<?php
ob_start();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script src="/vendor/jQuery/jquery-3.1.1.min.js"></script>
        <script src="/vendor/ckeditor/ckeditor.js"></script>
        <link rel="apple-touch-icon" sizes="57x57" href="/_image/apple-icon-57x57.png">
        <link rel="apple-touch-icon" sizes="60x60" href="/_image/apple-icon-60x60.png">
        <link rel="apple-touch-icon" sizes="72x72" href="/_image/apple-icon-72x72.png">
        <link rel="apple-touch-icon" sizes="76x76" href="/_image/apple-icon-76x76.png">
        <link rel="apple-touch-icon" sizes="114x114" href="/_image/apple-icon-114x114.png">
        <link rel="apple-touch-icon" sizes="120x120" href="/_image/apple-icon-120x120.png">
        <link rel="apple-touch-icon" sizes="144x144" href="/_image/apple-icon-144x144.png">
        <link rel="apple-touch-icon" sizes="152x152" href="/_image/apple-icon-152x152.png">
        <link rel="apple-touch-icon" sizes="180x180" href="/_image/apple-icon-180x180.png">
        <link rel="icon" type="image/png" sizes="192x192"  href="/_image/android-icon-192x192.png">
        <link rel="icon" type="image/png" sizes="32x32" href="/_image/favicon-32x32.png">
        <link rel="icon" type="image/png" sizes="96x96" href="/_image/favicon-96x96.png">
        <link rel="icon" type="image/png" sizes="16x16" href="/_image/favicon-16x16.png">
        <link rel="manifest" href="/_image/manifest.json">
        <meta name="msapplication-TileColor" content="#ffffff">
        <meta name="msapplication-TileImage" content="/_image/ms-icon-144x144.png">
        <meta name="theme-color" content="#ffffff">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <?php
        require('common.php');
        require('event_handler.php');
        //ob_flush();
        $page = new page();

        echo '<link rel="stylesheet" type="text/css" href="/_css/default.css">';
        ?>
         <link rel="stylesheet" type="text/css" href="/_css/nav.css">
         <link rel="stylesheet" type="text/css" href="/_css/form.css">
         <link rel="stylesheet" type="text/css" href="/_css/button.css">
         <link rel="stylesheet" type="text/css" href="/_css/addbutton.css">
         <link rel="stylesheet" type="text/css" href="/_css/login_form.css">
         <?php
        if ($page->is_page() && in_array($page->get_page(), array('view', 'preview'))) {
            echo '<link rel="stylesheet" type="text/css" href="/_css/default_view.css">';
        }


        if (in_array($page->get_page(), array('view','preview')) && $page->is_subpage() && $page->get_subpage() == "diary"|| $page->get_page() == "view" && !$page->is_subpage())
            echo '<link rel="stylesheet" type="text/css" href="/_css/diary.css">';

        if ($page->is_page() && ($page->get_page() == 'coach' || $page->get_page() == 'coach_preview')) {
            echo '<link rel="stylesheet" type="text/css" href="/_css/default_coach.css">';
        }

        if ($page->is_page() && ($page->get_page() == 'tabor')) {
            echo '<link rel="stylesheet" type="text/css" href="/_css/camp.css">';
        }

        if ($page->is_page() && ($page->get_page() == 'taborvezeto')) {
            echo '<link rel="stylesheet" type="text/css" href="/_css/camp_leader.css">';
        }

        ?>


        <title>
            <?php
            if ($page->is_page() && ($page->get_page() == 'tabor')) {
                echo "Tollaslabda táborok 2018. nyár";
            }
            else {
                echo "Badminton Coach";
            }
            ?>
        </title>
    </head>

    <body>
        <div id="pageContainer">
        <nav>
            <?= $page->get_page_nav();?>
        </nav>
        <main>
            <div id="loading"></div>
            <div id="main_content">
                <?= $page->get_page_content();?>
            </div>
        </main>
        <footer></footer>
        </div>
        <script>

        function onReady(callback) {
            var intervalID = window.setInterval(checkReady, 1000);
            function checkReady() {
                if (document.getElementsByTagName('body')[0] !== undefined) {
                    window.clearInterval(intervalID);
                    callback.call(this);
                }
            }
        }

        function show(id, value) {
            document.getElementById(id).style.display = value ? 'block' : 'none';
        }

        onReady(function () {
            show('main_content', true);
            show('loading', false);
            //user list autofocus Firefox fix
            if ($("#uk_filter_name").length) {
                $("#uk_filter_name").focus();
            }
        });

        </script>
        <?php
        if ($page->is_page() && ($page->get_page() == 'tabor' && !$dev)) {
        ?>
            <!--Start Cookie Script--> <script type="text/javascript" charset="UTF-8" src="http://chs03.cookie-script.com/s/bf70195c19da2a2b2ca37a0384845a73.js"></script> <!--End Cookie Script-->
        <?php
        }
        ?>
    </body>
</html>

<?php
ob_end_flush();
?>
