
		//preload the images and load them into an array
		imageArray2 = new Array(); 
		
		function DefObrazki2()
		{
			var image01 = new Image();
			imageArray2[imageArray2.length] = image01;
			image01.src = 'images/zgaszone.jpg';

			var image02 = new Image();
			imageArray2[imageArray2.length] = image02;
			image02.src = 'images/zaswiecone.jpg';

		}
		
		DefObrazki2();
		
		// imageIndex is going to be the index of the next image to display.  
		// images 0 and 1 are already loaded into the html
		var imageIndex2 = 1;

		function WybierzObrazek2(wartosc)
		{
			imageIndex2 = wartosc-1;
		}
		
		function switchImage2() {

			// place the next image to be displayed to the front
			$('imageFront2').src = imageArray2[imageIndex2].src;

			// make the image in front appear, when it is done swap it with the image in the back
			new Effect.Appear('imageFront2', {
				afterFinish: function() { 
					// make the image in the back the same src as the image in the front
					$('imageBehind2').style.background = 'url('+$('imageFront2').src+')';
					//hide the image in the front
					$('imageFront2').style.display = 'none';
					
					// increment the index
					imageIndex2++;
					// if we have indexed past the end of the array, go back to zero
					if (imageIndex2 == imageArray2.length) { 
						imageIndex2 = 0;
					}
				}
			});
		}

