<?php echo $header; ?>
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<?php if (isset($success)) { ?>
	<div class="success"><?php echo $success; ?></div>
<?php } ?>
<div class="breadcrumb" style="display:block;">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
</div>
<?php echo $column_left; ?>
<?php echo $column_right; ?>
<div id="content" class="twelve columns">
    <?php echo $content_top; ?>

	<?php if ($post) { ?>
		<div class="content8 blog-module blog-post">
            <div class="wrapper">
                <h3 class="pull-left title">POSTS</h3>
            </div>

            <div class="blog-post-view post">
                <h3 class="teaser"><?php echo $post['title'];?></h3>
                <p><?php echo date('F j, Y',strtotime($post['posted_date']));?> by <?=$post['poster_name']?></p>
                <?php if ($thumb) : ?>
                <div class="image image-detail">
                    <a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="colorbox"><img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" id="image" /></a>
                </div>
                <?php endif; ?>


                <?php if ($thumb || $images) { ?>
                    <?php if ($images) { ?>
                    <div class="image image-additional">
                        <?php foreach ($images as $image) { ?>
                        <a href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>" class="colorbox"><img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a>
                        <?php } ?>
                    </div>
                    <?php } ?>
                <?php } ?>
                <?php echo html_entity_decode($post['description']);?>

				<div class="storycontent b-description">
					<?php if(strlen(trim($post['tags']))) : ?>
					<h4><?=$text_related_tags?></h4>
					<div class="post_related_tags">
						<?php
						$tag_arr = explode(',', $post['tags']);
						$tag_links = array();
						foreach($tag_arr as $itag){
							$itag = trim($itag);
							$tag_links[] = '<a href="/index.php?route=blog/post&filter_tag='.$itag.'">'.$itag.'</a>';
						}
						echo implode(', ', $tag_links);
						?>
					</div>
					<?php endif; ?>
				</div> 
				<style>#socialbuttonnav li{list-style:none;overflow:hidden;margin:1 auto;background:none;overflow:hidden;width:92px; height:25px; line-height:10px; margin-right:1px; padding: 20px 0px 0px 0px; float:left; text-align:center;}</style>
				<?php
function curPageURL() {
 $pageURL = 'http';
 if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
?>

<ul id="socialbuttonnav">
<li><!-- Facebook like--><iframe src="http://www.facebook.com/plugins/like.php?href=<?=urlencode(curPageURL());?>&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21&amp;appId=220231561331594" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe></li>
<li><!-- Google plus one--><div class="g-plusone" data-size="tall" data-annotation="inline" data-width="120"></div></li>
<li><!-- Twitter--><a name="twitter_share" data-count="horizontal" href="http://twitter.com/share" class="twitter-share-button" >Tweet</a></li>
<li><!-- Buffer--><a href="http://bufferapp.com/add" class="buffer-add-button" data-count="horizontal" >Buffer</a><script type="text/javascript" src="http://static.bufferapp.com/js/button.js"></script></li>
<li><!-- linkedin--><div><script src="//platform.linkedin.com/in.js" type="text/javascript">
 lang: en_US
</script>
<script type="IN/Share" data-counter="right"></script></div></li>
<li><!-- stumbleupon--><div><script src="http://www.stumbleupon.com/hostedbadge.php?s=1"></script></div></li>
<li><!-- Pinterest like--><span class="pinwidget"><a class="" href="//www.pinterest.com/pin/create/button/" data-pin-do="buttonBookmark">&nbsp;</a></span></li>

</ul>
        </div>
            <div class="comments">
                <div class="divider"></div>

                <div class="wrapper_block" id="content-title">
                    <h3 class="pull-left title">ADD COMMENT</h3>
                </div>

                <?php if ($comment_status) : ?>
                <div class="wrapper">
                    <div class="six columns alpha">
                        <label><?php echo $entry_name; ?></label>
                        <input class="full-width" type="text" name="name" value="" />
                    </div>
                    <div class="six columns omega">
                        <label><?php echo $entry_email; ?></label>
                        <input class="full-width" type="text" name="email" value="" />
                    </div>
                </div>
                <label><?php echo $entry_comment; ?></label>
                <textarea name="comment" cols="1" rows="20" class="full-width" style="height:190px;"></textarea>
                <span style="font-size: 11px;"><?php echo $text_note; ?></span>
                <br />
                <label><?php echo $entry_captcha; ?></label>
                <br />
                <input type="text" name="captcha" value="" />
                <br />
                <img src="index.php?route=product/product/captcha" alt="" id="captcha" />
                <br />

                <div class="button_outer inline">
                    <a id="button-comment" class="button button_form"><?php echo $button_continue; ?></a>
                </div>





                <?php endif; ?>
                <div id="comments"></div>

            </div>


		</div> 
	<?php } else { ?>
		<div class="content"><?php  echo $text_empty; ?></div>
		<div class="buttons">
			<div class="right"><a href="<?php echo $continue; ?>" class="button"><span><?php echo $button_continue; ?></span></a></div>
		</div>
	<?php } ?>
	<?php echo $content_bottom; ?>
</div>
<script type="text/javascript"><!--
$('#comments .pagination a').live('click', function() {
	$('#comments').slideUp('slow');
		
	$('#comments').load(this.href);
	
	$('#comments').slideDown('slow');
	
	return false;
});			

$('#comments').load('index.php?route=blog/comment&blog_post_id=<?php echo $blog_post_id; ?>');

$('#button-comment').bind('click', function() {
	$.ajax({
		url: 'index.php?route=blog/comment/write&blog_post_id=<?php echo $blog_post_id; ?>',
		type: 'post',
		dataType: 'json',
		data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&email=' + encodeURIComponent($('input[name=\'email\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'comment\']').val()) + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
		beforeSend: function() {
			$('.success, .warning').remove();
			$('#button-comment').attr('disabled', true);
			$('#content-title').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
		},
		complete: function() {
			$('#button-comment').attr('disabled', false);
			$('.attention').remove();
		},
		success: function(data) {
			if (data.error) {
				$('#content-title').after('<div class="warning">' + data.error + '</div>');
			}
			
			if (data.success) {
				$('#content-title').after('<div class="success">' + data.success + '</div>');
				
				/* Comment Form Reseting */
				$('input[name=\'name\']').val('');
				$('input[name=\'email\']').val('');
				$('textarea[name=\'comment\']').val('');
				$('input[name=\'captcha\']').val('');
			}
		}
	});
});
//--></script> 
<script type="text/javascript"><!--
$(document).ready(function() {
	$('.colorbox').colorbox({
		overlayClose: true,
		opacity: 0.5,
		rel: "colorbox"
	});
});
//--></script> 
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<script src="http://platform.linkedin.com/in.js" type="text/javascript"></script>
<script type="text/javascript" async src="//assets.pinterest.com/js/pinit.js"></script>
<?php echo $footer; ?> 