var isIE = false,range = "all[\'",style = "\'].style",i = 0;
var topPix = ".top",leftPix = ".left",images,storage;
var d = 0;

var mailurl = new Array ();
mailurl[0] = "mail/index.php";
mailurl[1] = "profile/entry.php";

		function mail(num) {
			var tpx = document.all['mail'].style.top;					
			if (num != 0) {
				mframe.window.location.href = mailurl[num-1];
				document.all['mail'].style.top = document.body.scrollTop + (document.body.clientHeight-316)/2;
				document.all['mail'].style.left = (document.body.clientWidth-416)/2;
				document.all['mframe'].style.width = 320;
			} else {
				mframe.window.location.href = "empty.html";
				document.all['mail'].style.top = -500;
			}
		}

		function money(sys) {
			var tpx = document.all['mail'].style.top;
			if (sys != 0) {
				mframe.window.location.href = "money.php?mn=" + sys;
				document.all['mail'].style.top = document.body.scrollTop + (document.body.clientHeight-316)/2;
				document.all['mail'].style.left = (document.body.clientWidth-450)/2;
				document.all['mframe'].style.width = 450;
			} else {
				mframe.window.location.href = "empty.html";
				document.all['mail'].style.top = -500;
			}
		}

		var icount = true;

		function newcode() {
			document.all['codeimg'].src = "profile/img/image.php?r="+icount;
			icount++;
		}

		function initTrail() {
			// prepares the script
			wimg = 6;
			images = new Array(); // prepare the image array
			for (i = 0; i < parseInt(trailLength); i++) {
				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++) {
				document.write('<img id="obj' + i + '" style="position:absolute; z-Index:100;" src="' + images[i].src + '" width=' + wimg + '>');
				wimg = wimg - i/10;
			}
			trail();
		}


		function trail() {

			limhgt = document.body.scrollTop + document.body.clientHeight - 10;

			// trailing function
			for (i = 0; i < images.length; i++) {// for every div/layer
				if (storage[d] < limhgt) {
					document.all['obj'+i].style.top = storage[d]; // the Y-coordinate
					document.all['obj'+i].style.left = storage[d+1]; // the X-coordinate
				}
				d = d+2;
			}
			for (i = storage.length; i >= 2; i--) { 
				// save the coordinate for the div/layer thats behind
				storage[i] = storage[i-2];
			}
			d = 0; // reset for future use
			setTimeout("trail()",30); // call recursively 
		}

		function processEvent(e) {
			if (isIE) {
				storage[0] = window.event.y+14;
				storage[1] = window.event.x+5;
			} else {
				storage[0] = e.pageY+14;
				storage[1] = e.pageX+5;
			}

		}
