// JavaScript Document

  var ricerca_pro;
      
function cerca() 
{
    var valorecampo = document.form1.categoria.options[document.form1.categoria.selectedIndex].value;
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        ricerca_pro = new XMLHttpRequest();
        ricerca_pro.onreadystatechange = ricevi;
        ricerca_pro.open("GET", "cercasottocategorie.asp?categoria_prodotto="+valorecampo,true);
        ricerca_pro.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        ricerca_pro = new ActiveXObject("Microsoft.XMLHTTP");
        if (ricerca_pro) {
            ricerca_pro.onreadystatechange = ricevi;
            ricerca_pro.open("GET", "cercasottocategorie.asp?categoria_prodotto="+valorecampo,true);
            ricerca_pro.send();
        }
    }
}

     
  function ricevi() {   
    var strRes;       
    var arrValori;      
	  if (ricerca_pro.readyState == 4) {	    
		  strRes=ricerca_pro.responseText;
		  arrValori=strRes.split("|");
		  document.form1.sottocategoria.options.length=0;		    
		  
		  if ((arrValori.length == 1) && (arrValori[0] == ""))
				{
			  document.form1.sottocategoria.disabled=true;
				}
		  else
				{
			  document.form1.sottocategoria.disabled=false;	  
				 }
		  
		  for(i=0;i<arrValori.length;i++)
		  {
		    document.form1.sottocategoria.options[document.form1.sottocategoria.options.length]= new Option(arrValori[i].split("|")); 
		  }
		 }
	}

