	// general purpose function for removing leading and trailing blanks ===========================
	function Trim(inputStrVal) {
		//remove leading blanks
		while(''+inputStrVal.charAt(0)==' ') {
			inputStrVal=inputStrVal.substring(1,inputStrVal.length)
		}
		//remove trailing blanks
		while(''+inputStrVal.charAt(inputStrVal.length-1)==' ') {
			inputStrVal=inputStrVal.substring(0,inputStrVal.length-1)
		}
		return inputStrVal
	}

	// general purpose function to see if an input value has been entered ==============================
	function isEmpty(inputStr) {
		if (inputStr.value == null) {
			return true
		}
		if (Trim(inputStr.value) == "") {
			return true
		}
		return false
	}
	

	// function to check for illegal characters in user-supplied school name and familiar name =====================
	function checkEntry(obj) {
			var s = new String(obj.value)
			var tempA = new String()
			var tempB = new String()
			var a = ["'","%","@", "!","(",")",".","&","+","<",">","?","/","\\","=","$","^","#","|","\"","~","`",":",";"]
			var len = a.length
			if (!isEmpty(obj)) {
				for (i=0;i<a.length;i++)
					for(j=0;j<s.length;j++)
						if (s.charAt(j) == a[i]) {
							tempA = s.substring(0,j)
							tempB = s.substring(j+1,s.length)
							s = tempA + tempB
							j = 0
							i = 0
						}
			obj.value = s
			}
	}
	
	// general purpose function to see if an input value is a 3 digit positive integer ======================
	function is3DigitNumber(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		if (inputStr.length < 3) {
			return false
		} else {
			for (var i = 0; i < inputStr.length; i++) {
				var oneChar = inputStr.charAt(i)
				if (oneChar < "0" || oneChar > "9") {
					return false
				}
			}
		}
		return true
	}

	// general purpose function to see if an input numeric value == 0
	function isZero(inputVal){
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		if (inputStr.length != 1 ) {
			return false
		}
		else if (inputStr.charAt(0) == "0"){
			return true;
		}

		return false;
	}

	// general purpose function to see if an input numeric value is > than 0
	function isNumberGreaterThanZero(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		if (inputStr.length < 1) {
			return false
		}
		for (var i = 0; i < inputStr.length; i++) {
			var oneChar = inputStr.charAt(i)
			if (oneChar < "0" || oneChar > "9") {
				return false
			}
		}
		compareFrom = parseInt(inputStr)
		if (!(compareFrom > 0)) {
			return false
		}
		else {
			return true
		}
	}

	// general purpose function to see if an input numeric value is > than 0
	function isNonNegativeInteger(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		if (inputStr.length < 1) {
			return false
		}
        
		for (var i = 0; i < inputStr.length; i++) {
			var oneChar = inputStr.charAt(i)
			if (oneChar < "0" || oneChar > "9") {
				return false
			}
		}
		compareFrom = parseInt(inputStr)
		if ((compareFrom < 0)) {
			return false
		}
		else {
			return true
		}
	}
	// general purpose function to see if an input numeric value is > than 499
	function isNumberGreaterThan499(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		if (inputStr.length < 1) {
			return false
		}
		for (var i = 0; i < inputStr.length; i++) {
			var oneChar = inputStr.charAt(i)
			if (oneChar < "0" || oneChar > "9") {
				return false
			}
		}
		compareFrom = parseInt(inputStr)
		if (!(compareFrom > 499)) {
			return false
		}
		else {
			return true
		}
	}

	// general purpose function to see if an input numeric value is < 1,000,000
	function isNumberLessThanAMillion(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		if (inputStr.length < 1) {
			return false
		}
		for (var i = 0; i < inputStr.length; i++) {
			var oneChar = inputStr.charAt(i)
			if (oneChar < "0" || oneChar > "9") {
				return false
			}
		}
		compareFrom = parseInt(inputStr)
		if (compareFrom > 999999) {
			return false
		}
		else {
			return true
		}
	}

	// general purpose function to see if an input numeric value is <= 4
	function isNumberLessThanOrEqualTo4(inputVal) {
		compareFrom = parseFloat(inputVal)
		if (compareFrom > 4.0) {
			return false
		}
		else {
			return true
		}
	}

	// general purpose function to see if an input value is a 4 digit positive integer ===========================
	function is4DigitNumber(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		if (inputStr.length < 4) {
			return false
		} else {
			for (var i = 0; i < inputStr.length; i++) {
				var oneChar = inputStr.charAt(i)
				if (oneChar < "0" || oneChar > "9") {
					return false
				}
			}
		}
		return true
	}

	// general purpose function to see if an input value is a 4 digit positive integer ===========================
	function is6DigitNumber(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		if (inputStr.length != 6) {
			return false
		} else {
			for (var i = 0; i < inputStr.length; i++) {
				var oneChar = inputStr.charAt(i)
				if (oneChar < "0" || oneChar > "9") {
					return false
				}
			}
		}
		return true
	}
	// general purpose function to see if an input value is a 16 digit positive integer =========================
	function is16DigitNumber(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		if (inputStr.length < 16) {
			return false
		} else {
			for (var i = 0; i < inputStr.length; i++) {
				var oneChar = inputStr.charAt(i)
				if (oneChar < "0" || oneChar > "9") {
					return false
				}
			}
		}
		return true
	}		

	// general purpose function to see if an input value is a valid 4 digit year =================================
	function isYear(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		if (inputStr.length < 4) {
			return false
		} else {
			for (var i = 0; i < inputStr.length; i++) {
				var oneChar = inputStr.charAt(i)
				if (oneChar < "0" || oneChar > "9") {
					return false
				}
			}
			iVal = parseInt(inputStr)
			var today = new Date()
			var thisYear = today.getFullYear()
			if ((iVal > thisYear) || (iVal < 1800)) {
				return false
			}
		}
		return true
	}
	
	// general purpose function to see if an input value is a valid 4 digit year, including years in the future =================================
	function isYearFuture(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		if (inputStr.length < 4) {
			return false
		} else {
			for (var i = 0; i < inputStr.length; i++) {
				var oneChar = inputStr.charAt(i)
				if (oneChar < "0" || oneChar > "9") {
					return false
				}
			}
			iVal = parseInt(inputStr)
			//Don't let them go past 2099 or before 1800
			if ((iVal > 2099) || (iVal < 1800)) {
				return false
			}
		}
		return true
	}

	//general purpose function to see if an input value is a positive or negative integer ========================
	function isInteger(inputVal) {
		inputStr = inputVal.toString()
		for (var i = 0; i < inputStr.length; i++) {
			var oneChar = inputStr.charAt(i)
			if (i == 0 && oneChar == "-") {
				continue
			}
			if (oneChar < "0" || oneChar > "9") {
				return false
			}
		}
		return true
	}

