/**********************************************
acDiv_slide.js 20/05/04
Version: 1.0
Autor: Ricard Comin Broc
Comentarios: lordrick3dfx@hotmail.com
************************************************/
acDiv.prototype.res = 0;
acDiv.prototype.vel = 0;
acDiv.prototype.kine =0;
acDiv.prototype.posx = null;
acDiv.prototype.posy = null;
acDiv.prototype.indice = 0;
acDiv.prototype.active=false;
acDiv.prototype.sto = 0;
acDiv.prototype.slide = function(x,y,resolucion,velocidad,kine,xbezier,ybezier){
	//for(var z=0;z<arguments.length;z++) alert(arguments[z]);
	this.res = resolucion;
	this.vel = velocidad;
	this.kine = kine;
	this.posx = new Array();
	this.posy = new Array();
	var xbez; var ybez;
	(xbezier == null)? xbez = Math.abs(this.getLeft()) + ((x - Math.abs(this.getLeft()))/20) * (10 + this.kine) : xbez = xbezier;
	(ybezier == null)? ybez = Math.abs(this.getTop()) + ((y - Math.abs(this.getTop()))/20) * (10 + this.kine) : ybez = ybezier;
	for(i=0; i<=this.res; i++){
		var a = (1 - i / this.res);
		var b = (i / this.res);
		this.posx[i] = Math.pow(a,2) * Math.abs(this.getLeft()) + 2 * b * a * xbez  + Math.pow(b,2) * x;
		this.posy[i] = Math.pow(a,2) * Math.abs(this.getTop()) + 2 * b * a * ybez  + Math.pow(b,2) * y;}
	this.indice = 0;
	this.sliderun();
}
acDiv.prototype.sliderun = function (){
		this.active=true;
		if(this.indice < this.posx.length){
			this.setLeft(parseInt(this.posx[this.indice]));
			this.setTop(parseInt(this.posy[this.indice]));
			this.indice++;
			if(this.sto!=null) clearTimeout(this.sto);
			this.sto = setTimeout(this.nom+".sliderun()",this.vel);
		}else{
			clearTimeout(this.sto);	
			this.active=false;
		}
}
