﻿function IsValidEmailAddress(emailAddress) {
    var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
    return pattern.test(emailAddress);
}

function IsValidPhone(phone) {
    var pattern = new RegExp(/\d{3}\-\d{3}\-\d{4}/);
    return pattern.test(phone);
}

function LogUser(userId,action,detail) {
    $.ajax({
        type: "GET",
        url: "/main/handlers/log/create.ashx?UserId=" + userId + "&Action=" + encodeURIComponent(action) + "&Detail=" + encodeURIComponent(detail),
        cache: false,
        success: function(response) {
            //do nothing
        }
    });
};
