/* Menu Controls v 2.0 and Matt Cannon */ var DEBUG_MENU = false; var POPPED = false; var ON_MENU = false; var CURRENT_MENU = ""; var PREVIOUS_LEVEL = ""; var CURRENT_LEVEL2 = ""; var CURRENT_TOP = ""; var CURRENT_CLASS = ""; var PREVIOUS_CLASS = ""; var thisagt=navigator.userAgent.toLowerCase(); setInterval("cleanUpMenus()",30000); showGlobals(); function getMenuObject(id){ var o = null; if (document.getElementById) { //W3C o = document.getElementById(id); } else if(document.all) { //IE4 o = document.all[id]; } else if(document.layers) { //NN4 o = document.layers[id]; } return o; } function showGlobals(){ if (DEBUG_MENU) { var global_variables = "Global Variables:\n"; global_variables += "\nPOPPED - "+POPPED; global_variables += "\nON_MENU - "+ON_MENU; } } function mouseOver(object,thisClass) { ON_MENU = true; CURRENT_CLASS = thisClass; CURRENT_MENU = object; if (PREVIOUS_LEVEL != CURRENT_MENU) { //alert("over --- " + object); popDown(); //alert("PREVIOUS_CLASS --- " + PREVIOUS_CLASS); PREVIOUS_LEVEL = CURRENT_MENU; PREVIOUS_CLASS = CURRENT_CLASS; return popUp(object); } return false; } function mouseOut(object) { //if (DEBUG_MENU) {alert("mouseout()");} //alert("out --- " + object); ON_MENU = false; setTimeout('cleanUpMenus()',3500); return false; } function popUp(object){ // if (DEBUG_MENU) {alert("popUp('"+object+"')");} //alert("CURRENT_CLASS --- " + CURRENT_CLASS + " CURRENT_MENU -- " + CURRENT_MENU); getMenuObject("table_2_"+CURRENT_MENU).className = CURRENT_CLASS + 'hover'; return menuUp(object); return false; } function popDown() { if (PREVIOUS_LEVEL != '') { menuDown(PREVIOUS_LEVEL); getMenuObject("table_2_"+PREVIOUS_LEVEL).className = PREVIOUS_CLASS; PREVIOUS_LEVEL = ''; } return false; } function menuUp(object) { // if (DEBUG_MENU) {alert("menuUp('"+object+"')");} var span = getMenuObject("span_"+object); var div = getMenuObject("div_"+object); var divUP = false; var spanUP = false; if (div != null) {show(div,"div",object);divUP = true;} if (span != null) {show(span,"span",object);spanUP = true;} POPPED = (spanUP && divUP); return false; } function menuDown(object) { // if (DEBUG_MENU) {alert("menuDown('"+object+"')");} var span = getMenuObject("span_"+object); var div = getMenuObject("div_"+object); if (div != null) {hide(div);} if (span != null) {hide(span);} return false; } function cleanUpMenus() { if (!ON_MENU) { popDown(); } return true; } function show(o,type,id){ if (document.layers) { if(type == "div"){//box if(id == "hcp"){ o.pageY = getMenuObject("span_"+id).pageY - 28; }else{ o.pageY = getMenuObject("span_"+id).pageY - 22; } } //alert(o.pageY); o.visibility = 'show'; o.zIndex = '100'; //need to set zIndex for NS 4.x } else { //alert(type + " =f " + findPosY(o)); if(type == "div"){//box if(id == "hcp"){ o.style.top = findPosY(getMenuObject("span_"+id)) - 28; }else{ o.style.top = findPosY(getMenuObject("span_"+id)) - 22; } } o.style.visibility = 'visible'; if ((thisagt.indexOf("mac")!=-1) && (thisagt.indexOf("msie") != -1) && (thisagt.indexOf("opera") == -1)){ o.style.zIndex = '100'; //need to set zIndex for MAC IE!!! } } } function hide(o){ var toClass = (o.id.indexOf("span") >= 0) ? "menulineoff" : "menupopupoff"; if (document.layers) { o.visibility = "hide"; } else { o.style.visibility = "hidden"; } } function findPosY(obj) { var curtop = 0; if (obj.offsetParent) //need this loop is for mac ie { while (obj.offsetParent) { curtop += obj.offsetTop; //alert(obj.id + " : obj.offsetTop " + obj.offsetTop); obj = obj.offsetParent; } } else if (obj.y){ curtop += obj.y;} return curtop; }