var activeMenu = null;

function getDiv( layerName )
{
	if ( document.getElementById ) return document.getElementById( layerName );
	if ( document.all ) return document.all[ layerName ];
	return null;
}

function getOffsetLeft( obj )
{
	var x = 0;
	while ( obj != document.body )
	{
		x += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return x;
}

function getOffsetTop( obj )
{
	var x = 0;
	while ( obj != document.body )
	{
		x += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return x;
}

function showMenu( menuId )
{
	if ( activeMenu != null )
	{
		activeMenu.style.display = "none";
	}
	if ( menuId == null ) return true;
	var div1 = getDiv( "menu1_" + menuId );
	var div2 = getDiv( "menu2_" + menuId );
	if ( div1 == null || div2 == null ) return true;
	div2.style.left = getOffsetLeft( div1 ) + 5;
	div2.style.top = getOffsetTop( div1 ) + 40;
	div2.style.display = "block";
	activeMenu = div2;
	return true;
}

function on( menuId )
{
	var div3 = getDiv( "menu3_" + menuId );
	var a3 = getDiv( "link_" + menuId );
	if ( div3 != null && a3 != null )
	{
		div3.style.backgroundColor = "#ffffff";
		// a3.style.color = "#FFFFFF";
	}
}

function off( menuId )
{
	var div3 = getDiv( "menu3_" + menuId );
	var a3 = getDiv( "link_" + menuId );
	if ( div3 != null && a3 != null )
	{
		div3.style.backgroundColor = "#dcdbcf";
		// a3.style.color = "#005837";
	}
}

