// JavaScript Document

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
}

function go(){
	var xhr = getXhr()
	
	// 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){
			//reponse = clean(xhr.responseXML);
			
			reponse = xhr.responseXML.documentElement;
			//alert(reponse.getElementsByTagName("radio")[0].firstChild.firstChild.nodeValue);
			tot = reponse.getElementsByTagName("radio").length;
			//liste_update = document.formType.modele_assos.elements["list"+L];
			document.recherche.elements["sscategorie"].options.length = tot;
			for(var i=0;i<tot;i++) { 
				document.recherche.sscategorie.options[i].value=reponse.getElementsByTagName("id")[i].firstChild.nodeValue;
				document.recherche.sscategorie.options[i].text=reponse.getElementsByTagName("name")[i].firstChild.nodeValue;	
			}
		}
	}

	xhr.open("GET","xml_categorie.asp?choix="+document.recherche.Categorie.value,true);
	xhr.send(null);
}