<head>
<?php
$table_name = $_SESSION['db_prefix']."_captured_jobs";
$plate_area_query = "SELECT  plate_area FROM $table_name WHERE  job_no = '".$_SESSION['job_no']."' ";
$plate_area_result = mySQL_query($plate_area_query);
$plate_area = mysql_result($plate_area_result, 0, "plate_area");
?>

<!--jscript-->
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script>  

</head>

<?php include('../include/wait.php') ?>

<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">

 <div class="page_middle_frame">  
<form id="form1" method="get" action="trussesJobWizbase.php">
  <table id="tableMain" width="595">
    <!--begin of tableMain-->
    <tr>
      <td><!--center of tableMain-->
        <table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
          <tr>
            <td width="525" valign="top" >
            <div class="wizard_frame">
Estimated plate area: &nbsp;&nbsp;<?php echo $plate_area ?> m<sup>2</sup>
</div>
            <div class="wizard_frame"><br />
                <table width="600" id="table_resume_wizard3">
                <tr>
					   <td align="left"><label class="label_std">Plates</label></td>
			      </tr>
                  <?php 
				 	$table_name = $_SESSION['db_prefix']."_store_items";
					$name_query = "SELECT store_item_id, item_name FROM $table_name WHERE subCategory='Mitek' AND class='plate' ORDER BY item_name  ASC";
					$name_result = mySQL_query($name_query);
					$name_num = mysql_num_rows($name_result);
					
					$k=0;
					
					while ($k<$name_num) {
					
					?>
					 
					 <tr>
                     <?php
                     $i=0;
					 while ($i<3) {
						 
					 if ($k<$name_num) {
					 $a1 = mysql_result($name_result, $k, "store_item_id"); 
					 $a2 = mysql_result($name_result, $k, "item_name");
					 }
					 else {
						 $a1='';
						 $a2='';
					 }
					
					$checked='no';
					$table_name = $_SESSION['db_prefix']."_plates_temp";
					$check_query = "SELECT plate_id FROM $table_name WHERE user =  '".$_SESSION['username']."' AND store_item_id='".$a1."'  ";
					$check_result = mySQL_query($check_query);
					$check_num = mysql_num_rows($check_result);
					if ($check_num!=0) {
						  $checked='yes';
						}		
					 ?>				            
                    <td width='60' align="left"><input type="checkbox" name="<?php echo "check".$k ?>" id="<?php echo "check".$k ?>" value="<?php echo $a1 ?>" <?php if ($checked=='yes') { ?>  checked="checked" <?php } ?>  onClick="document.getElementById('validate_checkbox').checked='checked';"  >
                    <?php echo $a2 ?>&nbsp;
                    <input type="hidden" name="<?php echo "item_no".$k ?>" id="<?php echo "item_no".$k ?>" value="<?php echo $a1 ?>">   
                    </td> 
                    <?php
					$k++;
					$i++;
					
					 }
					 $_SESSION['list_no_8'] = $k;
					  ?>
                  </tr>
                  <?php
				   	 }  
				 	
				  ?>
                  
				  </table>
                <input type="checkbox" name="validate_checkbox" id="validate_checkbox" style="visibility:hidden;">
                
                
                <p>
                  <label class="label_std">Total area:
                    &nbsp;&nbsp;
                    <input name="plate_area_text" type="text" class="text100" id="plate_area_text" onKeyPress="return isNumberKey(event)"onchange=" this.value = this.value.replace (/(\.........).*/, '$1')" value="<?php echo $_SESSION['plate_area']?>" onfocus = "this.select();" onBlur="document.getElementById('next_button').focus();" >
                    &nbsp;m<sup>2</sup></label>
<br />
                  <br />
                  <br />
              </p>
            </div>
<br />
<br>
<br></td>
            <!--center of tableMain-->
          </tr>
          <tr>
            <td><!--center of tableMain-->
              <table width="660" height="50" align="left" cellpadding="20"  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','trussesJobWizbase.php?s=&amp;p=4');return document.MM_returnValue" /></td>
                  <td width="115">&nbsp;</td>
                  <td width="99">
                    <input name="p" type="hidden" id="p" value="5" />
                    <input name="s" type="hidden" id="s" value="5" />
                  </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>
  </table>
  <!--end of tableMain-->
</form>
</div>
<!--form validation-->
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether(); 
  frmvalidator.addValidation("validate_checkbox","shouldselchk","Please select at least one plate.");
  frmvalidator.addValidation("plate_area_text","req","Please enter the total plate area.");
</script>
	
    </body>