function validate(form) { var name = form.name.value; var email = form.email.value; var telefon = form.telefon.value; // var gender = form.gender.value; var info = form.info.value; // var nameRegex = /^[a-zA-ZąęśżźćółńĄĘÓŁŃŻŹĆŚ]+(([\'\,\.\- ][a-zA-ZąęśżźćółńĄĘÓŁŃŻŹĆŚ ])?[a-zA-ZąęśżźćółńĄĘÓŁŃŻŹĆŚ]*)*$/; var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/; // var telefonRegex = /^[0-9.\-+<>(){}\[\]\s]+$/; // var infoRegex = new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim); // if(name == "") { // inlineMsg('name','Błąd !
Proszę podać imię i nazwisko.',2); // return false; // } // if(!name.match(nameRegex)) { // inlineMsg('name','Błąd !
Poprawny format dopuszcza jedynie litery. ',2); // return false; // } // if(telefon == "") { // inlineMsg('telefon','Błąd !
Proszę podać numer telefonu wraz z kierunkowym.',2); // return false; // } // if(!telefon.match(telefonRegex)) { // inlineMsg('telefon','Błąd !
Niepoprawny format numeru. Dopuszczalne znaki: 0-9,+,().',2); // return false; // } if(email == "") { inlineMsg('email','Błąd !
Proszę podać swój adres email.',2); return false; } if(!email.match(emailRegex)) { inlineMsg('email','Błąd !
Niepoprawny format adresu email.',2); return false; } // if(gender == "") { // inlineMsg('gender','Error
You must select your gender.',2); // return false; // } if(info == "") { inlineMsg('info','Błąd !
Proszę umieścić tekst.'); return false; } // if(info.match(infoRegex)) { // inlineMsg('info','Niepoprawny format.'); // return false; // } return true; } function validate2(form_input_number) { var input_numer = form_input_number.input_numer.value; var input_numerRegex = /^[1-9]{2}[0-9]{7}$/; if(input_numer == "") { inlineMsg('submit','Błąd !
Proszę podać numer telefonu wraz z kierunkowym.',2); return false; } if(!input_numer.match(input_numerRegex)) { inlineMsg('submit','Błąd !
Niepoprawny format numeru. Proszę podać 9 cyfrowy numer wraz z kierunkowym.',3); return false; } return true; } // START OF MESSAGE SCRIPT // var MSGTIMER = 20; var MSGSPEED = 5; var MSGOFFSET = 3; var MSGHIDE = 3; // build out the divs, set attributes and call the fade function // function inlineMsg(target,string,autohide) { var msg; var msgcontent; if(!document.getElementById('msg')) { msg = document.createElement('div'); msg.id = 'msg'; msgcontent = document.createElement('div'); msgcontent.id = 'msgcontent'; document.body.appendChild(msg); msg.appendChild(msgcontent); msg.style.filter = 'alpha(opacity=0)'; msg.style.opacity = 0; msg.alpha = 0; } else { msg = document.getElementById('msg'); msgcontent = document.getElementById('msgcontent'); } msgcontent.innerHTML = string; msg.style.display = 'block'; var msgheight = msg.offsetHeight; var targetdiv = document.getElementById(target); targetdiv.focus(); var targetheight = targetdiv.offsetHeight; var targetwidth = targetdiv.offsetWidth; var topposition = topPosition(targetdiv) - ((msgheight - targetheight) / 2); var leftposition = leftPosition(targetdiv) + targetwidth + MSGOFFSET; msg.style.top = topposition + 'px'; msg.style.left = leftposition + 'px'; clearInterval(msg.timer); msg.timer = setInterval("fadeMsg(1)", MSGTIMER); if(!autohide) { autohide = MSGHIDE; } window.setTimeout("hideMsg()", (autohide * 1000)); } // hide the form alert // function hideMsg(msg) { var msg = document.getElementById('msg'); if(!msg.timer) { msg.timer = setInterval("fadeMsg(0)", MSGTIMER); } } // face the message box // function fadeMsg(flag) { if(flag == null) { flag = 1; } var msg = document.getElementById('msg'); var value; if(flag == 1) { value = msg.alpha + MSGSPEED; } else { value = msg.alpha - MSGSPEED; } msg.alpha = value; msg.style.opacity = (value / 100); msg.style.filter = 'alpha(opacity=' + value + ')'; if(value >= 99) { clearInterval(msg.timer); msg.timer = null; } else if(value <= 1) { msg.style.display = "none"; clearInterval(msg.timer); } } // calculate the position of the element in relation to the left of the browser // function leftPosition(target) { var left = 0; if(target.offsetParent) { while(1) { left += target.offsetLeft; if(!target.offsetParent) { break; } target = target.offsetParent; } } else if(target.x) { left += target.x; } return left; } // calculate the position of the element in relation to the top of the browser window // function topPosition(target) { var top = 0; if(target.offsetParent) { while(1) { top += target.offsetTop; if(!target.offsetParent) { break; } target = target.offsetParent; } } else if(target.y) { top += target.y; } return top; } // preload the arrow // if(document.images) { arrow = new Image(7,80); arrow.src = "images/msg_arrow.gif"; } function goToLocation() { if (!document.getElementById('newlocation')) return; var si = document.getElementById('newlocation').selectedIndex; location.href = document.getElementById('newlocation').options[si].value; } function ceny() { if (document.cennik && document.cennik.cenanetto && document.cennik.cenabrutto && document.cennik.wybierzKraj) { val = document.cennik.wybierzKraj[document.cennik.wybierzKraj.selectedIndex].value; ind = val.indexOf('|'); if (ind>0){ document.cennik.cenabrutto.value = val.substring(0,ind) + " zł"; document.cennik.cenanetto.value = val.substring(ind+1,val.length) + " zł"; } } } function HideContent(d) { if(d.length < 1) { return; } document.getElementById(d).style.display = "none"; } function ShowContent(d) { if(d.length < 1) { return; } document.getElementById(d).style.display = "block"; } function ReverseContentDisplay(d) { if(d.length < 1) { return; } if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; } else { document.getElementById(d).style.display = "none"; } }