$(document).ready(function(){
	
	$('#slide_box').fadeIn(300);
	
	
	/* popup */
	var ievs = (/MSIE (\d+\.\d+);/.test(navigator.userAgent));
	// IF BROWSER IS IE 6 LOAD IE6 STYLE
	if (ievs){
		var iev=new Number(RegExp.$1);
		if ((iev==7) || (iev==8) || (iev==9)) {
			//alert("qq");
			$('.more, .more-link').nm();
		}
		if (iev==6) {
			//alert("ie6");
			/*
			$('.more, .more-link').nm({
				callbacks: {
				    beforeShowCont: function(nm) {
					if (nm._hasFilter('title') && nm.opener.is('[rev]')) {
					    nm.store.title.html('<a href="'+nm.opener.attr('rev')+'">'+nm.store.title.text()+'</a>');
					}
				    }
				}
			});
			*/
		}
	} else {
		$('.more, .more-link').nm();
	};
	
	
	/*EFFETTO MENU*/
	/* Cambiare l'effetto da utilizzare */
//	$.easing.def = "easeOutBounce";
	
	
	/* Associare una funzione all'evento click sul link */
	/*
	$('li.title a').click(function(e){
		$(".container_menu a").css('color','#191506');
		$(".container_menu ul.sub-menu-ul a").css('color','#666');
		$(this).css('color','#666'); /*Coloro la voce selezionata
				
		// Finding the drop down list that corresponds to the current section: 
		var subMenu = $(this).parent().next();		
		
		// Trovare il sotto menu che corrisponde alla voce cliccata 
		$('.sub-menu').not(subMenu).slideUp('slow');
		subMenu.stop(false,true).slideToggle('slow');
		
		
		// Prevenire l'evento predefinito (che sarebbe di seguire il collegamento) 
		if(subMenu.length != 0){
			e.preventDefault();
		}
	});
	*/
	
	
	/*SLIDESHOW*/
	$('#slideshow').cycle({
		fx:      'fade',
		timeout:  5000
	});	
	
	
	/*CYCLE OFFERS*/
	$('#s2').cycle({ 
		fx:     'fade', 
		speed:  'fast', 
		timeout: 0, 
		next:   '#next2', 
		prev:   '#prev2' 
	});
	
	
	/*CYCLE EVENTS*/
	$('#s3').cycle({ 
		fx:     'fade', 
		speed:  'fast', 
		timeout: 0, 
		next:   '#next3', 
		prev:   '#prev3' 
	});
	
	/* jCarousel  - Minigallery */
	$('#mycarousel').jcarousel({
		wrap: 'circular',
		LoadCallback: GalleryCallbackFunction
	});
	
	
	/*Personalizzazione select booking form*/
	$('.my-dropdown').sSelect();
	$('#hotel_list .my-dropdown').sSelect();	
	
	/*Fancybox*/
	 $(".group").fancybox({
		titlePosition: 'over'
	});
	
	
	/*Logo png trasparente*/
	$('div#logo').pngFix();
	
	
	// Link_exchange pager
	$('#link_exchange_links .pager').find('a').live('click', function () {
		var that = $(this);
		$('#link_exchange_links_container').height($('#link_exchange_links_container').height()).addClass('loading');
		$('#link_exchange_links').fadeOut(200, function () {
			$(this).load(that.attr('href') + ' #link_exchange_links > *', function  () {
				$(this).fadeIn(200);
				$('#link_exchange_links_container').height('auto').removeClass('loading');
			});
		});
		return false;
	});

	// Guest comments pager
	$('#guestcomments .pager').find('a').live('click', function () {
		var that = $(this);
		$('#guestcomments-container').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;
	});
	
});


/* FUNCTIONS */ 
function GalleryCallbackFunction()
{
	/*Fancybox*/
	$(".group").fancybox({
		titlePosition: 'over'
	});
};

