<?php if ($mod==""){
	header('location:../../404.php');
}else{
?>
			<div id="sidebar" class="span4">

				<div id="tabwidget" class="widget tab-container"> 
					<ul id="tabnav" class="clearfix"> 
						<li><h3><a href="#tab1" class="selected"><img src="po-content/<?php echo $folder; ?>/images/view-white-bg.png" alt="Popular">Teratas</a></h3></li>
						<li><h3><a href="#tab2"><img src="po-content/<?php echo $folder; ?>/images/time-white.png" alt="Recent">Terbaru</a></h3></li>
						<li><h3><a href="#tab3"><img src="po-content/<?php echo $folder; ?>/images/komen-putih.png" alt="Comments">Komentar</a></h3></li>
					</ul> 

				<div id="tab-content">
				
				<div id="tab1" style="display: block; ">
					<ul id="itemContainer" class="recent-tab">
					<?php
						$tablepop = new PoTable('post');
						$pops = $tablepop->findAllLimitBy(hits, active, 'Y', DESC, '15');
						foreach($pops as $pop){
						$tablepopc = new PoTable('comment');
						$totalpop = $tablepopc->numRowByAnd(id_post, $pop->id_post, active, 'Y');
					?>
						<li>
							<a href="<?php echo "detailpost-$pop->id_post-$pop->seotitle.html"; ?>"><img width="225" height="136" src="po-content/po-upload/medium-<?php echo $pop->picture; ?>" class="thumb" alt="<?php echo $pop->title; ?>" /></a>
							<h4 class="post-title"><a href="<?php echo "detailpost-$pop->id_post-$pop->seotitle.html"; ?>"><?php echo $pop->title; ?></a></h4>
							<p><?php echo tgl_indo($pop->date); ?></p>
							<div class="clearfix"></div>				
						</li>
					<?php } ?>
						<script type="text/javascript">
							jQuery(document).ready(function($){

								/* initiate the plugin */
								$("div.holder").jPages({
								containerID  : "itemContainer",
								perPage      : 5,
								startPage    : 1,
								startRange   : 1,
								links		   : "blank"
								});
							});		
						</script>
					</ul>
					
					<div class="holder clearfix"></div>
					<div class="clear"></div>

				<!-- End most viewed post -->		  

				</div><!-- /#tab1 -->
	 
				<div id="tab2" style="display: none;">	
					<ul id="itemContainer2" class="recent-tab">
					<?php
						$tablerec = new PoTable('post');
						$recs = $tablerec->findAllLimitBy(id_post, active, 'Y', DESC, '5');
						foreach($recs as $rec){
							$validrec = $rec->id_category;
							$tablecatrec = new PoTable('category');
							$currentCatrec = $tablecatrec->findBy(id_category, $validrec);
							$currentCatrec = $currentCatrec->current();
					?>
						<li>
							<a href="<?php echo "detailpost-$rec->id_post-$rec->seotitle_id.html"; ?>"><img width="225" height="136" src="po-content/po-upload/medium-<?php echo $rec->picture; ?>" class="thumb" alt="<?php echo $rec->title; ?>" /></a>
							<h4 class="post-title"><a href="<?php echo "detailpost-$rec->id_post-$rec->seotitle_id.html"; ?>"><?php echo $rec->title; ?></a></h4>
							<p><a href="<?php echo "category-$currentCatrec->id_category-$currentCatrec->seotitle.html"; ?>"><?php echo $currentCatrec->title; ?></a> - <?php echo tgl_indo($rec->date); ?></p>
							<div class="clearfix"></div>	
						</li>
					<?php } ?>
					</ul> 	 
				</div><!-- /#tab2 --> 

				<div id="tab3" style="display: none; ">
					<ul>
					<?php
						$tablecom = new PoTable('comment');
						$coms = $tablecom->findAllLimitBy(id_comment, active, 'Y', DESC, '5');
						foreach($coms as $com){
							$validcom = $com->id_post;
							$tablecompo = new PoTable('post');
							$currentCompo = $tablecompo->findBy(id_post, $validcom);
							$currentCompo = $currentCompo->current();
					?>
						<li>
							<?php echo tgl_indo($currentCompo->date); ?> - <span class="author"><?php echo $com->name; ?></span> di <a href="<?php echo "detailpost-$currentCompo->id_post-$currentCompo->seotitle.html"; ?>" title="<?php echo $currentCompo->title; ?>"><?php echo $currentCompo->title; ?></a>
							<p><?php echo cuthighlight('post', $com->comment, '80'); ?>...</p>
						</li>
					<?php } ?>
					</ul>
				</div><!-- /#tab2 --> 
		
				</div><!-- /#tab-content -->

				</div><!-- /#tab-widget --> 

				<div class="widget"><h3 class="title"><span>Facebook Like</span></h3>
					<div class="widget_fb">
						<iframe src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpopojicms&amp;width=350&amp;height=258&amp;colorscheme=light&amp;show_faces=true&amp;header=false&amp;stream=false&amp;show_border=false&amp;appId=563897243660142" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:350px; height:258px;" allowTransparency="true"></iframe>
					</div>
				</div>

				<div class="widget"><h3 class="title"><span>Twitter Update</span></h3>
					<div id="tickertweet" class="tweet"></div>
					<div id="magz-twitter-follow-link"><a target="_blank" href="http://twitter.com/DwiraSurvivor">Follow Twitter</a></div>
				</div>

				<div class="widget"><h3 class="title"><span>Berlangganan RSS</span></h3>
					<p>Ayo berlangganan! Anda bisa mendapatkan update dari kami setiap ada postingan terbaru.</p>
					<form name="subscribe-form" id="magazine-subscribe-form" method="post" action="#">
						<input type="text" name="email_address" id="cf_email" value="" placeholder="Contoh: email_kamu@domain.com" />
						<input type="submit" name="submit" value="Berlangganan" id="cf_send_rss" />
					</form>
				</div>

			</div><!-- sidebar -->
<?php } ?>