// tworzy nowy select i wypelnia danymi z pliku

function createOption(tab_k,nazwa)
{

var x=document.getElementById(nazwa);

if(tab_k.length>1){

x.length=tab_k.length;

for(i=0;i<x.length;i++)
  {
tbl=tab_k[i].split("|");
  x.options[i].value=tbl[0];
  x.options[i].text=tbl[1];
  }
x.selectIndexOf=0;
}
}




function handleHttpResponse_reg() {

  if (http.readyState == 4) {
     var tab = http.responseText.split("\n");
createOption(tab,'podkategoria');

  isWorking = false;

 }

}

function UpdateSelectRegion(idCat,url) {

alert(idCat);
if (!isWorking && http) {
http.open("GET", url+idCat, true);

    http.onreadystatechange = handleHttpResponse_reg;
isWorking = true;
    http.send(null);
}

}

function getHTTPObject() {

  var xmlhttp;

  /*@cc_on

  @if (@_jscript_version >= 5)

    try {

      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

    } catch (e) {

      try {

        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

      } catch (E) {

        xmlhttp = false;

      }

    }


@else

  xmlhttp = false;

  @end @*/

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {

    try {

      xmlhttp = new XMLHttpRequest();

    } catch (e) {

      xmlhttp = false;

    }

  }

  return xmlhttp;

}

var http = getHTTPObject(); // We create the HTTP Object
var isWorking = false;
