﻿// START TOOLTIP TRAVEL BOX
$(function() {
	$(".icon a").tooltip({
		bodyHandler: function() {
		    $($(this).attr("href")).html($(this).attr("value"));
			return $($(this).attr("href")).html();
		},
		//fade: 250,
		track: true,
		delay: 0,
		extraClass: "travel",
		fixPNG: true,
		left: -20,
		showURL: false
	});
	$(".point a").tooltip({
		bodyHandler: function() {
            $($(this).attr("href")).html($(this).attr("value"));
			return $($(this).attr("href")).html();
		},
		//fade: 250,
		track: true,
		delay: 0,
		extraClass: "point",
		fixPNG: true,
		left: -20,
		showURL: false
	});

});
// END TOOLTIP


// START TOOLTIP TRAVEL FLIGHTS
$(function() {
	$(".airport a").tooltip({
		bodyHandler: function() {
			return $($(this).attr("href")).html();
		},
		//fade: 250,
		track: true,
		delay: 0,
		extraClass: "flight",
		fixPNG: true,
		left: -20,
		showURL: false
		/*,
		positionBottom: true,
		positionTop: false,
		persistent: true*/



	});

});
// END TOOLTIP




// START CALENDAR
	$(function()
	{
	    
		$('.date-pick').datePicker({ endDate:dataMaxCalendar,clickInput:true,showYearNavigation:false  })
		$('#start-date').bind(
			'dpClosed',
			//'endDate'

			function(e, selectedDates)
			{
				var d = selectedDates[0];
				if (d) {
					d = new Date(d);
					$('#end-date').dpSetStartDate(d.addDays(0).asString());
				}
			}
		);
		$('#end-date').bind(
			'dpClosed',			
			function(e, selectedDates)
			{
			    
				var d = selectedDates[0];
				if (d) {
					d = new Date(d);
					
					//$('#start-date').dpSetEndDate(d.addDays(-1).asString());
				}
			}
			
		);

        $('#txtDataInizio').bind(
			'dpClosed',
			//'endDate'

			function(e, selectedDates)
			{
				var d = selectedDates[0];
				if (d) {
					d = new Date(d);
					$('#txtDataFine').dpSetStartDate(d.addDays(0).asString());
				}
			}
		);
		$('#txtDataFine').bind(
			'dpClosed',			
			function(e, selectedDates)
			{
			    
				var d = selectedDates[0];
				if (d) {
					d = new Date(d);
					
					//$('#start-date').dpSetEndDate(d.addDays(-1).asString());
				}
			}
			
		);
	});
	
    //Invio doppio click per IE6 per far apparire il calendario	
    function ie6Click(myObj) {
        if (jQuery.browser.version == "6.0") {
            myObj.click();
        }
    }
	
// END CALENDAR


// START GALLERY
$(document).ready(function(){
	//$("h2").append('<em></em>')
	$(".thumbs a").click(function(){
	    
		var largePath = $(this).attr("href");
		var largeAlt = $(this).attr("title");
		var largeId = $(this).attr("value"); //Inserisco nell'attributo value dell'href dell'immagine piccola l'id del prodotto
		var nomeElemento = "#largeImg"+largeId;
		
		$(nomeElemento).attr({ src: largePath, alt: largeAlt }); //richiamo l'id dell'immagine grande utilizzando anche l'id del prodotto
		$("h2 em").html(" (" + largeAlt + ")"); return false;
	});
	
});
// END GALLERY




// START ACCORDION
/*$(document).ready(function(){
	//$("#accordion").accordion({ alwaysOpen: false });  
	//$("#accordion").accordion();
});*/

$(document).init(function(){
	//alert("ok");
	//$("#accordion").accordion({ alwaysOpen: false });  
	
	$('#accordion').accordion({ 
	collapsible: true, 
	autoHeight: false, 
	active: false,
	alwaysOpen: false
	});
	
	$('#accordion2').accordion({ 
	collapsible: true, 
	autoHeight: false, 
	active: false,
	alwaysOpen: false
	});

});

// END ACCORDION



