﻿var map = null;
var bounds = null;
var isInit = false;
var geocoder = null;
var addCount = 0;

function initialize() {
    if (isInit == false) {
        if (GBrowserIsCompatible()) {
var myOptions = {
scrollwheel:false    	
};




            map = new GMap2(document.getElementById("map_canvas"),myOptions);
            //map.setCenter(new GLatLng(37.4419, -122.1419), 8);
            //map.setUIToDefault();
            bounds = new GLatLngBounds();
            geocoder = new GClientGeocoder();
            map.setCenter(new GLatLng(0, 0), 0);

var customUI = map.getDefaultUI();
        // Remove MapType.G_HYBRID_MAP
        customUI.maptypes.hybrid = false;
	customUI.zoom.scrollwheel = false;
        map.setUI(customUI);


        }
    }
}

function showAddress(lat, lon, html) {
 
    initialize();
    isInit = true;

    var point = new GLatLng(lat, lon);



    addCount = addCount + 1;
    bounds.extend(point);
    var marker = new GMarker(point);
    map.addOverlay(marker);
    GEvent.addListener(marker, "click", function () {
        marker.openInfoWindowHtml(html);
    });

    if (addCount == 1) {
        map.setCenter(point, 13);
    }
    else {
        map.setZoom(map.getBoundsZoomLevel(bounds));
        map.setCenter(bounds.getCenter());
    }
}

