/***************************************************************************
 *	General UI functions
 */

function showDiv(name, toggle) {
	element = document.getElementById(name);
	if (!element) {
		alert("showDiv: element \"" + name + "\" not found");
		result = false;
	} else {
		if (toggle == -1)
			hide = (element.style.display == "inline");
		else
			hide = !toggle;

		element.style.display=hide ? "none" : "inline";
		result = !hide;
	}

	return result;
}

/***************************************************************************
 *	Control panel main page functions
 */

function cpClickSection(section) {
	sectionDiv = document.getElementById("section_" + section);
	for (i=0; i<sectionArray.length; i++) {
		if (sectionArray[i] != section) {
			divElement = document.getElementById("section_"+sectionArray[i]);
			if (divElement != null) {
				showDiv("section_" + sectionArray[i], 0);
			}
		}
	}
	showDiv("section_" + section, 1);
}

