<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="JavaScript" src="../jscript/cancel_confirmation.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/show_hide_layers.js"  type="text/javascript"></script> 
<script language="javascript" src="../jscript/chainedselects.js"></script>
<script language="javascript" src="../jscript/no_spaces.js"></script>
<script language="JavaScript" src="../jscript/alert_message.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/capitalize_textbox.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/tooltip.js"  type="text/javascript"></script> 
<script language="JavaScript" src="../jscript/numbers_only.js"  type="text/javascript"></script>
<script language="JavaScript" src="../window/dhtmlwindow.js"  type="text/javascript"></script>  
<script language="JavaScript" src="../window/modal.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/numbers_only_decimal.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/confirm_exit.js"  type="text/javascript"></script>     

 
<!--style sheets-->
<link href="../css/tooltip.css" rel="stylesheet" type="text/css">
<link href="../window/dhtmlwindow.css" rel="stylesheet" type="text/css">
<link href="../window/modal.css" rel="stylesheet" type="text/css">


<?php
include('../include/session.php');

$edit=$_GET['edit'];
$message='no';
if ($edit==1) {
	$preset_name = $_GET['preset_name_text'];
	$list_type = $_GET['list_RadioGroup'];
	$table_name = $_SESSION['db_prefix']."_preset_list";
	$check_query = "SELECT preset_list_name FROM $table_name WHERE preset_list_name = '".$preset_name."' ";
	$check_result = mySQL_query($check_query);
	$check_num = mysql_num_rows($check_result);
	if ($check_num>0) {
		  $message='yes';
		  $edit=0;
	}
}

$table_name = $_SESSION['db_prefix']."_store_items";
$store_item_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory = 'Electric fencing' ORDER BY item_name ASC";
	$store_item_result = execsql($store_item_query);
	$store_item_num = mysql_num_rows($store_item_result);
	$w = 0;
	$arrId2 = array ();
	$arrName2 = array ();
	while ($w < $store_item_num) {
		$arrId2[$w] = mysql_result($store_item_result, $w, "store_item_id");
		$arrName2[$w] = mysql_result($store_item_result, $w, "item_name")." - -~".mysql_result($store_item_result, $w, "unit");
		$w++;
	}
	
$table_name = $_SESSION['db_prefix']."_store_items";
$store_item_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory = 'Fencing' ORDER BY item_name ASC";
	$store_item_result = execsql($store_item_query);
	$store_item_num = mysql_num_rows($store_item_result);
	$w = 0;
	$arrId3 = array ();
	$arrName3 = array ();
	while ($w < $store_item_num) {
		$arrId3[$w] = mysql_result($store_item_result, $w, "store_item_id");
		$arrName3[$w] = mysql_result($store_item_result, $w, "item_name")." - -~".mysql_result($store_item_result, $w, "unit");
		$w++;
	}
	
$table_name = $_SESSION['db_prefix']."_store_items";
$store_item_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory = 'Palisade' ORDER BY item_name ASC";
	$store_item_result = execsql($store_item_query);
	$store_item_num = mysql_num_rows($store_item_result);
	$w = 0;
	$arrId4 = array ();
	$arrName4 = array ();
	while ($w < $store_item_num) {
		$arrId4[$w] = mysql_result($store_item_result, $w, "store_item_id");
		$arrName4[$w] = mysql_result($store_item_result, $w, "item_name")." - -~".mysql_result($store_item_result, $w, "unit");
		$w++;
	}
	
$table_name = $_SESSION['db_prefix']."_store_items";
$store_item_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory = 'M-works' ORDER BY item_name ASC";
	$store_item_result = execsql($store_item_query);
	$store_item_num = mysql_num_rows($store_item_result);
	$w = 0;
	$arrId5 = array ();
	$arrName5 = array ();
	while ($w < $store_item_num) {
		$arrId5[$w] = mysql_result($store_item_result, $w, "store_item_id");
		$arrName5[$w] = mysql_result($store_item_result, $w, "item_name")." - -~".mysql_result($store_item_result, $w, "unit");
		$w++;
	}
	
