//added by Rob Cameron 4/7/04

//returns string value based on which of a group of radio buttons is selected

function FormUtils_getRadioButtonValue(radioSetName) {

	var radioValue = null;

	var radioSet = document.getElementsByName(radioSetName);

	for (var i = 0; i < radioSet.length; i++) {

		if (radioSet[i].checked){

			var radioValue = radioSet[i].value;

			break;

		}

	}

	return radioValue;

}



function FormUtils_setRadioButtonValue(radioSetName,valueToSet) {

	var radioValue = null;

	var radioSet = document.getElementsByName(radioSetName);

	for (var i = 0; i < radioSet.length; i++) {

		if (radioSet[i].value == valueToSet){

			radioSet[i].checked = true;

			break;

		}

	}

	return true;

}





//added by Rob Cameron 4/9/04

//removes all options from a dropdown box

function FormUtils_deleteDropDownOptions(dropDownObj) {

	for (var i = dropDownObj.options.length-1; i > 0; i--) {

		dropDownObj.options[i] = null; // null out in reverse order (bug workarnd)

	}

}



//added by Rob Cameron 4/9/04

//removes all options from a dropdown box and sets to new list provided

function FormUtils_setDropDownOptions(dropDownObj,labelsArray,valuesArray) {

	FormUtils_deleteDropDownOptions(dropDownObj);



	for (var i = 0; i < labelsArray.length; i++) {

		dropDownObj.options[i] = new Option(labelsArray[i],valuesArray[i]);

	}

}





function FormUtils_hideSelectBoxes(boundLeft,boundTop,boundRight,boundBottom){

//only hide the selects that are within the bounding area

	var selectBoxes = document.getElementsByTagName("SELECT");

	var currBox = null;



	for(var i = 0;i < selectBoxes.length; i++)	{

		currBox = selectBoxes[i];

		currBoxL = CssUtils_findPosX(currBox);

		currBoxT = CssUtils_findPosY(currBox);

		currBoxR = currBoxL + CssUtils_getWidthNum(currBox);

		currBoxB = currBoxT + CssUtils_getHeightNum(currBox);



		if ((boundLeft <= currBoxL && currBoxL <= boundRight) || (boundLeft <= currBoxR && currBoxR <= boundRight)) {

			if ((boundTop <= currBoxT && currBoxT <= boundBottom) || (boundTop <= currBoxB && currBoxB <= boundBottom)) {

				selectBoxes[i].style.visibility = "hidden";

			}

		}

	}

}



function FormUtils_showSelectBoxes(){

	var selectBoxes = document.getElementsByTagName("SELECT");

	

	for(var i = 0;i < selectBoxes.length; i++)	{

		selectBoxes[i].style.visibility = "inherit";

	}

}