<?php get_header(); ?>

<?php if (have_posts()) : ?>
		
	<?php /* If this is a category archive */ if (is_category()) { ?>
	    <h1 class="archive-title"><?php single_cat_title(); ?></h1>
	    
 	<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
	    <h1 class="archive-title"><?php single_tag_title(); ?></h1>
	    
 	<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
	    <h1 class="archive-title"><?php _e('Archive',TS_DOMAIN); ?> <?php the_time(get_option('date_format')); ?></h1>
	    
 	<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
	    <h1 class="archive-title"><?php _e('Archive',TS_DOMAIN); ?> <?php the_time('F Y'); ?></h1>
	    
 	<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
	    <h1 class="archive-title"><?php _e('Archive',TS_DOMAIN); ?> <?php the_time('Y'); ?></h1>
	    
 	<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
	    <h1 class="archive-title"><?php _e('Archive',TS_DOMAIN); ?></h1>
	    
 	<?php } ?>

	<?php $i=1; while (have_posts()) : the_post(); ?>
	
		<?php if($i%2==0) : add_filter('post_class','ts_post_class_alt'); endif; ?>
		
		<div <?php if(function_exists('post_class')) : post_class(); else : echo 'class="post"'; endif; ?>>
		
			<?php if((function_exists('has_post_thumbnail')) && (has_post_thumbnail())) : ?>
				
			<div class="post-image"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_post_thumbnail('dl-thumb', array('alt' => ''.get_the_title().'', 'title' => ''.get_the_title().'')); ?><span class="overlay2"><img src="<?php echo TS_IMG; ?>overlay2.png" alt="<?php the_title(); ?>" width="280" height="160"/></span></a></div>
			
			<?php elseif(get_post_meta($post->ID, 'image_value', true)) : ?>
			
			<div class="post-image"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php bloginfo('template_url'); ?>/lib/scripts/thumb.php?src=<?php echo ts_image(get_post_meta($post->ID, "image_value", true)); ?>&amp;w=260&amp;h=140&amp;zc=1&amp;q=95" alt="<?php the_title(); ?>" width="260" height="140"/><span class="overlay2"><img src="<?php echo TS_IMG; ?>overlay2.png" alt="<?php the_title(); ?>" width="280" height="160"/></span></a></div>
			
			<?php endif; // endif post thumbnail ?>
	    
	    	<h3><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
	
	    	<?php the_content('',TRUE); ?>
	    	
	    	<?php the_more(); ?>
	    	
	    </div><!-- end post -->
	    
	    <?php if($i%2==0) : remove_filter('post_class','ts_post_class_alt'); ?>
	    
	    	<div class="content-space"></div>
	    
	    <?php endif; ?>
		
	<?php $i++; endwhile; ?>
		
	<?php include(TEMPLATEPATH . '/lib/inc/paging.php'); ?>
	
	<?php else : ?>
	
	<div class="post">

	    <h3><?php _e('Error 404, no posts found!',TS_DOMAIN); ?></h3>
	    <p><?php _e('Sorry, no posts matched your criteria.',TS_DOMAIN); ?></p>
	    <?php include (TEMPLATEPATH . "/searchform.php"); ?>
	
	</div>

<?php endif; ?>
	
<?php get_footer(); ?>