<!--
/* fonction servant pour le tracking */
function rdp_callback ( dp, pub)
{
	var f = window.document.forms[0];
	if (f && f.x_provenance)
		f.x_provenance.value = dp + '_' + pub;
}

var nothingImg = '/images/nothing.gif';
var trueImg = '/images/true_2.gif';
var falseImg = '/images/false_2.gif';

function valideIndex()
{
	var f = window.document.forms[0];
	
	var revenu = f.i_revenu.value;
	if(revenu == '' || isNaN(revenu))
	{
		alert("Indiquez votre revenu.");
		f.i_revenu.focus();
		return;
	}
	if(revenu < 10000)
	{
		if(!confirm("Vérifiez que vous avez bien indiqué vos revenus annuels.\nContinuer ?"))
		{
			f.i_revenu.focus();
			return;
		}
	}
	if(f.c_sit_fam.selectedIndex == 0)
	{
        alert("Indiquez votre situation familiale.");
		f.c_sit_fam.focus();
		return;
	}
	if(f.i_enfants.selectedIndex == 0)
	{
        alert("Indiquez votre nombre d'enfants.");
		f.i_enfants.focus();
        return;
	}
	var cp = f.p_cp.value;
	if(cp == '' || cp.search(/\d{5}/) == -1) //no_ph
	{
		alert("Indiquez le code postal de votre lieu de résidence.");
		f.p_cp.focus();
        return;
	}
	var mail = f.e_mail.value;
	if(mail == '' || mail.search(/[\w\.-]+@[a-z0-9\.\-]+\.[a-z]{2,}$/) == -1) //no_ph
	{
		alert("Indiquez votre adresse e-mail.");
		f.e_mail.focus();
        return;
	}
	var tel = f.t_tel.value;
	if(tel == '' || tel.search(/^0[1-9]\D?\d{2}\D?\d{2}\D?\d{2}\D?\d{2}$/) == -1) //no_ph
	{
		alert("Indiquez votre n° de téléphone.");
		f.t_tel.focus();
        return;
	}

	f.submit();
}

function post()
{
	if (checkAll())
		document.forms[0].submit();
	else
		alert("Vous devriez vérifier les feux rouges");
}

function checkAll()
{
	var f = window.document.forms[0];
	
	var ok = setLight("civ_img", f.x_civ.selectedIndex != 0);
	ok &= setLight("nom_img", f.c_nom.value != "");
	ok &= setLight("prenom_img", f.c_prenom.value != "");
	ok &= setLight("adresse_img", f.x_adresse.value != "");
	ok &= setLight("cp_img", f.p_cp.value != '' && f.p_cp.value.search(/\d{5}/) != -1);
	ok &= setLight("ville_img", f.c_ville.value != "");
	var tel1 = (f.t_port.value != '' && f.t_port.value.search(/^0[1-9]\D?\d{2}\D?\d{2}\D?\d{2}\D?\d{2}$/) != -1) //no_ph
	var tel2 = (f.t_prof.value != '' && f.t_prof.value.search(/^0[1-9]\D?\d{2}\D?\d{2}\D?\d{2}\D?\d{2}$/) != -1) //no_ph
	var tel3 = (f.t_perso.value != '' && f.t_perso.value.search(/^0[1-9]\D?\d{2}\D?\d{2}\D?\d{2}\D?\d{2}$/) != -1) //no_ph
	ok &= setLight("tel_img", tel1 || tel2 || tel3);
	ok &= setLight("mail_img", f.e_mail.value != '' && f.e_mail.value.search(/[\w\.-]+@[a-z0-9\.\-]+\.[a-z]{2,}$/) != -1) //no_ph
	
	return(ok);
}

function setLight(o, i)
{
	document.getElementById(o).src = (i ? trueImg : falseImg);
	return(i);
}
//-->
