//Slider V1.2
//7th April 2003
//karl@core10.co.uk

var steps=25;
var ismoving=0;
var slideString='';

function slideObjectInit(x,y,tempsteps,instr,easing){
	slideString+=this.obj+".slidingObject();";
	this.endx=x=(x!=null ? x :this.x);
	this.endy=y=(y!=null ? y :this.y);
	this.steps=tempsteps||this.steps||steps;
	this.frame=0;
	this.instr=instr;
	this.stepx=(x-this.x)/this.steps;
	this.stepy=(y-this.y)/this.steps;
	this.moveX=new Array(this.x,0);
	this.moveY=new Array(this.y,0);
	this.easing=easing?easing:0;
	for(var i=1;i<this.steps;i++){
		var addon=Math.cos(Math.PI*2*i/this.steps)*this.easing;
		this.moveX[i]=this.moveX[i-1]+this.stepx-this.stepx*addon;
		this.moveY[i]=this.moveY[i-1]+this.stepy-this.stepy*addon;
	}
	ismoving++;
	if (ismoving==1)setTimeout("slideMove()",40);
}

function slidingObject(){
	if (++this.frame<this.steps)this.moveTo(this.moveX[this.frame],this.moveY[this.frame]);
	else{
		this.moveTo(this.endx,this.endy);
		slideString=eval('slideString.replace(/'+this.obj+'\.slidingObject\\(\\)\\;/,"")');
		eval(this.instr);
		this.instr='';
		ismoving--;
	}
}

function slideMove(){
	eval(slideString);
	if (ismoving)setTimeout("slideMove()",40);
}

ProtoLayer.prototype.slideTo=slideObjectInit;
ProtoLayer.prototype.slidingObject=slidingObject;
ProtoLayer.prototype.easeTo=easeObjectInit;

function easeObjectInit(x,y,easing,tempsteps,instr){
	this.slideTo(x,y,tempsteps,instr,easing);
}