<?php
if (!isset($_SESSION['FirstName'])) {
	session_start();
	//print_r($_SESSION);
	//echo "<br><br>";
	//print_r($_POST);
}
//echo "Brand: ".$_SESSION['admin_brand'];
	if($_GET['skey']=="p987gjkjtyedghnbdd3421scdzx"){
		$_SESSION['iframed']=1;
	}
    include ('includes/db1config.php'); //db connection config file
    include ('../includes/mysql_connect.php'); //connect using selected db config file
	include_once 'includes/admin-config.php';	//get site options	
//print_r($_SESSION);
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<?php 
include('title.php'); 
echo'<link href="css/'.$stylesheet.'" rel="stylesheet" type="text/css" media="screen" />';	
echo'<link href="css/print_style.css" rel="stylesheet" type="text/css" media="print" />';
?>
<script type="text/javascript">
function setFocus()
{
document.getElementById("username").focus();
}
</script>

<!-- for popup windows -->
<link href="css/popup-style.css" rel="stylesheet" type="text/css" media="all" />
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"> </script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<!--<script type="text/javascript" src="../js/jquery.popupoverlay.js"/></script>-->
 <!-- end popup script-->

<script type="text/javascript" src="js/jquery.nestable.js"></script>
<link rel="stylesheet" type="text/css" href="css/nestable.css" />

<!-- Latest compiled and minified CSS -->
<!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">-->

<!-- jQuery library -->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> -->

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
</head>

<body>
<?php
if(empty($_SESSION['UserID']) || !isset($_SESSION['UserID'])){
	echo '<div id="body-login-wrapper">';
} else {
	echo '<div id="wrapper">';
}
?>
<!-- start header -->
<?php include('includes/header.inc.php'); ?>
<!-- end header-->
<?php
if(isset($_GET['admin-page'])){
	$query = "select * from admin_pages where pageID=".$_GET['admin-page'];
	$rt=mysql_query($query);   
	while($nt=mysql_fetch_array($rt)){
		$page_name = $nt['page_name'];
		$includes_file = $nt['includes_file'];
		$full_width = $nt['full_width'];		
	}
}
if(empty($_SESSION['UserID']) || !isset($_SESSION['UserID'])){
	$full_width="1";
}
?>
<?php
if($full_width=="1"){
	$bg="-nobg";
	$col="-one-column";
}
?>

<!-- start page -->
<div id="page-container<?php echo $bg;?>">
<div id="page-bg-top">


<!-- start content -->
<div id="content<?php echo $col;?>">
<?php
if($full_width!="1"){
?>
<div id="main-content">
<?php
}
?>   
		<div class="post">
		  <div class="entry">
          
<?php
echo"<div id='top-page-title-section'><p><strong>Site Admin Page:</strong>";


if(empty($_GET['admin-page'])){
	echo " <i>Home</i></p></div><h1>Site Admin: <span class='admin-title'>" ; 
	include('seotitle.php');
	echo"</span></h1>";
	if($_SESSION['masterAdmin']==1){
		echo '<div id="dialog" title="Master options" style="display:none;">
		  	<iframe style="width:100%;height:400px;" src="adminOptions.php" id="iframe-add" class="menu-item-iframe"></iframe>
		</div>';
		echo"<div align=right><a href='javascript:void(0);' onClick='openPopup();' class='master_options'>Master options</a></div>";
	}
	
	include('login.php'); 
} else {
	//$query = "select * from admin_pages where pageID=".$_GET['admin-page'];
	//$rt=mysql_query($query);   
	//while($nt=mysql_fetch_array($rt)){
		echo " &bull; $page_name</p><br/></div>" ;

		include($includes_file);
	//}
}
?>

<br />

</div><!-- end entry-->

			  <br />
			 
</div><!-- end post-->
<?php
if($full_width!="1"){
?>
</div><!-- end main-content-->
<?php
}
?> 
</div><!-- end content -->
    
<!-- start sidebar -->
<?php 
if($full_width!="1"){
	include('includes/admin-sidebar.inc.php');
}
?>
<!--sidebar-->


<div style="clear: both;">&nbsp;</div>
<script>
	$(document).ready(function() {
		$('.master_options').click(function() {
			$('.loader').hide();
			$( "#dialog" ).dialog({
			  close: function( event, ui ) {
					$( "#backgroundPopup" ).hide();
    			}
			});
			$(".ui-dialog").css({"width":"50%",'left':'25%'});
		});
	});
</script>

<div id="page-bg-btm">
</div><!-- end page-bg-btm div -->
</div><!-- end page-bg-top div -->
</div><!-- end page-container -->



</div><!-- end wrapper div-->

<!-- end page -->


<!--footer-->


</div>
</body>
</html>
