// Create objects from divs and assign the following functions:
//	theObjs.objGetVisibility	find the object's visibility 
//	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
//	theObjs.objReplaceHTML		replaced the HTML code in the object
//	theObjs.objSetBGC			set the object's background color
//	theObjs.objSetColor			set the object's foreground color

var theObjs = new Array();

// Create objects from Divs
function createObjects() {
	if (domData.isIE4Up) { 
		createIEObjects(); 
	} else if (domData.isNN6Up) { 
		createDOMObjects(); 
	}
} // End createObjects() function


// Create object array from Divs named "dynamic", IE version
function createIEObjects() {
	theDivs = document.all.tags("div");
	for (var i = 0; i < theDivs.length; i++) {
		if (theDivs[i].id.indexOf("dynamic") == 0) {
			theObjs[theDivs[i].id] = new domObject(theDivs[i]);
			mNames[mNum] = theDivs[i].id;
			mNum ++;
		} else if (theDivs[i].id.indexOf("floater") == 0) {
			theObjs[theDivs[i].id] = new domObject(theDivs[i]);
		}
	}
} // End createIEObjects()


// Create object array from Divs named "dynamic", DOM version
function createDOMObjects() {
	theDivs = document.getElementsByTagName("div");
	for (var i = 0; i < theDivs.length; i++) {
		var obj = theDivs[i];
		if (obj.id.indexOf("dynamic") == 0) {
			theObjs[obj.id] = new domObject(obj); 
			mNames[mNum] = obj.id;
			mNum ++;
		} else if (theDivs[i].id.indexOf("floater") == 0) {
			theObjs[obj.id] = new domObject(obj); 
		}
	}
} // End createDOMObjects()


// 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;
	this.objReplaceHTML = domReplaceHTML;
	this.objSetBGC = domSetBGC;
	this.objSetColor = domSetColor;
} // End domObject(obj)


// Get element's top position
function domGetTop(top) {
	var tp = parseInt(this.css2.style.top);
	return tp;
} // End domGetTop(top)


// Get element's left position
function domGetLeft(left) {
	var lt = parseInt(this.css2.style.left);
	return lt;
} // End domGetLeft()


// Set element's top position
function domSetTop(top) {
	this.css2.style.top = top + "px";
} // End domSetTop(top)


// Set element's left position
function domSetLeft(left) {
	this.css2.style.left = left + "px";
} // End domSetLeft(left)


// Hide element
function domHide() {
	this.css2.style.visibility = "hidden";
} // End domHide()


// Show element
function domShow() {
	this.css2.style.visibility = "visible";
} // End domShow()


// Get element's width
function domGetWidth() {
	var wd = parseInt(this.css2.style.width);
	return wd;
} // End domGetWidth


// Get element's height
function domGetHeight() {
	var ht = parseInt(this.css2.style.height);
	return ht;
} // End domGetHeight()


// Set element's zindex order
function domSetZIndex(zindex) {
	this.css2.style.zIndex = zindex;
} // End domSetZIndex(zindex)


// Make absolute move
function domMoveAbsolute(newleft, newtop) {
	this.objSetLeft(newleft);
	this.objSetTop(newtop);
} // End domMoveAbsolute


// Make relative move
function domMoveRelative(left, top) {
	this.objSetLeft(left + this.objGetLeft());
	this.objSetTop(top + this.objGetTop());	 
} // End domMoveRelative


// Replace contents of object
function domReplaceHTML(stuffing) {
	this.css2.innerHTML = stuffing;
} // End domReplaceHTML


// Set object background Color
function domSetBGC(hex) {
	this.css2.style.backgroundColor = hex;
} // End domReplaceHTML


// Set object foreground Color
function domSetColor(hex) {
	this.css2.style.color = hex;
} // End domReplaceHTML

