<?php
include("../include/session.php");
//include("../include/db.php");
if(!$session -> logged_in){
	header("Location: ../main.php");
}else{
	include("../productionHeader.php");
	require_once('classes/tc_calendar.php');
		$d = date("d");
	$m = date("m");
	$y = date("Y");
			$q = "SELECT recipieId, recipieName FROM nam_recipie";
	$arrId = array();
	$arrName = array();
	$result = execsql($q);
	$num = mysql_num_rows($result);
	$b = 0;
	while($b < $num){
		$arrId[$b] = mysql_result($result, $b, "recipieId");
		$arrName[$b] = mysql_result($result, $b, "recipieName");
		$b++;
	}
	?>

	<script language="javascript">
<!--
function validate() {
var ErrorString='';

		if(document.wet.recipieId.value==''){
	    ErrorString+='Please select the Recipie\n';
		}
		if(document.wet.wet.value==''){
	    ErrorString+='Please enter the number of wet tiles\n';
		}
		if(isNaN(document.wet.wet.value)){
		ErrorString+='Please Enter a Valid number of wet tiles\n';
	}
	if(document.wet.hours.value==''){
	    ErrorString+='Please enter the hours of heating\n';
		}
		if(isNaN(document.wet.hours.value)){
		ErrorString+='Please Enter a Valid number of heating hours\n';
	}

	if( ErrorString == '' ){
    return true;
     }else{
	alert(ErrorString);
	return false;
	}
}
//-->
</script>
<link
	href="calendar.css" rel="stylesheet" type="text/css" />
<script
	language="javascript" src="../include/calendar.js"
	type="text/javascript"></script>
<h3>Wet Tiles<br />
</h3>
<form name="wet" action="manipulation/wetDaysProduction.php" method="post">
<table><tr>	<td>Select a Recipie:</td>
		<td><select name="recipieId">
			<option value="">Choose Me</option>
			<?php
			for ($i = 0 ; $i < count($arrId) ; $i++) {

				echo "<option value=". "\"". $arrId[$i]. "\"" .">" . $arrName[$i] . "</option>";
			}

			?>
		</select></td>
<td>Amount of Wet Tiles Produced:</td> <td><input name="wet" value="" /></td></tr>
<tr><td>Date:</td><td colspan="2"> <?php
		$myCalendar = new tc_calendar("date2", true);
		$myCalendar->setIcon("../img/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2000, 2030);
		$myCalendar->writeScript();

		?></td>

</tr><td>Hours of Heating</td><td><input name="hours" type="text" /></table>

<input type="reset" value="Reset Form" /> 
<input type="submit"
	name="submitok" value="    OK    " onclick="return validate();" /></form>
<?php }?>