<?php get_header(); ?>

	<!--SITE CONTENTS-->
	<div id="site-contents">

		<h2 class="ptitle">
			<?php
			if(get_option('luna_hide_welcome')!="true") {
				?>
				<!--SLIDE TEXT-->
				<div class="slide-text">
					<h1><?php echo get_option( 'luna_welcome_title' ); ?></h1>
					<span class="subtext"><?php echo get_option( 'luna_welcome_subtitle' ); ?></span>
				</div>
				<?php
			}
		?>
			<?php $pages = get_page_by_path( 'blog', 'page' ); ?>
			<label><?php echo get_post_meta( $pages->ID, "subtitle", true ); ?></label>
		</h2>

		<!--INSIDE CONTENT-->
		<div class="inside-content clear">

			<!--LEFT CONTAINER-->

			<?php
				if(get_option( 'luna_blog_sidebar_type' ) == "Right") {
					?><div class="left-container"><?php
				}elseif(get_option( 'luna_blog_sidebar_type' ) == "Left") {
					?><div class="right left-container"><?php
				}else {
					?><div class="left-container"><?php
				}
			?>

				<!--BLOG LIST-->
				<div class="blog-list">
					<h5><?php if(get_option('luna_hblog_header')!="") { echo get_option('luna_hblog_header'); } else { _e( 'Blog Posts', 'luna_lang' ); } ?></h5>
					<?php
						while (have_posts()) : the_post();
					?>
					<div class="single-blog-post">
						<?php
							if ( ( function_exists( 'get_post_format' ) && 'image' == get_post_format( $post->ID ) )  ) {
															
							}elseif ( ( function_exists( 'get_post_format' ) && 'video' == get_post_format( $post->ID ) )  ) { 
								if(get_post_meta( $post->ID, "video_site", true ) == "youtube") {
									?>
									<iframe width="622" height="259" src="<?php echo get_post_meta( $post->ID, "video", true ); ?>" frameborder="0" allowfullscreen></iframe>
									<?php
								}elseif(get_post_meta( $post->ID, "video_site", true ) == "vimeo") {
									?>
									<iframe width="622" height="259" src="<?php echo get_post_meta( $post->ID, "video", true ); ?>" frameborder="0" allowfullscreen></iframe>
									<?php
								}else {
									?>
									<a href="<?php echo get_post_meta( $post->ID, "video", true ); ?>" style="display:block;width:622px;height:350px" class="fplayer" id="player-<?php echo $post->ID; ?>"></a>
									<script type="text/javascript">
										flowplayer("player-<?php echo $post->ID; ?>", "<?php echo get_template_directory_uri(); ?>/js/flowplayer/flowplayer-3.2.15.swf", { 
											clip:{ autoPlay:false,autoBuffering:false } 
										});
									</script>
									<?php
								}											
							}
						?>
						<?php
							if ( has_post_thumbnail() ) {
								?><span class="tail-large">&nbsp;</span><?php
							}
						?>
						<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
						<span class="details"><?php the_time('d F'); ?> on <?php the_category(', ') ?> &nbsp; <?php the_tags('Tags: ', ', ', ''); ?> </span>
						<?php the_content(); ?>
					</div>
					<?php
						endwhile; 					
					?>
				</div>

				<!--AUTHOR DETAILS-->
				<?php
					if(get_option('luna_hide_author_details') != "true") {
						?>
						<div class="author-details">
							<?php echo get_avatar( get_the_author_meta('email'), '50' ); ?>
							<label><span><?php _e( 'Author', 'luna_lang' ); ?></span> <?php the_author_meta('user_nicename'); ?></label>
							<p><?php the_author_meta('description'); ?></p>
							<ul>
								<li><a href="<?php the_author_meta('user_url'); ?>"><img src="<?php echo get_template_directory_uri(); ?>/img/icons/awebsite.png" alt="" title="" /></a></li>
								<li><a href="mailto:<?php the_author_meta('user_email'); ?>"><img src="<?php echo get_template_directory_uri(); ?>/img/icons/aemail.png" alt="" title="" /></a></li>
								<li><a href="http://twitter.com/<?php the_author_meta('twitter'); ?>"><img src="<?php echo get_template_directory_uri(); ?>/img/icons/atwitter.png" alt="" title="" /></a></li>
								<li><a href="http://facebook.com/<?php the_author_meta('facebook'); ?>"><img src="<?php echo get_template_directory_uri(); ?>/img/icons/afacebook.png" alt="" title="" /></a></li>
							</ul>
						</div>
						<?php
					}
				?>
				
				<?php comments_template();	?>	

			</div>

			<?php
				if(get_option( 'luna_blog_sidebar_type' ) == "Right") { ?> <div class="sidebar"> <?php }
				elseif(get_option( 'luna_blog_sidebar_type' ) == "Left") { ?><div class="left sidebar"><?php }
				else { ?> <div class="sidebar"> <?php }
				if($sidebar_choice == "Default") {
					get_sidebar( 'blog' );
				}else {
					get_custom_sidebar(); 
				}
			?>
			</div>

		</div>

	</div>
	

<?php get_footer(); ?>