$(document).ready(function(){
	
	$('#theImages a#element-1 img').css('border','4px solid #407E8C');/*Metto il bordo all'img selezionata*/
	$('#theImages a#element-1 img').addClass('big_opacity');/*Metto l'alpha al 100% all'img selezionata*/
	
	
	$('#theImages a').click(function() {
		var id = parseInt($(this).attr('id').replace('element-', ''), 10);
		//alert(id);
		
		$('#theImages a img').each(function() {
			$(this).css('border','4px solid #ccc');/*Rimetto il bordo originale a tutte le img*/			
			$(this).addClass('small_opacity');/*Rimetto l'alpha originale a tutte le img*/
		});

		$('#theImages a#element-'+id+' img').css('border','4px solid #407E8C');/*Metto il bordo all'img selezionata*/
		$('#theImages a#element-'+id+' img').addClass('big_opacity');/*Metto l'alpha al 100% all'img selezionata*/
	});	
	if ($("theImages").length!=0) {initGalleryScript(); }
	
	
	/*SLIDEsHOW HOMEPAGE*/
	
	$('#column_1').cycle({			
		timeout: 4000, // disable automatic transitions 
		fx: 'fade',
		speed: 3000
			});
	
	$('#column_2').cycle({			
		timeout: 4000, // disable automatic transitions 
		fx: 'fade',
		speed: 1500
			});
			
	$('#column_3').cycle({			
		timeout: 4000, // disable automatic transitions 
		fx: 'fade',
		speed: 500
			});
			
	/*SLIDESHOW PAGINE INTERNE*/
	$('#column_1_item').cycle({			
		timeout: 4000, // disable automatic transitions 
		fx: 'fade',
		speed: 3000
			});
	
	$('#column_2_item').cycle({			
		timeout: 4000, // disable automatic transitions 
		fx: 'fade',
		speed: 1500
			});

	
	
	/*MENU*/	
	$("#nav-one > li").hover(
		function(){ $("ul", this).fadeIn("fast"); }, 
		function() { } 
	);
	if (document.all) {
		$("#nav-one li").hoverClass ("sfHover");
	}	
	/*FINE MENU*/	
	
	/*Personalizzazione select booking form*/
	$('.my-dropdown').sSelect();
	$('#hotel_list .my-dropdown').sSelect();	
	
	/*GALLERY PREV/NEXT*/
	$(function() {
		$('#s1').cycle({ 
			timeout: 4000, // disable automatic transitions 
			fx: 'fade',
			speed: 'fast',
			prevNextEvent: 'click',
			prev: '#prev',
			next: '#next'
		});
	});
	/*FINE GALLERY PREV/NEXT*/	
	
		/*Fancybox*/
	$(".group").fancybox({
		titlePosition: 'over'
	});
	
	// 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;
	});
	
	// 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;
	});	
	
	
	
	
	
	//Apertura esterna documenti PDF
	$('a[rel=external]').attr('target', '_blank');
	
	
	
	/*$('div.navigation div.top a:first()').css('color', 'red');*/
	

	
	/*Logo png trasparente*/
	/*$('div#logo').pngFix();*/

	
});

/*MENU*/
$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};
/*FINE MENU*/


