$(document).ready(function(){
	/*
	Hover state for the grid of room buttons on the /rooms page
	*/	
	
	$.preload( '#slider img', {
		placeholder:'/fileadmin/templates/mia/images/800x191.png',
		notFound:'/fileadmin/templates/mia/images/800x191.png'
	});
	
	$('#rooms-index a').hover(
		function(){	
			$('img',this).hide();		
			$(this).stop().animate({
				opacity: '0.3'
			});
		},
		function(){
			$('img',this).show();
			$(this).stop().animate({
				opacity: '1'
			});
		}
	);
	
	// Blank out the empty squares if categories of rooms are being filtered
	$('#qu, #ta, #ia, #pa').each(function(){
		if($(this).hasClass('unfiltered a')) $('a',this).click(function(e){e.preventDefault();});
	});
	
	// Blank out the unfiltered rooms
	$('#rooms-index .unfiltered a').append('<img width="100" height="86" src="fileadmin/templates/mia/images/80-percent-burgundy.png" alt=""/>');
		
	// Random fade for the images in the main bar across the page
	$('#slider').innerfade({ 
		speed: 'slow', 
		timeout: 6000, 
		type: 'random_start', 
		containerheight: '191px' 
	});
});