// JavaScript Document
		var map = null;
		
		var lastLat;
		var lastLong;
         
		 var CenterPoint; 
		 
		 /*
		 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;
		 
		 var obiective = new Array();
		 
		 var recomandate = new Array();
                  
         function GetMap(lat,lng)
         {
			CenterPoint = new VELatLong(lat, lng); 
            map = new VEMap('myMap');
           	map.LoadMap(CenterPoint, 13, VEMapStyle.Road, false, VEMapMode.Mode2D, true, 1);
			map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
			
			//obiective_recomandate();
			
			map.AttachEvent("onclick", getLatLng);

         }
		 
		 function getLatLng(e){
		 	var d = document.getElementById("textul");
			var latLng = map.GetCenter();
			d.innerHTML = "Lat: "+latLng.Latitude+" <BR>Long: "+latLng.Longitude;
			
		 }

         function getInfo()
         {
            var info;

            if (map.IsBirdseyeAvailable())
            {
               var center = map.GetCenter();

                info  = "Zoom level:\t" + map.GetZoomLevel() + "\n";
                info += "Latitude:\t"   + center.Latitude    + "\n";
                info += "Longitude:\t"  + center.Longitude;

                document.getElementById('tarea').innerHTML = info+"<BR>"+map.GetZoomLevel();
            }
            else
            {
                var center = map.GetCenter();

                info  = "Zoom level:\t" + map.GetZoomLevel() + "\n";
                info += "Latitude:\t"   + center.Latitude    + "\n";
                info += "Longitude:\t"  + center.Longitude;

                 document.getElementById('tarea').innerHTML = info+"<BR>"+map.GetZoomLevel();
            }
         }
         
         function AddPin()
         {
            // Add a new pushpin to the center of the map.
            pinPoint = map.GetCenter();
            pinPixel = map.LatLongToPixel(pinPoint);
            map.AddPushpin(pinPoint);
         }
		 
		 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, 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 adaugaPush(lat,long,idul,titlu,cont,li,poza){
			map.SetMapStyle(VEMapStyle.Road);
			
			var unP = new VELatLong(lat,long); 
			
			iconurl='images/push_small.png';
			
			imag = "";
			
			if(poza != ''){
				imag = "<img src='obiective/"+poza+"' vspace='8' />";
			}
			
			var pushpin = new VEPushpin(idul, 
			new VELatLong(lat+0.0018, long-0.0010), //latitude, longitude
		   	iconurl, //icon url
		   	"<div style='color:#97C804; font-size:16px'>"+titlu+"</div>",
			cont+"<div>"+imag+"</div><div align='left' style='margin-top:5px'><a class='negru' href='"+li+"'>Mai multe</a></div>"
			);
 
			VEPushpin.ShowDetailOnMouseOver = true;
			map.AddPushpin(pushpin);

		 }
		 
		 function adaugaPush2(lat,long,idul,titlu,cont,li,poza,banner,url){
			map.SetMapStyle(VEMapStyle.Road);
			
			var unP = new VELatLong(lat,long); 
			
			iconurl='images/push_small.png';
			
			imag = "";
			
			if(poza != ''){
				imag = "<img src='obiective/"+poza+"' vspace='8' />";
			}
			
			var pushpin = new VEPushpin(idul, 
			new VELatLong(lat, long), //latitude, longitude
		   	"obiective/"+banner, //icon url
		   	"<div style='color:#97C804; font-size:16px'>"+titlu+"</div>",
			cont+"<p style='margin-top:5px'><a href='"+url+"' target='_blank' class='negru' style='font-size:11px'>Viziteaza site</a></p>"+"<div>"+imag+"</div><div align='left' style='margin-top:5px'><a class='negru' href='"+li+"'>Mai multe</a></div>"
			);
 
			VEPushpin.ShowDetailOnMouseOver = true;
			map.AddPushpin(pushpin);

		 }
		 
		 function addPushes(){
		 	for(var i=0;i<obiective.length;i++){
				adaugaPush(obiective[i][0],obiective[i][1],obiective[i][2],obiective[i][3],obiective[i][4],obiective[i][5],obiective[i][6]);
			}
		 }
		 