var _currentMenuNavBarSelected = null;
var _sliding = false;

function moveMenuNavBarSelected(menuNavBarId) {
	if (_sliding) {
		setTimeout(function() { moveMenuNavBarSelected(menuNavBarId); }, 100);
		return;
	}
	_sliding = true;

	var menuNavBarSelected = document.getElementById("menuNavBarSelected");
	if (_currentMenuNavBarSelected) { document.getElementById(_currentMenuNavBarSelected).className = "menuNavBar"; }
	document.getElementById(menuNavBarId).className = "menuNavBarSelected";
	_currentMenuNavBarSelected = menuNavBarId;
	_sliding = false;
}

function moveOutMenuNavBarSelected(menuNavBarId, defaultMenuNavBarId) {
	if (_sliding) {
		return;
	}
	if (menuNavBarId == _currentMenuNavBarSelected) {
		moveMenuNavBarSelected(defaultMenuNavBarId);
	}
}

function getAbsolutePosition(element) {
	var r = { x: 0, y: 0 };
	if (element.offsetParent) {
		do {
			r.x += element.offsetLeft;
			r.y += element.offsetTop;
		} while (element = element.offsetParent);
	}
	if (navigator.appName == "Netscape" || (navigator.vendor && navigator.vendor.indexOf("Apple") > -1)) { 
		r.x += 7; // hack
	}
	
	return r;
};
