var tX = 0;
var tempX =0;
var lock = false;
function Load()
{
    tempX = document.body.clientWidth/2;
    Rotate();
	
}

  function getMouseXY(e) 
  {
 
    tX =  e.pageX ;//event.clientX;
    if (tX < 0) tX = 0;  
    tX *= 1;  
   
  }

RepeaterPlanets();

function RepeaterPlanets()
{

	if(Math.round(tempX)!=Math.round(tX))
	{
 	  tempX += -((tempX -tX)/11)  ;//event.clientX;
	  Rotate();
	}
	if(Math.abs(tempX -tX) > 30) lock = true;
	else lock = false;

 setTimeout("RepeaterPlanets()",20);

}


 function Rotate()
 {


   var clWidth = document.body.clientWidth*1.2;
    var clHeight = document.body.clientHeight*1.5;

    var offsetSin = (360/collection.length) ;//*parameter
	 

    for(i =0; i < collection.length; i++)
	{
		var leftStr = Math.round( Math.round(clWidth /2)   *    Math.cos(  ((- clWidth/2  +tempX)/180)  + ((offsetSin*i)/180)*Math.PI  )       +     clWidth/2  -  document.body.clientWidth*0.1 - 200) ;
    		var topStr  = Math.round(-Math.round(clHeight /2)  *    Math.sin(  ((- clWidth/2  +tempX)/180)  + ((offsetSin*i)/180)*Math.PI  )       +     clHeight/2 + 130) ;
		collection[i].style.left = leftStr.toString() + "px";
		collection[i].style.top =  topStr.toString() +  "px";
		
		//var size =  (clHeight - topStr)>0? (clHeight - topStr):0;
		// size *= 1;
		//imageCollection[i].style.width =  size.toString() +  "px";
		//imageCollection[i].style.height = size.toString() +  "px";
	}
 
 }
