//formularz zapytaj o cenę samochodu
      var NrAuto = 0;
      var NrMotor = 0;
      function dodajAuto(){
        if(getElemRefs('auto').options[getElemRefs('auto').selectedIndex].value=='') {alert("Wybierz samochód"); return;}
        var div = document.createElement("div");
        div.setAttribute('id','auto'+NrAuto);
        var usun = document.createElement("a");
        usun.setAttribute('href','javascript:usunAuto(\'auto'+NrAuto+'\');');
        var textUsun = document.createTextNode("Usuń z zapytania");
        usun.style.color = 'red';
        usun.style.fontSize = '10px';
        usun.appendChild(textUsun);
        var input = document.createElement("input");
        input.setAttribute('name','auto'+NrAuto);
        input.style.backgroundColor = 'transparent';
        input.style.border = 'none';
        input.style.color = 'white';
        input.style.fontWeight = 'bold';
        input.setAttribute('value',getElemRefs('auto').options[getElemRefs('auto').selectedIndex].text);
        div.appendChild(input);
        div.appendChild(usun);
        getElemRefs('DodajAuto').appendChild(div);
        NrAuto++;
        getElemRefs('autailosc').value = NrAuto;
      }
      function usunAuto(id){
        getElemRefs('DodajAuto').removeChild(getElemRefs(id));
      }
      function dodajMotor(){
        if(getElemRefs('motory').options[getElemRefs('motory').selectedIndex].value=='') {alert("Wybierz motor"); return;}
        var div = document.createElement("div");
        div.setAttribute('id','motor'+NrMotor);
        var usun = document.createElement("a");
        usun.setAttribute('href','javascript:usunMotor(\'motor'+NrMotor+'\');');
        var textUsun = document.createTextNode("Usuń z zapytania");
        usun.style.color = 'red';
        usun.style.fontSize = '10px';
        usun.appendChild(textUsun);
        var input = document.createElement("input");
        input.setAttribute('name','motor'+NrMotor);
        input.style.backgroundColor = 'transparent';
        input.style.border = 'none';
        input.style.color = 'white';
        input.style.fontWeight = 'bold';
        input.setAttribute('value',getElemRefs('motory').options[getElemRefs('motory').selectedIndex].text);
        div.appendChild(input);
        div.appendChild(usun);
        getElemRefs('DodajMotor').appendChild(div);
        NrMotor++;
        getElemRefs('motorilosc').value = NrMotor;
      }
      function usunMotor(id){
        getElemRefs('DodajMotor').removeChild(getElemRefs(id));
      }
      function usunWszystkieMotory(){
        while(getElemRefs('DodajMotor').firstChild){
          getElemRefs('DodajMotor').removeChild(getElemRefs('DodajMotor').firstChild);
        }
        NrMotor = 0;
      }
      function sprawdzZpaytajOCene(formularz){
        if(formularz.data_od_c.value==''){ alert("Podaj date wyjazdu (od - do)"); return false;}
        if(formularz.data_do_c.value==''){ alert("Podaj date wyjazdu (od - do)"); return false;}
        if(formularz.wyspa.selectedIndex==0){ alert("Wybierz wyspę"); return false;}
        if(NrAuto==0 && NrMotor == 0){ alert("Wybierz przynajmniej jeden samochód lub motor"); return false;}
        if(formularz.imie.value==''){ alert("Podaj imię"); return false;};
        if(formularz.nazwisko.value==''){ alert("Podaj nazwisko"); return false;};
        if(formularz.email.value==''){ alert("Podaj e-mail"); return false;};
      }
      
      function DoSelect(select){
        
        getElemRefs('auto').options.length = 1;
        usunWszystkieMotory();
        hidediv('divMoroty');
        switch(select.selectedIndex){
          case 1:
            for(var i=0; i<AutaKreta.length; i++){
              optionAuta = document.createElement("option");
              optionAuta.setAttribute('value',AutaKreta[i]);
              getElemRefs('auto').appendChild(optionAuta);
              optionAuta.text = AutaKreta[i];
            }
            var motoryIle = MotoryKreta.length;
            if(motoryIle>0){
              showdiv('divMoroty');
              getElemRefs('motory').options.length = 1;
              for(var i=0; i<motoryIle; i++){
                optionMotory = document.createElement("option");
                optionMotory.value = MotoryKreta[i];
                getElemRefs('motory').appendChild(optionMotory);
                optionMotory.text = MotoryKreta[i];
              }
            }
          break; 
          case 2:
            for(var i=0; i<AutaRodos.length; i++){
              optionAuta = document.createElement("option");
              optionAuta.value = AutaRodos[i];
              getElemRefs('auto').appendChild(optionAuta);
              optionAuta.text = AutaRodos[i];
            }
            var motoryIle = MotoryRodos.length;
            if(motoryIle>0){
              showdiv('divMoroty');
              getElemRefs('motory').options.length = 1;
              for(var i=0; i<motoryIle; i++){
                optionMotory = document.createElement("option");
                optionMotory.value = MotoryRodos[i];
                getElemRefs('motory').appendChild(optionMotory);
                optionMotory.text = MotoryRodos[i];
              }
            }
          break; 
          case 3:
            for(var i=0; i<AutaKorfu.length; i++){
              optionAuta = document.createElement("option");
              optionAuta.value = AutaKorfu[i];
              getElemRefs('auto').appendChild(optionAuta);
              optionAuta.text = AutaKorfu[i];
            }
            var motoryIle = MotoryKorfu.length;
            if(motoryIle>0){
              showdiv('divMoroty');
              getElemRefs('motory').options.length = 1;
              for(var i=0; i<motoryIle; i++){
                optionMotory = document.createElement("option");
                optionMotory.value = MotoryKorfu[i];
                getElemRefs('motory').appendChild(optionMotory);
                optionMotory.text = MotoryKorfu[i];
              }
            }
          break;
          case 4:
            for(var i=0; i<AutaHal.length; i++){
              optionAuta = document.createElement("option");
              optionAuta.value = AutaHal[i];
              getElemRefs('auto').appendChild(optionAuta);
              optionAuta.text = AutaHal[i];
            }
            var motoryIle = MotoryHal.length;
            if(motoryIle>0){
              showdiv('divMoroty');
              getElemRefs('motory').options.length = 1;
              for(var i=0; i<motoryIle; i++){
                optionMotory = document.createElement("option");
                optionMotory.value = MotoryHal[i];
                getElemRefs('motory').appendChild(optionMotory);
                optionMotory.text = MotoryHal[i];
              }
            }
          break;
          case 5:
            for(var i=0; i<AutaSan.length; i++){
              optionAuta = document.createElement("option");
              optionAuta.value = AutaSan[i];
              getElemRefs('auto').appendChild(optionAuta);
              optionAuta.text = AutaSan[i];
            }
            var motoryIle = MotorySan.length;
            if(motoryIle>0){
              showdiv('divMoroty');
              getElemRefs('motory').options.length = 1;
              for(var i=0; i<motoryIle; i++){
                optionMotory = document.createElement("option");
                optionMotory.value = MotorySan[i];
                getElemRefs('motory').appendChild(optionMotory);
                optionMotory.text = MotorySan[i];
              }
            }
          break; 
          case 6:
            for(var i=0; i<AutaAteny.length; i++){
              optionAuta = document.createElement("option");
              optionAuta.value = AutaAteny[i];
              getElemRefs('auto').appendChild(optionAuta);
              optionAuta.text = AutaAteny[i];
            }
            var motoryIle = MotoryAteny.length;
            if(motoryIle>0){
              showdiv('divMoroty');
              getElemRefs('motory').options.length = 1;
              for(var i=0; i<motoryIle; i++){
                optionMotory = document.createElement("option");
                optionMotory.value = MotoryAteny[i];
                getElemRefs('motory').appendChild(optionMotory);
                optionMotory.text = MotoryAteny[i];
              }
            }
          break; 
          case 7:
            showdiv('divMoroty');
            getElemRefs('motory').options.length = 1;
            for(var i=0; i<AutaZak.length; i++){
              optionAuta = document.createElement("option");
              optionAuta.value = AutaZak[i];
              getElemRefs('auto').appendChild(optionAuta);
              optionAuta.text = AutaZak[i];
            }
            for(var i=0; i<MotoryZak.length; i++){
              optionMotory = document.createElement("option");
              optionMotory.value = MotoryZak[i];
              getElemRefs('motory').appendChild(optionMotory);
              optionMotory.text = MotoryZak[i];
            }
          break;
          case 8:
            for(var i=0; i<AutaKos.length; i++){
              optionAuta = document.createElement("option");
              optionAuta.value = AutaKos[i];
              getElemRefs('auto').appendChild(optionAuta);
              optionAuta.text = AutaKos[i];
            }
            var motoryIle = MotoryKos.length;
            if(motoryIle>0){
              showdiv('divMoroty');
              getElemRefs('motory').options.length = 1;
              for(var i=0; i<motoryIle; i++){
                optionMotory = document.createElement("option");
                optionMotory.value = MotoryKos[i];
                getElemRefs('motory').appendChild(optionMotory);
                optionMotory.text = MotoryKos[i];
              }
            }
          break;
        }
        
        
      }
