// Cross Browser DOM External File 
// Filename: findDOM.js
//   Due to the differences in how the major browsers implement the DOM
//   it is necessary to detect the browser by testing for the particular
//   DOM supported. Each DOM is tested and returns the correct root 
//   DOM statement that matches the browser.
//   After first DOM is supported, testing stops.

var isDHTML = 0;     // 1 if browser supports DHTML
var isID = 0;        // 1 if browser supports W3C DOM
var isAll = 0;       // 1 if browser supports Internet Explorer DOM
var isLayers = 0;    // 1 if browser supports Netscape DOM

function findDOM(objectID,withStyle) {
  if (withStyle == 1) {
    if (isID) { return (document.getElementById(objectID).style); }
	else if (isAll) { return (document.all[objectID].style); }
	else if (isLayers) { return (document.layers[objectID]); }
  }
  else {
    if (isID) { return (document.getElementById(objectID)); }
	else if (isAll) { return (document.all[objectID]); }
	else if (isLayers) { return (document.layers[objectID]); }
  }
}

function reloadPage() {  // Navigator 4 fix
  if (innerWidth != origWidth || innerHeight != origHeight) location.reload; 
}	

// Main Programs
  if (document.layers) { origWidth = innerWidth; origHeight = innerHeight; }  // nav4reload
  if (document.layers) onresize = reloadPage();
  
  if (document.getElementById) {isID = 1; isDHTML = 1;}  // Set browser style variables
    else {
      if (document.all) {isAll = 1; isDHTML = 1;}
        else {
          browserVersion = parseInt(navigator.appVersion);
          if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {
            isLayers = 1; isDHTML = 1;}
          }
      }