/* /library/javascript/minimum.js -	

   DATE           AUTHOR    CHANGE
   28.07.2005  AgMcC       minimum script required throughout site

*/

// GLOBAL VARIABLES ---------------------------------------------------------------------------------------

var blnMac = (navigator.userAgent.toLowerCase().indexOf("mac") != -1) ? true : false;
var blnNs4 = (document.layers) ? true : false;
var blnIe4 = (document.all && !document.getElementById) ? true : false;
var blnIe5 = (document.all && document.getElementById) ? true : false;
var blnNs6 = (!document.all && document.getElementById) ? true : false;
var blnOpera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1) ? true : false;

// BROWSER DEPENDENCE CORE FUNCTIONS -----------------------------------------------------------------------

function ftnGetObjectString(strObjectId) {
/*Purpose	:	Used to return a string that represents the path to an object in the DOM
				    dependent on the browser being used.
	Effects	:	None
	Inputs	:	strObjectId - String - the id of an object
	Returns	:	String - the path to the object in the DOM
*/
	if(blnNs4) return "document." + strObjectId;
	if(blnIe4) return "document.all." + strObjectId;
	if(blnIe5 || blnNs6 || blnOpera){
		if (blnMac && blnIe5)
			return "document.all['" + strObjectId + "']";
		else
			return "document.getElementById('" + strObjectId + "')";
	}
}

function ftnGetObject(strObjectId) {
/*Purpose	:	Used to return an object in the DOM.
	Effects	:	None
	Inputs	:	strObjectId - String - the id of an object
	Returns	:	Object - the object in the DOM
*/
	var strEval = ftnGetObjectString(strObjectId);
	return eval(strEval);
}

function ftnGetObjLoc(objIn)
{
/*
	Purpose	:	Finds the position of the specified object relative to screen 0, 0.
	Effects	:	None.
	Inputs	:	objIn - Object - the object to find the position of.
	Returns	:	Object - an object containing .left and .top.
*/
	var objOut = new Object();
	objOut.left = objIn.offsetLeft;
	objOut.top = objIn.offsetTop;
	var objNewPos = objIn.offsetParent;
	while(objNewPos != null)
	{
		if (objNewPos.style) if (objNewPos.style.position=='absolute') break; 
		objOut.left += objNewPos.offsetLeft;
		objOut.top += objNewPos.offsetTop;
		objNewPos = objNewPos.offsetParent;
	}
	return objOut;
}