$table_name = $_SESSION['db_prefix']."_store_items";
$store_item_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory = 'Cleaning materials' ORDER BY item_name ASC";
	$store_item_result = execsql($store_item_query);
	$store_item_num = mysql_num_rows($store_item_result);
	$w = 0;
	$arrId6 = array ();
	$arrName6 = array ();
	while ($w < $store_item_num) {
		$arrId6[$w] = mysql_result($store_item_result, $w, "store_item_id");
		$arrName6[$w] = mysql_result($store_item_result, $w, "item_name")." - -~".mysql_result($store_item_result, $w, "unit");
		$w++;
	}
	
$table_name = $_SESSION['db_prefix']."_store_items";
$store_item_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory = 'Consumables' ORDER BY item_name ASC";
	$store_item_result = execsql($store_item_query);
	$store_item_num = mysql_num_rows($store_item_result);
	$w = 0;
	$arrId7 = array ();
	$arrName7 = array ();
	while ($w < $store_item_num) {
		$arrId7[$w] = mysql_result($store_item_result, $w, "store_item_id");
		$arrName7[$w] = mysql_result($store_item_result, $w, "item_name")." - -~".mysql_result($store_item_result, $w, "unit");
		$w++;
	}	
	
$table_name = $_SESSION['db_prefix']."_store_items";
$store_item_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory = 'Fuel' ORDER BY item_name ASC";
	$store_item_result = execsql($store_item_query);
	$store_item_num = mysql_num_rows($store_item_result);
	$w = 0;
	$arrId8 = array ();
	$arrName8 = array ();
	while ($w < $store_item_num) {
		$arrId8[$w] = mysql_result($store_item_result, $w, "store_item_id");
		$arrName8[$w] = mysql_result($store_item_result, $w, "item_name")." - -~".mysql_result($store_item_result, $w, "unit");
		$w++;
	}	
	
$table_name = $_SESSION['db_prefix']."_store_items";
$store_item_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory = 'Lubricants' ORDER BY item_name ASC";
	$store_item_result = execsql($store_item_query);
	$store_item_num = mysql_num_rows($store_item_result);
	$w = 0;
	$arrId9 = array ();
	$arrName9 = array ();
	while ($w < $store_item_num) {
		$arrId9[$w] = mysql_result($store_item_result, $w, "store_item_id");
		$arrName9[$w] = mysql_result($store_item_result, $w, "item_name")." - -~".mysql_result($store_item_result, $w, "unit");
		$w++;
	}	

$table_name = $_SESSION['db_prefix']."_store_items";
$store_item_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory = 'Machine spares' ORDER BY item_name ASC";
	$store_item_result = execsql($store_item_query);
	$store_item_num = mysql_num_rows($store_item_result);
	$w = 0;
	$arrId10 = array ();
	$arrName10 = array ();
	while ($w < $store_item_num) {
		$arrId10[$w] = mysql_result($store_item_result, $w, "store_item_id");
		$arrName10[$w] = mysql_result($store_item_result, $w, "item_name")." - -~".mysql_result($store_item_result, $w, "unit");
		$w++;
	}

$table_name = $_SESSION['db_prefix']."_store_items";
$store_item_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory = 'PPE' ORDER BY item_name ASC";
	$store_item_result = execsql($store_item_query);
	$store_item_num = mysql_num_rows($store_item_result);
	$w = 0;
	$arrId11 = array ();
	$arrName11 = array ();
	while ($w < $store_item_num) {
		$arrId11[$w] = mysql_result($store_item_result, $w, "store_item_id");
		$arrName11[$w] = mysql_result($store_item_result, $w, "item_name")." - -~".mysql_result($store_item_result, $w, "unit");
		$w++;
	}

