<head>
<?php
 
require_once ('../include/tc_calendar.php');
$start = strtotime($_SESSION['deliver_date']);
$d = date("d", $start );
$m = date("m", $start );
$y = date("Y", $start );
   
$table_name = $_SESSION['db_prefix']."_list_roofcover";
$dropDownQuery = "SELECT  item_name FROM $table_name  ORDER BY item_name";
$dropDownResult = execsql($dropDownQuery);
	$num = mysql_num_rows($dropDownResult);
	$a = 0;
	$arrId = array ();
	$arrName = array ();
	while ($a < $num) {
		$arrId[$a] = mysql_result($dropDownResult, $a, "item_name");
		$arrName[$a] = mysql_result($dropDownResult, $a, "item_name");
				
		$a++;
	}
   
?>

   
<!--jscript-->
<script language="javascript" src="../jscript/calendar.js"></script>
<script language="JavaScript" src="../jscript/numbers_only.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script>  


</head>

<?php include('../include/wait.php') ?>
<link href="../css/wait.css" rel="stylesheet" type="text/css">
<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">

<div class="page_middle_frame">
<form action="captureJobWizbase.php?p=3&s=2" method="post" name="form1" id="form1" >
<table id="tableMain" width="595">
    <!--begin of tableMain-->
    <tr>
      <td><!--center of tableMain-->
        <div class="wizard_frame">
          <table width="500" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="97"><label class="label_std">Delivery date:</label></td>
              <td width="403"><?php

		$myCalendar = new tc_calendar("deliver_date", true);
		$myCalendar->setIcon("../images/iconCalendar.gif");
		$myCalendar->setDate($d, $m, $y);
		$myCalendar->setPath("./");
		$myCalendar->setYearInterval(2014, 2090);
		//$myCalendar->dateAllow('2009-02-20', "", false);
		$myCalendar->writeScript();
?></td>
            </tr>
          </table>
        </div>
        <br />
<br /><br />


         <div class="wizard_frame">
           <table width="630" id="table_display_wizard">
             <tr>
               <td width="123" valign="middle">Roof cover:</td>
               <td valign="middle"><select name="roofcover_select" id="roofcover_select" class="select200" autofocus>
                 <option value="<?php echo $_SESSION['roof_cover']?>"><?php echo $_SESSION['roof_cover']?></option>
                 
                 <?php
    	for ($i = 0; $i < count($arrId); $i++) {
		echo "<option value=" . "\"" . $arrId[$i] . "\"" . ">" . $arrName[$i] . "</option>";
		$_SESSION['productName'] = $arrName[$i];
		}
     ?>
