<?php
// get node info
$nid = 0;
$headerTitle = null;
$headerText = null;
$headerImage = null;
if (arg(0) == 'node' && is_numeric(arg(1))):
    $nid = arg(1);
    if ($nid):
        $node = node_load($nid);
        $headerTitle = $node->title;
        $headerTextField = field_get_items('node', $node, 'field_header_text');
        $headerText = $headerTextField[0]['value'];
        $headerImageField = field_get_items('node', $node, 'field_school_image');
        $headerImage = str_ireplace('public://', '', $headerImageField[0]['uri']);
    endif;
endif;
?>

<?php if (theme_get_setting('scrolltop_display')): ?>
<div id="toTop"><span class="glyphicon glyphicon-chevron-up"></span></div>
<?php endif; ?>

<?php if ($page['highlighted']) :?>
    <?php print render($page['highlighted']); ?>
<?php endif; ?>

<?php include ($directory . '/includes/header.inc.php'); ?>

<!-- #header-top -->
<div id="header-top" class="clearfix">
    
    <!-- #header-top-inside -->
    <div id="header-top-inside" class="clearfix">
        
        <div id="inside-page-banner">
        
            <?php print ($page['banner_home_left'])? render($page['banner_home_left']) : null; ?>
            
            <div class="item">
                <a href="javascript:void(null);" style="background-image: url('<?php echo base_path() . 'sites/default/files/'. $headerImage; ?>');">
                    <div class="carousel-caption"><h2 class="title"><?php echo $headerTitle; ?></h2></div>
                </a>
            </div>
                
            <?php print ($page['banner_home_right'])? render($page['banner_home_right']) : null; ?>
            
        </div>
        <!-- EOF:#header-top-right -->
        
        <!-- #header-footer -->
        <div id="header-footer" class="clearfix">
            <?php print ($page['header_footer'])? render($page['header_footer']) : null; ?>
            <div class="hidden-md hidden-lg">
              <?php print ($page['header_top_left'])? render($page['header_top_left']) : null; ?>
              <?php print ($page['header_top_right'])? render($page['header_top_right']) : null; ?>
            </div>
        </div>
        <!-- EOF:#header-top-left-footer -->
        
    </div>
    <!-- EOF: #header-top-inside -->

</div>
<!-- EOF: #header-top -->

<!-- #page -->
<div id="page" class="clearfix front-page inside-page">
    
    <!-- #main-content -->
    <div id="main-content">
        <div class="container">
        
            <!-- #messages-console -->
            <?php if ($messages):?>
            <div id="messages-console" class="clearfix">
                <div class="row">
                    <div class="col-md-12">
                    <?php print $messages; ?>
                    </div>
                </div>
            </div>
            <?php endif; ?>
            <!-- EOF: #messages-console -->
            
            <?php $colSizes = ($page['sidebar_second'])? array('main' => 'col-md-9', 'sidebar' => 'col-md-3') : array('main' => 'col-md-12', 'sidebar' => 'hide'); ?>
            
            <!-- #main -->
            <section class="<?php echo $colSizes['main']; ?>">
                <div id="main" class="clearfix">
                    <div id="content-wrapper">
                        <?php print render($page['content']); ?>
                    </div>
                </div>
            </section>
            <!-- EOF:#main -->
            
            <!-- #sidebar -->
            <section class="<?php echo $colSizes['sidebar']; ?>">
              <div id="sidebar"><?php print render($page['sidebar_second']); ?></div>
            </section>
            <!-- EOF:#sidebar -->

        </div>
    </div>
    <!-- EOF:#main-content -->

    <?php if ($page['bottom_content']):?>
    <!-- #bottom-content -->
    <div id="bottom-content" class="clearfix">
        <div class="container">

            <!-- #bottom-content-inside -->
            <div id="bottom-content-inside" class="clearfix">
                <div class="row">
                    <div class="col-md-12">
                    <?php print render($page['bottom_content']); ?>
                    </div>
                </div>
            </div>
            <!-- EOF:#bottom-content-inside -->

        </div>
    </div>
    <!-- EOF: #bottom-content -->
    <?php endif; ?>

</div>
<!-- EOF:#page -->

<?php if ($page['promoted']):?>
<!-- #promoted -->
<div class="container">
    <div id="promoted" class="clearfix">
        <div id="promoted-inside" class="clearfix">
        <?php print render($page['promoted']); ?>
        </div>
    </div>
</div>
<!-- EOF: #promoted -->
<?php endif; ?>

<?php include ($directory . '/includes/footer.inc.php'); ?>