﻿function changeMenuElementBGtoHover(obj) {
	obj.style.backgroundPosition = '0';
}

function changeBackMenuElementFromBGhover (obj) {
	obj.style.backgroundPosition = '0 65px';
}

function showSubMenu(submenu) {
	//first show the top parent submenu_wrapper
	document.getElementById("submenu_wrapper").style.display = 'block';
	submenu.style.display = 'block';
}

function hideSubMenu(submenu) {
	//first hide the top parent submenu_wrapper
	document.getElementById("submenu_wrapper").style.display = 'none';
	submenu.style.display = 'none';
}

function enableMenuElementWithObjAndSubMenuIndex(obj, index) {
	changeMenuElementBGtoHover(obj);
	var submenu = document.getElementById("submenuAtIndex_" + index);
	showSubMenu(submenu);
}

function disableMenuElementWithObjAndSubMenuIndex(obj, index) {
	changeBackMenuElementFromBGhover(obj);
	var submenu = document.getElementById("submenuAtIndex_" + index);
	hideSubMenu(submenu);	
}