function SlideShow(id, images_array, update_interval) {
	this.id              = id;
	this.image_elem      = $('#' + id);
	this.update_interval = update_interval == undefined ? 3 : update_interval;
	this.images          = [];

	if( images_array != undefined )
	{
		this.images = images_array;
		this.preload();
	}

	
	var selfObject = this;
	setInterval(function(){ selfObject.update(); }, this.update_interval * 1000);
}

SlideShow.prototype.update = function() {
	for( var i = 0; i < this.images.length; i++ )
	{
		if( this.image_elem.attr('src') == this.images[ i ] )
		{
			if( ++i == this.images.length )
			{
				i = 0;
			}
		
			var selfObject = this;	
			this.image_elem.fadeOut( 800, function() {
					selfObject.image_elem.attr('src', selfObject.images[ i ] );
					selfObject.image_elem.fadeIn( 800 );
				}
			);	
			break;
		}
	}
}

SlideShow.prototype.preload = function() {
	for( var i = 0; i < this.images.length; i++ )
	{
		var img = new Image( );
		img.src = this.images[ i ];
	}	
}
