PageSourceSearch

https://www.cdnvideo.ru/bitrix/cache/js/s1/aspro-allcorp2/template…45831ed3ffa532110859_v1.js?1790166089696639

js cdnvideo.ru collected 2026-09-24 09:01:53 UTC 696,639 bytes, 14,580 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:60:"/bitrix/templates/aspro-allcorp2/js/browser.js?1718280873996";s:6:"source";s:46:"/bitrix/templates/aspro-allcorp2/js/browser.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3var matched, browser;
4
5jQuery.uaMatch = function( ua ) {
6    ua = ua.toLowerCase();
7
8    var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
9        /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
10        /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
11        /(msie)[\s?]([\w.]+)/.exec( ua ) ||       
12        /(trident)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
13        ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
14        [];
15
16    return {
17        browser: match[ 1 ] || "",
18        version: match[ 2 ] || "0"
19    };
20};
21
22matched = jQuery.uaMatch( navigator.userAgent );
23//IE 11+ fix (Trident) 
24matched.browser = matched.browser == 'trident' ? 'msie' : matched.browser;
25browser = {};
26
27if ( matched.browser ) {
28    browser[ matched.browser ] = true;
29    browser.version = matched.version;
30}
31
32// Chrome is Webkit, but Webkit is also Safari.
33if ( browser.chrome ) {
34    browser.webkit = true;
35} else if ( browser.webkit ) {
36    browser.safari = true;
37}
38
39jQuery.browser = browser;
40/* End */
41;
42; /* Start:"a:4:{s:4:"full";s:71:"/bitrix/templates/aspro-allcorp2/js/jquery.actual.min.js?17182808731239";s:6:"source";s:56:"/bitrix/templates/aspro-allcorp2/js/jquery.actual.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
43/*! Copyright 2012, Ben Lin (http://dreamerslab.com/)
44 * Licensed under the MIT License (LICENSE.txt).
45 *
46 * Version: 1.0.19
47 *
48 * Requires: jQuery >= 1.2.3
49 */
50(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a);
51}else{a(jQuery);}}(function(a){a.fn.addBack=a.fn.addBack||a.fn.andSelf;a.fn.extend({actual:function(b,l){if(!this[b]){throw'$.actual => The jQuery method "'+b+'" you called does not exist';
52}var f={absolute:false,clone:false,includeMargin:false,display:"block"};var i=a.extend(f,l);var e=this.eq(0);var h,j;if(i.clone===true){h=function(){var m="position: absolute !important; top: -1000 !important; ";
53e=e.clone().attr("style",m).appendTo("body");};j=function(){e.remove();};}else{var g=[];var d="";var c;h=function(){c=e.parents().addBack().filter(":hidden");
54d+="visibility: hidden !important; display: "+i.display+" !important; ";if(i.absolute===true){d+="position: absolute !important; ";}c.each(function(){var m=a(this);
55var n=m.attr("style");g.push(n);m.attr("style",n?n+";"+d:d);});};j=function(){c.each(function(m){var o=a(this);var n=g[m];if(n===undefined){o.removeAttr("style");
56}else{o.attr("style",n);}});};}h();var k=/(outer)/.test(b)?e[b](i.includeMargin):e[b]();j();return k;}});}));
57
58/* End */
59;
60; /* Start:"a:4:{s:4:"full";s:70:"/bitrix/templates/aspro-allcorp2/js/jquery.fancybox.js?171828087348771";s:6:"source";s:54:"/bitrix/templates/aspro-allcorp2/js/jquery.fancybox.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
61/*!
62 * fancyBox - jQuery Plugin
63 * version: 2.1.7 (Tue, 28 Feb 2017)
64 * requires jQuery v1.6 or later
65 *
66 * Examples at http://fancyapps.com/fancybox/
67 * License: www.fancyapps.com/fancybox/#license
68 *
69 * Copyright 2017 fancyapps.com
70 *
71 */
72
73;(function (window, document, $, undefined) {
74	"use strict";
75
76	var H = $("html"),
77		W = $(window),
78		D = $(document),
79		F = $.fancybox = function () {
80			F.open.apply( this, arguments );
81		},
82		IE =  navigator.userAgent.match(/msie/i),
83		didUpdate	= null,
84		isTouch		= document.createTouch !== undefined,
85
86		isQuery	= function(obj) {
87			return obj && obj.hasOwnProperty && obj instanceof $;
88		},
89		isString = function(str) {
90			return str && $.type(str) === "string";
91		},
92		isPercentage = function(str) {
93			return isString(str) && str.indexOf('%') > 0;
94		},
95		isScrollable = function(el) {
96			return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight)));
97		},
98		getScalar = function(orig, dim) {
99			var value = parseInt(orig, 10) || 0;
100
101			if (dim && isPercentage(orig)) {
102				value = F.getViewport()[ dim ] / 100 * value;
103			}
104
105			return Math.ceil(value);
106		},
107		getValue = function(value, dim) {
108			return getScalar(value, dim) + 'px';
109		};
110
111	$.extend(F, {
112		// The current version of fancyBox
113		version: '2.1.7
vendor: 42,882 bytes, lines 113-1892
113',
114
115		defaults: {
116			padding : 15,
117			margin  : 20,
118
119			width     : 800,
120			height    : 600,
121			minWidth  : 100,
122			minHeight : 100,
123			maxWidth  : 9999,
124			maxHeight : 9999,
125			pixelRatio: 1, // Set to 2 for retina display support
126
127			autoSize   : true,
128			autoHeight : false,
129			autoWidth  : false,
130
131			autoResize  : true,
132			autoCenter  : !isTouch,
133			fitToView   : true,
134			aspectRatio : false,
135			topRatio    : 0.5,
136			leftRatio   : 0.5,
137
138			scrolling : 'auto', // 'auto', 'yes' or 'no'
139			wrapCSS   : '',
140
141			arrows     : true,
142			closeBtn   : true,
143			closeClick : false,
144			nextClick  : false,
145			mouseWheel : true,
146			autoPlay   : false,
147			playSpeed  : 3000,
148			preload    : 3,
149			modal      : false,
150			loop       : true,
151
152			ajax  : {
153				dataType : 'html',
154				headers  : { 'X-fancyBox': true }
155			},
156			iframe : {
157				scrolling : 'auto',
158				preload   : true
159			},
160			swf : {
161				wmode: 'transparent',
162				allowfullscreen   : 'true',
163				allowscriptaccess : 'always'
164			},
165
166			keys  : {
167				next : {
168					13 : 'left', // enter
169					34 : 'up',   // page down
170					39 : 'left', // right arrow
171					40 : 'up'    // down arrow
172				},
173				prev : {
174					8  : 'right',  // backspace
175					33 : 'down',   // page up
176					37 : 'right',  // left arrow
177					38 : 'down'    // up arrow
178				},
179				close  : [27], // escape key
180				play   : [32], // space - start/stop slideshow
181				toggle : [70]  // letter "f" - toggle fullscreen
182			},
183
184			direction : {
185				next : 'left',
186				prev : 'right'
187			},
188
189			scrollOutside  : true,
190
191			// Override some properties
192			index   : 0,
193			type    : null,
194			href    : null,
195			content : null,
196			title   : null,
197
198			// HTML templates
199			tpl: {
200				wrap     : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
201				image    : '<img class="fancybox-image" src="{href}" alt="" />',
202				iframe   : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + (IE ? ' allowtransparency="true"' : '') + '></iframe>',
203				error    : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
204				closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
205				next     : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
206				prev     : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>',
207				loading  : '<div id="fancybox-loading"><div></div></div>'
208			},
209
210			// Properties for each animation type
211			// Opening fancyBox
212			openEffect  : 'fade', // 'elastic', 'fade' or 'none'
213			openSpeed   : 250,
214			openEasing  : 'swing',
215			openOpacity : true,
216			openMethod  : 'zoomIn',
217
218			// Closing fancyBox
219			closeEffect  : 'fade', // 'elastic', 'fade' or 'none'
220			closeSpeed   : 250,
221			closeEasing  : 'swing',
222			closeOpacity : true,
223			closeMethod  : 'zoomOut',
224
225			// Changing next gallery item
226			nextEffect : 'elastic', // 'elastic', 'fade' or 'none'
227			nextSpeed  : 250,
228			nextEasing : 'swing',
229			nextMethod : 'changeIn',
230
231			// Changing previous gallery item
232			prevEffect : 'elastic', // 'elastic', 'fade' or 'none'
233			prevSpeed  : 250,
234			prevEasing : 'swing',
235			prevMethod : 'changeOut',
236
237			// Enable default helpers
238			helpers : {
239				overlay : true,
240				title   : true
241			},
242
243			// Callbacks
244			onCancel     : $.noop, // If canceling
245			beforeLoad   : $.noop, // Before loading
246			afterLoad    : $.noop, // After loading
247			beforeShow   : $.noop, // Before changing in current item
248			afterShow    : $.noop, // After opening
249			beforeChange : $.noop, // Before changing gallery item
250			beforeClose  : $.noop, // Before closing
251			afterClose   : $.noop  // After closing
252		},
253
254		//Current state
255		group    : {}, // Selected group
256		opts     : {}, // Group options
257		previous : null,  // Previous element
258		coming   : null,  // Element being loaded
259		current  : null,  // Currently loaded element
260		isActive : false, // Is activated
261		isOpen   : false, // Is currently open
262		isOpened : false, // Have been fully opened at least once
263
264		wrap  : null,
265		skin  : null,
266		outer : null,
267		inner : null,
268
269		player : {
270			timer    : null,
271			isActive : false
272		},
273
274		// Loaders
275		ajaxLoad   : null,
276		imgPreload : null,
277
278		// Some collections
279		transitions : {},
280		helpers     : {},
281
282		/*
283		 *	Static methods
284		 */
285
286		open: function (group, opts) {
287			if (!group) {
288				return;
289			}
290
291			if (!$.isPlainObject(opts)) {
292				opts = {};
293			}
294
295			// Close if already active
296			if (false === F.close(true)) {
297				return;
298			}
299
300			// Normalize group
301			if (!$.isArray(group)) {
302				group = isQuery(group) ? $(group).get() : [group];
303			}
304
305			// Recheck if the type of each element is `object` and set content type (image, ajax, etc)
306			$.each(group, function(i, element) {
307				var obj = {},
308					href,
309					title,
310					content,
311					type,
312					rez,
313					hrefParts,
314					selector;
315
316				if ($.type(element) === "object") {
317					// Check if is DOM element
318					if (element.nodeType) {
319						element = $(element);
320					}
321
322					if (isQuery(element)) {
323						obj = {
324							href    : element.data('fancybox-href') || element.attr('href'),
325							title   : $('<div/>').text( element.data('fancybox-title') || element.attr('title') || '' ).html(),
326							isDom   : true,
327							element : element
328						};
329
330						if ($.metadata) {
331							$.extend(true, obj, element.metadata());
332						}
333
334					} else {
335						obj = element;
336					}
337				}
338
339				href  = opts.href  || obj.href || (isString(element) ? element : null);
340				title = opts.title !== undefined ? opts.title : obj.title || '';
341
342				content = opts.content || obj.content;
343				type    = content ? 'html' : (opts.type  || obj.type);
344
345				if (!type && obj.isDom) {
346					type = element.data('fancybox-type');
347
348					if (!type) {
349						rez  = element.prop('class').match(/fancybox\.(\w+)/);
350						type = rez ? rez[1] : null;
351					}
352				}
353
354				if (isString(href)) {
355					// Try to guess the content type
356					if (!type) {
357						if (F.isImage(href)) {
358							type = 'image';
359
360						} else if (F.isSWF(href)) {
361							type = 'swf';
362
363						} else if (href.charAt(0) === '#') {
364							type = 'inline';
365
366						} else if (isString(element)) {
367							type    = 'html';
368							content = element;
369						}
370					}
371
372					// Split url into two pieces with source url and content selector, e.g,
373					// "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id"
374					if (type === 'ajax') {
375						hrefParts = href.split(/\s+/, 2);
376						href      = hrefParts.shift();
377						selector  = hrefParts.shift();
378					}
379				}
380
381				if (!content) {
382					if (type === 'inline') {
383						if (href) {
384							content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7
385
386						} else if (obj.isDom) {
387							content = element;
388						}
389
390					} else if (type === 'html') {
391						content = href;
392
393					} else if (!type && !href && obj.isDom) {
394						type    = 'inline';
395						content = element;
396					}
397				}
398
399				$.extend(obj, {
400					href     : href,
401					type     : type,
402					content  : content,
403					title    : title,
404					selector : selector
405				});
406
407				group[ i ] = obj;
408			});
409
410			// Extend the defaults
411			F.opts = $.extend(true, {}, F.defaults, opts);
412
413			// All options are merged recursive except keys
414			if (opts.keys !== undefined) {
415				F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false;
416			}
417
418			F.group = group;
419
420			return F._start(F.opts.index);
421		},
422
423		// Cancel image loading or abort ajax request
424		cancel: function () {
425			var coming = F.coming;
426
427			if (coming && false === F.trigger('onCancel')) {
428				return;
429			}
430
431			F.hideLoading();
432
433			if (!coming) {
434				return;
435			}
436
437			if (F.ajaxLoad) {
438				F.ajaxLoad.abort();
439			}
440
441			F.ajaxLoad = null;
442
443			if (F.imgPreload) {
444				F.imgPreload.onload = F.imgPreload.onerror = null;
445			}
446
447			if (coming.wrap) {
448				coming.wrap.stop(true, true).trigger('onReset').remove();
449			}
450
451			F.coming = null;
452
453			// If the first item has been canceled, then clear everything
454			if (!F.current) {
455				F._afterZoomOut( coming );
456			}
457		},
458
459		// Start closing animation if is open; remove immediately if opening/closing
460		close: function (event) {
461			F.cancel();
462
463			if (false === F.trigger('beforeClose')) {
464				return;
465			}
466
467			F.unbindEvents();
468
469			if (!F.isActive) {
470				return;
471			}
472
473			if (!F.isOpen || event === true) {
474				$('.fancybox-wrap').stop(true).trigger('onReset').remove();
475
476				F._afterZoomOut();
477
478			} else {
479				F.isOpen = F.isOpened = false;
480				F.isClosing = true;
481
482				$('.fancybox-item, .fancybox-nav').remove();
483
484				F.wrap.stop(true, true).removeClass('fancybox-opened');
485
486				F.transitions[ F.current.closeMethod ]();
487			}
488		},
489
490		// Manage slideshow:
491		//   $.fancybox.play(); - toggle slideshow
492		//   $.fancybox.play( true ); - start
493		//   $.fancybox.play( false ); - stop
494		play: function ( action ) {
495			var clear = function () {
496					clearTimeout(F.player.timer);
497				},
498				set = function () {
499					clear();
500
501					if (F.current && F.player.isActive) {
502						F.player.timer = setTimeout(F.next, F.current.playSpeed);
503					}
504				},
505				stop = function () {
506					clear();
507
508					D.unbind('.player');
509
510					F.player.isActive = false;
511
512					F.trigger('onPlayEnd');
513				},
514				start = function () {
515					if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) {
516						F.player.isActive = true;
517
518						D.bind({
519							'onCancel.player beforeClose.player' : stop,
520							'onUpdate.player'   : set,
521							'beforeLoad.player' : clear
522						});
523
524						set();
525
526						F.trigger('onPlayStart');
527					}
528				};
529
530			if (action === true || (!F.player.isActive && action !== false)) {
531				start();
532			} else {
533				stop();
534			}
535		},
536
537		// Navigate to next gallery item
538		next: function ( direction ) {
539			var current = F.current;
540
541			if (current) {
542				if (!isString(direction)) {
543					direction = current.direction.next;
544				}
545
546				F.jumpto(current.index + 1, direction, 'next');
547			}
548		},
549
550		// Navigate to previous gallery item
551		prev: function ( direction ) {
552			var current = F.current;
553
554			if (current) {
555				if (!isString(direction)) {
556					direction = current.direction.prev;
557				}
558
559				F.jumpto(current.index - 1, direction, 'prev');
560			}
561		},
562
563		// Navigate to gallery item by index
564		jumpto: function ( index, direction, router ) {
565			var current = F.current;
566
567			if (!current) {
568				return;
569			}
570
571			index = getScalar(index);
572
573			F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
574			F.router    = router || 'jumpto';
575
576			if (current.loop) {
577				if (index < 0) {
578					index = current.group.length + (index % current.group.length);
579				}
580
581				index = index % current.group.length;
582			}
583
584			if (current.group[ index ] !== undefined) {
585				F.cancel();
586
587				F._start(index);
588			}
589		},
590
591		// Center inside viewport and toggle position type to fixed or absolute if needed
592		reposition: function (e, onlyAbsolute) {
593			var current = F.current,
594				wrap    = current ? current.wrap : null,
595				pos;
596
597			if (wrap) {
598				pos = F._getPosition(onlyAbsolute);
599
600				if (e && e.type === 'scroll') {
601					delete pos.position;
602
603					wrap.stop(true, true).animate(pos, 200);
604
605				} else {
606					wrap.css(pos);
607
608					current.pos = $.extend({}, current.dim, pos);
609				}
610			}
611		},
612
613		update: function (e) {
614			var type = (e && e.originalEvent && e.originalEvent.type),
615				anyway = !type || type === 'orientationchange';
616
617			if (anyway) {
618				clearTimeout(didUpdate);
619
620				didUpdate = null;
621			}
622
623			if (!F.isOpen || didUpdate) {
624				return;
625			}
626
627			didUpdate = setTimeout(function() {
628				var current = F.current;
629
630				if (!current || F.isClosing) {
631					return;
632				}
633
634				F.wrap.removeClass('fancybox-tmp');
635
636				if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) {
637					F._setDimension();
638				}
639
640				if (!(type === 'scroll' && current.canShrink)) {
641					F.reposition(e);
642				}
643
644				F.trigger('onUpdate');
645
646				didUpdate = null;
647
648			}, (anyway && !isTouch ? 0 : 300));
649		},
650
651		// Shrink content to fit inside viewport or restore if resized
652		toggle: function ( action ) {
653			if (F.isOpen) {
654				F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView;
655
656				// Help browser to restore document dimensions
657				if (isTouch) {
658					F.wrap.removeAttr('style').addClass('fancybox-tmp');
659
660					F.trigger('onUpdate');
661				}
662
663				F.update();
664			}
665		},
666
667		hideLoading: function () {
668			D.unbind('.loading');
669
670			$('#fancybox-loading').remove();
671		},
672
673		showLoading: function () {
674			var el, viewport;
675
676			F.hideLoading();
677
678			el = $(F.opts.tpl.loading).click(F.cancel).appendTo('body');
679
680			// If user will press the escape-button, the request will be canceled
681			D.bind('keydown.loading', function(e) {
682				if ((e.which || e.keyCode) === 27) {
683					e.preventDefault();
684
685					F.cancel();
686				}
687			});
688
689			if (!F.defaults.fixed) {
690				viewport = F.getViewport();
691
692				el.css({
693					position : 'absolute',
694					top  : (viewport.h * 0.5) + viewport.y,
695					left : (viewport.w * 0.5) + viewport.x
696				});
697			}
698
699			F.trigger('onLoading');
700		},
701
702		getViewport: function () {
703			var locked = (F.current && F.current.locked) || false,
704				rez    = {
705					x: W.scrollLeft(),
706					y: W.scrollTop()
707				};
708
709			if (locked && locked.length) {
710				rez.w = locked[0].clientWidth;
711				rez.h = locked[0].clientHeight;
712
713			} else {
714				// See http://bugs.jquery.com/ticket/6724
715				rez.w = isTouch && window.innerWidth  ? window.innerWidth  : W.width();
716				rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height();
717			}
718
719			return rez;
720		},
721
722		// Unbind the keyboard / clicking actions
723		unbindEvents: function () {
724			if (F.wrap && isQuery(F.wrap)) {
725				F.wrap.unbind('.fb');
726			}
727
728			D.unbind('.fb');
729			W.unbind('.fb');
730		},
731
732		bindEvents: function () {
733			var current = F.current,
734				keys;
735
736			if (!current) {
737				return;
738			}
739
740			// Changing document height on iOS devices triggers a 'resize' event,
741			// that can change document height... repeating infinitely
742			W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
743
744			keys = current.keys;
745
746			if (keys) {
747				D.bind('keydown.fb', function (e) {
748					var code   = e.which || e.keyCode,
749						target = e.target || e.srcElement;
750
751					// Skip esc key if loading, because showLoading will cancel preloading
752					if (code === 27 && F.coming) {
753						return false;
754					}
755
756					// Ignore key combinations and key events within form elements
757					if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) {
758						$.each(keys, function(i, val) {
759							if (current.group.length > 1 && val[ code ] !== undefined) {
760								F[ i ]( val[ code ] );
761
762								e.preventDefault();
763								return false;
764							}
765
766							if ($.inArray(code, val) > -1) {
767								F[ i ] ();
768
769								e.preventDefault();
770								return false;
771							}
772						});
773					}
774				});
775			}
776
777			if ($.fn.mousewheel && current.mouseWheel) {
778				F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) {
779					var target = e.target || null,
780						parent = $(target),
781						canScroll = false;
782
783					while (parent.length) {
784						if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) {
785							break;
786						}
787
788						canScroll = isScrollable( parent[0] );
789						parent    = $(parent).parent();
790					}
791
792					if (delta !== 0 && !canScroll) {
793						if (F.group.length > 1 && !current.canShrink) {
794							if (deltaY > 0 || deltaX > 0) {
795								F.prev( deltaY > 0 ? 'down' : 'left' );
796
797							} else if (deltaY < 0 || deltaX < 0) {
798								F.next( deltaY < 0 ? 'up' : 'right' );
799							}
800
801							e.preventDefault();
802						}
803					}
804				});
805			}
806		},
807
808		trigger: function (event, o) {
809			var ret, obj = o || F.coming || F.current;
810
811			if (obj) {
812				if ($.isFunction( obj[event] )) {
813					ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1));
814				}
815
816				if (ret === false) {
817					return false;
818				}
819
820				if (obj.helpers) {
821					$.each(obj.helpers, function (helper, opts) {
822						if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
823							F.helpers[helper][event]($.extend(true, {}, F.helpers[helper].defaults, opts), obj);
824						}
825					});
826				}
827			}
828
829			D.trigger(event);
830		},
831
832		isImage: function (str) {
833			return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i);
834		},
835
836		isSWF: function (str) {
837			return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i);
838		},
839
840		_start: function (index) {
841			var coming = {},
842				obj,
843				href,
844				type,
845				margin,
846				padding;
847
848			index = getScalar( index );
849			obj   = F.group[ index ] || null;
850
851			if (!obj) {
852				return false;
853			}
854
855			coming = $.extend(true, {}, F.opts, obj);
856
857			// Convert margin and padding properties to array - top, right, bottom, left
858			margin  = coming.margin;
859			padding = coming.padding;
860
861			if ($.type(margin) === 'number') {
862				coming.margin = [margin, margin, margin, margin];
863			}
864
865			if ($.type(padding) === 'number') {
866				coming.padding = [padding, padding, padding, padding];
867			}
868
869			// 'modal' propery is just a shortcut
870			if (coming.modal) {
871				$.extend(true, coming, {
872					closeBtn   : false,
873					closeClick : false,
874					nextClick  : false,
875					arrows     : false,
876					mouseWheel : false,
877					keys       : null,
878					helpers: {
879						overlay : {
880							closeClick : false
881						}
882					}
883				});
884			}
885
886			// 'autoSize' property is a shortcut, too
887			if (coming.autoSize) {
888				coming.autoWidth = coming.autoHeight = true;
889			}
890
891			if (coming.width === 'auto') {
892				coming.autoWidth = true;
893			}
894
895			if (coming.height === 'auto') {
896				coming.autoHeight = true;
897			}
898
899			/*
900			 * Add reference to the group, so it`s possible to access from callbacks, example:
901			 * afterLoad : function() {
902			 *     this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
903			 * }
904			 */
905
906			coming.group  = F.group;
907			coming.index  = index;
908
909			// Give a chance for callback or helpers to update coming item (type, title, etc)
910			F.coming = coming;
911
912			if (false === F.trigger('beforeLoad')) {
913				F.coming = null;
914
915				return;
916			}
917
918			type = coming.type;
919			href = coming.href;
920
921			if (!type) {
922				F.coming = null;
923
924				//If we can not determine content type then drop silently or display next/prev item if looping through gallery
925				if (F.current && F.router && F.router !== 'jumpto') {
926					F.current.index = index;
927
928					return F[ F.router ]( F.direction );
929				}
930
931				return false;
932			}
933
934			F.isActive = true;
935
936			if (type === 'image' || type === 'swf') {
937				coming.autoHeight = coming.autoWidth = false;
938				coming.scrolling  = 'visible';
939			}
940
941			if (type === 'image') {
942				coming.aspectRatio = true;
943			}
944
945			if (type === 'iframe' && isTouch) {
946				coming.scrolling = 'scroll';
947			}
948
949			// Build the neccessary markup
950			coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' );
951
952			$.extend(coming, {
953				skin  : $('.fancybox-skin',  coming.wrap),
954				outer : $('.fancybox-outer', coming.wrap),
955				inner : $('.fancybox-inner', coming.wrap)
956			});
957
958			$.each(["Top", "Right", "Bottom", "Left"], function(i, v) {
959				coming.skin.css('padding' + v, getValue(coming.padding[ i ]));
960			});
961
962			F.trigger('onReady');
963
964			// Check before try to load; 'inline' and 'html' types need content, others - href
965			if (type === 'inline' || type === 'html') {
966				if (!coming.content || !coming.content.length) {
967					return F._error( 'content' );
968				}
969
970			} else if (!href) {
971				return F._error( 'href' );
972			}
973
974			if (type === 'image') {
975				F._loadImage();
976
977			} else if (type === 'ajax') {
978				F._loadAjax();
979
980			} else if (type === 'iframe') {
981				F._loadIframe();
982
983			} else {
984				F._afterLoad();
985			}
986		},
987
988		_error: function ( type ) {
989			$.extend(F.coming, {
990				type       : 'html',
991				autoWidth  : true,
992				autoHeight : true,
993				minWidth   : 0,
994				minHeight  : 0,
995				scrolling  : 'no',
996				hasError   : type,
997				content    : F.coming.tpl.error
998			});
999
1000			F._afterLoad();
1001		},
1002
1003		_loadImage: function () {
1004			// Reset preload image so it is later possible to check "complete" property
1005			var img = F.imgPreload = new Image();
1006
1007			img.onload = function () {
1008				this.onload = this.onerror = null;
1009
1010				F.coming.width  = this.width / F.opts.pixelRatio;
1011				F.coming.height = this.height / F.opts.pixelRatio;
1012
1013				F._afterLoad();
1014			};
1015
1016			img.onerror = function () {
1017				this.onload = this.onerror = null;
1018
1019				F._error( 'image' );
1020			};
1021
1022			img.src = F.coming.href;
1023
1024			if (img.complete !== true) {
1025				F.showLoading();
1026			}
1027		},
1028
1029		_loadAjax: function () {
1030			var coming = F.coming;
1031
1032			F.showLoading();
1033
1034			F.ajaxLoad = $.ajax($.extend({}, coming.ajax, {
1035				url: coming.href,
1036				error: function (jqXHR, textStatus) {
1037					if (F.coming && textStatus !== 'abort') {
1038						F._error( 'ajax', jqXHR );
1039
1040					} else {
1041						F.hideLoading();
1042					}
1043				},
1044				success: function (data, textStatus) {
1045					if (textStatus === 'success') {
1046						coming.content = data;
1047
1048						F._afterLoad();
1049					}
1050				}
1051			}));
1052		},
1053
1054		_loadIframe: function() {
1055			var coming = F.coming,
1056				iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
1057					.attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling)
1058					.attr('src', coming.href);
1059
1060			// This helps IE
1061			$(coming.wrap).bind('onReset', function () {
1062				try {
1063					$(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
1064				} catch (e) {}
1065			});
1066
1067			if (coming.iframe.preload) {
1068				F.showLoading();
1069
1070				iframe.one('load', function() {
1071					$(this).data('ready', 1);
1072
1073					// iOS will lose scrolling if we resize
1074					if (!isTouch) {
1075						$(this).bind('load.fb', F.update);
1076					}
1077
1078					// Without this trick:
1079					//   - iframe won't scroll on iOS devices
1080					//   - IE7 sometimes displays empty iframe
1081					$(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
1082
1083					F._afterLoad();
1084				});
1085			}
1086
1087			coming.content = iframe.appendTo( coming.inner );
1088
1089			if (!coming.iframe.preload) {
1090				F._afterLoad();
1091			}
1092		},
1093
1094		_preloadImages: function() {
1095			var group   = F.group,
1096				current = F.current,
1097				len     = group.length,
1098				cnt     = current.preload ? Math.min(current.preload, len - 1) : 0,
1099				item,
1100				i;
1101
1102			for (i = 1; i <= cnt; i += 1) {
1103				item = group[ (current.index + i ) % len ];
1104
1105				if (item.type === 'image' && item.href) {
1106					new Image().src = item.href;
1107				}
1108			}
1109		},
1110
1111		_afterLoad: function () {
1112			var coming   = F.coming,
1113				previous = F.current,
1114				placeholder = 'fancybox-placeholder',
1115				current,
1116				content,
1117				type,
1118				scrolling,
1119				href,
1120				embed;
1121
1122			F.hideLoading();
1123
1124			if (!coming || F.isActive === false) {
1125				return;
1126			}
1127
1128			if (false === F.trigger('afterLoad', coming, previous)) {
1129				coming.wrap.stop(true).trigger('onReset').remove();
1130
1131				F.coming = null;
1132
1133				return;
1134			}
1135
1136			if (previous) {
1137				F.trigger('beforeChange', previous);
1138
1139				previous.wrap.stop(true).removeClass('fancybox-opened')
1140					.find('.fancybox-item, .fancybox-nav')
1141					.remove();
1142			}
1143
1144			F.unbindEvents();
1145
1146			current   = coming;
1147			content   = coming.content;
1148			type      = coming.type;
1149			scrolling = coming.scrolling;
1150
1151			$.extend(F, {
1152				wrap  : current.wrap,
1153				skin  : current.skin,
1154				outer : current.outer,
1155				inner : current.inner,
1156				current  : current,
1157				previous : previous
1158			});
1159
1160			href = current.href;
1161
1162			switch (type) {
1163				case 'inline':
1164				case 'ajax':
1165				case 'html':
1166					if (current.selector) {
1167						content = $('<div>').html(content).find(current.selector);
1168
1169					} else if (isQuery(content)) {
1170						if (!content.data(placeholder)) {
1171							content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter( content ).hide() );
1172						}
1173
1174						content = content.show().detach();
1175
1176						current.wrap.bind('onReset', function () {
1177							if ($(this).find(content).length) {
1178								content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false);
1179							}
1180						});
1181					}
1182				break;
1183
1184				case 'image':
1185					content = current.tpl.image.replace(/\{href\}/g, href);
1186				break;
1187
1188				case 'swf':
1189					content = '<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>';
1190					embed   = '';
1191
1192					$.each(current.swf, function(name, val) {
1193						content += '<param name="' + name + '" value="' + val + '"></param>';
1194						embed   += ' ' + name + '="' + val + '"';
1195					});
1196
1197					content += '<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>';
1198				break;
1199			}
1200
1201			if (!(isQuery(content) && content.parent().is(current.inner))) {
1202				current.inner.append( content );
1203			}
1204
1205			// Give a chance for helpers or callbacks to update elements
1206			F.trigger('beforeShow');
1207
1208			// Set scrolling before calculating dimensions
1209			current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
1210
1211			// Set initial dimensions and start position
1212			F._setDimension();
1213
1214			F.reposition();
1215
1216			F.isOpen = false;
1217			F.coming = null;
1218
1219			F.bindEvents();
1220
1221			if (!F.isOpened) {
1222				$('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove();
1223
1224			} else if (previous.prevMethod) {
1225				F.transitions[ previous.prevMethod ]();
1226			}
1227
1228			F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ]();
1229
1230			F._preloadImages();
1231		},
1232
1233		_setDimension: function () {
1234			var viewport   = F.getViewport(),
1235				steps      = 0,
1236				canShrink  = false,
1237				canExpand  = false,
1238				wrap       = F.wrap,
1239				skin       = F.skin,
1240				inner      = F.inner,
1241				current    = F.current,
1242				width      = current.width,
1243				height     = current.height,
1244				minWidth   = current.minWidth,
1245				minHeight  = current.minHeight,
1246				maxWidth   = current.maxWidth,
1247				maxHeight  = current.maxHeight,
1248				scrolling  = current.scrolling,
1249				scrollOut  = current.scrollOutside ? current.scrollbarWidth : 0,
1250				margin     = current.margin,
1251				wMargin    = getScalar(margin[1] + margin[3]),
1252				hMargin    = getScalar(margin[0] + margin[2]),
1253				wPadding,
1254				hPadding,
1255				wSpace,
1256				hSpace,
1257				origWidth,
1258				origHeight,
1259				origMaxWidth,
1260				origMaxHeight,
1261				ratio,
1262				width_,
1263				height_,
1264				maxWidth_,
1265				maxHeight_,
1266				iframe,
1267				body;
1268
1269			// Reset dimensions so we could re-check actual size
1270			wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp');
1271
1272			wPadding = getScalar(skin.outerWidth(true)  - skin.width());
1273			hPadding = getScalar(skin.outerHeight(true) - skin.height());
1274
1275			// Any space between content and viewport (margin, padding, border, title)
1276			wSpace = wMargin + wPadding;
1277			hSpace = hMargin + hPadding;
1278
1279			origWidth  = isPercentage(width)  ? (viewport.w - wSpace) * getScalar(width)  / 100 : width;
1280			origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height;
1281
1282			if (current.type === 'iframe') {
1283				iframe = current.content;
1284
1285				if (current.autoHeight && iframe && iframe.data('ready') === 1) {
1286					try {
1287						if (iframe[0].contentWindow.document.location) {
1288							inner.width( origWidth ).height(9999);
1289
1290							body = iframe.contents().find('body');
1291
1292							if (scrollOut) {
1293								body.css('overflow-x', 'hidden');
1294							}
1295
1296							origHeight = body.outerHeight(true);
1297						}
1298
1299					} catch (e) {}
1300				}
1301
1302			} else if (current.autoWidth || current.autoHeight) {
1303				inner.addClass( 'fancybox-tmp' );
1304
1305				// Set width or height in case we need to calculate only one dimension
1306				if (!current.autoWidth) {
1307					inner.width( origWidth );
1308				}
1309
1310				if (!current.autoHeight) {
1311					inner.height( origHeight );
1312				}
1313
1314				if (current.autoWidth) {
1315					origWidth = inner.width();
1316				}
1317
1318				if (current.autoHeight) {
1319					origHeight = inner.height();
1320				}
1321
1322				inner.removeClass( 'fancybox-tmp' );
1323			}
1324
1325			width  = getScalar( origWidth );
1326			height = getScalar( origHeight );
1327
1328			ratio  = origWidth / origHeight;
1329
1330			// Calculations for the content
1331			minWidth  = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth);
1332			maxWidth  = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth);
1333
1334			minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight);
1335			maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight);
1336
1337			// These will be used to determine if wrap can fit in the viewport
1338			origMaxWidth  = maxWidth;
1339			origMaxHeight = maxHeight;
1340
1341			if (current.fitToView) {
1342				maxWidth  = Math.min(viewport.w - wSpace, maxWidth);
1343				maxHeight = Math.min(viewport.h - hSpace, maxHeight);
1344			}
1345
1346			maxWidth_  = viewport.w - wMargin;
1347			maxHeight_ = viewport.h - hMargin;
1348
1349			if (current.aspectRatio) {
1350				if (width > maxWidth) {
1351					width  = maxWidth;
1352					height = getScalar(width / ratio);
1353				}
1354
1355				if (height > maxHeight) {
1356					height = maxHeight;
1357					width  = getScalar(height * ratio);
1358				}
1359
1360				if (width < minWidth) {
1361					width  = minWidth;
1362					height = getScalar(width / ratio);
1363				}
1364
1365				if (height < minHeight) {
1366					height = minHeight;
1367					width  = getScalar(height * ratio);
1368				}
1369
1370			} else {
1371				width = Math.max(minWidth, Math.min(width, maxWidth));
1372
1373				if (current.autoHeight && current.type !== 'iframe') {
1374					inner.width( width );
1375
1376					height = inner.height();
1377				}
1378
1379				height = Math.max(minHeight, Math.min(height, maxHeight));
1380			}
1381
1382			// Try to fit inside viewport (including the title)
1383			if (current.fitToView) {
1384				inner.width( width ).height( height );
1385
1386				wrap.width( width + wPadding );
1387
1388				// Real wrap dimensions
1389				width_  = wrap.width();
1390				height_ = wrap.height();
1391
1392				if (current.aspectRatio) {
1393					while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) {
1394						if (steps++ > 19) {
1395							break;
1396						}
1397
1398						height = Math.max(minHeight, Math.min(maxHeight, height - 10));
1399						width  = getScalar(height * ratio);
1400
1401						if (width < minWidth) {
1402							width  = minWidth;
1403							height = getScalar(width / ratio);
1404						}
1405
1406						if (width > maxWidth) {
1407							width  = maxWidth;
1408							height = getScalar(width / ratio);
1409						}
1410
1411						inner.width( width ).height( height );
1412
1413						wrap.width( width + wPadding );
1414
1415						width_  = wrap.width();
1416						height_ = wrap.height();
1417					}
1418
1419				} else {
1420					width  = Math.max(minWidth,  Math.min(width,  width  - (width_  - maxWidth_)));
1421					height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_)));
1422				}
1423			}
1424
1425			if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) {
1426				width += scrollOut;
1427			}
1428
1429			inner.width( width ).height( height );
1430
1431			wrap.width( width + wPadding );
1432
1433			width_  = wrap.width();
1434			height_ = wrap.height();
1435
1436			canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight;
1437			canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight));
1438
1439			$.extend(current, {
1440				dim : {
1441					width	: getValue( width_ ),
1442					height	: getValue( height_ )
1443				},
1444				origWidth  : origWidth,
1445				origHeight : origHeight,
1446				canShrink  : canShrink,
1447				canExpand  : canExpand,
1448				wPadding   : wPadding,
1449				hPadding   : hPadding,
1450				wrapSpace  : height_ - skin.outerHeight(true),
1451				skinSpace  : skin.height() - height
1452			});
1453
1454			if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) {
1455				inner.height('auto');
1456			}
1457		},
1458
1459		_getPosition: function (onlyAbsolute) {
1460			var current  = F.current,
1461				viewport = F.getViewport(),
1462				margin   = current.margin,
1463				width    = F.wrap.width()  + margin[1] + margin[3],
1464				height   = F.wrap.height() + margin[0] + margin[2],
1465				rez      = {
1466					position: 'absolute',
1467					top  : margin[0],
1468					left : margin[3]
1469				};
1470
1471			if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
1472				rez.position = 'fixed';
1473
1474			} else if (!current.locked) {
1475				rez.top  += viewport.y;
1476				rez.left += viewport.x;
1477			}
1478
1479			rez.top  = getValue(Math.max(rez.top,  rez.top  + ((viewport.h - height) * current.topRatio)));
1480			rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width)  * current.leftRatio)));
1481
1482			return rez;
1483		},
1484
1485		_afterZoomIn: function () {
1486			var current = F.current;
1487
1488			if (!current) {
1489				return;
1490			}
1491
1492			F.isOpen = F.isOpened = true;
1493
1494			F.wrap.css('overflow', 'visible').addClass('fancybox-opened').hide().show(0);
1495
1496			F.update();
1497
1498			// Assign a click event
1499			if ( current.closeClick || (current.nextClick && F.group.length > 1) ) {
1500				F.inner.css('cursor', 'pointer').bind('click.fb', function(e) {
1501					if (!$(e.target).is('a') && !$(e.target).parent().is('a')) {
1502						e.preventDefault();
1503
1504						F[ current.closeClick ? 'close' : 'next' ]();
1505					}
1506				});
1507			}
1508
1509			// Create a close button
1510			if (current.closeBtn) {
1511				$(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e) {
1512					e.preventDefault();
1513
1514					F.close();
1515				});
1516			}
1517
1518			// Create navigation arrows
1519			if (current.arrows && F.group.length > 1) {
1520				if (current.loop || current.index > 0) {
1521					$(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev);
1522				}
1523
1524				if (current.loop || current.index < F.group.length - 1) {
1525					$(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next);
1526				}
1527			}
1528
1529			F.trigger('afterShow');
1530
1531			// Stop the slideshow if this is the last item
1532			if (!current.loop && current.index === current.group.length - 1) {
1533
1534				F.play( false );
1535
1536			} else if (F.opts.autoPlay && !F.player.isActive) {
1537				F.opts.autoPlay = false;
1538
1539				F.play(true);
1540			}
1541		},
1542
1543		_afterZoomOut: function ( obj ) {
1544			obj = obj || F.current;
1545
1546			$('.fancybox-wrap').trigger('onReset').remove();
1547
1548			$.extend(F, {
1549				group  : {},
1550				opts   : {},
1551				router : false,
1552				current   : null,
1553				isActive  : false,
1554				isOpened  : false,
1555				isOpen    : false,
1556				isClosing : false,
1557				wrap   : null,
1558				skin   : null,
1559				outer  : null,
1560				inner  : null
1561			});
1562
1563			F.trigger('afterClose', obj);
1564		}
1565	});
1566
1567	/*
1568	 *	Default transitions
1569	 */
1570
1571	F.transitions = {
1572		getOrigPosition: function () {
1573			var current  = F.current,
1574				element  = current.element,
1575				orig     = current.orig,
1576				pos      = {},
1577				width    = 50,
1578				height   = 50,
1579				hPadding = current.hPadding,
1580				wPadding = current.wPadding,
1581				viewport = F.getViewport();
1582
1583			if (!orig && current.isDom && element.is(':visible')) {
1584				orig = element.find('img:first');
1585
1586				if (!orig.length) {
1587					orig = element;
1588				}
1589			}
1590
1591			if (isQuery(orig)) {
1592				pos = orig.offset();
1593
1594				if (orig.is('img')) {
1595					width  = orig.outerWidth();
1596					height = orig.outerHeight();
1597				}
1598
1599			} else {
1600				pos.top  = viewport.y + (viewport.h - height) * current.topRatio;
1601				pos.left = viewport.x + (viewport.w - width)  * current.leftRatio;
1602			}
1603
1604			if (F.wrap.css('position') === 'fixed' || current.locked) {
1605				pos.top  -= viewport.y;
1606				pos.left -= viewport.x;
1607			}
1608
1609			pos = {
1610				top     : getValue(pos.top  - hPadding * current.topRatio),
1611				left    : getValue(pos.left - wPadding * current.leftRatio),
1612				width   : getValue(width  + wPadding),
1613				height  : getValue(height + hPadding)
1614			};
1615
1616			return pos;
1617		},
1618
1619		step: function (now, fx) {
1620			var ratio,
1621				padding,
1622				value,
1623				prop       = fx.prop,
1624				current    = F.current,
1625				wrapSpace  = current.wrapSpace,
1626				skinSpace  = current.skinSpace;
1627
1628			if (prop === 'width' || prop === 'height') {
1629				ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start);
1630
1631				if (F.isClosing) {
1632					ratio = 1 - ratio;
1633				}
1634
1635				padding = prop === 'width' ? current.wPadding : current.hPadding;
1636				value   = now - padding;
1637
1638				F.skin[ prop ](  getScalar( prop === 'width' ?  value : value - (wrapSpace * ratio) ) );
1639				F.inner[ prop ]( getScalar( prop === 'width' ?  value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) );
1640			}
1641		},
1642
1643		zoomIn: function () {
1644			var current  = F.current,
1645				startPos = current.pos,
1646				effect   = current.openEffect,
1647				elastic  = effect === 'elastic',
1648				endPos   = $.extend({opacity : 1}, startPos);
1649
1650			// Remove "position" property that breaks older IE
1651			delete endPos.position;
1652
1653			if (elastic) {
1654				startPos = this.getOrigPosition();
1655
1656				if (current.openOpacity) {
1657					startPos.opacity = 0.1;
1658				}
1659
1660			} else if (effect === 'fade') {
1661				startPos.opacity = 0.1;
1662			}
1663
1664			F.wrap.css(startPos).animate(endPos, {
1665				duration : effect === 'none' ? 0 : current.openSpeed,
1666				easing   : current.openEasing,
1667				step     : elastic ? this.step : null,
1668				complete : F._afterZoomIn
1669			});
1670		},
1671
1672		zoomOut: function () {
1673			var current  = F.current,
1674				effect   = current.closeEffect,
1675				elastic  = effect === 'elastic',
1676				endPos   = {opacity : 0.1};
1677
1678			if (elastic) {
1679				endPos = this.getOrigPosition();
1680
1681				if (current.closeOpacity) {
1682					endPos.opacity = 0.1;
1683				}
1684			}
1685
1686			F.wrap.animate(endPos, {
1687				duration : effect === 'none' ? 0 : current.closeSpeed,
1688				easing   : current.closeEasing,
1689				step     : elastic ? this.step : null,
1690				complete : F._afterZoomOut
1691			});
1692		},
1693
1694		changeIn: function () {
1695			var current   = F.current,
1696				effect    = current.nextEffect,
1697				startPos  = current.pos,
1698				endPos    = { opacity : 1 },
1699				direction = F.direction,
1700				distance  = 200,
1701				field;
1702
1703			startPos.opacity = 0.1;
1704
1705			if (effect === 'elastic') {
1706				field = direction === 'down' || direction === 'up' ? 'top' : 'left';
1707
1708				if (direction === 'down' || direction === 'right') {
1709					startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance);
1710					endPos[ field ]   = '+=' + distance + 'px';
1711
1712				} else {
1713					startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance);
1714					endPos[ field ]   = '-=' + distance + 'px';
1715				}
1716			}
1717
1718			// Workaround for http://bugs.jquery.com/ticket/12273
1719			if (effect === 'none') {
1720				F._afterZoomIn();
1721
1722			} else {
1723				F.wrap.css(startPos).animate(endPos, {
1724					duration : current.nextSpeed,
1725					easing   : current.nextEasing,
1726					complete : F._afterZoomIn
1727				});
1728			}
1729		},
1730
1731		changeOut: function () {
1732			var previous  = F.previous,
1733				effect    = previous.prevEffect,
1734				endPos    = { opacity : 0.1 },
1735				direction = F.direction,
1736				distance  = 200;
1737
1738			if (effect === 'elastic') {
1739				endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px';
1740			}
1741
1742			previous.wrap.animate(endPos, {
1743				duration : effect === 'none' ? 0 : previous.prevSpeed,
1744				easing   : previous.prevEasing,
1745				complete : function () {
1746					$(this).trigger('onReset').remove();
1747				}
1748			});
1749		}
1750	};
1751
1752	/*
1753	 *	Overlay helper
1754	 */
1755
1756	F.helpers.overlay = {
1757		defaults : {
1758			closeClick : true,      // if true, fancyBox will be closed when user clicks on the overlay
1759			speedOut   : 200,       // duration of fadeOut animation
1760			showEarly  : true,      // indicates if should be opened immediately or wait until the content is ready
1761			css        : {},        // custom CSS properties
1762			locked     : !isTouch,  // if true, the content will be locked into overlay
1763			fixed      : true       // if false, the overlay CSS position property will not be set to "fixed"
1764		},
1765
1766		overlay : null,      // current handle
1767		fixed   : false,     // indicates if the overlay has position "fixed"
1768		el      : $('html'), // element that contains "the lock"
1769
1770		// Public methods
1771		create : function(opts) {
1772			var parent;
1773
1774			opts = $.extend({}, this.defaults, opts);
1775
1776			if (this.overlay) {
1777				this.close();
1778			}
1779
1780			parent = F.coming ? F.coming.parent : opts.parent;
1781
1782			this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( parent && parent.length ? parent : 'body' );
1783			this.fixed   = false;
1784
1785			if (opts.fixed && F.defaults.fixed) {
1786				this.overlay.addClass('fancybox-overlay-fixed');
1787
1788				this.fixed = true;
1789			}
1790		},
1791
1792		open : function(opts) {
1793			var that = this;
1794
1795			opts = $.extend({}, this.defaults, opts);
1796
1797			if (this.overlay) {
1798				this.overlay.unbind('.overlay').width('auto').height('auto');
1799
1800			} else {
1801				this.create(opts);
1802			}
1803
1804			if (!this.fixed) {
1805				W.bind('resize.overlay', $.proxy( this.update, this) );
1806
1807				this.update();
1808			}
1809
1810			if (opts.closeClick) {
1811				this.overlay.bind('click.overlay', function(e) {
1812					if ($(e.target).hasClass('fancybox-overlay')) {
1813						if (F.isActive) {
1814							F.close();
1815						} else {
1816							that.close();
1817						}
1818
1819						return false;
1820					}
1821				});
1822			}
1823
1824			this.overlay.css( opts.css ).show();
1825		},
1826
1827		close : function() {
1828			W.unbind('resize.overlay');
1829
1830			if (this.el.hasClass('fancybox-lock')) {
1831				$('.fancybox-margin').removeClass('fancybox-margin');
1832
1833				this.el.removeClass('fancybox-lock');
1834
1835				W.scrollTop( this.scrollV ).scrollLeft( this.scrollH );
1836			}
1837
1838			$('.fancybox-overlay').remove().hide();
1839
1840			$.extend(this, {
1841				overlay : null,
1842				fixed   : false
1843			});
1844		},
1845
1846		// Private, callbacks
1847
1848		update : function () {
1849			var width = '100%', offsetWidth;
1850
1851			// Reset width/height so it will not mess
1852			this.overlay.width(width).height('100%');
1853
1854			// jQuery does not return reliable result for IE
1855			if (IE) {
1856				offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
1857
1858				if (D.width() > offsetWidth) {
1859					width = D.width();
1860				}
1861
1862			} else if (D.width() > W.width()) {
1863				width = D.width();
1864			}
1865
1866			this.overlay.width(width).height(D.height());
1867		},
1868
1869		// This is where we can manipulate DOM, because later it would cause iframes to reload
1870		onReady : function (opts, obj) {
1871			var overlay = this.overlay;
1872
1873			$('.fancybox-overlay').stop(true, true);
1874
1875			if (!overlay) {
1876				this.create(opts);
1877			}
1878
1879			if (opts.locked && this.fixed && obj.fixed) {
1880				obj.locked = this.overlay.append( obj.wrap );
1881				obj.fixed  = false;
1882			}
1883
1884			if (opts.showEarly === true) {
1885				this.beforeShow.apply(this, arguments);
1886			}
1887		},
1888
1889		beforeShow : function(opts, obj) {
1890			if (obj.locked && !this.el.hasClass('fancybox-lock')) {
1891				if (this.fixPosition !== false) {
1892					$('*
vendor: 1,346 bytes, lines 1892-1950
1892:not(object)').filter(function(){
1893						return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") );
1894					}).addClass('fancybox-margin');
1895				}
1896
1897				this.el.addClass('fancybox-margin');
1898
1899				this.scrollV = W.scrollTop();
1900				this.scrollH = W.scrollLeft();
1901
1902				this.el.addClass('fancybox-lock');
1903
1904				W.scrollTop( this.scrollV ).scrollLeft( this.scrollH );
1905			}
1906
1907			this.open(opts);
1908		},
1909
1910		onUpdate : function() {
1911			if (!this.fixed) {
1912				this.update();
1913			}
1914		},
1915
1916		afterClose: function (opts) {
1917			// Remove overlay if exists and fancyBox is not opening
1918			// (e.g., it is not being open using afterClose callback)
1919			if (this.overlay && !F.coming) {
1920				this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this ));
1921			}
1922		}
1923	};
1924
1925	/*
1926	 *	Title helper
1927	 */
1928
1929	F.helpers.title = {
1930		defaults : {
1931			type     : 'float', // 'float', 'inside', 'outside' or 'over',
1932			position : 'bottom' // 'top' or 'bottom'
1933		},
1934
1935		beforeShow: function (opts) {
1936			var current = F.current,
1937				text    = current.title,
1938				type    = opts.type,
1939				title,
1940				target;
1941
1942			if ($.isFunction(text)) {
1943				text = text.call(current.element, current);
1944			}
1945
1946			if (!isString(text) || $.trim(text) === '') {
1947				return;
1948			}
1949
1950			title = $('<div class="fancybox-title fancybox-title-' + type + '-wrap">
vendor: 4,774 bytes, lines 1950-2111
1950' + text + '</div>');
1951
1952			switch (type) {
1953				case 'inside':
1954					target = F.skin;
1955				break;
1956
1957				case 'outside':
1958					target = F.wrap;
1959				break;
1960
1961				case 'over':
1962					target = F.inner;
1963				break;
1964
1965				default: // 'float'
1966					target = F.skin;
1967
1968					title.appendTo('body');
1969
1970					if (IE) {
1971						title.width( title.width() );
1972					}
1973
1974					title.wrapInner('<span class="child"></span>');
1975
1976					//Increase bottom margin so this title will also fit into viewport
1977					F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) );
1978				break;
1979			}
1980
1981			title[ (opts.position === 'top' ? 'prependTo'  : 'appendTo') ](target);
1982		}
1983	};
1984
1985	// jQuery plugin initialization
1986	$.fn.fancybox = function (options) {
1987		var index,
1988			that     = $(this),
1989			selector = this.selector || '',
1990			run      = function(e) {
1991				var what = $(this).blur(), idx = index, relType, relVal;
1992
1993				if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) {
1994					relType = options.groupAttr || 'data-fancybox-group';
1995					relVal  = what.attr(relType);
1996
1997					if (!relVal) {
1998						relType = 'rel';
1999						relVal  = what.get(0)[ relType ];
2000					}
2001
2002					if (relVal && relVal !== '' && relVal !== 'nofollow') {
2003						what = selector.length ? $(selector) : that;
2004						what = what.filter('[' + relType + '="' + relVal + '"]');
2005						idx  = what.index(this);
2006					}
2007
2008					options.index = idx;
2009
2010					// Stop an event from bubbling if everything is fine
2011					if (F.open(what, options) !== false) {
2012						e.preventDefault();
2013					}
2014				}
2015			};
2016
2017		options = options || {};
2018		index   = options.index || 0;
2019
2020		if (!selector || options.live === false) {
2021			that.unbind('click.fb-start').bind('click.fb-start', run);
2022
2023		} else {
2024			D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
2025		}
2026
2027		this.filter('[data-fancybox-start=1]').trigger('click');
2028
2029		return this;
2030	};
2031
2032	// Tests that need a body at doc ready
2033	D.ready(function() {
2034		var w1, w2;
2035
2036		if ( $.scrollbarWidth === undefined ) {
2037			// http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
2038			$.scrollbarWidth = function() {
2039				var parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'),
2040					child  = parent.children(),
2041					width  = child.innerWidth() - child.height( 99 ).innerWidth();
2042
2043				parent.remove();
2044
2045				return width;
2046			};
2047		}
2048
2049		if ( $.support.fixedPosition === undefined ) {
2050			$.support.fixedPosition = (function() {
2051				var elem  = $('<div style="position:fixed;top:20px;"></div>').appendTo('body'),
2052					fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 );
2053
2054				elem.remove();
2055
2056				return fixed;
2057			}());
2058		}
2059
2060		$.extend(F.defaults, {
2061			scrollbarWidth : $.scrollbarWidth(),
2062			fixed  : $.support.fixedPosition,
2063			parent : $('body')
2064		});
2065
2066		//Get real width of page scroll-bar
2067		w1 = $(window).width();
2068
2069		H.addClass('fancybox-lock-test');
2070
2071		w2 = $(window).width();
2072
2073		H.removeClass('fancybox-lock-test');
2074
2075		$("<style type='text/css'>.fancybox-margin{margin-right:" + (w2 - w1) + "px;}</style>").appendTo("head");
2076	});
2077
2078}(window, document, jQuery));
2079
2080/* End */
2081;
2082; /* Start:"a:4:{s:4:"full";s:71:"/bitrix/templates/aspro-allcorp2/vendor/jquery.easing.js?17182808618097";s:6:"source";s:56:"/bitrix/templates/aspro-allcorp2/vendor/jquery.easing.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2083/*
2084 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
2085 *
2086 * Uses the built in easing capabilities added In jQuery 1.1
2087 * to offer multiple easing options
2088 *
2089 * TERMS OF USE - jQuery Easing
2090 * 
2091 * Open source under the BSD License. 
2092 * 
2093 * Copyright © 2008 George McGinley Smith
2094 * All rights reserved.
2095 * 
2096 * Redistribution and use in source and binary forms, with or without modification, 
2097 * are permitted provided that the following conditions are met:
2098 * 
2099 * Redistributions of source code must retain the above copyright notice, this list of 
2100 * conditions and the following disclaimer.
2101 * Redistributions in binary form must reproduce the above copyright notice, this list 
2102 * of conditions and the following disclaimer in the documentation and/or other materials 
2103 * provided with the distribution.
2104 * 
2105 * Neither the name of the author nor the names of contributors may be used to endorse 
2106 * or promote products derived from this software without specific prior written permission.
2107 * 
2108 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
2109 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2110 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2111 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 5,091 bytes, lines 2112-2257
2112 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
2113 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
2114 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
2115 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
2116 * OF THE POSSIBILITY OF SUCH DAMAGE. 
2117 *
2118*/
2119
2120// t: current time, b: begInnIng value, c: change In value, d: duration
2121jQuery.easing['jswing'] = jQuery.easing['swing'];
2122
2123jQuery.extend( jQuery.easing,
2124{
2125	def: 'easeOutQuad',
2126	swing: function (x, t, b, c, d) {
2127		//alert(jQuery.easing.default);
2128		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
2129	},
2130	easeInQuad: function (x, t, b, c, d) {
2131		return c*(t/=d)*t + b;
2132	},
2133	easeOutQuad: function (x, t, b, c, d) {
2134		return -c *(t/=d)*(t-2) + b;
2135	},
2136	easeInOutQuad: function (x, t, b, c, d) {
2137		if ((t/=d/2) < 1) return c/2*t*t + b;
2138		return -c/2 * ((--t)*(t-2) - 1) + b;
2139	},
2140	easeInCubic: function (x, t, b, c, d) {
2141		return c*(t/=d)*t*t + b;
2142	},
2143	easeOutCubic: function (x, t, b, c, d) {
2144		return c*((t=t/d-1)*t*t + 1) + b;
2145	},
2146	easeInOutCubic: function (x, t, b, c, d) {
2147		if ((t/=d/2) < 1) return c/2*t*t*t + b;
2148		return c/2*((t-=2)*t*t + 2) + b;
2149	},
2150	easeInQuart: function (x, t, b, c, d) {
2151		return c*(t/=d)*t*t*t + b;
2152	},
2153	easeOutQuart: function (x, t, b, c, d) {
2154		return -c * ((t=t/d-1)*t*t*t - 1) + b;
2155	},
2156	easeInOutQuart: function (x, t, b, c, d) {
2157		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
2158		return -c/2 * ((t-=2)*t*t*t - 2) + b;
2159	},
2160	easeInQuint: function (x, t, b, c, d) {
2161		return c*(t/=d)*t*t*t*t + b;
2162	},
2163	easeOutQuint: function (x, t, b, c, d) {
2164		return c*((t=t/d-1)*t*t*t*t + 1) + b;
2165	},
2166	easeInOutQuint: function (x, t, b, c, d) {
2167		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
2168		return c/2*((t-=2)*t*t*t*t + 2) + b;
2169	},
2170	easeInSine: function (x, t, b, c, d) {
2171		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
2172	},
2173	easeOutSine: function (x, t, b, c, d) {
2174		return c * Math.sin(t/d * (Math.PI/2)) + b;
2175	},
2176	easeInOutSine: function (x, t, b, c, d) {
2177		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
2178	},
2179	easeInExpo: function (x, t, b, c, d) {
2180		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
2181	},
2182	easeOutExpo: function (x, t, b, c, d) {
2183		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
2184	},
2185	easeInOutExpo: function (x, t, b, c, d) {
2186		if (t==0) return b;
2187		if (t==d) return b+c;
2188		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
2189		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
2190	},
2191	easeInCirc: function (x, t, b, c, d) {
2192		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
2193	},
2194	easeOutCirc: function (x, t, b, c, d) {
2195		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
2196	},
2197	easeInOutCirc: function (x, t, b, c, d) {
2198		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
2199		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
2200	},
2201	easeInElastic: function (x, t, b, c, d) {
2202		var s=1.70158;var p=0;var a=c;
2203		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
2204		if (a < Math.abs(c)) { a=c; var s=p/4; }
2205		else var s = p/(2*Math.PI) * Math.asin (c/a);
2206		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
2207	},
2208	easeOutElastic: function (x, t, b, c, d) {
2209		var s=1.70158;var p=0;var a=c;
2210		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
2211		if (a < Math.abs(c)) { a=c; var s=p/4; }
2212		else var s = p/(2*Math.PI) * Math.asin (c/a);
2213		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
2214	},
2215	easeInOutElastic: function (x, t, b, c, d) {
2216		var s=1.70158;var p=0;var a=c;
2217		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
2218		if (a < Math.abs(c)) { a=c; var s=p/4; }
2219		else var s = p/(2*Math.PI) * Math.asin (c/a);
2220		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
2221		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
2222	},
2223	easeInBack: function (x, t, b, c, d, s) {
2224		if (s == undefined) s = 1.70158;
2225		return c*(t/=d)*t*((s+1)*t - s) + b;
2226	},
2227	easeOutBack: function (x, t, b, c, d, s) {
2228		if (s == undefined) s = 1.70158;
2229		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
2230	},
2231	easeInOutBack: function (x, t, b, c, d, s) {
2232		if (s == undefined) s = 1.70158; 
2233		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
2234		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
2235	},
2236	easeInBounce: function (x, t, b, c, d) {
2237		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
2238	},
2239	easeOutBounce: function (x, t, b, c, d) {
2240		if ((t/=d) < (1/2.75)) {
2241			return c*(7.5625*t*t) + b;
2242		} else if (t < (2/2.75)) {
2243			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
2244		} else if (t < (2.5/2.75)) {
2245			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
2246		} else {
2247			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
2248		}
2249	},
2250	easeInOutBounce: function (x, t, b, c, d) {
2251		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
2252		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
2253	}
2254});
2255
2256/*
2257 *
2258 * TERMS OF USE - EASING EQUATIONS
2259 * 
2260 * Open source under the BSD License. 
2261 * 
2262 * Copyright © 2001 Robert Penner
2263 * All rights reserved.
2264 * 
2265 * Redistribution and use in source and binary forms, with or without modification, 
2266 * are permitted provided that the following conditions are met:
2267 * 
2268 * Redistributions of source code must retain the above copyright notice, this list of 
2269 * conditions and the following disclaimer.
2270 * Redistributions in binary form must reproduce the above copyright notice, this list 
2271 * of conditions and the following disclaimer in the documentation and/or other materials 
2272 * provided with the distribution.
2273 * 
2274 * Neither the name of the author nor the names of contributors may be used to endorse 
2275 * or promote products derived from this software without specific prior written permission.
2276 * 
2277 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
2278 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2279 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
2280 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
2281 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
2282 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
2283 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
2284 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
2285 * OF THE POSSIBILITY OF SUCH DAMAGE. 
2286 *
2287 */
2288/* End */
2289;
2290; /* Start:"a:4:{s:4:"full";s:71:"/bitrix/templates/aspro-allcorp2/vendor/jquery.appear.js?17182808613188";s:6:"source";s:56:"/bitrix/templates/aspro-allcorp2/vendor/jquery.appear.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2291/*
2292 * jQuery.appear
2293 * https://github.com/bas2k/jquery.appear/
2294 * http://code.google.com/p/jquery-appear/
2295 *
2296 * Copyright (c) 2009 Michael Hixson
2297 * Copyright (c) 2012 Alexander Brovikov
2298 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
2299 */
2300(function($) {
2301	$.fn.appear = function(fn, options) {
2302
2303		var settings = $.extend({
2304
2305			//arbitrary data to pass to fn
2306			data: undefined,
2307
2308			//call fn only on the first appear?
2309			one: true,
2310
2311			// X & Y accuracy
2312			accX: 0,
2313			accY: 0
2314
2315		}, options);
2316
2317		return this.each(function() {
2318
2319			var t = $(this);
2320
2321			//whether the element is currently visible
2322			t.appeared = false;
2323
2324			if (!fn) {
2325
2326				//trigger the custom event
2327				t.trigger('appear', settings.data);
2328				return;
2329			}
2330
2331			var w = $(window);
2332
2333			//fires the appear event when appropriate
2334			var check = function() {
2335
2336				//is the element hidden?
2337				if (!t.is(':visible')) {
2338
2339					//it became hidden
2340					t.appeared = false;
2341					return;
2342				}
2343
2344				//is the element inside the visible window?
2345				var a = w.scrollLeft();
2346				var b = w.scrollTop();
2347				var o = t.offset();
2348				var x = o.left;
2349				var y = o.top;
2350
2351				var ax = settings.accX;
2352				var ay = settings.accY;
2353				var th = t.height();
2354				var wh = w.height();
2355				var tw = t.width();
2356				var ww = w.width();
2357
2358				if (y + th + ay >= b &&
2359					y <= b + wh + ay &&
2360					x + tw + ax >= a &&
2361					x <= a + ww + ax) {
2362
2363					//trigger the custom event
2364					if (!t.appeared) t.trigger('appear', settings.data);
2365
2366				} else {
2367
2368					//it scrolled out of view
2369					t.appeared = false;
2370				}
2371			};
2372
2373			//create a modified fn with some additional logic
2374			var modifiedFn = function() {
2375
2376				//mark the element as visible
2377				t.appeared = true;
2378
2379				//is this supposed to happen only once?
2380				if (settings.one) {
2381
2382					//remove the check
2383					w.unbind('scroll', check);
2384					var i = $.inArray(check, $.fn.appear.checks);
2385					if (i >= 0) $.fn.appear.checks.splice(i, 1);
2386				}
2387
2388				//trigger the original fn
2389				fn.apply(this, arguments);
2390			};
2391
2392			//bind the modified fn to the element
2393			if (settings.one) t.one('appear', settings.data, modifiedFn);
2394			else t.bind('appear', settings.data, modifiedFn);
2395
2396			//check whenever the window scrolls
2397			w.scroll(check);
2398
2399			//check whenever the dom changes
2400			$.fn.appear.checks.push(check);
2401
2402			//check now
2403			(check)();
2404		});
2405	};
2406
2407	//keep a queue of appearance checks
2408	$.extend($.fn.appear, {
2409
2410		checks: [],
2411		timeout: null,
2412
2413		//process the queue
2414		checkAll: function() {
2415			var length = $.fn.appear.checks.length;
2416			if (length >
2416 0) while (length--) ($.fn.appear.checks[length])();
2417		},
2418
2419		//check the queue asynchronously
2420		run: function() {
2421			if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout);
2422			$.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20);
2423		}
2424	});
2425
2426	//run checks when these methods are called
2427	$.each(['append', 'prepend', 'after', 'before', 'attr',
2428		'removeAttr', 'addClass', 'removeClass', 'toggleClass',
2429		'remove', 'css', 'show', 'hide'], function(i, n) {
2430		var old = $.fn[n];
2431		if (old) {
2432			$.fn[n] = function() {
2433				var r = old.apply(this, arguments);
2434				$.fn.appear.run();
2435				return r;
2436			}
2437		}
2438	});
2439
2440})(jQuery);
2441/* End */
2442;
2443; /* Start:"a:4:{s:4:"full";s:71:"/bitrix/templates/aspro-allcorp2/vendor/jquery.cookie.js?17182808612247";s:6:"source";s:56:"/bitrix/templates/aspro-allcorp2/vendor/jquery.cookie.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2444/*!
2445 * jQuery Cookie Plugin v1.3.1
2446 * https://github.com/carhartl/jquery-cookie
2447 *
2448 * Copyright 2013 Klaus Hartl
2449 * Released under the MIT license
2450 */
2451(function (factory) {
2452	if (typeof define === 'function' && define.amd && define.amd.jQuery) {
2453		// AMD. Register as anonymous module.
2454		define(['jquery'], factory);
2455	} else {
2456		// Browser globals.
2457		factory(jQuery);
2458	}
2459}(function ($) {
2460
2461	var pluses = /\+/g;
2462
2463	function raw(s) {
2464		return s;
2465	}
2466
2467	function decoded(s) {
2468		return decodeURIComponent(s.replace(pluses, ' '));
2469	}
2470
2471	function converted(s) {
2472		if (s.indexOf('"') === 0) {
2473			// This is a quoted cookie as according to RFC2068, unescape
2474			s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
2475		}
2476		try {
2477			return config.json ? JSON.parse(s) : s;
2478		} catch(er) {}
2479	}
2480
2481	var config = $.cookie = function (key, value, options) {
2482
2483		// write
2484		if (value !== undefined) {
2485			options = $.extend({}, config.defaults, options);
2486
2487			if (typeof options.expires === 'number') {
2488				var days = options.expires, t = options.expires = new Date();
2489				t.setDate(t.getDate() + days);
2490			}
2491
2492			value = config.json ? JSON.stringify(value) : String(value);
2493
2494			return (document.cookie = [
2495				encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value),
2496				options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
2497				options.path    ? '; path=' + options.path : '',
2498				options.domain  ? '; domain=' + options.domain : '',
2499				options.secure  ? '; secure' : ''
2500			].join(''));
2501		}
2502
2503		// read
2504		var decode = config.raw ? raw : decoded;
2505		var cookies = document.cookie.split('; ');
2506		var result = key ? undefined : {};
2507		for (var i = 0, l = cookies.length; i < l; i++) {
2508			var parts = cookies[i].split('=');
2509			var name = decode(parts.shift());
2510			var cookie = decode(parts.join('='));
2511
2512			if (key && key === name) {
2513				result = converted(cookie);
2514				break;
2515			}
2516
2517			if (!key) {
2518				result[name] = converted(cookie);
2519			}
2520		}
2521
2522		return result;
2523	};
2524
2525	config.defaults = {};
2526
2527	$.removeCookie = function (key, options) {
2528		if ($.cookie(key) !== undefined) {
2529			$.cookie(key, '', $.extend(options, { expires: -1 }));
2530			return true;
2531		}
2532		return false;
2533	};
2534
2535}));
2536
2537/* End */
2538;
2539; /* Start:"a:4:{s:4:"full";s:68:"/bitrix/templates/aspro-allcorp2/vendor/bootstrap.js?171828086127908";s:6:"source";s:52:"/bitrix/templates/aspro-allcorp2/vendor/bootstrap.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2540/*!
2541 * Bootstrap v3.0.0
2542 *
2543 * Copyright 2013 Twitter, Inc
2544 * Licensed under the Apache License v2.0
2545 * http://www.apache.org/licenses/LICENSE-2.0
2546 *
2547 * Designed and built with all the love in the world @twitter by @mdo and @fat.
2548 */
2549
2550+function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype.close=function(b){function f(){e.trigger("closed.bs.alert").remove()}var c=a(this),d=c.attr("data-target");d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));var e=a(d);b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.trigger(b=a.Event("close.bs.alert"));if(b.isDefaultPrevented())return;e.removeClass("in"),a.support.transition&&e.hasClass("fade")?e.one(a.support.transition.end,f).emulateTransitionEnd(150):f()};var d=a.fn.alert;a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("bs.alert");e||d.data("bs.alert",e=new c(this)),typeof b=="string"&&e[b].call(
2550d)})},a.fn.alert.Constructor=c,a.fn.alert.noConflict=function(){return a.fn.alert=d,this},a(document).on("click.bs.alert.data-api",b,c.prototype.close)}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d)};b.DEFAULTS={loadingText:"loading..."},b.prototype.setState=function(a){var b="disabled",c=this.$element,d=c.is("input")?"val":"html",e=c.data();a+="Text",e.resetText||c.data("resetText",c[d]()),c[d](e[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},b.prototype.toggle=function(){var a=this.$element.closest('[data-toggle="buttons"]');if(a.length){var b=this.$element.find("input").prop("checked",!this.$element.hasClass("active")).trigger("change");b.prop("type")==="radio"&&a.find(".active").removeClass("active")}this.$element.toggleClass("active")};var c=a.fn.button;a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("bs.button"),f=typeof c=="object"&&c;e||d.data("bs.button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.Constructor=b,a.fn.button.noConflict=function(){return a.fn.button=c,this},a(document).on("click.bs.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle"),b.preventDefault()})}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=this.sliding=this.interval=this.$active=this.$items=null,this.options.pause=="hover"&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.DEFAULTS={interval:5e3,pause:"hover",wrap:!0},b.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();if(b>this.$items.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b>d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition.end&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},b.prototype.next=function(){if(this.sliding)return;return this.slide("next")},b.prototype.prev=function(){if(this.sliding)return;return this.slide("prev")},b.prototype.slide=function(b,c){var d=this.$element.find(".item.active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this;if(!e.length){if(!this.options.wrap)return;e=this.$element.find(".item")[h]()}this.sliding=!0,f&&this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(e.hasClass("active"))return;this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&&b.addClass("active")}));if(a.support.transition&&this.$element.hasClass("slide")){this.$element.trigger(j);if(j.isDefaultPrevented())return;e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),d.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)}).emulateTransitionEnd(600)}else{this.$element.trigger(j);if(j.isDefaultPrevented())return;d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return f&&this.cycle(),this};var c=a.fn.carousel;a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},b.DEFAULTS,d.data(),typeof c=="object"&&c),g=typeof c=="string"?c:f.slide;e||d.data("bs.carousel",e=new b(this,f)),typeof c=="number"?e.to(c):g?e[g]():f.interval&&e.pause().cycle()})},a.fn.carousel.Constructor=b,a.fn.carousel.noConflict=function(){return a.fn.carousel=c,this}
2550,a(document).on("click.bs.carousel.data-api","[data-slide], [data-slide-to]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),c.data()),g=c.attr("data-slide-to");g&&(f.interval=!1),e.carousel(f),(g=c.attr("data-slide-to"))&&e.data("bs.carousel").to(g),b.preventDefault()}),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var b=a(this);b.carousel(b.data())})})}(window.jQuery),+function(a){function e(){a(b).remove(),a(c).each(function(b){var c=f(a(this));if(!c.hasClass("open"))return;c.trigger(b=a.Event("hide.bs.dropdown"));if(b.isDefaultPrevented())return;c.removeClass("open").trigger("hidden.bs.dropdown")})}function f(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}"use strict";var b=".dropdown-backdrop",c="[data-toggle=dropdown]",d=function(b){var c=a(b).on("click.bs.dropdown",this.toggle)};d.prototype.toggle=function(b){var c=a(this);if(c.is(".disabled, :disabled"))return;var d=f(c),g=d.hasClass("open");e();if(!g){"ontouchstart"in document.documentElement&&!d.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",e),d.trigger(b=a.Event("show.bs.dropdown"));if(b.isDefaultPrevented())return;d.toggleClass("open").trigger("shown.bs.dropdown"),c.focus()}return!1},d.prototype.keydown=function(b){if(!/(38|40|27)/.test(b.keyCode))return;var d=a(this);b.preventDefault(),b.stopPropagation();if(d.is(".disabled, :disabled"))return;var e=f(d),g=e.hasClass("open");if(!g||g&&b.keyCode==27)return b.which==27&&e.find(c).focus(),d.click();var h=a("[role=menu] li:not(.divider):visible a",e);if(!h.length)return;var i=h.index(h.filter(":focus"));b.keyCode==38&&i>0&&i--,b.keyCode==40&&i<h.length-1&&i++,~i||(i=0),h.eq(i).focus()};var g=a.fn.dropdown;a.fn.dropdown=function(b){return this.each(function(){var c=a(this),e=c.data("dropdown");e||c.data("dropdown",e=new d(this)),typeof b=="string"&&e[b].call(c)})},a.fn.dropdown.Constructor=d,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=g,this},a(document).on("click.bs.dropdown.data-api",e).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",c,d.prototype.toggle).on("keydown.bs.dropdown.data-api",c+", [role=menu]",d.prototype.keydown)}(window.jQuery),+function(a){"use strict";var b=function(b,c){this.options=c,this.$element=a(b),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.load(this.options.remote)};b.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},b.prototype.toggle=function(a){return this[this.isShown?"hide":"show"](a)},b.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d);if(this.isShown||d.isDefaultPrevented())return;this.isShown=!0,this.escape(),this.$element.on("click.dismiss.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show(),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)})},b.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one(a.support.transition.end,a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal()},b.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]!==a.target&&!this.$element.has(a.target).length&&this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){a.which==27&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},b.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden.bs.modal")})},b.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.$element.on("click.dismiss.modal",a.proxy(function(a){if
2550(a.target!==a.currentTarget)return;this.options.backdrop=="static"?this.$element[0].focus.call(this.$element[0]):this.hide.call(this)},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!b)return;e?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),typeof c=="object"&&c);f||e.data("bs.modal",f=new b(this,g)),typeof c=="string"?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(window.jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);var e=this.options.trigger.split(" ");for(var f=e.length;f--;){var g=e[f];if(g=="click")this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if(g!="manual"){var h=g=="hover"?"mouseenter":"focus",i=g=="hover"?"mouseleave":"blur";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);clearTimeout(c.timeout),c.hoverState="in";if(!c.options.delay||!c.options.delay.show)return c.show();c.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);clearTimeout(c.timeout),c.hoverState="out";if(!c.options.delay||!c.options.delay.hide)return c.hide();c.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);if(b.isDefaultPrevented())return;var c=this.tip();this.setContent(),this.options.animation&&c.addClass("fade");var d=typeof this.options.placement=="function"?this.options.placement.call(this,c[0],this.$element[0]):this.options.placement,e=/\s?auto?\s?/i,f=e.test(d);f&&(d=d.replace(e,"")||"top"),c.detach().css({top:0,left:0,display:"block"}).addClass(d),this.options.container?c.appendTo(this.options.container):c.insertAfter(this.$element);var g=this.getPosition(),h=c[0].offsetWidth,i=c[0].offsetHeight;if(f){var j=this.$element.parent(),k=d,l=document.documentElement.scrollTop||document.body.scrollTop,m=this.options.container=="body"?window.innerWidth:j.outerWidth(),n=this.options.container=="body"?window.innerHeight:j.outerHeight(),o=this.options.container=="body"?0:j.offset().left;d=d=="bottom"&&g.top+g.height+i-l>n?"top":d=="top"&&g.top-l-i<0?"bottom":d=="right"&&g.right+h>
2550m?"left":d=="left"&&g.left-h<o?"right":d,c.removeClass(k).addClass(d)}var p=this.getCalculatedOffset(d,g,h,i);this.applyPlacement(p,d),this.$element.trigger("shown.bs."+this.type)}},b.prototype.applyPlacement=function(a,b){var c,d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),a.top=a.top+g,a.left=a.left+h,d.offset(a).addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;b=="top"&&j!=f&&(c=!0,a.top=a.top+f-j);if(/bottom|top/.test(b)){var k=0;a.left<0&&(k=a.left*-2,a.left=0,d.offset(a),i=d[0].offsetWidth,j=d[0].offsetHeight),this.replaceArrow(k-e+i,i,"left")}else this.replaceArrow(j-f,j,"top");c&&d.offset(a)},b.prototype.replaceArrow=function(a,b,c){this.arrow().css(c,a?50*(1-a/b)+"%":"")},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},b.prototype.hide=function(){function e(){b.hoverState!="in"&&c.detach()}var b=this,c=this.tip(),d=a.Event("hide.bs."+this.type);this.$element.trigger(d);if(d.isDefaultPrevented())return;return c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?c.one(a.support.transition.end,e).emulateTransitionEnd(150):e(),this.$element.trigger("hidden.bs."+this.type),this},b.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},b.prototype.hasContent=function(){return this.getTitle()},b.prototype.getPosition=function(){var b=this.$element[0];return a.extend({},typeof b.getBoundingClientRect=="function"?b.getBoundingClientRect():{width:b.offsetWidth,height:b.offsetHeight},this.$element.offset())},b.prototype.getCalculatedOffset=function(a,b,c,d){return a=="bottom"?{top:b.top+b.height,left:b.left+b.width/2-c/2}:a=="top"?{top:b.top-d,left:b.left+b.width/2-c/2}:a=="left"?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},b.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a},b.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},b.prototype.validate=function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},b.prototype.enable=function(){this.enabled=!0},b.prototype.disable=function(){this.enabled=!1},b.prototype.toggleEnabled=function(){this.enabled=!this.enabled},b.prototype.toggle=function(b){var c=b?a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type):this;c.tip().hasClass("in")?c.leave(c):c.enter(c)},b.prototype.destroy=function(){this.hide().$element.off("."+this.type).removeData("bs."+this.type)};var c=a.fn.tooltip;a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f=typeof c=="object"&&c;e||d.data("bs.tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=c,this}}(window.jQuery),+function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");b.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||(typeof b.content=="function"?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f=typeof c=="object"&&c;e||d.data("bs.popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(window.jQuery),+function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;var e=c.find(".active:last a")[0],f=a.Event("show.bs.tab",{relatedTarget:e});b.trigger(f);if(f.isDefaultPrevented())return;var g=a(d);this.activate(b.parent("li"),c),this.activate(g,g.parent(),function(){b.trigger({type:"shown.bs.tab",relatedTarget:e})})},b.prototype.activate=function(b,c,d){function g(){e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var e=c.find("> .active"),f=d&&a.support.transition&&e.hasClass("fade");f?e.one(a.support.transition.end,g).emulateTransitionEnd(150):g(),e.removeClass("in")};var c=a.fn.tab;a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a.fn.tab.noConflict=function(){return a.fn.tab=c,this},a(document).on("click.bs.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.options=a.extend({},b.DEFAULTS,d),this.$window=a(window).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(c),this.affixed=this.unpin=null,this.checkPosition()};b.RESET="affix affix-top affix-bottom",b.DEFAULTS={offset:0},b.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},b.prototype.checkPosition=function(){if(!this.$element.is(":visible"))return;var c=a(document).height(),d=this.$window.scrollTop(),e=this.$element.offset(),f=this.options.offset,g=f.top,h=f.bottom;typeof f!="object"&&(h=g=f),typeof g=="function"&&(g=f.top()),typeof h=="function"&&(h=f.bottom());var i=this.unpin!=null&&d+this.unpin<=e.top?!1:h!=null&&e.top+this.$element.height()>=c-h?"bottom":g!=null&&d<=g?"top":!1;if(this.affixed===i)return;this.unpin&&this.$element.css("top",""),this.affixed=i,this.unpin=i=="bottom"?e.top-d:null,this.$element.removeClass(b.RESET).addClass("affix"+(i?"-"+i:"")),i=="bottom"&&this.$element.offset({top:document.body.offsetHeight-h-this.$element.height()})};var c=a.fn.affix;a.fn.affix=function(c){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f=typeof c=="object"&&c;
vendor: 5,733 bytes, lines 2550-2553
2550e||d.data("bs.affix",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.affix.Constructor=b,a.fn.affix.noConflict=function(){return a.fn.affix=c,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var b=a(this),c=b.data();c.offset=c.offset||{},c.offsetBottom&&(c.offset.bottom=c.offsetBottom),c.offsetTop&&(c.offset.top=c.offsetTop),b.affix(c)})})}(window.jQuery),+function(a){"use strict";var b=function(c,d){this.$element=a(c),this.options=a.extend({},b.DEFAULTS,d),this.transitioning=null,this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.DEFAULTS={toggle:!0},b.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},b.prototype.show=function(){if(this.transitioning||this.$element.hasClass("in"))return;var b=a.Event("show.bs.collapse");this.$element.trigger(b);if(b.isDefaultPrevented())return;var c=this.$parent&&this.$parent.find("> .panel > .in");if(c&&c.length){var d=c.data("bs.collapse");if(d&&d.transitioning)return;c.collapse("hide"),d||c.data("bs.collapse",null)}var e=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[e](0),this.transitioning=1;var f=function(){this.$element.removeClass("collapsing").addClass("in")[e]("auto"),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return f.call(this);var g=a.camelCase(["scroll",e].join("-"));this.$element.one(a.support.transition.end,a.proxy(f,this)).emulateTransitionEnd(350)[e](this.$element[0][g])},b.prototype.hide=function(){if(this.transitioning||!this.$element.hasClass("in"))return;var b=a.Event("hide.bs.collapse");this.$element.trigger(b);if(b.isDefaultPrevented())return;var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse").removeClass("in"),this.transitioning=1;var d=function(){this.transitioning=0,this.$element.trigger("hidden.bs.collapse").removeClass("collapsing").addClass("collapse")};if(!a.support.transition)return d.call(this);this.$element[c](0).one(a.support.transition.end,a.proxy(d,this)).emulateTransitionEnd(350)},b.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()};var c=a.fn.collapse;a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("bs.collapse"),f=a.extend({},b.DEFAULTS,d.data(),typeof c=="object"&&c);e||d.data("bs.collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.Constructor=b,a.fn.collapse.noConflict=function(){return a.fn.collapse=c,this},a(document).on("click.bs.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":c.data(),i=c.attr("data-parent"),j=i&&a(i);if(!g||!g.transitioning)j&&j.find('[data-toggle=collapse][data-parent="'+i+'"]').not(c).addClass("collapsed"),c[f.hasClass("in")?"addClass":"removeClass"]("collapsed");f.collapse(h)})}(window.jQuery),+function(a){function b(c,d){var e,f=a.proxy(this.process,this);this.$element=a(c).is("body")?a(window):a(c),this.$body=a("body"),this.$scrollElement=this.$element.on("scroll.bs.scroll-spy.data-api",f),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||(e=a(c).attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.offsets=a([]),this.targets=a([]),this.activeTarget=null,this.refresh(),this.process()}"use strict",b.DEFAULTS={offset:10},b.prototype.refresh=function(){var b=this.$element[0]==window?"offset":"position";this.offsets=a([]),this.targets=a([]);var c=this,d=this.$body.find(this.selector).map(function(){var d=a(this),e=d.data("target")||d.attr("href"),f=/^#\w/.test(e)&&a(e);return f&&f.length&&[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&&c.$scrollElement.scrollTop()),e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){c.offsets.push(this[0]),c.targets.push(this[1])})},b.prototype.process=function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,c=b-this.$scrollElement.height(),d=this.offsets,e=this.targets,f=this.activeTarget,g;if(a>=c)return f!=(g=e.last()[0])&&this.activate(g);for(g=d.length;g--;)f!=e[g]&&a>=d[g]&&(!d[g+1]||a<=d[g+1])&&this.activate(e[g])},b.prototype.activate=function(b){this.activeTarget=b,a(this.selector).parents(".active").removeClass("active");var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate")};var c=a.fn.scrollspy;a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f=typeof c=="object"&&c;e||d.data("bs.scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=c,this},a(window).on("load",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),+function(a){function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(a.style[c]!==undefined)return{end:b[c]}}"use strict",a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(a.support.transition.end,function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b()})}(window.jQuery)
2551/* End */
2552;
2553; /* Start:"a:4:{s:4:"full";
vendor: 31,186 bytes, lines 2553-3273
2553s:87:"/bitrix/templates/aspro-allcorp2/vendor/flexslider/jquery.flexslider.js?171828086155194";s:6:"source";s:71:"/bitrix/templates/aspro-allcorp2/vendor/flexslider/jquery.flexslider.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
2554/*
2555 * jQuery FlexSlider v2.6.3
2556 * Copyright 2012 WooThemes
2557 * Contributing Author: Tyler Smith
2558 */
2559;
2560(function ($) {
2561
2562  var focused = true;
2563
2564  //FlexSlider: Object Instance
2565  $.flexslider = function(el, options) {
2566    var slider = $(el);
2567
2568    // making variables public
2569    slider.vars = $.extend({}, $.flexslider.defaults, options);
2570
2571    var namespace = slider.vars.namespace,
2572        msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
2573        touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
2574        // depricating this idea, as devices are being released with both of these events
2575        eventType = "click touchend MSPointerUp keyup",
2576        watchedEvent = "",
2577        watchedEventClearTimer,
2578        vertical = slider.vars.direction === "vertical",
2579        reverse = slider.vars.reverse,
2580        carousel = (slider.vars.itemWidth > 0),
2581        fade = slider.vars.animation === "fade",
2582        asNav = slider.vars.asNavFor !== "",
2583        methods = {};
2584
2585    // Store a reference to the slider object
2586    $.data(el, "flexslider", slider);
2587
2588    // Private slider methods
2589    methods = {
2590      init: function() {
2591        slider.animating = false;
2592        // Get current slide and make sure it is a number
2593        slider.currentSlide = parseInt( ( slider.vars.startAt ? slider.vars.startAt : 0), 10 );
2594        if ( isNaN( slider.currentSlide ) ) { slider.currentSlide = 0; }
2595        slider.animatingTo = slider.currentSlide;
2596        slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
2597        slider.containerSelector = slider.vars.selector.substr(0,slider.vars.selector.search(' '));
2598        slider.slides = $(slider.vars.selector, slider);
2599        slider.container = $(slider.containerSelector, slider);
2600        slider.count = slider.slides.length;
2601        // SYNC:
2602        slider.syncExists = $(slider.vars.sync).length > 0;
2603        // SLIDE:
2604        if (slider.vars.animation === "slide") { slider.vars.animation = "swing"; }
2605        slider.prop = (vertical) ? "top" : "marginLeft";
2606        slider.args = {};
2607        // SLIDESHOW:
2608        slider.manualPause = false;
2609        slider.stopped = false;
2610        //PAUSE WHEN INVISIBLE
2611        slider.started = false;
2612        slider.startTimeout = null;
2613        // TOUCH/USECSS:
2614        slider.transitions = !slider.vars.video && !fade && slider.vars.useCSS && (function() {
2615          var obj = document.createElement('div'),
2616              props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
2617          for (var i in props) {
2618            if ( obj.style[ props[i] ] !== undefined ) {
2619              slider.pfx = props[i].replace('Perspective','').toLowerCase();
2620              slider.prop = "-" + slider.pfx + "-transform";
2621              return true;
2622            }
2623          }
2624          return false;
2625        }());
2626        slider.ensureAnimationEnd = '';
2627        // CONTROLSCONTAINER:
2628        if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);
2629        // MANUAL:
2630        if (slider.vars.manualControls !== "") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls);
2631
2632        // CUSTOM DIRECTION NAV:
2633        if (slider.vars.customDirectionNav !== "") slider.customDirectionNav = $(slider.vars.customDirectionNav).length === 2 && $(slider.vars.customDirectionNav);
2634
2635        // RANDOMIZE:
2636        if (slider.vars.randomize) {
2637          slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
2638          slider.container.empty().append(slider.slides);
2639        }
2640
2641        slider.doMath();
2642
2643        // INIT
2644        slider.setup("init");
2645
2646        // CONTROLNAV:
2647        if (slider.vars.controlNav) { methods.controlNav.setup(); }
2648
2649        // DIRECTIONNAV:
2650        if (slider.vars.directionNav) { methods.directionNav.setup(); }
2651
2652        // KEYBOARD:
2653        if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) {
2654          $(document).bind('keyup', function(event) {
2655            var keycode = event.keyCode;
2656            if (!slider.animating && (keycode === 39 || keycode === 37)) {
2657              var target = (keycode === 39) ? slider.getTarget('next') :
2658                           (keycode === 37) ? slider.getTarget('prev') : false;
2659              slider.flexAnimate(target, slider.vars.pauseOnAction);
2660            }
2661          });
2662        }
2663        // MOUSEWHEEL:
2664        if (slider.vars.mousewheel) {
2665          slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
2666            event.preventDefault();
2667            var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
2668            slider.flexAnimate(target, slider.vars.pauseOnAction);
2669          });
2670        }
2671
2672        // PAUSEPLAY
2673        if (slider.vars.pausePlay) { methods.pausePlay.setup(); }
2674
2675        //PAUSE WHEN INVISIBLE
2676        if (slider.vars.slideshow && slider.vars.pauseInvisible) { methods.pauseInvisible.init(); }
2677
2678        // SLIDSESHOW
2679        if (slider.vars.slideshow) {
2680          if (slider.vars.pauseOnHover) {
2681            slider.hover(function() {
2682              if (!slider.manualPlay && !slider.manualPause) { slider.pause(); }
2683            }, function() {
2684              if (!slider.manualPause && !slider.manualPlay && !slider.stopped) { slider.play(); }
2685            });
2686          }
2687          // initialize animation
2688          //If we're visible, or we don't use PageVisibility API
2689          if(!slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) {
2690            (slider.vars.initDelay > 0) ? slider.startTimeout = setTimeout(slider.play, slider.vars.initDelay) : slider.play();
2691          }
2692        }
2693
2694        // ASNAV:
2695        if (asNav) { methods.asNav.setup(); }
2696
2697        // TOUCH
2698        if (touch && slider.vars.touch) { methods.touch(); }
2699
2700        // FADE&&SMOOTHHEIGHT || SLIDE:
2701        if (!fade || (fade && slider.vars.smoothHeight)) { $(window).bind("resize orientationchange focus", methods.resize); }
2702
2703        slider.find("img").attr("draggable", "false");
2704
2705        // API: start() Callback
2706        setTimeout(function(){
2707          slider.vars.start(slider);
2708        }, 200);
2709      },
2710      asNav: {
2711        setup: function() {
2712          slider.asNav = true;
2713          slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
2714          slider.currentItem = slider.currentSlide;
2715          slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
2716          if(!msGesture){
2717              slider.slides.on(eventType, function(e){
2718                e.preventDefault();
2719                var $slide = $(this),
2720                    target = $slide.index();
2721                var posFromLeft = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
2722                if( posFromLeft <= 0 && $slide.hasClass( namespace + 'active-slide' ) ) {
2723                  slider.flexAnimate(slider.getTarget("prev"), true);
2724                } else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) {
2725                  slider.direction = (slider.currentItem < target) ? "next" : "prev";
2726                  slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
2727                }
2728              });
2729          }else{
2730              el._slider = slider;
2731              slider.slides.each(function (){
2732                  var that = this;
2733                  that._gesture = new MSGesture();
2734                  that._gesture.target = that;
2735                  that.addEventListener("MSPointerDown", function (e){
2736                      e.preventDefault();
2737                      if(e.currentTarget._gesture) {
2738                        e.currentTarget._gesture.addPointer(e.pointerId);
2739                      }
2740                  }, false);
2741                  that.addEventListener("MSGestureTap", function (e){
2742                      e.preventDefault();
2743                      var $slide = $(this),
2744                          target = $slide.index();
2745                      if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
2746                          slider.direction = (slider.currentItem < target) ? "next" : "prev";
2747                          slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
2748                      }
2749                  });
2750              });
2751          }
2752        }
2753      },
2754      controlNav: {
2755        setup: function() {
2756          if (!slider.manualControls) {
2757            methods.controlNav.setupPaging();
2758          } else { // MANUALCONTROLS:
2759            methods.controlNav.setupManual();
2760          }
2761        },
2762        setupPaging: function() {
2763          var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
2764              j = 1,
2765              item,
2766              slide;
2767
2768          slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
2769
2770          if (slider.pagingCount > 1) {
2771            for (var i = 0; i < slider.pagingCount; i++) {
2772              slide = slider.slides.eq(i);
2773              if ( undefined === slide.attr( 'data-thumb-alt' ) ) { slide.attr( 'data-thumb-alt', '' ); }
2774              var altText = ( '' !== slide.attr( 'data-thumb-alt' ) ) ? altText = ' alt="' + slide.attr( 'data-thumb-alt' ) + '"' : '';
2775              item = (slider.vars.controlNav === "thumbnails") ? '<img src="' + slide.attr( 'data-thumb' ) + '"' + altText + '/>' : '<a href="#">' + j + '</a>';
2776              if ( 'thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions ) {
2777                var captn = slide.attr( 'data-thumbcaption' );
2778                if ( '' !== captn && undefined !== captn ) { item += '<span class="' + namespace + 'caption">' + captn + '</span>'; }
2779              }
2780              slider.controlNavScaffold.append('<li>' + item + '</li>');
2781              j++;
2782            }
2783          }
2784
2785          // CONTROLSCONTAINER:
2786          (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
2787          methods.controlNav.set();
2788
2789          methods.controlNav.active();
2790
2791          slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
2792            event.preventDefault();
2793
2794            if (watchedEvent === "" || watchedEvent === event.type) {
2795              var $this = $(this),
2796                  target = slider.controlNav.index($this);
2797
2798              if (!$this.hasClass(namespace + 'active')) {
2799                slider.direction = (target > slider.currentSlide) ? "next" : "prev";
2800                slider.flexAnimate(target, slider.vars.pauseOnAction);
2801              }
2802            }
2803
2804            // setup flags to prevent event duplication
2805            if (watchedEvent === "") {
2806              watchedEvent = event.type;
2807            }
2808            methods.setToClearWatchedEvent();
2809
2810          });
2811        },
2812        setupManual: function() {
2813          slider.controlNav = slider.manualControls;
2814          methods.controlNav.active();
2815
2816          slider.controlNav.bind(eventType, function(event) {
2817            event.preventDefault();
2818
2819            if (watchedEvent === "" || watchedEvent === event.type) {
2820              var $this = $(this),
2821                  target = slider.controlNav.index($this);
2822
2823              if (!$this.hasClass(namespace + 'active')) {
2824                (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
2825                slider.flexAnimate(target, slider.vars.pauseOnAction);
2826              }
2827            }
2828
2829            // setup flags to prevent event duplication
2830            if (watchedEvent === "") {
2831              watchedEvent = event.type;
2832            }
2833            methods.setToClearWatchedEvent();
2834          });
2835        },
2836        set: function() {
2837          var selector = (slider.vars.controlNav === "thumbnails") ? 'img' : 'a';
2838          slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
2839        },
2840        active: function() {
2841          slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
2842        },
2843        update: function(action, pos) {
2844          if (slider.pagingCount > 1 && action === "add") {
2845            slider.controlNavScaffold.append($('<li><a href="#">' + slider.count + '</a></li>'));
2846          } else if (slider.pagingCount === 1) {
2847            slider.controlNavScaffold.find('li').remove();
2848          } else {
2849            slider.controlNav.eq(pos).closest('li').remove();
2850          }
2851          methods.controlNav.set();
2852          (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
2853        }
2854      },
2855      directionNav: {
2856        setup: function() {
2857          var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li class="' + namespace + 'nav-prev"><a class="' + namespace + 'prev" href="#">' + slider.vars.prevText + '</a></li><li class="' + namespace + 'nav-next"><a class="' + namespace + 'next" href="#">' + slider.vars.nextText + '</a></li></ul>');
2858
2859          // CUSTOM DIRECTION NAV:
2860          if (slider.customDirectionNav) {
2861            slider.directionNav = slider.customDirectionNav;
2862          // CONTROLSCONTAINER:
2863          } else if (slider.controlsContainer) {
2864            $(slider.controlsContainer).append(directionNavScaffold);
2865            slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
2866          } else {
2867            slider.append(directionNavScaffold);
2868            slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
2869          }
2870
2871          methods.directionNav.update();
2872
2873          slider.directionNav.bind(eventType, function(event) {
2874            event.preventDefault();
2875            var target;
2876
2877            if (watchedEvent === "" || watchedEvent === event.type) {
2878              target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
2879              slider.flexAnimate(target, slider.vars.pauseOnAction);
2880            }
2881
2882            // setup flags to prevent event duplication
2883            if (watchedEvent === "") {
2884              watchedEvent = event.type;
2885            }
2886            methods.setToClearWatchedEvent();
2887          });
2888        },
2889        update: function() {
2890          var disabledClass = namespace + 'disabled';
2891          if (slider.pagingCount === 1) {
2892            slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
2893          } else if (!slider.vars.animationLoop) {
2894            if (slider.animatingTo === 0) {
2895              slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1');
2896            } else if (slider.animatingTo === slider.last) {
2897              slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
2898            } else {
2899              slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
2900            }
2901          } else {
2902            slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
2903          }
2904        }
2905      },
2906      pausePlay: {
2907        setup: function() {
2908          var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a href="#"></a></div>');
2909
2910          // CONTROLSCONTAINER:
2911          if (slider.controlsContainer) {
2912            slider.controlsContainer.append(pausePlayScaffold);
2913            slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
2914          } else {
2915            slider.append(pausePlayScaffold);
2916            slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
2917          }
2918
2919          methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');
2920
2921          slider.pausePlay.bind(eventType, function(event) {
2922            event.preventDefault();
2923
2924            if (watchedEvent === "" || watchedEvent === event.type) {
2925              if ($(this).hasClass(namespace + 'pause')) {
2926                slider.manualPause = true;
2927                slider.manualPlay = false;
2928                slider.pause();
2929              } else {
2930                slider.manualPause = false;
2931                slider.manualPlay = true;
2932                slider.play();
2933              }
2934            }
2935
2936            // setup flags to prevent event duplication
2937            if (watchedEvent === "") {
2938              watchedEvent = event.type;
2939            }
2940            methods.setToClearWatchedEvent();
2941          });
2942        },
2943        update: function(state) {
2944          (state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').html(slider.vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').html(slider.vars.pauseText);
2945        }
2946      },
2947      touch: function() {
2948        var startX,
2949          startY,
2950          offset,
2951          cwidth,
2952          dx,
2953          startT,
2954          onTouchStart,
2955          onTouchMove,
2956          onTouchEnd,
2957          scrolling = false,
2958          localX = 0,
2959          localY = 0,
2960          accDx = 0;
2961
2962        if(!msGesture){
2963            onTouchStart = function(e) {
2964              if (slider.animating) {
2965                e.preventDefault();
2966              } else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) {
2967                slider.pause();
2968                // CAROUSEL:
2969                cwidth = (vertical) ? slider.h : slider. w;
2970                startT = Number(new Date());
2971                // CAROUSEL:
2972
2973                // Local vars for X and Y points.
2974                localX = e.touches[0].pageX;
2975                localY = e.touches[0].pageY;
2976
2977                offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
2978                         (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
2979                         (carousel && slider.currentSlide === slider.last) ? slider.limit :
2980                         (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
2981                         (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
2982                startX = (vertical) ? localY : localX;
2983                startY = (vertical) ? localX : localY;
2984
2985                el.addEventListener('touchmove', onTouchMove, false);
2986                el.addEventListener('touchend', onTouchEnd, false);
2987              }
2988            };
2989
2990            onTouchMove = function(e) {
2991              // Local vars for X and Y points.
2992
2993              localX = e.touches[0].pageX;
2994              localY = e.touches[0].pageY;
2995
2996              dx = (vertical) ? startX - localY : startX - localX;
2997              scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY));
2998
2999              var fxms = 500;
3000
3001              if ( ! scrolling || Number( new Date() ) - startT > fxms ) {
3002                e.preventDefault();
3003                if (!fade && slider.transitions) {
3004                  if (!slider.vars.animationLoop) {
3005                    dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
3006                  }
3007                  slider.setProps(offset + dx, "setTouch");
3008                }
3009              }
3010            };
3011
3012            onTouchEnd = function(e) {
3013              // finish the touch by undoing the touch session
3014              el.removeEventListener('touchmove', onTouchMove, false);
3015
3016              if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
3017                var updateDx = (reverse) ? -dx : dx,
3018                    target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
3019
3020                if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
3021                  slider.flexAnimate(target, slider.vars.pauseOnAction);
3022                } else {
3023                  if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); }
3024                }
3025              }
3026              el.removeEventListener('touchend', onTouchEnd, false);
3027
3028              startX = null;
3029              startY = null;
3030              dx = null;
3031              offset = null;
3032            };
3033
3034            el.addEventListener('touchstart', onTouchStart, false);
3035        }else{
3036            el.style.msTouchAction = "none";
3037            el._gesture = new MSGesture();
3038            el._gesture.target = el;
3039            el.addEventListener("MSPointerDown", onMSPointerDown, false);
3040            el._slider = slider;
3041            el.addEventListener("MSGestureChange", onMSGestureChange, false);
3042            el.addEventListener("MSGestureEnd", onMSGestureEnd, false);
3043
3044            function onMSPointerDown(e){
3045                e.stopPropagation();
3046                if (slider.animating) {
3047                    e.preventDefault();
3048                }else{
3049                    slider.pause();
3050                    el._gesture.addPointer(e.pointerId);
3051                    accDx = 0;
3052                    cwidth = (vertical) ? slider.h : slider. w;
3053                    startT = Number(new Date());
3054                    // CAROUSEL:
3055
3056                    offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
3057                        (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
3058                            (carousel && slider.currentSlide === slider.last) ? slider.limit :
3059                                (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
3060                                    (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
3061                }
3062            }
3063
3064            function onMSGestureChange(e) {
3065                e.stopPropagation();
3066                var slider = e.target._slider;
3067                if(!slider){
3068                    return;
3069                }
3070                var transX = -e.translationX,
3071                    transY = -e.translationY;
3072
3073                //Accumulate translations.
3074                accDx = accDx + ((vertical) ? transY : transX);
3075                dx = accDx;
3076                scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY));
3077
3078                if(e.detail === e.MSGESTURE_FLAG_INERTIA){
3079                    setImmediate(function (){
3080                        el._gesture.stop();
3081                    });
3082
3083                    return;
3084                }
3085
3086                if (!scrolling || Number(new Date()) - startT > 500) {
3087                    e.preventDefault();
3088                    if (!fade && slider.transitions) {
3089                        if (!slider.vars.animationLoop) {
3090                            dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1);
3091                        }
3092                        slider.setProps(offset + dx, "setTouch");
3093                    }
3094                }
3095            }
3096
3097            function onMSGestureEnd(e) {
3098                e.stopPropagation();
3099                var slider = e.target._slider;
3100                if(!slider){
3101                    return;
3102                }
3103                if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
3104                    var updateDx = (reverse) ? -dx : dx,
3105                        target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
3106
3107                    if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
3108                        slider.flexAnimate(target, slider.vars.pauseOnAction);
3109                    } else {
3110                        if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); }
3111                    }
3112                }
3113
3114                startX = null;
3115                startY = null;
3116                dx = null;
3117                offset = null;
3118                accDx = 0;
3119            }
3120        }
3121      },
3122      resize: function() {
3123        if (!slider.animating && slider.is(':visible')) {
3124          if (!carousel) { slider.doMath(); }
3125
3126          if (fade) {
3127            // SMOOTH HEIGHT:
3128            methods.smoothHeight();
3129          } else if (carousel) { //CAROUSEL:
3130            slider.slides.width(slider.computedW);
3131            slider.update(slider.pagingCount);
3132            slider.setProps();
3133          }
3134          else if (vertical) { //VERTICAL:
3135            slider.viewport.height(slider.h);
3136            slider.setProps(slider.h, "setTotal");
3137          } else {
3138            // SMOOTH HEIGHT:
3139            if (slider.vars.smoothHeight) { methods.smoothHeight(); }
3140            slider.newSlides.width(slider.computedW);
3141            slider.setProps(slider.computedW, "setTotal");
3142          }
3143        }
3144      },
3145      smoothHeight: function(dur) {
3146        if (!vertical || fade) {
3147          var $obj = (fade) ? slider : slider.viewport;
3148          (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).innerHeight()}, dur) : $obj.innerHeight(slider.slides.eq(slider.animatingTo).innerHeight());
3149        }
3150      },
3151      sync: function(action) {
3152        var $obj = $(slider.vars.sync).data("flexslider"),
3153            target = slider.animatingTo;
3154
3155        switch (action) {
3156          case "animate": $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true); break;
3157          case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
3158          case "pause": $obj.pause(); break;
3159        }
3160      },
3161      uniqueID: function($clone) {
3162        // Append _clone to current level and children elements with id attributes
3163        $clone.filter( '[id]' ).add($clone.find( '[id]' )).each(function() {
3164          var $this = $(this);
3165          $this.attr( 'id', $this.attr( 'id' ) + '_clone' );
3166        });
3167        return $clone;
3168      },
3169      pauseInvisible: {
3170        visProp: null,
3171        init: function() {
3172          var visProp = methods.pauseInvisible.getHiddenProp();
3173          if (visProp) {
3174            var evtname = visProp.replace(/[H|h]idden/,'') + 'visibilitychange';
3175            document.addEventListener(evtname, function() {
3176              if (methods.pauseInvisible.isHidden()) {
3177                if(slider.startTimeout) {
3178                  clearTimeout(slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible
3179                } else {
3180                  slider.pause(); //Or just pause
3181                }
3182              }
3183              else {
3184                if(slider.started) {
3185                  slider.play(); //Initiated before, just play
3186                } else {
3187                  if (slider.vars.initDelay > 0) {
3188                    setTimeout(slider.play, slider.vars.initDelay);
3189                  } else {
3190                    slider.play(); //Didn't init before: simply init or wait for it
3191                  }
3192                }
3193              }
3194            });
3195          }
3196        },
3197        isHidden: function() {
3198          var prop = methods.pauseInvisible.getHiddenProp();
3199          if (!prop) {
3200            return false;
3201          }
3202          return document[prop];
3203        },
3204        getHiddenProp: function() {
3205          var prefixes = ['webkit','moz','ms','o'];
3206          // if 'hidden' is natively supported just return it
3207          if ('hidden' in document) {
3208            return 'hidden';
3209          }
3210          // otherwise loop over all the known prefixes until we find one
3211          for ( var i = 0; i < prefixes.length; i++ ) {
3212              if ((prefixes[i] + 'Hidden') in document) {
3213                return prefixes[i] + 'Hidden';
3214              }
3215          }
3216          // otherwise it's not supported
3217          return null;
3218        }
3219      },
3220      setToClearWatchedEvent: function() {
3221        clearTimeout(watchedEventClearTimer);
3222        watchedEventClearTimer = setTimeout(function() {
3223          watchedEvent = "";
3224        }, 3000);
3225      }
3226    };
3227
3228    // public methods
3229    slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
3230      if (!slider.vars.animationLoop && target !== slider.currentSlide) {
3231        slider.direction = (target > slider.currentSlide) ? "next" : "prev";
3232      }
3233
3234      if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
3235
3236      if (!slider.animating && (slider.canAdvance(target, fromNav) || override) && slider.is(":visible")) {
3237        if (asNav && withSync) {
3238          var master = $(slider.vars.asNavFor).data('flexslider');
3239          slider.atEnd = target === 0 || target === slider.count - 1;
3240          master.flexAnimate(target, true, false, true, fromNav);
3241          slider.direction = (slider.currentItem < target) ? "next" : "prev";
3242          master.direction = slider.direction;
3243
3244          if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
3245            slider.currentItem = target;
3246            slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
3247            target = Math.floor(target/slider.visible);
3248          } else {
3249            slider.currentItem = target;
3250            slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
3251            return false;
3252          }
3253        }
3254
3255        slider.animating = true;
3256        slider.animatingTo = target;
3257
3258        // SLIDESHOW:
3259        if (pause) { slider.pause(); }
3260
3261        // API: before() animation Callback
3262        slider.vars.before(slider);
3263
3264        // SYNC:
3265        if (slider.syncExists && !fromNav) { methods.sync("animate"); }
3266
3267        // CONTROLNAV
3268        if (slider.vars.controlNav) { methods.controlNav.active(); }
3269
3270        // !CAROUSEL:
3271        // CANDIDATE: slide active class (for add/remove slide)
3272        // if (!carousel) { slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide'); }
3273        slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide');
vendor: 7,296 bytes, lines 3273-3431
3273
3274
3275        // INFINITE LOOP:
3276        // CANDIDATE: atEnd
3277        slider.atEnd = target === 0 || target === slider.last;
3278
3279        // DIRECTIONNAV:
3280        if (slider.vars.directionNav) { methods.directionNav.update(); }
3281
3282        if (target === slider.last) {
3283          // API: end() of cycle Callback
3284          slider.vars.end(slider);
3285          // SLIDESHOW && !INFINITE LOOP:
3286          if (!slider.vars.animationLoop) { slider.pause(); }
3287        }
3288
3289        // SLIDE:
3290        if (!fade) {
3291          var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
3292              margin, slideString, calcNext;
3293
3294          // INFINITE LOOP / REVERSE:
3295          if (carousel) {
3296            margin = slider.vars.itemMargin;
3297            calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
3298            slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
3299          } else if (slider.currentSlide === 0 && target === slider.count - 1 && slider.vars.animationLoop && slider.direction !== "next") {
3300            slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
3301          } else if (slider.currentSlide === slider.last && target === 0 && slider.vars.animationLoop && slider.direction !== "prev") {
3302            slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
3303          } else {
3304            slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
3305          }
3306          slider.setProps(slideString, "", slider.vars.animationSpeed);
3307          if (slider.transitions) {
3308            if (!slider.vars.animationLoop || !slider.atEnd) {
3309              slider.animating = false;
3310              slider.currentSlide = slider.animatingTo;
3311            }
3312
3313            // Unbind previous transitionEnd events and re-bind new transitionEnd event
3314            slider.container.unbind("webkitTransitionEnd transitionend");
3315            slider.container.bind("webkitTransitionEnd transitionend", function() {
3316              clearTimeout(slider.ensureAnimationEnd);
3317              slider.wrapup(dimension);
3318            });
3319
3320            // Insurance for the ever-so-fickle transitionEnd event
3321            clearTimeout(slider.ensureAnimationEnd);
3322            slider.ensureAnimationEnd = setTimeout(function() {
3323              slider.wrapup(dimension);
3324            }, slider.vars.animationSpeed + 100);
3325
3326          } else {
3327            slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function(){
3328              slider.wrapup(dimension);
3329            });
3330          }
3331        } else { // FADE:
3332          if (!touch) {
3333            slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing);
3334            slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
3335          } else {
3336            slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
3337            slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
3338            slider.wrapup(dimension);
3339          }
3340        }
3341        // SMOOTH HEIGHT:
3342        if (slider.vars.smoothHeight) { methods.smoothHeight(slider.vars.animationSpeed); }
3343      }
3344    };
3345    slider.wrapup = function(dimension) {
3346      // SLIDE:
3347      if (!fade && !carousel) {
3348        if (slider.currentSlide === 0 && slider.animatingTo === slider.last && slider.vars.animationLoop) {
3349          slider.setProps(dimension, "jumpEnd");
3350        } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && slider.vars.animationLoop) {
3351          slider.setProps(dimension, "jumpStart");
3352        }
3353      }
3354      slider.animating = false;
3355      slider.currentSlide = slider.animatingTo;
3356      // API: after() animation Callback
3357      slider.vars.after(slider);
3358    };
3359
3360    // SLIDESHOW:
3361    slider.animateSlides = function() {
3362      if (!slider.animating && focused ) { slider.flexAnimate(slider.getTarget("next")); }
3363    };
3364    // SLIDESHOW:
3365    slider.pause = function() {
3366      clearInterval(slider.animatedSlides);
3367      slider.animatedSlides = null;
3368      slider.playing = false;
3369      // PAUSEPLAY:
3370      if (slider.vars.pausePlay) { methods.pausePlay.update("play"); }
3371      // SYNC:
3372      if (slider.syncExists) { methods.sync("pause"); }
3373    };
3374    // SLIDESHOW:
3375    slider.play = function() {
3376      if (slider.playing) { clearInterval(slider.animatedSlides); }
3377      slider.animatedSlides = slider.animatedSlides || setInterval(slider.animateSlides, slider.vars.slideshowSpeed);
3378      slider.started = slider.playing = true;
3379      // PAUSEPLAY:
3380      if (slider.vars.pausePlay) { methods.pausePlay.update("pause"); }
3381      // SYNC:
3382      if (slider.syncExists) { methods.sync("play"); }
3383    };
3384    // STOP:
3385    slider.stop = function () {
3386      slider.pause();
3387      slider.stopped = true;
3388    };
3389    slider.canAdvance = function(target, fromNav) {
3390      // ASNAV:
3391      var last = (asNav) ? slider.pagingCount - 1 : slider.last;
3392      return (fromNav) ? true :
3393             (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
3394             (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
3395             (target === slider.currentSlide && !asNav) ? false :
3396             (slider.vars.animationLoop) ? true :
3397             (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
3398             (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
3399             true;
3400    };
3401    slider.getTarget = function(dir) {
3402      slider.direction = dir;
3403      if (dir === "next") {
3404        return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
3405      } else {
3406        return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
3407      }
3408    };
3409
3410    // SLIDE:
3411    slider.setProps = function(pos, special, dur) {
3412      var target = (function() {
3413        var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo,
3414            posCalc = (function() {
3415              if (carousel) {
3416                return (special === "setTouch") ? pos :
3417                       (reverse && slider.animatingTo === slider.last) ? 0 :
3418                       (reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
3419                       (slider.animatingTo === slider.last) ? slider.limit : posCheck;
3420              } else {
3421                switch (special) {
3422                  case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
3423                  case "setTouch": return (reverse) ? pos : pos;
3424                  case "jumpEnd": return (reverse) ? pos : slider.count * pos;
3425                  case "jumpStart": return (reverse) ? slider.count * pos : pos;
3426                  default: return pos;
3427                }
3428              }
3429            }());
3430
3431            return (posCalc * 
vendor: 13,579 bytes, lines 3431-3693
3431-1) + "px";
3432          }());
3433
3434      if (slider.transitions) {
3435        target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
3436        dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
3437        slider.container.css("-" + slider.pfx + "-transition-duration", dur);
3438         slider.container.css("transition-duration", dur);
3439      }
3440
3441      slider.args[slider.prop] = target;
3442      if (slider.transitions || dur === undefined) { slider.container.css(slider.args); }
3443
3444      slider.container.css('transform',target);
3445    };
3446
3447    slider.setup = function(type) {
3448      // SLIDE:
3449      if (!fade) {
3450        var sliderOffset, arr;
3451
3452        if (type === "init") {
3453          slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
3454          // INFINITE LOOP:
3455          slider.cloneCount = 0;
3456          slider.cloneOffset = 0;
3457          // REVERSE:
3458          if (reverse) {
3459            arr = $.makeArray(slider.slides).reverse();
3460            slider.slides = $(arr);
3461            slider.container.empty().append(slider.slides);
3462          }
3463        }
3464        // INFINITE LOOP && !CAROUSEL:
3465        if (slider.vars.animationLoop && !carousel) {
3466          slider.cloneCount = 2;
3467          slider.cloneOffset = 1;
3468          // clear out old clones
3469          if (type !== "init") { slider.container.find('.clone').remove(); }
3470          slider.container.append(methods.uniqueID(slider.slides.first().clone().addClass('clone')).attr('aria-hidden', 'true'))
3471                          .prepend(methods.uniqueID(slider.slides.last().clone().addClass('clone')).attr('aria-hidden', 'true'));
3472        }
3473        slider.newSlides = $(slider.vars.selector, slider);
3474
3475        sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
3476        // VERTICAL:
3477        if (vertical && !carousel) {
3478          slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
3479          setTimeout(function(){
3480            slider.newSlides.css({"display": "block"});
3481            slider.doMath();
3482            slider.viewport.height(slider.h);
3483            slider.setProps(sliderOffset * slider.h, "init");
3484          }, (type === "init") ? 100 : 0);
3485        } else {
3486          slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
3487          slider.setProps(sliderOffset * slider.computedW, "init");
3488          setTimeout(function(){
3489            slider.doMath();
3490            slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"});
3491            // SMOOTH HEIGHT:
3492            if (slider.vars.smoothHeight) { methods.smoothHeight(); }
3493          }, (type === "init") ? 100 : 0);
3494        }
3495      } else { // FADE:
3496        slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
3497        if (type === "init") {
3498          if (!touch) {
3499            //slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing);
3500            if (slider.vars.fadeFirstSlide == false) {
3501              slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).css({"opacity": 1});
3502            } else {
3503              slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing);
3504            }
3505          } else {
3506            slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + slider.vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
3507          }
3508        }
3509        // SMOOTH HEIGHT:
3510        if (slider.vars.smoothHeight) { methods.smoothHeight(); }
3511      }
3512      // !CAROUSEL:
3513      // CANDIDATE: active slide
3514      // if (!carousel) { slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide"); }
3515      slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");
3516
3517      //FlexSlider: init() Callback
3518      slider.vars.init(slider);
3519    };
3520
3521    slider.doMath = function() {
3522      var slide = slider.slides.first(),
3523          slideMargin = slider.vars.itemMargin,
3524          minItems = slider.vars.minItems,
3525          maxItems = slider.vars.maxItems;
3526
3527      slider.w = (slider.viewport===undefined) ? slider.width() : slider.viewport.width();
3528      slider.h = slide.height();
3529      slider.boxPadding = slide.outerWidth() - slide.width();
3530
3531      // CAROUSEL:
3532      if (carousel) {
3533        slider.itemT = slider.vars.itemWidth + slideMargin;
3534        slider.itemM = slideMargin;
3535        slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
3536        slider.maxW = (maxItems) ? (maxItems * slider.itemT) - slideMargin : slider.w;
3537        slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1)))/minItems :
3538                       (slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1)))/maxItems :
3539                       (slider.vars.itemWidth > slider.w) ? slider.w : slider.vars.itemWidth;
3540
3541        slider.visible = Math.floor(slider.w/(slider.itemW));
3542        slider.move = (slider.vars.move > 0 && slider.vars.move < slider.visible ) ? slider.vars.move : slider.visible;
3543        slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
3544        slider.last =  slider.pagingCount - 1;
3545        slider.limit = (slider.pagingCount === 1) ? 0 :
3546                       (slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)) : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
3547      } else {
3548        slider.itemW = slider.w;
3549        slider.itemM = slideMargin;
3550        slider.pagingCount = slider.count;
3551        slider.last = slider.count - 1;
3552      }
3553      slider.computedW = slider.itemW - slider.boxPadding;
3554      slider.computedM = slider.itemM;
3555    };
3556
3557    slider.update = function(pos, action) {
3558      slider.doMath();
3559
3560      // update currentSlide and slider.animatingTo if necessary
3561      if (!carousel) {
3562        if (pos < slider.currentSlide) {
3563          slider.currentSlide += 1;
3564        } else if (pos <= slider.currentSlide && pos !== 0) {
3565          slider.currentSlide -= 1;
3566        }
3567        slider.animatingTo = slider.currentSlide;
3568      }
3569
3570      // update controlNav
3571      if (slider.vars.controlNav && !slider.manualControls) {
3572        if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
3573          methods.controlNav.update("add");
3574        } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
3575          if (carousel && slider.currentSlide > slider.last) {
3576            slider.currentSlide -= 1;
3577            slider.animatingTo -= 1;
3578          }
3579          methods.controlNav.update("remove", slider.last);
3580        }
3581      }
3582      // update directionNav
3583      if (slider.vars.directionNav) { methods.directionNav.update(); }
3584
3585    };
3586
3587    slider.addSlide = function(obj, pos) {
3588      var $obj = $(obj);
3589
3590      slider.count += 1;
3591      slider.last = slider.count - 1;
3592
3593      // append new slide
3594      if (vertical && reverse) {
3595        (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
3596      } else {
3597        (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
3598      }
3599
3600      // update currentSlide, animatingTo, controlNav, and directionNav
3601      slider.update(pos, "add");
3602
3603      // update slider.slides
3604      slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
3605      // re-setup the slider to accomdate new slide
3606      slider.setup();
3607
3608      //FlexSlider: added() Callback
3609      slider.vars.added(slider);
3610    };
3611    slider.removeSlide = function(obj) {
3612      var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
3613
3614      // update count
3615      slider.count -= 1;
3616      slider.last = slider.count - 1;
3617
3618      // remove slide
3619      if (isNaN(obj)) {
3620        $(obj, slider.slides).remove();
3621      } else {
3622        (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
3623      }
3624
3625      // update currentSlide, animatingTo, controlNav, and directionNav
3626      slider.doMath();
3627      slider.update(pos, "remove");
3628
3629      // update slider.slides
3630      slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
3631      // re-setup the slider to accomdate new slide
3632      slider.setup();
3633
3634      // FlexSlider: removed() Callback
3635      slider.vars.removed(slider);
3636    };
3637
3638    //FlexSlider: Initialize
3639    methods.init();
3640  };
3641
3642  // Ensure the slider isn't focussed if the window loses focus.
3643  $( window ).blur( function ( e ) {
3644    focused = false;
3645  }).focus( function ( e ) {
3646    focused = true;
3647  });
3648
3649  //FlexSlider: Default Settings
3650  $.flexslider.defaults = {
3651    namespace: "flex-",             //{NEW} String: Prefix string attached to the class of every element generated by the plugin
3652    selector: ".slides > li",       //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
3653    animation: "fade",              //String: Select your animation type, "fade" or "slide"
3654    easing: "swing",                //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
3655    direction: "horizontal",        //String: Select the sliding direction, "horizontal" or "vertical"
3656    reverse: false,                 //{NEW} Boolean: Reverse the animation direction
3657    animationLoop: true,            //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
3658    smoothHeight: false,            //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
3659    startAt: 0,                     //Integer: The slide that the slider should start on. Array notation (0 = first slide)
3660    slideshow: true,                //Boolean: Animate slider automatically
3661    slideshowSpeed: 7000,           //Integer: Set the speed of the slideshow cycling, in milliseconds
3662    animationSpeed: 600,            //Integer: Set the speed of animations, in milliseconds
3663    initDelay: 0,                   //{NEW} Integer: Set an initialization delay, in milliseconds
3664    randomize: false,               //Boolean: Randomize slide order
3665    fadeFirstSlide: true,           //Boolean: Fade in the first slide when animation type is "fade"
3666    thumbCaptions: false,           //Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav.
3667
3668    // Usability features
3669    pauseOnAction: true,            //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
3670    pauseOnHover: false,            //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
3671    pauseInvisible: true,   		//{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
3672    useCSS: true,                   //{NEW} Boolean: Slider will use CSS3 transitions if available
3673    touch: true,                    //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
3674    video: false,                   //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
3675
3676    // Primary Controls
3677    controlNav: true,               //Boolean: Create navigation for paging control of each slide? Note: Leave true for manualControls usage
3678    directionNav: true,             //Boolean: Create navigation for previous/next navigation? (true/false)
3679    prevText: "Previous",           //String: Set the text for the "previous" directionNav item
3680    nextText: "Next",               //String: Set the text for the "next" directionNav item
3681
3682    // Secondary Navigation
3683    keyboard: true,                 //Boolean: Allow slider navigating via keyboard left/right keys
3684    multipleKeyboard: false,        //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
3685    mousewheel: false,              //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
3686    pausePlay: false,               //Boolean: Create pause/play dynamic element
3687    pauseText: "Pause",             //String: Set the text for the "pause" pausePlay item
3688    playText: "Play",               //String: Set the text for the "play" pausePlay item
3689
3690    // Special properties
3691    controlsContainer: "",          //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found.
3692    manualControls: "",             //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
3693    customDirectionNav: "",         //{NEW}
3693 jQuery Object/Selector: Custom prev / next button. Must be two jQuery elements. In order to make the events work they have to have the classes "prev" and "next" (plus namespace)
3694    sync: "",                       //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
3695    asNavFor: "",                   //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
3696
3697    // Carousel Options
3698    itemWidth: 0,                   //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
3699    itemMargin: 0,                  //{NEW} Integer: Margin between carousel items.
3700    minItems: 1,                    //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
3701    maxItems: 0,                    //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
3702    move: 0,                        //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
3703    allowOneSlide: true,           //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide
3704
3705    // Callback API
3706    start: function(){},            //Callback: function(slider) - Fires when the slider loads the first slide
3707    before: function(){},           //Callback: function(slider) - Fires asynchronously with each slider animation
3708    after: function(){},            //Callback: function(slider) - Fires after each slider animation completes
3709    end: function(){},              //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
3710    added: function(){},            //{NEW} Callback: function(slider) - Fires after a slide is added
3711    removed: function(){},           //{NEW} Callback: function(slider) - Fires after a slide is removed
3712    init: function() {}             //{NEW} Callback: function(slider) - Fires after the slider is initially setup
3713  };
3714
3715  //FlexSlider: Plugin Function
3716  $.fn.flexslider = function(options) {
3717    if (options === undefined) { options = {}; }
3718
3719    if (typeof options === "object") {
3720      return this.each(function() {
3721        var $this = $(this),
3722            selector = (options.selector) ? options.selector : ".slides > li",
3723            $slides = $this.find(selector);
3724
3725      if ( ( $slides.length === 1 && options.allowOneSlide === false ) || $slides.length === 0 ) {
3726          $slides.fadeIn(400);
3727          if (options.start) { options.start($this); }
3728        } else if ($this.data('flexslider') === undefined) {
3729          new $.flexslider(this, options);
3730        }
3731      });
3732    } else {
3733      // Helper strings to quickly perform functions on the slider
3734      var $slider = $(this).data('flexslider');
3735      switch (options) {
3736        case "play": $slider.play(); break;
3737        case "pause": $slider.pause(); break;
3738        case "stop": $slider.stop(); break;
3739        case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
3740        case "prev":
3741        case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
3742        default: if (typeof options === "number") { $slider.flexAnimate(options, true); }
3743      }
3744    }
3745  };
3746})(jQuery);
3747
3748/* End */
3749;
3750; /* Start:"a:4:{s:4:"full";s:78:"/bitrix/templates/aspro-allcorp2/vendor/jquery.validate.min.js?171828086122254";s:6:"source";s:62:"/bitrix/templates/aspro-allcorp2/vendor/jquery.validate.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3751/*! jQuery Validation Plugin - v1.13.1 - 10/14/2014
3752 * http://jqueryvalidation.org/
3753 * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */
3754!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.validateDelegate(":submit","click",function(b){c.settings.submitHandler&&(c.submitButton=b.target),a(b.target).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(b.target).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.submit(function(b){function d(){var d,e;return c.settings.submitHandler?(c.submitButton&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c;return a(this[0]).is("form")?b=this.validate().form():(b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element
3754(this)&&b})),b},removeAttrs:function(b){var c={},d=this;return a.each(b.split(/\s/),function(a,b){c[b]=d.attr(b),d.removeAttr(b)}),c},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){return!!a.trim(""+a(b).val())},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(a,b){(9!==b.which||""!==this.elementValue(a))&&(a.name in this.submitted||a===this.lastElement)&&this.element(a)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this[0].form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!this.is(e.ignore)&&e[d].call(c,this[0],b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']","focusin focusout keyup",b).validateDelegate("select, option, [type='radio'], [type='checkbox']","click",b),this.settings.invalidHandler&&a(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler),a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c=this.clean(b),d=this.validationTargetFor(c),e=!0;return this.lastElement=d,void 0===d?delete this.invalid[c.name]:(this.prepareElement(d),this.currentElements=a(d),e=this.check(d)!==!1,e?delete this.invalid[d.name]:this.invalid[d.name]=!0),a(b).attr("aria-invalid",!e),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers
3754)),this.showErrors(),e},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled], [readonly]").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in c||!b.objectLength(a(this).rules())?!1:(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d=a(b),e=b.type;return"radio"===e||"checkbox"===e?a("input[name='"+b.name+"']:checked").val():"number"===e&&"undefined"!=typeof b.validity?b.validity.badInput?!1:d.val():(c=d.val(),"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f=a(b).rules(),g=a.map(f,function(a,b){return b}).length,h=!1,i=this.elementValue(b);for(d in f){e={method:d,parameters:f[d]};try{if(c=a.validator.methods[d].call(this,i,b,e.parameters),"dependency-mismatch"===c&&1===g){h=!0;continue}if(h=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(j){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j}}if(!h)return this.objectLength(f)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a];return void 0},defaultMessage:function(b,c){return this.findDefined(this.customMessage(b.name,c),this.customDataMessage(b,c),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c],"<strong>Warning: No message defined for "+b.name+"</strong>")},formatAndAdd:function(b,c){var d=this.defaultMessage(b,c.method),e=/\$?\{(\d+)\}/g;"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),this.errorList.push({message:d,element:b,method:c.method}),this.errorMap[b.name]=d,this.submitted[b.name]=d},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.val
3754idClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g=this.errorsFor(b),h=this.idOrName(b),i=a(b).attr("aria-describedby");g.length?(g.removeClass(this.settings.validClass).addClass(this.settings.errorClass),g.html(c)):(g=a("<"+this.settings.errorElement+">").attr("id",h+"-error").addClass(this.settings.errorClass).html(c||""),d=g,this.settings.wrapper&&(d=g.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b),g.is("label")?g.attr("for",h):0===g.parents("label[for='"+h+"']").length&&(f=g.attr("id").replace(/(:|\.|\[|\])/g,"\\$1"),i?i.match(new RegExp("\\b"+f+"\\b"))||(i+=" "+f):i=f,a(b).attr("aria-describedby",i),e=this.groups[b.n
3754ame],e&&a.each(this.groups,function(b,c){c===e&&a("[name='"+b+"']",this.currentForm).attr("aria-describedby",g.attr("id"))}))),!c&&this.settings.success&&(g.text(""),"string"==typeof this.settings.success?g.addClass(this.settings.success):this.settings.success(g,b)),this.toShow=this.toShow.add(g)},errorsFor:function(b){var c=this.idOrName(b),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+d.replace(/\s+/g,", #")),this.errors().filter(e)},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+b+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);
3754return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),/min|max/.test(c)&&(null===g||/number|range|text/.test(g))&&(d=Number(d)),d||0===d?e[c]=d:g===c&&"range"!==g&&(e[c]=!0);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b);for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),void 0!==d&&(e[c]=d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0!==e.param?e.param:!0:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:a.trim(b).length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},date:function(a,b){/*return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())*/ /*customized!!!*/ var check = false,re=new RegExp((typeof(VALIDATE_DATE_MASK)!=='undefined'?VALIDATE_DATE_MASK:'^[0-9]{1,2}\.[0-9]{1,2}\.[0-9]{4}$')),adata,gg,mm,aaaa,xdata;if(re.test(a)){adata=a.split('.');if(adata.length===1){adata=a.split('-');if(adata.length===1){adata=a.split(' ');
3754if(adata.length===1){adata=a.split('/');if(adata.length===1){adata=a.split(':');}}}}gg=parseInt(adata[0],10);mm=parseInt(adata[1],10);aaaa=parseInt(adata[2],10);xdata=new Date(aaaa,mm-1,gg,12,0,0,0);if((xdata.getUTCFullYear()===aaaa)&&(xdata.getUTCMonth()===mm-1)&&(xdata.getUTCDate()===gg)){check = true;}else{check = false;}}else{check = false;}return this.optional(b)||check;},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||d>=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||c>=a},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e,f,g=this.previousValue(c);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),g.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=g.message,d="string"==typeof d&&{url:d}||d,g.old===b?g.valid:(g.old=b,e=this,this.startRequest(c),f={},f[c.name]=b,a.ajax(a.extend(!0,{url:d,mode:"abort",port:"validate"+c.name,dataType:"json",data:f,context:e.currentForm,success:function(d){var f,h,i,j=d===!0||"true"===d;e.settings.messages[c.name].remote=g.originalMessage,j?(i=e.formSubmitted,e.prepareElement(c),e.formSubmitted=i,e.successList.push(c),delete e.invalid[c.name],e.showErrors()):(f={},h=d||e.defaultMessage(c,"remote"),f[c.name]=g.message=a.isFunction(h)?h(b):h,e.invalid[c.name]=!0,e.showErrors(f)),g.valid=j,e.stopRequest(c,j)}},d)),"pending")}}}),a.format=function(){throw"$.format has been deprecated. Please use $.validator.format instead."};var b,c={};a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a.extend(a.fn,{validateDelegate:function(b,c,d){return this.bind(c,function(c){var e=a(c.target);return e.is(b)?d.apply(e,arguments):void 0})}})});
3755/* End */
3756;
3757; /* Start:"a:4:{s:4:"full";s:72:"/bitrix/templates/aspro-allcorp2/js/jquery.uniform.min.js?17182808738308";s:6:"source";s:57:"/bitrix/templates/aspro-allcorp2/js/jquery.uniform.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3758(function(e,t){"use strict";function n(e){var t=Array.prototype.slice.call(arguments,1);return e.prop?e.prop.apply(e,t):e.attr.apply(e,t)}function s(e,t,n){var s,a;for(s in n)n.hasOwnProperty(s)&&(a=s.replace(/ |$/g,t.eventNamespace),e.bind(a,n[s]))}function a(e,t,n){s(e,n,{focus:function(){t.addClass(n.focusClass)},blur:function(){t.removeClass(n.focusClass),t.removeClass(n.activeClass)},mouseenter:function(){t.addClass(n.hoverClass)},mouseleave:function(){t.removeClass(n.hoverClass),t.removeClass(n.activeClass)},"mousedown touchbegin":function(){e.is(":disabled")||t.addClass(n.activeClass)},"mouseup touchend":function(){t.removeClass(n.activeClass)}})}function i(e,t){e.removeClass(t.hoverClass+" "+t.focusClass+" "+t.activeClass)}function r(e,t,n){n?e.addClass(t):e.removeClass(t)}function l(e,t,n){var s="checked",a=t.is(":"+s);t.prop?t.prop(s,a):a?t.attr(s,s):t.removeAttr(s),r(e,n.checkedClass,a)}function u(e,t,n){r(e,n.disabledClass,t.is(":disabled"))}function o(e,t,n){switch(n){case"after":return e.after(t),e.next();case"before":return e.before(t),e.prev();case"wrap":return e.wrap(t),e.parent()}return null}function c(t,s,a){var i,r,l;return a||(a={}),a=e.extend({bind:{},divClass:null,divWrap:"wrap",spanClass:null,spanHtml:null,spanWrap:"wrap"},a),i=e("<div />"),r=e("<span />"),s.autoHide&&t.is(":hidden")&&"none"===t.css("display")&&i.hide(),a.divClass&&i.addClass(a.divClass),s.wrapperClass&&i.addClass(s.wrapperClass),a.spanClass&&r.addClass(a.spanClass),l=n(t,"id"),s.useID&&l&&n(i,"id",s.idPrefix+"-"+l),a.spanHtml&&r.html(a.spanHtml),i=o(t,i,a.divWrap),r=o(t,r,a.spanWrap),u(i,t,s),{div:i,span:r}}function d(t,n){var s;return n.wrapperClass?(s=e("<span />").addClass(n.wrapperClass),s=o(t,s,"wrap")):null}function f(){var t,n,s,a;return a="rgb(120,2,153)",n=e('<div style="width:0;height:0;color:'+a+'">'),e("body").append(n),s=n.get(0),t=window.getComputedStyle?window.getComputedStyle(s,"").color:(s.currentStyle||s.style||{}).color,n.remove(),t.replace(/ /g,"")!==a}function p(t){return t?e("<span />").text(t).html():""}function m(){return navigator.cpuClass&&!navigator.product}function v(){return window.XMLHttpRequest!==void 0?!0:!1}function h(e){var t;return e[0].multiple?!0:(t=n(e,"size"),!t||1>=t?!1:!0)}function C(){return!1}function w(e,t){var n="none";s(e,t,{"selectstart dragstart mousedown":C}),e.css({MozUserSelect:n,msUserSelect:n,webkitUserSelect:n,userSelect:n})}function b(e,t,n){var s=e.val();""===s?s=n.fileDefaultHtml:(s=s.split(/[\/\\]+/),s=s[s.length-1]),t.text(s)}function y(e,t,n){var s,a;for(s=[],e.each(function(){var e;
3758for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&(s.push({el:this,name:e,old:this.style[e]}),this.style[e]=t[e])}),n();s.length;)a=s.pop(),a.el.style[a.name]=a.old}function g(e,t){var n;n=e.parents(),n.push(e[0]),n=n.not(":visible"),y(n,{visibility:"hidden",display:"block",position:"absolute"},t)}function k(e,t){return function(){e.unwrap().unwrap().unbind(t.eventNamespace)}}var H=!0,x=!1,A=[{match:function(e){return e.is("a, button, :submit, :reset, input[type='button']")},apply:function(e,t){var r,l,o,d,f;return l=t.submitDefaultHtml,e.is(":reset")&&(l=t.resetDefaultHtml),d=e.is("a, button")?function(){return e.html()||l}:function(){return p(n(e,"value"))||l},o=c(e,t,{divClass:t.buttonClass,spanHtml:d()}),r=o.div,a(e,r,t),f=!1,s(r,t,{"click touchend":function(){var t,s,a,i;f||e.is(":disabled")||(f=!0,e[0].dispatchEvent?(t=document.createEvent("MouseEvents"),t.initEvent("click",!0,!0),s=e[0].dispatchEvent(t),e.is("a")&&s&&(a=n(e,"target"),i=n(e,"href"),a&&"_self"!==a?window.open(i,a):document.location.href=i)):e.click(),f=!1)}}),w(r,t),{remove:function(){return r.after(e),r.remove(),e.unbind(t.eventNamespace),e},update:function(){i(r,t),u(r,e,t),e.detach(),o.span.html(d()).append(e)}}}},{match:function(e){return e.is(":checkbox")},apply:function(e,t){var n,r,o;return n=c(e,t,{divClass:t.checkboxClass}),r=n.div,o=n.span,a(e,r,t),s(e,t,{"click touchend":function(){l(o,e,t)}}),l(o,e,t),{remove:k(e,t),update:function(){i(r,t),o.removeClass(t.checkedClass),l(o,e,t),u(r,e,t)}}}},{match:function(e){return e.is(":file")},apply:function(t,r){function l(){b(t,p,r)}var d,f,p,v;return d=c(t,r,{divClass:r.fileClass,spanClass:r.fileButtonClass,spanHtml:r.fileButtonHtml,spanWrap:"after"}),f=d.div,v=d.span,p=e("<span />").html(r.fileDefaultHtml),p.addClass(r.filenameClass),p=o(t,p,"after"),n(t,"size")||n(t,"size",f.width()/10),a(t,f,r),l(),m()?s(t,r,{click:function(){t.trigger("change"),setTimeout(l,0)}}):s(t,r,{change:l}),w(p,r),w(v,r),{remove:function(){return p.remove(),v.remove(),t.unwrap().unbind(r.eventNamespace)},update:function(){i(f,r),b(t,p,r),u(f,t,r)}}}},{match:function(e){if(e.is("input")){var t=(" "+n(e,"type")+" ").toLowerCase(),s=" color date datetime datetime-local email month number password search tel text time url week ";return s.indexOf(t)>=0}return!1},apply:function(e,t){var s,i;return s=n(e,"type"),e.addClass(t.inputClass),i=d(e,t),a(e,e,t),t.inputAddTypeAsClass&&e.addClass(s),{remove:function(){e.removeClass(t.inputClass),t.inputAddTypeAsClass&&e.removeClass(s),i&&e.unwrap()},update:C}}},{match:function(e){return e.is(":radio")},apply:function(t,r){var o,d,f;return o=c(t,r,{divClass:r.radioClass}),d=o.div,f=o.span,a(t,d,r),s(t,r,{"click touchend":function(){e.uniform.update(e(':radio[name="'+n(t,"name")+'"]'))}}),l(f,t,r),{remove:k(t,r),update:function(){i(d,r),l(f,t,r),u(d,t,r)}}}},{match:function(e){return e.is("select")&&!h(e)?!0:!1},apply:function(t,n){var r,l,o,d;return n.selectAutoWidth&&g(t,function(){d=t.width()}),r=c(t,n,{divClass:n.selectClass,spanHtml:(t.find(":selected:first")||t.find("option:first")).html(),spanWrap:"before"}),l=r.div,o=r.span,n.selectAutoWidth?g(t,function(){y(e([o[0],l[0]]),{display:"block"},function(){var e;e=o.outerWidth()-o.width(),l.width(d+e),o.width(d)})}):l.addClass("fixedWidth"),a(t,l,n),s(t,n,{change:function(){o.html(t.find(":selected").html()),l.removeClass(n.activeClass)},"click touchend":function(){var e=t.find(":selected").html();o.html()!==e&&t.trigger("change")},keyup:function(){o.html(t.find(":selected").html())}}),w(o,n),{remove:function(){return o.remove(),t.unwrap().unbind(n.eventNamespace),t},update:function(){n.selectAutoWidth?(e.uniform.restore(t),t.uniform(n)):(i(l,n),o.html(t.find(":selected").html()),u(l,t,n))}}}},{match:function(e){return e.is("select")&&h(e)?!0:!1},apply:function(e,t){var n;return e.addClass(t.selectMultiClass),n=d(e,t),a(e,e,t),{remove:function(){e.removeClass(t.selectMultiClass),n&&e.unwrap()},update:C}}},{match:function(e){return e.is("textarea")},apply:function(e,t){var n;return e.addClass(t.textareaClass),n=d(e,t),a(e,e,t),{remove:function(){e.removeClass(t.textareaClass),n&&e.unwrap()},update:C}}}];m()&&!v()&&(H=!1),e.uniform={defaults:{activeClass:"active",autoHide:!0,buttonClass:"button",checkboxClass:"checker",checkedClass:"checked",disabledClass:"disabled",eventNamespace:".uniform",fileButtonClass:"action",fileButtonHtml:"Cho
vendor: 4,677 bytes, lines 3758-3767
3758ose File",fileClass:"uploader",fileDefaultHtml:"No file selected",filenameClass:"filename",focusClass:"focus",hoverClass:"hover",idPrefix:"uniform",inputAddTypeAsClass:!0,inputClass:"uniform-input",radioClass:"radio",resetDefaultHtml:"Reset",resetSelector:!1,selectAutoWidth:!0,selectClass:"selector",selectMultiClass:"uniform-multiselect",submitDefaultHtml:"Submit",textareaClass:"uniform",useID:!0,wrapperClass:null},elements:[]},e.fn.uniform=function(t){var n=this;return t=e.extend({},e.uniform.defaults,t),x||(x=!0,f()&&(H=!1)),H?(t.resetSelector&&e(t.resetSelector).mouseup(function(){window.setTimeout(function(){e.uniform.update(n)},10)}),this.each(function(){var n,s,a,i=e(this);if(i.data("uniformed"))return e.uniform.update(i),void 0;for(n=0;A.length>n;n+=1)if(s=A[n],s.match(i,t))return a=s.apply(i,t),i.data("uniformed",a),e.uniform.elements.push(i.get(0)),void 0})):this},e.uniform.restore=e.fn.uniform.restore=function(n){n===t&&(n=e.uniform.elements),e(n).each(function(){var t,n,s=e(this);n=s.data("uniformed"),n&&(n.remove(),t=e.inArray(this,e.uniform.elements),t>=0&&e.uniform.elements.splice(t,1),s.removeData("uniformed"))})},e.uniform.update=e.fn.uniform.update=function(n){n===t&&(n=e.uniform.elements),e(n).each(function(){var t,n=e(this);t=n.data("uniformed"),t&&t.update(n,t.options)})}})(jQuery);
3759/* End */
3760;
3761; /* Start:"a:4:{s:4:"full";s:68:"/bitrix/templates/aspro-allcorp2/js/jquery-ui.min.js?171828087332162";s:6:"source";s:52:"/bitrix/templates/aspro-allcorp2/js/jquery-ui.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3762/*! jQuery UI - v1.12.1 - 2017-05-11
3763* http://jqueryui.com
3764* Includes: widget.js, position.js, keycode.js, unique-id.js, widgets/autocomplete.js, widgets/menu.js
3765* Copyright jQuery Foundation and other contributors; Licensed MIT */
3766
3767(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){t.ui=t.ui||{},t.ui.version="1.12.1";var e=0,i=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0];e=e.split(".")[1];var h=l+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var s,n,o=i.call(arguments,1),a=0,r=o.length;r>a;a++)for(s in o[a])n=o[a][s],o[a].hasOwnProperty(s)&&void 0!==n&&(e[s]=t.isPlainObject(n)?t.isPlainObject(e[s])?t.widget.extend({},e[s],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,s){var n=s.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=i.call(arguments,1),l=this;return a?this.length||"instance"!==o?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):l=void 0:(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new s(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(i,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=e++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t
vendor: 9,589 bytes, line 3767
3767(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),i),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,function(){function e(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function i(e,i){return parseInt(t.css(e,i),10)||0}function s(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}var n,o=Math.max,a=Math.abs,r=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,d=t.fn.position;t.position={scrollbarWidth:function(){if(void 0!==n)return n;var e,i,s=t("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return t("body").append(s),e=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,e===i&&(i=s[0].clientWidth),s.remove(),n=e-i},getScrollInfo:function(e){var i=e.isWindow||e.isDocument?"":e.element.css("overflow-x"),s=e.isWindow||e.isDocument?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.width<e.element[0].scrollWidth,o="scroll"===s||"auto"===s&&e.height<e.element[0].scrollHeight;return{width:o?t.position.scrollbarWidth():0,height:n?t.position.scrollbarWidth():0}},getWithinInfo:function(e){var i=t(e||window),s=t.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType,o=!s&&!n;return{element:i,isWindow:s,isDocument:n,offset:o?t(e).offset():{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:i.outerWidth(),height:i.outerHeight()}}},t.fn.position=function(n){if(!n||!n.of)return d.apply(this,arguments);n=t.extend({},n);var u,p,f,g,m,_,v=t(n.of),b=t.position.getWithinInfo(n.within),y=t.position.getScrollInfo(b),w=(n.collision||"flip").split(" "),k={};return _=s(v),v[0].preventDefault&&(n.at="left top"),p=_.width,f=_.height,g=_.offset,m=t.extend({},g),t.each(["my","at"],function(){var t,e,i=(n[this]||"").split(" ");1===i.length&&(i=r.test(i[0])?i.concat(["center"]):l.test(i[0])?["center"].concat(i):["center","center"]),i[0]=r.test(i[0])?i[0]:"center",i[1]=l.test(i[1])?i[1]:"center",t=h.exec(i[0]),e=h.exec(i[1]),k[this]=[t?t[0]:0,e?e[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===w.length&&(w[1]=w[0]),"right"===n.at[0]?m.left+=p:"center"===n.at[0]&&(m.left+=p/2),"bottom"===n.at[1]?m.top+=f:"center"===n.at[1]&&(m.top+=f/2),u=e(k.at,p,f),m.left+=u[0],m.top+=u[1],this.each(function(){var s,r,l=t(this),h=l.outerWidth(),c=l.outerHeight(),d=i(this,"marginLeft"),_=i(this,"marginTop"),x=h+d+i(this,"marginRight")+y.width,C=c+_+i(this,"marginBottom")+y.height,D=t.extend({},m),T=e(k.my,l.outerWidth(),l.outerHeight());"right"===n.my[0]?D.left-=h:"center"===n.my[0]&&(D.left-=h/2),"bottom"===n.my[1]?D.top-=c:"center"===n.my[1]&&(D.top-=c/2),D.left+=T[0],D.top+=T[1],s={marginLeft:d,marginTop:_},t.each(["left","top"],function(e,i){t.ui.position[w[e]]&&t.ui.position[w[e]][i](D,{targetWidth:p,targetHeight:f,elemWidth:h,elemHeight:c,collisionPosition:s,collisionWidth:x,collisionHeight:C,offset:[u[0]+T[0],u[1]+T[1]],my:n.my,at:n.at,within:b,elem:l})}),n.using&&(r=function(t){var e=g.left-D.left,i=e+p-h,s=g.top-D.top,r=s+f-c,u={target:{element:v,left:g.left,top:g.top,width:p,height:f},element:{element:l,left:D.left,top:D.top,width:h,height:c},horizontal:0>i?"left":e>0?"right":"center",vertical:0>r?"top":s>0?"bottom":"middle"};h>p&&p>a(e+i)&&(u.horizontal="center"),c>f&&f>a(s+r)&&(u.vertical="middle"),u.important=o(a(e),a(i))>o(a(s),a(r))?"horizontal":"vertical",n.using.call(this,t,u)}),l.offset(t.extend(D,{using:r}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,l=n-r,h=r+e.collisionWidth-a-n;e.collisionWidth>a?l>0&&0>=h?(i=t.left+l+e.collisionWidth-a-n,t.left+=l-i):t.left=h>0&&0>=l?n:l>h?n+a-e.collisionWidth:n:l>0?t.left+=l:h>0?t.left-=h:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,l=n-r,h=r+e.collisionHeight-a-n;e.collisionHeight>a?l>0&&0>=h?(i=t.top+l+e.collisionHeight-a-n,t.top+=l-i):t.top=h>0&&0>=l?n:l>h?n+a-e.collisionHeight:n:l>
vendor: 8,823 bytes, line 3767
37670?t.top+=l:h>0?t.top-=h:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,o=n.offset.left+n.scrollLeft,r=n.width,l=n.isWindow?n.scrollLeft:n.offset.left,h=t.left-e.collisionPosition.marginLeft,c=h-l,u=h+e.collisionWidth-r-l,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-r-o,(0>i||a(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-l,(s>0||u>a(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,o=n.offset.top+n.scrollTop,r=n.height,l=n.isWindow?n.scrollTop:n.offset.top,h=t.top-e.collisionPosition.marginTop,c=h-l,u=h+e.collisionHeight-r-l,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,g=-2*e.offset[1];0>c?(s=t.top+p+f+g+e.collisionHeight-r-o,(0>s||a(c)>s)&&(t.top+=p+f+g)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+g-l,(i>0||u>a(i))&&(t.top+=p+f+g))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}}}(),t.ui.position,t.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},t.fn.extend({uniqueId:function(){var t=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++t)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&t(this).removeAttr("id")})}}),t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.widget("ui.menu",{version:"1.12.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault()},"click .ui-menu-item":function(e){var i=t(e.target),s=t(t.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(e),e.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(e):!this.element.is(":focus")&&s.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(e){if(!this.previousFilter){var i=t(e.target).closest(".ui-menu-item"),s=t(e.currentTarget);i[0]===s[0]&&(this._removeClass(s.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(e,s))}},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this.element.find(this.options.items).eq(0);e||this.focus(t,i)},blur:function(e){this._delay(function(){var i=!t.contains(this.element[0],t.ui.safeActiveElement(this.document[0]));i&&this.collapseAll(e)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t),this.mouseHandled=!1}})},_destroy:function(){var e=this.element.find(".ui-menu-item").removeAttr("role aria-disabled"),i=e.children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),i.children().each(function(){var e=t(this);e.data("ui-menu-submenu-caret")&&e.remove()})},_keydown:function(e){var i,s,n,o,a=!0;switch(e.keyCode){case t.ui.keyCode.PAGE_UP:this.previousPage(e);break;case t.ui.keyCode.PAGE_DOWN:this.nextPage(e);break;case t.ui.keyCode.HOME:this._move("first","first",e);break;case t.ui.keyCode.END:this._move("last","last",e);break;case t.ui.keyCode.UP:this.previous(e);break;case t.ui.keyCode.DOWN:this.next(e);break;case t.ui.keyCode.LEFT:this.collapse(e);break;case t.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(e);break;case t.ui.keyCode.ENTER:case t.ui.keyCode.SPACE:this._activate(e);break;case t.ui.keyCode.ESCAPE:this.collapse(e);break;default:a=!1,s=this.previousFilter||"",o=!1,n=e.keyCode>=96&&105>=e.keyCode?""+(e.keyCode-96):String.fromCharCode(e.keyCode),clearTimeout(this.filterTimer),n===s?o=!0:n=s+n,i=this._filterMenuItems(n),i=o&&-1!==i.index(this.active.next())?this.active.nextAll(".ui-menu-item"):i,i.length||(n=String.fromCharCode(e.keyCode),i=this._filterMenuItems(n)),i.length?(this.focus(e,i),this.previousFilter=n,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}a&&e.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var e,i,s,n,o,a=this,r=this.options.icons.submenu,l=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),s=l.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var e=t(this),i=e.prev(),s=t("<span>").data("ui-menu-submenu-caret",!0);a._addClass(s,"ui-menu-icon","ui-icon "+r),i.attr("aria-haspopup","true").prepend(s),e.attr("aria-labelledby",i.attr("id"))}),this._addClass(s,"ui-menu","ui-widget ui-widget-content ui-front"),e=l.add(this.element),i=e.find(this.options.items),i.not(".ui-menu-item").each(function(){var e=t(this);a._isDivider(e)&&a._addClass(e,"ui-menu-divider","ui-widget-content")}),n=i.not(".ui-menu-item, .ui-menu-divider"),o=n.children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(n,"ui-menu-item")._addClass(o,"ui-menu-item-wrapper"),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!t.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){if("icons"===t){var i=this.element.find(".ui-menu-icon");this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)}this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t+""),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i,s,n;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),s=this.active.children(".ui-menu-item-wrapper"),this._addClass(s,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),n=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(n,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=e.children(".ui-menu"),i.length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(e){var i,s,n,o,a,r;this._hasScroll()&&(i=parseFloat(t.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(t.css(this.activeMenu[0],"paddingTop"))||0,n=e.offset().top-this.activeMenu.offset().top-i-s,o=this.activeMenu.scrollTop(),a=this.activeMenu.height(),r=e.outerHeight(),0>n?this.activeMenu.scrollTop(o+n):n+r>a&&this.activeMenu.scrollTop(o+n-a+r))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(e){var i=t.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(e.parents(".ui-menu")).hide().attr("aria-hidden","true"),e.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(i)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var s=i?this.element:t(e&&e.target).closest(this.element.find(".ui-menu"));s.length||(s=this.element),this._close(s),this.blur(e),this._removeClass(s.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=s},this.delay)},_close:function(t){t||(t=this.active?this.active.parent():this.element),t.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","fal
3767se")},_closeOnDocumentClick:function(e){return!t(e.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this.active.children(".ui-menu ").find(this.options.items).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(t,e,i){var s;this.active&&(s="first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").eq(-1):this.active[t+"All"](".ui-menu-item").eq(0)),s&&s.length&&this.active||(s=this.activeMenu.find(this.options.items)[e]()),this.focus(i,s)},nextPage:function(e){var i,s,n;return this.active?(this.isLastItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return i=t(this),0>i.offset().top-s-n}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items)[this.active?"last":"first"]())),void 0):(this.next(e),void 0)},previousPage:function(e){var i,s,n;return this.active?(this.isFirstItem()||(this._hasScroll()?(s=this.active.offset().top,n=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return i=t(this),i.offset().top-s+n>0}),this.focus(e,i)):this.focus(e,this.activeMenu.find(this.options.items).first())),void 0):(this.next(e),void 0)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(e){this.active=this.active||t(e.target).closest(".ui-menu-item");var i={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(e,!0),this._trigger("select",e,i)},_filterMenuItems:function(e){var i=e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),s=RegExp("^"+i,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return s.test(t.trim(t(this).children(".ui-menu-item-wrapper").text()))})}}),t.widget("ui.autocomplete",{version:"1.12.1",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,_create:function(){var e,i,s,n=this.element[0].nodeName.toLowerCase(),o="textarea"===n,a="input"===n;this.isMultiLine=o||!a&&this._isContentEditable(this.element),this.valueMethod=this.element[o||a?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(n){if(this.element.prop("readOnly"))return e=!0,s=!0,i=!0,void 0;e=!1,s=!1,i=!1;var o=t.ui.keyCode;switch(n.keyCode){case o.PAGE_UP:e=!0,this._move("previousPage",n);break;case o.PAGE_DOWN:e=!0,this._move("nextPage",n);break;case o.UP:e=!0,this._keyEvent("previous",n);break;case o.DOWN:e=!0,this._keyEvent("next",n);break;case o.ENTER:this.menu.active&&(e=!0,n.preventDefault(),this.menu.select(n));break;case o.TAB:this.menu.active&&this.menu.select(n);break;case o.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(n),n.preventDefault());break;default:i=!0,this._searchTimeout(n)}},keypress:function(s){if(e)return e=!1,(!this.isMultiLine||this.menu.element.is(":visible"))&&s.preventDefault(),void 0;if(!i){var n=t.ui.keyCode;switch(s.keyCode){case n.PAGE_UP:this._move("previousPage",s);break;case n.PAGE_DOWN:this._move("nextPage",s);break;case n.UP:this._keyEvent("previous",s);break;case n.DOWN:this._keyEvent("next",s)}}},input:function(t){return s?(s=!1,t.preventDefault(),void 0):(this._searchTimeout(t),void 0)},focus:function(){this.selectedItem=null,this.previous=this._value(
vendor: 4,123 bytes, line 3767
3767)},blur:function(t){return this.cancelBlur?(delete this.cancelBlur,void 0):(clearTimeout(this.searching),this.close(t),this._change(t),void 0)}}),this._initSource(),this.menu=t("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(e){e.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,this.element[0]!==t.ui.safeActiveElement(this.document[0])&&this.element.trigger("focus")})},menufocus:function(e,i){var s,n;return this.isNewMenu&&(this.isNewMenu=!1,e.originalEvent&&/^mouse/.test(e.originalEvent.type))?(this.menu.blur(),this.document.one("mousemove",function(){t(e.target).trigger(e.originalEvent)}),void 0):(n=i.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",e,{item:n})&&e.originalEvent&&/^key/.test(e.originalEvent.type)&&this._value(n.value),s=i.item.attr("aria-label")||n.value,s&&t.trim(s).length&&(this.liveRegion.children().hide(),t("<div>").text(s).appendTo(this.liveRegion)),void 0)},menuselect:function(e,i){var s=i.item.data("ui-autocomplete-item"),n=this.previous;this.element[0]!==t.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=n,this._delay(function(){this.previous=n,this.selectedItem=s})),!1!==this._trigger("select",e,{item:s})&&this._value(s.value),this.term=this._value(),this.close(e),this.selectedItem=s}}),this.liveRegion=t("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(e){var i=this.menu.element[0];return e.target===this.element[0]||e.target===i||t.contains(i,e.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var e=this.options.appendTo;return e&&(e=e.jquery||e.nodeType?t(e):this.document.find(e).eq(0)),e&&e[0]||(e=this.element.closest(".ui-front, dialog")),e.length||(e=this.document[0].body),e},_initSource:function(){var e,i,s=this;t.isArray(this.options.source)?(e=this.options.source,this.source=function(i,s){s(t.ui.autocomplete.filter(e,i.term))}):"string"==typeof this.options.source?(i=this.options.source,this.source=function(e,n){s.xhr&&s.xhr.abort(),s.xhr=t.ajax({url:i,data:e,dataType:"json",success:function(t){n(t)},error:function(){n([])}})}):this.source=this.options.source},_searchTimeout:function(t){clearTimeout(this.searching),this.searching=this._delay(function(){var e=this.term===this._value(),i=this.menu.element.is(":visible"),s=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;(!e||e&&!i&&!s)&&(this.selectedItem=null,this.search(null,t))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):this._trigger("search",e)!==!1?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return t.proxy(function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")},this)},__response:function(t){t&&(t=this._normalize(t)),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))}
3767,_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(e){return e.length&&e[0].label&&e[0].value?e:t.map(e,function(e){return"string"==typeof e?{label:e,value:e}:t.extend({},e,{label:e.label||e.value,value:e.value||e.label})})},_suggest:function(e){var i=this.menu.element.empty();this._renderMenu(i,e),this.isNewMenu=!0,this.menu.refresh(),i.show(),this._resizeMenu(),i.position(t.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(e,i){var s=this;t.each(i,function(t,i){s._renderItemData(e,i)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(e,i){return t("<li>").append(t("<div>").text(i.label)).appendTo(e)},_move:function(t,e){return this.menu.element.is(":visible")?this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),this.menu.blur(),void 0):(this.menu[t](e),void 0):(this.search(null,e),void 0)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){(!this.isMultiLine||this.menu.element.is(":visible"))&&(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),t.extend(t.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(e,i){var s=RegExp(t.ui.autocomplete.escapeRegex(i),"i");return t.grep(e,function(t){return s.test(t.label||t.value||t)})}}),t.widget("ui.autocomplete",t.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(t>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var i;this._superApply(arguments),this.options.disabled||this.cancelSearch||(i=e&&e.length?this.options.messages.results(e.length):this.options.messages.noResults,this.liveRegion.children().hide(),t("<div>").text(i).appendTo(this.liveRegion))}}),t.ui.autocomplete});
3768/* End */
3769;
3770; /* Start:"a:4:{s:4:"full";s:62:"/bitrix/templates/aspro-allcorp2/js/jqModal.js?171828087311039";s:6:"source";s:46:"/bitrix/templates/aspro-allcorp2/js/jqModal.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3771/*
3772 * jqModal - Minimalist Modaling with jQuery
3773 *
3774 * Copyright (c) 2007-2014 Brice Burgess @iceburg_net
3775 * Dual licensed under the MIT and GPL licenses:
3776 *   http://www.opensource.org/licenses/mit-license.php
3777 *   http://www.gnu.org/licenses/gpl.html
3778 * 
3779 * $Version: 1.0.2 (2014.04.10 +r19)
3780 * Requires: jQuery 1.2.3+
3781 */
3782
3783(function($) {
3784	
3785	/**
3786	 * Initialize a set of elements as "modals". Modals typically are popup dialogs,
3787	 * notices, modal windows, &c. 
3788	 * 
3789	 * @name jqm
3790	 * @param options user defined options, augments defaults.
3791	 * @type jQuery
3792	 * @cat Plugins/jqModal
3793	 */
3794	
3795	$.fn.jqm=function(options){
3796		
3797		var o = $.extend({}, $.jqm.params, options);
3798
3799		return this.each(function(){
3800			var e = $(this),
3801				jqm = $(this).data('jqm');
3802			
3803			if(!jqm) jqm = {ID: I++};
3804			
3805			// add/extend options to modal and mark as initialized
3806			e.data('jqm',$.extend(o,jqm)).addClass('jqm-init');
3807			
3808			// ... Attach events to trigger showing of this modal
3809			o.trigger&&$(this).jqmAddTrigger(o.trigger);
3810		});
3811	};
3812	
3813	
3814	/**
3815	 * Matching modals will have their jqmShow() method fired by attaching a
3816	 *   onClick event to elements matching `trigger`.
3817	 * 
3818	 * @name jqmAddTrigger
3819	 * @param trigger a selector String, jQuery collection of elements, or a DOM element.
3820	 */
3821	$.fn.jqmAddTrigger=function(trigger){
3822		return this.each(function(){
3823			if(!addTrigger($(this), 'jqmShow', trigger))
3824				err("jqmAddTrigger must be called on initialized modals")
3825		});
3826	};
3827	
3828	
3829	/**
3830	 * Matching modals will have their jqmHide() method fired by attaching an
3831	 *   onClick event to elements matching `trigger`.
3832	 * 
3833	 * @name jqmAddClose
3834	 * @param trigger a selector String, jQuery collection of elements, or a DOM element.
3835	 */
3836	$.fn.jqmAddClose=function(trigger){
3837		return this.each(function(){
3838			if(!addTrigger($(this), 'jqmHide', trigger))
3839				err("jqmAddClose must be called on initialized modals")
3840		});
3841	};
3842	
3843	
3844	/**
3845	 * Open matching modals (if not shown)
3846	 */
3847	$.fn.jqmShow=function(trigger){
3848		return this.each(function(){ !this._jqmShown&&show($(this), trigger); });
3849	};
3850	
3851	/**
3852	 * Close matching modals
3853	 */
3854	$.fn.jqmHide=function(trigger){
3855		return this.each(function(){ this._jqmShown&&hide($(this), trigger); });
3856	};
3857	
3858	
3859	// utility functions
3860	
3861	var
3862		err = function(msg){
3863			if(window.console && window.console.error) window.console.error(msg);
3864		
3865		
3866	}, show = function(e, t){
3867		
3868		/**
3869		 * e = modal element (as jQuery object)
3870		 * t = triggering element
3871		 * 
3872		 * o = options
3873		 * z = z-index of modal
3874		 * v = overlay element (as jQuery object)
3875		 * h = hash (for jqModal <= r15 compatibility)
3876		 */
3877		
3878		var o = e.data('jqm'),
3879			t = t || window.event,
3880			z = (parseInt(e.css('z-index'))),
3881			z = (z > 0) ? z : 3000,
3882			v = $('<div></div>').addClass(o.overlayClass).css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:o.overlay/100}),
3883		
3884			// maintain legacy "hash" construct
3885			h = {w: e, c: o, o: v, t: t};
3886			
3887		e.css('z-index',z);
3888
3889		if(o.ajax){
3890			var target = o.target || e,
3891				url = o.ajax;
3892			
3893			target = (typeof target == 'string') ? $(target,e) : $(target);
3894			if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1));
3895			
3896			 // Load the Ajax Content (and once loaded);
3897			   // Fire the onLoad callback (if exists),
3898			   // Attach closing events to elements inside the modal that match the closingClass,
3899			   // and Execute the jqModal default Open Callback
3900			target.html(o.ajaxText).load(url,function(){
3901				o.onLoad && o.onLoad.call(this,h);
3902				open(h);
3903			});	
3904		}
3905		else { open(h); }
3906		
3907	}, hide = function(e, t){
3908		/**
3909		 * e = modal element (as jQuery object)
3910		 * t = triggering element
3911		 * 
3912		 * o = options
3913		 * h = hash (for jqModal <= r15 compatibility)
3914		 */
3915		
3916		var o = e.data('jqm'),
3917			t = t || window.event,
3918		
3919		// maintain legacy "hash" construct
3920		h = {w: e, c: o, o: e.data('jqmv'), t: t};
3921		
3922		close(h);
3923		
3924	}, onShow = function(hash){
3925		// onShow callback. Responsible for showing a modal and overlay.
3926		//  return false to stop opening modal. 
3927		
3928		// hash object;
3929	    //  w: (jQuery object) The modal element
3930	    //  c: (object) The modal's options object 
3931	    //  o: (jQuery object) The overlay element
3932	    //  t: (DOM object) The triggering element
3933		
3934		// display the overlay (prepend to body) if not disabled
3935		
3936		// prevent double click
3937		if( hash.w[0]._jqmShown )
3938			return false;
3939			
3940		if(hash.c.overlay > 0)
3941			hash.o.prependTo('#popup_iframe_wrapper');
3942			
3943		// make modal visible
3944		hash.w.show();
3945		
3946		// call focusFunc (attempts to focus on first input in modal)
3947		$.jqm.focusFunc(hash.w);
3948		
3949		return true;
3950		
3951		
3952	}, onHide = function(hash){
3953		// onHide callback. Responsible for hiding a modal and overlay.
3954		//  return false to stop closing modal. 
3955		
3956		// hash object;
3957	    //  w: (jQuery object) The modal element
3958	    //  c: (object) The modal's options object 
3959	    //  o: (jQuery object) The overlay element
3960	    //  t: (DOM object) The triggering element
3961		
3962		// hide modal and if overlay, remove overlay.
3963		hash.w.hide() && hash.o && hash.o.remove();
3964		
3965		return true;
3966		
3967		
3968	},  addTrigger = function(e, key, trigger){
3969		// addTrigger: Adds a jqmShow or jqmHide (key) for a modal (e) 
3970		//  all elements that match trigger string (trigger)\
3971		
3972		// return false if e is not an initialized modal element
3973		if(!e.data('jqm')) return false;
3974		
3975		return $(trigger).each(function(){
3976			// register modal to trigger elements
3977			this[key] = this[key] || [];
3978			this[key].push(e);
3979			
3980		}).click(function(){
3981			
3982			var trigger = this;
3983			
3984			// foreadh modal registered to this trigger, call jqmShow || 
3985			//   jqmHide (key) on modal passing trigger element (e)
3986			$.each(this[key], function(i, e){ e[key](trigger); });
3987			
3988			// stop trigger click event from bubbling
3989			return false;
3990		});
3991		
3992		
3993	},  open = function(h){
3994		// open: executes the onOpen callback + performs common tasks if successful
3995
3996		// transform legacy hash into new var shortcuts 
3997		 var e = h.w,
3998		 	v = h.o,
3999		 	o = h.c;	
4000
4001		// execute onShow callback
4002		if(o.onShow(h) !== false){
4003			// mark modal as shown
4004			e[0]._jqmShown = true;
4005			
4006			// if modal dialog 
4007			//
4008			// Bind the Keep Focus Function [F] if no other Modals are open (!A[0]) +
4009			// Add this modal to the opened modals stack (A) for nested modal support
4010			// 
4011			// else, close dialog when overlay is clicked
4012			if(o.modal){ !A[0]&&F('bind'); A.push(e); }
4013            else e.jqmAddClose(v);
4014			
4015			//  Attach closing events to elements inside the modal that match the closingClass
4016			o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e));
4017			
4018			// IF toTop is true and overlay exists;
4019			//  Add placeholder element <span id="jqmP#ID_of_modal"/> before modal to
4020			//  remember it's position in the DOM and move it to a child of the body tag (after overlay)
4021			o.toTop&&v&&e.before('<span id="jqmP'+o.ID+'"></span>').insertAfter(v);
4022			
4023			// remember overlay (for closing function)
4024			e.data('jqmv',v);
4025		}
4026		
4027		
4028	},  close = function(h){
4029		// close: executes the onHide callback + performs common tasks if successful
4030
4031		// transform legacy hash into new var shortcuts 
4032		 var e = h.w,
4033		 	v = h.o,
4034		 	o = h.c;
4035
4036		// execute onShow callback
4037		if(o.onHide(h) !== false){
4038			// mark modal as !shown
4039			e[0]._jqmShown = false;
4040			
4041			 // If modal, remove from modal stack.
4042			 // If no modals in modal stack, unbind the Keep Focus Function
4043			 if(o.modal){A.pop();!A[0]&&F('unbind');}
4044			 
4045			 // IF toTop was passed and an overlay exists;
4046			 //  Move modal back to its "remembered" position.
4047			 o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove();
4048		}
4049		
4050		
4051	},  F = function(t){
4052		// F: The Keep Focus Function (for modal: true dialos)
4053		// Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks
4054		
4055		$(document)[t]("keypress keydown mousedown",X);
4056		
4057		
4058	}, X = function(e){
4059		// X: The Focus Examination Function (for modal: true dialogs)
4060
4061		var modal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'),
4062			activeModal = A[A.length-1].data('jqm');
4063		
4064		// allow bubbling if event target is within active modal dialog
4065		if(modal && modal.ID == activeModal.ID) return true; 
4066
4067		// else, trigger focusFunc (focus on first input element and halt bubbling)
4068		return $.jqm.focusFunc(activeModal);
4069	}, 
4070	
4071	I = 0,   // modal ID increment (for nested modals) 
4072	A = [];  // array of active modals (used to lock interactivity to appropriate modal)
4073	
4074	
4075	// $.jqm, overridable defaults
4076	$.jqm = {
4077		/**
4078		 *  default options
4079		 *    
4080		 * (Integer)   overlay      - [0-100] Translucency percentage (opacity) of the body covering overlay. Set to 0 for NO overlay, and up to 100 for a 100% opaque overlay.  
4081		 * (String)    overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS.
4082		 * (String)    closeClass   - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal).
4083		 * (Mixed)     trigger      - Matching elements will fire the onShow event (to display the modal). Trigger can be a selector String, a jQuery collection of elements, a DOM element, or a False boolean.
4084		 * (String)    ajax         - URL to load content from via an AJAX request. False to disable ajax. If ajax begins with a "@", the URL is extracted from the attribute of the triggering element (e.g. use '@data-url' for; <a href="#" class="jqModal" data-url="modal.html">...)	                
4085		 * (Mixed)     target       - Children of the modal element to load the ajax response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design. 
4086		 *                            Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element.
4087		 * (String)    ajaxText     - Text shown while waiting for ajax return. Replaces HTML content of `target` element.
4088		 * (Boolean)   modal        - If true, user interactivity will be locked to the modal window until closed.
4089		 * (Boolean)   toTop        - If true, modal will be posistioned as a first child of the BODY element when opened, and its DOM posistion restored when closed. Useful for overcoming z-Index container issues.
4090		 * (Function)  onShow       - User defined callback function fired when modal opened.
4091		 * (Function)  onHide       - User defined callback function fired when modal closed.
4092		 * (Function)  onLoad       - User defined callback function fired when ajax content loads.
4093		 */
4094		params: {
4095			overlay: 50,
4096			overlayClass: 'jqmOverlay',
4097			closeClass: 'jqmClose',
4098			trigger: '.jqModal',
4099			ajax: false,
4100			target: false,
4101			ajaxText: '',
4102			modal: false,
4103			toTop: false,
4104			onShow: onShow,
4105			onHide: onHide,
4106			onLoad: false
4107		},
4108		
4109		// focusFunc is fired when a modal is shown, or when interaction occurs outside
4110		// a modal enabled dialog. Passed the modal element. 
4111		focusFunc: function(e) { $(':input:visible:first',e).focus(); return false; }
4112	};
4113	
4114})( jQuery );
4115/* End */
4116;
4117; /* Start:"a:4:{s:4:"full";s:73:"/bitrix/templates/aspro-allcorp2/js/detectmobilebrowser.js?17182808732203";s:6:"source";s:58:"/bitrix/templates/aspro-allcorp2/js/detectmobilebrowser.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
4118/**
4119 * jQuery.browser.mobile (http://detectmobilebrowser.com/)
4120 *
4121 * jQuery.browser.mobile will be true if the browser is a mobile device
4122 *
4123 **/
4124(function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
4124sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);
4125/* End */
4126;
4127; /* Start:"a:4:{s:4:"full";s:64:"/bitrix/templates/aspro-allcorp2/js/matchMedia.js?17182808731700";s:6:"source";s:49:"/bitrix/templates/aspro-allcorp2/js/matchMedia.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
4128/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license */
4129
4130window.matchMedia || (window.matchMedia = function() {
4131    "use strict";
4132
4133    // For browsers that support matchMedium api such as IE 9 and webkit
4134    var styleMedia = (window.styleMedia || window.media);
4135
4136    // For those that don't support matchMedium
4137    if (!styleMedia) {
4138        var style       = document.createElement('style'),
4139            script      = document.getElementsByTagName('script')[0],
4140            info        = null;
4141
4142        style.type  = 'text/css';
4143        style.id    = 'matchmediajs-test';
4144
4145        script.parentNode.insertBefore(style, script);
4146
4147        // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
4148        info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;
4149
4150        styleMedia = {
4151            matchMedium: function(media) {
4152                var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';
4153
4154                // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
4155                if (style.styleSheet) {
4156                    style.styleSheet.cssText = text;
4157                } else {
4158                    style.textContent = text;
4159                }
4160
4161                // Test if media query is true or false
4162                return info.width === '1px';
4163            }
4164        };
4165    }
4166
4167    return function(media) {
4168        return {
4169            matches: styleMedia.matchMedium(media || 'all'),
4170            media: media || 'all'
4171        };
4172    };
4173}());
4174
4175/* End */
4176;
4177; /* Start:"a:4:{s:4:"full";s:63:"/bitrix/templates/aspro-allcorp2/js/counterup.js?17182808731928";s:6:"source";s:48:"/bitrix/templates/aspro-allcorp2/js/counterup.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
4178!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.counterUp=t():e.counterUp=t()}(self,(function(){return(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{default:()=>n,divideNumbers:()=>r});const n=(e,t={})=>{const{action:n="start",duration:i=1e3,delay:u=16}=t;if("stop"===n)return void o(e);if(o(e),!/[0-9]/.test(e.innerHTML))return;const l=r(e.innerHTML,{duration:i||e.getAttribute("data-duration"),delay:u||e.getAttribute("data-delay")});e._countUpOrigInnerHTML=e.innerHTML,e.innerHTML=l[0]||"&nbsp;",e.style.visibility="visible";const c=function(){e.innerHTML=l.shift()||"&nbsp;",l.length?(clearTimeout(e.countUpTimeout),e.countUpTimeout=setTimeout(c,u)):e._countUpOrigInnerHTML=void 0};e.countUpTimeout=setTimeout(c,u)},o=e=>{clearTimeout(e.countUpTimeout),e._countUpOrigInnerHTML&&(e.innerHTML=e._countUpOrigInnerHTML,e._countUpOrigInnerHTML=void 0),e.style.visibility=""},r=(e,t={})=>{const{duration:n=1e3,delay:o=16}=t,r=n/o,i=e.toString().split(/(<[^>]+>|[0-9.][,.0-9]*[0-9]*)/),u=[];for(let e=0;e<r;e++)u.push("");for(let e=0;e<i.length;e++)if(/([0-9.][,.0-9]*[0-9]*)/.test(i[e])&&!/<[^>]+>/.test(i[e])){let t=i[e];const n=[...t.matchAll(/[.,]/g)].map((e=>({char:e[0],i:t.length-e.index-1}))).sort(((e,t)=>e.i-t.i));t=t.replace(/[.,]/g,"");let o=u.length-1;for(let e=r;e>=1;e--){let i=parseInt(t/r*e,10);i=n.reduce(((e,{char:t,i:n})=>e.length<=n?e:e.slice(0,-n)+t+e.slice(-n)),i.toString()),u[o--]+=i}}else for(let t=0;t<r;t++)u[t]+=i[e];return u[u.length]=e.toString(),u};return t})()}));
4179/* End */
4180;
4181; /* Start:"a:4:{s:4:"full";
4181s:73:"/bitrix/templates/aspro-allcorp2/js/jquery.alphanumeric.js?17182808731972";s:6:"source";s:58:"/bitrix/templates/aspro-allcorp2/js/jquery.alphanumeric.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
4182(function ($) {
4183    $.fn.alphanumeric = function (p) {
4184        var input = $(this),
4185            az = "abcdefghijklmnopqrstuvwxyz",
4186            options = $.extend({
4187                ichars: '!@#$%^&*()+=[]\\\';,/{}|":<>?~`.- _',
4188                nchars: '',
4189                allow: ''
4190            }, p),
4191            s = options.allow.split(''),
4192            i = 0,
4193            ch,
4194            regex;
4195
4196        for (i; i < s.length; i++) {
4197            if (options.ichars.indexOf(s[i]) != -1) {
4198                s[i] = '\\' + s[i];
4199            }
4200        }
4201
4202        if (options.nocaps) {
4203            options.nchars += az.toUpperCase();
4204        }
4205        if (options.allcaps) {
4206            options.nchars += az;
4207        }
4208
4209        options.allow = s.join('|');
4210
4211        regex = new RegExp(options.allow, 'gi');
4212        ch = (options.ichars + options.nchars).replace(regex, '');
4213
4214        input.keypress(function (e) {
4215            var key = String.fromCharCode(!e.charCode ? e.which : e.charCode);
4216
4217            if (ch.indexOf(key) != -1 && !e.ctrlKey) {
4218                e.preventDefault();
4219            }
4220        });
4221
4222        input.blur(function () {
4223            var value = input.val(),
4224                j = 0;
4225
4226            for (j; j < value.length; j++) {
4227                if (ch.indexOf(value[j]) != -1) {
4228                    input.val('');
4229                    return false;
4230                }
4231            }
4232            return false;
4233        });
4234
4235        return input;
4236    };
4237
4238    $.fn.numeric = function (p) {
4239        var az = 'abcdefghijklmnopqrstuvwxyz',
4240            aZ = az.toUpperCase();
4241
4242        return this.each(function () {
4243            $(this).alphanumeric($.extend({ nchars: az + aZ }, p));
4244        });
4245    };
4246
4247    $.fn.alpha = function (p) {
4248        var nm = '1234567890';
4249        return this.each(function () {
4250            $(this).alphanumeric($.extend({ nchars: nm }, p));
4251        });
4252    };
4253})(jQuery);
4254/* End */
4255;
4256; /* Start:"a:4:{s:4:"full";s:74:"/bitrix/templates/aspro-allcorp2/js/jquery.autocomplete.js?171828087332714";s:6:"source";s:58:"/bitrix/templates/aspro-allcorp2/js/jquery.autocomplete.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
4257/**
4258*  Ajax Autocomplete for jQuery, version %version%
4259*  (c) 2017 Tomas Kirda
4260*
4261*  Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
4262*  For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
4263*/
4264
4265/*jslint  browser: true, white: true, single: true, this: true, multivar: true */
4266/*global define, window, document, jQuery, exports, require */
4267
4268// Expose plugin as an AMD module if AMD loader is present:
4269(function (factory) {
4270    "use strict";
4271    if (typeof define === 'function' && define.amd) {
4272        // AMD. Register as an anonymous module.
4273        define(['jquery'], factory);
4274    } else if (typeof exports === 'object' && typeof require === 'function') {
4275        // Browserify
4276        factory(require('jquery'));
4277    } else {
4278        // Browser globals
4279        factory(jQuery);
4280    }
4281}(function ($) {
4282    'use strict';
4283
4284    var
4285        utils = (function () {
4286            return {
4287                escapeRegExChars: function (value) {
4288                    return value.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
4289                },
4290                createNode: function (containerClass) {
4291                    var div = document.createElement('div');
4292                    div.className = containerClass;
4293                    div.style.position = 'absolute';
4294                    div.style.display = 'none';
4295                    return div;
4296                }
4297            };
4298        }()),
4299
4300        keys = {
4301            ESC: 27,
4302            TAB: 9,
4303            RETURN: 13,
4304            LEFT: 37,
4305            UP: 38,
4306            RIGHT: 39,
4307            DOWN: 40
4308        },
4309
4310        noop = $.noop;
4311
4312    function Autocomplete(el, options) {
4313        var that = this;
4314
4315        // Shared variables:
4316        that.element = el;
4317        that.el = $(el);
4318        that.suggestions = [];
4319        that.badQueries = [];
4320        that.selectedIndex = -1;
4321        that.currentValue = that.element.value;
4322        that.timeoutId = null;
4323        that.cachedResponse = {};
4324        that.onChangeTimeout = null;
4325        that.onChange = null;
4326        that.isLocal = false;
4327        that.suggestionsContainer = null;
4328        that.noSuggestionsContainer = null;
4329        that.options = $.extend({}, Autocomplete.defaults, options);
4330        that.classes = {
4331            selected: 'autocomplete-selected',
4332            suggestion: 'autocomplete-suggestion'
4333        };
4334        that.hint = null;
4335        that.hintValue = '';
4336        that.selection = null;
4337
4338        // Initialize and set options:
4339        that.initialize();
4340        that.setOptions(options);
4341    }
4342
4343    Autocomplete.utils = utils;
4344
4345    $.Autocomplete = Autocomplete;
4346
4347    Autocomplete.defaults = {
4348            ajaxSettings: {},
4349            autoSelectFirst: false,
4350            appendTo: 'body',
4351            serviceUrl: null,
4352            lookup: null,
4353            onSelect: null,
4354            width: 'auto',
4355            minChars: 1,
4356            maxHeight: 300,
4357            deferRequestBy: 0,
4358            params: {},
4359            formatResult: _formatResult,
4360            formatGroup: _formatGroup,
4361            delimiter: null,
4362            zIndex: 9999,
4363            type: 'GET',
4364            noCache: false,
4365            onSearchStart: noop,
4366            onSearchComplete: noop,
4367            onSearchError: noop,
4368            preserveInput: false,
4369            containerClass: 'autocomplete-suggestions',
4370            tabDisabled: false,
4371            dataType: 'text',
4372            currentRequest: null,
4373            triggerSelectOnValidInput: true,
4374            preventBadQueries: true,
4375            lookupFilter: _lookupFilter,
4376            paramName: 'query',
4377            transformResult: _transformResult,
4378            showNoSuggestionNotice: false,
4379            noSuggestionNotice: 'No results',
4380            orientation: 'bottom',
4381            forceFixPosition: false
4382    };
4383
4384    function _lookupFilter(suggestion, originalQuery, queryLowerCase) {
4385        return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
4386    };
4387
4388    function _transformResult(response) {
4389        return typeof response === 'string' ? $.parseJSON(response) : response;
4390    };
4391
4392    function _formatResult(suggestion, currentValue) {
4393        // Do not replace anything if the current value is empty
4394        if (!currentValue) {
4395            return suggestion.value;
4396        }
4397        
4398        var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
4399
4400        return suggestion.value
4401            .replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>')
4402            .replace(/&/g, '&amp;')
4403            .replace(/</g, '&lt;')
4404            .replace(/>/g, '&gt;')
4405            .replace(/"/g, '&quot;')
4406            .replace(/&lt;(\/?strong)&gt;/g, '<$1>');
4407    };
4408
4409    function _formatGroup(suggestion, category) {
4410        return '<div class="autocomplete-group">' + category + '</div>';
4411    };
4412
4413    Autocomplete.prototype = {
4414
4415        initialize: function () {
4416            var that = this,
4417                suggestionSelector = '.' + that.classes.suggestion,
4418                selected = that.classes.selected,
4419                options = that.options,
4420                container;
4421
4422            // Remove autocomplete attribute to prevent native suggestions:
4423            that.element.setAttribute('autocomplete', 'off');
4424
4425            // html() deals with many types: htmlString or Element or Array or jQuery
4426            that.noSuggestionsContainer = $('<div class="autocomplete-no-suggestion"></div>')
4427                                          .html(this.options.noSuggestionNotice).get(0);
4428
4429            that.suggestionsContainer = Autocomplete.utils.createNode(options.containerClass);
4430
4431            container = $(that.suggestionsContainer);
4432
4433            container.appendTo(options.appendTo || 'body');
4434
4435            // Only set width if it was provided:
4436            if (options.width !== 'auto') {
4437                container.css('width', options.width);
4438            }
4439
4440            // Listen for mouse over event on suggestions list:
4441            container.on('mouseover.autocomplete', suggestionSelector, function () {
4442                that.activate($(this).data('index'));
4443            });
4444
4445            // Deselect active element when mouse leaves suggestions container:
4446            container.on('mouseout.autocomplete', function () {
4447                that.selectedIndex = -1;
4448                container.children('.' + selected).removeClass(selected);
4449            });
4450
4451
4452            // Listen for click event on suggestions list:
4453            container.on('click.autocomplete', suggestionSelector, function () {
4454                that.select($(this).data('index'));
4455            });
4456
4457            container.on('click.autocomplete', function () {
4458                clearTimeout(that.blurTimeoutId);
4459            })
4460
4461            that.fixPositionCapture = function () {
4462                if (that.visible) {
4463                    that.fixPosition();
4464                }
4465            };
4466
4467            $(window).on('resize.autocomplete', that.fixPositionCapture);
4468
4469            that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); });
4470            that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); });
4471            that.el.on('blur.autocomplete', function () { that.onBlur(); });
4472            that.el.on('focus.autocomplete', function () { that.onFocus(); });
4473            that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); });
4474            that.el.on('input.autocomplete', function (e) { that.onKeyUp(e); });
4475        },
4476
4477        onFocus: function () {
4478            var that = this;
4479
4480            that.fixPosition();
4481
4482            if (that.el.val().length >= that.options.minChars) {
4483                that.onValueChange();
4484            }
4485        },
4486
4487        onBlur: function () {
4488            var that = this;
4489
4490            // If user clicked on a suggestion, hide() will
4491            // be canceled, otherwise close suggestions
4492            that.blurTimeoutId = setTimeout(function () {
4493                that.hide();
4494            }, 200);
4495        },
4496        
4497        abortAjax: function () {
4498            var that = this;
4499            if (that.currentRequest) {
4500                that.currentRequest.abort();
4501                that.currentRequest = null;
4502            }
4503        },
4504
4505        setOptions: function (suppliedOptions) {
4506            var that = this,
4507                options = that.options;
4508
4509            this.options = $.extend({}, options, suppliedOptions);
4510
4511            that.isLocal = $.isArray(options.lookup);
4512
4513            if (that.isLocal) {
4514                options.lookup = that.verifySuggestionsFormat(options.lookup);
4515            }
4516
4517            options.orientation = that.validateOrientation(options.orientation, 'bottom');
4518
4519            // Adjust height, width and z-index:
4520            $(that.suggestionsContainer).css({
4521                'max-height': options.maxHeight + 'px',
4522                'width': options.width + 'px',
4523                'z-index': options.zIndex
4524            });
4525        },
4526
4527
4528        clearCache: function () {
4529            this.cachedResponse = {};
4530            this.badQueries = [];
4531        },
4532
4533        clear: function () {
4534            this.clearCache();
4535            this.currentValue = '';
4536            this.suggestions = [];
4537        },
4538
4539        disable: function () {
4540            var that = this;
4541            that.disabled = true;
4542            clearTimeout(that.onChangeTimeout);
4543            that.abortAjax();
4544        },
4545
4546        enable: function () {
4547            this.disabled = false;
4548        },
4549
4550        fixPosition: function () {
4551            // Use only when container has already its content
4552
4553            var that = this,
4554                $container = $(that.suggestionsContainer),
4555                containerParent = $container.parent().get(0);
4556            // Fix position automatically when appended to body.
4557            // In other cases force parameter must be given.
4558            if (containerParent !== document.body && !that.options.forceFixPosition) {
4559                return;
4560            }
4561
4562            // Choose orientation
4563            var orientation = that.options.orientation,
4564                containerHeight = $container.outerHeight(),
4565                height = that.el.outerHeight(),
4566                offset = that.el.offset(),
4567                styles = { 'top': offset.top, 'left': offset.left };
4568
4569            if (orientation === 'auto') {
4570                var viewPortHeight = $(window).height(),
4571                    scrollTop = $(window).scrollTop(),
4572                    topOverflow = -scrollTop + offset.top - containerHeight,
4573                    bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight);
4574
4575                orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom';
4576            }
4577
4578            if (orientation === 'top') {
4579                styles.top += -containerHeight;
4580            } else {
4581                styles.top += height;
4582            }
4583
4584            // If container is not positioned to body,
4585            // correct its position using offset parent offset
4586            if(containerParent !== document.body) {
4587                var opacity = $container.css('opacity'),
4588                    parentOffsetDiff;
4589
4590                    if (!that.visible){
4591                        $container.css('opacity', 0).show();
4592                    }
4593
4594                parentOffsetDiff = $container.offsetParent().offset();
4595                styles.top -= parentOffsetDiff.top;
4596                styles.left -= parentOffsetDiff.left;
4597
4598                if (!that.visible){
4599                    $container.css('opacity', opacity).hide();
4600                }
4601            }
4602
4603            if (that.options.width === 'auto') {
4604                styles.width = that.el.outerWidth() + 'px';
4605            }
4606
4607            $container.css(styles);
4608        },
4609
4610        isCursorAtEnd: function () {
4611            var that = this,
4612                valLength = that.el.val().length,
4613                selectionStart = that.element.selectionStart,
4614                range;
4615
4616            if (typeof selectionStart === 'number') {
4617                return selectionStart === valLength;
4618            }
4619            if (document.selection) {
4620                range = document.selection.createRange();
4621                range.moveStart('character', -valLength);
4622                return valLength === range.text.length;
4623            }
4624            return true;
4625        },
4626
4627        onKeyPress: function (e) {
4628            var that = this;
4629
4630            // If suggestions are hidden and user presses arrow down, display suggestions:
4631            if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) {
4632                that.suggest();
4633                return;
4634            }
4635
4636            if (that.disabled || !that.visible) {
4637                return;
4638            }
4639
4640            switch (e.which) {
4641                case keys.ESC:
4642                    that.el.val(that.currentValue);
4643                    that.hide();
4644                    break;
4645                case keys.RIGHT:
4646                    if (that.hint && that.options.onHint && that.isCursorAtEnd()) {
4647                        that.selectHint();
4648                        break;
4649                    }
4650                    return;
4651                case keys.TAB:
4652                    if (that.hint && that.options.onHint) {
4653                        that.selectHint();
4654                        return;
4655                    }
4656                    if (that.selectedIndex === -1) {
4657                        that.hide();
4658                        return;
4659                    }
4660                    that.select(that.selectedIndex);
4661                    if (that.options.tabDisabled === false) {
4662                        return;
4663                    }
4664                    break;
4665                case keys.RETURN:
4666                    if (that.selectedIndex === -1) {
4667                        that.hide();
4668                        return;
4669                    }
4670                    that.select(that.selectedIndex);
4671                    break;
4672                case keys.UP:
4673                    that.moveUp();
4674                    break;
4675                case keys.DOWN:
4676                    that.moveDown();
4677                    break;
4678                default:
4679                    return;
4680            }
4681
4682            // Cancel event if function did not return:
4683            e.stopImmediatePropagation();
4684            e.preventDefault();
4685        },
4686
4687        onKeyUp: function (e) {
4688            var that = this;
4689
4690            if (that.disabled) {
4691                return;
4692            }
4693
4694            switch (e.which) {
4695                case keys.UP:
4696                case keys.DOWN:
4697                    return;
4698            }
4699
4700            clearTimeout(that.onChangeTimeout);
4701
4702            if (that.currentValue !== that.el.val()) {
4703                that.findBestHint();
4704                if (that.options.deferRequestBy > 0) {
4705                    // Defer lookup in case when value changes very quickly:
4706                    that.onChangeTimeout = setTimeout(function () {
4707                        that.onValueChange();
4708                    }, that.options.deferRequestBy);
4709                } else {
4710                    that.onValueChange();
4711                }
4712            }
4713        },
4714
4715        onValueChange: function () {
4716            var that = this,
4717                options = that.options,
4718                value = that.el.val(),
4719                query = that.getQuery(value);
4720
4721            if (that.selection && that.currentValue !== query) {
4722                that.selection = null;
4723                (options.onInvalidateSelection || $.noop).call(that.element);
4724            }
4725
4726            clearTimeout(that.onChangeTimeout);
4727            that.currentValue = value;
4728            that.selectedIndex = -1;
4729
4730            // Check existing suggestion for the match before proceeding:
4731            if (options.triggerSelectOnValidInput && that.isExactMatch(query)) {
4732                that.select(0);
4733                return;
4734            }
4735
4736            if (query.length < options.minChars) {
4737                that.hide();
4738            } else {
4739                that.getSuggestions(query);
4740            }
4741        },
4742
4743        isExactMatch: function (query) {
4744            var suggestions = this.suggestions;
4745
4746            return (suggestions.length === 1 && suggestions[0].value.toLowerCase() === query.toLowerCase());
4747        },
4748
4749        getQuery: function (value) {
4750            var delimiter = this.options.delimiter,
4751                parts;
4752
4753            if (!delimiter) {
4754                return value;
4755            }
4756            parts = value.split(delimiter);
4757            return $.trim(parts[parts.length - 1]);
4758        },
4759
4760        getSuggestionsLocal: function (query) {
4761            var that = this,
4762                options = that.options,
4763                queryLowerCase = query.toLowerCase(),
4764                filter = options.lookupFilter,
4765                limit = parseInt(options.lookupLimit, 10),
4766                data;
4767
4768            data = {
4769                suggestions: $.grep(options.lookup, function (suggestion) {
4770                    return filter(suggestion, query, queryLowerCase);
4771                })
4772            };
4773
4774            if (limit && data.suggestions.length > limit) {
4775                data.suggestions = data.suggestions.slice(0, limit);
4776            }
4777
4778            return data;
4779        },
4780
4781        getSuggestions: function (q) {
4782            var response,
4783                that = this,
4784                options = that.options,
4785                serviceUrl = options.serviceUrl,
4786                params,
4787                cacheKey,
4788                ajaxSettings;
4789
4790            options.params[options.paramName] = q;
4791
4792            if (options.onSearchStart.call(that.element, options.params) === false) {
4793                return;
4794            }
4795
4796            params = options.ignoreParams ? null : options.params;
4797
4798            if ($.isFunction(options.lookup)){
4799                options.lookup(q, function (data) {
4800                    that.suggestions = data.suggestions;
4801                    that.suggest();
4802                    options.onSearchComplete.call(that.element, q, data.suggestions);
4803                });
4804                return;
4805            }
4806
4807            if (that.isLocal) {
4808                response = that.getSuggestionsLocal(q);
4809            } else {
4810                if ($.isFunction(serviceUrl)) {
4811                    serviceUrl = serviceUrl.call(that.element, q);
4812                }
4813                cacheKey = serviceUrl + '?' + $.param(params || {});
4814                response = that.cachedResponse[cacheKey];
4815            }
4816
4817            if (response && $.isArray(response.suggestions)) {
4818                that.suggestions = response.suggestions;
4819                that.suggest();
4820                options.onSearchComplete.call(that.element, q, response.suggestions);
4821            } else if (!that.isBadQuery(q)) {
4822                that.abortAjax();
4823
4824                ajaxSettings = {
4825                    url: serviceUrl,
4826                    data: params,
4827                    type: options.type,
4828                    dataType: options.dataType
4829                };
4830
4831                $.extend(ajaxSettings, options.ajaxSettings);
4832
4833                that.currentRequest = $.ajax(ajaxSettings).done(function (data) {
4834                    var result;
4835                    that.currentRequest = null;
4836                    result = options.transformResult(data, q);
4837                    that.processResponse(result, q, cacheKey);
4838                    options.onSearchComplete.call(that.element, q, result.suggestions);
4839                }).fail(function (jqXHR, textStatus, errorThrown) {
4840                    options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown);
4841                });
4842            } else {
4843                options.onSearchComplete.call(that.element, q, []);
4844            }
4845        },
4846
4847        isBadQuery: function (q) {
4848            if (!this.options.preventBadQueries){
4849                return false;
4850            }
4851
4852            var badQueries = this.badQueries,
4853                i = badQueries.length;
4854
4855            while (i--) {
4856                if (q.indexOf(badQueries[i]) === 0) {
4857                    return true;
4858                }
4859            }
4860
4861            return false;
4862        },
4863
4864        hide: function () {
4865            var that = this,
4866                container = $(that.suggestionsContainer);
4867
4868            if ($.isFunction(that.options.onHide) && that.visible) {
4869                that.options.onHide.call(that.element, container);
4870            }
4871
4872            that.visible = false;
4873            that.selectedIndex = -1;
4874            clearTimeout(that.onChangeTimeout);
4875            $(that.suggestionsContainer).hide();
4876            that.signalHint(null);
4877        },
4878
4879        suggest: function () {
4880            if (!this.suggestions.length) {
4881                if (this.options.showNoSuggestionNotice) {
4882                    this.noSuggestions();
4883                } else {
4884                    this.hide();
4885                }
4886                return;
4887            }
4888
4889            var that = this,
4890                options = that.options,
4891                groupBy = options.groupBy,
4892                formatResult = options.formatResult,
4893                value = that.getQuery(that.currentValue),
4894                className = that.classes.suggestion,
4895                classSelected = that.classes.selected,
4896                container = $(that.suggestionsContainer),
4897                noSuggestionsContainer = $(that.noSuggestionsContainer),
4898                beforeRender = options.beforeRender,
4899                html = '',
4900                category,
4901                formatGroup = function (suggestion, index) {
4902                        var currentCategory = suggestion.data[groupBy];
4903
4904                        if (category === currentCategory){
4905                            return '';
4906                        }
4907
4908                        category = currentCategory;
4909
4910                        return options.formatGroup(suggestion, category);
4911                    };
4912
4913            if (options.triggerSelectOnValidInput && that.isExactMatch(value)) {
4914                that.select(0);
4915                return;
4916            }
4917
4918            // Build suggestions inner HTML:
4919            $.each(that.suggestions, function (i, suggestion) {
4920                if (groupBy){
4921                    html += formatGroup(suggestion, value, i);
4922                }
4923
4924                html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value, i) + '</div>';
4925            });
4926
4927            this.adjustContainerWidth();
4928
4929            noSuggestionsContainer.detach();
4930            container.html(html);
4931
4932            if ($.isFunction(beforeRender)) {
4933                beforeRender.call(that.element, container, that.suggestions);
4934            }
4935
4936            that.fixPosition();
4937            container.show();
4938
4939            // Select first value by default:
4940            if (options.autoSelectFirst) {
4941                that.selectedIndex = 0;
4942                container.scrollTop(0);
4943                container.children('.' + className).first().addClass(classSelected);
4944            }
4945
4946            that.visible = true;
4947            that.findBestHint();
4948        },
4949
4950        noSuggestions: function() {
4951             var that = this,
4952                 beforeRender = that.options.beforeRender,
4953                 container = $(that.suggestionsContainer),
4954                 noSuggestionsContainer = $(that.noSuggestionsContainer);
4955
4956            this.adjustContainerWidth();
4957
4958            // Some explicit steps. Be careful here as it easy to get
4959            // noSuggestionsContainer removed from DOM if not detached properly.
4960            noSuggestionsContainer.detach();
4961
4962            // clean suggestions if any
4963            container.empty(); 
4964            container.append(noSuggestionsContainer);
4965
4966            if ($.isFunction(beforeRender)) {
4967                beforeRender.call(that.element, container, that.suggestions);
4968            }
4969
4970            that.fixPosition();
4971
4972            container.show();
4973            that.visible = true;
4974        },
4975
4976        adjustContainerWidth: function() {
4977            var that = this,
4978                options = that.options,
4979                width,
4980                container = $(that.suggestionsContainer);
4981
4982            // If width is auto, adjust width before displaying suggestions,
4983            // because if instance was created before input had width, it will be zero.
4984            // Also it adjusts if input width has changed.
4985            if (options.width === 'auto') {
4986                width = that.el.outerWidth();
4987                container.css('width', width > 0 ? width : 300);
4988            } else if(options.width === 'flex') {
4989                // Trust the source! Unset the width property so it will be the max length
4990                // the containing elements.
4991                container.css('width', '');
4992            }
4993        },
4994
4995        findBestHint: function () {
4996            var that = this,
4997                value = that.el.val().toLowerCase(),
4998                bestMatch = null;
4999
5000            if (!value) {
5001                return;
5002            }
5003
5004            $.each(that.suggestions, function (i, suggestion) {
5005                var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0;
5006                if (foundMatch) {
5007                    bestMatch = suggestion;
5008                }
5009                return !foundMatch;
5010            });
5011
5012            that.signalHint(bestMatch);
5013        },
5014
5015        signalHint: function (suggestion) {
5016            var hintValue = '',
5017                that = this;
5018            if (suggestion) {
5019                hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
5020            }
5021            if (that.hintValue !== hintValue) {
5022                that.hintValue = hintValue;
5023                that.hint = suggestion;
5024                (this.options.onHint || $.noop)(hintValue);
5025            }
5026        },
5027
5028        verifySuggestionsFormat: function (suggestions) {
5029            // If suggestions is string array, convert them to supported format:
5030            if (suggestions.length && typeof suggestions[0] === 'string') {
5031                return $.map(suggestions, function (value) {
5032                    return { value: value, data: null };
5033                });
5034            }
5035
5036            return suggestions;
5037        },
5038
5039        validateOrientation: function(orientation, fallback) {
5040            orientation = $.trim(orientation || '').toLowerCase();
5041
5042            if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){
5043                orientation = fallback;
5044            }
5045
5046            return orientation;
5047        },
5048
5049        processResponse: function (result, originalQuery, cacheKey) {
5050            var that = this,
5051                options = that.options;
5052
5053            result.suggestions = that.verifySuggestionsFormat(result.suggestions);
5054
5055            // Cache results if cache is not disabled:
5056            if (!options.noCache) {
5057                that.cachedResponse[cacheKey] = result;
5058                if (options.preventBadQueries && !result.suggestions.length) {
5059                    that.badQueries.push(originalQuery);
5060                }
5061            }
5062
5063            // Return if originalQuery is not matching current query:
5064            if (originalQuery !== that.getQuery(that.currentValue)) {
5065                return;
5066            }
5067
5068            that.suggestions = result.suggestions;
5069            that.suggest();
5070        },
5071
5072        activate: function (index) {
5073            var that = this,
5074                activeItem,
5075                selected = that.classes.selected,
5076                container = $(that.suggestionsContainer),
5077                children = container.find('.' + that.classes.suggestion);
5078
5079            container.find('.' + selected).removeClass(selected);
5080
5081            that.selectedIndex = index;
5082
5083            if (that.selectedIndex !== -1 && children.length > that.selectedIndex) {
5084                activeItem = children.get(that.selectedIndex);
5085                $(activeItem).addClass(selected);
5086                return activeItem;
5087            }
5088
5089            return null;
5090        },
5091
5092        selectHint: function () {
5093            var that = this,
5094                i = $.inArray(that.hint, that.suggestions);
5095
5096            that.select(i);
5097        },
5098
5099        select: function (i) {
5100            var that = this;
5101            that.hide();
5102            that.onSelect(i);
5103        },
5104
5105        moveUp: function () {
5106            var that = this;
5107
5108            if (that.selectedIndex === -1) {
5109                return;
5110            }
5111
5112            if (that.selectedIndex === 0) {
5113                $(that.suggestionsContainer).children().first().removeClass(that.classes.selected);
5114                that.selectedIndex = -1;
5115                that.el.val(that.currentValue);
5116                that.findBestHint();
5117                return;
5118            }
5119
5120            that.adjustScroll(that.selectedIndex - 1);
5121        },
5122
5123        moveDown: function () {
5124            var that = this;
5125
5126            if (that.selectedIndex === (that.suggestions.length - 1)) {
5127                return;
5128            }
5129
5130            that.adjustScroll(that.selectedIndex + 1);
5131        },
5132
5133        adjustScroll: function (index) {
5134            var that = this,
5135                activeItem = that.activate(index);
5136
5137            if (!activeItem) {
5138                return;
5139            }
5140
5141            var offsetTop,
5142                upperBound,
5143                lowerBound,
5144                heightDelta = $(activeItem).outerHeight();
5145
5146            offsetTop = activeItem.offsetTop;
5147            upperBound = $(that.suggestionsContainer).scrollTop();
5148            lowerBound = upperBound + that.options.maxHeight - heightDelta;
5149
5150            if (offsetTop < upperBound) {
5151                $(that.suggestionsContainer).scrollTop(offsetTop);
5152            } else if (offsetTop > lowerBound) {
5153                $(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta);
5154            }
5155
5156            if (!that.options.preserveInput) {
5157                that.el.val(that.getValue(that.suggestions[index].value));
5158            }
5159            that.signalHint(null);
5160        },
5161
5162        onSelect: function (index) {
5163            var that = this,
5164                onSelectCallback = that.options.onSelect,
5165                suggestion = that.suggestions[index];
5166
5167            that.currentValue = that.getValue(suggestion.value);
5168
5169            if (that.currentValue !== that.el.val() && !that.options.preserveInput) {
5170                that.el.val(that.currentValue);
5171            }
5172
5173            that.signalHint(null);
5174            that.suggestions = [];
5175            that.selection = suggestion;
5176
5177            if ($.isFunction(onSelectCallback)) {
5178                onSelectCallback.call(that.element, suggestion);
5179            }
5180        },
5181
5182        getValue: function (value) {
5183            var that = this,
5184                delimiter = that.options.delimiter,
5185                currentValue,
5186                parts;
5187
5188            if (!delimiter) {
5189                return value;
5190            }
5191
5192            currentValue = that.currentValue;
5193            parts = currentValue.split(delimiter);
5194
5195            if (parts.length === 1) {
5196                return value;
5197            }
5198
5199            return currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + value;
5200        },
5201
5202        dispose: function () {
5203            var that = this;
5204            that.el.off('.autocomplete').removeData('autocomplete');
5205            $(window).off('resize.autocomplete', that.fixPositionCapture);
5206            $(that.suggestionsContainer).remove();
5207        }
5208    };
5209
5210    // Create chainable jQuery plugin:
5211    $.fn.devbridgeAutocomplete = function (options, args) {
5212        var dataKey = 'autocomplete';
5213        // If function invoked without argument return
5214        // instance of the first matched element:
5215        if (!arguments.length) {
5216            return this.first().data(dataKey);
5217        }
5218
5219        return this.each(function () {
5220            var inputElement = $(this),
5221                instance = inputElement.data(dataKey);
5222
5223            if (typeof options === 'string') {
5224                if (instance && typeof instance[options] === 'function') {
5225                    instance[options](args);
5226                }
5227            } else {
5228                // If instance already exists, destroy it:
5229                if (instance && instance.dispose) {
5230                    instance.dispose();
5231                }
5232                instance = new Autocomplete(this, options);
5233                inputElement.data(dataKey, instance);
5234            }
5235        });
5236    };
5237
5238    // Don't overwrite if it already exists
5239    if (!$.fn.autocomplete) {
5240        $.fn.autocomplete = $.fn.devbridgeAutocomplete;
5241    }
5242}));
5243
5244/* End */
5245;
5246; /* Start:"a:4:{s:4:"full";s:75:"/bitrix/templates/aspro-allcorp2/js/jquery.mousewheel.min.js?17182808732609";s:6:"source";
vendor: 5,487 bytes, lines 5246-5311
5246s:60:"/bitrix/templates/aspro-allcorp2/js/jquery.mousewheel.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
5247!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
5248/* End */
5249;
5250; /* Start:"a:4:{s:4:"full";s:78:"/bitrix/templates/aspro-allcorp2/js/jquery.mCustomScrollbar.js?171828087392949";s:6:"source";s:62:"/bitrix/templates/aspro-allcorp2/js/jquery.mCustomScrollbar.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
5251/*
5252== malihu jquery custom scrollbar plugin == 
5253Version: 3.1.5 
5254Plugin URI: http://manos.malihu.gr/jquery-custom-content-scroller 
5255Author: malihu
5256Author URI: http://manos.malihu.gr
5257License: MIT License (MIT)
5258*/
5259
5260/*
5261Copyright Manos Malihutsakis (email: [email protected])
5262
5263Permission is hereby granted, free of charge, to any person obtaining a copy
5264of this software and associated documentation files (the "Software"), to deal
5265in the Software without restriction, including without limitation the rights
5266to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5267copies of the Software, and to permit persons to whom the Software is
5268furnished to do so, subject to the following conditions:
5269
5270The above copyright notice and this permission notice shall be included in
5271all copies or substantial portions of the Software.
5272
5273THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5274IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5275FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5276AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5277LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5278OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5279THE SOFTWARE.
5280*/
5281
5282/*
5283The code below is fairly long, fully commented and should be normally used in development. 
5284For production, use either the minified jquery.mCustomScrollbar.min.js script or 
5285the production-ready jquery.mCustomScrollbar.concat.min.js which contains the plugin 
5286and dependencies (minified). 
5287*/
5288
5289(function(factory){
5290	if(typeof define==="function" && define.amd){
5291		define(["jquery"],factory);
5292	}else if(typeof module!=="undefined" && module.exports){
5293		module.exports=factory;
5294	}else{
5295		factory(jQuery,window,document);
5296	}
5297}(function($){
5298(function(init){
5299	var _rjs=typeof define==="function" && define.amd, /* RequireJS */
5300		_njs=typeof module !== "undefined" && module.exports, /* NodeJS */
5301		_dlp=("https:"==document.location.protocol) ? "https:" : "http:", /* location protocol */
5302		_url="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js";
5303	if(!_rjs){
5304		if(_njs){
5305			require("jquery-mousewheel")($);
5306		}else{
5307			/* load jquery-mousewheel plugin (via CDN) if it's not present or not loaded via RequireJS 
5308			(works when mCustomScrollbar fn is called on window load) */
5309			$.event.special.mousewheel || $("head").append(decodeURI("%3Cscript src="+_dlp+"//"+_url+"%3E%3C/script%3E"));
5310		}
5311	}
vendor: 12,508 bytes, lines 5312-5719
5312	init();
5313}(function(){
5314	
5315	/* 
5316	----------------------------------------
5317	PLUGIN NAMESPACE, PREFIX, DEFAULT SELECTOR(S) 
5318	----------------------------------------
5319	*/
5320	
5321	var pluginNS="mCustomScrollbar",
5322		pluginPfx="mCS",
5323		defaultSelector=".mCustomScrollbar",
5324	
5325	
5326		
5327	
5328	
5329	/* 
5330	----------------------------------------
5331	DEFAULT OPTIONS 
5332	----------------------------------------
5333	*/
5334	
5335		defaults={
5336			/*
5337			set element/content width/height programmatically 
5338			values: boolean, pixels, percentage 
5339				option						default
5340				-------------------------------------
5341				setWidth					false
5342				setHeight					false
5343			*/
5344			/*
5345			set the initial css top property of content  
5346			values: string (e.g. "-100px", "10%" etc.)
5347			*/
5348			setTop:0,
5349			/*
5350			set the initial css left property of content  
5351			values: string (e.g. "-100px", "10%" etc.)
5352			*/
5353			setLeft:0,
5354			/* 
5355			scrollbar axis (vertical and/or horizontal scrollbars) 
5356			values (string): "y", "x", "yx"
5357			*/
5358			axis:"y",
5359			/*
5360			position of scrollbar relative to content  
5361			values (string): "inside", "outside" ("outside" requires elements with position:relative)
5362			*/
5363			scrollbarPosition:"inside",
5364			/*
5365			scrolling inertia
5366			values: integer (milliseconds)
5367			*/
5368			scrollInertia:100,
5369			/* 
5370			auto-adjust scrollbar dragger length
5371			values: boolean
5372			*/
5373			autoDraggerLength:true,
5374			/*
5375			auto-hide scrollbar when idle 
5376			values: boolean
5377				option						default
5378				-------------------------------------
5379				autoHideScrollbar			false
5380			*/
5381			/*
5382			auto-expands scrollbar on mouse-over and dragging
5383			values: boolean
5384				option						default
5385				-------------------------------------
5386				autoExpandScrollbar			false
5387			*/
5388			/*
5389			always show scrollbar, even when there's nothing to scroll 
5390			values: integer (0=disable, 1=always show dragger rail and buttons, 2=always show dragger rail, dragger and buttons), boolean
5391			*/
5392			alwaysShowScrollbar:0,
5393			/*
5394			scrolling always snaps to a multiple of this number in pixels
5395			values: integer, array ([y,x])
5396				option						default
5397				-------------------------------------
5398				snapAmount					null
5399			*/
5400			/*
5401			when snapping, snap with this number in pixels as an offset 
5402			values: integer
5403			*/
5404			snapOffset:0,
5405			/* 
5406			mouse-wheel scrolling
5407			*/
5408			mouseWheel:{
5409				/* 
5410				enable mouse-wheel scrolling
5411				values: boolean
5412				*/
5413				enable:true,
5414				/* 
5415				scrolling amount in pixels
5416				values: "auto", integer 
5417				*/
5418				scrollAmount:"auto",
5419				/* 
5420				mouse-wheel scrolling axis 
5421				the default scrolling direction when both vertical and horizontal scrollbars are present 
5422				values (string): "y", "x" 
5423				*/
5424				axis:"y",
5425				/* 
5426				prevent the default behaviour which automatically scrolls the parent element(s) when end of scrolling is reached 
5427				values: boolean
5428					option						default
5429					-------------------------------------
5430					preventDefault				null
5431				*/
5432				/*
5433				the reported mouse-wheel delta value. The number of lines (translated to pixels) one wheel notch scrolls.  
5434				values: "auto", integer 
5435				"auto" uses the default OS/browser value 
5436				*/
5437				deltaFactor:"auto",
5438				/*
5439				normalize mouse-wheel delta to -1 or 1 (disables mouse-wheel acceleration) 
5440				values: boolean
5441					option						default
5442					-------------------------------------
5443					normalizeDelta				null
5444				*/
5445				/*
5446				invert mouse-wheel scrolling direction 
5447				values: boolean
5448					option						default
5449					-------------------------------------
5450					invert						null
5451				*/
5452				/*
5453				the tags that disable mouse-wheel when cursor is over them
5454				*/
5455				disableOver:["select","option","keygen","datalist","textarea"]
5456			},
5457			/* 
5458			scrollbar buttons
5459			*/
5460			scrollButtons:{ 
5461				/*
5462				enable scrollbar buttons
5463				values: boolean
5464					option						default
5465					-------------------------------------
5466					enable						null
5467				*/
5468				/*
5469				scrollbar buttons scrolling type 
5470				values (string): "stepless", "stepped"
5471				*/
5472				scrollType:"stepless",
5473				/*
5474				scrolling amount in pixels
5475				values: "auto", integer 
5476				*/
5477				scrollAmount:"auto"
5478				/*
5479				tabindex of the scrollbar buttons
5480				values: false, integer
5481					option						default
5482					-------------------------------------
5483					tabindex					null
5484				*/
5485			},
5486			/* 
5487			keyboard scrolling
5488			*/
5489			keyboard:{ 
5490				/*
5491				enable scrolling via keyboard
5492				values: boolean
5493				*/
5494				enable:true,
5495				/*
5496				keyboard scrolling type 
5497				values (string): "stepless", "stepped"
5498				*/
5499				scrollType:"stepless",
5500				/*
5501				scrolling amount in pixels
5502				values: "auto", integer 
5503				*/
5504				scrollAmount:"auto"
5505			},
5506			/*
5507			enable content touch-swipe scrolling 
5508			values: boolean, integer, string (number)
5509			integer values define the axis-specific minimum amount required for scrolling momentum
5510			*/
5511			contentTouchScroll:25,
5512			/*
5513			enable/disable document (default) touch-swipe scrolling 
5514			*/
5515			documentTouchScroll:true,
5516			/*
5517			advanced option parameters
5518			*/
5519			advanced:{
5520				/*
5521				auto-expand content horizontally (for "x" or "yx" axis) 
5522				values: boolean, integer (the value 2 forces the non scrollHeight/scrollWidth method, the value 3 forces the scrollHeight/scrollWidth method)
5523					option						default
5524					-------------------------------------
5525					autoExpandHorizontalScroll	null
5526				*/
5527				/*
5528				auto-scroll to elements with focus
5529				*/
5530				autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",
5531				/*
5532				auto-update scrollbars on content, element or viewport resize 
5533				should be true for fluid layouts/elements, adding/removing content dynamically, hiding/showing elements, content with images etc. 
5534				values: boolean
5535				*/
5536				updateOnContentResize:true,
5537				/*
5538				auto-update scrollbars each time each image inside the element is fully loaded 
5539				values: "auto", boolean
5540				*/
5541				updateOnImageLoad:"auto",
5542				/*
5543				auto-update scrollbars based on the amount and size changes of specific selectors 
5544				useful when you need to update the scrollbar(s) automatically, each time a type of element is added, removed or changes its size 
5545				values: boolean, string (e.g. "ul li" will auto-update scrollbars each time list-items inside the element are changed) 
5546				a value of true (boolean) will auto-update scrollbars each time any element is changed
5547					option						default
5548					-------------------------------------
5549					updateOnSelectorChange		null
5550				*/
5551				/*
5552				extra selectors that'll allow scrollbar dragging upon mousemove/up, pointermove/up, touchend etc. (e.g. "selector-1, selector-2")
5553					option						default
5554					-------------------------------------
5555					extraDraggableSelectors		null
5556				*/
5557				/*
5558				extra selectors that'll release scrollbar dragging upon mouseup, pointerup, touchend etc. (e.g. "selector-1, selector-2")
5559					option						default
5560					-------------------------------------
5561					releaseDraggableSelectors	null
5562				*/
5563				/*
5564				auto-update timeout 
5565				values: integer (milliseconds)
5566				*/
5567				autoUpdateTimeout:60
5568			},
5569			/* 
5570			scrollbar theme 
5571			values: string (see CSS/plugin URI for a list of ready-to-use themes)
5572			*/
5573			theme:"light",
5574			/*
5575			user defined callback functions
5576			*/
5577			callbacks:{
5578				/*
5579				Available callbacks: 
5580					callback					default
5581					-------------------------------------
5582					onCreate					null
5583					onInit						null
5584					onScrollStart				null
5585					onScroll					null
5586					onTotalScroll				null
5587					onTotalScrollBack			null
5588					whileScrolling				null
5589					onOverflowY					null
5590					onOverflowX					null
5591					onOverflowYNone				null
5592					onOverflowXNone				null
5593					onImageLoad					null
5594					onSelectorChange			null
5595					onBeforeUpdate				null
5596					onUpdate					null
5597				*/
5598				onTotalScrollOffset:0,
5599				onTotalScrollBackOffset:0,
5600				alwaysTriggerOffsets:true
5601			}
5602			/*
5603			add scrollbar(s) on all elements matching the current selector, now and in the future 
5604			values: boolean, string 
5605			string values: "on" (enable), "once" (disable after first invocation), "off" (disable)
5606			liveSelector values: string (selector)
5607				option						default
5608				-------------------------------------
5609				live						false
5610				liveSelector				null
5611			*/
5612		},
5613	
5614	
5615	
5616	
5617	
5618	/* 
5619	----------------------------------------
5620	VARS, CONSTANTS 
5621	----------------------------------------
5622	*/
5623	
5624		totalInstances=0, /* plugin instances amount */
5625		liveTimers={}, /* live option timers */
5626		oldIE=(window.attachEvent && !window.addEventListener) ? 1 : 0, /* detect IE < 9 */
5627		touchActive=false,touchable, /* global touch vars (for touch and pointer events) */
5628		/* general plugin classes */
5629		classes=[
5630			"mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar",
5631			"mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer",
5632			"mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft","mCSB_buttonRight"
5633		],
5634		
5635	
5636	
5637	
5638	
5639	/* 
5640	----------------------------------------
5641	METHODS 
5642	----------------------------------------
5643	*/
5644	
5645		methods={
5646			
5647			/* 
5648			plugin initialization method 
5649			creates the scrollbar(s), plugin data object and options
5650			----------------------------------------
5651			*/
5652			
5653			init:function(options){
5654				
5655				var options=$.extend(true,{},defaults,options),
5656					selector=_selector.call(this); /* validate selector */
5657				
5658				/* 
5659				if live option is enabled, monitor for elements matching the current selector and 
5660				apply scrollbar(s) when found (now and in the future) 
5661				*/
5662				if(options.live){
5663					var liveSelector=options.liveSelector || this.selector || defaultSelector, /* live selector(s) */
5664						$liveSelector=$(liveSelector); /* live selector(s) as jquery object */
5665					if(options.live==="off"){
5666						/* 
5667						disable live if requested 
5668						usage: $(selector).mCustomScrollbar({live:"off"}); 
5669						*/
5670						removeLiveTimers(liveSelector);
5671						return;
5672					}
5673					liveTimers[liveSelector]=setTimeout(function(){
5674						/* call mCustomScrollbar fn on live selector(s) every half-second */
5675						$liveSelector.mCustomScrollbar(options);
5676						if(options.live==="once" && $liveSelector.length){
5677							/* disable live after first invocation */
5678							removeLiveTimers(liveSelector);
5679						}
5680					},500);
5681				}else{
5682					removeLiveTimers(liveSelector);
5683				}
5684				
5685				/* options backward compatibility (for versions < 3.0.0) and normalization */
5686				options.setWidth=(options.set_width) ? options.set_width : options.setWidth;
5687				options.setHeight=(options.set_height) ? options.set_height : options.setHeight;
5688				options.axis=(options.horizontalScroll) ? "x" : _findAxis(options.axis);
5689				options.scrollInertia=options.scrollInertia>0 && options.scrollInertia<17 ? 17 : options.scrollInertia;
5690				if(typeof options.mouseWheel!=="object" &&  options.mouseWheel==true){ /* old school mouseWheel option (non-object) */
5691					options.mouseWheel={enable:true,scrollAmount:"auto",axis:"y",preventDefault:false,deltaFactor:"auto",normalizeDelta:false,invert:false}
5692				}
5693				options.mouseWheel.scrollAmount=!options.mouseWheelPixels ? options.mouseWheel.scrollAmount : options.mouseWheelPixels;
5694				options.mouseWheel.normalizeDelta=!options.advanced.normalizeMouseWheelDelta ? options.mouseWheel.normalizeDelta : options.advanced.normalizeMouseWheelDelta;
5695				options.scrollButtons.scrollType=_findScrollButtonsType(options.scrollButtons.scrollType); 
5696				
5697				_theme(options); /* theme-specific options */
5698				
5699				/* plugin constructor */
5700				return $(selector).each(function(){
5701					
5702					var $this=$(this);
5703					
5704					if(!$this.data(pluginPfx)){ /* prevent multiple instantiations */
5705					
5706						/* store options and create objects in jquery data */
5707						$this.data(pluginPfx,{
5708							idx:++totalInstances, /* instance index */
5709							opt:options, /* options */
5710							scrollRatio:{y:null,x:null}, /* scrollbar to content ratio */
5711							overflowed:null, /* overflowed axis */
5712							contentReset:{y:null,x:null}, /* object to check when content resets */
5713							bindEvents:false, /* object to check if events are bound */
5714							tweenRunning:false, /* object to check if tween is running */
5715							sequential:{}, /* sequential scrolling object */
5716							langDir:$this.css("direction"), /* detect/store direction (ltr or rtl) */
5717							cbOffsets:null, /* object to check whether callback offsets always trigger */
5718							/* 
5719							object to check how scrolling events where last triggered 
5720							"internal" (default - triggered by this script), "external" (triggered by other scripts, e.g. via scrollTo method) 
5721							usage: object.data("mCS").trigger
5722							*/
5723							trigger:null,
5724							/* 
5725							object to check for changes in elements in order to call the update method automatically 
5726							*/
5727							poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}
5728						});
5729						
5730						var d=$this.data(pluginPfx),o=d.opt,
5731							/* HTML data attributes */
5732							htmlDataAxis=$this.data("mcs-axis"),htmlDataSbPos=$this.data("mcs-scrollbar-position"),htmlDataTheme=$this.data("mcs-theme");
5733						 
5734						if(htmlDataAxis){o.axis=htmlDataAxis;} /* usage example: data-mcs-axis="y" */
5735						if(htmlDataSbPos){o.scrollbarPosition=htmlDataSbPos;} /* usage example: data-mcs-scrollbar-position="outside" */
5736						if(htmlDataTheme){ /* usage example: data-mcs-theme="minimal" */
5737							o.theme=htmlDataTheme;
5738							_theme(o); /* theme-specific options */
5739						}
5740						
5741						_pluginMarkup.call(this); /* add plugin markup */
5742						
5743						if(d && o.callbacks.onCreate && typeof o.callbacks.onCreate==="function"){o.callbacks.onCreate.call(this);} /* callbacks: onCreate */
5744						
5745						$("#mCSB_"+d.idx+"_container img:not(."+classes[2]+")").addClass(classe
vendor: 73,065 bytes, lines 5745-7612
5745s[2]); /* flag loaded images */
5746						
5747						methods.update.call(null,$this); /* call the update method */
5748					
5749					}
5750					
5751				});
5752				
5753			},
5754			/* ---------------------------------------- */
5755			
5756			
5757			
5758			/* 
5759			plugin update method 
5760			updates content and scrollbar(s) values, events and status 
5761			----------------------------------------
5762			usage: $(selector).mCustomScrollbar("update");
5763			*/
5764			
5765			update:function(el,cb){
5766				
5767				var selector=el || _selector.call(this); /* validate selector */
5768				
5769				return $(selector).each(function(){
5770					
5771					var $this=$(this);
5772					
5773					if($this.data(pluginPfx)){ /* check if plugin has initialized */
5774						
5775						var d=$this.data(pluginPfx),o=d.opt,
5776							mCSB_container=$("#mCSB_"+d.idx+"_container"),
5777							mCustomScrollBox=$("#mCSB_"+d.idx),
5778							mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
5779						
5780						if(!mCSB_container.length){return;}
5781						
5782						if(d.tweenRunning){_stop($this);} /* stop any running tweens while updating */
5783						
5784						if(cb && d && o.callbacks.onBeforeUpdate && typeof o.callbacks.onBeforeUpdate==="function"){o.callbacks.onBeforeUpdate.call(this);} /* callbacks: onBeforeUpdate */
5785						
5786						/* if element was disabled or destroyed, remove class(es) */
5787						if($this.hasClass(classes[3])){$this.removeClass(classes[3]);}
5788						if($this.hasClass(classes[4])){$this.removeClass(classes[4]);}
5789						
5790						/* css flexbox fix, detect/set max-height */
5791						mCustomScrollBox.css("max-height","none");
5792						if(mCustomScrollBox.height()!==$this.height()){mCustomScrollBox.css("max-height",$this.height());}
5793						
5794						_expandContentHorizontally.call(this); /* expand content horizontally */
5795						
5796						if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){
5797							mCSB_container.css("width",_contentWidth(mCSB_container));
5798						}
5799						
5800						d.overflowed=_overflowed.call(this); /* determine if scrolling is required */
5801						
5802						_scrollbarVisibility.call(this); /* show/hide scrollbar(s) */
5803						
5804						/* auto-adjust scrollbar dragger length analogous to content */
5805						if(o.autoDraggerLength){_setDraggerLength.call(this);}
5806						
5807						_scrollRatio.call(this); /* calculate and store scrollbar to content ratio */
5808						
5809						_bindEvents.call(this); /* bind scrollbar events */
5810						
5811						/* reset scrolling position and/or events */
5812						var to=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)];
5813						if(o.axis!=="x"){ /* y/yx axis */
5814							if(!d.overflowed[0]){ /* y scrolling is not required */
5815								_resetContentPosition.call(this); /* reset content position */
5816								if(o.axis==="y"){
5817									_unbindEvents.call(this);
5818								}else if(o.axis==="yx" && d.overflowed[1]){
5819									_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
5820								}
5821							}else if(mCSB_dragger[0].height()>mCSB_dragger[0].parent().height()){
5822								_resetContentPosition.call(this); /* reset content position */
5823							}else{ /* y scrolling is required */
5824								_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
5825								d.contentReset.y=null;
5826							}
5827						}
5828						if(o.axis!=="y"){ /* x/yx axis */
5829							if(!d.overflowed[1]){ /* x scrolling is not required */
5830								_resetContentPosition.call(this); /* reset content position */
5831								if(o.axis==="x"){
5832									_unbindEvents.call(this);
5833								}else if(o.axis==="yx" && d.overflowed[0]){
5834									_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
5835								}
5836							}else if(mCSB_dragger[1].width()>mCSB_dragger[1].parent().width()){
5837								_resetContentPosition.call(this); /* reset content position */
5838							}else{ /* x scrolling is required */
5839								_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
5840								d.contentReset.x=null;
5841							}
5842						}
5843						
5844						/* callbacks: onImageLoad, onSelectorChange, onUpdate */
5845						if(cb && d){
5846							if(cb===2 && o.callbacks.onImageLoad && typeof o.callbacks.onImageLoad==="function"){
5847								o.callbacks.onImageLoad.call(this);
5848							}else if(cb===3 && o.callbacks.onSelectorChange && typeof o.callbacks.onSelectorChange==="function"){
5849								o.callbacks.onSelectorChange.call(this);
5850							}else if(o.callbacks.onUpdate && typeof o.callbacks.onUpdate==="function"){
5851								o.callbacks.onUpdate.call(this);
5852							}
5853						}
5854						
5855						_autoUpdate.call(this); /* initialize automatic updating (for dynamic content, fluid layouts etc.) */
5856						
5857					}
5858					
5859				});
5860				
5861			},
5862			/* ---------------------------------------- */
5863			
5864			
5865			
5866			/* 
5867			plugin scrollTo method 
5868			triggers a scrolling event to a specific value
5869			----------------------------------------
5870			usage: $(selector).mCustomScrollbar("scrollTo",value,options);
5871			*/
5872		
5873			scrollTo:function(val,options){
5874				
5875				/* prevent silly things like $(selector).mCustomScrollbar("scrollTo",undefined); */
5876				if(typeof val=="undefined" || val==null){return;}
5877				
5878				var selector=_selector.call(this); /* validate selector */
5879				
5880				return $(selector).each(function(){
5881					
5882					var $this=$(this);
5883					
5884					if($this.data(pluginPfx)){ /* check if plugin has initialized */
5885					
5886						var d=$this.data(pluginPfx),o=d.opt,
5887							/* method default options */
5888							methodDefaults={
5889								trigger:"external", /* method is by default triggered externally (e.g. from other scripts) */
5890								scrollInertia:o.scrollInertia, /* scrolling inertia (animation duration) */
5891								scrollEasing:"mcsEaseInOut", /* animation easing */
5892								moveDragger:false, /* move dragger instead of content */
5893								timeout:60, /* scroll-to delay */
5894								callbacks:true, /* enable/disable callbacks */
5895								onStart:true,
5896								onUpdate:true,
5897								onComplete:true
5898							},
5899							methodOptions=$.extend(true,{},methodDefaults,options),
5900							to=_arr.call(this,val),dur=methodOptions.scrollInertia>0 && methodOptions.scrollInertia<17 ? 17 : methodOptions.scrollInertia;
5901						
5902						/* translate yx values to actual scroll-to positions */
5903						to[0]=_to.call(this,to[0],"y");
5904						to[1]=_to.call(this,to[1],"x");
5905						
5906						/* 
5907						check if scroll-to value moves the dragger instead of content. 
5908						Only pixel values apply on dragger (e.g. 100, "100px", "-=100" etc.) 
5909						*/
5910						if(methodOptions.moveDragger){
5911							to[0]*=d.scrollRatio.y;
5912							to[1]*=d.scrollRatio.x;
5913						}
5914						
5915						methodOptions.dur=_isTabHidden() ? 0 : dur; //skip animations if browser tab is hidden
5916						
5917						setTimeout(function(){ 
5918							/* do the scrolling */
5919							if(to[0]!==null && typeof to[0]!=="undefined" && o.axis!=="x" && d.overflowed[0]){ /* scroll y */
5920								methodOptions.dir="y";
5921								methodOptions.overwrite="all";
5922								_scrollTo($this,to[0].toString(),methodOptions);
5923							}
5924							if(to[1]!==null && typeof to[1]!=="undefined" && o.axis!=="y" && d.overflowed[1]){ /* scroll x */
5925								methodOptions.dir="x";
5926								methodOptions.overwrite="none";
5927								_scrollTo($this,to[1].toString(),methodOptions);
5928							}
5929						},methodOptions.timeout);
5930						
5931					}
5932					
5933				});
5934				
5935			},
5936			/* ---------------------------------------- */
5937			
5938			
5939			
5940			/*
5941			plugin stop method 
5942			stops scrolling animation
5943			----------------------------------------
5944			usage: $(selector).mCustomScrollbar("stop");
5945			*/
5946			stop:function(){
5947				
5948				var selector=_selector.call(this); /* validate selector */
5949				
5950				return $(selector).each(function(){
5951					
5952					var $this=$(this);
5953					
5954					if($this.data(pluginPfx)){ /* check if plugin has initialized */
5955										
5956						_stop($this);
5957					
5958					}
5959					
5960				});
5961				
5962			},
5963			/* ---------------------------------------- */
5964			
5965			
5966			
5967			/*
5968			plugin disable method 
5969			temporarily disables the scrollbar(s) 
5970			----------------------------------------
5971			usage: $(selector).mCustomScrollbar("disable",reset); 
5972			reset (boolean): resets content position to 0 
5973			*/
5974			disable:function(r){
5975				
5976				var selector=_selector.call(this); /* validate selector */
5977				
5978				return $(selector).each(function(){
5979					
5980					var $this=$(this);
5981					
5982					if($this.data(pluginPfx)){ /* check if plugin has initialized */
5983						
5984						var d=$this.data(pluginPfx);
5985						
5986						_autoUpdate.call(this,"remove"); /* remove automatic updating */
5987						
5988						_unbindEvents.call(this); /* unbind events */
5989						
5990						if(r){_resetContentPosition.call(this);} /* reset content position */
5991						
5992						_scrollbarVisibility.call(this,true); /* show/hide scrollbar(s) */
5993						
5994						$this.addClass(classes[3]); /* add disable class */
5995					
5996					}
5997					
5998				});
5999				
6000			},
6001			/* ---------------------------------------- */
6002			
6003			
6004			
6005			/*
6006			plugin destroy method 
6007			completely removes the scrollbar(s) and returns the element to its original state
6008			----------------------------------------
6009			usage: $(selector).mCustomScrollbar("destroy"); 
6010			*/
6011			destroy:function(){
6012				
6013				var selector=_selector.call(this); /* validate selector */
6014				
6015				return $(selector).each(function(){
6016					
6017					var $this=$(this);
6018					
6019					if($this.data(pluginPfx)){ /* check if plugin has initialized */
6020					
6021						var d=$this.data(pluginPfx),o=d.opt,
6022							mCustomScrollBox=$("#mCSB_"+d.idx),
6023							mCSB_container=$("#mCSB_"+d.idx+"_container"),
6024							scrollbar=$(".mCSB_"+d.idx+"_scrollbar");
6025					
6026						if(o.live){removeLiveTimers(o.liveSelector || $(selector).selector);} /* remove live timers */
6027						
6028						_autoUpdate.call(this,"remove"); /* remove automatic updating */
6029						
6030						_unbindEvents.call(this); /* unbind events */
6031						
6032						_resetContentPosition.call(this); /* reset content position */
6033						
6034						$this.removeData(pluginPfx); /* remove plugin data object */
6035						
6036						_delete(this,"mcs"); /* delete callbacks object */
6037						
6038						/* remove plugin markup */
6039						scrollbar.remove(); /* remove scrollbar(s) first (those can be either inside or outside plugin's inner wrapper) */
6040						mCSB_container.find("img."+classes[2]).removeClass(classes[2]); /* remove loaded images flag */
6041						mCustomScrollBox.replaceWith(mCSB_container.contents()); /* replace plugin's inner wrapper with the original content */
6042						/* remove plugin classes from the element and add destroy class */
6043						$this.removeClass(pluginNS+" _"+pluginPfx+"_"+d.idx+" "+classes[6]+" "+classes[7]+" "+classes[5]+" "+classes[3]).addClass(classes[4]);
6044					
6045					}
6046					
6047				});
6048				
6049			}
6050			/* ---------------------------------------- */
6051			
6052		},
6053	
6054	
6055	
6056	
6057		
6058	/* 
6059	----------------------------------------
6060	FUNCTIONS
6061	----------------------------------------
6062	*/
6063	
6064		/* validates selector (if selector is invalid or undefined uses the default one) */
6065		_selector=function(){
6066			return (typeof $(this)!=="object" || $(this).length<1) ? defaultSelector : this;
6067		},
6068		/* -------------------- */
6069		
6070		
6071		/* changes options according to theme */
6072		_theme=function(obj){
6073			var fixedSizeScrollbarThemes=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],
6074				nonExpandedScrollbarThemes=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"],
6075				disabledScrollButtonsThemes=["minimal","minimal-dark"],
6076				enabledAutoHideScrollbarThemes=["minimal","minimal-dark"],
6077				scrollbarPositionOutsideThemes=["minimal","minimal-dark"];
6078			obj.autoDraggerLength=$.inArray(obj.theme,fixedSizeScrollbarThemes) > -1 ? false : obj.autoDraggerLength;
6079			obj.autoExpandScrollbar=$.inArray(obj.theme,nonExpandedScrollbarThemes) > -1 ? false : obj.autoExpandScrollbar;
6080			obj.scrollButtons.enable=$.inArray(obj.theme,disabledScrollButtonsThemes) > -1 ? false : obj.scrollButtons.enable;
6081			obj.autoHideScrollbar=$.inArray(obj.theme,enabledAutoHideScrollbarThemes) > -1 ? true : obj.autoHideScrollbar;
6082			obj.scrollbarPosition=$.inArray(obj.theme,scrollbarPositionOutsideThemes) > -1 ? "outside" : obj.scrollbarPosition;
6083		},
6084		/* -------------------- */
6085		
6086		
6087		/* live option timers removal */
6088		removeLiveTimers=function(selector){
6089			if(liveTimers[selector]){
6090				clearTimeout(liveTimers[selector]);
6091				_delete(liveTimers,selector);
6092			}
6093		},
6094		/* -------------------- */
6095		
6096		
6097		/* normalizes axis option to valid values: "y", "x", "yx" */
6098		_findAxis=function(val){
6099			return (val==="yx" || val==="xy" || val==="auto") ? "yx" : (val==="x" || val==="horizontal") ? "x" : "y";
6100		},
6101		/* -------------------- */
6102		
6103		
6104		/* normalizes scrollButtons.scrollType option to valid values: "stepless", "stepped" */
6105		_findScrollButtonsType=function(val){
6106			return (val==="stepped" || val==="pixels" || val==="step" || val==="click") ? "stepped" : "stepless";
6107		},
6108		/* -------------------- */
6109		
6110		
6111		/* generates plugin markup */
6112		_pluginMarkup=function(){
6113			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
6114				expandClass=o.autoExpandScrollbar ? " "+classes[1]+"_expand" : "",
6115				scrollbar=["<div id='mCSB_"+d.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+d.idx+"_scrollbar mCS-"+o.theme+" mCSB_scrollTools_vertical"+expandClass+"'><div class='"+classes[12]+"'><div id='mCSB_"+d.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>","<div id='mCSB_"+d.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+d.idx+"_scrollbar mCS-"+o.theme+" mCSB_scrollTools_horizontal"+expandClass+"'><div class='"+classes[12]+"'><div id='mCSB_"+d.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;'><div class='mCSB_dragger_bar' /></div><div class='mCSB_draggerRail' /></div></div>"],
6116				wrapperClass=o.axis==="yx" ? "mCSB_vertical_horizontal" : o.axis==="x" ? "mCSB_horizontal" : "mCSB_vertical",
6117				scrollbars=o.axis==="yx" ? scrollbar[0]+scrollbar[1] : o.axis==="x" ? scrollbar[1] : scrollbar[0],
6118				contentWrapper=o.axis==="yx" ? "<div id='mCSB_"+d.idx+"_container_wrapper' class='mCSB_container_wrapper' />" : "",
6119				autoHideClass=o.autoHideScrollbar ? " "+classes[6] : "",
6120				scrollbarDirClass=(o.axis!=="x" && d.langDir==="rtl") ? " "+classes[7] : "";
6121			if(o.setWidth){$this.css("width",o.setWidth);} /* set element width */
6122			if(o.setHeight){$this.css("height",o.setHeight);} /* set element height */
6123			o.setLeft=(o.axis!=="y" && d.langDir==="rtl") ? "989999px" : o.setLeft; /* adjust left position for rtl direction */
6124			$this.addClass(pluginNS+" _"+pluginPfx+"_"+d.idx+autoHideClass+scrollbarDirClass).wrapInner("<div id='mCSB_"+d.idx+"' class='mCustomScrollBox mCS-"+o.theme+" "+wrapperClass+"'><div id='mCSB_"+d.idx+"_container' class='mCSB_container' style='position:relative; top:"+o.setTop+"; left:"+o.setLeft+";' dir='"+d.langDir+"' /></div>");
6125			var mCustomScrollBox=$("#mCSB_"+d.idx),
6126				mCSB_container=$("#mCSB_"+d.idx+"_container");
6127			if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){
6128				mCSB_container.css("width",_contentWidth(mCSB_container));
6129			}
6130			if(o.scrollbarPosition==="outside"){
6131				if($this.css("position")==="static"){ /* requires elements with non-static position */
6132					$this.css("position","relative");
6133				}
6134				$this.css("overflow","visible");
6135				mCustomScrollBox.addClass("mCSB_outside").after(scrollbars);
6136			}else{
6137				mCustomScrollBox.addClass("mCSB_inside").append(scrollbars);
6138				mCSB_container.wrap(contentWrapper);
6139			}
6140			_scrollButtons.call(this); /* add scrollbar buttons */
6141			/* minimum dragger length */
6142			var mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
6143			mCSB_dragger[0].css("min-height",mCSB_dragger[0].height());
6144			mCSB_dragger[1].css("min-width",mCSB_dragger[1].width());
6145		},
6146		/* -------------------- */
6147		
6148		
6149		/* calculates content width */
6150		_contentWidth=function(el){
6151			var val=[el[0].scrollWidth,Math.max.apply(Math,el.children().map(function(){return $(this).outerWidth(true);}).get())],w=el.parent().width();
6152			return val[0]>w ? val[0] : val[1]>w ? val[1] : "100%";
6153		},
6154		/* -------------------- */
6155		
6156		
6157		/* expands content horizontally */
6158		_expandContentHorizontally=function(){
6159			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
6160				mCSB_container=$("#mCSB_"+d.idx+"_container");
6161			if(o.advanced.autoExpandHorizontalScroll && o.axis!=="y"){
6162				/* calculate scrollWidth */
6163				mCSB_container.css({"width":"auto","min-width":0,"overflow-x":"scroll"});
6164				var w=Math.ceil(mCSB_container[0].scrollWidth);
6165				if(o.advanced.autoExpandHorizontalScroll===3 || (o.advanced.autoExpandHorizontalScroll!==2 && w>mCSB_container.parent().width())){
6166					mCSB_container.css({"width":w,"min-width":"100%","overflow-x":"inherit"});
6167				}else{
6168					/* 
6169					wrap content with an infinite width div and set its position to absolute and width to auto. 
6170					Setting width to auto before calculating the actual width is important! 
6171					We must let the browser set the width as browser zoom values are impossible to calculate.
6172					*/
6173					mCSB_container.css({"overflow-x":"inherit","position":"absolute"})
6174						.wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />")
6175						.css({ /* set actual width, original position and un-wrap */
6176							/* 
6177							get the exact width (with decimals) and then round-up. 
6178							Using jquery outerWidth() will round the width value which will mess up with inner elements that have non-integer width
6179							*/
6180							"width":(Math.ceil(mCSB_container[0].getBoundingClientRect().right+0.4)-Math.floor(mCSB_container[0].getBoundingClientRect().left)),
6181							"min-width":"100%",
6182							"position":"relative"
6183						}).unwrap();
6184				}
6185			}
6186		},
6187		/* -------------------- */
6188		
6189		
6190		/* adds scrollbar buttons */
6191		_scrollButtons=function(){
6192			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
6193				mCSB_scrollTools=$(".mCSB_"+d.idx+"_scrollbar:first"),
6194				tabindex=!_isNumeric(o.scrollButtons.tabindex) ? "" : "tabindex='"+o.scrollButtons.tabindex+"'",
6195				btnHTML=[
6196					"<a href='#' class='"+classes[13]+"' "+tabindex+" />",
6197					"<a href='#' class='"+classes[14]+"' "+tabindex+" />",
6198					"<a href='#' class='"+classes[15]+"' "+tabindex+" />",
6199					"<a href='#' class='"+classes[16]+"' "+tabindex+" />"
6200				],
6201				btn=[(o.axis==="x" ? btnHTML[2] : btnHTML[0]),(o.axis==="x" ? btnHTML[3] : btnHTML[1]),btnHTML[2],btnHTML[3]];
6202			if(o.scrollButtons.enable){
6203				mCSB_scrollTools.prepend(btn[0]).append(btn[1]).next(".mCSB_scrollTools").prepend(btn[2]).append(btn[3]);
6204			}
6205		},
6206		/* -------------------- */
6207		
6208		
6209		/* auto-adjusts scrollbar dragger length */
6210		_setDraggerLength=function(){
6211			var $this=$(this),d=$this.data(pluginPfx),
6212				mCustomScrollBox=$("#mCSB_"+d.idx),
6213				mCSB_container=$("#mCSB_"+d.idx+"_container"),
6214				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
6215				ratio=[mCustomScrollBox.height()/mCSB_container.outerHeight(false),mCustomScrollBox.width()/mCSB_container.outerWidth(false)],
6216				l=[
6217					parseInt(mCSB_dragger[0].css("min-height")),Math.round(ratio[0]*mCSB_dragger[0].parent().height()),
6218					parseInt(mCSB_dragger[1].css("min-width")),Math.round(ratio[1]*mCSB_dragger[1].parent().width())
6219				],
6220				h=oldIE && (l[1]<l[0]) ? l[0] : l[1],w=oldIE && (l[3]<l[2]) ? l[2] : l[3];
6221			mCSB_dragger[0].css({
6222				"height":h,"max-height":(mCSB_dragger[0].parent().height()-10)
6223			}).find(".mCSB_dragger_bar").css({"line-height":l[0]+"px"});
6224			mCSB_dragger[1].css({
6225				"width":w,"max-width":(mCSB_dragger[1].parent().width()-10)
6226			});
6227		},
6228		/* -------------------- */
6229		
6230		
6231		/* calculates scrollbar to content ratio */
6232		_scrollRatio=function(){
6233			var $this=$(this),d=$this.data(pluginPfx),
6234				mCustomScrollBox=$("#mCSB_"+d.idx),
6235				mCSB_container=$("#mCSB_"+d.idx+"_container"),
6236				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
6237				scrollAmount=[mCSB_container.outerHeight(false)-mCustomScrollBox.height(),mCSB_container.outerWidth(false)-mCustomScrollBox.width()],
6238				ratio=[
6239					scrollAmount[0]/(mCSB_dragger[0].parent().height()-mCSB_dragger[0].height()),
6240					scrollAmount[1]/(mCSB_dragger[1].parent().width()-mCSB_dragger[1].width())
6241				];
6242			d.scrollRatio={y:ratio[0],x:ratio[1]};
6243		},
6244		/* -------------------- */
6245		
6246		
6247		/* toggles scrolling classes */
6248		_onDragClasses=function(el,action,xpnd){
6249			var expandClass=xpnd ? classes[0]+"_expanded" : "",
6250				scrollbar=el.closest(".mCSB_scrollTools");
6251			if(action==="active"){
6252				el.toggleClass(classes[0]+" "+expandClass); scrollbar.toggleClass(classes[1]); 
6253				el[0]._draggable=el[0]._draggable ? 0 : 1;
6254			}else{
6255				if(!el[0]._draggable){
6256					if(action==="hide"){
6257						el.removeClass(classes[0]); scrollbar.removeClass(classes[1]);
6258					}else{
6259						el.addClass(classes[0]); scrollbar.addClass(classes[1]);
6260					}
6261				}
6262			}
6263		},
6264		/* -------------------- */
6265		
6266		
6267		/* checks if content overflows its container to determine if scrolling is required */
6268		_overflowed=function(){
6269			var $this=$(this),d=$this.data(pluginPfx),
6270				mCustomScrollBox=$("#mCSB_"+d.idx),
6271				mCSB_container=$("#mCSB_"+d.idx+"_container"),
6272				contentHeight=d.overflowed==null ? mCSB_container.height() : mCSB_container.outerHeight(false),
6273				contentWidth=d.overflowed==null ? mCSB_container.width() : mCSB_container.outerWidth(false),
6274				h=mCSB_container[0].scrollHeight,w=mCSB_container[0].scrollWidth;
6275			if(h>contentHeight){contentHeight=h;}
6276			if(w>contentWidth){contentWidth=w;}
6277			return [contentHeight>mCustomScrollBox.height(),contentWidth>mCustomScrollBox.width()];
6278		},
6279		/* -------------------- */
6280		
6281		
6282		/* resets content position to 0 */
6283		_resetContentPosition=function(){
6284			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
6285				mCustomScrollBox=$("#mCSB_"+d.idx),
6286				mCSB_container=$("#mCSB_"+d.idx+"_container"),
6287				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
6288			_stop($this); /* stop any current scrolling before resetting */
6289			if((o.axis!=="x" && !d.overflowed[0]) || (o.axis==="y" && d.overflowed[0])){ /* reset y */
6290				mCSB_dragger[0].add(mCSB_container).css("top",0);
6291				_scrollTo($this,"_resetY");
6292			}
6293			if((o.axis!=="y" && !d.overflowed[1]) || (o.axis==="x" && d.overflowed[1])){ /* reset x */
6294				var cx=dx=0;
6295				if(d.langDir==="rtl"){ /* adjust left position for rtl direction */
6296					cx=mCustomScrollBox.width()-mCSB_container.outerWidth(false);
6297					dx=Math.abs(cx/d.scrollRatio.x);
6298				}
6299				mCSB_container.css("left",cx);
6300				mCSB_dragger[1].css("left",dx);
6301				_scrollTo($this,"_resetX");
6302			}
6303		},
6304		/* -------------------- */
6305		
6306		
6307		/* binds scrollbar events */
6308		_bindEvents=function(){
6309			var $this=$(this),d=$this.data(pluginPfx),o=d.opt;
6310			if(!d.bindEvents){ /* check if events are already bound */
6311				_draggable.call(this);
6312				if(o.contentTouchScroll){_contentDraggable.call(this);}
6313				_selectable.call(this);
6314				if(o.mouseWheel.enable){ /* bind mousewheel fn when plugin is available */
6315					function _mwt(){
6316						mousewheelTimeout=setTimeout(function(){
6317							if(!$.event.special.mousewheel){
6318								_mwt();
6319							}else{
6320								clearTimeout(mousewheelTimeout);
6321								_mousewheel.call($this[0]);
6322							}
6323						},100);
6324					}
6325					var mousewheelTimeout;
6326					_mwt();
6327				}
6328				_draggerRail.call(this);
6329				_wrapperScroll.call(this);
6330				if(o.advanced.autoScrollOnFocus){_focus.call(this);}
6331				if(o.scrollButtons.enable){_buttons.call(this);}
6332				if(o.keyboard.enable){_keyboard.call(this);}
6333				d.bindEvents=true;
6334			}
6335		},
6336		/* -------------------- */
6337		
6338		
6339		/* unbinds scrollbar events */
6340		_unbindEvents=function(){
6341			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
6342				namespace=pluginPfx+"_"+d.idx,
6343				sb=".mCSB_"+d.idx+"_scrollbar",
6344				sel=$("#mCSB_"+d.idx+",#mCSB_"+d.idx+"_container,#mCSB_"+d.idx+"_container_wrapper,"+sb+" ."+classes[12]+",#mCSB_"+d.idx+"_dragger_vertical,#mCSB_"+d.idx+"_dragger_horizontal,"+sb+">a"),
6345				mCSB_container=$("#mCSB_"+d.idx+"_container");
6346			if(o.advanced.releaseDraggableSelectors){sel.add($(o.advanced.releaseDraggableSelectors));}
6347			if(o.advanced.extraDraggableSelectors){sel.add($(o.advanced.extraDraggableSelectors));}
6348			if(d.bindEvents){ /* check if events are bound */
6349				/* unbind namespaced events from document/selectors */
6350				$(document).add($(!_canAccessIFrame() || top.document)).unbind("."+namespace);
6351				sel.each(function(){
6352					$(this).unbind("."+namespace);
6353				});
6354				/* clear and delete timeouts/objects */
6355				clearTimeout($this[0]._focusTimeout); _delete($this[0],"_focusTimeout");
6356				clearTimeout(d.sequential.step); _delete(d.sequential,"step");
6357				clearTimeout(mCSB_container[0].onCompleteTimeout); _delete(mCSB_container[0],"onCompleteTimeout");
6358				d.bindEvents=false;
6359			}
6360		},
6361		/* -------------------- */
6362		
6363		
6364		/* toggles scrollbar visibility */
6365		_scrollbarVisibility=function(disabled){
6366			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
6367				contentWrapper=$("#mCSB_"+d.idx+"_container_wrapper"),
6368				content=contentWrapper.length ? contentWrapper : $("#mCSB_"+d.idx+"_container"),
6369				scrollbar=[$("#mCSB_"+d.idx+"_scrollbar_vertical"),$("#mCSB_"+d.idx+"_scrollbar_horizontal")],
6370				mCSB_dragger=[scrollbar[0].find(".mCSB_dragger"),scrollbar[1].find(".mCSB_dragger")];
6371			if(o.axis!=="x"){
6372				if(d.overflowed[0] && !disabled){
6373					scrollbar[0].add(mCSB_dragger[0]).add(scrollbar[0].children("a")).css("display","block");
6374					content.removeClass(classes[8]+" "+classes[10]);
6375				}else{
6376					if(o.alwaysShowScrollbar){
6377						if(o.alwaysShowScrollbar!==2){mCSB_dragger[0].css("display","none");}
6378						content.removeClass(classes[10]);
6379					}else{
6380						scrollbar[0].css("display","none");
6381						content.addClass(classes[10]);
6382					}
6383					content.addClass(classes[8]);
6384				}
6385			}
6386			if(o.axis!=="y"){
6387				if(d.overflowed[1] && !disabled){
6388					scrollbar[1].add(mCSB_dragger[1]).add(scrollbar[1].children("a")).css("display","block");
6389					content.removeClass(classes[9]+" "+classes[11]);
6390				}else{
6391					if(o.alwaysShowScrollbar){
6392						if(o.alwaysShowScrollbar!==2){mCSB_dragger[1].css("display","none");}
6393						content.removeClass(classes[11]);
6394					}else{
6395						scrollbar[1].css("display","none");
6396						content.addClass(classes[11]);
6397					}
6398					content.addClass(classes[9]);
6399				}
6400			}
6401			if(!d.overflowed[0] && !d.overflowed[1]){
6402				$this.addClass(classes[5]);
6403			}else{
6404				$this.removeClass(classes[5]);
6405			}
6406		},
6407		/* -------------------- */
6408		
6409		
6410		/* returns input coordinates of pointer, touch and mouse events (relative to document) */
6411		_coordinates=function(e){
6412			var t=e.type,o=e.target.ownerDocument!==document && frameElement!==null ? [$(frameElement).offset().top,$(frameElement).offset().left] : null,
6413				io=_canAccessIFrame() && e.target.ownerDocument!==top.document && frameElement!==null ? [$(e.view.frameElement).offset().top,$(e.view.frameElement).offset().left] : [0,0];
6414			switch(t){
6415				case "pointerdown": case "MSPointerDown": case "pointermove": case "MSPointerMove": case "pointerup": case "MSPointerUp":
6416					return o ? [e.originalEvent.pageY-o[0]+io[0],e.originalEvent.pageX-o[1]+io[1],false] : [e.originalEvent.pageY,e.originalEvent.pageX,false];
6417					break;
6418				case "touchstart": case "touchmove": case "touchend":
6419					var touch=e.originalEvent.touches[0] || e.originalEvent.changedTouches[0],
6420						touches=e.originalEvent.touches.length || e.originalEvent.changedTouches.length;
6421					return e.target.ownerDocument!==document ? [touch.screenY,touch.screenX,touches>1] : [touch.pageY,touch.pageX,touches>1];
6422					break;
6423				default:
6424					return o ? [e.pageY-o[0]+io[0],e.pageX-o[1]+io[1],false] : [e.pageY,e.pageX,false];
6425			}
6426		},
6427		/* -------------------- */
6428		
6429		
6430		/* 
6431		SCROLLBAR DRAG EVENTS
6432		scrolls content via scrollbar dragging 
6433		*/
6434		_draggable=function(){
6435			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
6436				namespace=pluginPfx+"_"+d.idx,
6437				draggerId=["mCSB_"+d.idx+"_dragger_vertical","mCSB_"+d.idx+"_dragger_horizontal"],
6438				mCSB_container=$("#mCSB_"+d.idx+"_container"),
6439				mCSB_dragger=$("#"+draggerId[0]+",#"+draggerId[1]),
6440				draggable,dragY,dragX,
6441				rds=o.advanced.releaseDraggableSelectors ? mCSB_dragger.add($(o.advanced.releaseDraggableSelectors)) : mCSB_dragger,
6442				eds=o.advanced.extraDraggableSelectors ? $(!_canAccessIFrame() || top.document).add($(o.advanced.extraDraggableSelectors)) : $(!_canAccessIFrame() || top.document);
6443			mCSB_dragger.bind("contextmenu."+namespace,function(e){
6444				e.preventDefault(); //prevent right click
6445			}).bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
6446				e.stopImmediatePropagation();
6447				e.preventDefault();
6448				if(!_mouseBtnLeft(e)){return;} /* left mouse button only */
6449				touchActive=true;
6450				if(oldIE){document.onselectstart=function(){return false;}} /* disable text selection for IE < 9 */
6451				_iframe.call(mCSB_container,false); /* enable scrollbar dragging over iframes by disabling their events */
6452				_stop($this);
6453				draggable=$(this);
6454				var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left,
6455					h=draggable.height()+offset.top,w=draggable.width()+offset.left;
6456				if(y<h && y>0 && x<w && x>0){
6457					dragY=y; 
6458					dragX=x;
6459				}
6460				_onDragClasses(draggable,"active",o.autoExpandScrollbar); 
6461			}).bind("touchmove."+namespace,function(e){
6462				e.stopImmediatePropagation();
6463				e.preventDefault();
6464				var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
6465				_drag(dragY,dragX,y,x);
6466			});
6467			$(document).add(eds).bind("mousemove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace,function(e){
6468				if(draggable){
6469					var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
6470					if(dragY===y && dragX===x){return;} /* has it really moved? */
6471					_drag(dragY,dragX,y,x);
6472				}
6473			}).add(rds).bind("mouseup."+namespace+" touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){
6474				if(draggable){
6475					_onDragClasses(draggable,"active",o.autoExpandScrollbar); 
6476					draggable=null;
6477				}
6478				touchActive=false;
6479				if(oldIE){document.onselectstart=null;} /* enable text selection for IE < 9 */
6480				_iframe.call(mCSB_container,true); /* enable iframes events */
6481			});
6482			function _drag(dragY,dragX,y,x){
6483				mCSB_container[0].idleTimer=o.scrollInertia<233 ? 250 : 0;
6484				if(draggable.attr("id")===draggerId[1]){
6485					var dir="x",to=((draggable[0].offsetLeft-dragX)+x)*d.scrollRatio.x;
6486				}else{
6487					var dir="y",to=((draggable[0].offsetTop-dragY)+y)*d.scrollRatio.y;
6488				}
6489				_scrollTo($this,to.toString(),{dir:dir,drag:true});
6490			}
6491		},
6492		/* -------------------- */
6493		
6494		
6495		/* 
6496		TOUCH SWIPE EVENTS
6497		scrolls content via touch swipe 
6498		Emulates the native touch-swipe scrolling with momentum found in iOS, Android and WP devices 
6499		*/
6500		_contentDraggable=function(){
6501			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
6502				namespace=pluginPfx+"_"+d.idx,
6503				mCustomScrollBox=$("#mCSB_"+d.idx),
6504				mCSB_container=$("#mCSB_"+d.idx+"_container"),
6505				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
6506				draggable,dragY,dragX,touchStartY,touchStartX,touchMoveY=[],touchMoveX=[],startTime,runningTime,endTime,distance,speed,amount,
6507				durA=0,durB,overwrite=o.axis==="yx" ? "none" : "all",touchIntent=[],touchDrag,docDrag,
6508				iframe=mCSB_container.find("iframe"),
6509				events=[
6510					"touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace, //start
6511					"touchmove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace, //move
6512					"touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace //end
6513				],
6514				touchAction=document.body.style.touchAction!==undefined && document.body.style.touchAction!=="";
6515			mCSB_container.bind(events[0],function(e){
6516				_onTouchstart(e);
6517			}).bind(events[1],function(e){
6518				_onTouchmove(e);
6519			});
6520			mCustomScrollBox.bind(events[0],function(e){
6521				_onTouchstart2(e);
6522			}).bind(events[2],function(e){
6523				_onTouchend(e);
6524			});
6525			if(iframe.length){
6526				iframe.each(function(){
6527					$(this).bind("load",function(){
6528						/* bind events on accessible iframes */
6529						if(_canAccessIFrame(this)){
6530							$(this.contentDocument || this.contentWindow.document).bind(events[0],function(e){
6531								_onTouchstart(e);
6532								_onTouchstart2(e);
6533							}).bind(events[1],function(e){
6534								_onTouchmove(e);
6535							}).bind(events[2],function(e){
6536								_onTouchend(e);
6537							});
6538						}
6539					});
6540				});
6541			}
6542			function _onTouchstart(e){
6543				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;}
6544				touchable=1; touchDrag=0; docDrag=0; draggable=1;
6545				$this.removeClass("mCS_touch_action");
6546				var offset=mCSB_container.offset();
6547				dragY=_coordinates(e)[0]-offset.top;
6548				dragX=_coordinates(e)[1]-offset.left;
6549				touchIntent=[_coordinates(e)[0],_coordinates(e)[1]];
6550			}
6551			function _onTouchmove(e){
6552				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;}
6553				if(!o.documentTouchScroll){e.preventDefault();} 
6554				e.stopImmediatePropagation();
6555				if(docDrag && !touchDrag){return;}
6556				if(draggable){
6557					runningTime=_getTime();
6558					var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left,
6559						easing="mcsLinearOut";
6560					touchMoveY.push(y);
6561					touchMoveX.push(x);
6562					touchIntent[2]=Math.abs(_coordinates(e)[0]-touchIntent[0]); touchIntent[3]=Math.abs(_coordinates(e)[1]-touchIntent[1]);
6563					if(d.overflowed[0]){
6564						var limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(),
6565							prevent=((dragY-y)>0 && (y-dragY)>-(limit*d.scrollRatio.y) && (touchIntent[3]*2<touchIntent[2] || o.axis==="yx"));
6566					}
6567					if(d.overflowed[1]){
6568						var limitX=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(),
6569							preventX=((dragX-x)>0 && (x-dragX)>-(limitX*d.scrollRatio.x) && (touchIntent[2]*2<touchIntent[3] || o.axis==="yx"));
6570					}
6571					if(prevent || preventX){ /* prevent native document scrolling */
6572						if(!touchAction){e.preventDefault();} 
6573						touchDrag=1;
6574					}else{
6575						docDrag=1;
6576						$this.addClass("mCS_touch_action");
6577					}
6578					if(touchAction){e.preventDefault();} 
6579					amount=o.axis==="yx" ? [(dragY-y),(dragX-x)] : o.axis==="x" ? [null,(dragX-x)] : [(dragY-y),null];
6580					mCSB_container[0].idleTimer=250;
6581					if(d.overflowed[0]){_drag(amount[0],durA,easing,"y","all",true);}
6582					if(d.overflowed[1]){_drag(amount[1],durA,easing,"x",overwrite,true);}
6583				}
6584			}
6585			function _onTouchstart2(e){
6586				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;}
6587				touchable=1;
6588				e.stopImmediatePropagation();
6589				_stop($this);
6590				startTime=_getTime();
6591				var offset=mCustomScrollBox.offset();
6592				touchStartY=_coordinates(e)[0]-offset.top;
6593				touchStartX=_coordinates(e)[1]-offset.left;
6594				touchMoveY=[]; touchMoveX=[];
6595			}
6596			function _onTouchend(e){
6597				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;}
6598				draggable=0;
6599				e.stopImmediatePropagation();
6600				touchDrag=0; docDrag=0;
6601				endTime=_getTime();
6602				var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
6603				if((endTime-runningTime)>30){return;}
6604				speed=1000/(endTime-startTime);
6605				var easing="mcsEaseOut",slow=speed<2.5,
6606					diff=slow ? [touchMoveY[touchMoveY.length-2],touchMoveX[touchMoveX.length-2]] : [0,0];
6607				distance=slow ? [(y-diff[0]),(x-diff[1])] : [y-touchStartY,x-touchStartX];
6608				var absDistance=[Math.abs(distance[0]),Math.abs(distance[1])];
6609				speed=slow ? [Math.abs(distance[0]/4),Math.abs(distance[1]/4)] : [speed,speed];
6610				var a=[
6611					Math.abs(mCSB_container[0].offsetTop)-(distance[0]*_m((absDistance[0]/speed[0]),speed[0])),
6612					Math.abs(mCSB_container[0].offsetLeft)-(distance[1]*_m((absDistance[1]/speed[1]),speed[1]))
6613				];
6614				amount=o.axis==="yx" ? [a[0],a[1]] : o.axis==="x" ? [null,a[1]] : [a[0],null];
6615				durB=[(absDistance[0]*4)+o.scrollInertia,(absDistance[1]*4)+o.scrollInertia];
6616				var md=parseInt(o.contentTouchScroll) || 0; /* absolute minimum distance required */
6617				amount[0]=absDistance[0]>md ? amount[0] : 0;
6618				amount[1]=absDistance[1]>md ? amount[1] : 0;
6619				if(d.overflowed[0]){_drag(amount[0],durB[0],easing,"y",overwrite,false);}
6620				if(d.overflowed[1]){_drag(amount[1],durB[1],easing,"x",overwrite,false);}
6621			}
6622			function _m(ds,s){
6623				var r=[s*1.5,s*2,s/1.5,s/2];
6624				if(ds>90){
6625					return s>4 ? r[0] : r[3];
6626				}else if(ds>60){
6627					return s>3 ? r[3] : r[2];
6628				}else if(ds>30){
6629					return s>8 ? r[1] : s>6 ? r[0] : s>4 ? s : r[2];
6630				}else{
6631					return s>8 ? s : r[3];
6632				}
6633			}
6634			function _drag(amount,dur,easing,dir,overwrite,drag){
6635				if(!amount){return;}
6636				_scrollTo($this,amount.toString(),{dur:dur,scrollEasing:easing,dir:dir,overwrite:overwrite,drag:drag});
6637			}
6638		},
6639		/* -------------------- */
6640		
6641		
6642		/* 
6643		SELECT TEXT EVENTS 
6644		scrolls content when text is selected 
6645		*/
6646		_selectable=function(){
6647			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
6648				namespace=pluginPfx+"_"+d.idx,
6649				mCSB_container=$("#mCSB_"+d.idx+"_container"),
6650				wrapper=mCSB_container.parent(),
6651				action;
6652			mCSB_container.bind("mousedown."+namespace,function(e){
6653				if(touchable){return;}
6654				if(!action){action=1; touchActive=true;}
6655			}).add(document).bind("mousemove."+namespace,function(e){
6656				if(!touchable && action && _sel()){
6657					var offset=mCSB_container.offset(),
6658						y=_coordinates(e)[0]-offset.top+mCSB_container[0].offsetTop,x=_coordinates(e)[1]-offset.left+mCSB_container[0].offsetLeft;
6659					if(y>0 && y<wrapper.height() && x>0 && x<wrapper.width()){
6660						if(seq.step){_seq("off",null,"stepped");}
6661					}else{
6662						if(o.axis!=="x" && d.overflowed[0]){
6663							if(y<0){
6664								_seq("on",38);
6665							}else if(y>wrapper.height()){
6666								_seq("on",40);
6667							}
6668						}
6669						if(o.axis!=="y" && d.overflowed[1]){
6670							if(x<0){
6671								_seq("on",37);
6672							}else if(x>wrapper.width()){
6673								_seq("on",39);
6674							}
6675						}
6676					}
6677				}
6678			}).bind("mouseup."+namespace+" dragend."+namespace,function(e){
6679				if(touchable){return;}
6680				if(action){action=0; _seq("off",null);}
6681				touchActive=false;
6682			});
6683			function _sel(){
6684				return 	window.getSelection ? window.getSelection().toString() : 
6685						document.selection && document.selection.type!="Control" ? document.selection.createRange().text : 0;
6686			}
6687			function _seq(a,c,s){
6688				seq.type=s && action ? "stepped" : "stepless";
6689				seq.scrollAmount=10;
6690				_sequentialScroll($this,a,c,"mcsLinearOut",s ? 60 : null);
6691			}
6692		},
6693		/* -------------------- */
6694		
6695		
6696		/* 
6697		MOUSE WHEEL EVENT
6698		scrolls content via mouse-wheel 
6699		via mouse-wheel plugin (https://github.com/brandonaaron/jquery-mousewheel)
6700		*/
6701		_mousewheel=function(){
6702			if(!$(this).data(pluginPfx)){return;} /* Check if the scrollbar is ready to use mousewheel events (issue: #185) */
6703			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
6704				namespace=pluginPfx+"_"+d.idx,
6705				mCustomScrollBox=$("#mCSB_"+d.idx),
6706				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
6707				iframe=$("#mCSB_"+d.idx+"_container").find("iframe");
6708			if(iframe.length){
6709				iframe.each(function(){
6710					$(this).bind("load",function(){
6711						/* bind events on accessible iframes */
6712						if(_canAccessIFrame(this)){
6713							$(this.contentDocument || this.contentWindow.document).bind("mousewheel."+namespace,function(e,delta){
6714								_onMousewheel(e,delta);
6715							});
6716						}
6717					});
6718				});
6719			}
6720			mCustomScrollBox.bind("mousewheel."+namespace,function(e,delta){
6721				_onMousewheel(e,delta);
6722			});
6723			function _onMousewheel(e,delta){
6724				_stop($this);
6725				if(_disableMousewheel($this,e.target)){return;} /* disables mouse-wheel when hovering specific elements */
6726				var deltaFactor=o.mouseWheel.deltaFactor!=="auto" ? parseInt(o.mouseWheel.deltaFactor) : (oldIE && e.deltaFactor<100) ? 100 : e.deltaFactor || 100,
6727					dur=o.scrollInertia;
6728				if(o.axis==="x" || o.mouseWheel.axis==="x"){
6729					var dir="x",
6730						px=[Math.round(deltaFactor*d.scrollRatio.x),parseInt(o.mouseWheel.scrollAmount)],
6731						amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.width() ? mCustomScrollBox.width()*0.9 : px[0],
6732						contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetLeft),
6733						draggerPos=mCSB_dragger[1][0].offsetLeft,
6734						limit=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(),
6735						dlt=o.mouseWheel.axis==="y" ? (e.deltaY || delta) : e.deltaX;
6736				}else{
6737					var dir="y",
6738						px=[Math.round(deltaFactor*d.scrollRatio.y),parseInt(o.mouseWheel.scrollAmount)],
6739						amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.height() ? mCustomScrollBox.height()*0.9 : px[0],
6740						contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetTop),
6741						draggerPos=mCSB_dragger[0][0].offsetTop,
6742						limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(),
6743						dlt=e.deltaY || delta;
6744				}
6745				if((dir==="y" && !d.overflowed[0]) || (dir==="x" && !d.overflowed[1])){return;}
6746				if(o.mouseWheel.invert || e.webkitDirectionInvertedFromDevice){dlt=-dlt;}
6747				if(o.mouseWheel.normalizeDelta){dlt=dlt<0 ? -1 : 1;}
6748				if((dlt>0 && draggerPos!==0) || (dlt<0 && draggerPos!==limit) || o.mouseWheel.preventDefault){
6749					e.stopImmediatePropagation();
6750					e.preventDefault();
6751				}
6752				if(e.deltaFactor<5 && !o.mouseWheel.normalizeDelta){
6753					//very low deltaFactor values mean some kind of delta acceleration (e.g. osx trackpad), so adjusting scrolling accordingly
6754					amount=e.deltaFactor; dur=17;
6755				}
6756				_scrollTo($this,(contentPos-(dlt*amount)).toString(),{dir:dir,dur:dur});
6757			}
6758		},
6759		/* -------------------- */
6760		
6761		
6762		/* checks if iframe can be accessed */
6763		_canAccessIFrameCache=new Object(),
6764		_canAccessIFrame=function(iframe){
6765		    var result=false,cacheKey=false,html=null;
6766		    if(iframe===undefined){
6767				cacheKey="#empty";
6768		    }else if($(iframe).attr("id")!==undefined){
6769				cacheKey=$(iframe).attr("id");
6770		    }
6771			if(cacheKey!==false && _canAccessIFrameCache[cacheKey]!==undefined){
6772				return _canAccessIFrameCache[cacheKey];
6773			}
6774			if(!iframe){
6775				try{
6776					var doc=top.document;
6777					html=doc.body.innerHTML;
6778				}catch(err){/* do nothing */}
6779				result=(html!==null);
6780			}else{
6781				try{
6782					var doc=iframe.contentDocument || iframe.contentWindow.document;
6783					html=doc.body.innerHTML;
6784				}catch(err){/* do nothing */}
6785				result=(html!==null);
6786			}
6787			if(cacheKey!==false){_canAccessIFrameCache[cacheKey]=result;}
6788			return result;
6789		},
6790		/* -------------------- */
6791		
6792		
6793		/* switches iframe's pointer-events property (drag, mousewheel etc. over cross-domain iframes) */
6794		_iframe=function(evt){
6795			var el=this.find("iframe");
6796			if(!el.length){return;} /* check if content contains iframes */
6797			var val=!evt ? "none" : "auto";
6798			el.css("pointer-events",val); /* for IE11, iframe's display property should not be "block" */
6799		},
6800		/* -------------------- */
6801		
6802		
6803		/* disables mouse-wheel when hovering specific elements like select, datalist etc. */
6804		_disableMousewheel=function(el,target){
6805			var tag=target.nodeName.toLowerCase(),
6806				tags=el.data(pluginPfx).opt.mouseWheel.disableOver,
6807				/* elements that require focus */
6808				focusTags=["select","textarea"];
6809			return $.inArray(tag,tags) > -1 && !($.inArray(tag,focusTags) > -1 && !$(target).is(":focus"));
6810		},
6811		/* -------------------- */
6812		
6813		
6814		/* 
6815		DRAGGER RAIL CLICK EVENT
6816		scrolls content via dragger rail 
6817		*/
6818		_draggerRail=function(){
6819			var $this=$(this),d=$this.data(pluginPfx),
6820				namespace=pluginPfx+"_"+d.idx,
6821				mCSB_container=$("#mCSB_"+d.idx+"_container"),
6822				wrapper=mCSB_container.parent(),
6823				mCSB_draggerContainer=$(".mCSB_"+d.idx+"_scrollbar ."+classes[12]),
6824				clickable;
6825			mCSB_draggerContainer.bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
6826				touchActive=true;
6827				if(!$(e.target).hasClass("mCSB_dragger")){clickable=1;}
6828			}).bind("touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){
6829				touchActive=false;
6830			}).bind("click."+namespace,function(e){
6831				if(!clickable){return;}
6832				clickable=0;
6833				if($(e.target).hasClass(classes[12]) || $(e.target).hasClass("mCSB_draggerRail")){
6834					_stop($this);
6835					var el=$(this),mCSB_dragger=el.find(".mCSB_dragger");
6836					if(el.parent(".mCSB_scrollTools_horizontal").length>0){
6837						if(!d.overflowed[1]){return;}
6838						var dir="x",
6839							clickDir=e.pageX>mCSB_dragger.offset().left ? -1 : 1,
6840							to=Math.abs(mCSB_container[0].offsetLeft)-(clickDir*(wrapper.width()*0.9));
6841					}else{
6842						if(!d.overflowed[0]){return;}
6843						var dir="y",
6844							clickDir=e.pageY>mCSB_dragger.offset().top ? -1 : 1,
6845							to=Math.abs(mCSB_container[0].offsetTop)-(clickDir*(wrapper.height()*0.9));
6846					}
6847					_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
6848				}
6849			});
6850		},
6851		/* -------------------- */
6852		
6853		
6854		/* 
6855		FOCUS EVENT
6856		scrolls content via element focus (e.g. clicking an input, pressing TAB key etc.)
6857		*/
6858		_focus=function(){
6859			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
6860				namespace=pluginPfx+"_"+d.idx,
6861				mCSB_container=$("#mCSB_"+d.idx+"_container"),
6862				wrapper=mCSB_container.parent();
6863			mCSB_container.bind("focusin."+namespace,function(e){
6864				var el=$(document.activeElement),
6865					nested=mCSB_container.find(".mCustomScrollBox").length,
6866					dur=0;
6867				if(!el.is(o.advanced.autoScrollOnFocus)){return;}
6868				_stop($this);
6869				clearTimeout($this[0]._focusTimeout);
6870				$this[0]._focusTimer=nested ? (dur+17)*nested : 0;
6871				$this[0]._focusTimeout=setTimeout(function(){
6872					var	to=[_childPos(el)[0],_childPos(el)[1]],
6873						contentPos=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft],
6874						isVisible=[
6875							(contentPos[0]+to[0]>=0 && contentPos[0]+to[0]<wrapper.height()-el.outerHeight(false)),
6876							(contentPos[1]+to[1]>=0 && contentPos[0]+to[1]<wrapper.width()-el.outerWidth(false))
6877						],
6878						overwrite=(o.axis==="yx" && !isVisible[0] && !isVisible[1]) ? "none" : "all";
6879					if(o.axis!=="x" && !isVisible[0]){
6880						_scrollTo($this,to[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur});
6881					}
6882					if(o.axis!=="y" && !isVisible[1]){
6883						_scrollTo($this,to[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur});
6884					}
6885				},$this[0]._focusTimer);
6886			});
6887		},
6888		/* -------------------- */
6889		
6890		
6891		/* sets content wrapper scrollTop/scrollLeft always to 0 */
6892		_wrapperScroll=function(){
6893			var $this=$(this),d=$this.data(pluginPfx),
6894				namespace=pluginPfx+"_"+d.idx,
6895				wrapper=$("#mCSB_"+d.idx+"_container").parent();
6896			wrapper.bind("scroll."+namespace,function(e){
6897				if(wrapper.scrollTop()!==0 || wrapper.scrollLeft()!==0){
6898					$(".mCSB_"+d.idx+"_scrollbar").css("visibility","hidden"); /* hide scrollbar(s) */
6899				}
6900			});
6901		},
6902		/* -------------------- */
6903		
6904		
6905		/* 
6906		BUTTONS EVENTS
6907		scrolls content via up, down, left and right buttons 
6908		*/
6909		_buttons=function(){
6910			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
6911				namespace=pluginPfx+"_"+d.idx,
6912				sel=".mCSB_"+d.idx+"_scrollbar",
6913				btn=$(sel+">a");
6914			btn.bind("contextmenu."+namespace,function(e){
6915				e.preventDefault(); //prevent right click
6916			}).bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace+" mouseup."+namespace+" touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace+" mouseout."+namespace+" pointerout."+namespace+" MSPointerOut."+namespace+" click."+namespace,function(e){
6917				e.preventDefault();
6918				if(!_mouseBtnLeft(e)){return;} /* left mouse button only */
6919				var btnClass=$(this).attr("class");
6920				seq.type=o.scrollButtons.scrollType;
6921				switch(e.type){
6922					case "mousedown": case "touchstart": case "pointerdown": case "MSPointerDown":
6923						if(seq.type==="stepped"){return;}
6924						touchActive=true;
6925						d.tweenRunning=false;
6926						_seq("on",btnClass);
6927						break;
6928					case "mouseup": case "touchend": case "pointerup": case "MSPointerUp":
6929					case "mouseout": case "pointerout": case "MSPointerOut":
6930						if(seq.type==="stepped"){return;}
6931						touchActive=false;
6932						if(seq.dir){_seq("off",btnClass);}
6933						break;
6934					case "click":
6935						if(seq.type!=="stepped" || d.tweenRunning){return;}
6936						_seq("on",btnClass);
6937						break;
6938				}
6939				function _seq(a,c){
6940					seq.scrollAmount=o.scrollButtons.scrollAmount;
6941					_sequentialScroll($this,a,c);
6942				}
6943			});
6944		},
6945		/* -------------------- */
6946		
6947		
6948		/* 
6949		KEYBOARD EVENTS
6950		scrolls content via keyboard 
6951		Keys: up arrow, down arrow, left arrow, right arrow, PgUp, PgDn, Home, End
6952		*/
6953		_keyboard=function(){
6954			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
6955				namespace=pluginPfx+"_"+d.idx,
6956				mCustomScrollBox=$("#mCSB_"+d.idx),
6957				mCSB_container=$("#mCSB_"+d.idx+"_container"),
6958				wrapper=mCSB_container.parent(),
6959				editables="input,textarea,select,datalist,keygen,[contenteditable='true']",
6960				iframe=mCSB_container.find("iframe"),
6961				events=["blur."+namespace+" keydown."+namespace+" keyup."+namespace];
6962			if(iframe.length){
6963				iframe.each(function(){
6964					$(this).bind("load",function(){
6965						/* bind events on accessible iframes */
6966						if(_canAccessIFrame(this)){
6967							$(this.contentDocument || this.contentWindow.document).bind(events[0],function(e){
6968								_onKeyboard(e);
6969							});
6970						}
6971					});
6972				});
6973			}
6974			mCustomScrollBox.attr("tabindex","0").bind(events[0],function(e){
6975				_onKeyboard(e);
6976			});
6977			function _onKeyboard(e){
6978				switch(e.type){
6979					case "blur":
6980						if(d.tweenRunning && seq.dir){_seq("off",null);}
6981						break;
6982					case "keydown": case "keyup":
6983						var code=e.keyCode ? e.keyCode : e.which,action="on";
6984						if((o.axis!=="x" && (code===38 || code===40)) || (o.axis!=="y" && (code===37 || code===39))){
6985							/* up (38), down (40), left (37), right (39) arrows */
6986							if(((code===38 || code===40) && !d.overflowed[0]) || ((code===37 || code===39) && !d.overflowed[1])){return;}
6987							if(e.type==="keyup"){action="off";}
6988							if(!$(document.activeElement).is(editables)){
6989								e.preventDefault();
6990								e.stopImmediatePropagation();
6991								_seq(action,code);
6992							}
6993						}else if(code===33 || code===34){
6994							/* PgUp (33), PgDn (34) */
6995							if(d.overflowed[0] || d.overflowed[1]){
6996								e.preventDefault();
6997								e.stopImmediatePropagation();
6998							}
6999							if(e.type==="keyup"){
7000								_stop($this);
7001								var keyboardDir=code===34 ? -1 : 1;
7002								if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){
7003									var dir="x",to=Math.abs(mCSB_container[0].offsetLeft)-(keyboardDir*(wrapper.width()*0.9));
7004								}else{
7005									var dir="y",to=Math.abs(mCSB_container[0].offsetTop)-(keyboardDir*(wrapper.height()*0.9));
7006								}
7007								_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
7008							}
7009						}else if(code===35 || code===36){
7010							/* End (35), Home (36) */
7011							if(!$(document.activeElement).is(editables)){
7012								if(d.overflowed[0] || d.overflowed[1]){
7013									e.preventDefault();
7014									e.stopImmediatePropagation();
7015								}
7016								if(e.type==="keyup"){
7017									if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){
7018										var dir="x",to=code===35 ? Math.abs(wrapper.width()-mCSB_container.outerWidth(false)) : 0;
7019									}else{
7020										var dir="y",to=code===35 ? Math.abs(wrapper.height()-mCSB_container.outerHeight(false)) : 0;
7021									}
7022									_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
7023								}
7024							}
7025						}
7026						break;
7027				}
7028				function _seq(a,c){
7029					seq.type=o.keyboard.scrollType;
7030					seq.scrollAmount=o.keyboard.scrollAmount;
7031					if(seq.type==="stepped" && d.tweenRunning){return;}
7032					_sequentialScroll($this,a,c);
7033				}
7034			}
7035		},
7036		/* -------------------- */
7037		
7038		
7039		/* scrolls content sequentially (used when scrolling via buttons, keyboard arrows etc.) */
7040		_sequentialScroll=function(el,action,trigger,e,s){
7041			var d=el.data(pluginPfx),o=d.opt,seq=d.sequential,
7042				mCSB_container=$("#mCSB_"+d.idx+"_container"),
7043				once=seq.type==="stepped" ? true : false,
7044				steplessSpeed=o.scrollInertia < 26 ? 26 : o.scrollInertia, /* 26/1.5=17 */
7045				steppedSpeed=o.scrollInertia < 1 ? 17 : o.scrollInertia;
7046			switch(action){
7047				case "on":
7048					seq.dir=[
7049						(trigger===classes[16] || trigger===classes[15] || trigger===39 || trigger===37 ? "x" : "y"),
7050						(trigger===classes[13] || trigger===classes[15] || trigger===38 || trigger===37 ? -1 : 1)
7051					];
7052					_stop(el);
7053					if(_isNumeric(trigger) && seq.type==="stepped"){return;}
7054					_on(once);
7055					break;
7056				case "off":
7057					_off();
7058					if(once || (d.tweenRunning && seq.dir)){
7059						_on(true);
7060					}
7061					break;
7062			}
7063			
7064			/* starts sequence */
7065			function _on(once){
7066				if(o.snapAmount){seq.scrollAmount=!(o.snapAmount instanceof Array) ? o.snapAmount : seq.dir[0]==="x" ? o.snapAmount[1] : o.snapAmount[0];} /* scrolling snapping */
7067				var c=seq.type!=="stepped", /* continuous scrolling */
7068					t=s ? s : !once ? 1000/60 : c ? steplessSpeed/1.5 : steppedSpeed, /* timer */
7069					m=!once ? 2.5 : c ? 7.5 : 40, /* multiplier */
7070					contentPos=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)],
7071					ratio=[d.scrollRatio.y>10 ? 10 : d.scrollRatio.y,d.scrollRatio.x>10 ? 10 : d.scrollRatio.x],
7072					amount=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*(ratio[1]*m)) : contentPos[0]+(seq.dir[1]*(ratio[0]*m)),
7073					px=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*parseInt(seq.scrollAmount)) : contentPos[0]+(seq.dir[1]*parseInt(seq.scrollAmount)),
7074					to=seq.scrollAmount!=="auto" ? px : amount,
7075					easing=e ? e : !once ? "mcsLinear" : c ? "mcsLinearOut" : "mcsEaseInOut",
7076					onComplete=!once ? false : true;
7077				if(once && t<17){
7078					to=seq.dir[0]==="x" ? contentPos[1] : contentPos[0];
7079				}
7080				_scrollTo(el,to.toString(),{dir:seq.dir[0],scrollEasing:easing,dur:t,onComplete:onComplete});
7081				if(once){
7082					seq.dir=false;
7083					return;
7084				}
7085				clearTimeout(seq.step);
7086				seq.step=setTimeout(function(){
7087					_on();
7088				},t);
7089			}
7090			/* stops sequence */
7091			function _off(){
7092				clearTimeout(seq.step);
7093				_delete(seq,"step");
7094				_stop(el);
7095			}
7096		},
7097		/* -------------------- */
7098		
7099		
7100		/* returns a yx array from value */
7101		_arr=function(val){
7102			var o=$(this).data(pluginPfx).opt,vals=[];
7103			if(typeof val==="function"){val=val();} /* check if the value is a single anonymous function */
7104			/* check if value is object or array, its length and create an array with yx values */
7105			if(!(val instanceof Array)){ /* object value (e.g. {y:"100",x:"100"}, 100 etc.) */
7106				vals[0]=val.y ? val.y : val.x || o.axis==="x" ? null : val;
7107				vals[1]=val.x ? val.x : val.y || o.axis==="y" ? null : val;
7108			}else{ /* array value (e.g. [100,100]) */
7109				vals=val.length>1 ? [val[0],val[1]] : o.axis==="x" ? [null,val[0]] : [val[0],null];
7110			}
7111			/* check if array values are anonymous functions */
7112			if(typeof vals[0]==="function"){vals[0]=vals[0]();}
7113			if(typeof vals[1]==="function"){vals[1]=vals[1]();}
7114			return vals;
7115		},
7116		/* -------------------- */
7117		
7118		
7119		/* translates values (e.g. "top", 100, "100px", "#id") to actual scroll-to positions */
7120		_to=function(val,dir){
7121			if(val==null || typeof val=="undefined"){return;}
7122			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
7123				mCSB_container=$("#mCSB_"+d.idx+"_container"),
7124				wrapper=mCSB_container.parent(),
7125				t=typeof val;
7126			if(!dir){dir=o.axis==="x" ? "x" : "y";}
7127			var contentLength=dir==="x" ? mCSB_container.outerWidth(false)-wrapper.width() : mCSB_container.outerHeight(false)-wrapper.height(),
7128				contentPos=dir==="x" ? mCSB_container[0].offsetLeft : mCSB_container[0].offsetTop,
7129				cssProp=dir==="x" ? "left" : "top";
7130			switch(t){
7131				case "function": /* this currently is not used. Consider removing it */
7132					return val();
7133					break;
7134				case "object": /* js/jquery object */
7135					var obj=val.jquery ? val : $(val);
7136					if(!obj.length){return;}
7137					return dir==="x" ? _childPos(obj)[1] : _childPos(obj)[0];
7138					break;
7139				case "string": case "number":
7140					if(_isNumeric(val)){ /* numeric value */
7141						return Math.abs(val);
7142					}else if(val.indexOf("%")!==-1){ /* percentage value */
7143						return Math.abs(contentLength*parseInt(val)/100);
7144					}else if(val.indexOf("-=")!==-1){ /* decrease value */
7145						return Math.abs(contentPos-parseInt(val.split("-=")[1]));
7146					}else if(val.indexOf("+=")!==-1){ /* inrease value */
7147						var p=(contentPos+parseInt(val.split("+=")[1]));
7148						return p>=0 ? 0 : Math.abs(p);
7149					}else if(val.indexOf("px")!==-1 && _isNumeric(val.split("px")[0])){ /* pixels string value (e.g. "100px") */
7150						return Math.abs(val.split("px")[0]);
7151					}else{
7152						if(val==="top" || val==="left"){ /* special strings */
7153							return 0;
7154						}else if(val==="bottom"){
7155							return Math.abs(wrapper.height()-mCSB_container.outerHeight(false));
7156						}else if(val==="right"){
7157							return Math.abs(wrapper.width()-mCSB_container.outerWidth(false));
7158						}else if(val==="first" || val==="last"){
7159							var obj=mCSB_container.find(":"+val);
7160							return dir==="x" ? _childPos(obj)[1] : _childPos(obj)[0];
7161						}else{
7162							if($(val).length){ /* jquery selector */
7163								return dir==="x" ? _childPos($(val))[1] : _childPos($(val))[0];
7164							}else{ /* other values (e.g. "100em") */
7165								mCSB_container.css(cssProp,val);
7166								methods.update.call(null,$this[0]);
7167								return;
7168							}
7169						}
7170					}
7171					break;
7172			}
7173		},
7174		/* -------------------- */
7175		
7176		
7177		/* calls the update method automatically */
7178		_autoUpdate=function(rem){
7179			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
7180				mCSB_container=$("#mCSB_"+d.idx+"_container");
7181			if(rem){
7182				/* 
7183				removes autoUpdate timer 
7184				usage: _autoUpdate.call(this,"remove");
7185				*/
7186				clearTimeout(mCSB_container[0].autoUpdate);
7187				_delete(mCSB_container[0],"autoUpdate");
7188				return;
7189			}
7190			upd();
7191			function upd(){
7192				clearTimeout(mCSB_container[0].autoUpdate);
7193				if($this.parents("html").length===0){
7194					/* check element in dom tree */
7195					$this=null;
7196					return;
7197				}
7198				mCSB_container[0].autoUpdate=setTimeout(function(){
7199					/* update on specific selector(s) length and size change */
7200					if(o.advanced.updateOnSelectorChange){
7201						d.poll.change.n=sizesSum();
7202						if(d.poll.change.n!==d.poll.change.o){
7203							d.poll.change.o=d.poll.change.n;
7204							doUpd(3);
7205							return;
7206						}
7207					}
7208					/* update on main element and scrollbar size changes */
7209					if(o.advanced.updateOnContentResize){
7210						d.poll.size.n=$this[0].scrollHeight+$this[0].scrollWidth+mCSB_container[0].offsetHeight+$this[0].offsetHeight+$this[0].offsetWidth;
7211						if(d.poll.size.n!==d.poll.size.o){
7212							d.poll.size.o=d.poll.size.n;
7213							doUpd(1);
7214							return;
7215						}
7216					}
7217					/* update on image load */
7218					if(o.advanced.updateOnImageLoad){
7219						if(!(o.advanced.updateOnImageLoad==="auto" && o.axis==="y")){ //by default, it doesn't run on vertical content
7220							d.poll.img.n=mCSB_container.find("img").length;
7221							if(d.poll.img.n!==d.poll.img.o){
7222								d.poll.img.o=d.poll.img.n;
7223								mCSB_container.find("img").each(function(){
7224									imgLoader(this);
7225								});
7226								return;
7227							}
7228						}
7229					}
7230					if(o.advanced.updateOnSelectorChange || o.advanced.updateOnContentResize || o.advanced.updateOnImageLoad){upd();}
7231				},o.advanced.autoUpdateTimeout);
7232			}
7233			/* a tiny image loader */
7234			function imgLoader(el){
7235				if($(el).hasClass(classes[2])){doUpd(); return;}
7236				var img=new Image();
7237				function createDelegate(contextObject,delegateMethod){
7238					return function(){return delegateMethod.apply(contextObject,arguments);}
7239				}
7240				function imgOnLoad(){
7241					this.onload=null;
7242					$(el).addClass(classes[2]);
7243					doUpd(2);
7244				}
7245				img.onload=createDelegate(img,imgOnLoad);
7246				img.src=el.src;
7247			}
7248			/* returns the total height and width sum of all elements matching the selector */
7249			function sizesSum(){
7250				if(o.advanced.updateOnSelectorChange===true){o.advanced.updateOnSelectorChange="*";}
7251				var total=0,sel=mCSB_container.find(o.advanced.updateOnSelectorChange);
7252				if(o.advanced.updateOnSelectorChange && sel.length>0){sel.each(function(){total+=this.offsetHeight+this.offsetWidth;});}
7253				return total;
7254			}
7255			/* calls the update method */
7256			function doUpd(cb){
7257				clearTimeout(mCSB_container[0].autoUpdate);
7258				methods.update.call(null,$this[0],cb);
7259			}
7260		},
7261		/* -------------------- */
7262		
7263		
7264		/* snaps scrolling to a multiple of a pixels number */
7265		_snapAmount=function(to,amount,offset){
7266			return (Math.round(to/amount)*amount-offset); 
7267		},
7268		/* -------------------- */
7269		
7270		
7271		/* stops content and scrollbar animations */
7272		_stop=function(el){
7273			var d=el.data(pluginPfx),
7274				sel=$("#mCSB_"+d.idx+"_container,#mCSB_"+d.idx+"_container_wrapper,#mCSB_"+d.idx+"_dragger_vertical,#mCSB_"+d.idx+"_dragger_horizontal");
7275			sel.each(function(){
7276				_stopTween.call(this);
7277			});
7278		},
7279		/* -------------------- */
7280		
7281		
7282		/* 
7283		ANIMATES CONTENT 
7284		This is where the actual scrolling happens
7285		*/
7286		_scrollTo=function(el,to,options){
7287			var d=el.data(pluginPfx),o=d.opt,
7288				defaults={
7289					trigger:"internal",
7290					dir:"y",
7291					scrollEasing:"mcsEaseOut",
7292					drag:false,
7293					dur:o.scrollInertia,
7294					overwrite:"all",
7295					callbacks:true,
7296					onStart:true,
7297					onUpdate:true,
7298					onComplete:true
7299				},
7300				options=$.extend(defaults,options),
7301				dur=[options.dur,(options.drag ? 0 : options.dur)],
7302				mCustomScrollBox=$("#mCSB_"+d.idx),
7303				mCSB_container=$("#mCSB_"+d.idx+"_container"),
7304				wrapper=mCSB_container.parent(),
7305				totalScrollOffsets=o.callbacks.onTotalScrollOffset ? _arr.call(el,o.callbacks.onTotalScrollOffset) : [0,0],
7306				totalScrollBackOffsets=o.callbacks.onTotalScrollBackOffset ? _arr.call(el,o.callbacks.onTotalScrollBackOffset) : [0,0];
7307			d.trigger=options.trigger;
7308			if(wrapper.scrollTop()!==0 || wrapper.scrollLeft()!==0){ /* always reset scrollTop/Left */
7309				$(".mCSB_"+d.idx+"_scrollbar").css("visibility","visible");
7310				wrapper.scrollTop(0).scrollLeft(0);
7311			}
7312			if(to==="_resetY" && !d.contentReset.y){
7313				/* callbacks: onOverflowYNone */
7314				if(_cb("onOverflowYNone")){o.callbacks.onOverflowYNone.call(el[0]);}
7315				d.contentReset.y=1;
7316			}
7317			if(to==="_resetX" && !d.contentReset.x){
7318				/* callbacks: onOverflowXNone */
7319				if(_cb("onOverflowXNone")){o.callbacks.onOverflowXNone.call(el[0]);}
7320				d.contentReset.x=1;
7321			}
7322			if(to==="_resetY" || to==="_resetX"){return;}
7323			if((d.contentReset.y || !el[0].mcs) && d.overflowed[0]){
7324				/* callbacks: onOverflowY */
7325				if(_cb("onOverflowY")){o.callbacks.onOverflowY.call(el[0]);}
7326				d.contentReset.x=null;
7327			}
7328			if((d.contentReset.x || !el[0].mcs) && d.overflowed[1]){
7329				/* callbacks: onOverflowX */
7330				if(_cb("onOverflowX")){o.callbacks.onOverflowX.call(el[0]);}
7331				d.contentReset.x=null;
7332			}
7333			if(o.snapAmount){ /* scrolling snapping */
7334				var snapAmount=!(o.snapAmount instanceof Array) ? o.snapAmount : options.dir==="x" ? o.snapAmount[1] : o.snapAmount[0];
7335				to=_snapAmount(to,snapAmount,o.snapOffset);
7336			}
7337			switch(options.dir){
7338				case "x":
7339					var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_horizontal"),
7340						property="left",
7341						contentPos=mCSB_container[0].offsetLeft,
7342						limit=[
7343							mCustomScrollBox.width()-mCSB_container.outerWidth(false),
7344							mCSB_dragger.parent().width()-mCSB_dragger.width()
7345						],
7346						scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.x)],
7347						tso=totalScrollOffsets[1],
7348						tsbo=totalScrollBackOffsets[1],
7349						totalScrollOffset=tso>0 ? tso/d.scrollRatio.x : 0,
7350						totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.x : 0;
7351					break;
7352				case "y":
7353					var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_vertical"),
7354						property="top",
7355						contentPos=mCSB_container[0].offsetTop,
7356						limit=[
7357							mCustomScrollBox.height()-mCSB_container.outerHeight(false),
7358							mCSB_dragger.parent().height()-mCSB_dragger.height()
7359						],
7360						scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.y)],
7361						tso=totalScrollOffsets[0],
7362						tsbo=totalScrollBackOffsets[0],
7363						totalScrollOffset=tso>0 ? tso/d.scrollRatio.y : 0,
7364						totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.y : 0;
7365					break;
7366			}
7367			if(scrollTo[1]<0 || (scrollTo[0]===0 && scrollTo[1]===0)){
7368				scrollTo=[0,0];
7369			}else if(scrollTo[1]>=limit[1]){
7370				scrollTo=[limit[0],limit[1]];
7371			}else{
7372				scrollTo[0]=-scrollTo[0];
7373			}
7374			if(!el[0].mcs){
7375				_mcs();  /* init mcs object (once) to make it available before callbacks */
7376				if(_cb("onInit")){o.callbacks.onInit.call(el[0]);} /* callbacks: onInit */
7377			}
7378			clearTimeout(mCSB_container[0].onCompleteTimeout);
7379			_tweenTo(mCSB_dragger[0],property,Math.round(scrollTo[1]),dur[1],options.scrollEasing);
7380			if(!d.tweenRunning && ((contentPos===0 && scrollTo[0]>=0) || (contentPos===limit[0] && scrollTo[0]<=limit[0]))){return;}
7381			_tweenTo(mCSB_container[0],property,Math.round(scrollTo[0]),dur[0],options.scrollEasing,options.overwrite,{
7382				onStart:function(){
7383					if(options.callbacks && options.onStart && !d.tweenRunning){
7384						/* callbacks: onScrollStart */
7385						if(_cb("onScrollStart")){_mcs(); o.callbacks.onScrollStart.call(el[0]);}
7386						d.tweenRunning=true;
7387						_onDragClasses(mCSB_dragger);
7388						d.cbOffsets=_cbOffsets();
7389					}
7390				},onUpdate:function(){
7391					if(options.callbacks && options.onUpdate){
7392						/* callbacks: whileScrolling */
7393						if(_cb("whileScrolling")){_mcs(); o.callbacks.whileScrolling.call(el[0]);}
7394					}
7395				},onComplete:function(){
7396					if(options.callbacks && options.onComplete){
7397						if(o.axis==="yx"){clearTimeout(mCSB_container[0].onCompleteTimeout);}
7398						var t=mCSB_container[0].idleTimer || 0;
7399						mCSB_container[0].onCompleteTimeout=setTimeout(function(){
7400							/* callbacks: onScroll, onTotalScroll, onTotalScrollBack */
7401							if(_cb("onScroll")){_mcs(); o.callbacks.onScroll.call(el[0]);}
7402							if(_cb("onTotalScroll") && scrollTo[1]>=limit[1]-totalScrollOffset && d.cbOffsets[0]){_mcs(); o.callbacks.onTotalScroll.call(el[0]);}
7403							if(_cb("onTotalScrollBack") && scrollTo[1]<=totalScrollBackOffset && d.cbOffsets[1]){_mcs(); o.callbacks.onTotalScrollBack.call(el[0]);}
7404							d.tweenRunning=false;
7405							mCSB_container[0].idleTimer=0;
7406							_onDragClasses(mCSB_dragger,"hide");
7407						},t);
7408					}
7409				}
7410			});
7411			/* checks if callback function exists */
7412			function _cb(cb){
7413				return d && o.callbacks[cb] && typeof o.callbacks[cb]==="function";
7414			}
7415			/* checks whether callback offsets always trigger */
7416			function _cbOffsets(){
7417				return [o.callbacks.alwaysTriggerOffsets || contentPos>=limit[0]+tso,o.callbacks.alwaysTriggerOffsets || contentPos<=-tsbo];
7418			}
7419			/* 
7420			populates object with useful values for the user 
7421			values: 
7422				content: this.mcs.content
7423				content top position: this.mcs.top 
7424				content left position: this.mcs.left 
7425				dragger top position: this.mcs.draggerTop 
7426				dragger left position: this.mcs.draggerLeft 
7427				scrolling y percentage: this.mcs.topPct 
7428				scrolling x percentage: this.mcs.leftPct 
7429				scrolling direction: this.mcs.direction
7430			*/
7431			function _mcs(){
7432				var cp=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft], /* content position */
7433					dp=[mCSB_dragger[0].offsetTop,mCSB_dragger[0].offsetLeft], /* dragger position */
7434					cl=[mCSB_container.outerHeight(false),mCSB_container.outerWidth(false)], /* content length */
7435					pl=[mCustomScrollBox.height(),mCustomScrollBox.width()]; /* content parent length */
7436				el[0].mcs={
7437					content:mCSB_container, /* original content wrapper as jquery object */
7438					top:cp[0],left:cp[1],draggerTop:dp[0],draggerLeft:dp[1],
7439					topPct:Math.round((100*Math.abs(cp[0]))/(Math.abs(cl[0])-pl[0])),leftPct:Math.round((100*Math.abs(cp[1]))/(Math.abs(cl[1])-pl[1])),
7440					direction:options.dir
7441				};
7442				/* 
7443				this refers to the original element containing the scrollbar(s)
7444				usage: this.mcs.top, this.mcs.leftPct etc. 
7445				*/
7446			}
7447		},
7448		/* -------------------- */
7449		
7450		
7451		/* 
7452		CUSTOM JAVASCRIPT ANIMATION TWEEN 
7453		Lighter and faster than jquery animate() and css transitions 
7454		Animates top/left properties and includes easings 
7455		*/
7456		_tweenTo=function(el,prop,to,duration,easing,overwrite,callbacks){
7457			if(!el._mTween){el._mTween={top:{},left:{}};}
7458			var callbacks=callbacks || {},
7459				onStart=callbacks.onStart || function(){},onUpdate=callbacks.onUpdate || function(){},onComplete=callbacks.onComplete || function(){},
7460				startTime=_getTime(),_delay,progress=0,from=el.offsetTop,elStyle=el.style,_request,tobj=el._mTween[prop];
7461			if(prop==="left"){from=el.offsetLeft;}
7462			var diff=to-from;
7463			tobj.stop=0;
7464			if(overwrite!=="none"){_cancelTween();}
7465			_startTween();
7466			function _step(){
7467				if(tobj.stop){return;}
7468				if(!progress){onStart.call();}
7469				progress=_getTime()-startTime;
7470				_tween();
7471				if(progress>=tobj.time){
7472					tobj.time=(progress>tobj.time) ? progress+_delay-(progress-tobj.time) : progress+_delay-1;
7473					if(tobj.time<progress+1){tobj.time=progress+1;}
7474				}
7475				if(tobj.time<duration){tobj.id=_request(_step);}else{onComplete.call();}
7476			}
7477			function _tween(){
7478				if(duration>0){
7479					tobj.currVal=_ease(tobj.time,from,diff,duration,easing);
7480					elStyle[prop]=Math.round(tobj.currVal)+"px";
7481				}else{
7482					elStyle[prop]=to+"px";
7483				}
7484				onUpdate.call();
7485			}
7486			function _startTween(){
7487				_delay=1000/60;
7488				tobj.time=progress+_delay;
7489				_request=(!window.requestAnimationFrame) ? function(f){_tween(); return setTimeout(f,0.01);} : window.requestAnimationFrame;
7490				tobj.id=_request(_step);
7491			}
7492			function _cancelTween(){
7493				if(tobj.id==null){return;}
7494				if(!window.requestAnimationFrame){clearTimeout(tobj.id);
7495				}else{window.cancelAnimationFrame(tobj.id);}
7496				tobj.id=null;
7497			}
7498			function _ease(t,b,c,d,type){
7499				switch(type){
7500					case "linear": case "mcsLinear":
7501						return c*t/d + b;
7502						break;
7503					case "mcsLinearOut":
7504						t/=d; t--; return c * Math.sqrt(1 - t*t) + b;
7505						break;
7506					case "easeInOutSmooth":
7507						t/=d/2;
7508						if(t<1) return c/2*t*t + b;
7509						t--;
7510						return -c/2 * (t*(t-2) - 1) + b;
7511						break;
7512					case "easeInOutStrong":
7513						t/=d/2;
7514						if(t<1) return c/2 * Math.pow( 2, 10 * (t - 1) ) + b;
7515						t--;
7516						return c/2 * ( -Math.pow( 2, -10 * t) + 2 ) + b;
7517						break;
7518					case "easeInOut": case "mcsEaseInOut":
7519						t/=d/2;
7520						if(t<1) return c/2*t*t*t + b;
7521						t-=2;
7522						return c/2*(t*t*t + 2) + b;
7523						break;
7524					case "easeOutSmooth":
7525						t/=d; t--;
7526						return -c * (t*t*t*t - 1) + b;
7527						break;
7528					case "easeOutStrong":
7529						return c * ( -Math.pow( 2, -10 * t/d ) + 1 ) + b;
7530						break;
7531					case "easeOut": case "mcsEaseOut": default:
7532						var ts=(t/=d)*t,tc=ts*t;
7533						return b+c*(0.499999999999997*tc*ts + -2.5*ts*ts + 5.5*tc + -6.5*ts + 4*t);
7534				}
7535			}
7536		},
7537		/* -------------------- */
7538		
7539		
7540		/* returns current time */
7541		_getTime=function(){
7542			if(window.performance && window.performance.now){
7543				return window.performance.now();
7544			}else{
7545				if(window.performance && window.performance.webkitNow){
7546					return window.performance.webkitNow();
7547				}else{
7548					if(Date.now){return Date.now();}else{return new Date().getTime();}
7549				}
7550			}
7551		},
7552		/* -------------------- */
7553		
7554		
7555		/* stops a tween */
7556		_stopTween=function(){
7557			var el=this;
7558			if(!el._mTween){el._mTween={top:{},left:{}};}
7559			var props=["top","left"];
7560			for(var i=0; i<props.length; i++){
7561				var prop=props[i];
7562				if(el._mTween[prop].id){
7563					if(!window.requestAnimationFrame){clearTimeout(el._mTween[prop].id);
7564					}else{window.cancelAnimationFrame(el._mTween[prop].id);}
7565					el._mTween[prop].id=null;
7566					el._mTween[prop].stop=1;
7567				}
7568			}
7569		},
7570		/* -------------------- */
7571		
7572		
7573		/* deletes a property (avoiding the exception thrown by IE) */
7574		_delete=function(c,m){
7575			try{delete c[m];}catch(e){c[m]=null;}
7576		},
7577		/* -------------------- */
7578		
7579		
7580		/* detects left mouse button */
7581		_mouseBtnLeft=function(e){
7582			return !(e.which && e.which!==1);
7583		},
7584		/* -------------------- */
7585		
7586		
7587		/* detects if pointer type event is touch */
7588		_pointerTouch=function(e){
7589			var t=e.originalEvent.pointerType;
7590			return !(t && t!=="touch" && t!==2);
7591		},
7592		/* -------------------- */
7593		
7594		
7595		/* checks if value is numeric */
7596		_isNumeric=function(val){
7597			return !isNaN(parseFloat(val)) && isFinite(val);
7598		},
7599		/* -------------------- */
7600		
7601		
7602		/* returns element position according to content */
7603		_childPos=function(el){
7604			var p=el.parents(".mCSB_container");
7605			return [el.offset().top-p.offset().top,el.offset().left-p.offset().left];
7606		},
7607		/* -------------------- */
7608		
7609		
7610		/* checks if browser tab is hidden/inactive via Page Visibility API */
7611		_isTabHidden=function(){
7612			var prop=_getHiddenProp();
7613			if(!prop) return false;
7614			return document[prop];
7615			function _getHiddenProp(){
7616				var pfx=["webkit","moz","ms","o"];
7617				if("hidden" in document) return "hidden"; //natively supported
7618				for(var i=0; i<pfx.length; i++){ //prefixed
7619				    if((pfx[i]+"Hidden") in document) 
7620				        return pfx[i]+"Hidden";
7621				}
7622				return null; //not supported
7623			}
7624		};
7625		/* -------------------- */
7626		
7627	
7628	
7629	
7630	
7631	/* 
7632	----------------------------------------
7633	PLUGIN SETUP 
7634	----------------------------------------
7635	*/
7636	
7637	/* plugin constructor functions */
7638	$.fn[pluginNS]=function(method){ /* usage: $(selector).mCustomScrollbar(); */
7639		if(methods[method]){
7640			return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
7641		}else if(typeof method==="object" || !method){
7642			return methods.init.apply(this,arguments);
7643		}else{
7644			$.error("Method "+method+" does not exist");
7645		}
7646	};
7647	$[pluginNS]=function(method){ /* usage: $.mCustomScrollbar(); */
7648		if(methods[method]){
7649			return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
7650		}else if(typeof method==="object" || !method){
7651			return methods.init.apply(this,arguments);
7652		}else{
7653			$.error("Method "+method+" does not exist");
7654		}
7655	};
7656	
7657	/* 
7658	allow setting plugin default options. 
7659	usage: $.mCustomScrollbar.defaults.scrollInertia=500; 
7660	to apply any changed default options on default selectors (below), use inside document ready fn 
7661	e.g.: $(document).ready(function(){ $.mCustomScrollbar.defaults.scrollInertia=500; });
7662	*/
7663	$[pluginNS].defaults=defaults;
7664	
7665	/* 
7666	add window object (window.mCustomScrollbar) 
7667	usage: if(window.mCustomScrollbar){console.log("custom scrollbar plugin loaded");}
7668	*/
7669	window[pluginNS]=true;
7670	
7671	$(window).bind("load",function(){
7672		
7673		$(defaultSelector)[pluginNS](); /* add scrollbars automatically on default selector */
7674		
7675		/* extend jQuery expressions */
7676		$.extend($.expr[":"],{
7677			/* checks if element is within scrollable viewport */
7678			mcsInView:$.expr[":"].mcsInView || function(el){
7679				var $el=$(el),content=$el.parents(".mCSB_container"),wrapper,cPos;
7680				if(!content.length){return;}
7681				wrapper=content.parent();
7682				cPos=[content[0].offsetTop,content[0].offsetLeft];
7683				return 	cPos[0]+_childPos($el)[0]>=0 && cPos[0]+_childPos($el)[0]<wrapper.height()-$el.outerHeight(false) && 
7684						cPos[1]+_childPos($el)[1]>=0 && cPos[1]+_childPos($el)[1]<wrapper.width()-$el.outerWidth(false);
7685			},
7686			/* checks if element or part of element is in view of scrollable viewport */
7687			mcsInSight:$.expr[":"].mcsInSight || function(el,i,m){
7688				var $el=$(el),elD,content=$el.parents(".mCSB_container"),wrapperView,pos,wrapperViewPct,
7689					pctVals=m[3]==="exact" ? [[1,0],[1,0]] : [[0.9,0.1],[0.6,0.4]];
7690				if(!content.length){return;}
7691				elD=[$el.outerHeight(false),$el.outerWidth(false)];
7692				pos=[content[0].offsetTop+_childPos($el)[0],content[0].offsetLeft+_childPos($el)[1]];
7693				wrapperView=[content.parent()[0].offsetHeight,content.parent()[0].offsetWidth];
7694				wrapperViewPct=[elD[0]<wrapperView[0] ? pctVals[0] : pctVals[1],elD[1]<wrapperView[1] ? pctVals[0] : pctVals[1]];
7695				return 	pos[0]-(wrapperView[0]*wrapperViewPct[0][0])<0 && pos[0]+elD[0]-(wrapperView[0]*wrapperViewPct[0][1])>=0 && 
7696						pos[1]-(wrapperView[1]*wrapperViewPct[1][0])<0 && pos[1]+elD[1]-(wrapperView[1]*wrapperViewPct[1][1])>=0;
7697			},
7698			/* checks if element is overflowed having visible scrollbar(s) */
7699			mcsOverflow:$.expr[":"].mcsOverflow || function(el){
7700				var d=$(el).data(pluginPfx);
7701				if(!d){return;}
7702				return d.overflowed[0] || d.overflowed[1];
7703			}
7704		});
7705	
7706	});
7707
7708}))}));
7709/* End */
7710;
7711; /* Start:"a:4:{s:4:"full";s:84:"/bitrix/templates/aspro-allcorp2/js/jquery.mobile.custom.touch.min.js?17182808737684";s:6:"source";s:69:"/bitrix/templates/aspro-allcorp2/js/jquery.mobile.custom.touch.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
7712/*! jQuery Mobile v1.4.5 | Copyright 2010, 2014 jQuery Foundation, Inc. | jquery.org/license */
7713!function(e,t,n){"function"==typeof define&&define.amd?define(["jquery"],(function(r){return n(r,e,t),r.mobile})):n(e.jQuery,e,t)}(this,document,(function(e,t,n,r){(function(e,t,n,r){function T(e){for(;e&&void 0!==e.originalEvent;)e=e.originalEvent;return e}function N(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;if((t=e.Event(t)).type=n,s=t.originalEvent,o=e.event.props,i.search(/^(mouse|click)/)>-1&&(o=f),s)for(p=o.length;p;)t[l=o[--p]]=s[l];if(i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1),-1!==i.search(/^touch/)&&(i=(a=T(s)).touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r))for(d=0,v=u.length;d<v;d++)t[l=u[d]]=h[l];return t}function C(t){for(var n={},r,s;t;){for(s in r=e.data(t,i))r[s]&&(n[s]=n.hasVirtualBinding=!0);t=t.parentNode}return n}function k(t,n){for(var r;t;){if((r=e.data(t,i))&&(!n||r[n]))return t;t=t.parentNode}return null}function L(){g=!1}function A(){g=!0}function O(){E=0,v.length=0,m=!1,A()}function M(){L()}function _(){D(),c=setTimeout((function(){c=0,O()}),e.vmouse.resetTimerDuration)}function D(){c&&(clearTimeout(c),c=0)}function P(t,n,r){var i;return(r&&r[t]||!r&&k(n.target,t))&&(i=N(n,t),e(n.target).trigger(i)),i}function H(t){var n=e.data(t.target,s),r;!m&&(!E||E!==n)&&((r=P("v"+t.type,t))&&(r.isDefaultPrevented()&&t.preventDefault(),r.isPropagationStopped()&&t.stopPropagation(),r.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function B(t){var n=T(t).touches,r,i,o;n&&1===n.length&&((i=C(r=t.target)).hasVirtualBinding&&(E=w++,e.data(r,s,E),D(),M(),d=!1,o=T(t).touches[0],h=o.pageX,p=o.pageY,P("vmouseover",t,i),P("vmousedown",t,i)))}
7713function j(e){g||(d||P("vmousecancel",e,C(e.target)),d=!0,_())}function F(t){if(!g){var n=T(t).touches[0],r=d,i=e.vmouse.moveDistanceThreshold,s=C(t.target);(d=d||Math.abs(n.pageX-h)>i||Math.abs(n.pageY-p)>i)&&!r&&P("vmousecancel",t,s),P("vmousemove",t,s),_()}}function I(e){if(!g){A();var t=C(e.target),n,r;P("vmouseup",e,t),d||(n=P("vclick",e,t))&&n.isDefaultPrevented()&&(r=T(e).changedTouches[0],v.push({touchID:E,x:r.clientX,y:r.clientY}),m=!0),P("vmouseout",e,t),d=!1,_()}}function q(t){var n=e.data(t,i),r;if(n)for(r in n)if(n[r])return!0;return!1}function R(){}function U(t){var n=t.substr(1);return{setup:function(){var r;q(this)||e.data(this,i,{}),e.data(this,i)[t]=!0,l[t]=(l[t]||0)+1,1===l[t]&&b.bind(n,H),e(this).bind(n,R),y&&(l.touchstart=(l.touchstart||0)+1,1===l.touchstart&&b.bind("touchstart",B).bind("touchend",I).bind("touchmove",F).bind("scroll",j))},teardown:function(){--l[t],l[t]||b.unbind(n,H),y&&(--l.touchstart,l.touchstart||b.unbind("touchstart",B).unbind("touchmove",F).unbind("touchend",I).unbind("scroll",j));var r=e(this),s=e.data(this,i);s&&(s[t]=!1),r.unbind(n,R),q(this)||r.removeData(i)}}}var i="virtualMouseBindings",s="virtualTouchID",o="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),u="clientX clientY pageX pageY screenX screenY".split(" "),a=e.event.mouseHooks?e.event.mouseHooks.props:[],l={},c=0,h=0,p=0,d=!1,v=[],m=!1,g=!1,y="addEventListener"in n,b=e(n),w=1,E=0,S,x;for(e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500},x=0;x<o.length;x++)e.event.special[o[x]]=U(o[x]);y&&n.addEventListener("click",(function(t){var n=v.length,r=t.target,i,o,u,a,f,l;if(n)for(i=t.clientX,o=t.clientY,S=e.vmouse.clickDistanceThreshold,u=r;u;){for(a=0;a<n;a++)if(f=v[a],l=0,u===r&&Math.abs(f.x-i)<S&&Math.abs(f.y-o)<S||e.data(u,s)===f.touchID)return t.preventDefault(),void t.stopPropagation();u=u.parentNode}}),!0)})(e,t,n),function(e){e.mobile={}}(e),function(e,t){var r={touch:"ontouchend"in n};e.mobile.support=e.mobile.support||{},e.extend(e.support,r),e.extend(e.mobile.support,r)}(e),function(e,t,r){function l(t,n,i,s){var o=i.type;i.type=n,s?e.event.trigger(i,r,t):e.event.dispatch.call(t,i),i.type=o}var i=e(n),s=e.mobile.support.touch,o="touchmove scroll",u=s?"touchstart":"mousedown",a=s?"touchend":"mouseup",f=s?"touchmove":"mousemove";e.each("touchstart touchmove touchend tap taphold swipe swipeleft swiperight scrollstart scrollstop".split(" "),(function(t,n){e.fn[n]=function(e){return e?this.bind(n,e):this.trigger(n)},e.attrFn&&(e.attrFn[n]=!0)})),e.event.special.scrollstart={enabled:!0,setup:function(){function s(e,n){l(t,(r=n)?"scrollstart":"scrollstop",e)}var t=this,n,r,i;e(t).bind(o,(function(t){e.event.special.scrollstart.enabled&&(r||s(t,!0),clearTimeout(i),i=setTimeout((function(){s(t,!1)}),50))}))},teardown:function(){e(this).unbind(o)}},e.event.special.tap={tapholdThreshold:750,emitTapOnTaphold:!0,setup:function(){var t=this,n=e(t),r=!1;n.bind("vmousedown",(function(s){function a(){clearTimeout(u)}function f(){a(),n.unbind("vclick",c).unbind("vmouseup",a),i.unbind("vmousecancel",f)}function c(e){f(),r||o!==e.target?r&&e.preventDefault():l(t,"tap",e)}if(r=!1,s.which&&1!==s.which)return!1;var o=s.target,u;n.bind("vmouseup",a).bind("vclick",c),i.bind("vmousecancel",f),u=setTimeout((function(){e.event.special.tap.emitTapOnTaphold||(r=!0),l(t,"taphold",e.Event("taphold",{target:o}))}),e.event.special.tap.tapholdThreshold)}))},teardown:function(){e(this).unbind("vmousedown").unbind("vclick").unbind("vmouseup"),i.unbind("vmousecancel")}},e.event.special.swipe={scrollSupressionThreshold:30,durationThreshold:1e3,horizontalDistanceThreshold:30,verticalDistanceThreshold:30,getLocation:function(e){var n=t.pageXOffset,r=t.pageYOffset,i=e.clientX,s=e.clientY;return 0===e.pageY&&Math.floor(s)>Math.floor(e.pageY)||0===e.pageX&&Math.floor(i)>Math.floor(e.pageX)?(i-=n,s-=r):(s<e.pageY-r||i<e.pageX-n)&&(i=e.pageX-n,s=e.pageY-r),{x:i,y:s}},start:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y],origin:e(t.target)}},stop:function(t){var n=t.originalEvent.touches?t.originalEvent.touches[0]:t,r=e.event.special.swipe.getLocation(n);return{time:(new Date).getTime(),coords:[r.x,r.y]}},handleSwipe:function(t,n,r,i){if(n.time-t.time<e.event.special.swipe.durationThreshold&&Math.abs(t.coords[0]-n.
7713coords[0])>e.event.special.swipe.horizontalDistanceThreshold&&Math.abs(t.coords[1]-n.coords[1])<e.event.special.swipe.verticalDistanceThreshold){var s=t.coords[0]>n.coords[0]?"swipeleft":"swiperight";return l(r,"swipe",e.Event("swipe",{target:i,swipestart:t,swipestop:n}),!0),l(r,s,e.Event(s,{target:i,swipestart:t,swipestop:n}),!0),!0}return!1},eventInProgress:!1,setup:function(){var t,n=this,r=e(n),s={};(t=e.data(this,"mobile-events"))||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=s,s.start=function(t){if(!e.event.special.swipe.eventInProgress){e.event.special.swipe.eventInProgress=!0;var r,o=e.event.special.swipe.start(t),u=t.target,l=!1;s.move=function(t){o&&!t.isDefaultPrevented()&&(r=e.event.special.swipe.stop(t),l||(l=e.event.special.swipe.handleSwipe(o,r,n,u))&&(e.event.special.swipe.eventInProgress=!1),Math.abs(o.coords[0]-r.coords[0]),e.event.special.swipe.scrollSupressionThreshold)},s.stop=function(){l=!0,e.event.special.swipe.eventInProgress=!1,i.off(f,s.move),s.move=null},i.on(f,s.move).one(a,s.stop)}},r.on(u,s.start)},teardown:function(){var t,n;(t=e.data(this,"mobile-events"))&&(n=t.swipe,delete t.swipe,t.length--,0===t.length&&e.removeData(this,"mobile-events")),n&&(n.start&&e(this).off(u,n.start),n.move&&i.off(f,n.move),n.stop&&i.off(a,n.stop))}},e.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe.left",swiperight:"swipe.right"},(function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)},teardown:function(){e(this).unbind(n)}}}))}(e,this)}));
7714/* End */
7715;
7716; /* Start:"a:4:{s:4:"full";s:83:"/bitrix/templates/aspro-allcorp2/js/bootstrap-datetimepicker.min.js?171828087339221";s:6:"source";s:67:"/bitrix/templates/aspro-allcorp2/js/bootstrap-datetimepicker.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
7717(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a)}else{if(typeof exports==="object"){a(require("jquery"))}else{a(jQuery)}}}(function(d,f){if(!("indexOf" in Array.prototype)){Array.prototype.indexOf=function(k,j){if(j===f){j=0}if(j<0){j+=this.length}if(j<0){j=0}for(var l=this.length;j<l;j++){if(j in this&&this[j]===k){return j}}return -1}}function a(){var q,k,p,l,j,n,m,o;k=(new Date()).toString();p=((m=k.split("(")[1])!=null?m.slice(0,-1):0)||k.split(" ");if(p instanceof Array){n=[];for(var l=0,j=p.length;l<j;l++){o=p[l];if((q=(m=o.match(/\b[A-Z]+\b/))!==null)?m[0]:0){n.push(q)}}p=n.pop()}return p}function h(){return new Date(Date.UTC.apply(Date,arguments))}var g=function(k,j){var m=this;this.element=d(k);this.container=j.container||"body";this.language=j.language||this.element.data("date-language")||"en";this.language=this.language in e?this.language:this.language.split("-")[0];this.language=this.language in e?this.language:"en";this.isRTL=e[this.language].rtl||false;this.formatType=j.formatType||this.element.data("format-type")||"standard";this.format=c.parseFormat(j.format||this.element.data("date-format")||e[this.language].format||c.getDefaultFormat(this.formatType,"input"),this.formatType);this.isInline=false;this.isVisible=false;this.isInput=this.element.is("input");this.fontAwesome=j.fontAwesome||this.element.data("font-awesome")||false;this.bootcssVer=j.bootcssVer||(this.isInput?(this.element.is(".form-control")?3:2):(this.bootcssVer=this.element.is(".input-group")?3:2));this.component=this.element.is(".date")?(this.bootcssVer===3?this.element.find(".input-group-addon .glyphicon-th, .input-group-addon .glyphicon-time, .input-group-addon .glyphicon-remove, .input-group-addon .glyphicon-calendar, .input-group-addon .fa-calendar, .input-group-addon .fa-clock-o").parent():this.element.find(".add-on .icon-th, .add-on .icon-time, .add-on .icon-calendar, .add-on .fa-calendar, .add-on .fa-clock-o").parent()):false;this.componentReset=this.element.is(".date")?(this.bootcssVer===3?this.element.find(".input-group-addon .glyphicon-remove, .input-group-addon .fa-times").parent():this.element.find(".add-on .icon-remove, .add-on .fa-times").parent()):false;this.hasInput=this.component&&this.element.find("input").length;if(this.component&&this.component.length===0){this.component=false}this.linkField=j.linkField||this.element.data("link-field")||false;this.linkFormat=c.parseFormat(j.linkFormat||this.element.data("link-format")||c.getDefaultFormat(this.formatType,"link"),this.formatType);this.minuteStep=j.minuteStep||this.element.data("minute-step")||5;this.pickerPosition=j.pickerPosition||this.element.data("picker-position")||"bottom-right";this.showMeridian=j.showMeridian||this.element.data("show-meridian")||false;this.initialDate=j.initialDate||new Date();this.zIndex=j.zIndex||this.element.data("z-index")||f;this.title=typeof j.title==="undefined"?false:j.title;this.timezone=j.timezone||a();this.icons={leftArrow:this.fontAwesome?"fa-arrow-left":(this.bootcssVer===3?"glyphicon-arrow-left":"icon-arrow-left"),rightArrow:this.fontAwesome?"fa-arrow-right":(this.bootcssVer===3?"glyphicon-arrow-right":"icon-arrow-right")};this.icontype=this.fontAwesome?"fa":"glyphicon";this._attachEvents();this.clickedOutside=function(n){if(d(n.target).closest(".datetimepicker").length===0){m.hide()}};this.formatViewType="datetime";if("formatViewType" in j){this.formatViewType=j.formatViewType}else{if("formatViewType" in this.element.data()){this.formatViewType=this.element.data("formatViewType")}}this.minView=0;if("minView" in j){this.minView=j.minView}else{if("minView" in this.element.data()){this.minView=this.element.data("min-view")}}this.minView=c.convertViewMode(this.minView);this.maxView=c.modes.length-1;if("maxView" in j){this.maxView=j.maxView}else{if("maxView" in this.element.data()){this.maxView=this.element.data("max-view")}}this.maxView=c.convertViewMode(this.maxView);this.wheelViewModeNavigation=false;if("wheelViewModeNavigation" in j){this.wheelViewModeNavigation=j.wheelViewModeNavigation}else{if("wheelViewModeNavigation" in this.element.data()){this.wheelViewModeNavigation=this.element.data("view-mode-wheel-navigation")}}this.wheelViewModeNavigationInverseDirection=false;if("wheelViewModeNavigationInverseDirection" in j){this.wheelViewModeNavigationInverseDirection=j.wheelViewModeNavigationInverseDirection}else{if("wheelViewModeNavigationInverseDirection" in this.element.data()){this.wheelViewModeNavigationInverseDirection=this.element.data("view-mode-wheel-navigation-inverse-dir")}}this.wheelViewModeNavigationDelay=100;if("wheelViewModeNavigationDelay" in j){this.wheelViewModeNavigationDelay=j.wheelViewModeNavigationDelay}else{if("wheelViewModeNavigationDelay" in this.element.data()){this.wheelViewModeNavigationDelay=this.element.data("view-mode-wheel-navigation-delay")}}this.startViewMode=2;if("startView" in j){this.startViewMode=j.startView}else{if("startView" in this.element.data()){this.startViewMode=this.element.data("start-view")}}this.startViewMode=c.convertViewMode(this.startViewMode);this.viewMode=this.startViewMode;this.viewSelect=this.minView;if("viewSelect" in j){this.viewSelect=j.viewSelect}else{if("viewSelect" in this.element.data()){this.viewSelect=this.element.data("view-select")}}this.viewSelect=c.convertViewMode(this.viewSelect);this.forceParse=true;if("forceParse" in j){this.forceParse=j.forceParse}else{if("dateForceParse" in this.element.data()){this.forceParse=this.element.data("date-force-parse")}}var l=this.bootcssVer===3?c.templateV3:c.template;while(l.indexOf("{iconType}")!==-1){l=l.replace("{iconType}",this.icontype)}while(l.indexOf("{leftArrow}")!==-1){l=l.replace("{leftArrow}",this.icons.leftArrow)}while(l.indexOf("{rightArrow}")!==-1){l=l.replace("{rightArrow}",this.icons.rightArrow)}this.picker=d(l).appendTo(this.isInline?this.element:this.container).on({click:d.proxy(this.click,this),mousedown:d.proxy(this.mousedown,this)});if(this.wheelViewModeNavigation){if(d.fn.mousewheel){this.picker.on({mousewheel:d.proxy(this.mousewheel,this)})}else{console.log("Mouse Wheel event is not supported. Please include the jQuery Mouse Wheel plugin before enabling this option")}}if(this.isInline){this.picker.addClass("datetimepicker-inline")}else{this.picker.addClass("datetimepicker-dropdown-"+this.pickerPosition+" dropdown-menu")}if(this.isRTL){this.picker.addClass("datetimepicker-rtl");var i=this.bootcssVer===3?".prev span, .next span":".prev i, .next i";this.picker.find(i).toggleClass(this.icons.leftArrow+" "+this.icons.rightArrow)}d(document).on("mousedown touchend",this.clickedOutside);this.autoclose=false;if("autoclose" in j){this.autoclose=j.autoclose}else{if("dateAutoclose" in this.element.data()){this.autoclose=this.element.data("date-autoclose")}}this.keyboardNavigation=true;if("keyboardNavigation" in j){this.keyboardNavigation=j.keyboardNavigation}else{if("dateKeyboardNavigation" in this.element.data()){this.keyboardNavigation=this.element.data("date-keyboard-navigation")}}this.todayBtn=(j.todayBtn||this.element.data("date-today-btn")||false);this.clearBtn=(j.clearBtn||this.element.data("date-clear-btn")||false);this.todayHighlight=(j.todayHighlight||this.element.data("date-today-highlight")||false);this.weekStart=0;if(typeof j.weekStart!=="undefined"){this.weekStart=j.weekStart}else{if(typeof this.element.data("date-weekstart")!=="undefined"){this.weekStart=this.element.data("date-weekstart")}else{if(typeof e[this.language].weekStart!=="undefined"){this.weekStart=e[this.language].weekStart}}}this.weekStart=this.weekStart%7;this.weekEnd=((this.weekStart+6)%7);this.onRenderDay=function(n){var p=(j.onRenderDay||function(){return[]})(n);if(typeof p==="string"){p=[p]}var o=["day"];return o.concat((p?p:[]))};this.onRenderHour=function(n){var p=(j.onRenderHour||function(){return[]})(n);var o=["hour"];if(typeof p==="string"){p=[p]}return o.concat((p?p:[]))};this.onRenderMinute=function(n){var p=(j.onRenderMinute||function(){return[]})(n);var o=["minute"];if(typeof p==="string"){p=[p]}if(n<this.startDate||n>this.endDate){o.push("disabled")}else{if(Math.floor(this.date.getUTCMinutes()/this.minuteStep)===Math.floor(n.getUTCMinutes()/this.minuteStep)){o.push("active")}}return o.concat((p?p:[]))};this.onRenderYear=function(o){var q=(j.onRenderYear||function(){return[]})(o);var p=["year"];if(typeof q==="string"){q=[q]}if(this.date.getUTCFullYear()===o.getUTCFullYear()){p.push("active")}var n=o.getUTCFullYear();var r=this.endDate.getUTCFullYear();if(o<this.startDate||n>r){p.push("disabled")}return p.concat((q?q:[]))};this.onRenderMonth=function(n){var p=(j.onRenderMonth||function(){return[]})(n);var o=["month"];if(typeof p==="string"){p=[p]}return o.concat((p?p:[]))};this.startDate=new Date(-8639968443048000);this.endDate=new Date(8639968443048000);this.datesDisabled=[];this.daysOfWeekDisabled=[];this.setStartDate(j.startDate||this.element.data("date-startdate"));this.setEndDate(j.endDate||this.element.data("date-enddate"));this.setDatesDisabled(j.datesDisabled||this.element.data("date-dates-disabled"));this.setDaysOfWeekDisabled(j.daysOfWeekDisabled||this.element.data("date-days-of-week-disabled"));this.setMinutesDisabled(j.minutesDisabled||this.element.data("date-minute-disabled"));this.setHoursDisabled(j.hoursDisabled||this.element.data("date-hour-disabled"));this.fillDow();this.fillMonths();this.update();this.showMode();if(this.isInline){this.show()}};g.prototype={constructor:g,_events:[],_attachEvents:function(){this._detachEvents();if(this.isInput){this._events=[[this.element,{focus:d.proxy(this.show,this),keyup:d.proxy(this.update,this),keydown:d.proxy(this.keydown,this)}]]}else{if(this.component&&this.hasInput){this._events=[[this.element.find("input"),{focus:d.proxy(this.show,this),keyup:d.proxy(this.update,this),keydown:d.proxy(this.keydown,this)}],[this.component,{click:d.proxy(this.show,this)}]];if(this.componentReset){this._events.push([this.componentReset,{click:d.proxy(this.reset,this)}])}}else{if(this.element.is("div")){this.isInline=true}else{this._events=[[this.element,{click:d.proxy(this.show,this)}]]}}}for(var j=0,k,l;j<this._events.length;j++){k=this._events[j][0];l=this._events[j][1];k.on(l)}},_detachEvents:function(){for(var j=0,k,l;j<this._events.length;j++){k=this._events[j][0];l=this._events[j][1];k.off(l)}this._events=[]},show:function(i){this.picker.show();this.height=this.component?this.component.outerHeight():this.element.outerHeight();if(this.forceParse){this.update()}this.place();d(window).on("resize",d.proxy(this.place,this));if(i){i.stopPropagation();i.preventDefault()}this.isVisible=true;this.element.trigger({type:"show",date:this.date})},hide:function(){if(!this.isVisible){return}if(this.isInline){return}this.picker.hide();d(window).off("resize",this.place);this.viewMode=this.startViewMode;this.showMode();if(!this.isInput){d(document).off("mousedown",this.hide)}if(this.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val())){this.setValue()}this.isVisible=false;this.element.trigger({type:"hide",date:this.date})},remove:function(){this._detachEvents();d(document).off("mousedown",this.clickedOutside);this.picker.remove();delete this.picker;delete this.element.data().datetimepicker},getDate:function(){var i=this.getUTCDate();if(i===null){return null}return new Date(i.getTime()+(i.getTimezoneOffset()*60000))},getUTCDate:function(){return this.date},getInitialDate:function(){return this.initialDate},setInitialDate:function(i){this.initialDate=i},setDate:function(i){this.setUTCDate(new Date(i.getTime()-(i.getTimezoneOffset()*60000)))},setUTCDate:function(i){if(i>=this.startDate&&i<=this.endDate){this.date=i;this.setValue();this.viewDate=this.date;this.fill()}else{this.element.trigger({type:"outOfRange",date:i,startDate:this.startDate,endD
7717ate:this.endDate})}},setFormat:function(j){this.format=c.parseFormat(j,this.formatType);var i;if(this.isInput){i=this.element}else{if(this.component){i=this.element.find("input")}}if(i&&i.val()){this.setValue()}},setValue:function(){var i=this.getFormattedDate();if(!this.isInput){if(this.component){this.element.find("input").val(i)}this.element.data("date",i)}else{this.element.val(i)}if(this.linkField){d("#"+this.linkField).val(this.getFormattedDate(this.linkFormat))}},getFormattedDate:function(i){i=i||this.format;return c.formatDate(this.date,i,this.language,this.formatType,this.timezone)},setStartDate:function(i){this.startDate=i||this.startDate;if(this.startDate.valueOf()!==8639968443048000){this.startDate=c.parseDate(this.startDate,this.format,this.language,this.formatType,this.timezone)}this.update();this.updateNavArrows()},setEndDate:function(i){this.endDate=i||this.endDate;if(this.endDate.valueOf()!==8639968443048000){this.endDate=c.parseDate(this.endDate,this.format,this.language,this.formatType,this.timezone)}this.update();this.updateNavArrows()},setDatesDisabled:function(j){this.datesDisabled=j||[];if(!d.isArray(this.datesDisabled)){this.datesDisabled=this.datesDisabled.split(/,\s*/)}var i=this;this.datesDisabled=d.map(this.datesDisabled,function(k){return c.parseDate(k,i.format,i.language,i.formatType,i.timezone).toDateString()});this.update();this.updateNavArrows()},setTitle:function(i,j){return this.picker.find(i).find("th:eq(1)").text(this.title===false?j:this.title)},setDaysOfWeekDisabled:function(i){this.daysOfWeekDisabled=i||[];if(!d.isArray(this.daysOfWeekDisabled)){this.daysOfWeekDisabled=this.daysOfWeekDisabled.split(/,\s*/)}this.daysOfWeekDisabled=d.map(this.daysOfWeekDisabled,function(j){return parseInt(j,10)});this.update();this.updateNavArrows()},setMinutesDisabled:function(i){this.minutesDisabled=i||[];if(!d.isArray(this.minutesDisabled)){this.minutesDisabled=this.minutesDisabled.split(/,\s*/)}this.minutesDisabled=d.map(this.minutesDisabled,function(j){return parseInt(j,10)});this.update();this.updateNavArrows()},setHoursDisabled:function(i){this.hoursDisabled=i||[];if(!d.isArray(this.hoursDisabled)){this.hoursDisabled=this.hoursDisabled.split(/,\s*/)}this.hoursDisabled=d.map(this.hoursDisabled,function(j){return parseInt(j,10)});this.update();this.updateNavArrows()},place:function(){if(this.isInline){return}if(!this.zIndex){var j=0;d("div").each(function(){var o=parseInt(d(this).css("zIndex"),10);if(o>j){j=o}});this.zIndex=j+10}var n,m,l,k;if(this.container instanceof d){k=this.container.offset()}else{k=d(this.container).offset()}if(this.component){n=this.component.offset();l=n.left;if(this.pickerPosition==="bottom-left"||this.pickerPosition==="top-left"){l+=this.component.outerWidth()-this.picker.outerWidth()}}else{n=this.element.offset();l=n.left;if(this.pickerPosition==="bottom-left"||this.pickerPosition==="top-left"){l+=this.element.outerWidth()-this.picker.outerWidth()}}var i=document.body.clientWidth||window.innerWidth;if(l+220>i){l=i-220}if(this.pickerPosition==="top-left"||this.pickerPosition==="top-right"){m=n.top-this.picker.outerHeight()}else{m=n.top+this.height}m=m-k.top;l=l-k.left;this.picker.css({top:m,left:l,zIndex:this.zIndex})},hour_minute:"^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]",update:function(){var i,j=false;if(arguments&&arguments.length&&(typeof arguments[0]==="string"||arguments[0] instanceof Date)){i=arguments[0];j=true}else{i=(this.isInput?this.element.val():this.element.find("input").val())||this.element.data("date")||this.initialDate;if(typeof i==="string"){i=i.replace(/^\s+|\s+$/g,"")}}if(!i){i=new Date();j=false}if(typeof i==="string"){if(new RegExp(this.hour_minute).test(i)||new RegExp(this.hour_minute+":[0-5][0-9]").test(i)){i=this.getDate()}}this.date=c.parseDate(i,this.format,this.language,this.formatType,this.timezone);if(j){this.setValue()}if(this.date<this.startDate){this.viewDate=new Date(this.startDate)}else{if(this.date>this.endDate){this.viewDate=new Date(this.endDate)}else{this.viewDate=new Date(this.date)}}this.fill()},fillDow:function(){var i=this.weekStart,j="<tr>";while(i<this.weekStart+7){j+='<th class="dow">'+e[this.language].daysMin[(i++)%7]+"</th>"}j+="</tr>";this.picker.find(".datetimepicker-days thead").append(j)},fillMonths:function(){var l="";var m=new Date(this.viewDate);for(var k=0;k<12;k++){m.setUTCMonth(k);var j=this.onRenderMonth(m);l+='<span class="'+j.join(" ")+'">'+e[this.language].monthsShort[k]+"</span>"}this.picker.find(".datetimepicker-months td").html(l)},fill:function(){if(!this.date||!this.viewDate){return}var E=new Date(this.viewDate),t=E.getUTCFullYear(),G=E.getUTCMonth(),n=E.getUTCDate(),A=E.getUTCHours(),w=this.startDate.getUTCFullYear(),B=this.startDate.getUTCMonth(),p=this.endDate.getUTCFullYear(),x=this.endDate.getUTCMonth()+1,q=(new h(this.date.getUTCFullYear(),this.date.getUTCMonth(),this.date.getUTCDate())).valueOf(),D=new Date();this.setTitle(".datetimepicker-days",e[this.language].months[G]+" "+t);if(this.formatViewType==="timdatetimee"){var k=this.getFormattedDate();this.setTitle(".datetimepicker-hours",k);this.setTitle(".datetimepicker-minutes",k)}else{this.setTitle(".datetimepicker-hours",n+" "+e[this.language].months[G]+" "+t);this.setTitle(".datetimepicker-minutes",n+" "+e[this.language].months[G]+" "+t)}this.picker.find("tfoot th.today").text(e[this.language].today||e.en.today).toggle(this.todayBtn!==false);this.picker.find("tfoot th.clear").text(e[this.language].clear||e.en.clear).toggle(this.clearBtn!==false);this.updateNavArrows();this.fillMonths();var I=h(t,G-1,28,0,0,0,0),z=c.getDaysInMonth(I.getUTCFullYear(),I.getUTCMonth());I.setUTCDate(z);I.setUTCDate(z-(I.getUTCDay()-this.weekStart+7)%7);var j=new Date(I);j.setUTCDate(j.getUTCDate()+42);j=j.valueOf();var r=[];var F;
7717while(I.valueOf()<j){if(I.getUTCDay()===this.weekStart){r.push("<tr>")}F=this.onRenderDay(I);if(I.getUTCFullYear()<t||(I.getUTCFullYear()===t&&I.getUTCMonth()<G)){F.push("old")}else{if(I.getUTCFullYear()>t||(I.getUTCFullYear()===t&&I.getUTCMonth()>G)){F.push("new")}}if(this.todayHighlight&&I.getUTCFullYear()===D.getFullYear()&&I.getUTCMonth()===D.getMonth()&&I.getUTCDate()===D.getDate()){F.push("today")}if(I.valueOf()===q){F.push("active")}if((I.valueOf()+86400000)<=this.startDate||I.valueOf()>this.endDate||d.inArray(I.getUTCDay(),this.daysOfWeekDisabled)!==-1||d.inArray(I.toDateString(),this.datesDisabled)!==-1){F.push("disabled")}r.push('<td class="'+F.join(" ")+'">'+I.getUTCDate()+"</td>");if(I.getUTCDay()===this.weekEnd){r.push("</tr>")}I.setUTCDate(I.getUTCDate()+1)}this.picker.find(".datetimepicker-days tbody").empty().append(r.join(""));r=[];var u="",C="",s="";var l=this.hoursDisabled||[];E=new Date(this.viewDate);for(var y=0;y<24;y++){E.setUTCHours(y);F=this.onRenderHour(E);if(l.indexOf(y)!==-1){F.push("disabled")}var v=h(t,G,n,y);if((v.valueOf()+3600000)<=this.startDate||v.valueOf()>this.endDate){F.push("disabled")}else{if(A===y){F.push("active")}}if(this.showMeridian&&e[this.language].meridiem.length===2){C=(y<12?e[this.language].meridiem[0]:e[this.language].meridiem[1]);if(C!==s){if(s!==""){r.push("</fieldset>")}r.push('<fieldset class="hour"><legend>'+C.toUpperCase()+"</legend>")}s=C;u=(y%12?y%12:12);if(y<12){F.push("hour_am")}else{F.push("hour_pm")}r.push('<span class="'+F.join(" ")+'">'+u+"</span>");if(y===23){r.push("</fieldset>")}}else{u=y+":00";r.push('<span class="'+F.join(" ")+'">'+u+"</span>")}}this.picker.find(".datetimepicker-hours td").html(r.join(""));r=[];u="";C="";s="";var m=this.minutesDisabled||[];E=new Date(this.viewDate);for(var y=0;y<60;y+=this.minuteStep){if(m.indexOf(y)!==-1){continue}E.setUTCMinutes(y);E.setUTCSeconds(0);F=this.onRenderMinute(E);if(this.showMeridian&&e[this.language].meridiem.length===2){C=(A<12?e[this.language].meridiem[0]:e[this.language].meridiem[1]);if(C!==s){if(s!==""){r.push("</fieldset>")}r.push('<fieldset class="minute"><legend>'+C.toUpperCase()+"</legend>")}s=C;u=(A%12?A%12:12);r.push('<span class="'+F.join(" ")+'">'+u+":"+(y<10?"0"+y:y)+"</span>");if(y===59){r.push("</fieldset>")}}else{u=y+":00";r.push('<span class="'+F.join(" ")+'">'+A+":"+(y<10?"0"+y:y)+"</span>")}}this.picker.find(".datetimepicker-minutes td").html(r.join(""));var J=this.date.getUTCFullYear();var o=this.setTitle(".datetimepicker-months",t).end().find(".month").removeClass("active");if(J===t){o.eq(this.date.getUTCMonth()).addClass("active")}if(t<w||t>p){o.addClass("disabled")}if(t===w){o.slice(0,B).addClass("disabled")}if(t===p){o.slice(x).addClass("disabled")}r="";t=parseInt(t/10,10)*10;var H=this.setTitle(".datetimepicker-years",t+"-"+(t+9)).end().find("td");t-=1;E=new Date(this.viewDate);for(var y=-1;y<11;y++){E.setUTCFullYear(t);F=this.onRenderYear(E);if(y===-1||y===10){F.push(b)}r+='<span class="'+F.join(" ")+'">'+t+"</span>";t+=1}H.html(r);this.place()},updateNavArrows:function(){var m=new Date(this.viewDate),k=m.getUTCFullYear(),l=m.getUTCMonth(),j=m.getUTCDate(),i=m.getUTCHours();switch(this.viewMode){case 0:if(k<=this.startDate.getUTCFullYear()&&l<=this.startDate.getUTCMonth()&&j<=this.startDate.getUTCDate()&&i<=this.startDate.getUTCHours()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(k>=this.endDate.getUTCFullYear()&&l>=this.endDate.getUTCMonth()&&j>=this.endDate.getUTCDate()&&i>=this.endDate.getUTCHours()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 1:if(k<=this.startDate.getUTCFullYear()&&l<=this.startDate.getUTCMonth()&&j<=this.startDate.getUTCDate()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(k>=this.endDate.getUTCFullYear()&&l>=this.endDate.getUTCMonth()&&j>=this.endDate.getUTCDate()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 2:if(k<=this.startDate.getUTCFullYear()&&l<=this.startDate.getUTCMonth()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(k>=this.endDate.getUTCFullYear()&&l>=this.endDate.getUTCMonth()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 3:case 4:if(k<=this.startDate.getUTCFullYear()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(k>=this.endDate.getUTCFullYear()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break}},mousewheel:function(j){j.preventDefault();j.stopPropagation();if(this.wheelPause){return}this.wheelPause=true;var i=j.originalEvent;var l=i.wheelDelta;var k=l>0?1:(l===0)?0:-1;
7717if(this.wheelViewModeNavigationInverseDirection){k=-k}this.showMode(k);setTimeout(d.proxy(function(){this.wheelPause=false},this),this.wheelViewModeNavigationDelay)},click:function(m){m.stopPropagation();m.preventDefault();var n=d(m.target).closest("span, td, th, legend");if(n.is("."+this.icontype)){n=d(n).parent().closest("span, td, th, legend")}if(n.length===1){if(n.is(".disabled")){this.element.trigger({type:"outOfRange",date:this.viewDate,startDate:this.startDate,endDate:this.endDate});return}switch(n[0].nodeName.toLowerCase()){case"th":switch(n[0].className){case"switch":this.showMode(1);break;case"prev":case"next":var i=c.modes[this.viewMode].navStep*(n[0].className==="prev"?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveHour(this.viewDate,i);break;case 1:this.viewDate=this.moveDate(this.viewDate,i);break;case 2:this.viewDate=this.moveMonth(this.viewDate,i);break;case 3:case 4:this.viewDate=this.moveYear(this.viewDate,i);break}this.fill();this.element.trigger({type:n[0].className+":"+this.convertViewModeText(this.viewMode),date:this.viewDate,startDate:this.startDate,endDate:this.endDate});break;case"clear":this.reset();if(this.autoclose){this.hide()}break;case"today":var j=new Date();j=h(j.getFullYear(),j.getMonth(),j.getDate(),j.getHours(),j.getMinutes(),j.getSeconds(),0);if(j<this.startDate){j=this.startDate}else{if(j>this.endDate){j=this.endDate}}this.viewMode=this.startViewMode;this.showMode(0);this._setDate(j);this.fill();if(this.autoclose){this.hide()}break}break;case"span":if(!n.is(".disabled")){var p=this.viewDate.getUTCFullYear(),o=this.viewDate.getUTCMonth(),q=this.viewDate.getUTCDate(),r=this.viewDate.getUTCHours(),k=this.viewDate.getUTCMinutes(),s=this.viewDate.getUTCSeconds();if(n.is(".month")){this.viewDate.setUTCDate(1);o=n.parent().find("span").index(n);q=this.viewDate.getUTCDate();this.viewDate.setUTCMonth(o);this.element.trigger({type:"changeMonth",date:this.viewDate});if(this.viewSelect>=3){this._setDate(h(p,o,q,r,k,s,0))}}else{if(n.is(".year")){this.viewDate.setUTCDate(1);p=parseInt(n.text(),10)||0;this.viewDate.setUTCFullYear(p);this.element.trigger({type:"changeYear",date:this.viewDate});if(this.viewSelect>=4){this._setDate(h(p,o,q,r,k,s,0))}}else{if(n.is(".hour")){r=parseInt(n.text(),10)||0;if(n.hasClass("hour_am")||n.hasClass("hour_pm")){if(r===12&&n.hasClass("hour_am")){r=0}else{if(r!==12&&n.hasClass("hour_pm")){r+=12}}}this.viewDate.setUTCHours(r);this.element.trigger({type:"changeHour",date:this.viewDate});if(this.viewSelect>=1){this._setDate(h(p,o,q,r,k,s,0))}}else{if(n.is(".minute")){k=parseInt(n.text().substr(n.text().indexOf(":")+1),10)||0;this.viewDate.setUTCMinutes(k);this.element.trigger({type:"changeMinute",date:this.viewDate});if(this.viewSelect>=0){this._setDate(h(p,o,q,r,k,s,0))}}}}}if(this.viewMode!==0){var l=this.viewMode;this.showMode(-1);this.fill();if(l===this.viewMode&&this.autoclose){this.hide()}}else{this.fill();if(this.autoclose){this.hide()}}}break;case"td":if(n.is(".day")&&!n.is(".disabled")){var q=parseInt(n.text(),10)||1;var p=this.viewDate.getUTCFullYear(),o=this.viewDate.getUTCMonth(),r=this.viewDate.getUTCHours(),k=this.viewDate.getUTCMinutes(),s=this.viewDate.getUTCSeconds();if(n.is(".old")){if(o===0){o=11;p-=1}else{o-=1}}else{if(n.is(".new")){if(o===11){o=0;p+=1}else{o+=1}}}this.viewDate.setUTCFullYear(p);this.viewDate.setUTCMonth(o,q);this.element.trigger({type:"changeDay",date:this.viewDate});if(this.viewSelect>=2){this._setDate(h(p,o,q,r,k,s,0))}}var l=this.viewMode;this.showMode(-1);this.fill();if(l===this.viewMode&&this.autoclose){this.hide()}break}}},_setDate:function(i,k){if(!k||k==="date"){this.date=i}if(!k||k==="view"){this.viewDate=i}this.fill();this.setValue();var j;if(this.isInput){j=this.element}else{if(this.component){j=this.element.find("input")}}if(j){j.change()}this.element.trigger({type:"changeDate",date:this.getDate()});if(i===null){this.date=this.viewDate}},moveMinute:function(j,i){if(!i){return j}var k=new Date(j.valueOf());k.setUTCMinutes(k.getUTCMinutes()+(i*this.minuteStep));return k},moveHour:function(j,i){if(!i){return j}var k=new Date(j.valueOf());k.setUTCHours(k.getUTCHours()+i);return k}
7717,moveDate:function(j,i){if(!i){return j}var k=new Date(j.valueOf());k.setUTCDate(k.getUTCDate()+i);return k},moveMonth:function(j,k){if(!k){return j}var n=new Date(j.valueOf()),r=n.getUTCDate(),o=n.getUTCMonth(),m=Math.abs(k),q,p;k=k>0?1:-1;if(m===1){p=k===-1?function(){return n.getUTCMonth()===o}:function(){return n.getUTCMonth()!==q};q=o+k;n.setUTCMonth(q);if(q<0||q>11){q=(q+12)%12}}else{for(var l=0;l<m;l++){n=this.moveMonth(n,k)}q=n.getUTCMonth();n.setUTCDate(r);p=function(){return q!==n.getUTCMonth()}}while(p()){n.setUTCDate(--r);n.setUTCMonth(q)}return n},moveYear:function(j,i){return this.moveMonth(j,i*12)},dateWithinRange:function(i){return i>=this.startDate&&i<=this.endDate},keydown:function(o){if(this.picker.is(":not(:visible)")){if(o.keyCode===27){this.show()}return}var k=false,j,i,n;switch(o.keyCode){case 27:this.hide();o.preventDefault();break;case 37:case 39:if(!this.keyboardNavigation){break}j=o.keyCode===37?-1:1;var m=this.viewMode;if(o.ctrlKey){m+=2}else{if(o.shiftKey){m+=1}}if(m===4){i=this.moveYear(this.date,j);n=this.moveYear(this.viewDate,j)}else{if(m===3){i=this.moveMonth(this.date,j);n=this.moveMonth(this.viewDate,j)}else{if(m===2){i=this.moveDate(this.date,j);n=this.moveDate(this.viewDate,j)}else{if(m===1){i=this.moveHour(this.date,j);n=this.moveHour(this.viewDate,j)}else{if(m===0){i=this.moveMinute(this.date,j);n=this.moveMinute(this.viewDate,j)}}}}}if(this.dateWithinRange(i)){this.date=i;this.viewDate=n;this.setValue();this.update();o.preventDefault();k=true}break;case 38:case 40:if(!this.keyboardNavigation){break}j=o.keyCode===38?-1:1;m=this.viewMode;if(o.ctrlKey){m+=2}else{if(o.shiftKey){m+=1}}if(m===4){i=this.moveYear(this.date,j);n=this.moveYear(this.viewDate,j)}else{if(m===3){i=this.moveMonth(this.date,j);n=this.moveMonth(this.viewDate,j)}else{if(m===2){i=this.moveDate(this.date,j*7);n=this.moveDate(this.viewDate,j*7)}else{if(m===1){if(this.showMeridian){i=this.moveHour(this.date,j*6);n=this.moveHour(this.viewDate,j*6)}else{i=this.moveHour(this.date,j*4);n=this.moveHour(this.viewDate,j*4)}}else{if(m===0){i=this.moveMinute(this.date,j*4);n=this.moveMinute(this.viewDate,j*4)}}}}}if(this.dateWithinRange(i)){this.date=i;this.viewDate=n;this.setValue();this.update();o.preventDefault();k=true}break;case 13:if(this.viewMode!==0){var p=this.viewMode;this.showMode(-1);this.fill();if(p===this.viewMode&&this.autoclose){this.hide()}}else{this.fill();if(this.autoclose){this.hide()}}o.preventDefault();break;case 9:this.hide();break}if(k){var l;if(this.isInput){l=this.element}else{if(this.component){l=this.element.find("input")}}if(l){l.change()}this.element.trigger({type:"changeDate",date:this.getDate()})}},showMode:function(i){if(i){var j=Math.max(0,Math.min(c.modes.length-1,this.viewMode+i));if(j>=this.minView&&j<=this.maxView){this.element.trigger({type:"changeMode",date:this.viewDate,oldViewMode:this.viewMode,newViewMode:j});this.viewMode=j}}this.picker.find(">div").hide().filter(".datetimepicker-"+c.modes[this.viewMode].clsName).css("display","block");this.updateNavArrows()},reset:function(){this._setDate(null,"date")},convertViewModeText:function(i){switch(i){case 4:return"decade";case 3:return"year";case 2:return"month";case 1:return"day";case 0:return"hour"}}};var b=d.fn.datetimepicker;d.fn.datetimepicker=function(k){var i=Array.apply(null,arguments);i.shift();var j;this.each(function(){var n=d(this),m=n.data("datetimepicker"),l=typeof k==="object"&&k;if(!m){n.data("datetimepicker",(m=new g(this,d.extend({},d.fn.datetimepicker.defaults,l))))}if(typeof k==="string"&&typeof m[k]==="function"){j=m[k].apply(m,i);if(j!==f){return false}}});if(j!==f){return j}else{return this}};d.fn.datetimepicker.defaults={};d.fn.datetimepicker.Constructor=g;var e=d.fn.datetimepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["am","pm"],suffix:["st","nd","rd","th"],today:"Today",clear:"Clear"}};var c={modes:[{clsName:"minutes",navFnc:"Hours",navStep:1},{clsName:"hours",navFnc:"Date",navStep:1},{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(i){return(((i%4===0)&&(i%100!==0))||(i%400===0))},getDaysInMonth:function(i,j){return[31,(c.isLeapYear(i)?29:28),31,30,31,30,31,31,30,31,30,31][j]},getDefaultFormat:function(i,j){if(i==="standard"){if(j==="input"){return"yyyy-mm-dd hh:ii"}else{return"yyyy-mm-dd hh:ii:ss"}}else{if(i==="php"){if(j==="input"){return"Y-m-d H:i"}else{return"Y-m-d H:i:s"}}else{throw new Error("Invalid format type.")}}},validParts:function(i){if(i==="standard"){return/t|hh?|HH?|p|P|z|Z|ii?|ss?|dd?|DD?|mm?|MM?|yy(?:yy)?/g}else{if(i==="php"){return/[dDjlNwzFmMnStyYaABgGhHis]/g}else{throw new Error("Invalid format type.")}}},nonpunctuation:/[^ -\/:-@\[-`{-~\t\n\rTZ]+/g,parseFormat:function(l,j){var i=l.replace(this.validParts(j),"\0").split("\0"),k=l.match(this.validParts(j));if(!i||!i.length||!k||k.length===0){throw new Error("Invalid date format.")}return{separators:i,parts:k}},parseDate:function(A,y,v,j,r){if(A instanceof Date){var u=new Date(A.valueOf()-A.getTimezoneOffset()*60000);u.setMilliseconds(0);return u}if(/^\d{4}\-\d{1,2}\-\d{1,2}$/.test(A)){y=this.parseFormat("yyyy-mm-dd",j)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}$/.test(A)){y=this.parseFormat("yyyy-mm-dd hh:ii",j)}if(/^\d{4}\-\d{1,2}\-\d{1,2}[T ]\d{1,2}\:\d{1,2}\:\d{1,2}[Z]{0,1}$/.test(A)){y=this.parseFormat("yyyy-mm-dd hh:ii:ss",j)}if(/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(A)){var l=/([-+]\d+)([dmwy])/,q=A.match(/([-+]\d+)([dmwy])/g),t,p;A=new Date();for(var x=0;x<q.length;x++){t=l.exec(q[x]);p=parseInt(t[1]);switch(t[2]){case"d":A.setUTCDate(A.getUTCDate()+p);break;case"m":A=g.prototype.moveMonth.call(g.prototype,A,p);break;case"w":A.setUTCDate(A.getUTCDate()+p*7);break;case"y":A=g.prototype.moveYear.call(g.prototype,A,p);break}}return h(A.getUTCFullYear(),A.getUTCMonth(),A.getUTCDate(),A.getUTCHours(),A.getUTCMinutes(),A.getUTCSeconds(),0)}var q=A&&A.toString().match(this.nonpunctuation)||[],A=new Date(0,0,0,0,0,0,0),m={},z=["hh","h","ii","i","ss","s","yyyy","yy","M","MM","m","mm","D","DD","d","dd","H","HH","p","P","z","Z"],o={hh:function(s,i){return s.setUTCHours(i)},h:function(s,i){return s.setUTCHours(i)},HH:function(s,i){return s.setUTCHours(i===12?0:i)},H:function(s,i){return s.setUTCHours(i===12?0:i)},ii:function(s,i){return s.setUTCMinutes(i)},i:function(s,i){return s.setUTCMinutes(i)},ss:function(s,i){return s.setUTCSeconds(i)},s:function(s,i){return s.setUTCSeconds(i)},yyyy:function(s,i){return s.setUTCFullYear(i)},yy:function(s,i){return s.setUTCFullYear(2000+i)},m:function(s,i){i-=1;while(i<0){i+=12}i%=12;s.setUTCMonth(i);while(s.getUTCMonth()!==i){if(isNaN(s.getUTCMonth())){return s}else{s.setUTCDate(s.getUTCDate()-1)}}return s},d:function(s,i){return s.setUTCDate(i)},p:function(s,i){return s.setUTCHours(i===1?s.getUTCHours()+12:s.getUTCHours())},z:function(){return r}},B,k,t;o.M=o.MM=o.mm=o.m;o.dd=o.d;o.P=o.p;o.Z=o.z;A=h(A.getFullYear(),A.getMonth(),A.getDate(),A.getHours(),A.getMinutes(),A.getSeconds());if(q.length===y.parts.length){for(var x=0,w=y.parts.length;x<w;x++){B=parseInt(q[x],10);
7717t=y.parts[x];if(isNaN(B)){switch(t){case"MM":k=d(e[v].months).filter(function(){var i=this.slice(0,q[x].length),s=q[x].slice(0,i.length);return i===s});B=d.inArray(k[0],e[v].months)+1;break;case"M":k=d(e[v].monthsShort).filter(function(){var i=this.slice(0,q[x].length),s=q[x].slice(0,i.length);return i.toLowerCase()===s.toLowerCase()});B=d.inArray(k[0],e[v].monthsShort)+1;break;case"p":case"P":B=d.inArray(q[x].toLowerCase(),e[v].meridiem);break;case"z":case"Z":r;break}}m[t]=B}for(var x=0,n;x<z.length;x++){n=z[x];if(n in m&&!isNaN(m[n])){o[n](A,m[n])}}}return A},formatDate:function(l,q,m,p,o){if(l===null){return""}var k;if(p==="standard"){k={t:l.getTime(),yy:l.getUTCFullYear().toString().substring(2),yyyy:l.getUTCFullYear(),m:l.getUTCMonth()+1,M:e[m].monthsShort[l.getUTCMonth()],MM:e[m].months[l.getUTCMonth()],d:l.getUTCDate(),D:e[m].daysShort[l.getUTCDay()],DD:e[m].days[l.getUTCDay()],p:(e[m].meridiem.length===2?e[m].meridiem[l.getUTCHours()<12?0:1]:""),h:l.getUTCHours(),i:l.getUTCMinutes(),s:l.getUTCSeconds(),z:o};if(e[m].meridiem.length===2){k.H=(k.h%12===0?12:k.h%12)}else{k.H=k.h}k.HH=(k.H<10?"0":"")+k.H;k.P=k.p.toUpperCase();k.Z=k.z;k.hh=(k.h<10?"0":"")+k.h;k.ii=(k.i<10?"0":"")+k.i;k.ss=(k.s<10?"0":"")+k.s;k.dd=(k.d<10?"0":"")+k.d;k.mm=(k.m<10?"0":"")+k.m}else{if(p==="php"){k={y:l.getUTCFullYear().toString().substring(2),Y:l.getUTCFullYear(),F:e[m].months[l.getUTCMonth()],M:e[m].monthsShort[l.getUTCMonth()],n:l.getUTCMonth()+1,t:c.getDaysInMonth(l.getUTCFullYear(),l.getUTCMonth()),j:l.getUTCDate(),l:e[m].days[l.getUTCDay()],D:e[m].daysShort[l.getUTCDay()],w:l.getUTCDay(),N:(l.getUTCDay()===0?7:l.getUTCDay()),S:(l.getUTCDate()%10<=e[m].suffix.length?e[m].suffix[l.getUTCDate()%10-1]:""),a:(e[m].meridiem.length===2?e[m].meridiem[l.getUTCHours()<12?0:1]:""),g:(l.getUTCHours()%12===0?12:l.getUTCHours()%12),G:l.getUTCHours(),i:l.getUTCMinutes(),s:l.getUTCSeconds()};k.m=(k.n<10?"0":"")+k.n;k.d=(k.j<10?"0":"")+k.j;k.A=k.a.toString().toUpperCase();k.h=(k.g<10?"0":"")+k.g;k.H=(k.G<10?"0":"")+k.G;k.i=(k.i<10?"0":"")+k.i;k.s=(k.s<10?"0":"")+k.s}else{throw new Error("Invalid format type.")}}var l=[],r=d.extend([],q.separators);for(var n=0,j=q.parts.length;n<j;n++){if(r.length){l.push(r.shift())}l.push(k[q.parts[n]])}if(r.length){l.push(r.shift())}return l.join("")},convertViewMode:function(i){switch(i){case 4:case"decade":i=4;break;case 3:case"year":i=3;break;case 2:case"month":i=2;break;case 1:case"day":i=1;break;case 0:case"hour":i=0;break}return i},headTemplate:'<thead><tr><th class="prev"><i class="{iconType} {leftArrow}"/></th><th colspan="5" class="switch"></th><th class="next"><i class="{iconType} {rightArrow}"/></th></tr></thead>',headTemplateV3:'<thead><tr><th class="prev"><span class="{iconType} {leftArrow}"></span> </th><th colspan="5" class="switch"></th><th class="next"><span class="{iconType} {rightArrow}"></span> </th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'};c.template='<div class="datetimepicker"><div class="datetimepicker-minutes"><table class=" table-condensed">'+c.headTemplate+c.contTemplate+c.footTemplate+'</table></div><div class="datetimepicker-hours"><table class=" table-condensed">'+c.headTemplate+c.contTemplate+c.footTemplate+'</table></div><div class="datetimepicker-days"><table class=" table-condensed">'+c.headTemplate+"<tbody></tbody>"+c.footTemplate+'</table></div><div class="datetimepicker-months"><table class="table-condensed">'+c.headTemplate+c.contTemplate+c.footTemplate+'</table></div><div class="datetimepicker-years"><table class="table-condensed">'+c.headTemplate+c.contTemplate+c.footTemplate+"</table></div></div>";c.templateV3='<div class="datetimepicker"><div class="datetimepicker-minutes"><table class=" table-condensed">'+c.headTemplateV3+c.contTemplate+c.footTemplate+'</table></div><div class="datetimepicker-hours"><table class=" table-condensed">'+c.headTemplateV3+c.contTemplate+c.footTemplate+'</table></div><div class="datetimepicker-days"><table class=" table-condensed">'+c.headTemplateV3+"<tbody></tbody>"+c.footTemplate+'</table></div><div class="datetimepicker-months"><table class="table-condensed">
7717'+c.headTemplateV3+c.contTemplate+c.footTemplate+'</table></div><div class="datetimepicker-years"><table class="table-condensed">'+c.headTemplateV3+c.contTemplate+c.footTemplate+"</table></div></div>";d.fn.datetimepicker.DPGlobal=c;d.fn.datetimepicker.noConflict=function(){d.fn.datetimepicker=b;return this};d(document).on("focus.datetimepicker.data-api click.datetimepicker.data-api",'[data-provide="datetimepicker"]',function(j){var i=d(this);if(i.data("datetimepicker")){return}j.preventDefault();i.datetimepicker("show")});d(function(){d('[data-provide="datetimepicker-inline"]').datetimepicker()})}));
7718/* End */
7719;
7720; /* Start:"a:4:{s:4:"full";s:81:"/bitrix/templates/aspro-allcorp2/js/bootstrap-datetimepicker.ru.js?17182808732055";s:6:"source";s:66:"/bitrix/templates/aspro-allcorp2/js/bootstrap-datetimepicker.ru.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
7721/**
7722 * Russian translation for bootstrap-datetimepicker
7723 * Victor Taranenko <[email protected]>
7724 */
7725;(function($){
7726	$.fn.datetimepicker.dates['ru'] = {
7727		days: [BX.message('DATE_TIME_DAYS_FULL_7'), BX.message('DATE_TIME_DAYS_FULL_1'), BX.message('DATE_TIME_DAYS_FULL_2'), BX.message('DATE_TIME_DAYS_FULL_3'), BX.message('DATE_TIME_DAYS_FULL_4'), BX.message('DATE_TIME_DAYS_FULL_5'), BX.message('DATE_TIME_DAYS_FULL_6'), BX.message('DATE_TIME_DAYS_FULL_7')],
7728		daysShort: [BX.message('DATE_TIME_DAYS_SHORT_7'), BX.message('DATE_TIME_DAYS_SHORT_1'), BX.message('DATE_TIME_DAYS_SHORT_2'), BX.message('DATE_TIME_DAYS_SHORT_3'), BX.message('DATE_TIME_DAYS_SHORT_4'), BX.message('DATE_TIME_DAYS_SHORT_5'), BX.message('DATE_TIME_DAYS_SHORT_6'), BX.message('DATE_TIME_DAYS_SHORT_7')],
7729		daysMin: [BX.message('DATE_TIME_DAYS_7'), BX.message('DATE_TIME_DAYS_1'), BX.message('DATE_TIME_DAYS_2'), BX.message('DATE_TIME_DAYS_3'), BX.message('DATE_TIME_DAYS_4'), BX.message('DATE_TIME_DAYS_5'), BX.message('DATE_TIME_DAYS_6'), BX.message('DATE_TIME_DAYS_7')],
7730		months: [BX.message('DATE_TIME_MOUNTH_1'), BX.message('DATE_TIME_MOUNTH_2'), BX.message('DATE_TIME_MOUNTH_3'), BX.message('DATE_TIME_MOUNTH_4'), BX.message('DATE_TIME_MOUNTH_5'), BX.message('DATE_TIME_MOUNTH_6'), BX.message('DATE_TIME_MOUNTH_7'), BX.message('DATE_TIME_MOUNTH_8'), BX.message('DATE_TIME_MOUNTH_9'), BX.message('DATE_TIME_MOUNTH_10'), BX.message('DATE_TIME_MOUNTH_11'), BX.message('DATE_TIME_MOUNTH_12')],
7731		monthsShort: [BX.message('DATE_TIME_MOUNTH_SHORT_1'), BX.message('DATE_TIME_MOUNTH_SHORT_2'), BX.message('DATE_TIME_MOUNTH_SHORT_3'), BX.message('DATE_TIME_MOUNTH_SHORT_4'), BX.message('DATE_TIME_MOUNTH_SHORT_5'), BX.message('DATE_TIME_MOUNTH_SHORT_6'), BX.message('DATE_TIME_MOUNTH_SHORT_7'), BX.message('DATE_TIME_MOUNTH_SHORT_8'), BX.message('DATE_TIME_MOUNTH_SHORT_9'), BX.message('DATE_TIME_MOUNTH_SHORT_10'), BX.message('DATE_TIME_MOUNTH_SHORT_11'), BX.message('DATE_TIME_MOUNTH_SHORT_12')],
7732		today: BX.message('DATE_TIME_TODAY'),
7733		suffix: [],
7734		meridiem: []
7735	};
7736}(jQuery));
7737/* End */
7738;
7739; /* Start:"a:4:{s:4:"full";s:63:"/bitrix/templates/aspro-allcorp2/js/general.js?1718280873175921";s:6:"source";s:46:"/bitrix/templates/aspro-allcorp2/js/general.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
7740var funcDefined = function (func) {
7741  try {
7742    if (typeof func == "function") return true;
7743    else return typeof window[func] === "function";
7744  } catch (e) {
7745    return false;
7746  }
7747};
7748
7749getRandomInt = function (min, max) {
7750  return Math.floor(Math.random() * (max - min)) + min;
7751};
7752
7753ShowOverlay = function () {
7754  $('<div class="jqmOverlay waiting"></div>').appendTo("body");
7755};
7756
7757window.addEventListener("popstate", function (event) {
7758  if (typeof startActions == "function") {
7759    setTimeout(startActions, 500);
7760  }
7761});
7762
7763HideOverlay = function () {
7764  $(".jqmOverlay").detach();
7765  CloseMobilePhone();
7766};
7767
7768if (!funcDefined("pauseYmObserver")) {
7769  // pause ya metrika webvisor MutationObserver callback (DOM indexer)
7770  // use before insert html with some animation
7771  pauseYmObserver = function () {
7772    if (
7773      typeof MutationObserver === "function" &&
7774      typeof MutationObserver.observers === "object" &&
7775      typeof MutationObserver.observers.ym === "object"
7776    ) {
7777      MutationObserver.observers.ym.pause();
7778    }
7779  };
7780}
7781
7782if (!funcDefined("resumeYmObserver")) {
7783  // resume ya metrika webvisor MutationObserver callback
7784  // use when animation finished
7785  resumeYmObserver = function () {
7786    if (
7787      typeof MutationObserver === "function" &&
7788      typeof MutationObserver.observers === "object" &&
7789      typeof MutationObserver.observers.ym === "object"
7790    ) {
7791      MutationObserver.observers.ym.resume();
7792    }
7793  };
7794}
7795
7796CheckTopMenuDotted = function () {
7797  var menu = $("nav.mega-menu.sliced");
7798  /*if(isMobile)
7799    return;*/
7800
7801  if (window.matchMedia("(max-width:991px)").matches) return;
7802
7803  if (menu.length) {
7804    menu.each(function () {
7805      var menuMoreItem = $(this).find("td.js-dropdown");
7806      if ($(this).parents(".collapse").css("display") == "none") {
7807        return false;
7808      }
7809
7810      var block_w = $(this).closest("div").actual("width");
7811      var menu_w = $(this).find("table").actual("outerWidth");
7812      var afterHide = false;
7813
7814      while (Math.floor(menu_w) > Math.floor(block_w)) {
7815        menuItemOldSave = $(this).find("td").not(".nosave").last();
7816        if (menuItemOldSave.length) {
7817          menuMoreItem.show();
7818          menuItemNewSave =
7819            '<li class="' +
7820            (menuItemOldSave.hasClass("dropdown") ? "dropdown-submenu " : "") +
7821            (menuItemOldSave.hasClass("active") ? "active " : "") +
7822            '" data-hidewidth="' +
7823            menu_w +
7824            '">' +
7825            menuItemOldSave.find(".wrap").html() +
7826            "</li>";
7827          menuItemOldSave.remove();
7828          menuMoreItem
7829            .find("> .wrap > .dropdown-menu")
7830            .prepend(menuItemNewSave);
7831          menu_w = $(this).find("table").actual("outerWidth");
7832          afterHide = true;
7833        }
7834        //menu.find('.nosave').css('display', 'table-cell');
7835        else {
7836          break;
7837        }
7838      }
7839
7840      if (!afterHide) {
7841        do {
7842          var menuItemOldSaveCnt = menuMoreItem
7843            .find(".dropdown-menu")
7844            .find("li").length;
7845          menuItemOldSave = menuMoreItem
7846            .find(".dropdown-menu")
7847            .find("li")
7848            .first();
7849          if (!menuItemOldSave.length) {
7850            menuMoreItem.hide();
7851            break;
7852          } else {
7853            var hideWidth = menuItemOldSave.attr("data-hidewidth");
7854            if (hideWidth > block_w) {
7855              break;
7856            } else {
7857              menuItemNewSave =
7858                '<td class="' +
7859                (menuItemOldSave.hasClass("dropdown-submenu")
7860                  ? "dropdown "
7861                  : "") +
7862                (menuItemOldSave.hasClass("active") ? "active " : "") +
7863                '" data-hidewidth="' +
7864                block_w +
7865                '"><div class="wrap">' +
7866                menuItemOldSave.html() +
7867                "</div></td>";
7868              menuItemOldSave.remove();
7869              $(menuItemNewSave).insertBefore($(this).find("td.js-dropdown"));
7870              if (!menuItemOldSaveCnt) {
7871                menuMoreItem.hide();
7872                break;
7873              }
7874            }
7875          }
7876          menu_w = $(this).find("table").actual("outerWidth");
7877        } while (menu_w <= block_w);
7878      }
7879      $(this).find("td").css("visibility", "visible");
7880      $(this).find("td").removeClass("unvisible");
7881      $(this).parents(".menu-only").css("opacity", "1");
7882    });
7883  }
7884  return false;
7885};
7886
7887CheckTopVisibleMenu = function (that) {
7888  var dropdownMenu = $(".dropdown-menu:visible").last();
7889
7890  if (dropdownMenu.length) {
7891    dropdownMenu.find("a").css("white-space", "");
7892    dropdownMenu.css("left", "");
7893    dropdownMenu.css("right", "");
7894    dropdownMenu.removeClass("toright");
7895
7896    var dropdownMenu_left = dropdownMenu.offset().left;
7897    if (typeof dropdownMenu_left != "undefined") {
7898      var menu = dropdownMenu.parents(".mega-menu");
7899      if (!menu.length) menu = dropdownMenu.closest(".logo-row");
7900      var menu_width = menu.outerWidth();
7901      var menu_left = menu.offset().left;
7902      var menu_right = menu_left + menu_width;
7903      var isToRight = dropdownMenu.parents(".toright").length > 0;
7904      var parentsDropdownMenus = dropdownMenu.parents(".dropdown-menu");
7905      var isHasParentDropdownMenu = parentsDropdownMenus.length > 0;
7906      if (isHasParentDropdownMenu) {
7907        var parentDropdownMenu_width = parentsDropdownMenus
7908          .first()
7909          .outerWidth();
7910        var parentDropdownMenu_left = parentsDropdownMenus
7911          .first()
7912          .offset().left;
7913        var parentDropdownMenu_right =
7914          parentDropdownMenu_width + parentDropdownMenu_left;
7915      }
7916
7917      if (parentDropdownMenu_right + dropdownMenu.outerWidth() > menu_right) {
7918        dropdownMenu.find("a").css("white-space", "normal");
7919      }
7920
7921      var dropdownMenu_width = dropdownMenu.outerWidth();
7922      var dropdownMenu_right = dropdownMenu_left + dropdownMenu_width;
7923
7924      if (dropdownMenu_right > menu_right || isToRight) {
7925        var addleft = 0;
7926        addleft = menu_right - dropdownMenu_right;
7927        if (isHasParentDropdownMenu || isToRight) {
7928          dropdownMenu.css("left", "auto");
7929          dropdownMenu.css("right", "100%");
7930          dropdownMenu.addClass("toright");
7931        } else {
7932          var dropdownMenu_curLeft = parseInt(dropdownMenu.css("left"));
7933          dropdownMenu.css("left", dropdownMenu_curLeft + addleft + "px");
7934        }
7935      }
7936    }
7937  }
7938};
7939
7940MegaMenuFixed = function () {
7941  var animationTime = 150;
7942
7943  $(".logo_and_menu-row .burger").on("click", function () {
7944    $(".mega_fixed_menu").fadeIn(animationTime);
7945  });
7946
7947  $(".mega_fixed_menu .svg.svg-close").on("click", function () {
7948    $(this).closest(".mega_fixed_menu").fadeOut(animationTime);
7949  });
7950
7951  $(".mega_fixed_menu .dropdown-menu .arrow").on("click", function (e) {
7952    e.preventDefault();
7953    e.stopPropagation();
7954    $(this)
7955      .closest(".dropdown-submenu")
7956      .find(".dropdown-menu")
7957      .slideToggle(animationTime);
7958    $(this).closest(".dropdown-submenu").addClass("opened");
7959  });
7960};
7961
7962CheckPopupTop = function () {
7963  // var popup = $(".jqmWindow.show");
7964  // if (popup.length) {
7965  //   var documentScollTop = $(document).scrollTop();
7966  //   var windowHeight = $(window).height();
7967  //   var popupTop = parseInt(popup.css("top"));
7968  //   var popupHeight = popup.height();
7969
7970  //   if (windowHeight >= popupHeight) {
7971  //     // center
7972  //     popupTop = (windowHeight - popupHeight) / 2;
7973  //   } else {
7974  //     if (documentScollTop > documentScrollTopLast) {
7975  //       // up
7976  //       popupTop -= documentScollTop - documentScrollTopLast;
7977  //     } else if (documentScollTop < documentScrollTopLast) {
7978  //       // down
7979  //       popupTop += documentScrollTopLast - documentScollTop;
7980  //     }
7981
7982  //     if (popupTop + popupHeight < windowHeight) {
7983  //       // bottom
7984  //       popupTop = windowHeight - popupHeight;
7985  //     } else if (popupTop > 0) {
7986  //       // top
7987  //       popupTop = 0;
7988  //     }
7989  //   }
7990  //   popup.css("top", popupTop + "px");
7991  // }
7992};
7993
7994CheckMainBannerSliderVText = function (slider) {
7995  /*if(slider.parents('.banners-big').length){
7996    var sh = slider.height();
7997    slider.find('.item').each(function() {
7998      var curSlideTextInner = $(this).find('.text .inner');
7999      if(curSlideTextInner.length){
8000        var ith = curSlideTextInner.actual('height');
8001        var p = (ith >= sh ? 0 : Math.floor((sh - ith) / 2));
8002        curSlideTextInner.css('padding-top', p + 'px');
8003      }
8004    });
8005  }*/
8006};
8007
8008CheckStickyFooter = function () {
8009  BX.addCustomEvent("onWindowResize", function (eventdata) {
8010    if (!isMobile) {
8011      try {
8012        var footerHeight = $("footer").outerHeight();
8013        ignoreResize.push(true);
8014        $("footer").css("margin-top", "-" + footerHeight + "px");
8015        $(".body").css("margin-bottom", "-" + footerHeight + "px");
8016        $(".main").css("padding-bottom", footerHeight + 0 + "px");
8017        ignoreResize.pop();
8018      } catch (e) { }
8019    }
8020  });
8021};
8022
8023verticalAlign = function (class_name) {
8024  if (typeof class_name == "undefined") class_name = "auto_align";
8025  if ($("." + class_name).length) {
8026    maxHeight = 0;
8027    $("." + class_name).each(function () {
8028      if ($(this).height() > maxHeight) {
8029        maxHeight = $(this).height();
8030      }
8031    });
8032    $("." + class_name).each(function () {
8033      delta = Math.round((maxHeight - $(this).height()) / 2);
8034      $(this).css({
8035        "padding-top": delta + "px",
8036        "padding-bottom": delta + "px",
8037      });
8038    });
8039  }
8040};
8041
8042getGridSize = function (counts, custom_counts) {
8043  var z = parseInt($(".body_media").css("top"));
8044  if (typeof custom_counts != "undefined") {
8045    if (window.matchMedia("(max-width: 700px)").matches)
8046      return counts[3] ? counts[3] : counts[2];
8047    else if (window.matchMedia("(max-width: 850px)").matches) return counts[2];
8048    else if (window.matchMedia("(max-width: 1100px)").matches) return counts[1];
8049    else return counts[0];
8050  } else {
8051    if (window.matchMedia("(max-width: 600px)").matches) {
8052      return counts[3] ? counts[3] : counts[2];
8053    } else return z == 2 ? counts[0] : z == 1 ? counts[1] : counts[2];
8054  }
8055};
8056
8057CheckFlexSlider = function () {
8058  $(".flexslider:not(.thmb):visible").each(function () {
8059    var slider = $(this);
8060    slider.resize();
8061    var counts = slider.data("flexslider").vars.counts,
8062      slide_counts = slider.data("flexslider").vars.slide_counts;
8063    if (typeof counts != "undefined") {
8064      var cnt = getGridSize(counts, slider.data("flexslider").vars.customGrid);
8065      var to0 =
8066        cnt != slider.data("flexslider").vars.minItems ||
8067        cnt != slider.data("flexslider").vars.maxItems ||
8068        cnt != slider.data("flexslider").vars.move;
8069      if (to0) {
8070        slider.data("flexslider").vars.minItems = cnt;
8071        slider.data("flexslider").vars.maxItems = cnt;
8072        if (typeof slide_counts != "undefined")
8073          slider.data("flexslider").vars.move = slide_counts;
8074        else slider.data("flexslider").vars.move = cnt;
8075
8076        slider.flexslider(0);
8077        slider.resize();
8078        slider.resize(); // twise!
8079      }
8080    }
8081  });
8082};
8083
8084CheckHeaderFixed = function () {
8085  var header_fixed = $("#headerfixed");
8086  header = $("header").first();
8087  if (header_fixed.length) {
8088    if (header.length) {
8089      var isHeaderFixed = false,
8090        headerCanFix = true,
8091        headerFixedHeight = header_fixed.actual("outerHeight"),
8092        headerNormalHeight = header.actual("outerHeight"),
8093        headerDiffHeight = headerNormalHeight - headerFixedHeight,
8094        mobileBtnMenu = $(".btn.btn-responsive-nav"),
8095        headerTop = $("#panel:visible").actual("outerHeight");
8096      (topBlock = $(".TOP_HEADER").first()),
8097        ($headerFixedNlo = header_fixed.find("[data-nlo]")),
8098        (isNloLoaded = !$headerFixedNlo.length),
8099        (OnHeaderFixedScrollHandler = "");
8100
8101      if (headerDiffHeight <= 0) headerDiffHeight = 0;
8102      if (topBlock.length) headerTop += topBlock.actual("outerHeight");
8103
8104      $(window).scroll(
8105        (OnHeaderFixedScrollHandler = function () {
8106          /*if(!isMobile && window.matchMedia('(min-width: 992px)').matches)
8107        {*/
8108          var scrollTop = $(window).scrollTop();
8109          headerCanFix =
8110            !mobileBtnMenu.is(
8111              ":visible"
8112            ) /* && !$('.dropdown-menu:visible').length*/;
8113
8114          var current_is = $(".search-wrapper .search-input:visible"),
8115            title_search_result = $(
8116              ".title-search-result." + current_is.attr("id")
8117            ),
8118            pos,
8119            pos_input;
8120
8121          if (!isHeaderFixed) {
8122            if (scrollTop > headerNormalHeight + headerTop && headerCanFix) {
8123              if (!isNloLoaded) {
8124                if (!$headerFixedNlo.hasClass("nlo-loadings")) {
8125                  $headerFixedNlo.addClass("nlo-loadings");
8126                  setTimeout(function () {
8127                    $.ajax({
8128                      data: { nlo: $headerFixedNlo.attr("data-nlo") },
8129                      complete: function (jqXHR, textStatus) {
8130                        if (textStatus === "success" || jqXHR.status == 404) {
8131                          // stop ya metrika webvisor DOM indexer
8132                          pauseYmObserver();
8133
8134                          isNloLoaded = true;
8135                          var ob = BX.processHTML($.trim(jqXHR.responseText));
8136                          BX.ajax.processScripts(ob.SCRIPT);
8137                          $headerFixedNlo.replaceWith(ob.HTML);
8138
8139                          OnHeaderFixedScrollHandler();
8140
8141                          // resume ya metrika webvisor
8142                          // (300ms transition) + (100ms scroll handler)
8143                          setTimeout(resumeYmObserver, 400);
8144
8145                          CheckTopMenuDotted();
8146                        }
8147                      },
8148                      error: function () {
8149                        $headerFixedNlo.removeClass("nlo-loadings");
8150                      },
8151                    });
8152                  }, 300);
8153                }
8154              } else {
8155                isHeaderFixed = true;
8156                header_fixed.css("top", "-" + headerNormalHeight + "px");
8157                header_fixed.addClass("fixed");
8158
8159                header_fixed.animate(
8160                  { top: "0" },
8161                  { duration: 300, complete: function () { } }
8162                );
8163                CheckTopMenuDotted();
8164              }
8165
8166              ///////
8167              // isHeaderFixed = true;
8168              // header_fixed.css('top', '-' + headerNormalHeight + 'px');
8169              // header_fixed.addClass('fixed');
8170              // // header_fixed.stop(0).animate({top: '0'}, 300);
8171
8172              // header_fixed.animate({top: '0'}, {duration:300, complete:
8173              // 	function(){}
8174              // });
8175              // CheckTopMenuDotted();
8176            }
8177          } else if (isHeaderFixed || !headerCanFix) {
8178            if (scrollTop <= headerDiffHeight + headerTop || !headerCanFix) {
8179              isHeaderFixed = false;
8180              header_fixed.removeClass("fixed");
8181            }
8182          }
8183          // }
8184        })
8185      );
8186    }
8187  }
8188
8189  //mobile fixed
8190  var mfixed = $(
8191    "body.mfixed_Y #mobileheader, body.mfixed_Y #mobileheadersimple"
8192  );
8193  if (mfixed.length && isMobile) {
8194    var isMHeaderFixed = false,
8195      mheaderCanFix = true,
8196      //mheaderFixedHeight = mfixed.actual('outerHeight'),
8197      mheaderFixedHeight = 0,
8198      mheaderTop = $("#panel:visible").actual("outerHeight");
8199    $(window).scroll(function () {
8200      var scrollTop = $(window).scrollTop();
8201      if (window.matchMedia("(max-width:991px)").matches) {
8202        if (
8203          $("body.mfixed_Y.mfixed_view_scroll_top #mobileheader").length ||
8204          $("body.mfixed_Y.mfixed_view_scroll_top #mobileheadersimple").length
8205        ) {
8206          if (scrollTop > startScroll) {
8207            $("body.mfixed_Y.mfixed_view_scroll_top #mobileheader").removeClass(
8208              "fixed"
8209            );
8210            $(
8211              "body.mfixed_Y.mfixed_view_scroll_top #mobileheadersimple"
8212            ).removeClass("fixed");
8213          } else if (scrollTop > mheaderFixedHeight + mheaderTop) {
8214            $("body.mfixed_Y.mfixed_view_scroll_top #mobileheader").addClass(
8215              "fixed"
8216            );
8217            $(
8218              "body.mfixed_Y.mfixed_view_scroll_top #mobileheadersimple"
8219            ).addClass("fixed");
8220          } else if (scrollTop <= mheaderFixedHeight + mheaderTop) {
8221            $("body.mfixed_Y.mfixed_view_scroll_top #mobileheader").removeClass(
8222              "fixed"
8223            );
8224            $(
8225              "body.mfixed_Y.mfixed_view_scroll_top #mobileheadersimple"
8226            ).removeClass("fixed");
8227          }
8228          startScroll = scrollTop;
8229        } else {
8230          if (!isMHeaderFixed) {
8231            if (scrollTop > mheaderFixedHeight + mheaderTop) {
8232              isMHeaderFixed = true;
8233              mfixed.addClass("fixed");
8234            }
8235          } else if (isMHeaderFixed) {
8236            if (scrollTop <= mheaderFixedHeight + mheaderTop) {
8237              isMHeaderFixed = false;
8238              mfixed.removeClass("fixed");
8239            }
8240          }
8241        }
8242      } else mfixed.removeClass("fixed");
8243    });
8244  }
8245};
8246
8247CheckObjectsSizes = function () {
8248  $(".container iframe,.container object,.container video").each(function () {
8249    var height_attr = $(this).attr("height");
8250    var width_attr = $(this).attr("width");
8251    if (height_attr && width_attr) {
8252      $(this).css("height", ($(this).outerWidth() * height_attr) / width_attr);
8253    }
8254  });
8255};
8256
8257scrollToTop = function () {
8258  if (arAllcorp2Options["THEME"]["SCROLLTOTOP_TYPE"] !== "NONE") {
8259    scrollToTopAnimateClassIn =
8260      arAllcorp2Options.THEME.SCROLLTOTOP_TYPE.indexOf("ROUND") !== -1
8261        ? "rotateIn"
8262        : "rubberBand";
8263    scrollToTopAnimateClassOut =
8264      arAllcorp2Options.THEME.SCROLLTOTOP_TYPE.indexOf("ROUND") !== -1
8265        ? "rotateOut"
8266        : "flipOutX";
8267    if (BX.browser.IsMac()) {
8268      scrollToTopAnimateClassIn = scrollToTopAnimateClassOut = "";
8269    }
8270    var _isScrolling = false;
8271    // Append Button
8272    $("body").append(
8273      $("<a />")
8274        .addClass(
8275          "scroll-to-top " +
8276          arAllcorp2Options["THEME"]["SCROLLTOTOP_TYPE"] +
8277          " " +
8278          arAllcorp2Options["THEME"]["SCROLLTOTOP_POSITION"]
8279        )
8280        .attr({ href: "#", id: "scrollToTop" })
8281    );
8282    $scrolltotop = $("#scrollToTop");
8283
8284    if (arAllcorp2Options.THEME.SCROLLTOTOP_POSITION_RIGHT)
8285      $scrolltotop.css({
8286        right: arAllcorp2Options.THEME.SCROLLTOTOP_POSITION_RIGHT + "px",
8287        left: "auto",
8288      });
8289
8290    $scrolltotop.click(function (e) {
8291      e.preventDefault();
8292      $("body, html").animate({ scrollTop: 0 }, 500);
8293      return false;
8294    });
8295    // Show/Hide Button on Window Scroll event.
8296    $(window).scroll(function () {
8297      if (!_isScrolling) {
8298        _isScrolling = true;
8299
8300        var bottom = 23,
8301          scrollVal = $(window).scrollTop(),
8302          windowHeight = $(window).height();
8303
8304        if (arAllcorp2Options.THEME.SCROLLTOTOP_POSITION_BOTTOM) {
8305          bottom = arAllcorp2Options.THEME.SCROLLTOTOP_POSITION_BOTTOM;
8306          $scrolltotop.css("bottom", bottom + "px");
8307        }
8308
8309        var footerOffset = 0;
8310        if ($("footer").get(0)) {
8311          footerOffset = $("footer").offset().top;
8312        }
8313        if (scrollVal > 150) {
8314          $("#scrollToTop").stop(true, true).addClass("visible");
8315          _isScrolling = false;
8316        } else {
8317          $("#scrollToTop").stop(true, true).removeClass("visible");
8318          _isScrolling = false;
8319        }
8320        CheckScrollToTop();
8321      }
8322    });
8323  }
8324};
8325
8326CheckScrollToTop = function () {
8327  if (
8328    arAllcorp2Options["THEME"]["SCROLLTOTOP_TYPE"] !== "NONE" &&
8329    $scrolltotop.length != undefined
8330  ) {
8331    if (documentScrollTop > 150) {
8332      $scrolltotop.stop(true, true).addClass("visible").addClass("animated");
8333      if (scrollToTopAnimateClassOut) {
8334        $scrolltotop.removeClass(scrollToTopAnimateClassOut);
8335      }
8336      if (scrollToTopAnimateClassIn) {
8337        $scrolltotop.addClass(scrollToTopAnimateClassIn);
8338      }
8339    } else {
8340      $scrolltotop.stop(true, true).removeClass("visible");
8341      if (scrollToTopAnimateClassIn) {
8342        $scrolltotop.removeClass(scrollToTopAnimateClassIn);
8343      }
8344      if (scrollToTopAnimateClassOut) {
8345        $scrolltotop.addClass(scrollToTopAnimateClassOut);
8346      }
8347    }
8348  }
8349  var bottom = 23,
8350    scrollVal = $(window).scrollTop(),
8351    windowHeight = $(window).height();
8352
8353  if (arAllcorp2Options.THEME.SCROLLTOTOP_POSITION_BOTTOM) {
8354    bottom = arAllcorp2Options.THEME.SCROLLTOTOP_POSITION_BOTTOM;
8355    $scrolltotop.css("bottom", bottom + "px");
8356  }
8357
8358  if ($("footer").length) var footerOffset = $("footer").offset().top;
8359
8360  if (scrollVal + windowHeight > footerOffset) {
8361    $("#scrollToTop").css(
8362      "bottom",
8363      bottom + scrollVal + windowHeight - footerOffset
8364    );
8365  } else if (parseInt($("#scrollToTop").css("bottom")) > bottom) {
8366    $("#scrollToTop").css("bottom", bottom);
8367  }
8368};
8369
8370$.fn.mCustomScrollbarDeferred = function (config) {
8371  $(this).addClass("scroll-init");
8372
8373  $(this).hover(
8374    function (e) {
8375      var $this = $(this);
8376      if (!$this.hasClass("mCustomScrollbar")) {
8377        $this.data(
8378          "scrollTimer",
8379          setTimeout(function () {
8380            $this.mCustomScrollbar(config);
8381            $this.off(
8382              "touchstart touchmove touchend mousewheel mouseenter mouseleave"
8383            );
8384          }, 200)
8385        );
8386      }
8387    },
8388    function (e) {
8389      clearTimeout($(this).data("scrollTimer"));
8390    }
8391  );
8392
8393  $(this).on("touchstart touchmove", function (e) {
8394    var $this = $(this);
8395    if (!$this.hasClass("mCustomScrollbar")) {
8396      $this.mCustomScrollbar(config);
8397    }
8398
8399    var $scrollContainer = $this.find(">.mCustomScrollBox>.mCSB_container");
8400    if ($scrollContainer.length) {
8401      var touch =
8402        e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
8403
8404      var newTouch = new Touch({
8405        identifier: 42,
8406        target: $scrollContainer[0],
8407        clientX: touch.clientX,
8408        clientY: touch.clientY,
8409        screenX: touch.screenX,
8410        screenY: touch.screenY,
8411        pageX: touch.pageX,
8412        pageY: touch.pageY,
8413        radiusX: 1,
8414        radiusY: 1,
8415      });
8416
8417      var newEvent = new TouchEvent(e.type, {
8418        cancelable: true,
8419        bubbles: true,
8420        composed: true,
8421        touches: [newTouch],
8422        targetTouches: [newTouch],
8423        changedTouches: [newTouch],
8424      });
8425
8426      $scrollContainer[0].dispatchEvent(newEvent);
8427    }
8428  });
8429
8430  $(this).on("touchend", function (e) {
8431    $(this).off(
8432      "touchstart touchmove touchend mousewheel mouseenter mouseleave"
8433    );
8434  });
8435
8436  if ($.event.special.mousewheel) {
8437    $(this).on("mousewheel", function (e) {
8438      var $this = $(this);
8439      if (!$this.hasClass("mCustomScrollbar")) {
8440        $this.mCustomScrollbar(config);
8441        $this.off(
8442          "touchstart touchmove touchend mousewheel mouseenter mouseleave"
8443        );
8444      }
8445    });
8446  }
8447};
8448
8449InitScrollBar = function (el, initOptions) {
8450  var block;
8451  if (typeof el === "undefined") {
8452    block = $(".srollbar-custom:not(.mobile-scroll):not(.scroll-init)");
8453  } else {
8454    block = el.filter(":not(.scroll-init)");
8455  }
8456
8457  if (block.length) {
8458    block.addClass("scroll-init");
8459
8460    var options,
8461      defaults = {
8462        mouseWheel: {
8463          scrollAmount: 150,
8464          preventDefault: true,
8465        },
8466      };
8467    var config = $.extend(
8468      {},
8469      defaults,
8470      options,
8471      block.data("plugin-options"),
8472      initOptions
8473    );
8474
8475    config.callbacks = {
8476      onScroll: function () {
8477        if ($(this).find(".mCSB_buttonLeft").hasClass("disabled"))
8478          $(this).find(".mCSB_buttonLeft").removeClass("disabled");
8479        if ($(this).find(".mCSB_buttonRight").hasClass("disabled"))
8480          $(this).find(".mCSB_buttonRight").removeClass("disabled");
8481      },
8482      onTotalScrollBack: function () {
8483        $(this).find(".mCSB_buttonLeft").addClass("disabled");
8484      },
8485      onTotalScroll: function () {
8486        $(this).find(".mCSB_buttonRight").addClass("disabled");
8487      },
8488      onInit: function () {
8489        $(this).find(".mCSB_buttonLeft").addClass("disabled");
8490      },
8491    };
8492
8493    block.filter(":not(.scroll-deferred)").mCustomScrollbar(config);
8494    block.filter(".scroll-deferred").mCustomScrollbarDeferred(config);
8495  }
8496};
8497
8498InitCustomScrollBar = function (el) {
8499  var block;
8500  if (typeof el === "undefined") {
8501    block = $(".scrollbar:not(.mobile-scroll):not(.scroll-init)");
8502  } else {
8503    block = el.filter(":not(.scroll-init)");
8504  }
8505
8506  if (block.length) {
8507    block.addClass("scroll-init");
8508
8509    var options,
8510      defaults = {
8511        effect: "fadeIn",
8512        effectTime: 300,
8513        threshold: 0,
8514        // threshold: 30
8515      };
8516
8517    var config = $.extend({}, defaults, options, block.data("plugin-options"));
8518
8519    block.filter(":not(.scroll-deferred)").mCustomScrollbar(config);
8520    block.filter(".scroll-deferred").mCustomScrollbarDeferred(config);
8521  }
8522};
8523
8524var isMobile = jQuery.browser.mobile;
8525var players = {};
8526
8527if (isMobile) {
8528  document.documentElement.className += " mobile";
8529}
8530
8531var timerScroll = false,
8532  ignoreScroll = [],
8533  documentScrollTopLast = $(document).scrollTop(),
8534  startScroll = 0;
8535
8536function pauseMainBanner() {
8537  $(".banners-big .flexslider").flexslider("pause");
8538}
8539
8540function playMainBanner() {
8541  $(".banners-big .flexslider").flexslider("play");
8542}
8543
8544function startMainBannerSlideVideo($slide) {
8545  var slideActiveIndex = $slide.attr("data-slide_index");
8546  var $slides = $slide
8547    .closest(".items")
8548    .find('.item[data-slide_index="' + slideActiveIndex + '"]'); // current slide & cloned
8549  var videoSource = $slide.attr("data-video_source");
8550  if (videoSource) {
8551    if (!$slides.hasClass("started")) {
8552      $slides.addClass("loading");
8553    }
8554    pauseMainBanner();
8555
8556    var videoPlayerSrc = $slide.attr("data-video_src");
8557    var videoSoundDisabled = $slide.attr("data-video_disable_sound");
8558    var bVideoSoundDisabled = videoSoundDisabled == 1;
8559    var videoLoop = $slide.attr("data-video_loop");
8560    var bVideoLoop = videoLoop == 1;
8561    var videoCover = $slide.attr("data-video_cover");
8562    var bVideoCover = videoCover == 1; //&& !isMobile
8563    var videoUnderText = $slide.attr("data-video_under_text");
8564    var bVideoUnderText = videoUnderText == 1;
8565    var videoPlayer = $slide.attr("data-video_player");
8566    var bVideoPlayerYoutube = videoPlayer === "YOUTUBE";
8567    var bVideoPlayerVimeo = videoPlayer === "VIMEO";
8568    var bVideoPlayerRutube = videoPlayer === "RUTUBE";
8569    var bVideoPlayerHtml5 = videoPlayer === "HTML5";
8570
8571    if (videoPlayerSrc && !$slide.find(".video").length) {
8572      var InitPlayer = function () {
8573        $slides.each(function (i, node) {
8574          var $_slide = $(node);
8575          var videoID = getRandomInt(100, 1000);
8576          var bClone = $_slide.hasClass("clone"); //,
8577          // 	tmp_class = $_slide.attr('id');
8578          // if(!$_slide.find('.video.'+tmp_class).length)
8579          // {
8580
8581          if (bVideoPlayerYoutube) {
8582            $_slide.prepend(
8583              '<div class="wrapper_video"><iframe id="player_' +
8584              videoID +
8585              '" class="video' +
8586              (bVideoCover ? " cover" : "") +
8587              '" src="' +
8588              videoPlayerSrc +
8589              '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; fullscreen;"></iframe></div>'
8590            );
8591          } else if (bVideoPlayerVimeo) {
8592            $_slide.prepend(
8593              '<div class="wrapper_video"><iframe id="player_' +
8594              videoID +
8595              '" class="video' +
8596              (bVideoCover ? " cover" : "") +
8597              '" src="' +
8598              videoPlayerSrc +
8599              '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; fullscreen;"></iframe></div>'
8600            );
8601          } else if (bVideoPlayerRutube) {
8602            videoPlayerSrc = videoPlayerSrc + "&playerid=" + videoID;
8603            $_slide.prepend(
8604              '<div class="wrapper_video"><iframe id="player_' +
8605              videoID +
8606              '" class="video' +
8607              (bVideoCover ? " cover" : "") +
8608              '" src="' +
8609              videoPlayerSrc +
8610              '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; fullscreen;"></iframe></div>'
8611            );
8612          } else if (bVideoPlayerHtml5) {
8613            $_slide.prepend(
8614              '<div class="wrapper_video"><video autobuffer playsinline webkit-playsinline autoplay id="player_' +
8615              videoID +
8616              '" class="video' +
8617              (bVideoCover ? " cover" : "") +
8618              '"' +
8619              (bVideoLoop ? " loop " : "") +
8620              (bVideoSoundDisabled || bClone ? " muted " : "") +
8621              '><source src="' +
8622              videoPlayerSrc +
8623              '" type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\' /><p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video</p></video></div>'
8624            );
8625          }
8626          // }
8627
8628          if (typeof players !== "undefined" && players) {
8629            players[videoID] = {
8630              id: "player_" + videoID,
8631              mute: bVideoSoundDisabled || bClone,
8632              loop: bVideoLoop,
8633              cover: bVideoCover,
8634              videoPlayer: videoPlayer,
8635              slideIndex: slideActiveIndex,
8636              clone: bClone,
8637              playing: false,
8638            };
8639
8640            if (bVideoPlayerYoutube) {
8641              window[players[videoID].id] = new YT.Player(players[videoID].id, {
8642                events: {
8643                  onReady: function (e) {
8644                    //var videoID = e.target.f.id.replace('player_', '')
8645                    if (videoID) {
8646                      var mute = players[videoID].mute;
8647                      var cover = players[videoID].cover;
8648                      var clone = players[videoID].clone;
8649
8650                      // mute sound
8651                      if (mute || clone) {
8652                        window[players[videoID].id].mute();
8653                      }
8654
8655                      // cover video
8656                      if (cover) {
8657                        CoverPlayer();
8658                      }
8659
8660                      // not start clone video playing
8661                      if (clone) {
8662                        setTimeout(function () {
8663                          e.target.pauseVideo();
8664                        }, 100);
8665                      } else {
8666                        // stop slider
8667                        pauseMainBanner();
8668                        e.target.playVideo();
8669
8670                        // e.target.playVideo();
8671                        // e.target.playVideo();
8672                      }
8673
8674                      // update slide class
8675                      var $slide = $("#player_" + videoID).closest(".item");
8676                      $slide.addClass("started");
8677                      //$slide.removeClass('loading')
8678                    }
8679                  },
8680                  onStateChange: function (e) {
8681                    // var videoID = e.target.a.id.replace('player_', '')
8682                    // var videoID = e.target.f.id.replace('player_', '')
8683                    if (videoID) {
8684                      var clone = players[videoID].clone;
8685                      var loop = players[videoID].loop;
8686                      var slideIndex = players[videoID].slideIndex;
8687                      var $btn = $("#" + players[videoID].id)
8688                        .closest(".item")
8689                        .find(".btn-video");
8690
8691                      if (!clone) {
8692                        if (e.data === YT.PlayerState.PLAYING) {
8693                          players[videoID].playing = true;
8694
8695                          //$('#player_'+videoID).closest('.item').find('.maxwidth-theme').addClass('loading');
8696                          //$('#player_'+videoID).closest('.item').find('.maxwidth-theme .btn-video').addClass('loading');
8697                          $btn.addClass("loading");
8698
8699                          // stop slider
8700                          pauseMainBanner();
8701
8702                          e.target.playVideo();
8703                        } else if (e.data === YT.PlayerState.PAUSED) {
8704                          players[videoID].playing = false;
8705                          $btn.removeClass("loading");
8706
8707                          // sync time in cloned players & pause
8708                          var time =
8709                            Math.floor(
8710                              window[players[videoID].id].getCurrentTime() * 10
8711                            ) / 10;
8712
8713                          window[players[videoID].id].seekTo(time, true);
8714                          for (var j in players) {
8715                            if (
8716                              players[j].slideIndex == slideIndex &&
8717                              players[j].clone
8718                            ) {
8719                              if ("getCurrentTime" in window[players[j].id]) {
8720                                window[players[j].id].pauseVideo();
8721                                window[players[j].id].seekTo(time, true);
8722                              }
8723                            }
8724                          }
8725                        } else if (e.data === YT.PlayerState.ENDED) {
8726                          players[videoID].playing = false;
8727                          $btn.removeClass("loading");
8728                          if (loop) {
8729                            e.target.playVideo();
8730                          } else {
8731                            // play slider
8732                            playMainBanner();
8733                          }
8734                        }
8735                      }
8736                    }
8737                  },
8738                },
8739              });
8740            } else if (bVideoPlayerVimeo) {
8741              window[players[videoID].id] = new Vimeo.Player(
8742                document.getElementById(players[videoID].id),
8743                { autopause: false, byline: false, loop: false, title: false }
8744              );
8745              window[players[videoID].id].on("loaded", onVimeoPlayerReady);
8746              window[players[videoID].id].on("play", onVimeoPlayerStateChange);
8747              window[players[videoID].id].on("pause", onVimeoPlayerStateChange);
8748              window[players[videoID].id].on("ended", onVimeoPlayerStateChange);
8749            } else if (bVideoPlayerRutube) {
8750              document.getElementById(players[videoID].id).onload = function (
8751                e
8752              ) {
8753                var videoID = this.id.replace("player_", "");
8754                players[videoID].contentWindow = this.contentWindow;
8755                onRutubePlayerReady(videoID);
8756              };
8757            } else if (bVideoPlayerHtml5) {
8758              document
8759                .getElementById(players[videoID].id)
8760                .addEventListener("loadeddata", onHtml5PlayerReady);
8761              document
8762                .getElementById(players[videoID].id)
8763                .addEventListener("play", onHtml5PlayerStateChange);
8764              document
8765                .getElementById(players[videoID].id)
8766                .addEventListener("pause", onHtml5PlayerStateChange);
8767              document
8768                .getElementById(players[videoID].id)
8769                .addEventListener("ended", onHtml5PlayerStateChange);
8770            }
8771          }
8772        });
8773      };
8774
8775      if (!bVideoPlayerHtml5) {
8776        var obPlayerVariable = "";
8777        var fnPlayerVariable = "";
8778        if (typeof window["YoutubePlayerScriptLoaded"] === "undefined") {
8779          window["YoutubePlayerScriptLoaded"] = false;
8780        }
8781        if (typeof window["VimeoPlayerScriptLoaded"] === "undefined") {
8782          window["VimeoPlayerScriptLoaded"] = false;
8783        }
8784        if (typeof window["RutubePlayerListnersAdded"] === "undefined") {
8785          window["RutubePlayerListnersAdded"] = false;
8786        }
8787
8788        // load script
8789        if (bVideoPlayerYoutube) {
8790          obPlayerVariable = "YT";
8791          fnPlayerVariable = "Player";
8792          if (!window["YoutubePlayerScriptLoaded"]) {
8793            var script = document.createElement("script");
8794            script.src = "https://www.youtube.com/iframe_api";
8795            var firstScriptTag = document.getElementsByTagName("script")[0];
8796            firstScriptTag.parentNode.insertBefore(script, firstScriptTag);
8797            window["YoutubePlayerScriptLoaded"] = true;
8798          }
8799        } else if (bVideoPlayerVimeo) {
8800          obPlayerVariable = "Vimeo";
8801          if (!window["VimeoPlayerScriptLoaded"]) {
8802            var script = document.createElement("script");
8803            script.src = "https://player.vimeo.com/api/player.js";
8804            (document.head || document.documentElement).appendChild(script);
8805            window["VimeoPlayerScriptLoaded"] = true;
8806          }
8807        } else if (bVideoPlayerRutube) {
8808          if (!window["RutubePlayerListnersAdded"]) {
8809            window.addEventListener("message", function (e) {
8810              if (e.origin.indexOf("rutube.ru") !== -1) {
8811                var message = JSON.parse(e.data);
8812                if (typeof message === "object" && message) {
8813                  if (typeof message.type !== "undefined" && message.type) {
8814                    var videoID = false;
8815
8816                    for (var j in players) {
8817                      if (typeof players[j].contentWindow !== "undefined") {
8818                        if (players[j].contentWindow == e.source) {
8819                          videoID = j;
8820                          break;
8821                        }
8822                      }
8823                    }
8824
8825                    if (videoID) {
8826                      switch (message.type) {
8827                        case "player:changeState":
8828                          onRutubePlayerStateChange(
8829                            videoID,
8830                            message.data.state
8831                          );
8832                          break;
8833                        case "player:currentTime":
8834                          onRutubePlayerCurrentTime(videoID, message.data.time);
8835                          break;
8836                      }
8837                    }
8838                  }
8839                }
8840              }
8841            });
8842          }
8843        }
8844
8845        if (!obPlayerVariable.length) {
8846          InitPlayer();
8847        } else {
8848          // wait player class
8849          if (typeof window[obPlayerVariable] === "object") {
8850            if (
8851              !fnPlayerVariable.length ||
8852              (fnPlayerVariable.length &&
8853                typeof window[obPlayerVariable][fnPlayerVariable] ===
8854                "function")
8855            ) {
8856              InitPlayer();
8857            }
8858          } else {
8859            var waitPlayerInterval = setInterval(function () {
8860              if (typeof window[obPlayerVariable] === "object") {
8861                if (
8862                  !fnPlayerVariable.length ||
8863                  (fnPlayerVariable.length &&
8864                    typeof window[obPlayerVariable][fnPlayerVariable] ===
8865                    "function")
8866                ) {
8867                  clearInterval(waitPlayerInterval);
8868
8869                  InitPlayer();
8870                }
8871              }
8872            }, 50);
8873          }
8874        }
8875      } else {
8876        InitPlayer();
8877      }
8878    } else {
8879      // pause play video
8880      if (typeof players !== "undefined" && players) {
8881        for (var j in players) {
8882          if (
8883            /*players[j].playing &&*/ !players[j]
8884              .clone /* && (players[j].slideIndex != curSlideIndex)*/
8885          ) {
8886            if (typeof window[players[j].id] == "object") {
8887              if (players[j].playing) {
8888                if (players[j].videoPlayer === "YOUTUBE") {
8889                  window[players[j].id].pauseVideo();
8890                } else if (players[j].videoPlayer === "VIMEO") {
8891                  window[players[j].id].pause();
8892                } else if (players[j].videoPlayer === "RUTUBE") {
8893                  document
8894                    .getElementById(players[j].id)
8895                    .contentWindow.postMessage(
8896                      JSON.stringify({
8897                        type: "player:pause",
8898                        data: {},
8899                      }),
8900                      "*"
8901                    );
8902                } else if (players[j].videoPlayer === "HTML5") {
8903                  document.getElementById(players[j].id).pause();
8904                }
8905              } else if (players[j].slideIndex == slideActiveIndex) {
8906                if (players[j].videoPlayer === "YOUTUBE") {
8907                  window[players[j].id].playVideo();
8908                } else if (players[j].videoPlayer === "VIMEO") {
8909                  window[players[j].id].play();
8910                } else if (players[j].videoPlayer === "RUTUBE") {
8911                  document
8912                    .getElementById(players[j].id)
8913                    .contentWindow.postMessage(
8914                      JSON.stringify({
8915                        type: "player:play",
8916                        data: {},
8917                      }),
8918                      "*"
8919                    );
8920                } else if (players[j].videoPlayer === "HTML5") {
8921                  document.getElementById(players[j].id).play();
8922                }
8923              }
8924            }
8925          }
8926        }
8927      }
8928    }
8929  }
8930}
8931
8932var CoverPlayer = function () {
8933  var $videoCover = $(".video.cover");
8934  if ($videoCover.length) {
8935    var bannersHeight = $(".banners-big").height();
8936    var bannersWidth = $(".banners-big").width();
8937    var windowWidth = $(window).width();
8938    var height = (windowWidth * 2.4) / 3.55;
8939    height = height < 240 ? 240 : height;
8940    height = height > 240 && height < 660 ? 660 : height;
8941    $videoCover.css({
8942      height: height + "px",
8943      "margin-top": (bannersHeight - height) / 2 + "px",
8944    });
8945  }
8946};
8947
8948function onVimeoPlayerReady(e) {
8949  var videoID = this.element.id.replace("player_", "");
8950  if (videoID) {
8951    var mute = players[videoID].mute;
8952    var cover = players[videoID].cover;
8953    var clone = players[videoID].clone;
8954
8955    // mute sound
8956    if (mute || clone) {
8957      window[players[videoID].id].setVolume(0);
8958    }
8959
8960    // cover video
8961    if (cover) {
8962      CoverPlayer();
8963    }
8964
8965    // not start clone video playing
8966    if (clone) {
8967      setTimeout(function () {
8968        window[players[videoID].id].pause();
8969      }, 100);
8970    } else {
8971      // stop slider
8972      pauseMainBanner();
8973
8974      window[players[videoID].id].play();
8975    }
8976
8977    // update slide class
8978    var $slide = $("#player_" + videoID).closest(".item");
8979    $slide.addClass("started");
8980    // $slide.removeClass('loading')
8981  }
8982}
8983
8984function onVimeoPlayerStateChange(e) {
8985  var videoID = this.element.id.replace("player_", "");
8986  if (videoID) {
8987    var cover = players[videoID].cover;
8988    var clone = players[videoID].clone;
8989    var loop = players[videoID].loop;
8990    var slideIndex = players[videoID].slideIndex;
8991    var $btn = $("#" + players[videoID].id)
8992      .closest(".item")
8993      .find(".btn-video");
8994
8995    if (!clone) {
8996      window[players[videoID].id].getPaused().then(function (paused) {
8997        if (paused) {
8998          players[videoID].playing = false;
8999          $btn.removeClass("loading");
9000          // sync time in cloned players & pause
9001          window[players[videoID].id].getCurrentTime().then(function (seconds) {
9002            var time = Math.floor(seconds * 10) / 10;
9003            window[players[videoID].id]
9004              .setCurrentTime(time)
9005              .then(function (seconds) {
9006                for (var j in players) {
9007                  if (players[j].slideIndex == slideIndex && players[j].clone) {
9008                    window[players[j].id].pause();
9009                    window[players[j].id]
9010                      .setCurrentTime(time)
9011                      .then(function (seconds) { });
9012                  }
9013                }
9014              });
9015          });
9016        } else {
9017          //$('#player_'+videoID).closest('.item').find('.maxwidth-theme').addClass('loading');
9018          // $('#player_'+videoID).closest('.item').find('.maxwidth-theme .btn-video').addClass('loading');
9019          window[players[videoID].id].getEnded().then(function (ended) {
9020            if (ended) {
9021              players[videoID].playing = false;
9022              $btn.removeClass("loading");
9023              if (loop) {
9024                window[players[videoID].id].play();
9025              } else {
9026                // play slider
9027                playMainBanner();
9028              }
9029            } else {
9030              players[videoID].playing = true;
9031              $btn.addClass("loading");
9032
9033              // stop slider
9034              pauseMainBanner();
9035            }
9036          });
9037        }
9038      });
9039    }
9040  }
9041}
9042
9043function onRutubePlayerReady(videoID) {
9044  if (videoID) {
9045    var mute = players[videoID].mute;
9046    var cover = players[videoID].cover;
9047    var clone = players[videoID].clone;
9048    var player = document.getElementById(players[videoID].id);
9049
9050    // mute sound
9051    if (mute || clone) {
9052      player.contentWindow.postMessage(
9053        JSON.stringify({
9054          type: "player:mute",
9055          data: {},
9056        }),
9057        "*"
9058      );
9059    }
9060
9061    // cover video
9062    if (cover) {
9063      CoverPlayer();
9064    }
9065
9066    // not start clone video playing
9067    if (clone) {
9068      setTimeout(function () {
9069        player.contentWindow.postMessage(
9070          JSON.stringify({
9071            type: "player:pause",
9072            data: {},
9073          }),
9074          "*"
9075        );
9076      }, 100);
9077    } else {
9078      // stop slider
9079      pauseMainBanner();
9080
9081      player.contentWindow.postMessage(
9082        JSON.stringify({
9083          type: "player:play",
9084          data: {},
9085        }),
9086        "*"
9087      );
9088    }
9089
9090    // update slide class
9091    var $slide = $("#player_" + videoID).closest(".item");
9092    $slide.addClass("started");
9093    // $slide.removeClass('loading')
9094  }
9095}
9096
9097function onRutubePlayerCurrentTime(videoID, time) {
9098  if (videoID) {
9099    players[videoID].time = time;
9100  }
9101}
9102
9103function onRutubePlayerStateChange(videoID, state) {
9104  if (videoID) {
9105    var clone = players[videoID].clone;
9106    var loop = players[videoID].loop;
9107    var slideIndex = players[videoID].slideIndex;
9108    var player = document.getElementById(players[videoID].id);
9109
9110    if (!clone) {
9111      if (state === "playing") {
9112        $("#" + videoID)
9113          .closest(".item")
9114          .find(".maxwidth-theme")
9115          .addClass("loading");
9116        $("#" + videoID)
9117          .closest(".item")
9118          .find(".maxwidth-theme .btn-video")
9119          .addClass("loading");
9120
9121        players[videoID].playing = true;
9122
9123        // stop slider
9124        pauseMainBanner();
9125      } else if (state === "paused") {
9126        players[videoID].playing = false;
9127
9128        // sync time in cloned players & pause
9129        var time = Math.floor(players[videoID].time * 10) / 10;
9130        player.contentWindow.postMessage(
9131          JSON.stringify({
9132            type: "player:setCurrentTime",
9133            data: { time: time },
9134          }),
9135          "*"
9136        );
9137        for (var j in players) {
9138          if (players[j].slideIndex == slideIndex && players[j].clone) {
9139            document.getElementById(players[j].id).contentWindow.postMessage(
9140              JSON.stringify({
9141                type: "player:pause",
9142                data: {},
9143              }),
9144              "*"
9145            );
9146            document.getElementById(players[j].id).contentWindow.postMessage(
9147              JSON.stringify({
9148                type: "player:setCurrentTime",
9149                data: { time: time },
9150              }),
9151              "*"
9152            );
9153          }
9154        }
9155      } else if (state === "stopped") {
9156        $("#" + videoID)
9157          .closest(".item")
9158          .find(".maxwidth-theme")
9159          .removeClass("loading");
9160        $("#" + videoID)
9161          .closest(".item")
9162          .find(".maxwidth-theme .btn-video")
9163          .removeClass("loading");
9164
9165        players[videoID].playing = false;
9166        if (loop) {
9167          player.contentWindow.postMessage(
9168            JSON.stringify({
9169              type: "player:play",
9170              data: {},
9171            }),
9172            "*"
9173          );
9174        } else {
9175          // play slider
9176          playMainBanner();
9177        }
9178      }
9179    }
9180  }
9181}
9182
9183function onHtml5PlayerReady(e) {
9184  var videoID = e.target.id.replace("player_", "");
9185  if (videoID) {
9186    var mute = players[videoID].mute;
9187    var cover = players[videoID].cover;
9188    var clone = players[videoID].clone;
9189
9190    // mute sound
9191    if (mute || clone) {
9192      $("#" + players[videoID].id).prop("muted", true);
9193    }
9194
9195    // cover video
9196    if (cover) {
9197      CoverPlayer();
9198    }
9199
9200    // not start clone video playing
9201    if (clone) {
9202      e.target.pause();
9203    } else {
9204      // stop slider
9205      pauseMainBanner();
9206
9207      e.target.play();
9208    }
9209
9210    // update slide class
9211    var $slide = $("#player_" + videoID).closest(".item");
9212    $slide.addClass("started");
9213    // $slide.removeClass('loading')
9214  }
9215}
9216
9217function onHtml5PlayerStateChange(e) {
9218  var videoID = e.target.id.replace("player_", "");
9219  if (videoID) {
9220    var cover = players[videoID].cover;
9221    var clone = players[videoID].clone;
9222    var loop = players[videoID].loop;
9223    var slideIndex = players[videoID].slideIndex;
9224
9225    if (!clone) {
9226      if (e.target.paused) {
9227        players[videoID].playing = false;
9228
9229        // sync time in cloned players & pause
9230        var time = Math.floor(e.target.currentTime * 10) / 10;
9231        e.target.currentTime = time;
9232        for (var j in players) {
9233          if (players[j].slideIndex == slideIndex && players[j].clone) {
9234            document.getElementById(players[j].id).pause();
9235            document.getElementById(players[j].id).currentTime = time;
9236          }
9237        }
9238      } else if (e.target.ended) {
9239        players[videoID].playing = false;
9240        if (loop) {
9241          $("#player_" + videoID)
9242            .closest(".item")
9243            .find(".maxwidth-theme")
9244            .addClass("loading");
9245          $("#player_" + videoID)
9246            .closest(".item")
9247            .find(".maxwidth-theme .btn-video")
9248            .addClass("loading");
9249
9250          e.target.play();
9251        } else {
9252          // play slider
9253          playMainBanner();
9254        }
9255      } else {
9256        players[videoID].playing = true;
9257        if (!$(this).closest(".banners-big").hasClass("view_2")) {
9258          $("#player_" + videoID)
9259            .closest(".item")
9260            .find(".maxwidth-theme")
9261            .addClass("loading");
9262          $("#player_" + videoID)
9263            .closest(".item")
9264            .find(".maxwidth-theme .btn-video")
9265            .addClass("loading");
9266        }
9267        // stop slider
9268        pauseMainBanner();
9269      }
9270    }
9271  }
9272}
9273
9274$.fn.equalizeHeights = function (outer, classNull, minHeight, autoHeightBlock) {
9275  var maxHeight = this.map(function (i, e) {
9276    var minus_height = 0,
9277      calc_height = 0;
9278    if (classNull !== false && $(e).find(classNull).is(":visible"))
9279      minus_height = parseInt($(e).find(classNull).actual("outerHeight"));
9280    if (minus_height) minus_height += 15;
9281    $(e).css("height", "");
9282    if (autoHeightBlock !== false) {
9283      var height_tmp = $(e).find(autoHeightBlock).css("height");
9284      $(e).find(autoHeightBlock).css("height", "");
9285    }
9286    if (outer == true) {
9287      calc_height = $(e).actual("outerHeight") - minus_height;
9288    } else {
9289      calc_height = $(e).actual("height") - minus_height;
9290    }
9291
9292    if (autoHeightBlock !== false) {
9293      $(e).find(autoHeightBlock).css("height", height_tmp);
9294    }
9295    if (minHeight !== false) {
9296      if (calc_height < minHeight) {
9297        calc_height += minHeight - calc_height;
9298      }
9299      if (window.matchMedia("(max-width: 520px)").matches) {
9300        calc_height = 300;
9301      }
9302      if (window.matchMedia("(max-width: 400px)").matches) {
9303        calc_height = 200;
9304      }
9305    }
9306    return calc_height;
9307  }).get();
9308
9309  for (var i = 0, c = maxHeight.length; i < c; ++i) {
9310    if (maxHeight[i] % 2) {
9311      --maxHeight[i];
9312    }
9313  }
9314
9315  return this.height(Math.max.apply(this, maxHeight));
9316};
9317
9318$.fn.getFloatWidth = function () {
9319  var width = 0;
9320
9321  if ($(this).length) {
9322    var rect = $(this)[0].getBoundingClientRect();
9323    if (!(width = rect.width)) {
9324      width = rect.right - rect.left;
9325    }
9326  }
9327
9328  return width;
9329};
9330
9331$.fn.sliceHeight = function (options) {
9332  function _slice(el) {
9333    el.each(function () {
9334      $(this).css("line-height", "");
9335      $(this).css("height", "");
9336    });
9337    if (
9338      typeof options.autoslicecount == "undefined" ||
9339      options.autoslicecount !== false
9340    ) {
9341      var elsw =
9342        typeof options.row !== "undefined" && options.row.length
9343          ? el.first().parents(options.row).getFloatWidth()
9344          : el.first().parents(".items").getFloatWidth(),
9345        elw =
9346          typeof options.item !== "undefined" && options.item.length
9347            ? $(options.item).first().getFloatWidth()
9348            : el.first().hasClass("item")
9349              ? el.first().getFloatWidth()
9350              : el.first().parents(".item").getFloatWidth();
9351
9352      if (!elsw) {
9353        elsw = el.first().parents(".row").getFloatWidth();
9354      }
9355      if (elw && options.fixWidth) elw -= options.fixWidth;
9356
9357      if (elsw && elw) {
9358        options.slice = Math.floor(elsw / elw);
9359      }
9360    }
9361    if (
9362      typeof options.typeResize == "undefined" ||
9363      options.typeResize == false
9364    ) {
9365      if (options.sliceEqualLength && el.closest(".flexslider").length)
9366        options.slice = el.length;
9367      if (options.slice) {
9368        for (var i = 0; i < el.length; i += options.slice) {
9369          $(el.slice(i, i + options.slice)).equalizeHeights(
9370            options.outer,
9371            options.classNull,
9372            options.minHeight,
9373            options.autoHeightBlock
9374          );
9375        }
9376      }
9377      if (options.lineheight) {
9378        var lineheightAdd = parseInt(options.lineheight);
9379        if (isNaN(lineheightAdd)) {
9380          lineheightAdd = 0;
9381        }
9382        el.each(function () {
9383          $(this).css(
9384            "line-height",
9385            $(this).actual("height") + lineheightAdd + "px"
9386          );
9387        });
9388      }
9389    }
9390
9391    if (typeof options.callback == "function") options.callback(el);
9392  }
9393  var options = $.extend(
9394    {
9395      slice: null,
9396      outer: false,
9397      lineheight: false,
9398      autoslicecount: true,
9399      classNull: false,
9400      minHeight: false,
9401      row: false,
9402      item: false,
9403      typeResize: false,
9404      resize: true,
9405      typeValue: false,
9406      sliceEqualLength: false,
9407      fixWidth: 0,
9408      callback: false,
9409      autoHeightBlock: false,
9410    },
9411    options
9412  );
9413
9414  var el = $(this);
9415  ignoreResize.push(true);
9416  _slice(el);
9417  ignoreResize.pop();
9418
9419  if (options.resize != false) {
9420    BX.addCustomEvent("onWindowResize", function (eventdata) {
9421      ignoreResize.push(true);
9422      _slice(el);
9423      ignoreResize.pop();
9424    });
9425  }
9426};
9427
9428waitingExists = function (selector, delay, callback) {
9429  if (typeof callback !== "undefined" && selector.length && delay > 0) {
9430    delay = parseInt(delay);
9431    delay = delay < 0 ? 0 : delay;
9432
9433    if (!$(selector).length) {
9434      setTimeout(function () {
9435        waitingExists(selector, delay, callback);
9436      }, delay);
9437    } else {
9438      callback();
9439    }
9440  }
9441};
9442
9443waitingNotExists = function (
9444  selectorExists,
9445  selectorNotExists,
9446  delay,
9447  callback
9448) {
9449  if (
9450    typeof callback !== "undefined" &&
9451    selectorExists.length &&
9452    selectorNotExists.length &&
9453    delay > 0
9454  ) {
9455    delay = parseInt(delay);
9456    delay = delay < 0 ? 0 : delay;
9457
9458    setTimeout(function () {
9459      if (selectorExists.length && !$(selectorNotExists).length) {
9460        callback();
9461      }
9462    }, delay);
9463  }
9464};
9465
9466function onLoadjqm(hash) {
9467  var name = $(hash.t).data("name"),
9468    top =
9469      ($(window).height() > hash.w.height()
9470        ? Math.floor(($(window).height() - hash.w.height()) / 2)
9471        : 0) + "px";
9472  $.each($(hash.t).get(0).attributes, function (index, attr) {
9473    if (/^data\-autoload\-(.+)$/.test(attr.nodeName)) {
9474      var key = attr.nodeName.match(/^data\-autoload\-(.+)$/)[1];
9475      var el = $('input[name="' + key.toUpperCase() + '"]');
9476      if (!el.length)
9477        //is form block
9478        el = $('input[data-sid="' + key.toUpperCase() + '"]');
9479
9480      var value = $(hash.t).data("autoload-" + key);
9481      value = value.replace(/%99/g, "\\"); // replace symbol \
9482
9483      el.val(BX.util.htmlspecialcharsback(value)).attr("readonly", "readonly");
9484      el.closest(".form-group").addClass("input-filed");
9485      el.attr("title", el.val());
9486    }
9487  });
9488  if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) {
9489    $("body").css({ overflow: "hidden", height: "100vh" });
9490    hash.w.closest("#popup_iframe_wrapper").css({ "z-index": 3000, display: "flex" });
9491  }
9492  var eventdata = { action: "loadForm" };
9493  BX.onCustomEvent("onCompleteAction", [eventdata, $(hash.t)[0]]);
9494
9495  if ($(hash.t).data("autohide")) {
9496    $(hash.w).data("autohide", $(hash.t).data("autohide"));
9497  }
9498  if (name == "order_product") {
9499    if ($(hash.t).data("product")) {
9500      $('input[name="PRODUCT"]').closest(".form-group").addClass("input-filed");
9501      $('input[name="PRODUCT"]')
9502        .val($(hash.t).data("product"))
9503        .attr("readonly", "readonly")
9504        .attr("title", $('input[name="PRODUCT"]').val());
9505    }
9506  }
9507  if (name == "question") {
9508    if ($(hash.t).data("product")) {
9509      $('input[name="NEED_PRODUCT"]')
9510        .closest(".form-group")
9511        .addClass("input-filed");
9512      $('input[name="NEED_PRODUCT"]')
9513        .val($(hash.t).data("product"))
9514        .attr("readonly", "readonly")
9515        .attr("title", $('input[name="NEED_PRODUCT"]').val());
9516    }
9517  }
9518
9519  if (
9520    arAllcorp2Options["THEME"]["REGIONALITY_SEARCH_ROW"] == "Y" &&
9521    (hash.w.hasClass("city_chooser_frame ") ||
9522      hash.w.hasClass("city_chooser_small_frame"))
9523  )
9524    hash.w.addClass("small_popup_regions");
9525
9526  hash.w.addClass("show").css({
9527    //"margin-left": "-" + Math.floor(hash.w.width() / 2) + "px",
9528    //top: top,
9529    opacity: 1,
9530  });
9531  hash.w.addClass("scrollblock");
9532
9533  //show password eye
9534  if (hash.w.hasClass("auth_frame")) {
9535    hash.w.find(".form-group:not(.eye-password-ignore) [type=password]").each(function (item) {
9536      $(this).closest(".form-group").addClass("eye-password");
9537    });
9538  }
9539}
9540
9541function onHide(hash) {
9542  if ($(hash.w).data("autohide")) {
9543    eval($(hash.w).data("autohide"));
9544  }
9545  if (!hash.w.closest("#popup_iframe_wrapper").find(".jqmOverlay").length) {
9546    hash.w.closest("#popup_iframe_wrapper").css({ "z-index": "", display: "" });
9547  }
9548  // hash.w.css('opacity', 0).hide();
9549  hash.w.animate({ opacity: 0 }, 200, function () {
9550    hash.w.hide();
9551    hash.w.empty();
9552    hash.o.remove();
9553    hash.w.removeClass("show");
9554    $("body").css({ overflow: "", height: "" });
9555    if (!hash.w.closest("#popup_iframe_wrapper").find(".jqmOverlay").length) {
9556      hash.w.closest("#popup_iframe_wrapper").css({ "z-index": "", display: "" });
9557    }
9558  });
9559}
9560
9561function parseUrlQuery() {
9562  var data = {};
9563  if (location.search) {
9564    var pair = location.search.substr(1).split("&");
9565    for (var i = 0; i < pair.length; i++) {
9566      var param = pair[i].split("=");
9567      data[param[0]] = param[1];
9568    }
9569  }
9570  return data;
9571}
9572
9573function scroll_block(block) {
9574  if (block.length) {
9575    var topPos = block.offset().top,
9576      headerH = $("header").outerHeight(true, true);
9577    if ($(".stores_tab").length) {
9578      $(".stores_tab").addClass("active").siblings().removeClass("active");
9579    } else {
9580      $(".prices_tab").addClass("active").siblings().removeClass("active");
9581      if (
9582        $(".prices_tab .opener").length &&
9583        !$(".prices_tab .opener .opened").length
9584      ) {
9585        var item = $(".prices_tab .opener").first();
9586        item.find(".opener_icon").addClass("opened");
9587        item.parents("tr").addClass("nb");
9588        item
9589          .parents("tr")
9590          .next(".offer_stores")
9591          .find(".stores_block_wrap")
9592          .slideDown(200);
9593      }
9594    }
9595    $("html,body").animate({ scrollTop: topPos - 80 }, 150);
9596  }
9597}
9598
9599$.fn.jqmEx = function () {
9600  $(this).each(function () {
9601    var _this = $(this);
9602    var name = _this.data("name");
9603
9604    if (name.length) {
9605      var script = arAllcorp2Options["SITE_DIR"] + "ajax/form.php";
9606      var paramsStr = "";
9607      var trigger = "";
9608      var arTriggerAttrs = {};
9609      $.each(_this.get(0).attributes, function (index, attr) {
9610        var attrName = attr.nodeName;
9611        var attrValue = _this.attr(attrName);
9612        trigger += "[" + attrName + '="' + attrValue + '"]';
9613        arTriggerAttrs[attrName] = attrValue;
9614        if (/^data\-param\-(.+)$/.test(attrName)) {
9615          var key = attrName.match(/^data\-param\-(.+)$/)[1];
9616          paramsStr += key + "=" + attrValue + "&";
9617        }
9618      });
9619      var triggerAttrs = JSON.stringify(arTriggerAttrs);
9620      var encTriggerAttrs = encodeURIComponent(triggerAttrs);
9621
9622      if (name == "auth") script += "?" + paramsStr + "auth=Y";
9623      else script += "?" + paramsStr + "data-trigger=" + encTriggerAttrs;
9624
9625      if (
9626        !$("." + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').length
9627      ) {
9628        if (_this.attr("disabled") != "disabled") {
9629          $("body #popup_iframe_wrapper")
9630            .find("." + name + '_frame[data-trigger="' + encTriggerAttrs + '"]')
9631            .remove();
9632          $("body #popup_iframe_wrapper").append(
9633            '<div class="' +
9634            name +
9635            '_frame jqmWindow" style="width:500px" data-trigger="' +
9636            encTriggerAttrs +
9637            '"></div>'
9638          );
9639          $("." + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').jqm({
9640            trigger: trigger,
9641            onLoad: function (hash) {
9642              onLoadjqm(hash);
9643            },
9644            onHide: function (hash) {
9645              onHide(hash);
9646            },
9647            ajax: script,
9648          });
9649        }
9650      }
9651    }
9652    return;
9653  });
9654};
9655
9656InitFlexSlider = function () {
9657  $(".flexslider:not(.thmb):not(.flexslider-init):visible").each(function () {
9658    var slider = $(this);
9659    var options;
9660    var defaults = {
9661      animationLoop: false,
9662      controlNav: false,
9663      directionNav: true,
9664      animation: "slide",
9665    };
9666    var config = $.extend({}, defaults, options, slider.data("plugin-options"));
9667    if (
9668      typeof config.counts != "undefined" &&
9669      config.direction !== "vertical"
9670    ) {
9671      var slide_counts = "";
9672      if (typeof slider.data("plugin-options") != "undefined") {
9673        if ("slide_counts" in slider.data("plugin-options"))
9674          slide_counts = slider.data("plugin-options").slide_counts;
9675      }
9676      config.maxItems = getGridSize(config.counts);
9677      config.minItems = getGridSize(config.counts);
9678
9679      if (slide_counts) config.move = slide_counts;
9680      else config.move = getGridSize(config.counts);
9681
9682      config.itemWidth = 200;
9683    }
9684
9685    // custom direction nav
9686    if (typeof config.customDirection != "undefined")
9687      config.customDirectionNav = $(config.customDirection);
9688
9689    (config.prevText = BX.message("FANCY_PREV")), //String: Set the text for the "previous" directionNav item
9690      (config.nextText = BX.message("FANCY_NEXT")),
9691      (config.after = config.start =
9692        function (slider) {
9693          var eventdata = { slider: slider };
9694          BX.onCustomEvent("onSlide", [eventdata]);
9695        });
9696
9697    config.before = function (slider) {
9698      var eventdata = { slider: slider };
9699      BX.onCustomEvent("onSlideBefore", [eventdata]);
9700    };
9701
9702    config.end = function (slider) {
9703      var eventdata = { slider: slider };
9704      BX.onCustomEvent("onSlideEnd", [eventdata]);
9705    };
9706
9707    /*if(typeof(config.nav) == 'undefined')
9708      slider.addClass('dark-nav');*/
9709    slider.flexslider(config).addClass("flexslider-init");
9710    if (config.controlNav) slider.addClass("flexslider-control-nav");
9711    if (config.directionNav) slider.addClass("flexslider-direction-nav");
9712  });
9713};
9714
9715InitFlexSliderClass = function (class_name) {
9716  //$('.flexslider:not(.thmb):not(.flexslider-init)').each(function(){
9717
9718  var slider = $(class_name);
9719  var options;
9720  var defaults = {
9721    animationLoop: false,
9722    controlNav: false,
9723    directionNav: true,
9724    animation: "slide",
9725  };
9726  var config = $.extend({}, defaults, options, slider.data("plugin-options"));
9727
9728  var slide_counts = "";
9729  if (typeof slider.data("plugin-options") != "undefined") {
9730    if ("slide_counts" in slider.data("plugin-options"))
9731      slide_counts = slider.data("plugin-options").slide_counts;
9732  }
9733
9734  if (typeof config.counts != "undefined" && config.direction !== "vertical") {
9735    config.maxItems = getGridSize(config.counts);
9736    config.minItems = getGridSize(config.counts);
9737    config.move = getGridSize(config.counts);
9738
9739    config.itemWidth = 200;
9740  }
9741  if (slide_counts) config.move = slide_counts;
9742
9743  // custom direction nav
9744  if (typeof config.customDirection != "undefined")
9745    config.customDirectionNav = $(config.customDirection);
9746
9747  (config.prevText = BX.message("FANCY_PREV")), //String: Set the text for the "previous" directionNav item
9748    (config.nextText = BX.message("FANCY_NEXT")),
9749    (config.after = config.start =
9750      function (slider) {
9751        var eventdata = { slider: slider };
9752        BX.onCustomEvent("onSlide", [eventdata]);
9753      });
9754
9755  config.before = function (slider) {
9756    var eventdata = { slider: slider };
9757    BX.onCustomEvent("onSlideBefore", [eventdata]);
9758  };
9759
9760  config.end = function (slider) {
9761    var eventdata = { slider: slider };
9762    BX.onCustomEvent("onSlideEnd", [eventdata]);
9763  };
9764
9765  slider.flexslider(config).addClass("flexslider-init");
9766  if (config.controlNav) slider.addClass("flexslider-control-nav");
9767  if (config.directionNav) slider.addClass("flexslider-direction-nav");
9768  //});
9769};
9770
9771InitFlexSliderMin = function () {
9772  $(".bxSlider.top-small").on("mousedown", ".slides li", function () {
9773    var index = $(this).data("slide_key");
9774    $(this).siblings().removeClass("flex-active-slide");
9775    $(this).addClass("flex-active-slide");
9776    $(this)
9777      .siblings('[data-slide_key="' + index + '"]')
9778      .addClass("flex-active-slide");
9779    $(".top-bigs").data("flexslider").flexAnimate(index);
9780  });
9781};
9782
9783SliceHeightBlocks = function () {
9784  $('*[data-slice="Y"]').each(function () {
9785    var slice_els = $(this).find('*[data-slice-block="Y"]');
9786    if (slice_els.length) {
9787      var slice_params = {};
9788      if (slice_els.data("slice-params"))
9789        slice_params = slice_els.data("slice-params");
9790      slice_els.sliceHeight(slice_params);
9791    }
9792  });
9793};
9794
9795createTableCompare = function (originalTable, appendDiv, cloneTable) {
9796  try {
9797    if ($(".tarifs .head-block:visible").length) {
9798      var clone = originalTable.clone().addClass("clone");
9799      if (cloneTable.length) {
9800        cloneTable.remove();
9801        appendDiv.html("");
9802        appendDiv.html(clone);
9803      } else {
9804        appendDiv.append(clone);
9805      }
9806    }
9807  } catch (e) {
9808  } finally {
9809  }
9810};
9811
9812InitTopestMenuGummi = function () {
9813  if (!isOnceInited) {
9814    function _init() {
9815      var arItems = $menuTopest.find(">li:not(.more)");
9816      var cntItems = arItems.length;
9817      if (cntItems) {
9818        var itemsWidth = 0;
9819        for (var i = 0; i < cntItems; ++i) {
9820          var item = arItems.eq(i);
9821          var itemWidth = item.actual("outerWidth", { includeMargin: true });
9822          arItemsHideWidth[i] =
9823            (itemsWidth += itemWidth) + (i !== cntItems - 1 ? moreWidth : 0);
9824        }
9825      }
9826    }
9827
9828    function _gummi() {
9829      var rowWidth = $menuTopest.actual("innerWidth");
9830      var arItems = $menuTopest.find(">li:not(.more),li.more>.dropdown>li");
9831      var cntItems = arItems.length;
9832      if (cntItems) {
9833        var bMore = false;
9834        for (var i = cntItems - 1; i >= 0; --i) {
9835          var item = arItems.eq(i);
9836          var bInMore = item.parents(".more").length > 0;
9837          if (!bInMore) {
9838            if (arItemsHideWidth[i] > rowWidth) {
9839              if (!bMore) {
9840                bMore = true;
9841                more.removeClass("hidden");
9842              }
9843              var clone = item.clone();
9844              clone.find(">a").addClass("dark_font");
9845              clone.prependTo(moreDropdown);
9846              item.addClass("cloned");
9847            }
9848          }
9849        }
9850        for (var i = 0; i < cntItems; ++i) {
9851          var item = arItems.eq(i);
9852          var bInMore = item.parents(".more").length > 0;
9853          if (bInMore) {
9854            if (arItemsHideWidth[i] <= rowWidth) {
9855              if (i === cntItems - 1) {
9856                bMore = false;
9857                more.addClass("hidden");
9858              }
9859              var clone = item.clone();
9860              clone.find(">a").removeClass("dark_font");
9861              clone.insertBefore(more);
9862              item.addClass("cloned");
9863            }
9864          }
9865        }
9866        $menuTopest.find("li.cloned").remove();
9867      }
9868    }
9869
9870    var $menuTopest = $(".menu.topest");
9871    if ($menuTopest.length) {
9872      var more = $menuTopest.find(">.more");
9873      var moreDropdown = more.find(">.dropdown");
9874      var moreWidth = more.actual("outerWidth", { includeMargin: true });
9875      var arItemsHideWidth = [];
9876
9877      ignoreResize.push(true);
9878      _init();
9879      _gummi();
9880      ignoreResize.pop();
9881
9882      BX.addCustomEvent("onWindowResize", function (eventdata) {
9883        try {
9884          ignoreResize.push(true);
9885          _gummi();
9886        } catch (e) {
9887        } finally {
9888          ignoreResize.pop();
9889        }
9890      });
9891    }
9892  }
9893};
9894
9895CheckHeaderFixedMenu = function () {
9896  if (
9897    arAllcorp2Options["THEME"]["HEADER_FIXED"] == 2 &&
9898    $("#headerfixed .js-nav").length &&
9899    window.matchMedia("(min-width: 992px)").matches
9900  ) {
9901    $("#headerfixed .js-nav").css("width", "0");
9902    var all_width = 0,
9903      cont_width = $("#headerfixed .maxwidth-theme").actual("width"),
9904      padding_menu =
9905        $("#headerfixed .logo-row.v2 .menu-block").actual("outerWidth") -
9906        $("#headerfixed .logo-row.v2 .menu-block").actual("width");
9907    $("#headerfixed .logo-row.v2 > .inner-table-block").each(function () {
9908      if (!$(this).hasClass("menu-block"))
9909        all_width += $(this).actual("outerWidth");
9910    });
9911    $("#headerfixed .js-nav").width(cont_width - all_width - padding_menu);
9912  }
9913};
9914
9915CheckTopMenuPadding = function () {
9916  if (
9917    $(".logo_and_menu-row .right-icons .wrap_icon").length &&
9918    $(".logo_and_menu-row .menu-row").length
9919  ) {
9920    var menuPosition = $(".menu-row .menu-only").position().left,
9921      maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 32,
9922      leftPadding = 0,
9923      rightPadding = 0;
9924
9925    $(".logo_and_menu-row .menu-row>div")
9926      .each(function (indx) {
9927        if (!$(this).hasClass("menu-only")) {
9928          var elementPosition = $(this).position().left,
9929            elementWidth = $(this).outerWidth();
9930
9931          if (elementPosition > menuPosition) {
9932            rightPadding += elementWidth;
9933          } else {
9934            leftPadding += elementWidth;
9935          }
9936        }
9937      })
9938      .promise()
9939      .done(function () {
9940        $(".logo_and_menu-row .menu-only").css({
9941          "padding-left": leftPadding,
9942          "padding-right": rightPadding + 1,
9943          opacity: 1,
9944        });
9945      });
9946  }
9947};
9948
9949CheckTopMenuOncePadding = function () {
9950  if ($(".menu-row.sliced .right-icons .wrap_icon").length) {
9951    var menuPosition = $(".menu-row .menu-only").position().left,
9952      maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 32,
9953      leftPadding = 0,
9954      rightPadding = 0;
9955
9956    $(".menu-row.sliced .maxwidth-theme>div>div")
9957      .each(function (indx) {
9958        if (!$(this).hasClass("menu-only")) {
9959          var elementPosition = $(this).position().left,
9960            elementWidth = $(this).outerWidth();
9961
9962          if (elementPosition > menuPosition) {
9963            rightPadding += elementWidth;
9964          } else {
9965            leftPadding += elementWidth;
9966          }
9967        }
9968      })
9969      .promise()
9970      .done(function () {
9971        $(".menu-row.sliced .menu-only").css({
9972          "padding-left": leftPadding,
9973          "padding-right": rightPadding + 1,
9974          opacity: 1,
9975        });
9976      });
9977  }
9978};
9979
9980CheckSearchWidth = function () {
9981  if ($(".logo_and_menu-row .search_wrap").length) {
9982    var searchPosition = $(".logo_and_menu-row .search_wrap").position().left,
9983      maxWidth = $(".logo_and_menu-row .maxwidth-theme").width() - 32;
9984    width = 0;
9985
9986    $(".logo_and_menu-row .maxwidth-theme>div")
9987      .each(function () {
9988        if (!$(this).hasClass("search_wrap")) {
9989          var elementWidth = $(this).outerWidth();
9990
9991          width = width ? width - elementWidth : maxWidth - elementWidth;
9992        }
9993      })
9994      .promise()
9995      .done(function () {
9996        $(".logo_and_menu-row .search_wrap")
9997          .outerWidth(width)
9998          .css({ opacity: 1, visibility: "visible" });
9999      });
10000  }
10001};
10002
10003waitCounter = function (idCounter, delay, callback) {
10004  var obCounter = window["yaCounter" + idCounter];
10005  if (typeof obCounter == "object") {
10006    if (typeof callback == "function") callback();
10007  } else {
10008    setTimeout(function () {
10009      waitCounter(idCounter, delay, callback);
10010    }, delay);
10011  }
10012};
10013
10014var waitReCaptcha = function (delay, callback) {
10015  if (typeof grecaptcha == "object") {
10016    if (typeof callback == "function") {
10017      callback();
10018    }
10019  } else {
10020    setTimeout(function () {
10021      waitReCaptcha(delay, callback);
10022    }, delay);
10023  }
10024};
10025
10026var reCaptchaRender = function (response) {
10027  if ($(".g-recaptcha:not(.rendered)").length) {
10028    waitReCaptcha(50, function () {
10029      $(".g-recaptcha:not(.rendered)").each(function () {
10030        $this = $(this);
10031        $this.addClass("rendered");
10032        var id = grecaptcha.render($this[0], {
10033          sitekey: $this.attr("data-sitekey"),
10034          theme: $this.attr("data-theme"),
10035          size: $this.attr("data-size"),
10036          callback: $this.attr("data-callback"),
10037        });
10038        $this.attr("data-widgetid", id);
10039      });
10040    });
10041  }
10042};
10043
10044var reCaptchaVerify = function (response) {
10045  $(".g-recaptcha.rendered").each(function () {
10046    var id = $(this).attr("data-widgetid");
10047    if (typeof id !== "undefined") {
10048      if (grecaptcha.getResponse(id) != "") {
10049        $(this).closest("form").find(".recaptcha").valid();
10050      }
10051    }
10052  });
10053};
10054
10055var reCaptchaVerifyHidden = function (response) {
10056  $(".g-recaptcha.rendered:last").each(function () {
10057    var id = $(this).attr("data-widgetid");
10058    if (typeof id !== "undefined" && response) {
10059      if (!$(this).closest("form").find(".g-recaptcha-response").val())
10060        $(this).closest("form").find(".g-recaptcha-response").val(response);
10061      $(this).closest("form").submit();
10062    }
10063  });
10064};
10065
10066waitYTPlayer = function (delay, callback) {
10067  if (typeof YT !== "undefined" && YT && YT.Player) {
10068    if (typeof callback == "function") callback();
10069  } else {
10070    setTimeout(function () {
10071      waitYTPlayer(delay, callback);
10072    }, delay);
10073  }
10074};
10075
10076var scrollToTopAnimateClassIn = false;
10077var scrollToTopAnimateClassOut = false;
10078
10079var $body = {};
10080var $scrolltotop = {};
10081var isOnceInited = false;
10082
10083if (navigator.userAgent.indexOf("Edge") != -1)
10084  document.documentElement.className += " edge";
10085
10086initFull = function () {
10087  checkMobileRegion();
10088};
10089
10090var isFrameDataReceived = false;
10091if (typeof window.frameCacheVars !== "undefined") {
10092  BX.addCustomEvent("onFrameDataReceived", function (json) {
10093    initFull();
10094
10095    isFrameDataReceived = true;
10096  });
10097} else {
10098  $(document).ready(initFull);
10099}
10100
10101checkMobileRegion = function () {
10102  if ($(".confirm_region").length) {
10103    if (!$(".top_mobile_region").length)
10104      $(
10105        '<div class="top_mobile_region"><div class="confirm_region"></div><div class="close_popup"></div></div>'
10106      ).insertBefore($("#mobileheader"));
10107    $(".top_mobile_region .confirm_region").html($(".confirm_region").html());
10108
10109    $(".top_mobile_region .close_popup").click(function () {
10110      $(".js-confirm-region-close").trigger("click");
10111      $(this).remove();
10112    });
10113  }
10114};
10115
10116$(document).ready(function () {
10117  scrollToTop();
10118  // CheckStickyFooter();
10119  InitScrollBar();
10120
10121  if (!jQuery.browser.safari) {
10122    CheckTopMenuPadding();
10123    CheckTopMenuOncePadding();
10124    CheckHeaderFixed();
10125    CheckTopMenuDotted();
10126    MegaMenuFixed();
10127    CheckSearchWidth();
10128    InitTopestMenuGummi();
10129    isOnceInited = true;
10130
10131    setTimeout(function () {
10132      $(window).resize(); // need to check resize flexslider & menu
10133    }, 350);
10134
10135    setTimeout(function () {
10136      $(window).scroll();
10137    }, 250); // need to check position fixed ask block
10138  } else {
10139    setTimeout(function () {
10140      $(window).resize(); // need to check resize flexslider & menu
10141      setTimeout(function () {
10142        CheckTopMenuPadding();
10143        CheckTopMenuOncePadding();
10144        CheckHeaderFixed();
10145        CheckTopMenuDotted();
10146        MegaMenuFixed();
10147        CheckSearchWidth();
10148        InitTopestMenuGummi();
10149        isOnceInited = true;
10150        setTimeout(function () {
10151          $(window).scroll();
10152        }, 50);
10153      }, 50);
10154    }, 350);
10155  }
10156
10157  if (arAllcorp2Options["THEME"]["USE_DEBUG_GOALS"] === "Y") {
10158    $.cookie("_ym_debug", "1");
10159  } else {
10160    $.cookie("_ym_debug", null);
10161  }
10162
10163  /*  --- Bind mobile menu  --- */
10164  var $mobileMenu = $("#mobilemenu");
10165  if ($mobileMenu.length) {
10166    $mobileMenu.isLeftSide = $mobileMenu.hasClass("leftside");
10167    $mobileMenu.isOpen = $mobileMenu.hasClass("show");
10168    $mobileMenu.isDowndrop = $mobileMenu
10169      .find(">.scroller")
10170      .hasClass("downdrop");
10171    $mobileMenuNlo = $mobileMenu.find("[data-nlo]");
10172
10173    $("#mobileheader .burger").click(function () {
10174      SwipeMobileMenu();
10175      CloseMobilePhone();
10176    });
10177
10178    if ($mobileMenu.isLeftSide) {
10179      $mobileMenu.parent().append('<div id="mobilemenu-overlay"></div>');
10180      var $mobileMenuOverlay = $("#mobilemenu-overlay");
10181
10182      $mobileMenuOverlay.click(function () {
10183        if ($mobileMenu.isOpen) {
10184          CloseMobileMenu();
10185          $mobileMenu.find('.expanded').removeClass("expanded");
10186        }
10187      });
10188
10189      $(document).on('swiperight', function (e) {
10190        if (
10191          !$(e.target).closest(".flexslider").length &&
10192          !$(e.target).closest(".swipeignore").length
10193        ) {
10194          OpenMobileMenu();
10195        }
10196      });
10197
10198      $(document).on('swipeleft', function (e) {
10199        if (
10200          !$(e.target).closest(".flexslider").length &&
10201          !$(e.target).closest(".swipeignore").length
10202        ) {
10203          CloseMobileMenu();
10204        }
10205      });
10206    } else {
10207      $("#mobileheader").click(function (e) {
10208        if (
10209          !$(e.target).closest("#mobilemenu").length &&
10210          !$(e.target).closest(".burger").length &&
10211          $mobileMenu.isOpen
10212        ) {
10213          CloseMobileMenu();
10214        }
10215      });
10216    }
10217
10218    $(document).on(
10219      "click",
10220      "#mobilemenu .menu a,#mobilemenu .social-icons a",
10221      function (e) {
10222        var $this = $(this);
10223        if ($this.hasClass("parent")) {
10224          e.preventDefault();
10225
10226          if (!$mobileMenu.isDowndrop) {
10227            $this.closest("li").addClass("expanded");
10228            MoveMobileMenuWrapNext();
10229          } else {
10230            if (!$this.closest("li").hasClass("expanded")) {
10231              $this.closest("li").addClass("expanded");
10232            } else {
10233              $this.closest("li").removeClass("expanded");
10234            }
10235          }
10236        } else {
10237          if ($this.closest("li").hasClass("counters")) {
10238            var href = $this.attr("href");
10239            if (typeof href !== "undefined") {
10240              window.location.href = href;
10241              window.location.reload();
10242            }
10243          }
10244
10245          if (!$this.closest(".menu_back").length) {
10246            CloseMobileMenu();
10247          }
10248        }
10249      }
10250    );
10251
10252    $(document).on("click", "#mobilemenu .dropdown .menu_back", function (e) {
10253      e.preventDefault();
10254      var $this = $(this);
10255      MoveMobileMenuWrapPrev();
10256      setTimeout(function () {
10257        $this.closest(".expanded").removeClass("expanded");
10258      }, 400);
10259    });
10260
10261    OpenMobileMenu = function () {
10262      if (!$mobileMenu.isOpen) {
10263        // hide styleswitcher
10264        if ($(".style-switcher").hasClass("active")) {
10265          $(".style-switcher .switch").trigger("click");
10266        }
10267        $(".style-switcher .switch").hide();
10268        $(".style-switcher .switch_presets").hide();
10269
10270        if ($mobileMenu.isLeftSide) {
10271          // show overlay
10272          setTimeout(function () {
10273            $mobileMenuOverlay.fadeIn("fast");
10274          }, 100);
10275        } else {
10276          // scroll body to top & set fixed
10277          $("body").scrollTop(0).css({ position: "fixed" });
10278
10279          // set menu top = bottom of header
10280          $mobileMenu.css({
10281            top:
10282              +($("#mobileheader").height() + $("#mobileheader").offset().top) +
10283              "px",
10284          });
10285
10286          // change burger icon
10287          $("#mobileheader .burger").addClass("c");
10288        }
10289
10290        // show menu
10291        $mobileMenu.addClass("show");
10292        $mobileMenu.isOpen = true;
10293
10294        if (!$mobileMenu.isDowndrop) {
10295          var $wrap = $mobileMenu.find(".wrap").first();
10296          var params = $wrap.data("params");
10297          if (typeof params === "undefined") {
10298            params = {
10299              depth: 0,
10300              scroll: {},
10301              height: {},
10302            };
10303          }
10304          $wrap.data("params", params);
10305        }
10306
10307        if ($mobileMenuNlo.length) {
10308          if (!$mobileMenuNlo.hasClass("nlo-loadings")) {
10309            $mobileMenuNlo.addClass("nlo-loadings");
10310            setTimeout(function () {
10311              $.ajax({
10312                data: { nlo: $mobileMenuNlo.attr("data-nlo") },
10313                complete: function (jqXHR, textStatus) {
10314                  if (textStatus === "success" || jqXHR.status == 404) {
10315                    var ob = BX.processHTML($.trim(jqXHR.responseText));
10316                    BX.ajax.processScripts(ob.SCRIPT);
10317                    $mobileMenuNlo.replaceWith(ob.HTML);
10318                  }
10319                },
10320                error: function () {
10321                  $mobileMenuNlo.removeClass("nlo-loadings");
10322                },
10323              });
10324            }, 300);
10325          }
10326        }
10327      }
10328    };
10329
10330    CloseMobileMenu = function () {
10331      if ($mobileMenu.isOpen) {
10332        // hide menu
10333        $mobileMenu.removeClass("show");
10334        $mobileMenu.isOpen = false;
10335
10336        // show styleswitcher
10337        $(".style-switcher .switch").show();
10338        $(".style-switcher .switch_presets").show();
10339
10340        if ($mobileMenu.isLeftSide) {
10341          // hide overlay
10342          setTimeout(function () {
10343            $mobileMenuOverlay.fadeOut("fast");
10344          }, 100);
10345        } else {
10346          // change burger icon
10347          $("#mobileheader .burger").removeClass("c");
10348
10349          // body unset fixed
10350          $("body").css({ position: "" });
10351        }
10352
10353        if (!$mobileMenu.isDowndrop) {
10354          setTimeout(function () {
10355            var $scroller = $mobileMenu.find(".scroller").first();
10356            var $wrap = $mobileMenu.find(".wrap").first();
10357            var params = $wrap.data("params");
10358            params.depth = 0;
10359            $wrap.data("params", params).attr("style", "");
10360            $mobileMenu.scrollTop(0);
10361            $scroller.css("height", "");
10362          }, 400);
10363        }
10364      }
10365    };
10366
10367    SwipeMobileMenu = function () {
10368      if ($mobileMenu.isOpen) {
10369        CloseMobileMenu();
10370      } else {
10371        OpenMobileMenu();
10372      }
10373    };
10374
10375    function MoveMobileMenuWrapNext() {
10376      if (!$mobileMenu.isDowndrop) {
10377        var $scroller = $mobileMenu.find(".scroller").first();
10378        var $wrap = $mobileMenu.find(".wrap").first();
10379        if ($wrap.length) {
10380          var params = $wrap.data("params");
10381          var $dropdownNext = $mobileMenu
10382            .find(".expanded>.dropdown")
10383            .eq(params.depth);
10384          if ($dropdownNext.length) {
10385            // save scroll position
10386            params.scroll[params.depth] = parseInt($mobileMenu.scrollTop());
10387
10388            // height while move animating
10389            params.height[params.depth + 1] = Math.max(
10390              $dropdownNext.height(),
10391              !params.depth
10392                ? $wrap.height()
10393                : $mobileMenu
10394                  .find(".expanded>.dropdown")
10395                  .eq(params.depth - 1)
10396                  .height()
10397            );
10398            $scroller.css("height", params.height[params.depth + 1] + "px");
10399
10400            // inc depth
10401            ++params.depth;
10402
10403            // translateX for move
10404            $wrap.css("transform", "translateX(" + -100 * params.depth + "%)");
10405
10406            // scroll to top
10407            setTimeout(function () {
10408              $mobileMenu.animate({ scrollTop: 0 }, 200);
10409            }, 100);
10410
10411            // height on enimating end
10412            var h = $dropdownNext.height();
10413            setTimeout(function () {
10414              if (h) {
10415                $scroller.css("height", h + "px");
10416              } else {
10417                $scroller.css("height", "");
10418              }
10419            }, 200);
10420          }
10421
10422          $wrap.data("params", params);
10423        }
10424      }
10425    }
10426
10427    function MoveMobileMenuWrapPrev() {
10428      if (!$mobileMenu.isDowndrop) {
10429        var $scroller = $mobileMenu.find(".scroller").first();
10430        var $wrap = $mobileMenu.find(".wrap").first();
10431        if ($wrap.length) {
10432          var params = $wrap.data("params");
10433          if (params.depth > 0) {
10434            var $dropdown = $mobileMenu
10435              .find(".expanded>.dropdown")
10436              .eq(params.depth - 1);
10437            if ($dropdown.length) {
10438              // height while move animating
10439              $scroller.css("height", params.height[params.depth] + "px");
10440
10441              // dec depth
10442              --params.depth;
10443
10444              // translateX for move
10445              $wrap.css(
10446                "transform",
10447                "translateX(" + -100 * params.depth + "%)"
10448              );
10449
10450              // restore scroll position
10451              setTimeout(function () {
10452                $mobileMenu.animate(
10453                  { scrollTop: params.scroll[params.depth] },
10454                  200
10455                );
10456              }, 100);
10457
10458              // height on enimating end
10459              var h = !params.depth
10460                ? false
10461                : $mobileMenu
10462                  .find(".expanded>.dropdown")
10463                  .eq(params.depth - 1)
10464                  .height();
10465              setTimeout(function () {
10466                if (h) {
10467                  $scroller.css("height", h + "px");
10468                } else {
10469                  $scroller.css("height", "");
10470                }
10471              }, 200);
10472            }
10473          }
10474
10475          $wrap.data("params", params);
10476        }
10477      }
10478    }
10479  }
10480  /*  --- END Bind mobile menu  --- */
10481
10482  /*  --- Bind mobile phone  --- */
10483  var $mobileHeader = $("#mobileheader, #mobileheadersimple");
10484  var $mobilePhone = $("#mobilePhone");
10485  $mobilePhone.isOpen = false;
10486
10487  if ($mobilePhone.length) {
10488    $mobilePhone.isOpen = $mobilePhone.hasClass("show");
10489
10490    $(document).on("click", ".wrap_phones > .svg", function (e) {
10491      SwipeMobilePhone();
10492      e.stopPropagation();
10493    });
10494
10495    $(document).on("click", ".wrap_phones .more_phone.title svg", function (e) {
10496      CloseMobilePhone();
10497      e.stopPropagation();
10498    });
10499    $(document).on("click", ".wrap_phones .more_phone.title svg", function (e) {
10500      CloseMobilePhone();
10501      e.stopPropagation();
10502    });
10503  }
10504
10505  SwipeMobilePhone = function () {
10506    if ($mobilePhone.isOpen) {
10507      CloseMobilePhone();
10508    } else {
10509      OpenMobilePhone();
10510    }
10511  };
10512
10513  OpenMobilePhone = function () {
10514    if (!$mobilePhone.isOpen) {
10515      CloseMobileMenu();
10516
10517      // show overlay
10518      $(
10519        '<div class="jqmOverlay mobp" style="top:' +
10520        ($mobileHeader.position().top + $mobileHeader.height()) +
10521        'px;"></div>'
10522      ).appendTo("body");
10523      // toggle phones
10524      setTimeout(function () {
10525        $mobilePhone.slideDown("fast", function () {
10526          $mobilePhone.addClass("show");
10527          $mobilePhone.isOpen = true;
10528        });
10529      }, 100);
10530    }
10531  };
10532
10533  CloseMobilePhone = function () {
10534    if ($mobilePhone.isOpen) {
10535      // toggle phones
10536      setTimeout(function () {
10537        $mobilePhone.slideUp("fast", function () {
10538          $mobilePhone.removeClass("show");
10539          $mobilePhone.isOpen = false;
10540
10541          // hide overlay
10542          $(".jqmOverlay.mobp").remove();
10543        });
10544      }, 100);
10545    }
10546  };
10547
10548  checkMobilePhone = function () {
10549    if (!window.matchMedia("(max-width: 991px)").matches) {
10550      CloseMobilePhone();
10551    }
10552  };
10553  /*  --- END Bind mobile phone  --- */
10554
10555  /* change type2 menu for fixed */
10556  if ($("#headerfixed .js-nav").length) {
10557    if (arAllcorp2Options["THEME"]["HEADER_FIXED"] == 2) CheckHeaderFixedMenu();
10558
10559    setTimeout(function () {
10560      $("#headerfixed .js-nav").addClass("opacity1");
10561    }, 350);
10562  }
10563
10564  /* close search block */
10565  $("html, body").on("mousedown", function (e) {
10566    if (
10567      typeof e.target.className == "string" &&
10568      e.target.className.indexOf("adm") < 0
10569    ) {
10570      e.stopPropagation();
10571      var search_target = $(e.target).closest(".bx_searche");
10572      if (
10573        !$(e.target).hasClass("inline-search-block") &&
10574        !$(e.target).hasClass("svg") &&
10575        !search_target.length
10576      ) {
10577        $(".inline-search-block").removeClass("show");
10578        $(".title-search-result").hide();
10579        if (arAllcorp2Options["THEME"]["TYPE_SEARCH"] == "fixed")
10580          $(".jqmOverlay.search").detach();
10581      }
10582
10583      if (isMobile) {
10584        if (search_target.length) location.href = search_target.attr("href");
10585      }
10586      var class_name = $(e.target).attr("class");
10587      if (typeof class_name == "undefined" || class_name.indexOf("tooltip") < 0)
10588        //tooltip link
10589        $(".tooltip-link").tooltip("hide");
10590    }
10591  });
10592  $(".inline-search-block")
10593    .find("*")
10594    .on("mousedown", function (e) {
10595      e.stopPropagation();
10596    });
10597
10598  $(".filter-action").on("click", function () {
10599    $(this).toggleClass("active");
10600    $(this).find(".svg").toggleClass("white");
10601    if ($(".introtext").length) {
10602      var top_pos = $(".filters-wrap").position();
10603      $(".bx_filter").css({ top: top_pos.top + 40 });
10604    }
10605    $(".bx_filter").slideToggle();
10606  });
10607
10608  waitingNotExists(
10609    "#bx-composite-banner .bx-composite-btn",
10610    "#footer .col-sm-3.hidden-md.hidden-lg #bx-composite-banner .bx-composite-btn",
10611    500,
10612    function () {
10613      $("#footer .col-sm-3.hidden-md.hidden-lg #bx-composite-banner").html(
10614        $("#bx-composite-banner .bx-composite-btn").parent().html()
10615      );
10616    }
10617  );
10618
10619  $.extend($.validator.messages, {
10620    required: BX.message("JS_REQUIRED"),
10621    email: BX.message("JS_FORMAT"),
10622    equalTo: BX.message("JS_PASSWORD_COPY"),
10623    minlength: BX.message("JS_PASSWORD_LENGTH"),
10624    remote: BX.message("JS_ERROR"),
10625  });
10626
10627  $.validator.addMethod(
10628    "regexp",
10629    function (value, element, regexp) {
10630      var re = new RegExp(regexp);
10631      return this.optional(element) || re.test(value);
10632    },
10633    BX.message("JS_FORMAT")
10634  );
10635
10636  $.validator.addMethod(
10637    "filesize",
10638    function (value, element, param) {
10639      return this.optional(element) || element.files[0].size <= param;
10640    },
10641    BX.message("JS_FILE_SIZE")
10642  );
10643
10644  $.validator.addMethod(
10645    "date",
10646    function (value, element, param) {
10647      var status = false;
10648      if (!value || value.length <= 0) {
10649        status = true;
10650      } else {
10651        var re = new RegExp("^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})$");
10652        var matches = re.exec(value);
10653        if (matches) {
10654          var composedDate = new Date(matches[5], matches[3] - 1, matches[1]);
10655          status =
10656            composedDate.getMonth() == matches[3] - 1 &&
10657            composedDate.getDate() == matches[1] &&
10658            composedDate.getFullYear() == matches[5];
10659        }
10660      }
10661      return status;
10662    },
10663    BX.message("JS_DATE")
10664  );
10665
10666  $.validator.addMethod(
10667    "datetime",
10668    function (value, element, param) {
10669      var status = false;
10670      if (!value || value.length <= 0) {
10671        status = true;
10672      } else {
10673        var re = new RegExp(
10674          "^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4}) ([0-9]{1,2}):([0-9]{1,2})$"
10675        );
10676        var matches = re.exec(value);
10677        if (matches) {
10678          var composedDate = new Date(
10679            matches[5],
10680            matches[3] - 1,
10681            matches[1],
10682            matches[6],
10683            matches[7]
10684          );
10685          status =
10686            composedDate.getMonth() == matches[3] - 1 &&
10687            composedDate.getDate() == matches[1] &&
10688            composedDate.getFullYear() == matches[5] &&
10689            composedDate.getHours() == matches[6] &&
10690            composedDate.getMinutes() == matches[7];
10691        }
10692      }
10693      return status;
10694    },
10695    BX.message("JS_DATETIME")
10696  );
10697
10698  $.validator.addMethod(
10699    "extension",
10700    function (value, element, param) {
10701      param =
10702        typeof param === "string" ? param.replace(/,/g, "|") : "png|jpe?g|gif";
10703      return (
10704        this.optional(element) ||
10705        value.match(new RegExp(".(" + param + ")$", "i"))
10706      );
10707    },
10708    BX.message("JS_FILE_EXT")
10709  );
10710
10711  $.validator.addMethod(
10712    "captcha",
10713    function (value, element, params) {
10714      return $.validator.methods.remote.call(this, value, element, {
10715        url: arAllcorp2Options["SITE_DIR"] + "ajax/check-captcha.php",
10716        type: "post",
10717        data: {
10718          captcha_word: value,
10719          captcha_sid: function () {
10720            return $(element)
10721              .closest("form")
10722              .find('input[name="captcha_sid"]')
10723              .val();
10724          },
10725        },
10726      });
10727    },
10728    BX.message("JS_ERROR")
10729  );
10730
10731  $.validator.addMethod(
10732    "recaptcha",
10733    function (value, element, param) {
10734      var id = $(element)
10735        .closest("form")
10736        .find(".g-recaptcha")
10737        .attr("data-widgetid");
10738      if (typeof id !== "undefined") {
10739        return grecaptcha.getResponse(id) != "";
10740      } else {
10741        return true;
10742      }
10743    },
10744    BX.message("JS_RECAPTCHA_ERROR")
10745  );
10746
10747  /*reload captcha*/
10748  $("body").on("click", ".refresh", function (e) {
10749    e.preventDefault();
10750    $.ajax({
10751      url: arAllcorp2Options["SITE_DIR"] + "ajax/captcha.php",
10752    }).done(function (text) {
10753      if ($(".captcha_sid").length) {
10754        $(".captcha_sid").val(text);
10755        $(".captcha_img").attr(
10756          "src",
10757          "/bitrix/tools/captcha.php?captcha_sid=" + text
10758        );
10759      }
10760    });
10761  });
10762
10763  $.validator.addClassRules({
10764    phone: {
10765      regexp: arAllcorp2Options["THEME"]["VALIDATE_PHONE_MASK"],
10766    },
10767    confirm_password: {
10768      equalTo: "input.password",
10769      minlength: 6,
10770    },
10771    password: {
10772      minlength: 6,
10773    },
10774    inputfile: {
10775      extension: arAllcorp2Options["THEME"]["VALIDATE_FILE_EXT"],
10776      filesize: 5000000,
10777    },
10778    datetime: {
10779      datetime: "",
10780    },
10781    captcha: {
10782      captcha: "",
10783    },
10784    recaptcha: {
10785      recaptcha: "",
10786    },
10787  });
10788
10789  $.validator.setDefaults({
10790    highlight: function (element) {
10791      $(element).parent().addClass("error");
10792    },
10793    unhighlight: function (element) {
10794      $(element).parent().removeClass("error");
10795    },
10796  });
10797
10798  $(".video_link").fancybox({
10799    type: "iframe",
10800    maxWidth: 800,
10801    maxHeight: 600,
10802    fitToView: false,
10803    width: "70%",
10804    height: "70%",
10805    autoSize: false,
10806    closeClick: false,
10807  });
10808
10809  /*city*/
10810  $("select.region").on("change", function () {
10811    var val = parseInt($(this).val());
10812    if ($("select.city").length) {
10813      if (val) {
10814        $("select.city option").hide();
10815        $("select.city option").prop("disabled", "disabled");
10816        $("select.city option[data-parent_section=" + val + "]").prop(
10817          "disabled",
10818          ""
10819        );
10820        $("select.city option:eq(0)").prop("disabled", "");
10821        // $('select.city').ikSelect('reset');
10822        $("select.city option[data-parent_section=" + val + "]").show();
10823      } else $("select.city option").prop("disabled", "disabled");
10824      $("select.city option:eq(0)").prop("disabled", "");
10825      // $('select.city').ikSelect('reset');
10826    }
10827  });
10828
10829  $("select.city, select.region").on("change", function () {
10830    var _this = $(this),
10831      val = parseInt(_this.val());
10832    if (_this.hasClass("region")) {
10833      $("select.city option:eq(0)").show();
10834      $("select.city").val(0);
10835    }
10836
10837    if ((_this.hasClass("region") && !val) || _this.hasClass("city")) {
10838      $.ajax({
10839        type: "POST",
10840        data: { ID: val },
10841        success: function (html) {
10842          var ob = BX.processHTML(html);
10843          $(".ajax_items")[0].innerHTML = ob.HTML;
10844          BX.ajax.processScripts(ob.SCRIPT);
10845        }
10846      });
10847    }
10848  });
10849
10850  $(".mobile_regions .city_item").on("click", function (e) {
10851    e.preventDefault();
10852    var _this = $(this);
10853    $.removeCookie("current_region");
10854
10855    if (arAllcorp2Options["SITE_ADDRESS"].indexOf(",") != "-1") {
10856      var arDomains = arAllcorp2Options["SITE_ADDRESS"].split(",");
10857      if (arDomains) {
10858        for (var i in arDomains) {
10859          var domain_name = arDomains[i].replace("\n", "");
10860          domain_name = arDomains[i].replace("'", "");
10861          $.cookie("current_region", _this.data("id"), {
10862            path: "/",
10863            domain: domain_name,
10864          });
10865        }
10866      }
10867    }
10867 else $.cookie("current_region", _this.data("id"), { path: "/", domain: arAllcorp2Options["SITE_ADDRESS"] });
10868
10869    location.href = _this.attr("href");
10870  });
10871
10872  InitFlexSlider();
10873  InitFlexSliderMin();
10874
10875  // for check flexslider bug in composite mode
10876  waitingNotExists(
10877    ".detail .galery #slider",
10878    ".detail .galery #slider .flex-viewport",
10879    1000,
10880    function () {
10881      InitFlexSlider();
10882      setTimeout(function () {
10883        $(window).resize();
10884      }, 350);
10885    }
10886  );
10887
10888  /* change view type catalog */
10889  $(".view-button").on("click", function () {
10890    $(this).siblings().removeClass("cur");
10891    $(this).addClass("cur");
10892  });
10893
10894  // -- escape close popup form
10895  $(document).on("keydown", function (e) {
10896    if (e.keyCode == 27) {
10897      if ($(".jqmWindow.show").length) $(".jqmWindow.show .jqmClose").click();
10898      $(".title-search-result").hide();
10899      if ($(".inline-search-block.fixed.show").length)
10900        $(".inline-search-block.fixed .inline-search-hide").click();
10901    }
10902  });
10903
10904  /*check mobile device*/
10905  if (isMobile) {
10906    $(".hint span").remove();
10907
10908    $(document).on("click", '*[data-event="jqm"]', function (e) {
10909      e.preventDefault();
10910      var _this = $(this);
10911      var name = _this.data("name");
10912
10913      if (window.matchMedia("(min-width:992px)").matches) {
10914        e.stopPropagation();
10915        $(this).jqmEx();
10916        $(this).trigger("click");
10917      } else if (name.length) {
10918        var script = arAllcorp2Options["SITE_DIR"] + "form/";
10919        var paramsStr = "";
10920        var arTriggerAttrs = {};
10921        $.each(_this.get(0).attributes, function (index, attr) {
10922          var attrName = attr.nodeName;
10923          var attrValue = _this.attr(attrName);
10924          attrValue = attrValue.replace(/%99/g, "\\"); // replace symbol \
10925          arTriggerAttrs[attrName] = attrValue;
10926          if (/^data\-param\-(.+)$/.test(attrName)) {
10927            var key = attrName.match(/^data\-param\-(.+)$/)[1];
10928            paramsStr += key + "=" + attrValue + "&";
10929          }
10930        });
10931        var triggerAttrs = JSON.stringify(arTriggerAttrs);
10932        var encTriggerAttrs = encodeURIComponent(triggerAttrs);
10933        script +=
10934          "?name=" + name + "&" + paramsStr + "data-trigger=" + encTriggerAttrs;
10935        location.href = script;
10936      }
10937    });
10938
10939    // $('.fancybox').removeClass('fancybox');
10940  } else {
10941    $(document).on("click", '*[data-event="jqm"]', function (e) {
10942      e.preventDefault();
10943      e.stopPropagation();
10944      $(this).jqmEx();
10945      $(this).trigger("click");
10946    });
10947  }
10948
10949  $(".animate-load").on("click", function () {
10950    $(this).parent().addClass("loadings");
10951  });
10952
10953  BX.addCustomEvent("onCompleteAction", function (eventdata, _this) {
10954    try {
10955      if (eventdata.action === "loadForm") {
10956        $(_this).parent().removeClass("loadings");
10957      } else if (eventdata.action === "loadBasket") {
10958        var basket_link = $(".basket-link");
10959        if (basket_link.length) {
10960          basket_link.attr("title", $(_this).find("a").attr("title"));
10961          if ($(_this).find("a .count").length) {
10962            var count = basket_link.find(".count").length
10963              ? parseInt($(_this).find(".count").text())
10964              : parseInt($(_this).find(".count").text());
10965            basket_link
10966              .find(".prices")
10967              .text($(_this).find(".icon").data("summ"));
10968            if (basket_link.find(".count").length) {
10969              basket_link.find(".count").text(count);
10970              if (count) basket_link.addClass("basket-count");
10971              else basket_link.removeClass("basket-count");
10972            } else {
10973              basket_link
10974                .find(".js-basket-block")
10975                .append($(_this).find(".count"));
10976              basket_link.addClass("basket-count");
10977              CheckHeaderFixedMenu();
10978            }
10979
10980            $("#mobilemenu .menu .ready .count").text(count);
10981            if (count) {
10982              $("#mobilemenu .menu .ready .count").removeClass("empted");
10983            } else {
10984              $("#mobilemenu .menu .ready .count").addClass("empted");
10985            }
10986          } else if ($(_this).find(".opener").length) {
10987            var count = parseInt($(_this).find(".opener .count").text());
10988
10989            if (basket_link.find(".count").length) {
10990              basket_link.find(".count").text(count);
10991              if (count) basket_link.addClass("basket-count");
10992              else basket_link.removeClass("basket-count");
10993              basket_link.attr("title", $(_this).find(".opener").attr("title"));
10994            }
10995            $("#mobilemenu .menu .ready .count").text(count);
10996            if (count) {
10997              $("#mobilemenu .menu .ready .count").removeClass("empted");
10998            } else {
10999              $("#mobilemenu .menu .ready .count").addClass("empted");
11000            }
11001          } else {
11002            basket_link.find(".count").remove();
11003            basket_link.removeClass("basket-count");
11004            CheckHeaderFixedMenu();
11005          }
11006        }
11007      } else if (eventdata.action === "loadRSS") {
11008      } else if (eventdata.action === "ajaxContentLoaded") {
11009        if ("type" in eventdata) {
11010          if (eventdata.type == "table_block") {
11011            $(".catalog.item-views.table .item .title").sliceHeight();
11012            $(".catalog.item-views.table .item .cont").sliceHeight();
11013            $(".catalog.item-views.table .item .slice_price").sliceHeight();
11014            $(".catalog.item-views.table .item").sliceHeight();
11015          } else if (eventdata.type == "table_block2") {
11016            $(".catalog.item-views.table .item .title").sliceHeight();
11017            $(".catalog.item-views.table .item .cont").sliceHeight({
11018              autoHeightBlock: ".cont_inner",
11019              classNull: ".props_wrapper",
11020            });
11021            $(".catalog.item-views.table .item .slice_price").sliceHeight();
11022            $(".catalog.item-views.table .item").sliceHeight({
11023              autoHeightBlock: ".cont_inner",
11024              callback: setHoverHeight,
11025            });
11026          }
11027        }
11028      }
11029    } catch (e) {
11030      console.error(e);
11031    }
11032  });
11033
11034  BX.addCustomEvent("onCounterGoals", function (eventdata) {
11035    if (
11036      arAllcorp2Options["THEME"]["YA_GOLAS"] == "Y" &&
11037      arAllcorp2Options["THEME"]["YA_COUNTER_ID"]
11038    ) {
11039      var idCounter = arAllcorp2Options["THEME"]["YA_COUNTER_ID"];
11040      idCounter = parseInt(idCounter);
11041
11042      if (typeof eventdata != "object") eventdata = { goal: "undefined" };
11043
11044      if (typeof eventdata.goal != "string") eventdata.goal = "undefined";
11045
11046      if (idCounter) {
11047        try {
11048          waitCounter(idCounter, 50, function () {
11049            var obCounter = window["yaCounter" + idCounter];
11050            if (typeof obCounter == "object") {
11051              obCounter.reachGoal(eventdata.goal);
11052            }
11053          });
11054        } catch (e) {
11055          console.error(e);
11056        }
11057      } else {
11058        console.info("Bad counter id!", idCounter);
11059      }
11060    }
11061  });
11062
11063  BX.addCustomEvent(window, "onAjaxSuccess", function (e) {
11064    if (e != "OK") {
11065      InitFlexSlider();
11066      InitFlexSliderMin();
11067    }
11068  });
11069
11070  /* show print */
11071  if (arAllcorp2Options["THEME"]["PRINT_BUTTON"] == "Y") {
11072    setTimeout(function () {
11073      if ($(".page-top .rss-block.top").length) {
11074        $(
11075          '<div class="print-link"><i class="svg svg-print"></i></div>'
11076        ).insertBefore($(".page-top .rss-block.top .shares-block"));
11077      } else if ($(".page-top .rss").length) {
11078        $(
11079          '<div class="print-link"><i class="svg svg-print"></i></div>'
11080        ).insertAfter($(".page-top .rss"));
11081      } else if ($(".page-top h1").length)
11082        $(
11083          '<div class="print-link"><i class="svg svg-print"></i></div>'
11084        ).insertBefore($(".page-top h1"));
11085      // else
11086      // $('footer .print-block').html('<div class="print-link"><i class="svg svg-print"><svg id="Print.svg" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path class="cls-1" d="M1553,287h-2v3h-8v-3h-2a2,2,0,0,1-2-2v-5a2,2,0,0,1,2-2h2v-4h8v4h2a2,2,0,0,1,2,2v5A2,2,0,0,1,1553,287Zm-8,1h4v-4h-4v4Zm4-12h-4v2h4v-2Zm4,4h-12v5h2v-3h8v3h2v-5Z" transform="translate(-1539 -274)"/></svg></i></div>');
11087    }, 150);
11088  }
11089
11090  $(document).on("click", ".print-link", function () {
11091    window.print();
11092  });
11093
11094  $(".head-block .item-link").on("click", function () {
11095    var _this = $(this);
11096    _this.siblings().removeClass("active");
11097    _this.addClass("active");
11098  });
11099
11100  $("table.table").each(function () {
11101    var _this = $(this),
11102      first_td = _this.find("thead tr th");
11103    if (!first_td.length) first_td = _this.find("thead tr td");
11104    if (first_td.length) {
11105      _this.find("tbody tr:not(.nomobile)").each(function (i) {
11106        $(this)
11107          .find("td")
11108          .each(function (i) {
11109            if (typeof first_td[i] !== "undefined") {
11110              $(
11111                '<div class="th-mobile">' + first_td[i].textContent + "</div>"
11112              ).appendTo($(this));
11113            }
11114          });
11115      });
11116    }
11117  });
11118
11119  $("a.fancybox").fancybox();
11120
11121  /* flex pagination */
11122  $(document).on("mouseenter", ".flex-viewport .item", function () {
11123    $(this).closest(".flexslider").find(".flex-control-nav").toggleClass("noz");
11124    $(this)
11125      .closest(".flexslider")
11126      .find(".flex-control-nav")
11127      .css("z-index", "0");
11128  });
11129  $(document).on("mouseleave", ".flex-viewport .item", function () {
11130    $(this).closest(".flexslider").find(".flex-control-nav").toggleClass("noz");
11131    $(this)
11132      .closest(".flexslider")
11133      .find(".flex-control-nav")
11134      .css("z-index", "2");
11135  });
11136
11137  /* ajax more items */
11138  $(document).on("click", ".ajax_load_btn", function () {
11139    var url = $(this)
11140      .closest(".bottom_nav")
11141      .find(".module-pagination .next a")
11142      .attr("href"),
11143      th = $(this).find(".more_text_ajax"),
11144      _this = $(this),
11145      container = $(this).closest(".bottom_nav");
11146    if (!th.hasClass("loading")) {
11147      th.addClass("loading");
11148      var objUrl = parseUrlQuery(),
11149        add_url = "",
11150        obData = { AJAX_REQUEST: "Y" };
11151      if ("clear_cache" in objUrl) {
11152        if (objUrl.clear_cache == "Y") add_url = "&clear_cache=Y";
11153      }
11154      if ($(".banners-small.front").length) {
11155        obData.MD = $(".banners-small.front").find(".items").data("c
11155olmd");
11156        obData.SM = $(".banners-small.front").find(".items").data("colsm");
11157      }
11158      $.ajax({
11159        url: url + "" + add_url,
11160        data: BX.ajax.prepareData(obData),
11161        success: function (html) {
11162          var eventdata = { action: "ajaxContentLoaded", content: html };
11163          if ($(".ajax_load").length) {
11164            th.removeClass("loading");
11165            if (_this.closest(".item-views.list").length) {
11166              _this.closest(".item-views").find(".items").append(html);
11167            } else if (_this.closest(".item-views.table").length) {
11168              _this.closest(".item-views").find(".items").append(html);
11169              // touchItemBlock('.catalog_item a');
11170              eventdata.type = "table_block";
11171              if (
11172                arAllcorp2Options["THEME"]["CATALOG_BLOCK_TYPE"] ==
11173                "catalog_table_2"
11174              )
11175                eventdata.type = "table_block2";
11176            } else if ($(".module_products_list").length) {
11177              $(".module_products_list > tbody").append(html);
11178            }
11179            $(".bottom_nav").html($(html).find(".bottom_nav").html());
11180          } else {
11181            if ($(".banners-small.front").length) {
11182              $(".banners-small .items.row").append(html);
11183              $(".bottom_nav").html(
11184                $(".banners-small .items.row .bottom_nav").html()
11185              );
11186              $(".banners-small .items.row .bottom_nav").remove();
11187            } else if (
11188              container.hasClass("index_block") &&
11189              container.data("class")
11190            ) {
11191              //index page
11192              var class_block = th
11193                .closest(".drag-block")
11194                .attr("class")
11195                .replace("drag-block container", ""),
11196                html_content = "";
11197              class_block = class_block.replace(/\s/g, "");
11198
11199              html_content = $(html)
11200                .find("." + class_block)
11201                .find(container.data("class"));
11202              th.closest(".drag-block")
11203                .find(container.data("class"))
11204                .find(container.data("item"))
11205                .append(html_content.find(container.data("item")).html());
11206              th.closest(".nav_wrapper").html(
11207                html_content.find(".nav_wrapper").html()
11208              );
11209            } else {
11210              $(html).insertBefore($(".blog .bottom_nav"));
11211              $(".bottom_nav").html($(".blog .bottom_nav:hidden").html());
11212              $(".blog .bottom_nav:hidden").remove();
11213            }
11214          }
11215
11216          setTimeout(function () {
11217            BX.onCustomEvent("onCompleteAction", [eventdata, th[0]]);
11218            $(".banners-small .item.normal-block").sliceHeight();
11219            th.removeClass("loading");
11220          }, 100);
11221        },
11222      });
11223    }
11224  });
11225
11226  /* bug fix in ff*/
11227  $("img").removeAttr("draggable");
11228
11229  clicked_tab = 0;
11230
11231  $(".title-tab-heading").on("click", function () {
11232    var container = $(this).closest(".tab-pane"),
11233      nav = $(this).closest(".tabs").find(".nav"),
11234      slide_block = $(this).next();
11235
11236    clicked_tab = container.index() + 1;
11237
11238    container.siblings().removeClass("active");
11239    container.siblings().find(".title-tab-heading + div").hide();
11240
11241    $(".catalog.detail .nav.nav-tabs li").removeClass("active");
11242    nav.find("li").removeClass("active");
11243
11244    if (container.hasClass("active")) {
11245      slide_block.slideUp(200, function () {
11246        container.removeClass("active");
11247        nav.find("li:eq(" + container.index() + ")").removeClass("active");
11248      });
11249    } else {
11250      container.addClass("active");
11251      scrollToBlock(container);
11252      nav.find("li:eq(" + container.index() + ")").addClass("active");
11253      slide_block.slideDown();
11254    }
11255  });
11256
11257  // Responsive Menu Events
11258  var addActiveClass = false;
11259  $("#mainMenu li.dropdown > a > i, #mainMenu li.dropdown-submenu > a > i").on(
11260    "click",
11261    function (e) {
11262      e.preventDefault();
11263      if ($(window).width() > 979) return;
11264      addActiveClass = $(this).closest("li").hasClass("resp-active");
11265      // $('#mainMenu').find('.resp-active').removeClass('resp-active');
11266      if (!addActiveClass) {
11267        $(this).closest("li").addClass("resp-active");
11268      } else {
11269        $(this).closest("li").removeClass("resp-active");
11270      }
11271    }
11272  );
11273
11274  /*animate increment*/
11275  
11276  const IO = new IntersectionObserver(entries => {
11277    entries.forEach(entry => {
11278      const counter = entry.target;
11279      if (entry.isIntersecting) {
11280        counterUp.default(counter, {
11281          duration: 1000,
11282          delay: 80,
11283        });
11284        IO.unobserve(counter);
11285      }
11286    });
11287  }, { threshold: 1 });
11288  
11289  
11290  const spincrements = document.querySelectorAll('.spincrement');
11291
11292  spincrements.forEach(counter => {
11293    IO.observe(counter);
11294  });
11295
11296  $(".bx_filter_input_container input[type=text]").numeric({ allow: "." });
11297
11298  $(".toggle .more_items").on("click", function () {
11299    $(this).closest(".toggle").find(".collapsed").fadeToggle();
11300    $(this).remove();
11301    if (typeof $(this).data("resize") !== "undefined" && $(this).data("resize"))
11302      $(window).resize();
11303  });
11304  $(document).on("click", ".toggle_menu .more_items", function () {
11305    $(this).closest(".toggle_menu").find(".collapsed").addClass("clicked_exp");
11306    $(this).remove();
11307  });
11308
11309  /* search sync */
11310  $(document).on("keyup", ".search-input-div input", function (e) {
11311    var inputValue = $(this).val();
11312    $(".search-input-div input").val(inputValue);
11313
11314    if ($(this).closest("#headerfixed").length) {
11315      if (e.keyCode == 13) $(".search form").submit();
11316    }
11317  });
11318  $(document).on("click", ".search-button-div button", function (e) {
11319    if ($(this).closest("#headerfixed").length) $(".search form").submit();
11320  });
11321
11322  $(".inline-search-show, .inline-search-hide").on("click", function (e) {
11323    if (
11324      typeof $(this).data("type_search") != "undefined" &&
11325      $(this).data("type_search") == "fixed"
11326    )
11327      $(".inline-search-block").addClass("fixed");
11328
11329    if (arAllcorp2Options["THEME"]["TYPE_SEARCH"] != "fixed") {
11330      var height_block = 0;
11331
11332      height_block = $(this).closest(".maxwidth-theme").actual("outerHeight");
11333      if ($(this).closest("header.long").length)
11334        height_block = $(this).closest("header.long").actual("outerHeight");
11335      if ($("header > .top-block").length) {
11336        height_block += $("header > .top-block").actual("outerHeight");
11337        height_block -= 6;
11338      }
11339      if ($("#bx-panel").length)
11340        height_block += $("#bx-panel").actual("outerHeight");
11341      $(".inline-search-block").css({
11342        height: height_block,
11343        "line-height": height_block - 4 + "px",
11344        top: -height_block,
11345      });
11346    }
11347
11348    $(".inline-search-block").toggleClass("show");
11349    if ($(".top-block").length) {
11350      if ($(".inline-search-block").hasClass("show"))
11351        $(".inline-search-block").css(
11352          "background",
11353          $(".top-block").css("background-color")
11354
11355        );
11356      else {
11357        $(".inline-search-block").css("background", "#fff");
11358        $("#title-search-input").blur();
11359        $(".jqmOverlay").detach();
11360      }
11361    }
11362    if (arAllcorp2Options["THEME"]["TYPE_SEARCH"] == "fixed") {
11363      if ($(".inline-search-block").hasClass("show"))
11364        $('<div class="jqmOverlay search"></div>').appendTo("body");
11365      else {
11366        $(".jqmOverlay").remove();
11367      }
11368    }
11369  });
11370
11371  if ($(".styled-block .row > div.col-md-3").length) {
11372    BX.addCustomEvent("onWindowResize", function (eventdata) {
11373      try {
11374        ignoreResize.push(true);
11375        $(".styled-block .row > div.col-md-3").each(function () {
11376          $(this).css({ height: "", "line-height": "" });
11377          var z = parseInt($(".body_media").css("top"));
11378          if (z > 0) {
11379            var rowHeight = $(this)
11380              .parents(".row")
11381              .first()
11382              .actual("outerHeight");
11383            $(this).css({
11384              height: rowHeight + "px",
11385              "line-height": rowHeight + "px",
11386            });
11387          }
11388        });
11389      } catch (e) {
11390      } finally {
11391        ignoreResize.pop();
11392      }
11393    });
11394  }
11395
11396  if ($(".order-block").length) {
11397    BX.addCustomEvent("onWindowResize", function (eventdata) {
11398      try {
11399        ignoreResize.push(true);
11400        $(".order-block").each(function () {
11401          var cols = $(this).find(".row > div");
11402          if (cols.length) {
11403            var colFirst = cols.first();
11404            var colLast = cols.last();
11405            var colText = colFirst.find(".text");
11406            var bText = colText.length;
11407            var bOnlyText = cols.length === 1 && bText;
11408            var bPrice = colFirst.find(".price").length;
11409            var z = parseInt($(".body_media").css("top"));
11410
11411            cols.css({ height: "", "padding-top": "", "padding-bottom": "" });
11412            colText.css({
11413              height: "",
11414              "padding-top": "",
11415              "padding-bottom": "",
11416            });
11417            if ((!bPrice && z > 0) || (bPrice && z > 1)) {
11418              var minHeight = 83;
11419
11420              if (!bOnlyText) {
11421                var colLast_height = colLast.outerHeight();
11422                colLast_height =
11423                  colLast_height >= minHeight ? colLast_height : minHeight;
11424              }
11425
11426              if (bText) {
11427                var colFirst_height = colFirst.outerHeight();
11428                colFirst_height =
11429                  colFirst_height >= minHeight ? colFirst_height : minHeight;
11430              }
11431
11432              var colMax_height = bText
11433                ? !bOnlyText
11434                  ? colLast_height >= colFirst_height
11435                    ? colLast_height
11436                    : colFirst_height
11437                  : colLast_height
11438                : colFirst_height;
11439
11440              if (!bOnlyText) {
11441                var textPadding =
11442                  41 + (colMax_height - colFirst.outerHeight()) / 2;
11443                colLast.find(".btns").css({
11444                  "padding-top": textPadding + "px",
11445                  "padding-bottom": textPadding + "px",
11446                  height: colMax_height + "px",
11447                });
11448              }
11449              if (bText) {
11450                colLast.css({ height: colMax_height + "px" });
11451                var textPadding =
11452                  41 + (colMax_height - colText.outerHeight()) / 2;
11453                colText.css({
11454                  "padding-top": textPadding + "px",
11455                  "padding-bottom": textPadding + "px",
11456                  height: colMax_height + "px",
11457                });
11458              }
11459            }
11460          }
11461        });
11462      } catch (e) {
11463      } finally {
11464        ignoreResize.pop();
11465      }
11466    });
11467  }
11468
11469  if ($(".equal-padding").length) {
11470    BX.addCustomEvent("onWindowResize", function (eventdata) {
11471      try {
11472        ignoreResize.push(true);
11473        $(".equal-padding").each(function () {
11474          $(this)
11475            .find(".text")
11476            .css({ "padding-top": "0px", "padding-bottom": "0px" });
11477          var equal_block = $(this).siblings(".equals"),
11478            height = $(this).actual("outerHeight");
11479
11480          delta = Math.round((equal_block.actual("outerHeight") - height) / 2);
11481          if (delta)
11482            $(this)
11483              .find(".text")
11484              .css({
11485                "padding-top": delta + "px",
11486                "padding-bottom": delta + "px",
11487              });
11488        });
11489      } catch (e) {
11490      } finally {
11491        ignoreResize.pop();
11492      }
11493    });
11494  }
11495
11496  $(document).on("click", ".mega-menu .dropdown-menu", function (e) {
11497    e.stopPropagation();
11498  });
11499
11500  $(document).on(
11501    "click",
11502    ".mega-menu .dropdown-toggle.more-items",
11503    function (e) {
11504      e.preventDefault();
11505    }
11506  );
11507
11508  $(
11509    ".table-menu .dropdown,.table-menu .dropdown-submenu,.table-menu .dropdown-toggle"
11510  ).on("mouseenter", function () {
11511    CheckTopVisibleMenu();
11512  });
11513
11514  $(
11515    ".mega-menu .search-item .search-icon, .menu-row #title-search .fa-close"
11516  ).on("click", function (e) {
11517    e.preventDefault();
11518    $(".menu-row #title-search").toggleClass("hide");
11519  });
11520
11521  $(".mega-menu ul.nav .search input").on("keyup", function (e) {
11522    var inputValue = $(this).val();
11523    $(".menu-row > .search input").val(inputValue);
11524    if (e.keyCode == 13) {
11525      $(".menu-row > .search form").submit();
11526    }
11527  });
11528
11529  $(".menu-row > .search input").on("keyup", function (e) {
11530    var inputValue = $(this).val();
11531    $(".mega-menu ul.nav .search input").val(inputValue);
11532    if (e.keyCode == 13) {
11533      $(".menu-row > .search form").submit();
11534    }
11535  });
11536
11537  $(".mega-menu ul.nav .search button").on("click", function (e) {
11538    e.preventDefault();
11539    var inputValue = $(this).parents(".search").find("input").val();
11540    $(".menu-and-search .search input").val(inputValue);
11541    $(".menu-row > .search form").submit();
11542  });
11543
11544  $(".filter .calendar").on("click", function () {
11545    var button = $(this).next();
11546    if (button.hasClass("calendar-icon")) {
11547      button.trigger("click");
11548    }
11549  });
11550
11551  /*sliceheights*/
11552  if ($(".banners-small .item.normal-block").length)
11553    $(".banners-small .item.normal-block").sliceHeight();
11554  if ($(".teasers .item").length) $(".teasers .item").sliceHeight();
11555  if ($(".wrap-portfolio-front .row.items > div").length)
11556    $(".wrap-portfolio-front .row.items > div").sliceHeight({
11557      row: ".row.items",
11558      item: ".item1",
11559    });
11560
11561  SliceHeightBlocks();
11562
11563  /* toggle */
11564  var $this = this,
11565    previewParClosedHeight = 25;
11566
11567  $("section.toggle > label").prepend($("<i />").addClass("fa fa-plus"));
11568  $("section.toggle > label").prepend($("<i />").addClass("fa fa-minus"));
11569  $("section.toggle.active > p").addClass("preview-active");
11570  $("section.toggle.active > div.toggle-content").slideDown(
11571    350,
11572    function () { }
11573  );
11574
11575  $("section.toggle > label").click(function (e) {
11576    var parentSection = $(this).parent(),
11577      parentWrapper = $(this).parents("div.toogle"),
11578      previewPar = false,
11579      isAccordion = parentWrapper.hasClass("toogle-accordion");
11580
11581    if (isAccordion && typeof e.originalEvent != "undefined") {
11582      parentWrapper.find("section.toggle.active > label").trigger("click");
11583    }
11584
11585    parentSection.toggleClass("active");
11586
11587    // Preview Paragraph
11588    if (parentSection.find("> p").get(0)) {
11589      previewPar = parentSection.find("> p");
11590      var previewParCurrentHeight = previewPar.css("height");
11591      previewPar.css("height", "auto");
11592      var previewParAnimateHeight = previewPar.css("height");
11593      previewPar.css("height", previewParCurrentHeight);
11594    }
11595
11596    // Content
11597    var toggleContent = parentSection.find("> div.toggle-content");
11598
11599    if (parentSection.hasClass("active")) {
11600      $(previewPar).animate(
11601        {
11602          height: previewParAnimateHeight,
11603        },
11604        350,
11605        function () {
11606          $(this).addClass("preview-active");
11607        }
11608      );
11609      toggleContent.slideDown(350, function () { });
11610    } else {
11611      $(previewPar).animate(
11612        {
11613          height: previewParClosedHeight,
11614        },
11615        350,
11616        function () {
11617          $(this).removeClass("preview-active");
11618        }
11619      );
11620      toggleContent.slideUp(350, function () { });
11621    }
11622  });
11623
11624  /* accordion */
11625  $(".accordion-head").on("click", function (e) {
11626    e.preventDefault();
11627    if (!$(this).next().hasClass("collapsing")) {
11628      $(this).toggleClass("accordion-open");
11629      $(this).toggleClass("accordion-close");
11630    }
11631  });
11632
11633  /* progress bar */
11634  $("[data-appear-progress-animation]").each(function () {
11635    var $this = $(this);
11636    $this.appear(
11637      function () {
11638        var delay = $this.attr("data-appear-animation-delay")
11639          ? $this.attr("data-appear-animation-delay")
11640          : 1;
11641        if (delay > 1) $this.css("animation-delay", delay + "ms");
11642        $this.addClass($this.attr("data-appear-animation"));
11643
11644        setTimeout(function () {
11645          $this.animate(
11646            {
11647              width: $this.attr("data-appear-progress-animation"),
11648            },
11649            1500,
11650            "easeOutQuad",
11651            function () {
11652              $this.find(".progress-bar-tooltip").animate(
11653                {
11654                  opacity: 1,
11655                },
11656                500,
11657                "easeOutQuad"
11658              );
11659            }
11660          );
11661        }, delay);
11662      },
11663      { accX: 0, accY: -50 }
11664    );
11665  });
11666
11667  /* portfolio item */
11668  $(".item.animated-block").appear(
11669    function () {
11670      var $this = $(this);
11671
11672      $this.addClass($this.data("animation")).addClass("visible");
11673    },
11674    { accX: 0, accY: 150 }
11675  );
11676
11677  $("a[rel=tooltip]").tooltip();
11678  $("span[data-toggle=tooltip]").tooltip();
11679
11680  $(document).on("change", "select.sort", function () {
11681    location.href = $(this).val();
11682  });
11683
11684  setTimeout(function (th) {
11685    $(".catalog.group.list .item").each(function () {
11686      var th = $(this);
11687      if (
11688        (tmp =
11689          th.find(".image").outerHeight() -
11690          th.find(".text_info").outerHeight()) > 0
11691      ) {
11692        th.find(".text_info .titles").height(
11693          th.find(".text_info .titles").outerHeight() + tmp
11694        );
11695      }
11696    });
11697  }, 50);
11698
11699  /* ajax tabs*/
11700
11701  /*tabs on front in mobile*/
11702  $(".items-link-mobile").each(function () {
11703    var _this = $(this),
11704      selectOption = _this.find("option"),
11705      selectOptionLength = selectOption.length,
11706      selectedOption = selectOption.filter(":selected"),
11707      duration = 200; // äëèòåëüíîñòü àíèìàöèè
11708
11709    _this.hide();
11710    _this.wrap('<div class="select"></div>');
11711    $("<div>", {
11712      class: "new-select",
11713      text: _this.children("option:disabled").text(),
11714    }).insertAfter(_this);
11715
11716    var selectHead = _this.next(".new-select");
11717    $("<div>", {
11718      class: "new-select__list",
11719    }).insertAfter(selectHead);
11720
11721    var selectList = selectHead.next(".new-select__list");
11722    for (var i = 1; i < selectOptionLength; i++) {
11723      $("<div>", {
11724        class: "new-select__item",
11725        html: $("<span>", {
11726          text: selectOption.eq(i).text(),
11727        }),
11728      })
11729        .attr("data-value", selectOption.eq(i).val())
11730        .appendTo(selectList);
11731    }
11732
11733    var selectItem = selectList.find(".new-select__item");
11734    var selectItemFirst = selectList.find(".new-select__item:first-child");
11735    selectList.slideUp();
11736    selectHead.on("click", function () {
11737      if (!$(this).hasClass("on")) {
11738        $(this).addClass("on");
11739        selectList.slideDown(duration);
11740
11741        selectItemCur = selectList.find(".new-select__item.active");
11742
11743        if (!selectItem.hasClass("active")) {
11744          selectItemFirst.addClass("active");
11745          selectItemCur = selectItemFirst;
11746        }
11747
11748        selectItem.on("click", function () {
11749          selectItemCur.removeClass("active");
11750          var chooseItem = $(this).data("value");
11751
11752          $("select").val(chooseItem).attr("selected", "selected");
11753          selectHead.text($(this).find("span").text());
11754          selectHead.attr("data-value", $(this).attr("data-value"));
11755          $(this).addClass("active");
11756          var _this = $(this);
11757          selectList.slideUp(150, function () {
11758            selectHead.removeClass("on");
11759
11760            var index = _this.index();
11761            var curHeadBlock = _this.closest(".head-block");
11762            var indexTab = curHeadBlock.find(".items-link .item-link.active");
11763            var indexActiveTab = indexTab.index();
11764
11765            if (indexActiveTab != index) {
11766              curHeadBlock
11767                .find(".items-link .item-link")
11768                .eq(index)
11769                .trigger("click");
11770            }
11771          });
11772        });
11773      } else {
11774        $(this).removeClass("on");
11775        selectList.slideUp(duration);
11776      }
11777    });
11778  });
11779
11780  // $('.items-link-mobile').on('change', function(){
11781  // 	var value = $(this).val();
11782
11783  // 	var option = $(this).find('option[value='+value+']');
11784
11785  // 	var index = option.index();
11786
11787  // 	var curHeadBlock = $(this).closest('.head-block');
11788  // 	var indexTab = curHeadBlock.find('.item-link.active');
11789  // 	var indexActiveTab = indexTab.index();
11790
11791  // 	if(indexActiveTab != index){
11792  // 		curHeadBlock.find('.items-link .item-link').eq(index).trigger('click');
11793  // 	}
11794  // });
11795
11796  /*tabs on PC*/
11797  $(".head-block .item-link").on("click", function () {
11798    var index = $(this).index(),
11799      body_block = $(this).closest(".catalog").find(".body-block"),
11800      obQuery = parseUrlQuery(),
11801      url_post =
11802        arAllcorp2Options["SITE_DIR"] +
11803        "include/mainpage/comp_catalog_ajax.php";
11804    // $hideItemsLink = $('.clicked').siblings('.hide_mobile');
11805
11806    $(this).siblings().removeClass("active").addClass("hide_mobile");
11807    $(this).addClass("active").removeClass("hide_mobile");
11808
11809    if ("clear_cache" in obQuery)
11810      url_post += "?clear_cache=" + obQuery.clear_cache;
11811
11812    if (!$(this).hasClass("clicked")) {
11813      $.ajax({
11814        url: url_post,
11815        type: "POST",
11816        data: {
11817          AJAX_POST: "Y",
11818          AJAX_PARAMS: $(this)
11819            .closest(".item-views.catalog")
11820            .find(".request-data")
11821            .data("value"),
11822          GLOBAL_FILTER: body_block
11823            .find(".item-block:eq(" + index + ")")
11824            .data("filter"),
11825        },
11826        success: function (html) {
11827          body_block.find(".item-block:eq(" + index + ")").html(html);
11828
11829          InitFlexSliderClass(
11830            body_block.find(".item-block:eq(" + index + ")").find(".flexslider")
11831          ); //reinit flexslider
11832
11833          body_block.css(
11834            "height",
11835            body_block.find(".item-block.active").actual("outerHeight")
11836          );
11837
11838          body_block
11839            .find(".item-block")
11840            .removeClass("active")
11841            .removeClass("opacity1")
11842            .addClass("opacity0");
11843          body_block.find(".item-block:eq(" + index + ")").addClass("active");
11844
11845          setTimeout(function () {
11846            body_block.css("height", "auto");
11847
11848            //recalculate height
11849            body_block
11850              .find(
11851                ".item-block:eq(" +
11852                index +
11853                ") .catalog.item-views.table .item .title"
11854              )
11855            //.sliceHeight({ sliceEqualLength: true });
11856            body_block
11857              .find(
11858                ".item-block:eq(" +
11859                index +
11860                ") .catalog.item-views.table .item .cont"
11861              )
11862            //.sliceHeight({ sliceEqualLength: true });
11863            body_block
11864              .find(
11865                ".item-block:eq(" +
11866                index +
11867                ") .catalog.item-views.table .item .slice_price"
11868              )
11869            //.sliceHeight({ sliceEqualLength: true });
11870            body_block
11871              .find(
11872                ".item-block:eq(" + index + ") .catalog.item-views.table .item"
11873              )
11874            //.sliceHeight({ sliceEqualLength: true });
11875
11876            body_block
11877              .find(".item-block:eq(" + index + ")")
11878              .removeClass("opacity0")
11879              .addClass("opacity1");
11880            if (typeof setHoverHeight == "function") setHoverHeight();
11881          }, 100);
11882
11883          setBasketItemsClasses();
11884        }
11885      });
11886    } else {
11887      body_block
11888        .find(".item-block")
11889        .removeClass("active")
11890        .removeClass("opacity1")
11891        .addClass("opacity0");
11892      body_block
11893        .find(".item-block:eq(" + index + ")")
11894        .addClass("active")
11895        .removeClass("opacity0")
11896        .addClass("opacity1");
11897
11898      if (!body_block.find(".item-block.active .flex-control-nav li").length) {
11899        $(".item-views.catalog .flex-direction-nav li a").addClass(
11900          "flex-disabled"
11901        );
11902      } else {
11903        $(".item-views.catalog .flex-direction-nav li a").removeClass(
11904          "flex-disabled"
11905        );
11906      }
11907      setBasketItemsClasses();
11908      if (typeof setHoverHeight == "function") setHoverHeight();
11909
11910      // if ($hideItemsLink.hasClass('hide_mobile')) {
11911      //     $hideItemsLink.each(function(){
11912      //         $(this).removeClass("hide_mobile");
11913      //     });
11914      // }
11915    }
11916    $(this).addClass("clicked");
11917  });
11918
11919  /*item galery*/
11920  $(".thumbs .item a").on("click", function (e) {
11921    e.preventDefault();
11922    $(".thumbs .item").removeClass("current");
11923    $(this).closest(".item").toggleClass("current");
11924    $(".slides li" + $(this).attr("href"))
11925      .addClass("current")
11926      .siblings()
11927      .removeClass("current");
11928  });
11929
11930  $("header.fixed .btn-responsive-nav").on("click", function () {
11931    $("html, body").animate({ scrollTop: 0 }, 400);
11932  });
11933
11934  $("body").on("click", ".form .refresh-page", function () {
11935    location.href = location.href;
11936  });
11937
11938  // click on HTML5 video
11939  $(document).on("click", "video.video", function (e) {
11940    var videoID = e.target.id.replace("player_", "");
11941    if (videoID) {
11942      if (players[videoID].playing) {
11943        e.target.pause();
11944      } else {
11945        e.target.play();
11946      }
11947    }
11948  });
11949
11950  // START VIDEO BUTTON
11951  /*$(document).on('click', '.banners-big .item .btn-video', function(){
11952    $(this).addClass('loading');
11953    startMainBannerSlideVideo($(this).closest('.item'));
11954  });*/
11955
11956  $(document).on("click", ".basket.fly .opener", function () {
11957    if (window.matchMedia("(max-width: 767px)").matches)
11958      location.href = arAllcorp2Options["THEME"]["URL_BASKET_SECTION"];
11959    else $(this).closest(".ajax_basket").toggleClass("opened");
11960  });
11961
11962  $(document).on("click", ".basket.fly .close_block", function () {
11963    $(".basket.fly .opener").trigger("click");
11964  });
11965
11966  /* show props */
11967  $(document).on("click", ".show_props", function () {
11968    $(this).prev(".props_list").stop().slideToggle(333);
11969    $(this).find(".char_title").toggleClass("opened");
11970  });
11971
11972  /* animated labels */
11973  $(document)
11974    .on(
11975      "focus",
11976      ".animated-labels:not(.animated-labels--no-animation) input,.animated-labels textarea",
11977      function () {
11978        $(this).closest(".animated-labels").addClass("input-filed");
11979      }
11980    )
11981    .on(
11982      "focusout",
11983      ".animated-labels input,.animated-labels textarea",
11984      function () {
11985        if ("" != $(this).val())
11986          $(this).closest(".animated-labels").addClass("input-filed");
11987        else $(this).closest(".animated-labels").removeClass("input-filed");
11988      }
11989    );
11990
11991  /* accordion action*/
11992  $(".panel-collapse").on("hidden.bs.collapse", function () {
11993    $(this).parent().toggleClass("opened");
11994  });
11995  $(".panel-collapse").on("show.bs.collapse", function () {
11996    $(this).parent().toggleClass("opened");
11997  });
11998
11999  // DIGITAL BASKET
12000  // - basket fly close
12001  $(document).on("click", function () {
12002    if ($(".basket.fly").length && $(".ajax_basket").hasClass("opened")) {
12003      $(".ajax_basket").removeClass("opened");
12004    }
12005  });
12006
12007  $(document).on("click", ".basket.fly", function (e) {
12008    e.stopPropagation();
12009  });
12010
12011  // - COUNTER
12012  var timerBasketCounter = false;
12013
12014  // -- keyup input
12015  $(document).on("keydown", ".count", function (e) {
12016    // Allow: backspace, delete, tab, escape, enter and .
12017    if (
12018      $.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
12019      // Allow: Ctrl+A, Command+A
12020      (e.keyCode === 65 && (e.ctrlKey === true || e.metaKey === true)) ||
12021      // Allow: home, end, left, right, down, up
12022      (e.keyCode >= 35 && e.keyCode <= 40)
12023    ) {
12024      // let it happen, don't do anything
12025      return;
12026    }
12027    // Ensure that it is a number and stop the keypress
12028    if (
12029      (e.shiftKey || e.keyCode < 48 || e.keyCode > 57) &&
12030      (e.keyCode < 96 || e.keyCode > 105)
12031    ) {
12032      e.preventDefault();
12033    }
12034  });
12035  $(document).on("keyup", ".count", function (e) {
12036    var $this = $(this),
12037      counterInputValueNew = $this.val(),
12038      price = $this.closest(".item").find("input[name=PRICE]").val();
12039
12040    Summ($this, counterInputValueNew, price);
12041  });
12042
12043  // -- scroll after apply option
12044  if ($(".instagram_ajax").length) {
12045    BX.addCustomEvent("onCompleteAction", function (eventdata) {
12046      if (eventdata.action === "instagrammLoaded") scrollPreviewBlock();
12047    });
12048  } else scrollPreviewBlock();
12049
12050  $("select.region").on("change", function () {
12051    var val = parseInt($(this).val());
12052    if ($("select.city").length) {
12053      if (val) {
12054        $("select.city").removeAttr("disabled");
12055        $("select.city option").hide();
12056        $("select.city option[data-parent_section=" + val + "]").show();
12057      } else $("select.city").attr("disabled", "disabled");
12058    }
12059  });
12060
12061  $("select.city, select.region").on("change", function () {
12062    var _this = $(this),
12063      val = parseInt(_this.val());
12064    if (_this.hasClass("region")) {
12065      $("select.city option:eq(0)").show();
12066      $("select.city").val(0);
12067    }
12068
12069    if ((_this.hasClass("region") && !val) || _this.hasClass("city")) {
12070      $.ajax({
12071        type: "POST",
12072        data: { ID: val },
12073        success: function (html) {
12074          var ob = BX.processHTML(html);
12075          $(".ajax_items")[0].innerHTML = ob.HTML;
12076          BX.ajax.processScripts(ob.SCRIPT);
12077        }
12078      });
12079    }
12080  });
12081
12082  // -- blur input
12083  $(document).on("blur", ".count", function () {
12084    BasketCounter($(this));
12085  });
12086
12087  // -- click minus, plus button
12088  $(document).on("click", ".minus, .plus", function (e) {
12089    e.stopPropagation();
12090    BasketCounter($(this));
12091  });
12092
12093  // - Add2Basket
12094  $(document).on("click", ".to_cart", function (e) {
12095    e.stopPropagation();
12096    var item = $(this).closest("[data-item]"),
12097      _this = $(this),
12098      itemData = item.data("item"),
12099      buyBlock = item.find(".buy_block"),
12100      counter = buyBlock.find(".counter"),
12101      buttonToCart = buyBlock.find(".to_cart"),
12102      itemQuantity = parseFloat(buttonToCart.data("quantity")),
12103      countItem = $(".basket").length
12104        ? parseInt($(".basket .count").text())
12105        : parseInt($(".basket_top:visible .count").text());
12106
12107    if (
12108      typeof arBasketItems === "object" &&
12109      typeof arBasketItems[itemData.ID] !== "object"
12110    )
12111      arBasketItems[itemData.ID] = { ID: itemData.ID };
12112
12113    $(".basket_top .count")
12114      .text(countItem + 1)
12115      .removeClass("empted");
12116    $(".basket .count")
12117      .text(countItem + 1)
12118      .removeClass("empted");
12119
12120    if (
12121      typeof arAllcorp2Options["THEME"]["ORDER_BASKET_VIEW"] !== "undefined"
12122    ) {
12123      if (
12124        $.trim(arAllcorp2Options["THEME"]["ORDER_BASKET_VIEW"]) === "HEADER" &&
12125        $(".basket_top").length
12126      )
12127        var bBasketTop = true;
12128      else if ($(".basket.fly").length) var bBasketFly = true;
12129    }
12130
12131    if (isNaN(itemQuantity) || itemQuantity <= 0) {
12132      itemQuantity = 1;
12133    }
12134
12135    if (!isNaN(itemData.ID) && parseInt(itemData.ID) > 0) {
12136      buyBlock.addClass("in");
12137
12138      $.ajax({
12139        url: arAllcorp2Options["SITE_DIR"] + "include/footer/site-basket.php",
12140        type: "POST",
12141        data: { itemData: itemData, quantity: itemQuantity },
12142        success: function (html) {
12143          var eventdata = { action: "loadForm" };
12144          BX.onCustomEvent("onCompleteAction", [eventdata, _this[0]]);
12145
12146          const bShowCartNotice = arAllcorp2Options.THEME.SHOW_BASKET_NOTICE
12147            && arAllcorp2Options.THEME.SHOW_BASKET_NOTICE === 'Y'
12148            && typeof JNoticeSurface !== "undefined"
12149            && !_this.hasClass("added");
12150
12151          if (bBasketTop) {
12152            $(".ajax_basket").html(html);
12153          }
12154
12155          if (bBasketFly) {
12156            if ($(".basket.fly").length) {
12157              $(".ajax_basket").html(html);
12158
12159              const $nodeAjaxBasket = $(".ajax_basket");
12160              const bOpenCart = !bShowCartNotice
12161                && arAllcorp2Options.THEME.SHOW_BASKET_ONADDTOCART
12162                && arAllcorp2Options.THEME.SHOW_BASKET_ONADDTOCART === 'Y'
12163                && !$nodeAjaxBasket.hasClass('opened-once');
12164
12165              if (bOpenCart) {
12166                setTimeout(function () {
12167                  if (!$nodeAjaxBasket.hasClass("opened")) {
12168                    $nodeAjaxBasket.addClass("opened opened-once");
12169                  }
12170                }, 50);
12171              }
12172            }
12173          }
12174
12175          if (bShowCartNotice) {
12176            JNoticeSurface.get().onAdd2cart([_this[0]]);
12177          }
12178
12179          var eventdata = { action: "loadBasket" };
12180          BX.onCustomEvent("onCompleteAction", [eventdata, $(".ajax_basket")[0]]);
12181
12182          if (arAllcorp2Options["THEME"]["USE_SALE_GOALS"] != "N") {
12183            var eventdata = {
12184              goal: "goal_basket_add",
12185              params: { itemData: itemData, quantity: itemQuantity },
12186            };
12187            BX.onCustomEvent("onCounterGoals", [eventdata]);
12188          }
12189        },
12190      });
12191    } else {
12192      return;
12193    }
12194  });
12195
12196  // - Remove9Basket
12197  $(document).on("click", ".remove", function () {
12198    var item = $(this).closest("[data-item]"),
12199      itemData = item.data("item"),
12200      bRemove = "Y",
12201      bRemoveAll =
12202        $.trim($(this).closest("[data-remove_all]").data("remove_all")) === "Y"
12203          ? "Y"
12204          : false;
12205    (getCurUri = $.trim($("input[name=getPageUri]").val())),
12206      (countItem = $(".basket").length
12207        ? parseInt($(".basket .item").length)
12208        : parseInt($(".basket_top:visible .item").length)),
12209      (bOneItem = countItem - 1 <= 0),
12210      (scrollTop = $(".basket.fly").length
12211        ? $(".basket.fly .items_wrap").scrollTop()
12212        : $(".basket_top:visible").length
12213          ? $(".basket_top .items:visible").scrollTop()
12214          : "");
12215
12216    if (
12217      typeof arBasketItems === "object" &&
12218      itemData &&
12219      typeof arBasketItems[itemData.ID] === "object"
12220    )
12221      delete arBasketItems[itemData.ID];
12222
12223    var _ajax = function () {
12224      $.ajax({
12225        url: arAllcorp2Options["SITE_DIR"] + "include/footer/site-basket.php",
12226        data: { itemData: itemData, remove: bRemove, removeAll: bRemoveAll },
12227        success: function (html) {
12228          if (bBasketTop) {
12229            $(".ajax_basket").html(html);
12230            $(".basket_top .items").scrollTop(scrollTop);
12231          }
12232
12233          if (getCurUri) {
12234            $.ajax({
12235              url: getCurUri,
12236              type: "POST",
12237              success: function (html) {
12238                if ($(".basket.default").length) {
12239                  $(".basket.default").html(html);
12240                }
12241              },
12242            });
12243          }
12244
12245          if (bBasketFly) {
12246            $(".ajax_basket").html(html);
12247            $(".ajax_basket").addClass("opened");
12248            $(".basket.fly .items_wrap").scrollTop(scrollTop);
12249          }
12250
12251          var eventdata = { action: "loadBasket" };
12252          BX.onCustomEvent("onCompleteAction", [eventdata, $(html)]);
12253
12254          if (arAllcorp2Options["THEME"]["USE_SALE_GOALS"] != "N") {
12255            var eventdata = {
12256              goal: "goal_basket_remove",
12257              params: {
12258                itemData: itemData,
12259                remove: bRemove,
12260                removeAll: bRemoveAll,
12261              },
12262            };
12263            BX.onCustomEvent("onCounterGoals", [eventdata]);
12264          }
12265        },
12266      });
12267    };
12268
12269    if (
12270      typeof arAllcorp2Options["THEME"]["ORDER_BASKET_VIEW"] !== "undefined"
12271    ) {
12272      if (
12273        $.trim(arAllcorp2Options["THEME"]["ORDER_BASKET_VIEW"]) === "HEADER" &&
12274        $(".basket_top").length
12275      )
12276        var bBasketTop = true;
12277      else if ($(".basket.fly").length) var bBasketFly = true;
12278    }
12279
12280    if (
12281      (typeof itemData !== "undefined" &&
12282        !isNaN(itemData.ID) &&
12283        itemData.ID > 0) ||
12284      bRemoveAll
12285    ) {
12286      if (bRemoveAll) {
12287        $(".buy_block").removeClass("in");
12288        $(".basket .count").text(0).addClass("empted");
12289        $(".basket_top .count").text(0).addClass("empted");
12290        $("#mobilemenu .menu .ready .count").text(0).addClass("empted");
12291      } else {
12292        $("[data-item]").each(function () {
12293          if ($(this).data("item").ID == itemData.ID) {
12294            $(this).find(".buy_block").removeClass("in");
12295          }
12296        });
12297        if ($(".basket").length) {
12298          if ($(".basket_top .count").length)
12299            $(".basket_top .count").text(
12300              parseFloat($(".basket_top:visible .count").text()) - 1
12301            );
12302          else {
12303            $(".basket .count").text(
12304              parseFloat($(".basket .count").text()) - 1
12305            );
12306            $(".basket_top .count").text(
12307              parseFloat($(".basket .count").text()) - 1
12308            );
12309          }
12310        } else {
12311          $(".basket_top .count").text(
12312            parseFloat($(".basket_top:visible .count").text()) - 1
12313          );
12314        }
12315
12316        $("#mobilemenu .menu .ready .count").text(
12317          parseFloat($("#mobilemenu .menu .ready .count").text()) - 1
12318        );
12319      }
12320
12321      if (bOneItem && !bRemoveAll) {
12322        if (item.closest(".basket_top").length) {
12323          item.closest(".dropdown").animate({ opacity: 0 }, 200, function () {
12324            _ajax();
12325          });
12326        } else {
12327          item.closest(".basket").find(".count").addClass("empted");
12328          item.closest(".basket_wrap").fadeOut(200, function () {
12329            item
12330              .closest(".basket")
12331              .find(".basket_empty")
12332              .fadeIn(200, function () {
12333                _ajax();
12334              });
12335          });
12336        }
12337      } else if (bRemoveAll) {
12338        $(".basket_wrap").fadeOut(200, function () {
12339          $(".remove.all").remove();
12340          $(".basket")
12341            .find(".basket_empty")
12342            .fadeIn(200, function () {
12343              _ajax();
12344            });
12345        });
12346      } else if (!bOneItem) {
12347        item.animate({ opacity: 0 }, 200).slideUp(200, function () {
12348          _ajax();
12349        });
12350      }
12351    } else {
12352      return;
12353    }
12354  });
12355  $(document).on("click", ".print", function () {
12356    window.print();
12357  });
12358
12359  $(".choise").on("click", function () {
12360    var _this = $(this);
12361    if (typeof _this.data("block") != "undefined") {
12362      scrollToBlock(_this.data("block"));
12363    }
12364  });
12365
12366  /*touch event*/
12367  document.addEventListener(
12368    "touchend",
12369    function (event) {
12370      if (
12371        !$(event.target).closest(".menu-item").length &&
12372        !$(event.target).hasClass("menu-item")
12373      ) {
12374        $(".mega-menu .dropdown-menu").css({ display: "none", opacity: 0 });
12375        $(".menu-item").removeClass("hover");
12376        $(".bx-breadcrumb-item.drop").removeClass("hover");
12377      }
12378      if (!$(event.target).closest(".menu.topest").length) {
12379        $(".menu.topest").css({ overflow: "hidden" });
12380        $(".menu.topest > li").removeClass("hover");
12381      }
12382      if (!$(event.target).closest(".full.has-child").length) {
12383        $(".menu_top_block.catalog_block li").removeClass("hover");
12384      }
12385      /*if(!$(event.target).closest('.basket_block').length){
12386      $('.basket_block .link').removeClass('hover');
12387      $('.basket_block .basket_popup_wrapp').slideUp();
12388    }
12389    if(!$(event.target).closest('.catalog_item').length){
12390      var tabsContentUnhoverHover = $('.tab:visible').attr('data-unhover') * 1;
12391      $('.tab:visible').stop().animate({'height': tabsContentUnhoverHover}, 100);
12392      $('.tab:visible').find('.catalog_item').removeClass('hover');
12393      $('.tab:visible').find('.catalog_item .buttons_block').stop().fadeOut(233);
12394      if($('.catalog_block').length){
12395        $('.catalog_block').find('.catalog_item_wrapp').removeClass('hover');
12396        $('.catalog_block').find('.catalog_item').removeClass('hover');
12397      }
12398    }*/
12399    },
12400    false
12401  );
12402
12403  touchMenu(".mega-menu .menu-item");
12404  touchTopMenu(".menu.topest li");
12405  /*show password*/
12406  $(".form-group:not(.eye-password-ignore) [type=password]").each(function (item) {
12407    let passBlock = $(this).closest(".form-group");
12408    let labelBlock = passBlock.find(".label_block");
12409    if (labelBlock.length) {
12410      labelBlock.addClass("eye-password");
12411    } else {
12412      passBlock.addClass("eye-password");
12413    }
12414  });
12415
12416  $(document).on("click", ".eye-password:not(.eye-password-ignore)", function (event) {
12417    let input = this.querySelector("input");
12418    let eyeWidth = 56;
12419    if (this.clientWidth - eyeWidth < event.offsetX) {
12420      if (input.type == "password") {
12421        input.type = "text";
12422        this.classList.add("password-show");
12423      } else if (input.type == "text") {
12424        input.type = "password";
12425        this.classList.remove("password-show");
12426      }
12427    }
12428  });
12429  /**/
12430});
12431
12432function touchMenu(selector) {
12433  if (isMobile) {
12434    if ($(selector).length) {
12435      $(selector).each(function () {
12436        var th = $(this);
12437        th.on("touchend", function (e) {
12438          var _th = $(e.target).closest(".menu-item");
12439
12440          $(".menu.topest > li").removeClass("hover");
12441          $(".menu_top_block.catalog_block li").removeClass("hover");
12442          $(".bx-breadcrumb-item.drop").removeClass("hover");
12443
12444          if (_th.find(".dropdown-menu").length && !_th.hasClass("hover")) {
12445            e.preventDefault();
12446            e.stopPropagation();
12447            _th.siblings().removeClass("hover");
12448            _th.addClass("hover");
12449            $(".menu-row .dropdown-menu").css({ display: "none", opacity: 0 });
12450            if (_th.hasClass("menu-item")) {
12451              _th
12452                .closest(".dropdown-menu")
12453                .css({ display: "block", opacity: 1 });
12454            }
12455            if (_th.find("> .wrap > .dropdown-menu")) {
12456              _th
12457                .find("> .wrap > .dropdown-menu")
12458                .css({ display: "block", opacity: 1 });
12459            } else if (_th.find("> .dropdown-menu")) {
12460              _th
12461                .find("> .dropdown-menu")
12462                .css({ display: "block", opacity: 1 });
12463            }
12464            CheckTopVisibleMenu();
12465          } else {
12466            var href = $(e.target).attr("href")
12467              ? $(e.target).attr("href")
12468              : $(e.target).closest("a").attr("href");
12469            if (href && href !== "undefined") location.href = href;
12470          }
12471        });
12472      });
12473    }
12474  } else {
12475    $(selector).off();
12476  }
12477}
12478
12479function touchTopMenu(selector) {
12480  if (isMobile) {
12481    if ($(selector).length) {
12482      $(selector).each(function () {
12483        var th = $(this);
12484        th.on("touchend", function (e) {
12485          var _th = $(e.target).closest("li");
12486
12487          $(".menu-item").removeClass("hover");
12488          $(".menu-item .dropdown-menu").css({ display: "none", opacity: 0 });
12489          $(".menu_top_block.catalog_block li").removeClass("hover");
12490          $(".bx-breadcrumb-item.drop").removeClass("hover");
12491
12492          if (_th.hasClass("more") && !_th.hasClass("hover")) {
12493            e.preventDefault();
12494            e.stopPropagation();
12495            _th.siblings().removeClass("hover");
12496            _th.addClass("hover");
12497            $(".menu.topest").css({ overflow: "visible" });
12498          } else {
12499            var href = $(e.target).attr("href")
12500              ? $(e.target).attr("href")
12501              : $(e.target).closest("a").attr("href");
12502            if (href && href !== "undefined") location.href = href;
12503          }
12504        });
12505      });
12506    }
12507  } else {
12508    $(selector).off();
12509  }
12510}
12511
12512scrollPreviewBlock = function () {
12513  if (
12514    typeof $.cookie("scoll_block") != "undefined" &&
12515    $.cookie("scoll_block")
12516  ) {
12517    var scoll_block = $($.cookie("scoll_block"));
12518    if (scoll_block.length) {
12519      $("body, html").animate({ scrollTop: scoll_block.offset().top }, 500);
12520      $.cookie("scoll_block", null);
12521    }
12522  }
12523};
12524
12525scrollToBlock = function (block) {
12526  if ($(block).length) {
12527    var offset = $(block).offset().top;
12528    if (typeof $(block).data("toggle") != "undefined") $(block).click();
12529
12530    if (typeof $(block).data("offset") != "undefined")
12531      offset += $(block).data("offset");
12532
12533    $("body, html").animate({ scrollTop: offset }, 500);
12534  }
12535};
12536
12537// START VIDEO BUTTON
12538$(".banners-big .maxwidth-banner .item.vvideo .maxwidth-theme").on(
12539  "click",
12540  function (e) {
12541    if (!$(e.target).hasClass("btn-video")) {
12542      if ($(this).hasClass("loading")) {
12543        e.stopPropagation();
12544        $(this).find(".btn-video").trigger("click");
12545      }
12546    }
12547  }
12548);
12549
12550$(document).on("click", ".banners-big .item.current  .btn-video", function (e) {
12551  e.stopPropagation();
12552  if (
12553    !$(this).hasClass("loading") &&
12554    !$(this).closest(".banners-big").hasClass("view_2")
12555  ) {
12556    $(this).addClass("loading");
12557    $(this).closest(".maxwidth-theme").addClass("loading");
12558  } else {
12559    $(this).removeClass("loading");
12560    $(this).closest(".maxwidth-theme").removeClass("loading");
12561  }
12562
12563  startMainBannerSlideVideo($(this).closest(".item"));
12564});
12565
12566//  BANNER GO TO LINK
12567$(document).on("click", ".banners-big.front .box .tablet_img", function (e) {
12568  var wurl = $(this).closest(".box").hasClass("wurl");
12569  if (wurl) {
12570    var href = $(this).closest(".box").find(".target").attr("href");
12571    if (href.length) {
12572      var target = $(this).closest(".box").find(".target").attr("target");
12573      if (typeof target === "undefined" || target === "_self") {
12574        location.href = href;
12575      } else {
12576        window.open(href);
12577      }
12578    }
12579  }
12580});
12581
12582//DIGITAL BASKET
12583function number_format(number, decimals, dec_point, thousands_sep) {
12584  number = (number + "").replace(/[^0-9+\-Ee.]/g, "");
12585  var n = !isFinite(+number) ? 0 : +number,
12586    prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
12587    sep = typeof thousands_sep === "undefined" ? "," : thousands_sep,
12588    dec = typeof dec_point === "undefined" ? "." : dec_point,
12589    s = "",
12590    toFixedFix = function (n, prec) {
12591      var k = Math.pow(10, prec);
12592      return "" + (Math.round(n * k) / k).toFixed(prec);
12593    };
12594
12595  // Fix for IE parseFloat(0.55).toFixed(0) = 0;
12596  s = (prec ? toFixedFix(n, prec) : "" + Math.round(n)).split(".");
12597
12598  if (s[0].length > 3) {
12599    s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
12600  }
12601
12602  if ((s[1] || "").length < prec) {
12603    s[1] = s[1] || "";
12604    s[1] += new Array(prec - s[1].length + 1).join("0");
12605  }
12606
12607  return s.join(dec);
12608}
12609
12610setBasketItemsClasses = function () {
12611  if (
12612    typeof arBasketItems !== "undefined" &&
12613    typeof arBasketItems !== "string"
12614  ) {
12615    if (Object.keys(arBasketItems).length) {
12616      for (var key in arBasketItems) {
12617        $("[data-item]").each(function () {
12618          if ($(this).data("item").ID == key) {
12619            $(this).find(".buy_block").addClass("in");
12620          }
12621        });
12622      }
12623    }
12624  }
12625};
12626
12627function Summ(el, counterInputValueNew, price) {
12628  if (counterInputValueNew <= 0) {
12629    counterInputValueNew = 1;
12630  }
12631
12632  var summ = number_format(counterInputValueNew * price, 0, ".", " "),
12633    allSumm = 0;
12634
12635  el.closest(".items")
12636    .find(".item")
12637    .each(function () {
12638      var $this = $(this),
12639        price = parseFloat($this.find("input[name=PRICE]").val()),
12640        count = parseFloat($this.find("input.count").val());
12641
12642      if (count <= 0) {
12643        count = 1;
12644      }
12645
12646      if (!isNaN(price) && !isNaN(count)) {
12647        allSumm += count * price;
12648      }
12649    });
12650
12651  allSumm = number_format(parseFloat(allSumm), 0, ".", " ");
12652
12653  el.closest(".item").find(".summ .price_val").text(summ);
12654  el.closest(".basket").find(".foot .total>span").text(allSumm);
12655}
12656
12657var timerBasketUpdate = false;
12658// - COUNTER
12659BasketCounter = function (el) {
12660  var elClass = $.trim(el.attr("class")),
12661    bClassMinus = elClass.indexOf("minus") > -1,
12662    bClassPlus = elClass.indexOf("plus") > -1,
12663    bClassCount = elClass.indexOf("count") > -1,
12664    getCurUri = $.trim($("input[name=getPageUri]").val()),
12665    buyBlock = el.closest(".buy_block"),
12666    buttonToCart = buyBlock.find(".to_cart"),
12667    counterInput = el.closest(".counter").find("input.count"),
12668    counterInputValue = parseFloat($.trim(counterInput.val())),
12669    price = parseFloat(buyBlock.find("input[name=PRICE]").val()),
12670    counterInputMaxCount =
12671      Math.pow(10, parseInt(counterInput.attr("maxlength"))) - 1,
12672    bAjax = el.closest(".basket").length ? true : false;
12673
12674  // class minus button
12675  if (bClassMinus) {
12676    var counterInputValueNew = counterInputValue - 1;
12677
12678    if (counterInputValueNew <= 0) {
12679      counterInputValueNew = 1;
12680    }
12681
12682    counterInput.val(counterInputValueNew);
12683
12684    if (bAjax) {
12685      Summ(el, counterInputValueNew, price);
12686
12687      if (timerBasketUpdate) {
12688        clearTimeout(timerBasketUpdate);
12689        timerBasketUpdate = false;
12690      }
12691
12692      timerBasketUpdate = setTimeout(function () {
12693        BasketUpdate(el, counterInputValueNew);
12694        timerBasketUpdate = false;
12695      }, 700);
12696    }
12697  }
12698  // class plus button
12699  else if (bClassPlus) {
12700    var counterInputValueNew = counterInputValue + 1;
12701
12702    if (counterInputValueNew > counterInputMaxCount) {
12703      counterInputValueNew = counterInputMaxCount;
12704    }
12705
12706    counterInput.val(counterInputValueNew);
12707
12708    if (bAjax) {
12709      Summ(el, counterInputValueNew, price);
12710
12711      if (timerBasketUpdate) {
12712        clearTimeout(timerBasketUpdate);
12713        timerBasketUpdate = false;
12714      }
12715
12716      timerBasketUpdate = setTimeout(function () {
12717        BasketUpdate(el, counterInputValueNew);
12718        timerBasketUpdate = false;
12719      }, 700);
12720    }
12721  }
12722  // class input
12723  else if (bClassCount) {
12724    var counterInputValueNew = counterInputValue;
12725
12726    if (counterInputValueNew <= 0 || isNaN(counterInputValueNew)) {
12727      counterInputValueNew = 1;
12728    }
12729    el.val(counterInputValueNew);
12730
12731    if (bAjax) {
12732      BasketUpdate(el, counterInputValueNew);
12733    }
12734  }
12735
12736  if (!getCurUri && !el.closest(".basket.fly").length) {
12737    buttonToCart.data("quantity", counterInputValueNew);
12738  }
12739};
12740
12741BasketUpdate = function (el, counterInputValueNew) {
12742  var itemData = el.closest("[data-item]").data("item"),
12743    itemData =
12744      typeof arBasketItems === "object" &&
12745        typeof arBasketItems[itemData.ID] === "object"
12746        ? arBasketItems[itemData.ID]
12747        : itemData,
12748    buyBlock = el.closest(".buy_block"),
12749    buttonToCart = buyBlock.find(".to_cart"),
12750    getCurUri = $.trim($("input[name=getPageUri]").val());
12751  scrollTop = $(".basket.fly").length
12752    ? $(".basket.fly .items_wrap").scrollTop()
12753    : $(".basket_top:visible").length
12754      ? $(".basket_top .items:visible").scrollTop()
12755      : "";
12756
12757  if (
12758    typeof arAllcorp2Options["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" &&
12759    $.trim(arAllcorp2Options["THEME"]["ORDER_BASKET_VIEW"]) === "FLY" &&
12760    $(".basket.fly").length
12761  ) {
12762    var bBasketFly = true;
12763  }
12764
12765  if (
12766    typeof arAllcorp2Options["THEME"]["ORDER_BASKET_VIEW"] !== "undefined" &&
12767    $.trim(arAllcorp2Options["THEME"]["ORDER_BASKET_VIEW"]) === "HEADER" &&
12768    $(".basket_top").length
12769  ) {
12770    var bBasketTop = true;
12771  } else {
12772    if (
12773      typeof itemData != "undefined" &&
12774      !isNaN(itemData.ID) &&
12775      itemData.ID > 0
12776    ) {
12777      $.ajax({
12778        // url: arAllcorp2Options['SITE_DIR'] + 'ajax/basket_items.php',
12779        url: arAllcorp2Options["SITE_DIR"] + "include/footer/site-basket.php",
12780        data: { itemData: itemData, quantity: counterInputValueNew },
12781        success: function (data) {
12782          if (typeof data === "object") {
12783            arBasketItems = data;
12784          }
12785          if (bBasketTop) {
12786            $.ajax({
12787              url:
12788                arAllcorp2Options["SITE_DIR"] + "include/footer/site-basket.php",
12789              type: "POST",
12790              data: { ajaxPost: "Y" },
12791              success: function (html) {
12792                buyBlock.removeClass("in");
12793                $(".ajax_basket").html(html);
12794              },
12795            });
12796          }
12797
12798          if (bBasketFly) {
12799            $.ajax({
12800              url:
12801                arAllcorp2Options["SITE_DIR"] + "include/footer/site-basket.php",
12802              type: "POST",
12803              data: { ajaxPost: "Y" },
12804              success: function (html) {
12805                if ($(".basket.fly").length) {
12806                  $(".ajax_basket").html(html);
12807                  $(".basket.fly .items_wrap").scrollTop(scrollTop);
12808                }
12809              },
12810            });
12811          }
12812
12813          var eventdata = { action: "loadBasket" };
12814          BX.onCustomEvent("onCompleteAction", [eventdata, $(data)]);
12815
12816          if (getCurUri) {
12817            $.ajax({
12818              url: getCurUri,
12819              type: "POST",
12820              success: function (html) {
12821                if ($(".basket.default").length) {
12822                  $(".basket.default").html(html);
12823                }
12824              },
12825            });
12826          }
12827        },
12828      });
12829    } else {
12830      return;
12831    }
12832  }
12833};
12834
12835showTopIcons = function () {
12836  $("h1").addClass("shares");
12837  $(document).ready(function () {
12838    if ($("a.rss").length) $("a.rss").after($(".share.top"));
12839    else $("h1").before($(".share.top"));
12840  });
12841};
12842
12843CheckTabActive = function () {
12844  if (typeof clicked_tab && clicked_tab) {
12845    /*if(window.matchMedia('(min-width: 768px)').matches)
12846    {
12847      clicked_tab--;
12848      $('.catalog.detail .nav.nav-tabs li:eq('+clicked_tab+')').addClass('active');
12849      $('.catalog.detail .tab-content .tab-pane:eq('+clicked_tab+')').addClass('active');
12850      $('.catalog.detail .tab-content .tab-pane .title-tab-heading').next().removeAttr('style');
12851      clicked_tab = 0;
12852    }*/
12853  }
12854};
12855
12856/* parallax bg */
12857ParallaxBg = function () {
12858  if ($("*[data-type=parallax-bg]").length) {
12859    var x = $(window).scrollTop() / $(document).height();
12860    x = parseInt(-x * 280);
12861    $("*[data-type=parallax-bg]")
12862      .stop()
12863      .animate({ "background-position-y": x + "px" }, 400, "swing");
12864  }
12865};
12866SetFixedAskBlock = function () {
12867  if ($(".ask_a_question_wrapper").length) {
12868    var offset = $(".ask_a_question_wrapper").offset(),
12869      block = $(".ask_a_question_wrapper").find(".ask_a_question"),
12870      block_offset = BX.pos(block[0]),
12871      block_height = block_offset.bottom - block_offset.top,
12872      ask_block_offset = 130,
12873      diff_top_scroll = $("#headerfixed").height() + 20,
12874      footer_block = $("footer").offset().top;
12875
12876    //need for short page content
12877    var wrapHeight = block.height();
12878    block.parent().css({ "min-height": wrapHeight + 42 + "px" });
12879
12880    if (
12881      block_height + ask_block_offset <
12882      block.closest(".fixed_wrapper").height()
12883    ) {
12884      if (
12885        block_height + ask_block_offset >
12886        block.closest(".fixed_wrapper").height()
12887      )
12888        block.addClass("nonfixed");
12889      else block.removeClass("nonfixed");
12890
12891      if (block.closest(".fixed_wrapper").length)
12892        footer_block = BX.pos(block.closest(".fixed_wrapper")[0]).bottom;
12893
12894      if (
12895        block_height + diff_top_scroll + documentScrollTopLast + 80 >
12896        footer_block
12897      ) {
12898        block
12899          .removeClass("fixed")
12900          .css({ top: "auto", width: "auto", bottom: 0 })
12901          .addClass("normal");
12902        block.parent().css("position", "static");
12903        block.parent().parent().css("position", "static");
12904      } else {
12905        block.removeClass("normal");
12906        //block.parent().removeAttr('style');
12907        block.parent().css({ "min-height": wrapHeight + 42 + "px" });
12908        block.parent().parent().removeAttr("style");
12909
12910        if (documentScrollTopLast + diff_top_scroll - 30 > offset.top)
12911          block.addClass("fixed").css({
12912            top: diff_top_scroll,
12913            bottom: "auto",
12914            width: $(".fixed_block_fix").width(),
12915          });
12916        else block.removeClass("fixed").css({ top: 0, width: "auto" });
12917      }
12918    }
12919  }
12920};
12921
12922// Events
12923var timerScroll = false,
12924  ignoreScroll = [],
12925  documentScrollTopLast = $(document).scrollTop(),
12926  documentScrollTop = $(document).scrollTop();
12927$(window).scroll(function () {
12928  documentScrollTop = $(document).scrollTop();
12929  CheckPopupTop();
12930  SetFixedAskBlock();
12931  if (!ignoreScroll.length) {
12932    if (timerScroll) {
12933      clearTimeout(timerScroll);
12934      timerScroll = false;
12935    }
12936    timerScroll = setTimeout(function () {
12937      BX.onCustomEvent("onWindowScroll", false);
12938    }, 100);
12939  }
12940  documentScrollTopLast = $(document).scrollTop();
12941});
12942
12943var timerResize = false,
12944  ignoreResize = [];
12945
12946$(window).resize(function () {
12947  documentScrollTop = $(document).scrollTop();
12948
12949  var scrollTimer = setInterval(function () {
12950    if (typeof arAllcorp2Options !== "undefined") {
12951      CheckPopupTop();
12952      CheckScrollToTop();
12953      clearInterval(scrollTimer);
12954    }
12955  });
12956
12957  if (!ignoreResize.length) {
12958    if (timerResize) {
12959      clearTimeout(timerResize);
12960      timerResize = false;
12961    }
12962    timerResize = setTimeout(function () {
12963      BX.onCustomEvent("onWindowResize", false);
12964    }, 100);
12965  }
12966  documentScrollTopLast = $(document).scrollTop();
12967
12968  if (arAllcorp2Options["THEME"]["COMPACT_FOOTER_MOBILE"] && arAllcorp2Options["THEME"]["COMPACT_FOOTER_MOBILE"] == "Y") {
12969    if (window.matchMedia("(max-width:767px)").matches) {
12970      $("footer").addClass("mobile");
12971      $(".bottom-menu .items>.wrap_compact_mobile").addClass(
12972        "accordion-body collapse"
12973      );
12974      $(".bottom-menu .items>.item-link").attr("data-toggle", "collapse");
12975    } else {
12976      $("footer").removeClass("mobile");
12977      $(".bottom-menu .items>.wrap_compact_mobile").removeClass(
12978        "accordion-body collapse"
12979      );
12980      $(".bottom-menu .items>.item-link").removeAttr("data-toggle");
12981    }
12982  }
12983});
12984
12985BX.addCustomEvent("onWindowScroll", function (eventdata) {
12986  try {
12987    ignoreScroll.push(true);
12988    ParallaxBg();
12989
12990    if (arAllcorp2Options["THEME"]["TYPE_SEARCH"] != "fixed") {
12991      if (!$("header > .top-block").length) {
12992        var height_block = 0,
12993          scrollVal = $(window).scrollTop();
12994        height_block = $(".logo_and_menu-row").actual("outerHeight");
12995        if (!scrollVal) {
12996          $(".inline-search-block").css({
12997            height: height_block,
12998            "line-height": height_block - 4 + "px",
12999            top: -height_block,
13000          });
13001        }
13002      }
13003    }
13004  } catch (e) {
13005  } finally {
13006    ignoreScroll.pop();
13007  }
13008});
13009
13010BX.addCustomEvent("onWindowResize", function (eventdata) {
13011  try {
13012    ignoreResize.push(true);
13013
13014    CheckHeaderFixedMenu();
13015    CheckTopMenuDotted();
13016    CheckTopVisibleMenu();
13017    CheckFlexSlider();
13018    CheckMainBannerSliderVText($(".banners-big .flexslider"));
13019    CheckObjectsSizes();
13020    CoverPlayer();
13021    verticalAlign();
13022    CheckTabActive();
13023    setTimeout(function () {
13024      createTableCompare(
13025        $(".main-block .items .title-block:not(.clone) .item"),
13026        $(".prop_title_table"),
13027        $(".main-block .prop_title_table .item.clone")
13028      );
13029    }, 100);
13030    SliceHeightBlocks();
13031  } catch (e) {
13032  } finally {
13033    ignoreResize.pop();
13034  }
13035});
13036
13037BX.addCustomEvent("onSlide", function (eventdata) {
13038  try {
13039    ignoreResize.push(true);
13040    if (eventdata) {
13041      var slider = eventdata.slider;
13042      if (slider) {
13043        // add classes .curent & .shown to slide
13044        slider.find(".item").removeClass("current");
13045        var curSlide = slider.find(".item.flex-active-slide");
13046        var curSlideIndex = curSlide.attr("data-slide_index");
13047
13048        curSlide.addClass("current");
13049        slider
13050          .find(".item[data-slide_index=" + curSlideIndex + "]")
13051          .addClass("shown");
13052        slider.resize();
13053
13054        if (typeof curSlideIndex !== "undefined" && curSlideIndex.length) {
13055          // set main banners text vertical center
13056          CheckMainBannerSliderVText(slider);
13057          if ($(".item.vvideo")) {
13058            $(".item.vvideo .maxwidth-theme").removeClass("loading");
13059            $(".item.vvideo .maxwidth-theme .btn-video").removeClass("loading");
13060
13061            if (!slider.closest(".banners-big").hasClass("view_2")) {
13062              $(".item.vvideo[data-video_autoplay=1] .maxwidth-theme").addClass(
13063                "loading"
13064              );
13065              $(
13066                ".item.vvideo[data-video_autoplay=1] .maxwidth-theme .btn-video"
13067              ).addClass("loading");
13068            }
13069          }
13070
13071          // pause play video
13072          if (typeof players !== "undefined" && players) {
13073            for (var j in players) {
13074              if (
13075                players[j].playing &&
13076                !players[j].clone &&
13077                players[j].slideIndex != curSlideIndex
13078              ) {
13079                if (typeof window[players[j].id] == "object") {
13080                  if (players[j].videoPlayer === "YOUTUBE") {
13081                    window[players[j].id].pauseVideo();
13082                  } else if (players[j].videoPlayer === "VIMEO") {
13083                    window[players[j].id].pause();
13084                  } else if (players[j].videoPlayer === "RUTUBE") {
13085                    document
13086                      .getElementById(players[j].id)
13087                      .contentWindow.postMessage(
13088                        JSON.stringify({
13089                          type: "player:pause",
13090                          data: {},
13091                        }),
13092                        "*"
13093                      );
13094                  } else if (players[j].videoPlayer === "HTML5") {
13095                    document.getElementById(players[j].id).pause();
13096                  }
13097                }
13098              }
13099            }
13100          }
13101          // autoplay video
13102          var bVideoAutoPlay = curSlide.attr("data-video_autoplay") == 1;
13103          if (bVideoAutoPlay) {
13104            startMainBannerSlideVideo(curSlide);
13105          }
13106        } else {
13107          slider.find(".item").css("opacity", "1");
13108        }
13109        if (slider.closest(".blocks").length)
13110          slider
13111            .closest(".blocks")
13112            .find(".flex-direction-nav li")
13113            .addClass("initied");
13114
13115        if (slider.closest(".wraps").length)
13116          slider
13117            .closest(".wraps")
13118            .find(".flex-direction-nav li")
13119            .addClass("initied");
13120
13121        if (
13122          !slider.find(".flex-control-nav li").length &&
13123          slider.hasClass("normal")
13124        ) {
13125          slider.find(".flex-direction-nav li a").addClass("flex-disabled");
13126        }
13127
13128        if (slider.closest(".banners-big").length) {
13129          // var curSlide = slider.find('.item.flex-active-slide');
13130          //logo src
13131          var bLogoImg = $("header .logo-block .logo img").length;
13132          if (bLogoImg)
13133            $("header .logo-block .logo img").attr(
13134              "src",
13135              arAllcorp2Options.THEME.LOGO_IMAGE
13136            );
13137
13138          //nav flex color
13139          slider.find(".flex-control-nav li").removeClass();
13140
13141          //header color
13142          $("header").removeClass("light dark");
13143          if (typeof curSlide.data("color") != "undefined") {
13144            slider
13145              .find(".flex-control-nav li")
13146              .addClass(curSlide.data("color"));
13147            $("header").addClass(curSlide.data("color"));
13148            if (bLogoImg) {
13149              if (
13150                arAllcorp2Options.THEME.LOGO_IMAGE_LIGHT &&
13151                curSlide.data("color") == "light"
13152              )
13153                $("header .logo-block .logo img").attr(
13154                  "src",
13155                  arAllcorp2Options.THEME.LOGO_IMAGE_LIGHT
13156                );
13157            }
13158          }
13159        }
13160
13161        if (
13162          !slider.hasClass("flexslider-init-slice") &&
13163          slider.hasClass("nav-title") &&
13164          $(".gallery-block").closest(".tab-pane").hasClass("active")
13165        ) {
13166          slider.find(".item").sliceHeight({ lineheight: -3 });
13167          slider.addClass("flexslider-init-slice");
13168        }
13169
13170        if (slider.find(".flex-direction-nav").length) {
13171          if (slider.find(".flex-direction-nav").find("a.flex-disabled").length)
13172            slider
13173              .find(".flex-direction-nav")
13174              .removeClass("opacity1")
13175              .addClass("opacity0");
13176          else
13177            slider
13178              .find(".flex-direction-nav")
13179              .removeClass("opacity0")
13180              .addClass("opacity1");
13181        }
13182      }
13183    }
13184  } catch (e) {
13185  } finally {
13186    ignoreResize.pop();
13187  }
13188});
13189
13190BX.addCustomEvent("onSlideBefore", function (eventdata) {
13191  try {
13192    ignoreResize.push(true);
13193    if (eventdata) {
13194      var slider = eventdata.slider;
13195      if (slider) {
13196        if (slider.closest(".banners-big").length) {
13197          setTimeout(function () {
13198            var curSlide = slider.find(".item.flex-active-slide");
13199            //logo src
13200            var bLogoImg = $("header .logo-block .logo img").length;
13201            if (bLogoImg)
13202              $("header .logo-block .logo img").attr(
13203                "src",
13204                arAllcorp2Options.THEME.LOGO_IMAGE
13205              );
13206
13207            //nav flex color
13208            slider.find(".flex-control-nav li").removeClass();
13209
13210            //header color
13211            $("header").removeClass("light dark");
13212            if (typeof curSlide.data("color") != "undefined") {
13213              slider
13214                .find(".flex-control-nav li")
13215                .addClass(curSlide.data("color"));
13216              $("header").addClass(curSlide.data("color"));
13217              if (bLogoImg) {
13218                if (
13219                  arAllcorp2Options.THEME.LOGO_IMAGE_LIGHT &&
13220                  curSlide.data("color") == "light"
13221                )
13222                  $("header .logo-block .logo img").attr(
13223                    "src",
13224                    arAllcorp2Options.THEME.LOGO_IMAGE_LIGHT
13225                  );
13226              }
13227            }
13228          }, 100);
13229        } else if (slider.hasClass("top-bigs")) {
13230          setTimeout(function () {
13231            var index = slider
13232              .find(".item.flex-active-slide")
13233              .data("slide_key");
13234            $(".bxSlider.top-small .slides").data("bxSlider").goToSlide(index);
13235            $(".bxSlider.top-small .slides li").removeClass(
13236              "flex-active-slide"
13237            );
13238            $(
13239              '.bxSlider.top-small .slides li[data-slide_key="' + index + '"]'
13240            ).addClass("flex-active-slide");
13241          }, 100);
13242        }
13243      }
13244    }
13245  } catch (e) {
13246  } finally {
13247    ignoreResize.pop();
13248  }
13249});
13250
13251BX.addCustomEvent("onSlideEnd", function (eventdata) {
13252  try {
13253    ignoreResize.push(true);
13254    if (eventdata) {
13255      var slider = eventdata.slider;
13256      if (slider) {
13257      }
13258    }
13259  } catch (e) {
13260  } finally {
13261    ignoreResize.pop();
13262  }
13263});
13264
13265$(window).resize(function () {
13266  CheckTopMenuPadding();
13267  CheckTopMenuOncePadding();
13268  CheckSearchWidth();
13269});
13270
13271var onCaptchaVerifyinvisible = function (response) {
13272  $(".g-recaptcha:last").each(function () {
13273    var id = $(this).attr("data-widgetid");
13274    if (typeof id !== "undefined" && response) {
13275      if (!$(this).closest("form").find(".g-recaptcha-response").val())
13276        $(this).closest("form").find(".g-recaptcha-response").val(response);
13277      if ($("iframe[src*=recaptcha]").length) {
13278        $("iframe[src*=recaptcha]").each(function () {
13279          var block = $(this).parent().parent();
13280          if (!block.hasClass("grecaptcha-badge")) block.css("width", "100%");
13281        });
13282      }
13283      if ($(this).closest("form").attr("name") == "form_comment")
13284        BX.submit(BX("form_comment"));
13285      else $(this).closest("form").submit();
13286    }
13287  });
13288};
13289
13290var onCaptchaVerifynormal = function (response) {
13291  $(".g-recaptcha").each(function () {
13292    var id = $(this).attr("data-widgetid");
13293    if (typeof id !== "undefined") {
13294      if (grecaptcha.getResponse(id) != "") {
13295        $(this).closest("form").find(".recaptcha").valid();
13296      }
13297    }
13298  });
13299};
13300
13301BX.addCustomEvent("onSubmitForm", function (eventdata) {
13302  try {
13303    if (
13304      !window.renderRecaptchaById ||
13305      !window.asproRecaptcha ||
13306      !window.asproRecaptcha.key
13307    ) {
13308      eventdata.form.submit();
13309      $(eventdata.form).closest(".form").addClass("sending");
13310      return true;
13311    }
13312
13313    if (
13314      window.asproRecaptcha.params.recaptchaSize == "invisible" &&
13315      $(eventdata.form).find(".g-recaptcha").length
13316    ) {
13317      if ($(eventdata.form).find(".g-recaptcha-response").val()) {
13318        eventdata.form.submit();
13319        $(eventdata.form).closest(".form").addClass("sending");
13320        return true;
13321      } else {
13322        if (typeof grecaptcha != "undefined") {
13323          grecaptcha.execute(
13324            $(eventdata.form).find(".g-recaptcha").data("widgetid")
13325          );
13326        } else {
13327          return false;
13328        }
13329      }
13330    } else {
13331      eventdata.form.submit();
13332      $(eventdata.form).closest(".form").addClass("sending");
13333      return true;
13334    }
13335  } catch (e) {
13336    console.error(e);
13337    return true;
13338  }
13339});
13340
13341/* End */
13342;
13343; /* Start:"a:4:{s:4:"full";s:65:"/bitrix/templates/aspro-allcorp2/js/scrollTabs.js?171828087313520";s:6:"source";s:49:"/bitrix/templates/aspro-allcorp2/js/scrollTabs.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13344InitTabsScroll = function(){
13345	$('.arrow_scroll:not(.arrow_scroll_init)').scrollTab();
13346}
13347
13348ResizeScrollTabs = function() {
13349	var scrollTabs = $('.arrow_scroll_init');
13350
13351	if(scrollTabs.length) {
13352		scrollTabs.each(function(i, scrollTab){
13353			var _scrollTab = $(scrollTab);
13354			_scrollTab.data('scrollTabOptions').resize();
13355		});
13356	}
13357}
13358
13359$(document).ready(function(){
13360	InitTabsScroll();
13361});
13362
13363$(window).on('resize', function(){
13364	if(window.scrollTabsTimeout !== undefined) {
13365		clearTimeout(window.scrollTabsTimeout);
13366	}
13367	
13368	window.scrollTabsTimeout = setTimeout(
13369		ResizeScrollTabs,
13370		20
13371	);
13372});
13373
13374$.fn.scrollTab = function( options ){
13375	function _scrollTab(element, options) {
13376		var _scrollTab = $(element);
13377		var tabs_wrapper = _scrollTab.find(options.tabs_wrapper);
13378		if( tabs_wrapper === undefined || !tabs_wrapper.length )
13379			return false;
13380		
13381		var tabs = tabs_wrapper.find('> li');
13382		if(!tabs.length)
13383			return false;
13384
13385		var arrow_svg = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8">'+
13386							'<rect width="12" height="8" fill="#333" fill-opacity="0" />'+
13387							'<path d="M1015.69,507.693a0.986,0.986,0,0,1-1.4,0l-4.31-4.316-4.3,4.316a0.993,0.993,0,0,1-1.4-1.408l4.99-5.009a1.026,1.026,0,0,1,1.43,0l4.99,5.009A0.993,0.993,0,0,1,1015.69,507.693Z" fill="#333" transform="translate(-1004 -501)"/>'+
13388						'</svg>';
13389		var arrows_wrapper = '<div class="arrows_wrapper">'+
13390								'<div class="arrow arrow_left colored_theme_hover_text">'+arrow_svg+'</div>'+
13391								'<div class="arrow arrow_right colored_theme_hover_text">'+arrow_svg+'</div>'+
13392							'</div>';
13393
13394		var arrows = $(arrows_wrapper).insertBefore(tabs_wrapper);
13395		var arrow_left = arrows.find('.arrow_left');
13396		var arrow_right = arrows.find('.arrow_right');
13397
13398		var thisOoptions = $.extend({}, options);       
13399        var isTouch = ('ontouchstart' in document.documentElement);
13400
13401		thisOoptions.scrollTab = _scrollTab;
13402		thisOoptions.wrapper = tabs_wrapper;
13403		thisOoptions.tabs = tabs;
13404		thisOoptions.arrows = {};
13405		thisOoptions.arrows.wrapper = arrows;
13406		thisOoptions.arrows.arrow_left = arrow_left;
13407		thisOoptions.arrows.arrow_right = arrow_right;
13408
13409		if(thisOoptions.linked_tabs !== undefined && thisOoptions.linked_tabs.length && thisOoptions.linked_tabs.data('scrollTabOptions') !== undefined) {
13410			thisOoptions.linked_options = thisOoptions.linked_tabs.data('scrollTabOptions');
13411			thisOoptions.linked_options.linked_options = thisOoptions;
13412		}
13413
13414		if(options.arrows_css) {
13415			thisOoptions.arrows.arrow_left.css(options.arrows_css);
13416			thisOoptions.arrows.arrow_right.css(options.arrows_css);
13417		}
13418
13419		thisOoptions.initTabs = function(){
13420			thisOoptions.wrapperBounds = thisOoptions.wrapper[0].getBoundingClientRect();
13421			thisOoptions.scrollBounds = thisOoptions.scrollTab[0].getBoundingClientRect();
13422			elements = $(thisOoptions.tabs);
13423			if(elements.length) {
13424				thisOoptions.firstTabBound = elements[0].getBoundingClientRect().left;
13425				thisOoptions.lastTabBound = elements[ elements.length - 1 ].getBoundingClientRect().right;
13426			}
13427			thisOoptions.minTranslate = (thisOoptions.wrapperBounds.right < thisOoptions.lastTabBound ? thisOoptions.wrapperBounds.right - thisOoptions.lastTabBound - 2 : 0);
13428			thisOoptions.disabled = ( thisOoptions.lastTabBound - thisOoptions.wrapperBounds.left ) <= thisOoptions.scrollBounds.width;
13429		}
13430
13431		thisOoptions.wrapper.css({
13432			'white-space': 'nowrap',
13433			'min-width': 'auto',
13434			'overflow': 'visible',
13435			'z-index': '1',
13436		});
13437		thisOoptions.scrollTab.css({
13438			'overflow': 'hidden',
13439			'position': 'relative',
13440		});
13441
13442		thisOoptions.checkArrows = function(translate){
13443			if(translate === undefined) {
13444				translate = thisOoptions.translate;
13445			}
13446			
13447			if( thisOoptions.disabled ) {
13448				thisOoptions.arrows.arrow_left.addClass('disabled');
13449				thisOoptions.arrows.arrow_right.addClass('disabled');
13450			} else {
13451				if(translate >= thisOoptions.maxTranslate) {
13452					thisOoptions.arrows.arrow_left.addClass('disabled');
13453					thisOoptions.arrows.arrow_right.removeClass('disabled');
13454				} else if(translate <= thisOoptions.minTranslate) {
13455					thisOoptions.arrows.arrow_right.addClass('disabled');
13456					thisOoptions.arrows.arrow_left.removeClass('disabled');
13457				} else {
13458					thisOoptions.arrows.arrow_left.removeClass('disabled');
13459					thisOoptions.arrows.arrow_right.removeClass('disabled');
13460				}
13461			}
13462
13463		}
13464
13465		thisOoptions.directScroll = function(distance, delay, step){
13466			if(delay === undefined) {
13467				delay = 5;
13468			}
13469			clearInterval(thisOoptions.timerMoveDirect);
13470			var newTranslate = thisOoptions.translate + distance;
13471
13472			if(newTranslate > thisOoptions.maxTranslate) {
13473				newTranslate = thisOoptions.maxTranslate;
13474			} else if(newTranslate < thisOoptions.minTranslate) {
13475				newTranslate = thisOoptions.minTranslate;
13476			}
13477			var tmpTranslate = thisOoptions.translate;
13478			thisOoptions.translate = newTranslate;
13479			
13480			if(delay == 0) {
13481				thisOoptions.translate = newTranslate;
13482				thisOoptions.wrapper.css({
13483					'transform': 'translateX('+thisOoptions.translate+'px)',
13484				});
13485			} else {
13486				if(step === undefined) {
13487					step = 1;
13488				}
13489				thisOoptions.timerMoveDirect = setInterval(
13490					function() {
13491						thisOoptions.wrapper.css({
13492							'transform': 'translateX('+tmpTranslate+'px)',
13493						});
13494						
13495						if( (distance < 0 && tmpTranslate <= newTranslate) || (distance > 0 && tmpTranslate >= newTranslate) ) {
13496							thisOoptions.initTabs();
13497							clearInterval(thisOoptions.timerMoveDirect);
13498						}
13499
13500						if(tmpTranslate < newTranslate) {
13501							tmpTranslate += step;
13502						} else {
13503							tmpTranslate -= step;
13504						}
13505					},
13506					delay
13507				);
13508			}
13509			
13510			thisOoptions.checkArrows(newTranslate);
13511		};
13512		
13513		thisOoptions.addArrowsEvents = function() {
13514            if (!isTouch) {
13515                thisOoptions.arrows.arrow_right.on('mouseenter', function () {
13516                    thisOoptions.arrows.arrow_left.removeClass('disabled');
13517                    thisOoptions.timerMoveLeft = setInterval(
13518                      function () {
13519                          if (thisOoptions.translate < thisOoptions.minTranslate) {
13520                              clearInterval(thisOoptions.timerMoveLeft);
13521                              thisOoptions.arrows.arrow_right.addClass('disabled');
13522                          } else {
13523                              thisOoptions.translate -= thisOoptions.translateSpeed;
13524                              thisOoptions.wrapper.css({
13525                                  'transform': 'translateX(' + thisOoptions.translate + 'px)',
13526                              });
13527                          }
13528                      },
13529                      10
13530                      );
13531                });
13532
13533                thisOoptions.arrows.arrow_right.on('mouseleave', function () {
13534                    clearInterval(thisOoptions.timerMoveLeft);
13535                });
13536
13537                thisOoptions.arrows.arrow_left.on('mouseenter', function () {
13538                    thisOoptions.arrows.arrow_right.removeClass('disabled');
13539                    thisOoptions.timerMoveRight = setInterval(
13540                      function () {
13541                          if (thisOoptions.translate >= thisOoptions.maxTranslate) {
13542                              clearInterval(thisOoptions.timerMoveRight);
13543                              thisOoptions.arrows.arrow_left.addClass('disabled');
13544                          } else {
13545                              thisOoptions.translate += thisOoptions.translateSpeed;
13546                              thisOoptions.wrapper.css({
13547                                  'transform': 'translateX(' + thisOoptions.translate + 'px)',
13548                              });
13549                          }
13550                      },
13551                      10
13552                      );
13553                });
13554                
13555                thisOoptions.arrows.arrow_left.on('mouseleave', function() {
13556                    clearInterval(thisOoptions.timerMoveRight);
13557                });
13558            }			
13559
13560			thisOoptions.arrows.arrow_right.on('click', function() {
13561				thisOoptions.directScroll(-thisOoptions.directTranslate);
13562				thisOoptions.arrows.arrow_left.removeClass('disabled');
13563			});
13564
13565			thisOoptions.arrows.arrow_right.on('touchend', function() {
13566				setTimeout(function() {
13567					clearInterval(thisOoptions.timerMoveLeft);
13568				}, 1);
13569			});
13570
13571			thisOoptions.arrows.arrow_left.on('click', function() {
13572				thisOoptions.directScroll(thisOoptions.directTranslate);
13573				thisOoptions.arrows.arrow_right.removeClass('disabled');
13574			});
13575
13576			thisOoptions.arrows.arrow_left.on('touchend', function() {
13577				setTimeout(function() {
13578					clearInterval(thisOoptions.timerMoveRight);
13579				}, 1);
13580			});
13581		};
13582
13583		thisOoptions.addTabsEvents = function() {
13584			thisOoptions.tabs.on('click', function() {
13585				var leftScrollBound = thisOoptions.scrollBounds.left;
13586				var rightScrollBound = thisOoptions.scrollBounds.right;
13587
13588				var tabBounds = this.getBoundingClientRect();
13589				var leftTabScrollBound = tabBounds.left - thisOoptions.arrows.arrow_width;
13590				var rightTabScrollBound = tabBounds.right + thisOoptions.arrows.arrow_width;
13591
13592				if(leftTabScrollBound < leftScrollBound) {
13593					thisOoptions.directScroll(leftScrollBound - leftTabScrollBound, 1, 2);
13594				} else if(rightTabScrollBound > rightScrollBound) {
13595					thisOoptions.directScroll(rightScrollBound - rightTabScrollBound, 1, 2);
13596				}
13597
13598				thisOoptions.activeTab = $(this);
13599
13600				if(thisOoptions.linked_options !== undefined) {
13601					var this_index = $(this).index();
13602					var linked_tab = $(thisOoptions.linked_options.tabs[this_index]);
13603					var linked_tabs = {
13604						leftScrollBound: thisOoptions.linked_options.scrollBounds.left,
13605						rightScrollBound: thisOoptions.linked_options.scrollBounds.right,
13606						tabBounds: linked_tab[0].getBoundingClientRect(),
13607					};
13608					if(linked_tabs.tabBounds.left < linked_tabs.leftScrollBound) {
13609						thisOoptions.linked_options.directScroll(linked_tabs.leftScrollBound - linked_tabs.tabBounds.left + thisOoptions.linked_options.arrows.arrow_width + 1, 0);
13610					} else if(linked_tabs.tabBounds.right > linked_tabs.rightScrollBound) {
13611						thisOoptions.linked_options.directScroll(linked_tabs.rightScrollBound - linked_tabs.tabBounds.right - thisOoptions.linked_options.arrows.arrow_width - 1, 0);
13612					}
13613
13614					thisOoptions.linked_options.activeTab = linked_tab;
13615				}
13616
13617				
13618			});
13619		};
13620
13621		thisOoptions.addWrapperEvents = function() {
13622			thisOoptions.wrapper.on('touchstart', function(event) {
13623				thisOoptions.touch.posPrev = event.originalEvent.changedTouches[0].pageX;
13624				clearInterval(thisOoptions.timerMoveRight);
13625				clearInterval(thisOoptions.timerMoveLeft);
13626				clearInterval(thisOoptions.timerMoveDirect);
13627			});
13628
13629			thisOoptions.wrapper.on('touchmove', function(event) {
13630				thisOoptions.touch.posCurrent = event.originalEvent.changedTouches[0].pageX - thisOoptions.touch.posPrev;
13631				thisOoptions.directScroll(thisOoptions.touch.posCurrent, 0);
13632				thisOoptions.touch.posPrev = event.originalEvent.changedTouches[0].pageX;
13633			});
13634		};
13635
13636		thisOoptions.resize = function(){
13637			if(thisOoptions.onBeforeResize && typeof(thisOoptions.onBeforeResize) == 'function') {
13638				thisOoptions.onBeforeResize(thisOoptions);
13639			}
13640
13641			if(thisOoptions.onResize && typeof(thisOoptions.onResize) == 'function') {
13642				thisOoptions.onResize(thisOoptions);
13643			}
13644
13645			if(thisOoptions.translate < thisOoptions.minTranslate) {
13646				thisOoptions.directScroll(thisOoptions.minTranslate - thisOoptions.translate);
13647			} else if(thisOoptions.translate > thisOoptions.maxTranslate) {
13648				thisOoptions.directScroll(thisOoptions.maxTranslate - thisOoptions.translate);
13649			}
13650
13651			if( thisOoptions.activeTab !== undefined && thisOoptions.activeTab.length ) {
13652				var activeTabBounds = thisOoptions.activeTab[0].getBoundingClientRect();
13653				if(activeTabBounds.left < thisOoptions.scrollBounds.left) {
13654					thisOoptions.directScroll(thisOoptions.scrollBounds.left - activeTabBounds.left);
13655				} else if(activeTabBounds.right > thisOoptions.scrollBounds.right) {
13656					thisOoptions.directScroll(thisOoptions.scrollBounds.right - activeTabBounds.right);
13657				}
13658			}
13659
13660			thisOoptions.initTabs();
13661			thisOoptions.checkArrows();
13662
13663			if(thisOoptions.onAfterResize && typeof(thisOoptions.onAfterResize) == 'function') {
13664				thisOoptions.onAfterResize(thisOoptions);
13665			}
13666		};
13667
13668
13669		_scrollTab.data('scrollTabOptions', thisOoptions );
13670		_scrollTab.data('scrollTabOptions').addArrowsEvents();
13671		_scrollTab.data('scrollTabOptions').addTabsEvents();
13672		_scrollTab.data('scrollTabOptions').addWrapperEvents();
13673		_scrollTab.addClass('arrow_scroll_init').addClass('swipeignore');
13674		if (arrow_right !== undefined && arrow_right.length) {
13675			thisOoptions.arrows.arrow_width = thisOoptions.arrows.arrow_right[0].getBoundingClientRect().width;
13676		}
13677		_scrollTab.data('scrollTabOptions').resize();
13678		delete thisOoptions;
13679	}
13680
13681	var options = $.extend({
13682		translate: 1,
13683		translateSpeed: 2,
13684		directTranslate: 150,
13685		maxTranslate: 1,
13686		touch: {},
13687		arrows_css: false,
13688		tabs_wrapper: '.nav-tabs',
13689		onResize: false,
13690		width_grow: 9,
13691	}, options);
13692
13693	var el = $(this);
13694
13695	if(el.hasClass('arrow_scroll_init'))
13696		return false;
13697
13698	el.each(function(i, scrollTab){
13699		_scrollTab(scrollTab, options);
13700	});
13701}
13702/* End */
13703;
13704; /* Start:"a:4:{s:4:"full";s:59:"/bitrix/templates/aspro-allcorp2/js/custom.js?1718280873100";s:6:"source";s:45:"/bitrix/templates/aspro-allcorp2/js/custom.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13705/*
13706You can use this file with your scripts.
13707It will not be overwritten when you upgrade solution.
13708*/
13709/* End */
13710;
13711; /* Start:"a:4:{s:4:"full";s:103:"/bitrix/templates/aspro-allcorp2/components/bitrix/news.list/front-cases-custom/script.js?1718280866534";s:6:"source";s:89:"/bitrix/templates/aspro-allcorp2/components/bitrix/news.list/front-cases-custom/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13712$(document).ready(function(){
13713	if(BX.browser.IsIE9() && BX.browser.IsIE())
13714	{
13715		$('.news_block.portfolio .items').each(function(){
13716			if($(this).find('.s_1').length || $(this).find('.s_2').length)
13717			{
13718				var item_block = $(this).find('.item.sliced:last');
13719				$(this).find('.item.sliced').sliceHeight({item: item_block});
13720			}
13721			else
13722			{
13723				$(this).find('.item').sliceHeight({callback: setCustomHeight});
13724			}
13725		})
13726	}
13727});
13728
13729setCustomHeight = function(){
13730	$('.news_block .items .custom > .item').sliceHeight();
13731}
13732/* End */
13733;
13734; /* Start:"a:4:{s:4:"full";s:63:"/bitrix/components/bitrix/search.title/script.js?17182807699847";s:6:"source";s:48:"/bitrix/components/bitrix/search.title/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13735function JCTitleSearch(arParams)
13736{
13737	var _this = this;
13738
13739	this.arParams = {
13740		'AJAX_PAGE': arParams.AJAX_PAGE,
13741		'CONTAINER_ID': arParams.CONTAINER_ID,
13742		'INPUT_ID': arParams.INPUT_ID,
13743		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
13744	};
13745	if(arParams.WAIT_IMAGE)
13746		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
13747	if(arParams.MIN_QUERY_LEN <= 0)
13748		arParams.MIN_QUERY_LEN = 1;
13749
13750	this.cache = [];
13751	this.cache_key = null;
13752
13753	this.startText = '';
13754	this.running = false;
13755	this.runningCall = false;
13756	this.currentRow = -1;
13757	this.RESULT = null;
13758	this.CONTAINER = null;
13759	this.INPUT = null;
13760	this.WAIT = null;
13761
13762	this.ShowResult = function(result)
13763	{
13764		if(BX.type.isString(result))
13765		{
13766			_this.RESULT.innerHTML = result;
13767		}
13768
13769		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
13770		var pos = _this.adjustResultNode();
13771
13772		//adjust left column to be an outline
13773		var res_pos;
13774		var th;
13775		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
13776		if(tbl)
13777		{
13778			th = BX.findChild(tbl, {'tag':'th'}, true);
13779		}
13780
13781		if(th)
13782		{
13783			var tbl_pos = BX.pos(tbl);
13784			tbl_pos.width = tbl_pos.right - tbl_pos.left;
13785
13786			var th_pos = BX.pos(th);
13787			th_pos.width = th_pos.right - th_pos.left;
13788			th.style.width = th_pos.width + 'px';
13789
13790			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
13791
13792			//Move table to left by width of the first column
13793			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
13794
13795			//Shrink table when it's too wide
13796			if((tbl_pos.width - th_pos.width) > pos.width)
13797				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
13798
13799			//Check if table is too wide and shrink result div to it's width
13800			tbl_pos = BX.pos(tbl);
13801			res_pos = BX.pos(_this.RESULT);
13802			if(res_pos.right > tbl_pos.right)
13803			{
13804				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
13805			}
13806		}
13807
13808		var fade;
13809		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
13810		if(fade && th)
13811		{
13812			res_pos = BX.pos(_this.RESULT);
13813			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
13814			fade.style.width = 18 + 'px';
13815			fade.style.top = 0 + 'px';
13816			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
13817			fade.style.display = 'block';
13818		}
13819	};
13820
13821	this.onKeyPress = function(keyCode)
13822	{
13823		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
13824		if(!tbl)
13825			return false;
13826
13827		var i;
13828		var cnt = tbl.rows.length;
13829
13830		switch (keyCode)
13831		{
13832		case 27: // escape key - close search div
13833			_this.RESULT.style.display = 'none';
13834			_this.currentRow = -1;
13835			_this.UnSelectAll();
13836		return true;
13837
13838		case 40: // down key - navigate down on search results
13839			if(_this.RESULT.style.display == 'none')
13840				_this.RESULT.style.display = 'block';
13841
13842			var first = -1;
13843			for(i = 0; i < cnt; i++)
13844			{
13845				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
13846				{
13847					if(first == -1)
13848						first = i;
13849
13850					if(_this.currentRow < i)
13851					{
13852						_this.currentRow = i;
13853						break;
13854					}
13855					else if(tbl.rows[i].className == 'title-search-selected')
13856					{
13857						tbl.rows[i].className = '';
13858					}
13859				}
13860			}
13861
13862			if(i == cnt && _this.currentRow != i)
13863				_this.currentRow = first;
13864
13865			tbl.rows[_this.currentRow].className = 'title-search-selected';
13866		return true;
13867
13868		case 38: // up key - navigate up on search results
13869			if(_this.RESULT.style.display == 'none')
13870				_this.RESULT.style.display = 'block';
13871
13872			var last = -1;
13873			for(i = cnt-1; i >= 0; i--)
13874			{
13875				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
13876				{
13877					if(last == -1)
13878						last = i;
13879
13880					if(_this.currentRow > i)
13881					{
13882						_this.currentRow = i;
13883						break;
13884					}
13885					else if(tbl.rows[i].className == 'title-search-selected')
13886					{
13887						tbl.rows[i].className = '';
13888					}
13889				}
13890			}
13891
13892			if(i < 0 && _this.currentRow != i)
13893				_this.currentRow = last;
13894
13895			tbl.rows[_this.currentRow].className = 'title-search-selected';
13896		return true;
13897
13898		case 13: // enter key - choose current search result
13899			if(_this.RESULT.style.display == 'block')
13900			{
13901				for(i = 0; i < cnt; i++)
13902				{
13903					if(_this.currentRow == i)
13904					{
13905						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
13906						{
13907							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
13908							if(a)
13909							{
13910								window.location = a.href;
13911								return true;
13912							}
13913						}
13914					}
13915				}
13916			}
13917		return false;
13918		}
13919
13920		return false;
13921	};
13922
13923	this.onTimeout = function()
13924	{
13925		_this.onChange(function(){
13926			setTimeout(_this.onTimeout, 500);
13927		});
13928	};
13929
13930	this.onChange = function(callback)
13931	{
13932		if (_this.running)
13933		{
13934			_this.runningCall = true;
13935			return;
13936		}
13937		_this.running = true;
13938
13939		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
13940		{
13941			_this.oldValue = _this.INPUT.value;
13942			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
13943			{
13944				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
13945				if(_this.cache[_this.cache_key] == null)
13946				{
13947					if(_this.WAIT)
13948					{
13949						var pos = BX.pos(_this.INPUT);
13950						var height = (pos.bottom - pos.top)-2;
13951						_this.WAIT.style.top = (pos.top+1) + 'px';
13952						_this.WAIT.style.height = height + 'px';
13953						_this.WAIT.style.width = height + 'px';
13954						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
13955						_this.WAIT.style.display = 'block';
13956					}
13957
13958					BX.ajax.post(
13959						_this.arParams.AJAX_PAGE,
13960						{
13961							'ajax_call':'y',
13962							'INPUT_ID':_this.arParams.INPUT_ID,
13963							'q':_this.INPUT.value,
13964							'l':_this.arParams.MIN_QUERY_LEN
13965						},
13966						function(result)
13967						{
13968							_this.cache[_this.cache_key] = result;
13969							_this.ShowResult(result);
13970							_this.currentRow = -1;
13971							_this.EnableMouseEvents();
13972							if(_this.WAIT)
13973								_this.WAIT.style.display = 'none';
13974							if (!!callback)
13975								callback();
13976							_this.running = false;
13977							if (_this.runningCall)
13978							{
13979								_this.runningCall = false;
13980								_this.onChange();
13981							}
13982						}
13983					);
13984					return;
13985				}
13986				else
13987				{
13988					_this.ShowResult(_this.cache[_this.cache_key]);
13989					_this.currentRow = -1;
13990					_this.EnableMouseEvents();
13991				}
13992			}
13993			else
13994			{
13995				_this.RESULT.style.display = 'none';
13996				_this.currentRow = -1;
13997				_this.UnSelectAll();
13998			}
13999		}
14000		if (!!callback)
14001			callback();
14002		_this.running = false;
14003	};
14004
14005	this.onScroll = function ()
14006	{
14007		if(BX.type.isElementNode(_this.RESULT)
14008			&& _this.RESULT.style.display !== "none"
14009			&& _this.RESULT.innerHTML !== ''
14010		)
14011		{
14012			_this.adjustResultNode();
14013		}
14014	};
14015
14016	this.UnSelectAll = function()
14017	{
14018		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
14019		if(tbl)
14020		{
14021			var cnt = tbl.rows.length;
14022			for(var i = 0; i < cnt; i++)
14023				tbl.rows[i].className = '';
14024		}
14025	};
14026
14027	this.EnableMouseEvents = function()
14028	{
14029		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
14030		if(tbl)
14031		{
14032			var cnt = tbl.rows.length;
14033			for(var i = 0; i < cnt; i++)
14034				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
14035				{
14036					tbl.rows[i].id = 'row_' + i;
14037					tbl.rows[i].onmouseover = function (e) {
14038						if(_this.currentRow != this.id.substr(4))
14039						{
14040							_this.UnSelectAll();
14041							this.className = 'title-search-selected';
14042							_this.currentRow = this.id.substr(4);
14043						}
14044					};
14045					tbl.rows[i].onmouseout = function (e) {
14046						this.className = '';
14047						_this.currentRow = -1;
14048					};
14049				}
14050		}
14051	};
14052
14053	this.onFocusLost = function(hide)
14054	{
14055		setTimeout(function(){_this.RESULT.style.display = 'none';}, 250);
14056	};
14057
14058	this.onFocusGain = function()
14059	{
14060		if(_this.RESULT.innerHTML.length)
14061			_this.ShowResult();
14062	};
14063
14064	this.onKeyDown = function(e)
14065	{
14066		if(!e)
14067			e = window.event;
14068
14069		if (_this.RESULT.style.display == 'block')
14070		{
14071			if(_this.onKeyPress(e.keyCode))
14072				return BX.PreventDefault(e);
14073		}
14074	};
14075
14076	this.adjustResultNode = function()
14077	{
14078		if(!(BX.type.isElementNode(_this.RESULT)
14079			&& BX.type.isElementNode(_this.CONTAINER))
14080		)
14081		{
14082			return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
14083		}
14084
14085		var pos = BX.pos(_this.CONTAINER);
14086
14087		_this.RESULT.style.position = 'absolute';
14088		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
14089		_this.RESULT.style.left = pos.left + 'px';
14090		_this.RESULT.style.width = pos.width + 'px';
14091
14092		return pos;
14093	};
14094
14095	this._onContainerLayoutChange = function()
14096	{
14097		if(BX.type.isElementNode(_this.RESULT)
14098			&& _this.RESULT.style.display !== "none"
14099			&& _this.RESULT.innerHTML !== ''
14100		)
14101		{
14102			_this.adjustResultNode();
14103		}
14104	};
14105	this.Init = function()
14106	{
14107		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
14108		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
14109
14110		this.RESULT = document.body.appendChild(document.createElement("DIV"));
14111		this.RESULT.className = 'title-search-result';
14112		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
14113		this.startText = this.oldValue = this.INPUT.value;
14114		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
14115		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
14116		this.INPUT.onkeydown = this.onKeyDown;
14117
14118		if(this.arParams.WAIT_IMAGE)
14119		{
14120			this.WAIT = document.body.appendChild(document.createElement("DIV"));
14121			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
14122			if(!BX.browser.IsIE())
14123				this.WAIT.style.backgroundRepeat = 'none';
14124			this.WAIT.style.display = 'none';
14125			this.WAIT.style.position = 'absolute';
14126			this.WAIT.style.zIndex = '1100';
14127		}
14128
14129		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
14130
14131		var fixedParent = BX.findParent(this.CONTAINER, BX.is_fixed);
14132		if(BX.type.isElementNode(fixedParent))
14133		{
14134			BX.bind(window, 'scroll', BX.throttle(this.onScroll, 100, this));
14135		}
14136	};
14137	BX.ready(function (){_this.Init(arParams)});
14138}
14139
14140/* End */
14141;
14142; /* Start:"a:4:{s:4:"full";
14142s:95:"/bitrix/templates/aspro-allcorp2/components/bitrix/search.title/fixed/script.js?171828086310017";s:6:"source";s:79:"/bitrix/templates/aspro-allcorp2/components/bitrix/search.title/fixed/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
14143function JCTitleSearch2(arParams)
14144{
14145	var _this = this;
14146
14147	this.arParams = {
14148		'AJAX_PAGE': arParams.AJAX_PAGE,
14149		'CONTAINER_ID': arParams.CONTAINER_ID,
14150		'INPUT_ID': arParams.INPUT_ID,
14151		'INPUT_ID_TMP': arParams.INPUT_ID_TMP,
14152		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
14153	};
14154
14155	if(arParams.WAIT_IMAGE)
14156		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
14157	if(arParams.MIN_QUERY_LEN <= 0)
14158		arParams.MIN_QUERY_LEN = 1;
14159
14160	this.cache = [];
14161	this.cache_key = null;
14162
14163	this.startText = '';
14164	this.running = false;
14165	this.needRunAgain = false;
14166	this.currentRow = -1;
14167	this.RESULT = null;
14168	this.CONTAINER = null;
14169	this.INPUT = null;
14170	this.WAIT = null;
14171
14172	this.ShowResult = function(result)
14173	{
14174		if(BX.type.isString(result))
14175		{
14176			_this.RESULT.innerHTML = result;
14177		}
14178
14179		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
14180		var pos = _this.adjustResultNode();
14181
14182		//adjust left column to be an outline
14183		var res_pos;
14184		var th;
14185		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
14186		if(tbl)
14187		{
14188			th = BX.findChild(tbl, {'tag':'th'}, true);
14189		}
14190		if(th)
14191		{
14192			var tbl_pos = BX.pos(tbl);
14193			tbl_pos.width = tbl_pos.right - tbl_pos.left;
14194
14195			var th_pos = BX.pos(th);
14196			th_pos.width = th_pos.right - th_pos.left;
14197			th.style.width = th_pos.width + 'px';
14198
14199			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
14200
14201			//Move table to left by width of the first column
14202			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
14203
14204			//Shrink table when it's too wide
14205			if((tbl_pos.width - th_pos.width) > pos.width)
14206				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
14207
14208			//Check if table is too wide and shrink result div to it's width
14209			tbl_pos = BX.pos(tbl);
14210			res_pos = BX.pos(_this.RESULT);
14211			if(res_pos.right > tbl_pos.right)
14212			{
14213				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
14214			}
14215		}
14216
14217		var fade;
14218		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
14219		if(fade && th)
14220		{
14221			res_pos = BX.pos(_this.RESULT);
14222			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
14223			fade.style.width = 18 + 'px';
14224			fade.style.top = 0 + 'px';
14225			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
14226			fade.style.display = 'block';
14227		}
14228	};
14229
14230	this.onKeyPress = function(keyCode)
14231	{
14232		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
14233		if(!tbl)
14234			return false;
14235
14236		var i;
14237		var cnt = tbl.rows.length;
14238
14239		switch (keyCode)
14240		{
14241		case 27: // escape key - close search div
14242			_this.RESULT.style.display = 'none';
14243			_this.currentRow = -1;
14244			_this.UnSelectAll();
14245		return true;
14246
14247		case 40: // down key - navigate down on search results
14248			if(_this.RESULT.style.display == 'none')
14249				_this.RESULT.style.display = 'block';
14250
14251			var first = -1;
14252			for(i = 0; i < cnt; i++)
14253			{
14254				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
14255				{
14256					if(first == -1)
14257						first = i;
14258
14259					if(_this.currentRow < i)
14260					{
14261						_this.currentRow = i;
14262						break;
14263					}
14264					else if(tbl.rows[i].className == 'title-search-selected')
14265					{
14266						tbl.rows[i].className = '';
14267					}
14268				}
14269			}
14270
14271			if(i == cnt && _this.currentRow != i)
14272				_this.currentRow = first;
14273
14274			tbl.rows[_this.currentRow].className = 'title-search-selected';
14275		return true;
14276
14277		case 38: // up key - navigate up on search results
14278			if(_this.RESULT.style.display == 'none')
14279				_this.RESULT.style.display = 'block';
14280
14281			var last = -1;
14282			for(i = cnt-1; i >= 0; i--)
14283			{
14284				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
14285				{
14286					if(last == -1)
14287						last = i;
14288
14289					if(_this.currentRow > i)
14290					{
14291						_this.currentRow = i;
14292						break;
14293					}
14294					else if(tbl.rows[i].className == 'title-search-selected')
14295					{
14296						tbl.rows[i].className = '';
14297					}
14298				}
14299			}
14300
14301			if(i < 0 && _this.currentRow != i)
14302				_this.currentRow = last;
14303
14304			tbl.rows[_this.currentRow].className = 'title-search-selected';
14305		return true;
14306
14307		case 13: // enter key - choose current search result
14308			if(_this.RESULT.style.display == 'block')
14309			{
14310				for(i = 0; i < cnt; i++)
14311				{
14312					if(_this.currentRow == i)
14313					{
14314						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
14315						{
14316							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
14317							if(a)
14318							{
14319								window.location = a.href;
14320								return true;
14321							}
14322						}
14323					}
14324				}
14325			}
14326		return false;
14327		}
14328
14329		return false;
14330	};
14331
14332	this.onTimeout = function()
14333	{
14334		_this.onChange(function(){
14335			setTimeout(_this.onTimeout, 500);
14336		});
14337	};
14338
14339	this.onChange = function(callback)
14340	{
14341		if (_this.running){
14342			_this.needRunAgain = true;
14343			return;
14344		}
14345		_this.running = true;
14346
14347		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
14348		{
14349			_this.oldValue = _this.INPUT.value;
14350			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
14351			{
14352				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
14353				if(_this.cache[_this.cache_key] == null)
14354				{
14355					if(_this.WAIT)
14356					{
14357						var pos = BX.pos(_this.INPUT);
14358						var height = (pos.bottom - pos.top)-2;
14359						_this.WAIT.style.top = (pos.top+1) + 'px';
14360						_this.WAIT.style.height = height + 'px';
14361						_this.WAIT.style.width = height + 'px';
14362						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
14363						_this.WAIT.style.display = 'block';
14364					}
14365
14366					BX.ajax.post(
14367						_this.arParams.AJAX_PAGE,
14368						{
14369							'ajax_call':'y',
14370							'INPUT_ID':_this.arParams.INPUT_ID_TMP,
14371							'q':_this.INPUT.value,
14372							'l':_this.arParams.MIN_QUERY_LEN
14373						},
14374						function(result)
14375						{
14376							_this.cache[_this.cache_key] = result;
14377							_this.ShowResult(result);
14378							_this.currentRow = -1;
14379							_this.EnableMouseEvents();
14380							if(_this.WAIT)
14381								_this.WAIT.style.display = 'none';
14382							if (!!callback)
14383								callback();
14384							_this.running = false;
14385
14386							if(_this.needRunAgain){
14387								_this.needRunAgain = false;
14388								_this.onChange(callback);
14389							}
14390						}
14391					);
14392					return;
14393				}
14394				else
14395				{
14396					_this.ShowResult(_this.cache[_this.cache_key]);
14397					_this.currentRow = -1;
14398					_this.EnableMouseEvents();
14399				}
14400			}
14401			else
14402			{
14403				_this.RESULT.style.display = 'none';
14404				_this.currentRow = -1;
14405				_this.UnSelectAll();
14406			}
14407		}
14408		if (!!callback)
14409			callback();
14410		_this.running = false;
14411	};
14412
14413	this.UnSelectAll = function()
14414	{
14415		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
14416		if(tbl)
14417		{
14418			var cnt = tbl.rows.length;
14419			for(var i = 0; i < cnt; i++)
14420				tbl.rows[i].className = '';
14421		}
14422	};
14423
14424	this.EnableMouseEvents = function()
14425	{
14426		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
14427		if(tbl)
14428		{
14429			var cnt = tbl.rows.length;
14430			for(var i = 0; i < cnt; i++)
14431				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
14432				{
14433					tbl.rows[i].id = 'row_' + i;
14434					tbl.rows[i].onmouseover = function (e) {
14435						if(_this.currentRow != this.id.substr(4))
14436						{
14437							_this.UnSelectAll();
14438							this.className = 'title-search-selected';
14439							_this.currentRow = this.id.substr(4);
14440						}
14441					};
14442					tbl.rows[i].onmouseout = function (e) {
14443						this.className = '';
14444						_this.currentRow = -1;
14445					};
14446				}
14447		}
14448	};
14449
14450	this.onFocusLost = function(hide)
14451	{
14452		setTimeout(function(){_this.RESULT.style.display = 'none';}, 300);
14453		// _this.RESULT.style.display = 'none';
14454	};
14455
14456	this.onFocusGain = function()
14457	{
14458		if(_this.RESULT.innerHTML.length)
14459			_this.ShowResult();
14460	};
14461
14462	this.onKeyDown = function(e)
14463	{
14464		if(!e)
14465			e = window.event;
14466		if (_this.RESULT.style.display == 'block')
14467		{
14468			if(_this.onKeyPress(e.keyCode))
14469				return BX.PreventDefault(e);
14470		}
14471	};
14472
14473	this.adjustResultNode = function()
14474	{
14475		var pos, pos_input;
14476		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
14477		if(!!fixedParent)
14478		{
14479			_this.RESULT.style.position = 'fixed';
14480			_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
14481			pos = BX.pos(_this.CONTAINER, true);
14482		}
14483		else
14484		{
14485			_this.RESULT.style.position = 'absolute';
14486			pos = BX.pos(_this.CONTAINER);
14487		}
14488		pos_input = BX.pos(_this.INPUT);
14489
14490		pos.width = pos.right - pos.left;
14491		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
14492		_this.RESULT.style.left = pos_input.left + 'px';
14493
14494		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
14495			_this.RESULT.style.width = pos_input.width + 'px';
14496		else
14497			_this.RESULT.style.width = pos.width + 'px';
14498		return pos;
14499	};
14500
14501	this._onContainerLayoutChange = function()
14502	{
14503		if(_this.RESULT.style.display !== "none" && _this.RESULT.innerHTML !== '')
14504		{
14505			_this.adjustResultNode();
14506		}
14507	};
14508	this.Init = function()
14509	{
14510		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
14511		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
14512
14513		this.RESULT = document.body.appendChild(document.createElement("DIV"));
14514
14515		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
14516		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
14517		this.startText = this.oldValue = this.INPUT.value;
14518		BX.bind(this.INPUT, 'focus', function(e) {
14519			_this.onFocusGain()
14520		});
14521		BX.bind(this.INPUT, 'blur', function(e) {
14522			if(!$(e.relatedTarget).hasClass('bx_item_block'))
14523				_this.onFocusLost();
14524		});
14525
14526		if(BX.browser.IsSafari() || BX.browser.IsIE())
14527			this.INPUT.onkeydown = this.onKeyDown;
14528		else
14529			this.INPUT.onkeypress = this.onKeyDown;
14530
14531		if(this.arParams.WAIT_IMAGE)
14532		{
14533			this.WAIT = document.body.appendChild(document.createElement("DIV"));
14534			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
14535			if(!BX.browser.IsIE())
14536				this.WAIT.style.backgroundRepeat = 'none';
14537			this.WAIT.style.display = 'none';
14538			this.WAIT.style.position = 'absolute';
14539			this.WAIT.style.zIndex = '1100';
14540		}
14541
14542		BX.bind(this.INPUT, 'bxchange', function(e) {_this.onChange()});
14543	};
14544	BX.ready(function (){_this.Init(arParams)});
14545}
14546
14547/* End */
14548;
14549; /* Start:"a:4:{s:4:"full";s:82:"/bitrix/templates/aspro-allcorp2/js/jquery.inputmask.bundle.min.js?171828087370933";s:6:"source";
14549s:66:"/bitrix/templates/aspro-allcorp2/js/jquery.inputmask.bundle.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
14550!function(e){function t(n){if(i[n])return i[n].exports;var a=i[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var i={};t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&&Symbol.iterator,a=[i(2)],void 0!==(r="function"==typeof(n=function(e){return e})?n.apply(t,a):n)&&(e.exports=r)},function(e,t,i){"use strict";var n,a,r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};a=[i(0),i(5),i(6)],void 0!==(r="function"==typeof(n=function(e,t,i,n){function a(t,i,o){if(!(this instanceof a))return new a(t,i,o);this.el=n,this.events={},this.maskset=n,this.refreshValue=!1,!0!==o&&(e.isPlainObject(t)?i=t:(i=i||{},t&&(i.alias=t)),this.opts=e.extend(!0,{},this.defaults,i),this.noMasksCache=i&&i.definitions!==n,this.userOptions=i||{},this.isRTL=this.opts.numericInput,r(this.opts.alias,i,this.opts))}function r(t,i,o){var s=a.prototype.aliases[t];return s?(s.alias&&r(s.alias,n,o),e.extend(!0,o,s),e.extend(!0,o,i),!0):(null===o.mask&&(o.mask=t),!1)}function s(t,i){function r(t,r,o){var s=!1;if(null!==t&&""!==t||((s=null!==o.regex)?t=(t=o.regex).replace(/^(\^)(.*)(\$)$/,"$2"):(s=!0,t=".*")),1===t.length&&!1===o.greedy&&0!==o.repeat&&(o.placeholder=""),o.repeat>0||"*"===o.repeat||"+"===o.repeat){var l="*"===o.repeat?0:"+"===o.repeat?1:o.repeat;t=o.groupmarker[0]+t+o.groupmarker[1]+o.quantifiermarker[0]+l+","+o.repeat+o.quantifiermarker[1]}var u,c=s?"regex_"+o.regex:o.numericInput?t.split("").reverse().join(""):t;return a.prototype.masksCache[c]===n||!0===i?(u={mask:t,maskToken:a.prototype.analyseMask(t,s,o),validPositions:{},_buffer:n,buffer:n,tests:{},excludes:{},metadata:r,maskLength:n},!0!==i&&(a.prototype.masksCache[c]=u,u=e.extend(!0,{},a.prototype.masksCache[c]))):u=e.extend(!0,{},a.prototype.masksCache[c]),u}if(e.isFunction(t.mask)&&(t.mask=t.mask(t)),e.isArray(t.mask)){if(t.mask.length>1){if(null===t.keepStatic){t.keepStatic="auto";for(var o=0;o<t.mask.length;o++)if(t.mask[o].charAt(0)!==t.mask[0].charAt(0)){t.keepStatic=!0;break}}var s=t.groupmarker[0];return e.each(t.isRTL?t.mask.reverse():t.mask,function(i,a){s.length>1&&(s+=t.groupmarker[1]+t.alternatormarker+t.groupmarker[0]),a.mask===n||e.isFunction(a.mask)?s+=a:s+=a.mask}),r(s+=t.groupmarker[1],t.mask,t)}t.mask=t.mask.pop()}return t.mask&&t.mask.mask!==n&&!e.isFunction(t.mask.mask)?r(t.mask.mask,t.mask,t):r(t.mask,t.mask,t)}function l(e){var t=i.createElement("input"),n="on"+e,a=n in t;return a||(t.setAttribute(n,"return;"),a="function"==typeof t[n]),t=null,a}function u(r,s,c){function d(e,t,i){t=t||0;var a,r,o,s=[],l=0,u=v();do{!0===e&&h().validPositions[l]?(r=(o=h().validPositions[l]).match,a=o.locator.slice(),s.push(!0===i?o.input:!1===i?r.nativeDef:N(l,r))):(r=(o=P(l,a,l-1)).match,a=o.locator.slice(),(!1===c.jitMasking||l<u||"number"==typeof c.jitMasking&&isFinite(c.jitMasking)&&c.jitMasking>l)&&s.push(!1===i?r.nativeDef:N(l,r))),"auto"===c.keepStatic&&r.newBlockMarker&&null!==r.fn&&(c.keepStatic=l-1),l++}while(($===n||l<$)&&(null!==r.fn||""!==r.def)||t>l);return""===s[s.length-1]&&s.pop(),!1===i&&h().maskLength!==n||(h().maskLength=l-1),s}function h(){return s}function g(e){var t=h();t.buffer=n,!0!==e&&(t.validPositions={},t.p=0)}function v(e,t,i){var a=-1,r=-1,o=i||h().validPositions;e===n&&(e=-1);for(var s in o){var l=parseInt(s);o[l]&&(t||!0!==o[l].generatedInput)&&(l<=e&&(a=l),l>=e&&(r=l))}return-1!==a&&e-a>1||r<e?a:r}function k(t,i,a,r){var o,s=t,l=e.extend(!0,{},h().validPositions),u=!1;for(h().p=t,o=i-1;o>=s;
14550o--)h().validPositions[o]!==n&&(!0!==a&&(!h().validPositions[o].match.optionality&&function(e){var t=h().validPositions[e];if(t!==n&&null===t.match.fn){var i=h().validPositions[e-1],a=h().validPositions[e+1];return i!==n&&a!==n}return!1}(o)||!1===c.canClearPosition(h(),o,v(n,!0),r,c))||delete h().validPositions[o]);for(g(!0),o=s+1;o<=v();){for(;h().validPositions[s]!==n;)s++;if(o<s&&(o=s+1),h().validPositions[o]===n&&j(o))o++;else{var p=P(o);!1===u&&l[s]&&l[s].match.def===p.match.def?(h().validPositions[s]=e.extend(!0,{},l[s]),h().validPositions[s].input=p.input,delete h().validPositions[o],o++):A(s,p.match.def)?!1!==_(s,p.input||N(o),!0)&&(delete h().validPositions[o],o++,u=!0):j(o)||(o++,s--),s++}}if(!0!==r)for(o=v(-1,!0);h().validPositions[o]&&!0===h().validPositions[o].generatedInput;)delete h().validPositions[o--];g(!0)}function y(e,t,i){for(var a,r=S(e=e>0?e-1:0),o=r.alternation!==n?r.locator[r.alternation].toString().split(","):[],s=0;s<t.length&&(!((a=t[s]).match&&(c.greedy&&!0!==a.match.optionalQuantifier||(!1===a.match.optionality||!1===a.match.newBlockMarker)&&!0!==a.match.optionalQuantifier)&&(r.alternation===n||r.alternation!==a.alternation||a.locator[r.alternation]!==n&&D(a.locator[r.alternation].toString().split(","),o)))||!0===i&&(null!==a.match.fn||/[0-9a-bA-Z]/.test(a.match.def)));s++);return a}function b(e){var t=e.locator[e.alternation];return"string"==typeof t&&t.length>0&&(t=t.split(",")[0]),t!==n?t.toString():""}function x(e,t){for(var i=(e.alternation!=n?e.mloc[b(e)]:e.locator).join("");i.length<t;)i+="0";return i}function P(e,t,i){return h().validPositions[e]||y(e,C(e,t?t.slice():t,i))}function S(e){return h().validPositions[e]?h().validPositions[e]:C(e)[0]}function A(e,t){for(var i=!1,n=C(e),a=0;a<n.length;a++)if(n[a].match&&n[a].match.def===t){i=!0;break}return i}function C(t,i,a){function r(i,a,s,l){function u(s,l,p){function m(t,i){var n=0===e.inArray(t,i.matches);return n||e.each(i.matches,function(e,a){if(!0===a.isQuantifier&&(n=m(t,i.matches[e-1])))return!1}),n}function k(t,i,a){var r,o;if((h().tests[t]||h().validPositions[t])&&e.each(h().tests[t]||[h().validPositions[t]],function(e,t){if(t.mloc[i])return r=t,!1;var s=a!==n?a:t.alternation,l=t.locator[s]!==n?t.locator[s].toString().indexOf(i):-1;(o===n||l<o)&&-1!==l&&(r=t,o=l)}),r){var s=r.locator[r.alternation];return(r.mloc[i]||r.mloc[s]||r.locator).slice((a!==n?a:r.alternation)+1)}return a!==n?k(t,i):n}function y(e,t){function i(e){for(var t,i,n=[],a=0,r=e.length;a<r;a++)if("-"===e.charAt(a))for(i=e.charCodeAt(a+1);++t<i;)n.push(String.fromCharCode(t));else t=e.charCodeAt(a),n.push(e.charAt(a));return n.join("")}return c.regex&&null!==e.match.fn&&null!==t.match.fn?-1!==i(t.match.def.replace(/[\[\]]/g,"")).indexOf(i(e.match.def.replace(/[\[\]]/g,""))):e.match.def===t.match.nativeDef}function b(e,t){if(t===n||e.alternation===t.alternation&&-1===e.locator[e.alternation].toString().indexOf(t.locator[t.alternation])){e.mloc=e.mloc||{};var i=e.locator[e.alternation];if(i!==n){if("string"==typeof i&&(i=i.split(",")[0]),e.mloc[i]===n&&(e.mloc[i]=e.locator.slice()),t!==n){for(var a in t.mloc)"string"==typeof a&&(a=a.split(",")[0]),e.mloc[a]===n&&(e.mloc[a]=t.mloc[a]);e.locator[e.alternation]=Object.keys(e.mloc).join(",")}return!0}e.alternation=n}return!1}if(f>1e4)throw"Inputmask: There is probably an error in your mask definition or in the code. Create an issue on github with an example of the mask you are using. "+h().mask;if(f===t&&s.matches===n)return d.push({match:s,locator:l.reverse(),cd:v,mloc:{}}),!0;if(s.matches!==n){if(s.isGroup&&p!==s){if(s=u(i.matches[e.inArray(s,i.matches)+1],l))return!0}else if(s.isOptional){var x=s;if(s=r(s,a,l,p)){if(!m(o=d[d.length-1].match,x))return!0;g=!0,f=t}}else if(s.isAlternator){var P,S=s,A=[],C=d.slice(),M=l.length,E=a.length>0?a.shift():-1;if(-1===E||"string"==typeof E){var w,D=f,O=a.slice(),_=[];if("string"==typeof E)_=E.split(",");else for(w=0;w<S.matches.length;w++)_.push(w.toString());if(h().excludes[t]){for(var j=_.slice(),F=0,T=h().excludes[t].length;F<T;F++)_.splice(_.indexOf(h().excludes[t][F].toString()),1);0===_.length&&(h().excludes[t]=n,_=j)}(!0===c.keepStatic||isFinite(parseInt(c.keepStatic))&&D>=c.keepStatic)&&(_=_.slice(0,1));for(var R=0;R<_.length;R++){w=parseInt(_[R]),d=[],a=k(f,w,M)||O.slice(),S.matches[w]&&u(S.matches[w],[w].concat(l),p)&&(s=!0),P=d.slice(),f=D,d=[];for(var N=0;N<P.length;N++){var G=P[N],B=!1;G.alternation=G.alternation||M,b(G);for(var I=0;I<A.length;I++){var L=A[I];if("string"!=typeof E||G.alternation!==n&&-1!==e.inArray(G.locator[G.alternation].toString(),_)){if(G.match.nativeDef===L.match.nativeDef){B=!0,b(L,G);break}if(y(G,L)){b(G,L)&&(B=!0,A.splice(A.indexOf(L),0,G));break}if(y(L,G)){b(L,G);break}if(z=L,null===(U=G).match.fn&&null!==z.match.fn&&z.match.fn.test(U.match.def,h(),t,!1,c,!1)){b(G,L)&&(B=!0,A.splice(A.indexOf(L),0,G));break}}}B||A.push(G)}}d=C.concat(A),f=t,g=d.length>0,s=A.length>0,a=O.slice()}else s=u(S.matches[E]||i.matches[E],[E].concat(l),p);if(s)return!0}else if(s.isQuantifier&&p!==i.matches[e.inArray(s,i.matches)-1])for(var H=s,V=a.length>0?a.shift():0;V<(isNaN(H.quantifier.max)?V+1:H.quantifier.max)&&f<=t;V++){var K=i.matches[e.inArray(H,i.matches)-1];
14550if(s=u(K,[V].concat(l),K)){if((o=d[d.length-1].match).optionalQuantifier=V>H.quantifier.min-1,m(o,K)){if(V>H.quantifier.min-1){g=!0,f=t;break}return!0}return!0}}else if(s=r(s,a,l,p))return!0}else f++;var U,z}for(var p=a.length>0?a.shift():0;p<i.matches.length;p++)if(!0!==i.matches[p].isQuantifier){var m=u(i.matches[p],[p].concat(s),l);if(m&&f===t)return m;if(f>t)break}}var o,s,l,u,p=h().maskToken,f=i?a:0,m=i?i.slice():[0],d=[],g=!1,v=i?i.join(""):"";if(t>-1){if(i===n){for(var k,b=t-1;(k=h().validPositions[b]||h().tests[b])===n&&b>-1;)b--;k!==n&&b>-1&&(s=b,l=k,u=[],e.isArray(l)||(l=[l]),l.length>0&&(l[0].alternation===n?0===(u=y(s,l.slice()).locator.slice()).length&&(u=l[0].locator.slice()):e.each(l,function(e,t){if(""!==t.def)if(0===u.length)u=t.locator.slice();else for(var i=0;i<u.length;i++)t.locator[i]&&-1===u[i].toString().indexOf(t.locator[i])&&(u[i]+=","+t.locator[i])})),v=(m=u).join(""),f=b)}if(h().tests[t]&&h().tests[t][0].cd===v)return h().tests[t];for(var x=m.shift();x<p.length&&!(r(p[x],m,[x])&&f===t||f>t);x++);}return(0===d.length||g)&&d.push({match:{fn:null,optionality:!0,casing:null,def:"",placeholder:""},locator:[],mloc:{},cd:v}),i!==n&&h().tests[t]?e.extend(!0,[],d):(h().tests[t]=e.extend(!0,[],d),h().tests[t])}function M(){return h()._buffer===n&&(h()._buffer=d(!1,1),h().buffer===n&&(h().buffer=h()._buffer.slice())),h()._buffer}function E(e){return h().buffer!==n&&!0!==e||(h().buffer=d(!0,v(),!0)),h().buffer}function w(e,t,i){var a,r;if(!0===e)g(),e=0,t=i.length;else for(a=e;a<t;a++)delete h().validPositions[a];for(r=e,a=e;a<t;a++)if(g(!0),i[a]!==c.skipOptionalPartCharacter){var o=_(r,i[a],!0,!0);!1!==o&&(g(!0),r=o.caret!==n?o.caret:o.pos+1)}}function D(t,i,a){for(var r,o=c.greedy?i:i.slice(0,1),s=!1,l=a!==n?a.split(","):[],u=0;u<l.length;u++)-1!==(r=t.indexOf(l[u]))&&t.splice(r,1);for(var p=0;p<t.length;p++)if(-1!==e.inArray(t[p],o)){s=!0;break}return s}function O(t,i,a,r,o){var s,l,u,p,f,m,d,k=e.extend(!0,{},h().validPositions),y=!1,x=o!==n?o:v();if(-1===x&&o===n)l=(p=S(s=0)).alternation;else for(;x>=0;x--)if((u=h().validPositions[x])&&u.alternation!==n){if(p&&p.locator[u.alternation]!==u.locator[u.alternation])break;s=x,l=h().validPositions[s].alternation,p=u}if(l!==n){d=parseInt(s),h().excludes[d]=h().excludes[d]||[],!0!==t&&h().excludes[d].push(b(p));var P=[],A=0;for(f=d;f<v(n,!0)+1;f++)(m=h().validPositions[f])&&!0!==m.generatedInput&&/[0-9a-bA-Z]/.test(m.input)?P.push(m.input):f<t&&A++,delete h().validPositions[f];for(;h().excludes[d]&&h().excludes[d].length<10;){var C=-1*A,M=P.slice();for(h().tests[d]=n,g(!0),y=!0;M.length>0;){var E=M.shift();if(E!==c.skipOptionalPartCharacter&&!(y=_(v(n,!0)+1,E,!1,r,!0)))break}if(y&&i!==n){var w=v(t)+1;for(f=d;f<v()+1;f++)((m=h().validPositions[f])===n||null==m.match.fn)&&f<t+C&&C++;y=_((t+=C)>w?w:t,i,a,r,!0)}if(y)break;if(g(),p=S(d),h().validPositions=e.extend(!0,{},k),!h().excludes[d]){y=O(t,i,a,r,d-1);break}var D=b(p);if(-1!==h().excludes[d].indexOf(D)){y=O(t,i,a,r,d-1);break}for(h().excludes[d].push(D),f=d;f<v(n,!0)+1;f++)delete h().validPositions[f]}}return h().excludes[d]=n,y}function _(t,i,r,o,s,l){function u(e){return X?e.begin-e.end>1||e.begin-e.end==1:e.end-e.begin>1||e.end-e.begin==1}function p(i,r,s){var l=!1;return e.each(C(i),function(p,f){var d=f.match;if(E(!0),!1!==(l=null!=d.fn?d.fn.test(r,h(),i,s,c,u(t)):(r===d.def||r===c.skipOptionalPartCharacter)&&""!==d.def&&{c:N(i,d,!0)||d.def,pos:i})){var y=l.c!==n?l.c:r;y=y===c.skipOptionalPartCharacter&&null===d.fn?N(i,d,!0)||d.def:y;var b=i,x=E();if(l.remove!==n&&(e.isArray(l.remove)||(l.remove=[l.remove]),e.each(l.remove.sort(function(e,t){return t-e}),function(e,t){k(t,t+1,!0)})),l.insert!==n&&(e.isArray(l.insert)||(l.insert=[l.insert]),e.each(l.insert.sort(function(e,t){return e-t}),function(e,t){_(t.pos,t.c,!0,o)})),l.refreshFromBuffer){var P=l.refreshFromBuffer;if(w(!0===P?P:P.start,P.end,x),l.pos===n&&l.c===n)return l.pos=v(),!1;if((b=l.pos!==n?l.pos:i)!==i)return l=e.extend(l,_(b,y,!0,o)),!1}else if(!0!==l&&l.pos!==n&&l.pos!==i&&(b=l.pos,w(i,b,E().slice()),b!==i))return l=e.extend(l,_(b,y,!0)),!1;return(!0===l||l.pos!==n||l.c!==n)&&(p>0&&g(!0),m(b,e.extend({}
14550,f,{input:function(t,i,n){switch(c.casing||i.casing){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase();break;case"title":var r=h().validPositions[n-1];t=0===n||r&&r.input===String.fromCharCode(a.keyCode.SPACE)?t.toUpperCase():t.toLowerCase();break;default:if(e.isFunction(c.casing)){var o=Array.prototype.slice.call(arguments);o.push(h().validPositions),t=c.casing.apply(this,o)}}return t}(y,d,b)}),o,u(t))||(l=!1),!1)}}),l}function f(t,i,a){var r;if(t===n)for(t=i-1;t>0&&!h().validPositions[t];t--);for(var o=t;o<i;o++)if(h().validPositions[o]===n&&!j(o,!0)){var s=0==o?S(o):h().validPositions[o-1];if(s){var l,u=x(s),c=C(o).slice(),p=n,f=S(o);if(""===c[c.length-1].match.def&&c.pop(),e.each(c,function(e,t){l=x(t,u.length);var i=Math.abs(l-u);(p===n||i<p)&&null===t.match.fn&&!0!==t.match.optionality&&!0!==t.match.optionalQuantifier&&(p=i,f=t)}),(f=e.extend({},f,{input:N(o,f.match,!0)||f.match.def})).generatedInput=!0,m(o,f,!0),!0!==a){var d=h().validPositions[i].input;h().validPositions[i]=n,r=_(i,d,!0,!0)}}}return r}function m(t,i,a,r){if(r||c.insertMode&&h().validPositions[t]!==n&&a===n){var o,s=e.extend(!0,{},h().validPositions),l=v(n,!0);for(o=t;o<=l;o++)delete h().validPositions[o];h().validPositions[t]=e.extend(!0,{},i);var u,p=!0,m=h().validPositions,d=!1;for(o=u=t;o<=l;o++){var k=s[o];if(k!==n)for(var y=u;""!==S(y).match.def&&(null===k.match.fn&&m[o]&&(!0===m[o].match.optionalQuantifier||!0===m[o].match.optionality)||null!=k.match.fn);){if(y++,!1===d&&s[y]&&s[y].match.def===k.match.def)h().validPositions[y]=e.extend(!0,{},s[y]),h().validPositions[y].input=k.input,f(n,y,!0),u=y,p=!0;else if(A(y,k.match.def)){var b=_(y,k.input,!0,!0);p=!1!==b,u=b.caret||b.insert?v():y,d=!0}else if(!(p=!0===k.generatedInput)&&""===S(y).match.def)break;if(p)break}if(!p)break}if(!p)return h().validPositions=e.extend(!0,{},s),g(!0),!1}else h().validPositions[t]=e.extend(!0,{},i);return g(!0),!0}r=!0===r;var d=t;t.begin!==n&&(d=X&&!u(t)?t.end:t.begin);var y=!0,b=e.extend(!0,{},h().validPositions);if(e.isFunction(c.preValidation)&&!r&&!0!==o&&!0!==l&&(y=c.preValidation(E(),d,i,u(t),c)),!0===y){if(f(n,d,!0),u(t)&&(K(0,a.keyCode.DELETE,t,!0,!0),d=h().p),($===n||d<$)&&(y=p(d,i,r),(!r||!0===o)&&!1===y&&!0!==l)){var P=h().validPositions[d];if(!P||null!==P.match.fn||P.match.def!==i&&i!==c.skipOptionalPartCharacter){if((c.insertMode||h().validPositions[F(d)]===n)&&!j(d,!0))for(var M=d+1,D=F(d);M<=D;M++)if(!1!==(y=p(M,i,r))){y=f(d,y.pos!==n?y.pos:M)||y,d=M;break}}else y={caret:F(d)}}!1!==y||null===c.keepStatic||!1===c.keepStatic||r||!0===s||(y=O(d,i,r,o)),!0===y&&(y={pos:d})}if(e.isFunction(c.postValidation)&&!1!==y&&!r&&!0!==o&&!0!==l){var T=c.postValidation(E(!0),y,c);if(T!==n){if(T.refreshFromBuffer&&T.buffer){var R=T.refreshFromBuffer;w(!0===R?R:R.start,R.end,T.buffer)}y=!0===T?y:T}}return y&&y.pos===n&&(y.pos=d),!1!==y&&!0!==l||(g(!0),h().validPositions=e.extend(!0,{},b)),y}function j(e,t){var i=P(e).match;if(""===i.def&&(i=S(e).match),null!=i.fn)return i.fn;if(!0!==t&&e>-1){var n=C(e);return n.length>1+(""===n[n.length-1].match.def?1:0)}return!1}function F(e,t){for(var i=e+1;""!==S(i).match.def&&(!0===t&&(!0!==S(i).match.newBlockMarker||!j(i))||!0!==t&&!j(i));)i++;return i}function T(e,t){var i,n=e;if(n<=0)return 0;for(;--n>0&&(!0===t&&!0!==S(n).match.newBlockMarker||!0!==t&&!j(n)&&((i=C(n)).length<2||2===i.length&&""===i[1].match.def)););return n}function R(t,i,a,r,o){if(r&&e.isFunction(c.onBeforeWrite)){var s=c.onBeforeWrite.call(J,r,i,a,c);if(s){if(s.refreshFromBuffer){var l=s.refreshFromBuffer;w(!0===l?l:l.start,l.end,s.buffer||i),i=E(!0)}a!==n&&(a=s.caret!==n?s.caret:a)}}t!==n&&(t.inputmask._valueSet(i.join("")),a===n||r!==n&&"blur"===r.type?z(t,a,0===i.length):I(t,a),!0===o&&(te=!0,e(t).trigger("input")))}function N(t,i,a){if((i=i||S(t).match).placeholder!==n||!0===a)return e.isFunction(i.placeholder)?i.placeholder(c):i.placeholder;if(null===i.fn){if(t>-1&&h().validPositions[t]===n){var r,o=C(t),s=[];if(o.length>1+(""===o[o.length-1].match.def?1:0))for(var l=0;l<o.length;l++)if(!0!==o[l].match.optionality&&!0!==o[l].match.optionalQuantifier&&(null===o[l].match.fn||r===n||!1!==o[l].match.fn.test(r.match.def,h(),t,!0,c))&&(s.push(o[l]),null===o[l].match.fn&&(r=o[l]),s.length>1&&/[0-9a-bA-Z]/.test(s[0].match.def)))return c.placeholder.charAt(t%c.placeholder.length)}return i.def}return c.placeholder.charAt(t%c.placeholder.length)}function G(t,i,r,o,s){var l=o.slice(),u="",p=-1,f=n;if(g(),r||!0===c.autoUnmask)p=F(p);else{var m=M().slice(0,F(-1)).join(""),k=l.join("").match(new RegExp("^"+a.escapeRegex(m),"g"));k&&k.length>0&&(l.splice(0,k.length*m.length),p=F(p))}-1===p?(h().p=F(p),p=0):h().p=p,e.each(l,function(i,a){if(a!==n)if(h().validPositions[i]===n&&l[i]===N(i)&&j(i,!0)&&!1===_(i,l[i],!0,n,n,!0))h().p++;else{var o=new e.Event("_checkval");
14550o.which=a.charCodeAt(0),u+=a;var s=v(n,!0),m=S(s),g=P(s+1,m?m.locator.slice():n,s);if(y=p,b=u,-1===d(!0,0,!1).slice(y,F(y)).join("").indexOf(b)||j(y)||S(y).match.nativeDef!==b.charAt(0)&&(" "!==S(y).match.nativeDef||S(y+1).match.nativeDef!==b.charAt(0))||r||c.autoUnmask){var k=r?i:null==g.match.fn&&g.match.optionality&&s+1<h().p?s+1:h().p;(f=oe.keypressEvent.call(t,o,!0,!1,r,k))&&(p=k+1,u="")}else f=oe.keypressEvent.call(t,o,!0,!1,!0,s+1);R(n,E(),f.forwardPosition,o,!1)}var y,b}),i&&R(t,E(),f?f.forwardPosition:n,s||new e.Event("checkval"),s&&"input"===s.type)}function B(t){if(t){if(t.inputmask===n)return t.value;t.inputmask&&t.inputmask.refreshValue&&oe.setValueEvent.call(t)}var i=[],a=h().validPositions;for(var r in a)a[r].match&&null!=a[r].match.fn&&i.push(a[r].input);var o=0===i.length?"":(X?i.reverse():i).join("");if(e.isFunction(c.onUnMask)){var s=(X?E().slice().reverse():E()).join("");o=c.onUnMask.call(J,s,o,c)}return o}function I(a,r,o,s){function l(e){return!0===s||!X||"number"!=typeof e||c.greedy&&""===c.placeholder||(e=a.inputmask.__valueGet.call(a).length-e),e}var u;if(r===n)return a.setSelectionRange?(r=a.selectionStart,o=a.selectionEnd):t.getSelection?(u=t.getSelection().getRangeAt(0)).commonAncestorContainer.parentNode!==a&&u.commonAncestorContainer!==a||(r=u.startOffset,o=u.endOffset):i.selection&&i.selection.createRange&&(o=(r=0-(u=i.selection.createRange()).duplicate().moveStart("character",-a.inputmask._valueGet().length))+u.text.length),{begin:l(r),end:l(o)};if(e.isArray(r)&&(o=X?r[0]:r[1],r=X?r[1]:r[0]),r.begin!==n&&(o=X?r.begin:r.end,r=X?r.end:r.begin),"number"==typeof r){r=l(r),o="number"==typeof(o=l(o))?o:r;var p=parseInt(((a.ownerDocument.defaultView||t).getComputedStyle?(a.ownerDocument.defaultView||t).getComputedStyle(a,null):a.currentStyle).fontSize)*o;if(a.scrollLeft=p>a.scrollWidth?p:0,!1===c.insertMode&&r===o&&o++,a.inputmask.caretPos={begin:r,end:o},a.setSelectionRange)a.selectionStart=r,a.selectionEnd=o;else if(t.getSelection){if(u=i.createRange(),a.firstChild===n||null===a.firstChild){var f=i.createTextNode("");a.appendChild(f)}u.setStart(a.firstChild,r<a.inputmask._valueGet().length?r:a.inputmask._valueGet().length),u.setEnd(a.firstChild,o<a.inputmask._valueGet().length?o:a.inputmask._valueGet().length),u.collapse(!0);var m=t.getSelection();m.removeAllRanges(),m.addRange(u)}else a.createTextRange&&((u=a.createTextRange()).collapse(!0),u.moveEnd("character",o),u.moveStart("character",r),u.select());z(a,{begin:r,end:o})}}function L(t){var i,a,r=E(),o=r.length,s=v(),l={},u=h().validPositions[s],c=u!==n?u.locator.slice():n;for(i=s+1;i<r.length;i++)c=(a=P(i,c,i-1)).locator.slice(),l[i]=e.extend(!0,{},a);var p=u&&u.alternation!==n?u.locator[u.alternation]:n;for(i=o-1;i>s&&((a=l[i]).match.optionality||a.match.optionalQuantifier&&a.match.newBlockMarker||p&&(p!==l[i].locator[u.alternation]&&null!=a.match.fn||null===a.match.fn&&a.locator[u.alternation]&&D(a.locator[u.alternation].toString().split(","),p.toString().split(","))&&""!==C(i)[0].def))&&r[i]===N(i,a.match);i--)o--;return t?{l:o,def:l[o]?l[o].match:n}:o}function H(e){for(var t,i=L(),a=e.length,r=h().validPositions[v()];i<a&&!j(i,!0)&&(t=r!==n?P(i,r.locator.slice(""),r):S(i))&&!0!==t.match.optionality&&(!0!==t.match.optionalQuantifier&&!0!==t.match.newBlockMarker||i+1===a&&""===(r!==n?P(i+1,r.locator.slice(""),r):S(i+1)).match.def);)i++;for(;(t=h().validPositions[i-1])&&t&&t.match.optionality&&t.input===c.skipOptionalPartCharacter;)i--;return e.splice(i),e}function V(t){if(e.isFunction(c.isComplete))return c.isComplete(t,c);if("*"===c.repeat)return n;var i=!1,a=L(!0),r=T(a.l);if(a.def===n||a.def.newBlockMarker||a.def.optionality||a.def.optionalQuantifier){i=!0;for(var o=0;o<=r;o++){var s=P(o).match;if(null!==s.fn&&h().validPositions[o]===n&&!0!==s.optionality&&!0!==s.optionalQuantifier||null===s.fn&&t[o]!==N(o,s)){i=!1;break}}}return i}function K(e,t,i,r,o){if((c.numericInput||X)&&(t===a.keyCode.BACKSPACE?t=a.keyCode.DELETE:t===a.keyCode.DELETE&&(t=a.keyCode.BACKSPACE),X)){var s=i.end;i.end=i.begin,i.begin=s}if(t===a.keyCode.BACKSPACE&&(i.end-i.begin<1||!1===c.insertMode)?(i.begin=T(i.begin),h().validPositions[i.begin]!==n&&h().validPositions[i.begin].input===c.groupSeparator&&i.begin--):t===a.keyCode.DELETE&&i.begin===i.end&&(i.end=j(i.end,!0)&&h().validPositions[i.end]&&h().validPositions[i.end].input!==c.radixPoint?i.end+1:F(i.end)+1,h().validPositions[i.begin]!==n&&h().validPositions[i.begin].input===c.groupSeparator&&i.end++),k(i.begin,i.end,!1,r),!0!==r&&null!==c.keepStatic&&!1!==c.keepStatic){var l=O(!0);l&&(i.begin=l.caret!==n?l.caret:l.pos?F(l.pos.begin?l.pos.begin:l.pos):v(-1,!0))}var u=v(i.begin,!0);if(u<i.begin||-1===i.begin)h().p=F(u);else if(!0!==r&&(h().p=i.begin,!0!==o))for(;h().p<u&&h().validPositions[h().p]===n;)h().p++}function U(n){var a=(n.ownerDocument.defaultView||t).getComputedStyle(n,null),r=i.createElement("div");r.style.width=a.width,r.style.textAlign=a.textAlign,q=i.createElement("div"),n.inputmask.colorMask=q,q.className="im-colormask",n.parentNode.insertBefore(q,n),n.parentNode.removeChild(n),q.appendChild(r),q.appendChild(n),n.style.left=r.offsetLeft+"px",e(n).on("click",function(e){return I(n,function(e){var t,r=i.createElement("span");for(var o in a)isNaN(o)&&-1!==o.indexOf("font")&&(r.style[o]=a[o]);r.style.textTransform=a.textTransform,r.style.letterSpacing=a.letterSpacing,r.style.position="absolute",r.style.height="auto",r.style.width="auto",r.style.visibility="hidden",r.style.whiteSpace="nowrap",i.body.appendChild(r);var s,l=n.inputmask._valueGet(),u=0;for(t=0,s=l.length;t<=s;t++){if(r.innerHTML+=l.charAt(t)||"_",r.offsetWidth>=e){var c=e-u,p=r.offsetWidth-e;r.innerHTML=l.charAt(t),t=(c-=r.offsetWidth/3)<p?t-1:t;break}u=r.offsetWidth}return i.body.removeChild(r),t}(e.clientX)),oe.clickEvent.call(n,[e])}),e(n).on("keydown",function(e){e.shiftKey||!1===c.insertMode||setTimeout(function(){z(n)},0)})}function z(e,t,a){function r(e){if(e===n&&(e=""),p||null!==o.fn&&s.input!==n)if(p&&(null!==o.fn&&s.input!==n||""===o.def)){p=!1;var t=u.length;u[t-1]=u[t-1]+"</span>",u.push(e)}else u.push(e);else p=!0,u.push("<span class='im-static'>"+e)}var o,s,l,u=[],p=!1,f=0;if(q!==n){var m=E();if(t===n?t=I(e):t.begin===n&&(t={begin:t,end:t}),!0!==a){var d=v();
14550do{h().validPositions[f]?(s=h().validPositions[f],o=s.match,l=s.locator.slice(),r(m[f])):(s=P(f,l,f-1),o=s.match,l=s.locator.slice(),(!1===c.jitMasking||f<d||"number"==typeof c.jitMasking&&isFinite(c.jitMasking)&&c.jitMasking>f)&&r(N(f,o))),f++}while(($===n||f<$)&&(null!==o.fn||""!==o.def)||d>f||p);p&&r(),i.activeElement===e&&(u.splice(t.begin,0,t.begin===t.end?'<mark class="im-caret" style="border-right-width: 1px;border-right-style: solid;">':'<mark class="im-caret-select">'),u.splice(t.end+1,0,"</mark>"))}var g=q.getElementsByTagName("div")[0];g.innerHTML=u.join(""),e.inputmask.positionColorMask(e,g)}}s=s||this.maskset,c=c||this.opts;var Q,W,$,q,Z,J=this,Y=this.el,X=this.isRTL,ee=!1,te=!1,ie=!1,ne=!1,ae=!1,re={on:function(t,i,r){var o=function(t){var i=this;if(i.inputmask===n&&"FORM"!==this.nodeName){var o=e.data(i,"_inputmask_opts");o?new a(o).mask(i):re.off(i)}else{if("setvalue"===t.type||"FORM"===this.nodeName||!(i.disabled||i.readOnly&&!("keydown"===t.type&&t.ctrlKey&&67===t.keyCode||!1===c.tabThrough&&t.keyCode===a.keyCode.TAB))){switch(t.type){case"input":if(!0===te)return te=!1,t.preventDefault();p&&(ae=!0);break;case"keydown":ee=!1,te=!1;break;case"keypress":if(!0===ee)return t.preventDefault();ee=!0;break;case"click":if(f||m){var s=arguments;return setTimeout(function(){r.apply(i,s)},0),!1}}var l=r.apply(i,arguments);return ae&&(ae=!1,setTimeout(function(){I(i,i.inputmask.caretPos,n,!0)})),!1===l&&(t.preventDefault(),t.stopPropagation()),l}t.preventDefault()}};t.inputmask.events[i]=t.inputmask.events[i]||[],t.inputmask.events[i].push(o),-1!==e.inArray(i,["submit","reset"])?null!==t.form&&e(t.form).on(i,o):e(t).on(i,o)},off:function(t,i){var n;t.inputmask&&t.inputmask.events&&(i?(n=[])[i]=t.inputmask.events[i]:n=t.inputmask.events,e.each(n,function(i,n){for(;n.length>0;){var a=n.pop();-1!==e.inArray(i,["submit","reset"])?null!==t.form&&e(t.form).off(i,a):e(t).off(i,a)}delete t.inputmask.events[i]}))}},oe={keydownEvent:function(t){var i=this,n=e(i),r=t.keyCode,o=I(i);if(r===a.keyCode.BACKSPACE||r===a.keyCode.DELETE||m&&r===a.keyCode.BACKSPACE_SAFARI||t.ctrlKey&&r===a.keyCode.X&&!l("cut"))t.preventDefault(),K(0,r,o),R(i,E(!0),h().p,t,i.inputmask._valueGet()!==E().join("")),i.inputmask._valueGet()===M().join("")?n.trigger("cleared"):!0===V(E())&&n.trigger("complete");else if(r===a.keyCode.END||r===a.keyCode.PAGE_DOWN){t.preventDefault();var s=F(v());c.insertMode||s!==h().maskLength||t.shiftKey||s--,I(i,t.shiftKey?o.begin:s,s,!0)}else r===a.keyCode.HOME&&!t.shiftKey||r===a.keyCode.PAGE_UP?(t.preventDefault(),I(i,0,t.shiftKey?o.begin:0,!0)):(c.undoOnEscape&&r===a.keyCode.ESCAPE||90===r&&t.ctrlKey)&&!0!==t.altKey?(G(i,!0,!1,Q.split("")),n.trigger("click")):r!==a.keyCode.INSERT||t.shiftKey||t.ctrlKey?!0===c.tabThrough&&r===a.keyCode.TAB?(!0===t.shiftKey?(null===S(o.begin).match.fn&&(o.begin=F(o.begin)),o.end=T(o.begin,!0),o.begin=T(o.end,!0)):(o.begin=F(o.begin,!0),o.end=F(o.begin,!0),o.end<h().maskLength&&o.end--),o.begin<h().maskLength&&(t.preventDefault(),I(i,o.begin,o.end))):t.shiftKey||!1===c.insertMode&&(r===a.keyCode.RIGHT?setTimeout(function(){var e=I(i);I(i,e.begin)},0):r===a.keyCode.LEFT&&setTimeout(function(){var e=I(i);I(i,X?e.begin+1:e.begin-1)},0)):(c.insertMode=!c.insertMode,I(i,c.insertMode||o.begin!==h().maskLength?o.begin:o.begin-1));c.onKeyDown.call(this,t,E(),I(i).begin,c),ie=-1!==e.inArray(r,c.ignorables)},keypressEvent:function(t,i,r,o,s){var l=this,u=e(l),p=t.which||t.charCode||t.keyCode;if(!(!0===i||t.ctrlKey&&t.altKey)&&(t.ctrlKey||t.metaKey||ie))return p===a.keyCode.ENTER&&Q!==E().join("")&&(Q=E().join(""),setTimeout(function(){u.trigger("change")},0)),!0;if(p){46===p&&!1===t.shiftKey&&""!==c.radixPoint&&(p=c.radixPoint.charCodeAt(0));var f,m=i?{begin:s,end:s}:I(l),d=String.fromCharCode(p);h().writeOutBuffer=!0;var v=_(m,d,o);if(!1!==v&&(g(!0),f=v.caret!==n?v.caret:F(v.pos.begin?v.pos.begin:v.pos),h().p=f),f=c.numericInput&&v.caret===n?T(f):f,!1!==r&&(setTimeout(function(){c.onKeyValidation.call(l,p,v,c)},0),h().writeOutBuffer&&!1!==v)){var k=E();R(l,k,f,t,!0!==i),!0!==i&&setTimeout(function(){!0===V(k)&&u.trigger("complete")},0)}if(t.preventDefault(),i)return!1!==v&&(v.forwardPosition=f),v}},pasteEvent:function(i){var n,a=this,r=i.originalEvent||i,o=e(a),s=a.inputmask._valueGet(!0),l=I(a);X&&(n=l.end,l.end=l.begin,l.begin=n);var u=s.substr(0,l.begin),p=s.substr(l.end,s.length);if(u===(X?M().reverse():M()).slice(0,l.begin).join("")&&(u=""),p===(X?M().reverse():M()).slice(l.end).join("")&&(p=""),X&&(n=u,u=p,p=n),t.clipboardData&&t.clipboardData.getData)s=u+t.clipboardData.getData("Text")+p;else{if(!r.clipboardData||!r.clipboardData.getData)return!0;s=u+r.clipboardData.getData("text/plain")+p}var f=s;if(e.isFunction(c.onBeforePaste)){if(!1===(f=c.onBeforePaste.call(J,s,c)))return i.preventDefault();f||(f=s)}return G(a,!1,!1,X?f.split("").reverse():f.toString().split("")),R(a,E(),F(v()),i,Q!==E().join("")),!0===V(E())&&o.trigger("complete"),i.preventDefault()},inputFallBackEvent:function(t){var i,n,r=this,o=r.inputmask._valueGet();if(E().join("")!==o){var s=I(r);if(n=s,"."===(i=o).charAt(n.begin-1)&&""!==c.radixPoint&&((i=i.split(""))[n.begin-1]=c.radixPoint.charAt(0),i=i.join("")),o=function(e,t,i){if(f){var n=t.replace(E().join(""),"");if(1===n.length){var a=t.split("");
14550a.splice(i.begin,0,n),t=a.join("")}}return t}(0,o=i,s),E().join("")!==o){var l=E().join(""),u=o.length>l.length?-1:0,p=o.substr(0,s.begin),m=o.substr(s.begin),d=l.substr(0,s.begin+u),h=l.substr(s.begin+u),g=s,v="",k=!1;if(p!==d){for(var y=(k=p.length>=d.length)?p.length:d.length,b=0;p.charAt(b)===d.charAt(b)&&b<y;b++);k&&(0===u&&(g.begin=b),v+=p.slice(b,g.end))}if(m!==h&&(m.length>h.length?v+=m.slice(0,1):m.length<h.length&&(g.end+=h.length-m.length,k||""===c.radixPoint||""!==m||p.charAt(g.begin+u-1)!==c.radixPoint||(g.begin--,v=c.radixPoint))),R(r,E(),{begin:g.begin+u,end:g.end+u}),v.length>0)e.each(v.split(""),function(t,i){var n=new e.Event("keypress");n.which=i.charCodeAt(0),ie=!1,oe.keypressEvent.call(r,n)});else{g.begin===g.end-1&&(g.begin=T(g.begin+1),g.begin===g.end-1?I(r,g.begin):I(r,g.begin,g.end));var x=new e.Event("keydown");x.keyCode=a.keyCode.DELETE,oe.keydownEvent.call(r,x),!1===c.insertMode&&I(r,I(r).begin-1)}t.preventDefault()}}},setValueEvent:function(t){this.inputmask.refreshValue=!1;var i=this.inputmask._valueGet(!0);e.isFunction(c.onBeforeMask)&&(i=c.onBeforeMask.call(J,i,c)||i),i=i.split(""),G(this,!0,!1,X?i.reverse():i),Q=E().join(""),(c.clearMaskOnLostFocus||c.clearIncomplete)&&this.inputmask._valueGet()===M().join("")&&this.inputmask._valueSet("")},focusEvent:function(e){var t=this,i=t.inputmask._valueGet();c.showMaskOnFocus&&(!c.showMaskOnHover||c.showMaskOnHover&&""===i)&&(t.inputmask._valueGet()!==E().join("")?R(t,E(),F(v())):!1===ne&&I(t,F(v()))),!0===c.positionCaretOnTab&&!1===ne&&oe.clickEvent.apply(t,[e,!0]),Q=E().join("")},mouseleaveEvent:function(e){if(ne=!1,c.clearMaskOnLostFocus&&i.activeElement!==this){var t=E().slice(),n=this.inputmask._valueGet();n!==this.getAttribute("placeholder")&&""!==n&&(-1===v()&&n===M().join("")?t=[]:H(t),R(this,t))}},clickEvent:function(t,a){var r=this;setTimeout(function(){if(i.activeElement===r){var t=I(r);if(a&&(X?t.end=t.begin:t.begin=t.end),t.begin===t.end)switch(c.positionCaretOnClick){case"none":break;case"select":I(r,0,E().length);break;case"radixFocus":if(function(t){if(""!==c.radixPoint){var i=h().validPositions;if(i[t]===n||i[t].input===N(t)){if(t<F(-1))return!0;var a=e.inArray(c.radixPoint,E());if(-1!==a){for(var r in i)if(a<r&&i[r].input!==N(r))return!1;return!0}}}return!1}(t.begin)){var o=E().join("").indexOf(c.radixPoint);I(r,c.numericInput?F(o):o);break}default:var s=t.begin,l=v(s,!0),u=F(l);if(s<u)I(r,j(s,!0)||j(s-1,!0)?s:F(s));
14550else{var p=h().validPositions[l],f=P(u,p?p.match.locator:n,p),m=N(u,f.match);if(""!==m&&E()[u]!==m&&!0!==f.match.optionalQuantifier&&!0!==f.match.newBlockMarker||!j(u,!0)&&f.match.def===m){var d=F(u);(s>=d||s===u)&&(u=d)}I(r,u)}}}},0)},dblclickEvent:function(e){var t=this;setTimeout(function(){I(t,0,F(v()))},0)},cutEvent:function(n){var r=e(this),o=I(this),s=n.originalEvent||n,l=t.clipboardData||s.clipboardData,u=X?E().slice(o.end,o.begin):E().slice(o.begin,o.end);l.setData("text",X?u.reverse().join(""):u.join("")),i.execCommand&&i.execCommand("copy"),K(0,a.keyCode.DELETE,o),R(this,E(),h().p,n,Q!==E().join("")),this.inputmask._valueGet()===M().join("")&&r.trigger("cleared")},blurEvent:function(t){var i=e(this);if(this.inputmask){var a=this.inputmask._valueGet(),r=E().slice();""===a&&q===n||(c.clearMaskOnLostFocus&&(-1===v()&&a===M().join("")?r=[]:H(r)),!1===V(r)&&(setTimeout(function(){i.trigger("incomplete")},0),c.clearIncomplete&&(g(),r=c.clearMaskOnLostFocus?[]:M().slice())),R(this,r,n,t)),Q!==E().join("")&&(Q=r.join(""),i.trigger("change"))}},mouseenterEvent:function(e){ne=!0,i.activeElement!==this&&c.showMaskOnHover&&this.inputmask._valueGet()!==E().join("")&&R(this,E())},submitEvent:function(e){Q!==E().join("")&&W.trigger("change"),c.clearMaskOnLostFocus&&-1===v()&&Y.inputmask._valueGet&&Y.inputmask._valueGet()===M().join("")&&Y.inputmask._valueSet(""),c.removeMaskOnSubmit&&(Y.inputmask._valueSet(Y.inputmask.unmaskedvalue(),!0),setTimeout(function(){R(Y,E())},0))},resetEvent:function(e){Y.inputmask.refreshValue=!0,setTimeout(function(){W.trigger("setvalue")},0)}};if(a.prototype.positionColorMask=function(e,t){e.style.left=t.offsetLeft+"px"},r!==n)switch(r.action){case"isComplete":return Y=r.el,V(E());case"unmaskedvalue":return Y!==n&&r.value===n||(Z=r.value,Z=(e.isFunction(c.onBeforeMask)&&c.onBeforeMask.call(J,Z,c)||Z).split(""),G(n,!1,!1,X?Z.reverse():Z),e.isFunction(c.onBeforeWrite)&&c.onBeforeWrite.call(J,n,E(),0,c)),B(Y);case"mask":!function(t){re.off(t);var a=function(t,a){var r=t.getAttribute("type"),s="INPUT"===t.tagName&&-1!==e.inArray(r,a.supportsInputType)||t.isContentEditable||"TEXTAREA"===t.tagName;if(!s)if("INPUT"===t.tagName){var l=i.createElement("input");l.setAttribute("type",r),s="text"===l.type,l=null}else s="partial";return!1!==s?function(t){function r(){return this.inputmask?this.inputmask.opts.autoUnmask?this.inputmask.unmaskedvalue():-1!==v()||!0!==a.nullable?i.activeElement===this&&a.clearMaskOnLostFocus?(X?H(E().slice()).reverse():H(E().slice())).join(""):l.call(this):"":l.call(this)}function s(t){u.call(this,t),this.inputmask&&e(this).trigger("setvalue")}var l,u,c;if(!t.inputmask.__valueGet){if(!0!==a.noValuePatching){if(Object.getOwnPropertyDescriptor){"function"!=typeof Object.getPrototypeOf&&(Object.getPrototypeOf="object"===o("test".__proto__)?function(e){return e.__proto__}:function(e){return e.constructor.prototype});var p=Object.getPrototypeOf?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),"value"):n;p&&p.get&&p.set?(l=p.get,u=p.set,Object.defineProperty(t,"value",{get:r,set:s,configurable:!0})):"INPUT"!==t.tagName&&(l=function(){return this.textContent},u=function(e){this.textContent=e},Object.defineProperty(t,"value",{get:r,set:s,configurable:!0}))}else i.__lookupGetter__&&t.__lookupGetter__("value")&&(l=t.__lookupGetter__("value"),u=t.__lookupSetter__("value"),t.__defineGetter__("value",r),t.__defineSetter__("value",s));t.inputmask.__valueGet=l,t.inputmask.__valueSet=u}t.inputmask._valueGet=function(e){return X&&!0!==e?l.call(this.el).split("").reverse().join(""):l.call(this.el)},t.inputmask._valueSet=function(e,t){u.call(this.el,null===e||e===n?"":!0!==t&&X?e.split("").reverse().join(""):e)},l===n&&(l=function(){return this.value},u=function(e){this.value=e},function(t){if(e.valHooks&&(e.valHooks[t]===n||!0!==e.valHooks[t].inputmaskpatch)){var i=e.valHooks[t]&&e.valHooks[t].get?e.valHooks[t].get:function(e){return e.value},r=e.valHooks[t]&&e.valHooks[t].set?e.valHooks[t].set:function(e,t){return e.value=t,e};e.valHooks[t]={get:function(e){if(e.inputmask){if(e.inputmask.opts.autoUnmask)return e.inputmask.unmaskedvalue();var t=i(e);return-1!==v(n,n,e.inputmask.maskset.validPositions)||!0!==a.nullable?t:""}return i(e)},set:function(t,i){var n,a=e(t);return n=r(t,i),t.inputmask&&a.trigger("setvalue"),n},inputmaskpatch:!0}}}(t.type),c=t,re.on(c,"mouseenter",function(t){var i=e(this);this.inputmask._valueGet()!==E().join("")&&i.trigger("setvalue")}))}}(t):t.inputmask=n,s}(t,c);if(!1!==a&&(W=e(Y=t),-1===($=Y!==n?Y.maxLength:n)&&($=n),!0===c.colorMask&&U(Y),p&&("inputmode"in Y&&(Y.inputmode=c.inputmode,Y.setAttribute("inputmode",c.inputmode)),!0===c.disablePredictiveText&&("autocorrect"in Y?Y.autocorrect=!1:(!0!==c.colorMask&&U(Y),Y.type="password"))),!0===a&&(re.on(Y,"submit",oe.submitEvent),re.on(Y,"reset",oe.resetEvent),re.on(Y,"mouseenter",oe.mouseenterEvent),re.on(Y,"blur",oe.blurEvent),re.on(Y,"focus",oe.focusEvent),re.on(Y,"mouseleave",oe.mouseleaveEvent),!0!==c.colorMask&&re.on(Y,"click",oe.clickEvent),re.on(Y,"dblclick",oe.dblclickEvent),re.on(Y,"paste",oe.pasteEvent),re.on(Y,"dragdrop",oe.pasteEvent),re.on(Y,"drop",oe.pasteEvent),re.on(Y,"cut",oe.cutEvent),re.on(Y,"complete",c.oncomplete),re.on(Y,"incomplete",c.onincomplete),re.on(Y,"cleared",c.oncleared),p||!0===c.inputEventOnly?Y.removeAttribute("maxLength"):(re.on(Y,"keydown",oe.keydownEvent),re.on(Y,"keypress",oe.keypressEvent)),re.on(Y,"compositionstart",e.noop),re.on(Y,"compositionupdate",e.noop),re.on(Y,"compositionend",e.noop),re.on(Y,"keyup",e.noop),re.on(Y,"input",oe.inputFallBackEvent),re.on(Y,"beforeinput",e.noop)),re.on(Y,"setvalue",oe.setValueEvent),Q=M().join(""),""!==Y.inputmask._valueGet(!0)||!1===c.clearMaskOnLostFocus||i.activeElement===Y)){var r=e.isFunction(c.onBeforeMask)&&c.onBeforeMask.call(J,Y.
14550inputmask._valueGet(!0),c)||Y.inputmask._valueGet(!0);""!==r&&G(Y,!0,!1,X?r.split("").reverse():r.split(""));var s=E().slice();Q=s.join(""),!1===V(s)&&c.clearIncomplete&&g(),c.clearMaskOnLostFocus&&i.activeElement!==Y&&(-1===v()?s=[]:H(s)),R(Y,s),i.activeElement===Y&&I(Y,F(v()))}}(Y);break;case"format":return Z=(e.isFunction(c.onBeforeMask)&&c.onBeforeMask.call(J,r.value,c)||r.value).split(""),G(n,!0,!1,X?Z.reverse():Z),r.metadata?{value:X?E().slice().reverse().join(""):E().join(""),metadata:u.call(this,{action:"getmetadata"},s,c)}:X?E().slice().reverse().join(""):E().join("");case"isValid":r.value?(Z=r.value.split(""),G(n,!0,!0,X?Z.reverse():Z)):r.value=E().join("");for(var se=E(),le=L(),ue=se.length-1;ue>le&&!j(ue);ue--);return se.splice(le,ue+1-le),V(se)&&r.value===E().join("");case"getemptymask":return M().join("");case"remove":return Y&&Y.inputmask&&(W=e(Y),Y.inputmask._valueSet(c.autoUnmask?B(Y):Y.inputmask._valueGet(!0)),re.off(Y),Y.inputmask.colorMask&&((q=Y.inputmask.colorMask).removeChild(Y),q.parentNode.insertBefore(Y,q),q.parentNode.removeChild(q)),Object.getOwnPropertyDescriptor&&Object.getPrototypeOf?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Y),"value")&&Y.inputmask.__valueGet&&Object.defineProperty(Y,"value",{get:Y.inputmask.__valueGet,set:Y.inputmask.__valueSet,configurable:!0}):i.__lookupGetter__&&Y.__lookupGetter__("value")&&Y.inputmask.__valueGet&&(Y.__defineGetter__("value",Y.inputmask.__valueGet),Y.__defineSetter__("value",Y.inputmask.__valueSet)),Y.inputmask=n),Y;case"getmetadata":if(e.isArray(s.metadata)){var ce=d(!0,0,!1).join("");return e.each(s.metadata,function(e,t){if(t.mask===ce)return ce=t,!1}),ce}return s.metadata}}var c=navigator.userAgent,p=l("touchstart"),f=/iemobile/i.test(c),m=/iphone/i.test(c)&&!f;return a.prototype={dataAttribute:"data-inputmask",defaults:{placeholder:"_",optionalmarker:["[","]"],quantifiermarker:["{","}"],groupmarker:["(",")"],alternatormarker:"|",escapeChar:"\\",mask:null,regex:null,oncomplete:e.noop,onincomplete:e.noop,oncleared:e.noop,repeat:0,greedy:!0,autoUnmask:!1,removeMaskOnSubmit:!1,clearMaskOnLostFocus:!0,insertMode:!0,clearIncomplete:!1,alias:null,onKeyDown:e.noop,onBeforeMask:null,onBeforePaste:function(t,i){return e.isFunction(i.onBeforeMask)?i.onBeforeMask.call(this,t,i):t},onBeforeWrite:null,onUnMask:null,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:e.noop,skipOptionalPartCharacter:" ",numericInput:!1,rightAlign:!1,undoOnEscape:!0,radixPoint:"",radixPointDefinitionSymbol:n,groupSeparator:"",keepStatic:null,positionCaretOnTab:!0,tabThrough:!1,supportsInputType:["text","tel","password","search"],ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123,0,229],isComplete:null,canClearPosition:e.noop,preValidation:null,postValidation:null,staticDefinitionSymbol:n,jitMasking:!1,nullable:!0,inputEventOnly:!1,noValuePatching:!1,positionCaretOnClick:"lvp",casing:null,inputmode:"verbatim",colorMask:!1,disablePredictiveText:!1,importDataAttributes:!0},definitions:{9:{validator:"[0-91-9]",definitionSymbol:"*"},a:{validator:"[A-Za-zÀ-ÿ¨¸A-yµ]",definitionSymbol:"*"},"*":{validator:"[0-91-9A-Za-zÀ-ÿ¨¸A-yµ]"}},aliases:{},masksCache:{},mask:function(o){var l=this;return"string"==typeof o&&(o=i.getElementById(o)||i.querySelectorAll(o)),o=o.nodeName?[o]:o,e.each(o,function(i,o){var c=e.extend(!0,{},l.opts);if(function(i,a,o,s){if(!0===a.importDataAttributes){var l,u,c,p,f=function(e,a){null!==(a=a!==n?a:i.getAttribute(s+"-"+e))&&("string"==typeof a&&(0===e.indexOf("on")?a=t[a]:"false"===a?a=!1:"true"===a&&(a=!0)),o[e]=a)},m=i.getAttribute(s);if(m&&""!==m&&(m=m.replace(/'/g,'"'),u=JSON.parse("{"+m+"}")),u){c=n;for(p in u)if("alias"===p.toLowerCase()){c=u[p];break}}f("alias",c),o.alias&&r(o.alias,o,a);for(l in a){if(u){c=n;for(p in u)if(p.toLowerCase()===l.toLowerCase()){c=u[p];break}}f(l,c)}}return e.extend(!0,a,o),("rtl"===i.dir||a.rightAlign)&&(i.style.textAlign="right"),("rtl"===i.dir||a.numericInput)&&(i.dir="ltr",i.removeAttribute("dir"),a.isRTL=!0),Object.keys(o).length}(o,c,e.extend(!0,{},l.userOptions),l.dataAttribute)){var p=s(c,l.noMasksCache);p!==n&&(o.inputmask!==n&&(o.inputmask.opts.autoUnmask=!0,o.inputmask.remove()),o.inputmask=new a(n,n,!0),o.inputmask.opts=c,o.inputmask.noMasksCache=l.noMasksCache,o.inputmask.userOptions=e.extend(!0,{},l.userOptions),o.inputmask.isRTL=c.isRTL||c.numericInput,o.inputmask.el=o,o.inputmask.maskset=p,e.data(o,"_inputmask_opts",c),u.call(o.inputmask,{action:"mask"}))}}),o&&o[0]&&o[0].inputmask||this},option:function(t,i){return"string"==typeof t?this.opts[t]:"object"===(void 0===t?"undefined":o(t))?(e.extend(this.userOptions,t),this.el&&!0!==i&&this.mask(this.el),this):void 0},unmaskedvalue:function(e){return this.maskset=this.maskset||s(this.opts,this.noMasksCache),u.call(this,{action:"unmaskedvalue",value:e})},remove:function(){return u.call(this,{action:"remove"})},getemptymask:function(){return this.maskset=this.maskset||s(this.opts,this.noMasksCache),u.call(this,{action:"getemptymask"})},hasMaskedValue:function(){return!this.opts.autoUnmask},isComplete:function(){return this.maskset=this.maskset||s(this.opts,this.noMasksCache),u.call(this,{action:"isComplete"})},getmetadata:function(){return this.maskset=this.maskset||s(this.opts,this.noMasksCache),u.call(this,{action:"getmetadata"})},isValid:function(e){return this.maskset=this.maskset||s(this.opts,this.noMasksCache),u.call(this,{action:"isValid",value:e})},format:function(e,t){return this.maskset=this.maskset||s(this.opts,this.noMasksCache),u.call(this,{action:"format",value:e,metadata:t})},analyseMask:function(t,i,r){function o(e,t,i,n){this.matches=[],this.openGroup=e||!1,this.alternatorGroup=!1,this.isGroup=e||!1,this.isOptional=t||!1,this.isQuantifier=i||!1,this.isAlternator=n||!1,this.quantifier={min:1,max:1}}function s(t,o,s){s=s!==n?s:t.matches.length;var l=t.matches[s-1];if(i)0===o.indexOf("[")||k&&/\\d|\\s|\\w]/i.test(o)||"."===o?t.matches.splice(s++,0,{fn:new RegExp(o,r.casing?"i":""),optionality:t.isOptional,newBlockMarker:l===n||l.def!==o,casing:null,def:o,placeholder:n,nativeDef:o}):(k&&(o=o[o.length-1]),e.each(o.split(""),function(e,i){l=t.matches[s-1],t.matches.splice(s++,0,{fn:null,optionality:t.isOptional,newBlockMarker:l===n||l.def!==i&&null!==l.fn,casing:null,def:r.staticDefinitionSymbol||i,placeholder:r.staticDefinitionSymbol!==n?i:n,nativeDef:i})})),k=!1;else{var u=(r.definitions?r.definitions[o]:n)||a.prototype.definitions[o];u&&!k?t.matches.splice(s++,0,{fn:u.validator?"string"==typeof u.validator?new RegExp(u.validator,r.casing?"i":""):new function(){this.test=u.validator}:new RegExp("."),optionality:t.isOptional,newBlockMarker:l===n||l.def!==(u.definitionSymbol||o),casing:u.casing,def:u.definitionSymbol||o,placeholder:u.placeholder,nativeDef:o}):(t.matches.splice(s++,0,{fn:null,optionality:t.isOptional,newBlockMarker:l===n||l.def!==o&&null!==l.fn,casing:null,def:r.staticDefinitionSymbol||o,placeholder:r.staticDefinitionSymbol!==n?o:n,nativeDef:o}),k=!1)}}function l(){if(b.length>0){if(s(f=b[b.length-1],c),f.isAlternator){m=b.pop();for(var e=0;e<m.matches.length;e++)m.matches[e].isGroup=!1;b.length>0?(f=b[b.length-1]).matches.push(m):y.matches.push(m)}}else s(y,c)}var u,c,p,f,m,d,h,g=/(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})|[^.?*+^${[]()|\\]+|./g,v=/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,k=!1,y=new o,b=[],x=[];for(i&&(r.optionalmarker[0]=n,r.optionalmarker[1]=n);u=i?v.exec(t):g.exec(t);){if(c=u[0],i)switch(c.charAt(0)){case"?":c="{0,1}";break;case"+":case"*":c="{"+c+"}"}if(k)l();else switch(c.charAt(0)){case r.escapeChar:k=!0,i&&l();break;case r.optionalmarker[1]:case r.groupmarker[1]:if((p=b.pop()).openGroup=!1,p!==n)if(b.length>0){if((f=b[b.length-1]).matches.push(p),f.isAlternator){m=b.pop();for(var P=0;P<m.matches.length;P++)m.matches[P].isGroup=!1,m.matches[P].alternatorGroup=!1;b.length>0?(f=b[b.length-1]).matches.push(m):y.matches.push(m)}}else y.matches.push(p);else l();break;case r.optionalmarker[0]:b.push(new o(!1,!0));break;case r.groupmarker[0]:b.push(new o(!0));break;case r.quantifiermarker[0]:var S=new o(!1,!1,!0),A=(c=c.replace(/[{}]/g,"")).split(","),C=isNaN(A[0])?A[0]:parseInt(A[0]),M=1===A.length?C:isNaN(A[1])?A[1]:parseInt(A[1]);if("*"!==M&&"+"!==M||(C="*"===M?0:1),S.quantifier={min:C,max:M},b.length>0){var E=b[b.length-1].matches;(u=E.pop()).isGroup||((h=new o(!0)).matches.push(u),u=h),E.push(u),E.push(S)}else(u=y.matches.pop()).isGroup||(i&&null===u.fn&&"."===u.def&&(u.fn=new RegExp(u.def,r.casing?"i":"")),(h=new o(!0)).matches.push(u),u=h),y.matches.push(u),y.matches.push(S);break;case r.alternatormarker:if(b.length>0){var w=(f=b[b.length-1]).matches[f.matches.length-1];
14550d=f.openGroup&&(w.matches===n||!1===w.isGroup&&!1===w.isAlternator)?b.pop():f.matches.pop()}else d=y.matches.pop();if(d.isAlternator)b.push(d);else if(d.alternatorGroup?(m=b.pop(),d.alternatorGroup=!1):m=new o(!1,!1,!1,!0),m.matches.push(d),b.push(m),d.openGroup){d.openGroup=!1;var D=new o(!0);D.alternatorGroup=!0,b.push(D)}break;default:l()}}for(;b.length>0;)p=b.pop(),y.matches.push(p);return y.matches.length>0&&(function t(a){a&&a.matches&&e.each(a.matches,function(e,o){var l=a.matches[e+1];(l===n||l.matches===n||!1===l.isQuantifier)&&o&&o.isGroup&&(o.isGroup=!1,i||(s(o,r.groupmarker[0],0),!0!==o.openGroup&&s(o,r.groupmarker[1]))),t(o)})}(y),x.push(y)),(r.numericInput||r.isRTL)&&function e(t){t.matches=t.matches.reverse();for(var i in t.matches)if(t.matches.hasOwnProperty(i)){var a=parseInt(i);if(t.matches[i].isQuantifier&&t.matches[a+1]&&t.matches[a+1].isGroup){var o=t.matches[i];t.matches.splice(i,1),t.matches.splice(a+1,0,o)}t.matches[i].matches!==n?t.matches[i]=e(t.matches[i]):t.matches[i]=function(e){return e===r.optionalmarker[0]?e=r.optionalmarker[1]:e===r.optionalmarker[1]?e=r.optionalmarker[0]:e===r.groupmarker[0]?e=r.groupmarker[1]:e===r.groupmarker[1]&&(e=r.groupmarker[0]),e}(t.matches[i])}return t}(x[0]),x}},a.extendDefaults=function(t){e.extend(!0,a.prototype.defaults,t)},a.extendDefinitions=function(t){e.extend(!0,a.prototype.definitions,t)},a.extendAliases=function(t){e.extend(!0,a.prototype.aliases,t)},a.format=function(e,t,i){return a(t).format(e,i)},a.unmask=function(e,t){return a(t).unmaskedvalue(e)},a.isValid=function(e,t){return a(t).isValid(e)},a.remove=function(t){e.each(t,function(e,t){t.inputmask&&t.inputmask.remove()})},a.escapeRegex=function(e){return e.replace(new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^"].join("|\\")+")","gim"),"\\$1")},a.keyCode={BACKSPACE:8,BACKSPACE_SAFARI:127,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,RIGHT:39,SPACE:32,TAB:9,UP:38,X:88,CONTROL:17},a})?n.apply(t,a):n)&&(e.exports=r)},function(e,t){e.exports=jQuery},function(e,t,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}i(4),i(7),i(8),i(9);var a=n(i(1)),r=n(i(0)),o=n(i(2));r.default===o.default&&i(10),window.Inputmask=a.default},function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&&Symbol.iterator,a=[i(0),i(1)],void 0!==(r="function"==typeof(n=function(e,t){function i(e){if(!e.tokenizer){var t=[];for(var i in o)-1===t.indexOf(i[0])&&t.push(i[0]);e.tokenizer="("+t.join("+|")+")+?|.",e.tokenizer=new RegExp(e.tokenizer,"g")}return e.tokenizer}function n(e,n,a){for(var r,s="";r=i(a).exec(e);)void 0===n?s+=o[r[0]]?"("+o[r[0]][0]+")":t.escapeRegex(r[0]):o[r[0]]?s+=o[r[0]][3].call(n.date):s+=r[0];return s}function a(e,t){for(e=String(e),t=t||2;e.length<t;)e="0"+e;return e}function r(e,t,n){var a,r,s,l,u,c,p,f,m={date:new Date(1,0,1)},d=e;if("string"==typeof d){for(;r=i(n).exec(t);){var h=d.slice(0,r[0].length);o.hasOwnProperty(r[0])&&(a=o[r[0]][2],s=o[r[0]][1],l=m,u=h,c=n,p=void 0,f=void 0,"year"===a?(l[a]=(f=4===(p=u).length?p:(new Date).getFullYear().toString().substr(0,4-p.length)+p,n.min&&n.min.year&&n.max&&n.max.year?(f=f.replace(/[^0-9]/g,""),f=p.charAt(0)===n.max.year.charAt(0)?p.replace(/[^0-9]/g,"0"):f+n.min.year.substr(f.length)):f=f.replace(/[^0-9]/g,"0"),f),l["raw"+a]=u):l[a]=c.min&&u.match(/[^0-9]/)?c.min[a]:u,void 0!==s&&s.call(l.date,"month"==a?parseInt(l[a])-1:l[a])),d=d.slice(h.length)}return m}}var o={d:["[1-9]|[12][0-9]|3[01]",Date.prototype.setDate,"day",Date.prototype.getDate],dd:["0[1-9]|[12][0-9]|3[01]",Date.prototype.setDate,"day",function(){return a(Date.prototype.getDate.call(this),2)}],ddd:[""],dddd:[""],m:["[1-9]|1[012]",Date.prototype.setMonth,"month",function(){return Date.prototype.getMonth.call(this)+1}],mm:["0[1-9]|1[012]",Date.prototype.setMonth,"month",function(){return a(Date.prototype.getMonth.call(this)+1,2)}],mmm:[""],mmmm:[""],yy:["[0-9]{2}",Date.prototype.setFullYear,"year",function(){return a(Date.prototype.getFullYear.call(this),2)}],yyyy:["[0-9]{4}",Date.prototype.setFullYear,"year",function(){return a(Date.prototype.getFullYear.call(this),4)}],h:["[1-9]|1[0-2]",Date.prototype.setHours,"hours",Date.prototype.getHours],hh:["0[1-9]|1[0-2]",Date.prototype.setHours,"hours",function(){return a(Date.prototype.getHours.call(this),2)}],hhh:["[0-9]+",Date.prototype.setHours,"hours",Date.prototype.getHours],H:["1?[0-9]|2[0-3]",Date.prototype.setHours,"hours",Date.prototype.getHours],HH:["[01][0-9]|2[0-3]",Date.prototype.setHours,"hours",function(){return a(Date.prototype.getHours.call(this),2)}],HHH:["[0-9]+",Date.prototype.setHours,"hours",Date.prototype.getHours],M:["[1-5]?[0-9]",Date.prototype.setMinutes,"minutes",Date.prototype.getMinutes],MM:["[0-5][0-9]",Date.prototype.setMinutes,"minutes",function(){return a(Date.prototype.getMinutes.call(this),2)}],s:["[1-5]?[0-9]",Date.prototype.setSeconds,"seconds",Date.prototype.getSeconds],ss:["[0-5][0-9]",Date.prototype.setSeconds,"seconds",function(){return a(Date.prototype.getSeconds.call(this),2)}],l:["[0-9]{3}",Date.prototype.setMilliseconds,"milliseconds",function(){return a(Date.prototype.getMilliseconds.call(this),3)}],L:["[0-9]{2}",Date.prototype.setMilliseconds,"milliseconds",function(){return a(Date.prototype.getMilliseconds.call(this),2)}],t:[""],tt:[""],T:[""],TT:[""],Z:[""],o:[""],S:[""]},s={isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};return t.extendAliases({datetime:{mask:function(e){return e.inputFormat=s[e.inputFormat]||e.inputFormat,e.displayFormat=s[e.displayFormat]||e.displayFormat||e.inputFormat,e.outputFormat=s[e.outputFormat]||e.outputFormat||e.inputFormat,e.placeholder=e.placeholder!==t.prototype.defaults.placeholder?e.placeholder:e.inputFormat,e.min=r(e.min,e.inputFormat,e),e.max=r(e.max,e.inputFormat,e),e.regex=n(e.inputFormat,void 0,e),null},inputFormat:"isoDateTime",displayFormat:void 0,outputFormat:void 0,min:null,max:null,i18n:{dayNames:["Mon","Tue","Wed","Thu","Fri","Sat","Sun","Monday","Tuesday","Wednesday","Thursday","Frid
14550ay","Saturday","Sunday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]},postValidation:function(e,t,i){var n,a,o,s,l,u=t,c=r(e.join(""),i.inputFormat,i);return u&&c.date.getTime()==c.date.getTime()&&(s=c,l=u,u=(u=(!isFinite(s.day)||"29"==s.day&&!isFinite(s.rawyear)||new Date(s.date.getFullYear(),isFinite(s.month)?s.month:s.date.getMonth()+1,0).getDate()>=s.day)&&l)&&(n=c.date,o=!0,(a=i).min&&a.min.date.getTime()==a.min.date.getTime()&&(o=o&&a.min.date.getTime()<=n.getTime()),a.max&&a.max.date.getTime()==a.max.date.getTime()&&(o=o&&a.max.date.getTime()>=n.getTime()),o)),u},onKeyDown:function(n,r,o,s){if(n.ctrlKey&&n.keyCode===t.keyCode.RIGHT){for(var l,u=new Date,c="";l=i(s).exec(s.inputFormat);)"d"===l[0].charAt(0)?c+=a(u.getDate(),l[0].length):"m"===l[0].charAt(0)?c+=a(u.getMonth()+1,l[0].length):"yyyy"===l[0]?c+=u.getFullYear().toString():"y"===l[0].charAt(0)&&(c+=a(u.getYear(),l[0].length));this.inputmask._valueSet(c),e(this).trigger("setvalue")}},onUnMask:function(e,t,i){return n(i.outputFormat,r(e,i.inputFormat,i),i)},insertMode:!1}}),t})?n.apply(t,a):n)&&(e.exports=r)},function(e,t,i){"use strict";var n;"function"==typeof Symbol&&Symbol.iterator,void 0!==(n=function(){return window}.call(t,i,t,e))&&(e.exports=n)},function(e,t,i){"use strict";var n;"function"==typeof Symbol&&Symbol.iterator,void 0!==(n=function(){return document}.call(t,i,t,e))&&(e.exports=n)},function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&&Symbol.iterator,a=[i(0),i(1)],void 0!==(r="function"==typeof(n=function(e,t){return t.extendDefinitions({A:{validator:"[A-Za-zÀ-ÿ¨¸A-yµ]",casing:"upper"},"&":{validator:"[0-9A-Za-zÀ-ÿ¨¸A-yµ]",casing:"upper"},"#":{validator:"[0-9A-Fa-f]",casing:"upper"}}),t.extendAliases({url:{definitions:{i:{validator:"."}},mask:"(\\http://)|(\\http\\s://)|(ftp://)|(ftp\\s://)i{+}",insertMode:!1,autoUnmask:!1,inputmode:"url"},ip:{mask:"i[i[i]].i[i[i]].i[i[i]].i[i[i]]",definitions:{i:{validator:function(e,t,i,n,a){return i-1>-1&&"."!==t.buffer[i-1]?(e=t.buffer[i-1]+e,e=i-2>-1&&"."!==t.buffer[i-2]?t.buffer[i-2]+e:"0"+e):e="00"+e,new RegExp("25[0-5]|2[0-4][0-9]|[01][0-9][0-9]").test(e)}}},onUnMask:function(e,t,i){return e},inputmode:"numeric"},email:{mask:"*{1,64}[.*{1,64}][.*{1,64}][.*{1,63}]@-{1,63}.-{1,63}[.-{1,63}][.-{1,63}]",greedy:!1,onBeforePaste:function(e,t){return(e=e.toLowerCase()).replace("mailto:","")},definitions:{"*":{validator:"[0-9A-Za-z!#$%&'*+/=?^_`{|}~-]",casing:"lower"},"-":{validator:"[0-9A-Za-z-]",casing:"lower"}},onUnMask:function(e,t,i){return e},inputmode:"email"},mac:{mask:"##:##:##:##:##:##"},vin:{mask:"V{13}9{4}",definitions:{V:{validator:"[A-HJ-NPR-Za-hj-npr-z\\d]",casing:"upper"}},clearIncomplete:!0,autoUnmask:!0}}),t})?n.apply(t,a):n)&&(e.exports=r)},function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&&Symbol.iterator,a=[i(0),i(1)],void 0!==(r="function"==typeof(n=function(e,t,i){function n(e,i){for(var n="",a=0;a<e.length;a++)t.prototype.definitions[e.charAt(a)]||i.definitions[e.charAt(a)]||i.optionalmarker.start===e.charAt(a)||i.optionalmarker.end===e.charAt(a)||i.quantifiermarker.start===e.charAt(a)||i.quantifiermarker.end===e.charAt(a)||i.groupmarker.start===e.charAt(a)||i.groupmarker.end===e.charAt(a)||i.alternatormarker===e.charAt(a)?n+="\\"+e.charAt(a):n+=e.charAt(a);return n}return t.extendAliases({numeric:{mask:function(e){if(0!==e.repeat&&isNaN(e.integerDigits)&&(e.integerDigits=e.repeat),e.repeat=0,e.groupSeparator===e.radixPoint&&e.digits&&"0"!==e.digits&&("."===e.radixPoint?e.groupSeparator=",":","===e.radixPoint?e.groupSeparator=".":e.groupSeparator="")," "===e.groupSeparator&&(e.skipOptionalPartCharacter=i),e.autoGroup=e.autoGroup&&""!==e.groupSeparator,e.autoGroup&&("string"==typeof e.groupSize&&isFinite(e.groupSize)&&(e.groupSize=parseInt(e.groupSize)),isFinite(e.integerDigits))){var t=Math.floor(e.integerDigits/e.groupSize),a=e.integerDigits%e.groupSize;e.integerDigits=parseInt(e.integerDigits)+(0===a?t-1:t),e.integerDigits<1&&(e.integerDigits="*")}e.placeholder.length>1&&(e.placeholder=e.placeholder.charAt(0)),"radixFocus"===e.positionCaretOnClick&&""===e.placeholder&&!1===e.integerOptional&&(e.positionCaretOnClick="lvp"),e.definitions[";"]=e.definitions["~"],e.definitions[";
14550"].definitionSymbol="~",!0===e.numericInput&&(e.positionCaretOnClick="radixFocus"===e.positionCaretOnClick?"lvp":e.positionCaretOnClick,e.digitsOptional=!1,isNaN(e.digits)&&(e.digits=2),e.decimalProtect=!1);var r="[+]";if(r+=n(e.prefix,e),!0===e.integerOptional?r+="~{1,"+e.integerDigits+"}":r+="~{"+e.integerDigits+"}",e.digits!==i){e.radixPointDefinitionSymbol=e.decimalProtect?":":e.radixPoint;var o=e.digits.toString().split(",");isFinite(o[0]&&o[1]&&isFinite(o[1]))?r+=e.radixPointDefinitionSymbol+";{"+e.digits+"}":(isNaN(e.digits)||parseInt(e.digits)>0)&&(e.digitsOptional?r+="["+e.radixPointDefinitionSymbol+";{1,"+e.digits+"}]":r+=e.radixPointDefinitionSymbol+";{"+e.digits+"}")}return r+=n(e.suffix,e),r+="[-]",e.greedy=!1,r},placeholder:"",greedy:!1,digits:"*",digitsOptional:!0,enforceDigitsOnBlur:!1,radixPoint:".",positionCaretOnClick:"radixFocus",groupSize:3,groupSeparator:"",autoGroup:!1,allowMinus:!0,negationSymbol:{front:"-",back:""},integerDigits:"+",integerOptional:!0,prefix:"",suffix:"",rightAlign:!0,decimalProtect:!0,min:null,max:null,step:1,insertMode:!0,autoUnmask:!1,unmaskAsNumber:!1,inputmode:"numeric",preValidation:function(t,n,a,r,o){if("-"===a||a===o.negationSymbol.front)return!0===o.allowMinus&&(o.isNegative=o.isNegative===i||!o.isNegative,""===t.join("")||{caret:n,dopost:!0});if(!1===r&&a===o.radixPoint&&o.digits!==i&&(isNaN(o.digits)||parseInt(o.digits)>0)){var s=e.inArray(o.radixPoint,t);if(-1!==s)return!0===o.numericInput?n===s:{caret:s+1}}return!0},postValidation:function(n,a,r){var o=r.suffix.split(""),s=r.prefix.split("");if(a.pos===i&&a.caret!==i&&!0!==a.dopost)return a;var l=a.caret!==i?a.caret:a.pos,u=n.slice();r.numericInput&&(l=u.length-l-1,u=u.reverse());var c=u[l];if(c===r.groupSeparator&&(c=u[l+=1]),l===u.length-r.suffix.length-1&&c===r.radixPoint)return a;c!==i&&c!==r.radixPoint&&c!==r.negationSymbol.front&&c!==r.negationSymbol.back&&(u[l]="?",r.prefix.length>0&&l>=(!1===r.isNegative?1:0)&&l<r.prefix.length-1+(!1===r.isNegative?1:0)?s[l-(!1===r.isNegative?1:0)]="?":r.suffix.length>0&&l>=u.length-r.suffix.length-(!1===r.isNegative?1:0)&&(o[l-(u.length-r.suffix.length-(!1===r.isNegative?1:0))]="?")),s=s.join(""),o=o.join("");var p=u.join("").replace(s,"");if(p=(p=(p=(p=p.replace(o,"")).replace(new RegExp(t.escapeRegex(r.groupSeparator),"g"),"")).replace(new RegExp("[-"+t.escapeRegex(r.negationSymbol.front)+"]","g"),"")).replace(new RegExp(t.escapeRegex(r.negationSymbol.back)+"$"),""),isNaN(r.placeholder)&&(p=p.replace(new RegExp(t.escapeRegex(r.placeholder),"g"),"")),p.length>1&&1!==p.indexOf(r.radixPoint)&&("0"===c&&(p=p.replace(/^\?/g,"")),p=p.replace(/^0/g,"")),p.charAt(0)===r.radixPoint&&""!==r.radixPoint&&!0!==r.numericInput&&(p="0"+p),""!==p){if(p=p.split(""),(!r.digitsOptional||r.enforceDigitsOnBlur&&"blur"===a.event)&&isFinite(r.digits)){var f=e.inArray(r.radixPoint,p),m=e.inArray(r.radixPoint,u);-1===f&&(p.push(r.radixPoint),f=p.length-1);for(var d=1;d<=r.digits;d++)r.digitsOptional&&(!r.enforceDigitsOnBlur||"blur"!==a.event)||p[f+d]!==i&&p[f+d]!==r.placeholder.charAt(0)?-1!==m&&u[m+d]!==i&&(p[f+d]=p[f+d]||u[m+d]):p[f+d]=a.placeholder||r.placeholder.charAt(0)}if(!0!==r.autoGroup||""===r.groupSeparator||c===r.radixPoint&&a.pos===i&&!a.dopost)p=p.join("");else{var h=p[p.length-1]===r.radixPoint&&a.c===r.radixPoint;p=t(function(e,t){var i="";if(i+="("+t.groupSeparator+"*{"+t.groupSize+"}){*}",""!==t.radixPoint){var n=e.join("").split(t.radixPoint);n[1]&&(i+=t.radixPoint+"*{"+n[1].match(/^\d*\??\d*/)[0].length+"}")}return i}(p,r),{numericInput:!0,jitMasking:!0,definitions:{"*":{validator:"[0-9?]",cardinality:1}}}).format(p.join("")),h&&(p+=r.radixPoint),p.charAt(0)===r.groupSeparator&&p.substr(1)}}if(r.isNegative&&"blur"===a.event&&(r.isNegative="0"!==p),p=s+p,p+=o,r.isNegative&&(p=r.negationSymbol.front+p,p+=r.negationSymbol.back),p=p.split(""),c!==i)if(c!==r.radixPoint&&c!==r.negationSymbol.front&&c!==r.negationSymbol.back)(l=e.inArray("?",p))>-1?p[l]=c:l=a.caret||0;else if(c===r.radixPoint||c===r.negationSymbol.front||c===r.negationSymbol.back){var g=e.inArray(c,p);-1!==g&&(l=g)}r.numericInput&&(l=p.length-l-1,p=p.reverse());var v={caret:c===i||a.pos!==i?l+(r.numericInput?-1:1):l,buffer:p,refreshFromBuffer:a.dopost||n.join("")!==p.join("")};return v.refreshFromBuffer?v:a},onBeforeWrite:function(n,a,r,o){if(n)switch(n.type){case"keydown":return o.postValidation(a,{caret:r,dopost:!0},o);case"blur":case"checkval":var s;if((l=o).parseMinMaxOptions===i&&(null!==l.min&&(l.min=l.min.toString().replace(new RegExp(t.escapeRegex(l.groupSeparator),"g"),""),","===l.radixPoint&&(l.min=l.min.replace(l.radixPoint,".")),l.min=isFinite(l.min)?parseFloat(l.min):NaN,isNaN(l.min)&&(l.min=Number.MIN_VALUE)),null!==l.max&&(l.max=l.max.toString().replace(new RegExp(t.escapeRegex(l.groupSeparator),"g"),""),","===l.radixPoint&&(l.max=l.max.replace(l.radixPoint,".")),l.max=isFinite(l.max)?parseFloat(l.max):NaN,isNaN(l.max)&&(l.max=Number.MAX_VALUE)),l.parseMinMaxOptions="done"),null!==o.min||null!==o.max){if(s=o.onUnMask(a.join(""),i,e.extend({},o,{unmaskAsNumber:!0})),null!==o.min&&s<o.min)return o.isNegative=o.min<0,o.postValidation(o.min.toString().replace(".",o.radixPoint).split(""),{caret:r,dopost:!0,placeholder:"0"},o);if(null!==o.max&&s>o.max)return o.isNegative=o.max<0,o.postValidation(o.max.toString().replace(".",o.radixPoint).split(""),{caret:r,dopost:!0,placeholder:"0"},o)}return o.postValidation(a,{caret:r,placeholder:"0",event:"blur"},o);case"_checkval":return{caret:r}}var l},regex:{integerPart:function(e,i){return i?new RegExp("["+t.escapeRegex(e.negationSymbol.front)+"+]?"):new RegExp("["+t.escapeRegex(e.negationSymbol.front)+"+]?\\d+")},integerNPart:function(e){return new RegExp("[\\d"+t.escapeRegex(e.groupSeparator)+t.escapeRegex(e.placeholder.charAt(0))+"]+")}},definitions:{"~":{validator:function(e,n,a,r,o,s){var l=r?new RegExp("[0-9"+t.escapeRegex(o.groupSeparator)+"]").test(e):new RegExp("[0-9]").test(e);
14550if(!0===l){if(!0!==o.numericInput&&n.validPositions[a]!==i&&"~"===n.validPositions[a].match.def&&!s){var u=n.buffer.join(""),c=(u=(u=u.replace(new RegExp("[-"+t.escapeRegex(o.negationSymbol.front)+"]","g"),"")).replace(new RegExp(t.escapeRegex(o.negationSymbol.back)+"$"),"")).split(o.radixPoint);c.length>1&&(c[1]=c[1].replace(/0/g,o.placeholder.charAt(0))),"0"===c[0]&&(c[0]=c[0].replace(/0/g,o.placeholder.charAt(0))),u=c[0]+o.radixPoint+c[1]||"";var p=n._buffer.join("");for(u===o.radixPoint&&(u=p);null===u.match(t.escapeRegex(p)+"$");)p=p.slice(1);l=(u=(u=u.replace(p,"")).split(""))[a]===i?{pos:a,remove:a}:{pos:a}}}else r||e!==o.radixPoint||n.validPositions[a-1]!==i||(n.buffer[a]="0",l={pos:a+1});return l},cardinality:1},"+":{validator:function(e,t,i,n,a){return a.allowMinus&&("-"===e||e===a.negationSymbol.front)},cardinality:1,placeholder:""},"-":{validator:function(e,t,i,n,a){return a.allowMinus&&e===a.negationSymbol.back},cardinality:1,placeholder:""},":":{validator:function(e,i,n,a,r){var o="["+t.escapeRegex(r.radixPoint)+"]",s=new RegExp(o).test(e);return s&&i.validPositions[n]&&i.validPositions[n].match.placeholder===r.radixPoint&&(s={caret:n+1}),s},cardinality:1,placeholder:function(e){return e.radixPoint}}},onUnMask:function(e,i,n){if(""===i&&!0===n.nullable)return i;var a=e.replace(n.prefix,"");return a=(a=a.replace(n.suffix,"")).replace(new RegExp(t.escapeRegex(n.groupSeparator),"g"),""),""!==n.placeholder.charAt(0)&&(a=a.replace(new RegExp(n.placeholder.charAt(0),"g"),"0")),n.unmaskAsNumber?(""!==n.radixPoint&&-1!==a.indexOf(n.radixPoint)&&(a=a.replace(t.escapeRegex.call(this,n.radixPoint),".")),a=(a=a.replace(new RegExp("^"+t.escapeRegex(n.negationSymbol.front)),"-")).replace(new RegExp(t.escapeRegex(n.negationSymbol.back)+"$"),""),Number(a)):a},isComplete:function(e,i){var n=e.join("");if(e.slice().join("")!==n)return!1;var a=n.replace(i.prefix,"");return a=(a=a.replace(i.suffix,"")).replace(new RegExp(t.escapeRegex(i.groupSeparator)+"([0-9]{3})","g"),"$1"),","===i.radixPoint&&(a=a.replace(t.escapeRegex(i.radixPoint),".")),isFinite(a)},onBeforeMask:function(e,n){if(n.isNegative=i,e=e.toString().charAt(e.length-1)===n.radixPoint?e.toString().substr(0,e.length-1):e.toString(),""!==n.radixPoint&&isFinite(e)){var a=e.split("."),r=""!==n.groupSeparator?parseInt(n.groupSize):0;2===a.length&&(a[0].length>r||a[1].length>r||a[0].length<=r&&a[1].length<r)&&(e=e.replace(".",n.radixPoint))}var o=e.match(/,/g),s=e.match(/\./g);if(e=s&&o?s.length>o.length?(e=e.replace(/\./g,"")).replace(",",n.radixPoint):o.length>s.length?(e=e.replace(/,/g,"")).replace(".",n.radixPoint):e.indexOf(".")<e.indexOf(",")?e.replace(/\./g,""):e.replace(/,/g,""):e.replace(new RegExp(t.escapeRegex(n.groupSeparator),"g"),""),0===n.digits&&(-1!==e.indexOf(".")?e=e.substring(0,e.indexOf(".")):-1!==e.indexOf(",")&&(e=e.substring(0,e.indexOf(",")))),""!==n.radixPoint&&isFinite(n.digits)&&-1!==e.indexOf(n.radixPoint)){var l=e.split(n.radixPoint)[1].match(new RegExp("\\d*"))[0];if(parseInt(n.digits)<l.toString().length){var u=Math.pow(10,parseInt(n.digits));e=e.replace(t.escapeRegex(n.radixPoint),"."),e=(e=Math.round(parseFloat(e)*u)/u).toString().replace(".",n.radixPoint)}}return e},canClearPosition:function(e,t,i,n,a){var r=e.validPositions[t],o=r.input!==a.radixPoint||null!==e.validPositions[t].match.fn&&!1===a.decimalProtect||r.input===a.radixPoint&&e.validPositions[t+1]&&null===e.validPositions[t+1].match.fn||isFinite(r.input)||t===i||r.input===a.groupSeparator||r.input===a.negationSymbol.front||r.input===a.negationSymbol.back;return!o||"+"!==r.match.nativeDef&&"-"!==r.match.nativeDef||(a.isNegative=!1),o},onKeyDown:function(i,n,a,r){var o=e(this);if(i.ctrlKey)switch(i.keyCode){case t.keyCode.UP:o.val(parseFloat(this.inputmask.unmaskedvalue())+parseInt(r.step)),o.trigger("setvalue");break;case t.keyCode.DOWN:o.val(parseFloat(this.inputmask.unmaskedvalue())-parseInt(r.step)),o.trigger("setvalue")}}},currency:{prefix:"$ ",groupSeparator:",",alias:"numeric",placeholder:"0",autoGroup:!0,digits:2,digitsOptional:!1,clearMaskOnLostFocus:!1},decimal:{alias:"numeric"},integer:{alias:"numeric",digits:0,radixPoint:""},percentage:{alias:"numeric",digits:2,digitsOptional:!0,radixPoint:".",placeholder:"0",autoGroup:!1,min:0,max:100,suffix:" %",allowMinus:!1}}),t})?n.apply(t,a):n)&&(e.exports=r)},function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&&Symbol.iterator,a=[i(0),i(1)],void 0!==(r="function"==typeof(n=function(e,t){function i(e,t){var i=(e.mask||e).replace(/#/g,"0").replace(/\)/,"0").replace(/[+()#-]/g,""),n=(t.mask||t).replace(/#/g,"0").replace(/\)/,"0").replace(/[+()#-]/g,"");return i.localeCompare(n)}
14550var n=t.prototype.analyseMask;return t.prototype.analyseMask=function(t,i,a){var r={};return a.phoneCodes&&(a.phoneCodes&&a.phoneCodes.length>1e3&&(function e(i,n,a){n=n||"",a=a||r,""!==n&&(a[n]={});for(var o="",s=a[n]||a,l=i.length-1;l>=0;l--)s[o=(t=i[l].mask||i[l]).substr(0,1)]=s[o]||[],s[o].unshift(t.substr(1)),i.splice(l,1);for(var u in s)s[u].length>500&&e(s[u].slice(),u,s)}((t=t.substr(1,t.length-2)).split(a.groupmarker[1]+a.alternatormarker+a.groupmarker[0])),t=function t(i){var n="",r=[];for(var o in i)e.isArray(i[o])?1===i[o].length?r.push(o+i[o]):r.push(o+a.groupmarker[0]+i[o].join(a.groupmarker[1]+a.alternatormarker+a.groupmarker[0])+a.groupmarker[1]):r.push(o+t(i[o]));return 1===r.length?n+=r[0]:n+=a.groupmarker[0]+r.join(a.groupmarker[1]+a.alternatormarker+a.groupmarker[0])+a.groupmarker[1],n}(r)),t=t.replace(/9/g,"\\9")),n.call(this,t,i,a)},t.extendAliases({abstractphone:{groupmarker:["<",">"],countrycode:"",phoneCodes:[],keepStatic:"auto",mask:function(e){return e.definitions={"#":t.prototype.definitions[9]},e.phoneCodes.sort(i)},onBeforeMask:function(e,t){var i=e.replace(/^0{1,2}/,"").replace(/[\s]/g,"");return(i.indexOf(t.countrycode)>1||-1===i.indexOf(t.countrycode))&&(i="+"+t.countrycode+i),i},onUnMask:function(e,t,i){return e.replace(/[()#-]/g,"")},inputmode:"tel"}}),t})?n.apply(t,a):n)&&(e.exports=r)},function(e,t,i){"use strict";var n,a,r,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};a=[i(2),i(1)],void 0!==(r="function"==typeof(n=function(e,t){return void 0===e.fn.inputmask&&(e.fn.inputmask=function(i,n){var a,r=this[0];if(void 0===n&&(n={}),"string"==typeof i)switch(i){case"unmaskedvalue":return r&&r.inputmask?r.inputmask.unmaskedvalue():e(r).val();case"remove":return this.each(function(){this.inputmask&&this.inputmask.remove()});case"getemptymask":return r&&r.inputmask?r.inputmask.getemptymask():"";case"hasMaskedValue":return!(!r||!r.inputmask)&&r.inputmask.hasMaskedValue();case"isComplete":return!r||!r.inputmask||r.inputmask.isComplete();case"getmetadata":return r&&r.inputmask?r.inputmask.getmetadata():void 0;case"setvalue":e(r).val(n),r&&void 0===r.inputmask&&e(r).triggerHandler("setvalue");break;case"option":if("string"!=typeof n)return this.each(function(){if(void 0!==this.inputmask)return this.inputmask.option(n)});if(r&&void 0!==r.inputmask)return r.inputmask.option(n);break;default:return n.alias=i,a=new t(n),this.each(function(){a.mask(this)})}else{if("object"==(void 0===i?"undefined":o(i)))return a=new t(i),void 0===i.mask&&void 0===i.alias?this.each(function(){if(void 0!==this.inputmask)return this.inputmask.option(i);a.mask(this)}):this.each(function(){a.mask(this)});if(void 0===i)return this.each(function(){(a=new t(n)).mask(this)})}}),e.fn.inputmask})?n.apply(t,a):n)&&(e.exports=r)}]);
14551/* End */
14552;; /* /bitrix/templates/aspro-allcorp2/js/browser.js?1718280873996*/
14553; /* /bitrix/templates/aspro-allcorp2/js/jquery.actual.min.js?17182808731239*/
14554; /* /bitrix/templates/aspro-allcorp2/js/jquery.fancybox.js?171828087348771*/
14555; /* /bitrix/templates/aspro-allcorp2/vendor/jquery.easing.js?17182808618097*/
14556; /* /bitrix/templates/aspro-allcorp2/vendor/jquery.appear.js?17182808613188*/
14557; /* /bitrix/templates/aspro-allcorp2/vendor/jquery.cookie.js?17182808612247*/
14558; /* /bitrix/templates/aspro-allcorp2/vendor/bootstrap.js?171828086127908*/
14559; /* /bitrix/templates/aspro-allcorp2/vendor/flexslider/jquery.flexslider.js?171828086155194*/
14560; /* /bitrix/templates/aspro-allcorp2/vendor/jquery.validate.min.js?171828086122254*/
14561; /* /bitrix/templates/aspro-allcorp2/js/jquery.uniform.min.js?17182808738308*/
14562; /* /bitrix/templates/aspro-allcorp2/js/jquery-ui.min.js?171828087332162*/
14563; /* /bitrix/templates/aspro-allcorp2/js/jqModal.js?171828087311039*/
14564; /* /bitrix/templates/aspro-allcorp2/js/detectmobilebrowser.js?17182808732203*/
14565; /* /bitrix/templates/aspro-allcorp2/js/matchMedia.js?17182808731700*/
14566; /* /bitrix/templates/aspro-allcorp2/js/counterup.js?17182808731928*/
14567;
14567 /* /bitrix/templates/aspro-allcorp2/js/jquery.alphanumeric.js?17182808731972*/
14568; /* /bitrix/templates/aspro-allcorp2/js/jquery.autocomplete.js?171828087332714*/
14569; /* /bitrix/templates/aspro-allcorp2/js/jquery.mousewheel.min.js?17182808732609*/
14570; /* /bitrix/templates/aspro-allcorp2/js/jquery.mCustomScrollbar.js?171828087392949*/
14571; /* /bitrix/templates/aspro-allcorp2/js/jquery.mobile.custom.touch.min.js?17182808737684*/
14572; /* /bitrix/templates/aspro-allcorp2/js/bootstrap-datetimepicker.min.js?171828087339221*/
14573; /* /bitrix/templates/aspro-allcorp2/js/bootstrap-datetimepicker.ru.js?17182808732055*/
14574; /* /bitrix/templates/aspro-allcorp2/js/general.js?1718280873175921*/
14575; /* /bitrix/templates/aspro-allcorp2/js/scrollTabs.js?171828087313520*/
14576; /* /bitrix/templates/aspro-allcorp2/js/custom.js?1718280873100*/
14577; /* /bitrix/templates/aspro-allcorp2/components/bitrix/news.list/front-cases-custom/script.js?1718280866534*/
14578; /* /bitrix/components/bitrix/search.title/script.js?17182807699847*/
14579; /* /bitrix/templates/aspro-allcorp2/components/bitrix/search.title/fixed/script.js?171828086310017*/
14580; /* /bitrix/templates/aspro-allcorp2/js/jquery.inputmask.bundle.min.js?171828087370933*/

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.