function voidVerifieTexte(strChamp,strMessage)
{
	if(document.getElementById(strChamp).value=='')
	{
		alert(strMessage);
		document.getElementById(strChamp).focus();
		return false;
	}
	else return true;
}

function booNumerique(sText)
{
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;
	for (i = 0; i < sText.length && IsNumber == true; i++) 
	{ 
		Char = sText.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
		{
			IsNumber = false;
		}
	}
	return IsNumber;
}

function voidVerifieCP(strChamp,strMessage)
{
	strValeur=document.getElementById(strChamp).value;
	if(!(strValeur.length==5&&booNumerique(strValeur)))
	{
		alert(strMessage);
		document.getElementById(strChamp).focus();
		return false;
	}
	else return true;
}

function booIsMail(emailStr)
{
	var checkTLD = 1;
	var knownDomsPat = /^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|fr)$/;
	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) { return false; }
	var user = matchArray[1];
	var domain = matchArray[2];
	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i) > 127) { return false; }
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i) > 127) { return false; }
	}
	if (user.match(userPat) == null) { return false; }
	var IPArray=domain.match(ipDomainPat);
	if (IPArray != null) {
		for (var i=1; i<=4; i++) {
			if (IPArray[i] > 255) { return false; }
		}
		return true;
	}
	var atomPat = new RegExp("^" + atom + "$");
	var domArr = domain.split(".");
	var len = domArr.length;
	for (i=0; i<len; i++) {
		if (domArr[i].search(atomPat) == -1) { return false; }
	}
	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) { return false; }
	if (len < 2) { return false; }
	return true;
}

function voidVerifieMail(strChamp,strMessage)
{
	strValeur=document.getElementById(strChamp).value;
	valide1 = booIsMail(strValeur);
	if(valide1==false)
	{
		alert(strMessage);
		document.getElementById(strChamp).focus();
		return false;
	}
	else return true;
}

function voidVerifieSelect(strChamp,strMessage)
{
	strValeur=document.getElementById(strChamp).options[document.getElementById(strChamp).selectedIndex].value;
	if(strValeur=='')
	{
		alert(strMessage);
		document.getElementById(strChamp).focus();
		return false;
	}
	else return true;
}

