
function showAddress(address){
    this.geocoder.getLatLng(
	address,
	function(point){
		if(point){
			this.map.setCenter(point, 12);
            
            var marker = new GMarker(point);
            
			this.map.addOverlay(marker);
			//marker.openInfoWindowHtml(address);
            GEvent.addListener(marker, "click", function() {
                marker.openInfoWindowHtml(address);
            });
            this.map.setCenter(new GLatLng(51.031206,-114.091132), 11);
		}
		else {
			this.close();
			alert('The address cannot be found!');
		}
    });
}
function initializeGoogleMaps() {
      if (GBrowserIsCompatible()) {
        
        geocoder = new GClientGeocoder();

        this.map = new GMap2(document.getElementById("google-map"));
        
        this.map.addControl(new GSmallMapControl());
        this.map.setMapType(G_PHYSICAL_MAP);
        
        
        showAddress('14th St. & 17th Ave. S.W., Calgary, Alberta');
        showAddress('210-6455 MacLeod Trail SW Calgary, Alberta');
        showAddress('5111 Northland Drive NW Calgary, Alberta');
        showAddress('29-100 Anderson Road SE Calgary, Alberta');
        
        
//        // Add 10 markers to the map at random locations
//        var bounds = map.getBounds();
//        var southWest = bounds.getSouthWest();
//        var northEast = bounds.getNorthEast();
//        var lngSpan = northEast.lng() - southWest.lng();
//        var latSpan = northEast.lat() - southWest.lat();
//        for (var i = 0; i < 10; i++) {
//          var latlng = new GLatLng(southWest.lat() + latSpan * Math.random(),
//                                  southWest.lng() + lngSpan * Math.random());
//          map.addOverlay(new GMarker(latlng));
//        }
      }
    }
    
window.addEvent('domready', function() {
    initializeGoogleMaps();
});
