<?php if ($browser->hasFeature('dom')):
    $gotourl = Horde::addParameter($registry->getParam('webroot', 'horde') . '/javascript.php', 'file=goto.inc');
    $gotourl = Horde::addParameter($gotourl, 'app=kronolith');
    $gotourl = Horde::url($gotourl);
?>
<script language="JavaScript" type="text/javascript" src="<?php echo $gotourl; ?>"></script>
<div id="goto" class="control" style="position:absolute;visibility:hidden;left:50px;top:50px;padding:1px"></div>
<?php endif; ?>
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="menu"><table border="0" width="100%"><tr>

<?php
/* Kronolith menu items. */
Menu::printItem(Horde::applicationUrl($prefs->getValue('defaultview') . '.php'), _("Today"), 'today.gif', null, null, null, '__noselection');
if ($browser->hasFeature('dom')) {
    Menu::printItem('#', _("Goto"), 'goto.gif', null, '', 'openGoto(\'' . $timestamp . '\'); return false;');
}
Menu::printItem(Horde::applicationUrl('day.php' . $append), _("Day"), 'dayview.gif');
Menu::printItem(Horde::applicationUrl('workweek.php' . $append), _("Work Week"), 'workweekview.gif');
Menu::printItem(Horde::applicationUrl('week.php' . $append), _("Week"), 'weekview.gif');
Menu::printItem(Horde::applicationUrl('month.php' . $append), _("Month"), 'monthview.gif');

if (count(Kronolith::listCalendars(false, _PERMS_EDIT))) {
    Menu::printItem(Horde::applicationUrl('addevent.php' . $append), _("New Event"), 'new.gif');
}

/* Import/Export */
if ($conf['menu']['import_export']) {
    Menu::printItem(Horde::applicationUrl('data.php' . $append), _("Import/Export"), 'data.gif', $registry->getParam('graphics', 'horde'));
}

/* Print */
if ($conf['menu']['print'] && isset($print_link) && $browser->hasFeature('javascript')) {
    Menu::printItem('#', _("Print"), 'print.gif', $registry->getParam('graphics', 'horde'), '', "open_print_win('$print_link'); return false;");
}

/* Additional site-specific menu items */
Menu::siteLinks();

/* Options menu */
if (($conf['prefs']['driver'] != '') && ($conf['prefs']['driver'] != 'none')) {
    Menu::printItem(Horde::applicationUrl('prefs.php'), _("Options"), 'prefs.gif', $registry->getParam('graphics', 'horde'));
}
    
/* Online Help */
if ($help_link = Help::listLink('kronolith')) {
    Menu::printItem($help_link, _("Help"), 'manual.gif', $registry->getParam('graphics', 'horde'));
}

/* Links to other Horde applications. */
Menu::appLinks();
?>
<td width="100%">&nbsp;</td><!-- spacer -->

<?php if (!$prefs->isLocked('default_share') && ((count($remote_calendars) > 1 || count($calendars) > 1) || !count($GLOBALS['display_calendars']))): ?>
<?php Menu::printItem(Horde::applicationUrl($prefs->getValue('defaultview') . '.php'), _("Show"), 'kronolith.gif', null, null, 'return listCalendarsSubmit();', '__noselection'); ?>
<td class="light" align="left">
<?php if (strstr($_SERVER['PHP_SELF'], 'month.php') !== false || 
                strstr($_SERVER['PHP_SELF'], 'week.php') !== false ||
                strstr($_SERVER['PHP_SELF'], 'workweek.php') !== false ||
                strstr($_SERVER['PHP_SELF'], 'day.php') !== false) :?>
<form action="<?php echo Horde::selfUrl() ?>" method="post" name="calmenu">
<?php else: ?>
<form action="<?php echo Horde::applicationUrl($prefs->getValue('defaultview') . '.php') ?>" method="post" name="calmenu">
<?php endif; ?>
<?php Horde::pformInput() ?>
<input type="hidden" name="timestamp" value="<?php echo $timestamp ?>" />
<select name="display_cal" onchange="listCalendarsSubmit();">
  <option value=""><?php echo _("Show Calendars:") ?></option>
<?php foreach (Kronolith::listCalendars() as $id => $cal): ?>
  <option value="<?php echo $id ?>"><?php echo (in_array($id, $display_calendars) ? '* ' : '') . $cal->getShareName() ?></option>
<?php endforeach; ?>
<?php if (count($remote_calendars)): ?>
  <option value=""><?php echo _("Remote Calendars") ?>:</option>
  <?php foreach ($remote_calendars as $id => $cal): ?>
    <option value="remote_<?php echo $cal['url'] ?>"><?php echo (in_array($cal['url'], $display_remote_calendars) ? '* ' : '') . $cal['name'] ?></option>
  <?php endforeach; ?>
<?php endif; ?>
</select>
</form>
<script language="JavaScript" type="text/javascript">
<!--
var loading;
function listCalendarsSubmit()
{
    document.calmenu.submit();
    return false;
}
// -->
</script>
</td>
<?php endif; ?>
</tr></table></td></tr></table><br />
