	
	var whitespace = " \t\n\r";
	
	function isEmpty(s)
	{   return ((s == null) || (s.length == 0))
	}
	
	function isWhitespace (s)
	{   var i;
	    if (isEmpty(s)) return true;
	    for (i = 0; i < s.length; i++)
	    {   
		var c = s.charAt(i);
		if (whitespace.indexOf(c) == -1) return false;
	    }
	    return true;
	}
	
	function ForceEntry(objField, FieldName)
	{
		var strField = new String(objField.value);
		if (isWhitespace(strField)) 
		{
			alert("You need to enter information for " + FieldName);
			
			objField.focus();
			objField.select();
			return false;
		}
		return true;
	}
	
	function ForceNumber(objField, FieldName)
	{
		var strField = new String(objField.value);
		
		if (isWhitespace(strField)) return true;

		var i = 0;

		for (i = 0; i < strField.length; i++)
			if (strField.charAt(i) < '0' || strField.charAt(i) > '9') {
				alert(FieldName + " must be a valid numeric entry.  Please do not use commas or dollar signs or any non-numeric symbols.");
				objField.focus();
				return false;
			}

		return true;
	}
	
	/*function isEmail (s)
	{   if (isEmpty(s)) 
	       if (isEmail.arguments.length == 1) return defaultEmptyOK;
	       else return (isEmail.arguments[1] == true);
	    if (isWhitespace(s)) return false;
	    var i = 1;
	    var sLength = s.length;
	    while ((i < sLength) && (s.charAt(i) != "@"))
	    { i++
	    }
	    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
	    else i += 2;
	    while ((i < sLength) && (s.charAt(i) != "."))
	    { i++
	    }
	    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
	    else return true;
	}*/
	function isDateNumber(strNum,method)
	{		
		var str = new String(strNum);
		var i = 0;
		if (isNaN(parseInt(str)) || parseInt(str) < 0) return false;
		if (method == 2)
			if (parseInt(str) > 31)
				return false;
		if (method == 1)
			if (parseInt(str) > 12)
				return false;
		for (i = 0; i < str.length; i++)
			if (str.charAt(i) < '0' || str.charAt(i) > '9')
				return false;
		return true;
	}
	function isDDMMYYYY(strNum,method)
	{		
		var str = new String(strNum);
		var i = 0;
		if (isNaN(parseInt(str)) || parseInt(str) < 0) return false;
		if (method == 1)
			if (parseInt(str) > 31)
				return false;
		if (method == 2)
			if (parseInt(str) > 12)
				return false;
		for (i = 0; i < str.length; i++)
			if (str.charAt(i) < '0' || str.charAt(i) > '9')
				return false;
		return true;
	}

	function PromptErrorMsg(Field,strError)
	{
		alert("You have entered an invalid date for " + strError + ".  Please make sure your date format is in MM/DD/YYYY format.");
		Field.focus();
	}
	function PromptDDMMYYErr(Field,strError)
	{
		alert("You have entered an invalid date for " + strError + ".  Please make sure your date format is in DD/MM/YYYY format.");
		Field.focus();
	}
	function ForceDate(strDate,strField)
	{
		var str = new String(strDate.value);
		if (isWhitespace(str)) 
			return true;
		var i = 0, count = str.length, j = 0;
		while ((str.charAt(i) != "/" && str.charAt(i) != "-") && i < count)
			i++;
		if (i == count || i > 2) {
			PromptErrorMsg(strDate,strField);
			return false;
		}
		var addOne = false;
		if (i == 2) addOne = true;
		if (!isDateNumber(str.substring(0,i),1)) {
			PromptErrorMsg(strDate,strField);
			return false;
		}
		j = i+1;
		i = 0;
		while ((str.charAt(i+j) != "/" && str.charAt(j+i) != "-") && i+j < count)
			i++;
		if (i+j == count || i > 2) {
			PromptErrorMsg(strDate,strField);
			return false;
		}
		if (!isDateNumber(str.substring(j,i+j),2)) {
			PromptErrorMsg(strDate,strField);
			return false;
		}
		j = i+3;
		i = 0;
		if (addOne) j++;
		while (i+j < count)
			i++;
		if (i != 4) {
			PromptErrorMsg(strDate,strField);
			return false;
		}
		if (!isDateNumber(str.substring(j,i+j),3)) {
			PromptErrorMsg(strDate,strField);
			return false;
		}
		return true;
	}
function ForceDDMMYYDate(strDate,strField)
	{
		var str = new String(strDate.value);
		if (isWhitespace(str)) 
			return true;
		var i = 0, count = str.length, j = 0;
		while ((str.charAt(i) != "/" && str.charAt(i) != "-") && i < count)
			i++;						
		if (i == count || i > 2) {		
			PromptDDMMYYErr(strDate,strField);
			return false;
		}
		var addOne = false;
		if (i == 2) addOne = true;			
		if (!isDDMMYYYY(str.substring(0,i),1)) {		
			PromptDDMMYYErr(strDate,strField);
			return false;
		}		
		j = i+1;
		i = 0;
		while ((str.charAt(i+j) != "/" && str.charAt(j+i) != "-") && i+j < count)
			i++;
		if (i+j == count || i > 2) {
			PromptDDMMYYErr(strDate,strField);
			return false;
		}
		if (!isDDMMYYYY(str.substring(j,i+j),2)) {
			PromptDDMMYYErr(strDate,strField);
			return false;
		}
		j = i+3;
		i = 0;
		if (addOne) j++;
		while (i+j < count)
			i++;
		if (i != 4) {
			PromptDDMMYYErr(strDate,strField);
			return false;
		}
		if (!isDDMMYYYY(str.substring(j,i+j),3)) {
			PromptDDMMYYErr(strDate,strField);
			return false;
		}
		return true;
	}
	
