$(function(){

	var $slider = "#slider";	
	$('img', $slider).css("z-index", 0);
	$('img:first', $slider).css("z-index", 1);
	$('img', $slider).css("display", 'none');
	$('img:first', $slider).css("display", 'block');
	
	var show = 0;
	var oldshow = 0;
	var zdjec = $('img', $slider).length - 1;
	
	showImage = function(oldshow, show){
		if(oldshow != show){
			$('img:eq(' + oldshow + ')', $slider).css("z-index", 0);
			$('img:eq(' + show + ')', $slider).css("z-index", 1);
			$('img:eq(' + show + ') ', $slider).fadeIn('slow', function() {});
			$('img:eq(' + oldshow + ') ', $slider).fadeOut('slow', function() {});
		}
	};	
	
   changeSlid = function() {
     play = setInterval(function() {
			oldshow = show;
			show++;	
			if(show > zdjec) {show = 0;}
			showImage(oldshow, show);
     }, 5000);
   };

    changeSlid();	
	
});
