<?php
/*
Template Name: Full Width Page
*/
?>
<?php
if (get_option('flex_content_trans') == "no") {
$fwpagewidth = get_option('flex_blog_width') - get_option('flex_blog_padding');
$fwcontentwidth = get_option('flex_blog_width') - (get_option('flex_blog_padding') * 2);
} else { 
$fwpagewidth = get_option('flex_blog_width');
$fwcontentwidth = get_option('flex_blog_width');
}
?>
<?php get_header(); ?>
<?php if (get_option('flex_feat_postid')) { // if showing feature by ID 
global $post;
$thePostID = $post->ID;
$postidlist = get_option('flex_feat_postid');
$postids = explode (",", $postidlist);
if (in_array($thePostID, $postids)) { ?>
<div id="feature">
<div class="topshadow">
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Top Feature') ) : else : ?>
<?php get_template_part( 'feature'); ?>
<?php endif; ?>
<div class="clear"></div>
</div>
</div>
<?php }
} else { // if showing feature by generic page type
if (get_option('flex_feat_display') == "no" OR get_option('flex_feat_pages') == "home only" OR get_option('flex_feat_pages') == "home and posts") { ?>
<?php if ( is_front_page() AND get_option('flex_feat_display') != "no" ) { ?>
<div id="feature">
  <div class="topshadow">
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Top Feature') ) : else : ?>
    <?php get_template_part( 'feature'); ?>
    <?php endif; ?>
    <div class="clear"></div>
  </div>
</div>
<?php } ?>
<?php } else { ?>
<div id="feature">
  <div class="topshadow">
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Top Feature') ) : else : ?>
    <?php get_template_part( 'feature'); ?>
    <?php endif; ?>
    <div class="clear"></div>
  </div>
</div>
<?php } ?>
<?php } // end feature display ?>
<?php if (get_option('flex_nav_show') == "yes" && (get_option('flex_nav_position') == "below feature")) {
	get_template_part( 'includes/nav.inc'); } 
	?>
<?php if (get_option('flex_nav_show') == "yes" && (get_option('flex_nav_position2') == "below feature")) {
	get_template_part( 'includes/secondary-nav.inc'); } 
	?>
<div id="content" style="width:<?php echo $fwpagewidth; ?>px;">
  <div class="postwrap" style="width:<?php echo $fwcontentwidth; ?>px;">
  
  	<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Top of Post/Page') ) : else : ?>
    <?php endif; ?>
    
    <div class="post">
      <div class="posthead">
        <h1>
          <?php the_title(); ?>
        </h1>
        <div class="clear"></div>
      </div>
      <div class="postcontent">
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <?php the_content("<p>__('Read the rest of this page')</p>"); ?>
        <?php edit_post_link(__('Edit'), '<p>', '</p>'); ?>
        <?php wp_link_pages('before=<div id="page-links"><p style="text-align:right"><strong>Pages:</strong>&after=</p></div>'); ?>
        <?php endwhile; endif; ?>
      </div>
    </div>
    
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('Bottom of Post/Page') ) : else : ?>
    <?php endif; ?>
    
    <?php if (get_option('flex_metadata_comoff') == "yes") { ?>
    <?php if(comments_open()) : ?>
    <?php comments_template('', true); ?>
    <?php endif; ?>
    <?php } ?>
  </div>
</div>
<?php get_footer(); ?>
