	function SlideShow(destination, images, delay, fadespeed)
	{

		this.destination = $("#" + destination);
		this.delay = delay;
		this.fadespeed = fadespeed;
		this.currentindex = 0;
		this.images = Array();
		for(i = 0; i < images.length; i++)
		{
			this.images[i] = new Image();
			this.images[i].src = images[i];
		}

		this.Proxy = function(self, pfunc)
		{
			return function()
			{
				pfunc.apply(self);
			}
		}
		
		this.SetImage = function(index)
		{
			this.destination.attr("src", this.images[index].src);
			this.destination.attr("width", this.images[index].width);
			this.destination.attr("height", this.images[index].height);
		}
		
		this.ShowNext = function()
		{
			next = (this.currentindex + 1 >= this.images.length) ? 0 : this.currentindex + 1;

			if( !this.images[next] )
			{ // Pokud není obrázek načten, animace se pozdrží
				setTimeout( this.Proxy(this, this.ShowNext), 500);					
				return;
			}
			this.currentindex = next;
			this.destination.fadeOut(this.fadespeed, this.Proxy(this, this.FadeIn));
		}
		this.FadeIn = function()
		{
			this.SetImage(this.currentindex);
			this.destination.fadeIn(this.fadespeed);
			setTimeout( this.Proxy(this, this.ShowNext), this.delay);
		}
	
		//this.ShowNext();
		//this.SetImage(this.currentindex);
		setTimeout( this.Proxy(this, this.ShowNext), this.delay);
	}
