/*
Script for showing a hover image with moving relative to the cursor position
*/

function gettrailobj(){
if (document.getElementById)
return document.getElementById("imageHoverId").style
else if (document.all)
return document.all.imageHoverId.style
}


function gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("imageHoverId")
else if (document.all)
return document.all.imageHoverId
}


function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}


function showImageHover(imagename){
	document.onmousemove=followmouse;

	newHTML = '<div>';
	newHTML = newHTML + '<div style="border: 1px solid #000000;" align="center"><img src="' + imagename + '" border="0"></div>';
	newHTML = newHTML + '</div>';

	gettrailobjnostyle().innerHTML = newHTML;
	gettrailobj().visibility="visible";
}


function hideImageHover(){
	gettrailobj().visibility="hidden"
	document.onmousemove=""
	gettrailobj().left="-650px"
}

function followmouse(e){

	var xcoord=10	//image x,y offsets from cursor position in pixels
	var ycoord=10	//image x,y offsets from cursor position in pixels

	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"){
		xcoord += e.pageX;
		ycoord += e.pageY;
	} else if (typeof window.event != "undefined"){
		xcoord += truebody().scrollLeft + event.clientX
		ycoord += truebody().scrollTop + event.clientY;
	}

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)

	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"
}