Mousefollow constraints

I am having trouble on blocking two mouse following bars with different speeds not going past the borders of the black area of my new site.

The site unfinished intro beta:
The bars themselves are in:

The code connected to there movieclip is the following, considering maskerv is the vertical bar and maskerh is the horizontal bar, :
This code seems to work on ending the bars at the bottom and to the right but at the top and at the left the bars dissapear out of view, they hould end exactly in the corner and remain in view; both bars measure 40 on 4 pixels.

onClipEvent (load) {
maskerv._y = 0;
maskerh._x = 40;
maskerv.speed = 5;
maskerh.speed = 5;
onClipEvent (enterFrame) {
maskerv.endY = _root._ymouse;
maskerh.endX = _root._xmouse;
maskerv._x += 0;
maskerv._y += (maskerv.endY-maskerv._y-60)/maskerv.speed;
maskerh._x += (maskerh.endX-maskerh._x-40)/maskerh.speed;
maskerh._y += 0;

Can anyone help me with this coding ?