PageSourceSearch

https://grodno-region.gov.by/scripts/design/script.js

js grodno-region.gov.by collected 2026-10-02 04:47:32 UTC 54,318 bytes, 1,620 lines download raw bytes

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

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.