<?php
/*
	Template Name: Portfolio Style 4
*/
?>
<?php get_header(); ?>


<!-- begin page short cut -->
<div class="page_shortcut">
	<?php include (TEMPLATEPATH . '/includes/get_shortcut.php'); ?>
</div>
<!-- end page short cut -->

<!-- begin page title container -->
<div class="page_title_container">
	
	<!-- begin page title -->
	<div class="page_title">
		<div class="custom_title"><?php the_title(); ?> </div>
	</div>
	<!-- end page title -->


</div>
<!-- end page title container -->

<div class="page_line"></div>

<!-- begin page content -->
<div class="page_container">
  
	<!-- begin page navigation -->
	<div class="page_navigation_container">
		
		<?php 
			wp_reset_query();
			if($post->post_parent) {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->post_parent."&echo=0");
			} else {
				$children = wp_list_pages("title_li=&sort_column=menu_order&child_of=".$post->ID."&echo=0");
			}
			if ($children) { 
		?>
		<!-- begin navigation title -->
		<div class="page_navigation_title">
			<?php wp_reset_query(); if(intval($post->post_parent)>0){	while(intval($post->post_parent)>0)	$post = get_post($post->post_parent);	} echo "<h3>".get_the_title($post->post_parent)."</h3>";  wp_reset_query(); ?>
		</div>
		<!-- end navigation title -->
		
		<!-- begin navigation categories -->
		<ul class="site_left_menu">
			<?php echo create_page($post);?>
		</ul>
		<!-- begin navigation categories -->
		<?php } ?>
		
		<!-- begin custom navigation -->
			<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Right Widget 1 (All of Pages)')) ?>
			<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Right Widget 2 (All of Pages)')) ?>
			<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Right Widget 3 (All of Pages)')) ?>
			<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Right Widget 4 (All of Pages)')) ?>
			<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('Right Widget 5 (All of Pages)')) ?>
		<!-- begin custom navigation -->
	</div>
	<!-- begin page navigation -->
	
	<!-- begin content widt categories -->
	<div class="page_content_with_categories">
	
		<!-- begin portfolio container -->
		<div class="portfolio_container">

			<!-- begin portfolio container 1 -->
			<div class="portfolio_box_container clearfix">
				
				
				<?php if(have_posts()) : ?>
				<?php 
					
					$category_id =  get_post_meta($post->ID, "page_id", true);
					$limit = get_option('portfolio4_limit', 5);
					$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
					query_posts("cat=$category_id&showposts=$limit&paged=$paged");
					
					$i = 1;
					$culomns = 1;
					$padtop = get_option('portfolio4_thumb_height', '250')/2 - 40;
					$padleft = get_option('portfolio4_thumb_width', '620')/2 - 40;
				?>
				<?php while(have_posts()) : the_post(); 
				
					
				?>
				
				<!-- begin box 1 -->
				<div class="portfolio_box_skin_3" <?php if($i == $culomns){ echo 'style="padding-right:0;"'; } ?>>
					
					<?php if(get_post_meta($post->ID, "thumb_one", true) != "" or get_post_meta($post->ID, "video_one", true) != ""){ ?>
					<!-- begin box image -->
					<div class="portfolio_image_skin2">
						<div class="inside_border">
							<!-- begin image -->
							<div class="portfolio_box_anime">
								<?php if(get_post_meta($post->ID, "video_one", true) != ""){ ?>
								
								<?php echo get_post_meta($post->ID, "video_one", true); ?>
								
								<?php } else { ?>
								
								<?php if(get_post_meta($post->ID, "big_one", true) != ""){ ?>
								
								<a href="<?php echo get_post_meta($post->ID, "big_one", true); ?>" rel="prettyPhoto[canyon_gallery]">
								
								<?php } ?>
								
								<img src="<?php echo get_post_meta($post->ID, "thumb_one", true); ?>" width="<?php echo get_option('portfolio4_thumb_width', '620'); ?>" height="<?php echo get_option('portfolio4_thumb_height', '250'); ?>" alt=""/>
								
								<?php if(get_post_meta($post->ID, "big_one", true) != ""){ ?>
								
								<span class="portfolio_zoom" style="padding-top:<?php echo $padtop; ?>px; padding-left:<?php echo $padleft; ?>px;"><img src="<?php bloginfo('template_url'); ?>/images/zoom_<?php 
									$type = get_post_meta($post->ID, "big_one", true);
									$type =  substr($type, -4);
									if(get_post_meta($post->ID, "big_one", true) != ""){ 
										if($type == ".jpg" or $type == ".gif" or $type == ".png" or $type == ".jpeg" or $type == ".JPG" or $type == ".GIF" or $type == ".PNG" or $type == ".JPEG") { echo "image"; } else { echo "play"; }
									}
								?>.png" alt="" /></span>
								
								</a>
								<?php } } ?>
								
							</div>
							<!-- end image -->
						</div>
					</div>
					<!-- begin box image -->
					<?php } ?>
					
					<div class="cleardiv"></div>
					
					<!-- begin box details -->
					<div class="portfolio_details_with_categories_skin_2">
						
						<!-- begin box title -->
						<div class="portfolio_title">
							<div class="custom_title"><?php the_title(); ?></div>
						</div>
						<!-- end box title -->
						
						<!-- begin detail text -->
						<div class="portfolio_text"><?php echo get_post_meta($post->ID, "short_desc", true); ?>
						
							<?php if (get_option('disable_portfolio_details', 1) == '1'): ?>
							<div class="portfolio_details_button"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><span class="details_button"><?php echo get_option('portfolio_details_title', 'DETAILS'); ?></span></a></div>
							<?php endif; ?>
						
						</div>
						<!-- begin detail text -->
					</div>
					<!-- end box details -->

				</div>
				<!-- end box 1 -->
				<?php if($i == $culomns){ echo '</div><div class="portfolio_box_container clearfix">'; $i =0; } $i++; ?>
				<?php endwhile; endif; ?>
				
			</div>
			<!-- end portfolio container 1 -->
		

			<div class="cleardiv"></div>
			<!-- begin pages numbers -->
			<div class="pages_numbers">
				<?php include (TEMPLATEPATH . '/includes/get_pagination.php'); ?>
			</div>
			<!-- end pages numbers -->
				
		</div>
		<!-- end portfolio container -->
		
	</div>
	<!-- end content widt categories -->
	
</div>
<!-- end page content -->

<?php get_footer(); ?>