// convert timestamps to HHMM format without leading zeros
 $time_t = date($format, $t);
 // and get a stripped version of the time for use with periods
 $time_t_stripped = preg_replace("/^0/", "", $time_t);
 // calculate hour and minute (needed for links)
 $hour = date("H", $t);
 $minute = date("i", $t);
 // Show the time linked to the URL for highlighting that time
 echo "<tr>";
 draw_time_cell($t, $time_t, $time_t_stripped, $hilite_url);
 // Loop through the list of rooms we have for this area
 while (list($key, $room_id) = each($rooms)) {
     // set up the query strings to be used for the link in the cell
     $query_strings = array();
     $query_strings['new_periods'] = formatURLPeriods($year, $month, $day, $area, $room_id, $time_t_stripped);
     $query_strings['new_times'] = formatURLTimes($year, $month, $day, $area, $room_id, $hour, $minute);
     $query_strings['booking'] = formatURLFull($year, $month, $day, $area, NULL);
     // and then draw the cell
     if (!isset($today[$room_id][$day][$time_t])) {
         $today[$room_id][$day][$time_t] = array();
         // to avoid an undefined index NOTICE error
     }
     if (isset($timetohighlight) && $time_t == $timetohighlight) {
         $cell_class = "row_highlight";
     } else {
         $cell_class = $row_class;
     }
     draw_cell($today[$room_id][$day][$time_t], $query_strings, $cell_class);
 }
 // next lines to display times on right side
 if (FALSE != $row_labels_both_sides) {
 echo "</div>\n";
 // then the link to make a new booking
 if ($javascript_cursor) {
     echo "<script type=\"text/javascript\">\n";
     echo "//<![CDATA[\n";
     echo "BeginActiveCell();\n";
     echo "//]]>\n";
     echo "</script>\n";
 }
 if ($enable_periods) {
     $url = formatURLPeriods($year, $month, $cday, $area, $room, 0);
     echo "<a class=\"new_booking\" href=\"edit_entry/{$url}\">\n";
     echo "<img src=\"images/new.gif\" alt=\"New\" width=\"10\" height=\"10\">\n";
     echo "</a>\n";
 } else {
     $url = formatURLTimes($year, $month, $cday, $area, $room, $morningstarts, 0);
     echo "<a class=\"new_booking\" href=\"edit_entry/{$url}\">\n";
     echo "<img src=\"images/new.gif\" alt=\"New\" width=\"10\" height=\"10\">\n";
     echo "</a>\n";
 }
 if ($javascript_cursor) {
     echo "<script type=\"text/javascript\">\n";
     echo "//<![CDATA[\n";
     echo "EndActiveCell();\n";
     echo "//]]>\n";
     echo "</script>\n";
 }
 // then any bookings for the day
 if (isset($d[$cday]["id"][0])) {
     echo "<div class=\"booking_list\">\n";
     $n = count($d[$cday]["id"]);