
//find an object in a way that is compatible with most DOM's
function getObject (objName) {
    if (document.all) {return document.all[objName];}
    else if (document.layers && document.layers[objName] != null) {
      return document.layers[objName];
    }
    else {return parent.document.getElementById(objName);}
}

//used for a specific help functionality
function show(objName, event, xOffset, yOffset) {
  if (xOffset == null) {xOffset = 10;}
  if (yOffset == null) {yOffset = 20;}
  var x = event.clientX + xOffset + document.body.scrollLeft;
  var y = event.clientY + yOffset + document.body.scrollTop;
  
  if (document.layers && document.layers[objName] != null) {
   document.layers[objName].visibility = 'visible';
   document.layers[objName].top = y;    
   document.layers[objName].left = x;
  }
  else {
    var obj = getObject(objName);
    obj.style.visibility = 'visible';
    obj.style.top = y;    
    obj.style.left = x;
  }
}

//used for a specific help functionality
function hide(objName) {
  if (document.layers && document.layers[objName] != null) {
   document.layers[objName].visibility = 'hidden';
  }
  else {
    var obj = getObject(objName);
    if (obj == null || obj.style == null) {return;}
    obj.style.visibility = 'hidden';
  }
}

//designed to show an entire page section which may contain HTML
//code in a collapse-expand type of way
function showPageSection (objName) {
  var obj = getObject(objName);
  if (obj == null || obj.style == null) {return;}
  obj.style.visibility = 'visible';
  obj.style.position = 'static';  
}

//designed to show an entire page section which may contain HTML
//code in a collapse-expand type of way
function hidePageSection (objName) {
  var obj = getObject(objName);
  if (obj == null || obj.style == null) {return;}
  obj.style.visibility = 'hidden';
  obj.style.position = 'absolute';  
}

//either hides(contracts) or shows(expands) a section of a page
//which has been placed within a div tag with id="objName"
//typically starts out with style="visibility: hidden;position: absolute"
function togglePageSection (objName) {
  var obj = getObject(objName);
  if (obj.style.visibility == 'visible') {
    hidePageSection(objName);
  }
  else {showPageSection(objName);}
}

//designed to be used during development to find all 
//the functions and attributes of an object
//(alerts the results)
//the second parameter may be used to limit the type of attributes
//being found examples: string, number, function, object
function searchObject (obj, typeOfAttribute) {
    var partList = new Array();

    for (i in obj) {      
      var value = '';
      if (typeOfObj != null && typeof(obj[i]) != typeOfObj) {continue;}
      if (typeof(obj[i]) == 'string') {
        value = (obj[i]).substr(0, 45);
      }
      else if (typeof(obj[i]) != 'object') {
        value = obj[i];
      }
      
      partList.push(typeof(obj[i]) + ' ' + i + '= "' + value + '"');
    }
  alert(partList.sort().join(',   '));
}




