function RunFooVars(swf, hauteur, largeur, vars) {
	document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\""+hauteur+"\" height=\""+largeur+"\">");
	document.write("<param name=\"movie\" value=\""+swf+"\" />");
	document.write("<param name=\"Flashvars\" value=\""+vars+"\" />");
	document.write("<param name=\"quality\" value=\"high\" />");
	document.write("<param name=\"menu\" value=\"false\" />");
	document.write("<embed src=\""+swf+"\" flashvars=\""+vars+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" menu=\"false\" width=\""+hauteur+"\" height=\""+largeur+"\"></embed>");
	document.write("</object>");
}

function getXhr(){
	var xhr = null; 
	if(window.XMLHttpRequest) xhr = new XMLHttpRequest(); 
	else if(window.ActiveXObject){
		try{
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e){
			xhr = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	else{
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
		xhr = false; 
	} 
	return xhr
}

function ouvre_page(div,page,variable,type){
	var xhr = getXhr();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){
			document.getElementById(div).innerHTML = xhr.responseText;
		}
	}
	xhr.open(type,page,true);
	if(type=="POST"){
		xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xhr.send(variable);
	}
	else xhr.send(null);
}

function envoi_mail(){
	var variables = 'send=ok&nom='+document.forms.form_contact.nom.value+'&prenom='+document.forms.form_contact.prenom.value+'&email='+document.forms.form_contact.email.value;
	variables = variables+'&destinataire='+document.forms.form_contact.destinataire.value+'&sujet='+document.forms.form_contact.sujet.value+'&message='+document.forms.form_contact.message.value;

	var xhr = getXhr();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){
			var reponse = xhr.responseText;
			if(reponse==1){
				document.getElementById('erreur').innerHTML = '<br><strong>Votre message a bien été envoyé.</strong>';
				document.forms.form_contact.reset();
			}
			else document.getElementById('erreur').innerHTML = '<br>'+reponse;
		}
	}
	xhr.open('POST', 'contact.php', true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send(variables);
}
