<?php get_header(); ?>
	<div id="content" class="clearfix">
	<div id="blog-post"><!-- start BLOG section -->
	<?php menu(-1); ?>
	<div class="clearfix"></div>
						<div class="page-title mt37">
							<h2 class="titleH2"><?php _e('Search Results','pego_tr'); ?></h2>
							<span class="shortDesc11">}</span><p class="shortDesc12">Results found...</p>
		
						</div>
					</div>
		<div id="main-left search-content" class="fl">
	<?php 
	$items=0;
	$news=0;	
	?>
	<?php if (have_posts()) : ?>

		<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>
		<?php while (have_posts()) : the_post(); ?>
		
			<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
			<?php setPostViews(get_the_ID()); ?><!--  counting views of post -->
			<?php
				$items++;
				$postType = get_post_meta($post->ID, 'post_type_selected' , true); 
				if($postType == 'News'){ $news++; continue;}
	      ?>	

				<p class="blog-post-date"><?php the_time('F j, Y') ?></p>
					<h3 class="blog-post-title blogposttitleExtra"><?php the_title(); ?></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="clearfix"></div>
				<div class="blog-line mt15"></div>

				<div class="entry">
				
				<?php if( get_post_type() == 'portfolio') { ?><div class="clearfix"></div>
					<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
					<div class="one-third-search fl"><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"><p><?php the_excerpt(); ?></p>
					
					
					<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" class="readmore colorFFF"><span><?php _e('View','pego_tr'); ?></span></a>
					</div>				
				<?php  }
				else
				if( get_post_type() == 'post') { ?>
				<div class="clearfix"></div>
					<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>
					<div class="one-third-search fl mr20"><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-3"><p><?php the_excerpt(); ?></p>
					<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" class="readmore colorFFF"><span><?php _e('View','pego_tr'); ?></span></a>
					
					
					</div>	
					
								
				
				<?php  }
				else
				
				if( get_post_type() == 'page'){
				$content= get_the_excerpt();
					 ?>					 	
					 		<p><?php the_excerpt(); ?></p>
					 		<div class="readmore"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php _e('View page','pego_tr'); ?></a></div>
							<?php }
	?>
					<div class="clear"></div>
					<div class="fullwidth-seperator mb-24"></div>
				</div>
			</div>
				</div> <!-- end main left -->

		<?php endwhile; ?>

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

	<?php else : ?>
		 <div class="search-nothing fl">
		<h2><?php _e('No posts found.','pego_tr'); ?></h2>
		<p><?php _e('Ooopppssss... There is nothing to found!','pego_tr'); ?>
		<br /><br />
		<?php _e('Please try again.','pego_tr'); ?>
		</p>
		</div>
	<?php endif; ?>

		
		<?php 
	if(($items == $news)&&($items != 0)) { ?>
	<div class="search-nothing-news fl"> 
		<h2><?php _e('No posts found.','pego_tr'); ?></h2>
		<p><?php _e('Ooopppssss... There is nothing to found!','pego_tr'); ?>
		<br /><br />
		<?php _e('Please try again.','pego_tr'); ?>
		</p>
		</div>
	<?php
	}
	?>

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

</div>
</div>



<?php get_footer(); ?>
