function emailCheck (emailStr) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]àéèçêôâ"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
	alert("L'adresse e-mail semble incomplète/incorrecte.\n(Absence de signe \"@\" ou \".\" ?)\n\nExemple correct : votrenom@votresite.fr")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    alert("Le nom d'utilisateur semble incorrect.\n(Evitez accents, espaces et caractères spéciaux !)")
    return false
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("Le nom de domaine semble incorrect.\n(Evitez accents, espaces et caractères spéciaux !)")
    return false
}

/* domain name seems valid, but check that it ends with 3 letters (com, edu, gov, ...) or 2 letters (uk, nl, ...), and that there's a hostname preceding the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   alert("L'adresse doit finir par un domaine de 2 ou 3 lettres\nprécédé d'un point (.com, .net, .org, .fr, .be, etc.).")
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="Cette adresse ne comporte aucun nom de domaine !"
   alert(errStr)
   return false
}

// If we've gotten this far, everything's valid!
return true;
}