Function.prototype.bind = function(object) {
	var __method = this;
	return function() {
		return __method.apply(object, arguments);
	}
}
function frameMotion(id) {
	this.frameId=null;
	this.oSectionFrame=null;
	this.iFrameLength=null;
	this.iNowFrame=0;
	this.iFrameValue=0;
	this.oTid=null;
	this._x=0;
	this.sState=null;
	this.iSpeed=0.09;

	this.initialized=function(id) 
	{
		this.frameId=document.getElementById(id);
	}
	this.doMove=function(state) 
	{
		this.sState=state;
		if(state=="next") {this._nextFrame();}
		else if(state=="prev") {this._prevFrame();}
	}
	this.setFrame=function(obj) 
	{
		this.oSectionFrame=obj;
		this.iFrameLength=obj.length-1;
	}

	this._nextFrame=function() 
	{
		if(this.iFrameLength-1>this.iNowFrame) {
			this.iNowFrame++;
			this.iFrameValue=this.oSectionFrame[this.iNowFrame];
			this._actionApply();
		}
	}
	this._prevFrame=function() 
	{
		if(this.iNowFrame!=0) {
			this.iNowFrame--;
			this.iFrameValue=this.oSectionFrame[this.iNowFrame];
			this._actionApply();
		}
	}
	this._actionApply=function()
	{
		if(!this.oTid) {
			this._actionFrame();
			this.oTid=setInterval(this._actionFrame.bind(this),13);
		}
	}
	this._actionFrame=function() {
		if(this.sState=="next") this.itmp=-1; else this.itmp=0; 
		this._x +=this.iSpeed*((parseInt(this.iFrameValue)+this.itmp)-this._x);
		this.frameId.style.left=this._x+"px";
		if(this._x<=parseInt(this.iFrameValue) && this.sState=="next") {
			this.frameId.style.left=this.iFrameValue;
			clearInterval(this.oTid);
			this.oTid=null;
		}
		if(parseInt(this._x)>=parseInt(this.iFrameValue) && this.sState=="prev") {
			this.frameId.style.left=this.iFrameValue;
			clearInterval(this.oTid);
			this.oTid=null;
		}
	}
	this.initialized(id);
}