<?php

 $lang = $this->Session->read('Config.language');
if(isset($_COOKIE['blog_lang']) && $_COOKIE['blog_lang'] != $lang) {
    setcookie('blog_lang', $lang, time()+3600*24);
} else if(!isset($_COOKIE['blog_lang']) && empty($_COOKIE['blog_lang'])) {
    setcookie('blog_lang', $lang, time()+3600*24);
}
?>
<!doctype html>
<html>
<head>
<?php echo $this->Html->charset(); ?>
    
<meta name="viewport" content="width=device-width, initial-scale=1">

<?php if(IS_GOOGLE_ANALYTIC == 1){ ?>
<title>
        ExpenseCount - <?php echo __("LBL_WEBSITE_TITLE"); ?>
    </title>
    <meta name="description" content="<?php echo __('LBL_SITE_META_DESCRIPTION'); ?>" />
    <meta name="keywords" content="<?php echo __('LBL_SITE_META_KEYWORD'); ?>" />
<?php } ?>
    <link rel="shortcut icon" type="image/x-icon" href="<?php echo CDN_URL; ?>images/favicon.ico">
<link href="<?php echo CDN_URL; ?>css/bootstrap.css" rel="stylesheet" type="text/css">
<script src="<?php echo CDN_URL; ?>js/jquery-3.3.1.min.js"></script>
<script src="<?php echo CDN_URL; ?>js/popper.min.js"></script>
<script src="<?php echo CDN_URL; ?>js/bootstrap.min.js"></script>
    <!--<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.2/js/bootstrap.min.js" integrity="sha384-o+RDsa0aLu++PJvFqy8fFScvbHFLtbvScb8AjopnFD+iEQ7wo/CG0xlczd+2O/em" crossorigin="anonymous"></script>-->
<script  src="<?php echo CDN_URL; ?>js/nav.js"></script>
<script src="<?php echo CDN_URL; ?>owlcarousel/owl.carousel.js"></script>
<link href="<?php echo CDN_URL; ?>css/style.css" rel="stylesheet" type="text/css">
<link href="<?php echo CDN_URL; ?>css/nav.css" rel="stylesheet" type="text/css">
<link href="<?php echo CDN_URL; ?>owlcarousel/assets/owl.carousel.min.css" rel="stylesheet" type="text/css">
<style type="text/css">
  #cssmenu .signinText{
      font-weight: bold;
    }
  @media screen and (max-width: 576px){
    #cssmenu .signinText{
      padding-right: 20px;
    }
  }
  @media screen and (max-width: 767px){
    .googlebtn img{
      margin: 0px;
    }
  }
  @media screen and (max-width: 1000px){
    .auth #cssmenu {
        background: none;
    }
  }
</style>
</head>

<body>
<!---->
<div class="header auth">
  <div class="container pt-0 pb-0">
    <div class="row">
      <div class="col-sm-3 logo"><a href="<?php echo HTTP_SITE_URL;?>"><img src="<?php echo CDN_URL; ?><?php echo __("LBL_MAIN_LOGO");?>" alt=""/></a>
      </div>

      <div class="col-sm-9 no-padding">
        <div id="cssmenu">
		<div class="mt-3 text-right signinText" style="font-weight:bold;">
		  <?php if ($this->request->controller == 'Users' && $this->request->action == 'login'): ?>Don't have an account? <a style="text-decoration:underline;" href="<?php echo HTTP_SITE_URL; ?>/users/register"><?php echo "Sign Up";?></a><?php endif; ?>
		</div>
		</div>
      </div>
    </div>
  </div>
</div>

<!-- main body -->
<?php if ($this->request->here != $this->base.'/' && $this->request->here != $this->base.'/pages/myExpenses'): ?>
    <div class="block-2" style="background:#E3E3E3;">
      <div class="container">
        <?php echo $this->Session->flash(); ?>
        <?php echo $this->fetch('content'); ?>
      </div>
    </div>
<?php else: ?>
    <?php echo $this->Session->flash(); ?>
    <?php echo $this->fetch('content'); ?>
<?php endif; ?>
<!-- end of main body -->

<?php //echo $this->element('footer'); ?>

<?php 
        echo $this->Form->create("Home", array('id'=> 'languageSelectionForm','url' => array('controller' => 'Home', 'action' => 'changeLanguage')));
    
        echo $this->Form->input('global_selected_language', array('type' => 'hidden','id'=>'global_selected_language'));
        echo $this->Form->input('global_current_url', array('type' => 'hidden','id'=>'global_current_url'));
        
        echo $this->Form->end();    
    ?>
    
    <script>

    function changeLanguage(language){
 
        document.getElementById("global_selected_language").value = language;
         
        document.getElementById("global_current_url").value = "<?php echo $this->Html->url();?>";
         
        document.forms["languageSelectionForm"].submit();
         
     }

     $(document).on('change','#languageList',function(){
        var lang = $(this).val();
        changeLanguage(lang);


     });
    $(document).ready(function(){
        $('[data-toggle="tooltip"]').tooltip();
    });

    </script>
 
<?php if(IS_GOOGLE_ANALYTIC == 1){ ?>
<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-19803228-4', 'auto');
  ga('send', 'pageview');

</script>
<?php } ?>

</body>
</html>