﻿var osMap;

$(document).ready(function() {
    /*for (var i = 0; i < 200; i++) {
    var northing = 104700 + Math.floor(Math.random() * 329000);
    var easting = 773900 + Math.floor(Math.random() * 203500);        
    sightings.push({ GridRef: northing + "," + easting, Location: 'Hello', Url: 'NoUrl' });
    }*/
    try {
        osMap = new OSMapWrapper('map',
        {
            cluster: false,
            centerLat: 844250,
            centerLng: 232150,
            zoomLevel: 4,
            icon: "/images/Pointer.png",
            markerList: sightings,
            useOverlays: true,
            centerInfoWindow: false
        });
        osMap.Initalize();
        osMap.displayMarkers();

        if (currentSighting) {
            var ref = currentSighting.GridRef.split(',');
            osMap.setMapCenter(ref[0], ref[1], 8);
        }
    } catch (e) {
    $('#viewSightingList').click();
    }

});

function displayMarkers() {
    osMap.displayMarkers();
}

