//Fonction renvoyant une valeur "aléatoire" pour forcer le navigateur (ie...)
//à envoyer la requête de mise à jour
function ieTrick(sep)
{
	d = new Date();
	trick = d.getYear() + "ie" + d.getMonth() + "t" + d.getDate() + "r" + d.getHours() + "i" + d.getMinutes() + "c" + d.getSeconds() + "k" + d.getMilliseconds();

	if (sep != "?")
	{
		sep = "&";
	}

	return sep + "ietrick=" + trick;
}

var html = new sack();

function whenLoading(){
	var e = document.getElementById('cadre'); 
	e.innerHTML = "<p  id=\"loading\">Envoi en cours...</p>";
}

function whenLoaded(){
	var e = document.getElementById('cadre'); 
	e.innerHTML = "<p  id=\"loading\">OK.</p>";
}

function whenInteractive(){
	var e = document.getElementById('cadre'); 
	e.innerHTML = "<p>Echange avec le serveur...</p>";
}

function whenCompleted(){
	var e = document.getElementById('cadre'); 
	e.innerHTML = html.response;
}

function ValideEnvoiBug(chemin){
	html.setVar("localisation", document.formulaire_bug.localisation.value);
	html.setVar("description", document.formulaire_bug.description.value);
	html.setVar("email", document.formulaire_bug.email.value);
	
	if (document.formulaire_bug.copie.checked)
		html.setVar("copie",document.formulaire_bug.copie.value);
	else
		html.setVar("copie","");
	html.setVar("lang",document.formulaire_bug.lang.value);
	
	html.requestFile = chemin;
	html.method = document.formulaire_bug.method;
	html.element = 'cadre';
	html.onLoading = whenLoading;
	html.onLoaded = whenLoaded; 
	html.onInteractive = whenInteractive;
	html.onCompletion = whenCompleted;
	html.runAJAX();
}

function ConseilleLien()
{
	html.setVar("nom", document.formulaire_conseil.nom.value);
	html.setVar("email", document.formulaire_conseil.email.value);
	html.setVar("to", document.formulaire_conseil.to.value);
	
	if (document.formulaire_conseil.copie.checked)
		html.setVar("copie",document.formulaire_conseil.copie.value);
	else
		html.setVar("copie","");

	html.setVar("page",document.formulaire_conseil.page.value);
	html.setVar("terme",document.formulaire_conseil.terme.value);
	
	html.requestFile = "./dictionnaire/conseil.php?mode=soumission";
	html.method = document.formulaire_conseil.method;
	html.element = 'cadre';
	html.onLoading = whenLoading;
	html.onLoaded = whenLoaded; 
	html.onInteractive = whenInteractive;
	html.onCompletion = whenCompleted;
	html.runAJAX();	
}

function FaireRemarque()
{
	html.setVar("type", document.formulaire_remarque.type.value);
	html.setVar("email", document.formulaire_remarque.email.value);
	html.setVar("departement", document.formulaire_remarque.departement.value);
	html.setVar("age", document.formulaire_remarque.age.value);
	html.setVar("remarque", document.formulaire_remarque.remarque.value);
	
	if (document.formulaire_remarque.copie.checked)
		html.setVar("copie",document.formulaire_remarque.copie.value);
	else
		html.setVar("copie","");

	html.setVar("page",document.formulaire_remarque.page.value);
	html.setVar("terme",document.formulaire_remarque.terme.value);
	
	html.requestFile = "./dictionnaire/remarque.php?mode=soumission";
	html.method = document.formulaire_remarque.method;
	html.element = 'cadre';
	html.onLoading = whenLoading;
	html.onLoaded = whenLoaded; 
	html.onInteractive = whenInteractive;
	html.onCompletion = whenCompleted;
	html.runAJAX();	
}
