<!--
	/*
		pop_up_menu.js include file
		Written			: 20011112 by James Austin.
		Last Updated	: 20030501 - Amended the call to doElementEffects() from hidePopUp() to tie into the new system.
		Current Version	: 2.4

		Purpose:
		This code provides the functionality for producing pop-up menus created in DIVs.  It is limited to only supporting one pop-up
		DIV at once.

		Dependants:
		DHTML_main.js
		change_images.js
	*/

	// Setup global variables
	var gblStrPopUpDivId = "";
	var gblObjTimer;
	var gblBlnMenuInUse = false;
	var gblObjImg;
	var gblObjChangeImgOffSrc;
	var gblIntDelayPeriod = 1000;


	function popUpOn(objImg,objChangeImgOnSrc,objChangeImgOffSrc,strPopUpDivId,strPopUpDivX,strPopUpDivY) {
		/*
			Wrapper function.  Filters the parameters to the relevant functions depending on browser capability
			
			objImg				- image object which spawns the pop-up menu, not passed in quotes	(if applicable)
			objChangeImgOnSrc	- on-state source of the image object, not passed in quotes			(if applicable)
			objChangeImgOffSrc	- off-state source of the image object, not passed in quotes		(if applicable)
			strPopUpDivId		- name of the pop-up DIV, passed in quotes							(required)
			strPopUpDivX		- desired x-coordinate of the pop-up DIV, passed in quotes			(required)
			strPopUpDivY		- desired y-coordinate of the pop-up DIV, passed in quotes			(required)
		*/

		// Is there a menu already visible?  If so, clear it before showing the new one.
		if (gblStrPopUpDivId != '') {
			gblBlnMenuInUse = false;
			hidePopUp();
		}

		gblObjImg = objImg;								// Store the image object which spawns the pop-up menu
		gblObjChangeImgOffSrc = objChangeImgOffSrc;		// Store the off-state image source name
		gblStrPopUpDivId = strPopUpDivId;				// Store the id of the pop-up DIV

		if (objImg != "") {
			changeImages(objImg,objChangeImgOnSrc);		// change the image src if specified
		}

		if (blnDHTMLOk) {
			gblBlnMenuInUse = true;

			// Call "doElementEffects()" to make the changes
			doElementEffects(eval('"' + strPopUpDivId + ',left,' + strPopUpDivX + ';' + strPopUpDivId + ',top,' + strPopUpDivY + ';' + strPopUpDivId + ',visibility,visible"'));
		}
	}


	function popUpOff() {
		/*
			If the client is DHTML capable, this function simply sets in motion the timer delay which hides the pop-up DIV.
			However, on non-DHTML clients, it calls the changeImages function to perform a simple image roll-out
		*/

		if (blnDHTMLOk) {
			if (document.all || document.layers) {
				// NS6 doesn't support the clearTimeout method
				clearTimeout(gblObjTimer);
			}

			gblBlnMenuInUse = false;
			gblObjTimer = setTimeout("hidePopUp()",gblIntDelayPeriod);
		}
		else {
			// Browser is not DHTML-capable, so perfom image roll-off if applicable
			if (gblObjImg != "") {
				changeImages(gblObjImg,gblObjChangeImgOffSrc);
			}
		}
	}


	function hidePopUp() {
		if (gblBlnMenuInUse == false) {
			doElementEffects(eval('"' + gblStrPopUpDivId + ',visibility,hidden"'));		// hide the pop up DIV

			if (gblObjImg != "")	{
				changeImages(gblObjImg,gblObjChangeImgOffSrc);				// perform image roll-off if applicable
			}

			gblObjImg = null;
			gblObjChangeImgOffSrc = null;
			gblStrPopUpDivId = "";
		}
	}
//-->