﻿var $jq = jQuery.noConflict(); $jq(document).ready(function () { $jq('#vslider').coinslider({ width: 653, height: 253, spw: 7, sph: 5, delay: 5000, sDelay: 30, opacity: 0.7, titleSpeed: 1500, effect: 'rain', navigation: false, links: false, hoverPause: false }); });


// 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 app_submit() {
    
    var txtFName = document.getElementById("ctl00_Body_tbfirstName");
    var txtLName = document.getElementById("ctl00_Body_tbLastName");
    var txtEmail = document.getElementById("ctl00_Body_tbEmail");
    var txtComments = document.getElementById("ctl00_Body_tbComments");
    var txtHow = document.getElementById("ctl00_Body_tbHear");

    var lblFName = document.getElementById("lblFName");
    var lblLName = document.getElementById("lblLName");
    var lblEmail = document.getElementById("lblEmail");
    var lblComments = document.getElementById("lblComments");
    var lblHow = document.getElementById("lblHow");
   
    var validation_summary = "Please complete and answer the required fields:\n";
    if (trim(txtFName.value) == "") {
        validation_summary = validation_summary + "First Name\n";
        lblFName.innerHTML = "*";
    }
    if (trim(txtLName.value) == "") {
        validation_summary = validation_summary + "Last Name\n";
        lblLName.innerHTML = "*";
    }
    if (trim(txtEmail.value) == "") {
        validation_summary = validation_summary + "E-mail\n";
        lblEmail.innerHTML = "*";
    }
    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";
            lblEmail.innerHTML = "*";
        }
    }
    if (trim(txtComments.value) == "") {
        validation_summary = validation_summary + "Comments / Inquiry\n";
        lblComments.innerHTML = "*";
    }
    if (trim(txtHow.value) == "") {
        validation_summary = validation_summary + "How did you hear about us?\n";
        lblHow.innerHTML = "*";
    }


    if (validation_summary == "Please complete and answer the required fields:\n") {
        return true;
    }
    else {
        alert(validation_summary);
        return false;
    }
}
 
