/*----------------------------------------
INCUBATE by Hatchling Studios
FILENAME: 	dom.func.js
CREATED BY:	Ian Muir
CREATED ON: 01/10/05
MODULE:		Global

DESCRIPTION:
This file is for finding DOM elements across 
browsers.

FUNCTIONS:
find_dom(object_id) : Returns vaild dom object
find_style(object_id) : Returns style object

CLASSES:
none

REQUIREMENTS:
none
----------------------------------------*/

var is_dhtml = 0; //set to 1 if browser supports DHTML
var is_id = 0; //set to 1 if browser uses docuemnt.GetElementByID
var is_all = 0; //set to 1 if browser uses document.all
var is_layers = 0; //set to 1 if browser is crappy old netscape


// Determine DOM format
if(document.getElementById){
	is_id = 1;
	is_dhtml = 1;
}else if(document.all){
	is_all = 1;
	is_dhtml = 1;
}else if(document.layers){
	is_layers = 1;
	is_dhtml = 1;
}else{
	alert("You're browser is not DHTML compatible. Please update your browser. Firefox, Internet Explorer for PC, and Safari are all valid browsers.");	
	alert(document.getElementByID);
} 

//FUNCTIONS

	/*FUNCTION: find_dom(str object_id)
	  ARGS:
	  -str object_id : the id name of the element
	  DESCRIPTION:
	  This function returns the proper object for the
	  DOM determined above.*/
	  
	  function find_dom(object_id){
	  	if(is_id){
		  	return (document.getElementById(object_id));
	  	}else if(is_all){
		  	return (document.all[object_id]);
	  	}else if(is_layers){
		  	return (document.layers[object_id]);
	  	}else{
		 	alert("DOM object cannot be found. Your browser doesn't support DHTML");
		 	return false; 	
	  	}
	  }
	//END FUNCTION: find_dom
	
	/*FUNCTION: find_style(str object_id))
	  ARGS:
	  -str object_id : the id name of the element
	  DESCRIPTION:
	  This function returns the proper style for the
	  DOM determined above.*/
	  
	  function find_style(object_id){
	  	if(is_id){
		  	return (document.getElementById(object_id).style);
	  	}else if(is_all){
		  	return (document.all[object_id].style);
	  	}else if(is_layers){
		  	return (document.layers[object_id]);
	  	}else{
		 	alert("DOM object cannot be found. Your browser doesn't support DHTML");
		 	return false; 	
	  	}	  
	  }
	//END FUNCTION: example_function
