<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  
<script language="JavaScript" src="../jscript/gen_validatorv4_2.js"  type="text/javascript" xml:space="preserve"></script>
 
<?php

//include('../include/db.php');
include('../include/session.php');	
include('../include/formValidations.php');

$cat=$_GET['cat'];
$job_no = $_GET['job_no'];
$show = $_GET['show'];
$bracing_num = $_GET['bracing_select'];


if ($cat=='Bracing') {
$table_name = $_SESSION['db_prefix']."_list_bracing";
$dropDownQuery = "SELECT item_id, item_name, width, depth FROM $table_name ORDER BY item_name ASC";
$dropDownResult = execsql($dropDownQuery);
	$num = mysql_num_rows($dropDownResult);
	$a = 0;
	$arrId = array ();
	$arrName = array ();
	while ($a < $num) {
		$arrId[$a] = mysql_result($dropDownResult, $a, "item_id");
		$arrName[$a] = mysql_result($dropDownResult, $a, "item_name");
		$arrWidth[$a] = mysql_result($dropDownResult, $a, "width");
		$arrDepth[$a] = mysql_result($dropDownResult, $a, "depth");
		$a++;
	}
}

if ($cat=='Sundries') {	
$table_name = $_SESSION['db_prefix']."_list_sundries";
$dropDownQuery = "SELECT item_id, item_name FROM $table_name ORDER BY item_name ASC";

$dropDownResult = execsql($dropDownQuery);
	$num = mysql_num_rows($dropDownResult);
	$a = 0;
	$arrId = array ();
	$arrName = array ();
	while ($a < $num) {
		$arrId[$a] = mysql_result($dropDownResult, $a, "item_id");
		$arrName[$a] = mysql_result($dropDownResult, $a, "item_name");
		$a++;
	}
}


	

?>

<style>
select.store_item_select {
width:230px;
}
select.store_item_select option {
width:220px;
}

label.label_std{
	margin-left:5px;
    line-height:20px;
	padding-top:6px;
    color:#000;
    text-shadow:1px 1px 1px #fff;
    font:bold 12px Arial;
}

input.imagebutton{
	background-color:#E1E1E1;
	width: 100px;
	height: 24px;
	border:solid;
	border-width:1px;
	border-color:#FB6808;
	cursor:pointer;
	color:#000000;
	font:bold 12px Arial;
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
	-moz-box-shadow:0px 0px 0px #CCC;
	-webkit-box-shadow:0px 0px 0px #CCC;
	box-shadow:0px 0px 0px #CCC;
	
}
</style>

<style >
input.imagebutton{
	background-color:#E1E1E1;
	width: 100px;
	height: 24px;
	border:solid;
	border-width:1px;
	border-color:#FB6808;
	cursor:pointer;
	color:#000000;
	font:bold 12px Arial;
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
	-moz-box-shadow:0px 0px 0px #CCC;
	-webkit-box-shadow:0px 0px 0px #CCC;
	box-shadow:0px 0px 0px #CCC;
	
}

input.imagebutton:hover{
	background-color:#E4E4E4;
	width: 100px;
	height: 24px;
	border:solid;
	border-width:2px;
	border-color:#FB6808;
	cursor:pointer;
	color:#000000;
	font:bold 12px Arial;
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
	-moz-box-shadow:5px 5px 5px #666;
	-webkit-box-shadow:5px 5px 5px #666;
	box-shadow:5px 5px 5px #666;
	
}

input.imagebutton:disabled{
	background-color:#E4E4E4;
	width: 100px;
	height: 24px;
	border:solid;
	border-width:1px;
	border-color:#E4E4E4;
	cursor:none;
	color:#666;
	font:bold 12px Arial;
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	border-radius: 5px;
	
	
	
}

</style>
<script type="text/javascript">
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
</script>
</head>
<body onload="<?php if ($show==0) {?>document.getElementById('finish_add_bracing').disabled = true; document.getElementById('next_add_bracing').disabled = true;<?php } ?>">
<div  style="height:auto;">  <form action="authorisation_edit_add_bracing.php" method="get" name="form1" target="_self" id="form1">
    <table width="451" border="0">
  <tr>
    <td width="445" align="center" valign="middle"><span class="wizard_frame">
      <label class="label_std"><?php echo $cat?></label>
      <br />
      <select  name="bracing_select" class="store_item_select" id="bracing_select" style="width:250px;" onchange="document.getElementById('finish_add_bracing').disabled = false; document.getElementById('next_add_bracing').disabled = false; document.forms.form1.submit();">
        <option value=" " selected="selected"> </option>
        <?php
    	for ($i = 0; $i < count($arrId); $i++) {
		echo "<option value=" . "\"" . $arrId[$i] . "\"" . ">" . $arrName[$i] ." </option>";
		
		
	    }
     ?>
      </select>
      <input type="hidden" name="cat" id="cat" value='<?php echo $cat?>';/>
      <input type="hidden" name="job_no" id="job_no" value='<?php echo $job_no?>';/>
      <input type="hidden" name="show" id="show" value='1';/>
    </span></td>
  </tr>
</table>
</form>  
<form action="authorisation_edit_add_bracing_save.php" method="get" name="form2" target="_top" id="form2">
    <table width="450" border="0" align="left" cellpadding="0" cellspacing="0" class="list2" id="select_table">
    <tr>
      <td height="38" align="center"></td>
    </tr>
    <tr>
      <td align="center">
      
      <?php if ($show=='1') { include('timber_lengths.php'); }?></td>
      </tr>
    <tr>
      <td align="center"><label for="textfield"></label>
        <br />
        <input name="next_add_bracing" type="submit" id="next_add_bracing" value="Next" class="imagebutton" style="visibility:hidden;"  />
         <input name="finish_add_bracing" type="submit" id="finish_add_bracing" value="Add" class="imagebutton"  />
        <input name="button" type="button" id="button" class="imagebutton" onclick="MM_goToURL('parent','../production/authorisation_edit.php?&job_no=<?php echo $job_no?>&screen=0&edit=1&sub_category=<?php if ($cat=='Bracing') { echo '#bracing'; } else { echo '#sundries2';}?>');return document.MM_returnValue" value="Cancel" />
        <input type="hidden" name="job_no" id="job_no" value="<?php echo $job_no?>" />
        <?php if ($cat=='Bracing') {?><input type="hidden" name="cat" id="cat" value="Bracing" /><?php } ?>
        <?php if ($cat=='Sundries') {?><input type="hidden" name="cat" id="cat" value="Sundries" /><?php } ?>
      <input type="hidden" name="bracing_num" id="bracing_num" value="<?php echo $bracing_num?>"/>  
      </td>
    </tr>
  </table>
</form>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form2");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("store_item_id_radio","selone","Please select item.");
  frmvalidator.addValidation("qty_text","req","Please enter quantity.");
</script>
</div>
</body>
</html>