///////////////////////////////////////////////////////////////////////////////

  function resetTimer(){
  	clearTimeout(timerID);
  }

///////////////////////////////////////////////////////////////////////////////

	function getButtonNum(buttonID){
		// Get the number following the underscore in the button ID passed to function
		buttonIDarray = buttonID.split("_");
		dropNum = buttonIDarray[1];
		return(dropNum);
	}

///////////////////////////////////////////////////////////////////////////////

	function showDrop(buttonID) {

		dropNum = getButtonNum(buttonID);

		// Start by hiding all drop menus
		hideDrop('all');

		// Set rollover class of menu option (unless it is the active menu option)
		MM_findObj(buttonID).className = (MM_findObj(buttonID).className == activeClass) ? activeClass : overClass;

		// If menu item has no drop associated with it, simply return from here
		if(!(MM_findObj(dropIDprefix+dropNum))){
			return;
		}

		// Get position and width of hovered button
    var buttonOffsetLeft=MM_findObj(buttonID).offsetLeft;
		var buttonOffsetTop=MM_findObj(buttonID).offsetTop;
		// offsetWidth is read-only.  Must be set using setAttribute("width")
		// var buttonWidth=MM_findObj(buttonID).style.offsetWidth;


		var activeDrop = MM_findObj(dropIDprefix+dropNum);

		// Set x,y pos of drop menu ensuring that it doesn't overlap right edge of site
		activeDropLeftPos = (offset == "-") ? eval(buttonOffsetLeft-dropMenuHorizontalOffset) : eval(buttonOffsetLeft+dropMenuHorizontalOffset);		
		activeDrop.style.left = (activeDropLeftPos > maxDropPos) ? maxDropPos+'px' : activeDropLeftPos+'px';
		activeDrop.style.top = eval(buttonOffsetTop+dropMenuVerticalOffset)+'px';
		activeDrop.style.display='block';
		
		// Reset timer
		resetTimer();
	}


///////////////////////////////////////////////////////////////////////////////

	function hideDrop(buttonID){
		if(buttonID.toLowerCase()=='all'){
			// Hide ALL drops immediately
			// line moved to dropMenuConfig.js ---> // var drops = getElementsByClassName(MM_findObj(dropContainer), "div", dropMenuClass);
			for (i=0; i<drops.length; i++) {
				drops[i].style.display = 'none';
			}
			var headerMenuOptions = document.getElementById(tmoContainer);
			var tmos = headerMenuOptions.getElementsByTagName("a");
			for (var i=0; i<tmos.length; i++) {
				// Set rollover class of menu option (unless it is the active menu option)
				tmos[i].className = (tmos[i].className == activeClass) ? activeClass : baseClass;
			}
		}
		else{
			dropNum = getButtonNum(buttonID);
		  // Hide specified drop after duration: menuHideDelay
			clearTimeout(timerID);
			// If menu item has no drop associated with it,
			//    simply reset menu option color and return from here (unless it is the active menu option)
			if(!(MM_findObj(dropIDprefix+dropNum))){
				MM_findObj(buttonID).className = (MM_findObj(buttonID).className == activeClass) ? activeClass : baseClass;
				return;
		  }
		  // timerID=setTimeout("MM_findObj('"+dropIDprefix+dropNum+"').style.display='none'; MM_findObj('"+buttonID+"').className='"+baseClass+"';",menuHideDelay);
		  timerID=setTimeout("MM_findObj('"+dropIDprefix+dropNum+"').style.display='none'; MM_findObj('"+buttonID+"').className = (MM_findObj('"+buttonID+"').className == '"+activeClass+"') ? '"+activeClass+"' : '"+baseClass+"';",menuHideDelay);
		}
	}

///////////////////////////////////////////////////////////////////////////////

	function lockDrop(dropMenu){
		// parameter "dropMenu" not used at this time
		resetTimer();
	}

///////////////////////////////////////////////////////////////////////////////

function releaseDrop(dropMenu){
		buttonNum = getButtonNum(dropMenu);
		// timerID=setTimeout("MM_findObj('"+dropMenu+"').style.display='none'; MM_findObj('"+tmoIDprefix+buttonNum+"').className='"+baseClass+"';",menuHideDelay);
		timerID=setTimeout("MM_findObj('"+dropMenu+"').style.display='none'; MM_findObj('"+tmoIDprefix+buttonNum+"').className = (MM_findObj('"+tmoIDprefix+buttonNum+"').className == '"+activeClass+"') ? '"+activeClass+"' : '"+baseClass+"';",menuHideDelay);
	}

///////////////////////////////////////////////////////////////////////////////

