var pageLabel;
var menuLabel;
var menuList = new Array('an', 'cp', 'wl', 'ac', 'rc');
for (var n in menuList) {
	if (document.getElementById(menuList[n]+'Menu')) {
		pageLabel = menuList[n];
	}
}
function showSubMenu(menuLabel) {
	for (var i in menuList) {
		if( menuLabel == menuList[i]) {
			document.getElementById(menuLabel).style.backgroundPosition= window.opera ? '0 -30px !important':'0 -30px';
			document.getElementById(menuLabel+'Sub').style.display= window.opera ? 'block !important':'block';
		} else {
			document.getElementById(menuList[i]).style.backgroundPosition= window.opera ? '0 0 !important':'0 0';
			document.getElementById(menuList[i]+'Sub').style.display= window.opera ? 'none !important':'none';
		}
	}
}
function isChild(node, possibleChild) {
	var tmp = possibleChild;
		while (tmp) {
			if (tmp == node) {
				return true;
			}
			tmp = tmp.parentNode;
		}
		return false;
}
function findTarget(evt) {
	evt = evt || ((window.event) ? event : null);
	var targetEl = evt.relatedTarget || ((evt.toElement) ? evt.toElement : null);
	return targetEl;
} 
document.getElementById('sub').onmouseout = function(evt) {
	if (!isChild(document.getElementById('sub'),findTarget(evt))) {
			showSubMenu(pageLabel);
	}
}
function onMove(evt) {
		if (findTarget(evt).parentNode != document.getElementById('sub')) {
			showSubMenu(pageLabel);
		}
}