﻿function initialize() {
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));

        //oxfootstone granary marker should be in the centre.  zoom of 10
        var myLocation = new GLatLng(52.388451, 1.013339);
        map.setCenter(myLocation, 11);
        map.setUIToDefault();

        var myIcon = new GIcon(G_DEFAULT_ICON);
        myIcon.image = 'library/images/markers/image.png';
        myIcon.shadow = 'library/images/markers/shadow.png';
        myIcon.iconSize = new GSize(139, 61);
        myIcon.shadowSize = new GSize(170, 61);
        myIcon.iconAnchor = new GPoint(70, 61);
        myIcon.infoWindowAnchor = new GPoint(70, 0);
        myIcon.printImage = 'library/images/markers/printImage.gif';
        myIcon.mozPrintImage = 'library/images/markers/mozPrintImage.gif';
        myIcon.printShadow = 'library/images/markers/printShadow.gif';
        myIcon.transparent = 'library/images/markers/transparent.png';
        myIcon.imageMap = [136, 0, 138, 1, 138, 2, 138, 3, 138, 4, 138, 5, 138, 6, 138, 7, 138, 8, 138, 9, 138, 10, 138, 11, 138, 12, 138, 13, 138, 14, 138, 15, 138, 16, 138, 17, 138, 18, 138, 19, 138, 20, 138, 21, 138, 22, 138, 23, 138, 24, 138, 25, 138, 26, 138, 27, 138, 28, 138, 29, 138, 30, 138, 31, 138, 32, 138, 33, 138, 34, 138, 35, 138, 36, 138, 37, 138, 38, 138, 39, 138, 40, 138, 41, 138, 42, 138, 43, 138, 44, 138, 45, 138, 46, 138, 47, 115, 48, 114, 49, 114, 50, 113, 51, 111, 52, 109, 53, 107, 54, 102, 55, 72, 56, 72, 57, 72, 58, 71, 59, 71, 60, 70, 60, 70, 59, 70, 58, 70, 57, 69, 56, 69, 55, 69, 54, 32, 53, 30, 52, 27, 51, 24, 50, 24, 49, 22, 48, 1, 47, 1, 46, 0, 45, 0, 44, 0, 43, 0, 42, 0, 41, 0, 40, 0, 39, 0, 38, 0, 37, 0, 36, 0, 35, 0, 34, 0, 33, 0, 32, 0, 31, 0, 30, 0, 29, 0, 28, 0, 27, 0, 26, 0, 25, 0, 24, 0, 23, 0, 22, 0, 21, 0, 20, 0, 19, 0, 18, 0, 17, 0, 16, 0, 15, 0, 14, 0, 13, 0, 12, 0, 11, 0, 10, 0, 9, 0, 8, 0, 7, 0, 6, 0, 5, 0, 4, 0, 3, 0, 2, 0, 1, 1, 0];
        var markerOptions = { icon: myIcon };

        var marker = new GMarker(map.getCenter(), markerOptions);

        //add Oxfootstone marker
        map.addOverlay(marker);

        //Pop up balloon for when user clicks the marker
        GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml('<div class="googleinfoWindow"><h4>Oxfootstone Granary</h4><a href="http://maps.google.com/maps?saddr=&daddr=' + myLocation.toUrlValue() + '" target ="_blank">Get Directions<\/a></div>'); });
        }
}

