$(document).ready(function() {
	
	<!--$("img").lazyload({threshold : 200, effect : "fadeIn", placeholder : "img/bigGalInd.gif"});-->
	
	$(".topNaviBox ul li").mouseenter(function(){
		$(".topNaviBox ul li").removeClass("current");
		$(this).animate().addClass("current");
    }).mouseleave(function(){
		$(".topNaviBox ul li").removeClass("current");
    });
	
	$(".animTab").each(function(index){
		var $li = $(this);
			setTimeout(function() {
				$li.find('.chmura').animate({opacity: 1}, 500, function() {});
				$li.find('.objekt').animate({opacity: 1}, 200, function() {});
				$li.find('.chmura').animate({ top : "-65px" }, 300, function(){});
				$li.find('.objekt').animate({ top : "-5px" }, 200, function (){});
				$li.find('a img').animate({top: "0px",opacity: 1}, 800);
			}, index * 1000);
	});
	
	$(".animTab").mouseenter(function(){
		$(this).find('.chmura').animate({ top : "-75px" }, 1000);
		$(this).find('a img').animate({top: "-10px"}, 200);
    }).mouseleave(function(){
		$(this).find('.chmura').animate({ top : "-65px" }, 1000);
		$(this).find('a img').animate({top: "0px"}, 200);
    });
	
	setInterval(function() {
	var delIndex = 3;
	$.eachDelay($(".animTab"),function(delIndex){
			var $li = $(this);
			$(this).find('.chmura').animate({ top : "-75px" }, 500);
			$(this).find('a img').animate({top: "-10px"}, 200);
			$(this).find('.chmura').animate({ top : "-65px" }, 500);
			$(this).find('a img').animate({top: "0px"}, 200);
		}, delIndex * 500);
	}, 10000);
	
	$(".sliderBox img").hide().each(function(index){
		var $li = $(this);
			setTimeout(function() {
				$li.fadeIn();
			}, index * 200);
	});
	
	
	$('.newsListBox').jScrollPane({showArrows: true});
	$('.podstrText').jScrollPane({showArrows: true});
	
	
	if ($('.sliderBox img').length >= 1){
		$(".sliderBox").jCarouselLite({
			btnNext: "#sliderBtL",
			btnPrev: "#sliderBtR",
			visible: 7,
			easing: "easeInOutBack",
			speed: 1000,
			auto: 500,
			pauseOnHover: true,
			afterEnd: function(a) {  
				$(".sliderBox img").fadeIn();      
				}
		});
	}
 
			$('.player').player({
				width: 390,
				height: 225,
				chromeless: 0,		
				showTime: 0,
				showPlaylist: 0,
				showTitleOverlay: 0,
				playlist: {
					videos: [
						{ id: '2Y_ccpXF7wI' }
					]
				}
			});
	
	$(".refBox .refItem:first").addClass('current');
	$(".refBox .refItem").mouseenter(function(){
		$(".refBox .refItem").removeClass('current');
		$(this).addClass('current');
    });
	
	$('a.top').click(function(){
		$('html, body').animate({scrollTop: '0px'}, 300);
     return false;
	});
	
	
	$('.bigLoader').show();
			window.setTimeout(function() {
				$('.bigLoader').hide();
				$('.galeryBox .galBigBox img').animate({ 'marginTop' : "0px" }, 1000, 'easeOutBack', function(){});
	}, 1500);
	
	
	
	$('.galImgList .imgBox a').click(function(){								  
		var imgName = $(this).attr('rel');
		$('.galeryBox .galBigBox img').animate({ 'marginTop' : "307px" }, 500, 'easeInBack', function(){
																									   
			$('.bigLoader').show();
			
			$('.galeryBox .galBigBox img').attr('src', ''+imgName+'').load(function() {  
  $('.bigLoader').hide();
			$('.galeryBox .galBigBox img').animate({ 'marginTop' : "0px" }, 1000, 'easeOutBack', function(){}); 
});  
			
			
			
			
			
		});
		
		
		return false;
	});
	
	
	$('.galImgList .imgBox a').load(function() {  
		$(this).fadeIn(); 
	});
	
	$('a.konSendForm').click(function(){
		$('#form1 .formLog').text();						  
		$.post("submit_form.php", $("#form1").serialize(), function(data){
			$('#form1 .formLog').text(data);												 
		});
		return false;
	});
	
	$("a[rel^='prettyPhoto']").prettyPhoto();
	
});

















