var bottles = new Array(	
	'patTemplate',
	'patSysinfo',
	'patConfiguration',
	'patSpiderizer'
);
var bottleSrcs	=	new Array();
var rotateTime	=	3500;
var bottlePath	=	'img/bottles';
var idxmax		=	bottles.length;
var idx			=	0;
var footEl;
var bottleEl;
var bottleImgEl;

function rotateBottles()
{
	preloadBottles();

	footEl		=	getElement( 'footnote' );
	bottleEl	=	getElement( 'bottle' );
	bottleImgEl	=	getElement( 'bottleImg' );
	
	moveElementTo( bottleEl, getElementX( footEl )+getElementWidth( footEl )-11, getElementY( footEl )-200 );
	showElement( bottleEl );
	
	doRotate();
}

function preloadBottles()
{
	for( var i=0; i < idxmax; i++ )
	{
		bottleSrcs[i] = new Image();
		bottleSrcs[i].src = getBottleImage( i );
	}
}

function doRotate()
{
	bottleImgEl.src = bottleSrcs[idx].src;
	
	idx++;
	if( idx >= idxmax )
		idx = 0;
	
	setTimeout( 'doRotate()', rotateTime );
}

function getBottleImage( idx )
{
	var bottle = bottles[idx];
	return bottlePath + '/' + bottle + '.png';
}
