var HEIGHT = 32;
var WIDTH = 110;
var LEFT = 16;


var oldMenu = null;

/**
* shows the given menu on screen and hides all other,
* possibly currently visible menus
*/
function showMenu(menuid, menu, num)	{
	if (!document.getElementById) return;

	var id = document.getElementById(menuid);
  if (oldMenu!=id || id.style.visibilty != "visible") {
  	hideMenu();
	  /*id.style.left = (LEFT + (num-1) * WIDTH) + 'px';*/
	  id.style.visibility = "visible";
	  oldMenu = id;
  }
}

function countMenuItems(id) {
	var count = 0;
	for(var i=0; i<id.childNodes.length; ++i) {
		//alert(id.childNodes[i].tagName);
		if (id.childNodes[i].tagName) {
			if (id.childNodes[i].tagName.toLowerCase() == 'a') {
				count++;
			}
		}
	}
	return count;	
}

function getMenuHeight(id) {
	var h = 0;
	for(var i=0; i<id.childNodes.length; ++i) {
		if (id.childNodes[i].tagName) {
			if (id.childNodes[i].tagName.toLowerCase() == 'div') {
				//alert(id.childNodes[i].style.height);
				h += id.childNodes[i].style.height;
			}
		}
	}
	return h;	
}

function hideMenu()	{
	if (!document.getElementById) return;

	if (oldMenu) {
		oldMenu.style.visibility = 'hidden';
	}
}