if (document.all) {n=0;ie=1;ns6=0;fShow="visible";fHide="hidden";} if (document.getElementById&&!document.all) {n=0;ie=0;ns6=1;fShow="visible";fHide="hidden";} if (document.layers) {n=1;ie=0;ns6=0;fShow="show";fHide="hide";} opr6=ie&&navigator.userAgent.indexOf("Opera")!=-1; //alert(opr6); /* --------------------------------------------------------------- Top Nav Bar I v2- By Constantin Kuznetsov Jr. (script@esolutiononline.com) Modified by Dynamic Drive for NS6/Opera6 compatibility and code streamlining March 4th, 2002 Modified by Probatus Technologies to integrate script with other components ------------------------------------------------------------------*/ window.onerror=new Function("return true") /* G L O B A L P A R A M E T E R S */ /* ---------------------------------------------------------------*/ rightX = 0; // Menubar and submenu widths // Set maxWidth same as totalWidth if layout is fixed to top corner // Set maxWidth to 0 if layout is centered totalWidth = 774; maxWidth = 0; subWidth = 170; //Menubars distance from browser top edge submenuOffsetIE = 20; submenuOffsetNS = 18; //Finetuning submenus place leftBiasIE = 5; leftBiasNS = 4; //Finetuning ns6 submenus to right place var ns6offset = ns6?2:0; mainItemSeparator = "   " // CSS style settings mainStyle = "toplinks1"; subStyle = "toplinks11"; menuBarColor = menucolor; subMenuColor = subcolor; if (sitepath=="/common/") commonpath=""; else commonpath = "/lh" + sitepath; function Menu() { /*Menubar static links*/ /* ---------------------------------------------------------------*/ if (lang==1) staticLinks = "Etusivu" + mainItemSeparator; else if (lang==2) staticLinks = "Ingång" + mainItemSeparator; else staticLinks = "Home" + mainItemSeparator; /* ---------------------------------------------------------------*/ this.bgColor = menuBarColor; this.subColor = subMenuColor; this.addItem = addItem; this.addSubItem = addSubItem; this.showMenu = showMenu; this.mainPaneBorder = 0; this.subMenuPaneBorder = 0; this.mainmenumargin = 10; this.subMenuPaneWidth = subWidth; lastMenu = null; rightY = 0; leftY = 0; leftX = 0; HTMLstr = ""; HTMLstr += "\n"; HTMLstr += "\n"; if (ie) HTMLstr += "
\n"; // if (n) HTMLstr += "\n"; HTMLstr += "\n"; HTMLstr += "
"; if (ie||ns6) HTMLstr += ""; if (n) HTMLstr += " 
 "; if (ie||ns6) HTMLstr += "" HTMLstr += staticLinks; HTMLstr += "\n"; HTMLstr += "\n"; HTMLstr += "\n"; if (n) HTMLstr += "
