<form method="post" name="search" action="<?php echo Horde::applicationUrl('mailbox.php') ?>">
<input type="hidden" name="mailbox" value="**search" />
<input type="hidden" name="actionID" value="<?php echo SEARCH ?>" />
<div align="center">
<table border="0" cellspacing="0" cellpadding="2" align="center">
<tr>
    <td align="left" class="header">
        <b><?php echo _("Search") ?></b>
    </td>
<?php if ($conf['user']['online_help'] && $browser->hasFeature('javascript')): ?>
    <td align="right" class="header">
        <?php echo Help::link('imp', 'search') ?>
    </td>
<?php else: ?>
    <td class="header">&nbsp;</td>
<?php endif; ?>
</tr>
<tr>
    <td>&nbsp;</td>
    <td valign="top" align="left">
        <input type="submit" class="button" value="<?php echo _("Search") ?>" onclick="return formCheck();" />
        <input type="reset" class="button" value="<?php echo _("Reset") ?>" />
    </td>
</tr>
<tr>
    <td class="smallheader" colspan="2" align="left"><b><?php echo _("Message fields") ?></b></td>
</tr>
<tr>
    <td class="light" align="right">
        <b><?php echo _("From") ?>&nbsp;</b>
    </td>
    <td class="item1" align="left">
        <input type="text" name="search_from" size="40" />
    </td>
</tr>
<tr>
    <td class="light" align="right">
        <b><?php echo _("To") ?>&nbsp;</b>
    </td>
    <td class="item0" align="left">
        <input type="text" name="search_to" size="40" />
    </td>
</tr>
<tr>
    <td class="light" align="right">
        <b><?php echo _("Cc") ?>&nbsp;</b>
    </td>
    <td class="item1" align="left">
        <input type="text" name="search_cc" size="40" />
    </td>
</tr>
<tr>
    <td class="light" align="right">
        <b><?php echo _("Subject") ?>&nbsp;</b>
    </td>
    <td class="item0" align="left">
        <input type="text" name="search_subject" size="40" />
    </td>
</tr>
<tr>
    <td class="light" align="right">
        <b><?php echo _("Body") ?>&nbsp;</b>
    </td>
    <td class="item1" align="left">
        <input type="text" name="search_body" size="40" />
    </td>
</tr>
<tr>
    <td class="light" align="right">
        <b><?php echo _("Received on") ?>&nbsp;</b>
    </td>
    <td class="item0" nowrap="nowrap" align="left">
        <input type="text" name="search_on_year" size="4" maxlength="4" onchange="dateCheck('on')" />
        <select name="search_on_month" onchange="dateCheck('on')">
            <option value=""></option>
<?php foreach ($months as $key => $val): ?>
            <option value="<?php echo $key ?>"><?php echo $val ?></option>
<?php endforeach; ?>
        </select>
        <select name="search_on_day" onchange="dateCheck('on')">
            <option value=""></option>
<?php foreach (range(1, 31) as $n): ?>
            <option value="<?php echo $n ?>"><?php echo $n ?></option>
<?php endforeach; ?>
        </select>
    </td>
</tr>
<tr>
    <td class="light" align="right">
        <b><?php echo _("Received before") ?>&nbsp;</b>
    </td>
    <td class="item1" nowrap="nowrap" align="left">
        <input type="text" name="search_before_year" size="4" maxlength="4" onchange="dateCheck('before')" />
        <select name="search_before_month" onchange="dateCheck('before')">
            <option value=""></option>
<?php foreach ($months as $key => $val): ?>
            <option value="<?php echo $key ?>"><?php echo $val ?></option>
<?php endforeach; ?>
        </select>
        <select name="search_before_day" onchange="dateCheck('before')">
            <option value=""></option>
<?php foreach (range(1, 31) as $n): ?>
            <option value="<?php echo $n ?>"><?php echo $n ?></option>
<?php endforeach; ?>
        </select>
    </td>
</tr>
<tr>
    <td class="light" align="right">
        <b><?php echo _("Received after") ?>&nbsp;</b>
    </td>
    <td class="item0" nowrap="nowrap" align="left">
        <input type="text" name="search_since_year" size="4" maxlength="4" onchange="dateCheck('since')" />
        <select name="search_since_month" onchange="dateCheck('since')">
            <option value=""></option>
<?php foreach ($months as $key => $val): ?>
            <option value="<?php echo $key ?>"><?php echo $val ?></option>
<?php endforeach; ?>
        </select>
        <select name="search_since_day" onchange="dateCheck('since')">
            <option value=""></option>
<?php foreach (range(1, 31) as $n): ?>
            <option value="<?php echo $n ?>"><?php echo $n ?></option>
<?php endforeach; ?>
        </select>
    </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">
<tr>
    <td class="item1" align="left">
        <input type="radio" name="search_seen" value="0" />
        <i><?php echo _("Old messages") ?></i>
    </td>
    <td class="item1" align="left">
        <input type="radio" name="search_seen" value="1" />
        <i><?php echo _("New messages") ?></i>
    </td>
    <td class="item1" align="left">
        <input type="radio" name="search_seen" value="2" checked="checked" />
        <i><?php echo _("Both") ?></i>
    </td>
</tr>
<tr>
    <td class="item0" align="left">
        <input type="radio" name="search_answered" value="0" />
        <i><?php echo _("Answered messages") ?></i>
    </td>
    <td class="item0" align="left">
        <input type="radio" name="search_answered" value="1" />
        <i><?php echo _("Unanswered messages") ?></i>
    </td>
    <td class="item0" align="left">
        <input type="radio" name="search_answered" value="2" checked="checked" />
        <i><?php echo _("Both") ?></i>
    </td>
</tr>
<tr>
    <td class="item1" align="left">
        <input type="radio" name="search_flagged" value="0" />
        <i><?php echo _("Important messages") ?></i>
    </td>
    <td class="item1" align="left">
        <input type="radio" name="search_flagged" value="1" />
        <i><?php echo _("Not important messages") ?></i>
    </td>
    <td class="item1" align="left">
        <input type="radio" name="search_flagged" value="2" checked="checked" />
        <i><?php echo _("Both") ?></i>
    </td>
</tr>
<tr>
    <td class="item0" align="left">
        <input type="radio" name="search_deleted" value="0" />
        <i><?php echo _("Deleted messages") ?></i>
    </td>
    <td class="item0" align="left">
        <input type="radio" name="search_deleted" value="1" />
        <i><?php echo _("Not deleted messages") ?></i>
    </td>
    <td class="item0" align="left">
        <input type="radio" name="search_deleted" value="2" checked="checked" />
        <i><?php echo _("Both") ?></i>
    </td>
</tr>
</table>

    </td>
</tr>
<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 $search_folders; ?>
            </td>
        </tr>
        </table>
    </td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td valign="top" align="left">
        <input type="submit" class="button" value="<?php echo _("Search") ?>" onclick="return formCheck();" />
        <input type="reset" class="button" value="<?php echo _("Reset") ?>" />
    </td>
</tr>
</table>
</div>
</form>
