<?php get_header(); ?>

	<div id="content">

		<?php if (have_posts()) : ?>

		 <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>				
		<h1 class="pagetitle">Archive for the '<?php echo single_cat_title(); ?>' category</h1>
		
 	  <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
		<h1 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h1>
		
	 <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
		<h1 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h1>

		<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
		<h1 class="pagetitle">Archive for <?php the_time('Y'); ?></h1>
		
	  <?php /* If this is a search */ } elseif (is_search()) { ?>
		<h1 class="pagetitle">Search results</h1>
		
	  <?php /* If this is an author archive */ } elseif (is_author()) { ?>
		<h1 class="pagetitle">Author archive</h1>

		<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
		<h1 class="pagetitle">Complete archives</h1>

		<?php } ?>

		<div class="navigation"><div class="previous"><?php next_posts_link('&laquo; Older entries') ?></div><div class="next"><?php previous_posts_link('Newer entries &raquo;') ?></div></div>

<!-- google_ad_section_start -->

		<?php while (have_posts()) : the_post(); ?>
		<div class="post" id="post-<?php the_ID(); ?>">
				<h1 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1>
				<div class="postmetadata">by <?php the_author() ?> — published on <?php the_time('F jS, Y') ?> <?php edit_post_link('Edit this entry','',''); ?></div>
				
				<div class="entry">
					<?php the_content('Read the rest of this entry &raquo;'); ?>
				</div>

				<div class="postmetadata">
				<div class="comments-slug">
				<?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?>
				</div>
				<div class="categories-slug">
				categories: <?php the_category(', ') ?>
				</div>
				</div>

			</div>
	
			<?php ad_intermixed(); ?>

		<?php endwhile; ?>

<!-- google_ad_section_end -->

		<div class="navigation"><div class="previous"><?php next_posts_link('&laquo; Older entries') ?></div><div class="next"><?php previous_posts_link('Newer entries &raquo;') ?></div></div>

	<?php else : ?>

		<h1 class="center">Not Found</h1>
		<?php include (TEMPLATEPATH . '/searchform.php'); ?>

	<?php endif; ?>
		
	</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>
