/**********************************************
// 
acDiv_sv.js - la bRoCha mEcAnIca x/01/01
NOTAS: modulo para prototipar un scroll virtual en el objeto acDiv
//
Autor: azulcore knowledge (jcv)
Comentarios: azulcore@mixmail.com
************************************************/

acDiv.prototype.createSV=function(id,w,h,imgA,imgB,res,ms,falsa_x,falsa_y,falsa_w,falsa_h,falsa_imgH){
	this.id=id;
	this.imgA=imgA;
	this.imgB=imgB;
	this.res=res;
	this.ms=ms;
	this.height=h;
	this.width=w;
	this.posx=this.getLeft();
	this.posy=this.getTop();
	this.d=0;
	this.z=0;
	this.k=0;
	var pfalsa_imgH = falsa_imgH || 20;
	var scrolstr = '<table border=0 cellspacing=0 cellpadding=0 width=11><tr><td><a href=# onmouseover='+this.id+'.moveScDn() onmouseout='+this.id+'.stopMove()>'+this.imgA+'</a></td></tr><tr><td><img src=img/sp.gif width=1 height='+pfalsa_imgH+'></td></tr><tr><td><a href=# onmouseover='+this.id+'.moveScUp() onmouseout='+this.id+'.stopMove()>'+this.imgB+'</a></td></tr></table>';
	this.falsa=new acDiv('falsa',falsa_x,falsa_y,2000,falsa_w,falsa_h,"visible",null,scrolstr);
	this.calculaH();
	this.reanimate();
}
acDiv.prototype.writeStringSV=function wDivTD(contenido){
	this.reanimate();
	if(this.ie4){
		this.name.innerHTML = contenido;
		this.delay();
	} else {
		this.name.document.open();
		this.name.document.write(contenido);
		this.name.document.close();	
		this.calculaH();
	}
}
acDiv.prototype.delay=function(){
	if(this.d<50){
		this.d +=10;
		this.tiempo2=setTimeout(this.id+'.delay()',10);
	}else{
		this.calculaH();
		clearTimeout(this.tiempo2);
		this.d=0;
	}
}
acDiv.prototype.calculaH=function(){(this.getHeight()>this.height) ? this.falsa.show() : this.falsa.hide();}
acDiv.prototype.moveScDn=function(){

	if(this.getTop()<this.posy){
		this.z -=this.res;
		this.k = this.z + this.height;
		this.setTop(this.getTop()+this.res);
		if(this.ie4){
			this.nST.clip= "rect("+this.z+"px,"+this.width+"px,"+this.k+"px, 0px)";
		}else{
			this.nST.clip.top = this.z;
			this.nST.clip.bottom = this.k;
		}	
		this.tiempo = setTimeout(this.id+'.moveScDn()',this.ms)
	}else{
		if(this.tiempo)
			this.stopMove();
	}
}

acDiv.prototype.moveScUp=function(){
	var aux = this.getHeight() - this.height;
	this.maxScUp = this.posy - aux;
	if(this.getTop() > this.maxScUp){
		this.z +=this.res;
		this.k = this.z + this.height;
		this.setTop(this.getTop()-this.res);
		if(this.ie4){
			this.nST.clip= "rect("+this.z+"px,"+this.width+"px,"+this.k+"px, 0px)";
		}else{
			this.nST.clip.top = this.z;
			this.nST.clip.bottom = this.k;
		}	
		this.tiempo = setTimeout(this.id+'.moveScUp()',this.ms)
	}else{
		if(this.tiempo)
			this.stopMove();
	}
}
acDiv.prototype.stopMove=function(){clearTimeout(this.tiempo);}
acDiv.prototype.reanimate=function(){
	this.nST.top=this.posy;
	(this.ie4) ? this.nST.clip = "rect(0px,"+this.width+"px,"+this.height+"px,0px)" : this.name.clip.bottom = this.height;
}
