  <br>
  <table id="tbltrade" border=1 cellspacing=1 cellpadding=2 width=1948 style="border: 1px inset;"><!--928-->

  <tr valign=top>
  <td valign=top width=48 class=listheader>No.</td>
  <td id="hdr1" valign=top width=380 colspan=2 class=listheader>Main&nbsp;&nbsp;<!--<img src="gfx/options/b_back.png" width=16 height=16 border=0 title="Condense" alt="Condense" style="cursor: pointer;" onClick="compressColumn('1')"><img src="gfx/options/b_forward.png" width=16 height=16 border=0 title="Expand" alt="Expand" style="cursor: pointer;" onClick="expandColumn('1')">--></td>
  <td id="hdr2" valign=top width=380 colspan=2 class=listheader>Sub Main&nbsp;&nbsp;<!--<img src="gfx/options/b_back.png" width=16 height=16 border=0 title="Condense" alt="Condense" style="cursor: pointer;" onClick="compressColumn('2')"><img src="gfx/options/b_forward.png" width=16 height=16 border=0 title="Expand" alt="Expand" style="cursor: pointer;" onClick="expandColumn('2')">--></td>
  <td id="hdr3" valign=top width=380 colspan=2 class=listheader>Sub&nbsp;&nbsp;<!--<img src="gfx/options/b_back.png" width=16 height=16 border=0 title="Condense" alt="Condense" style="cursor: pointer;" onClick="compressColumn('3')"><img src="gfx/options/b_forward.png" width=16 height=16 border=0 title="Expand" alt="Expand" style="cursor: pointer;" onClick="expandColumn('3')">--></td>
  <td id="hdr4" valign=top width=380 colspan=2 class=listheader>Sub-Sub&nbsp;&nbsp;<!--<img src="gfx/options/b_back.png" width=16 height=16 border=0 title="Condense" alt="Condense" style="cursor: pointer;" onClick="compressColumn('4')"><img src="gfx/options/b_forward.png" width=16 height=16 border=0 title="Expand" alt="Expand" style="cursor: pointer;" onClick="expandColumn('4')">--></td>
  <td id="hdr5" valign=top width=380 colspan=2 class=listheader>Tri-Sub&nbsp;&nbsp;<!--<img src="gfx/options/b_back.png" width=16 height=16 border=0 title="Condense" alt="Condense" style="cursor: pointer;" onClick="compressColumn('5')"><img src="gfx/options/b_forward.png" width=16 height=16 border=0 title="Expand" alt="Expand" style="cursor: pointer;" onClick="expandColumn('5')">--></td>
  </tr>

  <?
  $prevtrade1="";
  $prevtrade2="";
  $prevtrade3="";
  $prevtrade4="";
  $prevtrade5="";
  ?>

  <? foreach ($trade_list as $mytrade) { ?>

    <tr id="row<?=$mytrade['recordno'];?>" valign=top>
    <td valign=top width=48 class=listnumber><?=$mytrade['recordno'];?></td>

    <? if ($mytrade['tradepkey1']!=$prevtrade1) { ?>
      <td id="col1<?=$mytrade['recordno'];?>" valign=top width=320 class=listcontent><?=$mytrade['tradecode1'];?><span id="spn1<?=$mytrade['recordno'];?>" style="display: inline;"> - <?=$mytrade['tradedescription1'];?></span></td>
      <td valign=top width=60 class=listcontent style="text-align: left;">
      <a href="index.php?module=trade&task=view&itemid=<?=$mytrade['tradepkey1'];?>"><img src="gfx/options/b_browse.png" border=0 title="View" alt="View"></a>
      <a href="index.php?module=trade&task=edit&itemid=<?=$mytrade['tradepkey1'];?>"><img src="gfx/options/b_edit.png" border=0 title="Edit" alt="Edit"></a>
      <? if ($mytrade['tradepkey2']=="") { ?>
        <a href="index.php?module=trade&task=delete&itemid=<?=$mytrade['tradepkey1'];?>"><img src="gfx/options/b_drop.png" border=0 title="Delete" alt="Delete"></a>
      <? } ?>
      </td>
    <? } else { ?>
      <td id="plh1<?=$mytrade['recordno'];?>" valign=top width=380 colspan=2 class=listcontent>&nbsp;</td>
    <? } ?>

    <? if ($mytrade['tradepkey2']!=$prevtrade2) { ?>
      <td id="col2<?=$mytrade['recordno'];?>" valign=top width=320 class=listcontent><?=$mytrade['tradecode2'];?><span id="spn2<?=$mytrade['recordno'];?>" style="display: inline;"> - <?=$mytrade['tradedescription2'];?></span></td>
      <td valign=top width=60 class=listcontent style="text-align: left;">
      <a href="index.php?module=trade&task=view&itemid=<?=$mytrade['tradepkey2'];?>"><img src="gfx/options/b_browse.png" border=0 title="View" alt="View"></a>
      <a href="index.php?module=trade&task=edit&itemid=<?=$mytrade['tradepkey2'];?>"><img src="gfx/options/b_edit.png" border=0 title="Edit" alt="Edit"></a>
      <? if ($mytrade['tradepkey3']=="") { ?>
        <a href="index.php?module=trade&task=delete&itemid=<?=$mytrade['tradepkey2'];?>"><img src="gfx/options/b_drop.png" border=0 title="Delete" alt="Delete"></a>
      <? } ?>
      </td>
    <? } else { ?>
      <td id="plh2<?=$mytrade['recordno'];?>" valign=top width=380 colspan=2 class=listcontent>&nbsp;</td>
    <? } ?>

    <? if ($mytrade['tradepkey3']!=$prevtrade3) { ?>
      <td id="col3<?=$mytrade['recordno'];?>" valign=top width=320 class=listcontent><?=$mytrade['tradecode3'];?><span id="spn3<?=$mytrade['recordno'];?>" style="display: inline;"> - <?=$mytrade['tradedescription3'];?></span></td>
      <td valign=top width=60 class=listcontent style="text-align: left;">
      <a href="index.php?module=trade&task=view&itemid=<?=$mytrade['tradepkey3'];?>"><img src="gfx/options/b_browse.png" border=0 title="View" alt="View"></a>
      <a href="index.php?module=trade&task=edit&itemid=<?=$mytrade['tradepkey3'];?>"><img src="gfx/options/b_edit.png" border=0 title="Edit" alt="Edit"></a>
      <? if ($mytrade['tradepkey4']=="") { ?>
        <a href="index.php?module=trade&task=delete&itemid=<?=$mytrade['tradepkey3'];?>"><img src="gfx/options/b_drop.png" border=0 title="Delete" alt="Delete"></a>
      <? } ?>
      </td>
    <? } else { ?>
      <td id="plh3<?=$mytrade['recordno'];?>" valign=top width=380 colspan=2 class=listcontent>&nbsp;</td>
    <? } ?>

    <? if ($mytrade['tradepkey4']!=$prevtrade4) { ?>
      <td id="col4<?=$mytrade['recordno'];?>" valign=top width=320 class=listcontent><?=$mytrade['tradecode4'];?><span id="spn4<?=$mytrade['recordno'];?>" style="display: inline;"> - <?=$mytrade['tradedescription4'];?></span></td>
      <td valign=top width=60 class=listcontent style="text-align: left;">
      <a href="index.php?module=trade&task=view&itemid=<?=$mytrade['tradepkey4'];?>"><img src="gfx/options/b_browse.png" border=0 title="View" alt="View"></a>
      <a href="index.php?module=trade&task=edit&itemid=<?=$mytrade['tradepkey4'];?>"><img src="gfx/options/b_edit.png" border=0 title="Edit" alt="Edit"></a>
      <? if ($mytrade['tradepkey5']=="") { ?>
        <a href="index.php?module=trade&task=delete&itemid=<?=$mytrade['tradepkey4'];?>"><img src="gfx/options/b_drop.png" border=0 title="Delete" alt="Delete"></a>
      <? } ?>
      </td>
    <? } else { ?>
      <td id="plh4<?=$mytrade['recordno'];?>" valign=top width=380 colspan=2 class=listcontent>&nbsp;</td>
    <? } ?>

    <? if ($mytrade['tradepkey5']!=$prevtrade5) { ?>
      <td id="col5<?=$mytrade['recordno'];?>" valign=top width=320 class=listcontent><?=$mytrade['tradecode5'];?><span id="spn5<?=$mytrade['recordno'];?>" style="display: inline;"> - <?=$mytrade['tradedescription5'];?></span></td>
      <td valign=top width=60 class=listcontent style="text-align: left;">
      <a href="index.php?module=trade&task=view&itemid=<?=$mytrade['tradepkey5'];?>"><img src="gfx/options/b_browse.png" border=0 title="View" alt="View"></a>
      <a href="index.php?module=trade&task=edit&itemid=<?=$mytrade['tradepkey5'];?>"><img src="gfx/options/b_edit.png" border=0 title="Edit" alt="Edit"></a>
      <a href="index.php?module=trade&task=delete&itemid=<?=$mytrade['tradepkey5'];?>"><img src="gfx/options/b_drop.png" border=0 title="Delete" alt="Delete"></a>
      </td>
    <? } else { ?>
      <td id="plh5<?=$mytrade['recordno'];?>" valign=top width=380 colspan=2 class=listcontent>&nbsp;</td>
    <? } ?>

    </tr>

    <?
    $prevtrade1=$mytrade['tradepkey1'];
    $prevtrade2=$mytrade['tradepkey2'];
    $prevtrade3=$mytrade['tradepkey3'];
    $prevtrade4=$mytrade['tradepkey4'];
    $prevtrade5=$mytrade['tradepkey5'];
    ?>
    
  <? } ?>

  </table>

  <script type="text/javascript">

  function compressColumn(colno) {
    //var objtbl = document.getElementById('tbltrade');
    //objtbl.width=848;
    var objhdr = document.getElementById('hdr'+colno);
    objhdr.width=160;
    for (var i=1;i<=5000;i++) {
      var objspn = document.getElementById('spn'+colno+i);
      if (objspn!=null) {
        objspn.style.cssText="display: none;";
      }
      var objrow = document.getElementById('col'+colno+i);
      if (objrow!=null) {
        objrow.width=100;
      }
      var objplh = document.getElementById('plh'+colno+i);
      if (objplh!=null) {
        objplh.width=100;
      }
    }
  }

  function expandColumn(colno) {
    var objtbl = document.getElementById('tbltrade');
    objtbl.width=1940;
    var objhdr = document.getElementById('hdr'+colno);
    objhdr.width=380;
    for (var i=1;i<=5000;i++) {
      var objspn = document.getElementById('spn'+colno+i);
      if (objspn!=null) {
        objspn.style.cssText="display: none;";
      }
      var objrow = document.getElementById('col'+colno+i);
      if (objrow!=null) {
        objrow.width=320;
      }
      var objplh = document.getElementById('plh'+colno+i);
      if (objplh!=null) {
        objplh.width=320;
      }
    }
  }

  </script>
