<!--

	/*
	Function Name:  checkDiv1
	Input:  divObj - a div that should be visible or hidden
			cbxObj - a check box that determines the visibility of the div
			arrRel - an array of related objects contained inside the div 
			that need to be set to empty strings if the div is hidden
	Output: Returns a boolean 
	Purpose:  The  checkDiv1 function hides the div if the checkbox is checked and shows the div otherwise.
	*/
	function checkDiv1(divObj, cbxObj, arrRel)
	{
		if (cbxObj.checked)
		{
			divObj.style.visibility = "hidden";
			divObj.style.display = "none";
			return true;
		}
		else
		{
			divObj.style.visibility = "visible";
			divObj.style.display = "inline";
			for (i=0; i<arrRel.length; i++)
			{
				arrRel[i].value="";
			}
			return true;
		}
	}
	/***************************************************************************************************************/
		/*
	Function Name:  checkDiv2
	Input:  divObj - a div that should be visible or hidden
			cbxObj - a check box that determines the visibility of the div
			relObj - the related object held inside the div
	Output: Returns a boolean 
	Purpose:  The  checkDiv2 function shows the div if the checkbox is checked and hides the div otherwise.
	*/
	function checkDiv2(divObj, cbxObj, relObj)
	{
		if (!cbxObj.checked)
		{
			divObj.style.visibility = "hidden";
			divObj.style.display = "none";
			relObj.value = "";
			return true;
		}
		else
		{
			divObj.style.visibility = "visible";
			divObj.style.display = "inline";
			relObj.focus();
			relObj.select();
			return true;
		}
	}
	/***************************************************************************************************************/
	/*
	Function Name:  checkDivOther
	Input:  divObj - a div that should be visible or hidden
			thisObj - a object that determines the visibility of the div
			relObj - the object held in the div
	Output: Returns a boolean 
	Purpose:  The  checkDivOther function shows the div that contains the other description text box
	*/
	function checkDivOther(divObj, thisObj, relObj)
	{
		if(thisObj.type == 'checkbox')
		{
			//the determining object is a checkbox and we need to see if the name has 99 in it - 
			//meaning it is the 'Other'
			if (thisObj.name.indexOf('99', 0) >= 0)
			{
				if (!thisObj.checked)
					//it is not checked so hide everything and default the description
					{
						divObj.style.visibility = "hidden";
						divObj.style.display = "none";
						relObj.value = "Provide a description for other.";
						return true;
					}
					else
					{
					//it is checked so show the div
						divObj.style.visibility = "visible";
						divObj.style.display = "inline";
						relObj.focus();
						relObj.select();
						return true;
					}
			}
		}
		else if(thisObj.type == 'radio')
		{
			//the determining object is a radio button and we need to see if it is equal to 99
			if (thisObj.value == 99)
			{
				//it is equal to 99, so show the div
				divObj.style.visibility = "visible";
				divObj.style.display = "inline";
				relObj.focus();
				relObj.select();
				return true;
			}
			else
			{
				//it is not equal to 99 so hide the dive and default other
				divObj.style.visibility = "hidden";
				divObj.style.display = "none";
				relObj.value = "Provide a description for other.";
				return true;
			}
		}
			
	}
		/***************************************************************************************************************/
	/*
	Function Name:  checkDivAge
	Input:  divObj - a div
			cbxObj - a checkbox
			arrRelObj - an array of related objects
	Output: Returns a boolean 
	Purpose:  The  checkDivAge function shows the div that holds the goals for a given age group
	*/
	function checkDivAge(divObj, cbxObj, arrRelObj)
	{
		if (!cbxObj.checked)
		{
			divObj.style.visibility = "hidden";
			divObj.style.display = "none";
			//loop through the array and uncheck checkboxes in the array
			for (i=0; i<arrRelObj.length; i++)
			{
				arrRelObj[i].checked=false;
			}
			return true;
		}
		else
		{
			divObj.style.visibility = "visible";
			divObj.style.display = "inline";
			return true;
		}
	}
			/***************************************************************************************************************/
	/*
	Function Name:  checkDivInsurers
	Input:  divObj - a div
			rdbObj - a radio button
			arrRelObj - an array of related objects
	Output: Returns a boolean 
	Purpose:  The  checkDivInsurers function shows the div that holds the different insurers.
	*/
	function checkDivInsurers(divObj, rdbObj, arrRelObj)
	{
		if (rdbObj.value == 0 || rdbObj.value == 2)
		{
			divObj.style.visibility = "hidden";
			divObj.style.display = "none";
			
			//loop through the array and uncheck each insurer
			for (i=0; i<arrRelObj.length; i++)
			{
				arrRelObj[i].checked=false;
			}
			return true;
		}
		else
		{
			divObj.style.visibility = "visible";
			divObj.style.display = "inline";
			return true;
		}
	}
	
