﻿var parkingImgSrc = "http://aagmexplorer.activclient.com/Upload/parkingIcon.png";

var lat = new Array("57.14811", "57.1483", "57.14669", "57.14804", "57.14856", "57.14427", "57.14543", "57.14681", "57.15", "57.1484", "57.14805");
var lng = new Array("-2.10245", "-2.09747", "-2.0947", "-2.09388", "-2.10682", "-2.09843", "-2.09919", "-2.09433", "-2.09982", "-2.10076", "-2.10295");
var type = new Array(0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0);
var info = new Array("<strong>Aberdeen Art Gallery & Museum</strong><br />Schoolhill, Aberdeen<br /><strong>Tel: 01224 523700</strong><br /><em>Tuesday - Saturday 10am-5pm, Sunday 2-5pm</em><br /><span style='color:red'>Free Admission</span>", "<strong>Provost Skene's House</strong><br />Guestrow, Aberdeen<br /><strong>Tel: 01224 641086</strong><br /><em>Monday - Saturday 10am-5pm</em><br /><span style='color:red'>Free Admission</span>", "<strong>Aberdeen Maritime Museum</strong><br />Shiprow, Aberdeen<br /><strong>Tel: 01224 337700</strong><br /><em>Tuesday - Saturday 10am-5pm, Sunday 12noon-3pm</em><br /><span style='color:red'>Free Admission</span>", "<strong>The Tolbooth Museum</strong><br />Castle Street, Aberdeen<br /><strong>Tel: 01224 621167</strong><br /><em>Tuesday - Saturday: 10am-12.30pm, 1.30-5pm<br />Sundays: 12.30pm-3.30pm</em><br /><span style='color:red'>Free Admission</span>", "<strong>Denburn</strong>", "<strong>Rail and Bus station</strong>", "<strong>The Trinity Centre</strong>", "<strong>NCP Shiprow</strong>", "<strong>The Bon-Accord Centre, Loch St</strong>", "<strong>The Bon-Accord Centre, Harriet St</strong>", "<strong>The Cowdray Hall</strong><br />Schoolhill, Aberdeen<br /><strong>Tel: 01224 523700</strong>");

var map;

function initialize() {
    if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng("57.1475", "-2.1"), 15);

        map.setUIToDefault();

        var count = 0;
        //for every coordinate (point) place a marker and bind its infowindow
        for (i in lat) {
            var icon = new GIcon(G_DEFAULT_ICON);
            if (type[i] == 1) {
                icon.image = parkingImgSrc;
                icon.iconSize = new GSize(25, 25);
                icon.shadowSize = new GSize(0, 0);
                icon.iconAnchor = new GPoint(10, 10);
            }
            else {
                var letter = String.fromCharCode("A".charCodeAt(0) + count);
                icon.image = "http://www.google.com/mapfiles/marker" + letter + ".png";
                count++;
            }
            markerOptions = { icon: icon };
            var point = new GLatLng(lat[i], lng[i]);
            var marker = new GMarker(point, markerOptions);
            GEvent.addListener(marker, "click", function(latlng) {
                map.setZoom(16);
                map.panTo(latlng);
            });
            marker.bindInfoWindowHtml(info[i]);
            map.addOverlay(marker);
        }
    }
}
