window.addEvent('domready', function(){    var carousel = $('carousel-quotes');    var carouselBox = $('carousel-quotes-box');    if (!carousel || !carouselBox) {        return;    }    var citateContainer = $('carousel-quote-citate-container');    var itemsContainer = carouselBox.getParent();    var itemsCollection = carouselBox.getChildren('li.quote');    var buttonPrevious = $('carousel-previous');    var buttonNext = $('carousel-next');    var handlesContainer = $('carousel-quotes-handles');    var handles = handlesContainer.getElements('.container div');    var itemsDisplay = 1;    var autoPlay = true;    var autoPlayInterval = 10000;    var itemsMargin = 10;    if (!carouselBox) {        return;    }    var itemSizeX = 0;    var itemSizeY = 0;    var itempaddingY = 0;    var y = 1;    carousel.setStyle('display', 'none');    itemsCollection.each(function(li, index){        if (itempaddingY < 1) {            itempaddingY = li.getStyle('padding-top').toInt() + li.getStyle('padding-bottom').toInt();        }        if (itemSizeX < 1) {            itemSizeX = li.getStyle('width').toInt();        }        if (li.getStyle('height').toInt() > itemSizeY) {            itemSizeY = li.getStyle('height').toInt();        }        li.setStyle('clear', 'none');        li.setStyle('display', 'block');        li.setStyle('float', 'left');        li.setStyle('width', itemSizeX + 'px');        if (y < itemsCollection.length) {            li.setStyle('margin-right', itemsMargin + 'px');        }    });    handlesContainer.setStyle('display', 'block');    var items = new Array;    for (var i = 0; i < itemsCollection.length - itemsDisplay + 1; i++) {        items[i] = i;    }    carouselBox.setStyle('width', (itemSizeX + itemsMargin) * itemsCollection.length);    carouselBox.setStyle('position', 'absolute');    itemsContainer.setStyle('overflow', 'hidden');    itemsContainer.setStyle('position', 'relative');    itemsContainer.setStyle('width', itemSizeX);    itemsContainer.setStyle('height', itemSizeY + itempaddingY + 'px');    citateContainer.setStyle('display', 'block');    var ns1 = new noobSlide({        box: carouselBox,        items: items,        size: itemSizeX + itemsMargin,        sizeContainer: itemsCollection.length * itemSizeX + itemSizeX,        autoPlay: autoPlay,        interval: autoPlayInterval,        fxOptions: {            duration: 1000,            transition: Fx.Transitions.Quad.easeOut,            wait: false        },        addButtons: {            previous: buttonPrevious,            next: buttonNext        },        onWalk: function(currentItem, currentHandle){            if (currentHandle) {                this.handles.removeClass('active');                this.handles.removeClass('semiactive');                currentHandle.addClass('active');                if (currentHandle.getPrevious()) {                    currentHandle.getPrevious().addClass('semiactive');                }                if (currentHandle.getNext()) {                    currentHandle.getNext().addClass('semiactive');                }            }            if (!currentItem) {                currentItem = 0;            }            for (i in itemsCollection) {                if (i == currentItem) {                    citateContainer.getFirst('.mdl').innerHTML = itemsCollection[i].getFirst('p.quote-citate').innerHTML;                }            }        },        handles: handles    });});
