function ShowLayer() {
	this.css.visibility = "visible";
}
LayerObject.prototype.show = ShowLayer;

function HideLayer() {
	this.css.visibility = "hidden";
}
LayerObject.prototype.hide = HideLayer;

function CutLayer() {
	this.css.display = "none"; 
}
LayerObject.prototype.cut = CutLayer;

function PasteLayer(displaytype) {
	if (!displaytype) displaytype="block";
	this.css.display = displaytype; 
}
LayerObject.prototype.paste = PasteLayer;

function RewriteLayer(string) {
	if (document.layers) {
		with (this.d) {
			open();
			writeln(string);
			close();
		}
	}
	else { this.d.innerHTML = string; }
}
LayerObject.prototype.rewrite = RewriteLayer;

function ClipLayer(t,r,b,l) {
	if (document.layers) {
		with (this.css.clip) {
			top = t;
			right = r;
			bottom = b;
			left = l;
		}
	}
	else { this.css.clip = "rect("+ t +"px, "+ r +"px, "+ b +"px, "+ l +"px)"; }
}
LayerObject.prototype.setClip = ClipLayer;

function SetLayerXpos(x){
	if (!document.getElementById && document.all) { this.css.pixelLeft = x + 'px'; }
	else              { this.css.left      = x + 'px'; }
}
LayerObject.prototype.setLeft = SetLayerXpos;

function SetLayerYpos(y){
	if (!document.getElementById && document.all) { this.css.pixelTop = y + 'px';; }
	else              { this.css.top      = y + 'px'; }
}
LayerObject.prototype.setTop = SetLayerYpos;

function SetLayerXYpos(x,y){
	this.setLeft(x);
	this.setTop(y); 
}
LayerObject.prototype.setPos = SetLayerXYpos;

function SetPositionType(type){
	this.css.position = type;
}
LayerObject.prototype.setPositionType = SetPositionType;

function SetZIndex(index){
	this.css.zIndex = index;
}
LayerObject.prototype.setZindex = SetZIndex;

function SetLayerOverflow(type){
	if (!document.layers) this.css.overflow = type;
}
LayerObject.prototype.setOverflow = SetLayerOverflow;


function SetClassName(string){
	if (!document.layers) this.d.className = string;
}
LayerObject.prototype.setClass = SetClassName;

function GetClassName(){
	if (!document.layers) return this.d.className;
}
LayerObject.prototype.getClass = GetClassName;

function SetLayerHeight(value){
	this.css.height = value; 
}
LayerObject.prototype.setHeight = SetLayerHeight;

function SetLayerWidth(value){
	this.css.width = value;
}
LayerObject.prototype.setWidth = SetLayerWidth;


function GetLayerHeight(){
	if (document.layers) { this.height = this.d.height; }
	else                 { this.height = this.d.offsetHeight; }
	return this.height;
}
LayerObject.prototype.getHeight = GetLayerHeight;

function GetLayerWidth(){
	if (document.layers)  { this.width = this.d.width; }
	else                  { this.width = this.d.offsetWidth; }
	return this.width;
}
LayerObject.prototype.getWidth = GetLayerWidth;

function GetLayerYpos () {
	if (document.all) { this.y = this.css.pixelTop; }
	else              { this.y = this.css.top; }
/* neu seit 17.01.2007 */
	if (document.getElementById) this.y = this.d.offsetTop;

	if (isNaN(this.y)) this.y = parseInt(this.y.substring(0,this.y.lastIndexOf('px')));
	return this.y;
}
LayerObject.prototype.getTop = GetLayerYpos;

function GetLayerXpos () {
	if (document.all) { this.x = this.css.pixelLeft; }
	else              { this.x = this.css.left; }
/* neu seit 17.01.2007 */
	if (document.getElementById) this.x = this.d.offsetLeft;

	if (isNaN(this.x))  this.x = parseInt(this.x.substring(0,this.x.lastIndexOf('px')));
	return this.x;
}
LayerObject.prototype.getLeft = GetLayerXpos;

function GetLayerXYpos(){
	this.x = this.getLeft();
	this.y = this.getTop();
}
LayerObject.prototype.getPos = GetLayerXYpos;


function GetLayerVisibility(){
	if (this.css.visibility == "hidden" || this.css.visibility == "hide") { return false; }
	else { return true; }
}
LayerObject.prototype.getVisibility = GetLayerVisibility;

function GetDisplay() {
	return this.css.display; 
}
LayerObject.prototype.getDisplay = GetDisplay;


function SwitchLayerVisibility() {
	if (this.css.visibility == "hidden" || this.css.visibility == "hide") { 
		this.show(); 
	}
	else {
		this.hide(); 
	}
}
LayerObject.prototype.switchVisibility = SwitchLayerVisibility;


function SwitchCutAndPaste() {
	if (this.css.display == "none") {
		this.paste();
	}
	else {
		this.cut();
	}
}
LayerObject.prototype.switchDisplay = SwitchCutAndPaste;


function switchShowAndHide() {
	if (this.css.visibility == "hidden") {
		this.show();
	}
	else {
		this.hide();
	}
}



function RotateLayer(kreis,radius,mitteX,mitteY,bewegung,zeit) {
	this.kreis    = kreis;
	this.radius   = radius;
	this.mitteX   = mitteX;
	this.mitteY   = mitteY;
	this.bewegung = bewegung;  						// hier 3 Grad je Zyklus
	this.zeit     = zeit;    						// alle 20 millisek.
	this.timeout  = "";
	this.bogen   = (this.kreis*Math.PI/180);		// in Bogenmaß umrechnen, da sin und
	this.r_x = this.mitteX + (Math.sin(this.bogen) * this.radius);
	this.r_y = this.mitteY + (Math.cos(this.bogen) * this.radius);

	this.setPos(this.r_x,this.r_y);
	
	this.kreis += this.bewegung;
	if(this.kreis > 360) { this.kreis = 0; clearTimeout(this.timeout); }	   	// bei 360 Grad ist der Kreis voll
	else {										 	// müssen wir wohl bei null wieder anfangen
		this.timeout = setTimeout(this.id+".rotate("+this.kreis+","+this.radius+","+this.mitteX+","+this.mitteY+","+this.bewegung+","+this.zeit+")",this.zeit);
	}
}
LayerObject.prototype.rotate = RotateLayer;

function ChangeOpacity (opacity) {
     this.css.opacity = (opacity/100);
     this.css.MozOpacity = (opacity/100);
     this.css.KhtmlOpacity = (opacity/100);
     this.css.filter = "alpha(opacity=" + opacity + ")";
}
LayerObject.prototype.setOpacity = ChangeOpacity;


function LayerObject(id){
	this.id = id;

	if (document.all)            { this.d = document.all[this.id]; }
	if (document.layers)         { this.d = document.layers[this.id].document; }
	if (document.getElementById) { this.d = document.getElementById(this.id); }
	
	if (document.layers) { this.css = document.layers[this.id]; }
	else                 { this.css = this.d.style; }

	this.x = this.getLeft(); 
	this.y = this.getTop();

	this.width  = this.getWidth();
	this.height = this.getHeight();

	this.o = "";
	
	this.visibility = this.getVisibility();
//	this.setClip(0,this.width,(this.y+this.height),0);
}
