<?php
global $options;
foreach ($options as $value) {
    if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
}
?>
<?php get_header(); ?>
 
	<div id="middle">
       
		<div id="posts">
   
		<?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()) { ?>
				<h3 class="recent">Archive for the <strong>&#8216;<?php single_cat_title(); ?>&#8217;</strong> category</h3 class="recent">
				<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
				<h3 class="recent">Posts Tagged &#8216;<?php single_tag_title(); ?>&#8217;</h3 class="recent">
				<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
				<h3 class="recent">Archive for <?php the_time('F jS, Y'); ?></h3 class="recent">
				<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
				<h3 class="recent">Archive for <?php the_time('F, Y'); ?></h3 class="recent">
				<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
				<h3 class="recent">Archive for <?php the_time('Y'); ?></h3 class="recent">
				<?php /* If this is an author archive */ } elseif (is_author()) { ?>
				<h3 class="recent">Author Archive</h3 class="recent">
				<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
				<h3 class="recent">Blog Archives</h3 class="recent">
				<?php } ?>
		
			<?php while (have_posts()) : the_post(); ?>
			<div class="homepost">
			 
				<div class="thumb">
					<a href="<?php echo get_permalink($_post->ID); ?>">
						<?php unset($photo);
						if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail() ) {
						  the_post_thumbnail(array(130,9999, true)); 
						}
						else{ 
							if (!$photo)
							{
							  $photo = catch_that_image($post->ID);
							}
						  } // if CF not used
						  if ($photo)
						  {
							?>
							<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?w=130&amp;h=90&amp;zc=1&amp;src=<?php echo $photo; ?>" alt="<?php the_title(); ?>" /></a>
							<?php  
						  }
						?> 
					</a>
				</div>
				
				<div class="rightcontp">
					<div class="bubble"><?php comments_popup_link('0', '1', '%', ' ', ' '); ?></div>
					<h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a> </h3>
					<?php the_excerpt(); ?>
					<div class="post-meta">Published by <?php the_author_posts_link(); ?> on <?php the_time('F jS, Y') ?> at <?php the_time('h:m a') ?></div>
				</div>
				
			</div>
			<?php endwhile; ?>
 		   
		   
		</div> <!-- end posts --> 
 
		
		
		<div class="navigation">
		
			<?php if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
			
				<div class="floatleft"><?php next_posts_link( __('&laquo; Older Entries', '') ); ?></div>
				<div class="floatright"><?php previous_posts_link( __('Newer Entries &raquo;', '') ); ?></div>
			
			<?php } ?>
			
		</div>
		
		
	  
	</div><!-- end middle -->


	<?php else : ?>

	<h2>Not Found</h2>
 
	<?php endif; ?>
	
	
<?php get_sidebar(); ?>
 
<?php get_footer(); ?>