  window.name = "main"

var isIE = (navigator.userAgent.indexOf("MSIE") > 0) ? 1 : 0;
var isIE4 = (navigator.userAgent.indexOf("MSIE 4") > 0) ? 1 : 0;
var isIE5 = (navigator.userAgent.indexOf("MSIE 5") > 0) ? 1 : 0;
var isIE55 = (navigator.userAgent.indexOf("MSIE 5.5") > 0) ? 1 : 0;
var isIE6 = (navigator.userAgent.indexOf("MSIE 6") > 0) ? 1 : 0;
var isDT = (document.compatMode == "CSS1Compat") ? 1 : 0;
var isDOM = (document.getElementById) ? 1 : 0;
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
var isNS4 = ((parseInt(navigator.appVersion) == 4)&&(isNS)) ? 1 : 0;
var isNS6 = (navigator.userAgent.indexOf("Gecko") > 0) ? 1 : 0;
var isOP = (navigator.userAgent.indexOf("Opera") > 0) ? 1 : 0;
var isOP4 = ((parseInt(navigator.appVersion) >= 4)&&(isOP)) ? 1 : 0;
if (isOP){
  var isIE4 = 0;
  var isIE5 = 0;
  var isIE6 = 0;
  var isIE55 = 0;
  var isNS6 = 0;
  var isNS4 = 0;
}

  layerRef = (isNS4) ? "document" : "document.all";
  styleRef = (isNS4) ? "" : ".style";	

  var queue = new Array();
	
  for (x=1; x < 7; x++) {	 
    eval("trailSpriteFrame" + x + " = new Image(10,10);");
    eval("trailSpriteFrame" + x + ".src = 'trailgif" + x + ".png';");
  }

  function trailSpriteObj(anID) {
    this.trailSpriteID = "trailSprite" + anID;  
    this.imgRef = "trailSprite" + anID + "img"; 
    this.currentFrame = 1;
    this.animateTrailSprite = animateTrailSprite; 
  }

  function animateTrailSprite() {
    if (this.currentFrame <7) {	
      if (isNS4)
  	  eval("document." + this.trailSpriteID +".document['"+ this.imgRef + "'].src  =  trailSpriteFrame" + this.currentFrame + ".src");
      else 
	  eval("document['" + this.imgRef + "'].src  =  trailSpriteFrame" + this.currentFrame + ".src");
      this.currentFrame ++;
    }
    else if(isDOM)
	 document.getElementById(this.trailSpriteID).style.visibility = "hidden";
     else if (isIE)
       eval(layerRef + '.' + this.trailSpriteID + styleRef + '.visibility = "hidden"');
   }

  function processAnim() {
    for(x=0; x < 6; x++)
      queue[x].animateTrailSprite();
  }

  function processMouse(e) {
    var currentObj = shuffleQueue();
    if(isDOM)
      currentObj = document.getElementById(currentObj);
    else 
      currentObj = eval(layerRef + "." + currentObj);

    var myevent = (isNS) ? e : event;
    if (isIE){
    var bodyobject = (isDT) ? document.documentElement : document.body;
      var myclientX = bodyobject.scrollLeft+myevent.clientX;
      var myclientY = bodyobject.scrollTop+myevent.clientY;
    }
    else {
      var myclientX = myevent.pageX;
      var myclientY = myevent.pageY;
    }

    if(isDOM){
      currentObj.style.left = myclientX + "px";
      currentObj.style.top = myclientY + 5+ "px";
    }
    else if (isNS4){
     currentObj.left = myclientX;
     currentObj.top = myclientY + 5;
    }
    else if (isIE){
	currentObj.style.pixelLeft = myclientX;
	currentObj.style.pixelTop = myclientY + 5;
    }
  }

   function shuffleQueue() {
     lastItemPos = queue.length - 1;
     lastItem = queue[lastItemPos];
     for (i = lastItemPos; i>0; i--) 
       queue[i] = queue[i-1];
     queue[0] = lastItem;
     queue[0].currentFrame = 1;	
     if(isDOM){
	 document.getElementById(queue[0].trailSpriteID).style.visibility = "visible";}
     else{eval(layerRef + '.' + queue[0].trailSpriteID +  styleRef + '.visibility = "visible"');}
     return queue[0].trailSpriteID;
   }

   function init() {
     for(x=0; x<6; x++) 
       queue[x] = new trailSpriteObj(x+1) ;
     if (isNS) { document.captureEvents(Event.MOUSEMOVE); }
     document.onmousemove = processMouse;
     setInterval("processAnim();",25);
   }

    if (parseInt(navigator.appVersion) > 3){window.onload = init;}
