function roc(leid,lacouleur){
	document.getElementById(leid).style.backgroundColor = lacouleur;
}
function roi(leid,limg){
	document.getElementById(leid).style.backgroundImage = 'url('+limg+')';
}


function isEmail(emailStr, nom_champs, allow_null) {
  if ((emailStr == "") && (allow_null == 1)) {
	return (true);
  } else {
	var emailPat = /^(.+)@(.+)$/
	var specialChars = "\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars = "\[^\\s" + specialChars + "\]"
	var quotedUser = "(\"[^\"]*\")"
	var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	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("Le courriel est invalide")
	  return false
	}
	var user = matchArray[1]
	var domain = matchArray[2]

	if (user.match(userPat) == null) {
	  alert("Le format de l'adresse courriel est invalide") //alert(nom_champs + ":\n\nLe format de l'adresse courriel est invalide")
	  return false
	}

	var IPArray = domain.match(ipDomainPat)
	if (IPArray != null) {
	  for (var i = 1; i <= 4; i++) {
		if (IPArray[i] > 255) {
		  alert("Le courriel est invalide") //alert(nom_champs + ":\nDestination IP address is invalid!")
		  return false
		}
	  } return true
	}

	var domainArray = domain.match(domainPat)
	if (domainArray == null) {
	  alert("Le courriel est invalide") //alert(nom_champs + ":\nThe domain name doesn't seem to be valid.")
	  return false
	}

	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) {
	  alert("Le courriel est invalide") //alert(nom_champs + ":\nThe address must end in a three-letter domain, or two letter country.")
	  return false
	}

	if (len < 2) {
	  //var errStr = nom_champs + ":\nThis address is missing a hostname!"
	  //alert(errStr)
	  alert("Le courriel est invalide")
	  return false
	}

	return true;
  }

}
