var timer;
var position = 1;

function scroll_up() {
  position -= 1;
  text_object = document.getElementById("thetext");
  if (position < 0 - text_object.offsetHeight + 100) 
    {clearInterval(timer); // stop moving
      text_object.style.top = position + "px";}
  else
    {text_object.style.top = position + "px";}
}

function scroll_down() {
  position += 1;
  text_object = document.getElementById("thetext");
  if (position > 0 + (text_object.offsetHeight - (text_object.offsetHeight - 1)))
    {clearInterval(timer); // stop moving
      text_object.style.top = position + "px";}
  else
    {text_object.style.top = position + "px";}
}

function doUp() {
  timer = setInterval("scroll_up()", 10);
}

function doDn() {
  timer = setInterval("scroll_down()", 10);
}

