
var map_1, geocoder=null, geoXml=null, latlng;
if(typeof window.addEventListener != 'undefined') {
	window.addEventListener('load', load_1, false);
	window.addEventListener('onunload', GUnload, false);
}
else if(typeof document.addEventListener != 'undefined') {
	document.addEventListener('load', load_1, false);
	document.addEventListener('onunload', GUnload, false);
}
else if(typeof window.attachEvent != 'undefined') {
	window.attachEvent('onload', load_1);
	window.attachEvent('onunload', GUnload);
}
function load_1() {
latlng="45.602539,5.878458", q="949 rue Denis Papin motte servolex";
	if (GBrowserIsCompatible()) {
		map_1 = new GMap2(document.getElementById("Googlemap_1"));
		map_1.clearOverlays();
		map_1.enableDoubleClickZoom();
		map_1.enableContinuousZoom();
		map_1.setMapType(G_NORMAL_MAP); // Vue carte, (G_SATELLITE_MAP: Vue satellite) - (G_HYBRID_MAP: Vue mixte)
		map_1.setUIToDefault();

		if(q!="") {
			adresse="949 rue Denis Papin motte servolex";
			geocoder = new GClientGeocoder();
			geocoder.getLocations(adresse, 
			function(reponse) {
				if (!reponse || reponse.Status.code != 200) {
					ErrorMsg= "Impossible de GéoCoder :\n";
					ErrorMsg+="Code d'erreur : "+reponse.Status.code+"\n";
					ErrorMsg+="Info : http://www.google.com/apis/maps/documentation/reference.html#GGeoStatusCode";
					//alert(ErrorMsg);

					if(latlng!="") {
						var coord=new GLatLng(45.602539,5.878458);
						map_1.setCenter(coord, 15);

						var marker = new GMarker(coord);
						GEvent.addListener(marker, "click",
						function() {
							marker.openInfoWindowHtml("<p style='text-transform:capitalize;'><b>949 rue Denis Papin motte servolex</b><br/><small>Placement approximatif</small></p>");
						});
						map_1.addOverlay(marker);
						marker.openInfoWindowHtml("<p style='text-transform:capitalize;'><b>949 rue Denis Papin motte servolex</b><br/><small>Placement approximatif</small></p>");
					}

				}
				else {
					place = reponse.Placemark[0];
					var Adresse = place.address;
					var Glatitude = place.Point.coordinates[1];
					var Glongitude = place.Point.coordinates[0];

					InfoArray=Adresse.split(", ");
					Adresse="<div style='text-transform:capitalize;'><b>"+InfoArray[0]+"</b></div>";
					for(var i=1; i<InfoArray.length; i++) {
						Adresse+="<div style='text-transform:capitalize;'>"+InfoArray[i]+"</div>";
					}

					var coord=new GLatLng(Glatitude,Glongitude);
					map_1.setCenter(coord, 15);
					var marker = new GMarker(coord);
					GEvent.addListener(marker, "click",
					function() {
						marker.openInfoWindowHtml(Adresse);
					});
					map_1.addOverlay(marker);
					marker.openInfoWindowHtml(Adresse);
				}
			});
		}
		else {
			var coord=new GLatLng(45.602539,5.878458);
			map_1.setCenter(coord, 15);

			geoXml = new GGeoXml("http://www.google.com/maps/ms?output=nl&f=q&source=s_q&hl=fr&geocode=&q=949 rue Denis Papin motte servolex&sll=45.986153,6.168609&sspn=0.009482,0.022724&ie=UTF8&hq=&hnear=949 Rue Denis Papin, 73290 La Motte-Servolex, Savoie, Rhône-Alpes&ll=45.602539,5.878458&spn=0.019096,0.045447&z=15&iwloc=A&count=1");
			map_1.addOverlay(geoXml);
			//geoXml.gotoDefaultViewport(map_1);
		}

		PosLib = document.getElementById("Lib_1");
		TagSmall=document.createElement("small")
		Lien = document.createElement('a');
		Lien.setAttribute("href","http://maps.google.fr/maps?f=q&source=s_q&hl=fr&geocode=&q=949 rue Denis Papin motte servolex&sll=45.986153,6.168609&sspn=0.009482,0.022724&ie=UTF8&hq=&hnear=949 Rue Denis Papin, 73290 La Motte-Servolex, Savoie, Rhône-Alpes&ll=45.602539,5.878458&spn=0.019096,0.045447&z=15&iwloc=A&count=1");
		Lien.appendChild(document.createTextNode("Agrandir le plan"));
		TagSmall.appendChild(Lien);
		PosLib.appendChild(TagSmall);
	}
	else {
		document.getElementById("Googlemap_1").innerHTML="Sorry, your browser can't display Google Maps...";
		}
}
