ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

function DynLayer(id,nestref)  {
	if (ns4) {
		this.css = (nestref) ? eval("document."+nestref+".document."+id) : document.layers[id]
		this.x = this.css.left
		this.y = this.css.top
	}
	else if (ie4)  {
		this.css = document.all[id].style
		this.x = this.css.pixelLeft
		this.y = this.css.pixelTop
	}
	
	this.show = DynLayerShow
	this.hide = DynLayerHide
	this.moveTo = DynLayerMoveTo
	this.moveBy = DynLayerMoveBy
}

function DynLayerMoveTo(x,y)  {
	if (x!=null)  {
		this.x = x
		this.css.left = this.x
	}
	if (y!=null)  {
		this.y = y
		this.css.top = this.y
	}
}

function DynLayerMoveBy(x,y)  {
	this.moveTo(this.x+x, this.y+y)
}

function DynLayerShow()  {
	this.css.visibility = (ns4)? "show" : "visible"
}

function DynLayerHide()  {
	this.css.visibility = (ns4)? "hide" : "hidden"
}

function layerWrite(id,nestref,text)  {
	if (ns4)  {
		if(nestref) var lyr = eval('document.'+nestref+'.document.'+id+'.document')
		else var lyr = document.layers[id].document
		lyr.open()
		lyr.write(text)
		lyr.close()
	}
	else if (ie4) document.all[id].innerHTML = text
}
