var adsRotator = {
    index: 0,
    total: 0,
    slides: [],
    timerId: null,
    started: false,
    init: function(selector) {
        this.slides = $(selector).immediateDescendants();
        this.total = this.slides.length;
        this.showNext();
        return this;
    },
    showNext: function() {
        if (this.total > 1) {
            this.slides.each(function(slide) {
                slide.hide();
            });
            $(this.slides[this.index++]).appear();
            if (this.index >= this.total) {
                this.index = 0;
            }
        }
    },
    show: function() {
        var self = this;
        this.timerId = window.setInterval(function(){
            self.showNext();
        }, 10000);
    }
};
