<?php if (!isset($_SESSION['FirstName'])) {
	session_start();
}
    include ('includes/db1config.php');
    include ('../includes/mysql_connect.php');
	include ('includes/admin-config.php');
?>

<?php include("admin_globals.php"); ?>

<!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" xml:lang="en">
<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" src="../js/jquery-1.7.1.min.js"></script>
<link rel="stylesheet" href="includes/tinyaccordion/style.css" type="text/css" />

<script type="text/javascript" src="../js/jquery.popupoverlay.js"></script>


<!-- for popup windows -->
<link href="css/popup-style.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="js/script.js"></script>
 <!-- end popup script-->

<!--DatePicker-->
<link href="css/jquery.timepicker.css" rel="stylesheet" type="text/css" media="all" />
<script type="text/javascript" src="js/jquery.timepicker.js"></script>

<script type="text/javascript" src="../js/ddaccordion.js">

/***********************************************
* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

</script>
<script type="text/javascript">
ddaccordion.init({
	headerclass: "expandable", //Shared CSS class name of headers group that are expandable
	contentclass: "categoryitems", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

ddaccordion.init({ //2nd level headers initialization
	headerclass: "subexpandable", //Shared CSS class name of sub headers group that are expandable
	contentclass: "subcategoryitems", //Shared CSS class name of sub contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["opensubheader", "closedsubheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})
</script>
<style type="text/css">

.arrowlistmenu{
width: 100%; /*width of accordion menu*/
}

.arrowlistmenu .menuheader{ /*CSS class for menu headers in general (expanding or not!)*/
font:12px Verdana,Arial;width:95%; border:1px solid #467182; padding:7px; 
	font-weight:bold; margin-top:5px; cursor:pointer; 
    -webkit-border-radius: 7px;
    -moz-border-radius: 7px;
    border-radius: 7px;
    border: solid 1px #e8e8e8;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
    -webkit-transition-duration: 0.2s;
    -moz-transition-duration: 0.2s;
    transition-duration: 0.2s;
    -webkit-user-select:none;
    -moz-user-select:none;
    -ms-user-select:none;
    user-select:none;
	color:#fff;
	background-color:#2077a1;
	padding-left:.5em;padding-right:.5em;
}

.arrowlistmenu .openheader{ /*CSS class to apply to expandable header when it's expanded*/
background-image: url(titlebar-active.png);
}

.arrowlistmenu ul{ /*CSS for UL of each sub menu*/
list-style-type: none;
margin: 0;
padding: 0;
margin-bottom: 0px; /*bottom spacing between each UL and rest of content*/
background: none;
}

.arrowlistmenu ul li{
padding-bottom: 0px; /*bottom spacing between menu items*/
}

.arrowlistmenu ul li .opensubheader{ /*Open state CSS for sub menu header*/
background: lightblue !important;
}

.arrowlistmenu ul li .closedsubheader{ /*Closed state CSS for sub menu header*/
background: lightgreen !important;
}

.arrowlistmenu ul li a{
color: #81BEF7;
background: url(arrowbullet.png) no-repeat center left; /*custom bullet list image*/
display: block;
padding: 0px 0;
padding-left: 19px; /*link text is indented 19px*/
text-decoration: none;
font-weight: bold;
border-bottom: 1px solid #dadada;
font-size: 90%;
}

.arrowlistmenu ul li a:visited{
color: #81BEF7;
}

.arrowlistmenu ul li a:hover{ /*hover state CSS*/
color: #FA5858;
background-color: #FA5858;
}

.arrowlistmenu ul li a.subexpandable:hover{ /*hover state CSS for sub menu header*/
background: lightblue;
}
html {
    overflow-y: scroll;
}

.hoursEdit {
	display: none;
}

/* styling for popup modals */
.popup_background {
	z-index: 4005; /* any number */
}
.popup_wrapper {
	z-index: 4006; /* any number + 1 */
}

.modal_close_button {
	position: absolute;
	top: 5px;
	right: 5px;
}

.popup_modal {
	display:none;
	background:white;padding:20px;
		border: 1px solid #777777;
     -webkit-border-radius: 6px;
    -moz-border-radius: 6px;
    border-radius: 6px;
	max-width:800px;
}

#menu_modal {
    max-height: 600px;
    overflow: auto;
}
.menu_modal_open {
	cursor: pointer;
}

/* styling for topping select icon popup window */

#modal-close {
	text-align:center;
	margin-top:1.8em;
	padding:.3em;
}

.popup_modal label {
	width: 40px;
	display: inline-block;
}

.other_location_btn{
	color: white;
	text-align: center;
	background-color: #2077A1;
	float: right;
	padding-left: 5px;
	padding-right: 5px;
	font-family: Arial,Times,serif;
	cursor: pointer;
    margin-top: 5px;
}
#iframe-1 {
    width: 100%;
    height: 100%;
}
.location-item{
	height:400px; 
}
	.time-setting{
		cursor: pointer;
	}
	.save_time_btn{
		cursor: pointer;
		color: white;
		background: #2077a1 none repeat scroll 0 0;
	    border: 1px solid #cccfd2;
	    border-radius: 4px;
	    padding: 3px;
	    
	}
	#add_more_btn{
		cursor: pointer;
		color: white;
		background: #2077a1 none repeat scroll 0 0;
	    border: 1px solid #cccfd2;
	    border-radius: 4px;
	    padding: 3px;
	    float: right;
	}
	#timeSettingPopup{
		overflow-y: auto;
	}
	#close_btn{
	width: 30px;
	height: 30px;
	float: right;
	background: transparent url("../images/closebox.png") no-repeat scroll 0 0;
	cursor: pointer;
}
</style>




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

