);
cityB = new Array("256=","244=","257=Andrychow","220=Białystok","230=Bielsko","143=Bielsko-biala","240=Boleslawiec","234=Brzeg","226=Brzesko","28=Bydgoszcz","258=Bytom","250=Chorzow","161=Chrzanow","141=Cieszyn","151=Czechowice","145=Czechowice dziedzice","132=Czestochowa","133=Debica","21=Gdańsk","212=Gdynia","146=Gliwice","253=Jazstrzebie zdroj","241=Jedrzychowice","204=Jelenia góra","259=Kalwaria","7=Katowice","197=Kędzierzyn koźle","251=Kedzierzyn kozle","260=Kety","134=Kielce","201=Kłodzko","213=Koszalin","6=Kraków","242=Legnica","235=Leluchow","135=Leszno","152=Łodź","245=Łódź kaliska","8=Łódź","136=Lublin","236=Nowy sacz","200=Nysa","246=Olawa","137=Opole","237=Oswiecim","153=Piotrków","138=Piotrkow trybunalski","142=Piotrkow tryb.","11=Poznań","199=Prudnik","174=Pszczyna","238=Pulawy","139=Radom","198=Rawa mazowiecka","254=Rybnik","13=Rzeszów","239=Siewierz","154=Skarżysko-kamienna","177=Skoczow","214=Słupsk","148=Strzelce opolskie","29=Szczecin","262=Tarnobrzeg","140=Tarnow","215=Toruń","155=Tychy","261=Wadowice","1=Warszawa","216=Włocławek","255=Wodzislaw slaski","247=Wolborz","15=Wrocław","243=Zabrze","222=Zamość","150=Zory","252=Zywiec");
cityF = new Array("16=Berlin","248=Berlin tegel","18=Budapeszt","28=Bydgoszcz","128=Drezno","20=Frankfurt","21=Gdańsk","7=Katowice","6=Kraków","112=Leipzig","152=Łodź","8=Łódź","24=Monachium","130=Nunnberg","11=Poznań","26=Praga","210=Prague","13=Rzeszów","29=Szczecin","1=Warszawa","27=Wiedeń","15=Wrocław");
var operatorzy = {"FLDR":"1279837","ALOV":"22435","RTCE":"536501","AFLA":"454483","MTER":"118821","DART":"159764","OHKS":"1","OCCE":"86930","AKRO":"1271708","TLED":"148638","CERG":"250591","FNUS":"1","RTPE":"1015","ELIM":"18504","YZEW":"965604","TTEJ":"1","TNOK":"2290","OGYW":"125043","LPOS":"2383","RKEL":"61843","TSED":"247","AVIV":"28108","TSEB":"1441","MILO":"32792","UITO":"126905","SAO":"129430","RTSE":"1","EPLA":"2989","ERFB":"168777","MIXE":"308268","XDNI":"3080"};

var regionSelect = 0;
var regionSelectHot = 0;
var nrCitySelect = 0;

function changeRegion() {
  var len = 0;
  var index = document.szukajoferty.krajSel.selectedIndex;
  var wartosc = document.szukajoferty.krajSel.options[index].value;
  if(wartosc == 0){
    document.getElementById('selctRegion').innerHTML = "";
    document.getElementById('selctRegion').style.display = "none";
    return
  }
  var arrayRegion = "t_" + wartosc;
  eval("len = "+arrayRegion+".length;");
  var bufor = "";
  bufor += "<label>Region:</label>\n";
  bufor += "<SELECT NAME=\"regionSel\">\n";
  bufor +=  "<OPTION VALUE=\"0\"";
  if (regionSelect == 0) bufor +=  " selected";
  bufor += ">bez znaczenia</OPTION>\n";
  for(i=0; i<len; i++) {
    eval("slowa = "+arrayRegion+"["+i+"].split('=')");
    bufor += '<OPTION VALUE="';
    bufor += slowa[0];
    bufor += '"';
    if (regionSelect == slowa[0]) bufor += " selected";
    bufor += "> "+slowa[1]+"</OPTION>\n";
  }
  bufor += "</SELECT>\n";
  document.getElementById('selctRegion').style.display = "inline";
  document.getElementById('selctRegion').innerHTML = bufor;
}
function changeRegionHot() {
  var len = 0;
  var index = document.szukajoferty.krajSelHot.selectedIndex;
  var wartosc = document.szukajoferty.krajSelHot.options[index].value;
  if(wartosc == 0){
    document.getElementById('selctRegionHot').innerHTML = "";
    document.getElementById('selctRegionHot').style.display = "none";
    return
  }
  var arrayRegion = "t_" + wartosc;
  eval("len = "+arrayRegion+".length;");
  var bufor = "";
  bufor += "<label>Region:</label>\n";
  bufor += "<SELECT NAME=\"regionSelHot\">\n";
  bufor +=  "<OPTION VALUE=\"0\"";
  if (regionSelectHot == 0) bufor +=  " selected";
  bufor += ">bez znaczenia</OPTION>\n";
  for(i=0; i<len; i++) {
    eval("slowa = "+arrayRegion+"["+i+"].split('=')");
    bufor += '<OPTION VALUE="';
    bufor += slowa[0];
    bufor += '"';
    if (regionSelectHot == slowa[0]) bufor += " selected";
    bufor += "> "+slowa[1]+"</OPTION>\n";
  }
  bufor += "</SELECT>\n";
  document.getElementById('selctRegionHot').style.display = "inline";
  document.getElementById('selctRegionHot').innerHTML = bufor;
}
function changeCity() {
  var len = 0;
  var index = document.szukajoferty.Transport.selectedIndex;
  var wartosc = document.szukajoferty.Transport.options[index].value;
  if(wartosc == 0){
    document.getElementById('selctCity').innerHTML = "";
    document.getElementById('selctCity').style.display = "none";
    return
  }
  var bufor = "";
  bufor += "<label>z miasta:</label>\n";
  bufor += "<select name=\"nrCitySel\">\n";
  bufor +=  "<OPTION VALUE=\"0\"";
  if (nrCitySelect == 0) bufor +=  " selected";
  bufor += ">bez znaczenia</OPTION>\n";
  if(wartosc == "F"){
    len = cityF.length;
    for(i=0; i<len; i++) {
      slowa = cityF[i].split('=');
      bufor += '<OPTION VALUE="';
      bufor += slowa[0];
      bufor += '"';
      if (nrCitySelect == slowa[0]) bufor += " selected";
      bufor += "> "+slowa[1]+"</OPTION>\n";
    }
    bufor += "</SELECT>\n";
  } else if(wartosc == "BU"){
    len = cityB.length;
    for(i=0; i<len; i++) {
      slowa = cityB[i].split('=');
      bufor += '<OPTION VALUE="';
      bufor += slowa[0];
      bufor += '"';
      if (nrCitySelect == slowa[0]) bufor += " selected";
      bufor += "> "+slowa[1]+"</OPTION>\n";
    }
    bufor += "</SELECT>\n";
  } else {
    bufor = "";
  }
  document.getElementById('selctCity').style.display = "inline"
  document.getElementById('selctCity').innerHTML = bufor;
}

function sprawdzKodOferty() {
  var kod = document.szukajoferty.kodoferty.value;
  kod = kod.toUpperCase();
  for (i in operatorzy) {
    if(kod.indexOf(i) === 0){
      wyr_reg=new RegExp(i);
      var idoferty= parseInt(kod.replace(wyr_reg,""));
      if(idoferty>0 && idoferty<operatorzy[i])return true;
    }
 }
 alert("w bazie nie ma oferty\n o kodzie: "+kod);
 return false;
}

