activemenu = 0;

function sm(menu,submenu) {
	activemenu = 0;
	men2 = 0;
	hideall();
	swap("nimg"+menu);
	activemenu = document.getElementById("subm"+menu);
	if (activemenu) {
		activemenu.style.display = "block";
	}
	if (submenu!== "") {
		men2 = document.getElementById("subm"+submenu);
	}
	if (men2) {
		men2.style.display = 'block';
	}
}
function hideall() {
	if (activemenu == 0) {
		divs = document.getElementsByTagName("div");
		for (i = 0; i < divs.length; i++) {
			mydiv = divs[i];
			if (mydiv.id.substr(0,4) == "subm") {
				mydiv.style.display = "none";
			}
		}
		imgs = document.getElementsByTagName("img");
		for (i = 0; i < imgs.length; i++) {
			myimg = imgs[i];
			if (myimg.id.substr(0,4) == "nimg") {
				swapback(myimg.id);
			}
		}
	}
}
function hidenav() {
	timerID = setTimeout("hideall();", 1000);
}

function hm() {
	activemenu = 0;
	hidenav();
}

function swap(what) {
	img = document.getElementById(what);
	handPointer(img);
	name = img.src.substr(0,img.src.length-6)+"_r.gif"
	if (img.src != name) {
		img.src = img.src.substr(0,img.src.length-4)+"_r.gif";
	}

}

function swapback(what) {
	img = document.getElementById(what);
	name = img.src.substr(0,img.src.length-6)+"_r.gif"
	if (img.src == name) {
		img.src = img.src.substr(0,img.src.length-6)+".gif";
	}
}


function movr(what,submenu) {
	handPointer(submenu);
	submenu.style.backgroundColor = "#858585";
	par = submenu.parentNode;
	swap("nimg"+what);
	par.style.display = 'block';
	activemenu = par;
}

function mout(what) {
	what.style.backgroundColor = "#9B9B9B";
	par = what.parentNode;
	activemenu = 0;
	hidenav();
}

function handPointer(src) {
	if (navigator.appName.indexOf("Internet Explorer") == -1) {
		src.style.cursor = "pointer";
	} else {
		src.style.cursor = "hand";
	}
}


