$(function() { var uffizi = new google.maps.LatLng(43.7681962, 11.2553000), pointToMoveTo, first = true, curMarker = new google.maps.Marker({}), $el; var myOptions = {zoom: 17, center: uffizi, mapTypeId: google.maps.MapTypeId.ROADMAP , scrollwheel: false}; var map = new google.maps.Map($("#mapdx")[0], myOptions); map.setTilt(45); $("#locations li").mouseenter(function() { $el = $(this); if (!$el.hasClass("hover")) { $("#locations li").removeClass("hover"); $el.addClass("hover"); if (!first) { curMarker.setMap(); curinfowindow.setMap(); } pointToMoveTo = new google.maps.LatLng($el.attr("data-geo-lat"), $el.attr("data-geo-long")); map.panTo(pointToMoveTo); curinfowindow = new google.maps.InfoWindow({content: $el.find(".longdesc").html()}); curMarker = new google.maps.Marker({position: pointToMoveTo, map: map, icon: "/images/blu.png"}); google.maps.event.addListener(curMarker, 'click', function() {curinfowindow.open(map,curMarker);}); } }); $("#locations li:first").trigger("mouseenter"); }); function available(date) { dmy = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear(); if ($.inArray(dmy, availableDates) != -1) { /* CONTROLLIAMO CHE NON SIA ANCHE SOTTO */ if ($.inArray(dmy, disableDates) != -1) { /* E' SOTTO */ return [false,"","unAvailable"]; } else { /* NON E' SOTTO */ return [true, "","Available"]; } /* CONTROLLIAMO CHE NON SIA ANCHE SOTTO */ } else { return [false,"","unAvailable"]; } } $('#calendar').datepicker({ onSelect: function(dateText, inst) { window.location = 'prenotazione-biglietti-galleria-accademia.asp?data=' + dateText;}, inline: true, firstDay: 1, dateFormat: 'dd-mm-yy', //showOtherMonths: true, dayNamesMin: ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'ven', 'Sab'], monthNamesShort: ['Gen', 'Feb', 'Mar', 'Apr', 'Mag', 'Giu','Lug', 'Ago', 'Set', 'Ott', 'Nov', 'Dic'], monthNames: ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'], minDate: 0, beforeShowDay: available, numberOfMonths: 2 }); $(function () { $('.excerpt').each(function () { $(this).html(formatWords($(this).html(), 30)); $(this).children('span').hide(); }).click(function () { var more_text = $(this).children('span.more_text'); var more_link = $(this).children('a.more_link'); if (more_text.hasClass('hide')) { more_text.show(); more_link.html(' » hide'); more_text.removeClass('hide'); } else { more_text.hide(); more_link.html(' « more'); more_text.addClass('hide'); } return false; }); }); function formatWords(sentence, show) { var words = sentence.split(' '); var new_sentence = ''; for (i = 0; i < words.length; i++) { if (i <= show) { new_sentence += words[i] + ' '; } else { if (i == (show + 1)) new_sentence += '... '; new_sentence += words[i] + ' '; if (words[i+1] == null) new_sentence += ' » more'; } } return new_sentence; } var geocoder; var map; function initialize() { geocoder = new google.maps.Geocoder(); var latlng = new google.maps.LatLng(43.7681962, 11.2553000); var myOptions = { zoom: 18, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map"), myOptions); } function showAddress(address) { geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); var marker = new google.maps.Marker({ map: map, position: results[0].geometry.location }); } else { alert("Geocode was not successful for the following reason: " + status); } }); }