﻿// JScript File
// Removes leading whitespaces
function LTrim(value) {

    var re = /\s*((\S+\s*)*)/;
    return value.replace(re, "$1");

}

// Removes ending whitespaces
function RTrim(value) {

    var re = /((\s*\S+)*)\s*/;
    return value.replace(re, "$1");

}

// Removes leading and ending whitespaces
function trim(value) {

    return LTrim(RTrim(value));

}
function quick_submit() {
    var txtName = document.getElementById("ctl00_Quick_Contact1_txtFullName");
    var txtEmail = document.getElementById("ctl00_Quick_Contact1_txtEmail");
    var txtComments = document.getElementById("ctl00_Quick_Contact1_txtComments");
    var validation_summary = "Please complete and answer the required fields:\n";
    if (trim(txtName.value) == "Name" || trim(txtName.value) == "") {
        validation_summary = validation_summary + "Full Name\n";
    }
    if (trim(txtEmail.value) == "Email") {
        validation_summary = validation_summary + "E-mail\n";
    }
    else {
        retxtname = new RegExp(/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/);
        if (!(retxtname.test(trim(txtEmail.value)))) {
            validation_summary = validation_summary + "E-mail address is not valid\n";
        }
    }
    if (trim(txtComments.value) == "Comments" || trim(txtComments.value) == "") {
        validation_summary = validation_summary + "Comments / Inquiry\n";
    }
    if (validation_summary == "Please complete and answer the required fields:\n") {
        return true;
    }
    else {
        alert(validation_summary);
        return false;
    }
}