// JavaScript Document
var submenuCount=3;
function MoveElementTo(_Target,x,y)
{
	if (_Target.left)
	{
		_Target.left=x+"px";
    	_Target.top=y+"px";
	}
	else
	{
		_Target.style.left=x+"px";
    	_Target.style.top=y+"px";
	}
}

function OnLoad()
{
	var menuID;
	var pmenu;
	for (menuID=1;menuID<=submenuCount;menuID++)
	{
		pmenu=document.getElementById("parentmenu"+menuID);
		if (pmenu!=null)
		{
			pmenu.onmouseover=OpenSubmenu;
		}
	}
}
function HideSubMenu(e)
{
	var tname="DIV";
	if(!e)
	{
		e=window.event;
	}
	if (e)
	{
		if (e.toElement)
		{
			tname=e.toElement.tagName;
		}
		else
		{
			if (e.relatedTarget)
			{
			tname=e.relatedTarget.tagName;
			}
		}
	}
	if (tname=="UL" || tname=="A" || tname=="LI" || tname=="DIV")
	{
		return false;
	}
	this.style.display="none";
	MoveElementTo(this,0,0);
}
function OpenSubmenu(e)
{
	var menuid=null;
	var x=0;
	var y=0;
	if(!e)
	{
		e=window.event;
	}
	if (e.x)
	{
		x=e.x;
		y=e.y;
	}
	else
	{
		x=e.clientX;
		y=e.clientY;
	}

	
	menuid=String(this.id);
			if (menuid==null)
			{
				return;
			}
			menuid=menuid.replace("parentmenu","");
			menuid=Number(menuid);
	for (menuID=1;menuID<=submenuCount;menuID++)
	{
		smenu=document.getElementById("submenu"+menuID);
		if (smenu!=null)
		{
			smenu.style.display="none";
			MoveElementTo(smenu,0,0);
		}
	}
	obj=document.getElementById("submenu"+menuid);
	obj.style.display="block";
	MoveElementTo(obj,x-20,y);
	obj.onmouseout=HideSubMenu;
}

	if (window)
	{
		window.onload=OnLoad;
	}
	else
	{
		document.onload=OnLoad;
	}