//================================================================
	function isSSN(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		if (inputStr.length != 9) {
			return false
		} else {
			for (var i = 0; i < inputStr.length; i++) {
				var oneChar = inputStr.charAt(i)
				if (oneChar < "0" || oneChar > "9") {
					return false
				}
			}
		}
		return true
	}

//====================================================================
	function isEmailOld(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		
		//Check for multiple @ characters & that email ends with .123
		tooMany = inputStr.split("@");
		
		if (tooMany.length != 2){
			return false
			} else {
				dotSomethingPt1 = tooMany[1].split(".");
				if (dotSomethingPt1.length <= 1) {
					return false
					} else {
						dotSomethingPt2 = dotSomethingPt1.length -1;
						dotSomethingPt3 = dotSomethingPt1[dotSomethingPt2];
						if (!(dotSomethingPt3.length == 2 || dotSomethingPt3.length == 3)) {
						return false
						} else {
						}
					}
			return true
			}
		} 
//====================================================================
	function isEmail(inputVal)
	{
		inputStr = Trim(inputVal);
		inputStr = inputStr.toString();
		//var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
		var filter=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
		if (filter.test(inputStr))
			return true;
		else	
			return false;
	} 
		
//=======================================================		
	function isDate(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		// Check first for valid characters
		for (var i = 0; i < inputStr.length; i++) {
			var oneChar = inputStr.charAt(i)
			if ((oneChar < "0" || oneChar > "9") && (oneChar != "/")) {
				return false
			}
		}
		
		//Get indexes of slashes
		var iFirstSlashIndex = inputStr.indexOf("/", 0)
		var iSecondSlashIndex = inputStr.indexOf("/", iFirstSlashIndex + 1)
		
		//Check that there are two slashes
		if (iFirstSlashIndex == -1 || iSecondSlashIndex == -1) {
			return false
		}
		
		// Get month value
		var iMonthLength = iFirstSlashIndex
		var sMonth = inputStr.substr(0, iMonthLength)
		
		// Get day value
		var iDayLength = iSecondSlashIndex - iFirstSlashIndex - 1
		var sDay = inputStr.substr(iFirstSlashIndex + 1, iDayLength)
		
		// Get year value
		var sYear = inputStr.substr(iSecondSlashIndex + 1)
		
		// Check month
		var iMonth = parseInt(sMonth, 10)
		if (isNaN(iMonth)) {
			return false
		} else {
			if (iMonth < 1 || iMonth > 12) {
				return false
			}
		}
		
		// Check day
		var iDay = parseInt(sDay, 10)
		if (isNaN(iDay)) {
			return false
		} else {
			if (iDay < 1 || iDay > 31) {
				return false
			}
		}
		
		// Check year
		var iYear = parseInt(sYear, 10)
		if (isNaN(iYear)) {
			return false
		} else {
			var today = new Date()
			var thisYear = today.getFullYear()
			if (iYear < 1800 || iYear > thisYear) {
				return false
			}
		}
		
		// Check to make sure that the date is not in the future
		var thisDate = new Date(inputStr)
		var today = new Date()
		if (thisDate > today) {
			return false
		}
		
		return true
	}

