$(function(){
	
	/* GESTIONE LOADING DELLA BF */
	$('#bf .bf-content').css('display','block');
	$('#bf').removeClass('loading');
	
	
	// FANCYBOX	
	jQuery(".photogallery a").fancybox();
	jQuery(".box-list-rooms .image a").fancybox();
	
	
	/***************************************************/
	/****************	 UNIFORM	********************/
	/***************************************************/
	$("#idForm .small select").uniform();	
	start();
		
	var i = 1;
	t = setTimeout('rotateCallouts('+i+')',6000);
	animationControls();
	
	// 
	$('#numbers a').mouseover(function(){
		$('#numbers span').each(function() {	
			$(this).removeClass('current');
		});
		
		clearTimeout(t);
		
		var thisId = $(this).attr('id');
		i = thisId.replace('number','');
		newId = 'div#rotating' + i;
		
		$('div.rotatingDiv:visible').css({display:"none"});
		
		$(newId).css({display:"block"});
		
		$(this).parent('span').addClass('current');
	});
	
});	/* end $(function) */

//Preview guest comments homepage		
$(document).ready(function() {
	$("ul#load_comments li a.loader").click(function() {
		$("ul#load_comments li a.current").removeClass("current");
		$(this).addClass('current');
		var toload='#comments_preview .'+$(this).attr('rel');
		var obj=$('#comments_preview .visible');
		obj.removeClass("visible");
		obj.fadeOut("fast", function ()
						{	
							$(toload).fadeIn("slow"); 
							$(toload).addClass('visible');
						});
	});
	$('.cat_39').attr('href','http://www.fastbooking.net');
	//$('.cat_39').attr('target','_blank');
	$('.cat_36').attr('href','javascript:;');
	$('.cat_36').click(function(){hhotelSearch("FRBAUSTPierre", "", "", "", "", "", "&amp;FSTBKNGTrackLink=");});
});
		

/*****************************************************/
/**************** 		FUNCTIONS 		**************/
/*****************************************************/
// FUNCTION animationControls
function animationControls(){
	$('div.rotatingDiv').mouseover(function(){
		clearTimeout(t);
	});

	$('div.rotatingDiv').mouseout(function(){
		visibleId = $('div.rotatingDiv:visible').attr('id');
		i = visibleId.replace('rotating','');
		t = setTimeout('rotateCallouts('+i+')',6000);
	});
	
	$('#numbers a').mouseover(function(){
		var thisId = $(this).attr('id');
		i = thisId.replace('number','');
		newId = 'div#rotating' + i;
		
		$('div.rotatingDiv:visible').css({display:"none"});
		
		$(newId).css({display:"block"});
	});	
}


// FUNCTION rotateCallouts		
function rotateCallouts(i){			
	if(i<5){
		thisId = 'div#rotating' + i;
		newId = i;
		newId++;
		newId = 'div#rotating' + newId;
		
		$('#numbers .element' + i).removeClass('current');
		
		
		$(thisId).fadeOut(1000,function(){
			$(newId).fadeIn(100); // SCRITTA
			$('#numbers .element' + i).addClass('current');
			i++;
		});
		
		
		i = newId.replace('div#rotating','');
		parseFloat(i);
		t = setTimeout('rotateCallouts('+i+')',6000);

	}
	else if(i===5){
		//Uncomment the code below to repeat
		/*
		$('div#rotating6').fadeOut(1000,function(){
			$('div#rotating1').fadeIn(1000);
			i++;
		});

		i = 1
		setTimeout('rotateCallouts('+i+')',6000);
		*/
	}
}

function book_room(ac, rc)
 {
	var cname="FRBAUSTPierre";
	hhotelResaDirect(cname,"",ac,rc,"",""); 
 }




