    var timer;
    var amount = 0;
    var pos = 0;
    var dir = 0;
  
    function scrolldown()
    {
      amount = -10;
      dir = 0;
      timer = setTimeout(scroll, 100);
    }
    
    function scrollup()
    {
      amount = 10;
      dir = 1;
      timer = setTimeout(scroll, 100);
    }    

    function scroll()
    {
      var text = document.getElementById('text');
      var h = text.offsetHeight;
      if (dir == 0 && pos > (0 - (h - 360)) || dir == 1 && pos < 0)
      {
        pos = pos + amount;
        text.style.top = pos + "px";
        
        setVis("uparrow", "visible");
        setVis("downarrow", "visible");
        
        timer = setTimeout(scroll, 100); 
      }
      else
      {
        if (dir == 0)
          setVis("downarrow", "hidden");
        else
          setVis("uparrow", "hidden");
      }
    }
    
    function stopscroll()
    {
      if (timer) clearTimeout(timer);
    }
    
    function showMenu()
    {
      document.getElementById("menupanel").style.visibility = "visible";
      var text = document.getElementById('text');
      var h = text.offsetHeight;
      if (h > 360)
        setVis("downarrow", "visible");
    }
    
    function setVis(item, vis)
    {
      document.getElementById(item).style.visibility = vis;
    }