
        /* klasse:
            Eigenschaften:
                slidingDiv: div object das verschoben werden soll
                picSize: Groesse der Bilder
                shiftWidth: um wieviele Pixel wird das Objekt verschoben 
                tempo: wie oft wird verschoben beim autoslide
                shiftIntervalManual: wie oft wird verschoben bei manuellem slide
                easOutDuration: dauer des stop tweens
                currentPos: _intern aktueller CSS left Wert
                imagePos: _intern aktueller CSS left Wert eines Bildes
                currentImage: _intern index des aktuellen Bildes

            Methoden:
                shiftIt: verschiebt das objekt "slidingDiv"
                startLoop: startet den Film
                stopLoop: stoppt den Film
                appendImage: setzt Bild ans Ende des objektes
        */
        

        var Carousel = new Class({
            
            options: {
                slidingDiv: null,
                viewElements: 0,
                picSize: 200,
                orientation: 'left',
                times: 1,
                easeOutDuration: 0,
                direction: 'forward', // forward or backward 
                mouse: 1
            },

            initialize: function(options){
                this.setOptions(options);
                this.currentPos = 0;
                this.listOfPics = $$('#' + this.options.slidingDiv + ' div');

                this.imageStyleObj = [] ;
                // loop over pics an create fx instances
                this.listOfPics.each(function(i){
                    this.imageStyleObj[this.listOfPics.indexOf(i)] = new Fx.Tween(
                                                                            i, 
                                                                            {    property: this.options.orientation,
                                                                                 duration: 0 }
                                                                         ); 
                }, this) ;

                this.numberOfPics = this.listOfPics.length ;
                this.totalWidth = this.options.picSize * this.numberOfPics;
                this.imagePos = this.totalWidth;
                this.c = 0 ;
                this.slideObj = $(this.options.slidingDiv);
                this.currentImage;
                // style instance 
                this.fx = new Fx.Tween(this.options.slidingDiv, { 
                    property: this.options.orientation,
                    duration: this.options.easeOutDuration,
                    onStart: function(){
                        this.options.mouse = null;
                        this.options.times--;
                        this.appendPic();
                    }.bind(this),
                    onComplete: function(){
                        if(this.options.times > 0){
                            this.shiftIt();
                        }
                        else {
                            this.options.mouse = 1;
                        }
                    }.bind(this)
                });
                this.fx.options.transition = Fx.Transitions.linear ; 
            },
        
            go: function(){
                while(this.options.times > 0) {
                    this.options.times--;
                    this.shiftIt();
                    this.appendPic();
                }
            },

            shiftIt: function(){
                if(this.options.direction == 'forward'){
                    this.currentPos += ( this.options.shiftWidth * -1 ) ; 
                }
                else {
                    this.currentPos += this.options.shiftWidth ; 
                };
                //this.fx.start(this.options.orientation,this.currentPos);
                this.slideObj.setStyle(this.options.orientation,this.currentPos);
            },

            appendPic: function(){
                var tmpPos = this.imagePos ;

                this.imageStyleObj[this.c].set(tmpPos) ;

                this.c = this.getIndex('up', this.c); 
                this.imagePos += this.options.picSize;
            },

            getIndex: function(s, b){
                var i;
                if(s == 'up') {  
                    i = b + 1;
                    if(i == this.numberOfPics) { i = 0 };
                    return i;
                }
                if(s == 'down'){
                    i = b - 1;
                    if(i == -1) { i = this.numberOfPics - 1 };
                    return i;
                }
            }

        });
        Carousel.implement(new Options, new Events);
