﻿function InitializeMap(latPos, lngPos, viewType, mapURL) {
    latPos = latPos.replace(",", ".");
    lngPos = lngPos.replace(",", ".");

    if (viewType == "zoom") {
        document.getElementById("MapContent").style.height = "160px";
        var map = new google.maps.Map2(document.getElementById("MapContent"));
        map.setCenter(new google.maps.LatLng(latPos, lngPos), 13);
    } else {
        document.getElementById("MapContent").style.height = "360px";
        var map = new google.maps.Map2(document.getElementById("MapContent"));
        map.setCenter(new google.maps.LatLng(62.772, 17.29), 4);
    }

    // Marker
    var blueIcon = new GIcon(G_DEFAULT_ICON);
    blueIcon.image = "/Images/Map/marker.png";
    blueIcon.iconSize = new GSize(21.0, 28.0);
    blueIcon.iconAnchor = new GPoint(3.0, 28.0);
    markerOptions = { icon: blueIcon, url: '/sv/karta/', clickable : true };
    var point = new GLatLng(latPos, lngPos);
    var marker = new GMarker(point, markerOptions)
    GEvent.addListener(marker, "click", function () { document.location = "/sv/Karta/" + mapURL; });
    map.addOverlay(marker);

}
