<?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(); 

if(get_query_var('author_name')) :
$curauth = get_userdatabylogin(get_query_var('author_name'));
else :
$curauth = get_userdata(get_query_var('author'));
endif;

?>
<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 author archive */ if (is_author()) { ?>
		<h1><?php _e('Author Archive', 'tutspress');?>: <a href="<?php echo $curauth->user_url; ?>"><?php echo $curauth->display_name; ?></a></h1>
		<?php } ?>
	</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(); ?>