function post_request(url, properties) {
var xhr_object = null;
if (window.XMLHttpRequest) {
xhr_object = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
} else {
return "";
}
xhr_object.open("POST", url, false);
xhr_object.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhr_object.send(properties);
return xhr_object.responseText;
}
function est_visible(identifiant) {
var element = document.getElementById(identifiant);
if (element != null)
return element.style.display == "";
return false;
}
function rend_visible(identifiant, visible) {
var element = document.getElementById(identifiant);
if (element != null) {
if (visible)
element.style.display = "";
else
element.style.display = "none";
}
}
function rend_visibles(selectionnee, tableau) {
for (var i = 0; i < tableau.length; i++) {
var element = tableau[i];
var identifiant = element[1];
if (identifiant != 'none')
rend_visible(identifiant, false);
}
for (var i = 0; i < tableau.length; i++) {
var element = tableau[i];
var valeur = element[0];
var identifiant = element[1];
if (identifiant != 'none' && valeur == selectionnee)
rend_visible(identifiant, true);
}
}
function verifier_code_postal(suffix){
var identifiant = "ville" + suffix;
var code_postal_select = document.getElementById("code_postal" + suffix);
if (code_postal_select != null) {
var code_postal = code_postal_select.value;
if (code_postal.length == 5) {
var properties = 'code_postal='+code_postal+'&nom_champ='+identifiant;
var contenu = post_request('http://www.financeimmo.com/formulaires/recuperer_champ_ville.php',properties);
var ligne_ville = document.getElementById("ligne_ville" + suffix);
ligne_ville.innerHTML = contenu;
ligne_ville.style.display = "";
code_postal_select.style.color="black";
} else {
if (code_postal != "0")
code_postal_select.style.color="red";
else
code_postal_select.style.color="black";
document.getElementById("ligne_ville" + suffix).style.display = "none";
}
} else {
alert("L'object "+ identifiant + " ou code_postal" + suffix + " n'a pas été trouvé");
}
}
function charger_code_postal(suffix) {
var code_postal_select = document.getElementById("code_postal" + suffix);
var code_postal = code_postal_select.value;
if (code_postal.length == 5)
document.getElementById("ligne_ville" + suffix).style.display = "";
else
document.getElementById("ligne_ville" + suffix).style.display = "none";
}
function montrer_montant_tresorerie() {
var tresorerie_radio = document.getElementById("tresorerie_oui");
if (tresorerie_radio.checked)
rend_visible("ligne_montant_tresorerie", true);
else
rend_visible("ligne_montant_tresorerie", false);
}
function gerer_proprietaire() {
var proprietaire_radio = document.getElementById("proprietaire_locataire");
rend_visible("ligne_montant_loyer", proprietaire_radio.checked);
}
function gerer_civilite_emprunteur() {
var civilite_emprunteur_radio = document.getElementById("civilite_emprunteur_mme");
rend_visible("ligne_nom_jeune_fille_emprunteur", civilite_emprunteur_radio.checked);
}
function gerer_civilite_co_emprunteur() {
var civilite_co_emprunteur_radio = document.getElementById("civilite_co_emprunteur_mme");
rend_visible("ligne_nom_jeune_fille_co_emprunteur", civilite_co_emprunteur_radio.checked);
}
function gerer_situation_familiale() {
var plusieur_radio = document.getElementById("plusieur_oui");
var object = document.getElementById("situation_familiale");
var selectedOption = object.options[object.selectedIndex];
var plusieurs = selectedOption.value != 1;
var civilite_co_emprunteur_mme = document.getElementById("civilite_co_emprunteur_mme");
var civilite_co_emprunteur_m = document.getElementById("civilite_co_emprunteur_m");
var civilite_co_emprunteur_mlle = document.getElementById("civilite_co_emprunteur_mlle");
var civilite_emprunteur_m = document.getElementById("civilite_emprunteur_m");
if (civilite_emprunteur_m.checked && selectedOption.value == 1) {
rend_visible("civilite_co_emprunteur_m", false);
rend_visible("civilite_co_emprunteur_mlle", false);
rend_visible("civilite_co_emprunteur_m_label", false);
rend_visible("civilite_co_emprunteur_mlle_label", false);
civilite_co_emprunteur_m.checked = false;
civilite_co_emprunteur_mlle.checked = false;
civilite_co_emprunteur_mme.checked = true;
} else {
rend_visible("civilite_co_emprunteur_mlle", true);
rend_visible("civilite_co_emprunteur_m", true);
rend_visible("civilite_co_emprunteur_m_label", true);
rend_visible("civilite_co_emprunteur_mlle_label", true);
}
var communaute = selectedOption.value == 1 || selectedOption.value == 8;
rend_visible("ligne_plusieur", plusieurs);
rend_visible("ligne_co_emprunteur", communaute || plusieur_radio.checked);
rend_visible("ligne_revenu_co_emprunteur", communaute || plusieur_radio.checked);
rend_visible("ligne_complement_revenu_co_emprunteur", !communaute);
rend_visible("ligne_enfants_co_emprunteur", !communaute && selectedOption.value != 2 && selectedOption.value != 6);
rend_visible("ligne_banque_co_emprunteur", plusieur_radio.checked && !communaute);
gerer_civilite_co_emprunteur();
gerer_civilite_emprunteur();
}
function gerer_plusieur() {
var object = document.getElementById("situation_familiale");
var selectedOption = object.options[object.selectedIndex];
var plusieur_radio = document.getElementById("plusieur_oui");
rend_visible("ligne_co_emprunteur", plusieur_radio.checked || selectedOption.value == 1);
rend_visible("ligne_revenu_co_emprunteur", plusieur_radio.checked || selectedOption.value == 1);
rend_visible("ligne_banque_co_emprunteur", plusieur_radio.checked || selectedOption.value == 1);
//rend_visible("ligne_meme_adresse_co_emprunteur", plusieur_radio.checked || selectedOption.value == 1);
gerer_civilite_co_emprunteur();
gerer_civilite_emprunteur();
}
function gerer_revenus_fonciers($suffix) {
var fonciers = document.getElementById("revenu_fonciers" + $suffix + "_oui");
rend_visible("ligne_montant_fonciers" + $suffix , fonciers.checked);
}
function gerer_autres_revenus($suffix) {
var autres = document.getElementById("revenu_autres" + $suffix + "_oui");
rend_visible("ligne_montant_autres" + $suffix , autres.checked);
}
function recuperer_contenu_liste_credit(nombre) {
var contenu = "";
for (i=0; i < nombre; i++) {
identifiant = i+1;
var type_de_credit = document.getElementById("type_credit_" + identifiant);
var mensualite_credit = document.getElementById("mensualite_credit_" + identifiant);
var restant_credit = document.getElementById("restant_credit_" + identifiant);
var mensualite = "";
if (mensualite_credit != null)
mensualite = mensualite_credit.value;
var restant = "";
if (restant_credit != null)
restant = restant_credit.value;
var valeur_type = 0;
if (type_de_credit != null)
valeur_type = parseInt(type_de_credit.value);
contenu += "\t\t
";
contenu += "\t\t\tType";
contenu += "\t\t\t";
contenu += "\t\t\t";
contenu += "\t\t\tmensualité";
contenu += "\t\t\t";
contenu += "\t\t\t€,";
contenu += "\t\t\trestant dû";
contenu += "\t\t\t";
contenu += "\t\t\t€";
contenu += "\t\t\t
";
}
return contenu;
}
function modifier_liste_credit(min, monbre) {
if (monbre < min)
monbre = min;
var contenu = recuperer_contenu_liste_credit(monbre);
var groupe_rachat_immo = document.getElementById("ligne_liste_credit");
if (groupe_rachat_immo == null || groupe_rachat_immo == 'undefined')
alert("Le groupe des crédits en cours n'existe pas");
groupe_rachat_immo.innerHTML = contenu;
image = document.getElementById("suppression_credit");
if (monbre > min)
image.src = "http://www.financeimmo.com/formulaires/images/supprimer.png";
else
image.src = "http://www.financeimmo.com/formulaires/images/supprimer_disabled.png";
document.getElementById("nombre_credit").value = monbre;
}
function ajouter_un_credit(min){
var strNombre = document.getElementById("nombre_credit").value;
var nNb = parseInt(strNombre) + 1;
modifier_liste_credit(min, nNb);
}
function supprimer_un_credit(min){
var strNombre = document.getElementById("nombre_credit").value;
var nNb = parseInt(strNombre) - 1;
modifier_liste_credit(min, nNb);
}
function afficher_les_credits(){
var nombre = parseInt(document.getElementById("nombre_credit").value);
modifier_liste_credit(1, nombre);
}
function gerer_pensions_alimentaires() {
var question_radio = document.getElementById("pensions_alimentaires_oui");
rend_visible("ligne_montant_pensions", question_radio.checked);
}
function gerer_autres_charges() {
var question_radio = document.getElementById("autres_charge_oui");
rend_visible("ligne_montant_autres_charge", question_radio.checked);
}
function montrer_a_racheter(visible) {
var strNombre = document.getElementById("nombre_credit").value;
var nombre = parseInt(strNombre);
for (var i=1; i <= nombre; i++) {
rend_visible("rachat_" + i, visible);
rend_visible("rachat_" + i + "_label", visible);
}
}
function gerer_question_apport() {
var question_oui = document.getElementById("question_apport_oui");
rend_visible("ligne_apport", question_oui.checked);
}
function gerer_avoir_credit() {
var question_avaoir_credit = document.getElementById("a_credits_oui");
rend_visible("groupe_credit", question_avaoir_credit.checked);
}
function gerer_type_de_projet() {
var categories = new Array("description_bien", "etat_civil", "revenus", "charges", "banques", "coordonnees", "projet", "relais", "financement");
var question_rachat = document.getElementById("type_projet_rch");
var couleur_puce = "rgb(204, 102, 0)";
var couleur_titre = "rgb(246, 139, 30)";
rend_visible("ligne_partie_rachat", question_rachat.checked);
rend_visible("ligne_partie_acquisition", !question_rachat.checked);
rend_visible("ligne_domiciliation", !question_rachat.checked);
rend_visible("relais", !question_rachat.checked);
rend_visible("financement", !question_rachat.checked);
if (!question_rachat.checked) {
couleur_puce = "rgb(220, 0, 0)";
couleur_titre = "rgb(220, 29, 29)";
}
for (var i = 0; i < categories.length; i++) {
var element = categories[i];
var puce = document.getElementById(element + "_puce");
var titre = document.getElementById(element + "_titre");
puce.style.backgroundColor = couleur_puce;
titre.style.backgroundColor = couleur_titre;
}
var situation_habitation = document.getElementById("situation_habitation");
gerer_situation_habitation(situation_habitation);
}
function gerer_nature_bien() {
var object = document.getElementById("nature_bien");
var selectedOption = object.options[object.selectedIndex];
rend_visible("age_bien", selectedOption.value == 1 || selectedOption.value == 2);
rend_visible("autre_nature" , selectedOption.value == 6);
rend_visible("ligne_valeur_bien", selectedOption.value == 1 || selectedOption.value == 2 || selectedOption.value == 6);
rend_visible("ligne_prix_terrain", selectedOption.value == 4 || selectedOption.value == 3);
rend_visible("ligne_prix_construction", selectedOption.value == 4 || selectedOption.value == 15);
rend_visible("ligne_notaire", selectedOption.value != 15);
var element = document.getElementById("ligne_prix_construction");
if (selectedOption.value == 15)
element.style.marginTop = "6pt";
else
element.style.marginTop = "";
calculer_montant_total();
}
function calculer_estimation_notaire(valeur, ancien) {
var object = document.getElementById("notaire");
if (valeur == "" || isNaN(valeur)) {
object.value = "";
} else {
var prix = parseInt(valeur);
var droits = (prix*0.0509) + (prix*0.001);
if (!ancien)
droits = (prix*0.00715) + (prix*0.001);
var emoluments = 0;
if (prix <= 3050)
emoluments = prix * 0.05;
else if (prix <=6100)
emoluments = (3050 * 0.05) + ((prix - 3050) * 0.033);
else if (prix <=16770)
emoluments = (3050 * 0.083) + ((prix - 6100) * 0.0165);
else
emoluments = (3050 * 0.083) + ((16770-6100) * 0.0165) + ((prix - 16770) * 0.00825);
//TVA
emoluments *= 1.196;
total = droits + emoluments + 750;
total = Math.ceil(Math.round(total*100) / 100.0);
object.value = total;
}
}
function gerer_valeur_bien() {
var valeur_bien = document.getElementById("valeur_bien").value;
var age_selection = document.getElementById("age_bien");
var age = age_selection.options[age_selection.selectedIndex];
calculer_estimation_notaire(valeur_bien, age.value == "1");
calculer_montant_total();
}
function gerer_prix_terrain() {
var valeur_bien = document.getElementById("prix_terrain").value;
calculer_estimation_notaire(valeur_bien, true);
calculer_montant_total();
}
function gerer_age_bien() {
var object = document.getElementById("nature_bien");
var selectedOption = object.options[object.selectedIndex];
if (selectedOption.value == 1 || selectedOption.value == 2) {
gerer_valeur_bien();
}
else if (selectedOption.value != 6 && selectedOption.value != 15) {
gerer_prix_terrain();
}
}
function lister_nom_element_formulaires() {
var names = "";
for (var index = 0; index < document.forms.length; index++) {
var form = document.forms[index];
for (var index_f = 0; index_f < form.elements.length; index_f++) {
var element = form.elements[index_f];
names += element.name + "
\n";
}
}
var listing = document.getElementById("listing");
listing.innerHTML = names;
}
function gerer_compromis() {
/* var compromis = document.getElementById("compromis_1");
rend_visible("ligne_code_postal_bien", !compromis.checked);*/
}
function gerer_visibilite(identifiant, ligne, visible) {
var radio = document.getElementById(identifiant);
rend_visible(ligne, radio.checked == visible);
}
function recuperer_contenu_liste_credit_immo(nombre) {
var contenu = "";
for (i=0; i < nombre; i++) {
identifiant = i+1;
var mensualite_credit = document.getElementById("mensualite_credit_immo_" + identifiant);
var restant_credit = document.getElementById("restant_credit_immo_" + identifiant);
var valeur_bien = document.getElementById("valeur_bien_" + identifiant);
var mensualite = "";
if (mensualite_credit != null)
mensualite = mensualite_credit.value;
var restant = "";
if (restant_credit != null)
restant = restant_credit.value;
var valeur = "";
if (valeur_bien != null)
valeur = valeur_bien.value;
contenu += "\t\t";
contenu += "\t\t\tmensualité";
contenu += "\t\t\t";
contenu += "\t\t\t€,";
contenu += "\t\t\trestant dû";
contenu += "\t\t\t";
contenu += "\t\t\t€,";
contenu += "\t\t\tvaleur du bien";
contenu += "\t\t\t";
contenu += "\t\t\t€";
contenu += "\t\t\t
";
}
return contenu;
}
function modifier_liste_credit_immo(min, monbre) {
if (monbre < min)
monbre = min;
var contenu = recuperer_contenu_liste_credit_immo(monbre);
var groupe_rachat_immo = document.getElementById("ligne_liste_rachat_immo");
if (groupe_rachat_immo == null || groupe_rachat_immo == 'undefined')
alert("Le groupe des crédits immobilier n'existe pas");
groupe_rachat_immo.innerHTML = contenu;
image = document.getElementById("suppression_credit_immo");
if (monbre > min)
image.src = "http://www.financeimmo.com/formulaires/images/supprimer.png";
else
image.src = "http://www.financeimmo.com/formulaires/images/supprimer_disabled.png";
document.getElementById("nombre_rachat_immo").value = monbre;
}
function ajouter_un_credit_immo(min){
var strNombre = document.getElementById("nombre_rachat_immo").value;
var nNb = parseInt(strNombre) + 1;
modifier_liste_credit_immo(min, nNb);
}
function supprimer_un_credit_immo(min){
var strNombre = document.getElementById("nombre_rachat_immo").value;
var nNb = parseInt(strNombre) - 1;
modifier_liste_credit_immo(min, nNb);
}
function afficher_les_credits_immo(){
var nombre = parseInt(document.getElementById("nombre_rachat_immo").value);
modifier_liste_credit_immo(1, nombre);
}
function recuperer_contenu_liste_credit_conso(nombre) {
var contenu = "";
for (i=0; i < nombre; i++) {
identifiant = i+1;
var type_de_credit = document.getElementById("type_credit_conso_" + identifiant);
var mensualite_credit = document.getElementById("mensualite_credit_conso_" + identifiant);
var restant_credit = document.getElementById("restant_credit_conso_" + identifiant);
var mensualite = "";
if (mensualite_credit != null)
mensualite = mensualite_credit.value;
var restant = "";
if (restant_credit != null)
restant = restant_credit.value;
var valeur_type = 0;
if (type_de_credit != null)
valeur_type = parseInt(type_de_credit.value);
contenu += "\t\t";
contenu += "\t\t\tType";
contenu += "\t\t\t";
contenu += "\t\t\t";
contenu += "\t\t\tmensualité";
contenu += "\t\t\t";
contenu += "\t\t\t€,";
contenu += "\t\t\trestant dû";
contenu += "\t\t\t";
contenu += "\t\t\t€";
contenu += "\t\t\t
";
}
return contenu;
}
function modifier_liste_credit_conso(min, monbre) {
if (monbre < min)
monbre = min;
var contenu = recuperer_contenu_liste_credit_conso(monbre);
var groupe_rachat_conso = document.getElementById("ligne_liste_rachat_conso");
if (groupe_rachat_conso == null || groupe_rachat_conso == 'undefined')
alert("Le groupe des crédits consobilier n'existe pas");
groupe_rachat_conso.innerHTML = contenu;
image = document.getElementById("suppression_credit_conso");
if (monbre > min)
image.src = "http://www.financeimmo.com/formulaires/images/supprimer.png";
else
image.src = "http://www.financeimmo.com/formulaires/images/supprimer_disabled.png";
document.getElementById("nombre_rachat_conso").value = monbre;
}
function ajouter_un_credit_conso(min){
var strNombre = document.getElementById("nombre_rachat_conso").value;
var nNb = parseInt(strNombre) + 1;
modifier_liste_credit_conso(min, nNb);
}
function supprimer_un_credit_conso(min){
var strNombre = document.getElementById("nombre_rachat_conso").value;
var nNb = parseInt(strNombre) - 1;
modifier_liste_credit_conso(min, nNb);
}
function afficher_les_credits_conso(){
var nombre = parseInt(document.getElementById("nombre_rachat_conso").value);
modifier_liste_credit_conso(1, nombre);
}
function gerer_annee(input) {
if (input.value == "AAAA")
input.value = "";
}
function gerer_situation_habitation(element) {
var question_rachat = document.getElementById("type_projet_rch");
var a_rachat_immo = document.getElementById("a_rachat_immo_oui");
var selectedValue = element.options[element.selectedIndex].value;
rend_visible("ligne_veut_relais", selectedValue == 1 && !question_rachat.checked);
rend_visible("ligne_valeur_propriete", selectedValue == 1 && question_rachat.checked && !a_rachat_immo.checked);
rend_visible("ligne_montant_loyer", selectedValue == 0);
if (selectedValue == 1 && !question_rachat.checked)
gerer_visibilite('veut_relais_oui', 'relais', true);
else
rend_visible("relais", false);
}
function gerer_rachat_immo() {
gerer_visibilite('a_rachat_immo_oui', 'ligne_rachat_immo', true);
var situation_habitation = document.getElementById("situation_habitation");
gerer_situation_habitation(situation_habitation);
}
function gerer_revente_nette() {
var valeur = document.getElementById("valeur_relais").value;
var restant = document.getElementById("restant_relais").value;
if (!isNaN(valeur) && !isNaN(restant)) {
var nette = valeur - restant;
document.getElementById("revente_nette").value = nette;
document.getElementById("apport_relais").value = Math.ceil((nette * 70) / 100);
calculer_montant_total();
}
}
function gerer_revenu_salarie(suffix) {
var valeur = parseInt(document.getElementById("montant_salaire" + suffix).value);
var total = 12 * valeur;
if (document.getElementById("prime" + suffix + "_oui").checked)
total += parseInt(document.getElementById("montant_prime" + suffix).value);
document.getElementById("annuel_salaire" + suffix).value = total;
}
function gerer_nature_salaire(element, suffix) {
var selectedValue = element.options[element.selectedIndex].value;
rend_visible("ligne_anciennete" + suffix, selectedValue != "" && selectedValue != "1" && selectedValue != "4" && selectedValue != "5");
rend_visible("ligne_collectivite" + suffix, selectedValue != "" && selectedValue == "4");
rend_visible("ligne_plus_de_trois" + suffix, selectedValue == "5");
}
var taux = new Array();
taux['5'] = 2.84;taux['10'] = 3;taux['15'] = 3.5;taux['20'] = 3.65;taux['25'] = 3.8;taux['30'] = 3.95;
function caculer_echeance(montant, annees) {
var courrant = taux['30'];
if (annees <= 25 )
courrant = taux['25'];
if (annees <= 20 )
courrant = taux['20'];
if (annees <= 15 )
courrant = taux['15'];
if (annees <= 10 )
courrant = taux['10'];
if (annees <= 5 )
courrant = taux['5'];
var dummy = (1200 + courrant) / 1200;
var power = Math.pow (dummy, -12 * annees);
var temp = 1 - power;
return (montant * courrant) / (1200 * temp);
}
function calculer_autre_mensualite(selectionne) {
if (selectionne)
document.getElementById("duree_credit_autre").checked = true;
var montant_total = document.getElementById("montant_total").value;
if (isNaN(montant_total) || montant_total == "")
return;
var annee = document.getElementById("valeur_autre_duree").value;
if (isNaN(annee) || annee == "")
return;
document.getElementById("dummy").value = Math.ceil(caculer_echeance(parseInt(montant_total), parseInt(annee)));
}
function calcule_credit() {
var montant_total = document.getElementById("montant_total").value;
if (isNaN(montant_total) || montant_total == "")
return;
document.getElementById("duree_credit_15_label").innerHTML = '15 ansSoit un mensualité de environ ' + Math.ceil(caculer_echeance(parseInt(montant_total), 15)) + " €";
document.getElementById("duree_credit_20_label").innerHTML = '20 ansSoit un mensualité de environ ' + Math.ceil(caculer_echeance(parseInt(montant_total), 20)) + " €";
document.getElementById("duree_credit_25_label").innerHTML = '25 ansSoit un mensualité de environ ' + Math.ceil(caculer_echeance(parseInt(montant_total), 25)) + " €";
document.getElementById("duree_credit_30_label").innerHTML = '30 ansSoit un mensualité de environ ' + Math.ceil(caculer_echeance(parseInt(montant_total), 30)) + " €";
calculer_autre_mensualite(false);
}
function calculer_montant_total() {
var object = document.getElementById("nature_bien");
var selectedOption = object.options[object.selectedIndex];
var montant_total = 0;
if (selectedOption.value == 1 || selectedOption.value == 2 || selectedOption.value == 6) {
var valeur_bien = document.getElementById("valeur_bien").value;
if (valeur_bien == "" || isNaN(valeur_bien))
return;
montant_total += parseInt(valeur_bien);
}
if (selectedOption.value == 4 || selectedOption.value == 3) {
var prix_terrain = document.getElementById("prix_terrain").value;
if (prix_terrain == "" || isNaN(prix_terrain))
return;
montant_total += parseInt(prix_terrain);
}
if (selectedOption.value == 4 || selectedOption.value == 15) {
var prix_construction = document.getElementById("prix_construction").value;
if (prix_construction == "" || isNaN(prix_construction))
return;
montant_total += parseInt(prix_construction);
}
if (selectedOption.value != 15) {
var notaire = document.getElementById("notaire").value;
if (notaire == "" || isNaN(notaire))
return;
montant_total += parseInt(notaire);
}
var travaux = document.getElementById("travaux").value;
if (!(travaux == "" || isNaN(travaux)))
montant_total += parseInt(travaux);
var situation_habitation = document.getElementById("situation_habitation");
var selectedValue = situation_habitation.options[situation_habitation.selectedIndex].value;
if (selectedValue == 1) {
if (document.getElementById("veut_relais_oui").checked) {
var relais = document.getElementById("apport_relais").value
if (relais == "" || isNaN(relais))
return;
montant_total -= parseInt(relais);
}
}
if (document.getElementById("question_apport_oui").checked) {
var apport = document.getElementById("apport").value
if (apport == "" || isNaN(apport))
return;
montant_total -= parseInt(apport);
}
document.getElementById("montant_total").value = montant_total;
calcule_credit();
}
function verifier_montant_total() {
if (document.getElementById("montant_total").value == "")
calculer_montant_total();
}
function au_chargement(tout) {
var question_rachat = document.getElementById("type_projet_rch");
if (tout) {
gerer_type_de_projet();
if (question_rachat.checked) {
gerer_rachat_immo();
gerer_visibilite('a_rachat_conso_oui', 'ligne_rachat_conso', true);
gerer_visibilite('tresorerie_oui', 'ligne_montant_tresorerie', true);
}
}
gerer_compromis();
gerer_question_apport();
gerer_civilite_emprunteur();
gerer_civilite_co_emprunteur();
gerer_plusieur();
var situation_habitation = document.getElementById("situation_habitation");
gerer_situation_habitation(situation_habitation);
var nature_salaire = document.getElementById("nature_salaire_emprunteur");
gerer_nature_salaire(nature_salaire,'_emprunteur');
var nature_salaire_co = document.getElementById("nature_salaire_co_emprunteur");
gerer_nature_salaire(nature_salaire_co,'co_emprunteur');
gerer_visibilite('revenu_salarie_emprunteur_oui', 'ligne_groupe_salaire_emprunteur', true);
gerer_visibilite('revenu_salarie_co_emprunteur_oui', 'ligne_groupe_salaire_co_emprunteur', true)
gerer_visibilite('revenu_non_salarie_emprunteur_oui', 'ligne_groupe_non_salaire_emprunteur', true);
gerer_visibilite('revenu_non_salarie_co_emprunteur_oui', 'ligne_groupe_non_salaire_co_emprunteur', true)
gerer_visibilite('prime_emprunteur_oui', 'ligne_montant_prime_emprunteur', true);
gerer_visibilite('prime_co_emprunteur_oui', 'ligne_montant_prime_co_emprunteur', true);
gerer_visibilite('pensions_emprunteur_oui', 'ligne_groupe_pensions_emprunteur', true);
gerer_visibilite('pensions_co_emprunteur_oui', 'ligne_groupe_pensions_co_emprunteur', true);
gerer_revenus_fonciers('_emprunteur');
gerer_revenus_fonciers('_co_emprunteur');
gerer_autres_revenus('_co_emprunteur');
gerer_visibilite('a_credits_oui', 'ligne_credit_en_cours', true);
afficher_les_credits();
afficher_les_credits_immo();
afficher_les_credits_conso();
gerer_pensions_alimentaires();
charger_code_postal('');
calculer_montant_total();
}
function mise_a_jour(rachat, immo, conso) {
var question_rachat = document.getElementById("type_projet_rch");
var question_acquisition = document.getElementById("type_projet_acq");
question_rachat.checked = rachat;
question_acquisition.checked = !rachat;
gerer_type_de_projet();
var question_immo_oui = document.getElementById("a_rachat_immo_oui");
var question_immo_non = document.getElementById("a_rachat_immo_non");
question_immo_oui.checked = immo;
question_immo_non.checked = !immo;
gerer_visibilite("a_rachat_immo_oui", "ligne_rachat_immo", true);
rend_visible("ligne_a_rachat_immo", false);
var question_conso_oui = document.getElementById("a_rachat_conso_oui");
var question_conso_non = document.getElementById("a_rachat_conso_non");
question_conso_oui.checked = conso;
question_conso_non.checked = !conso;
gerer_visibilite("a_rachat_conso_oui", "ligne_rachat_conso", true);
rend_visible("ligne_a_rachat_conso", false);
rend_visible("projet", false);
var a_credits_label = document.getElementById("a_credits_label");
if (a_credits_label != null) {
if (!rachat || !conso) {
a_credits_label.innerHTML = "Avez-vous des crédit en cours?";
a_credits_label.style.paddingRight = "60pt";
} else {
a_credits_label.innerHTML = "Avez-vous d'autre(s) crédit(s) en cours?";
a_credits_label.style.paddingRight = "20pt";
}
}
gerer_visibilite('a_rachat_conso_oui','ligne_bdf', true);
gerer_visibilite('a_rachat_conso_oui','ligne_restructuration', true);
gerer_visibilite('a_rachat_conso_oui','ligne_rejet', false);
if (rachat && conso) {
gerer_visibilite('bdf_oui','ligne_banque_de_france', true);
gerer_visibilite('bdf_oui','ligne_rejet', false);
gerer_visibilite('restructuration_oui','ligne_restructuration_de_dettes', true);
gerer_visibilite('rejet_oui','ligne_nombre_rejets', true);
} else {
rend_visible('ligne_banque_de_france', false);
rend_visible('ligne_rejet', false);
rend_visible('ligne_nombre_rejets', false);
rend_visible('ligne_restructuration', false);
rend_visible('ligne_restructuration_de_dettes', false);
}
au_chargement(false);
}