<?php get_header(); ?>
<?php /* Get author data */
	if(get_query_var('author_name')) :
	$curauth = get_userdatabylogin(get_query_var('author_name'));
	else :
	$curauth = get_userdata(get_query_var('author'));
	endif;
?>
					
			<!--BEGIN #primary .hfeed-->
			<div id="primary" class="hfeed">
				
				<?php $blog = get_post(get_option('page_for_posts')); ?>	
				
				<?php if(!is_search()) { $post = $posts[0]; } // Hack. Set $post so that the_date() works. ?>
	            <?php /* If this is a category archive */ if (is_category()) { ?>
	                <h1 class="page-title"><?php printf(__('All posts in %s', 'framework'), single_cat_title('',false)); ?></h1>
	            <?php /* If this is a search */ } elseif (is_search()) { ?>
	                <h1 class="page-title"><?php _e('Search Results:', 'framework'); ?> "<?php echo $_GET['s']; ?>"</h1>
	            <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
	                <h1 class="page-title"><?php printf(__('All posts tagged %s', 'framework'), single_tag_title('',false)); ?></h1>
	            <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
	                <h1 class="page-title"><?php _e('Archive for', 'framework') ?> <?php the_time('F jS, Y'); ?></h1>
	             <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
	                <h1 class="page-title"><?php _e('Archive for', 'framework') ?> <?php the_time('F, Y'); ?></h1>
	            <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
	                <h1 class="page-title"><?php _e('Archive for', 'framework') ?> <?php the_time('Y'); ?></h1>
	            <?php /* If this is an author archive */ } elseif (is_author()) { ?>
	                <h1 class="page-title"><?php _e('All posts by', 'framework') ?> <?php echo $curauth->display_name; ?></h1>
	            <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
	                <h1 class="page-title"><?php _e('Blog Archives', 'framework') ?></h1>
	            <?php } else { ?>
	            	<h1 class="page-title">
	            	    <?php if( get_option('page_for_posts') == 0 ) { 
	            	        echo get_bloginfo('title'); // posts displayed on home page; grab the site title
	            	        $caption = get_bloginfo('description'); // no page caption; grab the site description
	            	    } else { 
	            	        echo $blog->post_title; // unique page as posts page; grab page title
	            	        $caption = get_post_meta($blog->ID, 'tz_caption', TRUE); // set our page caption
	            	    } ?>
	            	</h1>
	            	<?php
					    if( !empty($caption) ) { 
                            echo '<p class="page-caption">' . stripslashes(htmlspecialchars_decode(nl2br($caption))) . '</p>';
                        } ?>
                <?php } ?>
				
				<div class="hentry-wrap clearfix">
				
					<?php if (have_posts()) : while (have_posts()) : the_post();
					
					 // The following determines what the post format is and shows the correct file accordingly
                    $format = get_post_format();
                    get_template_part( 'includes/'.$format );
                    
                    if( empty($format) )
                        get_template_part( 'includes/standard' );

					endwhile;
					
					else : ?>

					    <!--BEGIN #post-0-->
    					<div id="post-0" class="hentry">
					
    						<h2 class="entry-title"><?php _e('Error 404 - Not Found', 'framework') ?></h2>
					
    						<!--BEGIN .entry-content-->
    						<div class="entry-content">
    							<p><?php _e("Sorry, but you are looking for something that isn't here.", "framework") ?></p>
    						<!--END .entry-content-->
    						</div>
					
    					<!--END #post-0-->
    					</div>
	
					<?php endif; ?>
				
				</div>

				<!--BEGIN .navigation .page-navigation -->
				<div class="navigation page-navigation">
					<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
					<div class="nav-next"><?php next_posts_link(__('&larr; Older Entries', 'framework')) ?></div>
					<div class="nav-previous"><?php previous_posts_link(__('Newer Entries &rarr;', 'framework')) ?></div>
					<?php } ?>
				<!--END .navigation .page-navigation -->
				</div>
	
			<!--END #primary .hfeed-->
			</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>