// Contacter une societe
var reEmail = /^[0-9a-z_\.\-]+\@[0-9a-z_\.\-]+\.[0-9a-z_\.\-]+$/i; 
// BOI, followed by one or more whitespace characters, followed by EOI. 
var reWhitespace = /^\s+$/; 

// Check whether string s is empty. 
 
function isEmpty(s) 
{   return ((s == null) || (s.length == 0)); 
} 
 
 
 
// Returns true if string s is empty or  
// whitespace characters only. 
 
function isWhitespace (s) 
 
{   // Is s empty? 
    return (isEmpty(s) || reWhitespace.test(s)); 
} 
 
 


// isEmail (STRING s [, BOOLEAN emptyOK])
// 
// Email address must be of form a@b.c -- in other words:
// * there must be at least one character before the @
// * there must be at least one character before and after the .
// * the characters @ and . are both required
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function isEmail (s)

{   if (isWhitespace(s)) 
       if (isEmail.arguments.length == 1) return false;
       else return (isEmail.arguments[1] == true);
    
    else {
       return reEmail.test(s);
    }
}
 
/*
function checkEmail(email) {
  var proto  = "(mailto:)?";
  var usr    = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
  var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";
  var regex  = "^" + proto + "?" + usr + "\@" + domain + "$";
  

  var rgx    = new RegExp(regex);
  return rgx.exec(email) ? true : false;
}
*/

/* formulaire nous contacter */

function formNousContacter() {
	var f = document.envoiMess;
	
	if (f.mail.value == "") {
		alert("Vous devez indiquer une adresse e-mail");
		f.mail.focus();
	} else {			
		if (!isEmail(f.mail.value)) {
			alert("Cette adresse e-mail n'est pas valide");
			f.mail.focus();
		} else {
			if (f.descriptif.value == "") {
				alert("Vous n'avez pas posé votre question");
				f.descriptif.focus();
			} else {
				f.action = "action.php?act=envoi";
				f.submit();
			}
		}
	}
	
}


