var aLogo = new Array();
var nLogo = 15;

function rand( nMin, nMax )
{
	return Math.round( nMin + ( Math.random() * ( nMax - nMin ) ) );
}

function Rotator( oLogo, nIndex )
{
		this._logo = oLogo;

		this._timer   = null;
		this._speed   = ( Math.PI / 45 );
		this._size    = rand( 25, 100 );
		this._cycle   = Math.round( ( 2 * Math.PI ) / ( Math.random() * 100 ) ) * this._speed;
		this._centerX = Math.round( ( -150 + ( Math.random() * 300 ) ) );
		this._centerY = -300 + rand( -100, 100 );
		this._radiusX = Math.round( Math.random() * ( document.body.clientWidth || window.innerWidth ) );
		this._radiusY = Math.round( Math.random() * 50 );
		this._modX    = 1 + ( Math.random() * -2 );
		this._modY    = 1 + ( Math.random() * 2 );

		this._logo.style.width  = this._size + "px";
		this._logo.style.height = this._size + "px";

		// Return the proper reference to the rotator
		this._self = "rotator" + nIndex + "object";
		eval( this._self + "=this" );
		return this;				
}
Rotator.prototype.step = function()
{
	clearTimeout( this._timer );
	this._logo.style.left = ( this._centerX + ( Math.tan( this._cycle * this._modX ) * ( this._radiusX ) ) ) + "px";
	this._logo.style.top  = ( this._centerY + ( Math.sin( this._cycle * this._modY ) * ( this._radiusY ) ) ) + "px";
	this._cycle          += this._speed;
	this._timer           = setTimeout( this._self + ".step();", 50 );
}

window.onload = function()
{
	if ( document.getElementById )
	{
		var oContainer = document.getElementById( "animate" );
		var oLogo      = oContainer.firstChild;
		while ( oLogo.nodeType != 1 && oLogo.className != "logo" && oLogo.nextSibling )
			oLogo = oLogo.nextSibling;
		
		if ( oLogo.nodeType != 1 || oLogo.className != "logo" )
			return false;

		for ( var i = 0; i < nLogo; ++i )
		{
			if ( i > 0 )
			{
				oLogo = oLogo.cloneNode( true );
				oContainer.appendChild( oLogo );
			}
			var nIndex      = aLogo.length;
			aLogo[ nIndex ] = new Rotator( oLogo, nIndex );
			aLogo[ nIndex ].step();
		}
	}
}

function flashreceiver( oData )
{
	eval( oData.data );
}