// custom dropdown menu controller
menu = new Object();
menu.current = null;
menu.canceleventprop = false;
menu.open = function( o )
{
	this.close();
	if( !o ) return;
	if( typeof o == "string" ) {
		usMenuId = o;
		o = document.getElementById( o );
	}
	if( !o ) return;
	
	o.scrollTop = 0;
	o.style.visibility = "visible";
	this.current = o;
}
menu.close = function()
{
	if( !menu.current ) return;
	menu.current.style.visibility = "hidden";
	menu.current = null;
}
menu.activaterow = function( row )
{
	row.className = "activerow";
	row.style.cursor = "hand";
}
menu.deactivaterow = function( row )
{
	row.className = "menuitem";
	row.style.cursor = "default";
}
	
document.onclick = function()
{
	if( !menu.canceleventprop )menu.close();
	menu.canceleventprop = false;
}

function RelPosMenu(refID,menuID) {
	if (!document.getElementById(refID) || !document.getElementById(menuID)) return;
	document.getElementById(menuID).style.left=findPosX(document.getElementById(refID))+'px';
	document.getElementById(menuID).style.top=(findPosY(document.getElementById(refID))+22)+'px';
}

