//Animate Resizing V1.1
//7th April March 2003
//karl@core10.co.uk

var steps=25;
var isresizing=0;
var resizeString='';

function resizeObjectInit(w,h,tempsteps,instr,easing){
	resizeString+=this.obj+".resizeObject();";
	this.endw=w=(w!=null ? w :this.w);
	this.endh=h=(h!=null ? h :this.h);
	this.steps=tempsteps||this.steps||steps;
	this.frameR=0;
	this.instr=instr;
	this.stepw=(w-this.w)/this.steps;
	this.steph=(h-this.h)/this.steps;
	this.resizeW=new Array(this.w,0);
	this.resizeH=new Array(this.h,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.resizeW[i]=this.resizeW[i-1]+this.stepw-this.stepw*addon;
		this.resizeH[i]=this.resizeH[i-1]+this.steph-this.steph*addon;
	}	
	isresizing++;
	if (isresizing==1)setTimeout("resizeMove()",40);
}

function resizeObject(){
	if (++this.frameR<this.steps)this.resizeTo(this.resizeW[this.frameR],this.resizeH[this.frameR]);
	else{
		this.resizeTo(this.endw,this.endh);
		resizeString=eval('resizeString.replace(/'+this.obj+'\.resizeObject\\(\\)\\;/,"")');
		eval(this.instr);
		this.instr='';
		isresizing--;
	}
}

function resizeMove(){
	eval(resizeString);
	if (isresizing>0)setTimeout("resizeMove()",40);
}

function resizeEaseObjectInit(w,h,easing,tempsteps,instr){
	this.resizeAnim(w,h,tempsteps,instr,easing);
}

ProtoLayer.prototype.resizeAnim=resizeObjectInit;
ProtoLayer.prototype.resizeEase=resizeEaseObjectInit;
ProtoLayer.prototype.resizeObject=resizeObject;