function scroll_box(div_name){
  var tname='scroll_box_'+div_name;
  this.div_name = div_name;
  this.name = tname
  this.time_interval = 60;
  this.timeoutID = 0;
  this.top = 0;

  this.div_obj = document.getElementById(this.div_name);
  this.div_obj.style.overflow = 'hidden';
  var content = this.div_obj.innerHTML;
  
  var subdiv1 = document.createElement('div');
  
  subdiv1.style.position = 'absolute';
  subdiv1.style.top = '0px';
  subdiv1.innerHTML = content;
  subdiv1.style.visibility='hidden';
  this.div_obj.appendChild(subdiv1);

  //if (subdiv1.offsetHeight<=this.div_obj.offsetHeight) return;
  this.div_obj.removeChild(subdiv1);

  var sdstyle="position:relative;top:0;left:0;border: 0px ; padding-top:0;padding-bottom:0;padding-left:0;padding-right:0;margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;";
  var str="";
  str+= "<div id='"+div_name+"_sub_1' style='"+sdstyle+"' >"+content+"</div>";
  str+= "<div id='"+div_name+"_sub_2' style='"+sdstyle+"' >"+content+"</div>";
  
  this.div_obj.innerHTML = str;
  str="";
  content="";
  
  this.subdiv1=document.getElementById(div_name+'_sub_1');
  this.subdiv2=document.getElementById(div_name+'_sub_2');
  
  this.realheight = this.subdiv1.offsetHeight;
  
  this.div_obj.onmouseover = function() { eval(tname + ".stopScroll();") };
  this.div_obj.onmouseout = function() { eval(tname + ".startScroll();") };
  
  

  this.startScroll = function() {
    this.timeoutID = setTimeout(this.name + ".scrollUp()", this.time_interval);
  }

  this.stopScroll = function() {
    clearTimeout(this.timeoutID);
  }


  this.scrollUp = function() {
    if (this.div_obj) {
      this.top = this.top-1;
      if (this.top<=-this.realheight){
        this.top=0;
      }
      this.subdiv1.style.top=this.top+'px';
      this.subdiv2.style.top=this.top+'px';
      this.timeoutID = setTimeout(this.name + ".scrollUp()", this.time_interval);
    }
  }

  this.scrollDown = function() {
  }
  
  this.startScroll();
}

function init_scroll_boxes(){
  var objs;
  var okobjs=new Array();
  var nr=0;
  objs=document.getElementsByTagName('div');
  for (var i=0;i<objs.length;i++){
    if (objs[i].className=='scroll_box'){
      okobjs[nr++]=objs[i];
    }
  }
  for (var i=0;i<okobjs.length;i++){
    eval("scroll_box_"+okobjs[i].id+" = new scroll_box('"+okobjs[i].id+"');");
  }
}


