// Browser Variables var loaded = "false"; var ie = document.all && navigator.userAgent.indexOf("Opera") == -1; var ns = document.getElementById && !document.all; var mac = navigator.userAgent.indexOf("Mac") > -1; var ns6 = navigator.userAgent.indexOf("Netscape6") > -1; var saf = navigator.userAgent.indexOf("Safari") > -1; var iemac = mac && ie; // Script Variables menushown = 0; linktype = 0; clickedlink = 0; hideme = 1; var studentname = "none"; var imgnum = ""; var menulocstring=""; var menulocstring2=""; // Main function to show menu // imgid=The id used to uniquely identify this link usually an id placed on the link or an image where the menu will anchor // menuid=The id of the menu that will be popped open // depth=how many levels down the table hierarchy this link sits ie. a table embedded in a table would be 2 // linktype=identifies several different link types that affect how the menu is positioned // 1- where menu needs to be pushed to the far left of the page and only positioned vertically // 2- where menu needs to be postioned at top of page in a different frame // 3- where menu needs to be positioned at top of page // 4- when link is an action with an icon image inside button and menu should line up with the button // 5- when link is an action button and menu should line up with the button // frameid=used only when the menu will appear in a different frame function showmenu(imgid, menuid, depth, linktypevar, frameid) { linktype = linktypevar; menunum = menuid; imgnum = imgid; // FORCE MENUS WIDE FOR MAC BUG if (iemac) { document.styleSheets[0].rules[0].style.width=220 + "px"; document.styleSheets[0].rules[1].style.width=220 + "px"; document.styleSheets[0].rules[2].style.width=220 + "px"; document.styleSheets[0].rules[3].style.width=220 + "px"; } // HIDE ANY MENU SHOWING PREVIOUSLY hidemenu(); // SET THE MAIN MENU VARIABLE if (frameid) themenu = parent.frames[frameid].document.getElementById(menuid); else themenu = document.getElementById(menuid); // FIND THE LINK TO KEY THE LOCATION OFF OF thelink = document.getElementById(imgid + "img"); // GET INITIAL LOCATION OF LINK x = thelink.offsetLeft; y = thelink.offsetTop; papa = thelink.offsetParent; x += papa.offsetLeft; y += papa.offsetTop; // GET THE PARENT TABLE FOR POSITIONING, OR IF IT'S IN A SUB-TABLE (DEPTH > 0) GET THE PARENT OF THE PARENT TABLE if (depth > 0) { thetable = thelink.parentNode; cycle = 0 for (i = 0; i <= 10; i++) { if (thetable.nodeName != "TABLE") { thetable = thetable.parentNode; } else break; } if (depth <= 1) { if ((ie && !mac) || (mac && linktype != 4)) { x = x + thetable.offsetLeft; y = y + thetable.offsetTop; } else if (ns && !ns6) { x = x + thetable.offsetLeft; y = y + thetable.offsetTop; } else { y = y + 20; x = x + 15; } } } if (depth > 1) { thetable2 = thetable.parentNode; cycle = 0; for (i = 0; i <= 10; i++) { if (thetable2.nodeName != "TABLE") { thetable2 = thetable2.parentNode; } else break; } if ((ie && !mac) || (mac && linktype != 4)) { x = x + thetable2.offsetLeft; y = y + thetable2.offsetTop; } else if (ns && !ns6) { x = x + thetable2.offsetLeft; y = y + thetable2.offsetTop; } else { y = y + 20; x = x + 15; } } if (depth > 1 && !iemac) { papa2 = papa.offsetParent; x += papa2.offsetLeft; y += papa2.offsetTop; } if (depth > 1 && !iemac) { papa3 = papa2.offsetParent; x += papa3.offsetLeft; y += papa3.offsetTop; } if (depth > 2 && !iemac) { papa4 = papa3.offsetParent; papa5 = papa4.offsetParent; x += papa5.offsetLeft; //y += papa4.offsetTop; } // MAKE SOME MINOR ADJUSTMENT TO POSITION y = ie && !mac ? y + 16 : ns && !ns6 ? y + 20 : y - 6; x = ie ? x : ns && !ns6 ? x + 0 : x + 0; // CHECK FOR PUSH LEFT VARIABLE THAT ALWAYS KEEP THE MENUS TO THE LEFT OF THE SCREEN if (linktype == 1) { x = 25; } if (linktype == 2) { x -= 10; y = 0 + parent.frames['PGCRF'].document.body.scrollTop; } if (linktype == 3) { y = 0; } if (linktype == 4) { y = ie ? y + 8 : y; x = saf ? x + 10 : x; } if (linktype == 5) { y = ie ? y + 2 : y; } if (linktype == 6) { x -= 5; y += 15; } // SET POSTION ADJUST TO MAKE SURE IT DOESN'T GO OFF SCREEN TO THE RIGHT themenu.stl = ns6 ? themenu : themenu.style; thelink.contentwidth = thelink.offsetWidth; themenu.contentwidth = themenu.offsetWidth; themenu.contentheight = themenu.offsetHeight; var rightedge = ie ? document.body.clientWidth - x : window.innerWidth - x var bottomedge = ie ? document.body.clientHeight - y : window.innerHeight - y if (rightedge < themenu.contentwidth && linktype != 2) { x-=themenu.contentwidth-thelink.contentwidth; } if (x < 0) { x = 0; } themenu.stl.left = x + "px"; if (bottomedge < themenu.contentheight && linktype == 1) { y = y - themenu.contentheight - 10; } if (y < 0) { y = 0; } themenu.stl.top = y + "px"; if(document.getElementById('DivShim')&&ie) { theiframe = document.getElementById('DivShim'); theiframe.style.width = themenu.offsetWidth; theiframe.style.height = themenu.offsetHeight; theiframe.style.top = themenu.stl.top; theiframe.style.left = themenu.stl.left; theiframe.style.zIndex = 9; theiframe.style.display = "block"; } // MAKE MENU VISIBLE themenu.stl.visibility = "visible"; menushown = 1; menulocstring2=menulocstring; if (linktype != 2 && linktype != 4) { menulocstring = '#' + menuid + "links"; if(!saf || menulocstring2!=menulocstring) document.location = menulocstring; } } function hidemenu() { if (menushown == 1 && hideme == 1) { if (linktype != 2 && linktype != 3 && linktype != 4) { locstring = '#' + imgnum + 'link' if(!saf || menulocstring2!=menulocstring)document.location = locstring; } themenu.stl.visibility = "hidden"; if(document.getElementById('DivShim')&&ie) { theiframe = document.getElementById('DivShim'); theiframe.style.display = "none";} menushown = 0; } hideme = 1; } function nextlink() { locstring = '#' + imgnum + 'link' if(!saf)document.location = locstring; }