/**********************************************************************************************************************
Function:		replace
Purpose:		Replaces all occurances of one substring with another substring in a string.
Parameters:		string		(string)		The string which is having its text replaced
				text		(string)		The text to search for, which is being replaced
				by			(string)		The string that is replacing the search text
**********************************************************************************************************************/
function replace(string, text, by) {
	// Replaces all occurances of text with by in string
    
	var strLength = string.length;
	var txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) {
		return string;
	}
    
	var i = string.indexOf(text);
	if ((!i) && (text != string.substring(0,txtLength))) {
		return string;
	}
    if (i == -1) {
		return string;
	}
    
	var newstr = string.substring(0,i) + by;
    if (i+txtLength < strLength) {
        newstr += replace(string.substring(i+txtLength,strLength),text,by);
	}

    return newstr;
}


/**********************************************************************************************************************
Function:		getObj
Purpose:		Assuming a version 5 browser or higher, will return a reference to an object of the specified name
Parameters:		targetName	(string)		Name of the target object
**********************************************************************************************************************/
function getObj(targetName)
{
	var target = null;
	if (document.getElementById) { // NS6+
		target = document.getElementById(targetName);
	} else if (document.all) { // IE4+
		target = document.all[targetName];
	}
	
	return target;
}

