var numMenus = 4;

function getStyleObject(objectId) {
// cross-browser function to get an object's style object given its id
if(document.getElementById && document.getElementById(objectId)) { return document.getElementById(objectId).style; } else if (document.all && document.all(objectId)) {	return document.all(objectId).style; }
else if (document.layers && document.layers[objectId]) { return document.layers[objectId]; } else { return false;}
}

function changeObjectVisibility(objectId, newVisibility) {
// get a reference to the cross-browser style object and make sure the object exists
var styleObject = getStyleObject(objectId);
if(styleObject) { styleObject.visibility = newVisibility; return true; } else { return false; }
}

function moveObject(objectId, newXCoordinate, newYCoordinate) {
// get a reference to the cross-browser style object and make sure the object exists
var styleObject = getStyleObject(objectId);
if(styleObject) {	styleObject.left = newXCoordinate;	styleObject.top = newYCoordinate; return true; } else { return false; }
}

function showMenu(menuNumber, eventObj) {
    //    alert(eventObj);
    hideAllMenus();
    var menuId = 'dhtml' + menuNumber;
    if(changeObjectVisibility(menuId, 'visible')) {
	var dhtmlTitle = getStyleObject('dhtmlTitle' + menuNumber);
	dhtmlTitle.backgroundColor = '';
	dhtmlTitle.color= '#F2D400';
	eventObj.cancelBubble = true;
	return true;
    } else {
	return false;
    }
}

function hideAllMenus() {
  for(counter = 1; counter <= numMenus; counter++) {
	changeObjectVisibility('dhtml' + counter, 'hidden');
	var dhtmlTitle = getStyleObject('dhtmlTitle' + counter);
	dhtmlTitle.backgroundColor = '';
	dhtmlTitle.color= '#FFFFFF';
  }
}