﻿function initialize() {
    if (GBrowserIsCompatible()) {

        // A function to create the marker and set up the event window
        // Dont try to unroll this function. It has to be here for the function closure
        // Each instance of the function preserves the contends of a different instance
        // of the "marker" and "html" variables which will be needed later when the event triggers.    
        function createMarker(point, html) {
            var marker = new GMarker(point);
            GEvent.addListener(marker, "click", function() {
                marker.openInfoWindowHtml(html);
            });
            return marker;
        }

        // Display the map, with some controls and set the initial location
        var map = new GMap2(document.getElementById("ctl00_ContentPlaceHolder1_map_canvas"));
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(41.32619835697691, -81.7339038848877), 16);

        // Set up three markers with info windows
//church
        var point = new GLatLng(41.3253982443776, -81.73322432403564);
        var marker = createMarker(point, '<div style="width:240px; font-size:0.9em; font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-weight:bold;"><a href="http://www.saint-albert.org/main.htm">Saint Albert the Great Church and Hall<\/a><\/span><br\/>6667 Wallings Rd.<br\/>North Royalton, Ohio 44133<\/div>')
        map.addOverlay(marker);
//rectory
        var point = new GLatLng(41.325131515672996, -81.7333743240356);
        var marker = createMarker(point, '<div style="width:240px; font-size:0.9em; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight:bold;">Saint Albert the Great Rectory<\/div>')
        map.addOverlay(marker);
//school
        point = new GLatLng(41.324651404004555, -81.7333743240356);
        var marker = createMarker(point, '<div style="width:240px; font-size:0.9em; font-family: Verdana, Arial, Helvetica, sans-serif;"><span style="font-weight:bold;"><a href="http://school.saint-albert.org/">Saint Albert the Great School<\/a><\/span><br\/>6667 Wallings Rd.<br\/>North Royalton, Ohio 44133<\/div>')
        map.addOverlay(marker);

    }

    // display a warning if the browser was not compatible
    else {
        alert("Sorry, the Google Maps API is not compatible with this browser");
    }
}