var xmlHttp

// Detect IE browser
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Define what function gets the onclick event
document.onmousemove = getMouseXY;

var tempX = 0
var tempY = 0

function getMouseXY(e) 
{
	if (IE) 
	{ // grab the x-y pos.s if browser is IE
		tempX = event.clientX + document.documentElement.scrollLeft - 390
		tempY = event.clientY + document.documentElement.scrollTop - 200
	} 
	else 
	{  // grab the x-y pos.s if browser is NS
		tempX = e.pageX - 350
		tempY = e.pageY - 180
	}  
	//catch possible negative values in NS4
	if (tempX < 0){tempX = 0}
	if (tempY < 0){tempY = 0}  

	return true
}

function showmenu(strElementID)
{
	getMouseXY;
	
	document.getElementById('ProductList').style.visibility='visible';
	document.getElementById("ProductList").innerHTML = 'Loading Product List'
	document.getElementById('ProductList').style.width = '370px';
	document.getElementById('ProductList').style.height = '500px';
	document.getElementById('ProductList').style.border = 'thin dotted';
	document.getElementById('ProductList').style.padding = '10px';
	document.getElementById('ProductList').style.left= tempX + 'px'; //(document.body.clientWidth/2) - (document.getElementById('ProductList').offsetWidth/2);
	document.getElementById('ProductList').style.top= tempY + 'px'; //(document.body.clientHeight/2) - (document.getElementById('ProductList').offsetHeight/2);

	show(strElementID);
}

function hidemenu()
{
	document.getElementById('ProductList').style.visibility='hidden';
}


function show(strElementID)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		// alert ("Browser does not support HTTP Request")
		alert ("Your browser does not support this feature, please call for details.")
		return
	} 
	var url="/Code/Ajax/BuildMenu.aspx"
	url=url+"?strElementID="+strElementID
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("ProductList").innerHTML=xmlHttp.responseText 
	} 
} 

function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}

function toggleVisibility(me){
	if (me.style.visibility=="hidden")
	{
		me.style.visibility="visible";
	}
	else 
	{
		me.style.visibility="hidden";
	}
}
