/*Look&Enter 2001 Scroll Virtual Básico*/
//comprueba si es NT
var cadNav = navigator.appVersion;
	cadNav.toString();
var NT = false;
	if(cadNav.indexOf('NT')>-1) NT = true;

function Virtualscroll(id,padre,x,y,width,height,topImg,abjImg,velocidad,resolucion,mS,mL,anF,alF){
  this.id = id;
  this.height = height;
  this.vel = (creator.ns4)?velocidad-2:velocidad;
  if(NT)this.vel += 25;
  this.res = resolucion;
  this.scrollPanel =  creator(id,padre,x,y,"show",width,height,9);
  this.mainDiv = creator(id+"mD",this.scrollPanel,mS,mL,"show",width,height,0);
  this.conteDiv = creator(id+"cD",this.mainDiv,0,0,"show",100,null,0);
  this.timeScroll = 0;
  eval("self."+this.id+"=this");
  this.first = true;
}

Virtualscroll.prototype.relizaMovScroll = function(move,direccion){
	if(this.first){
	 do{ 
	 	var c = this.conteDiv.getDocHeight();
	 	this.altoDoc = c;
	 }while(this.altoDoc != c);
	 this.first=false
	 }
	if(((move > parseInt(this.height-this.altoDoc))&&direccion==1)||(move<0&&direccion==0)){ 
	this.conteDiv.move(this.conteDiv.x,move);
	this.timeScroll = setTimeout(this.id+".goMoveToScroll("+direccion+")",this.vel);
    }
}

Virtualscroll.prototype.stop = function(){
 clearTimeout(this.timeScroll);
}

Virtualscroll.prototype.goMoveToScroll = function(direccion){
  var move = (direccion == 0) ? this.conteDiv.y + this.res : this.conteDiv.y - this.res;
  this.relizaMovScroll(move,direccion);
}

Virtualscroll.prototype.refreshCont = function(nuevoContenido){
   this.conteDiv.fill(nuevoContenido);
   this.first=true;
   if(!creator.ns6){this.refreshaltoDoc();this.first=false}
   this.conteDiv.move(this.conteDiv.x,0);
}


Virtualscroll.prototype.refreshaltoDoc = function(){
	this.conteDiv.resize(this.scrollPanel.w,null);
	this.altoDoc = this.conteDiv.getDocHeight();
    if(!creator.ns6)this.conteDiv.resize(this.scrollPanel.w,this.altoDoc);
    else this.first = true;
	   return false;
}

