
function getXhr(){
	var xhr = null; 
	if(window.XMLHttpRequest) // Firefox et autres
	   xhr = new XMLHttpRequest(); 
	else if(window.ActiveXObject){ // Internet Explorer 
	   try {
	       xhr = new ActiveXObject("Msxml2.XMLHTTP");
	    } catch (e) {
	       xhr = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	else { // XMLHttpRequest non supporté par le navigateur 
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	   xhr = false; 
	} 
       return xhr;
}
/**
* Ces fonctions sont appelées par certains scripts php
*/
/*----oappele est l'id de l'objet à mettre à jour------*/
/*----phpscript est le nom du script php de traitement*/
/*----oappelant est l'id de l'objet qui appele ------*/
/*----srcscript est le nom du script php emetteur*/
/*----Attention : la variable chem est à définir en fonction du contexte de publication*/

function go(oappele,phpscript,id,oappelant,srcscript){
	var xhr = getXhr();
	var myscript='';
	var prof_num='';
	//var chem = 'http://localhost/france-sport-international/admback_038/' ;
	var chem = 'http://auberge-jeunesse-aix.fr/admback_038/' ;

// On défini ce qu'on va faire quand on aura la réponse
	xhr.onreadystatechange = function(){
		// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
		if(xhr.readyState == 4 && xhr.status == 200){
			leselect = xhr.responseText;
		// On se sert de innerHTML pour rajouter les options a la liste
			document.getElementById(oappele).innerHTML = leselect;
		}
	}
// Ici affecte le chemin complet au phpscript
	phpscript = chem+phpscript ;

//	alert ( phpscript ) ;

	xhr.open("POST",phpscript,true);

	// ne pas oublier ça pour le post
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

//	On recupère l'objet appelant ;
	sel = document.getElementById(oappelant);


	myscript+=srcscript ;


	if( myscript=='update_produits') {
//		alert (oappelant) ;
//		xhr.send("lang_id="+oappelant);
		xhr.send("id="+id+"&lang_id="+oappelant);
	}


	if( myscript=='update_traductions_formulaires') {
//		alert (oappelant) ;
//		xhr.send("lang_id="+oappelant);
		xhr.send("id="+id+"&lang_id="+oappelant);
	}



	if( myscript=='update_dossier_3') {
		if(oappelant=='randomisation_choix') {
			if(sel.checked) {
//				alert ("Choix OUI...") ;
				id = document.getElementById('id');
				confbv_fic_id = id.value ;
				xhr.send("id_dossier="+confbv_fic_id);
			}
			else
			{
//			alert ("Choix NON...") ;
			confbv_fic_id = 0 ;
			xhr.send("id_dossier="+confbv_fic_id);
//			window.location.reload(true) ;
//			window.document.newcommande.submit() ;
			}
		}		

		if(oappelant=='traitements_concomitants_choix') {
			if(sel.checked) {
//				alert ("Choix OUI...") ;
				id = document.getElementById('id');
				confbv_fic_id = id.value ;
				xhr.send("id_dossier="+confbv_fic_id);
			}
			else
			{
//			alert ("Choix NON...") ;
			confbv_fic_id = 0 ;
			xhr.send("id_dossier="+confbv_fic_id);
//			window.location.reload(true) ;
//			window.document.newcommande.submit() ;
			}
		}		



}


	if( myscript=='update_dossier_4') {
		if(oappelant=='traitements_concomitants_choix') {
			if(sel.checked) {
//				alert ("Choix OUI...") ;
				id = document.getElementById('id');
				confbv_fic_id = id.value ;
				xhr.send("id_dossier="+confbv_fic_id);
			}
			else
			{
//			alert ("Choix NON...") ;
			confbv_fic_id = 0 ;
			xhr.send("id_dossier="+confbv_fic_id);
//			window.location.reload(true) ;
//			window.document.newcommande.submit() ;
			}
		}		
	}


	if( myscript=='update_dossier_5') {
		if(oappelant=='traitements_concomitants_choix') {
			if(sel.checked) {
//				alert ("Choix OUI...") ;
				id = document.getElementById('id');
				confbv_fic_id = id.value ;
				xhr.send("id_dossier="+confbv_fic_id);
			}
			else
			{
//			alert ("Choix NON...") ;
			confbv_fic_id = 0 ;
			xhr.send("id_dossier="+confbv_fic_id);
//			window.location.reload(true) ;
//			window.document.newcommande.submit() ;
			}
		}		
	}

	if( myscript=='update_dossier_6') {
//		alert ( myscript ) ;
		if(oappelant=='traitements_concomittants_choix') {
			if(sel.checked) {
//				alert ("Choix OUI...") ;
				id = document.getElementById('id');
				confbv_fic_id = id.value ;
				xhr.send("id_dossier="+confbv_fic_id);
			}
			else
			{
//			alert ("Choix NON...") ;
			confbv_fic_id = 0 ;
			xhr.send("id_dossier="+confbv_fic_id);
//			window.location.reload(true) ;
//			window.document.newcommande.submit() ;
			}
		}		
	}

	if( myscript=='update_dossier_8') {
//		alert ( myscript ) ;
		if(oappelant=='traitements_concomittants_choix') {
			if(sel.checked) {
//				alert ("Choix OUI...") ;
				id = document.getElementById('id');
				confbv_fic_id = id.value ;
				xhr.send("id_dossier="+confbv_fic_id);
			}
			else
			{
//			alert ("Choix NON...") ;
			confbv_fic_id = 0 ;
			xhr.send("id_dossier="+confbv_fic_id);
//			window.location.reload(true) ;
//			window.document.newcommande.submit() ;
			}
		}		
	}

	if( myscript=='update_dossier_9') {
//		alert ( myscript ) ;
		if(oappelant=='traitements_concomittants_choix') {
			if(sel.checked) {
//				alert ("Choix OUI...") ;
				id = document.getElementById('id');
				confbv_fic_id = id.value ;
				xhr.send("id_dossier="+confbv_fic_id);
			}
			else
			{
//			alert ("Choix NON...") ;
			confbv_fic_id = 0 ;
			xhr.send("id_dossier="+confbv_fic_id);
//			window.location.reload(true) ;
//			window.document.newcommande.submit() ;
			}
		}		
	}


	if( myscript=='update_dossier_12') {
		if(oappelant=='autre_action_choix') {
			if(sel.checked) {
//				alert ("Choix OUI...") ;
				id = document.getElementById('id');
				confbv_fic_id = id.value ;
				xhr.send("id_dossier="+confbv_fic_id);
			}
			else
			{
//			alert ("Choix NON...") ;
			confbv_fic_id = 0 ;
			xhr.send("id_dossier="+confbv_fic_id);
//			window.location.reload(true) ;
//			window.document.newcommande.submit() ;
			}
		}		
	}




}


