(function () {
    var init, document, list, items, anim, countdown, count, scroll;

    document = this.document;

    anim = function () {
        var item;
        if (list.scrollTop < items[0].offsetHeight) {
            scroll += 1.2;
            list.scrollTop = scroll;
        } else if (countdown > 0) {
            countdown -= 1;
        } else {
            item = items.shift();
            list.appendChild(item);
            items.push(item);
            scroll = 0;
            list.scrollTop = 0;
            countdown = count;
        }
    };

    init = function () {
        var itemsReq, i, length;
        scroll = 0;
        count = 60;
        countdown = count;
        list = document.getElementById('topitems');
        items = [];
        itemsReq = list.getElementsByTagName('li');
        length = itemsReq.length;
        for (i = 0; i < length; i += 1) {
            items.push(itemsReq[i]);
        }
        this.setTimeout(function () {
            this.setInterval(anim, 50);
        }, 3000);
    };

    if (this.addEventListener instanceof Function) {
        this.addEventListener('DOMContentLoaded', init, false);
    } else {
        this.document.attachEvent('onreadystatechange', function () {
            if (this.document.readyState === 'complete') {
                init();
            }
        });
    }
}());
