var map = null;
function GetMap()
{map = new Microsoft.Maps.Map(document.getElementById('myMap'), {credentials: 'AmiN4f-zdB5C6IPphedxK0PSLmKC2XlkpYiUWB52kxZBkagbkg8v8N46DrODyuYS', showMapTypeSelector:false, center: new Microsoft.Maps.Location(45.8389996737242, 27.0090000033379),mapTypeId: Microsoft.Maps.MapTypeId.birdseye, zoom: 7, enableSearchLogo: false,  enableClickableLogo: false, showDashboard: false});

  GetLocation(); }

 function GetLocation() {
            //check if location api supported
            if (!!navigator.geolocation) {
                
                //request current location
                navigator.geolocation.getCurrentPosition(UpdateLocation,HandleErrors);
            }
        }
 
        function UpdateLocation(position) {
            var latitude = position.coords.latitude;
            var longitude = position.coords.longitude;
 
            //move map to new location and zoom in
            map.setView({ center: { latitude: latitude, longitude: longitude }, zoom: 17, mapTypeId: Microsoft.Maps.MapTypeId.automatic });
        }
 
        function HandleErrors(error) {
            //handle geolocation errors and alert user
            switch (error.code) {
                case error.PERMISSION_DENIED: alert("Pentru o interactiune ideala cu site-ul For&Du va recomandam sa aprobati cererea de identificare a pozitiei geografice. Va multumim.");
                    break;
 
                case error.POSITION_UNAVAILABLE: alert("Coordonatele geografice nu au putut fi identificate");
                    break;
 
                case error.TIMEOUT: alert("Retrieving position timed out");
                    break;
 
                default: alert("unknown error");
                    break;
            }  
        }

      



      


     



		


