<?php 
/*
 *  This page template is used to display category post indexes. 
 *
 *  @package Portfolio 
 *  @since Portfolio 1.0
 *
 */ 
 get_header(); ?>

<!-- #content -->
<div id="content">
	
	<!-- .row -->
	<div class="row portfolio">

		<?php if(of_get_option('category_portfolio') == 'one') { ?>
	
		<!-- BEGIN .twelve columns -->
		<div class="twelve columns">
		
			<h1 class="headline alt"><?php single_cat_title(); ?></h1>
		
			<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
			<?php $meta_box = get_post_custom($post->ID); $video = $meta_box['custom_meta_video'][0]; ?>
	                      
			<!-- BEGIN .portfolio-item -->
			<div class="portfolio-item"> 
	
	            <?php if ( $video ) : ?>
	                <div class="feature_vid"><?php echo $video; ?></div>
	            <?php else: ?>
	                <div class="feature_img"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'portfolio-large' ); ?></a></div>
	            <?php endif; ?>
	            
	            <?php if(of_get_option('display_portfolio_cat_info') == '1') { ?>
	                <div class="information">              
	                    <h2 class="title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
	                    <?php the_excerpt(); ?>
	                </div><!-- information -->
	            <?php } else { ?>
	            <?php } ?>
	
			<!-- END .portfolio-item -->
			</div>
	            
	    	<div class="clear"></div>
	
	  		<?php endwhile; ?>
	  		
			<div class="pagination">
				<?php if (function_exists("number_paginate")) { number_paginate(); } ?>
			</div>
		
			<?php else : // do not delete ?>
			
			<div class="article">
				<h1 class="headline"><?php _e("No Posts Found", 'organicthemes'); ?></h1>
				<p><?php _e("We're sorry, but no posts were found for this category.", 'organicthemes'); ?></p>
				<p><?php _e("Try searching for the page you are looking for or using the navigation in the header or sidebar.", 'organicthemes'); ?></p>
			</div>
		
		    <?php endif; // do not delete ?>
	
		<!-- END .twelve columns -->
		</div>
	        
	    <?php } else { ?>
	    
	    <?php if(of_get_option('category_portfolio') == 'two') { ?>
	
		<h1 class="headline alt"><?php single_cat_title(); ?></h1>
	                      
		<?php $first_or_second = 'first'; ?>
		<?php if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>
		<?php $meta_box = get_post_custom($post->ID); $video = $meta_box['custom_meta_video'][0]; ?>
		<?php global $more; $more = 0; ?>
	       
		<!-- BEGIN .six columns -->
		<div class="six columns <?php echo $first_or_second; ?>">
		<?php $first_or_second = ('first'==$first_or_second) ? 'second' : 'first'; ?> 
	
			<!-- BEGIN .portfolio-item -->
			<div class="portfolio-item">
	
	    		<?php if ( $video ) : ?>
	        			<div class="feature_vid"><?php echo $video; ?></div>
	    		<?php else: ?>
	        			<div class="feature_img"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'portfolio-medium' ); ?></a></div>
	    		<?php endif; ?>
	        
	        	<?php if(of_get_option('display_portfolio_cat_info') == '1') { ?>
	        	    <div class="information">              
	        	        <h2 class="title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
	        	        <?php the_excerpt(); ?>
	        	    </div><!-- information -->
	        	<?php } else { ?>
	        	<?php } ?>
	        
			<!-- END .portfolio-item -->
	        </div>
	
		<!-- END .six columns -->
		</div>
	                            
		<?php endwhile; ?>
	
		<div class="pagination">
			<?php if (function_exists("number_paginate")) { number_paginate(); } ?>
		</div>
	
		<?php else : // do not delete ?>
	
		<div class="twelve columns">
		
			<div class="article">
				<h1 class="headline"><?php _e("No Posts Found", 'organicthemes'); ?></h1>
				<p><?php _e("We're sorry, but no posts were found for this category.", 'organicthemes'); ?></p>
				<p><?php _e("Try searching for the page you are looking for or using the navigation in the header or sidebar.", 'organicthemes'); ?></p>
			</div>
			
		</div><!-- .twelve columns -->
	
	    <?php endif; // do not delete ?>
	        
	    <?php } else { ?>
	        
		<h1 class="headline alt"><?php single_cat_title(); ?></h1>
	
		<?php $post_class = 'first'; ?>
		<?php if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>
		<?php $meta_box = get_post_custom($post->ID); $video = $meta_box['custom_meta_video'][0]; ?>
		<?php global $more; $more = 0; ?>
	            
		<!-- BEGIN .four columns -->
	   	<div class="four columns <?php echo $post_class; ?>">
	
			<!-- BEGIN .portfolio-item -->
			<div class="portfolio-item">
	            
	            <?php
	                if ('first' == $post_class){
	                  $post_class = 'second';
	                }elseif ('second' == $post_class){
	                  $post_class = 'third';
	                }else{
	                  $post_class = 'first';
	                }
	            ?>
	
	            <?php if ( $video ) : ?>
	                <div class="feature_vid"><?php echo $video; ?></div>
	            <?php else: ?>
	                <div class="feature_img"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'portfolio-small' ); ?></a></div>
	            <?php endif; ?>
	            
	            <?php if(of_get_option('display_portfolio_cat_info') == '1') { ?>
	                <div class="information">              
	                    <h2 class="title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
	                    <?php the_excerpt(); ?>
	                </div><!-- information -->
	            <?php } else { ?>
	            <?php } ?>
	
			<!-- END .portfolio-item -->
			</div>
	            
		<!-- END .four columns -->
	    </div>
	                            
		<?php endwhile; ?>
	
		<div class="pagination">
			<?php if (function_exists("number_paginate")) { number_paginate(); } ?>
		</div>
	
		<?php else : // do not delete ?>
	
		<div class="twelve columns">
		
			<div class="article">
				<h1 class="headline"><?php _e("No Posts Found", 'organicthemes'); ?></h1>
				<p><?php _e("We're sorry, but no posts were found for this category.", 'organicthemes'); ?></p>
				<p><?php _e("Try searching for the page you are looking for or using the navigation in the header or sidebar.", 'organicthemes'); ?></p>
			</div>
			
		</div><!-- .twelve columns -->
	
	    <?php endif; // do not delete ?>
	            
	    <?php } ?>
	    <?php } ?>
        
	<!-- END .row -->
    </div>

<!-- END #content -->
</div>

<?php get_footer(); ?>