/* HM_Loader.js
*  HierMenus Version 6
*  Copyright 2004 Jupitermedia Corporation
*/

// 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. 
HM_ScriptDir = "_client/hm/";
HM_ImageDir = "_client/hm/img/";
HM_ConfigDir = "_client/hm/";
HM_ConfigFiles = "HM_Menus_clients.js";
HM_ConfigType = "default";
HM_FramesEnabled = false;
HM_pageWidth = 980;

// Preload images
HM_Images = [ 'up.gif', 'down.gif', 'right.gif', 'hier_bg.gif', 'hier_bg1.gif' ];
for(var i = 0; i < HM_Images.length; i++) {
	HM_ImagePreload = new Image();
	HM_ImagePreload.src = HM_ImageDir + HM_Images[i];
}

/*
<script language="JavaScript" type="text/javascript">
	function mainMenu_DoFSCommand(command, args) {
		e = new HM_f_dummyEvent();
		if(command == "over") {
			e.type = "over";
			popUp(args, e);
			HM_isOnMenu = true;
		} else {
			HM_isOnMenu = false;
			e.type = "out";
			popDown(args, e);
		}
	}
</script>
<script language="VBScript" type="text/vbscript">
<!-- 
// Catch the fscommand in ie with vbscript, and pass
// it on to JavaScript.
Sub mainMenu_FSCommand(ByVal command, ByVal args)
    call mainMenu_DoFSCommand(command, args)
end sub
//-->
</script>
*/

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;
    HM_IsMenu = !HM_IE4M && !HM_IE5M && (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;

// 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 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.

Hvq=(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.HYD();if(Hvq||(on&&!this.vm)||(!on&&!this.vn)){this.HYF(on);return;}else{var ve=(on?this.vm:this.vn);var vb=(on?this.vk:this.vl);if(!vb)vb=(HM_Opera)?20:10;var vj=(on?this.vo:this.vp);if(!vj)vj=20;
}if(HM_Opera){if(this.mh.nl)this.HXh(null,1);}else{if(this.nl)this.HXh(null,1);}this.mh.uy={va:0,vf:0,vg:0,vc:"cs",vd:"width",vh:"left",vs:(HM_Opera)?parseInt(this.mh.cs.style.left):parseInt(this.cs.style.left),vr:vb};var uy=this.mh.uy;
this.mh.vi=(on?1:2);if((ve=="top")||(ve=="bottom")){uy.vd="height";uy.vh="top";uy.vs=(HM_Opera)?parseInt(this.mh.cs.style.top):parseInt(this.cs.style.top);uy.vf=parseInt(this.mh.style.height);}else uy.vf=parseInt(this.mh.style.width);
if((ve=="right")||(ve=="bottom"))uy.vc="mh";vj=vj/100;uy.vg=Math.round((uy.vf)*vj);if(uy.vc=="mh"){if(uy.vh=="left")uy.va=(on)?this.xPos:this.xPos+uy.vf;else uy.va=(on)?this.yPos:this.yPos+uy.vf;}else uy.va=(on)?uy.vs:uy.vf*(-1);
if(on){this.mh.style[uy.vd]="0px";var jp=(uy.vc=="mh")?this.mh:(HM_Opera)?this.mh.cs:this.cs;jp.style[uy.vh]=((uy.vc=="mh")?uy.va+uy.vf:uy.vs-uy.vf)+"px";}else uy.vg*=(-1);HM_f_SlideMoveTo(this.ne);}
function HM_f_SlideMoveTo(eg){if(Hax||!HWU())return;var uz=Hms[eg];if(!uz.mh.vi)return;var uy=uz.mh.uy;var jp=(uy.vc=="mh")?uz.mh:(HM_Opera)?uz.mh.cs:uz.cs;var oldPos=parseInt(jp.style[uy.vh]);var newPos=(oldPos+(uy.vg*(uy.vc=="mh"?(-1):1)));
if((Math.abs(newPos-uy.va))<Math.abs(uy.vg))newPos=uy.va;if(newPos==uy.va)uz.HYD();else{var oldDim=parseInt(uz.mh.style[uy.vd]);uz.HYF(0);uz.mh.style[uy.vd]=(oldDim+uy.vg)+"px";jp.style[uy.vh]=newPos+"px";uz.HYF(1);Hg.clearTimeout(uz.mh.sp);
uz.mh.sp=null;var en="HM_f_SlideMoveTo('"+uz.ne+"')";if(HM_Opera)uz.mh.sp=Hg.setTimeout(en,uy.vr);else uz.mh.sp=setTimeout(en,uy.vr);}}
function HM_f_KillSlide(){if(!this.mh||!this.mh.vi)return;if(HM_Opera)Hg.clearTimeout(this.mh.sp);else clearTimeout(this.mh.sp);this.mh.sp=null;this.HYF(0);var uy=this.mh.uy;this.mh.style[uy.vd]=uy.vf+"px";
if(uy.vc=="mh")this.mh.style[uy.vh]=uy.va+"px";else{if(HM_Opera)this.mh.cs.style[uy.vh]=uy.vs+"px";else this.cs.style[uy.vh]=uy.vs+"px";}this.HYF(this.mh.vi==1);this.mh.vi=0;}

// The following functions are intended for use with the HM_OnVisibilityToggle,
// HM_OnMove, and HM_OnMenuCreated menu triggers. For Internet Explorer version 5.5 
// and 6, they utilize an IFrame based masking method that allows menus to cover 
// drop-down select boxes, Flash movies, and other windowed elements on pages 
// that have them.

function HM_f_IEMaskMove(menuEl,xPos,yPos){if(this.rt){this.rt.style.left=xPos+"px";this.rt.style.top=yPos+"px";}}
function HM_f_IEMaskToggle(menuEl,ru){if(window.HM_IE55){if(ru){this.rt.style.left=this.mh.style.left;this.rt.style.top=this.mh.style.top;this.rt.style.width=this.mh.offsetWidth;this.rt.style.height=this.mh.offsetHeight;
}if(this.rt)this.rt.style.visibility=(ru)?"visible":"hidden";}}
function HM_f_IEMaskCreate(menuEl){if(window.HM_IE55){this.rt=Hg.document.createElement("IFRAME");this.rt.src="javascript:void(0)";this.rt.frameBorder=0;this.rt.style.position="absolute";this.rt.style.visibility="hidden";
this.rt.style.left=(HXN())?"0px":"-500px";this.rt.style.top="-2000px";this.rt.style.width="100px";this.rt.style.height="100px";this.rt.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)";this.rt.allowTransparency=false;
if(this.UseInsert)Hg.document.body.insertBefore(this.rt,Hg.document.body.firstChild);else Hg.document.body.appendChild(this.rt);}}

