		var map = null;
         
		 var CenterPoint = new VELatLong(44.42869269857914, 26.112012863159173); 
		 
		 /*
		 4272539.699526462, 2304180.387971632 contains pixel 567, 208.5: true contains latlong 31.653381399663985, 0: false latlong: -89.725812064738, 759.4424113414412
		 */
 
         var pinPoint = null;
         var pinPixel = null;
                  
         function GetMap()
         {
            map = new VEMap('myMap');
           	map.LoadMap(CenterPoint, 13, VEMapStyle.Road, false, VEMapMode.Mode2D, true, 1);
         }		 
		 function setCenter(lat,long,idul){
		 	map.SetZoomLevel(16);
			
			var unP = new VELatLong(lat,long); 
			
			map.SetCenter(unP);
			
			iconurl='images/pushpinImage.png';
			
			var pushpin = new VEPushpin(idul, 
			new VELatLong(lat+0.0015, long), //latitude, longitude
		   	iconurl, //icon url
		   	'Titlu',
			"Content"
			);
 
			VEPushpin.ShowDetailOnMouseOver = false;
			map.AddPushpin(pushpin);

		 }
		  function setCenterStreet(lat,long,idul){
			map.SetMapStyle(VEMapStyle.Road);
		 	map.Clear();
		 	map.SetZoomLevel(16);
			
			var unP = new VELatLong(lat,long); 
			
			map.SetCenter(unP);
			
			iconurl='images/pushpinImage2.png';
			
			var pushpin = new VEPushpin(idul, 
			new VELatLong(lat+0.0018, long-0.0010), //latitude, longitude
		   	iconurl, //icon url
		   	'Titlu',
			"Content"
			);
 
			VEPushpin.ShowDetailOnMouseOver = false;
			map.AddPushpin(pushpin);

		 }
		 
		 //////////////////////
		 function GetRouteMap(start,end)
         {
		 	map.Clear();
			//map.SetZoomLevel(15);
            var locations;
			
			locations = new Array(start,end);

            var options = new VERouteOptions;

            // Otherwise what's the point?
            options.DrawRoute      = true;

            // So the map doesn't change:
            options.SetBestMapView = true;

            // Call this function when map route is determined:
            options.RouteCallback  = ShowTurns;

            // Show as miles
            options.DistanceUnit   = VERouteDistanceUnit.Mile;

            // Show the disambiguation dialog
            options.ShowDisambiguation = true;

            map.GetDirections(locations, options);
			self.scrollTo(0,0);
         }

         function ShowTurns(route)
         {
            var turns = "<h3>Turn-by-Turn Directions</h3>(rounding errors are possible)";

            turns += "<p><b>Distance:</b> " + route.Distance.toFixed(1) + " miles";

            turns += "<br/><b>Time:</b> " + GetTime(route.Time) + "</p>";

            if (dirsForm.dirsType[0].checked)
            {
               // Unroll route and populate DIV
               var legs          = route.RouteLegs;
               var leg           = null;
               var turnNum       = 0;  // The turn #

               // Get intermediate legs
               for(var i = 0; i < legs.length; i++)
               {
                  // Get this leg so we don't have to derefernce multiple times
                  leg = legs[i];  // Leg is a VERouteLeg object

                  var legNum = i + 1;
                  turns += "<br/><b>Distance for leg " + legNum + ":</b> " + leg.Distance.toFixed(1) + " miles" +
                           "<br/><b>Time for leg "     + legNum + ":</b> " + GetTime(leg.Time) + "<br/><br/>";

                  // Unroll each intermediate leg
                  var turn        = null;  // The itinerary leg
                  var legDistance = null;  // The distance for this leg
                  
                  for(var j = 0; j < leg.Itinerary.Items.length; j ++)
                  {
                     turnNum++;
                     
                     turn = leg.Itinerary.Items[j];  // turn is a VERouteItineraryItem object

                     turns += "<b>" + turnNum + "</b>\t" + turn.Text;

                     legDistance    = turn.Distance;

                     // So we don't show 0.0 for the arrival
                     if(legDistance > 0)
                     {
                        // Round distances to 1/10ths
                        turns += " (" + legDistance.toFixed(1) + " miles";

                        // Append time if found
                        if(turn.Time != null)
                        {
                           turns += "; " + GetTime(turn.Time);
                        }

                        turns += ")<br/>";
                     }
                  }

                  turns += "<br/>";
               }

               // Populate DIV with directions
               //SetDirections(turns);
            }
         }

         function SetDirections(s)
         {
            var d = document.getElementById("directions");
            d.innerHTML = s;
         }

         // time is an integer representing seconds
         // returns a formatted string
         function GetTime(time)
         {
            if(time == null)
            {
               return("");
            }

            if(time > 60)
            {                                 // if time == 100
               var seconds = time % 60;       // seconds == 40
               var minutes = time - seconds;  // minutes == 60
               minutes     = minutes / 60;    // minutes == 1


               if(minutes > 60)
               {                                     // if minutes == 100
                  var minLeft = minutes % 60;        // minLeft    == 40
                  var hours   = minutes - minLeft;   // hours      == 60
                  hours       = hours / 60;          // hours      == 1

                  return(hours + " hour(s), " + minLeft + " minute(s), " + seconds + " second(s)");
               }
               else
               {
                  return(minutes + " minutes, " + seconds + " seconds");
               }
            }
            else
            {
               return(time + " seconds");
            }
         }
        
         function ClearAll()
         {
            map.DeleteRoute();
            SetDirections("");
         }

		 //////////////////////