var address=Array();var name=Array();var coordTab=Array('','');var map;function initializeMapXml(){if(GBrowserIsCompatible()){map=new GMap2(document.getElementById("myMap"));var debug=false;map.enableScrollWheelZoom();var positionMapControl=new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(10,50));map.addControl(new GSmallMapControl(),positionMapControl);map.addControl(new GMapTypeControl());map.addControl(new SpecialZoomControl());setFrZoom();if(debug){cslDebug=document.getElementById('debug');GEvent.addListener(map,"moveend",function(){var center=map.getCenter();var theZoom=map.getZoom();txtDebug=center.toString()+' Zoom : '+theZoom;cslDebug.innerHTML=txtDebug;});}}else{alert("Votre navigateur ne supporte pas le module GoogleMap !");}}function gm_load(urlXml,latD,lngD,zoom){map.clearOverlays();GDownloadUrl(urlXml,function(data){var xml=GXml.parse(data);var markers=xml.documentElement.getElementsByTagName("marker");for(var i=0;i<markers.length;i++){var lien=markers[i].getAttribute("lien");var content=markers[i].getAttribute("content");if(markers[i].getAttribute("lat")!=''){var lat=parseFloat(markers[i].getAttribute("lat"));var lng=parseFloat(markers[i].getAttribute("lng"));var point=new GLatLng(lat,lng);map.addOverlay(createXmlMarker(point,lien,content));}else if((markers[i].getAttribute("cp")!=''||markers[i].getAttribute("ville")!='')&&markers[i].getAttribute("pays")!=''){get_gpsXml(markers[i].getAttribute("adr"),markers[i].getAttribute("cp"),markers[i].getAttribute("ville"),markers[i].getAttribute("pays"),lien,content);}}});}function gm_loadAndPlace(lat,lng,zoom){if(GBrowserIsCompatible()){map=new GMap2(document.getElementById("myMap"));map.addControl(new GSmallMapControl());map.addControl(new GMapTypeControl());var lat=parseFloat(lat);var lng=parseFloat(lng);var zoom=(zoom==''||zoom==undefined)?7:zoom;var point=new GLatLng(lat,lng);map.setCenter(point,zoom);var marker=new GMarker(point);map.addOverlay(marker);}}function createMarker(point,name,address,lien){var marker=new GMarker(point);if(content){GEvent.addListener(marker,'click',function(){marker.openInfoWindowHtml(content);});}if(lien!=''){GEvent.addListener(marker,'dblclick',function(){document.location.href=lien;});}return marker;}function createXmlMarker(point,lien,content){var marker=new GMarker(point);if(content!=''){GEvent.addListener(marker,'click',function(){marker.openInfoWindowHtml(content);});}if(lien!=''){GEvent.addListener(marker,'dblclick',function(){document.location.href=lien;});}return marker;}function get_gps(adresse,cp,ville,pays,idIn,idOut,passage){if(GBrowserIsCompatible()){var geocoder=new GClientGeocoder();var adr=adresse+' '+cp+' '+ville+' '+pays;var passage=passage||1;geocoder.getLatLng(adr,function(point){if(!point){if(passage>=3){geocoder=null;gm_swapBox(idOut,idIn);}else if(adresse==''&&ville!=''){geocoder=null;passage++;get_gps('','',ville,pays,idIn,idOut,passage);}else if(adresse==''&&ville==''&&cp!=''){geocoder=null;passage++;get_gps('',cp,'',pays,idIn,idOut,passage);}}else{geocoder=null;gm_loadAndPlace(point.lat(),point.lng(),12);gm_swapBox(idIn,idOut);}});}}function get_gpsXml(adresse,cp,ville,pays,lien,content,passage){if(GBrowserIsCompatible()){var geocoder=new GClientGeocoder();var adr=adresse+' '+cp+' '+ville+' '+pays;var passage=passage||1;geocoder.getLatLng(adr,function(point){if(!point){if(passage>=3){geocoder=null;}else if(adresse==''&&ville!=''){geocoder=null;passage++;get_gpsXml('','',ville,pays,lien,content,passage);}else if(adresse==''&&ville==''&&cp!=''){geocoder=null;passage++;get_gpsXml('',cp,'',pays,lien,content,passage);}}else{geocoder=null;map.addOverlay(createXmlMarker(point,lien,content));}});}}function gm_swapBox(idIn,idOut){document.getElementById(idIn).style.display='block';document.getElementById(idOut).style.display='none';}function gm_getZoom(region){if(region=='')return null;var geocoder=new GClientGeocoder();geocoder.getLocations(region,function(response){if(!response||response.Status.code!=200){geocoder=null;}else{}});}function setDirections(fromAddress,toAddress,locale){gdir=new GDirections(map,document.getElementById("directions"));GEvent.addListener(gdir,"load",onGDirectionsLoad);GEvent.addListener(gdir,"error",handleErrors);gdir.load("from: "+fromAddress+" to: "+toAddress,{"locale":locale});}function handleErrors(){if(gdir.getStatus().code==G_GEO_UNKNOWN_ADDRESS)alert("Erreur n° "+gdir.getStatus().code+"\nAucune correspondance n'a ï¿½tï¿½ trouvï¿½e avec l'adresse spï¿½cifiï¿½e. Cette adresse est peut ï¿½tre trop rï¿½cente, imcomplï¿½te ou incorrecte.");else if(gdir.getStatus().code==G_GEO_SERVER_ERROR)alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: "+gdir.getStatus().code);else if(gdir.getStatus().code==G_GEO_MISSING_QUERY)alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: "+gdir.getStatus().code);else if(gdir.getStatus().code==G_GEO_BAD_KEY)alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: "+gdir.getStatus().code);else if(gdir.getStatus().code==G_GEO_BAD_REQUEST)alert("A directions request could not be successfully parsed.\n Error code: "+gdir.getStatus().code);else alert("Une erreur inconnue s'est produite");}function onGDirectionsLoad(){}function SpecialZoomControl(){}SpecialZoomControl.prototype=new GControl();SpecialZoomControl.prototype.initialize=function(map){var container=document.createElement("div");var contZoomFrDiv=document.createElement("div");this.setButtonStylePre_(contZoomFrDiv);var zoomFrDiv=document.createElement("div");this.setButtonStyle_(zoomFrDiv);container.appendChild(contZoomFrDiv);contZoomFrDiv.appendChild(zoomFrDiv);zoomFrDiv.appendChild(document.createTextNode("France"));GEvent.addDomListener(zoomFrDiv,"click",function(){setFrZoom();});var contZoomWorlDiv=document.createElement("div");this.setButtonStylePre_(contZoomWorlDiv);var zoomWorldDiv=document.createElement("div");this.setButtonStyle_(zoomWorldDiv);container.appendChild(contZoomWorlDiv);contZoomWorlDiv.appendChild(zoomWorldDiv);zoomWorldDiv.appendChild(document.createTextNode("Monde"));GEvent.addDomListener(zoomWorldDiv,"click",function(){setWorldZoom();});map.getContainer().appendChild(container);return container;};SpecialZoomControl.prototype.getDefaultPosition=function(){return new GControlPosition(G_ANCHOR_TOP_LEFT,new GSize(7,7));};SpecialZoomControl.prototype.setButtonStylePre_=function(button){button.style.backgroundColor="white";button.style.borderBottomColor="black";button.style.borderBottomStyle="solid";button.style.borderBottomWidth="1px";button.style.borderLeftColor="black";button.style.borderLeftStyle="solid";button.style.borderLeftWidth="1px";button.style.borderRightColor="black";button.style.borderRightStyle="solid";button.style.borderRightWidth="1px";button.style.borderTopColor="black";button.style.borderTopStyle="solid";button.style.borderTopWidth="1px";button.style.cursor="pointer";button.style.textAlign="center";button.style.width="5em";};SpecialZoomControl.prototype.setButtonStyle_=function(button){button.style.color="#000";button.style.fontFamily="Arial, sans-serif";button.style.borderBottomColor="#B0B0B0";button.style.borderBottomStyle="solid";button.style.borderBottomWidth="1px";button.style.borderLeftColor="white";button.style.borderLeftStyle="solid";button.style.borderLeftWidth="1px";button.style.borderRightColor="#B0B0B0";button.style.borderRightStyle="solid";button.style.borderRightWidth="1px";button.style.borderTopColor="white";button.style.borderTopStyle="solid";button.style.borderTopWidth="1px";button.style.fontSize="12px";};function setFrZoom(){map.setCenter(new GLatLng(46.9502622421856,2.61474609375),5);}function setWorldZoom(){map.setCenter(new GLatLng(13.239945499286312,0),1);}function pause(tps){var date=new Date();var curDate=null;do{curDate=new Date();}while(curDate-date<tps);}function print_r(obj){win_print_r=window.open('about:blank','win_print_r');win_print_r.document.write('<html><body>');r_print_r(obj,win_print_r);win_print_r.document.write('</body></html>');}function r_print_r(theObj,win_print_r){if(theObj.constructor==Array||theObj.constructor==Object){if(win_print_r==null)win_print_r=window.open('about:blank','win_print_r');}for(var p in theObj){if(theObj[p].constructor==Array||theObj[p].constructor==Object){win_print_r.document.write("<li>["+p+"] =>"+typeof(theObj)+"</li>");win_print_r.document.write("<ul>");r_print_r(theObj[p],win_print_r);win_print_r.document.write("</ul>")}else{win_print_r.document.write("<li>["+p+"] =>"+theObj[p]+"</li>");}}win_print_r.document.write("</ul>");}
