	// ****************************** Change Log *********************************
	// *  Date                 Name           Desciption                         *
	// *                                                                         *
	// * 07/05/2000            Lynn Yohn      Add new function (is5Characters)   *
	// *                                      to check for minimum of five       *
	// *                                      characters in a field              *
	// *                                                                         *
	// * 08/01/2001            Lynn Yohn      Add new function (isValidEMail)    *
	// *                                      to check for valid e-mail address  *
	// ***************************************************************************
	//
	//
	
	// 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
	}

	// 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 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 minimum of five characters
	function is5Characters(inputVal) {
		inputStr = Trim(inputVal)
		inputStr = inputStr.toString()
		if (inputStr.length < 5) {
			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 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 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 == 10)) {
			if (inputStr.length == 5) {
				for (var i = 0; i < inputStr.length; i++) {
					var oneChar = inputStr.charAt(i)
					if ((oneChar < "0") || (oneChar > "9")) {
						return false
					}
				}
			} else {
				for (var i = 0; i < inputStr.length; i++) {
					var oneChar = inputStr.charAt(i)
					if (((oneChar < "0") || (oneChar > "9")) && (oneChar != "-")){
						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 input value is a positive or negative number
	function isUSCurrency(inputVal) {
	
		//initialize the oneDecimal boolean
		oneDecimal = false
		
		//initialize the number after decimal counter
		numAfterDecimal = 0
		
		//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)
			
			//check to see if you found a period and if it is the first one
			if (oneChar == "." && !oneDecimal) {
				oneDecimal = true
				continue
			}
			
			//check to see if the character is other than numbers or commas
			if (oneChar < "0" || oneChar > "9") {
				//check for a comma
				if (oneChar == ",") {
					continue
				}
				
				return false
			} else {
			
				//if you found a number check to see if you are beyond the decimal
				if (oneDecimal) {
				
					//increment the num after decimal counter
					numAfterDecimal = numAfterDecimal + 1
				
					//if the num after decimal is greater than 2 then return false
					if (numAfterDecimal > 2) {
						return false
					}
				}
			}
		}
		return true
	}

	function isValidEmail(inputStr) {
	
		inputStr = Trim(inputStr)
		inputStr = inputStr.toString()
		if (inputStr.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) {
			return false
		} else {
			return true
		}
	}	
			
	// general function to check text boxes
	function checkText(sfield, name, method) {
		
		var field = eval(sfield)
				
		// Check to see if the text box is empty
		if (method == 'notEmpty') {
			if (isEmpty(field)) {
				errMsgs[iCurrentErrorNumber] = name + ' can not be blank'
				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 three 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 is5Characters
		if (method == 'is5Characters') {
			if (!is5Characters(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be five characters'
				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 Number
		if (method == 'isNumber') {
			if (!isNumber(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a number and can 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 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 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 valid e-mail address
		if (method == 'isEmail') {
			if (!isValidEmail(field.value)) {
				errMsgs[iCurrentErrorNumber] = name + ' must be a valid E-mail address'
				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
			}
		}
	}
	
	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
		}
	}
	
	// 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 errors occured:\n'
		for (var i = 0; i < errMsgs.length; i++) {
			if (errMsgs[i] != '') {
				if (bFirstMessage) {
					errMsg = errMsg + errMsgs[i]
					bFirstMessage = false
				} else {
					errMsg = errMsg + '\n - and - \n' + errMsgs[i]
				}
			}
		}
		errMsg = errMsg + '.'
		alert(errMsg)
		
		if (sFocusField != '') {
			//Set the focus
			eval(sFocusField + '.focus()')
		}
		
		//Initialize the display array
		Initialize()
	}
	
