Advertisement
Guest User

Untitled

a guest
Dec 17th, 2014
17,430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // JavaScript Document
  2.  
  3. function escape_frame()
  4.          {
  5.          if (window != top)
  6.             {
  7.             alert(location.href);
  8.             top.location.href = location.href+'?checkJS=true';
  9.             }
  10.          }
  11.  
  12. function show_hide_element(id)
  13.          {
  14.          var styl=this.document.getElementById(id).style.display;
  15.          if (styl=="none")
  16.             {
  17.             this.document.getElementById(id).style.display="block";
  18.             }
  19.          else
  20.             {
  21.             this.document.getElementById(id).style.display="none";
  22.             }
  23.          }
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31. var tab_znakow = new Array("¡","±", "Ê","ê", "£", "³", "¬", "¼", "¯", "¿", "Æ", "æ", "¦", "¶", "Ñ", "ñ", "Ó", "ó");
  32. var pol = new Array("261","263","281","322","324","243","347","378","380","260","262","280","321","323","211","346","377","379");
  33. var pol_2 = new Array("185","230","234","179","241","243","156","159","191","165","198","202","163","209","211","140","143","175");
  34. var bez = new Array("97","99","101","108","110","111","115","122","122","65","67","69","76","78","79","83","90","90");
  35. var miesiace = ["1","3","5","7","8","10","12"];
  36.  
  37.  
  38.  
  39.  
  40.  
  41. function nrnip() {
  42. var NO = 0;
  43. var OK = 1;
  44. var suma = 0;
  45. var nip = 0;
  46.  
  47.     if(document.daneFirmy.nip.value.length == 0)
  48.         return OK;
  49.  
  50.     nip = document.daneFirmy.nip.value.replace(/[^0-9]/g,"");  
  51.     if(nip == 0)    
  52.         return NO;
  53.  
  54.     wagi = new Array(6,5,7,2,3,4,5,6,7);
  55.    
  56.     for (i = 0; i < 9; i++)
  57.         suma += nip.charAt(i)*wagi[i];
  58.  
  59.     if ((suma%11) != nip.charAt(9))
  60.         return NO;
  61.  
  62.     return OK;
  63. }
  64.  
  65. function tylko_cyfra(cyfra){
  66. var NO = 0;
  67. var OK = 1;
  68.  
  69.     if ( isNaN(cyfra) == 0 )
  70.         return OK;
  71.        
  72.     return NO;
  73. }
  74.  
  75. function telfax_OK(telfax) {
  76. var OK = 1;
  77. var NO = 0;
  78. var dlugosc = 0;
  79. var koniec = true;
  80.  
  81.     dlugosc = telfax.length;
  82.  
  83.     if (dlugosc == 0 )
  84.             return OK;
  85.  
  86.     for ( i  =  0;  i < dlugosc;  i++) {
  87.             if( telfax.charAt(i) == "(" || (isNaN(telfax.charAt(i)) == 0) || telfax.charAt(i) == ")" || telfax.charAt(i) == "-" || telfax.charAt(i) == " " || telfax.charAt(i) == "+")
  88.                     koniec = true;
  89.             else{
  90.                     koniec = false;
  91.                     return NO;
  92.             }
  93.     }
  94.  
  95.     return OK;
  96. }
  97.  
  98. function nipFirmyDaneKlienta_OK(nipfirmy) {
  99. var OK = 1;
  100. var NO = 0;
  101. var dlugosc = 0;
  102. var koniec = true;
  103.  
  104.     dlugosc = nipfirmy.length;
  105.  
  106.     if (dlugosc == 0 )
  107.             return OK;
  108.  
  109.     for ( i  =  0;  i < dlugosc;  i++) {
  110.             if( nipfirmy.charAt(i) == "(" || (isNaN(nipfirmy.charAt(i)) == 0) || nipfirmy.charAt(i) == ")" || nipfirmy.charAt(i) == "-" || nipfirmy.charAt(i) == " ")
  111.                     koniec = true;
  112.             else{
  113.                     koniec = false;
  114.                     return NO;
  115.             }
  116.     }
  117.  
  118.     return OK;
  119. }
  120.  
  121. function  kodpocz_OK(kod) {
  122. var OK = 1;
  123. var NO = 0;
  124. var error = 0;
  125.     var dlugosc = kod.length;
  126.     if(kod.charAt(2) =="-")
  127.     {
  128.         for(i = 0;  i < dlugosc;  i++){
  129.             if (i==0 || i==1 || i==3 || i==4){
  130.                 if((kod.charAt(i) >="A" && kod.charAt(i) <="Z") || (kod.charAt(i) >="a" && kod.charAt(i) <="z") || (kod.charAt(i) >="0" && kod.charAt(i) <="9")){
  131.                 }
  132.                 else{
  133.                     error = error+1;
  134.                 }
  135.             }
  136.             if (i==2){
  137.                 if((kod.charAt(i) >="A" && kod.charAt(i) <="Z") || (kod.charAt(i) >="a" && kod.charAt(i) <="z") || (kod.charAt(i) >="0" && kod.charAt(i) <="9") || (kod.charAt(i) =="-") || (kod.charAt(i) ==" ")){
  138.                 }
  139.                 else{
  140.                     error = error+1;
  141.                 }
  142.             }
  143.             if (i==5){
  144.                 if((kod.charAt(i) >="A" && kod.charAt(i) <="Z") || (kod.charAt(i) >="a" && kod.charAt(i) <="z") || (kod.charAt(i) >="0" && kod.charAt(i) <="9") || (kod.charAt(i) ==" ")){
  145.                 }
  146.                 else{
  147.                     error = error+1;
  148.                 }
  149.             }
  150.         }
  151.     }
  152.     else
  153.     {
  154.         for(i = 0;  i < dlugosc;  i++)
  155.         {
  156.             if((kod.charAt(i) >="A" && kod.charAt(i) <="Z") || (kod.charAt(i) >="a" && kod.charAt(i) <="z") || (kod.charAt(i) >="0" && kod.charAt(i) <="9") || (kod.charAt(i) =="-") || (kod.charAt(i) ==" "))
  157.             {}
  158.             else
  159.             {
  160.                 error = error+1;
  161.             }
  162.         }
  163.     }
  164.     if (error>0)
  165.         return NO;
  166.     else
  167.         return OK;
  168. }
  169. function  kodpocz_OK_pl(kod) {
  170. var OK = 1;
  171. var NO = 0;
  172. var error = 0;
  173.     var dlugosc = kod.length;
  174.     if (dlugosc !=6)
  175.          error = error+1;
  176.          for(i = 0;  i < dlugosc;  i++){
  177.             if (i==0 || i==1 || i==3 || i==4){
  178.                 if((kod.charAt(i) >="0" && kod.charAt(i) <="9")){
  179.                 }
  180.                 else{
  181.                     error = error+1;
  182.                 }
  183.             }
  184.             if (i==2){
  185.                 if((kod.charAt(i) =="-") || (kod.charAt(i) ==" ")){
  186.                 }
  187.                 else{
  188.                     error = error+1;
  189.                 }
  190.             }
  191.             if (i==5){
  192.                 if((kod.charAt(i) >="0" && kod.charAt(i) <="9") || (kod.charAt(i) ==" ")){
  193.                 }
  194.                 else{
  195.                     error = error+1;
  196.                 }
  197.             }
  198.         }
  199.  
  200.     if (error>0)
  201.         return NO;
  202.     else
  203.         return OK;
  204. }
  205.  
  206. function poprawny_email(email) {
  207. var OK = 1;
  208. var NO = 0;
  209. var dobryEmail=/^[^@]+@([a-z0-9\-]+\.)+[a-z]{2,8}$/i;
  210.  
  211. if (dobryEmail.test(email))
  212.     return OK;
  213. else
  214.     return NO;
  215. }
  216.  
  217. function dlugosc_pol(dlug) {
  218. var minimalna = 6
  219. var maksymalna = 30
  220. var NO = 0
  221. var OK = 1
  222.  
  223.     if(dlug < minimalna || dlug > maksymalna)  
  224.     return NO
  225.     else
  226.     return OK
  227. }
  228. function dlugosc_pol_haslo(dlug) {
  229. var minimalna = 8
  230. var maksymalna = 15
  231. var NO = 0
  232. var OK = 1
  233.  
  234.     if(dlug < minimalna || dlug > maksymalna)  
  235.     return NO
  236.     else
  237.     return OK
  238. }
  239.  
  240. function polska_litera(litera) {
  241. var NO = 0;
  242. var OK = 1;
  243.  
  244.     var tab_dl = tab_znakow.length;
  245.  
  246.     for(j = 0; j <= tab_dl; j++) {
  247.             if(litera == tab_znakow[j] ) {
  248.                 return OK;
  249.             }
  250.     }
  251.  
  252.     return NO;
  253. }
  254.  
  255. function tylko_litery(wyraz) {
  256. var OK = 1
  257. var NO = 0
  258.  
  259.     wyraz = wyraz.toUpperCase();
  260.  
  261.     var dlugosc = wyraz.length;
  262.  
  263.     for(i = 0;  i < dlugosc;  i++){
  264.             if(wyraz.charAt(i) <"A" && wyraz.charAt(i) != "-" && wyraz.charAt(i)  != " " && wyraz.charAt(i) != "." && wyraz.charAt(i) != "&" && wyraz.charAt(i) != "_" ) {
  265.                 if(polska_litera(wyraz.charAt(i) ) == 0 )
  266.                             return NO;
  267.             }
  268.             if(wyraz.charAt(i) >"Z" && wyraz.charAt(i) != "-" && wyraz.charAt(i)  != " " && wyraz.charAt(i) != "." && wyraz.charAt(i) != "&" && wyraz.charAt(i) != "_") {  
  269.  
  270.                 if(wyraz.charCodeAt(i) >188)
  271.                     continue;
  272.                 else
  273.                 {
  274.                  if(polska_litera(wyraz.charAt(i) ) == 0 )
  275.                         return NO;
  276.                 else
  277.                    continue;
  278.                 }
  279.             }
  280.     }
  281.     var licznik = 0;
  282.     for(i = 0;  i < dlugosc;  i++){
  283.             if(wyraz.charAt(i) == "-" || wyraz.charAt(i)  == " " || wyraz.charAt(i) == "." || wyraz.charAt(i) == "&" || wyraz.charAt(i) == "_") {
  284.                 licznik++;
  285.             }
  286.     }
  287.     if (dlugosc > 0)
  288.     if (licznik==dlugosc)
  289.     {
  290.         return NO;
  291.     }
  292.     return OK;
  293. }
  294.  
  295. function tylko_litery_i_cyfry(wyraz)
  296. {
  297.     var OK = 1
  298.     var NO = 0
  299.  
  300.     wyraz = wyraz.toUpperCase();
  301.  
  302.     var dlugosc = wyraz.length;
  303.  
  304.     for (i = 0; i < dlugosc; i++)
  305.     {
  306.         if (wyraz.charAt(i) < "A" && wyraz.charAt(i) != "-" && wyraz.charAt(i) != " " && wyraz.charAt(i) != "." && wyraz.charAt(i) != "&" && wyraz.charAt(i) != "_" && wyraz.charAt(i) != "0" && wyraz.charAt(i) != "1" && wyraz.charAt(i) != "2" && wyraz.charAt(i) != "3"  && wyraz.charAt(i) != "4" && wyraz.charAt(i) != "4" && wyraz.charAt(i) != "5" && wyraz.charAt(i) != "7" && wyraz.charAt(i) != "8" && wyraz.charAt(i) != "9")
  307.         {
  308.             if (polska_litera(wyraz.charAt(i)) == 0)
  309.                 return NO;
  310.         }
  311.         if (wyraz.charAt(i) > "Z" && wyraz.charAt(i) != "-" && wyraz.charAt(i) != " " && wyraz.charAt(i) != "." && wyraz.charAt(i) != "&" && wyraz.charAt(i) != "_" && wyraz.charAt(i) != "0" && wyraz.charAt(i) != "1" && wyraz.charAt(i) != "2" && wyraz.charAt(i) != "3"  && wyraz.charAt(i) != "4" && wyraz.charAt(i) != "4" && wyraz.charAt(i) != "5" && wyraz.charAt(i) != "7" && wyraz.charAt(i) != "8" && wyraz.charAt(i) != "9")
  312.         {
  313.  
  314.             if (wyraz.charCodeAt(i) > 188)
  315.                 continue;
  316.             else
  317.             {
  318.                 if (polska_litera(wyraz.charAt(i)) == 0)
  319.                     return NO;
  320.                 else
  321.                     continue;
  322.             }
  323.         }
  324.     }
  325.     var licznik = 0;
  326.     for (i = 0; i < dlugosc; i++)
  327.     {
  328.         if (wyraz.charAt(i) == "-" || wyraz.charAt(i) == " " || wyraz.charAt(i) == "." || wyraz.charAt(i) == "&" || wyraz.charAt(i) == "_") {
  329.             licznik++;
  330.         }
  331.     }
  332.     if (dlugosc > 0)
  333.         if (licznik == dlugosc)
  334.         {
  335.             return NO;
  336.         }
  337.     return OK;
  338. }
  339.  
  340. function nie_tylko_litery(wyraz) {
  341.    
  342.     var OK = 1
  343.     var NO = 0
  344.  
  345.    
  346.     wyraz = wyraz.toUpperCase();
  347.  
  348.     var dlugosc = wyraz.length;
  349.  
  350.     for(i = 0;  i < dlugosc;  i++){        
  351.            
  352.             if(wyraz.charAt(i) <"A"
  353.                     && wyraz.charAt(i) != "-"
  354.                         && wyraz.charAt(i)  != " "
  355.                             && wyraz.charAt(i) != "."
  356.                                 && wyraz.charAt(i) != "&"
  357.                                     && wyraz.charAt(i) != "_"
  358.                                         && wyraz.charAt(i) != "\""
  359.                                             && wyraz.charAt(i) != "'"
  360.                            
  361.             ) {                
  362.                 if(polska_litera(wyraz.charAt(i) ) == 0 )
  363.                             return NO;
  364.             }
  365.             if(wyraz.charAt(i) >"Z"
  366.                        && wyraz.charAt(i) != "-"
  367.                             && wyraz.charAt(i)  != " "
  368.                                 && wyraz.charAt(i) != "."
  369.                                     && wyraz.charAt(i) != "&"
  370.                                         && wyraz.charAt(i) != "_"
  371.                                             && wyraz.charAt(i) != "\""
  372.                                                 && wyraz.charAt(i) != "'"
  373.             ) {  
  374.  
  375.                 if(wyraz.charCodeAt(i) >188)
  376.                     continue;
  377.                 else
  378.                 {
  379.                  if(polska_litera(wyraz.charAt(i) ) == 0 )
  380.                         return NO;
  381.                 else
  382.                    continue;
  383.                 }
  384.             }
  385.     }
  386.     var licznik = 0;
  387.     for(i = 0;  i < dlugosc;  i++){
  388.             if(wyraz.charAt(i) == "-"
  389.                         || wyraz.charAt(i)  == " "
  390.                             || wyraz.charAt(i) == "."
  391.                                 || wyraz.charAt(i) == "&"
  392.                                     || wyraz.charAt(i) == "_"
  393.                                         || wyraz.charAt(i) == "\""
  394.                                             || wyraz.charAt(i) == "'"
  395.              ) {
  396.                 licznik++;
  397.             }
  398.     }
  399.     if (dlugosc > 0)
  400.     if (licznik==dlugosc)
  401.     {
  402.         return NO;
  403.     }
  404.     return OK;
  405. }
  406.  
  407. function rok_przestepny(rok) {
  408. var OK = true;
  409. var NO = false;
  410. var  podziel_4 = 0;
  411. var podziel_100 = 0;
  412. var podziel_400 = 0;
  413.  
  414.     podziel_4 = rok % 4;
  415.  
  416.     if( podziel_4 == 0 ) {
  417.             podziel_100 = rok % 100;
  418.             podziel_400 = rok% 400;
  419.  
  420.             if(podziel_100 != 0 || podziel_400 == 0) {
  421.                             return OK;
  422.                     }
  423.     }
  424.  
  425.     return NO;
  426. }
  427.  
  428.  
  429.  
  430. function poprawna_podphasla(inf) {
  431. var OK = 1;
  432. var NO = 0;
  433. var dobryEmail=/^[^@]+@([a-z0-9\-]+\.)+[a-z]{2,4}$/i;
  434.  
  435. if ((dobryEmail.test(document.podpHasla.email.value)) && (document.podpHasla.login.value.length>5)){
  436.     document.podpHasla.submit();
  437.     }
  438. else {
  439.     alert (inf);
  440.     }
  441. }
  442.  
  443.  
  444.  
  445.  
  446. function jest_ok(info)
  447. {
  448. var OK = 1;
  449. var NO = 0;
  450.  
  451.     if(document.logowanie.login.value=="" || document.logowanie.haslo.value==""){
  452.         alert(info);
  453.  
  454.         if(document.logowanie.haslo.value=="")
  455.             document.logowanie.haslo.focus();
  456.  
  457.         if(document.logowanie.login.value=="")
  458.             document.logowanie.login.focus();
  459.  
  460.         return NO;      
  461.     }
  462.     document.logowanie.submit();
  463.    
  464.     return OK;
  465. }
  466.  
  467.  
  468. function login_Klienta(){
  469.  
  470.     if (navigator.appVersion.indexOf("MSIE")>0)
  471.         pol ;
  472.     else
  473.         pol_2;
  474.    
  475.     bez;
  476.  
  477.     tekst = document.logowanie.login.value;
  478.  
  479.     for (var i=0; i < pol.length; i++) {
  480.         regexp = eval("/"+String.fromCharCode(pol[i])+"/g");
  481.         tekst=tekst.replace(regexp,String.fromCharCode(bez[i]));
  482.     }
  483.     document.logowanie.login.value = tekst;
  484. }
  485.  
  486. function login_Klienta3(){
  487.  
  488.     if (navigator.appVersion.indexOf("MSIE")>0)
  489.         pol ;
  490.     else
  491.         pol_2;
  492.    
  493.     bez;
  494.  
  495.     tekst = document.podpHasla.login.value;
  496.  
  497.     for (var i=0; i < pol.length; i++) {
  498.         regexp = eval("/"+String.fromCharCode(pol[i])+"/g");
  499.         tekst=tekst.replace(regexp,String.fromCharCode(bez[i]));
  500.     }
  501.     document.podpHasla.login.value = tekst;
  502. }
  503.  
  504.  
  505.  
  506.  
  507. function drugie_haslo(logowanie_admin, tekst)
  508. {
  509.     if(document.logowanie_admin.haslo2.value==""){
  510.     alert(tekst)
  511.  
  512.         if(document.logowanie_admin.haslo2.value=="")
  513.             document.logowanie_admin.haslo2.focus()
  514.     }
  515.     else
  516.         document.logowanie_admin.submit();
  517. }
  518.  
  519. function litery_liczby(wyraz) {
  520. var OK = 1
  521. var NO = 0
  522.  
  523.    
  524.     reg2 = /^[0-9]{1,15}/;
  525.     wyn2 = wyraz.match(reg2);
  526.     reg3 = /^[a-zA-Z]{1,15}/;
  527.     wyn3 = wyraz.match(reg3);
  528.  
  529.     if ( wyn2 && wyn3)
  530.         return OK;
  531.  
  532.     return NO;  
  533. }
  534.  
  535. function litery_liczby_login(wyraz) {
  536. var OK = 1
  537. var NO = 0
  538.  
  539.     reg = /^[0-9a-zA-Z\.\_\\\s\\\-\\\&@!]{1,30}$/i;
  540.     wyn = wyraz.match(reg);
  541.    
  542.     if (wyn)
  543.         return OK;
  544.  
  545.     return NO;  
  546. }
  547.  
  548. function litery_liczby_spacja(wyraz) {
  549. var OK = 1
  550. var NO = 0
  551.  
  552.     reg = /^[0-9a-zA-Z\.\_\\\s\\\-\\\&]{1,50}$/;
  553.     reg2 = /[^\\\"\\\']{1,50}$/;
  554.     wyn = wyraz.match(reg);
  555.     wyn2 = wyraz.match(reg2);
  556.  
  557.     if(!wyn || !wyn2){
  558.         return NO;
  559.     }
  560.     return OK;
  561. }
  562.  
  563.  
  564. function nrdok_Klient(inf){
  565. var OK = 1;
  566. var NO = 0;
  567. var dlugosc = 0;
  568.  
  569.     document.daneKlienta.nrdok.value = document.daneKlienta.nrdok.value.toUpperCase();
  570.  
  571.     dlugosc = document.daneKlienta.nrdok.value.length;
  572.     if(dlugosc == 0)
  573.             return OK;
  574.    
  575.     reg = /^[A-Z0-9\-\\\s\\\\\/]{1,30}$/;
  576.  
  577.     wyn = daneKlienta.nrdok.value.match(reg);
  578.  
  579.     if(!wyn){
  580.         alert(inf);
  581.         document.daneKlienta.nrdok.focus();
  582.         return NO;
  583.     }
  584.  
  585.     return OK;
  586. }    
  587.  
  588. function adresIP_User(inf){
  589. var OK = 1;
  590. var NO = 0;
  591. var dlugosc = 0;
  592.  
  593.     dlugosc = document.daneKlienta.adminip.length;
  594.     if(dlugosc == 0)
  595.             return OK;
  596.  
  597.     reg = /^[0-9\*\:\.\;\\\s]{1,500}$/;
  598.     regC = /^[0-9]{1,500}$/;
  599.     regK = /[.]{1,500}$/;
  600.     regS = /[;]{1,500}$/;
  601.     regD = /[:]{1,500}$/;
  602.  
  603.     wyn = daneKlienta.adminip.value.match(reg);
  604.     wynC = daneKlienta.adminip.value.match(regC);
  605.     wynK = daneKlienta.adminip.value.match(regK);
  606.     wynS = daneKlienta.adminip.value.match(regS);
  607.  
  608.     if(!wyn || wynC || wynK || wynS){
  609.         alert(inf);
  610.        
  611.         document.daneKlienta.adminip.focus();
  612.         return NO;
  613.     }
  614.  
  615.     return OK;
  616. }
  617.  
  618. function login_Klienta2(inf){
  619. var NO = 0;
  620. var OK = 1;
  621.  
  622.     if(document.daneKlienta.login.value.length == 0)
  623.         return OK;
  624.  
  625.     if (navigator.appVersion.indexOf("MSIE")>0)
  626.         pol ;
  627.     else
  628.         pol_2;
  629.    
  630.     bez;
  631.  
  632.     tekst = document.daneKlienta.login.value;
  633.  
  634.     for (var i=0; i < pol.length; i++) {
  635.         regexp = eval("/"+String.fromCharCode(pol[i])+"/g");
  636.         tekst=tekst.replace(regexp,String.fromCharCode(bez[i]));
  637.     }
  638.     document.daneKlienta.login.value = tekst;
  639.  
  640.     if(dlugosc_pol(document.daneKlienta.login.value.length) == 0 || litery_liczby_login(document.daneKlienta.login.value) == 0){
  641.         alert(inf);
  642.         document.daneKlienta.login.focus();
  643.         return NO;
  644.     }
  645.     return OK;
  646. }
  647.  
  648. function login_USERA(inf){
  649. var NO = 0;
  650. var OK = 1;
  651.  
  652.     if(document.daneKlienta.login.value.length == 0)
  653.         return OK;
  654.  
  655.     if (navigator.appVersion.indexOf("MSIE")>0)
  656.         pol ;
  657.     else
  658.         pol_2;
  659.    
  660.     bez;
  661.  
  662.     tekst = document.daneKlienta.login.value;
  663.  
  664.     for (var i=0; i < pol.length; i++) {
  665.         regexp = eval("/"+String.fromCharCode(pol[i])+"/g");
  666.         tekst=tekst.replace(regexp,String.fromCharCode(bez[i]));
  667.     }
  668.     document.daneKlienta.login.value = tekst;
  669.  
  670.     if(dlugosc_pol(document.daneKlienta.login.value.length) == 0 || litery_liczby_spacja(document.daneKlienta.login.value) == 0){
  671.         alert(inf);
  672.         document.daneKlienta.login.focus();
  673.         return NO;
  674.     }
  675.     return OK;
  676. }
  677.  
  678. function nowehaslo_Klienta(inf){
  679. var OK = 1;
  680. var NO = 0;
  681.  
  682.     if(document.daneKlienta.haslo.value.length == 0)
  683.         return OK;
  684.  
  685.     if(dlugosc_pol_haslo(document.daneKlienta.haslo.value.length) == 0 ){
  686.         alert(inf);
  687.         document.daneKlienta.haslo.value = "";
  688.         document.daneKlienta.haslo.focus();
  689.         return NO;
  690.     }
  691.    
  692.     return OK;
  693. }
  694.  
  695. function dodhaslo_Usera(inf){
  696. var OK = 1;
  697. var NO = 0;
  698.  
  699.     if(document.daneKlienta.haslo2.value.length == 0)
  700.         return OK;
  701.  
  702.     if(dlugosc_pol(document.daneKlienta.haslo2.value.length) == 0 || litery_liczby(document.daneKlienta.haslo2.value) == 0){
  703.         alert(inf);
  704.         document.daneKlienta.haslo2.value = "";
  705.         document.daneKlienta.haslo2.focus();
  706.         return NO;
  707.     }
  708.    
  709.     return OK;
  710. }
  711.  
  712. function powthasla_Klienta(inf){
  713. var OK = 1;
  714. var NO = 0;
  715.  
  716.     if(document.daneKlienta.powt_hasla.value == 0)
  717.         return OK;
  718.  
  719.     if(document.daneKlienta.haslo.value != document.daneKlienta.powt_hasla.value){
  720.         alert(inf);
  721.         document.daneKlienta.powt_hasla.focus();
  722.         return NO;
  723.     }
  724.  
  725.  return OK;
  726. }
  727.  
  728. function email_Klienta(inf){
  729. var OK = 1;
  730. var NO = 0;
  731. var dlugosc = 0;
  732.  
  733.     dlugosc = document.daneKlienta.email.value.length;
  734.  
  735.     if(dlugosc == 0)
  736.             return OK;
  737.  
  738.     if(poprawny_email(document.daneKlienta.email.value)== 0){
  739.             alert(inf);
  740.             document.daneKlienta.email.focus();
  741.             return NO;
  742.     }
  743.  
  744.     return OK;
  745. }
  746.  
  747. function poprawna_nazwa(nazwa) {
  748. var OK = 1;
  749. var NO = 0;
  750. var i=0;
  751.  
  752. var str = nazwa.split(/\s/g);
  753.  
  754.  
  755.  
  756. while(str[i]!=undefined){
  757.    
  758.     if (str[i].length<1){        
  759.         return NO;
  760.     }
  761.     i=i+1;
  762. }
  763. if (i==1){    
  764.     return NO;
  765. }
  766. return OK;
  767.  
  768. }
  769.  
  770. function validateImieNazwisko(inf){
  771. var OK = 1;
  772. var NO = 0;
  773.  
  774. var pattern = /^([a-zA-Z]{1,40}\s*){2,}$/;
  775.  
  776.     //if(poprawna_nazwa(document.daneKlienta.nazwa.value)== 0){
  777.     if(!pattern.test(document.daneKlienta.nazwa.value)) {
  778.             alert(inf);
  779.             document.daneKlienta.nazwa.focus();
  780.             return NO;
  781.     }
  782.    
  783.     return OK;
  784. }
  785.  
  786.  
  787.  
  788.  
  789. function nazwa_daneKlienta(inf){
  790. var OK = 1;
  791. var NO = 0;
  792.  
  793. var pattern = /^([a-zA-Z]{2,40}\s*){2,}$/;
  794.  
  795.     //if(poprawna_nazwa(document.daneKlienta.nazwa.value)== 0){
  796.     if(!pattern.test(document.daneKlienta.nazwa.value)) {
  797.             alert(inf);
  798.             document.daneKlienta.nazwa.focus();
  799.             return NO;
  800.     }
  801.     return OK;
  802. }
  803.  
  804. function nazwa_daneKlientaForm(inf){
  805. var OK = 1;
  806. var NO = 0;
  807.  
  808.     if(poprawna_nazwa(document.listaUzytkFormNazwa.nazwaUzytkownika.value)== 0){
  809.             alert(inf);
  810.             document.listaUzytkFormNazwa.nazwaUzytkownika.focus();
  811.             return NO;
  812.     }
  813.     else{
  814.         document.listaUzytkFormNazwa.submit();
  815.         }
  816. }
  817.  
  818. function nazwa_daneKlienta_rezH(inf){
  819. var OK = 1;
  820. var NO = 0;
  821.  
  822.     if(poprawna_nazwa(document.rkh.dla.value)== 0){
  823.             alert(inf);
  824.             document.rkh.dla.focus();
  825.             return NO;
  826.     }
  827.     return OK;
  828. }
  829. function jakiwyjazd(){
  830.     if(document.rkh.wyjazdsluzbowy.checked ==  false) {
  831.             alert ("Wyjazd prywatny")
  832.             document.daneKlienta.zgoda.focus();
  833.  
  834.     }
  835. else
  836. {           alert ("Wyjazd prywatny")
  837.             document.daneKlienta.zgoda.focus();
  838. }
  839. }
  840. function  kod_Klienta_pl(inf, kraj) {
  841. var NO = 0;
  842. var OK = 1;
  843. var dlugosc = 0;
  844.  
  845.     dlugosc = document.daneKlienta.kodpocztowy.value.length;
  846.  
  847.     if(dlugosc == 0)
  848.             return OK;
  849. if (kraj>0)
  850.     if (kodpocz_OK(document.daneKlienta.kodpocztowy.value) == 0){
  851.             alert(inf);
  852.             document.daneKlienta.kodpocztowy.focus();
  853.             return NO;
  854.     }
  855. if (kraj==0)
  856.     if (kodpocz_OK_pl(document.daneKlienta.kodpocztowy.value) == 0){
  857.             alert(inf);
  858.             document.daneKlienta.kodpocztowy.focus();
  859.             return NO;
  860.     }
  861.  
  862.     return OK;
  863. }
  864.  
  865. function  kod_Klienta(inf) {
  866. var NO = 0;
  867. var OK = 1;
  868. var dlugosc = 0;
  869.  
  870.     dlugosc = document.daneKlienta.kodpocztowy.value.length;
  871.  
  872.     if(dlugosc == 0)
  873.             return OK;
  874.  
  875.     if (kodpocz_OK(document.daneKlienta.kodpocztowy.value) == 0){
  876.             alert(inf);
  877.             document.daneKlienta.kodpocztowy.focus();
  878.             return NO;
  879.     }
  880.  
  881.     return OK;
  882. }
  883.  
  884. function nazwa_miasta(inf) {
  885. var NO = 0;
  886. var OK = 1;
  887. var dlugosc = 0;
  888.  
  889.  
  890.     dlugosc = document.daneKlienta.miasto.length;
  891.  
  892.     if(dlugosc == 0)
  893.             return OK;
  894.     else
  895.     if( nie_tylko_litery(document.daneKlienta.miasto.value) == 0) {
  896.             alert(inf);
  897.             document.daneKlienta.miasto.focus();
  898.             return NO;
  899.     }
  900.  
  901.     return OK;
  902. }
  903.  
  904. function telefon_Klienta(inf) {
  905. var OK = 1;
  906. var NO = 0;
  907. var dlugosc = 0;
  908.  
  909.     dlugosc = document.daneKlienta.tel.length;
  910.  
  911.     if(dlugosc == 0)
  912.             return OK;
  913.  
  914.     if (telfax_OK(document.daneKlienta.tel.value) == 0){
  915.             alert(inf);
  916.             document.daneKlienta.tel.focus();
  917.             return NO;
  918.     }
  919.     return OK;
  920. }
  921.  
  922. function fax_Klienta(inf) {
  923. var OK = 1;
  924. var NO = 0;
  925. var dlugosc = 0;
  926.  
  927.     dlugosc = document.daneKlienta.fax.length;
  928.  
  929.     if(dlugosc == 0)
  930.             return OK;
  931.  
  932.     if (telfax_OK(document.daneKlienta.fax.value) == 0){
  933.             alert(inf);
  934.             document.daneKlienta.fax.focus();
  935.             return NO;
  936.     }
  937.     return OK;
  938. }
  939. function nazwaUzytkownikaFirmy(inf){
  940. var OK = 1;
  941. var NO = 0;
  942.    
  943.     if(tylko_litery(document.daneKlienta.nazwafirmy.value)==0){
  944.         alert(inf);
  945.         document.daneKlienta.nazwafirmy.focus();
  946.         return NO;
  947.     }
  948.     return OK;
  949. }
  950.  
  951. function  kod_Firmy(inf) {
  952. var NO = 0;
  953. var OK = 1;
  954. var dlugosc = 0;
  955.  
  956.     dlugosc = document.daneKlienta.kodpocztowyfirmy.value.length;
  957.  
  958.     if(dlugosc == 0)
  959.             return OK;
  960.  
  961.     if (kodpocz_OK(document.daneKlienta.kodpocztowyfirmy.value) == 0){
  962.             alert(inf);
  963.             document.daneKlienta.kodpocztowyfirmy.focus();
  964.             return NO;
  965.     }
  966.  
  967.     return OK;
  968. }
  969.  
  970. function nazwa_miastafirmy(inf) {
  971. var NO = 0;
  972. var OK = 1;
  973. var dlugosc = 0;
  974.  
  975.     dlugosc = document.daneKlienta.miastofirmy.length;
  976.  
  977.     if(dlugosc == 0)
  978.             return OK;
  979.  
  980.  if(dlugosc > 0)  
  981. if( tylko_litery(document.daneKlienta.miastofirmy.value) == 0) {
  982.             alert(inf);
  983.             document.daneKlienta.miastofirmy.focus();
  984.             return NO;
  985.     }
  986.  
  987.     return OK;
  988. }
  989.  
  990. function kompletnosc_danychUsera(pracSprzed, idUsera, idAjent, ifPracSprzed, login, email, haslo, powthasla, rodzdoktoz, nrdoktoz, firma, rodzuzytk, imienazwisko, infnrdok, adres, kodpoczt, infkod, miasto, infmiasto, poprpola, inf1, inf2, kodpocztfirmy, infkodpocztfirmy, miastofirmy, infmiastofirmy, polafirmy){
  991. var pola = "";
  992. var koniec = false;
  993.  
  994. //    if(document.daneKlienta.uzytktypkod.value==pracSprzed && document.daneKlienta.adminip.value.length ==0){
  995. //        alert(ifPracSprzed);
  996. //        koniec=true;
  997. //    }
  998.  
  999.     if(document.daneKlienta.login.value=="" || dlugosc_pol(document.daneKlienta.login.value.length) == 0){
  1000.     pola+=" - " + login + "\n";
  1001.     koniec=true;
  1002.     }
  1003.    
  1004.     if(document.daneKlienta.email.value=="" || poprawny_email(document.daneKlienta.email.value) == 0 ){
  1005.     pola+=" - " + email + "\n";
  1006.     koniec=true;
  1007.     }
  1008.  
  1009.     if(document.daneKlienta.haslo.value=="" || dlugosc_pol_haslo(document.daneKlienta.haslo.value.length) == 0 || litery_liczby(document.daneKlienta.haslo.value) == 0){
  1010.     pola+=" - " +  haslo + "\n";
  1011.     koniec=true;
  1012.     }
  1013.  
  1014.     if(document.daneKlienta.powt_hasla.value=="" || document.daneKlienta.haslo.value != document.daneKlienta.powt_hasla.value){
  1015.     pola+=" - " + powthasla + "\n";
  1016.     koniec=true;
  1017.     }
  1018.  
  1019.     if(document.daneKlienta.typdok.value==""){
  1020.     pola+=" - " + rodzdoktoz + "\n";
  1021.     koniec=true;
  1022.     }
  1023.  
  1024.     if(document.daneKlienta.nrdok.value=="" || nrdok_Klient(infnrdok) == 0){
  1025.     pola+=" - " + nrdoktoz + "\n";
  1026.     koniec=true;
  1027.     }
  1028.  
  1029.     if(document.daneKlienta.firmaid.value==""){
  1030.     pola+=" - " + firma + "\n";
  1031.     koniec=true;
  1032.     }
  1033.  
  1034. //    if(document.daneKlienta.uzytktypkod.value==""){
  1035. //  pola+=" - " + rodzuzytk + "\n";
  1036. //  koniec=true;
  1037. //   }
  1038.  
  1039.     if(document.daneKlienta.nazwa.value=="" || tylko_litery(document.daneKlienta.nazwa.value) == 0){
  1040.     pola+=" - " +  imienazwisko + "\n";
  1041.     koniec=true;
  1042.     }
  1043.  
  1044.    if(document.daneKlienta.ulica.value==""){
  1045.     pola+=" - " + adres + "\n";
  1046.     koniec=true;
  1047.     }
  1048.  
  1049.     if(document.daneKlienta.kodpocztowy.value=="" || kod_Klienta(infkod) == 0){
  1050.     pola+=" - " + kodpoczt + "\n";
  1051.     koniec=true;
  1052.     }
  1053.  
  1054.     if(document.daneKlienta.miasto.value=="" || nazwa_miasta(infmiasto) == 0){
  1055.     pola+=" - " + miasto + "\n";
  1056.     koniec=true;
  1057.     }
  1058.  
  1059. //    if(indywidualny(idUsera, idAjent) == 0){
  1060. //        koniec=true;
  1061. //    }
  1062.  
  1063.     if (daneKlienta.uzytktypkod.value==990) {
  1064.  
  1065.     if(document.daneKlienta.kodpocztowyfirmy.value=="" || kod_Firmy(infkodpocztfirmy) == 0){
  1066.     pola+=" - " + kodpocztfirmy + "\n";
  1067.     koniec=true;
  1068.     }
  1069.    
  1070.     if(document.daneKlienta.miastofirmy.value=="" || nazwa_miastafirmy(infmiastofirmy) == 0){
  1071.     pola+=" - " + miastofirmy + "\n";
  1072.     koniec=true;
  1073.     }
  1074.  
  1075.     var nip = 0;
  1076.     var nazwa = "";
  1077.     var adres = "";
  1078.     var kod = "";
  1079.     var miasto = "";
  1080.  
  1081.     nazwa = document.daneKlienta.nazwafirmy.value;
  1082.     nip = document.daneKlienta.nipfirmy.value.length;
  1083.     adres = document.daneKlienta.ulicafirmy.value;
  1084.     kod = document.daneKlienta.kodpocztowyfirmy.value;
  1085.     miasto = document.daneKlienta.miastofirmy.value;
  1086.     if (nazwa != "" && (nip == 0 || adres == "" || kod == "" || miasto == "")){
  1087.         pola+=" - " + polafirmy + "\n";
  1088.         koniec=true;
  1089.     }
  1090.     else {
  1091.         if (nip != 0 && (nazwa == "" || adres == "" || kod == "" || miasto == "")){
  1092.         pola+=" - " + polafirmy + "\n";
  1093.         koniec=true;
  1094.         }
  1095.         else {
  1096.             if (adres != "" && (nip == 0 || nazwa == "" || kod == "" || miasto == "")){
  1097.             pola+=" - " + polafirmy + "\n";
  1098.             koniec=true;
  1099.             }
  1100.             else {
  1101.                 if (kod != "" && (nip == 0 || adres == "" || nazwa == "" || miasto == "")){
  1102.                 pola+=" - " + polafirmy + "\n";
  1103.                 koniec=true;
  1104.                 }
  1105.                 else {
  1106.                     if (miasto != "" && (nip == 0 || adres == "" || kod == "" || nazwa == "")){
  1107.                     pola+=" - " + polafirmy + "\n";
  1108.                     koniec=true;
  1109.                     }
  1110.                 }
  1111.             }
  1112.         }
  1113.     }
  1114. }
  1115.     if(!koniec){
  1116.         document.daneKlienta.submit();
  1117.     }
  1118.     else {
  1119.         if(pola != ""){
  1120.             alert(poprpola + ":\n" + pola);
  1121.     }
  1122.     }
  1123. }
  1124.  
  1125. function kompletnosc_danych(kraj, login, imienazwisko, nowehaslo, powthasla, email, adres, kodpoczt, infkod, miasto, infmiasto, rodzdoktoz, nrdoktoz, wyrzgody, infnrdok, poprpola, kodpocztfirmy, infkodpocztfirmy, miastofirmy, infmiastofirmy, polafirmy, polawysylka){
  1126. var pola = "";
  1127. var koniec = false;
  1128. var bladWysylka = false;
  1129.  
  1130.     if(document.daneKlienta.login.value=="" || dlugosc_pol(document.daneKlienta.login.value.length) == 0){
  1131.     pola+=" - " + login + "\n";
  1132.     koniec=true;
  1133.     }
  1134.  
  1135.     if(document.daneKlienta.nazwa.value=="" || tylko_litery(document.daneKlienta.nazwa.value) == 0 ){
  1136.     pola+=" - " +  imienazwisko + "\n";
  1137.     koniec=true;
  1138.     }
  1139.  
  1140.     if(document.daneKlienta.haslo.value=="" || dlugosc_pol_haslo(document.daneKlienta.haslo.value.length) == 0 || litery_liczby(document.daneKlienta.haslo.value) == 0){
  1141.     pola+=" - " +  nowehaslo + "\n";
  1142.     koniec=true;
  1143.     }
  1144.  
  1145.     if(document.daneKlienta.powt_hasla.value=="" || document.daneKlienta.haslo.value != document.daneKlienta.powt_hasla.value){
  1146.     pola+=" - " + powthasla + "\n";
  1147.     koniec=true;
  1148.     }
  1149.  
  1150.     if(document.daneKlienta.email.value=="" || (poprawny_email(document.daneKlienta.email.value) == 0) ){
  1151.     pola+=" - " + email + "\n";
  1152.     koniec=true;
  1153.     }
  1154.    
  1155.     if(document.daneKlienta.jesliFirma.checked == false){
  1156.    if(document.daneKlienta.ulica.value==""){
  1157.     pola+=" - " + adres + "\n";
  1158.     koniec=true;
  1159.     }
  1160.  
  1161.     if(document.daneKlienta.kodpocztowy.value=="" || kod_Klienta_pl(infkod, kraj) == 0){
  1162.     pola+=" - " + kodpoczt + "\n";
  1163.     koniec=true;
  1164.     }
  1165.  
  1166.     if(document.daneKlienta.miasto.value=="" || nazwa_miasta(infmiasto) == 0){
  1167.     pola+=" - " + miasto + "\n";
  1168.     koniec=true;
  1169.     }
  1170.     }
  1171.  
  1172.  
  1173. /*
  1174.    if(document.daneKlienta.jesliAdresWysylka.checked == true){
  1175.     var adresW = "";
  1176.     var kodW = "";
  1177.     var miastoW = "";
  1178.  
  1179.  
  1180.      adresW = document.daneKlienta.ulicaWysylka.value;
  1181.     kodW = document.daneKlienta.kodpocztowyWysylka.value;
  1182.     miastoW = document.daneKlienta.miastoWysylka.value;
  1183.  
  1184.        if(document.daneKlienta.ulicaWysylka.value==""){
  1185.             bladWysylka=true;
  1186.         }
  1187.  
  1188.         if(document.daneKlienta.kodpocztowyWysylka.value=="" || kod_Klienta_pl(kodW,kraj) == 0){
  1189.           bladWysylka=true;
  1190.         }
  1191.  
  1192.         if(document.daneKlienta.miastoWysylka.value=="" || nazwa_miasta(miastoW) == 0){
  1193.           bladWysylka=true;
  1194.         }
  1195.         if (bladWysylka==true)
  1196.         {
  1197.             pola+=" - " + polawysylka + "\n";
  1198.             koniec=true;
  1199.  
  1200.         }
  1201.     }
  1202.     */
  1203.  
  1204.  
  1205.     var nip = 0;
  1206.     var nazwa = "";
  1207.     var adres = "";
  1208.     var kod = "";
  1209.     var miasto = "";
  1210.  
  1211.     nazwa = document.daneKlienta.nazwafirmy.value;
  1212.     nip = document.daneKlienta.nipfirmy.value.length;
  1213.     adres = document.daneKlienta.ulicafirmy.value;
  1214.     kod = document.daneKlienta.kodpocztowyfirmy.value;
  1215.     miasto = document.daneKlienta.miastofirmy.value;
  1216.     if(document.daneKlienta.jesliFirma.checked == true){
  1217.         if (nazwa == "" && nip == 0 && adres == "" && kod == "" && miasto == ""){
  1218.         pola+= polafirmy + "\n";
  1219.         koniec=true;
  1220.     }    
  1221.     }
  1222.     if (nazwa != "" && (nip == 0 || adres == "" || kod == "" || miasto == "")){
  1223.         pola+=polafirmy + "\n";
  1224.         koniec=true;
  1225.     }
  1226.     else {
  1227.         if (nip != 0 && (nazwa == "" || adres == "" || kod == "" || miasto == "")){
  1228.         pola+= polafirmy + "\n";
  1229.         koniec=true;
  1230.         }
  1231.         else {
  1232.             if (adres != "" && (nip == 0 || nazwa == "" || kod == "" || miasto == "")){
  1233.             pola+= polafirmy + "\n";
  1234.             koniec=true;
  1235.             }
  1236.             else {
  1237.                 if (kod != "" && (nip == 0 || adres == "" || nazwa == "" || miasto == "")){
  1238.                 pola+= polafirmy + "\n";
  1239.                 koniec=true;
  1240.                 }
  1241.                 else {
  1242.                     if (miasto != "" && (nip == 0 || adres == "" || kod == "" || nazwa == "")){
  1243.                     pola+= polafirmy + "\n";
  1244.                     koniec=true;
  1245.                     }
  1246.                 }
  1247.             }
  1248.         }
  1249.     }
  1250.   if(document.daneKlienta.akceptacja.checked == false){
  1251.  
  1252.     koniec=true;
  1253.     }
  1254.  
  1255.     if(!koniec){
  1256.    
  1257.             document.daneKlienta.submit();
  1258.    
  1259.     }
  1260.     else {
  1261.     if(pola != "")
  1262.             alert(poprpola + ":\n" + pola);
  1263.      else
  1264.          alert(wyrzgody);
  1265.  
  1266.     }
  1267.  
  1268. }
  1269.  
  1270. function kompletnosc_danych2(login, imienazwisko, nowehaslo, powthasla, email, adres, kodpoczt, infkod, miasto, infmiasto, rodzdoktoz, nrdoktoz, wyrzgody, infnrdok, poprpola, kodpocztfirmy, infkodpocztfirmy, miastofirmy, infmiastofirmy, polafirmy){
  1271. var pola = "";
  1272. var koniec = false;
  1273.  
  1274.     if(document.daneKlienta.login.value=="" || dlugosc_pol(document.daneKlienta.login.value.length) == 0){
  1275.     pola+=" - " + login + "\n";
  1276.     koniec=true;
  1277.     }
  1278.  
  1279.     if(document.daneKlienta.nazwa.value=="" || tylko_litery(document.daneKlienta.nazwa.value) == 0 || poprawna_nazwa(document.daneKlienta.nazwa.value) == 0){
  1280.     pola+=" - " +  imienazwisko + "\n";
  1281.     koniec=true;
  1282.     }
  1283.  
  1284.     if(document.daneKlienta.haslo.value=="" || dlugosc_pol_haslo(document.daneKlienta.haslo.value.length) == 0 ){
  1285.     pola+=" - " +  nowehaslo + "\n";
  1286.     koniec=true;
  1287.     }
  1288.  
  1289.     if(document.daneKlienta.powt_hasla.value=="" || document.daneKlienta.haslo.value != document.daneKlienta.powt_hasla.value){
  1290.     pola+=" - " + powthasla + "\n";
  1291.     koniec=true;
  1292.     }
  1293.  
  1294.     if(document.daneKlienta.email.value=="" || (poprawny_email(document.daneKlienta.email.value) == 0) ){
  1295.     pola+=" - " + email + "\n";
  1296.     koniec=true;
  1297.     }
  1298.    if(daneKlienta.uzytktypkod.value!=990){
  1299.    if(document.daneKlienta.ulica.value==""){
  1300.     pola+=" - " + adres + "\n";
  1301.     koniec=true;
  1302.     }
  1303.  
  1304.     if(document.daneKlienta.kodpocztowy.value=="" || kod_Klienta(infkod) == 0){
  1305.     pola+=" - " + kodpoczt + "\n";
  1306.     koniec=true;
  1307.     }
  1308.  
  1309.     if(document.daneKlienta.miasto.value=="" || nazwa_miasta(infmiasto) == 0){
  1310.     pola+=" - " + miasto + "\n";
  1311.     koniec=true;
  1312.     }
  1313.     }
  1314.  
  1315.     if (daneKlienta.uzytktypkod.value==990 && daneKlienta.firmaid.value==1) {
  1316.  
  1317.     var nip = 0;
  1318.     var nazwa = "";
  1319.     var adres = "";
  1320.     var kod = "";
  1321.     var miasto = "";
  1322.  
  1323.     nazwa = document.daneKlienta.nazwafirmy.value;
  1324.     nip = document.daneKlienta.nipfirmy.value.length;
  1325.     adres = document.daneKlienta.ulicafirmy.value;
  1326.     kod = document.daneKlienta.kodpocztowyfirmy.value;
  1327.     miasto = document.daneKlienta.miastofirmy.value;
  1328.     if (nazwa != "" && (nip == 0 || adres == "" || kod == "" || miasto == "")){
  1329.         pola+=" - " + polafirmy + "\n";
  1330.         koniec=true;
  1331.     }
  1332.     else {
  1333.         if (nip != 0 && (nazwa == "" || adres == "" || kod == "" || miasto == "")){
  1334.         pola+=" - " + polafirmy + "\n";
  1335.         koniec=true;
  1336.         }
  1337.         else {
  1338.             if (adres != "" && (nip == 0 || nazwa == "" || kod == "" || miasto == "")){
  1339.             pola+=" - " + polafirmy + "\n";
  1340.             koniec=true;
  1341.             }
  1342.             else {
  1343.                 if (kod != "" && (nip == 0 || adres == "" || nazwa == "" || miasto == "")){
  1344.                 pola+=" - " + polafirmy + "\n";
  1345.                 koniec=true;
  1346.                 }
  1347.                 else {
  1348.                     if (miasto != "" && (nip == 0 || adres == "" || kod == "" || nazwa == "")){
  1349.                     pola+=" - " + polafirmy + "\n";
  1350.                     koniec=true;
  1351.                     }
  1352.                 }
  1353.             }
  1354.         }
  1355.     }
  1356. }
  1357.  
  1358.     if(!koniec){
  1359.     document.daneKlienta.submit();
  1360.     }
  1361.     else {
  1362.     if(pola != "")
  1363.             alert(poprpola + ":\n" + pola);
  1364.     }
  1365.  
  1366. }
  1367.  
  1368. function kompletnosc_danych3(kraj, login, imienazwisko, nowehaslo, powthasla, email, adres, kodpoczt, infkod, miasto, infmiasto, rodzdoktoz, nrdoktoz, efaktura, wyrzgody, infnrdok, poprpola, polafirmy, polawysylka, powtemail, infemail){
  1369. var pola = "";
  1370. var koniec = false;
  1371. var bladWysylka = false;
  1372. var bladEFaktura = false;
  1373.  
  1374.     if(document.daneKlienta.login.value=="" || dlugosc_pol(document.daneKlienta.login.value.length) == 0){
  1375.     pola+=" - " + login + "\n";
  1376.     koniec=true;
  1377.     }
  1378.  
  1379.     if(document.daneKlienta.nazwa.value=="" || nie_tylko_litery(document.daneKlienta.nazwa.value) == 0 ){        
  1380.     pola+=" - " +  imienazwisko + "\n";
  1381.     koniec=true;
  1382.     }
  1383.  
  1384.     if(document.daneKlienta.haslo.value=="" || dlugosc_pol_haslo(document.daneKlienta.haslo.value.length) == 0 ){
  1385.     pola+=" - " +  nowehaslo + "\n";
  1386.     koniec=true;
  1387.     }
  1388.  
  1389.     if(document.daneKlienta.powt_hasla.value=="" || document.daneKlienta.haslo.value != document.daneKlienta.powt_hasla.value){
  1390.     pola+=" - " + powthasla + "\n";
  1391.     koniec=true;
  1392.     }
  1393.  
  1394.     if(document.daneKlienta.email.value=="" || (poprawny_email(document.daneKlienta.email.value) == 0) ){
  1395.     pola+=" - " + email + "\n";
  1396.     koniec=true;
  1397.     }
  1398.    
  1399.  
  1400.     var nip = 0;
  1401.     var nazwa = "";
  1402.     var adres = "";
  1403.     var kod = "";
  1404.     var miasto = "";
  1405.  
  1406.     nazwa = document.daneKlienta.nazwafirmy.value;
  1407.     nip = document.daneKlienta.nipfirmy.value.length;
  1408.     adres = document.daneKlienta.ulica.value;
  1409.     kod = document.daneKlienta.kodpocztowy.value;
  1410.     miasto = document.daneKlienta.miasto.value;
  1411.     if (nazwa != "" && (nip == 0 || adres == "" || kod == "" || miasto == "")) {
  1412.         pola += polafirmy + "\n";
  1413.         koniec = true;
  1414.     }
  1415.     else {
  1416.         if (nip != 0 && (nazwa == "" || adres == "" || kod == "" || miasto == "")) {
  1417.             pola += polafirmy + "\n";
  1418.             koniec = true;
  1419.         }
  1420.  
  1421.     }
  1422.    
  1423.     if (document.daneKlienta.nazwafirmy.value.length > 0 || document.daneKlienta.nipfirmy.value.length > 0 || document.daneKlienta.ulica.value.length > 0 ||
  1424.             document.daneKlienta.kodpocztowy.value.length > 0 || document.daneKlienta.miasto.value.length > 0) {
  1425.         if (document.daneKlienta.zgodafakturaelektoniczna.checked == false) {
  1426.             koniec = true;
  1427.             bladEFaktura = true;
  1428.         }
  1429.     }
  1430.  
  1431.     if (document.daneKlienta.akceptacja.checked == false) {
  1432.  
  1433.         koniec = true;
  1434.     }
  1435.  
  1436.     if (!koniec) {
  1437.         document.daneKlienta.submit();
  1438.     }
  1439.     else {
  1440.         if (pola != "") {
  1441.             alert(poprpola + ":\n" + pola);
  1442.         }
  1443.         else {
  1444.             if (bladEFaktura) {
  1445.                 alert(efaktura);
  1446.             } else {
  1447.                 alert(wyrzgody);
  1448.             }
  1449.         }
  1450.     }
  1451.  
  1452. }
  1453.  
  1454. function kompletnosc_danych4(login, firma, nowehaslo, nip, powthasla, regon, osoba, adres, email, kodpoczt, infkod, miasto, infmiasto, telefon){
  1455. var pola = "";
  1456. var poprpola = "Proszê poprawiæ pola";
  1457. var koniec = false;
  1458.  
  1459.     if(document.daneKlienta.login.value=="" || dlugosc_pol(document.daneKlienta.login.value.length) == 0){
  1460.     pola+=" - " + login + "\n";
  1461.     koniec=true;
  1462.     }
  1463.  
  1464.     if(document.daneKlienta.nazwa_firmy.value=="" || tylko_litery_i_cyfry(document.daneKlienta.nazwa_firmy.value) == 0){
  1465.     pola+=" - " +  firma + "\n";
  1466.     koniec=true;
  1467.     }
  1468.  
  1469.     if(document.daneKlienta.haslo.value=="" || dlugosc_pol_haslo(document.daneKlienta.haslo.value.length) == 0 ){
  1470.     pola+=" - " +  nowehaslo + "\n";
  1471.     koniec=true;
  1472.     }
  1473.  
  1474.     if(document.daneKlienta.nip_firmy.value=="" || sprNip('nip_firmy_id') == 0 ){
  1475.     pola+=" - " +  nip + "\n";
  1476.     koniec=true;
  1477.     }
  1478.  
  1479.     if(document.daneKlienta.powt_hasla.value=="" || document.daneKlienta.haslo.value != document.daneKlienta.powt_hasla.value){
  1480.     pola+=" - " + powthasla + "\n";
  1481.     koniec=true;
  1482.     }
  1483.  
  1484.  
  1485.     if(document.daneKlienta.regon_firmy.value=="" || dlugosc_pol(document.daneKlienta.regon_firmy.value.length) == 0){
  1486.     pola+=" - " + regon + "\n";
  1487.     koniec=true;
  1488.     }
  1489.    
  1490.     if(document.daneKlienta.osoba_kontakt.value=="" || tylko_litery(document.daneKlienta.osoba_kontakt.value) == 0 || poprawna_nazwa(document.daneKlienta.osoba_kontakt.value) == 0){
  1491.     pola+=" - " +  osoba + "\n";
  1492.     koniec=true;
  1493.     }
  1494.    
  1495.     if(document.daneKlienta.ulica.value==""){
  1496.     pola+=" - " + adres + "\n";
  1497.     koniec=true;
  1498.     }
  1499.  
  1500.     if(document.daneKlienta.email.value=="" || (poprawny_email(document.daneKlienta.email.value) == 0) ){
  1501.     pola+=" - " + email + "\n";
  1502.     koniec=true;
  1503.     }
  1504.  
  1505.     if(document.daneKlienta.kodpocztowy.value=="" || kod_Klienta(infkod) == 0){
  1506.     pola+=" - " + kodpoczt + "\n";
  1507.     koniec=true;
  1508.     }
  1509.  
  1510.     if(document.daneKlienta.miasto.value=="" || nazwa_miasta(infmiasto) == 0){
  1511.     pola+=" - " + miasto + "\n";
  1512.     koniec=true;
  1513.     }
  1514.  
  1515.     if(document.daneKlienta.tel.value=="" || dlugosc_pol(document.daneKlienta.tel.value.length) == 0){
  1516.     pola+=" - " + telefon + "\n";
  1517.     koniec=true;
  1518.     }
  1519.    
  1520.     try {
  1521.         if (!(Number(document.daneKlienta.jedn_sluzb.value) > 0 && Number(document.daneKlienta.nr_kasy.value) > 0 && Number(document.daneKlienta.k_nr.value) > 0)) {
  1522.             pola+=" - " + "Jednostka s³u¿bowa, Nr kasy, K-nr" + "\n";
  1523.             koniec=true;
  1524.         }
  1525.     }
  1526.     catch (err)
  1527.     {
  1528.         pola+=" - " + "Jednostka s³u¿bowa, Nr kasy, K-nr" + "\n";
  1529.         koniec=true;
  1530.     }
  1531.     if(!koniec){
  1532.     document.daneKlienta.submit();
  1533.     }
  1534.     else {
  1535.     if(pola != "")
  1536.             alert(poprpola + ":\n" + pola);
  1537.     }
  1538.  
  1539. }
  1540.  
  1541. function kompletnosc_danych5(osoba, adres, email, kodpoczt, infkod, miasto, infmiasto, telefon, domena){
  1542. var pola = "";
  1543. var poprpola = "Proszê poprawiæ pola";
  1544. var koniec = false;
  1545.  
  1546.     if(document.daneKlienta.osobakontaktowa.value=="" || tylko_litery(document.daneKlienta.osobakontaktowa.value) == 0 || poprawna_nazwa(document.daneKlienta.osobakontaktowa.value) == 0){
  1547.     pola+=" - " +  osoba + "\n";
  1548.     koniec=true;
  1549.     }
  1550.    
  1551.     if(document.daneKlienta.ulica.value==""){
  1552.     pola+=" - " + adres + "\n";
  1553.     koniec=true;
  1554.     }
  1555.  
  1556.     if(document.daneKlienta.email.value=="" || (poprawny_email(document.daneKlienta.email.value) == 0) ){
  1557.     pola+=" - " + email + "\n";
  1558.     koniec=true;
  1559.     } else {
  1560.         if (document.daneKlienta.email.value.indexOf(domena, document.daneKlienta.email.value.length - domena.length) == -1) {
  1561.             pola+=" - email (wymagana domena: " + domena + ")\n";
  1562.             koniec=true;
  1563.         }
  1564.     }
  1565.    
  1566.  
  1567.     if(document.daneKlienta.kodpocztowy.value=="" || kod_Klienta(infkod) == 0){
  1568.     pola+=" - " + kodpoczt + "\n";
  1569.     koniec=true;
  1570.     }
  1571.  
  1572.     if(document.daneKlienta.miasto.value=="" || nazwa_miasta(infmiasto) == 0){
  1573.     pola+=" - " + miasto + "\n";
  1574.     koniec=true;
  1575.     }
  1576.  
  1577.     if(document.daneKlienta.tel.value=="" || dlugosc_pol(document.daneKlienta.tel.value.length) == 0){
  1578.     pola+=" - " + telefon + "\n";
  1579.     koniec=true;
  1580.     }
  1581.    
  1582.     if(!koniec){
  1583.     document.daneKlienta.submit();
  1584.     }
  1585.     else {
  1586.     if(pola != "")
  1587.             alert(poprpola + ":\n" + pola);
  1588.     }
  1589.  
  1590. }
  1591.  
  1592. function sprawdz_numery(){
  1593.     var pola = "";
  1594.     var poprpola = "Proszê poprawiæ pola";
  1595.     var koniec = false;
  1596.    
  1597.     if (isNaN(document.daneKlienta.jedn_sluzb.value) || Number(document.daneKlienta.jedn_sluzb.value) <= 0) {
  1598.         pola += " - Jednostka s³u¿bowa\n";
  1599.         koniec = true;
  1600.     }
  1601.  
  1602.     if (isNaN(document.daneKlienta.nr_kasy.value) || Number(document.daneKlienta.nr_kasy.value) <= 0) {
  1603.         pola += " - Nr kasy\n";
  1604.         koniec = true;
  1605.     }
  1606.  
  1607.     if (isNaN(document.daneKlienta.k_nr.value) || Number(document.daneKlienta.k_nr.value) <= 0) {
  1608.         pola += " - K-nr\n";
  1609.         koniec = true;
  1610.     }
  1611.    
  1612.     if(!koniec){
  1613.         document.body.style.cursor = "wait";    
  1614.         var xhr = new XMLHttpRequest();
  1615.         xhr.onreadystatechange = function() {
  1616.             if (xhr.readyState === 4) {
  1617.                 var data = xhr.responseText;
  1618.                 document.body.style.cursor = "default";
  1619.                 alert(data);
  1620.             }
  1621.         }
  1622.         xhr.open('GET', '/CheckNumbers?jedn_sluzb='+document.daneKlienta.jedn_sluzb.value+'&nr_kasy='+document.daneKlienta.nr_kasy.value+'&k_nr='+document.daneKlienta.k_nr.value, true);
  1623.         xhr.send(null);
  1624.     }
  1625.     else {
  1626.         if(pola != "")
  1627.             alert(poprpola + ":\n" + pola);
  1628.     }
  1629.    
  1630. }
  1631.  
  1632. function kompletnosc_danych_kontogosc(imienazwisko, identyfikator, email, powt_email, poprpola, efaktura, wyrzgody, nazwafirmy, nip, ulica, kodpocztowy, miasto){
  1633. var pola = "";
  1634. var koniec = false;
  1635. var bladEFaktura = false;
  1636.  
  1637.     if(sprImieNazwisko(document.daneKlienta.imie.value, "", 1, 2) === 0 || sprImieNazwisko(document.daneKlienta.nazwisko.value, "", 1, 2) === 0){
  1638.     pola+=" - " + imienazwisko + "\n";
  1639.     koniec=true;
  1640.     }
  1641.  
  1642.     if(sprPesel(document.daneKlienta.identyfikatorGoscia.value, '', 1) === 0){        
  1643.     pola+=" - " +  identyfikator + "\n";
  1644.     koniec=true;
  1645.     }
  1646.  
  1647.     if(document.daneKlienta.email.value==="" || (poprawny_email(document.daneKlienta.email.value) === 0) ){
  1648.     pola+=" - " + email + "\n";
  1649.     koniec=true;
  1650.     }
  1651.  
  1652.     if(document.daneKlienta.powt_email.value==="" || (poprawny_email(document.daneKlienta.powt_email.value) === 0) || document.daneKlienta.powt_email.value!==document.daneKlienta.email.value ){
  1653.     pola+=" - " +  powt_email + "\n";
  1654.     koniec=true;
  1655.     }
  1656.    
  1657.     if(document.getElementById('fakturavat').checked){
  1658.         if (document.daneKlienta.zgodafakturaelektoniczna.checked === false) {
  1659.             koniec = true;
  1660.             bladEFaktura = true;
  1661.         }
  1662.        
  1663.         /*
  1664.         if (sprNipValue('nipfirmy') === 0) {
  1665.             koniec = true;
  1666.             pola += " - " + nip + "\n";
  1667.         }
  1668.         */
  1669.        
  1670.         if (document.daneKlienta.nazwafirmy.value.length < 2) {
  1671.             koniec = true;
  1672.             pola += " - " + nazwafirmy + "\n";
  1673.         }
  1674.         if (document.daneKlienta.ulica.value.length < 2) {
  1675.             koniec = true;
  1676.             pola += " - " + ulica + "\n";
  1677.         }
  1678.         if (document.daneKlienta.kodpocztowy.value.length < 2) {
  1679.             koniec = true;
  1680.             pola += " - " + kodpocztowy + "\n";
  1681.         }
  1682.         if (document.daneKlienta.miasto.value.length < 2) {
  1683.             koniec = true;
  1684.             pola += " - " + miasto + "\n";
  1685.         }
  1686.  
  1687.     }    
  1688.  
  1689.     if(document.daneKlienta.akceptacja.checked === false){
  1690.     koniec=true;
  1691.     }
  1692.  
  1693.     if (!koniec) {
  1694.         document.daneKlienta.submit();
  1695.     }
  1696.     else {
  1697.         if (pola !== "") {
  1698.             alert(poprpola + ":\n" + pola);
  1699.         }
  1700.         else {
  1701.             if (bladEFaktura) {
  1702.                 alert(efaktura);
  1703.             } else {
  1704.                 alert(wyrzgody);
  1705.             }
  1706.         }
  1707.     }
  1708. }
  1709.  
  1710. function danych_bezhasla(imienazwisko, email, adres, kodpoczt, infkod, miasto, infmiasto, nrdoktoz, infnrdok, poprpola, kodpocztfirmy, infkodpocztfirmy, miastofirmy, infmiastofirmy, polafirmy1, polawysylka){
  1711. var pola = "";
  1712. var koniec = false;
  1713. var bladWysylka = false;
  1714.     if(document.daneKlienta.nazwa.value=="" || tylko_litery(document.daneKlienta.nazwa.value) == 0 || poprawna_nazwa(document.daneKlienta.nazwa.value) == 0){
  1715.     pola+=" - " +  imienazwisko + "\n";
  1716.     koniec=true;
  1717.     }
  1718.        
  1719.     if(document.daneKlienta.email.value=="" || poprawny_email(document.daneKlienta.email.value) == 0){
  1720.     pola+=" - " + email + "\n";
  1721.     koniec=true;
  1722.     }
  1723.     if(document.daneKlienta.typUsera.value!=990){
  1724.    if(document.daneKlienta.ulica.value==""){
  1725.     pola+=" - " + adres + "\n";
  1726.     koniec=true;
  1727.     }
  1728.  
  1729.     if(document.daneKlienta.kodpocztowy.value=="" || kod_Klienta(infkod) == 0){
  1730.     pola+=" - " + kodpoczt + "\n";
  1731.     koniec=true;
  1732.     }
  1733.  
  1734.     if(document.daneKlienta.miasto.value=="" || nazwa_miasta(infmiasto) == 0){
  1735.     pola+=" - " + miasto + "\n";
  1736.     koniec=true;
  1737.     }
  1738.     }
  1739.  
  1740.  
  1741.     if( kod_Firmy(infkodpocztfirmy) == 0){
  1742.     pola+=" - " + kodpocztfirmy + "\n";
  1743.     koniec=true;
  1744.     }
  1745.    
  1746.     if(nazwa_miastafirmy(infmiastofirmy) == 0){
  1747.     pola+=" - " + miastofirmy + "\n";
  1748.     koniec=true;
  1749.     }
  1750.    
  1751.     var nip = 0;
  1752.     var nazwa = "";
  1753.     var adres = "";
  1754.     var kod = "";
  1755.     var miasto = "";
  1756.  
  1757.     nazwa = document.daneKlienta.nazwafirmy.value;
  1758.     nip = document.daneKlienta.nipfirmy.value.length;
  1759.     adres = document.daneKlienta.ulicafirmy.value;
  1760.     kod = document.daneKlienta.kodpocztowyfirmy.value;
  1761.     miasto = document.daneKlienta.miastofirmy.value;
  1762.  
  1763.     if(document.daneKlienta.typUsera.value==990){
  1764.         if (nazwa == "" && nip == 0 && adres == "" && kod == "" && miasto == ""){
  1765.             pola+= polafirmy1 + "\n";
  1766.             koniec=true;
  1767.         }
  1768.     }
  1769.     if(document.daneKlienta.typUsera.value>=990){
  1770.     if (nazwa != "" && (nip == 0 || adres == "" || kod == "" || miasto == "")){
  1771.         pola+= polafirmy1 + "\n";
  1772.         koniec=true;
  1773.     }
  1774.     else {
  1775.         if (nip != 0 && (nazwa == "" || adres == "" || kod == "" || miasto == "")){
  1776.         pola+= polafirmy1 + "\n";
  1777.         koniec=true;
  1778.         }
  1779.         else {
  1780.             if (adres != "" && (nip == 0 || nazwa == "" || kod == "" || miasto == "")){
  1781.             pola+= polafirmy1 + "\n";
  1782.             koniec=true;
  1783.             }
  1784.             else {
  1785.                 if (kod != "" && (nip == 0 || adres == "" || nazwa == "" || miasto == "")){
  1786.                 pola+= polafirmy1 + "\n";
  1787.                 koniec=true;
  1788.                 }
  1789.                 else {
  1790.                     if (miasto != "" && (nip == 0 || adres == "" || kod == "" || nazwa == "")){
  1791.                     pola+= + polafirmy1 + "\n";
  1792.                     koniec=true;
  1793.                     }
  1794.                 }
  1795.             }
  1796.         }
  1797.     }
  1798.     }
  1799.     if(!koniec){
  1800.     document.daneKlienta.submit();
  1801.     }
  1802.     else {
  1803.     if(pola != "")
  1804.             alert(poprpola + ":\n" + pola);
  1805.     }
  1806. }
  1807.  
  1808. function kompletnosc_danychF(kraj, login, imienazwisko, nowehaslo, powthasla, email, wyrNPS, wyrzgody, poprpola, polafirmy){
  1809. var pola = "";
  1810. var koniec = false;
  1811. var txtPS = false;
  1812. var bladWysylka = false;
  1813.  
  1814.     if(document.daneKlienta.login.value=="" || dlugosc_pol(document.daneKlienta.login.value.length) == 0){
  1815.     pola+=" - " + login + "\n";
  1816.     koniec=true;
  1817.     }
  1818.  
  1819.     if(document.daneKlienta.nazwa.value=="" || nie_tylko_litery(document.daneKlienta.nazwa.value) == 0 ){        
  1820.     pola+=" - " +  imienazwisko + "\n";
  1821.     koniec=true;
  1822.     }
  1823.  
  1824.     if(document.daneKlienta.haslo.value=="" || dlugosc_pol_haslo(document.daneKlienta.haslo.value.length) == 0 ){
  1825.     pola+=" - " +  nowehaslo + "\n";
  1826.     koniec=true;
  1827.     }
  1828.  
  1829.     if(document.daneKlienta.powt_hasla.value=="" || document.daneKlienta.haslo.value != document.daneKlienta.powt_hasla.value){
  1830.     pola+=" - " + powthasla + "\n";
  1831.     koniec=true;
  1832.     }
  1833.  
  1834.     if(document.daneKlienta.email.value=="" || (poprawny_email(document.daneKlienta.email.value) == 0) ){
  1835.     pola+=" - " + email + "\n";
  1836.     koniec=true;
  1837.     }
  1838.    
  1839.  
  1840.     var nip = 0;
  1841.     var nazwa = "";
  1842.     var adres = "";
  1843.     var kod = "";
  1844.     var miasto = "";
  1845.  
  1846.     nazwa = document.daneKlienta.nazwafirmy.value;
  1847.     nip = document.daneKlienta.nipfirmy.value.length;
  1848.     adres = document.daneKlienta.ulica.value;
  1849.     kod = document.daneKlienta.kodpocztowy.value;
  1850.     miasto = document.daneKlienta.miasto.value;
  1851.      if (nazwa == "" || nip == 0 || adres == "" || kod == "" || miasto == ""){
  1852.         pola+=polafirmy + "\n";
  1853.         koniec=true;
  1854.     }
  1855.    
  1856.   if(document.daneKlienta.akceptacja.checked == false){
  1857.  
  1858.     koniec=true;
  1859.     }
  1860.  
  1861.  if(document.daneKlienta.nieJestemPS.checked == false){
  1862.  
  1863.     koniec=true;
  1864.         txtPS= true;
  1865.     }
  1866.  
  1867.     if(!koniec){
  1868.    
  1869.             document.daneKlienta.submit();
  1870.  
  1871.     }
  1872.     else {
  1873.     if(pola != "")
  1874.             alert(poprpola + ":\n" + pola);
  1875.      else
  1876.      {
  1877.           if(txtPS)
  1878.           {
  1879.                 alert(wyrNPS);
  1880.             }else
  1881.             {
  1882.                 alert(wyrzgody);
  1883.             }
  1884.      }
  1885.  
  1886.     }
  1887.  
  1888. }
  1889.  
  1890.  
  1891. function tylko_haslo(starehaslo, takiesame, nowehaslo, powthasla, nrdoktoz, infnrdok, poprpola){
  1892. var pola = "";
  1893. var koniec = false;
  1894.        
  1895.     if(document.daneKlienta.stare_haslo.value=="")
  1896.     {
  1897.     pola+=" - " + starehaslo + "\n";
  1898.     koniec=true;
  1899.     }
  1900.        
  1901.     if((document.daneKlienta.stare_haslo.value != 0 || document.daneKlienta.haslo.value != 0) && (document.daneKlienta.haslo.value==document.daneKlienta.stare_haslo.value)){
  1902.         alert(takiesame);
  1903.         koniec=true;
  1904.     }
  1905.        
  1906.     if(document.daneKlienta.haslo.value=="" || dlugosc_pol_haslo(document.daneKlienta.haslo.value.length) == 0 || litery_liczby(document.daneKlienta.haslo.value) == 0){
  1907.     pola+=" - " + nowehaslo + "\n";
  1908.     koniec=true;
  1909.     }
  1910.        
  1911.     if(document.daneKlienta.powt_hasla.value=="" || document.daneKlienta.haslo.value != document.daneKlienta.powt_hasla.value){
  1912.     pola+=" - " + powthasla + "\n";
  1913.     koniec=true;
  1914.     }
  1915.  
  1916.  
  1917.     if(!koniec){
  1918.         document.daneKlienta.submit();
  1919.     }
  1920.     else {
  1921.         if(pola != "")
  1922.             alert(poprpola + ":\n" + pola);
  1923.     }
  1924. }
  1925.  
  1926. function zmiana_hasla_link(takiesame, nowehaslo, powthasla, poprpola){
  1927. var pola = "";
  1928. var koniec = false;
  1929.                        
  1930.     if(document.daneKlienta.haslo.value=="" || dlugosc_pol_haslo(document.daneKlienta.haslo.value.length) == 0 ){
  1931.     pola+=" - " + nowehaslo + "\n";
  1932.     koniec=true;
  1933.     }
  1934.        
  1935.     if(document.daneKlienta.powt_hasla.value=="" || document.daneKlienta.haslo.value != document.daneKlienta.powt_hasla.value){
  1936.     pola+=" - " + powthasla + "\n";
  1937.     koniec=true;
  1938.     }
  1939.  
  1940.  
  1941.     if(!koniec){
  1942.         document.daneKlienta.submit();
  1943.     }
  1944.     else {
  1945.         if(pola != "")
  1946.             alert(poprpola + ":\n" + pola);
  1947.     }
  1948. }
  1949.  
  1950. //function indywidualny(indywUser, indywAjent ,inf2){
  1951. //var NO = 0;
  1952. //var OK = 1;
  1953.  
  1954.  
  1955. //   document.daneKlienta.adminip.disabled=true;
  1956. //    if (document.daneKlienta.firmaid.value!=1 && document.daneKlienta.uzytktypkod.value == indywUser)
  1957. //    {
  1958. //        alert(inf2);
  1959. //        document.daneKlienta.uzytktypkod.value = indywAjent;
  1960. //        document.daneKlienta.adminip.disabled=true;
  1961. //        return NO;
  1962. //    }
  1963. //    if(document.daneKlienta.uzytktypkod.selectedIndex==3)
  1964. //    {
  1965. //        document.daneKlienta.adminip.disabled=false;
  1966. //    }
  1967. //    if(document.daneKlienta.uzytktypkod.selectedIndex!=3)
  1968. //    {
  1969. //        document.daneKlienta.adminip.disabled=true;
  1970. //    }
  1971. //    return OK;
  1972. //}
  1973.  
  1974. //function indywidualny2(indywUser, indywAjent ,inf1){
  1975. //var NO = 0;
  1976. //var OK = 1;
  1977.  
  1978.  
  1979. //   document.daneKlienta.adminip.disabled=true;
  1980. //   if (document.daneKlienta.firmaid.value==1 && document.daneKlienta.uzytktypkod.value != indywUser)
  1981. //    {
  1982. //        alert(inf1);
  1983. //        document.daneKlienta.uzytktypkod.value = indywUser;
  1984. //        document.daneKlienta.adminip.disabled=true;
  1985. //        return NO;
  1986. //   }
  1987. //    if(document.daneKlienta.uzytktypkod.selectedIndex==3)
  1988. //    {
  1989. //        document.daneKlienta.adminip.disabled=false;
  1990. //    }
  1991. //    if(document.daneKlienta.uzytktypkod.selectedIndex!=3)
  1992. //    {
  1993. //        document.daneKlienta.adminip.disabled=true;
  1994. //    }
  1995. //    return OK;
  1996. //}
  1997.  
  1998.  
  1999.  
  2000. function check_relacja(pole){
  2001. var NO = 0;
  2002. var OK = 1;
  2003.  
  2004.     if (navigator.appVersion.indexOf("MSIE")>0)
  2005.         pol ;
  2006.     else
  2007.         pol_2;
  2008.    
  2009.     bez;
  2010.  
  2011.    tekst = "";
  2012.    
  2013.    if (pole==1)
  2014.        tekst=document.relacja.stodjN.value;
  2015.    else if (pole==2)
  2016.        tekst=document.relacja.stprzN.value;
  2017.    
  2018.  
  2019.     for (var i=0; i < pol.length; i++) {
  2020.         regexp = eval("/"+String.fromCharCode(pol[i])+"/g");
  2021.         tekst=tekst.replace(regexp,String.fromCharCode(bez[i]));
  2022.     }
  2023.  
  2024.     if (pole==1)        
  2025.         document.relacja.stodjN.value = tekst.toUpperCase();
  2026.     else if (pole==2)        
  2027.         document.relacja.stprzN.value = tekst.toUpperCase();
  2028.    
  2029.     return OK;
  2030. }
  2031.  
  2032. function relacja_stodj(inf){
  2033. var NO = 0;
  2034. var OK = 1;
  2035.  
  2036.     if (navigator.appVersion.indexOf("MSIE")>0)
  2037.         pol ;
  2038.     else
  2039.         pol_2;
  2040.    
  2041.     bez;
  2042.  
  2043.    tekst = document.relacja.stodj.value;
  2044.  
  2045.     for (var i=0; i < pol.length; i++) {
  2046.         regexp = eval("/"+String.fromCharCode(pol[i])+"/g");
  2047.         tekst=tekst.replace(regexp,String.fromCharCode(bez[i]));
  2048.     }
  2049.  
  2050.     document.relacja.stodj.value = tekst;
  2051.  
  2052.     if(document.relacja.stodj.value.length < 3){
  2053.         alert(inf);
  2054.         document.relacja.stodj.focus();
  2055.         return NO;
  2056.     }
  2057.  
  2058.     if( tylko_litery(document.relacja.stodj.value) == 0) {
  2059.             alert(inf);
  2060.             document.relacja.stodj.focus();
  2061.             document.relacja.stodj.value="";
  2062.             return NO;
  2063.     }
  2064.    
  2065.     return OK;
  2066. }
  2067.  
  2068. function relacja_stprz(inf){
  2069. var NO = 0;
  2070. var OK = 1;
  2071.  
  2072.     if (navigator.appVersion.indexOf("MSIE")>0)
  2073.         pol ;
  2074.     else
  2075.         pol_2;
  2076.    
  2077.     bez;
  2078.  
  2079.     tekst = document.relacja.stprz.value;
  2080.  
  2081.     for (var i=0; i < pol.length; i++) {
  2082.         regexp = eval("/"+String.fromCharCode(pol[i])+"/g");
  2083.         tekst=tekst.replace(regexp,String.fromCharCode(bez[i]));
  2084.     }
  2085.  
  2086.     document.relacja.stprz.value = tekst;
  2087.  
  2088.     if(document.relacja.stprz.value.length <3){
  2089.         alert(inf);
  2090.         document.relacja.stprz.focus();
  2091.         return NO;
  2092.     }
  2093.  
  2094.     if( tylko_litery(document.relacja.stprz.value) == 0) {
  2095.             alert(inf);
  2096.             document.relacja.stprz.focus();
  2097.             document.relacja.stprz.value="";
  2098.             return NO;
  2099.     }
  2100.  
  2101.     return OK;
  2102. }
  2103.  
  2104. function kompletnosc_pol(stodj, stprz, odjprz, mcwstecz, dzienwstecz, godzwstecz, minwstecz, ildnimc, ildniluty, poprpola) {
  2105. var pola = "";
  2106. var koniec = false;
  2107. var OK = true;
  2108. var NO = false;
  2109.  
  2110.     document.relacja.stodj.value = document.relacja.stodj.value.toUpperCase();
  2111.     document.relacja.stprz.value = document.relacja.stprz.value.toUpperCase();
  2112.  
  2113.     if(document.relacja.stodj.value=="" || document.relacja.stodj.value.length < 3){
  2114.         pola+="-  " + stodj + "\n";
  2115.         koniec=true;
  2116.     }
  2117.  
  2118.     if(document.relacja.stprz.value=="" || document.relacja.stprz.value.length < 3){
  2119.         pola+="-  " + stprz + "\n";
  2120.     koniec=true;
  2121.     }
  2122.  
  2123.     if(!koniec){
  2124.        
  2125.         if(document.relacja.stodj.value == document.relacja.stprz.value) {
  2126.             alert(odjprz);
  2127.             document.relacja.stprz.focus();
  2128.             return NO;
  2129.         }
  2130.  
  2131.         if(!kontrola_danych(mcwstecz, dzienwstecz, godzwstecz, minwstecz, ildnimc, ildniluty)) {
  2132.             return NO;
  2133.         }
  2134.  
  2135.         else {
  2136.             document.relacja.submit()
  2137.         }
  2138.     }
  2139.     else
  2140.         alert(poprpola + ":\n " + pola)
  2141.        
  2142. }
  2143.  
  2144. function kontrola_danych(mcwstecz, dzienwstecz, godzwstecz, minwstecz, ildnimc, ildniluty) {
  2145. var OK = true;
  2146. var NO = false;
  2147.  
  2148.     data  = new Date();
  2149.     data.toLocaleString();
  2150.  
  2151.     if(document.relacja.dzodj.value == "" && document.relacja.mcodj.value == "" && document.relacja.rokodj.value == ""){
  2152.         document.relacja.dzodj.value  =  data.getDate();
  2153.         document.relacja.mcodj.value = data.getMonth() + 1;
  2154.         document.relacja.rokodj.value  =  data.getYear();
  2155.     }
  2156.  
  2157.     if(document.relacja.godzodj.value == "" && document.relacja.minodj.value == ""){
  2158.        document.relacja.godzodj.value =  data.getHours();
  2159.         document.relacja.minodj.value =  data.getMinutes();
  2160.     }
  2161.  
  2162.     if(!czas_wstecz(mcwstecz, dzienwstecz, godzwstecz, minwstecz))
  2163.             return NO;
  2164.  
  2165.     if(!dni_miesiac(ildnimc))
  2166.             return NO;
  2167.  
  2168.     if(!luty_dni(ildniluty))
  2169.             return NO;
  2170.  
  2171.     return OK;
  2172. }
  2173.  
  2174. function data_wstecz(mcwstecz, dzienwstecz) {
  2175. var OK = true;
  2176. var NO = false;
  2177.  
  2178.     if (document.relacja.rokodj.value == data.getFullYear())
  2179. {
  2180.     if(document.relacja.mcodj.value < data.getMonth() + 1) {
  2181.             alert(mcwstecz);
  2182.             document.relacja.mcodj.focus();
  2183.             return NO;     
  2184.     }
  2185. }
  2186.  
  2187.     if(document.relacja.mcodj.value == data.getMonth() + 1) {
  2188.             if(document.relacja.dzodj.value  <  data.getDate()) {
  2189.                     alert(dzienwstecz);
  2190.                     document.relacja.dzodj.focus();
  2191.                     return NO;     
  2192.             }
  2193.     }
  2194.  
  2195.     return OK;
  2196.  }
  2197.  
  2198. function czas_wstecz(mcwstecz, dzienwstecz, godzwstecz, minwstecz) {
  2199. var OK = true;
  2200. var NO = false;
  2201.  
  2202.     if(!data_wstecz(mcwstecz, dzienwstecz))
  2203.             return NO;
  2204.  
  2205.     if(document.relacja.mcodj.value == data.getMonth() + 1 && document.relacja.dzodj.value  == data.getDate()) {
  2206.             if( document.relacja.godzodj.value < data.getHours()) {
  2207.                     alert(godzwstecz);
  2208.                     document.relacja.godzodj.focus();
  2209.                     return NO;         
  2210.             }
  2211.  
  2212.             if( document.relacja.godzodj.value == data.getHours() && document.relacja.minodj.value <  data.getMinutes() ) {
  2213.                     alert(minwstecz);
  2214.                     document.relacja.minodj.focus();
  2215.                     return NO;         
  2216.             }
  2217.     }
  2218.     return OK;
  2219.  }
  2220.  
  2221. function dni_miesiac(ildnimc) {
  2222. var OK = true;
  2223. var NO = false;
  2224. var jest = 0;
  2225.  
  2226.     if(document.relacja.dzodj.value != 31)
  2227.             return OK;
  2228.  
  2229.     if(document.relacja.mcodj.value == 2)
  2230.             return OK;
  2231.  
  2232.     for(i = 0; i < miesiace.length; i++) {
  2233.                     if(document.relacja.mcodj.value == miesiace[i])
  2234.                             jest = 1;
  2235.     }
  2236.  
  2237.     if(jest != 1) {
  2238.                     alert(ildnimc);
  2239.                     document.relacja.dzodj.focus();
  2240.                     return NO;
  2241.     }
  2242.  
  2243.     return OK;
  2244. }
  2245.  
  2246.  
  2247. function luty_dni(ildniluty) {
  2248. var OK = true;
  2249. var NO = false;
  2250.  
  2251.     if(rok_przestepny(document.relacja.rokodj.value)) {
  2252.         if(document.relacja.mcodj.value == 2 ) {
  2253.                 if(document.relacja.dzodj.value <= 29)  {
  2254.                         return OK;
  2255.                 }
  2256.                 else {
  2257.                         alert(ildniluty);
  2258.                         document.relacja.dzodj.focus();
  2259.                         return NO;
  2260.                 }
  2261.          }
  2262.          return OK;
  2263.     }
  2264.     else {
  2265.         if(document.relacja.mcodj.value == 2 ) {
  2266.                 if(document.relacja.dzodj.value <= 28)  {
  2267.                         return OK;
  2268.                 }
  2269.                 else {
  2270.                         alert(ildniluty);
  2271.                         document.relacja.dzodj.focus();
  2272.                         return NO;
  2273.                 }
  2274.          }
  2275.     return OK;
  2276.     }
  2277. }
  2278.  
  2279.  
  2280.  
  2281. function kompletnosc_polCombo(inf) {
  2282.  
  2283.     if(document.relacjaCombo.stodj.value == document.relacjaCombo.stprz.value) {
  2284.         alert(inf);
  2285.         document.relacjaCombo.stprz.focus();
  2286.     }
  2287.     else {
  2288.     document.relacjaCombo.submit()
  2289.     }
  2290. }
  2291.  
  2292.  
  2293.  
  2294. function nrdok_RezH(inf){
  2295. var OK = 1;
  2296. var NO = 0;
  2297. var dlugosc = 0;
  2298.  
  2299.     document.rkh.nrdok.value = document.rkh.nrdok.value.toUpperCase();
  2300.    
  2301.     dlugosc = document.rkh.nrdok.length;
  2302.     if(dlugosc == 0)
  2303.             return OK;
  2304. reg = /^[A-Z0-9\-\\\s\\\\\/]{1,30}$/;
  2305.      wyn = rkh.nrdok.value.match(reg);
  2306.  
  2307.     if(!wyn){
  2308.         alert(inf);
  2309.         document.rkh.nrdok.focus();
  2310.         return NO;
  2311.     }
  2312.  
  2313.     return OK;
  2314. }
  2315.  
  2316. function hasloJ_RezH(inf) {
  2317. var OK = 1
  2318. var NO = 0
  2319.  
  2320.     reg = /^[a-z0-9]{1,8}$/i;
  2321.     wyn = rkh.hasloJ.value.match(reg);
  2322.  
  2323.     if (wyn)
  2324.         return OK;
  2325.  
  2326.     alert(inf);
  2327.     return NO;  
  2328. }
  2329.  
  2330. function hasloJ_Generuj(inf) {
  2331. var OK = 1
  2332. var NO = 0
  2333.  
  2334.     reg = /^[a-z0-9]{1,8}$/i;
  2335.     wyn = generuj.hasloGeneruj.value.match(reg);
  2336.     dl = generuj.hasloGeneruj.value.length;
  2337.  
  2338.     if (wyn && dl==8){
  2339.         document.generuj.submit();
  2340.         return OK;
  2341.        
  2342.     }
  2343.  
  2344.     alert(inf);
  2345.     return NO;  
  2346. }
  2347.  
  2348. function hasloJ_Aktywuj(inf,param) {
  2349. var OK = 1
  2350. var NO = 0
  2351.  
  2352.     reg = /^[a-z0-9]{1,8}$/i;
  2353.     wyn = document.forms[param].hasloAktywuj.value.match(reg);
  2354.     dl = document.forms[param].hasloAktywuj.value.length;
  2355.  
  2356.     if (wyn && dl==8){
  2357.         document.forms[param].submit();
  2358.         return OK;
  2359.     }
  2360.     alert(inf);
  2361.     return NO;  
  2362. }
  2363.  
  2364. function tylko_cyfra1(cyfra){
  2365. var NO = 0;
  2366. var OK = 1;
  2367.  
  2368.     if ( cyfra.length != 0 && tylko_cyfra(cyfra) == 1 )
  2369.         return OK;
  2370.        
  2371.     return NO;
  2372. }
  2373.  
  2374. function kompletnosc_polRezH_KoloroweKarty(kolorowa_karta, kod, kodspolki, nrdokumentu, imienazwisko, zlynrdok, zlehaslo, poprpola, kodUzytk){
  2375. var OK = 1;
  2376. var NO = 0;
  2377. var pola = "";
  2378. var koniec = false;
  2379.  
  2380.  
  2381.     if(kod == 1){
  2382.         if(document.rkh.spolkaPKP.value.length == 0 || tylko_cyfra1(document.rkh.spolkaPKP.value) == 0){
  2383.              pola+="- " + kodspolki + "\n";
  2384.              document.rkh.spolkaPKP.focus();
  2385.              koniec=true;
  2386.         }
  2387.     }
  2388.  
  2389.     if(document.rkh.dla.value.length == 0 ){
  2390.         pola+="-" + imienazwisko + "\n";
  2391.         koniec=true;
  2392.     }
  2393.    
  2394.    
  2395.     if(kodUzytk==1){
  2396.         if(document.rkh.hasloJ.value.length < 8 || document.rkh.hasloJ.value.length > 8 || hasloJ_RezH(zlehaslo) == 0){
  2397.             pola+="- " + zlehaslo + "\n";
  2398.             koniec=true;
  2399.         }
  2400.      }
  2401.  
  2402.  
  2403.  
  2404.     if (kolorowa_karta==1)  
  2405.     {
  2406.         if(!koniec)
  2407.             document.rkh.submit();
  2408.         else
  2409.             alert(poprpola + ":\n "+ pola);
  2410.     }
  2411.    
  2412. }
  2413.  
  2414. function kompletnosc_polRezH(kod, kodspolki, nrdokumentu, imienazwisko, zlynrdok, zlehaslo, poprpola, kodUzytk){
  2415. var OK = 1;
  2416. var NO = 0;
  2417. var pola = "";
  2418. var koniec = false;
  2419.  
  2420.     if(kod == 1){
  2421.         if(document.rkh.spolkaPKP.value.length == 0 || tylko_cyfra1(document.rkh.spolkaPKP.value) == 0){
  2422.              pola+="- " + kodspolki + "\n";
  2423.              document.rkh.spolkaPKP.focus();
  2424.              koniec=true;
  2425.         }
  2426.     }
  2427.  
  2428.     if(document.rkh.dla.value.length == 0  || poprawna_nazwa(document.rkh.dla.value) == 0){
  2429.         pola+="- " + imienazwisko + "\n";
  2430.         koniec=true;
  2431.     }
  2432.    
  2433.     if(kodUzytk==1){
  2434.         if(document.rkh.hasloJ.value.length < 8 || document.rkh.hasloJ.value.length > 8 || hasloJ_RezH(zlehaslo) == 0){
  2435.             pola+="- " + zlehaslo + "\n";
  2436.             koniec=true;
  2437.         }
  2438.      }
  2439.  
  2440.  
  2441.     if(!koniec)
  2442.         document.rkh.submit();
  2443.     else
  2444.         alert(poprpola + ":\n "+ pola);
  2445. }
  2446. function kompletnosc_polKarnet( imienazwisko,nrdokumentu,zlynrdok, poprpola){
  2447. var OK = 1;
  2448. var NO = 0;
  2449. var pola = "";
  2450. var koniec = false;
  2451.  
  2452.  
  2453.     if(document.rkh.dla.value.length == 0  || poprawna_nazwa(document.rkh.dla.value) == 0){
  2454.         pola+="- " + imienazwisko + "\n";
  2455.         koniec=true;
  2456.     }
  2457.    
  2458.     if(document.rkh.nrdok.value=="" ){
  2459.     pola+=" - " + nrdokumentu + "\n";
  2460.     koniec=true;
  2461.     }
  2462.  
  2463.  
  2464.     if(!koniec)
  2465.         document.rkh.submit();
  2466.     else
  2467.         alert(poprpola + ":\n "+ pola);
  2468. }
  2469.  
  2470.  
  2471.  
  2472. function drukOknoPDF(sciezka){    
  2473.     window.location.href=sciezka;
  2474. }
  2475.  
  2476. function drukBilet(sciezka){
  2477.     window2=open("/irez/jsp/" + sciezka + "&checkJS=true&print=1","Drukowanie","toolbar=no, menubar=no, location=no, personalbar=no, status=no, resizable=yes, scrollbars=yes, copyhistory=no, width=625, height=900, top=0, left=0");
  2478.     window2.focus();
  2479. }
  2480.  
  2481. function drukOkno(sciezka){
  2482.     window2=open("/irez/jsp/" + sciezka + "&checkJS=true","Drukowanie","toolbar=no, menubar=no, location=no, personalbar=no, status=no, resizable=yes, scrollbars=yes, copyhistory=no, width=520, height=800, top=0, left=0");
  2483.     window2.focus();
  2484.     setTimeout('window2.print()', 16000);
  2485.     setTimeout('window2.close()',30000);
  2486. }
  2487.  
  2488. function drukOknoWykaz(sciezka){
  2489.     window2=open("/irez/jsp/" + sciezka + "&checkJS=true","Drukowanie","toolbar=no, menubar=no, location=no, personalbar=no, status=no, resizable=no, scrollbars=yes, copyhistory=no, width=600, height=750, top=0, left=0");
  2490.     window2.focus();
  2491.     setTimeout('window2.print()', 4000);
  2492.     setTimeout('window2.close()',20000);
  2493. }
  2494.  
  2495.  
  2496. function otworzOkno(sciezka){    
  2497.     window2=open("/irez/jsp/" + sciezka  + "&checkJS=true","Informacja","toolbar=no, menubar=no, location=no, personalbar=no, status=no, resizable=no, scrollbars=no, copyhistory=no, width=520, height=800, top=0, left=0");
  2498.     window2.focus();
  2499.     return;
  2500. }
  2501.  
  2502. function otworzOkno2(sciezka){
  2503.     window2=open("/irez/jsp/" + sciezka  + "&checkJS=true","Informacja","toolbar=no, menubar=no, location=no, personalbar=no, status=no, resizable=no, scrollbars=no, copyhistory=no, width=900, height=550, top=0, left=0");
  2504.     window2.focus();
  2505.     return;
  2506. }
  2507.  
  2508. function otworzOkno3(sciezka, szerokosc, wysokosc){
  2509.     window2=open("/irez/jsp/" + sciezka  + "&checkJS=true","Informacja","toolbar=no, menubar=no, location=no, personalbar=no, status=no, resizable=no, scrollbars=yes, copyhistory=no, width=700, height=800, top=0, left=0");
  2510.     window2.focus();
  2511.     return;
  2512. }
  2513.  
  2514. function otworzOkno4(sciezka){
  2515.     window2=open("/irez/jsp/" + sciezka  + "&checkJS=true","Informacja","toolbar=no, menubar=no, location=no, personalbar=no, status=no, resizable=no, scrollbars=no, copyhistory=no, width=300, height=400, top=0, left=0");
  2516.     window2.focus();
  2517.     return;
  2518. }
  2519.  
  2520. function drukRpos(sciezka){
  2521.     window2=open("/irez/jsp/" + sciezka + "&checkJS=true","Drukowanie","toolbar=no, menubar=no, location=no, personalbar=no, status=no, resizable=no, scrollbars=no, copyhistory=no, width=640, height=900, top=0, left=0");
  2522.     window2.focus();
  2523.     setTimeout('window2.print()', 4000);
  2524.     setTimeout('window2.close()',30000);
  2525. }
  2526.  
  2527.  
  2528. function drukmg21(sciezka){
  2529.     window3=open("/irez/jsp/" + sciezka + "&checkJS=true","Drukowanie","toolbar=no, menubar=no, location=no, personalbar=no, status=no, resizable=no, scrollbars=no, copyhistory=no, width=660, height=450, top=0, left=0");
  2530.     window3.focus();
  2531.     setTimeout('window3.print()',10000);
  2532.     setTimeout('window3.close()',30000);
  2533. }
  2534.  
  2535. function drukReg(sciezka){
  2536.     window2=open("/irez/jsp/" + sciezka + "&checkJS=true","Drukowanie","toolbar=no, menubar=no, location=no, personalbar=no, status=no, resizable=no, scrollbars=yes, copyhistory=no, width=600, height=600, top=0, left=0");
  2537.     window2.focus();
  2538.     setTimeout('window2.print()', 4000);
  2539.    
  2540. }
  2541.  
  2542.  
  2543.  
  2544. function sprdata(dzien, miesiac, rok) {
  2545. miesiac--;
  2546.  
  2547. d = new Date(rok,miesiac,dzien, 23, 59, 0);
  2548.  
  2549.     if (dzien==d.getDate() && miesiac==d.getMonth() && rok==d.getFullYear())
  2550.         return true;
  2551.     else
  2552.         return false
  2553. }
  2554.  
  2555. function nazwa_Firmy2(inf)
  2556. {
  2557. var OK = 1;
  2558. var NO = 0;
  2559.    
  2560.     if(tylko_litery_i_cyfry(document.daneKlienta.nazwa_firmy.value)==0)
  2561.     {
  2562.         alert(inf);
  2563.         document.daneKlienta.nazwa_firmy.focus();
  2564.         return NO;
  2565.     }
  2566.     return OK;
  2567. }
  2568.  
  2569. function nazwa_Firmy(inf){
  2570. var OK = 1;
  2571. var NO = 0;
  2572.    
  2573.     if(tylko_litery(document.daneFirmy.nazwa.value)==0){
  2574.         alert(inf);
  2575.         document.daneFirmy.nazwa.focus();
  2576.         return NO;
  2577.     }
  2578.     return OK;
  2579. }
  2580. function nazwa_COK(inf){
  2581. var OK = 1;
  2582. var NO = 0;
  2583.    
  2584.     if(tylko_litery(document.daneCOK.nazwa.value)==0){
  2585.         alert(inf);
  2586.         document.daneCOK.nazwa.focus();
  2587.         return NO;
  2588.     }
  2589.     return OK;
  2590. }
  2591.  
  2592. function nazwa_KFirmy(inf){
  2593. var OK = 1;
  2594. var NO = 0;
  2595.    
  2596.     if(tylko_litery(document.daneFirmy.nazwaKrotka.value)==0){
  2597.         alert(inf);
  2598.         document.daneFirmy.nazwaKrotka.focus();
  2599.         return NO;
  2600.     }
  2601.     return OK;
  2602. }
  2603.  
  2604.  
  2605. function nip_Firmy(inf){
  2606. var NO = 0;
  2607. var OK = 1;
  2608.  
  2609.     if(nrnip() == 0){
  2610.         alert(inf);
  2611.         document.daneFirmy.nip.focus();
  2612.         return NO;
  2613.     }
  2614.  
  2615.     return OK;
  2616. }
  2617.  
  2618. function regon_Firmy(inf){
  2619. var NO = 0;
  2620. var OK = 1;
  2621.  
  2622.     if(tylko_cyfra(document.daneFirmy.regon.value) == 0){
  2623.         alert(inf);
  2624.         document.daneFirmy.regon.focus();
  2625.         return NO;
  2626.     }
  2627.  
  2628.     return OK;
  2629. }
  2630.  
  2631. function  kodpocztowy_Firmy(inf) {
  2632. var OK = 1;
  2633. var NO = 0;
  2634.  
  2635.     if(document.daneFirmy.kodpocztowy.value == 0)
  2636.         return OK;
  2637.  
  2638.     if (kodpocz_OK(document.daneFirmy.kodpocztowy.value) == 0){
  2639.         alert(inf);
  2640.         document.daneFirmy.kodpocztowy.focus();
  2641.         return NO;
  2642.     }
  2643.    
  2644.     return OK;
  2645. }
  2646. function  kodpocztowy_COK(inf) {
  2647. var OK = 1;
  2648. var NO = 0;
  2649.  
  2650.     if(document.daneCOK.kodpocztowy.value == 0)
  2651.         return OK;
  2652.  
  2653.     if (kodpocz_OK(document.daneCOK.kodpocztowy.value) == 0){
  2654.         alert(inf);
  2655.         document.daneCOK.kodpocztowy.focus();
  2656.         return NO;
  2657.     }
  2658.    
  2659.     return OK;
  2660. }
  2661.  
  2662. function  kodpocztowy_FirmyKlient(inf, kraj) {
  2663. var OK = 1;
  2664. var NO = 0;
  2665.  
  2666.     if(document.daneKlienta.kodpocztowyfirmy.value == 0)
  2667.         return OK;
  2668.         if (kraj> 0)
  2669.             {
  2670.     if (kodpocz_OK(document.daneKlienta.kodpocztowyfirmy.value) == 0){
  2671.         alert(inf);
  2672.         document.daneKlienta.kodpocztowyfirmy.focus();
  2673.         return NO;
  2674.     }
  2675.             }
  2676.         else
  2677.             {
  2678.     if (kodpocz_OK_pl(document.daneKlienta.kodpocztowyfirmy.value) == 0){
  2679.         alert(inf);
  2680.         document.daneKlienta.kodpocztowyfirmy.focus();
  2681.         return NO;
  2682.  
  2683.             }
  2684.             }
  2685.     return OK;
  2686. }
  2687.  
  2688. function  miasto_Firmy(inf) {
  2689. var OK = 1;
  2690. var NO = 0;
  2691.  
  2692.     if (tylko_litery(document.daneFirmy.miasto.value)== 0){
  2693.         alert(inf);
  2694.         document.daneFirmy.miasto.focus();
  2695.         return NO;
  2696.     }
  2697.    
  2698.     return OK;
  2699. }
  2700. function  miasto_COK(inf) {
  2701. var OK = 1;
  2702. var NO = 0;
  2703.  
  2704.     if (tylko_litery(document.daneCOK.miasto.value)== 0){
  2705.         alert(inf);
  2706.         document.daneCOK.miasto.focus();
  2707.         return NO;
  2708.     }
  2709.    
  2710.     return OK;
  2711. }
  2712.  
  2713. function  miasto_FirmyKlient(inf) {
  2714. var OK = 1;
  2715. var NO = 0;
  2716.  
  2717.     if (tylko_litery(document.daneKlienta.miastofirmy.value)== 0){
  2718.         alert(inf);
  2719.         document.daneKlienta.miastofirmy.focus();
  2720.         return NO;
  2721.     }
  2722.    
  2723.     return OK;
  2724. }
  2725.  
  2726.  
  2727. function telefon_COK(inf) {
  2728. var OK = 1;
  2729. var NO = 0;
  2730. var dlugosc = 0;
  2731.    
  2732.     dlugosc = document.daneCOK.tel.length;
  2733.    
  2734.     if(dlugosc == 0)
  2735.         return OK;
  2736.  
  2737.     if (telfax_OK(document.daneCOK.tel.value) == 0){
  2738.     alert(inf);
  2739.     document.daneCOK.tel.focus();
  2740.     return NO;
  2741.     }
  2742.    
  2743.     return OK;
  2744. }
  2745. function telefon_Firmy(inf) {
  2746. var OK = 1;
  2747. var NO = 0;
  2748. var dlugosc = 0;
  2749.    
  2750.     dlugosc = document.daneFirmy.tel.length;
  2751.    
  2752.     if(dlugosc == 0)
  2753.         return OK;
  2754.  
  2755.     if (telfax_OK(document.daneFirmy.tel.value) == 0){
  2756.     alert(inf);
  2757.     document.daneFirmy.tel.focus();
  2758.     return NO;
  2759.     }
  2760.    
  2761.     return OK;
  2762. }
  2763.  
  2764. function fax_Firmy(inf) {
  2765. var OK = 1;
  2766. var NO = 0;
  2767. var dlugosc = 0;
  2768.    
  2769.     dlugosc = document.daneFirmy.fax.length;
  2770.  
  2771.     if(dlugosc == 0)
  2772.     return OK;
  2773.  
  2774.     if (telfax_OK(document.daneFirmy.fax.value) == 0){
  2775.     alert(inf);
  2776.     document.daneFirmy.fax.focus();
  2777.     return NO;
  2778.     }
  2779.    
  2780.     return OK;
  2781. }
  2782.  
  2783. function email_Firmy(inf){
  2784. var OK = 1;
  2785. var NO = 0;
  2786. var dlugosc = 0;
  2787.    
  2788.     dlugosc = document.daneFirmy.email.value.length;
  2789.    
  2790.     if(dlugosc == 0)
  2791.     return OK;
  2792.  
  2793.     if(poprawny_email(document.daneFirmy.email.value)== 0){
  2794.     alert(inf);
  2795.     document.daneFirmy.email.focus();
  2796.     return NO;
  2797.     }
  2798.    
  2799.     return OK;
  2800. }
  2801.  
  2802. function daneOK_Firmy(nazwafull, nipf, regf, adresf, kodpocztf, miastof, nazwakrotkaf, nrumowyf, dataodf, datadof, poprpola, inf1, infod, infdo, infLista, infHasla){
  2803. var NO = 0;
  2804. var OK = 1;
  2805. var pola = "";
  2806. var koniec = false;
  2807.  
  2808.     if(document.daneFirmy.nazwa.value == "" || tylko_litery(document.daneFirmy.nazwa.value)==0){
  2809.         pola+=" - " + nazwafull + "\n";
  2810.     koniec=true;
  2811.     }
  2812.  
  2813.     if(document.daneFirmy.nip.value == ""){ // || nrnip() == 0){
  2814.     pola+=" - " + nipf + "\n";
  2815.     koniec=true;
  2816.     }
  2817.  
  2818.     if(document.daneFirmy.regon.value == 0 || tylko_cyfra(document.daneFirmy.regon.value) == 0){
  2819.     pola+=" - " + regf + "\n";
  2820.     koniec=true;
  2821.     }
  2822.  
  2823.     if(document.daneFirmy.ulica.value == ""){
  2824.     pola+=" - " + adresf + "\n";
  2825.     koniec=true;
  2826.     }
  2827.  
  2828.     if(document.daneFirmy.kodpocztowy.value == "" || kodpocz_OK(document.daneFirmy.kodpocztowy.value)== 0){
  2829.     pola+=" - " + kodpocztf + "\n";
  2830.     koniec=true;
  2831.     }
  2832.  
  2833.     if(document.daneFirmy.miasto.value == "" || tylko_litery(document.daneFirmy.miasto.value)== 0){
  2834.     pola+=" - " + miastof + "\n";
  2835.     koniec=true;
  2836.     }
  2837.  
  2838.     if(document.daneFirmy.nazwaKrotka.value == "" || tylko_litery(document.daneFirmy.nazwaKrotka.value)==0 ){
  2839.     pola+=" - " + nazwakrotkaf + "\n";
  2840.     koniec=true;
  2841.     }
  2842.  
  2843.     if(document.daneFirmy.nrumowy.value == ""){
  2844.     pola+=" - " + nrumowyf + "\n";
  2845.     koniec=true;
  2846.     }
  2847.  
  2848.    if(document.daneFirmy.dataod.value == ""){
  2849.     pola+=" - " + dataodf + "\n";
  2850.     koniec=true;
  2851.     }
  2852.     else{
  2853.         if(sprdataod_Firma(inf1, infod) ==false)
  2854.             koniec = true;
  2855.     }
  2856.  
  2857.    if(document.daneFirmy.datado.value == ""){
  2858.         }
  2859.     else{
  2860.         if(sprdatado_Firma(inf1, infdo) ==false)
  2861.             koniec = true;
  2862.     }
  2863.  
  2864.    if(document.daneFirmy.listyHasel.value == "" || document.daneFirmy.listyHasel.value >5){
  2865.     pola+=" - " + infLista + "\n";
  2866.     koniec=true;
  2867.     }
  2868.     else{
  2869.         if(sprListaHasel_Firma(infLista) ==false)
  2870.             koniec = true;
  2871.     }
  2872.  
  2873.    if(document.daneFirmy.hasla.value == "" || document.daneFirmy.hasla.value >50){
  2874.     pola+=" - " + infHasla + "\n";
  2875.     koniec=true;
  2876.     }
  2877.     else{
  2878.         if(sprHasla_Firma(infHasla) ==false)
  2879.             koniec = true;
  2880.     }
  2881.  
  2882.     if(!koniec){
  2883.         document.daneFirmy.submit();
  2884.     }
  2885.     else {
  2886.         if(pola != "")
  2887.             alert(poprpola + ":\n" + pola);
  2888.     }
  2889.    
  2890.     return OK;
  2891. }
  2892.  
  2893.  
  2894.  
  2895. function tylko_cyfra_zwrot(){
  2896. var OK = 1;
  2897. var NO = 0;
  2898. var dlugosc = 0;
  2899. var koniec = false;
  2900.  
  2901. dlugosc = document.zwrotBiletow.nrBiletu.value.length;
  2902.     if ( isNaN(document.zwrotBiletow.nrBiletu.value) != 0 ){
  2903.                 koniec = true;
  2904.         }
  2905.         if (dlugosc == 0 ){
  2906.                 koniec = true;
  2907.         }          
  2908.  if(!koniec){
  2909.         document.zwrotBiletow.submit();
  2910.         return OK;
  2911.         }
  2912.     else {
  2913.         alert("Podaj numer biletu");
  2914.         return NO;
  2915.     }
  2916. }
  2917.  
  2918. function kompletnosc_danych_zwrot(){
  2919. var pola = "";
  2920. var koniec = false;
  2921.  
  2922.     if(dlugosc_pol(document.zwrotBiletow.zwrotBilet.length) == 0 || cena_OK(document.zwrotBiletow.zwrotBilet.value) == 0){
  2923.        
  2924.     pola+=" -  Kwota za bilet \n";
  2925.     koniec=true;
  2926.     }
  2927.  
  2928.     if(document.zwrotBiletow.powodBilet.value=="" || dlugosc_pol(document.zwrotBiletow.powodBilet.length) == 0){
  2929.     pola+=" -  Powód zwrotu biletu\n";
  2930.     koniec=true;
  2931.     }
  2932.        
  2933.     if(dlugosc_pol(document.zwrotBiletow.zwrotMiejscowka.length) == 0 || cena_OK(document.zwrotBiletow.zwrotMiejscowka.value) == 0){
  2934.     pola+=" -  Kwota za rezerwacjê\n";
  2935.     koniec=true;
  2936.     }
  2937.  
  2938.     if(document.zwrotBiletow.powodMiejscowka.value=="" || dlugosc_pol(document.zwrotBiletow.powodMiejscowka.length) == 0){
  2939.     pola+=" -  Powód zwrotu rezerwacji\n";
  2940.     koniec=true;
  2941.     }
  2942.  
  2943.     if(!koniec){
  2944.         document.zwrotBiletow.submit();
  2945.     }
  2946.    
  2947.     else {
  2948.     if(pola != "")
  2949.             alert("Popraw lub wype³nij pola:\n" + pola);
  2950.     }
  2951. }
  2952.  
  2953. function kompletnosc_danych_blokada_zwrotu(){
  2954. var pola = "";
  2955. var koniec = false;
  2956.  
  2957.     if(dlugosc_pol(document.blokadaZwrotuBiletow.kwotaZwrotu.length) == 0 || cena_OK(document.blokadaZwrotuBiletow.kwotaZwrotu.value) == 0){
  2958.  
  2959.     pola+=" -  Kwota zwrotu \n";
  2960.     koniec=true;
  2961.     }
  2962.  
  2963.     if(document.blokadaZwrotuBiletow.powodBlokady.value=="" || dlugosc_pol(document.blokadaZwrotuBiletow.powodBlokady.length) == 0){
  2964.     pola+=" -  Przyczyna blokady zwrotu biletu\n";
  2965.     koniec=true;
  2966.     }
  2967.  
  2968.      if(!koniec){
  2969.         document.blokadaZwrotuBiletow.submit();
  2970.     }
  2971.  
  2972.     else {
  2973.     if(pola != "")
  2974.             alert("Popraw lub wype³nij pola:\n" + pola);
  2975.     }
  2976. }
  2977.  
  2978. function  cena_OK(kod) {
  2979. var OK = 1;
  2980. var NO = 0;
  2981.    
  2982.     if (kod.match(/^\d\d,\d\d$/) || kod.match(/^\d,\d\d$/) || kod.match(/^\d\d\d,\d\d$/) || kod.match(/^\d\d\d\d,\d\d$/))
  2983.         return OK;
  2984.  
  2985.    else
  2986.    return NO;
  2987. }
  2988.  
  2989. function kompletnosc_danych_filtr(tekst){
  2990. var pola = "";
  2991. var koniec = false;
  2992.         if(document.listaBiletowSzczegoly.nrPociagu.value.length != 0){
  2993.             if(tylko_cyfra(document.listaBiletowSzczegoly.nrPociagu.value) == 0){
  2994.                 alert(tekst);
  2995.                 document.listaBiletowSzczegoly.nrPociagu.focus();
  2996.                 koniec = true;
  2997.             }
  2998.         }
  2999.  
  3000.     if(!koniec)
  3001.             document.listaBiletowSzczegoly.submit();
  3002. }
  3003.  
  3004.  
  3005.  
  3006. function nrpoc_OK(inf1, inf2){
  3007. var koniec = true;
  3008.  
  3009.     if(document.data_pociag.nrpoc.value == 0 || document.data_pociag.nrpoc.value == ""){
  3010.         alert(inf1);
  3011.         document.data_pociag.nrpoc.focus();
  3012.         koniec = false;
  3013.     }
  3014.  
  3015.     if(document.data_pociag.nrpoc.length != 0){
  3016.        if(tylko_cyfra(document.data_pociag.nrpoc.value)==0){
  3017.             alert(inf2);
  3018.             document.data_pociag.nrpoc.focus();
  3019.            koniec = false;
  3020.         }
  3021.     }
  3022.  
  3023.     if(koniec)
  3024.         document.data_pociag.submit();
  3025. }
  3026.  
  3027. function nrbil_OK(inf1, inf2){
  3028. var koniec = true;
  3029.  
  3030.     if(document.kontrolaBiletu.idBilet.value == 0 || document.kontrolaBiletu.idBilet.value == ""){
  3031.         alert(inf1);
  3032.         document.kontrolaBiletu.idBilet.focus();
  3033.         koniec = false;
  3034.     }
  3035.  
  3036.     if(document.kontrolaBiletu.idBilet.length != 0){
  3037.        if(tylko_cyfra(document.kontrolaBiletu.idBilet.value)==0){
  3038.             alert(inf2);
  3039.             document.kontrolaBiletu.idBilet.focus();
  3040.            koniec = false;
  3041.         }
  3042.     }
  3043.  
  3044.     if(koniec)
  3045.         document.kontrolaBiletu.submit();
  3046. }
  3047.  
  3048. function sprdatanew(inf) {
  3049. var dzien = document.data_pociag.dzodj.value;
  3050. var miesiac = document.data_pociag.mcodj.value;
  3051. var rok = document.data_pociag.rokodj.value;
  3052. var pierwszy = 1;
  3053. miesiac--;
  3054.  
  3055.     d = new Date(rok,miesiac,dzien, 23, 59, 0);
  3056.    
  3057.     if (dzien==d.getDate() && miesiac==d.getMonth() && rok==d.getFullYear())
  3058.     {
  3059.         return true;
  3060.     }
  3061.     else
  3062.     {
  3063.         alert(inf);
  3064.         document.data_pociag.dzodj.value = pierwszy;
  3065.         return false;
  3066.     }
  3067. }
  3068.  
  3069.  
  3070. function  data_OK(data) {
  3071. var OK = 1;
  3072. var NO = 0;
  3073.    
  3074.     if (!data.match(/^\d\d\d\d-\d\d-\d\d$/))
  3075.         return NO;
  3076.  
  3077.     return OK;
  3078. }
  3079.  
  3080. function sprdataod_Firma(inf1, inf2) {
  3081. var rok = document.daneFirmy.dataod.value.substring(0,4);
  3082. var miesiac = document.daneFirmy.dataod.value.substring(5,7);
  3083. var dzien = document.daneFirmy.dataod.value.substring(8);
  3084. miesiac--;
  3085.  
  3086. if(document.daneFirmy.dataod.value.length == 0)
  3087.     return true;
  3088.  
  3089. if (data_OK(document.daneFirmy.dataod.value) == 0)
  3090.     {
  3091.         alert(inf1);
  3092.         document.daneFirmy.dataod.focus();
  3093.         return false;
  3094.     }
  3095.     d = new Date(rok,miesiac,dzien, 23, 59, 0);
  3096.     if (dzien==d.getDate() && miesiac==d.getMonth() && rok==d.getFullYear())
  3097.     {
  3098.         return true;
  3099.     }
  3100.     else
  3101.     {
  3102.         alert(inf2);
  3103.         document.daneFirmy.dataod.focus();
  3104.          return false;
  3105.     }
  3106. }
  3107. function sprdataod_COK(inf1, inf2) {
  3108. var rok = document.daneCOK.dataod.value.substring(0,4);
  3109. var miesiac = document.daneCOK.dataod.value.substring(5,7);
  3110. var dzien = document.daneCOK.dataod.value.substring(8);
  3111. miesiac--;
  3112.  
  3113. if(document.daneCOK.dataod.value.length == 0)
  3114.     return true;
  3115.  
  3116. if (data_OK(document.daneCOK.dataod.value) == 0)
  3117.     {
  3118.         alert(inf1);
  3119.         document.daneCOK.dataod.focus();
  3120.         return false;
  3121.     }
  3122.     d = new Date(rok,miesiac,dzien, 23, 59, 0);
  3123.     if (dzien==d.getDate() && miesiac==d.getMonth() && rok==d.getFullYear())
  3124.     {
  3125.         return true;
  3126.     }
  3127.     else
  3128.     {
  3129.         alert(inf2);
  3130.         document.daneCOK.dataod.focus();
  3131.          return false;
  3132.     }
  3133. }
  3134.  
  3135. function sprListaHasel_Firma(inf) {
  3136. var OK = 1;
  3137. var NO = 0;
  3138. var dlugosc = 0;
  3139. var koniec = false;
  3140.  
  3141. dlugosc = document.daneFirmy.listyHasel.value.length;
  3142.     if ( isNaN(document.daneFirmy.listyHasel.value) != 0 ){
  3143.                 alert(inf);
  3144.                 koniec = true;
  3145.         }
  3146.         if (dlugosc == 0 ){
  3147.                 koniec = true;
  3148.         }          
  3149.         if(!koniec){
  3150.                 return OK;
  3151.         }
  3152.         else {
  3153.             document.daneFirmy.listyHasel.focus();
  3154.             return NO;
  3155.     }
  3156. }
  3157.  
  3158. function sprHasla_Firma(inf) {
  3159. var OK = 1;
  3160. var NO = 0;
  3161. var dlugosc = 0;
  3162. var koniec = false;
  3163.  
  3164. dlugosc = document.daneFirmy.hasla.value.length;
  3165.     if ( isNaN(document.daneFirmy.hasla.value) != 0 ){
  3166.                 alert(inf);
  3167.                 koniec = true;
  3168.         }
  3169.         if (dlugosc == 0 ){
  3170.                 koniec = true;
  3171.         }          
  3172.         if(!koniec){
  3173.                 return OK;
  3174.         }
  3175.         else {
  3176.             document.daneFirmy.hasla.focus();
  3177.             return NO;
  3178.     }
  3179. }
  3180.  
  3181. function sprdatado_Firma(inf1, inf2) {
  3182. var rok = document.daneFirmy.datado.value.substring(0,4);
  3183. var miesiac = document.daneFirmy.datado.value.substring(5,7);
  3184. var dzien = document.daneFirmy.datado.value.substring(8);
  3185. miesiac--;
  3186.  
  3187. if(document.daneFirmy.datado.value.length == 0)
  3188.     return true;
  3189.  
  3190. if (data_OK(document.daneFirmy.datado.value) == 0)
  3191.     {
  3192.        alert(inf1);
  3193.         document.daneFirmy.datado.focus();
  3194.         return false;
  3195.  
  3196. }
  3197.     d = new Date(rok,miesiac,dzien, 23, 59, 0);
  3198.    
  3199.     if (dzien==d.getDate() && miesiac==d.getMonth() && rok==d.getFullYear())
  3200.     {
  3201.         return true;
  3202.     }
  3203.     else
  3204.     {
  3205.         alert(inf2);
  3206.         document.daneFirmy.datado.focus();
  3207.         return false;
  3208.     }
  3209. }
  3210.  
  3211.  
  3212.  
  3213.  
  3214. function kompletnosc_danych_wykaz(){
  3215. var pola = "";
  3216. var koniec = false;
  3217. var koniec2 = false;
  3218. var error = "";
  3219. error = "Popraw pola:\n";
  3220.        
  3221.         if(document.wykazPrzesylek.nrOd.value.length > 0){
  3222.             if(tylko_cyfra(document.wykazPrzesylek.nrOd.value) == 0){
  3223.                 pola +=" - nr faktury od\n";
  3224.                 document.wykazPrzesylek.nrOd.focus();
  3225.                 koniec = true;
  3226.             }
  3227.         }
  3228.  
  3229.         if(document.wykazPrzesylek.nrOd.value.length == 0){
  3230.                 pola +=" - nr faktury od\n";
  3231.                 document.wykazPrzesylek.nrOd.focus();
  3232.                 koniec = true;
  3233.         }
  3234.        if(document.wykazPrzesylek.rok.value.length == 0){
  3235.                 pola +=" - rok\n";
  3236.                 document.wykazPrzesylek.rok.focus();
  3237.                 koniec = true;
  3238.         }
  3239.  
  3240.  
  3241.         if(document.wykazPrzesylek.nrDo.value.length > 0){
  3242.             if(tylko_cyfra(document.wykazPrzesylek.nrDo.value) == 0){
  3243.                 pola +=" - nr faktury do\n";
  3244.                 document.wykazPrzesylek.nrDo.focus();
  3245.                 koniec = true;
  3246.             }
  3247.         }
  3248.        if(document.wykazPrzesylek.rok.value.length > 0){
  3249.             if(tylko_cyfra(document.wykazPrzesylek.rok.value) == 0){
  3250.                 pola +=" - rok\n";
  3251.                 document.wykazPrzesylek.rok.focus();
  3252.                 koniec = true;
  3253.             }
  3254.         }
  3255.  
  3256.         if(document.wykazPrzesylek.nrDo.value.length == 0){
  3257.                 pola +=" - nr faktury do\n";
  3258.                 document.wykazPrzesylek.nrDo.focus();
  3259.                 koniec = true;
  3260.         }
  3261.  
  3262.     if(!koniec)
  3263.         document.wykazPrzesylek.submit();
  3264.     else
  3265.         alert(error + pola);
  3266. }
  3267.  
  3268.  
  3269. function kompletnosc_danych_faktura(){
  3270. var pola = "";
  3271. var koniec = false;
  3272. var koniec2 = false;
  3273. var error = "";
  3274. error = "Popraw pola:\n";
  3275.         if(document.faktury.rok.value.length != 0){
  3276.             if(tylko_cyfra(document.faktury.rok.value) == 0){
  3277.                 pola= " -rok \n";
  3278.                 document.faktury.rok.focus();
  3279.                 koniec = true;
  3280.             }
  3281.             else if (document.faktury.rok.value < 2005){
  3282.                 pola= " - rok \n";
  3283.                 document.faktury.rok.focus();
  3284.                 koniec = true;
  3285.             }      
  3286.         }
  3287.         else{
  3288.             pola= " - rok \n";
  3289.             document.faktury.rok.focus();
  3290.             koniec = true;
  3291.         }
  3292.  
  3293.         if(document.faktury.nrOd.value.length > 0){
  3294.             if(tylko_cyfra(document.faktury.nrOd.value) == 0){
  3295.                 pola +=" - nr faktury od\n";
  3296.                 document.faktury.nrOd.focus();
  3297.                 koniec = true;
  3298.             }
  3299.         }
  3300.  
  3301.    
  3302.         if(document.faktury.nrDo.value.length > 0){
  3303.             if(tylko_cyfra(document.faktury.nrDo.value) == 0){
  3304.                 pola +=" - nr faktury do\n";
  3305.                 document.faktury.nrDo.focus();
  3306.                 koniec = true;
  3307.             }
  3308.         }
  3309.  
  3310.         if(document.faktury.nrBil.value.length > 0){
  3311.             if(tylko_cyfra(document.faktury.nrBil.value) == 0){
  3312.                 pola +=" - nr transakcji\n";
  3313.                 document.faktury.nrBil.focus();
  3314.                 koniec = true;
  3315.             }
  3316.         }
  3317.  
  3318.         if((document.faktury.nrDo.value.length > 0 || document.faktury.nrOd.value.length > 0) && document.faktury.nrBil.value.length > 0){
  3319.             document.faktury.nrOd.focus();
  3320.             koniec2 = true;
  3321.         }
  3322.         if(document.faktury.nrDo.value.length == 0 && document.faktury.nrOd.value.length == 0 && document.faktury.nrBil.value.length == 0){
  3323.             pola +=" - nr faktury od\n - nr faktury do\n - nr transakcji\n";
  3324.             document.faktury.nrOd.focus();
  3325.             koniec = true;
  3326.         }
  3327.        
  3328.         if((document.faktury.nrDo.value.length == 0 && document.faktury.nrOd.value.length > 0) || (document.faktury.nrDo.value.length > 0 && document.faktury.nrOd.value.length == 0)){
  3329.             pola +=" - nr faktury \n";
  3330.             koniec = true;
  3331.         }
  3332.  
  3333.  
  3334.     if(!koniec && !koniec2)
  3335.         document.faktury.submit();
  3336.     else if (koniec && !koniec2)
  3337.         alert(error + pola);
  3338.     else if (!koniec && koniec2)
  3339.         alert("Podaj numery faktur albo numer transakcji\n");
  3340.     else if (koniec && koniec2)
  3341.         alert("Podaj numery faktur albo numer transakcji\n");
  3342. }
  3343.  
  3344.  
  3345. function setAnotherDay(newAnotherDay) {
  3346.     var aDay = newAnotherDay;
  3347.     document.anotherDayForm.anotherday.value = aDay;
  3348.     document.anotherDayForm.submit();
  3349. }
  3350.  
  3351.  
  3352.  
  3353. function redirect(x,dowolny,okno,srodek,korytarz,palacy,niepalacy){
  3354.     var group=new Array(5);
  3355.     for (i=0; i<5; i++){
  3356.         group[i]=new Array();
  3357.     }
  3358.  
  3359.     group[0][0]=new Option(dowolny,"0");
  3360.     group[0][1]=new Option(okno,"1");
  3361.     group[0][2]=new Option(srodek,"2");
  3362.     group[0][3]=new Option(korytarz,"3");
  3363.  
  3364.     group[1][0]=new Option(dowolny,"0");
  3365.     group[1][1]=new Option(okno,"1");
  3366.     group[1][2]=new Option(srodek,"2");
  3367.     group[1][3]=new Option(korytarz,"3");
  3368.  
  3369.     group[2][0]=new Option(dowolny,"0");
  3370.     group[2][1]=new Option(okno,"1");
  3371.     group[2][2]=new Option(srodek,"2");
  3372.  
  3373.     group[3][0]=new Option(dowolny,"0");
  3374.     group[3][1]=new Option(okno,"1");
  3375.     group[3][2]=new Option(srodek,"2");
  3376.  
  3377.     group[4][0]=new Option(dowolny,"0");
  3378.  
  3379.  
  3380.     var temp=document.rkf.usytuowanie;
  3381.  
  3382.     for (m=temp.options.length-1;m>0;m--){
  3383.         temp.options[m]=null;
  3384.     }
  3385.  
  3386.     if (x==5)
  3387.         x=3;
  3388.     if (x==6)
  3389.         x=4;
  3390.  
  3391.     for (i=0;i<group[x].length;i++){
  3392.         temp.options[i]=new Option(group[x][i].text,group[x][i].value);
  3393.     }
  3394.     temp.options[0].selected=true;
  3395. }
  3396.  
  3397.  
  3398. function redirect2(x,caly,meski,damski,dowolne,gora,srodek,dol){
  3399.  
  3400.     var group=new Array(3)
  3401.     var groupUsyt=new Array(3)
  3402.     for (i=0; i<3; i++){
  3403.         group[i]=new Array()
  3404.         groupUsyt[i]=new Array()
  3405.     }
  3406. var wagonde = document.getElementById('wagondelux');
  3407.     group[0][0]=new Option(caly,"0")
  3408.  
  3409.     group[1][0]=new Option(caly,"0")
  3410.     group[1][1]=new Option(meski,"1")
  3411.     group[1][2]=new Option(damski,"2")
  3412.  
  3413.     group[2][0]=new Option(caly,"0")
  3414.     group[2][1]=new Option(meski,"1")
  3415.     group[2][2]=new Option(damski,"2")
  3416.  
  3417.      groupUsyt[0][0]=new Option(dowolne,"0")
  3418.  
  3419.     groupUsyt[1][0]=new Option(dowolne,"0")
  3420.     groupUsyt[1][1]=new Option(gora,"1")
  3421.     groupUsyt[1][2]=new Option(dol,"3")
  3422.  
  3423.     groupUsyt[2][0]=new Option(dowolne,"0")
  3424.     groupUsyt[2][1]=new Option(gora,"1")
  3425.     groupUsyt[2][2]=new Option(srodek,"2")
  3426.     groupUsyt[2][3]=new Option(dol,"3")
  3427.  
  3428.     var temp=document.rkf.plec
  3429.     var tempUsyt=document.rkf.usytuowanie
  3430.  
  3431.     for (m=temp.options.length-1;m>0;m--){
  3432.         temp.options[m]=null
  3433.     }
  3434.     for (m=tempUsyt.options.length-1;m>0;m--){
  3435.         tempUsyt.options[m]=null
  3436.     }
  3437.  
  3438.     for (i=0;i<group[x].length;i++){
  3439.         temp.options[i]=new Option(group[x][i].text,group[x][i].value)    
  3440.     }
  3441.     for (i=0;i<groupUsyt[x].length;i++){
  3442.         tempUsyt.options[i]=new Option(groupUsyt[x][i].text,groupUsyt[x][i].value)
  3443.     }
  3444.     temp.options[0].selected=true
  3445.     tempUsyt.options[0].selected=true
  3446. }
  3447.  
  3448.  
  3449. function redirect3(x,dowolne,gora,srodek,dol){
  3450.  
  3451.     var groups=document.rkf.klasa.options.length
  3452.     var group=new Array(groups)
  3453.     for (i=0; i<groups; i++)
  3454.         group[i]=new Array()
  3455.  
  3456.     group[0][0]=new Option(dowolne,"0")
  3457.     group[0][1]=new Option(gora,"1")
  3458.     group[0][2]=new Option(dol,"3")
  3459.  
  3460.     group[1][0]=new Option(dowolne,"0")
  3461.     group[1][1]=new Option(gora,"1")
  3462.     group[1][2]=new Option(srodek,"2")
  3463.     group[1][3]=new Option(dol,"3")
  3464.  
  3465.     group[2][0]=new Option(dowolne,"0")
  3466.     group[2][1]=new Option(gora,"1")
  3467.     group[2][2]=new Option(srodek,"2")
  3468.     group[2][3]=new Option(dol,"3")
  3469.  
  3470.     group[3][0]=new Option(dowolne,"0")
  3471.     group[3][1]=new Option(gora,"1")
  3472.     group[3][2]=new Option(srodek,"2")
  3473.     group[3][3]=new Option(dol,"3")
  3474.  
  3475.     var temp=document.rkf.usytuowanie
  3476.     for (m=temp.options.length-1;m>0;m--)
  3477.         temp.options[m]=null
  3478.     for (i=0;i<group[x].length;i++){
  3479.         temp.options[i]=new Option(group[x][i].text,group[x][i].value)
  3480.     }
  3481.     temp.options[0].selected=true
  3482. }
  3483.  
  3484. function wyborRodzajuUsera(uInd,labuInd,uIndFirma,labuIndFirma,icDysp,labicDysp,icPracSprzed,labicPracSprzed,icPracBKD1,labicPracBKD1,icPracBKD2,labicPracBKD2,icPracBRZ,labicPracBRZ,icHelpdesk,labicHelpdesk, icCOK, labicCOK, icCallCenter,labicCallCenter, icPracMarketing,labicPracmarketing,ajentAdmin,labAjentFirmy,ajentPracow,labAjentPracFirmy,AdminIC,AdminLok){
  3485.     document.all.firma.style.display=(false)?"block":"none";
  3486.     if (document.daneKlienta.firmaid.value==1 && AdminIC==100){
  3487.         var pozycja;
  3488.         var x, q;
  3489.         for (q = document.daneKlienta.uzytktypkod.options.length; q>=0; q--)
  3490.             document.daneKlienta.uzytktypkod.options[q]=null;
  3491.         pozycja = document.createElement("option");
  3492.         pozycja.setAttribute('value',uInd);
  3493.         var txt = document.createTextNode(labuInd);
  3494.         pozycja.appendChild(txt)
  3495.         daneKlienta.uzytktypkod.appendChild(pozycja);
  3496.         pozycja = document.createElement("option");
  3497.         pozycja.setAttribute('value',uIndFirma);
  3498.         txt = document.createTextNode(labuIndFirma);
  3499.         pozycja.appendChild(txt)
  3500.         daneKlienta.uzytktypkod.appendChild(pozycja);
  3501.     }
  3502.     if (document.daneKlienta.firmaid.value==2 && AdminIC==100){
  3503.         var pozycja;
  3504.         var x, q;
  3505.         for (q = document.daneKlienta.uzytktypkod.options.length; q>=0; q--)
  3506.             document.daneKlienta.uzytktypkod.options[q]=null;
  3507.         pozycja = document.createElement("option");
  3508.         pozycja.setAttribute('value',icDysp);
  3509.         var txt = document.createTextNode(labicDysp);
  3510.         pozycja.appendChild(txt)
  3511.         daneKlienta.uzytktypkod.appendChild(pozycja);
  3512.         pozycja = document.createElement("option");
  3513.         pozycja.setAttribute('value',icPracSprzed);
  3514.         txt = document.createTextNode(labicPracSprzed);
  3515.        pozycja.appendChild(txt)
  3516.       daneKlienta.uzytktypkod.appendChild(pozycja);
  3517.         pozycja = document.createElement("option");
  3518.         pozycja.setAttribute('value',icPracBKD1);
  3519.         txt = document.createTextNode(labicPracBKD1);
  3520.        pozycja.appendChild(txt)
  3521.       daneKlienta.uzytktypkod.appendChild(pozycja);
  3522.         pozycja = document.createElement("option");
  3523.         pozycja.setAttribute('value',icPracBKD2);
  3524.         txt = document.createTextNode(labicPracBKD2);
  3525.        pozycja.appendChild(txt)
  3526.       daneKlienta.uzytktypkod.appendChild(pozycja);
  3527.         pozycja = document.createElement("option");
  3528.         pozycja.setAttribute('value',icPracBRZ);
  3529.         txt = document.createTextNode(labicPracBRZ);
  3530.        pozycja.appendChild(txt)
  3531.        daneKlienta.uzytktypkod.appendChild(pozycja);
  3532.           pozycja = document.createElement("option");
  3533.         pozycja.setAttribute('value',icHelpdesk);
  3534.         txt = document.createTextNode(labicHelpdesk);
  3535.         pozycja.appendChild(txt)
  3536.         daneKlienta.uzytktypkod.appendChild(pozycja);
  3537.         pozycja = document.createElement("option");
  3538.         pozycja.setAttribute('value',icCOK);
  3539.         txt = document.createTextNode(labicCOK);
  3540.         pozycja.appendChild(txt)
  3541.         daneKlienta.uzytktypkod.appendChild(pozycja);
  3542.         pozycja = document.createElement("option");
  3543.         pozycja.setAttribute('value',icCallCenter);
  3544.         txt = document.createTextNode(labicCallCenter);
  3545.         pozycja.appendChild(txt)
  3546.         daneKlienta.uzytktypkod.appendChild(pozycja);
  3547.         pozycja = document.createElement("option");
  3548.         pozycja.setAttribute('value',icPracMarketing);
  3549.         txt = document.createTextNode(labicPracmarketing);
  3550.         pozycja.appendChild(txt)
  3551.         daneKlienta.uzytktypkod.appendChild(pozycja);
  3552.  
  3553.     }
  3554.     if (daneKlienta.firmaid.value>2){
  3555.        var pozycja;
  3556.        var x, q;
  3557.        for (q = document.daneKlienta.uzytktypkod.options.length; q>=0; q--)
  3558.             document.daneKlienta.uzytktypkod.options[q]=null;
  3559.         if(AdminIC==100){
  3560.             pozycja = document.createElement("option");
  3561.             pozycja.setAttribute('value',ajentAdmin);
  3562.             var txt = document.createTextNode(labAjentFirmy);
  3563.             pozycja.appendChild(txt)
  3564.             daneKlienta.uzytktypkod.appendChild(pozycja);
  3565.         }
  3566.         if(AdminLok==ajentAdmin){
  3567.             pozycja = document.createElement("option");
  3568.             pozycja.setAttribute('value',ajentPracow);
  3569.             var txt = document.createTextNode(labAjentPracFirmy);
  3570.             pozycja.appendChild(txt)
  3571.             daneKlienta.uzytktypkod.appendChild(pozycja);
  3572.         }
  3573.     }
  3574.         if (document.daneKlienta.uzytktypkod.value>=130 && document.daneKlienta.uzytktypkod.value<200){
  3575.         document.daneKlienta.adminip.disabled=false;
  3576.           if (document.daneKlienta.uzytktypkod.value==160 ){
  3577.               document.all.DaneCOK.style.display="block";
  3578.         }else
  3579.             {
  3580.            document.all.DaneCOK.style.display=(false)?"block":"none";
  3581.             }
  3582.        }
  3583.         else{
  3584.         document.daneKlienta.adminip.value="";
  3585.         document.daneKlienta.adminip.disabled=true;        
  3586.       document.all.DaneCOK.style.display=(false)?"block":"none";
  3587.         }
  3588. }
  3589.  
  3590. function wyborIndFirmaStart(ulica, kod, miasto) {
  3591.     document.all.firma.style.display=(false)?"block":"none";
  3592.     document.all.DaneCOK.style.display="none";
  3593.     document.daneKlienta.ulica.disabled = false;
  3594.     document.daneKlienta.kodpocztowy.disabled = false;
  3595.     document.daneKlienta.miasto.disabled = false;
  3596.     document.all.Napisy.innerHTML = "<font color=\"red\">*</font>"+ulica+":";
  3597.     document.all.Napisy1.innerHTML = "<font color=\"red\">*</font>"+kod+"/ "+miasto+":";
  3598. }
  3599.  
  3600. function wyborIndFirma(ulica, kod, miasto) {
  3601.     if (daneKlienta.uzytktypkod.value==990) {
  3602.         document.all.firma.style.display=(true)?"block":"none";
  3603.         document.all.DaneCOK.style.display="none";
  3604.         document.daneKlienta.ulica.disabled = true;
  3605.         document.daneKlienta.kodpocztowy.disabled = true;
  3606.         document.daneKlienta.miasto.disabled = true;
  3607.         document.daneKlienta.ulica.value="";
  3608.         document.daneKlienta.kodpocztowy.value="";
  3609.         document.daneKlienta.miasto.value="";
  3610.         document.all.Napisy.innerHTML = "<font color=\"gray\">"+ulica+":</font>";
  3611.         document.all.Napisy1.innerHTML = "<font color=\"gray\">"+kod+"/ "+miasto+":</font>";
  3612.     }
  3613.     else {
  3614.         document.all.firma.style.display=(false)?"block":"none";
  3615.         document.daneKlienta.ulica.disabled = false;
  3616.         document.daneKlienta.kodpocztowy.disabled = false;
  3617.         document.daneKlienta.miasto.disabled = false;
  3618.         document.all.Napisy.innerHTML = "<font color=\"red\">*</font>"+ulica+":";
  3619.         document.all.Napisy1.innerHTML = "<font color=\"red\">*</font>"+kod+"/ "+miasto+":";
  3620.         if (document.daneKlienta.uzytktypkod.value>=130 && document.daneKlienta.uzytktypkod.value<200){            
  3621.         document.daneKlienta.adminip.disabled=false;
  3622.         if (document.daneKlienta.uzytktypkod.value==160 ){
  3623.               document.all.DaneCOK.style.display="block";
  3624.         }else
  3625.         {
  3626.          document.all.DaneCOK.style.display="none";
  3627.         }
  3628.          }
  3629.         else{
  3630.         document.daneKlienta.adminip.value="";
  3631.         document.daneKlienta.adminip.disabled=true;        
  3632.         document.all.DaneCOK.style.display="none";
  3633.         }
  3634.     }
  3635. }
  3636. function jesliToFirmaStart(ulica, kod, miasto) {
  3637.     document.all.DaneFirma.disabled= true;
  3638.     document.all.UWAGA.style.display=(false)?"block":"none";
  3639.         /*
  3640.        if(document.daneKlienta.jesliAdresWysylka.checked == true) {
  3641.          document.all.DaneKorespondencyjneFirmy.disabled=false;
  3642.          document.daneKlienta.firmaWysylka.disabled = false;
  3643.         }
  3644.         */
  3645.     document.all.Napisy.innerHTML = "<font color=\"red\">*</font>"+ulica+":";
  3646.     document.all.Napisy1.innerHTML = "<font color=\"red\">*</font>"+kod+"/ "+miasto+":";
  3647.     document.all.Napisy2.innerHTML = "<font color=\"gray\">"+ulica+":</font>";
  3648.     document.all.Napisy3.innerHTML = "<font color=\"gray\">"+kod+"/ "+miasto+":</font>";
  3649.     if (document.daneKlienta.nazwafirmy.value.length>0)
  3650.     {
  3651.     document.daneKlienta.jesliFirma.checked = true;
  3652.  
  3653.     }
  3654.     jesliToFirma(ulica, kod, miasto);
  3655. }
  3656.  
  3657. function jesliToFirma(ulica, kod, miasto) {
  3658.     if(document.daneKlienta.jesliFirma.checked == true) {
  3659.         document.daneKlienta.ulica.disabled = true;
  3660.         document.daneKlienta.kodpocztowy.disabled = true;
  3661.         document.daneKlienta.miasto.disabled = true;
  3662.         document.daneKlienta.ulica.value="";
  3663.         document.daneKlienta.kodpocztowy.value="";
  3664.         document.daneKlienta.miasto.value="";
  3665.         document.all.Napisy.innerHTML = "<font color=\"gray\">"+ulica+":</font>";
  3666.         document.all.Napisy1.innerHTML = "<font color=\"gray\">"+kod+"/ "+miasto+":</font>";
  3667.         document.all.Napisy2.innerHTML = "<font color=\"red\">*</font>"+ulica+":";
  3668.         document.all.Napisy3.innerHTML = "<font color=\"red\">*</font>"+kod+"/ "+miasto+":";
  3669.         document.all.DaneFirma.disabled=false;
  3670.         document.all.UWAGA.style.display=(true)?"block":"none";
  3671.         document.daneKlienta.nazwafirmy.disabled = false;
  3672.         document.daneKlienta.ulicafirmy.disabled = false;
  3673.         document.daneKlienta.nipfirmy.disabled = false;
  3674.         document.daneKlienta.kodpocztowyfirmy.disabled = false;
  3675.         document.daneKlienta.miastofirmy.disabled = false;
  3676.         /*
  3677.         if(document.daneKlienta.jesliAdresWysylka.checked == true) {
  3678.                 document.all.DaneKorespondencyjneFirmy.disabled=false;
  3679.                 document.daneKlienta.firmaWysylka.disabled = false;
  3680.         }
  3681.         */
  3682.     }
  3683.     else {
  3684.         document.daneKlienta.ulica.disabled = false;
  3685.         document.daneKlienta.kodpocztowy.disabled = false;
  3686.         document.daneKlienta.miasto.disabled = false;
  3687.          document.all.UWAGA.style.display=(false)?"block":"none";
  3688.       document.daneKlienta.nazwafirmy.disabled = true;
  3689.         document.daneKlienta.ulicafirmy.disabled = true;
  3690.         document.daneKlienta.nipfirmy.disabled = true;
  3691.         document.daneKlienta.kodpocztowyfirmy.disabled = true;
  3692.         document.daneKlienta.miastofirmy.disabled = true;
  3693.  
  3694.         document.all.Napisy.innerHTML = "<font color=\"red\">*</font>"+ulica+":";
  3695.         document.all.Napisy1.innerHTML = "<font color=\"red\">*</font>"+kod+"/ "+miasto+":";
  3696.      document.all.Napisy2.innerHTML = "<font color=\"gray\">"+ulica+":</font>";
  3697.     document.all.Napisy3.innerHTML = "<font color=\"gray\">"+kod+"/ "+miasto+":</font>";
  3698.     document.all.DaneFirma.disabled=true;
  3699.     document.daneKlienta.firmaWysylka.disabled = true;
  3700.      document.all.DaneKorespondencyjneFirmy.disabled=true;
  3701.  
  3702.         /*
  3703.      if(document.daneKlienta.jesliAdresWysylka.checked == true) {
  3704.        document.daneKlienta.ulicaWysylka.disabled = false;
  3705.         document.daneKlienta.kodpocztowyWysylka.disabled = false;
  3706.         document.daneKlienta.miastoWysylka.disabled = false;
  3707.  
  3708.       }
  3709.       */
  3710.     }
  3711. }
  3712. function jesliFirmaWyczysc(){
  3713.     if(document.daneKlienta.jesliFirma.checked == false){
  3714.         document.daneKlienta.nazwafirmy.value="";
  3715.         document.daneKlienta.ulicafirmy.value="";
  3716.         document.daneKlienta.nipfirmy.value="";
  3717.         document.daneKlienta.kodpocztowyfirmy.value="";
  3718.         document.daneKlienta.miastofirmy.value="";
  3719.         document.daneKlienta.firmaWysylka.value="";
  3720.        document.daneKlienta.nazwafirmy.disabled = true;
  3721.         document.daneKlienta.ulicafirmy.disabled = true;
  3722.         document.daneKlienta.nipfirmy.disabled = true;
  3723.         document.daneKlienta.kodpocztowyfirmy.disabled = true;
  3724.         document.daneKlienta.miastofirmy.disabled = true;
  3725.         document.daneKlienta.firmaWysylka.disabled = true;
  3726.     }  
  3727. }
  3728.  
  3729. function jesliAdresWysylkaStart(ulica, kod, miasto) {
  3730.     document.all.DaneKorespondencyjneFirmy.disabled=false;
  3731.       document.daneKlienta.firmaWysylka.disabled = false;
  3732.     document.all.DaneKorespondencyjne.disabled=false;
  3733.    if (document.daneKlienta.ulicaWysylka.value.length>0)
  3734.     {
  3735.     //document.daneKlienta.jesliAdresWysylka.checked = true;
  3736.      }
  3737.       jesliAresdoWysylki(ulica, kod, miasto);
  3738. }
  3739.  
  3740. function jesliAresdoWysylki(ulica, kod, miasto) {
  3741. if(document.daneKlienta.disabledData.value==0){  
  3742.    
  3743.     if(document.daneKlienta.jesliAdresWysylka.checked == true) {
  3744.     document.all.DaneKorespondencyjne.disabled=false;
  3745.     document.daneKlienta.ulicaWysylka.disabled = false;
  3746.     document.daneKlienta.kodpocztowyWysylka.disabled = false;
  3747.     document.daneKlienta.miastoWysylka.disabled = false;
  3748.  
  3749.     if(document.daneKlienta.nazwafirmy.disabled == true){
  3750.     document.daneKlienta.firmaWysylka.value="";
  3751.     document.daneKlienta.firmaWysylka.disabled=true;
  3752.    document.all.DaneKorespondencyjneFirmy.disabled=true;
  3753.             }
  3754.         else
  3755.         {
  3756.         document.all.DaneKorespondencyjneFirmy.disabled=false;
  3757.          document.daneKlienta.firmaWysylka.disabled=false;
  3758.         }
  3759.      }
  3760.     else {
  3761.        document.daneKlienta.ulicaWysylka.value="";
  3762.         document.daneKlienta.kodpocztowyWysylka.value="";
  3763.         document.daneKlienta.miastoWysylka.value="";
  3764.   document.daneKlienta.ulicaWysylka.disabled = true;
  3765.     document.daneKlienta.kodpocztowyWysylka.disabled = true;
  3766.     document.daneKlienta.miastoWysylka.disabled = true;
  3767.  
  3768.   document.daneKlienta.firmaWysylka.value="";
  3769.     document.all.DaneKorespondencyjne.disabled=true;
  3770.         document.daneKlienta.firmaWysylka.disabled=true;
  3771.   document.all.DaneKorespondencyjneFirmy.disabled=true;
  3772.       }
  3773. }
  3774. }
  3775.  
  3776.  
  3777. function jesliAdresWysylkaWyczysc(){
  3778.     /*
  3779.     if(document.daneKlienta.jesliAdresWysylka.checked == false){
  3780.         document.daneKlienta.ulicaWysylka.value="";
  3781.         document.daneKlienta.kodpocztowyWysylka.value="";
  3782.         document.daneKlienta.miastoWysylka.value="";
  3783.         document.daneKlienta.ulicaWysylka.disabled = true;
  3784.         document.daneKlienta.kodpocztowyWysylka.disabled = true;
  3785.         document.daneKlienta.miastoWysylka.disabled = true;
  3786.  
  3787.     }
  3788.     */
  3789. }
  3790.  
  3791. function jesliMiejsceSasiadujaceStart() {
  3792.     if(document.rkf.isMiejsceSasiadujace.checked == true) {
  3793.     document.all.MiejsceSasiadujace.style.display=(true)?"block":"none";
  3794.     }
  3795.     else {
  3796.     document.all.MiejsceSasiadujace.style.display=(false)?"block":"none";
  3797.     }
  3798.  }
  3799.  
  3800. function jesliMiejsceSasiadujace() {
  3801.     if(document.rkf.isMiejsceSasiadujace.checked == true) {
  3802.     document.all.MiejsceSasiadujace.style.display=(true)?"block":"none";
  3803.     }
  3804.     else {
  3805.     document.all.MiejsceSasiadujace.style.display=(false)?"block":"none";
  3806.     }
  3807. }
  3808.  
  3809. function jesliMiejsceSasiadujaceWyczysc(){
  3810.     if(document.rkf.isMiejsceSasiadujace.checked == false){
  3811.         document.rkf.nrWagonu.value="";
  3812.         document.rkf.nrMiejsca.value="";
  3813.     }  
  3814. }
  3815.  
  3816.  function jesliFaktura() {
  3817.     if(document.rkh.faktura.checked == true) {
  3818.     document.all.TxtFaktura.style.display=(true)?"block":"none";
  3819.     }
  3820.     else {
  3821.     document.all.TxtFaktura.style.display=(false)?"block":"none";
  3822.     }
  3823. }
  3824.  
  3825.  function jesliKolorowaKarta() {
  3826.     if(document.rkh.platnosc_kolorowa_karta.checked == true) {
  3827.         document.all.kolorowa_karta.style.display=(true)?"block":"none";
  3828.         document.all.dla.readOnly=false;
  3829.  
  3830.         document.all.dla.value=document.all.dla_org.value;
  3831.          }
  3832.     else {
  3833.         document.all.kolorowa_karta.style.display=(false)?"block":"none";
  3834.         document.all.dla.readOnly=false;
  3835.         document.all.numer_kolorowej_karty.value="";
  3836.     }
  3837. }
  3838.  
  3839. function edycjaDanych(ulica, kod, miasto){
  3840.    if(document.daneKlienta.typUsera.value==990){
  3841.         document.daneKlienta.ulica.disabled = true;
  3842.         document.daneKlienta.kodpocztowy.disabled = true;
  3843.         document.daneKlienta.miasto.disabled = true;
  3844.         document.all.Napisy.innerHTML = "<font color=\"gray\">"+ulica+":</font>";
  3845.         document.all.Napisy1.innerHTML = "<font color=\"gray\">"+kod+"/ "+miasto+":</font>";
  3846.     document.all.DaneFirma.style.display=(true)?"block":"none";
  3847.   }
  3848.     else{
  3849.         if(document.daneKlienta.disabledData.value==1){
  3850.             document.daneKlienta.ulica.disabled = true;
  3851.             document.daneKlienta.kodpocztowy.disabled = true;
  3852.             document.daneKlienta.miasto.disabled = true;
  3853.             document.all.Napisy.innerHTML = "<font color=\"gray\">*"+ulica+":</font>";
  3854.             document.all.Napisy1.innerHTML = "<font color=\"gray\">*"+kod+"/ "+miasto+":</font>";
  3855.             document.all.DaneFirma.style.display=(false)?"block":"none";    
  3856.              }
  3857.         else{
  3858.             document.daneKlienta.ulica.disabled = false;
  3859.             document.daneKlienta.kodpocztowy.disabled = false;
  3860.             document.daneKlienta.miasto.disabled = false;
  3861.             document.all.Napisy.innerHTML = "<font color=\"red\">*</font>"+ulica+":";
  3862.             document.all.Napisy1.innerHTML = "<font color=\"red\">*</font>"+kod+"/"+miasto+":";
  3863.             document.all.DaneFirma.style.display=(false)?"block":"none";        
  3864.         }
  3865.     }    
  3866. }
  3867. function PokazAktualnosciStart()
  3868. {
  3869. document.all.PoleAktualnosci.style.display=(false)?"block":"none";
  3870. document.all.PoleAktualnosci1.style.display=(false)?"block":"none";
  3871. document.all.PoleAktualnosci2.style.display=(false)?"block":"none";
  3872. document.all.PoleAktualnosci3.style.display=(false)?"block":"none";
  3873. }
  3874.  
  3875. function PokazAktualnosci()
  3876. {
  3877. document.all.p1.style.color="#FF8000";
  3878. document.all.p1.style.font=12+"px;";
  3879. document.all.p2.style.color="#103293";
  3880. document.all.p2.style.font=11+"px;";
  3881. document.all.p3.style.color="#103293";
  3882. document.all.p3.style.font=11+"px;";
  3883. document.all.p4.style.color="#103293";
  3884. document.all.p4.style.font=11+"px;";
  3885. document.all.PoleAktualnosci.style.display=(true)?"block":"none";
  3886. document.all.PoleAktualnosci1.style.display=(false)?"block":"none";
  3887. document.all.PoleAktualnosci2.style.display=(false)?"block":"none";
  3888. document.all.PoleAktualnosci3.style.display=(false)?"block":"none";
  3889. }
  3890.  
  3891. function PokazAktualnosci1()
  3892. {
  3893. document.all.p1.style.color="#103293";
  3894. document.all.p1.style.font=11+"px;";
  3895. document.all.p2.style.color="#FF8000";
  3896. document.all.p2.style.font=12+"px;";
  3897. document.all.p3.style.color="#103293";
  3898. document.all.p3.style.font=11+"px;";
  3899. document.all.p4.style.color="#103293";
  3900. document.all.p4.style.font=11+"px;";
  3901. document.all.PoleAktualnosci1.style.display=(true)?"block":"none";
  3902. document.all.PoleAktualnosci.style.display=(false)?"block":"none";
  3903. document.all.PoleAktualnosci2.style.display=(false)?"block":"none";
  3904. document.all.PoleAktualnosci3.style.display=(false)?"block":"none";
  3905. }
  3906.  
  3907. function PokazAktualnosci2()
  3908. {
  3909. document.all.p1.style.color="#103293";
  3910. document.all.p1.style.font=11+"px;";
  3911. document.all.p2.style.color="#103293";
  3912. document.all.p2.style.font=11+"px;";
  3913. document.all.p3.style.color="#FF8000";
  3914. document.all.p3.style.font=12+"px;";
  3915. document.all.p4.style.color="#103293";
  3916. document.all.p4.style.font=11+"px;";
  3917. document.all.PoleAktualnosci2.style.display=(true)?"block":"none";
  3918. document.all.PoleAktualnosci1.style.display=(false)?"block":"none";
  3919. document.all.PoleAktualnosci.style.display=(false)?"block":"none";
  3920. document.all.PoleAktualnosci3.style.display=(false)?"block":"none";
  3921. }
  3922.  
  3923. function PokazAktualnosci3()
  3924. {
  3925. document.all.p1.style.color="#103293";
  3926. document.all.p1.style.font=11+"px;";
  3927. document.all.p2.style.color="#103293";
  3928. document.all.p2.style.font=11+"px;";
  3929. document.all.p3.style.color="#103293";
  3930. document.all.p3.style.font=11+"px;";
  3931. document.all.p4.style.color="#FF8000";
  3932. document.all.p4.style.font=12+"px;";
  3933. document.all.PoleAktualnosci3.style.display=(true)?"block":"none";
  3934. document.all.PoleAktualnosci1.style.display=(false)?"block":"none";
  3935. document.all.PoleAktualnosci2.style.display=(false)?"block":"none";
  3936. document.all.PoleAktualnosci.style.display=(false)?"block":"none";
  3937. }
  3938.  
  3939. function zmien1()
  3940. {
  3941.     var temp='';
  3942.     temp=document.aktualnosci_zap.aktualnosci.value;
  3943.     document.aktualnosci_zap.aktualnosci.value=document.aktualnosci_zap.aktualnosci1.value;
  3944.     document.aktualnosci_zap.aktualnosci1.value=temp;
  3945.     var temp1='';
  3946.     temp1=document.aktualnosci_zap.news_tyt.value;
  3947.     document.aktualnosci_zap.news_tyt.value=document.aktualnosci_zap.news_tyt1.value;
  3948.     document.aktualnosci_zap.news_tyt1.value=temp1;
  3949.  
  3950.     var tempa='';
  3951.     tempa=document.aktualnosci_zap.aktualnoscia.value;
  3952.     document.aktualnosci_zap.aktualnoscia.value=document.aktualnosci_zap.aktualnosci1a.value;
  3953.     document.aktualnosci_zap.aktualnosci1a.value=tempa;
  3954.     var temp1a='';
  3955.     temp1a=document.aktualnosci_zap.news_tyta.value;
  3956.     document.aktualnosci_zap.news_tyta.value=document.aktualnosci_zap.news_tyt1a.value;
  3957.     document.aktualnosci_zap.news_tyt1a.value=temp1a;
  3958.  
  3959.     if(document.aktualnosci_zap.news.checked==true)
  3960.         var temp2a=1;
  3961.     else
  3962.         var temp2a=0;
  3963.     if(document.aktualnosci_zap.news1.checked==true)
  3964.         document.aktualnosci_zap.news.checked=true;
  3965.     else
  3966.         document.aktualnosci_zap.news.checked=false;
  3967.     if(temp2a==1)
  3968.         document.aktualnosci_zap.news1.checked=true;
  3969.     else
  3970.         document.aktualnosci_zap.news1.checked=false;
  3971. }
  3972.  
  3973. function zmien2()
  3974. {
  3975.     var temp='';
  3976.     temp=document.aktualnosci_zap.aktualnosci1.value;
  3977.     document.aktualnosci_zap.aktualnosci1.value=document.aktualnosci_zap.aktualnosci2.value;
  3978.     document.aktualnosci_zap.aktualnosci2.value=temp;
  3979.     var temp1='';
  3980.     temp1=document.aktualnosci_zap.news_tyt1.value;
  3981.     document.aktualnosci_zap.news_tyt1.value=document.aktualnosci_zap.news_tyt2.value;
  3982.     document.aktualnosci_zap.news_tyt2.value=temp1;
  3983.  
  3984.     var tempa='';
  3985.     tempa=document.aktualnosci_zap.aktualnosci1a.value;
  3986.     document.aktualnosci_zap.aktualnosci1a.value=document.aktualnosci_zap.aktualnosci2a.value;
  3987.     document.aktualnosci_zap.aktualnosci2a.value=tempa;
  3988.     var temp1a='';
  3989.     temp1a=document.aktualnosci_zap.news_tyt1a.value;
  3990.     document.aktualnosci_zap.news_tyt1a.value=document.aktualnosci_zap.news_tyt2a.value;
  3991.     document.aktualnosci_zap.news_tyt2a.value=temp1a;
  3992.  
  3993.     if(document.aktualnosci_zap.news1.checked==true)
  3994.         var temp2a=1;
  3995.     else
  3996.         var temp2a=0;
  3997.     if(document.aktualnosci_zap.news2.checked==true)
  3998.         document.aktualnosci_zap.news1.checked=true;
  3999.     else
  4000.         document.aktualnosci_zap.news1.checked=false;
  4001.     if(temp2a==1)
  4002.         document.aktualnosci_zap.news2.checked=true;
  4003.     else
  4004.         document.aktualnosci_zap.news2.checked=false;
  4005. }
  4006.  
  4007. function zmien3()
  4008. {
  4009.     var temp='';
  4010.     temp=document.aktualnosci_zap.aktualnosci2.value;
  4011.     document.aktualnosci_zap.aktualnosci2.value=document.aktualnosci_zap.aktualnosci3.value;
  4012.     document.aktualnosci_zap.aktualnosci3.value=temp;
  4013.     var temp1='';
  4014.     temp1=document.aktualnosci_zap.news_tyt2.value;
  4015.     document.aktualnosci_zap.news_tyt2.value=document.aktualnosci_zap.news_tyt3.value;
  4016.     document.aktualnosci_zap.news_tyt3.value=temp1;
  4017.  
  4018.     var tempa='';
  4019.     tempa=document.aktualnosci_zap.aktualnosci2a.value;
  4020.     document.aktualnosci_zap.aktualnosci2a.value=document.aktualnosci_zap.aktualnosci3a.value;
  4021.     document.aktualnosci_zap.aktualnosci3a.value=tempa;
  4022.     var temp1a='';
  4023.     temp1a=document.aktualnosci_zap.news_tyt2a.value;
  4024.     document.aktualnosci_zap.news_tyt2a.value=document.aktualnosci_zap.news_tyt3a.value;
  4025.     document.aktualnosci_zap.news_tyt3a.value=temp1a;
  4026.  
  4027.     if(document.aktualnosci_zap.news2.checked==true)
  4028.         var temp2a=1;
  4029.     else
  4030.         var temp2a=0;
  4031.     if(document.aktualnosci_zap.news3.checked==true)
  4032.         document.aktualnosci_zap.news2.checked=true;
  4033.     else
  4034.         document.aktualnosci_zap.news2.checked=false;
  4035.     if(temp2a==1)
  4036.         document.aktualnosci_zap.news3.checked=true;
  4037.     else
  4038.         document.aktualnosci_zap.news3.checked=false;
  4039. }
  4040.  
  4041.  
  4042.  
  4043.  
  4044.  
  4045.  
  4046. function setCookie(c_name,value,expiredays)
  4047.             {
  4048.                 var exdate=new Date();
  4049.                 exdate.setDate(expiredays)
  4050.                 document.cookie=c_name+ "=" +escape(value)+
  4051.                 ((expiredays==null) ? "" : ";expires="+exdate)                
  4052.             }
  4053.  
  4054.             function getCookie(c_name)
  4055.             {
  4056.                 if (document.cookie.length>0)
  4057.                 {
  4058.                     c_start=document.cookie.indexOf(c_name + "=")
  4059.                     if (c_start!=-1)
  4060.                     {
  4061.                         c_start=c_start + c_name.length+1
  4062.                         c_end=document.cookie.indexOf(";",c_start)
  4063.                         if (c_end==-1) c_end=document.cookie.length
  4064.                         return unescape(document.cookie.substring(c_start,c_end))
  4065.                     }
  4066.                 }
  4067.                 return null
  4068.             }
  4069.  
  4070. function kontrola(pole, maxlimit)
  4071. {
  4072. if (pole.value.length > maxlimit)
  4073.     pole.value = pole.value.substring(0, maxlimit);
  4074. }
  4075.  
  4076. function eCardTransakcje_Kontrola()
  4077. {
  4078.     if(document.Szukaj.nazwa_szukaj.value.length>1 || document.Szukaj.loginMail_szukaj.value.length>5 || document.Szukaj.pesel_szukaj.value.length>8){
  4079.         if(document.Szukaj.nazwa_szukaj.value.length>1 && document.Szukaj.loginMail_szukaj.value.length<6 && document.Szukaj.loginMail_szukaj.value.length>0)
  4080.         {
  4081.         if (document.Szukaj.pesel_szukaj.value.length>0 && document.Szukaj.pesel_szukaj.value.length<8)
  4082.         {
  4083.                 alert("Login lub e-mail minimalnie 6 znaków \n(w adresie e-mail musi wyst±piæ @)\nPesel minimalnie 9 znaków.");
  4084.         }else{
  4085.              alert("Login lub e-mail minimalnie 6 znaków \n(w adresie e-mail musi wyst±piæ @).");
  4086.         }
  4087.         }else{
  4088.             document.Szukaj.submit();
  4089.         }
  4090.     } else {
  4091.         if (document.Szukaj.pesel_szukaj.value.length>0 && document.Szukaj.pesel_szukaj.value.length<8)
  4092.         {
  4093.             alert("Imiê i/lub Nazwisko minimalnie 2 znaki \nLogin lub e-mail minimalnie 6 znaków \n(w adresie e-mail musi wyst±piæ @)\nPesel minimalnie 9 znaków.");
  4094.         }
  4095.         else{
  4096.             alert("Imiê i/lub Nazwisko minimalnie 2 znaki \nLogin lub e-mail minimalnie 6 znaków \n(w adresie e-mail musi wyst±piæ @).");
  4097.         }
  4098.     }
  4099. }
  4100.  
  4101. function formatCeny(wartosc)
  4102. {
  4103. var cena= ""+wartosc;
  4104. var kwota = wartosc;
  4105. var jestKropa=0;
  4106. var txt="";
  4107. cenaTXT="";
  4108. groszeTXT="";
  4109. groszeTXT = ""+wartosc%100;
  4110. groszeTXT= groszeTXT.substring(0,groszeTXT.indexOf('.'));
  4111. jestKropa=cena.indexOf('.');
  4112. if (jestKropa>=0)
  4113. {
  4114. cenaTXT = cena.substring(0,jestKropa);
  4115.     if (cena.length > 2)
  4116.     {
  4117.     if ((wartosc%100) <10)
  4118.         txt =""+cenaTXT.substring(0,cenaTXT.length-2)+",0"+groszeTXT;
  4119.     else
  4120.         txt =""+cenaTXT.substring(0,cenaTXT.length-2)+","+groszeTXT;
  4121.     }
  4122.     else
  4123.     {
  4124.     if ((wartosc%100) <10)
  4125.         txt ="0,0"+groszeTXT;
  4126.     else
  4127.         txt ="0,"+groszeTXT;
  4128.     }
  4129. }
  4130. else
  4131. {
  4132.     if (cena.length > 2)
  4133.     {
  4134.     if ((wartosc%100) <10)
  4135.         txt =""+cena.substring(0,cena.length-2)+",0"+(wartosc%100);
  4136.     else
  4137.         txt =""+cena.substring(0,cena.length-2)+","+(wartosc%100);
  4138.     }
  4139.     else
  4140.     {
  4141.     if ((wartosc%100) <10)
  4142.         txt ="0,0"+(wartosc%100);
  4143.     else
  4144.         txt ="0,"+(wartosc%100);
  4145.     }
  4146.  
  4147. }
  4148.  
  4149.       return txt;
  4150. }
  4151.  
  4152. function obliczBilet(wartosc)
  4153. {
  4154. var cena= 0;
  4155. var procent = document.zwrotBiletow.procBilet.value;
  4156. var txt="";
  4157.    cena = (wartosc*procent)/100;
  4158.    txt=formatCeny(cena);
  4159.     document.zwrotBiletow.zwrotBilet.value=txt;
  4160.  
  4161. }
  4162. function obliczMiejscowke(wartosc)
  4163. {
  4164. var cena= 0;
  4165. var procent = document.zwrotBiletow.procRez.value;
  4166. var txt="";
  4167.    cena = (wartosc*procent)/100;
  4168.    txt=formatCeny(cena);
  4169.     document.zwrotBiletow.zwrotMiejscowka.value=txt;
  4170.  
  4171. }
  4172.  
  4173.  
  4174.  
  4175. function kompletnosc_subkontyngent(){
  4176. var pola = "";
  4177. var koniec = false;
  4178.  
  4179.     if(dlugosc_pol(document.zwrotBiletow.zwrotBilet.length) == 0 || cena_OK(document.zwrotBiletow.zwrotBilet.value) == 0){
  4180.        
  4181.     pola+=" -  Kwota za bilet \n";
  4182.     koniec=true;
  4183.     }
  4184.  
  4185.     if(document.zwrotBiletow.powodBilet.value=="" || dlugosc_pol(document.zwrotBiletow.powodBilet.length) == 0){
  4186.     pola+=" -  Powód zwrotu biletu\n";
  4187.     koniec=true;
  4188.     }
  4189.        
  4190.     if(dlugosc_pol(document.zwrotBiletow.zwrotMiejscowka.length) == 0 || cena_OK(document.zwrotBiletow.zwrotMiejscowka.value) == 0){
  4191.     pola+=" -  Kwota za rezerwacjê\n";
  4192.     koniec=true;
  4193.     }
  4194.  
  4195.     if(document.zwrotBiletow.powodMiejscowka.value=="" || dlugosc_pol(document.zwrotBiletow.powodMiejscowka.length) == 0){
  4196.     pola+=" -  Powód zwrotu rezerwacji\n";
  4197.     koniec=true;
  4198.     }
  4199.  
  4200.     if(!koniec){
  4201.         document.zwrotBiletow.submit();
  4202.     }
  4203.    
  4204.     else {
  4205.     if(pola != "")
  4206.             alert("Popraw lub wype³nij pola:\n" + pola);
  4207.     }
  4208. }
  4209.  
  4210.  
  4211. function zmianaDanychBilet1(imienazwisko, poprpola){
  4212. var pola = "";
  4213. var koniec = false;
  4214.  
  4215.     if(document.fzmien1.podrozny.value=="" || tylko_litery(document.fzmien1.podrozny.value) == 0 || poprawna_nazwa(document.fzmien1.podrozny.value) == 0){
  4216.     pola+=" - " +  imienazwisko + "\n";
  4217.     koniec=true;
  4218.     }
  4219.  
  4220.     if(!koniec){
  4221.     document.fzmien1.submit();
  4222.     }
  4223.     else {
  4224.     if(pola != "")
  4225.             alert(poprpola + ":\n" + pola);
  4226.     }
  4227. }
  4228.  
  4229.  
  4230.  
  4231. function telefon_MMS(inf) {
  4232. var OK = 1;
  4233. var NO = 0;
  4234. var dlugosc = 0;
  4235. var nrTel48= document.wysylkaMMS.tel.value.substring(0,3);
  4236.  
  4237.     dlugosc = document.wysylkaMMS.tel.length;
  4238.  
  4239.     if(dlugosc == 0)
  4240.             return NO;
  4241.  
  4242.     if (tylko_cyfra1(document.wysylkaMMS.tel.value) == 0){
  4243.             alert(inf);
  4244.             document.wysylkaMMS.tel.focus();
  4245.             return NO;
  4246.     }
  4247.  
  4248.             if (nrTel48<480 || nrTel48>489)
  4249.             {
  4250.              alert(inf);
  4251.              document.wysylkaMMS.tel.focus();
  4252.              return NO;
  4253.              }
  4254.  
  4255.     return OK;
  4256. }
  4257.  
  4258. function sprTelMMS(telefon, inf, poprpola){
  4259. var pola = "";
  4260. var koniec = false;
  4261.  
  4262.  
  4263.     if(document.wysylkaMMS.tel.value =="" || telefon_MMS(inf) == 0){
  4264.     pola+=" - " + telefon + "\n";
  4265.     koniec=true;
  4266.     }
  4267.  
  4268.     if(!koniec){
  4269.         document.wysylkaMMS.submit();
  4270.     }
  4271.     else {
  4272.         if(pola != "")
  4273.             alert(poprpola );
  4274.     }
  4275. }
  4276.  
  4277. function getStationNameByIbnr(ibnrField, outFieldId) {
  4278.     var ibnr = document.getElementById(ibnrField).value;
  4279.     if (ibnr === "") {
  4280.         document.getElementById(outFieldId).innerHTML = "nie wybrano";
  4281.     } else if (isNaN(ibnr)) {
  4282.         document.getElementById(outFieldId).innerHTML = "<font color=red>! b³êdny IBNR</font>";
  4283.     } else if (ibnr <= 0) {
  4284.         document.getElementById(outFieldId).innerHTML = "<font color=red>! IBNR <= 0</font>";
  4285.     } else {
  4286.         var xhr = new XMLHttpRequest();
  4287.         xhr.onreadystatechange = function() {
  4288.             if (xhr.readyState === 4) {
  4289.                 var data = xhr.responseText;
  4290.                 document.getElementById(outFieldId).innerHTML = data;
  4291.             }
  4292.         }
  4293.         xhr.open('GET', '/Utils?funkcja=NAZWA_STACJI_PO_IBNR&ibnr='+ibnr, true);
  4294.         xhr.send(null);
  4295.     }
  4296. }
  4297.  
  4298. function delTanszaOferta(owr_id){
  4299.     var xhr = new XMLHttpRequest();
  4300.     xhr.onreadystatechange = function() {
  4301.         if (xhr.readyState === 4) {
  4302.             var data = xhr.responseText;
  4303.             if (data.indexOf("OK") > -1) {
  4304.                 for (var i = 1; i < 9; i++) {
  4305.                     document.getElementById(i + 'C' + owr_id).innerHTML = '<strike>' + document.getElementById(i + 'C' + owr_id).innerHTML + '<strike>';
  4306.                 }
  4307.                 document.getElementById('1B' + owr_id).setAttribute('disabled', 'disabled');
  4308.             } else {
  4309.                 alert(data);
  4310.             }
  4311.         }
  4312.     }
  4313.     xhr.open('GET', '/Utils?funkcja=USUN_TANSZA_OFERTE&owr_id=' + owr_id, true);
  4314.     xhr.send(null);
  4315. }
  4316.  
  4317. function validateTanszaOferta(){
  4318.     var isOk = 1;
  4319.     var text = "";
  4320.     if(document.getElementById("st_od_output").innerHTML==="nie wybrano" || document.getElementById("st_od_output").innerHTML.indexOf('!')>-1){
  4321.         isOk = 0;
  4322.         text = "Proszê uzupe³niæ/poprawiæ stacjê od.";
  4323.     } else if(document.getElementById("st_do_output").innerHTML==="nie wybrano" || document.getElementById("st_do_output").innerHTML.indexOf('!')>-1){
  4324.         isOk = 0;
  4325.         text = "Proszê uzupe³niæ/poprawiæ stacjê do.";
  4326.     } else if(document.getElementById("st_p1_output").innerHTML.indexOf('!')>-1 || document.getElementById("st_p2_output").innerHTML.indexOf('!')>-1 ||
  4327.               document.getElementById("st_p3_output").innerHTML.indexOf('!')>-1 || document.getElementById("st_p4_output").innerHTML.indexOf('!')>-1){
  4328.         isOk = 0;
  4329.         text = "Proszê poprawiæ stacje przez.";
  4330.     } else {
  4331.         var ibnrod = document.getElementById("st_od_input").value;
  4332.         var ibnrdo = document.getElementById("st_do_input").value;
  4333.         var ibnrp1 = document.getElementById("st_p1_input").value;
  4334.         var ibnrp2 = document.getElementById("st_p2_input").value;
  4335.         var ibnrp3 = document.getElementById("st_p3_input").value;
  4336.         var ibnrp4 = document.getElementById("st_p4_input").value;
  4337.         var stacje = new Array(ibnrod, ibnrdo, ibnrp1, ibnrp2, ibnrp3, ibnrp4);
  4338.         for (var i = 0; i < 5; i++) {
  4339.             if (stacje[i] !== '') {
  4340.                 for (var j = i + 1; j < 6; j++) {
  4341.                     if (stacje[j] !== '' && stacje[i] === stacje[j]) {
  4342.                         isOk = 0;
  4343.                         text = "Stacje nie mog¹ siê powtarzaæ.";
  4344.                         break;
  4345.                     }
  4346.                 }
  4347.             }
  4348.             if (isOk === 0) {
  4349.                 break;
  4350.             }
  4351.         }
  4352.         if (isOk === 1) {
  4353.             for (var i = 5; i > 2; i--) {
  4354.                 if (stacje[i] !== '') {
  4355.                     for (var j = i - 1; j > 1; j--) {
  4356.                         if (stacje[j] === '') {
  4357.                             isOk = 0;
  4358.                             text = "Proszê uzupe³niæ puste stacje przez.";
  4359.                             break;
  4360.                         }
  4361.                     }
  4362.                 }
  4363.                 if (isOk === 0) {
  4364.                     break;
  4365.                 }
  4366.             }
  4367.         }
  4368.     }
  4369.     if (isOk === 1) {
  4370.         document.saveForm.submit();
  4371.     } else {
  4372.         alert(text);
  4373.     }
  4374. }
  4375.  
  4376. function sprNip(nip_id){
  4377.     var ret = 0;
  4378.  
  4379.     if (document.getElementById(nip_id).value.length === 0) {
  4380.         ret = 0;
  4381.     } else if(eval(/^[0-9]{10}$/).test(document.getElementById(nip_id).value)){
  4382.         ret = 1;
  4383.     } else {
  4384.         alert("Nieprawid³owy NIP.\nPowinien siê sk³adaæ z 10 cyfr, bez znaków podzia³u.");
  4385.         document.getElementById(nip_id).focus();
  4386.     }
  4387.    
  4388.     if (ret==1)
  4389.     {
  4390.         if (!validatenip(document.getElementById(nip_id).value))
  4391.         {
  4392.             alert("Nieprawid³owy NIP.\nPowinien siê sk³adaæ z 10 cyfr, bez znaków podzia³u.\nSystem sprawdza cyfrê kontroln¹");
  4393.             document.getElementById(nip_id).focus();
  4394.             ret =0;
  4395.         }
  4396.     }
  4397.  
  4398.     return ret;
  4399. }
  4400.  
  4401. function sprNipValue(nip_id){
  4402.     var ret = 0;
  4403.  
  4404.     if(eval(/^[0-9]{10}$/).test(document.getElementById(nip_id).value)){
  4405.         ret = 1;
  4406.     }
  4407.     return ret;
  4408. }
  4409.  
  4410. function sprTylkoLiteryICyfry(field_id, message){
  4411.     var ret = 0;
  4412.  
  4413.     if (document.getElementById(field_id).value.length === 0) {
  4414.         ret = 1;
  4415.     } else if((eval(/^[A-Za-z]+[0-9]+/).test(document.getElementById(field_id).value)||eval(/^[0-9]+[A-Za-z]+/).test(document.getElementById(field_id).value))&& eval(/^[A-Za-z0-9 _]*[A-Za-z0-9][A-Za-z0-9 _]*$/).test(document.getElementById(field_id).value)){
  4416.         ret = 1;
  4417.     } else {
  4418.         alert(message);
  4419.         document.getElementById(field_id).focus();
  4420.     }
  4421.  
  4422.     return ret;
  4423. }
  4424.  
  4425. function sprNrBiletu(bil_id,msg,typ)
  4426. {
  4427.     var ret=0;
  4428.     if (tylko_cyfra1(bil_id)==0)
  4429.     {
  4430.         if (typ==0)
  4431.         {
  4432.             alert(msg)
  4433.         }        
  4434.     }
  4435.     else
  4436.     {
  4437.         ret=1;
  4438.     }
  4439.    
  4440.     return ret;
  4441. }
  4442.  
  4443. function sprPesel(pesel,msg,typ)
  4444. {    
  4445.     var ret=0;
  4446.     if (tylko_cyfra1(pesel)==0 || pesel.length!=11 || pesel=='00000000000')
  4447.     {
  4448.         if (typ==0)
  4449.         {
  4450.              alert(msg)
  4451.          }
  4452.     }
  4453.     else
  4454.     {
  4455.         if (!validatepesel(pesel))
  4456.         {
  4457.             alert(msg);
  4458.         }
  4459.         else
  4460.         {
  4461.             ret=1;
  4462.         }
  4463.        
  4464.     }
  4465.    
  4466.     return ret;
  4467. }
  4468.  
  4469. function sprDowodOsobisty(dowodOsobosty,msg,typ)
  4470. {
  4471.     var ret=0;    
  4472.     reg = /^[A-Z0-9\-\\\s\\\\\/]{9,30}$/;
  4473.     if (!dowodOsobosty.match(reg))
  4474.     {
  4475.         if (typ==0)
  4476.         {
  4477.             alert(msg)
  4478.         }
  4479.     }
  4480.     else
  4481.     {
  4482.         ret=1;
  4483.     }
  4484.    
  4485.     return ret;    
  4486. }
  4487.  
  4488. function sprIdentyfikator(idOption, identyfikator, msgDowod, msgPesel, typDowod, typPesel, typ){
  4489.     var ret = 0;
  4490.     if (document.getElementById(idOption).value === typPesel) {
  4491.         ret = sprPesel(identyfikator, msgPesel, typ);
  4492.     } else if (document.getElementById(idOption).value === typDowod) {
  4493.         ret = sprDowodOsobisty(identyfikator, msgDowod, typ);
  4494.     }
  4495.     return ret;
  4496. }
  4497.  
  4498. function sprImieNazwisko(imienazwisko,msg,typ,iloscznakow)
  4499. {
  4500.  var ret=0;    
  4501.     if (tylko_litery(imienazwisko)==0 || imienazwisko.length<iloscznakow)
  4502.     {
  4503.         if (typ==0)
  4504.         {
  4505.             alert(msg)
  4506.         }
  4507.     }
  4508.     else
  4509.     {
  4510.         ret=1;
  4511.     }
  4512.    
  4513.     return ret;    
  4514. }
  4515.  
  4516. function sprEmail(email,msg,typ)
  4517. {
  4518.      var ret=0;
  4519.     if (poprawny_email(email)==0)
  4520.     {
  4521.         if (typ==0)
  4522.         {
  4523.             alert(msg)
  4524.         }
  4525.     }
  4526.     else
  4527.     {
  4528.         ret=1;
  4529.     }
  4530.    
  4531.     return ret;    
  4532. }
  4533.  
  4534. function kompletnoscDanychLogowanieKontoGosc(bil_id,pesel,imie,nazwisko,email,msg)
  4535. {
  4536.     if (sprNrBiletu(bil_id,'',1)==0 || (pesel.length!=0 && sprPesel(pesel,'',1,3)==0) || (imie.length!=0 && sprImieNazwisko(imie,'',1,2)==0) || (nazwisko.length!=0 && sprImieNazwisko(nazwisko,'',1,2)==0) || (email.length!=0 && sprEmail(email,'',1)==0))
  4537.     {
  4538.         alert(msg);
  4539.     }
  4540.     else
  4541.     {
  4542.         document.kontogosclogowanie.submit();        
  4543.     }
  4544. }
  4545.  
  4546. function validatepesel(pesel) {
  4547.     var reg = /^[0-9]{11}$/;
  4548.     if(reg.test(pesel) == false) {
  4549.     return false;}
  4550.     else
  4551.     {
  4552.         var dig = (""+pesel).split("");
  4553.         var kontrola = (1*parseInt(dig[0]) + 3*parseInt(dig[1]) + 7*parseInt(dig[2]) + 9*parseInt(dig[3]) + 1*parseInt(dig[4]) + 3*parseInt(dig[5]) + 7*parseInt(dig[6]) + 9*parseInt(dig[7]) + 1*parseInt(dig[8]) + 3*parseInt(dig[9]))%10;
  4554.         if(kontrola==0) kontrola = 10;
  4555.         kontrola = 10 - kontrola;
  4556.         if(parseInt(dig[10])==kontrola)
  4557.         return true;
  4558.         else
  4559.         return false;
  4560.     }
  4561.  
  4562. }
  4563.  
  4564. function validatenip(nip) {
  4565.     var nip_bez_kresek = nip.replace(/-/g,"");
  4566.     var reg = /^[0-9]{10}$/;
  4567.     if(reg.test(nip_bez_kresek) == false) {
  4568.     return false;}
  4569.     else
  4570.     {
  4571.         var dig = (""+nip_bez_kresek).split("");
  4572.         var kontrola = (6*parseInt(dig[0]) + 5*parseInt(dig[1]) + 7*parseInt(dig[2]) + 2*parseInt(dig[3]) + 3*parseInt(dig[4]) + 4*parseInt(dig[5]) + 5*parseInt(dig[6]) + 6*parseInt(dig[7]) + 7*parseInt(dig[8]))%11;
  4573.         if(parseInt(dig[9])==kontrola)
  4574.         return true;
  4575.         else
  4576.         return false;
  4577.     }
  4578.  
  4579. }
  4580.  
  4581.  
  4582. function validateregon9(regon) {
  4583.     var reg = /^[0-9]{9}$/;
  4584.     if(reg.test(regon) == false) {
  4585.     return false;}
  4586.     else
  4587.     {
  4588.         var dig = (""+regon).split("");
  4589.         var kontrola = (8*parseInt(dig[0]) + 9*parseInt(dig[1]) + 2*parseInt(dig[2]) + 3*parseInt(dig[3]) + 4*parseInt(dig[4]) + 5*parseInt(dig[5]) + 6*parseInt(dig[6]) + 7*parseInt(dig[7]))%11;
  4590.         if(kontrola == 10) kontrola = 0;
  4591.         if(parseInt(dig[8])==kontrola)
  4592.         return true;
  4593.         else
  4594.         return false;
  4595.     }
  4596. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement