<?php 
global $options;
foreach ($options as $value) {
    if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
}
$dateformat = get_option('date_format');
$timeformat = get_option('time_format');
get_header(); ?>

<div id="content">
<div class="wrap">
      
	<div class="teaser">
		<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
		<?php /* If this is a category archive */ if (is_category()) { ?>
		<h1><?php single_cat_title(); ?></h1>
		<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
		<h1><?php _e('Archive for', 'tutspress');?>: <?php single_tag_title(); ?></h1>
		<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
		<h1><?php _e('Archive for', 'tutspress');?>: <?php the_time('F jS, Y'); ?></h1>
		<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
		<h1><?php _e('Archive for', 'tutspress');?>: <?php the_time('F, Y'); ?></h1>
		<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
		<h1><?php _e('Archive for', 'tutspress');?>: <?php the_time('Y'); ?></h1>
		<?php /* If this is an author archive */ } ?>
		<?php echo category_description(); ?>
	</div><!-- end .teaser -->
	      
	<div class="column column-wide">
	      
		<div class="posts">
		      
			<?php
			wp_reset_query();
			
			$i = 0;
			if (have_posts()) : while (have_posts()) : the_post();
			$i++;
			update_post_caches($posts);
			?>
			
			<div class="post">
			        
				<h2><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
				          
				<div class="thumb"><?php 
					if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail() ) {
						$thumbURL = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), '' );
						$img = $thumbURL[0]; 
					}
						
					else {
						unset($img);
						if ($tutspress_cf_use == 'Yes')
						{
							$img = get_post_meta($post->ID, $tutspress_cf_photo, true);
						}
						else
						{
							if (!$img)
							{
								$img = catch_that_image($post->ID);
							}
						}
					}
					if ($img){ 
					$img = tutspress_wpmu($img);
					?><a href="<?php the_permalink(); ?>" rel="bookmark,nofollow" title="<?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $img ?>&amp;h=125&amp;w=200&amp;zc=1" height="125" width="200" alt="<?php the_title(); ?>" /></a>
					<?php }	?>
				</div>

				<div class="info"><p><?php the_content_limit('320'); ?>&nbsp;<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>" rel="nofollow"><?php _e('read more &raquo;', 'tutspress'); ?></a></p></div>
				        
				<div class="clear">&nbsp;</div>  
			
			</div><!-- end .post -->
			        
			<?php endwhile; endif; ?>
			        
			<div class="clear">&nbsp;</div>
		      
		</div><!-- end .posts -->
		      
		<div class="navigation">
			<p><span class="older"><?php next_posts_link(__('&lt; older entries', 'tutspress')); ?></span>  <span class="latest"><?php previous_posts_link(__('newer entries &gt;', 'tutspress')); ?></span></p>
		</div>
	      
	</div><!-- end .column .column-wide -->
	
	<div class="column column-narrow column-last">
		<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar: Content Pages') ) : ?><?php endif; ?>
	</div><!-- end .column .column-narrow .column-last -->
	      
	<div class="clear">&nbsp;</div>
	<div class="sep">&nbsp;</div>

</div><!-- end .wrap -->
</div><!-- end #content -->

<div class="clear">&nbsp;</div>

<?php get_footer(); ?>