}
    echo "</table>\n";
} else {
    AddSortedTable("mytable");
    echo "<table align=center id='mytable'\n\t\t border=1 cellpadding=5 cellspacing=2>\n";
    echo "<thead class='sort'>\n";
    echo "<tr>\n            <th>Run</th>\n            <th>Instance</th>\n            <th>Template</th>\n            <th>ID</th>\n            <th>Started</th>\n            <th>Stopped</th>\n            <th>Description</th>\n          </tr>\n";
    echo "</thead>\n";
    while ($row = mysql_fetch_array($query_result)) {
        $pvers = $row['parent_vers'];
        $runidx = $row['runidx'];
        $runid = $row['runid'];
        $exptidx = $row['exptidx'];
        $desc = $row['description'];
        $started = $row['start_time'];
        $stopped = $row['stop_time'];
        $onmouseover = MakeMouseOver($desc);
        if (strlen($desc) > 30) {
            $desc = substr($desc, 0, 30) . " <b>... </b>";
        }
        $template_link = MakeLink("template", "guid={$guid}&version={$pvers}", "{$pvers}");
        $instance_link = MakeLink("instance", "instance={$exptidx}", "{$exptidx}");
        $run_link = MakeLink("run", "instance={$exptidx}&runidx={$runidx}", "{$runidx}");
        echo "<tr>" . "<td>{$run_link}</td>" . "<td>{$instance_link}</td>" . "<td>{$template_link}</td>" . "<td>{$runid}</td>" . "<td>{$started}</td>" . "<td>{$stopped}</td>" . "<td {$onmouseover}>{$desc}</td>";
    }
    echo "</table>\n";
}
#
# Standard Testbed Footer
#
PAGEFOOTER();
 function ShowRun($runidx)
 {
     $runidx = addslashes($runidx);
     $exptidx = $this->exptidx();
     $guid = $this->guid();
     $vers = $this->vers();
     $template = $this->template();
     $query_result = DBQueryFatal("select r.* from experiment_runs as r " . "left join experiment_template_instances as i on " . "     i.exptidx=r.exptidx " . "where r.exptidx='{$exptidx}' and r.idx='{$runidx}'");
     if (!mysql_num_rows($query_result)) {
         return;
     }
     $row = mysql_fetch_array($query_result);
     $start = $row['start_time'];
     $stop = $row['stop_time'];
     $runid = $row['runid'];
     $start_tag = $row['starting_archive_tag'];
     $end_tag = $row['ending_archive_tag'];
     $description = $row['description'];
     $hidden = $row['hidden'];
     # Run descriptions are metatdata that can be changed.
     # But use a naming convention.
     $desc_metaname = "__run_description_{$exptidx}_{$runidx}";
     $desc_metadata = $template->LookupMetadataByName($desc_metaname);
     if (!isset($stop)) {
         $stop = "&nbsp";
     }
     SUBPAGESTART();
     SUBMENUSTART("Run Options");
     WRITESUBMENUBUTTON("Export Record", CreateURL("template_export", $this, "runidx", $runidx));
     WRITESUBMENUBUTTON("Revise Record", CreateURL("record_revise", $this, "runidx", $runidx));
     if ($hidden) {
         WRITESUBMENUBUTTON("UnHide Record", CreateURL("toggle", $this, "runidx", $runidx, "type", "hiderun", "value", 0));
     } else {
         WRITESUBMENUBUTTON("Hide Record", CreateURL("toggle", $this, "runidx", $runidx, "type", "hiderun", "value", 1));
     }
     if (isset($end_tag) && $end_tag != "") {
         WRITESUBMENUBUTTON("View Archive", CreateURL("archive_view", $this, "tag", $end_tag));
     }
     SUBMENUEND();
     echo "<center>\n";
     echo "<table border=0 bgcolor=#000 color=#000 class=stealth " . " cellpadding=0 cellspacing=0>\n";
     echo "<tr valign=top>";
     echo "<td class=stealth align=center>\n";
     echo "<center>\n               <h3>Run Details</h3>\n             </center>\n";
     echo "<table align=center cellpadding=2 cellspacing=2 border=1>\n";
     ShowItem("Template", MakeLink("template", "guid={$guid}&version={$vers}", "{$guid}/{$vers}"));
     ShowItem("Instance", MakeLink("instance", "instance={$exptidx}", "{$exptidx}"));
     ShowItem("ID", $runidx);
     if ($hidden) {
         ShowItem("Hidden", "<font color=red>Yes</font>");
     }
     if ($description && $description != "") {
         $onmouseover = MakeMouseOver($description);
         if (strlen($description) > 40) {
             $description = substr($description, 0, 40) . " <b>... </b>";
         }
     } else {
         $onmouseover = "";
         $description = "Click to Add";
     }
     # If no metadata, assume its for an instance prior to modifiable
     # instance descriptions.
     if ($desc_metadata) {
         $desc_anchor = MakeAnchor(CreateURL("template_metadata", $template, $desc_metadata) . "&action=modify", $description, $onmouseover);
     } else {
         $desc_anchor = MakeAnchor(CreateURL("template_metadata", $template) . "&action=add" . "&metadata_type=run_description" . "&formfields[name]={$desc_metaname}", $description, $onmouseover);
     }
     ShowItem("Description", $desc_anchor);
     ShowItem("Started", $start);
     ShowItem("Stopped", $stop);
     ShowItem("Start Tag", $start_tag);
     ShowItem("End Tag", $end_tag);
     echo "</table>\n";
     echo "</td>\n";
     $query_result = DBQueryFatal("select * from experiment_run_bindings " . "where exptidx='{$exptidx}' and runidx='{$runidx}'");
     if (mysql_num_rows($query_result)) {
         $id = "{$exptidx}_{$runidx}_bindings";
         echo "<td align=center class=stealth> &nbsp &nbsp &nbsp </td>\n";
         echo "<td align=center class=stealth>\n";
         AddSortedTable($id);
         echo "<center>\n                   <h3>Run Bindings</h3>\n                  </center> \n                  <table id='{$id}'\n                         align=center border=1 cellpadding=5 cellspacing=2>\n";
         echo "<thead class='sort'>\n";
         echo "<tr>\n                    <th>Name</th>\n                    <th>Value</th>\n                  </tr>\n";
         echo "</thead>\n";
         while ($row = mysql_fetch_array($query_result)) {
             $name = $row['name'];
             $value = $row['value'];
             if (!isset($value)) {
                 $value = "&nbsp";
             }
             echo "<tr>\n                       <td>{$name}</td>\n                       <td>{$value}</td>\n                      </tr>\n";
         }
         echo "</table>\n";
         echo "</td>\n";
     }
     echo "</tr>\n";
     echo "</table>\n";
     $this->ShowRunAnnotation($runidx);
     echo "</center>\n";
     SUBPAGEEND();
 }