$table_name = $_SESSION['db_prefix']."_store_items";
$store_item_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory = 'Tools' ORDER BY item_name ASC";
	$store_item_result = execsql($store_item_query);
	$store_item_num = mysql_num_rows($store_item_result);
	$w = 0;
	$arrId12 = array ();
	$arrName12 = array ();
	while ($w < $store_item_num) {
		$arrId12[$w] = mysql_result($store_item_result, $w, "store_item_id");
		$arrName12[$w] = mysql_result($store_item_result, $w, "item_name")." - -~".mysql_result($store_item_result, $w, "unit");
		$w++;
	}

$table_name = $_SESSION['db_prefix']."_store_items";
$store_item_query = "SELECT store_item_id, item_name, unit FROM $table_name WHERE subCategory = 'Welding & Engineering' ORDER BY item_name ASC";
	$store_item_result = execsql($store_item_query);
	$store_item_num = mysql_num_rows($store_item_result);
	$w = 0;
	$arrId13 = array ();
	$arrName13 = array ();
	while ($w < $store_item_num) {
		$arrId13[$w] = mysql_result($store_item_result, $w, "store_item_id");
		$arrName13[$w] = mysql_result($store_item_result, $w, "item_name")." - -~".mysql_result($store_item_result, $w, "unit");
		$w++;
	}
	
?>




<script>


//var disable_empty_list=true; //uncomment this line to disable empty selection lists
<?php 
$i=0;
while ( $i<10 ) {

?>

addListGroup("Direct materials", "category<?php echo $i ?>", "store_item_id_select<?php echo $i ?>", "items");
//addOption("category0", "", "", "", 1); //Empty starter option
addList("category<?php echo $i ?>", "<?php echo $_SESSION['category'.$i]?>", "<?php echo $_SESSION['category'.$i]?>", "");
addList("category<?php echo $i ?>", "Electric fencing", "Electric fencing", "Electric fencing");
addList("category<?php echo $i ?>", "Fencing", "Fencing", "Fencing");
addList("category<?php echo $i ?>", "Palisade", "Palisade", "Palisade");
addList("category<?php echo $i ?>", "M-works", "M-works", "M-works");
addList("category<?php echo $i ?>", "Cleaning materials", "Cleaning materials", "Cleaning materials");
addList("category<?php echo $i ?>", "Consumables", "Consumables", "Consumables");
addList("category<?php echo $i ?>", "Fuel", "Fuel", "Fuel");
addList("category<?php echo $i ?>", "Lubricants", "Lubricants", "Lubricants");
addList("category<?php echo $i ?>", "Machine spares", "Machine spares", "Machine spares");
addList("category<?php echo $i ?>", "PPE", "PPE", "PPE");
addList("category<?php echo $i ?>", "Tools", "Tools", "Tools");
addList("category<?php echo $i ?>", "Welding & Engineering", "Welding & Engineering", "Welding & Engineering");


<?php
$i++;
}
?>

		addList("Electric fencing", "", "", "");
		<?php 
    	for ($w = 0; $w < count($arrId2); $w++) { ?>
			addList("Electric fencing", "", "<?php echo $arrId2[$w]?> ", "");
		<?php
	    }
     ?>
		addList("Fencing", "", "", "");
		<?php 
        for ($w = 0; $w < count($arrId3); $w++) { ?>
			addList("Fencing", "<?php echo $arrName3[$w]?> ", "<?php echo $arrId3[$w]?> ", "");
		<?php
	    }
	?>
      addList("Palisade", "", "", "");
		<?php 
        for ($w = 0; $w < count($arrId4); $w++) { ?>
			addList("Palisade", "<?php echo $arrName4[$w]?> ", "<?php echo $arrId4[$w]?> ", "");
		<?php
	    }
	?>
	   addList("M-works", "", "", "");
		<?php 
        for ($w = 0; $w < count($arrId5); $w++) { ?>
			addList("M-works", "<?php echo $arrName5[$w]?> ", "<?php echo $arrId5[$w]?> ", "");
		<?php
	    }
	?>
	addList("Cleaning materials", "", "", "");
		<?php 
        for ($w = 0; $w < count($arrId6); $w++) { ?>
			addList("Cleaning materials", "<?php echo $arrName6[$w]?> ", "<?php echo $arrId6[$w]?> ", "");
		<?php
	    }
	?>
	addList("Consumables", "", "", "");
		<?php 
        for ($w = 0; $w < count($arrId7); $w++) { ?>
			addList("Consumables", "<?php echo $arrName7[$w]?> ", "<?php echo $arrId7[$w]?> ", "");
		<?php
	    }
	?>
	addList("Fuel", "", "", "");
		<?php 
        for ($w = 0; $w < count($arrId8); $w++) { ?>
			addList("Fuel", "<?php echo $arrName8[$w]?> ", "<?php echo $arrId8[$w]?> ", "");
		<?php
	    }
	?>
	addList("Lubricants", "", "", "");
		<?php 
        for ($w = 0; $w < count($arrId9); $w++) { ?>
			addList("Lubricants", "<?php echo $arrName9[$w]?> ", "<?php echo $arrId9[$w]?> ", "");
		<?php
	    }
	?>
	addList("Machine spares", "", "", "");
		<?php 
        for ($w = 0; $w < count($arrId10); $w++) { ?>
			addList("Machine spares", "<?php echo $arrName10[$w]?> ", "<?php echo $arrId10[$w]?> ", "");
		<?php
	    }
	?>
	addList("PPE", "", "", "");
		<?php 
        for ($w = 0; $w < count($arrId11); $w++) { ?>
			addList("PPE", "<?php echo $arrName11[$w]?> ", "<?php echo $arrId11[$w]?> ", "");
		<?php
	    }
	?>
	addList("Tools", "", "", "");
		<?php 
        for ($w = 0; $w < count($arrId12); $w++) { ?>
			addList("Tools", "<?php echo $arrName12[$w]?> ", "<?php echo $arrId12[$w]?> ", "");
		<?php
	    }
	?>
	addList("Welding & Engineering", "", "", "");
		<?php 
        for ($w = 0; $w < count($arrId13); $w++) { ?>
			addList("Welding & Engineering", "<?php echo $arrName13[$w]?> ", "<?php echo $arrId13[$w]?> ", "");
		<?php
	    }
	?>
	


