function joinkFX2(o, p, d){
	this.clock = null;
	this.active = false;
	this.c = 0;
	this.z = false;
	if (typeof(o) == 'object'){
		this.o = o;
	}else{
		if (document.getElementById(o)){
			this.o = document.getElementById(o);
		}
	}
	
	if (p){
		if (p.animation){
			this.a = this[p.animation];
		}else{
			this.a = this.noEase;
		}
		
		if (p.time){
			this.t = parseInt(p.time);
		}else{
			this.t = 30;
		}
		
		if (p.style){
			this.s = p.style.split(',');
		}
		
		if (p.start){
			this.x = p.start.split(',');
			this.z = this.x;
		}
		
		if (p.distance){
			this.y = p.distance.split(',');
		}
		
		if (p.bi){
			this.b = p.bi;
		}else{
			this.b = false;
		}
		
		if (p.func){
			this.f = p.func;
		}else{
			this.f = null;
		}
	}
						
						
}

joinkFX2.prototype={

	setStart:function(d){
		this.x = d.split(',');
		this.z = this.x;
	},

	setDistance:function(d){
		this.y = d.split(',');		
	}
	
	,

	setFunction:function(f){
		this.f = f;
	}

	,
	

	onFinish:function(f){
		this.f = f;	
	}
	
	,
			
	setAnimation:function(a){
		this.a = this[a];
	}
	
	,
	
	move:function(){
		if (!this.active){
			this.active = true;
			this.animate();
		}else{
			window.clearTimeout(this.clock);
			this.animate();
		}
	}
	
	,
	
	animate:function(){
	   if (this.c <= this.t){
	      var newPos = 0;
		  for (var i = 0; i < this.x.length;i++){
		     newPos = this.a(this.c, parseInt(this.x[i]), parseInt(this.y[i]), this.t);
			 this.o.style[this.s[i]] = Math.ceil(newPos) + 'px';
		  }
		  this.c++;
		  this.clock = window.setTimeout(bind(this, this.animate), 15);
	   }else{
	   	  if (this.f){
		  	this.f.call();
		  }
		  if (this.b){
		  	for (var i = 0;i<this.x.length;i++){
				this.x[i] = parseInt(this.x[i]) + parseInt(this.y[i]);
				this.y[i] = 0 - parseInt(this.y[i]);
			}
		  }
	   	  this.c = 0;
		  this.active = false;
	   }
	}
	
	,
	
	bounceSmall:function(t, b, c, d){
	   var ts=(t/=d)*t;
	   var tc=ts*t;
	   return b+c*(36.4925*tc*ts + -106.88*ts*ts + 116.48*tc + -57.79*ts + 12.6975*t);		
	}
	
	,
	
	bounceBig:function(t, b, c, d){
	   var ts=(t/=d)*t;
	   var tc=ts*t;
	   return b+c*(78.1425*tc*ts + -216.88*ts*ts + 217.88*tc + -94.69*ts + 16.5475*t);	
	}
	
    ,
    
    noEase:function(t, b, c, d){
	   t/=d;
	   return b+c*(t);
    }
    
    ,
    
    backInCubic:function(t, b, c, d){
	   var ts = (t/=d)*t;
	   var tc = ts*t;
	   return b+c*(4*tc + -3*ts);		
    }

    ,
    
    outElasticSmall:function(t, b, c, d){
	   var ts =(t/=d)*t;
	   var tc =ts*t;
	   return b+c*(33*tc*ts + -106*ts*ts + 126*tc + -67*ts + 15*t);
    }
    
    ,
    
    outElasticBig:function(t, b, c, d){
	   var ts = (t/=d)*t;
	   var tc = ts*t;
	   return b+c*(56*tc*ts + -175*ts*ts + 200*tc + -100*ts + 20*t);		
    }

    ,

    inQuintic:function(t, b, c, d){
	   var ts = (t/=d)*t;
	   var tc = ts*t;
	   return b+c*(tc*ts);		
    }
    
    ,

    outQuintic:function(t, b, c, d){
	   var ts = (t/=d)*t;
	   var tc = ts*t;
	   return b+c*(tc*ts + -5*ts*ts + 10*tc + -10*ts + 5*t);		
    }
    
    ,

    outCubic:function(t, b, c, d){
	   var ts = (t/=d)*t;
	   var tc = ts*t;
	   return b+c*(tc + -3*ts + 3*t);		
    }

}

function bind(el, func){
    return function() { func.call(el); }
}