var DHTML = (document.getElementById || document.all || document.layers);


function getObj(name)
{
  if (document.getElementById)
  {
	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);
	this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;

	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
			foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) 
		    foundLayer = tmp;
	}
	return foundLayer;
}


function getIdProperty( id, property )
{
	if (!DHTML) return;

	var x = new getObj(id);
	return x.style[property];
}

function setIdProperty( id, property, value )
{
	if (!DHTML) return;

	var x = new getObj(id);
	return x.style[property] = value;
}

function getClassName( id )
{
	if (!DHTML) return;

	var x = new getObj(id);
	return x.obj.className;
}

function showMenu( divNum, openMenuNum )
{
	var numMenus = 3;
	//if 99 is supplied as the div id then callapse all menus
	if (divNum == -1)
	{
		//colapse all of the menus
		for (i = 0; i < numMenus ; i++)
		{
		    if(i != openMenuNum)
			    setIdProperty("menu" + i, "display", "none");
		}	
		return;
	}
	else
	{
		if (getIdProperty( "menu" + divNum, "display") != "block" )
		{
			//expand the menu
			setIdProperty("menu" + divNum, "display", "block");

			//colapse the rest of the menus
			for (i = 0; i < numMenus; i++)
			{
				if (divNum != i)
				{
				    if(i != openMenuNum)
					    setIdProperty("menu" + i, "display", "none");
				}
			}
		}
	}
}
