// dom wrapper
function LayerSearch() {
	this.getObject = function(id) {
		if (document.getElementById && document.getElementById(id)) {
			return document.getElementById(id);
		}
		if (document.all && eval('document.' + id)) {
			return eval('document.' + id);
		}
		if (document.layers) {
			return this.searchChild(document,id);
		}
		return null;
	}
	
	this.searchChild = function(obj,id) {
		var i = 0;
		var tmpObj = obj.layers
		var gotObj = null;
		var searchedObj = null;
		if (tmpObj) {
			for (i = 0; i < tmpObj.length; i++) {
				if (tmpObj[i].id == id) { gotObj = tmpObj[i]; }
				else { if (tmpObj[i].layers.length > 0) { searchedObj = this.searchChild(tmpObj[i], id); } }
				if (searchedObj) {
					gotObj = searchedObj;
				}
				
			}
		}
		return gotObj;
	}
}



function Layer(id) {
	this.obj = null;
	if (id) {
		var ls = new LayerSearch();
		this.obj = ls.getObject(id);
	}
	if (!this.obj) return null;
	if (document.layers) {
		this.width = this.obj.clip.right;
		this.height = this.obj.clip.bottom;
	}
	else {
		this.width = this.obj.style.width;
		this.height = this.obj.style.height;
	}

	this.setWidth = function(w) {
		this.width = w;
		this.obj.style.width = w;
	}

	this.setHeight = function(h) {
		this.height = h;
		this.obj.style.height = h;
	}
	
	this.setDisplay = function(v) {
			if (document.getElementById || document.all) {
				if (v == 'none') {
					this.obj.style.display = 'none';
					this.obj.style.visibility = 'hidden';
				}
				else {
					this.obj.style.display = 'block';
					this.obj.style.visibility = 'visible';
				}
			}
			else if (document.layers) {
				if (v == 'none') {
					this.obj.clip.bottom = 0;
					this.obj.visibility = 'hide';
					objRootMenu.obj.clip.bottom = 22;
				}
				else {
					this.obj.visibility = 'show';
					this.obj.clip.bottom = this.height;
					objRootMenu.obj.clip.bottom = objRootMenu.height;
				}

			}
	}
	this.left = 0;
}
