/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

//var trailimage=["test.gif", 100, 99] //image path, plus width and height
var offsetfrommouse=[-235,0] //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=0 //duration in seconds image should remain visible. 0 for always.
var currentwidth = 0;
var currentheight = 0;

// Set to left:-500 so that div doesn't show up in top corner before moving to proper place. 
if (document.getElementById || document.all)
document.write('<div id="hover" style="position:absolute;width:0;left:-500px;"></div>')

// variable to hold setTimout Object. 
// Set to false to cancel timeout function. 
hovertimeout = false;

function showtrail(description,height,width){
//	document.onmousemove=followmouse;
	if(height>0){
		getHoverObj().height=height+"px";
		offsetfrommouse[1] = -parseInt( parseInt(getHoverObj().height) /2 )-5;
	} else {
		offsetfrommouse[1] = -20;
	}
	
	if (width > 25){
		getHoverObj().width=width +"px"
	}
	else{
		getHoverObj().width="250px";
	}

	title = "&nbsp;";
	
	newHTML = '<h2>'+title+'</h2>';
	newHTML = newHTML+'<div class="hoverContent"><p>';
	newHTML = newHTML+description;
	newHTML = newHTML+'</p></div>';
	newHTML = newHTML+'<br class="clear"/><br class="clear"/>';
	
	getHoverObj().display="block";
	getHoverObj().visibility="visible";
	getHoverObj().width=225+"px";
	getHoverObjnostyle().innerHTML = newHTML;
	
}

function getHoverObj(){
if (document.getElementById)
return document.getElementById("hover").style
else if (document.all)
return document.all.trailimagid.style
}

function getHoverObjnostyle(){
if (document.getElementById)
return document.getElementById("hover")
else if (document.all)
return document.all.trailimagid
}

function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function hidetrail(){
getHoverObj().visibility="hidden"
document.onmousemove=""
// Set back off of page so that div doesn't show up in corner. 
getHoverObj().left=-400+"px"
	ycoord = 0;
}

function followmouse(e){
var xcoord=offsetfrommouse[0];
var ycoord=offsetfrommouse[1];
	if(ycoord==0){
		return;
	}


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)
if (xcoord+currentwidth+3>docwidth || ycoord+currentheight> docheight)
getHoverObj().display="none"
else 
getHoverObj().display=""
getHoverObj().left=xcoord+"px"
getHoverObj().top=ycoord+"px"
}


// Automatically show mouse trail on page. 
//document.onmousemove=followmouse

if (displayduration>0)
setTimeout("hidetrail()", displayduration*1000)

