PageSourceSearch

https://festlife.ru/local/templates/aspro-stroy/js/general.js?175155648743086

js festlife.ru collected 2026-10-08 15:23:00 UTC 43,086 bytes, 1,394 lines download raw bytes

1CheckTopMenuDotted = function(){
2	var menu = $('nav.mega-menu');
3	var menuMoreItem = menu.find('td.js-dropdown');
4	if(menu.parents('.collapse').css('display') == 'none'){
5		return false;
6	}
7
8	var block_w = menu.closest('div').actual('width');
9	var	menu_w = menu.find('table').actual('outerWidth');
10	var afterHide = false;
11	var h_block=h_block_top=0;
12
13	while(menu_w > block_w) {
14		menuItemOldSave = menu.find('td').not('.nosave').last();
15		if(menuItemOldSave.length){
16			menuMoreItem.show();
17			// if(menuItemOldSave.find('.wrap > a').length){
18				// h_block=menuItemOldSave.find('.wrap > a').actual( 'outerHeight' )-15;
19				h_block=39;
20			// }
21			if(menuItemOldSave.find('.wrap .dropdown-menu').length){
22				h_block_top=menuItemOldSave.find('.wrap .dropdown-menu').actual( 'outerHeight' );
23				h_block_top=h_block_top/2;
24			}
25			menuItemNewSave = '<li class="' + (menuItemOldSave.hasClass('dropdown') ? 'dropdown-submenu ' : '') + (menuItemOldSave.hasClass('active') ? 'active ' : '') + '" data-hidewidth="' + menu_w + '" style="height:'+h_block+'px"><div class="slide_wrapp" style="padding-bottom:'+h_block_top+'px">' + menuItemOldSave.find('.wrap').html() + '</div></li>';
26			menuItemOldSave.remove();
27			menuMoreItem.find('> .wrap > .dropdown-menu').prepend(menuItemNewSave);
28			menu_w = menu.find('table').actual('outerWidth');
29			afterHide = true;
30		}
31		else{
32			break;
33		}
34	}
35
36	if(!afterHide) {
37		do {
38			var menuItemOldSaveCnt = menuMoreItem.find('.dropdown-menu').find('li').length;
39			menuItemOldSave = menuMoreItem.find('.dropdown-menu').find('li').first();
40			if(!menuItemOldSave.length) {
41				menuMoreItem.hide();
42				break;
43			}
44			else {
45				var hideWidth = menuItemOldSave.attr('data-hidewidth');
46				if(hideWidth > block_w) {
47					break
48				}
49				else {
50					// menuItemOldSave.replace()
51					menuItemNewSave = '<td class="' + (menuItemOldSave.hasClass('dropdown-submenu') ? 'dropdown ' : '') + (menuItemOldSave.hasClass('active') ? 'active ' : '') + '" data-hidewidth="' + block_w + '"><div class="wrap">' + menuItemOldSave.html() + '</div></td>';
52					menuItemOldSave.remove();
53					$(menuItemNewSave).insertBefore(menu.find('td.js-dropdown'));
54					if(!menuItemOldSaveCnt) {
55						menuMoreItem.hide();
56						break;
57					}
58				}
59			}
60			menu_w = menu.find('table').actual('outerWidth');
61		}
62		while(menu_w <= block_w);
63	}
64	menu.find('td').css('visibility', 'visible');
65
66	return false;
67}
68
69CheckTopVisibleMenu = function(that) {
70	var dropdownMenu = $('.dropdown-menu:not(.fixed_menu_ext):visible').last();
71	if(dropdownMenu.length){
72		dropdownMenu.find('a').css('white-space', '');
73		dropdownMenu.css('left', '');
74		dropdownMenu.css('right', '');
75		dropdownMenu.removeClass('toright');
76
77		var dropdownMenu_left = dropdownMenu.offset().left;
78		if(typeof(dropdownMenu_left) != 'undefined'){
79			var menu = dropdownMenu.parents('.mega-menu');
80			var menu_width = menu.outerWidth();
81			var menu_left = menu.offset().left;
82			var menu_right = menu_left + menu_width;
83			var isToRight = dropdownMenu.parents('.toright').length > 0;
84			var parentsDropdownMenus = dropdownMenu.parents('.dropdown-menu:not(.fixed_menu_ext)');
85			var isHasParentDropdownMenu = parentsDropdownMenus.length > 0;
86			if(isHasParentDropdownMenu){
87				var parentDropdownMenu_width = parentsDropdownMenus.first().outerWidth();
88				var parentDropdownMenu_left = parentsDropdownMenus.first().offset().left;
89				var parentDropdownMenu_right = parentDropdownMenu_width + parentDropdownMenu_left;
90			}
91
92			if(parentDropdownMenu_right + dropdownMenu.outerWidth() > menu_right){
93				dropdownMenu.find('a').css('white-space', 'normal');
94			}
95
96			var dropdownMenu_width = dropdownMenu.outerWidth();
97			var dropdownMenu_right = dropdownMenu_left + dropdownMenu_width;
98
99			if(dropdownMenu_right > menu_right || isToRight){
100				var addleft = 0;
101				addleft = menu_right - dropdownMenu_right;
102				if(isHasParentDropdownMenu || isToRight){
103					dropdownMenu.css('left', 'auto');
104					dropdownMenu.css('right', '100%');
105					dropdownMenu.addClass('toright');
106				}
107				else{
108					var dropdownMenu_curLeft = parseInt(dropdownMenu.css('left'));
109					dropdownMenu.css('left', (dropdownMenu_curLeft + addleft) + 'px');
110				}
111			}
112		}
113	}
114}
115
116CheckPopupTop = function(){
117	var popup = $('.jqmWindow.show');
118	if(popup.length){
119		var documentScollTop = $(document).scrollTop();
120		var windowHeight = $(window).height();
121		var popupTop = parseInt(popup.css('top'));
122		var popupHeight = popup.height();
123
124		if(windowHeight >= popupHeight){
125			// center
126			popupTop = (windowHeight - popupHeight) / 2;
127		}
128		else{
129			if(documentScollTop > documentScrollTopLast){
130				// up
131				popupTop -= documentScollTop - documentScrollTopLast;
132			}
133			else if(documentScollTop < documentScrollTopLast){
134				// down
135				popupTop += documentScrollTopLast - documentScollTop;
136			}
137
138			if(popupTop + popupHeight < windowHeight){
139				// bottom
140				popupTop = windowHeight - popupHeight;
141			}
142			else if(popupTop > 0){
143				// top
144				popupTop = 0;
145			}
146		}
147		popup.css('top', popupTop + 'px');
148	}
149}
150
151CheckMainBannerSliderVText = function(slider){
152	if(slider.parents('.banners-big').length){
153		var sh = slider.height();
154		slider.find('.item').each(function() {
155			var curSlideTextInner = $(this).find('.text .inner');
156			if(curSlideTextInner.length){
157				var ith = curSlideTextInner.actual('height');
158				var p = (ith >= sh ? 0 : Math.floor((sh - ith) / 2));
159				curSlideTextInner.css('padding-top', p + 'px');
160			}
161		});
162	}
163}
164
165CheckStickyFooter = function() {
166	$(window).resize(function() { //  BX.addCustomEvent('onWindowResize', function(eventdata) {
167		try{
168			var footerHeight = $('footer').outerHeight(),
169				vheight=0;
170			ignoreResize.push(true);
171			$('footer').css('margin-top', '-' + footerHeight + 'px');
172			$('.body').css('margin-bottom', '-' + footerHeight + 'px');
173			if(!$('.body').hasClass('index')){
174				vheight=25;
175			}
176			if($('.body').hasClass('detail_page')){
177				vheight=0;
178			}
179			$('.main').css('padding-bottom', footerHeight + vheight + 'px'); // 25px
180			ignoreResize.pop();
181		}
182		catch(e){}
183	});
184}
185
186getGridSize = function(counts) {
187	var z = parseInt($('.body_media').css('top')),
188		counts_item=1;
189		counts_item=(z == 2 ? counts[0] : z == 1 ? counts[1] : counts[2]);
190		if(counts[3] && z==3)
191			counts_item=1;
192	return counts_item;
193}
194
195CheckFlexSlider = function(){
196	$('.flexslider:not(.thmb)').each(function(){
197		var slider = $(this);
198		slider.resize();
199		var counts = slider.data('flexslider').vars.counts;
200		if(typeof(counts) != 'undefined'){
201			var cnt = getGridSize(counts);
202			var to0 = (cnt != slider.data('flexslider').vars.minItems || cnt != slider.data('flexslider').vars.maxItems || cnt != slider.data('flexslider').vars.move);
203			if(to0){
204				slider.data('flexslider').vars.minItems = cnt;
205				slider.data('flexslider').vars.maxItems = cnt;
206				slider.data('flexslider').vars.move = cnt;
207				slider.flexslider(0);
208				slider.resize();
209				slider.resize(); // twise!
210			}
211		}
212	});
213}
214
215CheckHeaderFixed = function(){
216	var header = $('header.canfixed');
217
218	if(header.length){
219		var headerLogoAndMenuRow = header.find('.logo_and_menu-row');
220		if(headerLogoAndMenuRow.length){
221			var isHeaderFixed = false;
222			var headerCanFix = true;
223			var headerFixedHeight = 53;
224			var headerNormalHeight = headerLogoAndMenuRow.actual('outerHeight');
225			var headerDiffHeight = headerNormalHeight - headerFixedHeight;
226			var mobileBtnMenu = $('.btn.btn-responsive-nav');
227			$(window).scroll(function(){
228				var headerTop = $('#panel:visible').outerHeight();
229				var scrollTop = $(window).scrollTop();
230				if(!isHeaderFixed){
231					headerNormalHeight = headerLogoAndMenuRow.actual('outerHeight');
232					headerDiffHeight = headerNormalHeight - headerFixedHeight;
233				}
234
235				headerCanFix = !mobileBtnMenu.is(':visible') && !$('.dropdown-menu:not(.fixed_menu_ext):visible').length;
236
237				if(!isHeaderFixed){
238					if((scrollTop > headerNormalHeight + headerTop) && headerCanFix){
239						isHeaderFixed = true;
240						var headerNext = header.next();
241						if(headerNext.length){
242							var mt = parseInt(headerNext.css('margin-top'));
243						}
244						header.css('top', '-' + headerNormalHeight + 'px');
245						header.addClass('fixed');
246						if(headerNext.length){
247							headerNext.css('margin-top', headerNormalHeight + mt + 'px');
248						}
249						header.delay(0).animate({top: '0'}, 300);
250					}
251				}
252				else if(isHeaderFixed || !headerCanFix){
253					if((scrollTop <= headerDiffHeight + headerTop) || !headerCanFix){
254						isHeaderFixed = false;
255						header.removeClass('fixed');
256						var headerNext = header.next();
257						if(headerNext.length){
258							headerNext.css('margin-top', '');
259						}
260						CheckTopMenuDotted();
261					}
262				}
263			});
264		}
265	}
266}
267
268CheckObjectsSizes = function() {
269	$('.container iframe,.container object,.container video').each(function() {
270		var height_attr = $(this).attr('height');
271		var width_attr = $(this).attr('width');
272		if (height_attr && width_attr) {
273			$(this).css('height', $(this).outerWidth() * height_attr / width_attr);
274		}
275	});
276}
277CheckFilterSeletSizes = function() {
278	$('.bx_filter_select_block').each(function(){
279		var popup=$("#smartFilterDropDown"+$(this).data('id'));
280		if(popup.length){
281			popup.css({'width':$(this).css('width')});
282		}
283	})
284}
285
286scrollToTop = function(){
287	if(arStroyOptions['THEME']['SCROLLTOTOP_TYPE'] !== 'NONE'){
288		var _isScrolling = false;
289		// Append Button
290		$('body').append($('<a />').addClass('scroll-to-top ' + arStroyOptions['THEME']['SCROLLTOTOP_TYPE'] + ' ' + arStroyOptions['THEME']['SCROLLTOTOP_POSITION']).attr({'href': '#', 'id': 'scrollToTop'}));
291		$('#scrollToTop').click(function(e){
292			e.preventDefault();
293			$('body, html').animate({scrollTop : 0}, 500);
294			return false;
295		});
296		// Show/Hide Button on Window Scroll event.
297		$(window).scroll(function(){
298			if(!_isScrolling) {
299				_isScrolling = true;
300				var bottom = 23,
301					scrollVal = $(window).scrollTop(),
302					windowHeight = $(window).height(),
303					footerOffset = $('footer').offset().top;
304				if(scrollVal > 150){
305					$('#scrollToTop').stop(true, true).addClass('visible');
306					_isScrolling = false;
307				}
308				else{
309					$('#scrollToTop').stop(true, true).removeClass('visible');
310					_isScrolling = false;
311				}
312				CheckScrollToTop();
313			}
314		});
315	}
316}
317
318CheckScrollToTop = function(){
319	var bottom = 23,
320		scrollVal = $(window).scrollTop(),
321		windowHeight = $(window).height(),
322		footerOffset = $('footer').offset().top;
323
324	if(scrollVal + windowHeight > footerOffset){
325		$('#scrollToTop').css('bottom', bottom + scrollVal + windowHeight - footerOffset);
326	}
327	else if(parseInt($('#scrollToTop').css('bottom')) > bottom){
328		$('#scrollToTop').css('bottom', bottom);
329	}
330}
331
332$.fn.equalizeHeights = function( outer, classNull, minHeight ){
333	var maxHeight = this.map( function( i, e ){
334		var minus_height=0,
335			calc_height=0;
336		if(classNull!==false && $(e).find(classNull).length){
337			minus_height=parseInt($(e).find(classNull).actual('outerHeight'));
338		}
339		if(minus_height)
340			minus_height+=12;
341		$(e).css('height', '');
342		if( outer == true ){
343			calc_height=$(e).actual('outerHeight')-minus_height;
344		}else{
345			calc_height=$(e).actual('height')-minus_height;
346		}
347		if(minHeight!==false){
348			if(calc_height<minHeight){
349				calc_height+=(minHeight-calc_height);
350			}
351			if(window.matchMedia('(max-width: 520px)').matches){
352				calc_height=300;
353			}
354			if(window.matchMedia('(max-width: 400px)').matches){
355				calc_height=200;
356			}
357		}
358		return calc_height;
359	}).get();
360
361	for(var i = 0, c = maxHeight.length; i < c; ++i){
362		if(maxHeight[i] % 2){
363			--maxHeight[i];
364		}
365	}
366
367
368	return this.height( Math.max.apply( this, maxHeight ) );
369}
370
371$.fn.sliceHeight = function( options ){
372	function _slice(el){
373		el.each(function() {
374			$(this).css('line-height', '');
375			$(this).css('height', '');
376		});
377		if(typeof(options.autoslicecount) == 'undefined' || options.autoslicecount !== false){
378			var elw = (el.first().hasClass('item') ? el.first().outerWidth() : el.first().parents('.item').outerWidth());
379			var elsw = el.first().parents('.items').outerWidth();
380			if(!elsw){
381				elsw = el.first().parents('.row').outerWidth();
382			}
383			if(elsw && elw){
384				options.slice = Math.floor(elsw / elw);
385			}
386		}
387		if(options.slice){
388			for(var i = 0; i < el.length; i += options.slice){
389				$(el.slice(i, i + options.slice)).equalizeHeights(options.outer, options.classNull, options.minHeight);
390			}
391		}
392		if(options.lineheight){
393			var lineheightAdd = parseInt(options.lineheight);
394			if(isNaN(lineheightAdd)){
395				lineheightAdd = 0;
396			}
397			el.each(function() {
398				$(this).css('line-height', ($(this).actual('height') + lineheightAdd) + 'px');
399			});
400		}
401	}
402
403	var options = $.extend({
404		slice: null,
405		outer: false,
406		lineheight: false,
407		autoslicecount: true,
408		classNull: false,
409		minHeight: false,
410		options: false,
411	}, options);
412
413	var el = $(this);
414	_slice(el);
415
416	BX.addCustomEvent('onWindowResize', function(eventdata) {
417		ignoreResize.push(true);
418		_slice(el);
419		if(options.opacity=="Y"){
420			el.each(function() {
421				$(this).css('opacity', '1');
422			});
423		}
424		ignoreResize.pop();
425	});
426}
427
428waitingExists = function(selector, delay, callback){
429	if(typeof(callback) !== 'undefined' && selector.length && delay > 0){
430		delay = parseInt(delay);
431		delay = (delay < 0 ? 0 : delay);
432
433		if(!$(selector).length){
434			setTimeout(function(){
435				waitingExists(selector, delay, callback);
436			}, delay);
437		}
438		else{
439			callback();
440		}
441	}
442}
443
444waitingNotExists = function(selectorExists, selectorNotExists, delay, callback){
445	if(typeof(callback) !== 'undefined' && selectorExists.length && selectorNotExists.length && delay > 0){
446		delay = parseInt(delay);
447		delay = (delay < 0 ? 0 : delay);
448
449		setTimeout(function(){
450			if(selectorExists.length && !$(selectorNotExists).length){
451				callback();
452			}
453		}, delay);
454	}
455}
456
457function onLoadjqm(hash){
458	var name = $(hash.t).data('name'),
459		top = (($(window).height() > hash.w.height()) ? Math.floor(($(window).height() - hash.w.height()) / 2) : 0) + 'px';
460	$.each($(hash.t).get(0).attributes, function(index, attr){
461		if(/^data\-autoload\-(.+)$/.test(attr.nodeName)){
462			var key = attr.nodeName.match(/^data\-autoload\-(.+)$/)[1];
463			var el = $('input[name="'+key.toUpperCase()+'"]');
464			el.val( $(hash.t).data('autoload-'+key) ).attr('readonly', 'readonly');
465			el.attr('title', el.val());
466		}
467	});
468	if($(hash.t).data('autohide')){
469		$(hash.w).data('autohide', $(hash.t).data('autohide'));
470	}
471	if(name == 'order_product'){
472		if($(hash.t).data('product')) {
473			$('input[name="PRODUCT"]').val($(hash.t).data('product')).attr('readonly', 'readonly').attr('title', $('input[name="PRODUCT"]').val());
474		}
475	}
476	if(name == 'question'){
477		if($(hash.t).data('product')) {
478			$('input[name="NEED_PRODUCT"]').val($(hash.t).data('product')).attr('readonly', 'readonly').attr('title', $('input[name="NEED_PRODUCT"]').val());
479		}
480	}
481	hash.w.addClass('show').css({'margin-left': '-' + Math.floor(hash.w.width() / 2) + 'px', 'top': top, 'opacity': 1});
482}
483
484function onHide(hash){
485	if($(hash.w).data('autohide')){
486		eval($(hash.w).data('autohide'));
487	}
488	hash.w.css('opacity', 0).hide();
489	hash.w.empty();
490	hash.o.remove();
491	hash.w.removeClass('show');
492}
493
494$.fn.jqmEx = function(){
495	$(this).each(function(){
496		var _this = $(this);
497		var name = _this.data('name');
498
499		if(name.length){
500			var script = arStroyOptions['SITE_DIR'] + 'ajax/form.php';
501			var paramsStr = ''; var trigger = ''; var arTriggerAttrs = {};
502			$.each(_this.get(0).attributes, function(index, attr){
503				var attrName = attr.nodeName;
504				var attrValue = _this.attr(attrName);
505				trigger += '[' + attrName + '=\"' + attrValue + '\"]';
506				arTriggerAttrs[attrName] = attrValue;
507				if(/^data\-param\-(.+)$/.test(attrName)){
508					var key = attrName.match(/^data\-param\-(.+)$/)[1];
509					paramsStr += key + '=' + attrValue + '&';
510				}
511			});
512			if(!('data-page-url' in arTriggerAttrs))
513				arTriggerAttrs['data-page-url'] = location.href;
514
515			var triggerAttrs = JSON.stringify(arTriggerAttrs);
516			var encTriggerAttrs = encodeURIComponent(triggerAttrs);
517			script += '?' + paramsStr + 'data-trigger=' + encTriggerAttrs;
518
519			if(!$('.' + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').length){
520				if(_this.attr('disabled') != 'disabled'){
521					$('body').find('.' + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').remove();
522					$('body').append('<div class="' + name + '_frame jqmWindow" style="width:500px" data-trigger="' + encTriggerAttrs + '"></div>');
523					$('.' + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').jqm({trigger: trigger, onLoad: function(hash){onLoadjqm(hash);}, onHide: function(hash){onHide(hash);}, ajax:script});
524				}
525			}
526		}
527	});
528}
529
530InitFlexSlider = function() {
531	$('.flexslider:not(.thmb):not(.flexslider-init)').each(function(){
532		var slider = $(this);
533		var options;
534		var defaults = {
535			animationLoop: false,
536			controlNav: false,
537			directionNav: true,
538			animation: "slide"
539		}
540		var config = $.extend({}, defaults, options, slider.data('plugin-options'));
541		if(typeof(config.counts) != 'undefined' && config.direction !== 'vertical'){
542			config.maxItems =  getGridSize(config.counts);
543			config.minItems = getGridSize(config.counts);
544			config.move = getGridSize(config.counts);
545			config.itemWidth = 200;
546		}
547
548		config.after = config.start = function(slider){
549			var eventdata = {slider: slider};
550			BX.onCustomEvent('onSlide', [eventdata]);
551		}
552
553		config.end = function(slider){
554			var eventdata = {slider: slider};
555			BX.onCustomEvent('onSlideEnd', [eventdata]);
556		}
557
558		slider.flexslider(config).addClass('flexslider-init');
559		if(config.controlNav)
560			slider.addClass('flexslider-control-nav');
561		if(config.directionNav)
562			slider.addClass('flexslider-direction-nav');
563	});
564}
565/*
566clickTouchLink=function(selector, parent, className) {
567	$(selector).on('click', function(e) {
568		selector.closest(parent).removeClass(className);
569		if (!selector.closest(parent).hasClass(className)) {
570
571		}
572	});
573}*/
574
575touchBlock=function(selector){
576	$(selector).each(function(){
577		var th=$(this);
578		th.on('touchend', function(e) {
579			if(!th.parent().hasClass('touch_class')){
580				e.preventDefault();
581				e.stopPropagation();
582				th.parents().find('.touch_class').removeClass('touch_class');
583				th.parent().addClass('touch_class');
584				/*$('.child').css({'display':'none'});
585				th.find('.child').css({'display':'block'});*/
586			}
587		})
588	})
589}
590
591clickTouchLink = function(el, parent, item) {
592	el.on('click', function(e) {
593		var th = $(this);
594		if (!th.hasClass('move_link')) {
595			e.preventDefault();
596			$('.move_link').removeClass('move_link');
597			th.addClass('move_link');
598			th.hover();
599		}else{
600			var href = th.find('a').attr('href');
601			window.location.href = href;
602		}
603	});
604}
605
606$(document).ready(function(){
607	/*check mobile device*/
608	if (device.mobile() || device.tablet()) {
609		clickTouchLink($('.catalog.sections .item'), '.catalog.sections', '.item');
610		clickTouchLink($('.item-views.portfolio .item'), '.item-views.portfolio', '.item');
611		clickTouchLink($('.mega-menu table td>.wrap'), '.mega-menu', '>.wrap');
612		clickTouchLink($('ul.dropdown-menu>.dropdown-submenu>li'), '.wrap', '.dropdown-submenu>li');
613	}
614
615	scrollToTop();
616	CheckStickyFooter();
617	if(!jQuery.browser.safari){
618		setTimeout(function(){
619			CheckTopMenuDotted();
620		}, 250);
621		CheckHeaderFixed();
622		setTimeout(function() {$(window).resize();}, 150); // need to check resize flexslider & menu
623		setTimeout(function() {$(window).scroll();}, 250); // need to check position fixed ask block
624	}
625	else{
626		setTimeout(function(){
627			$(window).resize(); // need to check resize flexslider & menu
628			setTimeout(function(){
629				CheckTopMenuDotted();
630				CheckHeaderFixed();
631				
632				setTimeout(function(){
633					$(window).scroll();
634				}, 50);
635			}, 50);
636		}, 350);
637	}
638	
639	//CheckHeaderFixed();
640	//CheckTopMenuDotted();
641	//setTimeout(function() {$(window).resize();}, 350); // need to check resize flexslider & menu
642	//$(window).scroll();
643
644	$('.blink img').blink();
645
646	waitingNotExists('#bx-composite-banner .bx-composite-btn', '#footer .col-sm-3.hidden-md.hidden-lg #bx-composite-banner .bx-composite-btn', 500, function() {
647		$('#footer .col-sm-3.hidden-md.hidden-lg #bx-composite-banner').html($('#bx-composite-banner .bx-composite-btn').parent().html());
648	});
649
650	if(arStroyOptions['THEME']['USE_DEBUG_GOALS'] === 'Y'){
651		$.cookie('_ym_debug', 1, {path: '/',});
652	}
653	else{
654		$.cookie('_ym_debug', null, {path: '/',});
655	}
656
657	$.extend( $.validator.messages, {
658		required: BX.message('JS_REQUIRED'),
659		email: BX.message('JS_FORMAT'),
660		equalTo: BX.message('JS_PASSWORD_COPY'),
661		minlength: BX.message('JS_PASSWORD_LENGTH'),
662		remote: BX.message('JS_ERROR')
663	});
664
665	$.validator.addMethod(
666		'regexp', function( value, element, regexp ){
667			var re = new RegExp( regexp );
668			return this.optional( element ) || re.test( value );
669		},
670		BX.message('JS_FORMAT')
671	);
672
673	$.validator.addMethod(
674		'filesize', function( value, element, param ){
675			return this.optional( element ) || ( element.files[0].size <= param )
676		},
677		BX.message('JS_FILE_SIZE')
678	);
679
680	$.validator.addMethod(
681		'date', function( value, element, param ) {
682			var status = false;
683			if(!value || value.length <= 0){
684				status = false;
685			}
686			else{
687				var re = new RegExp('^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})$');
688				var matches = re.exec(value);
689				if(matches){
690					var composedDate = new Date(matches[5], (matches[3] - 1), matches[1]);
691					status = ((composedDate.getMonth() == (matches[3] - 1)) && (composedDate.getDate() == matches[1]) && (composedDate.getFullYear() == matches[5]));
692				}
693			}
694			return status;
695		}, BX.message('JS_DATE')
696	);
697
698	$.validator.addMethod(
699		'datetime', function( value, element, param ) {
700			var status = false;
701			if(!value || value.length <= 0){
702				status = false;
703			}
704			else{
705				var re = new RegExp('^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4}) ([0-9]{1,2}):([0-9]{1,2})$');
706				var matches = re.exec(value);
707				if(matches){
708					var composedDate = new Date(matches[5], (matches[3] - 1), matches[1], matches[6], matches[7]);
709					status = ((composedDate.getMonth() == (matches[3] - 1)) && (composedDate.getDate() == matches[1]) && (composedDate.getFullYear() == matches[5]) && (composedDate.getHours() == matches[6]) && (composedDate.getMinutes() == matches[7]));
710				}
711			}
712			return status;
713		}, BX.message('JS_DATETIME')
714	);
715
716	$.validator.addMethod(
717		'extension', function(value, element, param){
718			param = typeof param === 'string' ? param.replace(/,/g, '|') : 'png|jpe?g|gif';
719			return this.optional(element) || value.match(new RegExp('.(' + param + ')$', 'i'));
720		}, BX.message('JS_FILE_EXT')
721	);
722
723	$.validator.addMethod(
724		'captcha', function( value, element, params ){
725			return $.validator.methods.remote.call(this, value, element,{
726				url: arStroyOptions['SITE_DIR'] + 'ajax/check-captcha.php',
727				type: 'post',
728				data:{
729					captcha_word: value,
730					captcha_sid: function(){
731						return $(element).closest('form').find('input[name="captcha_sid"]').val();
732					}
733				}
734			});
735		},
736		BX.message('JS_ERROR')
737    );
738
739	/*reload captcha*/
740	$('body').on( 'click', '.refresh', function(e){
741		e.preventDefault();
742		$.ajax({
743			url: arStroyOptions['SITE_DIR'] + 'ajax/captcha.php'
744		}).done(function(text){
745			$('.captcha_sid').val(text);
746			$('.captcha_img').attr('src', '/bitrix/tools/captcha.php?captcha_sid=' + text);
747		});
748	});
749
750    $.validator.addMethod(
751		'recaptcha', function(value, element, param){
752			var id = $(element).closest('form').find('.g-recaptcha').attr('data-widgetid');
753			if(typeof id !== 'undefined'){
754				return grecaptcha.getResponse(id) != '';
755			}
756			else{
757				return true;
758			}
759		}, BX.message('JS_RECAPTCHA_ERROR')
760	);
761
762	$.validator.addMethod(
763		'processing_approval', function(value, element, param){
764			return $(element).is(':checked');
765		}, BX.message('JS_PROCESSING_ERROR')
766	);
767
768	$.validator.addClassRules({
769		'phone':{
770			regexp: arStroyOptions['THEME']['VALIDATE_PHONE_MASK']
771		},
772		'confirm_password':{
773			equalTo: 'input[name="REGISTER\[PASSWORD\]"]',
774			minlength: 6
775		},
776		'password':{
777			minlength: 6
778		},
779		'inputfile':{
780			extension: arStroyOptions['THEME']['VALIDATE_FILE_EXT'],
781			filesize: 5000000
782		},
783		'datetime':{
784			datetime: ''
785		},
786		'captcha':{
787			captcha: ''
788		},
789		'recaptcha':{
790			recaptcha: ''
791		},
792		'processing_approval':{
793			processing_approval: ''
794		}
795	});
796
797	InitFlexSlider();
798
799	// for check flexslider bug in composite mode
800	waitingNotExists('.detail .galery #slider', '.detail .galery #slider .flex-viewport', 
8001000, function() {
801		InitFlexSlider();
802		setTimeout(function() {
803			$(window).resize();
804		}, 350);
805	});
806
807
808	/*check mobile browser*/
809	if(jQuery.browser.mobile || device.tablet()){
810		$('.style-switcher').addClass('hidden');
811		$('.hint span').remove();
812
813		$('*[data-event="jqm"]').on('click', function(e){
814			e.preventDefault();
815			var _this = $(this);
816			var name = _this.data('name');
817
818			if(name.length){
819				var script = arStroyOptions['SITE_DIR'] + 'form/';
820				var paramsStr = ''; var arTriggerAttrs = {};
821				$.each(_this.get(0).attributes, function(index, attr){
822					var attrName = attr.nodeName;
823					var attrValue = _this.attr(attrName);
824					arTriggerAttrs[attrName] = attrValue;
825					if(/^data\-param\-(.+)$/.test(attrName)){
826						var key = attrName.match(/^data\-param\-(.+)$/)[1];
827						paramsStr += key + '=' + attrValue + '&';
828					}
829				});
830
831				if(!('data-page-url' in arTriggerAttrs))
832					arTriggerAttrs['data-page-url'] = location.href;
833
834				var triggerAttrs = JSON.stringify(arTriggerAttrs);
835				var encTriggerAttrs = encodeURIComponent(triggerAttrs);
836				script += '?name=' + name + '&' + paramsStr + 'data-trigger=' + encTriggerAttrs;
837				location.href = script;
838			}
839		});
840
841		// $('.fancybox').removeClass('fancybox');
842		$('.footer_button').css('display','none');
843		/*touchBlock('.sections.front .item a');
844		touchBlock('.portfolio.front .item a');*/
845	}
846	else{
847		$('*[data-event="jqm"]').on('click', function(e){
848			e.preventDefault();
849			$(this).jqmEx();
850			//$(this).trigger('click');
851		});
852	}
853
854	/*touch event*/
855	document.addEventListener('touchend', function(event) {
856		if(!$(event.target).closest('.menu_item_l1').length){
857			$('.front .item').removeClass('touch_class');
858		}
859	}, false);
860
861	$('a.fancybox:has(img)').fancybox({
862		tpl:{
863			closeBtn : '<a title="'+BX.message('FANCY_CLOSE')+'" class="fancybox-item fancybox-close" href="javascript:;"></a>',
864			next     : '<a title="'+BX.message('FANCY_NEXT')+'" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
865			prev     : '<a title="'+BX.message('FANCY_PREV')+'" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
866		}
867	});
868	$('a.fancybox_ext').fancybox({
869		tpl:{
870			closeBtn : '<a title="'+BX.message('FANCY_CLOSE')+'" class="fancybox-item fancybox-close" href="javascript:;"></a>',
871			next     : '<a title="'+BX.message('FANCY_NEXT')+'" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
872			prev     : '<a title="'+BX.message('FANCY_PREV')+'" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
873		}
874	});
875
876
877
878	/*licence fancy*/
879	$(document).on('click', '.fancy_gallery', function(e){
880		e.preventDefault();
881		var arPict=[];
882
883		arPict.push({
884			'href':$(this).attr('href'),
885			'title':$(this).attr('title'),
886		});
887
888		$(this).closest('.image').find('.popup_gallery .img').each(function(){
889			// arPict.push($(this).data('big'));
890			arPict.push({
891				'href':$(this).data('big'),
892				'title':$(this).data('title'),
893			});
894		})
895
896		$.fancybox(arPict, {
897			openEffect  : 'fade',
898			closeEffect : 'fade',
899			nextEffect : 'fade',
900			prevEffect : 'fade',
901			//'type'              : 'image',
902			tpl:{
903				closeBtn : '<a title="'+BX.message('FANCY_CLOSE')+'" class="fancybox-item fancybox-close" href="javascript:;"></a>',
904				next     : '<a title="'+BX.message('FANCY_NEXT')+'" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
905				prev     : '<a title="'+BX.message('FANCY_PREV')+'" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
906			},
907		});
908	})
909
910	// Responsive Menu Events
911	var addActiveClass = false;
912	$('#mainMenu li.dropdown > a, #mainMenu li.dropdown-submenu > a').on('click', function(e){
913		var _th = $(this);
914		e.preventDefault();
915
916		addActiveClass = _th.parent().hasClass('resp-active');
917
918		if(!_th.closest('.dropdown-menu').length)
919			$('#mainMenu').find('.resp-active').removeClass('resp-active');
920		if(!addActiveClass)
921			_th.closest("li").addClass("resp-active");
922		else
923			_th.closest("li").removeClass("resp-active");
924		
925	});
926
927	if($('.styled-block .row > div.col-md-3').length){
928		BX.addCustomEvent('onWindowResize', function(eventdata) {
929			try{
930				ignoreResize.push(true);
931				$('.styled-block .row > div.col-md-3').each(function() {
932					$(this).css({'height': '', 'line-height': ''});
933					var z = parseInt($('.body_media').css('top'));
934					if(z > 0){
935						var rowHeight = $(this).parents('.row').first().actual('outerHeight');
936						$(this).css({'height': rowHeight + 'px'});
937						// $(this).css({'height': rowHeight + 'px', 'line-height' : rowHeight + 'px'});
938					}
939				});
940			}
941			catch(e){}
942			finally{
943				ignoreResize.pop();
944			}
945		});
946	}
947
948	if($('.order-block').length){
949		BX.addCustomEvent('onWindowResize', function(eventdata) {
950			try{
951				ignoreResize.push(true);
952				$('.order-block').each(function() {
953					var cols = $(this).find('.row > div');
954					if(cols.length){
955						var colFirst = cols.first();
956						var colLast = cols.last();
957						var colText = colLast.find('.text');
958						var bText = colText.length;
959						var bOnlyText = cols.length === 1 && bText;
960						var bPrice = colFirst.find('.price').length;
961						var z = parseInt($('.body_media').css('top'));
962
963						cols.css({'height': '', 'padding-top': '', 'padding-bottom': ''});
964						colText.css({'height': '', 'padding-top': '', 'padding-bottom': ''});
965						if((!bPrice && z > 0) || (bPrice && z > 1)){
966							var minHeight = 83;
967
968							if(!bOnlyText){
969								var colFirst_height = colFirst.outerHeight();
970								colFirst_height = colFirst_height >= minHeight ? colFirst_height : minHeight;
971							}
972
973							if(bText){
974								var colLast_height = colLast.outerHeight();
975								colLast_height = colLast_height >= minHeight ? colLast_height : minHeight;
976							}
977
978							var colMax_height = (bText ? (!bOnlyText ? (colLast_height >= colFirst_height ? colLast_height : colFirst_height) : colLast_height) : colFirst_height);
979
980							if(!bOnlyText){
981								var textPadding = 22 + (colMax_height - colFirst.outerHeight()) / 2;
982								colFirst.css({'padding-top': textPadding + 'px', 'padding-bottom': textPadding + 'px', 'height': colMax_height + 'px'});
983							}
984							if(bText){
985								colLast.css({'height': colMax_height + 'px'});
986								var textPadding = 22 + (colMax_height - colText.outerHeight()) / 2;
987								colText.css({'padding-top': textPadding + 'px', 'padding-bottom': textPadding + 'px', 'height': colMax_height + 'px'});
988							}
989						}
990					}
991				});
992			}
993			catch(e){}
994			finally{
995				ignoreResize.pop();
996			}
997		});
998	}
999
1000	$(document).on('click', '.mega-menu .dropdown-menu', function(e){
1001		e.stopPropagation()
1002	});
1003
1004	$(document).on('click', '.mega-menu .dropdown-toggle.more-items', function(e){
1005		e.preventDefault();
1006	});
1007
1008	$('.table-menu .dropdown,.table-menu .dropdown-submenu,.table-menu .dropdown-toggle').on('mouseenter', function() {
1009		CheckTopVisibleMenu();
1010	});
1011
1012	var n = 0;
1013	$('.flex-viewport .item').on('mouseenter', function(){
1014		$(this).closest('.flexslider').find('.flex-control-nav').toggleClass('noz');
1015		$(this).closest('.flexslider').find('.flex-control-nav').css('z-index','0');
1016	})
1017	$('.flex-viewport .item').on('mouseleave', function(){
1018		$(this).closest('.flexslider').find('.flex-control-nav').toggleClass('noz');
1019		$(this).closest('.flexslider').find('.flex-control-nav').css('z-index','2');
1020	})
1021
1022	$('.mega-menu .search-item, .menu-row #title-search .fa-close').on('click', function(e) {
1023		e.preventDefault();
1024		$('.menu-row #title-search').toggleClass('hide');
1025	});
1026
1027	// $('.menu_wr.mega-menu .search input').on('keyup', function(e) {
1028	$('.logo_and_menu-row .logo-row .search-input-div input').on('keyup', function(e) {
1029		var inputValue = $(this).val();
1030		$('.menu-only .search input').val(inputValue);
1031		$('.logo_and_menu-row .logo-row .search-input-div input').val(inputValue);
1032		if(e.keyCode == 13){
1033			$('.menu-only .search form').submit();
1034		}
1035	});
1036
1037	$('.menu-row .search input').on('keyup', function(e) {
1038		var inputValue = $(this).val();
1039		$('.menu-only .search input').val(inputValue);
1040		$('.logo_and_menu-row .logo-row .search-input-div input').val(inputValue);
1041		if(e.keyCode == 13){
1042			$('.menu-only .search form').submit();
1043		}
1044	});
1045
1046	$('.logo_and_menu-row .search-button-div button').on('click', function(e) {
1047		e.preventDefault();
1048		var inputValue = $(this).parents().find('input').val();
1049		$('.menu-only .search input').val(inputValue);
1050		$('.menu-only .search form').submit();
1051	});
1052
1053	$('.filter .calendar').on('click', function() {
1054		var button = $(this).next();
1055		if(button.hasClass('calendar-icon')){
1056			button.trigger('click');
1057		}
1058	});
1059
1060	/* toggle */
1061	var $this = this,
1062		previewParClosedHeight = 25;
1063
1064	$('section.toggle >
1064 label').prepend($('<i />').addClass('fa fa-plus'));
1065	$('section.toggle > label').prepend($('<i />').addClass('fa fa-minus'));
1066	$('section.toggle.active > p').addClass('preview-active');
1067	$('section.toggle.active > div.toggle-content').slideDown(350, function() {});
1068
1069	$('section.toggle > label').click(function(e){
1070		var parentSection = $(this).parent(),
1071			parentWrapper = $(this).parents('div.toogle'),
1072			previewPar = false,
1073			isAccordion = parentWrapper.hasClass('toogle-accordion');
1074
1075		if(isAccordion && typeof(e.originalEvent) != 'undefined') {
1076			parentWrapper.find('section.toggle.active > label').trigger('click');
1077		}
1078
1079		parentSection.toggleClass('active');
1080
1081		// Preview Paragraph
1082		if( parentSection.find('> p').get(0) ){
1083			previewPar = parentSection.find('> p');
1084			var previewParCurrentHeight = previewPar.css('height');
1085			previewPar.css('height', 'auto');
1086			var previewParAnimateHeight = previewPar.css('height');
1087			previewPar.css('height', previewParCurrentHeight);
1088		}
1089
1090		// Content
1091		var toggleContent = parentSection.find('> div.toggle-content');
1092
1093		if( parentSection.hasClass('active') ){
1094			$(previewPar).animate({
1095				height: previewParAnimateHeight
1096			}, 350, function() {
1097				$(this).addClass('preview-active');
1098			});
1099			toggleContent.slideDown(350, function() {});
1100		}
1101		else{
1102			$(previewPar).animate({
1103				height: previewParClosedHeight
1104			}, 350, function() {
1105				$(this).removeClass('preview-active');
1106			});
1107			toggleContent.slideUp(350, function() {});
1108		}
1109	});
1110
1111	/* accordion */
1112	$('.accordion-head').on('click', function(e){
1113		e.preventDefault();
1114		if(!$(this).next().hasClass('collapsing')){
1115			$(this).toggleClass('accordion-open');
1116			$(this).toggleClass('accordion-close');
1117		}
1118	});
1119
1120	/* progress bar */
1121	$('[data-appear-progress-animation]').each(function(){
1122		var $this = $(this);
1123		$this.appear(function(){
1124			var delay = ($this.attr('data-appear-animation-delay') ? $this.attr('data-appear-animation-delay') : 1);
1125			if( delay > 1 )
1126				$this.css('animation-delay', delay + 'ms');
1127			$this.addClass($this.attr('data-appear-animation'));
1128
1129			setTimeout(function(){
1130				$this.animate({
1131					width: $this.attr('data-appear-progress-animation')
1132				}, 1500, 'easeOutQuad', function() {
1133					$this.find('.progress-bar-tooltip').animate({
1134						opacity: 1
1135					}, 500, 'easeOutQuad');
1136				});
1137			}, delay);
1138		}, {accX: 0, accY: -50});
1139	});
1140
1141	$('a[rel=tooltip]').tooltip();
1142	$('span[data-toggle=tooltip]').tooltip();
1143
1144	$('select.sort').on('change', function(){
1145		location.href = $(this).val();
1146	});
1147
1148	setTimeout(function(th){
1149		$('.catalog.group.list .item').each(function(){
1150			var th = $(this);
1151			if((tmp = th.find('.image').outerHeight() - th.find('.text_info').outerHeight()) > 0){
1152				th.find('.text_info .titles').height(th.find('.text_info .titles').outerHeight() + tmp);
1153			}
1154
1155		})
1156	}, 50);
1157
1158	/*item galery*/
1159	$('.thumbs .item a').on('click', function(e){
1160		e.preventDefault();
1161		$('.thumbs .item').removeClass('current');
1162		$(this).closest('.item').toggleClass('current');
1163		$('.slides li' + $(this).attr('href')).addClass('current').siblings().removeClass('current');
1164	});
1165
1166	$('header.fixed .btn-responsive-nav').on('click', function() {
1167		$('html, body').animate({scrollTop: 0}, 400);
1168	});
1169
1170	$('.more_block span').on('click', function() {
1171		var content_offset=$('.detail .scroll_block').offset();
1172		$('html, body').animate({scrollTop: content_offset.top-53}, 400);
1173	});
1174
1175	$('body').on('click', '.form .refresh-page', function(){
1176		location.href = location.href;
1177	});
1178
1179	/*animate increment*/
1180	// $('.spincrement1').counterUp({
1181	// 	delay: 80,
1182    // 	time: 1000
1183	// });
1184	$('.bx_filter_input_container input[type=text]').numeric({allow:"."});
1185	$('.top_menu_fixed_js').appendTo($('.fixed_menu .menu_wr.mega-menu'))
1186});
1187
1188var waitCounter = function(idCounter, delay, callback){
1189	var obCounter = window['yaCounter' + idCounter];
1190	if(typeof obCounter == 'object'){
1191		if(typeof callback == 'function'){
1192			callback();
1193		}
1194	}
1195	else{
1196		setTimeout(function(){
1197			waitCounter(idCounter, delay, callback);
1198		}, delay);
1199	}
1200}
1201
1202var waitReCaptcha = function(delay, callback){
1203	if(typeof grecaptcha == 'object'){
1204		if(typeof callback == 'function'){
1205			callback();
1206		}
1207	}
1208	else{
1209		setTimeout(function(){
1210			waitReCaptcha(delay, callback);
1211		}, delay);
1212	}
1213}
1214
1215var reCaptchaRender = function(response){
1216	if($('.g-recaptcha:not(.rendered)').length){
1217		waitReCaptcha(50, function(){
1218			$('.g-recaptcha:not(.rendered)').each(function(){
1219				$this = $(this);
1220				$this.addClass('rendered')
1221				var id = grecaptcha.render($this[0], {
1222					sitekey: $this.attr('data-sitekey'),
1223					theme: $this.attr('data-theme'),
1224					size: $this.attr('data-size'),
1225					callback: $this.attr('data-callback'),
1226				});
1227				$this.attr('data-widgetid', id);
1228			});
1229		});
1230	}
1231}
1232
1233var reCaptchaVerify = function(response){
1234	$('.g-recaptcha.rendered').each(function(){
1235		var id = $(this).attr('data-widgetid');
1236		if(typeof(id) !== 'undefined'){
1237			if(grecaptcha.getResponse(id) != ''){
1238				$(this).closest('form').find('.recaptcha').valid();
1239			}
1240		}
1241	});
1242}
1243
1244// Events
1245var timerScroll = false, ignoreScroll = [], documentScrollTopLast = $(document).scrollTop();
1246$(window).scroll(function(){
1247	CheckPopupTop();
1248	if(!ignoreScroll.length){
1249		if(timerScroll){
1250			clearTimeout(timerScroll);
1251			timerScroll = false;
1252		}
1253		timerScroll = setTimeout(function(){
1254			BX.onCustomEvent('onWindowScroll', false);
1255		}, 100);
1256	}
1257	documentScrollTopLast = $(document).scrollTop();
1258});
1259
1260var timerResize = false, ignoreResize = [];
1261$(window).resize(function(){
1262	CheckPopupTop();
1263	CheckScrollToTop();
1264	if(!ignoreResize.length){
1265		if(timerResize){
1266			clearTimeout(timerResize);
1267			timerResize = false;
1268		}
1269		timerResize = setTimeout(function(){
1270			BX.onCustomEvent('onWindowResize', false);
1271		}, 100);
1272	}
1273	documentScrollTopLast = $(document).scrollTop();
1274});
1275
1276BX.addCustomEvent('onWindowScroll', function(eventdata) {
1277	try{
1278		ignoreScroll.push(true);
1279	}
1280	catch(e){}
1281	finally{
1282		ignoreScroll.pop();
1283	}
1284});
1285
1286BX.addCustomEvent('onWindowResize', function(eventdata) {
1287	try{
1288		ignoreResize.push(true);
1289		CheckTopMenuDotted();
1290		CheckTopVisibleMenu();
1291		CheckFlexSlider();
1292		CheckMainBannerSliderVText($('.banners-big .flexslider'));
1293		CheckObjectsSizes();
1294		CheckFilterSeletSizes();
1295
1296		if($('.table.catalog.front').length){
1297			if($('.table.catalog.front .flexslider').find('.flex-direction-nav .flex-disabled').length){
1298				$('.table.catalog.front').find('.white.transparent').addClass('to-right');
1299			}else{
1300				$('.table.catalog.front').find('.white.transparent').removeClass('to-right');
1301			}
1302		}
1303	}
1304	catch(e){}
1305	finally{
1306		ignoreResize.pop();
1307	}
1308});
1309
1310BX.addCustomEvent('onSlide', function(eventdata) {
1311	try{
1312		ignoreResize.push(true);
1313		if(eventdata){
1314			var slider = eventdata.slider,
1315				block_projects='';
1316			if(slider){
1317				block_projects=slider.closest('.catalog.front');
1318				if(block_projects.length){
1319					if(slider.find('.flex-direction-nav .flex-disabled').length){
1320						block_projects.find('.white.transparent').addClass('to-right');
1321					}else{
1322						block_projects.find('.white.transparent').removeClass('to-right');
1323					}
1324				}
1325				// add classes .curent & .shown to slide
1326				slider.find('.item').removeClass('current');
1327				var curSlide = slider.find('.item.flex-active-slide');
1328				var curSlideId = curSlide.attr('id');
1329				curSlide.addClass('current');
1330
1331				if(curSlide.hasClass('shown')){
1332					slider.find('.item.clone[id=' + curSlideId + '_clone]').addClass('shown');
1333				}
1334
1335				curSlide.addClass('shown');
1336				slider.resize();
1337
1338				// set main banners text vertical center
1339				CheckMainBannerSliderVText(slider);
1340			}
1341		}
1342	}
1343	catch(e){}
1344	finally{
1345		ignoreResize.pop();
1346	}
1347});
1348
1349BX.addCustomEvent('onSlideEnd', function(eventdata) {
1350	try{
1351		ignoreResize.push(true);
1352		if(eventdata){
1353			var slider = eventdata.slider;
1354			if(slider){
1355
1356			}
1357		}
1358	}
1359	catch(e){}
1360	finally{
1361		ignoreResize.pop();
1362	}
1363});
1364
1365BX.addCustomEvent('onCounterGoals', function(eventdata){
1366	if(arStroyOptions['THEME']['USE_YA_COUNTER'] === 'Y'){
1367		var idCounter = arStroyOptions['THEME']['YA_COUNTER_ID'];
1368		idCounter = parseInt(idCounter);
1369
1370		if(typeof eventdata != 'object'){
1371			eventdata = {goal: 'undefined'};
1372		}
1373		if(typeof eventdata.goal != 'string'){
1374			eventdata.goal = 'undefined';
1375		}
1376
1377		if(idCounter){
1378			try{
1379				waitCounter(idCounter, 50, function(){
1380					var obCounter = window['yaCounter' + idCounter];
1381					if(typeof obCounter == 'object'){
1382						obCounter.reachGoal(eventdata.goal);
1383					}
1384				});
1385			}
1386			catch(e){
1387				console.error(e)
1388			}
1389		}
1390		else{
1391			console.info('Bad counter id!', idCounter);
1392		}
1393	}
1394})

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.