// studiofabryka.pl
// mc, 11 may 2011

$(function(){

	$('body').hide().fadeIn(500);

	// slideshow

		$('#slideshow').cycle({
			fx:			'scrollHorz',
			sync:		1,
			timeout:	4200,
			speed:		1800,
			easing: 	'easeOutBack'
		});


	// nav start animation

		$('nav li').hide();
		$('nav li').each(function(index){
			var $li = $(this);
			delay = 150;

			setTimeout(function(){
				$li.slideDown(800, 'easeOutBounce');
			}, index * delay);
		});

	// nav hover animation

		$('nav li').append('<img src="header/images/menubg-hover.jpg" />');
		$('nav li').not('.active').hover(function(){

			$(this).find('a').delay(50).stop(true, true).animate({marginTop:60}, 400, 'easeOutBack');
			$(this).find('img').delay(350).stop(true, true).animate({top:0}, 500, 'easeOutBack');
			$(this).find('a').delay(50).stop(true, true).animate({marginTop:0}, 400, 'easeOutBack');

		}, function(){

			$(this).find('img').delay(50).animate({top:-67}, 200);
			$(this).find('a').delay(0).animate({marginTop:-60}, 400, 'easeOutBack');
			$(this).find('a').delay(0).animate({marginTop:0}, 400, 'easeOutBack');

		});


	// google search

		$('.content').hide();

		$('.gsc-search-box').live('change', function(){
				$('#content').hide();
				$('.content').show();
		});

		$('.gsc-clear-button').live('click', function(){
			$('.content').hide();
			$('#content').show();
		});



}); // ready end
