// domobjsx.js -- Object Creation Script with Partial Feature Set:
//	theObjs.objHide				hide the object 
//	theObjs.objShow				show the object
//	theObjs.objGetTop			find the object's top coordinate (y)
//	theObjs.objGetLeft			find the object's left coordinate (x)
//	theObjs.objSetTop			set the object's top coordinate (y)
//	theObjs.objSetLeft			set the object's top coordinate (x)
//	theObjs.objMoveAbsolute		move the object to coordinate x,y
//	theObjs.objMoveRelative		move the object x and/or y pixels
//	theObjs.objSetZIndex		reset the objet's z-index
//	theObjs.objGetWidth			find the object's width
//	theObjs.objGetHeight		find the object's height

// BEGIN Create objects from Divs
function createObjects() {
	if (domData.isNN4) { createN4Objects(); 
	} else if (domData.isIE4up) { createIEObjects(); 
	} else if (domData.isNN6up) { createDOMObjects(); }
} // END create_objects() function


// BEGIN For IE, pull DIV blocks into object array
function createIEObjects() {
	theDivs = document.all.tags("div");
	theObjs = new Array();
	for (i = 0; i < theDivs.length; i++) {
		if (theDivs[i].id != "") {
			theObjs[theDivs[i].id] = new domObject(theDivs[i]);
		}
	}
} // END createIEObjects()


// BEGIN For Navigator 4.x, pull layer blocks into object array
function createN4Objects() {
	theObjs = new Array();
	for (i = 0; i < document.layers.length; i++) {
		if (document.layers[i].name != "") {
			theObjs[document.layers[i].name] = new n4Object(document.layers[i]);
		}
	}
} // END createN4Ojbects()


// BEGIN For W3C DOM (Navigator 6.x, Mozilla), pull DIV blocks into object array
function createDOMObjects() {
	theDivs = document.getElementsByTagName("div");
	theObjs = new Array();
	for (i = 0; i < theDivs.length; i++) {
		var obj = theDivs[i];
		if (obj.id != "") { 
			theObjs[obj.id] = new domObject(obj); 
		}
	}
} // END createDOMObjects()


// BEGIN Establish properities of the DOM; also works for IE 4.x and 5.x Object
function domObject(obj) {
	this.css2 = obj;
	this.name = obj.id;
	this.objHide = domHide; 
	this.objShow = domShow;
	this.objGetTop = domGetTop;
	this.objGetLeft = domGetLeft;
	this.objSetTop = domSetTop;
	this.objSetLeft = domSetLeft;
	this.objMoveAbsolute = domMoveAbsolute;
	this.objMoveRelative = domMoveRelative;
	this.objSetZIndex = domSetZIndex;
	this.objGetWidth = domGetWidth;
	this.objGetHeight = domGetHeight;
} // END ie_object(obj)


// BEGIN Establish properities of the Netscape object
function n4Object(obj) {
	this.css2 = obj;
	this.name = obj.name;
	this.objGetTop = nnGetTop;
	this.objGetLeft = nnGetLeft;
	this.objHide = nnHide;
	this.objShow = nnShow;
	this.objSetTop = nnSetTop;
	this.objSetLeft = nnSetLeft;
	this.objGetWidth = nnGetWidth;
	this.objGetHeight = nnGetHeight;
	this.objMoveAbsolute = domMoveAbsolute;
	this.objMoveRelative = domMoveRelative;
	this.objSetZIndex = nnSetZIndex;
} // END n4Object(obj)


// BEGIN DOM and IE get element's top position
function domGetTop(top) {
	var tp = parseInt(this.css2.style.top);
	return tp;
} // END domGetTop(top)


// BEGIN DOM and IE get element's left position
function domGetLeft(left) {
	var lt = parseInt(this.css2.style.left);
	return lt;
} // END domGetLeft()


// BEGIN DOM and IE set element's top position
function domSetTop(top) {
	this.css2.style.top = top + "px";
} // END domSetTop(top)


// BEGIN DOM and IE set element's left position
function domSetLeft(left) {
	this.css2.style.left = left + "px";
} // END domSetLeft(left)


// BEGIN DOM and IE hide element
function domHide() {
   this.css2.style.visibility = "hidden";
} // END domHide()


// BEGIN DOM and IE show element
function domShow() {
   this.css2.style.visibility = "visible";
} // END domShow()


// BEGIN DOM and IE get element's width
function domGetWidth() {
	var wd = parseInt(this.css2.style.width);
	return wd;
} // END domGetWidth


// BEGIN DOM and IE get element's height
function domGetHeight() {
	var ht = parseInt(this.css2.style.height);
	return ht;
} // END domGetHeight()


// BEGIN DOM and IE set element's zindex order
function domSetZIndex(zindex) {
   this.css2.style.zIndex = zindex;
} // END domSetZIndex(zindex)


// BEGIN make absolute move
function domMoveAbsolute(newleft,newtop) {
   this.objSetLeft(newleft);
   this.objSetTop(newtop);
} // END domMoveAbsolute


// BEGIN make relative move
function domMoveRelative(left,top) {
   this.objSetLeft(left + this.objGetLeft());
   this.objSetTop(top + this.objGetTop());    
} // END domMoveRelative


// BEGIN Netscape 4.x hide element
function nnHide() {
	this.css2.visibility = "hidden";
} // END nnHide


// BEGIN Netscape 4.x show element
function nnShow() {
	this.css2.visibility = "inherit";
} // END nnShow()


// BEGIN Netscape 4.x get element's left position
function nnGetLeft() {
	return this.css2.left;
} // END nnGetLeft()


// BEGIN Netscape 4.x get element's top position
function nnGetTop () {
	return this.css2.top;
} // END nnGetTop()


// BEGIN Netscape 4.x set element's top position
function nnSetTop(top) {
	this.css2.top = top;
} // END nnSetTop(top)


// BEGIN Netscape 4.x set element's left position
function nnSetLeft(left) {
	this.css2.left = left;
} // END nnSetLeft(left)


// BEGIN Netscape 4.x get element's width
function nnGetWidth() {
	return this.css2.clip.width;
} // END nnGetWidth()


// BEGIN Netscape 4.x get element's height
function nnGetHeight() {
	return this.css2.clip.height;
} // END nnGetHeight()


// BEGIN Netscape 4.x set element's zindex order
function nnSetZIndex(zindex) {
	this.css2.zIndex = zindex;
} // END nnSetZindex(zindex)


