
// TRASPARENT IE6
$(function() {
	$('#logo, .separa, .arrow-left, .arrow-right').ifixpng(); 
});


// PRIVACY LINK
$("a[class*='cat_12']").attr('href', 'javascript:;');
$("a[class*='cat_12']").click(function(){
	window.open("/themes/hotel_axo/static/privacy.html","popup","scrollbars=no,width=724,height=453,top=50,left=23").focus
	return false;
});


// NASCONDO TUUTE LE RISPOSTE DELLE FAQ
$(".faq_box .answer").each(function() {	
	$(this).css("display","none");
});


// VISUALIZZO LA RISPOSTA DELLA FAQ
$(".faq_box .body a").click(function(){
	// nascodo tutte le risposte aperte
	//console.log("qui");
	$(".faq_box .answer").each(function() {	
		$(this).hide(1000);
	});
	var hidden_id = parseInt($(this).parent('.body').attr('id').replace('h_', ''), 10); 
	$(".faq_box #risp_" + hidden_id).show(500);
	return false;
});



// SCROLLING 
(function($) {
	$(function() { //on DOM ready
		 
		$("#scroller").simplyScroll({
			className: 'vert',
			horizontal: false,
			frameRate: 20,
			speed: 10
		});
		
		$("#scroller_body").simplyScroll({
			className: 'vert',
			horizontal: false,
			frameRate: 20,
			speed: 10
		});
		
		$("#scroller_photogallery").simplyScroll({
			className: 'vert',
			horizontal: false,
			frameRate: 20,
			speed: 10
		});
		
	});
})(jQuery);



// PHOTOGALLERY
$(document).ready(function(){
	// NASCONDO CHIOCCIOLA DOPO CARICAMENTO CONTENUTI
	$('.hidden').removeClass('hidden');
	$('.loading').removeClass('loading');
	$('.loading_gallery').css("display","none");
	$('.loading_gallery').removeClass('loading_gallery');
	
						   
	$(".logo a").mouseover(function(){
		var hidden_id = parseInt($(this).parent('.logo').attr('id').replace('p_', ''), 10); 
		//console.log(hidden_id);
		$('.over_' + hidden_id).show();
			
    }).mouseout(function(){
			var hidden_id = parseInt($(this).parent('.logo').attr('id').replace('p_', ''), 10); 
			$('.over_' + hidden_id).mouseover(function(){
				$('.over_' + hidden_id).show();
			}).mouseout(function(){
				//console.log("qui");
				$('.over_' + hidden_id).hide();
			});	
		$('.over_' + hidden_id).hide();
    });
});


// LIST_PAGE
$(function() {
	$(".services a").click(function(){

		var hidden_id = parseInt($(this).parent('div').parent('.services').attr('id').replace('list_', ''), 10); 
		//console.log(hidden_id);
		$('#box_hidden').animate({ left: "580px"}, 1500);
		
		$('#box_hidden #articolo').load($(this).attr('href') + ' #articolo', function() {});		
		
		return false;
	});
	
	
	// CLOSE
	$('#close').click(function(){
		$('#box_hidden').animate({ left: "0"}, 1500);
		return false;
	});
	
});



// UNIFORM
$(function(){
	$("select").uniform();
	/*
	$(":radio").uniform();
	$(":checkbox").uniform();
	*/
});

$(function(){
	$('#input_date').click(function(){
		alert("qui");
		return false;						
	});
});


/*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.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;

	//alert(dd + "/" + mm + "/" + yy);
}


// FLASH
var flashvars = {szlang:maui_runtime.current_language};
var params = {};
var attributes = {};
attributes.id = "myFlash";
swfobject.embedSWF("/Uploads/Flash/Axo_cover.swf", "myAlternativeContent", "580", "600", "9.0.0", false, flashvars, params, attributes);




