/**
 * @projectDescription DOM - Cross Browser DOM External File
 * Copyright 2007 Strictlyhelicopters
 * License GNU Public License V2.0
 * $Revision: 60 $ 
 * $Id: findDOM.js 60 2007-09-20 20:42:07Z svn $
 * File: http://www.hayward.server/svn/lib/javascript/dom/findDOM.js
 * $HeadURL: svn://hayward/lib/javascript/dom/findDOM.js $
 * 
 * Notes:
 *  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.
 *  
 *  The following code needs to be implemented to properly support Firefox
 *  
 *  Test for Firefox and newer browsers if different.
 *  if (!document.all && document.getElementById) IE4 & firefox
 *    need to further research this.
 */


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;}
          }
      }