function	valider(action)
{
	erreur	= false;
	document.Infos.elements["identification[action]"].value	= action;
	document.Infos.action	= "/index.php";
	document.Infos.target	= "_self";
	switch(action)
	{
		case 'valider':
			validerValider();
		break;
		case 'oublier':
			validerOublier();
		break;
		case 'changer':
			validerChanger();
		break;
	}
}
function	validerChanger()
{
	if( verifExistanceChamp("Infos","identification[motDePasseConfirm]") && verifExistanceChamp("Infos","identification[motDePasseNew]") )
	{
		if( !verifNonVide(document.Infos.elements["identification[login]"].value) )
		{
			alert(erreurLogin);
			document.Infos.elements["identification[login]"].select();
			document.Infos.elements["identification[login]"].focus();
			erreur	= true;
		}
		if( !erreur && !verifNonVide(document.Infos.elements["identification[motDePasse]"].value) )
		{
			alert(erreurMotDePasse);
			document.Infos.elements["identification[motDePasse]"].select();
			document.Infos.elements["identification[motDePasse]"].focus();
			erreur	= true;
		}
		if( !erreur && !verifNonVide(document.Infos.elements["identification[motDePasseNew]"].value) )
		{
			alert(erreurMotDePasseNew);
			document.Infos.elements["identification[motDePasseNew]"].select();
			document.Infos.elements["identification[motDePasseNew]"].focus();
			erreur	= true;
		}
		if( !erreur && !verifNonVide(document.Infos.elements["identification[motDePasseConfirm]"].value) )
		{
			alert(erreurMotDePasseConfirm);
			document.Infos.elements["identification[motDePasseConfirm]"].select();
			document.Infos.elements["identification[motDePasseConfirm]"].focus();
			erreur	= true;
		}
		if( !erreur && document.Infos.elements["identification[motDePasseConfirm]"].value != document.Infos.elements["identification[motDePasseNew]"].value )
		{
			alert(erreurMotDePasseChanger);
			document.Infos.elements["identification[motDePasseConfirm]"].select();
			document.Infos.elements["identification[motDePasseConfirm]"].focus();
			erreur	= true;
		}
	}
	if( !erreur )	document.Infos.submit();
}
function	validerOublier()
{
	if( !verifNonVide(document.Infos.elements["identification[login]"].value) )
	{
		alert(erreurLogin);
		document.Infos.elements["identification[login]"].select();
		document.Infos.elements["identification[login]"].focus();
		erreur	= true;
	}
	if( !erreur )	document.Infos.submit();
}
function	validerValider()
{
	if( !verifNonVide(document.Infos.elements["identification[login]"].value) )
	{
		alert(erreurLogin);
		document.Infos.elements["identification[login]"].select();
		document.Infos.elements["identification[login]"].focus();
		erreur	= true;
	}
	if( !erreur && !verifNonVide(document.Infos.elements["identification[motDePasse]"].value) )
	{
		alert(erreurMotDePasse);
		document.Infos.elements["identification[motDePasse]"].select();
		document.Infos.elements["identification[motDePasse]"].focus();
		erreur	= true;
	}
	if( !erreur )	document.Infos.submit();
}
//--------------------------------------------------------------------------------------------------
//	Associe le fait d'appuyer sur la touche "entrée" à nue validation
//--------------------------------------------------------------------------------------------------
function appuie(e)
{
	if (!e) e = window.event;
	if(e.keyCode == 13 )
	{
		valider("valider");
	}
}
document.onkeypress = appuie;
