<?php get_header(); ?>
	<div id="content" class="clearfix mh800">
	<div id="blog-post"><!-- start BLOG section -->
	<?php menu(-1); ?>
	<div class="clearfix"></div>
						<div class="page-title mt37" >
							<h2  class="titleH2"><?php _e('Archive','pego_tr'); ?></h2>
							<span class="shortDesc11">}</span><p class="shortDesc12">Our archive...</p>
		
						</div>
					</div>
		<div id="main-left" class="fl">

		<?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="archiveSearchFont"><?php _e('Archive for the','pego_tr'); ?> &#8216;<?php single_cat_title(); ?>&#8217; <?php _e('Category','pego_tr'); ?></h3>

			<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
				<h3 class="archiveSearchFont"><?php _e('Posts Tagged','pego_tr'); ?> &#8216;<?php single_tag_title(); ?>&#8217;</h3>

			<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
				<h3 class="archiveSearchFont"><?php _e('Archive for','pego_tr'); ?> <?php the_time('F jS, Y'); ?></h3>

			<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
				<h3 class="archiveSearchFont"><?php _e('Archive for','pego_tr'); ?> <?php the_time('F, Y'); ?></h3>

			<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
				<h3 class="archiveSearchFont"><?php _e('Archive for','pego_tr'); ?> <?php the_time('Y'); ?></h3>

			<?php /* If this is an author archive */ } elseif (is_author()) { ?>
				<h3 class="archiveSearchFont"><?php _e('Author Archive','pego_tr'); ?></h3>

			<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
				<h3 class="archiveSearchFont"><?php _e('Blog Archives','pego_tr'); ?></h3>
			
			<?php } ?>

			<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>

			<?php while (have_posts()) : the_post();     ?>
			<?php 
				$postType = get_post_meta($post->ID, 'post_type_selected' , true); 
				if($postType == 'News'){continue;}
			?>	
			
			
				<div <?php post_class() ?>>
					<p class="blog-post-date"><?php the_time('F j, Y') ?></p>
					<h3 class="blog-post-title blogposttitleExtra"><a href="<?php the_permalink() ?>" class="tdn"><?php the_title(); ?></a></h3>
					
				<div class="blog-line mt10"></div>
				<div class="blog-details">
					<ul>
						<li><span><?php echo getPostViews(get_the_ID()); ?></span> <?php _e('Views','pego_tr'); ?></li>
						<li>/</li>
						<li><span><?php comments_number( '0', '1', '%' ); ?></span> <?php _e('Comments','pego_tr'); ?> </li>
						<li>/</li>
						<li><span><?php _e('in','pego_tr'); ?> <a href="#"><?php the_category(', '); ?></a></span></li>
						<li>/</li>
						<li><span><?php _e('by','pego_tr'); ?> <?php the_author() ?></span></li>	
					</ul>
				</div>	
				<div class="blog-line mb15"></div>
					<div class="clearfix"></div>
						<?php 
							$content = get_post($post->ID)->post_content;
							if (strlen($content) > 353)
							{
								$content = substr($content,0,350).'...';
							}						
						?>	
            <div class="entry mt10">
				<?php if (get_post_type() == 'post') { 
				?>	
					<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
					<div class="one-third-search fl mt-10"><a href="<?php the_permalink() ?>"  class="lightbox-image"><img src="<?php echo get_template_directory_uri(); ?>/scripts/timthumb.php?src=<?php echo get_image_path($image[0]); ?>&h=129&w=208&zc=1" alt="" title="<?php the_title(); ?>" /></a></div>
					<div class="two-third-search last-column fl mt-15"><p><?php echo $content; ?></p></div>				
				<?php  }
				else {?>
							<p><?php echo $content; ?></p>	
				<?php } ?>
					
		    		<div class="clearfix"></div><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" class="readmore readmoreExtra" ><span>View</span></a>
				</div>
				</div>
			<?php endwhile; ?>
			<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>			
	<?php else : ?>
		<h2><?php _e('Nothing found','pego_tr'); ?></h2>

	<?php endif; ?>
</div>
		<div id="sidebar-right" class="fl mt-30" > 
			<?php get_sidebar(); ?>
		</div>
	</div>
</div>
<?php get_footer(); ?>
