<?php
    $prevurl = Horde::addParameter('month.php', 'month=' . date('n', $prevstamp));
    $prevurl = Horde::addParameter($prevurl, 'year=' . date('Y', $prevstamp));
    $prevurl = Horde::applicationURL($prevurl);
    
    $nexturl = Horde::addParameter('month.php', 'month=' . date('n', $nextstamp));
    $nexturl = Horde::addParameter($nexturl, 'year=' . date('Y', $nextstamp));
    $nexturl = Horde::applicationURL($nexturl);

    $daysInMonth = Kronolith::daysInMonth($month, $year);
    $startday = Kronolith::dayOfWeek($year, $month, 1);
?>    
<table border="0" cellpadding="1" cellspacing="0" width="100%">
<tr>
  <th class="header" width="20%">
  <?php echo (!$print_view) ? Horde::link($prevurl, _("Last Month")) . Horde::img('nav/left.gif', '&lt;', null, $GLOBALS['registry']->getParam('graphics', 'horde')) . '</a>' : '' ?>
  <?php echo $title ?>
  <?php echo (!$print_view) ? Horde::link($nexturl, _("Next Month")) . Horde::img('nav/right.gif', '&gt;', null, $GLOBALS['registry']->getParam('graphics', 'horde')) . '</a>' : '' ?>
  </th>
  <td class="header" width="20%"></td>
  <th class="header" width="20%">
  <?php echo (!$print_view) ? Horde::link($prevurl, _("Last Month")) . Horde::img('nav/left.gif', '&lt;', null, $GLOBALS['registry']->getParam('graphics', 'horde')) . '</a>' : '' ?>
  <?php echo $title ?>
  <?php echo (!$print_view) ? Horde::link($nexturl, _("Next Month")) . Horde::img('nav/right.gif', '&gt;', null, $GLOBALS['registry']->getParam('graphics', 'horde')) . '</a>' : '' ?>
  </th>
  <td class="header" width="20%"></td>
  <th class="header" width="20%">
  <?php echo (!$print_view) ? Horde::link($prevurl, _("Last Month")) . Horde::img('nav/left.gif', '&lt;', null, $GLOBALS['registry']->getParam('graphics', 'horde')) . '</a>' : '' ?>
  <?php echo $title ?>
  <?php echo (!$print_view) ? Horde::link($nexturl, _("Next Month")) . Horde::img('nav/right.gif', '&gt;', null, $GLOBALS['registry']->getParam('graphics', 'horde')) . '</a>' : '' ?>
  </th>
</tr>

<tr><td class="control" colspan="5"><table border="0" cellpadding="2" cellspacing="1" width="100%">

<tr>
<?php
$dayofweek = ($startday) % 7;
for ($day = 1; $day <= $daysInMonth; $day++) {
   switch($dayofweek % 7) {
   case 0:
?>
<th class="control"><?php echo _("Monday") ?></th>
<?php break;
case 1: ?>
<th class="control"><?php echo _("Tuesday") ?></th>
<?php break;
case 2: ?>
<th class="control"><?php echo _("Wednesday") ?></th>
<?php break;
case 3: ?>
<th class="control"><?php echo _("Thursday") ?></th>
<?php break;
case 4: ?>
<th class="control"><?php echo _("Friday") ?></th>
<?php break;
case 5: ?>
<th class="control"><?php echo _("Saturday") ?></th>
<?php break;
case 6: ?>
<th class="control"><?php echo _("Sunday") ?></th>
<?php 
    } 
    if ($prefs->getValue('week_start_monday') == (($dayofweek + 2) % 7)) { ?>
    <td></td>
<?php
    }

    $dayofweek++;
}
?>
</tr>
<tr>
