var count = 0; 
var baseSpeed = 0.05; 
var radiusX = 200; 
var radiusY = 30; 
var centerX = 270; 
var centerY = 230;
var speed = 0.2;
var imageDivs = '';
var numberOfElements = 0;
var carousel = '';
var speedTest = '';


function onMouseMove( evt ) {
	
	tempX = evt.client.x;
	speed = (tempX - centerX) / 2500;
	
}

function startCarousel(){
	
	/* 
	jtb 080410: I pulled these constants out of the for() loop to improve 
	performance. This eliminates 5 mults and 1 div for each element.
	*/
	const1 = ( Math.PI * 2 ) / numberOfElements; 
	const2 = count * ( baseSpeed * speed );
	
	/*
	jtb 080410: Instead of multiplying to calculate the angle, just increment it
	*/
	angle = 0;
	for(i=0; i < numberOfElements; i++){
		imageDivsStyle = imageDivs[ i ].style; 
		imageDivsStyle.position='absolute'; 
		
		const3 = const2 + angle; /* (this eliminates 1 addition)*/
		angle += const1;
		posX = ( Math.sin( const3 )* radiusX + centerX );
		posY = ( Math.cos( const3 )* radiusY + centerY );
		
		imageDivsStyle.left = posX+"px"; 
		imageDivsStyle.top = posY+"px"
		
		imageDivWidth = posY/2;
		imageDivZIndex = Math.round(imageDivWidth)+100;
		
		imageDivsStyle.width = imageDivWidth+'px';
		imageDivsStyle.zIndex = imageDivZIndex;
	}
	count++
}
