

function create_ticker (container, options)
{
    var t = (typeof container == 'string') ? $(container) : container;
    t.ticker = Object.extend({
            width: 200,
            speed: 0,
            max_speed: 3,
            min_speed: 1,
            accel: 1000,
            interval: 50
        }, options);
    t.tick = function () {
        if (t.ticker.accel) {
            t.ticker.speed += t.ticker.accel;
            if (t.ticker.speed > t.ticker.max_speed) {
                t.ticker.speed = t.ticker.max_speed;
                t.ticker.accel = 0;
            }
            else if (t.ticker.speed < t.ticker.min_speed) {
                t.ticker.speed = t.ticker.min_speed;
                t.ticker.accel = 0;
            }
        }
        t.scrollLeft += t.ticker.speed;
        if (t.scrollLeft >= t.scrollWidth - t.offsetWidth)
            t.scrollLeft = 0;
        setTimeout('$("'+t.id+'").tick()', t.ticker.interval);
    };
    t.onmouseover = function () {
        t.ticker.accel = -0.3;
    }
    t.onmouseout = function () {
        t.ticker.accel = 0.3;
    };
    var b = t.id + '_ticker_body';
    var img = '<img src="/images/layout/pixel.gif" width="'+t.ticker.width+'" height="0">';
    var content = t.innerHTML;
    
    t.innerHTML = '<table cellspacing="0" cellpadding="0" width="'+t.ticker.width+'"><tr><td nowrap="nowrap">'+img+'<span id="'+b+'" width="'+t.ticker.width+'">&nbsp;</span>'+img+'</td></tr></table>';

    t.scrollLeft = t.scrollWidth - t.offsetWidth;
    t.style.overflow = 'hidden';
    t.style.display = 'block';
    t.style.width = t.ticker.width + 'px';
    b = $(b);
    b.innerHTML = content;
    t.tick();
}
