function slideshow()
{
	this.images= new Array(),
	this.show= '',
	this.targetdiv= '',
	this.imageid = '',
	this.image,
	this.startoffset = 0,	
	this.delay = 3,
	this.duration = 3,
	this.start= function()
	{
		this.show = this.images;
		var image = this.show.pop();
		this.show.unshift( image );
		
		var img_html = $('<img src="' + image + '" id="' + this.imageid + '" style="width: 707px; height: 472px; display:none;" />');

		$('#'+this.imageid ).remove();
		$('#'+this.targetdiv).append( img_html );
		$('#'+this.targetdiv + ' img').attr( 'rel' , this );
		
		this.next_image();
	},
	
	this.next_image= function()
	{
		if( this.show.length == 0 )
		{
			this.show = this.images;
		}
		var that = this;
		var tmp_date = new Date();
		this.laststart = tmp_date.getTime();
//		console.log( 'DELAY of ' + this.targetdiv + ' : '  + ( 1+(this.delay + this.startoffset  ) * 1000 ) );
		$('#'+this.imageid)
			.delay( 1+(this.delay + this.startoffset  ) * 1000  )
			.fadeIn(  this.duration  * 1000 , 
					function ( )
					{
						var tmp_date2 = new Date();
						var now = tmp_date2.getTime();
			
						that.startoffset = 0;
						var img = $('#'+that.imageid);
						var bg_image = ( img.attr('src') );
						$('#'+that.targetdiv)
							.css('backgroundImage' , 'url(' + bg_image + ')');

						var image = that.show.pop();
						that.show.unshift( image );
						img.hide();
						$(img).attr('src' , image);

//						console.log( 'LAUFZEIT of ' + that.targetdiv + ' : ' + ( that.laststart - now ) + ' WEIL now=' + now + ' LASTSTART = ' + that.laststart );
//						that.startoffset = ( ( ( that.laststart - now )/1000) + ( that.duration + that.delay ) );

//						console.log( 'KORREKTUR : ' + that.startoffset );
						that.next_image();
					}
			); 
	};
}
