Trouble using a function

Hello again. Well, I decided to put my jumping code into a function instead of a onClipEvent handler, but something is wrong. When I press the space bar(jumping key), he keeps on moving up until I release the key. Here is the code:


_root.onEnterFrame = function() {
 jumping();
 vel_y = 0;
 jump = false;
};
function jumping() {
 if (Key.isDown(Key.LEFT)) {
  hero._x -= 5;
 }
 if (Key.isDown(Key.RIGHT)) {
  hero._x += 5;
 }
 if (Key.isDown(Key.SPACE) && !jump) {
  vel_y = 10;
  jump = true;
 }
 if (jump == true) {
  vel_y -= 1;
  if (vel_y<=-10) {
   vel_y = -10;
  }
  hero._y -= vel_y;
 }
 if (_root.ground.hitTest(hero._x, hero._y+15, true)) {
  vel_y = 0;
  jump = false;
 }
 if (!_root.ground.hitTest(hero._x, hero._y+15, true) && !jump) {
  fall += 1;
  if (fall>10) {
   fall = 10;
  }
  hero._y += fall;
 }
}

If anyone could please help me, I would be very grateful. Thanks in advance!

peace