﻿// JScript File
         var map = null;
         var findResults = null;
         var origCenter = null;
         
         function GetCityMap(City, State, Country)
         {
            map = new VEMap('myMap');
            map.SetDashboardSize(VEDashboardSize.Small);
            map.LoadMap(null, 12);
            try
            {
                findResults = map.Find(null, City + " " + State + " " + Country);
            }         
            catch(e)         
            {            
                alert(e.message);         
            }
            StoreCenter()
         }
          function GetGeoMap(Latitude, Longitude)
         {
            map = new VEMap('myMap');
            map.SetDashboardSize(VEDashboardSize.Small);
            map.LoadMap(new VELatLong(Latitude, Longitude), 12 ,'r' ,false);
            StoreCenter();
         }
         
         function AddHotel(ID, Title, Description, Lat, Long, icon)
         {          
            var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(Lat, Long));          
            
            shape.SetCustomIcon(icon);
            //map.ClearInfoBoxStyles();
            
            shape.SetTitle(Title);          
            shape.SetDescription(Description); 
                           
            map.AddShape(shape);      
         }
         
               
        function LocationFound(layer, resultsArray, places, hasMore, veErrorMessage)
        {
            var Search = document.getElementById('Location').value;
            var Label = document.getElementById('Title').value
            var Match = false;
            var x, shape;
            
            for (x in places)
            {                
                if(places[x].MatchConfidence == 0)
                {
                    shape = new VEShape(VEShapeType.Pushpin, places[x].LatLong);
                    shape.SetCustomIcon('<div class="map-number">' + Label + '</div>');
                    map.ClearInfoBoxStyles();
                    map.AddShape(shape);
                    Match = true;
                }
            }   
            if (Match == false)
            {
                alert("Unable to locate " + Search);
            }     
        }
         function DoCenterZoom(Lat, Long)      
         {                 
            map.SetCenterAndZoom(new VELatLong(Lat, Long), 16);
         }
         
         function StoreCenter()
         {
            origCenter = map.GetCenter();
         }
         
         function ResetMap()      
         {               
            map.SetCenterAndZoom(origCenter, 12);
         }