	function mapLoadDirections(from,latitud,longitud) {
		$("#direcciones").text('');
		if (GBrowserIsCompatible()) {
			map = new GMap2(document.getElementById("mapa_canvas"));
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
			map.addMapType(G_PHYSICAL_MAP);
			casa = new GLatLng(latitud, longitud);
			if (from!="") {
				lugar = from;
			}
			geocoder = new GClientGeocoder();
			geocoder.getLocations(casa, showAddress);
			gdir = new GDirections(map, document.getElementById("direcciones"));
			GEvent.addListener(gdir, "error", handleErrors);
		}
	}

	function showAddress(response) {
		  if (!response || response.Status.code != 200) {
		    alert("Status Code:" + response.Status.code);
		  } else {
		    place = response.Placemark[0];
		    address = place.address;
			setDirections(lugar, "es");
		  }
	}

	function setDirections(fromAddress) {
		gdir.load("from: " + fromAddress + " to: " + address,
		{ "locale": "es_ES" });
	}

	function handleErrors(){

		if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
		alert("Por favor revisa la localidad o introduce la busqueda de la siguiente forma: 'Localidad, Provincia'");
		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("La direccion requerida no ha sido procesada correctamente.\n Error code: " + gdir.getStatus().code);
		else alert("Ha ocurrido un error desconocido por google.");
	}

	function comoLlegarSubmit(F)
	{
		var dst = document.getElementById("dst");
		if(!dst) return false;
		var coord = dst[dst.selectedIndex].value.split(",");
		if(2 != coord.length) return false;
		var fromInput = document.getElementById("fromAddress");
		if(!fromInput) return false;
		if(!fromInput.value.length) return false;

		mapLoadDirections(fromInput.value, coord[0], coord[1]);
	}

