	//
	//	This function will create a new child node for the given parent.
	//	The new node will be created after the last child for this parent.
	//
	function appendNode(docpath, sNewName, sParentName, sStyle, sContent, sNewNodeType) {
		var MainNode = docpath.getElementById(sParentName);
		var newNode = docpath.createElement(sNewNodeType);	// this will create a new div
		newNode.setAttribute('name', sNewName);
		newNode.setAttribute('id', sNewName);
		newNode.setAttribute('style', sStyle);
		MainNode.appendChild(newNode);		// add on the new div
		if (sContent.length > 0 ) {
			newNode.innerHTML = sContent;
		}
	}
	
	//	
	//	This function loops through all elements of a radio group to determine which
	//	one is selected and returns the value of the selected item
	//
	function getRadioValue(rRadioObject) {
		if ( typeof rRadioObject.value != "undefined" ) {
			return rRadioObject.value;
		} else {
			var nRadioElements = rRadioObject.length;
	
			for (var i=0; i < nRadioElements; i++) {
				if (rRadioObject[i].checked == true) {
					return rRadioObject[i].value;
				}
			}    
		}
	}
	
	//
	//	This function will toggle the given element between inline and none display values
	//
	function toggleElement(sElement) {
		ThisElement = document.getElementById(sElement);
		if (ThisElement.style.display == "inline") {
			ThisElement.style.display = "none";
		} else {
			ThisElement.style.display = "inline";
		}
	}
		
	//
	//	This function will toggle the given element between inline and none display values
	//
	function toggleBlockElement(sElement) {
		ThisElement = document.getElementById(sElement);
		if (ThisElement.style.display == "block") {
			ThisElement.style.display = "none";
		} else {
			ThisElement.style.display = "block";
		}
	}
	
		//
		//	Will give the user a warning and truncate the specified field value to the specified number of characters
		//
	function limitChars(eItem, nLimit) {
		if ( eItem.value.length > nLimit ) {
			alert("There is a limit of " + nLimit + " characters on this item.  Your entry will be truncated to "  + nLimit + " characters.");
			eItem.value = eItem.value.substring(0, nLimit);
		}
	}
		//
		//	Returns true if the passed value is found in the array.  Returns false if it is not.
		//	The syntx below will assign this is a function to all arrays
		//
	Array.prototype.inArray = function (value)
	{
		var i;
		for (i=0; i < this.length; i++) {
			// Matches identical (===), not just similar (==).
			if (this[i] === value) {
				return true;
			}
		}
		return false;
	}
	
	// function takes a display NAME and the VALUE for the new element and then adds it to the dropdown specified in the other parameter
	function addOption(whichDD,name,value) {
		// create a reference to the SELECT and the form
		var theDD=eval(whichDD);
	 
		// create the new OPTION
		var newOption;
		newOption= new Option (name,value);
	 
		// position
		var insertAt = theDD.options.length;
	 
		// create the space
		theDD.options.length=theDD.options.length + 1;
	 
		// add the option
		theDD.options[insertAt] = newOption;
	}
	
		//
		//	This function will select the proper option from a select element based on value
		//
	function setSelectedItem(eDD, nValue) {
		for ( i=0; i<eDD.options.length; i++ ) {
			if ( eDD.options[i].value == nValue ) {
				eDD.options[i].selected = true;
			}
		}
	}

		//
		//	This function will select the proper option from a select element based on value
		//
	function setSelectedItem(eDD, nValue) {
		for ( i=0; i<eDD.options.length; i++ ) {
			if ( eDD.options[i].value == nValue ) {
				eDD.options[i].selected = true;
			}
		}
	}
	
	function compareText (option1, option2) {
	  return option1.text < option2.text ? -1 :
		option1.text > option2.text ? 1 : 0;
	}
	function compareValue (option1, option2) {
	  return option1.value < option2.value ? -1 :
		option1.value > option2.value ? 1 : 0;
	}
	function compareTextAsFloat (option1, option2) {
	  var value1 = parseFloat(option1.text);
	  var value2 = parseFloat(option2.text);
	  return value1 < value2 ? -1 :
		value1 > value2 ? 1 : 0;
	}
	function compareValueAsFloat (option1, option2) {
	  var value1 = parseFloat(option1.value);
	  var value2 = parseFloat(option2.value);
	  return value1 < value2 ? -1 :
		value1 > value2 ? 1 : 0;
	}
	function sortSelect (select, compareFunction) {
	  if (!compareFunction)
		compareFunction = compareText;
	  var options = new Array (select.options.length);
	  for (var i = 0; i < options.length; i++)
		options[i] = 
		  new Option (
			select.options[i].text,
			select.options[i].value,
			select.options[i].defaultSelected,
			select.options[i].selected
		  );
	  options.sort(compareFunction);
	  select.options.length = 0;
	  for (var i = 0; i < options.length; i++)
		select.options[i] = options[i];
	}
	