</script>
  
<script language="javascript">
function addRow(dataTable) {
 
            var table = document.getElementById(dataTable);
 
            var rowCount = table.rows.length;
            var row = table.insertRow(rowCount);
			var line_no = rowCount-1;
 
            var cell1 = row.insertCell(0);
            var element1 = document.createElement("input");
            element1.type = "checkbox";
            element1.name="line_checkbox"+line_no;
			element1.id="line_checkbox"+line_no;
			/*element1.checked="checked";*/
            cell1.appendChild(element1);
			
            var cell2 = row.insertCell(1);
            var element2 = document.createElement("select");
            element2.name = "category"+line_no;
			element2.id = "category"+line_no;
			element2.className = "select160";
			element2.onchange = function() {document.getElementById("index"+line_no).value = document.getElementById("category"+line_no).selectedIndex; }
						
			var element9 = document.createElement("input");
            element9.type = "hidden";
            element9.name = "index"+line_no;
			element9.id = "index"+line_no;
			
			var element10 = document.createElement("input");
            element10.type = "hidden";
            element10.name = "store_item_id"+line_no;
			element10.id = "store_item_id"+line_no;
											
            var element7 = document.createElement("select");
            element7.name = "store_item_id_select"+line_no;
			element7.id = "store_item_id_select"+line_no;
			element7.className = "select250";
			element7.style="margin-left:3px;";
			element7.selectedIndex= -1;
			element7.onchange = function(){
				document.getElementById("line_checkbox"+line_no).checked = "checked"; 
				document.getElementById("store_item_id"+line_no).value = 
				document.getElementById("store_item_id_select"+line_no).value; 
				units=document.getElementById("store_item_id_select"+line_no).options[document.getElementById("store_item_id_select"+line_no).selectedIndex].text;
				units2 = units.split("~"); 
				units3 = units2[1]; 
				if (units3=="no") {
					document.getElementById("quantity_text"+line_no).value = ""; 
					document.getElementById("quantity_text"+line_no).onkeypress = function num(event) { return numbersonly(this, event);}
					
					}
					else {
						document.getElementById("quantity_text"+line_no).value = ""; 
						document.getElementById("quantity_text"+line_no).onkeypress = function num(event) { return isNumberKey(event);}
						}
						document.getElementById("store_item_id"+line_no).value=document.getElementById("store_item_id_select0"+line_no).value; 
						document.getElementById("store_item_text"+line_no).value = document.getElementById("store_item_id_select0"+line_no).value; 
						};
						
			cell2.appendChild(element2);
			cell2.appendChild(element9);
			cell2.appendChild(element10);
			cell2.appendChild(element7);
			
			<?php
			$t=0;
			while ($t<25) {
			?>
			if (line_no==<?php echo $t ?>) {
			initListGroup("Direct materials", form1.category<?php echo $t ?>, form1.store_item_id_select<?php echo $t ?>);
			function initLists() { 
  			form1.category<?php echo $t ?>.selectedIndex = -1;
  			form1.category<?php echo $t ?>.onchange();
			}
			}
			<?php 
			$t++;
			}
			?>
			
			
            var cell4 = row.insertCell(2);
			cell4.align = "right";
            var element3 = document.createElement("input");
            element3.type = "text";
            element3.name = "quantity_text"+line_no;
			element3.id = "quantity_text"+line_no;
			element3.className = "text60";
			element3.value = "";
			element3.style = "text-align:right";
			element3.autocomplete="off";
			element3.onkeypress = function isNumberKey(evt)
       								{
          							var charCode = (evt.which) ? evt.which : event.keyCode
          							if ( charCode > 31 
            						&& (charCode < 45 || charCode > 57)
									)
             						return false;
 
          							return true;
       								}
									;
			element3.onchange = function(){document.getElementById("line_checkbox"+line_no).checked = "checked";}
			cell4.appendChild(element3);
			
					
			var cell5 = row.insertCell(3);
			cell5.align = "right";
				

            var element4 = document.createElement("input");
            element4.type = "hidden";
            element4.name = "line_num";
			element4.value = rowCount;
            						
			
            cell5.appendChild(element4);
			
			var element8 = document.createElement("script");
			element8.setAttribute('type', 'text/javascript');
			element8.innerHTML="var frmvalidator  = new Validator('form1');frmvalidator.EnableMsgsTogether();for (i = 0; i < 10; i++) "; 
			document.getElementsByTagName('head').item(0).appendChild(element8);



		
element1.onmouseup = function() {
				 if (document.getElementById('line_checkbox'+line_no).checked) {
                         element2.style.background = '#F0F0F0';
						 element3.style.background = '#F0F0F0';
						 element2.selectedIndex=1;
						 element3.value = '-----';
						 element2.disabled = true;
						 element3.disabled = true;
						 
						 
                } else {
                        element2.style.background = '#FFF';
						element3.style.background = '#FFF';
						element2.selected_index=0;
						element3.value = '';
						element2.disabled = false;
						element3.disabled = false;
						
						 
                }
				};
			
}
</script> 


