//<![CDATA[
		  
		   var coordenadas = Array(43.562046, -7.208300);
		   
		function loadmap() {
	
			   if (GBrowserIsCompatible()) {
			   
			   var map = new GMap2(document.getElementById("map"));
			   
			   var maptext = document.getElementById("maptext");
			 
			   maptext.style.position = 'absolute';
			   maptext.style.left = '-5000px';
			   var h = parseFloat(coordenadas[0]);
				var v = parseFloat(coordenadas[1]);

			   var camping = new GLatLng(h,v);
			   var center = new GLatLng(43.000000, -5.200000);
			   map.setCenter(center, 7);
			   
			   // now we put a zoom control
			   map.addControl(new GSmallMapControl());
			   // map, sat, hybrid
			   map.addControl(new GMapTypeControl());
			   
			  //map.setMapType(G_SATELLITE_TYPE);
			    map.setMapType(G_NORMAL_MAP);
			   //map.setMapType(G_HYBRID_MAP);
			   
			   //marker
			   var marker1= new GMarker(camping);
			   
			   map.addOverlay(marker1);
			   
			   // add listener to open infobox when clicking on a marker
			   GEvent.addListener(marker1, "click",
			   function () {
			   	marker1.openInfoWindowHtml(document.getElementById('maptext').innerHTML);
			   }
			   
			   
			);
			marker1.openInfoWindowHtml(document.getElementById('maptext').innerHTML);
			gdir = new GDirections(map, document.getElementById("comollegarcontenedor"));
			GEvent.addListener(gdir, "load", onGDirectionsLoad);
			GEvent.addListener(gdir, "error", handleErrors);
		}
		else alert('Lo sentimos, su navegador no es compatible con GoogleMaps, por lo que no podrá visualizar el mapa de localización.');
		
	}
	addLoadEvent(loadmap);
	//addLoadEvent(loadmap);
	
	
	function onGDirectionsLoad(){
	// Use this function to access information about the latest load() results.
	// e.g.
	// document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	// and yada yada yada...
    } 

	var rotonda1 = "43.54017,-7.251931";
	var rotonda2 = "43.54459, -7.217664";
	function setDirections(fromAddress, toAddress, locale) {
		gdir.load("from: " + fromAddress + " to: " + rotonda1 + " to: " + rotonda2 + " to: " + toAddress,
		{ "locale": locale });
	}
		
	function handleErrors(){
		if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
		alert("No se ha encontrado una localización válida para la dirección especificada. Puede ser debido a que la dirección esté mal escrita o a que sea muy nueva.\nError code: " + gdir.getStatus().code);
		else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
		alert("Error desconocido al intentar procesar la búsqueda de ruta.\n Error code: " + gdir.getStatus().code);
		
		else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
		alert("Debe especificar una dirección de salida válida en el campo 'Dirección de salida'.\n Error code: " + gdir.getStatus().code);
		
		//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
		//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\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("An unknown error occurred.");
																		
	}

//]]>
