var map;var gdir;var geocoder=null;var addressMarker;function gm_loadAndPlace(lat,lng,zoom){if(GBrowserIsCompatible()){map=new GMap2(document.getElementById("myMap"));debug=false;gdir=new GDirections(map,document.getElementById("directions"));GEvent.addListener(gdir,"load",onGDirectionsLoad);GEvent.addListener(gdir,"error",handleErrors);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);if(debug){GEvent.addListener(map,"moveend",function(){var center=map.getCenter();document.getElementById("debug").innerHTML=center.toString();});}}else{alert("Votre navigateur n'est pas comptatible avec l'API GoogleMaps !");}}function createMarker(point,name,address,lien){var marker=new GMarker(point);GEvent.addListener(marker,'click',function(){marker.openInfoWindowHtml("<b>"+name+"</b> <br/>"+address);});GEvent.addListener(marker,'dblclick',function(){document.location.href=lien;});return marker;}function setDirections(fromAddress,toAddress,locale){map.clearOverlays();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(){}
