$out .= "[ <a href='{$_WEB_URL}/'>Back to Top</a> ]";
$out .= "</center><br />";
# dump information about this plex
$slots = get_upcoming_slots($id, 14, 3);
# 14 days forward, 3 days backwards
if ($slots && count($slots)) {
    $scheds = get_schedules($id, $slots);
    # get schedules for these slots
    $out .= "<ul>";
    foreach ($slots as $d) {
        $dayid = $d[0];
        $slot = $d[1];
        $inpast = $d[2];
        $slotid = $slot->slotid;
        $out .= "<li>";
        $out .= stddate(slot_to_date($dayid));
        $out .= " - " . $slot->name;
        if ($scheds[$dayid][$slotid]) {
            $schedid = $scheds[$dayid][$slotid]->schedid;
            # setup tags we want
            $tag = "";
            if (!is_null($scheds[$dayid][$slotid]->ranattime)) {
                $tag = "<font color='#00ff00'>(DONE)</font> ";
            }
            # now let's print out basic information
            $out .= " - {$tag}<font color='#ff0000'>";
            $out .= "<b>" . get_corp_name($scheds[$dayid][$slotid]->corpid) . "</b></font>";
            # FIXME: access restrictions here please
            if (1) {
                $out .= " [ <b><a href='{$_WEB_URL}/igb-scheduleinfo.php?id={$id}&schedid={$schedid}'>See Run Information</a></b> ]";
            }
$out .= "[ <a href='{$_WEB_URL}/'>Back to Top</a> ] [ <a href='{$_WEB_URL}/igb-showcomplex.php?id={$id}'>Back to Complex</a> ]";
$out .= "</center><br />";
# if they're trying to confirm
if ($_GET['confirm'] == 1) {
    # okay, set the confirmation
    $run = submit_schedule($id, $dayid, $slotid, get_corp_id($ft->eve->CorpName), get_pilot_id($ft->eve->CharName));
    $out .= "Your reservation has been confirmed.  <b>Good luck!</b>";
} else {
    # so they want to reserve it eh...
    $out .= "Okay, so you want to run a complex?  Well, from the looks of it, the run you've chosen is not ";
    $out .= "already reserved for someone.  That's good for you, means you should be able to get in.";
    $out .= "<p>Please review the information below and confirm that you intend to run this complex.  <b>You are ";
    $out .= "responsible for ensuring your corporation/group runs the complex.  If you reserve slots and do not ";
    $out .= "use them, we will hunt you down and barbeque you.  :-)</p>";
    # now dump the information
    $info = array("Complex" => "<a href='{$_WEB_URL}/igb-showcomplex.php?id={$id}'>{$plex->name}</a> (" . $plex->rating . "/10)", "System" => $plex->system . " (" . $plex->region . ")", "a" => "-", "Date" => stddate(slot_to_date($dayid)), "Name" => get_complex_slot_name($slotid), "Description" => get_complex_slot_desc($slotid), "b" => "-", "Reserve for corp" => $ft->eve->CorpName, "Reserve by pilot" => $ft->eve->CharName);
    foreach ($info as $k => $v) {
        if ($v == "-") {
            $out .= "<br />";
            continue;
        }
        $out .= " &bull; <font color='#ffff00'>{$k}:</font> {$v}<br />";
    }
    # give them a button to reserve it
    $out .= "<p>[ <a href='{$_WEB_URL}/igb-schedulecomplex.php?id={$id}&dayid={$dayid}&slotid={$slotid}&confirm=1'>Confirm Reservation</a> ]</p>";
}
# all done
echo "<html><title>Plexer - The Complex Scheduler</title><body>{$out}</body></html>";
?>

if (is_null($plex)) {
    return $ft->igberrorpage('Sorry, that complex was not found.');
}
# validate their id
$schedid = $_GET['schedid'] + 0;
$run = load_run_schedid($id, $schedid);
if (!$run) {
    return $ft->igberrorpage('Sorry, that run was not found.');
}
# store output here
$out = "<center><b><font color='#ffff00'>Plexer - The Complex Scheduler</font></b><br />";
$out .= "<font color='#ff0000'><b>{$plex->name}</b> in <b>{$plex->system}</b> rated <b>{$plex->rating}/10</b></font><br />";
$out .= "[ <a href='{$_WEB_URL}/'>Back to Top</a> ] [ <a href='{$_WEB_URL}/igb-showcomplex.php?id={$id}'>Back to Complex</a> ]";
$out .= "</center><br />";
# dump the information
$info = array("Complex" => "<a href='{$_WEB_URL}/igb-showcomplex.php?id={$id}'>{$plex->name}</a> (" . $plex->rating . "/10)", "System" => $plex->system . " (" . $plex->region . ")", "1" => "-", "Date" => stddate(slot_to_date($run->dayid)), "Name" => get_complex_slot_name($id, $run->slotid), "Description" => get_complex_slot_desc($id, $run->slotid), "2" => "-", "Reserved for corp" => get_corp_name($run->corpid), "Reserved by pilot" => get_pilot_name($run->pilotid), "3" => "-", "Was ran at" => is_null($run->ranattime) ? "not run yet" : stddate($run->ranattime));
foreach ($info as $k => $v) {
    if ($v == "-") {
        $out .= "<br />";
        continue;
    }
    $out .= " &bull; <font color='#ffff00'>{$k}:</font> {$v}<br />";
}
# set some flags
$is_corp_mgr = $run->corpid == get_corp_id($ft->eve->CorpName) ? 1 : 0;
$is_site_mgr = $obj->manager();
$is_mgr = $is_corp_mgr || $is_site_mgr;
# now give them some commands
if ($is_mgr) {
    $out .= "<br />";
    if (is_null($run->ranattime)) {