/***************************************************************************************************************/
/*
	Function Name:  checkDivComProgram
	Input:  divObj - a div that holds the commercial program name
			spanObj - a span that hold the description for other
			rdbObj - the radio button that determines if the div should be visible
			relObj2 - the other description
	Output: Returns a boolean 
	Purpose:  The  checkDivComProgram function shows the div that holds all the commercial program names.
	*/
	function checkDivComProgram(divObj, spanObj, rdbObj, relObj2)
	{
		if (rdbObj.value == 0)
		{
			divObj.style.visibility = "hidden";
			divObj.style.display = 'none';
			for(i=0; i<document.forms[1].length;i++)
			{
				//loop through the form and look for all of the commercial program boxes and uncheck them
				if(document.forms[1].elements[i].id.indexOf('cbxComProg', 0)>=0)
				{
					var strId = document.forms[1].elements[i].id;
					document.getElementById(strId).checked=false;
				}
			}
			
			spanObj.style.visibility = "hidden";
			spanObj.style.display = 'none';
			relObj2.value = "Provide a description for other."		
			return true;
		}
		else
		{
			divObj.style.visibility = "visible";
			divObj.style.display = 'inline';
			return true;
		}
	}
	
	/***************************************************************************************************************/
	/*
	Function Name:  checkDivEmail
	Input:  divObj - a div
			rdbObj - the radio button that determines that the user wants to receive emails
			relObj - the object that holds the email address
	Output: Returns a boolean 
	Purpose:  The  checkDivEmail function shows the div that holds the text field for the Email address of the admin user.
	*/
	function checkDivEmail(divObj, rdbObj, relObj)
	{
		if (rdbObj.value == 0)
		{
			divObj.style.visibility = "hidden";
			divObj.style.display = 'none';
			relObj.value = '';
			
			return true;
		}
		else
		{
			divObj.style.visibility = "visible";
			divObj.style.display = 'inline';
			return true;
		}
	}
	
	/***************************************************************************************************************/
	/*
	Function Name:  sameAddress
	Input:  n/a
	Output: Returns a boolean 
	Purpose:  The sameAddress function sets the address variables for the secondary contact equal to the address
			  variables for the primary contact.
	*/
	function sameAddress()
	{
		if (document.getElementById('cbxAltSame').checked)
		{
			var sec_index=24;
			for (prim_index=8; prim_index<14; prim_index++)
			{
				document.forms[1].elements[sec_index].value = document.forms[1].elements[prim_index].value;
				//alert(document.forms[1].elements[sec_index].name + " is " + document.forms[1].elements[prim_index].value);
				sec_index++;
				
			}
			return true;
		}
		else
		{
			return false;
		}			
	}
	
	/***************************************************************************************************************/
	/*
	Function Name:  requiredField
	Input:  any field that should be required
	Output: Returns a boolean 
	Purpose:  Accepts an arbitrary number of arguments, all input field references whose values are required in the form...
			  Can be called from an object itself: onBlur="requiredField(this)" or from a different object (i.e. button): 
			  onClick="requiredField(txtProtNum, txtCntrNum, txtSubjId)"
			  Updated by Tim Haak and Simona Popescu to handle required radio buttons.
	Taken from: ACRN
	*/	
	
	function requiredField()
	{
		var myRegExp = /\S/;
		var maxLen = arguments.length;
		var missingFields = 0;
		var firstError = -1;

		for(var x = 0; x < maxLen; x++)
		{
			//Added by Tim Haak and Simona Popescu to handle required radio buttons
			//If radio group has no value and is not disabled, check for error
			if(arguments[x].type == null && arguments[x][0].type == "radio" && !arguments[x][0].disabled)
			{
				var rdbLen = arguments[x].length;
				var missingFound = 0;
				
				for(var j = 0; j < rdbLen; j++)
				{
					if(!arguments[x][j].checked)
					{
						missingFound++;
					}
				}
				
				if(missingFound == rdbLen)
				//The number missing is equal to the length of the radio button group array
				{
					missingFields++;
					//Set to true since the missing field is a radio button or checkbox
					if(firstError == -1)
					{
						firstError = x;
					}
				}	
			}
			else
			{
				// if the field is blank or contains only white space and is not disabled, mark it as an error
				if((arguments[x].value == null || arguments[x].value.length == 0 || !myRegExp.test(arguments[x].value)) && !arguments[x].disabled)
				{
					missingFields++;
					if(firstError == -1)
					{
						firstError = x;
					}
				}
			}
		}
		// if at least one required field is blank and checkRaiseError returns true, throw error
		if(missingFields > 0)
		{
			alert('This field is required.');
			if(arguments[firstError].type == null && arguments[firstError][0].type == "radio")
			//If the missing field is a radio button use the first radio button in that group to give focus to
			{
				arguments[firstError][0].focus();
				arguments[firstError][0].select();
			}
			else
			{
				arguments[firstError].focus();
				// if the field is not a select box, also select the value
				if(arguments[firstError].type != "select-one" && arguments[firstError].type != "select-multiple")
				{
					arguments[firstError].select();
				}
			}
			
			// return false so that submit buttons will not submit  
			return false;
		}
		// otherwise, all required fields have been entered
		else
		{
			return true;
		}
	}
	
	/***************************************************************************************************************/
	/*
	Function Name:  isNum
	Input:  myObject - the object whose value is being checked
	Output: Returns a boolean 
	Purpose:  alerts an error if the value is not numeric
	*/	
	
