// Alain

var xmlHttp
function LireRobes(str,patienter)
{

	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
  	{
  		alert ("Votre Navigateur ne support AJAX!");
  		return;
  	}

	if (str==null)
  	{
  		alert ("Pas d'argument dans la fonction!");
  		return;
  	}



  	var url="ResultatRobes-adodb.php";
	url=url + "?" + str;

	document.getElementById("dynamique").innerHTML=patienter;

	//alert ("patienter est " + patienter );
	//return;

	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);

}

function stateChanged()
{
	if (xmlHttp.readyState==4)
	{
		var chaine = xmlHttp.responseText;
		htmlstr = '<span class="nombre_reponse_robes">Nombre de r&eacute;ponses : ' + chaine + '</span>';
		//alert("Returned result : " + chaine);
		document.getElementById("dynamique").innerHTML=htmlstr;


	}
}


function LireCriteres()
{


  argUrl="";
  strstyles="";styleid="";strcolors =""; colorid="";strtenu =""; tenuid="";strtenub=""; tenuidb="";strprix=""; prixidb="";



  for(var i=0;i<document.forms.robe.style.length;i++)
  {

	if(document.forms.robe.style[i].checked)
	{
		styleid=document.forms.robe.style[i].value;
		if(strstyles == "")
		{
			strstyles = styleid;
		}else
		{
			strstyles = strstyles + "," + styleid;
		}

	}

   }

	if(strstyles.length > 0)
	{
		//strstyles = "styles=(" + strstyles + ")";
		//alert (" styles " + argUrl );

		if(argUrl.length > 0)
		{
			argUrl = argUrl+"&styles=(" + strstyles + ")";
		}else
		{
			argUrl = "styles=(" + strstyles + ")";
		}
	}



   for(var i=0;i<document.forms.robe.color.length;i++)
   {

	if(document.forms.robe.color[i].checked)
	{
		colorid=document.forms.robe.color[i].value;
		if(strcolors == "")
		{
			strcolors = colorid;
		}else
		{
			strcolors = strcolors + "," + colorid;
		}

	}

    }




	if(strcolors.length > 0)
	{
		if(argUrl.length > 0)
		{
			argUrl = argUrl+"&colors=(" + strcolors + ")";
		}else
		{
			argUrl = "colors=(" + strcolors + ")";
		}

	}


   for(var i=0;i<document.forms.robe.tenueH.length;i++)
   {

	if(document.forms.robe.tenueH[i].checked)
	{
		tenuid=document.forms.robe.tenueH[i].value;
		if(strtenu == "")
		{
			strtenu = tenuid;
		}else
		{
			strtenu = strtenu + "," + tenuid;
		}

	}

    }




	if(strtenu.length > 0)
	{
		if(argUrl.length > 0)
		{
			argUrl = argUrl+"&tenueH=(" + strtenu + ")";
		}else
		{
			argUrl = "tenueH=(" + strtenu + ")";
		}

	}



   for(var i=0;i<document.forms.robe.tenueB.length;i++)
   {

	if(document.forms.robe.tenueB[i].checked)
	{
		tenuidb=document.forms.robe.tenueB[i].value;
		if(strtenub == "")
		{
			strtenub = tenuidb;
		}else
		{
			strtenub = strtenub + "," + tenuidb;
		}

	}

    }




	if(strtenub.length > 0)
	{
		if(argUrl.length > 0)
		{
			argUrl = argUrl+"&tenueB=(" + strtenub + ")";
		}else
		{
			argUrl = "tenueB=(" + strtenub + ")";
		}

	}



   for(var i=0;i<document.forms.robe.prix.length;i++)
   {

	if(document.forms.robe.prix[i].checked)
	{
		prixidb=document.forms.robe.prix[i].value;
		if(strprix == "")
		{
			strprix = prixidb;
		}else
		{
			strprix = strprix + "," + prixidb;
		}

	}

    }




	if(strprix.length > 0)
	{
		if(argUrl.length > 0)
		{
			argUrl = argUrl+"&prix=(" + strprix + ")";
		}else
		{
			argUrl = "prix=(" + strprix + ")";
		}

	}


	// le 20-01-2010
	Uncreateur = document.forms.robe.createur_id.value;
		if(argUrl.length > 0)
		{
			argUrl = argUrl+"&createur_id="+Uncreateur;
		}else
		{
			argUrl = "createur_id=" + Uncreateur;
		}
	//alert("argUrl "+ argUrl);



if(argUrl.length > 0)
{
	//alert("argUrl : "+argUrl);
	patienter = '<span class="nombre_reponse_robes">Nombre de r&eacute;ponses : <img src="/images_charte/ajax-loader.gif" /></span>';
	LireRobes(argUrl,patienter);

}




return false;


}


function GetXmlHttpObject()
{
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;
}

