function NewsTicker() {
    var $t = this;
    var $current = $("#ticker li:first");

    $t.timer;

    $t.showNext = function() {

        $current.find("a").fadeOut("slow", function(){
            $current.addClass("jsHide");
            $current = $current.next();
            if($current.length == 0)
                $current = $("#ticker li:first");
            $current.removeClass("jsHide");
            $current.find("a").fadeIn("slow");
        });
    }

    $t.showPrevious = function() {
        $current.find("a").fadeOut("slow", function(){
            $current.addClass("jsHide");
            $current = $current.prev();
            if($current.length == 0)
                $current = $("#ticker li:last");
            $current.removeClass("jsHide");
            $current.find("a").fadeIn("slow");
        });
    }

    $t.createLinks = function() {
        var $prev = $('<a href="#" id="rss-prev">Previous</a> ');
        $prev.click($t.showPrevious);

        var $next = $('<a href="#" id="rss-next">Next</a> ');
        $next.click($t.showNext);

        var $pause = $('<a href="#" id="rss-pause">Pause</a> ');
        $pause.click(function() {
            if($t.timer) {
                $("#rss-pause")[0].id = "rss-play";
                $t.destroyTimer();
            }
            else {
                $("#rss-play")[0].id = "rss-pause";
                $t.createTimer();
            }
        });
        var $buttons = $('<div id="buttons"></div>').append($next).append($prev).append($pause);
        $('#ticker').append($buttons);
    }

    $t.createTimer = function() {
        $t.timer = setInterval($t.showNext, 3000);
    }

    $t.destroyTimer = function() {
        clearInterval($t.timer);
        $t.timer = false;
    }

    $t.createLinks();
    $t.createTimer();
}
