// constants var SPACER_IMAGE_PATH = "/projects/sacleasing/sacweb.nsf/blank.gif"; // declarations var span = null; var selected_id = ""; var selected_submenu = ""; var shown_id = ""; var highlighted_primary = ""; /* Prins the primary menu. */ function showSecondaryVisibleMenu() { var keys = primary_menu.keys; for (var i=0; i'); document.write(''); document.write(name); document.write(''); } } /* Sets the html of the submenu. */ function setSubmenuHtml(html) { if (null == span) { // get the span span = document.getElementById("submenu"); } span.innerHTML = html; } /* Returns the HTML for the submenu with the supplied id. */ function getSubmenuHtml(primary_id, secondary_id) { // get the submenu var submenu = secondary_menu.get(primary_id); // compose html var html = ""; var keys = submenu.keys; if (keys.length > 0) { html += "
"; } for (var i=0; i" + name + " "; } else { html += "" + name + " "; } html += ""; } if (keys.length > 0) { html += "
"; } if (html == "") { html = "
"; } // return the html if ( ("" != secondary_id) || ("" != primary_id && "" != secondary_id) ) { return "
" + html + "
"; } else { return "
" + html + "
"; } } /* This method should be called when loading the page to select a submenu. This means that the submenu will revert to this when focus leaves the menu. */ function selectSubmenu(prim_id, sec_id) { // get the html var html = getSubmenuHtml(prim_id, sec_id); // store submenu html in variable selected_submenu = html; // place in span setSubmenuHtml(html); // find the link of the primary item that is chosen var primlink_selected = document.getElementById("link_" + prim_id); primlink_selected.className = "primarylinkselected"; // get the cell of the selected primary menu item var cell = document.getElementById(prim_id); cell.className = "menucell_selected"; // store submenu id in variable selected_id = prim_id; } /* Shows the submenu for the passed id. */ function showSubmenu(id) { if (shown_id != "" && shown_id != id && shown_id != selected_id) { cell = document.getElementById(shown_id); cell.className = "menucell"; } shown_id = id; // if this is the already selected primary menu item we use that HTML if (id == selected_id) { // use selected setSubmenuHtml(selected_submenu); } else { // get html for submenu var html = getSubmenuHtml(id, ""); // set the html setSubmenuHtml(html); // get the cell of the selected primary menu item var cell = document.getElementById(id); cell.className = "menucell_hover"; } // find the link of the primary item that is chosen var primlink_selected = null; if (highlighted_primary != "") { primlink_selected = document.getElementById(highlighted_primary); primlink_selected.className = "primarylink"; } if ("link_" + selected_id != "link_" + id) { primlink_selected = document.getElementById("link_" + id); primlink_selected.className = "primarylinkselected"; highlighted_primary = "link_" + id; } } /* Resets the shown submenu to the selected submenu (if any). */ function resetSubmenu(id) { if (id != selected_id && shown_id != id) { var cell = document.getElementById("menucell_" + id); cell.className = "menucell"; } } /* Resets the shown submenu to the selected submenu (if any) when leaving the span area. */ function resetSpan() { if ("" != selected_submenu) { setSubmenuHtml(selected_submenu); } else { setSubmenuHtml("
"); } if (shown_id != "" && shown_id != selected_id) { cell = document.getElementById(shown_id); cell.className = "menucell"; shown_id=""; } // find the link of the primary item that is chosen var primlink_selected = null; if (highlighted_primary != "") { primlink_selected = document.getElementById(highlighted_primary); primlink_selected.className = "primarylink"; highlighted_primary = ""; } }