"; if (ie||ns6) HTMLstr += "
\n"; // HTMLstr += "\n"; HTMLstr += "\n"; HTMLstr += "\n"; HTMLstr += "\n"; HTMLstr += "\n"; // HTMLstr += "\n"; if (ie) HTMLstr+= "
\n"; // if (n) HTMLstr+= "\n"; HTMLstr += "\n"; } function addItem(idItem, text, hint, location, altLocation) { var Lookup = ""; if (HTMLstr.indexOf(Lookup) != -1) { alert(idParent + " already exist"); return; } var MENUitem = ""; MENUitem += "\n\n"; if (n) { MENUitem += ""; MENUitem += ""; //MENUitem += "| "; MENUitem += text; MENUitem += "" + mainItemSeparator; MENUitem += ""; } if (ie||ns6) { MENUitem += "\n"; MENUitem += "
\n"; MENUitem += "\n\n"; MENUitem += "\n"; HTMLstr = HTMLstr.replace("\n", MENUitem); } function addSubItem(idParent, text, hint, location) { var MENUitem = ""; Lookup = ""; if (HTMLstr.indexOf(Lookup) == -1) { alert(idParent + " not found"); return; } Lookup = ""; if (HTMLstr.indexOf(Lookup) == -1) { if (n) { MENUitem += "\n"; MENUitem += "\n"; MENUitem += "\n"; MENUitem += "\n"; MENUitem += "
\n"; MENUitem += "
\n"; MENUitem += "\n"; } if (ie||ns6) { MENUitem += "\n"; MENUitem += "\n"; MENUitem += "\n"; } MENUitem += "\n"; HTMLstr = HTMLstr.replace("\n", MENUitem); } Lookup = "\n"; if (n) MENUitem = "
"+text+"
\n"; if (ie||ns6) MENUitem = ""+text+"
\n"; MENUitem += Lookup; HTMLstr = HTMLstr.replace(Lookup, MENUitem); } function showMenu() { document.writeln(HTMLstr); } /*-------------------- Private declaration -----------------------*/ function findPosY(obj) { // subroutine courtesy Peter-Paul Koch // http://www.xs4all.nl/~ppk/js/index.html var curtop = 0; if (document.getElementById || document.all) { while (obj.offsetParent) { curtop += obj.offsetTop; obj = obj.offsetParent; } } else if (document.layers) curtop += obj.y; return curtop; } function displaySubMenu(idMainMenu) { var menu; var submenu; var y_coord; // maximum browser width that submenus can't overlap if (maxWidth==0){ if (n) maxWidth = self.innerWidth if(ie||ns6)maxWidth = document.body.clientWidth; } if (n) { submenu = document.layers[idMainMenu+"submenu"]; if (lastMenu != null && lastMenu != submenu) hideAll(); submenu.left = document.layers[idMainMenu].pageX - leftBiasNS; // checking if submenu is overlapping if(submenu.left + subWidth > maxWidth){ overlap=submenu.left + subWidth - maxWidth; submenu.left = submenu.left - overlap; } submenu.top = document.layers[idMainMenu].pageY + submenuOffsetNS; submenu.visibility = fShow; leftX = document.layers[idMainMenu+"submenu"].left; rightX = leftX + document.layers[idMainMenu+"submenu"].clip.width; leftY = document.layers[idMainMenu+"submenu"].top + document.layers[idMainMenu+"submenu"].clip.height; rightY = leftY; } else if (ie||ns6) { menu = ie? eval(idMainMenu) : document.getElementById(idMainMenu); submenu = ie? eval(idMainMenu+"submenu.style") : document.getElementById(idMainMenu+"submenu").style; submenu.left = calculateSumOffset(menu, 'offsetLeft') - leftBiasIE; // checking if menu is overlapping browserwindows right border leftcorner = opr6 ? submenu.left : submenu.left.substring(0,submenu.left.indexOf("p"))-0; total = leftcorner + subWidth; if(total > maxWidth){ overlap = total - maxWidth; newcorner = leftcorner - overlap - 1; submenu.left = opr6 ? newcorner : newcorner + "px" } // computing top corner coordinate for menubar if (ns6) y_coord = findPosY(document.getElementById("menuanchor")) else y_coord = findPosY(document.all.menuanchor) submenu.top = menu.style.top + (y_coord + submenuOffsetIE - ns6offset); submenu.visibility = fShow; if (lastMenu != null && lastMenu != submenu) hideAll(); leftX = ie? document.all[idMainMenu+"submenu"].style.posLeft : parseInt(document.getElementById(idMainMenu+"submenu").style.left); rightX = ie? leftX + document.all[idMainMenu+"submenu"].offsetWidth : leftX+parseInt(document.getElementById(idMainMenu+"submenu").offsetWidth); if(rightX > maxWidth){ overlap = rightX - maxWidth; } topY= (ie? document.all[idMainMenu+"submenu"].style.posTop : parseInt(document.getElementById(idMainMenu+"submenu").style.top)) - 30; leftY = (ie? document.all[idMainMenu+"submenu"].style.posTop+document.all[idMainMenu+"submenu"].offsetHeight : parseInt(document.getElementById(idMainMenu+"submenu").style.top)+parseInt(document.getElementById(idMainMenu+"submenu").offsetHeight)) + 10; rightY = leftY; } lastMenu = submenu; } function hideAll() { if (lastMenu != null) {lastMenu.visibility = fHide;lastMenu.left = 0;} } function calculateSumOffset(idItem, offsetName) { var totalOffset = 0; var item = eval('idItem'); do { totalOffset += eval('item.'+offsetName); item = eval('item.offsetParent'); } while (item != null); return totalOffset; } function updateIt(e) { if (ie&&!opr6) { var x = window.event.clientX + document.body.scrollLeft; var y = window.event.clientY + document.body.scrollTop; if (x > rightX || x < leftX) hideAll(); else if (y > rightY) hideAll(); else if (y < topY) hideAll(); } if (n||ns6) { var x = e.pageX; var y = e.pageY; if (x > rightX || x < leftX) hideAll(); else if (y > rightY) hideAll(); } } function operahide(){ if (opr6){ if (!MainTable.contains(event.toElement)) hideAll() } } if (ie||ns6) { document.onclick=hideAll; //document.body.onscroll=hideAll; document.onmousemove=updateIt; } if (n) { document.onmousedown=hideAll; window.captureEvents(Event.MOUSEMOVE); window.onmousemove=updateIt; }