// JavaScript Document

var oHoverDiv;
var oHoverImg;
mouseLocation = new Point(-500,-500);

function Point(x,y) {  this.x = x; this.y = y; }


/* 
Example:
function test()
{
  if (document.layers) getMouseLoc;     //NS
  else if (document.all) getMouseLoc(); //IE
  alert(mouseLocation.x+","+mouseLocation.y);
}
in the BODY:
<a href="#" onmouseover="test()">test</a>
*/


function checkDiv() {
	if(!oHoverDiv) {
		oHoverDiv=document.createElement("div");
		oHoverDiv.setAttribute("id","HoverDiv");
		oHoverDiv.style.display="none";
		oHoverDiv.style.position="absolute";
		oHoverDiv.style.width="";
		oHoverDiv.style.height="";
		//oHoverDiv.style.border="solid 1px black";
		oHoverDiv.style.zIndex=100;
		oHoverDiv.style.backgroundColor="#E0E0E0";
		oHoverImg=document.createElement("img");
		oHoverImg.style.width="";
		oHoverImg.style.height="";
		oHoverImg.style.border="dotted 2px black";
		oHoverImg.style.top="20px";
		oHoverImg.style.left="20px";
		oHoverDiv.appendChild(oHoverImg);
		document.body.insertBefore(oHoverDiv,document.getElementById("divFooter"));
	}
}
function registerHoverElement(oElementID,sImage) {
	var oElement=document.getElementById(oElementID);
	if(!oElement) return null;
	oElement.onmouseover=function(e) {
		checkDiv();
		if(!e) e=window.event;
		if(!document.all)  //NS
		{
			mouseLocation.x = e.pageX;
			mouseLocation.y = e.pageY;
		}
		else               //IE
		{
			mouseLocation.x = event.x + document.body.scrollLeft;
			mouseLocation.y = event.y + document.body.scrollTop;
		}
		
		oHoverDiv.style.top=mouseLocation.y -150;
		if(mouseLocation.x>600) oHoverDiv.style.left=mouseLocation.x-320
		else oHoverDiv.style.left=mouseLocation.x+20;
		oHoverDiv.style.display="block";
		oHoverImg.src=sImage;
	}
	oElement.onmouseout=function(e) {
		oHoverDiv.style.display="none";
		oHoverImg.src="/db2/images/spaceer.gif";
	}
	oElement.onmousemove=function(e) {
		checkDiv();
		if(!e) e=window.event;
		if(!document.all)  //NS
		{
			mouseLocation.x = e.pageX;
			mouseLocation.y = e.pageY;
		}
		else               //IE
		{
			mouseLocation.x = event.x + document.body.scrollLeft;
			mouseLocation.y = event.y + document.body.scrollTop;
		}
		oHoverDiv.style.top=mouseLocation.y -150;
		if(mouseLocation.x>600) oHoverDiv.style.left=mouseLocation.x-320
		else oHoverDiv.style.left=mouseLocation.x+20;
	}
}