<script type="text/javascript">
	function addHours() {
		var addHoursType = $('#addHoursType').val();

		var day = $('#addDay').val();
		var fromHour = $('#addFromHour').val();
		var fromMinute = $('#addFromMinute').val();
		var fromMeridiem = $('#addFromMeridiem').val();
		var toHour = $('#addToHour').val();
		var toMinute = $('#addToMinute').val();
		var toMeridiem = $('#addToMeridiem').val();

		// convert to 24 hour
		fromHour24 = convertHourTo24(fromHour, fromMeridiem);
		toHour24 = convertHourTo24(toHour, toMeridiem);
		
		// check that from time is less than end time
		var fromDate = new Date('1970', '01', '01', fromHour24, fromMinute);
		var toDate = new Date('1970', '01', '01', toHour24, toMinute);
		if(fromDate.getTime() > toDate.getTime()) {
			alert('Error adding hours. Start time must be less than end time.');
			return false;
		}else{
			var sendData = {'a': 'add', 'addHoursType': addHoursType, 'day':day, 'fromHour':fromHour, 'fromMinute':fromMinute, 'fromMeridiem':fromMeridiem, 'toHour':toHour, 'toMinute': toMinute, 'toMeridiem':toMeridiem};

			$.post('update_hours.php', sendData, function(responseData) {
				if(responseData == '1') {
					location.reload();
				}else{
					alert('Error updating hours. ' + responseData);
				}
			});
		}

	}
	function updateHours(inRecordKey) {
		var fromHour = $('#fromHour'+inRecordKey).val();
		var fromMinute = $('#fromMinute'+inRecordKey).val();
		var fromMeridiem = $('#fromMeridiem'+inRecordKey).val();
		var toHour = $('#toHour'+inRecordKey).val();
		var toMinute = $('#toMinute'+inRecordKey).val();
		var toMeridiem = $('#toMeridiem'+inRecordKey).val();

		// convert to 24 hour
		fromHour24 = convertHourTo24(fromHour, fromMeridiem);
		toHour24 = convertHourTo24(toHour, toMeridiem);
		
		// check that from time is less than end time
		var fromDate = new Date('1970', '01', '01', fromHour24, fromMinute);
		var toDate = new Date('1970', '01', '01', toHour24, toMinute);
		if(fromDate.getTime() > toDate.getTime()) {
			alert('Error updating hours. Start time must be less than end time.');
			return false;
		}else{
			var sendData = {'a': 'update', 'recordKey':inRecordKey, 'fromHour':fromHour, 'fromMinute':fromMinute, 'fromMeridiem':fromMeridiem, 'toHour':toHour, 'toMinute': toMinute, 'toMeridiem':toMeridiem};

			$.post('update_hours.php', sendData, function(responseData) {
				if(responseData == '1') {
					var newFromTimeDisplay = fromHour+':'+fromMinute+fromMeridiem;
					var newToTimeDisplay = toHour+':'+toMinute+toMeridiem;

					$('#fromTime'+inRecordKey).html(newFromTimeDisplay);
					$('#toTime'+inRecordKey).html(newToTimeDisplay);
				}else{
					alert('Error updating hours. ' + responseData);
				}
			});
		}
	}

	function removeHours(inRecordKey) {
		userResponse = confirm('Are you sure you want to delete those hours?');

		if(userResponse) {
			var sendData = {'a': 'remove', 'recordKey':inRecordKey};

			$.post('update_hours.php', sendData, function(responseData) {
				if(responseData == '1') {
					$('#trHours'+inRecordKey).remove();
				}else{
					alert('Error removing hours. ' + responseData);
				}
			});
		}
	}

	function updateAddHoursType(inType) {
		if(inType == 'open') {
			$('#addHoursType').val('open');
		}
		if(inType == 'delivery') {
			$('#addHoursType').val('delivery');
		}
	}

	function convertHourTo24(inHour, inMeridiem) {
		if(inMeridiem == 'pm') {
			if(inHour == '12') {
				hour24 = '23';
			}else{
				hour24 = 12 + inHour;
			}
		}else{
			if(inHour == '12') {
				hour24 = '00';
			}else{
				hour24 = inHour;
			}
		}
		return hour24;
	}
</script>

</head>
<body>

<div id="wrapper">

<!-- start header -->
<?php include('includes/header.inc.php'); ?>
<!-- end header-->


<!-- start page -->
<div id="page-container">
<div id="page-bg-top">


<!-- start content -->
<div id="content">
<div id="main-content">
   
		<div class="post">
		  <div class="entry">
          
          <br />
<p><strong>Site Admin Page</strong> &bull; Categories
</p>
<br />
				<h1>Manage Store Preferences</h1>
<?php
include "sessionchecklink.php";
include "editprefssub.php";

// if($_SESSION['adminkey']=="security"){
// include "editprefssub.php"; 
// } else {
// 	echo '<font color="red"><div align="center">You are not authorized to view this page. <br>Please <a href="index.php"><font color="blue">login here</font></a>.</div></font>';
// }
?>
     
<br />

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

<br />
<div style="clear: both;">&nbsp;</div>
			  <div style="text-align:center;"><?php echo $bottom_links; ?></div>
</div><!-- end post-->

</div><!-- end main-content-->

</div><!-- end content -->
    
<!-- start sidebar -->
<?php include('includes/admin-sidebar.inc.php'); ?>
<!--sidebar-->


<div style="clear: both;">&nbsp;</div>
<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-->



</body>
</html>
