$(document).ready(function () {
	$("a.group").fancybox();
	
	$("select#HotelList").uniform();
	$("select#nbdays").uniform();
	$("select#adulteresa").uniform();
	$("select#enfantresa").uniform();
	
	$("#group_gallery_2").cycle({fx: 'uncover,wipe,zoom', timeout:7500, speed:1500, delay:-4750, randomizeEffects:0});
	$("#group_gallery_3").cycle({fx: 'uncover,wipe,zoom', timeout:7500, speed:1500, delay:-3250, randomizeEffects:0});
	$("#group_gallery_4").cycle({fx: 'uncover,wipe,zoom', timeout:7500, speed:1500, delay:-1750, randomizeEffects:0});
	$("#group_gallery_5").cycle({fx: 'uncover,wipe,zoom', timeout:7500, speed:1500, delay:250  , randomizeEffects:0});

	$("#images_container").cycle({fx: 'uncover,wipe,zoom', timeout:3000, speed:1800, delay:-1500, randomizeEffects:0});

	if($("#subcats").length == 0) {
		$("#internal_content").css("width","100%");
	}

	// 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;
	});
	
	var ok_go=true;
	//Apertura offerte on mouseover
	$('#list_items div.item').each(function()
		{
			
			
			/*
			$(this).mouseenter(function () {
				var id_of_current_content=$("#ajax_content div.item_content").attr('id');
				var id_of_content_to_load="item_"+$(this).attr('id');
				//alert("id_of_current_content='"+id_of_current_content+"', id_of_content_to_load='"+id_of_content_to_load+"'");
				$(this).addClass('offershover');
				if ((id_of_current_content != id_of_content_to_load) && ok_go)
				 {
					var url_selector='#link_'+$(this).attr('id');
					var url=$(url_selector).attr('href')+" .item_content";
					ok_go=false;
					$("#ajax_content").slideUp(
						function() 
						{
							$('#loading').removeClass('hidden');
							$("#ajax_content").load(url, function() {
								location.href="#top";
								$('#loading').addClass('hidden');
								$("#ajax_content").mouseenter();
								$("#ajax_content").slideDown();
							});	
						}
					);
				
				 }

				return false;
			}); */
			
			$(this).mouseenter(function () {$(this).addClass('offershover');});
			$(this).mouseleave(function () {$(this).removeClass('offershover');});
		}
	 );
	 
	 $('li.cat_20 a').attr("target", "_blank");
	 $('li.cat_23 a').attr("target", "_blank");
	 
	 $("li.cat_18 a").attr('href', 'javascript:;');
	 $("li.cat_18 a").click(function(){
		hhotelSearch(myhotelname, '', '', '', '', '', '');
		return false;
	});
	 
	 
	 $('#list_items').mouseleave(function() {ok_go=true;});
});
