// -------------------------------------------------------------------------- // różne // -------------------------------------------------------------------------- function gotoPage(newPageURL) { setTimeout("self.location.replace(newPageURL)",1); } // przeskakiwanie kursora pomiędzy polami function auto_tab(input, len) { var index = -1, i = 0; while (i < input.form.length && index == -1) if (input.form[i] == input) index = i; else i++; if (index != -1) if (input.value.length >= len) input.form[(index + 1) % input.form.length].focus(); } // popup window do dodawania i pobierania załączników function openAttachmentsForm(URL) { window.open(URL, "attachments", "width=800,height=650,scrollbars=yes"); } // -------------------------------------------------------------------------- // Wodotryski - kręciołek przy ładowaniu // -------------------------------------------------------------------------- function ShowPageDelayed() { if (document.all) { document.all.loader.style.display="none"; document.all.main_page.style.display="block"; } else if(document.getElementById) { l = document.getElementById('loader'); p = document.getElementById('main_page'); l.style.display="none"; p.style.display="block"; } } function PrintPageDelayed() { window.print(); } function ShowPage() { setTimeout("ShowPageDelayed()",500); //pokaż ikonki drukarki try{ if (document.all) { document.all.main_navig_icons.style.display="block"; } else if(document.getElementById) { ni = document.getElementById('main_navig_icons'); ni.style.display="block"; } } catch (err) {} } // -------------------------------------------------------------------------- // przełączanie pomiędzy wersją zwykłą strony i do druku // -------------------------------------------------------------------------- function ShowPrintHeader() { if (document.all) { document.all.main_header_table.style.display="none"; document.all.main_footer_table.style.display="none"; try { document.all.ProcessExecutionControlButtons.style.display="none"; } catch (err) {}; document.all.print_header_table.style.display="block"; // document.all.main_page_table.align="left"; } else if(document.getElementById) { mh = document.getElementById('main_header_table'); mf = document.getElementById('main_footer_table'); mp = document.getElementById('ProcessExecutionControlButtons'); ph = document.getElementById('print_header_table'); // mp = document.getElementById('main_page_table'); mh.style.display="none"; mf.style.display="none"; if (mp!=null) { mp.style.display="none"; }; ph.style.display="block"; // mp.align="left"; } } // pokazuje stronę w postaci z naglówkiem i stopką function ShowNormalHeader() { if (document.all) { document.all.main_header_table.style.display="block"; document.all.main_footer_table.style.display="block"; try { document.all.ProcessExecutionControlButtons.style.display="block"; } catch (err) {}; document.all.print_header_table.style.display="none"; // document.all.main_page_table.align="center"; } else if(document.getElementById) { mh = document.getElementById('main_header_table'); mf = document.getElementById('main_footer_table'); mp = document.getElementById('ProcessExecutionControlButtons'); ph = document.getElementById('print_header_table'); // mp = document.getElementById('main_page_table'); mh.style.display="block"; mf.style.display="block"; if (mp!=null) { mp.style.display="block"; } ph.style.display="none"; // mp.align="center"; } } // pokazuje podany element function ShowElement(elementId) { if (document.all) { document.all[elementId].style.display="block"; } else if(document.getElementById) { obj=document.getElementById(id); if (obj!=null) { obj.style.display="block"; } } } // ukrywa podany element function HideElement(elementId) { if (document.all) { document.all[elementId].style.display="none"; } else if(document.getElementById) { obj=document.getElementById(id); if (obj!=null) { obj.style.display="none"; } } } // pokazuje lub ukrywa podany element i zwraca "" jeśli ukryto lub "Y" jeśli // pokazano function ShowHideElement(elementId) { if (document.all) { if (document.all[elementId].style.display == "none") { document.all[elementId].style.display="block"; return "Y"; } else { document.all[elementId].style.display="none"; return ""; } } else if(document.getElementById) { obj=document.getElementById(id); if (obj!=null) { if (obj.style.display=="none") { obj.style.display="block"; return "Y"; } else { obj.style.display="none"; return ""; } } } } // podmienia źródło obrazka cImg na url podany w ref function changeImg(cImg, ref) { cImg.src = ref.src; } // -------------------------------------------------------------------------- // sprawdzanie nipów peseli itp. -------------------------------------------- // -------------------------------------------------------------------------- function checkNIP(nip) { if (!nip) return ""; if (nip.length!=10) return "\n- nieprawidłowy nr NIP" var ctrSum=0; var wagi=new Array(6,5,7,2,3,4,5,6,7); for (i=0; i<9;i++) { ctrSum+=nip.charAt(i)*wagi[i]; } ctrSum%=11; if(ctrSum==nip.charAt(9)) return "" else if( (nip.charAt(10)==0) && (ctrSum==10) ) return "" else if( confirm('Podany numer NIP jest formalnie niepoprawny.\nCzy na pewno numer został poprawnie wprowadzony?') ) return "" else return "\n- nieprawidłowy nr NIP"; } function checkPESEL(pesel) { if (!pesel) return ""; if (pesel.length!=11) return "\n- nieprawidłowy nr PESEL (zbyt mało cyfr)" var ctrSum=0; var wagi=new Array(1,3,7,9,1,3,7,9,1,3); for (i=0; i<10;i++) { ctrSum+=pesel.charAt(i)*wagi[i]; } ctrSum%=10; ctrSum=10-ctrSum; if(ctrSum==pesel.charAt(10)) return "" else if((pesel.charAt(10)==0)&&(ctrSum==10)) return "" else if( confirm('Podany numer PESEL jest formalnie niepoprawny.\nCzy na pewno numer został poprawnie wprowadzony?') ) return "" else return "\n- nieprawidłowy nr PESEL"; } function checkEmail(email) { if (!email) return ""; re=/[\s\/\:\,\:]+/ if (re.test(email)) return "\n- nieprawidłowy adres e-mail\n (nieprawidłowe znaki)" re = /.*\@.*/ if (re.test(email)) return "" else return "\n- nieprawidłowy adres e-mail\n (brak znaku @)" } function checkDate1(dzien,miesiac,rok) { re=/^0*/ if ((!dzien)&&(!miesiac)&&(!rok)) return ""; dzien=dzien.replace(re,''); miesiac=miesiac.replace(re,''); rok=rok.replace(re,''); dd=parseInt(dzien); mm=parseInt(miesiac); yy=parseInt(rok); if ((!dd)||(!mm)||(!yy)) return "\n- nieprawidłowo wprowadzona data\n (nie podano wszystkich wartości)"; if ((dd<1)||(mm<1)||(mm>12)||(yy<1)) return "\n- nieprawidłowo wprowadzona data\n (błądne wartości)"; var dateInfo = new Array() dateInfo[1] = 31; dateInfo[2] = getLeap(rok); dateInfo[3] = 31; dateInfo[4] = 30; dateInfo[5] = 31; dateInfo[6] = 30; dateInfo[7] = 31; dateInfo[8] = 31; dateInfo[9] = 30; dateInfo[10] = 31; dateInfo[11] = 30; dateInfo[12] = 31; if(dd>dateInfo[mm]) return "\n- nieprawidłowo wprowadzona data\n (zbyt duży dzień miesiąca)"; dzisiaj=new Date(); nowa=new Date(yy,mm,dd); return ""; } function checkPCode(pcode) { if (!pcode) return "" if (pcode.length != 6) return "\n- Niewłaściwa liczba znaków w kodzie pocztowym" if (pcode.substr(2,1) != "-") return "\n- Kod pocztowy nie jest w formacie xx-yyy" re=/[^0-9\-]+/ if (re.test(pcode)) return "\n- nieprawidłowy kod pocztowy" return "" } // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // --------------------------------------------------------------------------