// JavaScript Document

function IsEmpty(aTextField) {

   if ((aTextField.value.length==0) || (aTextField.value==null)) {

      return true;

   }

   else { return false; }

}	

/* On cr&eacute;e une fonction de verification */

function verifForm(formulaire)

{ 

  if (confirm('A la question "Fichages actuels" vous avez r&eacute;pondu :'+formulaire.FICP.value+'\nA la question "Interdit bancaire" vous avez r&eacute;pondu : '+formulaire.interdit_bancaire.value+'\nêtes vous sur ?'))

  {

    formulaire.submit(); /* sinon on envoi le formulaire */

	return true;

  }

  else

  {

    return false;

  }

}


function verifFormGauche(formulaire){ 
	
	var valid = true;
	$('type_dossier').style.backgroundColor = "white";
	$('e_mail').style.backgroundColor = "white";
	$('e_mail_valid').style.backgroundColor = "white";


	var msg="";
	/*
	//alert("type_dossier "+$F("type_dossier"));
	if($F("type_dossier")=="0"){
		msg+="Vous devez nous indiquer si vous êtes locataire ou propriétaire.\n";
		$('type_dossier').style.backgroundColor = "red";
		valid=false;
	}
	*/
	if(isEmpty($F('e_mail'))){
		msg+="Vous devez saisir votre adresse email.\n";
		$('e_mail').style.backgroundColor = "red";
		valid=false;
	}
	if(!isEmail($F('e_mail'))){
		msg+="Vous devez saisir une adresse email valide.\n";
		$('e_mail').style.backgroundColor = "red";
		valid=false;
	}
	if( checkEmail($F('e_mail'),$F('e_mail_valid')) ){
		msg+="Les 2 adresses emails ne sont pas identiques.\n";
		$('e_mail').style.backgroundColor = "red";
		$('e_mail_valid').style.backgroundColor = "red";
		valid=false;
	}

	if(!valid){
		alert(msg);
	}
	
	return valid;

}

