function aide (texte, destination)
{
	document.getElementById(destination).innerHTML =texte;
}
function aide_out (destination)
{
	document.getElementById(destination).innerHTML ='<span class="vide"><div align="center">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Survolez un élément pour obtenir de l\'aide...</div></span>';
}
var global = new initialisation_ajax() ;
function initialisation_ajax ()
{
	this.global = '' ;
}

function rafraichir(page, variable, destination)
{
    var xhr;
    if (window.XMLHttpRequest) xhr = new XMLHttpRequest();
    else if (window.ActiveXObject) xhr = new ActiveXObject('Microsoft.XMLHTTP');
    else
	{
        alert('JavaScript : votre navigateur ne supporte pas les objets XMLHttpRequest... Téléchargez Mozilla !');
        return;
	}
    xhr.open('POST',page+'.php',true);
    xhr.onreadystatechange = function()
	{
        if (xhr.readyState == 4)
		{
			document.getElementById(destination).innerHTML = xhr.responseText;
			var scripts = document.getElementById(destination).getElementsByTagName('script'); //on récupère les balises scripts
			for( var i=0; i < scripts.length; i++)
			{
			  eval(scripts.item(i).innerHTML); //on exécute
			}
	        move(destination) ;
		}
	}
    xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');
    xhr.send(variable);
}

var t=0;
var cartehauteur =-800;
var dt=25;
var xi = 0.8;
var w0 = 5;
var tmax=1.2 ;
function menu (page, variable, destination)
{
	if (t==tmax)
	{
		back(page, variable,destination);
	}
}	
function back(page, variable, destination)
{
	t -= dt/1000 ;
	document.getElementById (destination).style.top = Math.round(cartehauteur * Math.exp(-xi*w0*t)*(Math.cos(w0*t*Math.sqrt(1-xi^2))+xi/Math.sqrt(1-xi^2)*Math.sin(w0*t*Math.sqrt(1-xi^2))))+"px";
	if (t>0)
		setTimeout("back('"+page+"', '"+variable+"','"+destination+"')",dt);
	else
	{
		t=0;
		rafraichir(page, variable, destination) ;
	}
		
}
function move(destination)
{
	t += dt/1000 ;
	document.getElementById (destination).style.top = Math.round(cartehauteur * Math.exp(-xi*w0*t)*(Math.cos(w0*t*Math.sqrt(1-xi^2))+xi/Math.sqrt(1-xi^2)*Math.sin(w0*t*Math.sqrt(1-xi^2))))+"px";
	if (t<tmax)
		setTimeout("move('"+destination+"')",dt);
	else
	{
		t=tmax;
	}
		
}

