var ref_Collection = "";
var ref_CollectionEnd = "";
var ref_Style = "";

if (document.all) {
	ref_Collection = "all.";
	ref_Style = ".style";
}

if (parseInt(navigator.appVersion) >= 5 && navigator.appName.indexOf("Netscape") != -1) {
	isNetscape6 = 1;
	ref_Collection = "getElementById('";
	ref_CollectionEnd = "')";
	ref_Style = ".style";
} else {
	isNetscape6 = 0;
}

function layerHandler (objectName) {
	
	var ref_ObjectString = "document." + ref_Collection + objectName + ref_CollectionEnd;
	var ref_Object = eval (ref_ObjectString);
	// Check that the referenced object actually exists.
	//alert ("ref_Object:" + ref_Object + "\nref_ObjectString:" + ref_ObjectString + "\nobjectName:" + objectName);
	if (ref_Object) {
		this.obj = eval ("ref_Object" + ref_Style);
		this.content = ref_Object;
	} else {
		alert ("I don't seem to be able to reference the object.");
	}

	this.name = objectName;

	this.setTop = layerHandler_setTop;
	this.setLeft = layerHandler_setLeft;
	this.setPosition = layerHandler_setPosition;
	this.setWidth = layerHandler_setWidth;
	this.setHeight = layerHandler_setHeight;
	this.setSize = layerHandler_setSize;
	
	this.top = layerHandler_getTop;
	this.left = layerHandler_getLeft;
	this.width = layerHandler_getWidth;
	this.height = layerHandler_getHeight;
	
	this.show = layerHandler_show;
	this.hide = layerHandler_hide;
}

function layerHandler_setTop(y) {
	if (this.obj) {
		if (document.all) {
			this.obj.pixelTop = y;
		} else {
			this.obj.top = y;
		}
	} else {
		alert("I appear to have lost the object. Doh!");
	}
}

function layerHandler_setLeft(x) {
	if (this.obj) {
		if (document.all) {
			this.obj.pixelLeft = x;
		} else {
			this.obj.left = x;
		}
	}
}

function layerHandler_setPosition(x,y) {
	this.setLeft(x);
	this.setTop(y);
}

function layerHandler_getTop() {
	if (this.obj) {
		if (document.all) {
			return this.obj.pixelTop;
		} else {
			return this.obj.top;
		}
	}
}

function layerHandler_getLeft() {
	if (this.obj) {
		if (document.all) {
			return this.obj.pixelLeft;
		} else {
			return this.obj.left;
		}
	}
}

function layerHandler_setWidth(w) {
	if (this.obj) {
		if (isNetscape6) {
			this.obj.width = w;
		} else {
			if (document.all) {
				this.obj.clientWidth = w;
			} else {
				this.obj.clip.width = w;
			}
		}
	}
}

function layerHandler_setHeight(h) {
	if (this.obj) {
		if (isNetscape6) {
			this.obj.height = h;
		} else {
			if (document.all) {
				this.obj.clientWidth = h;
			} else {
				this.obj.clip.height = h;
			}
		}
	}
}

function layerHandler_setSize(w,h) {
	this.setWidth(w);
	this.setHeight(h);
}

function layerHandler_getWidth() {
	if (this.obj) {
		if (isNetscape6) {
			return this.obj.width;
		} else {
			if (document.all) {
				return this.content.clientWidth;
			} else {
				return this.obj.clip.width;
			}
		}
	}
}

function layerHandler_getHeight() {
	if (this.obj) {
		if (isNetscape6) {
			return this.obj.height;
		} else {
			if (document.all) {
				return this.content.clientHeight;
			} else {
				return this.obj.clip.height;
			}
		}
	}
}

function layerHandler_show() {
	if (this.obj) {
		this.obj.visibility = "visible";
	}
}

function layerHandler_hide() {
	if (this.obj) {
		this.obj.visibility = "hidden";
	}
}