

var aimages = new Array(); 

function preloadimages() 
{ 

 imageObj= new Image();
 for (i=0;i<9;i++)
 {
  
  aimages[i] = "./Images/StageIndicators/stage"+i*45+".gif"; 
  imageObj.src=aimages[i];
 } 
} 

/*
Simple Image Trail script- By JavaScriptKit.com Modified by Richard Turner Delta Computer Services
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

var trailimage=["./Images/StageIndicators/stagenone.gif",48, 62] //image path, plus width and height
//var offsetfrommouse=[15,-20] //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var offsetfrommouse=[0,-128];
var displayduration=5 //duration in seconds image should remain visible. 0 for always.

if (document.getElementById || document.all)
document.write('<div id="trailimageid" style="position:absolute;visibility:visible;left:0px;top:0px;width:1px;height:1px;z-index:999"><img id="StageIndicator" src="'+trailimage[0]+'" border="0" width="'+trailimage[1]+'px" height="'+trailimage[2]+'px"></div>')

function gettrailobj(){
if (document.getElementById)
return document.getElementById("trailimageid").style
else if (document.all)
return document.all.trailimagid.style
}

function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function hidetrail(){
gettrailobj().visibility="hidden";
document.onmousemove='';

//resetTimeout("hidetrail()");

}

function followmouse(e){
var xcoord=100;
var ycoord=0;
//netscape
if (typeof e != "undefined"){
  ycoord=e.pageY;	
  if (e.pageX >80 && e.pageX< 220) xcoord=0;
  if (e.pageX<=0) hidetrail();
if ((Math.abs(e.pageY-ycoord) < 62) && (Math.abs(e.pageX-xcoord) < 48))
 {
   xcoord=100;
   //ycoord+=offsetfrommouse[1];
 }
}
 else
{
	if (typeof window.event !="undefined"){
	ycoord=truebody().scrollTop+event.clientY;
    if (Math.abs(truebody().scrollLeft+event.clientX) >80 && Math.abs(truebody().scrollLeft+event.clientX)< 220) 
    {
	xcoord=0;
	//offsetfrommouse[0];
    //ycoord+=offsetfrommouse[1];
    }

}

//clearInterval("hidetrail()");
//if (displayduration>0)
//setInterval("hidetrail()", displayduration*1000)

}
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+trailimage[1]+3>docwidth || ycoord+trailimage[2]> docheight)
gettrailobj().display="none"
else 
gettrailobj().display=""
gettrailobj().left=xcoord+"px"
gettrailobj().top=ycoord+"px"
gettrailobj().visibility="visible"
}



if (displayduration>0)
var hidetimer = setTimeout("hidetrail()", displayduration*500)

function stage(pos)
{
 psn=pos/45;
 gettrailobj().visibility='visible'
 var stagepos = document.getElementById("StageIndicator");
 stagepos.src=aimages[psn];
 document.onmousemove=followmouse
 trailimage=[aimages[psn],48,62] 
 if (displayduration>0) {
 clearTimeout(hidetimer);
 hidetimer = setTimeout("hidetrail()", displayduration*500);
 }
}
preloadimages();

