﻿// JScript File
// Initial settings
var pinId = 0;

// DynamicDog information
var Map = null;
var Latitude = 56.174921;
var Longitude = 12.672093;
var ZoomLevel = 10;
var HomePin = null;
var HomeIcon = '<img src="/Images/mapLogo.png" alt="Hotell Rusthållargården" />';
var HomeLat = 56.274921;
var HomeLon = 12.572093;
var BoxTitle = 'Hotell Rusthållargården';
var BoxDesc = 'Utsikten 1<br />260 43 ARILD<br />SWEDEN';

// Get the base Trivector Map
// --------------------------
function GetMap()
{
    // Create a new VEMap object
    Map = new VEMap('MapWrapper'); // The Constructor of VEMap = the name of the map div in .aspx file.
    
    // Set the scale to KM
    MapControl.Features.ScaleBarKilometers = true;


    //map.SetMapStyle(VEMapStyle.Shaded);

    // Set my coordinates
    var latLong = new VELatLong(Latitude, Longitude); // Where the map should center

    // Set the left "navigator"-Dashboard to Normal, Small or Tiny
    Map.SetDashboardSize(VEDashboardSize.Tiny); // I prefer tiny

    //Load the map
    Map.LoadMap(latLong, ZoomLevel);   // Load the map with the correct coordinates and zoom level 
    
    // Place the HomePin
    PlaceHomePin();
}

// Places a Logotype shape at the specified coordinates
// -----------------------------------------------
function PlaceHomePin()
{
    // Only if the Home Pin isn't already set on the map
    if(HomePin == null)
    {
        // Initialize the shape
        HomePin = new VEShape(VEShapeType.Pushpin, new VELatLong(HomeLat, HomeLon)); // Type of shape (New in VE 5 ?) and coordinates of the shape
        
        //Set the icon         
        HomePin.SetCustomIcon(HomeIcon); // What should we place, img, div etc.               
        
        //Set the info box         
        Map.ClearInfoBoxStyles();         
        HomePin.SetTitle(BoxTitle); // InfoBox Title       
        HomePin.SetDescription(BoxDesc); // InfoBox description
        //Add the shape the the map         
        Map.AddShape(HomePin); // Add my shape to the map       
        pinId++; // Adds the pinId number other whise it will work bad or even crash
    }
}




