PageSourceSearch

https://gmina-lubartow.pl/js/functions.js

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

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.