//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 {
		switchAllOff();
		document.getElementById(theDiv).style.display="block";
		if (theArrow) {
			document.getElementById(theArrow).className="title expandedLeft";
		}
	} catch (e) {
	}
}

function switchDropdownOff(theDiv, theArrow) {
	try {
		if (theDiv) {
			document.getElementById(theDiv).style.display="none";
			if (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');
			}
		}
	} catch (e) {
	}
}

function showExpand(theArrow, theSide) {
	try {
		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 {
		document.getElementById(theDiv).style.display="block";
		if (theArrow) {
			document.getElementById(theArrow).className="nestedTitle expandedRight";
		}
	} catch (e) {
	}
}

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

