/*!
 * jQuery custom scripts file
 * 
 * Dariusz Pobożniak
 * http://pobozniak.pl
 */

$(function () {
	$('.lightbox').fancybox();
	rotator();
	bouncingdivs();
})

rotator = function () {
	if ($("#slider li").length > 1) {

		$("#slider li").hide();
		$active = $("#slider li:first").show();
			
		rotate = function(fade, time) {
		play = setInterval(function() { 
				$active.fadeOut(fade);
				$active = $active.next();
					if ($active.length === 0) {
						$active = $("#slider li:first");
					}
				$active.fadeIn(fade);
			}, time);
		};

		rotate(700,3000);
	
		$("#slider li").hover(
				function() {
				clearInterval(play); 
		}, function() {
				rotate(700,3000);
		});	

	}
}

bouncingdivs = function() {
	$(".description").hover(
			function() {
				$(".show-desc", this).animate({
					height: '60px' }, 500);
				$(".title", this).css('border-width','1px');
			}, function () {
				$(".show-desc", this).stop().css('height','');
				$(".title", this).css('border-width','0px');
	});
}
