var destinationY = 0;
var currentY=0;
// 1 is too slow, 5 is too fast... ??
var speed=5;


function divOnScroll(){
    // set the currentY to the whatever!
    // maintains the position when the user scrolls...
    var div=document.getElementById("EventsListBox");
    currentY=div.scrollTop;
}


function getY(obj){
    var posY = obj.offsetTop;
    while(obj.offsetParent){
        posY=posY+obj.offsetParent.offsetTop;
        if(obj==document.getElementsByTagName('body')[0])
            {break}
        else{
            obj=obj.offsetParent;
        }
    }
return posY;
}

function scrollDivUp(div){
    while(currentY>destinationY){
        if(destinationY>currentY-speed){
            currentY=destinationY;
        }
        else{
            currentY=currentY-speed;
        }
        div.scrollTop=currentY;
    }
}

function scrollDivDown(div){
    while(currentY<destinationY){
        if(destinationY<currentY-speed){
            currentY=destinationY;
        }
        else{
            currentY=currentY+speed;
        }
        div.scrollTop=currentY;
    }
}

function scrollDivTo() 
{
    var divElement=document.getElementById("EventsListBox");
    if(divElement){
        if(currentY<destinationY){
            scrollDivDown(divElement);
        }
        else if(currentY>destinationY){
            scrollDivUp(divElement);
        }
    }
}
