﻿var googleMap = null;
var geocoder = null;

function ShowGoogleMaps(mapId) {
    window.onunload = GUnload;
    if (GBrowserIsCompatible()) {
        var mapElement = document.getElementById(mapId);
        mapElement.style.display = 'block';
        
        googleMap = new GMap2(mapElement);
        googleMap.addControl(new GSmallMapControl());
    }
}

function ShowMapAddress(address, htmlAddress, zoom) {
    if (googleMap) {
        geocoder = new GClientGeocoder();

        geocoder.getLatLng(
    address,
    function(point) {
        if (!point) {
            alert(address + " no encontrado");
        } else {
            googleMap.setCenter(point, zoom);
            var marker = new GMarker(point);
            googleMap.addOverlay(marker);
            marker.openInfoWindowHtml(htmlAddress);

            googleMap.checkResize();
        }
    }
  );
    }
}

function CreateTabbedMarker(point, html1, html2, label1, label2) {
    if (googleMap) {
        var marker = new GMarker(point);
        GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowTabsHtml([new GInfoWindowTab(label1, html1), new GInfoWindowTab(label2, html2)]);
        });
        
        googleMap.addOverlay(marker);
    }
}