<script language="javascript">
function initCS() {
<?php
$t=0;
while ($t<50) {
?>
initListGroup("Direct materials", form1.category<?php echo $t ?>, form1.store_item_id_select<?php echo $t ?>); 


function initLists() {
  form1.category<?php echo $t ?>.onchange();
  category<?php echo $t ?>.fireEvent("onchange");
}

function initLists2() {
  form1.store_item_id_select<?php echo $t ?>.selectedIndex = -1;
  form1.store_item_id_select<?php echo $t ?>.onchange();
}
<?php 
$t++;
}
?>
}
</script>
</head>



<?php
include ("../navigation/header.php");
$page_name = "AD-presets";
include ("../navigation/access.php");
if ($permission_num==1) {
	include ("../navigation/admin_sidebar.php");
?>

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


<div class="main_frame"  style="height:auto; min-height:570px;">
<div class="page_head_frame">
    <table width="809" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="385"><label class="label_page_head">Preset order/production list</label></td>
        <td align="right">&nbsp;</td>
      </tr>
    </table>
  </div>

<div class="page_middle_frame">      
<form id="form2" name="form2" method="GET" action="preset_order_list.php">
  <div class="page_inside_frame" style="display:<?php if ($edit==0) { echo 'block';} else { echo 'none'; } ?>; "> 
  <?php if ($message=='yes') { ?> <img src="../images/exclamation_mark_red_small.png" width="10" height="16">The name <?php echo $preset_name ?> is already used. Please use another name. <?php } ?>
  <br>
Name of preset list:&nbsp;&nbsp;&nbsp;
    <input name="preset_name_text" id="preset_name_text" type="text" class="text200" maxlength="20" onkeyup="nospaces(this)" onBlur="capitalize(this)">
    &nbsp;&nbsp;<img src="../images/info_green.png" width="16" height="16">
<label class="label_small">Don't use spaces in the name, max 20 characters.</label>
    <br><br>

     Listing for:
     <input type="radio" name="list_RadioGroup" value="Orders" id="list_RadioGroup_0">Orders
     <input type="radio" name="list_RadioGroup" value="Production" id="list_RadioGroup_1">Production
     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input name="edit" type="hidden" value="1">
    <input name="list_button" type="submit" class="imagebutton" id="list_button" value="Make list" onClick="needToConfirm = false;">
  </div>
</form>
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form2");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("preset_name_text","req","- list name.");
  frmvalidator.addValidation("list_RadioGroup","selone","- list type.");
</script> 


  <form id="form1" name="form1" method="POST" action="preset_order_list_save.php">
  <div style="display:<?php if ($edit==1) { echo 'block';} else { echo 'none'; } ?>;"> 
  <div class="page_inside_frame" style="min-height:350px;  ">
  Enter items for the <?php echo $list_type .' preset list "<b>'. $preset_name.'</b>"' ?>.
  <input name="preset_name_text" type="hidden" value="<?php echo $preset_name ?>">
  <input name="list_type_text" type="hidden" value="<?php echo $list_type ?>"><br>
    <table id="dataTable" width="635" border="1" style="border-collapse:collapse;">
    <thead> 
        <tr>
          <td>&nbsp;</td>
          <td width="418">Store item</td>
          <td align="center">Quantity</td>
          <td>&nbsp;</td>
        </tr>
        </thead>
        <script>
			 function check_it() {
				 if (document.getElementById('line_checkbox0').checked) {
                         document.getElementById('store_item_id_select0').style.background = '#F0F0F0';
						 document.getElementById('store_item_text0').style.background = '#F0F0F0';
						 document.getElementById('quantity_text0').style.background = '#F0F0F0';
						 document.getElementById('store_item_id_select0').selectedIndex=1;
						 document.getElementById('store_item_text0').value = '.';
						 document.getElementById('quantity_text0').value = '.';
						document.getElementById('store_item_id_select0').disabled = true;
						 document.getElementById('store_item_text0').disabled = true;
						 document.getElementById('quantity_text0').disabled = true;
						 document.getElementById('add_icon0').hidden = true;
						 
                } else {
                         document.getElementById('store_item_id_select0').style.background = '#FFF';
						 document.getElementById('quantity_text0').style.background = '#FFF';
						 document.getElementById('store_item_id_select0').selectedIndex=0;
						 document.getElementById('store_item_text0').value = '';
						 document.getElementById('quantity_text0').value = '';
						 document.getElementById('store_item_id_select0').disabled = false;
						 document.getElementById('quantity_text0').disabled = false;
						 document.getElementById('add_icon0').hidden = false;
                }
				}
		     </script>
        <tr>
            <td width="20"><input type="checkbox" name="line_checkbox0" id="line_checkbox0" onMouseUp="check_it()"  /></td>
          <td>
          
         <div id=store_item_divB0 >
              <select name="category0" id="category0"  class="select160"  onChange="document.getElementById('store_item_divA0').hidden=true; document.getElementById('store_item_divB0').hidden=false; document.getElementById('store_item_id_select0').selectedIndex=-1; document.getElementById('index0').value = document.getElementById('category0').selectedIndex; ">
              </select>
              <input type="hidden" name="index0" id="index0">
              <input type="hidden" name="store_item_id0" id="store_item_id0">
              <select name="store_item_id_select0" id="store_item_id_select0" class="select250" onChange="
              document.getElementById('line_checkbox0').checked=true;
              unit = document.getElementById('store_item_id_select0').options[document.getElementById('store_item_id_select0').selectedIndex].text; 
              unit2 = unit.split('~'); 
              unit3 = unit2[1];
              if (unit3=='no') {
              document.getElementById('quantity_text0').value = '';
              document.getElementById('quantity_text0').onkeypress = function num(event) { return numbersonly(this, event);}
              }
              else {
              document.getElementById('quantity_text0').value = '';
              document.getElementById('quantity_text0').onkeypress = function decnum(event) { return isNumberKey(event);}  
              }            
              document.getElementById('store_item_id0').value=document.getElementById('store_item_id_select0').value; 
              document.getElementById('store_item_text0').value = document.getElementById('store_item_id_select0').value; 
              "
              >
               
              </select>
            </div> 
            
          </td>
          <td width="84" align="right"><input  name="quantity_text0" type="text" class="text60" id="quantity_text0" style="text-align:right" value="" size="10" autocomplete="off"  onKeyPress="return isNumberKey(event)" />  
          </td>
            <td width="85" align="right"><input type="hidden" name="line_num" id="line_num" value="1" >
      

        </td>    
            <!--<input name="textfield0" type="text" id="textfield0" size="5" value="1"></td>-->
        </tr>
        
        
  </table>
  
    <input type="button" class="imagebutton" onClick="addRow('dataTable')" value="Add line" />
    <div align="right"><label class="label_small">To delete a line: uncheck line box</label></div>
	
				
 </div> 


    <div class="page_inside_frame">
      <table width="645" border="0">
    <tr>
      <td width="20"></td>
      <td width="615" align="right"><input name="button2" type="button" class="imagebutton" id="button2" onclick="cancel_confirmation(3, '../admin_module/user_list.php');" value="Close"/>
        <input name="save_close_button"  id="save_close_button" type="submit" class="imagebutton" value="Save &amp; Close" onclick="needToConfirm = false; confirmRefresh();" /></td>
    </tr>
  </table>
</div>
</div>

</form> 
<!--<script language="JavaScript" type="text/javascript" xml:space="preserve">'
var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
 for (j = 0; j < 20; j++) {
	frmvalidator.addValidation("item_text2"+j,"req","- store item on store line 2-"+(j+1)+".");
	frmvalidator.addValidation("order_text2"+j,"req","- order no on store line 2-"+(j+1)+".");
	frmvalidator.addValidation("quantity_text2"+j,"req","- quantity  on store line2-"+(j+1)+".");
  	frmvalidator.addValidation("amount_text2"+j,"req","- price on store line 2-"+(j+1)+".");
	
}
</script>-->
</div>
</div>

<?php } else {
    $_SESSION['denied_return'] = "admin_module/user_list.php";	
    include ("../navigation/admin_sidebar.php");?>
	<body onLoad="accessdenied(); return false">	
	</body>
<?php }
?>


<?php include ('../navigation/side_bar.php'); ?>
</body>
</html>