﻿function FrontPage_Form1_Validator(theForm) {

    if (theForm.realname.value == "") {
        alert("Please enter a value for the \"Your Name\" field.");
        theForm.realname.focus();
        return (false);
    }

    if (theForm.realname.value.length < 1) {
        alert("Please enter at least 1 characters in the \"Your Name\" field.");
        theForm.realname.focus();
        return (false);
    }

    if (theForm.email.value == "") {
        alert("Please enter a value for the \"Your Email Address\" field.");
        theForm.email.focus();
        return (false);
    }

    if (theForm.email.value.length < 1) {
        alert("Please enter at least 1 characters in the \"Your Email Address\" field.");
        theForm.email.focus();
        return (false);
    }

    if (theForm.StreetAddress.value == "") {
        alert("Please enter a value for the \"Street Address\" field.");
        theForm.StreetAddress.focus();
        return (false);
    }

    if (theForm.StreetAddress.value.length < 1) {
        alert("Please enter at least 1 characters in the \"Street Address\" field.");
        theForm.StreetAddress.focus();
        return (false);
    }

    if (theForm.City.value == "") {
        alert("Please enter a value for the \"City\" field.");
        theForm.City.focus();
        return (false);
    }

    if (theForm.City.value.length < 1) {
        alert("Please enter at least 1 characters in the \"City\" field.");
        theForm.City.focus();
        return (false);
    }

    if (theForm.State.value == "") {
        alert("Please enter a value for the \"State\" field.");
        theForm.State.focus();
        return (false);
    }

    if (theForm.State.value.length < 1) {
        alert("Please enter at least 1 characters in the \"State\" field.");
        theForm.State.focus();
        return (false);
    }

    if (theForm.ZipCode.value == "") {
        alert("Please enter a value for the \"Zip Code\" field.");
        theForm.ZipCode.focus();
        return (false);
    }

    if (theForm.ZipCode.value.length < 5) {
        alert("Please enter at least 5 characters in the \"Zip Code\" field.");
        theForm.ZipCode.focus();
        return (false);
    }

    if (theForm.ZipCode.value.length > 12) {
        alert("Please enter at most 12 characters in the \"Zip Code\" field.");
        theForm.ZipCode.focus();
        return (false);
    }

    if (theForm.WorkPhone.value == "") {
        alert("Please enter a value for the \"Work Phone\" field.");
        theForm.WorkPhone.focus();
        return (false);
    }

    if (theForm.WorkPhone.value.length < 5) {
        alert("Please enter at least 5 characters in the \"Work Phone\" field.");
        theForm.WorkPhone.focus();
        return (false);
    }

    if (theForm.WorkPhone.value.length > 25) {
        alert("Please enter at most 25 characters in the \"Work Phone\" field.");
        theForm.WorkPhone.focus();
        return (false);
    }

    if (theForm.FAX.value == "") {
        alert("Please enter a value for the \"Fax Number\" field.");
        theForm.FAX.focus();
        return (false);
    }

    if (theForm.FAX.value.length < 5) {
        alert("Please enter at least 5 characters in the \"Fax Number\" field.");
        theForm.FAX.focus();
        return (false);
    }

    if (theForm.FAX.value.length > 25) {
        alert("Please enter at most 25 characters in the \"Fax Number\" field.");
        theForm.FAX.focus();
        return (false);
    }

    if (theForm.suggested_width.value.length > 25) {
        alert("Please enter at most 25 characters in the \"Suggested Width\" field.");
        theForm.suggested_width.focus();
        return (false);
    }

    var chkVal = theForm.suggested_width.value;
    var prsVal = chkVal;
    if (chkVal != "" && !(prsVal > "0")) {
        alert("Please enter a value greater than \"0\" in the \"Suggested Width\" field.");
        theForm.suggested_width.focus();
        return (false);
    }

    if (theForm.suggested_height.value.length > 25) {
        alert("Please enter at most 25 characters in the \"Suggested Height\" field.");
        theForm.suggested_height.focus();
        return (false);
    }

    var chkVal = theForm.suggested_height.value;
    var prsVal = chkVal;
    if (chkVal != "" && !(prsVal > "0")) {
        alert("Please enter a value greater than \"0\" in the \"Suggested Height\" field.");
        theForm.suggested_height.focus();
        return (false);
    }
    return (true);
}
