
/****************************************************************
	INIZIALIZZAZIONE DEGLI OGGETTI LAYER E DEI METODI PRINCIPALI
****************************************************************/

function layerObj(id,x,y,vi,z) {
	if (ns4) {
		this.elm = document.layers[id]
		this.css = this.elm
		this.x = this.css.left
		this.y = this.css.top
		this.w = this.css.clip.width
		this.h = this.css.clip.height
		this.vi = this.css.visibility
		this.z = this.css.zIndex
	}
	else if (ie4) {
		this.elm = document.all[id]
		this.css = this.elm.style
		this.x = this.elm.offsetLeft
		this.y = this.elm.offsetTop
		this.vi = this.css.visibility
		this.z = this.css.zIndex
		this.w = this.css.offsetWidth
		this.h = this.css.offsetHeight
	}
	this.obj = id + "layerObj"
	eval(this.obj + "=this")
	this.show = layerObjShow
	this.hide = layerObjHide
	this.moveTo = layerObjMoveTo
	this.moveBy = layerObjMoveBy
	this.zetaPlus = layerObjZetaPlus
}


function layerObjShow() {
	this.vi = (ns4) ? "show" : "visible"
	this.css.visibility = this.vi
}

function layerObjHide() {
	this.vi = (ns4) ? "hide" : "hidden"
	this.css.visibility = this.vi
}

function layerObjMoveTo(x,y) {
	if (x!=null) {
		this.x = x
		if (ns4) this.css.left = this.x
		else this.css.pixelLeft = this.x
	}
	if (y!=null) {
		this.y = y
		if (ns4) this.css.top = this.y
		else this.css.pixelTop = this.y
	}
}

function layerObjMoveBy(x,y) {
	this.moveTo(this.x+x,this.y+y)
}

function layerObjZetaPlus(x) {
	this.z = ((this.z+x)>=0) ? (this.z+x) : this.z 
	this.css.zIndex = this.z
}
