/*HM_Loader.js
* by Peter Belesis. v4.2 020128
* Copyright (c) 2002 Peter Belesis. All Rights Reserved.
*/

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_Opera = (navigator.userAgent.indexOf("Opera")!=-1);
HM_Konqueror = (navigator.userAgent.indexOf("Konqueror")!=-1);

HM_IsMenu = !HM_Opera && !HM_Konqueror && !HM_IE4M && (HM_DOM || HM_NS4 || HM_IE4);

HM_BrowserString = HM_NS4 ? "NS4" : HM_DOM ? "DOM" : "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;


HM_GL_MenuWidth          = 250;
HM_GL_FontFamily         = "Myriad,MetaNormal,Arial,Helvetica,sans-serif";
HM_GL_FontSize           = 11;
HM_GL_FontBold           = false;
HM_GL_FontItalic         = false;
HM_GL_FontColor          = "#FFFFFF";
HM_GL_FontColorOver      = "#4A1D20";
HM_GL_BGColor            = "#4A1D20";
HM_GL_BGColorOver        = "#C0C9C3";
HM_GL_ItemPadding        = 0;

HM_GL_BorderWidth        = 2;
HM_GL_BorderColor        = "#3B5D47"; 
HM_GL_BorderStyle        = "solid";
HM_GL_SeparatorSize      = 1;
HM_GL_SeparatorColor     = "#3B5D47";

HM_GL_ImageSrc = "/_/js/hiermenus/HM_More_white_right.gif";
HM_GL_ImageSrcLeft = null;

HM_GL_ImageSrcOver = "/_/js/hiermenus/HM_More_black_right.gif";
HM_GL_ImageSrcLeftOver = null;

HM_GL_ImageSize          = 4;
HM_GL_ImageHorizSpace    = 2;
HM_GL_ImageVertSpace     = 2;

HM_GL_KeepHilite         = true;
HM_GL_ClickStart         = false;
HM_GL_ClickKill          = false;
HM_GL_ChildOverlap       = 3;
HM_GL_ChildOffset        = 2;
HM_GL_ChildPerCentOver   = null;
HM_GL_TopSecondsVisible  = 0;
HM_GL_ChildSecondsVisible = .3;
HM_GL_StatusDisplayBuild = 0;
HM_GL_StatusDisplayLink  = 1;
HM_GL_UponDisplay        = null;
HM_GL_UponHide           = null;

//New addition added by sysys to support the hide form elements functionality
// this has been moved to the array level evaluate_upon_tree_show & evaluate_upon_tree_hide
//   HM_GL_UponDisplay	= "hideForm(true,this)";
//	 HM_GL_UponHide		= "hideForm(false,this);";
// End New addition

//HM_GL_RightToLeft      = false;
HM_GL_CreateTopOnly      = HM_NS4 ? true : false;
HM_GL_ShowLinkCursor     = true;

//New addition added by sysys to support the hide form elements functioanlity

/*---------------------------------------------------------------------------------------

	getPosition(obj)
	Purpose:	Finds the object's offsetTop and offsetLeft values relative to the BODY tag.

	-------------------------------------------------------------------------------------*/
	function getPosition(element) {

	//	Set position and dimension variables
		positionLeft	= element.offsetLeft;
		positionTop		= element.offsetTop;
		elementWidth	= element.offsetWidth;
		elementHeight	= element.offsetHeight;
		elementParent	= element.offsetParent;

		while (elementParent.tagName.toUpperCase() != "BODY") {
			positionLeft	+= elementParent.offsetLeft;
			positionTop		+= elementParent.offsetTop;
			elementParent	= elementParent.offsetParent;
		}

		positionRight	= elementWidth + positionLeft;
		positionBottom	= elementHeight + positionTop;
		positionObject	= new setDimensions(positionLeft,positionRight,
											positionTop,positionBottom,
											elementHeight,elementWidth);

	/*	For testing - alert the current menu's position
		alert("--- " + element.id.toUpperCase()		+ " ---\n"
				+ "Left: "		+ positionLeft		+ "\n"
				+ "Right: "		+ positionRight		+ "\n"
				+ "Top: "		+ positionTop		+ "\n"
				+ "Bottom: "	+ positionBottom	+ "\n"
				+ "Width: "		+ elementWidth		+ "\n"
				+ "Height: "	+ elementHeight);	*/

		return positionObject;

	}


/*	---------------------------------------------------------------------------------------

	setDimensions(left,right,top,bottom)
	Purpose:	Sets properties of a new JavaScript object containing the position and 
				dimension information of an element passed into getPosition().

	-------------------------------------------------------------------------------------*/
	function setDimensions(left,right,top,bottom,height,width) {

		this.left	= left;
		this.right	= right;
		this.top	= top;
		this.bottom	= bottom;
		this.width	= width;
		this.height	= height;

	}


