/***************************** generalFunctions.js ***************************** 
Author: Paul Kerrison
Creation Date: 01/08/07
Description: Common javascript functions 
Dependencies: None
*/

/*********************************** CONTENTS ***********************************

		1.  htmlObject(name) - Used to create a javascript HTML object
		2.  getElmt(elmtId) - Used to gain raw access to a HTML element (if possible create an object using htmlObject above)
		3.  checkExit(event) - Used to confirm the user wants to leave the page without saving changes
		4.  
		5.  
		6.  
		7.  
		8.  
		9.  
		10.
		11.
		12.
		13.
		14.
		15.
		
*********************************** END CONTENTS ***********************************/

//Uncomment the following line to check the file is being loaded
//alert("Loaded Javascript file: General Functions");


//Set up global variable to indicate whether the browser supports dhtml operations
var DHTML = (document.getElementById || document.all || document.layers);

//1. Used to create a javascript HTML object
function htmlObject(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

//2. Used to gain raw access to a HTMl element (if possible create an object using htmlObject above)
function getElmt(elmtId){
	var elmt;
	if (document.all){
		elmt = document.all[elmtId];
	}else{
		elmt = document.getElementById(elmtId);
	}
	return elmt;
}
//3. Used to confirm the user wants to leave the page without saving changes
function checkExit(event){
	if(dirty) {
		msg = "You have made unsaved changes.\nIf you close this window they will be lost";
		if(window.event) {
	    	window.event.returnValue = msg;
	   	}else{
	    	event.returnValue = msg;
	   	}
  	} 
 }

