<?php
/**
 * The main template file.
 *
 * @package WordPress
 */

session_start();
$pp_homepage_hide_slider = get_option('pp_homepage_hide_slider');
$pp_slider_timer = get_option('pp_slider_timer'); 
				
if(empty($pp_slider_timer))
{
    $pp_slider_timer = 5;
}
				
get_header(); ?>	
	
		<script type="text/javascript"> 
    	$j(function () {
    		$j.fancybox.showActivity;
    	});	
    	</script>		

		<input type="hidden" id="slider_timer" name="slider_timer" value="<?php echo $pp_slider_timer; ?>"/>
	
		<br class="clear"/>
		<div id="slider_wrapper">
			
			<?php
					include (TEMPLATEPATH . "/templates/template-slider-slide.php");
			?>
			
		</div>
		
		</div>
		<!-- End header -->
		
		<div class="wrapper_shadow"></div>
		
		<?php
				$pp_homepage_hide_tagline = get_option('pp_homepage_hide_tagline');
				
				if(!empty($pp_homepage_hide_tagline))
				{
					$pp_homepage_tagline_title = get_option('pp_homepage_tagline_title');
					if(empty($pp_homepage_tagline_title))
					{
						$pp_homepage_tagline_title = 'Built-in so many custom modification. You can control almost
every parts of the theme. Unlimited colors, fonts and many more...';
					}
			?>		
				
			<div class="tagline">
				<div class="tagline_inner">
					<h1 class="tagline_header cufon"><?php echo stripcslashes($pp_homepage_tagline_title); ?></h1>
				</div>
			</div>
			
			<?php
				} //end if hide tagline
			?>
			
			<!-- Begin content -->
			<div id="content_wrapper">
		
			<div class="inner">
			
				<!-- Begin main content -->
				<div class="inner_wrapper">
			
				<div class="standard_wrapper small">
					<br class="clear"/>
					
					<?php 
							if(isset($_SESSION['pp_home_style']))
							{
								switch($_SESSION['pp_home_style'])
								{
									case 1:
										$pp_homepage_content = array(1641, 11);
										break;
									case 2:
										$pp_homepage_content = array(11);
										break;
									case 3:
										$pp_homepage_content = array(50);
										break;
									case 4:
										$pp_homepage_content = array(1797);
										break;
									case 5:
										$pp_homepage_content = array(1638, 11);
										break;
									default:
										$pp_homepage_content = array(1641, 11);
										break;
								}
							}
							else
							{
								$pp_homepage_content = unserialize(get_option('pp_homepage_content_sort_data'));
							}
							
							global $wp_query;

							if(is_array($pp_homepage_content) && !empty($pp_homepage_content))
							{
							
								foreach($pp_homepage_content as $key => $pp_homepage)
								{
									$template_name = get_post_meta( $pp_homepage, '_wp_page_template', true );

									if(empty($template_name) OR $template_name == 'default')
									{
									    $obj_home = get_page($pp_homepage);
									    $pp_home_content = $obj_home->post_content;
									    
									    if($key > 0)
									    {
									    	echo '<br class="clear"/><div class="line_shadow"></div><br class="clear"/>';
									    }
									    
									    echo do_shortcode($pp_home_content);
									}
									else
									{
									    $hide_header = TRUE;
									    
									    if($key > 0)
									    {
									    	echo '<br class="clear"/><div class="line_shadow"></div><br class="clear"/>';
									    }
									    
									    if(file_exists(TEMPLATEPATH.'/'.$template_name))
									    {
									    	include(TEMPLATEPATH.'/'.$template_name);
									    }
									}
									
								if(isset($pp_homepage_content[$key+1]))
								{	
						?>
						
								<br class="clear"/><br/>
						
						<?php	}
									
								}
							}
						?>
				</div>
				
			<br class="clear"/>
		
		</div>
		</div>

<?php get_footer(); ?>