<?php get_header();?>
<div id="content">
	<div id="posts" class="index">
	<?php
	if (have_posts()) {
		while (have_posts()) {
			the_post();?>
			<div class="single<?php echo ($posts[0]->ID == $post->ID ? " firstPost" : "");?>">
				<?php the_title("<h4><a href=\"".get_permalink()."\">","</a></h4>");?>
				<?php unset($firstCat); list($firstCat) = get_the_category(); ?>

				<div class="postMeta bullet<?php echo ($firstCat->term_id ? " cat-item-{$firstCat->term_id}" : "");?>">
					<?php
					$previousday = null; the_date("",__('Posted on ',THEMENAME));?>
					<?php _e('by',THEMENAME);?> <a href="<?php echo get_author_posts_url(get_the_author_ID()); ?>"><?php the_author();?></a>
					<?php comments_popup_link(__('and has no comments yet.',THEMENAME), __(' and has 1 comment.',THEMENAME), __(' and has % comments.',THEMENAME),"","");?>
					<?php edit_post_link(__('Edit',THEMENAME),"&nbsp;&nbsp;&nbsp;&nbsp;(",")"); ?>
				</div>

				<div class="postBody">
					<?php
					the_content(__('continue reading...',THEMENAME));

					wp_link_pages(array("before" => "<div class=\"pageLinks\">".__('Select a page',THEMENAME).":&nbsp", 'after' => "</div>", "next_or_number" => "number", "pagelink" => "<span>%</span>"));?>
				</div>
				<div class="clear"></div>
			</div>
			<?php
		}
	} else {?>
		<div class="postBody search">
			<h2>Sorry no pages matching your request were found.</h2>
			<p>Either hit the back button on your browser or use this search form to find what you where looking for.</p>
			<?php include (TEMPLATEPATH."/searchform.php");?>
		</div><?php
	}
	global $wp_query; /* To avoid orphaned tags showing up when there is no need for post_nav_link() the following checks for the need of it. */
	if ( $wp_query->max_num_pages > 1 && !is_singular()) {?>
		<div id="pageNavigation">
			<div id="previousPosts"><?php previous_posts_link(__('&laquo; Previous page',THEMENAME));?></div>
			<div id="nextPosts"><?php next_posts_link(__('Next page &raquo;',THEMENAME));?></div>
		</div><?php
	}?>
	</div>
	<?php get_sidebar(); ?>
	<span class="clear"></span>
</div>
<?php get_footer(); ?>
