function checkemail(email)
{
if (!isemail(email.value))
	{
		alert("Entrez une addresse Email Valide");
		email.focus();
	}
}


function checkemailifexist(EMail)
{
if (EMail.value.length>0)
	{
		
		if (isemail(EMail.value,false)) 
		
		return true
		else
			{
			alert('Erreur dans le champs Email de Travail');
			EMail.focus();
			return false
			}
	}
else
return true
}


function check2(email,phone)
{
if ( (email.value.length>2) && (!isemail(email.value))) 
	{
	alert('Fautes Dans le champs email');
	return false
	}

if (isemail(email.value) || check(phone))
	{return true}
	else
	{
	alert('Entrez votre Email ou votre Telephone correctement!')
	return false 
	}
}

function isemail(src) 
{
     var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
     var regex = new RegExp(emailReg);
     return regex.test(src);
}


function checkifexist(val)
{
if (val.value.length>0)
	{
		
		if (isInteger(val.value,false)) 
		
		return true
		else
			{
			alert("Erreur dans le champs nombre d'enfants");
			val.focus();
			return false
			}
	}
else
return true
}



function isInteger( strValue,msg) 
{
  var objRegExp  = /(^-?\d\d*$)/;
 
  //check for integer characters
  if (!objRegExp.test(strValue))
  {
  if (msg) alert('Le numero de fiche doit etre des chiffres uniquements');
  return false
  }
  else
  return true
    
}

function trim(inputString) 
{
   // Removes leading and trailing spaces from the passed string. Also removes
   // consecutive spaces and replaces it with one space. If something besides
   // a string is passed in (null, custom object, etc.) then return the input.
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { // Check for spaces at the beginning of the string
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { // Check for spaces at the end of the string
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
   }
   return retValue; // Return the trimmed string back to the user
} // Ends the "trim" 


function check() 
{
var argv=check.arguments;
var argc=argv.length
var parameter=argv[0]

n=trim(parameter.value)
if (n.length<2)
	{
	if (argc==2)
		{alert(argv[1]);}
	else
		{alert("Erreur dans le champs " + parameter.name);}
	
	parameter.focus();
	return false;
}
else
return true
}

function compare(a,b)
{
if (a!=b) 
{
alert('Les mots de passes ne sont pas les mêmes.');
return false ;
}
else 

return true
}