﻿var oContainer;
var oContent

var cScrollTimeout;

function ScrollDivUp( sContainer, sContent )
{
    oContainer = document.getElementById(sContainer);
    oContent = document.getElementById(sContent);                    
    
    cScrollTimeout = setTimeout("ScrollDn(30);", 50);    
}

function ScrollDivDn( sContainer, sContent )
{
    oContainer = document.getElementById(sContainer);
    oContent = document.getElementById(sContent);                    
    
    cScrollTimeout = setTimeout("ScrollUp(-30);", 50);
}

//this makes the scrolling smooth

function ScrollUp( iSpeed )
{    
    if( parseInt(oContent.style.top) > -1 * (parseInt(oContent.offsetHeight) - parseInt(oContainer.style.height)) )
    {
        oContent.style.top = (parseInt(oContent.style.top) + iSpeed) + "px";
        //window.status = oContent.style.top + " TOP UP";
        cScrollTimeout = setTimeout("ScrollUp(" + iSpeed + ");", 50);
    }
}

function ScrollDn( iSpeed )
{    
    if( parseInt(oContent.style.top) <  0)
    {
        oContent.style.top = (parseInt(oContent.style.top) + iSpeed) + "px";
        //window.status = oContent.style.top + " TOP DN";
        cScrollTimeout = setTimeout("ScrollDn(" + iSpeed + ");", 50);
    }
}

function StopScroll()
{
    clearTimeout(cScrollTimeout);
}

function CheckDisplayScroller( sContainer, sContent, sArrows )
{
    oContainer = document.getElementById(sContainer);
    oContent = document.getElementById(sContent); 
    var oArrows = document.getElementById(sArrows);                        
    
if (oContainer != null)
    if(parseInt(oContent.offsetHeight) > parseInt(oContainer.style.height))
        oArrows.style.visibility = 'visible';            
}