PageSourceSearch

https://sp5kg.pl/js/functions.js

js sp5kg.pl collected 2026-10-02 14:22:32 UTC 89,536 bytes, 2,940 lines download raw bytes

1var execution_array = new Array();
2/**
3 * funkcja sprawdzająca poprawność adresu email
4 * 
5 * @param {String} email
6 */
7function checkEmail(email) {
8    var reg_test = /^[\w\.-]{2,}@[\w\.-]+\.[a-z]{2,5}$/i.test(email);
9    if (!reg_test)
10        return false;
11    return true;
12}
13
14/**
15 * funkcja sprawdzająca poprawność godziny
16 * 
17 * @param {String} h
18 */
19function checkHour(h) {
20    /* var reg_test = /^[0-9]{1,2}\:[0-9]{2}\:[0-9]{2}$/i.test(h); */
21    var reg_test = /^[0-9]{1,2}\:[0-9]{2}$/i.test(h);
22    if (!reg_test)
23        return reg_test;
24    var val = h.split(':');
25    if (val[0] > 23 || val[0] < 0 || val[1] > 59 || val[1] < 0 || val[2] > 59
26            || val[2] < 0)
27        return false;
28    return true;
29}
30
31/**
32 * funkcja sprawdzająca poprawność numeru telefonu
33 * 
34 * @param {string} pN
35 */
36function checkPhoneNumber(pN) {
37    var reg_test = /^[0-9]{10}$/i.test(pN);
38    if (!reg_test)
39        return false;
40    return true;
41}
42
43/**
44 * funkcja sprawdzająca poprawność adresu WWW
45 * 
46 * @param {String} www
47 */
48function checkWWW(www) {
49    var reg_test = /^(http:\/\/|www\.).*/i.test(www);
50    if (!reg_test)
51        return false;
52    return true;
53}
54
55/**
56 * funkcja sprawdzająca poprawność kodu pocztowego
57 * 
58 * @param {String} zC
59 */
60function checkZipCode(zC) {
61    var reg_test = /^[0-9]{2}\-[0-9]{3}$/i.test(zC);
62    if (!reg_test)
63        return false;
64    return true;
65}
66
67/**
68 * funkcja sprawdzająca, czy długość string-a zawiera się w przedziale
69 * 
70 * @param {string} str
71 * @param {int} from
72 * @param {int} to
73 */
74function checkLength(str, from, to) {
75    if (str.length >= from && str.length <= to)
76        return true;
77    return false;
78}
79
80/**
81 * funkcja sprawdzająca poprawność loginu uzytkownika
82 * 
83 * @param {string} login
84 */
85function checkLogin(login) {
86    var reg_test = /^[\w\.-]{8,50}$/i.test(login);
87    if (!reg_test)
88        return false;
89    return true;
90}
91
92/**
93 * funkcja sprawdzająca zgodność z typem int
94 * 
95 * @param {Object} value
96 */
97function checkInt(value) {
98    var reg_test = /^[\-]{0,1}[0-9]{1,8}$/i.test(value);
99    if (!reg_test)
100        return false;
101    return true;
102}
103
104/**
105 * Backtrace dla funkcji JavaScript
106 * 
107 * @param {Object} func
108 */
109
110function getStackTrace(func) {
111
112    if (!func)
113        return "not a function!";
114    var trace = getFuncName(func);
115    var args = "(";
116    for (var arg in func.arguments) {
117        if (args && args.length && args.length > 1)
118            args += ",";
119        args += func.arguments.toString();
120    }
121
122    trace += args + ")\n";
123    return trace + getStackTrace(func.caller);
124}
125
126/**
127 * funkcja wychwytująca błędy
128 */
129
130function handleErrors(errStr, url, lineNum) {
131    document.getElementById('JSError').innerHTML = getStackTrace();
132}
133// window.onerror=handleErrors;
134
135/**
136 * funkcja potwierdzająca wykonaną akcję
137 * 
138 */
139function confirmSubmit(str) {
140    var agree = confirm(str);
141
142    if (agree) {
143        return true;
144    }
145    return false;
146}
147
148/**
149 * funkcja zwalnia aktywne zakladki, przyciski i aktywuje wybrana jako aktywna
150 * (newsy na stronie glownej, box galerii strony glownej) ile - calkowita ilosc
151 * zakladek cur - numer zakladki do aktywacji id - tekstowy przedrostek id
152 * zakladek, przyciskow
153 */
154function activateGroup(ile, cur, id) {
155    for (var i = 0; i <= ile; i++) {
156        if (document.getElementById(id + i)) {
157            document.getElementById(id + i).className = '';
158        }
159    }
160    if (document.getElementById(id + cur) != null) {
161        document.getElementById(id + cur).className = 'sel';
162    }
163}
164
165// ==========================================
166// Check All boxes
167// ==========================================
168function CheckAll(fmobj)
169{
170    var checked = jQuery('input[name="search[select_all]"]', fmobj).is(':checked');
171
172    jQuery('input[type="checkbox"]', fmobj).each(function (index) {
173        if ((!this.disabled) && (this.name != 'search[select_all]') && (this.name != 'search[aktualne]') && (this.name != 'search[archiwalne]')) {
174            this.checked = checked;
175        }
176    });
177
178}
179
180// ==========================================
181// Check all or uncheck all?
182// ==========================================
183function CheckCheckAll(fmobj)
184{
185    var TotalBoxes = 0;
186    var TotalOn = 0;
187    var checked = jQuery('input[name="search[select_all]"]', fmobj).is(':checked');
188
189    jQuery('input[type="checkbox"]', fmobj).each(function (index) {
190        if ((!this.disabled) && (this.name != 'search[select_all]') && (this.name != 'search[aktualne]') && (this.name != 'search[archiwalne]')) {
191            TotalBoxes++;
192
193            if (e.checked)
194                TotalOn++;
195        }
196    });
197
198    if (TotalBoxes == TotalOn) {
199        jQuery('*[id$="search_select_all"]', fmobj).checked = true;
200    } else {
201        jQuery('*[id$="search_select_all"]', fmobj).checked = false;
202    }
203}
204
205function MarkAll(checkb, selid) {
206    var val = checkb.checked;
207    var form = jQuery(checkb).closest('form');
208    //console.log(form[0]);
209    var opts = jQuery('select[id$="' + selid + '"]', form).children();
210    for (var i = 0; i < opts.length; i++) {
211        var opt = opts[i];
212        if (opt.children.length) {
213            var subopts = opt.children;
214            for (var j = 0; j < subopts.length; j++) {
215                subopts[j].selected = val;
216            }
217        } else {
218            opt.selected = val;
219        }
220    }
221}
222
223function ulubione(obj) {
224    var title = document.title;
225    var url = document.location;
226    if (window.sidebar && window.sidebar.addPanel) {
227        window.sidebar.addPanel(document.title, window.location.href, '');
228        obj.href = "#";
229        return false;
230    } else if (window.external && ('AddFavorite' in window.external)) {
231        window.external.AddFavorite(url, title);
232        obj.href = "#";
233        return false;
234    } else if (window.opera && window.print) {
235        obj.rel = 'sidebar';
236        obj.title = title;
237        obj.href = url;
238        return true;
239    } else { // webkit - safari/chrome
240        alert('Naciśnij ' + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Command/Cmd' : 'CTRL') + ' + D aby dodać tę stronę.');
241    }
242    return false;
243}
244
245/**
246 * Funkcja wyświetla obiekt flash w miejscu wywołania konieczna by zachowac
247 * walidacje xhtml
248 */
249function flashFix(o) {
250    document.write(o)
251}
252
253
254/**
255 * Funkcja pokazuje lub ukrywa zawartosc zakladek w menu glownym panelu
256 * administracyjnego
257 */
258function ShowHideMenuItems(id)
259{
260    if (document.getElementById(id))
261    {
262        new Effect.toggle(id, 'blind', {
263            duration: 0.5
264        });
265        if (document.getElementById(id).style.display == 'none')
266            sCookie(id, true, 365);
267        else
268            sCookie(id, '', -1);
269    }
270}
271
272/**
273 * Funkcja pokazuje lub ukrywa menu admina i rozszerza drzewko struktury portalu
274 */
275
276var il_new_small_width = new Number();
277var cp_new_small_width = new Number();
278
279function ShowHideMainMenu()
280{
281    var mm_id = 'cms_left_panel'; //id menu glownego
282    var mm = document.getElementById(mm_id); //menu glowne
283    var ct = document.getElementById('content'); //content
284    var ct_new = $('content'); //content
285    var cp = document.getElementById('cms_center_panel'); //panel centralny
286    var cp_new = $('cms_center_panel'); //panel centralny
287    var kl = document.getElementById('kat_list'); //lista struktury portalu
288    var gl = document.getElementById('cms_center_panel_content'); //lista struktury galerii
289    var il = document.getElementById('info_list'); //lista struktury informatora
290    var il_new = $('info_list');
291
292    if (mm) {
293        if (mm.style.display == 'none') {    //jesli lewy panel ukryty, pokazujemy go
294            mm.style.display = 'block';
295
296            if (notNull(ct))
297                ct.style.width = ct.clientWidth - 175 + 'px';
298            //if(cp) cp.style.width = cp.clientWidth - 175 + 'px';
299            if (notNull(cp_new))
300                cp_new.style.width = cp_new_small_width + "px";
301
302            if (notNull(kl))
303                kl.style.width = kl.clientWidth - 178 + 'px';
304            if (notNull(gl))
305                gl.style.width = gl.clientWidth - 178 + 'px';
306            //if(il) il.style.width = il.clientWidth - 163 + 'px';
307            if (notNull(il_new))
308                il_new.style.width = il_new_small_width + "px";
309        } else {
310            if (notNull(cp_new))
311                cp_new_small_width = cp_new.getWidth() - 2;   //odjete paddingi/marginesy
312            if (notNull(il_new))
313                il_new_small_width = il_new.getWidth() - 4;   //odjete paddingi/marginesy
314
315            mm.style.display = 'none';  //jesli lewy panel pokazany, ukrywamy go
316
317            if (ct)
318                ct.style.width = ct.clientWidth + 175 + 'px';
319            if (cp)
320                cp.style.width = cp.clientWidth + 175 + 'px';
321            if (kl)
322                kl.style.width = kl.clientWidth + 170 + 'px';
323            if (gl)
324                gl.style.width = gl.clientWidth + 170 + 'px';
325            if (il)
326                il.style.width = il.clientWidth + 187 + 'px';
327        }
328    }
329}
330
331/**
332 * Nowa wersja funkcji:
333 * Funkcja pokazuje lub ukrywa menu admina i rozszerza drzewko struktury portalu
334 */
335function ShowHideMainMenuNew(divId)
336{
337    var mm_id = 'cms_left_panel'; //id menu glownego
338    var mm = $(mm_id); //menu glowne
339
340    var mmWidth = mm.getWidth();
341
342    var menu = $(divId);
343    var ct = $('content'); //content
344    var cp = $('cms_center_panel'); //panel centralny
345
346    if (menu) {
347        if (mm) {
348            if (mm.visible()) {
349                mm.hide();
350
351                var menuWidth = menu.getWidth() + mmWidth;
352                var ctWidth = ct.getWidth() + mmWidth;
353                var cpWidth = cp.getWidth() + mmWidth;
354
355                menu.clientWidth = menuWidth + "px";
356                ct.clientWidth = ctWidth + "px";
357                cp.clientWidth = cpWidth + "px";
358            } else {
359                mm.show();
360
361                var menuWidth = menu.getWidth() - mmWidth;
362                var ctWidth = ct.getWidth() - mmWidth;
363                var cpWidth = cp.getWidth() - mmWidth;
364
365                menu.clientWidth = menuWidth + "px";
366                ct.clientWidth = ctWidth + "px";
367                cp.clientWidth = cpWidth + "px";
368            }
369        }
370    }
371}
372
373/**
374 * Funkcja pokazuje lub ukrywa zaawansowana czesc formularza wyszukiwania
375 */
376function ShowHideAdvSearch(txtc, txto, hash_id) {
377
378    if (!hash_id)
379        var hash_id = '';
380
381    if (hash_id)
382        hash_id = '_' + hash_id;
383
384    var fs = document.getElementById('adv_form' + hash_id);
385    //console.log(fs);
386    var rl = document.getElementById('rollas' + hash_id);
387    ///console.log(rl);
388    if (rl && fs) {
389        if (fs.style.display == 'none') {
390            rl.className = 'rollas roll_sel';
391            rl.innerHTML = '<span class="hidden-wcag">' + txto + '</span>';
392            sCookie('show_search', true, 0);
393            wcagstinks(fs);
394        } else {
395            rl.className = 'rollas roll';
396            rl.innerHTML = '<span class="hidden-wcag">' + txtc + '</span>';
397            sCookie('show_search', '', -1);
398        }
399    }
400
401    jQuery(fs).slideToggle('1000', "swing");
402
403    updateAdvSearchWidth(hash_id);
404}
405
406function ShowHideDocuSearch(txtc, txto) {
407
408    var fs = document.getElementById('doku_szuk');
409    var rl = document.getElementById('dokuSearch');
410    if (rl && fs) {
411        if (fs.style.display == 'none') {
412            rl.title = txtc;
413            sCookie('document_search', true, 0);
414            wcagstinks(fs);
415        } else {
416            rl.title = txto;
417            sCookie('document_search', '', -1);
418        }
419    }
420    jQuery(fs).slideToggle('1000', "swing");
421}
422
423/**
424 * Comment
425 */
426function updateAdvSearchWidth(hash_id)
427{
428    var wrapper = jQuery('section.wyszukiwarka-wrapper')[0];
429    if (!wrapper)
430        return false;
431    var dok = jQuery(wrapper).parent();
432
433    var fs = document.getElementById('adv_form' + hash_id);
434
435
436    if (fs && dok && wrapper && jQuery(wrapper).css('position') != 'static')
437        fs.style.width = dok.offsetWidth + "px";
438}
439
440/**
441 * Funkcja do powiekszania i zmniejszania czcionki
442 */
443var pointer = 0;
444function FontSize(mode)
445{
446    var levels = new Array(100, 125, 150, 175, 200);
447    var pointerold = parseInt(gCookie("textsize"));
448
449    if (mode == 'up')
450    {
451        if (pointer < levels.length - 1)
452            pointer++;
453    } else if (mode == 'down')
454    {
455
456        if (pointer > 0)
457            pointer--;
458    } else if (mode == 'def')
459    {
460        pointer = 0;
461    } else
462    {
463        pointer = parseInt(gCookie("textsize"));
464
465
466        if (isNaN(pointer))
467            pointer = 0;
468    }
469    var fontval = levels[pointer];
470    //console.log('fontsize: ' + fontval + '%');
471
472    var elements = $$(
473            //dodaj klase resize_font np do zajawek
474            'body > *'
475            //elementy tresci tworzonej za pomoca tinymce
476            //'.content p',
477            //'.content ._Lista_punktowana',
478            //'.content ._Lista_numerowana',
479            //'.content ._Lista_punktowana2',
480            //'.content ._Lista_numerowana2'
481            );
482
483    if (elements) {
484        for (var i = 0; i < elements.length; i++) {
485            if (fontval == '100')
486            {
487                elements[i].style.fontSize = '';
488                //elements[i].style.lineHeight = '100%';
489            } else
490            {
491                elements[i].style.fontSize = fontval + '%';
492                //elements[i].style.lineHeight = '100%';
493            }
494        }
495    }
496
497    if (!isNaN(pointer) && pointer != pointerold) {
498        sCookie('textsize', '', -1);
499        sCookie('textsize', pointer, 1);
500    }
501
502    fixConceptRotators(jQuery);
503
504    fixZajawkiRowHeight();
505    fixZajawkiMultiRowHeight();
506    fixZajawkiAsideHeight();
507
508}
509
510function FontSizeRestore() {
511    var pointer = parseInt(gCookie("textsize"));
512
513    if (isNaN(pointer))
514        return true;
515    FontSize(null);
516}
517
518function SetContrast() {
519    var contrast = gCookie("contrast");
520    if (contrast == 'true') {
521        sCookie('contrast', '', 0);
522    } else {
523        sCookie('contrast', true, 0);
524    }
525    location.reload(true);
526}
527
528function replEmail(user, site, name, attributes)
529{
530    document.write('<a href=\"mailto:' + user + '@' + site + '\"' + attributes + '>');
531    if (name) {
532        document.write(name + '<\/a>');
533    } else {
534        document.write(user + '@' + site + '<\/a>');
535    }
536}
537
538function replTel(number, number2)
539{
540    document.write(number + "" + number2);
541}
542
543/**
544 * Funkcja do wyboru ikonki przy dodawaniu obiektu od strony internauty
545 * Drugie wywołanie jest w admin.js
546 */
547function changeIcon(src, target, self) {
548    document.getElementById(target).value = src;
549    document.getElementById('selected_icon').src = self.src;
550}
551/**
552 * Funkcja pokazuje lub ukrywa prawy panel
553 */
554function ToggleMap(txtc, txto) {
555    var fs = document.getElementById('page_content_right');
556    var fshidden = fs.style.display;
557    Element.toggle('page_content_right');
558    var rl = $('roll');
559    var r2 = $('content_center'); //mapa_content_left
560    var r3 = $('pg_bgr_top'); //mapa_content_tresc
561    var r4 = $('pg_bgr_bottom'); //map
562    var r5 = $('map');
563
564    if (rl && fs) {
565        if (fshidden == 'none') {
566            rl.className = 'roll';
567            rl.innerHTML = txtc;
568            r2.className = 'page_content'; //mapa_content_left
569            r3.className = 'page_content_top'; //mapa_content_tresc
570            r4.className = 'page_content_bottom'; //mapa
571
572            $('page_content_center').style.width = '470px'; //mapa_content_left
573            $('content_center').style.width = 'auto'; //mapa_content_tresc
574            $('map').style.width = '100%';
575            sCookie('show_right_mapa', '', -1);
576        } else {
577            rl.className = 'roll_sel';
578            rl.innerHTML = txto;
579            r2.className += '_big';
580            r3.className += '_big';
581            r4.className += '_big';
582
583            $('page_content_center').style.width = '760px'; //mapa_content_left
584            $('content_center').style.width = 'auto'; //mapa_content_tresc
585            $('map').style.width = '100%';
586            sCookie('show_right_mapa', true, 0);
587        }
588    }
589}
590
591function ToggleOfidMap(txtc, txto) {
592    var fs = document.getElementById('page_content_right');
593    var fshidden = fs.style.display;
594    Element.toggle('page_content_right');
595    var rl = $('roll');
596    var r2 = $('content_center');
597    var r3 = $('pg_bgr_top');
598    var r4 = $('pg_bgr_bottom');
599    var r5 = $('map');
600
601    if (rl && fs) {
602        if (fshidden == 'none') {
603            rl.className = 'roll';
604            rl.innerHTML = txtc;
605            r2.className = 'page_content';
606            r3.className = 'page_content_top';
607            r4.className = 'page_content_bottom';
608
609            $('page_content_center').style.width = '470px';
610            $('content_center').style.width = 'auto';
611            $('map').style.width = '100%';
612            sCookie('show_right_ofid', '', -1);
613        } else {
614            rl.className = 'roll_sel';
615            rl.innerHTML = txto;
616            r2.className += '_big';
617            r3.className += '_big';
618            r4.className += '_big';
619
620            $('page_content_center').style.width = '760px';
621            $('content_center').style.width = 'auto';
622            $('map').style.width = '100%';
623            sCookie('show_right_ofid', true, 0);
624        }
625    }
626}
627
628function ToggleGallery(txtc, txto) {
629    var fs = document.getElementById('page_content_right');
630    var fshidden = fs.style.display;
631    Element.toggle('page_content_right');
632    var rl = $('roll');
633    var r2 = $('content_center');
634    var r3 = $('pg_bgr_top');
635    var r4 = $('pg_bgr_bottom');
636    var r5 = $('content_center_powiazane');
637    var r6 = $('pgb_bgr_top');
638    var r7 = $('pgb_bgr_bottom');
639
640    if (rl && fs) {
641        if (fshidden == 'none') {
642            rl.className = 'roll';
643            rl.innerHTML = txtc;
644            r2.className = 'page_content';
645            r3.className = 'page_content_top';
646            r4.className = 'page_content_bottom';
647
648            if (r5 && r6 && r7) {
649                r5.className = 'page_content';
650                r6.className = 'page_content_top';
651                r7.className = 'page_content_bottom';
652                $('content_center_powiazane').style.width = 'auto';
653            }
654
655            $('page_content_center').style.width = '470px';
656            $('content_center').style.width = 'auto';
657            sCookie('show_right_galp', '', -1);
658        } else {
659            rl.className = 'roll_sel';
660            rl.innerHTML = txto;
661            r2.className += '_big';
662            r3.className += '_big';
663            r4.className += '_big';
664
665            if (r5 && r6 && r7) {
666                r5.className += '_big';
667                r6.className += '_big';
668                r7.className += '_big';
669                $('content_center_powiazane').style.width = 'auto';
670            }
671
672            $('page_content_center').style.width = '760px';
673            $('content_center').style.width = 'auto';
674            sCookie('show_right_galp', true, 0);
675        }
676    }
677}
678
679function ToggleIGallery(txtc, txto) {
680    var fs = document.getElementById('page_content_right');
681    var fshidden = fs.style.display;
682    Element.toggle('page_content_right');
683    var rl = $('roll');
684    var r2 = $('content_center');
685    var r3 = $('pg_bgr_top');
686    var r4 = $('pg_bgr_bottom');
687
688    if (rl && fs) {
689        if (fshidden == 'none') {
690            rl.className = 'roll';
691            rl.innerHTML = txtc;
692            r2.className = 'page_content';
693            r3.className = 'page_content_top';
694            r4.className = 'page_content_bottom';
695
696            $('page_content_center').style.width = '470px';
697            $('content_center').style.width = 'auto';
698            sCookie('show_right_gali', '', -1);
699        } else {
700            rl.className = 'roll_sel';
701            rl.innerHTML = txto;
702            r2.className += '_big';
703            r3.className += '_big';
704            r4.className += '_big';
705
706            $('page_content_center').style.width = '760px';
707            $('content_center').style.width = 'auto';
708            sCookie('show_right_gali', true, 0);
709        }
710    }
711}
712function ToggleMedia(txtc, txto) {
713    var fs = document.getElementById('page_content_right');
714    var fshidden = fs.style.display;
715    Element.toggle('page_content_right');
716    var rl = $('roll');
717    var r2 = $('content_center');
718    var r3 = $('pg_bgr_top');
719    var r4 = $('pg_bgr_bottom');
720
721    if (rl && fs) {
722        if (fshidden == 'none') {
723            rl.className = 'roll';
724            rl.innerHTML = txtc;
725            r2.className = 'page_content';
726            r3.className = 'page_content_top';
727            r4.className = 'page_content_bottom';
728
729            $('page_content_center').style.width = '470px';
730            $('content_center').style.width = 'auto';
731            sCookie('show_right_medi', '', -1);
732        } else {
733            rl.className = 'roll_sel';
734            rl.innerHTML = txto;
735            r2.className += '_big';
736            r3.className += '_big';
737            r4.className += '_big';
738
739            $('page_content_center').style.width = '760px';
740            $('content_center').style.width = 'auto';
741            sCookie('show_right_medi', true, 0);
742        }
743    }
744}
745
746/**
747 * Funkcja do zmiany obrazka captcha jezeli nie da sie odczytac
748 */
749function reloadCaptcha(url) {
750    var random = Math.round(Math.random(0) * 1000) + 1;
751    $("captcha_img").src = url.substr(0, url.length - 5) + '/id/' + random + '.html';
752}
753
754/**
755 * Otwiera nowe okno o podanych wymiarach a w nim podany adres
756 */
757function NoweOkno(url, szer, wys) {
758    if (typeof (szer) != 'number')
759        szer = 640;
760    if (typeof (wys) != 'number')
761        wys = 360;
762    noweOkno = window.open(url, 'okienko', 'menubar=no, toolbar=no, location=no, scrollbars=no, resizable=yes, status=no, width=' + szer + ', height=' + wys + ', left=150, top=150');
763    noweOkno.focus();
764}
765
766function sprawdzAnkiete(params, num, btxt) 
767{
768    var ile_pyt = 0;    
769    var params_parsed = objectifyForm(params);    
770    for (key in params_parsed) 
771    {
772        if (typeof (params_parsed[key]) === 'string') 
773        {
774            if (trim(params_parsed[key]) === '' && key != 'commit') 
775            {
776                alert(btxt);
777                return 0;//pusty input text
778            }
779        }
780        ile_pyt++;
781    }
782    ile_pyt = ile_pyt - 2;//nie wazne 3 parametry, czyli id, vote, i commit bo nie sa pytaniami
783
784    if (ile_pyt !== num) 
785    {
786        alert(btxt);
787        return 0;//puste pytanie
788    }
789    return 1;
790}
791
792function objectifyForm(formArray) {//serialize data function
793
794  var returnArray = {};
795  for (var i = 0; i < formArray.length; i++)
796  {
797        if(formArray[i]['name'] in returnArray)
798        {
799            if(Array.isArray(returnArray[formArray[i]['name']]))
800            {
801                returnArray[formArray[i]['name']].push(formArray[i]['value']);
802            }
803            else
804            {
805                var val = returnArray[formArray[i]['name']];
806                returnArray[formArray[i]['name']] = [];
807                returnArray[formArray[i]['name']].push(val);
808                returnArray[formArray[i]['name']].push(formArray[i]['value']);
809            }
810        }
811        else
812        {
813            returnArray[formArray[i]['name']] = formArray[i]['value'];
814        }
815  }
816  return returnArray;
817}
818
819function trim(str) {
820    return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
821}
822/**
823 * Funkcja odczytuje cookie
824 * @param N - nazwa cookie
825 */
826function gCookie(N, x) {
827    if ((x = document.cookie) && (N = (';' + x).match(new RegExp('(;| )' + N + '=[^;]+')))) {
828        return unescape(N[0].split(/=/g)[1])
829    }
830}
831
832/**
833 * Funkcja ustawia cookie
834 * @param N - nazwa cookie
835 * @param V - wartosc cookie
836 * @param D - czas waznosci w dniach cookie ([0]-wazne do zamkniecia przegladarki, [-1]-usuwa cookie)
837 */
838function sCookie(N, V, D) {
839    document.cookie = N + '=' + escape(V) + (D ? '; expires=' + new Date(+new Date() + D * 864e5).toGMTString() : '') + '; path=/;'
840}
841
842if (typeof Position != 'undefined') {
843    Position.getWindowSize = function (w)
844    {
845        var width, height;
846        w = w ? w : window;
847        this.width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth);
848        this.height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight);
849        return this;
850    }
851}
852
853//Pokazuje baner popup
854function pokaz_baner(id) {
855    var aid = 'img_' + id;
856
857
858    document.getElementById("popup-bg").style.display = 'block';
859    document.getElementById(aid).style.display = 'block';
860    center_element(aid);
861}
862
863//Ukrywa baner popup
864function ukryj_baner(id) {
865    document.getElementById("popup-bg").style.display = 'none';
866    document.getElementById('img_' + id).style.display = 'none';
867    clearInterval('adsinterval_' + id);
868    sCookie('popup_' + id, 1, 0);
869}
870
871// Centruje poziomo i pionowo element "id"
872function center_element(id) {
873
874    document.getElementById(id).style.position = 'fixed';
875
876    var marginLeft = document.getElementById(id).offsetWidth / 2;
877    var marginTop = document.getElementById(id).offsetHeight / 2;
878    document.getElementById(id).style.position = 'fixed';
879    document.getElementById(id).style.top = '50%';
880
881
882    document.getElementById(id).style.marginTop = '-' + marginTop + 'px';
883    document.getElementById(id).style.left = '50%';
884    document.getElementById(id).style.marginLeft = '-' + marginLeft + 'px';
885
886}
887
888
889function checkAllBoxes(checked, className) {
890    var boxes = $$('input.' + className + '[type="checkbox"]');
891    boxes.each(function (box) {
892        box.checked = checked;
893    })
894}
895
896function manageInput(element) {
897    element.onfocus = function () {
898
899        if (element.value == element.defaultValue)
900            element.value = "";
901    }
902    element.onblur = function () {
903
904        if (element.value == "")
905            element.value = element.defaultValue;
906    }
907}
908
909function copyElement(from_id, to_id, delete_source) {
910    if ($(to_id) && $(to_id)) {
911        $(to_id).innerHTML = $(from_id).innerHTML;
912
913        if (delete_source) {
914            $(from_id).remove();
915        }
916    }
917}
918
919function domenaURL() {
920    return document.location.protocol + '//' + document.location.host + '/';
921}
922
923function notNull(variable) {
924    if (variable != null && variable != undefined) {
925        return true;
926    } else {
927        return false;
928    }
929}
930
931function isNull(variable) {
932    if (variable == null || variable == undefined) {
933        return true;
934    } else {
935        return false;
936    }
937}
938
939function checkDefaultPrompt(id, defaultPrompt) {
940    var search = jQuery("[id$=" + id + "]");
941    var search_val = search.val();
942
943    if (search_val == defaultPrompt) {
944        search_val = search.val("");
945    }
946}
947
948//	ścieżka do pliku list.php
949function listURL(id) {
950    return ('list.php');
951}
952function katalogZObrazkami(id) {
953    return ('images-flash/');
954}
955//	domena
956function domenaURL(ID) {
957    return top.location.host;
958
959}
960//	data
961function dayDate(id) {
962    return ('dzień do wyświetlenia');
963}
964//	czy obrazki mają się scrollować
965function scrollPictures(id) {
966    return (true);
967}
968//	czy rozmiar obrazka ma być dopasowywany
969function autoFitPictures(id) {
970    return (true);
971}
972//	prędkość przesuwania obrazka
973function scrollSpeed(id) {
974    return (1.5);
975}
976//	granica miękkich zwrotów podczas scrollu
977function scrollSwitchSmotthness(id) {
978    return (30);
979}
980//	czas pomiÄ™dzy zmianami obrazków
981function slideShowTime(id) {
982    return (24000);
983}
984//	prędkość przejść zmian obrazków
985function fadeSpeed(id) {
986    return (0.02);
987}
988
989function dodajDoUlubionych()
990{
991    var title = document.title;
992    var url = document.location.href;
993    var def_msg = 'Aby dodać do zakładek naciśnij Ctrl+D';
994
995    if (window.sidebar) {
996        window.sidebar.addPanel(title, url, "");
997    } else if (document.all) {
998        window.external.AddFavorite(url, title);
999    } else if (window.opera && window.print) {
1000        alert(def_msg);
1001    } else if (window.chrome) {
1002        alert(def_msg);
1003    } else {
1004        alert(def_msg);
1005    }
1006}
1007
1008function AddEvent(html_element, event_name, event_function)
1009{
1010    if (html_element.attachEvent) //Internet Explorer
1011        html_element.attachEvent("on" + event_name, function () {
1012            event_function.call(html_element);
1013        });
1014    else if (html_element.addEventListener) //Firefox & company
1015        html_element.addEventListener(event_name, event_function, false); //don't need the 'call' trick because in FF everything already works in the right way          
1016}
1017
1018//**
1019// rozwijanie pozycji menu glownego
1020//
1021
1022var menuVisible = false;
1023var blockMenuTimers = [];
1024var blockMenuOutTimers = [];
1025var menuFoldDelay = 300;
1026
1027function menuFoldOut(menu_pos, withMargin) {
1028    if ($(menu_pos).hasClass('opened')) {
1029        return 0;
1030    }
1031
1032    var id = jQuery(menu_pos).attr('id');
1033    var theId = id.split('_')[3];
1034    clearTimeout(blockMenuOutTimers[theId]);
1035
1036    if (jQuery(menu_pos).hasClass("active"))
1037    {
1038        return;
1039    }
1040
1041    var position = jQuery('.sub-block-menu', menu_pos);
1042
1043    blockMenuTimers[theId] = setTimeout(function () {
1044        $(menu_pos).parent().find('.block').removeClass('opened');
1045        $(menu_pos).addClass('opened');
1046        menuVisible = true;
1047        position.addClass('js-display-block').removeClass('js-display-none').addClass('js-max-height-0').removeClass('js-max-height-700');
1048
1049        if (withMargin == 'true')
1050        {
1051            position.parent().parent().stop(true).animate({marginBottom: position.outerHeight(true) + "px"}, 0);
1052        }
1053        if (jQuery('a:hover').length > 0)
1054            wyrownajMenu(jQuery('a:hover'));
1055    }, menuFoldDelay);
1056
1057    //setTimeout(function () {
1058    //adjustBoxes(menu_pos);
1059    //}, 1);
1060}
1061
1062/**
1063 * zwijanie pozycji menu glownego
1064 */
1065function menuFoldIn(menu_pos, withMargin, instant)
1066{
1067    $(menu_pos).parent().find('.block').removeClass('opened');
1068    var id = jQuery(menu_pos).attr('id');
1069    var theId = id.split('_')[3];
1070
1071    if (jQuery(menu_pos).hasClass("active"))
1072    {
1073        return;
1074    }
1075
1076    clearTimeout(blockMenuTimers[theId]);
1077
1078    blockMenuOutTimers[theId] = setTimeout(function () {
1079        var position = jQuery('.sub-block-menu', menu_pos);
1080        var delayTime = 35;
1081        if (instant)
1082            delayTime = 0;
1083        position.stop(true).delay(5).removeClass('js-display-block').addClass('js-display-none');
1084
1085        if (withMargin == 'true')
1086            position.parent().parent().stop(true).animate({marginBottom: "0px"}, 0);
1087        menuVisible = false;
1088    }, menuFoldDelay);
1089}
1090
1091var main_menu_id = null;
1092var docked = false;
1093var menu_height = null;
1094var menu_width = null;
1095
1096/**
1097 * funkcja przyczepiajaca menu glowne do gornej czesci przegladarki
1098 */
1099function menuDocking(menu_id)
1100{
1101
1102    if (!main_menu_id)
1103        main_menu_id = menu_id;
1104
1105    if (main_menu_id != menu_id)
1106        return false;
1107
1108    var DOM_menu = document.getElementById(menu_id);
1109    if (!DOM_menu)
1110        return null;
1111
1112    var menu = DOM_menu.parentNode;
1113    var menuStartOffsetTop = jQuery(menu).offset().top;
1114    var menuDockedPaddingTop = 0;
1115
1116    //if (!menu_height)
1117    {
1118        jQuery(DOM_menu).height('auto');
1119        jQuery(menu).height('auto');
1120        menu_height = jQuery(DOM_menu).outerHeight(true);
1121    }
1122
1123    //if (!menu_width)
1124    {
1125        menu_width = jQuery(DOM_menu).parent().width();
1126        //jQuery(DOM_menu).width(menu_width);
1127    }
1128
1129    var scrollTop = jQuery(window).scrollTop();
1130    if (scrollTop > (menuStartOffsetTop - menuDockedPaddingTop)) {
1131
1132        if (!docked)
1133        {
1134            DOM_menu.parentNode.style.height = menu_height + "px";
1135            DOM_menu.style.width = menu_width + "px";
1136            DOM_menu.style.height = menu_height + "px";
1137            DOM_menu.style.top = 0; // menuDockedPaddingTop+"px";
1138            DOM_menu.style.zIndex = 14;
1139            //DOM_menu.style.position = 'fixed';
1140            DOM_menu.className += ' docked';
1141            jQuery('#PAN_HEAD').addClass('menuDocked');
1142            docked = true;
1143        }
1144    } else
1145    {
1146        if (docked)
1147        {
1148            //DOM_menu.style.position = 'relative';
1149            DOM_menu.style.top = 0 + "px";
1150            DOM_menu.style.width = "auto"
1151            DOM_menu.style.zIndex = 14; // z jakiegos powodu bylo tu wczesniej 10
1152            DOM_menu.className = DOM_menu.className.replace(' docked', '');
1153            jQuery('#PAN_HEAD').removeClass('menuDocked');
1154            docked = false;
1155        }
1156    }
1157}
1158
1159function getOffsetTop(element)
1160{
1161    //var xPosition = 0;
1162    var yPosition = 0; //element.offsetHeight;
1163
1164    while (element) {
1165        //xPosition += (element.offsetLeft - element.scrollLeft + element.clientLeft);
1166        yPosition += (element.offsetTop - element.scrollTop + element.clientTop);
1167        element = element.offsetParent;
1168    }
1169
1170    //return { x: xPosition, y: yPosition };
1171    return yPosition;
1172}
1173
1174/**
1175 * Cross Browser helper to addEventListener.
1176 *
1177 * @param {HTMLElement} obj The Element to attach event to.
1178 * @param {string} evt The event that will trigger the binded function.
1179 * @param {function(event)} fnc The function to bind to the element. 
1180 * @return {boolean} true if it was successfuly binded.
1181 */
1182var cb_addEventListener = function (obj, evt, fnc) {
1183    if (!obj)
1184        return false;
1185
1186    // W3C model
1187    if (obj.addEventListener) {
1188        obj.addEventListener(evt, fnc, false);
1189        return true;
1190    }
1191    // Microsoft model
1192    else if (obj.attachEvent) {
1193        return obj.attachEvent('on' + evt, fnc);
1194    }
1195    // Browser don't support W3C or MSFT model, go on with traditional
1196    else {
1197        evt = 'on' + evt;
1198        if (typeof obj[evt] === 'function') {
1199            // Object already has a function on traditional
1200            // Let's wrap it with our own function inside another function
1201            fnc = (function (f1, f2) {
1202                return function () {
1203                    f1.apply(this, arguments);
1204                    f2.apply(this, arguments);
1205                }
1206            })(obj[evt], fnc);
1207        }
1208        obj[evt] = fnc;
1209        return true;
1210    }
1211    return false;
1212};
1213
1214
1215/**
1216 * poprawki specjalnie dla jasnie szanownego WCAG
1217 */
1218function wcagstinks(wrapper)
1219{
1220    // elementy z onclickiem
1221    if (typeof wrapper !== 'undefined')
1222        var divs = jQuery('*[onclick]');
1223    else
1224        var divs = jQuery('*[onclick]', wrapper);
1225
1226    for (var i = 0; i < divs.length; i++)
1227    {
1228        var el = divs[i];
1229        if (el)
1230        {
1231            if (el.parentNode.tagName.toLowerCase() == 'a')
1232                continue;
1233
1234            if (el.getAttribute("tabindex") == null)
1235                el.setAttribute("tabindex", "0");
1236
1237            var fn = "if (event.keyCode==13){" + el.getAttribute("onclick") + "}";
1238            el.setAttribute("onkeypress", fn);
1239            el.setAttribute("role", "button");
1240
1241            //	kasowanie focusa po kliknięciu myszką
1242            jQuery(el).not('[name*="search"]').on("click", function () {
1243                jQuery(this).blur();
1244            });
1245        }
1246    }
1247
1248    // elementy z tabindexem bez onclicka (np. dodany eventHandler)
1249    if (typeof wrapper !== 'undefined')
1250        var divs = jQuery('*[tabindex]');
1251    else
1252        var divs = jQuery('*[tabindex]', wrapper);
1253
1254    for (var i = 0; i < divs.length; i++)
1255    {
1256        var el = divs[i];
1257        if (el)
1258        {
1259            if (el.parentNode.tagName.toLowerCase() == 'a')
1260                continue;
1261
1262            if (el.getAttribute("onclick") == null)
1263            {
1264                var fn = "if (event.keyCode==13){ event.target.click(); }";
1265                el.setAttribute("onkeypress", fn);
1266                el.setAttribute("role", "button");
1267            }
1268        }
1269        
1270    }
1271
1272
1273    // elementy z target="_blank"
1274    if (typeof wrapper !== 'undefined')
1275        var divs = jQuery('*[target="_blank"], *[onclick*="window.open"]');
1276    else
1277        var divs = jQuery('*[target="_blank"], *[onclick*="window.open"]', wrapper);
1278
1279    for (var i = 0; i < divs.length; i++)
1280    {
1281        var el = divs[i];
1282        if (el)
1283        {
1284            var dopisek = "[otwórz w nowym oknie]";
1285            var title = el.getAttribute("title") ? el.getAttribute("title") + ' ' : '';
1286            if (title.indexOf(dopisek) == -1)
1287            {
1288                el.setAttribute("title", title + dopisek);
1289            }
1290        }
1291    }
1292
1293
1294    // linki do fancyboxa
1295    if (typeof wrapper !== 'undefined')
1296        var divs = jQuery('a.fancybox');
1297    else
1298        var divs = jQuery('a.fancybox', wrapper);
1299
1300    for (var i = 0; i < divs.length; i++)
1301    {
1302        var el = divs[i];
1303        if (el)
1304        {
1305            var dopisek = "kliknięcie spowoduje wyświetlenie powiększenia";
1306            var title = el.getAttribute("title") ? el.getAttribute("title") + ' - ' : '';
1307            if (title.indexOf(dopisek) == -1)
1308            {
1309                el.setAttribute("title", title + dopisek);
1310            }
1311        }
1312    }
1313}
1314
1315/*	****************************************
1316**	Aktywacja FOCUSA tylko po akcji z klawiatury
1317**	****************************************	*/
1318jQuery(document).on('click mouseup mousedown', function(){
1319	jQuery('body').removeClass('keyboard-navigated');
1320});
1321jQuery(document).on('keydown', function(){
1322	jQuery('body').addClass('keyboard-navigated');
1323});
1324
1325
1326
1327
1328
1329if (window.jQuery)
1330{
1331    jQuery(function () {
1332        //console.log(jQuery(".toggle"));
1333        jQuery(".toggle").each(function () {
1334            jQuery(this).prepend('<span class="hidden-wcag">' + jQuery(this).prev().text() + '</span>');
1335        }).css("height", "20px").click(
1336                function () {
1337                    if (this.className.indexOf("folded") != -1)
1338                    {
1339                        jQuery(this).animate({"height": "20px"}, "fast");
1340                        jQuery(this).removeClass("folded");
1341                    } else
1342                    {
1343                        var autoHeight = jQuery(this).css("height", "auto").height();
1344                        jQuery(this).css("height", "20px");
1345                        jQuery(this).animate({"height": autoHeight}, "fast");
1346                        jQuery(this).addClass("folded");
1347                    }
1348                })
1349    });
1350
1351
1352    jQuery(function () {
1353        jQuery(window).resize(
1354                function () {
1355                    if (window.adjustBoxes)
1356                        adjustBoxes();
1357                })
1358    });
1359
1360    jQuery.fn.scrollTo = function (target, options, callback) {
1361        if (typeof options == 'function' && arguments.length == 2) {
1362            callback = options;
1363            options = target;
1364        }
1365        var settings = jQuery.extend({
1366            scrollTarget: target,
1367            offsetTop: 50,
1368            duration: 500,
1369            easing: 'swing'
1370        }, options);
1371        return this.each(function () {
1372            var scrollPane = jQuery(this);
1373            var scrollTarget = (typeof settings.scrollTarget == "number") ? settings.scrollTarget : jQuery(settings.scrollTarget);
1374            var scrollY = (typeof scrollTarget == "number") ? scrollTarget : scrollTarget.offset().top + scrollPane.scrollTop() - parseInt(settings.offsetTop);
1375            scrollPane.animate({scrollTop: scrollY}, parseInt(settings.duration), settings.easing, function () {
1376                if (typeof callback == 'function') {
1377                    callback.call(this);
1378                }
1379            });
1380        });
1381    }
1382}
1383
1384function fixConceptRotators($, wrapper) {
1385    if (!$)
1386        $ = jQuery;
1387        
1388    var css_active = jQuery('#css-active').height() > 0;
1389    if(!css_active) return;
1390
1391    var rotators = null;
1392    if (wrapper)
1393        rotators = $('.ci-rotator', wrapper);
1394    else
1395        rotators = $('.ci-rotator');
1396
1397    var i = 0;
1398    for (i = 0; i < rotators.length; i++) {
1399        var news = $('.ci-rotator-news', rotators[i]).children();
1400
1401        var maxH = 0;
1402        //var butH = $('.ci-rotator-buttons', rotators[i]).height();
1403        for (var i2 = 0; i2 < news.length; i2++)
1404        {
1405            if ($(news[i2]).attr('hidden'))
1406                continue;
1407			
1408			$(news[i2]).css('height','auto');
1409			
1410            if ($(news[i2]).height() > maxH) {
1411                maxH = $(news[i2]).height();				
1412			}
1413        }
1414        if ($('.ci-rotator-news', rotators[i]).height() < maxH) {
1415            $('.ci-rotator-news', rotators[i]).animate({height: maxH});
1416		}
1417    }
1418
1419}
1420
1421function getInnerWidth(element)
1422{
1423    var element_width = null; // element.style.width;
1424
1425    if (!element_width)
1426        element_width = jQuery(element).width();
1427
1428    if (!element_width)
1429        if (document.defaultView)
1430        {
1431            element_width = document.defaultView.getComputedStyle(element, "").getPropertyValue("width");
1432        } else if (element.currentStyle)
1433        {
1434            element_width = element.currentStyle.width;
1435        }
1436
1437    return parseInt(element_width);
1438}
1439
1440
1441function getDecoratorsHeight(element)
1442{
1443    var element_height = 0;
1444
1445    if (document.defaultView && document.defaultView.getComputedStyle(element, ""))
1446    {
1447        element_height = parseInt(document.defaultView.getComputedStyle(element, "").getPropertyValue("margin-top"))
1448                + parseInt(document.defaultView.getComputedStyle(element, "").getPropertyValue("margin-bottom"))
1449                + parseInt(document.defaultView.getComputedStyle(element, "").getPropertyValue("padding-top"))
1450                + parseInt(document.defaultView.getComputedStyle(element, "").getPropertyValue("padding-bottom"))
1451                + parseInt(document.defaultView.getComputedStyle(element, "").getPropertyValue("border-top-width"))
1452                + parseInt(document.defaultView.getComputedStyle(element, "").getPropertyValue("border-bottom-width"))
1453                ;
1454    } else
1455    if (element.currentStyle)
1456    {
1457        element_height = parseInt(element.currentStyle.marginTop)
1458                + parseInt(element.currentStyle.marginBottom)
1459                + parseInt(element.currentStyle.paddingTop)
1460                + parseInt(element.currentStyle.paddingBottom)
1461                + parseInt(element.currentStyle.borderTopWidth)
1462                + parseInt(element.currentStyle.borderBottomWidth)
1463                ;
1464    } else
1465        element_height = 0;
1466
1467    return parseInt(element_height);
1468}
1469
1470
1471
1472
1473/* Kalendarz hatmonogram
1474 ***********************************	*/
1475function initHarmonogramTrace() {
1476    traceFocusInside(jQuery, jQuery('.icalendar[class*="harmonogram"] .event'), 'active', 2, null, null);
1477}
1478jQuery(document).ready(function () {
1479    initHarmonogramTrace();
1480});
1481
1482
1483/* Wykrywa zcy focus jest wewnątrz conainera
1484 ***********************************	*/
1485
1486function traceFocusInside(jQuery, el, classOnFocus, timeOut, onCompleteIn, onCompleteOut) {
1487    var $ = jQuery;
1488    var focusArray = [];
1489    for (var i = 0; i < el.length; i++) {
1490        var eli = el[i];
1491        $(eli).attr('data-menu-id', i);
1492        $(eli).attr('data-focus-trace', 'true');
1493        var focusInside = false;
1494        focusArray.push(false);
1495
1496        $(eli).focusin(function (i1, eli1) {	// enclosure is created
1497            return function () {
1498                if (($(eli1).has(document.activeElement).length >= 0) &&
1499                        (!focusArray[i1])) {
1500
1501                    focusArray[i1] = true;
1502                    $(eli1).addClass(classOnFocus);
1503                    if (onCompleteIn) {
1504                        onCompleteIn(eli1);
1505                    }
1506                }
1507            }
1508        }(i, eli));
1509        $(eli).focusout(function (i1, eli1) {
1510            return function () {
1511                setTimeout(function () {
1512                    timeout(i1, eli1);
1513                }, timeOut);
1514            }
1515        }(i, eli));
1516    }
1517    function timeout(i, eli) {	// enclosure is created
1518        if (($(':focus', eli).length <= 0) &&
1519                (!$(eli).is(':focus'))) {
1520
1521            focusArray[i] = false;
1522            $(eli).removeClass(classOnFocus);
1523            if (onCompleteOut)
1524                onCompleteOut(eli);
1525        }
1526    }
1527}
1528;
1529
1530
1531/**
1532 * Comment
1533 */
1534function showWaiter(container_id)
1535{
1536    //console.log("showWaiter('"+container_id+"');");
1537    var container = jQuery('#' + container_id)[0];
1538    if (container)
1539    {
1540        jQuery(container)./*css('position', 'relative').*/append('<span class="waiter-wrapper"><span class="waiter"></span></span>');
1541    }
1542    return false;
1543}
1544
1545/**
1546 * Comment
1547 */
1548function hideWaiter(container_id)
1549{
1550    //console.log("showWaiter('"+container_id+"');");
1551    var container = jQuery('#' + container_id + ' span.waiter-wrapper')[0];
1552    if (container)
1553    {
1554        jQuery(container).remove();
1555    }
1556    return false;
1557}
1558
1559/**
1560 * funkcja do zaznaczania odpowiedniego trybu wyswietlania zajawek w view_changer
1561 * @param {type} elid
1562 * @param {type} mode
1563 * @returns {undefined}
1564 */
1565function selectViewChanger(elid, mode, switcher_id)
1566{
1567    jQuery("#" + elid + " > a").removeClass('sel');
1568    jQuery("#" + elid + " > a." + mode).addClass('sel');
1569    if (mode == 'view_list')
1570        jQuery("#" + switcher_id).addClass('columns-1');
1571    else
1572        jQuery("#" + switcher_id).removeClass('columns-1');
1573}
1574
1575
1576function adjustBoxes(wrapper)
1577{
1578    var debug = false;
1579
1580    if (debug)
1581    {
1582        jQuery(box).append('AdjustBoxes: ' + wrapper);
1583    }
1584
1585    if (wrapper)
1586        var box_list = jQuery('.zajawka', wrapper);
1587    else
1588        var box_list = jQuery('.zajawka');
1589
1590    for (var k = 0; k < box_list.length; k++)
1591    {
1592        var box = box_list[k];
1593        if (typeof box != "object" || jQuery(box).hasClass('exclude'))
1594            continue;
1595
1596        // usuniecie wczesniejszych in-row i in-column
1597        var class_name = box.className;
1598        class_name = class_name.replace(/ in-row/g, '');
1599        class_name = class_name.replace(/ in-column/g, '');
1600        class_name = class_name.replace(/ in-flow/g, '');
1601        box.className = class_name;
1602        //box.style.minWidth = "auto";
1603
1604        // obsluga NewsBox-a
1605        if (jQuery(box).parent().parent().parent().hasClass('newsbox-container'))
1606        {
1607            box.className += " in-column";
1608            if (debug)
1609            {
1610                jQuery(box).append('CLASS: in-column (NEWSBOX)');
1611            }
1612            continue;
1613        }
1614
1615        var box_width = getInnerWidth(box);
1616
1617        var box_left_childs = box.querySelectorAll('.box-left');
1618        var box_LEFT_width = 0;
1619
1620        for (var i in box_left_childs)
1621        {
1622            var child = box_left_childs[i];
1623            if (typeof child != "object")
1624                continue;
1625
1626            var child_width = parseInt(child.offsetWidth);
1627            if (child_width > box_LEFT_width)
1628                box_LEFT_width = child_width;
1629        }
1630
1631        var box_RIGHT_width = box_width - box_LEFT_width;
1632
1633        if (debug)
1634        {
1635            jQuery(box).append(' Left: ' + box_LEFT_width);
1636            jQuery(box).append(' Right: ' + box_RIGHT_width);
1637            jQuery(box).append(' All: ' + box_width);
1638        }
1639
1640        if (box_LEFT_width < 0.5 * box_width && box_RIGHT_width >
1640 250 || box_LEFT_width == 'undefined' || box_LEFT_width == 0)
1641        {
1642            box.className += " in-row";
1643            if (debug)
1644            {
1645                jQuery(box).append('CLASS: in-row');
1646            }
1647        } else if (box_LEFT_width < 0.6 * box_width && box_RIGHT_width > 250)
1648        {
1649            box.className += " in-flow";
1650            if (debug)
1651            {
1652                jQuery(box).append('CLASS: in-flow');
1653            }
1654        } else
1655        {
1656            box.className += " in-column";
1657            if (debug)
1658            {
1659                jQuery(box).append('CLASS: in-column');
1660            }
1661        }
1662    }
1663}
1664
1665
1666/*!
1667 *  VERSION: 1.0
1668 *  DATE: 2014-11-29
1669 * 
1670 *   AUTHOR: 
1671 *	Maciej Dejewski
1672 *       bass-in-motion studio
1673 *   http://bimstudio.pl
1674 *
1675 *   COPYRIGHT / LEGAL ISSUES:
1676 *      free for all
1677 *
1678 *   REQUIRES:
1679 *   -   
1680 *   
1681 *   DESCRIPTION:
1682 *   ahortcut for console.log tracing
1683 **/
1684
1685//  I chose not to use those variables in other functions so I can create console logs easier
1686//  so dont use cc(h2) if You have defined Your own private h2 variable
1687var h1 = 'h1';
1688var h2 = 'h2';
1689var h3 = 'h3';
1690
1691function cc(v1, v2, heading) {
1692    //	IE console fix
1693    if (!window.console)
1694        window.console = {};
1695    if (!window.console.log)
1696        window.console.log = function () {
1697        };
1698
1699    var h = '';
1700    if ((v1 == 'h1') ||
1701            (v2 == 'h1') ||
1702            (heading == 'h1') ||
1703            (v1 == 1111) ||
1704            (v2 == 1111) ||
1705            (heading == 1111)) {
1706        h = '███  ';
1707    }
1708    if ((v1 == 'h2') ||
1709            (v2 == 'h2') ||
1710            (heading == 'h2') ||
1711            (v1 == 2222) ||
1712            (v2 == 2222) ||
1713            (heading == 2222)) {
1714        h = '█▄   ';
1715    }
1716    if ((v1 == 'h3') ||
1717            (v2 == 'h3') ||
1718            (heading == 'h3') ||
1719            (v1 == 3333) ||
1720            (v2 == 3333) ||
1721            (heading == 3333)) {
1722        h = '●●   ';
1723    }
1724
1725    if ((v1 == 'h1') ||
1726            (v1 == 'h2') ||
1727            (v1 == 'h3') ||
1728            (v1 == 1111) ||
1729            (v1 == 2222) ||
1730            (v1 == 3333))
1731        v1 = undefined;
1732    if ((v2 == 'h1') ||
1733            (v2 == 'h2') ||
1734            (v2 == 'h3') ||
1735            (v2 == 1111) ||
1736            (v2 == 2222) ||
1737            (v2 == 3333))
1738        v2 = undefined;
1739
1740    if ((v1 != undefined) &&
1741            (v2 != undefined)) {
1742        // console.log(h + v1 + ' = ', v2);
1743    } else if ((v1 != undefined) &&
1744            (v2 == undefined)) {
1745        // console.log(h + v1);
1746    } else if ((v1 == undefined) &&
1747            (v2 != undefined)) {
1748        // console.log(h + v2);
1749    } else {
1750        //console.log('. . . no parameters');
1751        //console.log('. . .  .   .    .');
1752    }
1753}
1754;
1755
1756/*
1757 * jQuery throttle / debounce - v1.1 - 3/7/2010
1758 * http://benalman.com/projects/jquery-throttle-debounce-plugin/
1759 * 
1760 * Copyright (c) 2010 "Cowboy" Ben Alman
1761 * Dual licensed under the MIT and GPL licenses.
1762 * http://benalman.com/about/license/
1763 
1764 usage
1765 // Console logging happens on window scroll, but no more than once every 250ms.
1766 $(window).scroll( $.throttle( 250, log ) );
1767 
1768 // Console logging happens when window scroll stops occuring, check for scroll occures once every 250ms.
1769 $(window).scroll( $.debounce( 250, log ) );
1770 */
1771(function (b, c) {
1772    var $ = b.jQuery || b.Cowboy || (b.Cowboy = {}), a;
1773    $.throttle = a = function (e, f, j, i) {
1774        var h, d = 0;
1775        if (typeof f !== "boolean") {
1776            i = j;
1777            j = f;
1778            f = c
1779        }
1780        function g() {
1781            var o = this, m = +new Date() - d, n = arguments;
1782            function l() {
1783                d = +new Date();
1784                j.apply(o, n)
1785            }
1786            function k() {
1787                h = c
1788            }
1789            if (i && !h) {
1790                l()
1791            }
1792            h && clearTimeout(h);
1793            if (i === c && m > e) {
1794                l()
1795            } else {
1796                if (f !== true) {
1797                    h = setTimeout(i ? k : l, i === c ? e - m : e)
1798                }
1799            }
1800        }
1801        if ($.guid) {
1802            g.guid = j.guid = j.guid || $.guid++
1803        }
1804        return g
1805    };
1806    $.debounce = function (d, e, f) {
1807        return f === c ? a(d, e, false) : a(d, f, e !== false)
1808    }
1809})(this);
1810
1811/**
1812 * funkcja pomocnicza w menu modulowym - obsluguje zwijacze
1813 * @param {type} element_id
1814 * @param {type} trigerer_el
1815 * @returns {Boolean}
1816 */
1817function show_hideElement(element_id, trigerer_el)
1818{
1819    // tu dostaje tylko id stąd ten hush
1820    element_id = '#' + element_id;
1821
1822    jQuery(element_id).slideToggle('1000', "swing");
1823
1824    if (trigerer_el)
1825        jQuery(trigerer_el).toggleClass('sel');
1826
1827    return false;
1828}
1829
1830/**
1831 * funkcja zaznaczajaca odpowiednie pozycje w menu modulowym. Wazne, zeby pierwszym (zerowym) elementtem levels bylo 0.
1832 * @param {type} hash_id
1833 * @param {type} levels
1834 * @returns {undefined}
1835 */
1836function highlight_menu_item(hash_id, levels)
1837{
1838    
1839    jQuery.each(levels, function (index, value) {
1840        if (value != 0)
1841        {
1842            var el_id = 'level-' + index + '-' + hash_id + '-' + value;
1843
1844            jQuery('#' + el_id).addClass('select');
1845
1846            jQuery('#' + el_id + ' > span.menu-toggler').addClass('sel');
1847
1848            var wrapper_id = 'level-' + (index + 1) + '-' + hash_id + '-wrapper-' + value;
1849
1850            // console.log(jQuery('#'+wrapper_id)[0]);
1851            if (jQuery('#' + wrapper_id)[0])
1852                show_hideElement(wrapper_id);
1853        }
1854    });
1855}
1856
1857function mainMenuTogglePosition(element)
1858{
1859    jQuery(element).parent().toggleClass('active');
1860}
1861
1862
1863var extraMenuHeight = 0;
1864var wyrownajAdjustBoxesRun = false;
1865
1866function wyrownajMenu(li_a) {
1867    
1868    var css_active = jQuery('#css-active').height() > 0;
1869    if(!css_active) return;
1870    
1871	//debugger;
1872	
1873	//	return jeśli menu jest prostą listą
1874	if (jQuery('ul.mainMenu').hasClass('simplified')) return 0;
1875	
1876    var li_pos = jQuery(li_a).closest('li');
1877    var subBlockMenu = jQuery(li_pos).closest('.sub-block-menu');
1878	if (jQuery(li_a).hasClass('menu-level-1')){
1879		subBlockMenu = jQuery('.sub-block-menu', li_pos);
1880	}
1881	
1882    if (subBlockMenu.parent().hasClass("active")) {
1883	 
1884        return;
1885    }
1886
1887    jQuery(subBlockMenu).height('auto');
1888	jQuery('.level-1 > .extra-box > div > .zajawka', subBlockMenu).css('max-height','none');
1889	
1890	var subBlockMenuPadding = {top: parseInt(jQuery(subBlockMenu).css('padding-top')), bottom: parseInt(jQuery(subBlockMenu).css('padding-bottom')), borderTop: parseInt(jQuery(subBlockMenu).css('border-top-width')), borderBottom: parseInt(jQuery(subBlockMenu).css('border-bottom-width')) };
1891	
1892	
1893	//	------------------------------
1894	//	lewa część
1895	
1896    var left = jQuery('> .level-1-wrapper', subBlockMenu);
1897    var leftTop = 0;
1898    if (left.length > 0) {
1899        leftTop = jQuery(left).position().top;
1900	}
1901    var leftH = jQuery(left).outerHeight(true);
1902									
1903
1904	
1905	//	------------------------------------
1906	//	prawa część
1907	
1908	//	#1 - belka pozioma item:hover
1909    var r1 = null;
1910    var r1H = 0;
1911	var r1IH = 0;
1912    var r1Top = 0;
1913	if (jQuery(li_a).hasClass('menu-level-1')){
1914		r1 = jQuery('.extra-content .extra-box', li_pos);
1915									   
1916		r1IH = jQuery('> .zajawka',r1).outerHeight(true);
1917		r1H = Math.max( r1H, r1IH );
1918        r1Top = jQuery(r1).parent().position().top;
1919	}
1920	
1921	
1922 
1923	//	#2	- lewe menu - pierwszy poziom w drzewku - link  ma tu klasę lvl2
1924	//		- zajawka (od poziomu lvl2) hover
1925	var r2 = null;
1926	var r2H = 0;
1927	var r2Top = 0;
1928	if ( (jQuery(li_a).hasClass('menu-level-2')) ||
1929		(jQuery(li_a).parent().hasClass('zajawka')) ) {
1930		r2 = jQuery('> .extra-box > div',li_pos);
1931				
1932		//	jeśli mamy zajawkę w tiled list trzeba zmienić r2
1933		if (r2.length <= 0) {
1934			r2 = jQuery('> .menu-extra-zaj', li_pos);
1935		}
1936		r2HH = jQuery(r2).outerHeight(false);
1937		try {
1938			r2Top = jQuery(r2).parent().position().top;
1939		} catch (err){}
1940		//	wysokość wewnętrznych elementów
1941		var r2I = jQuery('> .zajawka',r2);
1942		var r2ITop = r2I.position().top;
1943		var r2IOuterH = r2I.outerHeight(true);
1944		var r2IH = r2ITop + r2IOuterH;
1945																																														
1946				
1947
1948		r2H = Math.max(r2HH,r2IH);
1949	}
1950	
1951	//	#4	- zajawka menu - tiled-list item hover
1952	var r4 = null;
1953	var r4H = 0;
1954	var r4Top = 0;
1955	if (jQuery(li_pos).hasClass('tile-wrapper')){
1956		r4 = jQuery('> .menu-extra-zaj',li_pos);
1957		jQuery('.level-1 > .extra-box > div > .zajawka', subBlockMenu).css('max-height','0px');
1958		if (r4.length <= 0) {
1959			r4 = jQuery('.level-1 > .extra-box > div > .zajawka', subBlockMenu);
1960			jQuery('.level-1 > .extra-box > div > .zajawka', subBlockMenu).css('max-height','');
1961		}
1962		r4H = jQuery(r4).outerHeight(true);
1963        r4Top = jQuery(r4).position().top + jQuery(r4).closest('.extra-box').position().top;
1964	}
1965	
1966	//	#5 - elementy dynamiczne - aktualności / kalendarz / galerie
1967	var r5 = null;
1968	var r5H = 0;
1969	var r5Top = 0;
1970	
1971	if (jQuery('section.component, .kali_harmonogramtydzien',li_pos).length > 0){
1972		r5 = jQuery('.extra-content',li_pos);
1973		r5H = jQuery(r5).outerHeight(true);
1974		r5H += 5;
1975	}
1976	
1977// #6 - Level 2
1978	var r6 = null;
1979	var r6H = 0;
1980	var r6Top = 0;
1981	if ( (jQuery(li_a).hasClass('menu-level-3')) ||
1982		(jQuery(li_a).parent().hasClass('zajawka')) ) {
1983		r6 = jQuery('> .extra-box > div',li_pos);
1984		
1985		//	jeśli mamy zajawkę w tiled list trzeba zmienić r2
1986		if (r6.length <= 0) {
1987			r6 = jQuery('> .menu-extra-zaj', li_pos);
1988		}
1989		r6H = jQuery(r6).outerHeight(true);
1990        r6Top = jQuery(r6).parent().position().top;
1991		
1992		//	wysokość wewnętrznych elementów
1993		var r6I = jQuery('> .zajawka',r6);
1994		var r6IH = r6I.position().top + r6I.outerHeight(true);
1995		r6H = Math.max(r6H,r6IH);
1996	}
1997	
1998
1999	//	Podsumowanie pomiarów
2000	
2001    var left = leftH + leftTop;
2002    var right1 = r1H + r1Top;
2003    var right2 = r2H + r2Top;
2004    //var right3 = r3H + r3Top;
2005	var right4 = r4H + r4Top;
2006	var right6 = r6H + r6Top;
2007	var right5 = r5H + r5Top;
2008						  
2009
2010 
2011    var maxH = Math.max(left, right1, right2, right4, right5, right6) + extraMenuHeight;
2012	maxH += subBlockMenuPadding.bottom;
2013	maxH += subBlockMenuPadding.borderTop;
2014	maxH += subBlockMenuPadding.borderBottom;
2015	
2016    
2017	//	stosujemy wyliczone wielkości
2018	if (r1 && !r5) {
2019		 wyrownajMenu2(li_a);
2020	}
2021	else if (r5) {
2022		adjustBoxes();
2023		setZajawkiHeight();
2024										  
2025	
2026		setTimeout(function(){
2027			if (jQuery('section.component, .kali_harmonogramtydzien',li_pos).length > 0){
2028				r5 = jQuery('.extra-content',li_pos);
2029				r5H = jQuery(r5).outerHeight(true);
2030				r5H += 5;
2031			}
2032			right5 = r5H + r5Top;
2033			maxH = Math.max(left, right1, right2, right4, right5) + extraMenuHeight + 18;
2034			subBlockMenu.css({height: maxH});
2035		},0);
2036	} else {
2037		subBlockMenu.css({height: maxH});
2038	};
2039}
2040
2041function wyrownajMenu2(lia) {
2042    var ul1 = jQuery(lia).parent().find('ul.level-1-wrapper');
2043    var subBlockMenu = jQuery(ul1).closest('.sub-block-menu');
2044
2045    if (subBlockMenu.parent().hasClass("active")) {
2046	 
2047        return;
2048    }
2049	
2050	subBlockMenu.css({height: 'auto'});
2051	if (extraMenuHeight) {
2052		subBlockMenu.css({height: subBlockMenu.outerHeight(true)+extraMenuHeight});
2053	}
2054}
2055
2056
2057/*	**********************************************
2058 *	get viewport sizes (x = width, y = height)
2059 *	rozmiar ekranu
2060 */
2061var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0];
2062var x,y = null;    
2063//	get current viewport size
2064var getViewPortSize = function()
2065{
2066	    x=w.innerWidth||e.clientWidth||g.clientWidth,y=w.innerHeight||e.clientHeight||g.clientHeight;
2067}
2068getViewPortSize();
2069
2070
2071
2072/*	**********************************************
2073 **	karuzela dla boxów z wieloma elementami
2074 
2075 var karuzelaBox = function( 
2076 $,					//	przekazanie jQuery do funkcji dla wygody podczas pisania i braku konfliktu ze znakiem $ używanym w s@m3 przez prototype
2077 wrapperSelector,	//	string - selektor css dla całego elementu instancji karuzeli (takie np. 'section')
2078 containerSelector,	//	string - selektor css dla listy bezpośrednio zawierającej elementy do przesuwania
2079 elementSelector,	//	string - selektor css dla elementów do przesuwania
2080 options				//	obiekt - opcje konfiguracyjne
2081 );
2082 
2083 //	opcje konfiguracyjne - wartości domyślne wstawiane w przypadku ich 
2084 options.slideshowDelay = 0;					//	czas między auto zmianami (0 by wyłączyć)
2085 options.slideshowMouseleaveDelay = 2000;	//	dodatkowa przerwa op opuszczeniu containera przed uruchomieniem timera
2086 options.rowsPerPage = 1;					//	ilość rzędów na stronę
2087 options.navigationArrows = true;			//	strzałki
2088 options.navigationPager = false;			//	pager
2089 options.navigationSwipe = true;				//	gesty dla mobilnych on / off
2090 
2091 UWAGI:
2092 -	Karuzela zawiera na sztywno zakodowane uruchamianie resizea dla boxu z galeriami (ze względu na to że najnowsze i popularne są od razu ładowane na starcie ale z display:none - psuje to ustawianie wymiarów)
2093 -	Na chwilę obecną brak pagera
2094 -	Wewnątrz jest jedno odwołanie do globalnego dla s@m3 jQuery (nie koniecznie tego przekazywanego funkcji gdzie ja preferuję jQuery 3 dostępne pod zmienną $jq3) - dlatego że dla tej wersji jest zdefiniowane debounce i throttle
2095 
2096 **	**********************************************	*/
2097
2098var karuzelaBox = function ($, wrapperSelector, containerSelector, elementSelector, options) {
2099    //console.log('karuzelaBox');
2100	getViewPortSize();
2101	if (x  < 1210) return 0;
2102	
2103    if (typeof (globalPause) == 'undefined')
2104        globalPause = false;
2105
2106    // wstawianie domyslnych opcji
2107    if (typeof (options.slideshowDelay) == 'undefined')
2108        options.slideshowDelay = 0;
2109    if (typeof (options.slideshowMouseleaveDelay) == 'undefined')
2110        options.slideshowMouseleaveDelay = 2000;
2111    if (typeof (options.rowsPerPage) == 'undefined')
2112        options.rowsPerPage = 1;
2113    if (typeof (options.navigationArrows) == 'undefined')
2114        options.navigationArrows = true;
2115    if (typeof (options.navigationPager) == 'undefined')
2116        options.navigationPager = false;
2117    if (typeof (options.navigationSwipe) == 'undefined')
2118        options.navigationSwipe = true;
2119	
2120    //	deklaracje
2121    var $wrapper = $(wrapperSelector).addClass('karuzela-box');
2122    var $container = $(containerSelector,$wrapper);
2123
2124    //$('.filler', $wrapper).remove();
2125	
2126    var els = $(elementSelector, $container).addClass('karuzela-box-el');
2127    var pages = 0;
2128    var currentPage = 0;
2129    var containerW = 0;
2130    var $prev = null;
2131    var $next = null;
2132    var slideshowTimer = null;
2133    var slideshowDelayTimeout = null;
2134
2135
2136    function buildPages(rowsPerPage) {
2137        //	resetujemy pozycje
2138        $container.css({opacity: 0});
2139        $(elementSelector, $container).css({
2140            position: 'initial',
2141            left: 'initial',
2142            transition: 'none'
2143        });
2144        setTimeout(function () {
2145            $(elementSelector, $container).css({
2146                transform: 'translate3d(0,0,0)'
2147            });
2148
2149            $(elementSelector, $container).attr('data-page', 0).attr('data-row', 0);
2150            pages = 0;
2151            containerW = $container.width();
2152            currentPage = 0;
2153
2154            if (options.navigationArrows) {
2155                $next.removeClass('disabled');
2156                $prev.addClass('disabled');
2157            }
2158
2159            //	local vars
2160            var elH = $(els[0]).height();
2161            var maxRowsOnPage = 0;
2162
2163            var rowsOnPage = 0;
2164            var lastPositionTop = 0;
2165            if ($(els[0]) && $(els[0]).position()) {
2166                lastPositionTop = $(els[0]).position().top;
2167            }
2168            var rowHeight = 0;
2169            var maxRowHeight = 0;
2170            var pageHeight = 0;
2171            var maxPageHeight = 0;
2172
2173            //	dzielę na strony, ustawiam odpowiednie pozycje
2174            $.each(els, function (i, el) {
2175                //	sprawdzam czy jest w tym samym czy nowym rzędzie
2176                if ($(el).position().top != lastPositionTop) {
2177                    rowsOnPage++;
2178                }
2179                //	sprawdzam czy rząd mieści się w limicie rzędów na stronie
2180                if (rowsOnPage >= rowsPerPage) {
2181                    pages++;
2182                    rowsOnPage = 0;
2183                }
2184                if (rowsOnPage > maxRowsOnPage)
2185                    maxRowsOnPage = rowsOnPage;
2186                lastPositionTop = $(el).position().top;
2187                //	przypisuję nukmer rzędu i strony oraz wartość css top i left
2188                $(el).attr('data-page', pages).attr('data-row', rowsOnPage);
2189                $(el).css({
2190                    top: rowsOnPage * elH,
2191                    left: $(el).position().left
2192                });
2193
2194                $(el).css({transform: 'translate3d(' + pages * containerW + 'px,0,0)'});
2195            });
2196            $(elementSelector, $container).css({position: 'absolute'});
2197
2198            //	ustalam wysokość containera
2199            $container.css({
2200                height: (maxRowsOnPage + 1) * elH,
2201                overflow: 'hidden'
2202            });
2203            fixGalHeight();	//	fix dla boxu galerie
2204            //	korekta statusu strzałek nawigacyjnych
2205            if (pages == 0) {
2206                $next.addClass('disabled');
2207            }
2208
2209            $(elementSelector, $container).css({
2210                transition: 'transform .3s'
2211            });
2212            $container.delay(100).animate({opacity: 1}, 500);
2213			
2214			
2215			addNavigationPager();
2216        }, 0);
2217    }
2218
2219    //	dodaję nawigację
2220    function addNavigation() {
2221        //	navigationArrows
2222
2223        if (options.navigationArrows) {
2224            $container.after('<div class="nav nav-arrows aria-hidden="true" karuzela-box"><div class="nav-arrow prev">PREV</div><div class="nav-arrow next">NEXT</div></div>');
2225            
2226            //console.log($container);
2227            
2228            $prev = $('.nav-arrow.prev', $wrapper);
2229            $next = $('.nav-arrow.next', $wrapper);
2230			$prev.click(showPrevPage);
2231            $next.click(showNextPage);
2232        }
2233        //	urządzenia mobilne
2234        if (options.navigationSwipe) {
2235            $container.each(function () {
2236                mc = new Hammer(this);
2237                mc.on('swipeleft swiperight', function (e) {
2238
2239                    switch (e.type) {
2240                        case 'swipeleft':
2241                            showNextPage();
2242                            break;
2243
2244                        case 'swiperight':
2245                            showPrevPage();
2246                            break;
2247                    }
2248                });
2249            });
2250        }
2251        
2252
2253        //	slideshow
2254        if (options.slideshowDelay != 0) {
2255            timer.start();
2256            $wrapper.on('mouseleave focusout', timer.start);
2257            $wrapper.on('mouseenter focusin', timer.stop);
2258        }
2259
2260        //	nawigacja przez TAB
2261        $(elementSelector, $wrapper).on('focusin', function () {
2262            $container.scrollLeft(0);
2263            var targetPage = $(this).attr('data-page');
2264            showPage(targetPage);
2265        });
2266        //	przypadek dla karuzeli polecane
2267        $('li > div > a', $wrapper).on('focusin', function () {
2268            $container.scrollLeft(0);
2269            var targetPage = $(this).closest('li').attr('data-page');
2270            showPage(targetPage);
2271        });
2272    }
2273	
2274	//	pager
2275	function addNavigationPager() {
2276		if (!options.navigationPager) return 0;
2277			
2278		$pager = $('<span class="nav nav-pager pager karuzela-box-pager" style="z-index:100;"></span>');
2279		$container.after($pager);
2280		for (var i=0; i<=pages; i++){
2281			$pager.append('<div class="pager-button page-'+i+'" data-page="'+i+'" style="width:30px; height:30px; float:left; background:green; margin-right:20px;"></div>');
2282		}
2283		$('.pager-button.page-'+currentPage,$wrapper).addClass('active');
2284		$('.pager-button',$wrapper).on('click',function(){
2285			var tar = $(this).data('page');
2286			if (tar === currentPage) return;
2287			showPage(tar);
2288		});
2289	}
2290
2291
2292    var timer = {};
2293    timer.start = function () {
2294        timer.stop();
2295        slideshowDelayTimeout = setTimeout(function () {
2296            clearInterval(slideshowTimer);
2297            slideshowTimer = setInterval(timerChangePage, options.slideshowDelay);
2298        }, options.slideshowMouseleaveDelay);
2299    }
2300    timer.stop = function () {
2301        clearTimeout(slideshowDelayTimeout);
2302        clearInterval(slideshowTimer);
2303    }
2304    timer.reset = function () {
2305        timer.stop();
2306        timer.start();
2307    }
2308
2309
2310
2311    function showPrevPage() {
2312        if (currentPage > 0) {
2313            currentPage--;
2314            showPage(currentPage);
2315        }
2316    }
2317    function showNextPage() {
2318        if (currentPage < (pages)) {
2319            currentPage++;
2320            showPage(currentPage);
2321        }
2322    }
2323    function showPage(targetPage) {
2324        $.each(els, function (i, el) {
2325            pageNumberOffset = $(el).attr('data-page') - targetPage;
2326            $(el).css({transform: 'translate3d(' + pageNumberOffset * containerW + 'px,0,0)'});
2327        });
2328        currentPage = targetPage;
2329		
2330		if (options.navigationPager) {
2331			$('.pager-button',$wrapper).removeClass('active');
2332			$('.pager-button.page-'+currentPage,$wrapper).addClass('active');
2333		}
2334		
2335
2336        $prev.removeClass('disabled');
2337        $next.removeClass('disabled');
2338        if (currentPage == 0) {
2339            $prev.addClass('disabled');
2340        }
2341        if (currentPage == (pages)) {
2342            $next.addClass('disabled');
2343        }
2344    }
2345    function timerChangePage() {
2346        //cc('timerChangePage',containerSelector);
2347        if (!globalPause) {
2348            currentPage++;
2349            //cc('targetPage',currentPage);
2350            if (currentPage > pages)
2351                currentPage = 0;
2352            showPage(currentPage);
2353        }
2354    }
2355
2356
2357
2358    function resize() {
2359        buildPages(options.rowsPerPage);
2360    }
2361
2362    addNavigation();
2363	
2364	
2365    resize();
2366    showPage(currentPage)
2367    $(window).resize(jQuery.debounce(250, resize));
2368
2369
2370    //	dla boxu galerie - przełączanie NAJNOWSZE POPULARNE
2371    var fixGalHeight = function () {};
2372    if (wrapperSelector.indexOf('tab-container-3') >= 0) {
2373
2374        //	ustawiamy wysokość obydwu containerów na starcie
2375        fixGalHeight = function () {
2376            var galConMaxH = 0;
2377            $('#tab-container-3 .icons').each(function (i, el) {
2378                if ($(el).height() > galConMaxH)
2379                    galConMaxH = $(el).height();
2380            });
2381            $('.icons', $wrapper).css({height: galConMaxH});
2382        }
2383
2384        function changeGalTab() {
2385            timer.stop();
2386            $container.css({opacity: 0});
2387            var thisTab = $(this).attr('href');
2388            if (containerSelector.indexOf(thisTab) >= 0) {
2389                $container.css({opacity: 0});
2390                resize();
2391                $container.delay(100).animate({opacity: 1}, 500);
2392                timer.start();
2393            }
2394        }
2395        $('#tab-container-3-nav li a').click(changeGalTab);
2396        $('#tab-container-3-nav li a').keypress(function (e) {
2397            if (e.keyCode == 13) {	//ENTER
2398                changeGalTab();
2399            }
2400        });
2401    }
2402}
2403
2404/*	****************************************
2405//	SECRET TOOLS :)
2406//	otwieranie admina poprzez skrót klawiaturowy   CTRL + SHIFT + A A
2407//	v. 1.0
2408//	ostatnia modyfikacja: 2018-10-12
2409//	****************************************	*/
2410function sam3QuickAdmin($){
2411	//console.log('sam3QuickAdmin()');
2412	var comboMaxTime = 1000;
2413	$(document).on('keypress',checkForCombo);
2414	var combo = {counter:0, timeout:null};
2415	function checkForCombo(e) {
2416		//	CTRL + (A A A A)
2417		var charCode = 1;	// 1 - A (ctrl + shift + A)
2418		if ( e.charCode === charCode ) {
2419			if (combo.timeout) {
2420				combo.counter ++;
2421				if (combo.counter >= 2) {
2422					comboSuccess();
2423				}
2424			}
2425			else {
2426				startComboTimeout();
2427			}
2428		}
2429	}
2430	
2431	function comboSuccess() {
2432		clearComboTimeout();
2433		var loc = window.location;
2434		var target = loc.protocol + '//' + loc.hostname;
2435		if (loc.href.indexOf('admin.php') >= 0){
2436			target += '/index.php';
2437		}
2438		else if (loc.href.indexOf('admin_dev.php') >= 0) {
2439			target += '/index_dev.php';
2440		}
2441		else if (loc.href.indexOf('index_dev.php') >= 0) {
2442			target += '/admin_dev.php';
2443		}
2444		else {
2445			target += '/admin.php';
2446		}
2447		window.open(target,'_blank');
2448	}
2449	function startComboTimeout(){
2450		combo.counter = 0;
2451		combo.timeout = setTimeout(clearComboTimeout,comboMaxTime);
2452		combo.counter ++;
2453	}
2454	function clearComboTimeout(){
2455		clearTimeout(combo.timeout);
2456		combo.timeout = null;
2457		combo.counter = 0;
2458	}
2459}
2460jQuery(document).ready(function () {
2461	sam3QuickAdmin(jQuery);
2462});
2463
2464
2465/*	**********************************************
2466 **	iFrame loader
2467 ładuje zawartość Iframeu w div - coś jak fancy box ale nie wymaga wczytania całej zawartości
2468 **	**********************************************	*/
2469closeIFrame = null;
2470function conceptIFrameLauncher($, els, options) {
2471    cc('conceptIFrameLauncher');
2472
2473    if (typeof options.boxOpenSpeed == 'undefined')
2474        options.boxOpenSpeed = 300;
2475
2476    var $box,
2477            $iframe;
2478    var eDiemensions;
2479
2480    $.each(els, function (i, el) {
2481        $(el).click(function (e) {
2482            e.preventDefault();
2483
2484            //	tworzymy container dla flipbooka
2485            $e = $(e.target).closest('a');
2486            href = $e.attr('href');
2487
2488            var wScroll = $(window).scrollTop();
2489            eDiemensions = {x1: $e.offset().left, x2: $e.offset().left + $e.width(), width: $e.width(), y1: $e.offset().top - wScroll, y2: $e.offset().top - wScroll + $e.height(), height: $e.height()};
2490
2491            $box = $('<div class="flipbook-box" style="position:fixed;left:' + eDiemensions.x1 + 'px;top:' + eDiemensions.y1 + 'px;width:' + eDiemensions.width + 'px;height:' + eDiemensions.height + 'px;background:#222;z-index:9999;opacity:0.4;transform:translate3d(0,0,1px);transition: all ' + options.boxOpenSpeed / 1000 + 's;"></div>');
2492            $('body').append($box);
2493
2494            setTimeout(function () {
2495                $box.css({
2496                    top: 0,
2497                    left: 0,
2498                    width: '100%',
2499                    height: '100%',
2500                    opacity: 1
2501                });
2502            }, 1);
2503            setTimeout(function () {
2504                $('body, html').addClass('flipbook-opened');
2505            }, options.boxOpenSpeed - 30);
2506            //	wkładam iFramea
2507            setTimeout(function () {
2508                $iframe = $('<iframe src="' + href + '" class="flipbook-iframe" frameborder="0" style="padding:0;margin:0;width:100%;height:100%"></iframe>');
2509                $iframe.append('<div class="close-iframe button">close</div>');
2510                $box.append($iframe);
2511            }, options.boxOpenSpeed);
2512
2513
2514
2515
2516
2517
2518            console.log(href);
2519        });
2520    });
2521
2522    closeIFrame = function (iframeSelector) {
2523        $(iframeSelector).animate({opacity: 0}, options.boxOpenSpeed / 3, function () {
2524            $(iframeSelector).remove();
2525            $box.css({
2526                top: eDiemensions.y1,
2527                left: eDiemensions.x1,
2528                width: eDiemensions.width,
2529                height: eDiemensions.height,
2530                opacity: 0
2531            });
2532            //$box.delay(options.boxOpenSpeed).animate({opacity:0}
2532,options.boxOpenSpeed,
2533            $box.delay(options.boxOpenSpeed).animate({opacity: 0}, 0,
2534                    function () {
2535                        $box.remove()
2536                    }
2537            );
2538            setTimeout(function () {
2539                $('body,html').removeClass('flipbook-opened');
2540            }, 30);
2541        });
2542    }
2543}
2544
2545
2546
2547jQuery(document).ready(function () {
2548
2549    var entries = [];
2550
2551    jQuery.each(jQuery('#sfWebDebugDatabaseLogs ol li'), function (index, value) {
2552        var el = jQuery(value);
2553
2554        el.css('padding', '5px 0 5px 0').css('lineHeight', '150%').css('fontFamily', 'verdana');
2555        el.html(el.html().replace('SELECT', '<b>SELECT</b>'));
2556        el.html(el.html().replace(' FROM ', '<br/>&nbsp;&nbsp;&nbsp;&nbsp;<b>FROM</b> '));
2557        el.html(el.html().replace(' WHERE ', '<br/>&nbsp;&nbsp;&nbsp;&nbsp;<b>WHERE</b> '));
2558        el.html(el.html().replace(' ORDER BY ', '<br/>&nbsp;&nbsp;&nbsp;&nbsp;<b>ORDER BY</b> '));
2559        el.html(el.html().replace(' LIMIT ', '<br/>&nbsp;&nbsp;&nbsp;&nbsp;<b>LIMIT</b> '));
2560        el.html(el.html().replace(' OFFSET ', ' <b>OFFSET</b> '));
2561        el.html(el.html().replace(new RegExp(/ (DISTINCT) /, 'g'), ' <b>\$1</b> '));
2562        el.html(el.html().replace(new RegExp(/ (CROSS) /, 'g'), '<br/>&nbsp;&nbsp;&nbsp;&nbsp;<b style="color: red;">\$1</b> '));
2563        el.html(el.html().replace(new RegExp(/ (INNER) /, 'g'), '<br/>&nbsp;&nbsp;&nbsp;&nbsp;<b>\$1</b> '));
2564        el.html(el.html().replace(new RegExp(/ (LEFT) /, 'g'), '<br/>&nbsp;&nbsp;&nbsp;&nbsp;<b>\$1</b> '));
2565        el.html(el.html().replace(new RegExp(/ (RIGHT) /, 'g'), '<br/>&nbsp;&nbsp;&nbsp;&nbsp;<b>\$1</b> '));
2566        el.html(el.html().replace(new RegExp(/ (JOIN) /, 'g'), ' <b>\$1</b> '));
2567        el.html(el.html().replace(new RegExp(/ (ON) /, 'g'), ' <b>\$1</b> '));
2568        el.html(el.html().replace(new RegExp(/ (AND) /, 'g'), ' <b>\$1</b> '));
2569        el.html(el.html().replace(new RegExp(/ (OR) /, 'g'), ' <b>\$1</b> '));
2570        el.html(el.html().replace(new RegExp(/ (ASC)/, 'g'), ' <b>\$1</b>'));
2571        el.html(el.html().replace(new RegExp(/ (DESC)/, 'g'), ' <b>\$1</b>'));
2572        el.html(el.html().replace(new RegExp(/`([a-zA-Z0-9_]+)`/, 'g'), '<span style="background-color: lightyellow; padding: 2px 3px; display: inline-block;">`\$1`</span>'));
2573
2574        if (entries.indexOf(el.html()) != -1)
2575        {
2576            el.html(el.html() + '<br/>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color: red; background-color: lightyellow; border: 2px solid red; padding: 3px 5px; margin: 5px 0 10px;font-weight: bold;">DUPLIKAT!</span>');
2577        } else
2578        {
2579            entries.push(el.html());
2580        }
2581    });
2582});
2583
2584// galerie wstrzykiwane
2585function gallery_inject(prefix) {
2586//        return 0;
2587    var myimg = document.getElementsByClassName('concept-gallery-properties');
2588    var insertion = new Array(myimg.length);
2589    //console.log('myimg');
2590    //console.log(myimg);
2591    var insertion_options = new Array(myimg.length);
2592
2593
2594    var host = location.origin;
2595    //document.write(host);
2596    var ajax_params = {};
2597
2598    if (host == 'http://wave.webaim.org')
2599    {
2600        return; // galerie wstrzykiwane nie zadzialaja przez posrednika (Cross domain content)
2601    }
2602
2603    for (i = 0; i < myimg.length; i++) {
2604        
2605        var img_params = myimg[i].getAttribute("data-mce-params").split(";");
2606        var params = {};
2607        jQuery.each(img_params, function (key, value) {
2608            var temp = value.split(":");
2609            params[temp[0]] = temp[1];
2610        });
2611
2612        ajax_params[params.gallery + params.salt] = params;
2613		//Wyciagamy ajaxem niezbędne informacje o galerii
2614		
2615		if(params['preview'] == '1'){
2616			var ajax_url = host + '/galerie/ajaxGetPhotosForGallery/gid/' + params.gallery + '/salt/' + params.salt + '/key/' + Math.floor((Math.random() * 10) + 1) + '/preview/true.html';
2617		} else {
2618			var ajax_url = host + '/galerie/ajaxGetPhotosForGallery/gid/' + params.gallery + '/salt/' + params.salt + '/key/' + Math.floor((Math.random() * 10) + 1) + '.html';
2619		}
2620        
2621        var gallery_info = '';
2622
2623
2624        jQuery.ajax({
2625            url: ajax_url,
2626            beforeSend: function () {
2627                var ajax_loader = $('#wait');
2628                if (ajax_loader) {
2629                    ajax_loader.show();
2630                }
2631            },
2632        }).complete(function (response) {
2633            if (response.status === 200) {
2634                var ajax_loader = $('#wait');
2635                if (ajax_loader) {
2636                    ajax_loader.hide();
2637                }
2638                gallery_info = response.responseText;
2639                var gallery_info_arr = gallery_info.split("||");
2640
2641                var ajax_gallery_id = gallery_info_arr[0];
2642                var ajax_gallery_salt = gallery_info_arr[1];
2643                var ajax_gallery_text = gallery_info_arr[2];
2644
2645                // tylko po to by mozna było zaladować tą sama galerię dwa razy z innymi ustawieniami
2646                var ajax_gallery_object_id = ajax_gallery_id + ajax_gallery_salt;
2647                
2648
2649                if (ajax_gallery_text) {
2650                    var options = new Object();
2651                    options.type = ajax_params[ajax_gallery_object_id].type; // sposób wyświetlenia galerii
2652                    options.rowLimit = ajax_params[ajax_gallery_object_id].rowLimit; // liczba rzędów miniaturek
2653                    options.thumbWidth = ajax_params[ajax_gallery_object_id].thumbWidth; //wysokość miniaturki
2654                    options.thumbHeight = ajax_params[ajax_gallery_object_id].thumbHeight; //szerokość miniaturki
2655                    options.alignThumbnails = ajax_params[ajax_gallery_object_id].alignThumbnails; //wyświetla tytuł galerii
2656                    options.inlineSlideshowPhotoFormat = ajax_params[ajax_gallery_object_id].inlineSlideshowPhotoFormat; //wyświetla proporcje zdjęcia
2657                    options.thumbnailTitles = ajax_params[ajax_gallery_object_id].thumbnailTitles; //wyświetla tytuł galerii
2658                    options.showGalleryTitle = (ajax_params[ajax_gallery_object_id].inj_gal_gname == "true" ? true : false);	//wyświetla tytuł galerii
2659                    options.showGalleryDescription = (ajax_params[ajax_gallery_object_id].inj_gal_fname == "true" ? true : false);	//wyświetla opis galerii
2660                    options.slideshowTime = parseInt(ajax_params[ajax_gallery_object_id].inj_slideshow_time) * 1000; //czas prezentacji zdjęcia
2661                    options.slideshowStart = (ajax_params[ajax_gallery_object_id].inj_slideshow_start == "true" ? true : false); //automatyczne uruchomienie pokazu
2662                    options.buttonInactiveColor = "#dddddd";
2663                    options.buttonActiveColor = "#000000";
2664                    options.buttonHoverColor = "#888888";
2665                    options.buttonInactiveFsColor = "#eeeeee"
2666                    options.buttonActiveFsColor = "#000000";
2667                    options.buttonHoverFsColor = "#888888";
2668                    options.backgroundOpacity = "0.8";
2669                    options.interfaceImagesPath = "/images-design/";
2670                    options.timThumbPath = '/tools/timthumb.php';
2671                    options.imagesPath = host + '/images/';
2672                    options.loaderUrl = '/images-design/thumb-loader.gif';
2673                    options.allowLargeView = true; //czy można powiększać miniaturki (jeśli false wstawione będą tylko kafelki)
2674                    options.startInFullMode = true;
2675                    options.allowFullMode = false;
2676                    options.alignThumbnailsFillExtraQuality = 3; //ile razy większe miniaturki przygotować, by następnie po powiększeniu ich w trybie FILL wyglądały lepiej
2677                    options.thumbnailPrefix = prefix; //wielkosc (prefix) miniatur
2678
2679                    insertion_options['g_' + ajax_gallery_id + '_' + ajax_gallery_salt] = options;
2680                    insertion['g_' + ajax_gallery_id + '_' + ajax_gallery_salt] = '<div class="config" style="display: none;">' + ajax_gallery_text + '</div>';
2681
2682                    document.getElementById('g_' + ajax_gallery_id + '_' + ajax_gallery_salt).innerHTML = document.getElementById('g_' + ajax_gallery_id + '_' + ajax_gallery_salt).innerHTML + '<div class="config" style="display: none;">' + ajax_gallery_text + '</div>';
2683                    //jQuery('ul.preloaded-photos').remove();
2684                    runConceptGallery("#" + 'g_' + ajax_gallery_id + '_' + ajax_gallery_salt, options, $jq3);
2685                } else {
2686                    //brak zdjęc w galerii - chowamy grafikę pomocniczą!
2687                    document.getElementById('g_' + ajax_gallery_id + '_' + ajax_gallery_salt).innerHTML = '';
2688                }
2689            } else {
2690                alert('Błąd: ' + response.status + ' ' + response.statusText)
2691            }
2692        });
2693    }
2694}
2695;
2696
2697/*
2698 *  MS - funkcje z portal.php
2699 */
2700// żałoba
2701function bwmode(obj) {
2702    return obj;
2703}
2704;
2705
2706// exec array
2707function isFunction(functionToCheck) {
2708    var getType = {};
2709    return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
2710}
2711
2712// scroll-top
2713var window_height = jQuery(window).height();
2714var offset = window_height * 0.7;
2715var position;
2716var button = jQuery(".scroll-top");
2717
2718function button_toggle()
2719{
2720    position = jQuery(this).scrollTop();
2721    if (position > offset) {
2722        jQuery(button).fadeIn("slow", function ()
2723        {
2724            button.show();
2725        });
2726    } else {
2727        jQuery(button).fadeOut("slow", function ()
2728        {
2729            button.hide();
2730        });
2731    }
2732}
2733
2734function ShowHideZampSearch(txtc, txto) {
2735
2736    var fs = document.getElementById('zamp_szuk');
2737    var rl = document.getElementById('zampSearch');
2738    if (rl && fs) {
2739        if (fs.style.display == 'none') {
2740            rl.title = txtc;
2741            sCookie('zamowienia_search', true, 0);
2742            wcagstinks(fs);
2743        } else {
2744            rl.title = txto;
2745            sCookie('zamowienia_search', '', -1);
2746        }
2747    }
2748    jQuery(fs).slideToggle('1000', "swing");
2749}
2750
2751/* przeniesione z pliku portal.php - bo sie powtarza we wszystkich sitach */
2752function setZajawkiHeight(){				
2753    jQuery.each(jQuery(".zaj-wrapper > .zajawka"), function(i, el) {
2754        jQuery('a',el).css('height','auto');
2755        setTimeout(function(){
2756            var height;
2757            var blockLeftHight = 0;
2758            var blockRightTitleHight = 0;
2759			
2760			if ($(el).hasClass('in-column')) {
2761				blockLeftHight = jQuery('.box-left',el).outerHeight(true);
2762				blockRightTitleHight = jQuery('.box-right .title',el).outerHeight(true);						
2763				height =  blockLeftHight+blockRightTitleHight;					
2764				jQuery('a',el).css({height: height});
2765			} else if ($(el).hasClass('in-row')) {
2766				//	chyba niepotrzebne to jest tutaj - wysokość ustawialiśmy dla sytuacji. gdzie tekst zajawki wchodził zamiast zdjęcia
2767			}
2768        },10);
2769    });			
2770}
2771
2772/* przeniesione z pliku portal.php - bo sie powtarza we wszystkich sitach */
2773function setZajawkiHeight2(){		
2774
2775	setTimeout(function(){
2776		setZajawkiHeight()
2777	},500);
2778	
2779    jQuery.each(jQuery(".zaj-wrapper > .zajawka"), function(i, el) {
2780        jQuery('a',el).css('height','auto');
2781        setTimeout(function(){
2782            var height;
2783            var blockLeftHight = 0;
2784            var blockRightTitleHight = 0;
2785			
2786			if ($(el).hasClass('in-column')) {
2787				blockLeftHight = jQuery('.box-left',el).outerHeight(true);
2788				blockRightTitleHight = jQuery('.box-right .title',el).outerHeight(true);						
2789				height =  blockLeftHight+blockRightTitleHight;					
2790				jQuery('a',el).css({height: height});
2791			} else if ($(el).hasClass('in-row')) {
2792				//	chyba niepotrzebne to jest tutaj - wysokość ustawialiśmy dla sytuacji. gdzie tekst zajawki wchodził zamiast zdjęcia
2793			}
2794        },1000);
2795    });			
2796}
2797/*
2798 *  Funkcje potrzebne do prawidłowego tworzenia statycznych mapek z polygonem.
2799 *  Tu bo nie potrzeba do tego js'ow od mapy
2800 */
2801
2802
2803function polyObject(geometry, x, y) {
2804    var bounds = new google.maps.LatLngBounds();
2805
2806    lcValues = new Array();
2807
2808    jQuery.each(geometry, function (key, item)
2809    {
2810        lcValues[key] = new google.maps.LatLng(item.lat, item.lng);
2811    });
2812
2813    for (i = 0; i < lcValues.length; i++) {
2814        bounds.extend(lcValues[i]);
2815    }
2816
2817    var polygon = new google.maps.Polygon({
2818        path: lcValues,
2819        strokeWeight: '1',
2820        strokeColor: '#ff0000',
2821        strokeOpacity: '1',
2822        fillColor: '#ff0000',
2823        fillOpacity: '1'
2824    });
2825    
2826    let path = polygon.getPath();
2827    let center = getObjectPosition(path);
2828    
2829    let mapDim = { width: x, height: y};
2830    let zoom = getBoundsZoomLevel(bounds, mapDim);
2831    
2832    let poly = center.lat() + ','+center.lng() + '&amp;zoom=' + zoom;
2833    return poly;
2834}
2835
2836function getObjectPosition(path) {
2837    var lastPath = null;
2838    var lastCenter = null;
2839    
2840    if (lastPath == path) {
2841            return lastCenter;
2842        }
2843        lastPath = path;
2844        var bounds = new google.maps.LatLngBounds();
2845        path.forEach(function (latlng, i) {
2846            bounds.extend(latlng);
2847        });
2848
2849        lastCenter = bounds.getCenter();
2850        return lastCenter;
2851}
2852
2853
2854function getBoundsZoomLevel(bounds, mapDim) {
2855    var WORLD_DIM = { width: 256, height: 256 };
2856    var ZOOM_MAX = 21;
2857
2858    function latRad(lat) {
2859        var sin = Math.sin(lat * Math.PI / 180);
2860        var radX2 = Math.log((1 + sin) / (1 - sin)) / 2;
2861        return Math.max(Math.min(radX2, Math.PI), -Math.PI) / 2;
2862    }
2863
2864    function zoom(mapPx, worldPx, fraction) {
2865        return Math.floor(Math.log(mapPx / worldPx / fraction) / Math.LN2);
2866    }
2867
2868    var ne = bounds.getNorthEast();
2869    var sw = bounds.getSouthWest();
2870
2871    var latFraction = (latRad(ne.lat()) - latRad(sw.lat())) / Math.PI;
2872
2873    var lngDiff = ne.lng() - sw.lng();
2874    var lngFraction = ((lngDiff < 0) ? (lngDiff + 360) : lngDiff) / 360;
2875
2876    var latZoom = zoom(mapDim.height, WORLD_DIM.height, latFraction);
2877    var lngZoom = zoom(mapDim.width, WORLD_DIM.width, lngFraction);
2878
2879    return Math.min(latZoom, lngZoom, ZOOM_MAX);
2880}
2881
2882/**
2883 * Funkcja resetujaca i czyszczaca forme. 
2884 * @param myFormElement - element pokroju document.forms.identyfikator_formy
2885 */
2886function clearForm(myFormElement) {
2887
2888  var elements = myFormElement.elements;
2889
2890  myFormElement.reset();
2891
2892  for(i=0; i<elements.length; i++) {
2893
2894  field_type = elements[i].type.toLowerCase();
2895
2896  switch(field_type) {
2897
2898    case "text":
2899    case "password":
2900    case "textarea":
2901    case "hidden":
2902
2903      elements[i].value = "";
2904      break;
2905
2906    case "radio":
2907    case "checkbox":
2908        if (elements[i].checked) {
2909          elements[i].checked = false;
2910      }
2911      break;
2912
2913    case "select-one":
2914    case "select-multi":
2915        elements[i].selectedIndex = 0;
2916      break;
2917
2918    default:
2919      break;
2920  }
2921    }
2922}
2923
2924
2925jQuery(document).ready(function (){
2926	jQuery(".scroll-top").click(function ()	{						
2927		setTimeout(function(){ jQuery('.scroll_to').focus(); }, 1000);  	
2928	});
2929});
2930
2931
2932jQuery(document).ready(function (){
2933	jQuery("a.fancybox").click(function ()	{						
2934		setTimeout(function(){ jQuery('.fancybox-close').focus(); }, 1000);  
2935		jQuery('body').addClass('fancybox_actives'); 	
2936	});
2937});
2938
2939
2940

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.