// JavaScript Document

<!--

/*
Submitted by Marcin Wojtowicz [one_spook@hotmail.com] 
Featured on JavaScript Kit (http://javascriptkit.com)
Modified by JK to be IE7+/ Firefox compatible
For this and over 400+ free scripts, visit http://javascriptkit.com
*/

var trailLength = 20 // The length of trail (8 by default; put more for longer "tail")
//Following selects image at random




var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes


var i,d = 0//sets initial value at 0

function initTrail() { // prepares the script
	images = new Array() // prepare the image array
	for (i = 0; i < parseInt(trailLength); i++) {
	movie = new Array
movie[1]="starg.gif"
movie[2]="staro.gif"
movie[3]="starb.gif"
movie[4]="starp.gif"
movie[5]="starg4.gif"
movie[6]="staro4.gif"
movie[7]="starb4.gif"
movie[8]="starp4.gif"
movie[9]="starg8.gif"
movie[10]="staro8.gif"
movie[11]="starb8.gif"
movie[12]="starp8.gif"
random_num = (Math.round((Math.random()*11)+1))
var path = (movie[random_num]);
		images[i] = new Image()
		images[i].src = path
	}
	storage = new Array() // prepare the storage for the coordinates
	for (i = 0; i < images.length*3; i++) {
		storage[i] = 0
	}
	for (i = 0; i < images.length; i++) { // make divs for IE and layers for Navigator
		document.write('<div id="obj' + i + '" style="position: absolute; z-Index: 100; height: 0; width: 0"><img src="' + images[i].src + '"></div>')
	}
	trail()
}
function trail() { // trailing function
	for (i = 0; i < images.length; i++) { // for every div/layer
		document.getElementById("obj" + i).style.top = storage[d+10]+'px' // the Y-coordinate
		document.getElementById("obj" + i).style.left = + storage[d+11]+'px' // the X-coordinate
		d = d+2
	}
	for (i = storage.length; i >= 2; i--) { // save the coordinate for the div/layer that's behind
		storage[i] = storage[i-2]
	}
	d = 0 // reset for future use
	var timer = setTimeout("trail()",20) // call recursively 
}
function processEvent(e) { // catches and processes the mousemove event 
	if (window.event) { // for IE
	//following is distance from the mouse pointer
		storage[0] = window.event.y+standardbody.scrollTop+5
		storage[1] = window.event.x+standardbody.scrollLeft+5
	} else {
		storage[0] = e.pageY+5
		storage[1] = e.pageX+5
	}
}

	initTrail() 
	document.onmousemove = processEvent // start capturing

//-->

