<!--

	function isDate(inputStr, txtField) {
	
		if (inputStr != "") {
		
			//
			// Check length of inputStr
			//
			if (inputStr.length < 6 || inputStr.length > 10) {
				alert("The date entry is not in an acceptable format.  Please use format 'mm/dd/yyyy'.")
				txtField.focus()
				txtField.select()
				return false			
			}
		
			//
			// Convert hyphens to slashes
			//
			while (inputStr.indexOf("-") != -1) {
				inputStr = replaceString(inputStr,"-","/")
			}

			//
			// Check number of slashes
			//
			var iDelims = 0
			var sTemp = inputStr
			while (sTemp.indexOf("/") != -1) {
				sTemp = replaceString(sTemp,"/","-")
				iDelims += 1
			}			
			if (iDelims > 2) {
				alert("The date entry is not in an acceptable format.  Please use format 'mm/dd/yyyy'.")
				txtField.focus()
				txtField.select()
				return false
			}
		
			//
			// Are there any delimiters?
			//
			var delim1 = inputStr.indexOf("/")
			var delim2 = inputStr.lastIndexOf("/")
			
			//
			// Check # of delimiters
			//
			if (delim1 == -1 || delim1 == delim2) {
				alert("The date entry is not in an acceptable format.  Please use format 'mm/dd/yyyy'.")
				txtField.focus()
				txtField.select()
				return false
			}
		
			//
			// get month, day, year
			//
			var mm = parseInt(inputStr.substring(0, delim1), 10)
			var dd = parseInt(inputStr.substring(delim1 + 1, delim2), 10)
			var yyyy = parseInt(inputStr.substring(delim2 + 1, inputStr.length),10)
			
			//
			// Check length of year
			//
			if (inputStr.length - delim2 != 3 && inputStr.length - delim2 != 5) {
				alert("The date entry is not in an acceptable format.  Please use format 'mm/dd/yyyy'.")
				txtField.focus()
				txtField.select()
				return false
			}
			
			//
			// numeric test for month, day, year
			//
			if (isNaN(mm) || isNaN(dd) || isNaN(yyyy)) {
				alert("The date entry is not in an acceptable format.  Please use format 'mm/dd/yyyy'.")
				txtField.focus()
				txtField.select()
				return false
			}
			
			//
			// Check month of year
			//
			if (mm < 1 || mm > 12) {
				alert("Months must be entered between the range of 1 and 12.")
				txtField.focus()
				txtField.select()
				return false
			}
			
			//
			// Check day of month
			//
			if (dd < 1 || dd > 31) {
				alert("Days must be entered between the range of 1 and 31 (depending on the month and year).")
				txtField.focus()
				txtField.select()
				return false
			}
			
			//
			// Set year to 4 digit year
			//
			if (yyyy < 100) {
				// entered value is 2 digits, which we allow for 1930 - 2029
				if (yyyy >= 30) {
					yyyy += 1900
				} else {
					yyyy += 2000
				}
			}
			
			//	
			// Check month length
			//
			if (!checkMonthLength(mm,dd)) {
				txtField.focus()
				txtField.select()
				return false
			}
			
			//
			//  Check February date for too high a value
			//
			if (mm == 2) {
				if (!checkLeapMonth(mm,dd,yyyy)) {
					txtField.focus()
					txtField.select()
					return false
				}
			}
			
			txtField.value = mm + "/" + dd + "/" + yyyy			
		}
		return true	
	}
	
	// check the entered month for too high a value
	function checkMonthLength(mm,dd) {
		var months = new Array("","January","February","March","April","May","June","July","August","September","October","November","December")
		if ((mm == 4 || mm == 6 || mm == 9 || mm == 11) && dd > 30) {
			alert(months[mm] + " has only 30 days.")
			return false
		} else if (dd > 31) {
			alert(months[mm] + " has only 31 days.")
			return false
		}
		return true
	}
	
	// check the entered February date for too high a value 
	function checkLeapMonth(mm,dd,yyyy) {
		if (yyyy % 4 > 0 && dd > 28) {
			alert("February of " + yyyy + " has only 28 days.")
			return false
		} else if (dd > 29) {
			alert("February of " + yyyy + " has only 29 days.")
			return false
		}
		return true
	}
	
	// extract front part of string prior to searchString
	function getFront(mainStr,searchStr){
		foundOffset = mainStr.indexOf(searchStr)
		if (foundOffset == -1) {
			return null
		}
		return mainStr.substring(0,foundOffset)
	}
	
	// extract back end of string after searchString
	function getEnd(mainStr,searchStr) {
		foundOffset = mainStr.indexOf(searchStr)
		if (foundOffset == -1) {
			return null
		}
		return mainStr.substring(foundOffset+searchStr.length,mainStr.length)
	}
	
	// insert insertString immediately before searchString
	function insertString(mainStr,searchStr,insertStr) {
		var front = getFront(mainStr,searchStr)
		var end = getEnd(mainStr,searchStr)
		if (front != null && end != null) {
			return front + insertStr + searchStr + end
		}
		return null
	}
	
	// remove deleteString
	function deleteString(mainStr,deleteStr) {
		return replaceString(mainStr,deleteStr,"")
	}
	
	// replace searchString with replaceString
	function replaceString(mainStr,searchStr,replaceStr) {
		var front = getFront(mainStr,searchStr)
		var end = getEnd(mainStr,searchStr)
		if (front != null && end != null) {
			return front + replaceStr + end
		}
		return null
	}

// -->