function isNum(myObject)
{
	//If the object's value does not have a length, don't check it.
	if(myObject.value.length > 0)
	{
		//Check if it is not a number.
		if (isNaN(myObject.value))
		{
			alert('This field must be numeric.');
			myObject.focus();
			myObject.select();
		}
		else
		{
			return true;
		}
	}
	else
	{
		return true;
	}
}

	/***************************************************************************************************************/
	/*
	Function Name:  minLen
	Input:  theObject - the object whose length we are checking
			intMinLen - the minimum length
			strType - num or char
	Output: Returns a boolean 
	Purpose:  If the strType is num, verifies that the object value is numeric and has the minimum length.
			  If the strType is char, verifies that the object value has the minimum length.
	*/
	
	function minLen(theObject, intMinLen, strType)
	{	
		if (theObject.value.length > 0)
		{
			switch (strType)
			{
				case "num": 
					if (isNaN(theObject.value))
					{
						alert('This value must be numeric.');
						theObject.focus();
						theObject.select();
						return false;
					}
					if((theObject.value.length < intMinLen) && !isNaN(theObject.value))
					{
						alert('This value must be at least ' + intMinLen + ' digits long.');
						theObject.focus();
						theObject.select();
						return false
					}
					else 
					{
						return true;
					}
				case "char":
					if (theObject.value.length < intMinLen) 
					{
						alert('This value must be at least ' + intMinLen + ' characters long.');
						theObject.focus();
						theObject.select();
						return false
					}
					else 
					{
						return true;
					}
			}
		}
		return true;
	}
	
	/***************************************************************************************************************/
	/*
	Function Name:  checkOneChecked
	Input:  strObj - the string to look for in the form elements
			strAlert - the string to use in the alert
	Output: Returns a boolean 
	Purpose:  Loops through the form elements and looks for a particular string in the form name.  At least one
	 		  of the elements in the form that match that string must be checked.
	*/	
	
function checkOneChecked(strObj, strAlert)
{	
	//Initialize the number checked as 0.
	var intNumChecked = 0;
	
	//Loop through the form and check for elements that have the strObj in the name.  If you find one and it
	//is checked, increment intNumChecked.
	for (i=0; i<document.forms[1].length; i++)
	{
		if(document.forms[1].elements[i].name.indexOf(strObj, 0) >= 0)
		{
			if(document.forms[1].elements[i].checked)
			{
				intNumChecked++;
			}
		}
	}
	//If no elements (that we need) are checked, alert an error.
	if (intNumChecked == 0)
	{
		alert('At least one ' + strAlert + ' must be selected.');
		return false;
	}
	else
	{
		return true;
	}
}

	/***************************************************************************************************************/
	/*
	Function Name:  checkGoal
	Input:  strObj - the string to look for in the form elements
			strAlert - the string to use in the alert
			cbxObj -  the checkbox for a given age group
	Output: Returns a boolean 
	Purpose:  Looks at the checkbox for that age.  If it is checked then at least one goal must be checked.
	*/	
	
