	var map = null;  
			var pinid = 0;
			
			function GetMap()         
				{            
					map = new VEMap('myMap');            
					map.LoadMap(new VELatLong(39.67800, 15.8230), 15 ,'h' ,false);    
					AddPushpinCarabinieri();
					AddPushpinPoliziaMunicipale();
					AddPushpinGuardiaMedica();
					AddPushpinFarmaciaCipolla();
					AddPushpinFarmaciaDeLuna();
					AddPushpinCapinateriaPorto();
					AddPushpinFerrettiHotel();
					AddUfficioInformazioni();
					AddParcheggioDiscesaCorvino();
					AddParcheggioParcoCorvino();
					AddParcheggioBenedettoCroce();
					AddParcheggioAmendola();
					AddUfficioPostale();
					AddTeatroDeiRuderi();
					AddRuderiDiCirella();
					AddTheLegend();
					AddLidoAlexander();
					AddHotelCristina();
					//AddHotelParthenius();
					AddHotelSandaniele();
					AddHotelVillaCerelis();
					AddAidanHouse();
					AddIsolaCirella();
					AddFotoPorto();
					AddLungoMareVecchio();
					AddLungoMareNuovo();
					AddLungoMareNuovo2();
					AddLido1();
					AddLido2();
					AddLido3();
					AddDiamante();
					AddPorto();
					AddStazioneTreno();
					AddBBLabellavita();
					AddHotelStellaMaris();
					AddBeachHotel();
					AddBBLafiumara();
				}   
				
				function GetMapHotel()         
				{            
					map = new VEMap('myMap');            
					map.LoadMap(new VELatLong(39.6970, 15.8151), 13 ,'h' ,false);    
					
					AddPushpinFerrettiHotel();
					AddHotelCristina();
					AddHotelSandaniele();
					AddHotelVillaCerelis();
					AddHotelStellaMaris();
					AddBeachHotel();
				}   
				
				function GetMapRoad()         
				{            
					map = new VEMap('myMap');            
					//map.LoadMap(new VELatLong(39.67800, 15.8230), 13 ,'h' ,false);    
					map.LoadMap(new VELatLong(39.67800, 15.8230), 6, VEMapStyle.Road, false, VEMapMode.Mode2D, true, 1);
					map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);
				}
					
					
			function AddPushpinCarabinieri()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6802, 15.819));
				shape.SetTitle('Carabinieri');          
				shape.SetDescription('Via Europa <br>87023 Diamante (Cosenza)<br>Tel.(+39) 0985.81117<br>Tel.(+39) 0985.876954');
				map.AddShape(shape);        
			}	
			
			function AddPushpinPoliziaMunicipale()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6770, 15.8215));
				shape.SetTitle('Polizia Municipale');          
				shape.SetDescription('Via Benedetto Croce, 26<br>87023 Diamante (Cosenza)<br>Tel.(+39) 0985.81035');      
				map.AddShape(shape);      
			}
			
			function AddPushpinGuardiaMedica()      {   
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6770, 15.8212));
				shape.SetCustomIcon(iconSanitari);
				shape.SetTitle('Guardia Medica');          
				shape.SetDescription('87023 Diamante (Cosenza)<br>Tel.(+39) 0985.81000');
				map.AddShape(shape);  
			}
			
			function AddPushpinFarmaciaCipolla()      {
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.7144, 15.8088));
				shape.SetCustomIcon(iconFarmacia);
				shape.SetTitle('Farmacia Cipolla Federico');          
				shape.SetDescription('Via Vittorio Veneto 177<br>87020 Cirella (Cosenza)<br>Tel.(+39) 0985.86103');
				map.AddShape(shape);   
			}   
			
			function AddPushpinFarmaciaDeLuna()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6754, 15.8224));
				shape.SetCustomIcon(iconFarmacia);
				shape.SetTitle('Farmacia De Luna');          
				shape.SetDescription('Via Poseidone 9<br>87023 Diamante (Cosenza)<br>Tel.(+39) 0985.81146');       
				map.AddShape(shape);      
			}	
			
			function AddPushpinCapinateriaPorto()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.67505, 15.8236));
				shape.SetTitle('Capitaneria di porto');    
				shape.SetDescription('Via Poseidon 123<br>87023 Diamante (Cosenza)<br>Tel. (+39) 0985.876075');   
				map.AddShape(shape);      
			}	
			
			function AddPushpinFerrettiHotel()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6717, 15.8279));
				shape.SetTitle('Hotel Ferretti');          
				shape.SetDescription('4 stelle<br>Via Poseidone<br>87023 - Diamante (Cosenza)<br>Tel. (+39) 0985.81428<br>Fax. (+39) 0985.81114<br><a href="FerrettiHotel.aspx">maggiori info</a>');
				map.AddShape(shape);      
			}	
			
			function AddHotelVillaCerelis()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.7136, 15.8143));
				shape.SetTitle('Hotel Villa Cerelis');          
				shape.SetDescription('3 stelle<br><br>Loc. Tredoliche 87020 - Cirella di Diamante (Cosenza)<br>Tel. (+39) 0985.86828<br>Fax. (+39) 0985.86828<br><a href="Villa-Cerelis.aspx">maggiori info</a>');
				map.AddShape(shape);      
			}
			
			function AddUfficioInformazioni()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.67925, 15.8182));
				shape.SetTitle('Ufficio informazioni turistiche');          
				shape.SetDescription('Discesa Corvino Superiore<br>87023 Diamante (Cosenza)<br>Tel. (+39) 0985.876046');         
				map.AddShape(shape);      
			}	
			
			function AddParcheggioDiscesaCorvino()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.67923, 15.8172));
				shape.SetCustomIcon(iconPark);
				shape.SetTitle('Parcheggio Discesa Corvino');          
				shape.SetDescription('Discesa Corvino');         
				map.AddShape(shape);      
			}	
			
			function AddParcheggioParcoCorvino()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6796, 15.8213));
				shape.SetCustomIcon(iconPark);
				shape.SetTitle('Parcheggio Parco Corvino');          
				shape.SetDescription('Ingresso Parco Corvino');         
				map.AddShape(shape);      
			}	
			
			function AddParcheggioBenedettoCroce()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6772, 15.8210));
				shape.SetCustomIcon(iconPark);
				shape.SetTitle('Parcheggio Benedetto Croce');          
				shape.SetDescription('Via Benedetto Croce');         
				map.AddShape(shape);      
			}	
			
			function AddParcheggioAmendola()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6764, 15.8235));
				shape.SetCustomIcon(iconPark);
				shape.SetTitle('Parcheggio Amendola'); 
				shape.SetDescription('Via Amendola');         
				map.AddShape(shape);      
			}	
			
			function AddStazioneTreno()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6768, 15.8242));
				shape.SetTitle('Stazione di Diamante'); 
				map.AddShape(shape);      
			}	
			
			function AddUfficioPostale()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6802, 15.8167));
				shape.SetTitle('Ufficio Postale');          
				shape.SetDescription('Viale Glauco 1<br>87023 Diamante (Cosenza)<br>Tel.(+39) 0985.896011');
				map.AddShape(shape);      
			}	
			
			function AddTeatroDeiRuderi()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.7173, 15.8218));
				shape.SetTitle('Teatro dei Ruderi di Cirella');         
				shape.SetDescription('Contrada Tredoliche<br>87020 Cirella di Diamante (Cosenza)<br><a href="TeatroRuderiCirella.aspx">maggiori info</a>'); 
				map.AddShape(shape);      
			}	
			
			function AddRuderiDiCirella()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.7173, 15.8180));
				shape.SetTitle('Ruderi di Cirella');         
				shape.SetDescription('Contrada Tredoliche<br>87020 Cirella di Diamante (Cosenza)'); 
				map.AddShape(shape);      
			}	
			
			function AddTheLegend()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6825, 15.8299));
				shape.SetTitle('Centro Sportivo The Legend');      
				shape.SetDescription('Parco Corvino<br>Diamante (Cosenza)<br>Tel. (+39) 347.5467508<br>Tel. (+39) 329.4022298<br><a href="Centro-Sportivo-The-Legend.aspx">maggiori info</a>');    
				map.AddShape(shape);      
			}	
			
			function AddLidoAlexander()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.72168, 15.81097));
				shape.SetTitle('Lido Alexander');   
				shape.SetDescription('Via Riviera Azzurra<br>87020 - Cirella di Diamante (Cosenza)<br>Tel. (+39) 0985.86159<br>Cell.(+39) 340.7325250<br><a href="Lido-Alexander-Diamante-Cirella.aspx">maggiori info</a>');       
				map.AddShape(shape);      
			}	
			
			function AddHotelCristina()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6970, 15.8151));
				shape.SetTitle('Hotel Cristina');  
				shape.SetDescription('3 stelle<br>Via Pietrarossa 24<br>87023 - Diamante (Cosenza)<br>Tel. (+39) 0985.81210<br>Fax. (+39) 0985.876224<br><a href="CristinaHotel.aspx">maggiori info</a>');        
				map.AddShape(shape);      
			}	
			
			function AddBBLabellavita()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6860, 15.8193));
				shape.SetTitle('B&B La bella vita');  
				shape.SetDescription('Contrada monaca 21 <br>87020 - Diamante (Cosenza)<br>Tel. (+39) 347.0653600<br>(+39)  338.2767230<br><a href="Bed-and-breakfast-La-bella-vita.aspx">maggiori info</a>');        
				map.AddShape(shape);      
			}			
			
			function AddHotelParthenius()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.7156, 15.8081));
				shape.SetTitle('Hotel Parthenius');  
				shape.SetDescription('Via Vittorio Veneto<br>87023 - Cirella di Diamante (Cosenza)<br>Tel. (+39) 0985.86713<br>Fax. (+39) 0985.86713<br><a href="Parthenius-Hotel.aspx">maggiori info</a>');        
				map.AddShape(shape);      
			}	
			
			function AddHotelStellaMaris()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.67740, 15.8183));
				shape.SetTitle('Hotel Stella Maris');  
				shape.SetDescription('3 stelle<br>Via Cavour, 12 <br>87023 - Diamante (Cosenza)<br>Tel. (+39) 0985.87445<br>Fax. (+39) 0985.256902<br><a href="Hotel-Diamante-Calabria-Stella-Maris.aspx">maggiori info</a>');        
				map.AddShape(shape);      
			}			
			
			function AddBeachHotel()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6830, 15.8167));
				shape.SetTitle('Beach Hotel');  
				shape.SetDescription('3 stelle<br>Via Ibico, 4 <br>87023 - Diamante (Cosenza)<br>Tel. (+39) (+39) 0985.81727<br>Fax. (+39) 0985.81727<br><a href="Hotel-Diamante-Calabria-Beach.aspx">maggiori info</a>');        
				map.AddShape(shape);      
			}			
			
			function AddBBLafiumara()      {          
			    var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6810, 15.8233));
				shape.SetTitle('B&B La Fiumara');  
				shape.SetDescription('Via Fragalleto, 1 <br>87020 - Diamante (Cosenza)<br>Tel. (+39) 0985.876856<br>Cell. (+39) 338.7990852<br><a href="Bed-and-Breakfast-La-Fiumara.aspx">maggiori info</a>');        
				map.AddShape(shape);      
			}
			
			function AddHotelSandaniele()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.7156, 15.8074));
				shape.SetTitle('Ristorante Albergo Sandaniele');  
				shape.SetDescription('3 stelle<br>Via Vittorio Veneto<br>87023 - Cirella di Diamante (Cosenza)<br>Tel. (+39) 0985.86834<br>Fax. (+39) 0985.86935<br><a href="Sandaniele-Hotel-Albergo.aspx">maggiori info</a>');           
    			pinid++;         
				map.AddShape(shape);      
			}	
			
			function AddAidanHouse()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6771, 15.8217));
				shape.SetTitle('Agenzia Immobiliare Aidan House');    
				shape.SetDescription('Via Vincenzo Padula<br>87023 - Diamante (Cosenza)<br>Tel. (+39) 0985.81161<br>Cell. (+39) 329.6482223<br><a href="Agenzia-Immobiliare-Aidan-House.aspx">maggiori info</a>');
				map.AddShape(shape);      
			}	
			
			function AddIsolaCirella()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6990, 15.8020));
				shape.SetTitle('Isola Cirella');  
				map.AddShape(shape);      
			}	
			
			var icon = "<div style='font-size:12px;font-weight:bold;border:solid 2px Black;background-color:Aqua;width:30px;'>foto</div>";
			var iconPark = "<div style='width: 25px; height:20px;'><img src='images/Logo-Parcheggio-Pubblico.png'></div>";  
			var iconFarmacia = "<div style='width: 24px; height:26px;'><img src='images/Logo-Farmacie.png'></div>";  
			var iconSanitari = "<div style='width: 24px; height:26px;'><img src='images/Logo-Sanitari.png'></div>";  
			
			function AddFotoPorto()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.67750, 15.8170));
				shape.SetCustomIcon(icon);
				shape.SetTitle('Foto porto');          
				shape.SetDescription("<a href=javascript:Zoom('Fotogallery547.jpg')>clicca qui per la foto</a>");         
				map.AddShape(shape);      
			}	
			
			function AddPorto()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.67730, 15.8160));
				shape.SetTitle('Porto di Diamante');          
				shape.SetDescription('<a href="http://www.pagineazzurre.com/italian/porto/id_cal003">maggiori info</a>');
				map.AddShape(shape);      
			}	
			
			function AddLungoMareVecchio()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.67650, 15.8190));
				shape.SetCustomIcon(icon);
				shape.SetTitle('Foto lungomare vecchio');          
				shape.SetDescription("<a href=javascript:Zoom('Fotogallery1044.jpg')>clicca qui per la foto</a>");         
				map.AddShape(shape);      
			}	
			
			function AddLungoMareNuovo()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.67920, 15.8165));
				shape.SetCustomIcon(icon);
				shape.SetTitle('Foto lungomare nuovo');          
				shape.SetDescription("<a href=javascript:Zoom('Fotogallery1054.jpg')>clicca qui per la foto</a>");         
				map.AddShape(shape);      
			}	
			
			function AddLungoMareNuovo2()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6820, 15.8163));
				shape.SetCustomIcon(icon);
				shape.SetTitle('Foto lungomare nuovo');          
				shape.SetDescription("<a href=javascript:Zoom('Fotogallery316.jpg')>clicca qui per la foto</a>");         
				map.AddShape(shape);      
			}	
			
			function AddLido1()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6830, 15.8155));
				shape.SetCustomIcon(icon);
				shape.SetTitle('Foto spiaggia');          
				shape.SetDescription("<a href=javascript:Zoom('Fotogallery296.jpg')>clicca qui per la foto</a>");         
				map.AddShape(shape);      
			}	
			
			function AddLido2()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6840, 15.8155));
				shape.SetCustomIcon(icon);
				shape.SetTitle('Foto spiaggia');          
				shape.SetDescription("<a href=javascript:Zoom('Fotogallery297.jpg')>clicca qui per la foto</a>");         
				map.AddShape(shape);      
			}	
			
			function AddLido3()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.67870, 15.8159));
				shape.SetCustomIcon(icon);
				shape.SetTitle('Foto spiaggia');          
				shape.SetDescription("<a href=javascript:Zoom('Fotogallery1052.jpg')>clicca qui per la foto</a>");         
				map.AddShape(shape);      
			}	
			
			function AddDiamante()      {          
				var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(39.6750, 15.8224));
				shape.SetCustomIcon(icon);
				shape.SetTitle('Foto Diamante');          
				shape.SetDescription("<a href=javascript:Zoom('Fotogallery1067.jpg')>clicca qui per la foto</a>");         
				map.AddShape(shape);      
			}	
			
			
			function Zoom(img) {
				window.open('FotogalleryZoom.aspx?img=' + img, "new", "width=860,height=720, scrollbars=yes, resizable=1");
			}
			
			
			/*
			function Zoom(img) {
				var contentZoom = document.getElementById("ContentZoom");
				contentZoom.style.display = 'block';
				contentZoom.style.backgroundImage = 'url(FotoGallery/' + img + ')';
			 }*/
			 
			 function ShowRoadMap() {
				var Partenza = document.getElementById("txtPartenza");
				var Arrivo = document.getElementById("txtArrivo");

				var locations;

				//locations = new Array("NAPOLI ITALIA", "NAPOLI ITALIA", "SORRENTO ITALIA");
				locations = new Array(Partenza.value, Partenza.value, Arrivo.value);

				var options = new VERouteOptions;

				// Otherwise what's the point?
				options.DrawRoute = true;

				// So the map doesn't change:
				options.SetBestMapView = false;
			    
				// Show as miles
				options.DistanceUnit = VERouteDistanceUnit.Kilometer;

				// Call this function when map route is determined:
				options.RouteCallback = ShowTurns;

				// Show the disambiguation dialog
				options.ShowDisambiguation = true;

				map.GetDirections(locations, options);

			}

function ShowTurns(route) {
    var turns = "<h3>Percorso</h3>(sono possibili approssimazioni)";

    turns += "<p><b>Distanza:</b> " + route.Distance.toFixed(1) + " km";


    turns += "<br/><b>Tempo:</b> " + GetTime(route.Time) + "</p>";

    // 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>Percorso 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) + " km";

                // 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("divRisultato");
    var divRisultato = document.getElementById("divRisultato");
    divRisultato.style.display = "block"
    
    d.innerHTML = "<p style='text-align: left'>" + s + "</p>";
    
}

// 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("");
    map.LoadMap(SeattleEastside, 8);
}
			      