if (typeof(Linderoth) == "undefined") Linderoth = {};
Linderoth.CarListFront = Linderoth.CarListFront || {
    initialize: function() {
        var _me = this;
        $(document).ready(function() {
            $('#spotContentSlides').cycle({
                fx:                 'scrollRight', 
	            easing:             'easeOutBack',
                delay:              0,
                speed:              500,
                timeout:            5000,
                before:             _me.onBefore,
                pager:              '#spotContentPager',
                pagerAnchorBuilder: _me.anchorBuilder
            });
        });
    },
    onBefore: function(currSlideElement, nextSlideElement, options, forwardFlag) {
        if (currSlideElement != nextSlideElement) {
            $('#spotContentPagerSelector').stop();
            $('#spotContentPagerSelector').animate({top: options.nextSlide * 39 + 'px'}, 500);
        };
    },
    onPagerClick: function(zeroBasedSlideIndex, slideElement) {
        $('#spotContentPagerSelector').stop();
        $('#spotContentPagerSelector').animate({top: zeroBasedSlideIndex * 39 + 'px'}, 500);
    },
    anchorBuilder: function(index, DOMelement) {
        return $('#spotContentPagerItem_' + index);
    }
};
Linderoth.CarListFront.initialize();
