function ResultsBoxScroller(mainbox,max_speed) {
    var _animator;
    var _dest_offset = 0;
    var _mainbox;
    var _max_step = (max_speed != undefined) ? max_speed : 30;
    var _accel = 0.2;
    var _last_dist = 0;
    var _last_offset = 0;


    function _animator_callback() {
        if (_animator == undefined) {
            clearInterval(_animator);
            return;
        }
        if (_mainbox) {
            var curr_offset = _mainbox.scrollTop;
            if (((curr_offset>(_dest_offset-0.5)) &&
                 (curr_offset<(_dest_offset+0.5))) ||
                ((_last_offset !=0) && (curr_offset != _last_offset))) {
                clearInterval(_animator);
                _animator = undefined;
            }
            else {
                var dist = Math.max(1,Math.min(Math.abs(curr_offset-_dest_offset)*_accel,Math.min(1+_last_dist*(1+_accel),_max_step)));
                if (isNaN(dist)) {
                    clearInterval(_animator);
                    _animator = undefined;
                }
                var _direction = curr_offset<_dest_offset ? 1 : -1;
                var oldScrollTop = _mainbox.scrollTop;
                _mainbox.scrollTop = curr_offset+dist*_direction;
                if (oldScrollTop == _mainbox.scrollTop) {
                    clearInterval(_animator);
                    _animator = undefined;                
                }
                _last_dist = dist;
                _last_offset = _mainbox.scrollTop;
            }
        }
        else {
            clearInterval(_animator);
            _animator = undefined;
        }

    }

    function makeVisibleYPart(yoffset,height) {
        var topbox = $(mainbox);
        _mainbox = topbox;
        _last_offset = 0;
        
            if ((yoffset)<(topbox.scrollTop)) {
                _dest_offset = yoffset;
            } 
            else if ((yoffset+height)>((topbox.scrollTop)+topbox.offsetHeight)) {
                _dest_offset = yoffset-topbox.offsetHeight+height;
            }
        
        if (_animator != undefined) {
            clearInterval(_animator);
        }
        _animator = setInterval(_animator_callback,40);
    }

    this.makeVisibleYPart = makeVisibleYPart;
}