var decalage = 0;
var nbBout=7;	  
var timer;
var timeOut;

var norm_width = 115;
var act_width;
var max_width = 172.5;

var norm_height = 34;
var act_height;
var max_height = 51;


function menu()
{
	var angle = 360 / nbBout;		
	var posX;
	var posY;
	var rayon = 0;
	var centreX = document.getElementById("centre").offsetLeft;
	var centreY = document.getElementById("centre").offsetTop;
	var lItem = 0;
	var i = 1;
	var item;
	var b;

	for(b = 0; b < 360; b += angle)
	{		  
		posX = centreX + 25 + rayon * Math.cos(b * Math.PI / 180);
		posY = centreY + 25 + rayon * Math.sin(b * Math.PI / 180); 

		item = document.getElementById("item" + i);
		item.className = "item";	
		item.style.top = (posY - lItem / 2) + "px"; 
		item.style.left = (posX - lItem / 2) + "px";
		i++;
	}
	replayanim();
}


function anim()
{		  
	decalage++;
	var angle = 360 / nbBout;		
	var posX;
	var posY;
	var rayon = 200;
	var centreX = document.getElementById("centre").offsetLeft;
	var centreY = document.getElementById("centre").offsetTop;
	var lItem = 115;
	var hItem = 32;
	var i = 1;
	var item
	var b;
	for(b = 0; b < 360; b = b + angle)
	{		  
		posX = centreX + 25 + rayon * Math.cos((b + decalage) * Math.PI / 180);
		posY = centreY + 25 + rayon * Math.sin((b + decalage) * Math.PI / 180); 

		item = document.getElementById("item" + i);
		item.style.top = (posY - hItem / 2) + "px"; 
		item.style.left = (posX - lItem / 2) + "px";
		i++;
	}
}

function stopanim()
{
	clearInterval(timer);		   
}

function replayanim()
{
	timer = setInterval("anim()",70);
}


function grossit(id)
{
	act_width = parseInt($('#'+id+'').attr("width"));
	act_height = parseInt($('#'+id+'').attr("height"));
	
	
	var new_width  = act_width + 11.5;
	var new_height = act_height + 3.1;

	if(new_width<=max_width && new_height<=max_height)
	{ 	

		$('#'+id+'').attr("width", new_width);
		$('#'+id+'').attr("height", new_height);
		
		timeOut = setTimeout("grossit('"+id+"')", 100);
	}
}


function degrossit(id)
{
	$('#'+id+'').attr("width", 115);
	$('#'+id+'').attr("height", 31);
	clearTimeout(timeOut);
}

