function check_rac()
{
	if (document.getElementById('incident_bancaire').value == "aucun") 
	{
		document.getElementById('confirm_rac').style.display = 'block'; 
	}
	else
	{
		document.getElementById('confirm_rac').style.display = 'none'; 
	}
}

function Field2(contact)
{
	if (document.contact.type_contact.selectedIndex != 1)
	{
		hideField('contact','heure_debut');
		hideField('contact','heure_fin');
	}
	else
	{
		showField('contact','heure_debut');
		showField('contact','heure_fin');
	}
}

function valid() 
{
	if (document.contact.civilite.value == 0)
	{
	alert("Indiquez votre civilité");
	document.contact.civilite.focus();
	return(false);
	} 
	if (document.contact.nom.value == "")
	{
	alert("Indiquez votre nom");
	document.contact.nom.focus();
	return(false);
	} 
	if (document.contact.prenom.value == "")
	{
	alert("Indiquez votre prénom");
	document.contact.prenom.focus();
	return(false);
	} 
	if (document.contact.adr1.value == "")
	{
	alert("Indiquez votre adresse");
	document.contact.adr1.focus();
	return(false);
	} 
	if (document.contact.cod_postal.value == "")
	{
	alert("Indiquez votre code postal");
	document.contact.cod_postal.focus();
	return(false);
	} 
	if (document.contact.ville.value == "")
	{
	alert("Indiquez votre ville");
	document.contact.ville.focus();
	return(false);
	} 
	if (document.contact.tel_dom.value == "")
	{
	alert("Indiquez votre téléphone");
	document.contact.tel_dom.focus();
	return(false);
	} 
	if (document.contact.type_contact.value == 0)
	{
	alert("Indiquez par quel moyen vous souhaitez être contacté");
	document.contact.type_contact.focus();
	return(false);
	}  
	if ((document.contact.heure_debut.selectedIndex == 0) && (document.contact.type_contact.value == "tel"))
	{
	alert("Indiquez l'heure à partir de laquelle vous pouvez être contacté");
	document.contact.heure_debut.focus();
	return(false);
	}	
	if ((document.contact.heure_fin.selectedIndex == 0) && (document.contact.type_contact.value == "tel"))
	{
	alert("Indiquez l'heure jusqu'à laquelle vous pouvez être contacté");
	document.contact.heure_fin.focus();
	return(false);
	}	
	if (document.contact.jour_naiss.selectedIndex == 0)
	{
	alert("Indiquez votre jour de naissance");
	document.contact.jour_naiss.focus();
	return(false);
	}
	if (document.contact.mois_naiss.selectedIndex == 0)
	{
	alert("Indiquez votre mois de naissance");
	document.contact.mois_naiss.focus();
	return(false);
	}
	if (document.contact.an_naiss.selectedIndex == 0)
	{
	alert("Indiquez votre année de naissance");
	document.contact.an_naiss.focus();
	return(false);
	}

	if (document.contact.total_pret.value == "")
	{
	alert("Indiquez le Total du prêt souhaité");
	document.contact.total_pret.focus();
	return(false);
	} 


	var radioSelected = false;
	for (i = 0;  i < document.contact.type_loyer.length;  i++)
	{
    	if (document.contact.type_loyer[i].checked)
        	radioSelected = true;
	}

	if (!radioSelected)
	{    
		alert("Veuillez indiquez votre situation résidentielle.");
		document.contact.type_loyer[0].focus();
    	return (false);
	}
	
	if ((document.contact.type_loyer[0].checked) && (document.contact.loyer1.value == ""))
	{
		alert("Indiquez le montant de votre loyer.");
		document.contact.loyer1.focus();
		return(false);
	}

	if ((document.contact.type_loyer[1].checked) && (document.contact.loyer2.value == ""))
	{
		alert("Indiquez le montant de l'accession à la propriété.");
		document.contact.loyer2.focus();
		return(false);
	}	 	

	if (document.contact.total_revenu.value == "")
	{
		alert("Indiquez vos Revenus mensuels nets");
		document.contact.total_revenu.focus();
		return(false);
	}	
	
	if (document.contact.incident_bancaire.value == "")
	{
	alert("Veuillez indiquer si vous avez eu des incidents bancaires.");
	document.contact.incident_bancaire.focus();
	return(false);
	} 
	
	if (document.contact.email.value == "")
	{
	alert("Indiquez votre email");
	document.contact.email.focus();
	return(false);
	} 


	var radioSelected = false;
  for (i = 0;  i < document.contact.cnil.length;  i++)
  {
    if (document.contact.cnil[i].checked)
        radioSelected = true;
  }
  if (!radioSelected)
  {    alert("Indiquez si vous souhaitez recevoir des offres personnalisées.");
	document.contact.cnil[0].focus();
    return (false);
  }
}

function hideField(contact,fieldName){
	eval("document." + contact + "." + fieldName + ".disabled='true'");
	eval("document." + contact + "." + fieldName + ".style.backgroundColor='#CCCCCC'");
	return;
}

function showField(contact,fieldName){
	eval("document." + contact + "." + fieldName + ".disabled=''");
	eval("document." + contact + "." + fieldName + ".style.backgroundColor=''");
	return;
}