//==================================================================
	function isZip(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		// Zip can either be 5 chars long or 10 chars long
		if ((inputStr.length == 5) || (inputStr.length == 9) || (inputStr.length == 10)) {
			if (inputStr.length != 10) {
				for (var i = 0; i < inputStr.length; i++) {
					var oneChar = inputStr.charAt(i)
					if ((oneChar < "0") || (oneChar > "9")) {
						return false
					}
				}
			} else {
				var dashCount = 0;
				var dashPlace = -1;
				for (var i = 0; i < inputStr.length; i++) {
					var oneChar = inputStr.charAt(i)
					if (((oneChar < "0") || (oneChar > "9")) && (oneChar != "-")) {
						return false
					}
					if (oneChar == "-") {
						dashCount++;
						dashPlace = i;
					}
				}
				if ((dashCount != 1) || (dashPlace != 5)) {
					return false
				}
			}
		} else {
			return false
		}
		return true
	}
	
	// general purpose function to see if an input value is a positive or negative number ========================
	function isNumber(inputVal) {
		oneDecimal = false
		inputStr = inputVal.toString()
		for (var i = 0; i < inputStr.length; i++) {
			var oneChar = inputStr.charAt(i)
			if (i == 0 && oneChar == "-") {
				continue
			}
			if (oneChar == "." && !oneDecimal) {
				oneDecimal = true
				continue
			}
			if (oneChar < "0" || oneChar > "9") {
					return false
			}
		}
		return true
	}
	
	// general purpose function to see if an screen name have space or blank ========================
	function isSpace(inputVal) {
		oneDecimal = false
		inputStr = inputVal.toString()
		for (var i = 0; i < inputStr.length; i++) {
			var oneChar = inputStr.charAt(i)
			if (oneChar == " ") {
				return false
			}
		}
		return true
	}
	
	// general purpose function to see if an input value is positive (non-zero) number ==============================
	function isPositiveNumber(inputVal) {
		inputStr = inputVal.toString()
		if (inputStr.length == 0) {
			return false
		} else {
			for (var i = 0; i < inputStr.length; i++) {
				var oneChar = inputStr.charAt(i)
				 if (oneChar < "1" || oneChar > "9") {
						return false
				}
			}
		}
		return true
	}

	// general purpose function to see if an input value is positive number ==============================
	function isWholeNumber(inputVal) {
		inputStr = inputVal.toString()
		if (inputStr.length == 0) {
			return false
		} else {
			for (var i = 0; i < inputStr.length; i++) {
				var oneChar = inputStr.charAt(i)
				 if (oneChar < "0" || oneChar > "9") {
						return false
				}
			}
		}
		return true
	}

	function isPercentage(sNumber) {
		var tempNum

		if (sNumber.length == 0)
			return false

		//convert the value to a string for inspection
		inputStr = sNumber.toString()
		
		//loop through all of the characters
		for (var i = 0; i < inputStr.length; i++) 
		{
			//set a local var for each character
			var oneChar = inputStr.charAt(i)

			if ((oneChar < "0" || oneChar > "9") && oneChar != ".") 
				return false
		}

		tempNum = parseFloat(sNumber)

		if (isNaN (tempNum))
			return false
		else if (tempNum >= 0.0 && tempNum <= 99.99) 
			return true

		return false
	}

	// general purpose function to see if an input value is a positive or negative number ===========================
	function isUSCurrency(inputVal) {
	
		if (inputVal.length == 0)
			return false

		//initialize the oneDecimal boolean
		oneDecimal = false
		
		//initialize the number after decimal counter
		numAfterDecimal = 0
		
		//initialize the counter and flag for comma position
		commaPosition = 0
		commaFound = false

		//convert the value to a string for inspection
		inputStr = inputVal.toString()
		
		//loop through all of the characters
		for (var i = 0; i < inputStr.length; i++) {
		
			//set a local var for each character
			var oneChar = inputStr.charAt(i)
			
			if (commaFound == true)
				commaPosition = commaPosition + 1

			//check to see if char is a period
			if (oneChar == ".") 
				return false
			
			//check to see if the character is other than numbers or commas
			if (oneChar < "0" || oneChar > "9") {
				//check for a comma
				if (oneChar == ",") 
				{
					if (commaFound == false)	
					{
						commaFound = true
						continue
					}

					if ((commaPosition - 1) == 3 && commaFound == true)
					{
						commaPosition = 0
						continue
					}
					else
						return false
				}
				
				return false
			} 
		}

		if (commaPosition != 3 && commaFound == true)
			return false

		return true
	}

	// general function to check text boxes ==================================================
	function checkText(sfield, name, method) {
	
		var field = eval(sfield)
		// Verify that the text box is NOT empty
		if (method == 'notEmpty') {
			if (isEmpty(field)) {
				errMsgs[iCurrentErrorNumber] = name + ' cannot be blank'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
		// Verify the first part of screenname won't exceed 25 characters when screenname with @ character 
		if(method == 'nomore25before@'){
			if(field.value.indexOf('@') >25){
				errMsgs[iCurrentErrorNumber] = name + ' number of characters before can\'t exceed 25'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
			    bValid = false
			    return
			}
		}
		// Verify that the text box IS empty
		if (method == 'isEmpty') {
			if (!isEmpty(field)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be blank'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
		// Verify that the field contains "0"
		if (method == 'isZero') {
			if (!isZero(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be 0'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
		// Check for is3Digit Number
		if (method == 'is3DigitNumber') {
			if (!is3DigitNumber(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a 3 digit number'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}

		// Check for is4Digit Number
		if (method == 'is4DigitNumber') {
			if (!is4DigitNumber(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a 4 digit number'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
	
		// Check for is4Digit Number
		if (method == 'is6DigitNumber') {
			if (!is6DigitNumber(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a 6 digit number'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
		// Check for is16Digit Number
		if (method == 'is16DigitNumber') {
			if (!is16DigitNumber(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a 16 digit number'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}

		// Check for Integer
		if (method == 'isInteger') {
			if (!isInteger(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be an integer'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}

		// Check for Positive Number
		if (method == 'isPositiveNumber') {
			if (!isPositiveNumber(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a positive number and must not include any commas'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
	
		// Check for Number > 0
		if (method == 'isNumberGreaterThanZero') {
			if (!isNumberGreaterThanZero(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a whole dollar amount greater than 0 without punctuation'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}	
		
		// Check for Number > 0
		if (method == 'isNonNegativeInteger') {
			if (!isNonNegativeInteger(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a whole number no less than 0'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}	
		// Check for Number > 499
		if (method == 'isNumberGreaterThan499') {
			if (!isNumberGreaterThan499(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a whole dollar amount greater than 499 without punctuation'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}	

		// Check for Number < 1,000,000
		if (method == 'isNumberLessThanAMillion') {
			if (!isNumberLessThanAMillion(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a whole dollar amount less than 1000000 without punctuation'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}	

		// Check for Number
		if (method == 'isNumber') {
			if (!isNumber(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a number and must not include any commas'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
		
		// Check for SSN
		if (method == 'isSSN') {
			if (!isSSN(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a nine digit Social Security Number'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}

		// Check for date
		if (method == 'isDate') {
			if (!isDate(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a valid date in the MM/DD/YYYY format'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
		
		// Check for valid email
		if (method == 'isEmail') {
			if (!isEmail(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a valid Email Address'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
		
		// Check for Zip
		if (method == 'isZip') {
			if (!isZip(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a valid Zip Code'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
		// Check for valid Birth Month
		if (method == 'isBirthMonth') {			
			//Months allowed would be of the format 1-12, where single digit months can be "1" or "01"
			if (field.value != '')
			{
				var where = field.value.search(/^((0?[1-9])|(1[0-2]))$/);
				if (where == -1) {
					bValid = false;
					errMsgs[iCurrentErrorNumber] = name + ' must be a valid Month';
					iCurrentErrorNumber = iCurrentErrorNumber + 1;
					if (sFocusField == '') {
						sFocusField = sfield
					}
				}
			}

			return
		}
		
		if (method == 'isMonth') {
			if (!isMonth(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a valid Month'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}

		// Check for 4 digit year
		if (method == 'isYear') {
			if (!isYear(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a valid 4 digit year'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
		
		// Check for 4 digit year, including years in the future
		if (method == 'isYearFuture') {
			if (!isYearFuture(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a valid 4 digit year'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
		
		// Check for Space in Screen Name
		if (method == 'isSpace') {
			if (!isSpace(field.value)) {
				errMsgs[iCurrentErrorNumber] ='A ' + name + ' cannot contain spaces, Please re-enter a different screen name'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
		
		// Check for input all being alphabetic
		if (method == 'isAlpha') {
			// the following pattern is supposed to say:
			//   'starts with a non-blank alpha and only has alphas or blanks following to the end'
			var where = field.value.search(/^[a-zA-Z]+[a-z A-Z]*$/);
			if (where == -1) {
				bValid = false;
				errMsgs[iCurrentErrorNumber] = name + ' must be alphabetic';
				iCurrentErrorNumber = iCurrentErrorNumber + 1;
				if (sFocusField == '') {
					sFocusField = sfield
				}
			}
			return
		}

		// Check for input all being alphabetic, numbers or space
		if (method == 'isAlphaNum') {
			// the following pattern is supposed to say:
			//   'starts with a non-blank alpha and only has alphas or blanks following to the end'

			if (field.value != '')
			{
				var where = field.value.search(/^[a-zA-Z0-9]+[a-z A-Z0-9]*$/);
				if (where == -1) {
					bValid = false;
					errMsgs[iCurrentErrorNumber] = name + ' must be alphanumeric and may not include periods';
					iCurrentErrorNumber = iCurrentErrorNumber + 1;
					if (sFocusField == '') {
						sFocusField = sfield
					}
				}
			}

			return
		}
		
		//Modified for Registration Changes
		// Check for input all being alphabetic, numbers or space
		if (method == 'isAlphaNum-.') {
			// the following pattern is supposed to say:
			//   'starts with a non-blank alpha and only has alphas or blanks following to the end'

			if (field.value != '')
			{
				var where = field.value.search(/^[a-zA-Z0-9-'.]+[a-z A-Z0-9-'.]*$/);
				if (where == -1) {
					bValid = false;
					errMsgs[iCurrentErrorNumber] = name + ' must be alphanumeric';
					iCurrentErrorNumber = iCurrentErrorNumber + 1;
					if (sFocusField == '') {
						sFocusField = sfield
					}
				}
			}

			return
		}
		
		//Modified for Registration Changes
		// Check for input all being alphabetic, numbers or space
		if (method == 'isAlpha.') {
			// the following pattern is supposed to say:
			//   'starts with a non-blank alpha and only has alphas or blanks following to the end'

			if (field.value != '')
			{
				var where = field.value.search(/^[a-zA-Z.]+[a-z A-Z.]*$/);
				if (where == -1) {
					bValid = false;
					errMsgs[iCurrentErrorNumber] = name + ' must be alphanumeric';
					iCurrentErrorNumber = iCurrentErrorNumber + 1;
					if (sFocusField == '') {
						sFocusField = sfield
					}
				}
			}

			return
		}
		
		//Modified for Registration Changes
		// Check for input all being alphabetic, numbers or space or "#" or "."
		if (method == 'isAlphaNum#.') {
			// the following pattern is supposed to say:
			//   'starts with a non-blank alpha and only has alphas or blanks following to the end'

			if (field.value != '')
			{
				var where = field.value.search(/^[a-zA-Z0-9#.]+[a-z A-Z0-9#.]*$/);
				if (where == -1) {
					bValid = false;
					errMsgs[iCurrentErrorNumber] = name + ' must be alphanumeric';
					iCurrentErrorNumber = iCurrentErrorNumber + 1;
					if (sFocusField == '') {
						sFocusField = sfield
					}
				}
			}

			return
		}

		// Check for input all being alphabetic, numbers or space
		if (method == 'isAlphaNumPeriod@') {
			// the following pattern is supposed to say:
			//   'starts with a non-blank alpha and only has alphas or blanks following to the end'

			if (field.value != '')
			{
				var where = field.value.search(/^[a-zA-Z0-9.#$*@_-]*$/);
				if (where == -1) {
					bValid = false;
					errMsgs[iCurrentErrorNumber] = name + ' must be alphanumeric (space not allowed)';
					iCurrentErrorNumber = iCurrentErrorNumber + 1;
					if (sFocusField == '') {
						sFocusField = sfield
					}
				}
			}

			return
		}	
		
		// Check for input all being alpha-plus-dash
		if (method == 'isAlphaDash') {
			// the following pattern is supposed to say:
			//   'starts with a non-blank alpha and only has alphas or blanks or dashes following to the end'
			var where = field.value.search(/^[a-zA-Z]+[a-z A-Z\-]*$/);
			if (where == -1) {
				bValid = false;
				errMsgs[iCurrentErrorNumber] = name + ' must be alphabetic(dash is OK)';
				iCurrentErrorNumber = iCurrentErrorNumber + 1;
				if (sFocusField == '') {
					sFocusField = sfield
				}
			}
			return
		}
		
		// Check for input all being alphanumeric-plus-dash-and-pound (plus a few other characters)
		if (method == 'isAlphaNumDashPound') {
			// it is advisable to have the input field include the spec: onBlur="this.value=Trim(this.value);"
			// the following pattern is supposed to say:
			//   'starts with a non-blank alphanumeric and only has alphanums, blanks, dashes, #'s, forward slashes, commas and periods following to the end'
			var where = field.value.search(/^[a-zA-Z0-9]+[\/\.,\-#a-z A-Z0-9]*$/);
			if (where == -1) {
				bValid = false;
				errMsgs[iCurrentErrorNumber] = name + ' must be alphanumeric(#,.-/ also OK)';
				iCurrentErrorNumber = iCurrentErrorNumber + 1;
				if (sFocusField == '') {
					sFocusField = sfield
				}
			}
			return
		}
		
		// The Scholarship Search needed a slightly different error message than that given by isNumber
		if (method == 'isGpaNumber') {
			if (!isNumber(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a number'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}
		
		// Check that the entered GPA on the Scholarship Search form is less than or equal to 4.0
		if (method == 'isFourOrLess') {
            if (!isNumberLessThanOrEqualTo4(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be less than or equal to 4.0'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = sfield
				}
				bValid = false
				return
			}
		}	
	}

	// general function to check select boxes ==============================================
	function checkSelect(field, name, method) {
	
		var selectString = eval(field + ".options[" + field + ".selectedIndex].value.toString()")
		
		// Check to see if a selection has been made
		if (method == 'notEmpty') {
			if (selectString == '') {
				errMsgs[iCurrentErrorNumber] = name + ' must have a value selected'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = field
				}
				bValid = false
				return
			}
		}
		if (method == 'srnNotEmpty') {
			if (selectString == '0' || selectString == '000') {
				errMsgs[iCurrentErrorNumber] = name + ' must have a value selected'
				iCurrentErrorNumber = iCurrentErrorNumber + 1
				if (sFocusField == '') {
					sFocusField = field
				}
				bValid = false
				return
			}
		}
	}

	
	// general function to check select boxes ==============================================
	function checkCasheSelect(field, method) {
	
		var selectString = eval(field + ".options[" + field + ".selectedIndex].value.toString()")
		
		// Check to see if a selection has been made
		if (method == 'notEmpty') {
			if (selectString == '') 
				return true
			
		}
		
		return false
	}

//==================================================================================
	function checkMatch(sfield1, sname1, sfield2, sname2) {
		// Get the values
		var field1 = eval(sfield1)
		var field2 = eval(sfield2)
		
		// Check that they are equal
		if (field1.value != field2.value) {
			errMsgs[iCurrentErrorNumber] = sname1 + ' does not match ' + sname2
			iCurrentErrorNumber = iCurrentErrorNumber + 1
			if (sFocusField == '') {
				sFocusField = sfield1
			}
			bValid = false
			return
		}
	}
	
//================================================================================
	function checkRadio(sGroup, sName) {
		// Get the radio group
		var radioGroup = eval(sGroup)
		
		// Loop through the radio group to see if one is selected
		var bSelected = false
		for (var i = 0; i < radioGroup.length; i++) {
			if (radioGroup[i].checked) {
				bSelected = true
			}
		}
		if (!bSelected) {
			errMsgs[iCurrentErrorNumber] = sName + ' must have one option selected '
			iCurrentErrorNumber = iCurrentErrorNumber + 1
			bValid = false
			return
		}
	}
	
	
/******************************
*           New Check         *
******************************/
	// general function to check credit card expiration
	function checkCCExpiration(fieldMM, fieldYY, sName) {
		var iMM = eval(fieldMM + ".options[" + fieldMM + ".selectedIndex].value") - 0 // added - 0 to cast as a number.  Before this, parseInt was producing octal results because of leading 0's.
		var iYY = eval(fieldYY + ".options[" + fieldYY + ".selectedIndex].value")
		
		// Current Date
		var dToday = new Date();
		var iTodayMonth = dToday.getMonth() + 1;
		var iTodayYear = dToday.getFullYear();

		// Min Date (DaysToAdd * 24 * 60 * 60 * 1000)
		var dMinDateSeconds = dToday.getTime() + (14*24*60*60*1000);
		var dMinDate = new Date(dMinDateSeconds);
		var iMinMonth = dMinDate.getMonth() + 1;
		var iMinYear = dMinDate.getFullYear();
		
		if ((parseInt(iMM) < parseInt(iMinMonth)) && (parseInt(iYY) <= parseInt(iMinYear))) {
			//The expiration date is too soon
			errMsgs[iCurrentErrorNumber] = sName + ' must be at least two weeks in the future'
			iCurrentErrorNumber = iCurrentErrorNumber + 1
			bValid = false
			return
		}
	}
	
	// general function to initialize the error array ==============================================
	function Initialize() {
		//initialize the array
		for (var i = 0; i < errMsgs.length; i++) {
			errMsgs[i] = ''
		}
		//initialize the current error number
		iCurrentErrorNumber = 0
		
		//initialize the valid variable
		bValid = true
		
		//initialize the focus field var
		sFocusField = ''
	}
	
	// general function to display errors ======================================
	function DisplayErrors() {
		var bFirstMessage = true
		var errMsg = 'The following error(s) occurred: \n'
		for (var i = 0; i < errMsgs.length; i++) {
			if (errMsgs[i] != '') {
				if (bFirstMessage) {
					errMsg = errMsg + errMsgs[i]
					bFirstMessage = false
				} else {
					errMsg = errMsg + ', and\n' + errMsgs[i]
				}
			}
		}
		errMsg = errMsg + '.'
		alert(errMsg)

		// If we have a focus field, and it's not disabled		
		
		// Hart: The line below failed to move the focus to the correct field in Netscape 4.x because those browsers return "undefined" instead of
		// "false" for eval(sFocusField + ".disabled").
        // if (sFocusField != '' && eval(sFocusField + ".disabled") == false) {
    
		if (sFocusField != '' && (eval(sFocusField + ".disabled") == false) || eval(sFocusField + ".disabled") == undefined) {
			//Set the focus
			eval(sFocusField + '.focus()')
		}
		
		//Initialize the display array
		Initialize()
	}

//================================================================================
//Function to display child information entry boxes
//================================================================================
function checkChildEntryBoxes(collEntYearBoxName, collEntYearBoxPath, gradeLevelPath)
{
	var collEntYear = document.getElementById(collEntYearBoxName);
	if(collEntYear != null)
	{
		if(eval(collEntYearBoxPath).length == undefined)
		{
			//there is only one textbox for College Entrance Year.  It is not an array
			checkText(collEntYearBoxPath, 'College entrance year', 'isYearFuture');
			//also check the accompanying grade level dropdown
			checkSelect(gradeLevelPath, 'Current grade level', 'notEmpty')
		}
		else
		{
			//We have an array of College Entrance Years, check them all
			for(i = 0; i < eval(collEntYearBoxPath).length; i++)
			{
				checkText(collEntYearBoxPath + '[' + i + ']', 'College entrance year', 'isYearFuture');
				//also check the accompanying grade level dropdown
				checkSelect(gradeLevelPath + '[' + i + ']', 'Current grade level', 'notEmpty')
			}
		}
	}
}
//===================================================================================
//Function to check for valid Birth Month
//===================================================================================
function isMonth(inputVal) {
		inputStr = Trim(inputVal);
		inputStr = inputStr.toString();
		
		var iMonth = parseInt(inputStr);		
		if (isNaN(iMonth)) {
			return false
		} else {
			if (iMonth < 1 || iMonth > 12) {
				return false
			}
		}		
		return true
}