// JavaScript Document
		var map = null;
		
		var lastLat;
		var lastLong;
         
		 var CenterPoint = new VELatLong(44.4369069095,26.1023398244,1155); 
		 
		 /*
		 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()
         {
            map = new VEMap('myMap');
           	map.LoadMap(CenterPoint, 1, VEMapStyle.Birdseye, false, VEMapMode.Mode2D, true, 1);
			map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
			
			obiective_recomandate();
			map.setCenter(44.4369069095,26.1023398244,1155);
         }

         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){
			//caat 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){
			//caat 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,w,h){
			//caat 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]);
			}
		 }
		 
		 function Centreaza(lat,long){
		 	if(lastLat != lat && lastLong != long){
				//map.SetZoomLevel(16);
				map.SetCenter(new VELatLong(lat,long));
				lastLat = lat;
				lastLong = long;
			}
		 }
		 
		  function obiective_recomandate(){
		 	for(var i=0;i<recomandate.length;i++){
				adaugaPush2(recomandate[i][0],recomandate[i][1],recomandate[i][2],recomandate[i][3],recomandate[i][4],recomandate[i][5],recomandate[i][6],recomandate[i][7],recomandate[i][8],recomandate[i][9],recomandate[i][10]);
			}
		 }