<!--
//	Titel: Javascript Lib layers.js 1.3
//	Autor: Scientec Internet Applications + Media GmbH
//	Email: info@scientec.de
//	URL: www.scientec.de
//	Datum: 19.11.2000
//
//	Copyright (c) scientec Internet Applications + Media GmbH, 2000
//	All rights reserved. Alle Rechte vorbehalten
//
//	Dieser Code darf, auch in Auszügen, ausschliesslich nach schriftlicher
//	Zustimmung seitens der scientec Internet Applications + Media GmbH, kopiert
//	oder bearbeitet werden.

//	Koordinatensystem			x: links->rechts; y: oben->unten
//	FV_fixLayer(id,hor,ver):	Layer scrollt nicht mit	(Aufruf in body mit onScroll und onResize)
//						id=LayerID, hor,ver=BOOLEAN (scrollt hor. nicht, ver. nicht)
//	FV_writeInLayer(id,html)	Schreiben von HTML-Quelltext in einen Layer
//	FV_hideLayer(id)			Layer verstecken
//	FV_showLayer(id)			Layer sichtbar machen
//	FV_fixLayer(id)			Layer nicht mitscrollen
//	FV_moveLayerBy(id,dx,dy)	Layer um dx,dy verschieben
//	FV_getLayerX(id)			X-Layerkoordinate der linken oberen Ecke lesen
//	FV_getLayerY(id)			Y-Layerkoordinate der linken oberen Ecke lesen
//	FV_getLayerZ(id)			z-index auslesen
//	FV_setLayerXY(id,x,y)		Layerkoordinaten der linken oberen Ecke setzen (relativ zum Elternelement)
//	FV_setLayerW(id,w)		Layerbreite setzen
//	FV_setLayerH(id,w)		Layerhöhe setzen
//	FV_setLayerZ(id,z)		z-index setzen
//	FV_DivOnTop(id)			Layer nach oben
//	FV_getRelativeX(id)		Abstand zum linken Rand des Elternelements ohne Berück. zus. Ränder
//	FV_getRelativeY(id)		Abstand zum oberen Rand des Elternelements ohne Berück. zus. Ränder
//	FV_getAbsoluteX(id)
//	FV_getAbsoluteY(id)
//	FV_getClipValue(id,pos) 	id: layer-ID, pos: top,right,bottom,left
//	FV_setClipValues(id,x,y,w,h)	(x,y)=linke obere Ecke, w=Breite, h=Höhe
//	FV_setClipXY(id,x,y)		Koordinaten der linken oberen Ecke setzen
//	FV_moveClipBy(id,dx,dy)		Nur clip-area innerhalb des Layers verschieben
//	FV_slideLayerBy(id,dx,dy)	Layer verschieben, CLIP entgegengesetzt

// GLOBALE VARIABLEN

// ABGELEITETE FUNKTIONEN

function FV_setLayerValues(id,x,y,z,w,h){
	FV_setLayerXY(id,x,y);
	FV_setLayerZ(id,z);
	FV_setLayerW(id,w);
	FV_setLayerH(id,h)
}

function FV_moveLayerBy(id,dx,dy){
	FV_setLayerXY(id,FV_getLayerX(id)+dx,FV_getLayerY(id)+dy)
}

function FV_slideLayerBy(id,dx,dy){
	FV_moveLayerBy(id,dx,dy);
	FV_moveClipBy(id,-dx,-dy)
}

// BASISFUNKTIONEN

function FV_fixLayer(id,hor,ver){
	if (NS4){
		ID=id;
		HOR=hor;
		VER=ver;
		if (hor==1) window.document.layers[id].top=window.pageYOffset;
		if (ver==1) window.document.layers[id].left=window.pageXOffset;
		window.setTimeout('FV_fixLayer(ID,HOR,VER)',10);
	}
	if (IE4){
	if (hor==1) document.all[id].style.posTop=document.body.scrollTop;
	if (ver==1) document.all[id].style.posLeft=document.body.scrollLeft;
	}
}

function FV_writeInLayer(id,html){
	if (NS5){document.getElementById(id).innerHTML=html}
	if (NS4){
		var ebene=document.layers[id].document;
		ebene.open();
		ebene.write(html);
		ebene.close();
	}
	if (IE4){document.all[id].innerHTML=html}
}

function FV_hideLayer(id){
 	if(NS5){document.getElementById(id).style.visibility='hidden';}
 	if(NS4){document.layers[id].visibility='hide';}
	if(IE4){document.all[id].style.visibility='hidden';}
}

function FV_showLayer(id){
 	if(NS5){document.getElementById(id).style.visibility='visible';}
 	if(NS4){document.layers[id].visibility='show';}
	if(IE4){document.all[id].style.visibility='visible';}
}

function FV_getLayerX(id){
 	if(NS4) return(document.layers[id].left)
	if(IE4) return(parseInt(document.all[id].style.left.replace(/px/,"")))	
	return(-1);
}

