<?php

// Start the session
session_start();
require 'core/operations_tracking.php';
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">

    <title>Wendlings Operation Tracking - Home Page</title>

    <?php 
link_external_files();
?>
</head>

<body>
    <div id="head" class="head">
        <?php 
page_head();
check_login('home_page');
?>
    </div>

    <div id="nav-container" class="nav-container">
    <h2> Home Page</h2>
    <?php 
//
// setting click fun vars
session_start();
require 'core/operations_tracking.php';
?>

<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <title id="page-title"></title>

    <?php 
if (!isset($_GET['tab'])) {
    $_GET['tab'] = 'BAD_PAGE';
}
link_external_files($_GET['tab']);
?>

    <script>
        // executing a specific page generation function
        function generate_page() {
            var tab = document.URL.match(/tab=([-_\w]+)&?/)[1];
            var title = tab.replace(/_|-/g, ' ');
            title = 'Wendlings Operation Tracking - '+title.toTitleCase();
            document.getElementById('page-title').textContent = title;
            window[tab+'_page']();
        }
    </script>

</head>
<body onload="generate_page()">