﻿function initialize() {
    if (GBrowserIsCompatible())
    {
        var map = new GMap2(document.getElementById("map_canvas"), { size: new GSize(650, 400) });
       
        geocoder = new GClientGeocoder();
        geocoder.getLatLng("207 Kent St Sydney", function(point) {
            map.addOverlay(new GMarker(point, { title: "Level 16, 207 Kent St, Sydney" }));
            map.setCenter(point, 16);
        }
                    );
                    
        map.setUIToDefault();
    }
}

//to get the parameters in the url. NOT USED
function gup(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.href);
    if (results == null)
        return "";
    else
        return results[1];
}

// this last section of code ensures that it works in IE
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

addLoadEvent(initialize);

