   		var map = null;
		var geocoder = null;
	
		function load() {
		  if (GBrowserIsCompatible()) {
			map = new GMap2(document.getElementById("map"));
			map.addControl(new GSmallMapControl());
			map.addControl(new GScaleControl());
			//map.addControl(new GOverviewMapControl());
			map.addControl(new GMapTypeControl());
			geocoder = new GClientGeocoder();
		  }
		}
	
		function showAddress(address,infobulle) {
		  if (geocoder) {
			geocoder.getLatLng(
			  address,
			  function(point) {
				if (!point) {
				  alert(address + " not found");
				} else {
				  map.setCenter(point, 13);
				  var marker = new GMarker(point);
				  map.addOverlay(marker);
				  GEvent.addListener(marker, "click", function() {
          		  	marker.openInfoWindowHtml(infobulle);
        		  });
				  marker.openInfoWindowHtml(infobulle);
				}
			  }
			);
		  }
		}

function getFocus(inElement) {
//document.getElementById(inElement).style.visibility='visible';
//document.getElementById(inElement).style.display='block';
document.getElementById(inElement).style.color='#555555';
document.getElementById(inElement).style.borderColor='#dddddd';
}

function getBlur(inElement) {
//document.getElementById(inElement).style.visibility='hidden';
//document.getElementById(inElement).style.display='none';
document.getElementById(inElement).style.borderColor='#FFFFFF';
document.getElementById(inElement).style.color='#dddddd';
}


function count_credit(){
//window.alert(document.getElementById("tabcredits").getElementsByTagName("tr").length - 1);
document.frm_etude.credit_count.value = document.getElementById("tabcredits").getElementsByTagName("tr").length - 1;
}

function count_immo(){
//window.alert(document.getElementById("pat_immo").getElementsByTagName("tr").length - 1);
document.frm_etude.immo_count.value = document.getElementById("pat_immo").getElementsByTagName("tr").length - 1;
}


//Crédit

//proprio
function show_proprio() {
	
	f = document.frm_etude;
	
	if(f.logement[1].checked == true || f.logement[2].checked == true) {
		document.getElementById("question_proprio").style.display = "";
		
	}else{
		document.getElementById("question_proprio").style.display = "none";
	}
	
}

//patrimoine
function show_patrimoine() {
	
	f = document.frm_etude;
	
	if(f.logement[0].checked == true || f.proprio[0].checked == true) {
		document.getElementById("patrimoine_immo").style.display = "";
	}
	else {
		document.getElementById("patrimoine_immo").style.display = "none";
	}

}

//champs coemprunteur
function show_coemp() {
	
	f = document.frm_etude;
	tab_champs = new Array("salaire_co_mois","salaire_co","profession_co","contrat_co","anciennete_co_mois","anciennete_co_an","jour_naiss_co", "mois_naiss_co", "annee_naiss_co", "nom_co", "prenom_co");
	taille_tab = tab_champs.length;

	if(f.co[1].checked == false) {
		for(i = 0; i < taille_tab; i++) {
			f.elements[tab_champs[i]].disabled = false;
			f.elements[tab_champs[i]].style.backgroundColor = "#f8f8f8";
			document.getElementById('civ_co_1').disabled=false;
			document.getElementById('civ_co_2').disabled=false;
			document.getElementById('civ_co_3').disabled=false;
		}	
	}
	else {
		for(i = 0; i < taille_tab; i++) {
			f.elements[tab_champs[i]].disabled = true;
			f.elements[tab_champs[i]].style.backgroundColor = "#dddddd";
			document.getElementById('civ_co_1').disabled=true;
			document.getElementById('civ_co_2').disabled=true;
			document.getElementById('civ_co_3').disabled=true;
		}
	}
	
}

//ligne patrimoine
function add_immo(){  
  var newLigne = document.getElementById("pat_immo").insertRow(-1);
  var tabBiens = document.getElementById("pat_immo");
	var numBien = tabBiens.getElementsByTagName("tr").length - 2;
	numBien++;
	monnaieencours = "&euro;";
  newCell = newLigne.insertCell(0);
  newCell.innerHTML = "Bien immobilier n°" + numBien;
  newCell = newLigne.insertCell(1);
  newCell.innerHTML = "<select name='immo_type"+ numBien +"' class=\"iselect\" style='width:177px;'><option value=''></option><option value=1 >Résidence principale</option><option value=2 >Résidence secondaire</option><option value=3 >Investissement locatif - Défiscalisation</option><option value=4 >Investissement locatif - Autre</option></select>";
  newCell = newLigne.insertCell(2);
  newCell.innerHTML = "<input type=text name=immo_valeur"+ numBien +" size=7 value='0' class=\"itext\"> "+ monnaieencours;
}

//credits
function add_credit()
	{
	var monnaieencours;
	var tabcredits = document.getElementById("tabcredits");
	var lignecredit = tabcredits.getElementsByTagName("tr").length;

	if(lignecredit < 30) {
		monnaieencours = "&euro;";
		//document.frm_etude.credit_count.value = lignecredit+1;
		
		in1 = "Crédit n°"+(lignecredit);
		in2 = "<select onFocus=\"getFocus('helpCredit');\" onBlur=\"getBlur('helpCredit');\" name='credit_type"+lignecredit+"' class=\"iselect\" style='width:135px;'><option value=\"\"></option><option value=\"1\">Consommation</option><option  value=\"2\">Immobilier</option><option  value=\"3\">Personnel</option><option  value=\"4\">Prêt à taux zéro</option><option  value=\"5\">Réserve d'argent</option><option  value=\"6\">Autres</option></select>";
		in2bis = "&nbsp; ";
		in3 = "<center><input onFocus=\"getFocus('helpCredit');\" onBlur=\"getBlur('helpCredit');\" type='text' class=\"itext\" size=8 name='credit_mensualite"+lignecredit+"'> "+monnaieencours+"/mois</center>";
		//in3bis = "&nbsp; ";
		in4 = "<center><input onFocus=\"getFocus('helpCredit');\" onBlur=\"getBlur('helpCredit');\" type='text' class=\"itext\" size=8 name='credit_restant"+lignecredit+"'>&nbsp;"+monnaieencours+"&nbsp;&nbsp;</center>";
		in4bis = "&nbsp; ";
		in5 = "<center><input onFocus=\"getFocus('helpCredit');\" onBlur=\"getBlur('helpCredit');\" type=radio name='credit_inclure"+lignecredit+"' checked>Oui &nbsp;<input onFocus=\"getFocus('helpCredit');\" onBlur=\"getBlur('helpCredit');\" type=radio name='credit_inclure"+lignecredit+"'>Non</center>";
		//in5bis = "&nbsp; ";
		var l = tabcredits.insertRow(tabcredits.rows.length); 
		var c = l.insertCell(l.cells.length);

		c.innerHTML = in1; 
		c = l.insertCell(l.cells.length); 
		c.innerHTML = in2;
		c = l.insertCell(l.cells.length);
		c.innerHTML = in2bis;
		c = l.insertCell(l.cells.length);
		c.innerHTML = in3;
		c = l.insertCell(l.cells.length);
		//c.innerHTML = in3bis;
		//c = l.insertCell(l.cells.length);
		c.innerHTML = in4;
		c = l.insertCell(l.cells.length);
		c.innerHTML = in4bis;
		c = l.insertCell(l.cells.length);
		c.innerHTML = in5;
		//c = l.insertCell(l.cells.length);
		//c.innerHTML = in5bis;
		//c = l.insertCell(l.cells.length);
		lignecredit++;
		}
	}