// Create dummy event for calls from flash
function HM_f_dummyEvent(){this.pageX = this.clientX = 0;this.pageY = this.clientY = 0; this.currentTarget = this.srcElement = null;this.type = "unknown";return this;}

// End custom functions

HM_IsMenu=(HM_Konqueror&&HM_FramesEnabled)?false:HM_IsMenu;
if(HM_IsMenu) {
	HM_BrowserString = HM_NS4 ? "NS4" : HM_Opera ? "OPR" : HM_DOM ? "DOM" : "IE4";
	HM_WriteString = '<scr'+'ipt language="JavaScript1.2" src="' + HM_ScriptDir + 'HM_Script' + HM_BrowserString + '.js" type="text/javascript">'+"\n"+'<\/scr'+'ipt>'+"\n";
	document.write(HM_WriteString);

	HM_WriteString = '<scr'+'ipt language="JavaScript1.2" src="' + HM_ConfigDir + HM_ConfigFiles + '" type="text/javascript">'+"\n"+'<\/scr'+'ipt>'+"\n";
	document.write(HM_WriteString);
/*
	HM_aConfigs = HM_ConfigFiles.split(',');
	for(var i=0; i<HM_aConfigs.length; i++) {
		HM_WriteString = '<scr'+'ipt language="JavaScript1.2" src="' + HM_ConfigDir + HM_aConfigs[i] + '" type="text/javascript">'+"\n"+'<\/scr'+'ipt>'+"\n";
		if(HM_aConfigs[i]) document.write(HM_WriteString);
	}
	if(HM_ConfigType=="arrays") {
		HM_WriteString = '<scr'+'ipt language="JavaScript1.2" src="' + HM_ScriptDir + 'HM_ConvertArrays.js" type="text/javascript">'+"\n"+'<\/scr'+'ipt>'+"\n"
		document.write(HM_WriteString);
	}
*/	
}
