 var $ = $ || window;
    $.get = function (expr) {
        function clsMatcher(className){
            return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
        }
        var e = typeof expr == "string" ? document.getElementById(expr) : expr;
        var elem = {
            dom:e,
            addClass:function(className) {
                var oldCls = e.className;
                e.className = !oldCls ?
                        className :
                        clsMatcher(className).test(oldCls) ?
                                oldCls : [oldCls,className].join(" ");
                return this;
            },remove:function() {
                e.parentNode && e.parentNode.removeChild(e);
                return this;
            },removeClass:function(className){
                e.className =(e.className||"").replace(clsMatcher(className),"$1$2");
                return this;
            },on:function(type, callback) {
                if (window.attachEvent)
                    e.attachEvent("on" + type, callback);
                else
                    e.addEventListener(type, callback, false);
                return this;
            },first:function(type) {
                var children = e.childNodes;
                for (var k = 0; k < children.length; k++) {
                    if (children[k].nodeType == 3)
                        continue;
                    if (!type || children[k].tagName.toLowerCase() == type.toLowerCase())
                        return $.get(children[k]);
                }
            },appendTo:function(parent){
                var p=parent.dom||parent;
                p.appendChild(e);
                return this;
            }
        };
        var directions = ["Left","Top"];
        for (var i = 0; i < directions.length; i++) {
            var method = "scroll" + directions[i];
            elem[method] = function(val) {
                return arguments.length ? e[method] = val : e[method];
            };
        }
        var sides = ["Width","Height"];
        for (var i = 0; i < sides.length; i++) {
            var side = sides[i];
            elem[side.toLowerCase()] = function(val) {
                if (arguments.length) {
                    e.style[side.toLowerCase()] = val + "px";
                    return this;
                }
                return  e["offset" + side] || e[side];
            }
        }
        return elem;
    };
    function Timer(c) {
        var thread;
        var delay = c.delay || 90;
        var runner = c.run || typeof c == "function" ? c : function() {
        };
        this.start = function() {
            !thread && (thread = window.setInterval(runner, delay));
            return this;
        }
        this.stop = function() {
            var snapshot = thread;
            thread = null;
            snapshot && window.clearInterval(snapshot);
            return this;
        }

    }
    var list = $.get("list").addClass("list");
    var increment = 1;
    var timer = new Timer(function() {
        var offset = list.scrollTop();
        var first = list.first().addClass('active');
        if (offset >= first.height()) {
            list.first().removeClass('active').remove().appendTo(list);
            list.scrollTop(increment);
        } else {
            list.scrollTop(Math.min(offset + increment,first.height()));
        }
    });
    timer.start();
    list.on("mouseover", timer.stop).on("mouseout", timer.start);

