function DynLibLayer(id) {
	if (is.ns) {
		this.elm = document.getElementById(id)
		this.css = this.elm.style
		this.doc = document
		this.x = this.css.left
		this.y = this.css.top
		this.w = this.css.clip.width
		this.h = this.css.clip.height
	}
	else if (is.ie) {
		this.elm = this.event = document.all[id]
		this.css = document.all[id].style
		this.doc = document
		this.x = this.elm.offsetLeft
		this.y = this.elm.offsetTop
		this.w = (is.ie4)? this.css.pixelWidth : this.elm.offsetWidth
		this.h = (is.ie4)? this.css.pixelHeight : this.elm.offsetHeight
	}
	else {
        // W3C DOM compliant
        this.elm = this.event = document.getElementById(id);
        this.css = this.elm.style;
    }
	this.z=this.css.zIndex;
	this.id = id
	this.obj = id + "Object"
	eval(this.obj + "=this")
}

if (is.ns) {
	DynLibLayer.prototype._setX=function(){ this.css.left=this.x; };
	DynLibLayer.prototype._setY=function(){ this.css.top=this.y; };
} else {
	DynLibLayer.prototype._setX=function(){ this.css.pixelLeft=this.x; };
	DynLibLayer.prototype._setY=function(){ this.css.pixelTop=this.y; };
};
DynLibLayer.prototype.moveTo=function(x,y) {
	if (x!=null) this.x=x;
	if (y!=null) this.y=y;
	if (this.css==null) return;
	this._setX();
	this._setY();
};
DynLibLayer.prototype.moveBy=function(x,y) {
	this.moveTo(this.x+x,this.y+y);
};
DynLibLayer.prototype.setX=function(x) { this.moveTo(x,null); };
DynLibLayer.prototype.setY=function(y) { this.moveTo(null,y); };
DynLibLayer.prototype.getX=function() { return this.x; };
DynLibLayer.prototype.getY=function() { return this.y; };
DynLibLayer.prototype.setVisible=function(b) {
	this.visible=b;
	if (this.css==null) return;
	this.css.visibility = b? "inherit" : (is.ns4?"hide":"hidden");
};
DynLibLayer.prototype.getVisible=function() {
	return this.visible;
};
DynLibLayer.prototype.setBgColor=function(color) {
	if (color==null) {
		if (is.ns4) color=null;
		else color='transparent';
	}
	this.bgColor=color;
	if (this.css==null) return;
	if (is.ns4) this.doc.bgColor=color;
	else this.css.backgroundColor=color;
};
DynLibLayer.prototype.getBgColor=function() {
	return this.bgColor;
};
DynLibLayer.prototype.setSize = function(w,h) {
	this.w=(w==null)?this.w:w<0?0:w;
	this.h=(h==null)?this.h:h<0?0:h;
	if (this.w==null&&this.h==null) return;
	if (this.css!=null) {
		if (is.ns4) {
			this.css.clip.width = this.w;
			this.css.clip.height = this.h;
			}
		else {
			this.css.width = this.w;
			this.css.height = this.h;
			this.css.clip = 'rect(0px '+(this.w||0)+'px '+(this.h||0)+'px 0px)';
		}
	}
};
DynLibLayer.prototype.setWidth=function(w) {
	this.w=(w==null)?this.w:w<0?0:w;
	if (this.w==null) return;
	if (this.css!=null) {
		if (is.ns4) this.css.clip.width = this.w;
		else {
			this.css.width = this.w;
			this.css.clip = 'rect(0px '+(this.w||0)+'px '+(this.h||0)+'px 0px)';
		}
	}
};
DynLibLayer.prototype.setHeight=function(h) {
	this.h=(h==null)?this.h:h<0?0:h;
	if (this.h==null) return;
	if (this.css!=null) {
		if (is.ns4) this.css.clip.height = this.h;
		else {
			this.css.height = this.h;
			this.css.clip = 'rect(0px '+(this.w||0)+'px '+(this.h||0)+'px 0px)';
		}
	}
};
DynLibLayer.prototype.getWidth=function() {
	return this.w;
};
DynLibLayer.prototype.getHeight=function() {
	return this.h;
};
DynLibLayer.prototype.setZIndex=function(z) {
	this.z=z;
	if (this.css==null) return;
	this.css.zIndex=z;
};
DynLibLayer.prototype.getZIndex=function() {
	return this.z;
};
DynLibLayer.prototype.setClassName=function(name) {
	this.elm.className=name;
	if (this.css==null) return;
};
DynLibLayer.prototype.getClassName=function() {
	return this.elm.className;
};
if (is.ns4) {
	DynLibLayer.prototype._setHTML=function(html) {
		this.doc.open();
		this.doc.write(html);
		this.doc.close();
	}
} else {
	DynLibLayer.prototype._setHTML=function(html) {
		this.elm.innerHTML=html;
	}
};
DynLibLayer.prototype.setHTML=function(html) {
	if (this.css==null) return;
	this._setHTML(html);
}
DynLibLayer.prototype.getHTML=function() {
	return this.html;
};