function FV_getLayerY(id){
 	if(NS4) return(document.layers[id].top)
	if(IE4) return(parseInt(document.all[id].style.top.replace(/px/,"")))
	return(-1);
}

function FV_getLayerZ(id) {
	if(NS4) return(document.layers[id].zIndex);
 	if(IE4) return(document.all[id].style.zIndex);
	return(-1);
}

function FV_setLayerXY(id,x,y){
 	if(NS4){
		document.layers[id].left = x;
		document.layers[id].top = y;
	}
 	if(NS5 || IE5){
		document.getElementById(id).style.left = x;//wichtig runde Klammern
		document.getElementById(id).style.top = y;
	}
	if(IE4){
		document.all[id].style.left = x ;  
		document.all[id].style.top = y;
	}
}

function FV_setLayerW(id,w){
 	if(NS4)		{document.layers[id].width = w}
	if(IE4 || IE5)	{document.all[id].style.width = w}
}

function FV_setLayerH(id,h){
 	if(NS4)		{document.layers[id].height = h}
	if(IE4 || IE5)	{document.all[id].style.height = h}
}


function FV_setLayerZ(id,z) {
	if(NS4) document.layers[id].zIndex = z;
 	if(IE4) document.all[id].style.zIndex = z;
}

function FV_DivOnTop(id){
	var t=0; var z=(document.layers) ? ".zIndex" : ".style.zIndex";
	var fun=(document.getElementById) ? "document.getElementById" : "MM_findObj";
	var arr=(document.layers) ? document.layers : (document.all) ? document.all.tags("DIV") : document.getElementsByTagName("DIV");
	for(var i=0;i<arr.length;i++){var oz=eval("arr["+i+"]"+z); if(oz>t){t=oz;}}
	var obj=eval(fun+"(id)");if(obj)eval(fun+"('"+id+"')"+z+"=parseInt("+t+")+1");
}

function FV_getRelativeX(id){
 	if(NS4) return(document.layers[id].left)
	if(IE4) return(document.all[id].style.pixelLeft)	
	return(-1);
}

function FV_getRelativeY(id){
 	if(NS4) return(document.layers[id].top)
	if(IE4) return(document.all[id].style.pixelTop)	
	return(-1);
}

function FV_getAbsoluteX(id){
	if(NS4) return(document.layers[id].pageX)
	if(IE4){
		var cur=id;
		var x=document.all[cur].offsetLeft;
		var par=document.all[cur].offsetParent;
		while(par!=null){
  			x+=par.offsetLeft;
  			par=par.offsetParent;
		}
		return(x);
	}
	return(-1);
}

function FV_getAbsoluteY(id){
	if(NS4) return(document.layers[id].pageY)
	if(IE4){
		var cur=id;
		var y=document.all[cur].offsetTop;
		var par=document.all[cur].offsetParent;
		while(par!= null){
  			y+=par.offsetTop;
  			par=par.offsetParent;
		}
		return(y);
	}
	return(-1);
}

function FV_getClipValue(id,pos){
	if (NS4)
		return(document.layers[id].clip[pos]);
	if (IE4) {
		var str=document.all[id].style.clip;
		if (!str){return(0)}
		else {
			var clip=[];
			clip=document.all[id].style.clip.slice(0).split(" ");
			clip["top"]=clip[0].replace(/rect\(/,"").replace(/px/,"");
			clip["right"]=clip[1].replace(/px/,"");
			clip["bottom"]=clip[2].replace(/px/,"");
			clip["left"]=clip[3].replace(/\)/,"").replace(/px/,"");
			return(clip[pos]);
		}
	}
	return(-1);
}

function FV_setClipValues(id,x,y,w,h){
	var xl=x; var yt=y; var xr=x+w; var yb=y+h;
	if (NS4){with(document.layers[id].clip){top=yt; right=xr; bottom=yb; left=xl}}
	if (IE4){document.all[id].style.clip = "rect("+yt+"px "+xr+"px "+yb+"px "+xl+"px)"}
}

function FV_setClipXY(id,x,y){
	var dx=x-FV_getClipValue(id,'left');
	var dy=y-FV_getClipValue(id,'top');
	FV_moveClipBy(id,Number(dx),Number(dy));
}

function FV_moveClipBy(id,dx,dy){
	var xl=Number(FV_getClipValue(id,'left'));
	var yt=Number(FV_getClipValue(id,'top'));
	var xr=Number(FV_getClipValue(id,'right'));
	var yb=Number(FV_getClipValue(id,'bottom'));
	var newyt=yt+dy;
	var newxr=xr+dx;
	var newyb=yb+dy;
	var newxl=xl+dx;
	if(NS4){with(document.layers[id].clip){left=newxl; top=newyt; right=newxr; bottom=newyb}}
	if(IE4){document.all[id].style.clip="rect("+newyt+"px "+newxr+"px "+newyb+"px "+newxl+"px)"}
}
//-->