// AJAX CHANGE FAMILLE
function changeFamille(variable)
{
	//alert (variable);
	
    var xhr=null;
	var adr="script/ajax/fam.php?id="+variable;
    
    if (window.XMLHttpRequest) { 
        xhr = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) 
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    //on définit l'appel de la fonction au retour serveur
    xhr.onreadystatechange = function() { alert_fam(xhr); };
    
    //on appelle le fichier reponse.txt
    xhr.open("GET", adr, true);
    xhr.send(null);
	
}
function alert_fam(xhr)
{
    if (xhr.readyState==4) 
    {
    	var docXML= xhr.responseXML;
    	var itemSF = docXML.getElementsByTagName("sous_famille");
		
		// construction de la liste déroulante sous famille
		listeSfam = document.getElementById("sous_famille");
		listeSfam.length = 0;
		for (i=0;i<itemSF.length;i++)
    	{
			sfam = itemSF.item(i).firstChild.data;
			idsfam = itemSF.item(i).attributes[0].nodeValue;
			listeSfam.options[i]= new Option(sfam,idsfam);
    	}
		
		/*
    	var itemM = docXML.getElementsByTagName("marque");
		
		// construction de la liste déroulante sous famille
		listeM = document.getElementById("marquer");
		listeM.length = 0;
		for (i=0;i<itemM.length;i++)
    	{
			sfam = itemM.item(i).firstChild.data;
			idsfam = itemM.item(i).attributes[0].nodeValue;
			listeM.options[i]= new Option(sfam,idsfam);
    	}
		*/
    }
}