/*	---------------------------------------------------------------------------------------

	doesOverlap(posObj1,posObj2)
	Purpose:	Checks to see if two objects overlap.

	-------------------------------------------------------------------------------------*/
	function doesOverlap(posObj1,posObj2) {

	//	Initialize variables
		overlapsHorizontally = false;
		overlapsVertically = false;

	//	Test both objects for overlap of left/right axis
		if ((posObj1.left >= posObj2.left && posObj1.left <= posObj2.right) || (posObj2.left >= posObj1.left && posObj2.left <= posObj1.right)) {
			overlapsHorizontally = true;
		}

	//	Test both objects for overlap of top/bottom axis
		if ((posObj1.top >= posObj2.top && posObj1.top <= posObj2.bottom) || (posObj1.bottom >= posObj2.top && posObj1.bottom <= posObj2.bottom)) {
			overlapsVertically = true;
		}

		return overlapsHorizontally && overlapsVertically;

	}


/*	---------------------------------------------------------------------------------------

	hideForm(on,oMenuObj)
	Purpose:	Loops through JavaScript menu arrays, identifies which form elements need
				to be hidden or shown, and hides/shows the form elements.  This technique 
				DOES NOT WORK in Netscape 4.7x browsers due to JavaScript DOM constraints,
				and IS NOT NEEDED in Netscape 6.

	-------------------------------------------------------------------------------------*/
	function hideForm(on,oMenuObj) {
	
	//	This script works only for IE4+ browsers....
		if (document.all) {
			oMenuPos = getPosition(oMenuObj);

		//	Check for the existence of forms
			if (document.forms.length > 0) {

			//	Start with first form, and then move on to next, etc....
				for (var FormObject = 0; FormObject <= (document.forms.length - 1); FormObject++) {

				//	Loop through the collection of form elements
					for (var i = 0; i < document.forms[FormObject].elements.length; i++) {

					//	Set oElement = to the current form element object being looped through
						oElement = document.forms[FormObject].elements[i];

					//	Exclude all 'hidden' input types
						if (oElement.type.toLowerCase() != "hidden") {

						//	Exclude all 'hidden' input types
							var elementType = oElement.type.toLowerCase();

						//	List inputs we don't want hidden.
							switch (elementType) {
							//	Hidden, text and password fields need not be hidden
								case "hidden": break;
								case "text": break;
								case "password": break;

							//	For all other input types, run the following code....
								default:
							//	Set the position for the dropdown select box, using getPosition()
								oDropdownBoxPos = getPosition(oElement);

							//	For testing - alert the dropdown box's position when hiding the object (on)
							/*	if (on)	alert("--- " + oElement.type.toUpperCase() + " ---\n"
										+ "Left: "		+ oDropdownBoxPos.left		+ "\n"
										+ "Right: "		+ oDropdownBoxPos.right		+ "\n"
										+ "Top: "		+ oDropdownBoxPos.top		+ "\n"
										+ "Bottom: "	+ oDropdownBoxPos.bottom	+ "\n"
										+ "Width: "		+ oDropdownBoxPos.width		+ "\n"
										+ "Height: "	+ oDropdownBoxPos.height);	*/

							//	Test to see if oMenuObj overlaps the current oElement using doesOverlap()
								if (doesOverlap(oDropdownBoxPos,oMenuPos)) {
								//	(oElement.hidByMenuID != null) ? alert("hidByMenuID = " + oElement.hidByMenuID) : alert("hidByMenuID = null");

								//	If they do overlap, then hide or show the form element.

									if (on){

										if (oElement.hidByMenuID == null) {

										//	'on' is set true - hide the element
											oElement.style.visibility = "hidden"
										//	Tag the object that hid the element
											oElement.hidByMenuID = oMenuObj.id;

										}

									} else {
									
										if (oElement.hidByMenuID == oMenuObj.id) {

										//	'on' is set false - show the element
											oElement.style.visibility = "visible";
										//	Remove the tag to the object that hid the element.
											oElement.hidByMenuID = null;

										}

									}

								}
								break;
							}
 
						}

					}

				}

			}/**/

		}

	}

/*	---------------------------------------------------------------------------------------

	FORM ELEMENT HIDE/SHOW - END 

	=====================================================================================*/

if(HM_IsMenu) {
	document.write("<SCRIPT LANGUAGE='JavaScript1.2' SRC='/_/js/hiermenus/HM_Arrays_Splash.js' TYPE='text/javascript'><\/SCRIPT>");
	document.write("<SCRIPT LANGUAGE='JavaScript1.2' SRC='/_/js/hiermenus/HM_Script"+ HM_BrowserString +".js' TYPE='text/javascript'><\/SCRIPT>");
}


//end