<?php

$is_ajax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
   
require_once($_SERVER['DOCUMENT_ROOT'].'/protected/portal_settings.php');

function getFirst() {
  global $usrname, $is_ajax, $as_json, $page_title;
  
  if ($is_ajax) {
      echo json_encode(array("page" => $page_title)) . "<!-- jE -->";
      //ob_start();
      //echo 'AJAX !';
  }
  //all common requires and includes here
  //require_once('login.inc.php');
  
  if(! $is_ajax) {
?>
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php require($_SERVER['DOCUMENT_ROOT'].'/inc/head.inc.php'); ?>
</head>
<body>
<!-- MENUBAR STARTS -->
<?php require('menubar.inc.php'); ?>
<!-- MENUBAR ENDS -->
<!-- page-content -->
<div id="page-content">
  <!-- row-offcanvas -->
  <div class="row row-offcanvas row-offcanvas-left">

    <div class="col-lg-1 col-md-1 col-sm-2 col-xs-1 sidebar sidebar-offcanvas" id="sidebar">

<?php require('sidebar.inc.php'); ?>

    </div>
    <!-- main right col -->
    <div class="column col-lg-11 col-md-11 col-sm-10 col-xs-11" id="main">
      <div id="ajax-content">
<?php
  }
  
// ok, valid username & password

}

function getLast() {
  global $is_ajax, $as_json, $page_title;
  
  if ($is_ajax) {
      //echo ob_get_clean();
  } else {
?>
      </div>
    </div><!-- /main right col -->
  </div><!-- /row-offcanvas -->
</div><!-- /page-content -->

<!-- CONTENT AREA ENDS -->
	<!-- FOOTER STARTS -->
<?php require($_SERVER['DOCUMENT_ROOT'].'/inc/footer.inc.php'); ?>
	<!-- FOOTER ENDS -->
	</body>
</html>
<?php
  }
}
?>
