/*
	var tabChp = new Array("nom", "email");
	var tabMsg = new Array("your name", "your email address");
	typeChp : 1=text  2=select  3=radio
*/
function verif_form(nomForm, tabChp, tabMsg, typeChp)
{
	var txt1 ="Veuillez compléter";
	var txt2 ="n'est pas correct";
	
	var msg = "";
	var champ = "";
	var f = document.forms[nomForm];
	
	for (var i=0; i < (tabChp.length); i++)
	{
		var nomChamp = tabChp[i];
		var elmt = f.elements[nomChamp];
		if (typeChp[i]==1)
		{
			champ = elmt.value;
		}
		else if (typeChp[i]==2)
		{
			champ = elmt.options[elmt.selectedIndex].value;
		}

		if (champ != "")
		{
			if ((nomChamp == 'email') || (nomChamp == 'mail'))
			{
				indexAroba = champ.indexOf('@');
				indexPoint = champ.indexOf('.');
				if ((indexAroba < 0) || (indexPoint < 0))
				{
					msg += tabMsg[i] + " " + txt2 + "\n";
					erreur(elmt);
				}
				else
					correct(elmt);
			}
			else
				correct(elmt);
		}
		else
		{
			msg += txt1 + " " + tabMsg[i] + "\n";
			erreur(elmt);
		}
	}
	
	if (msg=="")
		return true;
	else
	{
		alert(msg);
		return false;
	}
}

function erreur(obj) {
     obj.style.borderColor = "#EE5733";
     obj.style.borderWidth = "1px";
     obj.style.borderStyle = "solid";
}

function correct(obj) {
     obj.style.borderColor = "#63664B";
     obj.style.borderWidth = "1px";
     obj.style.borderStyle = "solid";
}
