<?php
$menu_trash = (($imp['base_protocol'] != 'pop3') &&
               $prefs->getValue('use_trash') &&
               ($prefs->getValue('trash_folder') !== null) &&
               $prefs->getValue('empty_trash_menu'));
$menu_view = $prefs->getValue('menu_view');
?>
<div id="menu">
  <?php if ($conf['user']['allow_folders']): ?>
  <form action="mailbox.php" method="get" name="menu">
   <?php Util::pformInput() ?>
   <input type="hidden" name="no_newmail_popup" value="1" />
   <table class="folderselect" style="float:right;" cellspacing="0">
    <tr>
     <td align="center">
      <a style="white-space:normal" href="#" onclick="folderSubmit(true); return false;" onmouseover="window.status='<?php echo _("Open Folder") ?>'; return true;" onmouseout="window.status=''; return true;"><?php
if (($menu_view == 'icon') || ($menu_view == 'both')) {
    echo Horde::img('folders/folder_open.png', _("Open Folder"));
    if ($menu_view == 'both') {
        echo '<br />';
    }
}
if ($menu_view != 'icon') {
    $accesskey = $prefs->getValue('widget_accesskey') ? Horde::getAccessKey(_("Ope_n Folder")) : '';
    echo Horde::highlightAccessKey(_("Ope_n Folder"), $accesskey);
}
?></a>
     </td>
     <td>
<?php if (isset($accesskey)): ?>
      <label for="mailbox" accesskey="<?php echo $accesskey ?>"></label>
<?php endif; ?>
      <select id="mailbox" name="mailbox" onchange="folderSubmit()">
       <?php echo IMP::flistSelect('', true, array(), $imp['mailbox'], false, false, true) ?>
      </select>
     </td>
    </tr>
   </table>
  </form>
  <?php endif; ?>
  <?php echo IMP::getMenu('string') ?>
</div>

<?php if ($menu_trash || $conf['user']['allow_folders']): ?>
<script language="JavaScript" type="text/javascript">
<!--
<?php if ($menu_trash): ?>
var menu_trash_confirmed = 0;
var menu_trash_cvalue = 0;
<?php endif; ?>
<?php if ($conf['user']['allow_folders']): ?>
var loading;
function folderSubmit(clear)
{
    if (document.menu.mailbox[document.menu.mailbox.selectedIndex].value != '') {
        if ((loading == null) || (clear != null)) {
            loading = true;
            document.menu.submit();
        }
    }
}
// -->
</script>
<?php endif; ?>
<?php endif; ?>
<br />
