// JavaScript Document
var absbottom=null;
var absright=null;
var bottom=right=0; 
var activeMenu=null;
var openMenuIDs=new Array();

function showMenuOLD()
{
	var caller=event.srcElement;
	
	var re=new RegExp("\\w+\\.\\w{3,4}$","i")
	var url=document.location.href
	var nurl=url.replace(re,"")
	var xmlDoc=loadXMLDoc(nurl + "xml/RolloverDefinitions.xml")
	
	var m=xmlDoc.selectNodes("/RolloverButtons/RolloverButton[@ID='" + caller.id + "']/Menu")
	
	if(m.length==0) return;
	
	var Menu=m[0];
	
	var MenuName=(Menu.getAttribute("Name")!=null)?Menu.getAttribute("Name"):"BaseMenu";
	var menuId=caller.id + "_" + MenuName;

	if(document.getElementById(menuId)!=null) return;
	
	var hls=Menu.selectNodes("HyperLink");
	
	if(hls.length==0) return;
	
	var mnu=document.createElement("div");
	var toID=null;
	
	mnu.style.position='absolute';
	mnu.style.top=findPos(caller).top + caller.offsetHeight + 4;// - 10;
	mnu.style.left=findPos(caller).left;// + 10;
	mnu.style.zIndex=(Menu.getAttribute("Level")+100);
	mnu.style.border="1px solid black";
	mnu.style.clip="rect(0px 0px 0px 0px)"
	mnu.id=menuId;
	
	var tbl=document.createElement("table");
	var tbody=document.createElement("tbody");
	tbl.parentMenuId=mnu.id;
	tbl.style.backgroundColor="gray";
		
	for(i=0;i<hls.length;i++)
	{
		var hl=hls[i];
		var a=document.createElement("a");
		var tr=document.createElement("tr");
		var td=document.createElement("td");
		
		tbody.parentMenuId=mnu.id;
		tr.parentMenuId=mnu.id;
		td.parentMenuId=mnu.id;
		
		a.href=hl.getAttribute("URL");
		a.id=mnu.id + "$" + hl.getAttribute("Name");
		a.innerText=hl.getAttribute("Text");
		a.title=hl.getAttribute("Text");
		a.parentMenuId=mnu.id;
		
		td.appendChild(a);
		tr.appendChild(td);
		tbody.appendChild(tr);		
	}	
	tbl.appendChild(tbody)
	mnu.appendChild(tbl);
	
	document.body.appendChild(mnu)
	openMenuIDs.push(mnu.id);
	
	absbottom=findPos(mnu).top+mnu.offsetHeight+1;
	absright=findPos(mnu).left+mnu.offsetWidth+1;
	var bottom=right=0;
	
	activeMenu=mnu;
	
	window.setInterval(FadeIn,1);	
	
	//toID=window.setTimeout("if(document.getElementById('" + menuId + "')!=null) document.getElementById('" + menuId + "').parentElement.removeChild(document.getElementById('" + menuId + "'))",1000)
	
	mnu.onmouseover=function(){
		//window.clearTimeout(toID);
	}
	mnu.onmouseout=function(){
		var x=event.clientX;
		var y=event.clientY;
		var me=event.srcElement;
		
		if(me==null || me=='undefined') return;
		
		if(me==null || me=='undefined') alert('NULL');
		
		if(me.parentMenuId!=null && document.getElementById(me.parentMenuId)!=null)
		{
			me=document.getElementById(me.parentMenuId);
		}		
		
		if((x>(findPos(me).left-1) && x<(findPos(me).left+me.offsetWidth+1)) && (y>(findPos(me).top-1) && y<(findPos(me).top+me.offsetHeight+1)))
		{
			return;
		}
		
		var menuId=me.id;
		var parent=me.parentElement;	
		
		if(parent==null || parent=='undefined') return;
				
		parent.removeChild(me);
		var idx=indexOfArray(openMenuIDs,menuId);
		
		if(idx==0)
		{
			openMenuIDs.pop();
		}
		else if(idx>0)
		{
			for(i=idx;i<openMenuIDs.length-1;i++)
			{
				openMenuIDs[i]=openMenuIDs[i+1];
			}
			openMenuIDs.pop();
		}
	}
}

function ResetShowMenuVars()
{
	activeMenu=null;
	absbottom=absright=bottom=right=0;
}	

function DestroyMenus()
{
	var obj=event.srcElement;
	for(i=0;i<openMenuIDs.length;i++)
	{
		var str=obj.id+'_';
		if(openMenuIDs[i].indexOf(str)==-1)
		{
			var menu=document.getElementById(openMenuIDs[i]);
			if(menu==null || menu=='undefined') continue;
			
			var container=menu.parentElement;		
			if(container==null || container=='undefined') continue;
			
			if(menu!=null && menu!='undefined')container.removeChild(menu);
			
			for(n=i;n<openMenuIDs.length-1;n++)
			{
				openMenuIDs[n]=openMenuIDs[n+1];
			}
			openMenuIDs.pop();
		}
	}
}

function FadeIn()
{
	if(right>absright && bottom>absbottom)
	{
		window.clearInterval();
		ResetShowMenuVars();
		return;
	}
	
	activeMenu.style.clip="rect(0px " + right + "px " + bottom + "px 0px)";
	
	if(absright>right) right++;
	if(absbottom>bottom) bottom++;
}

function FadeOut()
{
	if(right<0 && bottom<0)
	{
		window.clearInterval();
		ResetShowMenuVars();
		return;
	}
	
	activeMenu.style.clip="rect(0px " + right + "px " + bottom + "px 0px)";
	
	if(right>-1) right--;
	if(bottom>-1) bottom--;
}