	/*Logo png trasparente*/
	$('div#logo').pngFix( );
	
	/*Gestione menu*/
	$('.top_category a').not('a.sub').each(function() {
		$(this).hover(function() {
			/*Ricavo la classe dell'oggetto selezionato che equivale all'id del menu che dovrò aprire*/
			var $num_submenu = $(this).attr('class');
			$('ul.submenu').css('display','none');
			$('ul#'+$num_submenu).css('display','block');		
			//return false;
		},function() {
		});
	});	
	
	$("ul.submenu").hover(function() {
		$(this).parent("ul").css("display","block");
	},function() {
		$('ul.submenu').css('display','none');
	});
	
	
	/*Effetto Carousel offerte homepage*/	
	jQuery('#mycarousel').jcarousel({
        scroll: 1
    });
	
	
	/*Effetto scroll gallery pagina default*/
	$(".scroller").simplyScroll({
		speed: 5
	});

	//display-none booking e offers
	$('#button_bf a').click(function() {
		$('#list_offers').fadeOut(500);
		$('#list_offers').css('display','none');
		$('#button_bf').removeClass('button_bf_fuxia');
		$('#button_offers').addClass('button_offers_fuxia');
		
		$('#bf').fadeIn(500);
		$('#bf').css('display','block');
	});
	
	$('#button_offers a').click(function() {
		$('#bf').fadeOut(500);
		$('#bf').css('display','none');
		$('#button_offers').removeClass('button_offers_fuxia');
		$('#button_bf').addClass('button_bf_fuxia');
		
		$('#list_offers').fadeIn(500);
		$('#list_offers').css('display','block');		
	});
	
	
	//display-none booking hotel e booking restaurant
	$('#button_hotel a').click(function() {
		$('#bf_restaurant').fadeOut(500);
		$('#bf_restaurant').css('left','-9999px');
		
		$('#bf_hotel').css('left','10px');
		$('#bf_hotel').fadeIn(500);		
		
		$('#button_hotel').removeClass('check_bf');
		$('#button_hotel').addClass('check_bf_sel');
		
		$('#button_restaurant').removeClass('check_bf_sel');
		$('#button_restaurant').addClass('check_bf');
		
	});
	
	$('#button_restaurant a').click(function() {
		$('#bf_hotel').fadeOut(500);
		$('#bf_hotel').css('left','-9999px');
		
		$('#bf_restaurant').css('left','10px');
		$('#bf_restaurant').fadeIn(500);		
		
		$('#button_hotel').removeClass('check_bf_sel');
		$('#button_hotel').addClass('check_bf');
		
		$('#button_restaurant').removeClass('check_bf');
		$('#button_restaurant').addClass('check_bf_sel');		
		
	});
	
		
	// EFFETTO FADE OFFERS / EVENTS
	$('#list_items .image_box a').each(function() {
		var linked_listpage;
		 $(this).click(function() {			
			linked_listpage = $(this).attr('href') + ' #offevent_detail';
			$('#offevent_detail').fadeOut(300, function() {
				$('#offevent_detail').load(linked_listpage, function() {
					$('#offevent_detail').fadeIn(300);
				});
			});			
			return false;
		});
	});

	
 
	$('#list_items .txt_preview .more a').each(function() {
		var linked_listpage;
		 $(this).click(function() {	
			linked_listpage = $(this).attr('href') + ' #offevent_detail';			
			$('#offevent_detail').fadeOut(50, function() {
			    setTimeout("window.location.href = '#top';", 300);
				$('#offevent_detail').load(linked_listpage, function() {					
					$('#offevent_detail').fadeIn(800);
				});
			});		
			
		
			
			return false;
		});
	});

	
		
	/*Personalizzazione select booking form*/
	$('.my-dropdown').sSelect();	
		
	// VIEW ALL delle pagine eventi / offerte
	$('#view_all').click(function(){
		$('.featured').fadeOut(500);
		$('.all_hidden').fadeIn(500);
		$(this).css("display","none");
		return false;
	});
	
	
	// Guest comments pager
	$('#guestcomments .paging').find('a').live('click', function () {
		var that = $(this);
		$('#guestcomments').height($('#guestcomments-container').height()).addClass('loading');
		$('#guestcomments').fadeOut(200, function () {
			$(this).load(that.attr('href') + ' #guestcomments > *', function  () {
				$(this).fadeIn(200);
				$('#guestcomments-container').height('auto').removeClass('loading');
			});
		});
		return false;
	});

	// VISUALIZZO LA RISPOSTA DELLA FAQ E L'EVENTO IN HOMEPAGE
	$(".story .full_box .title a").click(function(){
		var hidden_id = parseInt($(this).parent('.title').attr('id').replace('h_', ''), 10);
		// nascodo tutte le risposte aperte
		$(".story .full_box .body").each(function() {	
			$(this).hide(1000);	
			//console.log(hidden_id);
			$(".full_box .title").removeClass("link_open");
			$(".full_box .title").addClass("link_close");
		});	
		
		$(".story .full_box #risp_" + hidden_id).show(1000);	
		$(".full_box #h_" + hidden_id).removeClass("link_close");
		$(".full_box #h_" + hidden_id).addClass("link_open");
		/*$(".story .full_box #freccia_" + hidden_id).hide(1000);*/	
		return false;	
	});
	
	
	// DATE PICKER FOR BOOKING FORM	
	/*Gestione calendario nella booking*/
	$(function() {
	jQuery(function(){	
		// initialise the "Select date" link
		jQuery('.date-pick')
			.datePicker(
	
				//associate the link with a date picker
				{
					createButton:false,
					startDate:'<?php echo date("d/m/Y"); ?>',
					endDate:'<?php echo date("d/m/Y",time() + 63000000); ?>'
				}
			).bind(
				// when the link is clicked display the date picker
				'click',
				function()
				{
					updateSelects(jQuery(this).dpGetSelected()[0]);
					jQuery(this).dpDisplay();
					return false;
				}
			).bind(
				// when a date is selected update the SELECTs
				'dateSelected',
				function(e, selectedDate, $td, state)
				{
					updateSelects(selectedDate);
				}
			).bind(
				'dpClosed',
				function(e, selected)
				{
					updateSelects(selected[0]);
				}
			);
			
		var updateSelects = function (selectedDate)
		{
			var selectedDate = new Date(selectedDate);
			jQuery('#d option[value=' + selectedDate.getDate() + ']').attr('selected', 'selected');
			jQuery('#m option[value=' + (selectedDate.getMonth()+1) + ']').attr('selected', 'selected');
			jQuery('#y option[value=' + (selectedDate.getFullYear()) + ']').attr('selected', 'selected');
		}
		// listen for when the selects are changed and update the picker
		jQuery('#d, #m, #y')
			.bind(
				'change',
				function()
				{
					var d = new Date(
								jQuery('#y').val(),
								jQuery('#m').val()-1,
								jQuery('#d').val()
							);
					jQuery('#date-pick').dpSetSelected(d.asString());
				}
			);
		
		// default the position of the selects to today
		var today = new Date();
		updateSelects(today.getTime());
		
		// and update the datePicker to reflect it...
		jQuery('#d').trigger('change');
		});
	});
	
	
	function check_date() {	
		//var date_input = document.input_date.value;
		var date_input = document.idForm1.input_date.value
		var dd = date_input.substring(0,2);
		var mm = date_input.substring(3,5);
		var yy = date_input.substring(6,10);
		document.idForm1.fromday.value = dd;
		document.idForm1.frommonth.value = mm;
		document.idForm1.fromyear.value = yy;	
		//alert(dd + "/" + mm + "/" + yy);
	}
	
	function check_date_ristorante() {
		//var date_input = document.input_date.value;
		var date_input = document.idForm2.input_date.value
		var dd = date_input.substring(0,2);
		var mm = date_input.substring(3,5);
		var yy = date_input.substring(6,10);
		document.idForm2.fromday.value = dd;
		document.idForm2.frommonth.value = mm;
		document.idForm2.fromyear.value = yy;
	}
	

	$(function() {
		//start();
	});
	
	// link credits
	$("[class*='cat_27  last']").attr('href', 'http://www.fastbooking.net');
	$("[class*='cat_27  last']").attr('target', '_blank');
	$("ul#id_22 li.last a").attr('href', 'javascript:;');
	$("ul#id_22 li.last a").click(function(){hhotelSearch('FRPRESTHVDValrugues', '', '', '', '', '', '&amp;FSTBKNGTrackLink=');});