﻿var scrollingNewsDiv = null;
var scrollHeight = 0;
var scrollEnabled = true;
function scrollNews()
{
    if (scrollEnabled)
    {
        var currentTop = parseInt(scrollingNewsDiv.style.top ? scrollingNewsDiv.style.top : 0);
        var newTop = (-currentTop == scrollingNewsDiv.clientHeight) ? scrollHeight : currentTop-1;

        scrollingNewsDiv.style.top = newTop + "px";
        scrollingNewsDiv.style.clip = "rect(" + (-currentTop) + "px auto " + (-currentTop + scrollHeight) + "px auto)";
    }
    setTimeout(scrollNews,100);
}

if (document.getElementById)
{
    var maxScrollHeight = document.getElementById("NewsContainer").clientHeight - 2;
    scrollingNewsDiv = document.getElementById("ScrollingNews");
    scrollHeight = scrollingNewsDiv.clientHeight>maxScrollHeight ? maxScrollHeight : scrollingNewsDiv.clientHeight;
    scrollNews();
}


