<!-- timespan header -->
<tr>
 <td align="left" colspan="5" class="header">
  <span class="smallheader"><b><?php echo _("Time span") ?></b></span>
 </td>
</tr>

<!-- start date -->
<tr>
 <td align="right" class="light">
    <b><?php echo Horde::label('start[year]', _("Sta_rt On")) ?>&nbsp;&nbsp;</b>
 </td>
 <td align="left" class="item<?php echo($_i % 2)?>" colspan="3">
  <?php echo $event->html('start[year]') ?>
  -
  <?php echo $event->html('start[month]') ?>
  -
  <?php echo $event->html('start[day]') ?>
<?php if (($browser->isBrowser('msie') && $browser->getMajor() >= 4) ||
          ($browser->isBrowser('mozilla') && $browser->getMajor() >= 5)): ?>
  <span id="start_wday"></span>
  <script language="JavaScript" type="text/javascript">
   updateWday('start_wday');
  </script>
<?php endif; ?>
<?php if ($GLOBALS['browser']->hasFeature('dom')) {
    echo '</td><td align="right" class="item' . ($_i % 2) . '">';
    Horde::addScriptFile('open_calendar.js', 'horde');
    echo '<div id="goto" class="control" style="position:absolute;visibility:hidden;padding:1px"></div>';
    echo Horde::link('', _("Select a date"), '', '', 'openCalendar(\'startimg\', \'start\', \'' . addslashes($event->js('start')) . '\'); return false;') . Horde::img('calendar.png', _("Set start date"), 'align="top" id="startimg"', $GLOBALS['registry']->getImageDir('horde')) . '</a>';
} ?>
 </td>
</tr>

<!-- start time -->
<tr>
 <td align="right" class="light">
    <b><?php echo Horde::label('start_hour', _("_At")) ?>&nbsp;&nbsp;</b>
 </td>
 <td align="left" class="item<?php echo($_i++ % 2)?>" colspan="4">
  <?php echo $event->html('start_hour') ?>
  &nbsp;:&nbsp;
  <?php echo $event->html('start_min') ?>
  <?php
  if (!$prefs->getValue('twentyFour')) {
      if ($event->start->hour < 12) {
          $am = ' checked="checked"';
          $pm = '';
      } else {
          $am = '';
          $pm = ' checked="checked"';
      }
  ?>
  <input id="am" type="radio" name="am_pm" value="AM"<?php echo $am ?> onclick="document.event.whole_day.checked=false;updateEndDate();" /><label for="am" onclick="document.event.whole_day.checked=false;updateEndDate();">AM</label>
  <input id="pm" type="radio" name="am_pm" value="PM"<?php echo $pm ?> onclick="document.event.whole_day.checked=false;updateEndDate();" /><label for="pm" onclick="document.event.whole_day.checked=false;updateEndDate();">PM</label>
  <?php } ?>
 </td>
</tr>

<!-- end date -->
<tr>
 <td align="right" class="light"><b><?php echo Horde::label('duration', _("Duration")) ?>&nbsp;&nbsp;</b></td>
 <td align="left" class="item<?php echo($_i % 2)?>">
  <input type="radio" name="end_or_dur" id="duration" value="0" checked="checked" />
 </td>
 <td class="item<?php echo($_i % 2)?>" align="right">
    <?php echo Horde::label('end[year]', _("End On")) ?>&nbsp;&nbsp;
 </td>
 <td align="left" class="item<?php echo($_i % 2)?>">
  <?php echo $event->html('end[year]') ?>
  -
  <?php echo $event->html('end[month]') ?>
  -
  <?php echo $event->html('end[day]') ?>
<?php if (($browser->isBrowser('msie') && $browser->getMajor() >= 4) ||
          ($browser->isBrowser('mozilla') && $browser->getMajor() >= 5)): ?>
  <span id="end_wday"></span>
  <script language="JavaScript" type="text/javascript">
   updateWday('end_wday');
  </script>
<?php endif; ?>
<?php if ($GLOBALS['browser']->hasFeature('dom')) {
    echo '</td><td rowspan="2" valign="top" align="right" class="item' . ($_i % 2) . '">';
    Horde::addScriptFile('open_calendar.js', 'horde');
    echo Horde::link('', _("Select a date"), '', '', 'openCalendar(\'endimg\', \'end\', \'' . addslashes($event->js('end')) . '\'); return false;') . Horde::img('calendar.png', _("Set end date"), 'align="top" id="endimg"', $GLOBALS['registry']->getImageDir('horde')) . '</a>';
} ?>
 </td>
</tr>

<!-- end time -->
<tr>
 <td>&nbsp;</td>
 <td class="item<?php echo($_i % 2)?>" align="left">&nbsp;</td>
 <td class="item<?php echo($_i % 2)?>" align="right">
  <?php echo _("At") ?>
 </td>
 <td class="item<?php echo($_i++ % 2)?>" align="left">
  <?php echo $event->html('end_hour') ?>&nbsp;:&nbsp;<?php echo $event->html('end_min') ?>
  <?php
  if (!$prefs->getValue('twentyFour')) {
      if ($event->end->hour < 12) {
          $am = ' checked="checked"';
          $pm = '';
      } else {
          $am = '';
          $pm = ' checked="checked"';
      }
  ?>
  <input id="eam" type="radio" name="end_am_pm" value="AM"<?php echo $am ?> onclick="document.event.end_or_dur[0].checked=true;updateDuration()" /><label for="eam" onclick="document.event.end_or_dur[0].checked=true;updateDuration()">AM</label>
  <input id="epm" type="radio" name="end_am_pm" value="PM"<?php echo $pm ?> onclick="document.event.end_or_dur[0].checked=true;updateDuration()" /><label for="epm" onclick="document.event.end_or_dur[0].checked=true;updateDuration()">PM</label>
  <?php } ?>
 </td>
</tr>

<!-- duration -->
<tr>
 <td>&nbsp;</td>
 <td class="item<?php echo($_i % 2)?>" align="left" valign="top">
  <input type="radio" name="end_or_dur" value="1" />
 </td>
 <td class="item<?php echo($_i % 2)?>" align="right" valign="top">
    <?php echo Horde::label('dur_day', _("Lasts")) ?>&nbsp;&nbsp;
 </td>
 <td class="item<?php echo($_i % 2)?>" align="left" valign="top">
  <input id="allday" name="whole_day" type="checkbox" value="1" onclick="setWholeDay(this.value); updateEndDate(); document.event.end_or_dur[1].checked = true"<?php $dur = $event->getDuration(); if ($dur->wholeDay) echo ' checked="checked"' ?> />
  <?php echo Horde::label('allday', _("All day")) ?><br />
  <?php echo sprintf(_("%s Day(s) %s Hour(s) %s Minutes"), $event->html('dur_day'), $event->html('dur_hour'), $event->html('dur_min')) ?>
<?php if ($GLOBALS['browser']->hasFeature('dom')) {
    echo '</td><td rowspan="2" valign="top" align="right" class="item' . ($_i++ % 2) . '">&nbsp;';
} ?>
 </td>
</tr>