jQuery(function( $ ){
	
	/*
	if(typeof document.onselectstart!="undefined") {
		document.onselectstart=new Function ("return false");
	} else {
		document.onmousedown=new Function ("return false");
		document.onmouseup=new Function ("return true");
	}
	*/
	
	$('#newsletter_name').example('Twoję imie i nazwisko');
	$('#newsletter_mail').example('Twój adres e-mail');
	
	$('#container_top').serialScroll({
		items: '#transmission_top a',
		prev: '#move_left',
		next: '#move_right',
		offset: -155,
		start: 1,
		exclude: 3,
		duration: 250,
		force: true,
		stop: true,
		lock: false,
		cycle: true
	});
		
	$("div.homepage_block").mouseenter(function(){
		$(this).attr("id")
		$("#"+$(this).attr("id")+" a.read_more").animate({ 
			top: 100
		}, 400 );
	});
	
	$("div.homepage_block").mouseleave(function(){
		$(this).attr("id")
		$("#"+$(this).attr("id")+" a.read_more").animate({ 
			top: 143
		}, 200 );
	});
	
	
	var timeout;
	
	$("#subnavigation_wrap").css("top", 0-($("#subnavigation_wrap").height()));
	
	$("#n_ogolne").mouseenter(function(){
		clearTimeout(timeout);
		$("#subnavigation_mask").css("height", $("#subnavigation_wrap").height());
		$("#subnavigation_mask").css("top", 126);
		$("#subnavigation_wrap").animate({ top: 0 }, 250);
	});
	
	$("#subnavigation_wrap").mouseenter(function(){
		clearTimeout(timeout);
	});
		
	$("#subnavigation_wrap").mouseleave(function(){
		timeout = setTimeout(function() {
			$("#subnavigation_wrap").animate({ top: 0-($("#subnavigation_wrap").height()) }, 350, function(){
				$("#subnavigation_mask").css("height", 25);
				$("#subnavigation_mask").css("top", 96);
			});
		}, 500);
	});
	
	$("#n_ogolne").mouseleave(function(){
		timeout = setTimeout(function() {
			$("#subnavigation_wrap").animate({ top: 0-($("#subnavigation_wrap").height()) }, 350, function(){
				$("#subnavigation_mask").css("height", 25);
				$("#subnavigation_mask").css("top", 96);
			});
		}, 500);
	});
	
	$(".garage").hover(
		function() {
			
	    	$(this).find(".bar8").animate({top: "-18px"}, {queue: false, duration: 500});
	    	$(this).find(".bar7").animate({opacity: 1}, 10).animate({top: "-18px"}, {queue: false, duration: 500});
	    	$(this).find(".bar6").animate({opacity: 1}, 20).animate({top: "-18px"}, {queue: false, duration: 500});
	    	$(this).find(".bar5").animate({opacity: 1}, 30).animate({top: "-18px"}, {queue: false, duration: 500});
	    	$(this).find(".bar4").animate({opacity: 1}, 40).animate({top: "-18px"}, {queue: false, duration: 500});
	    	$(this).find(".bar3").animate({opacity: 1}, 50).animate({top: "-18px"}, {queue: false, duration: 500});
	    	$(this).find(".bar2").animate({opacity: 1}, 60).animate({top: "-18px"}, {queue: false, duration: 500});
	    	$(this).find(".bar1").animate({opacity: 1}, 70).animate({top: "-18px"}, {queue: false, duration: 500});
	    	$(this).find("img").animate({bottom: "-144px"}, 70).animate({bottom: "0"}, {queue: false, duration: 800});
	    	
		}, function() {
		
	    	$(this).find(".bar8").animate({top: "126px"}, {queue: false, duration: 720});
	    	$(this).find(".bar7").animate({top: "108px"}, {queue: false, duration: 730});
	    	$(this).find(".bar6").animate({top: "90px"}, {queue: false, duration: 740});
	    	$(this).find(".bar5").animate({top: "72px"}, {queue: false, duration: 750});
	    	$(this).find(".bar4").animate({top: "54px"}, {queue: false, duration: 760});
	    	$(this).find(".bar3").animate({top: "36px"}, {queue: false, duration: 770});
	    	$(this).find(".bar2").animate({top: "18px"}, {queue: false, duration: 780});
	    	$(this).find(".bar1").animate({top: "0px"}, {queue: false, duration: 790});
	    	$(this).find("img").animate({bottom: "-144px"}, {queue: false, duration: 810});
	    	
	    	setTimeout(function(){
	    		$(this).find(".bar8").css("top", 126);
	    		$(this).find(".bar7").css("top", 108);
	    		$(this).find(".bar6").css("top", 90);
	    		$(this).find(".bar5").css("top", 72);
	    		$(this).find(".bar4").css("top", 54);
	    		$(this).find(".bar3").css("top", 36);
	    		$(this).find(".bar2").css("top", 18);
	    		$(this).find(".bar1").css("top", 0);
	    		$(this).find("img").css("bottom", -144);
	    	}, 500)
	    		    
	    	    	
		}
	);
		

});
