var timeout;
var delay = 10;

function recScroll(elementId, direction, speed) {
  clearTimeout(timeout);
  var intElemScrollTop = window.document.getElementById(elementId).scrollTop;
  if (direction == 'down') {
    window.document.getElementById(elementId).scrollTop = intElemScrollTop + speed;
  } else {
    window.document.getElementById(elementId).scrollTop = intElemScrollTop - speed;
  }
  if (intElemScrollTop != window.document.getElementById(elementId).scrollTop ) {
    timeout=setTimeout("recScroll('"+elementId+"', '"+direction+"', "+speed+");",delay);
  } else {
    recScrollLimit(elementId,direction);
  }
}
function recScrollStop() {
  clearTimeout(timeout);
}
function recScrollLimit(elementId, direction) {
  //alert("You can't keep scrolling "+elementId+" "+direction+".");
}

