function FOLGE3_COVERFLOW(baseid, maxItems, width, imageRoot, imageSize){ 
	this.baseid=baseid;
	this.maxItems = maxItems;
	this.width = width;
	this.imageSize = imageSize;
	this.imageWidth = 74;
	this.current = 0;
	this.imageRoot=imageRoot;
	this.highlighted = null;
	this.numberOfItems = $("#"+this.baseid+" .coverflow_block_container"+this.imageSize+" td img").length;
	this.numberOfPages = Math.ceil(this.numberOfItems/5);
	
	// these two offset values are browser specific
	// they are read from the CSS files
	this.offset = parseInt($("#"+this.baseid+" .coverflow_offset").css("left"));
	this.offset_when_scrolling_right = parseInt($("#"+this.baseid+" .coverflow_offset_when_scrolling_right").css("left"));
	


	//move all tables to the right
	for(var i = 1; i < this.numberOfPages; i++){
		$("#"+this.baseid+" .coverflow_block-"+i).css("left", this.width);
	}
	
	
	this.next = function(){
			this.resetAll();
			this.scrollLeft(this.current, 0, -this.width);
			
			if (this.current == this.numberOfPages-1){
				this.current = 0;
			}
			else {
				this.current += 1;
			}
			
			this.moveRight(this.current);
			this.scrollLeft(this.current, 1, -this.offset);
		};
		
		
	this.prev = function(){
			this.resetAll();
			this.scrollRight(this.current, 0, this.width);
			if (this.current == 0){
				this.current = this.numberOfPages-1;
			}
			else {
				this.current -= 1;
			}
			this.moveLeft(this.current);
			this.scrollRight(this.current, 1, this.offset_when_scrolling_right);
		};
		
		
	this.scrollLeft = function (index, opac, leftTarget){
			var selector = "#"+this.baseid+" .coverflow_block_container"+this.imageSize+" .coverflow_block-"+index;
			var elem = $(selector);
//			alert("SCROLLING ##### leftTarget: "+leftTarget+"  -  Index: "+index+"  -  NumPages: "+this.numberOfPages);
			elem.animate({ 
					left:  leftTarget,
					opacity: opac
				  }, 1000
			);	
		};
		
		
	this.scrollRight = function (index, opac, rightTarget){
		var elem = $("#"+this.baseid+" .coverflow_block_container"+this.imageSize+" .coverflow_block-"+index);
		elem.animate({ 
				left:  rightTarget,
				opacity: opac
			  }, 1000 );
		};
	
		
	this.moveLeft = function(index){
		var elem = $("#"+this.baseid+" .coverflow_block_container"+this.imageSize+" .coverflow_block-"+index);
		elem.animate({ 
			left:  -this.width*2
		  }, 1 );
	}
		
	
	this.moveRight = function(index){
		var elem = $("#"+this.baseid+" .coverflow_block_container"+this.imageSize+" .coverflow_block-"+index);
		elem.animate({ 
			left:  this.width
		  }, 1 );
	}
		
		
	this.mouseEnterOnCover = function(src){
		
		var isAlreadyHighlighted = false;
		if(this.highlighted != null && this.highlighted.src == src){
			isAlreadyHighlighted = true;
		}
		if(!isAlreadyHighlighted){
			
			var nr = $(src).attr("name");
			$("#"+baseid+" .cf_teaser_cover").hide();
			$("#"+baseid+" .coverflow_teaser-cover"+nr).show();
			
			var index = parseInt(nr);
			
			if(this.highlighted != null){
				var hl = this.highlighted;
				$(hl.src).animate({ 
					width: 74
				  }, 200 );
			}
		

			this.highlighted = new Object();
			this.highlighted.src = src;
			this.highlighted.oldTop =  parseInt($(src).css("top"));
			
			$(src).animate({ 
					width: 94
				  }, 200 );
		}
	};
	
	
	this.resetAll = function(){
		$("#"+this.baseid+" td img").each(function(index, dom){
			$(this).animate({width: 74},200);
		});
	}
	
	
	this.stopAll = function(){
		for (var i = 0; i<this.numberOfPages; i++){
			var selector = "#"+this.baseid+" .coverflow_block_container"+this.imageSize+" .coverflow_block-"+i;
			$(selector).stop(true,true);
		}
	}
}