// JavaScript Document

function validate_email(field,alerttxt)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {return true;}
  }
}//function



function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
	

    }
  else
    {
    return true;
    }
  }
}//function

function validate_form(thisform,f1,f2,f3)
{
with (thisform)
  {
	  f1.style.background='';
	  f2.style.background=''; 
	  
	  if (validate_required(f1,"Le champ email est vide.")==false)
	  {f1.focus();f1.style.background='#FFE8E8';return false;}
	  if (validate_required(f2,"Le champ nom est vide.")==false)
	  {f2.focus();f2.style.background='#FFE8E8';return false;}
	  
	  if (validate_email(f1,"votre adresse email semble invalide")==false)
	  {f1.focus();f1.style.background='#FFE8E8';return false;}

  }
}//function

