// hack for ie - mozilla doesn't need this
ActivateDropdownMenu = function() {
	if (document.all&&document.getElementById) {
	
		// Scan through the unordered list for li's containing ul's.
		var navRoot = document.getElementById("Nav");
		Item = new Array(navRoot);
		
		// Find all the childrend of the navRoot.
		for(i=0; i < Item.length; i++) {
			for(j=0; j < Item[i].childNodes.length; j++) {
				
				// If the child is an unordered list and the parent is a list item...
				if(Item[i].nodeName == 'LI' && Item[i].childNodes[j].nodeName == 'UL') {
					
					if(i <= navRoot.childNodes.length) { // create first level dropdowns
						Item[i].onmouseover=function() {
							// Make the menu appear
							this.className+=" over";
							// Hide any dropdown menus
							FlipFormVisibility(0);
						}
						Item[i].onmouseout=function() {
							// Make the menu disappear
							this.className=this.className.replace(" over", "");
							// Unhide any dropdown menus
							FlipFormVisibility(1);
						}
					
					} else { // or sub level dropdowns
						Item[i].onmouseover=function() {
							// Make the menu appear
							this.className+=" subover";
							// Hide any dropdown menus
							FlipFormVisibility(0);
						}
						Item[i].onmouseout=function() {
							// Make the menu disappear
							this.className=this.className.replace(" subover", "");
							// Unhide any dropdown menus
							FlipFormVisibility(1);
						}
					}
				}// end if
				
				// Add the child to the list of children to investigate if it's a list element.
				if(Item[i].childNodes[j].nodeName == 'LI' || Item[i].childNodes[j].nodeName == 'UL') {
					Item.push(Item[i].childNodes[j]);
				}
				
			} // end for j
		} // end for i
	} 
}

/* ----------------------------------------------------------------------
FlipFormVisibility
This function hides and unhides SELECT form items so that the menu will 
appear properly.  We store the form fields in an array so we don't have 
to scan the whole file every time the function is called.
*/
var FormFields = null;
var LastVisibilitySwitch = 1;

function FlipFormVisibility(visible) {

	// Return if we are not changing from the previous state
	if(LastVisibilitySwitch == visible) { return; }
	else { LastVisibilitySwitch = visible; }
	
	// If we haven't gotten the form fields yet do so.
	if(FormFields == null) {
		FormFields = new Array();
		
		if(document.forms) {
			// Get all the form objects into an array.
			Item = new Array();
			for(i=0; i < document.forms.length; i++) {
				Item.push(document.forms[i]);
			}
			// Find all the childNodes of the form objects.
			for(i=0; i < Item.length; i++) {
				for(j=0; j < Item[i].childNodes.length; j++) {
					Item.push(Item[i].childNodes[j]);
				}
				// If the childNode is a SELECT field, store it.
				if(Item[i].nodeName == 'SELECT') {
					FormFields.push(Item[i]);
				}	
			}
		}	
	}
	
	// Flip all the form fields
	for(i=0; i < FormFields.length; i++) {
		FormFields[i].style.visibility = (visible ? 'visible' : 'hidden');
	}
}

// Run the function on load for IE:
if(document.all && document.getElementById) { window.onload = ActivateDropdownMenu; }
