NAV_HIDE_DELAY = 100; // wait to hide navigation (ms)

navTimeout = null;
currentNav = "";

function showNav(navName) {
	if (pageLoaded && !document.layers) {
		resetDelayedHide();

		if (currentNav != "") {
			hideAllNav();
		}
		showLayer("hideDhtml");
		showLayer(navName + "Subnav");
		currentNav = navName;
	}
}

function showNav2(navName) {
	if (pageLoaded && !document.layers) {
		showLayer(navName + "Subnav");
	}
}

function resetDelayedHide() {
	if (pageLoaded && navTimeout != null && !document.layers) {
		clearTimeout(navTimeout);
		navTimeout = null;
	}
}

function delayedNavHide() {
	if (pageLoaded && currentNav != "" && navTimeout == null && !document.layers) {
		hideLayer("hideDhtml");
		navTimeout = setTimeout("hideAllNav()", NAV_HIDE_DELAY);
	}
}

function hideAllNav() {
	if (pageLoaded && currentNav != "" && !document.layers) {
	 	hideLayer(currentNav + "Subnav");
		currentNav = "";
		navTimeout = null;
	}
}

function swapStyle(element, className) {
	if (pageLoaded && !document.layers) {
		element.className = className;
	}
}

function showLayer(layerId) {
	if (pageLoaded && !document.layers) {
		document.getElementById(layerId).style.visibility = "visible";
	}
}

function hideLayer(layerId) {
	if (pageLoaded && !document.layers) {
		document.getElementById(layerId).style.visibility = "hidden";
	}
}

// Uses the arguments[] array to get the ID's of each layer to hide.
function hideDropdowns() {
    if (pageLoaded && !document.layers) {
        for (var i = 0; i < arguments.length; i++) {
            document.getElementById(arguments[i]).style.visibility = "hidden";
        }
    }
}

pageLoaded = 0;				// Prevent access to layers until they're loaded
currentsubnav = "empty";	// Track the currently displayed subnav layer
defaultsubnav = null;		// Contains the value of the layer that is default (section)

var pageType = "home";

navTimer = null;			// Contains pointer to the "hide delay" timer

// Set the pageLoaded variable to denote that the layers are ready to be used
function doLoadProc() {
	pageLoaded = 1;
	if (defaultsubnav == null) {
		defaultsubnav = "empty";
	}
}

