// JavaScript Document

var ua = navigator.userAgent.toLowerCase();
var divw=0;
var divh=0;

document.onmousemove=followmouse;

function truebody()
	{
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}

function ShowPopupImage(imagePath)
{
	var popupObj = document.getElementById("PopupImage");
	popupObj.innerHTML = "<table cellpadding=9 cellspacing=0 border=0 bgcolor=#b4b5b8><tr><td><img style='border: 1px solid #808080' src=\"" + imagePath + "\" /></td></tr></table>";
	popupObj.style.display = "block";	
	divw = popupObj.offsetWidth;
	divh = popupObj.offsetHeight;
	//document.onmousemove=followmouse;
}

function HidePopupImage()
{
	var popupObj = document.getElementById("PopupImage");
	popupObj.style.display = "none";
	//document.onmousemove='';
}

function followmouse(e)
{
	var popupObj = document.getElementById("PopupImage");
	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight)
	if(typeof e != "undefined")
	{
		if(docwidth < 15+e.pageX+divw)
			xcoord = e.pageX-divw-5;
		else
			xcoord = 15+e.pageX;
		if(docheight < 15+e.pageY+divh)
		{
			
			ycoord = e.pageY-Math.max(0,(divh + e.pageY - docheight - truebody().scrollTop));
		}
		else
		{
			
			ycoord = 15+e.pageY;
		}
	}
	else if (typeof window.event != "undefined")
	{
		if(docwidth < 15+truebody().scrollLeft+event.clientX+divw)
			xcoord = truebody().scrollLeft-5+event.clientX-divw;
		else
			xcoord = truebody().scrollLeft+15+event.clientX;

		if(docheight < truebody().scrollTop+event.clientY+divh)
				
			ycoord = truebody().scrollTop+event.clientY-Math.max(0,(divh + event.clientY - docheight));
			
else

			ycoord = truebody().scrollTop+event.clientY;
	}
	popupObj.style.left=xcoord+"px"
	popupObj.style.top=ycoord+"px"
}
