  <br>
  <table border=1 cellspacing=1 cellpadding=2 width=760 style="border: 1px inset;">
  <form action="controllers/inputController.php" method="post" name="tradeform" id="tradeform">
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Parent Category</td>
  <td valign=top width=610 class=formvalue>
  <input name="tradepkey" id="tradepkey" type="hidden" value="<?=$trade_data['tradepkey'];?>">
  <input name="tradesubcontype" id="tradesubcontype" type="hidden" value="<?=$trade_data['tradesubcontype'];?>">
  <? if ($trade_data['tradelevel']==1) { ?>
    <input name="tradeparentpkey" id="tradeparentpkey" type="hidden" value="<?=$trade_data['tradeparentpkey'];?>">None
  <? } else { ?>
    <select name="tradeparentpkey" id="tradeparentpkey" style="width: 360px;">
    <? if ($pubtask=="add") { ?>
      <? $objtradeparentlevel=$publevel-1; ?>
      <? $objtradeparentpkey=$pubparentid; ?>
    <? } else { ?>
      <? $objtradeparentlevel=$trade_data['tradelevel']-1; ?>
      <? $objtradeparentpkey=$trade_data['tradeparentpkey']; ?>
    <? } ?>
    <? include_once('object-selectparenttrade.tpl'); ?>
    </select>
  <? } ?>
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Level</td>
  <td valign=top width=610 class=formvalue>
  <input name="tradelevel" id="tradelevel" type="text" value="<?=$trade_data['tradelevel'];?>" readonly maxlength=1 style="width: 180px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Code</td>
  <td valign=top width=610 class=formvalue>
  <input name="tradecode" id="tradecode" type="text" value="<?=unescape($trade_data['tradecode']);?>" maxlength=50 style="width: 180px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Description</td>
  <td valign=top width=610 class=formvalue>
  <input name="tradedescription" id="tradedescription" type="text" value="<?php echo htmlentities(stripslashes($trade_data['tradedescription']));?>" maxlength=200 style="width: 360px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Type</td>
  <td valign=top width=610 class=formvalue>
  <input name="tradetype" id="tradetype" type="text" value="<?=$trade_data['tradetype'];?>" maxlength=40 style="width: 360px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Unit</td>
  <td valign=top width=610 class=formvalue>
  <input name="tradeunit" id="tradeunit" type="text" value="<?=$trade_data['tradeunit'];?>" maxlength=40 style="width: 360px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Remarks</td>
  <td valign=top width=610 class=formvalue>
  <input name="traderemarks" id="traderemarks" type="text" value="<?=$trade_data['traderemarks'];?>" style="width: 360px;">
  </td>
  </tr>
  <tr valign=top>
  <td valign=top width=150 class=formlabel>Received Setting</td>
  <td valign=top width=610 class=formvalue>
  <input name="tradereceivedsetting" id="tradereceivedsetting" type="checkbox" value="<?=$trade_data['tradereceivedsetting'];?>" <? if ($trade_data['tradereceivedsetting']=="1") echo "checked"; ?>>Locked
  </td>
  </tr>
  <input name="job" id="job" type="hidden" value="">
  </form>
  </table>

  <script type="text/javascript">

  function validateForm() {

    var isvalid=true;
    var errmsg="";
    var tradecode=document.getElementById('tradecode');
    var tradedesc=document.getElementById('tradedescription');

    if ((tradecode.value=="")||(tradedesc.value=="")) {
      errmsg='Category Code and Description must be specified!\n';
      isvalid=false;
    }
    if (isvalid==false) alert('Error:\n'+errmsg);
    return isvalid;

  }

  </script>