</select></td>
             </tr>
             <tr>
               <td height="30" valign="middle">Roof pitch:</td>
               <td valign="middle"><input name="roof_pitch_text" type="text" class="text60" id="roof_pitch_text" onKeyPress="return isNumberKey(event)" onChange=" this.value = this.value.replace (/(\..).*/, '$1')" style="text-align:right" value="<?php echo $_SESSION['roof_pitch']?>" autocomplete="off"> 
                 &nbsp;&nbsp;deg</td>
             </tr>
             <tr>
               <td height="30" valign="middle">Max overhang:</td>
               <td valign="middle"><input name="overhang_text" type="text" class="text60" id="overhang_text" onKeyPress="return numbersonly(this, event)" style="text-align:right" value="<?php echo $_SESSION['overhang']?>" autocomplete="off">
               &nbsp;&nbsp;mm</td>
             </tr>
             <tr>
               <td height="30" valign="middle">Roof area:</td>
               <td valign="middle"><input name="roof_area_text" type="text" class="text60" id="roof_area_text" onKeyPress="return isNumberKey(event)" onChange=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $_SESSION['roof_area']?>" autocomplete="off">
               &nbsp;&nbsp;m<sup>2</sup></td>
             </tr>
             <tr>
               <td height="30" valign="middle">Floor area:</td>
               <td><input name="floor_area_text" type="text" class="text60" id="floor_area_text" onKeyPress="return isNumberKey(event)" onChange=" this.value = this.value.replace (/(\...).*/, '$1')" style="text-align:right" value="<?php echo $_SESSION['floor_area']?>" autocomplete="off">
               &nbsp;&nbsp;m<sup>2</sup></td>
              </tr>
           </table>
            <br>
            <table width="667" id="table_display_wizard">
              <tr>
                <td colspan="6">Enter estimated totals to be used on this job for:</td>
              </tr>
              <tr>
                <td width="70">S5 timber:</td>
                <td width="155"><label for="textfield"></label>
                  <input name="S5_text" type="text" class="text100" id="S5_text" value="<?php echo $_SESSION['S5'] ?>" autocomplete="off" onKeyPress="return numbersonly(this, event)" style="text-align:right">
                  &nbsp;m</td>
                <td width="65">S7 timber:</td>
                <td width="146"><label for="textfield2"></label>
                  <input name="S7_text" type="text" class="text100" id="S7_text" value="<?php echo $_SESSION['S7'] ?>" autocomplete="off" onKeyPress="return numbersonly(this, event)" style="text-align:right">
                  &nbsp;m</td>
                
              </tr>
              <tr>
                <td>plates area:</td>
                <td><input name="plate_area_text" type="text" class="text100" id="plate_area_text" value="<?php echo $_SESSION['plate_area'] ?>" onKeyPress="return isNumberKey(event)" onChange=" this.value = this.value.replace (/(\.........).*/, '$1')"  autocomplete="off" style="text-align:right">
                m<sup>2</sup></td>
                <td>FT:</td>
                <td><input name="press_text" type="text" class="text100" id="press_text" value="<?php echo $_SESSION['press_points'] ?>" autocomplete="off" onKeyPress="return numbersonly(this, event)" onBlur="document.getElementById('next_button').focus(); "></td>
                
              </tr>	
            </table>
        </div>
      </td>
      </tr>
      <tr>
      <td><table width="590" height="50" align="center" id="table_button_bar">
        <tr>
          <td width="117"><input type="button" name="lastprev_button" class="imagebutton" value="Prev"  onclick="needToConfirm = false;MM_showHideLayers('wait','','show');MM_goToURL('parent','captureJobWizbase.php?s=&amp;p=1');return document.MM_returnValue" /></td>
          <td width="115">&nbsp;</td>
          <td width="99"><input name="p" type="hidden" id="p" value="2" />
            <input name="s" type="hidden" id="s" value="2" />
            </span></td>
          <td width="125" align="right"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton"  onClick="needToConfirm = false; cancel_confirmation(1, '../production/production_main.php');" value="Cancel" /></td>
          <td width="110" align="right"><input type="submit" name="next_button" id="next_button" class="imagebutton" value="Next"  onClick="needToConfirm = false; MM_showHideLayers('wait','','show'); " /></td>
        </tr>
      </table></td>
      </tr>
      </table>
</form>
</div>
<!--form validation-->
<script language="JavaScript" type="text/javascript" xml:space="preserve">

  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("roofcover_select","req","Please select type of roof cover");
  frmvalidator.addValidation("roof_pitch_text","req","Please enter roof pitch");
  frmvalidator.addValidation("overhang_text","req","Please enter the maximum overhang");
  frmvalidator.addValidation("roof_area_text","req","Please enter the roof area");
  frmvalidator.addValidation("floor_area_text","req","Please enter the floor area");
  frmvalidator.addValidation("S5_text","req","Please enter estimated length S5 timber");
  frmvalidator.addValidation("S7_text","req","Please enter estimated length S7 timber");
  frmvalidator.addValidation("plate_area_text","req","Please enter the estimated plates area");
  frmvalidator.addValidation("press_text","req","Please enter the estimated number of FT");
  
</script>
</body>      