PageSourceSearch

https://plaska.pl/js/functions.js

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

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.