// JavaScript Document
alertMail="veuillez verifier votre adresse email";
checkMail = function(em) {
		this.email=em;
		this.numberAt = 0;
		this.isPoint = 0;
		this.emailError = alertMail;
		if (this.email == "") {
			this.displayError = this.emailError;
			return false;
		}
		for (i=0; i<this.email.length; i++) {
			if (this.email.charAt(i) == "@") {
				this.numberAt += 1;
			}
			if (this.email.charAt(i) == ".") {
				this.isPoint += 1;
			}
		}
		if (this.numberAt != 1) {
			this.displayError = this.emailError;
			return false;
		}
		if (this.isPoint<1) {
			this.displayError = this.emailError;
			return false;
		}
		if (this.email.charAt(this.email.indexOf("@")-1) == '.' || this.email.charAt(this.email.indexOf("@")+1) == '.') {
			this.displayError = this.emailError;
			return false;
		}
		if (this.email.charAt(0) == '@' || this.email.charAt(this.email.length-1) == '@') {
			this.displayError = this.emailError;
			return false;
		}
		if (this.email.charAt(0) == '.' || this.email.charAt(this.email.length-1) == '.') {
			this.displayError = this.emailError;
			return false;
		}
		if (this.email.length-this.email.lastIndexOf('.')>4 || this.email.length-this.email.lastIndexOf('.')<3) {
			this.displayError = this.emailError;
			return false;
		}
		if (this.email.lastIndexOf('.')-this.email.lastIndexOf('@')<=1) {
			this.displayError = this.emailError;
			return false;
		}
//                  ***************************************
					// otherwise return true
//                  ***************************************
		this.displayError=true;
		return true;
	};
