//
// COPYRIGHT (C) 2008 AUSTIN DIGITAL, INC
// CONFIDENTIAL AND PROPRIETARY. NOT FOR REUSE, PUBLIC CONSUMPTION,
// OR REALLY ANY KIND OF CONSUMPTION (JAVASCRIPT HAS BEEN SHOWN BY THE
// SURGEON GENERAL TO CAUSE INDIGESTION IN SENSITIVE INDIVIDUALS).
//

function menu_replIfStartsWith(s, sw, rpl) {
	if (s.substr(0, sw.length) == sw)
		return rpl + s.substr(sw.length);
	else
		return null;
}

function menu_toggleSubMenu(name) {
	// Look up the sub-menu.
	var submenu = document.getElementById(name);
	
	// Switch its class. For IE we have to deal with the "composite" class.
	var t = menu_replIfStartsWith(submenu.className, "menu-with-children-open", "menu-with-children");
	if (t)
		submenu.className = t;
	else {
		t = menu_replIfStartsWith(submenu.className, "menu-with-children", "menu-with-children-open");
		if (t)
			submenu.className = t;
	}
}

