<?php
$layout = get_post_meta($post->ID, '_page_layout', true);
if(empty($layout) || $layout == 'default'){
	$layout=theme_get_option('blog','single_layout');
}
if(empty($layout) || $layout == 'default'){
	$layout = theme_get_option('general','layout');
	
}
?>
<?php  get_header();?>
<?php  theme_generator('introduce',$post->ID);?>
<div id="content-area">
	<div class="wrap-center <?php if($layout=='right'):?>right_sidebar<?php endif;?><?php if($layout=='left'):?>left_sidebar<?php endif;?><?php if($layout=='full'):?>full_width<?php endif;?>">
		<div id="content" class="main">
			<?php echo theme_generator('breadcrumbs',$post->ID);?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
			<article id="post-<?php the_ID(); ?>" class="post">
				<header>
<?php if(!theme_get_option('blog','show_in_header') && get_post_meta($post->ID, '_introduce_text_type', true) !='defalut'):?>
					<h1 class="meta-title"><?php the_title(); ?></h1>
					<div class="post-meta">
<?php echo theme_generator('post_meta',true); ?>
					</div>
<?php endif;?>
<?php

	$featured_image = get_post_meta($post->ID, '_featured_image', true);
	if($featured_image == '') $featured_image = 'default';
	if($featured_image != "false"){
		if(($featured_image == 'default' && theme_get_option('blog','featured_image')) || $featured_image == 'true'){
			echo theme_generator('blog_featured_image','full',$layout);
		}
	}

?>
				</header>
				
				<div class="post-content">
					<?php the_content(); ?>
					<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', THEME_FRONT_DOMAIN), 'after' => '</div>' ) ); ?>
				</div>
<?php if(theme_get_option('blog','entry_navigation')){
	theme_generator('blog_page_navgation');		
}
?>
<?php if(theme_get_option('blog','author')){
	theme_generator('author_box');		
}
?>
<?php if(theme_get_option('blog','related_popular')):?>
				<div class="related_popular_wrap">
					<div class="one_half">
						<?php echo theme_generator('blog_related_posts');?>
					</div>
					<div class="one_half last">
						<?php echo theme_generator('blog_popular_posts');?>
					</div>
					<div class="clear"></div>
				</div>
<?php endif;?>
			</article>
<?php endwhile;?>
<?php comments_template( '', true ); ?>
		</div>
		<?php if($layout != 'full') get_sidebar(); ?>
		<div class="clear"></div>
	</div>
</div>

<?php get_footer(); ?>
