(function($) {                                        
$.fn.karuzela_left = function(x) { x = $.extend({	delay:null, speed: 500, auto:null, easing:null, pokarz:null,  prev: null, next: null, prev1: null, next1: null }, x || {});
$(window).load(function() { ul_width = 0; li.each(function() { ul_width += $(this).width(); }); ul.css({'width' : ul_width });  }); 		

var div = $(this), ul = $("ul", div), li = $("li", ul);
var li_width = li.outerWidth();
var li_height = li.outerHeight();		
var size_div = li_width * (x.pokarz); 	
var left_value = li_width * (-1); 
var max_li=li.size();
var max_clik=x.pokarz;
var timer; 
var numer = 1;

if(max_li==1) { $('.next').remove();  $('.prev').remove(); } else {};

if(max_li<=x.pokarz) { }
else if (max_li==2) {

		  $(x.next).click(function() {
			if ($(".scroll ul:animated").length === 1) {} else {
			
					numer=numer+1; 
					if(numer>max_li) { numer=1;} else { numer=numer; };
					var contents = $('#scroll_text'+numer).html();
					$(".scroll_info_p").html(contents); 
					

					var left_indent = parseInt(ul.css('left')) - li_width;
					$(ul).not(':animated').animate({'left' : left_indent}, x.speed, x.easing, function () { 
					$('li:first',ul).before($('li:last',ul));   
					$(ul).css({'left' : 0});		
					});
				};
			
			 return false;	});

			
		$(x.prev).click(function() {
		if ($(".scroll ul:animated").length === 1) {} else {
		
					numer=numer-1; 
					if(numer<1) { numer=max_li; } else { numer=numer; };
					var contents = $('#scroll_text'+numer).html();
					$(".scroll_info_p").html(contents); 
					
					
					$('li:last',ul).after($('li:first',ul)); 
					 $(ul).css({'left' : -li_width});	
					var left_indent = 0;
					$(ul).not(':animated').animate({'left' : left_indent}, x.speed, x.easing, function () {      
          $(ul).css({'left' : 0});	
					});
					};
					
		return false;	});


}  else {

			$('li:first',ul).before($('li:last',ul));    
			ul.css({'left' : left_value });

		  $(x.next).click(function() {
			if ($(".scroll ul:animated").length === 1) {} else {

					numer=numer+1; 
					if(numer>max_li) { numer=1; } else { numer=numer; };
					var contents = $('#scroll_text'+numer).html();
					$(".scroll_info_p").html(contents); 
					
					
					
					var left_indent = parseInt(ul.css('left')) - li_width;
					$(ul).not(':animated').animate({'left' : left_indent}, x.speed, x.easing, function () { 
					$('li:last',ul).after($('li:first',ul));  
					$(ul).css({'left' : left_value});	
					});
					};
			
			 return false;	});
			
			
			
		$(x.prev).click(function() {
		if ($(".scroll ul:animated").length === 1) {} else {
		
					numer=numer-1; 
					if(numer<1) { numer=max_li; } else { numer=numer; };
					var contents = $('#scroll_text'+numer).html();
					$(".scroll_info_p").html(contents); 
					
					
					
					var left_indent = parseInt(ul.css('left')) + li_width;
					$(ul).not(':animated').animate({'left' : left_indent}, x.speed, x.easing, function () { 
					$('li:first',ul).before($('li:last',ul));           
					$(ul).css({'left' : left_value});
					});
					};
					
		return false;	});

};


cli_time = setInterval(function() {  $(x.next).click(); }, x.delay); 
$('.scroll_gal').bind("mouseenter", function(){  clearInterval(cli_time); });	
$('.scroll_gal').bind("mouseleave", function(){ cli_time = setInterval(function() {  $(x.next).click(); }, x.delay);  });	

$('.next').bind("mouseenter", function(){  clearInterval(cli_time); });	
$('.next').bind("mouseleave", function(){ cli_time = setInterval(function() {  $(x.next).click(); }, x.delay);  });	

$('.prev').bind("mouseenter", function(){  clearInterval(cli_time); });	
$('.prev').bind("mouseleave", function(){ cli_time = setInterval(function() {  $(x.next).click(); }, x.delay);  });	

}})(jQuery);


$(function() { $(".scroll_gal").karuzela_left({ delay:5000, speed:500, auto:1, pokarz:1, prev: ".prev", next: ".next" });});


(function($) {  
$.fn.mailtoPL = function () {
	return this.each( function() {
		var email = /(([a-z0-9*._+]){1,}\@(([a-z0-9]+[-]?){1,}[a-z0-9]+\.){1,}([a-z]{2,4}|museum)(?![\w\s?&.\/;#~%"=-]*>))/g
		$(this).html( $(this).html().replace( email, '<a href="mailto:$1" style="font-size:14px;">$1</a>' ) );
	});
}})(jQuery);


$(function() { $(".text_p").mailtoPL(); });
$(function() { $("a[rel*=external]").attr( "target", "_blank" ); });
$(function() { $("a[rel*=nofollow]").attr( "target", "_blank" ); });


$(function() { 	
								$('#slowo2').show();
								$('#slowo').hide();
								$('#slowo2').bind("mouseenter", function(){ $('#slowo2').hide(); $('#slowo').show(); });
								$('#slowo').bind("mouseleave", function(){ if($('#slowo').val()==''){ $('#slowo2').show();$('#slowo').hide(); }});
});
















