<tr>
  <td class="control" align="left">
    <form method="post" name="contacts" action="<?php echo Horde::selfURL() ?>">
    <?php echo Util::formInput() ?>
    <table border="0" cellpadding="0" cellspacing="1" width="100%">
    <tr>
      <th class="item" width="1%" style="cursor:pointer;" onclick="document.contacts.checkAll.checked = !document.contacts.checkAll.checked; SelectAll();" align="left" nowrap="nowrap"><input type="checkbox" name="checkAll" onclick="document.contacts.checkAll.checked = !document.contacts.checkAll.checked; SelectAll();" <?php echo Horde::getAccessKeyAndTitle(_("Check _All/None")) ?>" /></th>
      <th class="item" width="1%"><?php echo Horde::img('edit.png', _("Edit"), '', $registry->getImageDir('horde')) ?></th>
      <th class="item" width="1%"><?php echo Horde::img('mime/vcard.png', _("vCard"), '', $registry->getImageDir('horde')) ?></th>
      <th class="item" width="1%"><?php echo Horde::img('group.png', _("List")) ?></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') ? 'za.png' : 'az.png', _("Sort Direction"), null, $registry->getImageDir('horde')) ?></a>
        <a class="widget" href="" onclick="Sort(0, <?php echo (int)$prefs->getValue('sortdir') ?>); return false;"><?php echo $attributes['name']['label'] ?></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') ? 'za.png' : 'az.png', _("Sort Direction"), null, $registry->getImageDir('horde')) ?></a>
        <a class="widget" href="" onclick="Sort(<?php echo $i ?>, <?php echo (int)$prefs->getValue('sortdir') ?>); return false;"><?php echo $attributes[$columns[$i-1]]['label'] ?></a>
      </th>
    <?php endfor; ?>
    </tr>
