﻿function validateEmail(source, clientside_arguments) {

    var reEmail = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;

    if (!reEmail.test(clientside_arguments.Value)) {

        clientside_arguments.IsValid = true;
        return;
    }

    $.ajax({
        type: "post",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        async: false,
        url: "/webservices/globalevolution/UsrService.aspx/ValidateEmail",
        data: JSON.stringify({ usrEmail: clientside_arguments.Value }),
        success: function (response) { clientside_arguments.IsValid = response.d; }
    });
}

function validateUserTerms(source, clientside_arguments) { clientside_arguments.IsValid = $("input[id$='chbAccept']").is(':checked'); }


//function IconFileIsPic(sender, args) {
//    // use the client id of the file upload
//    $("[id$='_fileUpload']")
//    var fileupload = $("[id$='_fileUpload']");  //document.getElementById('ctl00_PlaceHolder1_ctl00_fileUpload');
//    alert(fileupload.val());
//    $.ajax({
//        type: "post",
//        contentType: "application/json; charset=utf-8",
//        dataType: "json",
//        async: false,
//        url: "/UsrService.aspx/ValidateFileType",
//        data: JSON.stringify({ filePath: fileupload.val() }),
//        success: function (response) { alert("test"); args.IsValid = response.d; }
//    });

//}


function validateMyPictureTerms(source, clientside_arguments) { clientside_arguments.IsValid = $("input[id$='cbMyPicture']").is(':checked'); }

