// File: dom.js
//  Determine DOM 
// Requirements: None

function Browser() {
	// Browser Class
	// set browser variables
	this.name = navigator.appName;
	this.version = parseInt(navigator.appVersion);

	this.ns   = (this.name == "Netscape" && this.version > 3);
	this.ns4 = (this.name == "Netscape" && this.version == 4);
	this.ns5 = (this.name == "Netscape" && this.version == 5);
	this.ns6 = (this.name == "Netscape" && this.version == 6);

	this.ie   = (navigator.appVersion.indexOf('MSIE') > -1);
	this.ie4 = (navigator.appVersion.indexOf('MSIE 4') > -1);
	this.ie5 = (navigator.appVersion.indexOf('MSIE 5') > -1);
	this.ie6 = (navigator.appVersion.indexOf('MSIE 6') > -1);

	// initialize DOM variables
	this.Layers = false;
	this.All = false;
	this.W3C = false;

	// determine DOM Type
	if (document.getElementById) {this.W3C = true;}
	else if (document.all) {this.All = true;}
	else if (document.layers) {this.Layers = true;}

	this.dynamic = (this.Layers || this.All || this.W3C);
}

// Create new Browser object
 var dom = new Browser();

function getObject(id) {
	// This function returns an object ("object") with 2 properties: "object.id" and "object.style".
	// The object.id property is the object reference.
	// The object.style property is the object.style reference.
	// If the DOM is not recognized, the function returns a null Object;

	var object = new Object();

	if (dom.W3C) { 
		object.id = document.getElementById(id);
		object.style = document.getElementById(id).style;
	} else if (dom.All) { 
		object.id = document.all[id];
		object.style = document.all[id].style;
	} else if (dom.Layers) { 
		object.id = document.layers[id];
		object.style = document.layers[id];
	}
	return (object) ;
}



