    function checkEmail (strng) {
    var error="";
    var success = 1;
    if (strng == "") {
       error = "You didn't enter an email address.\n";
    }
    
        var emailFilter=/^.+@.+\..{2,3}$/;
        if (!(emailFilter.test(strng))) { 
           error = alert("Adresa de e-mail nu este corecta.\n");
           success = 0;
        }
        else {
    //test email for illegal characters
           var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
             if (strng.match(illegalChars)) {
              error = alert("Numele de email contine caractere ilegale.\n");
             success = 0;
           }
        }
        if(!success) {
            return false;
        }
        else {
            return true;
        }    
    }