

/*
Fade-away cursor trail (By Dave Collins at davecollin1@excite.com)
Code and technique learned from site SiteExperts.com
Permission granted to Dynamicdrive.com to include script in archive
For this and 100's more DHTML scripts, visit http://dynamicdrive.com
*/


var isNS = (navigator.appName == "Netscape");
layerRef = (isNS) ? "document" : "document.all";
styleRef = (isNS) ? "" : ".style";

var queue = new Array();

var NUM_OF_TRAIL_PARTS = 5

for (x=1; x < 6; x++) {
	eval("trailSpriteFrame" + x + " = new Image(28,36);");
	eval("trailSpriteFrame" + x + ".src = '/images/sp" + 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 <6 ) {
		if (isNS) {
			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 {
		eval(layerRef + '.' + this.trailSpriteID +  styleRef + '.visibility = "hidden"');
	}	
}



function processAnim() {
	for(x=0; x < NUM_OF_TRAIL_PARTS; x++)
			queue[x].animateTrailSprite();
}

function processMouse(e) {
	currentObj = shuffleQueue();
	if (isNS) {
		eval("document." + currentObj + ".left = e.pageX - 10 ;");
		eval("document." + currentObj + ".top = e.pageY + 10;");
	} else {
		eval("document.all." + currentObj + ".style.pixelLeft = event.clientX + document.body.scrollLeft - 10 ;");
		eval("document.all." + currentObj + ".style.pixelTop = event.clientY + document.body.scrollTop + 10;");
	}
}

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;
	eval(layerRef + '.' + queue[0].trailSpriteID +  styleRef + '.visibility = "visible"');	

	return 	queue[0].trailSpriteID;
}

function init() {
	
	for(x=0; x<NUM_OF_TRAIL_PARTS; x++)
		queue[x] = new trailSpriteObj(x+1) ;
	
	if (isNS) { document.captureEvents(Event.MOUSEMOVE); }
	document.onmousemove = processMouse;

	setInterval("processAnim();",25);
}	
if (document.all||document.layers)
window.onload = init;




function clpop()
{
  var wind = new Array();
  wind[1]=x1;
  wind[2]=x2;
  wind[3]=x3;
  wind[4]=x4;
  wind[5]=x5;
  wind[6]=x6;
  wind[7]=x7;
  wind[8]=x8;
  wind[9]=x9;
  wind[10]=x10;
  wind[11]=x11;
  wind[12]=x12;
  wind[13]=x13;
  wind[14]=x14;
  wind[15]=x15;
  wind[16]=x16;
  wind[17]=x17;
  wind[18]=x18;
  wind[19]=x19;
  wind[20]=x20;
  wind[21]=x21;
  wind[22]=x22;
  wind[23]=x23;
  wind[24]=x24;
  wind[25]=x25;
  wind[26]=x26;
  wind[27]=x27;
  wind[28]=x28;
  wind[29]=x29;
  wind[30]=x30;
  
 for(i=1;i<31;i++)
 {
 wi=wind[i];
 if(wi!=null)
 {
   if(false == wi.closed)
   {
      wi.close ();
   }
 }
 }
}

      x1=null;
      x2=null;
	  x3=null;
	  x4=null;
	  x5=null;
	  x6=null;
	  x7=null;
	  x8=null;
      x9=null;
	  x10=null;
	  x11=null;
	  x12=null;
	  x13=null;
	  x14=null;
	  x15=null;
	  x16=null;
	  x17=null;
	  x18=null;
	  x19=null;
	  x20=null;
	  x21=null;
      x22=null;
	  x23=null;
	  x24=null;
	  x25=null;
	  x26=null;
	  x27=null;
	  x28=null;
	  x29=null;
	  x30=null;


function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;

// decimal point jump
else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   }
else
   return false;
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

