// DON'T CHANGE THIS script...it is used across multiple service user interfaces!
// This script is from http://www.wamnet.com/scripts/dropDown.js

// Ident: $Id: dropDown.js 48156 2009-02-25 18:54:43Z rabrahamson $

//theDiv is the id of the element to show/hide
//theArrow (optional) is the id of the a href that has an expand arrow
//theSide ("left" | "right") controls where a nested child dropdown appears relative to its parent

function switchDropdownOn(theDiv, theArrow) {
	try {
		if (document.getElementById(theDiv)) document.getElementById(theDiv).style.display="block";
		if (document.getElementById(theArrow)) document.getElementById(theArrow).className="title expandedLeft";
		if (theDiv == "serviceDropdown") {
			Nifty("span#switchServiceButton","remove 0");
			Nifty("span#switchServiceButton","transparent top");
		}
	} catch (e) {
	}
}

function switchDropdownOff(theDiv, theArrow) {
	try {
		if (theDiv) {
			if (theDiv == "serviceDropdown") {
				Nifty("span#switchServiceButton","remove 0");
				Nifty("span#switchServiceButton","transparent");
			}
			if (document.getElementById(theDiv)) {
				document.getElementById(theDiv).style.display="none";
				if (document.getElementById(theArrow)) {
					document.getElementById(theArrow).className="title expandLeft";
				}
			}
		} else {
			// Do them all!
			switchDropdownOff('serviceDropdown', 'serviceArrow');
			for (var i = 1; i <= 6; i++) {
				switchDropdownOff('menu' + i + 'Dropdown', 'menu' + i + 'Arrow');
			}

			switchDropdownOff('helpDropdown', 'helpArrow');
		}
	} catch (e) {
	}
}

function showExpand(theArrow, theSide) {
	try {
		if (document.getElementById(theArrow)) {
			if(theSide == "left") {
				document.getElementById(theArrow).className="title expandLeft";
			} else {
				document.getElementById(theArrow).className="nestedTitle expandRight";
			}
		}
	} catch (e) {
	}
}

function switchAllOff() {
	switchDropdownOff();
	switchSubMenuOff();
}

function switchSubMenuOn(theDiv, theArrow) {
	try {
		if (document.getElementById(theDiv)) document.getElementById(theDiv).style.display="block";
		if (document.getElementById(theArrow)) document.getElementById(theArrow).className="nestedTitle expandedRight";
	} catch (e) {
	}
}

function switchSubMenuOff(theDiv, theArrow) {
	try {
		if (theDiv) {
			if (document.getElementById(theDiv)) {
				document.getElementById(theDiv).style.display="none";
				if (document.getElementById(theArrow)) document.getElementById(theArrow).className="nestedTitle expandRight";
				return(true);
			} else {
				return(false);
			}
		} else {
			i = 1;
			x = true;
			while (x == true) {
				x = switchSubMenuOff('sub' + i + 'Dropdown', 'sub' + i + 'Arrow');
				i++
			}
		}
	} catch (e) {
		return(false);
	}
}

