<tr>
  <td class="control" align="left">
    <form method="post" name="contacts" action="<?php echo Horde::selfURL() ?>">
    <?php echo Horde::formInput() ?>
    <table border="0" cellpadding="0" cellspacing="1" width="100%">
    <tr>
      <th align="left" class="item" nowrap="nowrap" width="10%">&nbsp;<?php echo Horde::img('checkbox.gif', 'alt="' . _("Checkbox") . '"') ?></th>
      <th class="<?php echo ($prefs->getValue('sortby') == 0) ? 'selected' : 'item' ?>" width="<?php echo $width ?>%" align="left" nowrap="nowrap">
        <a class="widget" href="" onclick="Sort(0, <?php echo abs(1 - $prefs->getValue('sortdir')) ?>); return false; "><?php echo Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', 'alt="' . _("Sort Direction") . '"'); ?></a>
        <a class="widget" href="" onclick="Sort(0, <?php echo $prefs->getValue('sortdir') ?>); return false;"><?php echo $attributes['name']['desc'] ?></a>
      </th>
    <?php for ($i=1; $i <= count($columns); $i++): ?>
      <th class="<?php echo ($prefs->getValue('sortby') == $i) ? 'selected' : 'item' ?>" width="<?php echo $width ?>%" align="left" nowrap="nowrap">
        <a class="widget" href="" onclick="Sort(<?php echo $i ?>, <?php echo abs(1 - $prefs->getValue('sortdir')) ?>); return false; "><?php echo Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', 'alt="' . _("Sort Direction"). '"'); ?></a>
        <a class="widget" href="" onclick="Sort(<?php echo $i ?>, <?php echo $prefs->getValue('sortdir') ?>); return false;"><?php echo $attributes[$columns[$i-1]]['desc'] ?></a>
      </th>
    <?php endfor; ?>
    </tr>
