
function CONTENTROTATOR(aTimeout, aTransitionTime, aRootName, aType, aChangeFunction) {
    this.timeout = aTimeout * 1000;
    this.transitionTime = aTransitionTime * 1000;
    this.rootName = aRootName;
    this.currentIndex = 0;
    this.type = aType;
    this.timer = null;
    this.changeFunction = aChangeFunction;
    this.change = function(index) {
        if (this.currentIndex != index) {
            if (this.type != 'navonly') {
                window.clearTimeout(this.timer);
                eval("this.timer = window.setTimeout('" + this.changeFunction + "',this.timeout);");
            }
            if (index == -1) {
                index = this.currentIndex + 1;
            }
            var oldDiv = $(this.rootName + this.currentIndex);
            if (oldDiv) {
                Effect.Fade(this.rootName + this.currentIndex, { durration: 100, from: 1.0, to: 0.0 });
                //eval("Effect.Fade(this.rootName+this.currentIndex, {durration:"+this.transitionTime+", from:1.0, to:0.0});");
                var oldLink = $(this.rootName + 'Toplink_' + this.currentIndex);
                if (oldLink) {
                    oldLink.removeClassName('selected');
                }
                oldLink = $(this.rootName + 'Bottomlink_' + this.currentIndex);
                if (oldLink) {
                    oldLink.removeClassName('selected');
                }
            }
            var newDiv = $(this.rootName + index);

            if (newDiv) {
                this.currentIndex = index;
            } else {
                newDiv = $(this.rootName + 1);
                this.currentIndex = 1;
            }
            var newLink = $(this.rootName + 'Toplink_' + this.currentIndex);
            if (newLink) {
                newLink.addClassName('selected');
            }
            newLink = $(this.rootName + 'Bottomlink_' + this.currentIndex);
            if (newLink) {
                newLink.addClassName('selected');
            }
            var newNewDiv = $(this.rootName + this.currentIndex);
            if (newNewDiv) {
                Effect.Appear(this.rootName + this.currentIndex, { durration: 100, from: 0.0, to: 1.0 });
            }
            //eval("Effect.Appear(this.rootName+this.currentIndex, {durration:"+this.transitionTime+", from:0.0, to:1.0});");
        }
    };
    this.pause = function() {
        if (this.type != 'navonly') {
            window.clearTimeout(this.timer);
        }
    };
    this.start = function() {
        if (this.type != 'navonly') {
            eval("this.timer = window.setTimeout('" + this.changeFunction + "',this.timeout);");
        }
    };
}

