(function() {
    var GMaps = {
        init: function () {
            if (GBrowserIsCompatible()) {
                var map = new GMap2(document.getElementById('map_canvas')),
                    geocoder = new GClientGeocoder(),
                    toAddress = [
                        $j('.street-address','#address-cards').text(),
                        $j('.locality','#address-cards').text(),
                        $j('.region','#address-cards').text(),
                        $j('.postal-code','#address-cards').text()
                    ].join(', ');
                
                geocoder.getLatLng(toAddress, function (point) {
                    if (point) {
                        var marker = new GMarker(point);
                        map.setCenter(point,14);
                        map.addOverlay(marker);
                    };
                });
            }
        }
    };
    $j(document).ready(function() {
        GMaps.init();
    });
    $j(window).unload(GUnload);
})();