var url_kod = "inc/ajax_kod.php5?"; // The server-side script




function handleHttpResponse_kod() {
  var theobj1= eval ('document.getElementById("miejscowosc_combo")');
  var theobj= eval ('document.getElementById("miejscowosc_txt")');

  if (http.readyState == 1)
  {
  theobj1.options.length = 0;
  theobj.innerHTML = 'proszę czekać...';
  theobj1.style.display='none';

  }

  if (http.readyState == 4) {
     theobj.innerHTML='';

     results = http.responseText.split("#");

     theobj.innerHTML='wybierz z listy lub wpisz: <br>';
     theobj.style.display='block';

     for(i=0;i<results.length-1;i++)
     {
     theobj1.style.display='block';
     miejscowsc_tmp=results[i];
     theobj1.options[i]=new Option(miejscowsc_tmp, miejscowsc_tmp);
     }

     if(i==0) { theobj.innerHTML='';  theobj.style.display='none'; }

  }
}







function UpdateKod() {
var kod_pocztowy;
var theobj= eval ('document.getElementById("kod_pocztowy")');

kod_pocztowy=theobj.value;

//alert('id_wybrany='+id_wybrana_kategoria+'&action='+action+'&id_kategoria='+id_kategoria+'&id_main='+id_main);
   if(kod_pocztowy!='' )
   {
      http = getHTTPObject();
   http.open("GET", url_kod +'kod_pocztowy='+kod_pocztowy, true);
   http.onreadystatechange = handleHttpResponse_kod;
   http.send(null);
   }

}







function SetMiejscowosc()
{
var theobj= eval ('document.getElementById("miejscowosc_combo")');
var theobj1= eval ('document.getElementById("miejscowosc")');

theobj1.value=theobj.value;
}






