	// DATE PICKER FOR BOOKING FORM
	// DATE PICKER FOR BOOKING FORM
		my_log=function(str)
		{
			if (typeof(console) != 'undefined')
			{
				console.log(str);
			}
		}
	
	/*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
				}
			).bind(
				// when the link is clicked display the date picker
				'click',
				function()
				{
					my_log('click'+jQuery(this).dpGetSelected()[0]);
					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)
				{
					my_log('dateslected'+selectedDate);
					updateSelects(selectedDate);
				}
			).bind(
				'dpClosed',
				function(e, selected)
				{
					my_log('dpclosed'+selected);
					updateSelects(selected[0]);
				}
			);
			
		var updateSelects = function (selectedDate)
		{
			
			var selectedDate = new Date(selectedDate);
			my_log('updateSelects-> '+selectedDate+" - "+selectedDate.getTime());
			jQuery('#d').val(selectedDate.getDate());
			jQuery('#m').val(selectedDate.getMonth()+1);
			jQuery('#y').val(selectedDate.getFullYear());
		}
		// 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()
							);
					my_log('change-> d='+d.asString()+'Eseguiamo dpsetselected');
					jQuery('#date-pick').dpSetSelected(d.asString());
					my_log('stop');
				}
			);
		
		// default the position of the selects to today
		var today = new Date();
		my_log(today+"->updateSelects...");
		updateSelects(today.getTime());
		my_log(today+"->trigger change...");
		// 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.idForm.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.idForm.fromday.value = dd;
		document.idForm.frommonth.value = mm;
		document.idForm.fromyear.value = yy;	
		my_log('check_date'+ dd + "/" + mm + "/" + yy);
	}
	
	
	/*Personalizzazione select booking form*/
	$('.my-dropdown').sSelect();	
	
	// BOOK NOW LINK
	$(function() {	
		$("a[class='cat_12']").click(function(){											 
			hhotelSearchGroup('ITMILHTLMozart', '', '', '', '');
			return false;
		});
	});
	
	$("li.cat-id-12 a").click(function(){
		hhotelSearchGroup('ITMILHTLMozart', '', '', '', '');
		return false;
	});
	
	// GESTIONE DEGLI ITEM DELLE LIST PAGE	
	$('.item .more a').each(function() {
		var linked_page;
		 $(this).click(function() {			
			linked_page = $(this).attr('href') + ' #detail_item';
			$('#offerta').fadeOut(300, function() {
				$('#detail_item').load(linked_page, function() {
					$('#offerta').fadeIn(300);
				});
			});			
			return false;
		});
	});

	
	// VIEW ALL delle pagine eventi / offerte
	$('#view_all').click(function(){
		$('.featured').fadeOut(500);
		$('.all_hidden').fadeIn(500);
		$(this).css("display","none");
		return false;
	});


	$(function() {
		my_log('start()');
		//start();
	});
