/* HM_Loader.js * HierMenus Version 6 * Copyright 2004 Jupitermedia Corporation */ HM_UserAgent = navigator.userAgent; HM_DOM = (document.getElementById) ? true : false; HM_NS4 = (document.layers) ? true : false; HM_IE = (document.all) ? true : false; HM_IE4 = HM_IE && !HM_DOM; HM_Mac = (navigator.appVersion.indexOf("Mac") != -1); HM_IE4M = HM_IE4 && HM_Mac; HM_IsSafari = ((HM_DOM)&& (parseInt(navigator.productSub)>=20020000)&& (navigator.vendor.indexOf("Apple Computer")!=-1)); if(HM_IsSafari) { HM_BrowserPattern = /Safari\/(\d+)/; HM_Matches = HM_UserAgent.match(HM_BrowserPattern); if (HM_Matches&&HM_Matches[1]) HM_BrowserVersion = (HM_Matches[1]-0); else HM_BrowserVersion = 0; } HM_Opera = (window.opera) ? true : false; if(HM_IsSafari||HM_Opera) { HM_IE=HM_NS4=HM_IE4=HM_IE4M=false; if(HM_IsSafari) HM_Mac=true; } HM_IE5M = (HM_IE&&HM_Mac&&HM_DOM); if(HM_Opera) { HM_BrowserPattern = /Opera(\/| )(\d+.*)/; HM_VersionSupported = 7; } HM_Konqueror = (HM_UserAgent.indexOf("Konqueror")!=-1); if(HM_Konqueror) { HM_BrowserPattern = /(Konqueror\/)(\d+.*)/; HM_VersionSupported = 3.2; } if(HM_Opera || HM_Konqueror) { if (HM_UserAgent.match) { HM_Matches = HM_UserAgent.match(HM_BrowserPattern); if (HM_Matches&&HM_Matches[2]) { HM_BrowserVersion = parseFloat(HM_Matches[2]); } else HM_BrowserVersion = 0; HM_IsMenu = (HM_BrowserVersion >= HM_VersionSupported); } else { HM_BrowserVersion = 0; HM_IsMenu = false; } } else { HM_BrowserVersion = 0; /* Test: BDOT commenting out the negation of IE 5 on the Mac Hoping to achieve some semblance of usability for the Mac/IE audience */ //HM_IsMenu = !HM_IE4M && !HM_IE5M && (HM_DOM || HM_NS4 || HM_IE4 ); HM_IsMenu = !HM_IE4M && (HM_DOM || HM_NS4 || HM_IE4 ); } if(window.event + "" == "undefined") event = null; function HM_f_PopUp(){return false}; function HM_f_PopDown(){return false}; popUp = HM_f_PopUp; popDown = HM_f_PopDown; // Configuration block. The following 6 variables should be configured // to match your default preferences. You can then override the settings // on a page by page basis by providing values for the variables in any // JavaScript segment that is loaded BEFORE this one. These variables // are the ONLY variables you should alter in this file. if(typeof(window.HM_ScriptDir)=="undefined") HM_ScriptDir = "hm/scripts/"; if(typeof(window.HM_ImageDir)=="undefined") HM_ImageDir = "hm/images/"; if(typeof(window.HM_ConfigDir)=="undefined") HM_ConfigDir = "hm/configs/"; if(typeof(window.HM_ConfigFiles)=="undefined") HM_ConfigFiles = "HM_Config.asp?height=75&nav=vacations"; if(typeof(window.HM_ConfigType)=="undefined") HM_ConfigType = "default"; if(typeof(window.HM_FramesEnabled)!="boolean") HM_FramesEnabled = false; // Custom functions. We recommend that you delete any of these // that you have no use for, to reduce the overall download times // of the scripts. (Be sure to save yourself a copy, in case // you decide you want to use them in the future!) // The following function is included to illustrate the JS // expression handling of the MenuX and MenuY parameters. // It returns a centered horizontal position for the menu. function HM_f_CenterMenu(topmenuid) { var MinimumPixelLeft = 0; var TheMenu = HM_o_Menus[topmenuid]; var TheMenuWidth = HM_DOM ? parseInt(TheMenu.eMenu.style.width) + ((HM_IEnoDTD || HM_OperaQuirk) ? 0 : TheMenu.BorderLeftWidth+TheMenu.BorderRightWidth) : HM_IE4 ? TheMenu.eMenu.style.pixelWidth : TheMenu.eMenu.clip.width; var TheWindowWidth = HM_IE ? (HM_DOM ? HM_Canvas.clientWidth : HM_MenusTarget.document.body.clientWidth) : (HM_MenusTarget.document.body&&HM_MenusTarget.document.body.clientWidth) ? HM_MenusTarget.document.body.clientWidth : HM_MenusTarget.innerWidth; return Math.max(parseInt((TheWindowWidth-TheMenuWidth) / 2),MinimumPixelLeft); } // The following three functions can be used in combination to // produce "sliding" menus; menus that slide in and out to their // desired locations. The "SetSlide" and "KillSlide" functions // are the required interface functions for HierMenus, and the // SlideMoveTo function does the actual work. To activate these // routines on a menu, you would add (as an example) // "ScrollEnabled:1,setTrans:HM_f_SetSlide,killTrans:HM_f_KillSlide,SlideInFrom:'left'" // to the menu definitions, in addition to the SlideIn/SlideOutInterval, // and SlideIn/SlideOutPercent variables (all of which will assume // defaults if not set). Note that for these particular transitions // to work, ScrollEnabled must be true on the menu. HM_NoSliding=(HM_DOM&&((navigator.productSub&&(navigator.productSub<20021130))||((/^Netscape/.test(navigator.vendor))&&(navigator.vendorSub==7.02))||(navigator.vendor=="Camino"&&(navigator.vendorSub<=.7)))); function HM_f_SetSlide(on) { this.killTrans(); if(HM_NoSliding||(on&&!this.SlideInFrom)||(!on&&!this.SlideOutTo)) { this.visibilityToggle(on); return; } else { var moveDir=(on?this.SlideInFrom:this.SlideOutTo); var SlideInt=(on?this.SlideInInterval:this.SlideOutInterval); if(!SlideInt) SlideInt=(HM_Opera)?20:10; var SlidePerc=(on?this.SlideInPercent:this.SlideOutPercent); if(!SlidePerc) SlidePerc=20; } if(HM_Opera) { if(this.eMenu.HasChildVisible) this.hideChildren(null,1); } else { if(this.HasChildVisible) this.hideChildren(null,1); } this.eMenu.SlideVars={SlideTo:0,SlideDim:0,SlidePixels:0,SlideEl:"scrollParent",SlideWH:"width",SlideTL:"left",SlideOrig:(HM_Opera)?parseInt(this.eMenu.scrollParent.style.left):parseInt(this.scrollParent.style.left),SlideInterval:SlideInt}; var SlideVars=this.eMenu.SlideVars; this.eMenu.SlideStatus=(on?1:2); if((moveDir=="top")||(moveDir=="bottom")) { SlideVars.SlideWH="height"; SlideVars.SlideTL="top"; SlideVars.SlideOrig=(HM_Opera)?parseInt(this.eMenu.scrollParent.style.top):parseInt(this.scrollParent.style.top); SlideVars.SlideDim=parseInt(this.eMenu.style.height); } else SlideVars.SlideDim=parseInt(this.eMenu.style.width); if((moveDir=="right")||(moveDir=="bottom")) SlideVars.SlideEl="eMenu"; SlidePerc=SlidePerc/100; SlideVars.SlidePixels=Math.round((SlideVars.SlideDim)*SlidePerc); if(SlideVars.SlideEl=="eMenu") { if(SlideVars.SlideTL=="left") SlideVars.SlideTo=(on)?this.xPos:this.xPos+SlideVars.SlideDim; else SlideVars.SlideTo=(on)?this.yPos:this.yPos+SlideVars.SlideDim; } else SlideVars.SlideTo=(on)?SlideVars.SlideOrig:SlideVars.SlideDim*(-1); if(on) { this.eMenu.style[SlideVars.SlideWH]="0px"; var TempElement = (SlideVars.SlideEl=="eMenu")?this.eMenu:(HM_Opera)?this.eMenu.scrollParent:this.scrollParent; TempElement.style[SlideVars.SlideTL]=((SlideVars.SlideEl=="eMenu")?SlideVars.SlideTo+SlideVars.SlideDim:SlideVars.SlideOrig-SlideVars.SlideDim)+"px"; } else SlideVars.SlidePixels*=(-1); HM_f_SlideMoveTo(this.MenuID); } function HM_f_SlideMoveTo(menuname) { if(HM_IsReloading||!HM_f_DocumentCheck()) return; var SlideMenu=HM_o_Menus[menuname]; if(!SlideMenu.eMenu.SlideStatus) return; var SlideVars=SlideMenu.eMenu.SlideVars; var TempElement=(SlideVars.SlideEl=="eMenu")?SlideMenu.eMenu:(HM_Opera)?SlideMenu.eMenu.scrollParent:SlideMenu.scrollParent; var oldPos=parseInt(TempElement.style[SlideVars.SlideTL]); var newPos=(oldPos+(SlideVars.SlidePixels*(SlideVars.SlideEl=="eMenu"?(-1):1))); if((Math.abs(newPos-SlideVars.SlideTo))=7.2)))?false:true; var nRetPos=eElement[sOffsetXY]; var nWidth=0; if(bAdjustIEMargin) { nWidth=eElStyle[sMarginXY]; if(!isNaN(parseInt(nWidth))) { if((nWidth.indexOf("%")!=-1)&&(eElement.parentElement)){ var nElSize=eElement.parentElement[sClientWHXY]; if(isNaN(nElSize)) nElSize=0; nWidth=Math.round((parseInt(nWidth)/100)*nElSize); } else nWidth=parseInt(nWidth); nRetPos+=nWidth; } } if(bIsNetscape60&&eElement.tagName!="TABLE") { nWidth=eElStyle[sBorderXY]; if(!/\d/.test(nWidth)) nWidth=eElement.getAttribute('border'); nWidth=parseInt(nWidth); if(!isNaN(nWidth)) nRetPos-=nWidth; } var eParElement = eElement.offsetParent; var bAdjustBodyClient=true; if(HM_Opera&&eParElement&&(eParElement.tagName=="BODY")&&(HM_BrowserVersion>=7.2)) { if(!/^(FORM|P|DIV|TD|TR|TABLE|DL|OL|UL)$/.test(eElement.tagName)) bAdjustBodyClient=false; } else if(HM_Opera&&(HM_BrowserVersion<7.2)) { bAdjustBodyClient=false; } while (eParElement) { eElStyle=(eParElement.currentStyle)?eParElement.currentStyle:eParElement.style; if(window.getComputedStyle&&HM_Opera) eElStyle=window.getComputedStyle(eParElement,null); if(eElStyle&&(eElStyle.position=="absolute")) bAbsolutePos=true; if(eElStyle&&eElStyle.position&&(eElStyle.position!="static")) bPositionedObject=true; if(bAbsolutePos&&HM_IsSafari) bAdjustBodyOffset=false; if(HM_Opera&&bPositionedObject&&(HM_BrowserVersion>=7.2)) bAdjustBodyOffset=false; if(HM_IE) { if((!HM_Mac)&&(eParElement.tagName!="TABLE")&&(eParElement.tagName!=((HM_IECSS)?"HTML":"BODY"))) nRetPos += eParElement[sClientXY]; if(bAdjustIEMargin) { nWidth=eElStyle[sMarginXY]; if(!isNaN(parseInt(nWidth))) { if((nWidth.indexOf("%")!=-1)&&(eParElement.parentElement)){ var eParent=eParElement.parentElement; var nElSize=eParent[sClientWHXY]; if(isNaN(nElSize)) nElSize=0; nWidth=Math.round((parseInt(nWidth)/100)*nElSize); } else nWidth=parseInt(nWidth); nRetPos+=nWidth; } } } else if(HM_NS6&&!HM_IsSafari) { nWidth=eElStyle[sBorderXY]; var sPosition = eElStyle.position; if(window.getComputedStyle&&!bIsNetscape6) { eElStyle=window.getComputedStyle(eParElement,null); nWidth=(xory=="x")?eElStyle.getPropertyValue('border-left-width'):eElStyle.getPropertyValue('border-top-width'); sPosition=eElStyle.getPropertyValue('position'); } nWidth=(isNaN(parseInt(nWidth)))?0:parseInt(nWidth); if(sPosition=="absolute") bAbsolutePos=true; if(((eParElement.tagName=="BODY")&&(!bIsNetscape60))|| ((sPosition)&&(sPosition!="static")&&(eParElement.tagName!="TABLE"))) { nRetPos+=nWidth; } else if((eParElement.tagName=="TABLE")&&(bAdjustGeckoBorder)) { if(nWidth==0) { var sFrame=eParElement.getAttribute('frame'); if(sFrame!=null) nRetPos += 1; } else if(nWidth > 0) nRetPos+=nWidth; } } if(HM_NS6&&!bIsNetscape60&&!HM_IsSafari&&(eParElement.tagName=="BODY")&&!bAbsolutePos) bAdjustBodyOffset=false; if((eParElement.tagName!="BODY")||bAdjustBodyOffset) { nRetPos+=eParElement[sOffsetXY]; if(HM_Opera&&(eParElement.tagName=="BODY")&&bAdjustBodyClient) nRetPos+=eParElement[sClientXY]; } eParElement = eParElement.offsetParent; } eElStyle=(document.body.currentStyle)?document.body.currentStyle:document.body.style; if(HM_Konqueror&&!bAbsolutePos&&(HM_BrowserVersion<3.2)) { nWidth=eElStyle[sMarginXY]; if(!isNaN(parseInt(nWidth))) { if(nWidth.indexOf("%")!=-1){ var nElSize=document.documentElement.offsetWidth; if(isNaN(nElSize)) nElSize=0; nWidth=parseInt((parseInt(nWidth)/100)*nElSize); } else nWidth=parseInt(nWidth); } else nWidth = 10; nRetPos+=nWidth; } return nRetPos; } // The following function retrieves the current height or // width of a menu. Use it to position menus based on their // bottom or right edges, among other possibilities. function HM_f_GetMenuDimension(menuname,width) { var TempMenu=HM_o_Menus[menuname]; var eMenu=(TempMenu)?TempMenu.eMenu:null; if(eMenu) { if (!HM_NS4&& ((HM_Opera&&!eMenu.SizeFixed)||(!HM_Opera&&!TempMenu.SizeFixed))) TempMenu.fixSize(false); if (HM_DOM) { return ((width)? ((HM_IEnoDTD||HM_OperaQuirk)?0:(TempMenu.BorderLeftWidth+TempMenu.BorderRightWidth))+parseInt(eMenu.style.width): ((HM_IEnoDTD||HM_OperaQuirk)?0:(TempMenu.BorderTopWidth+TempMenu.BorderBottomWidth))+parseInt(eMenu.style.height)); } else if (HM_IE) { return ((width) ? eMenu.style.pixelWidth : eMenu.style.pixelHeight); } else { return ((width) ? eMenu.clip.width : eMenu.clip.height); } } else return 0; } // In many (and especially older) browsers, select boxes and other form // elements as well as flash or java applets will cover menu elements // when they popup. The following function can be used to hide select // elements (or any other elements of your choosing) when the menus // appear or restore them when the menus are hidden. This function works // well in all HM supported browsers except NS4, which will only work // if the HTML of the page is structured in a specific way. For IE5.5 and // IE6.0, an alternate technique is presented lower in this script which // does not require element hiding. function HM_f_ToggleElementList(show,elList,toggleBy) { if(HM_NS4&&(toggleBy=="tag")) return true; for(var i=0; i'+"\n"+'<\/scr'+'ipt>'+"\n"; document.write(HM_WriteString); for(var i=0; i'+"\n"+'<\/scr'+'ipt>'+"\n"; if(HM_aConfigs[i]) document.write(HM_WriteString); } if(HM_ConfigType=="arrays") { HM_WriteString = ''+"\n"+'<\/scr'+'ipt>'+"\n" document.write(HM_WriteString); } }