﻿// JScript File

//scrolling article control js for ScrollingArticle.ascx


    //Specify speed of scroll. Larger=faster (ie: 5)
    var scrollspeed=cache=1;

    //Specify intial delay before scroller starts scrolling (in miliseconds):
    var initialdelay=500;

    function initializeScrollingArticle(scrollobj){
        //dataobj=document.all? document.all.datacontainer : document.getElementById("datacontainer")
        var dataobj=document.getElementById(scrollobj);
        dataobj.style.top="5px";
        setTimeout("getdataheight('"+scrollobj+"')", initialdelay);
    }

    function getdataheight(scrollobj){
        var dataobj=document.getElementById(scrollobj);
        var thelength=dataobj.offsetHeight;
        
        if (thelength==0)
        setTimeout("getdataheight('"+scrollobj+"')",10);
        else
        scrollDiv(scrollobj, thelength);
    }

    function scrollDiv(scrollobj, thelength){
        var dataobj=document.getElementById(scrollobj);
        dataobj.style.top=parseInt(dataobj.style.top)-scrollspeed+"px";
        
        if (parseInt(dataobj.style.top)<thelength*(-1))
        dataobj.style.top="5px";
        setTimeout("scrollDiv('"+scrollobj+"','"+thelength+"')",40);
    }
