<?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');
$accesskey = $prefs->getValue('widget_accesskey') ? Horde::getAccessKey(_("Ope_n Folder")) : '';
?>
<form action="mailbox.php" method="get" name="menu">
<?php echo Util::formInput() ?>
<div id="menu">
<?php if (($imp['base_protocol'] != 'pop3') && $conf['user']['allow_folders']): ?>
 <span style="float:right">
  <input type="hidden" name="no_newmail_popup" value="1" />
  <label for="mailbox" accesskey="<?php echo $accesskey ?>">
   <select id="mailbox" name="mailbox" onchange="folderSubmit()">
    <?php echo IMP::flistSelect('', true, array(), $imp['mailbox'], false, false, true) ?>
   </select>
  </label>
 </span>
 <span style="float:right">
  <?php
   $link = Horde::link('#', _("Open Folder"), '', '', 'folderSubmit(true); return false;');
   printf('<ul><li>%s%s<br />%s</a></li></ul>',
          $link,
          ($menu_view != 'text') ? Horde::img('folders/folder_open.png') : '',
          ($menu_view != 'icon') ? Horde::highlightAccessKey(_("Ope_n Folder"), $accesskey) : '');
  ?>
 </span>
 <?php endif; ?>
 <?php echo IMP::getMenu('string') ?>
 <br class="clear" />
</div>
</form>

<?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 id="menuSpacer" />
