﻿function CheckValid() {
    var strdest = document.getElementById(ctlSubscriberId + "txtDest");
    var strDate = document.getElementById(ctlSubscriberId + "txtDate");
    var strPrice = document.getElementById(ctlSubscriberId + "txtPrice");
    var strExhibition = document.getElementById(ctlSubscriberId + "txtExhibition");
    var strName = document.getElementById(ctlSubscriberId + "txtName");
    var strPhone = document.getElementById(ctlSubscriberId + "txtPhoneNu");

    var strMail = document.getElementById(ctlSubscriberId + "txtMail");

    
    if (strdest.value == "") {
        alert("חובה להזין יעד")
        strdest.focus();
        return false;
    }
      
    else if (strPhone.value == "") {
        alert("חובה להזין טלפון")
        strPhone.focus();
        return false;
    }
   
    if (strMail.value == '' || strMail.value == 'הכנס דואר אלקטרוני') {
        alert('נא למלא דואר אלקטרוני');
        strMail.focus();
        return false;
    }
    if (!isEmail(strMail.value)) {
        alert('דואר אלקטרוני לא תקין');
        strMail.focus();
        return false;
    }
    return true;
}

function CheckEmailValid(txtemail) {
    var strMail = document.getElementById(txtemail);
    if (strMail.value == '' || strMail.value == 'הכנס דואר אלקטרוני') {
        alert('נא למלא דואר אלקטרוני');
        strMail.focus();
        return false;
    }
    if (!isEmail(strMail.value)) {
        alert('דואר אלקטרוני לא תקין');
        strMail.focus();
        return false;
    }
    return true;
}

function isEmail(_email) {
    var emailRegExp = new RegExp("^([\\w\\d\-\\.]+)@{1}(([\\w\d\\-]{1,67})|([\\w\d\\-]+\\.[\\w\\d\\-]{1,67}))\\.(([a-zA-Z\\d]{2,4})(\\.[a-zA-Z\\d]{2})?)$");
    emailRegExp.exec(_email);
    return (emailRegExp.test(_email));
}
