// Counter
var nTop = 0;
 
// Start and Stop
var bRun;
 
// Scroll up
function goUp()
{
  // If nTop < 0 scroll
  if(nTop < 0)
  {
    var objDiv =document.getElementById("scroll0Content"); 
    nTop=nTop+5;
    objDiv.style.top=nTop+'px';
        
        // Dont stop scrolling, if the mouse is over the scrollbutton
    if (bRun) 
		  setTimeout("goUp();", 30);
   }
}
 
// Scroll down
function goDown()
{
  // Height of div
  var nHeight = '-'+window.document.getElementById("scroll0Content").clientHeight;
  
    // If nTop >= height scroll
    if(nTop >= parseInt(nHeight)+420)
  {
    var objDiv =document.getElementById("scroll0Content");
      nTop=nTop-5;
    objDiv.style.top=nTop+'px';
        // Dont stop scrolling, if the mouse is over the scrollbutton
        if (bRun)
         setTimeout("goDown();", 30);
  }
}
 
// Scroll to top
function goTop()
{
  // Jump to top
  document.getElementById("scroll0Content").style.top = '0px';
 
  // Set counter to 0 (begin)
    nTop = 0;
}

// Buttons
function createButtons(id){
  var root='root'+id;
  var container='scroll'+id+'Container';
  var content='scroll'+id+'Content';
  var buttons = '<div id="scrollers"><p><a href="#" onClick="bRun=true;goUp();" onMouseOut="bRun=false"><img src="img/up.gif" width="15" height="15" alt="" border="0"></a></p><p><a href="#" onClick="bRun=true;goDown();" onMouseOut="bRun=false"><img src="img/dn.gif" width="15" height="15" alt="" border="0"></a></p></div>';
  if (document.getElementById(content) && document.getElementById(content).clientHeight>document.getElementById(container).clientHeight){
    document.getElementById(root).innerHTML = buttons + document.getElementById(root).innerHTML;
    //document.getElementById(container).style.overflow = 'hidden';
  }
}
