<?php
/*
	Template Name: With Navigation Page
*/
?>
<?php get_header(); ?>


<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
					
					<!-- 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 container -->
					<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 page content -->
						<div class="page_content_with_categories clearfix">
						
							<?php the_content(); ?> 
								
							<div class="entry-utility">
							<?php if ( ('open' == $post->comment_status) && ('open' == $post->ping_status) ) :  ?>
							
							<br/><div class="page_line"></div>
							
							<?php endif; ?>
							</div>                                                                                                   
							<?php comments_template('', true); ?>   
							
						</div>
						<!-- end page content -->
						
					</div>
					<!-- end page container -->
				
<?php endwhile; endif;  ?>

<?php get_footer(); ?>