<?php if ($mod==""){
	header('location:../../404.php');
}else{
?>
<!-- 
*******************************************************
	Include Header Template
******************************************************* 
-->
<?php include_once "po-content/$folder/header.php"; ?>

<!-- 
*******************************************************
	Main Content Template
******************************************************* 
-->
	<div id="content" class="container">
		<div id="main" class="row-fluid">
			<div id="main-left" class="span8">
				<div id="slider" class="clearfix">
					<div id="slide-left" class="flexslider span12">
						<ul class="slides">
						<?php
							$tableslider = new PoTable('post');
							$sliders = $tableslider->findAllLimitBy(id_post, active, 'Y', DESC, '4');
							foreach($sliders as $slider){
						?>
							<li>
								<a href="<?php echo "detailpost-$slider->id_post-$slider->seotitle.html"; ?>" title="<?php echo $slider->title; ?>" rel="bookmark">
									<img width="546" height="291" src="po-content/po-upload/<?php echo $slider->picture; ?>" alt="<?php echo $slider->title; ?>" />
								</a>
								<div class="entry">
									<h4><?php echo $slider->title; ?></h4>
									<p><?php echo cuthighlight('post', $slider->content, '100'); ?>...</p>
								</div>
							</li>
						<?php
							}
						?>
						</ul>
					</div>
				</div>
				
				<div id="home-middle" class="clearfix">
					<div class="left span6">
						<h3 class="title"><a href="#" title="Game News"><span>PopojiCMS</span></a></h3>
						<div class="row-fluid">
						<?php
							$tablecon1a = new PoTable('post');
							$con1as = $tablecon1a->findAllLimitByAnd(id_post, id_category, active, '1', 'Y', DESC, '1');
							foreach($con1as as $con1a){
						?>
							<article class="post">
								<a class="image_thumb_zoom" href="<?php echo "detailpost-$con1a->id_post-$con1a->seotitle.html"; ?>" title="<?php echo $con1a->title; ?>" rel="bookmark">
								<img width="371" height="177" src="po-content/po-upload/medium-<?php echo $con1a->picture; ?>" class="attachment-post-first wp-post-image" alt="<?php echo $con1a->title; ?>" />
								</a>
								<h4 class="post-title">
								<a href="<?php echo "detailpost-$con1a->id_post-$con1a->seotitle.html"; ?>" title="<?php echo $con1a->title; ?>" rel="bookmark"><?php echo cuthighlight('title', $con1a->title, '30'); ?>...</a>
								<span class="date"><?php echo tgl_indo($con1a->date); ?></span>
								</h4>
								<p><?php echo cuthighlight('post', $con1a->content, '50'); ?>...</p>
							</article>
						<?php } ?>
						<?php
							$tablecon1b = new PoTable('post');
							$con1bs = $tablecon1b->findAllLimitByAnd(id_post, id_category, active, '1', 'Y', DESC, '1,2');
							foreach($con1bs as $con1b){
						?>
							<article class="post">
								<div class="entry clearfix">
									<a href="<?php echo "detailpost-$con1b->id_post-$con1b->seotitle.html"; ?>" title="<?php echo $con1b->title; ?>" rel="bookmark">
									<img width="225" height="136" src="po-content/po-upload/medium-<?php echo $con1b->picture; ?>" class="thumb" alt="<?php echo $con1b->title; ?>" />
									<h4 class="post-title"><?php cuthighlight('title', $con1b->title, '30'); ?>...</h4>
									</a>
									<p><?php echo cuthighlight('post', $con1b->content, '50'); ?>...</p>
									<div class="meta">
										<span class="date"><?php echo tgl_indo($con1b->date); ?></span>
									</div>
								</div>
							</article>
						<?php } ?>
							<div class="clearfix"></div>
						</div>
					</div>

					<div class="right span6">
						<h3 class="title"><a href="#" title="Sport News"><span>Internet</span></a></h3>
						<div class="row-fluid">
						<?php
							$tablecon2a = new PoTable('post');
							$con2as = $tablecon2a->findAllLimitByAnd(id_post, id_category, active, '7', 'Y', DESC, '1');
							foreach($con2as as $con2a){
						?>
							<article class="post">
								<a class="image_thumb_zoom" href="<?php echo "detailpost-$con2a->id_post-$con2a->seotitle.html"; ?>" title="<?php echo $con2a->title; ?>" rel="bookmark">
								<img width="371" height="177" src="po-content/po-upload/medium-<?php echo $con2a->picture; ?>" class="attachment-post-first wp-post-image" alt="<?php echo $con2a->title; ?>" />
								</a>
								<h4 class="post-title">
								<a href="<?php echo "detailpost-$con2a->id_post-$con2a->seotitle.html"; ?>" title="<?php echo $con2a->title; ?>" rel="bookmark"><?php echo cuthighlight('title', $con2a->title, '30'); ?>...</a>
								<span class="date"><?php echo tgl_indo($con2a->date); ?></span>
								</h4>
								<p><?php echo cuthighlight('post', $con2a->content, '50'); ?>...</p>
							</article>
						<?php } ?>
						<?php
							$tablecon2b = new PoTable('post');
							$con2bs = $tablecon2b->findAllLimitByAnd(id_post, id_category, active, '7', 'Y', DESC, '1,2');
							foreach($con2bs as $con2b){
						?>
							<article class="post">
								<div class="entry clearfix">
									<a href="<?php echo "detailpost-$con2b->id_post-$con2b->seotitle.html"; ?>" title="<?php echo $con2b->title; ?>" rel="bookmark">
									<img width="225" height="136" src="po-content/po-upload/medium-<?php echo $con2b->picture; ?>" class="thumb wp-post-image" alt="<?php echo $con2b->title; ?>" />
									<h4 class="post-title"><?php echo cuthighlight('title', $con2b->title, '30'); ?>...</h4>
									</a>
									<p><?php echo cuthighlight('post', $con2b->content, '50'); ?>...</p>
									<div class="meta">
										<span class="date"><?php echo tgl_indo($con2b->date); ?></span>
									</div>
								</div>
							</article>
						<?php } ?>
							<div class="clearfix"></div>
						</div>
					</div>
				</div>

				<div id="home-bottom" class="clearfix">
					<h3 class="title"><a href="#" title="Fashion News"><span>Olahraga</span></a></h3>	
					<div class="row-fluid">
					<?php
						$tablecon3a = new PoTable('post');
						$con3as = $tablecon3a->findAllLimitByAnd(id_post, id_category, active, '9', 'Y', DESC, '1');
						foreach($con3as as $con3a){
					?>
						<div class="span6">
							<article class="post">
								<a class="image_thumb_zoom" href="<?php echo "detailpost-$con3a->id_post-$con3a->seotitle.html"; ?>" title="<?php echo $con3a->title; ?>" rel="bookmark">
								<img width="371" height="177" src="po-content/po-upload/medium-<?php echo $con3a->picture; ?>" alt="<?php echo $con3a->title; ?>" />
								</a>
								<h4 class="post-title">
								<a href="<?php echo "detailpost-$con3a->id_post-$con3a->seotitle.html"; ?>" title="<?php echo $con3a->title; ?>" rel="bookmark"><?php echo cuthighlight('title', $con3a->title, '30'); ?>...</a>
								<span class="date"><?php echo tgl_indo($con3a->date); ?></span>
								</h4>
								<p><?php echo cuthighlight('post', $con3a->content, '50'); ?>...</p>
							</article>
						</div>
					<?php } ?>
						<div class="span6">
						<?php
							$tablecon3b = new PoTable('post');
							$con3bs = $tablecon2b->findAllLimitByAnd(id_post, id_category, active, '9', 'Y', DESC, '1,3');
							foreach($con3bs as $con3b){
						?>
							<article class="post">
								<div class="entry clearfix">
									<a href="<?php echo "detailpost-$con3b->id_post-$con3b->seotitle.html"; ?>" title="<?php echo $con3b->title; ?>" rel="bookmark">
									<img width="225" height="136" src="po-content/po-upload/medium-<?php echo $con3b->picture; ?>" class="thumb" alt="<?php echo $con3b->title; ?>" />
									<h4 class="post-title"><?php echo cuthighlight('post', $con3b->title, '30'); ?>...</h4>
									</a>
									<p><?php echo cuthighlight('post', $con3b->content, '50'); ?>...</p>
									<div class="meta">
										<span class="date"><?php echo tgl_indo($con3b->date); ?></span>
									</div>
								</div>
							</article>
						<?php } ?>
							<div class="clearfix"></div>
						</div>
					</div>
				</div>

			</div><!-- #main-left -->

			<!-- 
			*******************************************************
				Include Sidebar Template
			******************************************************* 
			-->
			<?php include_once "po-content/$folder/sidebar.php"; ?>
			
			<div class="clearfix"></div>

			<div id="gallery">
				<h3 class="title"><span>Cuplikan Galeri</span></h3>
					<ul class="gallery">
					<?php
						$tablegallery = new PoTable('gallery');
						$gallerys = $tablegallery->findAllLimit(id_gallery, DESC, '20');
						foreach($gallerys as $gallery){
							$idalb = $gallery->id_album;
							$tablecalb = new PoTable('album');
							$currentCalb = $tablecalb->findBy(id_album, $idalb);
							$currentCalb = $currentCalb->current();
							if ($currentCalb->active == 'Y'){
					?>
						<li class="galleries">
							<a class="image_thumb_zoom" href="po-content/po-upload/<?php echo $gallery->picture; ?>" title="<?php echo $gallery->title; ?>" rel="prettyPhoto">
								<img width="225" height="136" src="po-content/po-upload/medium-<?php echo $gallery->picture; ?>" alt="<?php echo $gallery->title; ?>" />
							</a>
							<h4 class="post-title clearfix"><?php echo "$currentCalb->title - $gallery->title"; ?></h4>
						</li>
					<?php
							}
						} 
					?>
					</ul>
			</div>
		</div><!-- #main -->
	</div><!-- #content -->


<!-- 
*******************************************************
	Include Footer Template
******************************************************* 
-->
<?php include_once "po-content/$folder/footer.php"; ?>
<?php } ?>