var WT = {
    options: {
        container: "TICKER",
        speed: 2,
        css: "font-family:Arial; font-size:12px; color:#444444",
        paused: false,
        width: "300px",
        content: "",
        righttoleft: false
    },
    ticker_start: function(options) {
        if (options) {
            WT.options = options;
        }
        var tickerSupported = false;
        var tickerContainer = document.getElementById(WT.options.container);
        WT.options.width = tickerContainer.style.width;
        tickerContainer.style.visibility = "visible";
        var img = "<img src='ticker_space.gif' width=" + WT.options.width + " height=0>";

        // Firefox
        if (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Safari") != -1) {
            tickerContainer.innerHTML = "<TABLE  cellspacing='0' cellpadding='0' width='100%'><TR><TD nowrap='nowrap'>" + img + "<SPAN style='" + WT.options.css + "' ID='" + WT.options.container + "_BODY' width='100%'>&nbsp;</SPAN>" + img + "</TD></TR></TABLE>";
            tickerSupported = true;
        }
        // IE
        if (navigator.userAgent.indexOf("MSIE") != -1 && navigator.userAgent.indexOf("Opera") == -1) {
            tickerContainer.innerHTML = "<DIV nowrap='nowrap' style='width:100%;'>" + img + "<SPAN style='" + WT.options.css + "' ID='" + WT.options.container + "_BODY' width='100%'></SPAN>" + img + "</DIV>";
            tickerSupported = true;
        }
        if (!tickerSupported) tickerContainer.outerHTML = ""; else {
            tickerContainer.scrollLeft = WT.options.righttoleft ? tickerContainer.scrollWidth - tickerContainer.offsetWidth : 0;
            document.getElementById(WT.options.container + "_BODY").innerHTML = WT.options.content;
            tickerContainer.style.display = "block";
            WT.ticker_tick();
        }
    },
    ticker_tick: function() {
        var tickerContainer = document.getElementById(WT.options.container);
        if (!WT.options.paused) tickerContainer.scrollLeft += WT.options.speed * (WT.options.righttoleft ? -1 : 1);
        if (WT.options.righttoleft && tickerContainer.scrollLeft <= 0) tickerContainer.scrollLeft = tickerContainer.scrollWidth - tickerContainer.offsetWidth;
        if (!WT.options.righttoleft && tickerContainer.scrollLeft >= tickerContainer.scrollWidth - tickerContainer.offsetWidth) tickerContainer.scrollLeft = 0;
        window.setTimeout("WT.ticker_tick()", 30);
    }
}
