// JavaScript Document
function checkMail (mail)
{
if (mail.value == "")
	{
		if (errfound) return;
		window.alert("Please enter your email address");
		mail.select();
		mail.focus();
		errfound = true;
	}
if ((mail.value.length <= 6) || (mail.value.indexOf('@',0) == -1) || (mail.value.indexOf('.',0) == -1))
	{
		if (errfound) return;
		window.alert("Please enter a valid email address");
		mail.select();
		mail.focus();
		errfound = true;

	}
}

function checkEstRempli (element, champ)
{
if (element.value == "")
	{
		if (errfound) return;
		window.alert("The field "+champ+" is mandatory. Thank you for filling it");
		element.select();
		element.focus();
		errfound = true;
	}
	
}
function checkEstNombre (element, champ)
{
if (isNaN(element.value))
	{
		if (errfound) return;
		window.alert("Only numbers are permitted in "+champ+" field");
		element.select();
		element.focus();
		errfound = true;
	}
	
}
function checkEstSelectionne (element, champ)
{
if (element[0].selected == true)
	{
		if (errfound) return;
		window.alert("An element of the list "+champ+" must be indicated. Thank you to make a choice");
		element[0].selected = true;
		element.focus();
		errfound = true;
	}
	
}

function checkEstCoche (element, nombre, champ)
{
var count = 0;
for (var i=0; i<nombre;i++)
	{
		if (document.getElementById(element+parseInt(i+1)).checked==true)
			{
				count = parseInt(count+1);
			}
	}
if (count == 0)	
	{
		if (errfound) return;
		window.alert("An element of the field "+champ+" must be indicated. Thank you to make a choice");
		document.getElementById(element+"1").selected = true;
		document.getElementById(element+"1").focus();
		errfound = true;	
	}
}
