﻿$(document).ready(function() {
    var speed = 1;
    var items, scroller = $('#scroller');
    var width = 0;
    scroller.children().each(function() {
        width += $(this).outerWidth(true);
    });
    scroller.css('width', width);
    scroll();
    function scroll() {
        items = scroller.children();
        var scrollWidth = items.eq(0).outerWidth();
        scroller.animate({ 'right': 0 - scrollWidth }, scrollWidth * 100 / speed, 'linear', changeFirst);
    }
    function changeFirst() {
        scroller.append(items.eq(0).remove()).css('right', 0);
        scroll();
    }
});