/*
    Written by Jonathan Snook, http://www.snook.ca/jonathan
    Add-ons by Robert Nyman, http://www.robertnyman.com
*/
function getElementsByClassName(oElm, strTagName, oClassNames){
	var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var arrRegExpClassNames = new Array();
	if(typeof oClassNames == "object"){
		for(var i=0; i<oClassNames.length; i++){
			arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"));
		}
	}
	else{
		arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"));
	}
	var oElement;
	var bMatchesAll;
	for(var j=0; j<arrElements.length; j++){
		oElement = arrElements[j];
		bMatchesAll = true;
		for(var k=0; k<arrRegExpClassNames.length; k++){
			if(!arrRegExpClassNames[k].test(oElement.className)){
				bMatchesAll = false;
				break;
			}

		}
		if(bMatchesAll){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}

///////////////////////////////////////////////////////////////////////////////



			/**************************************************************************************************************
		    Sets the internal value determining whether the Quick Jump menu is locked or not based on the current value
				of the checkbox.
			**************************************************************************************************************/
			function lockQuickMenu(){
				// stickyQuickMenu = (MM_findObj('quickMenuLockStatus').checked == true) ? 1 : 0;
			}

			/**************************************************************************************************************
		    Halt timeout to prevent Quick Jump Menu from auto-hiding while hovered
			**************************************************************************************************************/
			function fixQuickJumpMenu() {
				clearTimeout(qjTimerID);
			}


			/**************************************************************************************************************
		    (Bit of a misnomer as it shows Quick Jump Menu OR calls function to hide it if appropriate)
			  If optionalParam (passed in call from HTML form) is set to 'click', the the user has attempted to close
				the menu by clicking on the button a second time.  In this instance, qjHideDelay is not taken into
				consideration and the menu is closed immediately.

				Commented-out code was used to dynamically position drop menu based on button position.  Position now 
				hard-coded  in CSS but code remains in case the old method needs to be employed for any reason.
			**************************************************************************************************************/
		  function showQuickJumpMenu(optionalParam) {
				/* 
				var buttonXpos = findPosX(MM_findObj('quickJumpButton'));
				var buttonYpos = findPosY(MM_findObj('quickJumpButton'));
				MM_findObj('quickJumpMenu').style.left = buttonXpos;
				MM_findObj('quickJumpMenu').style.top = eval(buttonYpos + 18)+"px";
				*/
				if(MM_findObj('quickJumpMenu').style.display == "block"){
						hideQuickJumpMenu(optionalParam);
				}
				else{
					MM_findObj('quickJumpMenu').style.display = "block";
					//MM_findObj('quickMenuLockStatus').checked = (stickyQuickMenu == 0) ? false : true;
				}
				clearTimeout(qjTimerID);
			}

			/**************************************************************************************************************
		    Hides Quick Jump Menu
			  If optionalParam (passed in call from HTML form) is set to 'click', the the user has attempted to close
				the menu by clicking on the button a second time.  In this instance, qjHideDelay is not taken into
				consideration and the menu is closed immediately.
				If stickyQuickMenu is set to 1, then the menu will not auto-hide onMouseOut.
			**************************************************************************************************************/
			function hideQuickJumpMenu(optionalParam){
				if(optionalParam == 'click'){
					// Clear immediately
					clearTimeout(qjTimerID);
					MM_findObj('quickJumpMenu').style.display='none';
				}
				if(stickyQuickMenu==1){
					return;
				}
				clearTimeout(qjTimerID);
				qjTimerID=setTimeout("MM_findObj('quickJumpMenu').style.display='none'",qjHideDelay);
			}

			/**************************************************************************************************************
		    Used to determine on-screen position of element.  Not used here as Quick Jump Menu position is now
				hard-coded into CSS.
			**************************************************************************************************************/
			function findPosX(obj)
			{
				var curleft = 0;
				if (obj.offsetParent)
				{
					while (obj.offsetParent)
					{
						curleft += obj.offsetLeft
						obj = obj.offsetParent;
					}
				}
				else if (obj.x)
					curleft += obj.x;
				return curleft;
			}
			
			function findPosY(obj)
			{
				var curtop = 0;
				var printstring = '';
				if (obj.offsetParent)
				{
					while (obj.offsetParent)
					{
						printstring += ' element ' + obj.tagName + ' has ' + obj.offsetTop;
						curtop += obj.offsetTop
						obj = obj.offsetParent;
					}
				}
				else if (obj.y)
					curtop += obj.y;
				window.status = printstring;
				return curtop;
			}

///////////////////////////////////////////////////////////////////////////////
