var section = -1;
var menuCount = 4;
var timer = null;

function init() {
	showMenu(section);
	subnav(section, subsection, true);
}

function showMenu(index) {
	menuPersist();
	for (x = 1; x <= menuCount; x++) {
		document.getElementById("subnav" + x).style.display = (x == index) ? "block" : "none";
		document.getElementById("nav" + x).src = document.getElementById("nav" + x).src.split("_on.gif").join("").split(".gif").join("") + ((x == index) ? "_on.gif" : ".gif");
	}
}

function hideMenus() {
	timer = setTimeout("showMenu(section)", 1250);
}

function menuPersist() {
	clearTimeout(timer);
}

function subnav(sec, subsec, on) {
	menuPersist();
	element = document.getElementById("subnav" + sec + "_" + subsec);
	if (element)
		element.src = element.src.split("_on.gif").join("").split(".gif").join("") + ((on || (sec==section && subsec == subsection)) ? "_on.gif" : ".gif");
	if (!on) hideMenus();
}

function rollover(id, isOn) {
	var image = document.getElementById(id);
	image.src = image.src.split("_on.gif").join("").split(".gif").join("") + ((isOn) ? "_on.gif" : ".gif");
}
