var debugDHTMLapi = true,
    getObjectBreakPtSet = false,
    showBreakPtSet = false,
    hideBreakPtSet = false;

// Convert object name string or object reference
// into a valid DHTML object reference
function getDHTMLObject(obj){
   if(debugDHTMLapi && getObjectBreakPtSet) alert("DHTMLapi.js: getDHTMLObject(): beginning.");
   if(debugDHTMLapi && getObjectBreakPtSet) alert("DHTMLapi.js: getDHTMLObject(): parameter: " + obj);
   var theObj;

   if(typeof obj == "string"){
      if(clientBrowser.isBrowserCompliant2("Netscape", "Microsoft Internet Explorer", ">=", 5) == true){
         theObj = document.getElementById(obj).style;
      } else {
         theObj = "document." + range + obj + styleObj;
      }
   } else {
      theObj = obj;
   }

   if(debugDHTMLapi && getObjectBreakPtSet) alert("DHTMLapi.js: getDHTMLObject(): returns " + theObj);
   return theObj;
}

// Convert object name string or object reference
// into a valid object reference
function getObject(obj){
   if(debugDHTMLapi && getObjectBreakPtSet) alert("DHTMLapi.js: getObject(): beginning.");
   if(debugDHTMLapi && getObjectBreakPtSet) alert("DHTMLapi.js: getObject(): parameter: " + obj);
   var theObj;

   if(typeof obj == "string"){
      if(clientBrowser.isBrowserCompliant2("Netscape", "Microsoft Internet Explorer", ">=", 5) == true){
         theObj = document.getElementById(obj);
      } else {
         theObj = "document." + range + obj + styleObj;
      }
   } else {
      theObj = obj;
   }

   if(debugDHTMLapi && getObjectBreakPtSet) alert("DHTMLapi.js: getObject(): returns " + theObj);
   return theObj;
}



// Positioning an object at a specific  pixel coordinate
function shiftTo(obj, x, y){
   var theObj = getDHTMLObject(obj);
   if(isNav4){
      theObj.moveTo(x,y);
   } else {
      theObj.pixelLeft = x;
      theObj.pixelTop = y;
   }
}

// Moving an object by x and/or y pixels
function shiftBy(obj, deltaX, deltaY){
   var theObj = getDHTMLObject(obj);
   if(isNav4){
      theObj.moveBy(deltaX, deltaY);
   } else {
      theObj.pixelLeft += deltaX;
      theObj.pixelTop += deltaY;
   }
}

// Setting the z-order of an object
function setZIndex(obj, zOrder){
   var theObj = getDHTMLObject(obj);
   theObj.zIndex = zOrder;
}

// Setting the background color of an object
function setBGColor(obj, color){
   var theObj = getDHTMLObject(obj);
   if(isNav4){
      theObj.bgColor = color;
   } else {
      theObj.backgroundColor  = color;
   }
}

// Setting the visibility of an object
function show(obj){
   if(debugDHTMLapi && showBreakPtSet) alert("DHTMLapi.js: showObj(): beginning.");
   if(debugDHTMLapi && showBreakPtSet) alert("DHTMLapi.js: showObj(): parameter: " + obj);
   var theObj = getDHTMLObject(obj);

   theObj.visibility = "visible";

   if(debugDHTMLapi && showBreakPtSet) alert("DHTMLapi.js: showObj(): " + theObj.id + ".visibility: " + theObj.visibility);
}

// Setting the visibility of an object
function hide(obj){
   if(debugDHTMLapi && hideBreakPtSet) alert("DHTMLapi.js: hideObj(): beginning.");
   if(debugDHTMLapi && hideBreakPtSet) alert("DHTMLapi.js: hideObj(): parameter: " + obj);
   var theObj = getDHTMLObject(obj);
   theObj.visibility = "hidden";
   if(debugDHTMLapi && hideBreakPtSet) alert("DHTMLapi.js: hideObj(): " + theObj.id + ".visibility: " + theObj.visibility);
}

// Retrieving the x coordinate of a positionalbe object
function getObjectLeft(obj){
   var theObj = getDHTMLObject(obj);
   if(isNav4){
      return theObj.left;
   } else {
      return theObj.pixelLeft;
   }
}

// Retrieving the y coordinate of a positionable object
function getObjectTop(obj){
   var theObj = getDHTMLObject(obj);
   if(isNav4){
      return theObj.top;
   } else {
      return theObj.pixelTop;
   }
}

// Retrieves the innerHTML of the a positionable object
function getInnerHTML(obj){
	var theObj = getObject(obj);
	return theObj.innerHTML;	
}

// Replaces the innerHTML text of the positionable object
function replaceInnerHTMLText(obj, newText){
	var theObj = getObject(obj);
	theObj.innerHTML = newText;	
}
