	function MotionTween( OBJ, FROM, TO, DURATION, FUNC ) {
		this.duration	= DURATION;
		this.from		= FROM;
		this.obj		= OBJ;
		this.to			= TO;
		this.path		= TO - FROM;

		if( typeof this[FUNC] == 'function' )
			this.onStateChange	= this[FUNC];
	}

	function getFunc( obj, func ) {
		var args	= new Array();

		for( var i = 2; i < arguments.length; i++ )
			args[ i - 2 ] = arguments[i];

		return function() { func.apply( obj, args ); }
	}

	MotionTween.prototype.nextFrame	= function() {
		if( this.getCTime() < this.endTime )
			this.timer = window.setTimeout( getFunc( this, this.onStateChange ), 0 );
		else if( this.hasOwnProperty( 'onMotionFinished' ) ) {
			if( this.delayOnFinish )
				this.timer = window.setTimeout( this.onMotionFinished, this.delayOnFinish );
			else
				this.onMotionFinished();
		}
	}

	MotionTween.prototype.getCTime	= function() {
		if( new Date().getTime() <= this.endTime )
			return new Date().getTime();
		else
			return this.endTime;
	}

	MotionTween.prototype.getPercentage	= function() {
		return Math.ceil(( this.getCTime() - this.startTime )  / this.durPer);
	}

	MotionTween.prototype.start	= function() {
		this.startTime	= new Date().getTime();
		this.endTime	= this.startTime + this.duration * 1000;
		this.durPer		= this.duration * 10;

		this.nextFrame();
	}

	MotionTween.prototype.stop		= function() {
		this.endTime = this.getCTime;
	}

	MotionTween.prototype.opacity	= function() {
		this.obj.style.opacity = ( this.from + this.getPercentage() * this.path / 100 ) / 100;
		this.obj.style.filter = "alpha(opacity=" + ( this.from + this.getPercentage() * this.path / 100 ) + ")";
		this.nextFrame();
	}

