PageSourceSearch

https://zelva.gov.by/scripts/design/script.js

js zelva.gov.by collected 2026-10-02 18:19:29 UTC 54,511 bytes, 1,624 lines download raw bytes

1//new Image().src = '/desimages/slider_news_prev_hover.png';
2//new Image().src = '/desimages/slider_news_next_hover.png';
3
4var head_slider_prefix = "ph_slider";
5var head_slider;
6var tm;
7var timeout = 10000;
8var curr_item_konkurs = 0;
9var news_tabs_prefix = "news";
10var news_tabs;
11
12var info_tabs_prefix = "info";
13var info_tabs;
14
15var news_bookmark = 'news_bookmark';
16
17/*function dropDownLeftMenu(h_menu_second_id) {
18 document.getElementById(h_menu_second_id).classList.toggle("show");
19 }*/
20
21function close_calendar() {
22    if (document.getElementById('calendar_list')) {
23        document.getElementById('calendar_list').style.display = 'none';
24    }
25    if ($(".ui-datepicker")) {
26        $(".ui-datepicker").css('display', 'block');
27    }
28}
29function start() {
30    if (head_slider_prefix && document.getElementById(head_slider_prefix)) {
31        head_slider = new imgSlider(head_slider_prefix, timeout);
32    }
33
34    if (news_tabs_prefix && document.getElementById(news_tabs_prefix + "_tabs")) {
35        news_tabs = new newsTabs(news_tabs_prefix, "news");
36        news_tabs.newsTabs_start();
37    }
38
39    if (info_tabs_prefix && document.getElementById(info_tabs_prefix + "_tabs")) {
40        info_tabs = new infoTabs(info_tabs_prefix, "info");
41        info_tabs.infoTabs_start();
42    }
43    if (news_bookmark && document.getElementById(news_bookmark)) {
44        new SetBookmarkAction(news_bookmark);
45    }
46}
47
48function SetBookmarkAction(prefix) {
49    var i = 1;
50    this.curr_index = 0;
51    this.prefix = prefix;
52    var self = this;
53    while (document.getElementById(prefix + "_a_" + i)) {
54        if (document.getElementById(prefix + "_content_" + i)) {
55            document.getElementById(prefix + "_a_" + i).index = i;
56            document.getElementById(prefix + "_a_" + i).onclick = function () {
57                return showContent(this.index, self);
58            };
59        }
60        if (document.getElementById(prefix + "_a_" + i).className.toLowerCase() === prefix + "_item_sel") {
61            this.curr_index = i;
62        }
63        i++;
64    }
65}
66
67function showContent(index, obj) {
68    changeBookmarkClass(obj.curr_index, obj.prefix, obj.prefix + "_item", obj.prefix + "_content");
69    changeBookmarkClass(index, obj.prefix, obj.prefix + "_item_sel", obj.prefix + "_content_sel");
70    obj.curr_index = index;
71    return false;
72}
73
74function changeBookmarkClass(index, prefix, a_clName, c_clName) {
75    if (index && document.getElementById(prefix + "_a_" + index)) {
76        document.getElementById(prefix + "_a_" + index).className = a_clName;
77    }
78    if (index && document.getElementById(prefix + "_content_" + index)) {
79        document.getElementById(prefix + "_content_" + index).className = c_clName;
80    }
81}
82
83
84function checkFBForm(els)
85{
86    console.log(els);
87    var res = 1;
88    for (var i = 0; i < els.length; i++) {
89        res &= checkInput(els[i]);
90    }
91    if (!res) {
92        return false;
93    } else {
94        return true;
95    }
96}
97
98function checkInput(el_id) {
99    console.log(el_id);
100    if (!document.getElementById(el_id))
101        return true;
102    var el = document.getElementById(el_id);
103    var sp = document.getElementById("red_" + el_id);//el.previousElementSibling ? el.previousElementSibling : el.previousSibling;
104    if (!sp)
105        return true;
106    if ((el.tagName.toLowerCase() == "select" && el.selectedIndex == 0) || el.value == "") {
107        sp.style.display = "block";
108        return false;
109    } else {
110        sp.style.display = "none";
111        return true;
112    }
113}
114function checkFBFormOchered(els)
115{
116    console.log(els);
117    var res = 1;
118    for (var i = 0; i < els.length; i++) {
119        res &= checkInputOchered(els[i]);
120    }
121    if (!res) {
122        return false;
123    } else {
124        return true;
125    }
126}
127
128function checkInputOchered(el_id) {
129    console.log(el_id);
130    if (!document.getElementById(el_id))
131        return true;
132    
133    
134     if(el_id=='dater'){
135           var re = /^\d{4}([-])\d{2}\1\d{2}$/;
136           
137           var myMail = document.getElementById('dater').value;
138           var valid = myMail.match(re);
139           var spm = document.getElementById("reds_"+el_id);
140           if (valid){
141            spm.style.display = "none";
142                return true;
143            }else{
144                spm.style.display = "block";
145                return false;
146            }           
147       }
148    if(el_id=='godpost'){   
149        
150        var el = document.getElementById(el_id).value;
151        var sp = document.getElementById("red_" + el_id);//el.previousElementSibling ? el.previousElementSibling : el.previousSibling;
152        var rech = /^\d{4}$/;
153        var validche = el.match(rech);
154        if (validche) {
155        sp.style.display = "none";
156        return true;
157    } else {
158        sp.style.display = "block";
159        return false;
160    }
161    }
162    
163   
164    if(el_id=='title' || el_id=='name' || el_id=='otch' || el_id=='soato_rn'){
165         var res = /^[a-zA-Zа-яА-ЯёЁ]*$/;
166         var myText = document.getElementById(el_id).value;
167         var validtext = myText.match(res);
168         var spt = document.getElementById("red_" + el_id)
169         if (validtext && myText!="") {
170            spt.style.display = "none";
171            return true;
172         } else {
173            spt.style.display = "block";
174           return false;
175        }
176    }
177    
178    
179}
180function setAction(form_id, action, cal_id, el) {
181    if (!form_id || !document.getElementById(form_id) || !cal_id || !document.getElementById(cal_id) || !el)
182        return false;
183    document.getElementById(form_id).action = action;
184    document.getElementById(cal_id).value = el.innerHTML;
185    el.parentNode.style.display = 'none';
186    window.onclick = null;
187}
188
189function open_block(block_id, block_id2) {
190    if (!block_id || !document.getElementById(block_id))
191        return;
192    if (document.getElementById(block_id).style.display == "block") {
193        document.getElementById(block_id).style.display = 'none';
194    } else {
195        document.getElementById(block_id).style.display = 'block';
196    }
197    if (block_id2 != undefined) {
198        if (document.getElementById(block_id2).style.display == "block") {
199            document.getElementById(block_id2).style.display = 'none';
200        } else {
201            document.getElementById(block_id2).style.display = 'block';
202        }
203    }
204    var count = 0;
205    window.onclick = function () {
206        if (!count) {
207            count = 1;
208            return;
209        }
210        document.getElementById(block_id).style.display = 'none';
211        window.onclick = null;
212    }
213}
214
215function openAdvSearch(block_id, add_id){
216    if (!block_id || !document.getElementById(block_id) || !add_id || !document.getElementById(add_id) || !document.getElementById('search_str_inner')) return; 
217    if (!document.getElementById(block_id).style.display || document.getElementById(block_id).style.display=="none" || document.getElementById(block_id).style.display==""){
218        document.getElementById(block_id).style.display = "block";
219        document.getElementById(add_id).disabled = "disabled";
220        document.getElementById('search_str_inner').disabled = "disabled";
221    }else{
222        document.getElementById(block_id).style.display = "none";
223        document.getElementById(add_id).disabled = "";
224        document.getElementById('search_str_inner').disabled = "";
225    }
226   /* */
227}
228
229function open_rblock(block_id, block_id2) {
230    if (!block_id || !document.getElementById(block_id))
231        return;
232    if (document.getElementById(block_id).style.display == "block") {
233        document.getElementById(block_id).style.display = 'none';
234    } else {
235        document.getElementById(block_id).style.display = 'block';
236    }
237
238    document.getElementById("allRubrics_menub").className = "allRubrics_menu_sel";
239    var count = 0;
240    window.onclick = function () {
241        if (!count) {
242            count = 1;
243            return;
244        }
245        document.getElementById(block_id).style.display = 'none';
246        document.getElementById("allRubrics_menub").className = "allRubrics_menu";
247        window.onclick = null;
248    }
249}
250function open_item_konkurs(sel_id) {
251
252
253    var moreid = 'konkurs_more_' + sel_id;
254    var textid = 'konkurs_text_' + sel_id;
255    var old_selid = document.getElementById('old_si').value;
256
257    document.getElementById(moreid).style.display = 'none';
258    document.getElementById(textid).style.display = 'block';
259    if (old_selid > 0) {
260        var oldmoreid = 'konkurs_more_' + old_selid;
261        var oldtextid = 'konkurs_text_' + old_selid;
262        document.getElementById(oldmoreid).style.display = 'block';
263        document.getElementById(oldtextid).style.display = 'none';
264    }
265    document.getElementById('old_si').value = sel_id;
266}
267
268function change_menu_ico(ico_name, ico_name_hover, id, path) {
269    document.getElementById(id).src = path + ico_name_hover;
270}
271
272
273function open_close_rubric(id_number) {
274    var block_id1 = "main_" + id_number;
275    var block_id2 = "main2_" + id_number;
276    var block_id3 = "rolling_rubric_" + id_number;
277    // if (!block_id1 || !document.getElementById(block_id1)) return;
278    if (document.getElementById(block_id1).style.display == "table"
279            || document.getElementById(block_id1).style.display == "") {
280        document.getElementById(block_id1).style.display = 'none';
281    } else {
282        document.getElementById(block_id1).style.display = 'table';
283    }
284    if (document.getElementById(block_id2).style.display == "table"
285            || document.getElementById(block_id2).style.display == "") {
286        document.getElementById(block_id2).style.display = 'none';
287    } else {
288        document.getElementById(block_id2).style.display = 'table';
289    }
290    if (document.getElementById(block_id3).style.display == "block") {
291        document.getElementById(block_id3).style.display = 'none';
292    } else {
293        document.getElementById(block_id3).style.display = 'block';
294    }
295}
296
297
298function show_photo(photo_name, photo_title, photo_desc, ph_id) {
299
300    var ph_big = document.getElementById(ph_id);
301    ph_big.src = photo_name;
302    ph_big.title = photo_title;
303    var ph_big_title = ph_id + '_title';
304    document.getElementById(ph_id + '_title').innerHTML = photo_title;
305    document.getElementById(ph_id + '_titlet').innerHTML = photo_desc;
306
307
308}
309
310function show_photo_big(url, parent_popup_id, popup_id) {
311
312    if (!document.getElementById(parent_popup_id) || !document.getElementById(popup_id))
313        return false;
314
315    if (curr_video_url == url) {
316        document.getElementById(parent_popup_id).style.display = 'block';
317        return false;
318    }
319    var href = url;
320    var xhr = new XMLHttpRequest();
321    var end_url = 'xhr=html&r=' + Math.random();
322    url += url.indexOf('?') == -1 ? "?" + end_url : "&" + end_url;
323    xhr.open('GET', url, true);
324
325    xhr.onreadystatechange = function () {
326        if (xhr.readyState != 4)
327            return;
328        //alert( xhr.responseText);
329        if (xhr.responseText == "")
330            return;
331        document.getElementById(popup_id).innerHTML = xhr.responseText;
332        show_curr_photo(parent_popup_id, popup_id)
333
334        curr_video_url = href;
335
336        return false;
337
338    }
339    xhr.send(null);
340    return false;
341}
342
343
344//function positionPopup(top_p){
345//	if (!document.getElementById(curr_popup_id)) return;
346//	var el = document.getElementById(curr_popup_id);
347//	var leftBorder = (window.innerWidth>el.clientWidth) ?  Math.floor ((window.innerWidth-el.clientWidth)/2) : 0;
348//	
349//	var topBorder = (top_p!=undefined && top_p!=null) ? top_p : ((window.innerHeight>el.clientHeight) ?  Math.floor ((window.innerHeight-el.clientHeight)/2) : 0);
350//	el.style.top = topBorder + "px";
351//	return topBorder;
352//        
353//}
354
355function positionPopup() {
356    if (!document.getElementById(curr_popup_id)) return;
357    $("#" + curr_popup_id).css("top", Math.max(0, (($(window).height() - $($("#" + curr_popup_id)).outerHeight()) / 2) + $(window).scrollTop()) + "px");
358
359}
360
361function setPopupActivity(parent_popup_id, popup_id) {
362    //$(window).keypress(function (e) {
363//		$(window).keydown(function (e) {
364//		if (e.keyCode == 27) {
365//			close_popup(parent_popup_id);
366//		}
367//                
368//                else if (e.keyCode == 37) {//стрелка влево
369//			document.getElementById("ph_prev").click();
370//			//return false;
371//		  }else if (e.keyCode == 39){//стрелка вправо
372//			document.getElementById("ph_next").click();
373//			//return false;
374//		  }
375//	});
376
377
378    lastPageY = window.pageYOffset || document.documentElement.scrollTop;
379    $(window).scroll(function () {
380
381        //   positionPopup(); // чтобы не центрировалось при скролле эту функцию можно закомментировать
382
383//		var pageY = window.pageYOffset || document.documentElement.scrollTop;
384//		var scrollTop = lastPageY - pageY;
385//		
386//		var el = document.getElementById(popup_id);
387//		
388//		var bottom_border = el.offsetTop + el.clientHeight;
389//		var top_border = el.offsetTop;
390//		
391//		if (pageY==0){
392//			el.style.top = topBorder+ "px";
393//		}else if (pageY > lastPageY && bottom_border>window.innerHeight){
394//			if (bottom_border - window.innerHeight > scrollTop){
395//				el.style.top = el.offsetTop + scrollTop + "px";
396//			}else{
397//				el.style.top = el.offsetTop - bottom_border + window.innerHeight + 2 + "px";
398//			}
399//		}else if (pageY < lastPageY && top_border<topBorder){
400//			if (top_border + scrollTop < topBorder){
401//				el.style.top = el.offsetTop + scrollTop + "px";
402//			}else{
403//				el.style.top = topBorder+ "px";
404//			}
405//		}
406//		lastPageY = pageY;
407    });
408    window.onresize = positionPopup;
409}
410
411
412
413function positionRegionPopup() {
414    if (!curr_region_id || !document.getElementById(curr_region_id))
415        return;
416    var topborder = positionPopup(curr_region_id);
417    var parentborder = 0;
418    var mainborder = 0;
419    if (document.getElementById("ter_person")) {
420        parentborder = document.getElementById("ter_person").offsetTop;
421    }
422    /*if (document.getElementById("main")){
423     mainborder = document.getElementById("main").offsetTop;
424     }*/
425    document.getElementById(curr_region_id).style.top = (topborder - parentborder - mainborder) + "px";
426}
427
428/*Ajax для ссылок*/
429function get_page(url, res_id) {
430    if (!document.getElementById(res_id))
431        return;
432
433    var xhr = new XMLHttpRequest();
434    var end_url = 'xhr=html&r=' + Math.random();
435    if (url.indexOf('?') == -1) {
436        if (url[url.length - 1] != "/") {
437            url += "/";
438        }
439        url += "?" + end_url;
440        //console.log(url);
441    } else {
442        if (url[url.length - 1] == "/") {
443            url = url.substr(0, url.length - 1);
444        }
445        url += "&" + end_url;
446        //console.log(url);
447    }
448    //url += url.indexOf('?')==-1 ? "?"+end_url : "&"+end_url;
449    xhr.open('GET', url);
450
451    xhr.onreadystatechange = function () {
452        if (xhr.readyState != 4)
453            return;
454        document.getElementById(res_id).innerHTML = xhr.responseText;
455        return false;
456    }
457    xhr.send(null);
458    return false;
459}
460
461function get_bookmark(url, res_id) {
462    if (!document.getElementById(res_id))
463        return;
464    if (document.getElementById(res_id).innerHTML.trim() == "") {
465        get_page(url, res_id);
466    }
467}
468
469function open_wrap(block_class) {
470    if ($(block_class).length) {
471        $(block_class).toggleClass('show');
472
473        if ($('#burger_pic').length && $('#close_pic').length) {
474            $('#burger_pic').toggleClass('hide');
475            $('#close_pic').toggleClass('show');
476        }
477
478        if ($('.second_level.show').length)
479            $('.second_level.show').removeClass('show');
480        if ($('.click_point.active').length)
481            $('.click_point.active').removeClass('active');
482    }
483
484}
485
486if (window.Element && !Element.prototype.closest) {
487    Element.prototype.closest =
488            function (s) {
489                var matches = (this.document || this.ownerDocument).querySelectorAll(s),
490                        i,
491                        el = this;
492                do {
493                    i = matches.length;
494                    while (--i >= 0 && matches.item(i) !== el) {
495                    }
496                    ;
497                } while ((i < 0) && (el = el.parentElement));
498                return el;
499            };
500}
501
502$('.click_point').on('click', function (e) {
503    $('.click_point.active').not(e.target).removeClass('active');
504    $(e.target).toggleClass('active');
505    var item = (e.target).closest('.item_first_level');
506    var submenu_item = $(item).children('.list_second_level');
507    $('.list_second_level').not(submenu_item).removeClass('show');
508    $(submenu_item).toggleClass('show');
509});
510
511$('.menu_arrow').on('click', function (e) {
512    $('.menu_arrow.active').not(e.target).removeClass('active');
513    $(e.target).toggleClass('active');
514    var h_menu = (e.target).closest('.h_menu1');
515    var h_menu_second = $(h_menu).children('.h_menu_second');
516    $('.h_menu_second').not(h_menu_second).removeClass('show');
517    $(h_menu_second).toggleClass('show');
518    var h_menu_wrapper = $(h_menu).children('.h_menu_wrapper');
519    $('.h_menu_wrapper').not(h_menu_wrapper).removeClass('active');
520    $(h_menu_wrapper).toggleClass('active');
521});
522
523//function vote(url, res_id) {
524//    alert(res_id);
525//    if (!document.getElementById(res_id))
526//        return;
527//    var msg = $('#vote_form').serialize();
528//
529//    var xhr = new XMLHttpRequest();
530//    var end_url = 'xhr=html' + (msg == "" ? "" : "&" + msg) + '&r=' + Math.random();
531//
532//    url += url.indexOf('?') == -1 ? "?" + end_url : "&" + end_url;
533//    console.log(url);
534//    xhr.open('GET', url, true);
535//
536//    xhr.onreadystatechange = function () {
537//        if (xhr.readyState != 4)
538//            return;
539//        //	document.getElementById(res_id).innerHTML = xhr.responseText;
540//        //	alert(opros_ajax);
541////        var responseObj = eval('(' + xhr.responseText + ')');
542////        console.log(responseObj.html);
543//        document.getElementById(res_id).innerHTML = xhr.responseText;
544//    }
545//    xhr.send(null);
546//}
547
548var opros_ajax = null;
549function vote(url,res_id){
550    //console.log(res_id);
551	if (!document.getElementById(res_id)) return;
552
553	var msg = "";
554        var msg   = $('#vote_form').serialize();
555
556	var xhr = new XMLHttpRequest();
557	var end_url = 'xhr=html'+(msg=="" ? "": "&"+msg)+'&r=' + Math.random();
558	url += url.indexOf('?')==-1 ? "?"+end_url : "&"+end_url;
559  xhr.open('GET', url, true);
560
561  xhr.onreadystatechange = function() {
562    if (xhr.readyState != 4) return;
563		//	document.getElementById(res_id).innerHTML = xhr.responseText;
564		//	alert(opros_ajax);
565//			var responseObj = eval( '(' + xhr.responseText + ')' );
566//			document.getElementById(res_id).innerHTML = responseObj.html;
567//			Diagramm(responseObj.svg);
568                        document.getElementById(res_id).innerHTML = xhr.responseText;
569
570			return false;
571  }
572  xhr.send(null);
573	return false;
574}
575
576var curr_video_url = null;
577var video_conteiner_id = null;
578
579function show_photo_popup(url, parent_popup_id, popup_id) {
580    //alert('hi');
581    if (!document.getElementById(parent_popup_id) || !document.getElementById(popup_id))
582        return false;
583
584    if (curr_video_url == url) {
585        document.getElementById(parent_popup_id).style.display = 'block';
586        return false;
587    }
588    var href = url;
589    var xhr = new XMLHttpRequest();
590    var end_url = 'xhr=html&r=' + Math.random();
591    url += url.indexOf('?') == -1 ? "?" + end_url : "&" + end_url;
592    xhr.open('GET', url, true);
593
594    xhr.onreadystatechange = function () {
595        if (xhr.readyState != 4)
596            return;
597        //alert( xhr.responseText);
598        if (xhr.responseText == "")
599            return;
600        document.getElementById(popup_id).innerHTML = xhr.responseText;
601        show_curr_photo(parent_popup_id, popup_id)
602
603        curr_video_url = href;
604
605        return false;
606
607    }
608    xhr.send(null);
609    return false;
610}
611
612
613$(".slider_banners .slider_item").on("click", function () {
614    if ($('#parent_popup').length && $('#popup').length) {
615        $(this).clone().appendTo("#popup");
616        $('#parent_popup').show();
617    }
618});
619
620
621function show_curr_photo(parent_popup_id, popup_id, curr_photo) {
622    if (!document.getElementById(parent_popup_id) || !document.getElementById(popup_id))
623        return;
624    if (curr_photo) {
625        document.getElementById(popup_id).innerHTML = curr_photo;
626    }
627    document.getElementById(parent_popup_id).style.display = 'block';
628
629    //$("#big_photo").load(function(){
630    //document.getElementById(popup_id).style.maxWidth = document.getElementById('big_photo').clientWidth+8+"px";
631    curr_popup_id = popup_id;
632    //topBorder = positionPopup();
633    document.getElementById(parent_popup_id).style.display = 'block';
634    //setTimeout(function(){ positionPopup();}, 500);
635    setPopupActivity(parent_popup_id, popup_id);
636
637//		$(window).keypress(function (e) {
638//		  if (e.keyCode == 27) {
639//			close_photo(parent_popup_id);
640//		  } else if (e.keyCode == 37) {//стрелка влево
641//			document.getElementById("ph_prev").click();
642//			//return false;
643//		  }else if (e.keyCode == 39){//стрелка вправо
644//			document.getElementById("ph_next").click();
645//			//return false;
646//		  }
647//		  
648//		});	
649//	});
650
651
652
653}
654
655
656function close_popup(parent_popup_id) {
657    if ($('#popup .slider_item').length)
658        $("#popup .slider_item").remove();
659
660    document.getElementById(parent_popup_id).style.display = 'none';
661    window.onscroll = null;
662    window.onkeypress = null;
663    window.onresize = null;
664    
665    curr_video_url = null;
666    var selector_for_delete = "#" + parent_popup_id + " #popup";
667    document.querySelector(selector_for_delete).innerHTML = "";
668
669}
670
671/*Всплывающая форма для поиска*/
672
673var t;
674function up() {
675    var top = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
676    if (top > 0) {
677        window.scrollBy(0, -100);
678        t = setTimeout('up()', 20);
679    } else
680        clearTimeout(t);
681    return false;
682}
683
684/**/
685(function (window) {
686
687    'use strict';
688
689
690    function classReg(className) {
691        return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
692    }
693
694// classList support for class management
695// altho to be fair, the api sucks because it won't accept multiple classes at once
696    var hasClass, addClass, removeClass;
697
698    if ('classList' in document.documentElement) {
699        hasClass = function (elem, c) {
700            return elem.classList.contains(c);
701        };
702        addClass = function (elem, c) {
703            elem.classList.add(c);
704        };
705        removeClass = function (elem, c) {
706            elem.classList.remove(c);
707        };
708    } else {
709        hasClass = function (elem, c) {
710            return classReg(c).test(elem.className);
711        };
712        addClass = function (elem, c) {
713            if (!hasClass(elem, c)) {
714                elem.className = elem.className + ' ' + c;
715            }
716        };
717        removeClass = function (elem, c) {
718            elem.className = elem.className.replace(classReg(c), ' ');
719        };
720    }
721
722    function toggleClass(elem, c) {
723        var fn = hasClass(elem, c) ? removeClass : addClass;
724        fn(elem, c);
725    }
726
727    var classie = {
728        // full names
729        hasClass: hasClass,
730        addClass: addClass,
731        removeClass: removeClass,
732        toggleClass: toggleClass,
733        // short names
734        has: hasClass,
735        add: addClass,
736        remove: removeClass,
737        toggle: toggleClass
738    };
739
740// transport
741    if (typeof define === 'function' && define.amd) {
742        // AMD
743        define(classie);
744    } else {
745        // browser global
746        window.classie = classie;
747    }
748
749
750
751    'use strict';
752
753    // EventListener | @jon_neal | //github.com/jonathantneal/EventListener
754    !window.addEventListener && window.Element && (function () {
755        function addToPrototype(name, method) {
756            Window.prototype[name] = HTMLDocument.prototype[name] = Element.prototype[name] = method;
757        }
758
759        var registry = [];
760
761        addToPrototype("addEventListener", function (type, listener) {
762            var target = this;
763
764            registry.unshift({
765                __listener: function (event) {
766                    event.currentTarget = target;
767                    event.pageX = event.clientX + document.documentElement.scrollLeft;
768                    event.pageY = event.clientY + document.documentElement.scrollTop;
769                    event.preventDefault = function () {
770                        event.returnValue = false
771                    };
772                    event.relatedTarget = event.fromElement || null;
773                    event.stopPropagation = function () {
774                        event.cancelBubble = true
775                    };
776                    event.relatedTarget = event.fromElement || null;
777                    event.target = event.srcElement || target;
778                    event.timeStamp = +new Date;
779
780                    listener.call(target, event);
781                },
782                listener: listener,
783                target: target,
784                type: type
785            });
786
787            this.attachEvent("on" + type, registry[0].__listener);
788        });
789
790        addToPrototype("removeEventListener", function (type, listener) {
791            for (var index = 0, length = registry.length; index < length; ++index) {
792                if (registry[index].target == this && registry[index].type == type && registry[index].listener == listener) {
793                    return this.detachEvent("on" + type, registry.splice(index, 1)[0].__listener);
794                }
795            }
796        });
797
798        addToPrototype("dispatchEvent", function (eventObject) {
799            try {
800                return this.fireEvent("on" + eventObject.type, eventObject);
801            } catch (error) {
802                for (var index = 0, length = registry.length; index < length; ++index) {
803                    if (registry[index].target == this && registry[index].type == eventObject.type) {
804                        registry[index].call(this, eventObject);
805                    }
806                }
807            }
808        });
809    })();
810
811    function mobilecheck() {
812        var check = false;
813        (function (a) {
814            if (/(android|ipad|playbook|silk|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4)))
815                check = true
816        })(navigator.userAgent || navigator.vendor || window.opera);
817        return check;
818    }
819
820    !String.prototype.trim && (String.prototype.trim = function () {
821        return this.replace(/^\s+|\s+$/g, '');
822    });
823
824    function UISearch(el, options) {
825        this.el = el;
826        this.inputEl = el.querySelector('form > input.sb-search-input');
827        this._initEvents();
828    }
829
830    UISearch.prototype = {
831        _initEvents: function () {
832            var self = this,
833                    initSearchFn = function (ev) {
834                        ev.stopPropagation();
835                        // trim its value
836                        self.inputEl.value = self.inputEl.value.trim();
837
838                        if (!classie.has(self.el, 'sb-search-open')) { // open it
839                            ev.preventDefault();
840                            self.open();
841                        } else if (classie.has(self.el, 'sb-search-open') && /^\s*$/.test(self.inputEl.value)) { // close it
842                            ev.preventDefault();
843                            self.close();
844                        }
845                    }
846
847            this.el.addEventListener('click', initSearchFn);
848            this.el.addEventListener('touchstart', initSearchFn);
849            this.inputEl.addEventListener('click', function (ev) {
850                ev.stopPropagation();
851            });
852            this.inputEl.addEventListener('touchstart', function (ev) {
853                ev.stopPropagation();
854            });
855        },
856        open: function () {
857            var self = this;
858            classie.add(this.el, 'sb-search-open');
859            // focus the input
860            if (!mobilecheck()) {
861                this.inputEl.focus();
862            }
863            // close the search input if body is clicked
864            var bodyFn = function (ev) {
865                self.close();
866                this.removeEventListener('click', bodyFn);
867                this.removeEventListener('touchstart', bodyFn);
868            };
869            document.addEventListener('click', bodyFn);
870            document.addEventListener('touchstart', bodyFn);
871        },
872        close: function () {
873            this.inputEl.blur();
874            classie.remove(this.el, 'sb-search-open');
875        }
876    }
877
878    // add to global namespace
879    window.UISearch = UISearch;
880
881})(window);
882
883
884function open_info(menu_id, menu_id2) {
885    if (!menu_id || !document.getElementById(menu_id))
886        return;
887    var menu = document.getElementById(menu_id);
888    var menu2 = document.getElementById(menu_id2);
889    if (!menu.style || !menu.style.display || menu.style.display == "none" || menu2.style.display == "block") {
890        menu.style.display = "block";
891        menu2.style.display = "none";
892//    }else{
893//        menu2.style.display="block";
894//        menu.style.display = "none";        
895    }
896}
897
898function close_search(menu_id, menu_id2) {
899    if (!menu_id || !document.getElementById(menu_id))
900        return;
901    var menu = document.getElementById(menu_id);
902    var menu2 = document.getElementById(menu_id2);
903    if (!menu.style || !menu.style.display || menu.style.display == "block" || menu2.style.display == "none") {
904        menu.style.display = "none";
905        menu2.style.display = "block";
906//    }else{
907//        menu2.style.display="none";
908//        menu.style.display = "block";        
909    }
910}
911
912function newsTabs(prefix, class_prefix)
913{
914    this.prefix = prefix;
915    this.class_prefix = class_prefix;
916    this.tabs = document.getElementById(this.prefix + "_tabs");
917    this.tab_prefix = this.prefix + "_tab";
918    this.blocks_prefix = this.prefix + "_block";
919    this.tab_class = "blocks_border " + this.class_prefix + "_tab";
920    this.tab_class_sel = "blocks_border " + this.class_prefix + "_tab_sel";
921    this.block_class = "blocks_border " + this.class_prefix + "_block";
922    this.block_class_sel = "blocks_border " + this.class_prefix + "_block " + this.class_prefix + "_block_sel";
923    this.currIndex;
924
925    this.newsTabs_start = newsTabs_start;
926    this.newsTabs_changeBlocks = newsTabs_changeBlocks;
927//     this.newsTabs_start();
928}
929
930function newsTabs_start()
931{
932    var children = this.tabs.getElementsByTagName('div');
933    for (var i = 0; i < children.length; i++) {
934        if (children[i].className.toLowerCase() == this.tab_class_sel.toLowerCase()) {
935            this.currIndex = +children[i].id.substr(this.tab_prefix.length);
936            if (!document.getElementById(this.blocks_prefix + this.currIndex))
937                continue;
938            document.getElementById(this.blocks_prefix + this.currIndex).className = this.block_class_sel;
939            var index = this.currIndex;
940        } else {
941            var index = +children[i].id.substr(this.tab_prefix.length);
942            if (!document.getElementById(this.blocks_prefix + this.currIndex))
943                continue;
944        }
945        children[i].index = index;
946        if (this == news_tabs) {
947            children[i].onclick = function () {
948                newsTabs_changeBlocks.call(news_tabs, this);
949            }
950        } else {
951            children[i].onclick = function () {
952                newsTabs_changeBlocks.call(pha_tabs, this);
953            }
954        }
955    }
956}
957
958function newsTabs_changeBlocks(el)
959{
960    if (!el)
961        return;
962    var index = el.index;
963    if (!document.getElementById(this.blocks_prefix + index) || !document.getElementById(this.blocks_prefix + this.currIndex))
964        return;
965    stopHref(el.firstChild.firstChild);
966    document.getElementById(this.tab_prefix + this.currIndex).className = this.tab_class;
967    document.getElementById(this.tab_prefix + index).className = this.tab_class_sel;
968    document.getElementById(this.blocks_prefix + this.currIndex).className = this.block_class;
969    document.getElementById(this.blocks_prefix + index).className = this.block_class_sel;
970    this.currIndex = index;
971    setHeigthBlock();
972}
973
974function infoTabs(prefix, class_prefix)
975{
976    this.prefix = prefix;
977    this.class_prefix = class_prefix;
978    this.tabs = document.getElementById(this.prefix + "_tabs");
979    this.tab_prefix = this.prefix + "_tab";
980    this.blocks_prefix = this.prefix + "_block";
981    this.tab_class = "blocks_border " + this.class_prefix + "_tab";
982    this.tab_class_sel = "blocks_border " + this.class_prefix + "_tab_sel";
983    this.block_class = "blocks_border " + this.class_prefix + "_block";
984    this.block_class_sel = "blocks_border " + this.class_prefix + "_block " + this.class_prefix + "_block_sel";
985    this.currIndex;
986
987    this.infoTabs_start = infoTabs_start;
988    this.infoTabs_changeBlocks = infoTabs_changeBlocks;
989    setHeigthBlock();
990//     this.newsTabs_start();
991}
992
993function infoTabs_start()
994{
995    var children = this.tabs.getElementsByTagName('div');
996    for (var i = 0; i < children.length; i++) {
997        if (children[i].className.toLowerCase() == this.tab_class_sel.toLowerCase()) {
998            this.currIndex = +children[i].id.substr(this.tab_prefix.length);
999            if (!document.getElementById(this.blocks_prefix + this.currIndex))
1000                continue;
1001            document.getElementById(this.blocks_prefix + this.currIndex).className = this.block_class_sel;
1002            var index = this.currIndex;
1003        } else {
1004            var index = +children[i].id.substr(this.tab_prefix.length);
1005            if (!document.getElementById(this.blocks_prefix + this.currIndex))
1006                continue;
1007        }
1008        children[i].index = index;
1009        if (this == info_tabs) {
1010            children[i].onclick = function () {
1011                infoTabs_changeBlocks.call(info_tabs, this);
1012            }
1013        } else {
1014            children[i].onclick = function () {
1015                infoTabs_changeBlocks.call(pha_tabs, this);
1016            }
1017        }
1018    }
1019
1020}
1021
1022function infoTabs_changeBlocks(el)
1023{
1024    if (!el)
1025        return;
1026    var index = el.index;
1027    if (!document.getElementById(this.blocks_prefix + index) || !document.getElementById(this.blocks_prefix + this.currIndex))
1028        return;
1029    stopHref(el.firstChild.firstChild);
1030    document.getElementById(this.tab_prefix + this.currIndex).className = this.tab_class;
1031    document.getElementById(this.tab_prefix + index).className = this.tab_class_sel;
1032    document.getElementById(this.blocks_prefix + this.currIndex).className = this.block_class;
1033    document.getElementById(this.blocks_prefix + index).className = this.block_class_sel;
1034    this.currIndex = index;
1035}
1036
1037function stopHref(field) {
1038    field.removeAttribute('href');
1039}
1040
1041function get_page_news(url, res_id) {
1042    if (!document.getElementById(res_id))
1043        return;
1044
1045    var xhr = new XMLHttpRequest();
1046    var end_url = 'xhr=html&r=' + Math.random();
1047    if (url.indexOf('?') == -1) {
1048        if (url[url.length - 1] != "/") {
1049            url += "/";
1050        }
1051        url += "?" + end_url;
1052    } else {
1053        if (url[url.length - 1] == "/") {
1054            url = url.substr(0, url.length - 1);
1055        }
1056        url += "&" + end_url;
1057    }
1058    //url += url.indexOf('?')==-1 ? "?"+end_url : "&"+end_url;
1059    xhr.open('GET', url, true);
1060    xhr.onreadystatechange = function () {
1061        if (xhr.readyState != 4)
1062            return;
1063        document.getElementById(res_id).innerHTML = xhr.responseText;
1064        return false;
1065    };
1066    xhr.send(null);
1067    return false;
1068}
1069
1070/*Вкладки для меню контакты/районные отделы*/
1071function changeVkladki(id_lang, act_id, nact_id) {
1072
1073    document.getElementById('n').className = '';
1074    document.getElementById('a').className = '';
1075    document.getElementById(id_lang).className = 'active';
1076    styles = "#" + act_id + " {display:inline-block;}\n";
1077    styles += "#" + nact_id + " {display:none;}\n";
1078    document.getElementById("style_new").innerHTML = styles;
1079
1080}
1081
1082/*Вкладки для контактов, личного приема и новостей*/
1083function changeVkladkiFull(id_lang, act_id, nact_id, nact_id2) {
1084
1085    document.getElementById('c').className = '';
1086    document.getElementById('p').className = '';
1087    document.getElementById('b').className = '';
1088    document.getElementById(id_lang).className = 'active';
1089    styles = "#" + act_id + " {display:inline-block;width:100%}\n";
1090    styles += "#" + nact_id + " {display:none;}\n";
1091    styles += "#" + nact_id2 + " {display:none;}\n";
1092    document.getElementById("style_new_full").innerHTML = styles;
1093
1094}
1095
1096if ($('.right_vrezka .ban_text').length) {
1097    $(".right_vrezka .ban_text").hover(function () {
1098        $('.right_shadow').css("background", "url('/desimages/hover_bkgr_right1.png') no-repeat");
1099        $('.right_shadow').css("backgroundSize", "100% 100%");
1100        //$('.right_shadow').css("height","55px");
1101    }, function () {
1102        $('.right_shadow').css("background", "url(/desimages/bkgr_right1.png) no-repeat;");
1103        //$('.right_shadow').css("height","51px");
1104    });
1105}
1106
1107if ($('.left_col').length) {
1108    $('#left_menu_click_btn').on('click', function (e) {
1109        $(e.target).toggleClass('left_menu_arrow_up');
1110        //var item = (e.target).closest('.menu_item');
1111        //var submenu_item =  $(item).children('.menu_second');
1112        $('.nav_small_inner').toggleClass('show');
1113
1114    });
1115}
1116
1117
1118function setAction(input_id, el_id, value, el, parent_id) {
1119    if (!input_id || !document.getElementById(input_id) || !el_id || !document.getElementById(el_id) || !el)
1120        return false;
1121    document.getElementById(input_id).value = value;
1122    document.getElementById(el_id).innerHTML = el.innerHTML;
1123    if (parent_id) {
1124        document.getElementById(parent_id).style.display = 'none';
1125    } else {
1126        el.parentNode.style.display = 'none';
1127    }
1128}
1129
1130
1131function setActionTags(form_id, action, cal_id, el) {
1132    if (!form_id || !document.getElementById(form_id) || !cal_id || !document.getElementById(cal_id) || !el)
1133        return false;
1134    document.getElementById(form_id).action = action;
1135    document.getElementById(cal_id).value = el.innerHTML;
1136    el.parentNode.style.display = 'none';
1137    window.onclick = null;
1138}
1139
1140function form_submit(form_id) {
1141    var form_el = document.getElementById(form_id);
1142    if (form_el.attributes.ajax) {
1143        show_hear(form_el.attributes.action.nodeValue, form_el.attributes.content_id.nodeValue, form_el)
1144    } else {
1145        s
1146        form_el.submit();
1147    }
1148}
1149
1150function show_big_photo(photo_name, photo_title, photo_desc, rubric_name, rubric_desc, ph_id, photo_date) {
1151    var ph_big = document.getElementById(ph_id);
1152    ph_big.src = photo_name;
1153    ph_big.title = photo_title;
1154    document.getElementById('slider_ph_title').innerHTML = photo_title;
1155    document.getElementById('slider_ph_desc').innerHTML = photo_desc;
1156    document.getElementById('photo_date').innerHTML = photo_date;
1157
1158}
1159
1160function changeBannerImg(id, new_src)
1161{
1162    document.getElementById(id).src = new_src;
1163}
1164
1165function updateHeightBlock()
1166{
1167    setHeigthBlock();
1168
1169}
1170
1171$(window).on('resize', function () {
1172    setHeigthBlock();
1173    //console.log('1111111111');
1174});
1175
1176// $(window).on('resize', function() {
1177////          console.log("resize");
1178//             setHeigthBlock('topNews','topNews_item');
1179//             setHeigthBlock('topNews_p','publication_news');
1180//             //setHeigthBlock('lastNewsSlider','news_item');
1181//          });
1182function setHeigthBlock() {
1183    var contaners = $('.scriptHeight');
1184    if (contaners.length === 0) {
1185        // console.log('.photo_gallery_box not found');
1186        return false;
1187    }
1188
1189    contaners.each(function (i, element) {
1190        caclHeightBlock(element);
1191    });
1192}
1193;
1194
1195function caclHeightBlock(element) {
1196    var heightOfBlock = $(element).innerHeight();
1197
1198    if (heightOfBlock) {
1199        var children = $(element).children();
1200        if (children.length === 0) {
1201            //            console.log('element dont have children');
1202            return false;
1203        }
1204
1205        if (checkWidth(element, children))
1206            return;
1207
1208        var arrValueHeight = [];
1209
1210        children.each(function (i, child) {
1211            if ($(child).hasClass("one_cell_height")) {
1212                /* 
1213                 * удалим установленные ранее скриптом стили, а именно высоту. 
1214                 * это необходимо для корректной работы при срабатывании 
1215                 * события resize 
1216                 */
1217
1218                $(child).attr('style', '');
1219                arrValueHeight.push($(child).innerHeight());
1220            }
1221        });
1222
1223        if (arrValueHeight.length === 0) {
1224            // console.log('lenght of array eq 0');
1225            return false;
1226        }
1227
1228        var maxValueHeight = Math.max.apply(null, arrValueHeight);
1229
1230        children.each(function (i, child) {
1231            if ($(child).hasClass("one_cell_height")) {
1232                $(child).innerHeight(maxValueHeight);
1233            }
1234        });
1235    }
1236
1237}
1238
1239function checkWidth(element, children) {
1240
1241    var widthParentBlock = $(element).width();
1242    var widthChildBlock = $(children[0]).width();
1243
1244    var temp = widthParentBlock - widthChildBlock;
1245
1246    if (temp < 70) {
1247        /**
1248         * удаляем стили. Необходимо для корректного работы при 
1249         * срабатывания события resize
1250         */
1251        children.each(function (i, child) {
1252            $(child).attr('style', '');
1253        });
1254        return true;
1255    }
1256    return false;
1257}
1258
1259
1260
1261function changeLbl(curr_id) {
1262    var inp = document.getElementById('field_' + curr_id);
1263    var lbl =document.getElementById('upload_text_file_'+curr_id);
1264    var file_name;
1265    file_name = inp.value.replace("C:\\fakepath\\", '');
1266    if (!file_name.length)
1267        return;
1268    lbl.innerHTML = file_name;
1269}
1270
1271function textCounter(area,field_rest,max) {
1272    if (!document.getElementById(field_rest)) return false;
1273    
1274    if (area.value.length > max) {
1275        area.value = area.value.substring(0, max);
1276        return false;
1277    } else {
1278        document.getElementById(field_rest).innerHTML = max - area.value.length;
1279    }
1280}
1281
1282var letter_href = 0;
1283var prev_sel_href = 0;
1284function scroll_tab(tab_id) {
1285    var target = $("#" + tab_id + "_info .mCustomScrollbar");
1286    var percent = $('#scroll_pos').text();
1287    target.mCustomScrollbar("scrollTo", letter_href + "_" + tab_id)
1288    prev_sel_href = letter_href;
1289    var vkl_el = document.getElementById("cont_priem_news_bl");
1290    vkl_el.scrollIntoView(true);
1291
1292
1293}
1294
1295function changeVkladkiFull(id_lang, act_id, nact_id, nact_id2) {
1296
1297    document.getElementById('c').className = '';
1298    document.getElementById('p').className = '';
1299    document.getElementById('b').className = '';
1300    document.getElementById(id_lang).className = 'active';
1301    styles = "#" + act_id + " {display:inline-block;width:100%}\n";
1302    styles += "#" + nact_id + " {display:none;}\n";
1303    styles += "#" + nact_id2 + " {display:none;}\n";
1304    document.getElementById("style_new_full").innerHTML = styles;
1305    if (letter_href) {
1306        setTimeout(scroll_tab, 500, act_id);
1307    }
1308
1309
1310
1311}
1312function nextSlider() {
1313    var activeLabel = $('.list_page label.active'),
1314            nextSlide = $(activeLabel).next('label'),
1315            el = nextSlide.attr('for'),
1316            image = $('#' + el);
1317    if (!nextSlide.length) {
1318        nextSlide = $('.list_page label').first();
1319        el = nextSlide.attr('for');
1320        image = $('#' + el);
1321    }
1322    $(".list_page label").removeClass('active');
1323//    $(".image-section").removeAttr('checked');
1324    $(".image-section").removeClass('active');
1325    $(image).addClass('active');
1326
1327    //nextSlide.trigger("click").addClass('active');
1328    nextSlide.addClass('active');
1329}
1330
1331
1332
1333function getPosition(el, block_id, e) {
1334    if (!block_id || !document.getElementById(block_id) || !document.getElementById("all"))
1335        return;
1336    var block = document.getElementById(block_id);
1337    var all = document.getElementById("all");
1338    /*if (!block_opened){
1339     return;
1340     }*/
1341    e = e || window.event;
1342
1343    var html = document.documentElement;
1344    var body = document.body;
1345    var pageX = e.clientX + (html && html.scrollLeft || body && body.scrollLeft || 0) - (html.clientLeft || 0);
1346    var pageY = e.clientY + (html && html.scrollTop || body && body.scrollTop || 0) - (html.clientTop || 0);
1347    var pX = all.offsetLeft + parentOffsetLeft(el);
1348    var pY = all.offsetTop + parentOffsetTop(el);
1349    pEl = el;
1350
1351    bX = pageX - pX;
1352    bY = pageY - pY;
1353    // alert("clentX = "+e.clientX + "; clientY = "+e.clientY+"\npageX = "+pageX + "; pageY = "+pageY+"\npX = "+pX+"; pY= "+pY+"\nbX = "+bX+"; bY= "+bY);
1354    set_position = true;
1355    setBlockPosition(block);
1356    set_position = false;
1357}
1358
1359function parentOffsetTop(el) {
1360    if (el && el.id != "all") {
1361        return el.offsetTop + parentOffsetTop(el.parentNode);
1362    } else {
1363        return 0;
1364    }
1365}
1366
1367function parentOffsetLeft(el) {
1368    if (el && el.id != "all") {
1369        return el.offsetLeft + parentOffsetLeft(el.parentNode);
1370    } else {
1371        return 0;
1372    }
1373}
1374
1375function setBlockPosition(block) {
1376    if (!block || !set_position || !block_opened || !pEl)
1377        return;
1378    block.style.left = 0 + "px";
1379    block.style.top = 0 + "px";
1380    if (pEl.clientWidth < (bX + block.clientWidth)) {
1381        bX = pEl.clientWidth - block.clientWidth;
1382    }
1383
1384    block.style.left = bX + "px";
1385    block.style.top = bY + 10 + "px";
1386    set_position = false;
1387}
1388
1389function fix_menu() {
1390    if ($(window).width() > 950) {
1391        $(".sticky_left_menu, .sticky_top_menu").sticky({topSpacing: 0});
1392    }
1393    if ($(window).width() <= 950 && $('#sticky-wrapper').length) {
1394        $(".sticky_left_menu, .sticky_top_menu").unstick();
1395    }
1396}
1397
1398window.addEventListener('resize', function () {
1399    //fix_menu();
1400});
1401
1402/*для svg-карты*/
1403
1404function show_block(block_id) {
1405    if (!block_id || !document.getElementById(block_id))
1406        return;
1407    var block = document.getElementById(block_id);
1408    if (!block.style || !block.style.display || block.style.display == "") {
1409        block.style.display = "block";
1410    } else {
1411        block.style.display = "";
1412    }
1413    return false;
1414}
1415
1416var block_opened = false;
1417var set_position = false;
1418var bX = 0;
1419var bY = 0;
1420var pEl;
1421
1422function show_block2(block_id, text) {
1423    if (!block_id || !document.getElementById(block_id) || !document.getElementById(block_id + "_inner"))
1424        return;
1425    var block = document.getElementById(block_id);
1426    // if (!block.style || !block.style.display || block.style.display==""){
1427    block.style.display = "block";
1428    document.getElementById(block_id + "_inner").innerHTML = text;
1429    block_opened = true;
1430    /*}else{
1431     block.style.display = "";
1432     block_opened = false;
1433     }*/
1434
1435    setBlockPosition(block);
1436    //set_position = false;
1437    return false;
1438}
1439
1440function close_block(block_id) {
1441    if (!block_id || !document.getElementById(block_id))
1442        return;
1443    document.getElementById(block_id).style.display = "";
1444    block_opened = false;
1445}
1446
1447$('.content_menu .menu_btn, .content_menu .menu_close').on('click', function (e) {
1448    if ($('.inner_left_col').length) {
1449        $('.inner_left_col').toggleClass('mobile_content_menu');
1450    }
1451    if ($('.new_list_left_col').length) {
1452        $('.new_list_left_col').toggleClass('mobile_content_menu');
1453    }
1454});
1455
1456function show_menu_on_mob(id_clicked, id_menu) {
1457    var el_clicked = document.getElementById(id_clicked);
1458    var el_menu = document.getElementById(id_menu);
1459    console.log(id_clicked);
1460    if (el_clicked && el_menu) {
1461        if (id_clicked=="mob_main_langs" && window.innerWidth <= 600) {
1462            return false;
1463        } else {
1464            if (el_menu.classList.contains('show_menu')) {
1465                el_menu.classList.remove('show_menu');
1466            } else {
1467                el_menu.classList.add('show_menu');
1468            }
1469        }
1470    }
1471}
1472
1473function show_answer(question_el) {
1474    var q_id = question_el.id;
1475    var q_el = document.getElementById(q_id);
1476    if (!q_el) {return false;}
1477    remove_clicked_class(q_id);
1478    if (q_el.classList.contains("clicked")) {
1479        q_el.classList.remove("clicked");
1480        return false;
1481    } else {
1482        q_el.classList.add("clicked");
1483        return true;
1484    }
1485}
1486
1487function remove_clicked_class(q_id) {
1488    var q_els = document.getElementsByClassName("question_text clicked");
1489    var length_q_els = q_els.length;
1490    for (var i = 0; i < length_q_els; i++) {
1491        if (q_els[i].id !== q_id) {
1492            q_els[i].classList.remove("clicked");
1493        }
1494    }
1495}
1496
1497function commentAdd(form_id, url, res_id, hide_submit, need_reload){
1498
1499if (!document.getElementById(res_id)) return;
1500    var msg   = $('#'+form_id).serialize();
1501
1502    var xhr = new XMLHttpRequest();
1503    var end_url = '', 
1504        postRequestString = 'xhr=html&' + (msg=="" ? "": "&"+msg)+'&r=' + Math.random();
1505
1506    if (hide_submit === undefined) {
1507        hide_submit = false;
1508      }
1509    if (need_reload === undefined) {
1510        need_reload = true;
1511      }
1512      
1513    url += url.indexOf('?')==-1 ? "?"+end_url : "&"+end_url;
1514
1515    xhr.open("POST",url,true);
1516    xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
1517    xhr.onreadystatechange = function() {
1518        if (xhr.readyState != 4) return;
1519        
1520        document.getElementById(res_id).innerHTML = xhr.responseText;
1521        if(hide_submit)
1522        {
1523            $("#"+form_id+" input[type='submit']").hide();
1524        }
1525    }
1526    if(need_reload === true)
1527    {
1528        $('#code_block iframe')[0].contentWindow.location.reload(true);
1529        $('#code').val('');
1530    }
1531
1532    xhr.send(postRequestString);
1533}   
1534
1535
1536function reload_comments()
1537{
1538    location.reload();
1539}
1540
1541function clearForm()
1542{
1543    document.getElementById('sender_FIO').value = '';
1544    document.getElementById('message').value = '';
1545    document.getElementById('comment_p_id').value = '';
1546}
1547
1548function answer(p_id)
1549{
1550    console.log(1123)
1551    if(document.getElementById('comment_p_id') === undefined)
1552        return;
1553    document.getElementById('comment_p_id').value = p_id;
1554//    scrollToElement(document.getElementById('comment_add'));
1555     document.getElementById("comment_add").scrollIntoView();
1556//     scrollTo(0,10000);
1557}
1558
1559/* Обработчик для uLogin */
1560function uloginWorkWithToken(token, id)
1561{
1562    var field = document.getElementById(id)
1563    if (!field) return true;
1564   var url = 'http://ulogin.ru/token.php?token=' + token;
1565    var xhr = new XMLHttpRequest();
1566    var end_url = '';
1567   url += url.indexOf('?')==-1 ? "?"+end_url : "&"+end_url;
1568    xhr.open('GET', url, true);
1569
1570    xhr.onreadystatechange = function() {
1571        if (xhr.readyState != 4) return;
1572            if (xhr.responseText=="") return;
1573            var answer = JSON.parse(xhr.responseText);
1574            field.value = answer['first_name'] + ' ' + answer['last_name'];
1575
1576            return false;
1577    }
1578    xhr.send(null);
1579    return false;
1580}
1581
1582function scrollToElement(theElement) {
1583    var selectedPosX = 0;
1584    var selectedPosY = 0;
1585  
1586    while (theElement != null) {
1587        selectedPosX += theElement.offsetLeft;
1588        selectedPosY += theElement.offsetTop;
1589        theElement = theElement.offsetParent;
1590    }
1591        
1592    var top_menu_h;
1593//    if(document.getElementById('top_menu_block') === undefined)
1594//        top_menu_h = 0;
1595//    else
1596//        top_menu_h = document.getElementById('top_menu_block').offsetHeight + 10;
1597            
1598    window.scrollTo(selectedPosX,selectedPosY-top_menu_h);
1599}
1600//
1601//function answerAdd(url,res_id){
1602//
1603//if (!document.getElementById(res_id)) return;
1604//    var msg   = $('#comment_add').serialize();
1605//
1606//    var xhr = new XMLHttpRequest();
1607//    var end_url = 'xhr=html'+(msg=="" ? "": "&"+msg)+'&r=' + Math.random();
1608//
1609//    url += url.indexOf('?')==-1 ? "?"+end_url : "&"+end_url;
1610//    xhr.open('GET', url, true);
1611//    xhr.onreadystatechange = function() {
1612//        if (xhr.readyState != 4) return;
1613//        console.log(xhr.responseText);
1614//        
1615//        document.getElementById(res_id).innerHTML = xhr.responseText;
1616//    }
1617//    xhr.send(null);
1618//}
1619
1620$( document ).ready(function() {
1621    if($('.secondary_page .inner_text table').length) {
1622        $('.secondary_page .inner_text table').wrap('<div class="overflow_block"></div>');
1623    }
1624});

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.