jQuery(window).ready(function($) {
	// Home panel //
	
	$('#homePanel li')
		.css({'display':'none'})
		.first().addClass('top');
	
	var t = setTimeout(init, 700),
			rotateSpeed = 5000;
			
		function init() {
			$('#homePanel .top').fadeIn(700);
			clearTimeout(t);
			t = setTimeout(rotate, rotateSpeed);
		}
		
		function rotate() {
			$next = $('#homePanel .top').next(),
			$top = $('#homePanel .top');
			
			if($next.length <= 0) { $next = $('#homePanel li:first-child'); }
			
			$top.fadeOut(700, function() { $(this).removeClass('top'); });
			$next.fadeIn(700, function() { $(this).addClass('top'); });
			
			clearTimeout(t);
			t = setTimeout(rotate, rotateSpeed);
		}
	
	
	// Resource panel //
	var oHeight = 100,
			hHeight = 292;
	
	$('#resourcePanel .resource h4, #resourcePanel .resource a').hide();
	$('#resourcePanel .resource .overlay').height(hHeight);
	$('#resourcePanel .resource').hover(function() {
		$(this).children('h4, a').stop().fadeTo(100, 1);
		$(this).children('.overlay').stop().animate({'height':oHeight}, 200);
	}, function() {
		var $overlay = $(this).children('.overlay');
		$(this).children('h4, a').stop().fadeTo(100, 0);
		$overlay.stop().animate({'height':hHeight}, 200);
	});
		
});
