diff --git a/www/menu.php3 b/www/menu.php3
index ca3f0698678c71aa1e9518cf29b88b12428c494f..90b10f3ce1dbbbec739d167b416541d1cc71bee4 100644
--- a/www/menu.php3
+++ b/www/menu.php3
@@ -13,6 +13,7 @@ $autorefresh      = 0;
 $javascript_debug = 0;
 $currentusage     = 1;
 $currently_busy   = 0;
+$sortedtables     = array();
 $bodyclosestring  = "";
 
 #
@@ -42,6 +43,13 @@ else {
 $nextsidebarcl    = "";
 $nextsubmenucl    = "";
 
+# Add a table id to the list of sorted tables to initialize on current page.
+function AddSortedTable($id) {
+    global $sortedtables;
+
+    $sortedtables[] = $id;
+}
+
 #
 # TOPBARCELL - Make a cell for the topbar. Actually, the name lies, it can be
 # used for cells in a bottombar too.
@@ -967,6 +975,15 @@ function PAGEFOOTER($view = NULL) {
     # Plug the home site from all others.
     echo "\n<p><a href=\"www.emulab.net/netemu.php3\"></a>\n";
 
+    # Prime all the sortable tables.
+    if (count($sortedtables)) {
+	echo "<script type='text/javascript' language='javascript'>\n";
+	foreach ($sortedtables as $i => $id) {
+	    echo "sorttable.makeSortable(getObjbyName('$id'));\n";
+	}
+	echo "</script>\n";
+    }
+
     # This has to be after all the tooltip definitions.
     echo "<script type='text/javascript' src='${TBBASE}/js/wz_tooltip.js'>".
 	"</script>";