<!--
function validateNotEmpty(strValue) {
//Validates that a string is not all blank (whitespace) characters. Utilizes trimAll function.
//Returns true if valid, otherwise false.
	var strTemp = strValue;
	strTemp = trimAll(strTemp);
	if(strTemp.length > 0) {
		return true;
	}
	return false;
}

function trimAll(strValue) {
//Removes leading and trailing spaces. Returns source string with whitespaces removed.
	var objRegExp = /^(\s*)$/;
	
	//check for all spaces
	if(objRegExp.test(strValue)) {
		strValue = strValue.replace(objRegExp, '');
		if(strValue.length == 0) {
			return strValue;
		}
	}
	
	//check for leading & trailing spaces
	objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
	if(objRegExp.test(strValue)) {
		//remove leading and trailing whitespace characters
		strValue = strValue.replace(objRegExp, '$2');
	}
	return strValue;
}

//Declare module level variable to be assigned in validateIllegalChars function below and used in
//the alert message in when called from the validateForm function
var m_strIllegalCharsMsg
function validateIllegalChars(strValue, blnNoIllegalChars) {
	//Validates that a string does not contain any of the Illegal Characters as specified
	if (blnNoIllegalChars) {
		var objRegExp = /^[a-zA-Z0-9\s\-\.]*$/;
		strIllegalCharsMsg = "Your input is not valid. Please try again.";
	}
	else {
		var objRegExp = /^[a-zA-Z0-9\s\@\$\.\-\,\?\!\'\"\#\&\/]*$/;
		strIllegalCharsMsg = "Your input is not valid. Please try again.";
	}		
  	return objRegExp.test(strValue);
}

function validateInteger(strValue) {
//Validates that a string contains only a valid integer number. Returns true if valid,
//otherwise false.
  var objRegExp  = /(^-?\d\d*$)/;
 
  //check for integer characters
  return objRegExp.test(strValue);
}

/*function validateNumeric(strValue) {
//Validates that a string contains only valid numbers. Allows for decimals. Returns true if valid,
//otherwise false.
	var objRegExp = /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/;
	
	//check for numeric characters
	return objRegExp.test(strValue);
}*/

function validateDate(strValue) {
    // Checks for the following valid date formats:
    // MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
    // Also separates date into month, day, and year variables

    var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{2}|\d{4})$/;

    // To require a 4 digit year entry, use this line instead:
    // var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

    var matchArray = strValue.match(datePat); // is the format ok?
    if (matchArray == null){
        return false;
    }
    month = matchArray[1]; // parse date into variables
    day = matchArray[3];
    year = matchArray[4];
    if (month < 1 || month > 12) { // check month range
        return false;
    }
    if (day < 1 || day > 31) {
        return false;
    }
    if ((month==4 || month==6 || month==9 || month==11) && day==31) {
        return false
    }
    if (month == 2) { // check for february 29th
        var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
        if (day>29 || (day==29 && !isleap)) {
            return false;
       }
    }
    return true;  // date is valid
}

function validatePhoneNumber(strValue, intField) {
//Validates for a valid phone number 1 field at a time when phone number exists in 3 separate fields.
//Returns true if individual phone number field is va3lid, otherwise false.
	if (intField == 1 || intField == 2) {
		var objRegExp = /^\d{3}$/;
	}
	else if (intField == 3) {
		var objRegExp = /^\d{4}$/;
	}
	//check for a valid phone number 1 field at a time
	return objRegExp.test(strValue);
}

function validateFullPhoneNumber(strValue) {
//Validates for a valid phone number 1 field at a time when phone number exists in 3 separate fields.
//Returns true if individual phone number field is valid, otherwise false.
	var objRegExp = /^\d{10}|[0-9]{3}\-[0-9]{3}\-[0-9]{4}|[0-9]{3}\.[0-9]{3}\.[0-9]{4}|[0-9]{3}\.[0-9]{3}\-[0-9]{4}|\([0-9]{3}\)\s?[0-9]{3}\-[0-9]{4}$/;
	//check for a valid phone number 1 field at a time
	return objRegExp.test(strValue);
}

function validateZipCode(strValue) {
//Validates for a valid US Zipcode (5 digit format or zip -4 format). Returns true if valid Zipcode,
//otherwise returns false.
	var objRegExp  = /^(\d{5}(( |-)\d{4})?)$/
	//check for valid US Zipcode
	return objRegExp.test(strValue);
}

function validateEmail(strValue) {
//Validates for a valid email address format. Returns true if valid email, otherwise returns false.
	var objRegExp  = /^[\w\.-]+@[\w\.-]+\.[a-zA-Z]+$/
	//check for valid email
	return objRegExp.test(strValue);
}

function validateTextArea(strValue, intMinWords, intMaxChars) {
//Validates a text area field VALUE to make sure it contains the minimum number of words
//and does not exceed the maximum number of characters passed in. Returns true if valid, otherwise
//returns false. NOTE: DOES NOT VALIDATE FOR NOT EMPTY! (Use the validateNotEmpty function for that!)
	var arrNumWords = strValue.split(/\s+/);
	if (arrNumWords.length >= intMinWords && strValue.length <= intMaxChars) {
		return true;
	}
	return false;
}
//-->