<?php
/**
 * The main template file.
 *
 * Www.20script.ir
 */
 
get_header();

$pp_slider_timer = get_option('pp_slider_timer'); 			
if(empty($pp_slider_timer))
{
    $pp_slider_timer = 5;
}

// Get featured posts
$pp_featured_cat = get_option('pp_featured_cat');
$pp_home_display_slide = TRUE; 
$featured_posts_arr = array();

$pp_slider_items = get_option('pp_slider_items');
if(empty($pp_slider_items))
{
	$pp_slider_items = 5;
}

if(isset($_SESSION['pp_slider_style']))
{
    $pp_slider_style = $_SESSION['pp_slider_style'];
}
else
{
    $pp_slider_style = get_option('pp_slider_style');
}
		
?>

		<input type="hidden" id="slider_timer" name="slider_timer" value="<?php echo $pp_slider_timer; ?>"/>
	
		<br class="clear"/>
	
		<div id="content_wrapper">
			
			<div class="inner">
			
				<!-- Begin main content -->
				<div class="inner_wrapper">
				
				<?php
					$pp_enable_featured = get_option('pp_enable_featured');
					
					if($pp_slider_style == 'small')
					{
						include_once (TEMPLATEPATH . "/templates/template-slide-1.php");
					}
					elseif($pp_slider_style == 'full' && !empty($pp_enable_featured))
					{
						include_once (TEMPLATEPATH . "/templates/template-slide-2.php");
				?>
					<div class="sidebar_content">
					
				<?php
					}
					elseif($pp_slider_style == 'full' && empty($pp_enable_featured))
					{
				?>
					<div class="sidebar_content" style="margin-left:10px">		
				
						<div class="sidebar_left_home_wrapper">
				<?php
					}
				?>
					
				<?php
					//Get homepage content	
					$pp_homepage_content = unserialize(get_option('pp_homepage_content_sort_data'));
	    			$has_homepage_content = get_option('pp_homepage_content');
	
	    			if(is_array($pp_homepage_content) && !empty($pp_homepage_content) && !empty($has_homepage_content))
	    			{
	    				$count_content = count($pp_homepage_content);
	    			
	    				foreach($pp_homepage_content as $key => $pp_homepage)
	    				{
	    					if(!empty($pp_homepage))
	    					{
	    						$content_array = explode("-", $pp_homepage);
	    						
	    						if(isset($content_array[0]) && $content_array[0] == 'blog' && isset($content_array[1]))
	    						{
		    						include (TEMPLATEPATH . "/templates/template-blog-".$content_array[1].".php");
		    						echo '<br class="clear"/>';
		    					}
		    					elseif(isset($content_array[0]) && $content_array[0] == 'cat' && isset($content_array[1]))
		    					{
		    						$content_category_id = $content_array[1];
			    					include (TEMPLATEPATH . "/templates/template-category.php");
		    					}
		    				}
		    			}
		    		}
					
					?>
					
					<?php
					if($pp_slider_style == 'small')
					{
					?>
					</div>
					<?php
					}
					?>
				</div>
					
					<div class="sidebar_wrapper">
						<div class="sidebar">
					    
					    	<div class="content">
					    
					    		<ul class="sidebar_widget">
					    		<?php dynamic_sidebar('Home Sidebar'); ?>
					    		</ul>
					    	
					    	</div>
					
					    </div>
					    <br class="clear"/>

					</div>
					
					<br class="clear"/>
				</div>
				<!-- End main content -->
				
			</div>

</div>

<?php get_footer(); ?>