<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="calendar/calendar.css" rel="stylesheet" type="text/css" />
<?php
require_once('calendar/tc_calendar.php');
?>
<body style="background-color: #ffffff;background-image:url(rail.jpg);background-repeat: repeat-y">
<center>
<table>
	<tr>	
		<td><a href="http://www.wauhaha.com/karaoke/adminaccount.php"><img src=admin.gif width=140 height=140 border=0/><br/></a></td>
		<td><a href="http://www.wauhaha.com/karaoke/adminviewmem.php"><img src=member.gif width=140 height=140 border=0/><br/></a></td>
		<td><a href="http://www.wauhaha.com/karaoke/adminviewstaff.php"><img src=staff.gif width=140 height=140 border=0/><br/></a></td>
		<td><a href="http://www.wauhaha.com/karaoke/dutytime.php"><img src=duty.gif width=140 height=140 border=0/><br/></a></td>
		<td><a href="http://www.wauhaha.com/karaoke/salary.php"><img src=salary.gif width=140 height=140 border=0/><br/></a></td>
		<td><a href=adminhistory.php><img src=leave.gif width=140 height=140 border=0/><br/></a></td>
		<td><a href=adminhistory.php><img src=job.gif width=140 height=140 border=0/><br/></a></td>
		<td><a href=adminhistory.php><img src=advertisement.gif width=140 height=140 border=0/><br/></a></td>
		<td><a href="http://www.wauhaha.com/karaoke/room.php"><img src=room.gif width=140 height=140 border=0/><br/></a></td>
		
	</tr>
</table>
</center>
<p align=center style="font-family:georgia; font-size:16pt; color:Crimson">Leave Apply Form</p>
<form name="memreg" action="http://www.wauhaha.com/karaoke/leaveaction.php" method="POST">
<table align=center style="font-family:georgia;font-size:14pt;color:Crimson ">
<tr>
	<td><label for="DateFrom">Date From:</br>
	<?php
	  $thisweek = date('W');
		$thisyear = date('Y');

		function getDaysInWeek ($weekNumber, $year, $dayStart = 1) {
		  // Count from '0104' because January 4th is always in week 1
		  // (according to ISO 8601).
		  $time = strtotime($year . '0104 +' . ($weekNumber - 1).' weeks');
		  // Get the time of the first day of the week
		  $dayTime = strtotime('-' . (date('W', $time) - $dayStart) . ' days', $time);
		  // Get the times of days 0 -> 6
		  $dayTimes = array ();
		  for ($i = 0; $i < 7; ++$i) {
			$dayTimes[] = strtotime('+' . $i . ' days', $dayTime);
		  }
		  // Return timestamps for mon-sun.
		  return $dayTimes;
		}

		$dayTimes = getDaysInWeek($thisweek, $thisyear);
		//----------------------------------------

		$date4_default = date('m/d/y');
		$date5_default = date('d/m/y', $dayTimes[(sizeof($dayTimes)+1)]);

	  $myCalendar = new tc_calendar("date4", true, false);
	  $myCalendar->setIcon("calendar/images/iconCalendar.gif");
	  $myCalendar->setDate(date('d', strtotime($date4_default)), date('m', strtotime($date4_default)), date('Y', strtotime($date4_default)));
	  $myCalendar->setPath("calendar/");
	  $myCalendar->setYearInterval(2010, 2018);
	  //$myCalendar->dateAllow('2010-10-09', "", false);
	  $myCalendar->setAlignment('left', 'top');
	  $myCalendar->setDatePair('date4', 'date5', $date5_default);
	  $myCalendar->writeScript();
	  ?>
                </div>
              </div>
              <div style="float: left;">
                <div style="float: left; padding-left: 3px; padding-right: 3px; line-height: 18px;">to</div>
                <div style="float: left;">
                  <?php
	  $myCalendar = new tc_calendar("date5", true, false);
	  $myCalendar->setIcon("calendar/images/iconCalendar.gif");
	  $myCalendar->setDate(date('d', strtotime($date5_default)), date('m', strtotime($date5_default)), date('Y', strtotime($date5_default)));
	  $myCalendar->setPath("calendar/");
	  $myCalendar->setYearInterval(2010, 2012);
	  //$myCalendar->dateAllow("", '2011-11-09', false);
	  $myCalendar->setAlignment('right', 'bottom');
	  $myCalendar->setDatePair('date4', 'date5', $date4_default);
	  $myCalendar->writeScript();
	  ?></td>
	</tr>

<tr>
	<td>Apply Leave Hours:
	<input type="text" name="hours" id="hours">
	</tr>
	
<tr>

	<td>Leave Type:
<select name="type">
	<option>Medical Leave</option>
	<option>Bereavement leave</option>
	<option>Normal Leave</option>
	<option>Annual Leave</option>
</select>
	</td>
</tr>
<tr>
	<td>Reason:</br>
	<textarea name="reason" rows="10" cols="70"></textarea></td>
</tr>
<tr>
		<td align="center"><input type="submit" value="Submit" name="submit" style='height:30'	><input type="reset" style='height:30'></td>
</tr>
</body>
</html>