var map,point,marker;
var gdir;
var geocoder = null;
var addressMarker;

var icon = new GIcon();
icon.image = "/imagenes/icon.png";
icon.shadow = "/imagenes/icon-s.png";
icon.iconSize = new GSize(20, 20);
icon.shadowSize = new GSize(27, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(12, 20);

	var Mapa = new Object();
		 Mapa.MId="map";
		 Mapa.MLat = 42.057721;
 		 Mapa.MLng = -1.906739;	 
		 Mapa.MZoom = 15;
	var Punto = new Object();
		 Punto.PLat = -1.906639;
		 Punto.PLng = 42.057101;
		 Punto.PIcon = icon;
		 Punto.PTab1="Info";
		 Punto.PTab2="Cómo llegar";
		 Punto.PTab1Info="<p class='pGoogle'><strong>Balneario de Fitero</strong><br />Extramuros, s/n.<br /> 31593 Fitero<br />Navarra (España)<br />Tel&eacute;fono: 948 776 100</p><br />";
		 Punto.PTab2Info="<p class='pGoogle'>Ej.:  Calle Tajonar, Pamplona</p><form action='http://maps.google.es/maps' method='get' target='_blank' class='clearfix'><input type='text' name='saddr' id='saddr' class='inpuGoogle' /><input type='submit' class='botonGoogle' value='Enviar' /><input type='hidden' name='daddr' id='daddr' value='42.810971,-1.643229' class='oculto' /></form>";
function crear_mapa(Mapa){
	//Map
	map = new GMap2(document.getElementById(Mapa.MId));
	map.setCenter(new GLatLng(Mapa.MLat,Mapa.MLng), Mapa.MZoom);
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl(1));
}
function crear_punto(Punto){
	// Emplazar marcadores
	point = new GPoint(Punto.PLat,Punto.PLng);
	marker = new GMarker(point, Punto.PIcon);
	map.addOverlay(marker);
	GEvent.addListener(marker, "click", function() {
                       var html, html2
						map.savePosition();
						html = Punto.PTab1Info;
							html2 =	Punto.PTab2Info;
			
						var infoTabs = [
						new GInfoWindowTab(Punto.PTab1, html),
						new GInfoWindowTab(Punto.PTab2,html2)
						];
						marker.openInfoWindowTabsHtml(infoTabs);
                     });
}


function mostrar_mapa(Mapa){
			map.panTo(new GLatLng(Mapa.MLat, Mapa.MLng));
}
function mostrar_punto(Punto){
	marker.setPoint(new GLatLng(Punto.PLat,Punto.PLng));
	GEvent.addListener(marker, "click", function() {
                       var html, html2
						map.savePosition();
						html = Punto.PTab1Info;
							html2 =	Punto.PTab2Info;
			
						var infoTabs = [
						new GInfoWindowTab(Punto.PTab1, html),
						new GInfoWindowTab(Punto.PTab2,html2)
						];
						marker.openInfoWindowTabsHtml(infoTabs);
                     });
	crear_punto(Punto);
}
