
  
  
var map = null;
var geocoder = null;

function googlemap(idName) {
    if (GBrowserIsCompatible()) {
        if(idName.type == 'load'){
            idName = "map";
        }

        var maps = document.getElementById(idName);
        if(maps != null){

            map = new GMap2(maps);
            geocoder = new GClientGeocoder();
            var address = maps.getAttribute("title")
            if(address == null){
                address = "Minneapolis, MN";
            }

            showAddress(address)
        }
    }
}

function showAddress(address) {
    if (geocoder) {
        geocoder.getLatLng(
                address,
                function(point) {
                    if (!point) {
                        showAddress("Minneapolis, MN")
                    } else {
                        map.setCenter(point, 13);
                        var marker = new GMarker(point);
                        map.addOverlay(marker);
                        marker.openInfoWindowHtml(address);
                    }
                }
                );
    }
}

addEvent(window, 'load', googlemap, false);
