case "week":
            $returl = "week";
            break;
        default:
            $returl = "day";
    }
} else {
    $returl = $returl_base[0];
}
// If we haven't been given a sensible date then get out of here and don't trey and make a booking
if (!isset($day) || !isset($month) || !isset($year) || !checkdate($month, $day, $year)) {
    header("Location: {$returl}");
    exit;
}
// Now construct the new query string
$returl .= formatURLDate($year, $month, $day);
// If the old sticky room is one of the rooms requested for booking, then don't change the sticky room.
// Otherwise change the sticky room to be one of the new rooms.
if (!in_array($room, $rooms)) {
    $room = $rooms[0];
}
// Find the corresponding area
$area = mrbsGetRoomArea($room);
// Complete the query string
$returl .= formatURLArea($area, $room);
// Handle private booking
// Enforce config file settings if needed
if ($private_mandatory) {
    $isprivate = $private_default;
} else {
    $isprivate = $private ? TRUE : FALSE;
}
echo "</div>\n";
// Export and Export Series
if (!$keep_private && !$enable_periods) {
    // The iCalendar information has the full booking details in it, so we will not allow
    // it to be exported if it is private and the user is not authorised to see it.
    // iCalendar information doesn't work with periods at the moment (no periods to times mapping)
    echo "<div>\n";
    if (!$series) {
        echo "<a href=\"view_entry/id:{$id}-action:export-returl:{$link_returl}\">" . get_vocab("exportentry") . "</a>";
    }
    if (!empty($repeat_id) && !$series) {
        echo " - ";
    }
    if (!empty($repeat_id) || $series) {
        $url = formatURLDate($year, $month, $day);
        echo "<a href=\"view_entry/id:{$id}/{$url}/action:export-series:1-returl:{$link_returl}\">" . get_vocab("exportseries") . "</a>";
    }
    echo "</div>\n";
}
?>
  <div id="returl">
    <?php 
if (isset($HTTP_REFERER)) {
    ?>
    <a href="<?php 
    echo htmlspecialchars($HTTP_REFERER);
    ?>
"><?php 
    echo get_vocab("returnprev");
    ?>