// FUNCTION for persistent hover
				startList = function() {
					for (navCount=1; navCount<=1; navCount++) {
						if (document.all&&document.getElementById) {
							navRoot = document.getElementById("nav"+navCount);
							for (i=0; i<navRoot.childNodes.length; i++) {
								node = navRoot.childNodes[i];
								if (node.nodeName=="LI") {
									node.onmouseover=function() {
										this.className+=" over";
									}
									node.onmouseout=function() {
										this.className=this.className.replace(" over", "");
									}
								}
							}
						}
					}
				}
				window.onload=startList;

//FUNCTIONS for primary hover
function dropdownOver(dropdown) {

	// Kick off the mousemove event tracker to help Firefox with mouseout menu collapse
	if(is_fx || is_nav7up) { eventSetup('mousemove'); }

	// handle dropdown for later browsers only
	if (is_ie5up || is_nav7up || is_fx) {

		if (!isEmpty(dropdown)) {
			// the div
			var title = getFirstElementByTagName(dropdown, 'DIV');	

			if (!isEmpty(title)) {
				title.className = 'DropdownTitleOver';
			}

			// the li
			var sub = getFirstElementByTagName(dropdown, 'UL');
			if (!isEmpty(sub)) {
				sub.style.display = 'block';
			}	
		}		

	}

}

function dropdownOut(dropdown) {

	// handle dropdown for later browsers only
	if (is_ie5up || is_nav7up || is_fx) {

		if (!isEmpty(dropdown)) {
			
			var sub = null;
			var title = null;

			if (dropdown.tagName == 'UL') {
				if (dropdown.className != 'Main') {
					sub = dropdown;

					var parentUl = getParentOfTagName(sub, 'UL');
					if (xDef(parentUl)) {
						title = getFirstElementByTagName(dropdown, 'DIV');	
					}
				}
			}
			else {
				sub = getFirstElementByTagName(dropdown, 'UL');
				title = getFirstElementByTagName(dropdown, 'DIV');	
			}

			// the div
			if (!isEmpty(title)) {
				title.className = 'DropdownTitle';
			}

			if (!isEmpty(sub)) {
				sub.style.display = 'none';
			}

		}		
	}

}

// Function called for Firefox mousemove events, with second Firefox browser detection
function eventSetup() {

	if(is_fx || is_nav7up) {
		var args = eventSetup.arguments;
		document.addEventListener(args[0],eventManager,false);
	}

}

function eventManager(e) {
	var target  = e.target;
	var menu = getParentOfTagAndClass(target, 'UL','Main');
	if (menu != null)
	{
		// check if current menu = this menu
		// if current menu != menu - hide current menu
		// set the current menu = menu
			menuCurrent = getParentOfTagAndClass(target, 'UL','Main');
	}
	else {
		// find and hide the current menu, just like its done in the 'normal' mouseout event
		sub = getFirstElementByTagName(menuCurrent, 'UL');
		title = getFirstElementByTagName(menuCurrent, 'DIV');
		title.className = 'DropdownTitle';
		sub.style.display = 'none';
		// Easy way to watch event tracking:
			//document.getElementById('searchBox').value = target;
	}
}

// For FX mousemove functions: if an element has been defined, return true, otherwise false
function xDef() {
	for(var i=0; i<arguments.length; ++i) {
		if(typeof(arguments[i])=='undefined')  {
			return false;
		}
	}
	return true;
}

// For FX mousemove functions: go up the document tree until you file a parent with the tag name and class name specified
function getParentOfTagAndClass(e, tag, clazz) {
	var elt = null;
	if (xDef(e)) {
		elt = e;
		while (elt != null && (elt.className != clazz || elt.tagName != tag)) {
			// cross browser way of getting parent
			if (xDef(elt.parentNode)) { elt = elt.parentNode; }
			else if (xDef(elt.parentElement)) { elt = elt.parentElement; }
		}
	}
	return elt;
}


function isEmpty(node) {

	if (node == null) {
		return true;
	}
	else if (typeof node == "undefined") {
		return true;
	}
	else {
	return false;
	}

}

function getFirstElementByTagName(node, name) {
	
	var found = null;

	if (!isEmpty(node)) {
		var nodes = null;
		
		if (is_ie4) {
			var aNodes = new Array();

			for (var i=0; i<node.children.length; i++) {
				var child = node.children[i];

				if (!isEmpty(child)) {
					if (child.tagName == name) {
						aNodes[aNodes.length] = child;
					}
				}
			}

			nodes = aNodes;
		}
		else {
			nodes = node.getElementsByTagName(name);
		}

		if (nodes != null) {
			if (nodes.length > 0) {
				found = nodes[0];
			}
		}
	}

	return found;
}

function getParentOfTagName(e, tag) {

	e = xParent(e);
	
	while (e != null) {
		if (e.tagName == tag) {
			return e;
		}		

		e = xParent(e);
	}

	return null;
	
}

function xParent(e,bNode){
  if (!(e=xGetElementById(e))) return null;
  var p=null;
  if (!bNode && xDef(e.offsetParent)) p=e.offsetParent;
  else if (xDef(e.parentNode)) p=e.parentNode;
  else if (xDef(e.parentElement)) p=e.parentElement;
  return p;
}

function xDef() {
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
  return true;
}

