var PI_2 = Math.PI * 0.5;

if ( HTMLDivElement )
{
	HTMLDivElement.prototype.topStart = 0;
	HTMLDivElement.prototype.topEnd = 0;
	HTMLDivElement.prototype.topUnit = 'px';

	HTMLDivElement.prototype.leftStart = 0;
	HTMLDivElement.prototype.leftEnd = 0;
	HTMLDivElement.prototype.leftUnit = 'px';

	HTMLDivElement.prototype.opacityStart = 0.0;
	HTMLDivElement.prototype.opacityEnd = 1.0;

	HTMLDivElement.prototype.frameCount = 15;
	HTMLDivElement.prototype.frameCurrent = 0;

	HTMLDivElement.prototype.init = function( ostart, oend, tunit, lunit, tstart, lstart, tend, lend, fcount )
	{
		this.opacityStart = ostart;
		this.opacityEnd = oend;
		this.topUnit = tunit;
		this.leftUnit = lunit;
		this.topStart = tstart;
		this.leftStart = lstart;
		this.topEnd =  tend;
		this.leftEnd =  lend;
		this.frameCount = fcount;
		this.setFrame(0);
	};

	HTMLDivElement.prototype.setFrame = function( frame )
	{
		var fract = frame/this.frameCount;
		var pct = Math.sin( fract * PI_2 );
		this.style.left = Math.round(this.leftStart + ((this.leftEnd - this.leftStart) * pct)) + this.leftUnit;
		this.style.top = Math.round(this.topStart + ((this.topEnd - this.topStart) * pct)) + this.topUnit;
		this.style.opacity = this.opacityStart + ((this.opacityEnd - this.opacityStart) * fract);
		this.style.filter = 'alpha(opacity=' + Math.floor(this.opacityStart + ((this.opacityEnd - this.opacityStart) * fract) * 100) + ')';
	};
}