<?php if (basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) die ("Please don't do that.");?>

<?php get_header();?>
<div id="content">
	<div id="posts" class="single">
	<?php
	if (have_posts()) { while (have_posts()) { the_post();?>
		<div class="post">

			<?php the_title("<h1 class=\"underline\">",($page >= 2 ? __(' &roquo; Page',THEMENAME)." ".$page: "")."</h1>");?>
			<div class="postBody"><?php
				the_content("<span>".__('Read more',THEMENAME)."</span>");
				wp_link_pages(array('before' => '<div class="pageLinks">'.__('Select a page',THEMENAME).':&nbsp;', 'after' => '</div>', 'pagelink' => '<span>%</span>'))
				?>
			</div>
			<?php ?>
			<span class="clear"></span>
		</div><?php
		include (TEMPLATEPATH.'/postsidebar.php');
		comments_template('/comments.php',true);
		}
	} 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
	}

	/* To avoid orphaned tags showing up when there is no need for post_nav_link() the following checks for the need of it. */
	global $wp_query;
	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(); ?>