function checkGoal(strObj, strAlert, cbxObj)
{	
	//Initialize the number checked to 0
	var intNumChecked = 0;
	//Check to see if the age checkbox is checked.  If it is, we need at least one goal.  If not, go on.
	if (cbxObj.checked)
	{
		//loop through the form and look for elements that have strObj in their name. If you find one and it is checked
		//increment intNumChecked.
		for (i=0; i<document.forms[1].length; i++)
		{
			if(document.forms[1].elements[i].name.indexOf(strObj, 0) >= 0)
			{
				if(document.forms[1].elements[i].checked)
				{
					intNumChecked++;
				}
			}
		}
		//If no boxes are checked, alert an error.
		if (intNumChecked == 0)
		{
			alert('At least one ' + strAlert + ' must be selected for each age group.');
			return false;
		}
		else
		{
			return true;
		}
	}
	else
	{
		return true;
	}
}

	/***************************************************************************************************************/
	/*
	Function Name:  checkInsurer
	Input:  strObj - the string to look for in the form elements
			strAlert - the string to use in the alert
			rdbObj -  the radio button
	Output: Returns a boolean 
	Purpose: If insurers are needed, it verifies that at least one insurer is checked.
	*/	
	
function checkInsurer(strObj, strAlert, rdbObj)
{	
	//Initialize the number checked to 0
	var intNumChecked = 0;
	//Check to see if the program is reimbursed.  If it is, we need at least one insurer.  If not, go on.
	if (rdbObj.checked)
	{
		//loop through the form and look for elements that have strObj in their name. If you find one and it is checked
		//increment intNumChecked.
		for (i=0; i<document.forms[1].length; i++)
		{
			//alert(document.forms[1].elements[i].name);
			if(document.forms[1].elements[i].name.indexOf(strObj, 0) >= 0)
			{
				if(document.forms[1].elements[i].checked)
				{
					intNumChecked++;
				}
			}
		}
		//If no boxes are checked, alert an error.
		if (intNumChecked == 0)
		{
			alert('At least one ' + strAlert + ' must be selected.');
			return false;
		}
		else
		{
			return true;
		}
	}
	else
	{
		return true;
	}
}
	/***************************************************************************************************************/
	/*
	Function Name:  validateComment
	Input:  theObject - the comment object
	Output: Returns a boolean 
	Purpose: Verifies that a comment is present other than the default comment.
	*/
	
	function validateComment(theObject)
	{
		if(theObject.value == "Provide a description for other." || theObject.value == "")
		{
			alert('You must provide a comment when selecting \'Other\'.');
			theObject.focus();
			theObject.select();
		}
	}
	
	/***************************************************************************************************************/
	/*
	Function Name:  validateProgName
	Input:  theObject - the program name object
	Output: Returns a boolean 
	Purpose: Verifies that a name is present other than the default name.
	*/
	function validateProgName(theObject)
	{
		if(theObject.value == "Provide the name of the program." || theObject.value == "")
		{
			alert('You must provide the name of the program.');
			theObject.focus();
			theObject.select();
		}
	}
	

	/***************************************************************************************************************/
	/*
	Function Name:  isBetween
	Input:  theObject - the object
			low - the low value
			high - the high value
	Output: Returns a boolean 
	Purpose: Verifies that the object value is between the low and high values
	*/
	function isBetween(theObject, low, high)
	{
		if(theObject.value.length != 0)
		{
			if(theObject.value >= low && theObject.value <= high)
			{
				
				return true;
			}
			else
			{
				alert('This value must be between '+low+' and '+high+'.');
				theObject.select();
				theObject.focus();
				return false;
			}
		}
	}
	
	/***************************************************************************************************************/
	/*Function Name:  isBetween2
	Input:  theObject - the object
			low - the low value
			high - the high value
	Output: Returns a boolean 
	Purpose: Verifies that the object value is between the low and high values but does not alert an error.  Used by other
		     functions.
	*/
	function isBetween2(theObject, low, high)
	{
		if(theObject.length != 0)
		{
			if(theObject >= low && theObject <= high)
			{
				
				return true;
			}
			else
			{
				return false;
			}
		}
	}
	
	/***************************************************************************************************************/
	/*
	Function Name:  formatDateField
	Input:  txtField - the data field
	Output: Returns a boolean 
	Purpose: Function to format a date into MM/DD/YYYY format and validate it
	*/

	function formatDateField(txtField)
	{
		var strTemp = txtField.value;
		var intLength = strTemp.length;
		if(intLength > 0)
		{
			// If there are 8 characters (01012003), format MM/DD/YYYY
			if(intLength == 8)
			{
				txtField.value = strTemp.substr(0,2) + "/" + strTemp.substr(2,2) + "/" + strTemp.substr(4,4);
			}
			// If there are 7 characters (1012003), format 0M/DD/YYYY
			else if(intLength == 7)
			{
				txtField.value = "0" + strTemp.substr(0,1) + "/" + strTemp.substr(1,2) + "/" + strTemp.substr(3,4);
			}
			// If there are 9 characters (1/01/2003), format 0M/DD/YYYY
			else if(intLength == 9)
			{
				txtField.value = "0" + strTemp;
			}
			// Check if date is valid
			if(!isDateValid(txtField.value))
			{
				alert('This is not a valid date.');
				txtField.focus();
				txtField.select();
				return false;
			}
			else
			{
				return true;
			}
		}
		else
		{
			return true;
		}
	}
	
	/***************************************************************************************************************/
	/*
	Function Name:  isDateValid
	Input:  strDate - the data field
	Output: Returns a boolean 
	Purpose: Given a string of a date in 'MM/DD/YYYY' format, determine if the date is valid [handles Leap Years and such]
	*/
	function isDateValid(strDate)
	{
		var blnIsValid = true;
		// Extract the values from the strDate parameter...
		var intMonths = strDate.substr(0, 2);		
		var intDays = strDate.substr(3, 2);
		var intYears = strDate.substr(6, 4);
		var maxDays = getMaxDaysForMonthThisYear(intMonths, isLeapYear(intYears));

		// Remove the 0 at the beginning if there is one...
		intMonths = intMonths.substr(0, 1)==0 ? intMonths.substr(1, 1) : intMonths;
		intDays = intDays.substr(0, 1)==0 ? intDays.substr(1, 1) : intDays;		
		
		// Check range for months field...
		if(!isBetween2(intMonths, 1, 12))
		{
			blnIsValid = false;
		}

		// Check range for days field...
		if(!isBetween2(intDays, 1, maxDays))
		{
			blnIsValid = false;
		}

		return blnIsValid;
	}
	
	/***************************************************************************************************************/
	/*
	Function Name:  getMaxDaysForMonthThisYear
	Input:  intMonth - month
			isLeap - bool
	Output: Returns a boolean 
	Purpose: Determines the maximum number of days for a given month...	
	*/

	function getMaxDaysForMonthThisYear(intMonth, isLeap)
	{
		var maxDays = 0;
		// Months of January, March, May, July, August, October, December (7).
		if(intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12)
		{
			maxDays = 31;
		}
		// Month of February with leap year handling...
		else if(intMonth == 2)
		{
			if(isLeap == true)
			{
				maxDays = 29;
			}
			else
			{
				maxDays = 28;
			}
		}
		else
		// Months of April, June, September and November (4).
		{
			maxDays = 30;
		}												
		return maxDays;
	}
	
	/***************************************************************************************************************/
	/*
	Function Name:  isLeapYear
	Input:  intYear - the year
	Output: Returns a boolean 
	Purpose: Function determines if a given year is a leap year or not.
	*/
	function isLeapYear(intYear)
	{
		var isLeap = false;
		//Leap Year: In the Gregorian calendar: any year divisible by 4 except centenary years not divisible by 400
		if(intYear % 400 == 0)
		{
			isLeap = true;
		}
		else if(intYear % 100 == 0)
		{
			isLeap = false;
		}
		else if(intYear % 4 == 0)
		{
			isLeap = true;
		}
		else
		{
			isLeap = false;
		}
		return isLeap;
	}
	
	/***************************************************************************************************************/
	/*
	Function Name:  validateText
	Input:  objField - the field to be validated
	Output: Returns a boolean 
	Purpose: checks the provided text for use of anything other than letters, numbers, periods, hyphens, apostrophes or spaces.
	*/
	
	
	function validateText(objField)
	{
		var myExp;
		var strError;

		
		myExp = /[^a-zA-Z0-9\-.' ]/;
		strError = 'Invalid value.  Use only letters, numbers, periods, hyphens, apostrophes, and spaces.';
		
		if(myExp.test(objField.value))
		{
			alert(strError);
			objField.focus();
			objField.select();
		}
	}	
	
	/***************************************************************************************************************/
	/*
	Function Name:  confirmSave
	Input:  blnChange - boolean that indicates whether any text was changed
			strPage - the page that the user wants to go to
	Output: Returns a boolean
	Purpose: Sets several hidden form variables necessary for data processing on the action page
	*/	
	
	function confirmSave(blnChange, strPage, blnStatusChange)
	{
		//set the hidden field to the page that the user wants to go to.
		document.getElementById('hidNextPage').value = strPage;
		
		
		if (blnChange)
		{
			//data changed so ask if they want to save changes.
			var blnSave = confirm('Do you want to save your changes?');
			//set the hidden field 
			document.getElementById('hidBlnSave').value = blnSave;
			if (document.forms[1].elements[0].name == 'selStatus')
			{	
				if (blnSave && blnStatusChange)
				{
				//We are on the status page so do they want to send an email?
				var blnEmail = confirm('Do you want to email the primary contact to inform him/her of this status change?');
				document.getElementById('hidBlnEmail').value = blnEmail;
				}
				else
				{
					document.getElementById('hidBlnEmail').value = false;
				}
			}
		}
		return true;
	}
	
	/***************************************************************************************************************/
	/*
	Function Name:  checkValidation
	Input:  none
	Output: Returns a boolean
	Purpose: The onSubmit validation on each survey form was not working when the form was programatically submitted.  Therefore,
	this function determines the page we are on and then calls the validation functions that need to be called before we can 
	submit the form
	*/	
	
	function checkValidation()
	{
		var myForm = document.forms[1];
		var firstElement = myForm.elements[0].name;
		
		
		if (firstElement.indexOf('cbxAudience', 0) >= 0)
		{
			page = 'target';
		}
		else if (firstElement.indexOf('cbxComp', 0) >= 0)
		{
			page = 'component'
		}
		else if (firstElement.indexOf('cbxInd', 0) >= 0)
		{
			page = 'indicator'
		}
		else if (firstElement.indexOf('cbxSetting', 0) >= 0)
		{
			page = 'setting'
		}
		else if (firstElement.indexOf('txtProgName', 0) >= 0)
		{
			page = 'contact';
		}
		else if ((firstElement.indexOf('cbxSubSetting', 0) >= 0) || (firstElement.indexOf('rdbRegFee', 0) >= 0) || (firstElement.indexOf('selStatus', 0) >= 0))
		{
			page = 'none';
		}
		else if (firstElement.indexOf('cbx', 0) >= 0)
		{
			page = 'delivery';
		}
		
		if (page=='target')
		{
			//If the page we are on is the target page, we need to determine which age groups are selected so that
			//we can determine what goals are needed.
			var arrAgeGroup = new Array();
			var intNumAges = 0;
			for(i=0; i<myForm.length; i++)
			{
				if (myForm.elements[i].name.indexOf('cbxAge',0) >= 0)
				{
					arrAgeGroup[intNumAges] = myForm.elements[i].name;
					intNumAges++;
				}
			}
		}
	
		switch(page)
		{
			case "delivery":  result = checkOneChecked('cbx', 'position');
							  return result;
							  
			case "target":    result1 = checkOneChecked('Audience', 'audience') && checkOneChecked('Age', 'age');
							  for(j=0; j<arrAgeGroup.length; j++)
							  {
								  result2 = checkGoal(arrAgeGroup[j].charAt(arrAgeGroup[j].length - 1)+'Goal', 'goal', document.getElementById(arrAgeGroup[j]));
								  if (!result2)
								  {
									 break;
								  }								   
							  }
							  if (result1 && result2)
							  {
								  return true;
							  }
							  else
							  {
								  return false;
							  }
							  
			case "component": result = (checkOneChecked('Comp', 'component'));
							  return result;				
							  
			case "indicator": result = (checkOneChecked('Ind', 'outcome indicator'));
							  return result;
							  
			case "setting":   result = (checkOneChecked('Setting', 'setting'));
							  return result;
			
			case "contact":   sameAddress();
							  sameContact();
							  
			case "none":  	  return true;							  
		}
		return true;
	}
	/***************************************************************************************************************/
	/*
	Function Name:  checkPrimSec
	Input:  cbxObj - a checkbox
	Output:
	Purpose: Ensures that only one of the enrollment contact checkboxes are checked.  The enrollment contact cannot
	be the same as both the primary and secondary contact.
	*/		
	
	function checkPrimSec(cbxObj)
	{
		if ((cbxObj.name == 'cbxSamePrim') && cbxObj.checked)
		{
			document.getElementById('cbxSameSec').checked = false;
			return;
		}
		else if ((cbxObj.name == 'cbxSameSec') && cbxObj.checked)
		{
			document.getElementById('cbxSamePrim').checked = false;
			return;
		}
		else return;		
	}
	
		/***************************************************************************************************************/
	/*
	Function Name:  sameContact
	Input: n/a
	Output: n/a
	Purpose: sets the enrollment contact info to the primary or secondary contact info based on which checkbox was checked.
	*/
	function sameContact()
	{
		for (i=0; i < document.forms[1].length; i++)
		{
			//alert(document.forms[1].elements[i].name + " is " + i);
		}
		if (document.getElementById('cbxSamePrim').checked)
		{
			var first_index = 3;
			var sec_index = 14
		}
		else if (document.getElementById('cbxSameSec').checked)
		{
			var first_index = 19;
			var sec_index = 30;
		}
		else
		{
			return;
		}
		
		var enroll_index = 36;
		for (k=first_index; k<first_index+4; k++)
		{
			document.forms[1].elements[enroll_index].value = document.forms[1].elements[k].value;
			enroll_index++;
			
		}
		for (j=sec_index; j<sec_index+4; j++)
		{
			document.forms[1].elements[enroll_index].value = document.forms[1].elements[j].value;
			//alert(document.forms[1].elements[sec_index].name + " is " + document.forms[1].elements[prim_index].value);
			enroll_index++;
		}
		
		return;
	}
	
		/***************************************************************************************************************/
	/*
	Function Name:  lengthValid
	Input:  str - The string to check the length of
	Output: Returns a boolean 
	Purpose:  Determines if the string is at least 6 characters
	*/
	function lengthValid(str)
{
	if (str.value.length < 6)
	{
		alert('The password must have a minimum of 6 characters.');
		str.focus();
		str.select();
	}
	else
	{
		return true;
	}
}

		/***************************************************************************************************************/
	/*
	Function Name:  maxLength
	Input:  theObj - the object to check the length of
	Output: Returns a boolean 
	Purpose:  determines if the length of the passed object is greater than 250.
	*/
	function maxLength(theObj)
{
	if (theObj.value.length > 250 )
	{
		alert('This description may not have more than 250 characters.\nYou have used ' + theObj.value.length + ' characters.');
		theObj.focus();
		theObj.select();
	}
	else
	{
		return true;
	}
}

		/***************************************************************************************************************/
	/*
	Function Name:  fp
	Input:  txtField - the object to be validated
			fltLow - the low range
			fltHigh - the high range
			intDecimalPlaces - the number of decimal places 
	Output: Returns a boolean 
	Purpose: validates the object to make sure it is between the low and high values and does not exceed the number of decimal
	places allowed
	*/

	function fp(txtField, fltLow, fltHigh, intDecimalPlaces)
	{
		if(txtField.value.length > 0)
		{
			var blnBetween = isBetween(txtField, fltLow, fltHigh);
			if (blnBetween)
			{
				if(getDecimalPlaces(txtField.value) > intDecimalPlaces)
				{
					alert('This field can have at most ' + intDecimalPlaces + ' digits after the decimal.');
					txtField.focus();
					txtField.select();
				}
				else
				{
					return true;
				}
			}
			else
			{
				return true;
			}
		}
	}

/***************************************************************************************************************/
	/*
	Function Name:  maxLength
	Input:  theValue - the object to determine how many decimal spaces are used
	Purpose:  Returns the number of decimal places after the period in a number string
	*/
	function getDecimalPlaces(theValue)
	{
		var myExp = /\./;
		if(myExp.exec(theValue))
		{
			var right = RegExp.rightContext;
			return right.length;
		}
		return 0;
	}
	
//-->