function getSubcat(mCat, sCat) {

  var http = null;
  http = createObject(http);
  //alert('here');

  http.onreadystatechange = function()
  {
  //alert(http.readyState);
   if(http.readyState == 4)
    if(http.status == 200)
     fillCombobox(sCat,http);
    else
     alert("Error: returned status code");
  };

  var url = 'selectVal.php?cat='+document.getElementById(mCat).value;
  //alert(url);
  sendRequest(url,http);

}

function sendRequest(varURL,varObj){
  varObj.open("POST",varURL,true);
  varObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  varObj.send(null);
}

function createObject(varobj){
  if(window.XMLHttpRequest)
   varobj = new XMLHttpRequest();
  else if(window.ActiveXObject)
   varobj = new ActiveXObject("Microsoft.XMLHTTP");

   //alert('create Obj');
  return varobj;
}

function fillCombobox(sCat,varObj)
{
 //alert('here');
 //alert(document.getElementById(sCat).options.length);
 if(document.getElementById(sCat).options.length > 0)
 {
  //alert('in if ');
  for(j=document.getElementById(sCat).options.length-1;j>=0;j--)
   document.getElementById(sCat).options[j]=null;

 }


 //alert(varObj.responseText);
 var resp =varObj.responseText;
 var arrresp=resp.split("|");
 //alert(arrresp.length);
 if (arrresp.length > 1) {
  var opt1 = new Option("All","");
  document.getElementById(sCat).options[document.getElementById(sCat).options.length]=opt1;
 }

 for(i=0;i<arrresp.length;i++)
 {

  var opt = new Option(arrresp[i],arrresp[i]);
  document.getElementById(sCat).options[document.getElementById(sCat).options.length]=opt;
 }
 return;
}