PageSourceSearch

https://www.allfordj.ru/bitrix/cache/js/s1/aspro_max_local/templat…e8e6256eab0a7a9241d_v1.js?17901062311338368

js allfordj.ru collected 2026-09-26 02:35:03 UTC 1,338,368 bytes, 34,392 lines download raw bytes

1
2; /* Start:"a:4:{s:4:"full";s:63:"/local/js/allfordj.marketing/allfordj-tracker.js?17901061884949";s:6:"source";s:48:"/local/js/allfordj.marketing/allfordj-tracker.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
3(function (window) {
4  "use strict";
5  if (window.ALLFORDJBitrixMarketing) { return; }
6  var queue = [];
7
8  function makeId(prefix) {
9    if (window.crypto && window.crypto.randomUUID) {
10      return prefix + "-" + window.crypto.randomUUID();
11    }
12    return prefix + "-" + Date.now().toString(36) + "-" + Math.random().toString(36).slice(2);
13  }
14
15  function persistentId(storageName, key, prefix) {
16    try {
17      var storage = window[storageName];
18      var value = storage.getItem(key);
19      if (!value) {
20        value = makeId(prefix);
21        storage.setItem(key, value);
22      }
23      return value;
24    } catch (_error) {
25      return makeId(prefix);
26    }
27  }
28
29  var anonymousId = persistentId("localStorage", "allfordj_anonymous_id", "anon");
30  var sessionId = persistentId("sessionStorage", "allfordj_session_id", "session");
31  try {
32    document.cookie = "allfordj_session_id=" + encodeURIComponent(sessionId) + "; Path=/; SameSite=Lax";
33  } catch (_error) { /* storage identity still works */ }
34
35  function send(envelope, keepalive) {
36    // Bitrix may place the combined JavaScript bundle before Asset::addString()
37    // output. Resolve the endpoint at send time so DOMContentLoaded sees the
38    // bootstrap value even when it was not present while this file evaluated.
39    var apiBase = window.ALLFORDJ_MARKETING_API || "";
40    var body = JSON.stringify(envelope);
41    if (keepalive && window.navigator.sendBeacon) {
42      try {
43        if (window.navigator.sendBeacon(
44          apiBase + "/api/v1/marketing/browser-events",
45          new Blob([body], {type: "application/json"})
46        )) {
47          return Promise.resolve({accepted: true});
48        }
49      } catch (_error) { /* fall through to fetch */ }
50    }
51    if (!window.fetch) { return Promise.reject(new Error("fetch unavailable")); }
52    return window.fetch(apiBase + "/api/v1/marketing/browser-events", {
53      method: "POST",
54      headers: {"Content-Type": "application/json"},
55      body: body,
56      credentials: "omit",
57      keepalive: Boolean(keepalive)
58    }).then(function (response) {
59      if (!response.ok) { throw new Error("marketing endpoint unavailable"); }
60      return response.json();
61    });
62  }
63
64  function track(eventType, payload) {
65    var envelope = {
66      schema_version: "1.0",
67      event_id: makeId("bitrix-web"),
68      event_type: eventType,
69      occurred_at: new Date().toISOString(),
70      source: "allfordj-bitrix-tracker",
71      identity: {anonymous_id: anonymousId, session_id: sessionId},
72      payload: payload || {}
73    };
74    return send(envelope, true).catch(function () {
75      queue.push(envelope);
76      if (queue.length > 100) { queue.shift(); }
77      return {accepted: false};
78    });
79  }
80
81  function flush() {
82    var pending = queue.splice(0);
83    pending.forEach(function (envelope) {
84      send(envelope, false).catch(function () {
85        if (queue.length < 100) { queue.push(envelope); }
86      });
87    });
88  }
89
90  function legacyBridge(name, trackValue) {
91    var previous = window[name];
92    var bridge = function (value) {
93      var tracked = trackValue(value);
94      if (typeof previous === "function") {
95        return previous.apply(this, arguments);
96      }
97      return tracked;
98    };
99    try {
100      Object.defineProperty(window, name, {
101        configurable: true,
102        enumerable: true,
103        get: function () { return bridge; },
104        set: function (next) {
105          if (next !== bridge) { previous = next; }
106        }
107      });
108    } catch (_error) {
109      window[name] = bridge;
110    }
111  }
112
113  function automaticSiteVisit() {
114    var key = "allfordj_site_visit_sent";
115    try {
116      if (window.sessionStorage.getItem(key)) { return; }
117      window.sessionStorage.setItem(key, "1");
118    } catch (_error) { /* one duplicate after blocked storage is harmless */ }
119    track("site_visit", {page_url: window.location.href});
120  }
121
122  window.ALLFORDJBitrixMarketing = Object.freeze({
123    version: "1.3.2",
124    track: track,
125    siteVisit: function () {
126      return track("site_visit", {page_url: window.location.href});
127    },
128    productView: function (productId) {
129      return track("product_view", {product_id: String(productId)});
130    },
131    categoryView: function (categoryId) {
132      return track("category_view", {category_id: String(categoryId)});
133    },
134    cartChanged: function (items) {
135      return track("cart_changed", {items: items || []});
136    },
137    flush: flush
138  });
139  legacyBridge("mindboxViewProduct", function (productId) {
140    return window.ALLFORDJBitrixMarketing.productView(productId);
141  });
142  legacyBridge("mindboxViewCategory", function (categoryId) {
143    return window.ALLFORDJBitrixMarketing.categoryView(categoryId);
144  });
145  if (document.readyState === "loading") {
146    document.addEventListener("DOMContentLoaded", automaticSiteVisit, {once: true});
147  } else {
148    automaticSiteVisit();
149  }
150  window.addEventListener("online", flush, {passive: true});
151})(window);
152
153/* End */
154;
155; /* Start:"a:4:{s:4:"full";s:62:"/local/templates/aspro_max_local/js/observer.js?16201975696819";s:6:"source";s:47:"/local/templates/aspro_max_local/js/observer.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
156if(
157	typeof AMutationObserver === 'undefined' &&
158	typeof MutationObserver === 'function'
159){
160	(function(w, d){
161		"use strict";
162
163		/* ES6 class definition */
164		/*
165		class AMutationObserver extends MutationObserver{
166			constructor(callback){
167				super(function(mutationsList, observer){
168					if(
169						AMutationObserver.ignore ||
170						observer.paused
171					){
172						// ignore mutations without disconnect()
173						//console.log('ignore observer callback', observer.id);
174					}
175					else{
176						callback(mutationsList, observer);
177					}
178				});
179
180				this.paused = true;
181				this.id = Math.floor(Math.random() * Math.floor(1000));
182
183				// define parent script
184				try{
185					eval('@');
186				}
187				catch(e){
188					// define parent script
189					if(typeof e.stack === 'string'){
190						this.stack = e.stack.match(/[^\s]*:[\d]+:[\d]+[^\s]/g);
191						this.stack.splice(0, 1);
192						var script = this.stack[0];
193
194						if(script.indexOf('yandex.ru/metrika') !== -1){
195							this.id = 'ym';
196						}
197						else{
198							script = script.replace(/^(.*[/])?(.*\.js)(.*)$/ig, '$2');
199							this.id = script.replace(/(\.min)?\.js$/i, '');
200						}
201					}
202				}
203				finally{
204					//console.log('new observer', this.id);
205				}
206			}
207
208			observe(target, options){
209				this.target = target;
210				this.options = options;
211				this.paused = false;
212				if(typeof AMutationObserver.observers[this.id] === 'undefined'){
213					AMutationObserver.observers[this.id] = this;
214				}
215				super.observe(target, options);
216			}
217
218			disconnect(){
219				this.paused = true;
220				super.disconnect();
221			}
222
223			takeRecords(){
224				if(
225					AMutationObserver.ignore ||
226					this.paused
227				){
228					// ignore mutations without disconnect()
229					//console.log('ignore observer takeRecords', this.id);
230					return [];
231				}
232				else{
233					return super.takeRecords();
234				}
235			}
236
237			pause(){
238				this.paused = true;
239			}
240
241			resume(){
242				if(typeof this.options !== 'false'){
243					this.paused = false;
244				}
245			}
246		}
247		*/
248
249		/* ES5 class definition */
250		var _AMutationObserver = /*#__PURE__*/function (_MutationObserver) {
251			"use strict";
252
253			_inheritsLoose(_AMutationObserver, _MutationObserver);
254
255			function _AMutationObserver(callback) {
256				var _this;
257
258				_this = _MutationObserver.call(this, function (mutationsList, observer) {
259					if (_AMutationObserver.ignore || observer.paused) {// ignore mutations without disconnect()
260						//console.log('ignore observer callback', observer.id);
261					}
262					else {
263						callback(mutationsList, observer);
264					}
265				}) || this;
266
267				_this.paused = true;
268				_this.id = Math.floor(Math.random() * Math.floor(1000));
269
270				try {
271					eval('@');
272				}
273				catch (e) {
274					// define parent script
275					if(typeof e.stack === 'string'){
276						_this.stack = e.stack.match(/[^\s]*:[\d]+:[\d]+[^\s]/g);
277						_this.stack.splice(0, 1);
278						var script = _this.stack[0];
279
280						if (script.indexOf('yandex.ru/metrika') !== -1) {
281							_this.id = 'ym';
282						}
283						else {
284							script = script.replace(/^(.*[/])?(.*\.js)(.*)$/ig, '$2');
285							_this.id = script.replace(/(\.min)?\.js$/i, '');
286						}
287					}
288				}
289				finally {
290					//console.log('new observer', _this.id);
291				}
292
293				return _this;
294			}
295
296			var _proto = _AMutationObserver.prototype;
297
298			_proto.observe = function observe(target, options) {
299				this.target = target;
300				this.options = options;
301				this.paused = false;
302
303				if (typeof _AMutationObserver.observers[this.id] === 'undefined') {
304					_AMutationObserver.observers[this.id] = this;
305				}
306
307				_MutationObserver.prototype.observe.call(this, target, options);
308			};
309
310			_proto.disconnect = function disconnect() {
311				this.paused = true;
312
313				_MutationObserver.prototype.disconnect.call(this);
314			};
315
316			_proto.takeRecords = function takeRecords() {
317				if (_AMutationObserver.ignore || this.paused) {
318					// ignore mutations without disconnect()
319					//console.log('ignore observer takeRecords', this.id);
320					return [];
321				}
322				else {
323					return _MutationObserver.prototype.takeRecords.call(this);
324				}
325			};
326
327			_proto.pause = function pause() {
328				this.paused = true;
329			};
330
331			_proto.resume = function resume() {
332				if (typeof this.options !== 'false') {
333					this.paused = false;
334				}
335			};
336
337			return _AMutationObserver;
338		}( /*#__PURE__*/_wrapNativeSuper(MutationObserver));
339
340		_AMutationObserver.ignore = false;
341		_AMutationObserver.observers = [];
342		_AMutationObserver.parent = MutationObserver;
343		_AMutationObserver.toString = function(){
344			return 'function MutationObserver() { [native code] }';
345		}
346		MutationObserver = _AMutationObserver;
347
348		/* ES2015 Babel functions (loose) */
349		function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
350
351		function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
352
353		function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
354
355		function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
356
357		function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
358
359		function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
360
361		function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
362	})(window, document);
363}
364/* End */
365;
366; /* Start:"a:4:{s:4:"full";s:71:"/local/templates/aspro_max_local/js/jquery.actual.min.js?16201975691238";s:6:"source";s:56:"/local/templates/aspro_max_local/js/jquery.actual.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
367/*! Copyright 2012, Ben Lin (http://dreamerslab.com/)
368 * Licensed under the MIT License (LICENSE.txt).
369 *
370 * Version: 1.0.18
371 *
372 * Requires: jQuery >= 1.2.3
373 */
374(function(a){if(typeof define==="function"&&define.amd){define(["jquery"],a);
375}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';
376}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; ";
377e=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");
378d+="visibility: hidden !important; display: "+i.display+" !important; ";if(i.absolute===true){d+="position: absolute !important; ";}c.each(function(){var m=a(this);
379var 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");
380}else{o.attr("style",n);}});};}h();var k=/(outer)/.test(b)?e[b](i.includeMargin):e[b]();j();return k;}});}));
381/* End */
382;
383; /* Start:"a:4:{s:4:"full";s:62:"/local/templates/aspro_max_local/js/jqModal.js?162019756911178";s:6:"source";s:46:"/local/templates/aspro_max_local/js/jqModal.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
384/*
385 * jqModal - Minimalist Modaling with jQuery
386 *
387 * Copyright (c) 2007-2014 Brice Burgess @iceburg_net
388 * Dual licensed under the MIT and GPL licenses:
389 *   http://www.opensource.org/licenses/mit-license.php
390 *   http://www.gnu.org/licenses/gpl.html
391 *
392 * $Version: 1.0.2 (2014.04.10 +r19)
393 * Requires: jQuery 1.2.3+
394 */
395
396(function($) {
397
398	/**
399	 * Initialize a set of elements as "modals". Modals typically are popup dialogs,
400	 * notices, modal windows, &c.
401	 *
402	 * @name jqm
403	 * @param options user defined options, augments defaults.
404	 * @type jQuery
405	 * @cat Plugins/jqModal
406	 */
407
408	$.fn.jqm=function(options){
409
410		var o = $.extend({}, $.jqm.params, options);
411
412		return this.each(function(){
413			var e = $(this),
414				jqm = $(this).data('jqm');
415
416			if(!jqm) jqm = {ID: I++};
417
418			// add/extend options to modal and mark as initialized
419			e.data('jqm',$.extend(o,jqm)).addClass('jqm-init');
420
421			// ... Attach events to trigger showing of this modal
422			o.trigger&&$(this).jqmAddTrigger(o.trigger);
423		});
424	};
425
426
427	/**
428	 * Matching modals will have their jqmShow() method fired by attaching a
429	 *   onClick event to elements matching `trigger`.
430	 *
431	 * @name jqmAddTrigger
432	 * @param trigger a selector String, jQuery collection of elements, or a DOM element.
433	 */
434	$.fn.jqmAddTrigger=function(trigger){
435		return this.each(function(){
436			if(!addTrigger($(this), 'jqmShow', trigger))
437				err("jqmAddTrigger must be called on initialized modals")
438		});
439	};
440
441
442	/**
443	 * Matching modals will have their jqmHide() method fired by attaching an
444	 *   onClick event to elements matching `trigger`.
445	 *
446	 * @name jqmAddClose
447	 * @param trigger a selector String, jQuery collection of elements, or a DOM element.
448	 */
449	$.fn.jqmAddClose=function(trigger){
450		return this.each(function(){
451			if(!addTrigger($(this), 'jqmHide', trigger))
452				err("jqmAddClose must be called on initialized modals")
453		});
454	};
455
456
457	/**
458	 * Open matching modals (if not shown)
459	 */
460	$.fn.jqmShow=function(trigger){
461		return this.each(function(){ !this._jqmShown&&show($(this), trigger); });
462	};
463
464	/**
465	 * Close matching modals
466	 */
467	$.fn.jqmHide=function(trigger){
468		return this.each(function(){ this._jqmShown&&hide($(this), trigger); });
469	};
470
471
472	// utility functions
473
474	var
475		err = function(msg){
476			if(window.console && window.console.error) window.console.error(msg);
477
478
479	}, show = function(e, t){
480		/**
481		 * e = modal element (as jQuery object)
482		 * t = triggering element
483		 *
484		 * o = options
485		 * z = z-index of modal
486		 * v = overlay element (as jQuery object)
487		 * h = hash (for jqModal <= r15 compatibility)
488		 */
489
490		var o = e.data('jqm'),
491			t = t || window.event,
492			z = (parseInt(e.css('z-index')));
493
494			if(o.noOverlay === undefined || (o.noOverlay !== undefined && !o.noOverlay) ) {
495				if( isNaN(z) ) {
496					if( window['lastJqmZindex'] ) {
497						window['lastJqmZindex'] = z = window['lastJqmZindex'] + 2;
498					} else {
499						z = 3000;
500					}
501				}
502				window['lastJqmZindex'] = z;
503				var	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});
504				e.css('z-index',z);
505			} else {
506				var	v = $('');
507				e.css('z-index',2999);
508			}
509		
510			// maintain legacy "hash" construct
511			h = {w: e, c: o, o: v, t: t};
512
513
514		if(o.ajax){
515			var target = o.target || e,
516				url = o.ajax;
517
518			target = (typeof target == 'string') ? $(target,e) : $(target);
519			if(url.substr(0,1) == '@') url = $(t).attr(url.substring(1));
520
521			 // Load the Ajax Content (and once loaded);
522			   // Fire the onLoad callback (if exists),
523			   // Attach closing events to elements inside the modal that match the closingClass,
524			   // and Execute the jqModal default Open Callback
525			target.html(o.ajaxText).load(url,function(){
526				o.onLoad && o.onLoad.call(this,h);
527				open(h);
528			});
529		}
530		else { open(h); }
531
532	}, hide = function(e, t){
533		/**
534		 * e = modal element (as jQuery object)
535		 * t = triggering element
536		 *
537		 * o = options
538		 * h = hash (for jqModal <= r15 compatibility)
539		 */
540
541		var o = e.data('jqm'),
542			t = t || window.event,
543
544		// maintain legacy "hash" construct
545		h = {w: e, c: o, o: e.data('jqmv'), t: t};
546
547		close(h);
548
549	}, onShow = function(hash){
550		// onShow callback. Responsible for showing a modal and overlay.
551		//  return false to stop opening modal.
552
553		// hash object;
554	    //  w: (jQuery object) The modal element
555	    //  c: (object) The modal's options object
556	    //  o: (jQuery object) The overlay element
557	    //  t: (DOM object) The triggering element
558
559		// display the overlay (prepend to body) if not disabled
560
561		// prevent double click
562		if( hash.w[0]._jqmShown )
563			return false;
564		
565		if(hash.c.overlay > 0)
566			hash.o.prependTo('#popup_iframe_wrapper');
567
568		// make modal visible
569		hash.w.show();
570
571		// call focusFunc (attempts to focus on first input in modal)
572		$.jqm.focusFunc(hash.w);
573
574		return true;
575
576
577	}, onHide = function(hash){
578		// onHide callback. Responsible for hiding a modal and overlay.
579		//  return false to stop closing modal.
580
581		// hash object;
582	    //  w: (jQuery object) The modal element
583	    //  c: (object) The modal's options object
584	    //  o: (jQuery object) The overlay element
585	    //  t: (DOM object) The triggering element
586
587		// hide modal and if overlay, remove overlay.
588		hash.w.hide() && hash.o && hash.o.remove();
589
590		return true;
591
592
593	},  addTrigger = function(e, key, trigger){
594		// addTrigger: Adds a jqmShow or jqmHide (key) for a modal (e)
595		//  all elements that match trigger string (trigger)\
596
597		// return false if e is not an initialized modal element
598		if(!e.data('jqm')) return false;
599
600		return $(trigger).each(function(){
601			// register modal to trigger elements
602			this[key] = this[key] || [];
603			this[key].push(e);
604
605		}).click(function(){
606
607			var trigger = this;
608
609			// foreadh modal registered to this trigger, call jqmShow ||
610			//   jqmHide (key) on modal passing trigger element (e)
611			$.each(this[key], function(i, e){ e[key](trigger); });
612
613			// stop trigger click event from bubbling
614			return false;
615		});
616
617
618	},  open = function(h){
619		// open: executes the onOpen callback + performs common tasks if successful
620
621		// transform legacy hash into new var shortcuts
622		 var e = h.w,
623		 	v = h.o,
624		 	o = h.c;
625
626		// execute onShow callback
627		if(o.onShow(h) !== false){
628			// mark modal as shown
629			e[0]._jqmShown = true;
630
631			// if modal dialog
632			//
633			// Bind the Keep Focus Function [F] if no other Modals are open (!A[0]) +
634			// Add this modal to the opened modals stack (A) for nested modal support
635			//
636			// else, close dialog when overlay is clicked
637			if(o.modal){ !A[0]&&F('bind'); A.push(e); }
638            else e.jqmAddClose(v);
639
640			//  Attach closing events to elements inside the modal that match the closingClass
641			o.closeClass&&e.jqmAddClose($('.' + o.closeClass,e));
642
643			// IF toTop is true and overlay exists;
644			//  Add placeholder element <span id="jqmP#ID_of_modal"/> before modal to
645			//  remember it's position in the DOM and move it to a child of the body tag (after overlay)
646			o.toTop&&v&&e.before('<span id="jqmP'+o.ID+'"></span>').insertAfter(v);
647
648			// remember overlay (for closing function)
649			e.data('jqmv',v);
650		}
651
652
653	},  close = function(h){
654		// close: executes the onHide callback + performs common tasks if successful
655
656		// transform legacy hash into new var shortcuts
657		 var e = h.w,
658		 	v = h.o,
659		 	o = h.c;
660
661		// execute onShow callback
662		if(o.onHide(h) !== false){
663			// mark modal as !shown
664			e[0]._jqmShown = false;
665
666			 // If modal, remove from modal stack.
667			 // If no modals in modal stack, unbind the Keep Focus Function
668			 if(o.modal){A.pop();!A[0]&&F('unbind');}
669
670			 // IF toTop was passed and an overlay exists;
671			 //  Move modal back to its "remembered" position.
672			 o.toTop&&v&&$('#jqmP'+o.ID).after(e).remove();
673		}
674
675
676	},  F = function(t){
677		// F: The Keep Focus Function (for modal: true dialos)
678		// Binds or Unbinds (t) the Focus Examination Function (X) to keypresses and clicks
679
680		$(document)[t]("keypress keydown mousedown",X);
681
682
683	}, X = function(e){
684		// X: The Focus Examination Function (for modal: true dialogs)
685
686		var modal = $(e.target).data('jqm') || $(e.target).parents('.jqm-init:first').data('jqm'),
687			activeModal = A[A.length-1].data('jqm');
688
689		// allow bubbling if event target is within active modal dialog
690		if(modal && modal.ID == activeModal.ID) return true;
691
692		// else, trigger focusFunc (focus on first input element and halt bubbling)
693		return $.jqm.focusFunc(activeModal);
694	},
695
696	I = 0,   // modal ID increment (for nested modals)
697	A = [];  // array of active modals (used to lock interactivity to appropriate modal)
698
699
700	// $.jqm, overridable defaults
701	$.jqm = {
702		/**
703		 *  default options
704		 *
705		 * (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.
706		 * (String)    overlayClass - Applied to the body covering overlay. Useful for controlling overlay look (tint, background-image, &c) with CSS.
707		 * (String)    closeClass   - Children of the modal element matching `closeClass` will fire the onHide event (to close the modal).
708		 * (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.
709		 * (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">...)
710		 * (Mixed)     target       - Children of the modal element to load the aja
710x response into. If false, modal content will be overwritten by ajax response. Useful for retaining modal design.
711		 *                            Target may be a selector string, jQuery collection of elements, or a DOM element -- and MUST exist as a child of the modal element.
712		 * (String)    ajaxText     - Text shown while waiting for ajax return. Replaces HTML content of `target` element.
713		 * (Boolean)   modal        - If true, user interactivity will be locked to the modal window until closed.
714		 * (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.
715		 * (Function)  onShow       - User defined callback function fired when modal opened.
716		 * (Function)  onHide       - User defined callback function fired when modal closed.
717		 * (Function)  onLoad       - User defined callback function fired when ajax content loads.
718		 */
719		params: {
720			overlay: 50,
721			overlayClass: 'jqmOverlay',
722			closeClass: 'jqmClose',
723			trigger: '.jqModal',
724			ajax: false,
725			target: false,
726			ajaxText: '',
727			modal: false,
728			toTop: false,
729			onShow: onShow,
730			onHide: onHide,
731			onLoad: false
732		},
733
734		// focusFunc is fired when a modal is shown, or when interaction occurs outside
735		// a modal enabled dialog. Passed the modal element.
736		focusFunc: function(e) { $(':input:visible:first',e).focus(); return false; }
737	};
738
739})( jQuery );
740/* End */
741;
742; /* Start:"a:4:{s:4:"full";s:71:"/local/templates/aspro_max_local/vendor/js/bootstrap.js?162019756927908";s:6:"source";s:55:"/local/templates/aspro_max_local/vendor/js/bootstrap.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
743/*!
744 * Bootstrap v3.0.0
745 *
746 * Copyright 2013 Twitter, Inc
747 * Licensed under the Apache License v2.0
748 * http://www.apache.org/licenses/LICENSE-2.0
749 *
750 * Designed and built with all the love in the world @twitter by @mdo and @fat.
751 */
752
753+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(d)})},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(".
753item.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},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});
753d?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(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[
7530],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>m?"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;
753e||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)
754/* End */
755;
756; /* Start:"a:4:{s:4:"full";s:74:"/local/templates/aspro_max_local/vendor/js/jquery.appear.js?16201975693188";s:6:"source";s:59:"/local/templates/aspro_max_local/vendor/js/jquery.appear.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
757/*
758 * jQuery.appear
759 * https://github.com/bas2k/jquery.appear/
760 * http://code.google.com/p/jquery-appear/
761 *
762 * Copyright (c) 2009 Michael Hixson
763 * Copyright (c) 2012 Alexander Brovikov
764 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
765 */
766(function($) {
767	$.fn.appear = function(fn, options) {
768
769		var settings = $.extend({
770
771			//arbitrary data to pass to fn
772			data: undefined,
773
774			//call fn only on the first appear?
775			one: true,
776
777			// X & Y accuracy
778			accX: 0,
779			accY: 0
780
781		}, options);
782
783		return this.each(function() {
784
785			var t = $(this);
786
787			//whether the element is currently visible
788			t.appeared = false;
789
790			if (!fn) {
791
792				//trigger the custom event
793				t.trigger('appear', settings.data);
794				return;
795			}
796
797			var w = $(window);
798
799			//fires the appear event when appropriate
800			var check = function() {
801
802				//is the element hidden?
803				if (!t.is(':visible')) {
804
805					//it became hidden
806					t.appeared = false;
807					return;
808				}
809
810				//is the element inside the visible window?
811				var a = w.scrollLeft();
812				var b = w.scrollTop();
813				var o = t.offset();
814				var x = o.left;
815				var y = o.top;
816
817				var ax = settings.accX;
818				var ay = settings.accY;
819				var th = t.height();
820				var wh = w.height();
821				var tw = t.width();
822				var ww = w.width();
823
824				if (y + th + ay >= b &&
825					y <= b + wh + ay &&
826					x + tw + ax >= a &&
827					x <= a + ww + ax) {
828
829					//trigger the custom event
830					if (!t.appeared) t.trigger('appear', settings.data);
831
832				} else {
833
834					//it scrolled out of view
835					t.appeared = false;
836				}
837			};
838
839			//create a modified fn with some additional logic
840			var modifiedFn = function() {
841
842				//mark the element as visible
843				t.appeared = true;
844
845				//is this supposed to happen only once?
846				if (settings.one) {
847
848					//remove the check
849					w.unbind('scroll', check);
850					var i = $.inArray(check, $.fn.appear.checks);
851					if (i >= 0) $.fn.appear.checks.splice(i, 1);
852				}
853
854				//trigger the original fn
855				fn.apply(this, arguments);
856			};
857
858			//bind the modified fn to the element
859			if (settings.one) t.one('appear', settings.data, modifiedFn);
860			else t.bind('appear', settings.data, modifiedFn);
861
862			//check whenever the window scrolls
863			w.scroll(check);
864
865			//check whenever the dom changes
866			$.fn.appear.checks.push(check);
867
868			//check now
869			(check)();
870		});
871	};
872
873	//keep a queue of appearance checks
874	$.extend($.fn.appear, {
875
876		checks: [],
877		timeout: null,
878
879		//process the queue
880		checkAll: function() {
881			var length = $.fn.appear.checks.length;
882			if (length > 0) while (length--) ($.fn.appear.checks[length])();
883		},
884
885		//check the queue asynchronously
886		run: function() {
887			if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout);
888			$.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20);
889		}
890	});
891
892	//run checks when these methods are called
893	$.each(['append', 'prepend', 'after', 'before', 'attr',
894		'removeAttr', 'addClass', 'removeClass', 'toggleClass',
895		'remove', 'css', 'show', 'hide'], function(i, n) {
896		var old = $.fn[n];
897		if (old) {
898			$.fn[n] = function() {
899				var r = old.apply(this, arguments);
900				$.fn.appear.run();
901				return r;
902			}
903		}
904	});
905
906})(jQuery);
907/* End */
908;
909; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/aspro_max_local/vendor/js/ripple.js?16201975694702";s:6:"source";s:52:"/local/templates/aspro_max_local/vendor/js/ripple.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
910;(function($, document, Math){
911    $.ripple = function(selector, options) {
912
913        var self = this;
914
915        var _log = self.log = function() {
916            if(self.defaults.debug && console && console.log) {
917                console.log.apply(console, arguments);
918            }
919        };
920
921        self.selector = selector;
922        self.defaults = {
923            debug: false,
924            on: 'mousedown',
925
926            opacity: 0.4,
927            color: "auto",
928            multi: false,
929
930            duration: 0.7,
931            rate: function(pxPerSecond) {
932                return pxPerSecond;
933            },
934
935            easing: 'linear'
936        };
937
938        self.defaults = $.extend({}, self.defaults, options);
939
940        var Trigger = function(e) {
941
942            var $this = $(this);
943            var $ripple;
944            var settings;
945
946            $this.addClass('has-ripple');
947
948            // This instances settings
949            settings = $.extend({}, self.defaults, $this.data());
950
951            // Create the ripple element
952            if ( settings.multi || (!settings.multi && $this.find(".ripple").length === 0) ) {
953                $ripple = $("<span></span>").addClass("ripple");
954                $ripple.appendTo($this);
955
956                _log('Create: Ripple');
957
958                // Set ripple size
959                if (!$ripple.height() && !$ripple.width()) {
960                    var size = Math.max($this.outerWidth(), $this.outerHeight());
961                    $ripple.css({
962                        height: size,
963                        width: size
964                    });
965                    _log('Set: Ripple size');
966                }
967
968                // Give the user the ability to change the rate of the animation
969                // based on element width
970                if(settings.rate && typeof settings.rate == "function") {
971
972                    // rate = pixels per second
973                    var rate = Math.round( $ripple.width() / settings.duration );
974
975                    // new amount of pixels per second
976                    var filteredRate = settings.rate(rate);
977
978                    // Determine the new duration for the animation
979                    var newDuration = ( $ripple.width() / filteredRate);
980
981                    // Set the new duration if it has not changed
982                    if(settings.duration.toFixed(2) !== newDuration.toFixed(2)) {
983                        _log('Update: Ripple Duration', {
984                            from: settings.duration,
985                            to: newDuration
986                        });
987                        settings.duration = newDuration;
988                    }
989                }
990
991                // Set the color and opacity
992                var color = (settings.color == "auto") ? $this.css('color') : settings.color;
993                var css = {
994                    animationDuration: (settings.duration).toString() + 's',
995                    animationTimingFunction: settings.easing,
996                    background: color,
997                    opacity: settings.opacity
998                };
999
1000                _log('Set: Ripple CSS', css);
1001                $ripple.css(css);
1002            }
1003
1004            // Ensure we always have the ripple element
1005            if(!settings.multi) {
1006                _log('Set: Ripple Element');
1007                $ripple = $this.find(".ripple");
1008            }
1009
1010            // Kill animation
1011            _log('Destroy: Ripple Animation');
1012            $ripple.removeClass("ripple-animate");
1013
1014
1015            // Retrieve coordinates
1016            var x = e.pageX - $this.offset().left - $ripple.width() / 2;
1017            var y = e.pageY - $this.offset().top - $ripple.height() / 2;
1018
1019            /**
1020             * We want to delete the ripple elements if we allow multiple so we dont sacrifice any page
1021             * performance. We don't do this on single ripples because once it has rendered, we only
1022             * need to trigger paints thereafter.
1023             */
1024            if(settings.multi) {
1025                _log('Set: Ripple animationend event');
1026                $ripple.one('animationend webkitAnimationEnd oanimationend MSAnimationEnd', function() {
1027                    _log('Note: Ripple animation ended');
1028                    _log('Destroy: Ripple');
1029                    $(this).remove();
1030                });
1031            }
1032
1033            // Set position and animate
1034            _log('Set: Ripple location');
1035            _log('Set: Ripple animation');
1036            $ripple.css({
1037                top: y + 'px',
1038                left: x + 'px'
1039            }).addClass("ripple-animate");
1040        };
1041
1042        $(document).on(self.defaults.on, self.selector, Trigger);
1043    };
1044})(jQuery, document, Math);
1045
1046/* End */
1047;
1048; /* Start:"a:4:{s:4:"full";s:79:"/local/templates/aspro_max_local/vendor/js/velocity/velocity.js?162019756944791";s:6:"source";s:63:"/local/templates/aspro_max_local/vendor/js/velocity/velocity.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1049/*! VelocityJS.org (1.5.0). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */
1050/*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */
1051!function(a){"use strict";function b(a){var b=a.length,d=c.type(a);return"function"!==d&&!c.isWindow(a)&&(!(1!==a.nodeType||!b)||("array"===d||0===b||"number"==typeof b&&b>0&&b-1 in a))}if(!a.jQuery){var c=function(a,b){return new c.fn.init(a,b)};c.isWindow=function(a){return a&&a===a.window},c.type=function(a){return a?"object"==typeof a||"function"==typeof a?e[g.call(a)]||"object":typeof a:a+""},c.isArray=Array.isArray||function(a){return"array"===c.type(a)},c.isPlainObject=function(a){var b;if(!a||"object"!==c.type(a)||a.nodeType||c.isWindow(a))return!1;try{if(a.constructor&&!f.call(a,"constructor")&&!f.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(d){return!1}for(b in a);return b===undefined||f.call(a,b)},c.each=function(a,c,d){var e=0,f=a.length,g=b(a);if(d){if(g)for(;e<f&&c.apply(a[e],d)!==!1;e++);else for(e in a)if(a.hasOwnProperty(e)&&c.apply(a[e],d)===!1)break}else if(g)for(;e<f&&c.call(a[e],e,a[e])!==!1;e++);else for(e in a)if(a.hasOwnProperty(e)&&c.call(a[e],e,a[e])===!1)break;return a},c.data=function(a,b,e){if(e===undefined){var f=a[c.expando],g=f&&d[f];if(b===undefined)return g;if(g&&b in g)return g[b]}else if(b!==undefined){var h=a[c.expando]||(a[c.expando]=++c.uuid);return d[h]=d[h]||{},d[h][b]=e,e}},c.removeData=function(a,b){var e=a[c.expando],f=e&&d[e];f&&(b?c.each(b,function(a,b){delete f[b]}):delete d[e])},c.extend=function(){var a,b,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[i]||{},i++),"object"!=typeof h&&"function"!==c.type(h)&&(h={}),i===j&&(h=this,i--);i<j;i++)if(f=arguments[i])for(e in f)f.hasOwnProperty(e)&&(a=h[e],d=f[e],h!==d&&(k&&d&&(c.isPlainObject(d)||(b=c.isArray(d)))?(b?(b=!1,g=a&&c.isArray(a)?a:[]):g=a&&c.isPlainObject(a)?a:{}
vendor: 30,293 bytes, lines 1051-1052
1051,h[e]=c.extend(k,g,d)):d!==undefined&&(h[e]=d)));return h},c.queue=function(a,d,e){if(a){d=(d||"fx")+"queue";var f=c.data(a,d);return e?(!f||c.isArray(e)?f=c.data(a,d,function(a,c){var d=c||[];return a&&(b(Object(a))?function(a,b){for(var c=+b.length,d=0,e=a.length;d<c;)a[e++]=b[d++];if(c!==c)for(;b[d]!==undefined;)a[e++]=b[d++];a.length=e,a}(d,"string"==typeof a?[a]:a):[].push.call(d,a)),d}(e)):f.push(e),f):f||[]}},c.dequeue=function(a,b){c.each(a.nodeType?[a]:a,function(a,d){b=b||"fx";var e=c.queue(d,b),f=e.shift();"inprogress"===f&&(f=e.shift()),f&&("fx"===b&&e.unshift("inprogress"),f.call(d,function(){c.dequeue(d,b)}))})},c.fn=c.prototype={init:function(a){if(a.nodeType)return this[0]=a,this;throw new Error("Not a DOM node.")},offset:function(){var b=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:b.top+(a.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:b.left+(a.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){var a=this[0],b=function(a){for(var b=a.offsetParent;b&&"html"!==b.nodeName.toLowerCase()&&b.style&&"static"===b.style.position;)b=b.offsetParent;return b||document}(a),d=this.offset(),e=/^(?:body|html)$/i.test(b.nodeName)?{top:0,left:0}:c(b).offset();return d.top-=parseFloat(a.style.marginTop)||0,d.left-=parseFloat(a.style.marginLeft)||0,b.style&&(e.top+=parseFloat(b.style.borderTopWidth)||0,e.left+=parseFloat(b.style.borderLeftWidth)||0),{top:d.top-e.top,left:d.left-e.left}}};var d={};c.expando="velocity"+(new Date).getTime(),c.uuid=0;for(var e={},f=e.hasOwnProperty,g=e.toString,h="Boolean Number String Function Array Date RegExp Object Error".split(" "),i=0;i<h.length;i++)e["[object "+h[i]+"]"]=h[i].toLowerCase();c.fn.init.prototype=c.fn,a.Velocity={Utilities:c}}}(window),function(a){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a():"function"==typeof define&&define.amd?define(a):a()}(function(){"use strict";return function(a,b,c,d){function e(a){for(var b=-1,c=a?a.length:0,d=[];++b<c;){var e=a[b];e&&d.push(e)}return d}function f(a){return u.isWrapped(a)?a=s.call(a):u.isNode(a)&&(a=[a]),a}function g(a){var b=o.data(a,"velocity");return null===b?d:b}function h(a,b){var c=g(a);c&&c.delayTimer&&!c.delayPaused&&(c.delayRemaining=c.delay-b+c.delayBegin,c.delayPaused=!0,clearTimeout(c.delayTimer.setTimeout))}function i(a,b){var c=g(a);c&&c.delayTimer&&c.delayPaused&&(c.delayPaused=!1,c.delayTimer.setTimeout=setTimeout(c.delayTimer.next,c.delayRemaining))}function j(a){return function(b){return Math.round(b*a)*(1/a)}}function k(a,c,d,e){function f(a,b){return 1-3*b+3*a}function g(a,b){return 3*b-6*a}function h(a){return 3*a}function i(a,b,c){return((f(b,c)*a+g(b,c))*a+h(b))*a}function j(a,b,c){return 3*f(b,c)*a*a+2*g(b,c)*a+h(b)}function k(b,c){for(var e=0;e<p;++e){var f=j(c,a,d);if(0===f)return c;c-=(i(c,a,d)-b)/f}return c}function l(){for(var b=0;b<t;++b)x[b]=i(b*u,a,d)}function m(b,c,e){var f,g,h=0;do{g=c+(e-c)/2,f=i(g,a,d)-b,f>0?e=g:c=g}while(Math.abs(f)>r&&++h<s);return g}function n(b){for(var c=0,e=1,f=t-1;e!==f&&x[e]<=b;++e)c+=u;--e;var g=(b-x[e])/(x[e+1]-x[e]),h=c+g*u,i=j(h,a,d);return i>=q?k(b,h):0===i?h:m(b,c,c+u)}function o(){y=!0,a===c&&d===e||l()}var p=4,q=.001,r=1e-7,s=10,t=11,u=1/(t-1),v="Float32Array"in b;if(4!==arguments.length)return!1;for(var w=0;w<4;++w)if("number"!=typeof arguments[w]||isNaN(arguments[w])||!isFinite(arguments[w]))return!1;a=Math.min(a,1),d=Math.min(d,1),a=Math.max(a,0),d=Math.max(d,0);var x=v?new Float32Array(t):new Array(t),y=!1,z=function(b){return y||o(),a===c&&d===e?b:0===b?0:1===b?1:i(n(b),c,e)};z.getControlPoints=function(){return[{x:a,y:c},{x:d,y:e}]};var A="generateBezier("+[a,c,d,e]+")";return z.toString=function(){return A},z}function l(a,b){var c=a;return u.isString(a)?y.Easings[a]||(c=!1):c=u.isArray(a)&&1===a.length?j.apply(null,a):u.isArray(a)&&2===a.length?z.apply(null,a.concat([b])):!(!u.isArray(a)||4!==a.length)&&k.apply(null,a),c===!1&&(c=y.Easings[y.defaults.easing]?y.defaults.easing:x),c}function m(a){if(a){var b=y.timestamp&&a!==!0?a:r.now(),c=y.State.calls.length;c>1e4&&(y.State.calls=e(y.State.calls),c=y.State.calls.length);for(var f=0;f<c;f++)if(y.State.calls[f]){var h=y.State.calls[f],i=h[0],j=h[2],k=h[3],l=!!k,q=null,s=h[5],t=h[6];if(k||(k=y.State.calls[f][3]=b-16),s){if(s.resume!==!0)continue;k=h[3]=Math.round(b-t-16),h[5]=null}t=h[6]=b-k;for(var v=Math.min(t/j.duration,1),w=0,x=i.length;w<x;w++){var z=i[w],B=z.element;if(g(B)){var D=!1;if(j.display!==d&&null!==j.display&&"none"!==j.display){if("flex"===j.display){var E=["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"];o.each(E,function(a,b){A.setPropertyValue(B,"display",b)})}A.setPropertyValue(B,"display",j.display)}j.visibility!==d&&"hidden"!==j.visibility&&A.setPropertyValue(B,"visibility",j.visibility);for(var F in z)if(z.hasOwnProperty(F)&&"element"!==F){var G,H=z[F],I=u.isString(H.easing)?y.Easings[H.easing]:H.easing;if(u.isString(H.pattern)){var J=1===v?function(a,b,c){var d=H.endValue[b];return c?Math.round(d):d}:function(a,b,c){var d=H.startValue[b],e=H.endValue[b]-d,f=d+e*I(v,j,e);return c?Math.round(f):f};G=H.pattern.replace(/{(\d+)(!)?}/g,J)}else if(1===v)G=H.endValue;else{var K=H.endValue-H.startValue;G=H.startValue+K*I(v,j,K)}if(!l&&G===H.currentValue)continue;if(H.currentValue=G,"tween"===F)q=G;else{var L;if(A.Hooks.registered[F]){L=A.Hooks.getRoot(F);var M=g(B).rootPropertyValueCache[L];M&&(H.rootPropertyValue=M)}var N=A.setPropertyValue(B,F,H.currentValue+(p<9&&0===parseFloat(G)?"":H.unitType),H.rootPropertyValue,H.scrollData);A.Hooks.registered[F]&&(A.Normalizations.registered[L]?g(B).rootPropertyValueCache[L]=A.Normalizations.registered[L]("extract",null,N[1]):g(B).rootPropertyValueCache[L]=N[1]),"transform"===N[0]&&(D=!0)}}j.mobileHA&&g(B).transformCache.translate3d===d&&(g(B).transformCache.translate3d="(0px, 0px, 0px)",D=!0),D&&A.flushTransformCache(B)}}j.display!==d&&"none"!==j.display&&(y.State.calls[f][2].display=!1),j.visibility!==d&&"hidden"!==j.visibility&&(y.State.calls[f][2].visibility=!1),j.progress&&j.progress.call(h[1],h[1],v,Math.max(0,k+j.duration-b),k,q),1===v&&n(f)}}y.State.isTicking&&C(m)}function n(a,b){if(!y.State.calls[a])return!1;for(var c=y.State.calls[a][0],e=y.State.calls[a][1],f=y.State.calls[a][2],h=y.State.calls[a][4],i=!1,j=0,k=c.length;j<k;j++){var l=c[j].element;b||f.loop||("none"===f.display&&A.setPropertyValue(l,"display",f.display),"hidden"===f.visibility&&A.setPropertyValue(l,"visibility",f.visibility));var m=g(l);if(f.loop!==!0&&(o.queue(l)[1]===d||!/\.velocityQueueEntryFlag/i.test(o.queue(l)[1]))&&m){m.isAnimating=!1,m.rootPropertyValueCache={};var n=!1;o.each(A.Lists.transforms3D,function(a,b){var c=/^scale/.test(b)?1:0,e=m.transformCache[b];m.transformCache[b]!==d&&new RegExp("^\\("+c+"[^.]").test(e)&&(n=!0,delete m.transformCache[b])}),f.mobileHA&&(n=!0,delete m.transformCache.translate3d),n&&A.flushTransformCache(l),A.Values.removeClass(l,"velocity-animating")}if(!b&&f.complete&&!f.loop&&j===k-1)try{f.complete.call(e,e)}catch(r){setTimeout(function(){throw r},1)}h&&f.loop!==!0&&h(e),m&&f.loop===!0&&!b&&(o.each(m.tweensContainer,function(a,b){if(/^rotate/.test(a)&&(parseFloat(b.startValue)-parseFloat(b.endValue))%360==0){var c=b.startValue;b.startValue=b.endValue,b.endValue=c}/^backgroundPosition/.test(a)&&100===parseFloat(b.endValue)&&"%"===b.unitType&&(b.endValue=0,b.startValue=100)}),y(l,"reverse",{loop:!0,delay:f.delay})),f.queue!==!1&&o.dequeue(l,f.queue)}y.State.calls[a]=!1;for(var p=0,q=y.State.calls.length;p<q;p++)if(y.State.calls[p]!==!1){i=!0;break}i===!1&&(y.State.isTicking=!1,delete y.State.calls,y.State.calls=[])}var o,p=function(){if(c.documentMode)return c.documentMode;for(var a=7;a>4;a--){var b=c.createElement("div");if(b.innerHTML="<!--[if IE "+a+"]><span></span><![endif]-->",b.getElementsByTagName("span").length)return b=null,a}return d}(),q=function(){var a=0;return b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame||function(b){var c,d=(new Date).getTime();return c=Math.max(0,16-(d-a)),a=d+c,setTimeout(function(){b(d+c)},c)}}(),r=function(){var a=b.performance||{};if("function"!=typeof a.now){var c=a.timing&&a.timing.navigationStart?a.timing.navigationStart:(new Date).getTime();a.now=function(){return(new Date).getTime()-c}}return a}(),s=function(){var a=Array.prototype.slice;try{return a.call(c.documentElement),a}catch(b){return function(b,c){var d=this.length;if("number"!=typeof b&&(b=0),"number"!=typeof c&&(c=d),this.slice)return a.call(this,b,c);var e,f=[],g=b>=0?b:Math.max(0,d+b),h=c<0?d+c:Math.min(c,d),i=h-g;if(i>0)if(f=new Array(i),this.charAt)for(e=0;e<i;e++)f[e]=this.charAt(g+e);else for(e=0;e<i;e++)f[e]=this[g+e];return f}}}(),t=function(){return Array.prototype.includes?function(a,b){return a.includes(b)}:Array.prototype.indexOf?function(a,b){return a.indexOf(b)>=0}:function(a,b){for(var c=0;c<a.length;c++)if(a[c]===b)return!0;return!1}},u={isNumber:function(a){return"number"==typeof a},isString:function(a){return"string"==typeof a},isArray:Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},isFunction:function(a){return"[object Function]"===Object.prototype.toString.call(a)},isNode:function(a){return a&&a.nodeType},isWrapped:function(a){return a&&a!==b&&u.isNumber(a.length)&&!u.isString(a)&&!u.isFunction(a)&&!u.isNode(a)&&(0===a.length||u.isNode(a[0]))},isSVG:function(a){return b.SVGElement&&a instanceof b.SVGElement},isEmptyObject:function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}},v=!1;if(a.fn&&a.fn.jquery?(o=a,v=!0):o=b.Velocity.Utilities,p<=8&&!v)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(p<=7)return void(jQuery.fn.velocity=jQuery.fn.animate);var w=400,x="swing",y={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),isAndroid:/Android/i.test(navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(navigator.userAgent),isChrome:b.chrome,isFirefox:/Firefox/i.test(navigator.userAgent),prefixElement:c.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[],delayedElements:{count:0}},CSS:{},Utilities:o,Redirects:{},Easings:{},Promise:b.Promise,defaults:{queue:"",duration:w,easing:x,begin:d,complete:d,progress:d,display:d,visibility:d,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0,promiseRejectEmpty:!0},init:function(a){o.data(a,"velocity",{isSVG:u.isSVG(a),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:5,patch:0},debug:!1,timestamp:!0,pauseAll:function(a){var b=(new Date).getTime();o.each(y.State.calls,function(b,c){if(c){if(a!==d&&(c[2].queue!==a||c[2].queue===!1))return!0;c[5]={resume:!1}}}),o.each(y.State.delayedElements,function(a,c){c&&h(c,b)})},resumeAll:function(a){var b=(new Date).getTime();o.each(y.State.calls,function(b,c){if(c){if(a!==d&&(c[2].queue!==a||c[2].queue===!1))return!0;c[5]&&(c[5].resume=!0)}}),o.each(y.State.delayedElements,function(a,c){c&&i(c,b)})}};b.pageYOffset!==d?(y.State.scrollAnchor=b,y.State.scrollPropertyLeft="pageXOffset",y.State.scrollPropertyTop="pageYOffset"):(y.State.scrollAnchor=c.documentElement||c.body.parentNode||c.body,y.State.scrollPropertyLeft="scrollLeft",y.State.scrollPropertyTop="scrollTop");var z=function(){function a(a){return-a.tension*a.x-a.friction*a.v}function b(b,c,d){var e={x:b.x+d.dx*c,v:b.v+d.dv*c,tension:b.tension,friction:b.friction};return{dx:e.v,dv:a(e)}}function c(c,d){var e={dx:c.v,dv:a(c)},f=b(c,.5*d,e),g=b(c,.5*d,f),h=b(c,d,g),i=1/6*(e.dx+2*(f.dx+g.dx)+h.dx),j=1/6*(e.dv+2*(f.dv+g.dv)+h.dv);return c.x=c.x+i*d,c.v=c.v+j*d,c}return function d(a,b,e){var f,g,h,i={x:-1,v:0,tension:null,friction:null},j=[0],k=0;for(a=parseFloat(a)||500,b=parseFloat(b)||20,e=e||null,i.tension=a,i.friction=b,f=null!==e,f?(k=d(a,b),g=k/e*.016):g=.016;;)if(h=c(h||i,g),j.push(1+h.x),k+=16,!(Math.abs(h.x)>1e-4&&Math.abs(h.v)>1e-4))break;return f?function(a){return j[a*(j.length-1)|0]}:k}}();y.Easings={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},spring:function(a){return 1-Math.cos(4.5*a*Math.PI)*Math.exp(6*-a)}},o.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(a,b){y.Easings[b[0]]=k.apply(null,b[1])});var A=y.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"],units:["%","em","ex","ch","rem","vw","vh","vmin","vmax","cm","mm","Q","in","pc","pt","px","deg","grad","rad","turn","s","ms"],colorNames:{aliceblue:"240,248,255",antiquewhite:"250,235,215",aquamarine:"127,255,212",aqua:"0,255,255",azure:"240,255,255",beige:"245,245,220",bisque:"255,228,196",black:"0,0,0",blanchedalmond:"255,235,205",blueviolet:"138,43,226",blue:"0,0,255",brown:"165,42,42",burlywood:"222,184,135",cadetblue:"95,158,160",chartreuse:"127,255,0",chocolate:"210,105,30",coral:"255,127,80",cornflowerblue:"100,149,237",cornsilk:"255,248,220",crimson:"220,20,60",cyan:"0,255,255",darkblue:"0,0,139",darkcyan:"0,139,139",darkgoldenrod:"184,134,11",darkgray:"169,169,169",darkgrey:"169,169,169",darkgreen:"0,100,0",darkkhaki:"189,183,107",darkmagenta:"139,0,139",darkolivegreen:"85,107,47",darkorange:"255,140,0",darkorchid:"153,50,204",darkred:"139,0,0",darksalmon:"233,150,122",darkseagreen:"143,188,143",darkslateblue:"72,61,139",darkslategray:"47,79,79",darkturquoise:"0,206,209",darkviolet:"148,0,211",deeppink:"255,20,147",deepskyblue:"0,191,255",dimgray:"105,105,105",dimgrey:"105,105,105",dodgerblue:"30,144,255",firebrick:"178,34,34",floralwhite:"255,250,240",forestgreen:"34,139,34",fuchsia:"255,0,255",gainsboro:"220,220,220",ghostwhite:"248,248,255",gold:"255,215,0",goldenrod:"218,165,32",gray:"128,128,128",grey:"128,128,128",greenyellow:"173,255,47",green:"0,128,0",honeydew:"240,255,240",hotpink:"255,105,180",indianred:"205,92,92",indigo:"75,0,130",ivory:"255,255,240",khaki:"240,230,140",lavenderblush:"255,240,245",lavender:"230,230,250",lawngreen:"124,252,0",lemonchiffon:"255,250,205",lightblue:"173,216,230",lightcoral:"240,128,128",lightcyan:"224,255,255",lightgoldenrodyellow:"250,250,210",lightgray:"211,211,211",lightgrey:"211,211,211",lightgreen:"144,238,144",lightpink:"255,182,193",lightsalmon:"255,160,122",lightseagreen:"32,178,170",lightskyblue:"135,206,250",lightslategray:"119,136,153",lightsteelblue:"176,196,222",lightyellow:"255,255,224",limegreen:"50,205,50",lime:"0,255,0",linen:"250,240,230",magenta:"255,0,255",maroon:"128,0,0",mediumaquamarine:"102,205,170",mediumblue:"0,0,205",mediumorchid:"186,85,211",mediumpurple:"147,112,219",mediumseagreen:"60,179,113",mediumslateblue:"123,104,238",mediumspringgreen:"0,250,154",mediumturquoise:"72,209,204",mediumvioletred:"199,21,133",midnightblue:"25,25,112",mintcream:"245,255,250",mistyrose:"255,228,225",moccasin:"255,228,181",navajowhite:"255,222,173",navy:"0,0,128",oldlace:"253,245,230",olivedrab:"107,142,35",olive:"128,128,0",orangered:"255,69,0",orange:"255,165,0",orchid:"218,112,214",palegoldenrod:"238,232,170",palegreen:"152,251,152",paleturquoise:"175,238,238",palevioletred:"219,112,147",papayawhip:"255,239,213",peachpuff:"255,218,185",peru:"205,133,63",pink:"255,192,203",plum:"221,160,221",powderblue:"176,224,230",purple:"128,0,128",red:"255,0,0",rosybrown:"188,143,143",royalblue:"65,105,225",saddlebrown:"139,69,19",salmon:"250,128,114",sandybrown:"244,164,96",seagreen:"46,139,87",seashell:"255,245,238",sienna:"160,82,45",silver:"192,192,192",skyblue:"135,206,235",slateblue:"106,90,205",slategray:"112,128,144",snow:"255,250,250",springgreen:"0,255,127",steelblue:"70,130,180",tan:"210,180,140",teal:"0,128,128",thistle:"216,191,216",tomato:"255,99,71",turquoise:"64,224,208",violet:"238,130,238",wheat:"245,222,179",whitesmoke:"245,245,245",white:"255,255,255",yellowgreen:"154,205,50",yellow:"255,255,0"}},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var a=0;a<A.Lists.colors.length;a++){var b="color"===A.Lists.colors[a]?"0 0 0 1":"255 255 255 1";A.Hooks.templates[A.Lists.colors[a]]=["Red Green Blue Alpha",b]}var c,d,e;if(p)for(c in A.Hooks.templates)if(A.Hooks.templates.hasOwnProperty(c)){d=A.Hooks.templates[c],e=d[0].split(" ");var f=d[1].match(A.RegEx.valueSplit);"Color"===e[0]&&(e.push(e.shift()),f.push(f.shift()),A.Hooks.templates[c]=[e.join(" "),f.join(" ")])}for(c in A.Hooks.templates)if(A.Hooks.templates.hasOwnProperty(c)){d=A.Hooks.templates[c],e=d[0].split(" ");for(var g in e)if(e.hasOwnProperty(g)){var h=c+e[g],i=g;A.Hooks.registered[h]=[c,i]}}},getRoot:function(a){var b=A.Hooks.registered[a];return b?b[0]:a},getUnit:function(a,b){var c=(a.substr(b||0,5).match(/^[a-z%]+/)||[])[0]||"";return c&&t(A.Lists.units,c)?c:""},fixColors:function(a){return a.replace(/(rgba?\(\s*)?(\b[a-z]+\b)/g,function(a,b,c){return A.Lists.colorNames.hasOwnProperty(c)?(b?b:"rgba(")+A.Lists.colorNames[c]+(b?"":",1)"):b+c})},cleanRootPropertyValue:function(a,b){return A.RegEx.valueUnwrap.test(b)&&(b=b.match(A.RegEx.valueUnwrap)[1]),A.Values.isCSSNullValue(b)&&(b=A.Hooks.templates[a][1]),b},extractValue:function(a,b){var c=A.Hooks.registered[a];if(c){var d=c[0],e=c[1];return b=A.Hooks.cleanRootPropertyValue(d,b),b.toString().match(A.RegEx.valueSplit)[e]}return b},injectValue:function(a,b,c){var d=A.Hooks.registered[a];if(d){var e,f=d[0],g=d[1];return c=A.Hooks.cleanRootPropertyValue(f,c),e=c.toString().match(A.RegEx.valueSplit),e[g]=b,e.join(" ")}return c}},Normalizations:{registered:{clip:function(a,b,c){switch(a){case"name":return"clip";case"extract":var d;return A.RegEx.wrappedValueAlreadyExtracted.test(c)?d=c:(d=c.toString().match(A.RegEx.valueUnwrap),d=d?d[1].replace(/,(\s+)?/g," "):c),d;case"inject":return"rect("+c+")"}},blur:function(a,b,c){switch(a){case"name":return y.State.isFirefox?"filter":"-webkit-filter";case"extract":var d=parseFloat(c);if(!d&&0!==d){var e=c.toString().match(/blur\(([0-9]+[A-z]+)\)/i);d=e?e[1]:0}return d;case"inject":return parseFloat(c)?"blur("+c+")":"none"}},opacity:function(a,b,c){if(p<=8)switch(a){case"name":return"filter";case"extract":var d=c.toString().match(/alpha\(opacity=(.*)\)/i);return c=d?d[1]/100:1;case"inject":return b.style.zoom=1,parseFloat(c)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(c),10)+")"}else switch(a){case"name":return"opacity";case"extract":return c;case"inject":return c}}},register:function(){function a(a,b,c){if("border-box"===A.getPropertyValue(b,"boxSizing").toString().toLowerCase()===(c||!1)){var d,e,f=0,g="width"===a?["Left","Right"]:["Top","Bottom"],h=["padding"+g[0],"padding"+g[1],"border"+g[0]+"Width","border"+g[1]+"Width"];for(d=0;d<h.length;d++)e=parseFloat(A.getPropertyValue(b,h[d])),isNaN(e)||(f+=e);return c?-f:f}return 0}function b(b,c){return function(d,e,f){switch(d){case"name":return b;case"extract":return parseFloat(f)+a(b,e,c);case"inject":return parseFloat(f)-a(b,e,c)+"px"}}}p&&!(p>9)||y.State.isGingerbread||(A.Lists.transformsBase=A.Lists.transformsBase.concat(A.Lists.transforms3D));for(var c=0;c<A.Lists.transformsBase.length;c++)!function(){var a=A.Lists.transformsBase[c];A.Normalizations.registered[a]=function(b,c,e){switch(b){case"name":return"transform";case"extract":return g(c)===d||g(c).transformCache[a]===d?/^scale/i.test(a)?1:0:g(c).transformCache[a].replace(/[()]/g,"");case"inject":var f=!1;switch(a.substr(0,a.length-1)){case"translate":f=!/(%|px|em|rem|vw|vh|\d)$/i.test(e);break;case"scal":case"scale":y.State.isAndroid&&g(c).transformCache[a]===d&&e<1&&(e=1),f=!/(\d)$/i.test(e);break;case"skew":f=!/(deg|\d)$/i.test(e);break;case"rotate":f=!/(deg|\d)$/i.test(e)}return f||(g(c).transformCache[a]="("+e+")"),g(c).transformCache[a]}}}();for(var e=0;e<A.Lists.colors.length;e++)!function(){var a=A.Lists.colors[e];A.Normalizations.registered[a]=function(b,c,e){switch(b){case"name":return a;case"extract":var f;if(A.RegEx.wrappedValueAlreadyExtracted.test(e))f=e;else{var g,h={black:"rgb(0, 0, 0)",blue:"rgb(0, 0, 255)",gray:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",red:"rgb(255, 0, 0)",white:"rgb(255, 255, 255)"};/^[A-z]+$/i.test(e)?g=h[e]!==d?h[e]:h.black:A.RegEx.isHex.test(e)?g="rgb("+A.Values.hexToRgb(e).join(" ")+")":/^rgba?\(/i.test(e)||(g=h.black),f=(g||e).toString().match(A.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g," ")}return(!p||p>8)&&3===f.split(" ").length&&(f+=" 1"),f;case"inject":return/^rgb/.test(e)?e:(p<=8?4===e.split(" ").length&&(e=e.split(/\s+/).slice(0,3).join(" ")):3===e.split(" ").length&&(e+=" 1"),(p<=8?"rgb":"rgba")+"("+e.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")")}}}();A.Normalizations.registered.innerWidth=b("width",!0),A.Normalizations.registered.innerHeight=b("height",!0),A.Normalizations.registered.outerWidth=b("width"),A.Normalizations.registered.outerHeight=b("height")}},Names:{camelCase:function(a){return a.replace(/-(\w)/g,function(a,b){return b.toUpperCase()})},SVGAttribute:function(a){var b="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(p||y.State.isAndroid&&!y.State.isChrome)&&(b+="|transform"),new RegExp("^("+b+")$","i").test(a)},prefixCheck:function(a){if(y.State.prefixMatches[a])return[y.State.prefixMatches[a],!0];for(var b=["","Webkit","Moz","ms","O"],c=0,d=b.length;c<d;c++){var e;if(e=0===c?a:b[c]+a.replace(/^\w/,function(a){return a.toUpperCase()}),u.isString(y.State.prefixElement.style[e]))return y.State.prefixMatches[a]=e,[e,!0]}return[a,!1]}},Values:{hexToRgb:function(a){var b,c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i;return a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,b,c,d){return b+b+c+c+d+d}),b=c.exec(a),b?[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16)]:[0,0,0]},isCSSNullValue:function(a){return!a||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(a)},getUnitType:function(a){return/^(rotate|skew)/i.test(a)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(a)?"":"px"},getDisplayType:function(a){var b=a&&a.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(b)?"inline":/^(li)$/i.test(b)?"list-item":/^(tr)$/i.test(b)?"table-row":/^(table)$/i.test(b)?"table":/^(tbody)$/i.test(b)?"table-row-group":"block"},addClass:function(a,b){if(a)if(a.classList)a.classList.add(b);else if(u.isString(a.className))a.className+=(a.className.length?" ":"")+b;else{var c=a.getAttribute(p<=7?"className":"class")||"";a.setAttribute("class",c+(c?" ":"")+b)}},removeClass:function(a,b){if(a)if(a.classList)a.classList.remove(b);else if(u.isString(a.className))a.className=a.className.toString().replace(new RegExp("(^|\\s)"+b.split(" ").join("|")+"(\\s|$)","gi")," ");else{var c=a.getAttribute(p<=7?"className":"class")||"";a.setAttribute("class",c.replace(new RegExp("(^|s)"+b.split(" ").join("|")+"(s|$)","gi")," "))}}},getPropertyValue:function(a,c,e,f){function h(a,c){var e=0;if(p<=8)e=o.css(a,c);else{var i=!1;/^(width|height)$/.test(c)&&0===A.getPropertyValue(a,"display")&&(i=!0,A.setPropertyValue(a,"display",A.Values.getDisplayType(a)));var j=function(){i&&A.setPropertyValue(a,"display","none")};if(!f){if("height"===c&&"border-box"!==A.getPropertyValue(a,"boxSizing").toString().toLowerCase()){var k=a.offsetHeight-(parseFloat(A.getPropertyValue(a,"borderTopWidth"))||0)-(parseFloat(A.getPropertyValue(a,"borderBottomWidth"))||0)-(parseFloat(A.getPropertyValue(a,"paddingTop"))||0)-(parseFloat(A.getPropertyValue(a,"paddingBottom"))||0);return j(),k}if("width"===c&&"border-box"!==A.getPropertyValue(a,"boxSizing").toString().toLowerCase()){var l=a.offsetWidth-(parseFloat(A.getPropertyValue(a,"borderLeftWidth"))||0)-(parseFloat(A.getPropertyValue(a,"borderRightWidth"))||0)-(parseFloat(A.getPropertyValue(a,"paddingLeft"))||0)-(parseFloat(A.getPropertyValue(a,"paddingRight"))||0);return j(),l}}var m;m=g(a)===d?b.getComputedStyle(a,null):g(a).computedStyle?g(a).computedStyle:g(a).computedStyle=b.getComputedStyle(a,null),"borderColor"===c&&(c="borderTopColor"),e=9===p&&"filter"===c?m.getPropertyValue(c):m[c],""!==e&&null!==e||(e=a.style[c]),j()}if("auto"===e&&/^(top|right|bottom|left)$/i.test(c)){var n=h(a,"position");("fixed"===n||"absolute"===n&&/top|left/i.test(c))&&(e=o(a).position()[c]+"px")}return e}var i;if(A.Hooks.registered[c]){var j=c,k=A.Hooks.getRoot(j);e===d&&(e=A.getPropertyValue(a,A.Names.prefixCheck(k)[0])),A.Normalizations.registered[k]&&(e=A.Normalizations.registered[k]("extract",a,e)),i=A.Hooks.extractValue(j,e)}else if(A.Normalizations.registered[c]){var l,m;l=A.Normalizations.registered[c]("name",a),"transform"!==l&&(m=h(a,A.Names.prefixCheck(l)[0]),A.Values.isCSSNullValue(m)&&A.Hooks.templates[c]&&(m=A.Hooks.templates[c][1])),i=A.Normalizations.registered[c]("extract",a,m)}if(!/^[\d-]/.test(i)){var n=g(a);if(n&&n.isSVG&&A.Names.SVGAttribute(c))if(/^(height|width)$/i.test(c))try{i=a.getBBox()[c]}catch(q){i=0}else i=a.getAttribute(c);else i=h(a,A.Names.prefixCheck(c)[0])}return A.Values.isCSSNullValue(i)&&(i=0),y.debug>=2&&console.log("Get "+c+": "+i),i},setPropertyValue:function(a,c,d,e,f){var h=c;if("scroll"===c)f.container?f.container["scroll"+f.direction]=d:"Left"===f.direction?b.scrollTo(d,f.alternateValue):b.scrollTo(f.alternateValue,d);else if(A.Normalizations.registered[c]&&"transform"===A.Normalizations.registered[c]("name",a))A.Normalizations.registered[c]("inject",a,d),h="transform",d=g(a).transformCache[c];else{if(A.Hooks.registered[c]){var i=c,j=A.Hooks.getRoot(c);e=e||A.getPropertyValue(a,j),d=A.Hooks.injectValue(i,d,e),c=j}if(A.Normalizations.registered[c]&&(d=A.Normalizations.registered[c]("inject",a,d),c=A.Normalizations.registered[c]("name",a)),h=A.Names.prefixCheck(c)[0],p<=8)try{a.style[h]=d}catch(l){y.debug&&console.log("Browser does not support ["+d+"] for ["+h+"]")}else{var k=g(a);k&&k.isSVG&&A.Names.SVGAttribute(c)?a.setAttribute(c,d):a.style[h]=d}y.debug>=2&&console.log("Set "+c+" ("+h+"): "+d)}return[h,d]},flushTransformCache:function(a){var b="",c=g(a);if((p||y.State.isAndroid&&!y.State.isChrome)&&c&&c.isSVG){var d=function(b){return parseFloat(A.getPropertyValue(a,b))},e={translate:[d("translateX"),d("translateY")],skewX:[d("skewX")],skewY:[d("skewY")],scale:1!==d("scale")?[d("scale"),d("scale")]:[d("scaleX"),d("scaleY")],rotate:[d("rotateZ"),0,0]};o.each(g(a).transformCache,function(a){/^translate/i.test(a)?a="translate":/^scale/i.test(a)?a="scale":/^rotate/i.test(a)&&(a="rotate"),e[a]&&(b+=a+"("+e[a].join(" ")+") ",delete e[a])})}else{var f,h;o.each(g(a).transformCache,function(c){if(f=g(a).transformCache[c],"transformPerspective"===c)return h=f,!0;9===p&&"rotateZ"===c&&(c="rotate"),b+=c+f+" "}),h&&(b="perspective"+h+" "+b)}A.setPropertyValue(a,"transform",b)}};A.Hooks.register(),A.Normalizations.register(),y.hook=function(a,b,c){var e;return a=f(a),o.each(a,function(a,f){if(g(f)===d&&y.init(f),c===d)e===d&&(e=A.getPropertyValue(f,b));else{var h=A.setPropertyValue(f,b,c);"transform"===h[0]&&y.CSS.flushTransformCache(f),e=h}}),e};var B=function(){function a(){return k?z.promise||null:p}function e(a,e){function f(f){var k,n;if(i.begin&&0===D)try{i.begin.call(r,r)}catch(V){setTimeout(function(){throw V},1)}if("scroll"===G){var p,q,w,x=/^x$/i.test(i.axis)?"Left":"Top",B=parseFloat(i.offset)||0;i.container?u.isWrapped(i.container)||u.isNode(i.container)?(i.container=i.container[0]||i.container,p=i.container["scroll"+x],w=p+o(a).position()[x.toLowerCase()]+B):i.container=null:(p=y.State.scrollAnchor[y.State["scrollProperty"+x]],q=y.State.scrollAnchor[y.State["scrollProperty"+("Left"===x?"Top":"Left")]],w=o(a).offset()[x.toLowerCase()]+B),j={scroll:{rootPropertyValue:!1,startValue:p,currentValue:p,endValue:w,unitType:"",easing:i.easing,scrollData:{container:i.container,direction:x,alternateValue:q}},element:a},y.debug&&console.log("tweensContainer (scroll): ",j.scroll,a)}else if("reverse"===G){if(!(k=g(a)))return;if(!k.tweensContainer)return void o.dequeue(a,i.queue);"none"===k.opts.display&&(k.opts.display="auto"),"hidden"===k.opts.visibility&&(k.opts.visibility="visible"),k.opts.loop=!1,k.opts.begin=null,k.opts.complete=null,v.easing||delete i.easing,v.duration||delete i.duration,i=o.extend({},k.opts,i),n=o.extend(!0,{},k?k.tweensContainer:null);for(var E in n)if(n.hasOwnProperty(E)&&"element"!==E){var F=n[E].startValue;n[E].startValue=n[E].currentValue=n[E].endValue,n[E].endValue=F,u.isEmptyObject(v)||(n[E].easing=i.easing),y.debug&&console.log("reverse tweensContainer ("+E+"): "+JSON.stringify(n[E]),a)}j=n}else if("start"===G){k=g(a),k&&k.tweensContainer&&k.isAnimating===!0&&(n=k.tweensContainer);var H=function(e,f){var g,l=A.Hooks.getRoot(e),m=!1,p=f[0],q=f[1],r=f[2]
1052;if(!(k&&k.isSVG||"tween"===l||A.Names.prefixCheck(l)[1]!==!1
vendor: 5,506 bytes, line 1052
1052||A.Normalizations.registered[l]!==d))return void(y.debug&&console.log("Skipping ["+l+"] due to a lack of browser support."));(i.display!==d&&null!==i.display&&"none"!==i.display||i.visibility!==d&&"hidden"!==i.visibility)&&/opacity|filter/.test(e)&&!r&&0!==p&&(r=0),i._cacheValues&&n&&n[e]?(r===d&&(r=n[e].endValue+n[e].unitType),m=k.rootPropertyValueCache[l]):A.Hooks.registered[e]?r===d?(m=A.getPropertyValue(a,l),r=A.getPropertyValue(a,e,m)):m=A.Hooks.templates[l][1]:r===d&&(r=A.getPropertyValue(a,e));var s,t,v,w=!1,x=function(a,b){var c,d;return d=(b||"0").toString().toLowerCase().replace(/[%A-z]+$/,function(a){return c=a,""}),c||(c=A.Values.getUnitType(a)),[d,c]};if(r!==p&&u.isString(r)&&u.isString(p)){g="";var z=0,B=0,C=[],D=[],E=0,F=0,G=0;for(r=A.Hooks.fixColors(r),p=A.Hooks.fixColors(p);z<r.length&&B<p.length;){var H=r[z],I=p[B];if(/[\d\.-]/.test(H)&&/[\d\.-]/.test(I)){for(var J=H,K=I,L=".",N=".";++z<r.length;){if((H=r[z])===L)L="..";else if(!/\d/.test(H))break;J+=H}for(;++B<p.length;){if((I=p[B])===N)N="..";else if(!/\d/.test(I))break;K+=I}var O=A.Hooks.getUnit(r,z),P=A.Hooks.getUnit(p,B);if(z+=O.length,B+=P.length,O===P)J===K?g+=J+O:(g+="{"+C.length+(F?"!":"")+"}"+O,C.push(parseFloat(J)),D.push(parseFloat(K)));else{var Q=parseFloat(J),R=parseFloat(K);g+=(E<5?"calc":"")+"("+(Q?"{"+C.length+(F?"!":"")+"}":"0")+O+" + "+(R?"{"+(C.length+(Q?1:0))+(F?"!":"")+"}":"0")+P+")",Q&&(C.push(Q),D.push(0)),R&&(C.push(0),D.push(R))}}else{if(H!==I){E=0;break}g+=H,z++,B++,0===E&&"c"===H||1===E&&"a"===H||2===E&&"l"===H||3===E&&"c"===H||E>=4&&"("===H?E++:(E&&E<5||E>=4&&")"===H&&--E<5)&&(E=0),0===F&&"r"===H||1===F&&"g"===H||2===F&&"b"===H||3===F&&"a"===H||F>=3&&"("===H?(3===F&&"a"===H&&(G=1),F++):G&&","===H?++G>3&&(F=G=0):(G&&F<(G?5:4)||F>=(G?4:3)&&")"===H&&--F<(G?5:4))&&(F=G=0)}}z===r.length&&B===p.length||(y.debug&&console.error('Trying to pattern match mis-matched strings ["'+p+'", "'+r+'"]'),g=d),g&&(C.length?(y.debug&&console.log('Pattern found "'+g+'" -> ',C,D,"["+r+","+p+"]"),r=C,p=D,t=v=""):g=d)}g||(s=x(e,r),r=s[0],v=s[1],s=x(e,p),p=s[0].replace(/^([+-\/*])=/,function(a,b){return w=b,""}),t=s[1],r=parseFloat(r)||0,p=parseFloat(p)||0,"%"===t&&(/^(fontSize|lineHeight)$/.test(e)?(p/=100,t="em"):/^scale/.test(e)?(p/=100,t=""):/(Red|Green|Blue)$/i.test(e)&&(p=p/100*255,t="")));if(/[\/*]/.test(w))t=v;else if(v!==t&&0!==r)if(0===p)t=v;else{h=h||function(){var d={myParent:a.parentNode||c.body,position:A.getPropertyValue(a,"position"),fontSize:A.getPropertyValue(a,"fontSize")},e=d.position===M.lastPosition&&d.myParent===M.lastParent,f=d.fontSize===M.lastFontSize;M.lastParent=d.myParent,M.lastPosition=d.position,M.lastFontSize=d.fontSize;var g={};if(f&&e)g.emToPx=M.lastEmToPx,g.percentToPxWidth=M.lastPercentToPxWidth,g.percentToPxHeight=M.lastPercentToPxHeight;else{var h=k&&k.isSVG?c.createElementNS("http://www.w3.org/2000/svg","rect"):c.createElement("div");y.init(h),d.myParent.appendChild(h),o.each(["overflow","overflowX","overflowY"],function(a,b){y.CSS.setPropertyValue(h,b,"hidden")}),y.CSS.setPropertyValue(h,"position",d.position),y.CSS.setPropertyValue(h,"fontSize",d.fontSize),y.CSS.setPropertyValue(h,"boxSizing","content-box"),o.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(a,b){y.CSS.setPropertyValue(h,b,"100%")}),y.CSS.setPropertyValue(h,"paddingLeft","100em"),g.percentToPxWidth=M.lastPercentToPxWidth=(parseFloat(A.getPropertyValue(h,"width",null,!0))||1)/100,g.percentToPxHeight=M.lastPercentToPxHeight=(parseFloat(A.getPropertyValue(h,"height",null,!0))||1)/100,g.emToPx=M.lastEmToPx=(parseFloat(A.getPropertyValue(h,"paddingLeft"))||1)/100,d.myParent.removeChild(h)}return null===M.remToPx&&(M.remToPx=parseFloat(A.getPropertyValue(c.body,"fontSize"))||16),null===M.vwToPx&&(M.vwToPx=parseFloat(b.innerWidth)/100,M.vhToPx=parseFloat(b.innerHeight)/100),g.remToPx=M.remToPx,g.vwToPx=M.vwToPx,g.vhToPx=M.vhToPx,y.debug>=1&&console.log("Unit ratios: "+JSON.stringify(g),a),g}();var S=/margin|padding|left|right|width|text|word|letter/i.test(e)||/X$/.test(e)||"x"===e?"x":"y";switch(v){case"%":r*="x"===S?h.percentToPxWidth:h.percentToPxHeight;break;case"px":break;default:r*=h[v+"ToPx"]}switch(t){case"%":r*=1/("x"===S?h.percentToPxWidth:h.percentToPxHeight);break;case"px":break;default:r*=1/h[t+"ToPx"]}}switch(w){case"+":p=r+p;break;case"-":p=r-p;break;case"*":p*=r;break;case"/":p=r/p}j[e]={rootPropertyValue:m,startValue:r,currentValue:r,endValue:p,unitType:t,easing:q},g&&(j[e].pattern=g),y.debug&&console.log("tweensContainer ("+e+"): "+JSON.stringify(j[e]),a)};for(var I in s)if(s.hasOwnProperty(I)){var J=A.Names.camelCase(I),K=function(b,c){var d,f,g;return u.isFunction(b)&&(b=b.call(a,e,C)),u.isArray(b)?(d=b[0],!u.isArray(b[1])&&/^[\d-]/.test(b[1])||u.isFunction(b[1])||A.RegEx.isHex.test(b[1])?g=b[1]:u.isString(b[1])&&!A.RegEx.isHex.test(b[1])&&y.Easings[b[1]]||u.isArray(b[1])?(f=c?b[1]:l(b[1],i.duration),g=b[2]):g=b[1]||b[2]):d=b,c||(f=f||i.easing),u.isFunction(d)&&(d=d.call(a,e,C)),u.isFunction(g)&&(g=g.call(a,e,C)),[d||0,f,g]}(s[I]);if(t(A.Lists.colors,J)){var L=K[0],O=K[1],P=K[2];if(A.RegEx.isHex.test(L)){for(var Q=["Red","Green","Blue"],R=A.Values.hexToRgb(L),S=P?A.Values.hexToRgb(P):d,T=0;T<Q.length;T++){var U=[R[T]];O&&U.push(O),S!==d&&U.push(S[T]),H(J+Q[T],U)}continue}}H(J,K)}j.element=a}j.element&&(A.Values.addClass(a,"velocity-animating"),N.push(j),k=g(a),k&&(""===i.queue&&(k.tweensContainer=j,k.opts=i),k.isAnimating=!0),D===C-1?(y.State.calls.push([N,r,i,null,z.resolver,null,0]),
1052y.State.isTicking===!1&&(y.State.isTicking=!0,m())):D++)}var h,i=o.extend({},y.defaults,v),j={};switch(g(a)===d&&y.init(a),parseFloat(i.delay)&&i.queue!==!1&&o.queue(a,i.queue,function(b){y.velocityQueueEntryFlag=!0;var c=y.State.delayedElements.count++;y.State.delayedElements[c]=a;var d=function(a){return function(){y.State.delayedElements[a]=!1,b()}}(c);g(a).delayBegin=(new Date).getTime(),g(a).delay=parseFloat(i.delay),g(a).delayTimer={setTimeout:setTimeout(b,parseFloat(i.delay)),next:d}}),i.duration.toString().toLowerCase()){case"fast":i.duration=200;break;case"normal":i.duration=w;break;case"slow":i.duration=600;break;default:i.duration=parseFloat(i.duration)||1}if(y.mock!==!1&&(y.mock===!0?i.duration=i.delay=1:(i.duration*=parseFloat(y.mock)||1,i.delay*=parseFloat(y.mock)||1)),i.easing=l(i.easing,i.duration),i.begin&&!u.isFunction(i.begin)&&(i.begin=null),i.progress&&!u.isFunction(i.progress)&&(i.progress=null),i.complete&&!u.isFunction(i.complete)&&(i.complete=null),i.display!==d&&null!==i.display&&(i.display=i.display.toString().toLowerCase(),"auto"===i.display&&(i.display=y.CSS.Values.getDisplayType(a))),i.visibility!==d&&null!==i.visibility&&(i.visibility=i.visibility.toString().toLowerCase()),i.mobileHA=i.mobileHA&&y.State.isMobile&&!y.State.isGingerbread,i.queue===!1)if(i.delay){var k=y.State.delayedElements.count++;y.State.delayedElements[k]=a;var n=function(a){return function(){y.State.delayedElements[a]=!1,f()}}(k);g(a).delayBegin=(new Date).getTime(),g(a).delay=parseFloat(i.delay),g(a).delayTimer={setTimeout:setTimeout(f,parseFloat(i.delay)),next:n}}else f();else o.queue(a,i.queue,function(a,b){if(b===!0)return z.promise&&z.resolver(r),!0;y.velocityQueueEntryFlag=!0,f(a)});""!==i.queue&&"fx"!==i.queue||"inprogress"===o.queue(a)[0]||o.dequeue(a)}var j,k,p,q,r,s,v,x=arguments[0]&&(arguments[0].p||o.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||u.isString(arguments[0].properties));u.isWrapped(this)?(k=!1,q=0,r=this,p=this):(k=!0,q=1,r=x?arguments[0].elements||arguments[0].e:arguments[0]);var z={promise:null,resolver:null,rejecter:null};if(k&&y.Promise&&(z.promise=new y.Promise(function(a,b){z.resolver=a,z.rejecter=b})),x?(s=arguments[0].properties||arguments[0].p,v=arguments[0].options||arguments[0].o):(s=arguments[q],v=arguments[q+1]),!(r=f(r)))return void(z.promise&&(s&&v&&v.promiseRejectEmpty===!1?z.resolver():z.rejecter()));var C=r.length,D=0;if(!/^(stop|finish|finishAll|pause|resume)$/i.test(s)&&!o.isPlainObject(v)){var E=q+1;v={};for(var F=E;F<arguments.length;F++)u.isArray(arguments[F])||!/^(fast|normal|slow)$/i.test(arguments[F])&&!/^\d/.test(arguments[F])?u.isString(arguments[F])||u.isArray(arguments[F])?v.easing=arguments[F]:u.isFunction(arguments[F])&&(v.complete=arguments[F]):v.duration=arguments[F]}var G;switch(s){case"scroll":G="scroll";break;case"reverse":G="reverse";break;case"pause":var H=(new Date).getTime();return o.each(r,function(a,b){h(b,H)}),o.each(y.State.calls,function(a,b){var c=!1;b&&o.each(b[1],function(a,e){var f=v===d?"":v;return f!==!0&&b[2].queue!==f&&(v!==d||b[2].queue!==!1)||(o.each(r,function(a,d){if(d===e)return b[5]={resume:!1},c=!0,!1}),!c&&void 0)})}),a();case"resume":return o.each(r,function(a,b){i(b,H)}),o.each(y.State.calls,function(a,b){var c=!1;b&&o.each(b[1],function(a,e){var f=v===d?"":v;return f!==!0&&b[2].queue!==f&&(v!==d||b[2].queue!==!1)||(!b[5]||(o.each(r,function(a,d){if(d===e)return b[5].resume=!0,c=!0,!1}),!c&&void 0))})}),a();case"finish":case"finishAll":case"stop":o.each(r,function(a,b){g(b)&&g(b).delayTimer&&(clearTimeout(g(b).delayTimer.setTimeout),g(b).delayTimer.next&&g(b).delayTimer.next(),delete g(b).delayTimer),"finishAll"!==s||v!==!0&&!u.isString(v)||(o.each(o.queue(b,u.isString(v)?v:""),function(a,b){u.isFunction(b)&&b()}),o.queue(b,u.isString(v)?v:"",[]))});var I=[];return o.each(y.State.calls,function(a,b){b&&o.each(b[1],function(c,e){var f=v===d?"":v;if(f!==!0&&b[2].queue!==f&&(v!==d||b[2].queue!==!1))return!0;o.each(r,function(c,d){if(d===e)if((v===!0||u.isString(v))&&(o.each(o.queue(d,u.isString(v)?v:""),function(a,b){u.is
1052Function(b)&&b(null,!0)}),o.queue(d,u.isString(v)?v:"",[])),"stop"===s){var h=g(d);h&&h.tweensContainer&&f!==!1&&o.each(h.tweensContainer,function(a,b){b.endValue=b.currentValue}),I.push(a)}else"finish"!==s&&"finishAll"!==s||(b[2].duration=1)})})}),"stop"===s&&(o.each(I,function(a,b){n(b,!0)}),z.promise&&z.resolver(r)),a();default:if(!o.isPlainObject(s)||u.isEmptyObject(s)){if(u.isString(s)&&y.Redirects[s]){j=o.extend({},v);var J=j.duration,K=j.delay||0;return j.backwards===!0&&(r=o.extend(!0,[],r).reverse()),o.each(r,function(a,b){parseFloat(j.stagger)?j.delay=K+parseFloat(j.stagger)*a:u.isFunction(j.stagger)&&(j.delay=K+j.stagger.call(b,a,C)),j.drag&&(j.duration=parseFloat(J)||(/^(callout|transition)/.test(s)?1e3:w),j.duration=Math.max(j.duration*(j.backwards?1-a/C:(a+1)/C),.75*j.duration,200)),y.Redirects[s].call(b,b,j||{},a,C,r,z.promise?z:d)}),a()}var L="Velocity: First argument ("+s+") was not a property map, a known action, or a registered redirect. Aborting.";return z.promise?z.rejecter(new Error(L)):b.console&&console.log(L),a()}G="start"}var M={lastParent:null,lastPosition:null,lastFontSize:null,lastPercentToPxWidth:null,lastPercentToPxHeight:null,lastEmToPx:null,remToPx:null,vwToPx:null,vhToPx:null},N=[];o.each(r,function(a,b){u.isNode(b)&&e(b,a)}),j=o.extend({},y.defaults,v),j.loop=parseInt(j.loop,10);var O=2*j.loop-1;if(j.loop)for(var P=0;P<O;P++){var Q={delay:j.delay,progress:j.progress};P===O-1&&(Q.display=j.display,Q.visibility=j.visibility,Q.complete=j.complete),B(r,"reverse",Q)}return a()};y=o.extend(B,y),y.animate=B;var C=b.requestAnimationFrame||q;if(!y.State.isMobile&&c.hidden!==d){var D=function(){c.hidden?(C=function(a){return setTimeout(function(){a(!0)},16)},m()):C=b.requestAnimationFrame||q};D(),c.addEventListener("visibilitychange",D)}return a.Velocity=y,a!==b&&(a.fn.velocity=B,a.fn.velocity.defaults=y.defaults),o.each(["Down","Up"],function(a,b){y.Redirects["slide"+b]=function(a,c,e,f,g,h){var i=o.extend({},c),j=i.begin,k=i.complete,l={},m={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""};i.display===d&&(i.display="Down"===b?"inline"===y.CSS.Values.getDisplayType(a)?"inline-block":"block":"none"),i.begin=function(){0===e&&j&&j.call(g,g);for(var c in m)if(m.hasOwnProperty(c)){l[c]=a.style[c];var d=A.getPropertyValue(a,c);m[c]="Down"===b?[d,0]:[0,d]}l.overflow=a.style.overflow,a.style.overflow="hidden"},i.complete=function(){for(var b in l)l.hasOwnProperty(b)&&(a.style[b]=l[b]);e===f-1&&(k&&k.call(g,g),h&&h.resolver(g))},y(a,m,i)}}),o.each(["In","Out"],function(a,b){y.Redirects["fade"+b]=function(a,c,e,f,g,h){var i=o.extend({},c),j=i.complete,k={opacity:"In"===b?1:0};0!==e&&(i.begin=null),i.complete=e!==f-1?null:function(){j&&j.call(g,g),h&&h.resolver(g)},i.display===d&&(i.display="In"===b?"auto":"none"),y(this,k,i)}}),y}(window.jQuery||window.Zepto||window,window,window?window.document:undefined)});
1053/* End */
1054;
1055; /* Start:"a:4:{s:4:"full";s:82:"/local/templates/aspro_max_local/vendor/js/velocity/velocity.ui.js?162019756913257";s:6:"source";s:66:"/local/templates/aspro_max_local/vendor/js/velocity/velocity.ui.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1056/* VelocityJS.org UI Pack (5.0.4). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License. Portions copyright Daniel Eden, Christian Pucci. */
1057!function(t){"function"==typeof require&&"object"==typeof exports?module.exports=t():"function"==typeof define&&define.amd?define(["velocity"],t):t()}(function(){return function(t,a,e,r){function n(t,a){var e=[];return t&&a?($.each([t,a],function(t,a){var r=[];$.each(a,function(t,a){for(;a.toString().length<5;)a="0"+a;r.push(a)}),e.push(r.join(""))}),parseFloat(e[0])>parseFloat(e[1])):!1}if(!t.Velocity||!t.Velocity.Utilities)return void(a.console&&console.log("Velocity UI Pack: Velocity must be loaded first. Aborting."));var i=t.Velocity,$=i.Utilities,s=i.version,o={major:1,minor:1,patch:0};if(n(o,s)){var l="Velocity UI Pack: You need to update Velocity (jquery.velocity.js) to a newer version. Visit http://github.com/julianshapiro/velocity.";throw alert(l),new Error(l)}i.RegisterEffect=i.RegisterUI=function(t,a){function e(t,a,e,r){var n=0,s;$.each(t.nodeType?[t]:t,function(t,a){r&&(e+=t*r),s=a.parentNode,$.each(["height","paddingTop","paddingBottom","marginTop","marginBottom"],function(t,e){n+=parseFloat(i.CSS.getPropertyValue(a,e))})}),i.animate(s,{height:("In"===a?"+":"-")+"="+n},{queue:!1,easing:"ease-in-out",duration:e*("In"===a?.6:1)})}return i.Redirects[t]=function(n,s,o,l,c,u){function f(){s.display!==r&&"none"!==s.display||!/Out$/.test(t)||$.each(c.nodeType?[c]:c,function(t,a){i.CSS.setPropertyValue(a,"display","none")}),s.complete&&s.complete.call(c,c),u&&u.resolver(c||n)}var p=o===l-1;a.defaultDuration="function"==typeof a.defaultDuration?a.defaultDuration.call(c,c):parseFloat(a.defaultDuration);for(var d=0;d<a.calls.length;d++){var g=a.calls[d],y=g[0],m=s.duration||a.defaultDuration||1e3,X=g[1],Y=g[2]||{},O={};if(O.duration=m*(X||1),O.queue=s.queue||"",O.easing=Y.easing||"ease",O.delay=parseFloat(Y.delay)||0,O._cacheValues=Y._cacheValues||!0,0===d){if(O.delay+=parseFloat(s.delay)||0,0===o&&(O.begin=function(){s.begin&&s.begin.call(c,c);var a=t.match(/(In|Out)$/);a&&"In"===a[0]&&y.opacity!==r&&$.each(c.nodeType?[c]:c,function(t,a){i.CSS.setPropertyValue(a,"opacity",0)}),s.animateParentHeight&&a&&e(c,a[0],m+O.delay,s.stagger)}),null!==s.display)if(s.display!==r&&"none"!==s.display)O.display=s.display;else if(/In$/.test(t)){var v=i.CSS.Values.getDisplayType(n);O.display="inline"===v?"inline-block":v}
vendor: 11,730 bytes, lines 1057-1076
1057s.visibility&&"hidden"!==s.visibility&&(O.visibility=s.visibility)}d===a.calls.length-1&&(O.complete=function(){if(a.reset){for(var t in a.reset){var e=a.reset[t];i.CSS.Hooks.registered[t]!==r||"string"!=typeof e&&"number"!=typeof e||(a.reset[t]=[a.reset[t],a.reset[t]])}var s={duration:0,queue:!1};p&&(s.complete=f),i.animate(n,a.reset,s)}else p&&f()},"hidden"===s.visibility&&(O.visibility=s.visibility)),i.animate(n,y,O)}},i},i.RegisterEffect.packagedEffects={"callout.bounce":{defaultDuration:550,calls:[[{translateY:-30},.25],[{translateY:0},.125],[{translateY:-15},.125],[{translateY:0},.25]]},"callout.shake":{defaultDuration:800,calls:[[{translateX:-11},.125],[{translateX:11},.125],[{translateX:-11},.125],[{translateX:11},.125],[{translateX:-11},.125],[{translateX:11},.125],[{translateX:-11},.125],[{translateX:0},.125]]},"callout.flash":{defaultDuration:1100,calls:[[{opacity:[0,"easeInOutQuad",1]},.25],[{opacity:[1,"easeInOutQuad"]},.25],[{opacity:[0,"easeInOutQuad"]},.25],[{opacity:[1,"easeInOutQuad"]},.25]]},"callout.pulse":{defaultDuration:825,calls:[[{scaleX:1.1,scaleY:1.1},.5,{easing:"easeInExpo"}],[{scaleX:1,scaleY:1},.5]]},"callout.swing":{defaultDuration:950,calls:[[{rotateZ:15},.2],[{rotateZ:-10},.2],[{rotateZ:5},.2],[{rotateZ:-5},.2],[{rotateZ:0},.2]]},"callout.tada":{defaultDuration:1e3,calls:[[{scaleX:.9,scaleY:.9,rotateZ:-3},.1],[{scaleX:1.1,scaleY:1.1,rotateZ:3},.1],[{scaleX:1.1,scaleY:1.1,rotateZ:-3},.1],["reverse",.125],["reverse",.125],["reverse",.125],["reverse",.125],["reverse",.125],[{scaleX:1,scaleY:1,rotateZ:0},.2]]},"transition.fadeIn":{defaultDuration:500,calls:[[{opacity:[1,0]}]]},"transition.fadeOut":{defaultDuration:500,calls:[[{opacity:[0,1]}]]},"transition.flipXIn":{defaultDuration:700,calls:[[{opacity:[1,0],transformPerspective:[800,800],rotateY:[0,-55]}]],reset:{transformPerspective:0}},"transition.flipXOut":{defaultDuration:700,calls:[[{opacity:[0,1],transformPerspective:[800,800],rotateY:55}]],reset:{transformPerspective:0,rotateY:0}},"transition.flipYIn":{defaultDuration:800,calls:[[{opacity:[1,0],transformPerspective:[800,800],rotateX:[0,-45]}]],reset:{transformPerspective:0}},"transition.flipYOut":{defaultDuration:800,calls:[[{opacity:[0,1],transformPerspective:[800,800],rotateX:25}]],reset:{transformPerspective:0,rotateX:0}},"transition.flipBounceXIn":{defaultDuration:900,calls:[[{opacity:[.725,0],transformPerspective:[400,400],rotateY:[-10,90]},.5],[{opacity:.8,rotateY:10},.25],[{opacity:1,rotateY:0},.25]],reset:{transformPerspective:0}},"transition.flipBounceXOut":{defaultDuration:800,calls:[[{opacity:[.9,1],transformPerspective:[400,400],rotateY:-10},.5],[{opacity:0,rotateY:90},.5]],reset:{transformPerspective:0,rotateY:0}},"transition.flipBounceYIn":{defaultDuration:850,calls:[[{opacity:[.725,0],transformPerspective:[400,400],rotateX:[-10,90]},.5],[{opacity:.8,rotateX:10},.25],[{opacity:1,rotateX:0},.25]],reset:{transformPerspective:0}},"transition.flipBounceYOut":{defaultDuration:800,calls:[[{opacity:[.9,1],transformPerspective:[400,400],rotateX:-15},.5],[{opacity:0,rotateX:90},.5]],reset:{transformPerspective:0,rotateX:0}},"transition.swoopIn":{defaultDuration:850,calls:[[{opacity:[1,0],transformOriginX:["100%","50%"],transformOriginY:["100%","100%"],scaleX:[1,0],scaleY:[1,0],translateX:[0,-700],translateZ:0}]],reset:{transformOriginX:"50%",transformOriginY:"50%"}},"transition.swoopOut":{defaultDuration:850,calls:[[{opacity:[0,1],transformOriginX:["50%","100%"],transformOriginY:["100%","100%"],scaleX:0,scaleY:0,translateX:-700,translateZ:0}]],reset:{transformOriginX:"50%",transformOriginY:"50%",scaleX:1,scaleY:1,translateX:0}},"transition.whirlIn":{defaultDuration:850,calls:[[{opacity:[1,0],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:[1,0],scaleY:[1,0],rotateY:[0,160]},1,{easing:"easeInOutSine"}]]},"transition.whirlOut":{defaultDuration:750,calls:[[{opacity:[0,"easeInOutQuint",1],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:0,scaleY:0,rotateY:160},1,{easing:"swing"}]],reset:{scaleX:1,scaleY:1,rotateY:0}},"transition.shrinkIn":{defaultDuration:750,calls:[[{opacity:[1,0],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:[1,1.5],scaleY:[1,1.5],translateZ:0}]]},"transition.shrinkOut":{defaultDuration:600,calls:[[{opacity:[0,1],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:1.3,scaleY:1.3,translateZ:0}]],reset:{scaleX:1,scaleY:1}},"transition.expandIn":{defaultDuration:700,calls:[[{opacity:[1,0],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:[1,.625],scaleY:[1,.625],translateZ:0}]]},"transition.expandOut":{defaultDuration:700,calls:[[{opacity:[0,1],transformOriginX:["50%","50%"],transformOriginY:["50%","50%"],scaleX:.5,scaleY:.5,translateZ:0}]],reset:{scaleX:1,scaleY:1}},"transition.bounceIn":{defaultDuration:800,calls:[[{opacity:[1,0],scaleX:[1.05,.3],scaleY:[1.05,.3]},.4],[{scaleX:.9,scaleY:.9,translateZ:0},.2],[{scaleX:1,scaleY:1},.5]]},"transition.bounceOut":{defaultDuration:800,calls:[[{scaleX:.95,scaleY:.95},.35],[{scaleX:1.1,scaleY:1.1,translateZ:0},.35],[{opacity:[0,1],scaleX:.3,scaleY:.3},.3]],reset:{scaleX:1,scaleY:1}},"transition.bounceUpIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateY:[-30,1e3]},.6,{easing:"easeOutCirc"}],[{translateY:10},.2],[{translateY:0},.2]]},"transition.bounceUpOut":{defaultDuration:1e3,calls:[[{translateY:20},.2],[{opacity:[0,"easeInCirc",1],translateY:-1e3},.8]],reset:{translateY:0}},"transition.bounceDownIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateY:[30,-1e3]},.6,{easing:"easeOutCirc"}],[{translateY:-10},.2],[{translateY:0},.2]]},"transition.bounceDownOut":{defaultDuration:1e3,calls:[[{translateY:-20},.2],[{opacity:[0,"easeInCirc",1],translateY:1e3},.8]],reset:{translateY:0}},"transition.bounceLeftIn":{defaultDuration:750,calls:[[{opacity:[1,0],translateX:[30,-1250]},.6,{easing:"easeOutCirc"}],[{translateX:-10},.2],[{translateX:0},.2]]},"transition.bounceLeftOut":{defaultDuration:750,calls:[[{translateX:30},.2],[{opacity:[0,"easeInCirc",1],translateX:-1250},.8]],reset:{translateX:0}},"transition.bounceRightIn":{defaultDuration:750,calls:[[{opacity:[1,0],translateX:[-30,1250]},.6,{easing:"easeOutCirc"}],[{translateX:10},.2],[{translateX:0},.2]]},"transition.bounceRightOut":{defaultDuration:750,calls:[[{translateX:-30},.2],[{opacity:[0,"easeInCirc",1],translateX:1250},.8]],reset:{translateX:0}},"transition.slideUpIn":{defaultDuration:900,calls:[[{opacity:[1,0],translateY:[0,20],translateZ:0}]]},"transition.slideUpOut":{defaultDuration:900,calls:[[{opacity:[0,1],translateY:-20,translateZ:0}]],reset:{translateY:0}},"transition.slideDownIn":{defaultDuration:900,calls:[[{opacity:[1,0],translateY:[0,-20],translateZ:0}]]},"transition.slideDownOut":{defaultDuration:900,calls:[[{opacity:[0,1],translateY:20,translateZ:0}]],reset:{translateY:0}},"transition.slideLeftIn":{defaultDuration:1e3,calls:[[{opacity:[1,0],translateX:[0,-20],translateZ:0}]]},"transition.slideLeftOut":{defaultDuration:1050,calls:[[{opacity:[0,1],translateX:-20,translateZ:0}]],reset:{translateX:0}},"transition.slideRightIn":{defaultDuration:1e3,calls:[[{opacity:[1,0],translateX:[0,20],translateZ:0}]]},"transition.slideRightOut":{defaultDuration:1050,calls:[[{opacity:[0,1],translateX:20,translateZ:0}]],reset:{translateX:0}},"transition.slideUpBigIn":{defaultDuration:850,calls:[[{opacity:[1,0],translateY:[0,75],translateZ:0}]]},"transition.slideUpBigOut":{defaultDuration:800,calls:[[{opacity:[0,1],translateY:-75,translateZ:0}]],reset:{translateY:0}},"transition.slideDownBigIn":{defaultDuration:850,calls:[[{opacity:[1,0],translateY:[0,-75],translateZ:0}]]},"transition.slideDownBigOut":{defaultDuration:800,calls:[[{opacity:[0,1],translateY:75,translateZ:0}]],reset:{translateY:0}},"transition.slideLeftBigIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateX:[0,-75],translateZ:0}]]},"transition.slideLeftBigOut":{defaultDuration:750,calls:[[{opacity:[0,1],translateX:-75,translateZ:0}]],reset:{translateX:0}},"transition.slideRightBigIn":{defaultDuration:800,calls:[[{opacity:[1,0],translateX:[0,75],translateZ:0}]]},"transition.slideRightBigOut":{defaultDuration:750,calls:[[{opacity:[0,1],translateX:75,translateZ:0}]],reset:{translateX:0}},"transition.perspectiveUpIn":{defaultDuration:800,calls:[[{opacity:[1,0],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:["100%","100%"],rotateX:[0,-180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveUpOut":{defaultDuration:850,calls:[[{opacity:[0,1],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:["100%","100%"],rotateX:-180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateX:0}},"transition.perspectiveDownIn":{defaultDuration:800,calls:[[{opacity:[1,0],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:[0,0],rotateX:[0,180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveDownOut":{defaultDuration:850,calls:[[{opacity:[0,1],transformPerspective:[800,800],transformOriginX:[0,0],transformOriginY:[0,0],rotateX:180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateX:0}},"transition.perspectiveLeftIn":{defaultDuration:950,calls:[[{opacity:[1,0],transformPerspective:[2e3,2e3],transformOriginX:[0,0],transformOriginY:[0,0],rotateY:[0,-180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveLeftOut":{defaultDuration:950,calls:[[{opacity:[0,1],transformPerspective:[2e3,2e3],transformOriginX:[0,0],transformOriginY:[0,0],rotateY:-180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateY:0}},"transition.perspectiveRightIn":{defaultDuration:950,calls:[[{opacity:[1,0],transformPerspective:[2e3,2e3],transformOriginX:["100%","100%"],transformOriginY:[0,0],rotateY:[0,180]}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%"}},"transition.perspectiveRightOut":{defaultDuration:950,calls:[[{opacity:[0,1],transformPerspective:[2e3,2e3],transformOriginX:["100%","100%"],transformOriginY:[0,0],rotateY:180}]],reset:{transformPerspective:0,transformOriginX:"50%",transformOriginY:"50%",rotateY:0}}};for(var c in i.RegisterEffect.packagedEffects)i.RegisterEffect(c,i.RegisterEffect.packagedEffects[c]);i.RunSequence=function(t){var a=$.extend(!0,[],t);a.length>1&&($.each(a.reverse(),function(t,e){var r=a[t+1];if(r){var n=e.o||e.options,s=r.o||r.options,o=n&&n.sequenceQueue===!1?"begin":"complete",l=s&&s[o],c={};c[o]=function(){var t=r.e||r.elements,a=t.nodeType?[t]:t;l&&l.call(a,a),i(e)},r.o?r.o=$.extend({},s,c):r.options=$.extend({},s,c)}}),a.reverse()),i(a[0])}}(window.jQuery||window.Zepto||window,window,document)});
1058/* End */
1059;
1060; /* Start:"a:4:{s:4:"full";s:77:"/local/templates/aspro_max_local/vendor/js/jquery.menu-aim.js?162019756912787";s:6:"source";s:61:"/local/templates/aspro_max_local/vendor/js/jquery.menu-aim.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1061/**
1062 * menu-aim is a jQuery plugin for dropdown menus that can differentiate
1063 * between a user trying hover over a dropdown item vs trying to navigate into
1064 * a submenu's contents.
1065 *
1066 * menu-aim assumes that you have are using a menu with submenus that expand
1067 * to the menu's right. It will fire events when the user's mouse enters a new
1068 * dropdown item *and* when that item is being intentionally hovered over.
1069 *
1070 * __________________________
1071 * | Monkeys  >|   Gorilla  |
1072 * | Gorillas >|   Content  |
1073 * | Chimps   >|   Here     |
1074 * |___________|____________|
1075 *
1076 * In the above example, "Gorillas" is selected and its submenu 
1076content is
1077 * being shown on the right. Imagine that the user's cursor is hovering over
1078 * "Gorillas." When they move their mouse into the "Gorilla Content" area, they
1079 * may briefly hover over "Chimps." This shouldn't close the "Gorilla Content"
1080 * area.
1081 *
1082 * This problem is normally solved using timeouts and delays. menu-aim tries to
1083 * solve this by detecting the direction of the user's mouse movement. This can
1084 * make for quicker transitions when navigating up and down the menu. The
1085 * experience is hopefully similar to amazon.com/'s "Shop by Department"
1086 * dropdown.
1087 *
1088 * Use like so:
1089 *
1090 *      $("#menu").menuAim({
1091 *          activate: $.noop,  // fired on row activation
1092 *          deactivate: $.noop  // fired on row deactivation
1093 *      });
1094 *
1095 *  ...to receive events when a menu's row has been purposefully (de)activated.
1096 *
1097 * The following options can be passed to menuAim. All functions execute with
1098 * the relevant row's HTML element as the execution context ('this'):
1099 *
1100 *      .menuAim({
1101 *          // Function to call when a row is purposefully activated. Use this
1102 *          // to show a submenu's content for the activated row.
1103 *          activate: function() {},
1104 *
1105 *          // Function to call when a row is deactivated.
1106 *          deactivate: function() {},
1107 *
1108 *          // Function to call when mouse enters a menu row. Entering a row
1109 *          // does not mean the row has been activated, as the user may be
1110 *          // mousing over to a submenu.
1111 *          enter: function() {},
1112 *
1113 *          // Function to call when mouse exits a menu row.
1114 *          exit: function() {},
1115 *
1116 *          // Selector for identifying which elements in the menu are rows
1117 *          // that can trigger the above events. Defaults to "> li".
1118 *          rowSelector: "> li",
1119 *
1120 *          // You may have some menu rows that aren't submenus and therefore
1121 *          // shouldn't ever need to "activate." If so, filter submenu rows w/
1122 *          // this selector. Defaults to "*" (all elements).
1123 *          submenuSelector: "*",
1124 *
1125 *          // Direction the submenu opens relative to the main menu. Can be
1126 *          // left, right, above, or below. Defaults to "right".
1127 *          submenuDirection: "right"
1128 *      });
1129 *
1130 * https://github.com/kamens/jQuery-menu-aim
1131*/
1132(function($) {
1133
1134    $.fn.menuAim = function(opts) {
1135        // Initialize menu-aim for all elements in jQuery collection
1136        this.each(function() {
1137            init.call(this, opts);
1138        });
1139
1140        return this;
1141    };
1142
1143    function init(opts) {
1144        var $menu = $(this),
1145            activeRow = null,
1146            mouseLocs = [],
1147            lastDelayLoc = null,
1148            timeoutId = null,
1149            options = $.extend({
1150                firstActiveRow: false,
1151                rowSelector: "> li",
1152                submenuSelector: "*",
1153                submenuDirection: "right",
1154                tolerance: 5,  // bigger = more forgivey when entering submenu
1155                enter: $.noop,
1156                exit: $.noop,
1157                activate: $.noop,
1158                deactivate: $.noop,
1159                exitMenu: $.noop
1160            }, opts);
1161
1162        var MOUSE_LOCS_TRACKED = 3,  // number of past mouse locations to track
1163            DELAY = 3000;  // ms delay when user appears to be entering submenu
1164
1165        /**
1166         * Keep track of the last few locations of the mouse.
1167         */
1168        var mousemoveDocument = function(e) {
1169                mouseLocs.push({x: e.pageX, y: e.pageY});
1170
1171                if (mouseLocs.length > MOUSE_LOCS_TRACKED) {
1172                    mouseLocs.shift();
1173                }
1174            };
1175
1176        /**
1177         * Cancel possible row activations when leaving the menu entirely
1178         */
1179        var mouseleaveMenu = function() {
1180                if (timeoutId) {
1181                    clearTimeout(timeoutId);
1182                }
1183
1184                // If exitMenu is supplied and returns true, deactivate the
1185                // currently active row on menu exit.
1186                if (options.exitMenu(this)) {
1187                    if (activeRow) {
1188                        options.deactivate(activeRow);
1189                    }
1190
1191                    activeRow = null;
1192                }
1193            };
1194
1195        /**
1196         * Trigger a possible row activation whenever entering a new row.
1197         */
1198        var mouseenterRow = function() {
1199                if (timeoutId) {
1200                    // Cancel any previous activation delays
1201                    clearTimeout(timeoutId);
1202                }
1203
1204                options.enter(this);
1205                possiblyActivate(this);
1206            },
1207            mouseleaveRow = function() {
1208                options.exit(this);
1209            };
1210
1211        /*
1212         * Immediately activate a row if the user clicks on it.
1213         */
1214        var clickRow = function() {
1215                activate(this);
1216            };
1217
1218        /**
1219         * Activate a menu row.
1220         */
1221        var activate = function(row) {
1222                if (row == activeRow) {
1223                    return;
1224                }
1225
1226                if (activeRow) {
1227                    options.deactivate(activeRow);
1228                }
1229
1230                options.activate(row);
1231                activeRow = row;
1232            };
1233
1234        /**
1235         * Possibly activate a menu row. If mouse movement indicates that we
1236         * shouldn't activate yet because user may be trying to enter
1237         * a submenu's content, then delay and check again later.
1238         */
1239        var possiblyActivate = function(row) {
1240                var delay = activationDelay();
1241
1242                if (delay) {
1243                    timeoutId = setTimeout(function() {
1244                        possiblyActivate(row);
1245                    }, delay);
1246                } else {
1247                    activate(row);
1248                }
1249            };
1250
1251        /**
1252         * Return the amount of time that should be used as a delay before the
1253         * currently hovered row is activated.
1254         *
1255         * Returns 0 if the activation should happen immediately. Otherwise,
1256         * returns the number of milliseconds that should be delayed before
1257         * checking again to see if the row should be activated.
1258         */
1259        var activationDelay = function() {
1260                if (!activeRow || !$(activeRow).is(options.submenuSelector)) {
1261                    // If there is no other submenu row already active, then
1262                    // go ahead and activate immediately.
1263                    return 0;
1264                }
1265
1266                var offset = $menu.offset(),
1267                    upperLeft = {
1268                        x: offset.left,
1269                        y: offset.top - options.tolerance
1270                    },
1271                    upperRight = {
1272                        x: offset.left + $menu.outerWidth(),
1273                        y: upperLeft.y
1274                    },
1275                    lowerLeft = {
1276                        x: offset.left,
1277                        y: offset.top + $menu.outerHeight() + options.tolerance
1278                    },
1279                    lowerRight = {
1280                        x: offset.left + $menu.outerWidth(),
1281                        y: lowerLeft.y
1282                    },
1283                    loc = mouseLocs[mouseLocs.length - 1],
1284                    prevLoc = mouseLocs[0];
1285
1286                if (!loc) {
1287                    return 0;
1288                }
1289
1290                if (!prevLoc) {
1291                    prevLoc = loc;
1292                }
1293
1294                if (prevLoc.x < offset.left || prevLoc.x > lowerRight.x ||
1295                    prevLoc.y < offset.top || prevLoc.y > lowerRight.y) {
1296                    // If the previous mouse location was outside of the entire
1297                    // menu's bounds, immediately activate.
1298                    return 0;
1299                }
1300
1301                if (lastDelayLoc &&
1302                        loc.x == lastDelayLoc.x && loc.y == lastDelayLoc.y) {
1303                    // If the mouse hasn't moved since the last time we checked
1304                    // for activation status, immediately activate.
1305                    return 0;
1306                }
1307
1308                // Detect if the user is moving towards the currently activated
1309                // submenu.
1310                //
1311                // If the mouse is heading relatively clearly towards
1312                // the submenu's content, we should wait and give the user more
1313                // time before activating a new row. If the mouse is heading
1314                // elsewhere, we can immediately activate a new row.
1315                //
1316                // We detect this by calculating the slope formed between the
1317                // current mouse location and the upper/lower right points of
1318                // the menu. We do the same for the previous mouse location.
1319                // If the current mouse location's slopes are
1320                // increasing/decreasing appropriately compared to the
1321                // previous's, we know the user is moving toward the submenu.
1322                //
1323                // Note that since the y-axis increases as the cursor moves
1324                // down the screen, we are looking for the slope between the
1325                // cursor and the upper right corner to decrease over time, not
1326                // increase (somewhat counterintuitively).
1327                function slope(a, b) {
1328                    return (b.y - a.y) / (b.x - a.x);
1329                };
1330
1331                var decreasingCorner = upperRight,
1332                    increasingCorner = lowerRight;
1333
1334                // Our expectations for decreasing or increasing slope values
1335                // depends on which direction the submenu opens relative to the
1336                // main menu. By default, if the menu opens on the right, we
1337                // expect the slope between the cursor and the upper right
1338                // corner to decrease over time, as explained above. If the
1339                // submenu opens in a different direction, we change our slope
1340                // expectations.
1341                if (options.submenuDirection == "left") {
1342                    decreasingCorner = lowerLeft;
1343                    increasingCorner = upperLeft;
1344                } else if (options.submenuDirection == "below") {
1345                    decreasingCorner = lowerRight;
1346                    increasingCorner = lowerLeft;
1347                } else if (options.submenuDirection == "above") {
1348                    decreasingCorner = upperLeft;
1349                    increasingCorner = upperRight;
1350                }
1351
1352                var decreasingSlope = slope(loc, decreasingCorner),
1353                    increasingSlope = slope(loc, increasingCorner),
1354                    prevDecreasingSlope = slope(prevLoc, decreasingCorner),
1355                    prevIncreasingSlope = slope(prevLoc, increasingCorner);
1356
1357                if (decreasingSlope < prevDecreasingSlope &&
1358                        increasingSlope > prevIncreasingSlope) {
1359                    // Mouse is moving from previous location towards the
1360                    // currently activated submenu. Delay before activating a
1361                    // new menu row, because user may be moving into submenu.
1362                    lastDelayLoc = loc;
1363                    return DELAY;
1364                }
1365
1366                lastDelayLoc = null;
1367                return 0;
1368            };
1369
1370        /**
1371         * Hook up initial menu events
1372         */
1373        $menu
1374            .mouseleave(mouseleaveMenu)
1375            .find(options.rowSelector)
1376                .mouseenter(mouseenterRow)
1377                .mouseleave(mouseleaveRow)
1378                .click(clickRow);
1379
1380        // sets the first active row
1381        if ('firstActiveRow' in options) {
1382            if(!$menu.find(options.rowSelector).hasClass('active')) {
1383                if (options.firstActiveRow === true) {
1384                    activate($menu.find(options.rowSelector).eq(0));
1385                } else {
1386                    activate(options.firstActiveRow);
1387                }
1388            }
1389        }
1390        $(document).mousemove(mousemoveDocument);
1391    };
1392})(jQuery);
1393
1394
1395/* End */
1396;
1397; /* Start:"a:4:{s:4:"full";s:60:"/local/templates/aspro_max_local/js/browser.js?1620197569996";s:6:"source";s:46:"/local/templates/aspro_max_local/js/browser.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1398var matched, browser;
1399
1400jQuery.uaMatch = function( ua ) {
1401    ua = ua.toLowerCase();
1402
1403    var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
1404        /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
1405        /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
1406        /(msie)[\s?]([\w.]+)/.exec( ua ) ||       
1407        /(trident)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
1408        ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
1409        [];
1410
1411    return {
1412        browser: match[ 1 ] || "",
1413        version: match[ 2 ] || "0"
1414    };
1415};
1416
1417matched = jQuery.uaMatch( navigator.userAgent );
1418//IE 11+ fix (Trident) 
1419matched.browser = matched.browser == 'trident' ? 'msie' : matched.browser;
1420browser = {};
1421
1422if ( matched.browser ) {
1423    browser[ matched.browser ] = true;
1424    browser.version = matched.version;
1425}
1426
1427// Chrome is Webkit, but Webkit is also Safari.
1428if ( browser.chrome ) {
1429    browser.webkit = true;
1430} else if ( browser.webkit ) {
1431    browser.safari = true;
1432}
1433
1434jQuery.browser = browser;
vendor: 161,751 bytes, lines 1435-7101
1435/* End */
1436;
1437; /* Start:"a:4:{s:4:"full";s:71:"/local/templates/aspro_max_local/js/jquery.fancybox.js?1620197569160667";s:6:"source";s:54:"/local/templates/aspro_max_local/js/jquery.fancybox.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
1438// ==================================================
1439// fancyBox v3.5.7
1440//
1441// Licensed GPLv3 for open source use
1442// or fancyBox Commercial License for commercial use
1443//
1444// http://fancyapps.com/fancybox/
1445// Copyright 2019 fancyApps
1446//
1447// ==================================================
1448(function (window, document, $, undefined) {
1449  "use strict";
1450
1451  window.console = window.console || {
1452    info: function (stuff) {}
1453  };
1454
1455  // If there's no jQuery, fancyBox can't work
1456  // =========================================
1457
1458  if (!$) {
1459    return;
1460  }
1461
1462  // Check if fancyBox is already initialized
1463  // ========================================
1464
1465  if ($.fn.fancybox) {
1466    console.info("fancyBox already initialized");
1467
1468    return;
1469  }
1470
1471  // Private default settings
1472  // ========================
1473
1474  var defaults = {
1475    // Close existing modals
1476    // Set this to false if you do not need to stack multiple instances
1477    closeExisting: false,
1478
1479    // Enable infinite gallery navigation
1480    loop: false,
1481
1482    // Horizontal space between slides
1483    gutter: 50,
1484
1485    // Enable keyboard navigation
1486    keyboard: true,
1487
1488    // Should allow caption to overlap the content
1489    preventCaptionOverlap: true,
1490
1491    // Should display navigation arrows at the screen edges
1492    arrows: true,
1493
1494    // Should display counter at the top left corner
1495    infobar: true,
1496
1497    // Should display close button (using `btnTpl.smallBtn` template) over the content
1498    // Can be true, false, "auto"
1499    // If "auto" - will be automatically enabled for "html", "inline" or "ajax" items
1500    smallBtn: "auto",
1501
1502    // Should display toolbar (buttons at the top)
1503    // Can be true, false, "auto"
1504    // If "auto" - will be automatically hidden if "smallBtn" is enabled
1505    toolbar: "auto",
1506
1507    // What buttons should appear in the top right corner.
1508    // Buttons will be created using templates from `btnTpl` option
1509    // and they will be placed into toolbar (class="fancybox-toolbar"` element)
1510    buttons: [
1511      "zoom",
1512      //"share",
1513      "slideShow",
1514      //"fullScreen",
1515      //"download",
1516      "thumbs",
1517      "close"
1518    ],
1519
1520    // Detect "idle" time in seconds
1521    idleTime: 3,
1522
1523    // Disable right-click and use simple image protection for images
1524    protect: false,
1525
1526    // Shortcut to make content "modal" - disable keyboard navigtion, hide buttons, etc
1527    modal: false,
1528
1529    image: {
1530      // Wait for images to load before displaying
1531      //   true  - wait for image to load and then display;
1532      //   false - display thumbnail and load the full-sized image over top,
1533      //           requires predefined image dimensions (`data-width` and `data-height` attributes)
1534      preload: false
1535    },
1536
1537    ajax: {
1538      // Object containing settings for ajax request
1539      settings: {
1540        // This helps to indicate that request comes from the modal
1541        // Feel free to change naming
1542        data: {
1543          fancybox: true
1544        }
1545      }
1546    },
1547
1548    iframe: {
1549      // Iframe template
1550      tpl: '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" allowfullscreen="allowfullscreen" allow="autoplay; fullscreen" src=""></iframe>',
1551
1552      // Preload iframe before displaying it
1553      // This allows to calculate iframe content width and height
1554      // (note: Due to "Same Origin Policy", you can't get cross domain data).
1555      preload: true,
1556
1557      // Custom CSS styling for iframe wrapping element
1558      // You can use this to set custom iframe dimensions
1559      css: {},
1560
1561      // Iframe tag attributes
1562      attr: {
1563        scrolling: "auto"
1564      }
1565    },
1566
1567    // For HTML5 video only
1568    video: {
1569      tpl: '<video class="fancybox-video" controls controlsList="nodownload" poster="{{poster}}">' +
1570        '<source src="{{src}}" type="{{format}}" />' +
1571        'Sorry, your browser doesn\'t support embedded videos, <a href="{{src}}">download</a> and watch with your favorite video player!' +
1572        "</video>",
1573      format: "", // custom video format
1574      autoStart: true
1575    },
1576
1577    // Default content type if cannot be detected automatically
1578    defaultType: "image",
1579
1580    // Open/close animation type
1581    // Possible values:
1582    //   false            - disable
1583    //   "zoom"           - zoom images from/to thumbnail
1584    //   "fade"
1585    //   "zoom-in-out"
1586    //
1587    animationEffect: "zoom",
1588
1589    // Duration in ms for open/close animation
1590    animationDuration: 366,
1591
1592    // Should image change opacity while zooming
1593    // If opacity is "auto", then opacity will be changed if image and thumbnail have different aspect ratios
1594    zoomOpacity: "auto",
1595
1596    // Transition effect between slides
1597    //
1598    // Possible values:
1599    //   false            - disable
1600    //   "fade'
1601    //   "slide'
1602    //   "circular'
1603    //   "tube'
1604    //   "zoom-in-out'
1605    //   "rotate'
1606    //
1607    transitionEffect: "fade",
1608
1609    // Duration in ms for transition animation
1610    transitionDuration: 366,
1611
1612    // Custom CSS class for slide element
1613    slideClass: "",
1614
1615    // Custom CSS class for layout
1616    baseClass: "",
1617
1618    // Base template for layout
1619    baseTpl: '<div class="fancybox-container" role="dialog" tabindex="-1">' +
1620      '<div class="fancybox-bg"></div>' +
1621      '<div class="fancybox-inner">' +
1622      '<div class="fancybox-infobar"><span data-fancybox-index></span>&nbsp;/&nbsp;<span data-fancybox-count></span></div>' +
1623      '<div class="fancybox-toolbar">{{buttons}}</div>' +
1624      '<div class="fancybox-navigation">{{arrows}}</div>' +
1625      '<div class="fancybox-stage"></div>' +
1626      '<div class="fancybox-caption"><div class="fancybox-caption__body"></div></div>' +
1627      "</div>" +
1628      "</div>",
1629
1630    // Loading indicator template
1631    spinnerTpl: '<div class="fancybox-loading"></div>',
1632
1633    // Error message template
1634    errorTpl: '<div class="fancybox-error"><p>{{ERROR}}</p></div>',
1635
1636    btnTpl: {
1637      download: '<a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}" href="javascript:;">' +
1638        '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.62 17.09V19H5.38v-1.91zm-2.97-6.96L17 11.45l-5 4.87-5-4.87 1.36-1.32 2.68 2.64V5h1.92v7.77z"/></svg>' +
1639        "</a>",
1640
1641      zoom: '<button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}">' +
1642        '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.7 17.3l-3-3a5.9 5.9 0 0 0-.6-7.6 5.9 5.9 0 0 0-8.4 0 5.9 5.9 0 0 0 0 8.4 5.9 5.9 0 0 0 7.7.7l3 3a1 1 0 0 0 1.3 0c.4-.5.4-1 0-1.5zM8.1 13.8a4 4 0 0 1 0-5.7 4 4 0 0 1 5.7 0 4 4 0 0 1 0 5.7 4 4 0 0 1-5.7 0z"/></svg>' +
1643        "</button>",
1644
1645      close: '<button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}">' +
1646        '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 10.6L6.6 5.2 5.2 6.6l5.4 5.4-5.4 5.4 1.4 1.4 5.4-5.4 5.4 5.4 1.4-1.4-5.4-5.4 5.4-5.4-1.4-1.4-5.4 5.4z"/></svg>' +
1647        "</button>",
1648
1649      // Arrows
1650      arrowLeft: '<button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}">' +
1651        '<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.28 15.7l-1.34 1.37L5 12l4.94-5.07 1.34 1.38-2.68 2.72H19v1.94H8.6z"/></svg></div>' +
1652        "</button>",
1653
1654      arrowRight: '<button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}">' +
1655        '<div><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.4 12.97l-2.68 2.72 1.34 1.38L19 12l-4.94-5.07-1.34 1.38 2.68 2.72H5v1.94z"/></svg></div>' +
1656        "</button>",
1657
1658      // This small close button will be appended to your html/inline/ajax content by default,
1659      // if "smallBtn" option is not set to false
1660      smallBtn: '<button type="button" data-fancybox-close class="fancybox-button fancybox-close-small" title="{{CLOSE}}">' +
1661        '<svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24"><path d="M13 12l5-5-1-1-5 5-5-5-1 1 5 5-5 5 1 1 5-5 5 5 1-1z"/></svg>' +
1662        "</button>"
1663    },
1664
1665    // Container is injected into this element
1666    parentEl: "body",
1667
1668    // Hide browser vertical scrollbars; use at your own risk
1669    hideScrollbar: true,
1670
1671    // Focus handling
1672    // ==============
1673
1674    // Try to focus on the first focusable element after opening
1675    autoFocus: true,
1676
1677    // Put focus back to active element after closing
1678    backFocus: true,
1679
1680    // Do not let user to focus on element outside modal content
1681    trapFocus: true,
1682
1683    // Module specific options
1684    // =======================
1685
1686    fullScreen: {
1687      autoStart: false
1688    },
1689
1690    // Set `touch: false` to disable panning/swiping
1691    touch: {
1692      vertical: true, // Allow to drag content vertically
1693      momentum: true // Continue movement after releasing mouse/touch when panning
1694    },
1695
1696    // Hash value when initializing manually,
1697    // set `false` to disable hash change
1698    hash: null,
1699
1700    // Customize or add new media types
1701    // Example:
1702    /*
1703      media : {
1704        youtube : {
1705          params : {
1706            autoplay : 0
1707          }
1708        }
1709      }
1710    */
1711    media: {},
1712
1713    slideShow: {
1714      autoStart: false,
1715      speed: 3000
1716    },
1717
1718    thumbs: {
1719      autoStart: false, // Display thumbnails on opening
1720      hideOnClose: true, // Hide thumbnail grid when closing animation starts
1721      parentEl: ".fancybox-container", // Container is injected into this element
1722      axis: "y" // Vertical (y) or horizontal (x) scrolling
1723    },
1724
1725    // Use mousewheel to navigate gallery
1726    // If 'auto' - enabled for images only
1727    wheel: "auto",
1728
1729    // Callbacks
1730    //==========
1731
1732    // See Documentation/API/Events for more information
1733    // Example:
1734    /*
1735      afterShow: function( instance, current ) {
1736        console.info( 'Clicked element:' );
1737        console.info( current.opts.$orig );
1738      }
1739    */
1740
1741    onInit: $.noop, // When instance has been initialized
1742
1743    beforeLoad: $.noop, // Before the content of a slide is being loaded
1744    afterLoad: $.noop, // When the content of a slide is done loading
1745
1746    beforeShow: $.noop, // Before open animation starts
1747    afterShow: $.noop, // When content is done loading and animating
1748
1749    beforeClose: $.noop, // Before the instance attempts to close. Return false to cancel the close.
1750    afterClose: $.noop, // After instance has been closed
1751
1752    onActivate: $.noop, // When instance is brought to front
1753    onDeactivate: $.noop, // When other instance has been activated
1754
1755    // Interaction
1756    // ===========
1757
1758    // Use options below to customize taken action when user clicks or double clicks on the fancyBox area,
1759    // each option can be string or method that returns value.
1760    //
1761    // Possible values:
1762    //   "close"           - close instance
1763    //   "next"            - move to next gallery item
1764    //   "nextOrClose"     - move to next gallery item or close if gallery has only one item
1765    //   "toggleControls"  - show/hide controls
1766    //   "zoom"            - zoom image (if loaded)
1767    //   false             - do nothing
1768
1769    // Clicked on the content
1770    clickContent: function (current, event) {
1771      return current.type === "image" ? "zoom" : false;
1772    },
1773
1774    // Clicked on the slide
1775    clickSlide: "close",
1776
1777    // Clicked on the background (backdrop) element;
1778    // if you have not changed the layout, then most likely you need to use `clickSlide` option
1779    clickOutside: "close",
1780
1781    // Same as previous two, but for double click
1782    dblclickContent: false,
1783    dblclickSlide: false,
1784    dblclickOutside: false,
1785
1786    // Custom options when mobile device is detected
1787    // =============================================
1788
1789    mobile: {
1790      preventCaptionOverlap: false,
1791      idleTime: false,
1792      clickContent: function (current, event) {
1793        return current.type === "image" ? "toggleControls" : false;
1794      },
1795      clickSlide: function (current, event) {
1796        return current.type === "image" ? "toggleControls" : "close";
1797      },
1798      dblclickContent: function (current, event) {
1799        return current.type === "image" ? "zoom" : false;
1800      },
1801      dblclickSlide: function (current, event) {
1802        return current.type === "image" ? "zoom" : false;
1803      }
1804    },
1805
1806    // Internationalization
1807    // ====================
1808
1809    lang: "en",
1810    i18n: {
1811      en: {
1812        CLOSE: "Close",
1813        NEXT: "Next",
1814        PREV: "Previous",
1815        ERROR: "The requested content cannot be loaded. <br/> Please try again later.",
1816        PLAY_START: "Start slideshow",
1817        PLAY_STOP: "Pause slideshow",
1818        FULL_SCREEN: "Full screen",
1819        THUMBS: "Thumbnails",
1820        DOWNLOAD: "Download",
1821        SHARE: "Share",
1822        ZOOM: "Zoom"
1823      },
1824      de: {
1825        CLOSE: "Schlie&szlig;en",
1826        NEXT: "Weiter",
1827        PREV: "Zur&uuml;ck",
1828        ERROR: "Die angeforderten Daten konnten nicht geladen werden. <br/> Bitte versuchen Sie es sp&auml;ter nochmal.",
1829        PLAY_START: "Diaschau starten",
1830        PLAY_STOP: "Diaschau beenden",
1831        FULL_SCREEN: "Vollbild",
1832        THUMBS: "Vorschaubilder",
1833        DOWNLOAD: "Herunterladen",
1834        SHARE: "Teilen",
1835        ZOOM: "Vergr&ouml;&szlig;ern"
1836      }
1837    }
1838  };
1839
1840  // Few useful variables and methods
1841  // ================================
1842
1843  var $W = $(window);
1844  var $D = $(document);
1845
1846  var called = 0;
1847
1848  // Check if an object is a jQuery object and not a native JavaScript object
1849  // ========================================================================
1850  var isQuery = function (obj) {
1851    return obj && obj.hasOwnProperty && obj instanceof $;
1852  };
1853
1854  // Handle multiple browsers for "requestAnimationFrame" and "cancelAnimationFrame"
1855  // ===============================================================================
1856  var requestAFrame = (function () {
1857    return (
1858      window.requestAnimationFrame ||
1859      window.webkitRequestAnimationFrame ||
1860      window.mozRequestAnimationFrame ||
1861      window.oRequestAnimationFrame ||
1862      // if all else fails, use setTimeout
1863      function (callback) {
1864        return window.setTimeout(callback, 1000 / 60);
1865      }
1866    );
1867  })();
1868
1869  var cancelAFrame = (function () {
1870    return (
1871      window.cancelAnimationFrame ||
1872      window.webkitCancelAnimationFrame ||
1873      window.mozCancelAnimationFrame ||
1874      window.oCancelAnimationFrame ||
1875      function (id) {
1876        window.clearTimeout(id);
1877      }
1878    );
1879  })();
1880
1881  // Detect the supported transition-end event property name
1882  // =======================================================
1883  var transitionEnd = (function () {
1884    var el = document.createElement("fakeelement"),
1885      t;
1886
1887    var transitions = {
1888      transition: "transitionend",
1889      OTransition: "oTransitionEnd",
1890      MozTransition: "transitionend",
1891      WebkitTransition: "webkitTransitionEnd"
1892    };
1893
1894    for (t in transitions) {
1895      if (el.style[t] !== undefined) {
1896        return transitions[t];
1897      }
1898    }
1899
1900    return "transitionend";
1901  })();
1902
1903  // Force redraw on an element.
1904  // This helps in cases where the browser doesn't redraw an updated element properly
1905  // ================================================================================
1906  var forceRedraw = function ($el) {
1907    return $el && $el.length && $el[0].offsetHeight;
1908  };
1909
1910  // Exclude array (`buttons`) options from deep merging
1911  // ===================================================
1912  var mergeOpts = function (opts1, opts2) {
1913    var rez = $.extend(true, {}, opts1, opts2);
1914
1915    $.each(opts2, function (key, value) {
1916      if ($.isArray(value)) {
1917        rez[key] = value;
1918      }
1919    });
1920
1921    return rez;
1922  };
1923
1924  // How much of an element is visible in viewport
1925  // =============================================
1926
1927  var inViewport = function (elem) {
1928    var elemCenter, rez;
1929
1930    if (!elem || elem.ownerDocument !== document) {
1931      return false;
1932    }
1933
1934    $(".fancybox-container").css("pointer-events", "none");
1935
1936    elemCenter = {
1937      x: elem.getBoundingClientRect().left + elem.offsetWidth / 2,
1938      y: elem.getBoundingClientRect().top + elem.offsetHeight / 2
1939    };
1940
1941    rez = document.elementFromPoint(elemCenter.x, elemCenter.y) === elem;
1942
1943    $(".fancybox-container").css("pointer-events", "");
1944
1945    return rez;
1946  };
1947
1948  // Class definition
1949  // ================
1950
1951  var FancyBox = function (content, opts, index) {
1952    var self = this;
1953
1954    self.opts = mergeOpts({
1955      index: index
1956    }, $.fancybox.defaults);
1957
1958    if ($.isPlainObject(opts)) {
1959      self.opts = mergeOpts(self.opts, opts);
1960    }
1961
1962    if ($.fancybox.isMobile) {
1963      self.opts = mergeOpts(self.opts, self.opts.mobile);
1964    }
1965
1966    self.id = self.opts.id || ++called;
1967
1968    self.currIndex = parseInt(self.opts.index, 10) || 0;
1969    self.prevIndex = null;
1970
1971    self.prevPos = null;
1972    self.currPos = 0;
1973
1974    self.firstRun = true;
1975
1976    // All group items
1977    self.group = [];
1978
1979    // Existing slides (for current, next and previous gallery items)
1980    self.slides = {};
1981
1982    // Create group elements
1983    self.addContent(content);
1984
1985    if (!self.group.length) {
1986      return;
1987    }
1988
1989    self.init();
1990  };
1991
1992  $.extend(FancyBox.prototype, {
1993    // Create DOM structure
1994    // ====================
1995
1996    init: function () {
1997      var self = this,
1998        firstItem = self.group[self.currIndex],
1999        firstItemOpts = firstItem.opts,
2000        $container,
2001        buttonStr;
2002
2003      if (firstItemOpts.closeExisting) {
2004        $.fancybox.close(true);
2005      }
2006
2007      // Hide scrollbars
2008      // ===============
2009
2010      $("body").addClass("fancybox-active");
2011
2012      if (
2013        !$.fancybox.getInstance() &&
2014        firstItemOpts.hideScrollbar !== false &&
2015        !$.fancybox.isMobile &&
2016        document.body.scrollHeight > window.innerHeight
2017      ) {
2018        $("head").append(
2019          '<style id="fancybox-style-noscroll" type="text/css">.compensate-for-scrollbar{margin-right:' +
2020          (window.innerWidth - document.documentElement.clientWidth) +
2021          "px;}</style>"
2022        );
2023
2024        $("body").addClass("compensate-for-scrollbar");
2025      }
2026
2027      // Build html markup and set references
2028      // ====================================
2029
2030      // Build html code for buttons and insert into main template
2031      buttonStr = "";
2032
2033      $.each(firstItemOpts.buttons, function (index, value) {
2034        buttonStr += firstItemOpts.btnTpl[value] || "";
2035      });
2036
2037      // Create markup from base template, it will be initially hidden to
2038      // avoid unnecessary work like painting while initializing is not complete
2039      $container = $(
2040          self.translate(
2041            self,
2042            firstItemOpts.baseTpl
2043            .replace("{{buttons}}", buttonStr)
2044            .replace("{{arrows}}", firstItemOpts.btnTpl.arrowLeft + firstItemOpts.btnTpl.arrowRight)
2045          )
2046        )
2047        .attr("id", "fancybox-container-" + self.id)
2048        .addClass(firstItemOpts.baseClass)
2049        .data("FancyBox", self)
2050        .appendTo(firstItemOpts.parentEl);
2051
2052      // Create object holding references to jQuery wrapped nodes
2053      self.$refs = {
2054        container: $container
2055      };
2056
2057      ["bg", "inner", "infobar", "toolbar", "stage", "caption", "navigation"].forEach(function (item) {
2058        self.$refs[item] = $container.find(".fancybox-" + item);
2059      });
2060
2061      self.trigger("onInit");
2062
2063      // Enable events, deactive previous instances
2064      self.activate();
2065
2066      // Build slides, load and reveal content
2067      self.jumpTo(self.currIndex);
2068    },
2069
2070    // Simple i18n support - replaces object keys found in template
2071    // with corresponding values
2072    // ============================================================
2073
2074    translate: function (obj, str) {
2075      var arr = obj.opts.i18n[obj.opts.lang] || obj.opts.i18n.en;
2076
2077      return str.replace(/\{\{(\w+)\}\}/g, function (match, n) {
2078        return arr[n] === undefined ? match : arr[n];
2079      });
2080    },
2081
2082    // Populate current group with fresh content
2083    // Check if each object has valid type and content
2084    // ===============================================
2085
2086    addContent: function (content) {
2087      var self = this,
2088        items = $.makeArray(content),
2089        thumbs;
2090
2091      $.each(items, function (i, item) {
2092        var obj = {},
2093          opts = {},
2094          $item,
2095          type,
2096          found,
2097          src,
2098          srcParts;
2099
2100        // Step 1 - Make sure we have an object
2101        // ====================================
2102
2103        if ($.isPlainObject(item)) {
2104          // We probably have manual usage here, something like
2105          // $.fancybox.open( [ { src : "image.jpg", type : "image" } ] )
2106
2107          obj = item;
2108          opts = item.opts || item;
2109        } else if ($.type(item) === "object" && $(item).length) {
2110          // Here we probably have jQuery collection returned by some selector
2111          $item = $(item);
2112
2113          // Support attributes like `data-options='{"touch" : false}'` and `data-touch='false'`
2114          opts = $item.data() || {};
2115          opts = $.extend(true, {}, opts, opts.options);
2116
2117          // Here we store clicked element
2118          opts.$orig = $item;
2119
2120          obj.src = self.opts.src || opts.src || $item.attr("href");
2121
2122          // Assume that simple syntax is used, for example:
2123          //   `$.fancybox.open( $("#test"), {} );`
2124          if (!obj.type && !obj.src) {
2125            obj.type = "inline";
2126            obj.src = item;
2127          }
2128        } else {
2129          // Assume we have a simple html code, for example:
2130          //   $.fancybox.open( '<div><h1>Hi!</h1></div>' );
2131          obj = {
2132            type: "html",
2133            src: item + ""
2134          };
2135        }
2136
2137        // Each gallery object has full collection of options
2138        obj.opts = $.extend(true, {}, self.opts, opts);
2139
2140        // Do not merge buttons array
2141        if ($.isArray(opts.buttons)) {
2142          obj.opts.buttons = opts.buttons;
2143        }
2144
2145        if ($.fancybox.isMobile && obj.opts.mobile) {
2146          obj.opts = mergeOpts(obj.opts, obj.opts.mobile);
2147        }
2148
2149        // Step 2 - Make sure we have content type, if not - try to guess
2150        // ==============================================================
2151
2152        type = obj.type || obj.opts.type;
2153        src = obj.src || "";
2154
2155        if (!type && src) {
2156          if ((found = src.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))) {
2157            type = "video";
2158
2159            if (!obj.opts.video.format) {
2160              obj.opts.video.format = "video/" + (found[1] === "ogv" ? "ogg" : found[1]);
2161            }
2162          } else if (src.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)) {
2163            type = "image";
2164          } else if (src.match(/\.(pdf)((\?|#).*)?$/i)) {
2165            type = "iframe";
2166            obj = $.extend(true, obj, {
2167              contentType: "pdf",
2168              opts: {
2169                iframe: {
2170                  preload: false
2171                }
2172              }
2173            });
2174          } else if (src.charAt(0) === "#") {
2175            type = "inline";
2176          }
2177        }
2178
2179        if (type) {
2180          obj.type = type;
2181        } else {
2182          self.trigger("objectNeedsType", obj);
2183        }
2184
2185        if (!obj.contentType) {
2186          obj.contentType = $.inArray(obj.type, ["html", "inline", "ajax"]) > -1 ? "html" : obj.type;
2187        }
2188
2189        // Step 3 - Some adjustments
2190        // =========================
2191
2192        obj.index = self.group.length;
2193
2194        if (obj.opts.smallBtn == "auto") {
2195          obj.opts.smallBtn = $.inArray(obj.type, ["html", "inline", "ajax"]) > -1;
2196        }
2197
2198        if (obj.opts.toolbar === "auto") {
2199          obj.opts.toolbar = !obj.opts.smallBtn;
2200        }
2201
2202        // Find thumbnail image, check if exists and if is in the viewport
2203        obj.$thumb = obj.opts.$thumb || null;
2204
2205        if (obj.opts.$trigger && obj.index === self.opts.index) {
2206          obj.$thumb = obj.opts.$trigger.find("img:first");
2207
2208          if (obj.$thumb.length) {
2209            obj.opts.$orig = obj.opts.$trigger;
2210          }
2211        }
2212
2213        if (!(obj.$thumb && obj.$thumb.length) && obj.opts.$orig) {
2214          obj.$thumb = obj.opts.$orig.find("img:first");
2215        }
2216
2217        if (obj.$thumb && !obj.$thumb.length) {
2218          obj.$thumb = null;
2219        }
2220
2221        obj.thumb = obj.opts.thumb || (obj.$thumb ? obj.$thumb[0].src : null);
2222
2223        // "caption" is a "special" option, it can be used to customize caption per gallery item
2224        if ($.type(obj.opts.caption) === "function") {
2225          obj.opts.caption = obj.opts.caption.apply(item, [self, obj]);
2226        }
2227
2228        if ($.type(self.opts.caption) === "function") {
2229          obj.opts.caption = self.opts.caption.apply(item, [self, obj]);
2230        }
2231
2232        // Make sure we have caption as a string or jQuery object
2233        if (!(obj.opts.caption instanceof $)) {
2234          obj.opts.caption = obj.opts.caption === undefined ? "" : obj.opts.caption + "";
2235        }
2236
2237        // Check if url contains "filter" used to filter the content
2238        // Example: "ajax.html #something"
2239        if (obj.type === "ajax") {
2240          srcParts = src.split(/\s+/, 2);
2241
2242          if (srcParts.length > 1) {
2243            obj.src = srcParts.shift();
2244
2245            obj.opts.filter = srcParts.shift();
2246          }
2247        }
2248
2249        // Hide all buttons and disable interactivity for modal items
2250        if (obj.opts.modal) {
2251          obj.opts = $.extend(true, obj.opts, {
2252            trapFocus: true,
2253            // Remove buttons
2254            infobar: 0,
2255            toolbar: 0,
2256
2257            smallBtn: 0,
2258
2259            // Disable keyboard navigation
2260            keyboard: 0,
2261
2262            // Disable some modules
2263            slideShow: 0,
2264            fullScreen: 0,
2265            thumbs: 0,
2266            touch: 0,
2267
2268            // Disable click event handlers
2269            clickContent: false,
2270            clickSlide: false,
2271            clickOutside: false,
2272            dblclickContent: false,
2273            dblclickSlide: false,
2274            dblclickOutside: false
2275          });
2276        }
2277
2278        // Step 4 - Add processed object to group
2279        // ======================================
2280
2281        self.group.push(obj);
2282      });
2283
2284      // Update controls if gallery is already opened
2285      if (Object.keys(self.slides).length) {
2286        self.updateControls();
2287
2288        // Update thumbnails, if needed
2289        thumbs = self.Thumbs;
2290
2291        if (thumbs && thumbs.isActive) {
2292          thumbs.create();
2293
2294          thumbs.focus();
2295        }
2296      }
2297    },
2298
2299    // Attach an event handler functions for:
2300    //   - navigation buttons
2301    //   - browser scrolling, resizing;
2302    //   - focusing
2303    //   - keyboard
2304    //   - detecting inactivity
2305    // ======================================
2306
2307    addEvents: function () {
2308      var self = this;
2309
2310      self.removeEvents();
2311
2312      // Make navigation elements clickable
2313      // ==================================
2314
2315      self.$refs.container
2316        .on("click.fb-close", "[data-fancybox-close]", function (e) {
2317          e.stopPropagation();
2318          e.preventDefault();
2319
2320          self.close(e);
2321        })
2322        .on("touchstart.fb-prev click.fb-prev", "[data-fancybox-prev]", function (e) {
2323          e.stopPropagation();
2324          e.preventDefault();
2325
2326          self.previous();
2327        })
2328        .on("touchstart.fb-next click.fb-next", "[data-fancybox-next]", function (e) {
2329          e.stopPropagation();
2330          e.preventDefault();
2331
2332          self.next();
2333        })
2334        .on("click.fb", "[data-fancybox-zoom]", function (e) {
2335          // Click handler for zoom button
2336          self[self.isScaledDown() ? "scaleToActual" : "scaleToFit"]();
2337        });
2338
2339      // Handle page scrolling and browser resizing
2340      // ==========================================
2341
2342      $W.on("orientationchange.fb resize.fb", function (e) {
2343        if (e && e.originalEvent && e.originalEvent.type === "resize") {
2344          if (self.requestId) {
2345            cancelAFrame(self.requestId);
2346          }
2347
2348          self.requestId = requestAFrame(function () {
2349            self.update(e);
2350          });
2351        } else {
2352          if (self.current && self.current.type === "iframe") {
2353            self.$refs.stage.hide();
2354          }
2355
2356          setTimeout(
2357            function () {
2358              self.$refs.stage.show();
2359
2360              self.update(e);
2361            },
2362            $.fancybox.isMobile ? 600 : 250
2363          );
2364        }
2365      });
2366
2367      $D.on("keydown.fb", function (e) {
2368        var instance = $.fancybox ? $.fancybox.getInstance() : null,
2369          current = instance.current,
2370          keycode = e.keyCode || e.which;
2371
2372        // Trap keyboard focus inside of the modal
2373        // =======================================
2374
2375        if (keycode == 9) {
2376          if (current.opts.trapFocus) {
2377            self.focus(e);
2378          }
2379
2380          return;
2381        }
2382
2383        // Enable keyboard navigation
2384        // ==========================
2385
2386        if (!current.opts.keyboard || e.ctrlKey || e.altKey || e.shiftKey || $(e.target).is("input,textarea,video,audio,select")) {
2387          return;
2388        }
2389
2390        // Backspace and Esc keys
2391        if (keycode === 8 || keycode === 27) {
2392          e.preventDefault();
2393
2394          self.close(e);
2395
2396          return;
2397        }
2398
2399        // Left arrow and Up arrow
2400        if (keycode === 37 || keycode === 38) {
2401          e.preventDefault();
2402
2403          self.previous();
2404
2405          return;
2406        }
2407
2408        // Righ arrow and Down arrow
2409        if (keycode === 39 || keycode === 40) {
2410          e.preventDefault();
2411
2412          self.next();
2413
2414          return;
2415        }
2416
2417        self.trigger("afterKeydown", e, keycode);
2418      });
2419
2420      // Hide controls after some inactivity period
2421      if (self.group[self.currIndex].opts.idleTime) {
2422        self.idleSecondsCounter = 0;
2423
2424        $D.on(
2425          "mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",
2426          function (e) {
2427            self.idleSecondsCounter = 0;
2428
2429            if (self.isIdle) {
2430              self.showControls();
2431            }
2432
2433            self.isIdle = false;
2434          }
2435        );
2436
2437        self.idleInterval = window.setInterval(function () {
2438          self.idleSecondsCounter++;
2439
2440          if (self.idleSecondsCounter >= self.group[self.currIndex].opts.idleTime && !self.isDragging) {
2441            self.isIdle = true;
2442            self.idleSecondsCounter = 0;
2443
2444            self.hideControls();
2445          }
2446        }, 1000);
2447      }
2448    },
2449
2450    // Remove events added by the core
2451    // ===============================
2452
2453    removeEvents: function () {
2454      var self = this;
2455
2456      $W.off("orientationchange.fb resize.fb");
2457      $D.off("keydown.fb .fb-idle");
2458
2459      this.$refs.container.off(".fb-close .fb-prev .fb-next");
2460
2461      if (self.idleInterval) {
2462        window.clearInterval(self.idleInterval);
2463
2464        self.idleInterval = null;
2465      }
2466    },
2467
2468    // Change to previous gallery item
2469    // ===============================
2470
2471    previous: function (duration) {
2472      return this.jumpTo(this.currPos - 1, duration);
2473    },
2474
2475    // Change to next gallery item
2476    // ===========================
2477
2478    next: function (duration) {
2479      return this.jumpTo(this.currPos + 1, duration);
2480    },
2481
2482    // Switch to selected gallery item
2483    // ===============================
2484
2485    jumpTo: function (pos, duration) {
2486      var self = this,
2487        groupLen = self.group.length,
2488        firstRun,
2489        isMoved,
2490        loop,
2491        current,
2492        previous,
2493        slidePos,
2494        stagePos,
2495        prop,
2496        diff;
2497
2498      if (self.isDragging || self.isClosing || (self.isAnimating && self.firstRun)) {
2499        return;
2500      }
2501
2502      // Should loop?
2503      pos = parseInt(pos, 10);
2504      loop = self.current ? self.current.opts.loop : self.opts.loop;
2505
2506      if (!loop && (pos < 0 || pos >= groupLen)) {
2507        return false;
2508      }
2509
2510      // Check if opening for the first time; this helps to speed things up
2511      firstRun = self.firstRun = !Object.keys(self.slides).length;
2512
2513      // Create slides
2514      previous = self.current;
2515
2516      self.prevIndex = self.currIndex;
2517      self.prevPos = self.currPos;
2518
2519      current = self.createSlide(pos);
2520
2521      if (groupLen > 1) {
2522        if (loop || current.index < groupLen - 1) {
2523          self.createSlide(pos + 1);
2524        }
2525
2526        if (loop || current.index > 0) {
2527          self.createSlide(pos - 1);
2528        }
2529      }
2530
2531      self.current = current;
2532      self.currIndex = current.index;
2533      self.currPos = current.pos;
2534
2535      self.trigger("beforeShow", firstRun);
2536
2537      self.updateControls();
2538
2539      // Validate duration length
2540      current.forcedDuration = undefined;
2541
2542      if ($.isNumeric(duration)) {
2543        current.forcedDuration = duration;
2544      } else {
2545        duration = current.opts[firstRun ? "animationDuration" : "transitionDuration"];
2546      }
2547
2548      duration = parseInt(duration, 10);
2549
2550      // Check if user has swiped the slides or if still animating
2551      isMoved = self.isMoved(current);
2552
2553      // Make sure current slide is visible
2554      current.$slide.addClass("fancybox-slide--current");
2555
2556      // Fresh start - reveal container, current slide and start loading content
2557      if (firstRun) {
2558        if (current.opts.animationEffect && duration) {
2559          self.$refs.container.css("transition-duration", duration + "ms");
2560        }
2561
2562        self.$refs.container.addClass("fancybox-is-open").trigger("focus");
2563
2564        // Attempt to load content into slide
2565        // This will later call `afterLoad` -> `revealContent`
2566        self.loadSlide(current);
2567
2568        self.preload("image");
2569
2570        return;
2571      }
2572
2573      // Get actual slide/stage positions (before cleaning up)
2574      slidePos = $.fancybox.getTranslate(previous.$slide);
2575      stagePos = $.fancybox.getTranslate(self.$refs.stage);
2576
2577      // Clean up all slides
2578      $.each(self.slides, function (index, slide) {
2579        $.fancybox.stop(slide.$slide, true);
2580      });
2581
2582      if (previous.pos !== current.pos) {
2583        previous.isComplete = false;
2584      }
2585
2586      previous.$slide.removeClass("fancybox-slide--complete fancybox-slide--current");
2587
2588      // If slides are out of place, then animate them to correct position
2589      if (isMoved) {
2590        // Calculate horizontal swipe distance
2591        diff = slidePos.left - (previous.pos * slidePos.width + previous.pos * previous.opts.gutter);
2592
2593        $.each(self.slides, function (index, slide) {
2594          slide.$slide.removeClass("fancybox-animated").removeClass(function (index, className) {
2595            return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" ");
2596          });
2597
2598          // Make sure that each slide is in equal distance
2599          // This is mostly needed for freshly added slides, because they are not yet positioned
2600          var leftPos = slide.pos * slidePos.width + slide.pos * slide.opts.gutter;
2601
2602          $.fancybox.setTranslate(slide.$slide, {
2603            top: 0,
2604            left: leftPos - stagePos.left + diff
2605          });
2606
2607          if (slide.pos !== current.pos) {
2608            slide.$slide.addClass("fancybox-slide--" + (slide.pos > current.pos ? "next" : "previous"));
2609          }
2610
2611          // Redraw to make sure that transition will start
2612          forceRedraw(slide.$slide);
2613
2614          // Animate the slide
2615          $.fancybox.animate(
2616            slide.$slide, {
2617              top: 0,
2618              left: (slide.pos - current.pos) * slidePos.width + (slide.pos - current.pos) * slide.opts.gutter
2619            },
2620            duration,
2621            function () {
2622              slide.$slide
2623                .css({
2624                  transform: "",
2625                  opacity: ""
2626                })
2627                .removeClass("fancybox-slide--next fancybox-slide--previous");
2628
2629              if (slide.pos === self.currPos) {
2630                self.complete();
2631              }
2632            }
2633          );
2634        });
2635      } else if (duration && current.opts.transitionEffect) {
2636        // Set transition effect for previously active slide
2637        prop = "fancybox-animated fancybox-fx-" + current.opts.transitionEffect;
2638
2639        previous.$slide.addClass("fancybox-slide--" + (previous.pos > current.pos ? "next" : "previous"));
2640
2641        $.fancybox.animate(
2642          previous.$slide,
2643          prop,
2644          duration,
2645          function () {
2646            previous.$slide.removeClass(prop).removeClass("fancybox-slide--next fancybox-slide--previous");
2647          },
2648          false
2649        );
2650      }
2651
2652      if (current.isLoaded) {
2653        self.revealContent(current);
2654      } else {
2655        self.loadSlide(current);
2656      }
2657
2658      self.preload("image");
2659    },
2660
2661    // Create new "slide" element
2662    // These are gallery items  that are actually added to DOM
2663    // =======================================================
2664
2665    createSlide: function (pos) {
2666      var self = this,
2667        $slide,
2668        index;
2669
2670      index = pos % self.group.length;
2671      index = index < 0 ? self.group.length + index : index;
2672
2673      if (!self.slides[pos] && self.group[index]) {
2674        $slide = $('<div class="fancybox-slide"></div>').appendTo(self.$refs.stage);
2675
2676        self.slides[pos] = $.extend(true, {}, self.group[index], {
2677          pos: pos,
2678          $slide: $slide,
2679          isLoaded: false
2680        });
2681
2682        self.updateSlide(self.slides[pos]);
2683      }
2684
2685      return self.slides[pos];
2686    },
2687
2688    // Scale image to the actual size of the image;
2689    // x and y values should be relative to the slide
2690    // ==============================================
2691
2692    scaleToActual: function (x, y, duration) {
2693      var self = this,
2694        current = self.current,
2695        $content = current.$content,
2696        canvasWidth = $.fancybox.getTranslate(current.$slide).width,
2697        canvasHeight = $.fancybox.getTranslate(current.$slide).height,
2698        newImgWidth = current.width,
2699        newImgHeight = current.height,
2700        imgPos,
2701        posX,
2702        posY,
2703        scaleX,
2704        scaleY;
2705
2706      if (self.isAnimating || self.isMoved() || !$content || !(current.type == "image" && current.isLoaded && !current.hasError)) {
2707        return;
2708      }
2709
2710      self.isAnimating = true;
2711
2712      $.fancybox.stop($content);
2713
2714      x = x === undefined ? canvasWidth * 0.5 : x;
2715      y = y === undefined ? canvasHeight * 0.5 : y;
2716
2717      imgPos = $.fancybox.getTranslate($content);
2718
2719      imgPos.top -= $.fancybox.getTranslate(current.$slide).top;
2720      imgPos.left -= $.fancybox.getTranslate(current.$slide).left;
2721
2722      scaleX = newImgWidth / imgPos.width;
2723      scaleY = newImgHeight / imgPos.height;
2724
2725      // Get center position for original image
2726      posX = canvasWidth * 0.5 - newImgWidth * 0.5;
2727      posY = canvasHeight * 0.5 - newImgHeight * 0.5;
2728
2729      // Make sure image does not move away from edges
2730      if (newImgWidth > canvasWidth) {
2731        posX = imgPos.left * scaleX - (x * scaleX - x);
2732
2733        if (posX > 0) {
2734          posX = 0;
2735        }
2736
2737        if (posX < canvasWidth - newImgWidth) {
2738          posX = canvasWidth - newImgWidth;
2739        }
2740      }
2741
2742      if (newImgHeight > canvasHeight) {
2743        posY = imgPos.top * scaleY - (y * scaleY - y);
2744
2745        if (posY > 0) {
2746          posY = 0;
2747        }
2748
2749        if (posY < canvasHeight - newImgHeight) {
2750          posY = canvasHeight - newImgHeight;
2751        }
2752      }
2753
2754      self.updateCursor(newImgWidth, newImgHeight);
2755
2756      $.fancybox.animate(
2757        $content, {
2758          top: posY,
2759          left: posX,
2760          scaleX: scaleX,
2761          scaleY: scaleY
2762        },
2763        duration || 366,
2764        function () {
2765          self.isAnimating = false;
2766        }
2767      );
2768
2769      // Stop slideshow
2770      if (self.SlideShow && self.SlideShow.isActive) {
2771        self.SlideShow.stop();
2772      }
2773    },
2774
2775    // Scale image to fit inside parent element
2776    // ========================================
2777
2778    scaleToFit: function (duration) {
2779      var self = this,
2780        current = self.current,
2781        $content = current.$content,
2782        end;
2783
2784      if (self.isAnimating || self.isMoved() || !$content || !(current.type == "image" && current.isLoaded && !current.hasError)) {
2785        return;
2786      }
2787
2788      self.isAnimating = true;
2789
2790      $.fancybox.stop($content);
2791
2792      end = self.getFitPos(current);
2793
2794      self.updateCursor(end.width, end.height);
2795
2796      $.fancybox.animate(
2797        $content, {
2798          top: end.top,
2799          left: end.left,
2800          scaleX: end.width / $content.width(),
2801          scaleY: end.height / $content.height()
2802        },
2803        duration || 366,
2804        function () {
2805          self.isAnimating = false;
2806        }
2807      );
2808    },
2809
2810    // Calculate image size to fit inside viewport
2811    // ===========================================
2812
2813    getFitPos: function (slide) {
2814      var self = this,
2815        $content = slide.$content,
2816        $slide = slide.$slide,
2817        width = slide.width || slide.opts.width,
2818        height = slide.height || slide.opts.height,
2819        maxWidth,
2820        maxHeight,
2821        minRatio,
2822        aspectRatio,
2823        rez = {};
2824
2825      if (!slide.isLoaded || !$content || !$content.length) {
2826        return false;
2827      }
2828
2829      maxWidth = $.fancybox.getTranslate(self.$refs.stage).width;
2830      maxHeight = $.fancybox.getTranslate(self.$refs.stage).height;
2831
2832      maxWidth -=
2833        parseFloat($slide.css("paddingLeft")) +
2834        parseFloat($slide.css("paddingRight")) +
2835        parseFloat($content.css("marginLeft")) +
2836        parseFloat($content.css("marginRight"));
2837
2838      maxHeight -=
2839        parseFloat($slide.css("paddingTop")) +
2840        parseFloat($slide.css("paddingBottom")) +
2841        parseFloat($content.css("marginTop")) +
2842        parseFloat($content.css("marginBottom"));
2843
2844      if (!width || !height) {
2845        width = maxWidth;
2846        height = maxHeight;
2847      }
2848
2849      minRatio = Math.min(1, maxWidth / width, maxHeight / height);
2850
2851      width = minRatio * width;
2852      height = minRatio * height;
2853
2854      // Adjust width/height to precisely fit into container
2855      if (width > maxWidth - 0.5) {
2856        width = maxWidth;
2857      }
2858
2859      if (height > maxHeight - 0.5) {
2860        height = maxHeight;
2861      }
2862
2863      if (slide.type === "image") {
2864        rez.top = Math.floor((maxHeight - height) * 0.5) + parseFloat($slide.css("paddingTop"));
2865        rez.left = Math.floor((maxWidth - width) * 0.5) + parseFloat($slide.css("paddingLeft"));
2866      } else if (slide.contentType === "video") {
2867        // Force aspect ratio for the video
2868        // "I say the whole world must learn of our peaceful ways… by force!"
2869        aspectRatio = slide.opts.width && slide.opts.height ? width / height : slide.opts.ratio || 16 / 9;
2870
2871        if (height > width / aspectRatio) {
2872          height = width / aspectRatio;
2873        } else if (width > height * aspectRatio) {
2874          width = height * aspectRatio;
2875        }
2876      }
2877
2878      rez.width = width;
2879      rez.height = height;
2880
2881      return rez;
2882    },
2883
2884    // Update content size and position for all slides
2885    // ==============================================
2886
2887    update: function (e) {
2888      var self = this;
2889
2890      $.each(self.slides, function (key, slide) {
2891        self.updateSlide(slide, e);
2892      });
2893    },
2894
2895    // Update slide content position and size
2896    // ======================================
2897
2898    updateSlide: function (slide, e) {
2899      var self = this,
2900        $content = slide && slide.$content,
2901        width = slide.width || slide.opts.width,
2902        height = slide.height || slide.opts.height,
2903        $slide = slide.$slide;
2904
2905      // First, prevent caption overlap, if needed
2906      self.adjustCaption(slide);
2907
2908      // Then resize content to fit inside the slide
2909      if ($content && (width || height || slide.contentType === "video") && !slide.hasError) {
2910        $.fancybox.stop($content);
2911
2912        $.fancybox.setTranslate($content, self.getFitPos(slide));
2913
2914        if (slide.pos === self.currPos) {
2915          self.isAnimating = false;
2916
2917          self.updateCursor();
2918        }
2919      }
2920
2921      // Then some adjustments
2922      self.adjustLayout(slide);
2923
2924      if ($slide.length) {
2925        $slide.trigger("refresh");
2926
2927        if (slide.pos === self.currPos) {
2928          self.$refs.toolbar
2929            .add(self.$refs.navigation.find(".fancybox-button--arrow_right"))
2930            .toggleClass("compensate-for-scrollbar", $slide.get(0).scrollHeight > $slide.get(0).clientHeight);
2931        }
2932      }
2933
2934      self.trigger("onUpdate", slide, e);
2935    },
2936
2937    // Horizontally center slide
2938    // =========================
2939
2940    centerSlide: function (duration) {
2941      var self = this,
2942        current = self.current,
2943        $slide = current.$slide;
2944
2945      if (self.isClosing || !current) {
2946        return;
2947      }
2948
2949      $slide.siblings().css({
2950        transform: "",
2951        opacity: ""
2952      });
2953
2954      $slide
2955        .parent()
2956        .children()
2957        .removeClass("fancybox-slide--previous fancybox-slide--next");
2958
2959      $.fancybox.animate(
2960        $slide, {
2961          top: 0,
2962          left: 0,
2963          opacity: 1
2964        },
2965        duration === undefined ? 0 : duration,
2966        function () {
2967          // Clean up
2968          $slide.css({
2969            transform: "",
2970            opacity: ""
2971          });
2972
2973          if (!current.isComplete) {
2974            self.complete();
2975          }
2976        },
2977        false
2978      );
2979    },
2980
2981    // Check if current slide is moved (swiped)
2982    // ========================================
2983
2984    isMoved: function (slide) {
2985      var current = slide || this.current,
2986        slidePos,
2987        stagePos;
2988
2989      if (!current) {
2990        return false;
2991      }
2992
2993      stagePos = $.fancybox.getTranslate(this.$refs.stage);
2994      slidePos = $.fancybox.getTranslate(current.$slide);
2995
2996      return (
2997        !current.$slide.hasClass("fancybox-animated") &&
2998        (Math.abs(slidePos.top - stagePos.top) > 0.5 || Math.abs(slidePos.left - stagePos.left) > 0.5)
2999      );
3000    },
3001
3002    // Update cursor style depending if content can be zoomed
3003    // ======================================================
3004
3005    updateCursor: function (nextWidth, nextHeight) {
3006      var self = this,
3007        current = self.current,
3008        $container = self.$refs.container,
3009        canPan,
3010        isZoomable;
3011
3012      if (!current || self.isClosing || !self.Guestures) {
3013        return;
3014      }
3015
3016      $container.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-zoomOut fancybox-can-swipe fancybox-can-pan");
3017
3018      canPan = self.canPan(nextWidth, nextHeight);
3019
3020      isZoomable = canPan ? true : self.isZoomable();
3021
3022      $container.toggleClass("fancybox-is-zoomable", isZoomable);
3023
3024      $("[data-fancybox-zoom]").prop("disabled", !isZoomable);
3025
3026      if (canPan) {
3027        $container.addClass("fancybox-can-pan");
3028      } else if (
3029        isZoomable &&
3030        (current.opts.clickContent === "zoom" || ($.isFunction(current.opts.clickContent) && current.opts.clickContent(current) == "zoom"))
3031      ) {
3032        $container.addClass("fancybox-can-zoomIn");
3033      } else if (current.opts.touch && (current.opts.touch.vertical || self.group.length > 1) && current.contentType !== "video") {
3034        $container.addClass("fancybox-can-swipe");
3035      }
3036    },
3037
3038    // Check if current slide is zoomable
3039    // ==================================
3040
3041    isZoomable: function () {
3042      var self = this,
3043        current = self.current,
3044        fitPos;
3045
3046      // Assume that slide is zoomable if:
3047      //   - image is still loading
3048      //   - actual size of the image is smaller than available area
3049      if (current && !self.isClosing && current.type === "image" && !current.hasError) {
3050        if (!current.isLoaded) {
3051          return true;
3052        }
3053
3054        fitPos = self.getFitPos(current);
3055
3056        if (fitPos && (current.width > fitPos.width || current.height > fitPos.height)) {
3057          return true;
3058        }
3059      }
3060
3061      return false;
3062    },
3063
3064    // Check if current image dimensions are smaller than actual
3065    // =========================================================
3066
3067    isScaledDown: function (nextWidth, nextHeight) {
3068      var self = this,
3069        rez = false,
3070        current = self.current,
3071        $content = current.$content;
3072
3073      if (nextWidth !== undefined && nextHeight !== undefined) {
3074        rez = nextWidth < current.width && nextHeight < current.height;
3075      } else if ($content) {
3076        rez = $.fancybox.getTranslate($content);
3077        rez = rez.width < current.width && rez.height < current.height;
3078      }
3079
3080      return rez;
3081    },
3082
3083    // Check if image dimensions exceed parent element
3084    // ===============================================
3085
3086    canPan: function (nextWidth, nextHeight) {
3087      var self = this,
3088        current = self.current,
3089        pos = null,
3090        rez = false;
3091
3092      if (current.type === "image" && (current.isComplete || (nextWidth && nextHeight)) && !current.hasError) {
3093        rez = self.getFitPos(current);
3094
3095        if (nextWidth !== undefined && nextHeight !== undefined) {
3096          pos = {
3097            width: nextWidth,
3098            height: nextHeight
3099          };
3100        } else if (current.isComplete) {
3101          pos = $.fancybox.getTranslate(current.$content);
3102        }
3103
3104        if (pos && rez) {
3105          rez = Math.abs(pos.width - rez.width) > 1.5 || Math.abs(pos.height - rez.height) > 1.5;
3106        }
3107      }
3108
3109      return rez;
3110    },
3111
3112    // Load content into the slide
3113    // ===========================
3114
3115    loadSlide: function (slide) {
3116      var self = this,
3117        type,
3118        $slide,
3119        ajaxLoad;
3120
3121      if (slide.isLoading || slide.isLoaded) {
3122        return;
3123      }
3124
3125      slide.isLoading = true;
3126
3127      if (self.trigger("beforeLoad", slide) === false) {
3128        slide.isLoading = false;
3129
3130        return false;
3131      }
3132
3133      type = slide.type;
3134      $slide = slide.$slide;
3135
3136      $slide
3137        .off("refresh")
3138        .trigger("onReset")
3139        .addClass(slide.opts.slideClass);
3140
3141      // Create content depending on the type
3142      switch (type) {
3143        case "image":
3144          self.setImage(slide);
3145
3146          break;
3147
3148        case "iframe":
3149          self.setIframe(slide);
3150
3151          break;
3152
3153        case "html":
3154          self.setContent(slide, slide.src || slide.content);
3155
3156          break;
3157
3158        case "video":
3159          self.setContent(
3160            slide,
3161            slide.opts.video.tpl
3162            .replace(/\{\{src\}\}/gi, slide.src)
3163            .replace("{{format}}", slide.opts.videoFormat || slide.opts.video.format || "")
3164            .replace("{{poster}}", slide.thumb || "")
3165          );
3166
3167          break;
3168
3169        case "inline":
3170          if ($(slide.src).length) {
3171            self.setContent(slide, $(slide.src));
3172          } else {
3173            self.setError(slide);
3174          }
3175
3176          break;
3177
3178        case "ajax":
3179          self.showLoading(slide);
3180
3181          ajaxLoad = $.ajax(
3182            $.extend({}, slide.opts.ajax.settings, {
3183              url: slide.src,
3184              success: function (data, textStatus) {
3185                if (textStatus === "success") {
3186                  self.setContent(slide, data);
3187                }
3188              },
3189              error: function (jqXHR, textStatus) {
3190                if (jqXHR && textStatus !== "abort") {
3191                  self.setError(slide);
3192                }
3193              }
3194            })
3195          );
3196
3197          $slide.one("onReset", function () {
3198            ajaxLoad.abort();
3199          });
3200
3201          break;
3202
3203        default:
3204          self.setError(slide);
3205
3206          break;
3207      }
3208
3209      return true;
3210    },
3211
3212    // Use thumbnail image, if possible
3213    // ================================
3214
3215    setImage: function (slide) {
3216      var self = this,
3217        ghost;
3218
3219      // Check if need to show loading icon
3220      setTimeout(function () {
3221        var $img = slide.$image;
3222
3223        if (!self.isClosing && slide.isLoading && (!$img || !$img.length || !$img[0].complete) && !slide.hasError) {
3224          self.showLoading(slide);
3225        }
3226      }, 50);
3227
3228      //Check if image has srcset
3229      self.checkSrcset(slide);
3230
3231      // This will be wrapper containing both ghost and actual image
3232      slide.$content = $('<div class="fancybox-content"></div>')
3233        .addClass("fancybox-is-hidden")
3234        .appendTo(slide.$slide.addClass("fancybox-slide--image"));
3235
3236      // If we have a thumbnail, we can display it while actual image is loading
3237      // Users will not stare at black screen and actual image will appear gradually
3238      if (slide.opts.preload !== false && slide.opts.width && slide.opts.height && slide.thumb) {
3239        slide.width = slide.opts.width;
3240        slide.height = slide.opts.height;
3241
3242        ghost = document.createElement("img");
3243
3244        ghost.onerror = function () {
3245          $(this).remove();
3246
3247          slide.$ghost = null;
3248        };
3249
3250        ghost.onload = function () {
3251          self.afterLoad(slide);
3252        };
3253
3254        slide.$ghost = $(ghost)
3255          .addClass("fancybox-image")
3256          .appendTo(slide.$content)
3257          .attr("src", slide.thumb);
3258      }
3259
3260      // Start loading actual image
3261      self.setBigImage(slide);
3262    },
3263
3264    // Check if image has srcset and get the source
3265    // ============================================
3266    checkSrcset: function (slide) {
3267      var srcset = slide.opts.srcset || slide.opts.image.srcset,
3268        found,
3269        temp,
3270        pxRatio,
3271        windowWidth;
3272
3273      // If we have "srcset", then we need to find first matching "src" value.
3274      // This is necessary, because when you set an src attribute, the browser will preload the image
3275      // before any javascript or even CSS is applied.
3276      if (srcset) {
3277        pxRatio = window.devicePixelRatio || 1;
3278        windowWidth = window.innerWidth * pxRatio;
3279
3280        temp = srcset.split(",").map(function (el) {
3281          var ret = {};
3282
3283          el.trim()
3284            .split(/\s+/)
3285            .forEach(function (el, i) {
3286              var value = parseInt(el.substring(0, el.length - 1), 10);
3287
3288              if (i === 0) {
3289                return (ret.url = el);
3290              }
3291
3292              if (value) {
3293                ret.value = value;
3294                ret.postfix = el[el.length - 1];
3295              }
3296            });
3297
3298          return ret;
3299        });
3300
3301        // Sort by value
3302        temp.sort(function (a, b) {
3303          return a.value - b.value;
3304        });
3305
3306        // Ok, now we have an array of all srcset values
3307        for (var j = 0; j < temp.length; j++) {
3308          var el = temp[j];
3309
3310          if ((el.postfix === "w" && el.value >= windowWidth) || (el.postfix === "x" && el.value >= pxRatio)) {
3311            found = el;
3312            break;
3313          }
3314        }
3315
3316        // If not found, take the last one
3317        if (!found && temp.length) {
3318          found = temp[temp.length - 1];
3319        }
3320
3321        if (found) {
3322          slide.src = found.url;
3323
3324          // If we have default width/height values, we can calculate height for matching source
3325          if (slide.width && slide.height && found.postfix == "w") {
3326            slide.height = (slide.width / slide.height) * found.value;
3327            slide.width = found.value;
3328          }
3329
3330          slide.opts.srcset = srcset;
3331        }
3332      }
3333    },
3334
3335    // Create full-size image
3336    // ======================
3337
3338    setBigImage: function (slide) {
3339      var self = this,
3340        img = document.createElement("img"),
3341        $img = $(img);
3342
3343      slide.$image = $img
3344        .one("error", function () {
3345          self.setError(slide);
3346        })
3347        .one("load", function () {
3348          var sizes;
3349
3350          if (!slide.$ghost) {
3351            self.resolveImageSlideSize(slide, this.naturalWidth, this.naturalHeight);
3352
3353            self.afterLoad(slide);
3354          }
3355
3356          if (self.isClosing) {
3357            return;
3358          }
3359
3360          if (slide.opts.srcset) {
3361            sizes = slide.opts.sizes;
3362
3363            if (!sizes || sizes === "auto") {
3364              sizes =
3365                (slide.width / slide.height > 1 && $W.width() / $W.height() > 1 ? "100" : Math.round((slide.width / slide.height) * 100)) +
3366                "vw";
3367            }
3368
3369            $img.attr("sizes", sizes).attr("srcset", slide.opts.srcset);
3370          }
3371
3372          // Hide temporary image after some delay
3373          if (slide.$ghost) {
3374            setTimeout(function () {
3375              if (slide.$ghost && !self.isClosing) {
3376                slide.$ghost.hide();
3377              }
3378            }, Math.min(300, Math.max(1000, slide.height / 1600)));
3379          }
3380
3381          self.hideLoading(slide);
3382        })
3383        .addClass("fancybox-image")
3384        .attr("src", slide.src)
3385        .appendTo(slide.$content);
3386
3387      if ((img.complete || img.readyState == "complete") && $img.naturalWidth && $img.naturalHeight) {
3388        $img.trigger("load");
3389      } else if (img.error) {
3390        $img.trigger("error");
3391      }
3392    },
3393
3394    // Computes the slide size from image size and maxWidth/maxHeight
3395    // ==============================================================
3396
3397    resolveImageSlideSize: function (slide, imgWidth, imgHeight) {
3398      var maxWidth = parseInt(slide.opts.width, 10),
3399        maxHeight = parseInt(slide.opts.height, 10);
3400
3401      // Sets the default values from the image
3402      slide.width = imgWidth;
3403      slide.height = imgHeight;
3404
3405      if (maxWidth > 0) {
3406        slide.width = maxWidth;
3407        slide.height = Math.floor((maxWidth * imgHeight) / imgWidth);
3408      }
3409
3410      if (maxHeight > 0) {
3411        slide.width = Math.floor((maxHeight * imgWidth) / imgHeight);
3412        slide.height = maxHeight;
3413      }
3414    },
3415
3416    // Create iframe wrapper, iframe and bindings
3417    // ==========================================
3418
3419    setIframe: function (slide) {
3420      var self = this,
3421        opts = slide.opts.iframe,
3422        $slide = slide.$slide,
3423        $iframe;
3424
3425      slide.$content = $('<div class="fancybox-content' + (opts.preload ? " fancybox-is-hidden" : "") + '"></div>')
3426        .css(opts.css)
3427        .appendTo($slide);
3428
3429      $slide.addClass("fancybox-slide--" + slide.contentType);
3430
3431      slide.$iframe = $iframe = $(opts.tpl.replace(/\{rnd\}/g, new Date().getTime()))
3432        .attr(opts.attr)
3433        .appendTo(slide.$content);
3434
3435      if (opts.preload) {
3436        self.showLoading(slide);
3437
3438        // Unfortunately, it is not always possible to determine if iframe is successfully loaded
3439        // (due to browser security policy)
3440
3441        $iframe.on("load.fb error.fb", function (e) {
3442          this.isReady = 1;
3443
3444          slide.$slide.trigger("refresh");
3445
3446          self.afterLoad(slide);
3447        });
3448
3449        // Recalculate iframe content size
3450        // ===============================
3451
3452        $slide.on("refresh.fb", function () {
3453          var $content = slide.$content,
3454            frameWidth = opts.css.width,
3455            frameHeight = opts.css.height,
3456            $contents,
3457            $body;
3458
3459          if ($iframe[0].isReady !== 1) {
3460            return;
3461          }
3462
3463          try {
3464            $contents = $iframe.contents();
3465            $body = $contents.find("body");
3466          } catch (ignore) {}
3467
3468          // Calculate content dimensions, if it is accessible
3469          if ($body && $body.length && $body.children().length) {
3470            // Avoid scrolling to top (if multiple instances)
3471            $slide.css("overflow", "visible");
3472
3473            $content.css({
3474              width: "100%",
3475              "max-width": "100%",
3476              height: "9999px"
3477            });
3478
3479            if (frameWidth === undefined) {
3480              frameWidth = Math.ceil(Math.max($body[0].clientWidth, $body.outerWidth(true)));
3481            }
3482
3483            $content.css("width", frameWidth ? frameWidth : "").css("max-width", "");
3484
3485            if (frameHeight === undefined) {
3486              frameHeight = Math.ceil(Math.max($body[0].clientHeight, $body.outerHeight(true)));
3487            }
3488
3489            $content.css("height", frameHeight ? frameHeight : "");
3490
3491            $slide.css("overflow", "auto");
3492          }
3493
3494          $content.removeClass("fancybox-is-hidden");
3495        });
3496      } else {
3497        self.afterLoad(slide);
3498      }
3499
3500      $iframe.attr("src", slide.src);
3501
3502      // Remove iframe if closing or changing gallery item
3503      $slide.one("onReset", function () {
3504        // This helps IE not to throw errors when closing
3505        try {
3506          $(this)
3507            .find("iframe")
3508            .hide()
3509            .unbind()
3510            .attr("src", "//about:blank");
3511        } catch (ignore) {}
3512
3513        $(this)
3514          .off("refresh.fb")
3515          .empty();
3516
3517        slide.isLoaded = false;
3518        slide.isRevealed = false;
3519      });
3520    },
3521
3522    // Wrap and append content to the slide
3523    // ======================================
3524
3525    setContent: function (slide, content) {
3526      var self = this;
3527
3528      if (self.isClosing) {
3529        return;
3530      }
3531
3532      self.hideLoading(slide);
3533
3534      if (slide.$content) {
3535        $.fancybox.stop(slide.$content);
3536      }
3537
3538      slide.$slide.empty();
3539
3540      // If content is a jQuery object, then it will be moved to the slide.
3541      // The placeholder is created so we will know where to put it back.
3542      if (isQuery(content) && content.parent().length) {
3543        // Make sure content is not already moved to fancyBox
3544        if (content.hasClass("fancybox-content") || content.parent().hasClass("fancybox-content")) {
3545          content.parents(".fancybox-slide").trigger("onReset");
3546        }
3547
3548        // Create temporary element marking original place of the content
3549        slide.$placeholder = $("<div>")
3550          .hide()
3551          .insertAfter(content);
3552
3553        // Make sure content is visible
3554        content.css("display", "inline-block");
3555      } else if (!slide.hasError) {
3556        // If content is just a plain text, try to convert it to html
3557        if ($.type(content) === "string") {
3558          content = $("<div>")
3559            .append($.trim(content))
3560            .contents();
3561        }
3562
3563        // If "filter" option is provided, then filter content
3564        if (slide.opts.filter) {
3565          content = $("<div>")
3566            .html(content)
3567            .find(slide.opts.filter);
3568        }
3569      }
3570
3571      slide.$slide.one("onReset", function () {
3572        // Pause all html5 video/audio
3573        $(this)
3574          .find("video,audio")
3575          .trigger("pause");
3576
3577        // Put content back
3578        if (slide.$placeholder) {
3579          slide.$placeholder.after(content.removeClass("fancybox-content").hide()).remove();
3580
3581          slide.$placeholder = null;
3582        }
3583
3584        // Remove custom close button
3585        if (slide.$smallBtn) {
3586          slide.$smallBtn.remove();
3587
3588          slide.$smallBtn = null;
3589        }
3590
3591        // Remove content and mark slide as not loaded
3592        if (!slide.hasError) {
3593          $(this).empty();
3594
3595          slide.isLoaded = false;
3596          slide.isRevealed = false;
3597        }
3598      });
3599
3600      $(content).appendTo(slide.$slide);
3601
3602      if ($(content).is("video,audio")) {
3603        $(content).addClass("fancybox-video");
3604
3605        $(content).wrap("<div></div>");
3606
3607        slide.contentType = "video";
3608
3609        slide.opts.width = slide.opts.width || $(content).attr("width");
3610        slide.opts.height = slide.opts.height || $(content).attr("height");
3611      }
3612
3613      slide.$content = slide.$slide
3614        .children()
3615        .filter("div,form,main,video,audio,article,.fancybox-content")
3616        .first();
3617
3618      slide.$content.siblings().hide();
3619
3620      // Re-check if there is a valid content
3621      // (in some cases, ajax response can contain various elements or plain text)
3622      if (!slide.$content.length) {
3623        slide.$content = slide.$slide
3624          .wrapInner("<div></div>")
3625          .children()
3626          .first();
3627      }
3628
3629      slide.$content.addClass("fancybox-content");
3630
3631      slide.$slide.addClass("fancybox-slide--" + slide.contentType);
3632
3633      self.afterLoad(slide);
3634    },
3635
3636    // Display error message
3637    // =====================
3638
3639    setError: function (slide) {
3640      slide.hasError = true;
3641
3642      slide.$slide
3643        .trigger("onReset")
3644        .removeClass("fancybox-slide--" + slide.contentType)
3645        .addClass("fancybox-slide--error");
3646
3647      slide.contentType = "html";
3648
3649      this.setContent(slide, this.translate(slide, slide.opts.errorTpl));
3650
3651      if (slide.pos === this.currPos) {
3652        this.isAnimating = false;
3653      }
3654    },
3655
3656    // Show loading icon inside the slide
3657    // ==================================
3658
3659    showLoading: function (slide) {
3660      var self = this;
3661
3662      slide = slide || self.current;
3663
3664      if (slide && !slide.$spinner) {
3665        slide.$spinner = $(self.translate(self, self.opts.spinnerTpl))
3666          .appendTo(slide.$slide)
3667          .hide()
3668          .fadeIn("fast");
3669      }
3670    },
3671
3672    // Remove loading icon from the slide
3673    // ==================================
3674
3675    hideLoading: function (slide) {
3676      var self = this;
3677
3678      slide = slide || self.current;
3679
3680      if (slide && slide.$spinner) {
3681        slide.$spinner.stop().remove();
3682
3683        delete slide.$spinner;
3684      }
3685    },
3686
3687    // Adjustments after slide content has been loaded
3688    // ===============================================
3689
3690    afterLoad: function (slide) {
3691      var self = this;
3692
3693      if (self.isClosing) {
3694        return;
3695      }
3696
3697      slide.isLoading = false;
3698      slide.isLoaded = true;
3699
3700      self.trigger("afterLoad", slide);
3701
3702      self.hideLoading(slide);
3703
3704      // Add small close button
3705      if (slide.opts.smallBtn && (!slide.$smallBtn || !slide.$smallBtn.length)) {
3706        slide.$smallBtn = $(self.translate(slide, slide.opts.btnTpl.smallBtn)).appendTo(slide.$content);
3707      }
3708
3709      // Disable right click
3710      if (slide.opts.protect && slide.$content && !slide.hasError) {
3711        slide.$content.on("contextmenu.fb", function (e) {
3712          if (e.button == 2) {
3713            e.preventDefault();
3714          }
3715
3716          return true;
3717        });
3718
3719        // Add fake element on top of the image
3720        // This makes a bit harder for user to select image
3721        if (slide.type === "image") {
3722          $('<div class="fancybox-spaceball"></div>').appendTo(slide.$content);
3723        }
3724      }
3725
3726      self.adjustCaption(slide);
3727
3728      self.adjustLayout(slide);
3729
3730      if (slide.pos === self.currPos) {
3731        self.updateCursor();
3732      }
3733
3734      self.revealContent(slide);
3735    },
3736
3737    // Prevent caption overlap,
3738    // fix css inconsistency across browsers
3739    // =====================================
3740
3741    adjustCaption: function (slide) {
3742      var self = this,
3743        current = slide || self.current,
3744        caption = current.opts.caption,
3745        preventOverlap = current.opts.preventCaptionOverlap,
3746        $caption = self.$refs.caption,
3747        $clone,
3748        captionH = false;
3749
3750      $caption.toggleClass("fancybox-caption--separate", preventOverlap);
3751
3752      if (preventOverlap && caption && caption.length) {
3753        if (current.pos !== self.currPos) {
3754          $clone = $caption.clone().appendTo($caption.parent());
3755
3756          $clone
3757            .children()
3758            .eq(0)
3759            .empty()
3760            .html(caption);
3761
3762          captionH = $clone.outerHeight(true);
3763
3764          $clone.empty().remove();
3765        } else if (self.$caption) {
3766          captionH = self.$caption.outerHeight(true);
3767        }
3768
3769        current.$slide.css("padding-bottom", captionH || "");
3770      }
3771    },
3772
3773    // Simple hack to fix inconsistency across browsers, described here (affects Edge, too):
3774    // https://bugzilla.mozilla.org/show_bug.cgi?id=748518
3775    // ====================================================================================
3776
3777    adjustLayout: function (slide) {
3778      var self = this,
3779        current = slide || self.current,
3780        scrollHeight,
3781        marginBottom,
3782        inlinePadding,
3783        actualPadding;
3784
3785      if (current.isLoaded && current.opts.disableLayoutFix !== true) {
3786        current.$content.css("margin-bottom", "");
3787
3788        // If we would always set margin-bottom for the content,
3789        // then it would potentially break vertical align
3790        if (current.$content.outerHeight() > current.$slide.height() + 0.5) {
3791          inlinePadding = current.$slide[0].style["padding-bottom"];
3792          actualPadding = current.$slide.css("padding-bottom");
3793
3794          if (parseFloat(actualPadding) > 0) {
3795            scrollHeight = current.$slide[0].scrollHeight;
3796
3797            current.$slide.css("padding-bottom", 0);
3798
3799            if (Math.abs(scrollHeight - current.$slide[0].scrollHeight) < 1) {
3800              marginBottom = actualPadding;
3801            }
3802
3803            current.$slide.css("padding-bottom", inlinePadding);
3804          }
3805        }
3806
3807        current.$content.css("margin-bottom", marginBottom);
3808      }
3809    },
3810
3811    // Make content visible
3812    // This method is called right after content has been loaded or
3813    // user navigates gallery and transition should start
3814    // ============================================================
3815
3816    revealContent: function (slide) {
3817      var self = this,
3818        $slide = slide.$slide,
3819        end = false,
3820        start = false,
3821        isMoved = self.isMoved(slide),
3822        isRevealed = slide.isRevealed,
3823        effect,
3824        effectClassName,
3825        duration,
3826        opacity;
3827
3828      slide.isRevealed = true;
3829
3830      effect = slide.opts[self.firstRun ? "animationEffect" : "transitionEffect"];
3831      duration = slide.opts[self.firstRun ? "animationDuration" : "transitionDuration"];
3832
3833      duration = parseInt(slide.forcedDuration === undefined ? duration : slide.forcedDuration, 10);
3834
3835      if (isMoved || slide.pos !== self.currPos || !duration) {
3836        effect = false;
3837      }
3838
3839      // Check if can zoom
3840      if (effect === "zoom") {
3841        if (slide.pos === self.currPos && duration && slide.type === "image" && !slide.hasError && (start = self.getThumbPos(slide))) {
3842          end = self.getFitPos(slide);
3843        } else {
3844          effect = "fade";
3845        }
3846      }
3847
3848      // Zoom animation
3849      // ==============
3850      if (effect === "zoom") {
3851        self.isAnimating = true;
3852
3853        end.scaleX = end.width / start.width;
3854        end.scaleY = end.height / start.height;
3855
3856        // Check if we need to animate opacity
3857        opacity = slide.opts.zoomOpacity;
3858
3859        if (opacity == "auto") {
3860          opacity = Math.abs(slide.width / slide.height - start.width / start.height) > 0.1;
3861        }
3862
3863        if (opacity) {
3864          start.opacity = 0.1;
3865          end.opacity = 1;
3866        }
3867
3868        // Draw image at start position
3869        $.fancybox.setTranslate(slide.$content.removeClass("fancybox-is-hidden"), start);
3870
3871        forceRedraw(slide.$content);
3872
3873        // Start animation
3874        $.fancybox.animate(slide.$content, end, duration, function () {
3875          self.isAnimating = false;
3876
3877          self.complete();
3878        });
3879
3880        return;
3881      }
3882
3883      self.updateSlide(slide);
3884
3885      // Simply show content if no effect
3886      // ================================
3887      if (!effect) {
3888        slide.$content.removeClass("fancybox-is-hidden");
3889
3890        if (!isRevealed && isMoved && slide.type === "image" && !slide.hasError) {
3891          slide.$content.hide().fadeIn("fast");
3892        }
3893
3894        if (slide.pos === self.currPos) {
3895          self.complete();
3896        }
3897
3898        return;
3899      }
3900
3901      // Prepare for CSS transiton
3902      // =========================
3903      $.fancybox.stop($slide);
3904
3905      //effectClassName = "fancybox-animated fancybox-slide--" + (slide.pos >= self.prevPos ? "next" : "previous") + " fancybox-fx-" + effect;
3906      effectClassName = "fancybox-slide--" + (slide.pos >= self.prevPos ? "next" : "previous") + " fancybox-animated fancybox-fx-" + effect;
3907
3908      $slide.addClass(effectClassName).removeClass("fancybox-slide--current"); //.addClass(effectClassName);
3909
3910      slide.$content.removeClass("fancybox-is-hidden");
3911
3912      // Force reflow
3913      forceRedraw($slide);
3914
3915      if (slide.type !== "image") {
3916        slide.$content.hide().show(0);
3917      }
3918
3919      $.fancybox.animate(
3920        $slide,
3921        "fancybox-slide--current",
3922        duration,
3923        function () {
3924          $slide.removeClass(effectClassName).css({
3925            transform: "",
3926            opacity: ""
3927          });
3928
3929          if (slide.pos === self.currPos) {
3930            self.complete();
3931          }
3932        },
3933        true
3934      );
3935    },
3936
3937    // Check if we can and have to zoom from thumbnail
3938    //================================================
3939
3940    getThumbPos: function (slide) {
3941      var rez = false,
3942        $thumb = slide.$thumb,
3943        thumbPos,
3944        btw,
3945        brw,
3946        bbw,
3947        blw;
3948
3949      if (!$thumb || !inViewport($thumb[0])) {
3950        return false;
3951      }
3952
3953      thumbPos = $.fancybox.getTranslate($thumb);
3954
3955      btw = parseFloat($thumb.css("border-top-width") || 0);
3956      brw = parseFloat($thumb.css("border-right-width") || 0);
3957      bbw = parseFloat($thumb.css("border-bottom-width") || 0);
3958      blw = parseFloat($thumb.css("border-left-width") || 0);
3959
3960      rez = {
3961        top: thumbPos.top + btw,
3962        left: thumbPos.left + blw,
3963        width: thumbPos.width - brw - blw,
3964        height: thumbPos.height - btw - bbw,
3965        scaleX: 1,
3966        scaleY: 1
3967      };
3968
3969      return thumbPos.width > 0 && thumbPos.height > 0 ? rez : false;
3970    },
3971
3972    // Final adjustments after current gallery item is moved to position
3973    // and it`s content is loaded
3974    // ==================================================================
3975
3976    complete: function () {
3977      var self = this,
3978        current = self.current,
3979        slides = {},
3980        $el;
3981
3982      if (self.isMoved() || !current.isLoaded) {
3983        return;
3984      }
3985
3986      if (!current.isComplete) {
3987        current.isComplete = true;
3988
3989        current.$slide.siblings().trigger("onReset");
3990
3991        self.preload("inline");
3992
3993        // Trigger any CSS transiton inside the slide
3994        forceRedraw(current.$slide);
3995
3996        current.$slide.addClass("fancybox-slide--complete");
3997
3998        // Remove unnecessary slides
3999        $.each(self.slides, function (key, slide) {
4000          if (slide.pos >= self.currPos - 1 && slide.pos <= self.currPos + 1) {
4001            slides[slide.pos] = slide;
4002          } else if (slide) {
4003            $.fancybox.stop(slide.$slide);
4004
4005            slide.$slide.off().remove();
4006          }
4007        });
4008
4009        self.slides = slides;
4010      }
4011
4012      self.isAnimating = false;
4013
4014      self.updateCursor();
4015
4016      self.trigger("afterShow");
4017
4018      // Autoplay first html5 video/audio
4019      if (!!current.opts.video.autoStart) {
4020        current.$slide
4021          .find("video,audio")
4022          .filter(":visible:first")
4023          .trigger("play")
4024          .one("ended", function () {
4025            if (Document.exitFullscreen) {
4026              Document.exitFullscreen();
4027            } else if (this.webkitExitFullscreen) {
4028              this.webkitExitFullscreen();
4029            }
4030
4031            self.next();
4032          });
4033      }
4034
4035      // Try to focus on the first focusable element
4036      if (current.opts.autoFocus && current.contentType === "html") {
4037        // Look for the first input with autofocus attribute
4038        $el = current.$content.find("input[autofocus]:enabled:visible:first");
4039
4040        if ($el.length) {
4041          $el.trigger("focus");
4042        } else {
4043          self.focus(null, true);
4044        }
4045      }
4046
4047      // Avoid jumping
4048      current.$slide.scrollTop(0).scrollLeft(0);
4049    },
4050
4051    // Preload next and previous slides
4052    // ================================
4053
4054    preload: function (type) {
4055      var self = this,
4056        prev,
4057        next;
4058
4059      if (self.group.length < 2) {
4060        return;
4061      }
4062
4063      next = self.slides[self.currPos + 1];
4064      prev = self.slides[self.currPos - 1];
4065
4066      if (prev && prev.type === type) {
4067        self.loadSlide(prev);
4068      }
4069
4070      if (next && next.type === type) {
4071        self.loadSlide(next);
4072      }
4073    },
4074
4075    // Try to find and focus on the first focusable element
4076    // ====================================================
4077
4078    focus: function (e, firstRun) {
4079      var self = this,
4080        focusableStr = [
4081          "a[href]",
4082          "area[href]",
4083          'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
4084          "select:not([disabled]):not([aria-hidden])",
4085          "textarea:not([disabled]):not([aria-hidden])",
4086          "button:not([disabled]):not([aria-hidden])",
4087          "iframe",
4088          "object",
4089          "embed",
4090          "video",
4091          "audio",
4092          "[contenteditable]",
4093          '[tabindex]:not([tabindex^="-"])'
4094        ].join(","),
4095        focusableItems,
4096        focusedItemIndex;
4097
4098      if (self.isClosing) {
4099        return;
4100      }
4101
4102      if (e || !self.current || !self.current.isComplete) {
4103        // Focus on any element inside fancybox
4104        focusableItems = self.$refs.container.find("*:visible");
4105      } else {
4106        // Focus inside current slide
4107        focusableItems = self.current.$slide.find("*:visible" + (firstRun ? ":not(.fancybox-close-small)" : ""));
4108      }
4109
4110      focusableItems = focusableItems.filter(focusableStr).filter(function () {
4111        return $(this).css("visibility") !== "hidden" && !$(this).hasClass("disabled");
4112      });
4113
4114      if (focusableItems.length) {
4115        focusedItemIndex = focusableItems.index(document.activeElement);
4116
4117        if (e && e.shiftKey) {
4118          // Back tab
4119          if (focusedItemIndex < 0 || focusedItemIndex == 0) {
4120            e.preventDefault();
4121
4122            focusableItems.eq(focusableItems.length - 1).trigger("focus");
4123          }
4124        } else {
4125          // Outside or Forward tab
4126          if (focusedItemIndex < 0 || focusedItemIndex == focusableItems.length - 1) {
4127            if (e) {
4128              e.preventDefault();
4129            }
4130
4131            focusableItems.eq(0).trigger("focus");
4132          }
4133        }
4134      } else {
4135        self.$refs.container.trigger("focus");
4136      }
4137    },
4138
4139    // Activates current instance - brings container to the front and enables keyboard,
4140    // notifies other instances about deactivating
4141    // =================================================================================
4142
4143    activate: function () {
4144      var self = this;
4145
4146      // Deactivate all instances
4147      $(".fancybox-container").each(function () {
4148        var instance = $(this).data("FancyBox");
4149
4150        // Skip self and closing instances
4151        if (instance && instance.id !== self.id && !instance.isClosing) {
4152          instance.trigger("onDeactivate");
4153
4154          instance.removeEvents();
4155
4156          instance.isVisible = false;
4157        }
4158      });
4159
4160      self.isVisible = true;
4161
4162      if (self.current || self.isIdle) {
4163        self.update();
4164
4165        self.updateControls();
4166      }
4167
4168      self.trigger("onActivate");
4169
4170      self.addEvents();
4171    },
4172
4173    // Start closing procedure
4174    // This will start "zoom-out" animation if needed and clean everything up afterwards
4175    // =================================================================================
4176
4177    close: function (e, d) {
4178      var self = this,
4179        current = self.current,
4180        effect,
4181        duration,
4182        $content,
4183        domRect,
4184        opacity,
4185        start,
4186        end;
4187
4188      var done = function () {
4189        self.cleanUp(e);
4190      };
4191
4192      if (self.isClosing) {
4193        return false;
4194      }
4195
4196      self.isClosing = true;
4197
4198      // If beforeClose callback prevents closing, make sure content is centered
4199      if (self.trigger("beforeClose", e) === false) {
4200        self.isClosing = false;
4201
4202        requestAFrame(function () {
4203          self.update();
4204        });
4205
4206        return false;
4207      }
4208
4209      // Remove all events
4210      // If there are multiple instances, they will be set again by "activate" method
4211      self.removeEvents();
4212
4213      $content = current.$content;
4214      effect = current.opts.animationEffect;
4215      duration = $.isNumeric(d) ? d : effect ? current.opts.animationDuration : 0;
4216
4217      current.$slide.removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated");
4218
4219      if (e !== true) {
4220        $.fancybox.stop(current.$slide);
4221      } else {
4222        effect = false;
4223      }
4224
4225      // Remove other slides
4226      current.$slide
4227        .siblings()
4228        .trigger("onReset")
4229        .remove();
4230
4231      // Trigger animations
4232      if (duration) {
4233        self.$refs.container
4234          .removeClass("fancybox-is-open")
4235          .addClass("fancybox-is-closing")
4236          .css("transition-duration", duration + "ms");
4237      }
4238
4239      // Clean up
4240      self.hideLoading(current);
4241
4242      self.hideControls(true);
4243
4244      self.updateCursor();
4245
4246      // Check if possible to zoom-out
4247      if (
4248        effect === "zoom" &&
4249        !($content && duration && current.type === "image" && !self.isMoved() && !current.hasError && (end = self.getThumbPos(current)))
4250      ) {
4251        effect = "fade";
4252      }
4253
4254      if (effect === "zoom") {
4255        $.fancybox.stop($content);
4256
4257        domRect = $.fancybox.getTranslate($content);
4258
4259        start = {
4260          top: domRect.top,
4261          left: domRect.left,
4262          scaleX: domRect.width / end.width,
4263          scaleY: domRect.height / end.height,
4264          width: end.width,
4265          height: end.height
4266        };
4267
4268        // Check if we need to animate opacity
4269        opacity = current.opts.zoomOpacity;
4270
4271        if (opacity == "auto") {
4272          opacity = Math.abs(current.width / current.height - end.width / end.height) > 0.1;
4273        }
4274
4275        if (opacity) {
4276          end.opacity = 0;
4277        }
4278
4279        $.fancybox.setTranslate($content, start);
4280
4281        forceRedraw($content);
4282
4283        $.fancybox.animate($content, end, duration, done);
4284
4285        return true;
4286      }
4287
4288      if (effect && duration) {
4289        $.fancybox.animate(
4290          current.$slide.addClass("fancybox-slide--previous").removeClass("fancybox-slide--current"),
4291          "fancybox-animated fancybox-fx-" + effect,
4292          duration,
4293          done
4294        );
4295      } else {
4296        // If skip animation
4297        if (e === true) {
4298          setTimeout(done, duration);
4299        } else {
4300          done();
4301        }
4302      }
4303
4304      return true;
4305    },
4306
4307    // Final adjustments after removing the instance
4308    // =============================================
4309
4310    cleanUp: function (e) {
4311      var self = this,
4312        instance,
4313        $focus = self.current.opts.$orig,
4314        x,
4315        y;
4316
4317      self.current.$slide.trigger("onReset");
4318
4319      self.$refs.container.empty().remove();
4320
4321      self.trigger("afterClose", e);
4322
4323      // Place back focus
4324      if (!!self.current.opts.backFocus) {
4325        if (!$focus || !$focus.length || !$focus.is(":visible")) {
4326          $focus = self.$trigger;
4327        }
4328
4329        if ($focus && $focus.length) {
4330          x = window.scrollX;
4331          y = window.scrollY;
4332
4333          $focus.trigger("focus");
4334
4335          $("html, body")
4336            .scrollTop(y)
4337            .scrollLeft(x);
4338        }
4339      }
4340
4341      self.current = null;
4342
4343      // Check if there are other instances
4344      instance = $.fancybox.getInstance();
4345
4346      if (instance) {
4347        instance.activate();
4348      } else {
4349        $("body").removeClass("fancybox-active compensate-for-scrollbar");
4350
4351        $("#fancybox-style-noscroll").remove();
4352      }
4353    },
4354
4355    // Call callback and trigger an event
4356    // ==================================
4357
4358    trigger: function (name, slide) {
4359      var args = Array.prototype.slice.call(arguments, 1),
4360        self = this,
4361        obj = slide && slide.opts ? slide : self.current,
4362        rez;
4363
4364      if (obj) {
4365        args.unshift(obj);
4366      } else {
4367        obj = self;
4368      }
4369
4370      args.unshift(self);
4371
4372      if ($.isFunction(obj.opts[name])) {
4373        rez = obj.opts[name].apply(obj, args);
4374      }
4375
4376      if (rez === false) {
4377        return rez;
4378      }
4379
4380      if (name === "afterClose" || !self.$refs) {
4381        $D.trigger(name + ".fb", args);
4382      } else {
4383        self.$refs.container.trigger(name + ".fb", args);
4384      }
4385    },
4386
4387    // Update infobar values, navigation button states and reveal caption
4388    // ==================================================================
4389
4390    updateControls: function () {
4391      var self = this,
4392        current = self.current,
4393        index = current.index,
4394        $container = self.$refs.container,
4395        $caption = self.$refs.caption,
4396        caption = current.opts.caption;
4397
4398      // Recalculate content dimensions
4399      current.$slide.trigger("refresh");
4400
4401      // Set caption
4402      if (caption && caption.length) {
4403        self.$caption = $caption;
4404
4405        $caption
4406          .children()
4407          .eq(0)
4408          .html(caption);
4409      } else {
4410        self.$caption = null;
4411      }
4412
4413      if (!self.hasHiddenControls && !self.isIdle) {
4414        self.showControls();
4415      }
4416
4417      // Update info and navigation elements
4418      $container.find("[data-fancybox-count]").html(self.group.length);
4419      $container.find("[data-fancybox-index]").html(index + 1);
4420
4421      $container.find("[data-fancybox-prev]").prop("disabled", !current.opts.loop && index <= 0);
4422      $container.find("[data-fancybox-next]").prop("disabled", !current.opts.loop && index >= self.group.length - 1);
4423
4424      if (current.type === "image") {
4425        // Re-enable buttons; update download button source
4426        $container
4427          .find("[data-fancybox-zoom]")
4428          .show()
4429          .end()
4430          .find("[data-fancybox-download]")
4431          .attr("href", current.opts.image.src || current.src)
4432          .show();
4433      } else if (current.opts.toolbar) {
4434        $container.find("[data-fancybox-download],[data-fancybox-zoom]").hide();
4435      }
4436
4437      // Make sure focus is not on disabled button/element
4438      if ($(document.activeElement).is(":hidden,[disabled]")) {
4439        self.$refs.container.trigger("focus");
4440      }
4441    },
4442
4443    // Hide toolbar and caption
4444    // ========================
4445
4446    hideControls: function (andCaption) {
4447      var self = this,
4448        arr = ["infobar", "toolbar", "nav"];
4449
4450      if (andCaption || !self.current.opts.preventCaptionOverlap) {
4451        arr.push("caption");
4452      }
4453
4454      this.$refs.container.removeClass(
4455        arr
4456        .map(function (i) {
4457          return "fancybox-show-" + i;
4458        })
4459        .join(" ")
4460      );
4461
4462      this.hasHiddenControls = true;
4463    },
4464
4465    showControls: function () {
4466      var self = this,
4467        opts = self.current ? self.current.opts : self.opts,
4468        $container = self.$refs.container;
4469
4470      self.hasHiddenControls = false;
4471      self.idleSecondsCounter = 0;
4472
4473      $container
4474        .toggleClass("fancybox-show-toolbar", !!(opts.toolbar && opts.buttons))
4475        .toggleClass("fancybox-show-infobar", !!(opts.infobar && self.group.length > 1))
4476        .toggleClass("fancybox-show-caption", !!self.$caption)
4477        .toggleClass("fancybox-show-nav", !!(opts.arrows && self.group.length > 1))
4478        .toggleClass("fancybox-is-modal", !!opts.modal);
4479    },
4480
4481    // Toggle toolbar and caption
4482    // ==========================
4483
4484    toggleControls: function () {
4485      if (this.hasHiddenControls) {
4486        this.showControls();
4487      } else {
4488        this.hideControls();
4489      }
4490    }
4491  });
4492
4493  $.fancybox = {
4494    version: "3.5.7",
4495    defaults: defaults,
4496
4497    // Get current instance and execute a command.
4498    //
4499    // Examples of usage:
4500    //
4501    //   $instance = $.fancybox.getInstance();
4502    //   $.fancybox.getInstance().jumpTo( 1 );
4503    //   $.fancybox.getInstance( 'jumpTo', 1 );
4504    //   $.fancybox.getInstance( function() {
4505    //       console.info( this.currIndex );
4506    //   });
4507    // ======================================================
4508
4509    getInstance: function (command) {
4510      var instance = $('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),
4511        args = Array.prototype.slice.call(arguments, 1);
4512
4513      if (instance instanceof FancyBox) {
4514        if ($.type(command) === "string") {
4515          instance[command].apply(instance, args);
4516        } else if ($.type(command) === "function") {
4517          command.apply(instance, args);
4518        }
4519
4520        return instance;
4521      }
4522
4523      return false;
4524    },
4525
4526    // Create new instance
4527    // ===================
4528
4529    open: function (items, opts, index) {
4530      return new FancyBox(items, opts, index);
4531    },
4532
4533    // Close current or all instances
4534    // ==============================
4535
4536    close: function (all) {
4537      var instance = this.getInstance();
4538
4539      if (instance) {
4540        instance.close();
4541
4542        // Try to find and close next instance
4543        if (all === true) {
4544          this.close(all);
4545        }
4546      }
4547    },
4548
4549    // Close all instances and unbind all events
4550    // =========================================
4551
4552    destroy: function () {
4553      this.close(true);
4554
4555      $D.add("body").off("click.fb-start", "**");
4556    },
4557
4558    // Try to detect mobile devices
4559    // ============================
4560
4561    isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
4562
4563    // Detect if 'translate3d' support is available
4564    // ============================================
4565
4566    use3d: (function () {
4567      var div = document.createElement("div");
4568
4569      return (
4570        window.getComputedStyle &&
4571        window.getComputedStyle(div) &&
4572        window.getComputedStyle(div).getPropertyValue("transform") &&
4573        !(document.documentMode && document.documentMode < 11)
4574      );
4575    })(),
4576
4577    // Helper function to get current visual state of an element
4578    // returns array[ top, left, horizontal-scale, vertical-scale, opacity ]
4579    // =====================================================================
4580
4581    getTranslate: function ($el) {
4582      var domRect;
4583
4584      if (!$el || !$el.length) {
4585        return false;
4586      }
4587
4588      domRect = $el[0].getBoundingClientRect();
4589
4590      return {
4591        top: domRect.top || 0,
4592        left: domRect.left || 0,
4593        width: domRect.width,
4594        height: domRect.height,
4595        opacity: parseFloat($el.css("opacity"))
4596      };
4597    },
4598
4599    // Shortcut for setting "translate3d" properties for element
4600    // Can set be used to set opacity, too
4601    // ========================================================
4602
4603    setTranslate: function ($el, props) {
4604      var str = "",
4605        css = {};
4606
4607      if (!$el || !props) {
4608        return;
4609      }
4610
4611      if (props.left !== undefined || props.top !== undefined) {
4612        str =
4613          (props.left === undefined ? $el.position().left : props.left) +
4614          "px, " +
4615          (props.top === undefined ? $el.position().top : props.top) +
4616          "px";
4617
4618        if (this.use3d) {
4619          str = "translate3d(" + str + ", 0px)";
4620        } else {
4621          str = "translate(" + str + ")";
4622        }
4623      }
4624
4625      if (props.scaleX !== undefined && props.scaleY !== undefined) {
4626        str += " scale(" + props.scaleX + ", " + props.scaleY + ")";
4627      } else if (props.scaleX !== undefined) {
4628        str += " scaleX(" + props.scaleX + ")";
4629      }
4630
4631      if (str.length) {
4632        css.transform = str;
4633      }
4634
4635      if (props.opacity !== undefined) {
4636        css.opacity = props.opacity;
4637      }
4638
4639      if (props.width !== undefined) {
4640        css.width = props.width;
4641      }
4642
4643      if (props.height !== undefined) {
4644        css.height = props.height;
4645      }
4646
4647      return $el.css(css);
4648    },
4649
4650    // Simple CSS transition handler
4651    // =============================
4652
4653    animate: function ($el, to, duration, callback, leaveAnimationName) {
4654      var self = this,
4655        from;
4656
4657      if ($.isFunction(duration)) {
4658        callback = duration;
4659        duration = null;
4660      }
4661
4662      self.stop($el);
4663
4664      from = self.getTranslate($el);
4665
4666      $el.on(transitionEnd, function (e) {
4667        // Skip events from child elements and z-index change
4668        if (e && e.originalEvent && (!$el.is(e.originalEvent.target) || e.originalEvent.propertyName == "z-index")) {
4669          return;
4670        }
4671
4672        self.stop($el);
4673
4674        if ($.isNumeric(duration)) {
4675          $el.css("transition-duration", "");
4676        }
4677
4678        if ($.isPlainObject(to)) {
4679          if (to.scaleX !== undefined && to.scaleY !== undefined) {
4680            self.setTranslate($el, {
4681              top: to.top,
4682              left: to.left,
4683              width: from.width * to.scaleX,
4684              height: from.height * to.scaleY,
4685              scaleX: 1,
4686              scaleY: 1
4687            });
4688          }
4689        } else if (leaveAnimationName !== true) {
4690          $el.removeClass(to);
4691        }
4692
4693        if ($.isFunction(callback)) {
4694          callback(e);
4695        }
4696      });
4697
4698      if ($.isNumeric(duration)) {
4699        $el.css("transition-duration", duration + "ms");
4700      }
4701
4702      // Start animation by changing CSS properties or class name
4703      if ($.isPlainObject(to)) {
4704        if (to.scaleX !== undefined && to.scaleY !== undefined) {
4705          delete to.width;
4706          delete to.height;
4707
4708          if ($el.parent().hasClass("fancybox-slide--image")) {
4709            $el.parent().addClass("fancybox-is-scaling");
4710          }
4711        }
4712
4713        $.fancybox.setTranslate($el, to);
4714      } else {
4715        $el.addClass(to);
4716      }
4717
4718      // Make sure that `transitionend` callback gets fired
4719      $el.data(
4720        "timer",
4721        setTimeout(function () {
4722          $el.trigger(transitionEnd);
4723        }, duration + 33)
4724      );
4725    },
4726
4727    stop: function ($el, callCallback) {
4728      if ($el && $el.length) {
4729        clearTimeout($el.data("timer"));
4730
4731        if (callCallback) {
4732          $el.trigger(transitionEnd);
4733        }
4734
4735        $el.off(transitionEnd).css("transition-duration", "");
4736
4737        $el.parent().removeClass("fancybox-is-scaling");
4738      }
4739    }
4740  };
4741
4742  // Default click handler for "fancyboxed" links
4743  // ============================================
4744
4745  function _run(e, opts) {
4746    var items = [],
4747      index = 0,
4748      $target,
4749      value,
4750      instance;
4751
4752    // Avoid opening multiple times
4753    if (e && e.isDefaultPrevented()) {
4754      return;
4755    }
4756
4757    e.preventDefault();
4758
4759    opts = opts || {};
4760
4761    if (e && e.data) {
4762      opts = mergeOpts(e.data.options, opts);
4763    }
4764
4765    $target = opts.$target || $(e.currentTarget).trigger("blur");
4766    instance = $.fancybox.getInstance();
4767
4768    if (instance && instance.$trigger && instance.$trigger.is($target)) {
4769      return;
4770    }
4771
4772    if (opts.selector) {
4773      items = $(opts.selector);
4774    } else {
4775      // Get all related items and find index for clicked one
4776      value = $target.attr("data-fancybox") || "";
4777
4778      if (value) {
4779        items = e.data ? e.data.items : [];
4780        items = items.length ? items.filter('[data-fancybox="' + value + '"]') : $('[data-fancybox="' + value + '"]');
4781      } else {
4782        items = [$target];
4783      }
4784    }
4785
4786    index = $(items).index($target);
4787
4788    // Sometimes current item can not be found
4789    if (index < 0) {
4790      index = 0;
4791    }
4792
4793    instance = $.fancybox.open(items, opts, index);
4794
4795    // Save last active element
4796    instance.$trigger = $target;
4797  }
4798
4799  // Create a jQuery plugin
4800  // ======================
4801
4802  $.fn.fancybox = function (options) {
4803    var selector;
4804
4805    options = options || {};
4806    selector = options.selector || false;
4807
4808    if (selector) {
4809      // Use body element instead of document so it executes first
4810      $("body")
4811        .off("click.fb-start", selector)
4812        .on("click.fb-start", selector, {
4813          options: options
4814        }, _run);
4815    } else {
4816      this.off("click.fb-start").on(
4817        "click.fb-start", {
4818          items: this,
4819          options: options
4820        },
4821        _run
4822      );
4823    }
4824
4825    return this;
4826  };
4827
4828  // Self initializing plugin for all elements having `data-fancybox` attribute
4829  // ==========================================================================
4830
4831  $D.on("click.fb-start", "[data-fancybox]", _run);
4832
4833  // Enable "trigger elements"
4834  // =========================
4835
4836  $D.on("click.fb-start", "[data-fancybox-trigger]", function (e) {
4837    $('[data-fancybox="' + $(this).attr("data-fancybox-trigger") + '"]')
4838      .eq($(this).attr("data-fancybox-index") || 0)
4839      .trigger("click.fb-start", {
4840        $trigger: $(this)
4841      });
4842  });
4843
4844  // Track focus event for better accessibility styling
4845  // ==================================================
4846  (function () {
4847    var buttonStr = ".fancybox-button",
4848      focusStr = "fancybox-focus",
4849      $pressed = null;
4850
4851    $D.on("mousedown mouseup focus blur", buttonStr, function (e) {
4852      switch (e.type) {
4853        case "mousedown":
4854          $pressed = $(this);
4855          break;
4856        case "mouseup":
4857          $pressed = null;
4858          break;
4859        case "focusin":
4860          $(buttonStr).removeClass(focusStr);
4861
4862          if (!$(this).is($pressed) && !$(this).is("[disabled]")) {
4863            $(this).addClass(focusStr);
4864          }
4865          break;
4866        case "focusout":
4867          $(buttonStr).removeClass(focusStr);
4868          break;
4869      }
4870    });
4871  })();
4872})(window, document, jQuery);
4873// ==========================================================================
4874//
4875// Media
4876// Adds additional media type support
4877//
4878// ==========================================================================
4879(function ($) {
4880  "use strict";
4881
4882  // Object containing properties for each media type
4883  var defaults = {
4884    youtube: {
4885      matcher: /(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,
4886      params: {
4887        autoplay: 1,
4888        autohide: 1,
4889        fs: 1,
4890        rel: 0,
4891        hd: 1,
4892        wmode: "transparent",
4893        enablejsapi: 1,
4894        html5: 1
4895      },
4896      paramPlace: 8,
4897      type: "iframe",
4898      url: "https://www.youtube-nocookie.com/embed/$4",
4899      thumb: "https://img.youtube.com/vi/$4/hqdefault.jpg"
4900    },
4901
4902    vimeo: {
4903      matcher: /^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,
4904      params: {
4905        autoplay: 1,
4906        hd: 1,
4907        show_title: 1,
4908        show_byline: 1,
4909        show_portrait: 0,
4910        fullscreen: 1
4911      },
4912      paramPlace: 3,
4913      type: "iframe",
4914      url: "//player.vimeo.com/video/$2"
4915    },
4916
4917    instagram: {
4918      matcher: /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,
4919      type: "image",
4920      url: "//$1/p/$2/media/?size=l"
4921    },
4922
4923    // Examples:
4924    // http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16
4925    // https://www.google.com/maps/@37.7852006,-122.4146355,14.65z
4926    // https://www.google.com/maps/@52.2111123,2.9237542,6.61z?hl=en
4927    // https://www.google.com/maps/place/Googleplex/@37.4220041,-122.0833494,17z/data=!4m5!3m4!1s0x0:0x6c296c66619367e0!8m2!3d37.4219998!4d-122.0840572
4928    gmap_place: {
4929      matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,
4930      type: "iframe",
4931      url: function (rez) {
4932        return (
4933          "//maps.google." +
4934          rez[2] +
4935          "/?ll=" +
4936          (rez[9] ? rez[9] + "&z=" + Math.floor(rez[10]) + (rez[12] ? rez[12].replace(/^\//, "&") : "") : rez[12] + "").replace(/\?/, "&") +
4937          "&output=" +
4938          (rez[12] && rez[12].indexOf("layer=c") > 0 ? "svembed" : "embed")
4939        );
4940      }
4941    },
4942
4943    // Examples:
4944    // https://www.google.com/maps/search/Empire+State+Building/
4945    // https://www.google.com/maps/search/?api=1&query=centurylink+field
4946    // https://www.google.com/maps/search/?api=1&query=47.5951518,-122.3316393
4947    gmap_search: {
4948      matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,
4949      type: "iframe",
4950      url: function (rez) {
4951        return "//maps.google." + rez[2] + "/maps?q=" + rez[5].replace("query=", "q=").replace("api=1", "") + "&output=embed";
4952      }
4953    }
4954  };
4955
4956  // Formats matching url to final form
4957  var format = function (url, rez, params) {
4958    if (!url) {
4959      return;
4960    }
4961
4962    params = params || "";
4963
4964    if ($.type(params) === "object") {
4965      params = $.param(params, true);
4966    }
4967
4968    $.each(rez, function (key, value) {
4969      url = url.replace("$" + key, value || "");
4970    });
4971
4972    if (params.length) {
4973      url += (url.indexOf("?") > 0 ? "&" : "?") + params;
4974    }
4975
4976    return url;
4977  };
4978
4979  $(document).on("objectNeedsType.fb", function (e, instance, item) {
4980    var url = item.src || "",
4981      type = false,
4982      media,
4983      thumb,
4984      rez,
4985      params,
4986      urlParams,
4987      paramObj,
4988      provider;
4989
4990    media = $.extend(true, {}, defaults, item.opts.media);
4991
4992    // Look for any matching media type
4993    $.each(media, function (providerName, providerOpts) {
4994      rez = url.match(providerOpts.matcher);
4995
4996      if (!rez) {
4997        return;
4998      }
4999
5000      type = providerOpts.type;
5001      provider = providerName;
5002      paramObj = {};
5003
5004      if (providerOpts.paramPlace && rez[providerOpts.paramPlace]) {
5005        urlParams = rez[providerOpts.paramPlace];
5006
5007        if (urlParams[0] == "?") {
5008          urlParams = urlParams.substring(1);
5009        }
5010
5011        urlParams = urlParams.split("&");
5012
5013        for (var m = 0; m < urlParams.length; ++m) {
5014          var p = urlParams[m].split("=", 2);
5015
5016          if (p.length == 2) {
5017            paramObj[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
5018          }
5019        }
5020      }
5021
5022      params = $.extend(true, {}, providerOpts.params, item.opts[providerName], paramObj);
5023
5024      url =
5025        $.type(providerOpts.url) === "function" ? providerOpts.url.call(this, rez, params, item) : format(providerOpts.url, rez, params);
5026
5027      thumb =
5028        $.type(providerOpts.thumb) === "function" ? providerOpts.thumb.call(this, rez, params, item) : format(providerOpts.thumb, rez);
5029
5030      if (providerName === "youtube") {
5031        url = url.replace(/&t=((\d+)m)?(\d+)s/, function (match, p1, m, s) {
5032          return "&start=" + ((m ? parseInt(m, 10) * 60 : 0) + parseInt(s, 10));
5033        });
5034      } else if (providerName === "vimeo") {
5035        url = url.replace("&%23", "#");
5036      }
5037
5038      return false;
5039    });
5040
5041    // If it is found, then change content type and update the url
5042
5043    if (type) {
5044      if (!item.opts.thumb && !(item.opts.$thumb && item.opts.$thumb.length)) {
5045        item.opts.thumb = thumb;
5046      }
5047
5048      if (type === "iframe") {
5049        item.opts = $.extend(true, item.opts, {
5050          iframe: {
5051            preload: false,
5052            attr: {
5053              scrolling: "no"
5054            }
5055          }
5056        });
5057      }
5058
5059      $.extend(item, {
5060        type: type,
5061        src: url,
5062        origSrc: item.src,
5063        contentSource: provider,
5064        contentType: type === "image" ? "image" : provider == "gmap_place" || provider == "gmap_search" ? "map" : "video"
5065      });
5066    } else if (url) {
5067      item.type = item.opts.defaultType;
5068    }
5069  });
5070
5071  // Load YouTube/Video API on request to detect when video finished playing
5072  var VideoAPILoader = {
5073    youtube: {
5074      src: "https://www.youtube.com/iframe_api",
5075      class: "YT",
5076      loading: false,
5077      loaded: false
5078    },
5079
5080    vimeo: {
5081      src: "https://player.vimeo.com/api/player.js",
5082      class: "Vimeo",
5083      loading: false,
5084      loaded: false
5085    },
5086
5087    load: function (vendor) {
5088      var _this = this,
5089        script;
5090
5091      if (this[vendor].loaded) {
5092        setTimeout(function () {
5093          _this.done(vendor);
5094        });
5095        return;
5096      }
5097
5098      if (this[vendor].loading) {
5099        return;
5100      }
5101
5102      this[vendor].loading = true;
5103
5104      script = document.createElement("script");
5105      script.type = "text/javascript";
5106      script.src = this[vendor].src;
5107
5108      if (vendor === "youtube") {
5109        window.onYouTubeIframeAPIReady = function () {
5110          _this[vendor].loaded = true;
5111          _this.done(vendor);
5112        };
5113      } else {
5114        script.onload = function () {
5115          _this[vendor].loaded = true;
5116          _this.done(vendor);
5117        };
5118      }
5119
5120      document.body.appendChild(script);
5121    },
5122    done: function (vendor) {
5123      var instance, $el, player;
5124
5125      if (vendor === "youtube") {
5126        delete window.onYouTubeIframeAPIReady;
5127      }
5128
5129      instance = $.fancybox.getInstance();
5130
5131      if (instance) {
5132        $el = instance.current.$content.find("iframe");
5133
5134        if (vendor === "youtube" && YT !== undefined && YT) {
5135          player = new YT.Player($el.attr("id"), {
5136            events: {
5137              onStateChange: function (e) {
5138                if (e.data == 0) {
5139                  instance.next();
5140                }
5141              }
5142            }
5143          });
5144        } else if (vendor === "vimeo" && Vimeo !== undefined && Vimeo) {
5145          player = new Vimeo.Player($el);
5146
5147          player.on("ended", function () {
5148            instance.next();
5149          });
5150        }
5151      }
5152    }
5153  };
5154
5155  $(document).on({
5156    "afterShow.fb": function (e, instance, current) {
5157      if (instance.group.length > 1 && (current.contentSource === "youtube" || current.contentSource === "vimeo")) {
5158        VideoAPILoader.load(current.contentSource);
5159      }
5160    }
5161  });
5162})(jQuery);
5163// ==========================================================================
5164//
5165// Guestures
5166// Adds touch guestures, handles click and tap events
5167//
5168// ==========================================================================
5169(function (window, document, $) {
5170  "use strict";
5171
5172  var requestAFrame = (function () {
5173    return (
5174      window.requestAnimationFrame ||
5175      window.webkitRequestAnimationFrame ||
5176      window.mozRequestAnimationFrame ||
5177      window.oRequestAnimationFrame ||
5178      // if all else fails, use setTimeout
5179      function (callback) {
5180        return window.setTimeout(callback, 1000 / 60);
5181      }
5182    );
5183  })();
5184
5185  var cancelAFrame = (function () {
5186    return (
5187      window.cancelAnimationFrame ||
5188      window.webkitCancelAnimationFrame ||
5189      window.mozCancelAnimationFrame ||
5190      window.oCancelAnimationFrame ||
5191      function (id) {
5192        window.clearTimeout(id);
5193      }
5194    );
5195  })();
5196
5197  var getPointerXY = function (e) {
5198    var result = [];
5199
5200    e = e.originalEvent || e || window.e;
5201    e = e.touches && e.touches.length ? e.touches : e.changedTouches && e.changedTouches.length ? e.changedTouches : [e];
5202
5203    for (var key in e) {
5204      if (e[key].pageX) {
5205        result.push({
5206          x: e[key].pageX,
5207          y: e[key].pageY
5208        });
5209      } else if (e[key].clientX) {
5210        result.push({
5211          x: e[key].clientX,
5212          y: e[key].clientY
5213        });
5214      }
5215    }
5216
5217    return result;
5218  };
5219
5220  var distance = function (point2, point1, what) {
5221    if (!point1 || !point2) {
5222      return 0;
5223    }
5224
5225    if (what === "x") {
5226      return point2.x - point1.x;
5227    } else if (what === "y") {
5228      return point2.y - point1.y;
5229    }
5230
5231    return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
5232  };
5233
5234  var isClickable = function ($el) {
5235    if (
5236      $el.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio,iframe') ||
5237      $.isFunction($el.get(0).onclick) ||
5238      $el.data("selectable")
5239    ) {
5240      return true;
5241    }
5242
5243    // Check for attributes like data-fancybox-next or data-fancybox-close
5244    for (var i = 0, atts = $el[0].attributes, n = atts.length; i < n; i++) {
5245      if (atts[i].nodeName.substr(0, 14) === "data-fancybox-") {
5246        return true;
5247      }
5248    }
5249
5250    return false;
5251  };
5252
5253  var hasScrollbars = function (el) {
5254    var overflowY = window.getComputedStyle(el)["overflow-y"],
5255      overflowX = window.getComputedStyle(el)["overflow-x"],
5256      vertical = (overflowY === "scroll" || overflowY === "auto") && el.scrollHeight > el.clientHeight,
5257      horizontal = (overflowX === "scroll" || overflowX === "auto") && el.scrollWidth > el.clientWidth;
5258
5259    return vertical || horizontal;
5260  };
5261
5262  var isScrollable = function ($el) {
5263    var rez = false;
5264
5265    while (true) {
5266      rez = hasScrollbars($el.get(0));
5267
5268      if (rez) {
5269        break;
5270      }
5271
5272      $el = $el.parent();
5273
5274      if (!$el.length || $el.hasClass("fancybox-stage") || $el.is("body")) {
5275        break;
5276      }
5277    }
5278
5279    return rez;
5280  };
5281
5282  var Guestures = function (instance) {
5283    var self = this;
5284
5285    self.instance = instance;
5286
5287    self.$bg = instance.$refs.bg;
5288    self.$stage = instance.$refs.stage;
5289    self.$container = instance.$refs.container;
5290
5291    self.destroy();
5292
5293    self.$container.on("touchstart.fb.touch mousedown.fb.touch", $.proxy(self, "ontouchstart"));
5294  };
5295
5296  Guestures.prototype.destroy = function () {
5297    var self = this;
5298
5299    self.$container.off(".fb.touch");
5300
5301    $(document).off(".fb.touch");
5302
5303    if (self.requestId) {
5304      cancelAFrame(self.requestId);
5305      self.requestId = null;
5306    }
5307
5308    if (self.tapped) {
5309      clearTimeout(self.tapped);
5310      self.tapped = null;
5311    }
5312  };
5313
5314  Guestures.prototype.ontouchstart = function (e) {
5315    var self = this,
5316      $target = $(e.target),
5317      instance = self.instance,
5318      current = instance.current,
5319      $slide = current.$slide,
5320      $content = current.$content,
5321      isTouchDevice = e.type == "touchstart";
5322
5323    // Do not respond to both (touch and mouse) events
5324    if (isTouchDevice) {
5325      self.$container.off("mousedown.fb.touch");
5326    }
5327
5328    // Ignore right click
5329    if (e.originalEvent && e.originalEvent.button == 2) {
5330      return;
5331    }
5332
5333    // Ignore taping on links, buttons, input elements
5334    if (!$slide.length || !$target.length || isClickable($target) || isClickable($target.parent())) {
5335      return;
5336    }
5337    // Ignore clicks on the scrollbar
5338    if (!$target.is("img") && e.originalEvent.clientX > $target[0].clientWidth + $target.offset().left) {
5339      return;
5340    }
5341
5342    // Ignore clicks while zooming or closing
5343    if (!current || instance.isAnimating || current.$slide.hasClass("fancybox-animated")) {
5344      e.stopPropagation();
5345      e.preventDefault();
5346
5347      return;
5348    }
5349
5350    self.realPoints = self.startPoints = getPointerXY(e);
5351
5352    if (!self.startPoints.length) {
5353      return;
5354    }
5355
5356    // Allow other scripts to catch touch event if "touch" is set to false
5357    if (current.touch) {
5358      e.stopPropagation();
5359    }
5360
5361    self.startEvent = e;
5362
5363    self.canTap = true;
5364    self.$target = $target;
5365    self.$content = $content;
5366    self.opts = current.opts.touch;
5367
5368    self.isPanning = false;
5369    self.isSwiping = false;
5370    self.isZooming = false;
5371    self.isScrolling = false;
5372    self.canPan = instance.canPan();
5373
5374    self.startTime = new Date().getTime();
5375    self.distanceX = self.distanceY = self.distance = 0;
5376
5377    self.canvasWidth = Math.round($slide[0].clientWidth);
5378    self.canvasHeight = Math.round($slide[0].clientHeight);
5379
5380    self.contentLastPos = null;
5381    self.contentStartPos = $.fancybox.getTranslate(self.$content) || {
5382      top: 0,
5383      left: 0
5384    };
5385    self.sliderStartPos = $.fancybox.getTranslate($slide);
5386
5387    // Since position will be absolute, but we need to make it relative to the stage
5388    self.stagePos = $.fancybox.getTranslate(instance.$refs.stage);
5389
5390    self.sliderStartPos.top -= self.stagePos.top;
5391    self.sliderStartPos.left -= self.stagePos.left;
5392
5393    self.contentStartPos.top -= self.stagePos.top;
5394    self.contentStartPos.left -= self.stagePos.left;
5395
5396    $(document)
5397      .off(".fb.touch")
5398      .on(isTouchDevice ? "touchend.fb.touch touchcancel.fb.touch" : "mouseup.fb.touch mouseleave.fb.touch", $.proxy(self, "ontouchend"))
5399      .on(isTouchDevice ? "touchmove.fb.touch" : "mousemove.fb.touch", $.proxy(self, "ontouchmove"));
5400
5401    if ($.fancybox.isMobile) {
5402      document.addEventListener("scroll", self.onscroll, true);
5403    }
5404
5405    // Skip if clicked outside the sliding area
5406    if (!(self.opts || self.canPan) || !($target.is(self.$stage) || self.$stage.find($target).length)) {
5407      if ($target.is(".fancybox-image")) {
5408        e.preventDefault();
5409      }
5410
5411      if (!($.fancybox.isMobile && $target.parents(".fancybox-caption").length)) {
5412        return;
5413      }
5414    }
5415
5416    self.isScrollable = isScrollable($target) || isScrollable($target.parent());
5417
5418    // Check if element is scrollable and try to prevent default behavior (scrolling)
5419    if (!($.fancybox.isMobile && self.isScrollable)) {
5420      e.preventDefault();
5421    }
5422
5423    // One finger or mouse click - swipe or pan an image
5424    if (self.startPoints.length === 1 || current.hasError) {
5425      if (self.canPan) {
5426        $.fancybox.stop(self.$content);
5427
5428        self.isPanning = true;
5429      } else {
5430        self.isSwiping = true;
5431      }
5432
5433      self.$container.addClass("fancybox-is-grabbing");
5434    }
5435
5436    // Two fingers - zoom image
5437    if (self.startPoints.length === 2 && current.type === "image" && (current.isLoaded || current.$ghost)) {
5438      self.canTap = false;
5439      self.isSwiping = false;
5440      self.isPanning = false;
5441
5442      self.isZooming = true;
5443
5444      $.fancybox.stop(self.$content);
5445
5446      self.centerPointStartX = (self.startPoints[0].x + self.startPoints[1].x) * 0.5 - $(window).scrollLeft();
5447      self.centerPointStartY = (self.startPoints[0].y + self.startPoints[1].y) * 0.5 - $(window).scrollTop();
5448
5449      self.percentageOfImageAtPinchPointX = (self.centerPointStartX - self.contentStartPos.left) / self.contentStartPos.width;
5450      self.percentageOfImageAtPinchPointY = (self.centerPointStartY - self.contentStartPos.top) / self.contentStartPos.height;
5451
5452      self.startDistanceBetweenFingers = distance(self.startPoints[0], self.startPoints[1]);
5453    }
5454  };
5455
5456  Guestures.prototype.onscroll = function (e) {
5457    var self = this;
5458
5459    self.isScrolling = true;
5460
5461    document.removeEventListener("scroll", self.onscroll, true);
5462  };
5463
5464  Guestures.prototype.ontouchmove = function (e) {
5465    var self = this;
5466
5467    // Make sure user has not released over iframe or disabled element
5468    if (e.originalEvent.buttons !== undefined && e.originalEvent.buttons === 0) {
5469      self.ontouchend(e);
5470      return;
5471    }
5472
5473    if (self.isScrolling) {
5474      self.canTap = false;
5475      return;
5476    }
5477
5478    self.newPoints = getPointerXY(e);
5479
5480    if (!(self.opts || self.canPan) || !self.newPoints.length || !self.newPoints.length) {
5481      return;
5482    }
5483
5484    if (!(self.isSwiping && self.isSwiping === true)) {
5485      e.preventDefault();
5486    }
5487
5488    self.distanceX = distance(self.newPoints[0], self.startPoints[0], "x");
5489    self.distanceY = distance(self.newPoints[0], self.startPoints[0], "y");
5490
5491    self.distance = distance(self.newPoints[0], self.startPoints[0]);
5492
5493    // Skip false ontouchmove events (Chrome)
5494    if (self.distance > 0) {
5495      if (self.isSwiping) {
5496        self.onSwipe(e);
5497      } else if (self.isPanning) {
5498        self.onPan();
5499      } else if (self.isZooming) {
5500        self.onZoom();
5501      }
5502    }
5503  };
5504
5505  Guestures.prototype.onSwipe = function (e) {
5506    var self = this,
5507      instance = self.instance,
5508      swiping = self.isSwiping,
5509      left = self.sliderStartPos.left || 0,
5510      angle;
5511
5512    // If direction is not yet determined
5513    if (swiping === true) {
5514      // We need at least 10px distance to correctly calculate an angle
5515      if (Math.abs(self.distance) > 10) {
5516        self.canTap = false;
5517
5518        if (instance.group.length < 2 && self.opts.vertical) {
5519          self.isSwiping = "y";
5520        } else if (instance.isDragging || self.opts.vertical === false || (self.opts.vertical === "auto" && $(window).width() > 800)) {
5521          self.isSwiping = "x";
5522        } else {
5523          angle = Math.abs((Math.atan2(self.distanceY, self.distanceX) * 180) / Math.PI);
5524
5525          self.isSwiping = angle > 45 && angle < 135 ? "y" : "x";
5526        }
5527
5528        if (self.isSwiping === "y" && $.fancybox.isMobile && self.isScrollable) {
5529          self.isScrolling = true;
5530
5531          return;
5532        }
5533
5534        instance.isDragging = self.isSwiping;
5535
5536        // Reset points to avoid jumping, because we dropped first swipes to calculate the angle
5537        self.startPoints = self.newPoints;
5538
5539        $.each(instance.slides, function (index, slide) {
5540          var slidePos, stagePos;
5541
5542          $.fancybox.stop(slide.$slide);
5543
5544          slidePos = $.fancybox.getTranslate(slide.$slide);
5545          stagePos = $.fancybox.getTranslate(instance.$refs.stage);
5546
5547          slide.$slide
5548            .css({
5549              transform: "",
5550              opacity: "",
5551              "transition-duration": ""
5552            })
5553            .removeClass("fancybox-animated")
5554            .removeClass(function (index, className) {
5555              return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" ");
5556            });
5557
5558          if (slide.pos === instance.current.pos) {
5559            self.sliderStartPos.top = slidePos.top - stagePos.top;
5560            self.sliderStartPos.left = slidePos.left - stagePos.left;
5561          }
5562
5563          $.fancybox.setTranslate(slide.$slide, {
5564            top: slidePos.top - stagePos.top,
5565            left: slidePos.left - stagePos.left
5566          });
5567        });
5568
5569        // Stop slideshow
5570        if (instance.SlideShow && instance.SlideShow.isActive) {
5571          instance.SlideShow.stop();
5572        }
5573      }
5574
5575      return;
5576    }
5577
5578    // Sticky edges
5579    if (swiping == "x") {
5580      if (
5581        self.distanceX > 0 &&
5582        (self.instance.group.length < 2 || (self.instance.current.index === 0 && !self.instance.current.opts.loop))
5583      ) {
5584        left = left + Math.pow(self.distanceX, 0.8);
5585      } else if (
5586        self.distanceX < 0 &&
5587        (self.instance.group.length < 2 ||
5588          (self.instance.current.index === self.instance.group.length - 1 && !self.instance.current.opts.loop))
5589      ) {
5590        left = left - Math.pow(-self.distanceX, 0.8);
5591      } else {
5592        left = left + self.distanceX;
5593      }
5594    }
5595
5596    self.sliderLastPos = {
5597      top: swiping == "x" ? 0 : self.sliderStartPos.top + self.distanceY,
5598      left: left
5599    };
5600
5601    if (self.requestId) {
5602      cancelAFrame(self.requestId);
5603
5604      self.requestId = null;
5605    }
5606
5607    self.requestId = requestAFrame(function () {
5608      if (self.sliderLastPos) {
5609        $.each(self.instance.slides, function (index, slide) {
5610          var pos = slide.pos - self.instance.currPos;
5611
5612          $.fancybox.setTranslate(slide.$slide, {
5613            top: self.sliderLastPos.top,
5614            left: self.sliderLastPos.left + pos * self.canvasWidth + pos * slide.opts.gutter
5615          });
5616        });
5617
5618        self.$container.addClass("fancybox-is-sliding");
5619      }
5620    });
5621  };
5622
5623  Guestures.prototype.onPan = function () {
5624    var self = this;
5625
5626    // Prevent accidental movement (sometimes, when tapping casually, finger can move a bit)
5627    if (distance(self.newPoints[0], self.realPoints[0]) < ($.fancybox.isMobile ? 10 : 5)) {
5628      self.startPoints = self.newPoints;
5629      return;
5630    }
5631
5632    self.canTap = false;
5633
5634    self.contentLastPos = self.limitMovement();
5635
5636    if (self.requestId) {
5637      cancelAFrame(self.requestId);
5638    }
5639
5640    self.requestId = requestAFrame(function () {
5641      $.fancybox.setTranslate(self.$content, self.contentLastPos);
5642    });
5643  };
5644
5645  // Make panning sticky to the edges
5646  Guestures.prototype.limitMovement = function () {
5647    var self = this;
5648
5649    var canvasWidth = self.canvasWidth;
5650    var canvasHeight = self.canvasHeight;
5651
5652    var distanceX = self.distanceX;
5653    var distanceY = self.distanceY;
5654
5655    var contentStartPos = self.contentStartPos;
5656
5657    var currentOffsetX = contentStartPos.left;
5658    var currentOffsetY = contentStartPos.top;
5659
5660    var currentWidth = contentStartPos.width;
5661    var currentHeight = contentStartPos.height;
5662
5663    var minTranslateX, minTranslateY, maxTranslateX, maxTranslateY, newOffsetX, newOffsetY;
5664
5665    if (currentWidth > canvasWidth) {
5666      newOffsetX = currentOffsetX + distanceX;
5667    } else {
5668      newOffsetX = currentOffsetX;
5669    }
5670
5671    newOffsetY = currentOffsetY + distanceY;
5672
5673    // Slow down proportionally to traveled distance
5674    minTranslateX = Math.max(0, canvasWidth * 0.5 - currentWidth * 0.5);
5675    minTranslateY = Math.max(0, canvasHeight * 0.5 - currentHeight * 0.5);
5676
5677    maxTranslateX = Math.min(canvasWidth - currentWidth, canvasWidth * 0.5 - currentWidth * 0.5);
5678    maxTranslateY = Math.min(canvasHeight - currentHeight, canvasHeight * 0.5 - currentHeight * 0.5);
5679
5680    //   ->
5681    if (distanceX > 0 && newOffsetX > minTranslateX) {
5682      newOffsetX = minTranslateX - 1 + Math.pow(-minTranslateX + currentOffsetX + distanceX, 0.8) || 0;
5683    }
5684
5685    //    <-
5686    if (distanceX < 0 && newOffsetX < maxTranslateX) {
5687      newOffsetX = maxTranslateX + 1 - Math.pow(maxTranslateX - currentOffsetX - distanceX, 0.8) || 0;
5688    }
5689
5690    //   \/
5691    if (distanceY > 0 && newOffsetY > minTranslateY) {
5692      newOffsetY = minTranslateY - 1 + Math.pow(-minTranslateY + currentOffsetY + distanceY, 0.8) || 0;
5693    }
5694
5695    //   /\
5696    if (distanceY < 0 && newOffsetY < maxTranslateY) {
5697      newOffsetY = maxTranslateY + 1 - Math.pow(maxTranslateY - currentOffsetY - distanceY, 0.8) || 0;
5698    }
5699
5700    return {
5701      top: newOffsetY,
5702      left: newOffsetX
5703    };
5704  };
5705
5706  Guestures.prototype.limitPosition = function (newOffsetX, newOffsetY, newWidth, newHeight) {
5707    var self = this;
5708
5709    var canvasWidth = self.canvasWidth;
5710    var canvasHeight = self.canvasHeight;
5711
5712    if (newWidth > canvasWidth) {
5713      newOffsetX = newOffsetX > 0 ? 0 : newOffsetX;
5714      newOffsetX = newOffsetX < canvasWidth - newWidth ? canvasWidth - newWidth : newOffsetX;
5715    } else {
5716      // Center horizontally
5717      newOffsetX = Math.max(0, canvasWidth / 2 - newWidth / 2);
5718    }
5719
5720    if (newHeight > canvasHeight) {
5721      newOffsetY = newOffsetY > 0 ? 0 : newOffsetY;
5722      newOffsetY = newOffsetY < canvasHeight - newHeight ? canvasHeight - newHeight : newOffsetY;
5723    } else {
5724      // Center vertically
5725      newOffsetY = Math.max(0, canvasHeight / 2 - newHeight / 2);
5726    }
5727
5728    return {
5729      top: newOffsetY,
5730      left: newOffsetX
5731    };
5732  };
5733
5734  Guestures.prototype.onZoom = function () {
5735    var self = this;
5736
5737    // Calculate current distance between points to get pinch ratio and new width and height
5738    var contentStartPos = self.contentStartPos;
5739
5740    var currentWidth = contentStartPos.width;
5741    var currentHeight = contentStartPos.height;
5742
5743    var currentOffsetX = contentStartPos.left;
5744    var currentOffsetY = contentStartPos.top;
5745
5746    var endDistanceBetweenFingers = distance(self.newPoints[0], self.newPoints[1]);
5747
5748    var pinchRatio = endDistanceBetweenFingers / self.startDistanceBetweenFingers;
5749
5750    var newWidth = Math.floor(currentWidth * pinchRatio);
5751    var newHeight = Math.floor(currentHeight * pinchRatio);
5752
5753    // This is the translation due to pinch-zooming
5754    var translateFromZoomingX = (currentWidth - newWidth) * self.percentageOfImageAtPinchPointX;
5755    var translateFromZoomingY = (currentHeight - newHeight) * self.percentageOfImageAtPinchPointY;
5756
5757    // Point between the two touches
5758    var centerPointEndX = (self.newPoints[0].x + self.newPoints[1].x) / 2 - $(window).scrollLeft();
5759    var centerPointEndY = (self.newPoints[0].y + self.newPoints[1].y) / 2 - $(window).scrollTop();
5760
5761    // And this is the translation due to translation of the centerpoint
5762    // between the two fingers
5763    var translateFromTranslatingX = centerPointEndX - self.centerPointStartX;
5764    var translateFromTranslatingY = centerPointEndY - self.centerPointStartY;
5765
5766    // The new offset is the old/current one plus the total translation
5767    var newOffsetX = currentOffsetX + (translateFromZoomingX + translateFromTranslatingX);
5768    var newOffsetY = currentOffsetY + (translateFromZoomingY + translateFromTranslatingY);
5769
5770    var newPos = {
5771      top: newOffsetY,
5772      left: newOffsetX,
5773      scaleX: pinchRatio,
5774      scaleY: pinchRatio
5775    };
5776
5777    self.canTap = false;
5778
5779    self.newWidth = newWidth;
5780    self.newHeight = newHeight;
5781
5782    self.contentLastPos = newPos;
5783
5784    if (self.requestId) {
5785      cancelAFrame(self.requestId);
5786    }
5787
5788    self.requestId = requestAFrame(function () {
5789      $.fancybox.setTranslate(self.$content, self.contentLastPos);
5790    });
5791  };
5792
5793  Guestures.prototype.ontouchend = function (e) {
5794    var self = this;
5795
5796    var swiping = self.isSwiping;
5797    var panning = self.isPanning;
5798    var zooming = self.isZooming;
5799    var scrolling = self.isScrolling;
5800
5801    self.endPoints = getPointerXY(e);
5802    self.dMs = Math.max(new Date().getTime() - self.startTime, 1);
5803
5804    self.$container.removeClass("fancybox-is-grabbing");
5805
5806    $(document).off(".fb.touch");
5807
5808    document.removeEventListener("scroll", self.onscroll, true);
5809
5810    if (self.requestId) {
5811      cancelAFrame(self.requestId);
5812
5813      self.requestId = null;
5814    }
5815
5816    self.isSwiping = false;
5817    self.isPanning = false;
5818    self.isZooming = false;
5819    self.isScrolling = false;
5820
5821    self.instance.isDragging = false;
5822
5823    if (self.canTap) {
5824      return self.onTap(e);
5825    }
5826
5827    self.speed = 100;
5828
5829    // Speed in px/ms
5830    self.velocityX = (self.distanceX / self.dMs) * 0.5;
5831    self.velocityY = (self.distanceY / self.dMs) * 0.5;
5832
5833    if (panning) {
5834      self.endPanning();
5835    } else if (zooming) {
5836      self.endZooming();
5837    } else {
5838      self.endSwiping(swiping, scrolling);
5839    }
5840
5841    return;
5842  };
5843
5844  Guestures.prototype.endSwiping = function (swiping, scrolling) {
5845    var self = this,
5846      ret = false,
5847      len = self.instance.group.length,
5848      distanceX = Math.abs(self.distanceX),
5849      canAdvance = swiping == "x" && len > 1 && ((self.dMs > 130 && distanceX > 10) || distanceX > 50),
5850      speedX = 300;
5851
5852    self.sliderLastPos = null;
5853
5854    // Close if swiped vertically / navigate if horizontally
5855    if (swiping == "y" && !scrolling && Math.abs(self.distanceY) > 50) {
5856      // Continue vertical movement
5857      $.fancybox.animate(
5858        self.instance.current.$slide, {
5859          top: self.sliderStartPos.top + self.distanceY + self.velocityY * 150,
5860          opacity: 0
5861        },
5862        200
5863      );
5864      ret = self.instance.close(true, 250);
5865    } else if (canAdvance && self.distanceX > 0) {
5866      ret = self.instance.previous(speedX);
5867    } else if (canAdvance && self.distanceX < 0) {
5868      ret = self.instance.next(speedX);
5869    }
5870
5871    if (ret === false && (swiping == "x" || swiping == "y")) {
5872      self.instance.centerSlide(200);
5873    }
5874
5875    self.$container.removeClass("fancybox-is-sliding");
5876  };
5877
5878  // Limit panning from edges
5879  // ========================
5880  Guestures.prototype.endPanning = function () {
5881    var self = this,
5882      newOffsetX,
5883      newOffsetY,
5884      newPos;
5885
5886    if (!self.contentLastPos) {
5887      return;
5888    }
5889
5890    if (self.opts.momentum === false || self.dMs > 350) {
5891      newOffsetX = self.contentLastPos.left;
5892      newOffsetY = self.contentLastPos.top;
5893    } else {
5894      // Continue movement
5895      newOffsetX = self.contentLastPos.left + self.velocityX * 500;
5896      newOffsetY = self.contentLastPos.top + self.velocityY * 500;
5897    }
5898
5899    newPos = self.limitPosition(newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height);
5900
5901    newPos.width = self.contentStartPos.width;
5902    newPos.height = self.contentStartPos.height;
5903
5904    $.fancybox.animate(self.$content, newPos, 366);
5905  };
5906
5907  Guestures.prototype.endZooming = function () {
5908    var self = this;
5909
5910    var current = self.instance.current;
5911
5912    var newOffsetX, newOffsetY, newPos, reset;
5913
5914    var newWidth = self.newWidth;
5915    var newHeight = self.newHeight;
5916
5917    if (!self.contentLastPos) {
5918      return;
5919    }
5920
5921    newOffsetX = self.contentLastPos.left;
5922    newOffsetY = self.contentLastPos.top;
5923
5924    reset = {
5925      top: newOffsetY,
5926      left: newOffsetX,
5927      width: newWidth,
5928      height: newHeight,
5929      scaleX: 1,
5930      scaleY: 1
5931    };
5932
5933    // Reset scalex/scaleY values; this helps for perfomance and does not break animation
5934    $.fancybox.setTranslate(self.$content, reset);
5935
5936    if (newWidth < self.canvasWidth && newHeight < self.canvasHeight) {
5937      self.instance.scaleToFit(150);
5938    } else if (newWidth > current.width || newHeight > current.height) {
5939      self.instance.scaleToActual(self.centerPointStartX, self.centerPointStartY, 150);
5940    } else {
5941      newPos = self.limitPosition(newOffsetX, newOffsetY, newWidth, newHeight);
5942
5943      $.fancybox.animate(self.$content, newPos, 150);
5944    }
5945  };
5946
5947  Guestures.prototype.onTap = function (e) {
5948    var self = this;
5949    var $target = $(e.target);
5950
5951    var instance = self.instance;
5952    var current = instance.current;
5953
5954    var endPoints = (e && getPointerXY(e)) || self.startPoints;
5955
5956    var tapX = endPoints[0] ? endPoints[0].x - $(window).scrollLeft() - self.stagePos.left : 0;
5957    var tapY = endPoints[0] ? endPoints[0].y - $(window).scrollTop() - self.stagePos.top : 0;
5958
5959    var where;
5960
5961    var process = function (prefix) {
5962      var action = current.opts[prefix];
5963
5964      if ($.isFunction(action)) {
5965        action = action.apply(instance, [current, e]);
5966      }
5967
5968      if (!action) {
5969        return;
5970      }
5971
5972      switch (action) {
5973        case "close":
5974          instance.close(self.startEvent);
5975
5976          break;
5977
5978        case "toggleControls":
5979          instance.toggleControls();
5980
5981          break;
5982
5983        case "next":
5984          instance.next();
5985
5986          break;
5987
5988        case "nextOrClose":
5989          if (instance.group.length > 1) {
5990            instance.next();
5991          } else {
5992            instance.close(self.startEvent);
5993          }
5994
5995          break;
5996
5997        case "zoom":
5998          if (current.type == "image" && (current.isLoaded || current.$ghost)) {
5999            if (instance.canPan()) {
6000              instance.scaleToFit();
6001            } else if (instance.isScaledDown()) {
6002              instance.scaleToActual(tapX, tapY);
6003            } else if (instance.group.length < 2) {
6004              instance.close(self.startEvent);
6005            }
6006          }
6007
6008          break;
6009      }
6010    };
6011
6012    // Ignore right click
6013    if (e.originalEvent && e.originalEvent.button == 2) {
6014      return;
6015    }
6016
6017    // Skip if clicked on the scrollbar
6018    if (!$target.is("img") && tapX > $target[0].clientWidth + $target.offset().left) {
6019      return;
6020    }
6021
6022    // Check where is clicked
6023    if ($target.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container")) {
6024      where = "Outside";
6025    } else if ($target.is(".fancybox-slide")) {
6026      where = "Slide";
6027    } else if (
6028      instance.current.$content &&
6029      instance.current.$content
6030      .find($target)
6031      .addBack()
6032      .filter($target).length
6033    ) {
6034      where = "Content";
6035    } else {
6036      return;
6037    }
6038
6039    // Check if this is a double tap
6040    if (self.tapped) {
6041      // Stop previously created single tap
6042      clearTimeout(self.tapped);
6043      self.tapped = null;
6044
6045      // Skip if distance between taps is too big
6046      if (Math.abs(tapX - self.tapX) > 50 || Math.abs(tapY - self.tapY) > 50) {
6047        return this;
6048      }
6049
6050      // OK, now we assume that this is a double-tap
6051      process("dblclick" + where);
6052    } else {
6053      // Single tap will be processed if user has not clicked second time within 300ms
6054      // or there is no need to wait for double-tap
6055      self.tapX = tapX;
6056      self.tapY = tapY;
6057
6058      if (current.opts["dblclick" + where] && current.opts["dblclick" + where] !== current.opts["click" + where]) {
6059        self.tapped = setTimeout(function () {
6060          self.tapped = null;
6061
6062          if (!instance.isAnimating) {
6063            process("click" + where);
6064          }
6065        }, 500);
6066      } else {
6067        process("click" + where);
6068      }
6069    }
6070
6071    return this;
6072  };
6073
6074  $(document)
6075    .on("onActivate.fb", function (e, instance) {
6076      if (instance && !instance.Guestures) {
6077        instance.Guestures = new Guestures(instance);
6078      }
6079    })
6080    .on("beforeClose.fb", function (e, instance) {
6081      if (instance && instance.Guestures) {
6082        instance.Guestures.destroy();
6083      }
6084    });
6085})(window, document, jQuery);
6086// ==========================================================================
6087//
6088// SlideShow
6089// Enables slideshow functionality
6090//
6091// Example of usage:
6092// $.fancybox.getInstance().SlideShow.start()
6093//
6094// ==========================================================================
6095(function (document, $) {
6096  "use strict";
6097
6098  $.extend(true, $.fancybox.defaults, {
6099    btnTpl: {
6100      slideShow: '<button data-fancybox-play class="fancybox-button fancybox-button--play" title="{{PLAY_START}}">' +
6101        '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6.5 5.4v13.2l11-6.6z"/></svg>' +
6102        '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.33 5.75h2.2v12.5h-2.2V5.75zm5.15 0h2.2v12.5h-2.2V5.75z"/></svg>' +
6103        "</button>"
6104    },
6105    slideShow: {
6106      autoStart: false,
6107      speed: 3000,
6108      progress: true
6109    }
6110  });
6111
6112  var SlideShow = function (instance) {
6113    this.instance = instance;
6114    this.init();
6115  };
6116
6117  $.extend(SlideShow.prototype, {
6118    timer: null,
6119    isActive: false,
6120    $button: null,
6121
6122    init: function () {
6123      var self = this,
6124        instance = self.instance,
6125        opts = instance.group[instance.currIndex].opts.slideShow;
6126
6127      self.$button = instance.$refs.toolbar.find("[data-fancybox-play]").on("click", function () {
6128        self.toggle();
6129      });
6130
6131      if (instance.group.length < 2 || !opts) {
6132        self.$button.hide();
6133      } else if (opts.progress) {
6134        self.$progress = $('<div class="fancybox-progress"></div>').appendTo(instance.$refs.inner);
6135      }
6136    },
6137
6138    set: function (force) {
6139      var self = this,
6140        instance = self.instance,
6141        current = instance.current;
6142
6143      // Check if reached last element
6144      if (current && (force === true || current.opts.loop || instance.currIndex < instance.group.length - 1)) {
6145        if (self.isActive && current.contentType !== "video") {
6146          if (self.$progress) {
6147            $.fancybox.animate(self.$progress.show(), {
6148              scaleX: 1
6149            }, current.opts.slideShow.speed);
6150          }
6151
6152          self.timer = setTimeout(function () {
6153            if (!instance.current.opts.loop && instance.current.index == instance.group.length - 1) {
6154              instance.jumpTo(0);
6155            } else {
6156              instance.next();
6157            }
6158          }, current.opts.slideShow.speed);
6159        }
6160      } else {
6161        self.stop();
6162        instance.idleSecondsCounter = 0;
6163        instance.showControls();
6164      }
6165    },
6166
6167    clear: function () {
6168      var self = this;
6169
6170      clearTimeout(self.timer);
6171
6172      self.timer = null;
6173
6174      if (self.$progress) {
6175        self.$progress.removeAttr("style").hide();
6176      }
6177    },
6178
6179    start: function () {
6180      var self = this,
6181        current = self.instance.current;
6182
6183      if (current) {
6184        self.$button
6185          .attr("title", (current.opts.i18n[current.opts.lang] || current.opts.i18n.en).PLAY_STOP)
6186          .removeClass("fancybox-button--play")
6187          .addClass("fancybox-button--pause");
6188
6189        self.isActive = true;
6190
6191        if (current.isComplete) {
6192          self.set(true);
6193        }
6194
6195        self.instance.trigger("onSlideShowChange", true);
6196      }
6197    },
6198
6199    stop: function () {
6200      var self = this,
6201        current = self.instance.current;
6202
6203      self.clear();
6204
6205      self.$button
6206        .attr("title", (current.opts.i18n[current.opts.lang] || current.opts.i18n.en).PLAY_START)
6207        .removeClass("fancybox-button--pause")
6208        .addClass("fancybox-button--play");
6209
6210      self.isActive = false;
6211
6212      self.instance.trigger("onSlideShowChange", false);
6213
6214      if (self.$progress) {
6215        self.$progress.removeAttr("style").hide();
6216      }
6217    },
6218
6219    toggle: function () {
6220      var self = this;
6221
6222      if (self.isActive) {
6223        self.stop();
6224      } else {
6225        self.start();
6226      }
6227    }
6228  });
6229
6230  $(document).on({
6231    "onInit.fb": function (e, instance) {
6232      if (instance && !instance.SlideShow) {
6233        instance.SlideShow = new SlideShow(instance);
6234      }
6235    },
6236
6237    "beforeShow.fb": function (e, instance, current, firstRun) {
6238      var SlideShow = instance && instance.SlideShow;
6239
6240      if (firstRun) {
6241        if (SlideShow && current.opts.slideShow.autoStart) {
6242          SlideShow.start();
6243        }
6244      } else if (SlideShow && SlideShow.isActive) {
6245        SlideShow.clear();
6246      }
6247    },
6248
6249    "afterShow.fb": function (e, instance, current) {
6250      var SlideShow = instance && instance.SlideShow;
6251
6252      if (SlideShow && SlideShow.isActive) {
6253        SlideShow.set();
6254      }
6255    },
6256
6257    "afterKeydown.fb": function (e, instance, current, keypress, keycode) {
6258      var SlideShow = instance && instance.SlideShow;
6259
6260      // "P" or Spacebar
6261      if (SlideShow && current.opts.slideShow && (keycode === 80 || keycode === 32) && !$(document.activeElement).is("button,a,input")) {
6262        keypress.preventDefault();
6263
6264        SlideShow.toggle();
6265      }
6266    },
6267
6268    "beforeClose.fb onDeactivate.fb": function (e, instance) {
6269      var SlideShow = instance && instance.SlideShow;
6270
6271      if (SlideShow) {
6272        SlideShow.stop();
6273      }
6274    }
6275  });
6276
6277  // Page Visibility API to pause slideshow when window is not active
6278  $(document).on("visibilitychange", function () {
6279    var instance = $.fancybox.getInstance(),
6280      SlideShow = instance && instance.SlideShow;
6281
6282    if (SlideShow && SlideShow.isActive) {
6283      if (document.hidden) {
6284        SlideShow.clear();
6285      } else {
6286        SlideShow.set();
6287      }
6288    }
6289  });
6290})(document, jQuery);
6291// ==========================================================================
6292//
6293// FullScreen
6294// Adds fullscreen functionality
6295//
6296// ==========================================================================
6297(function (document, $) {
6298  "use strict";
6299
6300  // Collection of methods supported by user browser
6301  var fn = (function () {
6302    var fnMap = [
6303      ["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"],
6304      // new WebKit
6305      [
6306        "webkitRequestFullscreen",
6307        "webkitExitFullscreen",
6308        "webkitFullscreenElement",
6309        "webkitFullscreenEnabled",
6310        "webkitfullscreenchange",
6311        "webkitfullscreenerror"
6312      ],
6313      // old WebKit (Safari 5.1)
6314      [
6315        "webkitRequestFullScreen",
6316        "webkitCancelFullScreen",
6317        "webkitCurrentFullScreenElement",
6318        "webkitCancelFullScreen",
6319        "webkitfullscreenchange",
6320        "webkitfullscreenerror"
6321      ],
6322      [
6323        "mozRequestFullScreen",
6324        "mozCancelFullScreen",
6325        "mozFullScreenElement",
6326        "mozFullScreenEnabled",
6327        "mozfullscreenchange",
6328        "mozfullscreenerror"
6329      ],
6330      ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError"]
6331    ];
6332
6333    var ret = {};
6334
6335    for (var i = 0; i < fnMap.length; i++) {
6336      var val = fnMap[i];
6337
6338      if (val && val[1] in document) {
6339        for (var j = 0; j < val.length; j++) {
6340          ret[fnMap[0][j]] = val[j];
6341        }
6342
6343        return ret;
6344      }
6345    }
6346
6347    return false;
6348  })();
6349
6350  if (fn) {
6351    var FullScreen = {
6352      request: function (elem) {
6353        elem = elem || document.documentElement;
6354
6355        elem[fn.requestFullscreen](elem.ALLOW_KEYBOARD_INPUT);
6356      },
6357      exit: function () {
6358        document[fn.exitFullscreen]();
6359      },
6360      toggle: function (elem) {
6361        elem = elem || document.documentElement;
6362
6363        if (this.isFullscreen()) {
6364          this.exit();
6365        } else {
6366          this.request(elem);
6367        }
6368      },
6369      isFullscreen: function () {
6370        return Boolean(document[fn.fullscreenElement]);
6371      },
6372      enabled: function () {
6373        return Boolean(document[fn.fullscreenEnabled]);
6374      }
6375    };
6376
6377    $.extend(true, $.fancybox.defaults, {
6378      btnTpl: {
6379        fullScreen: '<button data-fancybox-fullscreen class="fancybox-button fancybox-button--fsenter" title="{{FULL_SCREEN}}">' +
6380          '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>' +
6381          '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"/></svg>' +
6382          "</button>"
6383      },
6384      fullScreen: {
6385        autoStart: false
6386      }
6387    });
6388
6389    $(document).on(fn.fullscreenchange, function () {
6390      var isFullscreen = FullScreen.isFullscreen(),
6391        instance = $.fancybox.getInstance();
6392
6393      if (instance) {
6394        // If image is zooming, then force to stop and reposition properly
6395        if (instance.current && instance.current.type === "image" && instance.isAnimating) {
6396          instance.isAnimating = false;
6397
6398          instance.update(true, true, 0);
6399
6400          if (!instance.isComplete) {
6401            instance.complete();
6402          }
6403        }
6404
6405        instance.trigger("onFullscreenChange", isFullscreen);
6406
6407        instance.$refs.container.toggleClass("fancybox-is-fullscreen", isFullscreen);
6408
6409        instance.$refs.toolbar
6410          .find("[data-fancybox-fullscreen]")
6411          .toggleClass("fancybox-button--fsenter", !isFullscreen)
6412          .toggleClass("fancybox-button--fsexit", isFullscreen);
6413      }
6414    });
6415  }
6416
6417  $(document).on({
6418    "onInit.fb": function (e, instance) {
6419      var $container;
6420
6421      if (!fn) {
6422        instance.$refs.toolbar.find("[data-fancybox-fullscreen]").remove();
6423
6424        return;
6425      }
6426
6427      if (instance && instance.group[instance.currIndex].opts.fullScreen) {
6428        $container = instance.$refs.container;
6429
6430        $container.on("click.fb-fullscreen", "[data-fancybox-fullscreen]", function (e) {
6431          e.stopPropagation();
6432          e.preventDefault();
6433
6434          FullScreen.toggle();
6435        });
6436
6437        if (instance.opts.fullScreen && instance.opts.fullScreen.autoStart === true) {
6438          FullScreen.request();
6439        }
6440
6441        // Expose API
6442        instance.FullScreen = FullScreen;
6443      } else if (instance) {
6444        instance.$refs.toolbar.find("[data-fancybox-fullscreen]").hide();
6445      }
6446    },
6447
6448    "afterKeydown.fb": function (e, instance, current, keypress, keycode) {
6449      // "F"
6450      if (instance && instance.FullScreen && keycode === 70) {
6451        keypress.preventDefault();
6452
6453        instance.FullScreen.toggle();
6454      }
6455    },
6456
6457    "beforeClose.fb": function (e, instance) {
6458      if (instance && instance.FullScreen && instance.$refs.container.hasClass("fancybox-is-fullscreen")) {
6459        FullScreen.exit();
6460      }
6461    }
6462  });
6463})(document, jQuery);
6464// ==========================================================================
6465//
6466// Thumbs
6467// Displays thumbnails in a grid
6468//
6469// ==========================================================================
6470(function (document, $) {
6471  "use strict";
6472
6473  var CLASS = "fancybox-thumbs",
6474    CLASS_ACTIVE = CLASS + "-active";
6475
6476  // Make sure there are default values
6477  $.fancybox.defaults = $.extend(
6478    true, {
6479      btnTpl: {
6480        thumbs: '<button data-fancybox-thumbs class="fancybox-button fancybox-button--thumbs" title="{{THUMBS}}">' +
6481          '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14.59 14.59h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76h-3.76v-3.76zm-4.47 0h3.76v3.76H5.65v-3.76zm8.94-4.47h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76h-3.76V5.65zm-4.47 0h3.76v3.76H5.65V5.65z"/></svg>' +
6482          "</button>"
6483      },
6484      thumbs: {
6485        autoStart: false, // Display thumbnails on opening
6486        hideOnClose: true, // Hide thumbnail grid when closing animation starts
6487        parentEl: ".fancybox-container", // Container is injected into this element
6488        axis: "y" // Vertical (y) or horizontal (x) scrolling
6489      }
6490    },
6491    $.fancybox.defaults
6492  );
6493
6494  var FancyThumbs = function (instance) {
6495    this.init(instance);
6496  };
6497
6498  $.extend(FancyThumbs.prototype, {
6499    $button: null,
6500    $grid: null,
6501    $list: null,
6502    isVisible: false,
6503    isActive: false,
6504
6505    init: function (instance) {
6506      var self = this,
6507        group = instance.group,
6508        enabled = 0;
6509
6510      self.instance = instance;
6511      self.opts = group[instance.currIndex].opts.thumbs;
6512
6513      instance.Thumbs = self;
6514
6515      self.$button = instance.$refs.toolbar.find("[data-fancybox-thumbs]");
6516
6517      // Enable thumbs if at least two group items have thumbnails
6518      for (var i = 0, len = group.length; i < len; i++) {
6519        if (group[i].thumb) {
6520          enabled++;
6521        }
6522
6523        if (enabled > 1) {
6524          break;
6525        }
6526      }
6527
6528      if (enabled > 1 && !!self.opts) {
6529        self.$button.removeAttr("style").on("click", function () {
6530          self.toggle();
6531        });
6532
6533        self.isActive = true;
6534      } else {
6535        self.$button.hide();
6536      }
6537    },
6538
6539    create: function () {
6540      var self = this,
6541        instance = self.instance,
6542        parentEl = self.opts.parentEl,
6543        list = [],
6544        src;
6545
6546      if (!self.$grid) {
6547        // Create main element
6548        self.$grid = $('<div class="' + CLASS + " " + CLASS + "-" + self.opts.axis + '"></div>').appendTo(
6549          instance.$refs.container
6550          .find(parentEl)
6551          .addBack()
6552          .filter(parentEl)
6553        );
6554
6555        // Add "click" event that performs gallery navigation
6556        self.$grid.on("click", "a", function () {
6557          instance.jumpTo($(this).attr("data-index"));
6558        });
6559      }
6560
6561      // Build the list
6562      if (!self.$list) {
6563        self.$list = $('<div class="' + CLASS + '__list">').appendTo(self.$grid);
6564      }
6565
6566      $.each(instance.group, function (i, item) {
6567        src = item.thumb;
6568
6569        if (!src && item.type === "image") {
6570          src = item.src;
6571        }
6572
6573        list.push(
6574          '<a href="javascript:;" tabindex="0" data-index="' +
6575          i +
6576          '"' +
6577          (src && src.length ? ' style="background-image:url(' + src + ')"' : 'class="fancybox-thumbs-missing"') +
6578          "></a>"
6579        );
6580      });
6581
6582      self.$list[0].innerHTML = list.join("");
6583
6584      if (self.opts.axis === "x") {
6585        // Set fixed width for list element to enable horizontal scrolling
6586        self.$list.width(
6587          parseInt(self.$grid.css("padding-right"), 10) +
6588          instance.group.length *
6589          self.$list
6590          .children()
6591          .eq(0)
6592          .outerWidth(true)
6593        );
6594      }
6595    },
6596
6597    focus: function (duration) {
6598      var self = this,
6599        $list = self.$list,
6600        $grid = self.$grid,
6601        thumb,
6602        thumbPos;
6603
6604      if (!self.instance.current) {
6605        return;
6606      }
6607
6608      thumb = $list
6609        .children()
6610        .removeClass(CLASS_ACTIVE)
6611        .filter('[data-index="' + self.instance.current.index + '"]')
6612        .addClass(CLASS_ACTIVE);
6613
6614      thumbPos = thumb.position();
6615
6616      // Check if need to scroll to make current thumb visible
6617      if (self.opts.axis === "y" && (thumbPos.top < 0 || thumbPos.top > $list.height() - thumb.outerHeight())) {
6618        $list.stop().animate({
6619            scrollTop: $list.scrollTop() + thumbPos.top
6620          },
6621          duration
6622        );
6623      } else if (
6624        self.opts.axis === "x" &&
6625        (thumbPos.left < $grid.scrollLeft() || thumbPos.left > $grid.scrollLeft() + ($grid.width() - thumb.outerWidth()))
6626      ) {
6627        $list
6628          .parent()
6629          .stop()
6630          .animate({
6631              scrollLeft: thumbPos.left
6632            },
6633            duration
6634          );
6635      }
6636    },
6637
6638    update: function () {
6639      var that = this;
6640      that.instance.$refs.container.toggleClass("fancybox-show-thumbs", this.isVisible);
6641
6642      if (that.isVisible) {
6643        if (!that.$grid) {
6644          that.create();
6645        }
6646
6647        that.instance.trigger("onThumbsShow");
6648
6649        that.focus(0);
6650      } else if (that.$grid) {
6651        that.instance.trigger("onThumbsHide");
6652      }
6653
6654      // Update content position
6655      that.instance.update();
6656    },
6657
6658    hide: function () {
6659      this.isVisible = false;
6660      this.update();
6661    },
6662
6663    show: function () {
6664      this.isVisible = true;
6665      this.update();
6666    },
6667
6668    toggle: function () {
6669      this.isVisible = !this.isVisible;
6670      this.update();
6671    }
6672  });
6673
6674  $(document).on({
6675    "onInit.fb": function (e, instance) {
6676      var Thumbs;
6677
6678      if (instance && !instance.Thumbs) {
6679        Thumbs = new FancyThumbs(instance);
6680
6681        if (Thumbs.isActive && Thumbs.opts.autoStart === true) {
6682          Thumbs.show();
6683        }
6684      }
6685    },
6686
6687    "beforeShow.fb": function (e, instance, item, firstRun) {
6688      var Thumbs = instance && instance.Thumbs;
6689
6690      if (Thumbs && Thumbs.isVisible) {
6691        Thumbs.focus(firstRun ? 0 : 250);
6692      }
6693    },
6694
6695    "afterKeydown.fb": function (e, instance, current, keypress, keycode) {
6696      var Thumbs = instance && instance.Thumbs;
6697
6698      // "G"
6699      if (Thumbs && Thumbs.isActive && keycode === 71) {
6700        keypress.preventDefault();
6701
6702        Thumbs.toggle();
6703      }
6704    },
6705
6706    "beforeClose.fb": function (e, instance) {
6707      var Thumbs = instance && instance.Thumbs;
6708
6709      if (Thumbs && Thumbs.isVisible && Thumbs.opts.hideOnClose !== false) {
6710        Thumbs.$grid.hide();
6711      }
6712    }
6713  });
6714})(document, jQuery);
6715//// ==========================================================================
6716//
6717// Share
6718// Displays simple form for sharing current url
6719//
6720// ==========================================================================
6721(function (document, $) {
6722  "use strict";
6723
6724  $.extend(true, $.fancybox.defaults, {
6725    btnTpl: {
6726      share: '<button data-fancybox-share class="fancybox-button fancybox-button--share" title="{{SHARE}}">' +
6727        '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2.55 19c1.4-8.4 9.1-9.8 11.9-9.8V5l7 7-7 6.3v-3.5c-2.8 0-10.5 2.1-11.9 4.2z"/></svg>' +
6728        "</button>"
6729    },
6730    share: {
6731      url: function (instance, item) {
6732        return (
6733          (!instance.currentHash && !(item.type === "inline" || item.type === "html") ? item.origSrc || item.src : false) || window.location
6734        );
6735      },
6736      tpl: '<div class="fancybox-share">' +
6737        "<h1>{{SHARE}}</h1>" +
6738        "<p>" +
6739        '<a class="fancybox-share__button fancybox-share__button--fb" href="https://www.facebook.com/sharer/sharer.php?u={{url}}">' +
6740        '<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m287 456v-299c0-21 6-35 35-35h38v-63c-7-1-29-3-55-3-54 0-91 33-91 94v306m143-254h-205v72h196" /></svg>' +
6741        "<span>Facebook</span>" +
6742        "</a>" +
6743        '<a class="fancybox-share__button fancybox-share__button--tw" href="https://twitter.com/intent/tweet?url={{url}}&text={{descr}}">' +
6744        '<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m456 133c-14 7-31 11-47 13 17-10 30-27 37-46-15 10-34 16-52 20-61-62-157-7-141 75-68-3-129-35-169-85-22 37-11 86 26 109-13 0-26-4-37-9 0 39 28 72 65 80-12 3-25 4-37 2 10 33 41 57 77 57-42 30-77 38-122 34 170 111 378-32 359-208 16-11 30-25 41-42z" /></svg>' +
6745        "<span>Twitter</span>" +
6746        "</a>" +
6747        '<a class="fancybox-share__button fancybox-share__button--pt" href="https://www.pinterest.com/pin/create/button/?url={{url}}&description={{descr}}&media={{media}}">' +
6748        '<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path d="m265 56c-109 0-164 78-164 144 0 39 15 74 47 87 5 2 10 0 12-5l4-19c2-6 1-8-3-13-9-11-15-25-15-45 0-58 43-110 113-110 62 0 96 38 96 88 0 67-30 122-73 122-24 0-42-19-36-44 6-29 20-60 20-81 0-19-10-35-31-35-25 0-44 26-44 60 0 21 7 36 7 36l-30 125c-8 37-1 83 0 87 0 3 4 4 5 2 2-3 32-39 42-75l16-64c8 16 31 29 56 29 74 0 124-67 124-157 0-69-58-132-146-132z" fill="#fff"/></svg>' +
6749        "<span>Pinterest</span>" +
6750        "</a>" +
6751        "</p>" +
6752        '<p><input class="fancybox-share__input" type="text" value="{{url_raw}}" onclick="select()" /></p>' +
6753        "</div>"
6754    }
6755  });
6756
6757  function escapeHtml(string) {
6758    var entityMap = {
6759      "&": "&amp;",
6760      "<": "&lt;",
6761      ">": "&gt;",
6762      '"': "&quot;",
6763      "'": "&#39;",
6764      "/": "&#x2F;",
6765      "`": "&#x60;",
6766      "=": "&#x3D;"
6767    };
6768
6769    return String(string).replace(/[&<>"'`=\/]/g, function (s) {
6770      return entityMap[s];
6771    });
6772  }
6773
6774  $(document).on("click", "[data-fancybox-share]", function () {
6775    var instance = $.fancybox.getInstance(),
6776      current = instance.current || null,
6777      url,
6778      tpl;
6779
6780    if (!current) {
6781      return;
6782    }
6783
6784    if ($.type(current.opts.share.url) === "function") {
6785      url = current.opts.share.url.apply(current, [instance, current]);
6786    }
6787
6788    tpl = current.opts.share.tpl
6789      .replace(/\{\{media\}\}/g, current.type === "image" ? encodeURIComponent(current.src) : "")
6790      .replace(/\{\{url\}\}/g, encodeURIComponent(url))
6791      .replace(/\{\{url_raw\}\}/g, escapeHtml(url))
6792      .replace(/\{\{descr\}\}/g, instance.$caption ? encodeURIComponent(instance.$caption.text()) : "");
6793
6794    $.fancybox.open({
6795      src: instance.translate(instance, tpl),
6796      type: "html",
6797      opts: {
6798        touch: false,
6799        animationEffect: false,
6800        afterLoad: function (shareInstance, shareCurrent) {
6801          // Close self if parent instance is closing
6802          instance.$refs.container.one("beforeClose.fb", function () {
6803            shareInstance.close(null, 0);
6804          });
6805
6806          // Opening links in a popup window
6807          shareCurrent.$content.find(".fancybox-share__button").click(function () {
6808            window.open(this.href, "Share", "width=550, height=450");
6809            return false;
6810          });
6811        },
6812        mobile: {
6813          autoFocus: false
6814        }
6815      }
6816    });
6817  });
6818})(document, jQuery);
6819// ==========================================================================
6820//
6821// Hash
6822// Enables linking to each modal
6823//
6824// ==========================================================================
6825(function (window, document, $) {
6826  "use strict";
6827
6828  // Simple $.escapeSelector polyfill (for jQuery prior v3)
6829  if (!$.escapeSelector) {
6830    $.escapeSelector = function (sel) {
6831      var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
6832      var fcssescape = function (ch, asCodePoint) {
6833        if (asCodePoint) {
6834          // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
6835          if (ch === "\0") {
6836            return "\uFFFD";
6837          }
6838
6839          // Control characters and (dependent upon position) numbers get escaped as code points
6840          return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
6841        }
6842
6843        // Other potentially-special ASCII characters get backslash-escaped
6844        return "\\" + ch;
6845      };
6846
6847      return (sel + "").replace(rcssescape, fcssescape);
6848    };
6849  }
6850
6851  // Get info about gallery name and current index from url
6852  function parseUrl() {
6853    var hash = window.location.hash.substr(1),
6854      rez = hash.split("-"),
6855      index = rez.length > 1 && /^\+?\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,
6856      gallery = rez.join("-");
6857
6858    return {
6859      hash: hash,
6860      /* Index is starting from 1 */
6861      index: index < 1 ? 1 : index,
6862      gallery: gallery
6863    };
6864  }
6865
6866  // Trigger click evnt on links to open new fancyBox instance
6867  function triggerFromUrl(url) {
6868    if (url.gallery !== "") {
6869      // If we can find element matching 'data-fancybox' atribute,
6870      // then triggering click event should start fancyBox
6871      $("[data-fancybox='" + $.escapeSelector(url.gallery) + "']")
6872        .eq(url.index - 1)
6873        .focus()
6874        .trigger("click.fb-start");
6875    }
6876  }
6877
6878  // Get gallery name from current instance
6879  function getGalleryID(instance) {
6880    var opts, ret;
6881
6882    if (!instance) {
6883      return false;
6884    }
6885
6886    opts = instance.current ? instance.current.opts : instance.opts;
6887    ret = opts.hash || (opts.$orig ? opts.$orig.data("fancybox") || opts.$orig.data("fancybox-trigger") : "");
6888
6889    return ret === "" ? false : ret;
6890  }
6891
6892  // Start when DOM becomes ready
6893  $(function () {
6894    // Check if user has disabled this module
6895    if ($.fancybox.defaults.hash === false) {
6896      return;
6897    }
6898
6899    // Update hash when opening/closing fancyBox
6900    $(document).on({
6901      "onInit.fb": function (e, instance) {
6902        var url, gallery;
6903
6904        if (instance.group[instance.currIndex].opts.hash === false) {
6905          return;
6906        }
6907
6908        url = parseUrl();
6909        gallery = getGalleryID(instance);
6910
6911        // Make sure gallery start index matches index from hash
6912        if (gallery && url.gallery && gallery == url.gallery) {
6913          instance.currIndex = url.index - 1;
6914        }
6915      },
6916
6917      "beforeShow.fb": function (e, instance, current, firstRun) {
6918        var gallery;
6919
6920        if (!current || current.opts.hash === false) {
6921          return;
6922        }
6923
6924        // Check if need to update window hash
6925        gallery = getGalleryID(instance);
6926
6927        if (!gallery) {
6928          return;
6929        }
6930
6931        // Variable containing last hash value set by fancyBox
6932        // It will be used to determine if fancyBox needs to close after hash change is detected
6933        instance.currentHash = gallery + (instance.group.length > 1 ? "-" + (current.index + 1) : "");
6934
6935        // If current hash is the same (this instance most likely is opened by hashchange), then do nothing
6936        if (window.location.hash === "#" + instance.currentHash) {
6937          return;
6938        }
6939
6940        if (firstRun && !instance.origHash) {
6941          instance.origHash = window.location.hash;
6942        }
6943
6944        if (instance.hashTimer) {
6945          clearTimeout(instance.hashTimer);
6946        }
6947
6948        // Update hash
6949        instance.hashTimer = setTimeout(function () {
6950          if ("replaceState" in window.history) {
6951            window.history[firstRun ? "pushState" : "replaceState"]({},
6952              document.title,
6953              window.location.pathname + window.location.search + "#" + instance.currentHash
6954            );
6955
6956            if (firstRun) {
6957              instance.hasCreatedHistory = true;
6958            }
6959          } else {
6960            window.location.hash = instance.currentHash;
6961          }
6962
6963          instance.hashTimer = null;
6964        }, 300);
6965      },
6966
6967      "beforeClose.fb": function (e, instance, current) {
6968        if (!current || current.opts.hash === false) {
6969          return;
6970        }
6971
6972        clearTimeout(instance.hashTimer);
6973
6974        // Goto previous history entry
6975        if (instance.currentHash && instance.hasCreatedHistory) {
6976          window.history.back();
6977        } else if (instance.currentHash) {
6978          if ("replaceState" in window.history) {
6979            window.history.replaceState({}, document.title, window.location.pathname + window.location.search + (instance.origHash || ""));
6980          } else {
6981            window.location.hash = instance.origHash;
6982          }
6983        }
6984
6985        instance.currentHash = null;
6986      }
6987    });
6988
6989    // Check if need to start/close after url has changed
6990    $(window).on("hashchange.fb", function () {
6991      var url = parseUrl(),
6992        fb = null;
6993
6994      // Find last fancyBox instance that has "hash"
6995      $.each(
6996        $(".fancybox-container")
6997        .get()
6998        .reverse(),
6999        function (index, value) {
7000          var tmp = $(value).data("FancyBox");
7001
7002          if (tmp && tmp.currentHash) {
7003            fb = tmp;
7004            return false;
7005          }
7006        }
7007      );
7008
7009      if (fb) {
7010        // Now, compare hash values
7011        if (fb.currentHash !== url.gallery + "-" + url.index && !(url.index === 1 && fb.currentHash == url.gallery)) {
7012          fb.currentHash = null;
7013
7014          fb.close();
7015        }
7016      } else if (url.gallery !== "") {
7017        triggerFromUrl(url);
7018      }
7019    });
7020
7021    // Check current hash and trigger click event on matching element to start fancyBox, if needed
7022    setTimeout(function () {
7023      if (!$.fancybox.getInstance()) {
7024        triggerFromUrl(parseUrl());
7025      }
7026    }, 50);
7027  });
7028})(window, document, jQuery);
7029// ==========================================================================
7030//
7031// Wheel
7032// Basic mouse weheel support for gallery navigation
7033//
7034// ==========================================================================
7035(function (document, $) {
7036  "use strict";
7037
7038  var prevTime = new Date().getTime();
7039
7040  $(document).on({
7041    "onInit.fb": function (e, instance, current) {
7042      instance.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll", function (e) {
7043        var current = instance.current,
7044          currTime = new Date().getTime();
7045
7046        if (instance.group.length < 2 || current.opts.wheel === false || (current.opts.wheel === "auto" && current.type !== "image")) {
7047          return;
7048        }
7049
7050        e.preventDefault();
7051        e.stopPropagation();
7052
7053        if (current.$slide.hasClass("fancybox-animated")) {
7054          return;
7055        }
7056
7057        e = e.originalEvent || e;
7058
7059        if (currTime - prevTime < 250) {
7060          return;
7061        }
7062
7063        prevTime = currTime;
7064
7065        instance[(-e.deltaY || -e.deltaX || e.wheelDelta || -e.detail) < 0 ? "next" : "previous"]();
7066      });
7067    }
7068  });
7069})(document, jQuery);
7070/* End */
7071;
7072; /* Start:"a:4:{s:4:"full";s:72:"/local/templates/aspro_max_local/js/jquery.flexslider.js?162019756959389";s:6:"source";s:56:"/local/templates/aspro_max_local/js/jquery.flexslider.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
7073/*
7074 * jQuery FlexSlider v2.6.3
7075 * Copyright 2012 WooThemes
7076 * Contributing Author: Tyler Smith
7077 */
7078;
7079(function ($) {
7080
7081  var focused = true;
7082
7083  // Turns a mouse event into a touch event
7084  function toTouchEvent(e) {
7085    var touch = {
7086      identifier: 0,
7087      target: e.target,
7088      screenX: e.screenX,
7089      screenY: e.screenY,
7090      clientX: e.clientX,
7091      clientY: e.clientY,
7092      pageX: e.pageX,
7093      pageY: e.pageY
7094    }
7095    var touchEvent = {
7096      touches: [touch],
7097      targetTouches: [touch],
7098      changedTouches: [touch],
7099      altKey: e.altKey,
7100      metaKey: e.metaKey,
7101      ctrlKey: e.ctrlKey,
7102      shiftKey: e.shiftKey,
7103      target: e.target,
7104      preventDefault: e.preventDefault.bind(e),
7105      type: e.type === 'mousedown' ? 'touchstart' : e.type === 'mousemove' ? 'touchmove' : e.type === 'mouseup' ? 'touchend' : e.type,
7106      timeStamp: e.timeStamp || Date.now()
7107    }
7108    return touchEvent
7109  }
7110
7111  //FlexSlider: Object Instance
7112  $.flexslider = function(el, options) {
7113    var slider = $(el);
7114
7115    // making variables public
7116    slider.vars = $.extend({}, $.flexslider.defaults, options);
7117
7118    var namespace = slider.vars.namespace,
7119        msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
7120        // touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && slider.vars.touch,
7121        touch = /*(( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) &&*/ slider.vars.touch,
7122        // depricating this idea, as devices are being released with both of these events
7123        eventType = "click touchend MSPointerUp keyup",
7124        watchedEvent = "",
7125        watchedEventClearTimer,
7126        vertical = slider.vars.direction === "vertical",
7127        reverse = slider.vars.reverse,
7128        carousel = (slider.vars.itemWidth > 0),
7129        fade = slider.vars.animation === "fade",
7130        asNav = slider.vars.asNavFor !== "",
7131        methods = {};
7132
7133    // Store a reference to the slider object
7134    $.data(el, "flexslider", slider);
7135
7136    // Private slider methods
7137    methods = {
7138      init: function() {
7139        slider.animating = false;
7140        // Get current slide and make sure it is a number
7141        slider.currentSlide = parseInt( ( slider.vars.startAt ? slider.vars.startAt : 0), 10 );
7142        if ( isNaN( slider.currentSlide ) ) { slider.currentSlide = 0; }
7143        slider.animatingTo = slider.currentSlide;
7144        slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
7145        slider.containerSelector = slider.vars.selector.substr(0,slider.vars.selector.search(' '));
7146        slider.slides = $(slider.vars.selector, slider);
7147        slider.container = $(slider.containerSelector, slider);
7148        slider.count = slider.slides.length;
7149        // SYNC:
7150        slider.syncExists = $(slider.vars.sync).length > 0;
7151        // SLIDE:
7152        if (slider.vars.animation === "slide") { slider.vars.animation = "swing"; }
7153        slider.prop = (vertical) ? "top" : "marginLeft";
7154        slider.args = {};
7155        // SLIDESHOW:
7156        slider.manualPause = false;
7157        slider.stopped = false;
7158        //PAUSE WHEN INVISIBLE
7159        slider.started = false;
7160        slider.startTimeout = null;
7161        // TOUCH/USECSS:
7162        slider.transitions = !slider.vars.video && !fade && slider.vars.useCSS && (function() {
7163          var obj = document.createElement('div'),
7164              props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
7165          for (var i in props) {
7166            if ( obj.style[ props[i] ] !== undefined ) {
7167              slider.pfx = props[i].replace('Perspective','').toLowerCase();
7168              slider.prop = "-" + slider.pfx + "-transform";
7169              return true;
7170            }
7171          }
7172          return false;
7173        }());
7174        slider.ensureAnimationEnd = '';
7175        // CONTROLSCONTAINER:
7176        if (slider.vars.controlsContainer !== "") slider.controlsContainer = $(slider.vars.controlsContainer).length > 0 && $(slider.vars.controlsContainer);
7177        // MANUAL:
7178        if (slider.vars.manualControls !== "") slider.manualControls = $(slider.vars.manualControls).length > 0 && $(slider.vars.manualControls);
7179
7180        // CUSTOM DIRECTION NAV:
7181        if (slider.vars.customDirectionNav !== "") slider.customDirectionNav = $(slider.vars.customDirectionNav).length === 2 && $(slider.vars.customDirectionNav);
7182
7183        // RANDOMIZE:
7184        if (slider.vars.randomize) {
7185          slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
7186          slider.container.empty().append(slider.slides);
7187        }
7188
7189        slider.doMath();
7190
7191        // INIT
7192        slider.setup("init");
7193
7194        // CONTROLNAV:
7195        if (slider.vars.controlNav) { methods.controlNav.setup(); }
7196
7197        // DIRECTIONNAV:
7198        if (slider.vars.directionNav) { methods.directionNav.setup(); }
7199
7200        // KEYBOARD:
7201        if (slider.vars.keyboard && ($(slider.containerSelector).length === 1 || slider.vars.multipleKeyboard)) {
7202          $(document).bind('keyup', function(event) {
7203            var keycode = event.keyCode;
7204            if (!slider.animating && (keycode === 39 || keycode === 37)) {
7205              var target = (keycode === 39) ? slider.getTarget('next') :
7206                           (keycode === 37) ? slider.getTarget('prev') : false;
vendor: 4,279 bytes, lines 7207-7304
7207              slider.flexAnimate(target, slider.vars.pauseOnAction);
7208            }
7209          });
7210        }
7211        // MOUSEWHEEL:
7212        if (slider.vars.mousewheel) {
7213          slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
7214            event.preventDefault();
7215            var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
7216            slider.flexAnimate(target, slider.vars.pauseOnAction);
7217          });
7218        }
7219
7220        // PAUSEPLAY
7221        if (slider.vars.pausePlay) { methods.pausePlay.setup(); }
7222
7223        //PAUSE WHEN INVISIBLE
7224        if (slider.vars.slideshow && slider.vars.pauseInvisible) { methods.pauseInvisible.init(); }
7225
7226        // SLIDSESHOW
7227        if (slider.vars.slideshow) {
7228          if (slider.vars.pauseOnHover) {
7229            slider.hover(function() {
7230              if (!slider.manualPlay && !slider.manualPause) { slider.pause(); }
7231            }, function() {
7232              if (!slider.manualPause && !slider.manualPlay && !slider.stopped) { slider.play(); }
7233            });
7234          }
7235          // initialize animation
7236          //If we're visible, or we don't use PageVisibility API
7237          if(!slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) {
7238            (slider.vars.initDelay > 0) ? slider.startTimeout = setTimeout(slider.play, slider.vars.initDelay) : slider.play();
7239          }
7240        }
7241
7242        // ASNAV:
7243        if (asNav) { methods.asNav.setup(); }
7244
7245        // TOUCH
7246        if (touch && slider.vars.touch) { methods.touch(); }
7247
7248        // FADE&&SMOOTHHEIGHT || SLIDE:
7249        if (!fade || (fade && slider.vars.smoothHeight)) { $(window).bind("resize orientationchange", methods.resize); }
7250
7251        slider.find("img").attr("draggable", "false");
7252
7253        // API: start() Callback
7254        setTimeout(function(){
7255          slider.vars.start(slider);
7256        }, 200);
7257      },
7258      asNav: {
7259        setup: function() {
7260          slider.asNav = true;
7261          slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
7262          slider.currentItem = slider.currentSlide;
7263          slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
7264          if(!msGesture){
7265              slider.slides.on(eventType, function(e){
7266                e.preventDefault();
7267                var $slide = $(this),
7268                    target = $slide.index();
7269                var posFromLeft = $slide.offset().left - $(slider).scrollLeft(); // Find position of slide relative to left of slider container
7270                if( posFromLeft <= 0 && $slide.hasClass( namespace + 'active-slide' ) ) {
7271                  slider.flexAnimate(slider.getTarget("prev"), true);
7272                } else if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) {
7273                  slider.direction = (slider.currentItem < target) ? "next" : "prev";
7274                  slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
7275                }
7276              });
7277          }else{
7278              el._slider = slider;
7279              slider.slides.each(function (){
7280                  var that = this;
7281                  that._gesture = new MSGesture();
7282                  that._gesture.target = that;
7283                  that.addEventListener("MSPointerDown", function (e){
7284                      e.preventDefault();
7285                      if(e.currentTarget._gesture) {
7286                        e.currentTarget._gesture.addPointer(e.pointerId);
7287                      }
7288                  }, false);
7289                  that.addEventListener("MSGestureTap", function (e){
7290                      e.preventDefault();
7291                      var $slide = $(this),
7292                          target = $slide.index();
7293                      if (!$(slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
7294                          slider.direction = (slider.currentItem < target) ? "next" : "prev";
7295                          slider.flexAnimate(target, slider.vars.pauseOnAction, false, true, true);
7296                      }
7297                  });
7298              });
7299          }
7300        }
7301      },
7302      controlNav: {
7303        setup: function() {
7304          if (!slider.manualControls) {
7305            methods.controlNav.setupPaging();
7306          } else { // MANUALCONTROLS:
7307            methods.controlNav.setupManual();
7308          }
7309        },
7310        setupPaging: function() {
7311          var type = (slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
7312              j = 1,
7313              item,
7314              slide;
7315
7316          slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
7317
7318          if (slider.pagingCount > 1) {
7319            for (var i = 0; i < slider.pagingCount; i++) {
7320              slide = slider.slides.eq(i);
7321              if ( undefined === slide.attr( 'data-thumb-alt' ) ) { slide.attr( 'data-thumb-alt', '' ); }
7322              var altText = ( '' !== slide.attr( 'data-thumb-alt' ) ) ? altText = ' alt="' + slide.attr( 'data-thumb-alt' ) + '"' : '';
7323              item = (slider.vars.controlNav === "thumbnails") ? '<img src="' + slide.attr( 'data-thumb' ) + '"' + altText + '/>' : '<a href="#">' + j + '</a>';
7324              if ( 'thumbnails' === slider.vars.controlNav && true === slider.vars.thumbCaptions ) {
7325                var captn = slide.attr( 'data-thumbcaption' );
7326                if ( '' !== captn && undefined !== captn ) { item += '<span class="' + namespace + 'caption">' + captn + '</span>'; }
7327              }
7328              slider.controlNavScaffold.append('<li>' + item + '</li>');
7329              j++;
7330            }
7331          }
7332
7333          // CONTROLSCONTAINER:
7334          (slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
7335          methods.controlNav.set();
7336
7337          methods.controlNav.active();
7338
7339          slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
7340            event.preventDefault();
7341
7342            if (watchedEvent === "" || watchedEvent === event.type) {
7343              var $this = $(this),
7344                  target = slider.controlNav.index($this);
7345
7346              if (!$this.hasClass(namespace + 'active')) {
7347                slider.direction = (target > slider.currentSlide) ? "next" : "prev";
7348                slider.flexAnimate(target, slider.vars.pauseOnAction);
7349              }
7350            }
7351
7352            // setup flags to prevent event duplication
7353            if (watchedEvent === "") {
7354              watchedEvent = event.type;
7355            }
7356            methods.setToClearWatchedEvent();
7357
7358          });
7359        },
7360        setupManual: function() {
7361          slider.controlNav = slider.manualControls;
7362          methods.controlNav.active();
7363
7364          slider.controlNav.bind(eventType, function(event) {
7365            event.preventDefault();
7366
7367            if (watchedEvent === "" || watchedEvent === event.type) {
7368              var $this = $(this),
7369                  target = slider.controlNav.index($this);
7370
7371              if (!$this.hasClass(namespace + 'active')) {
7372                (target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
7373                slider.flexAnimate(target, slider.vars.pauseOnAction);
7374              }
7375            }
7376
7377            // setup flags to prevent event duplication
7378            if (watchedEvent === "") {
7379              watchedEvent = event.type;
7380            }
7381            methods.setToClearWatchedEvent();
7382          });
7383        },
7384        set: function() {
7385          var selector = (slider.vars.controlNav === "thumbnails") ? 'img' : 'a';
7386          slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
7387        },
7388        active: function() {
7389          slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
7390        },
7391        update: function(action, pos) {
7392          if (slider.pagingCount > 1 && action === "add") {
7393            slider.controlNavScaffold.append($('<li><a href="#">' + slider.count + '</a></li>'));
7394          } else if (slider.pagingCount === 1) {
7395            slider.controlNavScaffold.find('li').remove();
7396          } else {
7397            slider.controlNav.eq(pos).closest('li').remove();
7398          }
7399          methods.controlNav.set();
7400          (slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
7401        }
7402      },
7403      directionNav: {
7404        setup: function() {
7405          var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li class="' + namespace + 'nav-prev"><a class="' + namespace + 'prev" href="#">
7405' + slider.vars.prevText + '</a></li><li class="' + namespace + 'nav-next"><a class="' + namespace + 'next" href="#">' + slider.vars.nextText + '</a></li></ul>');
7406
7407          // CUSTOM DIRECTION NAV:
7408          if (slider.customDirectionNav) {
7409            slider.directionNav = slider.customDirectionNav;
7410          // CONTROLSCONTAINER:
7411          } else if (slider.controlsContainer) {
7412            $(slider.controlsContainer).append(directionNavScaffold);
7413            slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
7414          } else {
7415            slider.append(directionNavScaffold);
7416            slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
7417          }
7418
7419          methods.directionNav.update();
7420
7421          slider.directionNav.bind(eventType, function(event) {
7422            event.preventDefault();
7423            var target;
7424
7425            if (watchedEvent === "" || watchedEvent === event.type) {
7426              target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
7427              slider.flexAnimate(target, slider.vars.pauseOnAction);
7428            }
7429
7430            // setup flags to prevent event duplication
7431            if (watchedEvent === "") {
7432              watchedEvent = event.type;
7433            }
7434            methods.setToClearWatchedEvent();
7435          });
7436        },
7437        update: function() {
7438          var disabledClass = namespace + 'disabled';
7439          if (slider.pagingCount === 1 || slider.pagingCount < 1) {
7440            slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
7441            slider.directionNav.parent().addClass(disabledClass);
7442          } else if (!slider.vars.animationLoop) {
7443            if (slider.animatingTo === 0) {
7444              slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1');
7445        slider.directionNav.parent().removeClass(disabledClass);
7446        slider.directionNav.filter('.' + namespace + "prev").parent().addClass(disabledClass);
7447            } else if (slider.animatingTo === slider.last) {
7448              slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
7449        slider.directionNav.parent().removeClass(disabledClass);
7450        slider.directionNav.filter('.' + namespace + "next").parent().addClass(disabledClass);
7451            } else {
7452              slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
7453        slider.directionNav.parent().removeClass(disabledClass);
7454            }
7455          } else {
7456            slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
7457      slider.directionNav.parent().removeClass(disabledClass);
7458          }
7459        }
7460      },
7461      pausePlay: {
7462        setup: function() {
7463          var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a href="#"></a></div>');
7464
7465          // CONTROLSCONTAINER:
7466          if (slider.controlsContainer) {
7467            slider.controlsContainer.append(pausePlayScaffold);
7468            slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
7469          } else {
7470            slider.append(pausePlayScaffold);
7471            slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
7472          }
7473
7474          methods.pausePlay.update((slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');
7475
7476          slider.pausePlay.bind(eventType, function(event) {
7477            event.preventDefault();
7478
7479            if (watchedEvent === "" || watchedEvent === event.type) {
7480              if ($(this).hasClass(namespace + 'pause')) {
7481                slider.manualPause = true;
7482                slider.manualPlay = false;
7483                slider.pause();
7484              } else {
7485                slider.manualPause = false;
7486                slider.manualPlay = true;
7487                slider.play();
7488              }
7489            }
7490
7491            // setup flags to prevent event duplication
7492            if (watchedEvent === "") {
7493              watchedEvent = event.type;
7494            }
7495            methods.setToClearWatchedEvent();
7496          });
7497        },
7498        update: function(state) {
7499          (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);
7500        }
7501      },
7502      touch: function() {
7503        var startX,
7504          startY,
7505          offset,
7506          cwidth,
7507          dx,
7508          startT,
7509          onTouchStart,
7510          onTouchMove,
7511          onTouchEnd,
7512          onMouseStart,
7513          onMouseMove,
7514          onMouseEnd,
7515          scrolling = false,
7516          localX = 0,
7517          localY = 0,
7518          accDx = 0,
7519          simulateTouch = slider.vars.simulateTouch;
7520
7521        if(!msGesture){
7522            onTouchStart = function(e) {
7523               var links = (('touches' in e) && $(e.target)[0].nodeName == "A");
7524
7525              if (slider.animating) {
7526                e.preventDefault();
7527              } else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) {
7528                slider.pause();
7529                // CAROUSEL:
7530                cwidth = (vertical) ? slider.h : slider.w;
7531                startT = Number(new Date());
7532                // CAROUSEL:
7533
7534                // Local vars for X and Y points.
7535                localX = e.touches[0].pageX;
7536                localY = e.touches[0].pageY;
7537
7538                offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
7539                         (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * 
7539slider.move) * slider.animatingTo) :
7540                         (carousel && slider.currentSlide === slider.last) ? slider.limit :
7541                         (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
7542                         (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
7543                startX = (vertical) ? localY : localX;
7544                startY = (vertical) ? localX : localY;
7545
7546                el.addEventListener('touchmove', onTouchMove, false);
7547                el.addEventListener('touchend', onTouchEnd, false);
7548
7549                if (simulateTouch && !links) {
7550                  el.addEventListener('mousemove', onMouseMove, false);
7551                  el.addEventListener('mouseup', onMouseEnd, false);
7552                }
7553              }
7554            };
7555
7556            onTouchMove = function(e) {
7557              // Local vars for X and Y points.
7558
7559              localX = e.touches[0].pageX;
7560              localY = e.touches[0].pageY;
7561
7562              dx = (vertical) ? startX - localY : startX - localX;
7563              scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY));
7564
7565              var fxms = 500;
7566
7567              if ( ! scrolling || Number( new Date() ) - startT > fxms ) {
7568                e.preventDefault();
7569                if (!fade && slider.transitions) {
7570                  if (!slider.vars.animationLoop) {
7571                    dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
7572                  }
7573                  slider.setProps(offset + dx, "setTouch");
7574                }
7575              }
7576            };
7577
7578            onTouchEnd = function(e) {
7579              var links = (('touches' in e) && $(e.target)[0].nodeName == "A");
7580              
7581              // finish the touch by undoing the touch session
7582              el.removeEventListener('touchmove', onTouchMove, false);
7583              
7584              if (simulateTouch && !links) {
7585                el.removeEventListener('mousemove', onMouseMove, false);
7586              }
7587
7588              if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
7589                var updateDx = (reverse) ? -dx : dx,
7590                    target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
7591
7592                if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
7593                  slider.flexAnimate(target, slider.vars.pauseOnAction);
7594                } else {
7595                  if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); }
7596                }
7597              }
7598              el.removeEventListener('touchend', onTouchEnd, false);
7599
7600              if (simulateTouch && !links) {
7601                el.removeEventListener('mouseup', onMouseEnd, false);
7602              }
7603
7604              startX = null;
7605              startY = null;
7606              dx = null;
7607              offset = null;
7608            };
7609
7610            onMouseStart = function(e) {
7611              onTouchStart.call(this, toTouchEvent(e));
7612            };
7613
7614            onMouseMove = function(e) {
7615              onTouchMove.call(this, toTouchEvent(e));
7616            };
7617
7618            onMouseEnd = function(e) {
7619              onTouchEnd.call(this, toTouchEvent(e));
7620            };
7621
7622            el.addEventListener('touchstart', onTouchStart, false);
7623
7624             if (simulateTouch) {
7625              el.addEventListener('mousedown', onMouseStart, false);
7626            }
7627        }else{
7628            el.style.msTouchAction = "none";
7629            el._gesture = new MSGesture();
7630            el._gesture.target = el;
7631            el.addEventListener("MSPointerDown", onMSPointerDown, false);
7632            el._slider = slider;
7633            el.addEventListener("MSGestureChange", onMSGestureChange, false);
7634            el.addEventListener("MSGestureEnd", onMSGestureEnd, false);
7635
7636            function onMSPointerDown(e){
7637                e.stopPropagation();
7638                if (slider.animating) {
7639                    e.preventDefault();
7640                }else{
7641                    slider.pause();
7642                    el._gesture.addPointer(e.pointerId);
7643                    accDx = 0;
7644                    cwidth = (vertical) ? slider.h : slider.w;
7645                    startT = Number(new Date());
7646                    // CAROUSEL:
7647
7648                    offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
7649                        (carousel && reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * 
vendor: 6,270 bytes, lines 7649-7801
7649slider.move) * slider.animatingTo) :
7650                            (carousel && slider.currentSlide === slider.last) ? slider.limit :
7651                                (carousel) ? ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.currentSlide :
7652                                    (reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
7653                }
7654            }
7655
7656            function onMSGestureChange(e) {
7657                e.stopPropagation();
7658                var slider = e.target._slider;
7659                if(!slider){
7660                    return;
7661                }
7662                var transX = -e.translationX,
7663                    transY = -e.translationY;
7664
7665                //Accumulate translations.
7666                accDx = accDx + ((vertical) ? transY : transX);
7667                dx = accDx;
7668                scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY));
7669
7670                if(e.detail === e.MSGESTURE_FLAG_INERTIA){
7671                    setImmediate(function (){
7672                        el._gesture.stop();
7673                    });
7674
7675                    return;
7676                }
7677
7678                if (!scrolling || Number(new Date()) - startT > 500) {
7679                    e.preventDefault();
7680                    if (!fade && slider.transitions) {
7681                        if (!slider.vars.animationLoop) {
7682                            dx = accDx / ((slider.currentSlide === 0 && accDx < 0 || slider.currentSlide === slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1);
7683                        }
7684                        slider.setProps(offset + dx, "setTouch");
7685                    }
7686                }
7687            }
7688
7689            function onMSGestureEnd(e) {
7690                e.stopPropagation();
7691                var slider = e.target._slider;
7692                if(!slider){
7693                    return;
7694                }
7695                if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
7696                    var updateDx = (reverse) ? -dx : dx,
7697                        target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
7698
7699                    if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
7700                        slider.flexAnimate(target, slider.vars.pauseOnAction);
7701                    } else {
7702                        if (!fade) { slider.flexAnimate(slider.currentSlide, slider.vars.pauseOnAction, true); }
7703                    }
7704                }
7705
7706                startX = null;
7707                startY = null;
7708                dx = null;
7709                offset = null;
7710                accDx = 0;
7711            }
7712        }
7713      },
7714      resize: function() {
7715        if (!slider.animating && slider.is(':visible')) {
7716          // aspro fix start
7717          if(slider.vars.autoHeight !== undefined && slider.vars.autoHeight) {
7718            slider.viewport.find('li').css('height', '');
7719          }
7720          // aspro fix end
7721          if (!carousel) { slider.doMath(); }
7722
7723          if (fade) {
7724            // SMOOTH HEIGHT:
7725            methods.smoothHeight();
7726          } else if (carousel) { //CAROUSEL:
7727            slider.slides.width(slider.computedW);
7728
7729            slider.update(slider.pagingCount);
7730            // slider.setProps();
7731          }
7732          else if (vertical) { //VERTICAL:
7733            slider.viewport.height(slider.h);
7734            slider.setProps(slider.h, "setTotal");
7735            // aspro fix start
7736            slider.viewport.find('li').css('height', slider.h);
7737            // aspro fix end
7738          } else {
7739            // SMOOTH HEIGHT:
7740            if (slider.vars.smoothHeight) { methods.smoothHeight(); }
7741            slider.newSlides.width(slider.computedW);
7742            slider.setProps(slider.computedW, "setTotal");
7743          }
7744        }
7745      },
7746      smoothHeight: function(dur) {
7747        if (!vertical || fade) {
7748          var $obj = (fade) ? slider : slider.viewport;
7749          (dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).innerHeight()}, dur) : $obj.innerHeight(slider.slides.eq(slider.animatingTo).innerHeight());
7750        }
7751      },
7752      sync: function(action) {
7753        var $obj = $(slider.vars.sync).data("flexslider"),
7754            target = slider.animatingTo;
7755
7756        switch (action) {
7757          case "animate": $obj.flexAnimate(target, slider.vars.pauseOnAction, false, true); break;
7758          case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
7759          case "pause": $obj.pause(); break;
7760        }
7761      },
7762      uniqueID: function($clone) {
7763        // Append _clone to current level and children elements with id attributes
7764        $clone.filter( '[id]' ).add($clone.find( '[id]' )).each(function() {
7765          var $this = $(this);
7766          $this.attr( 'id', $this.attr( 'id' ) + '_clone' );
7767        });
7768        return $clone;
7769      },
7770      pauseInvisible: {
7771        visProp: null,
7772        init: function() {
7773          var visProp = methods.pauseInvisible.getHiddenProp();
7774          if (visProp) {
7775            var evtname = visProp.replace(/[H|h]idden/,'') + 'visibilitychange';
7776            document.addEventListener(evtname, function() {
7777              if (methods.pauseInvisible.isHidden()) {
7778                if(slider.startTimeout) {
7779                  clearTimeout(slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible
7780                } else {
7781                  slider.pause(); //Or just pause
7782                }
7783              }
7784              else {
7785                if(slider.started) {
7786                  slider.play(); //Initiated before, just play
7787                } else {
7788                  if (slider.vars.initDelay > 0) {
7789                    setTimeout(slider.play, slider.vars.initDelay);
7790                  } else {
7791                    slider.play(); //Didn't init before: simply init or wait for it
7792                  }
7793                }
7794              }
7795            });
7796          }
7797        },
7798        isHidden: function() {
7799          var prop = methods.pauseInvisible.getHiddenProp();
7800          if (!prop) {
7801            return false;
7802          }
7803          return document[prop];
7804        },
7805        getHiddenProp: function() {
7806          var prefixes = ['webkit','moz','ms','o'];
7807          // if 'hidden' is natively supported just return it
7808          if ('hidden' in document) {
7809            return 'hidden';
7810          }
7811          // otherwise loop over all the known prefixes until we find one
7812          for ( var i = 0; i < prefixes.length; i++ ) {
7813              if ((prefixes[i] + 'Hidden') in document) {
7814                return prefixes[i] + 'Hidden';
7815              }
7816          }
7817          // otherwise it's not supported
7818          return null;
7819        }
7820      },
7821      setToClearWatchedEvent: function() {
7822        clearTimeout(watchedEventClearTimer);
7823        watchedEventClearTimer = setTimeout(function() {
7824          watchedEvent = "";
7825        }, 3000);
7826      }
7827    };
7828
7829    // public methods
7830    slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
7831      if (!slider.vars.animationLoop && target !== slider.currentSlide) {
7832        slider.direction = (target > slider.currentSlide) ? "next" : "prev";
7833      }
7834
7835      if (asNav && slider.pagingCount === 1) slider.direction = (slider.currentItem < target) ? "next" : "prev";
7836
7837      if (!slider.animating && (slider.canAdvance(target, fromNav) || override)/* && slider.is(":visible")*/) {
7838        if (asNav && withSync) {
7839          var master = $(slider.vars.asNavFor).data('flexslider');
7840          slider.atEnd = target === 0 || target === slider.count - 1;
7841          master.flexAnimate(target, true, false, true, fromNav);
7842          slider.direction = (slider.currentItem < target) ? "next" : "prev";
7843          master.direction = slider.direction;
7844
7845          // ++ added by kach
7846          slider.currentItem = target;
7847          slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
7848          var newtarget = Math.floor((target + 1)/slider.visible) > 0 ? (Math.floor((target + 1 - slider.visible) / slider.move)) : 0;
7849          if(newtarget != slider.currentSlide){
7850            target = newtarget;
7851          }
7852          else{
7853            return false;
7854          }
7855          // ++
7856
7857          // -- removed by kach
7858          /*
7859          if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
7860            slider.currentItem = target;
7861            slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
7862            target = Math.floor(target/slider.visible);
7863          } else {
7864            slider.currentItem = target;
7865            slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
7866            return false;
7867          }*/
7868          
7869          // --
7870        }
7871
7872        slider.animating = true;
7873        slider.animatingTo = target;
7874
7875        // SLIDESHOW:
7876        if (pause) { slider.pause(); }
7877
7878        // API: before() animation Callback
7879        slider.vars.before(slider);
7880
7881        // SYNC:
7882        if (slider.syncExists && !fromNav) { methods.sync("animate"); }
7883
7884        // CONTROLNAV
7885        if (slider.vars.controlNav) { methods.controlNav.active(); }
7886
7887        // !CAROUSEL:
7888        // CANDIDATE: slide active class (for add/remove slide)
7889        if (!carousel) { slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide'); }
7890
7891        // INFINITE LOOP:
7892        // CANDIDATE: atEnd
7893        slider.atEnd = target === 0 || target === slider.last;
7894
7895        // DIRECTIONNAV:
7896        if (slider.vars.directionNav) { methods.directionNav.update(); }
7897
7898        if (target === slider.last) {
7899          // API: end() of cycle Callback
7900          slider.vars.end(slider);
7901          // SLIDESHOW && !INFINITE LOOP:
7902          if (!slider.vars.animationLoop) { slider.pause(); }
7903        }
7904
7905        // SLIDE:
7906        if (!fade) {
7907          var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
7908              margin, slideString, calcNext;
7909
7910          // INFINITE LOOP / REVERSE:
7911          if (carousel) {
7912            margin = slider.vars.itemMargin;
vendor: 16,214 bytes, lines 7913-8281
7913            calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
7914            slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
7915          } else if (slider.currentSlide === 0 && target === slider.count - 1 && slider.vars.animationLoop && slider.direction !== "next") {
7916            slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
7917          } else if (slider.currentSlide === slider.last && target === 0 && slider.vars.animationLoop && slider.direction !== "prev") {
7918            slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
7919          } else {
7920            slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
7921          }
7922          slider.setProps(slideString, "", slider.vars.animationSpeed);
7923          if (slider.transitions) {
7924            if (!slider.vars.animationLoop || !slider.atEnd) {
7925              slider.animating = false;
7926              slider.currentSlide = slider.animatingTo;
7927            }
7928
7929            // Unbind previous transitionEnd events and re-bind new transitionEnd event
7930            slider.container.unbind("webkitTransitionEnd transitionend");
7931            slider.container.bind("webkitTransitionEnd transitionend", function() {
7932              clearTimeout(slider.ensureAnimationEnd);
7933              slider.wrapup(dimension);
7934            });
7935
7936            // Insurance for the ever-so-fickle transitionEnd event
7937            clearTimeout(slider.ensureAnimationEnd);
7938            slider.ensureAnimationEnd = setTimeout(function() {
7939              slider.wrapup(dimension);
7940            }, slider.vars.animationSpeed + 100);
7941
7942          } else {
7943            slider.container.animate(slider.args, slider.vars.animationSpeed, slider.vars.easing, function(){
7944              slider.wrapup(dimension);
7945            });
7946          }
7947        } else { // FADE:
7948          if (!touch) {
7949            slider.slides.eq(slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, slider.vars.animationSpeed, slider.vars.easing);
7950            slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, slider.vars.animationSpeed, slider.vars.easing, slider.wrapup);
7951          } else {
7952            slider.slides.eq(slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
7953            slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
7954            slider.wrapup(dimension);
7955          }
7956        }
7957        // SMOOTH HEIGHT:
7958        if (slider.vars.smoothHeight) { methods.smoothHeight(slider.vars.animationSpeed); }
7959      }
7960    };
7961    slider.wrapup = function(dimension) {
7962      // SLIDE:
7963      if (!fade && !carousel) {
7964        if (slider.currentSlide === 0 && slider.animatingTo === slider.last && slider.vars.animationLoop) {
7965          slider.setProps(dimension, "jumpEnd");
7966        } else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && slider.vars.animationLoop) {
7967          slider.setProps(dimension, "jumpStart");
7968        }
7969      }
7970      slider.animating = false;
7971      slider.currentSlide = slider.animatingTo;
7972      // API: after() animation Callback
7973      slider.vars.after(slider);
7974    };
7975
7976    // SLIDESHOW:
7977    slider.animateSlides = function() {
7978      if (!slider.animating && focused ) { slider.flexAnimate(slider.getTarget("next")); }
7979    };
7980    // SLIDESHOW:
7981    slider.pause = function() {
7982      clearInterval(slider.animatedSlides);
7983      slider.animatedSlides = null;
7984      slider.playing = false;
7985      // PAUSEPLAY:
7986      if (slider.vars.pausePlay) { methods.pausePlay.update("play"); }
7987      // SYNC:
7988      if (slider.syncExists) { methods.sync("pause"); }
7989    };
7990    // SLIDESHOW:
7991    slider.play = function() {
7992      if (slider.playing) { clearInterval(slider.animatedSlides); }
7993      slider.animatedSlides = slider.animatedSlides || setInterval(slider.animateSlides, slider.vars.slideshowSpeed);
7994      slider.started = slider.playing = true;
7995      // PAUSEPLAY:
7996      if (slider.vars.pausePlay) { methods.pausePlay.update("pause"); }
7997      // SYNC:
7998      if (slider.syncExists) { methods.sync("play"); }
7999    };
8000    slider.smoothHeight = function(){
8001      methods.smoothHeight();
8002    };
8003    // STOP:
8004    slider.stop = function () {
8005      slider.pause();
8006      slider.stopped = true;
8007    };
8008    slider.canAdvance = function(target, fromNav) {
8009      // ASNAV:
8010      var last = (asNav) ? slider.pagingCount - 1 : slider.last;
8011      return (fromNav) ? true :
8012             (asNav && slider.currentItem === slider.count - 1 && target === 0 && slider.direction === "prev") ? true :
8013             (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
8014             (target === slider.currentSlide && !asNav) ? false :
8015             (slider.vars.animationLoop) ? true :
8016             (slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
8017             (slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
8018             true;
8019    };
8020    slider.getTarget = function(dir) {
8021      slider.direction = dir;
8022      if (dir === "next") {
8023        return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
8024      } else {
8025        return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
8026      }
8027    };
8028
8029    // SLIDE:
8030    slider.setProps = function(pos, special, dur) {
8031      var target = (function() {
8032        var posCheck = (pos) ? pos : ((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo,
8033            posCalc = (function() {
8034              if (carousel) {
8035                return (special === "setTouch") ? pos :
8036                       (reverse && slider.animatingTo === slider.last) ? 0 :
8037                       (reverse) ? slider.limit - (((slider.itemW + slider.vars.itemMargin) * slider.move) * slider.animatingTo) :
8038                       (slider.animatingTo === slider.last) ? slider.limit : posCheck;
8039              } else {
8040                switch (special) {
8041                  case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
8042                  case "setTouch": return (reverse) ? pos : pos;
8043                  case "jumpEnd": return (reverse) ? pos : slider.count * pos;
8044                  case "jumpStart": return (reverse) ? slider.count * pos : pos;
8045                  default: return pos;
8046                }
8047              }
8048            }());
8049
8050            return (posCalc * -1) + "px";
8051          }());
8052
8053
8054
8055      if (slider.transitions) {
8056        target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
8057        dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
8058        slider.container.css("-" + slider.pfx + "-transition-duration", dur);
8059         slider.container.css("transition-duration", dur);
8060      }
8061
8062      slider.args[slider.prop] = target;
8063      if (slider.transitions || dur === undefined) { slider.container.css(slider.args); }
8064
8065      slider.container.css('transform',target);
8066    };
8067
8068    slider.setup = function(type) {
8069      // SLIDE:
8070      if (!fade) {
8071        var sliderOffset, arr;
8072
8073        if (type === "init") {
8074          slider.viewport = $('<div class="' + namespace + 'viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
8075          // INFINITE LOOP:
8076          slider.cloneCount = 0;
8077          slider.cloneOffset = 0;
8078          // REVERSE:
8079          if (reverse) {
8080            arr = $.makeArray(slider.slides).reverse();
8081            slider.slides = $(arr);
8082            slider.container.empty().append(slider.slides);
8083          }
8084        }
8085        // INFINITE LOOP && !CAROUSEL:
8086        if (slider.vars.animationLoop && !carousel) {
8087          slider.cloneCount = 2;
8088          slider.cloneOffset = 1;
8089          // aspro fix start
8090          slider.viewport.find('li').css('height', slider.h);
8091          // aspro fix end
8092          // clear out old clones
8093          if (type !== "init") { slider.container.find('.clone').remove(); }
8094          slider.container.append(methods.uniqueID(slider.slides.first().clone().addClass('clone')).attr('aria-hidden', 'true'))
8095                          .prepend(methods.uniqueID(slider.slides.last().clone().addClass('clone')).attr('aria-hidden', 'true'));
8096        }
8097        slider.newSlides = $(slider.vars.selector, slider);
8098
8099        sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
8100        // VERTICAL:
8101        if (vertical && !carousel) {
8102          slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
8103          setTimeout(function(){
8104            slider.newSlides.css({"display": "block"});
8105            slider.doMath();
8106            slider.viewport.height(slider.h);
8107            slider.setProps(sliderOffset * slider.h, "init");
8108          }, (type === "init") ? 100 : 0);
8109        } else {
8110          slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
8111          slider.setProps(sliderOffset * slider.computedW, "init");
8112          setTimeout(function(){
8113            slider.doMath();
8114            slider.newSlides.css({"width": slider.computedW, "marginRight" : slider.computedM, "float": "left", "display": "block"});
8115            // SMOOTH HEIGHT:
8116            if (slider.vars.smoothHeight) { methods.smoothHeight(); }
8117          }, (type === "init") ? 100 : 0);
8118        }
8119      } else { // FADE:
8120        slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
8121        if (type === "init") {
8122          if (!touch) {
8123            //slider.slides.eq(slider.currentSlide).fadeIn(slider.vars.animationSpeed, slider.vars.easing);
8124            if (slider.vars.fadeFirstSlide == false) {
8125              slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).css({"opacity": 1});
8126            } else {
8127              slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},slider.vars.animationSpeed,slider.vars.easing);
8128            }
8129          } else {
8130            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});
8131          }
8132        }
8133        // SMOOTH HEIGHT:
8134        if (slider.vars.smoothHeight) { methods.smoothHeight(); }
8135      }
8136      // !CAROUSEL:
8137      // CANDIDATE: active slide
8138      if (!carousel) { slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide"); }
8139
8140      //FlexSlider: init() Callback
8141      slider.vars.init(slider);
8142    };
8143
8144    slider.doMath = function() {
8145      var slide = slider.slides.first(),
8146          slideMargin = slider.vars.itemMargin,
8147          minItems = slider.vars.minItems,
8148          maxItems = slider.vars.maxItems;
8149
8150      slider.w = (slider.viewport===undefined) ? slider.width() : slider.viewport.width();
8151      slider.h = slide.height();
8152      // aspro fix start
8153      var height = 0;
8154      if(vertical) {
8155        slider.slides.each(function(i, el) {
8156          var elHeight = $(el).height();
8157          if(elHeight > height){
8158            height = elHeight;
8159          }
8160        });
8161        slider.h = height;
8162      }
8163      // aspro fix end
8164      slider.boxPadding = slide.outerWidth() - slide.width();
8165
8166      // CAROUSEL:
8167      if (carousel) {
8168        slider.itemT = slider.vars.itemWidth + slideMargin;
8169        slider.itemM = slideMargin;
8170        slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
8171        slider.maxW = (maxItems) ? (maxItems * slider.itemT) - slideMargin : slider.w;
8172        slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * (minItems - 1)))/minItems :
8173                       (slider.maxW < slider.w) ? (slider.w - (slideMargin * (maxItems - 1)))/maxItems :
8174                       (slider.vars.itemWidth > slider.w) ? slider.w : slider.vars.itemWidth;
8175
8176        slider.visible = Math.floor(slider.w / slider.itemW); // -- removed by kach
8177        // slider.visible = Math.floor((slider.itemT > slider.itemW ? slider.w + slider.itemM : slider.w)/(slider.itemT > slider.itemW ? slider.itemT : slider.itemW)); // ++ added by kach
8178        slider.move = (slider.vars.move > 0 && slider.vars.move < slider.visible ) ? slider.vars.move : slider.visible;
8179        slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
8180
8181        slider.last =  slider.pagingCount - 1;
8182        slider.limit = (slider.pagingCount === 1) ? 0 :
8183                       (slider.vars.itemWidth > slider.w) ? (slider.itemW * (slider.count - 1)) + (slideMargin * (slider.count - 1)) : ((slider.itemW + slideMargin) * slider.count) - slider.w - slideMargin;
8184      } else {
8185        slider.itemW = slider.w;
8186        slider.itemM = slideMargin;
8187        slider.pagingCount = slider.count;
8188        slider.last = slider.count - 1;
8189      }
8190      slider.computedW = slider.itemW - slider.boxPadding;
8191      slider.computedM = slider.itemM;
8192    };
8193
8194    slider.update = function(pos, action) {
8195      slider.doMath();
8196
8197      // update currentSlide and slider.animatingTo if necessary
8198      if (!carousel) {
8199        if (pos < slider.currentSlide) {
8200          slider.currentSlide += 1;
8201        } else if (pos <= slider.currentSlide && pos !== 0) {
8202          slider.currentSlide -= 1;
8203        }
8204        slider.animatingTo = slider.currentSlide;
8205      }
8206
8207      // update controlNav
8208      if (slider.vars.controlNav && !slider.manualControls) {
8209        if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
8210          methods.controlNav.update("add");
8211        } else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
8212          /*if (carousel && slider.currentSlide > slider.last) {
8213            slider.currentSlide -= 1;
8214            slider.animatingTo -= 1;
8215          }*/
8216          methods.controlNav.update("remove", slider.last);
8217        }
8218      }
8219      // update directionNav
8220      if (slider.vars.directionNav) { methods.directionNav.update(); }
8221
8222    };
8223
8224    slider.addSlide = function(obj, pos) {
8225      var $obj = $(obj);
8226
8227      slider.count += 1;
8228      slider.last = slider.count - 1;
8229
8230      // append new slide
8231      if (vertical && reverse) {
8232        (pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
8233      } else {
8234        (pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
8235      }
8236
8237      // update currentSlide, animatingTo, controlNav, and directionNav
8238      slider.update(pos, "add");
8239
8240      // update slider.slides
8241      slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
8242      // re-setup the slider to accomdate new slide
8243      slider.setup();
8244
8245      //FlexSlider: added() Callback
8246      slider.vars.added(slider);
8247    };
8248    slider.removeSlide = function(obj) {
8249      var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
8250
8251      // update count
8252      slider.count -= 1;
8253      slider.last = slider.count - 1;
8254
8255      // remove slide
8256      if (isNaN(obj)) {
8257        $(obj, slider.slides).remove();
8258      } else {
8259        (vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
8260      }
8261
8262      // update currentSlide, animatingTo, controlNav, and directionNav
8263      slider.doMath();
8264      slider.update(pos, "remove");
8265
8266      // update slider.slides
8267      slider.slides = $(slider.vars.selector + ':not(.clone)', slider);
8268      // re-setup the slider to accomdate new slide
8269      slider.setup();
8270
8271      // FlexSlider: removed() Callback
8272      slider.vars.removed(slider);
8273    };
8274
8275    //FlexSlider: Initialize
8276    methods.init();
8277  };
8278
8279  // Ensure the slider isn't focussed if the window loses focus.
8280  $( window ).blur( function ( e ) {
8281    focused = false;
8282  }).focus( function ( e ) {
8283    focused = true;
8284  });
8285
8286  //FlexSlider: Default Settings
8287  $.flexslider.defaults = {
8288    namespace: "flex-",             //{NEW} String: Prefix string attached to the class of every element generated by the plugin
8289    selector: ".slides > li",       //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
8290    animation: "fade",              //String: Select your animation type, "fade" or "slide"
8291    easing: "swing",                //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
8292    direction: "horizontal",        //String: Select the sliding direction, "horizontal" or "vertical"
8293    reverse: false,                 //{NEW} Boolean: Reverse the animation direction
8294    animationLoop: true,            //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
8295    smoothHeight: false,            //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
8296    startAt: 0,                     //Integer: The slide that the slider should start on. Array notation (0 = first slide)
8297    slideshow: true,                //Boolean: Animate slider automatically
8298    slideshowSpeed: 7000,           //Integer: Set the speed of the slideshow cycling, in milliseconds
8299    animationSpeed: 600,            //Integer: Set the speed of animations, in milliseconds
8300    initDelay: 0,                   //{NEW} Integer: Set an initialization delay, in milliseconds
8301    randomize: false,               //Boolean: Randomize slide order
8302    fadeFirstSlide: true,           //Boolean: Fade in the first slide when animation type is "fade"
8303    thumbCaptions: false,           //Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav.
8304
8305    // Usability features
8306    pauseOnAction: true,            //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
8307    pauseOnHover: false,            //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
8308    pauseInvisible: true,           //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
8309    useCSS: true,                   //{NEW} Boolean: Slider will use CSS3 transitions if available
8310    touch: true,                    //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
8311    video: false,                   //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
8312    simulateTouch: false,           //{NEW} Boolean: Allow mouse swipe navigation of the slider. Requires touch to be true
8313
8314    // Primary Controls
8315    controlNav: true,               //Boolean: Create navigation for paging control of each slide? Note: Leave true for manualControls usage
8316    directionNav: true,             //Boolean: Create navigation for previous/next navigation? (true/false)
8317    prevText: "Previous",           //String: Set the text for the "previous" directionNav item
8318    nextText: "Next",               //String: Set the text for the "next" directionNav item
8319
8320    // Secondary Navigation
8321    keyboard: true,                 //Boolean: Allow slider navigating via keyboard left/right keys
8322    multipleKeyboard: false,        //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
8323    mousewheel: false,              //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
8324    pausePlay: false,               //Boolean: Create pause/play dynamic element
8325    pauseText: "Pause",             //String: Set the text for the "pause" pausePlay item
8326    playText: "Play",               //String: Set the text for the "play" pausePlay item
8327
8328    // Special properties
8329    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.
8330    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.
8331    customDirectionNav: "",         //{NEW}
8331 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)
8332    sync: "",                       //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
8333    asNavFor: "",                   //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
8334
8335    // Carousel Options
8336    itemWidth: 0,                   //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
8337    itemMargin: 0,                  //{NEW} Integer: Margin between carousel items.
8338    minItems: 1,                    //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
8339    maxItems: 0,                    //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
8340    move: 0,                        //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
8341    allowOneSlide: true,           //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide
8342
8343    // Callback API
8344    start: function(){},            //Callback: function(slider) - Fires when the slider loads the first slide
8345    before: function(){},           //Callback: function(slider) - Fires asynchronously with each slider animation
8346    after: function(){},            //Callback: function(slider) - Fires after each slider animation completes
8347    end: function(){},              //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
8348    added: function(){},            //{NEW} Callback: function(slider) - Fires after a slide is added
8349    removed: function(){},           //{NEW} Callback: function(slider) - Fires after a slide is removed
8350    init: function() {}             //{NEW} Callback: function(slider) - Fires after the slider is initially setup
8351  };
8352
8353  //FlexSlider: Plugin Function
8354  $.fn.flexslider = function(options) {
8355    if (options === undefined) { options = {}; }
8356
8357    if (typeof options === "object") {
8358      return this.each(function() {
8359        var $this = $(this),
8360            selector = (options.selector) ? options.selector : ".slides > li",
8361            $slides = $this.find(selector);
8362
8363      if ( ( $slides.length === 1 && options.allowOneSlide === false ) || $slides.length === 0 ) {
8364          $slides.fadeIn(400);
8365          if (options.start) { options.start($this); }
8366        } else if ($this.data('flexslider') === undefined) {
8367          new $.flexslider(this, options);
8368        }
8369      });
8370    } else {
8371      // Helper strings to quickly perform functions on the slider
8372      var $slider = $(this).data('flexslider');
8373      switch (options) {
8374        case "play": $slider.play(); break;
8375        case "pause": $slider.pause(); break;
8376        case "stop": $slider.stop(); break;
8377        case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
8378        case "prev":
8379        case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
8380        default: if (typeof options === "number") { $slider.flexAnimate(options, true); }
8381      }
8382    }
8383  };
8384})(jQuery);
8385
8386/* End */
8387;
8388; /* Start:"a:4:{s:4:"full";s:72:"/local/templates/aspro_max_local/js/jquery.uniform.min.js?16201975698308";s:6:"source";s:57:"/local/templates/aspro_max_local/js/jquery.uniform.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
8389(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;
vendor: 4,406 bytes, line 8389
8389for(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
8389ose 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);
8390/* End */
8391;
8392; /* Start:"a:4:{s:4:"full";s:87:"/local/templates/aspro_max_local/vendor/js/carousel/owl/owl.carousel.js?162019756991210";s:6:"source";s:71:"/local/templates/aspro_max_local/vendor/js/carousel/owl/owl.carousel.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
8393/**
8394 * Owl Carousel v2.3.4
8395 * Copyright 2013-2018 David Deutsch
8396 * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
8397 */
8398/**
8399 * Owl carousel
vendor: 24,243 bytes, lines 8400-9381
8400 * @version 2.3.4
8401 * @author Bartosz Wojciechowski
8402 * @author David Deutsch
8403 * @license The MIT License (MIT)
8404 * @todo Lazy Load Icon
8405 * @todo prevent animationend bubling
8406 * @todo itemsScaleUp
8407 * @todo Test Zepto
8408 * @todo stagePadding calculate wrong active classes
8409 */
8410;(function($, window, document, undefined) {
8411
8412	/**
8413	 * Creates a carousel.
8414	 * @class The Owl Carousel.
8415	 * @public
8416	 * @param {HTMLElement|jQuery} element - The element to create the carousel for.
8417	 * @param {Object} [options] - The options
8418	 */
8419	function Owl(element, options) {
8420
8421		/**
8422		 * Current settings for the carousel.
8423		 * @public
8424		 */
8425		this.settings = null;
8426
8427		/**
8428		 * Current options set by the caller including defaults.
8429		 * @public
8430		 */
8431		this.options = $.extend({}, Owl.Defaults, options);
8432
8433		/**
8434		 * Plugin element.
8435		 * @public
8436		 */
8437		this.$element = $(element);
8438
8439		/**
8440		 * Proxied event handlers.
8441		 * @protected
8442		 */
8443		this._handlers = {};
8444
8445		/**
8446		 * References to the running plugins of this carousel.
8447		 * @protected
8448		 */
8449		this._plugins = {};
8450
8451		/**
8452		 * Currently suppressed events to prevent them from being retriggered.
8453		 * @protected
8454		 */
8455		this._supress = {};
8456
8457		/**
8458		 * Absolute current position.
8459		 * @protected
8460		 */
8461		this._current = null;
8462
8463		/**
8464		 * Animation speed in milliseconds.
8465		 * @protected
8466		 */
8467		this._speed = null;
8468
8469		/**
8470		 * Coordinates of all items in pixel.
8471		 * @todo The name of this member is missleading.
8472		 * @protected
8473		 */
8474		this._coordinates = [];
8475
8476		/**
8477		 * Current breakpoint.
8478		 * @todo Real media queries would be nice.
8479		 * @protected
8480		 */
8481		this._breakpoint = null;
8482
8483		/**
8484		 * Current width of the plugin element.
8485		 */
8486		this._width = null;
8487
8488		/**
8489		 * All real items.
8490		 * @protected
8491		 */
8492		this._items = [];
8493
8494		/**
8495		 * All cloned items.
8496		 * @protected
8497		 */
8498		this._clones = [];
8499
8500		/**
8501		 * Merge values of all items.
8502		 * @todo Maybe this could be part of a plugin.
8503		 * @protected
8504		 */
8505		this._mergers = [];
8506
8507		/**
8508		 * Widths of all items.
8509		 */
8510		this._widths = [];
8511
8512		/**
8513		 * Invalidated parts within the update process.
8514		 * @protected
8515		 */
8516		this._invalidated = {};
8517
8518		/**
8519		 * Ordered list of workers for the update process.
8520		 * @protected
8521		 */
8522		this._pipe = [];
8523
8524		/**
8525		 * Current state information for the drag operation.
8526		 * @todo #261
8527		 * @protected
8528		 */
8529		this._drag = {
8530			time: null,
8531			target: null,
8532			pointer: null,
8533			stage: {
8534				start: null,
8535				current: null
8536			},
8537			direction: null
8538		};
8539
8540		/**
8541		 * Current state information and their tags.
8542		 * @type {Object}
8543		 * @protected
8544		 */
8545		this._states = {
8546			current: {},
8547			tags: {
8548				'initializing': [ 'busy' ],
8549				'animating': [ 'busy' ],
8550				'dragging': [ 'interacting' ]
8551			}
8552		};
8553
8554		$.each([ 'onResize', 'onThrottledResize' ], $.proxy(function(i, handler) {
8555			this._handlers[handler] = $.proxy(this[handler], this);
8556		}, this));
8557
8558		$.each(Owl.Plugins, $.proxy(function(key, plugin) {
8559			this._plugins[key.charAt(0).toLowerCase() + key.slice(1)]
8560				= new plugin(this);
8561		}, this));
8562
8563		$.each(Owl.Workers, $.proxy(function(priority, worker) {
8564			this._pipe.push({
8565				'filter': worker.filter,
8566				'run': $.proxy(worker.run, this)
8567			});
8568		}, this));
8569
8570		this.setup();
8571		this.initialize();
8572	}
8573
8574	/**
8575	 * Default options for the carousel.
8576	 * @public
8577	 */
8578	Owl.Defaults = {
8579		items: 3,
8580		loop: false,
8581		center: false,
8582		rewind: false,
8583		checkVisibility: true,
8584
8585		mouseDrag: true,
8586		touchDrag: true,
8587		pullDrag: true,
8588		freeDrag: false,
8589
8590		margin: 0,
8591		stagePadding: 0,
8592
8593		merge: false,
8594		mergeFit: true,
8595		autoWidth: false,
8596
8597		startPosition: 0,
8598		rtl: false,
8599
8600		smartSpeed: 250,
8601		fluidSpeed: false,
8602		dragEndSpeed: false,
8603
8604		responsive: {},
8605		responsiveRefreshRate: 200,
8606		responsiveBaseElement: window,
8607
8608		fallbackEasing: 'swing',
8609		slideTransition: '',
8610
8611		info: false,
8612
8613		nestedItemSelector: false,
8614		itemElement: 'div',
8615		stageElement: 'div',
8616
8617		refreshClass: 'owl-refresh',
8618		loadedClass: 'owl-loaded',
8619		loadingClass: 'owl-loading',
8620		rtlClass: 'owl-rtl',
8621		responsiveClass: 'owl-responsive',
8622		dragClass: 'owl-drag',
8623		itemClass: 'owl-item',
8624		stageClass: 'owl-stage',
8625		stageOuterClass: 'owl-stage-outer',
8626		grabClass: 'owl-grab'
8627	};
8628
8629	/**
8630	 * Enumeration for width.
8631	 * @public
8632	 * @readonly
8633	 * @enum {String}
8634	 */
8635	Owl.Width = {
8636		Default: 'default',
8637		Inner: 'inner',
8638		Outer: 'outer'
8639	};
8640
8641	/**
8642	 * Enumeration for types.
8643	 * @public
8644	 * @readonly
8645	 * @enum {String}
8646	 */
8647	Owl.Type = {
8648		Event: 'event',
8649		State: 'state'
8650	};
8651
8652	/**
8653	 * Contains all registered plugins.
8654	 * @public
8655	 */
8656	Owl.Plugins = {};
8657
8658	/**
8659	 * List of workers involved in the update process.
8660	 */
8661	Owl.Workers = [ {
8662		filter: [ 'width', 'settings' ],
8663		run: function() {
8664			this._width = this.$element.width();
8665		}
8666	}, {
8667		filter: [ 'width', 'items', 'settings' ],
8668		run: function(cache) {
8669			cache.current = this._items && this._items[this.relative(this._current)];
8670		}
8671	}, {
8672		filter: [ 'items', 'settings' ],
8673		run: function() {
8674			this.$stage.children('.cloned').remove();
8675		}
8676	}, {
8677		filter: [ 'width', 'items', 'settings' ],
8678		run: function(cache) {
8679			var margin = this.settings.margin || '',
8680				grid = !this.settings.autoWidth,
8681				rtl = this.settings.rtl,
8682				css = {
8683					'width': 'auto',
8684					'margin-left': rtl ? margin : '',
8685					'margin-right': rtl ? '' : margin
8686				};
8687
8688			!grid && this.$stage.children().css(css);
8689
8690			cache.css = css;
8691		}
8692	}, {
8693		filter: [ 'width', 'items', 'settings' ],
8694		run: function(cache) {
8695			var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin,
8696				merge = null,
8697				iterator = this._items.length,
8698				grid = !this.settings.autoWidth,
8699				widths = [];
8700
8701			cache.items = {
8702				merge: false,
8703				width: width
8704			};
8705
8706			while (iterator--) {
8707				merge = this._mergers[iterator];
8708				merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge;
8709
8710				cache.items.merge = merge > 1 || cache.items.merge;
8711
8712				widths[iterator] = !grid ? this._items[iterator].width() : width * merge;
8713			}
8714
8715			this._widths = widths;
8716		}
8717	}, {
8718		filter: [ 'items', 'settings' ],
8719		run: function() {
8720			var clones = [],
8721				items = this._items,
8722				settings = this.settings,
8723				// TODO: Should be computed from number of min width items in stage
8724				view = Math.max(settings.items * 2, 4),
8725				size = Math.ceil(items.length / 2) * 2,
8726				repeat = settings.loop && items.length ? settings.rewind ? view : Math.max(view, size) : 0,
8727				append = '',
8728				prepend = '';
8729
8730			repeat /= 2;
8731
8732			while (repeat > 0) {
8733				// Switch to only using appended clones
8734				clones.push(this.normalize(clones.length / 2, true));
8735				append = append + items[clones[clones.length - 1]][0].outerHTML;
8736				clones.push(this.normalize(items.length - 1 - (clones.length - 1) / 2, true));
8737				prepend = items[clones[clones.length - 1]][0].outerHTML + prepend;
8738				repeat -= 1;
8739			}
8740
8741			this._clones = clones;
8742
8743			$(append).addClass('cloned').appendTo(this.$stage);
8744			$(prepend).addClass('cloned').prependTo(this.$stage);
8745		}
8746	}, {
8747		filter: [ 'width', 'items', 'settings' ],
8748		run: function() {
8749			var rtl = this.settings.rtl ? 1 : -1,
8750				size = this._clones.length + this._items.length,
8751				iterator = -1,
8752				previous = 0,
8753				current = 0,
8754				coordinates = [];
8755
8756			/* ASPRO_CUSTOM */
8757			var pullToEnd = false;
8758			if(this._widths[ this._widths.length - 1 ] < this._width && !this.settings.loop && this.settings.lightDrag) {
8759				pullToEnd = this._width - this._widths[ this._widths.length - 1 ];
8760			}
8761			/* ASPRO_CUSTOM */
8762
8763			while (++iterator < size) {
8764				previous = coordinates[iterator - 1] || 0;
8765				current = this._widths[this.relative(iterator)] + this.settings.margin;
8766				/* ASPRO_CUSTOM */
8767				if(iterator == size - 2 && pullToEnd) {
8768					coordinates.push(previous + current * rtl + pullToEnd + this.settings.margin);
8769				} else {
8770					coordinates.push(previous + current * rtl);
8771				}
8772				/* ASPRO_CUSTOM */
8773			}
8774			this._coordinates = coordinates;
8775		}
8776	}, {
8777		filter: [ 'width', 'items', 'settings' ],
8778		run: function() {
8779			var padding = this.settings.stagePadding,
8780				coordinates = this._coordinates,
8781				css = {
8782					'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding * 2,
8783					'padding-left': padding || '',
8784					'padding-right': padding || ''
8785				};
8786
8787			this.$stage.css(css);
8788		}
8789	}, {
8790		filter: [ 'width', 'items', 'settings' ],
8791		run: function(cache) {
8792			var iterator = this._coordinates.length,
8793				grid = !this.settings.autoWidth,
8794				items = this.$stage.children();
8795
8796			if (grid && cache.items.merge) {
8797				while (iterator--) {
8798					cache.css.width = this._widths[this.relative(iterator)];
8799					items.eq(iterator).css(cache.css);
8800				}
8801			} else if (grid) {
8802				cache.css.width = cache.items.width;
8803				items.css(cache.css);
8804			}
8805		}
8806	}, {
8807		filter: [ 'items' ],
8808		run: function() {
8809			this._coordinates.length < 1 && this.$stage.removeAttr('style');
8810		}
8811	}, {
8812		filter: [ 'width', 'items', 'settings' ],
8813		run: function(cache) {
8814			cache.current = cache.current ? this.$stage.children().index(cache.current) : 0;
8815			cache.current = Math.max(this.minimum(), Math.min(this.maximum(), cache.current));
8816			this.reset(cache.current);
8817		}
8818	}, {
8819		filter: [ 'position' ],
8820		run: function() {
8821			this.animate(this.coordinates(this._current));
8822		}
8823	}, {
8824		filter: [ 'width', 'position', 'items', 'settings' ],
8825		run: function() {
8826			var rtl = this.settings.rtl ? 1 : -1,
8827				padding = this.settings.stagePadding * 2,
8828				begin = this.coordinates(this.current()) + padding,
8829				end = begin + this.width() * rtl,
8830				inner, outer, matches = [], i, n;
8831
8832			for (i = 0, n = this._coordinates.length; i < n; i++) {
8833				inner = this._coordinates[i - 1] || 0;
8834				outer = Math.abs(this._coordinates[i]) + padding * rtl;
8835
8836				if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end)))
8837					|| (this.op(outer, '<', begin) && this.op(outer, '>', end))) {
8838					matches.push(i);
8839				}
8840			}
8841
8842			this.$stage.children('.active').removeClass('active');
8843			this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass('active');
8844
8845			this.$stage.children('.center').removeClass('center');
8846			if (this.settings.center) {
8847				this.$stage.children().eq(this.current()).addClass('center');
8848			}
8849		}
8850	} ];
8851
8852	/**
8853	 * Create the stage DOM element
8854	 */
8855	Owl.prototype.initializeStage = function() {
8856		this.$stage = this.$element.find('.' + this.settings.stageClass);
8857
8858		// if the stage is already in the DOM, grab it and skip stage initialization
8859		if (this.$stage.length) {
8860			return;
8861		}
8862
8863		this.$element.addClass(this.options.loadingClass);
8864
8865		// create stage
8866		this.$stage = $('<' + this.settings.stageElement + '>', {
8867			"class": this.settings.stageClass
8868		}).wrap( $( '<div/>', {
8869			"class": this.settings.stageOuterClass
8870		}));
8871
8872		// append stage
8873		this.$element.append(this.$stage.parent());
8874	};
8875
8876	/**
8877	 * Create item DOM elements
8878	 */
8879	Owl.prototype.initializeItems = function() {
8880		var $items = this.$element.find('.owl-item');
8881
8882		// if the items are already in the DOM, grab them and skip item initialization
8883		if ($items.length) {
8884			this._items = $items.get().map(function(item) {
8885				return $(item);
8886			});
8887
8888			this._mergers = this._items.map(function() {
8889				return 1;
8890			});
8891
8892			this.refresh();
8893
8894			return;
8895		}
8896
8897		// append content
8898		this.replace(this.$element.children().not(this.$stage.parent()));
8899
8900		// check visibility
8901		if (this.isVisible()) {
8902			// update view
8903			this.refresh();
8904		} else {
8905			// invalidate width
8906			this.invalidate('width');
8907		}
8908
8909		this.$element
8910			.removeClass(this.options.loadingClass)
8911			.addClass(this.options.loadedClass);
8912	};
8913
8914	/**
8915	 * Initializes the carousel.
8916	 * @protected
8917	 */
8918	Owl.prototype.initialize = function() {
8919		this.enter('initializing');
8920		this.trigger('initialize');
8921
8922		this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl);
8923
8924		if (this.settings.autoWidth && !this.is('pre-loading')) {
8925			var imgs, nestedSelector, width;
8926			imgs = this.$element.find('img');
8927			nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined;
8928			width = this.$element.children(nestedSelector).width();
8929
8930			if (imgs.length && width <= 0) {
8931				this.preloadAutoWidthImages(imgs);
8932			}
8933		}
8934
8935		this.initializeStage();
8936		this.initializeItems();
8937
8938		// register event handlers
8939		this.registerEventHandlers();
8940
8941		this.leave('initializing');
8942		this.trigger('initialized');
8943	};
8944
8945	/**
8946	 * @returns {Boolean} visibility of $element
8947	 *                    if you know the carousel will always be visible you can set `checkVisibility` to `false` to
8948	 *                    prevent the expensive browser layout forced reflow the $element.is(':visible') does
8949	 */
8950	Owl.prototype.isVisible = function() {
8951		return this.settings.checkVisibility
8952			? this.$element.is(':visible')
8953			: true;
8954	};
8955
8956	/**
8957	 * Setups the current settings.
8958	 * @todo Remove responsive classes. Why should adaptive designs be brought into IE8?
8959	 * @todo Support for media queries by using `matchMedia` would be nice.
8960	 * @public
8961	 */
8962	Owl.prototype.setup = function() {
8963		var viewport = this.viewport(),
8964			overwrites = this.options.responsive,
8965			match = -1,
8966			settings = null;
8967
8968		if (!overwrites) {
8969			settings = $.extend({}, this.options);
8970		} else {
8971			$.each(overwrites, function(breakpoint) {
8972				if (breakpoint <= viewport && breakpoint > match) {
8973					match = Number(breakpoint);
8974				}
8975			});
8976
8977			settings = $.extend({}, this.options, overwrites[match]);
8978			if (typeof settings.stagePadding === 'function') {
8979				settings.stagePadding = settings.stagePadding();
8980			}
8981			delete settings.responsive;
8982
8983			// responsive class
8984			if (settings.responsiveClass) {
8985				this.$element.attr('class',
8986					this.$element.attr('class').replace(new RegExp('(' + this.options.responsiveClass + '-)\\S+\\s', 'g'), '$1' + match)
8987				);
8988			}
8989		}
8990
8991		this.trigger('change', { property: { name: 'settings', value: settings } });
8992		this._breakpoint = match;
8993		this.settings = settings;
8994		this.invalidate('settings');
8995		this.trigger('changed', { property: { name: 'settings', value: this.settings } });
8996	};
8997
8998	/**
8999	 * Updates option logic if necessery.
9000	 * @protected
9001	 */
9002	Owl.prototype.optionsLogic = function() {
9003		if (this.settings.autoWidth) {
9004			this.settings.stagePadding = false;
9005			this.settings.merge = false;
9006		}
9007	};
9008
9009	/**
9010	 * Prepares an item before add.
9011	 * @todo Rename event parameter `content` to `item`.
9012	 * @protected
9013	 * @returns {jQuery|HTMLElement} - The item container.
9014	 */
9015	Owl.prototype.prepare = function(item) {
9016		var event = this.trigger('prepare', { content: item });
9017
9018		if (!event.data) {
9019			event.data = $('<' + this.settings.itemElement + '/>')
9020				.addClass(this.options.itemClass).append(item)
9021		}
9022
9023		this.trigger('prepared', { content: event.data });
9024
9025		return event.data;
9026	};
9027
9028	/**
9029	 * Updates the view.
9030	 * @public
9031	 */
9032	Owl.prototype.update = function() {
9033		var i = 0,
9034			n = this._pipe.length,
9035			filter = $.proxy(function(p) { return this[p] }, this._invalidated),
9036			cache = {};
9037
9038		while (i < n) {
9039			if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) {
9040				this._pipe[i].run(cache);
9041			}
9042			i++;
9043		}
9044
9045		this._invalidated = {};
9046
9047		!this.is('valid') && this.enter('valid');
9048	};
9049
9050	/**
9051	 * Gets the width of the view.
9052	 * @public
9053	 * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return.
9054	 * @returns {Number} - The width of the view in pixel.
9055	 */
9056	Owl.prototype.width = function(dimension) {
9057		dimension = dimension || Owl.Width.Default;
9058		switch (dimension) {
9059			case Owl.Width.Inner:
9060			case Owl.Width.Outer:
9061				return this._width;
9062			default:
9063				return this._width - this.settings.stagePadding * 2 + this.settings.margin;
9064		}
9065	};
9066
9067	/**
9068	 * Refreshes the carousel primarily for adaptive purposes.
9069	 * @public
9070	 */
9071	Owl.prototype.refresh = function() {
9072		this.enter('refreshing');
9073		this.trigger('refresh');
9074
9075		this.setup();
9076
9077		this.optionsLogic();
9078
9079		this.$element.addClass(this.options.refreshClass);
9080
9081		this.update();
9082
9083		this.$element.removeClass(this.options.refreshClass);
9084
9085		this.leave('refreshing');
9086		this.trigger('refreshed');
9087	};
9088
9089	/**
9090	 * Checks window `resize` event.
9091	 * @protected
9092	 */
9093	Owl.prototype.onThrottledResize = function() {
9094		window.clearTimeout(this.resizeTimer);
9095		this.resizeTimer = window.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate);
9096	};
9097
9098	/**
9099	 * Checks window `resize` event.
9100	 * @protected
9101	 */
9102	Owl.prototype.onResize = function() {
9103		if (!this._items.length) {
9104			return false;
9105		}
9106
9107		if (this._width === this.$element.width()) {
9108			return false;
9109		}
9110
9111		if (!this.isVisible()) {
9112			return false;
9113		}
9114
9115		this.enter('resizing');
9116
9117		if (this.trigger('resize').isDefaultPrevented()) {
9118			this.leave('resizing');
9119			return false;
9120		}
9121
9122		this.invalidate('width');
9123
9124		this.refresh();
9125
9126		this.leave('resizing');
9127		this.trigger('resized');
9128	};
9129
9130	/**
9131	 * Registers event handlers.
9132	 * @todo Check `msPointerEnabled`
9133	 * @todo #261
9134	 * @protected
9135	 */
9136	Owl.prototype.registerEventHandlers = function() {
9137		if ($.support.transition) {
9138			this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this));
9139		}
9140
9141		if (this.settings.responsive !== false) {
9142			this.on(window, 'resize', this._handlers.onThrottledResize);
9143		}
9144
9145		if (this.settings.mouseDrag) {
9146			this.$element.addClass(this.options.dragClass);
9147			this.$stage.on('mousedown.owl.core', $.proxy(this.onDragStart, this));
9148			this.$stage.on('dragstart.owl.core selectstart.owl.core', function() { return false });
9149		}
9150
9151		if (this.settings.touchDrag){
9152			this.$stage.on('touchstart.owl.core', $.proxy(this.onDragStart, this));
9153			this.$stage.on('touchcancel.owl.core', $.proxy(this.onDragEnd, this));
9154		}
9155	};
9156
9157	/**
9158	 * Handles `touchstart` and `mousedown` events.
9159	 * @todo Horizontal swipe threshold as option
9160	 * @todo #261
9161	 * @protected
9162	 * @param {Event} event - The event arguments.
9163	 */
9164	Owl.prototype.onDragStart = function(event) {
9165		var stage = null;
9166
9167		if (event.which === 3) {
9168			return;
9169		}
9170
9171		/* ASPRO CUSTOM */
9172		if(this.settings.marginMove) {
9173			stage = this.$stage.css('margin-left').replace('px', '');
9174			stage = {
9175				x: stage,
9176				y: 0
9177			};
9178		/* ASPRO CUSTOM */
9179		} else if ($.support.transform) {
9180			stage = this.$stage.css('transform').replace(/.*\(|\)| /g, '').split(',');
9181			stage = {
9182				x: stage[stage.length === 16 ? 12 : 4],
9183				y: stage[stage.length === 16 ? 13 : 5]
9184			};
9185		} else {
9186			stage = this.$stage.position();
9187			stage = {
9188				x: this.settings.rtl ?
9189					stage.left + this.$stage.width() - this.width() + this.settings.margin :
9190					stage.left,
9191				y: stage.top
9192			};
9193		}
9194
9195		if (this.is('animating')) {
9196			$.support.transform ? this.animate(stage.x) : this.$stage.stop()
9197			this.invalidate('position');
9198		}
9199
9200		this.$element.toggleClass(this.options.grabClass, event.type === 'mousedown');
9201
9202		this.speed(0);
9203
9204		this._drag.time = new Date().getTime();
9205		this._drag.target = $(event.target);
9206		this._drag.stage.start = stage;
9207		this._drag.stage.current = stage;
9208		this._drag.pointer = this.pointer(event);
9209
9210		$(document).on('mouseup.owl.core touchend.owl.core', $.proxy(this.onDragEnd, this));
9211
9212		$(document).one('mousemove.owl.core touchmove.owl.core', $.proxy(function(event) {
9213			var delta = this.difference(this._drag.pointer, this.pointer(event));
9214
9215			$(document).on('mousemove.owl.core touchmove.owl.core', $.proxy(this.onDragMove, this));
9216
9217			if (Math.abs(delta.x) < Math.abs(delta.y) && this.is('valid')) {
9218				return;
9219			}
9220
9221			event.preventDefault();
9222
9223			this.enter('dragging');
9224			this.trigger('drag');
9225		}, this));
9226	};
9227
9228	/**
9229	 * Handles the `touchmove` and `mousemove` events.
9230	 * @todo #261
9231	 * @protected
9232	 * @param {Event} event - The event arguments.
9233	 */
9234	Owl.prototype.onDragMove = function(event) {
9235		var minimum = null,
9236			maximum = null,
9237			pull = null,
9238			delta = this.difference(this._drag.pointer, this.pointer(event)),
9239			stage = this.difference(this._drag.stage.start, delta);
9240
9241		if (!this.is('dragging')) {
9242			return;
9243		}
9244
9245		event.preventDefault();
9246
9247		if (this.settings.loop) {
9248			minimum = this.coordinates(this.minimum());
9249			maximum = this.coordinates(this.maximum() + 1) - minimum;
9250			stage.x = (((stage.x - minimum) % maximum + maximum) % maximum) + minimum;
9251		} else {
9252			minimum = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum());
9253			maximum = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum());
9254			pull = this.settings.pullDrag ? -1 * delta.x / 5 : 0;
9255			stage.x = Math.max(Math.min(stage.x, minimum + pull), maximum + pull);
9256		}
9257
9258		this._drag.stage.current = stage;
9259
9260		this.animate(stage.x);
9261	};
9262
9263	/**
9264	 * Handles the `touchend` and `mouseup` events.
9265	 * @todo #261
9266	 * @todo Threshold for click event
9267	 * @protected
9268	 * @param {Event} event - The event arguments.
9269	 */
9270	Owl.prototype.onDragEnd = function(event) {
9271		var delta = this.difference(this._drag.pointer, this.pointer(event)),
9272			stage = this._drag.stage.current,
9273			direction = delta.x > 0 ^ this.settings.rtl ? 'left' : 'right';
9274
9275		$(document).off('.owl.core');
9276
9277		this.$element.removeClass(this.options.grabClass);
9278
9279		if (delta.x !== 0 && this.is('dragging') || !this.is('valid')) {
9280			this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed);
9281			this.current(this.closest(stage.x, delta.x !== 0 ? direction : this._drag.direction));
9282			this.invalidate('position');
9283			/* ASPRO CUSTOM */
9284			var bUpdate = false;
9285			if(!this.settings.loop) {
9286				if(this.current() === 0) {
9287					bUpdate = stage.x > 0;
9288				} else {
9289					bUpdate = stage.x < this.coordinates()[this._items.length - 1];
9290				}
9291			}
9292			if(!this.settings.lightDrag || bUpdate) {
9293				this.update();
9294			}
9295			/* ASPRO CUSTOM */
9296
9297			this._drag.direction = direction;
9298
9299			if (Math.abs(delta.x) > 3 || new Date().getTime() - this._drag.time > 300) {
9300				this._drag.target.one('click.owl.core', function() { return false; });
9301			}
9302		}
9303
9304		if (!this.is('dragging')) {
9305			return;
9306		}
9307
9308		this.leave('dragging');
9309		this.trigger('dragged');
9310	};
9311
9312	/**
9313	 * Gets absolute position of the closest item for a coordinate.
9314	 * @todo Setting `freeDrag` makes `closest` not reusable. See #165.
9315	 * @protected
9316	 * @param {Number} coordinate - The coordinate in pixel.
9317	 * @param {String} direction - The direction to check for the closest item. Ether `left` or `right`.
9318	 * @return {Number} - The absolute position of the closest item.
9319	 */
9320	Owl.prototype.closest = function(coordinate, direction) {
9321		var position = -1,
9322			pull = 30,
9323			width = this.width(),
9324			coordinates = this.coordinates();
9325
9326		if (!this.settings.freeDrag) {
9327			// check closest item
9328			$.each(coordinates, $.proxy(function(index, value) {
9329				// on a left pull, check on current index
9330				if (direction === 'left' && coordinate > value - pull && coordinate < value + pull) {
9331					position = index;
9332				// on a right pull, check on previous index
9333				// to do so, subtract width from value and set position = index + 1
9334				} else if (direction === 'right' && coordinate > value - width - pull && coordinate < value - width + pull) {
9335					position = index + 1;
9336				} else if (this.op(coordinate, '<', value)
9337					&& this.op(coordinate, '>', coordinates[index + 1] !== undefined ? coordinates[index + 1] : value - width)) {
9338					position = direction === 'left' ? index + 1 : index;
9339				}
9340				return position === -1;
9341			}, this));
9342		}
9343
9344		if (!this.settings.loop) {
9345			// non loop boundries
9346			if (this.op(coordinate, '>', coordinates[this.minimum()])) {
9347				position = coordinate = this.minimum();
9348			} else if (this.op(coordinate, '<', coordinates[this.maximum()])) {
9349				position = coordinate = this.maximum();
9350			}
9351		}
9352
9353		return position;
9354	};
9355
9356	/**
9357	 * Animates the stage.
9358	 * @todo #270
9359	 * @public
9360	 * @param {Number} coordinate - The coordinate in pixels.
9361	 */
9362	Owl.prototype.animate = function(coordinate) {
9363		var animate = this.speed() > 0;
9364
9365		this.is('animating') && this.onTransitionEnd();
9366
9367		if (animate) {
9368			this.enter('animating');
9369			this.trigger('translate');
9370		}
9371
9372		/* ASPRO CUSTOM */
9373		if(this.settings.marginMove) {
9374			this.$stage.css({
9375				'margin-left': coordinate + 'px',
9376				transition: (this.speed() / 1000) + 's' + (
9377					this.settings.slideTransition ? ' ' + this.settings.slideTransition : ''
9378				)
9379			});
9380		/* ASPRO CUSTOM */
9381		}
9381 else 
vendor: 10,522 bytes, lines 9381-9748
9381if ($.support.transform3d && $.support.transition) {
9382			this.$stage.css({
9383				transform: 'translate3d(' + coordinate + 'px,0px,0px)',
9384				transition: (this.speed() / 1000) + 's' + (
9385					this.settings.slideTransition ? ' ' + this.settings.slideTransition : ''
9386				)
9387			});
9388		} else if (animate) {
9389			this.$stage.animate({
9390				left: coordinate + 'px'
9391			}, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this));
9392		} else {
9393			this.$stage.css({
9394				left: coordinate + 'px'
9395			});
9396		}
9397	};
9398
9399	/**
9400	 * Checks whether the carousel is in a specific state or not.
9401	 * @param {String} state - The state to check.
9402	 * @returns {Boolean} - The flag which indicates if the carousel is busy.
9403	 */
9404	Owl.prototype.is = function(state) {
9405		return this._states.current[state] && this._states.current[state] > 0;
9406	};
9407
9408	/**
9409	 * Sets the absolute position of the current item.
9410	 * @public
9411	 * @param {Number} [position] - The new absolute position or nothing to leave it unchanged.
9412	 * @returns {Number} - The absolute position of the current item.
9413	 */
9414	Owl.prototype.current = function(position) {
9415		if (position === undefined) {
9416			return this._current;
9417		}
9418
9419		if (this._items.length === 0) {
9420			return undefined;
9421		}
9422
9423		position = this.normalize(position);
9424
9425		if (this._current !== position) {
9426			var event = this.trigger('change', { property: { name: 'position', value: position } });
9427
9428			if (event.data !== undefined) {
9429				position = this.normalize(event.data);
9430			}
9431
9432			this._current = position;
9433
9434			this.invalidate('position');
9435
9436			this.trigger('changed', { property: { name: 'position', value: this._current } });
9437		}
9438
9439		return this._current;
9440	};
9441
9442	/**
9443	 * Invalidates the given part of the update routine.
9444	 * @param {String} [part] - The part to invalidate.
9445	 * @returns {Array.<String>} - The invalidated parts.
9446	 */
9447	Owl.prototype.invalidate = function(part) {
9448		if ($.type(part) === 'string') {
9449			this._invalidated[part] = true;
9450			this.is('valid') && this.leave('valid');
9451		}
9452		return $.map(this._invalidated, function(v, i) { return i });
9453	};
9454
9455	/**
9456	 * Resets the absolute position of the current item.
9457	 * @public
9458	 * @param {Number} position - The absolute position of the new item.
9459	 */
9460	Owl.prototype.reset = function(position) {
9461		position = this.normalize(position);
9462
9463		if (position === undefined) {
9464			return;
9465		}
9466
9467		this._speed = 0;
9468		this._current = position;
9469
9470		this.suppress([ 'translate', 'translated' ]);
9471
9472		this.animate(this.coordinates(position));
9473
9474		this.release([ 'translate', 'translated' ]);
9475	};
9476
9477	/**
9478	 * Normalizes an absolute or a relative position of an item.
9479	 * @public
9480	 * @param {Number} position - The absolute or relative position to normalize.
9481	 * @param {Boolean} [relative=false] - Whether the given position is relative or not.
9482	 * @returns {Number} - The normalized position.
9483	 */
9484	Owl.prototype.normalize = function(position, relative) {
9485		var n = this._items.length,
9486			m = relative ? 0 : this._clones.length;
9487
9488		if (!this.isNumeric(position) || n < 1) {
9489			position = undefined;
9490		} else if (position < 0 || position >= n + m) {
9491			position = ((position - m / 2) % n + n) % n + m / 2;
9492		}
9493
9494		return position;
9495	};
9496
9497	/**
9498	 * Converts an absolute position of an item into a relative one.
9499	 * @public
9500	 * @param {Number} position - The absolute position to convert.
9501	 * @returns {Number} - The converted position.
9502	 */
9503	Owl.prototype.relative = function(position) {
9504		position -= this._clones.length / 2;
9505		return this.normalize(position, true);
9506	};
9507
9508	/**
9509	 * Gets the maximum position for the current item.
9510	 * @public
9511	 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
9512	 * @returns {Number}
9513	 */
9514	Owl.prototype.maximum = function(relative) {
9515		var settings = this.settings,
9516			maximum = this._coordinates.length,
9517			iterator,
9518			reciprocalItemsWidth,
9519			elementWidth;
9520
9521		if (settings.loop) {
9522			maximum = this._clones.length / 2 + this._items.length - 1;
9523		} else if (settings.autoWidth || settings.merge) {
9524			iterator = this._items.length;
9525			if (iterator) {
9526				reciprocalItemsWidth = this._items[--iterator].width();
9527				elementWidth = this.$element.width();
9528				while (iterator--) {
9529					reciprocalItemsWidth += this._items[iterator].width() + this.settings.margin;
9530					if (reciprocalItemsWidth > elementWidth) {
9531						break;
9532					}
9533				}
9534			}
9535			maximum = iterator + 1;
9536		} else if (settings.center) {
9537			maximum = this._items.length - 1;
9538		} else {
9539			maximum = this._items.length - settings.items;
9540		}
9541
9542		if (relative) {
9543			maximum -= this._clones.length / 2;
9544		}
9545
9546		return Math.max(maximum, 0);
9547	};
9548
9549	/**
9550	 * Gets the minimum position for the current item.
9551	 * @public
9552	 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position.
9553	 * @returns {Number}
9554	 */
9555	Owl.prototype.minimum = function(relative) {
9556		return relative ? 0 : this._clones.length / 2;
9557	};
9558
9559	/**
9560	 * Gets an item at the specified relative position.
9561	 * @public
9562	 * @param {Number} [position] - The relative position of the item.
9563	 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
9564	 */
9565	Owl.prototype.items = function(position) {
9566		if (position === undefined) {
9567			return this._items.slice();
9568		}
9569
9570		position = this.normalize(position, true);
9571		return this._items[position];
9572	};
9573
9574	/**
9575	 * Gets an item at the specified relative position.
9576	 * @public
9577	 * @param {Number} [position] - The relative position of the item.
9578	 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given.
9579	 */
9580	Owl.prototype.mergers = function(position) {
9581		if (position === undefined) {
9582			return this._mergers.slice();
9583		}
9584
9585		position = this.normalize(position, true);
9586		return this._mergers[position];
9587	};
9588
9589	/**
9590	 * Gets the absolute positions of clones for an item.
9591	 * @public
9592	 * @param {Number} [position] - The relative position of the item.
9593	 * @returns {Array.<Number>} - The absolute positions of clones for the item or all if no position was given.
9594	 */
9595	Owl.prototype.clones = function(position) {
9596		var odd = this._clones.length / 2,
9597			even = odd + this._items.length,
9598			map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 };
9599
9600		if (position === undefined) {
9601			return $.map(this._clones, function(v, i) { return map(i) });
9602		}
9603
9604		return $.map(this._clones, function(v, i) { return v === position ? map(i) : null });
9605	};
9606
9607	/**
9608	 * Sets the current animation speed.
9609	 * @public
9610	 * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged.
9611	 * @returns {Number} - The current animation speed in milliseconds.
9612	 */
9613	Owl.prototype.speed = function(speed) {
9614		if (speed !== undefined) {
9615			this._speed = speed;
9616		}
9617
9618		return this._speed;
9619	};
9620
9621	/**
9622	 * Gets the coordinate of an item.
9623	 * @todo The name of this method is missleanding.
9624	 * @public
9625	 * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`.
9626	 * @returns {Number|Array.<Number>} - The coordinate of the item in pixel or all coordinates.
9627	 */
9628	Owl.prototype.coordinates = function(position) {
9629		var multiplier = 1,
9630			newPosition = position - 1,
9631			coordinate;
9632
9633		if (position === undefined) {
9634			return $.map(this._coordinates, $.proxy(function(coordinate, index) {
9635				return this.coordinates(index);
9636			}, this));
9637		}
9638
9639		if (this.settings.center) {
9640			if (this.settings.rtl) {
9641				multiplier = -1;
9642				newPosition = position + 1;
9643			}
9644
9645			coordinate = this._coordinates[position];
9646			coordinate += (this.width() - coordinate + (this._coordinates[newPosition] || 0)) / 2 * multiplier;
9647		} else {
9648			coordinate = this._coordinates[newPosition] || 0;
9649		}
9650
9651		coordinate = Math.ceil(coordinate);
9652
9653		return coordinate;
9654	};
9655
9656	/**
9657	 * Calculates the speed for a translation.
9658	 * @protected
9659	 * @param {Number} from - The absolute position of the start item.
9660	 * @param {Number} to - The absolute position of the target item.
9661	 * @param {Number} [factor=undefined] - The time factor in milliseconds.
9662	 * @returns {Number} - The time in milliseconds for the translation.
9663	 */
9664	Owl.prototype.duration = function(from, to, factor) {
9665		if (factor === 0) {
9666			return 0;
9667		}
9668
9669		return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed));
9670	};
9671
9672	/**
9673	 * Slides to the specified item.
9674	 * @public
9675	 * @param {Number} position - The position of the item.
9676	 * @param {Number} [speed] - The time in milliseconds for the transition.
9677	 */
9678	Owl.prototype.to = function(position, speed) {
9679		var current = this.current(),
9680			revert = null,
9681			distance = position - this.relative(current),
9682			direction = (distance > 0) - (distance < 0),
9683			items = this._items.length,
9684			minimum = this.minimum(),
9685			maximum = this.maximum();
9686
9687		if (this.settings.loop) {
9688			if (!this.settings.rewind && Math.abs(distance) > items / 2) {
9689				distance += direction * -1 * items;
9690			}
9691
9692			position = current + distance;
9693			revert = ((position - minimum) % items + items) % items + minimum;
9694
9695			if (revert !== position && revert - distance <= maximum && revert - distance > 0) {
9696				current = revert - distance;
9697				position = revert;
9698				this.reset(current);
9699			}
9700		} else if (this.settings.rewind) {
9701			maximum += 1;
9702			position = (position % maximum + maximum) % maximum;
9703		} else {
9704			position = Math.max(minimum, Math.min(maximum, position));
9705		}
9706
9707		this.speed(this.duration(current, position, speed));
9708		this.current(position);
9709
9710		if (this.isVisible()) {
9711			this.update();
9712		}
9713	};
9714
9715	/**
9716	 * Slides to the next item.
9717	 * @public
9718	 * @param {Number} [speed] - The time in milliseconds for the transition.
9719	 */
9720	Owl.prototype.next = function(speed) {
9721		speed = speed || false;
9722		this.to(this.relative(this.current()) + 1, speed);
9723	};
9724
9725	/**
9726	 * Slides to the previous item.
9727	 * @public
9728	 * @param {Number} [speed] - The time in milliseconds for the transition.
9729	 */
9730	Owl.prototype.prev = function(speed) {
9731		speed = speed || false;
9732		this.to(this.relative(this.current()) - 1, speed);
9733	};
9734
9735	/**
9736	 * Handles the end of an animation.
9737	 * @protected
9738	 * @param {Event} event - The event arguments.
9739	 */
9740	Owl.prototype.onTransitionEnd = function(event) {
9741
9742		// if css2 animation then event object is undefined
9743		if (event !== undefined) {
9744			event.stopPropagation();
9745
9746			// Catch only owl-stage transitionEnd event
9747			if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) {
9748				return false;
vendor: 22,957 bytes, lines 9749-10597
9749			}
9750		}
9751
9752		this.leave('animating');
9753		this.trigger('translated');
9754	};
9755
9756	/**
9757	 * Gets viewport width.
9758	 * @protected
9759	 * @return {Number} - The width in pixel.
9760	 */
9761	Owl.prototype.viewport = function() {
9762		var width;
9763		if (this.options.responsiveBaseElement !== window) {
9764			width = $(this.options.responsiveBaseElement).width();
9765		} else if (window.innerWidth) {
9766			width = window.innerWidth;
9767		} else if (document.documentElement && document.documentElement.clientWidth) {
9768			width = document.documentElement.clientWidth;
9769		} else {
9770			console.warn('Can not detect viewport width.');
9771		}
9772		return width;
9773	};
9774
9775	/**
9776	 * Replaces the current content.
9777	 * @public
9778	 * @param {HTMLElement|jQuery|String} content - The new content.
9779	 */
9780	Owl.prototype.replace = function(content) {
9781		this.$stage.empty();
9782		this._items = [];
9783
9784		if (content) {
9785			content = (content instanceof jQuery) ? content : $(content);
9786		}
9787
9788		if (this.settings.nestedItemSelector) {
9789			content = content.find('.' + this.settings.nestedItemSelector);
9790		}
9791
9792		content.filter(function() {
9793			return this.nodeType === 1;
9794		}).each($.proxy(function(index, item) {
9795			item = this.prepare(item);
9796			this.$stage.append(item);
9797			this._items.push(item);
9798			this._mergers.push(item.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
9799		}, this));
9800
9801		this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0);
9802
9803		this.invalidate('items');
9804	};
9805
9806	/**
9807	 * Adds an item.
9808	 * @todo Use `item` instead of `content` for the event arguments.
9809	 * @public
9810	 * @param {HTMLElement|jQuery|String} content - The item content to add.
9811	 * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end.
9812	 */
9813	Owl.prototype.add = function(content, position) {
9814		var current = this.relative(this._current);
9815
9816		position = position === undefined ? this._items.length : this.normalize(position, true);
9817		content = content instanceof jQuery ? content : $(content);
9818
9819		this.trigger('add', { content: content, position: position });
9820
9821		content = this.prepare(content);
9822
9823		if (this._items.length === 0 || position === this._items.length) {
9824			this._items.length === 0 && this.$stage.append(content);
9825			this._items.length !== 0 && this._items[position - 1].after(content);
9826			this._items.push(content);
9827			this._mergers.push(content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
9828		} else {
9829			this._items[position].before(content);
9830			this._items.splice(position, 0, content);
9831			this._mergers.splice(position, 0, content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1);
9832		}
9833
9834		this._items[current] && this.reset(this._items[current].index());
9835
9836		this.invalidate('items');
9837
9838		this.trigger('added', { content: content, position: position });
9839	};
9840
9841	/**
9842	 * Removes an item by its position.
9843	 * @todo Use `item` instead of `content` for the event arguments.
9844	 * @public
9845	 * @param {Number} position - The relative position of the item to remove.
9846	 */
9847	Owl.prototype.remove = function(position) {
9848		position = this.normalize(position, true);
9849
9850		if (position === undefined) {
9851			return;
9852		}
9853
9854		this.trigger('remove', { content: this._items[position], position: position });
9855
9856		this._items[position].remove();
9857		this._items.splice(position, 1);
9858		this._mergers.splice(position, 1);
9859
9860		this.invalidate('items');
9861
9862		this.trigger('removed', { content: null, position: position });
9863	};
9864
9865	/**
9866	 * Preloads images with auto width.
9867	 * @todo Replace by a more generic approach
9868	 * @protected
9869	 */
9870	Owl.prototype.preloadAutoWidthImages = function(images) {
9871		images.each($.proxy(function(i, element) {
9872			this.enter('pre-loading');
9873			element = $(element);
9874			$(new Image()).one('load', $.proxy(function(e) {
9875				element.attr('src', e.target.src);
9876				element.css('opacity', 1);
9877				this.leave('pre-loading');
9878				!this.is('pre-loading') && !this.is('initializing') && this.refresh();
9879			}, this)).attr('src', element.attr('src') || element.attr('data-src') || element.attr('data-src-retina'));
9880		}, this));
9881	};
9882
9883	/**
9884	 * Destroys the carousel.
9885	 * @public
9886	 */
9887	Owl.prototype.destroy = function() {
9888
9889		this.$element.off('.owl.core');
9890		this.$stage.off('.owl.core');
9891		$(document).off('.owl.core');
9892
9893		if (this.settings.responsive !== false) {
9894			window.clearTimeout(this.resizeTimer);
9895			this.off(window, 'resize', this._handlers.onThrottledResize);
9896		}
9897
9898		for (var i in this._plugins) {
9899			this._plugins[i].destroy();
9900		}
9901
9902		this.$stage.children('.cloned').remove();
9903
9904		this.$stage.unwrap();
9905		this.$stage.children().contents().unwrap();
9906		this.$stage.children().unwrap();
9907		this.$stage.remove();
9908		this.$element
9909			.removeClass(this.options.refreshClass)
9910			.removeClass(this.options.loadingClass)
9911			.removeClass(this.options.loadedClass)
9912			.removeClass(this.options.rtlClass)
9913			.removeClass(this.options.dragClass)
9914			.removeClass(this.options.grabClass)
9915			.attr('class', this.$element.attr('class').replace(new RegExp(this.options.responsiveClass + '-\\S+\\s', 'g'), ''))
9916			.removeData('owl.carousel');
9917	};
9918
9919	/**
9920	 * Operators to calculate right-to-left and left-to-right.
9921	 * @protected
9922	 * @param {Number} [a] - The left side operand.
9923	 * @param {String} [o] - The operator.
9924	 * @param {Number} [b] - The right side operand.
9925	 */
9926	Owl.prototype.op = function(a, o, b) {
9927		var rtl = this.settings.rtl;
9928		switch (o) {
9929			case '<':
9930				return rtl ? a > b : a < b;
9931			case '>':
9932				return rtl ? a < b : a > b;
9933			case '>=':
9934				return rtl ? a <= b : a >= b;
9935			case '<=':
9936				return rtl ? a >= b : a <= b;
9937			default:
9938				break;
9939		}
9940	};
9941
9942	/**
9943	 * Attaches to an internal event.
9944	 * @protected
9945	 * @param {HTMLElement} element - The event source.
9946	 * @param {String} event - The event name.
9947	 * @param {Function} listener - The event handler to attach.
9948	 * @param {Boolean} capture - Wether the event should be handled at the capturing phase or not.
9949	 */
9950	Owl.prototype.on = function(element, event, listener, capture) {
9951		if (element.addEventListener) {
9952			element.addEventListener(event, listener, capture);
9953		} else if (element.attachEvent) {
9954			element.attachEvent('on' + event, listener);
9955		}
9956	};
9957
9958	/**
9959	 * Detaches from an internal event.
9960	 * @protected
9961	 * @param {HTMLElement} element - The event source.
9962	 * @param {String} event - The event name.
9963	 * @param {Function} listener - The attached event handler to detach.
9964	 * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not.
9965	 */
9966	Owl.prototype.off = function(element, event, listener, capture) {
9967		if (element.removeEventListener) {
9968			element.removeEventListener(event, listener, capture);
9969		} else if (element.detachEvent) {
9970			element.detachEvent('on' + event, listener);
9971		}
9972	};
9973
9974	/**
9975	 * Triggers a public event.
9976	 * @todo Remove `status`, `relatedTarget` should be used instead.
9977	 * @protected
9978	 * @param {String} name - The event name.
9979	 * @param {*} [data=null] - The event data.
9980	 * @param {String} [namespace=carousel] - The event namespace.
9981	 * @param {String} [state] - The state which is associated with the event.
9982	 * @param {Boolean} [enter=false] - Indicates if the call enters the specified state or not.
9983	 * @returns {Event} - The event arguments.
9984	 */
9985	Owl.prototype.trigger = function(name, data, namespace, state, enter) {
9986		var status = {
9987			item: { count: this._items.length, index: this.current() }
9988		}, handler = $.camelCase(
9989			$.grep([ 'on', name, namespace ], function(v) { return v })
9990				.join('-').toLowerCase()
9991		), event = $.Event(
9992			[ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(),
9993			$.extend({ relatedTarget: this }, status, data)
9994		);
9995
9996		if (!this._supress[name]) {
9997			$.each(this._plugins, function(name, plugin) {
9998				if (plugin.onTrigger) {
9999					plugin.onTrigger(event);
10000				}
10001			});
10002
10003			this.register({ type: Owl.Type.Event, name: name });
10004			this.$element.trigger(event);
10005
10006			if (this.settings && typeof this.settings[handler] === 'function') {
10007				this.settings[handler].call(this, event);
10008			}
10009		}
10010
10011		return event;
10012	};
10013
10014	/**
10015	 * Enters a state.
10016	 * @param name - The state name.
10017	 */
10018	Owl.prototype.enter = function(name) {
10019		$.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
10020			if (this._states.current[name] === undefined) {
10021				this._states.current[name] = 0;
10022			}
10023
10024			this._states.current[name]++;
10025		}, this));
10026	};
10027
10028	/**
10029	 * Leaves a state.
10030	 * @param name - The state name.
10031	 */
10032	Owl.prototype.leave = function(name) {
10033		$.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) {
10034			this._states.current[name]--;
10035		}, this));
10036	};
10037
10038	/**
10039	 * Registers an event or state.
10040	 * @public
10041	 * @param {Object} object - The event or state to register.
10042	 */
10043	Owl.prototype.register = function(object) {
10044		if (object.type === Owl.Type.Event) {
10045			if (!$.event.special[object.name]) {
10046				$.event.special[object.name] = {};
10047			}
10048
10049			if (!$.event.special[object.name].owl) {
10050				var _default = $.event.special[object.name]._default;
10051				$.event.special[object.name]._default = function(e) {
10052					if (_default && _default.apply && (!e.namespace || e.namespace.indexOf('owl') === -1)) {
10053						return _default.apply(this, arguments);
10054					}
10055					return e.namespace && e.namespace.indexOf('owl') > -1;
10056				};
10057				$.event.special[object.name].owl = true;
10058			}
10059		} else if (object.type === Owl.Type.State) {
10060			if (!this._states.tags[object.name]) {
10061				this._states.tags[object.name] = object.tags;
10062			} else {
10063				this._states.tags[object.name] = this._states.tags[object.name].concat(object.tags);
10064			}
10065
10066			this._states.tags[object.name] = $.grep(this._states.tags[object.name], $.proxy(function(tag, i) {
10067				return $.inArray(tag, this._states.tags[object.name]) === i;
10068			}, this));
10069		}
10070	};
10071
10072	/**
10073	 * Suppresses events.
10074	 * @protected
10075	 * @param {Array.<String>} events - The events to suppress.
10076	 */
10077	Owl.prototype.suppress = function(events) {
10078		$.each(events, $.proxy(function(index, event) {
10079			this._supress[event] = true;
10080		}, this));
10081	};
10082
10083	/**
10084	 * Releases suppressed events.
10085	 * @protected
10086	 * @param {Array.<String>} events - The events to release.
10087	 */
10088	Owl.prototype.release = function(events) {
10089		$.each(events, $.proxy(function(index, event) {
10090			delete this._supress[event];
10091		}, this));
10092	};
10093
10094	/**
10095	 * Gets unified pointer coordinates from event.
10096	 * @todo #261
10097	 * @protected
10098	 * @param {Event} - The `mousedown` or `touchstart` event.
10099	 * @returns {Object} - Contains `x` and `y` coordinates of current pointer position.
10100	 */
10101	Owl.prototype.pointer = function(event) {
10102		var result = { x: null, y: null };
10103
10104		event = event.originalEvent || event || window.event;
10105
10106		event = event.touches && event.touches.length ?
10107			event.touches[0] : event.changedTouches && event.changedTouches.length ?
10108				event.changedTouches[0] : event;
10109
10110		if (event.pageX) {
10111			result.x = event.pageX;
10112			result.y = event.pageY;
10113		} else {
10114			result.x = event.clientX;
10115			result.y = event.clientY;
10116		}
10117
10118		return result;
10119	};
10120
10121	/**
10122	 * Determines if the input is a Number or something that can be coerced to a Number
10123	 * @protected
10124	 * @param {Number|String|Object|Array|Boolean|RegExp|Function|Symbol} - The input to be tested
10125	 * @returns {Boolean} - An indication if the input is a Number or can be coerced to a Number
10126	 */
10127	Owl.prototype.isNumeric = function(number) {
10128		return !isNaN(parseFloat(number));
10129	};
10130
10131	/**
10132	 * Gets the difference of two vectors.
10133	 * @todo #261
10134	 * @protected
10135	 * @param {Object} - The first vector.
10136	 * @param {Object} - The second vector.
10137	 * @returns {Object} - The difference.
10138	 */
10139	Owl.prototype.difference = function(first, second) {
10140		return {
10141			x: first.x - second.x,
10142			y: first.y - second.y
10143		};
10144	};
10145
10146	/**
10147	 * The jQuery Plugin for the Owl Carousel
10148	 * @todo Navigation plugin `next` and `prev`
10149	 * @public
10150	 */
10151	$.fn.owlCarousel = function(option) {
10152		var args = Array.prototype.slice.call(arguments, 1);
10153
10154		return this.each(function() {
10155			var $this = $(this),
10156				data = $this.data('owl.carousel');
10157
10158			if (!data) {
10159				data = new Owl(this, typeof option == 'object' && option);
10160				$this.data('owl.carousel', data);
10161
10162				$.each([
10163					'next', 'prev', 'to', 'destroy', 'refresh', 'replace', 'add', 'remove'
10164				], function(i, event) {
10165					data.register({ type: Owl.Type.Event, name: event });
10166					data.$element.on(event + '.owl.carousel.core', $.proxy(function(e) {
10167						if (e.namespace && e.relatedTarget !== this) {
10168							this.suppress([ event ]);
10169							data[event].apply(this, [].slice.call(arguments, 1));
10170							this.release([ event ]);
10171						}
10172					}, data));
10173				});
10174			}
10175
10176			if (typeof option == 'string' && option.charAt(0) !== '_') {
10177				data[option].apply(data, args);
10178			}
10179		});
10180	};
10181
10182	/**
10183	 * The constructor for the jQuery Plugin
10184	 * @public
10185	 */
10186	$.fn.owlCarousel.Constructor = Owl;
10187
10188})(window.Zepto || window.jQuery, window, document);
10189
10190/**
10191 * AutoRefresh Plugin
10192 * @version 2.3.4
10193 * @author Artus Kolanowski
10194 * @author David Deutsch
10195 * @license The MIT License (MIT)
10196 */
10197;(function($, window, document, undefined) {
10198
10199	/**
10200	 * Creates the auto refresh plugin.
10201	 * @class The Auto Refresh Plugin
10202	 * @param {Owl} carousel - The Owl Carousel
10203	 */
10204	var AutoRefresh = function(carousel) {
10205		/**
10206		 * Reference to the core.
10207		 * @protected
10208		 * @type {Owl}
10209		 */
10210		this._core = carousel;
10211
10212		/**
10213		 * Refresh interval.
10214		 * @protected
10215		 * @type {number}
10216		 */
10217		this._interval = null;
10218
10219		/**
10220		 * Whether the element is currently visible or not.
10221		 * @protected
10222		 * @type {Boolean}
10223		 */
10224		this._visible = null;
10225
10226		/**
10227		 * All event handlers.
10228		 * @protected
10229		 * @type {Object}
10230		 */
10231		this._handlers = {
10232			'initialized.owl.carousel': $.proxy(function(e) {
10233				if (e.namespace && this._core.settings.autoRefresh) {
10234					this.watch();
10235				}
10236			}, this)
10237		};
10238
10239		// set default options
10240		this._core.options = $.extend({}, AutoRefresh.Defaults, this._core.options);
10241
10242		// register event handlers
10243		this._core.$element.on(this._handlers);
10244	};
10245
10246	/**
10247	 * Default options.
10248	 * @public
10249	 */
10250	AutoRefresh.Defaults = {
10251		autoRefresh: true,
10252		autoRefreshInterval: 500
10253	};
10254
10255	/**
10256	 * Watches the element.
10257	 */
10258	AutoRefresh.prototype.watch = function() {
10259		if (this._interval) {
10260			return;
10261		}
10262
10263		this._visible = this._core.isVisible();
10264		this._interval = window.setInterval($.proxy(this.refresh, this), this._core.settings.autoRefreshInterval);
10265	};
10266
10267	/**
10268	 * Refreshes the element.
10269	 */
10270	AutoRefresh.prototype.refresh = function() {
10271		if (this._core.isVisible() === this._visible) {
10272			return;
10273		}
10274
10275		this._visible = !this._visible;
10276
10277		this._core.$element.toggleClass('owl-hidden', !this._visible);
10278
10279		this._visible && (this._core.invalidate('width') && this._core.refresh());
10280	};
10281
10282	/**
10283	 * Destroys the plugin.
10284	 */
10285	AutoRefresh.prototype.destroy = function() {
10286		var handler, property;
10287
10288		window.clearInterval(this._interval);
10289
10290		for (handler in this._handlers) {
10291			this._core.$element.off(handler, this._handlers[handler]);
10292		}
10293		for (property in Object.getOwnPropertyNames(this)) {
10294			typeof this[property] != 'function' && (this[property] = null);
10295		}
10296	};
10297
10298	$.fn.owlCarousel.Constructor.Plugins.AutoRefresh = AutoRefresh;
10299
10300})(window.Zepto || window.jQuery, window, document);
10301
10302/**
10303 * Lazy Plugin
10304 * @version 2.3.4
10305 * @author Bartosz Wojciechowski
10306 * @author David Deutsch
10307 * @license The MIT License (MIT)
10308 */
10309;(function($, window, document, undefined) {
10310
10311	/**
10312	 * Creates the lazy plugin.
10313	 * @class The Lazy Plugin
10314	 * @param {Owl} carousel - The Owl Carousel
10315	 */
10316	var Lazy = function(carousel) {
10317
10318		/**
10319		 * Reference to the core.
10320		 * @protected
10321		 * @type {Owl}
10322		 */
10323		this._core = carousel;
10324
10325		/**
10326		 * Already loaded items.
10327		 * @protected
10328		 * @type {Array.<jQuery>}
10329		 */
10330		this._loaded = [];
10331
10332		/**
10333		 * Event handlers.
10334		 * @protected
10335		 * @type {Object}
10336		 */
10337		this._handlers = {
10338			'initialized.owl.carousel change.owl.carousel resized.owl.carousel': $.proxy(function(e) {
10339				if (!e.namespace) {
10340					return;
10341				}
10342
10343				if (!this._core.settings || !this._core.settings.lazyLoad) {
10344					return;
10345				}
10346
10347				if ((e.property && e.property.name == 'position') || e.type == 'initialized') {
10348					var settings = this._core.settings,
10349						n = (settings.center && Math.ceil(settings.items / 2) || settings.items),
10350						i = ((settings.center && n * -1) || 0),
10351						position = (e.property && e.property.value !== undefined ? e.property.value : this._core.current()) + i,
10352						clones = this._core.clones().length,
10353						load = $.proxy(function(i, v) { this.load(v) }, this);
10354					//TODO: Need documentation for this new option
10355					if (settings.lazyLoadEager > 0) {
10356						n += settings.lazyLoadEager;
10357						// If the carousel is looping also preload images that are to the "left"
10358						if (settings.loop) {
10359              position -= settings.lazyLoadEager;
10360              n++;
10361            }
10362					}
10363
10364					while (i++ < n) {
10365						this.load(clones / 2 + this._core.relative(position));
10366						clones && $.each(this._core.clones(this._core.relative(position)), load);
10367						position++;
10368					}
10369				}
10370			}, this)
10371		};
10372
10373		// set the default options
10374		this._core.options = $.extend({}, Lazy.Defaults, this._core.options);
10375
10376		// register event handler
10377		this._core.$element.on(this._handlers);
10378	};
10379
10380	/**
10381	 * Default options.
10382	 * @public
10383	 */
10384	Lazy.Defaults = {
10385		lazyLoad: false,
10386		lazyLoadEager: 0
10387	};
10388
10389	/**
10390	 * Loads all resources of an item at the specified position.
10391	 * @param {Number} position - The absolute position of the item.
10392	 * @protected
10393	 */
10394	Lazy.prototype.load = function(position) {
10395		var $item = this._core.$stage.children().eq(position),
10396			$elements = $item && $item.find('.owl-lazy');
10397
10398		if (!$elements || $.inArray($item.get(0), this._loaded) > -1) {
10399			return;
10400		}
10401
10402		$elements.each($.proxy(function(index, element) {
10403			var $element = $(element), image,
10404                url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src') || $element.attr('data-srcset');
10405
10406			this._core.trigger('load', { element: $element, url: url }, 'lazy');
10407
10408			if ($element.is('img')) {
10409				$element.one('load.owl.lazy', $.proxy(function() {
10410					$element.css('opacity', 1);
10411					this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
10412				}, this)).attr('src', url);
10413            } else if ($element.is('source')) {
10414                $element.one('load.owl.lazy', $.proxy(function() {
10415                    this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
10416                }, this)).attr('srcset', url);
10417			} else {
10418				image = new Image();
10419				image.onload = $.proxy(function() {
10420					$element.css({
10421						'background-image': 'url("' + url + '")',
10422						'opacity': '1'
10423					});
10424					this._core.trigger('loaded', { element: $element, url: url }, 'lazy');
10425				}, this);
10426				image.src = url;
10427			}
10428		}, this));
10429
10430		this._loaded.push($item.get(0));
10431	};
10432
10433	/**
10434	 * Destroys the plugin.
10435	 * @public
10436	 */
10437	Lazy.prototype.destroy = function() {
10438		var handler, property;
10439
10440		for (handler in this.handlers) {
10441			this._core.$element.off(handler, this.handlers[handler]);
10442		}
10443		for (property in Object.getOwnPropertyNames(this)) {
10444			typeof this[property] != 'function' && (this[property] = null);
10445		}
10446	};
10447
10448	$.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy;
10449
10450})(window.Zepto || window.jQuery, window, document);
10451
10452/**
10453 * AutoHeight Plugin
10454 * @version 2.3.4
10455 * @author Bartosz Wojciechowski
10456 * @author David Deutsch
10457 * @license The MIT License (MIT)
10458 */
10459;(function($, window, document, undefined) {
10460
10461	/**
10462	 * Creates the auto height plugin.
10463	 * @class The Auto Height Plugin
10464	 * @param {Owl} carousel - The Owl Carousel
10465	 */
10466	var AutoHeight = function(carousel) {
10467		/**
10468		 * Reference to the core.
10469		 * @protected
10470		 * @type {Owl}
10471		 */
10472		this._core = carousel;
10473
10474		this._previousHeight = null;
10475
10476		/**
10477		 * All event handlers.
10478		 * @protected
10479		 * @type {Object}
10480		 */
10481		this._handlers = {
10482			'initialized.owl.carousel refreshed.owl.carousel': $.proxy(function(e) {
10483				if (e.namespace && this._core.settings.autoHeight) {
10484					this.update();
10485				}
10486			}, this),
10487			'changed.owl.carousel': $.proxy(function(e) {
10488				if (e.namespace && this._core.settings.autoHeight && e.property.name === 'position'){
10489					this.update();
10490				}
10491			}, this),
10492			'loaded.owl.lazy': $.proxy(function(e) {
10493				if (e.namespace && this._core.settings.autoHeight
10494					&& e.element.closest('.' + this._core.settings.itemClass).index() === this._core.current()) {
10495					this.update();
10496				}
10497			}, this)
10498		};
10499
10500		// set default options
10501		this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options);
10502
10503		// register event handlers
10504		this._core.$element.on(this._handlers);
10505		this._intervalId = null;
10506		var refThis = this;
10507
10508		// These changes have been taken from a PR by gavrochelegnou proposed in #1575
10509		// and have been made compatible with the latest jQuery version
10510		$(window).on('load', function() {
10511			if (refThis._core.settings.autoHeight) {
10512				refThis.update();
10513			}
10514		});
10515
10516		// Autoresize the height of the carousel when window is resized
10517		// When carousel has images, the height is dependent on the width
10518		// and should also change on resize
10519		$(window).resize(function() {
10520			if (refThis._core.settings.autoHeight) {
10521				if (refThis._intervalId != null) {
10522					clearTimeout(refThis._intervalId);
10523				}
10524
10525				refThis._intervalId = setTimeout(function() {
10526					refThis.update();
10527				}, 250);
10528			}
10529		});
10530
10531	};
10532
10533	/**
10534	 * Default options.
10535	 * @public
10536	 */
10537	AutoHeight.Defaults = {
10538		autoHeight: false,
10539		autoHeightClass: 'owl-height'
10540	};
10541
10542	/**
10543	 * Updates the view.
10544	 */
10545	AutoHeight.prototype.update = function() {
10546		var start = this._core._current,
10547			end = start + this._core.settings.items,
10548			lazyLoadEnabled = this._core.settings.lazyLoad,
10549			visible = this._core.$stage.children().toArray().slice(start, end),
10550			heights = [],
10551			maxheight = 0;
10552
10553		$.each(visible, function(index, item) {
10554			heights.push($(item).height());
10555		});
10556
10557		maxheight = Math.max.apply(null, heights);
10558
10559		if (maxheight <= 1 && lazyLoadEnabled && this._previousHeight) {
10560			maxheight = this._previousHeight;
10561		}
10562
10563		this._previousHeight = maxheight;
10564
10565		this._core.$stage.parent()
10566			.height(maxheight)
10567			.addClass(this._core.settings.autoHeightClass);
10568	};
10569
10570	AutoHeight.prototype.destroy = function() {
10571		var handler, property;
10572
10573		for (handler in this._handlers) {
10574			this._core.$element.off(handler, this._handlers[handler]);
10575		}
10576		for (property in Object.getOwnPropertyNames(this)) {
10577			typeof this[property] !== 'function' && (this[property] = null);
10578		}
10579	};
10580
10581	$.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight;
10582
10583})(window.Zepto || window.jQuery, window, document);
10584
10585/**
10586 * Video Plugin
10587 * @version 2.3.4
10588 * @author Bartosz Wojciechowski
10589 * @author David Deutsch
10590 * @license The MIT License (MIT)
10591 */
10592;(function($, window, document, undefined) {
10593
10594	/**
10595	 * Creates the video plugin.
10596	 * @class The Video Plugin
10597	 * @param {Owl} carousel - The Owl Carousel
vendor: 5,347 bytes, lines 10598-10795
10598	 */
10599	var Video = function(carousel) {
10600		/**
10601		 * Reference to the core.
10602		 * @protected
10603		 * @type {Owl}
10604		 */
10605		this._core = carousel;
10606
10607		/**
10608		 * Cache all video URLs.
10609		 * @protected
10610		 * @type {Object}
10611		 */
10612		this._videos = {};
10613
10614		/**
10615		 * Current playing item.
10616		 * @protected
10617		 * @type {jQuery}
10618		 */
10619		this._playing = null;
10620
10621		/**
10622		 * All event handlers.
10623		 * @todo The cloned content removale is too late
10624		 * @protected
10625		 * @type {Object}
10626		 */
10627		this._handlers = {
10628			'initialized.owl.carousel': $.proxy(function(e) {
10629				if (e.namespace) {
10630					this._core.register({ type: 'state', name: 'playing', tags: [ 'interacting' ] });
10631				}
10632			}, this),
10633			'resize.owl.carousel': $.proxy(function(e) {
10634				if (e.namespace && this._core.settings.video && this.isInFullScreen()) {
10635					e.preventDefault();
10636				}
10637			}, this),
10638			'refreshed.owl.carousel': $.proxy(function(e) {
10639				if (e.namespace && this._core.is('resizing')) {
10640					this._core.$stage.find('.cloned .owl-video-frame').remove();
10641				}
10642			}, this),
10643			'changed.owl.carousel': $.proxy(function(e) {
10644				if (e.namespace && e.property.name === 'position' && this._playing) {
10645					this.stop();
10646				}
10647			}, this),
10648			'prepared.owl.carousel': $.proxy(function(e) {
10649				if (!e.namespace) {
10650					return;
10651				}
10652
10653				var $element = $(e.content).find('.owl-video');
10654
10655				if ($element.length) {
10656					$element.css('display', 'none');
10657					this.fetch($element, $(e.content));
10658				}
10659			}, this)
10660		};
10661
10662		// set default options
10663		this._core.options = $.extend({}, Video.Defaults, this._core.options);
10664
10665		// register event handlers
10666		this._core.$element.on(this._handlers);
10667
10668		this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) {
10669			this.play(e);
10670		}, this));
10671	};
10672
10673	/**
10674	 * Default options.
10675	 * @public
10676	 */
10677	Video.Defaults = {
10678		video: false,
10679		videoHeight: false,
10680		videoWidth: false
10681	};
10682
10683	/**
10684	 * Gets the video ID and the type (YouTube/Vimeo/vzaar only).
10685	 * @protected
10686	 * @param {jQuery} target - The target containing the video data.
10687	 * @param {jQuery} item - The item containing the video.
10688	 */
10689	Video.prototype.fetch = function(target, item) {
10690			var type = (function() {
10691					if (target.attr('data-vimeo-id')) {
10692						return 'vimeo';
10693					} else if (target.attr('data-vzaar-id')) {
10694						return 'vzaar'
10695					} else {
10696						return 'youtube';
10697					}
10698				})(),
10699				id = target.attr('data-vimeo-id') || target.attr('data-youtube-id') || target.attr('data-vzaar-id'),
10700				width = target.attr('data-width') || this._core.settings.videoWidth,
10701				height = target.attr('data-height') || this._core.settings.videoHeight,
10702				url = target.attr('href');
10703
10704		if (url) {
10705
10706			/*
10707					Parses the id's out of the following urls (and probably more):
10708					https://www.youtube.com/watch?v=:id
10709					https://youtu.be/:id
10710					https://vimeo.com/:id
10711					https://vimeo.com/channels/:channel/:id
10712					https://vimeo.com/groups/:group/videos/:id
10713					https://app.vzaar.com/videos/:id
10714
10715					Visual example: https://regexper.com/#(http%3A%7Chttps%3A%7C)%5C%2F%5C%2F(player.%7Cwww.%7Capp.)%3F(vimeo%5C.com%7Cyoutu(be%5C.com%7C%5C.be%7Cbe%5C.googleapis%5C.com)%7Cvzaar%5C.com)%5C%2F(video%5C%2F%7Cvideos%5C%2F%7Cembed%5C%2F%7Cchannels%5C%2F.%2B%5C%2F%7Cgroups%5C%2F.%2B%5C%2F%7Cwatch%5C%3Fv%3D%7Cv%5C%2F)%3F(%5BA-Za-z0-9._%25-%5D*)(%5C%26%5CS%2B)%3F
10716			*/
10717
10718			id = url.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com|be\-nocookie\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/);
10719
10720			if (id[3].indexOf('youtu') > -1) {
10721				type = 'youtube';
10722			} else if (id[3].indexOf('vimeo') > -1) {
10723				type = 'vimeo';
10724			} else if (id[3].indexOf('vzaar') > -1) {
10725				type = 'vzaar';
10726			} else {
10727				throw new Error('Video URL not supported.');
10728			}
10729			id = id[6];
10730		} else {
10731			throw new Error('Missing video URL.');
10732		}
10733
10734		this._videos[url] = {
10735			type: type,
10736			id: id,
10737			width: width,
10738			height: height
10739		};
10740
10741		item.attr('data-video', url);
10742
10743		this.thumbnail(target, this._videos[url]);
10744	};
10745
10746	/**
10747	 * Creates video thumbnail.
10748	 * @protected
10749	 * @param {jQuery} target - The target containing the video data.
10750	 * @param {Object} info - The video info object.
10751	 * @see `fetch`
10752	 */
10753	Video.prototype.thumbnail = function(target, video) {
10754		var tnLink,
10755			icon,
10756			path,
10757			dimensions = video.width && video.height ? 'width:' + video.width + 'px;height:' + video.height + 'px;' : '',
10758			customTn = target.find('img'),
10759			srcType = 'src',
10760			lazyClass = '',
10761			settings = this._core.settings,
10762			create = function(path) {
10763				icon = '<div class="owl-video-play-icon"></div>';
10764
10765				if (settings.lazyLoad) {
10766					tnLink = $('<div/>',{
10767						"class": 'owl-video-tn ' + lazyClass,
10768						"srcType": path
10769					});
10770				} else {
10771					tnLink = $( '<div/>', {
10772						"class": "owl-video-tn",
10773						"style": 'opacity:1;background-image:url(' + path + ')'
10774					});
10775				}
10776				target.after(tnLink);
10777				target.after(icon);
10778			};
10779
10780		// wrap video content into owl-video-wrapper div
10781		target.wrap( $( '<div/>', {
10782			"class": "owl-video-wrapper",
10783			"style": dimensions
10784		}));
10785
10786		if (this._core.settings.lazyLoad) {
10787			srcType = 'data-src';
10788			lazyClass = 'owl-lazy';
10789		}
10790
10791		// custom thumbnail
10792		if (customTn.length) {
10793			create(customTn.attr(srcType));
10794			customTn.remove();
10795			return false;
vendor: 15,908 bytes, lines 10796-11433
10796		}
10797
10798		if (video.type === 'youtube') {
10799			path = "//img.youtube.com/vi/" + video.id + "/hqdefault.jpg";
10800			create(path);
10801		} else if (video.type === 'vimeo') {
10802			$.ajax({
10803				type: 'GET',
10804				url: '//vimeo.com/api/v2/video/' + video.id + '.json',
10805				jsonp: 'callback',
10806				dataType: 'jsonp',
10807				success: function(data) {
10808					path = data[0].thumbnail_large;
10809					create(path);
10810				}
10811			});
10812		} else if (video.type === 'vzaar') {
10813			$.ajax({
10814				type: 'GET',
10815				url: '//vzaar.com/api/videos/' + video.id + '.json',
10816				jsonp: 'callback',
10817				dataType: 'jsonp',
10818				success: function(data) {
10819					path = data.framegrab_url;
10820					create(path);
10821				}
10822			});
10823		}
10824	};
10825
10826	/**
10827	 * Stops the current video.
10828	 * @public
10829	 */
10830	Video.prototype.stop = function() {
10831		this._core.trigger('stop', null, 'video');
10832		this._playing.find('.owl-video-frame').remove();
10833		this._playing.removeClass('owl-video-playing');
10834		this._playing = null;
10835		this._core.leave('playing');
10836		this._core.trigger('stopped', null, 'video');
10837	};
10838
10839	/**
10840	 * Starts the current video.
10841	 * @public
10842	 * @param {Event} event - The event arguments.
10843	 */
10844	Video.prototype.play = function(event) {
10845		var target = $(event.target),
10846			item = target.closest('.' + this._core.settings.itemClass),
10847			video = this._videos[item.attr('data-video')],
10848			width = video.width || '100%',
10849			height = video.height || this._core.$stage.height(),
10850			html,
10851			iframe;
10852
10853		if (this._playing) {
10854			return;
10855		}
10856
10857		this._core.enter('playing');
10858		this._core.trigger('play', null, 'video');
10859
10860		item = this._core.items(this._core.relative(item.index()));
10861
10862		this._core.reset(item.index());
10863
10864		html = $( '<iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>' );
10865		html.attr( 'height', height );
10866		html.attr( 'width', width );
10867		if (video.type === 'youtube') {
10868			html.attr( 'src', '//www.youtube.com/embed/' + video.id + '?autoplay=1&rel=0&v=' + video.id );
10869		} else if (video.type === 'vimeo') {
10870			html.attr( 'src', '//player.vimeo.com/video/' + video.id + '?autoplay=1' );
10871		} else if (video.type === 'vzaar') {
10872			html.attr( 'src', '//view.vzaar.com/' + video.id + '/player?autoplay=true' );
10873		}
10874
10875		iframe = $(html).wrap( '<div class="owl-video-frame" />' ).insertAfter(item.find('.owl-video'));
10876
10877		this._playing = item.addClass('owl-video-playing');
10878	};
10879
10880	/**
10881	 * Checks whether an video is currently in full screen mode or not.
10882	 * @todo Bad style because looks like a readonly method but changes members.
10883	 * @protected
10884	 * @returns {Boolean}
10885	 */
10886	Video.prototype.isInFullScreen = function() {
10887		var element = document.fullscreenElement || document.mozFullScreenElement ||
10888				document.webkitFullscreenElement;
10889
10890		return element && $(element).parent().hasClass('owl-video-frame');
10891	};
10892
10893	/**
10894	 * Destroys the plugin.
10895	 */
10896	Video.prototype.destroy = function() {
10897		var handler, property;
10898
10899		this._core.$element.off('click.owl.video');
10900
10901		for (handler in this._handlers) {
10902			this._core.$element.off(handler, this._handlers[handler]);
10903		}
10904		for (property in Object.getOwnPropertyNames(this)) {
10905			typeof this[property] != 'function' && (this[property] = null);
10906		}
10907	};
10908
10909	$.fn.owlCarousel.Constructor.Plugins.Video = Video;
10910
10911})(window.Zepto || window.jQuery, window, document);
10912
10913/**
10914 * Animate Plugin
10915 * @version 2.3.4
10916 * @author Bartosz Wojciechowski
10917 * @author David Deutsch
10918 * @license The MIT License (MIT)
10919 */
10920;(function($, window, document, undefined) {
10921
10922	/**
10923	 * Creates the animate plugin.
10924	 * @class The Navigation Plugin
10925	 * @param {Owl} scope - The Owl Carousel
10926	 */
10927	var Animate = function(scope) {
10928		this.core = scope;
10929		this.core.options = $.extend({}, Animate.Defaults, this.core.options);
10930		this.swapping = true;
10931		this.previous = undefined;
10932		this.next = undefined;
10933
10934		this.handlers = {
10935			'change.owl.carousel': $.proxy(function(e) {
10936				if (e.namespace && e.property.name == 'position') {
10937					this.previous = this.core.current();
10938					this.next = e.property.value;
10939				}
10940			}, this),
10941			'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) {
10942				if (e.namespace) {
10943					this.swapping = e.type == 'translated';
10944				}
10945			}, this),
10946			'translate.owl.carousel': $.proxy(function(e) {
10947				if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) {
10948					this.swap();
10949				}
10950			}, this)
10951		};
10952
10953		this.core.$element.on(this.handlers);
10954	};
10955
10956	/**
10957	 * Default options.
10958	 * @public
10959	 */
10960	Animate.Defaults = {
10961		animateOut: false,
10962		animateIn: false
10963	};
10964
10965	/**
10966	 * Toggles the animation classes whenever an translations starts.
10967	 * @protected
10968	 * @returns {Boolean|undefined}
10969	 */
10970	Animate.prototype.swap = function() {
10971
10972		if (this.core.settings.items !== 1) {
10973			return;
10974		}
10975
10976		if (!$.support.animation || !$.support.transition) {
10977			return;
10978		}
10979
10980		this.core.speed(0);
10981
10982		var left,
10983			clear = $.proxy(this.clear, this),
10984			previous = this.core.$stage.children().eq(this.previous),
10985			next = this.core.$stage.children().eq(this.next),
10986			incoming = this.core.settings.animateIn,
10987			outgoing = this.core.settings.animateOut;
10988
10989		if (this.core.current() === this.previous) {
10990			return;
10991		}
10992
10993		if (outgoing) {
10994			left = this.core.coordinates(this.previous) - this.core.coordinates(this.next);
10995			previous.one($.support.animation.end, clear)
10996				.css( { 'left': left + 'px' } )
10997				.addClass('animated owl-animated-out')
10998				.addClass(outgoing);
10999		}
11000
11001		if (incoming) {
11002			next.one($.support.animation.end, clear)
11003				.addClass('animated owl-animated-in')
11004				.addClass(incoming);
11005		}
11006	};
11007
11008	Animate.prototype.clear = function(e) {
11009		$(e.target).css( { 'left': '' } )
11010			.removeClass('animated owl-animated-out owl-animated-in')
11011			.removeClass(this.core.settings.animateIn)
11012			.removeClass(this.core.settings.animateOut);
11013		this.core.onTransitionEnd();
11014	};
11015
11016	/**
11017	 * Destroys the plugin.
11018	 * @public
11019	 */
11020	Animate.prototype.destroy = function() {
11021		var handler, property;
11022
11023		for (handler in this.handlers) {
11024			this.core.$element.off(handler, this.handlers[handler]);
11025		}
11026		for (property in Object.getOwnPropertyNames(this)) {
11027			typeof this[property] != 'function' && (this[property] = null);
11028		}
11029	};
11030
11031	$.fn.owlCarousel.Constructor.Plugins.Animate = Animate;
11032
11033})(window.Zepto || window.jQuery, window, document);
11034
11035/**
11036 * Autoplay Plugin
11037 * @version 2.3.4
11038 * @author Bartosz Wojciechowski
11039 * @author Artus Kolanowski
11040 * @author David Deutsch
11041 * @author Tom De Caluwé
11042 * @license The MIT License (MIT)
11043 */
11044;(function($, window, document, undefined) {
11045
11046	/**
11047	 * Creates the autoplay plugin.
11048	 * @class The Autoplay Plugin
11049	 * @param {Owl} scope - The Owl Carousel
11050	 */
11051	var Autoplay = function(carousel) {
11052		/**
11053		 * Reference to the core.
11054		 * @protected
11055		 * @type {Owl}
11056		 */
11057		this._core = carousel;
11058
11059		/**
11060		 * The autoplay timeout id.
11061		 * @type {Number}
11062		 */
11063		this._call = null;
11064
11065		/**
11066		 * Depending on the state of the plugin, this variable contains either
11067		 * the start time of the timer or the current timer value if it's
11068		 * paused. Since we start in a paused state we initialize the timer
11069		 * value.
11070		 * @type {Number}
11071		 */
11072		this._time = 0;
11073
11074		/**
11075		 * Stores the timeout currently used.
11076		 * @type {Number}
11077		 */
11078		this._timeout = 0;
11079
11080		/**
11081		 * Indicates whenever the autoplay is paused.
11082		 * @type {Boolean}
11083		 */
11084		this._paused = true;
11085
11086		/**
11087		 * All event handlers.
11088		 * @protected
11089		 * @type {Object}
11090		 */
11091		this._handlers = {
11092			'changed.owl.carousel': $.proxy(function(e) {
11093				if (e.namespace && e.property.name === 'settings') {
11094					if (this._core.settings.autoplay) {
11095						this.play();
11096					} else {
11097						this.stop();
11098					}
11099				} else if (e.namespace && e.property.name === 'position' && this._paused) {
11100					// Reset the timer. This code is triggered when the position
11101					// of the carousel was changed through user interaction.
11102					this._time = 0;
11103				}
11104			}, this),
11105			'initialized.owl.carousel': $.proxy(function(e) {
11106				if (e.namespace && this._core.settings.autoplay) {
11107					this.play();
11108				}
11109			}, this),
11110			'play.owl.autoplay': $.proxy(function(e, t, s) {
11111				if (e.namespace) {
11112					this.play(t, s);
11113				}
11114			}, this),
11115			'stop.owl.autoplay': $.proxy(function(e) {
11116				if (e.namespace) {
11117					this.stop();
11118				}
11119			}, this),
11120			'mouseover.owl.autoplay': $.proxy(function() {
11121				if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
11122					this.pause();
11123				}
11124			}, this),
11125			'mouseleave.owl.autoplay': $.proxy(function() {
11126				if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
11127					this.play();
11128				}
11129			}, this),
11130			'touchstart.owl.core': $.proxy(function() {
11131				if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) {
11132					this.pause();
11133				}
11134			}, this),
11135			'touchend.owl.core': $.proxy(function() {
11136				if (this._core.settings.autoplayHoverPause) {
11137					this.play();
11138				}
11139			}, this)
11140		};
11141
11142		// register event handlers
11143		this._core.$element.on(this._handlers);
11144
11145		// set default options
11146		this._core.options = $.extend({}, Autoplay.Defaults, this._core.options);
11147	};
11148
11149	/**
11150	 * Default options.
11151	 * @public
11152	 */
11153	Autoplay.Defaults = {
11154		autoplay: false,
11155		autoplayTimeout: 5000,
11156		autoplayHoverPause: false,
11157		autoplaySpeed: false
11158	};
11159
11160	/**
11161	 * Transition to the next slide and set a timeout for the next transition.
11162	 * @private
11163	 * @param {Number} [speed] - The animation speed for the animations.
11164	 */
11165	Autoplay.prototype._next = function(speed) {
11166		this._call = window.setTimeout(
11167			$.proxy(this._next, this, speed),
11168			this._timeout * (Math.round(this.read() / this._timeout) + 1) - this.read()
11169		);
11170
11171		if (this._core.is('interacting') || document.hidden) {
11172			return;
11173		}
11174		this._core.next(speed || this._core.settings.autoplaySpeed);
11175	}
11176
11177	/**
11178	 * Reads the current timer value when the timer is playing.
11179	 * @public
11180	 */
11181	Autoplay.prototype.read = function() {
11182		return new Date().getTime() - this._time;
11183	};
11184
11185	/**
11186	 * Starts the autoplay.
11187	 * @public
11188	 * @param {Number} [timeout] - The interval before the next animation starts.
11189	 * @param {Number} [speed] - The animation speed for the animations.
11190	 */
11191	Autoplay.prototype.play = function(timeout, speed) {
11192		var elapsed;
11193
11194		if (!this._core.is('rotating')) {
11195			this._core.enter('rotating');
11196		}
11197
11198		timeout = timeout || this._core.settings.autoplayTimeout;
11199
11200		// Calculate the elapsed time since the last transition. If the carousel
11201		// wasn't playing this calculation will yield zero.
11202		elapsed = Math.min(this._time % (this._timeout || timeout), timeout);
11203
11204		if (this._paused) {
11205			// Start the clock.
11206			this._time = this.read();
11207			this._paused = false;
11208		} else {
11209			// Clear the active timeout to allow replacement.
11210			window.clearTimeout(this._call);
11211		}
11212
11213		// Adjust the origin of the timer to match the new timeout value.
11214		this._time += this.read() % timeout - elapsed;
11215
11216		this._timeout = timeout;
11217		this._call = window.setTimeout($.proxy(this._next, this, speed), timeout - elapsed);
11218	};
11219
11220	/**
11221	 * Stops the autoplay.
11222	 * @public
11223	 */
11224	Autoplay.prototype.stop = function() {
11225		if (this._core.is('rotating')) {
11226			// Reset the clock.
11227			this._time = 0;
11228			this._paused = true;
11229
11230			window.clearTimeout(this._call);
11231			this._core.leave('rotating');
11232		}
11233	};
11234
11235	/**
11236	 * Pauses the autoplay.
11237	 * @public
11238	 */
11239	Autoplay.prototype.pause = function() {
11240		if (this._core.is('rotating') && !this._paused) {
11241			// Pause the clock.
11242			this._time = this.read();
11243			this._paused = true;
11244
11245			window.clearTimeout(this._call);
11246		}
11247	};
11248
11249	/**
11250	 * Destroys the plugin.
11251	 */
11252	Autoplay.prototype.destroy = function() {
11253		var handler, property;
11254
11255		this.stop();
11256
11257		for (handler in this._handlers) {
11258			this._core.$element.off(handler, this._handlers[handler]);
11259		}
11260		for (property in Object.getOwnPropertyNames(this)) {
11261			typeof this[property] != 'function' && (this[property] = null);
11262		}
11263	};
11264
11265	$.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay;
11266
11267})(window.Zepto || window.jQuery, window, document);
11268
11269/**
11270 * Navigation Plugin
11271 * @version 2.3.4
11272 * @author Artus Kolanowski
11273 * @author David Deutsch
11274 * @license The MIT License (MIT)
11275 */
11276;(function($, window, document, undefined) {
11277	'use strict';
11278
11279	/**
11280	 * Creates the navigation plugin.
11281	 * @class The Navigation Plugin
11282	 * @param {Owl} carousel - The Owl Carousel.
11283	 */
11284	var Navigation = function(carousel) {
11285		/**
11286		 * Reference to the core.
11287		 * @protected
11288		 * @type {Owl}
11289		 */
11290		this._core = carousel;
11291
11292		/**
11293		 * Indicates whether the plugin is initialized or not.
11294		 * @protected
11295		 * @type {Boolean}
11296		 */
11297		this._initialized = false;
11298
11299		/**
11300		 * The current paging indexes.
11301		 * @protected
11302		 * @type {Array}
11303		 */
11304		this._pages = [];
11305
11306		/**
11307		 * All DOM elements of the user interface.
11308		 * @protected
11309		 * @type {Object}
11310		 */
11311		this._controls = {};
11312
11313		/**
11314		 * Markup for an indicator.
11315		 * @protected
11316		 * @type {Array.<String>}
11317		 */
11318		this._templates = [];
11319
11320		/**
11321		 * The carousel element.
11322		 * @type {jQuery}
11323		 */
11324		this.$element = this._core.$element;
11325
11326		/**
11327		 * Overridden methods of the carousel.
11328		 * @protected
11329		 * @type {Object}
11330		 */
11331		this._overrides = {
11332			next: this._core.next,
11333			prev: this._core.prev,
11334			to: this._core.to
11335		};
11336
11337		/**
11338		 * All event handlers.
11339		 * @protected
11340		 * @type {Object}
11341		 */
11342		this._handlers = {
11343			'prepared.owl.carousel': $.proxy(function(e) {
11344				if (e.namespace && this._core.settings.dotsData) {
11345					this._templates.push('<div class="' + this._core.settings.dotClass + '">' +
11346						$(e.content).find('[data-dot]').addBack('[data-dot]').attr('data-dot') + '</div>');
11347				}
11348			}, this),
11349			'added.owl.carousel': $.proxy(function(e) {
11350				if (e.namespace && this._core.settings.dotsData) {
11351					this._templates.splice(e.position, 0, this._templates.pop());
11352				}
11353			}, this),
11354			'remove.owl.carousel': $.proxy(function(e) {
11355				if (e.namespace && this._core.settings.dotsData) {
11356					this._templates.splice(e.position, 1);
11357				}
11358			}, this),
11359			'changed.owl.carousel': $.proxy(function(e) {
11360				if (e.namespace && e.property.name == 'position') {
11361					this.draw();
11362				}
11363			}, this),
11364			'initialized.owl.carousel': $.proxy(function(e) {
11365				if (e.namespace && !this._initialized) {
11366					this._core.trigger('initialize', null, 'navigation');
11367					this.initialize();
11368					this.update();
11369					this.draw();
11370					this._initialized = true;
11371					this._core.trigger('initialized', null, 'navigation');
11372				}
11373			}, this),
11374			'refreshed.owl.carousel': $.proxy(function(e) {
11375				if (e.namespace && this._initialized) {
11376					this._core.trigger('refresh', null, 'navigation');
11377					this.update();
11378					this.draw();
11379					this._core.trigger('refreshed', null, 'navigation');
11380				}
11381			}, this)
11382		};
11383
11384		// set default options
11385		this._core.options = $.extend({}, Navigation.Defaults, this._core.options);
11386
11387		// register event handlers
11388		this.$element.on(this._handlers);
11389	};
11390
11391	/**
11392	 * Default options.
11393	 * @public
11394	 * @todo Rename `slideBy` to `navBy`
11395	 */
11396	Navigation.Defaults = {
11397		nav: false,
11398		navText: [
11399			'<span aria-label="' + 'Previous' + '">&#x2039;</span>',
11400			'<span aria-label="' + 'Next' + '">&#x203a;</span>'
11401		],
11402		navSpeed: false,
11403		navElement: 'button type="button" role="presentation"',
11404		navContainer: false,
11405		navContainerClass: 'owl-nav',
11406		navClass: [
11407			'owl-prev',
11408			'owl-next'
11409		],
11410		slideBy: 1,
11411		dotClass: 'owl-dot',
11412		dotsClass: 'owl-dots',
11413		dots: true,
11414		dotsEach: false,
11415		dotsData: false,
11416		dotsSpeed: false,
11417		dotsContainer: false
11418	};
11419
11420	/**
11421	 * Initializes the layout of the plugin and extends the carousel.
11422	 * @protected
11423	 */
11424	Navigation.prototype.initialize = function() {
11425		var override,
11426			settings = this._core.settings;
11427
11428		// create DOM structure for relative navigation
11429		this._controls.$relative = (settings.navContainer ? $(settings.navContainer)
11430			: $('<div>').addClass(settings.navContainerClass).appendTo(this.$element)).addClass('disabled');
11431
11432		this._controls.$previous = $('<' + settings.navElement + '>')
11433			.addClass(settings.navClass[0])
vendor: 4,756 bytes, lines 11434-11595
11434			.html(settings.navText[0])
11435			.prependTo(this._controls.$relative)
11436			.on('click', $.proxy(function(e) {
11437				this.prev(settings.navSpeed);
11438			}, this));
11439		this._controls.$next = $('<' + settings.navElement + '>')
11440			.addClass(settings.navClass[1])
11441			.html(settings.navText[1])
11442			.appendTo(this._controls.$relative)
11443			.on('click', $.proxy(function(e) {
11444				this.next(settings.navSpeed);
11445			}, this));
11446
11447		// create DOM structure for absolute navigation
11448		if (!settings.dotsData) {
11449			this._templates = [ $('<button role="button">')
11450				.addClass(settings.dotClass)
11451				.append($('<span>'))
11452				.prop('outerHTML') ];
11453		}
11454
11455		this._controls.$absolute = (settings.dotsContainer ? $(settings.dotsContainer)
11456			: $('<div>').addClass(settings.dotsClass).appendTo(this.$element)).addClass('disabled');
11457
11458		this._controls.$absolute.on('click', 'button', $.proxy(function(e) {
11459			var index = $(e.target).parent().is(this._controls.$absolute)
11460				? $(e.target).index() : $(e.target).parent().index();
11461
11462			e.preventDefault();
11463
11464			this.to(index, settings.dotsSpeed);
11465		}, this));
11466
11467		/*$el.on('focusin', function() {
11468			$(document).off(".carousel");
11469
11470			$(document).on('keydown.carousel', function(e) {
11471				if(e.keyCode == 37) {
11472					$el.trigger('prev.owl')
11473				}
11474				if(e.keyCode == 39) {
11475					$el.trigger('next.owl')
11476				}
11477			});
11478		});*/
11479
11480		// override public methods of the carousel
11481		for (override in this._overrides) {
11482			this._core[override] = $.proxy(this[override], this);
11483		}
11484	};
11485
11486	/**
11487	 * Destroys the plugin.
11488	 * @protected
11489	 */
11490	Navigation.prototype.destroy = function() {
11491		var handler, control, property, override, settings;
11492		settings = this._core.settings;
11493
11494		for (handler in this._handlers) {
11495			this.$element.off(handler, this._handlers[handler]);
11496		}
11497		for (control in this._controls) {
11498			if (control === '$relative' && settings.navContainer) {
11499				this._controls[control].html('');
11500			} else {
11501				this._controls[control].remove();
11502			}
11503		}
11504		for (override in this.overides) {
11505			this._core[override] = this._overrides[override];
11506		}
11507		for (property in Object.getOwnPropertyNames(this)) {
11508			typeof this[property] != 'function' && (this[property] = null);
11509		}
11510	};
11511
11512	/**
11513	 * Updates the internal state.
11514	 * @protected
11515	 */
11516	Navigation.prototype.update = function() {
11517		var i, j, k,
11518			lower = this._core.clones().length / 2,
11519			upper = lower + this._core.items().length,
11520			maximum = this._core.maximum(true),
11521			settings = this._core.settings,
11522			size = settings.center || settings.autoWidth || settings.dotsData
11523				? 1 : settings.dotsEach || settings.items;
11524
11525		if (settings.slideBy !== 'page') {
11526			settings.slideBy = Math.min(settings.slideBy, settings.items);
11527		}
11528
11529		if (settings.dots || settings.slideBy == 'page') {
11530			this._pages = [];
11531
11532			for (i = lower, j = 0, k = 0; i < upper; i++) {
11533				if (j >= size || j === 0) {
11534					this._pages.push({
11535						start: Math.min(maximum, i - lower),
11536						end: i - lower + size - 1
11537					});
11538					if (Math.min(maximum, i - lower) === maximum) {
11539						break;
11540					}
11541					j = 0, ++k;
11542				}
11543				j += this._core.mergers(this._core.relative(i));
11544			}
11545		}
11546	};
11547
11548	/**
11549	 * Draws the user interface.
11550	 * @todo The option `dotsData` wont work.
11551	 * @protected
11552	 */
11553	Navigation.prototype.draw = function() {
11554		var difference,
11555			settings = this._core.settings,
11556			disabled = this._core.items().length <= settings.items,
11557			index = this._core.relative(this._core.current()),
11558			loop = settings.loop || settings.rewind;
11559
11560		this._controls.$relative.toggleClass('disabled', !settings.nav || disabled);
11561
11562		if (settings.nav) {
11563			this._controls.$previous.toggleClass('disabled', !loop && index <= this._core.minimum(true));
11564			this._controls.$next.toggleClass('disabled', !loop && index >= this._core.maximum(true));
11565		}
11566
11567		this._controls.$absolute.toggleClass('disabled', !settings.dots || disabled);
11568
11569		if (settings.dots) {
11570			difference = this._pages.length - this._controls.$absolute.children().length;
11571
11572			if (settings.dotsData && difference !== 0) {
11573				this._controls.$absolute.html(this._templates.join(''));
11574			} else if (difference > 0) {
11575				this._controls.$absolute.append(new Array(difference + 1).join(this._templates[0]));
11576			} else if (difference < 0) {
11577				this._controls.$absolute.children().slice(difference).remove();
11578			}
11579
11580			this._controls.$absolute.find('.active').removeClass('active');
11581			this._controls.$absolute.children().eq($.inArray(this.current(), this._pages)).addClass('active');
11582		}
11583	};
11584
11585	/**
11586	 * Extends event data.
11587	 * @protected
11588	 * @param {Event} event - The event object which gets thrown.
11589	 */
11590	Navigation.prototype.onTrigger = function(event) {
11591		var settings = this._core.settings;
11592
11593		event.page = {
11594			index: $.inArray(this.current(), this._pages),
11595			count: this._pages.length,
vendor: 7,284 bytes, lines 11596-11881
11596			size: settings && (settings.center || settings.autoWidth || settings.dotsData
11597				? 1 : settings.dotsEach || settings.items)
11598		};
11599	};
11600
11601	/**
11602	 * Gets the current page position of the carousel.
11603	 * @protected
11604	 * @returns {Number}
11605	 */
11606	Navigation.prototype.current = function() {
11607		var current = this._core.relative(this._core.current());
11608		return $.grep(this._pages, $.proxy(function(page, index) {
11609			return page.start <= current && page.end >= current;
11610		}, this)).pop();
11611	};
11612
11613	/**
11614	 * Gets the current succesor/predecessor position.
11615	 * @protected
11616	 * @returns {Number}
11617	 */
11618	Navigation.prototype.getPosition = function(successor) {
11619		var position, length,
11620			settings = this._core.settings;
11621
11622		if (settings.slideBy == 'page') {
11623			position = $.inArray(this.current(), this._pages);
11624			length = this._pages.length;
11625			successor ? ++position : --position;
11626			position = this._pages[((position % length) + length) % length].start;
11627		} else {
11628			position = this._core.relative(this._core.current());
11629			length = this._core.items().length;
11630			successor ? position += settings.slideBy : position -= settings.slideBy;
11631		}
11632
11633		return position;
11634	};
11635
11636	/**
11637	 * Slides to the next item or page.
11638	 * @public
11639	 * @param {Number} [speed=false] - The time in milliseconds for the transition.
11640	 */
11641	Navigation.prototype.next = function(speed) {
11642		$.proxy(this._overrides.to, this._core)(this.getPosition(true), speed);
11643	};
11644
11645	/**
11646	 * Slides to the previous item or page.
11647	 * @public
11648	 * @param {Number} [speed=false] - The time in milliseconds for the transition.
11649	 */
11650	Navigation.prototype.prev = function(speed) {
11651		$.proxy(this._overrides.to, this._core)(this.getPosition(false), speed);
11652	};
11653
11654	/**
11655	 * Slides to the specified item or page.
11656	 * @public
11657	 * @param {Number} position - The position of the item or page.
11658	 * @param {Number} [speed] - The time in milliseconds for the transition.
11659	 * @param {Boolean} [standard=false] - Whether to use the standard behaviour or not.
11660	 */
11661	Navigation.prototype.to = function(position, speed, standard) {
11662		var length;
11663
11664		if (!standard && this._pages.length) {
11665			length = this._pages.length;
11666			$.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed);
11667		} else {
11668			$.proxy(this._overrides.to, this._core)(position, speed);
11669		}
11670	};
11671
11672	$.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation;
11673
11674})(window.Zepto || window.jQuery, window, document);
11675
11676/**
11677 * Hash Plugin
11678 * @version 2.3.4
11679 * @author Artus Kolanowski
11680 * @author David Deutsch
11681 * @license The MIT License (MIT)
11682 */
11683;(function($, window, document, undefined) {
11684	'use strict';
11685
11686	/**
11687	 * Creates the hash plugin.
11688	 * @class The Hash Plugin
11689	 * @param {Owl} carousel - The Owl Carousel
11690	 */
11691	var Hash = function(carousel) {
11692		/**
11693		 * Reference to the core.
11694		 * @protected
11695		 * @type {Owl}
11696		 */
11697		this._core = carousel;
11698
11699		/**
11700		 * Hash index for the items.
11701		 * @protected
11702		 * @type {Object}
11703		 */
11704		this._hashes = {};
11705
11706		/**
11707		 * The carousel element.
11708		 * @type {jQuery}
11709		 */
11710		this.$element = this._core.$element;
11711
11712		/**
11713		 * All event handlers.
11714		 * @protected
11715		 * @type {Object}
11716		 */
11717		this._handlers = {
11718			'initialized.owl.carousel': $.proxy(function(e) {
11719				if (e.namespace && this._core.settings.startPosition === 'URLHash') {
11720					$(window).trigger('hashchange.owl.navigation');
11721				}
11722			}, this),
11723			'prepared.owl.carousel': $.proxy(function(e) {
11724				if (e.namespace) {
11725					var hash = $(e.content).find('[data-hash]').addBack('[data-hash]').attr('data-hash');
11726
11727					if (!hash) {
11728						return;
11729					}
11730
11731					this._hashes[hash] = e.content;
11732				}
11733			}, this),
11734			'changed.owl.carousel': $.proxy(function(e) {
11735				if (e.namespace && e.property.name === 'position') {
11736					var current = this._core.items(this._core.relative(this._core.current())),
11737						hash = $.map(this._hashes, function(item, hash) {
11738							return item === current ? hash : null;
11739						}).join();
11740
11741					if (!hash || window.location.hash.slice(1) === hash) {
11742						return;
11743					}
11744
11745					window.location.hash = hash;
11746				}
11747			}, this)
11748		};
11749
11750		// set default options
11751		this._core.options = $.extend({}, Hash.Defaults, this._core.options);
11752
11753		// register the event handlers
11754		this.$element.on(this._handlers);
11755
11756		// register event listener for hash navigation
11757		$(window).on('hashchange.owl.navigation', $.proxy(function(e) {
11758			var hash = window.location.hash.substring(1),
11759				items = this._core.$stage.children(),
11760				position = this._hashes[hash] && items.index(this._hashes[hash]);
11761
11762			if (position === undefined || position === this._core.current()) {
11763				return;
11764			}
11765
11766			this._core.to(this._core.relative(position), false, true);
11767		}, this));
11768	};
11769
11770	/**
11771	 * Default options.
11772	 * @public
11773	 */
11774	Hash.Defaults = {
11775		URLhashListener: false
11776	};
11777
11778	/**
11779	 * Destroys the plugin.
11780	 * @public
11781	 */
11782	Hash.prototype.destroy = function() {
11783		var handler, property;
11784
11785		$(window).off('hashchange.owl.navigation');
11786
11787		for (handler in this._handlers) {
11788			this._core.$element.off(handler, this._handlers[handler]);
11789		}
11790		for (property in Object.getOwnPropertyNames(this)) {
11791			typeof this[property] != 'function' && (this[property] = null);
11792		}
11793	};
11794
11795	$.fn.owlCarousel.Constructor.Plugins.Hash = Hash;
11796
11797})(window.Zepto || window.jQuery, window, document);
11798
11799/**
11800 * Support Plugin
11801 *
11802 * @version 2.3.4
11803 * @author Vivid Planet Software GmbH
11804 * @author Artus Kolanowski
11805 * @author David Deutsch
11806 * @license The MIT License (MIT)
11807 */
11808;(function($, window, document, undefined) {
11809
11810	var style = $('<support>').get(0).style,
11811		prefixes = 'Webkit Moz O ms'.split(' '),
11812		events = {
11813			transition: {
11814				end: {
11815					WebkitTransition: 'webkitTransitionEnd',
11816					MozTransition: 'transitionend',
11817					OTransition: 'oTransitionEnd',
11818					transition: 'transitionend'
11819				}
11820			},
11821			animation: {
11822				end: {
11823					WebkitAnimation: 'webkitAnimationEnd',
11824					MozAnimation: 'animationend',
11825					OAnimation: 'oAnimationEnd',
11826					animation: 'animationend'
11827				}
11828			}
11829		},
11830		tests = {
11831			csstransforms: function() {
11832				return !!test('transform');
11833			},
11834			csstransforms3d: function() {
11835				return !!test('perspective');
11836			},
11837			csstransitions: function() {
11838				return !!test('transition');
11839			},
11840			cssanimations: function() {
11841				return !!test('animation');
11842			}
11843		};
11844
11845	function test(property, prefixed) {
11846		var result = false,
11847			upper = property.charAt(0).toUpperCase() + property.slice(1);
11848
11849		$.each((property + ' ' + prefixes.join(upper + ' ') + upper).split(' '), function(i, property) {
11850			if (style[property] !== undefined) {
11851				result = prefixed ? property : true;
11852				return false;
11853			}
11854		});
11855
11856		return result;
11857	}
11858
11859	function prefixed(property) {
11860		return test(property, true);
11861	}
11862
11863	if (tests.csstransitions()) {
11864		/* jshint -W053 */
11865		$.support.transition = new String(prefixed('transition'))
11866		$.support.transition.end = events.transition.end[ $.support.transition ];
11867	}
11868
11869	if (tests.cssanimations()) {
11870		/* jshint -W053 */
11871		$.support.animation = new String(prefixed('animation'))
11872		$.support.animation.end = events.animation.end[ $.support.animation ];
11873	}
11874
11875	if (tests.csstransforms()) {
11876		/* jshint -W053 */
11877		$.support.transform = new String(prefixed('transform'));
11878		$.support.transform3d = tests.csstransforms3d();
11879	}
11880
11881})(window.Zepto || window.jQuery, window, document);
11882
11883/* End */
11884;
11885; /* Start:"a:4:{s:4:"full";s:72:"/local/templates/aspro_max_local/vendor/js/moment.min.js?162019756934436";s:6:"source";s:56:"/local/templates/aspro_max_local/vendor/js/moment.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
11886//! moment.js
11887//! version : 2.10.3
11888//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
11889//! license : MIT
11890//! momentjs.com
11891!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return Dc.apply(null,arguments)}function b(a){Dc=a}function c(a){return"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function f(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function g(a,b){for(var c in b)f(b,c)&&(a[c]=b[c]);return f(b,"toString")&&(a.toString=b.toString),f(b,"valueOf")&&(a.valueOf=b.valueOf),a}function h(a,b,c,d){return za(a,b,c,d,!0).utc()}function i(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function j(a){return null==a._pf&&(a._pf=i()),a._pf}function k(a){if(null==a._isValid){var b=j(a);a._isValid=!isNaN(a._d.getTime())&&b.overflow<0&&!b.empty&&!b.invalidMonth&&!b.nullInput&&!b.invalidFormat&&!b.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===b.charsLeftOver&&0===b.unusedTokens.length&&void 0===b.bigHour)}return a._isValid}function l(a){var b=h(0/0);return null!=a?g(j(b),a):j(b).userInvalidated=!0,b}function m(a,b){var c,d,e;if("undefined"!=typeof b._isAMomentObject&&(a._isAMomentObject=b._isAMomentObject),"undefined"!=typeof b._i&&(a._i=b._i),"undefined"!=typeof b._f&&(a._f=b._f),"undefined"!=typeof b._l&&(a._l=b._l),"undefined"!=typeof b._strict&&(a._strict=b._strict),"undefined"!=typeof b._tzm&&(a._tzm=b._tzm),"undefined"!=typeof b._isUTC&&(a._isUTC=b._isUTC),"undefined"!=typeof b._offset&&(a._offset=b._offset),"undefined"!=typeof b._pf&&(a._pf=j(b)),"undefined"!=typeof b._locale&&(a._locale=b._locale),Fc.length>0)for(c in Fc)d=Fc[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function n(b){m(this,b),this._d=new Date(+b._d),Gc===!1&&(Gc=!0,a.updateOffset(this),Gc=!1)}function o(a){return a instanceof n||null!=a&&null!=a._isAMomentObject}function p(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function q(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&p(a[d])!==p(b[d]))&&g++;return g+f}function r(){}function s(a){return a?a.toLowerCase().replace("_","-"):a}function t(a){for(var b,c,d,e,f=0;f<a.length;){for(e=s(a[f]).split("-"),b=e.length,c=s(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=u(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&q(e,c,!0)>=b-1)break;b--}f++}return null}function u(a){var b=null;if(!Hc[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=Ec._abbr,require("./locale/"+a),v(b)}catch(c){}return Hc[a]}function v(a,b){var c;return a&&(c="undefined"==typeof b?x(a):w(a,b),c&&(Ec=c)),Ec._abbr}function w(a,b){return null!==b?(b.abbr=a,Hc[a]||(Hc[a]=new r),Hc[a].set(b),v(a),Hc[a]):(delete Hc[a],null)}function x(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return Ec;if(!c(a)){if(b=u(a))return b;a=[a]}return t(a)}function y(a,b){var c=a.toLowerCase();Ic[c]=Ic[c+"s"]=Ic[b]=a}function z(a){return"string"==typeof a?Ic[a]||Ic[a.toLowerCase()]:void 0}function A(a){var b,c,d={};for(c in a)f(a,c)&&(b=z(c),b&&(d[b]=a[c]));return d}function B(b,c){return function(d){return null!=d?(D(this,b,d),a.updateOffset(this,c),this):C(this,b)}}function C(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function D(a,b,c){return a._d["set"+(a._isUTC?"UTC":"")+b](c)}function E(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=z(a),"function"==typeof this[a])return this[a](b);return this}function F(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.length<b;)d="0"+d;return(e?c?"+":"":"-")+d}function G(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Mc[a]=e),b&&(Mc[b[0]]=function(){return F(e.apply(this,arguments),b[1],b[2])}),c&&(Mc[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function H(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function I(a){var b,c,d=a.match(Jc);for(b=0,c=d.length;c>b;b++)Mc[d[b]]?d[b]=Mc[d[b]]:d[b]=H(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function J(a,b){return a.isValid()?(b=K(b,a.localeData()),Lc[b]||(Lc[b]=I(b)),Lc[b](a)):a.localeData().invalidDate()}function K(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Kc.lastIndex=0;d>=0&&Kc.test(a);)a=a.replace(Kc,c),Kc.lastIndex=0,d-=1;return a}function L(a,b,c){_c[a]="function"==typeof b?b:function(a){return a&&c?c:b}}function M(a,b){return f(_c,a)?_c[a](b._strict,b._locale):new RegExp(N(a))}function N(a){return a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function O(a,b){var c,d=b;
11891for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=p(a)}),c=0;c<a.length;c++)ad[a[c]]=d}function P(a,b){O(a,function(a,c,d,e){d._w=d._w||{},b(a,d._w,d,e)})}function Q(a,b,c){null!=b&&f(ad,a)&&ad[a](b,c._a,c,a)}function R(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function S(a){return this._months[a.month()]}function T(a){return this._monthsShort[a.month()]}function U(a,b,c){var d,e,f;for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;12>d;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function V(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),R(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function W(b){return null!=b?(V(this,b),a.updateOffset(this,!0),this):C(this,"Month")}function X(){return R(this.year(),this.month())}function Y(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[cd]<0||c[cd]>11?cd:c[dd]<1||c[dd]>R(c[bd],c[cd])?dd:c[ed]<0||c[ed]>24||24===c[ed]&&(0!==c[fd]||0!==c[gd]||0!==c[hd])?ed:c[fd]<0||c[fd]>59?fd:c[gd]<0||c[gd]>59?gd:c[hd]<0||c[hd]>999?hd:-1,j(a)._overflowDayOfYear&&(bd>b||b>dd)&&(b=dd),j(a).overflow=b),a}function Z(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function $(a,b){var c=!0,d=a+"\n"+(new Error).stack;return g(function(){return c&&(Z(d),c=!1),b.apply(this,arguments)},b)}function _(a,b){kd[a]||(Z(b),kd[a]=!0)}function aa(a){var b,c,d=a._i,e=ld.exec(d);if(e){for(j(a).iso=!0,b=0,c=md.length;c>b;b++)if(md[b][1].exec(d)){a._f=md[b][0]+(e[6]||" ");break}for(b=0,c=nd.length;c>b;b++)if(nd[b][1].exec(d)){a._f+=nd[b][0];break}d.match(Yc)&&(a._f+="Z"),ta(a)}else a._isValid=!1}function ba(b){var c=od.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(aa(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function ca(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function da(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function ea(a){return fa(a)?366:365}function fa(a){return a%4===0&&a%100!==0||a%400===0}function ga(){return fa(this.year())}function ha(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=Aa(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ia(a){return ha(a,this._week.dow,this._week.doy).week}function ja(){return this._week.dow}function ka(){return this._week.doy}function la(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function ma(a){var b=ha(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function na(a,b,c,d,e){var f,g,h=da(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:ea(a-1)+g}}function oa(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function pa(a,b,c){return null!=a?a:null!=b?b:c}function qa(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function ra(a){var b,c,d,e,f=[];if(!a._d){for(d=qa(a),a._w&&null==a._a[dd]&&null==a._a[cd]&&sa(a),a._dayOfYear&&(e=pa(a._a[bd],d[bd]),a._dayOfYear>ea(e)&&(j(a)._overflowDayOfYear=!0),c=da(e,0,a._dayOfYear),a._a[cd]=c.getUTCMonth(),a._a[dd]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[ed]&&0===a._a[fd]&&0===a._a[gd]&&0===a._a[hd]&&(a._nextDay=!0,a._a[ed]=0),a._d=(a._useUTC?da:ca).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[ed]=24)}}function sa(a){var b,c,d,e,f,g,h;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=pa(b.GG,a._a[bd],ha(Aa(),1,4).year),d=pa(b.W,1),e=pa(b.E,1)):(f=a._locale._week.dow,g=
11891a._locale._week.doy,c=pa(b.gg,a._a[bd],ha(Aa(),f,g).year),d=pa(b.w,1),null!=b.d?(e=b.d,f>e&&++d):e=null!=b.e?b.e+f:f),h=na(c,d,e,g,f),a._a[bd]=h.year,a._dayOfYear=h.dayOfYear}function ta(b){if(b._f===a.ISO_8601)return void aa(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=K(b._f,b._locale).match(Jc)||[],c=0;c<e.length;c++)f=e[c],d=(h.match(M(f,b))||[])[0],d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),Mc[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),Q(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[ed]<=12&&b._a[ed]>0&&(j(b).bigHour=void 0),b._a[ed]=ua(b._locale,b._a[ed],b._meridiem),ra(b),Y(b)}function ua(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function va(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(0/0));for(e=0;e<a._f.length;e++)f=0,b=m({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._f=a._f[e],ta(b),k(b)&&(f+=j(b).charsLeftOver,f+=10*j(b).unusedTokens.length,j(b).score=f,(null==d||d>f)&&(d=f,c=b));g(a,c||b)}function wa(a){if(!a._d){var b=A(a._i);a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],ra(a)}}function xa(a){var b,e=a._i,f=a._f;return a._locale=a._locale||x(a._l),null===e||void 0===f&&""===e?l({nullInput:!0}):("string"==typeof e&&(a._i=e=a._locale.preparse(e)),o(e)?new n(Y(e)):(c(f)?va(a):f?ta(a):d(e)?a._d=e:ya(a),b=new n(Y(a)),b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b))}function ya(b){var f=b._i;void 0===f?b._d=new Date:d(f)?b._d=new Date(+f):"string"==typeof f?ba(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),ra(b)):"object"==typeof f?wa(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function za(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,xa(f)}function Aa(a,b,c,d){return za(a,b,c,d,!1)}function Ba(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Aa();for(d=b[0],e=1;e<b.length;++e)b[e][a](d)&&(d=b[e]);return d}function Ca(){var a=[].slice.call(arguments,0);return Ba("isBefore",a)}function Da(){var a=[].slice.call(arguments,0);return Ba("isAfter",a)}function Ea(a){var b=A(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;this._milliseconds=+k+1e3*j+6e4*i+36e5*h,this._days=+g+7*f,this._months=+e+3*d+12*c,this._data={},this._locale=x(),this._bubble()}function Fa(a){return a instanceof Ea}function Ga(a,b){G(a,0,0,function(){var a=this.utcOffset(),c="+";return 0>a&&(a=-a,c="-"),c+F(~~(a/60),2)+b+F(~~a%60,2)})}function Ha(a){var b=(a||"").match(Yc)||[],c=b[b.length-1]||[],d=(c+"").match(td)||["-",0,0],e=+(60*d[1])+p(d[2]);return"+"===d[0]?e:-e}function Ia(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(o(b)||d(b)?+b:+Aa(b))-+e,e._d.setTime(+e._d+f),a.updateOffset(e,!1),e):Aa(b).local();return c._isUTC?Aa(b).zone(c._offset||0):Aa(b).local()}function Ja(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ka(b,c){var d,e=this._offset||0;return null!=b?("string"==typeof b&&(b=Ha(b)),Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ja(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?$a(this,Va(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ja(this)}function La(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Ma(a){return this.utcOffset(0,a)}function Na(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ja(this),"m")),this}function Oa(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ha(this._i)),this}function Pa(a){return a=a?Aa(a).utcOffset():0,(this.utcOffset()-a)%60===0}function Qa(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ra(){if(this._a){var a=this._isUTC?h(this._a):Aa(this._a);return this.isValid()&&q(this._a,a.toArray())>0}return!1}function Sa(){return!this._isUTC}function Ta(){return this._isUTC}function Ua(){return this._isUTC&&0===this._offset}function Va(a,b){var c,d,e,g=a,h=null;return Fa(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=ud.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:p(h[dd])*c,h:p(h[ed])*c,m:p(h[fd])*c,s:p(h[gd])*c,ms:p(h[hd])*c}):(h=vd.exec(a))?(c="-"===h[1]?-1:1,g={y:Wa(h[2],c),M:Wa(h[3],c),d:Wa(h[4],c),h:Wa(h[5],c),m:Wa(h[6],c),s:Wa(h[7],c),w:Wa(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=Ya(Aa(g.from),Aa(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Ea(g),Fa(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function Wa(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function Xa(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Ya(a,b){var c;return b=Ia(b,a),a.isBefore(b)?c=Xa(a,b):(c=Xa(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function Za(a,b){return function(c,d){var e,f;
11891return null===d||isNaN(+d)||(_(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Va(c,d),$a(this,e,a),this}}function $a(b,c,d,e){var f=c._milliseconds,g=c._days,h=c._months;e=null==e?!0:e,f&&b._d.setTime(+b._d+f*d),g&&D(b,"Date",C(b,"Date")+g*d),h&&V(b,C(b,"Month")+h*d),e&&a.updateOffset(b,g||h)}function _a(a){var b=a||Aa(),c=Ia(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this,Aa(b)))}function ab(){return new n(this)}function bb(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Aa(a),+this>+a):(c=o(a)?+a:+Aa(a),c<+this.clone().startOf(b))}function cb(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Aa(a),+a>+this):(c=o(a)?+a:+Aa(a),+this.clone().endOf(b)<c)}function db(a,b,c){return this.isAfter(a,c)&&this.isBefore(b,c)}function eb(a,b){var c;return b=z(b||"millisecond"),"millisecond"===b?(a=o(a)?a:Aa(a),+this===+a):(c=+Aa(a),+this.clone().startOf(b)<=c&&c<=+this.clone().endOf(b))}function fb(a){return 0>a?Math.ceil(a):Math.floor(a)}function gb(a,b,c){var d,e,f=Ia(a,this),g=6e4*(f.utcOffset()-this.utcOffset());return b=z(b),"year"===b||"month"===b||"quarter"===b?(e=hb(this,f),"quarter"===b?e/=3:"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:fb(e)}function hb(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function ib(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function jb(){var a=this.clone().utc();return 0<a.year()&&a.year()<=9999?"function"==typeof Date.prototype.toISOString?this.toDate().toISOString():J(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):J(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function kb(b){var c=J(this,b||a.defaultFormat);return this.localeData().postformat(c)}function lb(a,b){return this.isValid()?Va({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function mb(a){return this.from(Aa(),a)}function nb(a,b){return this.isValid()?Va({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function ob(a){return this.to(Aa(),a)}function pb(a){var b;return void 0===a?this._locale._abbr:(b=x(a),null!=b&&(this._locale=b),this)}function qb(){return this._locale}function rb(a){switch(a=z(a)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a&&this.weekday(0),"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this}function sb(a){return a=z(a),void 0===a||"millisecond"===a?this:this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms")}function tb(){return+this._d-6e4*(this._offset||0)}function ub(){return Math.floor(+this/1e3)}function vb(){return this._offset?new Date(+this):this._d}function wb(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function xb(){return k(this)}function yb(){return g({},j(this))}function zb(){return j(this).overflow}function Ab(a,b){G(0,[a,a.length],0,b)}function Bb(a,b,c){return ha(Aa([a,11,31+b-c]),b,c).week}function Cb(a){var b=ha(this,this.localeData()._week.dow,this.localeData()._week.doy).year;return null==a?b:this.add(a-b,"y")}function Db(a){var b=ha(this,1,4).year;return null==a?b:this.add(a-b,"y")}function Eb(){return Bb(this.year(),1,4)}function Fb(){var a=this.localeData()._week;return Bb(this.year(),a.dow,a.doy)}function Gb(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}function Hb(a,b){if("string"==typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeof a)return null}else a=parseInt(a,10);return a}function Ib(a){return this._weekdays[a.day()]}function Jb(a){return this._weekdaysShort[a.day()]}function Kb(a){return this._weekdaysMin[a.day()]}
11891function Lb(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=Aa([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b}function Mb(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Hb(a,this.localeData()),this.add(a-b,"d")):b}function Nb(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Ob(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)}function Pb(a,b){G(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Qb(a,b){return b._meridiemParse}function Rb(a){return"p"===(a+"").toLowerCase().charAt(0)}function Sb(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Tb(a){G(0,[a,3],0,"millisecond")}function Ub(){return this._isUTC?"UTC":""}function Vb(){return this._isUTC?"Coordinated Universal Time":""}function Wb(a){return Aa(1e3*a)}function Xb(){return Aa.apply(null,arguments).parseZone()}function Yb(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.call(b,c):d}function Zb(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b}function $b(){return this._invalidDate}function _b(a){return this._ordinal.replace("%d",a)}function ac(a){return a}function bc(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)}function cc(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)}function dc(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function ec(a,b,c,d){var e=x(),f=h().set(d,b);return e[c](f,a)}function fc(a,b,c,d,e){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return ec(a,b,c,e);var f,g=[];for(f=0;d>f;f++)g[f]=ec(a,f,c,e);return g}function gc(a,b){return fc(a,b,"months",12,"month")}function hc(a,b){return fc(a,b,"monthsShort",12,"month")}function ic(a,b){return fc(a,b,"weekdays",7,"day")}function jc(a,b){return fc(a,b,"weekdaysShort",7,"day")}function kc(a,b){return fc(a,b,"weekdaysMin",7,"day")}function lc(){var a=this._data;return this._milliseconds=Rd(this._milliseconds),this._days=Rd(this._days),this._months=Rd(this._months),a.milliseconds=Rd(a.milliseconds),a.seconds=Rd(a.seconds),a.minutes=Rd(a.minutes),a.hours=Rd(a.hours),a.months=Rd(a.months),a.years=Rd(a.years),this}function mc(a,b,c,d){var e=Va(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function nc(a,b){return mc(this,a,b,1)}function oc(a,b){return mc(this,a,b,-1)}function pc(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;return g.milliseconds=d%1e3,a=fb(d/1e3),g.seconds=a%60,b=fb(a/60),g.minutes=b%60,c=fb(b/60),g.hours=c%24,e+=fb(c/24),h=fb(qc(e)),e-=fb(rc(h)),f+=fb(e/30),e%=30,h+=fb(f/12),f%=12,g.days=e,g.months=f,g.years=h,this}function qc(a){return 400*a/146097}function rc(a){return 146097*a/400}function sc(a){var b,c,d=this._milliseconds;if(a=z(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+12*qc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(rc(this._months/12)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function tc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*p(this._months/12)}function uc(a){return function(){return this.as(a)}}function vc(a){return a=z(a),this[a+"s"]()}function wc(a){return function(){return this._data[a]}}function xc(){return fb(this.days()/7)}function yc(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function zc(a,b,c){var d=Va(a).abs(),e=fe(d.as("s")),f=fe(d.as("m")),g=fe(d.as("h")),h=fe(d.as("d")),i=fe(d.as("M")),j=fe(d.as("y")),k=e<ge.s&&["s",e]||1===f&&["m"]||f<ge.m&&["mm",f]||1===g&&["h"]||g<ge.h&&["hh",g]||1===h&&["d"]||h<ge.d&&["dd",h]||1===i&&["M"]||i<ge.M&&["MM",i]||1===j&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,yc.apply(null,k)}function Ac(a,b){return void 0===ge[a]?!1:void 0===b?ge[a]:(ge[a]=b,!0)}function Bc(a){var b=this.localeData(),c=zc(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function Cc(){var a=he(this.years()),b=he(this.months()),c=he(this.days()),d=he(this.hours()),e=he(this.minutes()),f=he(this.seconds()+this.milliseconds()/1e3),g=this.asSeconds();return g?(0>g?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}var Dc,Ec,Fc=a.momentProperties=[],Gc=!1,Hc={},Ic={},Jc=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}
11891|x|X|zz?|ZZ?|.)/g,Kc=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Lc={},Mc={},Nc=/\d/,Oc=/\d\d/,Pc=/\d{3}/,Qc=/\d{4}/,Rc=/[+-]?\d{6}/,Sc=/\d\d?/,Tc=/\d{1,3}/,Uc=/\d{1,4}/,Vc=/[+-]?\d{1,6}/,Wc=/\d+/,Xc=/[+-]?\d+/,Yc=/Z|[+-]\d\d:?\d\d/gi,Zc=/[+-]?\d+(\.\d{1,3})?/,$c=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,_c={},ad={},bd=0,cd=1,dd=2,ed=3,fd=4,gd=5,hd=6;G("M",["MM",2],"Mo",function(){return this.month()+1}),G("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),G("MMMM",0,0,function(a){return this.localeData().months(this,a)}),y("month","M"),L("M",Sc),L("MM",Sc,Oc),L("MMM",$c),L("MMMM",$c),O(["M","MM"],function(a,b){b[cd]=p(a)-1}),O(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[cd]=e:j(c).invalidMonth=a});var id="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),jd="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),kd={};a.suppressDeprecationWarnings=!1;var ld=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,md=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],nd=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],od=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=$("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),G(0,["YY",2],0,function(){return this.year()%100}),G(0,["YYYY",4],0,"year"),G(0,["YYYYY",5],0,"year"),G(0,["YYYYYY",6,!0],0,"year"),y("year","y"),L("Y",Xc),L("YY",Sc,Oc),L("YYYY",Uc,Qc),L("YYYYY",Vc,Rc),L("YYYYYY",Vc,Rc),O(["YYYY","YYYYY","YYYYYY"],bd),O("YY",function(b,c){c[bd]=a.parseTwoDigitYear(b)}),a.parseTwoDigitYear=function(a){return p(a)+(p(a)>68?1900:2e3)};var pd=B("FullYear",!1);G("w",["ww",2],"wo","week"),G("W",["WW",2],"Wo","isoWeek"),y("week","w"),y("isoWeek","W"),L("w",Sc),L("ww",Sc,Oc),L("W",Sc),L("WW",Sc,Oc),P(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=p(a)});var qd={dow:0,doy:6};G("DDD",["DDDD",3],"DDDo","dayOfYear"),y("dayOfYear","DDD"),L("DDD",Tc),L("DDDD",Pc),O(["DDD","DDDD"],function(a,b,c){c._dayOfYear=p(a)}),a.ISO_8601=function(){};var rd=$("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Aa.apply(null,arguments);return this>a?this:a}),sd=$("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Aa.apply(null,arguments);return a>this?this:a});Ga("Z",":"),Ga("ZZ",""),L("Z",Yc),L("ZZ",Yc),O(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ha(a)});var td=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var ud=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,vd=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Va.fn=Ea.prototype;var wd=Za(1,"add"),xd=Za(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var yd=$("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});G(0,["gg",2],0,function(){return this.weekYear()%100}),G(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ab("gggg","weekYear"),Ab("ggggg","weekYear"),Ab("GGGG","isoWeekYear"),Ab("GGGGG","isoWeekYear"),y("weekYear","gg"),y("isoWeekYear","GG"),L("G",Xc),L("g",Xc),L("GG",Sc,Oc),L("gg",Sc,Oc),L("GGGG",Uc,Qc),L("gggg",Uc,Qc),L("GGGGG",Vc,Rc),L("ggggg",Vc,Rc),P(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=p(a)}),P(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),G("Q",0,0,"quarter"),y("quarter","Q"),L("Q",Nc),O("Q",function(a,b){b[cd]=3*(p(a)-1)}),G("D",["DD",2],"Do","date"),y("date","D"),L("D",Sc),L("DD",Sc,Oc),L("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),O(["D","DD"],dd),O("Do",function(a,b){b[dd]=p(a.match(Sc)[0],10)});var zd=B("Date",!0);G("d",0,"do","day"),G("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),G("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),G("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),G("e",0,0,"weekday"),G("E",0,0,"isoWeekday"),y("day","d"),y("weekday","e"),y("isoWeekday","E"),L("d",Sc),L("e",Sc),L("E",Sc),L("dd",$c),L("ddd",$c),L("dddd",$c),P(["dd","ddd","dddd"],function(a,b,c){var d=c._locale.weekdaysParse(a);null!=d?b.d=d:j(c).invalidWeekday=a}),P(["d","e","E"],function(a,b,c,d){b[d]=p(a)});var Ad="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Bd="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Cd="Su_Mo_Tu_We_Th_Fr_Sa".split("_");G("H",["HH",2],0,"hour"),G("h",["hh",2],0,function(){return this.hours()%12||12}),Pb("a",!0),Pb("A",!1),y("hour","h"),L("a",Qb),L("A",Qb),L("H",Sc),L("h",Sc),L("HH",Sc,Oc),L("hh",Sc,Oc),O(["H","HH"],ed),O(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),O(["h","hh"],function(a,b,c){b[ed]=p(a),j(c).bigHour=!0});var Dd=/[ap]\.?m?\.?/i,Ed=B("Hours",!0);G("m",["mm",2],0,"minute"),y("minute","m"),L("m",Sc),L("mm",Sc,Oc),O(["m","mm"],fd);var Fd=B("Minutes",!1);G("s",["ss",2],0,"second"),y("second","s"),L("s",Sc),L("ss",Sc,Oc),O(["s","ss"],gd);var Gd=B("Seconds",!1);G("S",0,0,function(){return~~(this.millisecond()/100)}),G(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Tb("SSS"),Tb("SSSS"),y("millisecond","ms"),L("S",Tc,Nc),L("SS",Tc,Oc),L("SSS",Tc,Pc),L("SSSS",Wc),O(["S","SS","SSS","SSSS"],function(a,b){b[hd]=p(1e3*("0."+a))});var Hd=B("Milliseconds",!1);G("z",0,0,"zoneAbbr"),G("zz",0,0,"zoneName");var Id=n.prototype;Id.add=wd,Id.calendar=_a,Id.clone=ab,Id.diff=gb,Id.endOf=sb,Id.format=kb,Id.from=lb,Id.fromNow=mb,Id.to=nb,Id.toNow=ob,Id.get=E,Id.invalidAt=zb,Id.isAfter=bb,Id.isBefore=cb,Id.isBetween=db,Id.isSame=eb,Id.isValid=xb,Id.lang=yd,Id.locale=pb,Id.localeData=qb,Id.max=sd,Id.min=rd,Id.parsingFlags=yb,Id.set=E,Id.startOf=rb,Id.subtract=
11891xd,Id.toArray=wb,Id.toDate=vb,Id.toISOString=jb,Id.toJSON=jb,Id.toString=ib,Id.unix=ub,Id.valueOf=tb,Id.year=pd,Id.isLeapYear=ga,Id.weekYear=Cb,Id.isoWeekYear=Db,Id.quarter=Id.quarters=Gb,Id.month=W,Id.daysInMonth=X,Id.week=Id.weeks=la,Id.isoWeek=Id.isoWeeks=ma,Id.weeksInYear=Fb,Id.isoWeeksInYear=Eb,Id.date=zd,Id.day=Id.days=Mb,Id.weekday=Nb,Id.isoWeekday=Ob,Id.dayOfYear=oa,Id.hour=Id.hours=Ed,Id.minute=Id.minutes=Fd,Id.second=Id.seconds=Gd,Id.millisecond=Id.milliseconds=Hd,Id.utcOffset=Ka,Id.utc=Ma,Id.local=Na,Id.parseZone=Oa,Id.hasAlignedHourOffset=Pa,Id.isDST=Qa,Id.isDSTShifted=Ra,Id.isLocal=Sa,Id.isUtcOffset=Ta,Id.isUtc=Ua,Id.isUTC=Ua,Id.zoneAbbr=Ub,Id.zoneName=Vb,Id.dates=$("dates accessor is deprecated. Use date instead.",zd),Id.months=$("months accessor is deprecated. Use month instead",W),Id.years=$("years accessor is deprecated. Use year instead",pd),Id.zone=$("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",La);var Jd=Id,Kd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Ld={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},Md="Invalid date",Nd="%d",Od=/\d{1,2}/,Pd={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",
11892hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Qd=r.prototype;Qd._calendar=Kd,Qd.calendar=Yb,Qd._longDateFormat=Ld,Qd.longDateFormat=Zb,Qd._invalidDate=Md,Qd.invalidDate=$b,Qd._ordinal=Nd,Qd.ordinal=_b,Qd._ordinalParse=Od,Qd.preparse=ac,Qd.postformat=ac,Qd._relativeTime=Pd,Qd.relativeTime=bc,Qd.pastFuture=cc,Qd.set=dc,Qd.months=S,Qd._months=id,Qd.monthsShort=T,Qd._monthsShort=jd,Qd.monthsParse=U,Qd.week=ia,Qd._week=qd,Qd.firstDayOfYear=ka,Qd.firstDayOfWeek=ja,Qd.weekdays=Ib,Qd._weekdays=Ad,Qd.weekdaysMin=Kb,Qd._weekdaysMin=Cd,Qd.weekdaysShort=Jb,Qd._weekdaysShort=Bd,Qd.weekdaysParse=Lb,Qd.isPM=Rb,Qd._meridiemParse=Dd,Qd.meridiem=Sb,v("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===p(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=$("moment.lang is deprecated. Use moment.locale instead.",v),a.langData=$("moment.langData is deprecated. Use moment.localeData instead.",x);var Rd=Math.abs,Sd=uc("ms"),Td=uc("s"),Ud=uc("m"),Vd=uc("h"),Wd=uc("d"),Xd=uc("w"),Yd=uc("M"),Zd=uc("y"),$d=wc("milliseconds"),_d=wc("seconds"),ae=wc("minutes"),be=wc("hours"),ce=wc("days"),de=wc("months"),ee=wc("years"),fe=Math.round,ge={s:45,m:45,h:22,d:26,M:11},he=Math.abs,ie=Ea.prototype;ie.abs=lc,ie.add=nc,ie.subtract=oc,ie.as=sc,ie.asMilliseconds=Sd,ie.asSeconds=Td,ie.asMinutes=Ud,ie.asHours=Vd,ie.asDays=Wd,ie.asWeeks=Xd,ie.asMonths=Yd,ie.asYears=Zd,ie.valueOf=tc,ie._bubble=pc,ie.get=vc,ie.milliseconds=$d,ie.seconds=_d,ie.minutes=ae,ie.hours=be,ie.days=ce,ie.weeks=xc,ie.months=de,ie.years=ee,ie.humanize=Bc,ie.toISOString=Cc,ie.toString=Cc,ie.toJSON=Cc,ie.locale=pb,ie.localeData=qb,ie.toIsoString=$("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Cc),ie.lang=yd,G("X",0,0,"unix"),G("x",0,0,"valueOf"),L("x",Xc),L("X",Zc),O("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),O("x",function(a,b,c){c._d=new Date(p(a))}),a.version="2.10.3",b(Aa),a.fn=Jd,a.min=Ca,a.max=Da,a.utc=h,a.unix=Wb,a.months=gc,a.isDate=d,a.locale=v,a.invalid=l,a.duration=Va,a.isMoment=o,a.weekdays=ic,a.parseZone=Xb,a.localeData=x,a.isDuration=Fa,a.monthsShort=hc,a.weekdaysMin=kc,a.defineLocale=w,a.weekdaysShort=jc,a.normalizeUnits=z,a.relativeTimeThreshold=Ac;var je=a;return je});
11893/* End */
11894;
11895; /* Start:"a:4:{s:4:"full";s:76:"/local/templates/aspro_max_local/vendor/js/sticky-sidebar.js?162019756925989";s:6:"source";s:60:"/local/templates/aspro_max_local/vendor/js/sticky-sidebar.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
11896(function (global, factory) {
11897	typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
11898	typeof define === 'function' && define.amd ? define(['exports'], factory) :
11899	(factory((global.StickySidebar = {})));
11900}(this, (function (exports) { 'use strict';
11901
11902var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
11903
11904
11905
11906function unwrapExports (x) {
11907	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
11908}
11909
11910function createCommonjsModule(fn, module) {
11911	return module = { exports: {} }, fn(module, module.exports), module.exports;
11912}
11913
11914var stickySidebar = createCommonjsModule(function (module, exports
11914) {
11915(function (global, factory) {
11916  if (typeof undefined === "function" && undefined.amd) {
11917    undefined(['exports'], factory);
11918  } else {
11919    factory(exports);
11920  }
11921})(commonjsGlobal, function (exports) {
11922  Object.defineProperty(exports, "__esModule", {
11923    value: true
11924  });
11925
11926  function _classCallCheck(instance, Constructor) {
11927    if (!(instance instanceof Constructor)) {
11928      throw new TypeError("Cannot call a class as a function");
11929    }
11930  }
11931
11932  var _createClass = function () {
11933    function defineProperties(target, props) {
11934      for (var i = 0; i < props.length; i++) {
11935        var descriptor = props[i];
11936        descriptor.enumerable = descriptor.enumerable || false;
11937        descriptor.configurable = true;
11938        if ("value" in descriptor) descriptor.writable = true;
11939        Object.defineProperty(target, descriptor.key, descriptor);
11940      }
11941    }
11942
11943    return function (Constructor, protoProps, staticProps) {
11944      if (protoProps) defineProperties(Constructor.prototype, protoProps);
11945      if (staticProps) defineProperties(Constructor, staticProps);
11946      return Constructor;
11947    };
11948  }();
11949
11950  /**
11951   * Sticky Sidebar JavaScript Plugin.
11952   * @version 3.3.4
11953   * @author Ahmed Bouhuolia <[email protected]>
11954   * @license The MIT License (MIT)
11955   */
11956  var StickySidebar = function () {
11957
11958    // ---------------------------------
11959    // # Define Constants
11960    // ---------------------------------
11961    //
11962    var EVENT_KEY = '.stickySidebar';
11963    var DEFAULTS = {
11964      /**
11965       * Additional top spacing of the element when it becomes sticky.
11966       * @type {Numeric|Function}
11967       */
11968      topSpacing: 0,
11969
11970      /**
11971       * Additional bottom spacing of the element when it becomes sticky.
11972       * @type {Numeric|Function}
11973       */
11974      bottomSpacing: 0,
11975
11976      /**
11977       * Container sidebar selector to know what the beginning and end of sticky element.
11978       * @type {String|False}
11979       */
11980      containerSelector: false,
11981
11982      /**
11983       * Inner wrapper selector.
11984       * @type {String}
11985       */
11986      innerWrapperSelector: '.inner-wrapper-sticky',
11987
11988      /**
11989       * The name of CSS class to apply to elements when they have become stuck.
11990       * @type {String|False}
11991       */
11992      stickyClass: 'is-affixed',
11993
11994      /**
11995       * Detect when sidebar and its container change height so re-calculate their dimensions.
11996       * @type {Boolean}
11997       */
11998      resizeSensor: true,
11999
12000      /**
12001       * The sidebar returns to its normal position if its width below this value.
12002       * @type {Numeric}
12003       */
12004      minWidth: false
12005    };
12006
12007    // ---------------------------------
12008    // # Class Definition
12009    // ---------------------------------
12010    //
12011    /**
12012     * Sticky Sidebar Class.
12013     * @public
12014     */
12015
12016    var StickySidebar = function () {
12017
12018      /**
12019       * Sticky Sidebar Constructor.
12020       * @constructor
12021       * @param {HTMLElement|String} sidebar - The sidebar element or sidebar selector.
12022       * @param {Object} options - The options of sticky sidebar.
12023       */
12024      function StickySidebar(sidebar) {
12025        var _this = this;
12026
12027        var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
12028
12029        _classCallCheck(this, StickySidebar);
12030
12031        this.options = StickySidebar.extend(DEFAULTS, options);
12032
12033        // Sidebar element query if there's no one, throw error.
12034        this.sidebar = 'string' === typeof sidebar ? document.querySelector(sidebar) : sidebar;
12035        if ('undefined' === typeof this.sidebar) throw new Error("There is no specific sidebar element.");
12036
12037        this.sidebarInner = false;
12038        this.container = this.sidebar.parentElement;
12039
12040        // Current Affix Type of sidebar element.
12041        this.affixedType = 'STATIC';
12042        this.direction = 'down';
12043        this.support = {
12044          transform: false,
12045          transform3d: false
12046        };
12047
12048        this._initialized = false;
12049        this._reStyle = false;
12050        this._breakpoint = false;
12051
12052        // Dimensions of sidebar, container and screen viewport.
12053        this.dimensions = {
12054          translateY: 0,
12055          maxTranslateY: 0,
12056          topSpacing: 0,
12057          lastTopSpacing: 0,
12058          bottomSpacing: 0,
12059          lastBottomSpacing: 0,
12060          sidebarHeight: 0,
12061          sidebarWidth: 0,
12062          containerTop: 0,
12063          containerHeight: 0,
vendor: 1,666 bytes, lines 12064-12111
12064          viewportHeight: 0,
12065          viewportTop: 0,
12066          lastViewportTop: 0
12067        };
12068
12069        // Bind event handlers for referencability.
12070        ['handleEvent'].forEach(function (method) {
12071          _this[method] = _this[method].bind(_this);
12072        });
12073
12074        // Initialize sticky sidebar for first time.
12075        this.initialize();
12076      }
12077
12078      /**
12079       * Initializes the sticky sidebar by adding inner wrapper, define its container, 
12080       * min-width breakpoint, calculating dimensions, adding helper classes and inline style.
12081       * @private
12082       */
12083
12084
12085      _createClass(StickySidebar, [{
12086        key: 'initialize',
12087        value: function initialize() {
12088          var _this2 = this;
12089
12090          this._setSupportFeatures();
12091
12092          // Get sticky sidebar inner wrapper, if not found, will create one.
12093          if (this.options.innerWrapperSelector) {
12094            this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector);
12095
12096            if (null === this.sidebarInner) this.sidebarInner = false;
12097          }
12098
12099          if (!this.sidebarInner) {
12100            var wrapper = document.createElement('div');
12101            wrapper.setAttribute('class', 'inner-wrapper-sticky');
12102            this.sidebar.appendChild(wrapper);
12103
12104            while (this.sidebar.firstChild != wrapper) {
12105              wrapper.appendChild(this.sidebar.firstChild);
12106            }this.sidebarInner = this.sidebar.querySelector('.inner-wrapper-sticky');
12107          }
12108
12109          // Container wrapper of the sidebar.
12110          if (this.options.containerSelector) {
12111            var containers = document.querySelectorAll(this.options.containerSelector);
12112            containers = Array.prototype.slice.call(containers);
12113
12114            containers.forEach(function (container, item) {
12115              if (!container.contains(_this2.sidebar)) return;
12116              _this2.container = container;
12117            });
12118
12119            if (!containers.length) throw new Error("The container does not contains on the sidebar.");
12120          }
12121
12122          // If top/bottom spacing is not function parse value to integer.
12123          if ('function' !== typeof this.options.topSpacing) this.options.topSpacing = parseInt(this.options.topSpacing) || 0;
12124
12125          if ('function' !== typeof this.options.bottomSpacing) this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0;
12126
12127          // Breakdown sticky sidebar if screen width below `options.minWidth`.
12128          this._widthBreakpoint();
12129
12130          // Calculate dimensions of sidebar, container and viewport.
12131          this.calcDimensions();
12132
12133          // Affix sidebar in proper position.
12134          this.stickyPosition();
12135
12136          // Bind all events.
12137          this.bindEvents();
12138
vendor: 4,110 bytes, lines 12139-12236
12139          // Inform other properties the sticky sidebar is initialized.
12140          this._initialized = true;
12141        }
12142      }, {
12143        key: 'bindEvents',
12144        value: function bindEvents() {
12145          window.addEventListener('resize', this, { passive: true, capture: false });
12146          window.addEventListener('scroll', this, { passive: true, capture: false });
12147
12148          this.sidebar.addEventListener('update' + EVENT_KEY, this);
12149
12150          if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
12151            new ResizeSensor(this.sidebarInner, this.handleEvent);
12152            new ResizeSensor(this.container, this.handleEvent);
12153          }
12154        }
12155      }, {
12156        key: 'handleEvent',
12157        value: function handleEvent(event) {
12158          this.updateSticky(event);
12159        }
12160      }, {
12161        key: 'calcDimensions',
12162        value: function calcDimensions() {
12163          if (this._breakpoint) return;
12164          var dims = this.dimensions;
12165
12166          // Container of sticky sidebar dimensions.
12167          dims.containerTop = StickySidebar.offsetRelative(this.container).top;
12168          dims.containerHeight = this.container.clientHeight;
12169          dims.containerBottom = dims.containerTop + dims.containerHeight;
12170
12171          // Sidebar dimensions.
12172          dims.sidebarHeight = this.sidebarInner.offsetHeight;
12173          dims.sidebarWidth = this.sidebarInner.offsetWidth;
12174
12175          // Screen viewport dimensions.
12176          dims.viewportHeight = window.innerHeight;
12177
12178          // Maximum sidebar translate Y.
12179          dims.maxTranslateY = dims.containerHeight - dims.sidebarHeight;
12180
12181          this._calcDimensionsWithScroll();
12182        }
12183      }, {
12184        key: '_calcDimensionsWithScroll',
12185        value: function _calcDimensionsWithScroll() {
12186          var dims = this.dimensions;
12187
12188          dims.sidebarLeft = StickySidebar.offsetRelative(this.sidebar).left;
12189
12190          dims.viewportTop = document.documentElement.scrollTop || document.body.scrollTop;
12191          dims.viewportBottom = dims.viewportTop + dims.viewportHeight;
12192          dims.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
12193
12194          dims.topSpacing = this.options.topSpacing;
12195          dims.bottomSpacing = this.options.bottomSpacing;
12196
12197          if ('function' === typeof dims.topSpacing) dims.topSpacing = parseInt(dims.topSpacing(this.sidebar)) || 0;
12198
12199          if ('function' === typeof dims.bottomSpacing) dims.bottomSpacing = parseInt(dims.bottomSpacing(this.sidebar)) || 0;
12200
12201          if ('VIEWPORT-TOP' === this.affixedType) {
12202            // Adjust translate Y in the case decrease top spacing value.
12203            if (dims.topSpacing < dims.lastTopSpacing) {
12204              dims.translateY += dims.lastTopSpacing - dims.topSpacing;
12205              this._reStyle = true;
12206            }
12207          } else if ('VIEWPORT-BOTTOM' === this.affixedType) {
12208            // Adjust translate Y in the case decrease bottom spacing value.
12209            if (dims.bottomSpacing < dims.lastBottomSpacing) {
12210              dims.translateY += dims.lastBottomSpacing - dims.bottomSpacing;
12211              this._reStyle = true;
12212            }
12213          }
12214
12215          dims.lastTopSpacing = dims.topSpacing;
12216          dims.lastBottomSpacing = dims.bottomSpacing;
12217        }
12218      }, {
12219        key: 'isSidebarFitsViewport',
12220        value: function isSidebarFitsViewport() {
12221          var dims = this.dimensions;
12222          var offset = this.scrollDirection === 'down' ? dims.lastBottomSpacing : dims.lastTopSpacing;
12223          return this.dimensions.sidebarHeight + offset < this.dimensions.viewportHeight;
12224        }
12225      }, {
12226        key: 'observeScrollDir',
12227        value: function observeScrollDir() {
12228          var dims = this.dimensions;
12229          if (dims.lastViewportTop === dims.viewportTop) return;
12230
12231          var furthest = 'down' === this.direction ? Math.min : Math.max;
12232
12233          // If the browser is scrolling not in the same direction.
12234          if (dims.viewportTop === furthest(dims.viewportTop, dims.lastViewportTop)) this.direction = 'down' === this.direction ? 'up' : 'down';
12235        }
12236      }, {
vendor: 5,814 bytes, lines 12237-12380
12237        key: 'getAffixType',
12238        value: function getAffixType() {
12239          this._calcDimensionsWithScroll();
12240          var dims = this.dimensions;
12241          var colliderTop = dims.viewportTop + dims.topSpacing;
12242          var affixType = this.affixedType;
12243
12244
12245          if (colliderTop <= dims.containerTop || dims.containerHeight < dims.sidebarHeight) {
12246            dims.translateY = 0;
12247            affixType = 'STATIC';
12248          } else {
12249            affixType = 'up' === this.direction ? this._getAffixTypeScrollingUp() : this._getAffixTypeScrollingDown();
12250          }
12251
12252          // Make sure the translate Y is not bigger than container height.
12253          dims.translateY = Math.max(0, dims.translateY);
12254          dims.translateY = Math.min(dims.containerHeight, dims.translateY);
12255          dims.translateY = Math.round(dims.translateY);
12256
12257          dims.lastViewportTop = dims.viewportTop;
12258          return affixType;
12259        }
12260      }, {
12261        key: '_getAffixTypeScrollingDown',
12262        value: function _getAffixTypeScrollingDown() {
12263
12264          //recalculate when height was changed
12265          if(this.dimensions.containerHeight != this.container.clientHeight){
12266            this.calcDimensions();
12267            //console.log('upd');
12268          }
12269          
12270          var dims = this.dimensions;
12271          var sidebarBottom = dims.sidebarHeight + dims.containerTop;
12272          var colliderTop = dims.viewportTop + dims.topSpacing;
12273          var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
12274          var affixType = this.affixedType;
12275
12276
12277
12278          if (this.isSidebarFitsViewport()) {
12279            if (dims.sidebarHeight + colliderTop >= dims.containerBottom) {
12280              dims.translateY = dims.containerBottom - sidebarBottom;
12281              affixType = 'CONTAINER-BOTTOM';
12282            } else if (colliderTop >= dims.containerTop) {
12283              dims.translateY = colliderTop - dims.containerTop;
12284              affixType = 'VIEWPORT-TOP';
12285            }
12286          } else {            
12287            if (dims.containerBottom <= colliderBottom) {
12288              dims.translateY = dims.containerBottom - sidebarBottom;
12289              affixType = 'CONTAINER-BOTTOM';
12290            } else if (sidebarBottom + dims.translateY <= colliderBottom) {
12291              dims.translateY = colliderBottom - sidebarBottom;
12292              affixType = 'VIEWPORT-BOTTOM';
12293            } else if (dims.containerTop + dims.translateY <= colliderTop && 0 !== dims.translateY && dims.maxTranslateY !== dims.translateY) {
12294              affixType = 'VIEWPORT-UNBOTTOM';
12295            }
12296          }
12297          
12298          return affixType;
12299        }
12300      }, {
12301        key: '_getAffixTypeScrollingUp',
12302        value: function _getAffixTypeScrollingUp() {
12303          var dims = this.dimensions;
12304          var sidebarBottom = dims.sidebarHeight + dims.containerTop;
12305          var colliderTop = dims.viewportTop + dims.topSpacing;
12306          var colliderBottom = dims.viewportBottom - dims.bottomSpacing;
12307          var affixType = this.affixedType;
12308
12309          if (colliderTop <= dims.translateY + dims.containerTop) {
12310            dims.translateY = colliderTop - dims.containerTop;
12311            affixType = 'VIEWPORT-TOP';
12312          } else if (dims.containerBottom <= colliderBottom) {
12313            dims.translateY = dims.containerBottom - sidebarBottom;
12314            affixType = 'CONTAINER-BOTTOM';
12315          } else if (!this.isSidebarFitsViewport()) {
12316
12317            if (dims.containerTop <= colliderTop && 0 !== dims.translateY && dims.maxTranslateY !== dims.translateY) {
12318              affixType = 'VIEWPORT-UNBOTTOM';
12319            }
12320          }
12321
12322          return affixType;
12323        }
12324      }, {
12325        key: '_getStyle',
12326        value: function _getStyle(affixType) {
12327          if ('undefined' === typeof affixType) return;
12328
12329          var style = { inner: {}, outer: {} };
12330          var dims = this.dimensions;
12331
12332          switch (affixType) {
12333            case 'VIEWPORT-TOP':
12334              style.inner = { position: 'fixed', top: dims.topSpacing,
12335                left: dims.sidebarLeft - dims.viewportLeft, width: dims.sidebarWidth };
12336              break;
12337            case 'VIEWPORT-BOTTOM':
12338              style.inner = { position: 'fixed', top: 'auto', left: dims.sidebarLeft,
12339                bottom: dims.bottomSpacing, width: dims.sidebarWidth };
12340              break;
12341            case 'CONTAINER-BOTTOM':
12342            case 'VIEWPORT-UNBOTTOM':
12343              var translate = this._getTranslate(0, dims.translateY + 'px');
12344
12345              if (translate) style.inner = { transform: translate };else style.inner = { position: 'absolute', top: dims.translateY, width: dims.sidebarWidth };
12346              break;
12347          }
12348
12349          switch (affixType) {
12350            case 'VIEWPORT-TOP':
12351            case 'VIEWPORT-BOTTOM':
12352            case 'VIEWPORT-UNBOTTOM':
12353            case 'CONTAINER-BOTTOM':
12354              style.outer = { height: dims.sidebarHeight, position: 'relative' };
12355              break;
12356          }
12357
12358          style.outer = StickySidebar.extend({ height: '', position: '' }, style.outer);
12359          style.inner = StickySidebar.extend({ position: 'relative', top: '', left: '',
12360            bottom: '', width: '', transform: '' }, style.inner);
12361
12362          return style;
12363        }
12364      }, {
12365        key: 'stickyPosition',
12366        value: function stickyPosition(force) {
12367          if (this._breakpoint) return;
12368
12369          force = this._reStyle || force || false;
12370
12371          var offsetTop = this.options.topSpacing;
12372          var offsetBottom = this.options.bottomSpacing;
12373
12374
12375          //for actual sidebar height, cause height can change after document load
12376          if(this.sidebarInner.offsetHeight > this.dimensions.sidebarHeight){            
12377            this.dimensions.sidebarHeight = this.sidebarInner.offsetHeight;
12378          }
12379
12380
vendor: 5,484 bytes, lines 12381-12512
12381          var affixType = this.getAffixType();
12382          var style = this._getStyle(affixType);
12383
12384          if ((this.affixedType != affixType || force) && affixType) {
12385            var affixEvent = 'affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
12386            StickySidebar.eventTrigger(this.sidebar, affixEvent);
12387
12388            if ('STATIC' === affixType) StickySidebar.removeClass(this.sidebar, this.options.stickyClass);else StickySidebar.addClass(this.sidebar, this.options.stickyClass);
12389
12390            for (var key in style.outer) {
12391              var unit = 'number' === typeof style.outer[key] ? 'px' : '';
12392              this.sidebar.style[key] = style.outer[key] + unit;
12393            }
12394
12395            for (var _key in style.inner) {
12396              var _unit = 'number' === typeof style.inner[_key] ? 'px' : '';
12397              this.sidebarInner.style[_key] = style.inner[_key] + _unit;
12398            }
12399
12400            var affixedEvent = 'affixed.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY;
12401            StickySidebar.eventTrigger(this.sidebar, affixedEvent);
12402          } else {
12403            if (this._initialized) this.sidebarInner.style.left = style.inner.left;
12404          }
12405
12406          this.affixedType = affixType;
12407        }
12408      }, {
12409        key: '_widthBreakpoint',
12410        value: function _widthBreakpoint() {
12411
12412          if (window.innerWidth <= this.options.minWidth) {
12413            this._breakpoint = true;
12414            this.affixedType = 'STATIC';
12415
12416            this.sidebar.removeAttribute('style');
12417            StickySidebar.removeClass(this.sidebar, this.options.stickyClass);
12418            this.sidebarInner.removeAttribute('style');
12419          } else {
12420            this._breakpoint = false;
12421          }
12422        }
12423      }, {
12424        key: 'updateSticky',
12425        value: function updateSticky() {
12426          var _this3 = this;
12427
12428          var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
12429
12430          if (this._running) return;
12431          this._running = true;
12432
12433          (function (eventType) {
12434            requestAnimationFrame(function () {
12435              switch (eventType) {
12436                // When browser is scrolling and re-calculate just dimensions
12437                // within scroll. 
12438                case 'scroll':
12439                  _this3._calcDimensionsWithScroll();
12440                  _this3.observeScrollDir();
12441                  _this3.stickyPosition();
12442                  break;
12443
12444                // When browser is resizing or there's no event, observe width
12445                // breakpoint and re-calculate dimensions.
12446                case 'resize':
12447                default:
12448                  _this3._widthBreakpoint();
12449                  _this3.calcDimensions();
12450                  _this3.stickyPosition(true);
12451                  break;
12452              }
12453              _this3._running = false;
12454            });
12455          })(event.type);
12456        }
12457      }, {
12458        key: '_setSupportFeatures',
12459        value: function _setSupportFeatures() {
12460          var support = this.support;
12461
12462          support.transform = StickySidebar.supportTransform();
12463          support.transform3d = StickySidebar.supportTransform(true);
12464        }
12465      }, {
12466        key: '_getTranslate',
12467        value: function _getTranslate() {
12468          var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
12469          var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
12470          var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
12471
12472          if (this.support.transform3d) return 'translate3d(' + y + ', ' + x + ', ' + z + ')';else if (this.support.translate) return 'translate(' + y + ', ' + x + ')';else return false;
12473        }
12474      }, {
12475        key: 'destroy',
12476        value: function destroy() {
12477          window.removeEventListener('resize', this, { capture: false });
12478          window.removeEventListener('scroll', this, { capture: false });
12479
12480          this.sidebar.classList.remove(this.options.stickyClass);
12481          this.sidebar.style.minHeight = '';
12482
12483          this.sidebar.removeEventListener('update' + EVENT_KEY, this);
12484
12485          var styleReset = { inner: {}, outer: {} };
12486
12487          styleReset.inner = { position: '', top: '', left: '', bottom: '', width: '', transform: '' };
12488          styleReset.outer = { height: '', position: '' };
12489
12490          for (var key in styleReset.outer) {
12491            this.sidebar.style[key] = styleReset.outer[key];
12492          }for (var _key2 in styleReset.inner) {
12493            this.sidebarInner.style[_key2] = styleReset.inner[_key2];
12494          }if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) {
12495            ResizeSensor.detach(this.sidebarInner, this.handleEvent);
12496            ResizeSensor.detach(this.container, this.handleEvent);
12497          }
12498        }
12499      }], [{
12500        key: 'supportTransform',
12501        value: function supportTransform(transform3d) {
12502          var result = false,
12503              property = transform3d ? 'perspective' : 'transform',
12504              upper = property.charAt(0).toUpperCase() + property.slice(1),
12505              prefixes = ['Webkit', 'Moz', 'O', 'ms'],
12506              support = document.createElement('support'),
12507              style = support.style;
12508
12509          (property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i) {
12510            if (style[property] !== undefined) {
12511              result = property;
12512              return false;
12513            }
12514          });
12515          return result;
12516        }
12517      }, {
12518        key: 'eventTrigger',
12519        value: function eventTrigger(element, eventName, data) {
12520          try {
12521            var event = new CustomEvent(eventName, { detail: data });
12522          } catch (e) {
12523            var event = document.createEvent('CustomEvent');
12524            event.initCustomEvent(eventName, true, true, data);
12525          }
12526          element.dispatchEvent(event);
12527        }
12528      }, {
12529        key: 'extend',
12530        value: function extend(defaults, options) {
12531          var results = {};
12532          for (var key in defaults) {
12533            if ('undefined' !== typeof options[key]) results[key] = options[key];else results[key] = defaults[key];
12534          }
12535          return results;
12536        }
12537      }, {
12538        key: 'offsetRelative',
12539        value: function offsetRelative(element) {
12540          var result = { left: 0, top: 0 };
12541
12542          do {
12543            var offsetTop = element.offsetTop;
12544            var offsetLeft = element.offsetLeft;
12545
12546            if (!isNaN(offsetTop)) result.top += offsetTop;
12547
12548            if (!isNaN(offsetLeft)) result.left += offsetLeft;
12549
12550            element = 'BODY' === element.tagName ? element.parentElement : element.offsetParent;
12551          } while (element);
12552          return result;
12553        }
12554      }, {
12555        key: 'addClass',
12556        value: function addClass(element, className) {
12557          if (!StickySidebar.hasClass(element, className)) {
12558            if (element.classList) element.classList.add(className);else element.className += ' ' + className;
12559          }
12560        }
12561      }, {
12562        key: 'removeClass',
12563        value: function removeClass(element, className) {
12564          if (StickySidebar.hasClass(element, className)) {
12565            if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' ');
12566          }
12567        }
12568      }, {
12569        key: 'hasClass',
12570        value: function hasClass(element, className) {
12571          if (element.classList) return element.classList.contains(className);else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className);
12572        }
12573      }, {
12574        key: 'defaults',
12575        get: function () {
12576          return DEFAULTS;
12577        }
12578      }]);
12579
12580      return StickySidebar;
12581    }();
12582
12583    return StickySidebar;
12584  }();
12585
12586  exports.default = StickySidebar;
12587
12588
12589  // Global
12590  // -------------------------
12591  window.StickySidebar = StickySidebar;
12592});
12593});
12594
12595var stickySidebar$1 = unwrapExports(stickySidebar);
12596
12597exports['default'] = stickySidebar$1;
12598exports.__moduleExports = stickySidebar;
12599
12600Object.defineProperty(exports, '__esModule', { value: true });
12601
12602})));
12603/* End */
12604;
12605; /* Start:"a:4:{s:4:"full";s:74:"/local/templates/aspro_max_local/js/jquery.validate.min.js?162019756922254";s:6:"source";s:58:"/local/templates/aspro_max_local/js/jquery.validate.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
12606/*! jQuery Validation Plugin - v1.13.1 - 10/14/2014
12607 * http://jqueryvalidation.org/
12608 * Copyright (c) 2014 Jörn Zaefferer; Licensed MIT */
12609!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
12609(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
12609)),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
12609idClass),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
12609ame],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);
12609return!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(' ');
12609if(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})}})});
12610/* End */
12611;
12612; /* Start:"a:4:{s:4:"full";s:78:"/local/templates/aspro_max_local/js/aspro_animate_open_fancy.js?16201975691865";s:6:"source";s:63:"/local/templates/aspro_max_local/js/aspro_animate_open_fancy.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
12613function retrieveScale(btn) {
12614	var btnRadius = btn.width()/2,
12615		left = btn.offset().left + btnRadius,
12616		top = btn.offset().top + btnRadius - $(window).scrollTop(),
12617		scale = scaleValue(top, left, btnRadius, $(window).height(), $(window).width());
12618
12619	btn.css('position', 'fixed').velocity({
12620		top: top - btnRadius,
12621		left: left - btnRadius,
12622		translateX: 0,
12623	}, 0);
12624
12625	return scale;
12626}
12627
12628function scaleValue( topValue, leftValue, radiusValue, windowW, windowH) {
12629	var maxDistHor = ( leftValue > windowW/2) ? leftValue : (windowW - leftValue),
12630		maxDistVert = ( topValue > windowH/2) ? topValue : (windowH - topValue);
12631	return Math.ceil(Math.sqrt( Math.pow(maxDistHor, 2) + Math.pow(maxDistVert, 2) )/radiusValue);
12632}
12633
12634function animateLayer(layer, scaleVal, bool) {
12635	layer.velocity({ scale: scaleVal }, 400, function(){
12636		$('body').toggleClass('overflow-hidden', bool);
12637		(bool)
12638			? layer.parents('.cd-section').addClass('modal-is-visible').end().off('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend')
12639			: layer.removeClass('is-visible').removeAttr( 'style' ).siblings('[data-type="modal-trigger"]').removeClass('to-circle');
12640	});
12641}
12642
12643function updateLayer() {
12644	var layer = $('.cd-section.modal-is-visible .cd-modal-bg'),
12645		layerRadius = layer.width()/2,
12646		layerTop = layer.siblings('.btn').offset().top + layerRadius - $(window).scrollTop(),
12647		layerLeft = layer.siblings('.btn').offset().left + layerRadius,
12648		scale = scaleValue(layerTop, layerLeft, layerRadius, $(window).height(), $(window).width());
12649
12650	layer.velocity({
12651		top: layerTop - layerRadius,
12652		left: layerLeft - layerRadius,
12653		scale: scale,
12654	}, 0);
12655}
12656
12657function closeModal() {
12658	$('.cd-modal-bg').fadeOut();
12659	animateLayer($('.cd-modal-bg'), 1, false);
12660	//$('.cd-modal-bg').removeAttr('style');
12661	//setTimeout(function(){
12662		$('.cd-modal-bg').removeClass('is-visible');
12663	//}, 510);
12664}
12665/* End */
12666;
12667; /* Start:"a:4:{s:4:"full";s:82:"/local/templates/aspro_max_local/js/jquery.inputmask.bundle.min.js?162019756970933";s:6:"source";s:66:"/local/templates/aspro_max_local/js/jquery.inputmask.bundle.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
12668!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})}
12668,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;
12668o--)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];
12668if(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({}
12668,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");
12668o.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();
12668do{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("");
12668a.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));
12668else{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.
12668inputmask._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];
12668d=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
12668ay","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[";
12668"].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);
12668if(!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)}
12668var 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)}]);
12669/* End */
12670;
12671; /* Start:"a:4:{s:4:"full";s:71:"/local/templates/aspro_max_local/js/jquery.easing.1.3.js?16201975698095";s:6:"source";s:56:"/local/templates/aspro_max_local/js/jquery.easing.1.3.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
12672/*
12673 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
12674 *
12675 * Uses the built in easing capabilities added In jQuery 1.1
12676 * to offer multiple easing options
12677 *
12678 * TERMS OF USE - jQuery Easing
12679 * 
12680 * Open source under the BSD License. 
12681 * 
12682 * Copyright © 2008 George McGinley Smith
12683 * All rights reserved.
12684 * 
12685 * Redistribution and use in source and binary forms, with or without modification, 
12686 * are permitted provided that the following conditions are met:
12687 * 
12688 * Redistributions of source code must retain the above copyright notice, this list of 
12689 * conditions and the following disclaimer.
12690 * Redistributions in binary form must reproduce the above copyright notice, this list 
12691 * of conditions and the following disclaimer in the documentation and/or other materials 
12692 * provided with the distribution.
12693 * 
12694 * Neither the name of the author nor the names of contributors may be used to endorse 
12695 * or promote products derived from this software without specific prior written permission.
12696 * 
12697 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
12698 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12699 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
12700 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
vendor: 5,091 bytes, lines 12701-12846
12701 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
12702 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
12703 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
12704 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
12705 * OF THE POSSIBILITY OF SUCH DAMAGE. 
12706 *
12707*/
12708
12709// t: current time, b: begInnIng value, c: change In value, d: duration
12710jQuery.easing['jswing'] = jQuery.easing['swing'];
12711
12712jQuery.extend( jQuery.easing,
12713{
12714	def: 'easeOutQuad',
12715	swing: function (x, t, b, c, d) {
12716		//alert(jQuery.easing.default);
12717		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
12718	},
12719	easeInQuad: function (x, t, b, c, d) {
12720		return c*(t/=d)*t + b;
12721	},
12722	easeOutQuad: function (x, t, b, c, d) {
12723		return -c *(t/=d)*(t-2) + b;
12724	},
12725	easeInOutQuad: function (x, t, b, c, d) {
12726		if ((t/=d/2) < 1) return c/2*t*t + b;
12727		return -c/2 * ((--t)*(t-2) - 1) + b;
12728	},
12729	easeInCubic: function (x, t, b, c, d) {
12730		return c*(t/=d)*t*t + b;
12731	},
12732	easeOutCubic: function (x, t, b, c, d) {
12733		return c*((t=t/d-1)*t*t + 1) + b;
12734	},
12735	easeInOutCubic: function (x, t, b, c, d) {
12736		if ((t/=d/2) < 1) return c/2*t*t*t + b;
12737		return c/2*((t-=2)*t*t + 2) + b;
12738	},
12739	easeInQuart: function (x, t, b, c, d) {
12740		return c*(t/=d)*t*t*t + b;
12741	},
12742	easeOutQuart: function (x, t, b, c, d) {
12743		return -c * ((t=t/d-1)*t*t*t - 1) + b;
12744	},
12745	easeInOutQuart: function (x, t, b, c, d) {
12746		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
12747		return -c/2 * ((t-=2)*t*t*t - 2) + b;
12748	},
12749	easeInQuint: function (x, t, b, c, d) {
12750		return c*(t/=d)*t*t*t*t + b;
12751	},
12752	easeOutQuint: function (x, t, b, c, d) {
12753		return c*((t=t/d-1)*t*t*t*t + 1) + b;
12754	},
12755	easeInOutQuint: function (x, t, b, c, d) {
12756		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
12757		return c/2*((t-=2)*t*t*t*t + 2) + b;
12758	},
12759	easeInSine: function (x, t, b, c, d) {
12760		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
12761	},
12762	easeOutSine: function (x, t, b, c, d) {
12763		return c * Math.sin(t/d * (Math.PI/2)) + b;
12764	},
12765	easeInOutSine: function (x, t, b, c, d) {
12766		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
12767	},
12768	easeInExpo: function (x, t, b, c, d) {
12769		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
12770	},
12771	easeOutExpo: function (x, t, b, c, d) {
12772		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
12773	},
12774	easeInOutExpo: function (x, t, b, c, d) {
12775		if (t==0) return b;
12776		if (t==d) return b+c;
12777		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
12778		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
12779	},
12780	easeInCirc: function (x, t, b, c, d) {
12781		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
12782	},
12783	easeOutCirc: function (x, t, b, c, d) {
12784		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
12785	},
12786	easeInOutCirc: function (x, t, b, c, d) {
12787		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
12788		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
12789	},
12790	easeInElastic: function (x, t, b, c, d) {
12791		var s=1.70158;var p=0;var a=c;
12792		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
12793		if (a < Math.abs(c)) { a=c; var s=p/4; }
12794		else var s = p/(2*Math.PI) * Math.asin (c/a);
12795		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
12796	},
12797	easeOutElastic: function (x, t, b, c, d) {
12798		var s=1.70158;var p=0;var a=c;
12799		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
12800		if (a < Math.abs(c)) { a=c; var s=p/4; }
12801		else var s = p/(2*Math.PI) * Math.asin (c/a);
12802		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
12803	},
12804	easeInOutElastic: function (x, t, b, c, d) {
12805		var s=1.70158;var p=0;var a=c;
12806		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
12807		if (a < Math.abs(c)) { a=c; var s=p/4; }
12808		else var s = p/(2*Math.PI) * Math.asin (c/a);
12809		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
12810		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
12811	},
12812	easeInBack: function (x, t, b, c, d, s) {
12813		if (s == undefined) s = 1.70158;
12814		return c*(t/=d)*t*((s+1)*t - s) + b;
12815	},
12816	easeOutBack: function (x, t, b, c, d, s) {
12817		if (s == undefined) s = 1.70158;
12818		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
12819	},
12820	easeInOutBack: function (x, t, b, c, d, s) {
12821		if (s == undefined) s = 1.70158; 
12822		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
12823		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
12824	},
12825	easeInBounce: function (x, t, b, c, d) {
12826		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
12827	},
12828	easeOutBounce: function (x, t, b, c, d) {
12829		if ((t/=d) < (1/2.75)) {
12830			return c*(7.5625*t*t) + b;
12831		} else if (t < (2/2.75)) {
12832			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
12833		} else if (t < (2.5/2.75)) {
12834			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
12835		} else {
12836			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
12837		}
12838	},
12839	easeInOutBounce: function (x, t, b, c, d) {
12840		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
12841		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
12842	}
12843});
12844
12845/*
12846 *
12847 * TERMS OF USE - EASING EQUATIONS
12848 * 
12849 * Open source under the BSD License. 
12850 * 
12851 * Copyright © 2001 Robert Penner
12852 * All rights reserved.
12853 * 
12854 * Redistribution and use in source and binary forms, with or without modification, 
12855 * are permitted provided that the following conditions are met:
12856 * 
12857 * Redistributions of source code must retain the above copyright notice, this list of 
12858 * conditions and the following disclaimer.
12859 * Redistributions in binary form must reproduce the above copyright notice, this list 
12860 * of conditions and the following disclaimer in the documentation and/or other materials 
12861 * provided with the distribution.
12862 * 
12863 * Neither the name of the author nor the names of contributors may be used to endorse 
12864 * or promote products derived from this software without specific prior written permission.
12865 * 
12866 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
12867 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12868 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
12869 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
12870 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
12871 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
12872 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
12873 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
12874 * OF THE POSSIBILITY OF SUCH DAMAGE. 
12875 *
12876 */
12877/* End */
12878;
12879; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_max_local/js/equalize.min.js?1620197569588";s:6:"source";s:51:"/local/templates/aspro_max_local/js/equalize.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
12880/**
12881 * equalize.js
12882 * Author & copyright (c) 2012: Tim Svensen
12883 * Dual MIT & GPL license
12884 *
12885 * Page: http://tsvensen.github.com/equalize.js
12886 * Repo: https://github.com/tsvensen/equalize.js/
12887 */
12888(function(b){b.fn.equalize=function(a){var d=!1,g=!1,c,e;b.isPlainObject(a)?(c=a.equalize||"height",d=a.children||!1,g=a.reset||!1):c=a||"height";if(!b.isFunction(b.fn[c]))return!1;e=0<c.indexOf("eight")?"height":"width";return this.each(function(){var a=d?b(this).find(d):b(this).children(),f=0;a.each(function(){var a=b(this);g&&a.css(e,"");a=a[c]();a>f&&(f=a)});a.css(e,f+"px")})}})(jQuery);
12889/* End */
12890;
12891; /* Start:"a:4:{s:4:"full";s:73:"/local/templates/aspro_max_local/js/jquery.alphanumeric.js?16201975691901";s:6:"source";s:58:"/local/templates/aspro_max_local/js/jquery.alphanumeric.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
12892(function ($) {
12893    $.fn.alphanumeric = function (p) {
12894        var input = $(this),
12895            az = "abcdefghijklmnopqrstuvwxyz",
12896            options = $.extend({
12897                ichars: '!@#$%^&*()+=[]\\\';,/{}|":<>?~`.- _',
12898                nchars: '',
12899                allow: ''
12900            }, p),
12901            s = options.allow.split(''),
12902            i = 0,
12903            ch,
12904            regex;
12905
12906        for (i; i < s.length; i++) {
12907            if (options.ichars.indexOf(s[i]) != -1) {
12908                s[i] = '\\' + s[i];
12909            }
12910        }
12911
12912        if (options.nocaps) {
12913            options.nchars += az.toUpperCase();
12914        }
12915        if (options.allcaps) {
12916            options.nchars += az;
12917        }
12918
12919        options.allow = s.join('|');
12920
12921        regex = new RegExp(options.allow, 'gi');
12922        ch = (options.ichars + options.nchars).replace(regex, '');
12923
12924        input.keypress(function (e) {
12925            var key = String.fromCharCode(!e.charCode ? e.which : e.charCode);
12926
12927            if (ch.indexOf(key) != -1 && !e.ctrlKey) {
12928                e.preventDefault();
12929            }
12930        });
12931
12932        input.blur(function () {
12933            var value = input.val(),
12934                j = 0;
12935
12936            for (j; j < value.length; j++) {
12937                if (ch.indexOf(value[j]) != -1) {
12938                    input.val('');
12939                    return false;
12940                }
12941            }
12942            return false;
12943        });
12944
12945        return input;
12946    };
12947
12948    $.fn.numeric = function (p) {
12949        var az = 'abcdefghijklmnopqrstuvwxyz',
12950            aZ = az.toUpperCase();
12951
12952        return this.each(function () {
12953            $(this).alphanumeric($.extend({ nchars: az + aZ }, p));
12954        });
12955    };
12956
12957    $.fn.alpha = function (p) {
12958        var nm = '1234567890';
12959        return this.each(function () {
12960            $(this).alphanumeric($.extend({ nchars: nm }, p));
12961        });
12962    };
12963})(jQuery);
12964/* End */
12965;
12966; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/aspro_max_local/js/jquery.cookie.js?16201975693066";s:6:"source";s:52:"/local/templates/aspro_max_local/js/jquery.cookie.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
12967/*!
12968 * jQuery Cookie Plugin v1.4.0
12969 * https://github.com/carhartl/jquery-cookie
12970 *
12971 * Copyright 2013 Klaus Hartl
12972 * Released under the MIT license
12973 */
12974(function (factory) {
12975	if (typeof define === 'function' && define.amd) {
12976		// AMD. Register as anonymous module.
12977		define(['jquery'], factory);
12978	} else {
12979		// Browser globals.
12980		factory(jQuery);
12981	}
12982}(function ($) {
12983
12984	var pluses = /\+/g;
12985
12986	function encode(s) {
12987		return config.raw ? s : encodeURIComponent(s);
12988	}
12989
12990	function decode(s) {
12991		return config.raw ? s : decodeURIComponent(s);
12992	}
12993
12994	function stringifyCookieValue(value) {
12995		return encode(config.json ? JSON.stringify(value) : String(value));
12996	}
12997
12998	function parseCookieValue(s) {
12999		if (s.indexOf('"') === 0) {
13000			// This is a quoted cookie as according to RFC2068, unescape...
13001			s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
13002		}
13003
13004		try {
13005			// Replace server-side written pluses with spaces.
13006			// If we can't decode the cookie, ignore it, it's unusable.
13007			// If we can't parse the cookie, ignore it, it's unusable.
13008			s = decodeURIComponent(s.replace(pluses, ' '));
13009			return config.json ? JSON.parse(s) : s;
13010		} catch(e) {}
13011	}
13012
13013	function read(s, converter) {
13014		var value = config.raw ? s : parseCookieValue(s);
13015		return $.isFunction(converter) ? converter(value) : value;
13016	}
13017
13018	var config = $.cookie = function (key, value, options) {
13019
13020		// Write
13021
13022		if (value !== undefined && !$.isFunction(value)) {
13023			options = $.extend({}, config.defaults, options);
13024
13025			if (typeof options.expires === 'number') {
13026				var days = options.expires, t = options.expires = new Date();
13027				t.setTime(+t + days * 864e+5);
13028			}
13029
13030			return (document.cookie = [
13031				encode(key), '=', stringifyCookieValue(value),
13032				options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
13033				options.path    ? '; path=' + options.path : '',
13034				options.domain  ? '; domain=' + options.domain : '',
13035				options.secure  ? '; secure' : ''
13036			].join(''));
13037		}
13038
13039		// Read
13040
13041		var result = key ? undefined : {};
13042
13043		// To prevent the for loop in the first place assign an empty array
13044		// in case there are no cookies at all. Also prevents odd result when
13045		// calling $.cookie().
13046		var cookies = document.cookie ? document.cookie.split('; ') : [];
13047
13048		for (var i = 0, l = cookies.length; i < l; i++) {
13049			var parts = cookies[i].split('=');
13050			var name = decode(parts.shift());
13051			var cookie = parts.join('=');
13052
13053			if (key && key === name) {
13054				// If second argument (value) is a function it's a converter...
13055				result = read(cookie, value);
13056				break;
13057			}
13058
13059			// Prevent storing a cookie that we couldn't decode.
13060			if (!key && (cookie = read(cookie)) !== undefined) {
13061				result[name] = cookie;
13062			}
13063		}
13064
13065		return result;
13066	};
13067
13068	config.defaults = {};
13069
13070	$.removeCookie = function (key, options) {
13071		if ($.cookie(key) === undefined) {
13072			return false;
13073		}
13074
13075		// Must not alter options, thus extending a fresh object...
13076		$.cookie(key, '', $.extend({}, options, { expires: -1 }));
13077		return !$.cookie(key);
13078	};
13079
13080}));
13081
13082/* End */
13083;
13084; /* Start:"a:4:{s:4:"full";s:71:"/local/templates/aspro_max_local/js/jquery.plugin.min.js?16201975693178";s:6:"source";s:56:"/local/templates/aspro_max_local/js/jquery.plugin.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13085/** Abstract base class for collection plugins v1.0.1.
13086	Written by Keith Wood (kbwood{at}iinet.com.au) December 2013.
13087	Licensed under the MIT (http://keith-wood.name/licence.html) license. */
13088(function(){var j=false;window.JQClass=function(){};JQClass.classes={};JQClass.extend=function extender(f){var g=this.prototype;j=true;var h=new this();j=false;for(var i in f){h[i]=typeof f[i]=='function'&&typeof g[i]=='function'?(function(d,e){return function(){var b=this._super;this._super=function(a){return g[d].apply(this,a||[])};var c=e.apply(this,arguments);this._super=b;return c}})(i,f[i]):f[i]}function JQClass(){if(!j&&this._init){this._init.apply(this,arguments)}}JQClass.prototype=h;JQClass.prototype.constructor=JQClass;JQClass.extend=extender;return JQClass}})();(function($){JQClass.classes.JQPlugin=JQClass.extend({name:'plugin',defaultOptions:{},regionalOptions:{},_getters:[],_getMarker:function(){return'is-'+this.name},_init:function(){$.extend(this.defaultOptions,(this.regionalOptions&&this.regionalOptions[''])||{});var c=camelCase(this.name);$[c]=this;$.fn[c]=function(a){var b=Array.prototype.slice.call(arguments,1
13088);if($[c]._isNotChained(a,b)){return $[c][a].apply($[c],[this[0]].concat(b))}return this.each(function(){if(typeof a==='string'){if(a[0]==='_'||!$[c][a]){throw'Unknown method: '+a;}$[c][a].apply($[c],[this].concat(b))}else{$[c]._attach(this,a)}})}},setDefaults:function(a){$.extend(this.defaultOptions,a||{})},_isNotChained:function(a,b){if(a==='option'&&(b.length===0||(b.length===1&&typeof b[0]==='string'))){return true}return $.inArray(a,this._getters)>-1},_attach:function(a,b){a=$(a);if(a.hasClass(this._getMarker())){return}a.addClass(this._getMarker());b=$.extend({},this.defaultOptions,this._getMetadata(a),b||{});var c=$.extend({name:this.name,elem:a,options:b},this._instSettings(a,b));a.data(this.name,c);this._postAttach(a,c);this.option(a,b)},_instSettings:function(a,b){return{}},_postAttach:function(a,b){},_getMetadata:function(d){try{var f=d.data(this.name.toLowerCase())||'';f=f.replace(/'/g,'"');f=f.replace(/([a-zA-Z0-9]+):/g,function(a,b,i){var c=f.substring(0,i).match(/"/g);return(!c||c.length%2===0?'"'+b+'":':b+':')});f=$.parseJSON('{'+f+'}');for(var g in f){var h=f[g];if(typeof h==='string'&&h.match(/^new Date\((.*)\)$/)){f[g]=eval(h)}}return f}catch(e){return{}}},_getInst:function(a){return $(a).data(this.name)||{}},option:function(a,b,c){a=$(a);var d=a.data(this.name);if(!b||(typeof b==='string'&&c==null)){var e=(d||{}).options;return(e&&b?e[b]:e)}if(!a.hasClass(this._getMarker())){return}var e=b||{};if(typeof b==='string'){e={};e[b]=c}this._optionsChanged(a,d,e);$.extend(d.options,e)},_optionsChanged:function(a,b,c){},destroy:function(a){a=$(a);if(!a.hasClass(this._getMarker())){return}this._preDestroy(a,this._getInst(a));a.removeData(this.name).removeClass(this._getMarker())},_preDestroy:function(a,b){}});function camelCase(c){return c.replace(/-([a-z])/g,function(a,b){return b.toUpperCase()})}$.JQPlugin={createPlugin:function(a,b){if(typeof a==='object'){b=a;a='JQPlugin'}a=camelCase(a);var c=camelCase(b.name);JQClass.classes[c]=JQClass.classes[a].extend(b);new JQClass.classes[c]()}}})(jQuery);
13089/* End */
13090;
13091; /* Start:"a:4:{s:4:"full";s:75:"/local/templates/aspro_max_local/js/jquery.countdown.min.js?162019756913137";s:6:"source";s:59:"/local/templates/aspro_max_local/js/jquery.countdown.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13092!function(e){var t="countdown",i=0,s=1,n=2,o=3,r=4,a=5,l=6;e.JQPlugin.createPlugin({name:t,defaultOptions:{until:null,since:null,timezone:null,serverSync:null,format:"dHMS",layout:"",compact:!1,padZeroes:!1,significant:0,description:"",expiryUrl:"",expiryText:"",alwaysExpire:!1,onExpiry:null,onTick:null,tickInterval:1},regionalOptions:{"":{labels:["Years","Months","Weeks","Days","Hours","Minutes","Seconds"],labels1:["Year","Month","Week","Day","Hour","Minute","Second"],compactLabels:["y","m","w","d"],whichLabels:null,digits:["0","1","2","3","4","5","6","7","8","9"],timeSeparator:":",isRTL:!1}},_getters:["getTimes"],_rtlClass:t+"-rtl",_sectionClass:t+"-section",_amountClass:t+"-amount",_periodClass:t+"-period",_rowClass:t+"-row",_holdingClass:t+"-holding",_showClass:t+"-show",_descrClass:t+"-descr",_timerElems:[],_init:function(){function t(e){var a=1e12>e?n?performance.now()+performance.timing.navigationStart:s():e||s();a-r>=1e3&&(i._updateElems(),r=a),o(t)}var i=this;this._super(),this._serverSyncs=[];var s="function"==typeof Date.now?Date.now:function(){return(new Date).getTime()},n=window.performance&&"function"==typeof window.performance.now,o=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||null,r=0;!o||e.noRequestAnimationFrame?(e.noRequestAnimationFrame=null,setInterval(function(){i._updateElems()},980)):(r=window.animationStartTime||window.webkitAnimationStartTime||window.mozAnimationStartTime||window.oAnimationStartTime||window.msAnimationStartTime||s(),o(t))},UTCDate:function(e,t,i,s,n,o,r,a){"object"==typeof t&&t.constructor==Date&&(a=t.getMilliseconds(),r=t.getSeconds(),o=t.getMinutes(),n=t.getHours(),s=t.getDate(),i=t.getMonth(),t=t.getFullYear());var l=new Date;return l.setUTCFullYear(t),l.setUTCDate(1),l.setUTCMonth(i||0),l.setUTCDate(s||1),l.setUTCHours(n||0),l.setUTCMinutes((o||0)-(Math.abs(e)<30?60*e:e)),l.setUTCSeconds(r||0),l.setUTCMilliseconds(a||0),l}
13092,periodsToSeconds:function(e){return 31557600*e[0]+2629800*e[1]+604800*e[2]+86400*e[3]+3600*e[4]+60*e[5]+e[6]},resync:function(){var t=this;e("."+this._getMarker()).each(function(){var i=e.data(this,t.name);if(i.options.serverSync){for(var s=null,n=0;n<t._serverSyncs.length;n++)if(t._serverSyncs[n][0]==i.options.serverSync){s=t._serverSyncs[n];break}if(null==s[2]){var o=e.isFunction(i.options.serverSync)?i.options.serverSync.apply(this,[]):null;s[2]=(o?(new Date).getTime()-o.getTime():0)-s[1]}i._since&&i._since.setMilliseconds(i._since.getMilliseconds()+s[2]),i._until.setMilliseconds(i._until.getMilliseconds()+s[2])}});for(var i=0;i<t._serverSyncs.length;i++)null!=t._serverSyncs[i][2]&&(t._serverSyncs[i][1]+=t._serverSyncs[i][2],delete t._serverSyncs[i][2])},_instSettings:function(e,t){return{_periods:[0,0,0,0,0,0,0]}},_addElem:function(e){this._hasElem(e)||this._timerElems.push(e)},_hasElem:function(t){return e.inArray(t,this._timerElems)>-1},_removeElem:function(t){this._timerElems=e.map(this._timerElems,function(e){return e==t?null:e})},_updateElems:function(){for(var e=this._timerElems.length-1;e>=0;e--)this._updateCountdown(this._timerElems[e])},_optionsChanged:function(t,i,s){s.layout&&(s.layout=s.layout.replace(/&lt;/g,"<").replace(/&gt;/g,">")),this._resetExtraLabels(i.options,s);var n=i.options.timezone!=s.timezone;e.extend(i.options,s),this._adjustSettings(t,i,null!=s.until||null!=s.since||n);var o=new Date;(i._since&&i._since<o||i._until&&i._until>o)&&this._addElem(t[0]),this._updateCountdown(t,i)},_updateCountdown:function(t,i){if(t=t.jquery?t:e(t),i=i||this._getInst(t),i&&i.options){if(t.html(this._generateHTML(i)).toggleClass(this._rtlClass,i.options.isRTL),e.isFunction(i.options.onT
13092ick)){var s="lap"!=i._hold?i._periods:this._calculatePeriods(i,i._show,i.options.significant,new Date);(1==i.options.tickInterval||this.periodsToSeconds(s)%i.options.tickInterval==0)&&i.options.onTick.apply(t[0],[s])}var n="pause"!=i._hold&&(i._since?i._now.getTime()<i._since.getTime():i._now.getTime()>=i._until.getTime());if(n&&!i._expiring){if(i._expiring=!0,this._hasElem(t[0])||i.options.alwaysExpire){if(this._removeElem(t[0]),e.isFunction(i.options.onExpiry)&&i.options.onExpiry.apply(t[0],[]),i.options.expiryText){var o=i.options.layout;i.options.layout=i.options.expiryText,this._updateCountdown(t[0],i),i.options.layout=o}i.options.expiryUrl&&(window.location=i.options.expiryUrl)}i._expiring=!1}else"pause"==i._hold&&this._removeElem(t[0])}},_resetExtraLabels:function(e,t){for(var i in t)i.match(/[Ll]abels[02-9]|compactLabels1/)&&(e[i]=t[i]);for(var i in e)i.match(/[Ll]abels[02-9]|compactLabels1/)&&"undefined"==typeof t[i]&&(e[i]=null)},_adjustSettings:function(t,i,s){for(var n=null,o=0;o<this._serverSyncs.length;o++)if(this._serverSyncs[o][0]==i.options.serverSync){n=this._serverSyncs[o][1];break}if(null!=n)var r=i.options.serverSync?n:0,a=new Date;else{var l=e.isFunction(i.options.serverSync)?i.options.serverSync.apply(t[0],[]):null,a=new Date,r=l?a.getTime()-l.getTime():0;this._serverSyncs.push([i.options.serverSync,r])}var _=i.options.timezone;_=null==_?-a.getTimezoneOffset():_,(s||!s&&null==i._until&&null==i._since)&&(i._since=i.options.since,null!=i._since&&(i._since=this.UTCDate(_,this._determineTime(i._since,null)),i._since&&r&&i._since.setMilliseconds(i._since.getMilliseconds()+r)),i._until=this.UTCDate(_,this._determineTime(i.options.until,a)),r&&i._until.setMilliseconds(i._until.getMilliseconds()+r)),i._show=this._determineShow(i)},_preDestroy:function(e,t){this._removeElem(e[0]),e.empty()},pause:function(e){this._hold(e,"pause")},lap:function(e){this._hold(e,"lap")},resume:function(e){this._hold(e,null)},toggle:function(t){var i=e.data(t,this.name)||{};this[i._hold?"resume":"pause"](t)},toggleLap:function(t){var i=e.data(t,this.name)||{};this[i._hold?"resume":"lap"](t)},_hold:function(t,i){var s=e.data(t,this.name);if(s){if("pause"==s._hold&&!i){s._periods=s._savePeriods;var n=s._since?"-":"+";s[s._since?"_since":"_until"]=this._determineTime(n+s._periods[0]+"y"+n+s._periods[1]+"o"+n+s._periods[2]+"w"+n+s._periods[3]+"d"+n+s._periods[4]+"h"+n+s._periods[5]+"m"+n+s._periods[6]+"s"),this._addElem(t)}s._hold=i,s._savePeriods="pause"==i?s._periods:null,e.data(t,this.name,s),this._updateCountdown(t,s)}},getTimes:function(t){var i=e.data(t,this.name);return i?"pause"==i._hold?i._savePeriods:i._hold?this._calculatePeriods(i,i._show,i.options.significant,new Date):i._periods:null},_determineTime:function(e,t){var i=this,s=function(e){var t=new Date;return t.setTime(t.getTime()+1e3*e),t},n=function(e){e=e.toLowerCase();for(var t=new Date,s=t.getFullYear(),n=t.getMonth(),o=t.getDate(),r=t.getHours(),a=t.getMinutes(),l=t.getSeconds(),_=/([+-]?[0-9]+)\s*(s|m|h|d|w|o|y)?/g,p=_.exec(e);p;){switch(p[2]||"s"){case"s":l+=parseInt(p[1],10);break;case"m":a+=parseInt(p[1],10);break;case"h":r+=parseInt(p[1],10);break;case"d":o+=parseInt(p[1],10);break;case"w":o+=7*parseInt(p[1],10);break;case"o":n+=parseInt(p[1],10),o=Math.min(o,i._getDaysInMonth(s,n));break;case"y":s+=parseInt(p[1],10),o=Math.min(o,i._getDaysInMonth(s,n))}p=_.exec(e)}return new Date(s,n,o,r,a,l,0)},o=null==e?t:"string"==typeof e?n(e):"number"==typeof e?s(e):e;return o&&o.setMilliseconds(0),o},_getDaysInMonth:function(e,t){return 32-new Date(e,t,32).getDate()},_normalLabels:function(e){return e},_generateHTML:function(t){var _=this;t._periods=t._hold?t._periods:this._calculatePeriods(t,t._show,t.options.significant,new Date);for(var p=!1,c=0,u=t.options.significant,d=e.extend({},t._show),h=i;l>=h;h++)p|="?"==t._show[h]&&t._periods[h]>0,d[h]="?"!=t._show[h]||p?t._show[h]:null,c+=d[h]?1:0,u-=t._periods[h]>0?1:0;for(var m=[!1,!1,!1,!1,!1,!1,!1],h=l;h>=i;h--)t._show[h]&&(t._periods[h]?m[h]=!0:(m[h]=u>0,u--));var g=t.options.compact?t.options.compactLabels:t.options.labels,f=t.options.whichLabels||this._normalLabels,w=function(e){var i=t.o
13092ptions["compactLabels"+f(t._periods[e])];return d[e]?_._translateDigits(t,t._periods[e])+(i?i[e]:g[e])+" ":""},y=t.options.padZeroes?2:1,v=function(e){var i=t.options["labels"+f(t._periods[e])];return!t.options.significant&&d[e]||t.options.significant&&m[e]?'<span class="'+_._sectionClass+'"><span class="'+_._amountClass+'">'+_._minDigits(t,t._periods[e],y)+'</span><span class="'+_._periodClass+'">'+(i?i[e]:g[e])+"</span></span>":""};return t.options.layout?this._buildLayout(t,d,t.options.layout,t.options.compact,t.options.significant,m):(t.options.compact?'<span class="'+this._rowClass+" "+this._amountClass+(t._hold?" "+this._holdingClass:"")+'">'+w(i)+w(s)+w(n)+w(o)+(d[r]?this._minDigits(t,t._periods[r],2):"")+(d[a]?(d[r]?t.options.timeSeparator:"")+this._minDigits(t,t._periods[a],2):"")+(d[l]?(d[r]||d[a]?t.options.timeSeparator:"")+this._minDigits(t,t._periods[l],2):""):'<span class="'+this._rowClass+" "+this._showClass+(t.options.significant||c)+(t._hold?" "+this._holdingClass:"")+'">'+v(i)+v(s)+v(n)+v(o)+v(r)+v(a)+v(l))+"</span>"+(t.options.description?'<span class="'+this._rowClass+" "+this._descrClass+'">'+t.options.description+"</span>":"")},_buildLayout:function(t,_,p,c,u,d){for(var h=t.options[c?"compactLabels":"labels"],m=t.options.whichLabels||this._normalLabels,g=function(e){return(t.options[(c?"compactLabels":"labels")+m(t._periods[e])]||h)[e]},f=function(e,i){return t.options.digits[Math.floor(e/i)%10]},w={desc:t.options.description,sep:t.options.timeSeparator,yl:g(i),yn:this._minDigits(t,t._periods[i],1),ynn:this._minDigits(t,t._periods[i],2),ynnn:this._minDigits(t,t._periods[i],3),y1:f(t._periods[i],1),y10:f(t._periods[i],10),y100:f(t._periods[i],100),y1000:f(t._periods[i],1e3),ol:g(s),on:this._minDigits(t,t._periods[s],1),onn:this._minDigits(t,t._periods[s],2),onnn:this._minDigits(t,t._periods[s],3),o1:f(t._periods[s],1),o10:f(t._periods[s],10),o100:f(t._periods[s],100),o1000:f(t._periods[s],1e3),wl:g(n),wn:this._minDigits(t,t._periods[n],1),wnn:this._minDigits(t,t._periods[n],2),wnnn:this._minDigits(t,t._periods[n],3),w1:f(t._periods[n],1),w10:f(t._periods[n],10),w100:f(t._periods[n],100),w1000:f(t._periods[n],1e3),dl:g(o),dn:this._minDigits(t,t._periods[o],1),dnn:this._minDigits(t,t._periods[o],2),dnnn:this._minDigits(t,t._periods[o],3),d1:f(t._periods[o],1),d10:f(t._periods[o],10),d100:f(t._periods[o],100),d1000:f(t._periods[o],1e3),hl:g(r),hn:this._minDigits(t,t._periods[r],1),hnn:this._minDigits(t,t._periods[r],2),hnnn:this._minDigits(t,t._periods[r],3),h1:f(t._periods[r],1),h10:f(t._periods[r],10),h100:f(t._periods[r],100),h1000:f(t._periods[r],1e3),ml:g(a),mn:this._minDigits(t,t._periods[a],1),mnn:this._minDigits(t,t._periods[a],2),mnnn:this._minDigits(t,t._periods[a],3),m1:f(t._periods[a],1),m10:f(t._periods[a],10),m100:f(t._periods[a],100),m1000:f(t._periods[a],1e3),sl:g(l),sn:this._minDigits(t,t._periods[l],1),snn:this._minDigits(t,t._periods[l],2),snnn:this._minDigits(t,t._periods[l],3),s1:f(t._periods[l],1),s10:f(t._periods[l],10),s100:f(t._periods[l],100),s1000:f(t._periods[l],1e3)},y=p,v=i;l>=v;v++){var D="yowdhms".charAt(v),T=new RegExp("\\{"+D+"<\\}([\\s\\S]*)\\{"+D+">\\}","g");y=y.replace(T,!u&&_[v]||u&&d[v]?"$1":"")}return e.each(w,function(e,t){var i=new RegExp("\\{"+e+"\\}","g");y=y.replace(i,t)}),y},_minDigits:function(e,t,i){return t=""+t,t.length>=i?this._translateDigits(e,t):(t="0000000000"+t,this._translateDigits(e,t.substr(t.length-i)))},_translateDigits:function(e,t){return(""+t).replace(/[0-9]/g,function(t){return e.options.digits[t]})},_determineShow:function(e){var t=e.options.format,_=[];return _[i]=t.match("y")?"?":t.match("Y")?"!":null,_[s]=t.match("o")?"?":t.match("O")?"!":null,_[n]=t.match("w")?"?":t.match("W")?"!":null,_[o]=t.match("d")?"?":t.match("D")?"!":null,_[r]=t.match("h")?"?":t.match("H")?"!":null,_[a]=t.match("m")?"?":t.match("M")?"!":null,_[l]=t.match("s")?"?":t.match("S")?"!":null,_},_calculatePeriods:function(e,t,_,p){e._now=p,e._now.setMilliseconds(0);var c=new Date(e._now.getTime());e._since?p.getTime()<e._since.getTime()?e._now=p=c:p=e._since:(c.setTime(e._until.getTime()),p.getTime()>e._until.getTime()&&(e._now=p=c));var u=[0,0,0,0,0,0,0];if(t[i]||t[s]){var d=this._getDaysInMonth(p.getFullYear(),p.getMonth()),h=this._getDaysInMonth(c.getFullYear(),c.getMonth()),m=c.getDate()==p.getDate()||c.getDate()>=Math.min(d,h)&&p.getDate()>=Math.min(d,h),g=function(e){return 60*(60*e.getHours()+e.getMinutes())+e.getSeconds()},f=Math.max(0,12*(c.getFullYear()-p.getFullYear())+c.getMonth()-p.getMonth()+(c.getDate()<p.getDate()&&!m||m&&g(c)<g(p)?-1:0));u[i]=t[i]?Math.floor(f/12):0,u[s]=t[s]?f-12*u[i]:0,p=new Date(p.getTime());var w=p.getDate()==d,y=this._getDaysInMonth(p.getFullYear()+u[i],p.getMonth()+u[s]);p.getDate()>y&&p.setDate(y),p.setFullYear(p.getFullYear()+u[i]),p.setMonth(p.getMonth()+u[s]),w&&p.setDate(y)}var v=Math.floor((c.getTime()-p.getTime())/1e3),D=function(e,i){u[e]=t[e]?Math.floor(v/i):0,v-=u[e]*i};if(D(n,604800),D(o,86400),D(r,3600),D(a,60),D(l,1),v>0&&!e._since)for(var T=[1,12,4.3482,7,24,60,60],M=l,S=1,b=l;b>=i;b--)t[b]&&(u[M]>=S&&(u[M]=0,v=1),v>0&&(u[b]++,v=0,M=b,S=1)),S*=T[b];if(_)for(var b=i;l>=b;b++)_&&u[b]?_--:_||(u[b]=0);return u}})}(jQuery);
13093/* End */
13094;
13095; /* Start:"a:4:{s:4:"full";s:73:"/local/templates/aspro_max_local/js/jquery.countdown-ru.js?16201975691866";s:6:"source";s:58:"/local/templates/aspro_max_local/js/jquery.countdown-ru.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13096/* http://keith-wood.name/countdown.html
13097 * Russian initialisation for the jQuery countdown extension
13098 * Written by Sergey K. (xslade{at}gmail.com) June 2010. */
13099(function($) {
13100        $.countdown.regionalOptions['ru'] = {
13101		labels: [BX.message('COUNTDOWN_YEAR0'), BX.message('COUNTDOWN_MONTH0'), BX.message('COUNTDOWN_WEAK0'), BX.message('COUNTDOWN_DAY0'), BX.message('COUNTDOWN_HOUR'), BX.message('COUNTDOWN_MIN'), BX.message('COUNTDOWN_SEC')],
13102		labels1: [BX.message('COUNTDOWN_YEAR1'), BX.message('COUNTDOWN_MONTH1'), BX.message('COUNTDOWN_WEAK1'), BX.message('COUNTDOWN_DAY1'), BX.message('COUNTDOWN_HOUR'), BX.message('COUNTDOWN_MIN'), BX.message('COUNTDOWN_SEC')],
13103		labels2: [BX.message('COUNTDOWN_YEAR2'), BX.message('COUNTDOWN_MONTH2'), BX.message('COUNTDOWN_WEAK2'), BX.message('COUNTDOWN_DAY2'), BX.message('COUNTDOWN_HOUR'), BX.message('COUNTDOWN_MIN'), BX.message('COUNTDOWN_SEC')],
13104		compactLabels: [BX.message('COUNTDOWN_COMPACT_YEAR0'), BX.message('COUNTDOWN_COMPACT_MONTH'), BX.message('COUNTDOWN_COMPACT_WEAK'), BX.message('COUNTDOWN_COMPACT_DAY'), BX.message('COUNTDOWN_COMPACT_HOUR'), BX.message('COUNTDOWN_COMPACT_MIN'), BX.message('COUNTDOWN_COMPACT_SEC')],
13105		compactLabels1: [BX.message('COUNTDOWN_COMPACT_YEAR1'), BX.message('COUNTDOWN_COMPACT_MONTH'), BX.message('COUNTDOWN_COMPACT_WEAK'), BX.message('COUNTDOWN_COMPACT_DAY'), BX.message('COUNTDOWN_COMPACT_HOUR'), BX.message('COUNTDOWN_COMPACT_MIN'), BX.message('COUNTDOWN_COMPACT_SEC')],
13106		whichLabels: function(amount) {
13107			var units = amount % 10;
13108			var tens = Math.floor((amount % 100) / 10);
13109			return (amount == 1 ? 1 : (units >= 2 && units <= 4 && tens != 1 ? 2 :
13110				(units == 1 && tens != 1 ? 1 : 0)));
13111		},
13112		digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
13113		timeSeparator: ':', isRTL: false};
13114	$.countdown.setDefaults($.countdown.regionalOptions['ru']);
13115})(jQuery);
13116/* End */
13117;
13118; /* Start:"a:4:{s:4:"full";s:70:"/local/templates/aspro_max_local/js/jquery.ikSelect.js?162019756932030";s:6:"source";s:54:"/local/templates/aspro_max_local/js/jquery.ikSelect.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
13119/*! ikSelect 1.0.3
13120	Copyright (c) 2013 Igor Kozlov
13121	http://igorkozlov.me */
13122
13123;(function ($, window, document, undefined) {
13124	var $window = $(window);
13125	var defaults = {
13126		syntax: '<div class="ik_select_link"><div class="ik_select_link_text"></div></div><div class="ik_select_dropdown"><div class="ik_select_list"></div></div>',
13127		autoWidth: true, // set select width according to the longest option
13128		ddFullWidth: true, // set dropdown width according to the longest option
13129		equalWidths: true, // include scrollbar width in fake select calculations
13130		dynamicWidth: false, // change fake select's width according to it's contents
13131		extractLink: false,
13132		customClass: '',
13133		linkCustomClass: '',
13134		ddCustomClass: '',
13135		ddMaxHeight: 200,
13136		filter: false,
13137		nothingFoundText: 'Nothing found',
13138		isDisabled: false,
13139		onInit: function() {},
13140		onShow: function () {},
13141		onHide: function () {},
13142		onKeyUp: function () {},
13143		onKeyDown: function () {},
13144		onHoverMove: function () {}
13145	};
13146
13147	var instOpened; // instance of the currently opened select
13148
13149	// browser detection part was taken from jQuery migrate
13150	// https://github.com/jquery/jquery-migrate/blob/e6bda6a84c294eb1319fceb48c09f51042c80892/src/core.js
13151	var uaMatch = function (ua) {
13152		ua = ua.toLowerCase();
13153
13154		var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
13155			/(webkit)[ \/]([\w.]+)/.exec(ua) ||
13156			/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
13157			/(msie) ([\w.]+)/.exec(ua) ||
13158			ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
13159			[];
13160
13161		return {
13162			browser: match[1] || '',
13163			version: match[2] || '0'
13164		};
13165	};
13166
13167	if (! $.browser) {
13168		var matched = uaMatch(navigator.userAgent);
13169		var browser = {};
13170
13171		if (matched.browser) {
13172			browser[matched.browser] = true;
13173			browser.version = matched.version;
13174		}
13175
13176		if (browser.chrome) {
13177			browser.webkit = true;
13178		} else if (browser.webkit) {
13179			browser.safari = true;
13180		}
13181
13182		$.browser = browser;
13183	}
13184
13185	$.browser.mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile/i.test(navigator.userAgent);
13186	$.browser.operamini = Object.prototype.toString.call(window.operamini) === "[object OperaMini]";
13187
13188	function IkSelect(element, options) {
13189		var dataOptions = {}; // parsed data- attributes
13190
13191		this.el = element;
13192		this.$el = $(element); // original select
13193
13194		for (var key in defaults) {
13195			dataOptions[key] = this.$el.data(key.toLowerCase());
13196		}
13197
13198		this.options = $.extend({}, defaults, options, dataOptions);
13199
13200		if ($.browser.mobile) {
13201			this.options.filter = false;
13202		}
13203
13204		this.init();
13205	}
13206
13207	$.extend(IkSelect.prototype, {
13208		init: function () {
13209			this.$wrapper = $('<div class="ik_select">' + this.options.syntax + '</div>'); // wrapper for the fake select and the fake dropdown
13210			this.$link = $('.ik_select_link', this.$wrapper); // fake select
13211			this.$linkText = $('.ik_select_link_text', this.$wrapper); // fake select's text
13212			this.$dropdown = $('.ik_select_dropdown', this.$wrapper); // fake dropdown
13213			this.$list = $('.ik_select_list', this.$wrapper); // options list inside the fake dropdown
13214			this.$listInner = $('<div class="ik_select_list_inner"/>'); // support dropdown for scrolling
13215			this.$active = $([]); // active fake option
13216			this.$hover = $([]); // hovered fake option
13217			this.hoverIndex = 0; // hovered fake option's index
13218
13219			this.$optionSet = $([]);
13220			this.$optgroupSet = $([]);
13221
13222			this.$list.append(this.$listInner);
13223
13224			if (this.options.filter) {
13225				this.$filter = $([]); // filter text input
13226				this.$optionSetOriginal = $([]); // contains original list items when filtering
13227				this.$nothingFoundText = $('<div class="ik_select_nothing_found"/>').html(this.options.nothingFoundText);
13228				this.$filterWrap = $('.ik_select_filter_wrap', this.$wrapper);
13229
13230				if (! this.$filterWrap.length) {
13231					this.$filterWrap = $('<div class="ik_select_filter_wrap"/>');
13232				}
13233
13234				this.$filter = $('<input type="text" class="ik_select_filter">');
13235
13236				this.$filterWrap.append(this.$filter);
13237				this.$list.prepend(this.$filterWrap);
13238
13239				this.$filter.on({
13240					// keyboard controls should work even if the filter is in focus
13241					'keydown.ikSelect keyup.ikSelect': $.proxy(this, '_elKeyUpDown'),
13242					// actual filtering happens on keyup
13243					'keyup.ikSelect': $.proxy(this, '_filterKeyup')
13244				});
13245			}
13246
13247			this.$wrapper.addClass(this.options.customClass);
13248			this.$link.addClass(this.options.linkCustomClass || (this.options.customClass && this.options.customClass + '-link'));
13249			this.$dropdown.addClass(this.options.ddCustomClass || (this.options.customClass && this.options.customClass + '-dd'));
13250
13251			// creating fake option list
13252			this.reset();
13253
13254			// disable select if an option or attribute are truthy
13255			this.toggle(!(this.options.isDisabled || this.$el.prop('disabled') || this.$el.hasClass('hidden')));
13256
13257			// click event for fake select
13258			this.$link.on('click.ikSelect', $.proxy(this, '_linkClick'));
13259
13260			this.$el.on({
13261				// when focus is on the original select add a focus class to the fake one
13262				'focus.ikSelect': $.proxy(this, '_elFocus'),
13263				// when focus lost remove the focus class from the fake one
13264				'blur.ikSelect': $.proxy(this, '_elBlur'),
13265				// make sure that the fake select shows correct data
13266				'change.ikSelect': $.proxy(this, '_syncOriginalOption'),
13267				// keyboard controls for the fake select
13268				'keydown.ikSelect keyup.ikSelect': $.proxy(this, '_elKeyUpDown')
13269			});
13270
13271			this.$list.on({
13272				'click.ikSelect': $.proxy(this, '_optionClick'),
13273				'mouseover.ikSelect': $.proxy(this, '_optionMouseover')
13274			}, '.ik_select_option');
13275
13276			// stop propagation of click events on the wrapper
13277			this.$wrapper.on('click', function () {
13278				return false;
13279			});
13280
13281			// appending the fake select right after the original one
13282			this.$el.after(this.$wrapper);
13283
13284			// set correct dimensions
13285			this.redraw();
13286
13287			// move original select inside the wrapper
13288			this.$el.appendTo(this.$wrapper);
13289
13290			this.options.onInit(this);
13291			this.$el.trigger('ikinit', this);
13292		},
13293
13294		// click listener for fake select
13295		_linkClick: function () {
13296			if (this.isDisabled) {
13297				return;
13298			}
13299			if (this === instOpened) {
13300				this.hideDropdown();
13301			} else {
13302				this.showDropdown();
13303			}
13304
13305		},
13306
13307		// click listener for the fake options
13308		_optionClick: function () {
13309			this._makeOptionActive(this.searchIndexes ? this.$optionSetOriginal.index(this.$hover) : this.hoverIndex, true);
13310			this.hideDropdown();
13311			this.$el.change().focus();
13312		},
13313
13314		// hover listener for the fake options
13315		_optionMouseover: function (event) {
13316			var $option = $(event.currentTarget);
13317			if ($option.hasClass('ik_select_option_disabled')) {
13318				return;
13319			}
13320			this.$hover.removeClass('ik_select_hover');
13321			this.$hover = $option.addClass('ik_select_hover');
13322			this.hoverIndex = this.$optionSet.index(this.$hover);
13323		},
13324
13325		// makes fake option active without syncing the original select
13326		_makeOptionActive: function (index, shouldSync) {
13327			var $option = $(this.el.options[index]),
13328				text='';
13329			if($option.data('img_src')){
13330				text+='<span class="icon_color" style="background: url('+$option.data('img_src')+')"></span>';
13331				this.$link.addClass('img');
13332			}
13333			if($option.attr('title')){
13334				this.$link.attr('title', $option.attr('title'));
13335			}
13336			text+=$option.text();
13337			this.$linkText.html(text);
13338
13339			this.$link.toggleClass('ik_select_link_novalue', !$option.attr('value'));
13340
13341			this.$hover.removeClass('ik_select_hover');
13342			this.$active.removeClass('ik_select_active');
13343			this.$hover = this.$active = this.$optionSet.eq(index).addClass('ik_select_hover ik_select_active');
13344			this.hoverIndex = index;
13345
13346			if (shouldSync) {
13347				this._syncFakeOption();
13348			}
13349		},
13350
13351		// keyboard controls for the fake select
13352		_elKeyUpDown: function (event) {
13353			var $handle = $(event.currentTarget);
13354			var type = event.type;
13355			var keycode = event.which;
13356			var newTop;
13357
13358			switch (keycode) {
13359			case 38: // up
13360				if (type === 'keydown') {
13361					event.preventDefault();
13362					this._moveToPrevActive();
13363				}
13364				break;
13365			case 40: // down
13366				if (type === 'keydown') {
13367					event.preventDefault();
13368					this._moveToNextActive();
13369				}
13370				break;
13371			case 33: // page up
13372				if (type === 'keydown') {
13373					event.preventDefault();
13374					newTop = this.$hover.position().top - this.$listInner.height();
13375					this._moveToPrevActive(function (optionTop) {
13376						return optionTop <= newTop;
13377					});
13378				}
13379				break;
13380			case 34: // page down
13381				if (type === 'keydown') {
13382					event.preventDefault();
13383					newTop = this.$hover.position().top + this.$listInner.height();
13384					this._moveToNextActive(function (optionTop) {
13385						return optionTop >= newTop;
13386					});
13387				}
13388				break;
13389			case 36: // home
13390				if (type === 'keydown' && $handle.is(this.$el)) {
13391					event.preventDefault();
13392					this._moveToFirstActive();
13393				}
13394				break;
13395			case 35: // end
13396				if (type === 'keydown' && $handle.is(this.$el)) {
13397					event.preventDefault();
13398					this._moveToLastActive();
13399				}
13400				break;
13401			case 32: // space
13402				if (type === 'keydown' && $handle.is(this.$el)) {
13403					event.preventDefault();
13404					if (! this.$dropdown.is(':visible')) {
13405						this._linkClick();
13406					} else {
13407						this.$hover.click();
13408					}
13409				}
13410				break;
13411			case 13: // enter
13412				if (type === 'keydown' && this.$dropdown.is(':visible')) {
13413					event.preventDefault();
13414					this.$hover.click();
13415				}
13416				break;
13417			case 27: // esc
13418				if (type === 'keydown' && this.$dropdown.is(':visible')) {
13419					event.preventDefault();
13420					this.hideDropdown();
13421				}
13422				break;
13423			case 9: // tab
13424				if (type === 'keydown') {
13425					if ($.browser.webkit && this.$dropdown.is(':visible')) {
13426						event.preventDefault();
13427					} else {
13428						this.hideDropdown();
13429					}
13430				}
13431				break;
13432			default:
13433				if (type === 'keyup' && $handle.is(this.$el)) {
13434					this._syncOriginalOption();
13435				}
13436				break;
13437			}
13438
13439			// mozilla ignores preventDefault for select navigation
13440			// this ensures that original select is in sync
13441			if (type === 'keyup' && $.browser.mozilla) {
13442				this._syncFakeOption();
13443			}
13444
13445			if (type === 'keydown') {
13446				this.options.onKeyDown(this, keycode);
13447				this.$el.trigger('ikkeydown', [this, keycode]);
13448			}
13449			if (type === 'keyup') {
13450				this.options.onKeyUp(this, keycode);
13451				this.$el.trigger('ikkeyup', [this, keycode]);
13452			}
13453		},
13454
13455		// controls hover/active states for options and makes selected with keyboard options fully visible
13456		_moveTo: function (index) {
13457			var optionTopLine, optionBottomLine;
13458			var $optgroup;
13459
13460			if (!this.$dropdown.is(':visible') && $.browser.webkit) {
13461				this.showDropdown();
13462				return this;
13463			}
13464
13465			if (!this.$dropdown.is(':visible') || $.browser.mozilla) {
13466				this._makeOptionActive(index, true);
13467			} else {
13468				this.$hover.removeClass('ik_select_hover');
13469				this.$hover = this.$optionSet.eq(index).addClass('ik_select_hover');
13470				this.hoverIndex = index;
13471			}
13472
13473			// make option fully visible
13474			optionTopLine = this.$hover.position().top;
13475			optionBottomLine = optionTopLine + this.$active.outerHeight();
13476			// make optgroup label visible if first option witin this optgroup is hovered
13477			if (!this.$hover.index()) {
13478				$optgroup = this.$hover.closest('.ik_select_optgroup');
13479				if ($optgroup.length) {
13480					optionTopLine = $optgroup.position().top;
13481				}
13482			}
13483			if (optionBottomLine > this.$listInner.height()) {
13484				this.$listInner.scrollTop(this.$listInner.scrollTop() + optionBottomLine - this.$listInner.height());
13485			} else if (optionTopLine < 0) {
13486				this.$listInner.scrollTop(this.$listInner.scrollTop() + optionTopLine);
13487			}
13488
13489			this.options.onHoverMove(this);
13490			this.$el.trigger('ikhovermove', this);
13491		},
13492
13493		_moveToFirstActive: function () {
13494			for (var i = 0; i < this.$optionSet.length; i++) {
13495				if (!this.$optionSet.eq(i).hasClass('ik_select_option_disabled')) {
13496					this._moveTo(i);
13497					break;
13498				}
13499			}
13500		},
13501
13502		_moveToLastActive: function () {
13503			for (var i = this.$optionSet.length - 1; i >= 0; i++) {
13504				if (!this.$optionSet.eq(i).hasClass('ik_select_option_disabled')) {
13505					this._moveTo(i);
13506					break;
13507				}
13508			}
13509		},
13510
13511		_moveToPrevActive: function (condition) {
13512			var $option;
13513			for (var i = this.hoverIndex - 1; i >= 0; i--) {
13514				$option = this.$optionSet.eq(i);
13515				if (!$option.hasClass('ik_select_option_disabled') && (typeof condition === 'undefined' || condition($option.position().top))) {
13516					this._moveTo(i);
13517					break;
13518				}
13519			}
13520		},
13521
13522		_moveToNextActive: function (condition) {
13523			var $option;
13524			for (var i = this.hoverIndex + 1; i < this.$optionSet.length; i++) {
13525				$option = this.$optionSet.eq(i);
13526				if (!$option.hasClass('ik_select_option_disabled') && (typeof condition === 'undefined' || condition($option.position().top))) {
13527					this._moveTo(i);
13528					break;
13529				}
13530			}
13531		},
13532
13533		// when focus is on the original select add a focus class to the fake one
13534		_elFocus:  function () {
13535			var wrapperOffsetTop, wrapperHeight, windowScrollTop, windowHeight;
13536			if (this.isDisabled) {
13537				return this;
13538			}
13539			this.$link.addClass('ik_select_link_focus');
13540
13541			// scroll the window so that focused select is visible
13542			wrapperOffsetTop = this.$wrapper.offset().top;
13543			wrapperHeight = this.$wrapper.height();
13544			windowScrollTop = $window.scrollTop();
13545			windowHeight = $window.height();
13546			if ((wrapperOffsetTop + wrapperHeight > windowScrollTop + windowHeight) ||
13547				(wrapperOffsetTop < windowScrollTop)) {
13548				$window.scrollTop(wrapperOffsetTop - windowHeight / 2);
13549			}
13550		},
13551
13552		// when focus lost remove the focus class from the fake one
13553		_elBlur: function () {
13554			this.$link.removeClass('ik_select_link_focus');
13555		},
13556
13557		// filtering on key up
13558		_filterKeyup: function () {
13559			var filterVal = $.trim(this.$filter.val());
13560			var filterValOld;
13561			this.$listInner.show();
13562
13563			if (typeof this.searchIndexes === 'undefined') {
13564				this.$optionSetOriginal = this.$optionSet;
13565				this.searchIndexes = $.makeArray(this.$optionSet.map(function (optionIndex, option) {
13566					return $(option).text().toLowerCase();
13567				}));
13568			}
13569
13570			if (filterVal !== filterValOld) {
13571				if (filterVal === '') {
13572					this.$optionSet = this.$optionSetOriginal.show();
13573					this.$optgroupSet.show();
13574					this.$nothingFoundText.remove();
13575				} else {
13576					this.$optionSet = $([]);
13577					this.$optgroupSet.show();
13578					this.$optionSetOriginal.each($.proxy(function (optionIndex, option) {
13579						var $option = $(option);
13580						if (this.searchIndexes[optionIndex].indexOf(filterVal.toLowerCase()) >= 0) {
13581							this.$optionSet = this.$optionSet.add($option);
13582							$option.show();
13583						} else {
13584							$option.hide();
13585						}
13586					}, this));
13587
13588					if (this.$optionSet.length) {
13589						this.$nothingFoundText.remove();
13590						this.$optgroupSet.each(function (optgroupIndex, optgroup) {
13591							var $optgroup = $(optgroup);
13592							if (!$('.ik_select_option:visible', $optgroup).length) {
13593								$optgroup.hide();
13594							}
13595						});
13596
13597						if (!this.$hover.is(':visible')) {
13598							this._moveToFirstActive();
13599						}
13600					} else {
13601						this.$listInner.hide();
13602						this.$list.append(this.$nothingFoundText);
13603					}
13604				}
13605
13606				filterValOld = filterVal;
13607			}
13608		},
13609
13610		// sync selected option in the fake select with the original one
13611		_syncFakeOption: function () {
13612			this.el.selectedIndex = this.hoverIndex;
13613		},
13614
13615		// sync selected option in the original select with the fake one
13616		_syncOriginalOption: function () {
13617			this._makeOptionActive(this.el.selectedIndex);
13618		},
13619
13620		// sets fixed height to dropdown if it's bigger than ddMaxHeight
13621		_fixHeight: function () {
13622			this.$dropdown.show();
13623			this.$listInner.css('height', 'auto');
13624			if (this.$listInner.height() > this.options.ddMaxHeight) {
13625				this.$listInner.css({
13626					overflow: 'auto',
13627					height: this.options.ddMaxHeight,
13628					position: 'relative'
13629				});
13630			}
13631			this.$dropdown.hide();
13632		},
13633
13634		// calculates the needed data for showing the dropdown
13635		redraw: function () {
13636			var maxWidthOuter, scrollbarWidth, wrapperParentWidth;
13637
13638			if (this.options.filter) {
13639				this.$filter.hide();
13640			}
13641
13642			this.$wrapper.css({
13643				position: 'relative'
13644			});
13645			this.$dropdown.css({
13646				position: 'absolute',
13647				zIndex: 9998,
13648				width: '100%'
13649			});
13650			this.$list.css({
13651				position: 'relative'
13652			});
13653
13654			this._fixHeight();
13655
13656			// width calculations for the fake select when "autoWidth" is "true"
13657			if (this.options.dynamicWidth || this.options.autoWidth || this.options.ddFullWidth) {
13658				this.$wrapper.width('');
13659
13660				this.$dropdown.show().width(9999);
13661				this.$listInner.css('float', 'left');
13662				this.$list.css('float', 'left');
13663				maxWidthOuter = this.$list.outerWidth(true);
13664				scrollbarWidth = this.$listInner.width() - this.$listInnerUl.width();
13665				this.$list.css('float', '');
13666				this.$listInner.css('float', '');
13667				this.$dropdown.css('width', '100%');
13668
13669				if (this.options.ddFullWidth) {
13670					this.$dropdown.width(maxWidthOuter + scrollbarWidth);
13671				}
13672
13673				if (this.options.dynamicWidth) {
13674					this.$wrapper.css({
13675						display: 'inline-block',
13676						width: 'auto',
13677						verticalAlign: 'top'
13678					});
13679				} else if (this.options.autoWidth) {
13680					this.$wrapper.width(maxWidthOuter + (this.options.equalWidths ? scrollbarWidth : 0)).addClass('ik_select_autowidth');
13681				}
13682
13683				wrapperParentWidth = this.$wrapper.parent().width();
13684				if (this.$wrapper.width() > wrapperParentWidth) {
13685					this.$wrapper.width(wrapperParentWidth);
13686				}
13687			}
13688
13689			if (this.options.filter) {
13690				this.$filter.show().outerWidth(this.$filterWrap.width());
13691			}
13692
13693			this.$dropdown.hide();
13694
13695			// hide the original select
13696			this.$el.css({
13697				position: 'absolute',
13698				margin: 0,
13699				padding: 0,
13700				top: 0,
13701				left: -9999
13702			});
13703
13704			// show the original select in mobile browsers
13705			if ($.browser.mobile) {
13706				this.$el.css({
13707					opacity: 0,
13708					left: 0,
13709					height: this.$wrapper.height(),
13710					width: this.$wrapper.width()
13711				});
13712			}
13713		},
13714
13715		// creates or recreates dropdown and sets selected options's text into fake select
13716		reset: function () {
13717			var html = '';
13718
13719			// init fake select's text
13720			this.$linkText.html(this.$el.val());
13721
13722			this.$listInner.empty();
13723
13724			// creating an ul>li list identical to the original dropdown
13725			html = '<ul>';
13726			this.$el.children().each($.proxy(function (childIndex, child) {
13727				var $child = $(child);
13728				var tagName = child.tagName.toLowerCase();
13729				var options;
13730				if (tagName === 'optgroup') {
13731					options = $child.children().map($.proxy(function (optionIndex, option) {
13732						return this._generateOptionObject($(option));
13733					}, this));
13734					options = $.makeArray(options);
13735					html += this._renderListOptgroup({
13736						label: $child.attr('label') || '&nbsp;',
13737						isDisabled: $child.is(':disabled'),
13738						options: options
13739					});
13740				} else if (tagName === 'option') {
13741					html += this._renderListOption(this._generateOptionObject($child));
13742				}
13743			}, this));
13744			html += '</ul>';
13745			this.$listInner.append(html);
13746			this._syncOriginalOption();
13747
13748			this.$listInnerUl = $('> ul', this.$listInner);
13749			this.$optgroupSet = $('.ik_select_optgroup', this.$listInner);
13750			this.$optionSet = $('.ik_select_option', this.$listInner);
13751		},
13752
13753		// hides dropdown
13754		hideDropdown: function () {
13755			if (this.options.filter) {
13756				this.$filter.val('');
13757				this._filterKeyup();
13758			}
13759
13760			this.$dropdown.hide().appendTo(this.$wrapper).css({
13761				'left': '',
13762				'top': ''
13763			});
13764			if (this.options.extractLink) {
13765				this.$wrapper.outerWidth(this.$wrapper.data('outerWidth'));
13766				this.$wrapper.height('');
13767				this.$link.removeClass('ik_select_link_extracted').css({
13768					position: '',
13769					top: '',
13770					left: '',
13771					zIndex: ''
13772				}).prependTo(this.$wrapper);
13773			}
13774			instOpened = null;
13775			this.$el.focus();
13776
13777			this.options.onHide(this);
13778			this.$el.trigger('ikhide', this);
13779		},
13780
13781		// shows dropdown
13782		showDropdown: function () {
13783			var dropdownOffset, dropdownOuterWidth, dropdownOuterHeight;
13784			var wrapperOffset, wrapperOuterWidth;
13785			var windowWidth, windowHeight, windowScroll;
13786			var linkOffset;
13787
13788			if (instOpened === this || !this.$optionSet.length) {
13789				return;
13790			} else if (instOpened) {
13791				instOpened.hideDropdown();
13792			}
13793
13794			this._syncOriginalOption();
13795			if($('.show_un_props').length)
13796				this.$dropdown.addClass('show_un_props');
13797			else if($('.unshow_un_props').length)
13798				this.$dropdown.addClass('unshow_un_props');
13799			this.$dropdown.show();
13800
13801			dropdownOffset = this.$dropdown.offset();
13802			dropdownOuterWidth = this.$dropdown.outerWidth(true);
13803			dropdownOuterHeight = this.$dropdown.outerHeight(true);
13804			wrapperOffset = this.$wrapper.offset();
13805			windowWidth = $window.width();
13806			windowHeight = $window.height();
13807			windowScroll = $window.scrollTop();
13808
13809			// if the dropdown's right border is beyond window's edge then move the dropdown to the left so that it fits
13810			if (this.options.ddFullWidth && wrapperOffset.left + dropdownOuterWidth > windowWidth) {
13811				dropdownOffset.left = windowWidth - dropdownOuterWidth;
13812			}
13813
13814			// if the dropdown's bottom border is beyond window's edge then move the dropdown to the top so that it fits
13815			if (dropdownOffset.top + dropdownOuterHeight > windowScroll + windowHeight) {
13816				dropdownOffset.top = windowScroll + windowHeight - dropdownOuterHeight;
13817			}
13818
13819			this.$dropdown.css({
13820				left: dropdownOffset.left,
13821				top: dropdownOffset.top,
13822				width: this.$dropdown.width()
13823			}).appendTo('body');
13824
13825			if (this.options.extractLink) {
13826				linkOffset = this.$link.offset();
13827				wrapperOuterWidth = this.$wrapper.outerWidth();
13828				this.$wrapper.data('outerWidth', wrapperOuterWidth);
13829				this.$wrapper.outerWidth(wrapperOuterWidth);
13830				this.$wrapper.outerHeight(this.$wrapper.outerHeight());
13831				this.$link.outerWidth(this.$link.outerWidth());
13832				this.$link.addClass('ik_select_link_extracted').css({
13833					position: 'absolute',
13834					top: linkOffset.top,
13835					left: linkOffset.left,
13836					zIndex: 9999
13837				}).appendTo('body');
13838			}
13839
13840			this.$listInner.scrollTop(this.$active.position().top - this.$list.height() / 2);
13841
13842			if (this.options.filter) {
13843				this.$filter.focus();
13844			} else {
13845				this.$el.focus();
13846			}
13847
13848			instOpened = this;
13849
13850			this.options.onShow(this);
13851			this.$el.trigger('ikshow', this);
13852		},
13853
13854		_generateOptionObject: function ($option) {
13855			
13856			return {
13857				value: $option.val(),
13858				label: $option.html() || '&nbsp;',
13859				isDisabled: $option.is(':disabled'),
13860				dataParam: $option.data(),
13861				className: $option.attr('class'),
13862				title: $option.attr('title')
13863			};
13864		},
13865
13866		// generates option code for the fake dropdown
13867		_renderListOption: function (option) {
13868			var html;
13869			var disabledClass = option.isDisabled ? ' ik_select_option_disabled' : '';
13870			var imgClass = option.dataParam.img_src ? ' img' : '';
13871			var missingClass = option.className=='hidden' ? ' missing' : '';
13872			var title = option.title;
13873			html = '<li class="ik_select_option' + disabledClass + imgClass + missingClass + '" title="'+title+'" data-value="' + option.value + '">';
13874			html += '<span class="ik_select_option_label" title="'+title+'">';
13875			if(option.dataParam.img_src){
13876				html += '<span class="icon_color" style="background: url('+option.dataParam.img_src+')"></span>';
13877			}
13878			html += option.label;
13879			html += '</span>';
13880			html += '</li>';
13881			return html;
13882		},
13883
13884		// generates optgroup code for the fake dropdown
13885		_renderListOptgroup: function (optgroup) {
13886			var html;
13887			var disabledClass = optgroup.isDisabled ? ' ik_select_optgroup_disabled' : '';
13888			html = '<li class="ik_select_optgroup' + disabledClass + '">';
13889			html += '<div class="ik_select_optgroup_label">' + optgroup.label + '</div>';
13890			html += '<ul>';
13891			if ($.isArray(optgroup.options)) {
13892				$.each(optgroup.options, $.proxy(function (optionIndex, option) {
13893					html += this._renderListOption({
13894						value: option.value,
13895						label: option.label || '&nbsp;',
13896						isDisabled: option.isDisabled
13897					});
13898				}, this));
13899			}
13900			html += '</ul>';
13901			html += '</li>';
13902			return html;
13903		},
13904
13905		// generates option code for the select
13906		_renderOption: function (option) {
13907			return '<option value="' + option.value + '">' + option.label + '</option>';
13908		},
13909
13910		// generates optgroup code for the select
13911		_renderOptgroup: function (optgroup) {
13912			var html;
13913			html = '<optgroup label="' + optgroup.label + '">';
13914			if ($.isArray(optgroup.options)) {
13915				$.each(optgroup.options, $.proxy(function (optionIndex, option) {
13916					html += this._renderOption(option);
13917				}, this));
13918			}
13919			html += '</option>';
13920			return html;
13921		},
13922
13923		addOptions: function (options, optionIndex, optgroupIndex) {
13924			var listHtml = '', selectHtml = '';
13925			var $destinationUl = this.$listInnerUl;
13926			var $destinationOptgroup = this.$el;
13927			var $ulOptions, $optgroupOptions;
13928
13929			options = $.isArray(options) ? options : [options];
13930
13931			$.each(options, $.proxy(function (index, option) {
13932				listHtml += this._renderListOption(option);
13933				selectHtml += this._renderOption(option);
13934			}, this));
13935
13936			if ($.isNumeric(optgroupIndex) && optgroupIndex < this.$optgroupSet.length) {
13937				$destinationUl = this.$optgroupSet.eq(optgroupIndex);
13938				$destinationOptgroup = $('optgroup', this.$el).eq(optgroupIndex);
13939			}
13940			if ($.isNumeric(optionIndex)) {
13941				$ulOptions = $('.ik_select_option', $destinationUl);
13942				if (optionIndex < $ulOptions.length) {
13943					$ulOptions.eq(optionIndex).before(listHtml);
13944					$optgroupOptions = $('option', $destinationOptgroup);
13945					$optgroupOptions.eq(optionIndex).before(selectHtml);
13946				}
13947			}
13948			if (!$optgroupOptions) {
13949				$destinationUl.append(listHtml);
13950				$destinationOptgroup.append(selectHtml);
13951			}
13952
13953			this.$optionSet = $('.ik_select_option', this.$listInner);
13954			this._fixHeight();
13955		},
13956
13957		addOptgroups: function (optgroups, optgroupIndex) {
13958			var listHtml = '', selectHtml = '';
13959			if (!optgroups) {
13960				return;
13961			}
13962			optgroups = $.isArray(optgroups) ? optgroups : [optgroups];
13963
13964			$.each(optgroups, $.proxy(function (optgroupIndex, optgroup) {
13965				listHtml += this._renderListOptgroup(optgroup);
13966				selectHtml += this._renderOptgroup(optgroup);
13967			}, this));
13968
13969			if ($.isNumeric(optgroupIndex) && optgroupIndex < this.$optgroupSet.length) {
13970				this.$optgroupSet.eq(optgroupIndex).before(listHtml);
13971				$('optgroup', this.$el).eq(optgroupIndex).before(selectHtml);
13972			} else {
13973				this.$listInnerUl.append(listHtml);
13974				this.$el.append(selectHtml);
13975			}
13976
13977			this.$optgroupSet = $('.ik_select_optgroup', this.$listInner);
13978			this.$optionSet = $('.ik_select_option', this.$listInner);
13979			this._fixHeight();
13980		},
13981
13982		removeOptions: function (optionIndexes, optgroupIndex) {
13983			var $removeList = $([]);
13984			var $listContext;
13985			var $selectContext;
13986
13987			if ($.isNumeric(optgroupIndex)) {
13988				if (optgroupIndex < 0) {
13989					$listContext = $('> .ik_select_option', this.$listInnerUl);
13990					$selectContext = $('> option', this.$el);
13991				} else if (optgroupIndex < this.$optgroupSet.length) {
13992					$listContext = $('.ik_select_option', this.$optgroupSet.eq(optgroupIndex));
13993					$selectContext = $('optgroup', this.$el).eq(optgroupIndex).find('option');
13994				}
13995			}
13996			if (!$listContext) {
13997				$listContext = this.$optionSet;
13998				$selectContext = $(this.el.options);
13999			}
14000
14001			if (!$.isArray(optionIndexes)) {
14002				optionIndexes = [optionIndexes];
14003			}
14004
14005			$.each(optionIndexes, $.proxy(function (index, optionIndex) {
14006				if (optionIndex < $listContext.length) {
14007					$removeList = $removeList.add($listContext.eq(optionIndex)).add($selectContext.eq(optionIndex));
14008				}
14009			}, this));
14010
14011			$removeList.remove();
14012			this.$optionSet = $('.ik_select_option', this.$listInner);
14013			this._syncOriginalOption();
14014			this._fixHeight();
14015		},
14016
14017		removeOptgroups: function (optgroupIndexes) {
14018			var $removeList = $([]);
14019			var $selectOptgroupSet = $('optgroup', this.el);
14020
14021			if (!$.isArray(optgroupIndexes)) {
14022				optgroupIndexes = [optgroupIndexes];
14023			}
14024
14025			$.each(optgroupIndexes, $.proxy(function (index, optgroupIndex) {
14026				if (optgroupIndex < this.$optgroupSet.length) {
14027					$removeList = $removeList.add(this.$optgroupSet.eq(optgroupIndex)).add($selectOptgroupSet.eq(optgroupIndex));
14028				}
14029			}, this));
14030
14031			$removeList.remove();
14032			this.$optionSet = $('.ik_select_option', this.$listInner);
14033			this.$optgroupSet = $('.ik_select_optgroup', this.$listInner);
14034			this._syncOriginalOption();
14035			this._fixHeight();
14036		},
14037
14038		// disable select
14039		disable: function () {
14040			this.toggle(false);
14041		},
14042
14043		// enable select
14044		enable: function () {
14045			this.toggle(true);
14046		},
14047
14048		// toggle select
14049		toggle: function (bool) {
14050			this.isDisabled = typeof bool !== 'undefined' ? !bool : !this.isDisabled;
14051			this.$el.prop('disabled', this.isDisabled);
14052			this.$link.toggleClass('ik_select_link_disabled', this.isDisabled);
14053		},
14054
14055		// make option selected by value
14056		select: function (value, isIndex) {
14057			if (!isIndex) {
14058				this.$el.val(value);
14059			} else {
14060				this.el.selectedIndex = value;
14061			}
14062			this._syncOriginalOption();
14063		},
14064
14065		disableOptgroups: function (optgroupIndexes) {
14066			this.toggleOptgroups(optgroupIndexes, false);
14067		},
14068
14069		enableOptgroups: function (optgroupIndexes) {
14070			this.toggleOptgroups(optgroupIndexes, true);
14071		},
14072
14073		toggleOptgroups: function (optgroupIndexes, bool) {
14074			if (!$.isArray(optgroupIndexes)) {
14075				optgroupIndexes = [optgroupIndexes];
14076			}
14077
14078			$.each(optgroupIndexes, $.proxy(function (index, optgroupIndex) {
14079				var isDisabled;
14080				var $optionSet, indexes = [], indexFirst;
14081				var $optgroup = $('optgroup', this.$el).eq(optgroupIndex);
14082				isDisabled = typeof bool !== 'undefined' ? bool : $optgroup.prop('disabled');
14083				$optgroup.prop('disabled', !isDisabled);
14084				this.$optgroupSet.eq(optgroupIndex).toggleClass('ik_select_optgroup_disabled', !isDisabled);
14085
14086				$optionSet = $('option', $optgroup);
14087				indexFirst = $(this.el.options).index($optionSet.eq(0));
14088				for (var i = indexFirst; i < indexFirst + $optionSet.length; i++) {
14089					indexes.push(i);
14090				}
14091				this.toggleOptions(indexes, true, isDisabled);
14092			}, this));
14093
14094			this._syncOriginalOption();
14095		},
14096
14097		disableOptions: function (lookupValues, isIndex) {
14098			this.toggleOptions(lookupValues, isIndex, false);
14099		},
14100
14101		enableOptions: function (lookupValues, isIndex) {
14102			this.toggleOptions(lookupValues, isIndex, true);
14103		},
14104
14105		toggleOptions: function (lookupValues, isIndex, bool) {
14106			var $selectOptionSet = $('option', this.el);
14107			if (!$.isArray(lookupValues)) {
14108				lookupValues = [lookupValues];
14109			}
14110
14111			var toggleOption = $.proxy(function ($option, optionIndex) {
14112				var isDisabled = typeof bool !== 'undefined' ? bool : $option.prop('disabled');
14113				$option.prop('disabled', !isDisabled);
14114				this.$optionSet.eq(optionIndex).toggleClass('ik_select_option_disabled', !isDisabled);
14115			}, this);
14116
14117			$.each(lookupValues, function (index, lookupValue) {
14118				if (!isIndex) {
14119					$selectOptionSet.each(function (optionIndex, option) {
14120						var $option = $(option);
14121						if ($option.val() === lookupValue) {
14122							toggleOption($option, optionIndex);
14123							return this;
14124						}
14125					});
14126				} else {
14127					toggleOption($selectOptionSet.eq(lookupValue), lookupValue);
14128				}
14129			});
14130
14131			this._syncOriginalOption();
14132		},
14133
14134		// detach plugin from the orignal select
14135		detach: function () {
14136			this.$el.off('.ikSelect').css({
14137				width: '',
14138				height: '',
14139				left: '',
14140				top: '',
14141				position: '',
14142				margin: '',
14143				padding: ''
14144			});
14145
14146			this.$wrapper.before(this.$el);
14147			this.$wrapper.remove();
14148			this.$el.removeData('plugin_ikSelect');
14149		}
14150	});
14151
14152	$.fn.ikSelect = function (options) {
14153		var args;
14154		//do nothing if opera mini
14155		if ($.browser.operamini) {
14156			return this;
14157		}
14158
14159		args = Array.prototype.slice.call(arguments, 1);
14160
14161		return this.each(function () {
14162			var plugin;
14163			if (!$.data(this, 'plugin_ikSelect')) {
14164				$.data(this, 'plugin_ikSelect', new IkSelect(this, options));
14165			} else if (typeof options === 'string') {
14166				plugin = $.data(this, 'plugin_ikSelect');
14167				if (typeof plugin[options] === 'function') {
14168					plugin[options].apply(plugin, args);
14169				}
14170			}
14171		});
14172	};
14173
14174	$.ikSelect = {
14175		extendDefaults: function (options) {
14176			$.extend(defaults, options);
14177		}
14178	};
14179
14180	$(document).bind('click.ikSelect', function () {
14181		if (instOpened) {
14182			instOpened.hideDropdown();
14183		}
14184	});
14185})(jQuery, window, document);
14186
14187/* End */
14188;
14189; /* Start:"a:4:{s:4:"full";s:84:"/local/templates/aspro_max_local/js/jquery.mobile.custom.touch.min.js?16201975697784";s:6:"source";s:69:"/local/templates/aspro_max_local/js/jquery.mobile.custom.touch.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
14190/*! jQuery Mobile v1.4.5 | Copyright 2010, 2014 jQuery Foundation, Inc. | jquery.org/license */
14191
14192(function(e,t,n){typeof define=="function"&&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){while(e&&typeof e.originalEvent!="undefined")e=e.originalEvent;return e}function N(t,n){var i=t.type,s,o,a,l,c,h,p,d,v;t=e.Event(t),t.type=n,s=t.originalEvent,o=e.event.props,i.search(/^(mouse|click)/)>-1&&(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)>-1&&!t.which&&(t.which=1);if(i.search(/^touch/)!==-1){a=T(s),i=a.touches,c=a.changedTouches,h=i&&i.length?i[0]:c&&c.length?c[0]:r;if(h)for(d=0,v=u.length;d<v;d++)l=u[d],t[l]=h[l]}return t}function C(t){var n={},r,s;while(t){r=e.data(t,i);for(s in r)r[s]&&(n[s]=n.hasVirtualBinding=!0);t=t.parentNode}return n}function k(t,n){var r;while(t){r=e.data(t,i);if(r&&(!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;if(r&&r[t]||!r&&k(n.target,t))i=N(n,t),e(n.target).trigger(i);return i}function H(t){var n=e.data(t.target,s),r;!m&&(!E||E!==n)&&(r=P("v"+t.type,t),r&&(r.isDefaultPrevented()&&t.preventDefault(),r.isPropagationStopped()&&t.stopPropagation(),r.isImmediatePropagationStopped()&&t.stopImmediatePropagation()))}function B(t){var n=T(t).touches,r,i,o;n&&n.length===1&&(r=t.target,i=C(r),i.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)))}function j(e){if(g)return;
14192d||P("vmousecancel",e,C(e.target)),d=!0,_()}function F(t){if(g)return;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,d&&!r&&P("vmousecancel",t,s),P("vmousemove",t,s),_()}function I(e){if(g)return;A();var t=C(e.target),n,r;P("vmouseup",e,t),d||(n=P("vclick",e,t),n&&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(){q(this)||e.data(this,i,{});var r=e.data(this,i);r[t]=!0,l[t]=(l[t]||0)+1,l[t]===1&&b.bind(n,H),e(this).bind(n,R),y&&(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&&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:[],f=e.event.props.concat(a),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;e.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(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){i=t.clientX,o=t.clientY,S=e.vmouse.clickDistanceThreshold,u=r;while(u){for(a=0;a<n;a++){f=v[a],l=0;if(u===r&&Math.abs(f.x-i)<S&&Math.abs(f.y-o)<S||e.data(u,s)===f.touchID){t.preventDefault(),t.stopPropagation();return}}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){r=n,l(t,r?"scrollstart":"scrollstop",e)}var t=this,n=e(t),r,i;n.bind(o,function(t){if(!e.event.special.scrollstart.enabled)return;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?l(t,"tap",e):r&&e.preventDefault()}r=!1;if(s.which&&s.which!==1)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;if(e.pageY===0&&Math.floor(s)>Math.floor(e.pageY)||e.pageX===0&&Math.floor(i)>Math.floor(e.pageX))i-=n,s-=r;else if(s<e.pageY-r||i<e.pageX-n)i=e.pageX-n,s=e.pageY-r;return{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.
14192coords[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||(t={length:0},e.data(this,"mobile-events",t)),t.length++,t.swipe=s,s.start=function(t){if(e.event.special.swipe.eventInProgress)return;e.event.special.swipe.eventInProgress=!0;var r,o=e.event.special.swipe.start(t),u=t.target,l=!1;s.move=function(t){if(!o||t.isDefaultPrevented())return;r=e.event.special.swipe.stop(t),l||(l=e.event.special.swipe.handleSwipe(o,r,n,u),l&&(e.event.special.swipe.eventInProgress=!1)),Math.abs(o.coords[0]-r.coords[0])>e.event.special.swipe.scrollSupressionThreshold&&t.preventDefault()},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"),t&&(n=t.swipe,delete t.swipe,t.length--,t.length===0&&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)});
14193/* End */
14194;
14195; /* Start:"a:4:{s:4:"full";s:70:"/local/templates/aspro_max_local/js/jquery.dotdotdot.js?16201975695908";s:6:"source";s:55:"/local/templates/aspro_max_local/js/jquery.dotdotdot.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
14196!function(t,e){function n(t,e,n){var r=t.children(),o=!1;t.empty();for(var i=0,d=r.length;d>i;i++){var l=r.eq(i);if(t.append(l),n&&t.append(n),a(t,e)){l.remove(),o=!0;break}n&&n.detach()}return o}function r(e,n,i,d,l){var s=!1,c="a table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, blockquote, select, optgroup, option, textarea, script, style",u="script, .dotdotdot-keep";return e.contents().detach().each(function(){var f=this,h=t(f);if("undefined"==typeof f||3==f.nodeType&&0==t.trim(f.data).length)return!0;if(h.is(u))e.append(h);else{if(s)return!0;e.append(h),!l||h.is(d.after)||h.find(d.after).length||e[e.is(c)?"after":"append"](l),a(i,d)&&(s=3==f.nodeType?o(h,n,i,d,l):r(h,n,i,d,l),s||(h.detach(),s=!0)),s||l&&l.detach()}}),s}function o(e,n,r,o,d){var c=e[0];if(!c)return!1;var f=s(c),h=-1!==f.indexOf(" ")?" ":" ",p="letter"==o.wrap?"":h,g=f.split(p),v=-1,w=-1,y=0,b=g.length-1;for(o.fallbackToLetter&&0==y&&0==b&&(p="",g=f.split(p),b=g.length-1);b>=y&&(0!=y||0!=b);){var m=Math.floor((y+b)/2);if(m==w)break;w=m,l(c,g.slice(0,w+1).join(p)+o.ellipsis),a(r,o)?(b=w,o.fallbackToLetter&&0==y&&0==b&&(p="",g=g[0].split(p),v=-1,w=-1,y=0,b=g.length-1)):(v=w,y=w)}if(-1==v||1==g.length&&0==g[0].length){var T=e.parent();e.detach();var x=d&&d.closest(T).length?d.length:0;T.contents().length>x?c=u(T.contents().eq(-1-x),n):(c=u(T,n,!0),x||T.detach()),c&&(f=i(s(c),o),l(c,f),x&&d&&t(c).parent().append(d))}else f=i(g.slice(0,v+1).join(p),o),l(c,f);return!0}function a(t,e){return t.innerHeight()>e.maxHeight}function i(e,n){for(;t.inArray(e.slice(-1),n.lastCharacter.remove)>-1;)e=e.slice(0,-1);return t.inArray(e.slice(-1),n.lastCharacter.noEllipsis)<0&&(e+=n.ellipsis),e}function d(t){return{width:t.innerWidth(),height:t.innerHeight()}}function l(t,e){t.innerText?t.innerText=e:t.nodeValue?t.nodeValue=e:t.textContent&&(t.textContent=e)}function s(t){return t.innerText?t.innerText:t.nodeValue?t.nodeValue:t.textContent?t.textContent:""}function c(t){do t=t.previousSibling;while(t&&1!==t.nodeType&&3!==t.nodeType);return t}function u(e,n,r){var o,a=e&&e[0];if(a){if(!r){if(3===a.nodeType)return a;
vendor: 4,260 bytes, lines 14196-14210
14196if(t.trim(e.text()))return u(e.contents().last(),n)}for(o=c(a);!o;){if(e=e.parent(),e.is(n)||!e.length)return!1;o=c(e[0])}if(o)return u(t(o),n)}return!1}function f(e,n){return e?"string"==typeof e?(e=t(e,n),e.length?e:!1):e.jquery?e:!1:!1}function h(t){for(var e=t.innerHeight(),n=["paddingTop","paddingBottom"],r=0,o=n.length;o>r;r++){var a=parseInt(t.css(n[r]),10);isNaN(a)&&(a=0),e-=a}return e}if(!t.fn.dotdotdot){t.fn.dotdotdot=function(e){if(0==this.length)return t.fn.dotdotdot.debug('No element found for "'+this.selector+'".'),this;if(this.length>1)return this.each(function(){t(this).dotdotdot(e)});var o=this;o.data("dotdotdot")&&o.trigger("destroy.dot"),o.data("dotdotdot-style",o.attr("style")||""),o.css("word-wrap","break-word"),"nowrap"===o.css("white-space")&&o.css("white-space","normal"),o.bind_events=function(){return o.bind("update.dot",function(e,d){e.preventDefault(),e.stopPropagation(),l.maxHeight="number"==typeof l.height?l.height:h(o),l.maxHeight+=l.tolerance,"undefined"!=typeof d&&(("string"==typeof d||"nodeType"in d&&1===d.nodeType)&&(d=t("<div />").append(d).contents()),d instanceof t&&(i=d)),g=o.wrapInner('<div class="dotdotdot" />').children(),g.contents().detach().end().append(i.clone(!0)).find("br").replaceWith("  <br />  ").end().css({height:"auto",width:"auto",border:"none",padding:0,margin:0});var c=!1,u=!1;return s.afterElement&&(c=s.afterElement.clone(!0),c.show(),s.afterElement.detach()),a(g,l)&&(u="children"==l.wrap?n(g,l,c):r(g,o,g,l,c)),g.replaceWith(g.contents()),g=null,t.isFunction(l.callback)&&l.callback.call(o[0],u,i),s.isTruncated=u,u}).bind("isTruncated.dot",function(t,e){return t.preventDefault(),t.stopPropagation(),"function"==typeof e&&e.call(o[0],s.isTruncated),s.isTruncated}).bind("originalContent.dot",function(t,e){return t.preventDefault(),t.stopPropagation(),"function"==typeof e&&e.call(o[0],i),i}).bind("destroy.dot",function(t){t.preventDefault(),t.stopPropagation(),o.unwatch().unbind_events().contents().detach().end().append(i).attr("style",o.data("dotdotdot-style")||"").data("dotdotdot",!1)}),o},o.unbind_events=function(){return o.unbind(".dot"),o},o.watch=function(){if(o.unwatch(),"window"==l.watch){var e=t(window),n=e.width(),r=e.height();e.bind("resize.dot"+s.dotId,function(){n==e.width()&&r==e.height()&&l.windowResizeFix||(n=e.width(),r=e.height(),u&&clearInterval(u),u=setTimeout(function(){o.trigger("update.dot")},100))})}else c=d(o),u=setInterval(function(){if(o.is(":visible")){var t=d(o);(c.width!=t.width||c.height!=t.height)&&(o.trigger("update.dot"),c=t)}},500);return o},o.unwatch=function(){return t(window).unbind("resize.dot"+s.dotId),u&&clearInterval(u),o};var i=o.contents(),l=t.extend(!0,{},t.fn.dotdotdot.defaults,e),s={},c={},u=null,g=null;return l.lastCharacter.remove instanceof Array||(l.lastCharacter.remove=t.fn.dotdotdot.defaultArrays.lastCharacter.remove),l.lastCharacter.noEllipsis instanceof Array||(l.lastCharacter.noEllipsis=t.fn.dotdotdot.defaultArrays.lastCharacter.noEllipsis),s.afterElement=f(l.after,o),s.isTruncated=!1,s.dotId=p++,o.data("dotdotdot",!0).bind_events().trigger("update.dot"),l.watch&&o.watch(),o},t.fn.dotdotdot.defaults={ellipsis:"... ",wrap:"word",fallbackToLetter:!0,lastCharacter:{},tolerance:0,callback:null,after:null,height:null,watch:!1,windowResizeFix:!0},t.fn.dotdotdot.defaultArrays={lastCharacter:{remove:[" "," ",",",";",".","!","?"],noEllipsis:[]}},t.fn.dotdotdot.debug=function(t){};var p=1,g=t.fn.html;t.fn.html=function(n){return n!=e&&!t.isFunction(n)&&this.data("dotdotdot")?this.trigger("update",[n]):g.apply(this,arguments)};var v=t.fn.text;t.fn.text=function(n){return n!=e&&!t.isFunction(n)&&this.data("dotdotdot")?(n=t("<div />").text(n).html(),this.trigger("update",[n])):v.apply(this,arguments)}}}(jQuery);
14197/* End */
14198;
14199; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/aspro_max_local/js/rating_likes.js?162019756910797";s:6:"source";s:51:"/local/templates/aspro_max_local/js/rating_likes.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
14200if (!BXRL)
14201{
14202	var BXRL = {};
14203	var BXRLW = null;
14204}
14205
14206RatingLikes = function(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax)
14207{
14208	this.enabled = true;
14209	this.likeId = likeId;
14210	this.entityTypeId = entityTypeId;
14211	this.entityId = entityId;
14212	this.available = (available == 'Y');
14213	this.userId = userId;
14214	this.localize = localize;
14215	this.template = template;
14216	this.pathToUserProfile = pathToUserProfile;
14217	this.pathToAjax = typeof(pathToAjax) == "string"? pathToAjax: '/bitrix/components/bitrix/rating.vote/vote.ajax.php';
14218
14219	this.box = BX('bx-ilike-button-'+likeId);
14220	if (this.box === null)
14221	{
14222		this.enabled = false;
14223		return false;
14224	}
14225
14226	this.button = BX.findChild(this.box, {className:'bx-ilike-left-wrap'}, true, false);
14227	this.wrapp = BX.findChild(this.box, {className:'all-wrapper'}, true, false);
14228	this.buttonText = BX.findChild(this.button, {className:'bx-ilike-text'}, true, false);
14229	this.count = BX.findChild(this.box,  {tagName:'span', className:'bx-ilike-right-wrap'}, true, false);
14230	this.countText	= BX.findChild(this.count, {tagName:'span', className:'bx-ilike-right'}, true, false);
14231	this.popup = null;
14232	this.popupId = null;
14233	this.popupOpenId = null;
14234	this.popupTimeoutId = null;
14235	this.popupContent = BX.findChild(BX('bx-ilike-popup-cont-'+likeId), {tagName:'span', className:'bx-ilike-popup'}, true, false);
14236	this.popupContentPage = 1;
14237	this.popupListProcess = false;
14238	this.popupTimeout = false;
14239	this.likeTimeout = false;
14240
14241	this.lastVote = BX.hasClass(template == 'standart'? this.button: this.count, 'bx-you-like')? 'plus': 'cancel';
14242};
14243
14244RatingLikes.LiveUpdate = function(params)
14245{
14246	if (params.USER_ID == BX.message('USER_ID'))
14247		return false;
14248
14249	for(var i in BXRL)
14250	{
14251		if (BXRL.hasOwnProperty(i))
14252		{
14253			if (BXRL[i].entityTypeId == params.ENTITY_TYPE_ID && BXRL[i].entityId == params.ENTITY_ID)
14254			{
14255				var element = BXRL[i];
14256				element.countText.innerHTML = parseInt(params.TOTAL_POSITIVE_VOTES);
14257				element.count.insertBefore(
14258					BX.create("span", { props : { className : "bx-ilike-plus-one" }, style: {width: (element.countText.clientWidth-8)+'px', height: (element.countText.clientHeight-8)+'px'}, html: (params.TYPE == 'ADD'? '+1': '-1')})
14259					, element.count.firstChild);
14260
14261				if (element.popup)
14262				{
14263					element.popup.close();
14264					element.popupContentPage = 1;
14265				}
14266			}
14267		}
14268	}
14269};
14270
14271RatingLikes.Set = function(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax)
14272{
14273	if (template === undefined)
14274		template = 'standart';
14275
14276	if (!BXRL[likeId] || BXRL[likeId].tryToSet <= 5)
14277	{
14278		var tryToSend = BXRL[likeId] && BXRL[likeId].tryToSet? BXRL[likeId].tryToSet: 1;
14279		BXRL[likeId] = new RatingLikes(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax);
14280		if (BXRL[likeId].enabled)
14281		{
14282			RatingLikes.Init(likeId);
14283		}
14284		else
14285		{
14286			setTimeout(function(){
14287				BXRL[likeId].tryToSet = tryToSend+1;
14288				RatingLikes.Set(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax);
14289			}, 500);
14290		}
14291	}
14292};
14293
14294RatingLikes.Init = function(likeId)
14295{
14296	// like/unlike button
14297	if (BXRL[likeId].available)
14298	{
14299
14300		BX.bind(BXRL[likeId].template == 'standart'? BXRL[likeId].button: BXRL[likeId].buttonText, 'click' ,function(e) {
14301			clearTimeout(BXRL[likeId].likeTimeout);
14302			if (BX.hasClass(BXRL[likeId].template == 'standart'? this: BXRL[likeId].count, 'bx-you-like'))
14303			{
14304				BXRL[likeId].buttonText.innerHTML	=	BXRL[likeId].localize['LIKE_N'];
14305				BXRL[likeId].countText.innerHTML		= 	parseInt(BXRL[likeId].countText.innerHTML)-1;
14306				BX.removeClass(BXRL[likeId].template == 'standart'? this: BXRL[likeId].count, 'bx-you-like');
14307
14308				BXRL[likeId].likeTimeout = setTimeout(function(){
14309					if (BXRL[likeId].lastVote != 'cancel')
14310						RatingLikes.Vote(likeId, 'cancel');
14311				}, 1000);
14312			}
14313			else
14314			{
14315				BXRL[likeId].buttonText.innerHTML	=	BXRL[likeId].localize['LIKE_Y'];
14316				BXRL[likeId].countText.innerHTML 	= 	parseInt(BXRL[likeId].countText.innerHTML)+1;
14317				BX.addClass(BXRL[likeId].template == 'standart'? this: BXRL[likeId].count, 'bx-you-like');
14318
14319				BXRL[likeId].likeTimeout = setTimeout(function(){
14320					if (BXRL[likeId].lastVote != 'plus')
14321						RatingLikes.Vote(likeId, 'plus');
14322				}, 1000);
14323			}
14324			BX.removeClass(this.box, 'bx-ilike-button-hover');
14325			BX.PreventDefault(e);
14326		});
14327		// Hover/unHover like-button
14328		BX.bind(BXRL[likeId].box, 'mouseover', function() {BX.addClass(this, 'bx-ilike-button-hover')});
14329		BX.bind(BXRL[likeId].box, 'mouseout', function() {BX.removeClass(this, 'bx-ilike-button-hover')});
14330
14331	}
14332	else
14333	{
14334		if (BXRL[likeId].buttonText != undefined)
14335			BXRL[likeId].buttonText.innerHTML	=	BXRL[likeId].localize['LIKE_D'];
14336	}
14337	// get like-user-list
14338	RatingLikes.PopupScroll(likeId);
14339	console.log();
14340	BX.bind(BXRL[likeId].wrapp, 'mouseover' , function() {
14341		clearTimeout(BXRL[likeId].popupTimeoutId);
14342		BXRL[likeId].popupTimeoutId = setTimeout(function(){
14343			if (BXRLW == likeId)
14344				return false;
14345			if (BXRL[likeId].popupContentPage == 1)
14346				RatingLikes.List(likeId, 1);
14347			BXRL[likeId].popupTimeoutId = setTimeout(function() {
14348				RatingLikes.OpenWindow(likeId);
14349			}, 400);
14350		}, 400);
14351	});
14352	BX.bind(BXRL[likeId].wrapp, 'mouseout' , function() {
14353		clearTimeout(BXRL[likeId].popupTimeoutId);
14354	});
14355	/*BX.bind(BXRL[likeId].count, 'click' , function() {
14356		clearTimeout(BXRL[likeId].popupTimeoutId);
14357		if (BXRL[likeId].popupContentPage == 1)
14358			RatingLikes.List(likeId, 1);
14359		RatingLikes.OpenWindow(likeId);
14360	});*/
14361
14362	BX.bind(BXRL[likeId].box, 'mouseover' , function() {
14363		clearTimeout(BXRL[likeId].popupTimeout);
14364	});
14365	BX.bind(BXRL[likeId].box, 'mouseout' , function() {
14366		clearTimeout(BXRL[likeId].popupTimeout);
14367		BXRL[likeId].popupTimeout = setTimeout(function(){
14368			if (BXRL[likeId].popup !== null)
14369			{
14370				BXRL[likeId].popup.close();
14371				BXRLW = null;
14372			}
14373		}, 1000);
14374	});
14375};
14376
14377RatingLikes.OpenWindow = function(likeId)
14378{
14379	if (parseInt(BXRL[likeId].countText.innerHTML) == 0)
14380		return false;
14381
14382	if (BXRL[likeId].popup == null)
14383	{
14384		BXRL[likeId].popup = new BX.PopupWindow('ilike-popup-'+likeId, (BXRL[likeId].template == 'standart'? BXRL[likeId].count: BXRL[likeId].box), {
14385			lightShadow : true,
14386			offsetLeft: 5,
14387			autoHide: true,
14388			closeByEsc: true,
14389			zIndex: 2005,
14390			bindOptions: {position: "top"},
14391			events : {
14392				onPopupClose : function() { BXRLW = null; },
14393				onPopupDestroy : function() {  }
14394			},
14395			content : BX('bx-ilike-popup-cont-'+likeId)
14396		});
14397		BXRL[likeId].popup.setAngle({});
14398
14399		BX.bind(BX('ilike-popup-'+likeId), 'mouseout' , function() {
14400			clearTimeout(BXRL[likeId].popupTimeout);
14401			BXRL[likeId].popupTimeout = setTimeout(function(){
14402				BXRL[likeId].popup.close();
14403			}, 1000);
14404		});
14405
14406		BX.bind(BX('ilike-popup-'+likeId), 'mouseover' , function() {
14407			clearTimeout(BXRL[likeId].popupTimeout);
14408		});
14409	}
14410
14411	if (BXRLW != null)
14412		BXRL[BXRLW].popup.close();
14413
14414	BXRLW = likeId;
14415	BXRL[likeId].popup.show();
14416
14417	RatingLikes.AdjustWindow(likeId);
14418};
14419
14420RatingLikes.Vote = function(likeId, voteAction)
14421{
14422	BX.ajax({
14423		url: BXRL[likeId].pathToAjax,
14424		method: 'POST',
14425		dataType: 'json',
14426		data: {'RATING_VOTE' : 'Y', 'RATING_VOTE_TYPE_ID' : BXRL[likeId].entityTypeId, 'RATING_VOTE_ENTITY_ID' : BXRL[likeId].entityId, 'RATING_VOTE_ACTION' : voteAction, 'sessid': BX.bitrix_sessid()},
14427		onsuccess: function(data)	{
14428			BXRL[likeId].lastVote = data.action;
14429			BXRL[likeId].countText.innerHTML = data.items_all;
14430			BXRL[likeId].popupContentPage = 1;
14431
14432			BXRL[likeId].popupContent.innerHTML = '';
14433			spanTag0 = document.createElement("span");
14434			spanTag0.className = "bx-ilike-wait";
14435			BXRL[likeId].popupContent.appendChild(spanTag0);
14436			RatingLikes.AdjustWindow(likeId);
14437
14438			if(BX('ilike-popup-'+likeId) && BX('ilike-popup-'+likeId).style.display == "block")
14439				RatingLikes.List(likeId, null);
14440		},
14441		onfailure: function(data)	{}
14442	});
14443	return false;
14444};
14445
14446RatingLikes.List = function(likeId, page)
14447{
14448	if (parseInt(BXRL[likeId].countText.innerHTML) == 0)
14449		return false;
14450
14451	if (page == null)
14452		page = BXRL[likeId].popupContentPage;
14453	BXRL[likeId].popupListProcess = true;
14454	BX.ajax({
14455		url: BXRL[likeId].pathToAjax,
14456		method: 'POST',
14457		dataType: 'json',
14458		data: {'RATING_VOTE_LIST' : 'Y', 'RATING_VOTE_TYPE_ID' : BXRL[likeId].entityTypeId, 'RATING_VOTE_ENTITY_ID' : BXRL[likeId].entityId, 'RATING_VOTE_LIST_PAGE' : page, 'PATH_TO_USER_PROFILE' : BXRL[likeId].pathToUserProfile, 'sessid': BX.bitrix_sessid()},
14459		onsuccess: function(data)
14460		{
14461			BXRL[likeId].countText.innerHTML = data.items_all;
14462
14463			if ( parseInt(data.items_page) == 0 )
14464				return false;
14465
14466			if (page == 1)
14467			{
14468				BXRL[likeId].popupContent.innerHTML = '';
14469				spanTag0 = document.createElement("span");
14470				spanTag0.className = "bx-ilike-bottom_scroll";
14471				BXRL[likeId].popupContent.appendChild(spanTag0);
14472			}
14473			BXRL[likeId].popupContentPage += 1;
14474
14475			var avatarNode = null;
14476
14477			for (var i = 0; i < data.items.length; i++)
14478			{
14479				if (data.items[i]['PHOTO_SRC'].length > 0)
14480				{
14481					avatarNode = BX.create("IMG", {
14482						attrs: {src: data.items[i]['PHOTO_SRC']},
14483						props: {className: "bx-ilike-popup-avatar-img"}
14484					});
14485				}
14486				else
14487				{
14488					avatarNode = BX.create("IMG", {
14489						attrs: {src: '/bitrix/images/main/blank.gif'},
14490						props: {className: "bx-ilike-popup-avatar-img bx-ilike-popup-avatar-img-default"}
14491					});
14492				}
14493
14494				BXRL[likeId].popupContent.appendChild(
14495					BX.create("div", {
14496						/*attrs: {
14497							href: data.items[i]['URL'],
14498							target: '_blank'
14499						},*/
14500						props: {
14501							className: "bx-ilike-popup-img" + (!!data.items[i]['USER_TYPE'] ? " bx-ilike-popup-img-" + data.items[i]['USER_TYPE'] : "")
14502						},
14503						children: [
14504							BX.create("SPAN", {
14505								props: {
14506									className: "bx-ilike-popup-avatar-new"
14507								},
14508								children: [
14509									avatarNode,
14510									BX.create("SPAN", {
14511										props: {className: "bx-ilike-popup-avatar-status-icon"}
14512									})
14513								]
14514							}),
14515							BX.create("SPAN", {
14516								props: {
14517									className: "bx-ilike-popup-name-new"
14518								},
14519								html: data.items[i]['FULL_NAME']
14520							})
14521						]
14522					})
14523				);
14524			}
14525
14526			RatingLikes.AdjustWindow(likeId);
14527			RatingLikes.PopupScroll(likeId);
14528
14529			BXRL[likeId].popupListProcess = false;
14530		},
14531		onfailure: function(data)	{}
14532	});
14533	return false;
14534};
14535
14536RatingLikes.AdjustWindow = function(likeId)
14537{
14538	if (BXRL[likeId].popup != null)
14539	{
14540		BXRL[likeId].popup.bindOptions.forceBindPosition = true;
14541		BXRL[likeId].popup.adjustPosition();
14542		BXRL[likeId].popup.bindOptions.forceBindPosition = false;
14543	}
14544};
14545
14546RatingLikes.PopupScroll = function(likeId)
14547{
14548	BX.bind(BXRL[likeId].popupContent, 'scroll' , function() {
14549		if (this.scrollTop > (this.scrollHeight - this.offsetHeight) / 1.5)
14550		{
14551			RatingLikes.List(likeId, null);
14552			BX.unbindAll(this);
14553		}
14554	});
14555};
14556
14557/* End */
14558;
14559; /* Start:"a:4:{s:4:"full";s:66:"/local/templates/aspro_max_local/js/buy_services.js?16201975695654";s:6:"source";s:51:"/local/templates/aspro_max_local/js/buy_services.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
14560
14561$(document).on('click', '.services_in_product .switch_block label', function(){
14562    var $this = $(this);    
14563    var servItem = $this.closest('.services-item');
14564    var servBuyButton = servItem.find('.services-item__buy .button_block .to-cart');
14565    var switcherState = servItem.find('#'+$this.attr('for')).prop('checked');
14566    var parentProduct = $this.closest('.buy_services_wrap').attr('data-parent_product');
14567    
14568    if(servBuyButton.length) {
14569        if(switcherState){ 
14570            var basketItem = arBasketAspro.SERVICES[servItem.attr('data-item_id') + '_' + parentProduct];
14571            var currentWrapClasses = servItem.closest('.buy_services_wrap').attr('class');
14572            
14573            if(typeof(basketItem) != "undefined" && basketItem['basket_id']){
14574                $.ajax({
14575                    url: arAsproOptions['SITE_DIR'] + 'ajax/item.php?delete_basket_id='+basketItem['basket_id'],
14576                    type: 'post',
14577                    success: function(html) {
14578                        updateBasketInfoServices();
14579                        getActualBasket();                                                
14580                    }
14581                });
14582            } 
14583            $('.product-container .buy_services_wrap[data-parent_product='+ parentProduct +'] .services-item[data-item_id=' + servItem.attr('data-item_id')+']').removeClass('services_on');
14584            $('.product-container .buy_services_wrap[data-parent_product='+ parentProduct +'] .services-item[data-item_id=' + servItem.attr('data-item_id')+'] input[name="buy_switch_services"]').each(function (){
14585                var _th = $(this);
14586                if(_th.closest('.buy_services_wrap').attr('class') !== currentWrapClasses){
14587                    _th.prop('checked', false);
14588                }                    
14589                
14590            });            
14591        } else {
14592            var parentProductId =  arBasketAspro.BASKET[parentProduct];
14593            var currentWrapClasses = servItem.closest('.buy_services_wrap').attr('class');
14594            var isBasketPage = servItem.closest('.buy_services_wrap').hasClass('services_in_basket_page');
14595
14596            if(parentProductId || isBasketPage){
14597                servBuyButton[0].click();
14598            }
14599            $('.product-container .buy_services_wrap[data-parent_product='+ parentProduct +'] .services-item[data-item_id=' + servItem.attr('data-item_id')+']').addClass('services_on');
14600            $('.product-container .buy_services_wrap[data-parent_product='+ parentProduct +'] .services-item[data-item_id=' + servItem.attr('data-item_id')+'] input[name="buy_switch_services"]').each(function (){
14601                var _th = $(this);
14602                if(_th.closest('.buy_services_wrap').attr('class') !== currentWrapClasses){
14603                    _th.prop('checked', true);
14604                }
14605            });
14606        }
14607    }
14608});
14609
14610function updateBasketInfoServices (refreshBasket = true){
14611    var basketFly = $('#basket_line .basket_fly').length;
14612
14613    if(basketFly){
14614        $.ajax({
14615        url: arAsproOptions['SITE_DIR'] + 'ajax/basket_fly.php',
14616        type: 'post',
14617        success: function(html) {
14618            $('#basket_line .basket_fly').addClass('loaded').html(html);
14619            if(window.matchMedia('(min-width: 769px)').matches)
14620			{
14621                $('.opener .basket_count').removeClass('small')
14622                $('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass('cur');
14623                $('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass('cur');
14624                $("#basket_line .basket_fly .opener > div:eq(0)").addClass("cur");
14625            }
14626        }
14627        });
14628    } else if($("#ajax_basket").length){
14629        reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
14630        basketTop('', $('.basket_hover_block'));
14631    }
14632
14633    //for basket page
14634    if($('.wrapper1.basket_page').length && refreshBasket){
14635        BX.Sale.BasketComponent.sendRequest('refreshAjax', {
14636            fullRecalculation: 'Y',
14637            otherParams: {
14638               param: 'N'
14639            }
14640         });
14641    }
14642}
14643
14644$(document).on("change", ".services_in_product .counter_block input[type=text]", function(e){
14645    var $this = $(this);    
14646    var servItem = $this.closest('.services-item');
14647    var servBuyButton = servItem.find('.services-item__buy .button_block .to-cart');
14648    var parentProduct = $this.closest('.buy_services_wrap').attr('data-parent_product');
14649    var servCount = servItem.find('.counter_block  input.text').val();
14650
14651    $('.product-container .buy_services_wrap[data-parent_product='+ parentProduct +'] .services-item[data-item_id=' + servItem.attr('data-item_id')+'] .counter_block  input.text').val(servCount);
14652
14653    if(servBuyButton.length) {
14654        var basketItem = arBasketAspro.SERVICES[servItem.attr('data-item_id') + '_' + parentProduct];
14655        var quantity = $this.val();
14656
14657        if(typeof(basketItem) != "undefined" && basketItem['basket_id']){
14658            $.ajax({
14659                url: arAsproOptions['SITE_DIR'] + 'ajax/item.php?update_basket_id='+basketItem['basket_id'] + '&quantity=' + quantity,
14660                type: 'post',
14661                success: function(html) {
14662                    updateBasketInfoServices();
14663                    getActualBasket();
14664                }
14665            });
14666        }
14667    }
14668});
14669
14670$(document).on('click', '.services_in_product .more-services-slide', function(){
14671    var _this = $(this);
14672    var servWrap = _this.closest('.buy_services_wrap');
14673    servWrap.toggleClass('show_all');
14674    servWrap.hasClass('show_all') ? _this.find('>span').text(_this.attr('data-close')) : _this.find('>span').text(_this.attr('data-open'));
14675});
14676
14677
14678
14679/* End */
14680;
14681; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/aspro_max_local/js/video_banner.js?162019756931815";s:6:"source";s:51:"/local/templates/aspro_max_local/js/video_banner.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
14682var players = {};
14683
14684function pauseMainBanner(){
14685	$('.top_slider_wrapp .flexslider').flexslider('pause');
14686}
14687
14688function playMainBanner(){
14689	$('.top_slider_wrapp .flexslider').flexslider('play');
14690}
14691
14692function startMainBannerSlideVideo($slide){
14693	var slideActiveIndex = $slide.attr('data-slide_index')
14694	var $slides = $slide.closest('.slides').find('.box[data-slide_index="'+ slideActiveIndex +'"]') // current slide & cloned
14695	var videoSource = $slide.attr('data-video_source')
14696	if(videoSource){
14697		$slides.addClass('loading')
14698		pauseMainBanner()
14699
14700		var $slider = $slide.closest('.flexslider')
14701		$slider.addClass('video_visible')
14702		var slidesIndexesWithVideo = $slider.data('slidesIndexesWithVideo')
14703		if(typeof slidesIndexesWithVideo === 'undefined'){
14704			slidesIndexesWithVideo = [];
14705		}
14706		slidesIndexesWithVideo.push(slideActiveIndex)
14707		$slider.data('slidesIndexesWithVideo', slidesIndexesWithVideo)
14708
14709		var videoPlayerSrc = $slide.attr('data-video_src')
14710		var videoSoundDisabled = $slide.attr('data-video_disable_sound')
14711		var bVideoSoundDisabled = videoSoundDisabled == 1
14712		var videoLoop = $slide.attr('data-video_loop')
14713		var bVideoLoop = videoLoop == 1
14714		var videoCover = $slide.attr('data-video_cover')
14715		var bVideoCover = videoCover == 1
14716		var videoUnderText = $slide.attr('data-video_under_text')
14717		var bVideoUnderText = videoUnderText == 1
14718		var videoPlayer = $slide.attr('data-video_player')
14719		var bVideoPlayerYoutube = videoPlayer === 'YOUTUBE'
14720		var bVideoPlayerVimeo = videoPlayer === 'VIMEO'
14721		var bVideoPlayerRutube = videoPlayer === 'RUTUBE'
14722		var bVideoPlayerHtml5 = videoPlayer === 'HTML5'
14723		var videoWidth = bVideoPlayerHtml5 ? false : $slide.attr('data-video_width')
14724		var videoHeight = bVideoPlayerHtml5 ? false : $slide.attr('data-video_height')
14725
14726		if(videoPlayerSrc && !$slide.find('.video').length){
14727			var InitPlayer = function(){
14728				$slides.each(function(i, node){
14729					var $_slide = $(node);
14730					var videoID = getRandomInt(100, 1000);
14731					var bClone = $_slide.hasClass('clone'),
14732						tmp_class = $_slide.attr('id');
14733					if(!$_slide.find('.video.'+tmp_class).length)
14734					{
14735						if(bVideoPlayerYoutube){
14736							$_slide.prepend('<div class="wrapper_video"><iframe id="player_' + videoID + '" class="video ' + tmp_class + (bVideoCover ? ' cover' : '') + '" src="'+ videoPlayerSrc +'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; fullscreen;"' + ((videoWidth && videoHeight) ? ' data-video_proportion="' + (videoWidth / videoHeight) + '"' : '') + '></iframe></div>');
14737						}
14738						else if(bVideoPlayerVimeo){
14739							$_slide.prepend('<div class="wrapper_video"><iframe id="player_' + videoID + '" class="video ' + tmp_class + (bVideoCover ? ' cover' : '') + '" src="'+ videoPlayerSrc +'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="accelerometer; autoplay; encrypted-media; gyroscope; fullscreen;"' + ((videoWidth && videoHeight) ? ' data-video_proportion="' + (videoWidth / videoHeight) + '"' : '') + '></iframe></div>');
14740						}
14741						else if(bVideoPlayerRutube){
14742							videoPlayerSrc = videoPlayerSrc + '&playerid=' + videoID;
14743							$_slide.prepend('<div class="wrapper_video"><iframe id="player_' + videoID + '" class="video ' + tmp_class + (bVideoCover ? ' cover' : '') + '" src="'+ videoPlayerSrc +'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen allow="autoplay; encrypted-media; gyroscope; fullscreen;"' + ((videoWidth && videoHeight) ? ' data-video_proportion="' + (videoWidth / videoHeight) + '"' : '') + '></iframe></div>');
14744						}
14745						else if(bVideoPlayerHtml5){
14746							$_slide.prepend('<div class="wrapper_video"><video autobuffer playsinline webkit-playsinline autoplay id="player_' + videoID + '" class="video ' + tmp_class + (bVideoCover ? ' cover' : '') + '"' + (bVideoLoop ? ' loop ' : '') + (bVideoSoundDisabled || bClone ? ' muted ' : '') + '><source src="'+ videoPlayerSrc +'" 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></iframe></div>');
14747						}
14748					}
14749
14750					if(typeof(players) !== 'undefined' && players){
14751						players[videoID] = {
14752							id: 'player_' + videoID,
14753							mute: bVideoSoundDisabled || bClone,
14754							loop: bVideoLoop,
14755							cover: bVideoCover,
14756							videoPlayer: videoPlayer,
14757							slideIndex: slideActiveIndex,
14758							clone: bClone,
14759							playing: false,
14760							videoWidth: videoWidth,
14761							videoHeight: videoHeight,
14762							videoProportion: ((videoWidth && videoHeight) ? videoWidth / videoHeight : false)
14763						};
14764
14765						if(bVideoPlayerYoutube){
14766							window[players[videoID].id] = new YT.Player(
14767								players[videoID].id, {
14768									events: {
14769										'onReady': onYoutubePlayerReady,
14770										'onStateChange': onYoutubePlayerStateChange
14771									}
14772								}
14773							);
14774						}
14775						else if(bVideoPlayerVimeo){
14776						    window[players[videoID].id] = new Vimeo.Player(document.getElementById(players[videoID].id), {autopause: false, byline: false, loop: false, title: false});
14777						    window[players[videoID].id].on('loaded', onVimeoPlayerReady)
14778						    window[players[videoID].id].on('play', onVimeoPlayerStateChange)
14779						    window[players[videoID].id].on('pause', onVimeoPlayerStateChange)
14780						    window[players[videoID].id].on('ended', onVimeoPlayerStateChange)
14781						}
14782						else if(bVideoPlayerRutube){
14783							document.getElementById(players[videoID].id).onload = function(e){
14784								var videoID = this.id.replace('player_', '')
14785								players[videoID].contentWindow = this.contentWindow
14786								onRutubePlayerReady(videoID)
14787							}
14788						}
14789						else if(bVideoPlayerHtml5){
14790							document.getElementById(players[videoID].id).addEventListener('loadeddata', on
14790Html5PlayerReady)
14791							document.getElementById(players[videoID].id).addEventListener('play', onHtml5PlayerStateChange)
14792							document.getElementById(players[videoID].id).addEventListener('pause', onHtml5PlayerStateChange)
14793							document.getElementById(players[videoID].id).addEventListener('ended', onHtml5PlayerStateChange)
14794						}
14795					}
14796				});
14797			}
14798
14799			if(!bVideoPlayerHtml5){
14800				var obPlayerVariable = ''
14801				var fnPlayerVariable = ''
14802				if(typeof window['YoutubePlayerScriptLoaded'] === 'undefined'){
14803					window['YoutubePlayerScriptLoaded'] = false
14804				}
14805				if(typeof window['VimeoPlayerScriptLoaded'] === 'undefined'){
14806					window['VimeoPlayerScriptLoaded'] = false
14807				}
14808				if(typeof window['RutubePlayerListnersAdded'] === 'undefined'){
14809					window['RutubePlayerListnersAdded'] = false
14810				}
14811
14812				// load script
14813				if(bVideoPlayerYoutube){
14814					obPlayerVariable = 'YT'
14815					fnPlayerVariable = 'Player'
14816					if(!window['YoutubePlayerScriptLoaded']){
14817						var script = document.createElement('script');
14818						script.src = "https://www.youtube.com/iframe_api";
14819						var firstScriptTag = document.getElementsByTagName('script')[0];
14820						firstScriptTag.parentNode.insertBefore(script, firstScriptTag);
14821						window['YoutubePlayerScriptLoaded'] = true;
14822					}
14823				}
14824				else if(bVideoPlayerVimeo){
14825					obPlayerVariable = 'Vimeo'
14826					if(!window['VimeoPlayerScriptLoaded']){
14827						var script = document.createElement('script');
14828						script.src = 'https://player.vimeo.com/api/player.js';
14829						(document.head || document.documentElement).appendChild(script);
14830						window['VimeoPlayerScriptLoaded'] = true
14831					}
14832				}
14833				else if(bVideoPlayerRutube){
14834					if(!window['RutubePlayerListnersAdded']){
14835						window.addEventListener('message', function(e){
14836							if(e.origin.indexOf('rutube.ru') !== -1){
14837							    var message = JSON.parse(e.data)
14838							    if(typeof message === 'object' && message){
14839							    	if(typeof message.type !== 'undefined' && message.type){
14840							    		var videoID = false
14841
14842							    		for(var j in players){
14843									    	if(typeof players[j].contentWindow !== 'undefined'){
14844									    		if(players[j].contentWindow == e.source){
14845									    			videoID = j
14846									    			break
14847									    		}
14848									    	}
14849									    }
14850
14851									    if(videoID){
14852										    switch (message.type) {
14853										        case 'player:changeState':
14854										            onRutubePlayerStateChange(videoID, message.data.state)
14855										            break
14856										        case 'player:currentTime':
14857										            onRutubePlayerCurrentTime(videoID, message.data.time)
14858										            break
14859										    }
14860										}
14861									}
14862							    }
14863							}
14864						});
14865					}
14866				}
14867
14868				if(!obPlayerVariable.length){
14869					InitPlayer()
14870				}
14871				else{
14872					// wait player class
14873					if(typeof window[obPlayerVariable] === 'object'){
14874						if(!fnPlayerVariable.length || (fnPlayerVariable.length && typeof window[obPlayerVariable][fnPlayerVariable] === 'function')){
14875
14876							InitPlayer()
14877						}
14878					}
14879					else{
14880						var waitPlayerInterval = setInterval(function(){
14881							if(typeof window[obPlayerVariable] === 'object'){
14882								if(!fnPlayerVariable.length || (fnPlayerVariable.length && typeof window[obPlayerVariable][fnPlayerVariable] === 'function')){
14883
14884									clearInterval(waitPlayerInterval)
14885
14886									InitPlayer()
14887								}
14888							}
14889						}, 50)
14890					}
14891				}
14892			}
14893			else{
14894				InitPlayer()
14895			}
14896		}
14897		else
14898		{
14899			// pause play video
14900			if(typeof(players) !== 'undefined' && players){
14901				for(var j in players){
14902					if(/*players[j].playing &&*/ !players[j].clone/* && (players[j].slideIndex != $curSlideIndex)*/){
14903						if((typeof window[players[j].id] == 'object')){
14904							if(players[j].playing)
14905							{
14906								if(players[j].videoPlayer === 'YOUTUBE'){
14907									window[players[j].id].pauseVideo()
14908								}
14909								else if(players[j].videoPlayer === 'VIMEO'){
14910									window[players[j].id].pause()
14911								}
14912								else if(players[j].videoPlayer === 'RUTUBE'){
14913									document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
14914									    type: 'player:pause',
14915									    data: {}
14916									}), '*')
14917								}
14918								else if(players[j].videoPlayer === 'HTML5'){
14919									document.getElementById(players[j].id).pause()
14920								}
14921							}
14922							else if(players[j].slideIndex == slideActiveIndex)
14923							{
14924								if(players[j].videoPlayer === 'YOUTUBE'){
14925									window[players[j].id].playVideo()
14926								}
14927								else if(players[j].videoPlayer === 'VIMEO'){
14928									window[players[j].id].play()
14929								}
14930								else if(players[j].videoPlayer === 'RUTUBE'){
14931									document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
14932									    type: 'player:play',
14933									    data: {}
14934									}), '*')
14935								}
14936								else if(players[j].videoPlayer === 'HTML5'){
14937									document.getElementById(players[j].id).play()
14938								}
14939							}
14940						}
14941					}
14942				}
14943			}
14944		}
14945	}
14946}
14947
14948var CoverPlayer = function(){
14949	$('.top_slider_wrapp .video.cover').each(function(){
14950
14951		var view2 = $(this).closest('.top_slider_wrapp.view_2');
14952		if(view2.length && window.matchMedia('(max-width:767px)').matches) {
14953			//var $slide = view2.find('table');
14954			var $slide = view2.find('table .main_info');
14955		} else {
14956			var $slide = $(this).closest('.box');
14957		}
14958
14959		var slideHeight = $slide.height();
14960		var slideWidth = $slide.width();
14961		var videoProportion = $(this).attr('data-video_proportion');
14962		if(videoProportion === undefined){
14963			videoProportion = 16 / 9;
14964		}
14965
14966		// set video width = 100% of slide width
14967		var videoWidth = slideWidth;
14968		// calculate video height proportional
14969		var videoHeight = slideWidth / videoProportion;
14970		// video minimal  height = 100% slide height
14971		if(videoHeight < slideHeight){
14972			// increase video width proportional
14973			videoWidth = slideHeight * videoProportion;
14974			videoHeight = slideHeight;
14975		}
14976
14977		$(this).width(videoWidth).height(videoHeight).css({
14978			'margin-top' : '-' + (videoHeight - slideHeight) / 2 + 'px',
14979			'margin-left' : '-' + (videoWidth - slideWidth) / 2 + 'px'
14980		});
14981	});
14982}
14983
14984// var CoverPlayerHtml = function(){
14985// 	$('.top_slider_wrapp li[data-video_player="HTML5"] .video.cover').each(function(){
14986// 		var view2 = $(this).closest('.top_slider_wrapp.view_2');
14987// 		if(view2.length && window.matchMedia('(max-width:767px)').matches) {
14988// 			var $slide = view2.find('table');
14989// 		} else {
14990// 			var $slide = $(this).closest('.box');
14991// 		}
14992// 		var slideHeight = $slide.height();
14993// 		var slideWidth = $slide.width();
14994// 		var videoHeight = $(this)[0].videoHeight; // original video size
14995// 		var videoWidth = $(this)[0].videoWidth; // original video size
14996// 		var videoProportion = videoWidth / videoHeight;
14997
14998// 		videoWidth = slideWidth;
14999// 		videoHeight = slideWidth / videoProportion;
15000
15001// 		if(videoHeight < slideHeight){
15002// 			videoWidth = slideHeight * videoProportion;
15003// 			videoHeight = slideHeight;
15004// 		}
15005
15006// 		$(this).width(videoWidth).height(videoHeight).css({
15007// 			'margin-top' : '-' + (videoHeight - slideHeight) / 2 + 'px',
15008// 			'margin-left' : '-' + (videoWidth - slideWidth) / 2 + 'px',
15009// 		});
15010// 	});
15011
15012// 	setTimeout(function(){
15013// 		$('.top_slider_wrapp .flex-active-slide .video.cover').css('visibility', 'visible');
15014// 	}, 1300);
15015// }
15016
15017// var CoverPlayer = function(){
15018// 	$('.top_slider_wrapp li:not([data-video_player="HTML5"]) .video.cover').each(function(){
15019// 		var view2 = $(this).closest('.top_slider_wrapp.view_2');
15020// 		if(view2.length && window.matchMedia('(max-width:767px)').matches) {
15021// 			var $slide = view2.find('table');
15022// 		} else {
15023// 			var $slide = $(this).closest('.box');
15024// 		}
15025// 		var $slide = $(this).closest('.box');
15026// 		var slideHeight = $slide.height();
15027// 		var slideWidth = $slide.width();
15028
15029// 		var videoHeight = $(this).attr('data-video_height'); // original video size
15030// 		var videoWidth = $(this).attr('data-video_width'); // original video size
15031
15032// 		if(videoHeight !== undefined && videoWidth !== undefined){
15033// 			var videoProportion = videoWidth / videoHeight;
15034
15035// 			videoWidth = slideWidth;
15036// 			videoHeight = slideWidth / videoProportion;
15037
15038// 			if(videoHeight < slideHeight){
15039// 				videoWidth = slideHeight * videoProportion;
15040// 				videoHeight = slideHeight;
15041// 			}
15042
15043// 			$(this).width(videoWidth).height(videoHeight).css({
15044// 				'margin-top' : '-' + (videoHeight - slideHeight) / 2 + 'px',
15045// 				'margin-left' : '-' + (videoWidth - slideWidth) / 2 + 'px',
15046// 			});
15047// 		}
15048// 		else{
15049// 			var windowWidth = $(window).width()
15050// 			var height = windowWidth * 9 / 16
15051// 			$(this).css({'height': height + 'px', 'margin-top': (height > slideHeight ? (slideHeight - height) / 2 : 0) + 'px'})
15052// 		}
15053// 	});
15054// }
15055
15056function onYoutubePlayerReady(e) {
15057	var videoID = e.target.f.id.replace('player_', '')
15058	if(videoID){
15059		var mute = players[videoID].mute
15060		var cover = players[videoID].cover
15061    	var clone = players[videoID].clone
15062    	var $slide = $('#player_' + videoID).closest('.box')
15063
15064    	// mute sound
15065		if(mute || clone){
15066			window[players[videoID].id].mute()
15067		}
15068
15069    	// cover video
15070		if(cover){
15071			// get video`s original size
15072			if(!players[videoID].videoProportion){
15073				var embedHtml = e.target.getVideoEmbedCode();
15074				if(embedHtml.length){
15075					var match = embedHtml.match(/width="(\d*)"[^>]*height="(\d*)"/);
15076					if(match !== null){
15077						var videoWidth = match[1];
15078						var videoHeight = match[2];
15079
15080						players[videoID].videoWidth = videoWidth;
15081						players[videoID].videoHeight = videoHeight;
15082						players[videoID].videoProportion = videoWidth / videoHeight;
15083
15084						$slide.find('.video').attr('data-video_proportion', players[videoID].videoProportion);
15085					}
15086				}
15087			}
15088
15089	    	CoverPlayer()
15090	    }
15091
15092    	// not start clone video playing
15093    	if(clone){
15094    		setTimeout(function(){
15095				e.target.pauseVideo()
15096    		}, 100)
15097    	}
15098    	else{
15099		    // stop slider
15100			pauseMainBanner()
15101			e.target.playVideo();
15102
15103		    // e.target.playVideo();
15104		    // e.target.playVideo();
15105    	}
15106
15107    	// update slide class
15108		$slide.addClass('started')
15109		// $slide.removeClass('loading')
15110    }
15111}
15112
15113function onYoutubePlayerStateChange(e){
15114	var videoID = e.target.f.id.replace('player_', '')
15115    if(videoID){
15116    	var clone = players[videoID].clone
15117		var loop = players[videoID].loop
15118    	var slideIndex = players[videoID].slideIndex
15119    	if(!clone){
15120			if(e.data === YT.PlayerState.PLAYING){
15121				players[videoID].playing = true
15122
15123				$('#player_'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
15124				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
15125
15126				// stop slider
15127				pauseMainBanner()
15128
15129				e.target.playVideo()
15130			}
15131			else if(e.data === YT.PlayerState.PAUSED){
15132		    	players[videoID].playing = false
15133
15134		    	// sync time in cloned players & pause
15135	    		var time = Math.floor(window[players[videoID].id].getCurrentTime() * 10) / 10
15136
15137				$('#player_'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
15138				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
15139
15140				window[players[videoID].id].seekTo(time, true)
15141				for(var j in players){
15142					if(players[j].slideIndex == slideIndex && players[j].clone){
15143
15144						if('getCurrentTime' in window[players[j].id])
15145						{
15146							window[players[j].id].pauseVideo()
15147							window[players[j].id].seekTo(time, true)
15148						}
15149					}
15150				}
15151			}
15152			else if(e.data === YT.PlayerState.ENDED){
15153				players[videoID].playing = false
15154		    	if(loop){
15155		    		e.target.playVideo()
15156		    	}
15157		    	else{
15158		    		// play slider
15159					playMainBanner()
15160		    	}
15161			}
15162			else if(e.data === YT.PlayerState.UNSTARTED){
15163				players[videoID].playing = false
15164				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
15165				// window[players[videoID].id].mute()
15166				e.target.playVideo()
15167			}
15168		}
15169	}
15170}
15171
15172function onVimeoPlayerReady(e){
15173	var videoID = this.element.id.replace('player_', '')
15174	if(videoID){
15175		var mute = players[videoID].mute
15176		var cover = players[videoID].cover
15177    	var clone = players[videoID].clone
15178		var $slide = $('#player_' + videoID).closest('.box')
15179
15180    	// mute sound
15181		if(mute || clone){
15182			window[players[videoID].id].setVolume(0)
15183		}
15184
15185    	// cover video
15186		if(cover){
15187			// get video`s original size
15188			if(!players[videoID].videoProportion){
15189				var widthPromise = window[players[videoID].id].getVideoWidth();
15190				var heightPromise = window[players[videoID].id].getVideoHeight();
15191				widthPromise.then(
15192					function(value) {
15193						var videoWidth = value;
15194
15195						heightPromise.then(
15196							function(value) {
15197								var videoHeight = value;
15198
15199								players[videoID].videoWidth = videoWidth;
15200								players[videoID].videoHeight = videoHeight;
15201								players[videoID].videoProportion = videoWidth / videoHeight;
15202
15203								$slide.find('.video').attr('data-video_proportion', players[videoID].videoProportion);
15204
15205								CoverPlayer();
15206							}
15207						);
15208					}
15209				);
15210			}
15211	    }
15212
15213    	// not start clone video playing
15214    	if(clone){
15215    		setTimeout(function(){
15216				window[players[videoID].id].pause()
15217    		}, 100)
15218    	}
15219    	else{
15220		    // stop slider
15221			pauseMainBanner()
15222
15223		    // start video
15224		    var promise = window[players[videoID].id].play();
15225			if(typeof promise !== 'undefined'){
15226				promise.catch(
15227					function(){
15228						setTimeout(function(){
15229							window[players[videoID].id].setVolume(0)
15230							window[players[videoID].id].play()
15231						}, 100);
15232					}
15233				);
15234			}
15235    	}
15236
15237    	// update slide class
15238		$slide.addClass('started')
15239		// $slide.removeClass('loading')
15240    }
15241}
15242
15243function onVimeoPlayerStateChange(e){
15244	var videoID = this.element.id.replace('player_', '')
15245	if(videoID){
15246		var cover = players[videoID].cover
15247    	var clone = players[videoID].clone
15248		var loop = players[videoID].loop
15249    	var slideIndex = players[videoID].slideIndex
15250
15251    	if(!clone){
15252    		window[players[videoID].id].getPaused().then(function(paused){
15253    			if(paused){
15254			    	players[videoID].playing = false
15255
15256			    	$('#player_'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
15257					$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
15258
15259			    	// sync time in cloned players & pause
15260			    	window[players[videoID].id].getCurrentTime().then(function(seconds){
15261			    		var time = Math.floor(seconds * 10) / 10
15262			    		window[players[videoID].id].setCurrentTime(time).then(function(seconds){
15263							for(var j in players){
15264								if(players[j].slideIndex == slideIndex && players[j].clone){
15265									window[players[j].id].pause()
15266									window[players[j].id].setCurrentTime(time).then(function(seconds){})
15267								}
15268							}
15269			    		})
15270			    	})
15271    			}
15272    			else{
15273    				$('#player_'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
15274					$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
15275		    		window[players[videoID].id].getEnded().then(function(ended){
15276		    			if(ended){
15277							players[videoID].playing = false
15278					    	if(loop){
15279					    		window[players[videoID].id].play()
15280					    	}
15281					    	else{
15282					    		// play slider
15283								playMainBanner()
15284					    	}
15285		    			}
15286		    			else{
15287		    				players[videoID].playing = true
15288
15289
15290		    				// stop slider
15291							pauseMainBanner()
15292		    			}
15293		    		})
15294    			}
15295    		})
15296		}
15297	}
15298}
15299
15300function onRutubePlayerReady(videoID){
15301	if(videoID){
15302		var mute = players[videoID].mute
15303		var cover = players[videoID].cover
15304    	var clone = players[videoID].clone
15305    	var player = document.getElementById(players[videoID].id)
15306    	var $slide = $('#player_' + videoID).closest('.box')
15307
15308    	// mute sound
15309		if(mute || clone){
15310			player.contentWindow.postMessage(JSON.stringify({
15311			    type: 'player:mute',
15312			    data: {}
15313			}), '*')
15314		}
15315
15316    	// cover video
15317		if(cover){
15318	    	CoverPlayer()
15319	    }
15320
15321    	// not start clone video playing
15322    	if(clone){
15323    		setTimeout(function(){
15324				player.contentWindow.postMessage(JSON.stringify({
15325				    type: 'player:pause',
15326				    data: {}
15327				}), '*')
15328    		}, 100)
15329    	}
15330    	else{
15331		    // stop slider
15332			pauseMainBanner()
15333
15334		    player.contentWindow.postMessage(JSON.stringify({
15335			    type: 'player:play',
15336			    data: {}
15337			}), '*')
15338    	}
15339
15340    	// update slide class
15341		$slide.addClass('started')
15342		// $slide.removeClass('loading')
15343    }
15344}
15345
15346function onRutubePlayerCurrentTime(videoID, time){
15347	if(videoID){
15348		players[videoID].time = time
15349	}
15350}
15351
15352function onRutubePlayerStateChange(videoID, state){
15353	if(videoID){
15354    	var clone = players[videoID].clone
15355		var loop = players[videoID].loop
15356    	var slideIndex = players[videoID].slideIndex
15357    	var player = document.getElementById(players[videoID].id)
15358
15359    	if(!clone){
15360			if(state === 'playing'){
15361				$('#'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
15362				$('#'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
15363
15364				players[videoID].playing = true
15365
15366				// stop slider
15367				pauseMainBanner()
15368			}
15369			else if(state === 'paused'){
15370				$('#'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
15371				$('#'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
15372
15373		    	players[videoID].playing = false
15374
15375		    	// sync time in cloned players & pause
15376	    		var time = Math.floor(players[videoID].time * 10) / 10
15377				player.contentWindow.postMessage(JSON.stringify({
15378				    type: 'player:setCurrentTime',
15379				    data: {time: time}
15380				}), '*')
15381				for(var j in players){
15382					if(players[j].slideIndex == slideIndex && players[j].clone){
15383						document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
15384						    type: 'player:pause',
15385						    data: {}
15386						}), '*')
15387						document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
15388						    type: 'player:setCurrentTime',
15389						    data: {time: time}
15390						}), '*')
15391					}
15392				}
15393			}
15394			else if(state === 'stopped'){
15395				$('#'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
15396				$('#'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
15397
15398				players[videoID].playing = false
15399		    	if(loop){
15400		    		player.contentWindow.postMessage(JSON.stringify({
15401					    type: 'player:play',
15402					    data: {}
15403					}), '*')
15404		    	}
15405		    	else{
15406		    		// play slider
15407					playMainBanner()
15408		    	}
15409			}
15410		}
15411	}
15412}
15413
15414function onHtml5PlayerReady(e){
15415	var videoID = e.target.id.replace('player_', '')
15416	if(videoID){
15417		var mute = players[videoID].mute
15418		var cover = players[videoID].cover
15419    	var clone = players[videoID].clone
15420    	var $slide = $('#player_' + videoID).closest('.box')
15421
15422    	// mute sound
15423		if(mute || clone){
15424			$('#' + players[videoID].id).prop('muted', true);
15425		}
15426
15427    	// cover video
15428		if(cover){
15429	    	// get video`s original size
15430			if(!players[videoID].videoProportion){
15431				var videoWidth = $slide.find('.video')[0].videoWidth;
15432				var videoHeight = $slide.find('.video')[0].videoHeight;
15433
15434				players[videoID].videoWidth = videoWidth;
15435				players[videoID].videoHeight = videoHeight;
15436				players[videoID].videoProportion = videoWidth / videoHeight;
15437
15438				$slide.find('.video').attr('data-video_proportion', players[videoID].videoProportion);
15439			}
15440
15441			CoverPlayer();
15442	    }
15443
15444    	// not start clone video playing
15445    	if(clone){
15446    		e.target.pause()
15447    	}
15448    	else{
15449		    // stop slider
15450			pauseMainBanner()
15451
15452			var promise = e.target.play();
15453		    if(typeof promise !== 'undefined'){
15454				promise.catch(
15455					function(){
15456						setTimeout(function(){
15457							$('#' + players[videoID].id).prop('muted', true);
15458							e.target.play();
15459						}, 100);
15460					}
15461				);
15462			}
15463    	}
15464
15465    	// update slide class
15466		$slide.addClass('started')
15467		// $slide.removeClass('loading')
15468    }
15469}
15470
15471function onHtml5PlayerStateChange(e){
15472	var videoID = e.target.id.replace('player_', '')
15473	if(videoID){
15474    	var cover = players[videoID].cover
15475    	var clone = players[videoID].clone
15476		var loop = players[videoID].loop
15477    	var slideIndex = players[videoID].slideIndex
15478
15479    	if(!clone){
15480			if(e.target.paused){
15481		    	players[videoID].playing = false
15482
15483		    	$('#player_'+videoID).closest('.box').find('.wrapper_inner').removeClass('loading');
15484				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').removeClass('loading');
15485
15486		    	// sync time in cloned players & pause
15487	    		var time = Math.floor(e.target.currentTime * 10) / 10
15488				e.target.currentTime = time
15489				for(var j in players){
15490					if(players[j].slideIndex == slideIndex && players[j].clone){
15491						document.getElementById(players[j].id).pause()
15492						document.getElementById(players[j].id).currentTime = time
15493					}
15494				}
15495			}
15496			else if(e.target.ended){
15497				players[videoID].playing = false
15498		    	if(loop){
15499		    		$('#player_'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
15500					$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
15501
15502		    		e.target.play()
15503		    	}
15504		    	else{
15505		    		// play slider
15506					playMainBanner()
15507		    	}
15508			}
15509			else{
15510				players[videoID].playing = true
15511
15512				$('#player_'+videoID).closest('.box').find('.wrapper_inner').addClass('loading');
15513				$('#player_'+videoID).closest('.box').find('.wrapper_inner .btn-video').addClass('loading');
15514				// stop slider
15515				pauseMainBanner()
15516			}
15517		}
15518	}
15519}
15520
15521waitYTPlayer = function(delay, callback){
15522	if((typeof YT !== "undefined") && YT && YT.Player)
15523	{
15524		if(typeof callback == 'function')
15525			callback();
15526	}
15527	else
15528	{
15529		setTimeout(function(){
15530			waitYTPlayer(delay, callback);
15531		}, delay);
15532	}
15533}
15534
15535// click on HTML5 video
15536$(document).on('click', 'video.video', function(e){
15537	var videoID = e.target.id.replace('player_', '')
15538    if(videoID){
15539    	if(players[videoID].playing){
15540			e.target.pause()
15541    	}
15542    	else{
15543    		e.target.play()
15544    	}
15545    }
15546})
15547
15548// START VIDEO BUTTON
15549$(document).on('click', '.top_slider_wrapp .box .btn-video', function(e){
15550	e.stopPropagation();
15551	if(!$(this).hasClass('loading'))
15552	{
15553		$(this).addClass('loading');
15554		$(this).closest('.wrapper_inner').addClass('loading');
15555	}
15556	else
15557	{
15558		$(this).removeClass('loading');
15559		$(this).closest('.wrapper_inner').removeClass('loading');
15560	}
15561
15562	startMainBannerSlideVideo($(this).closest('.box'));
15563});
15564
15565// START VIDEO BY BANNER OR GOTO LINK
15566$(document).on('click', '.top_slider_wrapp .box .wrapper_inner', function(e){
15567	var wvideo = $(this).closest('.box').hasClass('wvideo');
15568	var wurl = $(this).closest('.box').hasClass('wurl');
15569
15570	if($(e.target).hasClass('btn')){
15571		if(wvideo){
15572			if($(e.target).hasClass('btn-video')){
15573				e.stopPropagation();
15574				$(this).find('.btn-video').trigger('click');
15575			}
15576		}
15577	}
15578	else{
15579		if($(e.target).closest('.banner_buttons.with_actions').length){
15580			e.stopPropagation();
15581		} else {
15582			if(wurl){
15583				var href = $(this).closest('.box').find('.target').attr('href');
15584				if(href.length){
15585					var target = $(this).closest('.box').find('.target').attr('target');
15586					if(typeof target === 'undefined' || target === '_self'){
15587						location.href = href;
15588					}
15589					else{
15590						window.open(href);
15591					}
15592				}
15593			}
15594			else{
15595				if(wvideo){
15596					e.stopPropagation();
15597					$(this).find('.btn-video').trigger('click');
15598				}
15599			}
15600		}
15601		
15602	}
15603})
15604
15605getRandomInt = function(min, max){
15606	return Math.floor(Math.random() * (max - min)) + min;
15607}
15608
15609var ignoreResize = [];
15610
15611BX.addCustomEvent('onWindowResize', function(eventdata) {
15612	try{
15613		CoverPlayer();
15614	}
15615	catch(e){}
15616	finally{
15617		ignoreResize.pop();
15618	}
15619});
15620
15621BX.addCustomEvent('onSlideEnd', function(eventdata) {
15622	try{
15623		ignoreResize.push(true);
15624		if(eventdata){
15625			var slider = eventdata.slider;
15626			if(slider){
15627				setTimeout(function(){
15628					$('.banners-big.front .btn-video, .banners-big.front .box').removeClass('loading');
15629				}, 300);
15630			}
15631		}
15632	}
15633	catch(e){}
15634	finally{
15635		ignoreResize.pop();
15636	}
15637});
15638
15639BX.addCustomEvent('onSlide', function(eventdata) {
15640	try{
15641		ignoreResize.push(true);
15642		if(eventdata){
15643			var slider = eventdata.slider;
15644			if(slider){
15645				var $curSlide = slider.find('.box.flex-active-slide');
15646				var $curSlideIndex = $curSlide.attr('data-slide_index');
15647
15648				if(typeof($curSlideIndex) !== 'undefined' && $curSlideIndex.length){
15649					var slidesIndexesWithVideo = slider.data('slidesIndexesWithVideo')
15650					if(typeof slidesIndexesWithVideo === 'undefined'){
15651						slidesIndexesWithVideo = [];
15652					}
15653
15654					var bVideoVisible = slidesIndexesWithVideo.indexOf($curSlideIndex) != -1;
15655					if(bVideoVisible){
15656						slider.addClass('video_visible');
15657					}
15658					else{
15659						slider.removeClass('video_visible');
15660					}
15661
15662					setTimeout(function(){
15663						CoverPlayer();
15664					}, 200);
15665
15666					// pause play video
15667					if(typeof(players) !== 'undefined' && players){
15668						for(var j in players){
15669							if(players[j].playing && !players[j].clone && (players[j].slideIndex != $curSlideIndex)){
15670								if((typeof window[players[j].id] == 'object')){
15671									if(players[j].videoPlayer === 'YOUTUBE'){
15672										window[players[j].id].pauseVideo()
15673									}
15674									else if(players[j].videoPlayer === 'VIMEO'){
15675										window[players[j].id].pause()
15676									}
15677									else if(players[j].videoPlayer === 'RUTUBE'){
15678										document.getElementById(players[j].id).contentWindow.postMessage(JSON.stringify({
15679										    type: 'player:pause',
15680										    data: {}
15681										}), '*')
15682									}
15683									else if(players[j].videoPlayer === 'HTML5'){
15684										document.getElementById(players[j].id).pause()
15685									}
15686								}
15687							}
15688						}
15689					}
15690					// autoplay video
15691					var bVideoAutoPlay = $curSlide.attr('data-video_autoplay') == 1
15692					if(bVideoAutoPlay){
15693						startMainBannerSlideVideo($curSlide)
15694					}
15695				}
15696
15697				if($curSlide.find('video').length && !$curSlide.find('.btn-video').length){
15698					var videoID = $curSlide.find('video').attr('id');
15699					document.getElementById(videoID).play();
15700				}
15701			}
15702		}
15703	}
15704	catch(e){}
15705	finally{
15706		ignoreResize.pop();
15707	}
15708});
15709/* End */
15710;
15711; /* Start:"a:4:{s:4:"full";s:61:"/local/templates/aspro_max_local/js/mobile.js?162019756924621";s:6:"source";s:45:"/local/templates/aspro_max_local/js/mobile.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
15712$(document).ready(function(){
15713    /*  --- Bind mobile menu  --- */
15714        var $mobileMenu = $("#mobilemenu")
15715        if($mobileMenu.length){
15716            $mobileMenu.isLeftSide = $mobileMenu.hasClass('leftside')
15717            $mobileMenu.isOpen = $mobileMenu.hasClass('show')
15718            $mobileMenu.isDowndrop = $mobileMenu.find('>.scroller').hasClass('downdrop')
15719            $mobileMenuNlo = $mobileMenu.find('[data-nlo]')
15720
15721            $('#mobileheader .burger').click(function(){
15722                SwipeMobileMenu()
15723            })
15724
15725            if($mobileMenu.isLeftSide){
15726                $mobileMenu.parent().append('<div id="mobilemenu-overlay"></div>')
15727                var $mobileMenuOverlay = $('#mobilemenu-overlay')
15728
15729                $mobileMenuOverlay.click(function(){
15730                    if($mobileMenu.isOpen){
15731                        CloseMobileMenu()
15732                    }
15733                });
15734
15735                $(document).swiperight(function(e) {
15736                    if(!$(e.target).closest('.flexslider').length && !$(e.target).closest('.swipeignore').length && !$(e.target).closest('.jqmWindow.popup').length){
15737                        OpenMobileMenu()
15738                    }
15739                });
15740
15741                $(document).swipeleft(function(e) {
15742                    if(!$(e.target).closest('.flexslider').length && !$(e.target).closest('.swipeignore').length && !$(e.target).closest('.jqmWindow.popup').length){
15743                        CloseMobileMenu()
15744                    }
15745                });
15746            }
15747            else{
15748                $(document).on('click', '#mobileheader', function(e){
15749                    if(!$(e.target).closest('#mobilemenu').length && !$(e.target).closest('.burger').length && $mobileMenu.isOpen){
15750                        CloseMobileMenu()
15751                    }
15752                });
15753            }
15754
15755            $(document).on('click', '#mobilemenu .menu a,#mobilemenu .social-icons a', function(e){
15756                var $this = $(this)
15757                if($this.hasClass('parent')){
15758                    e.preventDefault()
15759
15760                    if(!$mobileMenu.isDowndrop){
15761                        $this.closest('li').addClass('expanded')
15762                        MoveMobileMenuWrapNext()
15763                    }
15764                    else{
15765                        if(!$this.closest('li').hasClass('expanded')){
15766                            $this.closest('li').addClass('expanded')
15767                        }
15768                        else{
15769                            $this.closest('li').removeClass('expanded')
15770                        }
15771                    }
15772                }
15773                else{
15774                    if($this.closest('li').hasClass('counters')){
15775                        var href = $this.attr('href')
15776                        if(typeof href !== 'undefined'){
15777                            window.location.href = href
15778                            window.location.reload()
15779                        }
15780                    }
15781
15782                    if(!$this.closest('.menu_back').length){
15783                        CloseMobileMenu()
15784                    }
15785                }
15786            })
15787
15788           $(document).on('click', '#mobilemenu .dropdown .menu_back', function(e){
15789                e.preventDefault()
15790                var $this = $(this)
15791                MoveMobileMenuWrapPrev()
15792                setTimeout(function(){
15793                    $this.closest('.expanded').removeClass('expanded')
15794                }, 400)
15795            })
15796
15797            OpenMobileMenu = function(){
15798                CloseMobilePhone();
15799
15800                if(!$mobileMenu.isOpen){
15801                    // hide styleswitcher
15802                    if($('.style-switcher').hasClass('active')){
15803                        $('.style-switcher .switch').trigger('click')
15804                    }
15805                    $('.style-switcher .switch').hide()
15806
15807                    if($mobileMenu.isLeftSide){
15808                        // show overlay
15809                        setTimeout(function(){
15810                            $mobileMenuOverlay.fadeIn('fast')
15811                        }, 100)
15812                    }
15813                    else{
15814                        // scroll body to top & set fixed
15815                        $('body').scrollTop(0).css({position: 'fixed'})
15816
15817                        // set menu top = bottom of header
15818                        $mobileMenu.css({top: + ($('#mobileheader').height() + $('#mobileheader').offset().top) + 'px'})
15819
15820                        // change burger icon
15821                        $('#mobileheader .burger').addClass('c')
15822                    }
15823
15824                    // show menu
15825                    $mobileMenu.addClass('show')
15826                    $mobileMenu.isOpen = true
15827
15828                    if(!$mobileMenu.isDowndrop){
15829                        var $wrap = $mobileMenu.find('.wrap').first()
15830                        var params =  $wrap.data('params')
15831                        if(typeof params === 'undefined'){
15832                            params = {
15833                                depth: 0,
15834                                scroll: {},
15835                                height: {}
15836                            }
15837                        }
15838                        $wrap.data('params', params)
15839                    }
15840
15841                    if($mobileMenuNlo.length){
15842                        if(!$mobileMenuNlo.hasClass('nlo-loadings')){
15843                            $mobileMenuNlo.addClass('nlo-loadings');
15844                            setTimeout(function(){
15845                                $.ajax({
15846                                    data: {nlo: $mobileMenuNlo.attr('data-nlo')},
15847                                    success: function(response){
15848                                        $mobileMenuNlo[0].insertAdjacentHTML('beforebegin', $.trim(response));
15849                                        $mobileMenuNlo.remove();
15850                                    },
15851                                    error:function(){
15852                                        $mobileMenuNlo.removeClass('nlo-loadings');
15853                                    }
15854                                });
15855                            }, 300);
15856                        }
15857                    }
15858                }
15859            }
15860
15861            CloseMobileMenu = function(){
15862                if($mobileMenu.isOpen){
15863                    // hide menu
15864                    $mobileMenu.removeClass('show')
15865                    $mobileMenu.isOpen = false
15866
15867                    // show styleswitcher
15868                    $('.style-switcher .switch').show()
15869
15870                    if($mobileMenu.isLeftSide){
15871                        // hide overlay
15872                        setTimeout(function(){
15873                            $mobileMenuOverlay.fadeOut('fast')
15874                        }, 100)
15875                    }
15876                    else{
15877                        // change burger icon
15878                        $('#mobileheader .burger').removeClass('c')
15879
15880                        // body unset fixed
15881                        $('body').css({position: ''})
15882                    }
15883
15884                    if(!$mobileMenu.isDowndrop){
15885                        setTimeout(function(){
15886                            var $scroller = $mobileMenu.find('.scroller').first()
15887                            var $wrap = $mobileMenu.find('.wrap').first()
15888                            var params =  $wrap.data('params')
15889                            params.depth = 0
15890                            $wrap.data('params', params).attr('style', '')
15891                            $mobileMenu.scrollTop(0)
15892                            $scroller.css('height', '')
15893                        }, 400)
15894                    }
15895                }
15896            }
15897
15898            SwipeMobileMenu = function(){
15899                if($mobileMenu.isOpen){
15900                    CloseMobileMenu()
15901                }
15902                else{
15903                    OpenMobileMenu()
15904                }
15905            }
15906
15907            function MoveMobileMenuWrapNext(){
15908                if(!$mobileMenu.isDowndrop){
15909                    var $scroller = $mobileMenu.find('.scroller').first()
15910                    var $wrap = $mobileMenu.find('.wrap').first()
15911                    if($wrap.length){
15912                        var params =  $wrap.data('params')
15913                        var $dropdownNext = $mobileMenu.find('.expanded>.dropdown').eq(params.depth)
15914                        if($dropdownNext.length){
15915                            // save scroll position
15916                            params.scroll[params.depth] = parseInt($mobileMenu.scrollTop())
15917
15918                            // height while move animating
15919                            params.height[params.depth + 1] = Math.max($dropdownNext.height(), (!params.depth ? $wrap.height() : $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1).height()))
15920                            $scroller.css('height', params.height[params.depth + 1] + 'px')
15921
15922                            // inc depth
15923                            ++params.depth
15924
15925                            // translateX for move
15926                            $wrap.css('transform', 'translateX(' + -100 * params.depth + '%)')
15927
15928                            // scroll to top
15929                            setTimeout(function() {
15930                                $mobileMenu.animate({scrollTop : 0}, 200);
15931                            }, 100)
15932
15933                            // height on enimating end
15934                            var h = $dropdownNext.height()
15935                            setTimeout(function() {
15936                                if(h){
15937                                    $scroller.css('height', h + 'px')
15938                                }
15939                                else{
15940                                    $scroller.css('height', '')
15941                                }
15942                            }, 200)
15943                        }
15944
15945                        $wrap.data('params', params)
15946                    }
15947                }
15948            }
15949
15950            function MoveMobileMenuWrapPrev(){
15951                if(!$mobileMenu.isDowndrop){
15952                    var $scroller = $mobileMenu.find('.scroller').first()
15953                    var $wrap = $mobileMenu.find('.wrap').first()
15954                    if($wrap.length){
15955                        var params =  $wrap.data('params')
15956                        if(params.depth > 0){
15957                            var $dropdown = $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1)
15958                            if($dropdown.length){
15959                                // height while move animating
15960                                $scroller.css('height', params.height[params.depth] + 'px')
15961
15962                                // dec depth
15963                                --params.depth
15964
15965                                // translateX for move
15966                                $wrap.css('transform', 'translateX(' + -100 * params.depth + '%)')
15967
15968                                // restore scroll position
15969                                setTimeout(function() {
15970                                    $mobileMenu.animate({scrollTop : params.scroll[params.depth]}, 200);
15971                                }, 100)
15972
15973                                // height on enimating end
15974                                var h = (!params.depth ? false : $mobileMenu.find('.expanded>.dropdown').eq(params.depth - 1).height())
15975                                setTimeout(function() {
15976                                    if(h){
15977                                        $scroller.css('height', h + 'px')
15978                                    }
15979                                    else{
15980                                        $scroller.css('height', '')
15981                                    }
15982                                }, 200)
15983                            }
15984                        }
15985
15986                        $wrap.data('params', params)
15987                    }
15988                }
15989            }
15990        }
15991    /*  --- END Bind mobile menu  --- */
15992
15993    /*  --- Bind mobile phone  --- */
15994        var $mobileHeader = $("#mobileheader");
15995        var $simpleHeader = $('body.simple_basket_mode #header');
15996        var $mobilePhone = $("#mobilePhone");
15997        $mobilePhone.isOpen = false;
15998        if($mobilePhone.length){
15999            $mobilePhone.isOpen = $mobilePhone.hasClass('show');
16000
16001            $(document).on('click', '.wrap_phones .svg-inline-phone', function(e){
16002                SwipeMobilePhone();
16003                e.stopPropagation();
16004            });
16005
16006            $(document).on('click', '.wrap_phones .svg-inline-close', function(e){
16007                CloseMobilePhone();
16008                e.stopPropagation();
16009            });
16010        }
16011
16012        SwipeMobilePhone = function(){
16013            if($mobilePhone.isOpen){
16014                CloseMobilePhone();
16015            }
16016            else{
16017                OpenMobilePhone();
16018            }
16019        }
16020
16021        OpenMobilePhone = function(){
16022            if(!$mobilePhone.isOpen){
16023                CloseMobileMenu();
16024
16025                // show overlay
16026                var isSimple = Boolean($simpleHeader.length);
16027                var positionOffset = isSimple ? $simpleHeader[0].getBoundingClientRect() : $mobileHeader[0].getBoundingClientRect();
16028                var position = positionOffset.top + positionOffset.height + pageYOffset;
16029                console.log(positionOffset);
16030                console.log(position);
16031                $('<div class="jqmOverlay mobp" style="top:'+(position)+'px;position:absolute"></div>').appendTo('body');
16032
16033                // toggle phones
16034                setTimeout(function(){
16035                    $mobilePhone.slideDown('fast', function(){
16036                        $mobilePhone.addClass('show');
16037                        $mobilePhone.isOpen = true;
16038                    });
16039                }, 100);
16040            }
16041        }
16042
16043        CloseMobilePhone = function(){
16044            if($mobilePhone.isOpen){
16045                // toggle phones
16046                setTimeout(function(){
16047                    $mobilePhone.slideUp('fast', function(){
16048                        $mobilePhone.removeClass('show');
16049                        $mobilePhone.isOpen = false;
16050
16051                        // hide overlay
16052                        $('.jqmOverlay.mobp').remove();
16053                    });
16054                }, 100);
16055            }
16056        }
16057
16058        checkMobilePhone = function(){
16059            if((!window.matchMedia('(max-width: 991px)').matches)){
16060                CloseMobilePhone();
16061            }
16062        }
16063        $(document).on('click', "body.simple_basket_mode .back-mobile-arrow .arrow-back", function(){
16064            if(document.referrer && document.referrer != location.href) {
16065                window.history.back();
16066            } else {
16067                location.href = '/';
16068            }
16069        })
16070    /*  --- END Bind mobile phone  --- */
16071
16072    /*  --- Bind mobile filter  --- */
16073        var $mobilefilter = $("#mobilefilter");
16074        if($mobilefilter.length){
16075            $mobilefilter.isOpen = $mobileMenu.hasClass('show');
16076            $mobilefilter.isAppendLeft = false;
16077            $mobilefilter.isWrapFilter = false;
16078            $mobilefilter.isHorizontalOrCompact = $('.filter_horizontal').length || $('.bx_filter_vertical.compact').length;
16079            $mobilefilter.close = '<i class="svg svg-close close-icons"></i>';
16080
16081            $(document).on('click', '.bx-filter-title', function(){
16082                OpenMobileFilter();
16083            });
16084
16085            $(document).on('click', '#mobilefilter .svg-close.close-icons', function(){
16086                CloseMobileFilter();
16087            });
16088
16089            $(document).on('click', '.bx_filter_select_block', function(e){
16090                var bx_filter_select_container = $(e.target).parents('.bx_filter_select_container');
16091                if(bx_filter_select_container.length) {
16092                    var prop_id = bx_filter_select_container.closest('.bx_filter_parameters_box').attr('data-property_id');
16093                    if($('#smartFilterDropDown'+prop_id).length){
16094                        $('#smartFilterDropDown'+prop_id).css({"max-width":bx_filter_select_container.width(), "z-index":"3020"});
16095                    }
16096                }
16097            });
16098
16099            $(document).on('mouseup', '.bx_filter_section', function(e){
16100                if($(e.target).hasClass('bx_filter_search_button')) {
16101                    CloseMobileFilter();
16102                }
16103            });
16104
16105
16106            $(document).on('mouseup', '.bx_filter_parameters_box_title', function(e){
16107                $("[id^='smartFilterDropDown']").hide();
16108                if($(e.target).hasClass('close-icons')) {
16109                    CloseMobileFilter();
16110                }
16111            });
16112
16113            /*$(document).on('DOMSubtreeModified', "#mobilefilter #modef_num_mobile", function() {
16114                mobileFilterNum($(this));
16115            });
16116
16117            $(document).on('DOMSubtreeModified', "#mobilefilter .bx_filter_container_modef", function() {
16118                mobileFilterNum($(this));
16119            });*/
16120
16121            $mobilefilter.parent().append('<div id="mobilefilter-overlay"></div>');
16122            var $mobilefilterOverlay = $('#mobilefilter-overlay');
16123
16124            $mobilefilterOverlay.click(function(){
16125                if($mobilefilter.isOpen){
16126                    CloseMobileFilter();
16127                    //e.stopPropagation();
16128                }
16129            });
16130
16131            mobileFilterNum = function(num, def){
16132                if(def){
16133                    $('.bx_filter_search_button').text(num.data("f"));;
16134                }
16135                else {
16136                    var str = "";
16137                    var $prosLeng = $('.bx_filter_parameters_box > span');
16138
16139                    str += $prosLeng.data("f") + " " + num + " " + declOfNumFilter(num, [$prosLeng.data("fi"), $prosLeng.data("fr"), $prosLeng.data("frm"),]);
16140                    $('.bx_filter_search_button').text(str);
16141                }
16142            }
16143
16144            declOfNumFilter = function(number, titles){
16145                cases = [2, 0, 1, 1, 1, 2];
16146                return titles[ (number%100>4 && number%100<20)? 2 : cases[(number%10<5)?number%10:5] ];
16147            }
16148
16149            OpenMobileFilter = function(){
16150                if(!$mobilefilter.isOpen)
16151                {
16152                    $('body').addClass('jqm-initied wf');
16153
16154                    $('.bx_filter_vertical .slide-block__head.filter_title').removeClass('closed');
16155                   
16156                    $('.bx_filter_vertical .slide-block__head.filter_title + .slide-block__body').show();
16157
16158
16159                    if(!$mobilefilter.isAppendLeft)
16160                    {
16161                        if(!$mobilefilter.isWrapFilter)
16162                        {
16163                            $(".bx_filter").wrap("<div id='wrapInlineFilter'></div>");
16164                            $mobilefilter.isWrapFilter = true;
16165                        }
16166                        $(".bx_filter").appendTo($("#mobilefilter"));
16167                        var helper = $('#filter-helper');
16168                        if(helper.length) {
16169                            helper.prependTo($("#mobilefilter .bx_filter_parameters"));
16170                        }
16171                        $mobilefilter.isAppendLeft = true;
16172
16173                    }
16174                    if (typeof checkFilterLandgings === 'function') {
16175                        checkFilterLandgings()
16176                    }
16177
16178                    $("#mobilefilter .bx_filter_parameters").addClass('scrollbar');
16179                    $("#mobilefilter .slide-block .filter_title").addClass('ignore');
16180                    $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").addClass('colored_theme_hover_bg-block');
16181
16182                    /*if (window.matchMedia('(max-width: 767px)').matches) {
16183                        $('#mobilefilter .bx_filter .scrollbar').addClass('mobile-scroll').removeClass('scroll-init');
16184                        if($('#mobilefilter .bx_filter .mobile-scroll.scrollbar').length)
16185                            $('#mobilefilter .bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
16186                        if($('#mobilefilter .bx_filter .mobile-scroll.srollbar-custom').length)
16187                            $('#mobilefilter .bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
16188                    }*/
16189
16190                    $(".bx_filter_button_box.ajax-btns").addClass('colored_theme_bg');
16191                    $(".bx_filter_button_box.ajax-btns .filter-bnt-wrapper").removeClass('hidden');
16192                    InitCustomScrollBar();
16193
16194                    // show overlay
16195                    setTimeout(function(){
16196                        $mobilefilterOverlay.fadeIn('fast');
16197                    }, 100);
16198
16199                    // fix body
16200                    $('body').css({'overflow': 'hidden','height': '100vh'});
16201
16202                    // show mobile filter
16203                    $mobilefilter.addClass('show');
16204                    $mobilefilter.find('.bx_filter').css({'display':'block'});
16205                    $mobilefilter.isOpen = true;
16206
16207                    $('#mobilefilter .bx_filter_button_box.btns.ajax-btns').removeClass('hidden');
16208
16209                    var init =  $mobilefilter.data('init');
16210                    if(typeof init === 'undefined'){
16211                        $mobilefilter.scroll(function() {
16212                            $(".bx_filter_section .bx_filter_select_container").each(function(){
16213                                var prop_id=$(this).closest('.bx_filter_parameters_box').attr('data-property_id');
16214                                if($('#smartFilterDropDown'+prop_id).length){
16215                                    $('#smartFilterDropDown'+prop_id).hide();
16216                                }
16217                            });
16218                        });
16219
16220                        $mobilefilter.data('init', "Y");
16221                    };
16222                };
16223            }
16224
16225            CloseMobileFilter = function(append){
16226                $mobilefilter.find('.bx_filter_parameters').removeClass('scrollbar');
16227
16228                if($("#mobilefilter .bx_filter_parameters").length)
16229                    $('body').removeClass('jqm-initied wf');
16230
16231                $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").removeClass('colored_theme_hover_bg-block');
16232                $(".slide-block .filter_title").removeClass('ignore');
16233                $(".bx_filter_button_box.ajax-btns").removeClass('colored_theme_bg');
16234
16235                $(".bx_filter:not(.n-ajax) .bx_filter_button_box.ajax-btns .filter-bnt-wrapper").addClass('hidden');
16236
16237                if($mobilefilter.isOpen){
16238                    // scroll to top
16239                    $mobilefilter.find('.bx_filter_parameters').scrollTop(0);
16240
16241                    // unfix body
16242                    $('body').css({'overflow': '','height': ''});
16243
16244                    // hide overlay
16245                    setTimeout(function(){
16246                        $mobilefilterOverlay.fadeOut('fast');
16247                    }, 100);
16248
16249                    // hide mobile filter
16250                    $mobilefilter.removeClass('show');
16251                    $mobilefilter.isOpen = false;
16252                }
16253
16254                if(append && $mobilefilter.isAppendLeft){
16255                    $(".bx_filter").appendTo($("#wrapInlineFilter")).show();
16256                    var helper = $('#filter-helper');
16257                    if(helper.length) {
16258                        helper.appendTo($('#filter-helper-wrapper'));
16259                    }
16260                    $mobilefilter.isAppendLeft = false;
16261                    $mobilefilter.removeData('init');
16262                    mobileFilterNum($("#modef_num_mobile"),true);
16263                }
16264            }
16265
16266            checkMobileFilter = function(){
16267                if((!window.matchMedia('(max-width: 991px)').matches && !$mobilefilter.isHorizontalOrCompact) || (!window.matchMedia('(max-width: 767px)').matches && $mobilefilter.isHorizontalOrCompact)){
16268                    CloseMobileFilter(true);
16269                }
16270            }
16271        }
16272        else {
16273            checkTopFilter();
16274            $(document).on('click', '.bx-filter-title', function(){
16275                $(this).toggleClass("opened");
16276                if($('.visible_mobile_filter').length) {
16277                    $('.visible_mobile_filter').show();
16278                    $('.bx_filter_vertical, .bx_filter').slideToggle(333);
16279                }
16280                else{
16281                    $('.bx_filter_vertical').closest('div[id^=bx_incl]').show();
16282                    $('.bx_filter_vertical, .bx_filter').slideToggle(333);
16283                }
16284            });
16285        }
16286    /*  --- END Bind mobile filter  --- */
16287})
16288/* End */
16289;
16290; /* Start:"a:4:{s:4:"full";s:75:"/local/templates/aspro_max_local/js/jquery.mousewheel.min.js?16201975692609";s:6:"source";s:60:"/local/templates/aspro_max_local/js/jquery.mousewheel.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
16291!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)}})});
16292/* End */
16293;
16294; /* Start:"a:4:{s:4:"full";s:78:"/local/templates/aspro_max_local/js/jquery.mCustomScrollbar.
vendor: 5,412 bytes, lines 16294-16470
16294js?162019756994214";s:6:"source";s:62:"/local/templates/aspro_max_local/js/jquery.mCustomScrollbar.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
16295/*
16296== malihu jquery custom scrollbar plugin == 
16297Version: 3.1.5 
16298Plugin URI: http://manos.malihu.gr/jquery-custom-content-scroller 
16299Author: malihu
16300Author URI: http://manos.malihu.gr
16301License: MIT License (MIT)
16302*/
16303
16304/*
16305Copyright Manos Malihutsakis (email: [email protected])
16306
16307Permission is hereby granted, free of charge, to any person obtaining a copy
16308of this software and associated documentation files (the "Software"), to deal
16309in the Software without restriction, including without limitation the rights
16310to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16311copies of the Software, and to permit persons to whom the Software is
16312furnished to do so, subject to the following conditions:
16313
16314The above copyright notice and this permission notice shall be included in
16315all copies or substantial portions of the Software.
16316
16317THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16318IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16319FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16320AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16321LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16322OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
16323THE SOFTWARE.
16324*/
16325
16326/*
16327The code below is fairly long, fully commented and should be normally used in development. 
16328For production, use either the minified jquery.mCustomScrollbar.min.js script or 
16329the production-ready jquery.mCustomScrollbar.concat.min.js which contains the plugin 
16330and dependencies (minified). 
16331*/
16332
16333(function(factory){
16334	if(typeof define==="function" && define.amd){
16335		define(["jquery"],factory);
16336	}else if(typeof module!=="undefined" && module.exports){
16337		module.exports=factory;
16338	}else{
16339		factory(jQuery,window,document);
16340	}
16341}(function($){
16342(function(init){
16343	var _rjs=typeof define==="function" && define.amd, /* RequireJS */
16344		_njs=typeof module !== "undefined" && module.exports, /* NodeJS */
16345		_dlp=("https:"==document.location.protocol) ? "https:" : "http:", /* location protocol */
16346		_url="cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js";
16347	if(!_rjs){
16348		if(_njs){
16349			require("jquery-mousewheel")($);
16350		}else{
16351			/* load jquery-mousewheel plugin (via CDN) if it's not present or not loaded via RequireJS 
16352			(works when mCustomScrollbar fn is called on window load) */
16353			$.event.special.mousewheel || $("head").append(decodeURI("%3Cscript src="+_dlp+"//"+_url+"%3E%3C/script%3E"));
16354		}
16355	}
16356	init();
16357}(function(){
16358	
16359	/* 
16360	----------------------------------------
16361	PLUGIN NAMESPACE, PREFIX, DEFAULT SELECTOR(S) 
16362	----------------------------------------
16363	*/
16364	
16365	var pluginNS="mCustomScrollbar",
16366		pluginPfx="mCS",
16367		defaultSelector=".mCustomScrollbar",
16368	
16369	
16370		
16371	
16372	
16373	/* 
16374	----------------------------------------
16375	DEFAULT OPTIONS 
16376	----------------------------------------
16377	*/
16378	
16379		defaults={
16380			/*
16381			set element/content width/height programmatically 
16382			values: boolean, pixels, percentage 
16383				option						default
16384				-------------------------------------
16385				setWidth					false
16386				setHeight					false
16387			*/
16388			/*
16389			set the initial css top property of content  
16390			values: string (e.g. "-100px", "10%" etc.)
16391			*/
16392			setTop:0,
16393			/*
16394			set the initial css left property of content  
16395			values: string (e.g. "-100px", "10%" etc.)
16396			*/
16397			setLeft:0,
16398			/* 
16399			scrollbar axis (vertical and/or horizontal scrollbars) 
16400			values (string): "y", "x", "yx"
16401			*/
16402			axis:"y",
16403			/*
16404			position of scrollbar relative to content  
16405			values (string): "inside", "outside" ("outside" requires elements with position:relative)
16406			*/
16407			scrollbarPosition:"inside",
16408			/*
16409			scrolling inertia
16410			values: integer (milliseconds)
16411			*/
16412			scrollInertia:100,
16413			/* 
16414			auto-adjust scrollbar dragger length
16415			values: boolean
16416			*/
16417			autoDraggerLength:true,
16418			/*
16419			auto-hide scrollbar when idle 
16420			values: boolean
16421				option						default
16422				-------------------------------------
16423				autoHideScrollbar			false
16424			*/
16425			/*
16426			auto-expands scrollbar on mouse-over and dragging
16427			values: boolean
16428				option						default
16429				-------------------------------------
16430				autoExpandScrollbar			false
16431			*/
16432			/*
16433			always show scrollbar, even when there's nothing to scroll 
16434			values: integer (0=disable, 1=always show dragger rail and buttons, 2=always show dragger rail, dragger and buttons), boolean
16435			*/
16436			alwaysShowScrollbar:0,
16437			/*
16438			scrolling always snaps to a multiple of this number in pixels
16439			values: integer, array ([y,x])
16440				option						default
16441				-------------------------------------
16442				snapAmount					null
16443			*/
16444			/*
16445			when snapping, snap with this number in pixels as an offset 
16446			values: integer
16447			*/
16448			snapOffset:0,
16449			/* 
16450			mouse-wheel scrolling
16451			*/
16452			mouseWheel:{
16453				/* 
16454				enable mouse-wheel scrolling
16455				values: boolean
16456				*/
16457				enable:true,
16458				/* 
16459				scrolling amount in pixels
16460				values: "auto", integer 
16461				*/
16462				scrollAmount:"auto",
16463				/* 
16464				mouse-wheel scrolling axis 
16465				the default scrolling direction when both vertical and horizontal scrollbars are present 
16466				values (string): "y", "x" 
16467				*/
16468				axis:"y",
16469				/* 
16470				prevent the default behaviour which automatically scrolls the parent element
16470(s) when end of scrolling is reached 
16471				values: boolean
16472					option						default
16473					-------------------------------------
16474					preventDefault				null
16475				*/
16476				/*
16477				the reported mouse-wheel delta value. The number of lines (translated to pixels) one wheel notch scrolls.  
16478				values: "auto", integer 
16479				"auto" uses the default OS/browser value 
16480				*/
16481				deltaFactor:"auto",
16482				/*
16483				normalize mouse-wheel delta to -1 or 1 (disables mouse-wheel acceleration) 
16484				values: boolean
16485					option						default
16486					-------------------------------------
16487					normalizeDelta				null
16488				*/
16489				/*
16490				invert mouse-wheel scrolling direction 
16491				values: boolean
16492					option						default
16493					-------------------------------------
16494					invert						null
16495				*/
16496				/*
16497				the tags that disable mouse-wheel when cursor is over them
16498				*/
16499				disableOver:["select","option","keygen","datalist","textarea"]
16500			},
16501			/* 
16502			scrollbar buttons
16503			*/
16504			scrollButtons:{ 
16505				/*
16506				enable scrollbar buttons
16507				values: boolean
16508					option						default
16509					-------------------------------------
16510					enable						null
16511				*/
16512				/*
16513				scrollbar buttons scrolling type 
16514				values (string): "stepless", "stepped"
16515				*/
16516				scrollType:"stepless",
16517				/*
16518				scrolling amount in pixels
16519				values: "auto", integer 
16520				*/
16521				scrollAmount:"auto"
16522				/*
16523				tabindex of the scrollbar buttons
16524				values: false, integer
16525					option						default
16526					-------------------------------------
16527					tabindex					null
16528				*/
16529			},
16530			/* 
16531			keyboard scrolling
16532			*/
16533			keyboard:{ 
16534				/*
16535				enable scrolling via keyboard
16536				values: boolean
16537				*/
16538				enable:true,
16539				/*
16540				keyboard scrolling type 
16541				values (string): "stepless", "stepped"
16542				*/
16543				scrollType:"stepless",
16544				/*
16545				scrolling amount in pixels
16546				values: "auto", integer 
16547				*/
16548				scrollAmount:"auto"
16549			},
16550			/*
16551			enable content touch-swipe scrolling 
16552			values: boolean, integer, string (number)
16553			integer values define the axis-specific minimum amount required for scrolling momentum
16554			*/
16555			contentTouchScroll:25,
16556			/*
16557			enable/disable document (default) touch-swipe scrolling 
16558			*/
16559			documentTouchScroll:true,
16560			/*
16561			advanced option parameters
16562			*/
16563			advanced:{
16564				/*
16565				auto-expand content horizontally (for "x" or "yx" axis) 
16566				values: boolean, integer (the value 2 forces the non scrollHeight/scrollWidth method, the value 3 forces the scrollHeight/scrollWidth method)
16567					option						default
16568					-------------------------------------
16569					autoExpandHorizontalScroll	null
16570				*/
16571				/*
16572				auto-scroll to elements with focus
16573				*/
16574				autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",
16575				/*
16576				auto-update scrollbars on content, element or viewport resize 
16577				should be true for fluid layouts/elements, adding/removing content dynamically, hiding/showing elements, content with images etc. 
16578				values: boolean
16579				*/
16580				updateOnContentResize:true,
16581				/*
16582				auto-update scrollbars each time each image inside the element is fully loaded 
16583				values: "auto", boolean
16584				*/
16585				updateOnImageLoad:"auto",
16586				/*
16587				auto-update scrollbars based on the amount and size changes of specific selectors 
16588				useful when you need to update the scrollbar(s) automatically, each time a type of element is added, removed or changes its size 
16589				values: boolean, string (e.g. "ul li" will auto-update scrollbars each time list-items inside the element are changed) 
16590				a value of true (boolean) will auto-update scrollbars each time any element is changed
16591					option						default
16592					-------------------------------------
16593					updateOnSelectorChange		null
16594				*/
16595				/*
16596				extra selectors that'll allow scrollbar dragging upon mousemove/up, pointermove/up, touchend etc. (e.g. "selector-1, selector-2")
16597					option						default
16598					-------------------------------------
16599					extraDraggableSelectors		null
16600				*/
16601				/*
16602				extra selectors that'll release scrollbar dragging upon mouseup, pointerup, touchend etc. (e.g. "selector-1, selector-2")
16603					option						default
16604					-------------------------------------
16605					releaseDraggableSelectors	null
16606				*/
16607				/*
16608				auto-update timeout 
16609				values: integer (milliseconds)
16610				*/
16611				autoUpdateTimeout:60
16612			},
16613			/* 
16614			scrollbar theme 
16615			values: string (see CSS/plugin URI for a list of ready-to-use themes)
16616			*/
16617			theme:"light",
16618			/*
16619			user defined callback functions
16620			*/
16621			callbacks:{
16622				/*
16623				Available callbacks: 
16624					callback					default
16625					-------------------------------------
16626					onCreate					null
16627					onInit						null
16628					onScrollStart				null
16629					onScroll					null
16630					onTotalScroll				null
16631					onTotalScrollBack			null
16632					whileScrolling				null
16633					onOverflowY					null
16634					onOverflowX					null
16635					onOverflowYNone				null
16636					onOverflowXNone				null
16637					onImageLoad					null
16638					onSelectorChange			null
16639					onBeforeUpdate				null
16640					onUpdate					null
16641				*/
16642				onTotalScrollOffset:0,
16643				onTotalScrollBackOffset:0,
16644				alwaysTriggerOffsets:true
16645			}
16646			/*
16647			add scrollbar(s) on all elements matching the current selector, now and in the future 
16648			values: boolean, string 
16649			string values: "on" (enable), "once" (disable after first invocation), "off" (disable)
16650			liveSelector values: string (selector)
16651				option						default
16652				-------------------------------------
16653				live						false
16654				liveSelector				null
16655			*/
16656		},
16657	
16658	
16659	
16660	
16661	
16662	/* 
16663	----------------------------------------
16664	VARS, CONSTANTS 
16665	----------------------------------------
16666	*/
16667	
16668		totalInstances=0, /* plugin instances amount */
16669		liveTimers={}, /* live option timers */
16670		oldIE=(window.attachEvent && !window.addEventListener) ? 1 : 0, /* detect IE < 9 */
16671		touchActive=false,touchable, /* global touch vars (for touch and pointer events) */
16672		/* general plugin classes */
16673		classes=[
16674			"mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar",
16675			"mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer",
16676			"mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft colored_theme_hover_text","mCSB_buttonRight colored_theme_hover_text"
16677		],
16678		touchOffCustom = false;
vendor: 22,935 bytes, lines 16678-17242
16678
16679		
16680	
16681	
16682	
16683	
16684	/* 
16685	----------------------------------------
16686	METHODS 
16687	----------------------------------------
16688	*/
16689	
16690		methods={
16691			
16692			/* 
16693			plugin initialization method 
16694			creates the scrollbar(s), plugin data object and options
16695			----------------------------------------
16696			*/
16697			
16698			init:function(options){
16699				
16700				var options=$.extend(true,{},defaults,options),
16701					selector=_selector.call(this); /* validate selector */
16702				
16703				/* 
16704				if live option is enabled, monitor for elements matching the current selector and 
16705				apply scrollbar(s) when found (now and in the future) 
16706				*/
16707				if(options.live){
16708					var liveSelector=options.liveSelector || this.selector || defaultSelector, /* live selector(s) */
16709						$liveSelector=$(liveSelector); /* live selector(s) as jquery object */
16710					if(options.live==="off"){
16711						/* 
16712						disable live if requested 
16713						usage: $(selector).mCustomScrollbar({live:"off"}); 
16714						*/
16715						removeLiveTimers(liveSelector);
16716						return;
16717					}
16718					liveTimers[liveSelector]=setTimeout(function(){
16719						/* call mCustomScrollbar fn on live selector(s) every half-second */
16720						$liveSelector.mCustomScrollbar(options);
16721						if(options.live==="once" && $liveSelector.length){
16722							/* disable live after first invocation */
16723							removeLiveTimers(liveSelector);
16724						}
16725					},500);
16726				}else{
16727					removeLiveTimers(liveSelector);
16728				}
16729				
16730				/* options backward compatibility (for versions < 3.0.0) and normalization */
16731				options.setWidth=(options.set_width) ? options.set_width : options.setWidth;
16732				options.setHeight=(options.set_height) ? options.set_height : options.setHeight;
16733				options.axis=(options.horizontalScroll) ? "x" : _findAxis(options.axis);
16734				options.scrollInertia=options.scrollInertia>0 && options.scrollInertia<17 ? 17 : options.scrollInertia;
16735				if(typeof options.mouseWheel!=="object" &&  options.mouseWheel==true){ /* old school mouseWheel option (non-object) */
16736					options.mouseWheel={enable:true,scrollAmount:"auto",axis:"y",preventDefault:false,deltaFactor:"auto",normalizeDelta:false,invert:false}
16737				}
16738				options.mouseWheel.scrollAmount=!options.mouseWheelPixels ? options.mouseWheel.scrollAmount : options.mouseWheelPixels;
16739				options.mouseWheel.normalizeDelta=!options.advanced.normalizeMouseWheelDelta ? options.mouseWheel.normalizeDelta : options.advanced.normalizeMouseWheelDelta;
16740				options.scrollButtons.scrollType=_findScrollButtonsType(options.scrollButtons.scrollType); 
16741				
16742				_theme(options); /* theme-specific options */
16743				
16744				/* plugin constructor */
16745				return $(selector).each(function(){
16746					
16747					var $this=$(this);
16748					
16749					if(!$this.data(pluginPfx)){ /* prevent multiple instantiations */
16750					
16751						/* store options and create objects in jquery data */
16752						$this.data(pluginPfx,{
16753							idx:++totalInstances, /* instance index */
16754							opt:options, /* options */
16755							scrollRatio:{y:null,x:null}, /* scrollbar to content ratio */
16756							overflowed:null, /* overflowed axis */
16757							contentReset:{y:null,x:null}, /* object to check when content resets */
16758							bindEvents:false, /* object to check if events are bound */
16759							tweenRunning:false, /* object to check if tween is running */
16760							sequential:{}, /* sequential scrolling object */
16761							langDir:$this.css("direction"), /* detect/store direction (ltr or rtl) */
16762							cbOffsets:null, /* object to check whether callback offsets always trigger */
16763							/* 
16764							object to check how scrolling events where last triggered 
16765							"internal" (default - triggered by this script), "external" (triggered by other scripts, e.g. via scrollTo method) 
16766							usage: object.data("mCS").trigger
16767							*/
16768							trigger:null,
16769							/* 
16770							object to check for changes in elements in order to call the update method automatically 
16771							*/
16772							poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}
16773						});
16774						
16775						var d=$this.data(pluginPfx),o=d.opt,
16776							/* HTML data attributes */
16777							htmlDataAxis=$this.data("mcs-axis"),htmlDataSbPos=$this.data("mcs-scrollbar-position"),htmlDataTheme=$this.data("mcs-theme");
16778						 
16779						if(htmlDataAxis){o.axis=htmlDataAxis;} /* usage example: data-mcs-axis="y" */
16780						if(htmlDataSbPos){o.scrollbarPosition=htmlDataSbPos;} /* usage example: data-mcs-scrollbar-position="outside" */
16781						if(htmlDataTheme){ /* usage example: data-mcs-theme="minimal" */
16782							o.theme=htmlDataTheme;
16783							_theme(o); /* theme-specific options */
16784						}
16785						
16786						_pluginMarkup.call(this); /* add plugin markup */
16787						
16788						if(d && o.callbacks.onCreate && typeof o.callbacks.onCreate==="function"){o.callbacks.onCreate.call(this);} /* callbacks: onCreate */
16789						
16790						$("#mCSB_"+d.idx+"_container img:not(."+classes[2]+")").addClass(classes[2]); /* flag loaded images */
16791						
16792						methods.update.call(null,$this); /* call the update method */
16793					
16794					}
16795					
16796				});
16797				
16798			},
16799			/* ---------------------------------------- */
16800			
16801			
16802			
16803			/* 
16804			plugin update method 
16805			updates content and scrollbar(s) values, events and status 
16806			----------------------------------------
16807			usage: $(selector).mCustomScrollbar("update");
16808			*/
16809			
16810			update:function(el,cb){
16811				
16812				var selector=el || _selector.call(this); /* validate selector */
16813				
16814				return $(selector).each(function(){
16815					
16816					var $this=$(this);
16817					
16818					if($this.data(pluginPfx)){ /* check if plugin has initialized */
16819						
16820						var d=$this.data(pluginPfx),o=d.opt,
16821							mCSB_container=$("#mCSB_"+d.idx+"_container"),
16822							mCustomScrollBox=$("#mCSB_"+d.idx),
16823							mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
16824						
16825						if(!mCSB_container.length){return;}
16826						
16827						if(d.tweenRunning){_stop($this);} /* stop any running tweens while updating */
16828						
16829						if(cb && d && o.callbacks.onBeforeUpdate && typeof o.callbacks.onBeforeUpdate==="function"){o.callbacks.onBeforeUpdate.call(this);} /* callbacks: onBeforeUpdate */
16830						
16831						/* if element was disabled or destroyed, remove class(es) */
16832						if($this.hasClass(classes[3])){$this.removeClass(classes[3]);}
16833						if($this.hasClass(classes[4])){$this.removeClass(classes[4]);}
16834						
16835						/* css flexbox fix, detect/set max-height */
16836						mCustomScrollBox.css("max-height","none");
16837						if(mCustomScrollBox.height()!==$this.height()){mCustomScrollBox.css("max-height",$this.height());}
16838						
16839						_expandContentHorizontally.call(this); /* expand content horizontally */
16840						
16841						if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){
16842							mCSB_container.css("width",_contentWidth(mCSB_container));
16843						}
16844						
16845						d.overflowed=_overflowed.call(this); /* determine if scrolling is required */
16846						
16847						_scrollbarVisibility.call(this); /* show/hide scrollbar(s) */
16848						
16849						/* auto-adjust scrollbar dragger length analogous to content */
16850						if(o.autoDraggerLength){_setDraggerLength.call(this);}
16851						
16852						_scrollRatio.call(this); /* calculate and store scrollbar to content ratio */
16853						
16854						_bindEvents.call(this); /* bind scrollbar events */
16855						
16856						/* reset scrolling position and/or events */
16857						var to=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)];
16858						if(o.axis!=="x"){ /* y/yx axis */
16859							if(!d.overflowed[0]){ /* y scrolling is not required */
16860								_resetContentPosition.call(this); /* reset content position */
16861								if(o.axis==="y"){
16862									_unbindEvents.call(this);
16863								}else if(o.axis==="yx" && d.overflowed[1]){
16864									_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
16865								}
16866							}else if(mCSB_dragger[0].height()>mCSB_dragger[0].parent().height()){
16867								_resetContentPosition.call(this); /* reset content position */
16868							}else{ /* y scrolling is required */
16869								_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
16870								d.contentReset.y=null;
16871							}
16872						}
16873						if(o.axis!=="y"){ /* x/yx axis */
16874							if(!d.overflowed[1]){ /* x scrolling is not required */
16875								_resetContentPosition.call(this); /* reset content position */
16876								if(o.axis==="x"){
16877									_unbindEvents.call(this);
16878								}else if(o.axis==="yx" && d.overflowed[0]){
16879									_scrollTo($this,to[0].toString(),{dir:"y",dur:0,overwrite:"none"});
16880								}
16881							}else if(mCSB_dragger[1].width()>mCSB_dragger[1].parent().width()){
16882								_resetContentPosition.call(this); /* reset content position */
16883							}else{ /* x scrolling is required */
16884								_scrollTo($this,to[1].toString(),{dir:"x",dur:0,overwrite:"none"});
16885								d.contentReset.x=null;
16886							}
16887						}
16888						
16889						/* callbacks: onImageLoad, onSelectorChange, onUpdate */
16890						if(cb && d){
16891							if(cb===2 && o.callbacks.onImageLoad && typeof o.callbacks.onImageLoad==="function"){
16892								o.callbacks.onImageLoad.call(this);
16893							}else if(cb===3 && o.callbacks.onSelectorChange && typeof o.callbacks.onSelectorChange==="function"){
16894								o.callbacks.onSelectorChange.call(this);
16895							}else if(o.callbacks.onUpdate && typeof o.callbacks.onUpdate==="function"){
16896								o.callbacks.onUpdate.call(this);
16897							}
16898						}
16899						
16900						_autoUpdate.call(this); /* initialize automatic updating (for dynamic content, fluid layouts etc.) */
16901						
16902					}
16903					
16904				});
16905				
16906			},
16907			/* ---------------------------------------- */
16908			
16909			
16910			
16911			/* 
16912			plugin scrollTo method 
16913			triggers a scrolling event to a specific value
16914			----------------------------------------
16915			usage: $(selector).mCustomScrollbar("scrollTo",value,options);
16916			*/
16917		
16918			scrollTo:function(val,options){
16919				
16920				/* prevent silly things like $(selector).mCustomScrollbar("scrollTo",undefined); */
16921				if(typeof val=="undefined" || val==null){return;}
16922				
16923				var selector=_selector.call(this); /* validate selector */
16924				
16925				return $(selector).each(function(){
16926					
16927					var $this=$(this);
16928					
16929					if($this.data(pluginPfx)){ /* check if plugin has initialized */
16930					
16931						var d=$this.data(pluginPfx),o=d.opt,
16932							/* method default options */
16933							methodDefaults={
16934								trigger:"external", /* method is by default triggered externally (e.g. from other scripts) */
16935								scrollInertia:o.scrollInertia, /* scrolling inertia (animation duration) */
16936								scrollEasing:"mcsEaseInOut", /* animation easing */
16937								moveDragger:false, /* move dragger instead of content */
16938								timeout:60, /* scroll-to delay */
16939								callbacks:true, /* enable/disable callbacks */
16940								onStart:true,
16941								onUpdate:true,
16942								onComplete:true
16943							},
16944							methodOptions=$.extend(true,{},methodDefaults,options),
16945							to=_arr.call(this,val),dur=methodOptions.scrollInertia>0 && methodOptions.scrollInertia<17 ? 17 : methodOptions.scrollInertia;
16946						
16947						/* translate yx values to actual scroll-to positions */
16948						to[0]=_to.call(this,to[0],"y");
16949						to[1]=_to.call(this,to[1],"x");
16950						
16951						/* 
16952						check if scroll-to value moves the dragger instead of content. 
16953						Only pixel values apply on dragger (e.g. 100, "100px", "-=100" etc.) 
16954						*/
16955						if(methodOptions.moveDragger){
16956							to[0]*=d.scrollRatio.y;
16957							to[1]*=d.scrollRatio.x;
16958						}
16959						
16960						methodOptions.dur=_isTabHidden() ? 0 : dur; //skip animations if browser tab is hidden
16961						setTimeout(function(){ 
16962							/* do the scrolling */
16963							if(to[0]!==null && typeof to[0]!=="undefined" && o.axis!=="x" && d.overflowed[0]){ /* scroll y */
16964								methodOptions.dir="y";
16965								methodOptions.overwrite="all";
16966								_scrollTo($this,to[0].toString(),methodOptions);
16967							}
16968							if(to[1]!==null && typeof to[1]!=="undefined" && o.axis!=="y" && d.overflowed[1]){ /* scroll x */
16969								methodOptions.dir="x";
16970								methodOptions.overwrite="none";
16971								_scrollTo($this,to[1].toString(),methodOptions);
16972							}
16973						},methodOptions.timeout);
16974						
16975					}
16976					
16977				});
16978				
16979			},
16980			/* ---------------------------------------- */
16981			
16982			
16983			
16984			/*
16985			plugin stop method 
16986			stops scrolling animation
16987			----------------------------------------
16988			usage: $(selector).mCustomScrollbar("stop");
16989			*/
16990			stop:function(){
16991				
16992				var selector=_selector.call(this); /* validate selector */
16993				
16994				return $(selector).each(function(){
16995					
16996					var $this=$(this);
16997					
16998					if($this.data(pluginPfx)){ /* check if plugin has initialized */
16999										
17000						_stop($this);
17001					
17002					}
17003					
17004				});
17005				
17006			},
17007			/* ---------------------------------------- */
17008			
17009			
17010			
17011			/*
17012			plugin disable method 
17013			temporarily disables the scrollbar(s) 
17014			----------------------------------------
17015			usage: $(selector).mCustomScrollbar("disable",reset); 
17016			reset (boolean): resets content position to 0 
17017			*/
17018			disable:function(r){
17019				
17020				var selector=_selector.call(this); /* validate selector */
17021				
17022				return $(selector).each(function(){
17023					
17024					var $this=$(this);
17025					
17026					if($this.data(pluginPfx)){ /* check if plugin has initialized */
17027						
17028						var d=$this.data(pluginPfx);
17029						
17030						_autoUpdate.call(this,"remove"); /* remove automatic updating */
17031						
17032						_unbindEvents.call(this); /* unbind events */
17033						
17034						if(r){_resetContentPosition.call(this);} /* reset content position */
17035						
17036						_scrollbarVisibility.call(this,true); /* show/hide scrollbar(s) */
17037						
17038						$this.addClass(classes[3]); /* add disable class */
17039					
17040					}
17041					
17042				});
17043				
17044			},
17045			/* ---------------------------------------- */
17046			
17047			
17048			
17049			/*
17050			plugin destroy method 
17051			completely removes the scrollbar(s) and returns the element to its original state
17052			----------------------------------------
17053			usage: $(selector).mCustomScrollbar("destroy"); 
17054			*/
17055			destroy:function(){
17056				
17057				var selector=_selector.call(this); /* validate selector */
17058				
17059				return $(selector).each(function(){
17060					
17061					var $this=$(this);
17062					
17063					if($this.data(pluginPfx)){ /* check if plugin has initialized */
17064					
17065						var d=$this.data(pluginPfx),o=d.opt,
17066							mCustomScrollBox=$("#mCSB_"+d.idx),
17067							mCSB_container=$("#mCSB_"+d.idx+"_container"),
17068							scrollbar=$(".mCSB_"+d.idx+"_scrollbar");
17069					
17070						if(o.live){removeLiveTimers(o.liveSelector || $(selector).selector);} /* remove live timers */
17071						
17072						_autoUpdate.call(this,"remove"); /* remove automatic updating */
17073						
17074						_unbindEvents.call(this); /* unbind events */
17075						
17076						_resetContentPosition.call(this); /* reset content position */
17077						
17078						$this.removeData(pluginPfx); /* remove plugin data object */
17079						
17080						_delete(this,"mcs"); /* delete callbacks object */
17081						
17082						/* remove plugin markup */
17083						scrollbar.remove(); /* remove scrollbar(s) first (those can be either inside or outside plugin's inner wrapper) */
17084						mCSB_container.find("img."+classes[2]).removeClass(classes[2]); /* remove loaded images flag */
17085						mCustomScrollBox.replaceWith(mCSB_container.contents()); /* replace plugin's inner wrapper with the original content */
17086						/* remove plugin classes from the element and add destroy class */
17087						$this.removeClass(pluginNS+" _"+pluginPfx+"_"+d.idx+" "+classes[6]+" "+classes[7]+" "+classes[5]+" "+classes[3]).addClass(classes[4]);
17088					
17089					}
17090					
17091				});
17092				
17093			}
17094			/* ---------------------------------------- */
17095			
17096		},
17097	
17098	
17099	
17100	
17101		
17102	/* 
17103	----------------------------------------
17104	FUNCTIONS
17105	----------------------------------------
17106	*/
17107	
17108		/* validates selector (if selector is invalid or undefined uses the default one) */
17109		_selector=function(){
17110			return (typeof $(this)!=="object" || $(this).length<1) ? defaultSelector : this;
17111		},
17112		/* -------------------- */
17113		
17114		
17115		/* changes options according to theme */
17116		_theme=function(obj){
17117			var fixedSizeScrollbarThemes=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],
17118				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"],
17119				disabledScrollButtonsThemes=["minimal","minimal-dark"],
17120				enabledAutoHideScrollbarThemes=["minimal","minimal-dark"],
17121				scrollbarPositionOutsideThemes=["minimal","minimal-dark"];
17122			obj.autoDraggerLength=$.inArray(obj.theme,fixedSizeScrollbarThemes) > -1 ? false : obj.autoDraggerLength;
17123			obj.autoExpandScrollbar=$.inArray(obj.theme,nonExpandedScrollbarThemes) > -1 ? false : obj.autoExpandScrollbar;
17124			obj.scrollButtons.enable=$.inArray(obj.theme,disabledScrollButtonsThemes) > -1 ? false : obj.scrollButtons.enable;
17125			obj.autoHideScrollbar=$.inArray(obj.theme,enabledAutoHideScrollbarThemes) > -1 ? true : obj.autoHideScrollbar;
17126			obj.scrollbarPosition=$.inArray(obj.theme,scrollbarPositionOutsideThemes) > -1 ? "outside" : obj.scrollbarPosition;
17127		},
17128		/* -------------------- */
17129		
17130		
17131		/* live option timers removal */
17132		removeLiveTimers=function(selector){
17133			if(liveTimers[selector]){
17134				clearTimeout(liveTimers[selector]);
17135				_delete(liveTimers,selector);
17136			}
17137		},
17138		/* -------------------- */
17139		
17140		
17141		/* normalizes axis option to valid values: "y", "x", "yx" */
17142		_findAxis=function(val){
17143			return (val==="yx" || val==="xy" || val==="auto") ? "yx" : (val==="x" || val==="horizontal") ? "x" : "y";
17144		},
17145		/* -------------------- */
17146		
17147		
17148		/* normalizes scrollButtons.scrollType option to valid values: "stepless", "stepped" */
17149		_findScrollButtonsType=function(val){
17150			return (val==="stepped" || val==="pixels" || val==="step" || val==="click") ? "stepped" : "stepless";
17151		},
17152		/* -------------------- */
17153		
17154		
17155		/* generates plugin markup */
17156		_pluginMarkup=function(){
17157			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
17158				expandClass=o.autoExpandScrollbar ? " "+classes[1]+"_expand" : "",
17159				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>"],
17160				wrapperClass=o.axis==="yx" ? "mCSB_vertical_horizontal" : o.axis==="x" ? "mCSB_horizontal" : "mCSB_vertical",
17161				scrollbars=o.axis==="yx" ? scrollbar[0]+scrollbar[1] : o.axis==="x" ? scrollbar[1] : scrollbar[0],
17162				contentWrapper=o.axis==="yx" ? "<div id='mCSB_"+d.idx+"_container_wrapper' class='mCSB_container_wrapper' />" : "",
17163				autoHideClass=o.autoHideScrollbar ? " "+classes[6] : "",
17164				scrollbarDirClass=(o.axis!=="x" && d.langDir==="rtl") ? " "+classes[7] : "";
17165			if(o.setWidth){$this.css("width",o.setWidth);} /* set element width */
17166			if(o.setHeight){$this.css("height",o.setHeight);} /* set element height */
17167			o.setLeft=(o.axis!=="y" && d.langDir==="rtl") ? "989999px" : o.setLeft; /* adjust left position for rtl direction */
17168			$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>");
17169			var mCustomScrollBox=$("#mCSB_"+d.idx),
17170				mCSB_container=$("#mCSB_"+d.idx+"_container");
17171			if(o.axis!=="y" && !o.advanced.autoExpandHorizontalScroll){
17172				mCSB_container.css("width",_contentWidth(mCSB_container));
17173			}
17174			if(o.scrollbarPosition==="outside"){
17175				if($this.css("position")==="static"){ /* requires elements with non-static position */
17176					$this.css("position","relative");
17177				}
17178				$this.css("overflow","visible");
17179				mCustomScrollBox.addClass("mCSB_outside").after(scrollbars);
17180			}else{
17181				mCustomScrollBox.addClass("mCSB_inside").append(scrollbars);
17182				mCSB_container.wrap(contentWrapper);
17183			}
17184			_scrollButtons.call(this); /* add scrollbar buttons */
17185			/* minimum dragger length */
17186			var mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
17187			mCSB_dragger[0].css("min-height",mCSB_dragger[0].height());
17188			mCSB_dragger[1].css("min-width",mCSB_dragger[1].width());
17189		},
17190		/* -------------------- */
17191		
17192		
17193		/* calculates content width */
17194		_contentWidth=function(el){
17195			var val=[el[0].scrollWidth,Math.max.apply(Math,el.children().map(function(){return $(this).outerWidth(true);}).get())],w=el.parent().width();
17196			return val[0]>w ? val[0] : val[1]>w ? val[1] : "100%";
17197		},
17198		/* -------------------- */
17199		
17200		
17201		/* expands content horizontally */
17202		_expandContentHorizontally=function(){
17203			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
17204				mCSB_container=$("#mCSB_"+d.idx+"_container");
17205			if(o.advanced.autoExpandHorizontalScroll && o.axis!=="y"){
17206				/* calculate scrollWidth */
17207				mCSB_container.css({"width":"auto","min-width":0,"overflow-x":"scroll"});
17208				var w=Math.ceil(mCSB_container[0].scrollWidth);
17209				if(o.advanced.autoExpandHorizontalScroll===3 || (o.advanced.autoExpandHorizontalScroll!==2 && w>mCSB_container.parent().width())){
17210					mCSB_container.css({"width":w,"min-width":"100%","overflow-x":"inherit"});
17211				}else{
17212					/* 
17213					wrap content with an infinite width div and set its position to absolute and width to auto. 
17214					Setting width to auto before calculating the actual width is important! 
17215					We must let the browser set the width as browser zoom values are impossible to calculate.
17216					*/
17217					mCSB_container.css({"overflow-x":"inherit","position":"absolute"})
17218						.wrap("<div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' />")
17219						.css({ /* set actual width, original position and un-wrap */
17220							/* 
17221							get the exact width (with decimals) and then round-up. 
17222							Using jquery outerWidth() will round the width value which will mess up with inner elements that have non-integer width
17223							*/
17224							"width":(Math.ceil(mCSB_container[0].getBoundingClientRect().right+0.4)-Math.floor(mCSB_container[0].getBoundingClientRect().left)),
17225							"min-width":"100%",
17226							"position":"relative"
17227						}).unwrap();
17228				}
17229			}
17230		},
17231		/* -------------------- */
17232		
17233		
17234		/* adds scrollbar buttons */
17235		_scrollButtons=function(){
17236			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
17237				mCSB_scrollTools=$(".mCSB_"+d.idx+"_scrollbar:first"),
17238				tabindex=!_isNumeric(o.scrollButtons.tabindex) ? "" : "tabindex='"+o.scrollButtons.tabindex+"'",
17239				btnHTML=[
17240					"<a href='#' class='"+classes[13]+"' "+tabindex+" />",
17241					"<a href='#' class='"+classes[14]+"' "+tabindex+" />",
17242					"<a href='#' class='"+classes[15]+"' "+tabindex+" 
17242><i class='svg right'><svg width='12' height='6.969' viewBox='0 0 12 6.969'><path class='cls-1' d='M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z' transform='translate(-350 -395.031)'></path></svg></i></a>",
17243					"<a href='#' class='"+classes[16]+"' "+tabindex+" ><i class='svg right'><svg width='12' height='6.969' viewBox='0 0 12 6.969'><path class='cls-1' d='M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.99
vendor: 13,291 bytes, lines 17243-17550
172431,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z' transform='translate(-350 -395.031)'></path></svg></i></a>"
17244				],
17245				btn=[(o.axis==="x" ? btnHTML[2] : btnHTML[0]),(o.axis==="x" ? btnHTML[3] : btnHTML[1]),btnHTML[2],btnHTML[3]];
17246			if(o.scrollButtons.enable){
17247				mCSB_scrollTools.prepend(btn[0]).append(btn[1]).next(".mCSB_scrollTools").prepend(btn[2]).append(btn[3]);
17248			}
17249		},
17250		/* -------------------- */
17251		
17252		
17253		/* auto-adjusts scrollbar dragger length */
17254		_setDraggerLength=function(){
17255			var $this=$(this),d=$this.data(pluginPfx),
17256				mCustomScrollBox=$("#mCSB_"+d.idx),
17257				mCSB_container=$("#mCSB_"+d.idx+"_container"),
17258				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
17259				ratio=[mCustomScrollBox.height()/mCSB_container.outerHeight(false),mCustomScrollBox.width()/mCSB_container.outerWidth(false)],
17260				l=[
17261					parseInt(mCSB_dragger[0].css("min-height")),Math.round(ratio[0]*mCSB_dragger[0].parent().height()),
17262					parseInt(mCSB_dragger[1].css("min-width")),Math.round(ratio[1]*mCSB_dragger[1].parent().width())
17263				],
17264				h=oldIE && (l[1]<l[0]) ? l[0] : l[1],w=oldIE && (l[3]<l[2]) ? l[2] : l[3];
17265			mCSB_dragger[0].css({
17266				"height":h,"max-height":(mCSB_dragger[0].parent().height()-10)
17267			}).find(".mCSB_dragger_bar").css({"line-height":l[0]+"px"});
17268			mCSB_dragger[1].css({
17269				"width":w,"max-width":(mCSB_dragger[1].parent().width()-10)
17270			});
17271		},
17272		/* -------------------- */
17273		
17274		
17275		/* calculates scrollbar to content ratio */
17276		_scrollRatio=function(){
17277			var $this=$(this),d=$this.data(pluginPfx),
17278				mCustomScrollBox=$("#mCSB_"+d.idx),
17279				mCSB_container=$("#mCSB_"+d.idx+"_container"),
17280				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
17281				scrollAmount=[mCSB_container.outerHeight(false)-mCustomScrollBox.height(),mCSB_container.outerWidth(false)-mCustomScrollBox.width()],
17282				ratio=[
17283					scrollAmount[0]/(mCSB_dragger[0].parent().height()-mCSB_dragger[0].height()),
17284					scrollAmount[1]/(mCSB_dragger[1].parent().width()-mCSB_dragger[1].width())
17285				];
17286			d.scrollRatio={y:ratio[0],x:ratio[1]};
17287		},
17288		/* -------------------- */
17289		
17290		
17291		/* toggles scrolling classes */
17292		_onDragClasses=function(el,action,xpnd){
17293			var expandClass=xpnd ? classes[0]+"_expanded" : "",
17294				scrollbar=el.closest(".mCSB_scrollTools");
17295			if(action==="active"){
17296				el.toggleClass(classes[0]+" "+expandClass); scrollbar.toggleClass(classes[1]); 
17297				el[0]._draggable=el[0]._draggable ? 0 : 1;
17298			}else{
17299				if(!el[0]._draggable){
17300					if(action==="hide"){
17301						el.removeClass(classes[0]); scrollbar.removeClass(classes[1]);
17302					}else{
17303						el.addClass(classes[0]); scrollbar.addClass(classes[1]);
17304					}
17305				}
17306			}
17307		},
17308		/* -------------------- */
17309		
17310		
17311		/* checks if content overflows its container to determine if scrolling is required */
17312		_overflowed=function(){
17313			var $this=$(this),d=$this.data(pluginPfx),
17314				mCustomScrollBox=$("#mCSB_"+d.idx),
17315				mCSB_container=$("#mCSB_"+d.idx+"_container"),
17316				contentHeight=d.overflowed==null ? mCSB_container.height() : mCSB_container.outerHeight(false),
17317				contentWidth=d.overflowed==null ? mCSB_container.width() : mCSB_container.outerWidth(false),
17318				h=mCSB_container[0].scrollHeight,w=mCSB_container[0].scrollWidth;
17319			if(h>contentHeight){contentHeight=h;}
17320			if(w>contentWidth){contentWidth=w;}
17321			return [contentHeight>mCustomScrollBox.height(),contentWidth>mCustomScrollBox.width()];
17322		},
17323		/* -------------------- */
17324		
17325		
17326		/* resets content position to 0 */
17327		_resetContentPosition=function(){
17328			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
17329				mCustomScrollBox=$("#mCSB_"+d.idx),
17330				mCSB_container=$("#mCSB_"+d.idx+"_container"),
17331				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")];
17332			_stop($this); /* stop any current scrolling before resetting */
17333			if((o.axis!=="x" && !d.overflowed[0]) || (o.axis==="y" && d.overflowed[0])){ /* reset y */
17334				mCSB_dragger[0].add(mCSB_container).css("top",0);
17335				_scrollTo($this,"_resetY");
17336			}
17337			if((o.axis!=="y" && !d.overflowed[1]) || (o.axis==="x" && d.overflowed[1])){ /* reset x */
17338				var cx=dx=0;
17339				if(d.langDir==="rtl"){ /* adjust left position for rtl direction */
17340					cx=mCustomScrollBox.width()-mCSB_container.outerWidth(false);
17341					dx=Math.abs(cx/d.scrollRatio.x);
17342				}
17343				mCSB_container.css("left",cx);
17344				mCSB_dragger[1].css("left",dx);
17345				_scrollTo($this,"_resetX");
17346			}
17347		},
17348		/* -------------------- */
17349		
17350		
17351		/* binds scrollbar events */
17352		_bindEvents=function(){
17353			var $this=$(this),d=$this.data(pluginPfx),o=d.opt;
17354			if(!d.bindEvents){ /* check if events are already bound */
17355				_draggable.call(this);
17356				if(o.contentTouchScroll){_contentDraggable.call(this);}
17357				_selectable.call(this);
17358				if(o.mouseWheel.enable){ /* bind mousewheel fn when plugin is available */
17359					function _mwt(){
17360						mousewheelTimeout=setTimeout(function(){
17361							if(!$.event.special.mousewheel){
17362								_mwt();
17363							}else{
17364								clearTimeout(mousewheelTimeout);
17365								_mousewheel.call($this[0]);
17366							}
17367						},100);
17368					}
17369					var mousewheelTimeout;
17370					_mwt();
17371				}
17372				_draggerRail.call(this);
17373				_wrapperScroll.call(this);
17374				if(o.advanced.autoScrollOnFocus){_focus.call(this);}
17375				if(o.scrollButtons.enable){_buttons.call(this);}
17376				if(o.keyboard.enable){_keyboard.call(this);}
17377				d.bindEvents=true;
17378			}
17379		},
17380		/* -------------------- */
17381		
17382		
17383		/* unbinds scrollbar events */
17384		_unbindEvents=function(){
17385			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
17386				namespace=pluginPfx+"_"+d.idx,
17387				sb=".mCSB_"+d.idx+"_scrollbar",
17388				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"),
17389				mCSB_container=$("#mCSB_"+d.idx+"_container");
17390			if(o.advanced.releaseDraggableSelectors){sel.add($(o.advanced.releaseDraggableSelectors));}
17391			if(o.advanced.extraDraggableSelectors){sel.add($(o.advanced.extraDraggableSelectors));}
17392			if(d.bindEvents){ /* check if events are bound */
17393				/* unbind namespaced events from document/selectors */
17394				$(document).add($(!_canAccessIFrame() || top.document)).unbind("."+namespace);
17395				sel.each(function(){
17396					$(this).unbind("."+namespace);
17397				});
17398				/* clear and delete timeouts/objects */
17399				clearTimeout($this[0]._focusTimeout); _delete($this[0],"_focusTimeout");
17400				clearTimeout(d.sequential.step); _delete(d.sequential,"step");
17401				clearTimeout(mCSB_container[0].onCompleteTimeout); _delete(mCSB_container[0],"onCompleteTimeout");
17402				d.bindEvents=false;
17403			}
17404		},
17405		/* -------------------- */
17406		
17407		
17408		/* toggles scrollbar visibility */
17409		_scrollbarVisibility=function(disabled){
17410			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
17411				contentWrapper=$("#mCSB_"+d.idx+"_container_wrapper"),
17412				content=contentWrapper.length ? contentWrapper : $("#mCSB_"+d.idx+"_container"),
17413				scrollbar=[$("#mCSB_"+d.idx+"_scrollbar_vertical"),$("#mCSB_"+d.idx+"_scrollbar_horizontal")],
17414				mCSB_dragger=[scrollbar[0].find(".mCSB_dragger"),scrollbar[1].find(".mCSB_dragger")];
17415			if(o.axis!=="x"){
17416				if(d.overflowed[0] && !disabled){
17417					scrollbar[0].add(mCSB_dragger[0]).add(scrollbar[0].children("a")).css("display","block");
17418					content.removeClass(classes[8]+" "+classes[10]);
17419				}else{
17420					if(o.alwaysShowScrollbar){
17421						if(o.alwaysShowScrollbar!==2){mCSB_dragger[0].css("display","none");}
17422						content.removeClass(classes[10]);
17423					}else{
17424						scrollbar[0].css("display","none");
17425						content.addClass(classes[10]);
17426					}
17427					content.addClass(classes[8]);
17428				}
17429			}
17430			if(o.axis!=="y"){
17431				if(d.overflowed[1] && !disabled){
17432					scrollbar[1].add(mCSB_dragger[1]).add(scrollbar[1].children("a")).css("display","block");
17433					content.removeClass(classes[9]+" "+classes[11]);
17434				}else{
17435					if(o.alwaysShowScrollbar){
17436						if(o.alwaysShowScrollbar!==2){mCSB_dragger[1].css("display","none");}
17437						content.removeClass(classes[11]);
17438					}else{
17439						scrollbar[1].css("display","none");
17440						content.addClass(classes[11]);
17441					}
17442					content.addClass(classes[9]);
17443				}
17444			}
17445			if(!d.overflowed[0] && !d.overflowed[1]){
17446				$this.addClass(classes[5]);
17447			}else{
17448				$this.removeClass(classes[5]);
17449			}
17450		},
17451		/* -------------------- */
17452		
17453		
17454		/* returns input coordinates of pointer, touch and mouse events (relative to document) */
17455		_coordinates=function(e){
17456			var t=e.type,o=e.target.ownerDocument!==document && frameElement!==null ? [$(frameElement).offset().top,$(frameElement).offset().left] : null,
17457				io=_canAccessIFrame() && e.target.ownerDocument!==top.document && frameElement!==null ? [$(e.view.frameElement).offset().top,$(e.view.frameElement).offset().left] : [0,0];
17458			switch(t){
17459				case "pointerdown": case "MSPointerDown": case "pointermove": case "MSPointerMove": case "pointerup": case "MSPointerUp":
17460					return o ? [e.originalEvent.pageY-o[0]+io[0],e.originalEvent.pageX-o[1]+io[1],false] : [e.originalEvent.pageY,e.originalEvent.pageX,false];
17461					break;
17462				case "touchstart": case "touchmove": case "touchend":
17463					var touch=e.originalEvent.touches[0] || e.originalEvent.changedTouches[0],
17464						touches=e.originalEvent.touches.length || e.originalEvent.changedTouches.length;
17465					return e.target.ownerDocument!==document ? [touch.screenY,touch.screenX,touches>1] : [touch.pageY,touch.pageX,touches>1];
17466					break;
17467				default:
17468					return o ? [e.pageY-o[0]+io[0],e.pageX-o[1]+io[1],false] : [e.pageY,e.pageX,false];
17469			}
17470		},
17471		/* -------------------- */
17472		
17473		
17474		/* 
17475		SCROLLBAR DRAG EVENTS
17476		scrolls content via scrollbar dragging 
17477		*/
17478		_draggable=function(){
17479			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
17480				namespace=pluginPfx+"_"+d.idx,
17481				draggerId=["mCSB_"+d.idx+"_dragger_vertical","mCSB_"+d.idx+"_dragger_horizontal"],
17482				mCSB_container=$("#mCSB_"+d.idx+"_container"),
17483				mCSB_dragger=$("#"+draggerId[0]+",#"+draggerId[1]),
17484				draggable,dragY,dragX,
17485				rds=o.advanced.releaseDraggableSelectors ? mCSB_dragger.add($(o.advanced.releaseDraggableSelectors)) : mCSB_dragger,
17486				eds=o.advanced.extraDraggableSelectors ? $(!_canAccessIFrame() || top.document).add($(o.advanced.extraDraggableSelectors)) : $(!_canAccessIFrame() || top.document);
17487			mCSB_dragger.bind("contextmenu."+namespace,function(e){
17488				e.preventDefault(); //prevent right click
17489			}).bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
17490				e.stopImmediatePropagation();
17491				e.preventDefault();
17492				if(!_mouseBtnLeft(e)){return;} /* left mouse button only */
17493				touchActive=true;
17494				if(oldIE){document.onselectstart=function(){return false;}} /* disable text selection for IE < 9 */
17495				_iframe.call(mCSB_container,false); /* enable scrollbar dragging over iframes by disabling their events */
17496				_stop($this);
17497				draggable=$(this);
17498				var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left,
17499					h=draggable.height()+offset.top,w=draggable.width()+offset.left;
17500				if(y<h && y>0 && x<w && x>0){
17501					dragY=y; 
17502					dragX=x;
17503				}
17504				_onDragClasses(draggable,"active",o.autoExpandScrollbar); 
17505			}).bind("touchmove."+namespace,function(e){
17506				e.stopImmediatePropagation();
17507				e.preventDefault();
17508				var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
17509				_drag(dragY,dragX,y,x);
17510			});
17511			$(document).add(eds).bind("mousemove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace,function(e){
17512				if(draggable){
17513					var offset=draggable.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
17514					if(dragY===y && dragX===x){return;} /* has it really moved? */
17515					_drag(dragY,dragX,y,x);
17516				}
17517			}).add(rds).bind("mouseup."+namespace+" touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){
17518				if(draggable){
17519					_onDragClasses(draggable,"active",o.autoExpandScrollbar); 
17520					draggable=null;
17521				}
17522				touchActive=false;
17523				if(oldIE){document.onselectstart=null;} /* enable text selection for IE < 9 */
17524				_iframe.call(mCSB_container,true); /* enable iframes events */
17525			});
17526			function _drag(dragY,dragX,y,x){
17527				mCSB_container[0].idleTimer=o.scrollInertia<233 ? 250 : 0;
17528				if(draggable.attr("id")===draggerId[1]){
17529					var dir="x",to=((draggable[0].offsetLeft-dragX)+x)*d.scrollRatio.x;
17530				}else{
17531					var dir="y",to=((draggable[0].offsetTop-dragY)+y)*d.scrollRatio.y;
17532				}
17533				_scrollTo($this,to.toString(),{dir:dir,drag:true});
17534			}
17535		},
17536		/* -------------------- */
17537		
17538		
17539		/* 
17540		TOUCH SWIPE EVENTS
17541		scrolls content via touch swipe 
17542		Emulates the native touch-swipe scrolling with momentum found in iOS, Android and WP devices 
17543		*/
17544		_contentDraggable=function(){
17545			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
17546				namespace=pluginPfx+"_"+d.idx,
17547				mCustomScrollBox=$("#mCSB_"+d.idx),
17548				mCSB_container=$("#mCSB_"+d.idx+"_container"),
17549				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
17550				draggable,dragY,dragX,touchStartY,touchStartX,touchMoveY=[],touchMoveX=[],startTime,runningTime,endTime,distance,speed,amount,
17551				durA=0,durB,overwrite=o.axis==="yx" ? "none" : "all",touchIntent=[],touchDrag,docDrag,
17552				iframe=mCSB_container.find("iframe"),
17553				events=[
17554					"touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace, //start
17555					"touchmove."+namespace+" pointermove."+namespace+" MSPointerMove."+namespace, //move
17556					"touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace //end
17557				],
17558				touchAction=document.body.style.touchAction!==undefined && document.body.style.touchAction!=="";
17559			mCSB_container.bind(events[0],function(e){
17560				_onTouchstart(e);
17561			}).bind(events[1],function(e){
17562				_onTouchmove(e);
17563			});
17564			mCustomScrollBox.bind(events[0],function(e){
17565				_onTouchstart2(e);
17566			}).bind(events[2],function(e){
17567				_onTouchend(e);
17568			});
17569			if(iframe.length){
17570				iframe.each(function(){
17571					$(this).bind("load",function(){
17572						/* bind events on accessible iframes */
17573						if(_canAccessIFrame(this)){
17574							$(this.contentDocument || this.contentWindow.document).bind(events[0],function(e){
17575								_onTouchstart(e);
17576								_onTouchstart2(e);
17577							}).bind(events[1],function(e){
17578								_onTouchmove(e);
17579							}).bind(events[2],function(e){
17580								_onTouchend(e);
17581							});
17582						}
17583					});
17584				});
17585			}
17586			function _onTouchstart(e){
17587				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;}
17588
17589				if($(e.target).closest('.bx_ui_slider_track').length){
17590					touchOffCustom = true;
17591					touchable=0; return;
17592				} else {
17593					touchOffCustom = false;
17594				}
17595
17596				touchable=1; touchDrag=0; docDrag=0; draggable=1;
17597				$this.removeClass("mCS_touch_action");
17598				var offset=mCSB_container.offset();
17599				dragY=_coordinates(e)[0]-offset.top;
17600				dragX=_coordinates(e)[1]-offset.left;
17601				touchIntent=[_coordinates(e)[0],_coordinates(e)[1]];
17602
17603			}
17604			function _onTouchmove(e){
17605				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;}
17606
17607				if(touchOffCustom){
17608					touchable=0; return;
17609				}
17610
17611				if(!o.documentTouchScroll){e.preventDefault();} 
17612				e.stopImmediatePropagation();
17613				if(docDrag && !touchDrag){return;}
17614				if(draggable){
17615					runningTime=_getTime();
17616					var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left,
17617						easing="mcsLinearOut";
17618					touchMoveY.push(y);
17619					touchMoveX.push(x);
17620					touchIntent[2]=Math.abs(_coordinates(e)[0]-touchIntent[0]); touchIntent[3]=Math.abs(_coordinates(e)[1]-touchIntent[1]);
17621					if(d.overflowed[0]){
17622						var limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(),
17623							prevent=((dragY-y)>0 && (y-dragY)>-(limit*d.scrollRatio.y) && (touchIntent[3]*2<touchIntent[2] || o.axis==="yx"));
17624					}
17625					if(d.overflowed[1]){
17626						var limitX=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(),
17627							preventX=((dragX-x)>0 && (x-dragX)>-(limitX*d.scrollRatio.x) && (touchIntent[2]*2<touchIntent[3] || o.axis==="yx"));
17628					}
17629					if(prevent || preventX){ /* prevent native document scrolling */
17630						if(!touchAction){e.preventDefault();} 
17631						touchDrag=1;
17632					}else{
17633						docDrag=1;
17634						$this.addClass("mCS_touch_action");
17635					}
17636					if(touchAction){e.preventDefault();} 
17637					amount=o.axis==="yx" ? [(dragY-y),(dragX-x)] : o.axis==="x" ? [null,(dragX-x)] : [(dragY-y),null];
17638					mCSB_container[0].idleTimer=250;
17639					if(d.overflowed[0]){_drag(amount[0],durA,easing,"y","all",true);}
17640					if(d.overflowed[1]){_drag(amount[1],durA,easing,"x",overwrite,true);}
17641				}
17642			}
17643			function _onTouchstart2(e){
17644				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){touchable=0; return;}
17645
17646				if($(e.target).closest('.bx_ui_slider_track').length){
17647					touchOffCustom = true;
17648					touchable=0; return;
17649				} else {
17650					touchOffCustom = false;
17651				}
17652
17653				touchable=1;
17654				e.stopImmediatePropagation();
17655				_stop($this);
17656				startTime=_getTime();
17657				var offset=mCustomScrollBox.offset();
17658				touchStartY=_coordinates(e)[0]-offset.top;
17659				touchStartX=_coordinates(e)[1]-offset.left;
17660				touchMoveY=[]; touchMoveX=[];
17661			}
17662			function _onTouchend(e){				
17663				if(!_pointerTouch(e) || touchActive || _coordinates(e)[2]){return;}
17664
17665				if($(e.target).closest('.bx_ui_slider_track').length){
17666					touchOffCustom = false;
17667					touchable=0; return;
17668				}
vendor: 13,509 bytes, lines 17669-18012
17669
17670				draggable=0;
17671				e.stopImmediatePropagation();
17672				touchDrag=0; docDrag=0;
17673				endTime=_getTime();
17674				var offset=mCustomScrollBox.offset(),y=_coordinates(e)[0]-offset.top,x=_coordinates(e)[1]-offset.left;
17675				if((endTime-runningTime)>30){return;}
17676				speed=1000/(endTime-startTime);
17677				var easing="mcsEaseOut",slow=speed<2.5,
17678					diff=slow ? [touchMoveY[touchMoveY.length-2],touchMoveX[touchMoveX.length-2]] : [0,0];
17679				distance=slow ? [(y-diff[0]),(x-diff[1])] : [y-touchStartY,x-touchStartX];
17680				var absDistance=[Math.abs(distance[0]),Math.abs(distance[1])];
17681				speed=slow ? [Math.abs(distance[0]/4),Math.abs(distance[1]/4)] : [speed,speed];
17682				var a=[
17683					Math.abs(mCSB_container[0].offsetTop)-(distance[0]*_m((absDistance[0]/speed[0]),speed[0])),
17684					Math.abs(mCSB_container[0].offsetLeft)-(distance[1]*_m((absDistance[1]/speed[1]),speed[1]))
17685				];
17686				amount=o.axis==="yx" ? [a[0],a[1]] : o.axis==="x" ? [null,a[1]] : [a[0],null];
17687				durB=[(absDistance[0]*4)+o.scrollInertia,(absDistance[1]*4)+o.scrollInertia];
17688				var md=parseInt(o.contentTouchScroll) || 0; /* absolute minimum distance required */
17689				amount[0]=absDistance[0]>md ? amount[0] : 0;
17690				amount[1]=absDistance[1]>md ? amount[1] : 0;
17691				if(d.overflowed[0]){_drag(amount[0],durB[0],easing,"y",overwrite,false);}
17692				if(d.overflowed[1]){_drag(amount[1],durB[1],easing,"x",overwrite,false);}
17693			}
17694			function _m(ds,s){
17695				var r=[s*1.5,s*2,s/1.5,s/2];
17696				if(ds>90){
17697					return s>4 ? r[0] : r[3];
17698				}else if(ds>60){
17699					return s>3 ? r[3] : r[2];
17700				}else if(ds>30){
17701					return s>8 ? r[1] : s>6 ? r[0] : s>4 ? s : r[2];
17702				}else{
17703					return s>8 ? s : r[3];
17704				}
17705			}
17706			function _drag(amount,dur,easing,dir,overwrite,drag){
17707				if(!amount){return;}
17708				_scrollTo($this,amount.toString(),{dur:dur,scrollEasing:easing,dir:dir,overwrite:overwrite,drag:drag});
17709			}
17710		},
17711		/* -------------------- */
17712		
17713		
17714		/* 
17715		SELECT TEXT EVENTS 
17716		scrolls content when text is selected 
17717		*/
17718		_selectable=function(){
17719			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
17720				namespace=pluginPfx+"_"+d.idx,
17721				mCSB_container=$("#mCSB_"+d.idx+"_container"),
17722				wrapper=mCSB_container.parent(),
17723				action;
17724			mCSB_container.bind("mousedown."+namespace,function(e){
17725				if(touchable){return;}
17726				if(!action){action=1; touchActive=true;}
17727			}).add(document).bind("mousemove."+namespace,function(e){
17728				if(!touchable && action && _sel()){
17729					var offset=mCSB_container.offset(),
17730						y=_coordinates(e)[0]-offset.top+mCSB_container[0].offsetTop,x=_coordinates(e)[1]-offset.left+mCSB_container[0].offsetLeft;
17731					if(y>0 && y<wrapper.height() && x>0 && x<wrapper.width()){
17732						if(seq.step){_seq("off",null,"stepped");}
17733					}else{
17734						if(o.axis!=="x" && d.overflowed[0]){
17735							if(y<0){
17736								_seq("on",38);
17737							}else if(y>wrapper.height()){
17738								_seq("on",40);
17739							}
17740						}
17741						if(o.axis!=="y" && d.overflowed[1]){
17742							if(x<0){
17743								_seq("on",37);
17744							}else if(x>wrapper.width()){
17745								_seq("on",39);
17746							}
17747						}
17748					}
17749				}
17750			}).bind("mouseup."+namespace+" dragend."+namespace,function(e){
17751				if(touchable){return;}
17752				if(action){action=0; _seq("off",null);}
17753				touchActive=false;
17754			});
17755			function _sel(){
17756				return 	window.getSelection ? window.getSelection().toString() : 
17757						document.selection && document.selection.type!="Control" ? document.selection.createRange().text : 0;
17758			}
17759			function _seq(a,c,s){
17760				seq.type=s && action ? "stepped" : "stepless";
17761				seq.scrollAmount=10;
17762				_sequentialScroll($this,a,c,"mcsLinearOut",s ? 60 : null);
17763			}
17764		},
17765		/* -------------------- */
17766		
17767		
17768		/* 
17769		MOUSE WHEEL EVENT
17770		scrolls content via mouse-wheel 
17771		via mouse-wheel plugin (https://github.com/brandonaaron/jquery-mousewheel)
17772		*/
17773		_mousewheel=function(){
17774			if(!$(this).data(pluginPfx)){return;} /* Check if the scrollbar is ready to use mousewheel events (issue: #185) */
17775			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
17776				namespace=pluginPfx+"_"+d.idx,
17777				mCustomScrollBox=$("#mCSB_"+d.idx),
17778				mCSB_dragger=[$("#mCSB_"+d.idx+"_dragger_vertical"),$("#mCSB_"+d.idx+"_dragger_horizontal")],
17779				iframe=$("#mCSB_"+d.idx+"_container").find("iframe");
17780			if(iframe.length){
17781				iframe.each(function(){
17782					$(this).bind("load",function(){
17783						/* bind events on accessible iframes */
17784						if(_canAccessIFrame(this)){
17785							$(this.contentDocument || this.contentWindow.document).bind("mousewheel."+namespace,function(e,delta){
17786								_onMousewheel(e,delta);
17787							});
17788						}
17789					});
17790				});
17791			}
17792			mCustomScrollBox.bind("mousewheel."+namespace,function(e,delta){
17793				_onMousewheel(e,delta);
17794			});
17795			function _onMousewheel(e,delta){
17796				_stop($this);
17797				if(_disableMousewheel($this,e.target)){return;} /* disables mouse-wheel when hovering specific elements */
17798				var deltaFactor=o.mouseWheel.deltaFactor!=="auto" ? parseInt(o.mouseWheel.deltaFactor) : (oldIE && e.deltaFactor<100) ? 100 : e.deltaFactor || 100,
17799					dur=o.scrollInertia;
17800				if(o.axis==="x" || o.mouseWheel.axis==="x"){
17801					var dir="x",
17802						px=[Math.round(deltaFactor*d.scrollRatio.x),parseInt(o.mouseWheel.scrollAmount)],
17803						amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.width() ? mCustomScrollBox.width()*0.9 : px[0],
17804						contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetLeft),
17805						draggerPos=mCSB_dragger[1][0].offsetLeft,
17806						limit=mCSB_dragger[1].parent().width()-mCSB_dragger[1].width(),
17807						dlt=o.mouseWheel.axis==="y" ? (e.deltaY || delta) : e.deltaX;
17808				}else{
17809					var dir="y",
17810						px=[Math.round(deltaFactor*d.scrollRatio.y),parseInt(o.mouseWheel.scrollAmount)],
17811						amount=o.mouseWheel.scrollAmount!=="auto" ? px[1] : px[0]>=mCustomScrollBox.height() ? mCustomScrollBox.height()*0.9 : px[0],
17812						contentPos=Math.abs($("#mCSB_"+d.idx+"_container")[0].offsetTop),
17813						draggerPos=mCSB_dragger[0][0].offsetTop,
17814						limit=mCSB_dragger[0].parent().height()-mCSB_dragger[0].height(),
17815						dlt=e.deltaY || delta;
17816				}
17817				if((dir==="y" && !d.overflowed[0]) || (dir==="x" && !d.overflowed[1])){return;}
17818				if(o.mouseWheel.invert || e.webkitDirectionInvertedFromDevice){dlt=-dlt;}
17819				if(o.mouseWheel.normalizeDelta){dlt=dlt<0 ? -1 : 1;}
17820				if((dlt>0 && draggerPos!==0) || (dlt<0 && draggerPos!==limit) || o.mouseWheel.preventDefault){
17821					e.stopImmediatePropagation();
17822					e.preventDefault();
17823				}
17824				if(e.deltaFactor<5 && !o.mouseWheel.normalizeDelta){
17825					//very low deltaFactor values mean some kind of delta acceleration (e.g. osx trackpad), so adjusting scrolling accordingly
17826					amount=e.deltaFactor; dur=17;
17827				}
17828				_scrollTo($this,(contentPos-(dlt*amount)).toString(),{dir:dir,dur:dur});
17829			}
17830		},
17831		/* -------------------- */
17832		
17833		
17834		/* checks if iframe can be accessed */
17835		_canAccessIFrameCache=new Object(),
17836		_canAccessIFrame=function(iframe){
17837		    var result=false,cacheKey=false,html=null;
17838		    if(iframe===undefined){
17839				cacheKey="#empty";
17840		    }else if($(iframe).attr("id")!==undefined){
17841				cacheKey=$(iframe).attr("id");
17842		    }
17843			if(cacheKey!==false && _canAccessIFrameCache[cacheKey]!==undefined){
17844				return _canAccessIFrameCache[cacheKey];
17845			}
17846			if(!iframe){
17847				try{
17848					var doc=top.document;
17849					html=doc.body.innerHTML;
17850				}catch(err){/* do nothing */}
17851				result=(html!==null);
17852			}else{
17853				try{
17854					var doc=iframe.contentDocument || iframe.contentWindow.document;
17855					html=doc.body.innerHTML;
17856				}catch(err){/* do nothing */}
17857				result=(html!==null);
17858			}
17859			if(cacheKey!==false){_canAccessIFrameCache[cacheKey]=result;}
17860			return result;
17861		},
17862		/* -------------------- */
17863		
17864		
17865		/* switches iframe's pointer-events property (drag, mousewheel etc. over cross-domain iframes) */
17866		_iframe=function(evt){
17867			var el=this.find("iframe");
17868			if(!el.length){return;} /* check if content contains iframes */
17869			var val=!evt ? "none" : "auto";
17870			el.css("pointer-events",val); /* for IE11, iframe's display property should not be "block" */
17871		},
17872		/* -------------------- */
17873		
17874		
17875		/* disables mouse-wheel when hovering specific elements like select, datalist etc. */
17876		_disableMousewheel=function(el,target){
17877			var tag=target.nodeName.toLowerCase(),
17878				tags=el.data(pluginPfx).opt.mouseWheel.disableOver,
17879				/* elements that require focus */
17880				focusTags=["select","textarea"];
17881			return $.inArray(tag,tags) > -1 && !($.inArray(tag,focusTags) > -1 && !$(target).is(":focus"));
17882		},
17883		/* -------------------- */
17884		
17885		
17886		/* 
17887		DRAGGER RAIL CLICK EVENT
17888		scrolls content via dragger rail 
17889		*/
17890		_draggerRail=function(){
17891			var $this=$(this),d=$this.data(pluginPfx),
17892				namespace=pluginPfx+"_"+d.idx,
17893				mCSB_container=$("#mCSB_"+d.idx+"_container"),
17894				wrapper=mCSB_container.parent(),
17895				mCSB_draggerContainer=$(".mCSB_"+d.idx+"_scrollbar ."+classes[12]),
17896				clickable;
17897			mCSB_draggerContainer.bind("mousedown."+namespace+" touchstart."+namespace+" pointerdown."+namespace+" MSPointerDown."+namespace,function(e){
17898				touchActive=true;
17899				if(!$(e.target).hasClass("mCSB_dragger")){clickable=1;}
17900			}).bind("touchend."+namespace+" pointerup."+namespace+" MSPointerUp."+namespace,function(e){
17901				touchActive=false;
17902			}).bind("click."+namespace,function(e){
17903				if(!clickable){return;}
17904				clickable=0;
17905				if($(e.target).hasClass(classes[12]) || $(e.target).hasClass("mCSB_draggerRail")){
17906					_stop($this);
17907					var el=$(this),mCSB_dragger=el.find(".mCSB_dragger");
17908					if(el.parent(".mCSB_scrollTools_horizontal").length>0){
17909						if(!d.overflowed[1]){return;}
17910						var dir="x",
17911							clickDir=e.pageX>mCSB_dragger.offset().left ? -1 : 1,
17912							to=Math.abs(mCSB_container[0].offsetLeft)-(clickDir*(wrapper.width()*0.9));
17913					}else{
17914						if(!d.overflowed[0]){return;}
17915						var dir="y",
17916							clickDir=e.pageY>mCSB_dragger.offset().top ? -1 : 1,
17917							to=Math.abs(mCSB_container[0].offsetTop)-(clickDir*(wrapper.height()*0.9));
17918					}
17919					_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
17920				}
17921			});
17922		},
17923		/* -------------------- */
17924		
17925		
17926		/* 
17927		FOCUS EVENT
17928		scrolls content via element focus (e.g. clicking an input, pressing TAB key etc.)
17929		*/
17930		_focus=function(){
17931			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
17932				namespace=pluginPfx+"_"+d.idx,
17933				mCSB_container=$("#mCSB_"+d.idx+"_container"),
17934				wrapper=mCSB_container.parent();
17935			mCSB_container.bind("focusin."+namespace,function(e){
17936				var el=$(document.activeElement),
17937					nested=mCSB_container.find(".mCustomScrollBox").length,
17938					dur=0;
17939				if(!el.is(o.advanced.autoScrollOnFocus)){return;}
17940				_stop($this);
17941				clearTimeout($this[0]._focusTimeout);
17942				$this[0]._focusTimer=nested ? (dur+17)*nested : 0;
17943				$this[0]._focusTimeout=setTimeout(function(){
17944					var	to=[_childPos(el)[0],_childPos(el)[1]],
17945						contentPos=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft],
17946						isVisible=[
17947							(contentPos[0]+to[0]>=0 && contentPos[0]+to[0]<wrapper.height()-el.outerHeight(false)),
17948							(contentPos[1]+to[1]>=0 && contentPos[0]+to[1]<wrapper.width()-el.outerWidth(false))
17949						],
17950						overwrite=(o.axis==="yx" && !isVisible[0] && !isVisible[1]) ? "none" : "all";
17951					if(o.axis!=="x" && !isVisible[0]){
17952						_scrollTo($this,to[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur});
17953					}
17954					if(o.axis!=="y" && !isVisible[1]){
17955						_scrollTo($this,to[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:overwrite,dur:dur});
17956					}
17957				},$this[0]._focusTimer);
17958			});
17959		},
17960		/* -------------------- */
17961		
17962		
17963		/* sets content wrapper scrollTop/scrollLeft always to 0 */
17964		_wrapperScroll=function(){
17965			var $this=$(this),d=$this.data(pluginPfx),
17966				namespace=pluginPfx+"_"+d.idx,
17967				wrapper=$("#mCSB_"+d.idx+"_container").parent();
17968			wrapper.bind("scroll."+namespace,function(e){
17969				if(wrapper.scrollTop()!==0 || wrapper.scrollLeft()!==0){
17970					$(".mCSB_"+d.idx+"_scrollbar").css("visibility","hidden"); /* hide scrollbar(s) */
17971				}
17972			});
17973		},
17974		/* -------------------- */
17975		
17976		
17977		/* 
17978		BUTTONS EVENTS
17979		scrolls content via up, down, left and right buttons 
17980		*/
17981		_buttons=function(){
17982			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
17983				namespace=pluginPfx+"_"+d.idx,
17984				sel=".mCSB_"+d.idx+"_scrollbar",
17985				btn=$(sel+">a");
17986			btn.bind("contextmenu."+namespace,function(e){
17987				e.preventDefault(); //prevent right click
17988			}).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){
17989				e.preventDefault();
17990				if(!_mouseBtnLeft(e)){return;} /* left mouse button only */
17991				var btnClass=$(this).attr("class");
17992				seq.type=o.scrollButtons.scrollType;
17993				switch(e.type){
17994					case "mousedown": case "touchstart": case "pointerdown": case "MSPointerDown":
17995						if(seq.type==="stepped"){return;}
17996						touchActive=true;
17997						d.tweenRunning=false;
17998						_seq("on",btnClass);
17999						break;
18000					case "mouseup": case "touchend": case "pointerup": case "MSPointerUp":
18001					case "mouseout": case "pointerout": case "MSPointerOut":
18002						if(seq.type==="stepped"){return;}
18003						touchActive=false;
18004						if(seq.dir){_seq("off",btnClass);}
18005						break;
18006					case "click":
18007						if(seq.type!=="stepped" || d.tweenRunning){return;}
18008						_seq("on",btnClass);
18009						break;
18010				}
18011				function _seq(a,c){
18012					
18012//seq.scrollAmount=o.scrollButtons.scrollAmount;
18013					_sequentialScroll($this,a,c);
18014				}
18015			});
18016		},
18017		/* -------------------- */
18018		
18019		
18020		/* 
18021		KEYBOARD EVENTS
18022		scrolls content via keyboard 
18023		Keys: up arrow, down arrow, left arrow, right arrow, PgUp, PgDn, Home, End
18024		*/
18025		_keyboard=function(){
18026			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,seq=d.sequential,
18027				namespace=pluginPfx+"_"+d.idx,
18028				mCustomScrollBox=$("#mCSB_"+d.idx),
18029				mCSB_container=$("#mCSB_"+d.idx+"_container"),
18030				wrapper=mCSB_container.parent(),
18031				editables="input,textarea,select,datalist,keygen,[contenteditable='true']",
18032				iframe=mCSB_container.find("iframe"),
vendor: 23,820 bytes, lines 18033-18687
18033				events=["blur."+namespace+" keydown."+namespace+" keyup."+namespace];
18034			if(iframe.length){
18035				iframe.each(function(){
18036					$(this).bind("load",function(){
18037						/* bind events on accessible iframes */
18038						if(_canAccessIFrame(this)){
18039							$(this.contentDocument || this.contentWindow.document).bind(events[0],function(e){
18040								_onKeyboard(e);
18041							});
18042						}
18043					});
18044				});
18045			}
18046			mCustomScrollBox.attr("tabindex","0").bind(events[0],function(e){
18047				_onKeyboard(e);
18048			});
18049			function _onKeyboard(e){
18050				switch(e.type){
18051					case "blur":
18052						if(d.tweenRunning && seq.dir){_seq("off",null);}
18053						break;
18054					case "keydown": case "keyup":
18055						var code=e.keyCode ? e.keyCode : e.which,action="on";
18056						if((o.axis!=="x" && (code===38 || code===40)) || (o.axis!=="y" && (code===37 || code===39))){
18057							/* up (38), down (40), left (37), right (39) arrows */
18058							if(((code===38 || code===40) && !d.overflowed[0]) || ((code===37 || code===39) && !d.overflowed[1])){return;}
18059							if(e.type==="keyup"){action="off";}
18060							if(!$(document.activeElement).is(editables)){
18061								e.preventDefault();
18062								e.stopImmediatePropagation();
18063								_seq(action,code);
18064							}
18065						}else if(code===33 || code===34){
18066							/* PgUp (33), PgDn (34) */
18067							if(d.overflowed[0] || d.overflowed[1]){
18068								e.preventDefault();
18069								e.stopImmediatePropagation();
18070							}
18071							if(e.type==="keyup"){
18072								_stop($this);
18073								var keyboardDir=code===34 ? -1 : 1;
18074								if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){
18075									var dir="x",to=Math.abs(mCSB_container[0].offsetLeft)-(keyboardDir*(wrapper.width()*0.9));
18076								}else{
18077									var dir="y",to=Math.abs(mCSB_container[0].offsetTop)-(keyboardDir*(wrapper.height()*0.9));
18078								}
18079								_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
18080							}
18081						}else if(code===35 || code===36){
18082							/* End (35), Home (36) */
18083							if(!$(document.activeElement).is(editables)){
18084								if(d.overflowed[0] || d.overflowed[1]){
18085									e.preventDefault();
18086									e.stopImmediatePropagation();
18087								}
18088								if(e.type==="keyup"){
18089									if(o.axis==="x" || (o.axis==="yx" && d.overflowed[1] && !d.overflowed[0])){
18090										var dir="x",to=code===35 ? Math.abs(wrapper.width()-mCSB_container.outerWidth(false)) : 0;
18091									}else{
18092										var dir="y",to=code===35 ? Math.abs(wrapper.height()-mCSB_container.outerHeight(false)) : 0;
18093									}
18094									_scrollTo($this,to.toString(),{dir:dir,scrollEasing:"mcsEaseInOut"});
18095								}
18096							}
18097						}
18098						break;
18099				}
18100				function _seq(a,c){
18101					seq.type=o.keyboard.scrollType;
18102					seq.scrollAmount=o.keyboard.scrollAmount;
18103					if(seq.type==="stepped" && d.tweenRunning){return;}
18104					_sequentialScroll($this,a,c);
18105				}
18106			}
18107		},
18108		/* -------------------- */
18109		
18110		
18111		/* scrolls content sequentially (used when scrolling via buttons, keyboard arrows etc.) */
18112		_sequentialScroll=function(el,action,trigger,e,s){
18113			var d=el.data(pluginPfx),o=d.opt,seq=d.sequential,
18114				mCSB_container=$("#mCSB_"+d.idx+"_container"),
18115				once=seq.type==="stepped" ? true : false,
18116				steplessSpeed=o.scrollInertia < 26 ? 26 : o.scrollInertia, /* 26/1.5=17 */
18117				steppedSpeed=o.scrollInertia < 1 ? 17 : o.scrollInertia;
18118			switch(action){
18119				case "on":
18120					seq.dir=[
18121						(trigger===classes[16] || trigger===classes[15] || trigger===39 || trigger===37 ? "x" : "y"),
18122						(trigger===classes[13] || trigger===classes[15] || trigger===38 || trigger===37 ? -1 : 1)
18123					];
18124					_stop(el);
18125					if(_isNumeric(trigger) && seq.type==="stepped"){return;}
18126					_on(once);
18127					break;
18128				case "off":
18129					_off();
18130					if(once || (d.tweenRunning && seq.dir)){
18131						_on(true);
18132					}
18133					break;
18134			}
18135			
18136			/* starts sequence */
18137			function _on(once){
18138				if(o.snapAmount){seq.scrollAmount=!(o.snapAmount instanceof Array) ? o.snapAmount : seq.dir[0]==="x" ? o.snapAmount[1] : o.snapAmount[0];} /* scrolling snapping */
18139				var c=seq.type!=="stepped", /* continuous scrolling */
18140					t=s ? s : !once ? 1000/60 : c ? steplessSpeed/1.5 : steppedSpeed, /* timer */
18141					m=!once ? 2.5 : c ? 7.5 : 40, /* multiplier */
18142					contentPos=[Math.abs(mCSB_container[0].offsetTop),Math.abs(mCSB_container[0].offsetLeft)],
18143					ratio=[d.scrollRatio.y>10 ? 10 : d.scrollRatio.y,d.scrollRatio.x>10 ? 10 : d.scrollRatio.x],
18144					amount=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*(ratio[1]*m)) : contentPos[0]+(seq.dir[1]*(ratio[0]*m)),
18145					px=seq.dir[0]==="x" ? contentPos[1]+(seq.dir[1]*parseInt(seq.scrollAmount)) : contentPos[0]+(seq.dir[1]*parseInt(seq.scrollAmount)),
18146					to=seq.scrollAmount!=="auto" ? px : amount,
18147					easing=e ? e : !once ? "mcsLinear" : c ? "mcsLinearOut" : "mcsEaseInOut",
18148					onComplete=!once ? false : true;
18149				if(once && t<17){
18150					to=seq.dir[0]==="x" ? contentPos[1] : contentPos[0];
18151				}
18152
18153				_scrollTo(el,to.toString(),{dir:seq.dir[0],scrollEasing:easing,dur:t,onComplete:onComplete});
18154				if(once){
18155					seq.dir=false;
18156					return;
18157				}
18158				clearTimeout(seq.step);
18159				seq.step=setTimeout(function(){
18160					_on();
18161				},t);
18162			}
18163			/* stops sequence */
18164			function _off(){
18165				clearTimeout(seq.step);
18166				_delete(seq,"step");
18167				_stop(el);
18168			}
18169		},
18170		/* -------------------- */
18171		
18172		
18173		/* returns a yx array from value */
18174		_arr=function(val){
18175			var o=$(this).data(pluginPfx).opt,vals=[];
18176			if(typeof val==="function"){val=val();} /* check if the value is a single anonymous function */
18177			/* check if value is object or array, its length and create an array with yx values */
18178			if(!(val instanceof Array)){ /* object value (e.g. {y:"100",x:"100"}, 100 etc.) */
18179				vals[0]=val.y ? val.y : val.x || o.axis==="x" ? null : val;
18180				vals[1]=val.x ? val.x : val.y || o.axis==="y" ? null : val;
18181			}else{ /* array value (e.g. [100,100]) */
18182				vals=val.length>1 ? [val[0],val[1]] : o.axis==="x" ? [null,val[0]] : [val[0],null];
18183			}
18184			/* check if array values are anonymous functions */
18185			if(typeof vals[0]==="function"){vals[0]=vals[0]();}
18186			if(typeof vals[1]==="function"){vals[1]=vals[1]();}
18187			return vals;
18188		},
18189		/* -------------------- */
18190		
18191		
18192		/* translates values (e.g. "top", 100, "100px", "#id") to actual scroll-to positions */
18193		_to=function(val,dir){
18194			if(val==null || typeof val=="undefined"){return;}
18195			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
18196				mCSB_container=$("#mCSB_"+d.idx+"_container"),
18197				wrapper=mCSB_container.parent(),
18198				t=typeof val;
18199			if(!dir){dir=o.axis==="x" ? "x" : "y";}
18200			var contentLength=dir==="x" ? mCSB_container.outerWidth(false)-wrapper.width() : mCSB_container.outerHeight(false)-wrapper.height(),
18201				contentPos=dir==="x" ? mCSB_container[0].offsetLeft : mCSB_container[0].offsetTop,
18202				cssProp=dir==="x" ? "left" : "top";
18203			switch(t){
18204				case "function": /* this currently is not used. Consider removing it */
18205					return val();
18206					break;
18207				case "object": /* js/jquery object */
18208					var obj=val.jquery ? val : $(val);
18209					if(!obj.length){return;}
18210					return dir==="x" ? _childPos(obj)[1] : _childPos(obj)[0];
18211					break;
18212				case "string": case "number":
18213					if(_isNumeric(val)){ /* numeric value */
18214						return Math.abs(val);
18215					}else if(val.indexOf("%")!==-1){ /* percentage value */
18216						return Math.abs(contentLength*parseInt(val)/100);
18217					}else if(val.indexOf("-=")!==-1){ /* decrease value */
18218						return Math.abs(contentPos-parseInt(val.split("-=")[1]));
18219					}else if(val.indexOf("+=")!==-1){ /* inrease value */
18220						var p=(contentPos+parseInt(val.split("+=")[1]));
18221						return p>=0 ? 0 : Math.abs(p);
18222					}else if(val.indexOf("px")!==-1 && _isNumeric(val.split("px")[0])){ /* pixels string value (e.g. "100px") */
18223						return Math.abs(val.split("px")[0]);
18224					}else{
18225						if(val==="top" || val==="left"){ /* special strings */
18226							return 0;
18227						}else if(val==="bottom"){
18228							return Math.abs(wrapper.height()-mCSB_container.outerHeight(false));
18229						}else if(val==="right"){
18230							return Math.abs(wrapper.width()-mCSB_container.outerWidth(false));
18231						}else if(val==="first" || val==="last"){
18232							var obj=mCSB_container.find(":"+val);
18233							return dir==="x" ? _childPos(obj)[1] : _childPos(obj)[0];
18234						}else{
18235							if($(val).length){ /* jquery selector */
18236								return dir==="x" ? _childPos($(val))[1] : _childPos($(val))[0];
18237							}else{ /* other values (e.g. "100em") */
18238								mCSB_container.css(cssProp,val);
18239								methods.update.call(null,$this[0]);
18240								return;
18241							}
18242						}
18243					}
18244					break;
18245			}
18246		},
18247		/* -------------------- */
18248		
18249		
18250		/* calls the update method automatically */
18251		_autoUpdate=function(rem){
18252			var $this=$(this),d=$this.data(pluginPfx),o=d.opt,
18253				mCSB_container=$("#mCSB_"+d.idx+"_container");
18254			if(rem){
18255				/* 
18256				removes autoUpdate timer 
18257				usage: _autoUpdate.call(this,"remove");
18258				*/
18259				clearTimeout(mCSB_container[0].autoUpdate);
18260				_delete(mCSB_container[0],"autoUpdate");
18261				return;
18262			}
18263			upd();
18264			function upd(){
18265				clearTimeout(mCSB_container[0].autoUpdate);
18266				if($this.parents("html").length===0){
18267					/* check element in dom tree */
18268					$this=null;
18269					return;
18270				}
18271				mCSB_container[0].autoUpdate=setTimeout(function(){
18272					/* update on specific selector(s) length and size change */
18273					if(o.advanced.updateOnSelectorChange){
18274						d.poll.change.n=sizesSum();
18275						if(d.poll.change.n!==d.poll.change.o){
18276							d.poll.change.o=d.poll.change.n;
18277							doUpd(3);
18278							return;
18279						}
18280					}
18281					/* update on main element and scrollbar size changes */
18282					if(o.advanced.updateOnContentResize){
18283						d.poll.size.n=$this[0].scrollHeight+$this[0].scrollWidth+mCSB_container[0].offsetHeight+$this[0].offsetHeight+$this[0].offsetWidth;
18284						if(d.poll.size.n!==d.poll.size.o){
18285							d.poll.size.o=d.poll.size.n;
18286							doUpd(1);
18287							return;
18288						}
18289					}
18290					/* update on image load */
18291					if(o.advanced.updateOnImageLoad){
18292						if(!(o.advanced.updateOnImageLoad==="auto" && o.axis==="y")){ //by default, it doesn't run on vertical content
18293							d.poll.img.n=mCSB_container.find("img").length;
18294							if(d.poll.img.n!==d.poll.img.o){
18295								d.poll.img.o=d.poll.img.n;
18296								mCSB_container.find("img").each(function(){
18297									imgLoader(this);
18298								});
18299								return;
18300							}
18301						}
18302					}
18303					if(o.advanced.updateOnSelectorChange || o.advanced.updateOnContentResize || o.advanced.updateOnImageLoad){upd();}
18304				},o.advanced.autoUpdateTimeout);
18305			}
18306			/* a tiny image loader */
18307			function imgLoader(el){
18308				if($(el).hasClass(classes[2])){doUpd(); return;}
18309				var img=new Image();
18310				function createDelegate(contextObject,delegateMethod){
18311					return function(){return delegateMethod.apply(contextObject,arguments);}
18312				}
18313				function imgOnLoad(){
18314					this.onload=null;
18315					$(el).addClass(classes[2]);
18316					doUpd(2);
18317				}
18318				img.onload=createDelegate(img,imgOnLoad);
18319				img.src=el.src;
18320			}
18321			/* returns the total height and width sum of all elements matching the selector */
18322			function sizesSum(){
18323				if(o.advanced.updateOnSelectorChange===true){o.advanced.updateOnSelectorChange="*";}
18324				var total=0,sel=mCSB_container.find(o.advanced.updateOnSelectorChange);
18325				if(o.advanced.updateOnSelectorChange && sel.length>0){sel.each(function(){total+=this.offsetHeight+this.offsetWidth;});}
18326				return total;
18327			}
18328			/* calls the update method */
18329			function doUpd(cb){
18330				clearTimeout(mCSB_container[0].autoUpdate);
18331				methods.update.call(null,$this[0],cb);
18332			}
18333		},
18334		/* -------------------- */
18335		
18336		
18337		/* snaps scrolling to a multiple of a pixels number */
18338		_snapAmount=function(to,amount,offset){
18339			return (Math.round(to/amount)*amount-offset); 
18340		},
18341		/* -------------------- */
18342		
18343		
18344		/* stops content and scrollbar animations */
18345		_stop=function(el){
18346			var d=el.data(pluginPfx),
18347				sel=$("#mCSB_"+d.idx+"_container,#mCSB_"+d.idx+"_container_wrapper,#mCSB_"+d.idx+"_dragger_vertical,#mCSB_"+d.idx+"_dragger_horizontal");
18348			sel.each(function(){
18349				_stopTween.call(this);
18350			});
18351		},
18352		/* -------------------- */
18353		
18354		
18355		/* 
18356		ANIMATES CONTENT 
18357		This is where the actual scrolling happens
18358		*/
18359		_scrollTo=function(el,to,options){
18360			var d=el.data(pluginPfx),o=d.opt,
18361				defaults={
18362					trigger:"internal",
18363					dir:"y",
18364					scrollEasing:"mcsEaseOut",
18365					drag:false,
18366					dur:o.scrollInertia,
18367					overwrite:"all",
18368					callbacks:true,
18369					onStart:true,
18370					onUpdate:true,
18371					onComplete:true
18372				},
18373				options=$.extend(defaults,options),
18374				dur=[options.dur,(options.drag ? 0 : options.dur)],
18375				mCustomScrollBox=$("#mCSB_"+d.idx),
18376				mCSB_container=$("#mCSB_"+d.idx+"_container"),
18377				wrapper=mCSB_container.parent(),
18378				totalScrollOffsets=o.callbacks.onTotalScrollOffset ? _arr.call(el,o.callbacks.onTotalScrollOffset) : [0,0],
18379				totalScrollBackOffsets=o.callbacks.onTotalScrollBackOffset ? _arr.call(el,o.callbacks.onTotalScrollBackOffset) : [0,0];
18380			d.trigger=options.trigger;
18381			if(wrapper.scrollTop()!==0 || wrapper.scrollLeft()!==0){ /* always reset scrollTop/Left */
18382				$(".mCSB_"+d.idx+"_scrollbar").css("visibility","visible");
18383				wrapper.scrollTop(0).scrollLeft(0);
18384			}
18385			if(to==="_resetY" && !d.contentReset.y){
18386				/* callbacks: onOverflowYNone */
18387				if(_cb("onOverflowYNone")){o.callbacks.onOverflowYNone.call(el[0]);}
18388				d.contentReset.y=1;
18389			}
18390			if(to==="_resetX" && !d.contentReset.x){
18391				/* callbacks: onOverflowXNone */
18392				if(_cb("onOverflowXNone")){o.callbacks.onOverflowXNone.call(el[0]);}
18393				d.contentReset.x=1;
18394			}
18395			if(to==="_resetY" || to==="_resetX"){return;}
18396			if((d.contentReset.y || !el[0].mcs) && d.overflowed[0]){
18397				/* callbacks: onOverflowY */
18398				if(_cb("onOverflowY")){o.callbacks.onOverflowY.call(el[0]);}
18399				d.contentReset.x=null;
18400			}
18401			if((d.contentReset.x || !el[0].mcs) && d.overflowed[1]){
18402				/* callbacks: onOverflowX */
18403				if(_cb("onOverflowX")){o.callbacks.onOverflowX.call(el[0]);}
18404				d.contentReset.x=null;
18405			}
18406			if(o.snapAmount){ /* scrolling snapping */
18407				var snapAmount=!(o.snapAmount instanceof Array) ? o.snapAmount : options.dir==="x" ? o.snapAmount[1] : o.snapAmount[0];
18408				to=_snapAmount(to,snapAmount,o.snapOffset);
18409			}
18410			switch(options.dir){
18411				case "x":
18412					var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_horizontal"),
18413						property="left",
18414						contentPos=mCSB_container[0].offsetLeft,
18415						limit=[
18416							mCustomScrollBox.width()-mCSB_container.outerWidth(false),
18417							mCSB_dragger.parent().width()-mCSB_dragger.width()
18418						],
18419						scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.x)],
18420						tso=totalScrollOffsets[1],
18421						tsbo=totalScrollBackOffsets[1],
18422						totalScrollOffset=tso>0 ? tso/d.scrollRatio.x : 0,
18423						totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.x : 0;
18424					break;
18425				case "y":
18426					var mCSB_dragger=$("#mCSB_"+d.idx+"_dragger_vertical"),
18427						property="top",
18428						contentPos=mCSB_container[0].offsetTop,
18429						limit=[
18430							mCustomScrollBox.height()-mCSB_container.outerHeight(false),
18431							mCSB_dragger.parent().height()-mCSB_dragger.height()
18432						],
18433						scrollTo=[to,to===0 ? 0 : (to/d.scrollRatio.y)],
18434						tso=totalScrollOffsets[0],
18435						tsbo=totalScrollBackOffsets[0],
18436						totalScrollOffset=tso>0 ? tso/d.scrollRatio.y : 0,
18437						totalScrollBackOffset=tsbo>0 ? tsbo/d.scrollRatio.y : 0;
18438					break;
18439			}
18440			if(scrollTo[1]<0 || (scrollTo[0]===0 && scrollTo[1]===0)){
18441				scrollTo=[0,0];
18442			}else if(scrollTo[1]>=limit[1]){
18443				scrollTo=[limit[0],limit[1]];
18444			}else{
18445				scrollTo[0]=-scrollTo[0];
18446			}
18447			if(!el[0].mcs){
18448				_mcs();  /* init mcs object (once) to make it available before callbacks */
18449				if(_cb("onInit")){o.callbacks.onInit.call(el[0]);} /* callbacks: onInit */
18450			}
18451			clearTimeout(mCSB_container[0].onCompleteTimeout);
18452
18453			_tweenTo(mCSB_dragger[0],property,Math.round(scrollTo[1]),dur[1],options.scrollEasing);
18454			if(!d.tweenRunning && ((contentPos===0 && scrollTo[0]>=0) || (contentPos===limit[0] && scrollTo[0]<=limit[0]))){return;}
18455			_tweenTo(mCSB_container[0],property,Math.round(scrollTo[0]),dur[0],options.scrollEasing,options.overwrite,{
18456				onStart:function(){
18457					if(options.callbacks && options.onStart && !d.tweenRunning){
18458						/* callbacks: onScrollStart */
18459						if(_cb("onScrollStart")){_mcs(); o.callbacks.onScrollStart.call(el[0]);}
18460						d.tweenRunning=true;
18461						_onDragClasses(mCSB_dragger);
18462						d.cbOffsets=_cbOffsets();
18463					}
18464				},onUpdate:function(){
18465					if(options.callbacks && options.onUpdate){
18466						/* callbacks: whileScrolling */
18467						if(_cb("whileScrolling")){_mcs(); o.callbacks.whileScrolling.call(el[0]);}
18468					}
18469				},onComplete:function(){
18470					if(options.callbacks && options.onComplete){
18471						if(o.axis==="yx"){clearTimeout(mCSB_container[0].onCompleteTimeout);}
18472						var t=mCSB_container[0].idleTimer || 0;
18473						mCSB_container[0].onCompleteTimeout=setTimeout(function(){
18474							/* callbacks: onScroll, onTotalScroll, onTotalScrollBack */
18475							if(_cb("onScroll")){_mcs(); o.callbacks.onScroll.call(el[0]);}
18476							if(_cb("onTotalScroll") && scrollTo[1]>=limit[1]-totalScrollOffset && d.cbOffsets[0]){_mcs(); o.callbacks.onTotalScroll.call(el[0]);}
18477							if(_cb("onTotalScrollBack") && scrollTo[1]<=totalScrollBackOffset && d.cbOffsets[1]){_mcs(); o.callbacks.onTotalScrollBack.call(el[0]);}
18478							d.tweenRunning=false;
18479							mCSB_container[0].idleTimer=0;
18480							_onDragClasses(mCSB_dragger,"hide");
18481						},t);
18482					}
18483				}
18484			});
18485			/* checks if callback function exists */
18486			function _cb(cb){
18487				return d && o.callbacks[cb] && typeof o.callbacks[cb]==="function";
18488			}
18489			/* checks whether callback offsets always trigger */
18490			function _cbOffsets(){
18491				return [o.callbacks.alwaysTriggerOffsets || contentPos>=limit[0]+tso,o.callbacks.alwaysTriggerOffsets || contentPos<=-tsbo];
18492			}
18493			/* 
18494			populates object with useful values for the user 
18495			values: 
18496				content: this.mcs.content
18497				content top position: this.mcs.top 
18498				content left position: this.mcs.left 
18499				dragger top position: this.mcs.draggerTop 
18500				dragger left position: this.mcs.draggerLeft 
18501				scrolling y percentage: this.mcs.topPct 
18502				scrolling x percentage: this.mcs.leftPct 
18503				scrolling direction: this.mcs.direction
18504			*/
18505			function _mcs(){
18506				var cp=[mCSB_container[0].offsetTop,mCSB_container[0].offsetLeft], /* content position */
18507					dp=[mCSB_dragger[0].offsetTop,mCSB_dragger[0].offsetLeft], /* dragger position */
18508					cl=[mCSB_container.outerHeight(false),mCSB_container.outerWidth(false)], /* content length */
18509					pl=[mCustomScrollBox.height(),mCustomScrollBox.width()]; /* content parent length */
18510				el[0].mcs={
18511					content:mCSB_container, /* original content wrapper as jquery object */
18512					top:cp[0],left:cp[1],draggerTop:dp[0],draggerLeft:dp[1],
18513					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])),
18514					direction:options.dir
18515				};
18516				/* 
18517				this refers to the original element containing the scrollbar(s)
18518				usage: this.mcs.top, this.mcs.leftPct etc. 
18519				*/
18520			}
18521		},
18522		/* -------------------- */
18523		
18524		
18525		/* 
18526		CUSTOM JAVASCRIPT ANIMATION TWEEN 
18527		Lighter and faster than jquery animate() and css transitions 
18528		Animates top/left properties and includes easings 
18529		*/
18530		_tweenTo=function(el,prop,to,duration,easing,overwrite,callbacks){
18531
18532			if(el && !el._mTween){el._mTween={top:{},left:{}};}
18533			var callbacks=callbacks || {},
18534				onStart=callbacks.onStart || function(){},onUpdate=callbacks.onUpdate || function(){},onComplete=callbacks.onComplete || function(){},
18535				startTime=_getTime(),_delay,progress=0,from=el.offsetTop,elStyle=el.style,_request,tobj=el._mTween[prop];
18536			if(prop==="left"){from=el.offsetLeft;}
18537			var diff=to-from;
18538			tobj.stop=0;
18539			if(overwrite!=="none"){_cancelTween();}
18540			_startTween();
18541			function _step(){
18542				if(tobj.stop){return;}
18543				if(!progress){onStart.call();}
18544				progress=_getTime()-startTime;
18545				_tween();
18546				if(progress>=tobj.time){
18547					tobj.time=(progress>tobj.time) ? progress+_delay-(progress-tobj.time) : progress+_delay-1;
18548					if(tobj.time<progress+1){tobj.time=progress+1;}
18549				}
18550				if(tobj.time<duration){tobj.id=_request(_step);}else{onComplete.call();}
18551			}
18552			function _tween(){
18553				if(duration>0){
18554					tobj.currVal=_ease(tobj.time,from,diff,duration,easing);
18555					elStyle[prop]=Math.round(tobj.currVal)+"px";
18556				}else{
18557					elStyle[prop]=to+"px";
18558				}
18559				onUpdate.call();
18560			}
18561			function _startTween(){
18562				_delay=1000/60;
18563				tobj.time=progress+_delay;
18564				_request=(!window.requestAnimationFrame) ? function(f){_tween(); return setTimeout(f,0.01);} : window.requestAnimationFrame;
18565				tobj.id=_request(_step);
18566			}
18567			function _cancelTween(){
18568				if(tobj.id==null){return;}
18569				if(!window.requestAnimationFrame){clearTimeout(tobj.id);
18570				}else{window.cancelAnimationFrame(tobj.id);}
18571				tobj.id=null;
18572			}
18573			function _ease(t,b,c,d,type){
18574				switch(type){
18575					case "linear": case "mcsLinear":
18576						return c*t/d + b;
18577						break;
18578					case "mcsLinearOut":
18579						t/=d; t--; return c * Math.sqrt(1 - t*t) + b;
18580						break;
18581					case "easeInOutSmooth":
18582						t/=d/2;
18583						if(t<1) return c/2*t*t + b;
18584						t--;
18585						return -c/2 * (t*(t-2) - 1) + b;
18586						break;
18587					case "easeInOutStrong":
18588						t/=d/2;
18589						if(t<1) return c/2 * Math.pow( 2, 10 * (t - 1) ) + b;
18590						t--;
18591						return c/2 * ( -Math.pow( 2, -10 * t) + 2 ) + b;
18592						break;
18593					case "easeInOut": case "mcsEaseInOut":
18594						t/=d/2;
18595						if(t<1) return c/2*t*t*t + b;
18596						t-=2;
18597						return c/2*(t*t*t + 2) + b;
18598						break;
18599					case "easeOutSmooth":
18600						t/=d; t--;
18601						return -c * (t*t*t*t - 1) + b;
18602						break;
18603					case "easeOutStrong":
18604						return c * ( -Math.pow( 2, -10 * t/d ) + 1 ) + b;
18605						break;
18606					case "easeOut": case "mcsEaseOut": default:
18607						var ts=(t/=d)*t,tc=ts*t;
18608						return b+c*(0.499999999999997*tc*ts + -2.5*ts*ts + 5.5*tc + -6.5*ts + 4*t);
18609				}
18610			}
18611		},
18612		/* -------------------- */
18613		
18614		
18615		/* returns current time */
18616		_getTime=function(){
18617			if(window.performance && window.performance.now){
18618				return window.performance.now();
18619			}else{
18620				if(window.performance && window.performance.webkitNow){
18621					return window.performance.webkitNow();
18622				}else{
18623					if(Date.now){return Date.now();}else{return new Date().getTime();}
18624				}
18625			}
18626		},
18627		/* -------------------- */
18628		
18629		
18630		/* stops a tween */
18631		_stopTween=function(){
18632			var el=this;
18633			if(!el._mTween){el._mTween={top:{},left:{}};}
18634			var props=["top","left"];
18635			for(var i=0; i<props.length; i++){
18636				var prop=props[i];
18637				if(el._mTween[prop].id){
18638					if(!window.requestAnimationFrame){clearTimeout(el._mTween[prop].id);
18639					}else{window.cancelAnimationFrame(el._mTween[prop].id);}
18640					el._mTween[prop].id=null;
18641					el._mTween[prop].stop=1;
18642				}
18643			}
18644		},
18645		/* -------------------- */
18646		
18647		
18648		/* deletes a property (avoiding the exception thrown by IE) */
18649		_delete=function(c,m){
18650			try{delete c[m];}catch(e){c[m]=null;}
18651		},
18652		/* -------------------- */
18653		
18654		
18655		/* detects left mouse button */
18656		_mouseBtnLeft=function(e){
18657			return !(e.which && e.which!==1);
18658		},
18659		/* -------------------- */
18660		
18661		
18662		/* detects if pointer type event is touch */
18663		_pointerTouch=function(e){
18664			var t=e.originalEvent.pointerType;
18665			return !(t && t!=="touch" && t!==2);
18666		},
18667		/* -------------------- */
18668		
18669		
18670		/* checks if value is numeric */
18671		_isNumeric=function(val){
18672			return !isNaN(parseFloat(val)) && isFinite(val);
18673		},
18674		/* -------------------- */
18675		
18676		
18677		/* returns element position according to content */
18678		_childPos=function(el){
18679			var p=el.parents(".mCSB_container");
18680			return [el.offset().top-p.offset().top,el.offset().left-p.offset().left];
18681		},
18682		/* -------------------- */
18683		
18684		
18685		/* checks if browser tab is hidden/inactive via Page Visibility API */
18686		_isTabHidden=function(){
18687			var prop=_getHiddenProp();
18688			if(!prop) return false;
18689			return document[prop];
18690			function _getHiddenProp(){
18691				var pfx=["webkit","moz","ms","o"];
18692				if("hidden" in document) return "hidden"; //natively supported
18693				for(var i=0; i<pfx.length; i++){ //prefixed
18694				    if((pfx[i]+"Hidden") in document) 
18695				        return pfx[i]+"Hidden";
18696				}
18697				return null; //not supported
18698			}
18699		};
18700		/* -------------------- */
18701		
18702	
18703	
18704	
18705	
18706	/* 
18707	----------------------------------------
18708	PLUGIN SETUP 
18709	----------------------------------------
18710	*/
18711	
18712	/* plugin constructor functions */
18713	$.fn[pluginNS]=function(method){ /* usage: $(selector).mCustomScrollbar(); */
18714		if(methods[method]){
18715			return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
18716		}else if(typeof method==="object" || !method){
18717			return methods.init.apply(this,arguments);
18718		}else{
18719			$.error("Method "+method+" does not exist");
18720		}
18721	};
18722	$[pluginNS]=function(method){ /* usage: $.mCustomScrollbar(); */
18723		if(methods[method]){
18724			return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
18725		}else if(typeof method==="object" || !method){
18726			return methods.init.apply(this,arguments);
18727		}else{
18728			$.error("Method "+method+" does not exist");
18729		}
18730	};
18731	
18732	/* 
18733	allow setting plugin default options. 
18734	usage: $.mCustomScrollbar.defaults.scrollInertia=500; 
18735	to apply any changed default options on default selectors (below), use inside document ready fn 
18736	e.g.: $(document).ready(function(){ $.mCustomScrollbar.defaults.scrollInertia=500; });
18737	*/
18738	$[pluginNS].defaults=defaults;
18739	
18740	/* 
18741	add window object (window.mCustomScrollbar) 
18742	usage: if(window.mCustomScrollbar){console.log("custom scrollbar plugin loaded");}
18743	*/
18744	window[pluginNS]=true;
18745	
18746	$(window).bind("load",function(){
18747		
18748		$(defaultSelector)[pluginNS](); /* add scrollbars automatically on default selector */
18749		
18750		/* extend jQuery expressions */
18751		$.extend($.expr[":"],{
18752			/* checks if element is within scrollable viewport */
18753			mcsInView:$.expr[":"].mcsInView || function(el){
18754				var $el=$(el),content=$el.parents(".mCSB_container"),wrapper,cPos;
18755				if(!content.length){return;}
18756				wrapper=content.parent();
18757				cPos=[content[0].offsetTop,content[0].offsetLeft];
18758				return 	cPos[0]+_childPos($el)[0]>=0 && cPos[0]+_childPos($el)[0]<wrapper.height()-$el.outerHeight(false) && 
18759						cPos[1]+_childPos($el)[1]>=0 && cPos[1]+_childPos($el)[1]<wrapper.width()-$el.outerWidth(false);
18760			},
18761			/* checks if element or part of element is in view of scrollable viewport */
18762			mcsInSight:$.expr[":"].mcsInSight || function(el,i,m){
18763				var $el=$(el),elD,content=$el.parents(".mCSB_container"),wrapperView,pos,wrapperViewPct,
18764					pctVals=m[3]==="exact" ? [[1,0],[1,0]] : [[0.9,0.1],[0.6,0.4]];
18765				if(!content.length){return;}
18766				elD=[$el.outerHeight(false),$el.outerWidth(false)];
18767				pos=[content[0].offsetTop+_childPos($el)[0],content[0].offsetLeft+_childPos($el)[1]];
18768				wrapperView=[content.parent()[0].offsetHeight,content.parent()[0].offsetWidth];
18769				wrapperViewPct=[elD[0]<wrapperView[0] ? pctVals[0] : pctVals[1],elD[1]<wrapperView[1] ? pctVals[0] : pctVals[1]];
18770				return 	pos[0]-(wrapperView[0]*wrapperViewPct[0][0])<0 && pos[0]+elD[0]-(wrapperView[0]*wrapperViewPct[0][1])>=0 && 
18771						pos[1]-(wrapperView[1]*wrapperViewPct[1][0])<0 && pos[1]+elD[1]-(wrapperView[1]*wrapperViewPct[1][1])>=0;
18772			},
18773			/* checks if element is overflowed having visible scrollbar(s) */
18774			mcsOverflow:$.expr[":"].mcsOverflow || function(el){
18775				var d=$(el).data(pluginPfx);
18776				if(!d){return;}
18777				return d.overflowed[0] || d.overflowed[1];
18778			}
18779		});
18780	
18781	});
18782
18783}))}));
18784/* End */
18785;
18786; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_max_local/js/scrollTabs.js?162019756912271";s:6:"source";s:49:"/local/templates/aspro_max_local/js/scrollTabs.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
18787InitTabsScroll = function(){
18788	$('.arrow_scroll:not(.arrow_scroll_init)').scrollTab();
18789}
18790
18791ResizeScrollTabs = function() {
18792	var scrollTabs = $('.arrow_scroll_init');
18793
18794	if(scrollTabs.length) {
18795		scrollTabs.each(function(i, scrollTab){
18796			var _scrollTab = $(scrollTab);
18797			_scrollTab.data('scrollTabOptions').resize();
18798		});
18799	}
18800}
18801
18802$(document).ready(function(){
18803	InitTabsScroll();
18804});
18805
18806$(window).on('resize', function(){
18807	if(window.scrollTabsTimeout !== undefined) {
18808		clearTimeout(window.scrollTabsTimeout);
18809	}
18810	
18811	window.scrollTabsTimeout = setTimeout(
18812		ResizeScrollTabs,
18813		20
18814	);
18815});
18816
18817$.fn.scrollTab = function( options ){
18818	function _scrollTab(element, options) {
18819		var _scrollTab = $(element);
18820		var tabs_wrapper = _scrollTab.find(options.tabs_wrapper);
18821		if( tabs_wrapper === undefined || !tabs_wrapper.length )
18822			return false;
18823		
18824		var tabs = tabs_wrapper.find('> li');
18825		if(!tabs.length)
18826			return false;
18827
18828		var arrow_svg = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8">'+
18829							'<rect width="12" height="8" fill="#333" fill-opacity="0" />'+
18830							'<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)"/>'+
18831						'</svg>';
18832		var arrows_wrapper = '<div class="arrows_wrapper">'+
18833								'<div class="arrow arrow_left colored_theme_hover_text">'+arrow_svg+'</div>'+
18834								'<div class="arrow arrow_right colored_theme_hover_text">'+arrow_svg+'</div>'+
18835							'</div>';
18836
18837		var arrows = $(arrows_wrapper).insertAfter(tabs_wrapper);
18838		var arrow_left = arrows.find('.arrow_left');
18839		var arrow_right = arrows.find('.arrow_right');
18840
18841		var thisOoptions = $.extend({}, options);
18842
18843		thisOoptions.scrollTab = _scrollTab;
18844		thisOoptions.wrapper = tabs_wrapper;
18845		thisOoptions.tabs = tabs;
18846		thisOoptions.arrows = {};
18847		thisOoptions.arrows.wrapper = arrows;
18848		thisOoptions.arrows.arrow_left = arrow_left;
18849		thisOoptions.arrows.arrow_right = arrow_right;
18850
18851		if(thisOoptions.linked_tabs !== undefined && thisOoptions.linked_tabs.length && thisOoptions.linked_tabs.data('scrollTabOptions') !== undefined) {
18852			thisOoptions.linked_options = thisOoptions.linked_tabs.data('scrollTabOptions');
18853			thisOoptions.linked_options.linked_options = thisOoptions;
18854		}
18855
18856		if(options.arrows_css) {
18857			thisOoptions.arrows.arrow_left.css(options.arrows_css);
18858			thisOoptions.arrows.arrow_right.css(options.arrows_css);
18859		}
18860
18861		thisOoptions.initTabs = function(){
18862			thisOoptions.wrapperBounds = thisOoptions.wrapper[0].getBoundingClientRect();
18863			thisOoptions.scrollBounds = thisOoptions.scrollTab[0].getBoundingClientRect();
18864			elements = $(thisOoptions.tabs);
18865			if(elements.length) {
18866				thisOoptions.firstTabBound = elements[0].getBoundingClientRect().left;
18867				thisOoptions.lastTabBound = elements[ elements.length - 1 ].getBoundingClientRect().right;
18868			}
18869			thisOoptions.minTranslate = (thisOoptions.wrapperBounds.right < thisOoptions.lastTabBound ? thisOoptions.wrapperBounds.right - thisOoptions.lastTabBound - 2 : 0);
18870			thisOoptions.disabled = ( thisOoptions.lastTabBound - thisOoptions.wrapperBounds.left ) <= thisOoptions.scrollBounds.width;
18871		}
18872
18873		thisOoptions.wrapper.css({
18874			'white-space': 'nowrap',
18875			'min-width': 'auto',
18876			'overflow': 'visible',
18877			'z-index': '1',
18878		});
18879		thisOoptions.scrollTab.css({
18880			'overflow': 'hidden',
18881			'position': 'relative',
18882		});
18883
18884		thisOoptions.checkArrows = function(translate){
18885			if(translate === undefined) {
18886				translate = thisOoptions.translate;
18887			}
18888			
18889			if( thisOoptions.disabled ) {
18890				thisOoptions.arrows.arrow_left.addClass('disabled');
18891				thisOoptions.arrows.arrow_right.addClass('disabled');
18892			} else {
18893				if(translate >= thisOoptions.maxTranslate) {
18894					thisOoptions.arrows.arrow_left.addClass('disabled');
18895					thisOoptions.arrows.arrow_right.removeClass('disabled');
18896				} else if(translate <= thisOoptions.minTranslate) {
18897					thisOoptions.arrows.arrow_right.addClass('disabled');
18898					thisOoptions.arrows.arrow_left.removeClass('disabled');
18899				} else {
18900					thisOoptions.arrows.arrow_left.removeClass('disabled');
18901					thisOoptions.arrows.arrow_right.removeClass('disabled');
18902				}
18903			}
18904
18905		}
18906
18907		thisOoptions.directScroll = function(distance, delay, step){
18908			if(delay === undefined) {
18909				delay = 5;
18910			}
18911			clearInterval(thisOoptions.timerMoveDirect);
18912			var newTranslate = thisOoptions.translate + distance;
18913
18914			if(newTranslate > thisOoptions.maxTranslate) {
18915				newTranslate = thisOoptions.maxTranslate;
18916			} else if(newTranslate < thisOoptions.minTranslate) {
18917				newTranslate = thisOoptions.minTranslate;
18918			}
18919			var tmpTranslate = thisOoptions.translate;
18920			thisOoptions.translate = newTranslate;
18921			
18922			if(delay == 0) {
18923				thisOoptions.translate = newTranslate;
18924				thisOoptions.wrapper.css({
18925					'transform': 'translateX('+thisOoptions.translate+'px)',
18926				});
18927			} else {
18928				if(step === undefined) {
18929					step = 1;
18930				}
18931				thisOoptions.timerMoveDirect = setInterval(
18932					function() {
18933						thisOoptions.wrapper.css({
18934							'transform': 'translateX('+tmpTranslate+'px)',
18935						});
18936						
18937						if( (distance < 0 && tmpTranslate <= newTranslate) || (distance > 0 && tmpTranslate >= newTranslate) ) {
18938							thisOoptions.initTabs();
18939							clearInterval(thisOoptions.timerMoveDirect);
18940						}
18941
18942						if(tmpTranslate < newTranslate) {
18943							tmpTranslate += step;
18944						} else {
18945							tmpTranslate -= step;
18946						}
18947					},
18948					delay
18949				);
18950			}
18951			
18952			thisOoptions.checkArrows(newTranslate);
18953		};
18954		
18955		thisOoptions.addArrowsEvents = function() {
18956			thisOoptions.arrows.arrow_right.on('mouseenter', function() {
18957				thisOoptions.arrows.arrow_left.removeClass('disabled');
18958				thisOoptions.timerMoveLeft = setInterval(
18959					function() {
18960						if( thisOoptions.translate < thisOoptions.minTranslate ){
18961							clearInterval(thisOoptions.timerMoveLeft);
18962							thisOoptions.arrows.arrow_right.addClass('disabled');
18963						} else {
18964							thisOoptions.translate -= thisOoptions.translateSpeed;
18965							thisOoptions.wrapper.css({
18966								'transform': 'translateX('+thisOoptions.translate+'px)',
18967							});
18968						}
18969					},
18970					10
18971				);
18972			});
18973
18974			thisOoptions.arrows.arrow_right.on('mouseleave', function() {
18975				clearInterval(thisOoptions.timerMoveLeft);
18976			});
18977
18978			thisOoptions.arrows.arrow_right.on('click', function() {
18979				thisOoptions.directScroll(-thisOoptions.directTranslate);
18980				thisOoptions.arrows.arrow_left.removeClass('disabled');
18981			});
18982
18983			thisOoptions.arrows.arrow_right.on('touchend', function() {
18984				setTimeout(function() {
18985					clearInterval(thisOoptions.timerMoveLeft);
18986				}, 1);
18987			});
18988
18989			thisOoptions.arrows.arrow_left.on('mouseenter', function() {
18990				thisOoptions.arrows.arrow_right.removeClass('disabled');
18991				thisOoptions.timerMoveRight = setInterval(
18992					function() {
18993						if(thisOoptions.translate >= thisOoptions.maxTranslate){
18994							clearInterval(thisOoptions.timerMoveRight);
18995							thisOoptions.arrows.arrow_left.addClass('disabled');
18996						} else {
18997							thisOoptions.translate += thisOoptions.translateSpeed;
18998							thisOoptions.wrapper.css({
18999								'transform': 'translateX('+thisOoptions.translate+'px)',
19000							});
19001						}
19002					},
19003					10
19004				);
19005			});
19006
19007			thisOoptions.arrows.arrow_left.on('mouseleave', function() {
19008				clearInterval(thisOoptions.timerMoveRight);
19009			});
19010
19011			thisOoptions.arrows.arrow_left.on('click', function() {
19012				thisOoptions.directScroll(thisOoptions.directTranslate);
19013				thisOoptions.arrows.arrow_right.removeClass('disabled');
19014			});
19015
19016			thisOoptions.arrows.arrow_left.on('touchend', function() {
19017				setTimeout(function() {
19018					clearInterval(thisOoptions.timerMoveRight);
19019				}, 1);
19020			});
19021		};
19022
19023		thisOoptions.addTabsEvents = function() {
19024			thisOoptions.tabs.on('click', function() {
19025				var leftScrollBound = thisOoptions.scrollBounds.left;
19026				var rightScrollBound = thisOoptions.scrollBounds.right;
19027
19028				var tabBounds = this.getBoundingClientRect();
19029				var leftTabScrollBound = tabBounds.left - thisOoptions.arrows.arrow_width;
19030				var rightTabScrollBound = tabBounds.right + thisOoptions.arrows.arrow_width;
19031
19032				if(leftTabScrollBound < leftScrollBound) {
19033					thisOoptions.directScroll(leftScrollBound - leftTabScrollBound, 1, 2);
19034				} else if(rightTabScrollBound > rightScrollBound) {
19035					thisOoptions.directScroll(rightScrollBound - rightTabScrollBound, 1, 2);
19036				}
19037
19038				thisOoptions.activeTab = $(this);
19039
19040				if(thisOoptions.linked_options !== undefined) {
19041					var this_index = $(this).index();
19042					var linked_tab = $(thisOoptions.linked_options.tabs[this_index]);
19043					var linked_tabs = {
19044						leftScrollBound: thisOoptions.linked_options.scrollBounds.left,
19045						rightScrollBound: thisOoptions.linked_options.scrollBounds.right,
19046						tabBounds: linked_tab[0].getBoundingClientRect(),
19047					};
19048					if(linked_tabs.tabBounds.left < linked_tabs.leftScrollBound) {
19049						thisOoptions.linked_options.directScroll(linked_tabs.leftScrollBound - linked_tabs.tabBounds.left + thisOoptions.linked_options.arrows.arrow_width + 1, 0);
19050					} else if(linked_tabs.tabBounds.right > linked_tabs.rightScrollBound) {
19051						thisOoptions.linked_options.directScroll(linked_tabs.rightScrollBound - linked_tabs.tabBounds.right - thisOoptions.linked_options.arrows.arrow_width - 1, 0);
19052					}
19053
19054					thisOoptions.linked_options.activeTab = linked_tab;
19055				}
19056
19057				
19058			});
19059		};
19060
19061		thisOoptions.addWrapperEvents = function() {
19062			thisOoptions.wrapper.on('touchstart', function(event) {
19063				thisOoptions.touch.posPrev = event.originalEvent.changedTouches[0].pageX;
19064				clearInterval(thisOoptions.timerMoveRight);
19065				clearInterval(thisOoptions.timerMoveLeft);
19066				clearInterval(thisOoptions.timerMoveDirect);
19067			});
19068
19069			thisOoptions.wrapper.on('touchmove', function(event) {
19070				thisOoptions.touch.posCurrent = event.originalEvent.changedTouches[0].pageX - thisOoptions.touch.posPrev;
19071				thisOoptions.directScroll(thisOoptions.touch.posCurrent, 0);
19072				thisOoptions.touch.posPrev = event.originalEvent.changedTouches[0].pageX;
19073			});
19074		};
19075
19076		thisOoptions.resize = function(){
19077			if(thisOoptions.onBeforeResize && typeof(thisOoptions.onBeforeResize) == 'function') {
19078				thisOoptions.onBeforeResize(thisOoptions);
19079			}
19080
19081			if(thisOoptions.onResize && typeof(thisOoptions.onResize) == 'function') {
19082				thisOoptions.onResize(thisOoptions);
19083			}
19084
19085			if(thisOoptions.translate < thisOoptions.minTranslate) {
19086				thisOoptions.directScroll(thisOoptions.minTranslate - thisOoptions.translate);
19087			} else if(thisOoptions.translate > thisOoptions.maxTranslate) {
19088				thisOoptions.directScroll(thisOoptions.maxTranslate - thisOoptions.translate);
19089			}
19090
19091			if( thisOoptions.activeTab !== undefined && thisOoptions.activeTab.length ) {
19092				var activeTabBounds = thisOoptions.activeTab[0].getBoundingClientRect();
19093				if(activeTabBounds.left < thisOoptions.scrollBounds.left) {
19094					thisOoptions.directScroll(thisOoptions.scrollBounds.left - activeTabBounds.left);
19095				} else if(activeTabBounds.right > thisOoptions.scrollBounds.right) {
19096					thisOoptions.directScroll(thisOoptions.scrollBounds.right - activeTabBounds.right);
19097				}
19098			}
19099
19100			thisOoptions.initTabs();
19101			thisOoptions.checkArrows();
19102
19103			if(thisOoptions.onAfterResize && typeof(thisOoptions.onAfterResize) == 'function') {
19104				thisOoptions.onAfterResize(thisOoptions);
19105			}
19106		};
19107
19108
19109		_scrollTab.data('scrollTabOptions', thisOoptions );
19110		_scrollTab.data('scrollTabOptions').addArrowsEvents();
19111		_scrollTab.data('scrollTabOptions').addTabsEvents();
19112		_scrollTab.data('scrollTabOptions').addWrapperEvents();
19113		_scrollTab.addClass('arrow_scroll_init').addClass('swipeignore');
19114		if (arrow_right !== undefined && arrow_right.length) {
19115			thisOoptions.arrows.arrow_width = thisOoptions.arrows.arrow_right[0].getBoundingClientRect().width;
19116		}
19117		_scrollTab.data('scrollTabOptions').resize();
19118		delete thisOoptions;
19119	}
19120
19121	var options = $.extend({
19122		translate: 1,
19123		translateSpeed: 2,
19124		directTranslate: 150,
19125		maxTranslate: 1,
19126		touch: {},
19127		arrows_css: false,
19128		tabs_wrapper: '.nav-tabs',
19129		onResize: false,
19130		width_grow: 9,
19131	}, options);
19132
19133	var el = $(this);
19134
19135	if(el.hasClass('arrow_scroll_init'))
19136		return false;
19137
19138	el.each(function(i, scrollTab){
19139		_scrollTab(scrollTab, options);
19140	});
19141}
19142/* End */
19143;
19144; /* Start:"a:4:{s:4:"full";s:60:"/local/templates/aspro_max_local/js/main.js?1720157373320461";s:6:"source";s:43:"/local/templates/aspro_max_local/js/main.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
19145var basketTimeoutSlide;
19146var resizeEventTimer;
19147
19148var clicked_tab = 0;
19149
19150if (typeof arAsproOptions === 'undefined') {
19151	var arAsproOptions = ({
19152		"SITE_DIR" : '/'
19153	});
19154	if($('body').data('site') !== undefined)
19155		arAsproOptions["SITE_DIR"] = $('body').data('site');
19156}
19157
19158InitLazyLoad = function() {}
19159
19160$(document).on('change', '.uploader input[type=file]', function(){
19161	if(!$(this).next().length || !$(this).next().hasClass('resetfile')){
19162		$('<span class="resetfile"><svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewBox="0 0 11 11"><path d="M1345.19,376.484l4.66,4.659a0.492,0.492,0,0,1,0,.707,0.5,0.5,0,0,1-.71,0l-4.66-4.659-4.65,4.659a0.5,0.5,0,0,1-.71,0,0.492,0.492,0,0,1,0-.707l4.66-4.659-4.66-4.659a0.492,0.492,0,0,1,0-.707,0.5,0.5,0,0,1,.71,0l4.65,4.659,4.66-4.659a0.5,0.5,0,0,1,.71,0,0.492,0.492,0,0,1,0,.707Z" transform="translate(-1339 -371)"/></svg></span>').insertAfter($(this));
19163	}
19164});
19165
19166$(document).on('click', '.uploader.files_add input[type=file] + .resetfile', function(){
19167	var $input = $(this).prev();
19168	$input.val('');
19169	$.uniform.update($input);
19170	$(this).remove();
19171});
19172
19173$(document).on('click', '.top_block h3', function(){
19174	if(window.matchMedia('(max-width: 550px)').matches)
19175	{
19176		var $this = $(this);
19177		var a = $this.siblings('a');
19178		if(a.length) {
19179			a[0].click();
19180		}
19181	}
19182});
19183
19184$(document).on('click', '.bx-yandex-view-layout .yandex-map__mobile-opener', function(){
19185	if($(this).hasClass('closer')) {
19186		closeYandexMap();
19187	} else {
19188		openYandexMap(this);
19189	}
19190});
19191
19192function openYandexMap(element) {
19193	var $this = $(element);
19194	if($this.hasClass('closer'))
19195		return;
19196	var currentMap = $this.parents('.bx-yandex-view-layout');
19197	var mapId = currentMap.find('.bx-yandex-map').attr('id');
19198	window.openedYandexMapFrame = mapId;
19199	var mapContainer = $('<div data-mapId="'+mapId+'"></div>');
19200	if(!$('div[data-mapId='+mapId+']').length) {
19201		currentMap.after(mapContainer);
19202	}
19203	var yandexMapFrame = $('<div class="yandex-map__frame"></div>');
19204	$('body .wrapper1').append(yandexMapFrame);
19205	currentMap.appendTo(yandexMapFrame);
19206	currentMap.find('.yandex-map__mobile-opener').addClass('closer');
19207	window.map.container.fitToViewport();
19208}
19209
19210function closeYandexMap() {
19211	var yandexMapFrame = $('.yandex-map__frame');
19212	if(yandexMapFrame.length) {
19213		var currentMap = yandexMapFrame.find('.bx-yandex-view-layout');
19214		var yandexMapContainer = $('div[data-mapId='+window.openedYandexMapFrame+']');
19215
19216		currentMap.appendTo(yandexMapContainer);
19217		yandexMapFrame.remove();
19218		currentMap.find('.yandex-map__mobile-opener').removeClass('closer');
19219		if(window.map) {
19220			window.map.container.fitToViewport();
19221		}
19222	}
19223}
19224
19225function throttle(f, t) {
19226  return function (args) {
19227    var previousCall = this.lastCall;
19228    this.lastCall = Date.now();
19229    if (previousCall === undefined // function is being called for the first time
19230        || (this.lastCall - previousCall) > t) { // throttle time has elapsed
19231      f(args);
19232    }
19233  }
19234}
19235
19236function debounce(f, t) {
19237  return function (args) {
19238    var  previousCall = this.lastCall;
19239    this.lastCall = Date.now();
19240    if (previousCall && ((this.lastCall - previousCall) <= t)) {
19241      clearTimeout(this.lastCallTimer);
19242    }
19243    this.lastCallTimer = setTimeout(function() {
19244			f(args);
19245		}, t);
19246  }
19247}
19248
19249$(document).on('click', '.flex-control-nav.flex-control-js-click li a:not(.flex-active)', function(e) {
19250	var _this = $(this);
19251	var itemIndex = _this.data('index') ? _this.data('index') : _this.closest('li').index();
19252
19253	var block = '';
19254	var blocks = _this.closest('.items').find('> .item');
19255	var activeBlock = _this.closest('.items').find('.item.active');
19256
19257	var activeLi = _this.closest('.flex-control-nav').find('.flex-active');
19258
19259	activeBlock.fadeOut(function(){
19260		activeBlock.removeClass('active');
19261
19262		block = blocks.eq(itemIndex);
19263		if (block.length) {
19264			block.fadeIn(function(){
19265				block.addClass('active');
19266			})
19267		}
19268
19269		_this.addClass('flex-active');
19270		activeLi.removeClass('flex-active');
19271	});
19272
19273	e.preventDefault();
19274});
19275
19276$(document).on('mouseenter', '#headerfixed .menu-item.wide_menu', function() {
19277	var _this = $(this);
19278	setTimeout(
19279		function() {
19280			var dropdownMenu = _this.find('.wrap > .dropdown-menu');
19281			var menuOffset = dropdownMenu[0].getBoundingClientRect();
19282			var headerOffset = document.getElementById('headerfixed').getBoundingClientRect();
19283			var windowHeight = document.documentElement.clientHeight;
19284
19285			if(menuOffset.height + headerOffset.height > windowHeight) {
19286				var maxHeight = windowHeight - headerOffset.height;
19287				dropdownMenu.css({
19288					'max-height': maxHeight,
19289				});
19290				dropdownMenu.find('.menu-navigation').css({'max-height': maxHeight,});
19291				dropdownMenu.find('.customScrollbar').css({'max-height': maxHeight,});
19292				dropdownMenu.find('.menu-wrapper.menu-type-4 > li').css({'min-height': 'auto',});
19293			} else {
19294				dropdownMenu.css({
19295					'max-height': '',
19296				});
19297				dropdownMenu.find('.menu-navigation').css({'max-height': '',});
19298				dropdownMenu.find('.customScrollbar').css({'max-height': '',});
19299				dropdownMenu.find('.menu-wrapper.menu-type-4 > li').css({'min-height': '',});
19300			}
19301		},
19302	300);
19303
19304
19305});
19306
19307BX.addCustomEvent('onAjaxSuccess', function(data) {
19308	if(typeof(data) === 'object' && data !== null) {
19309		if(typeof(data.BASKET_REFRESHED) !== undefined && data.BASKET_REFRESHED === true) {
19310			var basketCounts = data.BASKET_DATA.BASKET_ITEMS_COUNT;
19311			reloadBasketCounters(basketCounts);
19312		}
19313	}
19314});
19315
19316if(!funcDefined('parseUrlQuery')){
19317	parseUrlQuery=function() {
19318	    var data = {};
19319	    if(location.search) {
19320	        var pair = (location.search.substr(1)).split('&');
19321	        for(var i = 0; i < pair.length; i ++) {
19322	            var param = pair[i].split('=');
19323	            data[param[0]] = param[1];
19324			}
19325	    }
19326	    return data;
19327	}
19328}
19329
19330if(!funcDefined('setLocationSKU')){
19331	function setLocationSKU(ID, urlParam){
19332		if(urlParam === undefined)
19333			urlParam = 'oid';
19334
19335		var objUrl = parseUrlQuery(),
19336			j = 0,
19337			prefix = '',
19338			query_string = '',
19339			url = '';
19340
19341			objUrl[urlParam] = ID;
19342
19343			for(var i in objUrl)
19344			{
19345				if(parseInt(j)>0)
19346					prefix = '&';
19347				query_string = query_string + prefix + i + '='+ objUrl[i];
19348				j++;
19349			}
19350			if(query_string)
19351			{
19352				url = location.pathname+'?'+query_string + location.hash;
19353			}
19354			try {
19355				//history.pushState(null, null, url);
19356				history.replaceState(null, null, url);
19357				return;
19358			} catch(e) {}
19359			location.hash = '#' + url.substr(1);
19360	}
19361}
19362
19363if(!funcDefined('ShowOverlay')){
19364	ShowOverlay = function(){
19365		$('<div class="jqmOverlay waiting"></div>').appendTo('body');
19366	}
19367}
19368
19369if(!funcDefined('HideOverlay')){
19370	HideOverlay = function(){
19371		$('.jqmOverlay').detach();
19372	}
19373}
19374
19375if(!funcDefined('trimPrice')){
19376	var trimPrice = function trimPrice(s){
19377		s=s.split(" ").join("");
19378		s=s.split("&nbsp;").join("");
19379		return s;
19380	}
19381}
19382
19383if(!funcDefined('pauseYmObserver')){
19384	// pause ya metrika webvisor MutationObserver callback (DOM indexer)
19385	// use before insert html with some animation
19386	pauseYmObserver = function(){
19387		if(
19388			typeof MutationObserver === 'function' &&
19389			typeof MutationObserver.observers === 'object' &&
19390			typeof MutationObserver.observers.ym === 'object'
19391		){
19392			if(typeof pauseYmObserver.cnt === 'undefined'){
19393				pauseYmObserver.cnt = 0;
19394			}
19395
19396			++pauseYmObserver.cnt;
19397
19398			if(!MutationObserver.observers.ym.paused){
19399				MutationObserver.observers.ym.pause();
19400			}
19401		}
19402	}
19403}
19404
19405if(!funcDefined('resumeYmObserver')){
19406	// resume ya metrika webvisor MutationObserver callback
19407	// use when animation finished
19408	resumeYmObserver = function(){
19409		if(
19410			typeof MutationObserver === 'function' &&
19411			typeof MutationObserver.observers === 'object' &&
19412			typeof MutationObserver.observers.ym === 'object'
19413		){
19414			if(typeof pauseYmObserver.cnt === 'undefined'){
19415				pauseYmObserver.cnt = 1;
19416			}
19417
19418			pauseYmObserver.cnt -= pauseYmObserver.cnt > 0 ? 1 : 0;
19419
19420			if(!pauseYmObserver.cnt && MutationObserver.observers.ym.paused){
19421				MutationObserver.observers.ym.resume();
19422			}
19423		}
19424	}
19425}
19426
19427if(!funcDefined('markProductRemoveBasket')){
19428	var markProductRemoveBasket = function markProductRemoveBasket(id){
19429		$('.in-cart[data-item='+id+']').hide();
19430		$('.to-cart[data-item='+id+']').show();
19431		$('.to-cart[data-item='+id+']').closest('.button_block').removeClass('wide');
19432		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block').show();
19433		$('.counter_block[data-item='+id+']').closest('.counter_block_inner').show();
19434		$('.counter_block[data-item='+id+']').show();
19435		$('.in-subscribe[data-item='+id+']').hide();
19436		$('.to-subscribe[data-item='+id+']').show();
19437		//$('.wish_item[data-item='+id+']').removeClass("added");
19438		$('.wish_item[data-item='+id+'] .value:not(.added)').show();
19439		$('.wish_item[data-item='+id+'] .value.added').hide();
19440		$('.wish_item.to[data-item='+id+']').show();
19441		$('.wish_item.in[data-item='+id+']').hide();
19442		$('.banner_buttons.with_actions .wraps_buttons[data-id='+id+'] .basket_item_add').removeClass('added');
19443		$('.banner_buttons.with_actions .wraps_buttons[data-id='+id+'] .wish_item_add').removeClass('added');
19444
19445		if ($('#headerfixed .but-cell .type_block').length) {
19446			$('#headerfixed .but-cell .type_block span').text(BX.message('MORE_INFO_SKU'));
19447			$('#headerfixed .but-cell .type_block .svg-inline-fw').remove();
19448		}
19449	}
19450}
19451
19452if(!funcDefined('markProductAddBasket')){
19453	var markProductAddBasket = function markProductAddBasket(id){
19454		$('.to-cart[data-item='+id+']').hide();
19455		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block_inner').hide();
19456		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block').hide();
19457		$('.to-cart[data-item='+id+']').closest('.button_block').addClass('wide');
19458		$('.in-cart[data-item='+id+']').show();
19459		//$('.wish_item[data-item='+id+']').removeClass("added");
19460		$('.wish_item[data-item='+id+'] .value:not(.added)').show();
19461		$('.wish_item[data-item='+id+'] .value.added').hide();
19462
19463		$('.wish_item.to[data-item='+id+']').show();
19464		$('.wish_item.in[data-item='+id+']').hide();
19465		$('.banner_buttons.with_actions .wraps_buttons[data-id='+id+'] .basket_item_add').addClass('added');
19466
19467		if ($('#headerfixed .but-cell .type_block').length) {
19468			$('#headerfixed .but-cell .type_block').html($('.in-cart[data-item='+id+']').html());
19469		}
19470	}
19471}
19472
19473if(!funcDefined('markProductDelay')){
19474	var markProductDelay = function markProductDelay(id){
19475		$('.in-cart[data-item='+id+']').hide();
19476		$('.to-cart[data-item='+id+']').show();
19477		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block_inner').show();
19478		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block').show();
19479		$('.to-cart[data-item='+id+']').closest('.button_block').removeClass('wide');
19480		//$('.wish_item[data-item='+id+']').addClass("added");
19481		$('.wish_item[data-item='+id+'] .value:not(.added)').hide();
19482		$('.wish_item[data-item='+id+'] .value.added').css('display','block');
19483
19484		$('.wish_item.to[data-item='+id+']').hide();
19485		$('.wish_item.in[data-item='+id+']').show();
19486
19487		$('.banner_buttons.with_actions .wraps_buttons[data-id='+id+'] .wish_item_add').addClass('added');
19488
19489		if ($('#headerfixed .but-cell .type_block').length) {
19490			$('#headerfixed .but-cell .type_block span').text(BX.message('MORE_INFO_SKU'));
19491			$('#headerfixed .but-cell .type_block .svg-inline-fw').remove();
19492		}
19493
19494	}
19495}
19496
19497if(!funcDefined('markProductSubscribe')){
19498	var markProductSubscribe = function markProductSubscribe(id){
19499		$('.to-subscribe[data-item='+id+']').hide();
19500		$('.in-subscribe[data-item='+id+']').css('display','block');
19501	}
19502}
19503
19504if(!funcDefined('updateBottomIconsPanel')){
19505	var updateBottomIconsPanel = function updateBottomIconsPanel(options){
19506		if (options && $('.bottom-icons-panel').length) {
19507			var bBasketUpdate = ('READY' in options || 'BASKET_COUNT' in options);
19508			var basketCount = ('READY' in options ? options.READY.COUNT :
19509				('BASKET_COUNT' in options ? options.BASKET_COUNT : 0));
19510			var basketTitle = ('READY' in options ? options.READY.TITLE :
19511				('BASKET_SUMM_TITLE' in options ? options.BASKET_SUMM_TITLE : ''));
19512			var bDelayUpdate = ('DELAY' in options || 'DELAY_COUNT' in options);
19513			var delayCount = ('DELAY' in options ? options.DELAY.COUNT :
19514				('DELAY_COUNT' in options ? options.DELAY_COUNT : 0));
19515			var delayTitle = ('DELAY' in options ? options.DELAY.TITLE :
19516				('DELAY_SUMM_TITLE' in options ? options.DELAY_SUMM_TITLE : ''));
19517			var bCompareUpdate = ('COMPARE' in options);
19518			var compareCount = ('COMPARE' in options ?
19519				(typeof options.COMPARE === 'object' && 'COUNT' in options.COMPARE ? options.COMPARE.COUNT : Object.keys(options.COMPARE).length) : 0);
19520
19521			//basket
19522			if (bBasketUpdate) {
19523				if (+basketCount > 0) {
19524					$('.bottom-icons-panel .basket.counter-state').removeClass('counter-state--empty');
19525				} else {
19526					$('.bottom-icons-panel .basket.counter-state').addClass('counter-state--empty');
19527				}
19528				$('.bottom-icons-panel .basket .counter-state__content-item-value').text(basketCount);
19529				$('.bottom-icons-panel .basket').closest('.bottom-icons-panel__content-link').attr('title', $('<div/>').html(basketTitle).text());
19530			}
19531			//
19532
19533			//delay
19534			if (bDelayUpdate && bBasketUpdate) {
19535				if (+delayCount > 0) {
19536					$('.bottom-icons-panel .delay.counter-state').removeClass('counter-state--empty');
19537				} else {
19538					$('.bottom-icons-panel .delay.counter-state').addClass('counter-state--empty');
19539				}
19540				$('.bottom-icons-panel .delay .counter-state__content-item-value').text(delayCount);
19541				$('.bottom-icons-panel .delay').closest('.bottom-icons-panel__content-link').attr('title', $('<div/>').html(delayTitle).text());
19542			}
19543			//
19544
19545			//compare
19546			if (bCompareUpdate) {
19547				if (compareCount > 0) {
19548					$('.bottom-icons-panel .compare.counter-state').removeClass('counter-state--empty');
19549				} else {
19550					$('.bottom-icons-panel .compare.counter-state').addClass('counter-state--empty');
19551				}
19552				$('.bottom-icons-panel .compare .counter-state__content-item-value').text(compareCount);
19553			}
19554		}
19555	}
19556}
19557if(!funcDefined('basketFly')){
19558	var basketFly = function basketFly(action,opener){
19559		if(typeof obMaxPredictions === 'object'){
19560			obMaxPredictions.updateAll();
19561		}
19562
19563		/*if(arAsproOptions['PAGES']['BASKET_PAGE'])
19564			return;*/
19565		$.post( arAsproOptions['SITE_DIR']+"ajax/basket_fly.php", "PARAMS="+$("#basket_form").find("input#fly_basket_params").val(), $.proxy(function( data ){
19566			var small=$('.opener .basket_count').hasClass('small'),
19567				basket_count=$(data).find('.basket_count').find('.items div').text();
19568			$('#basket_line .basket_fly').addClass('loaded').html(data);
19569
19570			if(action=="refresh")
19571				$('li[data-type=AnDelCanBuy]').trigger('click');
19572
19573
19574			if(typeof(opener) == 'undefined' || $('#basket_line .basket_fly').hasClass('loading'))
19575			{
19576				if(window.matchMedia('(min-width: 769px)').matches)
19577				{
19578					if(action=='open')
19579					{
19580						if(small)
19581						{
19582							if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
19583							{
19584								$('.opener .basket_count').click();
19585							}
19586						}
19587						else
19588						{
19589							$('.opener .basket_count').removeClass('small')
19590							$('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass('cur');
19591							$('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass('cur');
19592
19593							$("#basket_line .basket_fly .opener > div:eq(0)").addClass("cur");
19594						}
19595					}
19596					else if(action=='wish')
19597					{
19598						if(small)
19599						{
19600							if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
19601								$('.opener .wish_count').click();
19602						}
19603						else
19604						{
19605							$('.opener .wish_count').removeClass('small')
19606							$('.tabs_content.basket li[item-section="DelDelCanBuy"]').addClass('cur');
19607							$('#basket_line ul.tabs li[item-section="DelDelCanBuy"]').addClass('cur');
19608						}
19609					}
19610					else
19611					{
19612						if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
19613						{
19614							$('.opener .basket_count').click();
19615						}
19616					}
19617				}
19618			} else if(opener === 'SHOW'){
19619				if(window.matchMedia('(min-width: 769px)').matches)
19620				{
19621					$('.opener .basket_count').removeClass('small')
19622					$('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass('cur');
19623					$('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass('cur');
19624					$("#basket_line .basket_fly .opener > div:eq(0)").addClass("cur");
19625				}
19626			}
19627		}));
19628	}
19629}
19630
19631if(!funcDefined('basketTop')){
19632	var basketTop = function basketTop(action, hoverBlock){
19633		if(action=='reload'){
19634			if($('.basket_hover_block:hover').length) {
19635				hoverBlock = $('.basket_hover_block:hover');
19636			}
19637		}
19638
19639		if(action=='open')
19640		{
19641			if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
19642			{
19643				if($('#headerfixed').hasClass('fixed')) {
19644					hoverBlock = $('#headerfixed .basket_hover_block');
19645				} else {
19646					hoverBlock = $('.top_basket .basket_hover_block');
19647				}
19648			}
19649		}
19650
19651		if( hoverBlock === undefined ) {
19652			console.log('Undefined hoverBlock');
19653			console.trace();
19654			return false;
19655		}
19656
19657		if(action=='close'){
19658			if(hoverBlock.length) {
19659				hoverBlock.css({
19660					'opacity': '',
19661					'visibility': ''
19662				});
19663				return true;
19664			}
19665		}
19666
19667		hoverBlock.removeClass('loaded');
19668		var firstTime = hoverBlock.find('div').length ? 'false' : 'true';
19669		var params = $("#basket_form").find("input#fly_basket_params").val();
19670		var postData = {
19671			firstTime: firstTime,
19672		};
19673		if(params !== undefined) {
19674			postData.PARAMS = params;
19675		}
19676
19677		$.post( arAsproOptions['SITE_DIR']+"ajax/showBasketHover.php", postData, $.proxy(function( data ){
19678			var ob = BX.processHTML(data);
19679
19680			// inject
19681			$('#headerfixed .basket_hover_block, .top_basket .basket_hover_block').html(ob.HTML);
19682			BX.ajax.processScripts(ob.SCRIPT);
19683
19684			if(window.matchMedia('(min-width: 992px)').matches)
19685			{
19686				hoverBlock.addClass('loaded');
19687
19688				if(action=='open')
19689				{
19690					if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
19691					{
19692						if($('#headerfixed').hasClass('fixed')) {
19693							hoverBlock = $('#headerfixed .basket_hover_block');
19694						} else {
19695							hoverBlock = $('.top_basket .basket_hover_block');
19696						}
19697
19698						hoverBlock.css({
19699							'opacity': '1',
19700							'visibility': 'visible'
19701						});
19702
19703						setTimeout(
19704							function() {
19705								hoverBlock.css({
19706									'opacity': '',
19707									'visibility': ''
19708								});
19709							},
19710							2000
19711						);
19712					}
19713				}
19714			}
19715
19716		}));
19717	}
19718}
19719
19720//work with hash start
19721var lastHash = location.hash;
19722if("onhashchange" in window)
19723{
19724	$(window).bind('hashchange', function() {
19725		var newHash = location.hash;
19726		if(newHash == '#delayed')
19727		{
19728			if($('#basket_toolbar_button_delayed').length)
19729				$('#basket_toolbar_button_delayed').trigger('click');
19730		}
19731		else
19732		{
19733			if($('#basket_toolbar_button').length)
19734				$('#basket_toolbar_button').trigger('click');
19735		}
19736		// Do something
19737		var diff = compareHash(newHash, lastHash);
19738		// alert("Difference between old and new hash:\n"+diff[0]+"\n\n"+diff[1]);
19739		//At the end of the func:
19740		lastHash = newHash;
19741
19742		if (lastHash) {
19743			if ('scrollRestoration' in history) {
19744				history.scrollRestoration = 'manual';
19745			}
19746			if ($('.ordered-block .tabs .nav a[href="'+lastHash+'"]').length) {
19747				$('.ordered-block .tabs .nav a[href="'+lastHash+'"]').trigger('click');
19748				var content_offset=$('.ordered-block .tabs').offset();
19749				$('html, body').animate({scrollTop: content_offset.top-90}, 400);
19750			}
19751		}
19752	});
19753
19754	function compareHash(current, previous){
19755		for(var i=0, len=Math.min(current.length, previous.length); i<len; i++){
19756			if(current.charAt(0) != previous.charAt(0)) break;
19757		}
19758		current = current.substr(i);
19759		previous = previous.substr(i);
19760		for(var i=0, len=Math.min(current.length, previous.length); i<len; i++){
19761			if(current.substr(-1) != previous.substr(-1)) break;
19762		}
19763
19764		//Array: Current = New hash, previous = old hash
19765		return [current, previous];
19766	}
19767}
19768
19769$(document).on('click', "#basket_toolbar_button", function(){
19770	if(lastHash)
19771		location.hash = 'cart';
19772})
19773$(document).on('click', "#basket_toolbar_button_delayed", function(){
19774	if(lastHash)
19775		location.hash = 'delayed';
19776})
19777if (location.hash) {
19778	var hash = location.hash
19779
19780
19781}
19782//work with hash end
19783
19784$(document).on('click', "#basket_line .basket_fly .opener > div.clicked", function(){
19785	if(arAsproOptions['PAGES']['BASKET_PAGE'])
19786		return;
19787	function onOpenFlyBasket(_this){
19788		$("#basket_line .basket_fly .tabs li").removeClass("cur");
19789		$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
19790		// $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
19791		if(!$(_this).is(".wish_count.empty"))
19792		{
19793			$("#basket_line .basket_fly .tabs_content li[item-section="+$(_this).data("type")+"]").addClass("cur");
19794			$("#basket_line .basket_fly .tabs li:eq("+$(_this).index()+")").addClass("cur");
19795			// $("#basket_line .basket_fly .remove_all_basket."+$(_this).data("type")).addClass("cur");
19796		}
19797		else
19798		{
19799			$("#basket_line .basket_fly .tabs li").first().addClass("cur").siblings().removeClass("cur");
19800			$("#basket_line .basket_fly .tabs_content li").first().addClass("cur").siblings().removeClass("cur");
19801			// $("#basket_line .basket_fly .remove_all_basket").first().addClass("cur");
19802		}
19803		$("#basket_line .basket_fly .opener > div.clicked").removeClass('small');
19804
19805		$("#basket_line .basket_fly .opener > div").siblings().removeClass('cur');
19806		$("#basket_line .basket_fly .opener > div:eq("+$(_this).index()+")").addClass('cur');
19807
19808	}
19809
19810	if(window.matchMedia('(min-width: 769px)').matches)
19811	{
19812		var _this = this;
19813
19814		$(_this).siblings().removeClass('cur');
19815		$(_this).addClass('cur');
19816
19817		if(parseInt($("#basket_line .basket_fly").css("right")) < 0)
19818		{
19819			$("#basket_line .basket_fly").stop().addClass('loading').animate({"right": "0"}, 333, function(){
19820				if($(_this).closest('.basket_fly.loaded').length)
19821				{
19822					onOpenFlyBasket(_this);
19823				}
19824				else
19825				{
19826					$.ajax({
19827						url: arAsproOptions['SITE_DIR'] + 'ajax/basket_fly.php',
19828						type: 'post',
19829						success: function(html){
19830							$('#basket_line .basket_fly').removeClass('loading').addClass('loaded').html(html);
19831							onOpenFlyBasket(_this);
19832						}
19833					});
19834				}
19835			});
19836			$('#basket_line .basket_fly').addClass('swiped');
19837		}
19838		else if($(this).is(".wish_count:not(.empty)") && !$("#basket_line .basket_fly .basket_sort ul.tabs li.cur").is("[item-section=DelDelCanBuy]"))
19839		{
19840			$("#basket_line .basket_fly .tabs li").removeClass("cur");
19841			$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
19842			// $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
19843			$("#basket_line .basket_fly .tabs_content li[item-section="+$(this).data("type")+"]").addClass("cur");
19844			$("#basket_line  .basket_fly .tabs li:eq("+$(this).index()+")").first().addClass("cur");
19845			// $("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur");
19846		}
19847		else if($(this).is(".basket_count") && $("#basket_line .basket_fly .basket_sort ul.tabs li.cur").length && !$("#basket_line .basket_fly .basket_sort ul.tabs li.cur").is("[item-section=AnDelCanBuy]"))
19848		{
19849			$("#basket_line .basket_fly .tabs li").removeClass("cur");
19850			$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
19851			// $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
19852			$("#basket_line  .basket_fly .tabs_content li:eq("+$(this).index()+")").addClass("cur");
19853			$("#basket_line  .basket_fly .tabs li:eq("+$(this).index()+")").first().addClass("cur");
19854			// $("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur");
19855		}
19856		else
19857		{
19858			$("#basket_line .basket_fly").stop().animate({"right": -$("#basket_line .basket_fly").outerWidth()}, 150);
19859			$("#basket_line .basket_fly .opener > div.clicked").addClass('small');
19860			$('#basket_line .basket_fly').removeClass('swiped');
19861			$("#basket_line .basket_fly .opener > div").removeClass("cur");
19862		}
19863	}
19864});
19865
19866if(!funcDefined("clearViewedProduct")){
19867	function clearViewedProduct(){
19868		try{
19869			var siteID = arAsproOptions.SITE_ID;
19870			var localKey = 'MAX_VIEWED_ITEMS_' + siteID;
19871			var cookieParams = {path: '/', expires: 30};
19872			if(typeof BX.localStorage !== 'undefined')
19873			{
19874				// remove local storage
19875				BX.localStorage.set(localKey, {}, 0);
19876			}
19877			// remove cookie
19878			$.removeCookie(localKey, cookieParams);
19879		}
19880		catch(e){
19881			console.error(e);
19882		}
19883	}
19884}
19885
19886if(!funcDefined("setViewedProduct")){
19887	function setViewedProduct(id, arData){
19888		try{
19889
19890			// save $.cookie option
19891			var bCookieJson = $.cookie.json;
19892			$.cookie.json = true;
19893
19894			var siteID = arAsproOptions.SITE_ID;
19895			var localKey = 'MAX_VIEWED_ITEMS_' + siteID;
19896			var cookieParams = {path: '/', expires: 30};
19897
19898			if((typeof BX.localStorage !== 'undefined') && (typeof id !== 'undefined') && (typeof arData !== 'undefined')){
19899				var PRODUCT_ID = (typeof arData.PRODUCT_ID !== 'undefined') ? arData.PRODUCT_ID : id;
19900				var arViewedLocal = BX.localStorage.get(localKey) ? BX.localStorage.get(localKey) : {};
19901				var arViewedCookie = $.cookie(localKey) ? $.cookie(localKey) : {};
19902				var count = 0;
19903
19904				// delete some items (sync cookie & local storage)
19905				for(var _id in arViewedLocal){
19906					arViewedLocal[_id].IS_LAST = false;
19907					if(typeof arViewedCookie[_id] === 'undefined'){
19908						delete arViewedLocal[_id];
19909					}
19910				}
19911				for(var _id in arViewedCookie){
19912					if(typeof arViewedLocal[_id] === 'undefined'){
19913						delete arViewedCookie[_id];
19914					}
19915				}
19916
19917				for(var _id in arViewedCookie){
19918					count++;
19919				}
19920
19921				// delete item if other item (offer) of that PRODUCT_ID is exists
19922				if(typeof arViewedLocal[PRODUCT_ID] !== 'undefined'){
19923					if(arViewedLocal[PRODUCT_ID].ID != id){
19924						delete arViewedLocal[PRODUCT_ID];
19925						delete arViewedCookie[PRODUCT_ID];
19926					}
19927				}
19928
19929				var time = new Date().getTime();
19930				arData.ID = id;
19931				arData.ACTIVE_FROM = time;
19932				arData.IS_LAST = true;
19933				arViewedLocal[PRODUCT_ID] = arData;
19934				arViewedCookie[PRODUCT_ID] = [time.toString(), arData.PICTURE_ID];
19935
19936				$.cookie(localKey, arViewedCookie, cookieParams);
19937				BX.localStorage.set(localKey, arViewedLocal, 2592000);  // 30 days
19938			}
19939		}
19940		catch(e){
19941			console.error(e);
19942		}
19943		finally{
19944			// restore $.cookie option
19945			$.cookie.json = bCookieJson;
19946		}
19947	}
19948}
19949
19950
19951
19952if(!funcDefined('initSelects')){
19953	function initSelects(target){
19954		var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false );
19955		if ( iOS ) return;
19956		if($("#bx-soa-order").length)
19957			return;
19958		// SELECT STYLING
19959		$(target).find('.wrapper1 select:visible').ikSelect({
19960			syntax: '<div class="ik_select_link"> \
19961						<span class="ik_select_link_text"></span> \
19962						<div class="trigger"></div> \
19963					</div> \
19964					<div class="ik_select_dropdown"> \
19965						<div class="ik_select_list"> \
19966						</div> \
19967					</div>',
19968			dynamicWidth: true,
19969			ddMaxHeight: 112,
19970			customClass: 'common_select',
19971			//equalWidths: true,
19972			onShow: function(inst){
19973				inst.$dropdown.css('top', (parseFloat(inst.$dropdown.css('top'))-5)+'px');
19974				if ( inst.$dropdown.outerWidth() < inst.$link.outerWidth() ){
19975					inst.$dropdown.css('width', inst.$link.outerWidth());
19976				}
19977				if ( inst.$dropdown.outerWidth() > inst.$link.outerWidth() ){
19978					inst.$dropdown.css('width', inst.$link.outerWidth());
19979				}
19980				var count=0,
19981					client_height=0;
19982				inst.$dropdown.css('left', inst.$link.offset().left);
19983				$(inst.$listInnerUl).find('li').each(function(){
19984					if(!$(this).hasClass('ik_select_option_disabled')){
19985						++count;
19986						client_height+=$(this).outerHeight();
19987					}
19988				})
19989				if(client_height<112){
19990					inst.$listInner.css('height', 'auto');
19991				}else{
19992					inst.$listInner.css('height', '112px');
19993				}
19994				inst.$link.addClass('opened');
19995				inst.$listInner.addClass('scroller');
19996				if($('.confirm_region').length)
19997					$('.confirm_region').remove();
19998			},
19999			onHide: function(inst){
20000				inst.$link.removeClass('opened');
20001			}
20002		});
20003		// END OF SELECT STYLING
20004
20005		var timeout;
20006		$(window).on('resize', function(){
20007			ignoreResize.push(true);
20008				clearTimeout(timeout);
20009				timeout = setTimeout(function(){
20010					//$('select:visible').ikSelect('redraw');
20011					var inst='';
20012					if(inst=$('.common_select-link.opened + select').ikSelect().data('plugin_ikSelect')){
20013						inst.$dropdown.css('left', inst.$link.offset().left+'px');
20014					}
20015				}, 20);
20016			ignoreResize.pop();
20017		});
20018	}
20019}
20020
20021if(!funcDefined('CheckTopMenuFullCatalogSubmenu')){
20022	CheckTopMenuFullCatalogSubmenu = function(){
20023		if(arAsproOptions['THEME'] && arAsproOptions['THEME']['MENU_TYPE_VIEW'] != 'HOVER')
20024			return;
20025
20026		var $menu = $('.left_block .menu_top_block');
20027		if($menu.length)
20028		{
20029			var $wrapmenu = $menu.parents('.wrap_menu');
20030
20031			var wrapMenuWidth = $menu.closest('.wrapper_inner').actual('width');
20032			if(!wrapMenuWidth)
20033				wrapMenuWidth = $menu.closest('.wraps').actual('width');
20034
20035			if ($menu.closest('.rasprodazha_sale').length)
20036			{
20037				wrapMenuWidth = $menu.closest('.rasprodazha_sale .right_block').actual('width');
20038			}
20039
20040			var bCatalogFirst = $menu.hasClass('catalogfirst');
20041			var findMenuLi = $('.left_block .menu_top_block:visible li.full');
20042			var parentSubmenuWidth = $menu.actual('outerWidth');
20043			var wrapMenuLeft = 0;
20044			var wrapMenuRight = 0;
20045
20046			if($wrapmenu.length)
20047			{
20048				wrapMenuWidth = $wrapmenu.actual('outerWidth');
20049				wrapMenuLeft = $wrapmenu.offset().left;
20050				wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
20051			}
20052
20053			if($('.left_block .catalog_block.menu_top_block').length){
20054				if($('.left_block .catalog_block.menu_top_block').is(':visible'))
20055					findMenuLi=$('.left_block .menu_top_block.catalog_block li.full');
20056			}
20057			findMenuLi.each(function(){
20058				var $this = $(this);
20059				var $submenu = $this.find('>.dropdown');
20060
20061				if($submenu.length){
20062					// $submenu.css({left: parentSubmenuWidth + 'px', width: (wrapMenuWidth - parentSubmenuWidth) + 'px', 'padding-left': '0px', 'padding-right': '0px', 'opacity': 1});
20063					$submenu.css({width: (wrapMenuWidth - parentSubmenuWidth) + 'px'});
20064
20065					if(!isOnceInited && arAsproOptions['THEME']["MENU_POSITION"] == "TOP"){
20066						$this.on('mouseenter', function(){
20067							$submenu.css('min-height', $this.closest('.dropdown').actual('outerHeight') + 'px');
20068						});
20069					}
20070				}
20071			});
20072		}
20073	}
20074}
20075
20076$.fn.getMaxHeights = function( outer, classNull, minHeight ){
20077	var maxHeight = this.map( function( i, e ){
20078		var calc_height=0;
20079		$(e).css('height', '');
20080
20081		if( outer == true )
20082			calc_height=$(e).actual('outerHeight');
20083		else
20084			calc_height=$(e).actual('height');
20085
20086		return calc_height;
20087	}).get();
20088	for(var i = 0, c = maxHeight.length; i < c; ++i)
20089	{
20090		if(maxHeight[i] % 2)
20091			--maxHeight[i];
20092	}
20093	return Math.max.apply( this, maxHeight );
20094}
20095
20096$.fn.equalizeHeights = function( outer, classNull, options ){
20097	var maxHeight = [];
20098	var items = [];
20099
20100	for (var i = 0, itemKey = 0; i < this.length; itemKey++) {
20101		var item = this[itemKey],
20102			_item = $(item),
20103			minus_height=0,
20104			calc_height=0;
20105
20106		i++;
20107
20108		if(options.blockNull !== undefined) {
20109			if(options.blockNull.class !== undefined) {
20110				if(_item.hasClass(options.blockNull.class) || _item.closest('.'+options.blockNull.class).length) {
20111					continue;
20112				}
20113			}
20114		}
20115
20116		items.push(this[itemKey]);
20117
20118		if(classNull!==false)
20119		{
20120			if(!isMobile) {
20121				var nulled = _item.find(classNull);
20122				if(nulled.length) {
20123					minus_height=parseInt(nulled[0].offsetHeight);
20124					//minus_height=parseInt(_item.find(classNull).outerHeight(false));
20125					//minus_height=parseInt(_item.find(classNull).actual('outerHeight'));
20126				}
20127			}
20128		}
20129
20130		if(minus_height)
20131			minus_height+=12;
20132
20133		_item.css('height', '');
20134
20135		calc_height=item.offsetHeight-minus_height;
20136
20137		if(options.minHeight!==false)
20138		{
20139			if(calc_height<options.minHeight)
20140				calc_height+=(options.minHeight-calc_height);
20141
20142			if(window.matchMedia('(max-width: 520px)').matches)
20143				calc_height=300;
20144
20145			if(window.matchMedia('(max-width: 400px)').matches)
20146				calc_height=200;
20147
20148		}
20149
20150		if(!calc_height)
20151			calc_height = 0;
20152
20153		maxHeight.push(calc_height);
20154	}
20155
20156	for(var i = 0, c = maxHeight.length; i < c; ++i){
20157		if(maxHeight[i] % 2){
20158			--maxHeight[i];
20159		}
20160	}
20161
20162	var result = $(items).height( Math.max.apply( this, maxHeight ) );
20163
20164	return result;
20165}
20166
20167$.fn.getFloatWidth = function(){
20168	var width = 0;
20169	if($(this).length){
20170		var rect = $(this)[0].getBoundingClientRect();
20171		if(!(width = rect.width))
20172			width = rect.right - rect.left;
20173	}
20174
20175	$(this).data('floatWidth', width);
20176
20177	return width;
20178}
20179
20180function extendDepthObject(target, FromObj) {
20181	var to = Object.assign({}, target);
20182	for(var key in FromObj)
20183	{
20184		if( typeof(FromObj[key]) == 'object' ) {
20185			to[key] = extendDepthObject(to[key], FromObj[key]);
20186		} else {
20187			to[key] = FromObj[key];
20188		}
20189	}
20190
20191	return to;
20192}
20193
20194$.fn.sliceHeight = function( options ){
20195	function _slice(el){
20196		var arBreakpoints = Object.keys(options.breakpoint);
20197		var resizeOptionsTmp = {};
20198		if(arBreakpoints.length)
20199		{
20200			for(var key in arBreakpoints)
20201			{
20202				if(window.matchMedia(arBreakpoints[key].toString()).matches)
20203				{
20204					resizeOptionsTmp = options.breakpoint[arBreakpoints[key]];
20205				}
20206			}
20207		}
20208
20209		var resizeOptions = extendDepthObject(options, resizeOptionsTmp);
20210
20211		var blockNullClass = resizeOptions.blockNull !== undefined && resizeOptions.blockNull.class !== undefined ? resizeOptions.blockNull.class : false;
20212		var parent = (typeof(resizeOptions.row) !== 'undefined' && resizeOptions.row.length) ?  el.first().parents(resizeOptions.row) : el.first().parents('.items');
20213		var item = '';
20214
20215		if(typeof(resizeOptions.item) !== 'undefined' && resizeOptions.item.length) {
20216			if(blockNullClass) {
20217				$(resizeOptions.item).each(function(i, element){
20218					_element = $(element);
20219					if(!_element.hasClass(blockNullClass)) {
20220						item = _element;
20221					}
20222				});
20223				if(!item) // if only ignored blocks
20224					return false;
20225			} else {
20226				item = $(resizeOptions.item).first();
20227			}
20228		} else {
20229			if( el.first().hasClass('item') ) {
20230				item = el.first();
20231			} else {
20232				item = el.first().parents('.item');
20233			}
20234		}
20235
20236		if(typeof(resizeOptions.autoslicecount) == 'undefined' || resizeOptions.autoslicecount !== false){
20237			var elsw = parent.getFloatWidth(),
20238				elw = item.getFloatWidth();
20239			if(!elsw){
20240				elsw = el.first().parents('.row').getFloatWidth();
20241			}
20242			if(!elw)
20243			{
20244				if(typeof(resizeOptions.item) !== 'undefined' && resizeOptions.item.length)
20245					elw = (($(resizeOptions.item+':eq(1)').getFloatWidth()) ? $(resizeOptions.item+':eq(1)').getFloatWidth() : $(resizeOptions.item+':eq(2)').getFloatWidth());
20246				else
20247					elw = (($(el[1]).getFloatWidth()) ? $(el[1]).getFloatWidth() : $(el[2]).getFloatWidth());
20248			}
20249			if(elw && resizeOptions.fixWidth)
20250				elw -= resizeOptions.fixWidth;
20251
20252			elw = (parseInt(elw * 100)) / 100;
20253
20254			if(elsw && elw){
20255				resizeOptions.slice = Math.floor(elsw / elw);
20256			}
20257		}
20258
20259		if(resizeOptions.customSlice) //manual slice count
20260		{
20261			var bSliceNext = false;
20262			if(resizeOptions.length)
20263			{
20264				elw=(typeof(resizeOptions.item) !== 'undefined' && resizeOptions.item.length) ? $(resizeOptions.item).last().getFloatWidth() : (el.last().hasClass('item') ? el.last().getFloatWidth() : el.last().parents('.item').getFloatWidth());
20265				if(elw)
20266					resizeOptions.sliceNext = Math.floor(elsw / elw);
20267
20268				bSliceNext = true;
20269			}
20270		}
20271
20272		elements = [];
20273		if(resizeOptions.classes !== undefined && resizeOptions.classes.length) {
20274			for(var i = 0;i < resizeOptions.classes.length;i++) {
20275				var items = $(resizeOptions.item).find(resizeOptions.classes[i]);
20276				elements.push( items );
20277			}
20278		}
20279		var elIndex = elements.push(el) - 1;
20280
20281		if(resizeOptions.mobile == true)
20282		{
20283			if(window.matchMedia('(max-width: 500px)').matches) {
20284				for(var block = 0; block < elements.length; block++){
20285					var items = $(elements[block]);
20286					items.css({
20287						'line-height': '',
20288						'height': '',
20289					});
20290				}
20291				return;
20292			}
20293		}
20294
20295		if(typeof(resizeOptions.typeResize) == 'undefined' || resizeOptions.typeResize == false)
20296		{
20297			if(resizeOptions.slice){
20298				for(var block = 0; block < elements.length; block++){
20299					if(resizeOptions.currentRow) {
20300						var itemNumber = el.index(resizeOptions.currentItem);
20301						var rowCount = resizeOptions.slice;
20302						var rowNumber = Math.floor(itemNumber / rowCount);
20303
20304						var items = $(elements[block].slice(rowNumber * rowCount, rowNumber * rowCount + rowCount));
20305						var classNull = block == elIndex ? resizeOptions.classNull : false;
20306						items.css({
20307							'line-height': '',
20308							'height': '',
20309						});
20310						items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions);
20311					} else {
20312						for(var i = 0; i < elements[block].length; ){
20313							if(resizeOptions.customSlice && resizeOptions.sliceNext && bSliceNext && i) //manual slice count
20314								resizeOptions.slice = resizeOptions.sliceNext;
20315
20316							var slice = resizeOptions.slice;
20317							var items = $(elements[block].slice(i, i + slice));
20318							if(resizeOptions.blockNull !== undefined) {
20319								if(resizeOptions.blockNull.class !== undefined) {
20320									var counts = 0;
20321									items.each(function(i, item) {
20322										var _item = $(item);
20323										if(_item.hasClass(resizeOptions.blockNull.class) || _item.closest('.'+resizeOptions.blockNull.class).length) {
20324											counts++;
20325										}
20326									});
20327								}
20328							}
20329							if(counts) {
20330								slice -= ( resizeOptions.blockNull.width - 1 ) * counts;
20331							}
20332
20333							items = $(elements[block].slice(i, i + slice));
20334							if(items) {
20335								var classNull = block == elIndex ? resizeOptions.classNull : false;
20336
20337								items.css({
20338									'line-height': '',
20339									'height': '',
20340								});
20341								items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions);
20342							}
20343							i += slice || 1;
20344						}
20345					}
20346
20347				}
20348			}
20349			if(resizeOptions.lineheight){
20350				var lineheightAdd = parseInt(resizeOptions.lineheight);
20351				if(isNaN(lineheightAdd)){
20352					lineheightAdd = 0;
20353				}
20354				el.each(function() {
20355					$(this).css('line-height', ($(this).actual('height') + lineheightAdd) + 'px');
20356				});
20357			}
20358		}
20359	}
20360	var options = $.extend({
20361		slice: null,
20362		sliceNext: null,
20363		outer: false,
20364		lineheight: false,
20365		autoslicecount: true,
20366		classNull: false,
20367		minHeight: false,
20368		row:false,
20369		item:false,
20370		typeResize:false,
20371		typeValue:false,
20372		fixWidth:0,
20373		resize:true,
20374		mobile:false,
20375		customSlice:false,
20376		breakpoint:{},
20377		classes: [],
20378	}, options);
20379
20380	var el = $(this);
20381
20382	ignoreResize.push(true);
20383	_slice(el);
20384	ignoreResize.pop();
20385
20386	if(options.resize)
20387	{
20388		BX.addCustomEvent('onWindowResize', function(eventdata) {
20389			try{
20390				ignoreResize.push(true);
20391				_slice(el);
20392			}
20393			catch(e){}
20394			finally{
20395				ignoreResize.pop();
20396			}
20397		});
20398	}
20399	else
20400	{
20401		if(!ignoreResize.length)
20402		{
20403			// ignoreResize.push(true);
20404			_slice(el);
20405			// ignoreResize.pop();
20406		}
20407	}
20408}
20409
20410$.fn.sliceHeightNoResize = function( options ){
20411	function _slice(el){
20412		el.each(function() {
20413			$(this).css('line-height', '');
20414			$(this).css('height', '');
20415		});
20416		if(options.mobile == true)
20417		{
20418			if(window.matchMedia('(max-width: 550px)').matches)
20419				return;
20420		}
20421		if(typeof(options.autoslicecount) == 'undefined' || options.autoslicecount !== false){
20422			var elsw=(typeof(options.row) !== 'undefined' && options.row.length) ?  el.first().parents(options.row).getFloatWidth() : el.first().parents('.items').getFloatWidth(),
20423				elw=(typeof(options.item) !== 'undefined' && options.item.length) ? $(options.item).first().getFloatWidth() : (el.first().hasClass('item') ? el.first().getFloatWidth() : el.first().parents('.item').getFloatWidth());
20424
20425			if(!elsw){
20426				elsw = el.first().parents('.row').getFloatWidth();
20427			}
20428			if(elw && options.fixWidth)
20429				elw -= options.fixWidth;
20430
20431			if(elsw && elw){
20432				options.slice = Math.floor(elsw / elw);
20433			}
20434		}
20435		if(options.customSlice) //manual slice count
20436		{
20437			var arBreakpoints = Object.keys(options.breakpoint),
20438				bSliceNext = false;
20439			if(arBreakpoints.length)
20440			{
20441				elw=(typeof(options.item) !== 'undefined' && options.item.length) ? $(options.item).last().getFloatWidth() : (el.last().hasClass('item') ? el.last().getFloatWidth() : el.last().parents('.item').getFloatWidth());
20442				if(elw)
20443					options.sliceNext = Math.floor(elsw / elw);
20444				for(var key in arBreakpoints)
20445				{
20446					if(window.matchMedia(arBreakpoints[key].toString()).matches)
20447					{
20448						bSliceNext = true;
20449						options.slice = options.breakpoint[arBreakpoints[key]];
20450					}
20451				}
20452			}
20453		}
20454		if(typeof(options.typeResize) == 'undefined' || options.typeResize == false)
20455		{
20456			if(options.slice){
20457				for(var i = 0; i < el.length; i += options.slice){
20458					if(options.customSlice && options.sliceNext && bSliceNext && i) //manual slice count
20459						options.slice = options.sliceNext;
20460					$(el.slice(i, i + options.slice)).equalizeHeights(options.outer, options.classNull, options.minHeight, options.typeResize, options.typeValue);
20461				}
20462			}
20463			if(options.lineheight){
20464				var lineheightAdd = parseInt(options.lineheight);
20465				if(isNaN(lineheightAdd)){
20466					lineheightAdd = 0;
20467				}
20468				el.each(function() {
20469					$(this).css('line-height', ($(this).actual('height') + lineheightAdd) + 'px');
20470				});
20471			}
20472		}
20473	}
20474	var options = $.extend({
20475		slice: null,
20476		sliceNext: null,
20477		outer: false,
20478		lineheight: false,
20479		autoslicecount: true,
20480		classNull: false,
20481		minHeight: false,
20482		row:false,
20483		item:false,
20484		typeResize:false,
20485		typeValue:false,
20486		fixWidth:0,
20487		resize:true,
20488		mobile:false,
20489		customSlice:false,
20490		breakpoint:{},
20491	}, options);
20492
20493	var el = $(this);
20494
20495	ignoreResize.push(true);
20496	_slice(el);
20497	ignoreResize.pop();
20498}
20499
20500if(!funcDefined('initHoverBlock')){
20501	function initHoverBlock(target){
20502		/*$(target).find('.catalog_item.item_wrap').on('mouseenter', function(){
20503			$(this).addClass('hover');
20504		})
20505		$(target).find('.catalog_item.item_wrap').on('mouseleave', function(){
20506			$(this).removeClass('hover');
20507		})*/
20508	}
20509}
20510if(!funcDefined('setStatusButton')){
20511	function setStatusButton(){
20512		if(!funcDefined('setItemButtonStatus')){
20513			setItemButtonStatus = function(data){
20514				if(data.BASKET){
20515					for( var i in data.BASKET ){
20516						var id = data.BASKET[i];
20517						if(typeof id === 'number' || typeof id === 'string'){
20518							$('.to-cart[data-item='+id+']').hide();
20519							$('.counter_block[data-item='+id+']').closest('.counter_block_inner').hide();
20520							$('.counter_block[data-item='+id+']').hide();
20521							$('.in-cart[data-item='+id+']').show();
20522							$('.in-cart[data-item='+id+']').closest('.button_block').addClass('wide');
20523						}
20524					}
20525				}
20526				if(data.DELAY){
20527					for( var i in data.DELAY ){
20528						var id = data.DELAY[i];
20529						if(typeof id === 'number' || typeof id === 'string'){
20530							$('.wish_item.to[data-item='+id+']').hide();
20531							$('.wish_item.in[data-item='+id+']').show();
20532							if ($('.wish_item[data-item='+id+']').find(".value.added").length) {
20533								//$('.wish_item[data-item='+id+']').addClass("added");
20534								$('.wish_item[data-item='+id+']').find(".value").hide();
20535								$('.wish_item[data-item='+id+']').find(".value.added").show();
20536							}
20537						}
20538					}
20539				}
20540				if(data.SUBSCRIBE){
20541					for( var i in data.SUBSCRIBE ){
20542						var id = data.SUBSCRIBE[i];
20543						if(typeof id === 'number' || typeof id === 'string'){
20544							$('.to-subscribe[data-item='+id+']').hide();
20545							$('.in-subscribe[data-item='+id+']').show();
20546						}
20547					}
20548				}
20549				if(data.COMPARE){
20550					for( var i in data.COMPARE ){
20551						var id = data.COMPARE[i];
20552						if(typeof id === 'number' || typeof id === 'string'){
20553							$('.compare_item.to[data-item='+id+']').hide();
20554							$('.compare_item.in[data-item='+id+']').show();
20555							if ($('.compare_item[data-item='+id+']').find(".value.added").length){
20556								$('.compare_item[data-item='+id+']').find(".value").hide();
20557								$('.compare_item[data-item='+id+']').find(".value.added").show();
20558							}
20559						}
20560					}
20561				}
20562			}
20563		}
20564		if(!Object.keys(arStatusBasketAspro).length)
20565		{
20566			if(typeof arAsproOptions === 'undefined')
20567			{
20568				var arAsproOptions = ({
20569					"SITE_DIR" : '/'
20570				});
20571				if($('body').data('site') !== undefined)
20572					arAsproOptions["SITE_DIR"] = $('body').data('site');
20573			}
20574			$.ajax({
20575				url: arAsproOptions["SITE_DIR"]+'ajax/getAjaxBasket.php',
20576				type: 'POST',
20577				success: function(data){
20578					arStatusBasketAspro = data;
20579					setItemButtonStatus(arStatusBasketAspro);
20580				}
20581			});
20582		}
20583		else
20584			setItemButtonStatus(arStatusBasketAspro);
20585	}
20586}
20587
20588
20589if(!funcDefined('onLoadjqm')){
20590	var onLoadjqm = function(name, hash, requestData, selector, requestTitle, isButton, thButton){
20591		if( hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay) ) {
20592			$('body').addClass('jqm-initied');
20593		}
20594		if(window.matchMedia('(min-width: 768px)').matches)
20595		{
20596			$("body").addClass("swipeignore");
20597		}
20598
20599		if(typeof $(hash.t).data('ls') !==' undefined' && $(hash.t).data('ls'))
20600		{
20601			var ls = $(hash.t).data('ls'),
20602				ls_timeout = 0,
20603				v = '';
20604
20605			if($(hash.t).data('ls_timeout'))
20606				ls_timeout = $(hash.t).data('ls_timeout');
20607
20608			ls_timeout = ls_timeout ? Date.now() + (ls_timeout*1000) : '';
20609
20610			if(typeof localStorage !== 'undefined')
20611			{
20612				var val = localStorage.getItem(ls);
20613				try{
20614					v = JSON.parse(val);
20615				}
20616				catch(e){
20617					v = val
20618				}
20619				if(v!= null)
20620				{
20621					localStorage.removeItem(ls);
20622				}
20623				v={};
20624				v['VALUE'] = 'Y';
20625				v['TIMESTAMP'] = ls_timeout; // default: seconds for 1 day
20626
20627				localStorage.setItem(ls, JSON.stringify(v));
20628			}
20629			else
20630			{
20631				var val = $.cookie(ls);
20632				if(!val)
20633					$.cookie(ls, "Y", {expires: ls_timeout});// default: seconds for 1 day
20634			}
20635
20636			var dopClasses = hash.w.find('.marketing-popup').data('classes');
20637			if(dopClasses) {
20638				hash.w.addClass(dopClasses);
20639			}
20640		}
20641
20642		$.each($(hash.t).get(0).attributes, function(index, attr){
20643			if(/^data\-autoload\-(.+)$/.test(attr.nodeName)){
20644				var key = attr.nodeName.match(/^data\-autoload\-(.+)$/)[1];
20645				var el = $('input[data-sid="'+key.toUpperCase()+'"]');
20646				el.val(BX.util.htmlspecialcharsback($(hash.t).data('autoload-'+key))).attr('readonly', 'readonly');
20647				el.closest('.form-group').addClass('input-filed');
20648				el.attr('title', el.val());
20649			}
20650		});
20651
20652		//show gift block
20653		if(hash.w.hasClass('send_gift_frame'))
20654		{
20655			var imgHtml = priceHtml = propsHtml = '';
20656			if($('.offers_img a').length)
20657				imgHtml = $('.offers_img a').html();
20658			else if($('.product-detail-gallery__container .first_sku_picture').length)
20659				imgHtml = '<img src='+$('.product-detail-gallery__container link.first_sku_picture').attr('href')+' />';
20660			else if($('.product-detail-gallery__container').length)
20661				imgHtml = '<img src='+$('.product-detail-gallery__container link[itemprop="image"]').attr('href')+' />';
20662
20663			if($('.product-container *[itemprop="offers"]').length) //show price
20664			{
20665				if($('.sku-view').length)
20666				{
20667					if($('.prices_block .price').length)
20668						priceHtml = $('.prices_block .cost.prices').html().replace('id', 'data-id');
20669				}
20670				else
20671				{
20672					if($('.prices_block .js_price_wrapper').length)
20673						priceHtml = '<div class="with_matrix">'+$('.prices_block .js_price_wrapper').html()+'</div>';
20674					else if($('.prices_block .with_matrix').length)
20675						priceHtml = '<div class="with_matrix">'+$('.prices_block .with_matrix').html()+'</div>';
20676					else if($('.prices_block .price_group.min').length)
20677						priceHtml = $('.prices_block .price_group.min').html();
20678					else if($('.prices_block .price_matrix_wrapper').length)
20679						priceHtml = $('.prices_block .price_matrix_wrapper').html();
20680				}
20681			}
20682
20683			if($('.buy_block .sku_props').length)
20684			{
20685				propsHtml = '<div class="props_item">';
20686				$('.buy_block .sku_props .bx_catalog_item_scu > div').each(function(){
20687					var title = $(this).find('.bx_item_section_name > span').html();
20688					var props = '';
20689					var ikSelect = $(this).find('.ik_select_link_text');
20690					if( ikSelect.length ) {
20691						props = ikSelect.text();
20692					} else {
20693						var activeSku = $(this).find('ul li.active');
20694						var isPicture = activeSku.find(' > i');
20695						if( isPicture.length && isPicture.attr('title') ) {
20696							var propTitle = isPicture.attr('title').split(':');
20697							if(propTitle.length) {
20698								propTitle = propTitle[1].trim();
20699							} else {
20700								propTitle = isPicture.attr('title');
20701							}
20702							props = propTitle;
20703						} else {
20704							props = activeSku.find(' > span').text();
20705						}
20706					}
20707
20708					propsHtml += '<div class="prop_item">'+
20709									'<span>'+
20710										title + '<span class="val">'+props+'</span>' +
20711									'</span>'+
20712								'</div>';
20713
20714				})
20715				propsHtml += '</div>';
20716			}
20717			$('<div class="custom_block">'+
20718				'<div class="title">'+BX.message('POPUP_GIFT_TEXT')+'</div>'+
20719				'<div class="item_block">'+
20720					'<table class="item_list"><tr>'+
20721						'<td class="image">'+
20722							'<div>'+imgHtml+'</div>'+
20723						'</td>'+
20724						'<td class="text">'+
20725							'<div class="name">'+$('h1').text()+'</div>'+
20726							priceHtml+
20727							propsHtml+
20728						'</td>'+
20729					'</tr></table>'+
20730				'</div>'+
20731				'</div>').prependTo(hash.w.find('.form_body'))
20732		}
20733
20734		if(arAsproOptions['THEME']['REGIONALITY_SEARCH_ROW'] == 'Y' && (hash.w.hasClass('city_chooser_frame ') || hash.w.hasClass('city_chooser_small_frame'))){
20735			hash.w.addClass('small_popup_regions');
20736			hash.w.addClass('no_custom_scroll');
20737		}
20738
20739		if( hash.w.hasClass('city_chooser_frame ') || hash.w.hasClass('city_chooser_small_frame ') ) {
20740			$('.popup_regions .items .items_block').mCustomScrollbar({
20741				mouseWheel: {
20742					scrollAmount: 150,
20743					preventDefault: true
20744				}
20745			});
20746		}
20747
20748
20749		if( name == 'fast_view' && $('.smart-filter-filter').length) {
20750			var navButtons = '<div class="navigation-wrapper-fast-view">'+
20751				'<div class="fast-view-nav prev colored_theme_hover_bg" data-fast-nav="prev">'+
20752					'<i class="svg left">'+
20753						'<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"><path id="Rounded_Rectangle_702_copy_24" data-name="Rounded Rectangle 702 copy 24" class="cls-1" d="M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z" transform="translate(-350 -395.031)"/></svg>'+
20754					'</i>'+
20755				'</div>'+
20756
20757				'<div class="fast-view-nav next colored_theme_hover_bg" data-fast-nav="next">'+
20758					'<i class="svg right">'+
20759						'<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"><path id="Rounded_Rectangle_702_copy_24" data-name="Rounded Rectangle 702 copy 24" class="cls-1" d="M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z" transform="translate(-350 -395.031)"/></svg>'+
20760					'</i>'+
20761				'</div>'+
20762			'</div>';
20763
20764			hash.w.closest('#popup_iframe_wrapper').append(navButtons);
20765		}
20766
20767		hash.w.addClass('show').css({
20768			// 'top': (($(window).height() > hash.w.height()) ? Math.floor(($(window).height() - hash.w.height()) / 2) : 0) + 'px',
20769			// 'margin-left': ($(window).width() > hash.w.outerWidth() ? '-' + hash.w.outerWidth() / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
20770			'opacity': 1
20771		});
20772
20773		if( !hash.w.hasClass('no_custom_scroll') ){
20774			hash.w.mCustomScrollbar({
20775				mouseWheel: {
20776					scrollAmount: 150,
20777					preventDefault: true
20778				}
20779			});
20780		}
20781
20782		
20783
20784		if(hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) {
20785			$('body').css({'overflow': 'hidden','height': '100vh'});
20786			hash.w.closest('#popup_iframe_wrapper').css({'z-index': 3000, 'display': 'flex'});
20787		}
20788
20789		var eventdata = {action:'loadForm'};
20790		BX.onCustomEvent('onCompleteAction', [eventdata, $(hash.t)[0]]);
20791
20792
20793		if(typeof(requestData) == 'undefined'){
20794			requestData = '';
20795		}
20796		if(typeof(selector) == 'undefined'){
20797			selector = false;
20798		}
20799
20800		var width = $('.'+name+'_frame').width();
20801		//$('.'+name+'_frame').css('margin-left', '-'+width/2+'px');
20802
20803		if(name=='order-popup-call') {
20804		}
20805		else if(name=='order-button') {
20806			$(".order-button_frame").find("div[product_name]").find("input").val(hash.t.title).attr("readonly", "readonly").css({"overflow": "hidden", "text-overflow": "ellipsis"});
20807		}
20808		else if(name=='basket_error')
20809		{
20810			$(".basket_error_frame .pop-up-title").text(requestTitle);
20811			$(".basket_error_frame .ajax_text").html(requestData);
20812
20813			if(window.matchMedia('(max-width: 991px)').matches)
20814			{
20815				$("body").addClass("all_viewed");
20816			}
20817
20818			initSelects(document);
20819			if(isButton=="Y" && thButton)
20820				$("<div class='popup_button_basket_wr'><span class='popup_button_basket big_btn button' data-item="+thButton.data("item")+"><span class='btn btn-default'>"+BX.message("ERROR_BASKET_BUTTON")+"</span></span></div>").insertAfter($(".basket_error_frame .ajax_text"));
20821		}
20822
20823		$('.'+name+'_frame').show();
20824	}
20825}
20826
20827if(!funcDefined('onHidejqm')){
20828	var onHidejqm = function(name, hash){
20829		if (hash.w.find('.one_click_buy_result_success').is(':visible') && name=="one_click_buy_basket") {
20830			window.location.href = window.location.href;
20831		}
20832
20833		if($('.xzoom-source').length)
20834			$('.xzoom-source').remove();
20835		if($('.xzoom-preview').length)
20836			$('.xzoom-preview').remove();
20837
20838		// hash.w.css('opacity', 0).hide();
20839		hash.w.animate({'opacity': 0}, 200, function(){
20840			hash.w.removeClass('scroll-init').mCustomScrollbar('destroy');
20841			hash.w.hide();
20842			hash.w.empty();
20843			hash.o.remove();
20844			hash.w.removeClass('show');
20845
20846			$('body').css({'overflow': '','height': ''});
20847
20848			if(!hash.w.closest('#popup_iframe_wrapper').find('.jqmOverlay').length) {
20849				hash.w.closest('#popup_iframe_wrapper').css({'z-index': '', 'display': ''});
20850			}
20851
20852			if(window.matchMedia('(max-width: 991px)').matches)
20853			{
20854				$("body").removeClass("all_viewed");
20855			}
20856			if(!$('.jqmOverlay:not(.mobp)').length || $('.jqmOverlay.waiting').length)
20857			{
20858				$('body').removeClass('jqm-initied');
20859			}
20860
20861			if(window.matchMedia('(min-width: 768px)').matches)
20862			{
20863				$("body").removeClass("swipeignore");
20864			}
20865
20866			if(name == 'fast_view') {
20867				$('.fast_view_popup').remove();
20868
20869				var navButtons = hash.w.closest('#popup_iframe_wrapper').find('.navigation-wrapper-fast-view');
20870				navButtons.remove();
20871			}
20872		});
20873
20874		window.b24form = false;
20875	}
20876}
20877
20878$.fn.jqmEx = function(){
20879	// $(this).each(function(){
20880		var _this = $(this);
20881		var name = _this.data('name');
20882
20883		if(name.length && _this.attr('disabled') != 'disabled'){
20884			var extClass = '',
20885				paramsStr = '',
20886				trigger = '',
20887				arTriggerAttrs = {};
20888
20889			// call counter
20890			if(typeof $.fn.jqmEx.counter === 'undefined'){
20891				$.fn.jqmEx.counter = 0;
20892			}
20893			else{
20894				++$.fn.jqmEx.counter;
20895			}
20896
20897			// trigger attrs and params
20898			$.each(_this.get(0).attributes, function(index, attr){
20899				var attrName = attr.nodeName;
20900				var attrValue = _this.attr(attrName);
20901				if (attrName !== 'onclick') {
20902					trigger += '[' + attrName + '=\"' + attrValue + '\"]';
20903					arTriggerAttrs[attrName] = attrValue;
20904				}
20905				if(/^data\-param\-(.+)$/.test(attrName)){
20906					var key = attrName.match(/^data\-param\-(.+)$/)[1];
20907					paramsStr += key + '=' + attrValue + '&';
20908				}
20909			});
20910			var triggerAttrs = JSON.stringify(arTriggerAttrs);
20911			var encTriggerAttrs = encodeURIComponent(triggerAttrs);
20912
20913			// popup url
20914			var script = arAsproOptions['SITE_DIR'] + 'ajax/form.php';
20915			if(name == 'auth'){
20916				script += '?' + paramsStr + 'auth=Y';
20917			}
20918			else{
20919				script += '?' + paramsStr + 'data-trigger=' + encTriggerAttrs;
20920			}
20921
20922			// ext frame class
20923			if(_this.closest('#fast_view_item').length){
20924				extClass = 'fast_view_popup';
20925			}
20926
20927			// use overlay?
20928			var noOverlay = _this.data('noOverlay') == 'Y';
20929
20930			// unique frame to each trigger
20931			if(noOverlay) {
20932				var frame = $('<div class="' + name + '_frame ' + extClass + ' jqmWindow popup" data-popup="' + $.fn.jqmEx.counter + '" data-trigger="' + encTriggerAttrs + '"></div>').appendTo('body');
20933			}
20934			else{
20935				var frame = $('<div class="' + name + '_frame ' + extClass + ' jqmWindow popup" data-popup="' + $.fn.jqmEx.counter + '" data-trigger="' + encTriggerAttrs + '"></div>').appendTo('#popup_iframe_wrapper');
20936			}
20937
20938			frame.jqm({
20939				ajax: script,
20940				trigger: trigger,
20941				noOverlay: noOverlay,
20942				onLoad: function(hash){
20943					onLoadjqm(name, hash);
20944				},
20945				onHide: function(hash){
20946					onHidejqm(name, hash);
20947				}
20948			});
20949		}
20950	// });
20951}
20952
20953window.addEventListener("keydown", function(e){
20954    if (e.keyCode == 27) {
20955        $('.jqm-init.show').last().jqmHide();
20956
20957        if($('.inline-search-block.show').length) {
20958
20959        	$('.inline-search-block').toggleClass('show');
20960        	$('.jqmOverlay.search').detach();
20961        }
20962
20963        $('.mega_fixed_menu').fadeOut(animationTime);
20964    }
20965});
20966
20967if(!funcDefined("scroll_block")) {
20968	function scroll_block(block, clickedItem){
20969		if(block.length)
20970		{
20971
20972			if(clickedItem !== undefined && clickedItem.length)
20973			{
20974				clickedItem.trigger('click');
20975			}
20976			else
20977			{
20978				$(".prices_tab").addClass("active").siblings().removeClass("active");
20979				if($(".prices_tab .opener").length && !$(".prices_tab .opener .opened").length){
20980					var item = $(".prices_tab .opener").first();
20981					item.find(".opener_icon").addClass("opened");
20982					item.parents("tr").addClass("nb")
20983					item.parents("tr").next(".offer_stores").find(".stores_block_wrap").slideDown(200);
20984				}
20985			}
20986			var topPos = block.offset().top,
20987				headerH = $('header').outerHeight(true,true);
20988
20989			$('html,body').animate({'scrollTop':topPos-88},150);
20990		}
20991	}
20992}
20993
20994if(!funcDefined("jqmEd")) {
20995	var jqmEd = function (name, form_id, open_trigger, requestData, selector, requestTitle, isButton, thButton){
20996		if(typeof(requestData) == "undefined"){
20997			requestData = '';
20998		}
20999		if(typeof(selector) == "undefined"){
21000			selector = false;
21001		}
21002		$('body #popup_iframe_wrapper').find('.'+name+'_frame').remove();
21003		$('body #popup_iframe_wrapper').append('<div class="'+name+'_frame jqmWindow popup"></div>');
21004		if(typeof open_trigger == "undefined" ){
21005			$('.'+name+'_frame').jqm({trigger: '.'+name+'_frame.popup',onHide: function(hash) { onHidejqm(name,hash); }, onLoad: function( hash ){ onLoadjqm( name , hash , requestData, selector); }, ajax: arAsproOptions["SITE_DIR"]+'ajax/form.php?form_id='+form_id+(requestData.length ? '&' + requestData : '')});
21006		}else{
21007			if(name == 'enter'){
21008				$('.'+name+'_frame').jqm({trigger: open_trigger,onHide: function(hash) { onHidejqm(name,hash); },  onLoad: function( hash ){ onLoadjqm( name , hash , requestData, selector); }
21008, ajax: arAsproOptions["SITE_DIR"]+'ajax/auth.php'});
21009			}else if(name=='basket_error'){
21010				$('.'+name+'_frame').jqm({trigger: open_trigger, onHide: function(hash) { onHidejqm(name,hash); }, onLoad: function( hash ){ onLoadjqm( name , hash , requestData, selector, requestTitle, isButton, thButton); }, ajax: arAsproOptions["SITE_DIR"]+'ajax/basket_error.php'});
21011
21012			}else{
21013				$('.'+name+'_frame').jqm({trigger: open_trigger, onHide: function(hash) { onHidejqm(name,hash); }, onLoad: function( hash ){ onLoadjqm( name , hash , requestData, selector); }, ajax: arAsproOptions["SITE_DIR"]+'ajax/form.php?form_id='+form_id+(requestData.length ? '&' + requestData : '')});
21014			}
21015			$(open_trigger).dblclick(function(){return false;})
21016		}
21017		return true;
21018	}
21019}
21020
21021if (!funcDefined("replaceBasketPopup")){
21022	function replaceBasketPopup (hash){
21023		if(typeof hash != "undefined"){
21024			hash.w.hide();
21025			hash.o.hide();
21026		}
21027	}
21028}
21029
21030if(!funcDefined("waitLayer")){
21031	function waitLayer(delay, callback){
21032		if((typeof dataLayer !== 'undefined') && (typeof callback === 'function')){
21033			callback();
21034		}
21035		else{
21036			setTimeout(function() {
21037				waitLayer(delay, callback);
21038			}, delay);
21039		}
21040	}
21041}
21042
21043if(!funcDefined("checkCounters")){
21044	function checkCounters(name){
21045		if(typeof name !== "undefined"){
21046			if(name == "google" && (arAsproOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0)){
21047				return true;
21048			}
21049			else if(name == "yandex" && (arAsproOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["YANDEX_COUNTER"] > 0)){
21050				return true;
21051			}
21052			else{
21053				return false;
21054			}
21055		}
21056		else if((arAsproOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["YANDEX_COUNTER"] > 0) || (arAsproOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" && arAsproOptions["COUNTERS"]["GOOGLE_COUNTER"] > 0)) {
21057			return true;
21058		}
21059		else{
21060			return false;
21061		}
21062	}
21063}
21064
21065if(!funcDefined("addBasketCounter")){
21066	function addBasketCounter(id){
21067		if(arAsproOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N'){
21068			var eventdata = {goal: 'goal_basket_add', params: {id: id}};
21069			BX.onCustomEvent('onCounterGoals', [eventdata]);
21070		}
21071		if(checkCounters()){
21072			$.ajax({
21073				url:arAsproOptions['SITE_DIR'] + "ajax/goals.php",
21074				dataType: "json",
21075				type: "POST",
21076				data: {"ID": id},
21077				success: function(item){
21078					if(!!item && !!item.ID){
21079						waitLayer(100, function() {
21080							dataLayer.push({
21081								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['ADD2BASKET'],
21082							    "ecommerce": {
21083							    	"currencyCode": item.CURRENCY,
21084							        "add": {
21085							            "products": [{
21086						                    "id": item.ID,
21087						                    "name": item.NAME,
21088						                    "price": item.PRICE,
21089						                    "brand": item.BRAND,
21090						                    "category": item.CATEGORY,
21091						                    "quantity": item.QUANTITY
21092						                }]
21093							        }
21094							    }
21095							});
21096						});
21097					}
21098				}
21099			});
21100		}
21101	}
21102}
21103
21104if(!funcDefined("purchaseCounter")){
21105	function purchaseCounter(order_id, type, callback){
21106		if(checkCounters()){
21107			$.ajax({
21108				url:arAsproOptions['SITE_DIR'] + "ajax/goals.php",
21109				dataType: "json",
21110				type: "POST",
21111				data: {"ORDER_ID": order_id, "TYPE": type},
21112				success: function(order){
21113					var products = [];
21114					if(order.ITEMS){
21115						for(var i in order.ITEMS){
21116							products.push({
21117								"id": order.ITEMS[i].ID,
21118								"sku": order.ITEMS[i].ID,
21119			                    "name": order.ITEMS[i].NAME,
21120			                    "price": order.ITEMS[i].PRICE,
21121			                    "brand": order.ITEMS[i].BRAND,
21122			                    "category": order.ITEMS[i].CATEGORY,
21123			                    "quantity": order.ITEMS[i].QUANTITY
21124							});
21125						}
21126					}
21127					if(order.ID){
21128						waitLayer(100, function() {
21129							dataLayer.push({
21130								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['PURCHASE'],
21131							    "ecommerce": d = {
21132							    	"purchase": {
21133								    	"actionField":{
21134								    		"id": order.ACCOUNT_NUMBER,
21135								    		"shipping": order.PRICE_DELIVERY,
21136								    		"tax": order.TAX_VALUE,
21137								    		"list": type,
21138								    		"revenue": order.PRICE
21139								    	},
21140							            "products": products
21141							        }
21142							    }
21143							});
21144
21145							if(typeof callback !== 'undefined'){
21146								callback(d);
21147							}
21148						});
21149					}
21150					else{
21151						if(typeof callback !== 'undefined'){
21152							callback();
21153						}
21154					}
21155				},
21156				error: function(){
21157					if(typeof callback !== 'undefined'){
21158						callback();
21159					}
21160				}
21161			});
21162		}
21163	}
21164}
21165
21166if(!funcDefined("viewItemCounter")){
21167	function viewItemCounter(id, price_id){
21168		if(checkCounters()){
21169			$.ajax({
21170				url:arAsproOptions['SITE_DIR'] + "ajax/goals.php",
21171				dataType: "json",
21172				type: "POST",
21173				data: {"PRODUCT_ID": id, "PRICE_ID": price_id},
21174				success: function(item){
21175					if(item.ID){
21176						waitLayer(100, function() {
21177							dataLayer.push({
21178								//"event": "",
21179								"ecommerce": {
21180									"detail": {
21181										"products": [{
21182											"id": item.ID,
21183											"name": item.NAME,
21184											"price": item.PRICE,
21185											"brand": item.BRAND,
21186											"category": item.CATEGORY
21187										}]
21188									}
21189								}
21190							});
21191						});
21192					}
21193				}
21194			});
21195		}
21196	}
21197}
21198
21199if(!funcDefined("checkoutCounter")){
21200	function checkoutCounter(step, option, callback){
21201		if(checkCounters('google')){
21202			$.ajax({
21203				url:arAsproOptions['SITE_DIR'] + "ajax/goals.php",
21204				dataType: "json",
21205				type: "POST",
21206				data: {"BASKET": "Y"},
21207				success: function(basket){
21208					var products = [];
21209					if(basket.ITEMS){
21210						for(var i in basket.ITEMS){
21211							products.push({
21212								"id": basket.ITEMS[i].ID,
21213			                    "name": basket.ITEMS[i].NAME,
21214			                    "price": basket.ITEMS[i].PRICE,
21215			                    "brand": basket.ITEMS[i].BRAND,
21216			                    "category": basket.ITEMS[i].CATEGORY,
21217			                    "quantity": basket.ITEMS[i].QUANTITY
21218							});
21219						}
21220					}
21221					if(products){
21222						waitLayer(100, function() {
21223							dataLayer.push({
21224								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['CHECKOUT_ORDER'],
21225							    "ecommerce": {
21226							    	'checkout': {
21227								    	"actionField":{
21228								    		"step": step,
21229								    		"option": option
21230								    	},
21231								        "products": products
21232								    }
21233							    },
21234							    /*"eventCallback": function() {
21235							    	if((typeof callback !== 'undefined') && (typeof callback === 'function')){
21236							    		callback();
21237							    	}
21238							   }*/
21239							});
21240						});
21241					}
21242				}
21243			});
21244		}
21245	}
21246}
21247
21248if(!funcDefined("delFromBasketCounter")){
21249	function delFromBasketCounter(id, callback){
21250		if(checkCounters()){
21251			$.ajax({
21252				url:arAsproOptions['SITE_DIR'] + "ajax/goals.php",
21253				dataType: "json",
21254				type: "POST",
21255				data: {"ID": id},
21256				success: function(item){
21257					if(item.ID){
21258						waitLayer(100, function() {
21259							dataLayer.push({
21260								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['REMOVE_BASKET'],
21261							    "ecommerce": {
21262							        "remove": {
21263							            "products": [{
21264						                    "id": item.ID,
21265						                    "name": item.NAME,
21266						                    "category": item.CATEGORY
21267						                }]
21268							        }
21269							    }
21270							});
21271							if(typeof callback == 'function'){
21272								callback();
21273							}
21274						});
21275					}
21276				}
21277			});
21278		}
21279	}
21280}
21281
21282if(!funcDefined("setHeightCompany")){
21283	function setHeightCompany(){
21284		$('.md-50.img').height($('.md-50.big').outerHeight()-35);
21285	}
21286}
21287
21288if(!funcDefined("initSly")){
21289	function initSly(){
21290		/*var $frame  = $(document).find('.frame');
21291		var $slidee = $frame.children('ul').eq(0);
21292		var $wrap   = $frame.parent();
21293
21294		if(arAsproOptions["PAGES"]["CATALOG_PAGE"] && $frame.length){
21295			$frame.sly({
21296				horizontal: 1,
21297				itemNav: 'basic',
21298				smart: 1,
21299				mouseDragging: 0,
21300				touchDragging: 0,
21301				releaseSwing: 0,
21302				startAt: 0,
21303				scrollBar: $wrap.find('.scrollbar'),
21304				scrollBy: 1,
21305				speed: 300,
21306				elasticBounds: 0,
21307				easing: 'swing',
21308				dragHandle: 1,
21309				dynamicHandle: 1,
21310				clickBar: 1,
21311
21312				// Buttons
21313				forward: $wrap.find('.forward'),
21314				backward: $wrap.find('.backward'),
21315			});
21316			$frame.sly('reload');
21317		}*/
21318	}
21319}
21320
21321if(!funcDefined("createTableCompare")){
21322	function createTableCompare(originalTable, appendDiv, cloneTable){
21323
21324		try{
21325			var clone = originalTable.clone().removeAttr('id').addClass('clone');
21326			if(cloneTable.length){
21327				cloneTable.remove();
21328				appendDiv.html('');
21329				appendDiv.html(clone);
21330			}else{
21331				appendDiv.append(clone);
21332			}
21333		}
21334		catch(e){}
21335		finally{
21336
21337		}
21338	}
21339}
21340
21341if(!funcDefined('fillBasketPropsExt')){
21342	fillBasketPropsExt = function(that, prop_code, basket_prop_div){
21343		var
21344			i = 0,
21345			propCollection = null,
21346			foundValues = false,
21347			basketParams = {},
21348			obBasketProps = null;
21349
21350		obBasketProps = BX(basket_prop_div);
21351		if(!obBasketProps && that.closest('.item').find('.basket_props_block').length)
21352			obBasketProps = that.closest('.item').find('.basket_props_block')[0];
21353
21354		if (!!obBasketProps)
21355		{
21356			propCollection = obBasketProps.getElementsByTagName('select');
21357			if (!!propCollection && !!propCollection.length)
21358			{
21359				for (i = 0; i < propCollection.length; i++)
21360				{
21361					if (!propCollection[i].disabled)
21362					{
21363						switch(propCollection[i].type.toLowerCase())
21364						{
21365							case 'select-one':
21366								basketParams[propCollection[i].name] = propCollection[i].value;
21367								foundValues = true;
21368								break;
21369							default:
21370								break;
21371						}
21372					}
21373				}
21374			}
21375			propCollection = obBasketProps.getElementsByTagName('input');
21376			if (!!propCollection && !!propCollection.length)
21377			{
21378				for (i = 0; i < propCollection.length; i++)
21379				{
21380					if (!propCollection[i].disabled)
21381					{
21382						switch(propCollection[i].type.toLowerCase())
21383						{
21384							case 'hidden':
21385								basketParams[propCollection[i].name] = propCollection[i].value;
21386								foundValues = true;
21387								break;
21388							case 'radio':
21389								if (propCollection[i].checked)
21390								{
21391									basketParams[propCollection[i].name] = propCollection[i].value;
21392									foundValues = true;
21393								}
21394								break;
21395							default:
21396								break;
21397						}
21398					}
21399				}
21400			}
21401		}
21402		if (!foundValues)
21403		{
21404			basketParams[prop_code] = [];
21405			basketParams[prop_code][0] = 0;
21406		}
21407		return basketParams;
21408	}
21409}
21410if(!funcDefined('showBasketError')){
21411	showBasketError = function(mess, title, addButton, th, callback){
21412		var title_set=(title ? title : BX.message("ERROR_BASKET_TITLE")),
21413			isButton="N",
21414			thButton="";
21415		if(typeof addButton!==undefined){
21416			isButton="Y";
21417		}
21418		if(typeof th!==undefined){
21419			thButton=th;
21420		}
21421		$("body").append("<span class='add-error-bakset' style='display:none;'></span>");
21422		jqmEd('basket_error', 'error-bakset', '.add-error-bakset', mess, this, title_set, isButton, thButton);
21423		$("body .add-error-bakset").click();
21424		$("body .add-error-bakset").remove();
21425
21426		if(typeof callback === 'function'){
21427			callback();
21428		}
21429	}
21430}
21431
21432CheckTopVisibleMenu = function(that) {
21433	var dropdownMenu = $('.dropdown-menu:visible');
21434	if( that !== undefined ) {
21435		dropdownMenu.push(that);
21436	}
21437
21438	if(dropdownMenu.length){
21439		dropdownMenu.each(function(i, el) {
21440			var dropdownMenuCurrent = $(el);
21441			dropdownMenuCurrent.find('a').css('white-space', '');
21442			dropdownMenuCurrent.css('left', '');
21443			dropdownMenuCurrent.css('right', '');
21444			dropdownMenuCurrent.removeClass('toright');
21445
21446			var dropdownMenuCurrent_left = dropdownMenuCurrent.offset().left;
21447
21448			if(typeof(dropdownMenuCurrent_left) != 'undefined'){
21449				var menu = dropdownMenuCurrent.parents('.mega-menu');
21450				if(!menu.length)
21451					menu = dropdownMenuCurrent.closest('.logo-row');
21452				var menu_width = menu.outerWidth();
21453				var menu_left = menu.offset().left;
21454				var menu_right = menu_left + menu_width;
21455				var isToRight = dropdownMenuCurrent.parents('.toright').length > 0;
21456				var parentsdropdownMenuCurrents = dropdownMenuCurrent.parents('.dropdown-menu');
21457				var isHasParentdropdownMenuCurrent = parentsdropdownMenuCurrents.length > 0;
21458				if(isHasParentdropdownMenuCurrent){
21459					var parentdropdownMenuCurrent_width = parentsdropdownMenuCurrents.first().outerWidth();
21460					var parentdropdownMenuCurrent_left = parentsdropdownMenuCurrents.first().offset().left;
21461					var parentdropdownMenuCurrent_right = parentdropdownMenuCurrent_width + parentdropdownMenuCurrent_left;
21462				}
21463
21464				if(parentdropdownMenuCurrent_right + dropdownMenuCurrent.outerWidth() > menu_right){
21465					dropdownMenuCurrent.find('a').css('white-space', 'normal');
21466				}
21467
21468				var dropdownMenuCurrent_width = dropdownMenuCurrent.outerWidth();
21469				var dropdownMenuCurrent_right = dropdownMenuCurrent_left + dropdownMenuCurrent_width;
21470
21471				if(dropdownMenuCurrent_right > menu_right || isToRight){
21472					var addleft = 0;
21473					addleft = menu_right - dropdownMenuCurrent_right;
21474					if(isHasParentdropdownMenuCurrent || isToRight){
21475						dropdownMenuCurrent.css('left', 'auto');
21476						dropdownMenuCurrent.css('right', '100%');
21477						dropdownMenuCurrent.addClass('toright');
21478					}
21479					else{
21480						var dropdownMenuCurrent_curLeft = parseInt(dropdownMenuCurrent.css('left'));
21481						dropdownMenuCurrent.css('left', (dropdownMenuCurrent_curLeft + addleft) + 'px');
21482					}
21483				}
21484			}
21485		});
21486	}
21487}
21488
21489if(!funcDefined("isRealValue")){
21490	function isRealValue(obj){
21491		return obj && obj !== "null" && obj!== "undefined";
21492	}
21493}
21494
21495if(!funcDefined("rightScroll")){
21496	function rightScroll(prop, id){
21497		var el = BX('prop_' + prop + '_' + id);
21498		if (el) {
21499			var curVal = parseInt(el.style.marginLeft);
21500			if (curVal >= 0) el.style.marginLeft = curVal - 20 + '%';
21501		}
21502	}
21503}
21504
21505if(!funcDefined("leftScroll")){
21506	function leftScroll(prop, id){
21507		var el = BX('prop_' + prop + '_' + id);
21508		if (el) {
21509			var curVal = parseInt(el.style.marginLeft);
21510			if (curVal < 0) el.style.marginLeft = curVal + 20 + '%';
21511		}
21512	}
21513}
21514
21515if(!funcDefined("InitOrderCustom")){
21516	InitOrderCustom = function () {
21517		$('.ps_logo img').wrap('<div class="image"></div>');
21518
21519		$('#bx-soa-order .radio-inline').each(function() {
21520			if ($(this).find('input').attr('checked') == 'checked') {
21521				$(this).addClass('checked');
21522			}
21523		});
21524
21525		$('#bx-soa-order .checkbox input[type=checkbox]').each(function() {
21526			if ($(this).attr('checked') == 'checked')
21527				$(this).parent().addClass('checked');
21528		});
21529
21530		$('#bx-soa-order .bx-authform-starrequired').each(function() {
21531			var html = $(this).html();
21532			$(this).closest('label').append('<span class="bx-authform-starrequired"> '+ html + '</span>');
21533			$(this).detach();
21534		});
21535		$('.bx_ordercart_coupon').each(function() {
21536			if ($(this).find('.bad').length)
21537				$(this).addClass('bad');
21538			else if ($(this).find('.good').length)
21539				$(this).addClass('good');
21540		});
21541		/*if (typeof(propsMap) !== 'undefined') {
21542			$(propsMap).on('click', function () {
21543				var value = $('#orderDescription').val();
21544				if ($('#orderDescription')) {
21545					if (value != '') {
21546						$('#orderDescription').closest('.form-group').addClass('value_y');
21547					}
21548				}
21549			});
21550		}*/
21551	}
21552}
21553
21554if(!funcDefined("InitLabelAnimation")){
21555	InitLabelAnimation = function(className) {
21556		// Fix order labels
21557		if (!$(className).length) {
21558			return;
21559		}
21560		$(className).find('.form-group').each(function() {
21561			if ($(this).find('input[type=text], textarea').length && !$(this).find('.dropdown-block').length && $(this).find('input[type=text], textarea').val() != '') {
21562				$(this).addClass('value_y');
21563			}
21564		});
21565
21566		$(document).on('click', className+' .form-group:not(.bx-soa-pp-field) label', function() {
21567			$(this).parent().find('input, textarea').focus();
21568		});
21569
21570		$(document).on('focusout', className+' .form-group:not(.bx-soa-pp-field) input, '+className+' .form-group:not(.bx-soa-pp-field) textarea', function() {
21571			var value = $(this).val();
21572			if (value != '' && !$(this).closest('.form-group').find('.dropdown-block').length && !$(this).closest('.form-group').find('#profile_change').length) {
21573				$(this).closest('.form-group').addClass('value_y');
21574			}else{
21575				$(this).closest('.form-group').removeClass('value_y');
21576			}
21577		});
21578
21579		$(document).on('focus', className+' .form-group:not(.bx-soa-pp-field) input, '+className+' .form-group:not(.bx-soa-pp-field) textarea', function() {
21580			if (!$(this).closest('.form-group').find('.dropdown-block').length && !$(this).closest('.form-group').find('#profile_change').length && !$(this).closest('.form-group').find('[name=PERSON_TYPE_OLD]').length ) {
21581				$(this).closest('.form-group').addClass('value_y');
21582			}
21583		});
21584	};
21585}
21586
21587checkPopupWidth = function(){
21588	$('.popup.show').each(function() {
21589		var width_form = $(this).actual('width');
21590		$(this).css({
21591			'margin-left': ($(window).width() > width_form ? '-' + width_form / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
21592		});
21593	});
21594}
21595
21596checkCaptchaWidth = function(){
21597	$('.captcha-row').each(function() {
21598		var width = $(this).actual('width');
21599		if($(this).hasClass('b')){
21600			if(width > 320){
21601				$(this).removeClass('b');
21602			}
21603		}
21604		else{
21605			if(width <= 320){
21606				$(this).addClass('b');
21607			}
21608		}
21609	});
21610}
21611
21612checkFormWidth = function(){
21613	$('.form .form_left').each(function() {
21614		var form = $(this).parents('.form');
21615		var width = form.actual('width');
21616		if(form.hasClass('b')){
21617			if(width > 417){
21618				form.removeClass('b');
21619			}
21620		}
21621		else{
21622			if(width <= 417){
21623				form.addClass('b');
21624			}
21625		}
21626	});
21627}
21628
21629checkFormControlWidth = function(){
21630	$('.form-control').each(function() {
21631		var width = $(this).actual('width');
21632		var labelWidth = $(this).find('label:not(.error) > span').actual('width');
21633		var errorWidth = $(this).find('label.error').actual('width');
21634		if(errorWidth > 0){
21635			if($(this).hasClass('h')){
21636				if(width > (labelWidth + errorWidth + 5)){
21637					$(this).removeClass('h');
21638				}
21639			}
21640			else{
21641				if(width <= (labelWidth + errorWidth + 5)){
21642					$(this).addClass('h');
21643				}
21644			}
21645		}
21646		else{
21647			$(this).removeClass('h');
21648		}
21649	});
21650}
21651
21652scrollToTop = function(){
21653	if(arAsproOptions['THEME']['SCROLLTOTOP_TYPE'] !== 'NONE'){
21654		var _isScrolling = false;
21655		// Append Button
21656		$('body').append($('<a />').addClass('scroll-to-top ' + arAsproOptions['THEME']['SCROLLTOTOP_TYPE'] + ' ' + arAsproOptions['THEME']['SCROLLTOTOP_POSITION']).attr({'href': '#', 'id': 'scrollToTop'}));
21657
21658		if(arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM']) {
21659			$('#scrollToTop').css('bottom', +arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM']+'px');
21660		}
21661
21662		if(arAsproOptions['THEME']['SCROLLTOTOP_POSITION_RIGHT']) {
21663			$('#scrollToTop').css('right', +arAsproOptions['THEME']['SCROLLTOTOP_POSITION_RIGHT']+'px');
21664		}
21665
21666		$('#scrollToTop').click(function(e){
21667			e.preventDefault();
21668			$('body, html').animate({scrollTop : 0}, 500);
21669			return false;
21670		});
21671		// Show/Hide Button on Window Scroll event.
21672		$(window).scroll(function(){
21673			if(!_isScrolling) {
21674				_isScrolling = true;
21675				if($(window).scrollTop() > 150){
21676					$('#scrollToTop').stop(true, true).addClass('visible');
21677					_isScrolling = false;
21678				}
21679				else{
21680					$('#scrollToTop').stop(true, true).removeClass('visible');
21681					_isScrolling = false;
21682				}
21683				checkScrollToTop();
21684			}
21685		});
21686	}
21687}
21688
21689checkScrollToTop = function(){
21690	if(arAsproOptions['THEME'] && arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM'])
21691		var bottom = +arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM'];
21692	else
21693		var bottom = 55;
21694
21695	var scrollVal = $(window).scrollTop(),
21696		windowHeight = $(window).height(),
21697		footerOffset = 0;
21698	if($('footer').length)
21699		footerOffset = $('footer .footer-inner').offset().top;
21700
21701	if(arAsproOptions['THEME'] && arAsproOptions['THEME']['SCROLLTOTOP_POSITION'] == 'CONTENT'){
21702		warpperWidth = $('body > .wrapper > .wrapper_inner').width();
21703		$('#scrollToTop').css('margin-left', Math.ceil(warpperWidth / 2) + 23);
21704	}
21705
21706	if(scrollVal + windowHeight > footerOffset){
21707		$('#scrollToTop').css('bottom', Math.round(bottom  + scrollVal + windowHeight - footerOffset) + 'px');
21708	}
21709	else if(parseInt($('#scrollToTop').css('bottom')) > bottom){
21710		$('#scrollToTop').css('bottom', Math.round(bottom));
21711	}
21712}
21713
21714CheckObjectsSizes = function() {
21715	$('.container iframe,.container object,.container video').each(function() {
21716		var height_attr = $(this).attr('height');
21717		var width_attr = $(this).attr('width');
21718		if (height_attr && width_attr) {
21719			$(this).css('height', $(this).outerWidth() * height_attr / width_attr);
21720		}
21721	});
21722}
21723
21724if(!funcDefined('reloadTopBasket')){
21725	var reloadTopBasket = function reloadTopBasket(action, basketWindow, speed, delay, slideDown, item, sync){
21726		var obj={
21727				"PARAMS": $('#top_basket_params').val(),
21728				"ACTION": action
21729			};
21730		if(typeof item !== "undefined" && item){
21731			obj.delete_top_item='Y';
21732			obj.delete_top_item_id=item.data('id');
21733		}
21734		// $.post( arAsproOptions['SITE_DIR']+"ajax/show_basket_popup.php", obj, $.proxy(function( data ){
21735		$.post( arAsproOptions['SITE_DIR']+"ajax/show_basket_actual.php", obj, $.proxy(function( data ){
21736			$(basketWindow).html(data);
21737
21738			//getActualBasket('', '', sync);
21739
21740			getActualBasket('', 'Compare', sync); //need for actual compare count when do opt action
21741
21742			var eventdata = {action:'loadBasket'};
21743			BX.onCustomEvent('onCompleteAction', [eventdata]);
21744
21745
21746			/*if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N'){
21747				if($(window).outerWidth() > 520){
21748					if(slideDown=="Y")
21749						$(basketWindow).find('.basket_popup_wrapp').stop(true,true).slideDown(speed);
21750					clearTimeout(basketTimeoutSlide);
21751					basketTimeoutSlide = setTimeout(function() {
21752						var _this = $('#basket_line').find('.basket_popup_wrapp');
21753						if (_this.is(':hover')) {
21754							_this.show();
21755						}else{
21756							$('#basket_line').find('.basket_popup_wrapp').slideUp(speed);
21757						}
21758					},delay);
21759				}
21760			}*/
21761		}))
21762	}
21763}
21764
21765CheckTabActive = function(){
21766	if(typeof(clicked_tab) && clicked_tab)
21767	{
21768		if(window.matchMedia('(min-width: 768px)').matches)
21769		{
21770			clicked_tab--;
21771			$('.nav.nav-tabs li').each(function(){
21772				if($(this).index() == clicked_tab)
21773					$(this).addClass('active');
21774			})
21775			// $('.nav.nav-tabs li:eq('+clicked_tab+')').addClass('active');
21776			$('.catalog_detail .tab-content .tab-pane:eq('+clicked_tab+')').addClass('active');
21777			$('.catalog_detail .tab-content .tab-pane .title-tab-heading').next().removeAttr('style');
21778			clicked_tab = 0;
21779		}
21780	}
21781}
21782
21783/*countdown start*/
21784if(!funcDefined('initCountdown')){
21785	var initCountdown = function initCountdown(){
21786		if( $('.view_sale_block').length ){
21787			$('.view_sale_block').each(function(){
21788				var _this = $(this);
21789				if(_this.hasClass('init-if-visible') && !_this.is(':visible'))
21790					return;
21791
21792				var activeTo=_this.find('.active_to').text(),
21793					dateTo= new Date(activeTo.replace(/(\d+)\.(\d+)\.(\d+)/, '$3/$2/$1'));
21794				if(_this.hasClass('compact'))
21795					_this.find('.countdown').countdown({until: dateTo, format: 'dHMS',compact: true, padZeroes: true, layout: '{d<}<span class="days item">{dn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hn}<div class="text">{hl}</div></span> <span class="minutes item">{mn}<div class="text">{ml}</div></span> <span class="sec item">{sn}<div class="text">{sl}</div></span>'}, $.countdown.regionalOptions['ru']);
21796				else
21797					_this.find('.countdown').countdown({until: dateTo, format: 'dHMS', padZeroes: true, layout: '{d<}<span class="days item">{dnn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hnn}<div class="text">{hl}</div></span> <span class="minutes item">{mnn}<div class="text">{ml}</div></span> <span class="sec item">{snn}<div class="text">{sl}</div></span>'}, $.countdown.regionalOptions['ru']);
21798			})
21799		}
21800	}
21801}
21802
21803if(!funcDefined('initCountdownTime')){
21804	var initCountdownTime = function initCountdownTime(block, time){
21805		if(time)
21806		{
21807			var dateTo= new Date(time.replace(/(\d+)\.(\d+)\.(\d+)/, '$3/$2/$1'));
21808			block.find('.countdown').countdown('destroy');
21809			if(block.hasClass('compact'))
21810				block.find('.countdown').countdown({until: dateTo, format: 'dHM',compact: true, padZeroes: true, layout: '{d<}<span class="days item">{dn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hn}<div class="text">{hl}</div></span> <span class="minutes item">{mn}<div class="text">{ml}</div></span> <span class="sec item">{sn}<div class="text">{sl}</div></span>'}, $.countdown.regionalOptions['ru']);
21811			else
21812				block.find('.countdown').countdown({until: dateTo, format: 'dHMS', padZeroes: true, layout: '{d<}<span class="days item">{dnn}<div class="text">{dl}</div></span>{d>} <span class="hours item">{hnn}<div class="text">{hl}</div></span> <span class="minutes item">{mnn}<div class="text">{ml}</div></span> <span class="sec item">{snn}<div class="text">{sl}</div></span>'}, $.countdown.regionalOptions['ru']);
21813			block.find('.view_sale_block').show();
21814		}
21815		else
21816		{
21817			block.find('.view_sale_block').hide();
21818		}
21819	}
21820}
21821/*countdown end*/
21822
21823waitCounter = function(idCounter, delay, callback){
21824	var obCounter = window['yaCounter' + idCounter];
21825	if(typeof obCounter == 'object')
21826	{
21827		if(typeof callback == 'function')
21828			callback();
21829
21830	}
21831	else
21832	{
21833		setTimeout(function(){
21834			waitCounter(idCounter, delay, callback);
21835		}, delay);
21836	}
21837}
21838
21839var isOnceInited = insertFilter = false;
21840var animationTime = 200;
21841var delayTime = 200;
21842var topMenuEnterTimer = false;
21843var previewMode = (window!=window.top)
21844var isMobile = ((jQuery.browser.mobile || previewMode) && window.matchMedia('(max-width:767px)').matches) || window.matchMedia('(max-width:400px)').matches;
21845
21846if(isMobile)
21847	document.documentElement.className += ' mobile';
21848if(previewMode)
21849	document.documentElement.className += ' previewMode';
21850
21851if(navigator.userAgent.indexOf("Edge") != -1)
21852	document.documentElement.className += ' bx-ie-edge';
21853
21854/*filter start*/
21855if(!funcDefined('checkVerticalMobileFilter')){
21856	var checkVerticalMobileFilter = function checkVerticalMobileFilter(){
21857		/*if($('.right_block1.catalog.vertical').length && !$('.left_block.filter_ajax').length)
21858		{
21859			if(typeof window['trackBarOptions'] !== 'undefined')
21860			{
21861				window['trackBarValues'] = {}
21862				for(key in window['trackBarOptions'])
21863				{
21864					window['trackBarValues'][key] = {
21865						'leftPercent': window['trackBar' + key].leftPercent,
21866						'leftValue': window['trackBar' + key].minInput.value,
21867						'rightPercent': window['trackBar' + key].rightPercent,
21868						'rightValue': window['trackBar' + key].maxInput.value,
21869					}
21870				}
21871			}
21872
21873			if(window.matchMedia('(max-width: 991px)').matches)
21874			{
21875				if(!insertFilter)
21876				{
21877					$('.js_filter .bx_filter.bx_filter_vertical').html($('.left_block .bx_filter.bx_filter_vertical').html());
21878					$('.left_block .bx_filter.bx_filter_vertical .bx_filter_section').remove();
21879					insertFilter=true;
21880				}
21881			}
21882			else
21883			{
21884				if(insertFilter)
21885				{
21886					$('.left_block .bx_filter.bx_filter_vertical').html($('.js_filter .bx_filter.bx_filter_vertical').html());
21887					$('.js_filter .bx_filter.bx_filter_vertical .bx_filter_section').remove();
21888					insertFilter=false;
21889				}
21890			}
21891
21892			if(typeof window['trackBarOptions'] !== 'undefined')
21893			{
21894				for(key in window['trackBarOptions'])
21895				{
21896					window['trackBarOptions'][key].leftPercent = window['trackBarValues'][key].leftPercent;
21897					window['trackBarOptions'][key].rightPercent = window['trackBarValues'][key].rightPercent;
21898					window['trackBarOptions'][key].curMinPrice = window['trackBarValues'][key].leftValue;
21899					window['trackBarOptions'][key].curMaxPrice = window['trackBarValues'][key].rightValue;
21900					window['trackBar' + key] = new BX.Iblock.SmartFilter(window['trackBarOptions'][key]);
21901					window['trackBar' + key].minInput.value = window['trackBarValues'][key].leftValue;
21902					window['trackBar' + key].maxInput.value = window['trackBarValues'][key].rightValue;
21903				}
21904			}
21905		}
21906		else if($('.visible_mobile_filter').length)
21907		{
21908			var posTopBlock = BX.pos($('.detail.partners')[0]),
21909				posBlock = $('.ajax_load').position();
21910			// $('.visible_mobile_filter').css('top', posBottomBlock.top-posTopBlock.top);
21911			$('.visible_mobile_filter').css('top', posBlock.top);
21912
21913		}*/
21914	}
21915}
21916/*filter end*/
21917
21918// ONE CLICK
21919if(!funcDefined("oneClickBuy")) {
21920	var oneClickBuy = function (elementID, iblockID, that) {
21921		var name = 'one_click_buy';
21922		var elementQuantity = 1;
21923		var offerProps = false;
21924		var buy_btn=$(that).closest('.buy_block').find('.to-cart');
21925		var buy_btn2=$(that).closest('tr').find('.to-cart');
21926
21927		if(typeof(that) !== 'undefined'){
21928			elementQuantity = $(that).attr('data-quantity');
21929			offerProps = $(that).attr('data-props');
21930		}
21931
21932		if(elementQuantity < 0){
21933			elementQuantity = 1;
21934		}
21935
21936		var tmp_props=buy_btn.data("props"),
21937			tmp_props2=buy_btn2.data("props"),
21938			props='',
21939			part_props='',
21940			add_props='N',
21941			fill_prop={},
21942			iblockid = buy_btn.data('iblockid'),
21943			item = buy_btn.attr('data-item');
21944
21945		if(tmp_props){
21946			props=tmp_props.split(";");
21947		}else if(tmp_props2){
21948			props=tmp_props2.split(";");
21949		}
21950		if(buy_btn.data("part_props")){
21951			part_props=buy_btn.data("part_props");
21952		}
21953		if(buy_btn.data("add_props")){
21954			add_props=buy_btn.data("add_props");
21955		}
21956
21957		fill_prop=fillBasketPropsExt(buy_btn, 'prop', buy_btn.data('bakset_div'));
21958		fill_prop.iblockID=iblockid;
21959		fill_prop.part_props=part_props;
21960		fill_prop.add_props=add_props;
21961		fill_prop.props=JSON.stringify(props);
21962		fill_prop.item=item;
21963		fill_prop.ocb_item="Y";
21964
21965		if(!isMobile)
21966		{
21967			if(!$(that).hasClass('clicked'))
21968			{
21969				$(that).addClass('clicked');
21970				$('body').find('.'+name+'_frame').remove();
21971				$('body').find('.'+name+'_trigger').remove();
21972				$('body #popup_iframe_wrapper').append('<div class="'+name+'_frame popup"></div>');
21973				$('body #popup_iframe_wrapper').append('<div class="'+name+'_trigger"></div>');
21974				$('.'+name+'_frame').jqm({trigger: '.'+name+'_trigger', onHide: function(hash) { onHidejqm(name,hash); }, toTop: false, onLoad: function( hash ){ onLoadjqm(name, hash ); }
21974, ajax: arAsproOptions["SITE_DIR"]+'ajax/one_click_buy.php?ELEMENT_ID='+elementID+'&IBLOCK_ID='+iblockID+'&ELEMENT_QUANTITY='+elementQuantity+'&OFFER_PROPS='+fill_prop.props});
21975				$('.'+name+'_trigger').click();
21976			}
21977		}
21978		else
21979		{
21980			var script = arAsproOptions['SITE_DIR'] + 'form/';
21981			script += '?name='+name+'&form_id=ocb&path='+window.location.pathname+'&ELEMENT_ID='+elementID+'&IBLOCK_ID='+iblockID+'&ELEMENT_QUANTITY='+elementQuantity+'&OFFER_PROPS='+fill_prop.props
21982			location.href = script;
21983		}
21984	}
21985}
21986
21987if(!funcDefined("oneClickBuyBasket")) {
21988	var oneClickBuyBasket = function () {
21989		name = 'one_click_buy_basket';
21990		if(!isMobile)
21991		{
21992			if(!$('.fast_order').hasClass('clicked'))
21993			{
21994				$('.fast_order').addClass('clicked');
21995				$('body').find('.'+name+'_frame').remove();
21996				$('body').find('.'+name+'_trigger').remove();
21997				$('body #popup_iframe_wrapper').append('<div class="'+name+'_frame popup"></div>');
21998				$('body #popup_iframe_wrapper').append('<div class="'+name+'_trigger"></div>');
21999				$('.'+name+'_frame').jqm({trigger: '.'+name+'_trigger', onHide: function(hash) { onHidejqm(name,hash) }, onLoad: function( hash ){ onLoadjqm( name, hash ); }, ajax: arAsproOptions["SITE_DIR"]+'ajax/one_click_buy_basket.php'});
22000				$('.'+name+'_trigger').click();
22001			}
22002		}
22003		else
22004		{
22005			var script = arAsproOptions['SITE_DIR'] + 'form/';
22006			script += '?name='+name+'&form_id=ocb&path='+window.location.pathname+'&buy_basket=y';
22007			location.href = script;
22008		}
22009	}
22010}
22011
22012// TOP MENU ANIMATION
22013$(document).on('click', '.menu_top_block>li .more a', function(){
22014	$this = $(this);
22015	$this.parents('.dropdown').first().find('>.hidden').removeClass('hidden');
22016	$this.parent().addClass('hidden');
22017	setTimeout(function(){
22018		$this.parent().remove();
22019	}, 500);
22020});
22021
22022$(document).on('mouseenter', '.menu_top_block.catalogfirst>li>.dropdown>li.full', function(){
22023	var $submenu = $(this).find('>.dropdown');
22024
22025	if($submenu.length){
22026		if(topMenuEnterTimer){
22027			clearTimeout(topMenuEnterTimer);
22028			topMenuEnterTimer = false;
22029		}
22030	}
22031});
22032
22033$(document).on('mouseenter', '.menu_top_block>li:not(.full)', function(){
22034	var $submenu = $(this).find('>.dropdown');
22035
22036	if($submenu.length && !$submenu.hasClass('visible')){
22037		var $menu = $(this).parents('.menu');
22038		var $wrapmenu = $menu.parents('.wrap_menu');
22039		var wrapMenuWidth = $wrapmenu.actual('outerWidth');
22040		var wrapMenuLeft = $wrapmenu.offset().left;
22041		var wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
22042		var left = wrapMenuRight - ($(this).offset().left + $submenu.actual('outerWidth'));
22043		if(window.matchMedia('(min-width: 951px)').matches && $(this).hasClass('catalog') && ( $('.banner_auto').hasClass('catalog_page') || $('.banner_auto').hasClass('front_page'))){
22044			return;
22045		}
22046		if(left < 0){
22047			$submenu.css({left: left + 'px'});
22048		}
22049		$submenu.stop().slideDown(animationTime, function(){
22050			$submenu.css({height: '', 'overflow':'visible'});
22051		});
22052
22053
22054		$(this).on('mouseleave', function(){
22055			var leaveTimer = setTimeout(function(){
22056				$submenu.stop().slideUp(animationTime, function(){
22057					$submenu.css({left: ''});
22058				});
22059			}, delayTime);
22060
22061			$(this).on('mouseenter', function(){
22062				if(leaveTimer){
22063					clearTimeout(leaveTimer);
22064					leaveTimer = false;
22065				}
22066			});
22067		});
22068	}
22069});
22070
22071$(document).on('mouseenter', '.menu_top_block>li .dropdown>li', function(){
22072	var $this = $(this);
22073	var $submenu = $this.find('>.dropdown');
22074
22075	if($submenu.length && ((!$this.parents('.full').length && !$this.hasClass('full')) || $this.parents('.more').length)){
22076		var $menu = $this.parents('.menu');
22077		var $wrapmenu = $menu.parents('.wrap_menu');
22078		var arParentSubmenuForOpacity = [];
22079		topMenuEnterTimer = setTimeout(function(){
22080
22081			var wrapMenuWidth = $wrapmenu.actual('outerWidth');
22082			var wrapMenuLeft = $wrapmenu.offset().left;
22083			var wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
22084			var $parentSubmenu = $this.parent();
22085			var bToLeft = $parentSubmenu.hasClass('toleft') ? true : false;
22086			if(!bToLeft){
22087				bToLeft = $this.offset().left + $this.actual('outerWidth') + $submenu.actual('outerWidth') > wrapMenuRight;
22088			}
22089			else{
22090				bToLeft = $this.offset().left + $this.actual('outerWidth') - $submenu.actual('outerWidth') < wrapMenuLeft;
22091			}
22092
22093			if(bToLeft){
22094				$this.find('>.dropdown').addClass('toleft').show();
22095			}
22096			else{
22097				$this.find('>.dropdown').removeClass('toleft').show();
22098			}
22099			var submenuLeft = $submenu.offset().left;
22100			var submenuRight = submenuLeft + $submenu.actual('outerWidth');
22101
22102			$this.parents('.dropdown').each(function(){
22103				var $this = $(this);
22104				var leftOffset = $this.offset().left;
22105				var rightOffset = leftOffset + $this.actual('outerWidth');
22106				if(leftOffset >= submenuLeft  && leftOffset < (submenuRight - 1) || (rightOffset > (submenuLeft + 1) && rightOffset <= submenuRight)){
22107					arParentSubmenuForOpacity.push($this);
22108					$this.find('>li>a').css({opacity: '0.1'});
22109				}
22110			});
22111		}, delayTime);
22112
22113		$this.unbind('mouseleave');
22114		$this.on('mouseleave', function(){
22115			var leaveTimer = setTimeout(function(){
22116				$this.find('.dropdown').removeClass('toleft').hide();
22117				if(arParentSubmenuForOpacity.length){
22118					for(i in arParentSubmenuForOpacity){
22119						arParentSubmenuForOpacity[i].find('>li>a').css({opacity: ''});
22120					}
22121				}
22122			}, delayTime);
22123
22124			$this.unbind('mouseenter');
22125			$this.on('mouseenter', function(){
22126				if(leaveTimer){
22127					clearTimeout(leaveTimer);
22128					leaveTimer = false;
22129				}
22130			});
22131		});
22132	}
22133});
22134
22135/*hover animate*/
22136	//breadcrumbs
22137	$(document).on('mouseenter', '.breadcrumbs .breadcrumbs__item, .hover-block .hover-block__item', function () {
22138		var _this = $(this),
22139			menu = _this.find('> .breadcrumbs__dropdown-wrapper, > .hover-block__item-wrapper');
22140
22141		menu.velocity('stop').velocity('transition.slideUpIn', {
22142			duration: 300,
22143			delay: 100
22144		});
22145
22146		_this.one('mouseleave', function () {
22147
22148			menu.velocity('stop').velocity('fadeOut', {
22149				duration: 100,
22150				// delay: 0
22151			});
22152		});
22153	});
22154
22155	//top menu
22156	$(document).on('mouseenter', '.menu .mega-menu table td, .menu-row .mega-menu table td', function(){
22157
22158		var _this = $(this),
22159			menu = _this.find('> .wrap > .dropdown-menu');
22160
22161		if(!_this.hasClass('wide_menu'))
22162		{
22163			menu.show();
22164			CheckTopVisibleMenu();
22165		}
22166
22167		var bDarkness = $('.wrapper1.dark-hover-overlay').length > 0;
22168
22169		menu.velocity('stop');
22170
22171		if(menu.css('opacity') != 0)
22172		{
22173			menu.css('opacity' , '1');
22174			if(bDarkness) {
22175				$('.shadow-block').css('opacity' , '1');
22176			}
22177		}
22178		else
22179		{
22180			// menu.velocity('stop').velocity('transition.perspectiveDownIn', {
22181			// menu.velocity('stop').velocity('transition.slideUpBigIn', {
22182			// menu.velocity('transition.expandIn', {
22183			menu.velocity('fadeIn', {
22184				begin: function(elements) {
22185					CheckTopVisibleMenu();
22186				},
22187				duration: 150,
22188				delay: 250,
22189				complete: function(){
22190					if(bDarkness) {
22191						$('body').addClass('menu-hovered');
22192						if(!$('.shadow-block').length)
22193							$('<div class="shadow-block"></div>').appendTo($('body'));
22194						$('.shadow-block').velocity('stop').velocity('fadeIn', 200);
22195					}
22196
22197					var bannerMenu = $('.dropdown-menu.with_right_block .owl-carousel-hover');
22198					if(bannerMenu.length) {
22199						bannerMenu.removeClass('owl-carousel-hover').addClass('owl-carousel');
22200						setTimeout(function() {
22201							InitOwlSlider();
22202							bannerMenu.removeClass('loader_circle');
22203						}, 1);
22204					}
22205				}
22206			});
22207		}
22208
22209		_this.one('mouseleave', function(){
22210			menu.velocity('stop').velocity('fadeOut', {
22211				duration: 50,
22212				delay: 300,
22213				complete: function(){
22214					if(bDarkness) {
22215						$('.shadow-block').velocity('stop').velocity('fadeOut', {
22216							duration: 200,
22217							// delay: 100,
22218							complete: function(){
22219								$('body').removeClass('menu-hovered');
22220							}
22221						});
22222					}
22223				}
22224			});
22225		});
22226	});
22227/**/
22228
22229$(document).on('mouseenter', '.menu-item:not(.wide_menu) .dropdown-menu .dropdown-submenu', function(){
22230	var _this = $(this),
22231		menu = _this.find('> .dropdown-menu');
22232
22233	menu.velocity('stop');
22234
22235	if(menu.css('opacity') != 0)
22236	{
22237		menu.css('opacity' , '1');
22238	}
22239	else
22240	{
22241		menu.velocity('transition.fadeIn', {
22242			begin: function(element) {
22243				$(element).css('display', 'block');
22244				CheckTopVisibleMenu();
22245			},
22246			duration: 300,
22247			delay: 250
22248		});
22249	}
22250
22251	_this.one('mouseleave', function(){
22252		menu.velocity('stop').velocity('fadeOut', {
22253			duration: 150,
22254			delay: 300
22255		});
22256	});
22257})
22258
22259/*register custom velocity animate*/
22260if(typeof $.Velocity !== undefined && ('RegisterEffect' in $.Velocity))
22261{
22262	var effects = {
22263		"transition.slideDownFullIn": {
22264			defaultDuration: 900,
22265			calls: [[{ opacity: [1, 0], translateY: [0, '-100%'], translateZ: 0}]]
22266		},
22267		"transition.slideDownFullOut": {
22268			defaultDuration: 900,
22269			calls: [[{ opacity: [0.4, 1], translateY: ['-100%', 0], translateZ: 0 }]]
22270		}
22271	};
22272
22273	for(var effectName in effects)
22274	{
22275		if(effects.hasOwnProperty(effectName))
22276		{
22277			$.Velocity.RegisterEffect(effectName, effects[effectName]);
22278		}
22279	}
22280}
22281/**/
22282
22283getGridSize = function(counts,slider) {
22284	var counts_item=1;
22285		//wide
22286		if(window.matchMedia('(min-width: 1200px)').matches){
22287			counts_item=counts[0];
22288			if(typeof(slider.data('lg_count')) !== 'undefined' && slider.data('lg_count') && $('.front.wide_page').length)
22289				counts_item=slider.data('lg_count');
22290		}
22291
22292		//large
22293		if(window.matchMedia('(max-width: 1200px)').matches){
22294			counts_item=counts[1];
22295		}
22296
22297		//middle
22298		if(window.matchMedia('(max-width: 992px)').matches){
22299			counts_item=counts[2];
22300		}
22301
22302		//small
22303		if(counts[3]){
22304			if(window.matchMedia('(max-width: 600px)').matches){
22305				counts_item=counts[3];
22306			}
22307		}
22308
22309		//exsmall
22310		if(counts[4]){
22311			if(window.matchMedia('(max-width: 400px)').matches){
22312				counts_item=counts[4];
22313			}
22314		}
22315	return counts_item;
22316}
22317
22318CheckFlexSlider = function(){
22319	$('.flexslider:not(.thmb)').each(function(){
22320		var slider = $(this);
22321		if(typeof(slider.data('flexslider')) != 'undefined')
22322		{
22323			if('vars' in slider.data('flexslider'))
22324			{
22325				slider.resize();
22326
22327				var counts = slider.data('flexslider').vars.counts;
22328				if(typeof(counts) != 'undefined' && slider.is(':visible')){
22329					var cnt = getGridSize(counts,slider);
22330					var to0 = (cnt != slider.data('flexslider').vars.minItems || cnt != slider.data('flexslider').vars.maxItems || cnt != slider.data('flexslider').vars.move);
22331					if(to0){
22332						slider.data('flexslider').vars.minItems = cnt;
22333						slider.data('flexslider').vars.maxItems = cnt;
22334						slider.data('flexslider').vars.move = cnt;
22335						slider.flexslider(0);
22336						slider.resize();
22337						slider.resize(); // twise!
22338					}
22339				}
22340			}
22341		}
22342	});
22343}
22344
22345$.fn.mCustomScrollbarDeferred = function(config){
22346	$(this).addClass('scroll-init');
22347
22348	if ($(this).hasClass('destroyed')) {
22349		return;
22350	}
22351
22352	
22353	$(this).hover(
22354		function(e){
22355			var $this = $(this);
22356			if(!$this.hasClass('mCustomScrollbar') && !$(this).hasClass('destroyed') && !$(this).hasClass('mobile-scroll')){
22357				$this.data('scrollTimer', setTimeout(function(){
22358					$this.mCustomScrollbar(config);
22359					$this.off('touchstart touchmove touchend mousewheel mouseenter mouseleave');
22360				}, 200));
22361			}
22362		},
22363		function(e){
22364			clearTimeout($(this).data('scrollTimer'));
22365		}
22366	);
22367
22368	$(this).on('touchstart touchmove', function(e){
22369		var $this = $(this);
22370		if(!$this.hasClass('mCustomScrollbar') && !$(this).hasClass('destroyed') && !$(this).hasClass('mobile-scroll')){
22371			$this.mCustomScrollbar(config);
22372		}
22373
22374		var $scrollContainer = $this.find('>.mCustomScrollBox>.mCSB_container');
22375		if($scrollContainer.length){
22376			var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
22377
22378			var newTouch = new Touch({
22379			    identifier: 42,
22380			    target: $scrollContainer[0],
22381			    clientX: touch.clientX,
22382			    clientY: touch.clientY,
22383			    screenX: touch.screenX,
22384			    screenY: touch.screenY,
22385			    pageX: touch.pageX,
22386			    pageY: touch.pageY,
22387			    radiusX: 1,
22388			    radiusY: 1
22389			});
22390
22391			var newEvent = new TouchEvent(e.type, {
22392			    cancelable: true,
22393			    bubbles: false,
22394			    composed: true,
22395			    touches: [newTouch],
22396			    targetTouches: [newTouch],
22397			    changedTouches: [newTouch]
22398			});
22399
22400			$scrollContainer[0].dispatchEvent(newEvent);
22401		}
22402	});
22403
22404	$(this).on('touchend', function(e){
22405		$(this).off('touchstart touchmove touchend mousewheel mouseenter mouseleave');
22406	});
22407
22408	if($.event.special.mousewheel){
22409		$(this).on('mousewheel', function(e){
22410			var $this = $(this);
22411			if(!$this.hasClass('mCustomScrollbar') && !$(this).hasClass('destroyed') && !$(this).hasClass('mobile-scroll')){
22412				$this.mCustomScrollbar(config);
22413				$this.off('touchstart touchmove touchend mousewheel mouseenter mouseleave');
22414			}
22415		});
22416	}
22417}
22418
22419InitScrollBar= function(el, initOptions) {
22420	var block;
22421	if(typeof el === 'undefined'){
22422		block = $('.srollbar-custom:not(.mobile-scroll):not(.scroll-init)');
22423	}
22424	else{
22425		block = el.filter(':not(.scroll-init)');
22426	}
22427
22428	if(block.length){
22429		block.addClass('scroll-init');
22430
22431		var options,
22432			defaults = {
22433				mouseWheel: {
22434					scrollAmount: 150,
22435					preventDefault: true
22436				}
22437			};
22438		var config = $.extend({}, defaults, options, block.data('plugin-options'), initOptions);
22439
22440		config.callbacks = {
22441			onScroll:function(){
22442				if($(this).find('.mCSB_buttonLeft').hasClass('disabled'))
22443					$(this).find('.mCSB_buttonLeft').removeClass('disabled');
22444				if($(this).find('.mCSB_buttonRight').hasClass('disabled'))
22445					$(this).find('.mCSB_buttonRight').removeClass('disabled');
22446			},
22447			onTotalScrollBack:function(){
22448				$(this).find('.mCSB_buttonLeft').addClass('disabled');
22449			},
22450			onTotalScroll:function(){
22451				$(this).find('.mCSB_buttonRight').addClass('disabled');
22452			},
22453			onInit:function(){
22454				$(this).find('.mCSB_buttonLeft').addClass('disabled');
22455			}
22456		};
22457
22458		block.filter(':not(.scroll-deferred)').mCustomScrollbar(config);
22459		block.filter('.scroll-deferred').mCustomScrollbarDeferred(config);
22460	}
22461}
22462
22463InitCustomScrollBar = function(el) {
22464	var block;
22465	if(typeof el === 'undefined'){
22466		block = $('.scrollbar:not(.mobile-scroll):not(.scroll-init)');
22467	}
22468	else{
22469		block = el.filter(':not(.scroll-init)');
22470	}
22471
22472	if(block.length){
22473		block.addClass('scroll-init');
22474
22475		var options,
22476			defaults = {
22477				effect : 'fadeIn',
22478				effectTime : 300,
22479				threshold: 0
22480				// threshold: 30
22481			};
22482
22483		var config = $.extend({}, defaults, options, block.data('plugin-options'));
22484
22485		block.filter(':not(.scroll-deferred)').mCustomScrollbar(config);
22486		block.filter('.scroll-deferred').mCustomScrollbarDeferred(config);
22487	}
22488}
22489
22490InitFancyBox = function() {
22491	$('.fancy').fancybox({
22492		padding: [40,40,64,40],
22493		openEffect  : 'fade',
22494		closeEffect : 'fade',
22495		nextEffect : 'fade',
22496		prevEffect : 'fade',
22497		opacity: true,
22498		tpl:{
22499			closeBtn: '<span title="'+BX.message('FANCY_CLOSE')+'" class="fancybox-item fancybox-close inline svg"><svg class="svg svg-close" width="14" height="14" viewBox="0 0 14 14"><path data-name="Rounded Rectangle 568 copy 16" d="M1009.4,953l5.32,5.315a0.987,0.987,0,0,1,0,1.4,1,1,0,0,1-1.41,0L1008,954.4l-5.32,5.315a0.991,0.991,0,0,1-1.4-1.4L1006.6,953l-5.32-5.315a0.991,0.991,0,0,1,1.4-1.4l5.32,5.315,5.31-5.315a1,1,0,0,1,1.41,0,0.987,0.987,0,0,1,0,1.4Z" transform="translate(-1001 -946)"></path></svg></span>',
22500			next     : '<a title="'+BX.message('FANCY_NEXT')+'" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
22501			prev     : '<a title="'+BX.message('FANCY_PREV')+'" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
22502		},
22503		touch: 'enabled',
22504		buttons: [
22505			// "zoom",
22506			//"share",
22507			// "slideShow",
22508			//"fullScreen",
22509			//"download",
22510			// "thumbs",
22511			"close"
22512		],
22513		backFocus: false,
22514		beforeShow: function(event){
22515			if(!$('.cd-modal-bg').hasClass('is-visible')){
22516				var scaleValue = retrieveScale($('.cd-modal-bg'));
22517
22518				$('.cd-modal-bg').show().addClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
22519					animateLayer($('.cd-modal-bg'), scaleValue, true);
22520				});
22521			}
22522			var video_block = $('.company-block source.video-block');
22523			if(video_block.length)
22524			{
22525				if(video_block.attr('src') == '#') {
22526					var video_block_wrapper = video_block.closest('video');
22527					var video_block_clone = video_block_wrapper.clone();
22528
22529					video_block_clone.find('source').attr('src', video_block_clone.find('source').data('src'));
22530					video_block.attr('src', video_block.data('src'));
22531					video_block_clone.insertAfter(video_block_wrapper);
22532					video_block_clone.siblings('video').remove();
22533				}
22534			}
22535			var video_block_frame = $('.company-block #company_video_iframe');
22536			if(video_block_frame.length)
22537			{
22538				var data_src_iframe = video_block_frame.attr("data-src");
22539				video_block_frame.attr("src", data_src_iframe);
22540				video_block_frame.attr("allow", 'autoplay');
22541			}
22542			// $('.detail .galery .overlay_form').hide();
22543		},
22544		afterShow: function(){
22545			if($('.fancybox-overlay').css('opacity') == 0){
22546				setTimeout(function(){
22547					$('.fancybox-overlay').css('opacity', 1);
22548					$('html').addClass('overflow_html');
22549				}, 200);
22550			}
22551
22552			$('.fancybox-nav').css('opacity', 0);
22553			setTimeout(function(){
22554				$('.fancybox-nav').css('opacity', 1);
22555			}, 150);
22556			if($('.fancybox-inner #company_video').length)
22557			{
22558				// var fancyHeight = $('.fancybox-wrap').height();
22559				// $('.fancybox-inner').height(fancyHeight);
22560				setTimeout(function(){
22561					$('.fancybox-wrap video').resize();
22562					setTimeout(function(){
22563						$('.fancybox-wrap').addClass('show_video');
22564						document.getElementById('company_video').currentTime = 0;
22565						document.getElementById('company_video').play();
22566					}, 300);
22567				}, 150);
22568			}
22569			else if($('.fancybox-wrap iframe').length)
22570			{
22571				$('.fancybox-inner').height('100%');
22572			}
22573		},
22574		beforeClose: function(){
22575			closeModal();
22576			$('.fancybox-overlay').fadeOut();
22577			if($('#company_video').length){
22578				document.getElementById('company_video').currentTime = 0;
22579			}
22580			$('html').removeClass('overflow_html');
22581			var video_block_frame = $('.company-block .video-block');
22582			if(video_block_frame.length)
22583			{
22584				$("#company_video_iframe").attr("src", '');
22585
22586			}
22587		},
22588		onClosed: function(){
22589			if($('.fancybox-wrap #company_video').length){
22590				document.getElementById('company_video').pause();
22591			}
22592		},
22593	});
22594}
22595
22596InitFancyBoxVideo = function() {
22597	$(".video_link").fancybox({
22598		type: "iframe",
22599        maxWidth    : 800,
22600        maxHeight   : 600,
22601        fitToView   : false,
22602        width       : '70%',
22603        height      : '70%',
22604        autoSize    : false,
22605        closeClick  : false,
22606        opacity: true,
22607		tpl:{
22608			closeBtn: '<span title="'+BX.message('FANCY_CLOSE')+'" class="fancybox-item fancybox-close inline svg"><svg class="svg svg-close" width="14" height="14" viewBox="0 0 14 14"><path data-name="Rounded Rectangle 568 copy 16" d="M1009.4,953l5.32,5.315a0.987,0.987,0,0,1,0,1.4,1,1,0,0,1-1.41,0L1008,954.4l-5.32,5.315a0.991,0.991,0,0,1-1.4-1.4L1006.6,953l-5.32-5.315a0.991,0.991,0,0,1,1.4-1.4l5.32,5.315,5.31-5.315a1,1,0,0,1,1.41,0,0.987,0.987,0,0,1,0,1.4Z" transform="translate(-1001 -946)"></path></svg></span>',
22609			next     : '<a title="'+BX.message('FANCY_NEXT')+'" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
22610			prev     : '<a title="'+BX.message('FANCY_PREV')+'" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
22611		},
22612        beforeShow: function(event){
22613			if(!$('.cd-modal-bg').hasClass('is-visible')){
22614				var scaleValue = retrieveScale($('.cd-modal-bg'));
22615
22616				$('.cd-modal-bg').show().addClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
22617					animateLayer($('.cd-modal-bg'), scaleValue, true);
22618				});
22619			}
22620		},
22621        afterShow: function(){
22622			if($('.fancybox-overlay').css('opacity') == 0){
22623				setTimeout(function(){
22624					$('.fancybox-overlay').css('opacity', 1);
22625					$('html').addClass('overflow_html');
22626				}, 200);
22627			}
22628
22629			$('.fancybox-nav').css('opacity', 0);
22630			setTimeout(function(){
22631				$('.fancybox-nav').css('opacity', 1);
22632			}, 150);
22633			if($('.fancybox-wrap iframe').length)
22634			{
22635				$('.fancybox-inner').height('100%');
22636			}
22637		},
22638        beforeClose: function(){
22639			closeModal();
22640			$('.fancybox-overlay').fadeOut();
22641			$('html').removeClass('overflow_html');
22642		},
22643    });
22644}
22645
22646InitStickySideBar = function(el, container_el) {
22647	var block = '.sticky-sidebar',
22648		container_catalog = '.wraps .wrapper_inner .container_inner .main-catalog-wrapper',
22649		container = '.wraps .wrapper_inner .container_inner';
22650	if(typeof el !== 'undefined')
22651		block = el;
22652
22653	if($(container_catalog).length)
22654		container = container_catalog;
22655
22656	if(typeof container_el !== 'undefined')
22657		container = container_el;
22658
22659	if($(block).length && arAsproOptions['THEME']['STICKY_SIDEBAR'] != 'N')
22660	{
22661		if(typeof window['stickySidebar'] !== 'undefined')
22662		{
22663			window['stickySidebar'].destroy();
22664		}
22665
22666		window['stickySidebar'] = new StickySidebar(block, {
22667			topSpacing: 60,
22668			bottomSpacing: 20,
22669			containerSelector: container,
22670			resizeSensor: true,
22671			innerWrapperSelector: '.sticky-sidebar__inner'
22672		});
22673
22674		if($('.sticky-sidebar .sticky-sidebar__inner .banner img').length)
22675		{
22676			$('.sticky-sidebar .sticky-sidebar__inner .banner img').load(function(){
22677				if(typeof window['stickySidebar'] !== 'undefined')
22678				{
22679					window['stickySidebar'].updateSticky();
22680				}
22681			})
22682		}
22683	}
22684}
22685
22686InitOwlSlider = function() {
22687	$('.owl-carousel:not(.owl-loaded):not(.appear-block)').each(function(){
22688		var slider = $(this);
22689		var options;
22690		var svg = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"><path id="Rounded_Rectangle_702_copy_24" data-name="Rounded Rectangle 702 copy 24" class="cls-1" d="M361.691,401.707a1,1,0,0,1-1.414,0L356,397.416l-4.306,4.291a1,1,0,0,1-1.414,0,0.991,0.991,0,0,1,0-1.406l5.016-5a1.006,1.006,0,0,1,1.415,0l4.984,5A0.989,0.989,0,0,1,361.691,401.707Z" transform="translate(-350 -395.031)"/></svg>';
22691		var defaults = {
22692			navText: [
22693				'<i class="svg left colored_theme_hover_text">'+svg+'</i>',
22694				'<i class="svg right colored_theme_hover_text">'+svg+'</i>',
22695			]
22696		}
22697		var config = $.extend({}, defaults, options, slider.data('plugin-options'));
22698
22699		slider.on('initialized.owl.carousel', function(event) {
22700
22701			var eventdata = {slider: event};
22702			BX.onCustomEvent('onSliderInitialized', [eventdata]);
22703
22704			$(event.target).removeClass('loading-state');
22705			$(event.target).find('.owl-item:first').addClass('current');
22706
22707			
22708			if($(event.target).hasClass('catalog_block')){
22709				if(typeof (sliceItemBlockSlide) === "function"){
22710					sliceItemBlockSlide();
22711				}
22712			}
22713
22714			if(typeof window['stickySidebar'] !== 'undefined'){				
22715				window['stickySidebar'].updateSticky();
22716			}
22717
22718		})
22719		slider.owlCarousel(config);
22720
22721		slider.on('change.owl.carousel', function(event) {
22722			var eventdata = {slider: event};
22723			BX.onCustomEvent('onSlideChange', [eventdata]);
22724
22725		})
22726		slider.on('resized.owl.carousel', function(event) {
22727			if(typeof (sliceItemBlockSlide) === "function"){
22728				sliceItemBlockSlide({resize: false});
22729			}
22730		})
22731
22732
22733
22734		slider.on('changed.owl.carousel', function(event) {
22735			var eventdata = {slider: event};
22736			BX.onCustomEvent('onSlideChanged', [eventdata]);
22737
22738			if($(event.target).data('pluginOptions'))
22739			{
22740				if(('index' in $(event.target).data('pluginOptions')))
22741				{
22742					if($('.switch-item-block').length)
22743					{
22744						$('.switch-item-block__count-wrapper--big .switch-item-block__count-value').text(event.item.index+1+'/'+event.item.count);
22745					}
22746				}
22747
22748				if(('relatedTo' in $(event.target).data('pluginOptions')))
22749				{
22750					var relatedClass = $(event.target).data('pluginOptions').relatedTo,
22751						relatedBlock = $(relatedClass);
22752
22753					if(relatedBlock.length && $(event.target).data('owl.carousel'))
22754					{
22755						if(!$(event.target).data('owl.carousel').loop)
22756						{
22757							var current = event.item.index;
22758						}
22759						else
22760						{
22761							var count = event.item.count-1;
22762							var current = Math.round(event.item.index - (event.item.count/2) - .5);
22763
22764							if(current < 0)
22765								current = count;
22766
22767							if(current > count)
22768								current = 0;
22769						}
22770
22771						relatedBlock
22772							.find(".owl-item")
22773							.removeClass("current")
22774							.eq(current)
22775							.addClass("current");
22776
22777						var onscreen = relatedBlock.find('.owl-item.active').length - 1;
22778						var start = relatedBlock.find('.owl-item.active').first().index();
22779						var end = relatedBlock.find('.owl-item.active').last().index();
22780
22781
22782						if (current > end)
22783							relatedBlock.data('owl.carousel').to(current, 100, true);
22784
22785						if (current < start)
22786							relatedBlock.data('owl.carousel').to(current - onscreen, 100, true);
22787						// $(".owl-slider-"+id).trigger('to.owl.carousel', [itemCarousel])
22788					}
22789				}
22790			}
22791		})
22792
22793		slider.on('translated.owl.carousel', function(event) {
22794		})
22795
22796		if(('clickTo' in config))
22797		{
22798			var relatedClass = config.clickTo,
22799				magnifier = ('magnifier' in config);
22800
22801			slider.on("click", ".owl-item", function(e){
22802				e.preventDefault();
22803				var _this = $(this),
22804					number = _this.index();
22805
22806				if(magnifier)
22807				{
22808					if($(relatedClass).closest('.product-container').find('.zoom_picture').length)
22809					{
22810						$(relatedClass).closest('.product-container').find('.zoom_picture').attr('data-large', _this.find('.product-detail-gallery__item').data('big'));
22811						$(relatedClass).closest('.product-container').find('.zoom_picture').attr('xoriginal', _this.find('.product-detail-gallery__item').data('big'));
22812						$(relatedClass).closest('.product-container').find('.zoom_picture').attr('src', _this.find('.product-detail-gallery__item img').attr('src'));
22813					}
22814					_this.siblings('').removeClass('current');
22815					_this.addClass('current');
22816				}
22817				else
22818				{
22819					$(relatedClass).data('owl.carousel').to(number, 300, true);
22820				}
22821			});
22822		}
22823	});
22824}
22825
22826InitFlexSlider = function() {
22827	// return;
22828	$('.flexslider:not(.thmb):not(.flexslider-init):not(.appear-block)').each(function(){
22829		var slider = $(this);
22830		var options;
22831		var defaults = {
22832			animationLoop: false,
22833			controlNav: false,
22834			keyboard: false,
22835			pauseOnAction: false,
22836			pauseInvisible: false,
22837			directionNav: true,
22838			useCSS: false,
22839			animation: "slide"
22840		}
22841		var config = $.extend({}, defaults, options, slider.data('plugin-options'));
22842		if(!slider.parent().hasClass('top_slider_wrapp') && slider.is(':visible')){
22843			if(typeof(config.counts) != 'undefined' && config.direction !== 'vertical'){
22844				config.maxItems =  getGridSize(config.counts,slider);
22845				config.minItems = getGridSize(config.counts,slider);
22846				config.itemWidth = 200;
22847			}
22848			if(typeof(config.move) == 'undefined')
22849				config.move = 1;
22850
22851			config.start = function(slider){
22852				var eventdata = {slider: slider};
22853				BX.onCustomEvent('onSlideInit', [eventdata]);
22854			}
22855
22856			config.after = function(slider){
22857				var eventdata = {slider: slider};
22858				BX.onCustomEvent('onSlideComplete', [eventdata]);
22859			}
22860
22861			config.end = function(slider){
22862				var eventdata = {slider: slider};
22863				BX.onCustomEvent('onSlideEnd', [eventdata]);
22864			}
22865			slider.flexslider(config).addClass('flexslider-init');
22866			if(config.controlNav)
22867				slider.addClass('flexslider-control-nav');
22868			if(config.directionNav)
22869				slider.addClass('flexslider-direction-nav');
22870		}
22871	});
22872}
22873
22874InitFlexSliderByClass = function($class) {
22875	if($class.hasClass('flexslider-init'))
22876		return;
22877	var slider = $class;
22878	var options;
22879	var defaults = {
22880		animationLoop: false,
22881		controlNav: false,
22882		keyboard: false,
22883		pauseOnAction: false,
22884		pauseInvisible: false,
22885		directionNav: true,
22886		useCSS: false,
22887		animation: "slide"
22888	}
22889	var config = $.extend({}, defaults, options, slider.data('plugin-options'));
22890	if(!slider.parent().hasClass('top_slider_wrapp') && slider.is(':visible')){
22891		if(typeof(config.counts) != 'undefined' && config.direction !== 'vertical'){
22892			config.maxItems =  getGridSize(config.counts,slider);
22893			config.minItems = getGridSize(config.counts,slider);
22894			config.itemWidth = 200;
22895		}
22896		if(typeof(config.move) == 'undefined')
22897			config.move = 1;
22898
22899		config.start = function(slider){
22900			var eventdata = {slider: slider};
22901			BX.onCustomEvent('onSlideInit', [eventdata]);
22902		}
22903
22904		config.after = function(slider){
22905			var eventdata = {slider: slider};
22906			BX.onCustomEvent('onSlideComplete', [eventdata]);
22907		}
22908
22909		config.end = function(slider){
22910			var eventdata = {slider: slider};
22911			BX.onCustomEvent('onSlideEnd', [eventdata]);
22912		}
22913
22914		slider.flexslider(config).addClass('flexslider-init');
22915		if(config.controlNav)
22916			slider.addClass('flexslider-control-nav');
22917		if(config.directionNav)
22918			slider.addClass('flexslider-direction-nav');
22919	}
22920}
22921
22922inIframe = function (){
22923    try {
22924        return window.self !== window.top;
22925    } catch (e) {
22926        return true;
22927    }
22928}
22929
22930InitZoomPict = function(el) {
22931	var block = $('.zoom_picture');
22932	if(typeof el !== 'undefined')
22933		block = el;
22934	if(block.length){
22935		var zoomer = block,
22936			options,
22937			defaults = {
22938				zoomWidth: 200,
22939				zoomHeight: 200,
22940				adaptive: false,
22941				title: true,
22942				Xoffset: 15,
22943
22944			};
22945		var config = $.extend({}, defaults, options, zoomer.data('plugin-options'));
22946			zoomer.xzoom(config);
22947
22948		block.on('mouseleave', function(){
22949			block.data('xzoom').movezoom(event);
22950		})
22951	}
22952}
22953
22954var arBasketAsproCounters = arStatusBasketAspro = arBasketPrices = {};
22955SetActualBasketFlyCounters = function(sync){
22956	if(arBasketAsproCounters.DEFAULT == true){
22957		$.ajax({
22958			url: arAsproOptions['SITE_DIR'] + 'ajax/basket_fly.php',
22959			type: 'post',
22960			success: function(html){
22961				$('#basket_line .basket_fly').removeClass('loaded').html(html);
22962
22963				if(typeof sync !== 'undefined')
22964				{
22965					$.ajax({
22966						type:"GET",
22967						url:arAsproOptions['SITE_DIR']+"ajax/actualBasket.php",
22968						// data:data,
22969						success: function(data){
22970							if(!$('.js_ajax').length)
22971								$('body').append('<div class="js_ajax"></div>');
22972							$('.js_ajax').html(data);
22973
22974							setBasketStatusBtn(true);
22975
22976						}
22977					});
22978				}
22979			}
22980		});
22981	}
22982	else{
22983		// insert currency &#8381; by this hack!: $('<div/>').html(arBasketAsproCounters.READY.TITLE).text()
22984		$('.basket_fly .opener .basket_count .count').attr('class', 'count' + (arBasketAsproCounters.READY.COUNT > 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.READY.COUNT)
22985		$('.basket_fly .opener .basket_count + a').attr('href', arBasketAsproCounters['READY']['HREF'])
22986		$('.basket_fly .opener .basket_count').attr('title', $('<div/>').html(arBasketAsproCounters.READY.TITLE).text()).attr('class', 'colored_theme_hover_text basket_count small clicked' + (arBasketAsproCounters.READY.COUNT > 0 ? '' : ' empty'))
22987
22988		$('.basket_fly .opener .wish_count .count').attr('class', 'count' + (arBasketAsproCounters.DELAY.COUNT > 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.DELAY.COUNT)
22989		$('.basket_fly .opener .wish_count + a').attr('href', arBasketAsproCounters.DELAY.HREF)
22990		$('.basket_fly .opener .wish_count').attr('title', $('<div/>').html(arBasketAsproCounters.DELAY.TITLE).text()).attr('class', 'colored_theme_hover_text wish_count small clicked' + (arBasketAsproCounters.DELAY.COUNT > 0 ? '' : ' empty'))
22991
22992		$('.basket_fly .opener .compare_count .wraps_icon_block').attr('class', 'wraps_icon_block compare' + (arBasketAsproCounters.COMPARE.COUNT > 0 ? '' : ' empty_block'));
22993		$('.basket_fly .opener .compare_count .count').attr('class', 'count' + (arBasketAsproCounters.COMPARE.COUNT > 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.COMPARE.COUNT)
22994		$('.basket_fly .opener .compare_count + a').attr('href', arBasketAsproCounters.COMPARE.HREF)
22995
22996		updateBottomIconsPanel(arBasketAsproCounters);
22997	}
22998}
22999
23000CheckHeaderFixed = function(){
23001	var header = $('header, body.simple_basket_mode #header').first(),
23002		header_fixed = $('#headerfixed, body.simple_basket_mode #header'),
23003		header_simple = $('body.simple_basket_mode #header');
23004
23005	if(header_fixed.length){
23006		if(header.length){
23007			var isHeaderFixed = false,
23008				isTabsFixed = false,
23009				headerCanFix = true,
23010				headerFixedHeight = header_fixed.actual('outerHeight'),
23011				headerNormalHeight = header.actual('outerHeight'),
23012				headerDiffHeight = headerNormalHeight - headerFixedHeight,
23013				mobileBtnMenu = $('.btn.btn-responsive-nav'),
23014				headerTop = $('#panel:visible').actual('outerHeight'),
23015				topBlock = $('.TOP_HEADER').first(),
23016				$headerFixedNlo = header_fixed.find('[data-nlo]'),
23017				isNloLoaded = !$headerFixedNlo.length,
23018				OnHeaderFixedScrollHandler;
23019
23020			if(headerDiffHeight <= 0)
23021				headerDiffHeight = 0;
23022
23023			if(topBlock.length)
23024				headerTop += topBlock.actual('outerHeight');
23025
23026			$(window).scroll(OnHeaderFixedScrollHandler = function(){
23027				var tabs_fixed = $('.product-item-detail-tabs-container-fixed');
23028
23029				if(window.matchMedia('(min-width:992px)').matches){
23030					var scrollTop = $(window).scrollTop(),
23031						current_is = $('.search-wrapper .search-input:visible'),
23032						tabs = $('.ordered-block .nav.nav-tabs'),
23033						headerCanFix = !mobileBtnMenu.is(':visible')/* && !$('.dropdown-menu:visible').length*/;
23034
23035					if(!isHeaderFixed){
23036						if(
23037							headerCanFix &&
23038							(scrollTop > headerNormalHeight + headerTop)
23039						){
23040							if(!isNloLoaded){
23041								if(!$headerFixedNlo.hasClass('nlo-loadings')){
23042									$headerFixedNlo.addClass('nlo-loadings');
23043									setTimeout(function(){
23044										$.ajax({
23045											data: {nlo: $headerFixedNlo.attr('data-nlo')},
23046											success: function(response){
23047												// stop ya metrika webvisor DOM indexer
23048												pauseYmObserver();
23049
23050												isNloLoaded = true;
23051												$headerFixedNlo[0].insertAdjacentHTML('beforebegin', $.trim(response));
23052												$headerFixedNlo.remove();
23053
23054												InitMenuNavigationAim();
23055												OnHeaderFixedScrollHandler();
23056
23057												// init custom scroll
23058												$('#headerfixed .mega-menu table td.wide_menu .customScrollbar').mCustomScrollbarDeferred({
23059													mouseWheel: {
23060														scrollAmount: 150,
23061														preventDefault: true
23062													}
23063												});
23064
23065												// resume ya metrika webvisor
23066												// (300ms transition) + (100ms scroll handler)
23067												setTimeout(resumeYmObserver, 400);
23068											},
23069											error:function(){
23070												$headerFixedNlo.removeClass('nlo-loadings');
23071											}
23072										});
23073									}, 300);
23074								}
23075							}
23076							else{
23077								isHeaderFixed = true;
23078								if(header_simple.length) {
23079									headerSimpleHeight = header_simple.actual('outerHeight');
23080									header_simple.closest('.header_wrap').css({'margin-top': headerSimpleHeight});
23081								}
23082								header_fixed.addClass('fixed');
23083
23084								$('nav.mega-menu.sliced.initied').removeClass('initied');
23085								CheckTopMenuDotted();
23086							}
23087						}
23088					}
23089					if(
23090						isHeaderFixed ||
23091						!headerCanFix
23092					){
23093						if(
23094							!headerCanFix ||
23095							(scrollTop <= headerDiffHeight + headerTop)
23096						){
23097							isHeaderFixed = false;
23098							header_fixed.removeClass('fixed');
23099							if(header_simple.length) {
23100								header_simple.closest('.header_wrap').css({'margin-top': ''});
23101							}
23102						}
23103					}
23104
23105					//fixed tabs
23106					if(tabs_fixed.length && tabs.length){
23107						var tabs_offset = $('.ordered-block .nav.nav-tabs').offset();
23108						if(scrollTop + headerFixedHeight > tabs_offset.top){
23109							tabs_fixed.css({'top': header_fixed.actual('outerHeight')});
23110							tabs_fixed.addClass('fixed');
23111
23112							header_fixed.addClass('tabs-fixed');
23113						}
23114						else if(tabs_fixed.hasClass('fixed')){
23115							tabs_fixed.removeAttr('style');
23116							tabs_fixed.removeClass('fixed');
23117
23118							header_fixed.removeClass('tabs-fixed');
23119						}
23120					}
23121				}
23122			});
23123		}
23124	}
23125
23126	//mobile fixed
23127	var headerSimple = $('body.simple_basket_mode .wrapper1.mfixed_Y #header');
23128	var mfixed = headerSimple.length ? headerSimple : $('.wrapper1.mfixed_Y #mobileheader');
23129	if(mfixed.length && isMobile)
23130	{
23131		var isMHeaderFixed = false,
23132			mheaderCanFix = true,
23133			mheaderFixedHeight = mfixed.actual('outerHeight'),
23134			// mheaderFixedHeight = 0,
23135			mheaderTop = $('#panel:visible').actual('outerHeight'),
23136			mHeaderScrollTop = $('.wrapper1').hasClass('mfixed_view_scroll_top');
23137		$(window).scroll(function(){
23138			var scrollTop = $(window).scrollTop();
23139			if(window.matchMedia('(max-width:991px)').matches)
23140			{
23141				if(mHeaderScrollTop)
23142				{
23143					if(scrollTop > startScroll)
23144					{
23145						if(!$("#mobilePhone.show").length){
23146							mfixed.removeClass('fixed');
23147							if(headerSimple.length) {
23148								headerSimple.closest('.header_wrap').css({'margin-top': ''});
23149							}
23150						}
23151					}
23152					else if(scrollTop > mheaderFixedHeight + mheaderTop){
23153						mfixed.addClass('fixed');
23154						if(headerSimple.length) {
23155							headerSimple.closest('.header_wrap').css({'margin-top': mheaderFixedHeight});
23156						}
23157					}
23158					else if(scrollTop <= mheaderFixedHeight + mheaderTop){
23159						mfixed.removeClass('fixed');
23160						if(headerSimple.length) {
23161							headerSimple.closest('.header_wrap').css({'margin-top': ''});
23162						}
23163					}
23164					startScroll = scrollTop;
23165				}
23166				else
23167				{
23168					if(!isMHeaderFixed)
23169					{
23170						if((scrollTop > mheaderFixedHeight + mheaderTop))
23171						{
23172							isMHeaderFixed = true;
23173							mfixed.addClass('fixed');
23174							if(headerSimple.length) {
23175								headerSimple.closest('.header_wrap').css({'margin-top': mheaderFixedHeight});
23176							}
23177						}
23178					}
23179					else if(isMHeaderFixed)
23180					{
23181						if((scrollTop <= mheaderFixedHeight + mheaderTop))
23182						{
23183							isMHeaderFixed = false;
23184							mfixed.removeClass('fixed');
23185							if(headerSimple.length) {
23186								headerSimple.closest('.header_wrap').css({'margin-top': ''});
23187							}
23188						}
23189					}
23190				}
23191			}
23192			else {
23193				mfixed.removeClass('fixed');
23194				if(headerSimple.length) {
23195					headerSimple.closest('.header_wrap').css({'margin-top': ''});
23196				}
23197			}
23198		})
23199	}
23200}
23201
23202CheckHeaderFixedMenu = function(){
23203	if(arAsproOptions['THEME'] && arAsproOptions['THEME']['HEADER_FIXED'] == 2 && $('#headerfixed .js-nav').length && window.matchMedia('(min-width: 992px)').matches)
23204	{
23205		$('#headerfixed .js-nav').css('width','0');
23206		var all_width = 0,
23207			cont_width = $('#headerfixed .maxwidth-theme').actual('width'),
23208			padding_menu = $('#headerfixed .logo-row.v2 .menu-block').actual('outerWidth')-$('#headerfixed .logo-row.v2 .menu-block').actual('width');
23209		$('#headerfixed .logo-row.v2 > .inner-table-block').each(function(){
23210			if(!$(this).hasClass('menu-block'))
23211				all_width += $(this).actual('outerWidth');
23212		})
23213		$('#headerfixed .js-nav').width(cont_width-all_width-padding_menu);
23214	}
23215}
23216
23217CheckSearchWidth = function(){
23218	if($('.logo_and_menu-row .search_wrap').length){
23219		var searchPosition = $('.logo_and_menu-row .search_wrap').position().left,
23220			maxWidth = $('.logo_and_menu-row .maxwidth-theme').width() - 2;
23221			width = 0;
23222		if($('.logo_and_menu-row .subtop .search_wrap').length)
23223		{
23224			maxWidth = $('.logo_and_menu-row .subtop').width() - 2;
23225			$('.logo_and_menu-row .subtop > .row >div >div').each(function(){
23226				if(!$(this).hasClass('search_wrap')){
23227					var elementWidth = $(this).outerWidth();
23228					if(!$(this).is(':visible') || !$(this).height())
23229						elementWidth = 0;
23230					width = (width ? width - elementWidth : maxWidth - elementWidth);
23231				}
23232			}).promise().done(function(){
23233				if($('.logo_and_menu-row .search_wrap.wide_search').length)
23234					$('.logo_and_menu-row .search_wrap .search-block').outerWidth(width);
23235				else
23236					$('.logo_and_menu-row .search_wrap').outerWidth(width);
23237				$('.logo_and_menu-row .search_wrap').css({'opacity': 1, 'visibility': 'visible'});
23238			});
23239		}
23240		else
23241		{
23242			if($('.logo_and_menu-row .subbottom .search_wrap').length)
23243			{
23244				maxWidth = $('.logo_and_menu-row .subbottom').width() - 2;
23245				$('.logo_and_menu-row .subbottom >div').each(function(){
23246					if(!$(this).hasClass('search_wrap')){
23247						var elementWidth = $(this).outerWidth();
23248						if(!$(this).is(':visible') || !$(this).height())
23249							elementWidth = 0;
23250						width = (width ? width - elementWidth : maxWidth - elementWidth);
23251					}
23252				}).promise().done(function(){
23253					if($('.logo_and_menu-row .search_wrap.wide_search').length)
23254						$('.logo_and_menu-row .search_wrap .search-block').outerWidth(width);
23255					else
23256						$('.logo_and_menu-row .search_wrap').outerWidth(width);
23257					$('.logo_and_menu-row .search_wrap').css({'opacity': 1, 'visibility': 'visible'});
23258				});
23259			}
23260			else
23261			{
23262				$('.logo_and_menu-row .maxwidth-theme > .row >div >div').each(function(){
23263					if(!$(this).hasClass('search_wrap')){
23264						var elementWidth = $(this).outerWidth();
23265						if(!$(this).is(':visible') || !$(this).height())
23266							elementWidth = 0;
23267						width = (width ? width - elementWidth : maxWidth - elementWidth);
23268					}
23269				}).promise().done(function(){
23270					if($('.logo_and_menu-row .search_wrap.wide_search').length)
23271						$('.logo_and_menu-row .search_wrap .search-block').outerWidth(width);
23272					else
23273						$('.logo_and_menu-row .search_wrap').outerWidth(width);
23274					$('.logo_and_menu-row .search_wrap').css({'opacity': 1, 'visibility': 'visible'});
23275				});
23276			}
23277		}
23278	}
23279}
23280
23281lazyLoadPagenBlock = function(){
23282	setTimeout(function(){
23283		if ($('.with-load-block .ajax_load_btn:not(.appear-block)').length) {
23284			$('.with-load-block .ajax_load_btn:not(.appear-block)').appear(function(){
23285				var $this = $(this);
23286				$this.addClass('appear-block').trigger('click');
23287
23288			}, {accX: 0, accY: 200})
23289		}
23290	}, 200)
23291}
23292
23293scrollPreviewBlock = function(){
23294	if(typeof($.cookie('scroll_block')) != 'undefined' && $.cookie('scroll_block'))
23295	{
23296		var scroll_block = $($.cookie('scroll_block'));
23297		if(scroll_block.length)
23298		{
23299			$('body, html').animate({scrollTop: scroll_block.offset().top}, 500);
23300		}
23301		$.cookie('scroll_block', null);
23302	}
23303}
23304
23305scrollToBlock = function(block){
23306	if($(block).length)
23307	{
23308		var offset = $(block).offset().top;
23309		if(typeof($(block).data('toggle')) != 'undefined')
23310			$(block).click();
23311
23312		if(typeof($(block).data('offset')) != 'undefined')
23313			offset += $(block).data('offset');
23314
23315		$('body, html').animate({scrollTop: offset}, 500);
23316	}
23317}
23318
23319checkMenuLines = function(){
23320	if($('.front_page .menu-row .left_border').length || $('.front_page .menu-row .right_border').length)
23321	{
23322		var positionMenu = ($('.centered .menu-row .mega-menu table').length ? $('.centered .menu-row .mega-menu table').offset().left : 0),
23323			varFixLineWidth = ($('body').hasClass('with_decorate') && window.matchMedia('(min-width: 1100px)').matches ? 126 : 7);
23324
23325		$('.menu-row .left_border, .menu-row .right_border').css('width', positionMenu - varFixLineWidth);
23326	}
23327}
23328
23329SetFixedAskBlock = function(){
23330	if($('.ask_a_question_wrapper').length)
23331	{
23332		var offset = $('.ask_a_question_wrapper').offset(),
23333			footer_offset = 0,
23334			block = $('.ask_a_question_wrapper').find('.ask_a_question'),
23335			block_offset = BX.pos(block[0]),
23336			block_height = block_offset.bottom-block_offset.top,
23337			diff_top_scroll = $('#headerfixed').height() + 20;
23338
23339		if($('footer').length)
23340			footer_offset = $('footer').offset().top;
23341
23342		if($('.banner.CONTENT_BOTTOM').length)
23343			footer_offset = $('.banner.CONTENT_BOTTOM').offset().top;
23344
23345		/* removed for ISSUE NEXT-414
23346		if(block_height+130 > block.closest('.fixed_wrapper').height())
23347			block.addClass('nonfixed');
23348		else
23349			block.removeClass('nonfixed');
23350		*/
23351
23352		if(block_height+diff_top_scroll+documentScrollTopLast + 130 > footer_offset)
23353		{
23354			block.removeClass('fixed').css({'top': 'auto', 'width': 'auto', 'bottom': 0});
23355			block.parent().css('position', 'static');
23356			block.parent().parent().css('position', 'static');
23357		}
23358		else
23359		{
23360			block.parent().removeAttr('style');
23361			block.parent().parent().removeAttr('style');
23362
23363			if(documentScrollTopLast + diff_top_scroll > offset.top)
23364			{
23365				var fixed_width = $('.fixed_block_fix').width();
23366				block.addClass('fixed').css({'top': diff_top_scroll, 'bottom': 'auto'});
23367				if(fixed_width)
23368					block.css({'width': $('.fixed_block_fix').width()})
23369			}
23370			else
23371				block.removeClass('fixed').css({'top': 0, 'width': 'auto'});
23372		}
23373	}
23374}
23375
23376MegaMenuFixed = function(){
23377	var animationTime = 150,
23378		$megaFixedNlo = $('.mega_fixed_menu').find('[data-nlo]');
23379
23380	$('header .burger, #headerfixed .burger').on('click', function(){
23381		if($megaFixedNlo.length){
23382	        if(!$megaFixedNlo.hasClass('nlo-loadings')){
23383	            $megaFixedNlo.addClass('nlo-loadings');
23384	            setTimeout(function(){
23385	                $.ajax({
23386	                    data: {nlo: $megaFixedNlo.attr('data-nlo')},
23387	                    success: function(response){
23388	                        $megaFixedNlo[0].insertAdjacentHTML('beforebegin', $.trim(response));
23389	                        $megaFixedNlo.remove();
23390	                    },
23391	                    error:function(){
23392	                        $megaFixedNlo.removeClass('nlo-loadings');
23393	                    }
23394	                });
23395	            }, 300);
23396	        }
23397	    }
23398
23399		$('.mega_fixed_menu').fadeIn(animationTime);
23400		//$('.header_wrap').toggleClass('zindexed');
23401		$('.mega_fixed_menu').mCustomScrollbarDeferred({
23402			mouseWheel: {
23403				scrollAmount: 150,
23404				preventDefault: true
23405			}
23406		});
23407	});
23408
23409	$('.mega_fixed_menu .svg.svg-close').on('click', function(){
23410		$(this).closest('.mega_fixed_menu').fadeOut(animationTime);
23411		//$('.header_wrap').toggleClass('zindexed');
23412	});
23413
23414	$('.mega_fixed_menu .dropdown-menu .arrow').on('click', function(e){
23415		e.preventDefault();
23416		e.stopPropagation();
23417		$(this).closest('.dropdown-submenu').find('.dropdown-menu').slideToggle(animationTime);
23418		$(this).closest('.dropdown-submenu').addClass('opened');
23419	});
23420}
23421
23422CheckPopupTop = function(){
23423	// var popup = $('.jqmWindow.show:last');
23424	// if(!popup.length)
23425	// 	popup = $('.jqmWindow.show');
23426	// if(!popup.length)
23427	// 	popup = $('.jqm-init.show');
23428	// if(popup.length){
23429	// 	var documentScollTop = $(document).scrollTop();
23430	// 	var windowHeight = $(window).height();
23431	// 	var popupTop = parseInt(popup.css('top'));
23432	// 	var popupHeight = popup.height();
23433
23434	// 	if(windowHeight >= popupHeight){
23435	// 		// center
23436	// 		popupTop = (windowHeight - popupHeight) / 2;
23437	// 	}
23438	// 	else{
23439	// 		if(documentScollTop > documentScrollTopLast){
23440	// 			// up
23441	// 			popupTop -= documentScollTop - documentScrollTopLast;
23442	// 		}
23443	// 		else if(documentScollTop < documentScrollTopLast){
23444	// 			// down
23445	// 			popupTop += documentScrollTopLast - documentScollTop;
23446	// 		}
23447
23448	// 		if(popupTop + popupHeight < windowHeight){
23449	// 			// bottom
23450	// 			popupTop = windowHeight - popupHeight;
23451	// 		}
23452	// 		else if(popupTop > 0){
23453	// 			// top
23454	// 			popupTop = 0;
23455	// 		}
23456	// 	}
23457	// 	popup.css('top', popupTop + 'px');
23458	// }
23459}
23460
23461AjaxClickLink = function(e){
23462	var _this = '',
23463		container = $('.js-load-wrapper'),
23464		container_inner = $('.js-load-wrapper').find('.ajax_load'),
23465		dopAction = '';
23466		url = '';
23467		if ('preventDefault' in e) {
23468			e.preventDefault();
23469			_this = ($(e.target).hasClass('js-load-link') ? $(e.target) : $(e.target).closest('.js-load-link'))
23470		}
23471		else
23472		{
23473			_this = $(e);
23474			dopAction = 'Y';
23475		}
23476
23477	if (container.length) {
23478		var objUrl = parseUrlQuery(),
23479			obGetData = {"ajax_get_filter": "Y", "control_ajax": "Y"};
23480
23481		obGetData.bitrix_include_areas = 'N';
23482
23483		if ('clear_cache' in objUrl) {
23484			if (objUrl.clear_cache == 'Y') {
23485				obGetData.clear_cache = 'Y';
23486			}
23487		}
23488
23489		if (container_inner.length) {
23490			container_inner.addClass('loading-state');
23491		} else {
23492			container.addClass('loading-state');
23493		}
23494
23495		if (_this.data('url')) {
23496			url = _this.data('url');
23497		}
23498
23499		if (_this.data('click_block') && $(_this.data('click_block')).length) {
23500			if ($(_this.data('click_block')).data('url')) {
23501				url = $(_this.data('click_block')).data('url');
23502			}
23503		}
23504
23505		if (dopAction) {
23506			BX.PopupWindowManager.getCurrentPopup().close();
23507			$('.bx_filter_select_popup ul li .sort_btn').removeClass('current');
23508			_this.addClass('current');
23509			_this.closest('.bx_filter_block').find('.bx_filter_select_text').text(_this.text());
23510		}
23511
23512		$('.bx_filter .bx_sort_filter .bx_filter_select_text').text(_this.text());
23513		$('.bx_filter .bx_sort_filter .bx_filter_select_popup ul li span.current').removeClass('current');
23514		$('.bx_filter .bx_sort_filter .bx_filter_select_popup ul li').eq(_this.parent().index()).find('span').addClass('current');
23515
23516		$.ajax({
23517			url: url,
23518			data: obGetData,
23519			success: function(html){
23520				container.html(html);
23521
23522				if(container_inner.length)
23523					container_inner.removeClass('loading-state');
23524				else
23525					container.removeClass('loading-state');
23526
23527				initAnimateLoad();
23528
23529				var eventdata = {action: 'jsLoadBlock'}
23530				BX.onCustomEvent('onCompleteAction', [eventdata, _this]);
23531
23532				initSelects(document);
23533				InitCustomScrollBar();
23534				InitScrollBar();
23535
23536				if(window.FilterHelper !== undefined) {
23537					FilterHelper.resultDiv = $('#filter-helper');
23538					FilterHelper.show();
23539				}
23540			}
23541		})
23542	}
23543}
23544
23545initCalculatePreview = function(){
23546	$('.calculate-delivery.with_preview:not(.inited)').each(function(){
23547		var $this = $(this);
23548		var $calculateSpan = $this.find('span[data-event=jqm]');
23549		var $preview = $this.find('.calculate-delivery-preview');
23550
23551		$this.addClass('inited');
23552		$this.appear(function(){
23553
23554			if($calculateSpan.length){
23555				if(typeof window['calculate-delivery-preview-index'] === 'undefined'){
23556					window['calculate-delivery-preview-index'] = 1001;
23557				}
23558				else{
23559					++window['calculate-delivery-preview-index'];
23560				}
23561
23562				var productId = $calculateSpan.attr('data-param-product_id') * 1;
23563				var quantity = $calculateSpan.attr('data-param-quantity') * 1;
23564
23565				if(productId > 0){
23566					var areaIndexSended = window['calculate-delivery-preview-index'];
23567					$calculateSpan.data({areaIndex: areaIndexSended});
23568
23569					$.ajax({
23570						url: arAsproOptions['SITE_DIR'] + 'ajax/delivery.php',
23571						type: 'POST',
23572						data: {
23573							is_preview: 'Y',
23574							index: areaIndexSended,
23575							product_id: productId,
23576							quantity: quantity
23577						},
23578						beforeSend: function(){
23579							$this.addClass('loadings');
23580						},
23581						success: function(response){
23582							var areaIndex = $calculateSpan.data('areaIndex');
23583							if(typeof areaIndex !== 'undefined' && areaIndex == areaIndexSended){
23584								$calculateSpan.hide();
23585								$preview.html(response);
23586								if(!$preview.find('.catalog-delivery-preview').length){
23587									$preview.empty();
23588									$calculateSpan.show();
23589								}
23590							}
23591						},
23592						error: function(xhr, ajaxOptions, thrownError){
23593						},
23594						complete: function(){
23595							var areaIndex = $calculateSpan.data('areaIndex');
23596							if(typeof areaIndex !== 'undefined' && areaIndex == areaIndexSended){
23597								$this.removeClass('loadings');
23598							}
23599						}
23600					});
23601				}
23602			}
23603
23604		}, {accX: 0, accY: 0});
23605	});
23606}
23607
23608/*set price item*/
23609if(!funcDefined('setPriceItem')){
23610	var setPriceItem = function setPriceItem(main_block, quantity, rewrite_price, check_quantity, is_sku, show_percent, percent){
23611		var old_quantity = main_block.find('.to-cart').attr('data-ratio'),
23612			value = (typeof rewrite_price !== 'undefined' && rewrite_price ? rewrite_price : main_block.find('.to-cart').attr('data-value')),
23613			currency = main_block.find('.to-cart').attr('data-currency'),
23614			total_block = '<div class="total_summ" style="display:none;"><div>
23614'+BX.message('TOTAL_SUMM_ITEM')+'<span></span></div></div>',
23615			price_block = main_block.find('.cost.prices'),
23616			use_percent = (typeof show_percent !== 'undefined' && show_percent == 'Y'),
23617			percent_number = (typeof percent !== 'undefined' && percent),
23618			sku_checked = (main_block.find('.has_offer_prop').length ? 'Y' : 'N'),
23619			check = (typeof check_quantity !== 'undefined' && check_quantity);
23620
23621		if(main_block.find('.counter_wrapp + .wrapp-one-click').length)
23622		{
23623			if(!main_block.find('.wrapp-one-click .total_summ').length && !is_sku)
23624				$(total_block).appendTo(main_block.find('.counter_wrapp + .wrapp-one-click'))
23625		}
23626		else if(main_block.find('.buy_block').length)
23627		{
23628			if(!main_block.find('.buy_block .total_summ').length && !is_sku)
23629				$(total_block).appendTo(main_block.find('.buy_block'))
23630		}
23631		else if(main_block.find('.counter_wrapp').length)
23632		{
23633			if(!main_block.find('.counter_wrapp .total_summ').length && !is_sku)
23634				$(total_block).appendTo(main_block.find('.counter_wrapp:first'))
23635		}
23636		if(main_block.find('.total_summ').length)
23637		{
23638			if(value && currency)
23639			{
23640				if((1 == quantity && old_quantity == quantity) || (typeof is_sku !== 'undefined' && is_sku && !check))
23641				{
23642					main_block.find('.total_summ').slideUp(50);
23643				}
23644				else
23645				{
23646					main_block.find('.total_summ span').html(BX.Currency.currencyFormat((value*quantity), currency, true));
23647					if(main_block.find('.total_summ').is(':hidden')/* || sku_checked == 'Y'*/)
23648						main_block.find('.total_summ').slideDown(100);
23649				}
23650			}
23651			else
23652			{
23653				main_block.find('.total_summ').slideUp(100);
23654			}
23655		}
23656	}
23657}
23658
23659if(!funcDefined('getCurrentPrice')){
23660	var getCurrentPrice = function getCurrentPrice(price, currency, print_price){
23661		var val = '';
23662		var format_value = BX.Currency.currencyFormat(price, currency);
23663		if(print_price.indexOf(format_value) >= 0)
23664		{
23665			val = print_price.replace(format_value, '<span class="price_value">'+format_value+'</span><span class="price_currency">');
23666			val += '</span>';
23667		}
23668		else
23669		{
23670			val = print_price;
23671		}
23672
23673		return val;
23674	}
23675}
23676
23677if(!funcDefined('initAnimateLoad')){
23678	var initAnimateLoad = function initAnimateLoad(){
23679		$('.animate-load').click(function(){
23680			if(!jQuery.browser.mobile)
23681			{
23682				$(this).parent().addClass('loadings');
23683			}
23684		})
23685	}
23686}
23687
23688if(!funcDefined('showBasketShareBtn')){
23689	var showBasketShareBtn = function(){
23690		if(arAsproOptions['THEME']['SHOW_SHARE_BASKET'] === 'Y'){
23691			if(!document.querySelector('.basket-checkout-block-btns')){
23692				var checkout = document.querySelector('.basket-checkout-section-inner');
23693				if(checkout){
23694					var btns = BX.create({
23695						tag: 'div',
23696						attrs: {
23697							class: 'basket-checkout-block basket-checkout-block-btns',
23698						},
23699						html: '<div class="basket-checkout-block-btns-wrap"></div>'
23700					});
23701
23702					BX.insertAfter(btns, BX.lastChild(checkout));
23703					var btnsWrap = btns.querySelector('.basket-checkout-block-btns-wrap');
23704
23705					var btnCheckout = checkout.querySelector('.basket-checkout-block-btn');
23706					if(btnCheckout){
23707						btnsWrap.appendChild(btnCheckout);
23708					}
23709
23710					var btnFastOrder = checkout.querySelector('.fastorder');
23711					if(btnFastOrder){
23712						btnsWrap.appendChild(btnFastOrder);
23713					}
23714
23715					if(
23716						$('.basket-btn-checkout').length &&
23717						!$('.basket-btn-checkout').hasClass('disabled')
23718					){
23719						var btnShareBasket = BX.create({
23720							tag: 'div',
23721							attrs: {
23722								class: 'basket-checkout-block basket-checkout-block-share colored_theme_hover_bg-block',
23723								title: arAsproOptions['THEME']["EXPRESSION_FOR_SHARE_BASKET"],
23724							},
23725							html: '<span class="animate-load" data-event="jqm" data-param-form_id="share_basket" data-name="share_basket"><i class="svg colored_theme_hover_bg-el-svg"><svg class="svg svg-share" xmlns="http://www.w3.org/2000/svg" width="14" height="16" viewBox="0 0 14 16"><path data-name="Ellipse 223 copy 8" d="M1613,203a2.967,2.967,0,0,1-1.86-.661l-3.22,2.01a2.689,2.689,0,0,1,0,1.3l3.22,2.01A2.961,2.961,0,0,1,1613,207a3,3,0,1,1-3,3,3.47,3.47,0,0,1,.07-0.651l-3.21-2.01a3,3,0,1,1,0-4.678l3.21-2.01A3.472,3.472,0,0,1,1610,200,3,3,0,1,1,1613,203Zm0,8a1,1,0,1,0-1-1A1,1,0,0,0,1613,211Zm-8-7a1,1,0,1,0,1,1A1,1,0,0,0,1605,204Zm8-5a1,1,0,1,0,1,1A1,1,0,0,0,1613,199Z" transform="translate(-1602 -197)" fill="#B8B8B8"></path></svg></i><span class="title">' + arAsproOptions['THEME']["EXPRESSION_FOR_SHARE_BASKET"] + '</span></span>',
23726						});
23727
23728						btnsWrap.appendChild(btnShareBasket);
23729						initAnimateLoad();
23730					}
23731				}
23732			}
23733		}
23734	}
23735}
23736
23737if(!funcDefined('showBasketHeadingBtn')){
23738	var showBasketHeadingBtn = function(){
23739		if(document.querySelector('.page-top h1')){
23740			var topicHeading = document.querySelector('.page-top .topic .topic__heading');
23741			if(topicHeading){
23742				if(arAsproOptions['THEME']['SHOW_BASKET_PRINT'] === 'Y'){
23743					if(!document.querySelector('.btn_basket_heading--print')){
23744						var btnPrintBasket = BX.create({
23745							tag: 'div',
23746							attrs: {
23747								class: 'btn_basket_heading btn_basket_heading--print print-link colored_theme_hover_bg-block',
23748								title: arAsproOptions['THEME']["EXPRESSION_FOR_PRINT_PAGE"],
23749							},
23750							html: '<i class="svg colored_theme_hover_bg-el-svg"><svg class="svg svg-print" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path id="Rectangle_665_copy_4" data-name="Rectangle 665 copy 4" class="cls-print" d="M1570,210h-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,1570,210Zm-8,1h4v-4h-4v4Zm4-12h-4v2h4v-2Zm4,4h-12v5h2v-3h8v3h2v-5Z" transform="translate(-1556 -197)"></path></svg></i>',
23751						});
23752						BX.insertBefore(btnPrintBasket, topicHeading);
23753					}
23754				}
23755
23756				if(
23757					$('.basket-btn-checkout').length &&
23758					!$('.basket-btn-checkout').hasClass('disabled')
23759				){
23760					// if(arAsproOptions['THEME']['SHOW_SEND_BASKET_2EMAIL'] === 'Y'){
23761						// if(!document.querySelector('.btn_basket_heading--send2email')){
23762						// 	var btnSendBasket2Email = BX.create({
23763						// 		tag: 'div',
23764						// 		attrs: {
23765						// 			class: 'btn_basket_heading btn_basket_heading--with_title btn_basket_heading--send2email colored_theme_hover_bg-block',
23766						// 			title: arAsproOptions['THEME']["EXPRESSION_FOR_SEND_BASKET_2EMAIL"],
23767						// 		},
23768						// 		html: '<i class="svg colored_theme_hover_bg-el-svg"><svg class="svg" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3 0H4H12H13V1V3.125L15.06 4.4125C15.6448 4.77798 16 5.41892 16 6.1085V6.98162C16.0002 6.99325 16.0002 7.00488 16 7.01649V14C16 15.1046 15.1046 16 14 16H2C0.895429 16 -1.43918e-06 15.1046 -1.43918e-06 14V7.01644C-0.000202747 7.00486 -0.000203195 6.99327 -1.43918e-06 6.98167V6.1085C-1.43918e-06 5.41892 0.355238 4.77798 0.940001 4.4125L3 3.125V1V0ZM5 4.2335L5 2H11V7L11 8.23381L9.62943 9.05615L8.64018 8.23178C8.26934 7.92274 7.73066 7.92274 7.35981 8.23178L6.37057 9.05615L5 8.23381V4.2335ZM2 6.1085L3 5.4835V7.03381L2 6.43381V6.1085ZM14 6.1085L13 5.4835V7.03381L14 6.43381V6.1085ZM12.4379 14L8 10.3017L3.56205 14H12.4379ZM14 12.6983V8.76619L11.2567 10.4122L14 12.6983ZM2 8.76619V12.6983L4.74333 10.4122L2 8.76619Z" fill="#B8B8B8"/></svg></i><span class="title">' + arAsproOptions['THEME']["EXPRESSION_FOR_SEND_BASKET_2EMAIL"] + '</span>',
23769						// 	});
23770						// 	BX.insertBefore(btnSendBasket2Email, topicHeading);
23771						// }
23772					// }
23773
23774					if(arAsproOptions['THEME']['SHOW_DOWNLOAD_BASKET'] === 'Y'){
23775						if(!document.querySelector('.btn_basket_heading--download')){
23776							var btnDownloadBasket = BX.create({
23777								tag: 'div',
23778								attrs: {
23779									class: 'btn_basket_heading btn_basket_heading--with_title btn_basket_heading--download colored_theme_hover_bg-block',
23780									title: arAsproOptions['THEME']["EXPRESSION_FOR_DOWNLOAD_BASKET"],
23781								},
23782								events: {
23783									click: BX.proxy(function(e){
23784										if(!e){
23785											e = window.event;
23786										}
23787
23788										BX.PreventDefault(e);
23789
23790										var button = e.target.closest('.btn_basket_heading');
23791										if(button){
23792											if(BX.hasClass(button, 'loadings')){
23793												return;
23794											}
23795
23796											BX.addClass(button, 'loadings');
23797											setTimeout(function(){
23798												BX.removeClass(button, 'loadings');
23799											}, 2000);
23800										}
23801
23802										location.href = '/ajax/download_basket.php?params[type]=' + arAsproOptions['THEME']["BASKET_FILE_DOWNLOAD_TEMPLATE"];
23803									}, this)
23804								},
23805								html: '<i class="svg colored_theme_hover_bg-el-svg"><svg class="svg" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5 14H14L14 6H11H10V5V2H5V6H7H9V8V10V12H7H5V14ZM13.6716 4L12 2.32843V4H13.6716ZM6 8H7V10H6H5H3H2V8H3H5H6ZM3 6H2H0V8V10V12H2H3V14V16H5H14H16V14V4.32843C16 3.79799 15.7893 3.28929 15.4142 2.91421L13.0858 0.585786C12.7107 0.210714 12.202 0 11.6716 0H5H3V2V6Z" fill="#B8B8B8"/></svg></i><span class="title">' + arAsproOptions['THEME']["EXPRESSION_FOR_DOWNLOAD_BASKET"] + '</span>',
23806							});
23807							BX.insertBefore(btnDownloadBasket, topicHeading);
23808						}
23809					}
23810				}
23811				else{
23812					BX.remove(document.querySelector('.btn_basket_heading--send2email'));
23813					BX.remove(document.querySelector('.btn_basket_heading--download'));
23814				}
23815			}
23816		}
23817	}
23818}
23819
23820$(document).ready(function(){
23821	//check width for menu and search
23822	CheckSearchWidth();
23823	MegaMenuFixed();
23824	InitScrollBar();
23825
23826	/*ripple effect for buttons*/
23827	$.ripple(".btn", {
23828		debug: false, // Turn Ripple.js logging on/off
23829		on: 'mouseenter', // The event to trigger a ripple effect
23830
23831		opacity: 0.4, // The opacity of the ripple
23832		color: "auto", // Set the background color. If set to "auto", it will use the text color
23833		multi: true, // Allow multiple ripples per element
23834
23835		duration: 0.6, // The duration of the ripple
23836
23837		easing: 'linear' // The CSS3 easing function of the ripple
23838	});
23839	/**/
23840
23841	//ecommerce order
23842	if(arAsproOptions["PAGES"]["ORDER_PAGE"])
23843	{
23844		var arUrl = parseUrlQuery();
23845		if("ORDER_ID" in arUrl)
23846		{
23847			var _id = arUrl["ORDER_ID"];
23848			if(arAsproOptions['COUNTERS']['USE_FULLORDER_GOALS'] !== 'N')
23849			{
23850				var eventdata = {goal: 'goal_order_success', result: _id};
23851				BX.onCustomEvent('onCounterGoals', [eventdata])
23852			}
23853			if(checkCounters())
23854			{
23855				if(typeof localStorage !== 'undefined'){
23856					var val = localStorage.getItem('gtm_e_' + _id),
23857						d = '';
23858					try{
23859						d = JSON.parse(val);
23860					}
23861					catch(e){
23862						d = val
23863					}
23864					if(typeof d === 'object'){
23865						window.dataLayer = window.dataLayer || [];
23866						dataLayer.push({"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['PURCHASE'], "ecommerce": d});
23867					}
23868
23869					if(typeof localStorage !== 'undefined'){
23870						localStorage.removeItem('gtm_e_' + _id);
23871					}
23872				}
23873			}
23874		}
23875	}
23876	var bSafary = false;
23877	if(typeof jQuery.browser == 'object')
23878		bSafary = jQuery.browser.safari;
23879	else if(typeof browser == 'object')
23880		bSafary = browser.safari;
23881	if(!bSafary){
23882		CheckTopMenuPadding();
23883		CheckTopMenuOncePadding();
23884		CheckTopMenuDotted();
23885		CheckHeaderFixed();
23886		checkMenuLines();
23887		setTimeout(function() {$(window).resize();}, 150); // need to check resize flexslider & menu
23888		setTimeout(function() {$(window).scroll();}, 250); // need to check position fixed ask block
23889	}
23890	else{
23891		setTimeout(function(){
23892			$(window).resize(); // need to check resize flexslider & menu
23893			setTimeout(function(){
23894				CheckTopMenuPadding();
23895				CheckTopMenuOncePadding();
23896				CheckTopMenuDotted();
23897				CheckHeaderFixed();
23898				checkMenuLines();
23899
23900				setTimeout(function(){
23901					$(window).scroll();
23902				}, 50);
23903			}, 50);
23904		}, 350);
23905	}
23906
23907
23908	/*for filter scrol in mobile*/
23909	if(window.matchMedia('(max-width: 767px)').matches){
23910		$('.bx_filter .scrollbar').addClass('mobile-scroll').removeClass('scroll-init');
23911		$('.bx_filter .srollbar-custom').addClass('mobile-scroll').removeClass('scroll-init');
23912		$('.bx_filter .bx_filter_section form .bx_filter_parameters').addClass('mobile-scroll').removeClass('scroll-init');
23913		if($('.bx_filter .mobile-scroll.scrollbar').length)
23914			$('.bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
23915		if($('.bx_filter .mobile-scroll.srollbar-custom').length)
23916			$('.bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
23917	}
23918	/**/
23919
23920	if(arAsproOptions['THEME']['USE_DEBUG_GOALS'] === 'Y')
23921		$.cookie('_ym_debug', 1, {path: '/',});
23922	else
23923		$.cookie('_ym_debug', null, {path: '/',});
23924
23925	/* change type2 menu for fixed */
23926	if($('#headerfixed .js-nav').length)
23927	{
23928		if(arAsproOptions['THEME']['HEADER_FIXED'] == 2)
23929			CheckHeaderFixedMenu();
23930
23931		setTimeout(function(){
23932			$('#headerfixed .js-nav').addClass('opacity1');
23933		},350);
23934	}
23935
23936	// -- scroll after apply option
23937	if($('.instagram_ajax').length)
23938	{
23939		BX.addCustomEvent('onCompleteAction', function(eventdata){
23940			if(eventdata.action === 'instagrammLoaded')
23941				scrollPreviewBlock();
23942		});
23943	}
23944	else
23945		scrollPreviewBlock();
23946
23947
23948	scrollToTop();
23949	checkVerticalMobileFilter();
23950
23951	$('[data-scroll-block]').click(function() {
23952		var _this = $(this);
23953		if(_this.data('scrollBlock')) {
23954			var target = $(_this.data('scrollBlock'));
23955			if(target.length) {
23956				scroll_block(target);
23957			}
23958		}
23959	});
23960
23961	$.extend( $.validator.messages, {
23962		required: BX.message('JS_REQUIRED'),
23963		email: BX.message('JS_FORMAT'),
23964		equalTo: BX.message('JS_PASSWORD_COPY'),
23965		minlength: BX.message('JS_PASSWORD_LENGTH'),
23966		remote: BX.message('JS_ERROR')
23967	});
23968
23969	$.validator.addMethod(
23970		'regexp', function( value, element, regexp ){
23971			var re = new RegExp( regexp );
23972			return this.optional( element ) || re.test( value );
23973		},
23974		BX.message('JS_FORMAT')
23975	);
23976
23977	$.validator.addMethod(
23978		'filesize', function( value, element, param ){
23979			return this.optional( element ) || ( element.files[0].size <= param )
23980		},
23981		BX.message('JS_FILE_SIZE')
23982	);
23983
23984	$.validator.addMethod(
23985		'date', function( value, element, param ) {
23986			var status = false;
23987			if(!value || value.length <= 0){
23988				status = false;
23989			}
23990			else{
23991				// html5 date allways yyyy-mm-dd
23992				var re = new RegExp('^([0-9]{4})(.)([0-9]{2})(.)([0-9]{2})$');
23993				var matches = re.exec(value);
23994				if(matches){
23995					var composedDate = new Date(matches[1], (matches[3] - 1), matches[5]);
23996					status = ((composedDate.getMonth() == (matches[3] - 1)) && (composedDate.getDate() == matches[5]) && (composedDate.getFullYear() == matches[1]));
23997				}
23998				else{
23999					// firefox
24000					var re = new RegExp('^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})$');
24001					var matches = re.exec(value);
24002					if(matches){
24003						var composedDate = new Date(matches[5], (matches[3] - 1), matches[1]);
24004						status = ((composedDate.getMonth() == (matches[3] - 1)) && (composedDate.getDate() == matches[1]) && (composedDate.getFullYear() == matches[5]));
24005					}
24006				}
24007			}
24008			return status;
24009		}, BX.message('JS_DATE')
24010	);
24011
24012	$.validator.addMethod(
24013		'extension', function(value, element, param){
24014			param = typeof param === 'string' ? param.replace(/,/g, '|') : 'png|jpe?g|gif';
24015			return this.optional(element) || value.match(new RegExp('.(' + param + ')$', 'i'));
24016		}, BX.message('JS_FILE_EXT')
24017	);
24018
24019	$.validator.addMethod(
24020		'captcha', function( value, element, params ){
24021			return $.validator.methods.remote.call(this, value, element,{
24022				url: arAsproOptions['SITE_DIR'] + 'ajax/check-captcha.php',
24023				type: 'post',
24024				data:{
24025					captcha_word: value,
24026					captcha_sid: function(){
24027						return $(element).closest('form').find('input[name="captcha_sid"]').val();
24028					}
24029				}
24030			});
24031		},
24032		BX.message('JS_ERROR')
24033	);
24034
24035	$.validator.addMethod(
24036		'recaptcha', function(value, element, param){
24037			var id = $(element).closest('form').find('.g-recaptcha').attr('data-widgetid');
24038			if(typeof id !== 'undefined'){
24039				return grecaptcha.getResponse(id) != '';
24040			}
24041			else{
24042				return true;
24043			}
24044		}, BX.message('JS_RECAPTCHA_ERROR')
24045	);
24046
24047	$.validator.addClassRules({
24048		'phone':{
24049			regexp: arAsproOptions['THEME']['VALIDATE_PHONE_MASK']
24050		},
24051		'confirm_password':{
24052			equalTo: 'input[name="REGISTER\[PASSWORD\]"]',
24053			minlength: 6
24054		},
24055		'password':{
24056			minlength: 6
24057		},
24058		'inputfile':{
24059			extension: arAsproOptions['THEME']['VALIDATE_FILE_EXT'],
24060			filesize: 5000000
24061		},
24062		'captcha':{
24063			captcha: ''
24064		},
24065		'recaptcha':{
24066			recaptcha: ''
24067		}
24068	});
24069
24070	if(arAsproOptions['THEME']['PHONE_MASK']){
24071		$('input.phone').inputmask('mask', {'mask': arAsproOptions['THEME']['PHONE_MASK']});
24072	}
24073
24074	// init calculate delivery with preview
24075	initCalculatePreview();
24076
24077	/*city*/
24078	$('select.region').on('change', function(){
24079		var val = parseInt($(this).val());
24080		if($('select.city').length)
24081		{
24082			if(val)
24083			{
24084				$('select.city option').hide();
24085				$('select.city option').prop('disabled', 'disabled');
24086				$('select.city option[data-parent_section='+val+']').prop('disabled', '');
24087				$('select.city option:eq(0)').prop('disabled', '');
24088				$('select.city').ikSelect('reset');
24089				$('select.city option[data-parent_section='+val+']').show();
24090			}
24091			else
24092				$('select.city option').prop('disabled', 'disabled');
24093				$('select.city option:eq(0)').prop('disabled', '');
24094				$('select.city').ikSelect('reset');
24095		}
24096	})
24097
24098	$('select.city, select.region').on('change', function(){
24099		var _this = $(this),
24100			val = parseInt(_this.val());
24101		if(_this.hasClass('region'))
24102		{
24103			$('select.city option:eq(0)').show();
24104			$('select.city').val(0);
24105		}
24106
24107		if((_this.hasClass('region') && !val) || _this.hasClass('city'))
24108		{
24109			$.ajax({
24110				type: 'POST',
24111				data: {ID: val},
24112			}).success(function(html){
24113				var ob = BX.processHTML(html);
24114				$('.ajax_items')[0].innerHTML = ob.HTML;
24115				BX.ajax.processScripts(ob.SCRIPT);
24116			})
24117		}
24118	})
24119
24120	$(document).on('mouseenter', '.section-gallery-wrapper .section-gallery-wrapper__item', function(){
24121		$(this).siblings().removeClass('_active');
24122		$(this).addClass('_active');
24123	});
24124
24125	$(document).on('click', ".hint .icon", function(e){
24126		var tooltipWrapp = $(this).closest(".hint");
24127
24128		if(tooltipWrapp.hasClass("active")){
24129			tooltipWrapp.removeClass("active").find(".tooltip").slideUp(200);
24130		}
24131		else{
24132			tooltipWrapp.addClass("active");
24133			tooltipWrapp.find(".tooltip").slideDown(200);
24134			tooltipWrapp.find(".tooltip_close").click(function(e){
24135				e.stopPropagation(); tooltipWrapp.removeClass("active").find(".tooltip").slideUp(100);
24136			});
24137		}
24138		e.stopPropagation();
24139	});
24140
24141	$('.mobile_regions .city_item').on('click', function(e){
24142    	e.preventDefault();
24143    	var _this = $(this);
24144    	$.removeCookie('current_region');
24145		$.cookie('current_region', _this.data('id'), {path: '/',domain: arAsproOptions['SITE_ADDRESS']});
24146		location.href = _this.attr('href');
24147    })
24148
24149	/* toggle */
24150	var $this = this,
24151		previewParClosedHeight = 25;
24152
24153	$('section.toggle > label').prepend($('<i />').addClass('fa fa-plus'));
24154	$('section.toggle > label').prepend($('<i />').addClass('fa fa-minus'));
24155	$('section.toggle.active > p').addClass('preview-active');
24156	$('section.toggle.active > div.toggle-content').slideDown(350, function() {});
24157
24158	$('section.toggle > label').click(function(e){
24159		var parentSection = $(this).parent(),
24160			parentWrapper = $(this).parents('div.toogle'),
24161			previewPar = false,
24162			isAccordion = parentWrapper.hasClass('toogle-accordion');
24163
24164		if(isAccordion && typeof(e.originalEvent) != 'undefined') {
24165			parentWrapper.find('section.toggle.active > label').trigger('click');
24166		}
24167
24168		parentSection.toggleClass('active');
24169
24170		// Preview Paragraph
24171		if( parentSection.find('> p').get(0) ){
24172			previewPar = parentSection.find('> p');
24173			var previewParCurrentHeight = previewPar.css('height');
24174			previewPar.css('height', 'auto');
24175			var previewParAnimateHeight = previewPar.css('height');
24176			previewPar.css('height', previewParCurrentHeight);
24177		}
24178
24179		// Content
24180		var toggleContent = parentSection.find('> div.toggle-content');
24181
24182		if( parentSection.hasClass('active') ){
24183			$(previewPar).animate({
24184				height: previewParAnimateHeight
24185			}, 350, function() {
24186				$(this).addClass('preview-active');
24187			});
24188			toggleContent.slideDown(350, function() {});
24189		}
24190		else{
24191			$(previewPar).animate({
24192				height: previewParClosedHeight
24193			}, 350, function() {
24194				$(this).removeClass('preview-active');
24195			});
24196			toggleContent.slideUp(350, function() {});
24197		}
24198	});
24199
24200	if( typeof $.fn.footable == 'function' ) {
24201		$('.tables-responsive .responsive').footable(); //responsive table
24202	}
24203
24204	$('a[rel=tooltip]').tooltip();
24205	$('span[data-toggle=tooltip]').tooltip();
24206
24207	$('.toggle .more_items').on('click', function(){
24208		$(this).closest('.toggle').find('.collapsed').css('display','inline-block').removeClass('collapsed');
24209		$(this).remove();
24210		if(typeof $(this).data('resize') !== 'undefined' && $(this).data('resize'))
24211			$(window).resize();
24212	})
24213	$('.toggle_menu .more_items').on('click', function(){
24214		$(this).closest('.toggle_menu').find('.collapsed').addClass('clicked_exp');
24215		$(this).remove();
24216	})
24217
24218	/* search sync */
24219	$(document).on('keyup', '.search-input-div input', function(e){
24220		var inputValue = $(this).val();
24221		$('.search-input-div input:not(:focus').val(inputValue);
24222
24223		if($(this).closest('#headerfixed').length)
24224		{
24225			if(e.keyCode == 13)
24226				$('.search form').submit();
24227		}
24228	});
24229	$(document).on('click', '.search-button-div button', function(e){
24230		if($(this).closest('#headerfixed').length)
24231			$('.search form').submit();
24232	});
24233
24234	$('.inline-search-show, .inline-search-hide').on('click', function(e){
24235		CloseMobilePhone();
24236		// if(window.matchMedia('(min-width: 600px)').matches)
24237		// {
24238			if(typeof($(this).data('type_search')) != 'undefined' && $(this).data('type_search') == 'fixed')
24239				$('.inline-search-block').addClass('fixed');
24240
24241			if(arAsproOptions['THEME']['TYPE_SEARCH'] == 'fixed'){
24242				/*setTimeout(function(){
24243					$('.inline-search-block.fixed.big .search-input').focus();
24244				}, 200);*/
24245				$('.inline-search-block.fixed.big .search-input').focus();
24246			}
24247			if(arAsproOptions['THEME']['TYPE_SEARCH'] != 'fixed')
24248			{
24249				$('#title-search-input').focus();
24250			}
24251
24252			$('.inline-search-block').toggleClass('show');
24253			if($('.top-block').length)
24254			{
24255				if($('.inline-search-block').hasClass('show'))
24256					$('.inline-search-block').css('background', $('.top-block').css('background-color'));
24257				else
24258					$('.inline-search-block').css('background', '#fff');
24259			}
24260			if(arAsproOptions['THEME']['TYPE_SEARCH'] == 'fixed')
24261			{
24262				if($('.inline-search-block').hasClass('show'))
24263					$('<div class="jqmOverlay search"></div>').appendTo('body');
24264				else{
24265					$('#title-search-input').blur();
24266					$('.jqmOverlay').detach();
24267				}
24268			}
24269		// }
24270		// else
24271		// 	location.href = arAsproOptions['PAGES']['CATALOG_PAGE_URL']+'?q';
24272	})
24273
24274	/* close search block */
24275	$("html, body").on('mousedown', function(e){
24276		if(typeof e.target.className == 'string' && e.target.className.indexOf('adm') < 0)
24277		{
24278			e.stopPropagation();
24279			var search_target = $(e.target).closest('.title-search-result');
24280			if(!$(e.target).hasClass('inline-search-block') && !$(e.target).hasClass('svg') && !search_target.length)
24281			{
24282				$('.inline-search-block').removeClass('show');
24283				$('.title-search-result').hide();
24284				if(arAsproOptions['THEME']['TYPE_SEARCH'] == 'fixed')
24285					$('.jqmOverlay.search').detach();
24286			}
24287
24288			if($("#mobilePhone").length){
24289                CloseMobilePhone();
24290            }
24291
24292			if($('#basket_line .basket_fly').length && parseInt($("#basket_line .basket_fly").css("right")) >= 0){
24293				if(!$(e.target).closest('.basket_wrapp').length)
24294				{
24295					$("#basket_line .basket_fly").stop().animate({"right": -$("#basket_line .basket_fly").outerWidth()}, 150);
24296					$("#basket_line .basket_fly .opener > div").removeClass("cur");
24297					$('#basket_line .basket_fly').removeClass('swiped');
24298				}
24299			}
24300
24301			if(isMobile)
24302			{
24303				if(search_target.length)
24304					location.href = search_target.attr('href');
24305			}
24306
24307			if(!$(e.target).closest('.js-info-block').length && !$(e.target).closest('.js-show-info-block').length)
24308			{
24309				$('.js-show-info-block').removeClass('opened');
24310				$('.js-info-block').fadeOut();
24311			}
24312
24313			if(!$(e.target).closest('.hint.active').length)
24314			{
24315				$('.hint.active .icon').trigger('click');
24316			}
24317
24318			var class_name = $(e.target).attr('class');
24319			if(typeof(class_name) == 'undefined' || class_name.indexOf('tooltip') < 0) //tooltip link
24320				$('.tooltip-link').tooltip('hide');
24321		}
24322	});
24323	$('.inline-search-block').find('*').on('mousedown', function(e){
24324		e.stopPropagation();
24325	});
24326
24327	initAnimateLoad();
24328
24329	/*check all opt table items*/
24330	$(document).on('change', "input#select_all_items", function(){
24331		var _this = $(this);
24332
24333		var notOfferCount = $('.table-view__item:not([data-product_type=3])').find('.button_block .to-cart').length;
24334		var wishCount = $('.table-view__item:not([data-product_type=3])').find('.item-icons .wish_item_button .wish_item.to').length;
24335		var allGoodsCount = $('.table-view__item').length;
24336
24337		if(_this.is(':checked'))
24338		{
24339			//$('.opt_action').removeClass('no-action');
24340
24341			//buy && wish
24342			if(notOfferCount != 0){
24343				$('.opt_action:not([data-action=compare])').removeClass('no-action');
24344			}
24345
24346			//compare
24347			$('.opt_action[data-action=compare]').removeClass('no-action');
24348
24349
24350			$('.opt_action').addClass('animate-load');
24351			$('.opt_action .text').remove();
24352			//$('<div class="text muted">(<span>'+$('.table-view__item').length+'</span>)</div>').appendTo($('.opt_action'));
24353			//$('<div class="text muted">(<span>' + $('.table-view__item:not([data-product_type=3])').length + '</span>)</div>').appendTo($('.opt_action'));
24354
24355			//buy
24356			$('<div class="text muted">(<span>' + notOfferCount + '</span>)</div>').appendTo($('.opt_action[data-action=buy]'));
24357
24358			//wish
24359			$('<div class="text muted">(<span>' + wishCount + '</span>)</div>').appendTo($('.opt_action[data-action=wish]'));
24360
24361			//compare
24362			$('<div class="text muted">(<span>' + allGoodsCount + '</span>)</div>').appendTo($('.opt_action[data-action=compare]'));
24363
24364
24365			$('input[name="chec_item"]').prop('checked', 'checked');
24366		}
24367		else
24368		{
24369			$('.opt_action').addClass('no-action');
24370			$('.opt_action').removeClass('animate-load');
24371			$('.opt_action .text').remove();
24372
24373			$('input[name="chec_item"]').removeAttr('checked');
24374		}
24375	})
24376
24377	/*check opt table item*/
24378	$(document).on('change', "input[name='chec_item']", function(){
24379		var _this = $(this);
24380
24381		var canBuy = _this.closest('.table-view__item').find('.button_block .to-cart').length;
24382		var isOffer = _this.closest('.main_item_wrapper').attr('data-product_type') == '3';
24383
24384		if(_this.is(':checked'))
24385		{
24386			$('.opt_action').each(function(){
24387				var _this = $(this);
24388
24389				var isBuyAction = _this.attr('data-action') == 'buy';
24390				var isWishAction = _this.attr('data-action') == 'wish';
24391
24392				if(isOffer && (isBuyAction || isWishAction)){
24393					return true;
24394				}
24395
24396				if(isBuyAction && !canBuy) {
24397					return true;
24398				}
24399
24400				if(_this.find('.text').length)
24401				{
24402					var count = parseInt(_this.find('.text span').text());
24403					_this.find('.text span').text(++count);
24404				}
24405				else
24406				{
24407					_this.removeClass('no-action');
24408					_this.addClass('animate-load');
24409					$('<div class="text muted">(<span>1</span>)</div>').appendTo(_this);
24410				}
24411			})
24412		}
24413		else
24414		{
24415			$('.opt_action').each(function(){
24416				var _this = $(this);
24417
24418				var isBuyAction = _this.attr('data-action') == 'buy';
24419				var isWishAction = _this.attr('data-action') == 'wish';
24420
24421				if(isOffer && (isBuyAction || isWishAction)){
24422					return true;
24423				}
24424
24425				if(isBuyAction && !canBuy) {
24426					return true;
24427				}
24428
24429				if(_this.find('.text').length)
24430				{
24431					var count = parseInt(_this.find('.text span').text());
24432					--count
24433					_this.find('.text span').text(count);
24434
24435					if(!count)
24436					{
24437						_this.addClass('no-action');
24438						_this.removeClass('animate-load');
24439						_this.find('.text').remove();
24440					}
24441				}
24442			})
24443		}
24444	})
24445
24446	/*buy|wish|compare opt table items*/
24447	$(document).on('click', ".opt_action", function(){
24448		var _this = $(this),
24449			action = _this.data('action'),
24450			basketParams = {
24451				type: 'multiple',
24452				iblock_id: _this.data('iblock_id'),
24453				action: action,
24454				items: {}
24455			};
24456
24457		if(!_this.hasClass('no-action'))
24458		{
24459			$('.opt_action').addClass('no-action');
24460			_this.removeClass('no-action');
24461
24462			$('.table-view__item').each(function(){
24463				var _this = $(this);
24464				var canBuy = _this.find('.button_block .to-cart').length; 
24465				var add = _this.find('input[name="chec_item"]').is(':checked') && (canBuy || (action != "buy") );
24466				if(add)
24467				{
24468					basketParams['items'][_this.data('id')] = {};
24469					basketParams['items'][_this.data('id')]['id'] = _this.data('id');
24470					basketParams['items'][_this.data('id')]['product_type'] = _this.data('product_type');
24471					basketParams['items'][_this.data('id')]['quantity'] = _this.find('input[name="quantity"]').val();
24472				}
24473			})
24474			$.ajax({
24475				type:"POST",
24476				url:arAsproOptions['SITE_DIR']+"ajax/item.php",
24477				data:basketParams,
24478				dataType:"json",
24479				success:function(data){
24480					if("STATUS" in data)
24481					{
24482						if(data.STATUS !== 'OK')
24483						{
24484							showBasketError(BX.message(data.MESSAGE)+' <br/>'+data.MESSAGE_EXT);
24485						}
24486						if($('.header-cart.fly').length)
24487						{
24488							arBasketAsproCounters.DEFAULT = true;
24489							SetActualBasketFlyCounters(true);
24490						}
24491						else
24492						{
24493							if($("#ajax_basket").length)
24494							{
24495								reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'N', '', true);
24496							}
24497							else{
24498								reloadBasketCounters('', true);
24499							}
24500						}
24501					}
24502					_this.parent().removeClass('loadings');
24503					$('.opt_action').removeClass('no-action');
24504				}
24505			})
24506		}
24507	})
24508
24509
24510
24511	//fix opt checked for back in browser
24512	setTimeout(function(){
24513		if($('.with-opt-buy input[name="chec_item"], .with-opt-buy input[name="select_all_items"]').length){
24514			$('.with-opt-buy input[name="chec_item"], .with-opt-buy input[name="select_all_items"]').prop('checked', false);
24515		}
24516	},1);
24517
24518
24519
24520	/*check mobile device*/
24521	if(isMobile){
24522		$(document).on('click', '*[data-event="jqm"]', function(e){
24523
24524			e.preventDefault();
24525			e.stopPropagation();
24526			var _this = $(this);
24527			var name = _this.data('name');
24528
24529			if((window.matchMedia('(min-width:768px)').matches || (typeof _this.data('no-mobile') !== 'undefinde' && _this.data('no-mobile') == 'Y')))
24530			{
24531				if(!$(this).hasClass('clicked'))
24532				{
24533					$(this).addClass('clicked');
24534					$(this).jqmEx();
24535					$(this).trigger('click');
24536				}
24537				return false;
24538			}
24539			else if(name.length){
24540				var script = arAsproOptions['SITE_DIR'] + 'form/';
24541				var paramsStr = ''; var arTriggerAttrs = {};
24542				$.each(_this.get(0).attributes, function(index, attr){
24543					var attrName = attr.nodeName;
24544					var attrValue = _this.attr(attrName);
24545					arTriggerAttrs[attrName] = attrValue;
24546					if(/^data\-param\-(.+)$/.test(attrName)){
24547						var key = attrName.match(/^data\-param\-(.+)$/)[1];
24548						paramsStr += key + '=' + attrValue + '&';
24549					}
24550				});
24551
24552				var triggerAttrs = JSON.stringify(arTriggerAttrs);
24553				var encTriggerAttrs = encodeURIComponent(triggerAttrs);
24554				script += '?name=' + name + '&' + paramsStr + 'data-trigger=' + encTriggerAttrs;
24555
24556				if (previewMode && _this.attr('href') !== undefined) {
24557					script = _this.attr('href')
24558				}
24559
24560				location.href = script;
24561			}
24562		});
24563
24564		$('.fancybox').removeClass('fancybox');
24565	}
24566	else
24567	{
24568		$(document).on('click', '*[data-event="jqm"]', function(e){
24569			e.preventDefault();
24570			e.stopPropagation();
24571
24572			var _this = $(this);
24573			var name = _this.data('name');
24574			if (previewMode && ((name.length && name == 'auth') || window.matchMedia('(max-width:400px)').matches)) {
24575
24576				var script = arAsproOptions['SITE_DIR'] + 'form/';
24577				var paramsStr = ''; var arTriggerAttrs = {};
24578				$.each(_this.get(0).attributes, function(index, attr){
24579					var attrName = attr.nodeName;
24580					var attrValue = _this.attr(attrName);
24581					arTriggerAttrs[attrName] = attrValue;
24582					if(/^data\-param\-(.+)$/.test(attrName)){
24583						var key = attrName.match(/^data\-param\-(.+)$/)[1];
24584						paramsStr += key + '=' + attrValue + '&';
24585					}
24586				});
24587
24588				var triggerAttrs = JSON.stringify(arTriggerAttrs);
24589				var encTriggerAttrs = encodeURIComponent(triggerAttrs);
24590				script += '?name=' + name + '&' + paramsStr + 'data-trigger=' + encTriggerAttrs;
24591
24592				if (_this.attr('href') !== undefined) {
24593					script = _this.attr('href')
24594				}
24595
24596					location.href = script;
24597			} else {
24598				if(!$(this).hasClass('clicked'))
24599				{
24600					$(this).addClass('clicked');
24601					$(this).jqmEx();
24602					$(this).trigger('click');
24603				}
24604			}
24605
24606			return false;
24607		});
24608	}
24609
24610	BX.addCustomEvent('onCompleteAction', function(eventdata, _this){
24611		try{
24612			if(eventdata.action === 'loadForm')
24613			{
24614				$(_this).parent().removeClass('loadings');
24615				$(_this).removeClass('clicked');
24616
24617				if($(_this).hasClass('one_click_buy_trigger'))
24618				{
24619					$('.wrapp_one_click > span').removeClass('clicked')
24620					$('.one_click').removeClass('clicked')
24621				}
24622				else if($(_this).hasClass('one_click_buy_basket_trigger'))
24623				{
24624					$('.fast_order').removeClass('clicked')
24625				}
24626			}
24627			else if(eventdata.action === 'loadBasket')
24628			{
24629				$('.basket-link.basket').attr('title', $('<div/>').html(arBasketPrices.BASKET_SUMM_TITLE).text());
24630				$('.basket-link.delay').attr('title', $('<div/>').html(arBasketPrices.DELAY_SUMM_TITLE).text());
24631
24632				if(arBasketPrices.BASKET_COUNT>0)
24633				{
24634					$('.basket-link.basket').addClass('basket-count');
24635					$('.basket-link.basket .count').removeClass('empted');
24636					if($('.basket-link.basket .prices').length)
24637						$('.basket-link.basket .prices').html(arBasketPrices.BASKET_SUMM);
24638				}
24639				else
24640				{
24641					$('.basket-link.basket').removeClass('basket-count');
24642					$('.basket-link.basket .count').addClass('empted');
24643					if($('.basket-link.basket .prices').length)
24644						$('.basket-link.basket .prices').html(arBasketPrices.BASKET_SUMM_TITLE_SMALL);
24645				}
24646				$('.basket-link.basket .count').text(arBasketPrices.BASKET_COUNT);
24647				if(arBasketPrices.DELAY_COUNT>0)
24648				{
24649					$('.basket-link.delay').addClass('basket-count');
24650					$('.basket-link.delay .count').removeClass('empted');
24651				}
24652				else
24653				{
24654					$('.basket-link.delay').removeClass('basket-count');
24655					$('.basket-link.delay .count').addClass('empted');
24656				}
24657				$('.basket-link.delay .count').text(arBasketPrices.DELAY_COUNT);
24658
24659				updateBottomIconsPanel(arBasketPrices);
24660			}
24661			else if(eventdata.action === 'loadActualBasketCompare')
24662			{
24663				var compare_count = Object.keys(arBasketAspro.COMPARE).length;
24664				if(compare_count>0)
24665				{
24666					$('.basket-link.compare').addClass('basket-count');
24667					$('.basket-link.compare .count').removeClass('empted');
24668					if($('#compare_fly').length)
24669						$('#compare_fly').removeClass('empty_block');
24670				}
24671				else
24672				{
24673					$('.basket-link.compare').removeClass('basket-count');
24674					$('.basket-link.compare .count').addClass('empted');
24675					if($('#compare_fly').length)
24676						$('#compare_fly').addClass('empty_block');
24677				}
24678				$('.basket-link.compare .count').text(compare_count);
24679
24680				updateBottomIconsPanel(arBasketAspro);
24681			}
24682			else if(eventdata.action === 'loadRSS')
24683			{
24684			}
24685			else if(eventdata.action === 'ajaxContentLoaded')
24686			{
24687			}
24688			else if(eventdata.action === 'jsLoadBlock')
24689			{
24690				initCountdown();
24691				setStatusButton();
24692				InitFlexSlider();
24693				InitOwlSlider();
24694				InitFancyBox();
24695
24696				checkLinkedArticles();
24697				checkLinkedBlocks('.linked-banners-list');
24698				lazyLoadPagenBlock();
24699
24700				if(typeof window['stickySidebar'] !== 'undefined')
24701				{
24702					window['stickySidebar'].updateSticky();
24703				}
24704			}
24705		}
24706		catch(e){
24707			console.error(e)
24708		}
24709	})
24710
24711	/*slices*/
24712	if($('.banners-small .item.normal-block').length)
24713		$('.banners-small .item.normal-block').sliceHeight();
24714	if($('.teasers .item').length)
24715		$('.teasers .item').sliceHeight();
24716	if($('.wrap-portfolio-front .row.items > div').length)
24717		$('.wrap-portfolio-front .row.items > div').sliceHeight({'row': '.row.items', 'item': '.item1'});
24718
24719	/* bug fix in ff*/
24720	$('img').removeAttr('draggable');
24721
24722	$('.title-tab-heading').on('click', function(){
24723		var container = $(this).parent(),
24724			slide_block = $(this).next(),
24725			bReviewTab = container.hasClass('media_review');
24726
24727		clicked_tab = container.index()+1;
24728
24729		container.siblings().removeClass('active');
24730
24731		$('.nav.nav-tabs li').removeClass('active');
24732
24733		if(container.hasClass('active'))
24734		{
24735			if(bReviewTab)
24736			{
24737				$('#reviews_content').slideUp(200, function(){
24738					container.removeClass('active');
24739				});
24740			}
24741			else
24742			{
24743				slide_block.slideUp(200, function(){
24744					container.removeClass('active');
24745				});
24746			}
24747		}
24748		else
24749		{
24750			container.addClass('active');
24751			if(bReviewTab)
24752			{
24753				$('#reviews_content').slideDown();
24754			}
24755			else
24756			{
24757				if($('.tabs_section + #reviews_content').length)
24758					$('.tabs_section + #reviews_content').slideUp();
24759				slide_block.slideDown();
24760				if(typeof container.attr('id') !== 'undefined' && container.attr('id') == 'descr'){
24761					var $gallery = $('.galerys-block');
24762					if($gallery.length){
24763						var bTypeBig = $gallery.find('.big_slider').length;
24764						var $slider = bTypeBig ? $gallery.find('.big_slider') : $gallery.find('.small_slider');
24765						InitFlexSlider();
24766						var interval = setInterval(function(){
24767							if($slider.find('.slides .item').attr('style').indexOf('height') === -1){
24768								$(window).resize();
24769							}
24770							else{
24771								clearInterval(interval);
24772							}
24773						}, 100);
24774					}
24775				}
24776			}
24777		}
24778	})
24779
24780	InitFlexSlider();
24781	InitOwlSlider();
24782	InitStickySideBar();
24783	InitFancyBox();
24784	InitFancyBoxVideo();
24785
24786	setTimeout(function(){
24787		InitTopestMenuGummi();
24788		isOnceInited = true;
24789	},50);
24790
24791	InitZoomPict();
24792
24793	$(document).on('click', '.captcha_reload', function(e){
24794		var captcha = $(this).parents('.captcha-row');
24795		e.preventDefault();
24796		$.ajax({
24797			url: arAsproOptions['SITE_DIR'] + 'ajax/captcha.php'
24798		}).done(function(text){
24799			captcha.find('input[name=captcha_sid],input[name=captcha_code]').val(text);
24800			captcha.find('img').attr('src', '/bitrix/tools/captcha.php?captcha_sid=' + text);
24801			captcha.find('input[name=captcha_word]').val('').removeClass('error');
24802			captcha.find('.captcha_input').removeClass('error').find('.error').remove();
24803		});
24804	});
24805
24806	/* show print */
24807	if(arAsproOptions["PAGES"]["BASKET_PAGE"]){
24808		showBasketHeadingBtn();
24809	}
24810	else{
24811		if(arAsproOptions['THEME']['PRINT_BUTTON'] === 'Y'){
24812			setTimeout(function(){
24813				var topicHeading = document.querySelector('.period_wrapper.in-detail-news1 .period_wrapper_inner') ? document.querySelector('.detail-news1 .period_wrapper .period_wrapper_inner') : (document.querySelector('.page-top .topic .topic__heading') ? document.querySelector('.page-top .topic .topic__heading') : null);
24814				if(topicHeading){
24815					var btnPrint = BX.create({
24816						tag: 'div',
24817						attrs: {
24818							class: 'print-link colored_theme_hover_bg-block',
24819							title: arAsproOptions['THEME']["EXPRESSION_FOR_PRINT_PAGE"],
24820						},
24821						html: '<i class="svg colored_theme_hover_bg-el-svg"><svg class="svg svg-print" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path id="Rectangle_665_copy_4" data-name="Rectangle 665 copy 4" class="cls-print" d="M1570,210h-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,1570,210Zm-8,1h4v-4h-4v4Zm4-12h-4v2h4v-2Zm4,4h-12v5h2v-3h8v3h2v-5Z" transform="translate(-1556 -197)"></path></svg></i>',
24822					});
24823					BX.insertBefore(btnPrint, topicHeading);
24824				}
24825			},150);
24826		}
24827	}
24828
24829	$(document).on('click', '.print-link', function(){
24830		window.print();
24831	})
24832
24833	$('.head-block .item-link').on('click', function(){
24834		var _this = $(this);
24835		_this.siblings().removeClass('active');
24836		_this.addClass('active');
24837	})
24838
24839	$('table.table').each(function(){
24840		var _this = $(this),
24841			first_td = _this.find('thead tr th');
24842		if(!first_td.length)
24843			first_td = _this.find('thead tr td');
24844		if(first_td.length)
24845		{
24846			var j = 0;
24847			_this.find('tbody tr td').each(function(i){
24848				if(j > first_td.length-1)
24849					j = 0;
24850				$('<div class="th-mobile">'+first_td[j].textContent+'</div>').appendTo($(this));
24851				j++;
24852			})
24853		}
24854	})
24855
24856	if(window.matchMedia('(min-width: 768px)').matches)
24857		$('.wrapper_middle_menu.wrap_menu').removeClass('mobile');
24858
24859
24860	if(window.matchMedia('(max-width: 767px)').matches)
24861		$('.wrapper_middle_menu.wrap_menu').addClass('mobile');
24862
24863
24864
24865	$('.menu_top_block .v_bottom a').on('click', function(e){
24866		if($(e.target).hasClass('toggle_block'))
24867			e.preventDefault();
24868	})
24869	$('.menu_top_block .v_bottom a .toggle_block').click(function(e){
24870		var _this = $(this),
24871			menu = _this.closest('.has-child').find('> .dropdown'),
24872			bVisibleMeu = (menu.is(':visible')),
24873			animate = (bVisibleMeu ? 'slideUp' : 'slideDown');
24874
24875		if(!_this.hasClass('clicked'))
24876		{
24877			_this.addClass('clicked');
24878
24879
24880			menu.velocity('stop').velocity(animate, {
24881				duration: 150,
24882				// delay: 250,
24883				begin: function(){
24884					_this.toggleClass('closed');
24885				},
24886				complete: function(){
24887					_this.removeClass('clicked');
24888
24889					if(typeof window['stickySidebar'] !== 'undefined')
24890						window['stickySidebar'].updateSticky();
24891				}
24892			});
24893		}
24894
24895		$(this).closest('.has-child').toggleClass('opened');
24896	})
24897
24898	$(document).on('click', '.show_props', function(){
24899		$(this).prev().stop().slideToggle(333);
24900		$(this).find('.char_title').toggleClass('opened');
24901	});
24902
24903	$('.see_more').on('click', function(e) {
24904		e.preventDefault();
24905		var see_more = ($(this).is('.see_more') ? $(this) : $(this).parents('.see_more').first());
24906		var see_moreText = (see_more.find('> a').length ? see_more.find('> a') : see_more);
24907		var see_moreHiden = see_more.parent().find('> .d');
24908		if(see_more.hasClass('open')){
24909			see_moreText.text(BX.message('CATALOG_VIEW_MORE'));
24910			see_more.removeClass('open');
24911			see_moreHiden.hide();
24912		}
24913		else{
24914			see_moreText.text(BX.message('CATALOG_VIEW_LESS'));
24915			see_more.addClass('open');
24916			see_moreHiden.show();
24917		}
24918		return false;
24919	});
24920
24921	$('.button.faq_button').click(function(e){
24922		e.preventDefault();
24923		$(this).toggleClass('opened');
24924		$('.faq_ask .form').slideToggle();
24925	});
24926
24927	$('.staff.list .staff_section .staff_section_title a').click(function(e) {
24928		e.preventDefault();
24929		$(this).parents('.staff_section').toggleClass('opened');
24930		$(this).parents('.staff_section').find('.staff_section_items').stop().slideToggle(600);
24931		$(this).parents('.staff_section_title').find('.opener_icon').toggleClass('opened');
24932	});
24933
24934	$('.jobs_wrapp .item .name').click(function(e) {
24935		$(this).closest('.item').toggleClass('opened');
24936		$(this).closest('.item').find('.description_wrapp').stop().slideToggle(600);
24937		$(this).closest('.item').find('.opener_icon').toggleClass('opened');
24938	});
24939
24940	$('.faq.list .item .q a').on('click', function(e){
24941		e.preventDefault();
24942		$(this).parents('.item').toggleClass('opened');
24943		$(this).parents('.item').find('.a').stop().slideToggle();
24944		$(this).parents('.item').find('.q .opener_icon').toggleClass('opened');
24945	});
24946
24947	$('.opener_icon').click(function(e) {
24948		e.preventDefault();
24949		$(this).parent().find('a').trigger('click');
24950	});
24951
24952	$('.dotdot').dotdotdot();
24953
24954	$('.more_block span').on('click', function() {
24955		var content_offset=$('.catalog_detail .tabs_section').offset();
24956		$('html, body').animate({scrollTop: content_offset.top-43}, 400);
24957	});
24958
24959	$(document).on("click", ".counter_block:not(.basket) .plus", function(){
24960		if(!$(this).parents('.basket_wrapp').length || $(this).parents('.services_in_basket').length){
24961			if($(this).parent().data("offers")!="Y"){
24962				var isDetailSKU2 = $(this).parents('.counter_block_wr').length;
24963					input = $(this).parents(".counter_block").find("input[type=text]")
24964					tmp_ratio = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
24965					
24966					isDblQuantity = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
24967					ratio=( isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
24968					max_value='';
24969					currentValue = input.val();
24970
24971
24972				if(isDblQuantity)
24973					ratio = Math.round(ratio*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor;
24974
24975				curValue = (isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10));
24976
24977
24978				curValue += ratio;
24979				if (isDblQuantity){
24980					curValue = Math.round(curValue*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor;
24981				}
24982
24983				if(parseFloat($(this).data('max'))>0){
24984					if(input.val() < $(this).data('max')){
24985						if(curValue<=$(this).data('max'))
24986							input.val(curValue);
24987
24988						input.change();
24989					}
24990				}else{
24991					input.val(curValue);
24992					input.change();
24993				}
24994			}
24995		}
24996	});
24997	$(document).on("click", ".counter_block:not(.basket) .minus", function(){
24998		if(!$(this).parents('.basket_wrapp').length  || $(this).parents('.services_in_basket').length){
24999			if($(this).parent().data("offers")!="Y"){
25000				var isDetailSKU2 = $(this).parents('.counter_block_wr').length;
25001					input = $(this).parents(".counter_block").find("input[type=text]")
25002					tmp_ratio = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
25003					isDblQuantity = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
25004					ratio=( isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
25005					max_value='';
25006					currentValue = input.val();
25007
25008				if(isDblQuantity)
25009					ratio = Math.round(ratio*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor;
25010
25011				curValue = (isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10));
25012
25013				curValue -= ratio;
25014				if (isDblQuantity){
25015					curValue = Math.round(curValue*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor;
25016				}
25017
25018				if(parseFloat($(this).parents(".counter_block").find(".plus").data('max'))>0){
25019					if(currentValue > ratio){
25020						if(curValue<ratio){
25021							input.val(ratio);
25022						}else{
25023							input.val(curValue);
25024						}
25025						input.change();
25026					}
25027				}else{
25028					if(curValue > ratio){
25029						input.val(curValue);
25030					}else{
25031						if(ratio){
25032							input.val(ratio);
25033						}else if(currentValue > 1){
25034							input.val(curValue);
25035						}
25036					}
25037					input.change();
25038				}
25039			}
25040		}
25041	});
25042
25043	$('.counter_block input[type=text]').numeric({allow:"."});
25044
25045	$(document).on("focus", ".counter_block input[type=text]", function(e){
25046		$(this).addClass('focus');
25047	})
25048
25049	$(document).on("blur", ".counter_block input[type=text]", function(e){
25050		$(this).removeClass('focus');
25051	})
25052
25053	var timerInitCalculateDelivery = false;
25054	$(document).on("change", ".counter_block input[type=text]", function(e){
25055		if(!$(this).parents('.basket_wrapp').length){
25056			var val = $(this).val(),
25057				tmp_ratio = $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
25058				isDblQuantity = $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') ? $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
25059				ratio=( isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
25060				diff = val % ratio;
25061
25062			if(isDblQuantity)
25063			{
25064				ratio = Math.round(ratio*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor;
25065				if(Math.round(diff*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor == ratio)
25066					diff = 0;
25067			}
25068
25069			if($(this).hasClass('focus'))
25070			{
25071				intCount = Math.round(
25072					Math.round(val * arAsproOptions.JS_ITEM_CLICK.precisionFactor / ratio) / arAsproOptions.JS_ITEM_CLICK.precisionFactor
25073				) || 1;
25074				val = (intCount <= 1 ? ratio : intCount * ratio);
25075				// val -= diff;
25076				val = Math.round(val*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor;
25077			}
25078
25079			if(parseFloat($(this).parents(".counter_block").find(".plus").data('max'))>0){
25080				if(val>parseFloat($(this).parents(".counter_block").find(".plus").data('max'))){
25081					val=parseFloat($(this).parents(".counter_block").find(".plus").data('max'));
25082					// val -= (val % ratio);
25083				}
25084			}
25085			if(val<ratio){
25086				val=ratio;
25087			}else if(!parseFloat(val)){
25088				val=1;
25089			}
25090
25091			$(this).parents('.counter_block').parent().parent().find('.to-cart').attr('data-quantity', val);
25092			$(this).parents('.counter_block').parent().parent().parent().find('.one_click').attr('data-quantity', val);
25093			$(this).parents('.counter_block').parent().parent().parent().parent().find('.one_click').attr('data-quantity', val);//for offers in list
25094			$(this).parents('.catalog_item_wrapp').find('.inner_wrap.TYPE_1 .one_click').attr('data-quantity', val);//for first type buttons in catalog_block
25095			
25096			$(this).val(val);
25097
25098			var $calculate = $(this).closest('.item').length ? $(this).closest('.item').find('.calculate-delivery') : $(this).closest('.catalog_detail').find('.calculate-delivery');
25099			if($calculate.length){
25100				$calculate.each(function(){
25101					var $calculateSpan = $(this).find('span[data-event=jqm]').first();
25102
25103					if($calculateSpan.length){
25104						var $clone = $calculateSpan.clone();
25105						$clone.attr('data-param-quantity', val).removeClass('clicked');
25106						$clone.insertAfter($calculateSpan).on('click', function(){
25107							if(!jQuery.browser.mobile){
25108								$(this).parent().addClass('loadings');
25109							}
25110						});
25111						$calculateSpan.remove();
25112					}
25113
25114					if($(this).hasClass('with_preview')){
25115						$(this).removeClass('inited');
25116
25117						if(timerInitCalculateDelivery){
25118							clearTimeout(timerInitCalculateDelivery);
25119						}
25120
25121						timerInitCalculateDelivery = setTimeout(function(){
25122							initCalculatePreview();
25123							timerInitCalculateDelivery = false;
25124						}, 1000);
25125					}
25126				});
25127			}
25128
25129			var eventdata = {type: 'change', params: {id: $(this), value: val}};
25130			BX.onCustomEvent('onCounterProductAction', [eventdata]);
25131		}
25132	});
25133
25134	BX.addCustomEvent('onCounterProductAction', function(eventdata) {
25135		if(typeof eventdata != 'object'){
25136			eventdata = {type: 'undefined'};
25137		}
25138		try{
25139			if(typeof eventdata.type != 'undefined'){
25140				if(!eventdata.params.id.closest('.gifts').length) // no gift
25141				{
25142					var obProduct = eventdata.params.id.data('product');
25143					if(eventdata.params.id.closest('.has_offer_prop').length) // type1 for offers in element list
25144					{
25145						if(typeof window['obSkuQuantys'] === 'undefined')
25146							window["obSkuQuantys"] = {};
25147
25148						// if(typeof window['obOffers'] === 'undefined')
25149							window["obSkuQuantys"][eventdata.params.id.closest('.offer_buy_block').find('.to-cart').data('item')] = eventdata.params.value;
25150					}
25151					if(typeof window[obProduct] == 'object')
25152					{
25153						if(obProduct == "obOffers")
25154							setPriceAction('', '', 'Y');
25155						else
25156							window[obProduct].setPriceAction('Y');
25157						if ($('.detail_page').length) {
25158							setNewHeader()
25159						}
25160					}
25161					else if(eventdata.params.id.length)
25162					{
25163						if(eventdata.params.id.closest('.main_item_wrapper').length && arAsproOptions['THEME']['SHOW_TOTAL_SUMM'] == 'Y')
25164						{
25165							setPriceItem(eventdata.params.id.closest('.main_item_wrapper'), eventdata.params.value);
25166						}
25167					}
25168					BX.onCustomEvent('onCounterProductActionResize');
25169				}
25170			}
25171		}
25172		catch(e){
25173			console.error(e)
25174		}
25175	});
25176
25177	/*show basket on hover */
25178	$(document).on('mouseenter', '.wrap_icon.top_basket, #headerfixed .basket-link.basket', function() {
25179
25180		var _this = $(this);
25181		var parent = _this.closest('header, #headerfixed');
25182		var hover_block = parent.find('.basket_hover_block');
25183
25184		if(!hover_block.hasClass('loaded')) {
25185			basketTop('', hover_block);
25186		}
25187	});
25188
25189	/*show basket on click mobile */
25190	$(document).on('click', '.wrap_icon.wrap_basket.top_basket, #headerfixed .basket-link.basket', function(e) {
25191		var _this = $(this);
25192		if(isMobile) {
25193			if(!_this.hasClass('clicked')) {
25194				e.preventDefault();
25195				_this.addClass('clicked');
25196				setTimeout(function(){
25197					_this.removeClass('clicked');
25198				}, 3000);
25199			}
25200		}
25201	});
25202
25203	/*slide cart*/
25204	$(document).on('mouseenter', '#basket_line .basket_normal:not(.empty_cart):not(.bcart) .basket_block ', function() {
25205		$(this).closest('.basket_normal').find('.popup').addClass('block');
25206		$(this).closest('.basket_normal').find('.basket_popup_wrapp').stop(true,true).slideDown(150);
25207	});
25208	$(document).on('mouseleave', '#basket_line .basket_normal .basket_block ', function() {
25209		var th=$(this);
25210		$(this).closest('.basket_normal').find('.basket_popup_wrapp').stop(true,true).slide
25210Up(150, function(){
25211			th.closest('.basket_normal').find('.popup').removeClass('block');
25212		});
25213	});
25214
25215	$(document).on('click', '.popup_button_basket', function(){
25216		var th=$(".to-cart[data-item="+$(this).data("item")+"]");
25217
25218		var val = th.attr('data-quantity');
25219
25220		if(!val) $val = 1;
25221
25222		var tmp_props=th.data("props"),
25223			props='',
25224			part_props='',
25225			add_props='N',
25226			fill_prop={},
25227			iblockid = th.data('iblockid'),
25228			offer = th.data('offers'),
25229			rid='',
25230			basket_props='',
25231			item = th.attr('data-item');
25232
25233		if(offer!="Y"){
25234			offer = "N";
25235		}else{
25236			basket_props=th.closest('.prices_tab').find('.bx_sku_props input').val();
25237		}
25238		if(tmp_props){
25239			props=tmp_props.split(";");
25240		}
25241		if(th.data("part_props")){
25242			part_props=th.data("part_props");
25243		}
25244		if(th.data("add_props")){
25245			add_props=th.data("add_props");
25246		}
25247		if($('.rid_item').length){
25248			rid=$('.rid_item').data('rid');
25249		}else if(th.data('rid')){
25250			rid=th.data('rid');
25251		}
25252
25253		fill_prop=fillBasketPropsExt(th, 'prop', 'bx_ajax_text');
25254
25255		fill_prop.quantity=val;
25256		fill_prop.add_item='Y';
25257		fill_prop.rid=rid;
25258		fill_prop.offers=offer;
25259		fill_prop.iblockID=iblockid;
25260		fill_prop.part_props=part_props;
25261		fill_prop.add_props=add_props;
25262		fill_prop.props=JSON.stringify(props);
25263		fill_prop.item=item;
25264		fill_prop.basket_props=basket_props;
25265
25266		var isDetail = th.closest('.product-action').length || th.closest('#headerfixed.with-product');
25267		var isSku2 = th.closest('.list-offers').length;
25268		var bIsService = th.closest('.buy_services_wrap').length;
25269
25270		if( !bIsService && (isDetail || isSku2) ){
25271			//var allServicesOn = th.closest('.product-container').find('.buy_services_wrap .services-item [name="buy_switch_services"]:checked');
25272			var allServicesOn = [];
25273			if(isSku2){
25274				allServicesOn = th.closest('.product-container').find('.buy_services_wrap .services-item [name="buy_switch_services"]:checked');
25275			} else {
25276				allServicesOn = $('.product-container').find('.buy_services_wrap[data-parent_product="' + item + '"] .services-item [name="buy_switch_services"]:checked');
25277			}
25278			var servicesNeedAdd = [];
25279			allServicesOn.each(function(){
25280				var _this = $(this);
25281				var buttonCart = _this.closest('.services-item').find('.to-cart');
25282				
25283				servicesNeedAdd[buttonCart.data('item')] = {};
25284				servicesNeedAdd[buttonCart.data('item')]['id'] = buttonCart.data('item');
25285				servicesNeedAdd[buttonCart.data('item')]['quantity'] =  buttonCart.attr('data-quantity');
25286				servicesNeedAdd[buttonCart.data('item')]['iblock_id'] = buttonCart.data('iblockid');
25287			});
25288			servicesNeedAdd = array_values_js(servicesNeedAdd);
25289			fill_prop.services = servicesNeedAdd;
25290		}
25291
25292		$.ajax({
25293			type:"POST",
25294			url:arAsproOptions['SITE_DIR']+"ajax/item.php",
25295			data:fill_prop,
25296			dataType:"json",
25297			success:function(data){
25298				$('.basket_error_frame').jqmHide();
25299				if("STATUS" in data){
25300					getActualBasket(fill_prop.iblockID);
25301					if(data.STATUS === 'OK'){
25302						th.hide();
25303						th.closest('.counter_wrapp').find('.counter_block_inner').hide();
25304						th.closest('.counter_wrapp').find('.counter_block').hide();
25305						th.parents('tr').find('.counter_block_wr .counter_block').hide();
25306						th.closest('.button_block').addClass('wide');
25307						th.parent().find('.in-cart').show();
25308
25309						addBasketCounter(item);
25310						//$('.wish_item[data-item='+item+']').removeClass("added");
25311						$('.wish_item[data-item='+item+']').find(".value").show();
25312						$('.wish_item[data-item='+item+']').find(".value.added").hide();
25313
25314						if($("#ajax_basket").length)
25315							reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
25316
25317						if($("#basket_line .basket_fly").length){
25318							if(th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches)
25319								basketFly('open', 'N');
25320							else
25321								basketFly('open');
25322						}
25323
25324					}else{
25325						showBasketError(BX.message(data.MESSAGE));
25326					}
25327				}else{
25328					showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
25329				}
25330			}
25331		});
25332	})
25333
25334	$(document).on( 'click', '.to-cart:not(.read_more), .basket_item_add', function(e){
25335		e.preventDefault();
25336		var th=$(this);
25337		if(!th.hasClass('clicked'))
25338		{
25339			th.addClass('clicked');
25340			var val = $(this).attr('data-quantity');
25341			var tmp_props=$(this).data("props"),
25342				props='',
25343				part_props='',
25344				add_props='N',
25345				fill_prop={},
25346				iblockid = $(this).data('iblockid'),
25347				offer = $(this).data('offers'),
25348				rid='',
25349				bBannerAction = false,
25350				basket_props='',
25351				item = $(this).attr('data-item');
25352			if(th.closest('.but-cell').length)
25353			{
25354				if($('.counter_block[data-item="'+item+'"]').length)
25355					val = $('.counter_block[data-item="'+item+'"] input').val();
25356			}
25357
25358			if(th.closest('.banner_buttons.with_actions').length) //banner action
25359			{
25360				var wrapper_btns = th.closest('.wraps_buttons');
25361				item = wrapper_btns.data('id');
25362				bBannerAction = true;
25363			}
25364
25365			if(!val)
25366				val = 1;
25367			if(offer!="Y"){
25368				offer = "N";
25369			}else{
25370				basket_props=$(this).closest('.prices_tab').find('.bx_sku_props input').val();
25371			}
25372			if(tmp_props){
25373				props=tmp_props.split(";");
25374			}
25375			if($(this).data("part_props")){
25376				part_props=$(this).data("part_props");
25377			}
25378			if($(this).data("add_props")){
25379				add_props=$(this).data("add_props");
25380			}
25381			if($('.rid_item').length){
25382				rid=$('.rid_item').data('rid');
25383			}else if($(this).data('rid')){
25384				rid=$(this).data('rid');
25385			}
25386
25387			fill_prop=fillBasketPropsExt(th, 'prop', th.data('bakset_div'));
25388
25389			fill_prop.quantity=val;
25390			fill_prop.add_item='Y';
25391			fill_prop.rid=rid;
25392			fill_prop.offers=offer;
25393			fill_prop.iblockID=iblockid;
25394			fill_prop.part_props=part_props;
25395			fill_prop.add_props=add_props;
25396			fill_prop.props=JSON.stringify(props);
25397			fill_prop.item=item;
25398			fill_prop.basket_props=basket_props;
25399
25400			var isDetail = th.closest('.product-action').length || th.closest('#headerfixed.with-product');
25401			var isSku2 = th.closest('.list-offers').length;
25402			var bIsService = th.closest('.buy_services_wrap').length;
25403
25404			if( !bIsService && (isDetail || isSku2) ){
25405				//var allServicesOn = th.closest('.product-container').find('.buy_services_wrap .services-item [name="buy_switch_services"]:checked');
25406				var allServicesOn = [];
25407				if(isSku2){
25408					allServicesOn = th.closest('.product-container').find('.buy_services_wrap .services-item [name="buy_switch_services"]:checked');
25409				} else {
25410					allServicesOn = $('.product-container').find('.buy_services_wrap[data-parent_product="' + item + '"] .services-item [name="buy_switch_services"]:checked');
25411				}
25412				var servicesNeedAdd = [];
25413				allServicesOn.each(function(){
25414					var _this = $(this);
25415					var buttonCart = _this.closest('.services-item').find('.to-cart');
25416					
25417					servicesNeedAdd[buttonCart.data('item')] = {};
25418					servicesNeedAdd[buttonCart.data('item')]['id'] = buttonCart.data('item');
25419					servicesNeedAdd[buttonCart.data('item')]['quantity'] =  buttonCart.attr('data-quantity');
25420					servicesNeedAdd[buttonCart.data('item')]['iblock_id'] = buttonCart.data('iblockid');
25421				});
25422				servicesNeedAdd = array_values_js(servicesNeedAdd);
25423				fill_prop.services = servicesNeedAdd;
25424			}
25425			
25426			var servicesWrap = $(this).closest('.buy_services_wrap');
25427			if( bIsService ){
25428				var parent_product = servicesWrap.attr('data-parent_product');
25429				fill_prop['prop[BUY_PRODUCT_PROP]'] = parent_product;
25430				fill_prop['prop[ASPRO_BUY_PRODUCT_ID]'] = parent_product;
25431			}
25432
25433			if(bBannerAction)
25434			{
25435
25436				if(th.hasClass('added'))
25437				{
25438					location.href = th.data('href');
25439					return false;
25440				}
25441				else
25442				{
25443					th.attr('title', th.data('title2'))
25444					th.toggleClass('added');
25445				}
25446
25447				if(wrapper_btns.find('.wish_item_add').length)
25448					wrapper_btns.find('.wish_item_add').removeClass('added');
25449			}
25450
25451			if(th.data("empty_props")=="N"/* && fill_prop.part_props != 'Y'*/){
25452				var basket_popup_html = $("#"+th.data("bakset_div")).html();
25453				if(!basket_popup_html && th.closest('.item').find('.basket_props_block').length)
25454					basket_popup_html = th.closest('.item').find('.basket_props_block').html();
25455
25456				showBasketError(basket_popup_html, BX.message("ERROR_BASKET_PROP_TITLE"), "Y", th);
25457				BX.addCustomEvent('onCompleteAction', function(e){
25458					if(!e.ignoreSelf){
25459						var eventdata = {action:'loadForm', ignoreSelf: true};
25460						BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
25461					}
25462				});
25463
25464			}else{
25465				$.ajax({
25466					type:"POST",
25467					url:arAsproOptions['SITE_DIR']+"ajax/item.php",
25468					data:fill_prop,
25469					dataType:"json",
25470					success:function(data){
25471						getActualBasket(fill_prop.iblockID);
25472						
25473						var eventdata = {action:'loadForm'};
25474						BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
25475						arStatusBasketAspro = {};
25476
25477						if(data !==null){
25478							if("STATUS" in data){
25479								if(data.MESSAGE_EXT===null)
25480									data.MESSAGE_EXT='';
25481								if(data.STATUS === 'OK'){
25482									// th.hide();
25483									$('.to-cart[data-item='+item+']').hide();
25484									$('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block_inner').hide();
25485									$('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block').hide();
25486									$('.to-cart[data-item='+item+']').parents('tr').find('.counter_block_wr .counter_block').hide();
25487									$('.to-cart[data-item='+item+']').closest('.button_block').addClass('wide');
25488									// th.parent().find('.in-cart').show();
25489									$('.in-cart[data-item='+item+']').show();
25490
25491									addBasketCounter(item);
25492									//$('.wish_item[data-item='+item+']').removeClass("added");
25493									$('.wish_item[data-item='+item+']').find(".value").show();
25494									$('.wish_item[data-item='+item+']').find(".value.added").hide();
25495									$('.wish_item.to[data-item='+item+']').show();
25496									$('.wish_item.in[data-item='+item+']').hide();
25497
25498									if($("#ajax_basket").length)
25499										reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
25500
25501									if($("#basket_line .basket_fly").length){
25502										if(th.closest('.services_in_basket').length && !window.matchMedia('(max-width: 767px)').matches){
25503											basketFly('open', 'SHOW');//need for buy services in basket_fly
25504										} 
25505										else if(th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches  || $("#basket_line .basket_fly.loaded").length)
25506											basketFly('open', 'N');
25507										else{
25508											basketFly('open');											
25509										}
25510											
25511									}
25512
25513									//need for services on basket_page
25514									if( th.closest('.services_in_basket_page').length ){
25515										BX.Sale.BasketComponent.sendRequest('refreshAjax', {
25516											fullRecalculation: 'Y',
25517											otherParams: {
25518											   param: 'N'
25519											}
25520										 });
25521									}
25522
25523									if($(".top_basket").length){
25524										basketTop('open', $(".top_basket").find('.basket_hover_block'));
25525									}
25526
25527									if ($('#headerfixed .wproducts .ajax_load .btn').length && th.next('.in-cart').length) {
25528										var buttonHtml = '<span class="buy_block"><span class="btn btn-default btn-sm slide_offer more type_block">'+th.next('.in-cart').html() +'</span></span>';
25529										$('#headerfixed .wproducts .ajax_load .item-buttons .but-cell').html(buttonHtml)
25530									}
25531
25532								}else{
25533									showBasketError(BX.message(data.MESSAGE)+' <br/>'+data.MESSAGE_EXT);
25534								}
25535							}else{
25536								showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
25537							}
25538						}else{
25539							// th.hide();
25540							$('.to-cart[data-item='+item+']').hide();
25541							$('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block_inner').hide();
25542							$('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block').hide();
25543							$('.to-cart[data-item='+item+']').parents('tr').find('.counter_block_wr .counter_block').hide();
25544							$('.to-cart[data-item='+item+']').closest('.button_block').addClass('wide');
25545							// th.parent().find('.in-cart').show();
25546							$('.in-cart[data-item='+item+']').show();
25547
25548							addBasketCounter(item);
25549							//$('.wish_item[data-item='+item+']').removeClass("added");
25550							$('.wish_item[data-item='+item+']').find(".value").show();
25551							$('.wish_item[data-item='+item+']').find(".value.added").hide();
25552
25553							if($("#ajax_basket").length)
25554								reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
25555
25556							if($("#basket_line .basket_fly").length)
25557							{
25558								if(th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches  || $("#basket_line .basket_fly.loaded").length)
25559									basketFly('open', 'N');
25560								else
25561									basketFly('open');
25562							}
25563						}
25564					}
25565				});
25566			}
25567		}
25568
25569	})
25570
25571	$(document).on('click', '.to-subscribe', function(e){
25572		e.preventDefault();
25573		var th=$(this);
25574		if(!th.hasClass('clicked'))
25575		{
25576			th.addClass('clicked');
25577			if($(this).is('.auth'))
25578			{
25579				if($(this).hasClass('nsubsc'))
25580				{
25581					$(this).jqmEx();
25582					$(this).trigger('click');
25583				}
25584				else
25585				{
25586					location.href=arAsproOptions['SITE_DIR']+'auth/?backurl='+location.pathname;
25587				}
25588			}
25589			else
25590			{
25591				var item = $(this).attr('data-item'),
25592					iblockid = $(this).attr('data-iblockid');
25593				// $(this).hide();
25594				$('.to-subscribe[data-item='+item+']').hide();
25595				$('.to-subscribe[data-item='+item+']').parent().find('.in-subscribe').show();
25596				$.get(arAsproOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&subscribe_item=Y',
25597					$.proxy(function(data){
25598						arStatusBasketAspro = {};
25599						getActualBasket(iblockid);
25600					})
25601				);
25602				th.removeClass('clicked');
25603			}
25604		}
25605	})
25606
25607	$(document).on('click', '.in-subscribe', function(e){
25608		e.preventDefault();
25609		var item = $(this).attr('data-item'),
25610			iblockid = $(this).attr('data-iblockid');;
25611		// $(this).hide();
25612		$('.in-subscribe[data-item='+item+']').hide();
25613		$('.in-subscribe[data-item='+item+']').parent().find('.to-subscribe').removeClass('clicked');
25614		$('.in-subscribe[data-item='+item+']').parent().find('.to-subscribe').show();
25615		$.get(arAsproOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&subscribe_item=Y',
25616			$.proxy(function(data){
25617				getActualBasket(iblockid);
25618				arStatusBasketAspro = {};
25619			})
25620		);
25621	})
25622
25623	$(document).on('click', '.wish_item, .wish_item_add', function(e){
25624		e.preventDefault();
25625		var val = $(this).attr('data-quantity'),
25626			_this = $(this),
25627			offer = $(this).data('offers'),
25628			iblockid = $(this).data('iblock'),
25629			tmp_props=$(this).data("props"),
25630			props='',
25631			bBannerAction = false,
25632			item = $(this).attr('data-item'),
25633			item2 = $(this).attr('data-item');
25634
25635		if(_this.closest('.banner_buttons.with_actions').length) //banner action
25636		{
25637			var wrapper_btns = _this.closest('.wraps_buttons');
25638			item = item2 = wrapper_btns.data('id');
25639			bBannerAction = true;
25640		}
25641
25642		if(!_this.hasClass('clicked'))
25643		{
25644			_this.addClass('clicked');
25645			if(!val) val = 1;
25646			if(offer!="Y") offer = "N";
25647			if(tmp_props){
25648				props=tmp_props.split(";");
25649			}
25650			if(!$(this).hasClass('text')){
25651				if($(this).hasClass('added')){
25652					if(!bBannerAction)
25653					{
25654						$(this).hide();
25655						$(this).closest('.wish_item_button').find('.to').show();
25656					}
25657					$('.like_icons').each(function(){
25658						if($(this).find('.wish_item.text[data-item="'+item+'"]').length){
25659							$(this).find('.wish_item.text[data-item="'+item+'"]').removeClass('added');
25660							$(this).find('.wish_item.text[data-item="'+item+'"]').find('.value').show();
25661							$(this).find('.wish_item.text[data-item="'+item+'"]').find('.value.added').hide();
25662						}
25663						if($(this).find('.wish_item_button').length){
25664							/*$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').removeClass('added');
25665							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').show();
25666							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').hide();*/
25667							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"].to').show();
25668							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"].in').hide();
25669						}
25670					})
25671				}
25672				else{
25673					if(!bBannerAction)
25674					{
25675						$(this).hide();
25676						$(this).closest('.wish_item_button').find('.in').addClass('added').show();
25677					}
25678
25679					$('.like_icons').each(function(){
25680						if($(this).find('.wish_item.text[data-item="'+item+'"]').length){
25681							$(this).find('.wish_item.text[data-item="'+item+'"]').addClass('added');
25682							$(this).find('.wish_item.text[data-item="'+item+'"]').find('.value').hide();
25683							$(this).find('.wish_item.text[data-item="'+item+'"]').find('.value.added').css({"display":"block"})
25684						}
25685						if($(this).find('.wish_item_button').length){
25686							/*$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').addClass('added');
25687							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').hide();
25688							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').show();*/
25689							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"].to').hide();
25690							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"].in').show();
25691						}
25692					})
25693				}
25694			}else{
25695				if(!$(this).hasClass('added')){
25696					$('.wish_item[data-item=' + item + ']').addClass('added');
25697					$('.wish_item[data-item=' + item + ']').find('.value').hide();
25698					$('.wish_item[data-item=' + item + ']').find('.value.added').css('display','block');
25699
25700					$('.wish_item.to[data-item='+item+']').hide();
25701					$('.wish_item.in[data-item='+item+']').show();
25702
25703
25704					$('.like_icons').each(function(){
25705						if($(this).find('.wish_item_button').length){
25706							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').addClass('added');
25707							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').hide();
25708							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').show();
25709						}
25710					})
25711				}else{
25712					$('.wish_item[data-item=' + item + ']').removeClass('added');
25713					$('.wish_item[data-item=' + item + ']').find('.value').show();
25714					$('.wish_item[data-item=' + item + ']').find('.value.added').hide();
25715
25716					$('.wish_item.to[data-item='+item+']').show();
25717					$('.wish_item.in[data-item='+item+']').hide();
25718
25719					$('.like_icons').each(function(){
25720						if($(this).find('.wish_item_button').length){
25721							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').removeClass('added');
25722							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').show();
25723							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').hide();
25724						}
25725					})
25726				}
25727			}
25728
25729			$('.in-cart[data-item=' + item + ']').hide();
25730			$('.to-cart[data-item=' + item + ']').removeClass('clicked');
25731			$('.to-cart[data-item=' + item + ']').parent().removeClass('wide');
25732			if(!$('.counter_block[data-item=' + item + ']').closest('.counter_wrapp').find('.to-order').length)
25733			{
25734				$('.to-cart[data-item=' + item + ']').show();
25735				$('.counter_block[data-item=' + item + ']').closest('.counter_block_inner').show();
25736				$('.counter_block[data-item=' + item + ']').show();
25737			}
25738
25739			if(bBannerAction)
25740			{
25741				_this.toggleClass('added');
25742
25743				if(_this.hasClass('added'))
25744					_this.attr('title', _this.data('title2'))
25745				else
25746					_this.attr('title', _this.data('title'))
25747
25748				if(wrapper_btns.find('.basket_item_add').length)
25749					wrapper_btns.find('.basket_item_add').removeClass('added');
25750			}
25751
25752			if(!$(this).closest('.module-cart').size()){
25753				$.ajax({
25754					type:"GET",
25755					url:arAsproOptions['SITE_DIR']+"ajax/item.php",
25756					data:"item="+item2+"&quantity="+val+"&wish_item=Y"+"&offers="+offer+"&iblockID="+iblockid+"&props="+JSON.stringify(props),
25757					dataType:"json",
25758					success: function(data){
25759						getActualBasket(iblockid);
25760						arStatusBasketAspro = {};
25761						if(data !==null){
25762							if(data.MESSAGE_EXT===null)
25763								data.MESSAGE_EXT='';
25764							if("STATUS" in data){
25765								if(data.STATUS === 'OK'){
25766									if(arAsproOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N'){
25767										var eventdata = {goal: 'goal_wish_add', params: {id: item2}};
25768										BX.onCustomEvent('onCounterGoals', [eventdata]);
25769									}
25770									if($("#ajax_basket").length)
25771										reloadTopBasket('wish', $('#ajax_basket'), 200, 5000, 'N');
25772
25773									if($("#basket_line .basket_fly").length){
25774										if(_this.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
25775											basketFly('wish', 'N');
25776										else
25777											basketFly('wish');
25778									}
25779								}else{
25780									showBasketError(BX.message(data.MESSAGE)+' <br/>'+data.MESSAGE_EXT, BX.message("ERROR_ADD_DELAY_ITEM"));
25781								}
25782							}else{
25783								showBasketError(BX.message(data.MESSAGE)+' <br/>'+data.MESSAGE_EXT, BX.message("ERROR_ADD_DELAY_ITEM"));
25784							}
25785						}else{
25786							if($("#ajax_basket").length)
25787								reloadTopBasket('wish', $('#ajax_basket'), 200, 5000, 'N');
25788
25789							if($("#basket_line .basket_fly").length){
25790								if(_this.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
25791									basketFly('wish', 'N');
25792								else
25793									basketFly('wish');
25794							}
25795						}
25796					_this.removeClass('clicked');
25797					}
25798				});
25799			}
25800		}
25801
25802	})
25803
25804	$(document).on('click', '.item_main_info .item_slider .flex-direction-nav li span', function(e){
25805		if($('.inner_slider .slides_block').length)
25806		{
25807			if($(this).parent().hasClass('flex-nav-next'))
25808				$('.inner_slider .slides_block li.current').next().click();
25809			else
25810				$('.inner_slider .slides_block li.current').prev().click();
25811		}
25812	})
25813
25814	$(document).on('click', '.compare_item, .compare_item_add', function(e){
25815		e.preventDefault();
25816		var item = $(this).attr('data-item');
25817		var iblockID = $(this).attr('data-iblock'),
25818			bBannerAction = false,
25819			th=$(this);
25820
25821		if(th.closest('.banner_buttons.with_actions').length) //banner action
25822		{
25823			var wrapper_btns = th.closest('.wraps_buttons');
25824			item = wrapper_btns.data('id');
25825			iblockID = wrapper_btns.data('iblockid');
25826			bBannerAction = true;
25827
25828			th.toggleClass('added');
25829
25830			if(th.hasClass('added'))
25831				th.attr('title', th.data('title2'))
25832			else
25833				th.attr('title', th.data('title'))
25834		}
25835
25836		if(!th.hasClass('clicked'))
25837		{
25838			th.addClass('clicked');
25839			if(!$(this).hasClass('text')){
25840				if($(this).hasClass('added')){
25841					if(!bBannerAction)
25842					{
25843						$(this).hide();
25844						$(this).closest('.compare_item_button').find('.to').show();
25845					}
25846
25847					/*sync other button*/
25848					$('.like_icons').each(function(){
25849						if($(this).find('.compare_item.text[data-item="'+item+'"]').length){
25850							$(this).find('.compare_item.text[data-item="'+item+'"]').removeClass('added');
25851							$(this).find('.compare_item.text[data-item="'+item+'"]').find('.value').show();
25852							$(this).find('.compare_item.text[data-item="'+item+'"]').find('.value.added').hide();
25853						}
25854						if($(this).find('.compare_item_button').length){
25855							/*$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').removeClass('added');
25856							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').show();
25857							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').hide();*/
25858							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"].in').hide();
25859							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"].to').show();
25860						}
25861					})
25862				}
25863				else
25864				{
25865					if(!bBannerAction)
25866					{
25867						$(this).hide();
25868						$(this).closest('.compare_item_button').find('.in').show();
25869					}
25870
25871					/*sync other button*/
25872					$('.like_icons').each(function(){
25873						if($(this).find('.compare_item.text[data-item="'+item+'"]').length){
25874							$(this).find('.compare_item.text[data-item="'+item+'"]').addClass('added');;
25875							$(this).find('.compare_item.text[data-item="'+item+'"]').find('.value').hide();
25876							$(this).find('.compare_item.text[data-item="'+item+'"]').find('.value.added').css({"display":"block"});
25877						}
25878						if($(this).find('.compare_item_button').length){
25879							/*$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').addClass('added');
25880							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').show();
25881							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').hide();*/
25882							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"].to').hide();
25883							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"].in').show();
25884						}
25885					})
25886				}
25887			}else{
25888				if(!$(this).hasClass('added')){
25889					$('.compare_item[data-item=' + item + ']').addClass('added');
25890					$('.compare_item[data-item=' + item + ']').find('.value').hide();
25891					$('.compare_item[data-item=' + item + ']').find('.value.added').css('display','block');
25892
25893					/*sync other button*/
25894					$('.like_icons').each(function(){
25895						if($(this).find('.compare_item_button').length){
25896							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').addClass('added');
25897							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').show();
25898							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').hide();
25899						}
25900					})
25901				}else{
25902					$('.compare_item[data-item=' + item + ']').removeClass('added');
25903					$('.compare_item[data-item=' + item + ']').find('.value').show();
25904					$('.compare_item[data-item=' + item + ']').find('.value.added').hide();
25905
25906					/*sync other button*/
25907					$('.like_icons').each(function(){
25908						if($(this).find('.compare_item_button').length){
25909							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').removeClass('added');
25910							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').show();
25911							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').hide();
25912						}
25913					})
25914				}
25915			}
25916
25917			$.get(arAsproOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&compare_item=Y&iblock_id=' + iblockID,
25918				$.proxy(function(data){
25919					getActualBasket(iblockID, 'Compare');
25920					arStatusBasketAspro = {};
25921					if($('#compare_fly').length){
25922						jsAjaxUtil.InsertDataToNode(arAsproOptions['SITE_DIR'] + 'ajax/show_compare_preview_fly.php', 'compare_fly', false);
25923					}
25924				th.removeClass('clicked');
25925				})
25926			);
25927		}
25928
25929	});
25930
25931	$('.fancybox').fancybox({
25932		backFocus: false,
25933	});
25934
25935	$(document).on('click', '.tabs>li', function(){
25936		var parent = $(this).parent();
25937		if(!$(this).hasClass('active')){
25938			var sliderIndex = $(this).index(),
25939				curLiNav=$(this).closest('.top_block').find('.slider_navigation').find('>li:eq(' + sliderIndex + ')'),
25940				curLi=$(this).closest('.top_block').siblings('.tabs_content').find('>li:eq(' + sliderIndex + ')');
25941			$(this).addClass('active').addClass('cur').siblings().removeClass('active').removeClass('cur');
25942			curLi.addClass('cur').siblings().removeClass('cur');
25943			curLiNav.addClass('cur').siblings().removeClass('cur');
25944
25945			if(parent.hasClass('ajax')) // front tabs
25946			{
25947				if(!$(this).hasClass('clicked'))
25948				{
25949					$.ajax({
25950						url: arAsproOptions['SITE_DIR'] + 'include/mainpage/comp_catalog_ajax.php',
25951						type: 'POST',
25952						data: {AJAX_POST: 'Y', FILTER_HIT_PROP: $(this).data('code'), AJAX_PARAMS: $(this).closest('.tab_slider_wrapp').find('.request-data').data('value'), GLOBAL_FILTER: curLi.data('filter')},
25953					}).success(function(html){
25954						curLi.find('.tabs_slider').html(html);
25955						var container = curLi.closest('.content_wrapper_block');
25956						if(container.length) {
25957							var bNav = curLi.find('.bottom_nav .module-pagination').length > 0;
25958							if(bNav) {
25959								container.removeClass('without-border');
25960							} else {
25961								container.addClass('without-borded');
25962							}
25963						}
25964						setTimeout(function(){
25965							curLi.addClass('opacity1');
25966						}, 100);
25967
25968						/*equal height*/
25969						// curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible .item-title').sliceHeight({item:'.catalog_item:visible', mobile: true});
25970						// curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible').sliceHeight({item:'.catalog_item:visible', mobile: true});
25971						// curLi.find('.catalog_block .catalog_item_wrapp .catalog_item:visible').sliceHeight({classNull: '.footer_button', item:'.catalog_item:visible', mobile: true});
25972
25973						initCountdown();
25974					})
25975					$(this).addClass('clicked');
25976				} else {
25977					var container = curLi.closest('.content_wrapper_block');
25978					if(container.length) {
25979						var bNav = curLi.find('.bottom_nav .module-pagination').length > 0;
25980						if(bNav) {
25981							container.removeClass('without-border');
25982						} else {
25983							container.addClass('without-borded');
25984						}
25985					}
25986					$('.cur .catalog_block .catalog_item_wrapp.catalog_item:not(.big):visible').sliceHeight({
25987						classNull: '.footer_button',
25988						item:'.cur .catalog_block .catalog_item_wrapp.catalog_item:not(.big):visible',
25989						classes: [
25990							'.item_info .item-title',
25991							'.item_info .sa_block',
25992							'.item_info .cost.prices',
25993						],
25994						mobile: true,
25995					});
25996				}
25997			}
25998
25999			var eventdata = {index: sliderIndex, target: $(this)};
26000			BX.onCustomEvent('clickedTabsLi', [eventdata]);
26001		}
26002	})
26003
26004	/*search click*/
26005	$('.search_block .icon').on('click', function(){
26006		var th=$(this);
26007		if($(this).hasClass('open')){
26008			$(this).closest('.center_block').find('.search_middle_block').removeClass('active');
26009			$(this).removeClass('open');
26010			$(this).closest('.center_block').find('.search_middle_block').find('.noborder').hide();
26011		}else{
26012			setTimeout(function(){
26013				th.closest('.center_block').find('.search_middle_block').find('.noborder').show();
26014			},100);
26015			$(this).closest('.center_block').find('.search_middle_block').addClass('active');
26016			$(this).addClass('open');
26017		}
26018	})
26019
26020	$(document).on('click', '.no_goods .button', function(){
26021		$('.bx_filter .smartfilter .bx_filter_search_reset').trigger('click');
26022	});
26023
26024	$(document).on('click', '.js-load-link', function(e){
26025		AjaxClickLink(e)
26026	})
26027
26028	$(document).on('click', '.svg-inline-bottom_nav-icon', function(){
26029		$(this).next().trigger('click');
26030	})
26031	$(document).on('click', '.ajax_load_btn', function(){
26032		var
26033			_this = $(this),
26034			url = _this.closest('.container').find('.module-pagination .flex-direction-nav .flex-next').attr('href'),
26035			th = _this.find('.more_text_ajax'),
26036			bottom_nav = _this.closest('.bottom_nav'),
26037			mobileBottomNav = bottom_nav.hasClass('mobile_slider'),
26038			bLoadingState = _this.closest('.animate-load-state').length;
26039
26040		if(!th.hasClass('loading'))
26041		{
26042			th.addClass('loading');
26043			if(mobileBottomNav) {
26044				var icon = bottom_nav.find('.svg-inline-bottom_nav-icon');
26045				icon.css('display', 'none');
26046			}
26047			if(bLoadingState)
26048				_this.addClass('loadings');
26049
26050			var objUrl = parseUrlQuery(),
26051				add_url = ''
26052				obGetData = {"ajax_get": "Y", "AJAX_REQUEST": "Y"};
26053
26054			if(_this.closest('.wrapper_inner.front').length) //index page
26055			{
26056				var class_block = th.closest('.drag-block').data('class').replace('_drag', '');
26057				class_block = class_block.replace(/\s/g, '');
26058				obGetData.BLOCK = class_block;
26059			}
26060
26061			if(_this.closest('.tab').length) //tabs block
26062			{
26063				var filter = th.closest('.tab').data('filter');
26064				obGetData.GLOBAL_FILTER = filter;
26065				url = _this.closest('.bottom_nav').find('.module-pagination .flex-direction-nav .flex-next').attr('href');
26066			}
26067
26068
26069			if(_this.closest('.content_linked_goods').length) //linked_goods block in content
26070			{
26071				var filterSections = th.closest('.content_linked_goods').attr('data-sections-ids');
26072				obGetData.ajax_section_id = decodeURIComponent(filterSections);
26073
26074				url = _this.closest('.bottom_nav').find('.module-pagination .flex-direction-nav .flex-next').attr('href');
26075			}
26076
26077			if('clear_cache' in objUrl)
26078			{
26079				if(objUrl.clear_cache == 'Y')
26080					add_url = '&clear_cache=Y';
26081			}
26082			if(_this.hasClass('ajax'))
26083				obGetData.ajax = 'y';
26084
26085			if(th.closest('.goods-block.ajax_load'))
26086				obGetData.bitrix_include_areas = 'N';
26087			$.ajax({
26088				url: url+add_url,
26089				data: obGetData,
26090				success: function(html) {
26091					pasteAjaxPagination(html, th, bottom_nav, bLoadingState, _this);
26092				},
26093				error: function(html) {
26094					pasteAjaxPagination(html.responseText, th, bottom_nav, bLoadingState, _this);
26095				},
26096			})
26097		}
26098	})
26099
26100	function pasteAjaxPagination(html, th, bottom_nav, bLoadingState, _this) {
26101		var mobileBottomClicked = bottom_nav.hasClass('mobile_slider');
26102		var hasMobileBottomNav = $(html).find('.bottom_nav.mobile_slider');
26103		var bottomNav = hasMobileBottomNav.length ? hasMobileBottomNav : $(html).find('.bottom_nav');
26104		var bottomNavHtml = bottomNav.html();
26105		var bottomNavScrollClass = bottomNav.data('scroll-class');
26106		var hasBottomNav = $(html).find('.ajax_load_btn').length;
26107
26108		if(th.closest('.ajax_load').length && !mobileBottomClicked)
26109		{
26110			th.removeClass('loading');
26111			if(th.closest('.ajax_load').find('.js_append').length)
26112			{
26113				if(_this.closest('.catalog_in_content').length){
26114					th.closest('.ajax_load').find('.js_append').append($('.inner_wrapper .js_wrapper_items>', html));//need for brands & landings
26115				}else{
26116					th.closest('.ajax_load').find('.js_append').append(html);
26117				}
26118				th.closest('.ajax_load').find('.bottom_nav_wrapper').remove();
26119			}
26120			else
26121			{
26122				if($('.display_list').length)
26123				{
26124					$('.display_list').append(html);
26125					th.closest('.display_list').find('.bottom_nav_wrapper').remove();
26126
26127				}else if($('.block_list').length)
26128				{
26129					$('.block_list').append(html);
26130					touchItemBlock('.catalog_item a');
26131					th.closest('.block_list').find('.bottom_nav_wrapper').remove();
26132				}else if($('.module_products_list').length)
26133				{
26134					$('.module_products_list > tbody').append(html);
26135					th.closest('.module_products_list > tbody').find('.bottom_nav_wrapper').remove();
26136				}
26137
26138			}
26139
26140
26141			setStatusButton();
26142			checkLinkedArticles();
26143			checkLinkedBlocks('.linked-banners-list');
26144
26145			var eventdata = {action:'ajaxContentLoadedTab'};
26146			BX.onCustomEvent('onAjaxSuccess', [eventdata]);
26147			_this.closest('.bottom_nav').html(bottomNavHtml);
26148		}
26149		else
26150		{
26151			var eventdata = {action:'ajaxContentLoaded'};
26152
26153			if($('.banners-small.front').length)
26154			{
26155				$('.banners-small .items.row').append(html);
26156				$('.bottom_nav').html($('.banners-small .items.row .bottom_nav').html());
26157				$('.banners-small .items.row .bottom_nav').remove();
26158				if(hasBottomNav) {
26159					$('.banners-small .items.row').addClass('has-bottom-nav');
26160				} else {
26161					$('.banners-small .items.row').removeClass('has-bottom-nav');
26162				}
26163			}
26164			else
26165			{
26166				if(bottom_nav.data('append') !== undefined && bottom_nav.data('parent') !== undefined)
26167				{
26168					var target = html;
26169					if(bottom_nav.data('target') !== undefined) {
26170						target = $(html).find(bottom_nav.data('target'));
26171					}
26172					if(mobileBottomClicked || hasMobileBottomNav.length) {
26173						var mobileSliderNav = th.closest(bottom_nav.data('parent')).find('.bottom_nav.mobile_slider');
26174						if(mobileSliderNav.length) {
26175							mobileSliderNav.before(target);
26176						} else {
26177							bottom_nav.before(target);
26178						}
26179					} else {
26180						th.closest(bottom_nav.data('parent')).find(bottom_nav.data('append')).append(target);
26181					}
26182					th.closest(bottom_nav.data('parent')).find(bottom_nav.data('append')).find('.bottom_nav_wrapper').remove();
26183
26184					if (hasBottomNav) {
26185						if (bottomNavScrollClass !== undefined) {
26186							th.closest(bottom_nav.data('parent')).find(bottomNavScrollClass).addClass('has-bottom-nav');
26187						}
26188						th.closest(bottom_nav.data('parent')).find(bottom_nav.data('append')).addClass('has-bottom-nav');
26189					} else {
26190						if (bottomNavScrollClass !== undefined) {
26191							th.closest(bottom_nav.data('parent')).find(bottomNavScrollClass).removeClass('has-bottom-nav');
26192						}
26193						th.closest(bottom_nav.data('parent')).find(bottom_nav.data('append')).removeClass('has-bottom-nav');
26194					}
26195
26196					bottom_nav = th.closest(bottom_nav.data('parent')).find('.bottom_nav');
26197					bottom_nav.html(bottomNavHtml);
26198					var icon = bottom_nav.find('.svg-inline-bottom_nav-icon');
26199					icon.css('display', '');
26200
26201					eventdata.container = th.closest(bottom_nav.data('parent'));
26202				}
26203				else
26204				{
26205					if(th.closest('.item-views').find('.items').length)
26206					{
26207						th.closest('.item-views').find('.items').append(html);
26208					}
26209					else
26210					{
26211						$(html).insertBefore($('.blog .bottom_nav'));
26212					}
26213
26214					bottom_nav.html($('.bottom_nav:hidden').html());
26215					if(hasBottomNav) {
26216						th.closest('.item-views').find('.items').addClass('has-bottom-nav');
26217					} else {
26218						th.closest('.item-views').find('.items').removeClass('has-bottom-nav');
26219					}
26220					_this.closest('.item-views').find('.bottom_nav:hidden').remove();
26221				}
26222			}
26223
26224			eventdata.content = html;
26225			eventdata.container = th;
26226			BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
26227
26228			setTimeout(function(){
26229				$('.banners-small .item.normal-block').sliceHeight({resize: false});
26230				if($('.item.slice-item').length)
26231				{
26232					$('.item.slice-item .title').sliceHeight({resize: false});
26233					$('.item.slice-item').sliceHeight({resize: false});
26234				}
26235				th.removeClass('loading');
26236				if(bLoadingState)
26237					_this.removeClass('loadings');
26238			}, 100);
26239		}
26240		initCountdown();
26241	}
26242
26243	// form rating
26244	$(document).on('mouseenter', '.form .votes_block.with-text .item-rating', function(){
26245		var $this = $(this),
26246			index = $this.index(),
26247			ratingValue = $this.data('rating_value'),
26248			ratingMessage = $this.data('message');
26249
26250		$(this).addClass('filed')
26251		$this.siblings().each(function(){
26252			if($(this).index() <= index)
26253				$(this).addClass('filed')
26254			else
26255				$(this).removeClass('filed')
26256		});
26257		$this.closest('.votes_block').find('.rating_message').text(ratingMessage);
26258	});
26259
26260	$(document).on('mouseleave', '.form .votes_block.with-text', function(){
26261		var $this = $(this),
26262			index = $this.data('rating'),
26263			ratingMessage = $this.closest('.votes_block').find('.rating_message').data('message');
26264
26265		$this.find('.item-rating').each(function(){
26266			if($(this).index() < index && index !== undefined)
26267				$(this).addClass('filed')
26268			else
26269				$(this).removeClass('filed')
26270		});
26271		$this.closest('.votes_block').find('.rating_message').text(ratingMessage);
26272	});
26273
26274	$(document).on('click', '.form .votes_block.with-text .item-rating', function(){
26275		var $this = $(this),
26276			rating = $this.closest('.votes_block').data('rating'),
26277			index = $this.index() + 1,
26278			ratingMessage = $this.data('message');
26279
26280		$this.closest('.votes_block').data('rating', index);
26281		if($this.closest('.form-control').find('input[name=RATING]').length){
26282			$this.closest('.form-control').find('input[name=RATING]').val(index);
26283		}
26284		else{
26285			$this.closest('.form-control').find('input[data-sid=RATING]').val(index);
26286		}
26287		$this.closest('.votes_block').find('.rating_message').data('message', ratingMessage);
26288	});
26289
26290	//set cookie for basket link click
26291	$(document).on('click', '.bx_ordercart_order_table_container .control > a, .basket-item-actions-remove, a[data-entity=basket-item-remove-delayed]', function(e){
26292		$.removeCookie('click_basket', {path: '/'});
26293		$.cookie('click_basket', 'Y', {path: '/'});
26294	})
26295
26296	$(document).on('click', '.bx_compare .tabs-head li', function(){
26297		var url=$(this).find('.sortbutton').data('href');
26298		BX.showWait(BX("bx_catalog_compare_block"));
26299		$.ajax({
26300			url: url,
26301			data: {'ajax_action': 'Y'},
26302			success: function(html){
26303				history.pushState(null, null, url);
26304				$('#bx_catalog_compare_block').html(html);
26305				BX.closeWait();
26306			}
26307		})
26308	})
26309	var hoveredTrs;
26310	$(document).on({
26311		mouseover: function(e){
26312			var _ = $(this);
26313			var tbodyIndex = _.closest('tbody').index()+1; //+1 for nth-child
26314			var trIndex = _.index()+1; // +1 for nth-child
26315			hoveredTrs = $(e.delegateTarget).find('.data_table_props')
26316				.children(':nth-child('+tbodyIndex+')')
26317				.children(':nth-child('+trIndex+')').addClass('hovered');
26318		},
26319		mouseleave: function(e){
26320			if(hoveredTrs)
26321				hoveredTrs.removeClass('hovered');
26322		}
26323	}, '.bx_compare .data_table_props tbody>tr');
26324	$(document).on('click', '.fancy_offer', function(e){
26325		e.preventDefault();
26326		var arPict=[], index = 0;
26327		$(this).closest('.item_slider').find('.sliders .slides_block li').each(function(){
26328			var obImg = {};
26329			obImg = {
26330				'title': $(this).find('img').attr('alt'),
26331				'href': $(this).data('big')
26332			}
26333			if($(this).hasClass('current')){
26334				index = $(this).index();
26335			}
26336			arPict.push(obImg);
26337		})
26338		$.fancybox(arPict, {
26339			index: index,
26340			openEffect  : 'fade',
26341			closeEffect : 'fade',
26342			nextEffect : 'fade',
26343			prevEffect : 'fade',
26344			type : 'image',
26345			tpl:{
26346				closeBtn : '<a title="'+BX.message('FANCY_CLOSE')+'" class="fancybox-item fancybox-close" href="javascript:;"></a>',
26347				next     : '<a title="'+BX.message('FANCY_NEXT')+'" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
26348				prev     : '<a title="'+BX.message('FANCY_PREV')+'" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
26349			},
26350		});
26351	})
26352
26353	/*tabs*/
26354	$(".tabs_section .tabs-head li").on("click", function(){
26355		if(!$(this).is(".current")){
26356			$(".tabs_section .tabs-head li").removeClass("current");
26357			$(this).addClass("current");
26358			$(".tabs_section ul.tabs_content li").removeClass("current");
26359			if($(this).attr("id") == "product_reviews_tab"){
26360				$(".shadow.common").hide(); $("#reviews_content").show();
26361			}
26362			else{
26363				$(".shadow.common").show();
26364				$("#reviews_content").hide();
26365				$(".tabs_section ul.tabs_content > li:eq("+$(this).index()+")").addClass("current");
26366			}
26367		}
26368	});
26369
26370	/*open first section slide*/
26371	setTimeout(function() {
26372		$('.jobs_wrapp .item:first .name tr').trigger('click');
26373	}, 300);
26374
26375	$('.choise').on('click', function(){
26376		var _this = $(this);
26377		if(typeof(_this.attr('data-block')) != 'undefined')
26378		{
26379			if($(_this.attr('data-block')).closest('.tab-pane').length)
26380			{
26381				$('.ordered-block a[href="#'+$(_this.attr('data-block')).closest('.tab-pane').attr('id')+'"]').click();
26382				_this.data('block', '.ordered-block.tabs-block');
26383				$(_this.data('block')).data('offset', -100);
26384			}
26385			else
26386			{
26387				if (typeof(_this.data('offset')) !== 'undefined')
26388					$(_this.data('block')).data('offset', _this.data('offset'));
26389				else
26390					$(_this.data('block')).data('offset', -100);
26391			}
26392			scrollToBlock(_this.data('block'));
26393		}
26394	})
26395
26396	$(document).on('click', '.buy_block .slide_offer', function(){
26397		scroll_block($('.js-offers-scroll'));
26398	});
26399	$('.share  > .share_wrapp .text').on('click', function(){
26400		var block = $(this).parent().find('.shares');
26401		if(!block.is(':visible') && !$(this).closest('.share.top').length)
26402			$('#content').css('z-index',3);
26403		block.fadeToggle(100,function(){
26404			if(!block.is(':visible'))
26405				$('#content').css('z-index',2);
26406		});
26407	})
26408	$('html, body').on('mousedown', function(e) {
26409		if(typeof e.target.className == 'string' && e.target.className.indexOf('adm') < 0)
26410		{
26411			e.stopPropagation();
26412			$('div.shares').fadeOut(100, function(){
26413				$('#content').css('z-index',2);
26414				$('.price_txt .share_wrapp').removeClass('opened');
26415			});
26416			$('.search_middle_block').removeClass('active_wide');
26417		}
26418	})
26419	$('.share_wrapp').find('*').on('mousedown', function(e) {
26420		e.stopPropagation();
26421	});
26422
26423	$('.price_txt .share_wrapp .text').click(function(){
26424		$(this).parent().toggleClass('opened');
26425		$(this).parent().find('.shares').fadeToggle();
26426	})
26427
26428	$(document).on('click', '.reviews-collapse-link', function(){
26429		$('.reviews-reply-form').slideToggle();
26430	})
26431
26432	/* accordion action*/
26433	$('.panel-collapse').on('hidden.bs.collapse', function(){
26434		$(this).parent().toggleClass('opened');
26435	})
26436	$('.panel-collapse').on('show.bs.collapse', function(){
26437		$(this).parent().toggleClass('opened');
26438	})
26439
26440	/* accordion */
26441	$('.accordion-head').on('click', function(e){
26442		e.preventDefault();
26443		if(!$(this).next().hasClass('collapsing')){
26444			$(this).toggleClass('accordion-open');
26445			$(this).toggleClass('accordion-close');
26446		}
26447	});
26448
26449	/* progress bar */
26450	$('[data-appear-progress-animation]').each(function(){
26451		var $this = $(this);
26452		$this.appear(function(){
26453			var delay = ($this.attr('data-appear-animation-delay') ? $this.attr('data-appear-animation-delay') : 1);
26454			if( delay > 1 )
26455				$this.css('animation-delay', delay + 'ms');
26456			$this.addClass($this.attr('data-appear-animation'));
26457
26458			setTimeout(function(){
26459				$this.animate({
26460					width: $this.attr('data-appear-progress-animation')
26461				}, 1500, 'easeOutQuad', function() {
26462					$this.find('.progress-bar-tooltip').animate({
26463						opacity: 1
26464					}, 500, 'easeOutQuad');
26465				});
26466			}, delay);
26467		}, {accX: 0, accY: -50});
26468	});
26469
26470	initCountdown();
26471
26472	/* portfolio item */
26473	if($('.item.animated-block').length)
26474	{
26475		$('.item.animated-block').appear(function(){
26476			var $this = $(this);
26477
26478			$this.addClass($this.data('animation')).addClass('visible');
26479
26480		}, {accX: 0, accY: 150})
26481	}
26482
26483	/* flexslider appear */
26484	if($('.appear-block').length)
26485	{
26486		$('.appear-block').appear(function(){
26487			var $this = $(this);
26488			$this.removeClass('appear-block');
26489
26490			CheckFlexSlider();
26491			InitFlexSlider();
26492			InitOwlSlider();
26493		}, {accX: 0, accY: 150})
26494	}
26495
26496	/* js-load-block appear */
26497	if($('.js-load-block').length)
26498	{
26499		var objUrl = parseUrlQuery();
26500		var bClearCache = false;
26501		if('clear_cache' in objUrl){
26502			if(objUrl.clear_cache == 'Y'){
26503				bClearCache = true;
26504			}
26505		}
26506
26507		var items = [];
26508		var bIdle = true;
26509		var insertNextBlockContent = function(){
26510			if(bIdle){
26511				if(items.length){
26512					bIdle = false;
26513					var item = items.pop();
26514
26515					item.content = $.trim(item.content);
26516
26517					// remove /bitrix/js/main/core/core_window.js if it was loaded already
26518					if(
26519						item.content.indexOf('/bitrix/js/main/core/core_window.') !== -1 &&
26520						BX.WindowManager
26521					){
26522						item.content = item.content.replace(/<script src="\/bitrix\/js\/main\/core\/core_window\.[^>]*><\/script>/gm, '');
26523					}
26524
26525					// remove /bitrix/js/currency/core_currency.js if it was loaded already
26526					if(
26527						item.content.indexOf('/bitrix/js/currency/core_currency.') !== -1 &&
26528						typeof BX.Currency === 'object' &&
26529						BX.Currency.defaultFormat
26530					){
26531						item.content = item.content.replace(/<script src="\/bitrix\/js\/currency\/core_currency\.[^>]*><\/script>/gm, '');
26532					}
26533
26534					// remove /bitrix/js/main/pageobject/pageobject.js if it was loaded already
26535					if(
26536						item.content.indexOf('/bitrix/js/main/pageobject/pageobject.') !== -1 &&
26537						BX.PageObject
26538					){
26539						item.content = item.content.replace(/<script src="\/bitrix\/js\/main\/pageobject\/pageobject\.[^>]*><\/script>/gm, '');
26540					}
26541
26542					// remove /bitrix/js/main/polyfill/promise/js/promise.js if it not need
26543					if(
26544						item.content.indexOf('/bitrix/js/main/polyfill/promise/js/promise.') !== -1 &&
26545						typeof window.Promise !== 'undefined' &&
26546						window.Promise.toString().indexOf('[native code]') !== -1
26547					){
26548						item.content = item.content.replace(/<script src="\/bitrix\/js\/main\/polyfill\/promise\/js\/promise\.[^>]*><\/script>/gm, '');
26549					}
26550
26551					var ob = BX.processHTML(item.content);
26552
26553					// stop ya metrika webvisor DOM indexer
26554					pauseYmObserver();
26555
26556					item.block.removeAttr('data-file').removeClass('loader_circle');
26557
26558					if(item.block.data('appendTo')){
26559						item.block.find(item.block.data('appendTo'))[0].innerHTML = ob.HTML;
26560					}
26561					else{
26562						if(item.block.find('> div[id*="bx_incl_"]').length){
26563							item.block.find('> div[id*="bx_incl_"]')[0].innerHTML = ob.HTML;
26564						}
26565						else{
26566							item.block[0].innerHTML = ob.HTML;
26567						}
26568					}
26569
26570					BX.ajax.processScripts(ob.SCRIPT);
26571
26572					var eventdata = {action:'jsLoadBlock'};
26573					BX.onCustomEvent('onCompleteAction', [eventdata, item.block]);
26574
26575					// resume ya metrika webvisor
26576					// 500ms
26577					setTimeout(resumeYmObserver, 500);
26578
26579					bIdle = true;
26580					insertNextBlockContent();
26581				}
26582			}
26583		}
26584
26585		$('.js-load-block').appear(function(){
26586			var $this = $(this);
26587
26588			if($this.data('file')){
26589				var add_url = bClearCache ? '?clear_cache=Y' : '';
26590				if($this.data('block')){
26591					add_url += (bClearCache ? '&' : '?') + 'BLOCK='+$this.data('block');
26592				}
26593
26594				// get content
26595				$.get($this.data('file') + add_url)
26596				.done(function(html){
26597					items.push({
26598						block: $this,
26599						content: html,
26600					});
26601
26602					if(items.length == 1){
26603						setTimeout(insertNextBlockContent, 100);
26604					}
26605				});
26606			}
26607		}, {accX: 0, accY: isMobile ? 300 : 150})
26608	}
26609
26610	/*show ajax store amount product*/
26611	$(document).on('click', '.js-show-info-block', function(e){
26612		if (window.matchMedia('(max-width: 500px)').matches) {
26613			return
26614		}
26615		var $this = $(this);
26616		e.stopPropagation();
26617		$('.js-info-block').fadeOut();
26618
26619		if($this.hasClass('opened'))
26620		{
26621			$('.js-show-info-block').removeClass('opened');
26622		}
26623		else
26624		{
26625			$('.js-show-info-block').removeClass('opened');
26626			$this.addClass('opened');
26627		}
26628
26629		if(!$this.siblings('.js-info-block').length)
26630		{
26631			var dataFields = $this.closest('.sa_block').data('fields');
26632			dataFields = dataFields == 'null' || dataFields === undefined ? '' : dataFields;
26633			var dataUserFields = $this.closest('.sa_block').data('user-fields');
26634			dataUserFields = dataUserFields == 'null' || dataUserFields === undefined ? '' : dataUserFields;
26635			var objUrl = parseUrlQuery(),
26636				add_url = '';
26637			if('clear_cache' in objUrl)
26638			{
26639				if(objUrl.clear_cache == 'Y')
26640					add_url += '?clear_cache=Y';
26641			}
26642
26643			var obPostParams = {
26644				'ajax': 'Y',
26645				'ELEMENT_ID': $this.data('id'),
26646				'FIELDS': dataFields,
26647				'USER_FIELDS': dataUserFields,
26648				'STORES': $this.closest('.sa_block').data('stores') || ''
26649			};
26650
26651			$this.addClass('loadings');
26652			$.post(arAsproOptions['SITE_DIR']+'ajax/productStoreAmountCompact.php'+add_url, obPostParams)
26653				.done(function(html){
26654					$this.removeClass('loadings');
26655					$(html).appendTo($this.closest('.sa_block'));
26656
26657					$this.siblings('.js-info-block').find('.more-btn a').attr('href', $this.closest('.item_info').find('a').attr('href'));
26658					InitScrollBar();
26659
26660					var eventdata = {action:'jsShowStores'};
26661					BX.onCustomEvent('onCompleteAction', [eventdata, $this]);
26662				})
26663		}
26664		else
26665		{
26666			if($this.hasClass('opened'))
26667			{
26668				$this.siblings('.js-info-block').find('.more-btn a').attr('href', $this.closest('.item_info').find('a').attr('href'));
26669				$this.siblings('.js-info-block').fadeIn();
26670				InitScrollBar();
26671			}
26672			else
26673			{
26674				$this.siblings('.js-info-block').fadeOut();
26675			}
26676		}
26677	})
26678	$(document).on('click', '.js-info-block .svg-inline-close', function(){
26679		$('.js-show-info-block').removeClass('opened');
26680		$(this).closest('.js-info-block').fadeOut();
26681	})
26682	/**/
26683
26684	/*adaptive menu start*/
26685	$('.menu.adaptive').on('click', function(){
26686		$(this).toggleClass('opened');
26687		if($(this).hasClass('opened')){
26688			$('.mobile_menu').toggleClass('opened').slideDown();
26689		}else{
26690			$('.mobile_menu').toggleClass('opened').slideUp();
26691		}
26692	});
26693	$('.mobile_menu .has-child >a').on('click', function(e){
26694		var parentLi=$(this).parent();
26695		e.preventDefault();
26696		parentLi.toggleClass('opened');
26697		parentLi.find('.dropdown').slideToggle();
26698	})
26699
26700	$('.mobile_menu .search-input-div input').on('keyup', function(e) {
26701		var inputValue = $(this).val();
26702		$('.center_block .stitle_form input').val(inputValue);
26703		if(e.keyCode == 13){
26704			$('.center_block .stitle_form form').submit();
26705		}
26706	});
26707
26708	$('.center_block .stitle_form input').on('keyup', function(e) {
26709		var inputValue = $(this).val();
26710		$('.mobile_menu .search-input-div input').val(inputValue);
26711		if(e.keyCode == 13){
26712			$('.center_block .stitle_form form').submit();
26713		}
26714	});
26715
26716	$('.mobile_menu .search-button-div button').on('click', function(e) {
26717		e.preventDefault();
26718		var inputValue = $(this).parents().find('input').val();
26719		$('.center_block .stitle_form input').val(inputValue);
26720		$('.center_block .stitle_form form').submit();
26721	});
26722	/*adaptive menu end*/
26723
26724	$(document).on('click', '.mega-menu .dropdown-menu', function(e){
26725		e.stopPropagation()
26726	});
26727
26728	$(document).on('click', '.mega-menu .dropdown-toggle.more-items', function(e){
26729		e.preventDefault();
26730	});
26731
26732	$(document).on('mouseenter', '.table-menu .dropdown,.table-menu .dropdown-submenu,.table-menu .dropdown-toggle', function() {
26733		// setTimeout(
26734		// 	function() {
26735		// 		CheckTopVisibleMenu();
26736		// 	}, 275);
26737
26738	});
26739	$(document).on('mouseenter', '#headerfixed .table-menu .dropdown-menu .dropdown-submenu', function() {
26740		setTimeout(
26741			function() {
26742				CheckTopVisibleMenu();
26743			}, 275);
26744	});
26745
26746	$('.mega-menu .search-item .search-icon, .menu-row #title-search .fa-close').on('click', function(e) {
26747		e.preventDefault();
26748		$('.menu-row #title-search').toggleClass('hide');
26749	});
26750
26751	$('.mega-menu ul.nav .search input').on('keyup', function(e) {
26752		var inputValue = $(this).val();
26753		$('.menu-row > .search input').val(inputValue);
26754		if(e.keyCode == 13){
26755			$('.menu-row > .search form').submit();
26756		}
26757	});
26758
26759	$('.menu-row > .search input').on('keyup', function(e) {
26760		var inputValue = $(this).val();
26761		$('.mega-menu ul.nav .search input').val(inputValue);
26762		if(e.keyCode == 13){
26763			$('.menu-row > .search form').submit();
26764		}
26765	});
26766
26767	$('.mega-menu ul.nav .search button').on('click', function(e) {
26768		e.preventDefault();
26769		var inputValue = $(this).parents('.search').find('input').val();
26770		$('.menu-and-search .search input').val(inputValue);
26771		$('.menu-row > .search form').submit();
26772	});
26773
26774	$('.btn.btn-add').on('click', function(){
26775		$.ajax({
26776			type:"GET",
26777			url:arAsproOptions['SITE_DIR']+"ajax/clearBasket.php",
26778			success: function(data){
26779			}
26780		});
26781	})
26782
26783	$('.sort_display a').on('click', function(){
26784		$(this).siblings().removeClass('current');
26785		$(this).addClass('current');
26786	})
26787
26788	/*detail order show payments*/
26789	$('.sale-order-detail-payment-options-methods-info-change-link').on('click', function(){
26790		$(this).closest('.sale-order-detail-payment-options-methods-info').addClass('opened').siblings().addClass('opened');
26791	})
26792
26793	/*expand/hide filter values*/
26794	$(document).on('click', '.expand_block', function(){
26795		togglePropBlock($(this));
26796	})
26797
26798	/*touch event*/
26799	document.addEventListener('touchend', function(event) {
26800		if(!$(event.target).closest('.menu-item').length && !$(event.target).hasClass('menu-item')){
26801			$('.menu-row .dropdown-menu').css({'display':'none','opacity':0});
26802			$('.menu-item').removeClass('hover');
26803			$('.bx-breadcrumb-item.drop').removeClass('hover');
26804		}
26805		if(!$(event.target).closest('.menu.topest').length){
26806			$('.menu.topest').css({'overflow': 'hidden'});
26807			$('.menu.topest > li').removeClass('hover');
26808		}
26809		if(!$(event.target).closest('.full.has-child').length){
26810			$('.menu_top_block.catalog_block li').removeClass('hover');
26811		}
26812		if(!$(event.target).closest('.basket_block').length){
26813			$('.basket_block .link').removeClass('hover');
26814			$('.basket_block .basket_popup_wrapp').slideUp();
26815		}
26816		if(!$(event.target).closest('.catalog_item').length){
26817			var tabsContentUnhoverHover = $('.tab:visible').attr('data-unhover') * 1;
26818			$('.tab:visible').stop().animate({'height': tabsContentUnhoverHover}, 100);
26819			$('.tab:visible').find('.catalog_item').removeClass('hover');
26820			$('.tab:visible').find('.catalog_item .buttons_block').stop().fadeOut(233);
26821			if($('.catalog_block').length){
26822				$('.catalog_block').find('.catalog_item_wrapp').removeClass('hover');
26823				$('.catalog_block').find('.catalog_item').removeClass('hover');
26824			}
26825		}
26826		//togglePropBlock($(event.target));
26827
26828	}, false);
26829
26830
26831	touchMenu('.menu-row .menu-item');
26832	touchTopMenu('.menu.topest li');
26833	touchLeftMenu('.menu_top_block:not(.in-search) li.full');
26834	touchBreadcrumbs('.bx-breadcrumb-item.drop');
26835
26836	$(document).on('keyup', '.coupon .input_coupon input', function(){
26837		if($(this).val().length){
26838			$(this).removeClass('error');
26839			$(this).closest('.input_coupon').find('.error').remove();
26840		}else{
26841			$(this).addClass('error');
26842			$("<label class='error'>"+BX.message("INPUT_COUPON")+"</label>").insertBefore($(this));
26843		}
26844	})
26845	showPhoneMask('input[autocomplete=tel]');
26846	BX.addCustomEvent(window, "onAjaxSuccessFilter", function(e){
26847		setBasketStatusBtn();
26848		checkLinkedArticles();
26849		checkLinkedBlocks('.linked-banners-list');
26850	});
26851
26852	$(document).on('click', '.block_container .items .item.initied', function(){
26853		var _this = $(this),
26854			itemID = _this.data('id'),
26855			animationTime = 200;
26856
26857		_this.closest('.items').fadeOut(animationTime, function(){
26858			_this.closest('.block_container').find('.detail_items').fadeIn(animationTime);
26859			_this.closest('.block_container').find('.detail_items .item[data-id='+itemID+']').fadeIn(animationTime);
26860
26861			var arCoordinates = _this.data('coordinates').split(',');
26862
26863			if(typeof map !== 'undefined')
26864				map.setCenter([arCoordinates[0], arCoordinates[1]], 15);
26865		});
26866	});
26867
26868	$(document).on('click', '.block_container .top-close', function(){
26869		var _this = $(this).closest('.block_container').find('.detail_items .item:visible'),
26870			animationTime = 200;
26871		_this.fadeOut(animationTime);
26872		_this.closest('.block_container').find('.detail_items').fadeOut(animationTime, function(){
26873			_this.closest('.block_container').find('.items').fadeIn(animationTime);
26874
26875			if(typeof map !== 'undefined' && typeof clusterer !== 'undefined')
26876			{
26877				map.setBounds(clusterer.getBounds(), {
26878					zoomMargin: 40,
26879					// checkZoomRange: true
26880				});
26881			}
26882		});
26883	});
26884
26885	BX.addCustomEvent(window, "onAjaxSuccess", function(e){
26886		if(e != 'OK')
26887		{
26888			initSelects(document);
26889			InitOrderCustom();
26890			showPhoneMask('input[autocomplete=tel]');
26891
26892			/*scroll in mobile for filter*/
26893			if($('.bx_filter').length){
26894				if(window.matchMedia('(min-width: 768px)').matches){
26895					// min-width: 768px
26896					$('.bx_filter .scrollbar').removeClass('mobile-scroll');
26897					$('.bx_filter .srollbar-custom').removeClass('mobile-scroll');
26898					$('.bx_filter .bx_filter_section form .bx_filter_parameters').removeClass('mobile-scroll');
26899					InitScrollBar();
26900					InitCustomScrollBar();
26901				}
26902				else{
26903					// max-width: 767px
26904					$('.bx_filter .scrollbar').addClass('mobile-scroll').removeClass('scroll-init');
26905					$('.bx_filter .srollbar-custom').addClass('mobile-scroll').removeClass('scroll-init');
26906					$('.bx_filter .bx_filter_section form .bx_filter_parameters').addClass('mobile-scroll').removeClass('scroll-init');
26907					if($('.bx_filter .mobile-scroll.scrollbar').length)
26908						$('.bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
26909					if($('.bx_filter .mobile-scroll.srollbar-custom').length)
26910						$('.bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
26911				}
26912			}
26913			/*end*/
26914
26915			if ($('.catalog_detail').length && !$('.fast_view_frame').length) {
26916				$('.bx_filter').remove();
26917				InitFlexSlider();
26918				InitOwlSlider();
26919			}
26920
26921			if (arAsproOptions["PAGES"]["CATALOG_PAGE"]) {
26922				initCountdown();
26923
26924				if(typeof window['stickySidebar'] !== 'undefined')
26925					window['stickySidebar'].updateSticky();
26926			}
26927
26928			if (arAsproOptions["PAGES"]["ORDER_PAGE"]) {
26929				orderActions(e);
26930			}
26931
26932			if (e && typeof e === 'object' && 'action' in e && e.action === 'ajaxContentLoadedTab') {
26933				lazyLoadPagenBlock();
26934			}
26935
26936			InitStickySideBar();
26937		}
26938	});
26939
26940	//event for default basket quantity change
26941	BX.addCustomEvent(window, "OnBasketChange", function(e){
26942		if(arAsproOptions["PAGES"]["BASKET_PAGE"])
26943		{
26944			var summ = 0,
26945				title = '';
26946
26947			if(typeof BX.Sale !== "undefined")
26948			{
26949				if(typeof BX.Sale.BasketComponent !== "undefined")
26950				{
26951					summ = BX.Sale.BasketComponent.result.allSum;
26952					title = BX.message('JS_BASKET_COUNT_TITLE').replace('SUMM', summ);
26953				}
26954			}
26955			else
26956			{
26957				summ = $('#allSum_FORMATED').html().replace(/&nbsp;/g, ' ');
26958				title = BX.message('JS_BASKET_COUNT_TITLE').replace('SUMM', summ);
26959			}
26960
26961			if($('.js-basket-block .wrap .prices').length)
26962				$('.js-basket-block .wrap .prices').html(summ);
26963			if($('a.basket-link.basket').length)
26964				$('a.basket-link.basket').attr('title', title);
26965			if($('.basket_fly .opener .basket_count').length)
26966				$('.basket_fly .opener .basket_count').attr('title', title);
26967
26968		}
26969	})
26970});
26971
26972if(!funcDefined('setBasketStatusBtn')){
26973	setBasketStatusBtn = function(type){
26974		var bSync = (typeof type !== undefined);
26975		if(typeof(arBasketAspro) !== 'undefined')
26976		{
26977			if('BASKET' in arBasketAspro) // basket items
26978			{
26979				if(arBasketAspro.BASKET)
26980				{
26981					for(var i in arBasketAspro.BASKET)
26982					{
26983						$('.to-cart[data-item='+i+']').hide();
26984						$('.counter_block[data-item='+i+']').closest('.counter_block_inner').hide();
26985						$('.counter_block[data-item='+i+']').hide();
26986						$('.in-cart[data-item='+i+']').show();
26987						$('.in-cart[data-item='+i+']').closest('.button_block').addClass('wide');
26988
26989						$('.wish_item.to[data-item='+i+']').show();
26990						$('.wish_item.in[data-item='+i+']').hide();
26991
26992						if($('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .basket_item_add').length)
26993						{
26994							$('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .basket_item_add').addClass('added')
26995							$('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .basket_item_add').attr('title', $('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .basket_item_add').data('title2'))
26996						}
26997
26998
26999					}
27000				}
27001			}
27002
27003			/*services*/
27004			if('SERVICES' in arBasketAspro) // services items
27005			{
27006				$needFillServices = $('.buy_services_wrap[data-parent_product]').length;
27007				if(arBasketAspro.SERVICES && $needFillServices)
27008				{
27009					for(var i in arBasketAspro.SERVICES)
27010					{
27011						var serviceItem = $('.buy_services_wrap[data-parent_product='+ arBasketAspro.SERVICES[i].link_id +'] .services-item[data-item_id='+ arBasketAspro.SERVICES[i].item_id +']');
27012						serviceItem.find('input[name="buy_switch_services"]').prop('checked', true);
27013						serviceItem.find('.counter_block input[name="quantity"]').val(arBasketAspro.SERVICES[i].quantity);
27014						serviceItem.addClass('services_on');
27015					}
27016				}
27017			}
27018			/**/
27019
27020			if('DELAY' in arBasketAspro) // delay items
27021			{
27022				if(arBasketAspro.DELAY)
27023				{
27024					for(var i in arBasketAspro.DELAY)
27025					{
27026						$('.wish_item.to[data-item='+i+']').hide();
27027						$('.wish_item.in[data-item='+i+']').show();
27028						if ($('.wish_item[data-item='+i+']').find(".value.added").length)
27029						{
27030							//$('.wish_item[data-item='+i+']').addClass("added");
27031							$('.wish_item[data-item='+i+']').find(".value").hide();
27032							$('.wish_item[data-item='+i+']').find(".value.added").css('display','block');
27033						}
27034
27035						$('.in-cart[data-item='+i+']').hide();
27036						$('.to-cart[data-item='+i+']').show();
27037						$('.to-cart[data-item='+i+']').closest('.counter_wrapp').find('.counter_block_inner').show();
27038						$('.to-cart[data-item='+i+']').closest('.counter_wrapp').find('.counter_block').show();
27039						$('.to-cart[data-item='+i+']').closest('.button_block').removeClass('wide');
27040
27041						if($('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .wish_item_add').length)
27042						{
27043							$('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .wish_item_add').addClass('added')
27044							$('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .wish_item_add').attr('title', $('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .wish_item_add').data('title2'))
27045						}
27046					}
27047				}
27048			}
27049
27050			if('SUBSCRIBE' in arBasketAspro) // subscribe items
27051			{
27052				if(arBasketAspro.SUBSCRIBE)
27053				{
27054					for(var i in arBasketAspro.SUBSCRIBE)
27055					{
27056						$('.to-subscribe[data-item='+i+']').hide();
27057						$('.in-subscribe[data-item='+i+']').show();
27058					}
27059				}
27060			}
27061
27062			if('COMPARE' in arBasketAspro) // compare items
27063			{
27064				if(arBasketAspro.COMPARE)
27065				{
27066					for(var i in arBasketAspro.COMPARE)
27067					{
27068						$('.compare_item.to[data-item='+i+']').hide();
27069						$('.compare_item.in[data-item='+i+']').show();
27070						if ($('.compare_item[data-item='+i+']').find(".value.added").length)
27071						{
27072							//$('.compare_item[data-item='+i+']').addClass("added");
27073							$('.compare_item[data-item='+i+']').find(".value").hide();
27074							$('.compare_item[data-item='+i+']').find(".value.added").css('display','block');
27075						}
27076
27077						if($('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .compare_item_add').length)
27078						{
27079							$('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .compare_item_add').addClass('added')
27080							$('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .compare_item_add').attr('title', $('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .compare_item_add').data('title2'))
27081						}
27082					}
27083				}
27084			}
27085		}
27086	}
27087}
27088
27089if(!funcDefined('togglePropBlock')){
27090	togglePropBlock=function(className){
27091		var all_props_block = className.closest('.bx_filter_parameters_box_container').find('.hidden_values');
27092		if(all_props_block.length && (className.hasClass('inner_text') || className.hasClass('expand_block')))
27093		{
27094			if(all_props_block.is(':visible'))
27095			{
27096				className.text(BX.message('FILTER_EXPAND_VALUES'));
27097				all_props_block.hide();
27098			}
27099			else
27100			{
27101				className.text(BX.message('FILTER_HIDE_VALUES'));
27102				all_props_block.show();
27103			}
27104		}
27105	}
27106}
27107
27108if(!funcDefined('showPhoneMask')){
27109	showPhoneMask=function(className){
27110		$(className).inputmask('mask', {'mask': arAsproOptions['THEME']['PHONE_MASK'], 'showMaskOnHover':false });
27111	}
27112}
27113
27114if(!funcDefined('getActualBasket')){
27115	getActualBasket=function(iblockID, type, sync){
27116		var data='';
27117		if(typeof iblockID !=="undefined" && iblockID){
27118			data={"iblockID":iblockID}
27119		}
27120		$.ajax({
27121			type:"GET",
27122			url:arAsproOptions['SITE_DIR']+"ajax/actualBasket.php",
27123			data:data,
27124			success: function(data){
27125				if(!$('.js_ajax').length)
27126					$('body').append('<div class="js_ajax"></div>');
27127				$('.js_ajax').html(data);
27128
27129				if(typeof sync !=="undefined"){
27130					setBasketStatusBtn(true);
27131				}
27132
27133				if(typeof(type) !== undefined)
27134				{
27135					var eventdata = {action:'loadActualBasket'+type};
27136					BX.onCustomEvent('onCompleteAction', [eventdata]);
27137				}
27138			}
27139		});
27140	}
27141}
27142
27143if(!funcDefined('reloadBasketCounters')){
27144	reloadBasketCounters=function(count, sync){
27145		var data='';
27146		if(count) {
27147			$('.basket-link.basket .count, .wraps_icon_block.basket .count .items > span').text(count);
27148		} else {
27149			$.ajax({
27150				type:"GET",
27151				url:arAsproOptions['SITE_DIR']+"ajax/actualBasket.php",
27152				data:data,
27153				success: function(data){
27154					if(!$('.js_ajax').length)
27155						$('body').append('<div class="js_ajax"></div>');
27156					$('.js_ajax').html(data);
27157					var countServices = typeof arBasketAspro.SERVICES !== 'undefined' ? Object.keys(arBasketAspro.SERVICES).length : 0 ;
27158					$('.basket-link.basket .count, .wraps_icon_block.basket .count .items > span').text(Object.keys(arBasketAspro.BASKET).length + countServices );
27159					$('.basket-link.delay .count, .wraps_icon_block.delay .count .items > span').text(Object.keys(arBasketAspro.DELAY).length);
27160					$('.basket-link.compare .count, .wraps_icon_block.compare .count .items > span').text(Object.keys(arBasketAspro.COMPARE).length);
27161
27162					if(typeof sync !== 'undefined')
27163					{
27164						setBasketStatusBtn(true);
27165					}
27166				}
27167			});
27168		}
27169	}
27170}
27171
27172function touchMenu(selector){
27173	if(isMobile){
27174		if($(selector).length)
27175		{
27176			$(selector).each(function(){
27177				var th=$(this);
27178				th.on('touchend', function(e) {
27179					var _th = $(e.target).closest('.menu-item');
27180
27181					$('.menu.topest > li').removeClass('hover');
27182					$('.menu_top_block.catalog_block li').removeClass('hover');
27183					$('.bx-breadcrumb-item.drop').removeClass('hover');
27184
27185					if (_th.find('.dropdown-menu').length && !_th.hasClass('hover')) {
27186						e.preventDefault();
27187						e.stopPropagation();
27188						_th.siblings().removeClass('hover');
27189						_th.addClass('hover');
27190						$('.menu-row .dropdown-menu').css({'display':'none', 'opacity':0});
27191						if(_th.hasClass('menu-item'))
27192						{
27193							_th.closest('.dropdown-menu').css({'display':'block', 'opacity':1});
27194						}
27195						if(_th.find('> .wrap > .dropdown-menu'))
27196						{
27197							_th.find('> .wrap > .dropdown-menu').css({'display':'block', 'opacity':1});
27198						}
27199						else if(_th.find('> .dropdown-menu'))
27200						{
27201							_th.find('> .dropdown-menu').css({'display':'block', 'opacity':1});
27202						}
27203						CheckTopVisibleMenu();
27204					}
27205					else
27206					{
27207						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
27208						if(href && href !== 'undefined')
27209							location.href = href;
27210					}
27211				})
27212			})
27213		}
27214	}else{
27215		$(selector).off();
27216	}
27217}
27218
27219function touchTopMenu(selector){
27220	if(isMobile){
27221		if($(selector).length)
27222		{
27223			$(selector).each(function(){
27224				var th=$(this);
27225				th.on('touchend', function(e) {
27226					var _th = $(e.target).closest('li');
27227
27228					$('.menu-item').removeClass('hover');
27229					$('.menu_top_block.catalog_block li').removeClass('hover');
27230					$('.bx-breadcrumb-item.drop').removeClass('hover');
27231
27232					if (_th.hasClass('more') && !_th.hasClass('hover')) {
27233						e.preventDefault();
27234						e.stopPropagation();
27235						_th.siblings().removeClass('hover');
27236						_th.addClass('hover');
27237						$('.menu.topest').css({'overflow': 'visible'});
27238					}
27239					else
27240					{
27241						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
27242						if(href && href !== 'undefined')
27243							location.href = href;
27244					}
27245				})
27246			})
27247		}
27248	}else{
27249		$(selector).off();
27250	}
27251}
27252
27253function touchLeftMenu(selector){
27254	if(isMobile){
27255		if($(selector).length)
27256		{
27257			$(selector).each(function(){
27258				var th=$(this);
27259				th.on('touchend', function(e) {
27260					var _th = $(e.target).closest('li');
27261
27262					$('.menu-item').removeClass('hover');
27263					$('.bx-breadcrumb-item.drop').removeClass('hover');
27264					$('.menu.topest > li').removeClass('hover');
27265
27266					if (_th.hasClass('has-child') && !_th.hasClass('hover')) {
27267						e.preventDefault();
27268						e.stopPropagation();
27269						_th.siblings().removeClass('hover');
27270						_th.addClass('hover');
27271					}
27272					else
27273					{
27274						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
27275						if(href && href !== 'undefined')
27276							location.href = href;
27277					}
27278				})
27279			})
27280		}
27281	}else{
27282		$(selector).off();
27283	}
27284}
27285
27286function touchBreadcrumbs(selector){
27287	if(isMobile){
27288		if($(selector).length)
27289		{
27290			$(selector).each(function(){
27291				var th=$(this);
27292				th.on('touchend', function(e) {
27293					var _th = $(e.target).closest('.bx-breadcrumb-item');
27294
27295					$('.menu-item').removeClass('hover');
27296					$('.menu.topest > li').removeClass('hover');
27297					$('.menu_top_block.catalog_block li').removeClass('hover');
27298
27299					if(!_th.hasClass('hover')) {
27300						e.preventDefault();
27301						e.stopPropagation();
27302						_th.siblings().removeClass('hover');
27303						_th.addClass('hover');
27304					}
27305					else
27306					{
27307						_th.removeClass('hover');
27308						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'));
27309						if(href && href !== 'undefined')
27310							location.href = href;
27311					}
27312				})
27313			})
27314		}
27315	}else{
27316		$(selector).off();
27317	}
27318}
27319
27320function touchItemBlock(selector){
27321	/*if(isMobile){
27322		if($(selector).length)
27323		{
27324			$(selector).each(function(){
27325				var th=$(this),
27326					item=th.closest('.catalog_item');
27327				th.on('touchend', function(e) {
27328					if (!item.hasClass('hover')) {
27329						e.preventDefault();
27330						// e.stopPropagation();
27331						item.siblings().removeClass('hover');
27332						item.siblings().blur();
27333						item.closest('.catalog_block').find('.catalog_item').removeClass('hover');
27334						item.addClass('hover');
27335						item.addClass('touch');
27336
27337						var tabsContentHover = th.closest('.tab').attr('data-hover') * 1,
27338							tabsContentUnhoverHover = th.closest('.tab').attr('data-unhover') * 1;
27339
27340						th.closest('.tab').stop().animate({'height': tabsContentUnhoverHover}, 100);
27341						th.closest('.catalog_item').siblings().find('.buttons_block').stop().fadeOut(233)
27342
27343						th.closest('.tab').fadeTo(100, 1);
27344						th.closest('.tab').stop().css({'height': tabsContentHover});
27345						th.closest('.catalog_item').find('.buttons_block').fadeIn(450, 'easeOutCirc');
27346					}
27347				})
27348			})
27349		}
27350	}else{
27351		$(selector).off();
27352	}*/
27353}
27354function touchBasket(selector){
27355	if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N'){
27356		if($(window).outerWidth()>600){
27357			$(document).find(selector).on('touchend', function(e) {
27358				if ($(this).parent().find('.basket_popup_wrapp').length && !$(this).hasClass('hover')) {
27359					e.preventDefault();
27360					e.stopPropagation();
27361					$(this).addClass('hover');
27362					$(this).parent().find('.basket_popup_wrapp').slideDown();
27363				}
27364			})
27365		}else{
27366			$(selector).off();
27367		}
27368	}
27369}
27370
27371function showTotalSummItem(popup){
27372	//show total summ
27373	if(arAsproOptions['THEME']["SHOW_TOTAL_SUMM_TYPE"] == "ALWAYS" && arAsproOptions['THEME']["SHOW_TOTAL_SUMM"] == "Y")
27374	{
27375		var parent = 'body ';
27376		if(typeof popup  === 'string' && popup == 'Y')
27377			parent = '.popup ';
27378		$(parent+'.counter_wrapp .counter_block input.text').each(function(){
27379			var _th = $(this);
27380			if(_th.data('product'))
27381			{
27382				var obProduct = _th.data('product');
27383				if(typeof window[obProduct] == 'object')
27384					window[obProduct].setPriceAction('Y');
27385				else
27386					setPriceItem(_th.closest('.main_item_wrapper'), _th.val());
27387			}
27388			else
27389				setPriceItem(_th.closest('.main_item_wrapper'), _th.val());
27390		})
27391	}
27392}
27392
27393
27394function initFull(){
27395	initSelects(document);
27396	initHoverBlock(document);
27397	touchItemBlock('.catalog_item a');
27398	InitOrderCustom();
27399	showTotalSummItem();
27400	basketActions();
27401	orderActions();
27402
27403	checkMobileRegion();
27404}
27405
27406checkMobileRegion = function(){
27407	if($('.confirm_region').length)
27408	{
27409		if(!$('.top_mobile_region').length)
27410			$('<div class="top_mobile_region"><div class="confirm_wrapper"><div class="confirm_region"></div></div></div>').insertBefore($('#mobileheader'));
27411		$('.top_mobile_region .confirm_region').html($('.confirm_region').html());
27412
27413		/*$('.top_mobile_region .close_popup').click(function(){
27414			$(this).remove();
27415			$('.confirm_region').remove();
27416		})*/
27417	}
27418}
27419if(!funcDefined('orderActions')){
27420	orderActions = function(e){
27421		if(arAsproOptions["PAGES"]["ORDER_PAGE"]){
27422			//phone
27423			if($('#bx-soa-order input[autocomplete=tel]').length){
27424				// get property phone
27425				for(var i = 0;i<BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties.length;++i){
27426					if(BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties[i].IS_PHONE == 'Y'){
27427						var arPropertyPhone = BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties[i];
27428					}
27429				}
27430
27431				// validate input type=tel
27432				if(typeof(BX.Sale.OrderAjaxComponent) !== 'undefined' && typeof(BX.Sale.OrderAjaxComponent) === 'object' && typeof(arPropertyPhone) == 'object' && arPropertyPhone){
27433					BX.Sale.OrderAjaxComponent.validatePhone = function(input, arProperty, fieldName)
27434					{
27435						if (!input || !arProperty)
27436							return [];
27437
27438						var value = input.value,
27439							errors = [],
27440							name = BX.util.htmlspecialchars(arProperty.NAME),
27441							field = BX.message('SOA_FIELD') + ' "' + name + '"',
27442							re;
27443
27444						if (arProperty.REQUIRED == 'Y' && value.length == 0){
27445							errors.push(field + ' ' + BX.message('SOA_REQUIRED'));
27446						}
27447
27448						if(arProperty.IS_PHONE == 'Y' && value.length > 0){
27449							function regexpPhone(value, element, regexp){
27450								var re = new RegExp( regexp );
27451								return re.test(value);
27452							}
27453
27454							var validPhone = regexpPhone($(input).val(), $(input), arAsproOptions['THEME']['VALIDATE_PHONE_MASK']);
27455
27456							if(!validPhone){
27457								errors.push(field + ' ' +BX.message('JS_FORMAT_ORDER'));
27458							}
27459						}
27460
27461						return errors;
27462					}
27463
27464					BX.Sale.OrderAjaxComponent.getValidationDataPhone = function(arProperty, propContainer){
27465						var data = {}, inputs;
27466						switch (arProperty.TYPE)
27467						{
27468							case 'STRING':
27469								data.action = 'blur';
27470								data.func = BX.delegate(function(input, fieldName){
27471									return this.validatePhone(input, arProperty, fieldName);
27472								}, this);
27473
27474								inputs = propContainer.querySelectorAll('input[type=tel]');
27475								if ($(inputs).length)
27476								{
27477									data.inputs = inputs;
27478									break;
27479								}
27480						}
27481
27482						return data;
27483					};
27484
27485					BX.Sale.OrderAjaxComponent.bindValidationPhone = function(id, propContainer)
27486					{
27487						if (!this.validation.properties || !this.validation.properties[id])
27488							return;
27489
27490						var arProperty = this.validation.properties[id],
27491							data = this.getValidationDataPhone(arProperty, propContainer),
27492							i, k;
27493
27494						if (data && data.inputs && data.action)
27495						{
27496							for (i = 0; i < $(data.inputs).length; i++)
27497							{
27498								if (BX.type.isElementNode(data.inputs[i])){
27499									BX.bind(data.inputs[i], data.action, BX.delegate(function(){
27500										this.isValidProperty(data);
27501									}, this));
27502								}
27503								else{
27504									for (k = 0; k < $(data.inputs[i]).length; k++)
27505										BX.bind(data.inputs[i][k], data.action, BX.delegate(function(){
27506											this.isValidProperty(data);
27507										}, this));
27508								}
27509							}
27510						}
27511					};
27512
27513					BX.Sale.OrderAjaxComponent.isValidPropertiesBlock = function(excludeLocation)
27514					{
27515						if (!this.options.propertyValidation)
27516							return [];
27517
27518						var props = this.orderBlockNode.querySelectorAll('.bx-soa-customer-field[data-property-id-row]'),
27519							propsErrors = [],
27520							id, propContainer, arProperty, data, i;
27521
27522						for (i = 0; i < props.length; i++)
27523						{
27524							id = props[i].getAttribute('data-property-id-row');
27525
27526							if (!!excludeLocation && this.locations[id])
27527								continue;
27528
27529							propContainer = props[i].querySelector('.soa-property-container');
27530							if (propContainer)
27531							{
27532								arProperty = this.validation.properties[id];
27533								data = this.getValidationData(arProperty, propContainer);
27534								dataPhone = this.getValidationDataPhone(arProperty, propContainer);
27535								data = $.extend({}, data, dataPhone);
27536
27537								propsErrors = propsErrors.concat(this.isValidProperty(data, true));
27538							}
27539						}
27540
27541						return propsErrors;
27542					};
27543
27544
27545					// create input type=tel
27546					var input = $('input[autocomplete=tel]'),
27547						inputHTML = input[0].outerHTML,
27548						value = input.val(),
27549						newInput = input[0].outerHTML.replace('type="text"', 'type="tel" value="'+value+'"');
27550
27551					if($(input).length < 2)
27552					{
27553						input.hide();
27554						$(newInput).insertAfter(input);
27555					}
27556					showPhoneMask('input[autocomplete=tel][type=tel]');
27557
27558					// change value input type=text when change input type=tel
27559					$('input[autocomplete=tel][type=tel]').on('blur', function(){
27560						var $this = $(this);
27561
27562						var value = $this.val();
27563						$this.parent().find('input[autocomplete=tel][type=text]').val(value);
27564					});
27565
27566					BX.Sale.OrderAjaxComponent.bindValidationPhone(arPropertyPhone.ID, $('input[autocomplete=tel]').parent()[0]);
27567				}
27568			}
27569
27570			if($('.bx-soa-cart-total').length){
27571				if(!$('.change_basket').length)
27572					$('.bx-soa-cart-total').prepend('<div class="change_basket">'+BX.message("BASKET_CHANGE_TITLE")+'<a href="'+arAsproOptions["SITE_DIR"]+'basket/" class="change_link">'+BX.message("BASKET_CHANGE_LINK")+'</a></div>');
27573
27574				if(typeof (BX.Sale.OrderAjaxComponent) == "object"){
27575					if(arAsproOptions['COUNTERS']['USE_FULLORDER_GOALS'] !== 'N'){
27576						if(typeof BX.Sale.OrderAjaxComponent.reachgoalbegin === 'undefined'){
27577							BX.Sale.OrderAjaxComponent.reachgoalbegin = true;
27578							var eventdata = {goal: 'goal_order_begin'};
27579							BX.onCustomEvent('onCounterGoals', [eventdata])
27580						}
27581					}
27582
27583					if(BX.Sale.OrderAjaxComponent.hasOwnProperty("params")){
27584						$('.bx-soa-cart-total .change_link').attr('href', BX.Sale.OrderAjaxComponent.params.PATH_TO_BASKET);
27585						if(arAsproOptions["PRICES"]["MIN_PRICE"]){
27586							if(arAsproOptions["PRICES"]["MIN_PRICE"]>Number(BX.Sale.OrderAjaxComponent.result.TOTAL.ORDER_PRICE)){
27587								$('<div class="fademask_ext"></div>').appendTo($('body'));
27588								location.href=BX.Sale.OrderAjaxComponent.params.PATH_TO_BASKET;
27589							}
27590						}
27591					}
27592
27593					// update oreder auth form
27594					if($('#bx-soa-auth').length && !$('#bx-soa-auth .redisigned').length){
27595						// update input USER_LOGIN
27596						if($('input[name="USER_LOGIN"]').length){
27597							var $label = $('input[name="USER_LOGIN"]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
27598							if(!$label.find('.bx-authform-starrequired').length){
27599								$label.html($label.html() + '<span class="bx-authform-starrequired"> *</span>');
27600							}
27601						}
27602
27603						// update input USER_PASSWORD
27604						if($('input[name="USER_PASSWORD"]').length){
27605							var $label = $('input[name="USER_PASSWORD"]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
27606							if(!$label.find('.bx-authform-starrequired').length){
27607								$label.html($label.html() + '<span class="bx-authform-starrequired"> *</span>');
27608							}
27609						}
27610
27611						if($('input[name="USER_REMEMBER"]').length){
27612							var $label = $('input[name="USER_REMEMBER"]').attr('id', 'ORDER_AUTH_USER_REMEMBER').closest('label').attr('for', 'ORDER_AUTH_USER_REMEMBER');
27613							var html = $('input[name="USER_REMEMBER"]').attr('id', 'ORDER_AUTH_USER_REMEMBER').wrap('<div id="trem_"></div>').parent().html();
27614							$('#trem_').remove();
27615							$label.html($label.text());
27616							$(html).insertBefore($label).closest('.bx-authform-formgroup-container').addClass('filter');
27617							var html = $('#bx-soa-auth .bx-authform>a').addClass('pull-right').addClass('forgot').wrap('<div id="trem_"></div>').parent().html();
27618							$('#trem_').remove();
27619							$(html).insertAfter($label.closest('.checkbox'));
27620						}
27621
27622						$('#bx-soa-auth .bx-soa-reg-block .btn').removeClass('btn-default').removeClass('btn-lg').addClass('transparent').addClass('btn-lg').text(BX.message('ORDER_REGISTER_BUTTON'));
27623
27624						$('#bx-soa-auth').append('<div class="redisigned hidden></div>');
27625					}
27626
27627					// update oreder register form
27628					if($('.bx-soa-section-content.reg').length && !$('.bx-soa-section-content.reg .redisigned').length){
27629						var bRebindRegSubmit = false;
27630
27631						if(arAsproOptions.THEME.LOGIN_EQUAL_EMAIL === 'Y'){
27632							bRebindRegSubmit = true;
27633
27634							// update input NEW_LOGIN
27635							if($('input[name="NEW_LOGIN"]').length){
27636								$('input[name="NEW_LOGIN"]').closest('.bx-authform-formgroup-container').hide();
27637							}
27638						}
27639
27640						if(arAsproOptions.THEME.PERSONAL_ONEFIO === 'Y'){
27641							bRebindRegSubmit = true;
27642
27643							// update input NEW_NAME
27644							if($('input[name="NEW_NAME"]').length){
27645								$('input[name="NEW_NAME"]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container').html(BX.message('ORDER_FIO_LABEL') + '<span class="bx-authform-starrequired"> *</span>');
27646							}
27647
27648							// update input NEW_LAST_NAME
27649							if($('input[name="NEW_LAST_NAME"]').length){
27650								$('input[name="NEW_LAST_NAME"]').closest('.bx-authform-formgroup-container').hide();
27651								$('input[name="NEW_LAST_NAME"]').val(' ');
27652							}
27653						}
27654
27655						if(bRebindRegSubmit){
27656							// bind new handler for submit button
27657							var $regSubmit = $('#do_register~input[type=submit]');
27658							if($regSubmit.length){
27659								BX.unbindAll($regSubmit[0]);
27660								$(document).on('click', '#do_register~input[type=submit]', function(e){
27661									e.preventDefault();
27662									e.stopImmediatePropagation();
27663
27664									if(arAsproOptions.THEME.LOGIN_EQUAL_EMAIL === 'Y'){
27665										var email = BX.findChild(BX('bx-soa-auth'), {attribute: {'name': 'NEW_EMAIL'}}, true, false);
27666										var login = BX.findChild(BX('bx-soa-auth'), {attribute: {'name': 'NEW_LOGIN'}}, true, false);
27667
27668										if(login && email){
27669											login.value = email.value;
27670										}
27671									}
27672
27673									BX('do_register').value = 'Y';
27674									BX.Sale.OrderAjaxComponent.sendRequest('showAuthForm');
27675								});
27676							}
27677						}
27678
27679						// update captcha
27680						var $captcha = $('.bx-soa-section-content.reg').find('.bx-captcha');
27681						if($captcha.length){
27682							$captcha.addClass('captcha_image');
27683							$captcha.append('<div class="captcha_reload"></div>');
27684							$captcha.closest('.bx-authform-formgroup-container').addClass('captcha-row').find('input[name=captcha_word]').closest('.bx-authform-input-container').addClass('captcha_input');
27685						}
27686
27687						// update input NEW_NAME && NEW_LAST_NAME
27688						if($('input[name=NEW_NAME]').length && $('input[name=NEW_LAST_NAME]').length && arAsproOptions.THEME.PERSONAL_ONEFIO !== 'Y'){
27689							if(!$('input[name=NEW_NAME]').closest('.bx-authform-formgroup-container.col
27689-md-6').length){
27690								$('input[name=NEW_NAME],input[name=NEW_LAST_NAME]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
27691								var html = $('input[name=NEW_LAST_NAME]').closest('.bx-authform-formgroup-container').wrap('<div id="trem_"></div>').parent().html();
27692								$('#trem_').remove();
27693								$(html).insertAfter($('input[name=NEW_NAME]').closest('.bx-authform-formgroup-container').wrap('<div class="row"></div>'));
27694							}
27695						}
27696
27697						// update input NEW_EMAIL && PHONE_NUMBER
27698						if($('input[name=NEW_EMAIL]').length && $('input[name=PHONE_NUMBER]').length){
27699							if(!$('input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container.col-md-6').length){
27700								$('input[name=NEW_EMAIL],input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
27701								var html = $('input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container').wrap('<div id="trem_"></div>').parent().html();
27702								$('#trem_').remove();
27703								$(html).insertAfter($('input[name=NEW_EMAIL]').closest('.bx-authform-formgroup-container').wrap('<div class="row"></div>'));
27704							}
27705						}
27706
27707						// update input NEW_PASSWORD && NEW_PASSWORD_CONFIRM
27708						if($('input[name=NEW_PASSWORD]').length && $('input[name=NEW_PASSWORD_CONFIRM]').length){
27709							if(!$('input[name=NEW_PASSWORD]').closest('.bx-authform-formgroup-container.col
27709-md-6').length){
27710								$('input[name=NEW_PASSWORD],input[name=NEW_PASSWORD_CONFIRM]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
27711								var html = $('input[name=NEW_PASSWORD_CONFIRM]').closest('.bx-authform-formgroup-container').wrap('<div id="trem_"></div>').parent().html();
27712								$('#trem_').remove();
27713								$(html).insertAfter($('input[name=NEW_PASSWORD]').closest('.bx-authform-formgroup-container').wrap('<div class="row"></div>'));
27714							}
27715						}
27716
27717						// update input PHONE_NUMBER
27718						if($('input[name=PHONE_NUMBER]').length){
27719							var input = $('input[name=PHONE_NUMBER]'),
27720								inputHTML = input[0].outerHTML,
27721								value = input.val(),
27722								newInput = input[0].outerHTML.replace('type="text"', 'type="tel" value="'+value+'"');
27723
27724							if($(input).length < 2){
27725								input.hide();
27726								$(newInput).insertAfter(input);
27727
27728								showPhoneMask('input[name=PHONE_NUMBER][type=tel]');
27729
27730								$('input[name=PHONE_NUMBER][type=tel]').on('blur', function(){
27731									var $this = $(this);
27732									var value = $this.val();
27733									$this.parent().find('input[name=PHONE_NUMBER][type=text]').val(value);
27734								});
27735
27736								var $label = $('input[name=PHONE_NUMBER][type=tel]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
27737								$label.html(BX.message('ORDER_PHONE_LABEL') + ($label.find('.bx-authform-starrequired').length ? '<span class="bx-authform-starrequired"> *</span>' : ''));
27738							}
27739						}
27740
27741						$('.bx-soa-section-content.reg').append('<div class="redisigned hidden></div>');
27742					}
27743
27744					var asproShowLicence = arAsproOptions["THEME"]["SHOW_LICENCE"] == "Y";
27745					var asproShowOffer = arAsproOptions["THEME"]["SHOW_OFFER"] == "Y";
27746
27747					if($('.bx-soa-cart-total-line-total').length && (asproShowLicence ||  asproShowOffer)){
27748						if(typeof(e) === 'undefined'){
27749							BX.Sale.OrderAjaxComponent.state_licence = (arAsproOptions['THEME']['LICENCE_CHECKED'] == 'Y' ? 'checked' : '');
27750							BX.Sale.OrderAjaxComponent.state_offer = (arAsproOptions['THEME']['OFFER_CHECKED'] == 'Y' ? 'checked' : '');
27751						}
27752
27753						if( (!$('.licence_block.filter.onoff').length && asproShowLicence) || (!$('.offer_block.filter.onoff').length && asproShowOffer) ){
27754							
27755							$('<div class="form"><div class="license_order_wrap"></div></div>').insertBefore($('#bx-soa-orderSave'));
27756
27757							if(!$('.licence_block.filter.onoff').length && asproShowLicence) {
27758								$('<div class="licence_block filter label_block onoff"><label data-for="licenses_order" class="hidden error">' + BX.message('JS_REQUIRED_LICENSES') + '</label><input type="checkbox" name="licenses_order" required ' + BX.Sale.OrderAjaxComponent.state_licence + ' value="Y"><label data-for="licenses_order" class="license">' + BX.message('LICENSES_TEXT') + '</label></div>').appendTo($('.license_order_wrap'));
27759							}
27760
27761							if(!$('.offer_block.filter.onoff').length && asproShowOffer)
27762								$('<div class="offer_block filter label_block onoff"><label data-for="offer_order" class="hidden error">'+BX.message('JS_REQUIRED_OFFER')+'</label><input type="checkbox" name="offer_order" required '+BX.Sale.OrderAjaxComponent.state_offer+' value="Y"><label data-for="offer_order" class="offer_pub">'+BX.message('OFFER_TEXT')+'</label></div>').appendTo($('.license_order_wrap'));
27763							
27764							if(asproShowLicence){
27765								$(document).on('click', '.bx-soa .licence_block label.license', function(){
27766									var id = $(this).data('for');
27767									$('.bx-soa .licence_block label.error').addClass('hidden');
27768									if(!$('input[name='+id+']').prop('checked')){
27769										$('input[name='+id+']').prop('checked', 'checked');
27770										BX.Sale.OrderAjaxComponent.state_licence = 'checked';
27771									}
27772									else{
27773										$('input[name='+id+']').prop('checked', '');
27774										BX.Sale.OrderAjaxComponent.state_licence = '';
27775									}
27776								})
27777							}
27778
27779							if(asproShowOffer){
27780								$(document).on('click', '.bx-soa .offer_block label.offer_pub', function(){
27781									var id = $(this).data('for');
27782									$('.bx-soa .offer_block label.error').addClass('hidden');
27783									if(!$('input[name='+id+']').prop('checked')){
27784										$('input[name='+id+']').prop('checked', 'checked');
27785										BX.Sale.OrderAjaxComponent.state_offer = 'checked';
27786									}
27787									else{
27788										$('input[name='+id+']').prop('checked', '');
27789										BX.Sale.OrderAjaxComponent.state_offer = '';
27790									}
27791								})
27792							}
27793
27794							$(document).on('click', '.lic_condition a', function(){
27795								if(BX.hasClass(BX('bx-soa-order'), 'orderform--v1')){
27796									if(BX.Sale.OrderAjaxComponent.isValidForm())
27797									{
27798										BX.Sale.OrderAjaxComponent.animateScrollTo($('.licence_block, .offer_block')[0], 800, 50);
27799									}
27800								}
27801								else{
27802									var iCountErrors = BX.Sale.OrderAjaxComponent.isValidPropertiesBlock().length;
27803									if(!BX.Sale.OrderAjaxComponent.activeSectionId || !iCountErrors)
27804									{
27805										BX.Sale.OrderAjaxComponent.animateScrollTo($('.licence_block, .offer_block')[0], 800, 50);
27806									}
27807								}
27808							})
27809						}
27810
27811						$('#bx-soa-orderSave, .bx-soa-cart-total-button-container').addClass('lic_condition');
27812
27813						if(typeof (BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction) === "undefined" && typeof (BX.Sale.OrderAjaxComponent.clickOrderSaveAction) !== 'undefined'){
27814							BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction = BX.Sale.OrderAjaxComponent.clickOrderSaveAction;
27815							BX.Sale.OrderAjaxComponent.clickOrderSaveAction = function(event){
27816								if(
27817									($('input[name="licenses_order"]').prop('checked') || !asproShowLicence)
27818									&& ($('input[name="offer_order"]').prop('checked') || !asproShowOffer)
27819								){
27820									$('.bx-soa .licence_block label.error').addClass('hidden');
27821									$('.bx-soa .offer_block label.error').addClass('hidden');
27822
27823									if (BX.Sale.OrderAjaxComponent.isValidForm())
27824									{
27825										if(typeof BX.Sale.OrderAjaxComponent.allowOrderSave == 'function')
27826											BX.Sale.OrderAjaxComponent.allowOrderSave();
27827										if(typeof BX.Sale.OrderAjaxComponent.doSaveAction == 'function')
27828											BX.Sale.OrderAjaxComponent.doSaveAction();
27829										else
27830											BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction(event);
27831									}
27832								}
27833								else{									
27834									if(!$('input[name="licenses_order"]').prop('checked'))
27835										$('.bx-soa .licence_block label.error').removeClass('hidden');
27836
27837									if(!$('input[name="offer_order"]').prop('checked'))
27838										$('.bx-soa .offer_block label.error').removeClass('hidden');
27839								}
27840							}
27841							if(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox'))
27842							{
27843								if(typeof browser == 'object')
27844								{
27845									if('msie' in browser && browser.msie)
27846										$(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox')).remove();
27847									else
27848										BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox').remove();
27849								}
27850							}
27851							BX.unbindAll(BX.Sale.OrderAjaxComponent.totalInfoBlockNode.querySelector('a.btn-order-save'));
27852							BX.unbindAll(BX.Sale.OrderAjaxComponent.mobileTotalBlockNode.querySelector('a.btn-order-save'));
27853							BX.unbindAll(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('a'));
27854							BX.bind(BX.Sale.OrderAjaxComponent.totalInfoBlockNode.querySelector('a.btn-order-save'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
27855							BX.bind(BX.Sale.OrderAjaxComponent.mobileTotalBlockNode.querySelector('a.btn-order-save'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
27856							BX.bind(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('a'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
27857						}
27858					}
27859
27860					// fix hide total block
27861					$(window).scroll();
27862
27863					if(checkCounters() && typeof (BX.Sale.OrderAjaxComponent.oldSaveOrder) === "undefined"){
27864						var saveFunc = typeof (BX.Sale.OrderAjaxComponent.saveOrder) !== 'undefined' ? 's
27864aveOrder' : 'saveOrderWithJson';
27865						if(typeof (BX.Sale.OrderAjaxComponent[saveFunc]) !== 'undefined'){
27866							BX.Sale.OrderAjaxComponent.oldSaveOrder = BX.Sale.OrderAjaxComponent[saveFunc];
27867							BX.Sale.OrderAjaxComponent[saveFunc] = function(result){
27868								var res = BX.parseJSON(result);
27869								if (res && res.order){
27870									if (!res.order.SHOW_AUTH){
27871										if (res.order.REDIRECT_URL && res.order.REDIRECT_URL.length && (!res.order.ERROR || BX.util.object_keys(res.order.ERROR).length < 1)){
27872											if((arMatch = res.order.REDIRECT_URL.match(/ORDER_ID\=[^&=]*/g)) && arMatch.length && (_id = arMatch[0].replace(/ORDER_ID\=/g, '', arMatch[0]))){
27873												$.ajax({
27874													url:arAsproOptions['SITE_DIR']+"ajax/check_order.php",
27875													dataType: "json",
27876													type: "POST",
27877													data: { "ID": _id },
27878													success: function(id){
27879														if(parseInt(id)){
27880															purchaseCounter(parseInt(id), BX.message('FULL_ORDER'), function(d){
27881																if(typeof localStorage !== 'undefined' && typeof d === 'object'){
27882																	localStorage.setItem('gtm_e_' + _id, JSON.stringify(d));
27883																}
27884																BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
27885															});
27886														}
27887														else{
27888															BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
27889														}
27890													},
27891													error: function(){
27892														BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
27893													}
27894												})
27895											}
27896											else{
27897												BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
27898											}
27899										}
27900										else{
27901											BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
27902										}
27903									}
27904									else{
27905										BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
27906									}
27907								}
27908								else{
27909									BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
27910								}
27911							}
27912						}
27913					}
27914
27915					if($('#bx-soa-order-form .captcha-row').length){
27916						if(window.asproRecaptcha && window.asproRecaptcha.key && window.asproRecaptcha.params.recaptchaSize == 'invisible'){
27917							$('#bx-soa-order-form .captcha-row').addClass('invisible');
27918							if(asproRecaptcha.params.recaptchaLogoShow === 'n'){
27919								$('#bx-soa-order-form .captcha-row').addClass('logo_captcha_n');
27920							}
27921						}
27922					}
27923
27924					if($('#bx-soa-order-form .captcha-row.invisible').length){
27925						if(typeof (BX.Sale.OrderAjaxComponent.oldSendRequest) === "undefined" && typeof (BX.Sale.OrderAjaxComponent.sendRequest) !== 'undefined'){
27926							var tmpAction, tmpActionData;
27927							BX.Sale.OrderAjaxComponent.oldSendRequest = BX.Sale.OrderAjaxComponent.sendRequest;
27928							BX.Sale.OrderAjaxComponent.sendRequest = function(action, actionData){
27929								var bSend = true;
27930
27931								if($('#bx-soa-order-form .captcha-row.invisible').length){
27932									if(window.renderRecaptchaById && window.asproRecaptcha && window.asproRecaptcha.key){
27933										if(window.asproRecaptcha.params.recaptchaSize == 'invisible'){
27934											var form = BX('bx-soa-order-form');
27935											if($(form).find('.g-recaptcha').length){
27936												if($(form).find('.g-recaptcha-response').val()){
27937													bSend = true;
27938												}
27939												else{
27940													if(typeof grecaptcha != 'undefined'){
27941														grecaptcha.execute($(form).find('.g-recaptcha').data('widgetid'));
27942														bSend = false;
27943													}
27944													else{
27945														bSend = false;
27946													}
27947												}
27948											}
27949										}
27950									}
27951								}
27952
27953								if(bSend){
27954									BX.Sale.OrderAjaxComponent.oldSendRequest(action, actionData);
27955								}
27956								else{
27957									tmpAction = action;
27958									tmpActionData = actionData;
27959								}
27960							}
27961
27962							$(document).on('submit', '#bx-soa-order-form', function(e){
27963								e.preventDefault();
27964
27965								if(typeof tmpAction !== 'undefined' || typeof tmpActionData !== 'undefined'){
27966									BX.Sale.OrderAjaxComponent.sendRequest(tmpAction, tmpActionData);
27967									tmpAction = undefined;
27968									tmpActionData = undefined;
27969								}
27970							});
27971						}
27972					}
27973				}
27974
27975				$('.bx-ui-sls-quick-locations.quick-locations').on('click', function(){
27976					$(this).siblings().removeClass('active');
27977					$(this).addClass('active');
27978				})
27979			}
27980		}
27981	}
27982}
27983
27984if(!funcDefined('basketActions')){
27985	basketActions = function(){
27986		if(arAsproOptions["PAGES"]["BASKET_PAGE"]){
27987			checkMinPrice();
27988
27989			//remove4Cart
27990			if(typeof(BX.Sale) !== 'undefined' && typeof(BX.Sale) === 'object')
27991			{
27992				if(typeof(BX.Sale.BasketComponent) !== 'undefined' && typeof(BX.Sale.BasketComponent) === 'object')
27993				{
27994					$(document).on('click', '.basket-item-actions-remove', function(){
27995						var basketID = $(this).closest('.basket-items-list-item-container').data('id');
27996						delFromBasketCounter(BX.Sale.BasketComponent.items[basketID].PRODUCT_ID);
27997					})
27998				}
27999			}
28000
28001			if(location.hash)
28002			{
28003				var hash = location.hash.substring(1);
28004				if($('#basket_toolbar_button_'+hash).length)
28005					$('#basket_toolbar_button_'+hash).trigger('click');
28006
28007				if($('.basket-items-list-header-filter a[data-filter="'+hash+'"]').length)
28008					$('.basket-items-list-header-filter a[data-filter="'+hash+'"]')[0].click();
28009			}
28010			var svg_cross = '<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"><path id="Rounded_Rectangle_568_copy_13" data-name="Rounded Rectangle 568 copy 13" class="cls-1" d="M1615.4,589l2.32,2.315a0.987,0.987,0,0,1,0,1.4,1,1,0,0,1-1.41,0L1614,590.4l-2.31,2.315a1,1,0,0,1-1.41,0,0.987,0.987,0,0,1,0-1.4L1612.6,589l-2.32-2.314a0.989,0.989,0,0,1,0-1.4,1,1,0,0,1,1.41,0l2.31,2.315,2.31-2.315a1,1,0,0,1,1.41,0,0.989,0.989,0,0,1,0,1.4Z" transform="translate(-1610 -585)"/></svg>';
28011
28012			$('.bx_sort_container').append('<div class="top_control basket_action"><span style="opacity:0;
28012" class="delete_all colored_theme_hover_text remove_all_basket">'+svg_cross+BX.message("BASKET_CLEAR_ALL_BUTTON")+'</span></div>');
28013			if($('.basket-items-list-header-filter').length)
28014			{
28015				$('.basket-items-list-header-filter').append('<div class="top_control basket_action"><span style="opacity:1;" class="delete_all colored_theme_hover_text remove_all_basket">'+svg_cross+BX.message("BASKET_CLEAR_ALL_BUTTON")+'</span></div>');
28016
28017				var cur_index = $('.basket-items-list-header-filter > a.active').index();
28018				//fix delayed
28019				if(cur_index == 3)
28020					cur_index = 2;
28021
28022				if($('.basket-items-list-header-filter > a.active').data('filter') == 'all')
28023					cur_index = 'all';
28024
28025				$('.basket-items-list-header-filter .top_control .delete_all').data("type",cur_index);
28026
28027				$('.basket-items-list-header-filter > a').on('click', function() {
28028					var index = $(this).index();
28029
28030					//fix delayed
28031					if(index == 3)
28032						index = 2;
28033
28034					if($(this).data('filter') == 'all')
28035						index = 'all';
28036
28037					$('.basket-items-list-header-filter .top_control .delete_all').data("type", index);
28038				});
28039			}
28040			else
28041			{
28042				var cur_index = $('.bx_sort_container a.current').index();
28043				$('.bx_sort_container .top_control .delete_all').data("type",cur_index);
28044				if($('.bx_ordercart > div:eq('+cur_index+') table tbody tr td.item').length)
28045					$('.bx_sort_container .top_control .delete_all').css('opacity',1);
28046
28047				$('.bx_ordercart .bx_ordercart_coupon #coupon').wrap('<div class="input"></div>');
28048
28049				$('.bx_sort_container > a').on('click', function() {
28050					var index = $(this).index();
28051					$('.bx_sort_container .top_control .delete_all').data("type", index);
28052
28053					if($('.bx_ordercart > div:eq('+index+') table tbody tr td.item').length)
28054						$('.bx_sort_container .top_control .delete_all').css('opacity',1);
28055					else
28056						$('.bx_sort_container .top_control .delete_all').css('opacity',0);
28057				});
28058			}
28059
28060
28061			$('.basket_print').on('click', function() {
28062				 // window.open(location.pathname+"?print=Y",'_blank');
28063				 window.print();
28064			});
28065
28066			$('.delete_all').on('click', function() {
28067				if(arAsproOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N'){
28068					var eventdata = {goal: 'goal_basket_clear', params: {type: $(this).data('type')}};
28069					BX.onCustomEvent('onCounterGoals', [eventdata]);
28070				}
28071				$.post( arAsproOptions['SITE_DIR']+"ajax/action_basket.php", "TYPE="+$(this).data('type')+"&CLEAR_ALL=Y", $.proxy(function( data ) {
28072					location.reload();
28073				}));
28074			});
28075
28076			$('.bx_item_list_section .bx_catalog_item').sliceHeight({row:'.bx_item_list_slide', item:'.bx_catalog_item'});
28077
28078			BX.addCustomEvent('onAjaxSuccess', function(e) {
28079				checkMinPrice();
28080
28081				var errorText = $.trim($('#warning_message').text());
28082				$('#basket_items_list .error_text').detach();
28083				if (errorText != '') {
28084					$('#warning_message').hide().text('');
28085					$('#basket_items_list').prepend('<div class="error_text">' +errorText+ '</div>');
28086				}
28087
28088				if (typeof e === 'object' && 'BASKET_DATA' in e) {
28089					if ($("#ajax_basket").length) {
28090						reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
28091					}
28092					if ($("#basket_line .basket_fly").length) {
28093						basketFly('open', 'N');
28094					}
28095				}
28096			});
28097			$(document).on('click', '.bx_ordercart_order_pay_center .checkout, .basket-checkout-section-inner .basket-btn-checkout', function(){
28098				if(checkCounters('google')){
28099					checkoutCounter(1, 'start order');
28100				}
28101			})
28102		}
28103	}
28104}
28105
28106if(!funcDefined('checkMinPrice')){
28107	checkMinPrice = function(){
28108		if(arAsproOptions["PAGES"]["BASKET_PAGE"]){
28109			var summ_raw=0,
28110				summ=0;
28111			if($('#allSum_FORMATED').length)
28112			{
28113				summ_raw=$('#allSum_FORMATED').text().replace(/[^0-9\.,]/g,'');
28114				summ=parseFloat(summ_raw);
28115				if($('#basket_items').length)
28116				{
28117					var summ = 0;
28118					$('#basket_items tr').each(function(){
28119						if(typeof ($(this).data('item-price')) !== 'undefined' && $(this).data('item-price'))
28120							summ += $(this).data('item-price')*$(this).find('#QUANTITY_INPUT_'+$(this).attr('id')).val();
28121					})
28122				}
28123				if(!$('.catalog_back').length)
28124					$('.bx_ordercart_order_pay_center').prepend('<a href="'+arAsproOptions["PAGES"]["CATALOG_PAGE_URL"]+'" class="catalog_back btn btn-default btn-lg white grey">'+BX.message("BASKET_CONTINUE_BUTTON")+'</a>');
28125			}
28126
28127			if(arAsproOptions['THEME']["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
28128				$('.basket-coupon-section').addClass('smallest');
28129
28130			if(typeof BX.Sale !== "undefined")
28131			{
28132				if(typeof BX.Sale.BasketComponent !== "undefined" && typeof BX.Sale.BasketComponent.result !== "undefined")
28133					summ = BX.Sale.BasketComponent.result.allSum;
28134			}
28135
28136			if(arAsproOptions["PRICES"]["MIN_PRICE"]){
28137				if(arAsproOptions["PRICES"]["MIN_PRICE"]>summ){
28138					var svgMinPrice = '<i class="svg  svg-inline-price colored_theme_svg" aria-hidden="true"><svg id="Group_278_copy" data-name="Group 278 copy" xmlns="http://www.w3.org/2000/svg" width="38" height="38" viewBox="0 0 38 38"><path id="Ellipse_305_copy_2" data-name="Ellipse 305 copy 2" class="clswm-1" d="M1851,561a19,19,0,1,1,19-19A19,19,0,0,1,1851,561Zm0-36a17,17,0,1,0,17,17A17,17,0,0,0,1851,525Zm3.97,10.375-0.03.266c-0.01.062-.02,0.127-0.03,0.188l-0.94,7.515h0a2.988,2.988,0,0,1-5.94,0H1848l-0.91-7.525c-0.01-.041-0.01-0.086-0.02-0.128l-0.04-.316h0.01c-0.01-.
28138125-0.04-0.246-0.04-0.375a4,4,0,0,1,8,0c0,0.129-.03.25-0.04,0.375h0.01ZM1851,533a2,2,0,0,0-2,2,1.723,1.723,0,0,0,.06.456L1850,543a1,1,0,0,0,2,0l0.94-7.544A1.723,1.723,0,0,0,1853,535,2,2,0,0,0,1851,533Zm0,14a3,3,0,1,1-3,3A3,3,0,0,1,1851,547Zm0,4a1,1,0,1,0-1-1A1,1,0,0,0,1851,551Z" transform="translate(-1832 -523)"></path>  <path class="clswm-2 op-cls" d="M1853,543l-1,1h-2l-1-1-1-8,1-2,1-1h2l1,1,1,2Zm-1,5,1,1v2l-1,1h-2l-1-1v-2l1-1h2Z" transform="translate(-1832 -523)"></path></svg></i>';
28139					if($('.oneclickbuy.fast_order').length)
28140						$('.oneclickbuy.fast_order').remove();
28141
28142					if($('.basket-checkout-container').length)
28143					{
28144						if(!$('.icon_error_wrapper').length){
28145							$('.basket-checkout-block.basket-checkout-block-btn').html('<div class="icon_error_wrapper"><div class="icon_error_block">'+svgMinPrice+BX.message("MIN_ORDER_PRICE_TEXT").replace("#PRICE#", jsPriceFormat(arAsproOptions["PRICES"]["MIN_PRICE"]))+'</div></div>');
28146						}
28147					}
28148					else
28149					{
28150						if(!$('.icon_error_wrapper').length  && typeof jsPriceFormat !== 'undefined'){
28151							$('.bx_ordercart_order_pay_center').prepend('<div class="icon_error_wrapper"><div class="icon_error_block">'+svgMinPrice+BX.message("MIN_ORDER_PRICE_TEXT").replace("#PRICE#", jsPriceFormat(arAsproOptions["PRICES"]["MIN_PRICE"]))+'</div></div>');
28152						}
28153						if($('.bx_ordercart_order_pay .checkout').length)
28154							$('.bx_ordercart_order_pay .checkout').remove();
28155					}
28156				}else{
28157					if($('.icon_error_wrapper').length)
28158						$('.icon_error_wrapper').remove();
28159
28160					if($('.basket-checkout-container').length)
28161					{
28162						if(!$('.oneclickbuy.fast_order').length && arAsproOptions['THEME']["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" && !$('.basket-btn-checkout.disabled').length)
28163							$('.basket-checkout-section-inner').append('<div class="fastorder"><span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()">'+BX.message("BASKET_QUICK_ORDER_BUTTON")+'</span></div>');
28164					}
28165					else
28166					{
28167						if($('.bx_ordercart_order_pay .checkout').length)
28168							$('.bx_ordercart .bx_ordercart_order_pay .checkout').css('opacity','1');
28169						else
28170							$('.bx_ordercart_order_pay_center').append('<a href="javascript:void(0)" onclick="checkOut();" class="checkout" style="opacity: 1;">'+BX.message("BASKET_ORDER_BUTTON")+'</a>');
28171						if(!$('.oneclickbuy.fast_order').length && arAsproOptions['THEME']["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
28172							$('.bx_ordercart_order_pay_center').append('<span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()">'+BX.message("BASKET_QUICK_ORDER_BUTTON")+'</span>');
28173					}
28174				}
28175			}else{
28176				if($('.basket-checkout-container').length)
28177				{
28178					if(!$('.oneclickbuy.fast_order').length && arAsproOptions['THEME']["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" && !$('.basket-btn-checkout.disabled').length)
28179						$('.basket-checkout-section-inner').append('<div class="fastorder"><span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()">'+BX.message("BASKET_QUICK_ORDER_BUTTON")+'</span></div>');
28180				}
28181				else
28182				{
28183					$('.bx_ordercart .bx_ordercart_order_pay .checkout').css('opacity','1');
28184					if(!$('.oneclickbuy.fast_order').length && arAsproOptions['THEME']["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
28185						$('.bx_ordercart_order_pay_center').append('<span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()">'+BX.message("BASKET_QUICK_ORDER_BUTTON")+'</span>');
28186				}
28187			}
28188
28189			showBasketShareBtn();
28190			showBasketHeadingBtn();
28191
28192			$('#basket-root .basket-checkout-container .basket-checkout-section .basket-checkout-block .basket-btn-checkout');
28193			$('#basket-root .basket-checkout-container').addClass('visible');
28194		}
28195	}
28196}
28197
28198var isFrameDataReceived = false;
28199if (typeof window.frameCacheVars !== "undefined"){
28200	BX.addCustomEvent(window, "onFrameDataRequestFail", function(response){
28201		console.log(response);
28202	});
28203
28204	BX.addCustomEvent("onFrameDataReceivedBefore", function (){
28205		// stop ya metrika webvisor DOM indexer
28206		pauseYmObserver();
28207	});
28208
28209	BX.addCustomEvent("onFrameDataReceived", function (json){
28210		initFull();
28211
28212		CheckTopMenuPadding();
28213		CheckTopMenuOncePadding();
28214		CheckTopMenuDotted();
28215
28216		CheckSearchWidth();
28217
28218		checkLinkedArticles();
28219		checkLinkedBlocks('.linked-banners-list');
28220
28221		if($('.logo-row.v2').length)
28222		{
28223			$(window).resize(); // need to check resize flexslider & menu
28224			setTimeout(function(){
28225				CheckTopMenuDotted();
28226			}, 100);
28227		}
28228
28229		if(funcDefined('setNewHeader')) {
28230			if(typeof BX === 'object' && (BX.message('TYPE_SKU') != 'TYPE_1' || BX.message('HAS_SKU_PROPS') != 'Y')) {
28231					setNewHeader();
28232			} else {
28233				var objNameWrapper = $('.bx_catalog_item_scu[id]');
28234				if(objNameWrapper.length) {
28235					var id = 'ob'+objNameWrapper.attr('id').replace('_skudiv', '');
28236					if(id && window[id] !== undefined) {
28237						var obj = window[id].offers[window[id].offerNum];
28238						if(obj !== undefined) {
28239							setNewHeader(obj);
28240						}
28241					}
28242				}
28243			}
28244		}
28245
28246		// resume ya metrika webvisor
28247		// (100ms sliceHeight) + (200ms mCustomScroll) + (100ms lazyload)
28248		setTimeout(resumeYmObserver, 400);
28249
28250		isFrameDataReceived = true;
28251	});
28252}else{
28253	$( document ).ready(initFull);
28254}
28255
28256if(!funcDefined('setHeightBlockSlider')){
28257	setHeightBlockSlider = function(){
28258		$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').equalize({children: '.item-title'});
28259		$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').equalize({children: '.item_info'});
28260		$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').equalize({children: '.catalog_item'});
28261
28262		var sliderWidth = $(document).find('.specials.tab_slider_wrapp').outerWidth();
28263
28264		var iCountTabs = $(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').length;
28265
28266		if(iCountTabs <= 1)
28267		{
28268			$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').css('height', '');
28269
28270			var itemsButtonsHeight = 0;
28271			if($(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').length)
28272			{
28273				$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').css('height', 'auto');
28274				itemsButtonsHeight = $(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').height();
28275				$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').css('height', '');
28276			}
28277			var tabsContentUnhover = $(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').height() * 1;
28278			var tabsContentHover = tabsContentUnhover + itemsButtonsHeight+50;
28279			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').attr('data-unhover', tabsContentUnhover);
28280			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').attr('data-hover', tabsContentHover);
28281			$(document).find('.specials.tab_slider_wrapp .tabs_content').height(tabsContentUnhover);
28282			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .flex-viewport').height(tabsContentUnhover);
28283		}
28284		else
28285		{
28286			$(document).find('.specials.tab_slider_wrapp .tabs_content > li.cur').each(function(){
28287				var _th = $(this);
28288				_th.css('height', '');
28289
28290				var itemsButtonsHeight = 0;
28291				if(_th.find('.tabs_slider li .footer_button').length)
28292				{
28293					_th.find('.tabs_slider li .footer_button').css('height', 'auto');
28294					itemsButtonsHeight = _th.find('.tabs_slider li .footer_button').height();
28295					_th.find('.tabs_slider li .footer_button').css('height', '');
28296				}
28297
28298				var tabsContentUnhover = _th.height() * 1;
28299				var tabsContentHover = tabsContentUnhover + itemsButtonsHeight+50;
28300				_th.attr('data-unhover', tabsContentUnhover);
28301				_th.attr('data-hover', tabsContentHover);
28302				_th.parent().height(tabsContentUnhover);
28303				_th.find('.flex-viewport').height(tabsContentUnhover);
28304
28305			})
28306		}
28307	}
28308}
28309
28310if(!funcDefined('checkTopFilter')){
28311	checkTopFilter = function() {
28312		/*if(window.matchMedia('(max-width: 991px)').matches){
28313			//if($('.group_description_block.top').length){
28314				var top_pos=$('.adaptive_filter').position().top;
28315				$('.bx_filter.bx_filter_vertical').css({'top':top_pos+43});
28316			//}
28317		}*/
28318	}
28319}
28320
28321if(!funcDefined('checkStickyFooter')){
28322	checkStickyFooter = function() {
28323		try{
28324			ignoreResize.push(true);
28325			$('#content').css('min-height', '');
28326			var contentTop = $('#content').offset().top;
28327			var contentBottom = contentTop + $('#content').outerHeight();
28328			var footerTop = 0;
28329			if($('footer').length)
28330				footerOffset = $('footer').offset().top;
28331
28332			$('#content').css('min-height', $(window).height() - contentTop - (footerTop - contentBottom) - $('footer').outerHeight() + 'px');
28333			ignoreResize.pop();
28334		}
28335		catch(e){console.error(e);}
28336	}
28337}
28338
28339if(!funcDefined('checkLinkedArticles')){
28340	checkLinkedArticles = function() {
28341		try{
28342			if ($('.linked-blog-list.content .item-views').length) {
28343				var mobileRow = $('.linked-blog-list').data('mobile_row'),
28344					desktopRow = $('.linked-blog-list').data('desktop_row'),
28345					parentBlock = $('.ajax_load .js_append'),
28346					widthRow = parentBlock.getFloatWidth(),
28347					elementWidthRow = parentBlock.find('> .item:eq(0)').getFloatWidth(),
28348					elementsCount = parentBlock.find('> .item').length,
28349					slice = Math.floor(widthRow / elementWidthRow),
28350					rowInsertCount = Math.floor(elementsCount/slice),
28351					bCalculateRows = false;
28352				if (window.matchMedia('(max-width: 767px)').matches) {
28353					if (!mobileRow && desktopRow) {
28354						mobileRow = desktopRow;
28355					}
28356					if (mobileRow && mobileRow <= rowInsertCount) {
28357						rowInsertCount = slice*mobileRow;
28358						bCalculateRows = true;
28359					}
28360				} else {
28361					if (desktopRow && desktopRow <= rowInsertCount) {
28362						rowInsertCount = slice*desktopRow;
28363						bCalculateRows = true;
28364					}
28365				}
28366				if (!bCalculateRows) {
28367					rowInsertCount = elementsCount;
28368				}
28369
28370				var linkedBlock = '.linked-blog-list';
28371				var blockInItems = parentBlock.find(linkedBlock);
28372				if(blockInItems.length){
28373					$(blockInItems).insertAfter(parentBlock.find('> .item:eq('+(rowInsertCount-1)+')'));
28374					setTimeout(function(){
28375						$(blockInItems).addClass('visible');
28376					}, 0);
28377				} else {
28378					var cloneBlock = $(linkedBlock).clone();
28379					var owlBlock = cloneBlock.find('.owl-carousel-wait');					
28380					cloneBlock.insertAfter(parentBlock.find('> .item:eq('+(rowInsertCount-1)+')'));
28381					owlBlock.removeClass('owl-carousel-wait').addClass('owl-carousel');
28382					setTimeout(function() {
28383						cloneBlock.addClass('visible');
28384						InitOwlSlider();
28385						owlBlock.removeClass('loader_circle');
28386					}, 1);
28387				}
28388
28389				// $('.linked-blog-list').insertAfter(parentBlock.find('> .item:eq('+(rowInsertCount-1)+')'));
28390				// setTimeout(function(){
28391				// 	$('.linked-blog-list').addClass('visible');
28392				// }, 0);
28393			}
28394		}
28395		catch(e){console.error(e);}
28396	}
28397}
28398
28399if(!funcDefined('checkLinkedBlocks')){
28400	checkLinkedBlocks = function(linkedBlock) {
28401		if(!linkedBlock)
28402			linkedBlock = '.linked-banners-list';
28403		
28404		try{
28405			if ($(linkedBlock + '.content' + ' div').length) {
28406				var mobileRow = $(linkedBlock).data('mobile_row'),
28407					desktopRow = $(linkedBlock).data('desktop_row'),
28408					parentBlock = $('.ajax_load .js_append'),
28409					widthRow = parentBlock.getFloatWidth(),
28410					elementWidthRow = parentBlock.find('> .item:eq(0)').getFloatWidth(),
28411					elementsCount = parentBlock.find('> .item').length,
28412					slice = Math.floor(widthRow / elementWidthRow),
28413					rowInsertCount = Math.floor(elementsCount/slice),
28414					bCalculateRows = false;
28415				if (window.matchMedia('(max-width: 767px)').matches) {
28416					if (!mobileRow && desktopRow) {
28417						mobileRow = desktopRow;
28418					}
28419					if (mobileRow && mobileRow <= rowInsertCount) {
28420						rowInsertCount = slice*mobileRow;
28421						bCalculateRows = true;
28422					}
28423				} else {
28424					if (desktopRow && desktopRow <= rowInsertCount) {
28425						rowInsertCount = slice*desktopRow;
28426						bCalculateRows = true;
28427					}
28428				}
28429				if (!bCalculateRows) {
28430					rowInsertCount = elementsCount;
28431				}
28432				var blockInItems = parentBlock.find(linkedBlock);
28433				if(blockInItems.length){
28434					$(blockInItems).insertAfter(parentBlock.find('> .item:eq('+(rowInsertCount-1)+')'));
28435					setTimeout(function(){
28436						$(blockInItems).addClass('visible');
28437					}, 0);
28438				} else {
28439					var cloneBlock = $(linkedBlock).clone();
28440					var owlBlock = cloneBlock.find('.owl-carousel-wait');					
28441					cloneBlock.insertAfter(parentBlock.find('> .item:eq('+(rowInsertCount-1)+')'));
28442					owlBlock.removeClass('owl-carousel-wait').addClass('owl-carousel');
28443					setTimeout(function() {
28444						cloneBlock.addClass('visible');
28445						InitOwlSlider();
28446						owlBlock.removeClass('loader_circle');
28447					}, 1);
28448				}
28449
28450				// $(linkedBlock).insertAfter(parentBlock.find('> .item:eq('+(rowInsertCount-1)+')'));
28451				// setTimeout(function(){
28452				// 	$(linkedBlock).addClass('visible');
28453				// }, 0);
28454			}
28455		}
28456		catch(e){console.error(e);}
28457	}
28458}
28459
28460
28461
28462/* EVENTS */
28463var timerResize = false, ignoreResize = [];
28464$(window).resize(function(){
28465	CheckPopupTop();
28466	checkLinkedArticles();
28467	checkLinkedBlocks('.linked-banners-list');
28468
28469	// here immediate functions
28470	if(!ignoreResize.length){
28471
28472		if(timerResize){
28473			clearTimeout(timerResize);
28474			timerResize = false;
28475		}
28476		timerResize = setTimeout(function(){
28477			// here delayed functions in event
28478			BX.onCustomEvent('onWindowResize', false);
28479		}, 50);
28480	}
28481});
28482
28483var timerScroll = false, ignoreScroll = [], documentScrollTopLast = $(document).scrollTop(), startScroll = 0;
28484$(window).scroll(function(){
28485	CheckPopupTop();
28486	// here immediate functions
28487	documentScrollTopLast = $(document).scrollTop();
28488	SetFixedAskBlock();
28489
28490	if(!ignoreScroll.length){
28491		if(timerScroll){
28492			clearTimeout(timerScroll);
28493			timerScroll = false;
28494		}
28495		timerScroll = setTimeout(function(){
28496			// here delayed functions in event
28497			BX.onCustomEvent('onWindowScroll', false);
28498		}, 50);
28499	}
28500});
28501
28502BX.addCustomEvent('onWindowResize', function(eventdata){
28503	try{
28504		ignoreResize.push(true);
28505
28506		CheckTopMenuPadding();
28507		CheckTopMenuOncePadding();
28508		CheckSearchWidth();
28509
28510		CheckTabActive();
28511		CheckTopMenuFullCatalogSubmenu();
28512		CheckHeaderFixedMenu();
28513
28514		if(window.matchMedia('(min-width:768px)').matches) {
28515			closeYandexMap();
28516		}
28517
28518		CheckTopMenuDotted();
28519		if($('nav.mega-menu.sliced').length)
28520			$('nav.mega-menu.sliced').removeClass('initied');
28521
28522
28523		CheckTopVisibleMenu();
28524
28525		checkScrollToTop();
28526		CheckObjectsSizes();
28527
28528		CheckFlexSlider();
28529		initSly();
28530
28531		// checkVerticalMobileFilter();
28532		if (typeof checkMobilePhone === 'function') {
28533			checkMobilePhone();
28534		}
28535		checkTopFilter();
28536		if (typeof checkMobileFilter === 'function') {
28537			checkMobileFilter();
28538		}
28539
28540		if(arAsproOptions['THEME'] && arAsproOptions['THEME']['COMPACT_FOOTER_MOBILE'] == 'Y') {
28541		    if (window.matchMedia('(max-width:767px)').matches) {
28542				$('footer').addClass('mobile');
28543				$('.bottom-menu .items>.wrap_compact_mobile').addClass('accordion-body collapse');
28544				$('.bottom-menu .items>.item.childs').attr('data-toggle','collapse');
28545		    } else {
28546		    	$('footer').removeClass('mobile');
28547		    	$('.bottom-menu .items>.wrap_compact_mobile').removeClass('accordion-body collapse');
28548		    	$('.bottom-menu .items>.item.childs').removeAttr('data-toggle');
28549		    }
28550		}
28551
28552		if(typeof window['stickySidebar'] !== 'undefined')
28553		{
28554			if(window.matchMedia('(max-width: 991px)').matches)
28555			{
28556				window['stickySidebar'].destroy();
28557			}
28558			else
28559			{
28560				window['stickySidebar'].bindEvents();
28561			}
28562		}
28563
28564		if($('.flexslider.wsmooth').length){
28565			$('.flexslider.wsmooth').each(function(){
28566				$(this).data('flexslider').smoothHeight();
28567			});
28568		}
28569
28570		if(window.matchMedia('(min-width: 767px)').matches)
28571			$('.wrapper_middle_menu.wrap_menu').removeClass('mobile');
28572
28573		if(window.matchMedia('(max-width: 767px)').matches)
28574			$('.wrapper_middle_menu.wrap_menu').addClass('mobile');
28575
28576
28577		if($("#basket_form").length && $(window).outerWidth()<=600){
28578			$("#basket_form .tabs_content.basket > li.cur td").each(function() { $(this).css("width","");});
28579		}
28580
28581		$(".bx_filter_section .bx_filter_select_container").each(function(){
28582			var prop_id=$(this).closest('.bx_filter_parameters_box').attr('property_id');
28583			if($('#smartFilterDropDown'+prop_id).length){
28584				$('#smartFilterDropDown'+prop_id).css("max-width", $(this).width());
28585			}
28586		})
28587
28588		if(window.matchMedia('(min-width: 768px)').matches){
28589			// min-width: 768px
28590			$('.bx_filter .scrollbar').removeClass('mobile-scroll');
28591			$('.bx_filter .srollbar-custom').removeClass('mobile-scroll');
28592			$('.bx_filter .bx_filter_section form .bx_filter_parameters').removeClass('mobile-scroll');
28593			InitScrollBar();
28594			InitCustomScrollBar();
28595		}
28596		else{
28597			// max-width: 767px
28598			$('.bx_filter .scrollbar').addClass('mobile-scroll').removeClass('scroll-init');
28599			$('.bx_filter .srollbar-custom').addClass('mobile-scroll').removeClass('scroll-init');
28600			$('.bx_filter .bx_filter_section form .bx_filter_parameters').addClass('mobile-scroll').removeClass('scroll-init');
28601			if($('.bx_filter .mobile-scroll.scrollbar').length)
28602				$('.bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
28603			if($('.bx_filter .mobile-scroll.srollbar-custom').length)
28604				$('.bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
28605		}
28606
28607	}
28608	catch(e){
28609		console.log(e);
28610	}
28611	finally{
28612		ignoreResize.pop();
28613	}
28614});
28615
28616BX.addCustomEvent('onWindowScroll', function(eventdata){
28617	try{
28618		ignoreScroll.push(true);
28619	}
28620	catch(e){}
28621	finally{
28622		ignoreScroll.pop();
28623	}
28624});
28625
28626BX.addCustomEvent('onSlideInit', function(eventdata) {
28627	try{
28628		ignoreResize.push(true);
28629		if(eventdata){
28630			var slider = eventdata.slider;
28631			if(slider){
28632				if(slider.hasClass('small-gallery'))
28633					$(window).resize();
28634				// add classes .curent & .shown to slide
28635				slider.find('.item').removeClass('current');
28636				var curSlide = slider.find('.item.flex-active-slide'),
28637					curSlideId = curSlide.attr('id'),
28638					nav = slider.find('.flex-direction-nav');
28639
28640				curSlide.addClass('current');
28641
28642				slider.find('.visible').css('opacity', '1');
28643				slider.find('.height0').css('height', 'auto');
28644
28645				if(curSlide.hasClass('shown')){
28646					slider.find('.item.clone[id=' + curSlideId + '_clone]').addClass('shown');
28647				}
28648
28649				curSlide.addClass('shown');
28650
28651			}
28652		}
28653	}
28654	catch(e){}
28655	finally{
28656		ignoreResize.pop();
28657	}
28658});
28659
28660BX.addCustomEvent('onCounterGoals', function(eventdata){
28661	if(arAsproOptions['THEME']['YA_GOALS'] == 'Y' && arAsproOptions['THEME']['YA_COUNTER_ID'])
28662	{
28663		var idCounter = arAsproOptions['THEME']['YA_COUNTER_ID'];
28664		idCounter = parseInt(idCounter);
28665
28666		if(typeof eventdata != 'object')
28667			eventdata = {goal: 'undefined'};
28668
28669		if(typeof eventdata.goal != 'string')
28670			eventdata.goal = 'undefined';
28671
28672		if(idCounter)
28673		{
28674			try
28675			{
28676				waitCounter(idCounter, 50, function(){
28677					var obCounter = window['yaCounter' + idCounter];
28678					if(typeof obCounter == 'object'){
28679						obCounter.reachGoal(eventdata.goal);
28680					}
28681				});
28682			}
28683			catch(e)
28684			{
28685				console.error(e)
28686			}
28687		}
28688		else
28689		{
28690			console.info('Bad counter id!', idCounter);
28691		}
28692	}
28693})
28694
28695var onCaptchaVerifyinvisible = function(response){
28696	$('.g-recaptcha:last').each(function(){
28697		var id = $(this).attr('data-widgetid');
28698		if(typeof(id) !== 'undefined' && response){
28699			if(!$(this).closest('form').find('.g-recaptcha-response').val())
28700				$(this).closest('form').find('.g-recaptcha-response').val(response)
28701			if($('iframe[src*=recaptcha]').length)
28702			{
28703				$('iframe[src*=recaptcha]').each(function(){
28704					var block = $(this).parent().parent();
28705					if(!block.hasClass('grecaptcha-badge'))
28706						block.css('width', '100%');
28707				})
28708			}
28709			$(this).closest('form').submit();
28710		}
28711	})
28712}
28713
28714var onCaptchaVerifynormal = function(response){
28715	$('.g-recaptcha').each(function(){
28716		var id = $(this).attr('data-widgetid');
28717		if(typeof(id) !== 'undefined'){
28718			if(grecaptcha.getResponse(id) != ''){
28719				$(this).closest('form').find('.recaptcha').valid();
28720			}
28721		}
28722	});
28723}
28724
28725BX.addCustomEvent('onSubmitForm', function(eventdata){
28726	try{
28727		if(!window.renderRecaptchaById || !window.asproRecaptcha || !window.asproRecaptcha.key)
28728		{
28729			eventdata.form.submit();
28730			$(eventdata.form).closest('.form').addClass('sending');
28731			return true;
28732		}
28733
28734		if(window.asproRecaptcha.params.recaptchaSize == 'invisible' && $(eventdata.form).find('.g-recaptcha').length)
28735		{
28736			if($(eventdata.form).find('.g-recaptcha-response').val())
28737			{
28738				eventdata.form.submit();
28739				$(eventdata.form).closest('.form').addClass('sending');
28740				return true;
28741			}
28742			else
28743			{
28744				if(typeof grecaptcha != 'undefined'){
28745					grecaptcha.execute($(eventdata.form).find('.g-recaptcha').data('widgetid'));
28746				}
28747				else{
28748					return false;
28749				}
28750			}
28751		}
28752		else
28753		{
28754			eventdata.form.submit();
28755			$(eventdata.form).closest('.form').addClass('sending');
28756			return true;
28757		}
28758	}
28759	catch (e){
28760		console.error(e);
28761		return true;
28762	}
28763})
28764
28765$(document).on('click', '.catalog_reviews_extended span.dropdown-select__list-link', function(){
28766	var _this = $(this);
28767	var ajaxData = _this.data('review_sort_ajax');
28768	var container = _this.closest('[id^=comp_]');
28769	containerId = container.attr('id');
28770	if(containerId !== undefined && containerId) {
28771		ajaxData.containerId = containerId;
28772	}
28773	if(ajaxData !== undefined) {
28774		container.addClass('blur')
28775		$.ajax({
28776			type: 'post',
28777			data: ajaxData,
28778			success: function(html){
28779				$('#reviews_sort_continer').html(html);
28780			}
28781		});
28782	}
28783});
28784
28785$(document).on('click', '.rating_vote:not(.disable)', function(){
28786
28787	var _this = $(this);
28788	var action = _this.data('action');
28789	var parent = _this.closest('.rating-vote');
28790	var commentId = parent.data('comment_id');
28791	var userId = parent.data('user_id');
28792	var ajaxUrl = parent.data('ajax_url');
28793	$.ajax({
28794		url: ajaxUrl,
28795		dataType: 'json',
28796		data: {'commentId': commentId, 'action': action, 'userId': userId},
28797		success: function(data){
28798			if(data.LIKE !== undefined) {
28799				_this.siblings('.rating-vote-result.like').text(data.LIKE);
28800			}
28801			if(data.DISLIKE !== undefined) {
28802				_this.siblings('.rating-vote-result.dislike').text(data.DISLIKE);
28803			}
28804			if(data.SET_ACTIVE_LIKE !== undefined) {
28805				parent.find('.rating_vote.plus').toggleClass('active');
28806			}
28807			if(data.SET_ACTIVE_DISLIKE !== undefined) {
28808				parent.find('.rating_vote.minus').toggleClass('active');
28809			}
28810		}
28811	});
28812
28813});
28814
28815function fileInputInit(message){
28816    $('input[type=file]').uniform({fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message});
28817    $(document).on('change', 'input[type=file]', function(){
28818        if($(this).val())
28819        {
28820            $(this).closest('.uploader').addClass('files_add');
28821        }
28822        else
28823        {
28824            $(this).closest('.uploader').removeClass('files_add');
28825        }
28826    })
28827    $('.form .add_file').on('click', function(){
28828        var index = $(this).closest('.input').find('input[type=file]').length+1;
28829
28830        $(this).closest('.form-group').find('.input').append('<input type="file" id="POPUP_FILE" name="FILE_n'+index+'"   class="inputfile" value="" />');
28831        $('input[type=file]').uniform({fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message});
28832    });
28833
28834    $('.form .add_file').on('click', function(){
28835        var index = $(this).closest('.input').find('input[type=file]').length+1;
28836
28837        $(this).closest('.form-group').find('.input').append('<input type="file" id="POPUP_FILE" name="FILE_n'+index+'"   class="inputfile" value="" />');
28838        $('input[type=file]').uniform({fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message});
28839    });
28840}
28841
28842/*custom event for sku prices*/
28843
28844/*BX.addCustomEvent('onAsproSkuSetPrice', function(eventdata){
28845	console.log(eventdata);
28846})*/
28847
28848/*BX.addCustomEvent('onAsproSkuSetPriceMatrix', function(eventdata){
28849	console.log(eventdata);
28850})*/
28851
28852function declOfNum(number, titles)
28853{
28854	var cases = [2, 0, 1, 1, 1, 2];
28855	return number + " " + titles[ (number%100>4 && number%100<20)? 2 : cases[Math.min(number%10, 5)] ];
28856}
28857
28858function array_values_js( input ) { 
28859	var tmp_arr = new Array(), cnt = 0;
28860	for ( key in input ){
28861		tmp_arr[cnt] = input[key];
28862		cnt++;
28863	}
28864	
28865	return tmp_arr;
28866}
28867/* End */
28868;
28869; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/aspro_max_local/js/blocks/blocks.js?16396301508424";s:6:"source";s:52:"/local/templates/aspro_max_local/js/blocks/blocks.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
28870InitMenuNavigationAim = function(){
28871	var $block = $('.menu-navigation__sections-wrapper .menu-navigation__sections:not(.aim-init)');
28872	if($block.length){
28873		$block.addClass('aim-init');
28874		$block.menuAim({
28875	        firstActiveRow: true,
28876	        rowSelector: "> .menu-navigation__sections-item",
28877	        activate: function activate(a) {
28878	            var _this = $(a),
28879	                index = _this.index(),
28880	                items = _this.closest('.menu-navigation__sections-wrapper').next(),
28881	                link = _this.find('> a');
28882
28883	            _this.siblings().find('> a').addClass('dark_link')
28884	            link.addClass('colored_theme_text').removeClass('dark_link');
28885	            items.find('.parent-items').siblings().hide();
28886	            items.find('.parent-items').eq(index).show();
28887	        },
28888	        deactivate: function deactivate(a) {
28889	            var _this = $(a),
28890	                index = _this.index(),
28891	                items = _this.closest('.menu-navigation__sections-wrapper').next(),
28892	                link = _this.find('> a');
28893
28894	          link.removeClass('colored_theme_text').addClass('dark_link');
28895	          items.find('.parent-items').siblings().hide();
28896	        }
28897	    });
28898	}
28899}
28900
28901$(document).ready(function(){
28902	//dropdown-select
28903		$(document).on('click', '.dropdown-select .dropdown-select__title', function(){
28904			var _this = $(this),
28905				menu = _this.parent().find('> .dropdown-select__list'),
28906				bVisibleMeu = (menu.is(':visible')),
28907				animate = (!bVisibleMeu ? 'transition.slideUpIn' : 'fadeOut');
28908
28909			if(!_this.hasClass('clicked'))
28910			{
28911				_this.addClass('clicked');
28912
28913				menu.velocity('stop').velocity(animate, {
28914					duration: 300,
28915					// delay: 250,
28916					begin: function(){
28917						_this.toggleClass('opened');
28918					},
28919					complete: function(){
28920						_this.removeClass('clicked');
28921					}
28922				});
28923			}
28924		})
28925
28926		// close select
28927		$("html, body").on('mousedown', function(e){
28928			if(typeof e.target.className == 'string' && e.target.className.indexOf('adm') < 0)
28929			{
28930				e.stopPropagation();
28931
28932				if(!$(e.target).closest('.dropdown-select').length)
28933				{
28934					$('.dropdown-select .dropdown-select__title.opened').click();
28935				}
28936			}
28937		})
28938	/**/
28939
28940
28941	/*side head block*/
28942	$(document).on('click', '.slide-block .slide-block__head', function(e){
28943		var _this = $(this),
28944			menu = _this.siblings('.slide-block__body'),
28945			bVisibleMeu = (menu.is(':visible')),
28946			animate = (bVisibleMeu ? 'slideUp' : 'slideDown');
28947
28948		if(!_this.hasClass('clicked') && menu.length && !_this.hasClass('ignore') && !$(e.target).attr('href'))
28949		{
28950			var type = _this.data('id');
28951			_this.addClass('clicked');
28952
28953			if(bVisibleMeu)
28954				$.cookie(type+'_CLOSED', 'Y');
28955			else
28956				$.cookie(type+'_CLOSED', 'N'); //$.removeCookie(type+'_CLOSED');
28957
28958			menu.velocity('stop').velocity(animate, {
28959				duration: 150,
28960				// delay: 250,
28961				begin: function(){
28962					_this.toggleClass('closed');
28963				},
28964				complete: function(){
28965					_this.removeClass('clicked');
28966
28967					if(typeof window['stickySidebar'] !== 'undefined')
28968					{
28969						window['stickySidebar'].updateSticky();
28970					}
28971				}
28972			});
28973		}
28974	})
28975	/**/
28976
28977	/*sku change props*/
28978	if(!('SelectOfferProp' in window) && typeof window.SelectOfferProp != 'function')
28979	{
28980		SelectOfferProp = function(){
28981			// return false;
28982			var _this = $(this),
28983				obParams = {},
28984				obSelect = {},
28985				objUrl = parseUrlQuery(),
28986				add_url = '',
28987				selectMode = (_this.hasClass('list_values_wrapper') ? true : false),
28988				container = _this.closest('.bx_catalog_item_scu'),
28989				img = _this.closest('.item-parent').find('.thumb img');
28990
28991			/* request params */
28992			obParams = {
28993				'PARAMS': _this.closest('.js_wrapper_items').data('params'),
28994				'ID': container.data('offer_id'),
28995				'SITE_ID': container.data('site_id'),
28996				'LINK_ID': container.data('id')+'_'+_this.closest('.cur').data('code'),
28997				'IBLOCK_ID': container.data('offer_iblockid'),
28998				'PROPERTY_ID': container.data('propertyid'),
28999				'DEPTH': _this.closest('.item_wrapper').index(),
29000				'VALUE': (selectMode ? _this.find('option:selected').data('onevalue') : _this.data('onevalue')),
29001				'CLASS': 'inner_content',
29002				'PICTURE': (img.data('src') ? img.data('src') : img.attr('src')),
29003				'ARTICLE_NAME': _this.closest('.item-parent').find('.article_block').data('name'),
29004				'ARTICLE_VALUE': _this.closest('.item-parent').find('.article_block').data('value'),
29005			}
29006			/**/
29007
29008			if("clear_cache" in objUrl)
29009			{
29010				if(objUrl.clear_cache == "Y")
29011					add_url += "?clear_cache=Y";
29012			}
29013
29014			/* save selected values */
29015			for (i = 0; i < obParams.DEPTH+1; i++)
29016			{
29017				strName = 'PROP_'+container.find('.item_wrapper:eq('+i+') > div').data('id');
29018				if(container.find('.item_wrapper:eq('+i+') select').length)
29019				{
29020					obSelect[strName] = container.find('.item_wrapper:eq('+i+') select option:selected').data('onevalue');
29021					obParams[strName] = container.find('.item_wrapper:eq('+i+') select option:selected').data('onevalue');
29022				}
29023				else
29024				{
29025					obSelect[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
29026					obParams[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
29027				}
29028			}
29029
29030			// obParams.SELECTED = JSON.stringify(obSelect);
29031			/**/
29032
29033			if(!selectMode)
29034			{
29035				_this.siblings().removeClass('active');
29036				_this.addClass('active');
29037			}
29038
29039
29040			if(_this.attr('title'))
29041			{
29042				var skuVal = _this.attr('title').split(':')[1];
29043				_this.closest('.item_wrapper').find('.show_class .val').text(skuVal);
29044			}
29045			else
29046			{
29047				var img_row = _this.find(' > i');
29048				if(img_row.length && img_row.attr('title')) {
29049					var skuVal = img_row.attr('title').split(':')[1];
29050					_this.closest('.item_wrapper').find('.show_class .val').text(skuVal);
29051				}
29052			}
29053
29054			/* get sku */
29055			$.ajax({
29056				url: arMaxOptions['SITE_DIR']+'ajax/js_item_detail.php'+add_url,
29057				type: 'POST',
29058				data: obParams,
29059			}).success(function(html){
29060				var ob = BX.processHTML(html);BX.ajax.processScripts(ob.SCRIPT);
29061				if($('.counter_wrapp.list'))
29062				{
29063					$('.counter_wrapp.list .counter_block.big').removeClass('big');
29064				}
29065
29066				var sku_props = _this.closest('.sku_props').find('.item_wrapper .item.active');
29067				$.each(sku_props,function(index,value){					
29068					value = $(value);
29069					if(value.attr('title'))
29070					{
29071						var skuVal = value.attr('title').split(':')[1];
29072						value.closest('.item_wrapper').find('.show_class .val').text(skuVal);
29073					}
29074					else
29075					{
29076						var img_row = value.find(' > i');
29077						if(img_row.length && img_row.attr('title')) {
29078							var skuVal = img_row.attr('title').split(':')[1];
29079							value.closest('.item_wrapper').find('.show_class .val').text(skuVal);
29080						}
29081					}
29082				});
29083
29084			})
29085		}
29086		$(document).on('click', '.ajax_load .bx_catalog_item_scu li.item', SelectOfferProp)
29087		$(document).on('change', '.ajax_load .bx_catalog_item_scu select.list_values_wrapper', SelectOfferProp)
29088	}
29089
29090	/**/
29091
29092	/**/
29093	$('.switch-item-block .switch-item-block__icons').on('click', function(){
29094		var $this = $(this),
29095			animationTime = 200;
29096
29097		if($this.hasClass('switch-item-block__icons--small') && !$this.hasClass('active')){
29098			$this.addClass('active');
29099			$this.siblings('.switch-item-block__icons--big').removeClass('active');
29100			$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--big').fadeOut(animationTime, function(){
29101				$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--small').fadeIn(animationTime);
29102			});
29103
29104			$this.closest('.switch-item-block').siblings('.big-gallery-block').fadeOut(animationTime, function(){
29105				$this.closest('.switch-item-block').siblings('.small-gallery-block').fadeIn(animationTime);
29106			});
29107		}
29108		else if($this.hasClass('switch-item-block__icons--big') && !$this.hasClass('active')){
29109			$this.addClass('active');
29110			$this.siblings('.switch-item-block__icons--small').removeClass('active');
29111			$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--small').fadeOut(animationTime, function(){
29112				$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--big').fadeIn(animationTime);
29113			});
29114
29115			$this.closest('.switch-item-block').siblings('.small-gallery-block').fadeOut(animationTime, function(){
29116				$this.closest('.switch-item-block').siblings('.big-gallery-block').fadeIn(animationTime);
29117			});
29118		}
29119		setTimeout(function(){
29120			InitLazyLoad();
29121		}, 300);
29122	});
29123	/**/
29124
29125	/*many items menu*/
29126
29127	InitMenuNavigationAim();
29128	/**/
29129})
29130/* End */
29131;
29132; /* Start:"a:4:{s:4:"full";s:64:"/bitrix/components/bitrix/search.title/script.js?177728676810573";s:6:"source";s:48:"/bitrix/components/bitrix/search.title/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
29133function JCTitleSearch(arParams)
29134{
29135	var _this = this;
29136
29137	this.arParams = {
29138		'AJAX_PAGE': BX.util.htmlspecialcharsback(arParams.AJAX_PAGE),
29139		'CONTAINER_ID': arParams.CONTAINER_ID,
29140		'INPUT_ID': arParams.INPUT_ID,
29141		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN, 10),
29142	};
29143
29144	if (arParams.WAIT_IMAGE)
29145	{
29146		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
29147	}
29148
29149	if (this.arParams.MIN_QUERY_LEN <= 0)
29150	{
29151		this.arParams.MIN_QUERY_LEN = 1;
29152	}
29153
29154	this.cache = [];
29155	this.cache_key = null;
29156
29157	this.startText = '';
29158	this.running = false;
29159	this.runningCall = false;
29160	this.currentRow = -1;
29161	this.RESULT = null;
29162	this.CONTAINER = null;
29163	this.INPUT = null;
29164	this.WAIT = null;
29165
29166	this.ShowResult = function(result)
29167	{
29168		if (BX.type.isString(result))
29169		{
29170			_this.RESULT.innerHTML = result;
29171		}
29172
29173		_this.RESULT.style.display = _this.RESULT.innerHTML === '' ? 'none' : 'block';
29174		var pos = _this.adjustResultNode();
29175
29176		// adjust left column to be an outline
29177		var resultPosition = null;
29178		var th = null;
29179		var tbl = BX.findChild(_this.RESULT, { 'tag': 'table', 'class': 'title-search-result' }, true);
29180		if (tbl)
29181		{
29182			th = BX.findChild(tbl, { 'tag': 'th' }, true);
29183		}
29184
29185		if (th)
29186		{
29187			var tablePosition = BX.pos(tbl);
29188			tablePosition.width = tablePosition.right - tablePosition.left;
29189
29190			var tableHeaderPosition = BX.pos(th);
29191			tableHeaderPosition.width = tableHeaderPosition.right - tableHeaderPosition.left;
29192			th.style.width = tableHeaderPosition.width + 'px';
29193
29194			_this.RESULT.style.width = (pos.width + tableHeaderPosition.width) + 'px';
29195
29196			// Move table to left by width of the first column
29197			_this.RESULT.style.left = (pos.left - tableHeaderPosition.width - 1) + 'px';
29198
29199			// Shrink table when it's too wide
29200			if ((tablePosition.width - tableHeaderPosition.width) > pos.width)
29201			{
29202				_this.RESULT.style.width = (pos.width + tableHeaderPosition.width - 1) + 'px';
29203			}
29204
29205			// Check if table is too wide and shrink result div to it's width
29206			tablePosition = BX.pos(tbl);
29207			resultPosition = BX.pos(_this.RESULT);
29208			if (resultPosition.right > tablePosition.right)
29209			{
29210				_this.RESULT.style.width = (tablePosition.right - tablePosition.left) + 'px';
29211			}
29212		}
29213
29214		var fade = false;
29215		if (tbl)
29216		{
29217			fade = BX.findChild(_this.RESULT, { 'class': 'title-search-fader' }, true);
29218		}
29219
29220		if (fade && th)
29221		{
29222			resultPosition = BX.pos(_this.RESULT);
29223			fade.style.left = (resultPosition.right - resultPosition.left - 18) + 'px';
29224			fade.style.width = 18 + 'px';
29225			fade.style.top = 0 + 'px';
29226			fade.style.height = (resultPosition.bottom - resultPosition.top) + 'px';
29227			fade.style.display = 'block';
29228		}
29229	};
29230
29231	this.onKeyPress = function(keyCode)
29232	{
29233		var tbl = BX.findChild(_this.RESULT, { 'tag': 'table', 'class': 'title-search-result' }, true);
29234		if (!tbl)
29235		{
29236			return false;
29237		}
29238
29239		var i = 0;
29240		var cnt = tbl.rows.length;
29241
29242		switch (keyCode)
29243		{
29244			case 27: // escape key - close search div
29245				_this.RESULT.style.display = 'none';
29246				_this.currentRow = -1;
29247				_this.UnSelectAll();
29248
29249				return true;
29250			case 40: // down key - navigate down on search results
29251				if (_this.RESULT.style.display == 'none')
29252				{
29253					_this.RESULT.style.display = 'block';
29254				}
29255
29256				var first = -1;
29257				for (i = 0; i < cnt; i++)
29258				{
29259					if (!BX.findChild(tbl.rows[i], { 'class': 'title-search-separator' }, true))
29260					{
29261						if (first == -1)
29262						{
29263							first = i;
29264						}
29265
29266						if (_this.currentRow < i)
29267						{
29268							_this.currentRow = i;
29269							break;
29270						}
29271						else if (tbl.rows[i].className == 'title-search-selected')
29272						{
29273							tbl.rows[i].className = '';
29274						}
29275					}
29276				}
29277
29278				if (i == cnt && _this.currentRow != i)
29279				{
29280					_this.currentRow = first;
29281				}
29282
29283				tbl.rows[_this.currentRow].className = 'title-search-selected';
29284
29285				return true;
29286			case 38: // up key - navigate up on search results
29287				if (_this.RESULT.style.display == 'none')
29288				{
29289					_this.RESULT.style.display = 'block';
29290				}
29291
29292				var last = -1;
29293				for (i = cnt - 1; i >= 0; i--)
29294				{
29295					if (!BX.findChild(tbl.rows[i], { 'class': 'title-search-separator' }, true))
29296					{
29297						if (last == -1)
29298						{
29299							last = i;
29300						}
29301
29302						if (_this.currentRow > i)
29303						{
29304							_this.currentRow = i;
29305							break;
29306						}
29307						else if (tbl.rows[i].className == 'title-search-selected')
29308						{
29309							tbl.rows[i].className = '';
29310						}
29311					}
29312				}
29313
29314				if (i < 0 && _this.currentRow != i)
29315				{
29316					_this.currentRow = last;
29317				}
29318
29319				tbl.rows[_this.currentRow].className = 'title-search-selected';
29320
29321				return true;
29322			case 13: // enter key - choose current search result
29323				if (_this.RESULT.style.display == 'block')
29324				{
29325					for (i = 0; i < cnt; i++)
29326					{
29327						if (
29328							_this.currentRow == i
29329							&& !BX.findChild(tbl.rows[i], { 'class': 'title-search-separator' }, true)
29330						)
29331						{
29332							var a = BX.findChild(tbl.rows[i], { 'tag': 'a' }, true);
29333							if (a)
29334							{
29335								window.location = a.href;
29336
29337								return true;
29338							}
29339						}
29340					}
29341				}
29342
29343				return false;
29344			default:
29345				break;
29346		}
29347
29348		return false;
29349	};
29350
29351	this.onTimeout = function()
29352	{
29353		_this.onChange(function() {
29354			setTimeout(_this.onTimeout, 500);
29355		});
29356	};
29357
29358	this.onChange = function(callback)
29359	{
29360		if (_this.running)
29361		{
29362			_this.runningCall = true;
29363
29364			return;
29365		}
29366		_this.running = true;
29367
29368		if (_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
29369		{
29370			_this.oldValue = _this.INPUT.value;
29371			if (_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
29372			{
29373				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
29374				if (_this.cache[_this.cache_key] == null)
29375				{
29376					if (_this.WAIT)
29377					{
29378						var pos = BX.pos(_this.INPUT);
29379						var height = (pos.bottom - pos.top) - 2;
29380						_this.WAIT.style.top = (pos.top + 1) + 'px';
29381						_this.WAIT.style.height = height + 'px';
29382						_this.WAIT.style.width = height + 'px';
29383						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
29384						_this.WAIT.style.display = 'block';
29385					}
29386
29387					BX.ajax.post(
29388						_this.arParams.AJAX_PAGE,
29389						{
29390							'ajax_call': 'y',
29391							'INPUT_ID': _this.arParams.INPUT_ID,
29392							'q': _this.INPUT.value,
29393							'l': _this.arParams.MIN_QUERY_LEN,
29394						},
29395						function(result)
29396						{
29397							_this.cache[_this.cache_key] = result;
29398							_this.ShowResult(result);
29399							_this.currentRow = -1;
29400							_this.EnableMouseEvents();
29401							if (_this.WAIT)
29402							{
29403								_this.WAIT.style.display = 'none';
29404							}
29405
29406							if (!!callback)
29407							{
29408								callback();
29409							}
29410
29411							_this.running = false;
29412							if (_this.runningCall)
29413							{
29414								_this.runningCall = false;
29415								_this.onChange();
29416							}
29417						}
29418					);
29419
29420					return;
29421				}
29422
29423				_this.ShowResult(_this.cache[_this.cache_key]);
29424				_this.currentRow = -1;
29425				_this.EnableMouseEvents();
29426			}
29427			else
29428			{
29429				_this.RESULT.style.display = 'none';
29430				_this.currentRow = -1;
29431				_this.UnSelectAll();
29432			}
29433		}
29434
29435		if (!!callback)
29436		{
29437			callback();
29438		}
29439		_this.running = false;
29440	};
29441
29442	this.onScroll = function ()
29443	{
29444		if (BX.type.isElementNode(_this.RESULT)
29445			&& _this.RESULT.style.display !== 'none'
29446			&& _this.RESULT.innerHTML !== ''
29447		)
29448		{
29449			_this.adjustResultNode();
29450		}
29451	};
29452
29453	this.UnSelectAll = function()
29454	{
29455		var tbl = BX.findChild(_this.RESULT, { 'tag': 'table', 'class': 'title-search-result' }, true);
29456		if (tbl)
29457		{
29458			var cnt = tbl.rows.length;
29459			for (var i = 0; i < cnt; i++)
29460			{
29461				tbl.rows[i].className = '';
29462			}
29463		}
29464	};
29465
29466	this.EnableMouseEvents = function()
29467	{
29468		var tbl = BX.findChild(_this.RESULT, { 'tag': 'table', 'class': 'title-search-result' }, true);
29469		if (tbl)
29470		{
29471			var cnt = tbl.rows.length;
29472			for (var i = 0; i < cnt; i++)
29473			{
29474				if (!BX.findChild(tbl.rows[i], { 'class': 'title-search-separator' }, true))
29475				{
29476					tbl.rows[i].id = 'row_' + i;
29477					tbl.rows[i].onmouseover = function (e) {
29478						if (_this.currentRow != this.id.substr(4))
29479						{
29480							_this.UnSelectAll();
29481							this.className = 'title-search-selected';
29482							_this.currentRow = this.id.substr(4);
29483						}
29484					};
29485
29486					tbl.rows[i].onmouseout = function (e) {
29487						this.className = '';
29488						_this.currentRow = -1;
29489					};
29490				}
29491			}
29492		}
29493	};
29494
29495	this.onFocusLost = function(hide)
29496	{
29497		setTimeout(function() { _this.RESULT.style.display = 'none'; }, 250);
29498	};
29499
29500	this.onFocusGain = function()
29501	{
29502		if (_this.RESULT.innerHTML.length > 0)
29503		{
29504			_this.ShowResult();
29505		}
29506	};
29507
29508	this.onKeyDown = function(e)
29509	{
29510		if (!e)
29511		{
29512			e = window.event;
29513		}
29514
29515		if (_this.RESULT.style.display == 'block' && _this.onKeyPress(e.keyCode))
29516		{
29517			return BX.PreventDefault(e);
29518		}
29519	};
29520
29521	this.adjustResultNode = function()
29522	{
29523		if (!(BX.type.isElementNode(_this.RESULT)
29524			&& BX.type.isElementNode(_this.CONTAINER))
29525		)
29526		{
29527			return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
29528		}
29529
29530		var pos = BX.pos(_this.CONTAINER);
29531
29532		_this.RESULT.style.position = 'absolute';
29533		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
29534		_this.RESULT.style.left = pos.left + 'px';
29535		_this.RESULT.style.width = pos.width + 'px';
29536
29537		return pos;
29538	};
29539
29540	this.onContainerLayoutChange = function()
29541	{
29542		if (BX.type.isElementNode(_this.RESULT)
29543			&& _this.RESULT.style.display !== 'none'
29544			&& _this.RESULT.innerHTML !== ''
29545		)
29546		{
29547			_this.adjustResultNode();
29548		}
29549	};
29550
29551	this.Init = function()
29552	{
29553		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
29554		BX.addCustomEvent(this.CONTAINER, 'OnNodeLayoutChange', this.onContainerLayoutChange);
29555
29556		this.RESULT = document.body.appendChild(document.createElement("DIV"));
29557		this.RESULT.className = 'title-search-result';
29558		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
29559		this.startText = this.INPUT.value;
29560		this.oldValue = this.INPUT.value;
29561		BX.bind(this.INPUT, 'focus', function() { _this.onFocusGain(); });
29562		BX.bind(this.INPUT, 'blur', function() { _this.onFocusLost(); });
29563		this.INPUT.onkeydown = this.onKeyDown;
29564
29565		if (this.arParams.WAIT_IMAGE)
29566		{
29567			this.WAIT = document.body.appendChild(document.createElement('DIV'));
29568			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
29569			if (!BX.browser.IsIE())
29570			{
29571				this.WAIT.style.backgroundRepeat = 'none';
29572			}
29573			this.WAIT.style.display = 'none';
29574			this.WAIT.style.position = 'absolute';
29575			this.WAIT.style.zIndex = '1100';
29576		}
29577
29578		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
29579
29580		var fixedParent = BX.findParent(this.CONTAINER, BX.is_fixed);
29581		if (BX.type.isElementNode(fixedParent))
29582		{
29583			BX.bind(window, 'scroll', BX.throttle(this.onScroll, 100, this));
29584		}
29585	};
29586
29587	BX.ready(function() { _this.Init(arParams); });
29588}
29589
29590/* End */
29591;
29592; /* Start:"a:4:{s:4:"full";s:92:"/local/templates/.default/components/bitrix/search.title/mega_menu/script.js?162019756910313";s:6:"source";s:76:"/local/templates/.default/components/bitrix/search.title/mega_menu/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
29593$(document).ready(function(){
29594	var containerHTML = $('.title-search-input_mega_menu').detach();
29595	$('#title-search_mega_menu').append(containerHTML);
29596});
29597
29598function JCTitleSearch3(arParams)
29599{
29600	var _this = this;
29601
29602	this.arParams = {
29603		'AJAX_PAGE': arParams.AJAX_PAGE,
29604		'CONTAINER_ID': arParams.CONTAINER_ID,
29605		'INPUT_ID': arParams.INPUT_ID,
29606		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
29607	};
29608	if(arParams.WAIT_IMAGE)
29609		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
29610	if(arParams.MIN_QUERY_LEN <= 0)
29611		arParams.MIN_QUERY_LEN = 1;
29612
29613	this.cache = [];
29614	this.cache_key = null;
29615
29616	this.startText = '';
29617	this.running = false;
29618	this.needRunAgain = false;
29619	this.currentRow = -1;
29620	this.RESULT = null;
29621	this.CONTAINER = null;
29622	this.INPUT = null;
29623	this.WAIT = null;
29624
29625	this.ShowResult = function(result)
29626	{
29627		if(BX.type.isString(result))
29628		{
29629			_this.RESULT.innerHTML = result;
29630		}
29631
29632		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
29633		var pos = _this.adjustResultNode();
29634
29635		//adjust left column to be an outline
29636		var res_pos;
29637		var th;
29638		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
29639		if(tbl)
29640		{
29641			th = BX.findChild(tbl, {'tag':'th'}, true);
29642		}
29643		if(th)
29644		{
29645			var tbl_pos = BX.pos(tbl);
29646			tbl_pos.width = tbl_pos.right - tbl_pos.left;
29647
29648			var th_pos = BX.pos(th);
29649			th_pos.width = th_pos.right - th_pos.left;
29650			th.style.width = th_pos.width + 'px';
29651
29652			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
29653
29654			//Move table to left by width of the first column
29655			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
29656
29657			//Shrink table when it's too wide
29658			if((tbl_pos.width - th_pos.width) > pos.width)
29659				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
29660
29661			//Check if table is too wide and shrink result div to it's width
29662			tbl_pos = BX.pos(tbl);
29663			res_pos = BX.pos(_this.RESULT);
29664			if(res_pos.right > tbl_pos.right)
29665			{
29666				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
29667			}
29668		}
29669
29670		var fade;
29671		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
29672		if(fade && th)
29673		{
29674			res_pos = BX.pos(_this.RESULT);
29675			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
29676			fade.style.width = 18 + 'px';
29677			fade.style.top = 0 + 'px';
29678			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
29679			fade.style.display = 'block';
29680		}
29681
29682		
29683		$('.bx_searche.scrollbar').mCustomScrollbar({
29684			mouseWheel: {
29685				scrollAmount: 150,
29686				preventDefault: true
29687			}
29688		});
29689	};
29690
29691	this.onKeyPress = function(keyCode)
29692	{
29693		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
29694		if(!tbl)
29695			return false;
29696
29697		var i;
29698		var cnt = tbl.rows.length;
29699
29700		switch (keyCode)
29701		{
29702		case 27: // escape key - close search div
29703			_this.RESULT.style.display = 'none';
29704			_this.currentRow = -1;
29705			_this.UnSelectAll();
29706		return true;
29707
29708		case 40: // down key - navigate down on search results
29709			if(_this.RESULT.style.display == 'none')
29710				_this.RESULT.style.display = 'block';
29711
29712			var first = -1;
29713			for(i = 0; i < cnt; i++)
29714			{
29715				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
29716				{
29717					if(first == -1)
29718						first = i;
29719
29720					if(_this.currentRow < i)
29721					{
29722						_this.currentRow = i;
29723						break;
29724					}
29725					else if(tbl.rows[i].className == 'title-search-selected')
29726					{
29727						tbl.rows[i].className = '';
29728					}
29729				}
29730			}
29731
29732			if(i == cnt && _this.currentRow != i)
29733				_this.currentRow = first;
29734
29735			tbl.rows[_this.currentRow].className = 'title-search-selected';
29736		return true;
29737
29738		case 38: // up key - navigate up on search results
29739			if(_this.RESULT.style.display == 'none')
29740				_this.RESULT.style.display = 'block';
29741
29742			var last = -1;
29743			for(i = cnt-1; i >= 0; i--)
29744			{
29745				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
29746				{
29747					if(last == -1)
29748						last = i;
29749
29750					if(_this.currentRow > i)
29751					{
29752						_this.currentRow = i;
29753						break;
29754					}
29755					else if(tbl.rows[i].className == 'title-search-selected')
29756					{
29757						tbl.rows[i].className = '';
29758					}
29759				}
29760			}
29761
29762			if(i < 0 && _this.currentRow != i)
29763				_this.currentRow = last;
29764
29765			tbl.rows[_this.currentRow].className = 'title-search-selected';
29766		return true;
29767
29768		case 13: // enter key - choose current search result
29769			if(_this.RESULT.style.display == 'block')
29770			{
29771				for(i = 0; i < cnt; i++)
29772				{
29773					if(_this.currentRow == i)
29774					{
29775						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
29776						{
29777							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
29778							if(a)
29779							{
29780								window.location = a.href;
29781								return true;
29782							}
29783						}
29784					}
29785				}
29786			}
29787		return false;
29788		}
29789
29790		return false;
29791	};
29792
29793	this.onTimeout = function()
29794	{
29795		_this.onChange(function(){
29796			setTimeout(_this.onTimeout, 500);
29797		});
29798	};
29799
29800	this.onChange = function(callback)
29801	{
29802		if (_this.running) {
29803			_this.needRunAgain = true;
29804			return;
29805		}
29806		_this.running = true;
29807
29808		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
29809		{
29810			_this.oldValue = _this.INPUT.value;
29811			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
29812			{
29813				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
29814				if(_this.cache[_this.cache_key] == null)
29815				{
29816					if(_this.WAIT)
29817					{
29818						var pos = BX.pos(_this.INPUT);
29819						var height = (pos.bottom - pos.top)-2;
29820						_this.WAIT.style.top = (pos.top+1) + 'px';
29821						_this.WAIT.style.height = height + 'px';
29822						_this.WAIT.style.width = height + 'px';
29823						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
29824						_this.WAIT.style.display = 'block';
29825					}
29826
29827					BX.ajax.post(
29828						_this.arParams.AJAX_PAGE,
29829						{
29830							'ajax_call':'y',
29831							'INPUT_ID':_this.arParams.INPUT_ID,
29832							'q':_this.INPUT.value,
29833							'l':_this.arParams.MIN_QUERY_LEN
29834						},
29835						function(result)
29836						{
29837							_this.cache[_this.cache_key] = result;
29838							_this.ShowResult(result);
29839							_this.currentRow = -1;
29840							_this.EnableMouseEvents();
29841							if(_this.WAIT)
29842								_this.WAIT.style.display = 'none';
29843							if (!!callback)
29844								callback();
29845							_this.running = false;
29846
29847							if(_this.needRunAgain){
29848								_this.needRunAgain = false;
29849								_this.onChange(callback);
29850							}
29851						}
29852					);
29853					return;
29854				}
29855				else
29856				{
29857					_this.ShowResult(_this.cache[_this.cache_key]);
29858					_this.currentRow = -1;
29859					_this.EnableMouseEvents();
29860				}
29861			}
29862			else
29863			{
29864				_this.RESULT.style.display = 'none';
29865				_this.currentRow = -1;
29866				_this.UnSelectAll();
29867			}
29868		}
29869		if (!!callback)
29870			callback();
29871		_this.running = false;
29872	};
29873
29874	this.UnSelectAll = function()
29875	{
29876		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
29877		if(tbl)
29878		{
29879			var cnt = tbl.rows.length;
29880			for(var i = 0; i < cnt; i++)
29881				tbl.rows[i].className = '';
29882		}
29883	};
29884
29885	this.EnableMouseEvents = function()
29886	{
29887		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
29888		if(tbl)
29889		{
29890			var cnt = tbl.rows.length;
29891			for(var i = 0; i < cnt; i++)
29892				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
29893				{
29894					tbl.rows[i].id = 'row_' + i;
29895					tbl.rows[i].onmouseover = function (e) {
29896						if(_this.currentRow != this.id.substr(4))
29897						{
29898							_this.UnSelectAll();
29899							this.className = 'title-search-selected';
29900							_this.currentRow = this.id.substr(4);
29901						}
29902					};
29903					tbl.rows[i].onmouseout = function (e) {
29904						this.className = '';
29905						_this.currentRow = -1;
29906					};
29907				}
29908		}
29909	};
29910
29911	this.onFocusLost = function(hide)
29912	{
29913		setTimeout(function(){_this.RESULT.style.display = 'none';}, 250);
29914		//_this.RESULT.style.display = 'none';
29915	};
29916
29917	this.onFocusGain = function()
29918	{
29919		if(_this.RESULT.innerHTML.length)
29920			_this.ShowResult();
29921	};
29922
29923	this.onKeyDown = function(e)
29924	{
29925		if(!e)
29926			e = window.event;
29927
29928		if (_this.RESULT.style.display == 'block')
29929		{
29930			if(_this.onKeyPress(e.keyCode))
29931				return BX.PreventDefault(e);
29932		}
29933		
29934		$('.title-search-result.'+_this.arParams.INPUT_ID).removeClass('closed');
29935	};
29936
29937	this.adjustResultNode = function()
29938	{
29939		var pos, pos_input;
29940		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
29941		/*if(!!fixedParent)
29942		{
29943			_this.RESULT.style.position = 'fixed';
29944			_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
29945			pos = BX.pos(_this.CONTAINER, true);
29946		}
29947		else
29948		{*/
29949			_this.RESULT.style.position = 'absolute';
29950			pos = BX.pos(_this.CONTAINER, true);
29951		//}
29952		pos_input = BX.pos(_this.INPUT);
29953
29954		pos.width = pos.right - pos.left;
29955		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
29956		//_this.RESULT.style.left = pos_input.left + 'px';
29957		_this.RESULT.style.left = 0 + 'px';
29958
29959		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
29960			_this.RESULT.style.width = pos_input.width + 'px';
29961		else
29962			_this.RESULT.style.width = pos.width + 'px';
29963		return pos;
29964	};
29965
29966	this._onContainerLayoutChange = function()
29967	{
29968		if(_this.RESULT.style.display !== "none" && _this.RESULT.innerHTML !== '')
29969		{
29970			_this.adjustResultNode();
29971		}
29972	};
29973	this.Init = function()
29974	{
29975		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
29976		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
29977
29978		this.RESULT = document.body.appendChild(document.createElement("DIV"));
29979
29980		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
29981		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
29982		this.startText = this.oldValue = this.INPUT.value;
29983		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
29984		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
29985
29986		if(BX.browser.IsSafari() || BX.browser.IsIE())
29987			this.INPUT.onkeydown = this.onKeyDown;
29988		else
29989			this.INPUT.onkeypress = this.onKeyDown;
29990
29991		if(this.arParams.WAIT_IMAGE)
29992		{
29993			this.WAIT = document.body.appendChild(document.createElement("DIV"));
29994			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
29995			if(!BX.browser.IsIE())
29996				this.WAIT.style.backgroundRepeat = 'none';
29997			this.WAIT.style.display = 'none';
29998			this.WAIT.style.position = 'absolute';
29999			this.WAIT.style.zIndex = '1100';
30000		}
30001
30002		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
30003	};
30004	BX.ready(function (){_this.Init(arParams)});
30005}
30006
30007/* End */
30008;
30009; /* Start:"a:4:{s:4:"full";s:87:"/local/templates/.default/components/bitrix/menu/menu_in_burger/script.js?1620197569201";s:6:"source";s:73:"/local/templates/.default/components/bitrix/menu/menu_in_burger/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
30010$(document).ready(function(){
30011	$('.menu-row .mega-menu table td.wide_menu .dropdown-menu > .customScrollbar').mCustomScrollbar({
30012		mouseWheel: {
30013			scrollAmount: 150,
30014			preventDefault: true
30015		}
30016	})
30017})
30018/* End */
30019;
30020; /* Start:"a:4:{s:4:"full";s:83:"/local/templates/aspro_max_local/components/bitrix/menu/top/script.
30020js?1620197569192";s:6:"source";s:69:"/local/templates/aspro_max_local/components/bitrix/menu/top/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
30021$(document).ready(function(){
30022	$('.menu-row .mega-menu table td.wide_menu .customScrollbar').mCustomScrollbarDeferred({
30023		mouseWheel: {
30024			scrollAmount: 150,
30025			preventDefault: true
30026		}
30027	})
30028})
30029/* End */
30030;
30031; /* Start:"a:4:{s:4:"full";s:107:"/local/templates/aspro_max_local/components/aspro/com.banners.max/top_big_banner_4/script.js?16201975692987";s:6:"source";s:92:"/local/templates/aspro_max_local/components/aspro/com.banners.max/top_big_banner_4/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
30032function checkNavColor(slider){
30033	var nav_color_flex = slider.find('.flex-active-slide').data('nav_color'),
30034		menu_color = slider.find('.flex-active-slide').data('text_color');
30035	if(nav_color_flex == 'dark')
30036		slider.find('.flex-control-nav').addClass('flex-dark');
30037	else
30038		slider.find('.flex-control-nav').removeClass('flex-dark');
30039
30040	var eventdata = {slider: slider};
30041	BX.onCustomEvent('onSlide', [eventdata]);
30042}
30043function checkHeight(){}
30044$(document).ready(function(){
30045	if($('.top_slider_wrapp .flexslider').length){
30046		var config = {"controlNav": true, "animationLoop": true, "pauseOnHover" : true, "simulateTouch" : true, 'autoHeight': true};
30047		if(typeof(arMaxOptions['THEME']) != 'undefined'){
30048			var slideshowSpeed = Math.abs(parseInt(arMaxOptions['THEME']['BIGBANNER_SLIDESSHOWSPEED']));
30049			var animationSpeed = Math.abs(parseInt(arMaxOptions['THEME']['BIGBANNER_ANIMATIONSPEED']));
30050			var currentBannerIndex = 0;
30051			config["slideshow"] = (slideshowSpeed && arMaxOptions['THEME']['BIGBANNER_ANIMATIONTYPE'].length ? true : false);
30052			config["animation"] = (arMaxOptions['THEME']['BIGBANNER_ANIMATIONTYPE'] === 'FADE' ? 'fade' : 'slide');
30053			if(animationSpeed >= 0){
30054				config["animationSpeed"] = animationSpeed;
30055			}
30056			if(slideshowSpeed >= 0){
30057				config["slideshowSpeed"] = slideshowSpeed;
30058			}
30059			if(arMaxOptions['THEME']['BIGBANNER_ANIMATIONTYPE'] !== 'FADE'){
30060				config["direction"] = (arMaxOptions['THEME']['BIGBANNER_ANIMATIONTYPE'] === 'SLIDE_VERTICAL' ? 'vertical' : 'horizontal');
30061			}
30062			if($('.top_slider_wrapp .flexslider').find('ul.slides li.box').length < 2) {
30063				config['animationLoop'] = false;
30064			}
30065
30066			if ('CURRENT_BANNER_INDEX' in arMaxOptions && arMaxOptions['CURRENT_BANNER_INDEX']) {
30067				currentBannerIndex = arMaxOptions['CURRENT_BANNER_INDEX'] - 1;
30068				if (currentBannerIndex < $('.top_slider_wrapp .flexslider .slides > li').length) {
30069					config['startAt'] = currentBannerIndex;
30070					config["slideshow"] = false;
30071				}
30072			}
30073			
30074			config.start = function(slider){
30075				checkNavColor(slider);
30076				var activeVideo = slider.find('.box.wvideo.flex-active-slide');
30077				if(activeVideo.length) {
30078					if(activeVideo.data('video_autoplay') == '1') {
30079						BX.onCustomEvent('onSlide', [{slider: slider}] );
30080					}
30081				}
30082				if(slider.count <= 1){
30083					slider.find('.flex-direction-nav li').addClass('flex-disabled');
30084				}
30085				$(slider).find('.flex-control-nav').css('opacity',1);
30086			}
30087			config.after = function(slider){
30088				// checkNavColor(slider);
30089				InitLazyLoad();
30090			}
30091			config.before = function(slider){
30092				setTimeout(function(){
30093					checkNavColor(slider);
30094					InitLazyLoad();
30095				}, 100);
30096			}
30097		}
30098
30099		$(".top_slider_wrapp .flexslider").appear(function(){
30100			var $this = $(this);
30101			$this.flexslider(config);
30102		}, {accX: 0, accY: 150})
30103	}
30104	
30105	checkHeight();
30106
30107	BX.addCustomEvent('onWindowResize', function(eventdata){
30108		try{
30109			ignoreResize.push(true);
30110			checkHeight();
30111			CoverPlayerHtml()
30112		}
30113		catch(e){}
30114		finally{
30115			ignoreResize.pop();
30116		}
30117	})
30118});
30119/* End */
30120;
30121; /* Start:"a:4:{s:4:"full";s:113:"/local/templates/aspro_max_local/components/bitrix/catalog.section/catalog_block_bigdata/script.js?16202785719252";s:6:"source";s:98:"/local/templates/aspro_max_local/components/bitrix/catalog.section/catalog_block_bigdata/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
30122if(!funcDefined("sliceItemBlock")){
30123	sliceItemBlock = function(){
30124		$('.cur .catalog_block .catalog_item_wrapp.catalog_item:visible').sliceHeight({
30125			classNull: '.footer_button',
30126			item:'.cur .catalog_block .catalog_item_wrapp.catalog_item:visible',
30127			classes: [
30128				'.item_info .item-title',
30129				'.item_info .sa_block',
30130				'.item_info .cost.prices',
30131			],
30132			mobile: true,
30133			blockNull: {
30134				class: 'big',
30135				width: 2,
30136			},
30137			breakpoint: {
30138				'(max-width: 600px)': {
30139					blockNull: {
30140						width: 1,
30141					},
30142					autoslicecount: false,
30143					slice: 999,
30144				}
30145			},
30146		});
30147
30148		InitCustomScrollBar();
30149	}
30150}
30151
30152$(document).ready(function(){
30153	sliceItemBlock();
30154});
30155
30156(function() {
30157	'use strict';
30158
30159	if (!!window.JCCatalogSectionComponent)
30160		return;
30161
30162	window.JCCatalogSectionComponent = function(params) {
30163		this.formPosting = false;
30164		this.siteId = params.siteId || '';
30165		this.ajaxId = params.ajaxId || '';
30166		this.template = params.template || '';
30167		this.componentPath = params.componentPath || '';
30168		this.parameters = params.parameters || '';
30169
30170		if (params.navParams)
30171		{
30172			this.navParams = {
30173				NavNum: params.navParams.NavNum || 1,
30174				NavPageNomer: parseInt(params.navParams.NavPageNomer) || 1,
30175				NavPageCount: parseInt(params.navParams.NavPageCount) || 1
30176			};
30177		}
30178
30179		this.bigData = params.bigData || {enabled: false};
30180		this.container = document.querySelector('[data-entity="' + params.container + '"]');
30181		this.showMoreButton = null;
30182		this.showMoreButtonMessage = null;
30183
30184		if (this.bigData.enabled && BX.util.object_keys(this.bigData.rows).length > 0)
30185		{
30186			BX.cookie_prefix = this.bigData.js.cookiePrefix || '';
30187			BX.cookie_domain = this.bigData.js.cookieDomain || '';
30188			BX.current_server_time = this.bigData.js.serverTime;
30189
30190			BX.ready(BX.delegate(this.bigDataLoad, this));
30191		}
30192
30193		if (params.initiallyShowHeader)
30194		{
30195			BX.ready(BX.delegate(this.showHeader, this));
30196		}
30197
30198		if (params.deferredLoad)
30199		{
30200			BX.ready(BX.delegate(this.deferredLoad, this));
30201		}
30202
30203		if (params.lazyLoad)
30204		{
30205			this.showMoreButton = document.querySelector('[data-use="show-more-' + this.navParams.NavNum + '"]');
30206			this.showMoreButtonMessage = this.showMoreButton.innerHTML;
30207			BX.bind(this.showMoreButton, 'click', BX.proxy(this.showMore, this));
30208		}
30209
30210		if (params.loadOnScroll)
30211		{
30212			BX.bind(window, 'scroll', BX.proxy(this.loadOnScroll, this));
30213		}
30214	};
30215
30216	window.JCCatalogSectionComponent.prototype =
30217	{
30218		checkButton: function()
30219		{
30220			if (this.showMoreButton)
30221			{
30222				if (this.navParams.NavPageNomer == this.navParams.NavPageCount)
30223				{
30224					BX.remove(this.showMoreButton);
30225				}
30226				else
30227				{
30228					this.container.appendChild(this.showMoreButton);
30229				}
30230			}
30231		},
30232
30233		enableButton: function()
30234		{
30235			if (this.showMoreButton)
30236			{
30237				BX.removeClass(this.showMoreButton, 'disabled');
30238				this.showMoreButton.innerHTML = this.showMoreButtonMessage;
30239			}
30240		},
30241
30242		disableButton: function()
30243		{
30244			if (this.showMoreButton)
30245			{
30246				BX.addClass(this.showMoreButton, 'disabled');
30247				this.showMoreButton.innerHTML = BX.message('BTN_MESSAGE_LAZY_LOAD_WAITER');
30248			}
30249		},
30250
30251		loadOnScroll: function()
30252		{
30253			var scrollTop = BX.GetWindowScrollPos().scrollTop,
30254				containerBottom = BX.pos(this.container).bottom;
30255
30256			if (scrollTop + window.innerHeight > containerBottom)
30257			{
30258				this.showMore();
30259			}
30260		},
30261
30262		showMore: function()
30263		{
30264			if (this.navParams.NavPageNomer < this.navParams.NavPageCount)
30265			{
30266				var data = {};
30267				data['action'] = 'showMore';
30268				data['PAGEN_' + this.navParams.NavNum] = this.navParams.NavPageNomer + 1;
30269
30270				if (!this.formPosting)
30271				{
30272					this.formPosting = true;
30273					this.disableButton();
30274					this.sendRequest(data);
30275				}
30276			}
30277		},
30278
30279		bigDataLoad: function()
30280		{
30281			var url = 'https://analytics.bitrix.info/crecoms/v1_0/recoms.php',
30282				data = BX.ajax.prepareData(this.bigData.params);
30283
30284			if (data)
30285			{
30286				url += (url.indexOf('?') !== -1 ? '&' : '?') + data;
30287			}
30288
30289			var onReady = BX.delegate(function(result){
30290				this.sendRequest({
30291					action: 'deferredLoad',
30292					bigData: 'Y',
30293					items: result && result.items || [],
30294					rid: result && result.id,
30295					count: this.bigData.count,
30296					rowsRange: this.bigData.rowsRange,
30297					shownIds: this.bigData.shownIds
30298				});
30299			}, this);
30300
30301			BX.ajax({
30302				method: 'GET',
30303				dataType: 'json',
30304				url: url,
30305				timeout: 3,
30306				onsuccess: onReady,
30307				onfailure: onReady
30308			});
30309		},
30310
30311		deferredLoad: function()
30312		{
30313			this.sendRequest({action: 'deferredLoad'});
30314		},
30315
30316		sendRequest: function(data)
30317		{
30318			var defaultData = {
30319				siteId: this.siteId,
30320				template: this.template,
30321				parameters: this.parameters
30322			};
30323
30324			if (this.ajaxId)
30325			{
30326				defaultData.AJAX_ID = this.ajaxId;
30327			}
30328
30329			BX.ajax({
30330				url: this.componentPath + '/ajax.php' + (document.location.href.indexOf('clear_cache=Y') !== -1 ? '?clear_cache=Y' : ''),
30331				method: 'POST',
30332				dataType: 'json',
30333				timeout: 60,
30334				data: BX.merge(defaultData, data),
30335				onsuccess: BX.delegate(function(result){
30336					if (!result || !result.JS)
30337						return;
30338
30339					BX.ajax.processScripts(
30340						BX.processHTML(result.JS).SCRIPT,
30341						false,
30342						BX.delegate(function(){this.showAction(result, data);}, this)
30343					);
30344				}, this)
30345			});
30346		},
30347
30348		showAction: function(result, data)
30349		{
30350			if (!data)
30351				return;
30352
30353			switch (data.action)
30354			{
30355				case 'showMore':
30356					this.processShowMoreAction(result);
30357					break;
30358				case 'deferredLoad':
30359					this.processDeferredLoadAction(result, data.bigData === 'Y');
30360					break;
30361			}
30362		},
30363
30364		processShowMoreAction: function(result)
30365		{
30366			this.formPosting = false;
30367			this.enableButton();
30368
30369			if (result)
30370			{
30371				this.navParams.NavPageNomer++;
30372				this.processItems(result.items);
30373				this.processPagination(result.pagination);
30374				this.processEpilogue(result.epilogue);
30375				this.checkButton();
30376			}
30377		},
30378
30379		processDeferredLoadAction: function(result, bigData)
30380		{
30381			if (!result)
30382				return;
30383
30384			var position = bigData ? this.bigData.rows : {};
30385
30386			this.processItems(result.items, BX.util.array_keys(position));
30387		},
30388
30389		processItems: function(itemsHtml, position)
30390		{
30391			if (!itemsHtml)
30392				return;
30393
30394			var processed = BX.processHTML(itemsHtml, false),
30395				temporaryNode = BX.create('DIV');
30396
30397			var items, k, origRows;
30398
30399			temporaryNode.innerHTML = processed.HTML;
30400			items = temporaryNode.querySelectorAll('[data-entity="items-row"]');
30401
30402			if (items.length)
30403			{
30404				this.showHeader(true);
30405
30406				for (k in items)
30407				{
30408					if (items.hasOwnProperty(k))
30409					{
30410						origRows = position ? this.container.querySelectorAll('[data-entity="items-row"]') : false;
30411						items[k].style.opacity = 0;
30412
30413						if (origRows && BX.type.isDomNode(origRows[position[k]]))
30414						{
30415							origRows[position[k]].parentNode.insertBefore(items[k], origRows[position[k]]);
30416						}
30417						else
30418						{
30419							this.container.appendChild(items[k]);
30420						}
30421					}
30422				}
30423
30424				new BX.easing({
30425					duration: 2000,
30426					start: {opacity: 0},
30427					finish: {opacity: 100},
30428					transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
30429					step: function(state){
30430						for (var k in items)
30431						{
30432							if (items.hasOwnProperty(k))
30433							{
30434								items[k].style.opacity = state.opacity / 100;
30435							}
30436						}
30437					},
30438					complete: function(){
30439						for (var k in items)
30440						{
30441							if (items.hasOwnProperty(k))
30442							{
30443								items[k].removeAttribute('style');
30444							}
30445						}
30446
30447						$('.CATALOG_BIGDATA .catalog_block .catalog_item_wrapp.catalog_item:not(.big):visible').sliceHeight({
30448							classNull: '.footer_button',
30449							item:'.CATALOG_BIGDATA .catalog_block .catalog_item_wrapp.catalog_item:not(.big):visible',
30450							classes: [
30451								'.item_info .item-title',
30452								'.item_info .sa_block',
30453								'.item_info .cost.prices',
30454							],
30455							mobile: true,
30456						});
30457					}
30458				}).animate();
30459			}
30460
30461			BX.ajax.processScripts(processed.SCRIPT);
30462		},
30463
30464		processPagination: function(paginationHtml)
30465		{
30466			if (!paginationHtml)
30467				return;
30468
30469			var pagination = document.querySelectorAll('[data-pagination-num="' + this.navParams.NavNum + '"]');
30470			for (var k in pagination)
30471			{
30472				if (pagination.hasOwnProperty(k))
30473				{
30474					pagination[k].innerHTML = paginationHtml;
30475				}
30476			}
30477		},
30478
30479		processEpilogue: function(epilogueHtml)
30480		{
30481			if (!epilogueHtml)
30482				return;
30483
30484			var processed = BX.processHTML(epilogueHtml, false);
30485			BX.ajax.processScripts(processed.SCRIPT);
30486		},
30487
30488		showHeader: function(animate)
30489		{
30490			var parentNode = BX.findParent(this.container, {attr: {'data-entity': 'parent-container'}}),
30491				header;
30492
30493			if (parentNode && BX.type.isDomNode(parentNode))
30494			{
30495				header = parentNode.querySelector('[data-entity="header"]');
30496
30497				if (header && header.getAttribute('data-showed') != 'true')
30498				{
30499					header.style.display = '';
30500
30501					if (animate)
30502					{
30503						new BX.easing({
30504							duration: 2000,
30505							start: {opacity: 0},
30506							finish: {opacity: 100},
30507							transition: BX.easing.makeEaseOut(BX.easing.transitions.quad),
30508							step: function(state){
30509								header.style.opacity = state.opacity / 100;
30510							},
30511							complete: function(){
30512								header.removeAttribute('style');
30513								header.setAttribute('data-showed', 'true');
30514							}
30515						}).animate();
30516					}
30517					else
30518					{
30519						header.style.opacity = 100;
30520					}
30521				}
30522			}
30523		}
30524	};
30525})();
30526/* End */
30527;
30528; /* Start:"a:4:{s:4:"full";s:83:"/bitrix/components/bitrix/catalog.item/templates/.default/script.js?168300663063917";s:6:"source";s:67:"/bitrix/components/bitrix/catalog.item/templates/.default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
30529
30530(function (window){
30531	'use strict';
30532
30533	if (window.JCCatalogItem)
30534		return;
30535
30536	var BasketButton = function(params)
30537	{
30538		BasketButton.superclass.constructor.apply(this, arguments);
30539		this.buttonNode = BX.create('span', {
30540			props: {className: 'btn btn-default btn-buy btn-sm', id: this.id},
30541			style: typeof params.style === 'object' ? params.style : {},
30542			text: params.text,
30543			events: this.contextEvents
30544		});
30545
30546		if (BX.browser.IsIE())
30547		{
30548			this.buttonNode.setAttribute("hideFocus", "hidefocus");
30549		}
30550	};
30551	BX.extend(BasketButton, BX.PopupWindowButton);
30552
30553	window.JCCatalogItem = function (arParams)
30554	{
30555		this.productType = 0;
30556		this.showQuantity = true;
30557		this.showAbsent = true;
30558		this.secondPict = false;
30559		this.showOldPrice = false;
30560		this.showMaxQuantity = 'N';
30561		this.relativeQuantityFactor = 5;
30562		this.showPercent = false;
30563		this.showSkuProps = false;
30564		this.basketAction = 'ADD';
30565		this.showClosePopup = false;
30566		this.useCompare = false;
30567		this.showSubscription = false;
30568		this.visual = {
30569			ID: '',
30570			PICT_ID: '',
30571			SECOND_PICT_ID: '',
30572			PICT_SLIDER_ID: '',
30573			QUANTITY_ID: '',
30574			QUANTITY_UP_ID: '',
30575			QUANTITY_DOWN_ID: '',
30576			PRICE_ID: '',
30577			PRICE_OLD_ID: '',
30578			DSC_PERC: '',
30579			SECOND_DSC_PERC: '',
30580			DISPLAY_PROP_DIV: '',
30581			BASKET_PROP_DIV: '',
30582			SUBSCRIBE_ID: ''
30583		};
30584		this.product = {
30585			checkQuantity: false,
30586			maxQuantity: 0,
30587			stepQuantity: 1,
30588			isDblQuantity: false,
30589			canBuy: true,
30590			name: '',
30591			pict: {},
30592			id: 0,
30593			addUrl: '',
30594			buyUrl: ''
30595		};
30596
30597		this.basketMode = '';
30598		this.basketData = {
30599			useProps: false,
30600			emptyProps: false,
30601			quantity: 'quantity',
30602			props: 'prop',
30603			basketUrl: '',
30604			sku_props: '',
30605			sku_props_var: 'basket_props',
30606			add_url: '',
30607			buy_url: ''
30608		};
30609
30610		this.compareData = {
30611			compareUrl: '',
30612			compareDeleteUrl: '',
30613			comparePath: ''
30614		};
30615
30616		this.defaultPict = {
30617			pict: null,
30618			secondPict: null
30619		};
30620
30621		this.defaultSliderOptions = {
30622			interval: 3000,
30623			wrap: true
30624		};
30625		this.slider = {
30626			options: {},
30627			items: [],
30628			active: null,
30629			sliding: null,
30630			paused: null,
30631			interval: null,
30632			progress: null
30633		};
30634		this.touch = null;
30635
30636		this.quantityDelay = null;
30637		this.quantityTimer = null;
30638
30639		this.checkQuantity = false;
30640		this.maxQuantity = 0;
30641		this.minQuantity = 0;
30642		this.stepQuantity = 1;
30643		this.isDblQuantity = false;
30644		this.canBuy = true;
30645		this.precision = 6;
30646		this.precisionFactor = Math.pow(10, this.precision);
30647		this.bigData = false;
30648		this.fullDisplayMode = false;
30649		this.viewMode = '';
30650		this.templateTheme = '';
30651
30652		this.currentPriceMode = '';
30653		this.currentPrices = [];
30654		this.currentPriceSelected = 0;
30655		this.currentQuantityRanges = [];
30656		this.currentQuantityRangeSelected = 0;
30657
30658		this.offers = [];
30659		this.offerNum = 0;
30660		this.treeProps = [];
30661		this.selectedValues = {};
30662
30663		this.obProduct = null;
30664		this.blockNodes = {};
30665		this.obQuantity = null;
30666		this.obQuantityUp = null;
30667		this.obQuantityDown = null;
30668		this.obQuantityLimit = {};
30669		this.obPict = null;
30670		this.obSecondPict = null;
30671		this.obPictSlider = null;
30672		this.obPictSliderIndicator = null;
30673		this.obPrice = null;
30674		this.obTree = null;
30675		this.obBuyBtn = null;
30676		this.obBasketActions = null;
30677		this.obNotAvail = null;
30678		this.obSubscribe = null;
30679		this.obDscPerc = null;
30680		this.obSecondDscPerc = null;
30681		this.obSkuProps = null;
30682		this.obMeasure = null;
30683		this.obCompare = null;
30684
30685		this.obPopupWin = null;
30686		this.basketUrl = '';
30687		this.basketParams = {};
30688		this.isTouchDevice = BX.hasClass(document.documentElement, 'bx-touch');
30689		this.hoverTimer = null;
30690		this.hoverStateChangeForbidden = false;
30691		this.mouseX = null;
30692		this.mouseY = null;
30693
30694		this.useEnhancedEcommerce = false;
30695		this.dataLayerName = 'dataLayer';
30696		this.brandProperty = false;
30697
30698		this.errorCode = 0;
30699
30700		if (typeof arParams === 'object')
30701		{
30702			if (arParams.PRODUCT_TYPE)
30703			{
30704				this.productType = parseInt(arParams.PRODUCT_TYPE, 10);
30705			}
30706
30707			this.showQuantity = arParams.SHOW_QUANTITY;
30708			this.showAbsent = arParams.SHOW_ABSENT;
30709			this.secondPict = arParams.SECOND_PICT;
30710			this.showOldPrice = arParams.SHOW_OLD_PRICE;
30711			this.showMaxQuantity = arParams.SHOW_MAX_QUANTITY;
30712			this.relativeQuantityFactor = parseInt(arParams.RELATIVE_QUANTITY_FACTOR);
30713			this.showPercent = arParams.SHOW_DISCOUNT_PERCENT;
30714			this.showSkuProps = arParams.SHOW_SKU_PROPS;
30715			this.showSubscription = arParams.USE_SUBSCRIBE;
30716
30717			if (arParams.ADD_TO_BASKET_ACTION)
30718			{
30719				this.basketAction = arParams.ADD_TO_BASKET_ACTION;
30720			}
30721
30722			this.showClosePopup = arParams.SHOW_CLOSE_POPUP;
30723			this.useCompare = arParams.DISPLAY_COMPARE;
30724			this.fullDisplayMode = arParams.PRODUCT_DISPLAY_MODE === 'Y';
30725			this.bigData = arParams.BIG_DATA;
30726			this.viewMode = arParams.VIEW_MODE || '';
30727			this.templateTheme = arParams.TEMPLATE_THEME || '';
30728			this.useEnhancedEcommerce = arParams.USE_ENHANCED_ECOMMERCE === 'Y';
30729			this.dataLayerName = arParams.DATA_LAYER_NAME;
30730			this.brandProperty = arParams.BRAND_PROPERTY;
30731
30732			this.visual = arParams.VISUAL;
30733
30734			switch (this.productType)
30735			{
30736				case 0: // no catalog
30737				case 1: // product
30738				case 2: // set
30739				case 7: // service
30740					if (arParams.PRODUCT && typeof arParams.PRODUCT === 'object')
30741					{
30742						this.currentPriceMode = arParams.PRODUCT.ITEM_PRICE_MODE;
30743						this.currentPrices = arParams.PRODUCT.ITEM_PRICES;
30744						this.currentPriceSelected = arParams.PRODUCT.ITEM_PRICE_SELECTED;
30745						this.currentQuantityRanges = arParams.PRODUCT.ITEM_QUANTITY_RANGES;
30746						this.currentQuantityRangeSelected = arParams.PRODUCT.ITEM_QUANTITY_RANGE_SELECTED;
30747
30748						if (this.showQuantity)
30749						{
30750							this.product.checkQuantity = arParams.PRODUCT.CHECK_QUANTITY;
30751							this.product.isDblQuantity = arParams.PRODUCT.QUANTITY_FLOAT;
30752
30753							if (this.product.checkQuantity)
30754							{
30755								this.product.maxQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.MAX_QUANTITY) : parseInt(arParams.PRODUCT.MAX_QUANTITY, 10));
30756							}
30757
30758							this.product.stepQuantity = (this.product.isDblQuantity ? parseFloat(arParams.PRODUCT.STEP_QUANTITY) : parseInt(arParams.PRODUCT.STEP_QUANTITY, 10));
30759
30760							this.checkQuantity = this.product.checkQuantity;
30761							this.isDblQuantity = this.product.isDblQuantity;
30762							this.stepQuantity = this.product.stepQuantity;
30763							this.maxQuantity = this.product.maxQuantity;
30764							this.minQuantity = this.currentPriceMode === 'Q'
30765								? parseFloat(this.currentPrices[this.currentPriceSelected].MIN_QUANTITY)
30766								: this.stepQuantity;
30767
30768							if (this.isDblQuantity)
30769							{
30770								this.stepQuantity = Math.round(this.stepQuantity * this.precisionFactor) / this.precisionFactor;
30771							}
30772						}
30773
30774						this.product.canBuy = arParams.PRODUCT.CAN_BUY;
30775
30776						if (arParams.PRODUCT.MORE_PHOTO_COUNT)
30777						{
30778							this.product.morePhotoCount = arParams.PRODUCT.MORE_PHOTO_COUNT;
30779							this.product.morePhoto = arParams.PRODUCT.MORE_PHOTO;
30780						}
30781
30782						if (arParams.PRODUCT.RCM_ID)
30783						{
30784							this.product.rcmId = arParams.PRODUCT.RCM_ID;
30785						}
30786
30787						this.canBuy = this.product.canBuy;
30788						this.product.name = arParams.PRODUCT.NAME;
30789						this.product.pict = arParams.PRODUCT.PICT;
30790						this.product.id = arParams.PRODUCT.ID;
30791						this.product.DETAIL_PAGE_URL = arParams.PRODUCT.DETAIL_PAGE_URL;
30792
30793						if (arParams.PRODUCT.ADD_URL)
30794						{
30795							this.product.addUrl = arParams.PRODUCT.ADD_URL;
30796						}
30797
30798						if (arParams.PRODUCT.BUY_URL)
30799						{
30800							this.product.buyUrl = arParams.PRODUCT.BUY_URL;
30801						}
30802
30803						if (arParams.BASKET && typeof arParams.BASKET === 'object')
30804						{
30805							this.basketData.useProps = arParams.BASKET.ADD_PROPS;
30806							this.basketData.emptyProps = arParams.BASKET.EMPTY_PROPS;
30807						}
30808					}
30809					else
30810					{
30811						this.errorCode = -1;
30812					}
30813
30814					break;
30815				case 3: // sku
30816					if (arParams.PRODUCT && typeof arParams.PRODUCT === 'object')
30817					{
30818						this.product.name = arParams.PRODUCT.NAME;
30819						this.product.id = arParams.PRODUCT.ID;
30820						this.product.DETAIL_PAGE_URL = arParams.PRODUCT.DETAIL_PAGE_URL;
30821						this.product.morePhotoCount = arParams.PRODUCT.MORE_PHOTO_COUNT;
30822						this.product.morePhoto = arParams.PRODUCT.MORE_PHOTO;
30823
30824						if (arParams.PRODUCT.RCM_ID)
30825						{
30826							this.product.rcmId = arParams.PRODUCT.RCM_ID;
30827						}
30828					}
30829
30830					if (arParams.OFFERS && BX.type.isArray(arParams.OFFERS))
30831					{
30832						this.offers = arParams.OFFERS;
30833						this.offerNum = 0;
30834
30835						if (arParams.OFFER_SELECTED)
30836						{
30837							this.offerNum = parseInt(arParams.OFFER_SELECTED, 10);
30838						}
30839
30840						if (isNaN(this.offerNum))
30841						{
30842							this.offerNum = 0;
30843						}
30844
30845						if (arParams.TREE_PROPS)
30846						{
30847							this.treeProps = arParams.TREE_PROPS;
30848						}
30849
30850						if (arParams.DEFAULT_PICTURE)
30851						{
30852							this.defaultPict.pict = arParams.DEFAULT_PICTURE.PICTURE;
30853							this.defaultPict.secondPict = arParams.DEFAULT_PICTURE.PICTURE_SECOND;
30854						}
30855					}
30856
30857					break;
30858				default:
30859					this.errorCode = -1;
30860			}
30861			if (arParams.BASKET && typeof arParams.BASKET === 'object')
30862			{
30863				if (arParams.BASKET.QUANTITY)
30864				{
30865					this.basketData.quantity = arParams.BASKET.QUANTITY;
30866				}
30867
30868				if (arParams.BASKET.PROPS)
30869				{
30870					this.basketData.props = arParams.BASKET.PROPS;
30871				}
30872
30873				if (arParams.BASKET.BASKET_URL)
30874				{
30875					this.basketData.basketUrl = arParams.BASKET.BASKET_URL;
30876				}
30877
30878				if (3 === this.productType)
30879				{
30880					if (arParams.BASKET.SKU_PROPS)
30881					{
30882						this.basketData.sku_props = arParams.BASKET.SKU_PROPS;
30883					}
30884				}
30885
30886				if (arParams.BASKET.ADD_URL_TEMPLATE)
30887				{
30888					this.basketData.add_url = arParams.BASKET.ADD_URL_TEMPLATE;
30889				}
30890
30891				if (arParams.BASKET.BUY_URL_TEMPLATE)
30892				{
30893					this.basketData.buy_url = arParams.BASKET.BUY_URL_TEMPLATE;
30894				}
30895
30896				if (this.basketData.add_url === '' && this.basketData.buy_url === '')
30897				{
30898					this.errorCode = -1024;
30899				}
30900			}
30901
30902			if (this.useCompare)
30903			{
30904				if (arParams.COMPARE && typeof arParams.COMPARE === 'object')
30905				{
30906					if (arParams.COMPARE.COMPARE_PATH)
30907					{
30908						this.compareData.comparePath = arParams.COMPARE.COMPARE_PATH;
30909					}
30910
30911					if (arParams.COMPARE.COMPARE_URL_TEMPLATE)
30912					{
30913						this.compareData.compareUrl = arParams.COMPARE.COMPARE_URL_TEMPLATE;
30914					}
30915					else
30916					{
30917						this.useCompare = false;
30918					}
30919
30920					if (arParams.COMPARE.COMPARE_DELETE_URL_TEMPLATE)
30921					{
30922						this.compareData.compareDeleteUrl = arParams.COMPARE.COMPARE_DELETE_URL_TEMPLATE;
30923					}
30924					else
30925					{
30926						this.useCompare = false;
30927					}
30928				}
30929				else
30930				{
30931					this.useCompare = false;
30932				}
30933			}
30934
30935			this.isFacebookConversionCustomizeProductEventEnabled
30936				= arParams.IS_FACEBOOK_CONVERSION_CUSTOMIZE_PRODUCT_EVENT_ENABLED
30937			;
30938		}
30939
30940		if (this.errorCode === 0)
30941		{
30942			BX.ready(BX.delegate(this.init,this));
30943		}
30944	};
30945
30946	window.JCCatalogItem.prototype = {
30947		init: function()
30948		{
30949			var i = 0,
30950				treeItems = null;
30951
30952			this.obProduct = BX(this.visual.ID);
30953			if (!this.obProduct)
30954			{
30955				this.errorCode = -1;
30956			}
30957
30958			this.obPict = BX(this.visual.PICT_ID);
30959			if (!this.obPict)
30960			{
30961				this.errorCode = -2;
30962			}
30963
30964			if (this.secondPict && this.visual.SECOND_PICT_ID)
30965			{
30966				this.obSecondPict = BX(this.visual.SECOND_PICT_ID);
30967			}
30968
30969			this.obPictSlider = BX(this.visual.PICT_SLIDER_ID);
30970			this.obPictSliderIndicator = BX(this.visual.PICT_SLIDER_ID + '_indicator');
30971			this.obPictSliderProgressBar = BX(this.visual.PICT_SLIDER_ID + '_progress_bar');
30972			if (!this.obPictSlider)
30973			{
30974				this.errorCode = -4;
30975			}
30976
30977			this.obPrice = BX(this.visual.PRICE_ID);
30978			this.obPriceOld = BX(this.visual.PRICE_OLD_ID);
30979			this.obPriceTotal = BX(this.visual.PRICE_TOTAL_ID);
30980			if (!this.obPrice)
30981			{
30982				this.errorCode = -16;
30983			}
30984
30985			if (this.showQuantity && this.visual.QUANTITY_ID)
30986			{
30987				this.obQuantity = BX(this.visual.QUANTITY_ID);
30988				this.blockNodes.quantity = this.obProduct.querySelector('[data-entity="quantity-block"]');
30989
30990				if (!this.isTouchDevice)
30991				{
30992					BX.bind(this.obQuantity, 'focus', BX.proxy(this.onFocus, this));
30993					BX.bind(this.obQuantity, 'blur', BX.proxy(this.onBlur, this));
30994				}
30995
30996				if (this.visual.QUANTITY_UP_ID)
30997				{
30998					this.obQuantityUp = BX(this.visual.QUANTITY_UP_ID);
30999				}
31000
31001				if (this.visual.QUANTITY_DOWN_ID)
31002				{
31003					this.obQuantityDown = BX(this.visual.QUANTITY_DOWN_ID);
31004				}
31005			}
31006
31007			if (this.visual.QUANTITY_LIMIT && this.showMaxQuantity !== 'N')
31008			{
31009				this.obQuantityLimit.all = BX(this.visual.QUANTITY_LIMIT);
31010				if (this.obQuantityLimit.all)
31011				{
31012					this.obQuantityLimit.value = this.obQuantityLimit.all.querySelector('[data-entity="quantity-limit-value"]');
31013					if (!this.obQuantityLimit.value)
31014					{
31015						this.obQuantityLimit.all = null;
31016					}
31017				}
31018			}
31019
31020			if (this.productType === 3 && this.fullDisplayMode)
31021			{
31022				if (this.visual.TREE_ID)
31023				{
31024					this.obTree = BX(this.visual.TREE_ID);
31025					if (!this.obTree)
31026					{
31027						this.errorCode = -256;
31028					}
31029				}
31030
31031				if (this.visual.QUANTITY_MEASURE)
31032				{
31033					this.obMeasure = BX(this.visual.QUANTITY_MEASURE);
31034				}
31035			}
31036
31037			this.obBasketActions = BX(this.visual.BASKET_ACTIONS_ID);
31038			if (this.obBasketActions)
31039			{
31040				if (this.visual.BUY_ID)
31041				{
31042					this.obBuyBtn = BX(this.visual.BUY_ID);
31043				}
31044			}
31045
31046			this.obNotAvail = BX(this.visual.NOT_AVAILABLE_MESS);
31047
31048			if (this.showSubscription)
31049			{
31050				this.obSubscribe = BX(this.visual.SUBSCRIBE_ID);
31051			}
31052
31053			if (this.showPercent)
31054			{
31055				if (this.visual.DSC_PERC)
31056				{
31057					this.obDscPerc = BX(this.visual.DSC_PERC);
31058				}
31059				if (this.secondPict && this.visual.SECOND_DSC_PERC)
31060				{
31061					this.obSecondDscPerc = BX(this.visual.SECOND_DSC_PERC);
31062				}
31063			}
31064
31065			if (this.showSkuProps)
31066			{
31067				if (this.visual.DISPLAY_PROP_DIV)
31068				{
31069					this.obSkuProps = BX(this.visual.DISPLAY_PROP_DIV);
31070				}
31071			}
31072
31073			if (this.errorCode === 0)
31074			{
31075				// product slider events
31076				if (this.isTouchDevice)
31077				{
31078					BX.bind(this.obPictSlider, 'touchstart', BX.proxy(this.touchStartEvent, this));
31079					BX.bind(this.obPictSlider, 'touchend', BX.proxy(this.touchEndEvent, this));
31080					BX.bind(this.obPictSlider, 'touchcancel', BX.proxy(this.touchEndEvent, this));
31081				}
31082				else
31083				{
31084					if (this.viewMode === 'CARD')
31085					{
31086						// product hover events
31087						BX.bind(this.obProduct, 'mouseenter', BX.proxy(this.hoverOn, this));
31088						BX.bind(this.obProduct, 'mouseleave', BX.proxy(this.hoverOff, this));
31089					}
31090
31091					// product slider events
31092					BX.bind(this.obProduct, 'mouseenter', BX.proxy(this.cycleSlider, this));
31093					BX.bind(this.obProduct, 'mouseleave', BX.proxy(this.stopSlider, this));
31094				}
31095
31096				if (this.bigData)
31097				{
31098					var links = BX.findChildren(this.obProduct, {tag:'a'}, true);
31099					if (links)
31100					{
31101						for (i in links)
31102						{
31103							if (links.hasOwnProperty(i))
31104							{
31105								if (links[i].getAttribute('href') == this.product.DETAIL_PAGE_URL)
31106								{
31107									BX.bind(links[i], 'click', BX.proxy(this.rememberProductRecommendation, this));
31108								}
31109							}
31110						}
31111					}
31112				}
31113
31114				if (this.showQuantity)
31115				{
31116					var startEventName = this.isTouchDevice ? 'touchstart' : 'mousedown';
31117					var endEventName = this.isTouchDevice ? 'touchend' : 'mouseup';
31118
31119					if (this.obQuantityUp)
31120					{
31121						BX.bind(this.obQuantityUp, startEventName, BX.proxy(this.startQuantityInterval, this));
31122						BX.bind(this.obQuantityUp, endEventName, BX.proxy(this.clearQuantityInterval, this));
31123						BX.bind(this.obQuantityUp, 'mouseout', BX.proxy(this.clearQuantityInterval, this));
31124						BX.bind(this.obQuantityUp, 'click', BX.delegate(this.quantityUp, this));
31125					}
31126
31127					if (this.obQuantityDown)
31128					{
31129						BX.bind(this.obQuantityDown, startEventName, BX.proxy(this.startQuantityInterval, this));
31130						BX.bind(this.obQuantityDown, endEventName, BX.proxy(this.clearQuantityInterval, this));
31131						BX.bind(this.obQuantityDown, 'mouseout', BX.proxy(this.clearQuantityInterval, this));
31132						BX.bind(this.obQuantityDown, 'click', BX.delegate(this.quantityDown, this));
31133					}
31134
31135					if (this.obQuantity)
31136					{
31137						BX.bind(this.obQuantity, 'change', BX.delegate(this.quantityChange, this));
31138					}
31139				}
31140
31141				switch (this.productType)
31142				{
31143					case 0: // no catalog
31144					case 1: // product
31145					case 2: // set
31146					case 7: // service
31147						if (parseInt(this.product.morePhotoCount) > 1 && this.obPictSlider)
31148						{
31149							this.initializeSlider();
31150						}
31151
31152						this.checkQuantityControls();
31153
31154						break;
31155					case 3: // sku
31156						if (this.offers.length > 0)
31157						{
31158							treeItems = BX.findChildren(this.obTree, {tagName: 'li'}, true);
31159
31160							if (treeItems && treeItems.length)
31161							{
31162								for (i = 0; i < treeItems.length; i++)
31163								{
31164									BX.bind(treeItems[i], 'click', BX.delegate(this.selectOfferProp, this));
31165								}
31166							}
31167
31168							this.setCurrent();
31169						}
31170						else if (parseInt(this.product.morePhotoCount) > 1 && this.obPictSlider)
31171						{
31172							this.initializeSlider();
31173						}
31174
31175						break;
31176				}
31177
31178				if (this.obBuyBtn)
31179				{
31180					if (this.basketAction === 'ADD')
31181					{
31182						BX.bind(this.obBuyBtn, 'click', BX.proxy(this.add2Basket, this));
31183					}
31184					else
31185					{
31186						BX.bind(this.obBuyBtn, 'click', BX.proxy(this.buyBasket, this));
31187					}
31188				}
31189
31190				if (this.useCompare)
31191				{
31192					this.obCompare = BX(this.visual.COMPARE_LINK_ID);
31193					if (this.obCompare)
31194					{
31195						BX.bind(this.obCompare, 'click', BX.proxy(this.compare, this));
31196					}
31197
31198					BX.addCustomEvent('onCatalogDeleteCompare', BX.proxy(this.checkDeletedCompare, this));
31199				}
31200			}
31201		},
31202
31203		setAnalyticsDataLayer: function(action)
31204		{
31205			if (!this.useEnhancedEcommerce || !this.dataLayerName)
31206				return;
31207
31208			var item = {},
31209				info = {},
31210				variants = [],
31211				i, k, j, propId, skuId, propValues;
31212
31213			switch (this.productType)
31214			{
31215				case 0: //no catalog
31216				case 1: //product
31217				case 2: //set
31218				case 7: // service
31219					item = {
31220						'id': this.product.id,
31221						'name': this.product.name,
31222						'price': this.currentPrices[this.currentPriceSelected] && this.currentPrices[this.currentPriceSelected].PRICE,
31223						'brand': BX.type.isArray(this.brandProperty) ? this.brandProperty.join('/') : this.brandProperty
31224					};
31225					break;
31226				case 3: //sku
31227					for (i in this.offers[this.offerNum].TREE)
31228					{
31229						if (this.offers[this.offerNum].TREE.hasOwnProperty(i))
31230						{
31231							propId = i.substring(5);
31232							skuId = this.offers[this.offerNum].TREE[i];
31233
31234							for (k in this.treeProps)
31235							{
31236								if (this.treeProps.hasOwnProperty(k) && this.treeProps[k].ID == propId)
31237								{
31238									for (j in this.treeProps[k].VALUES)
31239									{
31240										propValues = this.treeProps[k].VALUES[j];
31241										if (propValues.ID == skuId)
31242										{
31243											variants.push(propValues.NAME);
31244											break;
31245										}
31246									}
31247
31248								}
31249							}
31250						}
31251					}
31252
31253					item = {
31254						'id': this.offers[this.offerNum].ID,
31255						'name': this.offers[this.offerNum].NAME,
31256						'price': this.currentPrices[this.currentPriceSelected] && this.currentPrices[this.currentPriceSelected].PRICE,
31257						'brand': BX.type.isArray(this.brandProperty) ? this.brandProperty.join('/') : this.brandProperty,
31258						'variant': variants.join('/')
31259					};
31260					break;
31261			}
31262
31263			switch (action)
31264			{
31265				case 'addToCart':
31266					info = {
31267						'ecommerce': {
31268							'currencyCode': this.currentPrices[this.currentPriceSelected] && this.currentPrices[this.currentPriceSelected].CURRENCY || '',
31269							'add': {
31270								'products': [{
31271									'name': item.name || '',
31272									'id': item.id || '',
31273									'price': item.price || 0,
31274									'brand': item.brand || '',
31275									'category': item.category || '',
31276									'variant': item.variant || '',
31277									'quantity': this.showQuantity && this.obQuantity ? this.obQuantity.value : 1
31278								}]
31279							}
31280						}
31281					};
31282					break;
31283			}
31284
31285			window[this.dataLayerName] = window[this.dataLayerName] || [];
31286			window[this.dataLayerName].push(info);
31287		},
31288
31289		hoverOn: function(event)
31290		{
31291			clearTimeout(this.hoverTimer);
31292			this.obProduct.style.height = getComputedStyle(this.obProduct).height;
31293			BX.addClass(this.obProduct, 'hover');
31294
31295			BX.PreventDefault(event);
31296		},
31297
31298		hoverOff: function(event)
31299		{
31300			if (this.hoverStateChangeForbidden)
31301				return;
31302
31303			BX.removeClass(this.obProduct, 'hover');
31304			this.hoverTimer = setTimeout(
31305				BX.delegate(function(){
31306					this.obProduct.style.height = 'auto';
31307				}, this),
31308				300
31309			);
31310
31311			BX.PreventDefault(event);
31312		},
31313
31314		onFocus: function()
31315		{
31316			this.hoverStateChangeForbidden = true;
31317			BX.bind(document, 'mousemove', BX.proxy(this.captureMousePosition, this));
31318		},
31319
31320		onBlur: function()
31321		{
31322			this.hoverStateChangeForbidden = false;
31323			BX.unbind(document, 'mousemove', BX.proxy(this.captureMousePosition, this));
31324
31325			var cursorElement = document.elementFromPoint(this.mouseX, this.mouseY);
31326			if (!cursorElement || !this.obProduct.contains(cursorElement))
31327			{
31328				this.hoverOff();
31329			}
31330		},
31331
31332		captureMousePosition: function(event)
31333		{
31334			this.mouseX = event.clientX;
31335			this.mouseY = event.clientY;
31336		},
31337
31338		getCookie: function(name)
31339		{
31340			var matches = document.cookie.match(new RegExp(
31341				"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
31342			));
31343
31344			return matches ? decodeURIComponent(matches[1]) : null;
31345		},
31346
31347		rememberProductRecommendation: function()
31348		{
31349			// save to RCM_PRODUCT_LOG
31350			var cookieName = BX.cookie_prefix + '_RCM_PRODUCT_LOG',
31351				cookie = this.getCookie(cookieName),
31352				itemFound = false;
31353
31354			var cItems = [],
31355				cItem;
31356
31357			if (cookie)
31358			{
31359				cItems = cookie.split('.');
31360			}
31361
31362			var i = cItems.length;
31363
31364			while (i--)
31365			{
31366				cItem = cItems[i].split('-');
31367
31368				if (cItem[0] == this.product.id)
31369				{
31370					// it's already in recommendations, update the date
31371					cItem = cItems[i].split('-');
31372
31373					// update rcmId and date
31374					cItem[1] = this.product.rcmId;
31375					cItem[2] = BX.current_server_time;
31376
31377					cItems[i] = cItem.join('-');
31378					itemFound = true;
31379				}
31380				else
31381				{
31382					if ((BX.current_server_time - cItem[2]) > 3600 * 24 * 30)
31383					{
31384						cItems.splice(i, 1);
31385					}
31386				}
31387			}
31388
31389			if (!itemFound)
31390			{
31391				// add recommendation
31392				cItems.push([this.product.id, this.product.rcmId, BX.current_server_time].join('-'));
31393			}
31394
31395			// serialize
31396			var plNewCookie = cItems.join('.'),
31397				cookieDate = new Date(new Date().getTime() + 1000 * 3600 * 24 * 365 * 10).toUTCString();
31398
31399			document.cookie = cookieName + "=" + plNewCookie + "; path=/; expires=" + cookieDate + "; domain=" + BX.cookie_domain;
31400		},
31401
31402		startQuantityInterval: function()
31403		{
31404			var target = BX.proxy_context;
31405			var func = target.id === this.visual.QUANTITY_DOWN_ID
31406				? BX.proxy(this.quantityDown, this)
31407				: BX.proxy(this.quantityUp, this);
31408
31409			this.quantityDelay = setTimeout(
31410				BX.delegate(function() {
31411					this.quantityTimer = setInterval(func, 150);
31412				}, this),
31413				300
31414			);
31415		},
31416
31417		clearQuantityInterval: function()
31418		{
31419			clearTimeout(this.quantityDelay);
31420			clearInterval(this.quantityTimer);
31421		},
31422
31423		quantityUp: function()
31424		{
31425			var curValue = 0,
31426				boolSet = true;
31427
31428			if (this.errorCode === 0 && this.showQuantity && this.canBuy)
31429			{
31430				curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
31431				if (!isNaN(curValue))
31432				{
31433					curValue += this.stepQuantity;
31434					if (this.checkQuantity)
31435					{
31436						if (curValue > this.maxQuantity)
31437						{
31438							boolSet = false;
31439						}
31440					}
31441
31442					if (boolSet)
31443					{
31444						if (this.isDblQuantity)
31445						{
31446							curValue = Math.round(curValue * this.precisionFactor) / this.precisionFactor;
31447						}
31448
31449						this.obQuantity.value = curValue;
31450
31451						this.setPrice();
31452					}
31453				}
31454			}
31455		},
31456
31457		quantityDown: function()
31458		{
31459			var curValue = 0,
31460				boolSet = true;
31461
31462			if (this.errorCode === 0 && this.showQuantity && this.canBuy)
31463			{
31464				curValue = (this.isDblQuantity ? parseFloat(this.obQuantity.value) : parseInt(this.obQuantity.value, 10));
31465				if (!isNaN(curValue))
31466				{
31467					curValue -= this.stepQuantity;
31468
31469					this.checkPriceRange(curValue);
31470
31471					if (curValue < this.minQuantity)
31472					{
31473						boolSet = false;
31474					}
31475
31476					if (boolSet)
31477					{
31478						if (this.isDblQuantity)
31479						{
31480							curValue = Math.round(curValue * this.precisionFactor) / this.precisionFactor;
31481						}
31482
31483						this.obQuantity.value = curValue;
31484
31485						this.setPrice();
31486					}
31487				}
31488			}
31489		},
31490
31491		quantityChange: function()
31492		{
31493			var curValue = 0,
31494				intCount;
31495
31496			if (this.errorCode === 0 && this.showQuantity)
31497			{
31498				if (this.canBuy)
31499				{
31500					curValue = this.isDblQuantity ? parseFloat(this.obQuantity.value) : Math.round(this.obQuantity.value);
31501					if (!isNaN(curValue))
31502					{
31503						if (this.checkQuantity)
31504						{
31505							if (curValue > this.maxQuantity)
31506							{
31507								curValue = this.maxQuantity;
31508							}
31509						}
31510
31511						this.checkPriceRange(curValue);
31512
31513						intCount = Math.floor(
31514							Math.round(curValue * this.precisionFactor / this.stepQuantity) / this.precisionFactor
31515						) || 1;
31516						curValue = (intCount <= 1 ? this.stepQuantity : intCount * this.stepQuantity);
31517						curValue = Math.round(curValue * this.precisionFactor) / this.precisionFactor;
31518
31519						if (curValue < this.minQuantity)
31520						{
31521							curValue = this.minQuantity;
31522						}
31523
31524						this.obQuantity.value = curValue;
31525					}
31526					else
31527					{
31528						this.obQuantity.value = this.minQuantity;
31529					}
31530				}
31531				else
31532				{
31533					this.obQuantity.value = this.minQuantity;
31534				}
31535
31536				this.setPrice();
31537			}
31538		},
31539
31540		quantitySet: function(index)
31541		{
31542			var resetQuantity, strLimit;
31543
31544			var newOffer = this.offers[index],
31545				oldOffer = this.offers[this.offerNum];
31546
31547			if (this.errorCode === 0)
31548			{
31549				this.canBuy = newOffer.CAN_BUY;
31550
31551				this.currentPriceMode = newOffer.ITEM_PRICE_MODE;
31552				this.currentPrices = newOffer.ITEM_PRICES;
31553				this.currentPriceSelected = newOffer.ITEM_PRICE_SELECTED;
31554				this.currentQuantityRanges = newOffer.ITEM_QUANTITY_RANGES;
31555				this.currentQuantityRangeSelected = newOffer.ITEM_QUANTITY_RANGE_SELECTED;
31556
31557				if (this.canBuy)
31558				{
31559					if (this.blockNodes.quantity)
31560					{
31561						BX.style(this.blockNodes.quantity, 'display', '');
31562					}
31563
31564					if (this.obBasketActions)
31565					{
31566						BX.style(this.obBasketActions, 'display', '');
31567					}
31568
31569					if (this.obNotAvail)
31570					{
31571						BX.style(this.obNotAvail, 'display', 'none');
31572					}
31573
31574					if (this.obSubscribe)
31575					{
31576						BX.style(this.obSubscribe, 'display', 'none');
31577					}
31578				}
31579				else
31580				{
31581					if (this.blockNodes.quantity)
31582					{
31583						BX.style(this.blockNodes.quantity, 'display', 'none');
31584					}
31585
31586					if (this.obBasketActions)
31587					{
31588						BX.style(this.obBasketActions, 'display', 'none');
31589					}
31590
31591					if (this.obNotAvail)
31592					{
31593						BX.style(this.obNotAvail, 'display', '');
31594					}
31595
31596					if (this.obSubscribe)
31597					{
31598						if (newOffer.CATALOG_SUBSCRIBE === 'Y')
31599						{
31600							BX.style(this.obSubscribe, 'display', '');
31601							this.obSubscribe.setAttribute('data-item', newOffer.ID);
31602							BX(this.visual.SUBSCRIBE_ID + '_hidden').click();
31603						}
31604						else
31605						{
31606							BX.style(this.obSubscribe, 'display', 'none');
31607						}
31608					}
31609				}
31610
31611				this.isDblQuantity = newOffer.QUANTITY_FLOAT;
31612				this.checkQuantity = newOffer.CHECK_QUANTITY;
31613
31614				if (this.isDblQuantity)
31615				{
31616					this.stepQuantity = Math.round(parseFloat(newOffer.STEP_QUANTITY) * this.precisionFactor) / this.precisionFactor;
31617					this.maxQuantity = parseFloat(newOffer.MAX_QUANTITY);
31618					this.minQuantity = this.currentPriceMode === 'Q' ? parseFloat(this.currentPrices[this.currentPriceSelected].MIN_QUANTITY) : this.stepQuantity;
31619				}
31620				else
31621				{
31622					this.stepQuantity = parseInt(newOffer.STEP_QUANTITY, 10);
31623					this.maxQuantity = parseInt(newOffer.MAX_QUANTITY, 10);
31624					this.minQuantity = this.currentPriceMode === 'Q' ? parseInt(this.currentPrices[this.currentPriceSelected].MIN_QUANTITY) : this.stepQuantity;
31625				}
31626
31627				if (this.showQuantity)
31628				{
31629					var isDifferentMinQuantity = oldOffer.ITEM_PRICES.length
31630						&& oldOffer.ITEM_PRICES[oldOffer.ITEM_PRICE_SELECTED]
31631						&& oldOffer.ITEM_PRICES[oldOffer.ITEM_PRICE_SELECTED].MIN_QUANTITY != this.minQuantity;
31632
31633					if (this.isDblQuantity)
31634					{
31635						resetQuantity = Math.round(parseFloat(oldOffer.STEP_QUANTITY) * this.precisionFactor) / this.precisionFactor !== this.stepQuantity
31636							|| isDifferentMinQuantity
31637							|| oldOffer.MEASURE !== newOffer.MEASURE
31638							|| (
31639								this.checkQuantity
31640								&& parseFloat(oldOffer.MAX_QUANTITY) > this.maxQuantity
31641								&& parseFloat(this.obQuantity.value) > this.maxQuantity
31642							);
31643					}
31644					else
31645					{
31646						resetQuantity = parseInt(oldOffer.STEP_QUANTITY, 10) !== this.stepQuantity
31647							|| isDifferentMinQuantity
31648							|| oldOffer.MEASURE !== newOffer.MEASURE
31649							|| (
31650								this.checkQuantity
31651								&& parseInt(oldOffer.MAX_QUANTITY, 10) > this.maxQuantity
31652								&& parseInt(this.obQuantity.value, 10) > this.maxQuantity
31653							);
31654					}
31655
31656					this.obQuantity.disabled = !this.canBuy;
31657
31658					if (resetQuantity)
31659					{
31660						this.obQuantity.value = this.minQuantity;
31661					}
31662
31663					if (this.obMeasure)
31664					{
31665						if (newOffer.MEASURE)
31666						{
31667							BX.adjust(this.obMeasure, {html: newOffer.MEASURE});
31668						}
31669						else
31670						{
31671							BX.adjust(this.obMeasure, {html: ''});
31672						}
31673					}
31674				}
31675
31676				if (this.obQuantityLimit.all)
31677				{
31678					if (!this.checkQuantity || this.maxQuantity == 0)
31679					{
31680						BX.adjust(this.obQuantityLimit.value, {html: ''});
31681						BX.adjust(this.obQuantityLimit.all, {style: {display: 'none'}});
31682					}
31683					else
31684					{
31685						if (this.showMaxQuantity === 'M')
31686						{
31687							strLimit = (this.maxQuantity / this.stepQuantity >= this.relativeQuantityFactor)
31688								? BX.message('RELATIVE_QUANTITY_MANY')
31689								: BX.message('RELATIVE_QUANTITY_FEW');
31690						}
31691						else
31692						{
31693							strLimit = this.maxQuantity;
31694
31695							if (newOffer.MEASURE)
31696							{
31697								strLimit += (' ' + newOffer.MEASURE);
31698							}
31699						}
31700
31701						BX.adjust(this.obQuantityLimit.value, {html: strLimit});
31702						BX.adjust(this.obQuantityLimit.all, {style: {display: ''}});
31703					}
31704				}
31705			}
31706		},
31707
31708		initializeSlider: function()
31709		{
31710			var wrap = this.obPictSlider.getAttribute('data-slider-wrap');
31711			if (wrap)
31712			{
31713				this.slider.options.wrap = wrap === 'true';
31714			}
31715			else
31716			{
31717				this.slider.options.wrap = this.defaultSliderOptions.wrap;
31718			}
31719
31720			if (this.isTouchDevice)
31721			{
31722				this.slider.options.interval = false;
31723			}
31724			else
31725			{
31726				this.slider.options.interval = parseInt(this.obPictSlider.getAttribute('data-slider-interval')) || this.defaultSliderOptions.interval;
31727				// slider interval must be more than 700ms because of css transitions
31728				if (this.slider.options.interval < 700)
31729				{
31730					this.slider.options.interval = 700;
31731				}
31732
31733				if (this.obPictSliderIndicator)
31734				{
31735					var controls = this.obPictSliderIndicator.querySelectorAll('[data-go-to]');
31736					for (var i in controls)
31737					{
31738						if (controls.hasOwnProperty(i))
31739						{
31740							BX.bind(controls[i], 'click', BX.proxy(this.sliderClickHandler, this));
31741						}
31742					}
31743				}
31744
31745				if (this.obPictSliderProgressBar)
31746				{
31747					if (this.slider.progress)
31748					{
31749						this.resetProgress();
31750						this.cycleSlider();
31751					}
31752					else
31753					{
31754						this.slider.progress = new BX.easing({
31755							transition: BX.easing.transitions.linear,
31756							step: BX.delegate(function(state){
31757								this.obPictSliderProgressBar.style.width = state.width / 10 + '%';
31758							}, this)
31759						});
31760					}
31761				}
31762			}
31763		},
31764
31765		checkTouch: function(event)
31766		{
31767			if (!event || !event.changedTouches)
31768				return false;
31769
31770			return event.changedTouches[0].identifier === this.touch.identifier;
31771		},
31772
31773		touchStartEvent: function(event)
31774		{
31775			if (event.touches.length != 1)
31776				return;
31777
31778			this.touch = event.changedTouches[0];
31779		},
31780
31781		touchEndEvent: function(event)
31782		{
31783			if (!this.checkTouch(event))
31784				return;
31785
31786			var deltaX = this.touch.pageX - event.changedTouches[0].pageX,
31787				deltaY = this.touch.pageY - event.changedTouches[0].pageY;
31788
31789			if (Math.abs(deltaX) >= Math.abs(deltaY) + 10)
31790			{
31791				if (deltaX > 0)
31792				{
31793					this.slideNext();
31794				}
31795
31796				if (deltaX < 0)
31797				{
31798					this.slidePrev();
31799				}
31800			}
31801		},
31802
31803		sliderClickHandler: function(event)
31804		{
31805			var target = BX.getEventTarget(event),
31806				slideIndex = target.getAttribute('data-go-to');
31807
31808			if (slideIndex)
31809			{
31810				this.slideTo(slideIndex)
31811			}
31812
31813			BX.PreventDefault(event);
31814		},
31815
31816		slideNext: function()
31817		{
31818			if (this.slider.sliding)
31819				return;
31820
31821			return this.slide('next');
31822		},
31823
31824		slidePrev: function()
31825		{
31826			if (this.slider.sliding)
31827				return;
31828
31829			return this.slide('prev');
31830		},
31831
31832		slideTo: function(pos)
31833		{
31834			this.slider.active = BX.findChild(this.obPictSlider, {className: 'item active'}, true, false);
31835			this.slider.progress && (this.slider.interval = true);
31836
31837			var activeIndex = this.getItemIndex(this.slider.active);
31838
31839			if (pos > (this.slider.items.length - 1) || pos < 0)
31840				return;
31841
31842			if (this.slider.sliding)
31843				return false;
31844
31845			if (activeIndex == pos)
31846			{
31847				this.stopSlider();
31848				this.cycleSlider();
31849				return;
31850			}
31851
31852			return this.slide(pos > activeIndex ? 'next' : 'prev', this.eq(this.slider.items, pos));
31853		},
31854
31855		slide: function(type, next)
31856		{
31857			var active = BX.findChild(this.obPictSlider, {className: 'item active'}, true, false),
31858				isCycling = this.slider.interval,
31859				direction = type === 'next' ? 'left' : 'right';
31860
31861			next = next || this.getItemForDirection(type, active);
31862
31863			if (BX.hasClass(next, 'active'))
31864			{
31865				return (this.slider.sliding = false);
31866			}
31867
31868			this.slider.sliding = true;
31869
31870			isCycling && this.stopSlider();
31871
31872			if (this.obPictSliderIndicator)
31873			{
31874				BX.removeClass(this.obPictSliderIndicator.querySelector('.active'), 'active');
31875				var nextIndicator = this.obPictSliderIndicator.querySelectorAll('[data-go-to]')[this.getItemIndex(next)];
31876				nextIndicator && BX.addClass(nextIndicator, 'active');
31877			}
31878
31879			if (BX.hasClass(this.obPictSlider, 'slide') && !BX.browser.IsIE())
31880			{
31881				var self = this;
31882				BX.addClass(next, type);
31883				next.offsetWidth; // force reflow
31884				BX.addClass(active, direction);
31885				BX.addClass(next, direction);
31886				setTimeout(function() {
31887					BX.addClass(next, 'active');
31888					BX.removeClass(active, 'active');
31889					BX.removeClass(active, direction);
31890					BX.removeClass(next, type);
31891					BX.removeClass(next, direction);
31892					self.slider.sliding = false;
31893				}, 700);
31894			}
31895			else
31896			{
31897				BX.addClass(next, 'active');
31898				this.slider.sliding = false;
31899			}
31900
31901			this.obPictSliderProgressBar && this.resetProgress();
31902			isCycling && this.cycleSlider();
31903		},
31904
31905		stopSlider: function(event)
31906		{
31907			event || (this.slider.paused = true);
31908
31909			this.slider.interval && clearInterval(this.slider.interval);
31910
31911			if (this.slider.progress)
31912			{
31913				this.slider.progress.stop();
31914
31915				var width = parseInt(this.obPictSliderProgressBar.style.width);
31916
31917				this.slider.progress.options.duration = this.slider.options.interval * width / 200;
31918				this.slider.progress.options.start = {width: width * 10};
31919				this.slider.progress.options.finish = {width: 0};
31920				this.slider.progress.options.complete = null;
31921				this.slider.progress.animate();
31922			}
31923		},
31924
31925		cycleSlider: function(event)
31926		{
31927			event || (this.slider.paused = false);
31928
31929			this.slider.interval && clearInterval(this.slider.interval);
31930
31931			if (this.slider.options.interval && !this.slider.paused)
31932			{
31933				if (this.slider.progress)
31934				{
31935					this.slider.progress.stop();
31936
31937					var width = parseInt(this.obPictSliderProgressBar.style.width);
31938
31939					this.slider.progress.options.duration = this.slider.options.interval * (100 - width) / 100;
31940					this.slider.progress.options.start = {width: width * 10};
31941					this.slider.progress.options.finish = {width: 1000};
31942					this.slider.progress.options.complete = BX.delegate(function(){
31943						this.slider.interval = true;
31944						this.slideNext();
31945					}, this);
31946					this.slider.progress.animate();
31947				}
31948				else
31949				{
31950					this.slider.interval = setInterval(BX.proxy(this.slideNext, this), this.slider.options.interval);
31951				}
31952			}
31953		},
31954
31955		resetProgress: function()
31956		{
31957			this.slider.progress && this.slider.progress.stop();
31958			this.obPictSliderProgressBar.style.width = 0;
31959		},
31960
31961		getItemForDirection: function(direction, active)
31962		{
31963			var activeIndex = this.getItemIndex(active),
31964				willWrap = direction === 'prev' && activeIndex === 0
31965					|| direction === 'next' && activeIndex == (this.slider.items.length - 1);
31966
31967			if (willWrap && !this.slider.options.wrap)
31968				return active;
31969
31970			var delta = direction === 'prev' ? -1 : 1,
31971				itemIndex = (activeIndex + delta) % this.slider.items.length;
31972
31973			return this.eq(this.slider.items, itemIndex);
31974		},
31975
31976		getItemIndex: function(item)
31977		{
31978			this.slider.items = BX.findChildren(item.parentNode, {className: 'item'}, true);
31979
31980			return this.slider.items.indexOf(item || this.slider.active);
31981		},
31982
31983		eq: function(obj, i)
31984		{
31985			var len = obj.length,
31986				j = +i + (i < 0 ? len : 0);
31987
31988			return j >= 0 && j < len ? obj[j] : {};
31989		},
31990
31991		selectOfferProp: function()
31992		{
31993			var i = 0,
31994				value = '',
31995				strTreeValue = '',
31996				arTreeItem = [],
31997				rowItems = null,
31998				target = BX.proxy_context;
31999
32000			if (target && target.hasAttribute('data-treevalue'))
32001			{
32002				if (BX.hasClass(target, 'selected'))
32003					return;
32004
32005				strTreeValue = target.getAttribute('data-treevalue');
32006				arTreeItem = strTreeValue.split('_');
32007				if (this.searchOfferPropIndex(arTreeItem[0], arTreeItem[1]))
32008				{
32009					rowItems = BX.findChildren(target.parentNode, {tagName: 'li'}, false);
32010					if (rowItems && 0 < rowItems.length)
32011					{
32012						for (i = 0; i < rowItems.length; i++)
32013						{
32014							value = rowItems[i].getAttribute('data-onevalue');
32015							if (value === arTreeItem[1])
32016							{
32017								BX.addClass(rowItems[i], 'selected');
32018							}
32019							else
32020							{
32021								BX.removeClass(rowItems[i], 'selected');
32022							}
32023						}
32024					}
32025
32026					if (
32027						this.isFacebookConversionCustomizeProductEventEnabled
32028						&& BX.Type.isArrayFilled(this.offers)
32029						&& BX.Type.isObject(this.offers[this.offerNum])
32030					)
32031					{
32032						BX.ajax.runAction(
32033							'sale.facebookconversion.customizeProduct',
32034							{
32035								data: {
32036									offerId: this.offers[this.offerNum]['ID']
32037								}
32038							}
32039						);
32040					}
32041				}
32042			}
32043		},
32044
32045		searchOfferPropIndex: function(strPropID, strPropValue)
32046		{
32047			var strName = '',
32048				arShowValues = false,
32049				i, j,
32050				arCanBuyValues = [],
32051				allValues = [],
32052				index = -1,
32053				arFilter = {},
32054				tmpFilter = [];
32055
32056			for (i = 0; i < this.treeProps.length; i++)
32057			{
32058				if (this.treeProps[i].ID === strPropID)
32059				{
32060					index = i;
32061					break;
32062				}
32063			}
32064
32065			if (-1 < index)
32066			{
32067				for (i = 0; i < index; i++)
32068				{
32069					strName = 'PROP_'+this.treeProps[i].ID;
32070					arFilter[strName] = this.selectedValues[strName];
32071				}
32072				strName = 'PROP_'+this.treeProps[index].ID;
32073				arShowValues = this.getRowValues(arFilter, strName);
32074				if (!arShowValues)
32075				{
32076					return false;
32077				}
32078				if (!BX.util.in_array(strPropValue, arShowValues))
32079				{
32080					return false;
32081				}
32082				arFilter[strName] = strPropValue;
32083				for (i = index+1; i < this.treeProps.length; i++)
32084				{
32085					strName = 'PROP_'+this.treeProps[i].ID;
32086					arShowValues = this.getRowValues(arFilter, strName);
32087					if (!arShowValues)
32088					{
32089						return false;
32090					}
32091					allValues = [];
32092					if (this.showAbsent)
32093					{
32094						arCanBuyValues = [];
32095						tmpFilter = [];
32096						tmpFilter = BX.clone(arFilter, true);
32097						for (j = 0; j < arShowValues.length; j++)
32098						{
32099							tmpFilter[strName] = arShowValues[j];
32100							allValues[allValues.length] = arShowValues[j];
32101							if (this.getCanBuy(tmpFilter))
32102								arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
32103						}
32104					}
32105					else
32106					{
32107						arCanBuyValues = arShowValues;
32108					}
32109					if (this.selectedValues[strName] && BX.util.in_array(this.selectedValues[strName], arCanBuyValues))
32110					{
32111						arFilter[strName] = this.selectedValues[strName];
32112					}
32113					else
32114					{
32115						if (this.showAbsent)
32116							arFilter[strName] = (arCanBuyValues.length > 0 ? arCanBuyValues[0] : allValues[0]);
32117						else
32118							arFilter[strName] = arCanBuyValues[0];
32119					}
32120					this.updateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
32121				}
32122				this.selectedValues = arFilter;
32123				this.changeInfo();
32124			}
32125			return true;
32126		},
32127
32128		updateRow: function(intNumber, activeID, showID, canBuyID)
32129		{
32130			var i = 0,
32131				value = '',
32132				isCurrent = false,
32133				rowItems = null;
32134
32135			var lineContainer = this.obTree.querySelectorAll('[data-entity="sku-line-block"]'),
32136				listContainer;
32137
32138			if (intNumber > -1 && intNumber < lineContainer.length)
32139			{
32140				listContainer = lineContainer[intNumber].querySelector('ul');
32141				rowItems = BX.findChildren(listContainer, {tagName: 'li'}, false);
32142				if (rowItems && 0 < rowItems.length)
32143				{
32144					for (i = 0; i < rowItems.length; i++)
32145					{
32146						value = rowItems[i].getAttribute('data-onevalue');
32147						isCurrent = value === activeID;
32148
32149						if (isCurrent)
32150						{
32151							BX.addClass(rowItems[i], 'selected');
32152						}
32153						else
32154						{
32155							BX.removeClass(rowItems[i], 'selected');
32156						}
32157
32158						if (BX.util.in_array(value, canBuyID))
32159						{
32160							BX.removeClass(rowItems[i], 'notallowed');
32161						}
32162						else
32163						{
32164							BX.addClass(rowItems[i], 'notallowed');
32165						}
32166
32167						rowItems[i].style.display = BX.util.in_array(value, showID) ? '' : 'none';
32168
32169						if (isCurrent)
32170						{
32171							lineContainer[intNumber].style.display = (value == 0 && canBuyID.length == 1) ? 'none' : '';
32172						}
32173					}
32174				}
32175			}
32176		},
32177
32178		getRowValues: function(arFilter, index)
32179		{
32180			var i = 0,
32181				j,
32182				arValues = [],
32183				boolSearch = false,
32184				boolOneSearch = true;
32185
32186			if (0 === arFilter.length)
32187			{
32188				for (i = 0; i < this.offers.length; i++)
32189				{
32190					if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
32191					{
32192						arValues[arValues.length] = this.offers[i].TREE[index];
32193					}
32194				}
32195				boolSearch = true;
32196			}
32197			else
32198			{
32199				for (i = 0; i < this.offers.length; i++)
32200				{
32201					boolOneSearch = true;
32202					for (j in arFilter)
32203					{
32204						if (arFilter[j] !== this.offers[i].TREE[j])
32205						{
32206							boolOneSearch = false;
32207							break;
32208						}
32209					}
32210					if (boolOneSearch)
32211					{
32212						if (!BX.util.in_array(this.offers[i].TREE[index], arValues))
32213						{
32214							arValues[arValues.length] = this.offers[i].TREE[index];
32215						}
32216						boolSearch = true;
32217					}
32218				}
32219			}
32220			return (boolSearch ? arValues : false);
32221		},
32222
32223		getCanBuy: function(arFilter)
32224		{
32225			var i, j,
32226				boolSearch = false,
32227				boolOneSearch = true;
32228
32229			for (i = 0; i < this.offers.length; i++)
32230			{
32231				boolOneSearch = true;
32232				for (j in arFilter)
32233				{
32234					if (arFilter[j] !== this.offers[i].TREE[j])
32235					{
32236						boolOneSearch = false;
32237						break;
32238					}
32239				}
32240				if (boolOneSearch)
32241				{
32242					if (this.offers[i].CAN_BUY)
32243					{
32244						boolSearch = true;
32245						break;
32246					}
32247				}
32248			}
32249
32250			return boolSearch;
32251		},
32252
32253		setCurrent: function()
32254		{
32255			var i,
32256				j = 0,
32257				arCanBuyValues = [],
32258				strName = '',
32259				arShowValues = false,
32260				arFilter = {},
32261				tmpFilter = [],
32262				current = this.offers[this.offerNum].TREE;
32263
32264			for (i = 0; i < this.treeProps.length; i++)
32265			{
32266				strName = 'PROP_'+this.treeProps[i].ID;
32267				arShowValues = this.getRowValues(arFilter, strName);
32268				if (!arShowValues)
32269				{
32270					break;
32271				}
32272				if (BX.util.in_array(current[strName], arShowValues))
32273				{
32274					arFilter[strName] = current[strName];
32275				}
32276				else
32277				{
32278					arFilter[strName] = arShowValues[0];
32279					this.offerNum = 0;
32280				}
32281				if (this.showAbsent)
32282				{
32283					arCanBuyValues = [];
32284					tmpFilter = [];
32285					tmpFilter = BX.clone(arFilter, true);
32286					for (j = 0; j < arShowValues.length; j++)
32287					{
32288						tmpFilter[strName] = arShowValues[j];
32289						if (this.getCanBuy(tmpFilter))
32290						{
32291							arCanBuyValues[arCanBuyValues.length] = arShowValues[j];
32292						}
32293					}
32294				}
32295				else
32296				{
32297					arCanBuyValues = arShowValues;
32298				}
32299				this.updateRow(i, arFilter[strName], arShowValues, arCanBuyValues);
32300			}
32301			this.selectedValues = arFilter;
32302			this.changeInfo();
32303		},
32304
32305		changeInfo: function()
32306		{
32307			var i, j,
32308				index = -1,
32309				boolOneSearch = true,
32310				quantityChanged;
32311
32312			for (i = 0; i < this.offers.length; i++)
32313			{
32314				boolOneSearch = true;
32315				for (j in this.selectedValues)
32316				{
32317					if (this.selectedValues[j] !== this.offers[i].TREE[j])
32318					{
32319						boolOneSearch = false;
32320						break;
32321					}
32322				}
32323				if (boolOneSearch)
32324				{
32325					index = i;
32326					break;
32327				}
32328			}
32329			if (index > -1)
32330			{
32331				if (parseInt(this.offers[index].MORE_PHOTO_COUNT) > 1 && this.obPictSlider)
32332				{
32333					// hide pict and second_pict containers
32334					if (this.obPict)
32335					{
32336						this.obPict.style.display = 'none';
32337					}
32338
32339					if (this.obSecondPict)
32340					{
32341						this.obSecondPict.style.display = 'none';
32342					}
32343
32344					// clear slider container
32345					BX.cleanNode(this.obPictSlider);
32346
32347					// fill slider container with slides
32348					for (i in this.offers[index].MORE_PHOTO)
32349					{
32350						if (this.offers[index].MORE_PHOTO.hasOwnProperty(i))
32351						{
32352							this.obPictSlider.appendChild(
32353								BX.create('SPAN', {
32354									props: {className: 'product-item-image-slide item' + (i == 0 ? ' active' : '')},
32355									style: {backgroundImage: 'url(\'' + this.offers[index].MORE_PHOTO[i].SRC + '\')'}
32356								})
32357							);
32358						}
32359					}
32360
32361					// fill slider indicator if exists
32362					if (this.obPictSliderIndicator)
32363					{
32364						BX.cleanNode(this.obPictSliderIndicator);
32365
32366						for (i in this.offers[index].MORE_PHOTO)
32367						{
32368							if (this.offers[index].MORE_PHOTO.hasOwnProperty(i))
32369							{
32370								this.obPictSliderIndicator.appendChild(
32371									BX.create('DIV', {
32372										attrs: {'data-go-to': i},
32373										props: {className: 'product-item-image-slider-control' + (i == 0 ? ' active' : '')}
32374									})
32375								);
32376								this.obPictSliderIndicator.appendChild(document.createTextNode(' '));
32377							}
32378						}
32379
32380						this.obPictSliderIndicator.style.display = '';
32381					}
32382
32383					if (this.obPictSliderProgressBar)
32384					{
32385						this.obPictSliderProgressBar.style.display = '';
32386					}
32387
32388					// show slider container
32389					this.obPictSlider.style.display = '';
32390					this.initializeSlider();
32391				}
32392				else
32393				{
32394					// hide slider container
32395					if (this.obPictSlider)
32396					{
32397						this.obPictSlider.style.display = 'none';
32398					}
32399
32400					if (this.obPictSliderIndicator)
32401					{
32402						this.obPictSliderIndicator.style.display = 'none';
32403					}
32404
32405					if (this.obPictSliderProgressBar)
32406					{
32407						this.obPictSliderProgressBar.style.display = 'none';
32408					}
32409
32410					// show pict and pict_second containers
32411					if (this.obPict)
32412					{
32413						if (this.offers[index].PREVIEW_PICTURE)
32414						{
32415							BX.adjust(this.obPict, {style: {backgroundImage: 'url(\'' + this.offers[index].PREVIEW_PICTURE.SRC + '\')'}});
32416						}
32417						else
32418						{
32419							BX.adjust(this.obPict, {style: {backgroundImage: 'url(\'' + this.defaultPict.pict.SRC + '\')'}});
32420						}
32421
32422						this.obPict.style.display = '';
32423					}
32424
32425					if (this.secondPict && this.obSecondPict)
32426					{
32427						if (this.offers[index].PREVIEW_PICTURE_SECOND)
32428						{
32429							BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url(\'' + this.offers[index].PREVIEW_PICTURE_SECOND.SRC + '\')'}});
32430						}
32431						else if (this.offers[index].PREVIEW_PICTURE.SRC)
32432						{
32433							BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url(\'' + this.offers[index].PREVIEW_PICTURE.SRC + '\')'}});
32434						}
32435						else if (this.defaultPict.secondPict)
32436						{
32437							BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url(\'' + this.defaultPict.secondPict.SRC + '\')'}});
32438						}
32439						else
32440						{
32441							BX.adjust(this.obSecondPict, {style: {backgroundImage: 'url(\'' + this.defaultPict.pict.SRC + '\')'}});
32442						}
32443
32444						this.obSecondPict.style.display = '';
32445					}
32446				}
32447
32448				if (this.showSkuProps && this.obSkuProps)
32449				{
32450					if (this.offers[index].DISPLAY_PROPERTIES.length)
32451					{
32452						BX.adjust(this.obSkuProps, {style: {display: ''}, html: this.offers[index].DISPLAY_PROPERTIES});
32453					}
32454					else
32455					{
32456						BX.adjust(this.obSkuProps, {style: {display: 'none'}, html: ''});
32457					}
32458				}
32459
32460				this.quantitySet(index);
32461				this.setPrice();
32462				this.setCompared(this.offers[index].COMPARED);
32463
32464				this.offerNum = index;
32465			}
32466		},
32467
32468		checkPriceRange: function(quantity)
32469		{
32470			if (typeof quantity === 'undefined'|| this.currentPriceMode != 'Q')
32471				return;
32472
32473			var range, found = false;
32474
32475			for (var i in this.currentQuantityRanges)
32476			{
32477				if (this.currentQuantityRanges.hasOwnProperty(i))
32478				{
32479					range = this.currentQuantityRanges[i];
32480
32481					if (
32482						parseInt(quantity) >= parseInt(range.SORT_FROM)
32483						&& (
32484							range.SORT_TO == 'INF'
32485							|| parseInt(quantity) <= parseInt(range.SORT_TO)
32486						)
32487					)
32488					{
32489						found = true;
32490						this.currentQuantityRangeSelected = range.HASH;
32491						break;
32492					}
32493				}
32494			}
32495
32496			if (!found && (range = this.getMinPriceRange()))
32497			{
32498				this.currentQuantityRangeSelected = range.HASH;
32499			}
32500
32501			for (var k in this.currentPrices)
32502			{
32503				if (this.currentPrices.hasOwnProperty(k))
32504				{
32505					if (this.currentPrices[k].QUANTITY_HASH == this.currentQuantityRangeSelected)
32506					{
32507						this.currentPriceSelected = k;
32508						break;
32509					}
32510				}
32511			}
32512		},
32513
32514		getMinPriceRange: function()
32515		{
32516			var range;
32517
32518			for (var i in this.currentQuantityRanges)
32519			{
32520				if (this.currentQuantityRanges.hasOwnProperty(i))
32521				{
32522					if (
32523						!range
32524						|| parseInt(this.currentQuantityRanges[i].SORT_FROM) < parseInt(range.SORT_FROM)
32525					)
32526					{
32527						range = this.currentQuantityRanges[i];
32528					}
32529				}
32530			}
32531
32532			return range;
32533		},
32534
32535		checkQuantityControls: function()
32536		{
32537			if (!this.obQuantity)
32538				return;
32539
32540			var reachedTopLimit = this.checkQuantity && parseFloat(this.obQuantity.value) + this.stepQuantity > this.maxQuantity,
32541				reachedBottomLimit = parseFloat(this.obQuantity.value) - this.stepQuantity < this.minQuantity;
32542
32543			if (reachedTopLimit)
32544			{
32545				BX.addClass(this.obQuantityUp, 'product-item-amount-field-btn-disabled');
32546			}
32547			else if (BX.hasClass(this.obQuantityUp, 'product-item-amount-field-btn-disabled'))
32548			{
32549				BX.removeClass(this.obQuantityUp, 'product-item-amount-field-btn-disabled');
32550			}
32551
32552			if (reachedBottomLimit)
32553			{
32554				BX.addClass(this.obQuantityDown, 'product-item-amount-field-btn-disabled');
32555			}
32556			else if (BX.hasClass(this.obQuantityDown, 'product-item-amount-field-btn-disabled'))
32557			{
32558				BX.removeClass(this.obQuantityDown, 'product-item-amount-field-btn-disabled');
32559			}
32560
32561			if (reachedTopLimit && reachedBottomLimit)
32562			{
32563				this.obQuantity.setAttribute('disabled', 'disabled');
32564			}
32565			else
32566			{
32567				this.obQuantity.removeAttribute('disabled');
32568			}
32569		},
32570
32571		setPrice: function()
32572		{
32573			var obData, price;
32574
32575			if (this.obQuantity)
32576			{
32577				this.checkPriceRange(this.obQuantity.value);
32578			}
32579
32580			this.checkQuantityControls();
32581
32582			price = this.currentPrices[this.currentPriceSelected];
32583
32584			if (this.obPrice)
32585			{
32586				if (price)
32587				{
32588					BX.adjust(this.obPrice, {html: BX.Currency.currencyFormat(price.RATIO_PRICE, price.CURRENCY, true)});
32589				}
32590				else
32591				{
32592					BX.adjust(this.obPrice, {html: ''});
32593				}
32594
32595				if (this.showOldPrice && this.obPriceOld)
32596				{
32597					if (price && price.RATIO_PRICE !== price.RATIO_BASE_PRICE)
32598					{
32599						BX.adjust(this.obPriceOld, {
32600							style: {display: ''},
32601							html: BX.Currency.currencyFormat(price.RATIO_BASE_PRICE, price.CURRENCY, true)
32602						});
32603					}
32604					else
32605					{
32606						BX.adjust(this.obPriceOld, {
32607							style: {display: 'none'},
32608							html: ''
32609						});
32610					}
32611				}
32612
32613				if (this.obPriceTotal)
32614				{
32615					if (price && this.obQuantity && this.obQuantity.value != this.stepQuantity)
32616					{
32617						BX.adjust(this.obPriceTotal, {
32618							html: BX.message('PRICE_TOTAL_PREFIX') + ' <strong>'
32619							+ BX.Currency.currencyFormat(price.PRICE * this.obQuantity.value, price.CURRENCY, true)
32620							+ '</strong>',
32621							style: {display: ''}
32622						});
32623					}
32624					else
32625					{
32626						BX.adjust(this.obPriceTotal, {
32627							html: '',
32628							style: {display: 'none'}
32629						});
32630					}
32631				}
32632
32633				if (this.showPercent)
32634				{
32635					if (price && parseInt(price.PERCENT) > 0)
32636					{
32637						obData = {style: {display: ''}, html: -price.PERCENT + '%'};
32638					}
32639					else
32640					{
32641						obData = {style: {display: 'none'}, html: ''};
32642					}
32643
32644					if (this.obDscPerc)
32645					{
32646						BX.adjust(this.obDscPerc, obData);
32647					}
32648
32649					if (this.obSecondDscPerc)
32650					{
32651						BX.adjust(this.obSecondDscPerc, obData);
32652					}
32653				}
32654			}
32655		},
32656
32657		compare: function(event)
32658		{
32659			var checkbox = this.obCompare.querySelector('[data-entity="compare-checkbox"]'),
32660				target = BX.getEventTarget(event),
32661				checked = true;
32662
32663			if (checkbox)
32664			{
32665				checked = target === checkbox ? checkbox.checked : !checkbox.checked;
32666			}
32667
32668			var url = checked ? this.compareData.compareUrl : this.compareData.compareDeleteUrl,
32669				compareLink;
32670
32671			if (url)
32672			{
32673				if (target !== checkbox)
32674				{
32675					BX.PreventDefault(event);
32676					this.setCompared(checked);
32677				}
32678
32679				switch (this.productType)
32680				{
32681					case 0: // no catalog
32682					case 1: // product
32683					case 2: // set
32684					case 7: // service
32685						compareLink = url.replace('#ID#', this.product.id.toString());
32686						break;
32687					case 3: // sku
32688						compareLink = url.replace('#ID#', this.offers[this.offerNum].ID);
32689						break;
32690				}
32691
32692				BX.ajax({
32693					method: 'POST',
32694					dataType: checked ? 'json' : 'html',
32695					url: compareLink + (compareLink.indexOf('?') !== -1 ? '&' : '?') + 'ajax_action=Y',
32696					onsuccess: checked
32697						? BX.proxy(this.compareResult, this)
32698						: BX.proxy(this.compareDeleteResult, this)
32699				});
32700			}
32701		},
32702
32703		compareResult: function(result)
32704		{
32705			var popupContent, popupButtons;
32706
32707			if (this.obPopupWin)
32708			{
32709				this.obPopupWin.close();
32710			}
32711
32712			if (!BX.type.isPlainObject(result))
32713				return;
32714
32715			this.initPopupWindow();
32716
32717			if (this.offers.length > 0)
32718			{
32719				this.offers[this.offerNum].COMPARED = result.STATUS === 'OK';
32720			}
32721
32722			if (result.STATUS === 'OK')
32723			{
32724				BX.onCustomEvent('OnCompareChange');
32725
32726				popupContent = '<div style="width: 100%; margin: 0; text-align: center;"><p>'
32727					+ BX.message('COMPARE_MESSAGE_OK')
32728					+ '</p></div>';
32729
32730				if (this.showClosePopup)
32731				{
32732					popupButtons = [
32733						new BasketButton({
32734							text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'),
32735							events: {
32736								click: BX.delegate(this.compareRedirect, this)
32737							},
32738							style: {marginRight: '10px'}
32739						}),
32740						new BasketButton({
32741							text: BX.message('BTN_MESSAGE_CLOSE_POPUP'),
32742							events: {
32743								click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
32744							}
32745						})
32746					];
32747				}
32748				else
32749				{
32750					popupButtons = [
32751						new BasketButton({
32752							text: BX.message('BTN_MESSAGE_COMPARE_REDIRECT'),
32753							events: {
32754								click: BX.delegate(this.compareRedirect, this)
32755							}
32756						})
32757					];
32758				}
32759			}
32760			else
32761			{
32762				popupContent = '<div style="width: 100%; margin: 0; text-align: center;"><p>'
32763					+ (result.MESSAGE ? result.MESSAGE : BX.message('COMPARE_UNKNOWN_ERROR'))
32764					+ '</p></div>';
32765				popupButtons = [
32766					new BasketButton({
32767						text: BX.message('BTN_MESSAGE_CLOSE'),
32768						events: {
32769							click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
32770						}
32771					})
32772				];
32773			}
32774
32775			this.obPopupWin.setTitleBar(BX.message('COMPARE_TITLE'));
32776			this.obPopupWin.setContent(popupContent);
32777			this.obPopupWin.setButtons(popupButtons);
32778			this.obPopupWin.show();
32779		},
32780
32781		compareDeleteResult: function()
32782		{
32783			BX.onCustomEvent('OnCompareChange');
32784
32785			if (this.offers && this.offers.length)
32786			{
32787				this.offers[this.offerNum].COMPARED = false;
32788			}
32789		},
32790
32791		setCompared: function(state)
32792		{
32793			if (!this.obCompare)
32794				return;
32795
32796			var checkbox = this.obCompare.querySelector('[data-entity="compare-checkbox"]');
32797			if (checkbox)
32798			{
32799				checkbox.checked = state;
32800			}
32801		},
32802
32803		setCompareInfo: function(comparedIds)
32804		{
32805			if (!BX.type.isArray(comparedIds))
32806				return;
32807
32808			for (var i in this.offers)
32809			{
32810				if (this.offers.hasOwnProperty(i))
32811				{
32812					this.offers[i].COMPARED = BX.util.in_array(this.offers[i].ID, comparedIds);
32813				}
32814			}
32815		},
32816
32817		compareRedirect: function()
32818		{
32819			if (this.compareData.comparePath)
32820			{
32821				location.href = this.compareData.comparePath;
32822			}
32823			else
32824			{
32825				this.obPopupWin.close();
32826			}
32827		},
32828
32829		checkDeletedCompare: function(id)
32830		{
32831			switch (this.productType)
32832			{
32833				case 0: // no catalog
32834				case 1: // product
32835				case 2: // set
32836				case 7: // service
32837					if (this.product.id == id)
32838					{
32839						this.setCompared(false);
32840					}
32841
32842					break;
32843				case 3: // sku
32844					var i = this.offers.length;
32845					while (i--)
32846					{
32847						if (this.offers[i].ID == id)
32848						{
32849							this.offers[i].COMPARED = false;
32850
32851							if (this.offerNum == i)
32852							{
32853								this.setCompared(false);
32854							}
32855
32856							break;
32857						}
32858					}
32859			}
32860		},
32861
32862		initBasketUrl: function()
32863		{
32864			this.basketUrl = (this.basketMode === 'ADD' ? this.basketData.add_url : this.basketData.buy_url);
32865			switch (this.productType)
32866			{
32867				case 1: // product
32868				case 2: // set
32869				case 7: // service
32870					this.basketUrl = this.basketUrl.replace('#ID#', this.product.id.toString());
32871					break;
32872				case 3: // sku
32873					this.basketUrl = this.basketUrl.replace('#ID#', this.offers[this.offerNum].ID);
32874					break;
32875			}
32876			this.basketParams = {
32877				'ajax_basket': 'Y'
32878			};
32879			if (this.showQuantity)
32880			{
32881				this.basketParams[this.basketData.quantity] = this.obQuantity.value;
32882			}
32883			if (this.basketData.sku_props)
32884			{
32885				this.basketParams[this.basketData.sku_props_var] = this.basketData.sku_props;
32886			}
32887		},
32888
32889		fillBasketProps: function()
32890		{
32891			if (!this.visual.BASKET_PROP_DIV)
32892			{
32893				return;
32894			}
32895			var
32896				i = 0,
32897				propCollection = null,
32898				foundValues = false,
32899				obBasketProps = null;
32900
32901			if (this.basketData.useProps && !this.basketData.emptyProps)
32902			{
32903				if (this.obPopupWin && this.obPopupWin.contentContainer)
32904				{
32905					obBasketProps = this.obPopupWin.contentContainer;
32906				}
32907			}
32908			else
32909			{
32910				obBasketProps = BX(this.visual.BASKET_PROP_DIV);
32911			}
32912			if (obBasketProps)
32913			{
32914				propCollection = obBasketProps.getElementsByTagName('select');
32915				if (propCollection && propCollection.length)
32916				{
32917					for (i = 0; i < propCollection.length; i++)
32918					{
32919						if (!propCollection[i].disabled)
32920						{
32921							switch (propCollection[i].type.toLowerCase())
32922							{
32923								case 'select-one':
32924									this.basketParams[propCollection[i].name] = propCollection[i].value;
32925									foundValues = true;
32926									break;
32927								default:
32928									break;
32929							}
32930						}
32931					}
32932				}
32933				propCollection = obBasketProps.getElementsByTagName('input');
32934				if (propCollection && propCollection.length)
32935				{
32936					for (i = 0; i < propCollection.length; i++)
32937					{
32938						if (!propCollection[i].disabled)
32939						{
32940							switch (propCollection[i].type.toLowerCase())
32941							{
32942								case 'hidden':
32943									this.basketParams[propCollection[i].name] = propCollection[i].value;
32944									foundValues = true;
32945									break;
32946								case 'radio':
32947									if (propCollection[i].checked)
32948									{
32949										this.basketParams[propCollection[i].name] = propCollection[i].value;
32950										foundValues = true;
32951									}
32952									break;
32953								default:
32954									break;
32955							}
32956						}
32957					}
32958				}
32959			}
32960			if (!foundValues)
32961			{
32962				this.basketParams[this.basketData.props] = [];
32963				this.basketParams[this.basketData.props][0] = 0;
32964			}
32965		},
32966
32967		add2Basket: function()
32968		{
32969			this.basketMode = 'ADD';
32970			this.basket();
32971		},
32972
32973		buyBasket: function()
32974		{
32975			this.basketMode = 'BUY';
32976			this.basket();
32977		},
32978
32979		sendToBasket: function()
32980		{
32981			if (!this.canBuy)
32982			{
32983				return;
32984			}
32985
32986			// check recommendation
32987			if (this.product && this.product.id && this.bigData)
32988			{
32989				this.rememberProductRecommendation();
32990			}
32991
32992			this.initBasketUrl();
32993			this.fillBasketProps();
32994			BX.ajax({
32995				method: 'POST',
32996				dataType: 'json',
32997				url: this.basketUrl,
32998				data: this.basketParams,
32999				onsuccess: BX.proxy(this.basketResult, this)
33000			});
33001		},
33002
33003		basket: function()
33004		{
33005			var contentBasketProps = '';
33006			if (!this.canBuy)
33007			{
33008				return;
33009			}
33010			switch (this.productType)
33011			{
33012				case 1: // product
33013				case 2: // set
33014				case 7: // service
33015					if (this.basketData.useProps && !this.basketData.emptyProps)
33016					{
33017						this.initPopupWindow();
33018						this.obPopupWin.setTitleBar(BX.message('TITLE_BASKET_PROPS'));
33019						if (BX(this.visual.BASKET_PROP_DIV))
33020						{
33021							contentBasketProps = BX(this.visual.BASKET_PROP_DIV).innerHTML;
33022						}
33023						this.obPopupWin.setContent(contentBasketProps);
33024						this.obPopupWin.setButtons([
33025							new BasketButton({
33026								text: BX.message('BTN_MESSAGE_SEND_PROPS'),
33027								events: {
33028									click: BX.delegate(this.sendToBasket, this)
33029								}
33030							})
33031						]);
33032						this.obPopupWin.show();
33033					}
33034					else
33035					{
33036						this.sendToBasket();
33037					}
33038					break;
33039				case 3: // sku
33040					this.sendToBasket();
33041					break;
33042			}
33043		},
33044
33045		basketResult: function(arResult)
33046		{
33047			var strContent = '',
33048				strPict = '',
33049				successful,
33050				buttons = [];
33051
33052			if (this.obPopupWin)
33053				this.obPopupWin.close();
33054
33055			if (!BX.type.isPlainObject(arResult))
33056				return;
33057
33058			successful = arResult.STATUS === 'OK';
33059
33060			if (successful)
33061			{
33062				this.setAnalyticsDataLayer('addToCart');
33063			}
33064
33065			if (successful && this.basketAction === 'BUY')
33066			{
33067				this.basketRedirect();
33068			}
33069			else
33070			{
33071				this.initPopupWindow();
33072
33073				if (successful)
33074				{
33075					BX.onCustomEvent('OnBasketChange');
33076
33077					if  (BX.findParent(this.obProduct, {className: 'bx_sale_gift_main_products'}, 10))
33078					{
33079						BX.onCustomEvent('onAddToBasketMainProduct', [this]);
33080					}
33081
33082					switch (this.productType)
33083					{
33084						case 1: // product
33085						case 2: // set
33086						case 7: // service
33087							strPict = this.product.pict.SRC;
33088							break;
33089						case 3: // sku
33090							strPict = (this.offers[this.offerNum].PREVIEW_PICTURE ?
33091									this.offers[this.offerNum].PREVIEW_PICTURE.SRC :
33092									this.defaultPict.pict.SRC
33093							);
33094							break;
33095					}
33096
33097					strContent = '<div style="width: 100%; margin: 0; text-align: center;"><img src="'
33098						+ strPict + '" height="130" style="max-height:130px"><p>' + this.product.name + '</p></div>';
33099
33100					if (this.showClosePopup)
33101					{
33102						buttons = [
33103							new BasketButton({
33104								text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"),
33105								events: {
33106									click: BX.delegate(this.basketRedirect, this)
33107								},
33108								style: {marginRight: '10px'}
33109							}),
33110							new BasketButton({
33111								text: BX.message("BTN_MESSAGE_CLOSE_POPUP"),
33112								events: {
33113									click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
33114								}
33115							})
33116						];
33117					}
33118					else
33119					{
33120						buttons = [
33121							new BasketButton({
33122								text: BX.message("BTN_MESSAGE_BASKET_REDIRECT"),
33123								events: {
33124									click: BX.delegate(this.basketRedirect, this)
33125								}
33126							})
33127						];
33128					}
33129				}
33130				else
33131				{
33132					strContent = '<div style="width: 100%; margin: 0; text-align: center;"><p>'
33133						+ (arResult.MESSAGE ? arResult.MESSAGE : BX.message('BASKET_UNKNOWN_ERROR'))
33134						+ '</p></div>';
33135					buttons = [
33136						new BasketButton({
33137							text: BX.message('BTN_MESSAGE_CLOSE'),
33138							events: {
33139								click: BX.delegate(this.obPopupWin.close, this.obPopupWin)
33140							}
33141						})
33142					];
33143				}
33144				this.obPopupWin.setTitleBar(successful ? BX.message('TITLE_SUCCESSFUL') : BX.message('TITLE_ERROR'));
33145				this.obPopupWin.setContent(strContent);
33146				this.obPopupWin.setButtons(buttons);
33147				this.obPopupWin.show();
33148			}
33149		},
33150
33151		basketRedirect: function()
33152		{
33153			location.href = (this.basketData.basketUrl ? this.basketData.basketUrl : BX.message('BASKET_URL'));
33154		},
33155
33156		initPopupWindow: function()
33157		{
33158			if (this.obPopupWin)
33159				return;
33160
33161			this.obPopupWin = BX.PopupWindowManager.create('CatalogSectionBasket_' + this.visual.ID, null, {
33162				autoHide: true,
33163				offsetLeft: 0,
33164				offsetTop: 0,
33165				overlay : true,
33166				closeByEsc: true,
33167				titleBar: true,
33168				closeIcon: true,
33169				contentColor: 'white',
33170				className: this.templateTheme ? 'bx-' + this.templateTheme : ''
33171			});
33172		}
33173	};
33174})(window);
33175/* End */
33176;
33177; /* Start:"a:4:{s:4:"full";s:86:"/bitrix/components/aspro/wrapper.block.max/templates/.default/script.js?16201287591125";s:6:"source";s:71:"/bitrix/components/aspro/wrapper.block.max/templates/.default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
33178$(document).ready(function(){
33179	$('.hot-wrapper-items .flexslider li > .js-click').click(function(){
33180		var _this = $(this),
33181		block = '';
33182			activeBlock = _this.closest('.items').find('.item.active');
33183		if(_this.hasClass('flex-prev'))
33184		{
33185			activeBlock.fadeOut(function(){
33186				$(this).removeClass('active');
33187
33188				block = activeBlock.prev('.item');
33189				if(block.length)
33190				{
33191					block.fadeIn(function(){
33192						$(this).addClass('active');
33193						$(window).scroll();
33194					})
33195				}
33196				else
33197				{
33198					_this.closest('.items').find('> .item:last-of-type').fadeIn(function(){
33199						$(this).addClass('active');
33200						$(window).scroll();
33201					})
33202				}
33203			})
33204		}
33205		else
33206		{
33207			activeBlock.fadeOut(function(){
33208				$(this).removeClass('active');
33209
33210				block = activeBlock.next();
33211				if(block.length)
33212				{
33213					block.fadeIn(function(){
33214						$(this).addClass('active');
33215						$(window).scroll();
33216					})
33217				}
33218				else
33219				{
33220					_this.closest('.items').find('> .item:eq(0)').fadeIn(function(){
33221						$(this).addClass('active');
33222						$(window).scroll();
33223					})
33224				}
33225			})
33226		}
33227	})
33228})
33229/* End */
33230;
33231; /* Start:"a:4:{s:4:"full";s:96:"/local/templates/aspro_max_local/components/bitrix/news.list/front_news/script.
33231js?16201975691749";s:6:"source";s:81:"/local/templates/aspro_max_local/components/bitrix/news.list/front_news/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
33232$(document).ready(function(){
33233	if($('.item-views.news2.half-block .item-wrapper.line_img .half-wrapper').length)
33234	{
33235		
33236		var scrollItemsType6 = function(){
33237			if(window.matchMedia('(min-width: 601px)').matches) {
33238				$('.item-views.news2.half-block .item-wrapper.line_img .half-wrapper').removeClass('destroyed').mCustomScrollbarDeferred({
33239					mouseWheel: {
33240						scrollAmount: 150,
33241						preventDefault: true
33242					}
33243				})
33244			} else {
33245				$('.item-views.news2.half-block .item-wrapper.line_img .half-wrapper').addClass('destroyed').mCustomScrollbar('destroy')
33246			}
33247		}
33248
33249		// $(window).resize(throttle(scrollItemsType6, 200))
33250		$(window).resize(debounce(scrollItemsType6, 200))
33251	}
33252
33253	var containerEl = document.querySelector('.mixitup-container');
33254	if(containerEl)
33255	{
33256		var config = {
33257			selectors:{
33258				target: '[data-ref="mixitup-target"]'
33259			},
33260			animation:{
33261				effects: 'fade scale stagger(50ms)' // Set a 'stagger' effect for the loading animation
33262			},
33263			load:{
33264				filter: 'none' // Ensure all targets start from hidden (i.e. display: none;)
33265			},
33266			animation:{
33267				duration: 350
33268			},
33269			controls:{
33270				scope: 'local'
33271			},
33272			callbacks: {
33273				onMixStart:function(state) {
33274				},
33275				onMixEnd:function() {
33276					InitLazyLoad();
33277				}
33278			}
33279		};
33280		var mixer = mixitup(containerEl, config);
33281
33282		// Add a class to the container to remove 'visibility: hidden;' from targets. This
33283	    // prevents any flickr of content before the page's JavaScript has loaded.
33284
33285	    containerEl.classList.add('mixitup-ready');
33286
33287	    // Show all targets in the container
33288
33289	    mixer.show()
33290		.then(function(){
33291			// Remove the stagger effect for any subsequent operations
33292			mixer.configure({
33293				animation: {
33294					effects: 'fade scale'
33295				}
33296			});
33297		});
33298	}
33299
33300})
33301/* End */
33302;
33303; /* Start:"a:4:{s:4:"full";s:88:"/bitrix/components/aspro/marketing.popup.max/templates/.default/script.js?16201287591756";s:6:"source";s:73:"/bitrix/components/aspro/marketing.popup.max/templates/.default/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
33304
33305function showMarketingPopup(){
33306	if($('.dyn_mp_jqm').length)
33307	{
33308		var allDelays = [];
33309		$('.dyn_mp_jqm').each(function(i, el) {
33310			var jqmBlock = $(el),
33311				delay = 0;
33312
33313			if(!jqmBlock.hasClass('initied')) // first load
33314			{
33315				jqmBlock.addClass('initied');
33316				
33317				if(jqmBlock.data('param-delay'))
33318					delay = jqmBlock.data('param-delay')*1000;
33319
33320				while(allDelays.indexOf(delay) !== -1) {
33321					delay += 1000;
33322				}
33323
33324				allDelays.push(delay);
33325
33326				if(typeof localStorage !== 'undefined')
33327				{
33328					var dataLS = localStorage.getItem(jqmBlock.data('ls')),
33329						ls = '';
33330					try{
33331						ls = JSON.parse(dataLS);
33332					}
33333					catch(e){
33334						ls = dataLS
33335					}
33336					if(!ls || (ls && (ls.TIMESTAMP < Date.now() && ls.TIMESTAMP)))
33337					{
33338						/*if (timeoutID) {
33339							clearTimeout(timeoutID);
33340						}*/
33341						timeoutID = setTimeout(function(){
33342							console.log(jqmBlock, delay)
33343							jqmBlock.click();
33344						}, delay);
33345					}
33346				}
33347				else
33348				{
33349					var ls = $.cookie(jqmBlock.data('ls'));
33350					if(!ls)
33351					{
33352						/*if (timeoutID) {
33353							clearTimeout(timeoutID);
33354						}*/
33355						timeoutID = setTimeout(function(){
33356							jqmBlock.click();
33357						}, delay);
33358					}
33359				}
33360
33361			}
33362			else // ajax popup
33363			{
33364				
33365			}
33366
33367		});
33368	}
33369}
33370
33371
33372
33373
33374$(document).ready(function(){
33375
33376	showMarketingPopup();
33377	
33378	if(typeof window.frameCacheVars !== "undefined"){
33379		BX.addCustomEvent("onFrameDataReceived", function (json){
33380			showMarketingPopup();
33381		});
33382	}
33383
33384	$(document).on('click', '.dyn_mp_jqm_frame .popup-text-info__btn .btn', function() {
33385		var closeBtn = $(this).closest('.dyn_mp_jqm_frame').find('.jqmClose');
33386
33387		if(closeBtn.length) {
33388			closeBtn.trigger('click');
33389		}
33390	});
33391})
33392
33393/* End */
33394;
33395; /* Start:"a:4:{s:4:"full";s:69:"/bitrix/components/arturgolubev/search.title/script.js?17296815099674";s:6:"source";s:54:"/bitrix/components/arturgolubev/search.title/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
33396function JCTitleSearch(arParams)
33397{
33398	var _this = this;
33399
33400	this.arParams = {
33401		'AJAX_PAGE': arParams.AJAX_PAGE,
33402		'CONTAINER_ID': arParams.CONTAINER_ID,
33403		'INPUT_ID': arParams.INPUT_ID,
33404		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
33405	};
33406	if(arParams.WAIT_IMAGE)
33407		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
33408	if(arParams.MIN_QUERY_LEN <= 0)
33409		arParams.MIN_QUERY_LEN = 1;
33410
33411	this.cache = [];
33412	this.cache_key = null;
33413
33414	this.startText = '';
33415	this.running = false;
33416	this.currentRow = -1;
33417	this.RESULT = null;
33418	this.CONTAINER = null;
33419	this.INPUT = null;
33420	this.WAIT = null;
33421
33422	this.ShowResult = function(result)
33423	{
33424		if(BX.type.isString(result))
33425		{
33426			_this.RESULT.innerHTML = result;
33427		}
33428
33429		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
33430		var pos = _this.adjustResultNode();
33431
33432		//adjust left column to be an outline
33433		var res_pos;
33434		var th;
33435		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
33436		if(tbl)
33437		{
33438			th = BX.findChild(tbl, {'tag':'th'}, true);
33439		}
33440
33441		if(th)
33442		{
33443			var tbl_pos = BX.pos(tbl);
33444			tbl_pos.width = tbl_pos.right - tbl_pos.left;
33445
33446			var th_pos = BX.pos(th);
33447			th_pos.width = th_pos.right - th_pos.left;
33448			th.style.width = th_pos.width + 'px';
33449
33450			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
33451
33452			//Move table to left by width of the first column
33453			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
33454
33455			//Shrink table when it's too wide
33456			if((tbl_pos.width - th_pos.width) > pos.width)
33457				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
33458
33459			//Check if table is too wide and shrink result div to it's width
33460			tbl_pos = BX.pos(tbl);
33461			res_pos = BX.pos(_this.RESULT);
33462			if(res_pos.right > tbl_pos.right)
33463			{
33464				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
33465			}
33466		}
33467
33468		var fade;
33469		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
33470		if(fade && th)
33471		{
33472			res_pos = BX.pos(_this.RESULT);
33473			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
33474			fade.style.width = 18 + 'px';
33475			fade.style.top = 0 + 'px';
33476			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
33477			fade.style.display = 'block';
33478		}
33479	};
33480
33481	this.onKeyPress = function(keyCode)
33482	{
33483		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
33484		if(!tbl)
33485			return false;
33486
33487		var i;
33488		var cnt = tbl.rows.length;
33489
33490		switch (keyCode)
33491		{
33492		case 27: // escape key - close search div
33493			_this.RESULT.style.display = 'none';
33494			_this.currentRow = -1;
33495			_this.UnSelectAll();
33496		return true;
33497
33498		case 40: // down key - navigate down on search results
33499			if(_this.RESULT.style.display == 'none')
33500				_this.RESULT.style.display = 'block';
33501
33502			var first = -1;
33503			for(i = 0; i < cnt; i++)
33504			{
33505				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
33506				{
33507					if(first == -1)
33508						first = i;
33509
33510					if(_this.currentRow < i)
33511					{
33512						_this.currentRow = i;
33513						break;
33514					}
33515					else if(tbl.rows[i].className == 'title-search-selected')
33516					{
33517						tbl.rows[i].className = '';
33518					}
33519				}
33520			}
33521
33522			if(i == cnt && _this.currentRow != i)
33523				_this.currentRow = first;
33524
33525			tbl.rows[_this.currentRow].className = 'title-search-selected';
33526		return true;
33527
33528		case 38: // up key - navigate up on search results
33529			if(_this.RESULT.style.display == 'none')
33530				_this.RESULT.style.display = 'block';
33531
33532			var last = -1;
33533			for(i = cnt-1; i >= 0; i--)
33534			{
33535				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
33536				{
33537					if(last == -1)
33538						last = i;
33539
33540					if(_this.currentRow > i)
33541					{
33542						_this.currentRow = i;
33543						break;
33544					}
33545					else if(tbl.rows[i].className == 'title-search-selected')
33546					{
33547						tbl.rows[i].className = '';
33548					}
33549				}
33550			}
33551
33552			if(i < 0 && _this.currentRow != i)
33553				_this.currentRow = last;
33554
33555			tbl.rows[_this.currentRow].className = 'title-search-selected';
33556		return true;
33557
33558		case 13: // enter key - choose current search result
33559			if(_this.RESULT.style.display == 'block')
33560			{
33561				for(i = 0; i < cnt; i++)
33562				{
33563					if(_this.currentRow == i)
33564					{
33565						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
33566						{
33567							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
33568							if(a)
33569							{
33570								window.location = a.href;
33571								return true;
33572							}
33573						}
33574					}
33575				}
33576			}
33577		return false;
33578		}
33579
33580		return false;
33581	};
33582
33583	this.onTimeout = function()
33584	{
33585		_this.onChange(function(){
33586			setTimeout(_this.onTimeout, 500);
33587		});
33588	};
33589
33590	this.onChange = function(callback)
33591	{
33592		if (_this.running)
33593			return;
33594		_this.running = true;
33595
33596		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
33597		{
33598			_this.oldValue = _this.INPUT.value;
33599			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
33600			{
33601				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
33602				if(_this.cache[_this.cache_key] == null)
33603				{
33604					if(_this.WAIT)
33605					{
33606						var pos = BX.pos(_this.INPUT);
33607						var height = (pos.bottom - pos.top)-2;
33608						_this.WAIT.style.top = (pos.top+1) + 'px';
33609						_this.WAIT.style.height = height + 'px';
33610						_this.WAIT.style.width = height + 'px';
33611						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
33612						_this.WAIT.style.display = 'block';
33613					}
33614
33615					BX.ajax.post(
33616						_this.arParams.AJAX_PAGE,
33617						{
33618							'ajax_call':'y',
33619							'INPUT_ID':_this.arParams.INPUT_ID,
33620							'q':_this.INPUT.value,
33621							'l':_this.arParams.MIN_QUERY_LEN
33622						},
33623						function(result)
33624						{
33625							_this.cache[_this.cache_key] = result;
33626							_this.ShowResult(result);
33627							_this.currentRow = -1;
33628							_this.EnableMouseEvents();
33629							if(_this.WAIT)
33630								_this.WAIT.style.display = 'none';
33631							if (!!callback)
33632								callback();
33633							_this.running = false;
33634						}
33635					);
33636					return;
33637				}
33638				else
33639				{
33640					_this.ShowResult(_this.cache[_this.cache_key]);
33641					_this.currentRow = -1;
33642					_this.EnableMouseEvents();
33643				}
33644			}
33645			else
33646			{
33647				_this.RESULT.style.display = 'none';
33648				_this.currentRow = -1;
33649				_this.UnSelectAll();
33650			}
33651		}
33652		if (!!callback)
33653			callback();
33654		_this.running = false;
33655	};
33656
33657	this.onScroll = function ()
33658	{
33659		if(BX.type.isElementNode(_this.RESULT)
33660			&& _this.RESULT.style.display !== "none"
33661			&& _this.RESULT.innerHTML !== ''
33662		)
33663		{
33664			_this.adjustResultNode();
33665		}
33666	};
33667
33668	this.UnSelectAll = function()
33669	{
33670		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
33671		if(tbl)
33672		{
33673			var cnt = tbl.rows.length;
33674			for(var i = 0; i < cnt; i++)
33675				tbl.rows[i].className = '';
33676		}
33677	};
33678
33679	this.EnableMouseEvents = function()
33680	{
33681		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
33682		if(tbl)
33683		{
33684			var cnt = tbl.rows.length;
33685			for(var i = 0; i < cnt; i++)
33686				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
33687				{
33688					tbl.rows[i].id = 'row_' + i;
33689					tbl.rows[i].onmouseover = function (e) {
33690						if(_this.currentRow != this.id.substr(4))
33691						{
33692							_this.UnSelectAll();
33693							this.className = 'title-search-selected';
33694							_this.currentRow = this.id.substr(4);
33695						}
33696					};
33697					tbl.rows[i].onmouseout = function (e) {
33698						this.className = '';
33699						_this.currentRow = -1;
33700					};
33701				}
33702		}
33703	};
33704
33705	this.onFocusLost = function(hide)
33706	{
33707		setTimeout(function(){_this.RESULT.style.display = 'none';}, 250);
33708	};
33709
33710	this.onFocusGain = function()
33711	{
33712		if(_this.RESULT.innerHTML.length)
33713			_this.ShowResult();
33714	};
33715
33716	this.onKeyDown = function(e)
33717	{
33718		if(!e)
33719			e = window.event;
33720
33721		if (_this.RESULT.style.display == 'block')
33722		{
33723			if(_this.onKeyPress(e.keyCode))
33724				return BX.PreventDefault(e);
33725		}
33726	};
33727
33728	this.adjustResultNode = function()
33729	{
33730		if(!(BX.type.isElementNode(_this.RESULT)
33731			&& BX.type.isElementNode(_this.CONTAINER))
33732		)
33733		{
33734			return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
33735		}
33736
33737		var pos = BX.pos(_this.CONTAINER);
33738
33739		_this.RESULT.style.position = 'absolute';
33740		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
33741		_this.RESULT.style.left = pos.left + 'px';
33742		_this.RESULT.style.width = pos.width + 'px';
33743
33744		return pos;
33745	};
33746
33747	this._onContainerLayoutChange = function()
33748	{
33749		if(BX.type.isElementNode(_this.RESULT)
33750			&& _this.RESULT.style.display !== "none"
33751			&& _this.RESULT.innerHTML !== ''
33752		)
33753		{
33754			_this.adjustResultNode();
33755		}
33756	};
33757	this.Init = function()
33758	{
33759		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
33760		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
33761
33762		this.RESULT = document.body.appendChild(document.createElement("DIV"));
33763		this.RESULT.className = 'title-search-result';
33764		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
33765		this.startText = this.oldValue = this.INPUT.value;
33766		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
33767		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
33768		this.INPUT.onkeydown = this.onKeyDown;
33769
33770		if(this.arParams.WAIT_IMAGE)
33771		{
33772			this.WAIT = document.body.appendChild(document.createElement("DIV"));
33773			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
33774			if(!BX.browser.IsIE())
33775				this.WAIT.style.backgroundRepeat = 'none';
33776			this.WAIT.style.display = 'none';
33777			this.WAIT.style.position = 'absolute';
33778			this.WAIT.style.zIndex = '1100';
33779		}
33780
33781		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
33782
33783		var fixedParent = BX.findParent(this.CONTAINER, BX.is_fixed);
33784		if(BX.type.isElementNode(fixedParent))
33785		{
33786			BX.bind(window, 'scroll', BX.throttle(this.onScroll, 100, this));
33787		}
33788	};
33789	BX.ready(function (){_this.Init(arParams)});
33790}
33791
33792/* End */
33793;
33794; /* Start:"a:4:{s:4:"full";
33794s:101:"/local/templates/aspro_max_local/components/arturgolubev/search.title/fixed/script.js?162019756910264";s:6:"source";s:85:"/local/templates/aspro_max_local/components/arturgolubev/search.title/fixed/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
33795function JCTitleSearch2(arParams)
33796{
33797	var _this = this;
33798
33799	this.arParams = {
33800		'AJAX_PAGE': arParams.AJAX_PAGE,
33801		'CONTAINER_ID': arParams.CONTAINER_ID,
33802		'INPUT_ID': arParams.INPUT_ID,
33803		'INPUT_ID_TMP': arParams.INPUT_ID_TMP,
33804		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
33805	};
33806	if(arParams.WAIT_IMAGE)
33807		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
33808	if(arParams.MIN_QUERY_LEN <= 0)
33809		arParams.MIN_QUERY_LEN = 1;
33810
33811	this.cache = [];
33812	this.cache_key = null;
33813
33814	this.startText = '';
33815	this.running = false;
33816	this.needRunAgain = false;
33817	this.currentRow = -1;
33818	this.RESULT = null;
33819	this.CONTAINER = null;
33820	this.INPUT = null;
33821	this.WAIT = null;
33822
33823	this.ShowResult = function(result)
33824	{
33825		if(BX.type.isString(result))
33826		{
33827			_this.RESULT.innerHTML = result;
33828		}
33829
33830		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
33831		var pos = _this.adjustResultNode();
33832
33833		//adjust left column to be an outline
33834		var res_pos;
33835		var th;
33836		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
33837		if(tbl)
33838		{
33839			th = BX.findChild(tbl, {'tag':'th'}, true);
33840		}
33841		if(th)
33842		{
33843			var tbl_pos = BX.pos(tbl);
33844			tbl_pos.width = tbl_pos.right - tbl_pos.left;
33845
33846			var th_pos = BX.pos(th);
33847			th_pos.width = th_pos.right - th_pos.left;
33848			th.style.width = th_pos.width + 'px';
33849
33850			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';
33851
33852			//Move table to left by width of the first column
33853			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';
33854
33855			//Shrink table when it's too wide
33856			if((tbl_pos.width - th_pos.width) > pos.width)
33857				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';
33858
33859			//Check if table is too wide and shrink result div to it's width
33860			tbl_pos = BX.pos(tbl);
33861			res_pos = BX.pos(_this.RESULT);
33862			if(res_pos.right > tbl_pos.right)
33863			{
33864				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
33865			}
33866		}
33867
33868		var fade;
33869		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
33870		if(fade && th)
33871		{
33872			res_pos = BX.pos(_this.RESULT);
33873			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
33874			fade.style.width = 18 + 'px';
33875			fade.style.top = 0 + 'px';
33876			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
33877			fade.style.display = 'block';
33878		}
33879
33880		$('.bx_searche.scrollbar').mCustomScrollbar({
33881			mouseWheel: {
33882				scrollAmount: 150,
33883				preventDefault: true
33884			}
33885		});
33886	};
33887
33888	this.onKeyPress = function(keyCode)
33889	{
33890		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
33891		if(!tbl)
33892			return false;
33893
33894		var i;
33895		var cnt = tbl.rows.length;
33896
33897		switch (keyCode)
33898		{
33899		case 27: // escape key - close search div
33900			_this.RESULT.style.display = 'none';
33901			_this.currentRow = -1;
33902			_this.UnSelectAll();
33903		return true;
33904
33905		case 40: // down key - navigate down on search results
33906			if(_this.RESULT.style.display == 'none')
33907				_this.RESULT.style.display = 'block';
33908
33909			var first = -1;
33910			for(i = 0; i < cnt; i++)
33911			{
33912				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
33913				{
33914					if(first == -1)
33915						first = i;
33916
33917					if(_this.currentRow < i)
33918					{
33919						_this.currentRow = i;
33920						break;
33921					}
33922					else if(tbl.rows[i].className == 'title-search-selected')
33923					{
33924						tbl.rows[i].className = '';
33925					}
33926				}
33927			}
33928
33929			if(i == cnt && _this.currentRow != i)
33930				_this.currentRow = first;
33931
33932			tbl.rows[_this.currentRow].className = 'title-search-selected';
33933		return true;
33934
33935		case 38: // up key - navigate up on search results
33936			if(_this.RESULT.style.display == 'none')
33937				_this.RESULT.style.display = 'block';
33938
33939			var last = -1;
33940			for(i = cnt-1; i >= 0; i--)
33941			{
33942				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
33943				{
33944					if(last == -1)
33945						last = i;
33946
33947					if(_this.currentRow > i)
33948					{
33949						_this.currentRow = i;
33950						break;
33951					}
33952					else if(tbl.rows[i].className == 'title-search-selected')
33953					{
33954						tbl.rows[i].className = '';
33955					}
33956				}
33957			}
33958
33959			if(i < 0 && _this.currentRow != i)
33960				_this.currentRow = last;
33961
33962			tbl.rows[_this.currentRow].className = 'title-search-selected';
33963		return true;
33964
33965		case 13: // enter key - choose current search result
33966			if(_this.RESULT.style.display == 'block')
33967			{
33968				for(i = 0; i < cnt; i++)
33969				{
33970					if(_this.currentRow == i)
33971					{
33972						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
33973						{
33974							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
33975							if(a)
33976							{
33977								window.location = a.href;
33978								return true;
33979							}
33980						}
33981					}
33982				}
33983			}
33984		return false;
33985		}
33986
33987		return false;
33988	};
33989
33990	this.onTimeout = function()
33991	{
33992		_this.onChange(function(){
33993			setTimeout(_this.onTimeout, 500);
33994		});
33995	};
33996
33997	this.onChange = function(callback)
33998	{
33999		if (_this.running){
34000			_this.needRunAgain = true;
34001			return;
34002		}
34003		_this.running = true;
34004
34005		if(_this.INPUT.value != _this.oldValue && _this.INPUT.value != _this.startText)
34006		{
34007			_this.oldValue = _this.INPUT.value;
34008			if(_this.INPUT.value.length >= _this.arParams.MIN_QUERY_LEN)
34009			{
34010				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
34011				if(_this.cache[_this.cache_key] == null)
34012				{
34013					if(_this.WAIT)
34014					{
34015						var pos = BX.pos(_this.INPUT);
34016						var height = (pos.bottom - pos.top)-2;
34017						_this.WAIT.style.top = (pos.top+1) + 'px';
34018						_this.WAIT.style.height = height + 'px';
34019						_this.WAIT.style.width = height + 'px';
34020						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
34021						_this.WAIT.style.display = 'block';
34022					}
34023
34024					BX.ajax.post(
34025						_this.arParams.AJAX_PAGE,
34026						{
34027							'ajax_call':'y',
34028							'INPUT_ID':_this.arParams.INPUT_ID_TMP,
34029							'q':_this.INPUT.value,
34030							'l':_this.arParams.MIN_QUERY_LEN
34031						},
34032						function(result)
34033						{
34034							_this.cache[_this.cache_key] = result;
34035							_this.ShowResult(result);
34036							_this.currentRow = -1;
34037							_this.EnableMouseEvents();
34038							if(_this.WAIT)
34039								_this.WAIT.style.display = 'none';
34040							if (!!callback)
34041								callback();
34042							_this.running = false;
34043
34044							if(_this.needRunAgain){
34045								_this.needRunAgain = false;
34046								_this.onChange(callback);
34047							}
34048						}
34049					);
34050					return;
34051				}
34052				else
34053				{
34054					_this.ShowResult(_this.cache[_this.cache_key]);
34055					_this.currentRow = -1;
34056					_this.EnableMouseEvents();
34057				}
34058			}
34059			else
34060			{
34061				_this.RESULT.style.display = 'none';
34062				_this.currentRow = -1;
34063				_this.UnSelectAll();
34064			}
34065		}
34066		if (!!callback)
34067			callback();
34068		_this.running = false;
34069	};
34070
34071	this.UnSelectAll = function()
34072	{
34073		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
34074		if(tbl)
34075		{
34076			var cnt = tbl.rows.length;
34077			for(var i = 0; i < cnt; i++)
34078				tbl.rows[i].className = '';
34079		}
34080	};
34081
34082	this.EnableMouseEvents = function()
34083	{
34084		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
34085		if(tbl)
34086		{
34087			var cnt = tbl.rows.length;
34088			for(var i = 0; i < cnt; i++)
34089				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
34090				{
34091					tbl.rows[i].id = 'row_' + i;
34092					tbl.rows[i].onmouseover = function (e) {
34093						if(_this.currentRow != this.id.substr(4))
34094						{
34095							_this.UnSelectAll();
34096							this.className = 'title-search-selected';
34097							_this.currentRow = this.id.substr(4);
34098						}
34099					};
34100					tbl.rows[i].onmouseout = function (e) {
34101						this.className = '';
34102						_this.currentRow = -1;
34103					};
34104				}
34105		}
34106	};
34107
34108	this.onFocusLost = function(hide)
34109	{
34110		setTimeout(function(){_this.RESULT.style.display = 'none';}, 300);
34111		// _this.RESULT.style.display = 'none';
34112	};
34113
34114	this.onFocusGain = function()
34115	{
34116		if(_this.RESULT.innerHTML.length)
34117			_this.ShowResult();
34118	};
34119
34120	this.onKeyDown = function(e)
34121	{
34122		if(!e)
34123			e = window.event;
34124
34125		if (_this.RESULT.style.display == 'block')
34126		{
34127			if(_this.onKeyPress(e.keyCode))
34128				return BX.PreventDefault(e);
34129		}
34130	};
34131
34132	this.adjustResultNode = function()
34133	{
34134		var pos, pos_input;
34135		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
34136		if(!!fixedParent)
34137		{
34138			_this.RESULT.style.position = 'fixed';
34139			_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
34140			pos = BX.pos(_this.CONTAINER, true);
34141		}
34142		else
34143		{
34144			_this.RESULT.style.position = 'absolute';
34145			pos = BX.pos(_this.CONTAINER);
34146		}
34147		//console.log(pos);
34148		//console.log(_this.CONTAINER);
34149		pos_input = BX.pos(_this.INPUT);
34150
34151		pos.width = pos.right - pos.left;
34152		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
34153		_this.RESULT.style.left = pos_input.left + 'px';
34154
34155		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
34156			_this.RESULT.style.width = pos_input.width + 'px';
34157		else
34158			_this.RESULT.style.width = pos.width + 'px';
34159		return pos;
34160	};
34161
34162	this._onContainerLayoutChange = function()
34163	{
34164		if(_this.RESULT.style.display !== "none" && _this.RESULT.innerHTML !== '')
34165		{
34166			_this.adjustResultNode();
34167		}
34168	};
34169	this.Init = function()
34170	{
34171		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
34172		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);
34173
34174		this.RESULT = document.body.appendChild(document.createElement("DIV"));
34175
34176		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
34177		if(this.arParams.INPUT_ID != 'title-search-input_fixed')
34178			this.RESULT.className += ' '+arMaxOptions['THEME']['TYPE_SEARCH']+'_type';
34179
34180		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
34181		this.startText = this.oldValue = this.INPUT.value;
34182		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
34183		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
34184
34185		if(BX.browser.IsSafari() || BX.browser.IsIE())
34186			this.INPUT.onkeydown = this.onKeyDown;
34187		else
34188			this.INPUT.onkeypress = this.onKeyDown;
34189
34190		if(this.arParams.WAIT_IMAGE)
34191		{
34192			this.WAIT = document.body.appendChild(document.createElement("DIV"));
34193			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
34194			if(!BX.browser.IsIE())
34195				this.WAIT.style.backgroundRepeat = 'none';
34196			this.WAIT.style.display = 'none';
34197			this.WAIT.style.position = 'absolute';
34198			this.WAIT.style.zIndex = '1100';
34199		}
34200
34201		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
34202	};
34203	BX.ready(function (){_this.Init(arParams)});
34204}
34205
34206/* End */
34207;
34208; /* Start:"a:4:{s:4:"full";s:60:"/local/templates/aspro_max_local/js/custom.js?16359414634079";s:6:"source";s:45:"/local/templates/aspro_max_local/js/custom.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
34209/*
34210You can use this file with your scripts.
34211It will not be overwritten when you upgrade solution.
34212*/
34213
34214BX.addCustomEvent('onIblockCatalogCommentSubmit', function () {
34215	if (!!window.showAuthForm && window.showAuthForm === 'Y')
34216	{
34217		//$('.personal.login a.personal-link').trigger('click');
34218		$('#auth_socserv_popup').trigger('click');
34219	}
34220});
34221
34222$(document).on('ready', function () {
34223	// ajax отправка форм
34224	$('body').on('click', '.submit-ajax-brand', function()
34225	{
34226		var _this = $(this),
34227			popupContent, frame,
34228			popupWindow,
34229			name = 'sender_subscribe';
34230
34231		var fields = {
34232			sessid: BX.bitrix_sessid()
34233		};
34234		$.each($('input,textarea', _this.parents('form')), function(i, e){
34235			fields[$(e).attr('name')] = $(e).val();
34236		});
34237		$.post(_this.parents('form').attr('action'), fields, function(data)
34238		{
34239			if (data.success === 'Y' && !!BX('brend-form'))
34240				BX('brend-form').reset();
34241
34242			$('body').find('.' + name + '_frame').remove();
34243			$('body').find('.' + name + '_trigger').remove();
34244
34245			popupContent = '<div class="form" id="'+name+'">' +
34246				'<a href="javascript:void(0);" class="close jqmClose" onclick="window.b24form = false;"><i class="svg inline  svg-inline-" aria-hidden="true"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path data-name="Rounded Rectangle 114 copy 3" class="cccls-1" d="M334.411,138l6.3,6.3a1,1,0,0,1,0,1.414,0.992,0.992,0,0,1-1.408,0l-6.3-6.306-6.3,6.306a1,1,0,0,1-1.409-1.414l6.3-6.3-6.293-6.3a1,1,0,0,1,1.409-1.414l6.3,6.3,6.3-6.3A1,1,0,0,1,340.7,131.7Z" transform="translate(-325 -130)"></path></svg></i></a>' +
34247				'<div class="form_head"><h2>' + (data.success === 'Y' ? 'Спасибо' : 'Ошибка') + '</h2></div>' +
34248				'<div class="form_body">' +
34249				'<div class="form-control">' + data.message + '</div>' +
34250				'</div>' +
34251				'</div>';
34252
34253			frame = $('<div class="' + name + '_frame popup">'+popupContent+'</div>').appendTo('#popup_iframe_wrapper');
34254			$('body #popup_iframe_wrapper').append('<div class="'+name+'_trigger"></div>');
34255
34256			$('.' + name + '_frame').jqm({
34257				trigger: '.' + name + '_trigger',
34258				onHide: function(hash)
34259				{
34260					HideOverlay();
34261					onHidejqm(name, hash);
34262				},
34263				onShow: function(hash)
34264				{
34265					ShowOverlay();
34266					onLoadjqm(name, hash);
34267				}
34268			});
34269			$('.'+name+'_trigger').click();
34270
34271		},'json');
34272
34273		return false;
34274	});
34275
34276	//возвращает картинку товара в исходное положение
34277	$(document).on('mouseleave', '.section-gallery-wrapper', function() {
34278		$(this).children().removeClass('_active');
34279		var first = $(this).children()[0];
34280		$(first).addClass('_active');
34281	});
34282
34283	$('body').on('change', '.filter-panel__view.filter-checkboxes input', function ()
34284	{
34285		window.location.href = this.value;
34286		/*var url = $(this).data('url'),
34287			name = $(this).attr('name'),
34288			params = {};
34289
34290		if ($(this).attr('checked') === 'checked')
34291		{
34292			$(this).attr('checked', false);
34293			params[name] = 0;
34294		}
34295		else
34296		{
34297			$(this).attr('checked', true);
34298			params[name] = 1;
34299		}
34300
34301		url = BX.util.add_url_param(url, params);
34302		window.location.href = url;*/
34303	});
34304});
34305
34306if (!funcDefined('oneClickBuyPred'))
34307{
34308	var oneClickBuyPred = function (elementID, iblockID, that)
34309	{
34310		var name = 'one_click_buy_pred',
34311			elementQuantity;
34312
34313		if(typeof(that) !== 'undefined'){
34314			elementQuantity = $(that).attr('data-quantity');
34315		}
34316		if(!$(that).hasClass('clicked'))
34317		{
34318			$(that).addClass('clicked');
34319			$('body').find('.'+name+'_frame').remove();
34320			$('body').find('.'+name+'_trigger').remove();
34321			$('body').append('<div class="'+name+'_frame popup"></div>');
34322			$('body').append('<div class="'+name+'_trigger"></div>');
34323			$('.'+name+'_frame').jqm({
34324				trigger: '.'+name+'_trigger',
34325				onHide: function(hash)
34326				{
34327					onHidejqm(name,hash);
34328				},
34329				toTop: false,
34330				onLoad: function(hash)
34331				{
34332					onLoadjqm(name, hash );
34333				},
34334				ajax: arNextOptions['SITE_DIR'] + 'ajax/one_click_buypred.php?ELEMENT_ID=' + elementID +
34335					'&IBLOCK_ID=' + iblockID + '&ELEMENT_QUANTITY=' + elementQuantity});
34336			$('.'+name+'_trigger').click();
34337		}
34338	}
34339}
34340/* End */
34341;; /* /local/js/allfordj.marketing/allfordj-tracker.js?17901061884949*/
34342; /* /local/templates/aspro_max_local/js/observer.js?16201975696819*/
34343; /* /local/templates/aspro_max_local/js/jquery.actual.min.js?16201975691238*/
34344; /* /local/templates/aspro_max_local/js/jqModal.js?162019756911178*/
34345; /* /local/templates/aspro_max_local/vendor/js/bootstrap.js?162019756927908*/
34346; /* /local/templates/aspro_max_local/vendor/js/jquery.appear.js?16201975693188*/
34347; /* /local/templates/aspro_max_local/vendor/js/ripple.js?16201975694702*/
34348; /* /local/templates/aspro_max_local/vendor/js/velocity/velocity.js?162019756944791*/
34349; /* /local/templates/aspro_max_local/vendor/js/velocity/velocity.ui.js?162019756913257*/
34350; /* /local/templates/aspro_max_local/vendor/js/jquery.menu-aim.js?162019756912787*/
34351; /* /local/templates/aspro_max_local/js/browser.js?1620197569996*/
34352; /* /local/templates/aspro_max_local/js/jquery.fancybox.js?1620197569160667*/
34353; /* /local/templates/aspro_max_local/js/jquery.flexslider.js?162019756959389*/
34354; /* /local/templates/aspro_max_local/js/jquery.uniform.min.js?16201975698308*/
34355;
34355 /* /local/templates/aspro_max_local/vendor/js/carousel/owl/owl.carousel.js?162019756991210*/
34356; /* /local/templates/aspro_max_local/vendor/js/moment.min.js?162019756934436*/
34357; /* /local/templates/aspro_max_local/vendor/js/sticky-sidebar.js?162019756925989*/
34358; /* /local/templates/aspro_max_local/js/jquery.validate.min.js?162019756922254*/
34359; /* /local/templates/aspro_max_local/js/aspro_animate_open_fancy.js?16201975691865*/
34360; /* /local/templates/aspro_max_local/js/jquery.inputmask.bundle.min.js?162019756970933*/
34361; /* /local/templates/aspro_max_local/js/jquery.easing.1.3.js?16201975698095*/
34362; /* /local/templates/aspro_max_local/js/equalize.min.js?1620197569588*/
34363; /* /local/templates/aspro_max_local/js/jquery.alphanumeric.js?16201975691901*/
34364; /* /local/templates/aspro_max_local/js/jquery.cookie.js?16201975693066*/
34365; /* /local/templates/aspro_max_local/js/jquery.plugin.min.js?16201975693178*/
34366; /* /local/templates/aspro_max_local/js/jquery.countdown.min.js?162019756913137*/
34367; /* /local/templates/aspro_max_local/js/jquery.countdown-ru.js?16201975691866*/
34368; /* /local/templates/aspro_max_local/js/jquery.ikSelect.js?162019756932030*/
34369; /* /local/templates/aspro_max_local/js/jquery.mobile.custom.touch.min.js?16201975697784*/
34370; /* /local/templates/aspro_max_local/js/jquery.dotdotdot.js?16201975695908*/
34371; /* /local/templates/aspro_max_local/js/rating_likes.js?162019756910797*/
34372; /* /local/templates/aspro_max_local/js/buy_services.js?16201975695654*/
34373; /* /local/templates/aspro_max_local/js/video_banner.js?162019756931815*/
34374; /* /local/templates/aspro_max_local/js/mobile.js?162019756924621*/
34375; /* /local/templates/aspro_max_local/js/jquery.mousewheel.min.js?16201975692609*/
34376; /* /local/templates/aspro_max_local/js/jquery.mCustomScrollbar.js?162019756994214*/
34377; /* /local/templates/aspro_max_local/js/scrollTabs.js?162019756912271*/
34378; /* /local/templates/aspro_max_local/js/main.js?1720157373320461*/
34379; /* /local/templates/aspro_max_local/js/blocks/blocks.js?16396301508424*/
34380; /* /bitrix/components/bitrix/search.title/script.js?177728676810573*/
34381; /* /local/templates/.default/components/bitrix/search.title/mega_menu/script.js?162019756910313*/
34382; /* /local/templates/.default/components/bitrix/menu/menu_in_burger/script.js?1620197569201*/
34383; /* /local/templates/aspro_max_local/components/bitrix/menu/top/script.js?1620197569192*/
34384; /* /local/templates/aspro_max_local/components/aspro/com.banners.max/top_big_banner_4/script.js?16201975692987*/
34385; /* /local/templates/aspro_max_local/components/bitrix/catalog.section/catalog_block_bigdata/script.js?16202785719252*/
34386; /* /bitrix/components/bitrix/catalog.item/templates/.default/script.js?168300663063917*/
34387; /* /bitrix/components/aspro/wrapper.block.max/templates/.default/script.js?16201287591125*/
34388; /* /local/templates/aspro_max_local/components/bitrix/news.list/front_news/script.js?16201975691749*/
34389; /* /bitrix/components/aspro/marketing.popup.max/templates/.default/script.js?16201287591756*/
34390; /* /bitrix/components/arturgolubev/search.title/script.js?17296815099674*/
34391; /* /local/templates/aspro_max_local/components/arturgolubev/search.title/fixed/script.js?162019756910264*/
34392; /* /local/templates/aspro_max_local/js/custom.js?16359414634079*/

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.