var nav_layers	= new Array('nav1','nav2','nav3','nav4','nav5');
var nav_left	= new Array(75,60,45,30,15);
var nav_top 	= new Array(30,45,60,75,90);
var nav_zindex	= new Array(1,2,3,4,5);
var lefttemp= new Array();
var toptemp	= new Array();
var zindextemp= new Array();

function Hidelayer(id) {
	if (mac) {
		if (nn4) document.layers[id].visibility='hide';
		if (iex4) document.all[id].style.visibility = 'hidden';
		if (nn6) document.getElementById(id).style.visibility='hidden';
	}
}
function Showlayer(id,content) {
	if (mac) {
	    if (nn4) {
			document.layers[id].visibility='show';
			document.layers[id].left=xMousePos+10;
			document.layers[id].top=yMousePos;
		}
	    if (iex4) {
			document.all[id].style.visibility='visible';
			document.all[id].style.left=xMousePos+10;
			document.all[id].style.top=yMousePos;
		}
	    if (nn6) {
			document.getElementById(id).style.visibility='visible'; 
			document.getElementById(id).style.left=xMousePos+10;
			document.getElementById(id).style.top=yMousePos;
		}
	}
}

function InitNav() {
	layernav1 = new Layerini("nav1");
	layernav2 = new Layerini("nav2");
	layernav3 = new Layerini("nav3");
	layernav4 = new Layerini("nav4");
	layernav5 = new Layerini("nav5");
	load=true;
}

// define the differences between browsers and functions for moving
function Layerini(id) {
	if (nn4) {
		this.Sheet=document.layers[id];
		this.Ref=document.layers[id].document;
		this.X=this.Sheet.left;
		this.Y=this.Sheet.top;
		this.Z=this.Sheet.zIndex;
	}
	if (nn6) {
		this.Sheet=document.getElementById(id).style;
		this.Ref=document;
		this.X=this.Sheet.pixelLeft;
		this.Y=this.Sheet.pixelTop;
		this.Z=this.Sheet.zIndex;
	}
	if (iex4) {
		this.Sheet=document.all[id].style;
		this.Ref=document;
		this.X=this.Sheet.pixelLeft;
		this.Y=this.Sheet.pixelTop;
		this.Z=this.Sheet.zIndex;
	}
	this.Position=function Position(x,y,ze) {
		this.X=x;
		this.Sheet.left=this.X;
		this.Y=y;
		this.Sheet.top=this.Y;
		this.Z=ze;
		if (!iex4) this.Sheet.zIndex=this.Z;
	}
	this.Hide=function Hide() {
		if (nn4) this.Sheet.visibility='hide';
		if (iex4||nn6) this.Sheet.visibility='hidden';
		this.Activ=false;
	}
	this.Show=function Show(){
		if (nn4) this.Sheet.visibility='show';
		if (iex4||nn6) this.Sheet.visibility='visible';
	}

// name the layer and image
	this.RegIn=id+'reg';
	eval(this.RegIn+'=this');


// define a function to move the layers from a to b
	this.Move=function Move(x,y,i,incy,incx,step,ze) {
		if (i++<step) {
			y = y+incy;
			x = x+incx;
			this.Position(x,y);
			setTimeout(this.RegIn+'.Move('+x+','+y+','+i+','+incy+','+incx+','+step+','+ze+')',1/step*25);
		}
		this.Z = ze;
		this.Sheet.zIndex=this.Z;
		this.Activ = false;
	}

	this.Startmove=function Startmove(x,y,xe,ye,ze) {
	    if (this.Activ) return;
		this.Position(x,y);
		step = Math.abs(Math.ceil((ye-y)/4));
		if (step<2) step = 2;
		incy = (ye-y)/step;
		incx = (xe-x)/step;
		this.Move (x,y,0,incy,incx,step,ze);
		this.Activ = true;
	}
}

function Shiftlayer(name,foregroundnum,start) {
	if (mac&&iex4) start=true;
	layertemp = eval(name +"_layers");
	for (key in layertemp) { // position bestimmen -> shift
		if (key==foregroundnum) shiftamount = eval("layer"+ layertemp[key] +".Z");
	}
	for (key in layertemp) { // shiften
		shiftkey = key - shiftamount;
		if (shiftkey<0) shiftkey += layertemp.length;
		if (start) {
			eval("layer"+ layertemp[key]+".Position("+ name +"_left["+ shiftkey +"],"+ name +"_top["+ shiftkey +"],"+ name +"_zindex["+ shiftkey +"])");
		}
		else {
			eval("layer"+ layertemp[key] +".Startmove("+ name +"_left["+ key +"],"+ name +"_top["+ key +"],"+ name +"_left["+ shiftkey +"],"+ name +"_top["+ shiftkey +"],"+ name +"_zindex["+ shiftkey +"])");
		}
		lefttemp[key] = eval(name +"_left["+ shiftkey +"]");
		toptemp[key] = eval(name +"_top["+ shiftkey +"]");
		zindextemp[key] = eval(name +"_zindex["+ shiftkey +"]");
	}
	for (key in layertemp) { // position speichern
		temp = eval(name +"_left");
		temp[key] = lefttemp[key];
		temp = eval(name +"_top");
		temp[key] = toptemp[key];
		temp = eval(name +"_zindex");
		temp[key] = zindextemp[key];
	}
}

