<!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" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="popup.css" />
<script language="JavaScript" src="gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<style>
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;
	
}

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;
	
}
</style>
<?php

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


$cust_id = $_GET['cust_id'];
$field =$_GET['field'];


$table_name = $_SESSION['db_prefix']."_customer";
$customer_query = "SELECT $field FROM $table_name WHERE cust_id ='".$cust_id."' ";
$customer_result = mySQL_query($customer_query);
$value = mysql_result($customer_result, 0, "$field");

if ($field=="status") {
	$select_box ="
          <select name=editText id=editText>
          <option value=credit>credit</option>
          <option value=cash>cash</option>
		  <option value=closed>closed</option>
          <option value= $value  selected=selected> $value </option>
          </select>
		  ";
   }


   
if ($field=="bag_box") {
	$select_box ="
          <select name=editText id=editText>
          <option value=PO&nbsp;Box>PO&nbsp;Box</option>
          <option value=P&nbsp;Bag>P&nbsp;Bag</option>
          <option value= $value  selected=selected> $value </option>
          </select>
		  ";
   }
   


?>
<script type="text/javascript">
function stopRKey(evt) {
  var evt = (evt) ? evt : ((event) ? event : null);
  var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  if ((evt.keyCode == 13) && (node.type=="text"))  {return false;}
}
document.onkeypress = stopRKey;
</script> 

<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_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//-->
</script>


</head>
<form action="../sales/customer_details_edit.php" method="get" name="form1" target="_top" id="form1">
<body onload="document.getElementById(;MM_callJS('document.getElementById(\'quantityText\').focus();')"editText").focus();">
<table width="290" border="0" align="center" cellpadding="0" cellspacing="0" class="list2">
  <tr>
    <td width="290" align="center"><p><label class="label_std">Edit the value and click "Edit"<br />
If you don't want to change, click "cancel"</label>
        <br />
        <br />
        <?php echo $select_box ?>
<input name="edit" type="hidden" id="edit" value="1"  />
    <input name="cust_id" type="hidden" id="cust_id" value="<?php echo $cust_id ?>" />
    <input name="field" type="hidden" id="field" value="<?php echo $field ?>" />
    <br /></p></td>
  </tr>
  <tr>
    <td align="center">
      <input name="input" type="submit" value="Edit" class="imagebutton"  />
      <input name="button" type="button" class="imagebutton" id="button" onclick="MM_goToURL('parent','../sales/customer_details_edit.php?cust_id=<?php echo $cust_id ?>&edit=0');return document.MM_returnValue"  value="Cancel" /></form>
    </td>
  </tr>
</table>

<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("ProductSelect","req","Please select a product.");
  frmvalidator.addValidation("QuantityText","req","Please enter the quantity.");
    
    
    
   


  
</script>
</body>
</html>