<!--
function ValidateInput(theform, FieldName, isDataType, doReformat, MinLength, Message)
{
    var ValidChars = "";
    var v = theform[FieldName].value;

	var c = 0;
    var b = 0;
    var e = v.length;
    while (v.substring(b, b+1) == " ") { b++; }
    while (v.substring(e-1, e) == " ") { e--; }
    v = v.substring(b, e);

    if (v == "") return true;

    if (isDataType == "Any") {
        if (MinLength > 0 && v.length < MinLength) {
            if (Message == "") { Message = "This minimum length for data in this field is " + MinLength + " characters. Please re-enter."; }
            alert(Message);
            theform[FieldName].focus();
            return false;
        }
        if (doReformat == "Reformat") {
            theform[FieldName].value = v;
        }
        return true;
    }
     if (isDataType == "ShortDate") {
        while (v.indexOf("-") > 0) { v = v.substring(0, v.indexOf("-")) + "/" + v.substring(v.indexOf("-")+1) }
        while (v.indexOf(" ") > 0) { v = v.substring(0, v.indexOf(" ")) + "/" + v.substring(v.indexOf(" ")+1) }
        var tmp = v;
        while (tmp.indexOf("/") > 0) { 
			c++; 
			tmp = tmp.substring(0, tmp.indexOf("/")) + " " + tmp.substring(tmp.indexOf("/")+1);
		}
		if (c==1) {
			v = v.substring(0, v.indexOf("/")) + "/1/" + v.substring(v.indexOf("/")+1)
		}
        if ((v.length==6) && (v.indexOf("/")==-1)){
			v = v.substring(0,2) + "/" + v.substring(2,4) + "/" + v.substring(4,6);
		}
		
        var d = new Date(Date.parse(v));
        if (d.toString() == "NaN" || d.toString() == "Invalid Date" || d == 0) {
            if (Message == "") { Message = "This field only accepts a date. Please re-enter."; }
            alert(Message);
            theform[FieldName].focus();
            return false;
        }
        else {
            var fullyear = d.getYear();
            if (fullyear < 2000) {fullyear += 1900}
            if (v.indexOf(fullyear) < 0) {
                if (d.getYear() < 23) { d.setYear(2000 + d.getYear()) }
            }
            fullyear = d.getYear();
            if (fullyear < 2000) {fullyear += 1900}
            if (doReformat == "Reformat") {
                theform[FieldName].value = (d.getMonth()+1) + "/" + d.getDate() + "/" + fullyear;
            }        }
        return true;
    }
    if (isDataType == "Date") {
        while (v.indexOf("-") > 0) { v = v.substring(0, v.indexOf("-")) + "/" + v.substring(v.indexOf("-")+1) }
        while (v.indexOf(" ") > 0) { v = v.substring(0, v.indexOf(" ")) + "/" + v.substring(v.indexOf(" ")+1) }
        if ((v.length==6) && (v.indexOf("/")==-1)){
			v = v.substring(0,2) + "/" + v.substring(2,4) + "/" + v.substring(4,6);
		}
        var d = new Date(Date.parse(v));
        if (d.toString() == "NaN" || d.toString() == "Invalid Date" || d == 0) {
            if (Message == "") { Message = "This field only accepts a date. Please re-enter."; }
            alert(Message);
            theform[FieldName].focus();
            return false;
        }
        else {
            var fullyear = d.getYear();
            if (fullyear < 2000) {fullyear += 1900}
            if (v.indexOf(fullyear) < 0) {
                if (d.getYear() < 23) { d.setYear(2000 + d.getYear()) }
            }
            fullyear = d.getYear();
            if (fullyear < 2000) {fullyear += 1900}
            if (doReformat == "Reformat") {
                theform[FieldName].value = (d.getMonth()+1) + "/" + d.getDate() + "/" + fullyear;
            }        }
        return true;
    }
    if (isDataType == "StudentId") {
        ValidChars = "1234567890";
        if (Message == "") { Message = "Please enter a student Id in the form of 999 99 9999."; }
        var StudentId = "";
        for (var i = 0; i < v.length; i++) {
            var ch = v.substring(i, i + 1);
            if (ValidChars.indexOf(ch, 0) == -1) {
                if (ch == " " || ch == "-") {
                }
                else {
                    alert(Message);
                    theform[FieldName].focus();
                    return false;
                }
            }
            else {
                StudentId += ch;
            }
        }
        if (StudentId.length != 9) {
            alert(Message);
            theform[FieldName].focus();
            return false;
        }
        theform[FieldName].value = StudentId.substring(0, 3) + "-" + StudentId.substring(3, 5) + "-" + StudentId.substring(5, 9);
        return true;
    }
    if (isDataType == "SSN") {
        ValidChars = "1234567890";
        if (Message == "") { Message = "Please enter a student Id in the form of 999 99 9999."; }
        var SSN = "";
        for (var i = 0; i < v.length; i++) {
            var ch = v.substring(i, i + 1);
            if (ValidChars.indexOf(ch, 0) == -1) {
                if (ch == " " || ch == "-") {
                }
                else {
                    alert(Message);
                    theform[FieldName].focus();
                    return false;
                }
            }
            else {
                SSN += ch;
            }
        }
        if (SSN.length != 9) {
            alert(Message);
            theform[FieldName].focus();
            return false;
        }
        theform[FieldName].value = SSN.substring(0, 3) + "-" + SSN.substring(3, 5) + "-" + SSN.substring(5, 9);
        return true;
    }
    if (isDataType == "Telephone") {
        ValidChars = "1234567890";
        if (Message == "") { Message = "Please enter a telephone number in the form of 999 999 9999."; }
        var SSN = "";
        for (var i = 0; i < v.length; i++) {
            var ch = v.substring(i, i + 1);
            if (ValidChars.indexOf(ch, 0) == -1) {
                if (ch == " " || ch == "-" || ch == "(" || ch == ")") {
                }
                else {
                    alert(Message);
                    theform[FieldName].focus();
                    return false;
                }
            }
            else {
                SSN += ch;
            }
        }
        if (SSN.length != 10) {
            alert(Message);
            theform[FieldName].focus();
            return false;
        }
        theform[FieldName].value = "(" + SSN.substring(0, 3) + ") " + SSN.substring(3, 6) + "-" + SSN.substring(6, 10);
        return true;
    }
    if (isDataType == "Email") {
        if (MinLength < 6) { MinLength = 6; }
        ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_@.-!";
        if (Message == "") { Message = "This email address contains invalid character(s). Please re-enter."; }
    }
    
    if (isDataType == "Integer") {
        ValidChars = "1234567890";
        if (Message == "") { Message = "This field only accepts integers. Please re-enter."; }
        
        testv = v;
		testv = testv.replace(",","")
		if(testv.indexOf(".")!=-1 || isNaN(testv)) {
			alert(Message);
			theform[FieldName].focus();
			return false;
		}
		return true;
    }
    
    if (isDataType == "Currency") {
		ValidChars = "1234567890,.-";
        if (Message == "") { Message = "This field only accepts numbers, ',.-'. Please re-enter."; }
    
		testv = v;
		testv = testv.replace(",","");
		testv = testv.replace("$","");
		rg = /\d*?\.?/;
		if(testv.indexOf(".")!= -1) {
			if(testv.length - testv.indexOf(".") > 3) {
				alert(Message);
				theform[FieldName].focus();
				return false;
			}
		}
		if((rg.test(testv)) && (!isNaN(testv)) && (v!='$')) {
			return true;
		}
		alert(Message);
		theform[FieldName].focus();
		return false;
    }
    
    if (isDataType == "Number") {
        ValidChars = "1234567890,.-";
        if (Message == "") { Message = "This field only accepts numbers, ',.-'. Please re-enter."; }
        
        testv = v;
		testv = testv.replace(",","")
		if(isNaN(testv)) {
			alert(Message);
			theform[FieldName].focus();
			return false;
		}
		return true;
    }
    
    if (isDataType == "Alpha") {
        ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
        if (Message == "") { Message = "This field only accepts letters. Please re-enter."; }
    }
    if (isDataType == "AlphaNumeric") {
        ValidChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
        if (Message == "") { Message = "This field only accepts letters and numbers. Please re-enter."; }
    }
    if (isDataType == "Zip") {
        if (MinLength < 5) { MinLength = 5; }
        ValidChars = "1234567890-";
        if (Message == "") { Message = "This zip field only accepts numbers and '-'. Please re-enter."; }
    }

    for (var i = 0; i < v.length; i++) {
        var ch = v.substring(i, i + 1)
        if (ValidChars.indexOf(ch, 0) == -1) {
            if (Message == "") { Message = "This field contains one or more invalid characters. Please re-enter."; }
            alert(Message);
            theform[FieldName].focus();
            return false;
        }
    }
    if (v.length < MinLength) {
        if (Message == "") { Message = "This minimum length for data in this field is " + MinLength + " characters. Please re-enter."; }
        alert(Message);
        theform[FieldName].focus();
        return false;
    }
    if (doReformat == "Reformat") {
        theform[FieldName].value = v;
    }
    return true;
}

function CheckRequired(theform, FieldName, Message)
{
    var v = theform[FieldName].value;

    var b = 0;
    var e = v.length;
    while (v.substring(b, b+1) == " ") { b++; }
    while (v.substring(e-1, e) == " ") { e--; }
    v = v.substring(b, e);

    if (v == "") {
        if (Message == "") { Message = "This is a required field, please enter or select the proper value."; }
        alert(Message);
        theform[FieldName].focus();
        return false;
    }
    else {return true;}
}
-->