﻿jQuery.noConflict();

jQuery(document).ready(function() {
    jQuery('.newsletter_submit').click(function() {
    if (!checkemail(jQuery(".campaign_signup .textBox").val())) {
            alert('Please enter a valid email address.');
            return false;
        }
    });

    jQuery('#contactForm #submit').click(function() {
        var strEmail = jQuery('#strEmail').val();
        var strName = jQuery('#strName').val();
        var strComment = jQuery('#strComment').val();

        if (strName == '') {
            alert('Please enter your name');
            return false;
        }

        if (strEmail == '' || !checkemail(strEmail)) {
            alert('Please enter a valid email address');
            return false;
        }

        if (strComment == '') {
            alert('Please enter the message you would like to send us');
            return false;
        }
    });

});

function checkemail(emailstr) {
    var emailFilter = /^(([a-zA-Z0-9_\-]+)|(([a-zA-Z0-9_\-]+)([\.]{1,1}[a-zA-Z0-9_\-]+)+)+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;

    if (!(emailFilter.test(emailstr)))
        return false;
    return true;
}
