
loaded = 0;
window.onerror = function(){return false;}
window.defaultStatus ="";

function makeZflag() {
	this.NS = document.layers ? 1:0;
	this.IE = document.all ? 1:0;
	this.gecko = document.getElementById ? 1:0;
	this.mac = (navigator.appVersion.indexOf("Mac") > -1) ? 1:0;
	this.opera = (navigator.appName.indexOf("Opera") > -1) ? 1:0;
	}
Zflag = new makeZflag();

function makeZbrowse() { this.id = "Zbrowse";}
makeZbrowse.prototype.width = function() {return Zflag.IE?document.body.clientWidth:window.innerWidth;}
makeZbrowse.prototype.height = function() {return Zflag.IE?document.body.clientHeight:window.innerHeight;}
makeZbrowse.prototype.scrollY = function() {return Zflag.IE?document.body.scrollTop:pageYOffset;}
makeZbrowse.prototype.scrollX = function() {return Zflag.IE?document.body.scrollLeft:pageXOffset;}
Zbrowse = new makeZbrowse();

if (Zflag.NS) {
	layerstart = "document.";
	layerstyle = "";  }
if (Zflag.gecko){
	layerstart = "document.getElementById('";
	layerstyle = "').style"; }
if (Zflag.IE){
	layerstart = "document.all.";
	layerstyle = ".style"; }
	
function makeZobject(ID,wrapper,top,left,height,width,zindex,visibility,leftGoal) {
	this.ID = ID ? ID : "Zobject"+(Zobject.length);
	this.DHTML = (wrapper && Zflag.NS) ? eval(layerstart + wrapper + "." + layerstart + this.ID + layerstyle) : eval(layerstart + this.ID + layerstyle);
	this.top = top ? top:0;
	this.left = left ? left:0;
	this.height = height ? height:0;
	this.width = width ? width:0;
	this.zindex = zindex ? zindex:(Zobject.length+1)*1000;
	this.visibility = visibility ? visibility:"visible";
	this.leftGoal = leftGoal ? leftGoal:left;
	}

makeZobject.prototype.setZall = function() {
	this.DHTML.top = this.top; 
	this.DHTML.left = this.left;
	this.DHTML.zIndex = this.zindex;
	this.DHTML.height = this.height;
	this.DHTML.width = this.width;
	this.DHTML.visibility = this.visibility;
	}


function setDefaultVars() {
	Zlag=4;
	tempLeft2=0;
	tempTop2=0;
	ZpulseOnOff=1;deBug=0;sizeRatio=1;
	Ypos=0;Xpos=0;Zjustify=1;
	Zcount=0;Zpulse=0;
	// milliseconds to repeat & amount to scroll.
	Zrefresh = (Zflag.NS) ? 20:20;
	Zrefresh = ((Zflag.gecko && !Zflag.IE) || Zflag.opera) ? 24:Zrefresh;
	baseZlag = 12;
	baseZlag = (Zflag.gecko && !Zflag.IE) ? 2:baseZlag;
	baseZlag = (Zflag.opera) ? 12:baseZlag;
	baseZlag = (Zflag.mac) ? 4:baseZlag;
}
setDefaultVars();


// * * * * *  O B J E C T   C R E A T I O N  * * * * */	

Zobject = new Array();

function initZobjects() { 
// create list elements like this... name,wrapper,top,left,height,width,zindex
Zobject[0] = new makeZobject('neonBike', null, 88,  -138, 31, 79, 5000);
Zobject[1] = new makeZobject('shiftZone', null, 15,  0, 200, Zbrowse.width(), 100);
}




function setLeftGoals() {
	if (Zjustify) {
		leftGoals = new Array(-138,0);
		widthGoal = Zbrowse.width()-492;
		if (widthGoal<262) { widthGoal=262;}
	}
	else {
		leftGoals = new Array(-138,0);
		widthGoal = Zbrowse.width()-464;
		if (widthGoal<262) { widthGoal=262;}	
	}
	for (m=0;m<Zobject.length;m++){Zobject[m].leftGoal = leftGoals[m];}
}



	
// * * * * *  S E T U P  * * * * */
	
function setup() { 
	if (!loaded) { 
	
		initZobjects();
	
		if (Zbrowse.width() < 711) { window.resizeBy(711-Zbrowse.width(),0);
			if (Zflag.NS) { location.href=self.location.href; return false; }
		}
	
		ZrefreshID = setInterval ("fix()",Zrefresh);

	}
	else if ((Zflag.NS) && !replayFlag) { loaded=0; location.href=self.location.href; return false; }
	
	if (Zbrowse.width() > 711) {
		Zlag = Math.ceil(baseZlag * (711/Zbrowse.width()));if (Zlag < 2) Zlag=2;
		scrollDistance = Math.round(11*sizeRatio);
	}


	// shiftZone
	Zobject[1].width = Zbrowse.width();
	
	setLeftGoals();

	loaded=1;
}



function fixTopLeft(num) {
tempLeft = Zobject[num].leftGoal - Zobject[num].left;
if (Math.abs(tempLeft) > 0) {
tempLeft = (Math.abs(tempLeft) < 72) ? Math.round(tempLeft/(Zlag/2)) : Math.round(tempLeft/Zlag);
	Zobject[num].left = Zobject[num].left + tempLeft; }
tempTop = Zobject[num].topGoal - Zobject[num].top;
if (Math.abs(tempTop) > 0) {
tempTop = Math.round((Zobject[num].topGoal - Zobject[num].top)/Zlag);
	Zobject[num].top = Zobject[num].top + tempTop;} 
if (Math.abs(tempLeft) < .5) { Zobject[num].left = Zobject[num].leftGoal; }	}


function bikeVisible() {
	// make bicycle visible
	// only when it has reset
	// to position -140
	Zobject[0].visibility = 'visible';
}


function fix() {
if (!loaded) return false;
if ((Zbrowse.scrollX() != 0) || (Zbrowse.scrollY() != 0)) { scrollTo(0,0); }

	// bike movement handler
	if (ZpulseOnOff) {
		if (Zpulse) {
			
			if (Zobject[0].visibility != "hidden") { Zcount = Zcount + 4; }
			
			if (Zcount < (Zbrowse.width()+100)) { Zobject[0].leftGoal = Zcount; }
			else {
				Zobject[0].visibility = "hidden";
				Zcount = -140;
				setTimeout('bikeVisible()',1000);
			}
		}
		else {
			Zcount = Zbrowse.width()+40;
			Zobject[0].leftGoal = Zcount;
		}
	}

	
	// moves the bike by repositoning every element???
		for (m=0;m<Zobject.length;m++){ 
			fixTopLeft(m);
			Zobject[m].setZall();
		}

// allow Bike movement - determined by shiftZone being set
if ((Ypos<Zobject[1].top) || (Ypos>Zobject[1].top+Zobject[1].height)) {Zpulse=1;}
else { Zpulse=0; }

}

//Important! for initialization and browser resize
	onload=setup;
	onresize=setup;



// ----- script end -------