﻿// JScript File

var gmLocations = {
    "DEFAULT": ["", "", "45.825719", "16.115398", 10]
    , "ShopSesvete": ["SE-MARK d.o.o.", "ShopSesvete", "45.825719", "16.115398", 15]
    , "ShopMarin": ["SE-MARKd.o.o.", "ShopMarin", "45.816493", "16.002145", 15]

    , "ShopCentar": ["SE-MARK d.o.o.", "ShopCentar", "45.805395", "15.978026", 15]
    , "ShopGalerija": ["SE-MARK d.o.o.", "ShopGalerija", "45.777281", "15.9794", 15]
    , "ShopTrend": ["SE-MARKd.o.o.", "ShopTrend", "45.802687", "16.006823", 15]
    
    , "ShopVelikaGorica": ["SE-MARK d.o.o.", "ShopVelikaGorica", "45.710255", "16.067247", 15]
    , "ShopDugoSelo": ["SE-MARK d.o.o.", "ShopDugoSelo", "45.80882", "16.239166", 15]
    , "ShopBjelovar": ["SE-MARKd.o.o.", "ShopBjelovar", "45.902418", "16.845281", 15]
    
    , "ShopDaruvar": ["SE-MARK d.o.o.", "ShopDaruvar", "45.593786", "17.224063", 15]
    , "ShopVarazdin": ["SE-MARK d.o.o.", "ShopVarazdin", "46.312375", "16.326864", 15]
    , "ShopOsijek": ["SE-MARK d.o.o.", "ShopOsijek", "45.542141", "18.647146", 15]
    
};




function GLoad() {
    if (document.getElementById("googleMapsPlaceholder") == null)
        return;

    googleMapsHelper = new GoogleMapsHelper("googleMapsPlaceholder", gmLocations.DEFAULT);

    googleMapsHelper.AddLocation(gmLocations.ShopSesvete);
    googleMapsHelper.AddLocation(gmLocations.ShopMarin);

    googleMapsHelper.AddLocation(gmLocations.ShopCentar);
    googleMapsHelper.AddLocation(gmLocations.ShopGalerija);
    googleMapsHelper.AddLocation(gmLocations.ShopTrend);

    googleMapsHelper.AddLocation(gmLocations.ShopVelikaGorica);
    googleMapsHelper.AddLocation(gmLocations.ShopDugoSelo);
    googleMapsHelper.AddLocation(gmLocations.ShopBjelovar);

    googleMapsHelper.AddLocation(gmLocations.ShopDaruvar);
    googleMapsHelper.AddLocation(gmLocations.ShopVarazdin);
    googleMapsHelper.AddLocation(gmLocations.ShopOsijek);
    
}

function GoogleMapsHelper(canvasId, DEFAULT) {
    if (!GBrowserIsCompatible())
        return;
    this.map = new GMap2(document.getElementById(canvasId));
    this.map.setCenter(new GLatLng(DEFAULT[2], DEFAULT[3]), DEFAULT[4]);
    this.map.addControl(new GSmallMapControl());
    this.map.addControl(new GMapTypeControl());
    this.map.setMapType(G_NORMAL_MAP);  // G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP
    this.map.enableContinuousZoom();
    //this.map.enableScrollWheelZoom();
}

GoogleMapsHelper.prototype.AddLocation = function(gmLocation) {
    var name = gmLocation[0];
    var infoId = gmLocation[1];
    var lat = gmLocation[2];
    var lng = gmLocation[3];

    var marker = new GMarker(new GLatLng(lat, lng));
    var gIcon = marker.getIcon();
    gIcon.image = "http://www.google.com/mapfiles/markerS.png";
    this.map.addOverlay(marker);

    var info = document.getElementById(infoId) ? document.getElementById(infoId).innerHTML : name;
    info = "<div class='google-info'>" + info + "</div>";
    marker.bindInfoWindowHtml(info, null);
}

GoogleMapsHelper.prototype.GoTo = function(gmLocation) {
    this.map.setCenter(new GLatLng(gmLocation[2], gmLocation[3]), gmLocation[4]);
}  

