

//  	####  Browsercheck & Browseranpassung

 // var ns = (document.layers) ? 1 : 0;  // Bug ?
var ie = (document.all) ? 1 : 0;
var other = (document.getElementById) ? 1 : 0;

if (ie == 1)
{
	var obj = "document.all";
}
else
{
	if (other == 1)
		var obj = "document.getElementById";		
	else
	{
		var ns = 1;
		var obj = "document.layers";
	}
}

if ((ie == 1) || (other == 1))
	var eig = ".style";
else
	var eig = "";

var kl_open = (other) ? "(" : "[";
var kl_close = (other) ? ")" : "]";


//       ### DHTML-Funktionen

function layer_data(layer) {	

	L = eval(obj+kl_open+'\"'+layer+'\"'+kl_close+eig);	
	return(L);
}

function layer_values(layer,which) {
	L = layer_data(layer);
	if (ns) {
		if (which=="t") return parseInt(L.top)
		if (which=="r") return parseInt(L.width)  // funzt nicht.
		if (which=="b") return parseInt(L.height) // funzt nicht.
		if (which=="l") return parseInt(L.left)
	}
	else if ((ie) || (other)) {
		if (which=="t") return parseInt(L.top)
		if (which=="r") return parseInt(L.width)
		if (which=="b") return parseInt(L.height)
		if (which=="l") return parseInt(L.left)
	}	
}



function show(layer,i) {    
 	 L = layer_data(layer);
  	 L.visibility = (i) ? "visible" : "hidden";
}

function move_to(layer,x,y,z) { 
	L = layer_data(layer);
	L.left = x;
	L.top = y; 
	L.zIndex = z;
}

function move(layer,dx,dy,dz){
  L = layer_data(layer);
  x = parseInt(L.left) + dx;
  y = parseInt(L.top) + dy;
  z = parseInt(L.zIndex) + dz;
  move_to(layer,x,y,z);
}

function write(layer,text) {
  L = layer_data(layer);
  if(ns){
    L.document.open();
    L.document.write(text);
    L.document.close();
  }
  else L.innerHTML = text;
}

//           ### Clip-Funktionen

function clip_values(obj,which) {
	if (ns) {
		if (which=="t") return obj.clip.top
		if (which=="r") return obj.clip.right
		if (which=="b") return obj.clip.bottom
		if (which=="l") return obj.clip.left
	}
	else if ((ie) || (other)) {
		var clipv = obj.clip.split("rect(")[1].split(")")[0].split("px")
		if (which=="t") return Number(clipv[0])
		if (which=="r") return Number(clipv[1])
		if (which=="b") return Number(clipv[2])
		if (which=="l") return Number(clipv[3])
	}
}


function clip_to(obj,t,r,b,l) {
	if (ns) {
		obj.clip.top = t
		obj.clip.right = r
		obj.clip.bottom = b
		obj.clip.left = l
	}
	else if ((ie) || (other)) obj.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)"
}

function clip_by(obj,t,r,b,l) {
	if (ns) {
		obj.clip.top = clip_values(obj,'t') + t
		obj.clip.right = clip_values(obj,'r') + r
		obj.clip.bottom = clip_values(obj,'b') + b
		obj.clip.left = clip_values(obj,'l') + l
	}
	else if ((ie) || (other)) obj.clip = "rect("+(this.clip_values(obj,'t')+t)+"px "+(this.clip_values(obj,'r')+r)+"px "+Number(this.clip_values(obj,'b')+b)+"px "+Number(this.clip_values(obj,'l')+l)+"px)"
}


