      </table>
    </td>
  </tr>

  <tr>
    <td class="smallheader" colspan="2" align="left"><b><?php echo _("Message flags") ?></b></td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td class="item">
      <table cellspacing="0" cellpadding="0" width="100%">
        <tr>
          <td class="item1" align="left">
            <input type="radio" name="search_flag[<?php echo IMP_SEARCH_FLAG_SEEN ?>]" value="0" <?php if (!empty($search_flag) && $search_flag[IMP_SEARCH_FLAG_SEEN] == 0) echo 'checked="checked" '; ?>/>
            <i><?php echo _("Old messages") ?></i>
          </td>
          <td class="item1" align="left">
            <input type="radio" name="search_flag[<?php echo IMP_SEARCH_FLAG_SEEN ?>]" value="1" <?php if (!empty($search_flag) && $search_flag[IMP_SEARCH_FLAG_SEEN] == 1) echo 'checked="checked" '; ?>/>
            <i><?php echo _("New messages") ?></i>
          </td>
          <td class="item1" align="left">
            <input type="radio" name="search_flag[<?php echo IMP_SEARCH_FLAG_SEEN ?>]" value="2" <?php if (empty($search_flag) || $search_flag[IMP_SEARCH_FLAG_SEEN] == 2) echo 'checked="checked" '; ?> />
            <i><?php echo _("Both") ?></i>
          </td>
        </tr>

        <tr>
          <td class="item0" align="left">
            <input type="radio" name="search_flag[<?php echo IMP_SEARCH_FLAG_ANSWERED ?>]" value="0" <?php if (!empty($search_flag) && $search_flag[IMP_SEARCH_FLAG_ANSWERED] == 0) echo 'checked="checked" '; ?>/>
            <i><?php echo _("Answered messages") ?></i>
          </td>
          <td class="item0" align="left">
            <input type="radio" name="search_flag[<?php echo IMP_SEARCH_FLAG_ANSWERED ?>]" value="1" <?php if (!empty($search_flag) && $search_flag[IMP_SEARCH_FLAG_ANSWERED] == 1) echo 'checked="checked" '; ?>/>
            <i><?php echo _("Unanswered messages") ?></i>
          </td>
          <td class="item0" align="left">
            <input type="radio" name="search_flag[<?php echo IMP_SEARCH_FLAG_ANSWERED ?>]" value="2" <?php if (empty($search_flag) || $search_flag[IMP_SEARCH_FLAG_ANSWERED] == 2) echo 'checked="checked" '; ?>/>
            <i><?php echo _("Both") ?></i>
          </td>
        </tr>

        <tr>
          <td class="item1" align="left">
            <input type="radio" name="search_flag[<?php echo IMP_SEARCH_FLAG_FLAGGED ?>]" value="0" <?php if (!empty($search_flag) && $search_flag[IMP_SEARCH_FLAG_FLAGGED] == 0) echo 'checked="checked" '; ?>/>
            <i><?php echo _("Important messages") ?></i>
          </td>
          <td class="item1" align="left">
            <input type="radio" name="search_flag[<?php echo IMP_SEARCH_FLAG_FLAGGED ?>]" value="1" <?php if (!empty($search_flag) && $search_flag[IMP_SEARCH_FLAG_FLAGGED] == 1) echo 'checked="checked" '; ?>/>
            <i><?php echo _("Not important messages") ?></i>
          </td>
          <td class="item1" align="left">
            <input type="radio" name="search_flag[<?php echo IMP_SEARCH_FLAG_FLAGGED ?>]" value="2" <?php if (empty($search_flag) || $search_flag[IMP_SEARCH_FLAG_FLAGGED] == 2) echo 'checked="checked" '; ?>/>
            <i><?php echo _("Both") ?></i>
          </td>
        </tr>

        <tr>
          <td class="item0" align="left">
            <input type="radio" name="search_flag[<?php echo IMP_SEARCH_FLAG_DELETED ?>]" value="0" <?php if (!empty($search_flag) && $search_flag[IMP_SEARCH_FLAG_DELETED] == 0)echo 'checked="checked" '; ?>/>
            <i><?php echo _("Deleted messages") ?></i>
          </td>
          <td class="item0" align="left">
            <input type="radio" name="search_flag[<?php echo IMP_SEARCH_FLAG_DELETED ?>]" value="1" <?php if (!empty($search_flag) && $search_flag[IMP_SEARCH_FLAG_DELETED] == 1) echo 'checked="checked" '; ?>/>
            <i><?php echo _("Not deleted messages") ?></i>
          </td>
          <td class="item0" align="left">
            <input type="radio" name="search_flag[<?php echo IMP_SEARCH_FLAG_DELETED ?>]" value="2" <?php if (empty($search_flag) || $search_flag[IMP_SEARCH_FLAG_DELETED] == 2) echo 'checked="checked" '; ?>/>
            <i><?php echo _("Both") ?></i>
          </td>
        </tr>
      </table>
    </td>
  </tr>

<?php if ($mbox_param): ?>
<input type="hidden" name="search_folders[]" value="<?php echo $mbox_param ?>" />
<?php else: ?>
  <tr>
    <td class="smallheader" colspan="2" align="left"><b><?php echo _("Message folders") ?></b></td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td class="item">
      <a href="" onclick="toggleAll(true); return false;" onmouseover="status='<?php echo _("Select all") ?>'; return true;"><?php echo _("Select all") ?></a> |
      <a href="" onclick="toggleAll(false); return false;" onmouseover="status='<?php echo _("Select none") ?>'; return true;"><?php echo _("Select none") ?></a>
    </td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td class="item" valign="top" align="center">
      <table cellspacing="0" cellpadding="2" width="100%">
        <tr>
          <td class="control" valign="top" align="left">
            <?php echo $folderlist ?>
          </td>
        </tr>
      </table>
    </td>
  </tr>
<?php endif; ?>

  <tr>
    <td>&nbsp;</td>
    <td valign="top" align="left">
      <input type="submit" class="button" value="<?php echo _("Search") ?>" onclick="return formCheck();" />
      <input type="button" class="button" value="<?php echo _("Reset") ?>" onclick="document.search.actionID.value = 'reset_search';document.search.submit();return true;" />
      </td>
  </tr>
</table>
</div>
</form>
