// JavaScript

function map_ini(lat,lng,zoom){
	if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("mapaprovincia"));
		map.addControl(new GLargeMapControl());
		map.addControl(new GOverviewMapControl());
		var point = new GLatLng(lat,lng);
		map.setCenter(point, zoom);
	}
}

function showPoint(lat,lng,html){
	var point = new GLatLng(lat,lng);
	var marker = new GMarker(point);
	GEvent.addListener(marker, "click", function(){marker.openInfoWindowHtml(html);}); 
    map.addOverlay(marker);
}

function windowPoint(lat,lng,indice){
	var point = new GLatLng(lat,lng)
	var marker = new GMarker(point);
	map.setCenter(point);
	map.openInfoWindowHtml(map.getCenter(),arrayhtml[indice]);
}

function showAddress(address,html) {
 geocoder = new GClientGeocoder();
 if (geocoder) {
  geocoder.getLatLng(address, function(point) {
	if (!point) {
//	  alert("No se ha podido geolocalizar la dirección" + address);
	} else {
	  var marker = new GMarker(point);
	  map.addOverlay(marker);		
	  GEvent.addListener(marker, "click", function(){marker.openInfoWindowHtml(html);}); 
	}
  });
}
}


function windowAddress(address,indice){
	geocoder = new GClientGeocoder();
	if (geocoder) {	
	  geocoder.getLatLng(address, function(point) {
		if (!point) {
		  alert("No se ha podido geolocalizar la dirección" + address);
		} else {
		  var marker = new GMarker(point);
		map.setCenter(point);
		map.openInfoWindowHtml(map.getCenter(),arrayhtml[indice]);
		}
	  });
	}
}
