// JavaScript Document
function PasswordIdentique()
{
	var1 = document.inscription.password.value;
	var2  = document.inscription.confirm_password.value;
	if(var1 != "")
		{
			if(var1 == var2)
			{
				document.inscription.password.style.backgroundColor = "#90f4bb";
				document.inscription.confirm_password.style.backgroundColor = "#90f4bb";
			}
			else
			{
				document.inscription.password.style.backgroundColor = "#fba";
				document.inscription.confirm_password.style.backgroundColor = "#fba";
			}
		}
		else
		{
			document.inscription.password.style.backgroundColor = "#fba";
		}
		
}
function VerifPasswordb(champ)
{
	var1 = document.inscription.password.value;
	var2  = document.inscription.confirm_password.value;
	if(var2.length == var1.lenght )
	{
		surligne(champ, true);
    	return false;
	}
	else
	{
		surligne(champ, false);
        return true;
	}
}

function surligne(champ, erreur)
{
   if(erreur)
      champ.style.backgroundColor = "#fba";
   else
      champ.style.backgroundColor = "#90f4bb";
}



function verifPassword(champ)
{
   if(champ.value.length < 5 || champ.value.length > 40)
   {
      surligne(champ, true);
      return false;
   }
   else
   {
      surligne(champ, false);
      return true;
   }
}
function verifPseudo(champ)
{
	if(champ.value.length < 2 || champ.value.length > 40)
	{
			surligne(champ, true);
			return false;
	}
	else
	{
	  surligne(champ, false);
	  return true;
	}
}

function verifMail(champ)
{
   var regex = /^[a-zA-Z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$/;
   if(!regex.test(champ.value))
   {
      surligne(champ, true);
      return false;
   }
   else
   {
      surligne(champ, false);
      return true;
   }
}
function verifQuestion(champ)
{
   if(champ.value.length < 5 || champ.value.length > 40)
   {
      surligne(champ, true);
      return false;
   }
   else
   {
      surligne(champ, false);
      return true;
   }
}
function verifReponse(champ)
{
   if(champ.value.length < 2 || champ.value.length > 40)
   {
      surligne(champ, true);
      return false;
   }
   else
   {
      surligne(champ, false);
      return true;
   }
}
