 function spr_tekst (tekst,liczba_od,liczba_do,par,info) { tekst=document.getElementById (tekst); if ((par==0) && (tekst.value.length>0)) par=1; if ((par==1) && ((tekst.value.length<liczba_od) || (tekst.value.length>liczba_do))) { alert (info); tekst.focus(); return false; } return true; } function spr_haslo (haslo) { haslo=document.getElementById (haslo); if ((haslo.value.length<6) || (haslo.value.match (/^[^0-9]*$/))) { alert ("Hasło powinno się składać przynajmniej z 6 znaków i zawierać przynajmniej jedn± cyfrę"); haslo.focus (); return false; } return true; } function spr_mail (mail) { mail=document.getElementById (mail); if ((mail.value.length==0) || (!mail.value.match (/^[0-9a-z_.-]+@([0-9a-z-]+\.)+[a-z]{2,6}$/))) { alert ("Podaj prawidłowy adres e-mail\n(dozwolone małe litery, cyfry oraz znaki _.-)"); mail.focus (); return false; } return true; } function spr_liczba (liczba,par) { liczba=document.getElementById (liczba); if ((par==0) && (liczba.value.length>0)) par=1; if ((par==1) && (!liczba.value.match (/^[0-9]{1,20}$/))) { alert ("Podaj prawidłow± liczbę"); liczba.focus(); return false; } return true; } function spr_kategorie () { var pole = new Array (); pole[1]="k11_id"; pole[2]="k12_id"; for (var i=1;i<=2;i++) { var wartosc=document.getElementById (pole[i]); if (wartosc.value < 1) { alert ("Wybierz kategorie"); document.getElementById ("k1_button").focus (); return false; } } return true; } function spr_slowa_kluczowe (ile,slowo_kluczowe) { for (var i=1;i<=ile;i++) { if (i>1) var par=0; else var par=1; var slowo=document.getElementById (slowo_kluczowe+i); if ((par==0) && (slowo.value.length>0)) par=1; if ((par==1) && (!slowo.value.match (/^[a-zA-Z0-9±ćęłńó¶żĽˇĆĘŁŃÓ¦Ż¬]{1,60}( [a-zA-Z0-9±ćęłńó¶żĽˇĆĘŁŃÓ¦Ż¬]{1,60}){0,2}$/))) { alert ("Podaj prawidłowe słowo kluczowe\n(składaj±ce się z 1-3 wyrazów oddzielonych spacj± - tylko litery lub cyfry)"); slowo.focus(); return false; } } return true; } function spr_tytul (tytul,par,info) { tytul=document.getElementById (tytul); if ((par==0) && (tytul.value.length>0)) par=1; if ((par==1) && (!tytul.value.match (/^[a-zA-Z0-9 ęó±¶łżĽćńĘÓˇ¦ŁŻ¬ŹĆŃ.,-]{1,100}$/))) { alert (info+"\n(dozwolone litery, cyfry oraz znaki .,-)"); tytul.focus(); return false; } return true; } function spr_www (www,par) { www=document.getElementById (www); if ((par==0) && (www.value.length>0)) par=1; if ((par==1) && (www.value!="http://") && (!www.value.match (/^(http:\/\/)?([0-9a-zA-Z-]+\.)+[0-9a-zA-Z]{1,6}(:[0-9]+)?(\/)?(\/.+)*$/))) { alert ("Podaj prawidłowy adres Twojej firmowej strony WWW"); www.focus(); return false; } return true; } function spr_film (film,par) { film=document.getElementById (film); if ((par==0) && (film.value.length>0)) par=1; if ((par==1) && (!film.value.match (/^http:\/\/(www|pl).youtube.com\/(v\/|watch\?v=)[a-zA-Z0-9_-]{11}$/)) && (film.value!="http://")) { alert ("Podaj prawidłowy link do filmu Twojej firmy w serwisie YouTube"); film.focus(); return false; } return true; } function spr_cena (cena,par) { cena=document.getElementById (cena); if ((par==0) && (cena.value.length>0)) par=1; if ((par==1) && (!cena.value.match (/^[0-9]{1,9}(\.[0-9]{1,2}){0,1}$/))) { alert ("Podaj prawidłow± warto¶ć\n(na przykład 123 lub 39.65)"); cena.focus(); return false; } return true; } function spr_rok (rok,par) { var data = new Date (); rok=document.getElementById (rok); if ((par==0) && (rok.value.length>0)) par=1; if ((par==1) && ((!rok.value.match (/^[0-9]{4}$/)) || (rok.value<1800) || (rok.value>data.getFullYear()))) { alert ("Podaj poprawny rok\n(z przedziału 1800-"+data.getFullYear()+")"); rok.focus (); return false; } return true; } function spr_kod (kod,par) { kod=document.getElementById (kod); if ((par==0) && (kod.value.length>0)) par=1; if ((par==1) && (!kod.value.match (/^[0-9]{1,2}-[0-9]{1,3}$/))) { alert ("Podaj poprawny kod pocztowy\n(w formacie xx-xxx)"); kod.focus (); return false; } return true; } function spr_nip (nip,par) { nip=document.getElementById (nip); if ((par==0) && (nip.value.length>0)) par=1; if ((par==1) && (!nip.value.match (/^[0-9]{3}-[0-9]{3}-[0-9]{2}-[0-9]{2}$/))) { alert ("Podaj poprawny NIP\n(w formacie xxx-xxx-xx-xx)"); nip.focus (); return false; } return true; } function spr_regon (regon,par) { regon=document.getElementById (regon); if ((par==0) && (regon.value.length>0)) par=1; if ((par==1) && (!((regon.value.match (/^[0-9]{9}$/)) || (regon.value.match (/^[0-9]{14}$/))))) { alert ("Podaj poprawny REGON\n(składaj±cy się z 9 lub 14 cyfr)"); regon.focus (); return false; } return true; } function spr_krs (krs,par) { krs=document.getElementById (krs); if ((par==0) && (krs.value.length>0)) par=1; if ((par==1) && (!krs.value.match (/^[0-9]{10}$/))) { alert ("Podaj poprawny numer KRS\n(składaj±cy się z 10 cyfr)"); krs.focus (); return false; } return true; } function spr_edg (edg,par) { edg=document.getElementById (edg); if ((par==0) && (edg.value.length>0)) par=1; if ((par==1) && (edg.value.length==0)) { alert ("Podaj numer firmy w ewidencji działalno¶ci gospodarczej"); edg.focus (); return false; } return true; } function spr_tel1 (tel1,tel2,tel3,par) { var tel = new Array (); tel[1]=document.getElementById (tel1); tel[2]=document.getElementById (tel2); tel[3]=document.getElementById (tel3); if ((par==0) && (((tel[1].value.length==0) && ((tel[2].value.length>0) || (tel[3].value.length>0))) || ((tel[2].value.length==0) && (tel[3].value.length>0)) || ((tel[3].value.length==0) && (tel[2].value.length>0)) || ((tel[1].value.length>0) && ((tel[2].value.length>0) || (tel[3].value.length>0))))) par=1; if (par==1) { if (!tel[1].value.match (/^[+]{0,1}[0-9]{2,4}$/)) { alert ("Podaj poprawny numer kierunkowy kraju (dla Polski jest to +48)"); tel[1].focus (); return false; } if (!tel[2].value.match (/^[0-9]{2,5}$/)) { alert ("Podaj poprawny numer kierunkowy miejscowo¶ci (2-5 cyfr)"); tel[2].focus (); return false; } if (!tel[3].value.match (/^[0-9]{6,10}$/)) { alert ("Podaj poprawny numer telefonu stacjonarnego (6-10 cyfr)"); tel[3].focus (); return false; } } return true; } function spr_tel2 (tel1,tel2,par) { var tel = new Array (); tel[1]=document.getElementById (tel1); tel[2]=document.getElementById (tel2); if ((par==0) && ((tel[2].value.length>0) || ((tel[1].value.length>0) && (tel[2].value.length>0)))) par=1; if (par==1) { if (!tel[1].value.match (/^[+]{0,1}[0-9]{2,4}$/)) { alert ("Podaj poprawny numer kierunkowy kraju (dla Polski jest to +48)"); tel[1].focus (); return false; } if (!tel[2].value.match (/^[0-9]{8,12}$/)) { alert ("Podaj poprawny numer telefonu komórkowego (8-12 cyfr)"); tel[2].focus (); return false; } } return true; } function spr_gg (gg,par) { gg=document.getElementById (gg); if ((par==0) && (gg.value.length>0)) par=1; if ((par==1) && (!gg.value.match (/^[0-9]{3,8}$/))) { alert ("Podaj poprawny numer Gadu Gadu (3-8 cyfr)"); gg.focus (); return false; } return true; } function spr_zdjecie_certyfikat (ile,pole,text) { for (var i=1;i<=ile;i++) { var opis=document.getElementById (pole+i); if ((opis.value.length>0) && (!opis.value.match (/^[a-zA-Z0-9 ęó±¶łżĽćńĘÓˇ¦ŁŻ¬ŹĆŃ.,-_]{1,40}$/))) { alert ("Użyto nieprawidłowych znaków w opisie "+text+"\n(dozwolone litery, cyfry oraz znaki .,-_)"); opis.focus(); return false; } } return true; } function spr_certyfikat () { var pole = new Array (); pole[1]="rodzaj"; pole[2]="nr"; pole[3]="data_wydania"; pole[4]="waznosc"; pole[5]="wydany_przez"; pole[6]="na_co"; for (var i=1;i<=6;i++) if (!spr_zdjecie_certyfikat (6,"certyfikat_"+pole[i],"certyfikatu")) return false; return true; } function pozostalo_znakow (pole1,pole2,max,par) { var txt=document.getElementById (pole1); var liczba_znakow = txt.value.length; if (liczba_znakow > max) { liczba_znakow = 0; txt.value = txt.value.substring (0,max); } else liczba_znakow = max - liczba_znakow; if (par==1) document.getElementById (pole2).innerHTML=liczba_znakow; } 
