activateMenu = function(id) {
    /* currentStyle restricts the Javascript to IE only */
	if (document.all && document.getElementById(id).currentStyle) {  
       var navroot = document.getElementById(id);
        
		/* Get all the list items within the menu */
		var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {
        
           /* If the LI has another menu level */
            if(lis[i].lastChild.tagName=="UL"){
					
				
                /* assign the function to the LI */
             	lis[i].onmouseover=function() {	
                
                   /* display the inner menu */
                   this.lastChild.style.display="block";
                }				
                lis[i].onmouseout=function() {                       
                   this.lastChild.style.display="none";
                }
            }
        }
  	}
}

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 { 
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
		xhr = false;
	}
	return xhr;
}
function go(){
	var xhr = getXhr();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){

			document.getElementById('selctresult').innerHTML =xhr.responseText;
		}
	}
	sel = document.getElementById('recette');
	id_Cat = sel.options[sel.selectedIndex].value;
	xhr.open("post","s_cat_ajax.php",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send("id="+id_Cat);
}

function get_recette(){
	var xhr = getXhr();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){
			document.getElementById('result').innerHTML = xhr.responseText;
		}
	}
	
	sel = document.getElementById('delices');
	id_Cat = sel.options[sel.selectedIndex].value;
	xhr.open("post","get_recette.php",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send("s_cat_id="+id_Cat);
}


