

scrollStep = 1;
scrollStepFast = 10;

timerUp="";
timerDown="";

function toTop(id){
  document.getElementById(id).scrollTop=0;
}

function scrollDivDown(id){
  clearTimeout(timerDown);
  document.getElementById(id).scrollTop+=scrollStep;
  timerDown=setTimeout("scrollDivDown('"+id+"')",10);
  //alert(scrollStep);
}

function scrollDivUp(id){
  clearTimeout(timerUp);
  document.getElementById(id).scrollTop-=scrollStep;
  timerUp=setTimeout("scrollDivUp('"+id+"')",10);
}

function toBottom(id){
  document.getElementById(id).scrollTop=document.getElementById(id).scrollWidth;
}

function stopMe(){
  clearTimeout(timerUp);
  clearTimeout(timerDown);
}









function scrollDivDownSmooth(id,by) {
    var next = by - 1;
    clearTimeout(timerDown);
    document.getElementById(id).scrollTop+=scrollStepFast;
    if (next > 0) timerDown=setTimeout("scrollDivDownSmooth('"+id+"',"+next+")",1);
}
function scrollDivDownHeight(id) {
    var tmp = window.innerHeight / scrollStepFast;
    scrollDivDownSmooth(id,tmp);
}


function scrollDivUpSmooth(id,by) {
    var next = by - 1;
    clearTimeout(timerUp);
    document.getElementById(id).scrollTop-=scrollStepFast;
    if (next > 0) timerUp=setTimeout("scrollDivUpSmooth('"+id+"',"+next+")",1);
}
function scrollDivUpHeight(id) {
    var tmp = window.innerHeight / scrollStepFast;
    scrollDivUpSmooth(id,tmp);
}
