<?php
global $options;
foreach ($options as $value) {
    if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
}

$do_not_duplicate = array();
?>

<?php get_header(); ?>


	<?php if ( $paged < 2) { ?>

		<div id="featurespace">
		<?php	include(TEMPLATEPATH . '/featured.php'); ?> <!-- calling featured section-->
		</div>
		
	<?php } ?>

 
	<div id="middle">

		<?php if ( $paged < 2) { ?>	
			<?php	include(TEMPLATEPATH . '/homecats.php'); ?> <!-- calling homepage featured categories-->
		<?php  }  ?> 
		


		<!-- displaying Recent Articles-->
		<div id="posts">
	   
			<?php 
			
			  $z = count($wpzoom_exclude_cats_home);
			  if ($z > 0)
			  {
				$x = 0;
				$que = "";
				while ($x < $z)
				{
				  $que .= "-".$wpzoom_exclude_cats_home[$x];
				  $x++;
				  if ($x < $z) {$que .= ",";}
				}
			  }
			  
			  query_posts($query_string . "&cat=$que");
			
			if (have_posts()) : ?>
				 
				
			<h3 class="recent">Recent Articles</h3>
	 
			<?php while ($wp_query->have_posts()) : $wp_query->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 <strong><?php the_time('F jS, Y') ?></strong> at <strong><?php the_time('h:m a') ?></strong></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(); ?>