
function checkNewsletterMail(idDivEmail, idDivMessageErrorMissingEmail, idDivMessageErrorInvalidEmail) {

    email = document.getElementById(idDivEmail).value;
    if (email==null || email=="") {

        alert(document.getElementById(idDivMessageErrorMissingEmail).value); 
        return false;
    }
    else {
        if (!isValidEmail(email)) {
            alert(document.getElementById(idDivMessageErrorInvalidEmail).value); 
            return false;
        }
    }
    return true;
}

function isValidEmail(val){
    var re=/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
    if (!val.match(re)) {
        return false;
    } else {
        return true;
    }
}

