$(document).ready(function () { $('.dropbtn').click(function (e) { e.stopPropagation(); if ($('.dropdown-content').hasClass('hidden')) { $('.dropdown-content').removeClass('hidden'); } else { $('.dropdown-content').addClass('hidden'); } if ($('.dropdown-menu').not('hidden')) { $('.dropdown-menu').addClass('hidden'); } }); $(document.body).click(function () { if ($('.dropdown-menu').not('hidden')) { $('.dropdown-menu').addClass('hidden'); } if ($('.dropdown-content').not('hidden')) { $('.dropdown-content').addClass('hidden'); } }); }); function o(link) { window.open(link); return false; } function RegControlClearHelper(e) { for (var i = 0; i < e.length; i++) { e[i].style.backgroundColor = ''; } } function disableIco() { document.forms[0].ico.disabled = true; if (document.forms[0].ico.value != '') oldIco = document.forms[0].ico.value; document.forms[0].ico.value = ''; document.forms[0].cop.disabled = false; if (window.oldCop != undefined) document.forms[0].cop.value = oldCop; document.forms[0].ico.setAttribute("class", "disabled"); document.forms[0].cop.setAttribute("class", ""); } function disableCop() { document.forms[0].cop.disabled = true; if (document.forms[0].cop.value != '') oldCop = document.forms[0].cop.value; document.forms[0].cop.value = ''; document.forms[0].ico.disabled = false; if (window.oldIco != undefined) document.forms[0].ico.value = oldIco; document.forms[0].cop.setAttribute("class", "disabled"); document.forms[0].ico.setAttribute("class", ""); } function RegControl(e) { RegControlClearHelper(e); var chyba = ""; if (e['jmeno'].value == '') { e['jmeno'].style.backgroundColor = 'yellow'; e['jmeno'].focus(); chyba = chyba + " Nie podano nazwy handlowej.\n"; } if (e['ico'].disabled == false && e['ico'].value == '') { e['ico'].style.backgroundColor = 'yellow'; e['ico'].focus(); chyba = chyba + " Nie podano nr NIP\n"; } if (e['cop'] && e['cop'].disabled == false && e['cop'].value == '') { e['cop'].style.backgroundColor = 'yellow'; e['cop'].focus(); chyba = chyba + " Brak nr dowodu\n"; } var re = /\s/; var res = re.test(e['ico'].value); if (res) { e['ico'].style.backgroundColor = 'yellow'; e['ico'].focus(); chyba = chyba + " Niepoprawny format NIP\n"; } if (e['telefon'].value == '') { e['telefon'].style.backgroundColor = 'yellow'; e['telefon'].focus(); chyba = chyba + " Nie wpisano numeru telefonu.\n"; } /* if (e['email'].value=='' || e['email'].value=='@') { e['email'].style.backgroundColor = 'yellow'; e['email'].focus(); chyba = chyba + " Niepoprawny format e-mail\n"; } */ e['email'].value = e['email'].value.replace(/\s/g, ''); re = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/; if (!re.test(e['email'].value)) { e['email'].style.backgroundColor = 'yellow'; e['email'].focus(); chyba = chyba + " Niepoprawny format e-mail\n"; } if (e['stat'].value == '') { e['stat'].style.backgroundColor = 'yellow'; e['stat'].focus(); chyba = chyba + " Nie wpisano kraju.\n"; } if (e['region'] && e['region'].value == "") { e['region'].style.backgroundColor = 'yellow'; e['region'].focus(); chyba = chyba + " Nie wybrano województwa\n"; } // if ($('#gdpr_agree').prop('checked') === false) { // ($('#gdpr_error').show()); // return false; // } else { // ($('#gdpr_error').hide()); // } if (chyba != "") { chyba = "Podczas uzupełniania zgłoszenia doszło do kolejnych błędów:\n" + chyba; window.alert(chyba); return false; } else { return true; } } function initRegControl() { document.forms[0].onsubmit = function () { return RegControl(this); } } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function () { oldonload(); func(); } } } function getRegions(o) { if (!document.getElementById("region")) return; if (o.value == 'Czech Republic') { //czechrep document.getElementById("region").style.visibility = "visible"; document.getElementById("regionLabel").style.visibility = "visible"; var region_array = { 1: '', 2: 'Jihočeský kraj', 3: 'Jihomoravský kraj', 4: 'Karlovarský kraj', 5: 'Královehradecký kraj', 6: 'Liberecký kraj', 7: 'Moravskoslezský kraj', 8: 'Olomoucký kraj', 9: 'Pardubický kraj', 10: 'Plzeňský kraj', 11: 'Praha', 12: 'Středočeský kraj', 13: 'Ústecký kraj', 14: 'Vysočina', 15: 'Zlínský kraj' } var select = document.getElementById("region"); select.options.length = 0; for (index in region_array) { //select.options[select.options.length] = new Option(region_array[index], index); select.options[select.options.length] = new Option(region_array[index], region_array[index]); } } else if (o.value == 'Poland') { //poland document.getElementById("region").style.visibility = "visible"; document.getElementById("regionLabel").style.visibility = "visible"; var region_array = { 1: '', 2: 'dolnośląskie', 3: 'kujawsko-pomorskie', 4: 'lubelskie', 5: 'lubuskie', 6: 'łódzkie', 7: 'małopolskie', 8: 'mazowieckie', 9: 'opolskie', 10: 'podkarpackie', 11: 'podlaskie', 12: 'pomorskie', 13: 'śląskie', 14: 'świętokrzyskie', 15: 'warmińsko-mazurskie', 16: 'wielkopolskie', 17: 'zachodniopomorskie' } var select = document.getElementById("region"); select.options.length = 0; for (index in region_array) { select.options[select.options.length] = new Option(region_array[index], region_array[index]); } } else if (o.value == 'Slovakia') { //slovakia document.getElementById("region").style.visibility = "visible"; document.getElementById("regionLabel").style.visibility = "visible"; var region_array = { 1: '', 2: 'Banskobystrický kraj', 3: 'Bratislavský kraj', 4: 'Košický kraj', 5: 'Nitriansky kraj', 6: 'Prešovský kraj', 7: 'Trenčiansky kraj', 8: 'Trnavský kraj', 9: 'Žilinský kraj' } var select = document.getElementById("region"); select.options.length = 0; for (index in region_array) { select.options[select.options.length] = new Option(region_array[index], region_array[index]); } } else { document.getElementById("region").style.visibility = "hidden"; document.getElementById("regionLabel").style.visibility = "hidden"; } } addLoadEvent(initRegControl);