PageSourceSearch

https://verhnelebyazhie.ru/local/templates/aspro-resort/js/general.js?174568259340115

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

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.