Getting the ratio right

I’m trying to set up a dragger that moves a bugger movieclip up and down. As this will be for a template I’m thinking of using a ratio and thus save some time updating.

The code I’m using is

onClipEvent (load) {
_y = _root.box._y-_root.box._height/2+_height/2 ;
_x = _root.box._x ;
yold = _y ;
ratio = _root.content._height/_root.box._height ;
}
onClipEvent (enterFrame) {
if (dragging) {
if((_root._ymouse>_root.box._y-_root.box._height/2)and (_root._ymouse<_root.box._y+_root.box._height/2)) {
_y = _root._ymouse ;
dxdrag = _y - yold ;
yold = _y ;
_root.content._y -= ratio*dxdrag ;
}
}
}

Where “content” is the big movieclip and “box” is the boundery for the slider.
The problem I’m having is the “content” is moving up to high when the slider is at the end of the “box”. Is there a way to set a range within a mask for example.