function buttonOver(btnId,subExists) {
	changeButtonStyle(btnId,true);
	if(subExists) {	
		displaySubMenu(btnId,true);
	}
}

function buttonOut(btnId,subExists,lock) {
	if(!(lock>0)) {
		changeButtonStyle(btnId,false);
	}
	if(subExists) {
		displaySubMenu(btnId,false);
	}
}

function subOver(id,parentId,parentURL) {
	changeSubStyle(id,true);
	disableParent(parentId,true,parentURL);
}

function subOut(id,parentId,parentURL) {
	changeSubStyle(id,false);
	disableParent(parentId,false,parentURL);
}

function disableParent(id,disable,parentURL) {
	link = document.getElementById(id);
	
	if(disable) {
		link["onclick"] = null; 
	} else {
		link["onclick"] = new Function("location.href='" + parentURL + "'");
	}
}

function changeButtonStyle(id,over) {
	if(!over) {
		document.getElementById(id).className = "button";
		document.getElementById(id+'arrow').style.display = "none";
	} else {
		document.getElementById(id).className = "button selected";
		document.getElementById(id+'arrow').style.display = "block";
	}
}

function displaySubMenu(id,over) {
	if(!over) {
		document.getElementById(id+'_sub').style.display = "none";
	} else {
		document.getElementById(id+'_sub').style.display = "block";	
	}
}

function changeSubStyle(id, over) {
	if(!over) {
		document.getElementById(id).style.backgroundColor = "#333";
	} else {
		document.getElementById(id).style.backgroundColor = "#bd341e";
	}
}

