$(document).ready(function(){
	
	/* musicaaaaaaa */
	/*$('#musicbutton').click(function(){
		var boh = '<embed type="application/x-shockwave-flash" src="/solomusica.swf" scale="scale" wmode="transparent" id="mymovie" name="mymovie" bgcolor="#efe6c9" quality="high" width="55" height="13">';
		if($(this).hasClass('playing')) {
			$('#flashcontent_musica').html("");
			$(this).removeClass('playing');
			$("#musicbutton a").removeClass('playing');
			$("#musicbutton a").addClass('closed');
		} else {
			$('#flashcontent_musica').html(boh);
			$(this).addClass('playing');
			$("#musicbutton a").removeClass('closed');
			$("#musicbutton a").addClass('playing');
		}
		
	});*/
	
	
	var video ='<object width="630" height="390"><param name="movie" value="http://www.youtube.com/v/szImcEQ-tzI?fs=1&amp;hl=it_IT"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="transparent"></param><embed wmode="transparent" src="http://www.youtube.com/v/szImcEQ-tzI?fs=1&amp;hl=it_IT" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="630" height="390"></embed></object>';
	
	$('#video').prepend(video);
	
	
	$('#playmusic2').click(function(){
		var boh = '<embed type="application/x-shockwave-flash" src="/solomusica.swf" scale="scale" wmode="transparent" id="mymovie" name="mymovie" bgcolor="#efe6c9" quality="high" width="55" height="13">';
		if($(this).hasClass('playing')) {
			$('#flashcontent_musica').html("");
			$(this).removeClass('playing');
		} else {
			$('#flashcontent_musica').html(boh);
			$(this).addClass('playing');
		}
		
	});
	
	
	/*Scrolling gallery a destra*/
	$('#s4 #s2').cycle({ 
		fx:     'fade', 
		speed:  'fast', 
		timeout: 0, 
		next:   '#next2', 
		prev:   '#prev2' 
	}); 
	
	/*SLIDESHOW HOME ITEM*/
	$(function() {
		$('#slideshow').cycle({
			fx:      'fade',
			timeout:  5000			
		});		
	}); 
	
	/*Personalizzazione select booking form*/
	$('.my-dropdown').sSelect();
	$('#hotel_list .my-dropdown').sSelect();
	/*Personalizzazione select Newsletter */
	$('#newsletter_form select').sSelect();
	
	/*Fancybox*/
	$(".group").fancybox({
		titlePosition: 'over'
	}); 
	
	/*Logo png trasparente*/
	$('div#shadow_header_group,div#shadow_header_home,#shadow_header_default,div#logo,div#booking_box_group,div#booking_box_home,div#booking_box_default,div.logo_hotel_2,div.logo_hotel_3,div.logo_hotel_4,div.logo_hotel_5,div.logo_hotel_6,div.logo_hotel_7,div.logo_hotel_8,div.logo_hotel_9,div.logo_hotel_10').pngFix();
	
	/*Scrolling items*/
	$(".scrollable").scrollable();
	
	$('#slideshow').fadeIn(500);
	
	$('#newsletter_form').css("visibility","visible");


	// 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;
	});
	
});
