<?php
session_start();
$username = $_SESSION['staff'];
if($_SESSION['staff']!= null)
{
header("Cache-Control: no-cache, must-revalidate"); 
?>
	
<html>
<head>
<title>Daily Bookstore - Cashier System</title>
<!--include css file-->
<link href="bookstaff.css" rel="stylesheet" type="text/css"/>

<!--clock function-->
<script type="text/javascript">
function init ( )
{
  timeDisplay = document.createTextNode ( "" );
  document.getElementById("clock").appendChild ( timeDisplay );
}

function updateClock ( )
{
  var currentTime = new Date ( );

  var currentHours = currentTime.getHours ( );
  var currentMinutes = currentTime.getMinutes ( );
  var currentSeconds = currentTime.getSeconds ( );

  // Pad the minutes and seconds with leading zeros, if required
  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;

  // Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";

  // Convert the hours component to 12-hour format if needed
  currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;

  // Convert an hours component of "0" to "12"
  currentHours = ( currentHours == 0 ) ? 12 : currentHours;

  // Compose the string for display
  var currentTimeString = currentHours + ":" + currentMinutes + ":" + currentSeconds + " " + timeOfDay;

  // Update the time display
  document.getElementById("clock").firstChild.nodeValue = currentTimeString;
}

// -->
</script>

<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<script type='text/javascript' src="js/jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" />

<script type="text/javascript">
$().ready(function() {
	$("#memberName").autocomplete("memberauto.php", {
		width: 260,
		matchContains: true,
		//mustMatch: true,
		//minChars: 0,
		//multiple: true,
		//highlight: false,
		//multipleSeparator: ",",
		selectFirst: false
	});
});
</script>

</head>

<body onload="updateClock(); setInterval('updateClock()', 1000 )">

<table border="0" width="100%">

<tr>
<td><img src="Picture/Logo.gif"></td>
</tr>

<tr>
<td>&nbsp;</td>
</tr>

<tr>
<td colspan="2"><h2>Daily Bookstore - Cashier System</h2></td>
<td align="right"><h3>Current Time:<span id="clock">&nbsp;</span></h3></td>
</tr>

<tr>
<td colspan="2"></td>
<td align="right" style="color:darkblue"><h3>You log in as:<span>
<?php
echo "<span style='color:black;font-weight:bold'>".$username."</span>";
?>
<a href="logout.php">(Logout)</a>
</h3>
</span>
</td>
</tr>

</table>

<table align="center" width="100%" border="0">

<tr>
<td>
<fieldset>
<legend><img src="Picture/gear.gif" width="40" height="40">Function List</legend>
<div class="toplink">

<!--function list-->
<?php
include ("cashierfunction.php");
?>
</div>

</td>
</tr>
</table>

</center>

<hr/>
<center>
<h2>Daily Bookstore Gift Exchange</h2>
</center>

<div id="mainpage">
<div id="bookmenu">
<table width="90%">
<tr>
<td width="75%">
<center>
<?php
include("giftredeem.php");
?>

</td>
</tr>
</table>
</center>
<div id="bottom">
<center>

<br/>
Copyright &#169; with Tian Tian Bookstore 2011. All Rights Reserved.
<br/>
Website:<a href="../bookstore" target="_blank">www.dailybook.com.my
</div>
</center>
</div>
</div>
</body>
</html>
<?php
}else{
	echo "<script language='javascript'>alert ('Please login.')</script>";
	echo "<script language='javascript'>window.location='index.php'</script>";
}
?>