// ZNIPPets.com, "Zprime.js", by DocOzone... default basic setup...

window.onerror = function() { return false; }
window.defaultStatus ="";
// that sets the status bar to "" and disables error reporting.

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();

if (Zflag.NS) {
	layerstart = "document.";
	layerstyle = "";  }
if (Zflag.gecko){
	layerstart = "document.getElementById('";
	layerstyle = "').style"; }
if (Zflag.IE){
	layerstart = "document.all.";
	layerstyle = ".style"; }
	
	function getZbrowser() {
alert(navigator.appName + " - " + navigator.appVersion); }

// ZNIPPets.com, "Zbrowse.js", by DocOzone... basic browser variables...

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();

// ZNIPPets.com, "Zimage.js", by DocOzone... default basic setup... (from changeminds.com)

function getZimage(name,wrapper,outerWrapper) {
if (document.layers) {
	returnString = "";
	if (outerWrapper) returnString = returnString + "document." + outerWrapper + ".";
	if (wrapper) returnString = returnString + "document." + wrapper + ".";
	returnString = returnString + "document." + name;
	return eval(returnString);
	}
else if (document.all) {
	return eval("document.all." + name);
	}
else if (document.getElementById) {
	return document.getElementById(name);
	}
else { return false; }
}

// ZNIPPets.com, "makeZobject.js", by DocOzone... 
// "prototype" functions for the makeZobject() function.

function makeZobject(ID,wrapper,top,left,height,width,zindex,visibility) {
	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";
	}

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;
	}

//Important! Nothing much will work if we don't run the Zsetup() function. :)

	onload=Zsetup;

	Zobjects = new Array(); 

	Zrefresh = 5; if (Zflag.gecko && !Zflag.IE) Zrefresh = 10; 
	increment = .5;
	loaded=0; 

function Zsetup() {
	Xpos=Zbrowse.width()*.4; Ypos=100;
	dZwalking = new makeZobject("Zwalking",null,151,0,158,Zbrowse.width(),1);
	dZozone = new makeZobject("Zozone",null,17,(Zbrowse.width()-388)/2,108,388,5);
	dZemail = new makeZobject("Zemail",null,312,Zbrowse.width()-130,17,119,10);
	dZinterface = new makeZobject("Zinterface",null,340,(Zbrowse.width()-480)/2,120,480,500);
		Zobjects[0] = new makeZobject("Zlayer1","Zwalking",0,0,158,3052,400);
		Zobjects[1] = new makeZobject("Zlayer2","Zwalking",0,0,158,3052,300);
		Zobjects[2] = new makeZobject("Zlayer3","Zwalking",0,0,158,3052,200);
		Zobjects[3] = new makeZobject("Zlayer4","Zwalking",0,0,158,3052,100);
	fixObjects();
	
if (Zflag.NS) {
	window.captureEvents(Event.MOUSEMOVE);
	window.onMouseMove = moveHandler;}
else if (Zflag.IE) {
	document.onmousemove=moveHandler;}
else if (Zflag.gecko && !Zflag.opera) {
	document.addEventListener("mousemove", moveHandler, true);
	}
	
ZrefreshID = setInterval ("Zwalking()",Zrefresh);

loaded=1;
}

//Important! This next line is needed for the handling of browser re-sizing events.

	onresize=fixObjects;

function fixObjects() {
	dZozone.left = (Zbrowse.width()-388)/2;
	dZinterface.left = (Zbrowse.width()-480)/2;
	dZemail.left = Zbrowse.width()-130;
	dZwalking.width = Zbrowse.width();
	for (m=0;m<Zobjects.length;m++) Zobjects[m].setZall();
	dZozone.setZall();
	dZinterface.setZall();	dZemail.setZall();
	dZwalking.setZall();
}

function Zwalking() {

	//motionX = ((Xpos/(Zbrowse.width()/2))-1)*3;
	
	if (Xpos < Zbrowse.width()/2) motionX = increment; 
	else motionX = -increment;
	
	for (m=0;m<=3;m++) {
	if (Ypos<Zbrowse.height()/2) Zobjects[m].left = Zobjects[m].left - (Math.abs(m-4)*motionX); 
	else Zobjects[m].left = Zobjects[m].left - ((m+1)*motionX); 
	if (Zobjects[m].left < -763) Zobjects[m].left = Zobjects[m].left + 763;
	if (Zobjects[m].left > 0) Zobjects[m].left = Zobjects[m].left - 763;
	
	Zobjects[m].setZall();
	}
}

function moveHandler(e) {
	if (!loaded) return false;
	Xpos = (Zflag.IE)?event.x:e.pageX;
	Ypos = (Zflag.IE)?event.y:e.pageY;
	}

