canscroll=false;
scrolltimer=0;
scroll_up=scroll_left=1;
scroll_down=scroll_right=0;
divArray = new Array;
function ScrollDiv(binnen, bottomhash, resthoogte){
  if (!resthoogte) resthoogte=200;
  dummy = new MakeScrollDiv(binnen, bottomhash, resthoogte);
}

function ShowDiv(divnaam){
  dummy = new MakeShowDiv(divnaam);
}

function MakeShowDiv(divnaam){
   var thisnr = divArray.length;
   nestedarray = divnaam.split(",");
   binnen=nestedarray[nestedarray.length -1];
   eval('div'+binnen+'='+thisnr);
      this.showme=binnen+'.style.visibility';
   divArray[thisnr] = this;
}

function MakeScrollDiv(divnaam, bottomhash, resthoogte){
   nestedarray = divnaam.split(",");
   var thisnr = divArray.length;
   binnen=nestedarray[nestedarray.length -1];
   eval('div'+binnen+'='+thisnr);
      this.divpad=binnen;
      this.showme=this.divpad+'.style.visibility';
// 	 alert("bottomhash :" +bottomhash)
      this.scrolllimit=eval(bottomhash+'.offsetTop');
 //	 alert("bottomhash :" +document.all.bottomhashz.offsetTop)
 	// alert("bottomhash :" +bottomhashz.offsetTop)
   this.top = Math.abs(remembertop); // con esta variable, regresa al punto donde estaba al salir de la pagina. En ATTACCA
//   this.top = 0; //Esta es la variable normal
	 //alert(this.top);
   this.scrolllimit = this.scrolllimit - resthoogte;
   divArray[thisnr] = this;
}

function ScrollMe(updown,speed,constant, divnaam){
   if(scrolltimer) clearTimeout(scrolltimer);
   if (!canscroll) {
      return;
   }  
   if (!divnaam) {
      divnaam = 'div'+currentselect;
  }
   if (!constant) constant=1;
   var divnr = eval('div'+divnaam);
   var thistop = divArray[divnr].top;
	 //alert(thistop);
   var thislimit = divArray[divnr].scrolllimit;
   if(updown && thistop < thislimit - speed) {
 //   	alert("canscroll :"+canscroll);
    divArray[divnr].top = thistop + speed;
   } else if(!updown && thistop > speed) {
      divArray[divnr].top = thistop - speed;
   } else if(speed >= 2){
      speed = speed/2;
   }
   if (divArray[divnr].top < 1){
      divArray[divnr].top = 0;
      canscroll =false;
  }
      eval(divnaam+'.style.top=-'+divArray[divnr].top);
			//alert(div1.style.top);
   if(canscroll) {
      hulp = 'ScrollMe('+updown+','+constant*speed+','+constant+',"'+divnaam+'")';
 //    hulp = 'ScrollMe('+updown+','+speed+','+constant+',"'+divnaam+'")';
	//alert("hulp: "+hulp);
      scrolltimer=setTimeout(hulp,15);
   }
}  

function SpringNaar(richting, divnaam){
   if(scrolltimer) clearTimeout(scrolltimer);
   if (!divnaam) {
      divnaam = 'div'+currentselect;
   }
   var divnr = eval('div'+divnaam);
   newtop = (richting == 'beneden')?-divArray[divnr].scrolllimit:0;
   divArray[divnr].top = newtop;
   if (n) {
      eval(divArray[divnr].divpad+'.moveTo(0,'+newtop+')');
   } else {
      eval(divnaam+'.style.top='+newtop);
   }
}  

function hide_textdiv(divnaam){
   show_hide('="hidden"',divnaam)
}
function show_textdiv(divnaam){
   show_hide('="visible"',divnaam)
}

function show_hide(showhide, divnaam, titel){
   if (!divnaam) divnaam='div'+currentselect;
   if (titel) divnaam += '_titel';
   hulp = eval('div'+divnaam);
   eval(divArray[hulp].showme+showhide);
}



