PageSourceSearch

https://www.ogorod.ru/daily/_js/main.js?v=1790347708

js ogorod.ru collected 2026-09-25 14:57:43 UTC 99,678 bytes, 2,099 lines download raw bytes

1function setActiveIssueTopMenu() {
2	var current_issue = document.location.pathname.toString();
3	current_issue = current_issue.substring(current_issue.indexOf('/daily/') + 7);
4	current_issue = current_issue.substring(0, current_issue.indexOf('/'));
5	$("#menu_issue_" + current_issue).addClass('active');
6
7//	document.getElementById("menu_issue_dom").classList.add("active");
8
9	console.log("current_issue=" + current_issue);
10}
11
12function getInternetExplorerVersion() {
13	var rv = -1;
14	if (navigator.appName == 'Microsoft Internet Explorer') {
15		var ua = navigator.userAgent;
16		var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
17		if (re.exec(ua) != null)
18			rv = parseFloat( RegExp.$1 );
19	} else if (navigator.appName == 'Netscape') {
20		var ua = navigator.userAgent;
21		var re  = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
22		if (re.exec(ua) != null) rv = parseFloat( RegExp.$1 );
23	}
24	return rv;
25}
26var flagIE = false;
27if(getInternetExplorerVersion()!==-1){
28//	alert('IE!!!');
29//	console.log('IE!!!');
30	flagIE = true;
31	$("body").addClass('body_IE');
32} else {
33	$("body").addClass('body_NOT_IE');
34//	console.log('Not IE');
35}
36
37
38
39var rememberScrollPos = 0;
40var window_scroll_top = 0;
41var lastScrollTopPosition = 0;
42var arr_articles_id_nums = [];
43var arr_articles_id = [];
44var arr_articles_title = [];
45var arr_articles_url = [];
46var arr_max_column_height = [];
47var arr_all_column_fixer_time_of_fixing = [];
48var arr_all_column_fixer_pos_top_of_fixing = [];
49
50
51//****** New Article Scanning ******
52function scanArticlesForNewId() {
53	$( ".art-js-content" ).each( function() {
54		var art_id = $(this).attr('data-number');
55		if (art_id in arr_articles_id) {
56			console.log("old article id: " + art_id);
57		} else {
58			console.log("new article id: " + art_id);
59
60			arr_articles_id_nums[arr_articles_id_nums.length] = art_id;
61			arr_articles_id[art_id] = art_id;
62			arr_articles_title[art_id] = $(this).attr('data-title');
63			arr_articles_url[art_id] = $(this).attr('data-url');
64			arr_max_column_height[art_id] = 0;
65
66			arrArticleEmailFormState[art_id] = 0;
67			arrArticleEmailForm2State[art_id] = 0;
68			ajaxArticleOnEmailInit(art_id);
69			ajaxArticlesFromWritersInit(art_id);
70			ajaxArticleNextButtonInit(art_id);
71			initSwiperSliders(art_id);
72//		    if (typeof adblock != 'undefined' && adblock == "yes") {
73//console.log("zzz1");
74		    if (typeof zzz != 'undefined' && zzz == "yes") {
75console.log("adblock zzz1=" + (typeof zzz));
76
77//				ajaxAdblockShowInit(art_id);
78//				adBlockBannerRightColumnInsert(art_id);
79//				adBlockBannerBottomInsert(art_id);
80
81			}
82			imagesLazyInit(art_id);
83			articleShareIconsInit(art_id);
84			InitSelectionsList("selections_list_" + art_id);
85			PopupShowButtonsInit();
86/*
87console.log("aaaaaaaaaaa0 mediator art_id=" + art_id);
88			if (typeof window._mediator !== "undefined") {
89				if (window._mediator.isActive()) {
90					window._mediator.stop();
91console.log( "aaaaaaaaaaaaaaaaaaa1 reInit js-mediator is stopped!!");
92				}
93				window._mediator.start( { 
94					articleSelector: ".js-mediator-article_num_" + art_id,
95					url: $( ".art-js-content.article_" + art_id  ).attr( "data-url" )
96				} );
97console.log( "aaaaaaaaaaaaaaaaaaa2 reInit js-mediator is started!!");
98//console.log( "aaaaaaaaaaaaaaaaaaa reInit js-mediator=" + $( ".art-js-content.article_" + art_id  ).attr( "data-url" ) );
99//				window._mediator.stop();
100//				window._mediator.start( { articleSelector: "js-mediator-article_num_" + art_id} );
101			}
102*/
103		}
104	} );
105}
106//**********************************
107
108/*
109$("img.lazy").lazyload({
110	threshold : 2000,
111	failurelimit : 30
112});
113*/
114function imagesLazyInit(art_num) {
115//	$(".article_" + art_num + " img.lazy, .left_sidebar_" + art_num + " img.lazy").lazyload({
116//console.log('imagesLazyInit article ' + art_num);
117	$(".article_" + art_num + " img.lazy, .left_sidebar_" + art_num + " img.lazy, .right_sidebar_" + art_num + " img.lazy").lazyload({
118		threshold : 4000,
119		failurelimit : 30
120	});
121}
122
123
124//*************** Swiper Sliders *******************
125function correctSliders() {
126//console.log('bbbbbb');
127	$('.swiper-container').each(function(){
128		var slider = $(this);
129		$('.swiper-pagination', slider).css('bottom', slider.height() - $('.swiper-slide-active img', slider).height() + 5 + 30 + 'px');
130		var nav_buttons_margin = -(slider.height() - $('.swiper-slide-active img', slider).height())/2 - 22 - 30;
131		$('.swiper-button-prev', slider).css('margin-top', nav_buttons_margin + 'px');
132		$('.swiper-button-next', slider).css('margin-top', nav_buttons_margin + 'px');
133	});
134}
135
136function initSwiperSliders(art_num) {
137//console.log('aaaaa');
138    //initialize swiper when document ready  
139    var mySwiper = new Swiper ('.article_' + art_num + ' .swiper-container', {
140      // Optional parameters
141/*
142      direction: 'vertical',
143      loop: true
144*/
145//    	pagination: '.swiper-pagination',
146//        paginationClickable: true,
147//        nextButton: '.swiper-button-next',
148//        prevButton: '.swiper-button-prev',
149
150/*
151        direction: 'vertical',
152        slidesPerView: 1,
153        mousewheelControl: true,
154*/  
155//        autoplay: 2500,
156//        mousewheelControl: true,
157		grabCursor:true,
158        loop: true,
159        spaceBetween: 30,
160		pagination: {
161			el: '.swiper-pagination',
162			type: 'bullets',
163		},
164		navigation: {
165			nextEl: '.swiper-button-next',
166			prevEl: '.swiper-button-prev',
167		},
168    })
169	correctSliders();
170
171/*
172	$(window).scroll(function() {
173		correctSliders();
174	});	
175	$(window).resize();
176*/
177}
178/*
179$(window).resize(function(){
180	correctSliders();
181});
182*/
183
184//**************************************************
185
186
187
188
189function ajaxArticlesFromWritersInit(art_num) {
190	console.log("ajax article id: " + art_num);
191	
192	$(".author-know-more-button_" + art_num).on('click', function(e){
193		e.preventDefault();
194		$(".popup_wrapper.article_form_writers.author-know-more").toggleClass("hidden");
195		if ( $(".popup_wrapper.article_form_writers.author-know-more").is(':visible') ) {
196			$('.popup_wrapper.article_form_writers.author-know-more input[name="name"]').focus();
197			$('.popup_wrapper.article_form_writers.author-know-more input[name="article_id"]').val(art_num);
198			$('.popup_wrapper.article_form_writers.author-know-more input[name="article_title"]').val(arr_articles_title[art_num]);
199			$('.popup_wrapper.article_form_writers.author-know-more input[name="article_url"]').val(arr_articles_url[art_num]);
200		}
201	});
202	$(".author-new-theme-button_" + art_num).on('click', function(e){
203		e.preventDefault();
204		$(".popup_wrapper.article_form_writers.author-new-theme").toggleClass("hidden");
205		if ( $(".popup_wrapper.article_form_writers.author-new-theme").is(':visible') ) {
206			$('.popup_wrapper.article_form_writers.author-new-theme input[name="name"]').focus();
207			$('.popup_wrapper.article_form_writers.author-new-theme input[name="article_id"]').val(art_num);
208			$('.popup_wrapper.article_form_writers.author-new-theme input[name="article_title"]').val(arr_articles_title[art_num]);
209			$('.popup_wrapper.article_form_writers.author-new-theme input[name="article_url"]').val(arr_articles_url[art_num]);
210		}
211	});
212}
213
214//****** Columns and Article Same Sizing ******
215function scanColumnsSizings() {
216//console.log("scanning column sizings...");
217	for(var i=0; i<arr_articles_id_nums.length; i++) {
218//console.log("i=" + i);
219		var $article = $( ".art-js-content.article_" + arr_articles_id_nums[i] );
220		var $left_sidebar = $( ".left_sidebar_" + arr_articles_id_nums[i] );
221		var $right_sidebar = $( ".right_sidebar_" + arr_articles_id_nums[i] );
222		var $top_article_banner = $( ".top_article_banner_" + arr_articles_id_nums[i] );
223		var top_article_banner_height = 0;
224		if ($top_article_banner.length !== 0) {
225			top_article_banner_height = $top_article_banner.height();
226		}
227//console.log("top_article_banner_height=" + top_article_banner_height);
228		var left_sidebar_height = 0;
229		if ($left_sidebar.length !== 0) {
230			left_sidebar_height = $left_sidebar.height();
231		}		
232//console.log("article_id=" + arr_articles_id_nums[i]);
233//console.log("article_height=" + $article.height());
234//console.log("article=" + $article);
235//console.log("left_sidebar_height=" + left_sidebar_height);
236//console.log("right_sidebar_height=" + $right_sidebar.height());
237
238		var max_height = Math.max($article.height(), left_sidebar_height - top_article_banner_height, $right_sidebar.height() );
239//console.log("max_height_" + arr_articles_id_nums[i] + "=" + max_height);
240		if ( max_height > arr_max_column_height[arr_articles_id_nums[i]] ) {
241//console.log("new_max_height_" + arr_articles_id_nums[i] + "=" + max_height);
242//console.log("old max-height " + arr_articles_id_nums[i] + '=' + arr_max_column_height[arr_articles_id_nums[i]]);
243//console.log("new max-height " + arr_articles_id_nums[i] + '=' + max_height);
244			arr_max_column_height[arr_articles_id_nums[i]] = max_height;
245//			$article.css('height', max_height );
246//console.log('max_height' + arr_articles_id_nums[i] + '=' + max_height);
247//console.log('top_article_banner_height' + arr_articles_id_nums[i] + '=' + top_article_banner_height);
248			var tmp_height = max_height + top_article_banner_height;
249			$left_sidebar.css('height', tmp_height);
250//console.log('set_height' + arr_articles_id_nums[i] + '=' + tmp_height);
251			$right_sidebar.css('height', max_height );
252		}
253	}
254}
255//*********************************************
256
257
258//****** Left Column Popular Blocks Floating ******
259function scanLeftColumnFloatingBlocksPosition() {
260	if (flagIE) {
261	for(var i=0; i<arr_articles_id_nums.length; i++) {
262		if ($( ".left_sidebar_" + arr_articles_id_nums[i] + " .left_sidebar_floating_start" ).length !== 0) {
263			var $left_sidebar = $( ".left_sidebar_" + arr_articles_id_nums[i] );
264			var $left_sidebar_popular = $( ".left_sidebar_" + arr_articles_id_nums[i] + " .left_column_popular_wrapper" );
265			var $left_sidebar_floating_start = $( ".left_sidebar_" + arr_articles_id_nums[i] + " .left_sidebar_floating_start" );
266//console.log("$left_sidebar_floating_start=" + ".left_sidebar_" + arr_articles_id_nums[i] + " .left_sidebar_floating_start" );
267			var $left_sidebar_floating_end = $( ".left_sidebar_" + arr_articles_id_nums[i] + " .left_sidebar_floating_end" );
268
269			if ( !$left_sidebar_popular.hasClass("popular_fixed") ) {
270				if ( window_scroll_top >= $left_sidebar_floating_start.offset().top - 70 ) {
271					$left_sidebar_popular.addClass('popular_fixed');
272//console.log(arr_articles_id_nums[i] + " left_sidebar_popular is fixed!");
273				}		
274			} else {
275				if ( window_scroll_top < ( $left_sidebar_floating_start.offset().top - 70 ) ) {
276					$left_sidebar_popular.removeClass('popular_fixed');
277//console.log(arr_articles_id_nums[i] + " left_sidebar_popular is NOT fixed!");
278				}	
279			}
280
281			if ( !$left_sidebar_popular.hasClass("popular_bottom_fixed") ) {
282				if ( window_scroll_top >= ( $left_sidebar_floating_end.offset().top - $left_sidebar_popular.height() - 70 ) ) {
283					$left_sidebar_popular.addClass('popular_bottom_fixed');
284//console.log(arr_articles_id_nums[i] + " left_sidebar_popular is bottom_fixed!");
285				}
286			} else {
287				if ( window_scroll_top < ( $left_sidebar_floating_end.offset().top - $left_sidebar_popular.height() - 70 ) ) {
288					$left_sidebar_popular.removeClass('popular_bottom_fixed');
289//console.log(arr_articles_id_nums[i] + " left_sidebar_popular is NOT bottom_fixed!");
290				}
291			}
292		}
293	}
294	}
295}
296//*************************************************
297
298
299//****** Right Column Banners Floating ******
300function scanRightColumnFloatingBlocksPosition() {
301//	if (flagIE) {
302	if (false) {
303	for(var i=0; i<arr_articles_id_nums.length; i++) {
304		var $right_sidebar = $( ".right_sidebar_" + arr_articles_id_nums[i] );
305		var $right_sidebar_banner_floater = $( ".right_sidebar_" + arr_articles_id_nums[i] + " .banner_floater" );
306		var $right_sidebar_floating_start = $( ".right_sidebar_" + arr_articles_id_nums[i] + " .right_sidebar_floating_start" );
307		var $right_sidebar_floating_end = $( ".right_sidebar_" + arr_articles_id_nums[i] + " .right_sidebar_floating_end" );
308		var $right_sidebar_bottom_blocks = $( ".right_sidebar_" + arr_articles_id_nums[i] + " .bottom_blocks" );
309
310
311		
312		//+++++++ фиксация всей колонки на 3 секунды когда доходит до баннера в правой колонке на котором идет фиксация +++++++
313		//----------------- АЛГОРИТМ -----------------
314		//при фиксации колонки на баннере у дива может быть 3 состояния, которые задаются классами, и маржином
315		//0. в самом начале у $right_sidebar_all_column_fixer классов никаких нет
316
317		//--- пользователь скроллит вниз:
318		//1. когда доскролливают до $right_sidebar_all_column_fixer_floating_start то $right_sidebar_all_column_fixer добавляем класс is_fixed и запоминаем время фиксации колонки, чтобы ждать 3 секунды, фиксатор колонки становится position: fixed
319		//2. по прошествию 3х секунд у $right_sidebar_all_column_fixer убираем класс is_fixed и добавляем класс already_was_fixed, запоминаем позицию окончания фиксации колонки, фиксатор колонки становится position: relative и делаем в колонке отступ сверху стилем margin-top или просто top расстоянию которое проехала колонка за время 3х секундной фиксации (чтобы баннер не скакнул при прекращении фиксации) и ставим flagNeedControlFloatingBanner = true; означающий что надо уже контролировать и более нижние фиксированные 2 баннера 300х300
320
321		//--- пользователь скроллит вверх:
322		//1. когда доскралливают до запомненной позиции окончания фиксации то убираем класс already_was_fixed, добавляем класс is_fixed, и убираем в стилях в колонке margin-top или top, фиксатор колонки меняем position: relative снова на position: absolute
323		//2. когда доскралливают до запомненной позиции $right_sidebar_all_column_fixer_floating_start, то убираем класс is_fixed и position: fixed у фиксатора колнки, все вернулось в начальное состояние
324
325		// Все усложняется еще тем что при трехсекундной фиксации мы должны следить чтобы нижняя часть фиксируемой колонки не вылезла за пределы нижней части блока статьи, и если это произошло, то досрочно завершить фиксацию, запомнив окончание фиксации в тот момент когда нижняя часть фиксатора колонки уперлась в нижнюю часть статьи!
326
327
328
329		//----------------- ФИКСАЦИЯ ПЕРВОГО БАННЕРА (вместе со всей оставшейся частью колонки кроме низа колонки ) -----------------
330		var flagNeedControlFloatingBanner = false;
331		var $right_sidebar_all_column_fixer = $( ".right_sidebar_" + arr_articles_id_nums[i] + " .right_sidebar_all_column_fixer" );
332		var $right_sidebar_all_column_fixer_floating_start = $( ".right_sidebar_" + arr_articles_id_nums[i] + " .right_sidebar_all_column_fixer_floating_start" );
333		var $right_sidebar_banner_3sec_floater = $( ".right_sidebar_" + arr_articles_id_nums[i] + " .banner_3sec_floater" );
334
335console.log('$right_sidebar_all_column_fixer.height()=' + $right_sidebar_all_column_fixer.height());
336console.log('$right_sidebar_floating_end.offset().top=' + $right_sidebar_floating_end.offset().top);
337console.log('$right_sidebar_all_column_fixer_floating_start.offset().top=' + $right_sidebar_all_column_fixer_floating_start.offset().top);
338console.log($right_sidebar_floating_end.offset().top - $right_sidebar_all_column_fixer_floating_start.offset().top - $right_sidebar_all_column_fixer.height() + 'px');
339
340		if ( $right_sidebar_all_column_fixer.length !== 0 && $right_sidebar_all_column_fixer_floating_start.length !== 0 && $right_sidebar_banner_3sec_floater.length !== 0) {	//проверяем, что все элементы участвующие в залипании колонки имеются в DOM
341			var time_now = new Date().getTime();
342			if (lastScrollTopPosition <= $(document).scrollTop()) {
343				//+++значит скроллим вниз или вообще не скроллим				
344				if ( $right_sidebar_all_column_fixer.hasClass("already_was_fixed") ) {
345					//***стадия2 (3 секи фиксации уже прошли и фиксация колонки закончилась, передаем контроль фиксаторам следующих далее 2х залипающих баннеров 300x300)
346					flagNeedControlFloatingBanner = true;
347				} else {
348					if ( $right_sidebar_all_column_fixer.hasClass("is_fixed") ) {
349						//***стадия1 (идет фиксация на 3 секи)
350						//проверяем, прошло ли уже 3 секунды с начала фиксации колонки, и если прошло то добавляем класс already_was_fixed
351						if (time_now - Number.parseInt(arr_all_column_fixer_time_of_fixing[arr_articles_id_nums[i]]) > 1000) {
352							arr_all_column_fixer_pos_top_of_fixing[arr_articles_id_nums[i]] = Number.parseInt(window_scroll_top); //запомнили позицию когда кончилась фиксация баннера
353							$right_sidebar_all_column_fixer.removeClass("is_fixed");
354							//добавляем top) в фиксере колонки $right_sidebar_all_column_fixer соответсвующий растоянию которое он прополз за 3 секунды
355							$right_sidebar_all_column_fixer.addClass("already_was_fixed");
356							$right_sidebar_all_column_fixer.css('position', 'absolute');
357							$right_sidebar_all_column_fixer.css('top', arr_all_column_fixer_pos_top_of_fixing[arr_articles_id_nums[i]] - $right_sidebar_all_column_fixer_floating_start.offset().top + 70 + $right_sidebar_banner_3sec_floater.height() + 'px');
358						} else {
359/*
360							if (window_scroll_top + 70 + $right_sidebar_all_column_fixer.height() >= $right_sidebar_floating_end.offset().top) {			
361								//значит в то время когда вся колонка с банером была зафиксирована - мы вылезли за пределы колонки! надо остановить фиксацию и сделать все прижатым к низу!
362//console.log('aaaaaaaaaaaaaaa');
363//console.log('aaaaaaaaaaaaaaa $right_sidebar_all_column_fixer.height()=' + $right_sidebar_all_column_fixer.height());
364//console.log('aaaaaaaaaaaaaaa $right_sidebar_floating_end.offset().top=' + $right_sidebar_floating_end.offset().top);
365//console.log('aaaaaaaaaaaaaaa $right_sidebar_all_column_fixer_floating_start.offset().top=' + $right_sidebar_all_column_fixer_floating_start.offset().top);
366//console.log($right_sidebar_floating_end.offset().top - $right_sidebar_all_column_fixer_floating_start.offset().top - $right_sidebar_all_column_fixer.height() + 'px');
367
368								$right_sidebar_all_column_fixer.removeClass("is_fixed");
369								//добавляем top) в фиксере колонки $right_sidebar_all_column_fixer соответсвующий растоянию которое он прополз за 3 секунды
370								$right_sidebar_all_column_fixer.addClass("already_was_fixed");
371								$right_sidebar_all_column_fixer.css('position', 'absolute');
372								$right_sidebar_all_column_fixer.css('top', $right_sidebar_floating_end.offset().top - $right_sidebar_all_column_fixer_floating_start.offset().top - $right_sidebar_all_column_fixer.height() + 'px');
373
374							}
375*/
376						}
377					} else {
378						//***стадия0 (фиксация колонки еще не начиналась)
379						if ( window_scroll_top >= $right_sidebar_all_column_fixer_floating_start.offset().top - 70 ) {
380							//значит доскроллили вниз до div right_sidebar_all_column_fixer_floating_start, начинаем фиксацию всей колонки
381							arr_all_column_fixer_time_of_fixing[arr_articles_id_nums[i]] = time_now; //запомнили время когда началась фиксация баннера
382							$right_sidebar_all_column_fixer.addClass('is_fixed');
383							$right_sidebar_all_column_fixer.css('position', 'fixed');
384							$right_sidebar_all_column_fixer.css('top', '70px');
385						}						
386					}
387				}
388			} else {
389				//+++значит скроллим вверх
390				if ( $right_sidebar_all_column_fixer.hasClass("already_was_fixed") ) {
391					if ( window_scroll_top <= arr_all_column_fixer_pos_top_of_fixing[arr_articles_id_nums[i]]) {
392						//значит скроллят вверх, и доскроллили до места где прекратилась фиксация 3х секундная, фиксим снова баннер
393console.log('aaa');
394						$right_sidebar_all_column_fixer.removeClass("already_was_fixed");
395						$right_sidebar_all_column_fixer.addClass("is_fixed");
396						$right_sidebar_all_column_fixer.css('position', 'fixed');
397						$right_sidebar_all_column_fixer.css('top', '70px');
398					} else {
399						flagNeedControlFloatingBanner = true;
400					}
401				} else {
402					if ( $right_sidebar_all_column_fixer.hasClass("is_fixed") ) {
403						if (window_scroll_top <= $right_sidebar_all_column_fixer_floating_start.offset().top) {
404console.log('bbb');
405							//значит скроллят вверх, и доскроллили до места где стоял $right_sidebar_all_column_fixer_floating_start
406							$right_sidebar_all_column_fixer.removeClass("is_fixed");
407							$right_sidebar_all_column_fixer.css('position', 'relative');
408							$right_sidebar_all_column_fixer.css('top', 'auto');
409						} 
410					} else {
411					}
412				}
413			}
414		} else {
415			flagNeedControlFloatingBanner = true;
416		}
417		//---------------------------------------------------------------------------------------------------------------------------
418		
419
420
421//var flagNeedControlFloatingBanner = false;
422//console.log('flagNeedControlFloatingBanner=' + flagNeedControlFloatingBanner);
423		//----------------- ФИКСАЦИЯ ВТОРОГО БАННЕРА -----------------
424		if ( flagNeedControlFloatingBanner && $right_sidebar_banner_floater.length !== 0 ) {
425//console.log("$right_sidebar_banner_floater=" + ".right_sidebar_" + arr_articles_id_nums[i] + " .banner_floater" );
426			if (lastScrollTopPosition <= $(document).scrollTop()) {
427				//+++значит скроллим вниз или вообще не скроллим				
428				if ( $right_sidebar_banner_floater.hasClass("banner_floater_bottom_fixed") ) {
429					//***стадия2 баннер прижат к низу колонки
430				} else {
431					if ( $right_sidebar_banner_floater.hasClass("banner_floater_fixed") ) {
432						//***стадия1 баннер зафиксирован
433						if ( window_scroll_top >= ( $right_sidebar_floating_end.offset().top - $right_sidebar_banner_floater.height() - 70 - 10 ) ) {
434							$right_sidebar_banner_floater.removeClass('banner_floater_fixed');
435
436							$right_sidebar_banner_floater.addClass('banner_floater_bottom_fixed');
437							$right_sidebar_banner_floater.css('position', 'absolute');
438//							$right_sidebar_banner_floater.css('top', $right_sidebar_floating_end.offset().top - $right_sidebar.offset().top - $right_sidebar_banner_floater.height() - 20 );
439							$right_sidebar_banner_floater.css('top', $right_sidebar_floating_end.offset().top - $right_sidebar.offset().top - $right_sidebar_banner_floater.height() - 10 - (arr_all_column_fixer_pos_top_of_fixing[arr_articles_id_nums[i]] - $right_sidebar_all_column_fixer_floating_start.offset().top + 70 + $right_sidebar_banner_3sec_floater.height()) );
440						}
441					} else {
442						//***стадия0 (фиксация баннера еще не начиналась)
443						if ( window_scroll_top >= $right_sidebar_floating_start.offset().top - 70 ) {
444							$right_sidebar_banner_floater.addClass('banner_floater_fixed');
445							$right_sidebar_banner_floater.css('position', 'fixed');
446							$right_sidebar_banner_floater.css('top', '70px');
447						}
448					}
449				}
450			} else {
451//console.log('scroll up');
452				//+++значит скроллим вверх
453				if ( $right_sidebar_banner_floater.hasClass("banner_floater_bottom_fixed") ) {
454					if ( window_scroll_top <= $right_sidebar_floating_end.offset().top - $right_sidebar_banner_floater.height() - 70 - 20 ) {
455						$right_sidebar_banner_floater.removeClass('banner_floater_bottom_fixed');
456						$right_sidebar_banner_floater.addClass('banner_floater_fixed');
457						$right_sidebar_banner_floater.css('position', 'fixed');
458						$right_sidebar_banner_floater.css('top', '70px');
459					}
460				} else {
461					if ( $right_sidebar_banner_floater.hasClass("banner_floater_fixed") ) {
462						if ( window_scroll_top < ( $right_sidebar_floating_start.offset().top - 70 ) ) {
463							$right_sidebar_banner_floater.removeClass('banner_floater_fixed');
464							$right_sidebar_banner_floater.css('position', 'relative');
465							$right_sidebar_banner_floater.css('top', 'auto');
466						}
467					} else {
468					}
469				}
470			}
471		//------------------------------------------------------------
472		
473			
474
475/*
476			if ( !$right_sidebar_banner_floater.hasClass("banner_floater_fixed") ) {
477				if ( window_scroll_top >= $right_sidebar_floating_start.offset().top - 70 ) {
478					$right_sidebar_banner_floater.addClass('banner_floater_fixed');
479					$right_sidebar_banner_floater.css('position', 'fixed');
480					$right_sidebar_banner_floater.css('top', '70px');
481//console.log(arr_articles_id_nums[i] + " right_sidebar banner_floater is fixed!");
482				}		
483			} else {
484				if ( window_scroll_top < ( $right_sidebar_floating_start.offset().top - 70 ) ) {
485					$right_sidebar_banner_floater.removeClass('banner_floater_fixed');
486					$right_sidebar_banner_floater.css('position', 'relative');
487					$right_sidebar_banner_floater.css('top', 'auto');
488//console.log(arr_articles_id_nums[i] + " right_sidebar banner_floater is NOT fixed!");
489				}	
490			}
491
492			if ( !$right_sidebar_banner_floater.hasClass("banner_floater_bottom_fixed") && $right_sidebar_bottom_blocks.height() > 10) {
493				if ( window_scroll_top >= ( $right_sidebar_floating_end.offset().top - $right_sidebar_banner_floater.height() - 70 - 20 ) ) {
494					$right_sidebar_banner_floater.addClass('banner_floater_bottom_fixed');
495					$right_sidebar_banner_floater.css('position', 'absolute');
496					$right_sidebar_banner_floater.css('top', $right_sidebar_floating_end.offset().top - $right_sidebar.offset().top - $right_sidebar_banner_floater.height() - 20 );
497//console.log("$right_sidebar_bottom_blocks.height()=" + $right_sidebar_bottom_blocks.height());
498//console.log(arr_articles_id_nums[i] + " right_sidebar banner_floater is bottom_fixed!");
499				}
500			} else {
501				if ( window_scroll_top < ( $right_sidebar_floating_end.offset().top - $right_sidebar_banner_floater.height() - 70 - 20 ) ) {
502					$right_sidebar_banner_floater.removeClass('banner_floater_bottom_fixed');
503//					$right_sidebar_banner_floater.css('position', 'fixed');
504//					$right_sidebar_banner_floater.css('top', '70px');
505					$right_sidebar_banner_floater.css('top', '');
506//					console.log(arr_articles_id_nums[i] + " right_sidebar banner_floater is NOT bottom_fixed!");
507
508				}
509			}
510*/
511
512
513/*
514			if ( !$right_sidebar.hasClass("banner_floater_too_big") ) {
515//console.log("$right_sidebar_floating_end.offset().top=" + $right_sidebar_floating_end.offset().top);
516//console.log("$right_sidebar_floating_start.offset().top=" + $right_sidebar_floating_start.offset().top);
517//console.log("$right_sidebar_banner_floater.height()=" + $right_sidebar_banner_floater.height());
518//				if ( $right_sidebar_floating_end.offset().top < $right_sidebar_floating_start.offset().top + $right_sidebar_banner_floater.height() && ($right_sidebar_floating_end.offset().top - $right_sidebar_floating_start.offset().top > 10)  ) {
519				if ( $right_sidebar_floating_end.offset().top < $right_sidebar_floating_start.offset().top + $right_sidebar_banner_floater.height() ) {
520					$right_sidebar.addClass('banner_floater_too_big');
521//console.log(arr_articles_id_nums[i] + " right_sidebar banner_floater is too big!!!!");
522//console.log("$right_sidebar_floating_start.offset().top=" + $right_sidebar_floating_start.offset().top);
523//console.log("$right_sidebar_banner_floater.height()=" + $right_sidebar_banner_floater.height());
524//console.log("$right_sidebar_floating_end.offset().top=" + $right_sidebar_floating_end.offset().top);
525					$right_sidebar.css('height', 'auto');
526//					$( ".art-content.article_" + arr_articles_id_nums[i] ).css('height', $right_sidebar.height());
527//					if ($right_sidebar.height() > 1000 ) {
528//						$( ".art-js-content.article_" + arr_articles_id_nums[i] ).css('height', $right_sidebar.height());
529//					}
530				}
531			} else {
532				if ( $right_sidebar_floating_end.offset().top > $right_sidebar_floating_start.offset().top + $right_sidebar_banner_floater.height() ) {
533					$right_sidebar.removeClass('banner_floater_too_big');
534//console.log(arr_articles_id_nums[i] + " right_sidebar banner_floater is NOT too big!");
535				}
536			}
537*/
538
539		}
540	}
541	}
542}
543//*******************************************
544
545
546//****** Under Article Partner Banners Floating ******
547function scanUnderArticleFloatingBlocksPosition() {	
548	for(var i=0; i<arr_articles_id_nums.length; i++) {
549		if (flagIE) {
550		if ($( ".article_bottom_divider.article_" + arr_articles_id_nums[i] + " .under_article_floating_start" ).length !== 0) {
551			var $under_article_floating_block = $( ".article_bottom_divider.article_" + arr_articles_id_nums[i] + " .my-widget-anchor-wrapper" );
552			var $under_article_floating_start = $( ".article_bottom_divider.article_" + arr_articles_id_nums[i] + " .under_article_floating_start" );
553//console.log("$under_article_floating_start=" + ".article_bottom_divider.article_" + arr_articles_id_nums[i] + " .under_article_floating_start" );
554			var $under_article_floating_end = $( ".article_bottom_divider.article_" + arr_articles_id_nums[i] + " .under_article_floating_end" );
555
556			if ( $( ".article_bottom_divider.article_" + arr_articles_id_nums[i] + " .left_column .under_article_left_column_end" ).offset().top >= $( ".article_bottom_divider.article_" + arr_articles_id_nums[i] + " .right_column .under_article_floating_end" ).offset().top ) {
557				if ( !$under_article_floating_block.hasClass("under_article_fixed") ) {
558					if ( window_scroll_top >= $under_article_floating_start.offset().top - 70 ) {
559						$under_article_floating_block.addClass('under_article_fixed');
560//console.log(arr_articles_id_nums[i] + " under_article_floating_block is fixed!");
561					}		
562				} else {
563					if ( window_scroll_top < ( $under_article_floating_start.offset().top - 70 ) ) {
564						$under_article_floating_block.removeClass('under_article_fixed');
565//console.log(arr_articles_id_nums[i] + " under_article_floating_block is NOT fixed!");
566					}	
567				}
568
569				if ( !$under_article_floating_block.hasClass("under_article_bottom_fixed") ) {
570					if ( window_scroll_top >= ( $under_article_floating_end.offset().top - $under_article_floating_block.height() - 70 ) ) {
571						$under_article_floating_block.addClass('under_article_bottom_fixed');
572//console.log(arr_articles_id_nums[i] + " under_article_floating_block is bottom_fixed!");
573					}
574				} else {
575					if ( window_scroll_top < ( $under_article_floating_end.offset().top - $under_article_floating_block.height() - 70 ) ) {
576						$under_article_floating_block.removeClass('under_article_bottom_fixed');
577//console.log(arr_articles_id_nums[i] + " under_article_floating_block is NOT bottom_fixed!");
578					}
579				}
580			}
581		}
582		}
583
584		if ($( ".article_bottom_divider.article_" + arr_articles_id_nums[i] + " .article_next_wrapper" ).length !== 0) {
585			var mob_correction = 0;
586			if (document.body.clientWidth <= 780) {
587				mob_correction = 500;
588				if ($( ".flag_this_is_test_article_" + arr_articles_id_nums[i] ).length !== 0) {
589					$( ".article_bottom_divider.article_" + arr_articles_id_nums[i] + " .article_next_wrapper" ).addClass("hide_in_mob_version");
590				}
591			}
592			var $under_article_block = $( ".article_bottom_divider.article_" + arr_articles_id_nums[i] );
593			var $floating_article_next_button = $( ".article_bottom_divider.article_" + arr_articles_id_nums[i] + " .article_next_wrapper .article_next" );
594//			if ( window_scroll_top + $(window).height() >= $under_article_block.offset().top + 140 ) {
595			if ( window_scroll_top + $(window).height() >= $under_article_block.offset().top - 340 - mob_correction) {
596//			if ( window_scroll_top + $(window).height() >= $under_article_block.offset().top - 380 - mob_correction) {
597				if ( !$floating_article_next_button.hasClass("article_next_fixed") ) {
598					$floating_article_next_button.addClass('article_next_fixed');
599				}
600			} else {
601				if ( $floating_article_next_button.hasClass("article_next_fixed") ) {
602					$floating_article_next_button.removeClass('article_next_fixed');
603				}
604			}
605//			if ( window_scroll_top + $(window).height() >= $under_article_block.offset().top + $under_article_block.height() - 30 ) {
606			if ( window_scroll_top + $(window).height() >= $under_article_block.offset().top + $under_article_block.height() + 150 ) {
607				if ( !$floating_article_next_button.hasClass("article_next_invisible") ) {
608					$floating_article_next_button.addClass('article_next_invisible');
609				}
610			} else {
611				if ( $floating_article_next_button.hasClass("article_next_invisible") ) {
612					$floating_article_next_button.removeClass('article_next_invisible');
613				}
614			}
615		}
616	}
617}
618//****************************************************
619
620
621//****** Ajax Articles Cover Opacity ******
622function scanAjaxArticlesCover() {
623	for(var i=1; i<arr_articles_id_nums.length; i++) {
624		if ( $( ".cover_of_article_" + arr_articles_id_nums[i] ).length !== 0 ) {
625			var article_cover_opacity = 1;
626			var $article_cover = $( ".cover_of_article_" + arr_articles_id_nums[i] );
627console.log('window_scroll_top=' + window_scroll_top + ', $article_cover.offset().top=' + $article_cover.offset().top + ', $(window).height()=' + $(window).height());
628			if ( window_scroll_top >= $article_cover.offset().top - $(window).height() ) {
629//				article_cover_opacity = (window_scroll_top - $article_cover.offset().top) / $(window).height();
630				article_cover_opacity = (window_scroll_top + $(window).height()/4 - $article_cover.offset().top) / $(window).height();
631console.log('article_cover_opacity=' + article_cover_opacity);
632				if (article_cover_opacity <= 0) {
633					article_cover_opacity = -article_cover_opacity;
634					$article_cover.css('opacity', article_cover_opacity);
635				} else {
636console.log('article_cover_opacity=display:none;');
637					$article_cover.css('display', 'none');
638				}
639			}
640		}
641	}
642}
643//*****************************************
644
645
646//****** Top Menu Panels Fixing ******
647function scanTopMenuPanelsFixing() {
648//	console.log("scanTopMenuPanelsFixing!!!");
649	if (document.body.clientWidth >= 1081) {
650		if ( $( '.art-js-content' ).attr( "data-title" ) || $('.section_wrapper').length !== 0 || $('.with_floated_banners').length !== 0 ) {
651			var top = $(document).scrollTop();
652//console.log("top=" + top);
653//			var fixing_pos = $('.main_content').offset().top - 40;
654			var fixing_pos = $('.main_content').offset().top + 40;
655			var fixed_top_banner_starts_hiding = 130;
656//console.log("fixing_pos=" + fixing_pos);
657			if ( top >= fixing_pos  && scroll_direction == 'down') {
658				$('.global-top-menu2').css('opacity', 0);
659				setTimeout(TopMenuFadeIn, 100);
660
661				$('.global-top-menus').addClass('fixed');
662				$("body").addClass('body_fixed_all_sections');
663			} else {
664/*
665				$('.global-top-menus').removeClass('fixed');
666				$("body").removeClass('body_fixed_all_sections');
667
668				$('.global-top-menu2').removeClass('fadeInMenu');
669				$('.global-top-menu2').css('opacity', '');
670*/
671			}
672			if ( top >= fixed_top_banner_starts_hiding ) {
673				$("body").addClass('body_fixed_top_banner_starts_hiding');
674			} else {
675				$("body").removeClass('body_fixed_top_banner_starts_hiding');
676			}
677		}
678	} else {
679		var top = $(document).scrollTop();
680//		var fixing_pos = $('.top_menu_scrolled_wrapper_stripe').offset().top;
681		var fixing_pos = 130;
682//		if ($("body").hasClass('body_fixed_mobil_menu')) {
683//			fixing_pos = 170;
684//		}
685//		console.log("fixing_pos=" + fixing_pos);
686//		if ( top >= fixing_pos ) {
687		if ( (top >= fixing_pos + 80) && (scroll_direction == 'down')) {
688			if ( !$("body").hasClass('body_fixed_mobil_menu') ) {
689				$("body").addClass('body_fixed_mobil_menu');
690				$('.global-top-menu2').css('opacity', 0);
691				setTimeout(TopMenuFadeIn, 100);
692			}
693		} else {
694/*
695			if ( $("body").hasClass('body_fixed_mobil_menu') ) {				
696				$("body").removeClass('body_fixed_mobil_menu');
697				$('.global-top-menu2').removeClass('fadeInMenu');
698				$('.global-top-menu2').css('opacity', '');
699			}
700*/
701		}
702	}
703}
704
705function TopMenuFadeIn() {
706	$('.global-top-menu2').addClass('fadeInMenu');
707}
708function unfixingOfFixedTopMenu() {
709	if (document.body.clientWidth >= 1081) {
710		if ( $( '.art-js-content' ).attr( "data-title" ) || $('.section_wrapper').length !== 0 || $('.with_floated_banners').length !== 0 ) {
711			$('.global-top-menus').removeClass('fixed');
712			$("body").removeClass('body_fixed_all_sections');
713		
714			$('.global-top-menu2').removeClass('fadeInMenu');
715			$('.global-top-menu2').css('opacity', '');
716		}
717	} else {
718		if ( $("body").hasClass('body_fixed_mobil_menu') ) {				
719			$("body").removeClass('body_fixed_mobil_menu');
720			$('.global-top-menu2').removeClass('fadeInMenu');
721			$('.global-top-menu2').css('opacity', '');
722		}
723	}
724}
725
726
727//************************************
728
729
730//********** Custom Scroll ***********
731/*
732(function($){
733	$(window).on("load",function(){
734		$(".scrolled").mCustomScrollbar({
735			scrollInertia: 150,
736//			autoHideScrollbar: true,
737			theme: "dark"
738		});
739	});
740})(jQuery);
741*/
742//************************************
743
744
745
746
747
748
749
750var arrSharingEmailFormState = [];
751var arrArticleEmailFormState = [];
752var arrArticleEmailForm2State = [];
753
754/* Printing Article Functions */
755function print_article(article_id) {
756	$("body").addClass('printStyles');
757//	$( "<p class='printInserts' style='float: left; margin-top: 3px;'><img src='{{ url static_file='_img/logos_names/logo_main.png' }}' /></p>" ).insertBefore( ".main-article.article_" + article_id );
758//	$( "<p class='printInserts' style='float: right;'><img src='{{ url static_file="_img/logos_names/$sitelogo/top_line.png" }}' /></p>" ).insertBefore( ".main-article.article_" + article_id );
759//	$( "<p class='printInserts' style='float: right;'><img src='https://www.ogorod.ru/themes/publication_15/theme_2/_img/logos_names/ogorod/top_line.png' /></p>" ).insertBefore( ".main-article.article_" + article_id );
760	$( "<p class='printInserts' style='clear: both; color: #aaa !important; padding: 10px 0 0;'>{{ url }}</p>" ).insertBefore( ".article_" + article_id );
761	$( ".article_" + article_id ).addClass("print_visible");
762	window.print();
763	window.setTimeout(pageCleaner(article_id), 0);
764}
765function pageCleaner(article_id){
766	$('body').removeClass('printStyles');
767	$('.printInserts').remove(); 
768	$( ".article_" + article_id ).removeClass("print_visible");
769	$('html, body').animate({
770		scrollTop: $( ".article_" + article_id ).offset().top -20
771	}, 1);
772}
773
774
775
776
777	/*************************** article on email sending function ******************************/
778	function ajaxArticleOnEmailSending(art_num, type) {
779//console.log('type=' + type);
780//console.log('ajaxArticleOnEmailSending!!!');
781		if (type === undefined) {
782			type = '';
783		}		
784		$(".article_" + art_num + " .MailMe_btn" + type).attr("disabled", true);
785		var ajaxLink = $(".article_" + art_num + " .emailForm" + type).attr('action');
786		$.post(ajaxLink, { form_name: $(".article_" + art_num + " .form_name" + type).val(), form_email: $(".article_" + art_num + " .form_email" + type).val(), send: "email" }).done(function( data ) {
787			ajaxPostResult = $($.parseHTML(data)).find(".ajaxEmailResult").html().trim();
788			$(".article_" + art_num + " .MailMe_btn" + type).attr("disabled", false);
789//console.log('ajaxPostResult=' + ajaxPostResult);
790			if (ajaxPostResult == 'Success') {
791				alertify.success("Письмо отправлено");
792				$(".article_" + art_num + " .email_form" + type).slideUp("fast");
793				if (type == "2" ){
794					arrArticleEmailForm2State[art_num] = 0;
795					arrSharingEmailFormState[art_num] = 0;
796				} else {
797					arrArticleEmailFormState[art_num] = 0;
798				}
799			} else {
800				alertify.error(ajaxPostResult);
801				$(".article_" + art_num + " .form_email" + type).focus();
802				$(".article_" + art_num + " .email_form" + type + " #form_email" + type + "-error").css("display","block");
803				$(".article_" + art_num + " .email_form" + type + " #form_email" + type + "-error").text("Пожалуйста, введите корректный емэйл");
804			}
805		});
806	}
807	/********************************************************************************************/
808
809
810	/*************************** article on email init function ******************************/
811	function ajaxArticleOnEmailInit(art_num) {
812//console.log('ajaxArticleOnEmailInit!!!');
813		/*++++++++++++ sharing hidden block email form validation ++++++++++++*/
814		$(".share_icons_wrapper.article_" + art_num + " .emailForm2, .article_" + art_num + " .emailForm2").validate({
815			rules: {
816				form_email2: {
817					required: true,
818					email: true
819				}
820			},
821			messages: {
822				form_email2: "Пожалуйста, введите корректный емэйл"
823			},
824			submitHandler: function(form) {
825//console.log("share email SEND art_num=" + art_num);
826				ajaxArticleOnEmailSending(art_num, "2");
827			}
828		});
829
830		$(".article_" + art_num + " .emailForm").validate({
831			rules: {
832				form_email: {
833					required: true,
834					email: true
835				}
836			},
837			messages: {
838				form_email: "Пожалуйста, введите корректный емэйл"
839			},
840			submitHandler: function(form) {
841//console.log("share email SEND art_num=" + art_num);
842				ajaxArticleOnEmailSending(art_num);
843			}
844		});
845
846
847		/*++++++++++++ sharing hidden block email form slidings ++++++++++++*/
848		$(".share_icons_wrapper.article_" + art_num + " .share_email").on("click", function(e) {
849			art_num = $(this).parents('.share_block').find('.share_icons_wrapper').attr('data_art_num');
850//console.log("share email CLICK art_num=" + art_num);
851			e.preventDefault();
852			if( arrSharingEmailFormState[art_num] == false ) {
853				$(".share_icons_wrapper.article_" + art_num +" .email_form2").slideDown("fast");
854				$(".share_icons_wrapper.article_" + art_num +" .form_name2").focus();
855				arrSharingEmailFormState[art_num] = 1;
856//				ga('send', 'event', 'button', 'click', 'email_article1_bottom');
857			} else {
858				$(".share_icons_wrapper.article_" + art_num +" .email_form2").slideUp("fast");
859				arrSharingEmailFormState[art_num] = 0;
860			}
861		})
862		
863		
864		/*++++++++++++ article email 2 forms ++++++++++++*/
865		$(".article_" + art_num + " .button_email").click(function(){
866			if( arrArticleEmailFormState[art_num] == 0 ) {
867				$(".article_" + art_num + " .email_form").slideDown("fast");
868				$(".article_" + art_num + " .form_name").focus();
869				arrArticleEmailFormState[art_num] = 1;
870//				ga('send', 'event', 'button', 'click', 'email_article1_top');
871			} else {
872				$(".article_" + art_num + " .email_form").slideUp("fast");
873				arrArticleEmailFormState[art_num] = 0;
874			}
875		})		
876		$(".article_" + art_num + " .button_email2").click(function(){
877			if( arrArticleEmailForm2State[art_num] == 0 ) {
878				$(".article_" + art_num + " .email_form2").slideDown("fast");
879				$(".article_" + art_num + " .form_name2").focus();
880				arrArticleEmailForm2State[art_num] = 1;
881//				ga('send', 'event', 'button', 'click', 'email_article1_bottom');
882			} else {
883				$(".article_" + art_num + " .email_form2").slideUp("fast");
884				arrArticleEmailForm2State[art_num] = 0;
885			}
886		})
887
888		$(".article_" + art_num + " .email_form .close").click(function(){
889			$(".article_" + art_num + " .email_form").slideUp("fast");
890			arrArticleEmailFormState[art_num] = 0;
891		})
892		$(".article_" + art_num + " .email_form2 .close").click(function(){
893			$(".article_" + art_num + " .email_form2").slideUp("fast");
894			arrArticleEmailForm2State[art_num] = 0;
895		})
896		
897		$(".article_" + art_num + " .email_form").keydown(function(e) {
898			if ($(".article_" + art_num + " .email_form").is(':visible')) {
899				if( e.keyCode === 27 ) {
900					$(".article_" + art_num + " .email_form").slideUp("fast");
901					arrArticleEmailFormState[art_num] = 0;
902				}
903			}
904		});
905		$(".article_" + art_num + " .email_form2").keydown(function(e) {
906			if ($(".article_" + art_num + " .email_form2").is(':visible')) {
907				if( e.keyCode === 27 ) {
908					$(".article_" + art_num + " .email_form2").slideUp("fast");
909					arrArticleEmailForm2State[art_num] = 0;
910				}
911			}
912		});
913		/*+++++++++++++++++++++++++++++++++++++++++++++++*/
914
915
916		/*++++++++++++ article printing ++++++++++++*/
917		$(".article_" + art_num + " .button_printer.topmenu").click(function(){
918			print_article(art_num);
919//			ga('send', 'event', 'button', 'click', 'print_article1_top');
920		})
921		$(".article_" + art_num + " .button_printer.bottommenu").click(function(){
922			print_article(art_num);
923//			ga('send', 'event', 'button', 'click', 'print_article1_bottom');
924		})
925		/*++++++++++++++++++++++++++++++++++++++++++*/
926		
927		
928
929		/*++++++++++++ sharing hidden block email form keys ++++++++++++*/
930		$(".share_icons_wrapper.article_" + art_num + " .email_form2").keydown(function(e) {
931			art_num = $(this).parents('.share_block').find('.share_icons_wrapper').attr('data_art_num');
932//console.log("share email KEY art_num=" + art_num);
933			if ($(".article_" + art_num +" .email_form2").is(':visible')) {
934				if( e.keyCode === 27 ) {
935					$(".article_" + art_num +" .email_form2").slideUp("fast");
936					arrSharingEmailFormState[art_num] = 0;
937					//isEmailFormDown2_{{ $art_num }} = false;
938					return false;
939				}
940			}
941		});
942
943		/*++++++++++++ sharing hidden block email form close icons ++++++++++++*/
944		$(".share_icons_wrapper.article_" + art_num + " .close").on("click", function(e) {
945			art_num = $(this).parents('.share_block').find('.share_icons_wrapper').attr('data_art_num');
946//console.log("share CLOSE CLICK art_num=" + art_num);
947			if ($(".article_" + art_num +" .email_form2").is(':visible')) {
948				$(".article_" + art_num +" .email_form2").slideUp("fast");
949				arrSharingEmailFormState[art_num] = 0;
950				return false;
951			}
952		})
953
954		/*++++++++++++ article top hidden block email form close icons ++++++++++++*/
955/*
956		$(".share_icons_wrapper.article_" + art_num + " .close").on("click", function(e) {
957			art_num = $(this).parents('.share_block').find('.share_icons_wrapper').attr('data_art_num');
958//console.log("share CLOSE CLICK art_num=" + art_num);
959			if ($(".article_" + art_num +" .email_form2").is(':visible')) {
960				$(".article_" + art_num +" .email_form2").slideUp("fast");
961				arrSharingEmailFormState[art_num] = 0;
962				return false;
963			}
964		})
965*/
966	}
967	/*****************************************************************************************/
968
969
970	/*************************** Next Article Button Init Function ******************************/
971	function ajaxArticleNextButtonInit(art_num) {
972		var mob_correction = 0;
973		if (document.body.clientWidth <= 780) {
974			mob_correction = 40;
975		}
976		$('.article_bottom_divider.article_' + art_num + ' .article_next').click(function(){
977//			console.log("aaa");
978			var $container = $(this).parents('.article_bottom_divider');
979			$("body,html").animate({
980				scrollTop: $container.offset().top + $container.height() + 60 + mob_correction
981			}, 500);
982//			ga('send', 'event', 'button', 'click', 'next_article_button');
983		});
984	}
985	/*****************************************************************************************/
986
987
988function ClearArticleWritersErrors(data, form_id) {
989	var form_selector = '#' + form_id + '-popup';
990	$(form_selector + ' [feedback=1]').each(function (i, elem) {
991		if ((data.errors == undefined) || (data.errors[$(this).attr('name')] == undefined))
992		{
993			$(this).removeClass('error');
994			$(this).next().text('');
995		} else {
996			$(this).addClass('error');
997			$(this).next().text(data.errors[$(this).attr('name')]);
998		}
999		$(form_selector).css('height', 'auto');
1000		$(form_selector).css('margin-top', -$(form_selector).height()/2);
1001	});
1002}
1003
1004
1005
1006	/*************************** sharing social icons hidden article block init ******************************/
1007	(function($){$(function(){$('div.share42init_share_block').each(function(idx){var el=$(this),u=el.attr('data-url'),t=el.attr('data-title'),i=el.attr('data-image'),d=el.attr('data-description'),f=el.attr('data-path'),fn=el.attr('data-icons-file'),z=el.attr("data-zero-counter");if(!u)u=location.href;if(!fn)fn='icons.png';if(!z)z=0;if(!f){function path(name){var sc=document.getElementsByTagName('script'),sr=new RegExp('^(.*/|)('+name+')([#?]|$)');for(var p=0,scL=sc.length;p<scL;p++){var m=String(sc[p].src).match(sr);if(m){if(m[1].match(/^((https?|file)\:\/{2,}|\w:[\/\\])/))return m[1];if(m[1].indexOf("/")==0)return m[1];b=document.getElementsByTagName('base');if(b[0]&&b[0].href)return b[0].href+m[1];else return document.location.pathname.match(/(.*[\/\\])/)[0]+m[1];}}return null;}f=path('share42.js');}if(!t)t=document.title;if(!d){var meta=$('meta[name="description"]').attr('content');if(meta!==undefined)d=meta;else d='';}u=encodeURIComponent(u);t=encodeURIComponent(t);t=t.replace(/\'/g,'%27');i=encodeURIComponent(i);d=encodeURIComponent(d);d=d.replace(/\'/g,'%27');var vkImage='';if(i!='null'&&i!='')vkImage='&image='+i;var sss=new Array('Facebook','ВКонтакте','Одноклассники','Twitter','Google+','Постила');var s=new Array('"#" data-count="fb" onclick="window.open(\'//www.facebook.com/sharer/sharer.php?u='+u+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Поделиться в Facebook"','"#" data-count="vk" onclick="window.open(\'//vk.com/share.php?url='+u+'&title='+t+vkImage+'&description='+d+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Поделиться В Контакте"','"#" data-count="odkl" onclick="window.open(\'//ok.ru/dk?st.cmd=addShare&st._surl='+u+'&title='+t+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Добавить в Одноклассники"','"#" data-count="twi" onclick="window.open(\'//twitter.com/intent/tweet?text='+t+'&url='+u+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Добавить в Twitter"','"#" data-count="gplus" onclick="window.open(\'//plus.google.com/share?url='+u+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Поделиться в Google+"','"//postila.ru/publish/?url='+u+'&agregator=share42" title="Добавить в Постилу"');var l='';for(j=0;j<s.length;j++)l+='<span class="share42-item" style="display:inline-block;margin:0 6px 6px 0;
1007height:24px;"><a rel="nofollow" style="display:inline-block;width:24px;height:24px;margin:0;padding:0;outline:none;background:url('+f+fn+') -'+24*j+'px 0 no-repeat" href='+s[j]+' target="_blank"> <b class="share42-label">'+ sss[j] +'</b></a></span>';el.html('<span id="share42">'+l+'</span>'+'');})})})(jQuery);
1008	/*********************************************************************************************************/	
1009
1010	/*************************** sharing social icons article content init ******************************/
1011	function articleShareIconsInit(art_id) {
1012		(function($){$(function(){$('.article_' + art_id + ' div.share42init').each(function(idx){var el=$(this),u=el.attr('data-url'),t=el.attr('data-title'),i=el.attr('data-image'),d=el.attr('data-description'),f=el.attr('data-path'),fn=el.attr('data-icons-file'),z=el.attr("data-zero-counter");if(!u)u=location.href;if(!fn)fn='icons.png';if(!z)z=0;if(!f){function path(name){var sc=document.getElementsByTagName('script'),sr=new RegExp('^(.*/|)('+name+')([#?]|$)');for(var p=0,scL=sc.length;p<scL;p++){var m=String(sc[p].src).match(sr);if(m){if(m[1].match(/^((https?|file)\:\/{2,}|\w:[\/\\])/))return m[1];if(m[1].indexOf("/")==0)return m[1];b=document.getElementsByTagName('base');if(b[0]&&b[0].href)return b[0].href+m[1];else return document.location.pathname.match(/(.*[\/\\])/)[0]+m[1];}}return null;}f=path('share42.js');}if(!t)t=document.title;if(!d){var meta=$('meta[name="description"]').attr('content');if(meta!==undefined)d=meta;else d='';}u=encodeURIComponent(u);t=encodeURIComponent(t);t=t.replace(/\'/g,'%27');i=encodeURIComponent(i);d=encodeURIComponent(d);d=d.replace(/\'/g,'%27');var vkImage='';if(i!='null'&&i!='')vkImage='&image='+i;var s=new Array('"#" data-count="fb" onclick="window.open(\'//www.facebook.com/sharer/sharer.php?u='+u+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Поделиться в Facebook"','"#" data-count="vk" onclick="window.open(\'//vk.com/share.php?url='+u+'&title='+t+vkImage+'&description='+d+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Поделиться В Контакте"','"#" data-count="odkl" onclick="window.open(\'//ok.ru/dk?st.cmd=addShare&st._surl='+u+'&title='+t+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Добавить в Одноклассники"','"#" data-count="twi" onclick="window.open(\'//twitter.com/intent/tweet?text='+t+'&url='+u+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Добавить в Twitter"','"#" data-count="gplus" onclick="window.open(\'//plus.google.com/share?url='+u+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Поделиться в Google+"','"//postila.ru/publish/?url='+u+'&agregator=share42" title="Добавить в Постилу"');var l='';for(j=0;j<s.length;j++)l+='<span class="share42-item" style="display:inline-block;margin:0 6px 6px 0;height:16px;"><a rel="nofollow" style="display:inline-block;width:16px;height:16px;margin:0;padding:0;outline:none;background:url('+f+fn+') -'+16*j+'px 0 no-repeat" href='+s[j]+' target="_blank"></a></span>';el.html('<span id="share42">'+l+'</span>'+'');})})})(jQuery);
1013		(function($){$(function(){$('.article_' + art_id + ' div.share42init_big').each(function(idx){var el=$(this),u=el.attr('data-url'),t=el.attr('data-title'),i=el.attr('data-image'),d=el.attr('data-description'),f=el.attr('data-path'),fn=el.attr('data-icons-file'),z=el.attr("data-zero-counter");if(!u)u=location.href;if(!fn)fn='icons.png';if(!z)z=0;if(!f){function path(name){var sc=document.getElementsByTagName('script'),sr=new RegExp('^(.*/|)('+name+')([#?]|$)');for(var p=0,scL=sc.length;p<scL;p++){var m=String(sc[p].src).match(sr);if(m){if(m[1].match(/^((https?|file)\:\/{2,}
1013|\w:[\/\\])/))return m[1];if(m[1].indexOf("/")==0)return m[1];b=document.getElementsByTagName('base');if(b[0]&&b[0].href)return b[0].href+m[1];else return document.location.pathname.match(/(.*[\/\\])/)[0]+m[1];}}return null;}f=path('share42.js');}if(!t)t=document.title;if(!d){var meta=$('meta[name="description"]').attr('content');if(meta!==undefined)d=meta;else d='';}u=encodeURIComponent(u);t=encodeURIComponent(t);t=t.replace(/\'/g,'%27');i=encodeURIComponent(i);d=encodeURIComponent(d);d=d.replace(/\'/g,'%27');var vkImage='';if(i!='null'&&i!='')vkImage='&image='+i;var s=new Array('"#" data-count="fb" onclick="window.open(\'//www.facebook.com/sharer/sharer.php?u='+u+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Поделиться в Facebook"','"#" data-count="vk" onclick="window.open(\'//vk.com/share.php?url='+u+'&title='+t+vkImage+'&description='+d+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Поделиться В Контакте"','"#" data-count="odkl" onclick="window.open(\'//ok.ru/dk?st.cmd=addShare&st._surl='+u+'&title='+t+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Добавить в Одноклассники"','"#" data-count="twi" onclick="window.open(\'//twitter.com/intent/tweet?text='+t+'&url='+u+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Добавить в Twitter"','"#" data-count="gplus" onclick="window.open(\'//plus.google.com/share?url='+u+'\', \'_blank\', \'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0\');return false" title="Поделиться в Google+"','"//postila.ru/publish/?url='+u+'&agregator=share42" title="Добавить в Постилу"');var l='';for(j=0;j<s.length;j++)l+='<span class="share42-item" style="display:inline-block;margin:0 6px 6px 0;height:32px;"><a rel="nofollow" style="display:inline-block;width:32px;height:32px;margin:0;padding:0;outline:none;background:url('+f+fn+') -'+32*j+'px 0 no-repeat" href='+s[j]+' target="_blank"></a></span>';el.html('<span id="share42">'+l+'</span>'+'');})})})(jQuery);
1014		(function($){$(function(){$('.article_' + art_id + ' div.share42init_big.mob').each(function(idx){var el=$(this),u=el.attr('data-url'),t=el.attr('data-title'),i=el.attr('data-image'),d=el.attr('data-description'),f=el.attr('data-path'),fn=el.attr('data-icons-file'),z=el.attr("data-zero-counter");if(!u)u=location.href;if(!fn)fn='icons.png';if(!z)z=0;if(!f){function path(name){var sc=document.getElementsByTagName('script'),sr=new RegExp('^(.*/|)('+name+')([#?]|$)');for(var p=0,scL=sc.length;p<scL;p++){var m=String(sc[p].src).match(sr);if(m){if(m[1].match(/^((https?|file)\:\/{2,}|\w:[\/\\])/))return m[1];if(m[1].indexOf("/")==0)return m[1];b=document.getElementsByTagName('base');if(b[0]&&b[0].href)return b[0].href+m[1];else return document.location.pathname.match(/(.*[\/\\])/)[0]+m[1];}}return null;}f=path('share42.js');}if(!t)t=document.title;if(!d){var meta=$('meta[name="description"]').attr('content');if(meta!==undefined)d=meta;else d='';}u=encodeURIComponent(u);t=encodeURIComponent(t);t=t.replace(/\'/g,'%27');i=encodeURIComponent(i);d=encodeURIComponent(d);d=d.replace(/\'/g,'%27');var vkImage='';if(i!='null'&&i!='')vkImage='&image='+i;var s=new Array('"//postila.ru/publish/?url='+u+'&agregator=share42" title="Добавить в Постилу"');var l='';for(j=0;j<s.length;j++)l+='<span class="share42-item" style="display:inline-block;margin:0 6px 6px 0;height:32px;"><a rel="nofollow" style="display:inline-block;width:32px;height:32px;margin:0;padding:0;outline:none;background:url('+f+fn+') -'+32*j+'px 0 no-repeat" href='+s[j]+' target="_blank"></a></span>';el.html('<span id="share42">'+l+'</span>'+'');})})})(jQuery);
1015	}
1016
1017
1018
1019
1020
1021
1022
1023
1024	var art_id;
1025	var last_scroll = 0;
1026	var last_url_history = '';
1027	var scroll_direction = 'down';
1028	var ajax_loaded_articles_num_last = 0;
1029	/********************************************************************************************************************************************************/
1030	/*************************************************************** ALL SCROLL FUNCTIONS  ******************************************************************/
1031	/********************************************************************************************************************************************************/
1032	$(window).scroll(function(){
1033	    var scroll_pos = $(window).scrollTop();
1034		window_scroll_top = scroll_pos;
1035//	    var scroll_pos = $(document).scrollTop();
1036		/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
1037		/*++++++++++++++++++++++++++++++++++ Article Title changing on top panel  +++++++++++++++++++++++++++++++*/
1038//    	if ( Math.abs( scroll_pos - last_scroll ) > 400 ) {
1039    	if ( Math.abs( scroll_pos - last_scroll ) > 0 ) {
1040	    	if ( scroll_pos > last_scroll ) {
1041				scroll_direction = 'down';
1042			} else {
1043				scroll_direction = 'up';
1044				unfixingOfFixedTopMenu();
1045			}
1046	        last_scroll = scroll_pos;
1047    	    $( ".art-js-content" ).each( function() {
1048//            	var window_height = $( window ).height();
1049//console.log('$(window).height()=' + $(window).height());
1050	            var el_top = $( this ).offset().top - $(window).height()/2 - 100; //100 это высота фиксированного меню, меняем когда новая статья доскролится до середины высоты браузера
1051    	        var el_height = $( this ).height();
1052        	    var el_bottom = el_top + el_height;
1053//            	if ( ( el_bottom - el_height * 0.25 > scroll_pos ) && ( el_top < ( scroll_pos + 0.5 * window_height ) ) ) {
1054            	if ( ( scroll_pos > el_top ) && ( scroll_pos < el_bottom ) ) {
1055                	if ( last_url_history !== $( this ).attr( "data-url" ) && $( this ).attr( "data-url" ) !== undefined ) {
1056//console.log('!!! lazy article is changed !!!');
1057						art_id = $(this).attr('data-number');
1058    	                last_url_history = $( this ).attr( "data-url" );
1059        	            history.replaceState( null, null, $( this ).attr( "data-url" ) );
1060            	        $( "meta[property='og:title']" ).attr( 'content', $( this ).attr( "data-title" ) );
1061						if ( $( this ).attr( "data-title" ) ) {				
1062//	                	    $( "title" ).html( $( this ).attr( "data-title" ) + ' | ' + $( this ).attr( "data-issue" ) + ' (' + $( this ).attr( "data-publication" )  + ')' );
1063	                	    $( "title" ).html( $( this ).attr( "data-title" ) + ' | ' + $( this ).attr( "data-section" ) + ' (' + $( this ).attr( "data-publication" )  + ')' );
1064//console.log('bbbbbbbbb title is changed!');
1065//console.log("aaaaaaaaaaa0 mediator art_id=" + art_id);
1066/*
1067			if (typeof window._mediator !== "undefined") {
1068				if (window._mediator.isActive()) {
1069					window._mediator.stop();
1070//console.log( "aaaaaaaaaaaaaaaaaaa1 reInit js-mediator is stopped!!");
1071				}
1072				window._mediator.start( { 
1073					articleSelector: ".js-mediator-article_num_" + art_id,
1074					url: $( ".art-js-content.article_" + art_id  ).attr( "data-url" )
1075				} );
1076//console.log( "aaaaaaaaaaaaaaaaaaa2 reInit js-mediator is started!!");
1077//console.log( "aaaaaaaaaaaaaaaaaaa reInit js-mediator=" + $( ".art-js-content.article_" + art_id  ).attr( "data-url" ) );
1078//				window._mediator.stop();
1079//				window._mediator.start( { articleSelector: "js-mediator-article_num_" + art_id} );
1080			}
1081*/			
1082if (typeof (ym) === "function") {
1083	ym(32546320, 'hit', $(this).attr("data-url"));
1084	console.log("new YM hit URL=" + $(this).attr("data-url"));
1085}
1086						}
1087    	                $( "meta[property='og:url']" ).attr( 'content', $( this ).attr( "data-url" ) );
1088        	            $( "meta[property='og:description']" ).attr( 'content', $( this ).attr( "data-description" ) );
1089            	        $( "meta[property='og:image']" ).remove();
1090                	    $( 'head' ).append( '<meta property="og:image" content="">' );
1091                    	$( "meta[property='og:image']" ).attr( 'content', $( this ).attr( "data-img" ) );
1092//console.log('!!! lazy title=' + $( this ).attr( "data-title" ));
1093	                    $('h2.load_title, .h2.load_title').text($( this ).attr( "data-title" ));
1094
1095						if (typeof arr_articles_id_nums !== "undefined") {
1096							if ( scroll_direction == 'down' && arr_articles_id_nums.length > ajax_loaded_articles_num_last ) {
1097								ajax_loaded_articles_num_last = arr_articles_id_nums.length;
1098//								console.log('Refreshing FB comments.... last_url_history=' + last_url_history);
1099								//refresh FB comments content under article
1100								if (typeof FB !== "undefined") {		
1101									if ( FB.XFBML.length !== 0 ) {	
1102										FB.XFBML.parse();
1103									}
1104								}
1105							}
1106						}
1107	                }
1108	            }
1109	        } );
1110
1111	    }
1112		/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
1113
1114
1115		/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
1116		/*++++++++++++++++++++++++++++++++++ Top Menus Top Fixing when scrolling  +++++++++++++++++++++++++++++++*/
1117		if (document.body.clientWidth >= 1081) {
1118//			if ( $( '.art-js-content' ).attr( "data-title" ) || $('.section_wrapper').length !== 0 || $('.with_floated_banners').length !== 0 ) {
1119			if ( ($( '.art-js-content' ).length !== 0 && $( '.art-js-content' ).attr( "data-title" )) || $('.section_wrapper').length !== 0 || $('.with_floated_banners').length !== 0 ) {
1120				var posStop = $('.fix-front-menu').offset().top;
1121				if (scroll_pos >= posStop){
1122					$('.fix-front-menu').addClass('fixed');
1123					$("body").addClass('body_fixed_menu');
1124		            $('.head-scroll').addClass('fixed');
1125		            $('.search_header_panel').addClass('fixed');
1126				} else {
1127					$('.fix-front-menu').removeClass('fixed');
1128					$("body").removeClass('body_fixed_menu');
1129	    	        $('.head-scroll').removeClass('fixed');
1130	        	    $('.search_header_panel').removeClass('fixed');
1131				}
1132			}
1133			if ( $("#jump_top").length !== 0 ) {
1134				var $jump_top = $("#jump_top");
1135//				if ( $(this).scrollTop() > 200 && $jump_top.hasClass("default") ) {
1136				if ( scroll_pos > 200 && $jump_top.hasClass("default") ) {
1137					$jump_top.removeClass("default").addClass("fixed");
1138				} else if(scroll_pos <= 200 && $jump_top.hasClass("fixed")) {
1139					$jump_top.removeClass("fixed").addClass("default");
1140				}
1141			}
1142		}
1143		/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
1144
1145
1146		/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
1147		/*+++++++++++++++++++++++++++++++ Top Menus Article Progress Bar Scrolling  +++++++++++++++++++++++++++++*/
1148		if (typeof art_id !== "undefined") {
1149	        if ( scroll_pos >= $('.article_' + art_id).offset().top ) {
1150	            loading_per = (scroll_pos - $('.article_' + art_id).offset().top + 150) / $('.article_' + art_id).height()*100;
1151	            if (loading_per > 100) loading_per = 100;
1152	            $(".article_loading").css("width", loading_per + '%');
1153	        }
1154		}
1155		/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
1156
1157
1158		/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
1159		/*+++++++++++++++++++++++++++++++ Parallax banner left column Scrolling  +++++++++++++++++++++++++++++*/
1160		for(var i=0; i<arr_articles_id_nums.length; i++) {
1161			var $parralax_block = $( ".left_sidebar_" + arr_articles_id_nums[i] + " .parallax" );
1162		    if ($parralax_block.length !== 0) {
1163				var scrolled = $(window).scrollTop();
1164//console.log("offset().top=" + $parralax_block.offset().top);
1165//				$('#parallax-bg1').css('background-position-y',(300-(scrolled*.25))+'px');
1166//				var background_shift = (Number.parseInt($parralax_block.offset().top - scrolled - 600))*.35;
1167				var background_shift = (Number.parseInt($parralax_block.offset().top - scrolled - 600))*.30;
1168				if (background_shift < -140) {
1169					background_shift = 140;
1170				}
1171				if (background_shift < 0) {
1172					$parralax_block.css('background-position-y', background_shift + 'px');
1173				}
1174			} else {
1175				break;
1176			}
1177		}
1178		/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
1179
1180
1181		
1182		/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
1183		/*+++++++++++++++++++++++++++++++ Left & Right Column Fixing & Floatings  +++++++++++++++++++++++++++++++*/
1184//		window_scroll_top = $(document).scrollTop();
1185//		if (window_scroll_top < 500) {
1186		if (true) {
1187			scanTopMenuPanelsFixing();
1188		}
1189		scanLeftColumnFloatingBlocksPosition();
1190		scanRightColumnFloatingBlocksPosition();
1191		scanUnderArticleFloatingBlocksPosition();
1192		//scanAjaxArticlesCover();
1193	
1194//		if ( (window_scroll_top - lastScrollTopPosition) >= 300 || (window_scroll_top - lastScrollTopPosition) <= -300 ) {
1195		if ( true ) {
1196			lastScrollTopPosition = $(document).scrollTop();
1197			scanColumnsSizings();
1198		}
1199		/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/	
1200
1201	} );
1202	/********************************************************************************************************************************************************/
1203	/********************************************************************************************************************************************************/
1204	/********************************************************************************************************************************************************/
1205	
1206
1207
1208
1209
1210
1211
1212$(document).ready(function(){
1213	/********************************** sharing hidden block events begin ***********************************/
1214	$(".share_icons_wrapper").each(function(index, value) {
1215		art_num = $(this).attr('data_art_num');
1216		if (typeof arrSharingEmailFormState[art_num] == "undefined") {
1217			arrSharingEmailFormState[art_num] = 0;
1218//console.log('div.share_icons_wrapper' + index + ': data_art_num=' + $(this).attr('data_art_num'));
1219			ajaxArticleOnEmailInit(art_num);	
1220		}
1221	});
1222//	console.log(arrSharingEmailFormState);
1223	/********************************************************************************************************/
1224
1225
1226	if ( $(".invisible_counter").length !== 0 ) {	
1227		$(".invisible_counter").css({ "display": "none" })
1228	}
1229
1230    var loading_per;
1231	$('.search-link').click(function(e){
1232		e.preventDefault();
1233		$(this).parents('.header-menu').find('.hidden-search').fadeToggle('fast');
1234	});
1235
1236	$('span.close-fullscreen').click(function(){
1237		$(this).parent().fadeOut('fast');
1238	});
1239
1240	$('span.menu-arrow').click(function(){
1241		$(this).parents('body').find('.fullscreen-menu').fadeIn('fast');
1242	});
1243
1244	$(document).mouseup(function (e) {
1245		var container = $(".header-menu");
1246		if (container.has(e.target).length === 0){
1247			$('.hidden-search').fadeOut('fast');
1248		}
1249	});
1250
1251	$(document).mouseup(function (e) {
1252		var container = $(".fullscreen-menu");
1253		if (container.has(e.target).length === 0){
1254			$('.fullscreen-menu').fadeOut('fast');
1255		}
1256	});
1257
1258	$("#jump_top").click(function (){
1259		$("body,html").animate({
1260			scrollTop:0
1261		}, 500);
1262		return false;
1263	});		
1264
1265    $(".head-scroll").mCustomScrollbar({
1266        theme: "dark",
1267        scrollbarPosition:"outside",
1268        advanced:{
1269            updateOnContentResize: true
1270        }
1271    });
1272
1273    if ( document.body.clientWidth <= 975 ) {
1274        $('.open-section').on('click', function(e){
1275            e.preventDefault();
1276            $(".fixed-adaptive-menu .head-scroll").slideToggle("fast");
1277        });
1278    } else {
1279        $('.open-section').on('click', function(e){
1280            e.preventDefault();
1281            $("ul.left_buttons .head-scroll").slideToggle("fast");
1282        });
1283    }
1284
1285    $('span.section-menu-arrow').on('click', function(){
1286        $( this ).toggleClass('up');
1287        $(this).next().slideToggle(function(){
1288            $(".head-scroll").mCustomScrollbar("update");
1289        });
1290    });
1291
1292    $(document).mouseup(function (e) {
1293        var container = $("ul.section-menu, .global-top-menu, .header-first-menu-line, .fix-front-menu");
1294        if (container.has(e.target).length === 0){
1295            $('.head-scroll').slideUp('fast');
1296        }
1297    });
1298	
1299    $('.search-ico').on('click', function(e){
1300        $(".search_header_panel").toggleClass("hidden");
1301        $("#search_top_line").toggleClass("search_opened");
1302        if ( !$(".search_header_panel").hasClass("hidden") ) {
1303            $(".search_header_panel #ya-site-form0 .ya-site-form__input-text").focus();
1304        }
1305    });
1306    $('#search_top_line').on('click', function(e){
1307        $(".search_header_panel").toggleClass("hidden");
1308        $("#search_top_line").toggleClass("search_opened");
1309        if ( !$(".search_header_panel").hasClass("hidden") ) {
1310            $(".search_header_panel #ya-site-form0 .ya-site-form__input-text").focus();
1311        }
1312    });
1313
1314    $(".modal .close, .modal .popup_overlay").click(function () {
1315//		$(".modal").hide();
1316		$(".modal").fadeOut( "slow", function(){});
1317    });
1318	$("body").keydown(function(e) {
1319		if( e.keyCode === 27 ) {
1320			if ( $(".modal").is(':visible') ) {
1321//				$(".modal").hide();
1322				$(".modal").fadeOut( "slow", function(){});
1323			}
1324			if ( $(".user_popup").is(':visible') ) {
1325				$(".user_popup").fadeOut( "slow", function(){});
1326			}
1327		}
1328	});
1329
1330	$(".modal").keydown(function(e) {
1331		if ($(this).is(':visible')) {
1332			if( e.keyCode === 27 ) {
1333		        $('.modal').hide();
1334			}
1335		}
1336	});
1337    $(".modal-body .nav-tabs li a").click(function () {
1338		tab_num = $(this).attr( "tab_num" );
1339		$(this).parents('.nav-tabs').find('li').removeClass('active');
1340		$(this).parents('li').addClass('active');
1341//		alert(tab_num);
1342	    $(".tab-content .tab-pane").removeClass('active');
1343	    $(".tab-content .tab-pane#tab" + tab_num).addClass('active');
1344    });
1345	
1346
1347	$(window).bind('scroll',function(e){
1348		if ( $('.bg-competition').length !== 0 ) {
1349		    var scrolled = $(window).scrollTop();
1350//			console.log(scrolled);
1351//			console.log($('.bg-competition').css('background-position-y'));
1352//		    $('.bg-competition').css('top',(0+(scrolled*.25))+'px');
1353//		    $('.bg-competition').css('background-position','center '+(0-(scrolled*.25))+'px');
1354//		    $('.bg-competition').css('background-position','center '+(100-(scrolled*.25))+'%');
1355		    $('.bg-competition').css('background-position','center '+(-650+(scrolled*0.8))+'px');
1356		}
1357	});
1358
1359	function jscroll_start() {
1360		if ( $('.jscroll_wrapper').length !== 0 ) {
1361			console.log('eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee!!!!!!!');
1362		    $('.jscroll_wrapper').jscroll({
1363   			    loadingHtml: '',
1364//				padding: 0,
1365//		        padding: 200,
1366		        padding: 1600,
1367//		    	nextSelector: 'div.jscroll-next',
1368	    	    nextSelector: 'a.jscroll-next:last',
1369	        	debug: false,
1370		        autoTrigger: true
1371		    });
1372		}
1373	}
1374	
1375	setTimeout(jscroll_start, 1000);
1376
1377
1378	$('.front_block_popular_more').click(function(){
1379		var height_mult = 1;
1380		if (document.body.clientWidth <= 1215) {
1381			height_mult = 3;
1382		}		
1383//		var container = $(this).parents('#front_block_popular').find('.front_block_popular_frame');
1384		var container = $(this).parents('.front_sliding_block').find('.front_block_popular_frame');
1385		var wrapper_id = $(this).parents('.front_sliding_block').attr('id');
1386//		if (container.height() < 426*3*height_mult) {
1387//		if (container.height() < 370*3*height_mult) {
1388		if (container.height() < 406*4*height_mult) {
1389//			container.css("height", container.height() + 426*height_mult);
1390//			container.css("height", container.height() + 370*height_mult);
1391			container.css("height", container.height() + 406*height_mult);
1392//			if (container.height() >= 852*height_mult) {
1393//			if (container.height() >= 740*height_mult) {
1394//			if (container.height() >= 812*height_mult) {
1395			if (container.height() >= 1218*height_mult) {
1396				//$(this).css("color", "#aaa");
1397				setTimeout(inactive_front_block_popular_more, 500, wrapper_id);
1398			}
1399		}
1400	});
1401	function inactive_front_block_popular_more(wrapper_id) {
1402//		$('.front_block_popular_more').addClass("not_active");
1403//alert(container);
1404//console.log(wrapper_id);
1405//		container.find('.front_block_popular_frame').addClass("not_active");
1406		$('#' + wrapper_id + ' .front_block_popular_more').addClass("not_active");
1407	}
1408
1409	/************ Section Slider ************/
1410	$('.slider-section').each(function(){
1411		var slider = $(this),
1412		slider_els_wr = $('.items', slider),
1413		slider_els = $('.article-item', slider_els_wr),
1414		slider_link_go_prev = $('.link-go-prev', slider),
1415		slider_link_go_next = $('.link-go-next', slider),
1416		slider_pager_el = $('.pager', slider),
1417		slider_pager_links = [],
1418		slider_els_num = slider_els.length,
1419		slider_els_cur_num = 0,
1420		offsets = [],
1421		timer = null;
1422
1423		$('.clip-rect-l', slider).css('height', slider.height() + 'px');
1424		$('.clip-rect-r', slider).css('height', slider.height() + 'px');
1425
1426		slider_link_go_prev.click(function(){
1427			if (slider_els_cur_num > 0) slide_go(parseInt(slider_els_cur_num) - 1);
1428			else slide_go(slider_els_num - 1);
1429			return false;
1430		});
1431		slider_link_go_next.click(function(){
1432			if (slider_els_cur_num < slider_els_num - 1) slide_go(parseInt(slider_els_cur_num) + 1);
1433			else slide_go(0);
1434			return false;
1435		});
1436		slider_els.each(function(i){
1437			var slider_el = $(this),
1438			link = $('<a href="#" class="' + (i == 0 ? 'active' : '') + '" rel="' + i + '"></a>');
1439			slider_pager_el.append(link);
1440			slider_pager_links.push(link);
1441			offsets.push(this.offsetLeft);
1442			link.click(function(){
1443				slide_go($(this).attr('rel'));
1444				return false;
1445			});
1446		});
1447
1448		/* animation process */
1449		timer = setInterval(slide_animation_cycle, 4000);
1450		function slide_go(num) {
1451			clearInterval(timer);
1452			slider_els_cur_num = num;
1453			slide_animation();
1454			timer = setInterval(slide_animation_cycle, 4000);
1455		}
1456		function slide_animation() {
1457			slider_els_wr.animate({scrollLeft:offsets[slider_els_cur_num] - 10}, 500, function(){
1458				$('.active', slider_pager_el).removeClass('active');
1459				slider_pager_links[slider_els_cur_num].addClass('active');
1460			});
1461		}
1462		function slide_animation_cycle() {
1463			slider_link_go_next.click();
1464		}
1465	});
1466	/****************************************/
1467
1468	/**************** baloon.tpl ****************/
1469	function getCookie(name) {
1470		var cookie = " " + document.cookie;
1471		var search = " " + name + "=";
1472		var setStr = null;
1473		var offset = 0;
1474		var end = 0;
1475		if (cookie.length > 0) {
1476			offset = cookie.indexOf(search);
1477			if (offset != -1) {
1478				offset += search.length;
1479				end = cookie.indexOf(";", offset)
1480				if (end == -1) {
1481					end = cookie.length;
1482				}
1483				setStr = unescape(cookie.substring(offset, end));
1484			}
1485		}
1486		return(setStr);
1487	}
1488
1489	function setCookie (name, value, expires, path, domain, secure) {
1490		document.cookie = name + "=" + escape(value) +
1491			((expires) ? "; expires=" + expires : "") +
1492			((path) ? "; path=" + path : "") +
1493			((domain) ? "; domain=" + domain : "") +
1494			((secure) ? "; secure" : "");
1495	}	
1496
1497
1498		var BallonIsClosed = getCookie("baloon");
1499		
1500		if (!BallonIsClosed) {
1501			$(".baloon").show('slow');
1502		}
1503
1504		$(".baloon .close_div").click(function(e){
1505//			var largeExpDate = new Date ();
1506//			largeExpDate.setTime(largeExpDate.getTime() + (31 * 24 * 3600 * 1000));
1507//			setCookie("baloon", "1", largeExpDate, "/");
1508
1509			var d = new Date();
1510			d.setTime(d.getTime() + (31*24*60*60*1000));
1511			setCookie("baloon", "1", d.toUTCString(), "/");			
1512
1513//			setCookie("baloon", "1", "Mon, 01-Jan-2019 00:00:00 GMT", "/");
1514			$(".baloon").hide('slow');
1515		});
1516	/********************************************/
1517
1518
1519
1520	/**************** _auth.tpl ****************/
1521	var	intervalID;
1522	var	popup_id;	
1523	function authClose() {
1524		alert('Close');
1525		if(window.opener) {
1526			window.opener.location.reload();
1527		}
1528	}
1529	function popupCheck(popup_id) {
1530//		console.log(popup_id.closed);
1531		if(popup_id.closed == true) {
1532			clearInterval(intervalID);
1533//			userFunc();
1534//			bulkFunc({{ $topic_id }}, 'displayComments');
1535			userFunc('checkUserPermissions');
1536		}
1537	}
1538	function checkUserPermissions (data) {
1539//		console.log(data);
1540		if (data.data.user.type == "user") {
1541//			alert('Success!');
1542			window.location.reload();
1543		}
1544	}
1545	function popupShow() {
1546		$('.auth_popup').toggle();
1547		var shift_left = (document.body.clientWidth - 980)/2;
1548		var shift_top = (window.screen.height - 740)/2;
1549//		popup_id = window.open('http://forum.ogorod.ru/vk.php', 'auth_vk', 'width=980,height=740,left=' + shift_left + ',top=' + shift_top);
1550		popup_id = window.open('http://www.ogorod.ru/forum/vk.php', 'auth_vk', 'width=980,height=740,left=' + shift_left + ',top=' + shift_top);
1551		intervalID = setInterval("popupCheck(popup_id)", 1000);
1552//		setInterval('alert("sec")', 1000);
1553	}
1554	/*******************************************/
1555
1556
1557	/**************** top-line.tpl (subscribe MailChimp) ****************/
1558	$('#subscribe').on('click', function(e){
1559		e.preventDefault();
1560		$(".popup_wrapper.subscribe").toggleClass("hidden");
1561	});
1562	$('#subscribe_v2').on('click', function(e){
1563		e.preventDefault();
1564		$(".popup_wrapper.subscribe_v2").toggleClass("hidden");
1565	});
1566	$('.popup_wrapper.subscribe .close, .popup_wrapper.subscribe').on('click', function(e){
1567		e.preventDefault();
1568		$(".popup_wrapper.subscribe").addClass("hidden");
1569	});
1570	$('.popup_wrapper.subscribe_v2 .close, .popup_wrapper.subscribe_v2 .popup_overlay').on('click', function(e){
1571		e.preventDefault();
1572		$(".popup_wrapper.subscribe_v2").addClass("hidden");
1573	});
1574	/********************************************************************/
1575
1576
1577	/**************** header_mobile2.tpl (mobile search) ****************/
1578/*
1579	$('.menu_ico').click(function(){
1580		$( ".mobile_nav_left_wrapper" ).toggleClass("active");
1581		$('.menu_ico').toggleClass("active");
1582		if ( $('.search_ico').hasClass("active") ) {
1583			$('.mobile_search_full_wrapper').toggleClass("active");
1584			$('.search_ico').toggleClass("active");
1585		}
1586    });
1587*/
1588	$('.search-ico').click(function(){
1589		$('.mobile_search_full_wrapper').toggleClass("active");
1590/*
1591		$('.search_ico').toggleClass("active");
1592		if ( $('.menu_ico').hasClass("active") ) {
1593			$( ".mobile_nav_left_wrapper" ).toggleClass("active");
1594			$('.menu_ico').toggleClass("active");
1595//			$('.ya-site-form__input-text').focus();
1596		}
1597*/
1598    });
1599	$('.mobile_search_full_wrapper .close_icon').click(function(){
1600		$('.mobile_search_full_wrapper').toggleClass("active");
1601		$('.search_ico').toggleClass("active");
1602	});
1603	/********************************************************************/
1604
1605
1606
1607
1608
1609
1610
1611//	scanArticlesForNewId();
1612	scanTopMenuPanelsFixing();
1613//	scanColumnsSizings();
1614	scanLeftColumnFloatingBlocksPosition();
1615	scanRightColumnFloatingBlocksPosition();
1616	scanUnderArticleFloatingBlocksPosition();
1617
1618	//переинициализируем через 3 секунды размеры колонок и позиции залипающих блоков - нужно если в браузере нажали рефреш в середине статьи например - чтобы банеры плавающие не налазили друг на друга
1619	setTimeout(function () {
1620//		console.log('ReInitiation of Columns and Floatings!!!');
1621		scanTopMenuPanelsFixing()
1622		setActiveIssueTopMenu();
1623//		scanColumnsSizings();
1624		scanLeftColumnFloatingBlocksPosition();
1625		scanRightColumnFloatingBlocksPosition();
1626		scanUnderArticleFloatingBlocksPosition();
1627//		$("body,html").animate({ scrollTop: $(document).scrollTop() - 10}, 500);
1628	}, 1000);
1629
1630	$('.all-sections-menu').click(function(){
1631		if ( $('.navigation_wrapper').hasClass("active") ) {
1632			$('.navigation_wrapper').removeClass("active");
1633			$('.all-sections-menu').removeClass("close-icon");
1634			$('.global-top-menus').removeClass("navigation_opened");
1635			$('.all-sections-menu span').html(' Все <b>рубрики</b>');
1636			if (document.body.clientWidth <= 1080) {
1637//				console.log("rememberScrollPos=" + rememberScrollPos);
1638//				if (rememberScrollPos > 0) {
1639				if (true) {
1640//					$('.wrapper.global_wrapper').css('padding-top', rememberContentWrapperPaddingTop);
1641					$("body,html").animate({
1642						scrollTop:(rememberScrollPos)
1643					}, 1);
1644					$('.wrapper.global_wrapper').css('padding-top', "auto");
1645				}
1646			}
1647		} else {
1648			$('.navigation_wrapper').addClass("active");
1649			$('.all-sections-menu').addClass("close-icon");
1650			$('.global-top-menus').addClass("navigation_opened");
1651			$('.all-sections-menu span').html(' Закр<b>ыть</b><s>.</s>');
1652			if (document.body.clientWidth <= 1080) {
1653				rememberScrollPos = $(document).scrollTop();
1654				rememberContentWrapperPaddingTop = $('.wrapper.global_wrapper').css('padding-top');
1655//				console.log("rememberScrollPos=" + rememberScrollPos);
1656				$("body,html").animate({
1657					scrollTop:130
1658				}, 1);
1659				$('.wrapper.global_wrapper').css('padding-top', 50 + 250 + $('.navigation_wrapper').height());
1660//				console.log("rememberContentWrapperMarginTopNew=" + $('.wrapper.global_wrapper').css('padding-top'));
1661			}
1662//			ga('send', 'event', 'button', 'click', 'all_sections');
1663		}
1664	});
1665
1666	$('.sections_show_hidden_arrow').click(function(){
1667		if ( $('.global-top-menus').hasClass("navigation_opened") ) {
1668			$('.global-top-menus').removeClass("navigation_opened");
1669		} else {
1670			$('.global-top-menus').addClass("navigation_opened");
1671		}
1672	});
1673
1674	if (typeof $(".gallery_wrapper").lightGallery == 'function') {
1675	//	$(".gallery_wrapper").lightGallery();
1676		$(".gallery_wrapper").lightGallery({
1677			thumbnail: true,
1678		    selector: '.gallery_item'
1679		});
1680	}	
1681
1682	$(".show-read-also-mob").on('click', function(e){
1683		e.preventDefault();
1684		$(".read-also").toggleClass("opened");
1685	});
1686
1687	//********** Custom Scroll ***********
1688	$(".scrolled").mCustomScrollbar({
1689		scrollInertia: 150,
1690//		autoHideScrollbar: true,
1691		theme: "dark"
1692	});
1693	//************************************
1694
1695
1696
1697	/**************** _article_forms_writers.tpl (writers forms) ****************/
1698	$('.popup_wrapper.article_form_writers.author-know-more .close').on('click', function(e){
1699		e.preventDefault();
1700		$(".popup_wrapper.article_form_writers.author-know-more").addClass("hidden");
1701	});
1702	$('.popup_wrapper.article_form_writers.author-new-theme .close').on('click', function(e){
1703		e.preventDefault();
1704		$(".popup_wrapper.article_form_writers.author-new-theme").addClass("hidden");
1705	});
1706
1707	$(".popup_wrapper.article_form_writers").keydown(function(e) {
1708		if ( $(this).is(':visible') ) {
1709			if( e.keyCode === 27 ) {
1710				$(this).addClass("hidden");
1711			}
1712		}
1713	});
1714
1715	$("#author-know-more-form-popup form, #author-new-theme-form-popup form").submit(function () {
1716		var url = $( this ).attr('action');
1717		var id = $( this ).attr('id');
1718		$.ajax({
1719			type: "POST",
1720			url: url,
1721			data: $( this ).serialize(),
1722			success: function (data)
1723			{
1724				var obj = JSON.parse ( data );
1725				ClearArticleWritersErrors(obj, id);
1726				if (obj.status == 'ok') {
1727					//alert('Ваша заявка успешно отправлена');
1728//					$('.popup_wrapper.article_form_writers.author-know-more .close').on('click', function(e){
1729//					$('#' + form_id + '-popup .close').click()
1730					$(".popup_wrapper.article_form_writers").addClass("hidden");			
1731					alertify.success("Ваше сообщение успешно отправлено");
1732				} else {
1733					if (obj.status == 'email_sending_error') {
1734						//alert('Ошибка при отправке заявки');
1735						alertify.error(ajaxPostResult);
1736					}
1737				}
1738			}
1739		});
1740		return false; // avoid to execute the actual submit of the form.
1741	});
1742	/****************************************************************************/
1743
1744	function adBlockBannerTopInsert() {
1745		var banner_width = 0;
1746		if (document.body.clientWidth >= 1305) {
1747			banner_width = 1200;
1748		}
1749		if (document.body.clientWidth < 1305 && document.body.clientWidth >= 1085) {
1750			banner_width = 1000;
1751		}
1752		if (banner_width > 0) {
1753			var url = "https://goo.gl/PWfbXc";
1754			var banner_code = "<a href=\"" + url + "\" target=\"_blank\">";
1755			banner_code += "<img src=\"/themes/publication_15/theme_2/_img/fix/top/top" + banner_width +".jpg\" width=\"" + banner_width + "\" height=\"150\" border=\"0\">";
1756			banner_code += "</a>";
1757			$('#adfox_149068960149615173').append(banner_code);
1758		}
1759	}
1760
1761//    if (typeof adblock == 'undefined') {
1762//console.log("zzz2");
1763    if (typeof zzz == 'undefined') {
1764//console.log("typeof zzz2=" + (typeof zzz));
1765//		adblock = 'yes';
1766		zzz = 'yes';
1767		$("body").addClass('adblock_on');
1768		adBlockBannerTopInsert();
1769//		ajaxAdblockShowInit();
1770
1771		/**************** AdBlock Popup ****************/
1772		var AdblockIsClosed = getCookie("adblock");
1773//console.log("AdblockIsClosed=" + AdblockIsClosed);
1774		if (!AdblockIsClosed) {
1775//console.log("AdblockIsClosed2=" + AdblockIsClosed);
1776			ajaxAdblockShowPopup();
1777		}
1778//ajaxAdblockShowPopup();
1779		/***********************************************/
1780
1781//		ga('send', 'event', 'adblock_user', 'load', 'adblock_user_load');
1782	} else {
1783//console.log("zzz3");
1784//console.log("typeof zzz3=" + (typeof zzz));
1785//console.log("zzz=" + zzz);
1786	}
1787
1788	
1789	if ($(".offer_block a").length !== 0) {
1790		$(".offer_block a").on("click", function(e) {
1791//			e.preventDefault();
1792//			ga('send', 'event', 'button', 'click', 'offer_click');
1793		})
1794	}	
1795
1796
1797	if ($(".cards_left_menu li a").length !== 0) {
1798		$(".cards_left_menu li a").on('click', function(e){
1799			e.preventDefault();
1800			$('html , body').stop().animate({
1801				scrollTop: $( $(this).attr('href') ).offset().top - 80
1802//				scrollTop: $( $(this).attr('href') ).offset().top
1803			}, 500);	
1804		});
1805	}	
1806
1807	
1808	function ajaxAdblockShowPopup() {
1809//		console.log('ADBLOCK is Detected!!!!!!!!!!!!!!!!!!!');
1810		$('.adblock_popup_warning').fadeIn( "slow", function(){});
1811		setTimeout(timerCloseAdblockPopup, 1000);
1812	}
1813	function timerCloseAdblockPopup() {
1814		var counter = $(".popup_adblock_warning .close_info span").html();
1815		counter--;
1816		$(".popup_adblock_warning .close_info span").html(counter);
1817		if (counter > 0) {
1818			setTimeout(timerCloseAdblockPopup, 1000);
1819		} else {
1820			$(".adblock_popup_warning .close").trigger('click');
1821		}
1822	}
1823	
1824	$(".adblock_popup_warning .close").click(function () {
1825//		var largeExpDate = new Date ();
1826//		largeExpDate.setTime(largeExpDate.getTime() + ((1800 + (shiftTimeZone() * 60) ) * 1000));
1827//		largeExpDate.setTime(largeExpDate.getTime() + (0.5 * 3600 * 1000));
1828//console.log('largeExpDate=' + largeExpDate);
1829
1830		var d = new Date();
1831		d.setTime(d.getTime() + (0.5*60*60*1000));
1832		setCookie("adblock", "1", d.toUTCString(), "/");
1833
1834//		setCookie("adblock", "1", largeExpDate, "/");
1835		$('.adblock_popup_warning').fadeOut( "slow", function(){});
1836	});	
1837
1838	function shiftTimeZone() {
1839		var offset = new Date().getTimezoneOffset();
1840//		console.log(offset);
1841		return offset;
1842	}
1843
1844	var mySwiper = new Swiper ('.swiper-container.front-slider', {
1845		pagination: '.swiper-pagination',
1846		paginationClickable: true,
1847		nextButton: '.swiper-button-next',
1848		prevButton: '.swiper-button-prev',
1849		slidesPerView: 6,
1850		slidesPerGroup: 4,
1851//		initialSlide: 24,
1852//		autoplay: 2500,
1853//		mousewheelControl: true,
1854		grabCursor:true,
1855		loop: true,
1856		spaceBetween: 30,
1857		navigation: {
1858			nextEl: '.swiper-button-next',
1859			prevEl: '.swiper-button-prev',
1860		},
1861		on: {
1862			init: function () {
1863				$('.front_slider_wrapper').removeClass('invisible');
1864			},
1865		},		
1866	})
1867
1868});
1869//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1870//$(document).ready(function(){  !!!!!!!!END
1871//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1872
1873function adBlockBannerRightColumnInsert(art_id) {
1874//console.log("right_adblock_banner " + art_id);
1875/*
1876	var url = "https://goo.gl/RD2Sjb";
1877	var banner_code = "<a href=\"" + url + "\" target=\"_blank\">";
1878	banner_code += "<img src=\"/themes/publication_15/theme_2/_img/fix/right/right_300x300.jpg\" width=\"300\" height=\"300\" border=\"0\">";
1879	banner_code += "</a>";
1880	$( '.right_sidebar_' + art_id + ' .right_sidebar_all_column_fixer .banner_3sec_floater').prepend(banner_code);
1881*/
1882}
1883function adBlockBannerBottomInsert(art_id) {
1884//console.log("bottom_adblock_banner " + art_id);
1885/*
1886	var url = "https://goo.gl/RD2Sjb";
1887	var banner_code = "<a href=\"" + url + "\" target=\"_blank\">";
1888	banner_code += "<img src=\"/themes/publication_15/theme_2/_img/fix/bottom/bottom_300x300.jpg\" width=\"300\" height=\"300\" border=\"0\">";
1889	banner_code += "</a>";
1890	$( '.article_bottom_divider.article_' + art_id + ' .left_column .double_300_banners_under_article .banner_article_bottom_300_250_left').prepend(banner_code);		
1891*/
1892}
1893
1894
1895/********* ajax ReadingNow Block *********/
1896function ajaxAdblockShowInit(article_id) {
1897//console.log("ajaxAdblockShowInit!!!! " + article_id);
1898	var $where_to_show, $where_to_show2;
1899	if (article_id) {
1900//		$where_to_show = $('.right-sidebar.right_sidebar_' + article_id + ' .banner_floater');
1901		$where_to_show = $('.right_sidebar_' + article_id + ' .banner_floater_sticky');
1902		$where_to_show2 = $('.right_sidebar_' + article_id + ' .banner_3sec_floater');
1903	} else {
1904		$where_to_show = $('.right-sidebar .banner_floater');
1905	}
1906
1907	url = "//www.ogorod.ru/ru/pages/reading_now/";
1908	$.ajax({
1909		type: "GET",
1910		url: url,
1911		success: function (data)
1912		{
1913			$where_to_show.append(data);
1914			imagesLazyInit(article_id);	
1915//			LazySliderLoadPics();
1916//			setTimeout(LazySliderLoadPics, 1000);
1917//			setTimeout(LazySliderLoadPics, 3000);
1918//			setTimeout(LazySliderLoadPics, 6000);
1919		}
1920	});
1921
1922	url = "//www.ogorod.ru/ru/pages/reading_now2/";
1923	$.ajax({
1924		type: "GET",
1925		url: url,
1926		success: function (data)
1927		{
1928			$where_to_show2.append(data);
1929			imagesLazyInit(article_id);	
1930		}
1931	});
1932
1933//	ajaxAdblockInsertPdfAnons(article_id);	
1934}
1935
1936function ajaxAdblockInsertPdfAnons(article_id) {
1937//console.log('!!!!!!!!!!!! init ajaxAdblockInsertPdfAnons ' + article_id);
1938	var $where_to_show = $('.article_' + article_id + ' .banner_under_article_magazine');
1939//console.log($where_to_show);
1940
1941//	var url = "https://www.ogorod.ru/forum/files/file/19-ogurtsyi-sekretyi-horoshego-urozhaya/";
1942	var url = "https://goo.gl/Ko27ZA";
1943	var img_url = "https://www.ogorod.ru/themes/publication_15/theme_2/_img/pdf_anonses/under_article/2018_03.jpg";
1944	var title = "Огурцы - секреты хорошего урожая";
1945	var text = "В этом номере мы рассказываем, как выбрать правильный сорт, подходящий именно для ваших условий и соответствующий вашим потребностям, как подготовить семена к посеву, чтобы оÐ
1945½Ð¸ дали дружные всходы, как сделать мобильную, высокую, теплую и вертикальную грядку и как выращивать огурцов в открытом грунте, теплице и на подоконнике.";	
1946
1947	var html = "";
1948	html += "<div class=\"banner_wrapper adblock_under_article art_" + article_id + "\">";
1949	html += "	<a href=\"" + url + "\" target=\"_blank\">";
1950	html += "		<div class=\"column_left\">";
1951	html += "			<img src=\"" + img_url + "\" alt=\"Обложка журнала\" />";
1952	html += "		</div>";
1953	html += "		<div class=\"column_right\">";
1954	html += "			<p>" + title + "</p>";
1955	html += "			<div>" + text + "</div>";
1956	html += "			<span class=\"button\">Скачать бесплатно</span>";
1957	html += "		</div>";
1958	html += "	</a>";
1959	html += "</div>";
1960	
1961//	$where_to_show.append(html);
1962}
1963
1964/*****************************************/
1965/*
1966function LazySliderLoadPics() {
1967	$(".front-populars.right_column_articles_blocks .swiper-wrapper img.lazy").lazyload({
1968		skip_invisible : false
1969	});
1970}
1971*/
1972
1973
1974
1975
1976
1977
1978
1979
1980/********* article font size changing *********/
1981function changeFontSize(element,step){
1982	step = parseInt(step,10);
1983	var el = $("." + element);
1984	var curFont = el.css("font-size");
1985	curFont = curFont.replace("px","")
1986	curFont = parseInt(curFont,10) + step;
1987	el.css("font-size", curFont + "px");
1988} 
1989/**********************************************/
1990
1991
1992/********************** Forum Comments Functions **********************/
1993function _a(func, back) {
1994	url_tmp = ('https:' == window.location.protocol ? 'https' : 'http')  + '://www.ogorod.ru/forum/api.php?do=' + func;
1995    $.ajax({
1996//        url: 'http://www.ogorod.ru/forum/api.php?do=' + func,
1997		url: url_tmp,
1998        dataType: 'jsonp',
1999        jsonp: 'callback',
2000        jsonpCallback: back,
2001        success: function () {
2002//   		alert("success");
2003        }
2004    });
2005    return false;
2006}
2007function jsonpCallback(data) {
2008//    console.log(data);
2009}
2010function alertalert() {
2011    alert('alert');
2012    return false;
2013}
2014function pingFunc(back) {
2015    _a('ping', back);
2016    return false;
2017}
2018function userFunc(back) {
2019    _a('user', back);
2020    return false;
2021}
2022function topicFunc(topic, back) {
2023    _a('topic&topic=' + topic, back);
2024    return false;
2025}
2026function bulkFunc(topic, back) {
2027    _a('bulk&topic=' + topic, back);
2028    return false;
2029}
2030// постит в текущий топик
2031function postFunc(topic, content, back) {
2032    _a('post&topic=' + topic+'&content=' + encodeURIComponent(content), back);
2033    return false;
2034}
2035// постит в новый топик
2036function newPostFunc(content, title, url, image, desc, back) {
2037    _a('newpost&content=' + encodeURIComponent(content) +'&title=' + encodeURIComponent(title) +'&url=' + encodeURIComponent(url) +'&image=' + encodeURIComponent(image) +'&desc=' + encodeURIComponent(desc), back);
2038    return false;
2039}
2040// запрашивает последние комменты
2041function liveFunc(back) {
2042    _a('live', back);
2043    return false;
2044}
2045// показывает последние комменты в блоках $('.last_comments_block') в правой колонке (во всех)
2046function displayLastComments(arrComments) {
2047	var s = '';
2048	var comments_num = arrComments.data.topic_total ? arrComments.data.topic_total - 1 : '0';		
2049	if (arrComments.data.topic.length > 1) {
2050		var message;
2051		for (i = 0; i< arrComments.data.topic.length; ++i) {
2052			message = arrComments.data.topic[i];
2053
2054			var str = message.post.slice(0,200);
2055			var a = str.split(' ');
2056			a.splice(a.length-1, 1);
2057			str = a.join(' ') + ' ...';
2058				
2059			s = s + '<div class="comment_block">';
2060			s = s + '<div class="user_picture"><img src="' + message.author_photo + '" /></div>';
2061			s = s + '<div class="user_comment_wrapper">';
2062			s = s + '<span class="author">' + message.author_name + '</span>';
2063			s = s + ' <span class="data">' + message.post_date + '</span>';
2064//			s = s + '<div class="comment_text">' + message.post + '</div>';
2065			s = s + '<div class="comment_text">' + str + '</div>';
2066			s = s + '<div class="forum_topic"><a href="' + message.url + '" target="_blank">' + message.title + '</a></div>';
2067			s = s + '</div>';
2068			s = s + '</div>';
2069		}	
2070	}
2071//	console.log(arrComments);
2072//	$('#last_comments_' + art_number).html(s);
2073	$('.last_comments_block').html(s);
2074}
2075/**********************************************************************/
2076
2077$('.oglavlenie_ul a').on('click', function(e){
2078	event.preventDefault();
2079	$('html , body').stop().animate({
2080		scrollTop: $($(this).attr('href')).offset().top - 65
2081	}, 500);
2082});
2083
2084/*
2085//$('#PopupSignupForm_0 iframe').on('click', function(e){
2086//$('#PopupSignupForm_0 iframe').on('focus', function(e){
2087$('#PopupSignupForm_0').on('focus', function(e){
2088//	$article.css('#PopupSignupForm_0 iframe', 'height', '520px !important');
2089	console.log('aaaaaa');
2090	$article.css('#PopupSignupForm_0 iframe', 'height', '');
2091});
2092*/
2093
2094/*
2095var editorInstance = CKEDITOR.instances['PopupSignupForm_0'];
2096editorInstance.on('focus', function(e) {
2097	console.log("tadaaa");
2098});
2099*/

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.