  <table border=1 cellspacing=1 cellpadding=2 width=760 style="border: 1px inset;">
  <tr valign=top>
  <td valign=top width=30 class=listheader>No.</td>
  <td valign=top width=140 class=listheader>Code</td>
  <td valign=top width=510 class=listheader>Department Name</td>
  <td valign=top width=80 class=listheader>Options</td>
  </tr>

  <? $currdept=""; ?>

  <? foreach ($dept_list as $mydept) { ?>

    <? if ($currdept!=$mydept['div_name']) { ?>

      <tr valign=top>
      <td valign=top width=760 colspan=4 class=listcontent><?=$mydept['div_name'];?></td>
      </tr>

      <? $currdept=$mydept['div_name']; ?>

    <? } ?>

    <tr valign=top>
    <td valign=top width=30 class=listnumber><?=$mydept['recordno'];?></td>
    <td valign=top width=140 class=listcontent><?=$mydept['dept_code'];?></td>
    <td valign=top width=510 class=listcontent><?=$mydept['dept_name'];?></td>
    <td valign=top width=80 class=listcontent>
    <a href="index.php?module=user&task=deptview&itemid=<?=$mydept['dept_pkey'];?>"><img src="gfx/options/b_view.png" border=0 alt="View"></a>
    <a href="index.php?module=user&task=deptedit&itemid=<?=$mydept['dept_pkey'];?>"><img src="gfx/options/b_edit.png" border=0 alt="Edit"></a>
    <a href="index.php?module=user&task=deptdelete&itemid=<?=$mydept['dept_pkey'];?>"><img src="gfx/options/b_drop.png" border=0 alt="Delete"></a>
    </td>
    </tr>

  <? } ?>

  </table>
