<?php

date_default_timezone_set('Europe/Bratislava');
include('./core/functions.php');
include('./core/db.php');

$menu = array(
   NULL            => array('name' => '<img src="/img/opsim.png" />'),
   'schema-modelu' => array('name' => 'Schéma<br />modelu'),
   'aktualny-stav' => array('name' => 'Aktuálny<br />stav'),
   'predpoklady'   => array('name' => 'Predpoklady<br />a parametre'),
   'vysledky'      => array('name' => 'Výsledkové<br />správy'),
   'kontakt-autori'        => array('name' => 'Kontakt,<br />autori'),
);

include('./core/function.time.ago.php');
include('./core/Parsedown.php');
include('./core/definePage.php');

$printME     = NULL;
$title       = NULL;
$description = NULL;
$ogimage     = '1.jpg';

include('./core/getContent.php');

$trim = rtrim($_SERVER['REQUEST_URI'], '/');
if ($trim && $trim!=$_SERVER['REQUEST_URI']){
   header('Location: '.$trim, TRUE, 301);
   die();
}

?>

<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <?php echo '
         <title>'.$title.'</title>
         <meta property="og:title" content="'.$title.'" />
         <meta name="description" content="'.$description.'" />
         <meta property="og:description" content="'.$description.'" />
         <meta property="og:url" content="https://opsim.sk/'.(isset($path[1])?$path[1]:NULL).(isset($path[2])?'/'.$path[2]:NULL).'" />

         <meta property="og:image" content="https://opsim.sk/img/og/'.$ogimage.'" />
         <meta property="og:image:type" content="image/jpeg" />
         <meta property="og:image:width" content="1200" />
         <meta property="og:image:height" content="630" />

      '; ?>
      <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,300,700,600,800|Open+Sans+Condensed:300,700&subset=latin,latin-ext' rel='stylesheet' type='text/css'>
      <link href="/css/reset.css" rel="stylesheet" />
      <link href="/css/style.css?rev=2" rel="stylesheet" />

      <script src="/js/jquery-2.1.3.min.js"></script>
      <script src="/js/highcharts.js"></script>
      <script src="/js/custom.js?rev=4"></script>

      <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
        ga('create', 'UA-1149069-17', 'auto');
        ga('send', 'pageview');
      </script>

   </head>
   <body>
      <a id="on_uz_vsetko_vie_uz_moze_ist_k_Dzurindovi_robit_do_kancelarie" href="mailto:team@opsim.sk"><span class="less">Vieš to lepšie?</span><span class="more">Napíš nám!</span></a>
      <div id="topLine">
         <div class="menu">
            <?php
               foreach($menu as $href=>$item){
                  echo'<a href="/'.$href.'"'.((isset($path[1]) && $path[1]==$href) || (!isset($path[1]) && !$href)?' class="active"':NULL).'>'.$item['name'].'</a>';
               }
            ?>
         </div>
      </div>
      <div id="content">
         <div id="contentTopFix"></div>
            <?php echo $printME; ?>
         <div id="contentBotFix"></div>
      </div>
      <div id="background"></div>
   </body>
</html>
