var map=null;var geocoder=null;var marker=null;var point=null;function InitGoogleMap(){if(GBrowserIsCompatible()){map=new GMap2(document.getElementById('google_map'));map.setUIToDefault();map.addControl(new GOverviewMapControl());point=new GLatLng(43.599414,3.925509);map.setCenter(point,5);map.setMapType(G_HYBRID_MAP);geocoder=new GClientGeocoder()}}function showAddress(address){if(geocoder){geocoder.getLatLng(address,function(unpoint){if(!unpoint){alert(address+" non trouvé. Essayez avec seulement le nom de la ville.")}else{map.setCenter(unpoint,13);map.closeInfoWindow();if(marker){map.removeOverlay(marker)}marker=new GMarker(unpoint,{draggable:true});map.addOverlay(marker);document.form2submit.latlng.value=marker.getPoint().toUrlValue();marker.openInfoWindowHtml("Vous pouvez zoomer et déplacer le marqueur<br>pour être le plus précis possible");GEvent.addListener(marker,"click",function(){map.setCenter(unpoint,map.getZoom()+1)});GEvent.addListener(marker,"dragstart",function(){map.closeInfoWindow()});GEvent.addListener(marker,"dragend",function(){document.form2submit.latlng.value=marker.getPoint().toUrlValue()})}})}}function initAddress(){var adresse='';if(document.form2submit.rue2.value!=''){if(adresse!=''){adresse=adresse+', '}adresse=adresse+document.form2submit.rue2.value}if((document.form2submit.codepostal.value!='')||(document.form2submit.ville.value!='')){if(adresse!=''){adresse=adresse+', '}adresse=adresse+document.form2submit.codepostal.value+' '+document.form2submit.ville.value}document.formlatlng.address.value=adresse}window.onload=InitGoogleMap;window.onunload=GUnload;function CheckLen(Target,MaxLen,Reste){StrLen=Target.value.length;if(StrLen>MaxLen){Target.value=Target.value.substring(0,MaxLen);CharsLeft=MaxLen}else{CharsLeft=StrLen}var CharsLeft1=MaxLen-CharsLeft;Reste.value=CharsLeft1}