var skipOver = false;
var whichPulldownBody = 'pulldownBody_product';
var searchable = false;


	// SHOWS OR HIDES THE MAIN MENU
	function showHide(thisObj) {
	// fix for cms weirdness
	if (client.engine == 'msie') {
		thisObj.setAttribute('onmouseout', function () { var perform = 'nofunction'; });            //thisObj.setAttribute('onmouseout', function () { killMenuTimer(this) });
		thisObj.parentNode.setAttribute('onmouseout', function() { var perform = 'nofunction'; } ); //thisObj.parentNode.setAttribute('onmouseout', function() { killMenuTimer(getChildNodes(this)[0]) } );
	} else if (client.engine == 'gecko') {
		thisObj.setAttribute('onmouseout', 'var perform = "nofunction";');                          //thisObj.setAttribute('onmouseout', 'killMenuTimer(this)');
		thisObj.parentNode.setAttribute('onmouseout', 'var perform = "nofunction";');               //thisObj.parentNode.setAttribute('onmouseout', 'killMenuTimer(getChildNodes(this)[0])');
	} else if (client.engine == 'webkit') {
		thisObj.onmouseout = function() { var perform = 'nofunction'; }                             //thisObj.onmouseout = function() { killMenuTimer(thisObj); }
		getChildNodes(thisObj.parentNode)[1].onmouseout = function() { var perform = 'nofunction'; }//getChildNodes(thisObj.parentNode)[1].onmouseout = function() { killMenuTimer(thisObj); }
	}
	// get one with the regular stuff
		var pulldown        = getChildNodes(thisObj.parentNode)[1];
		var pullDownSibling = getChildNodes(thisObj.parentNode)[0];
		var inHeader        = false;
		var currentObj      = thisObj;
		var allLinks = pulldown.getElementsByTagName('a');
		for (var loop = 0; loop < allLinks.length; loop++) {
			 	var thisLink = allLinks[loop];
					thisLink.setAttribute('onmouseover', 'skipOver = clearTimeout(skipOver); skipOver = false;');
					thisLink.onmouseover = function() { clearTimeout(skipOver); skipOver = false;  }
		}
		while (currentObj.nodeName.toLowerCase() != 'body') {
			if (currentObj.className == 'header') {
				var inHeader = true; break;
			}
			currentObj = currentObj.parentNode; 
		}
		if (pulldown && pulldown.style.display == 'block') {
			pulldown.style.display = 'none';
			if (inHeader) {
				pullDownSibling.style.background = 'url(http://www.sixflags.com/national/global/assets/images/btn/btn_corp_dropdown.gif) no-repeat';
				pullDownSibling.style.width = '230px';
			}
		} else if (pulldown && pulldown.style.display == 'block') {
			pulldown.style.display = 'block';
			if (inHeader) {
				pullDownSibling.style.background = 'url(http://www.sixflags.com/national/global/assets/images/btn/btn_corp_dropdown_ov.gif) no-repeat';
				pullDownSibling.style.width = '422px';
			}
		} else {
			pulldown.style.display = 'block';
			if (inHeader) {
				pullDownSibling.style.background = 'url(http://www.sixflags.com/national/global/assets/images/btn/btn_corp_dropdown_ov.gif) no-repeat';
				pullDownSibling.style.width = '422px';
			}
		}
	}


	// THIS SETS THE MENU TIMER THAT HIDES THE ARTIFICIAL FORM SELECT ELEMENTS, IT GETS CALLED ONMOUSEOUT IN A BUNCH OF PLACES.
	// IT GETS CLEARED OUT BY MOST MOUSEOVER EVENTS.
	function killMenuTimer(thisObj) {
		if (thisObj) {
			var root = this;
				root.pulldown        = getChildNodes(thisObj.parentNode)[1];
				root.pulldownSibling = getChildNodes(thisObj.parentNode)[0];
			if (arguments.length) {
				var chickens = function() {
					var inHeader         = false;
					var currentObj       = thisObj
					while (currentObj.nodeName.toLowerCase() != 'body') {
						if (currentObj.className == 'header') {
							var inHeader = true; break;
						}
						currentObj = currentObj.parentNode; 
					}
					if (inHeader) {
						root.pulldownSibling.style.background = 'url(http://www.sixflags.com/national/global/assets/images/btn/btn_corp_dropdown.gif) no-repeat';
						root.pulldownSibling.style.width = '230px';
					}
					root.pulldown.style.display = 'none';
				}
				skipOver = setTimeout(chickens, 150);
			}
		}
	}


	// MULTI-PURPOSE DIV-SWITCHING FUNCTION
	function contentDivFamilySwitch(divFamily, divToActivate) {
		//// SHOW/HIDE DIVS
		for (var loop = 0; loop < document.getElementsByTagName('div').length; loop++) {
   		var divIdName = eval("document.getElementsByTagName('div')[" + loop + "].id");
			if (divIdName.indexOf(divFamily) == 0) {
				if (divIdName ==  divFamily + divToActivate) {
					document.getElementById(divIdName).style.display = 'block';
				} else {
					document.getElementById(divIdName).style.display = 'none';
				}
			}
		}
	}


	function doNothing() {
		var bootsy = 'collins';
	}


	function trkPldwn(thisObj) {
		var parentObj = thisObj.parentNode.parentNode.parentNode.parentNode
		if (parentObj.getAttribute('pos')) {
			var lpos    = hbxStrip(parentObj.getAttribute('pos'));
			var link    = hbxStrip(thisObj.innerHTML.split(' ').join('+').split(',').join(''));
			try { _hbLink(link, lpos) } catch (e) {  }
		}
	}


	function hbxStrip(a) {
	  a = a.split("|").join("");
	  a = a.split("/").join("");
	  a = a.split("\\").join("");
	  a = a.split("!").join("");
	  a = a.split("&").join("");
	  a = a.split("'").join("");
	  a = a.split("#").join("");
	  a = a.split("$").join("");
	  a = a.split("%").join("");
	  a = a.split("^").join("");
	  a = a.split("*").join("");
	  a = a.split(":").join("");
	  a = a.split("~").join("");
	  a = a.split(";").join("");
	  a = a.split(">").join("");
	  a = a.split("<").join("");
	  a = a.split(" ").join("+");
	  return a;
	}


	// returns childNodes array, minus the textNodes
		function getChildNodes(thisObj) {
			var elementsArray = new Array();
			for (var loop = 0; loop < thisObj.childNodes.length; loop++) {
				if (thisObj.childNodes[loop].nodeType == 1) {
					elementsArray[elementsArray.length++] = thisObj.childNodes[loop];
				}
			}
			return elementsArray;
		}


	// returns a related element, up or down the dom.
	// nodesNum is an integer, tells us how far up or down to go
	// updown is string. up or dn. tells us to get parentNodes or childNodes
	// if upDown == up, then step up nodesNum (number) of parentNodes
	// if upDown == dn, then get childnode[nodesNum] of thisObj.
		function getRelatedObj(thisObj, upDown, nodesNum) {
			nodesNum = parseInt(nodesNum);
			if (upDown == 'up') {
			// moving up DOM through parentNodes
				var getParentStr = '.parentNode';
				var getFinalObj = '';
				for (loop = 0; loop <= nodesNum; loop++) { getFinalObj = getFinalObj + getParentStr; }
				var targetElement = eval('thisObj' + getFinalObj);
			} else {
			// moving down DOM through childNodes
				var targetElement = getChildNodes(thisObj)[nodesNum];
			}
		return targetElement;
		}


	// returns childNode index value for an object for its parent
	// eg: I am childNodes[x] of thisObj.parentNode.
		function getObjIndex(thisObj) {
			var thisIndex = false;
			var parentObj = thisObj.parentNode;
			var parentChildrenArr = getChildNodes(parentObj);
			for (var loop = 0; loop < parentChildrenArr.length; loop++) { if (thisObj == parentChildrenArr[loop]) { thisIndex = loop; } }
			return thisIndex;
		}