function submitForm(contact_form) {
    var found = 0;
    var reasons = new Array();
    var fld_name = contact_form.my_name.value;
    var fld_email = contact_form.email.value;
    var fld_subject = contact_form.subject.value;
    var fld_comments = contact_form.comments.value;
    var fld_botbuster = contact_form.botbuster.value;

    function labelNeeded(lbl_name) {
        var label;
    
        label = document.getElementById(lbl_name);
        if (label.innerHTML[label.innerHTML.length - 1] != "*") {
            label.innerHTML += "*"
            label.style.color = "red";
        }
    }

    function labelDone(lbl_name) {
        var label;
    
        label = document.getElementById(lbl_name);
        if (label.innerHTML[label.innerHTML.length - 1] == "*") {
            label.innerHTML = label.innerHTML.slice(0, -1);
            label.style.color = "black";
        }
    }
    
    if (fld_name.length == 0) {
        labelNeeded("lbl_my_name");
        reasons[reasons.length] = "You did not provide us with your name.";
        contact_form.my_name.focus();
        found = 1;
    } else if (!fld_name.match(/^[a-z0-9()\/\'\":\*+|,.; \- !?&#$@]{2,75}$/i)) {
        labelNeeded("lbl_my_name");
        reasons[reasons.length] = "The name you provided is too short or contains illegal non-alphabetic characters.";
        contact_form.my_name.focus();
        found = 1;
    } else {
        labelDone("lbl_my_name");
    }
    if (fld_email.length == 0) {
        labelNeeded("lbl_email");
        reasons[reasons.length] = "You did not provide us with your email address.";
        if (!found) {
            contact_form.email.focus();
            found = 1;
        }
    } else if (!fld_email.match(/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i)) {
        labelNeeded("lbl_email");
        reasons[reasons.length] = "The email address you provided is formatted improperly.";
        if (!found) {
            contact_form.email.focus();
            found = 1;
        }
    } else {
        labelDone("lbl_email");
    }
    if (fld_subject.length == 0) {
        labelNeeded("lbl_subject");
        reasons[reasons.length] = "You did not provide us with a subject heading.";
        if (!found) {
            contact_form.subject.focus();
            found = 1;
        }
    } else {
        labelDone("lbl_subject");
    }
    if (fld_comments.length == 0) {
        labelNeeded("lbl_comments");
        reasons[reasons.length] = "You did not provide us with any comments.";
        if (!found) {
            contact_form.comments.focus();
            found = 1;
        }
    } else if (fld_comments.length > 2000) {
        contact_form.comments.value = fld_comments.slice(0, 1999);
        labelNeeded("lbl_comments");
        reasons[reasons.length] = "Your comments must be limited to 2000 characters.";
        if (!found) {
            contact_form.comments.focus();
            found = 1;
        }
    } else {
        labelDone("lbl_comments");
    }
    if (fld_botbuster.length == 0) {
        labelNeeded("lbl_botbuster");
        reasons[reasons.length] = "You must provide a numeric response to the spam prevention question.";
        if (!found) {
            contact_form.botbuster.focus();
            found = 1;
        }
    } else {
        labelDone("lbl_botbuster");
    }

    if (!found)
        return true;

    var txt = "";
    for (var i = 0; i < reasons.length; i++) {
        if (i)
            txt += "<br />";
        txt += reasons[i];
    }
    document.getElementById("submit_failed").innerHTML = txt;
    return false;
}
