<?php
    $hassidepre = $PAGE->blocks->region_has_content('side-pre', $OUTPUT);
    $hassidepost = $PAGE->blocks->region_has_content('side-post', $OUTPUT);
    $showsidepre = $hassidepre && !$PAGE->blocks->region_completely_docked('side-pre', $OUTPUT);
    $showsidepost = $hassidepost && !$PAGE->blocks->region_completely_docked('side-post', $OUTPUT);
    $courseheader = $coursecontentheader = $coursecontentfooter = $coursefooter = '';
    if (empty($PAGE->layout_options['nocourseheaderfooter'])) {
        $courseheader = $OUTPUT->course_header();
        $coursecontentheader = $OUTPUT->course_content_header();
        if (empty($PAGE->layout_options['nocoursefooter'])) {
            $coursecontentfooter = $OUTPUT->course_content_footer();
            $coursefooter = $OUTPUT->course_footer();
        }
    }
    
    /* Sidebar */
    $sidebar = "";
    if($hassidepre)
        $sidebar = "LEFT";
    else if($hassidepost)
        $sidebar = "RIGHT";
    else
        $sidebar = "NONE";

    echo $OUTPUT->doctype();
?>

<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en" <?php echo $OUTPUT->htmlattributes(); ?>> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en" <?php echo $OUTPUT->htmlattributes(); ?>> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en" <?php echo $OUTPUT->htmlattributes(); ?>> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en" <?php echo $OUTPUT->htmlattributes(); ?>> <!--<![endif]-->
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title><?php echo $PAGE->title; ?></title>

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <link href='http://fonts.googleapis.com/css?family=Oxygen:400,300' rel='stylesheet' type='text/css'>
    
    <!--[if lt IE 9]>
            <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <link rel="shortcut icon" href="<?php echo $OUTPUT->favicon(); ?>">
    
    <?php echo $OUTPUT->standard_head_html() ?>
    
    <noscript>
        <link rel="stylesheet" type="text/css" href="<?php echo $CFG->wwwroot;?>/theme/genesis/css/nojs.css" />
    </noscript>
</head>
<body>
    <?php echo $OUTPUT->standard_top_of_body_html(); ?>
    <?php include 'header.php'; ?>
    
    <?php echo $OUTPUT->slider('general'); ?>
    
    <div id="contentarea" class="row">
        <div class="sklt-container">
            
            <?php if($sidebar == "LEFT") { ?>
                <div class="four columns alpha leftsidebar">
                    <div id="region-pre" class="block-region">
                    	<div class="region-content">
                            <?php echo $OUTPUT->blocks_for_region('side-pre') ?>
                    	</div>
                    </div>
                </div>
            <?php } ?>
            
            <div class="<?php echo (($sidebar == "NONE")?"full omega":"twelve"); ?> columns <?php echo (($sidebar == "LEFT")?"omega":"alpha"); ?>">
                <div id="page">
                    <div id="ie6-container-wrap">
                        <div id="outercontainer">
                            <div id="container">
								<div id="innercontainer">
                                    <div id="page-content">
                                        <div id="region-main-box">
                                            <div id="region-post-box">
                                                <div id="region-main-wrap">
                                                    <div id="region-main">
                                                        <div class="region-content">
                                                            <?php echo $coursecontentheader; ?>
                                                            <?php echo $OUTPUT->main_content() ?>
                                                            <?php echo $coursecontentfooter; ?>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>  
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <?php if($sidebar == "RIGHT") { ?>
                <div class="four columns omega rightsidebar">
                    <div id="region-post" class="block-region">
                    	<div class="region-content">
                            <?php echo $OUTPUT->blocks_for_region('side-post') ?>
                    	</div>
                    </div>
                </div>
            <?php } ?>
        </div>
    </div>
    
    <?php include 'footer.php'; ?>
</body>

<?php 
    echo $OUTPUT->standard_end_of_body_html();
?>