var xmlHttp

var x1
var x2
var x3

function affichage_mn_niveau2(id_elt, salon, element, profil) {
	
    var tabs=document.getElementById('recherche_menu_niveau1').getElementsByTagName("a");

    for (var i=0; i < tabs.length; i++)
    {
        if(tabs[i].rel == element.rel) 
           tabs[i].className="selected";

 
        else
           tabs[i].className="";
    }
	if (id_elt.length>0) {
		xmlHttp=GetXmlHttpObject_cf();
		if (xmlHttp==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		  } 

		var url="ajax_animations.php";
		url=url+"?id_elt="+id_elt;
		url=url+"&salon="+salon;
		url=url+"&sid="+Math.random();

		xmlHttp.onreadystatechange=stateChanged_an;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	
	if (profil=="profil") {
		x1 = id_elt;
		x2 = salon;
		x3 = "profil";
	} else {
		x1 = "";
		x2 = salon;
		x3 = "liste";
	}
}
function affichage_mn_niv2(id_elt, element) {
	
    var tabs=document.getElementById('recherche_menu_niveau1').getElementsByTagName("a");

    for (var i=0; i < tabs.length; i++)
    {
        if(tabs[i].rel == element.rel) 
           tabs[i].className="selected";
        else
           tabs[i].className="";
    }
	if (id_elt.length>0) {
		xmlHttp=GetXmlHttpObject_cf();
		if (xmlHttp==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		  } 

		var url="ajax_animations_ecoute.php";
		url=url+"?action="+id_elt;
		url=url+"&sid="+Math.random();

		xmlHttp.onreadystatechange=stateChanged_an;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
}
function affichage_mn_niveau2_salon(id_elt, salon, element) {
	
    var tabs=document.getElementById('recherche_menu_niveau1').getElementsByTagName("a");
    
    for (var i=0; i < tabs.length; i++)
    {
        if(tabs[i].rel == element.rel) 
           tabs[i].addClass="selected";
           
        else
           tabs[i].className="";
    }
	if (id_elt.length>0) {
		xmlHttp=GetXmlHttpObject_cf();
		if (xmlHttp==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		  } 

		var url="ajax_animations.php";
		url=url+"?id_elt="+id_elt;
		url=url+"&salon="+salon;
		url=url+"&targ=1";
		url=url+"&sid="+Math.random();

		xmlHttp.onreadystatechange=stateChanged_an;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
}
function stateChanged_an() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	
		if (xmlHttp.responseText.length==0) {
			document.getElementById("recherche_menu_niveau2").innerHTML=xmlHttp.responseText;
		}
		if (xmlHttp.responseText.length>0) {
			document.getElementById("recherche_menu_niveau2").innerHTML=""+xmlHttp.responseText+"";
		}
		$.fn.nyroModal.settings.width = 796;
		$.fn.nyroModal.settings.height = 600;

		$(".nyroModal").nyroModal();
		
		if (x3=="profil") {
			affichage_animations(x1, x2);
		} else {
			affichage_animations("", x2);
		}
	}
}
function affichage_animations(id_conf, salon) {
		xmlHttp=GetXmlHttpObject_cf();
		if (xmlHttp==null)
		  {
		  alert ("Your browser does not support AJAX!");
		  return;
		  } 

		var url="ajax_animations_liste.php";
		url=url+"?id_conf="+id_conf;
		url=url+"&salon="+salon;
		url=url+"&sid="+Math.random();

		xmlHttp.onreadystatechange=stateChanged_lstan;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);

}
function stateChanged_lstan() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	
		if (xmlHttp.responseText.length==0) {
			document.getElementById("block_resultats").innerHTML=xmlHttp.responseText;
		}
		if (xmlHttp.responseText.length>0) {
			document.getElementById("block_resultats").innerHTML=""+xmlHttp.responseText+"";
		}
		
		$.fn.nyroModal.settings.width = 1008;
		$.fn.nyroModal.settings.height = 650;

		$(".nyroModal_large").nyroModal();
		$(".nyroModal").nyroModal();
	}
}
function GetXmlHttpObject_cf()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	 }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
