<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
; /* Start:"a:4:{s:4:"full";s:56:"/local/templates/aspro_max/js/observer.js?17119485506712";s:6:"source";s:41:"/local/templates/aspro_max/js/observer.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
if(
	typeof AMutationObserver === 'undefined' &amp;&amp;
	typeof MutationObserver === 'function'
){
	(function(w, d){
		"use strict";

		/* ES6 class definition */
		/*
		class AMutationObserver extends MutationObserver{
			constructor(callback){
				super(function(mutationsList, observer){
					if(
						AMutationObserver.ignore ||
						observer.paused
					){
						// ignore mutations without disconnect()
						//console.log('ignore observer callback', observer.id);
					}
					else{
						callback(mutationsList, observer);
					}
				});

				this.paused = true;
				this.id = Math.floor(Math.random() * Math.floor(1000));

				// define parent script
				try{
					eval('@');
				}
				catch(e){
					// define parent script
					if(typeof e.stack === 'string'){
						this.stack = e.stack.match(/[^\s]*:[\d]+:[\d]+[^\s]/g);
						this.stack.splice(0, 1);
						var script = this.stack[0];

						if(script.indexOf('yandex.ru/metrika') !== -1){
							this.id = 'ym';
						}
						else{
							script = script.replace(/^(.*[/])?(.*\.js)(.*)$/ig, '$2');
							this.id = script.replace(/(\.min)?\.js$/i, '');
						}
					}
				}
				finally{
					//console.log('new observer', this.id);
				}
			}

			observe(target, options){
				this.target = target;
				this.options = options;
				this.paused = false;
				if(typeof AMutationObserver.observers[this.id] === 'undefined'){
					AMutationObserver.observers[this.id] = this;
				}
				super.observe(target, options);
			}

			disconnect(){
				this.paused = true;
				super.disconnect();
			}

			takeRecords(){
				if(
					AMutationObserver.ignore ||
					this.paused
				){
					// ignore mutations without disconnect()
					//console.log('ignore observer takeRecords', this.id);
					return [];
				}
				else{
					return super.takeRecords();
				}
			}

			pause(){
				this.paused = true;
			}

			resume(){
				if(typeof this.options !== 'false'){
					this.paused = false;
				}
			}
		}
		*/

		/* ES5 class definition */
		var _AMutationObserver = /*#__PURE__*/function (_MutationObserver) {
			"use strict";

			_inheritsLoose(_AMutationObserver, _MutationObserver);

			function _AMutationObserver(callback) {
				var _this;

				_this = _MutationObserver.call(this, function (mutationsList, observer) {
					if (_AMutationObserver.ignore || observer.paused) {// ignore mutations without disconnect()
						//console.log('ignore observer callback', observer.id);
					}
					else {
						callback(mutationsList, observer);
					}
				}) || this;

				_this.paused = true;
				_this.id = Math.floor(Math.random() * Math.floor(1000));

				try {
					eval('@');
				}
				catch (e) {
					// define parent script
					if(typeof e.stack === 'string'){
						_this.stack = e.stack.match(/[^\s]*:[\d]+:[\d]+[^\s]/g);
						_this.stack.splice(0, 1);
						var script = _this.stack[0];

						if (script.indexOf('yandex.ru/metrika') !== -1) {
							_this.id = 'ym';
						}
						else {
							script = script.replace(/^(.*[/])?(.*\.js)(.*)$/ig, '$2');
							_this.id = script.replace(/(\.min)?\.js$/i, '');
						}
					}
				}
				finally {
					//console.log('new observer', _this.id);
				}

				return _this;
			}

			var _proto = _AMutationObserver.prototype;

			_proto.observe = function observe(target, options) {
				this.target = target;
				this.options = options;
				this.paused = false;

				if (typeof _AMutationObserver.observers[this.id] === 'undefined') {
					_AMutationObserver.observers[this.id] = this;
				}

				_MutationObserver.prototype.observe.call(this, target, options);
			};

			_proto.disconnect = function disconnect() {
				this.paused = true;

				_MutationObserver.prototype.disconnect.call(this);
			};

			_proto.takeRecords = function takeRecords() {
				if (_AMutationObserver.ignore || this.paused) {
					// ignore mutations without disconnect()
					//console.log('ignore observer takeRecords', this.id);
					return [];
				}
				else {
					return _MutationObserver.prototype.takeRecords.call(this);
				}
			};

			_proto.pause = function pause() {
				this.paused = true;
			};

			_proto.resume = function resume() {
				if (typeof this.options !== 'false') {
					this.paused = false;
				}
			};

			return _AMutationObserver;
		}( /*#__PURE__*/_wrapNativeSuper(MutationObserver));

		_AMutationObserver.ignore = false;
		_AMutationObserver.observers = [];
		_AMutationObserver.parent = MutationObserver;
		MutationObserver = _AMutationObserver;

		/* ES2015 Babel functions (loose) */
		function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }

		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); }

		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); }

		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; } }

		function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }

		function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

		function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
	})(window, document);
}
/* End */
;
; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_max/js/jquery.actual.min.js?17119485501238";s:6:"source";s:50:"/local/templates/aspro_max/js/jquery.actual.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/*! Copyright 2012, Ben Lin (http://dreamerslab.com/)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Version: 1.0.18
 *
 * Requires: jQuery &gt;= 1.2.3
 */
(function(a){if(typeof define==="function"&amp;&amp;define.amd){define(["jquery"],a);
}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 =&gt; The jQuery method "'+b+'" you called does not exist';
}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; ";
e=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");
d+="visibility: hidden !important; display: "+i.display+" !important; ";if(i.absolute===true){d+="position: absolute !important; ";}c.each(function(){var m=a(this);
var 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");
}else{o.attr("style",n);}});};}h();var k=/(outer)/.test(b)?e[b](i.includeMargin):e[b]();j();return k;}});}));
/* End */
;
; /* Start:"a:4:{s:4:"full";s:71:"/local/templates/aspro_max/vendor/js/jquery.bxslider.js?171141775966080";s:6:"source";s:55:"/local/templates/aspro_max/vendor/js/jquery.bxslider.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/**
 * bxSlider v4.2.12
 * Copyright 2013-2015 Steven Wanderski
 * Written while drinking Belgian ales and listening to jazz
 * Licensed under MIT (http://opensource.org/licenses/MIT)
 */

;(function($) {

  var defaults = {

    // GENERAL
    mode: 'horizontal',
    slideSelector: '',
    infiniteLoop: true,
    hideControlOnEnd: false,
    speed: 500,
    easing: null,
    slideMargin: 0,
    startSlide: 0,
    randomStart: false,
    captions: false,
    ticker: false,
    tickerHover: false,
    adaptiveHeight: false,
    adaptiveHeightSpeed: 500,
    video: false,
    useCSS: true,
    preloadImages: 'visible',
    responsive: true,
    slideZIndex: 50,
    wrapperClass: 'bx-wrapper',

    // TOUCH
    touchEnabled: true,
    swipeThreshold: 50,
    oneToOneTouch: true,
    preventDefaultSwipeX: true,
    preventDefaultSwipeY: false,

    // ACCESSIBILITY
    ariaLive: true,
    ariaHidden: true,

    // KEYBOARD
    keyboardEnabled: false,

    // PAGER
    pager: true,
    pagerType: 'full',
    pagerShortSeparator: ' / ',
    pagerSelector: null,
    buildPager: null,
    pagerCustom: null,

    // CONTROLS
    controls: true,
    nextText: 'Next',
    prevText: 'Prev',
    nextSelector: null,
    prevSelector: null,
    autoControls: false,
    startText: 'Start',
    stopText: 'Stop',
    autoControlsCombine: false,
    autoControlsSelector: null,

    // AUTO
    auto: false,
    pause: 4000,
    autoStart: true,
    autoDirection: 'next',
    stopAutoOnClick: false,
    autoHover: false,
    autoDelay: 0,
    autoSlideForOnePage: false,

    // CAROUSEL
    minSlides: 1,
    maxSlides: 1,
    moveSlides: 0,
    slideWidth: 0,
    shrinkItems: false,

    // CALLBACKS
    onSliderLoad: function() { return true; },
    onSlideBefore: function() { return true; },
    onSlideAfter: function() { return true; },
    onSlideNext: function() { return true; },
    onSlidePrev: function() { return true; },
    onSliderResize: function() { return true; },
	onAutoChange: function() { return true; } //calls when auto slides starts and stops
  };

  $.fn.bxSlider = function(options) {

    if (this.length === 0) {
      return this;
    }

    // support multiple elements
    if (this.length &gt; 1) {
      this.each(function() {
        $(this).bxSlider(options);
      });
      return this;
    }

    // create a namespace to be used throughout the plugin
    var slider = {},
    // set a reference to our slider element
    el = this,
    // get the original window dimens (thanks a lot IE)
    windowWidth = $(window).width(),
    windowHeight = $(window).height();

    // Return if slider is already initialized
    if ($(el).data('bxSlider')) { return; }

    /**
     * ===================================================================================
     * = PRIVATE FUNCTIONS
     * ===================================================================================
     */

    /**
     * Initializes namespace settings to be used throughout plugin
     */
    var init = function() {
      // Return if slider is already initialized
      if ($(el).data('bxSlider')) { return; }
      // merge user-supplied options with the defaults
      slider.settings = $.extend({}, defaults, options);
      // parse slideWidth setting
      slider.settings.slideWidth = parseInt(slider.settings.slideWidth);
      // store the original children
      slider.children = el.children(slider.settings.slideSelector);
      // check if actual number of slides is less than minSlides / maxSlides
      if (slider.children.length &lt; slider.settings.minSlides) { slider.settings.minSlides = slider.children.length; }
      if (slider.children.length &lt; slider.settings.maxSlides) { slider.settings.maxSlides = slider.children.length; }
      // if random start, set the startSlide setting to random number
      if (slider.settings.randomStart) { slider.settings.startSlide = Math.floor(Math.random() * slider.children.length); }
      // store active slide information
      slider.active = { index: slider.settings.startSlide };
      // store if the slider is in carousel mode (displaying / moving multiple slides)
      slider.carousel = slider.settings.minSlides &gt; 1 || slider.settings.maxSlides &gt; 1 ? true : false;
      // if carousel, force preloadImages = 'all'
      if (slider.carousel) { slider.settings.preloadImages = 'all'; }
      // calculate the min / max width thresholds based on min / max number of slides
      // used to setup and update carousel slides dimensions
      slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin);
      slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
      // store the current state of the slider (if currently animating, working is true)
      slider.working = false;
      // initialize the controls object
      slider.controls = {};
      // initialize an auto interval
      slider.interval = null;
      // determine which property to use for transitions
      slider.animProp = slider.settings.mode === 'vertical' ? 'top' : 'left';
      // determine if hardware acceleration can be used
      slider.usingCSS = slider.settings.useCSS &amp;&amp; slider.settings.mode !== 'fade' &amp;&amp; (function() {
        // create our test div element
        var div = document.createElement('div'),
        // css transition properties
        props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
        // test for each property
        for (var i = 0; i &lt; props.length; i++) {
          if (div.style[props[i]] !== undefined) {
            slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase();
            slider.animProp = '-' + slider.cssPrefix + '-transform';
            return true;
          }
        }
        return false;
      }());
      // if vertical mode always make maxSlides and minSlides equal
      if (slider.settings.mode === 'vertical') { slider.settings.maxSlides = slider.settings.minSlides; }
      // save original style data
      el.data('origStyle', el.attr('style'));
      el.children(slider.settings.slideSelector).each(function() {
        $(this).data('origStyle', $(this).attr('style'));
      });

      // perform all DOM / CSS modifications
      setup();
    };

    /**
     * Performs all DOM and CSS modifications
     */
    var setup = function() {
      var preloadSelector = slider.children.eq(slider.settings.startSlide); // set the default preload selector (visible)

      // wrap el in a wrapper
      el.wrap('&lt;div class="' + slider.settings.wrapperClass + '"&gt;&lt;div class="bx-viewport"&gt;&lt;/div&gt;&lt;/div&gt;');
      // store a namespace reference to .bx-viewport
      slider.viewport = el.parent();

      // add aria-live if the setting is enabled and ticker mode is disabled
      if (slider.settings.ariaLive &amp;&amp; !slider.settings.ticker) {
        slider.viewport.attr('aria-live', 'polite');
      }
      // add a loading div to display while images are loading
      slider.loader = $('&lt;div class="bx-loading" /&gt;');
      slider.viewport.prepend(slider.loader);
      // set el to a massive width, to hold any needed slides
      // also strip any margin and padding from el
      el.css({
        width: slider.settings.mode === 'horizontal' ? (slider.children.length * 1000 + 215) + '%' : 'auto',
        position: 'relative'
      });
      // if using CSS, add the easing property
      if (slider.usingCSS &amp;&amp; slider.settings.easing) {
        el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing);
      // if not using CSS and no easing value was supplied, use the default JS animation easing (swing)
      } else if (!slider.settings.easing) {
        slider.settings.easing = 'swing';
      }
      // make modifications to the viewport (.bx-viewport)
      slider.viewport.css({
        width: '100%',
        overflow: 'hidden',
        position: 'relative'
      });
      slider.viewport.parent().css({
        maxWidth: getViewportMaxWidth()
      });
      // apply css to all slider children
      slider.children.css({
        // the float attribute is a reserved word in compressors like YUI compressor and need to be quoted #48
        'float': slider.settings.mode === 'horizontal' ? 'left' : 'none',
        listStyle: 'none',
        position: 'relative'
      });
      // apply the calculated width after the float is applied to prevent scrollbar interference
      slider.children.css('width', getSlideWidth());
      // if slideMargin is supplied, add the css
      if (slider.settings.mode === 'horizontal' &amp;&amp; slider.settings.slideMargin &gt; 0) { slider.children.css('marginRight', slider.settings.slideMargin); }
      if (slider.settings.mode === 'vertical' &amp;&amp; slider.settings.slideMargin &gt; 0) { slider.children.css('marginBottom', slider.settings.slideMargin); }
      // if "fade" mode, add positioning and z-index CSS
      if (slider.settings.mode === 'fade') {
        slider.children.css({
          position: 'absolute',
          zIndex: 0,
          display: 'none'
        });
        // prepare the z-index on the showing element
        slider.children.eq(slider.settings.startSlide).css({zIndex: slider.settings.slideZIndex, display: 'block'});
      }
      // create an element to contain all slider controls (pager, start / stop, etc)
      slider.controls.el = $('&lt;div class="bx-controls" /&gt;');
      // if captions are requested, add them
      if (slider.settings.captions) { appendCaptions(); }
      // check if startSlide is last slide
      slider.active.last = slider.settings.startSlide === getPagerQty() - 1;
      // if video is true, set up the fitVids plugin
      if (slider.settings.video) { el.fitVids(); }
      if (slider.settings.preloadImages === 'all' || slider.settings.ticker) { preloadSelector = slider.children; }
      // only check for control addition if not in "ticker" mode
      if (!slider.settings.ticker) {
        // if controls are requested, add them
        if (slider.settings.controls) { appendControls(); }
        // if auto is true, and auto controls are requested, add them
        if (slider.settings.auto &amp;&amp; slider.settings.autoControls) { appendControlsAuto(); }
        // if pager is requested, add it
        if (slider.settings.pager) { appendPager(); }
        // if any control option is requested, add the controls wrapper
        if (slider.settings.controls || slider.settings.autoControls || slider.settings.pager) { slider.viewport.after(slider.controls.el); }
      // if ticker mode, do not allow a pager
      } else {
        slider.settings.pager = false;
      }
      loadElements(preloadSelector, start);
    };

    var loadElements = function(selector, callback) {
      var total = selector.find('img:not([src=""]), iframe').length,
      count = 0;
      if (total === 0) {
        callback();
        return;
      }
      selector.find('img:not([src=""]), iframe').each(function() {
        $(this).one('load error', function() {
          if (++count === total) { callback(); }
        }).each(function() {
          if (this.complete || this.src == '') { $(this).trigger('load'); }
        });
      });
    };

    /**
     * Start the slider
     */
    var start = function() {
      // if infinite loop, prepare additional slides
      if (slider.settings.infiniteLoop &amp;&amp; slider.settings.mode !== 'fade' &amp;&amp; !slider.settings.ticker) {
        var slice    = slider.settings.mode === 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides,
        sliceAppend  = slider.children.slice(0, slice).clone(true).addClass('bx-clone'),
        slicePrepend = slider.children.slice(-slice).clone(true).addClass('bx-clone');
        if (slider.settings.ariaHidden) {
          sliceAppend.attr('aria-hidden', true);
          slicePrepend.attr('aria-hidden', true);
        }
        el.append(sliceAppend).prepend(slicePrepend);
      }
      // remove the loading DOM element
      slider.loader.remove();
      // set the left / top position of "el"
      setSlidePosition();
      // if "vertical" mode, always use adaptiveHeight to prevent odd behavior
      if (slider.settings.mode === 'vertical') { slider.settings.adaptiveHeight = true; }
      // set the viewport height
      slider.viewport.height(getViewportHeight());
      // make sure everything is positioned just right (same as a window resize)
      el.redrawSlider();
      // onSliderLoad callback
      slider.settings.onSliderLoad.call(el, slider.active.index);
      // slider has been fully initialized
      slider.initialized = true;
      // bind the resize call to the window
      if (slider.settings.responsive) { $(window).bind('resize', resizeWindow); }
      // if auto is true and has more than 1 page, start the show
      if (slider.settings.auto &amp;&amp; slider.settings.autoStart &amp;&amp; (getPagerQty() &gt; 1 || slider.settings.autoSlideForOnePage)) { initAuto(); }
      // if ticker is true, start the ticker
      if (slider.settings.ticker) { initTicker(); }
      // if pager is requested, make the appropriate pager link active
      if (slider.settings.pager) { updatePagerActive(slider.settings.startSlide); }
      // check for any updates to the controls (like hideControlOnEnd updates)
      if (slider.settings.controls) { updateDirectionControls(); }
      // if touchEnabled is true, setup the touch events
      if (slider.settings.touchEnabled &amp;&amp; !slider.settings.ticker) { initTouch(); }
      // if keyboardEnabled is true, setup the keyboard events
      if (slider.settings.keyboardEnabled &amp;&amp; !slider.settings.ticker) {
        $(document).keydown(keyPress);
      }
    };

    /**
     * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value
     */
    var getViewportHeight = function() {
      var height = 0;
      // first determine which children (slides) should be used in our height calculation
      var children = $();
      // if mode is not "vertical" and adaptiveHeight is false, include all children
      if (slider.settings.mode !== 'vertical' &amp;&amp; !slider.settings.adaptiveHeight) {
        children = slider.children;
      } else {
        // if not carousel, return the single active child
        if (!slider.carousel) {
          children = slider.children.eq(slider.active.index);
        // if carousel, return a slice of children
        } else {
          // get the individual slide index
          var currentIndex = slider.settings.moveSlides === 1 ? slider.active.index : slider.active.index * getMoveBy();
          // add the current slide to the children
          children = slider.children.eq(currentIndex);
          // cycle through the remaining "showing" slides
          for (i = 1; i &lt;= slider.settings.maxSlides - 1; i++) {
            // if looped back to the start
            if (currentIndex + i &gt;= slider.children.length) {
              children = children.add(slider.children.eq(i - 1));
            } else {
              children = children.add(slider.children.eq(currentIndex + i));
            }
          }
        }
      }
      // if "vertical" mode, calculate the sum of the heights of the children
      if (slider.settings.mode === 'vertical') {
        children.each(function(index) {
          height += $(this).outerHeight();
        });
        // add user-supplied margins
        if (slider.settings.slideMargin &gt; 0) {
          height += slider.settings.slideMargin * (slider.settings.minSlides - 1);
        }
      // if not "vertical" mode, calculate the max height of the children
      } else {
        height = Math.max.apply(Math, children.map(function() {
          return $(this).outerHeight(false);
        }).get());
      }

      if (slider.viewport.css('box-sizing') === 'border-box') {
        height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom')) +
              parseFloat(slider.viewport.css('border-top-width')) + parseFloat(slider.viewport.css('border-bottom-width'));
      } else if (slider.viewport.css('box-sizing') === 'padding-box') {
        height += parseFloat(slider.viewport.css('padding-top')) + parseFloat(slider.viewport.css('padding-bottom'));
      }

      return height;
    };

    /**
     * Returns the calculated width to be used for the outer wrapper / viewport
     */
    var getViewportMaxWidth = function() {
      var width = '100%';
      if (slider.settings.slideWidth &gt; 0) {
        if (slider.settings.mode === 'horizontal') {
          width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin);
        } else {
          width = slider.settings.slideWidth;
        }
      }
      return width;
    };

    /**
     * Returns the calculated width to be applied to each slide
     */
    var getSlideWidth = function() {
      var newElWidth = slider.settings.slideWidth, // start with any user-supplied slide width
      wrapWidth      = slider.viewport.width();    // get the current viewport width
      // if slide width was not supplied, or is larger than the viewport use the viewport width
      if (slider.settings.slideWidth === 0 ||
        (slider.settings.slideWidth &gt; wrapWidth &amp;&amp; !slider.carousel) ||
        slider.settings.mode === 'vertical') {
        newElWidth = wrapWidth;
      // if carousel, use the thresholds to determine the width
      } else if (slider.settings.maxSlides &gt; 1 &amp;&amp; slider.settings.mode === 'horizontal') {
        if (wrapWidth &gt; slider.maxThreshold) {
          return newElWidth;
        } else if (wrapWidth &lt; slider.minThreshold) {
          newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides;
        } else if (slider.settings.shrinkItems) {
          newElWidth = Math.floor((wrapWidth + slider.settings.slideMargin) / (Math.ceil((wrapWidth + slider.settings.slideMargin) / (newElWidth + slider.settings.slideMargin))) - slider.settings.slideMargin);
        }
      }
      return newElWidth;
    };

    /**
     * Returns the number of slides currently visible in the viewport (includes partially visible slides)
     */
    var getNumberSlidesShowing = function() {
      var slidesShowing = 1,
      childWidth = null;
      if (slider.settings.mode === 'horizontal' &amp;&amp; slider.settings.slideWidth &gt; 0) {
        // if viewport is smaller than minThreshold, return minSlides
        if (slider.viewport.width() &lt; slider.minThreshold) {
          slidesShowing = slider.settings.minSlides;
        // if viewport is larger than maxThreshold, return maxSlides
        } else if (slider.viewport.width() &gt; slider.maxThreshold) {
          slidesShowing = slider.settings.maxSlides;
        // if viewport is between min / max thresholds, divide viewport width by first child width
        } else {
          childWidth = slider.children.first().width() + slider.settings.slideMargin;
          slidesShowing = Math.floor((slider.viewport.width() +
            slider.settings.slideMargin) / childWidth) || 1;
        }
      // if "vertical" mode, slides showing will always be minSlides
      } else if (slider.settings.mode === 'vertical') {
        slidesShowing = slider.settings.minSlides;
      }
      return slidesShowing;
    };

    /**
     * Returns the number of pages (one full viewport of slides is one "page")
     */
    var getPagerQty = function() {
      var pagerQty = 0,
      breakPoint = 0,
      counter = 0;
      // if moveSlides is specified by the user
      if (slider.settings.moveSlides &gt; 0) {
        if (slider.settings.infiniteLoop) {
          pagerQty = Math.ceil(slider.children.length / getMoveBy());
        } else {
          // when breakpoint goes above children length, counter is the number of pages
          while (breakPoint &lt; slider.children.length) {
            ++pagerQty;
            breakPoint = counter + getNumberSlidesShowing();
            counter += slider.settings.moveSlides &lt;= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing();
          }
		  return counter;
        }
      // if moveSlides is 0 (auto) divide children length by sides showing, then round up
      } else {
        pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing());
      }
      return pagerQty;
    };

    /**
     * Returns the number of individual slides by which to shift the slider
     */
    var getMoveBy = function() {
      // if moveSlides was set by the user and moveSlides is less than number of slides showing
      if (slider.settings.moveSlides &gt; 0 &amp;&amp; slider.settings.moveSlides &lt;= getNumberSlidesShowing()) {
        return slider.settings.moveSlides;
      }
      // if moveSlides is 0 (auto)
      return getNumberSlidesShowing();
    };

    /**
     * Sets the slider's (el) left or top position
     */
    var setSlidePosition = function() {
      var position, lastChild, lastShowingIndex;
      // if last slide, not infinite loop, and number of children is larger than specified maxSlides
      if (slider.children.length &gt; slider.settings.maxSlides &amp;&amp; slider.active.last &amp;&amp; !slider.settings.infiniteLoop) {
        if (slider.settings.mode === 'horizontal') {
          // get the last child's position
          lastChild = slider.children.last();
          position = lastChild.position();
          // set the left position
          setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.outerWidth())), 'reset', 0);
        } else if (slider.settings.mode === 'vertical') {
          // get the last showing index's position
          lastShowingIndex = slider.children.length - slider.settings.minSlides;
          position = slider.children.eq(lastShowingIndex).position();
          // set the top position
          setPositionProperty(-position.top, 'reset', 0);
        }
      // if not last slide
      } else {
        // get the position of the first showing slide
        position = slider.children.eq(slider.active.index * getMoveBy()).position();
        // check for last slide
        if (slider.active.index === getPagerQty() - 1) { slider.active.last = true; }
        // set the respective position
        if (position !== undefined) {
          if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
          else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
        }
      }
    };

    /**
     * Sets the el's animating property position (which in turn will sometimes animate el).
     * If using CSS, sets the transform property. If not using CSS, sets the top / left property.
     *
     * @param value (int)
     *  - the animating property's value
     *
     * @param type (string) 'slide', 'reset', 'ticker'
     *  - the type of instance for which the function is being
     *
     * @param duration (int)
     *  - the amount of time (in ms) the transition should occupy
     *
     * @param params (array) optional
     *  - an optional parameter containing any variables that need to be passed in
     */
    var setPositionProperty = function(value, type, duration, params) {
      var animateObj, propValue;
      // use CSS transform
      if (slider.usingCSS) {
        // determine the translate3d value
        propValue = slider.settings.mode === 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)';
        // add the CSS transition-duration
        el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's');
        if (type === 'slide') {
          // set the property value
          el.css(slider.animProp, propValue);
          if (duration !== 0) {
            // bind a callback method - executes when CSS transition completes
            el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
              //make sure it's the correct one
              if (!$(e.target).is(el)) { return; }
              // unbind the callback
              el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
              updateAfterSlideTransition();
            });
          } else { //duration = 0
            updateAfterSlideTransition();
          }
        } else if (type === 'reset') {
          el.css(slider.animProp, propValue);
        } else if (type === 'ticker') {
          // make the transition use 'linear'
          el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear');
          el.css(slider.animProp, propValue);
          if (duration !== 0) {
            el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(e) {
              //make sure it's the correct one
              if (!$(e.target).is(el)) { return; }
              // unbind the callback
              el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd');
              // reset the position
              setPositionProperty(params.resetValue, 'reset', 0);
              // start the loop again
              tickerLoop();
            });
          } else { //duration = 0
            setPositionProperty(params.resetValue, 'reset', 0);
            tickerLoop();
          }
        }
      // use JS animate
      } else {
        animateObj = {};
        animateObj[slider.animProp] = value;
        if (type === 'slide') {
          el.animate(animateObj, duration, slider.settings.easing, function() {
            updateAfterSlideTransition();
          });
        } else if (type === 'reset') {
          el.css(slider.animProp, value);
        } else if (type === 'ticker') {
          el.animate(animateObj, duration, 'linear', function() {
            setPositionProperty(params.resetValue, 'reset', 0);
            // run the recursive loop after animation
            tickerLoop();
          });
        }
      }
    };

    /**
     * Populates the pager with proper amount of pages
     */
    var populatePager = function() {
      var pagerHtml = '',
      linkContent = '',
      pagerQty = getPagerQty();
      // loop through each pager item
      for (var i = 0; i &lt; pagerQty; i++) {
        linkContent = '';
        // if a buildPager function is supplied, use it to get pager link value, else use index + 1
        if (slider.settings.buildPager &amp;&amp; $.isFunction(slider.settings.buildPager) || slider.settings.pagerCustom) {
          linkContent = slider.settings.buildPager(i);
          slider.pagerEl.addClass('bx-custom-pager');
        } else {
          linkContent = i + 1;
          slider.pagerEl.addClass('bx-default-pager');
        }
        // var linkContent = slider.settings.buildPager &amp;&amp; $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1;
        // add the markup to the string
        pagerHtml += '&lt;div class="bx-pager-item"&gt;&lt;a href="" data-slide-index="' + i + '" class="bx-pager-link"&gt;' + linkContent + '&lt;/a&gt;&lt;/div&gt;';
      }
      // populate the pager element with pager links
      slider.pagerEl.html(pagerHtml);
    };

    /**
     * Appends the pager to the controls element
     */
    var appendPager = function() {
      if (!slider.settings.pagerCustom) {
        // create the pager DOM element
        slider.pagerEl = $('&lt;div class="bx-pager" /&gt;');
        // if a pager selector was supplied, populate it with the pager
        if (slider.settings.pagerSelector) {
          $(slider.settings.pagerSelector).html(slider.pagerEl);
        // if no pager selector was supplied, add it after the wrapper
        } else {
          slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl);
        }
        // populate the pager
        populatePager();
      } else {
        slider.pagerEl = $(slider.settings.pagerCustom);
      }
      // assign the pager click binding
      slider.pagerEl.on('click touchend', 'a', clickPagerBind);
    };

    /**
     * Appends prev / next controls to the controls element
     */
    var appendControls = function() {
      slider.controls.next = $('&lt;a class="bx-next" href=""&gt;' + slider.settings.nextText + '&lt;/a&gt;');
      slider.controls.prev = $('&lt;a class="bx-prev" href=""&gt;' + slider.settings.prevText + '&lt;/a&gt;');
      // bind click actions to the controls
      slider.controls.next.bind('click touchend', clickNextBind);
      slider.controls.prev.bind('click touchend', clickPrevBind);
      // if nextSelector was supplied, populate it
      if (slider.settings.nextSelector) {
        $(slider.settings.nextSelector).append(slider.controls.next);
      }
      // if prevSelector was supplied, populate it
      if (slider.settings.prevSelector) {
        $(slider.settings.prevSelector).append(slider.controls.prev);
      }
      // if no custom selectors were supplied
      if (!slider.settings.nextSelector &amp;&amp; !slider.settings.prevSelector) {
        // add the controls to the DOM
        slider.controls.directionEl = $('&lt;div class="bx-controls-direction" /&gt;');
        // add the control elements to the directionEl
        slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next);
        // slider.viewport.append(slider.controls.directionEl);
        slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl);
      }
    };

    /**
     * Appends start / stop auto controls to the controls element
     */
    var appendControlsAuto = function() {
      slider.controls.start = $('&lt;div class="bx-controls-auto-item"&gt;&lt;a class="bx-start" href=""&gt;' + slider.settings.startText + '&lt;/a&gt;&lt;/div&gt;');
      slider.controls.stop = $('&lt;div class="bx-controls-auto-item"&gt;&lt;a class="bx-stop" href=""&gt;' + slider.settings.stopText + '&lt;/a&gt;&lt;/div&gt;');
      // add the controls to the DOM
      slider.controls.autoEl = $('&lt;div class="bx-controls-auto" /&gt;');
      // bind click actions to the controls
      slider.controls.autoEl.on('click', '.bx-start', clickStartBind);
      slider.controls.autoEl.on('click', '.bx-stop', clickStopBind);
      // if autoControlsCombine, insert only the "start" control
      if (slider.settings.autoControlsCombine) {
        slider.controls.autoEl.append(slider.controls.start);
      // if autoControlsCombine is false, insert both controls
      } else {
        slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop);
      }
      // if auto controls selector was supplied, populate it with the controls
      if (slider.settings.autoControlsSelector) {
        $(slider.settings.autoControlsSelector).html(slider.controls.autoEl);
      // if auto controls selector was not supplied, add it after the wrapper
      } else {
        slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl);
      }
      // update the auto controls
      updateAutoControls(slider.settings.autoStart ? 'stop' : 'start');
    };

    /**
     * Appends image captions to the DOM
     */
    var appendCaptions = function() {
      // cycle through each child
      slider.children.each(function(index) {
        // get the image title attribute
        var title = $(this).find('img:first').attr('title');
        // append the caption
        if (title !== undefined &amp;&amp; ('' + title).length) {
          $(this).append('&lt;div class="bx-caption"&gt;&lt;span&gt;' + title + '&lt;/span&gt;&lt;/div&gt;');
        }
      });
    };

    /**
     * Click next binding
     *
     * @param e (event)
     *  - DOM event object
     */
    var clickNextBind = function(e) {
      e.preventDefault();
      if (slider.controls.el.hasClass('disabled')) { return; }
      // if auto show is running, stop it
      if (slider.settings.auto &amp;&amp; slider.settings.stopAutoOnClick) { el.stopAuto(); }
      el.goToNextSlide();
    };

    /**
     * Click prev binding
     *
     * @param e (event)
     *  - DOM event object
     */
    var clickPrevBind = function(e) {
      e.preventDefault();
      if (slider.controls.el.hasClass('disabled')) { return; }
      // if auto show is running, stop it
      if (slider.settings.auto &amp;&amp; slider.settings.stopAutoOnClick) { el.stopAuto(); }
      el.goToPrevSlide();
    };

    /**
     * Click start binding
     *
     * @param e (event)
     *  - DOM event object
     */
    var clickStartBind = function(e) {
      el.startAuto();
      e.preventDefault();
    };

    /**
     * Click stop binding
     *
     * @param e (event)
     *  - DOM event object
     */
    var clickStopBind = function(e) {
      el.stopAuto();
      e.preventDefault();
    };

    /**
     * Click pager binding
     *
     * @param e (event)
     *  - DOM event object
     */
    var clickPagerBind = function(e) {
      var pagerLink, pagerIndex;
      e.preventDefault();
      if (slider.controls.el.hasClass('disabled')) {
        return;
      }
      // if auto show is running, stop it
      if (slider.settings.auto  &amp;&amp; slider.settings.stopAutoOnClick) { el.stopAuto(); }
      pagerLink = $(e.currentTarget);
      if (pagerLink.attr('data-slide-index') !== undefined) {
        pagerIndex = parseInt(pagerLink.attr('data-slide-index'));
        // if clicked pager link is not active, continue with the goToSlide call
        if (pagerIndex !== slider.active.index) { el.goToSlide(pagerIndex); }
      }
    };

    /**
     * Updates the pager links with an active class
     *
     * @param slideIndex (int)
     *  - index of slide to make active
     */
    var updatePagerActive = function(slideIndex) {
      // if "short" pager type
      var len = slider.children.length; // nb of children
      if (slider.settings.pagerType === 'short') {
        if (slider.settings.maxSlides &gt; 1) {
          len = Math.ceil(slider.children.length / slider.settings.maxSlides);
        }
        slider.pagerEl.html((slideIndex + 1) + slider.settings.pagerShortSeparator + len);
        return;
      }
      // remove all pager active classes
      slider.pagerEl.find('a').removeClass('active');
      // apply the active class for all pagers
      slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); });
    };

    /**
     * Performs needed actions after a slide transition
     */
    var updateAfterSlideTransition = function() {
      // if infinite loop is true
      if (slider.settings.infiniteLoop) {
        var position = '';
        // first slide
        if (slider.active.index === 0) {
          // set the new position
          position = slider.children.eq(0).position();
        // carousel, last slide
        } else if (slider.active.index === getPagerQty() - 1 &amp;&amp; slider.carousel) {
          position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position();
        // last slide
        } else if (slider.active.index === slider.children.length - 1) {
          position = slider.children.eq(slider.children.length - 1).position();
        }
        if (position) {
          if (slider.settings.mode === 'horizontal') { setPositionProperty(-position.left, 'reset', 0); }
          else if (slider.settings.mode === 'vertical') { setPositionProperty(-position.top, 'reset', 0); }
        }
      }
      // declare that the transition is complete
      slider.working = false;
      // onSlideAfter callback
      slider.settings.onSlideAfter.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);
    };

    /**
     * Updates the auto controls state (either active, or combined switch)
     *
     * @param state (string) "start", "stop"
     *  - the new state of the auto show
     */
    var updateAutoControls = function(state) {
      // if autoControlsCombine is true, replace the current control with the new state
      if (slider.settings.autoControlsCombine) {
        slider.controls.autoEl.html(slider.controls[state]);
      // if autoControlsCombine is false, apply the "active" class to the appropriate control
      } else {
        slider.controls.autoEl.find('a').removeClass('active');
        slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active');
      }
    };

    /**
     * Updates the direction controls (checks if either should be hidden)
     */
    var updateDirectionControls = function() {
      if (getPagerQty() === 1) {
        slider.controls.prev.addClass('disabled');
        slider.controls.next.addClass('disabled');
      } else if (!slider.settings.infiniteLoop &amp;&amp; slider.settings.hideControlOnEnd) {
        // if first slide
        if (slider.active.index === 0) {
          slider.controls.prev.addClass('disabled');
          slider.controls.next.removeClass('disabled');
        // if last slide
        } else if (slider.active.index === getPagerQty() - 1) {
          slider.controls.next.addClass('disabled');
          slider.controls.prev.removeClass('disabled');
        // if any slide in the middle
        } else {
          slider.controls.prev.removeClass('disabled');
          slider.controls.next.removeClass('disabled');
        }
      }
    };
	/* auto start and stop functions */
	var windowFocusHandler = function() { el.startAuto(); };
	var windowBlurHandler = function() { el.stopAuto(); };
    /**
     * Initializes the auto process
     */
    var initAuto = function() {
      // if autoDelay was supplied, launch the auto show using a setTimeout() call
      if (slider.settings.autoDelay &gt; 0) {
        var timeout = setTimeout(el.startAuto, slider.settings.autoDelay);
      // if autoDelay was not supplied, start the auto show normally
      } else {
        el.startAuto();

        //add focus and blur events to ensure its running if timeout gets paused
        $(window).focus(windowFocusHandler).blur(windowBlurHandler);
      }
      // if autoHover is requested
      if (slider.settings.autoHover) {
        // on el hover
        el.hover(function() {
          // if the auto show is currently playing (has an active interval)
          if (slider.interval) {
            // stop the auto show and pass true argument which will prevent control update
            el.stopAuto(true);
            // create a new autoPaused value which will be used by the relative "mouseout" event
            slider.autoPaused = true;
          }
        }, function() {
          // if the autoPaused value was created be the prior "mouseover" event
          if (slider.autoPaused) {
            // start the auto show and pass true argument which will prevent control update
            el.startAuto(true);
            // reset the autoPaused value
            slider.autoPaused = null;
          }
        });
      }
    };

    /**
     * Initializes the ticker process
     */
    var initTicker = function() {
      var startPosition = 0,
      position, transform, value, idx, ratio, property, newSpeed, totalDimens;
      // if autoDirection is "next", append a clone of the entire slider
      if (slider.settings.autoDirection === 'next') {
        el.append(slider.children.clone().addClass('bx-clone'));
      // if autoDirection is "prev", prepend a clone of the entire slider, and set the left position
      } else {
        el.prepend(slider.children.clone().addClass('bx-clone'));
        position = slider.children.first().position();
        startPosition = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
      }
      setPositionProperty(startPosition, 'reset', 0);
      // do not allow controls in ticker mode
      slider.settings.pager = false;
      slider.settings.controls = false;
      slider.settings.autoControls = false;
      // if autoHover is requested
      if (slider.settings.tickerHover) {
        if (slider.usingCSS) {
          idx = slider.settings.mode === 'horizontal' ? 4 : 5;
          slider.viewport.hover(function() {
            transform = el.css('-' + slider.cssPrefix + '-transform');
            value = parseFloat(transform.split(',')[idx]);
            setPositionProperty(value, 'reset', 0);
          }, function() {
            totalDimens = 0;
            slider.children.each(function(index) {
              totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
            });
            // calculate the speed ratio (used to determine the new speed to finish the paused animation)
            ratio = slider.settings.speed / totalDimens;
            // determine which property to use
            property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
            // calculate the new speed
            newSpeed = ratio * (totalDimens - (Math.abs(parseInt(value))));
            tickerLoop(newSpeed);
          });
        } else {
          // on el hover
          slider.viewport.hover(function() {
            el.stop();
          }, function() {
            // calculate the total width of children (used to calculate the speed ratio)
            totalDimens = 0;
            slider.children.each(function(index) {
              totalDimens += slider.settings.mode === 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true);
            });
            // calculate the speed ratio (used to determine the new speed to finish the paused animation)
            ratio = slider.settings.speed / totalDimens;
            // determine which property to use
            property = slider.settings.mode === 'horizontal' ? 'left' : 'top';
            // calculate the new speed
            newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property)))));
            tickerLoop(newSpeed);
          });
        }
      }
      // start the ticker loop
      tickerLoop();
    };

    /**
     * Runs a continuous loop, news ticker-style
     */
    var tickerLoop = function(resumeSpeed) {
      var speed = resumeSpeed ? resumeSpeed : slider.settings.speed,
      position = {left: 0, top: 0},
      reset = {left: 0, top: 0},
      animateProperty, resetValue, params;

      // if "next" animate left position to last child, then reset left to 0
      if (slider.settings.autoDirection === 'next') {
        position = el.find('.bx-clone').first().position();
      // if "prev" animate left position to 0, then reset left to first non-clone child
      } else {
        reset = slider.children.first().position();
      }
      animateProperty = slider.settings.mode === 'horizontal' ? -position.left : -position.top;
      resetValue = slider.settings.mode === 'horizontal' ? -reset.left : -reset.top;
      params = {resetValue: resetValue};
      setPositionProperty(animateProperty, 'ticker', speed, params);
    };

    /**
     * Check if el is on screen
     */
    var isOnScreen = function(el) {
      var win = $(window),
      viewport = {
        top: win.scrollTop(),
        left: win.scrollLeft()
      },
      bounds = el.offset();

      viewport.right = viewport.left + win.width();
      viewport.bottom = viewport.top + win.height();
      bounds.right = bounds.left + el.outerWidth();
      bounds.bottom = bounds.top + el.outerHeight();

      return (!(viewport.right &lt; bounds.left || viewport.left &gt; bounds.right || viewport.bottom &lt; bounds.top || viewport.top &gt; bounds.bottom));
    };

    /**
     * Initializes keyboard events
     */
    var keyPress = function(e) {
      var activeElementTag = document.activeElement.tagName.toLowerCase(),
      tagFilters = 'input|textarea',
      p = new RegExp(activeElementTag,['i']),
      result = p.exec(tagFilters);

      if (result == null &amp;&amp; isOnScreen(el)) {
        if (e.keyCode === 39) {
          clickNextBind(e);
          return false;
        } else if (e.keyCode === 37) {
          clickPrevBind(e);
          return false;
        }
      }
    };

    /**
     * Initializes touch events
     */
    var initTouch = function() {
      // initialize object to contain all touch values
      slider.touch = {
        start: {x: 0, y: 0},
        end: {x: 0, y: 0}
      };
      slider.viewport.bind('touchstart MSPointerDown pointerdown', onTouchStart);

      //for browsers that have implemented pointer events and fire a click after
      //every pointerup regardless of whether pointerup is on same screen location as pointerdown or not
      slider.viewport.on('click', '.bxslider a', function(e) {
        if (slider.viewport.hasClass('click-disabled')) {
          e.preventDefault();
          slider.viewport.removeClass('click-disabled');
        }
      });
    };

    /**
     * Event handler for "touchstart"
     *
     * @param e (event)
     *  - DOM event object
     */
    var onTouchStart = function(e) {
      //disable slider controls while user is interacting with slides to avoid slider freeze that happens on touch devices when a slide swipe happens immediately after interacting with slider controls
      slider.controls.el.addClass('disabled');

      if (slider.working) {
        e.preventDefault();
        slider.controls.el.removeClass('disabled');
      } else {
        // record the original position when touch starts
        slider.touch.originalPos = el.position();
        var orig = e.originalEvent,
        touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig];
        // record the starting touch x, y coordinates
        slider.touch.start.x = touchPoints[0].pageX;
        slider.touch.start.y = touchPoints[0].pageY;

        var chromePointerEvents = typeof PointerEvent === 'function'; if (chromePointerEvents) { if (orig.pointerId === undefined) { return; } }
        if (slider.viewport.get(0).setPointerCapture) {
          slider.pointerId = orig.pointerId;
          slider.viewport.get(0).setPointerCapture(slider.pointerId);
        }
        // bind a "touchmove" event to the viewport
        slider.viewport.bind('touchmove MSPointerMove pointermove', onTouchMove);
        // bind a "touchend" event to the viewport
        slider.viewport.bind('touchend MSPointerUp pointerup', onTouchEnd);
        slider.viewport.bind('MSPointerCancel pointercancel', onPointerCancel);
      }
    };

    /**
     * Cancel Pointer for Windows Phone
     *
     * @param e (event)
     *  - DOM event object
     */
    var onPointerCancel = function(e) {
      /* onPointerCancel handler is needed to deal with situations when a touchend
      doesn't fire after a touchstart (this happens on windows phones only) */
      setPositionProperty(slider.touch.originalPos.left, 'reset', 0);

      //remove handlers
      slider.controls.el.removeClass('disabled');
      slider.viewport.unbind('MSPointerCancel pointercancel', onPointerCancel);
      slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
      slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
      if (slider.viewport.get(0).releasePointerCapture) {
        slider.viewport.get(0).releasePointerCapture(slider.pointerId);
      }
    };

    /**
     * Event handler for "touchmove"
     *
     * @param e (event)
     *  - DOM event object
     */
    var onTouchMove = function(e) {
      var orig = e.originalEvent,
      touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
      // if scrolling on y axis, do not prevent default
      xMovement = Math.abs(touchPoints[0].pageX - slider.touch.start.x),
      yMovement = Math.abs(touchPoints[0].pageY - slider.touch.start.y),
      value = 0,
      change = 0;

      // x axis swipe
      if ((xMovement * 3) &gt; yMovement &amp;&amp; slider.settings.preventDefaultSwipeX) {
        e.preventDefault();
      // y axis swipe
      } else if ((yMovement * 3) &gt; xMovement &amp;&amp; slider.settings.preventDefaultSwipeY) {
        e.preventDefault();
      }
      if (slider.settings.mode !== 'fade' &amp;&amp; slider.settings.oneToOneTouch) {
        // if horizontal, drag along x axis
        if (slider.settings.mode === 'horizontal') {
          change = touchPoints[0].pageX - slider.touch.start.x;
          value = slider.touch.originalPos.left + change;
        // if vertical, drag along y axis
        } else {
          change = touchPoints[0].pageY - slider.touch.start.y;
          value = slider.touch.originalPos.top + change;
        }
        setPositionProperty(value, 'reset', 0);
      }
    };

    /**
     * Event handler for "touchend"
     *
     * @param e (event)
     *  - DOM event object
     */
    var onTouchEnd = function(e) {
      slider.viewport.unbind('touchmove MSPointerMove pointermove', onTouchMove);
      //enable slider controls as soon as user stops interacing with slides
      slider.controls.el.removeClass('disabled');
      var orig    = e.originalEvent,
      touchPoints = (typeof orig.changedTouches !== 'undefined') ? orig.changedTouches : [orig],
      value       = 0,
      distance    = 0;
      // record end x, y positions
      slider.touch.end.x = touchPoints[0].pageX;
      slider.touch.end.y = touchPoints[0].pageY;
      // if fade mode, check if absolute x distance clears the threshold
      if (slider.settings.mode === 'fade') {
        distance = Math.abs(slider.touch.start.x - slider.touch.end.x);
        if (distance &gt;= slider.settings.swipeThreshold) {
          if (slider.touch.start.x &gt; slider.touch.end.x) {
            el.goToNextSlide();
          } else {
            el.goToPrevSlide();
          }
          el.stopAuto();
        }
      // not fade mode
      } else {
        // calculate distance and el's animate property
        if (slider.settings.mode === 'horizontal') {
          distance = slider.touch.end.x - slider.touch.start.x;
          value = slider.touch.originalPos.left;
        } else {
          distance = slider.touch.end.y - slider.touch.start.y;
          value = slider.touch.originalPos.top;
        }
        // if not infinite loop and first / last slide, do not attempt a slide transition
        if (!slider.settings.infiniteLoop &amp;&amp; ((slider.active.index === 0 &amp;&amp; distance &gt; 0) || (slider.active.last &amp;&amp; distance &lt; 0))) {
          setPositionProperty(value, 'reset', 200);
        } else {
          // check if distance clears threshold
          if (Math.abs(distance) &gt;= slider.settings.swipeThreshold) {
            if (distance &lt; 0) {
              el.goToNextSlide();
            } else {
              el.goToPrevSlide();
            }
            el.stopAuto();
          } else {
            // el.animate(property, 200);
            setPositionProperty(value, 'reset', 200);
          }
        }
      }
      slider.viewport.unbind('touchend MSPointerUp pointerup', onTouchEnd);
      if (slider.viewport.get(0).releasePointerCapture) {
        slider.viewport.get(0).releasePointerCapture(slider.pointerId);
      }
    };

    /**
     * Window resize event callback
     */
    var resizeWindow = function(e) {
      // don't do anything if slider isn't initialized.
      if (!slider.initialized) { return; }
      // Delay if slider working.
      if (slider.working) {
        window.setTimeout(resizeWindow, 10);
      } else {
        // get the new window dimens (again, thank you IE)
        var windowWidthNew = $(window).width(),
        windowHeightNew = $(window).height();
        // make sure that it is a true window resize
        // *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements
        // are resized. Can you just die already?*
        if (windowWidth !== windowWidthNew || windowHeight !== windowHeightNew) {
          // set the new window dimens
          windowWidth = windowWidthNew;
          windowHeight = windowHeightNew;
          // update all dynamic elements
          el.redrawSlider();
          // Call user resize handler
          slider.settings.onSliderResize.call(el, slider.active.index);
        }
      }
    };

    /**
     * Adds an aria-hidden=true attribute to each element
     *
     * @param startVisibleIndex (int)
     *  - the first visible element's index
     */
    var applyAriaHiddenAttributes = function(startVisibleIndex) {
      var numberOfSlidesShowing = getNumberSlidesShowing();
      // only apply attributes if the setting is enabled and not in ticker mode
      if (slider.settings.ariaHidden &amp;&amp; !slider.settings.ticker) {
        // add aria-hidden=true to all elements
        slider.children.attr('aria-hidden', 'true');
        // get the visible elements and change to aria-hidden=false
        slider.children.slice(startVisibleIndex, startVisibleIndex + numberOfSlidesShowing).attr('aria-hidden', 'false');
      }
    };

    /**
     * Returns index according to present page range
     *
     * @param slideOndex (int)
     *  - the desired slide index
     */
    var setSlideIndex = function(slideIndex) {
      if (slideIndex &lt; 0) {
        if (slider.settings.infiniteLoop) {
          return getPagerQty() - 1;
        }else {
          //we don't go to undefined slides
          return slider.active.index;
        }
      // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop)
      } else if (slideIndex &gt;= getPagerQty()) {
        if (slider.settings.infiniteLoop) {
          return 0;
        } else {
          //we don't move to undefined pages
          return slider.active.index;
        }
      // set active index to requested slide
      } else {
        return slideIndex;
      }
    };

    /**
     * ===================================================================================
     * = PUBLIC FUNCTIONS
     * ===================================================================================
     */

    /**
     * Performs slide transition to the specified slide
     *
     * @param slideIndex (int)
     *  - the destination slide's index (zero-based)
     *
     * @param direction (string)
     *  - INTERNAL USE ONLY - the direction of travel ("prev" / "next")
     */
    el.goToSlide = function(slideIndex, direction) {
      // onSlideBefore, onSlideNext, onSlidePrev callbacks
      // Allow transition canceling based on returned value
      var performTransition = true,
      moveBy = 0,
      position = {left: 0, top: 0},
      lastChild = null,
      lastShowingIndex, eq, value, requestEl;
      // store the old index
      slider.oldIndex = slider.active.index;
      //set new index
      slider.active.index = setSlideIndex(slideIndex);

      // if plugin is currently in motion, ignore request
      if (slider.working || slider.active.index === slider.oldIndex) { return; }
      // declare that plugin is in motion
      slider.working = true;

      performTransition = slider.settings.onSlideBefore.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index);

      // If transitions canceled, reset and return
      if (typeof (performTransition) !== 'undefined' &amp;&amp; !performTransition) {
        slider.active.index = slider.oldIndex; // restore old index
        slider.working = false; // is not in motion
        return;
      }

      if (direction === 'next') {
        // Prevent canceling in future functions or lack there-of from negating previous commands to cancel
        if (!slider.settings.onSlideNext.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
          performTransition = false;
        }
      } else if (direction === 'prev') {
        // Prevent canceling in future functions or lack there-of from negating previous commands to cancel
        if (!slider.settings.onSlidePrev.call(el, slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index)) {
          performTransition = false;
        }
      }

      // check if last slide
      slider.active.last = slider.active.index &gt;= getPagerQty() - 1;
      // update the pager with active class
      if (slider.settings.pager || slider.settings.pagerCustom) { updatePagerActive(slider.active.index); }
      // // check for direction control update
      if (slider.settings.controls) { updateDirectionControls(); }
      // if slider is set to mode: "fade"
      if (slider.settings.mode === 'fade') {
        // if adaptiveHeight is true and next height is different from current height, animate to the new height
        if (slider.settings.adaptiveHeight &amp;&amp; slider.viewport.height() !== getViewportHeight()) {
          slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
        }
        // fade out the visible child and reset its z-index value
        slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0});
        // fade in the newly requested slide
        slider.children.eq(slider.active.index).css('zIndex', slider.settings.slideZIndex + 1).fadeIn(slider.settings.speed, function() {
          $(this).css('zIndex', slider.settings.slideZIndex);
          updateAfterSlideTransition();
        });
      // slider mode is not "fade"
      } else {
        // if adaptiveHeight is true and next height is different from current height, animate to the new height
        if (slider.settings.adaptiveHeight &amp;&amp; slider.viewport.height() !== getViewportHeight()) {
          slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed);
        }
        // if carousel and not infinite loop
        if (!slider.settings.infiniteLoop &amp;&amp; slider.carousel &amp;&amp; slider.active.last) {
          if (slider.settings.mode === 'horizontal') {
            // get the last child position
            lastChild = slider.children.eq(slider.children.length - 1);
            position = lastChild.position();
            // calculate the position of the last slide
            moveBy = slider.viewport.width() - lastChild.outerWidth();
          } else {
            // get last showing index position
            lastShowingIndex = slider.children.length - slider.settings.minSlides;
            position = slider.children.eq(lastShowingIndex).position();
          }
          // horizontal carousel, going previous while on first slide (infiniteLoop mode)
        } else if (slider.carousel &amp;&amp; slider.active.last &amp;&amp; direction === 'prev') {
          // get the last child position
          eq = slider.settings.moveSlides === 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides);
          lastChild = el.children('.bx-clone').eq(eq);
          position = lastChild.position();
        // if infinite loop and "Next" is clicked on the last slide
        } else if (direction === 'next' &amp;&amp; slider.active.index === 0) {
          // get the last clone position
          position = el.find('&gt; .bx-clone').eq(slider.settings.maxSlides).position();
          slider.active.last = false;
        // normal non-zero requests
        } else if (slideIndex &gt;= 0) {
          //parseInt is applied to allow floats for slides/page
          requestEl = slideIndex * parseInt(getMoveBy());
          position = slider.children.eq(requestEl).position();
        }

        /* If the position doesn't exist
         * (e.g. if you destroy the slider on a next click),
         * it doesn't throw an error.
         */
        if (typeof (position) !== 'undefined') {
          value = slider.settings.mode === 'horizontal' ? -(position.left - moveBy) : -position.top;
          // plugin values to be animated
          setPositionProperty(value, 'slide', slider.settings.speed);
        }
        slider.working = false;
      }
      if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
    };

    /**
     * Transitions to the next slide in the show
     */
    el.goToNextSlide = function() {
      // if infiniteLoop is false and last page is showing, disregard call
      if (!slider.settings.infiniteLoop &amp;&amp; slider.active.last) { return; }
	  if (slider.working == true){ return ;}
      var pagerIndex = parseInt(slider.active.index) + 1;
      el.goToSlide(pagerIndex, 'next');
    };

    /**
     * Transitions to the prev slide in the show
     */
    el.goToPrevSlide = function() {
      // if infiniteLoop is false and last page is showing, disregard call
      if (!slider.settings.infiniteLoop &amp;&amp; slider.active.index === 0) { return; }
	  if (slider.working == true){ return ;}
      var pagerIndex = parseInt(slider.active.index) - 1;
      el.goToSlide(pagerIndex, 'prev');
    };

    /**
     * Starts the auto show
     *
     * @param preventControlUpdate (boolean)
     *  - if true, auto controls state will not be updated
     */
    el.startAuto = function(preventControlUpdate) {
      // if an interval already exists, disregard call
      if (slider.interval) { return; }
      // create an interval
      slider.interval = setInterval(function() {
        if (slider.settings.autoDirection === 'next') {
          el.goToNextSlide();
        } else {
          el.goToPrevSlide();
        }
      }, slider.settings.pause);
	  //allback for when the auto rotate status changes
	  slider.settings.onAutoChange.call(el, true);
      // if auto controls are displayed and preventControlUpdate is not true
      if (slider.settings.autoControls &amp;&amp; preventControlUpdate !== true) { updateAutoControls('stop'); }
    };

    /**
     * Stops the auto show
     *
     * @param preventControlUpdate (boolean)
     *  - if true, auto controls state will not be updated
     */
    el.stopAuto = function(preventControlUpdate) {
      // if no interval exists, disregard call
      if (!slider.interval) { return; }
      // clear the interval
      clearInterval(slider.interval);
      slider.interval = null;
	  //allback for when the auto rotate status changes
	  slider.settings.onAutoChange.call(el, false);
      // if auto controls are displayed and preventControlUpdate is not true
      if (slider.settings.autoControls &amp;&amp; preventControlUpdate !== true) { updateAutoControls('start'); }
    };

    /**
     * Returns current slide index (zero-based)
     */
    el.getCurrentSlide = function() {
      return slider.active.index;
    };

    /**
     * Returns current slide element
     */
    el.getCurrentSlideElement = function() {
      return slider.children.eq(slider.active.index);
    };

    /**
     * Returns a slide element
     * @param index (int)
     *  - The index (zero-based) of the element you want returned.
     */
    el.getSlideElement = function(index) {
      return slider.children.eq(index);
    };

    /**
     * Returns number of slides in show
     */
    el.getSlideCount = function() {
      return slider.children.length;
    };

    /**
     * Return slider.working variable
     */
    el.isWorking = function() {
      return slider.working;
    };

    /**
     * Update all dynamic slider elements
     */
    el.redrawSlider = function() {
      // resize all children in ratio to new screen size
      slider.children.add(el.find('.bx-clone')).outerWidth(getSlideWidth());
      // adjust the height
      slider.viewport.css('height', getViewportHeight());
      // update the slide position
      if (!slider.settings.ticker) { setSlidePosition(); }
      // if active.last was true before the screen resize, we want
      // to keep it last no matter what screen size we end on
      if (slider.active.last) { slider.active.index = getPagerQty() - 1; }
      // if the active index (page) no longer exists due to the resize, simply set the index as last
      if (slider.active.index &gt;= getPagerQty()) { slider.active.last = true; }
      // if a pager is being displayed and a custom pager is not being used, update it
      if (slider.settings.pager &amp;&amp; !slider.settings.pagerCustom) {
        populatePager();
        updatePagerActive(slider.active.index);
      }
      if (slider.settings.ariaHidden) { applyAriaHiddenAttributes(slider.active.index * getMoveBy()); }
    };

    /**
     * Destroy the current instance of the slider (revert everything back to original state)
     */
    el.destroySlider = function() {
      // don't do anything if slider has already been destroyed
      if (!slider.initialized) { return; }
      slider.initialized = false;
      $('.bx-clone', this).remove();
      slider.children.each(function() {
        if ($(this).data('origStyle') !== undefined) {
          $(this).attr('style', $(this).data('origStyle'));
        } else {
          $(this).removeAttr('style');
        }
      });
      if ($(this).data('origStyle') !== undefined) {
        this.attr('style', $(this).data('origStyle'));
      } else {
        $(this).removeAttr('style');
      }
      $(this).unwrap().unwrap();
      if (slider.controls.el) { slider.controls.el.remove(); }
      if (slider.controls.next) { slider.controls.next.remove(); }
      if (slider.controls.prev) { slider.controls.prev.remove(); }
      if (slider.pagerEl &amp;&amp; slider.settings.controls &amp;&amp; !slider.settings.pagerCustom) { slider.pagerEl.remove(); }
      $('.bx-caption', this).remove();
      if (slider.controls.autoEl) { slider.controls.autoEl.remove(); }
      clearInterval(slider.interval);
      if (slider.settings.responsive) { $(window).unbind('resize', resizeWindow); }
      if (slider.settings.keyboardEnabled) { $(document).unbind('keydown', keyPress); }
      //remove self reference in data
      $(this).removeData('bxSlider');
	  // remove global window handlers
	  $(window).off('blur', windowBlurHandler).off('focus', windowFocusHandler);
    };

    /**
     * Reload the slider (revert all DOM changes, and re-initialize)
     */
    el.reloadSlider = function(settings) {
      if (settings !== undefined) { options = settings; }
      el.destroySlider();
      init();
      //store reference to self in order to access public functions later
      $(el).data('bxSlider', this);
    };

    init();

    $(el).data('bxSlider', this);

    // returns the current jQuery object
    return this;
  };

})(jQuery);

/* End */
;
; /* Start:"a:4:{s:4:"full";s:59:"/local/templates/aspro_max/js/jqModal.min.js?17114177462838";s:6:"source";s:40:"/local/templates/aspro_max/js/jqModal.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
(function(n){n.fn.jqm=function(o){var t=n.extend({},n.jqm.params,o);return this.each(function(){var o=n(this),i=n(this).data("jqm");i||(i={ID:u++}),o.data("jqm",n.extend(t,i)).addClass("jqm-init"),t.trigger&amp;&amp;n(this).jqmAddTrigger(t.trigger)})},n.fn.jqmAddTrigger=function(t){return this.each(function(){s(n(this),"jqmShow",t)||o("jqmAddTrigger must be called on initialized modals")})},n.fn.jqmAddClose=function(t){return this.each(function(){s(n(this),"jqmHide",t)||o("jqmAddClose must be called on initialized modals")})},n.fn.jqmShow=function(o){return this.each(function(){!this._jqmShown&amp;&amp;t(n(this),o)})},n.fn.jqmHide=function(o){return this.each(function(){this._jqmShown&amp;&amp;i(n(this),o)})};var o=function(n){window.console&amp;&amp;window.console.error&amp;&amp;window.console.error(n)},t=function(o,t){var i=o.data("jqm"),e=(t=t||window.event,parseInt(o.css("z-index")));if(void 0===i.noOverlay||void 0!==i.noOverlay&amp;&amp;!i.noOverlay){isNaN(e)&amp;&amp;(window.lastJqmZindex?window.lastJqmZindex=e=window.lastJqmZindex+2:e=3e3),window.lastJqmZindex=e;var a=n("&lt;div&gt;&lt;/div&gt;").addClass(i.overlayClass).css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":e-1,opacity:i.overlay/100});o.css("z-index",e)}else{a=n("");o.css("z-index",2999)}if(h={w:o,c:i,o:a,t:t},i.ajax){var s=i.target||o,d=i.ajax;s="string"==typeof s?n(s,o):n(s),"@"==d.substr(0,1)&amp;&amp;(d=n(t).attr(d.substring(1))),s.html(i.ajaxText).load(d,function(){i.onLoad&amp;&amp;i.onLoad.call(this,h),r(h)})}else r(h)},i=function(n,o){var t=n.data("jqm"),i=(o=o||window.event,{w:n,c:t,o:n.data("jqmv"),t:o});d(i)},e=function(o){return!o.w[0]._jqmShown&amp;&amp;(o.c.overlay&gt;0&amp;&amp;o.o.prependTo("#popup_iframe_wrapper"),o.w.show(),n.jqm.focusFunc(o.w),!0)},a=function(n){return n.w.hide()&amp;&amp;n.o&amp;&amp;n.o.remove(),!0},s=function(o,t,i){return!!o.data("jqm")&amp;&amp;n(i).each(function(){this[t]=this[t]||[],this[t].push(o)}).click(function(){var o=this;return n.each(this[t],function(n,i){i[t](o)}),!1})},r=function(o){var t=o.w,i=o.o,e=o.c;!1!==e.onShow(o)&amp;&amp;(t[0]._jqmShown=!0,e.modal?(!l[0]&amp;&amp;c("bind"),l.push(t)):t.jqmAddClose(i),e.closeClass&amp;&amp;t.jqmAddClose(n("."+e.closeClass,t)),e.toTop&amp;&amp;i&amp;&amp;t.before('&lt;span id="jqmP'+e.ID+'"&gt;&lt;/span&gt;').insertAfter(i),t.data("jqmv",i))},d=function(o){var t=o.w,i=o.o,e=o.c;!1!==e.onHide(o)&amp;&amp;(t[0]._jqmShown=!1,e.modal&amp;&amp;(l.pop(),!l[0]&amp;&amp;c("unbind")),e.toTop&amp;&amp;i&amp;&amp;n("#jqmP"+e.ID).after(t).remove())},c=function(o){n(document)[o]("keypress keydown mousedown",m)},m=function(o){var t=n(o.target).data("jqm")||n(o.target).parents(".jqm-init:first").data("jqm"),i=l[l.length-1].data("jqm");return!(!t||t.ID!=i.ID)||n.jqm.focusFunc(i)},u=0,l=[];n.jqm={params:{overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:!1,target:!1,ajaxText:"",modal:!1,toTop:!1,onShow:e,onHide:a,onLoad:!1},focusFunc:function(o){return n(":input:visible:first",o).focus(),!1}}})(jQuery);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_max/vendor/js/bootstrap.js?171141775727908";s:6:"source";s:49:"/local/templates/aspro_max/vendor/js/bootstrap.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/*!
 * Bootstrap v3.0.0
 *
 * Copyright 2013 Twitter, Inc
 * Licensed under the Apache License v2.0
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Designed and built with all the love in the world @twitter by @mdo and @fat.
 */

+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&amp;&amp;d.replace(/.*(?=#[^\s]*$)/,""));var e=a(d);b&amp;&amp;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&amp;&amp;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"&amp;&amp;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"&amp;&amp;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"&amp;&amp;c;e||d.data("bs.button",e=new b(this,f)),c=="toggle"?e.toggle():c&amp;&amp;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"&amp;&amp;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&amp;&amp;clearInterval(this.interval),this.options.interval&amp;&amp;!this.paused&amp;&amp;(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},b.prototype.getActiveIndex=function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},b.prototype.to=function(b){var c=this,d=this.getActiveIndex();if(b&gt;this.$items.length-1||b&lt;0)return;return this.sliding?this.$element.one("slid",function(){c.to(b)}):d==b?this.pause().cycle():this.slide(b&gt;d?"next":"prev",a(this.$items[b]))},b.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&amp;&amp;a.support.transition.end&amp;&amp;(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&amp;&amp;this.pause();var j=a.Event("slide.bs.carousel",{relatedTarget:e[0],direction:g});if(e.hasClass("active"))return;this.$indicators.length&amp;&amp;(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var b=a(i.$indicators.children()[i.getActiveIndex()]);b&amp;&amp;b.addClass("active")}));if(a.support.transition&amp;&amp;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&amp;&amp;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"&amp;&amp;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&amp;&amp;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"))&amp;&amp;d.replace(/.*(?=#[^\s]+$)/,"")),f=a.extend({},e.data(),c.data()),g=c.attr("data-slide-to");g&amp;&amp;(f.interval=!1),e.carousel(f),(g=c.attr("data-slide-to"))&amp;&amp;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&amp;&amp;/#/.test(c)&amp;&amp;c.replace(/.*(?=#[^\s]*$)/,""));var d=c&amp;&amp;a(c);return d&amp;&amp;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&amp;&amp;!d.closest(".navbar-nav").length&amp;&amp;a('&lt;div class="dropdown-backdrop"/&gt;').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&amp;&amp;b.keyCode==27)return b.which==27&amp;&amp;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&amp;&amp;i&gt;0&amp;&amp;i--,b.keyCode==40&amp;&amp;i&lt;h.length-1&amp;&amp;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"&amp;&amp;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&amp;&amp;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&amp;&amp;c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show(),d&amp;&amp;c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)})},b.prototype.hide=function(b){b&amp;&amp;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&amp;&amp;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&amp;&amp;!this.$element.has(a.target).length&amp;&amp;this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&amp;&amp;this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){a.which==27&amp;&amp;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&amp;&amp;this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&amp;&amp;this.options.backdrop){var e=a.support.transition&amp;&amp;d;this.$backdrop=a('&lt;div class="modal-backdrop '+d+'" /&gt;').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&amp;&amp;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&amp;&amp;this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&amp;&amp;this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&amp;&amp;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"&amp;&amp;c);f||e.data("bs.modal",f=new b(this,g)),typeof c=="string"?f[c](d):g.show&amp;&amp;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&amp;&amp;d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&amp;&amp;d},e.data(),c.data());b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&amp;&amp;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:'&lt;div class="tooltip"&gt;&lt;div class="tooltip-arrow"&gt;&lt;/div&gt;&lt;div class="tooltip-inner"&gt;&lt;/div&gt;&lt;/div&gt;',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&amp;&amp;typeof b.delay=="number"&amp;&amp;(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&amp;&amp;a.each(this._options,function(a,d){c[a]!=d&amp;&amp;(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"&amp;&amp;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"&amp;&amp;c.hide()},c.options.delay.hide)},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&amp;&amp;this.enabled){this.$element.trigger(b);if(b.isDefaultPrevented())return;var c=this.tip();this.setContent(),this.options.animation&amp;&amp;c.addClass("fade");var d=typeof this.options.placement=="function"?this.options.placement.call(this,c[0],this.$element[0]):this.options.placement,e=/\s?auto?\s?/i,f=e.test(d);f&amp;&amp;(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"&amp;&amp;g.top+g.height+i-l&gt;n?"top":d=="top"&amp;&amp;g.top-l-i&lt;0?"bottom":d=="right"&amp;&amp;g.right+h&gt;m?"left":d=="left"&amp;&amp;g.left-h&lt;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)&amp;&amp;(g=0),isNaN(h)&amp;&amp;(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"&amp;&amp;j!=f&amp;&amp;(c=!0,a.top=a.top+f-j);if(/bottom|top/.test(b)){var k=0;a.left&lt;0&amp;&amp;(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&amp;&amp;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"&amp;&amp;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&amp;&amp;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")&amp;&amp;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"&amp;&amp;c;e||d.data("bs.tooltip",e=new b(this,f)),typeof c=="string"&amp;&amp;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:'&lt;div class="popover"&gt;&lt;div class="arrow"&gt;&lt;/div&gt;&lt;h3 class="popover-title"&gt;&lt;/h3&gt;&lt;div class="popover-content"&gt;&lt;/div&gt;&lt;/div&gt;'}),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"&amp;&amp;c;e||d.data("bs.popover",e=new b(this,f)),typeof c=="string"&amp;&amp;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&amp;&amp;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("&gt; .dropdown-menu &gt; .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&amp;&amp;b.closest("li.dropdown").addClass("active"),d&amp;&amp;d()}var e=c.find("&gt; .active"),f=d&amp;&amp;a.support.transition&amp;&amp;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"&amp;&amp;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"&amp;&amp;(h=g=f),typeof g=="function"&amp;&amp;(g=f.top()),typeof h=="function"&amp;&amp;(h=f.bottom());var i=this.unpin!=null&amp;&amp;d+this.unpin&lt;=e.top?!1:h!=null&amp;&amp;e.top+this.$element.height()&gt;=c-h?"bottom":g!=null&amp;&amp;d&lt;=g?"top":!1;if(this.affixed===i)return;this.unpin&amp;&amp;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"&amp;&amp;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"&amp;&amp;c;e||d.data("bs.affix",e=new b(this,f)),typeof c=="string"&amp;&amp;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&amp;&amp;(c.offset.bottom=c.offsetBottom),c.offsetTop&amp;&amp;(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&amp;&amp;(this.$parent=a(this.options.parent)),this.options.toggle&amp;&amp;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&amp;&amp;this.$parent.find("&gt; .panel &gt; .in");if(c&amp;&amp;c.length){var d=c.data("bs.collapse");if(d&amp;&amp;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"&amp;&amp;c);e||d.data("bs.collapse",e=new b(this,f)),typeof c=="string"&amp;&amp;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"))&amp;&amp;d.replace(/.*(?=#[^\s]+$)/,""),f=a(e),g=f.data("bs.collapse"),h=g?"toggle":c.data(),i=c.attr("data-parent"),j=i&amp;&amp;a(i);if(!g||!g.transitioning)j&amp;&amp;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"))&amp;&amp;e.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li &gt; 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)&amp;&amp;a(e);return f&amp;&amp;f.length&amp;&amp;[[f[b]().top+(!a.isWindow(c.$scrollElement.get(0))&amp;&amp;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&gt;=c)return f!=(g=e.last()[0])&amp;&amp;this.activate(g);for(g=d.length;g--;)f!=e[g]&amp;&amp;a&gt;=d[g]&amp;&amp;(!d[g+1]||a&lt;=d[g+1])&amp;&amp;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&amp;&amp;(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"&amp;&amp;c;e||d.data("bs.scrollspy",e=new b(this,f)),typeof c=="string"&amp;&amp;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)
/* End */
;
; /* Start:"a:4:{s:4:"full";s:68:"/local/templates/aspro_max/vendor/js/jquery.appear.js?17114177573188";s:6:"source";s:53:"/local/templates/aspro_max/vendor/js/jquery.appear.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/*
 * jQuery.appear
 * https://github.com/bas2k/jquery.appear/
 * http://code.google.com/p/jquery-appear/
 *
 * Copyright (c) 2009 Michael Hixson
 * Copyright (c) 2012 Alexander Brovikov
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 */
(function($) {
	$.fn.appear = function(fn, options) {

		var settings = $.extend({

			//arbitrary data to pass to fn
			data: undefined,

			//call fn only on the first appear?
			one: true,

			// X &amp; Y accuracy
			accX: 0,
			accY: 0

		}, options);

		return this.each(function() {

			var t = $(this);

			//whether the element is currently visible
			t.appeared = false;

			if (!fn) {

				//trigger the custom event
				t.trigger('appear', settings.data);
				return;
			}

			var w = $(window);

			//fires the appear event when appropriate
			var check = function() {

				//is the element hidden?
				if (!t.is(':visible')) {

					//it became hidden
					t.appeared = false;
					return;
				}

				//is the element inside the visible window?
				var a = w.scrollLeft();
				var b = w.scrollTop();
				var o = t.offset();
				var x = o.left;
				var y = o.top;

				var ax = settings.accX;
				var ay = settings.accY;
				var th = t.height();
				var wh = w.height();
				var tw = t.width();
				var ww = w.width();

				if (y + th + ay &gt;= b &amp;&amp;
					y &lt;= b + wh + ay &amp;&amp;
					x + tw + ax &gt;= a &amp;&amp;
					x &lt;= a + ww + ax) {

					//trigger the custom event
					if (!t.appeared) t.trigger('appear', settings.data);

				} else {

					//it scrolled out of view
					t.appeared = false;
				}
			};

			//create a modified fn with some additional logic
			var modifiedFn = function() {

				//mark the element as visible
				t.appeared = true;

				//is this supposed to happen only once?
				if (settings.one) {

					//remove the check
					w.unbind('scroll', check);
					var i = $.inArray(check, $.fn.appear.checks);
					if (i &gt;= 0) $.fn.appear.checks.splice(i, 1);
				}

				//trigger the original fn
				fn.apply(this, arguments);
			};

			//bind the modified fn to the element
			if (settings.one) t.one('appear', settings.data, modifiedFn);
			else t.bind('appear', settings.data, modifiedFn);

			//check whenever the window scrolls
			w.scroll(check);

			//check whenever the dom changes
			$.fn.appear.checks.push(check);

			//check now
			(check)();
		});
	};

	//keep a queue of appearance checks
	$.extend($.fn.appear, {

		checks: [],
		timeout: null,

		//process the queue
		checkAll: function() {
			var length = $.fn.appear.checks.length;
			if (length &gt; 0) while (length--) ($.fn.appear.checks[length])();
		},

		//check the queue asynchronously
		run: function() {
			if ($.fn.appear.timeout) clearTimeout($.fn.appear.timeout);
			$.fn.appear.timeout = setTimeout($.fn.appear.checkAll, 20);
		}
	});

	//run checks when these methods are called
	$.each(['append', 'prepend', 'after', 'before', 'attr',
		'removeAttr', 'addClass', 'removeClass', 'toggleClass',
		'remove', 'css', 'show', 'hide'], function(i, n) {
		var old = $.fn[n];
		if (old) {
			$.fn[n] = function() {
				var r = old.apply(this, arguments);
				$.fn.appear.run();
				return r;
			}
		}
	});

})(jQuery);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_max/vendor/js/ripple.min.js?17114177571624";s:6:"source";s:46:"/local/templates/aspro_max/vendor/js/ripple.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
!function(m,i,h){m.ripple=function(t,e){var c=this,f=c.log=function(){c.defaults.debug&amp;&amp;console&amp;&amp;console.log&amp;&amp;console.log.apply(console,arguments)};c.selector=t,c.defaults={debug:!1,on:"mousedown",opacity:.4,color:"auto",multi:!1,duration:.7,rate:function(t){return t},easing:"linear"},c.defaults=m.extend({},c.defaults,e);m(i).on(c.defaults.on,c.selector,function(t){var e,i,o=m(this);if(o.addClass("has-ripple"),(i=m.extend({},c.defaults,o.data())).multi||!i.multi&amp;&amp;0===o.find(".ripple").length){if((e=m("&lt;span&gt;&lt;/span&gt;").addClass("ripple")).appendTo(o),f("Create: Ripple"),!e.height()&amp;&amp;!e.width()){var n=h.max(o.outerWidth(),o.outerHeight());e.css({height:n,width:n}),f("Set: Ripple size")}if(i.rate&amp;&amp;"function"==typeof i.rate){var a=h.round(e.width()/i.duration),l=i.rate(a),p=e.width()/l;i.duration.toFixed(2)!==p.toFixed(2)&amp;&amp;(f("Update: Ripple Duration",{from:i.duration,to:p}),i.duration=p)}var d="auto"==i.color?o.css("color"):i.color,r={animationDuration:i.duration.toString()+"s",animationTimingFunction:i.easing,background:d,opacity:i.opacity};f("Set: Ripple CSS",r),e.css(r)}i.multi||(f("Set: Ripple Element"),e=o.find(".ripple")),f("Destroy: Ripple Animation"),e.removeClass("ripple-animate");var s=t.pageX-o.offset().left-e.width()/2,u=t.pageY-o.offset().top-e.height()/2;i.multi&amp;&amp;(f("Set: Ripple animationend event"),e.one("animationend webkitAnimationEnd oanimationend MSAnimationEnd",function(){f("Note: Ripple animation ended"),f("Destroy: Ripple"),m(this).remove()})),f("Set: Ripple location"),f("Set: Ripple animation"),e.css({top:u+"px",left:s+"px"}).addClass("ripple-animate")})}}(jQuery,document,Math);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:73:"/local/templates/aspro_max/vendor/js/velocity/velocity.js?171141775644791";s:6:"source";s:57:"/local/templates/aspro_max/vendor/js/velocity/velocity.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/*! VelocityJS.org (1.5.0). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */
/*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */
!function(a){"use strict";function b(a){var b=a.length,d=c.type(a);return"function"!==d&amp;&amp;!c.isWindow(a)&amp;&amp;(!(1!==a.nodeType||!b)||("array"===d||0===b||"number"==typeof b&amp;&amp;b&gt;0&amp;&amp;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&amp;&amp;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&amp;&amp;!f.call(a,"constructor")&amp;&amp;!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&lt;f&amp;&amp;c.apply(a[e],d)!==!1;e++);else for(e in a)if(a.hasOwnProperty(e)&amp;&amp;c.apply(a[e],d)===!1)break}else if(g)for(;e&lt;f&amp;&amp;c.call(a[e],e,a[e])!==!1;e++);else for(e in a)if(a.hasOwnProperty(e)&amp;&amp;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&amp;&amp;d[f];if(b===undefined)return g;if(g&amp;&amp;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&amp;&amp;d[e];f&amp;&amp;(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&amp;&amp;(k=h,h=arguments[i]||{},i++),"object"!=typeof h&amp;&amp;"function"!==c.type(h)&amp;&amp;(h={}),i===j&amp;&amp;(h=this,i--);i&lt;j;i++)if(f=arguments[i])for(e in f)f.hasOwnProperty(e)&amp;&amp;(a=h[e],d=f[e],h!==d&amp;&amp;(k&amp;&amp;d&amp;&amp;(c.isPlainObject(d)||(b=c.isArray(d)))?(b?(b=!1,g=a&amp;&amp;c.isArray(a)?a:[]):g=a&amp;&amp;c.isPlainObject(a)?a:{},h[e]=c.extend(k,g,d)):d!==undefined&amp;&amp;(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&amp;&amp;(b(Object(a))?function(a,b){for(var c=+b.length,d=0,e=a.length;d&lt;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&amp;&amp;(f=e.shift()),f&amp;&amp;("fx"===b&amp;&amp;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&amp;&amp;"html"!==b.nodeName.toLowerCase()&amp;&amp;b.style&amp;&amp;"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&amp;&amp;(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&lt;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&amp;&amp;"object"==typeof module.exports?module.exports=a():"function"==typeof define&amp;&amp;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&lt;c;){var e=a[b];e&amp;&amp;d.push(e)}return d}function f(a){return u.isWrapped(a)?a=s.call(a):u.isNode(a)&amp;&amp;(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&amp;&amp;c.delayTimer&amp;&amp;!c.delayPaused&amp;&amp;(c.delayRemaining=c.delay-b+c.delayBegin,c.delayPaused=!0,clearTimeout(c.delayTimer.setTimeout))}function i(a,b){var c=g(a);c&amp;&amp;c.delayTimer&amp;&amp;c.delayPaused&amp;&amp;(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&lt;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&lt;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&gt;0?e=g:c=g}while(Math.abs(f)&gt;r&amp;&amp;++h&lt;s);return g}function n(b){for(var c=0,e=1,f=t-1;e!==f&amp;&amp;x[e]&lt;=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&gt;=q?k(b,h):0===i?h:m(b,c,c+u)}function o(){y=!0,a===c&amp;&amp;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&lt;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&amp;&amp;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)&amp;&amp;1===a.length?j.apply(null,a):u.isArray(a)&amp;&amp;2===a.length?z.apply(null,a.concat([b])):!(!u.isArray(a)||4!==a.length)&amp;&amp;k.apply(null,a),c===!1&amp;&amp;(c=y.Easings[y.defaults.easing]?y.defaults.easing:x),c}function m(a){if(a){var b=y.timestamp&amp;&amp;a!==!0?a:r.now(),c=y.State.calls.length;c&gt;1e4&amp;&amp;(y.State.calls=e(y.State.calls),c=y.State.calls.length);for(var f=0;f&lt;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&lt;x;w++){var z=i[w],B=z.element;if(g(B)){var D=!1;if(j.display!==d&amp;&amp;null!==j.display&amp;&amp;"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&amp;&amp;"hidden"!==j.visibility&amp;&amp;A.setPropertyValue(B,"visibility",j.visibility);for(var F in z)if(z.hasOwnProperty(F)&amp;&amp;"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&amp;&amp;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&amp;&amp;(H.rootPropertyValue=M)}var N=A.setPropertyValue(B,F,H.currentValue+(p&lt;9&amp;&amp;0===parseFloat(G)?"":H.unitType),H.rootPropertyValue,H.scrollData);A.Hooks.registered[F]&amp;&amp;(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]&amp;&amp;(D=!0)}}j.mobileHA&amp;&amp;g(B).transformCache.translate3d===d&amp;&amp;(g(B).transformCache.translate3d="(0px, 0px, 0px)",D=!0),D&amp;&amp;A.flushTransformCache(B)}}j.display!==d&amp;&amp;"none"!==j.display&amp;&amp;(y.State.calls[f][2].display=!1),j.visibility!==d&amp;&amp;"hidden"!==j.visibility&amp;&amp;(y.State.calls[f][2].visibility=!1),j.progress&amp;&amp;j.progress.call(h[1],h[1],v,Math.max(0,k+j.duration-b),k,q),1===v&amp;&amp;n(f)}}y.State.isTicking&amp;&amp;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&lt;k;j++){var l=c[j].element;b||f.loop||("none"===f.display&amp;&amp;A.setPropertyValue(l,"display",f.display),"hidden"===f.visibility&amp;&amp;A.setPropertyValue(l,"visibility",f.visibility));var m=g(l);if(f.loop!==!0&amp;&amp;(o.queue(l)[1]===d||!/\.velocityQueueEntryFlag/i.test(o.queue(l)[1]))&amp;&amp;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&amp;&amp;new RegExp("^\\("+c+"[^.]").test(e)&amp;&amp;(n=!0,delete m.transformCache[b])}),f.mobileHA&amp;&amp;(n=!0,delete m.transformCache.translate3d),n&amp;&amp;A.flushTransformCache(l),A.Values.removeClass(l,"velocity-animating")}if(!b&amp;&amp;f.complete&amp;&amp;!f.loop&amp;&amp;j===k-1)try{f.complete.call(e,e)}catch(r){setTimeout(function(){throw r},1)}h&amp;&amp;f.loop!==!0&amp;&amp;h(e),m&amp;&amp;f.loop===!0&amp;&amp;!b&amp;&amp;(o.each(m.tweensContainer,function(a,b){if(/^rotate/.test(a)&amp;&amp;(parseFloat(b.startValue)-parseFloat(b.endValue))%360==0){var c=b.startValue;b.startValue=b.endValue,b.endValue=c}/^backgroundPosition/.test(a)&amp;&amp;100===parseFloat(b.endValue)&amp;&amp;"%"===b.unitType&amp;&amp;(b.endValue=0,b.startValue=100)}),y(l,"reverse",{loop:!0,delay:f.delay})),f.queue!==!1&amp;&amp;o.dequeue(l,f.queue)}y.State.calls[a]=!1;for(var p=0,q=y.State.calls.length;p&lt;q;p++)if(y.State.calls[p]!==!1){i=!0;break}i===!1&amp;&amp;(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&gt;4;a--){var b=c.createElement("div");if(b.innerHTML="&lt;!--[if IE "+a+"]&gt;&lt;span&gt;&lt;/span&gt;&lt;![endif]--&gt;",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&amp;&amp;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&amp;&amp;(b=0),"number"!=typeof c&amp;&amp;(c=d),this.slice)return a.call(this,b,c);var e,f=[],g=b&gt;=0?b:Math.max(0,d+b),h=c&lt;0?d+c:Math.min(c,d),i=h-g;if(i&gt;0)if(f=new Array(i),this.charAt)for(e=0;e&lt;i;e++)f[e]=this.charAt(g+e);else for(e=0;e&lt;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)&gt;=0}:function(a,b){for(var c=0;c&lt;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&amp;&amp;a.nodeType},isWrapped:function(a){return a&amp;&amp;a!==b&amp;&amp;u.isNumber(a.length)&amp;&amp;!u.isString(a)&amp;&amp;!u.isFunction(a)&amp;&amp;!u.isNode(a)&amp;&amp;(0===a.length||u.isNode(a[0]))},isSVG:function(a){return b.SVGElement&amp;&amp;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&amp;&amp;a.fn.jquery?(o=a,v=!0):o=b.Velocity.Utilities,p&lt;=8&amp;&amp;!v)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(p&lt;=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&amp;&amp;(c[2].queue!==a||c[2].queue===!1))return!0;c[5]={resume:!1}}}),o.each(y.State.delayedElements,function(a,c){c&amp;&amp;h(c,b)})},resumeAll:function(a){var b=(new Date).getTime();o.each(y.State.calls,function(b,c){if(c){if(a!==d&amp;&amp;(c[2].queue!==a||c[2].queue===!1))return!0;c[5]&amp;&amp;(c[5].resume=!0)}}),o.each(y.State.delayedElements,function(a,c){c&amp;&amp;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)&gt;1e-4&amp;&amp;Math.abs(h.v)&gt;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&lt;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]&amp;&amp;(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&amp;&amp;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)&amp;&amp;(b=b.match(A.RegEx.valueUnwrap)[1]),A.Values.isCSSNullValue(b)&amp;&amp;(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&amp;&amp;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&lt;=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)&gt;=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&lt;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&amp;&amp;!(p&gt;9)||y.State.isGingerbread||(A.Lists.transformsBase=A.Lists.transformsBase.concat(A.Lists.transforms3D));for(var c=0;c&lt;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&amp;&amp;g(c).transformCache[a]===d&amp;&amp;e&lt;1&amp;&amp;(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&lt;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&gt;8)&amp;&amp;3===f.split(" ").length&amp;&amp;(f+=" 1"),f;case"inject":return/^rgb/.test(e)?e:(p&lt;=8?4===e.split(" ").length&amp;&amp;(e=e.split(/\s+/).slice(0,3).join(" ")):3===e.split(" ").length&amp;&amp;(e+=" 1"),(p&lt;=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&amp;&amp;!y.State.isChrome)&amp;&amp;(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&lt;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&amp;&amp;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&lt;=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&lt;=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&lt;=8)e=o.css(a,c);else{var i=!1;/^(width|height)$/.test(c)&amp;&amp;0===A.getPropertyValue(a,"display")&amp;&amp;(i=!0,A.setPropertyValue(a,"display",A.Values.getDisplayType(a)));var j=function(){i&amp;&amp;A.setPropertyValue(a,"display","none")};if(!f){if("height"===c&amp;&amp;"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&amp;&amp;"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&amp;&amp;(c="borderTopColor"),e=9===p&amp;&amp;"filter"===c?m.getPropertyValue(c):m[c],""!==e&amp;&amp;null!==e||(e=a.style[c]),j()}if("auto"===e&amp;&amp;/^(top|right|bottom|left)$/i.test(c)){var n=h(a,"position");("fixed"===n||"absolute"===n&amp;&amp;/top|left/i.test(c))&amp;&amp;(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&amp;&amp;(e=A.getPropertyValue(a,A.Names.prefixCheck(k)[0])),A.Normalizations.registered[k]&amp;&amp;(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&amp;&amp;(m=h(a,A.Names.prefixCheck(l)[0]),A.Values.isCSSNullValue(m)&amp;&amp;A.Hooks.templates[c]&amp;&amp;(m=A.Hooks.templates[c][1])),i=A.Normalizations.registered[c]("extract",a,m)}if(!/^[\d-]/.test(i)){var n=g(a);if(n&amp;&amp;n.isSVG&amp;&amp;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)&amp;&amp;(i=0),y.debug&gt;=2&amp;&amp;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]&amp;&amp;"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]&amp;&amp;(d=A.Normalizations.registered[c]("inject",a,d),c=A.Normalizations.registered[c]("name",a)),h=A.Names.prefixCheck(c)[0],p&lt;=8)try{a.style[h]=d}catch(l){y.debug&amp;&amp;console.log("Browser does not support ["+d+"] for ["+h+"]")}else{var k=g(a);k&amp;&amp;k.isSVG&amp;&amp;A.Names.SVGAttribute(c)?a.setAttribute(c,d):a.style[h]=d}y.debug&gt;=2&amp;&amp;console.log("Set "+c+" ("+h+"): "+d)}return[h,d]},flushTransformCache:function(a){var b="",c=g(a);if((p||y.State.isAndroid&amp;&amp;!y.State.isChrome)&amp;&amp;c&amp;&amp;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)&amp;&amp;(a="rotate"),e[a]&amp;&amp;(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&amp;&amp;"rotateZ"===c&amp;&amp;(c="rotate"),b+=c+f+" "}),h&amp;&amp;(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&amp;&amp;y.init(f),c===d)e===d&amp;&amp;(e=A.getPropertyValue(f,b));else{var h=A.setPropertyValue(f,b,c);"transform"===h[0]&amp;&amp;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&amp;&amp;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&amp;&amp;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&amp;&amp;(k.opts.display="auto"),"hidden"===k.opts.visibility&amp;&amp;(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)&amp;&amp;"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&amp;&amp;console.log("reverse tweensContainer ("+E+"): "+JSON.stringify(n[E]),a)}j=n}else if("start"===G){k=g(a),k&amp;&amp;k.tweensContainer&amp;&amp;k.isAnimating===!0&amp;&amp;(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]
;if(!(k&amp;&amp;k.isSVG||"tween"===l||A.Names.prefixCheck(l)[1]!==!1||A.Normalizations.registered[l]!==d))return void(y.debug&amp;&amp;console.log("Skipping ["+l+"] due to a lack of browser support."));(i.display!==d&amp;&amp;null!==i.display&amp;&amp;"none"!==i.display||i.visibility!==d&amp;&amp;"hidden"!==i.visibility)&amp;&amp;/opacity|filter/.test(e)&amp;&amp;!r&amp;&amp;0!==p&amp;&amp;(r=0),i._cacheValues&amp;&amp;n&amp;&amp;n[e]?(r===d&amp;&amp;(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&amp;&amp;(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&amp;&amp;u.isString(r)&amp;&amp;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&lt;r.length&amp;&amp;B&lt;p.length;){var H=r[z],I=p[B];if(/[\d\.-]/.test(H)&amp;&amp;/[\d\.-]/.test(I)){for(var J=H,K=I,L=".",N=".";++z&lt;r.length;){if((H=r[z])===L)L="..";else if(!/\d/.test(H))break;J+=H}for(;++B&lt;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&lt;5?"calc":"")+"("+(Q?"{"+C.length+(F?"!":"")+"}":"0")+O+" + "+(R?"{"+(C.length+(Q?1:0))+(F?"!":"")+"}":"0")+P+")",Q&amp;&amp;(C.push(Q),D.push(0)),R&amp;&amp;(C.push(0),D.push(R))}}else{if(H!==I){E=0;break}g+=H,z++,B++,0===E&amp;&amp;"c"===H||1===E&amp;&amp;"a"===H||2===E&amp;&amp;"l"===H||3===E&amp;&amp;"c"===H||E&gt;=4&amp;&amp;"("===H?E++:(E&amp;&amp;E&lt;5||E&gt;=4&amp;&amp;")"===H&amp;&amp;--E&lt;5)&amp;&amp;(E=0),0===F&amp;&amp;"r"===H||1===F&amp;&amp;"g"===H||2===F&amp;&amp;"b"===H||3===F&amp;&amp;"a"===H||F&gt;=3&amp;&amp;"("===H?(3===F&amp;&amp;"a"===H&amp;&amp;(G=1),F++):G&amp;&amp;","===H?++G&gt;3&amp;&amp;(F=G=0):(G&amp;&amp;F&lt;(G?5:4)||F&gt;=(G?4:3)&amp;&amp;")"===H&amp;&amp;--F&lt;(G?5:4))&amp;&amp;(F=G=0)}}z===r.length&amp;&amp;B===p.length||(y.debug&amp;&amp;console.error('Trying to pattern match mis-matched strings ["'+p+'", "'+r+'"]'),g=d),g&amp;&amp;(C.length?(y.debug&amp;&amp;console.log('Pattern found "'+g+'" -&gt; ',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&amp;&amp;(/^(fontSize|lineHeight)$/.test(e)?(p/=100,t="em"):/^scale/.test(e)?(p/=100,t=""):/(Red|Green|Blue)$/i.test(e)&amp;&amp;(p=p/100*255,t="")));if(/[\/*]/.test(w))t=v;else if(v!==t&amp;&amp;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&amp;&amp;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&amp;&amp;e)g.emToPx=M.lastEmToPx,g.percentToPxWidth=M.lastPercentToPxWidth,g.percentToPxHeight=M.lastPercentToPxHeight;else{var h=k&amp;&amp;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&amp;&amp;(M.remToPx=parseFloat(A.getPropertyValue(c.body,"fontSize"))||16),null===M.vwToPx&amp;&amp;(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&gt;=1&amp;&amp;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&amp;&amp;(j[e].pattern=g),y.debug&amp;&amp;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)&amp;&amp;(b=b.call(a,e,C)),u.isArray(b)?(d=b[0],!u.isArray(b[1])&amp;&amp;/^[\d-]/.test(b[1])||u.isFunction(b[1])||A.RegEx.isHex.test(b[1])?g=b[1]:u.isString(b[1])&amp;&amp;!A.RegEx.isHex.test(b[1])&amp;&amp;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)&amp;&amp;(d=d.call(a,e,C)),u.isFunction(g)&amp;&amp;(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&lt;Q.length;T++){var U=[R[T]];O&amp;&amp;U.push(O),S!==d&amp;&amp;U.push(S[T]),H(J+Q[T],U)}continue}}H(J,K)}j.element=a}j.element&amp;&amp;(A.Values.addClass(a,"velocity-animating"),N.push(j),k=g(a),k&amp;&amp;(""===i.queue&amp;&amp;(k.tweensContainer=j,k.opts=i),k.isAnimating=!0),D===C-1?(y.State.calls.push([N,r,i,null,z.resolver,null,0]),y.State.isTicking===!1&amp;&amp;(y.State.isTicking=!0,m())):D++)}var h,i=o.extend({},y.defaults,v),j={};switch(g(a)===d&amp;&amp;y.init(a),parseFloat(i.delay)&amp;&amp;i.queue!==!1&amp;&amp;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&amp;&amp;(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&amp;&amp;!u.isFunction(i.begin)&amp;&amp;(i.begin=null),i.progress&amp;&amp;!u.isFunction(i.progress)&amp;&amp;(i.progress=null),i.complete&amp;&amp;!u.isFunction(i.complete)&amp;&amp;(i.complete=null),i.display!==d&amp;&amp;null!==i.display&amp;&amp;(i.display=i.display.toString().toLowerCase(),"auto"===i.display&amp;&amp;(i.display=y.CSS.Values.getDisplayType(a))),i.visibility!==d&amp;&amp;null!==i.visibility&amp;&amp;(i.visibility=i.visibility.toString().toLowerCase()),i.mobileHA=i.mobileHA&amp;&amp;y.State.isMobile&amp;&amp;!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&amp;&amp;z.resolver(r),!0;y.velocityQueueEntryFlag=!0,f(a)});""!==i.queue&amp;&amp;"fx"!==i.queue||"inprogress"===o.queue(a)[0]||o.dequeue(a)}var j,k,p,q,r,s,v,x=arguments[0]&amp;&amp;(arguments[0].p||o.isPlainObject(arguments[0].properties)&amp;&amp;!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&amp;&amp;y.Promise&amp;&amp;(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&amp;&amp;(s&amp;&amp;v&amp;&amp;v.promiseRejectEmpty===!1?z.resolver():z.rejecter()));var C=r.length,D=0;if(!/^(stop|finish|finishAll|pause|resume)$/i.test(s)&amp;&amp;!o.isPlainObject(v)){var E=q+1;v={};for(var F=E;F&lt;arguments.length;F++)u.isArray(arguments[F])||!/^(fast|normal|slow)$/i.test(arguments[F])&amp;&amp;!/^\d/.test(arguments[F])?u.isString(arguments[F])||u.isArray(arguments[F])?v.easing=arguments[F]:u.isFunction(arguments[F])&amp;&amp;(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&amp;&amp;o.each(b[1],function(a,e){var f=v===d?"":v;return f!==!0&amp;&amp;b[2].queue!==f&amp;&amp;(v!==d||b[2].queue!==!1)||(o.each(r,function(a,d){if(d===e)return b[5]={resume:!1},c=!0,!1}),!c&amp;&amp;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&amp;&amp;o.each(b[1],function(a,e){var f=v===d?"":v;return f!==!0&amp;&amp;b[2].queue!==f&amp;&amp;(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&amp;&amp;void 0))})}),a();case"finish":case"finishAll":case"stop":o.each(r,function(a,b){g(b)&amp;&amp;g(b).delayTimer&amp;&amp;(clearTimeout(g(b).delayTimer.setTimeout),g(b).delayTimer.next&amp;&amp;g(b).delayTimer.next(),delete g(b).delayTimer),"finishAll"!==s||v!==!0&amp;&amp;!u.isString(v)||(o.each(o.queue(b,u.isString(v)?v:""),function(a,b){u.isFunction(b)&amp;&amp;b()}),o.queue(b,u.isString(v)?v:"",[]))});var I=[];return o.each(y.State.calls,function(a,b){b&amp;&amp;o.each(b[1],function(c,e){var f=v===d?"":v;if(f!==!0&amp;&amp;b[2].queue!==f&amp;&amp;(v!==d||b[2].queue!==!1))return!0;o.each(r,function(c,d){if(d===e)if((v===!0||u.isString(v))&amp;&amp;(o.each(o.queue(d,u.isString(v)?v:""),function(a,b){u.isFunction(b)&amp;&amp;b(null,!0)}),o.queue(d,u.isString(v)?v:"",[])),"stop"===s){var h=g(d);h&amp;&amp;h.tweensContainer&amp;&amp;f!==!1&amp;&amp;o.each(h.tweensContainer,function(a,b){b.endValue=b.currentValue}),I.push(a)}else"finish"!==s&amp;&amp;"finishAll"!==s||(b[2].duration=1)})})}),"stop"===s&amp;&amp;(o.each(I,function(a,b){n(b,!0)}),z.promise&amp;&amp;z.resolver(r)),a();default:if(!o.isPlainObject(s)||u.isEmptyObject(s)){if(u.isString(s)&amp;&amp;y.Redirects[s]){j=o.extend({},v);var J=j.duration,K=j.delay||0;return j.backwards===!0&amp;&amp;(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)&amp;&amp;(j.delay=K+j.stagger.call(b,a,C)),j.drag&amp;&amp;(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&amp;&amp;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)&amp;&amp;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&lt;O;P++){var Q={delay:j.delay,progress:j.progress};P===O-1&amp;&amp;(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&amp;&amp;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&amp;&amp;(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&amp;&amp;(i.display="Down"===b?"inline"===y.CSS.Values.getDisplayType(a)?"inline-block":"block":"none"),i.begin=function(){0===e&amp;&amp;j&amp;&amp;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)&amp;&amp;(a.style[b]=l[b]);e===f-1&amp;&amp;(k&amp;&amp;k.call(g,g),h&amp;&amp;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&amp;&amp;(i.begin=null),i.complete=e!==f-1?null:function(){j&amp;&amp;j.call(g,g),h&amp;&amp;h.resolver(g)},i.display===d&amp;&amp;(i.display="In"===b?"auto":"none"),y(this,k,i)}}),y}(window.jQuery||window.Zepto||window,window,window?window.document:undefined)});
/* End */
;
; /* Start:"a:4:{s:4:"full";s:76:"/local/templates/aspro_max/vendor/js/velocity/velocity.ui.js?171141775613257";s:6:"source";s:60:"/local/templates/aspro_max/vendor/js/velocity/velocity.ui.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/* 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. */
!function(t){"function"==typeof require&amp;&amp;"object"==typeof exports?module.exports=t():"function"==typeof define&amp;&amp;define.amd?define(["velocity"],t):t()}(function(){return function(t,a,e,r){function n(t,a){var e=[];return t&amp;&amp;a?($.each([t,a],function(t,a){var r=[];$.each(a,function(t,a){for(;a.toString().length&lt;5;)a="0"+a;r.push(a)}),e.push(r.join(""))}),parseFloat(e[0])&gt;parseFloat(e[1])):!1}if(!t.Velocity||!t.Velocity.Utilities)return void(a.console&amp;&amp;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&amp;&amp;(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&amp;&amp;"none"!==s.display||!/Out$/.test(t)||$.each(c.nodeType?[c]:c,function(t,a){i.CSS.setPropertyValue(a,"display","none")}),s.complete&amp;&amp;s.complete.call(c,c),u&amp;&amp;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&lt;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&amp;&amp;(O.begin=function(){s.begin&amp;&amp;s.begin.call(c,c);var a=t.match(/(In|Out)$/);a&amp;&amp;"In"===a[0]&amp;&amp;y.opacity!==r&amp;&amp;$.each(c.nodeType?[c]:c,function(t,a){i.CSS.setPropertyValue(a,"opacity",0)}),s.animateParentHeight&amp;&amp;a&amp;&amp;e(c,a[0],m+O.delay,s.stagger)}),null!==s.display)if(s.display!==r&amp;&amp;"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}s.visibility&amp;&amp;"hidden"!==s.visibility&amp;&amp;(O.visibility=s.visibility)}d===a.calls.length-1&amp;&amp;(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&amp;&amp;"number"!=typeof e||(a.reset[t]=[a.reset[t],a.reset[t]])}var s={duration:0,queue:!1};p&amp;&amp;(s.complete=f),i.animate(n,a.reset,s)}else p&amp;&amp;f()},"hidden"===s.visibility&amp;&amp;(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&gt;1&amp;&amp;($.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&amp;&amp;n.sequenceQueue===!1?"begin":"complete",l=s&amp;&amp;s[o],c={};c[o]=function(){var t=r.e||r.elements,a=t.nodeType?[t]:t;l&amp;&amp;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)});
/* End */
;
; /* Start:"a:4:{s:4:"full";s:74:"/local/templates/aspro_max/vendor/js/jquery.menu-aim.min.js?17114177571533";s:6:"source";s:55:"/local/templates/aspro_max/vendor/js/jquery.menu-aim.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
!function(w){w.fn.menuAim=function(e){return this.each(function(){(function(e){var m=w(this),x=null,y=[],p=null,n=null,d=w.extend({firstActiveRow:!1,rowSelector:"&gt; li",submenuSelector:"*",submenuDirection:"right",tolerance:5,enter:w.noop,exit:w.noop,activate:w.noop,deactivate:w.noop,exitMenu:w.noop},e),i=function(e){e!=x&amp;&amp;(x&amp;&amp;d.deactivate(x),d.activate(e),x=e)},o=function(e){var t=u();t?n=setTimeout(function(){o(e)},t):i(e)},u=function(){if(!x||!w(x).is(d.submenuSelector))return 0;var e=m.offset(),t={x:e.left,y:e.top-d.tolerance},n={x:e.left+m.outerWidth(),y:t.y},i={x:e.left,y:e.top+m.outerHeight()+d.tolerance},o={x:e.left+m.outerWidth(),y:i.y},u=y[y.length-1],r=y[0];if(!u)return 0;if(r||(r=u),r.x&lt;e.left||r.x&gt;o.x||r.y&lt;e.top||r.y&gt;o.y)return 0;if(p&amp;&amp;u.x==p.x&amp;&amp;u.y==p.y)return 0;function c(e,t){return(t.y-e.y)/(t.x-e.x)}var l=n,f=o;"left"==d.submenuDirection?(l=i,f=t):"below"==d.submenuDirection?(l=o,f=i):"above"==d.submenuDirection&amp;&amp;(l=t,f=n);var s=c(u,l),a=c(u,f),h=c(r,l),v=c(r,f);return s&lt;h&amp;&amp;v&lt;a?(p=u,3e3):(p=null,0)};m.mouseleave(function(){n&amp;&amp;clearTimeout(n),d.exitMenu(this)&amp;&amp;(x&amp;&amp;d.deactivate(x),x=null)}).find(d.rowSelector).mouseenter(function(){n&amp;&amp;clearTimeout(n),d.enter(this),o(this)}).mouseleave(function(){d.exit(this)}).click(function(){i(this)}),"firstActiveRow"in d&amp;&amp;(m.find(d.rowSelector).hasClass("active")||(!0===d.firstActiveRow?i(m.find(d.rowSelector).eq(0)):i(d.firstActiveRow)));w(document).mousemove(function(e){y.push({x:e.pageX,y:e.pageY}),3&lt;y.length&amp;&amp;y.shift()})}).call(this,e)}),this}}(jQuery);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:54:"/local/templates/aspro_max/js/browser.js?1711948550996";s:6:"source";s:40:"/local/templates/aspro_max/js/browser.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
var matched, browser;

jQuery.uaMatch = function( ua ) {
    ua = ua.toLowerCase();

    var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
        /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
        /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
        /(msie)[\s?]([\w.]+)/.exec( ua ) ||       
        /(trident)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
        ua.indexOf("compatible") &lt; 0 &amp;&amp; /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
        [];

    return {
        browser: match[ 1 ] || "",
        version: match[ 2 ] || "0"
    };
};

matched = jQuery.uaMatch( navigator.userAgent );
//IE 11+ fix (Trident) 
matched.browser = matched.browser == 'trident' ? 'msie' : matched.browser;
browser = {};

if ( matched.browser ) {
    browser[ matched.browser ] = true;
    browser.version = matched.version;
}

// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
    browser.webkit = true;
} else if ( browser.webkit ) {
    browser.safari = true;
}

jQuery.browser = browser;
/* End */
;
; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_max/js/jquery.fancybox.js?1711417750160667";s:6:"source";s:48:"/local/templates/aspro_max/js/jquery.fancybox.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
// ==================================================
// fancyBox v3.5.7
//
// Licensed GPLv3 for open source use
// or fancyBox Commercial License for commercial use
//
// http://fancyapps.com/fancybox/
// Copyright 2019 fancyApps
//
// ==================================================
(function (window, document, $, undefined) {
  "use strict";

  window.console = window.console || {
    info: function (stuff) {}
  };

  // If there's no jQuery, fancyBox can't work
  // =========================================

  if (!$) {
    return;
  }

  // Check if fancyBox is already initialized
  // ========================================

  if ($.fn.fancybox) {
    console.info("fancyBox already initialized");

    return;
  }

  // Private default settings
  // ========================

  var defaults = {
    // Close existing modals
    // Set this to false if you do not need to stack multiple instances
    closeExisting: false,

    // Enable infinite gallery navigation
    loop: false,

    // Horizontal space between slides
    gutter: 50,

    // Enable keyboard navigation
    keyboard: true,

    // Should allow caption to overlap the content
    preventCaptionOverlap: true,

    // Should display navigation arrows at the screen edges
    arrows: true,

    // Should display counter at the top left corner
    infobar: true,

    // Should display close button (using `btnTpl.smallBtn` template) over the content
    // Can be true, false, "auto"
    // If "auto" - will be automatically enabled for "html", "inline" or "ajax" items
    smallBtn: "auto",

    // Should display toolbar (buttons at the top)
    // Can be true, false, "auto"
    // If "auto" - will be automatically hidden if "smallBtn" is enabled
    toolbar: "auto",

    // What buttons should appear in the top right corner.
    // Buttons will be created using templates from `btnTpl` option
    // and they will be placed into toolbar (class="fancybox-toolbar"` element)
    buttons: [
      "zoom",
      //"share",
      "slideShow",
      //"fullScreen",
      //"download",
      "thumbs",
      "close"
    ],

    // Detect "idle" time in seconds
    idleTime: 3,

    // Disable right-click and use simple image protection for images
    protect: false,

    // Shortcut to make content "modal" - disable keyboard navigtion, hide buttons, etc
    modal: false,

    image: {
      // Wait for images to load before displaying
      //   true  - wait for image to load and then display;
      //   false - display thumbnail and load the full-sized image over top,
      //           requires predefined image dimensions (`data-width` and `data-height` attributes)
      preload: false
    },

    ajax: {
      // Object containing settings for ajax request
      settings: {
        // This helps to indicate that request comes from the modal
        // Feel free to change naming
        data: {
          fancybox: true
        }
      }
    },

    iframe: {
      // Iframe template
      tpl: '&lt;iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" allowfullscreen="allowfullscreen" allow="autoplay; fullscreen" src=""&gt;&lt;/iframe&gt;',

      // Preload iframe before displaying it
      // This allows to calculate iframe content width and height
      // (note: Due to "Same Origin Policy", you can't get cross domain data).
      preload: true,

      // Custom CSS styling for iframe wrapping element
      // You can use this to set custom iframe dimensions
      css: {},

      // Iframe tag attributes
      attr: {
        scrolling: "auto"
      }
    },

    // For HTML5 video only
    video: {
      tpl: '&lt;video class="fancybox-video" controls controlsList="nodownload" poster="{{poster}}"&gt;' +
        '&lt;source src="{{src}}" type="{{format}}" /&gt;' +
        'Sorry, your browser doesn\'t support embedded videos, &lt;a href="{{src}}"&gt;download&lt;/a&gt; and watch with your favorite video player!' +
        "&lt;/video&gt;",
      format: "", // custom video format
      autoStart: true
    },

    // Default content type if cannot be detected automatically
    defaultType: "image",

    // Open/close animation type
    // Possible values:
    //   false            - disable
    //   "zoom"           - zoom images from/to thumbnail
    //   "fade"
    //   "zoom-in-out"
    //
    animationEffect: "zoom",

    // Duration in ms for open/close animation
    animationDuration: 366,

    // Should image change opacity while zooming
    // If opacity is "auto", then opacity will be changed if image and thumbnail have different aspect ratios
    zoomOpacity: "auto",

    // Transition effect between slides
    //
    // Possible values:
    //   false            - disable
    //   "fade'
    //   "slide'
    //   "circular'
    //   "tube'
    //   "zoom-in-out'
    //   "rotate'
    //
    transitionEffect: "fade",

    // Duration in ms for transition animation
    transitionDuration: 366,

    // Custom CSS class for slide element
    slideClass: "",

    // Custom CSS class for layout
    baseClass: "",

    // Base template for layout
    baseTpl: '&lt;div class="fancybox-container" role="dialog" tabindex="-1"&gt;' +
      '&lt;div class="fancybox-bg"&gt;&lt;/div&gt;' +
      '&lt;div class="fancybox-inner"&gt;' +
      '&lt;div class="fancybox-infobar"&gt;&lt;span data-fancybox-index&gt;&lt;/span&gt;&amp;nbsp;/&amp;nbsp;&lt;span data-fancybox-count&gt;&lt;/span&gt;&lt;/div&gt;' +
      '&lt;div class="fancybox-toolbar"&gt;{{buttons}}&lt;/div&gt;' +
      '&lt;div class="fancybox-navigation"&gt;{{arrows}}&lt;/div&gt;' +
      '&lt;div class="fancybox-stage"&gt;&lt;/div&gt;' +
      '&lt;div class="fancybox-caption"&gt;&lt;div class="fancybox-caption__body"&gt;&lt;/div&gt;&lt;/div&gt;' +
      "&lt;/div&gt;" +
      "&lt;/div&gt;",

    // Loading indicator template
    spinnerTpl: '&lt;div class="fancybox-loading"&gt;&lt;/div&gt;',

    // Error message template
    errorTpl: '&lt;div class="fancybox-error"&gt;&lt;p&gt;{{ERROR}}&lt;/p&gt;&lt;/div&gt;',

    btnTpl: {
      download: '&lt;a download data-fancybox-download class="fancybox-button fancybox-button--download" title="{{DOWNLOAD}}" href="javascript:;"&gt;' +
        '&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;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"/&gt;&lt;/svg&gt;' +
        "&lt;/a&gt;",

      zoom: '&lt;button data-fancybox-zoom class="fancybox-button fancybox-button--zoom" title="{{ZOOM}}"&gt;' +
        '&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;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"/&gt;&lt;/svg&gt;' +
        "&lt;/button&gt;",

      close: '&lt;button data-fancybox-close class="fancybox-button fancybox-button--close" title="{{CLOSE}}"&gt;' +
        '&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;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"/&gt;&lt;/svg&gt;' +
        "&lt;/button&gt;",

      // Arrows
      arrowLeft: '&lt;button data-fancybox-prev class="fancybox-button fancybox-button--arrow_left" title="{{PREV}}"&gt;' +
        '&lt;div&gt;&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;path d="M11.28 15.7l-1.34 1.37L5 12l4.94-5.07 1.34 1.38-2.68 2.72H19v1.94H8.6z"/&gt;&lt;/svg&gt;&lt;/div&gt;' +
        "&lt;/button&gt;",

      arrowRight: '&lt;button data-fancybox-next class="fancybox-button fancybox-button--arrow_right" title="{{NEXT}}"&gt;' +
        '&lt;div&gt;&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;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"/&gt;&lt;/svg&gt;&lt;/div&gt;' +
        "&lt;/button&gt;",

      // This small close button will be appended to your html/inline/ajax content by default,
      // if "smallBtn" option is not set to false
      smallBtn: '&lt;button type="button" data-fancybox-close class="fancybox-button fancybox-close-small" title="{{CLOSE}}"&gt;' +
        '&lt;svg xmlns="http://www.w3.org/2000/svg" version="1" viewBox="0 0 24 24"&gt;&lt;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"/&gt;&lt;/svg&gt;' +
        "&lt;/button&gt;"
    },

    // Container is injected into this element
    parentEl: "body",

    // Hide browser vertical scrollbars; use at your own risk
    hideScrollbar: true,

    // Focus handling
    // ==============

    // Try to focus on the first focusable element after opening
    autoFocus: true,

    // Put focus back to active element after closing
    backFocus: true,

    // Do not let user to focus on element outside modal content
    trapFocus: true,

    // Module specific options
    // =======================

    fullScreen: {
      autoStart: false
    },

    // Set `touch: false` to disable panning/swiping
    touch: {
      vertical: true, // Allow to drag content vertically
      momentum: true // Continue movement after releasing mouse/touch when panning
    },

    // Hash value when initializing manually,
    // set `false` to disable hash change
    hash: null,

    // Customize or add new media types
    // Example:
    /*
      media : {
        youtube : {
          params : {
            autoplay : 0
          }
        }
      }
    */
    media: {},

    slideShow: {
      autoStart: false,
      speed: 3000
    },

    thumbs: {
      autoStart: false, // Display thumbnails on opening
      hideOnClose: true, // Hide thumbnail grid when closing animation starts
      parentEl: ".fancybox-container", // Container is injected into this element
      axis: "y" // Vertical (y) or horizontal (x) scrolling
    },

    // Use mousewheel to navigate gallery
    // If 'auto' - enabled for images only
    wheel: "auto",

    // Callbacks
    //==========

    // See Documentation/API/Events for more information
    // Example:
    /*
      afterShow: function( instance, current ) {
        console.info( 'Clicked element:' );
        console.info( current.opts.$orig );
      }
    */

    onInit: $.noop, // When instance has been initialized

    beforeLoad: $.noop, // Before the content of a slide is being loaded
    afterLoad: $.noop, // When the content of a slide is done loading

    beforeShow: $.noop, // Before open animation starts
    afterShow: $.noop, // When content is done loading and animating

    beforeClose: $.noop, // Before the instance attempts to close. Return false to cancel the close.
    afterClose: $.noop, // After instance has been closed

    onActivate: $.noop, // When instance is brought to front
    onDeactivate: $.noop, // When other instance has been activated

    // Interaction
    // ===========

    // Use options below to customize taken action when user clicks or double clicks on the fancyBox area,
    // each option can be string or method that returns value.
    //
    // Possible values:
    //   "close"           - close instance
    //   "next"            - move to next gallery item
    //   "nextOrClose"     - move to next gallery item or close if gallery has only one item
    //   "toggleControls"  - show/hide controls
    //   "zoom"            - zoom image (if loaded)
    //   false             - do nothing

    // Clicked on the content
    clickContent: function (current, event) {
      return current.type === "image" ? "zoom" : false;
    },

    // Clicked on the slide
    clickSlide: "close",

    // Clicked on the background (backdrop) element;
    // if you have not changed the layout, then most likely you need to use `clickSlide` option
    clickOutside: "close",

    // Same as previous two, but for double click
    dblclickContent: false,
    dblclickSlide: false,
    dblclickOutside: false,

    // Custom options when mobile device is detected
    // =============================================

    mobile: {
      preventCaptionOverlap: false,
      idleTime: false,
      clickContent: function (current, event) {
        return current.type === "image" ? "toggleControls" : false;
      },
      clickSlide: function (current, event) {
        return current.type === "image" ? "toggleControls" : "close";
      },
      dblclickContent: function (current, event) {
        return current.type === "image" ? "zoom" : false;
      },
      dblclickSlide: function (current, event) {
        return current.type === "image" ? "zoom" : false;
      }
    },

    // Internationalization
    // ====================

    lang: "en",
    i18n: {
      en: {
        CLOSE: "Close",
        NEXT: "Next",
        PREV: "Previous",
        ERROR: "The requested content cannot be loaded. &lt;br/&gt; Please try again later.",
        PLAY_START: "Start slideshow",
        PLAY_STOP: "Pause slideshow",
        FULL_SCREEN: "Full screen",
        THUMBS: "Thumbnails",
        DOWNLOAD: "Download",
        SHARE: "Share",
        ZOOM: "Zoom"
      },
      de: {
        CLOSE: "Schlie&amp;szlig;en",
        NEXT: "Weiter",
        PREV: "Zur&amp;uuml;ck",
        ERROR: "Die angeforderten Daten konnten nicht geladen werden. &lt;br/&gt; Bitte versuchen Sie es sp&amp;auml;ter nochmal.",
        PLAY_START: "Diaschau starten",
        PLAY_STOP: "Diaschau beenden",
        FULL_SCREEN: "Vollbild",
        THUMBS: "Vorschaubilder",
        DOWNLOAD: "Herunterladen",
        SHARE: "Teilen",
        ZOOM: "Vergr&amp;ouml;&amp;szlig;ern"
      }
    }
  };

  // Few useful variables and methods
  // ================================

  var $W = $(window);
  var $D = $(document);

  var called = 0;

  // Check if an object is a jQuery object and not a native JavaScript object
  // ========================================================================
  var isQuery = function (obj) {
    return obj &amp;&amp; obj.hasOwnProperty &amp;&amp; obj instanceof $;
  };

  // Handle multiple browsers for "requestAnimationFrame" and "cancelAnimationFrame"
  // ===============================================================================
  var requestAFrame = (function () {
    return (
      window.requestAnimationFrame ||
      window.webkitRequestAnimationFrame ||
      window.mozRequestAnimationFrame ||
      window.oRequestAnimationFrame ||
      // if all else fails, use setTimeout
      function (callback) {
        return window.setTimeout(callback, 1000 / 60);
      }
    );
  })();

  var cancelAFrame = (function () {
    return (
      window.cancelAnimationFrame ||
      window.webkitCancelAnimationFrame ||
      window.mozCancelAnimationFrame ||
      window.oCancelAnimationFrame ||
      function (id) {
        window.clearTimeout(id);
      }
    );
  })();

  // Detect the supported transition-end event property name
  // =======================================================
  var transitionEnd = (function () {
    var el = document.createElement("fakeelement"),
      t;

    var transitions = {
      transition: "transitionend",
      OTransition: "oTransitionEnd",
      MozTransition: "transitionend",
      WebkitTransition: "webkitTransitionEnd"
    };

    for (t in transitions) {
      if (el.style[t] !== undefined) {
        return transitions[t];
      }
    }

    return "transitionend";
  })();

  // Force redraw on an element.
  // This helps in cases where the browser doesn't redraw an updated element properly
  // ================================================================================
  var forceRedraw = function ($el) {
    return $el &amp;&amp; $el.length &amp;&amp; $el[0].offsetHeight;
  };

  // Exclude array (`buttons`) options from deep merging
  // ===================================================
  var mergeOpts = function (opts1, opts2) {
    var rez = $.extend(true, {}, opts1, opts2);

    $.each(opts2, function (key, value) {
      if ($.isArray(value)) {
        rez[key] = value;
      }
    });

    return rez;
  };

  // How much of an element is visible in viewport
  // =============================================

  var inViewport = function (elem) {
    var elemCenter, rez;

    if (!elem || elem.ownerDocument !== document) {
      return false;
    }

    $(".fancybox-container").css("pointer-events", "none");

    elemCenter = {
      x: elem.getBoundingClientRect().left + elem.offsetWidth / 2,
      y: elem.getBoundingClientRect().top + elem.offsetHeight / 2
    };

    rez = document.elementFromPoint(elemCenter.x, elemCenter.y) === elem;

    $(".fancybox-container").css("pointer-events", "");

    return rez;
  };

  // Class definition
  // ================

  var FancyBox = function (content, opts, index) {
    var self = this;

    self.opts = mergeOpts({
      index: index
    }, $.fancybox.defaults);

    if ($.isPlainObject(opts)) {
      self.opts = mergeOpts(self.opts, opts);
    }

    if ($.fancybox.isMobile) {
      self.opts = mergeOpts(self.opts, self.opts.mobile);
    }

    self.id = self.opts.id || ++called;

    self.currIndex = parseInt(self.opts.index, 10) || 0;
    self.prevIndex = null;

    self.prevPos = null;
    self.currPos = 0;

    self.firstRun = true;

    // All group items
    self.group = [];

    // Existing slides (for current, next and previous gallery items)
    self.slides = {};

    // Create group elements
    self.addContent(content);

    if (!self.group.length) {
      return;
    }

    self.init();
  };

  $.extend(FancyBox.prototype, {
    // Create DOM structure
    // ====================

    init: function () {
      var self = this,
        firstItem = self.group[self.currIndex],
        firstItemOpts = firstItem.opts,
        $container,
        buttonStr;

      if (firstItemOpts.closeExisting) {
        $.fancybox.close(true);
      }

      // Hide scrollbars
      // ===============

      $("body").addClass("fancybox-active");

      if (
        !$.fancybox.getInstance() &amp;&amp;
        firstItemOpts.hideScrollbar !== false &amp;&amp;
        !$.fancybox.isMobile &amp;&amp;
        document.body.scrollHeight &gt; window.innerHeight
      ) {
        $("head").append(
          '&lt;style id="fancybox-style-noscroll" type="text/css"&gt;.compensate-for-scrollbar{margin-right:' +
          (window.innerWidth - document.documentElement.clientWidth) +
          "px;}&lt;/style&gt;"
        );

        $("body").addClass("compensate-for-scrollbar");
      }

      // Build html markup and set references
      // ====================================

      // Build html code for buttons and insert into main template
      buttonStr = "";

      $.each(firstItemOpts.buttons, function (index, value) {
        buttonStr += firstItemOpts.btnTpl[value] || "";
      });

      // Create markup from base template, it will be initially hidden to
      // avoid unnecessary work like painting while initializing is not complete
      $container = $(
          self.translate(
            self,
            firstItemOpts.baseTpl
            .replace("{{buttons}}", buttonStr)
            .replace("{{arrows}}", firstItemOpts.btnTpl.arrowLeft + firstItemOpts.btnTpl.arrowRight)
          )
        )
        .attr("id", "fancybox-container-" + self.id)
        .addClass(firstItemOpts.baseClass)
        .data("FancyBox", self)
        .appendTo(firstItemOpts.parentEl);

      // Create object holding references to jQuery wrapped nodes
      self.$refs = {
        container: $container
      };

      ["bg", "inner", "infobar", "toolbar", "stage", "caption", "navigation"].forEach(function (item) {
        self.$refs[item] = $container.find(".fancybox-" + item);
      });

      self.trigger("onInit");

      // Enable events, deactive previous instances
      self.activate();

      // Build slides, load and reveal content
      self.jumpTo(self.currIndex);
    },

    // Simple i18n support - replaces object keys found in template
    // with corresponding values
    // ============================================================

    translate: function (obj, str) {
      var arr = obj.opts.i18n[obj.opts.lang] || obj.opts.i18n.en;

      return str.replace(/\{\{(\w+)\}\}/g, function (match, n) {
        return arr[n] === undefined ? match : arr[n];
      });
    },

    // Populate current group with fresh content
    // Check if each object has valid type and content
    // ===============================================

    addContent: function (content) {
      var self = this,
        items = $.makeArray(content),
        thumbs;

      $.each(items, function (i, item) {
        var obj = {},
          opts = {},
          $item,
          type,
          found,
          src,
          srcParts;

        // Step 1 - Make sure we have an object
        // ====================================

        if ($.isPlainObject(item)) {
          // We probably have manual usage here, something like
          // $.fancybox.open( [ { src : "image.jpg", type : "image" } ] )

          obj = item;
          opts = item.opts || item;
        } else if ($.type(item) === "object" &amp;&amp; $(item).length) {
          // Here we probably have jQuery collection returned by some selector
          $item = $(item);

          // Support attributes like `data-options='{"touch" : false}'` and `data-touch='false'`
          opts = $item.data() || {};
          opts = $.extend(true, {}, opts, opts.options);

          // Here we store clicked element
          opts.$orig = $item;

          obj.src = self.opts.src || opts.src || $item.attr("href");

          // Assume that simple syntax is used, for example:
          //   `$.fancybox.open( $("#test"), {} );`
          if (!obj.type &amp;&amp; !obj.src) {
            obj.type = "inline";
            obj.src = item;
          }
        } else {
          // Assume we have a simple html code, for example:
          //   $.fancybox.open( '&lt;div&gt;&lt;h1&gt;Hi!&lt;/h1&gt;&lt;/div&gt;' );
          obj = {
            type: "html",
            src: item + ""
          };
        }

        // Each gallery object has full collection of options
        obj.opts = $.extend(true, {}, self.opts, opts);

        // Do not merge buttons array
        if ($.isArray(opts.buttons)) {
          obj.opts.buttons = opts.buttons;
        }

        if ($.fancybox.isMobile &amp;&amp; obj.opts.mobile) {
          obj.opts = mergeOpts(obj.opts, obj.opts.mobile);
        }

        // Step 2 - Make sure we have content type, if not - try to guess
        // ==============================================================

        type = obj.type || obj.opts.type;
        src = obj.src || "";

        if (!type &amp;&amp; src) {
          if ((found = src.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i))) {
            type = "video";

            if (!obj.opts.video.format) {
              obj.opts.video.format = "video/" + (found[1] === "ogv" ? "ogg" : found[1]);
            }
          } else if (src.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i)) {
            type = "image";
          } else if (src.match(/\.(pdf)((\?|#).*)?$/i)) {
            type = "iframe";
            obj = $.extend(true, obj, {
              contentType: "pdf",
              opts: {
                iframe: {
                  preload: false
                }
              }
            });
          } else if (src.charAt(0) === "#") {
            type = "inline";
          }
        }

        if (type) {
          obj.type = type;
        } else {
          self.trigger("objectNeedsType", obj);
        }

        if (!obj.contentType) {
          obj.contentType = $.inArray(obj.type, ["html", "inline", "ajax"]) &gt; -1 ? "html" : obj.type;
        }

        // Step 3 - Some adjustments
        // =========================

        obj.index = self.group.length;

        if (obj.opts.smallBtn == "auto") {
          obj.opts.smallBtn = $.inArray(obj.type, ["html", "inline", "ajax"]) &gt; -1;
        }

        if (obj.opts.toolbar === "auto") {
          obj.opts.toolbar = !obj.opts.smallBtn;
        }

        // Find thumbnail image, check if exists and if is in the viewport
        obj.$thumb = obj.opts.$thumb || null;

        if (obj.opts.$trigger &amp;&amp; obj.index === self.opts.index) {
          obj.$thumb = obj.opts.$trigger.find("img:first");

          if (obj.$thumb.length) {
            obj.opts.$orig = obj.opts.$trigger;
          }
        }

        if (!(obj.$thumb &amp;&amp; obj.$thumb.length) &amp;&amp; obj.opts.$orig) {
          obj.$thumb = obj.opts.$orig.find("img:first");
        }

        if (obj.$thumb &amp;&amp; !obj.$thumb.length) {
          obj.$thumb = null;
        }

        obj.thumb = obj.opts.thumb || (obj.$thumb ? obj.$thumb[0].src : null);

        // "caption" is a "special" option, it can be used to customize caption per gallery item
        if ($.type(obj.opts.caption) === "function") {
          obj.opts.caption = obj.opts.caption.apply(item, [self, obj]);
        }

        if ($.type(self.opts.caption) === "function") {
          obj.opts.caption = self.opts.caption.apply(item, [self, obj]);
        }

        // Make sure we have caption as a string or jQuery object
        if (!(obj.opts.caption instanceof $)) {
          obj.opts.caption = obj.opts.caption === undefined ? "" : obj.opts.caption + "";
        }

        // Check if url contains "filter" used to filter the content
        // Example: "ajax.html #something"
        if (obj.type === "ajax") {
          srcParts = src.split(/\s+/, 2);

          if (srcParts.length &gt; 1) {
            obj.src = srcParts.shift();

            obj.opts.filter = srcParts.shift();
          }
        }

        // Hide all buttons and disable interactivity for modal items
        if (obj.opts.modal) {
          obj.opts = $.extend(true, obj.opts, {
            trapFocus: true,
            // Remove buttons
            infobar: 0,
            toolbar: 0,

            smallBtn: 0,

            // Disable keyboard navigation
            keyboard: 0,

            // Disable some modules
            slideShow: 0,
            fullScreen: 0,
            thumbs: 0,
            touch: 0,

            // Disable click event handlers
            clickContent: false,
            clickSlide: false,
            clickOutside: false,
            dblclickContent: false,
            dblclickSlide: false,
            dblclickOutside: false
          });
        }

        // Step 4 - Add processed object to group
        // ======================================

        self.group.push(obj);
      });

      // Update controls if gallery is already opened
      if (Object.keys(self.slides).length) {
        self.updateControls();

        // Update thumbnails, if needed
        thumbs = self.Thumbs;

        if (thumbs &amp;&amp; thumbs.isActive) {
          thumbs.create();

          thumbs.focus();
        }
      }
    },

    // Attach an event handler functions for:
    //   - navigation buttons
    //   - browser scrolling, resizing;
    //   - focusing
    //   - keyboard
    //   - detecting inactivity
    // ======================================

    addEvents: function () {
      var self = this;

      self.removeEvents();

      // Make navigation elements clickable
      // ==================================

      self.$refs.container
        .on("click.fb-close", "[data-fancybox-close]", function (e) {
          e.stopPropagation();
          e.preventDefault();

          self.close(e);
        })
        .on("touchstart.fb-prev click.fb-prev", "[data-fancybox-prev]", function (e) {
          e.stopPropagation();
          e.preventDefault();

          self.previous();
        })
        .on("touchstart.fb-next click.fb-next", "[data-fancybox-next]", function (e) {
          e.stopPropagation();
          e.preventDefault();

          self.next();
        })
        .on("click.fb", "[data-fancybox-zoom]", function (e) {
          // Click handler for zoom button
          self[self.isScaledDown() ? "scaleToActual" : "scaleToFit"]();
        });

      // Handle page scrolling and browser resizing
      // ==========================================

      $W.on("orientationchange.fb resize.fb", function (e) {
        if (e &amp;&amp; e.originalEvent &amp;&amp; e.originalEvent.type === "resize") {
          if (self.requestId) {
            cancelAFrame(self.requestId);
          }

          self.requestId = requestAFrame(function () {
            self.update(e);
          });
        } else {
          if (self.current &amp;&amp; self.current.type === "iframe") {
            self.$refs.stage.hide();
          }

          setTimeout(
            function () {
              self.$refs.stage.show();

              self.update(e);
            },
            $.fancybox.isMobile ? 600 : 250
          );
        }
      });

      $D.on("keydown.fb", function (e) {
        var instance = $.fancybox ? $.fancybox.getInstance() : null,
          current = instance.current,
          keycode = e.keyCode || e.which;

        // Trap keyboard focus inside of the modal
        // =======================================

        if (keycode == 9) {
          if (current.opts.trapFocus) {
            self.focus(e);
          }

          return;
        }

        // Enable keyboard navigation
        // ==========================

        if (!current.opts.keyboard || e.ctrlKey || e.altKey || e.shiftKey || $(e.target).is("input,textarea,video,audio,select")) {
          return;
        }

        // Backspace and Esc keys
        if (keycode === 8 || keycode === 27) {
          e.preventDefault();

          self.close(e);

          return;
        }

        // Left arrow and Up arrow
        if (keycode === 37 || keycode === 38) {
          e.preventDefault();

          self.previous();

          return;
        }

        // Righ arrow and Down arrow
        if (keycode === 39 || keycode === 40) {
          e.preventDefault();

          self.next();

          return;
        }

        self.trigger("afterKeydown", e, keycode);
      });

      // Hide controls after some inactivity period
      if (self.group[self.currIndex].opts.idleTime) {
        self.idleSecondsCounter = 0;

        $D.on(
          "mousemove.fb-idle mouseleave.fb-idle mousedown.fb-idle touchstart.fb-idle touchmove.fb-idle scroll.fb-idle keydown.fb-idle",
          function (e) {
            self.idleSecondsCounter = 0;

            if (self.isIdle) {
              self.showControls();
            }

            self.isIdle = false;
          }
        );

        self.idleInterval = window.setInterval(function () {
          self.idleSecondsCounter++;

          if (self.idleSecondsCounter &gt;= self.group[self.currIndex].opts.idleTime &amp;&amp; !self.isDragging) {
            self.isIdle = true;
            self.idleSecondsCounter = 0;

            self.hideControls();
          }
        }, 1000);
      }
    },

    // Remove events added by the core
    // ===============================

    removeEvents: function () {
      var self = this;

      $W.off("orientationchange.fb resize.fb");
      $D.off("keydown.fb .fb-idle");

      this.$refs.container.off(".fb-close .fb-prev .fb-next");

      if (self.idleInterval) {
        window.clearInterval(self.idleInterval);

        self.idleInterval = null;
      }
    },

    // Change to previous gallery item
    // ===============================

    previous: function (duration) {
      return this.jumpTo(this.currPos - 1, duration);
    },

    // Change to next gallery item
    // ===========================

    next: function (duration) {
      return this.jumpTo(this.currPos + 1, duration);
    },

    // Switch to selected gallery item
    // ===============================

    jumpTo: function (pos, duration) {
      var self = this,
        groupLen = self.group.length,
        firstRun,
        isMoved,
        loop,
        current,
        previous,
        slidePos,
        stagePos,
        prop,
        diff;

      if (self.isDragging || self.isClosing || (self.isAnimating &amp;&amp; self.firstRun)) {
        return;
      }

      // Should loop?
      pos = parseInt(pos, 10);
      loop = self.current ? self.current.opts.loop : self.opts.loop;

      if (!loop &amp;&amp; (pos &lt; 0 || pos &gt;= groupLen)) {
        return false;
      }

      // Check if opening for the first time; this helps to speed things up
      firstRun = self.firstRun = !Object.keys(self.slides).length;

      // Create slides
      previous = self.current;

      self.prevIndex = self.currIndex;
      self.prevPos = self.currPos;

      current = self.createSlide(pos);

      if (groupLen &gt; 1) {
        if (loop || current.index &lt; groupLen - 1) {
          self.createSlide(pos + 1);
        }

        if (loop || current.index &gt; 0) {
          self.createSlide(pos - 1);
        }
      }

      self.current = current;
      self.currIndex = current.index;
      self.currPos = current.pos;

      self.trigger("beforeShow", firstRun);

      self.updateControls();

      // Validate duration length
      current.forcedDuration = undefined;

      if ($.isNumeric(duration)) {
        current.forcedDuration = duration;
      } else {
        duration = current.opts[firstRun ? "animationDuration" : "transitionDuration"];
      }

      duration = parseInt(duration, 10);

      // Check if user has swiped the slides or if still animating
      isMoved = self.isMoved(current);

      // Make sure current slide is visible
      current.$slide.addClass("fancybox-slide--current");

      // Fresh start - reveal container, current slide and start loading content
      if (firstRun) {
        if (current.opts.animationEffect &amp;&amp; duration) {
          self.$refs.container.css("transition-duration", duration + "ms");
        }

        self.$refs.container.addClass("fancybox-is-open").trigger("focus");

        // Attempt to load content into slide
        // This will later call `afterLoad` -&gt; `revealContent`
        self.loadSlide(current);

        self.preload("image");

        return;
      }

      // Get actual slide/stage positions (before cleaning up)
      slidePos = $.fancybox.getTranslate(previous.$slide);
      stagePos = $.fancybox.getTranslate(self.$refs.stage);

      // Clean up all slides
      $.each(self.slides, function (index, slide) {
        $.fancybox.stop(slide.$slide, true);
      });

      if (previous.pos !== current.pos) {
        previous.isComplete = false;
      }

      previous.$slide.removeClass("fancybox-slide--complete fancybox-slide--current");

      // If slides are out of place, then animate them to correct position
      if (isMoved) {
        // Calculate horizontal swipe distance
        diff = slidePos.left - (previous.pos * slidePos.width + previous.pos * previous.opts.gutter);

        $.each(self.slides, function (index, slide) {
          slide.$slide.removeClass("fancybox-animated").removeClass(function (index, className) {
            return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" ");
          });

          // Make sure that each slide is in equal distance
          // This is mostly needed for freshly added slides, because they are not yet positioned
          var leftPos = slide.pos * slidePos.width + slide.pos * slide.opts.gutter;

          $.fancybox.setTranslate(slide.$slide, {
            top: 0,
            left: leftPos - stagePos.left + diff
          });

          if (slide.pos !== current.pos) {
            slide.$slide.addClass("fancybox-slide--" + (slide.pos &gt; current.pos ? "next" : "previous"));
          }

          // Redraw to make sure that transition will start
          forceRedraw(slide.$slide);

          // Animate the slide
          $.fancybox.animate(
            slide.$slide, {
              top: 0,
              left: (slide.pos - current.pos) * slidePos.width + (slide.pos - current.pos) * slide.opts.gutter
            },
            duration,
            function () {
              slide.$slide
                .css({
                  transform: "",
                  opacity: ""
                })
                .removeClass("fancybox-slide--next fancybox-slide--previous");

              if (slide.pos === self.currPos) {
                self.complete();
              }
            }
          );
        });
      } else if (duration &amp;&amp; current.opts.transitionEffect) {
        // Set transition effect for previously active slide
        prop = "fancybox-animated fancybox-fx-" + current.opts.transitionEffect;

        previous.$slide.addClass("fancybox-slide--" + (previous.pos &gt; current.pos ? "next" : "previous"));

        $.fancybox.animate(
          previous.$slide,
          prop,
          duration,
          function () {
            previous.$slide.removeClass(prop).removeClass("fancybox-slide--next fancybox-slide--previous");
          },
          false
        );
      }

      if (current.isLoaded) {
        self.revealContent(current);
      } else {
        self.loadSlide(current);
      }

      self.preload("image");
    },

    // Create new "slide" element
    // These are gallery items  that are actually added to DOM
    // =======================================================

    createSlide: function (pos) {
      var self = this,
        $slide,
        index;

      index = pos % self.group.length;
      index = index &lt; 0 ? self.group.length + index : index;

      if (!self.slides[pos] &amp;&amp; self.group[index]) {
        $slide = $('&lt;div class="fancybox-slide"&gt;&lt;/div&gt;').appendTo(self.$refs.stage);

        self.slides[pos] = $.extend(true, {}, self.group[index], {
          pos: pos,
          $slide: $slide,
          isLoaded: false
        });

        self.updateSlide(self.slides[pos]);
      }

      return self.slides[pos];
    },

    // Scale image to the actual size of the image;
    // x and y values should be relative to the slide
    // ==============================================

    scaleToActual: function (x, y, duration) {
      var self = this,
        current = self.current,
        $content = current.$content,
        canvasWidth = $.fancybox.getTranslate(current.$slide).width,
        canvasHeight = $.fancybox.getTranslate(current.$slide).height,
        newImgWidth = current.width,
        newImgHeight = current.height,
        imgPos,
        posX,
        posY,
        scaleX,
        scaleY;

      if (self.isAnimating || self.isMoved() || !$content || !(current.type == "image" &amp;&amp; current.isLoaded &amp;&amp; !current.hasError)) {
        return;
      }

      self.isAnimating = true;

      $.fancybox.stop($content);

      x = x === undefined ? canvasWidth * 0.5 : x;
      y = y === undefined ? canvasHeight * 0.5 : y;

      imgPos = $.fancybox.getTranslate($content);

      imgPos.top -= $.fancybox.getTranslate(current.$slide).top;
      imgPos.left -= $.fancybox.getTranslate(current.$slide).left;

      scaleX = newImgWidth / imgPos.width;
      scaleY = newImgHeight / imgPos.height;

      // Get center position for original image
      posX = canvasWidth * 0.5 - newImgWidth * 0.5;
      posY = canvasHeight * 0.5 - newImgHeight * 0.5;

      // Make sure image does not move away from edges
      if (newImgWidth &gt; canvasWidth) {
        posX = imgPos.left * scaleX - (x * scaleX - x);

        if (posX &gt; 0) {
          posX = 0;
        }

        if (posX &lt; canvasWidth - newImgWidth) {
          posX = canvasWidth - newImgWidth;
        }
      }

      if (newImgHeight &gt; canvasHeight) {
        posY = imgPos.top * scaleY - (y * scaleY - y);

        if (posY &gt; 0) {
          posY = 0;
        }

        if (posY &lt; canvasHeight - newImgHeight) {
          posY = canvasHeight - newImgHeight;
        }
      }

      self.updateCursor(newImgWidth, newImgHeight);

      $.fancybox.animate(
        $content, {
          top: posY,
          left: posX,
          scaleX: scaleX,
          scaleY: scaleY
        },
        duration || 366,
        function () {
          self.isAnimating = false;
        }
      );

      // Stop slideshow
      if (self.SlideShow &amp;&amp; self.SlideShow.isActive) {
        self.SlideShow.stop();
      }
    },

    // Scale image to fit inside parent element
    // ========================================

    scaleToFit: function (duration) {
      var self = this,
        current = self.current,
        $content = current.$content,
        end;

      if (self.isAnimating || self.isMoved() || !$content || !(current.type == "image" &amp;&amp; current.isLoaded &amp;&amp; !current.hasError)) {
        return;
      }

      self.isAnimating = true;

      $.fancybox.stop($content);

      end = self.getFitPos(current);

      self.updateCursor(end.width, end.height);

      $.fancybox.animate(
        $content, {
          top: end.top,
          left: end.left,
          scaleX: end.width / $content.width(),
          scaleY: end.height / $content.height()
        },
        duration || 366,
        function () {
          self.isAnimating = false;
        }
      );
    },

    // Calculate image size to fit inside viewport
    // ===========================================

    getFitPos: function (slide) {
      var self = this,
        $content = slide.$content,
        $slide = slide.$slide,
        width = slide.width || slide.opts.width,
        height = slide.height || slide.opts.height,
        maxWidth,
        maxHeight,
        minRatio,
        aspectRatio,
        rez = {};

      if (!slide.isLoaded || !$content || !$content.length) {
        return false;
      }

      maxWidth = $.fancybox.getTranslate(self.$refs.stage).width;
      maxHeight = $.fancybox.getTranslate(self.$refs.stage).height;

      maxWidth -=
        parseFloat($slide.css("paddingLeft")) +
        parseFloat($slide.css("paddingRight")) +
        parseFloat($content.css("marginLeft")) +
        parseFloat($content.css("marginRight"));

      maxHeight -=
        parseFloat($slide.css("paddingTop")) +
        parseFloat($slide.css("paddingBottom")) +
        parseFloat($content.css("marginTop")) +
        parseFloat($content.css("marginBottom"));

      if (!width || !height) {
        width = maxWidth;
        height = maxHeight;
      }

      minRatio = Math.min(1, maxWidth / width, maxHeight / height);

      width = minRatio * width;
      height = minRatio * height;

      // Adjust width/height to precisely fit into container
      if (width &gt; maxWidth - 0.5) {
        width = maxWidth;
      }

      if (height &gt; maxHeight - 0.5) {
        height = maxHeight;
      }

      if (slide.type === "image") {
        rez.top = Math.floor((maxHeight - height) * 0.5) + parseFloat($slide.css("paddingTop"));
        rez.left = Math.floor((maxWidth - width) * 0.5) + parseFloat($slide.css("paddingLeft"));
      } else if (slide.contentType === "video") {
        // Force aspect ratio for the video
        // "I say the whole world must learn of our peaceful waysâ€¦ by force!"
        aspectRatio = slide.opts.width &amp;&amp; slide.opts.height ? width / height : slide.opts.ratio || 16 / 9;

        if (height &gt; width / aspectRatio) {
          height = width / aspectRatio;
        } else if (width &gt; height * aspectRatio) {
          width = height * aspectRatio;
        }
      }

      rez.width = width;
      rez.height = height;

      return rez;
    },

    // Update content size and position for all slides
    // ==============================================

    update: function (e) {
      var self = this;

      $.each(self.slides, function (key, slide) {
        self.updateSlide(slide, e);
      });
    },

    // Update slide content position and size
    // ======================================

    updateSlide: function (slide, e) {
      var self = this,
        $content = slide &amp;&amp; slide.$content,
        width = slide.width || slide.opts.width,
        height = slide.height || slide.opts.height,
        $slide = slide.$slide;

      // First, prevent caption overlap, if needed
      self.adjustCaption(slide);

      // Then resize content to fit inside the slide
      if ($content &amp;&amp; (width || height || slide.contentType === "video") &amp;&amp; !slide.hasError) {
        $.fancybox.stop($content);

        $.fancybox.setTranslate($content, self.getFitPos(slide));

        if (slide.pos === self.currPos) {
          self.isAnimating = false;

          self.updateCursor();
        }
      }

      // Then some adjustments
      self.adjustLayout(slide);

      if ($slide.length) {
        $slide.trigger("refresh");

        if (slide.pos === self.currPos) {
          self.$refs.toolbar
            .add(self.$refs.navigation.find(".fancybox-button--arrow_right"))
            .toggleClass("compensate-for-scrollbar", $slide.get(0).scrollHeight &gt; $slide.get(0).clientHeight);
        }
      }

      self.trigger("onUpdate", slide, e);
    },

    // Horizontally center slide
    // =========================

    centerSlide: function (duration) {
      var self = this,
        current = self.current,
        $slide = current.$slide;

      if (self.isClosing || !current) {
        return;
      }

      $slide.siblings().css({
        transform: "",
        opacity: ""
      });

      $slide
        .parent()
        .children()
        .removeClass("fancybox-slide--previous fancybox-slide--next");

      $.fancybox.animate(
        $slide, {
          top: 0,
          left: 0,
          opacity: 1
        },
        duration === undefined ? 0 : duration,
        function () {
          // Clean up
          $slide.css({
            transform: "",
            opacity: ""
          });

          if (!current.isComplete) {
            self.complete();
          }
        },
        false
      );
    },

    // Check if current slide is moved (swiped)
    // ========================================

    isMoved: function (slide) {
      var current = slide || this.current,
        slidePos,
        stagePos;

      if (!current) {
        return false;
      }

      stagePos = $.fancybox.getTranslate(this.$refs.stage);
      slidePos = $.fancybox.getTranslate(current.$slide);

      return (
        !current.$slide.hasClass("fancybox-animated") &amp;&amp;
        (Math.abs(slidePos.top - stagePos.top) &gt; 0.5 || Math.abs(slidePos.left - stagePos.left) &gt; 0.5)
      );
    },

    // Update cursor style depending if content can be zoomed
    // ======================================================

    updateCursor: function (nextWidth, nextHeight) {
      var self = this,
        current = self.current,
        $container = self.$refs.container,
        canPan,
        isZoomable;

      if (!current || self.isClosing || !self.Guestures) {
        return;
      }

      $container.removeClass("fancybox-is-zoomable fancybox-can-zoomIn fancybox-can-zoomOut fancybox-can-swipe fancybox-can-pan");

      canPan = self.canPan(nextWidth, nextHeight);

      isZoomable = canPan ? true : self.isZoomable();

      $container.toggleClass("fancybox-is-zoomable", isZoomable);

      $("[data-fancybox-zoom]").prop("disabled", !isZoomable);

      if (canPan) {
        $container.addClass("fancybox-can-pan");
      } else if (
        isZoomable &amp;&amp;
        (current.opts.clickContent === "zoom" || ($.isFunction(current.opts.clickContent) &amp;&amp; current.opts.clickContent(current) == "zoom"))
      ) {
        $container.addClass("fancybox-can-zoomIn");
      } else if (current.opts.touch &amp;&amp; (current.opts.touch.vertical || self.group.length &gt; 1) &amp;&amp; current.contentType !== "video") {
        $container.addClass("fancybox-can-swipe");
      }
    },

    // Check if current slide is zoomable
    // ==================================

    isZoomable: function () {
      var self = this,
        current = self.current,
        fitPos;

      // Assume that slide is zoomable if:
      //   - image is still loading
      //   - actual size of the image is smaller than available area
      if (current &amp;&amp; !self.isClosing &amp;&amp; current.type === "image" &amp;&amp; !current.hasError) {
        if (!current.isLoaded) {
          return true;
        }

        fitPos = self.getFitPos(current);

        if (fitPos &amp;&amp; (current.width &gt; fitPos.width || current.height &gt; fitPos.height)) {
          return true;
        }
      }

      return false;
    },

    // Check if current image dimensions are smaller than actual
    // =========================================================

    isScaledDown: function (nextWidth, nextHeight) {
      var self = this,
        rez = false,
        current = self.current,
        $content = current.$content;

      if (nextWidth !== undefined &amp;&amp; nextHeight !== undefined) {
        rez = nextWidth &lt; current.width &amp;&amp; nextHeight &lt; current.height;
      } else if ($content) {
        rez = $.fancybox.getTranslate($content);
        rez = rez.width &lt; current.width &amp;&amp; rez.height &lt; current.height;
      }

      return rez;
    },

    // Check if image dimensions exceed parent element
    // ===============================================

    canPan: function (nextWidth, nextHeight) {
      var self = this,
        current = self.current,
        pos = null,
        rez = false;

      if (current.type === "image" &amp;&amp; (current.isComplete || (nextWidth &amp;&amp; nextHeight)) &amp;&amp; !current.hasError) {
        rez = self.getFitPos(current);

        if (nextWidth !== undefined &amp;&amp; nextHeight !== undefined) {
          pos = {
            width: nextWidth,
            height: nextHeight
          };
        } else if (current.isComplete) {
          pos = $.fancybox.getTranslate(current.$content);
        }

        if (pos &amp;&amp; rez) {
          rez = Math.abs(pos.width - rez.width) &gt; 1.5 || Math.abs(pos.height - rez.height) &gt; 1.5;
        }
      }

      return rez;
    },

    // Load content into the slide
    // ===========================

    loadSlide: function (slide) {
      var self = this,
        type,
        $slide,
        ajaxLoad;

      if (slide.isLoading || slide.isLoaded) {
        return;
      }

      slide.isLoading = true;

      if (self.trigger("beforeLoad", slide) === false) {
        slide.isLoading = false;

        return false;
      }

      type = slide.type;
      $slide = slide.$slide;

      $slide
        .off("refresh")
        .trigger("onReset")
        .addClass(slide.opts.slideClass);

      // Create content depending on the type
      switch (type) {
        case "image":
          self.setImage(slide);

          break;

        case "iframe":
          self.setIframe(slide);

          break;

        case "html":
          self.setContent(slide, slide.src || slide.content);

          break;

        case "video":
          self.setContent(
            slide,
            slide.opts.video.tpl
            .replace(/\{\{src\}\}/gi, slide.src)
            .replace("{{format}}", slide.opts.videoFormat || slide.opts.video.format || "")
            .replace("{{poster}}", slide.thumb || "")
          );

          break;

        case "inline":
          if ($(slide.src).length) {
            self.setContent(slide, $(slide.src));
          } else {
            self.setError(slide);
          }

          break;

        case "ajax":
          self.showLoading(slide);

          ajaxLoad = $.ajax(
            $.extend({}, slide.opts.ajax.settings, {
              url: slide.src,
              success: function (data, textStatus) {
                if (textStatus === "success") {
                  self.setContent(slide, data);
                }
              },
              error: function (jqXHR, textStatus) {
                if (jqXHR &amp;&amp; textStatus !== "abort") {
                  self.setError(slide);
                }
              }
            })
          );

          $slide.one("onReset", function () {
            ajaxLoad.abort();
          });

          break;

        default:
          self.setError(slide);

          break;
      }

      return true;
    },

    // Use thumbnail image, if possible
    // ================================

    setImage: function (slide) {
      var self = this,
        ghost;

      // Check if need to show loading icon
      setTimeout(function () {
        var $img = slide.$image;

        if (!self.isClosing &amp;&amp; slide.isLoading &amp;&amp; (!$img || !$img.length || !$img[0].complete) &amp;&amp; !slide.hasError) {
          self.showLoading(slide);
        }
      }, 50);

      //Check if image has srcset
      self.checkSrcset(slide);

      // This will be wrapper containing both ghost and actual image
      slide.$content = $('&lt;div class="fancybox-content"&gt;&lt;/div&gt;')
        .addClass("fancybox-is-hidden")
        .appendTo(slide.$slide.addClass("fancybox-slide--image"));

      // If we have a thumbnail, we can display it while actual image is loading
      // Users will not stare at black screen and actual image will appear gradually
      if (slide.opts.preload !== false &amp;&amp; slide.opts.width &amp;&amp; slide.opts.height &amp;&amp; slide.thumb) {
        slide.width = slide.opts.width;
        slide.height = slide.opts.height;

        ghost = document.createElement("img");

        ghost.onerror = function () {
          $(this).remove();

          slide.$ghost = null;
        };

        ghost.onload = function () {
          self.afterLoad(slide);
        };

        slide.$ghost = $(ghost)
          .addClass("fancybox-image")
          .appendTo(slide.$content)
          .attr("src", slide.thumb);
      }

      // Start loading actual image
      self.setBigImage(slide);
    },

    // Check if image has srcset and get the source
    // ============================================
    checkSrcset: function (slide) {
      var srcset = slide.opts.srcset || slide.opts.image.srcset,
        found,
        temp,
        pxRatio,
        windowWidth;

      // If we have "srcset", then we need to find first matching "src" value.
      // This is necessary, because when you set an src attribute, the browser will preload the image
      // before any javascript or even CSS is applied.
      if (srcset) {
        pxRatio = window.devicePixelRatio || 1;
        windowWidth = window.innerWidth * pxRatio;

        temp = srcset.split(",").map(function (el) {
          var ret = {};

          el.trim()
            .split(/\s+/)
            .forEach(function (el, i) {
              var value = parseInt(el.substring(0, el.length - 1), 10);

              if (i === 0) {
                return (ret.url = el);
              }

              if (value) {
                ret.value = value;
                ret.postfix = el[el.length - 1];
              }
            });

          return ret;
        });

        // Sort by value
        temp.sort(function (a, b) {
          return a.value - b.value;
        });

        // Ok, now we have an array of all srcset values
        for (var j = 0; j &lt; temp.length; j++) {
          var el = temp[j];

          if ((el.postfix === "w" &amp;&amp; el.value &gt;= windowWidth) || (el.postfix === "x" &amp;&amp; el.value &gt;= pxRatio)) {
            found = el;
            break;
          }
        }

        // If not found, take the last one
        if (!found &amp;&amp; temp.length) {
          found = temp[temp.length - 1];
        }

        if (found) {
          slide.src = found.url;

          // If we have default width/height values, we can calculate height for matching source
          if (slide.width &amp;&amp; slide.height &amp;&amp; found.postfix == "w") {
            slide.height = (slide.width / slide.height) * found.value;
            slide.width = found.value;
          }

          slide.opts.srcset = srcset;
        }
      }
    },

    // Create full-size image
    // ======================

    setBigImage: function (slide) {
      var self = this,
        img = document.createElement("img"),
        $img = $(img);

      slide.$image = $img
        .one("error", function () {
          self.setError(slide);
        })
        .one("load", function () {
          var sizes;

          if (!slide.$ghost) {
            self.resolveImageSlideSize(slide, this.naturalWidth, this.naturalHeight);

            self.afterLoad(slide);
          }

          if (self.isClosing) {
            return;
          }

          if (slide.opts.srcset) {
            sizes = slide.opts.sizes;

            if (!sizes || sizes === "auto") {
              sizes =
                (slide.width / slide.height &gt; 1 &amp;&amp; $W.width() / $W.height() &gt; 1 ? "100" : Math.round((slide.width / slide.height) * 100)) +
                "vw";
            }

            $img.attr("sizes", sizes).attr("srcset", slide.opts.srcset);
          }

          // Hide temporary image after some delay
          if (slide.$ghost) {
            setTimeout(function () {
              if (slide.$ghost &amp;&amp; !self.isClosing) {
                slide.$ghost.hide();
              }
            }, Math.min(300, Math.max(1000, slide.height / 1600)));
          }

          self.hideLoading(slide);
        })
        .addClass("fancybox-image")
        .attr("src", slide.src)
        .appendTo(slide.$content);

      if ((img.complete || img.readyState == "complete") &amp;&amp; $img.naturalWidth &amp;&amp; $img.naturalHeight) {
        $img.trigger("load");
      } else if (img.error) {
        $img.trigger("error");
      }
    },

    // Computes the slide size from image size and maxWidth/maxHeight
    // ==============================================================

    resolveImageSlideSize: function (slide, imgWidth, imgHeight) {
      var maxWidth = parseInt(slide.opts.width, 10),
        maxHeight = parseInt(slide.opts.height, 10);

      // Sets the default values from the image
      slide.width = imgWidth;
      slide.height = imgHeight;

      if (maxWidth &gt; 0) {
        slide.width = maxWidth;
        slide.height = Math.floor((maxWidth * imgHeight) / imgWidth);
      }

      if (maxHeight &gt; 0) {
        slide.width = Math.floor((maxHeight * imgWidth) / imgHeight);
        slide.height = maxHeight;
      }
    },

    // Create iframe wrapper, iframe and bindings
    // ==========================================

    setIframe: function (slide) {
      var self = this,
        opts = slide.opts.iframe,
        $slide = slide.$slide,
        $iframe;

      slide.$content = $('&lt;div class="fancybox-content' + (opts.preload ? " fancybox-is-hidden" : "") + '"&gt;&lt;/div&gt;')
        .css(opts.css)
        .appendTo($slide);

      $slide.addClass("fancybox-slide--" + slide.contentType);

      slide.$iframe = $iframe = $(opts.tpl.replace(/\{rnd\}/g, new Date().getTime()))
        .attr(opts.attr)
        .appendTo(slide.$content);

      if (opts.preload) {
        self.showLoading(slide);

        // Unfortunately, it is not always possible to determine if iframe is successfully loaded
        // (due to browser security policy)

        $iframe.on("load.fb error.fb", function (e) {
          this.isReady = 1;

          slide.$slide.trigger("refresh");

          self.afterLoad(slide);
        });

        // Recalculate iframe content size
        // ===============================

        $slide.on("refresh.fb", function () {
          var $content = slide.$content,
            frameWidth = opts.css.width,
            frameHeight = opts.css.height,
            $contents,
            $body;

          if ($iframe[0].isReady !== 1) {
            return;
          }

          try {
            $contents = $iframe.contents();
            $body = $contents.find("body");
          } catch (ignore) {}

          // Calculate content dimensions, if it is accessible
          if ($body &amp;&amp; $body.length &amp;&amp; $body.children().length) {
            // Avoid scrolling to top (if multiple instances)
            $slide.css("overflow", "visible");

            $content.css({
              width: "100%",
              "max-width": "100%",
              height: "9999px"
            });

            if (frameWidth === undefined) {
              frameWidth = Math.ceil(Math.max($body[0].clientWidth, $body.outerWidth(true)));
            }

            $content.css("width", frameWidth ? frameWidth : "").css("max-width", "");

            if (frameHeight === undefined) {
              frameHeight = Math.ceil(Math.max($body[0].clientHeight, $body.outerHeight(true)));
            }

            $content.css("height", frameHeight ? frameHeight : "");

            $slide.css("overflow", "auto");
          }

          $content.removeClass("fancybox-is-hidden");
        });
      } else {
        self.afterLoad(slide);
      }

      $iframe.attr("src", slide.src);

      // Remove iframe if closing or changing gallery item
      $slide.one("onReset", function () {
        // This helps IE not to throw errors when closing
        try {
          $(this)
            .find("iframe")
            .hide()
            .unbind()
            .attr("src", "//about:blank");
        } catch (ignore) {}

        $(this)
          .off("refresh.fb")
          .empty();

        slide.isLoaded = false;
        slide.isRevealed = false;
      });
    },

    // Wrap and append content to the slide
    // ======================================

    setContent: function (slide, content) {
      var self = this;

      if (self.isClosing) {
        return;
      }

      self.hideLoading(slide);

      if (slide.$content) {
        $.fancybox.stop(slide.$content);
      }

      slide.$slide.empty();

      // If content is a jQuery object, then it will be moved to the slide.
      // The placeholder is created so we will know where to put it back.
      if (isQuery(content) &amp;&amp; content.parent().length) {
        // Make sure content is not already moved to fancyBox
        if (content.hasClass("fancybox-content") || content.parent().hasClass("fancybox-content")) {
          content.parents(".fancybox-slide").trigger("onReset");
        }

        // Create temporary element marking original place of the content
        slide.$placeholder = $("&lt;div&gt;")
          .hide()
          .insertAfter(content);

        // Make sure content is visible
        content.css("display", "inline-block");
      } else if (!slide.hasError) {
        // If content is just a plain text, try to convert it to html
        if ($.type(content) === "string") {
          content = $("&lt;div&gt;")
            .append($.trim(content))
            .contents();
        }

        // If "filter" option is provided, then filter content
        if (slide.opts.filter) {
          content = $("&lt;div&gt;")
            .html(content)
            .find(slide.opts.filter);
        }
      }

      slide.$slide.one("onReset", function () {
        // Pause all html5 video/audio
        $(this)
          .find("video,audio")
          .trigger("pause");

        // Put content back
        if (slide.$placeholder) {
          slide.$placeholder.after(content.removeClass("fancybox-content").hide()).remove();

          slide.$placeholder = null;
        }

        // Remove custom close button
        if (slide.$smallBtn) {
          slide.$smallBtn.remove();

          slide.$smallBtn = null;
        }

        // Remove content and mark slide as not loaded
        if (!slide.hasError) {
          $(this).empty();

          slide.isLoaded = false;
          slide.isRevealed = false;
        }
      });

      $(content).appendTo(slide.$slide);

      if ($(content).is("video,audio")) {
        $(content).addClass("fancybox-video");

        $(content).wrap("&lt;div&gt;&lt;/div&gt;");

        slide.contentType = "video";

        slide.opts.width = slide.opts.width || $(content).attr("width");
        slide.opts.height = slide.opts.height || $(content).attr("height");
      }

      slide.$content = slide.$slide
        .children()
        .filter("div,form,main,video,audio,article,.fancybox-content")
        .first();

      slide.$content.siblings().hide();

      // Re-check if there is a valid content
      // (in some cases, ajax response can contain various elements or plain text)
      if (!slide.$content.length) {
        slide.$content = slide.$slide
          .wrapInner("&lt;div&gt;&lt;/div&gt;")
          .children()
          .first();
      }

      slide.$content.addClass("fancybox-content");

      slide.$slide.addClass("fancybox-slide--" + slide.contentType);

      self.afterLoad(slide);
    },

    // Display error message
    // =====================

    setError: function (slide) {
      slide.hasError = true;

      slide.$slide
        .trigger("onReset")
        .removeClass("fancybox-slide--" + slide.contentType)
        .addClass("fancybox-slide--error");

      slide.contentType = "html";

      this.setContent(slide, this.translate(slide, slide.opts.errorTpl));

      if (slide.pos === this.currPos) {
        this.isAnimating = false;
      }
    },

    // Show loading icon inside the slide
    // ==================================

    showLoading: function (slide) {
      var self = this;

      slide = slide || self.current;

      if (slide &amp;&amp; !slide.$spinner) {
        slide.$spinner = $(self.translate(self, self.opts.spinnerTpl))
          .appendTo(slide.$slide)
          .hide()
          .fadeIn("fast");
      }
    },

    // Remove loading icon from the slide
    // ==================================

    hideLoading: function (slide) {
      var self = this;

      slide = slide || self.current;

      if (slide &amp;&amp; slide.$spinner) {
        slide.$spinner.stop().remove();

        delete slide.$spinner;
      }
    },

    // Adjustments after slide content has been loaded
    // ===============================================

    afterLoad: function (slide) {
      var self = this;

      if (self.isClosing) {
        return;
      }

      slide.isLoading = false;
      slide.isLoaded = true;

      self.trigger("afterLoad", slide);

      self.hideLoading(slide);

      // Add small close button
      if (slide.opts.smallBtn &amp;&amp; (!slide.$smallBtn || !slide.$smallBtn.length)) {
        slide.$smallBtn = $(self.translate(slide, slide.opts.btnTpl.smallBtn)).appendTo(slide.$content);
      }

      // Disable right click
      if (slide.opts.protect &amp;&amp; slide.$content &amp;&amp; !slide.hasError) {
        slide.$content.on("contextmenu.fb", function (e) {
          if (e.button == 2) {
            e.preventDefault();
          }

          return true;
        });

        // Add fake element on top of the image
        // This makes a bit harder for user to select image
        if (slide.type === "image") {
          $('&lt;div class="fancybox-spaceball"&gt;&lt;/div&gt;').appendTo(slide.$content);
        }
      }

      self.adjustCaption(slide);

      self.adjustLayout(slide);

      if (slide.pos === self.currPos) {
        self.updateCursor();
      }

      self.revealContent(slide);
    },

    // Prevent caption overlap,
    // fix css inconsistency across browsers
    // =====================================

    adjustCaption: function (slide) {
      var self = this,
        current = slide || self.current,
        caption = current.opts.caption,
        preventOverlap = current.opts.preventCaptionOverlap,
        $caption = self.$refs.caption,
        $clone,
        captionH = false;

      $caption.toggleClass("fancybox-caption--separate", preventOverlap);

      if (preventOverlap &amp;&amp; caption &amp;&amp; caption.length) {
        if (current.pos !== self.currPos) {
          $clone = $caption.clone().appendTo($caption.parent());

          $clone
            .children()
            .eq(0)
            .empty()
            .html(caption);

          captionH = $clone.outerHeight(true);

          $clone.empty().remove();
        } else if (self.$caption) {
          captionH = self.$caption.outerHeight(true);
        }

        current.$slide.css("padding-bottom", captionH || "");
      }
    },

    // Simple hack to fix inconsistency across browsers, described here (affects Edge, too):
    // https://bugzilla.mozilla.org/show_bug.cgi?id=748518
    // ====================================================================================

    adjustLayout: function (slide) {
      var self = this,
        current = slide || self.current,
        scrollHeight,
        marginBottom,
        inlinePadding,
        actualPadding;

      if (current.isLoaded &amp;&amp; current.opts.disableLayoutFix !== true) {
        current.$content.css("margin-bottom", "");

        // If we would always set margin-bottom for the content,
        // then it would potentially break vertical align
        if (current.$content.outerHeight() &gt; current.$slide.height() + 0.5) {
          inlinePadding = current.$slide[0].style["padding-bottom"];
          actualPadding = current.$slide.css("padding-bottom");

          if (parseFloat(actualPadding) &gt; 0) {
            scrollHeight = current.$slide[0].scrollHeight;

            current.$slide.css("padding-bottom", 0);

            if (Math.abs(scrollHeight - current.$slide[0].scrollHeight) &lt; 1) {
              marginBottom = actualPadding;
            }

            current.$slide.css("padding-bottom", inlinePadding);
          }
        }

        current.$content.css("margin-bottom", marginBottom);
      }
    },

    // Make content visible
    // This method is called right after content has been loaded or
    // user navigates gallery and transition should start
    // ============================================================

    revealContent: function (slide) {
      var self = this,
        $slide = slide.$slide,
        end = false,
        start = false,
        isMoved = self.isMoved(slide),
        isRevealed = slide.isRevealed,
        effect,
        effectClassName,
        duration,
        opacity;

      slide.isRevealed = true;

      effect = slide.opts[self.firstRun ? "animationEffect" : "transitionEffect"];
      duration = slide.opts[self.firstRun ? "animationDuration" : "transitionDuration"];

      duration = parseInt(slide.forcedDuration === undefined ? duration : slide.forcedDuration, 10);

      if (isMoved || slide.pos !== self.currPos || !duration) {
        effect = false;
      }

      // Check if can zoom
      if (effect === "zoom") {
        if (slide.pos === self.currPos &amp;&amp; duration &amp;&amp; slide.type === "image" &amp;&amp; !slide.hasError &amp;&amp; (start = self.getThumbPos(slide))) {
          end = self.getFitPos(slide);
        } else {
          effect = "fade";
        }
      }

      // Zoom animation
      // ==============
      if (effect === "zoom") {
        self.isAnimating = true;

        end.scaleX = end.width / start.width;
        end.scaleY = end.height / start.height;

        // Check if we need to animate opacity
        opacity = slide.opts.zoomOpacity;

        if (opacity == "auto") {
          opacity = Math.abs(slide.width / slide.height - start.width / start.height) &gt; 0.1;
        }

        if (opacity) {
          start.opacity = 0.1;
          end.opacity = 1;
        }

        // Draw image at start position
        $.fancybox.setTranslate(slide.$content.removeClass("fancybox-is-hidden"), start);

        forceRedraw(slide.$content);

        // Start animation
        $.fancybox.animate(slide.$content, end, duration, function () {
          self.isAnimating = false;

          self.complete();
        });

        return;
      }

      self.updateSlide(slide);

      // Simply show content if no effect
      // ================================
      if (!effect) {
        slide.$content.removeClass("fancybox-is-hidden");

        if (!isRevealed &amp;&amp; isMoved &amp;&amp; slide.type === "image" &amp;&amp; !slide.hasError) {
          slide.$content.hide().fadeIn("fast");
        }

        if (slide.pos === self.currPos) {
          self.complete();
        }

        return;
      }

      // Prepare for CSS transiton
      // =========================
      $.fancybox.stop($slide);

      //effectClassName = "fancybox-animated fancybox-slide--" + (slide.pos &gt;= self.prevPos ? "next" : "previous") + " fancybox-fx-" + effect;
      effectClassName = "fancybox-slide--" + (slide.pos &gt;= self.prevPos ? "next" : "previous") + " fancybox-animated fancybox-fx-" + effect;

      $slide.addClass(effectClassName).removeClass("fancybox-slide--current"); //.addClass(effectClassName);

      slide.$content.removeClass("fancybox-is-hidden");

      // Force reflow
      forceRedraw($slide);

      if (slide.type !== "image") {
        slide.$content.hide().show(0);
      }

      $.fancybox.animate(
        $slide,
        "fancybox-slide--current",
        duration,
        function () {
          $slide.removeClass(effectClassName).css({
            transform: "",
            opacity: ""
          });

          if (slide.pos === self.currPos) {
            self.complete();
          }
        },
        true
      );
    },

    // Check if we can and have to zoom from thumbnail
    //================================================

    getThumbPos: function (slide) {
      var rez = false,
        $thumb = slide.$thumb,
        thumbPos,
        btw,
        brw,
        bbw,
        blw;

      if (!$thumb || !inViewport($thumb[0])) {
        return false;
      }

      thumbPos = $.fancybox.getTranslate($thumb);

      btw = parseFloat($thumb.css("border-top-width") || 0);
      brw = parseFloat($thumb.css("border-right-width") || 0);
      bbw = parseFloat($thumb.css("border-bottom-width") || 0);
      blw = parseFloat($thumb.css("border-left-width") || 0);

      rez = {
        top: thumbPos.top + btw,
        left: thumbPos.left + blw,
        width: thumbPos.width - brw - blw,
        height: thumbPos.height - btw - bbw,
        scaleX: 1,
        scaleY: 1
      };

      return thumbPos.width &gt; 0 &amp;&amp; thumbPos.height &gt; 0 ? rez : false;
    },

    // Final adjustments after current gallery item is moved to position
    // and it`s content is loaded
    // ==================================================================

    complete: function () {
      var self = this,
        current = self.current,
        slides = {},
        $el;

      if (self.isMoved() || !current.isLoaded) {
        return;
      }

      if (!current.isComplete) {
        current.isComplete = true;

        current.$slide.siblings().trigger("onReset");

        self.preload("inline");

        // Trigger any CSS transiton inside the slide
        forceRedraw(current.$slide);

        current.$slide.addClass("fancybox-slide--complete");

        // Remove unnecessary slides
        $.each(self.slides, function (key, slide) {
          if (slide.pos &gt;= self.currPos - 1 &amp;&amp; slide.pos &lt;= self.currPos + 1) {
            slides[slide.pos] = slide;
          } else if (slide) {
            $.fancybox.stop(slide.$slide);

            slide.$slide.off().remove();
          }
        });

        self.slides = slides;
      }

      self.isAnimating = false;

      self.updateCursor();

      self.trigger("afterShow");

      // Autoplay first html5 video/audio
      if (!!current.opts.video.autoStart) {
        current.$slide
          .find("video,audio")
          .filter(":visible:first")
          .trigger("play")
          .one("ended", function () {
            if (Document.exitFullscreen) {
              Document.exitFullscreen();
            } else if (this.webkitExitFullscreen) {
              this.webkitExitFullscreen();
            }

            self.next();
          });
      }

      // Try to focus on the first focusable element
      if (current.opts.autoFocus &amp;&amp; current.contentType === "html") {
        // Look for the first input with autofocus attribute
        $el = current.$content.find("input[autofocus]:enabled:visible:first");

        if ($el.length) {
          $el.trigger("focus");
        } else {
          self.focus(null, true);
        }
      }

      // Avoid jumping
      current.$slide.scrollTop(0).scrollLeft(0);
    },

    // Preload next and previous slides
    // ================================

    preload: function (type) {
      var self = this,
        prev,
        next;

      if (self.group.length &lt; 2) {
        return;
      }

      next = self.slides[self.currPos + 1];
      prev = self.slides[self.currPos - 1];

      if (prev &amp;&amp; prev.type === type) {
        self.loadSlide(prev);
      }

      if (next &amp;&amp; next.type === type) {
        self.loadSlide(next);
      }
    },

    // Try to find and focus on the first focusable element
    // ====================================================

    focus: function (e, firstRun) {
      var self = this,
        focusableStr = [
          "a[href]",
          "area[href]",
          'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
          "select:not([disabled]):not([aria-hidden])",
          "textarea:not([disabled]):not([aria-hidden])",
          "button:not([disabled]):not([aria-hidden])",
          "iframe",
          "object",
          "embed",
          "video",
          "audio",
          "[contenteditable]",
          '[tabindex]:not([tabindex^="-"])'
        ].join(","),
        focusableItems,
        focusedItemIndex;

      if (self.isClosing) {
        return;
      }

      if (e || !self.current || !self.current.isComplete) {
        // Focus on any element inside fancybox
        focusableItems = self.$refs.container.find("*:visible");
      } else {
        // Focus inside current slide
        focusableItems = self.current.$slide.find("*:visible" + (firstRun ? ":not(.fancybox-close-small)" : ""));
      }

      focusableItems = focusableItems.filter(focusableStr).filter(function () {
        return $(this).css("visibility") !== "hidden" &amp;&amp; !$(this).hasClass("disabled");
      });

      if (focusableItems.length) {
        focusedItemIndex = focusableItems.index(document.activeElement);

        if (e &amp;&amp; e.shiftKey) {
          // Back tab
          if (focusedItemIndex &lt; 0 || focusedItemIndex == 0) {
            e.preventDefault();

            focusableItems.eq(focusableItems.length - 1).trigger("focus");
          }
        } else {
          // Outside or Forward tab
          if (focusedItemIndex &lt; 0 || focusedItemIndex == focusableItems.length - 1) {
            if (e) {
              e.preventDefault();
            }

            focusableItems.eq(0).trigger("focus");
          }
        }
      } else {
        self.$refs.container.trigger("focus");
      }
    },

    // Activates current instance - brings container to the front and enables keyboard,
    // notifies other instances about deactivating
    // =================================================================================

    activate: function () {
      var self = this;

      // Deactivate all instances
      $(".fancybox-container").each(function () {
        var instance = $(this).data("FancyBox");

        // Skip self and closing instances
        if (instance &amp;&amp; instance.id !== self.id &amp;&amp; !instance.isClosing) {
          instance.trigger("onDeactivate");

          instance.removeEvents();

          instance.isVisible = false;
        }
      });

      self.isVisible = true;

      if (self.current || self.isIdle) {
        self.update();

        self.updateControls();
      }

      self.trigger("onActivate");

      self.addEvents();
    },

    // Start closing procedure
    // This will start "zoom-out" animation if needed and clean everything up afterwards
    // =================================================================================

    close: function (e, d) {
      var self = this,
        current = self.current,
        effect,
        duration,
        $content,
        domRect,
        opacity,
        start,
        end;

      var done = function () {
        self.cleanUp(e);
      };

      if (self.isClosing) {
        return false;
      }

      self.isClosing = true;

      // If beforeClose callback prevents closing, make sure content is centered
      if (self.trigger("beforeClose", e) === false) {
        self.isClosing = false;

        requestAFrame(function () {
          self.update();
        });

        return false;
      }

      // Remove all events
      // If there are multiple instances, they will be set again by "activate" method
      self.removeEvents();

      $content = current.$content;
      effect = current.opts.animationEffect;
      duration = $.isNumeric(d) ? d : effect ? current.opts.animationDuration : 0;

      current.$slide.removeClass("fancybox-slide--complete fancybox-slide--next fancybox-slide--previous fancybox-animated");

      if (e !== true) {
        $.fancybox.stop(current.$slide);
      } else {
        effect = false;
      }

      // Remove other slides
      current.$slide
        .siblings()
        .trigger("onReset")
        .remove();

      // Trigger animations
      if (duration) {
        self.$refs.container
          .removeClass("fancybox-is-open")
          .addClass("fancybox-is-closing")
          .css("transition-duration", duration + "ms");
      }

      // Clean up
      self.hideLoading(current);

      self.hideControls(true);

      self.updateCursor();

      // Check if possible to zoom-out
      if (
        effect === "zoom" &amp;&amp;
        !($content &amp;&amp; duration &amp;&amp; current.type === "image" &amp;&amp; !self.isMoved() &amp;&amp; !current.hasError &amp;&amp; (end = self.getThumbPos(current)))
      ) {
        effect = "fade";
      }

      if (effect === "zoom") {
        $.fancybox.stop($content);

        domRect = $.fancybox.getTranslate($content);

        start = {
          top: domRect.top,
          left: domRect.left,
          scaleX: domRect.width / end.width,
          scaleY: domRect.height / end.height,
          width: end.width,
          height: end.height
        };

        // Check if we need to animate opacity
        opacity = current.opts.zoomOpacity;

        if (opacity == "auto") {
          opacity = Math.abs(current.width / current.height - end.width / end.height) &gt; 0.1;
        }

        if (opacity) {
          end.opacity = 0;
        }

        $.fancybox.setTranslate($content, start);

        forceRedraw($content);

        $.fancybox.animate($content, end, duration, done);

        return true;
      }

      if (effect &amp;&amp; duration) {
        $.fancybox.animate(
          current.$slide.addClass("fancybox-slide--previous").removeClass("fancybox-slide--current"),
          "fancybox-animated fancybox-fx-" + effect,
          duration,
          done
        );
      } else {
        // If skip animation
        if (e === true) {
          setTimeout(done, duration);
        } else {
          done();
        }
      }

      return true;
    },

    // Final adjustments after removing the instance
    // =============================================

    cleanUp: function (e) {
      var self = this,
        instance,
        $focus = self.current.opts.$orig,
        x,
        y;

      self.current.$slide.trigger("onReset");

      self.$refs.container.empty().remove();

      self.trigger("afterClose", e);

      // Place back focus
      if (!!self.current.opts.backFocus) {
        if (!$focus || !$focus.length || !$focus.is(":visible")) {
          $focus = self.$trigger;
        }

        if ($focus &amp;&amp; $focus.length) {
          x = window.scrollX;
          y = window.scrollY;

          $focus.trigger("focus");

          $("html, body")
            .scrollTop(y)
            .scrollLeft(x);
        }
      }

      self.current = null;

      // Check if there are other instances
      instance = $.fancybox.getInstance();

      if (instance) {
        instance.activate();
      } else {
        $("body").removeClass("fancybox-active compensate-for-scrollbar");

        $("#fancybox-style-noscroll").remove();
      }
    },

    // Call callback and trigger an event
    // ==================================

    trigger: function (name, slide) {
      var args = Array.prototype.slice.call(arguments, 1),
        self = this,
        obj = slide &amp;&amp; slide.opts ? slide : self.current,
        rez;

      if (obj) {
        args.unshift(obj);
      } else {
        obj = self;
      }

      args.unshift(self);

      if ($.isFunction(obj.opts[name])) {
        rez = obj.opts[name].apply(obj, args);
      }

      if (rez === false) {
        return rez;
      }

      if (name === "afterClose" || !self.$refs) {
        $D.trigger(name + ".fb", args);
      } else {
        self.$refs.container.trigger(name + ".fb", args);
      }
    },

    // Update infobar values, navigation button states and reveal caption
    // ==================================================================

    updateControls: function () {
      var self = this,
        current = self.current,
        index = current.index,
        $container = self.$refs.container,
        $caption = self.$refs.caption,
        caption = current.opts.caption;

      // Recalculate content dimensions
      current.$slide.trigger("refresh");

      // Set caption
      if (caption &amp;&amp; caption.length) {
        self.$caption = $caption;

        $caption
          .children()
          .eq(0)
          .html(caption);
      } else {
        self.$caption = null;
      }

      if (!self.hasHiddenControls &amp;&amp; !self.isIdle) {
        self.showControls();
      }

      // Update info and navigation elements
      $container.find("[data-fancybox-count]").html(self.group.length);
      $container.find("[data-fancybox-index]").html(index + 1);

      $container.find("[data-fancybox-prev]").prop("disabled", !current.opts.loop &amp;&amp; index &lt;= 0);
      $container.find("[data-fancybox-next]").prop("disabled", !current.opts.loop &amp;&amp; index &gt;= self.group.length - 1);

      if (current.type === "image") {
        // Re-enable buttons; update download button source
        $container
          .find("[data-fancybox-zoom]")
          .show()
          .end()
          .find("[data-fancybox-download]")
          .attr("href", current.opts.image.src || current.src)
          .show();
      } else if (current.opts.toolbar) {
        $container.find("[data-fancybox-download],[data-fancybox-zoom]").hide();
      }

      // Make sure focus is not on disabled button/element
      if ($(document.activeElement).is(":hidden,[disabled]")) {
        self.$refs.container.trigger("focus");
      }
    },

    // Hide toolbar and caption
    // ========================

    hideControls: function (andCaption) {
      var self = this,
        arr = ["infobar", "toolbar", "nav"];

      if (andCaption || !self.current.opts.preventCaptionOverlap) {
        arr.push("caption");
      }

      this.$refs.container.removeClass(
        arr
        .map(function (i) {
          return "fancybox-show-" + i;
        })
        .join(" ")
      );

      this.hasHiddenControls = true;
    },

    showControls: function () {
      var self = this,
        opts = self.current ? self.current.opts : self.opts,
        $container = self.$refs.container;

      self.hasHiddenControls = false;
      self.idleSecondsCounter = 0;

      $container
        .toggleClass("fancybox-show-toolbar", !!(opts.toolbar &amp;&amp; opts.buttons))
        .toggleClass("fancybox-show-infobar", !!(opts.infobar &amp;&amp; self.group.length &gt; 1))
        .toggleClass("fancybox-show-caption", !!self.$caption)
        .toggleClass("fancybox-show-nav", !!(opts.arrows &amp;&amp; self.group.length &gt; 1))
        .toggleClass("fancybox-is-modal", !!opts.modal);
    },

    // Toggle toolbar and caption
    // ==========================

    toggleControls: function () {
      if (this.hasHiddenControls) {
        this.showControls();
      } else {
        this.hideControls();
      }
    }
  });

  $.fancybox = {
    version: "3.5.7",
    defaults: defaults,

    // Get current instance and execute a command.
    //
    // Examples of usage:
    //
    //   $instance = $.fancybox.getInstance();
    //   $.fancybox.getInstance().jumpTo( 1 );
    //   $.fancybox.getInstance( 'jumpTo', 1 );
    //   $.fancybox.getInstance( function() {
    //       console.info( this.currIndex );
    //   });
    // ======================================================

    getInstance: function (command) {
      var instance = $('.fancybox-container:not(".fancybox-is-closing"):last').data("FancyBox"),
        args = Array.prototype.slice.call(arguments, 1);

      if (instance instanceof FancyBox) {
        if ($.type(command) === "string") {
          instance[command].apply(instance, args);
        } else if ($.type(command) === "function") {
          command.apply(instance, args);
        }

        return instance;
      }

      return false;
    },

    // Create new instance
    // ===================

    open: function (items, opts, index) {
      return new FancyBox(items, opts, index);
    },

    // Close current or all instances
    // ==============================

    close: function (all) {
      var instance = this.getInstance();

      if (instance) {
        instance.close();

        // Try to find and close next instance
        if (all === true) {
          this.close(all);
        }
      }
    },

    // Close all instances and unbind all events
    // =========================================

    destroy: function () {
      this.close(true);

      $D.add("body").off("click.fb-start", "**");
    },

    // Try to detect mobile devices
    // ============================

    isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),

    // Detect if 'translate3d' support is available
    // ============================================

    use3d: (function () {
      var div = document.createElement("div");

      return (
        window.getComputedStyle &amp;&amp;
        window.getComputedStyle(div) &amp;&amp;
        window.getComputedStyle(div).getPropertyValue("transform") &amp;&amp;
        !(document.documentMode &amp;&amp; document.documentMode &lt; 11)
      );
    })(),

    // Helper function to get current visual state of an element
    // returns array[ top, left, horizontal-scale, vertical-scale, opacity ]
    // =====================================================================

    getTranslate: function ($el) {
      var domRect;

      if (!$el || !$el.length) {
        return false;
      }

      domRect = $el[0].getBoundingClientRect();

      return {
        top: domRect.top || 0,
        left: domRect.left || 0,
        width: domRect.width,
        height: domRect.height,
        opacity: parseFloat($el.css("opacity"))
      };
    },

    // Shortcut for setting "translate3d" properties for element
    // Can set be used to set opacity, too
    // ========================================================

    setTranslate: function ($el, props) {
      var str = "",
        css = {};

      if (!$el || !props) {
        return;
      }

      if (props.left !== undefined || props.top !== undefined) {
        str =
          (props.left === undefined ? $el.position().left : props.left) +
          "px, " +
          (props.top === undefined ? $el.position().top : props.top) +
          "px";

        if (this.use3d) {
          str = "translate3d(" + str + ", 0px)";
        } else {
          str = "translate(" + str + ")";
        }
      }

      if (props.scaleX !== undefined &amp;&amp; props.scaleY !== undefined) {
        str += " scale(" + props.scaleX + ", " + props.scaleY + ")";
      } else if (props.scaleX !== undefined) {
        str += " scaleX(" + props.scaleX + ")";
      }

      if (str.length) {
        css.transform = str;
      }

      if (props.opacity !== undefined) {
        css.opacity = props.opacity;
      }

      if (props.width !== undefined) {
        css.width = props.width;
      }

      if (props.height !== undefined) {
        css.height = props.height;
      }

      return $el.css(css);
    },

    // Simple CSS transition handler
    // =============================

    animate: function ($el, to, duration, callback, leaveAnimationName) {
      var self = this,
        from;

      if ($.isFunction(duration)) {
        callback = duration;
        duration = null;
      }

      self.stop($el);

      from = self.getTranslate($el);

      $el.on(transitionEnd, function (e) {
        // Skip events from child elements and z-index change
        if (e &amp;&amp; e.originalEvent &amp;&amp; (!$el.is(e.originalEvent.target) || e.originalEvent.propertyName == "z-index")) {
          return;
        }

        self.stop($el);

        if ($.isNumeric(duration)) {
          $el.css("transition-duration", "");
        }

        if ($.isPlainObject(to)) {
          if (to.scaleX !== undefined &amp;&amp; to.scaleY !== undefined) {
            self.setTranslate($el, {
              top: to.top,
              left: to.left,
              width: from.width * to.scaleX,
              height: from.height * to.scaleY,
              scaleX: 1,
              scaleY: 1
            });
          }
        } else if (leaveAnimationName !== true) {
          $el.removeClass(to);
        }

        if ($.isFunction(callback)) {
          callback(e);
        }
      });

      if ($.isNumeric(duration)) {
        $el.css("transition-duration", duration + "ms");
      }

      // Start animation by changing CSS properties or class name
      if ($.isPlainObject(to)) {
        if (to.scaleX !== undefined &amp;&amp; to.scaleY !== undefined) {
          delete to.width;
          delete to.height;

          if ($el.parent().hasClass("fancybox-slide--image")) {
            $el.parent().addClass("fancybox-is-scaling");
          }
        }

        $.fancybox.setTranslate($el, to);
      } else {
        $el.addClass(to);
      }

      // Make sure that `transitionend` callback gets fired
      $el.data(
        "timer",
        setTimeout(function () {
          $el.trigger(transitionEnd);
        }, duration + 33)
      );
    },

    stop: function ($el, callCallback) {
      if ($el &amp;&amp; $el.length) {
        clearTimeout($el.data("timer"));

        if (callCallback) {
          $el.trigger(transitionEnd);
        }

        $el.off(transitionEnd).css("transition-duration", "");

        $el.parent().removeClass("fancybox-is-scaling");
      }
    }
  };

  // Default click handler for "fancyboxed" links
  // ============================================

  function _run(e, opts) {
    var items = [],
      index = 0,
      $target,
      value,
      instance;

    // Avoid opening multiple times
    if (e &amp;&amp; e.isDefaultPrevented()) {
      return;
    }

    e.preventDefault();

    opts = opts || {};

    if (e &amp;&amp; e.data) {
      opts = mergeOpts(e.data.options, opts);
    }

    $target = opts.$target || $(e.currentTarget).trigger("blur");
    instance = $.fancybox.getInstance();

    if (instance &amp;&amp; instance.$trigger &amp;&amp; instance.$trigger.is($target)) {
      return;
    }

    if (opts.selector) {
      items = $(opts.selector);
    } else {
      // Get all related items and find index for clicked one
      value = $target.attr("data-fancybox") || "";

      if (value) {
        items = e.data ? e.data.items : [];
        items = items.length ? items.filter('[data-fancybox="' + value + '"]') : $('[data-fancybox="' + value + '"]');
      } else {
        items = [$target];
      }
    }

    index = $(items).index($target);

    // Sometimes current item can not be found
    if (index &lt; 0) {
      index = 0;
    }

    instance = $.fancybox.open(items, opts, index);

    // Save last active element
    instance.$trigger = $target;
  }

  // Create a jQuery plugin
  // ======================

  $.fn.fancybox = function (options) {
    var selector;

    options = options || {};
    selector = options.selector || false;

    if (selector) {
      // Use body element instead of document so it executes first
      $("body")
        .off("click.fb-start", selector)
        .on("click.fb-start", selector, {
          options: options
        }, _run);
    } else {
      this.off("click.fb-start").on(
        "click.fb-start", {
          items: this,
          options: options
        },
        _run
      );
    }

    return this;
  };

  // Self initializing plugin for all elements having `data-fancybox` attribute
  // ==========================================================================

  $D.on("click.fb-start", "[data-fancybox]", _run);

  // Enable "trigger elements"
  // =========================

  $D.on("click.fb-start", "[data-fancybox-trigger]", function (e) {
    $('[data-fancybox="' + $(this).attr("data-fancybox-trigger") + '"]')
      .eq($(this).attr("data-fancybox-index") || 0)
      .trigger("click.fb-start", {
        $trigger: $(this)
      });
  });

  // Track focus event for better accessibility styling
  // ==================================================
  (function () {
    var buttonStr = ".fancybox-button",
      focusStr = "fancybox-focus",
      $pressed = null;

    $D.on("mousedown mouseup focus blur", buttonStr, function (e) {
      switch (e.type) {
        case "mousedown":
          $pressed = $(this);
          break;
        case "mouseup":
          $pressed = null;
          break;
        case "focusin":
          $(buttonStr).removeClass(focusStr);

          if (!$(this).is($pressed) &amp;&amp; !$(this).is("[disabled]")) {
            $(this).addClass(focusStr);
          }
          break;
        case "focusout":
          $(buttonStr).removeClass(focusStr);
          break;
      }
    });
  })();
})(window, document, jQuery);
// ==========================================================================
//
// Media
// Adds additional media type support
//
// ==========================================================================
(function ($) {
  "use strict";

  // Object containing properties for each media type
  var defaults = {
    youtube: {
      matcher: /(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&amp;)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&amp;list=(.*))(.*)/i,
      params: {
        autoplay: 1,
        autohide: 1,
        fs: 1,
        rel: 0,
        hd: 1,
        wmode: "transparent",
        enablejsapi: 1,
        html5: 1
      },
      paramPlace: 8,
      type: "iframe",
      url: "https://www.youtube-nocookie.com/embed/$4",
      thumb: "https://img.youtube.com/vi/$4/hqdefault.jpg"
    },

    vimeo: {
      matcher: /^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,
      params: {
        autoplay: 1,
        hd: 1,
        show_title: 1,
        show_byline: 1,
        show_portrait: 0,
        fullscreen: 1
      },
      paramPlace: 3,
      type: "iframe",
      url: "//player.vimeo.com/video/$2"
    },

    instagram: {
      matcher: /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,
      type: "image",
      url: "//$1/p/$2/media/?size=l"
    },

    // Examples:
    // http://maps.google.com/?ll=48.857995,2.294297&amp;spn=0.007666,0.021136&amp;t=m&amp;z=16
    // https://www.google.com/maps/@37.7852006,-122.4146355,14.65z
    // https://www.google.com/maps/@52.2111123,2.9237542,6.61z?hl=en
    // https://www.google.com/maps/place/Googleplex/@37.4220041,-122.0833494,17z/data=!4m5!3m4!1s0x0:0x6c296c66619367e0!8m2!3d37.4219998!4d-122.0840572
    gmap_place: {
      matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,
      type: "iframe",
      url: function (rez) {
        return (
          "//maps.google." +
          rez[2] +
          "/?ll=" +
          (rez[9] ? rez[9] + "&amp;z=" + Math.floor(rez[10]) + (rez[12] ? rez[12].replace(/^\//, "&amp;") : "") : rez[12] + "").replace(/\?/, "&amp;") +
          "&amp;output=" +
          (rez[12] &amp;&amp; rez[12].indexOf("layer=c") &gt; 0 ? "svembed" : "embed")
        );
      }
    },

    // Examples:
    // https://www.google.com/maps/search/Empire+State+Building/
    // https://www.google.com/maps/search/?api=1&amp;query=centurylink+field
    // https://www.google.com/maps/search/?api=1&amp;query=47.5951518,-122.3316393
    gmap_search: {
      matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,
      type: "iframe",
      url: function (rez) {
        return "//maps.google." + rez[2] + "/maps?q=" + rez[5].replace("query=", "q=").replace("api=1", "") + "&amp;output=embed";
      }
    }
  };

  // Formats matching url to final form
  var format = function (url, rez, params) {
    if (!url) {
      return;
    }

    params = params || "";

    if ($.type(params) === "object") {
      params = $.param(params, true);
    }

    $.each(rez, function (key, value) {
      url = url.replace("$" + key, value || "");
    });

    if (params.length) {
      url += (url.indexOf("?") &gt; 0 ? "&amp;" : "?") + params;
    }

    return url;
  };

  $(document).on("objectNeedsType.fb", function (e, instance, item) {
    var url = item.src || "",
      type = false,
      media,
      thumb,
      rez,
      params,
      urlParams,
      paramObj,
      provider;

    media = $.extend(true, {}, defaults, item.opts.media);

    // Look for any matching media type
    $.each(media, function (providerName, providerOpts) {
      rez = url.match(providerOpts.matcher);

      if (!rez) {
        return;
      }

      type = providerOpts.type;
      provider = providerName;
      paramObj = {};

      if (providerOpts.paramPlace &amp;&amp; rez[providerOpts.paramPlace]) {
        urlParams = rez[providerOpts.paramPlace];

        if (urlParams[0] == "?") {
          urlParams = urlParams.substring(1);
        }

        urlParams = urlParams.split("&amp;");

        for (var m = 0; m &lt; urlParams.length; ++m) {
          var p = urlParams[m].split("=", 2);

          if (p.length == 2) {
            paramObj[p[0]] = decodeURIComponent(p[1].replace(/\+/g, " "));
          }
        }
      }

      params = $.extend(true, {}, providerOpts.params, item.opts[providerName], paramObj);

      url =
        $.type(providerOpts.url) === "function" ? providerOpts.url.call(this, rez, params, item) : format(providerOpts.url, rez, params);

      thumb =
        $.type(providerOpts.thumb) === "function" ? providerOpts.thumb.call(this, rez, params, item) : format(providerOpts.thumb, rez);

      if (providerName === "youtube") {
        url = url.replace(/&amp;t=((\d+)m)?(\d+)s/, function (match, p1, m, s) {
          return "&amp;start=" + ((m ? parseInt(m, 10) * 60 : 0) + parseInt(s, 10));
        });
      } else if (providerName === "vimeo") {
        url = url.replace("&amp;%23", "#");
      }

      return false;
    });

    // If it is found, then change content type and update the url

    if (type) {
      if (!item.opts.thumb &amp;&amp; !(item.opts.$thumb &amp;&amp; item.opts.$thumb.length)) {
        item.opts.thumb = thumb;
      }

      if (type === "iframe") {
        item.opts = $.extend(true, item.opts, {
          iframe: {
            preload: false,
            attr: {
              scrolling: "no"
            }
          }
        });
      }

      $.extend(item, {
        type: type,
        src: url,
        origSrc: item.src,
        contentSource: provider,
        contentType: type === "image" ? "image" : provider == "gmap_place" || provider == "gmap_search" ? "map" : "video"
      });
    } else if (url) {
      item.type = item.opts.defaultType;
    }
  });

  // Load YouTube/Video API on request to detect when video finished playing
  var VideoAPILoader = {
    youtube: {
      src: "https://www.youtube.com/iframe_api",
      class: "YT",
      loading: false,
      loaded: false
    },

    vimeo: {
      src: "https://player.vimeo.com/api/player.js",
      class: "Vimeo",
      loading: false,
      loaded: false
    },

    load: function (vendor) {
      var _this = this,
        script;

      if (this[vendor].loaded) {
        setTimeout(function () {
          _this.done(vendor);
        });
        return;
      }

      if (this[vendor].loading) {
        return;
      }

      this[vendor].loading = true;

      script = document.createElement("script");
      script.type = "text/javascript";
      script.src = this[vendor].src;

      if (vendor === "youtube") {
        window.onYouTubeIframeAPIReady = function () {
          _this[vendor].loaded = true;
          _this.done(vendor);
        };
      } else {
        script.onload = function () {
          _this[vendor].loaded = true;
          _this.done(vendor);
        };
      }

      document.body.appendChild(script);
    },
    done: function (vendor) {
      var instance, $el, player;

      if (vendor === "youtube") {
        delete window.onYouTubeIframeAPIReady;
      }

      instance = $.fancybox.getInstance();

      if (instance) {
        $el = instance.current.$content.find("iframe");

        if (vendor === "youtube" &amp;&amp; YT !== undefined &amp;&amp; YT) {
          player = new YT.Player($el.attr("id"), {
            events: {
              onStateChange: function (e) {
                if (e.data == 0) {
                  instance.next();
                }
              }
            }
          });
        } else if (vendor === "vimeo" &amp;&amp; Vimeo !== undefined &amp;&amp; Vimeo) {
          player = new Vimeo.Player($el);

          player.on("ended", function () {
            instance.next();
          });
        }
      }
    }
  };

  $(document).on({
    "afterShow.fb": function (e, instance, current) {
      if (instance.group.length &gt; 1 &amp;&amp; (current.contentSource === "youtube" || current.contentSource === "vimeo")) {
        VideoAPILoader.load(current.contentSource);
      }
    }
  });
})(jQuery);
// ==========================================================================
//
// Guestures
// Adds touch guestures, handles click and tap events
//
// ==========================================================================
(function (window, document, $) {
  "use strict";

  var requestAFrame = (function () {
    return (
      window.requestAnimationFrame ||
      window.webkitRequestAnimationFrame ||
      window.mozRequestAnimationFrame ||
      window.oRequestAnimationFrame ||
      // if all else fails, use setTimeout
      function (callback) {
        return window.setTimeout(callback, 1000 / 60);
      }
    );
  })();

  var cancelAFrame = (function () {
    return (
      window.cancelAnimationFrame ||
      window.webkitCancelAnimationFrame ||
      window.mozCancelAnimationFrame ||
      window.oCancelAnimationFrame ||
      function (id) {
        window.clearTimeout(id);
      }
    );
  })();

  var getPointerXY = function (e) {
    var result = [];

    e = e.originalEvent || e || window.e;
    e = e.touches &amp;&amp; e.touches.length ? e.touches : e.changedTouches &amp;&amp; e.changedTouches.length ? e.changedTouches : [e];

    for (var key in e) {
      if (e[key].pageX) {
        result.push({
          x: e[key].pageX,
          y: e[key].pageY
        });
      } else if (e[key].clientX) {
        result.push({
          x: e[key].clientX,
          y: e[key].clientY
        });
      }
    }

    return result;
  };

  var distance = function (point2, point1, what) {
    if (!point1 || !point2) {
      return 0;
    }

    if (what === "x") {
      return point2.x - point1.x;
    } else if (what === "y") {
      return point2.y - point1.y;
    }

    return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
  };

  var isClickable = function ($el) {
    if (
      $el.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio,iframe') ||
      $.isFunction($el.get(0).onclick) ||
      $el.data("selectable")
    ) {
      return true;
    }

    // Check for attributes like data-fancybox-next or data-fancybox-close
    for (var i = 0, atts = $el[0].attributes, n = atts.length; i &lt; n; i++) {
      if (atts[i].nodeName.substr(0, 14) === "data-fancybox-") {
        return true;
      }
    }

    return false;
  };

  var hasScrollbars = function (el) {
    var overflowY = window.getComputedStyle(el)["overflow-y"],
      overflowX = window.getComputedStyle(el)["overflow-x"],
      vertical = (overflowY === "scroll" || overflowY === "auto") &amp;&amp; el.scrollHeight &gt; el.clientHeight,
      horizontal = (overflowX === "scroll" || overflowX === "auto") &amp;&amp; el.scrollWidth &gt; el.clientWidth;

    return vertical || horizontal;
  };

  var isScrollable = function ($el) {
    var rez = false;

    while (true) {
      rez = hasScrollbars($el.get(0));

      if (rez) {
        break;
      }

      $el = $el.parent();

      if (!$el.length || $el.hasClass("fancybox-stage") || $el.is("body")) {
        break;
      }
    }

    return rez;
  };

  var Guestures = function (instance) {
    var self = this;

    self.instance = instance;

    self.$bg = instance.$refs.bg;
    self.$stage = instance.$refs.stage;
    self.$container = instance.$refs.container;

    self.destroy();

    self.$container.on("touchstart.fb.touch mousedown.fb.touch", $.proxy(self, "ontouchstart"));
  };

  Guestures.prototype.destroy = function () {
    var self = this;

    self.$container.off(".fb.touch");

    $(document).off(".fb.touch");

    if (self.requestId) {
      cancelAFrame(self.requestId);
      self.requestId = null;
    }

    if (self.tapped) {
      clearTimeout(self.tapped);
      self.tapped = null;
    }
  };

  Guestures.prototype.ontouchstart = function (e) {
    var self = this,
      $target = $(e.target),
      instance = self.instance,
      current = instance.current,
      $slide = current.$slide,
      $content = current.$content,
      isTouchDevice = e.type == "touchstart";

    // Do not respond to both (touch and mouse) events
    if (isTouchDevice) {
      self.$container.off("mousedown.fb.touch");
    }

    // Ignore right click
    if (e.originalEvent &amp;&amp; e.originalEvent.button == 2) {
      return;
    }

    // Ignore taping on links, buttons, input elements
    if (!$slide.length || !$target.length || isClickable($target) || isClickable($target.parent())) {
      return;
    }
    // Ignore clicks on the scrollbar
    if (!$target.is("img") &amp;&amp; e.originalEvent.clientX &gt; $target[0].clientWidth + $target.offset().left) {
      return;
    }

    // Ignore clicks while zooming or closing
    if (!current || instance.isAnimating || current.$slide.hasClass("fancybox-animated")) {
      e.stopPropagation();
      e.preventDefault();

      return;
    }

    self.realPoints = self.startPoints = getPointerXY(e);

    if (!self.startPoints.length) {
      return;
    }

    // Allow other scripts to catch touch event if "touch" is set to false
    if (current.touch) {
      e.stopPropagation();
    }

    self.startEvent = e;

    self.canTap = true;
    self.$target = $target;
    self.$content = $content;
    self.opts = current.opts.touch;

    self.isPanning = false;
    self.isSwiping = false;
    self.isZooming = false;
    self.isScrolling = false;
    self.canPan = instance.canPan();

    self.startTime = new Date().getTime();
    self.distanceX = self.distanceY = self.distance = 0;

    self.canvasWidth = Math.round($slide[0].clientWidth);
    self.canvasHeight = Math.round($slide[0].clientHeight);

    self.contentLastPos = null;
    self.contentStartPos = $.fancybox.getTranslate(self.$content) || {
      top: 0,
      left: 0
    };
    self.sliderStartPos = $.fancybox.getTranslate($slide);

    // Since position will be absolute, but we need to make it relative to the stage
    self.stagePos = $.fancybox.getTranslate(instance.$refs.stage);

    self.sliderStartPos.top -= self.stagePos.top;
    self.sliderStartPos.left -= self.stagePos.left;

    self.contentStartPos.top -= self.stagePos.top;
    self.contentStartPos.left -= self.stagePos.left;

    $(document)
      .off(".fb.touch")
      .on(isTouchDevice ? "touchend.fb.touch touchcancel.fb.touch" : "mouseup.fb.touch mouseleave.fb.touch", $.proxy(self, "ontouchend"))
      .on(isTouchDevice ? "touchmove.fb.touch" : "mousemove.fb.touch", $.proxy(self, "ontouchmove"));

    if ($.fancybox.isMobile) {
      document.addEventListener("scroll", self.onscroll, true);
    }

    // Skip if clicked outside the sliding area
    if (!(self.opts || self.canPan) || !($target.is(self.$stage) || self.$stage.find($target).length)) {
      if ($target.is(".fancybox-image")) {
        e.preventDefault();
      }

      if (!($.fancybox.isMobile &amp;&amp; $target.parents(".fancybox-caption").length)) {
        return;
      }
    }

    self.isScrollable = isScrollable($target) || isScrollable($target.parent());

    // Check if element is scrollable and try to prevent default behavior (scrolling)
    if (!($.fancybox.isMobile &amp;&amp; self.isScrollable)) {
      e.preventDefault();
    }

    // One finger or mouse click - swipe or pan an image
    if (self.startPoints.length === 1 || current.hasError) {
      if (self.canPan) {
        $.fancybox.stop(self.$content);

        self.isPanning = true;
      } else {
        self.isSwiping = true;
      }

      self.$container.addClass("fancybox-is-grabbing");
    }

    // Two fingers - zoom image
    if (self.startPoints.length === 2 &amp;&amp; current.type === "image" &amp;&amp; (current.isLoaded || current.$ghost)) {
      self.canTap = false;
      self.isSwiping = false;
      self.isPanning = false;

      self.isZooming = true;

      $.fancybox.stop(self.$content);

      self.centerPointStartX = (self.startPoints[0].x + self.startPoints[1].x) * 0.5 - $(window).scrollLeft();
      self.centerPointStartY = (self.startPoints[0].y + self.startPoints[1].y) * 0.5 - $(window).scrollTop();

      self.percentageOfImageAtPinchPointX = (self.centerPointStartX - self.contentStartPos.left) / self.contentStartPos.width;
      self.percentageOfImageAtPinchPointY = (self.centerPointStartY - self.contentStartPos.top) / self.contentStartPos.height;

      self.startDistanceBetweenFingers = distance(self.startPoints[0], self.startPoints[1]);
    }
  };

  Guestures.prototype.onscroll = function (e) {
    var self = this;

    self.isScrolling = true;

    document.removeEventListener("scroll", self.onscroll, true);
  };

  Guestures.prototype.ontouchmove = function (e) {
    var self = this;

    // Make sure user has not released over iframe or disabled element
    if (e.originalEvent.buttons !== undefined &amp;&amp; e.originalEvent.buttons === 0) {
      self.ontouchend(e);
      return;
    }

    if (self.isScrolling) {
      self.canTap = false;
      return;
    }

    self.newPoints = getPointerXY(e);

    if (!(self.opts || self.canPan) || !self.newPoints.length || !self.newPoints.length) {
      return;
    }

    if (!(self.isSwiping &amp;&amp; self.isSwiping === true)) {
      e.preventDefault();
    }

    self.distanceX = distance(self.newPoints[0], self.startPoints[0], "x");
    self.distanceY = distance(self.newPoints[0], self.startPoints[0], "y");

    self.distance = distance(self.newPoints[0], self.startPoints[0]);

    // Skip false ontouchmove events (Chrome)
    if (self.distance &gt; 0) {
      if (self.isSwiping) {
        self.onSwipe(e);
      } else if (self.isPanning) {
        self.onPan();
      } else if (self.isZooming) {
        self.onZoom();
      }
    }
  };

  Guestures.prototype.onSwipe = function (e) {
    var self = this,
      instance = self.instance,
      swiping = self.isSwiping,
      left = self.sliderStartPos.left || 0,
      angle;

    // If direction is not yet determined
    if (swiping === true) {
      // We need at least 10px distance to correctly calculate an angle
      if (Math.abs(self.distance) &gt; 10) {
        self.canTap = false;

        if (instance.group.length &lt; 2 &amp;&amp; self.opts.vertical) {
          self.isSwiping = "y";
        } else if (instance.isDragging || self.opts.vertical === false || (self.opts.vertical === "auto" &amp;&amp; $(window).width() &gt; 800)) {
          self.isSwiping = "x";
        } else {
          angle = Math.abs((Math.atan2(self.distanceY, self.distanceX) * 180) / Math.PI);

          self.isSwiping = angle &gt; 45 &amp;&amp; angle &lt; 135 ? "y" : "x";
        }

        if (self.isSwiping === "y" &amp;&amp; $.fancybox.isMobile &amp;&amp; self.isScrollable) {
          self.isScrolling = true;

          return;
        }

        instance.isDragging = self.isSwiping;

        // Reset points to avoid jumping, because we dropped first swipes to calculate the angle
        self.startPoints = self.newPoints;

        $.each(instance.slides, function (index, slide) {
          var slidePos, stagePos;

          $.fancybox.stop(slide.$slide);

          slidePos = $.fancybox.getTranslate(slide.$slide);
          stagePos = $.fancybox.getTranslate(instance.$refs.stage);

          slide.$slide
            .css({
              transform: "",
              opacity: "",
              "transition-duration": ""
            })
            .removeClass("fancybox-animated")
            .removeClass(function (index, className) {
              return (className.match(/(^|\s)fancybox-fx-\S+/g) || []).join(" ");
            });

          if (slide.pos === instance.current.pos) {
            self.sliderStartPos.top = slidePos.top - stagePos.top;
            self.sliderStartPos.left = slidePos.left - stagePos.left;
          }

          $.fancybox.setTranslate(slide.$slide, {
            top: slidePos.top - stagePos.top,
            left: slidePos.left - stagePos.left
          });
        });

        // Stop slideshow
        if (instance.SlideShow &amp;&amp; instance.SlideShow.isActive) {
          instance.SlideShow.stop();
        }
      }

      return;
    }

    // Sticky edges
    if (swiping == "x") {
      if (
        self.distanceX &gt; 0 &amp;&amp;
        (self.instance.group.length &lt; 2 || (self.instance.current.index === 0 &amp;&amp; !self.instance.current.opts.loop))
      ) {
        left = left + Math.pow(self.distanceX, 0.8);
      } else if (
        self.distanceX &lt; 0 &amp;&amp;
        (self.instance.group.length &lt; 2 ||
          (self.instance.current.index === self.instance.group.length - 1 &amp;&amp; !self.instance.current.opts.loop))
      ) {
        left = left - Math.pow(-self.distanceX, 0.8);
      } else {
        left = left + self.distanceX;
      }
    }

    self.sliderLastPos = {
      top: swiping == "x" ? 0 : self.sliderStartPos.top + self.distanceY,
      left: left
    };

    if (self.requestId) {
      cancelAFrame(self.requestId);

      self.requestId = null;
    }

    self.requestId = requestAFrame(function () {
      if (self.sliderLastPos) {
        $.each(self.instance.slides, function (index, slide) {
          var pos = slide.pos - self.instance.currPos;

          $.fancybox.setTranslate(slide.$slide, {
            top: self.sliderLastPos.top,
            left: self.sliderLastPos.left + pos * self.canvasWidth + pos * slide.opts.gutter
          });
        });

        self.$container.addClass("fancybox-is-sliding");
      }
    });
  };

  Guestures.prototype.onPan = function () {
    var self = this;

    // Prevent accidental movement (sometimes, when tapping casually, finger can move a bit)
    if (distance(self.newPoints[0], self.realPoints[0]) &lt; ($.fancybox.isMobile ? 10 : 5)) {
      self.startPoints = self.newPoints;
      return;
    }

    self.canTap = false;

    self.contentLastPos = self.limitMovement();

    if (self.requestId) {
      cancelAFrame(self.requestId);
    }

    self.requestId = requestAFrame(function () {
      $.fancybox.setTranslate(self.$content, self.contentLastPos);
    });
  };

  // Make panning sticky to the edges
  Guestures.prototype.limitMovement = function () {
    var self = this;

    var canvasWidth = self.canvasWidth;
    var canvasHeight = self.canvasHeight;

    var distanceX = self.distanceX;
    var distanceY = self.distanceY;

    var contentStartPos = self.contentStartPos;

    var currentOffsetX = contentStartPos.left;
    var currentOffsetY = contentStartPos.top;

    var currentWidth = contentStartPos.width;
    var currentHeight = contentStartPos.height;

    var minTranslateX, minTranslateY, maxTranslateX, maxTranslateY, newOffsetX, newOffsetY;

    if (currentWidth &gt; canvasWidth) {
      newOffsetX = currentOffsetX + distanceX;
    } else {
      newOffsetX = currentOffsetX;
    }

    newOffsetY = currentOffsetY + distanceY;

    // Slow down proportionally to traveled distance
    minTranslateX = Math.max(0, canvasWidth * 0.5 - currentWidth * 0.5);
    minTranslateY = Math.max(0, canvasHeight * 0.5 - currentHeight * 0.5);

    maxTranslateX = Math.min(canvasWidth - currentWidth, canvasWidth * 0.5 - currentWidth * 0.5);
    maxTranslateY = Math.min(canvasHeight - currentHeight, canvasHeight * 0.5 - currentHeight * 0.5);

    //   -&gt;
    if (distanceX &gt; 0 &amp;&amp; newOffsetX &gt; minTranslateX) {
      newOffsetX = minTranslateX - 1 + Math.pow(-minTranslateX + currentOffsetX + distanceX, 0.8) || 0;
    }

    //    &lt;-
    if (distanceX &lt; 0 &amp;&amp; newOffsetX &lt; maxTranslateX) {
      newOffsetX = maxTranslateX + 1 - Math.pow(maxTranslateX - currentOffsetX - distanceX, 0.8) || 0;
    }

    //   \/
    if (distanceY &gt; 0 &amp;&amp; newOffsetY &gt; minTranslateY) {
      newOffsetY = minTranslateY - 1 + Math.pow(-minTranslateY + currentOffsetY + distanceY, 0.8) || 0;
    }

    //   /\
    if (distanceY &lt; 0 &amp;&amp; newOffsetY &lt; maxTranslateY) {
      newOffsetY = maxTranslateY + 1 - Math.pow(maxTranslateY - currentOffsetY - distanceY, 0.8) || 0;
    }

    return {
      top: newOffsetY,
      left: newOffsetX
    };
  };

  Guestures.prototype.limitPosition = function (newOffsetX, newOffsetY, newWidth, newHeight) {
    var self = this;

    var canvasWidth = self.canvasWidth;
    var canvasHeight = self.canvasHeight;

    if (newWidth &gt; canvasWidth) {
      newOffsetX = newOffsetX &gt; 0 ? 0 : newOffsetX;
      newOffsetX = newOffsetX &lt; canvasWidth - newWidth ? canvasWidth - newWidth : newOffsetX;
    } else {
      // Center horizontally
      newOffsetX = Math.max(0, canvasWidth / 2 - newWidth / 2);
    }

    if (newHeight &gt; canvasHeight) {
      newOffsetY = newOffsetY &gt; 0 ? 0 : newOffsetY;
      newOffsetY = newOffsetY &lt; canvasHeight - newHeight ? canvasHeight - newHeight : newOffsetY;
    } else {
      // Center vertically
      newOffsetY = Math.max(0, canvasHeight / 2 - newHeight / 2);
    }

    return {
      top: newOffsetY,
      left: newOffsetX
    };
  };

  Guestures.prototype.onZoom = function () {
    var self = this;

    // Calculate current distance between points to get pinch ratio and new width and height
    var contentStartPos = self.contentStartPos;

    var currentWidth = contentStartPos.width;
    var currentHeight = contentStartPos.height;

    var currentOffsetX = contentStartPos.left;
    var currentOffsetY = contentStartPos.top;

    var endDistanceBetweenFingers = distance(self.newPoints[0], self.newPoints[1]);

    var pinchRatio = endDistanceBetweenFingers / self.startDistanceBetweenFingers;

    var newWidth = Math.floor(currentWidth * pinchRatio);
    var newHeight = Math.floor(currentHeight * pinchRatio);

    // This is the translation due to pinch-zooming
    var translateFromZoomingX = (currentWidth - newWidth) * self.percentageOfImageAtPinchPointX;
    var translateFromZoomingY = (currentHeight - newHeight) * self.percentageOfImageAtPinchPointY;

    // Point between the two touches
    var centerPointEndX = (self.newPoints[0].x + self.newPoints[1].x) / 2 - $(window).scrollLeft();
    var centerPointEndY = (self.newPoints[0].y + self.newPoints[1].y) / 2 - $(window).scrollTop();

    // And this is the translation due to translation of the centerpoint
    // between the two fingers
    var translateFromTranslatingX = centerPointEndX - self.centerPointStartX;
    var translateFromTranslatingY = centerPointEndY - self.centerPointStartY;

    // The new offset is the old/current one plus the total translation
    var newOffsetX = currentOffsetX + (translateFromZoomingX + translateFromTranslatingX);
    var newOffsetY = currentOffsetY + (translateFromZoomingY + translateFromTranslatingY);

    var newPos = {
      top: newOffsetY,
      left: newOffsetX,
      scaleX: pinchRatio,
      scaleY: pinchRatio
    };

    self.canTap = false;

    self.newWidth = newWidth;
    self.newHeight = newHeight;

    self.contentLastPos = newPos;

    if (self.requestId) {
      cancelAFrame(self.requestId);
    }

    self.requestId = requestAFrame(function () {
      $.fancybox.setTranslate(self.$content, self.contentLastPos);
    });
  };

  Guestures.prototype.ontouchend = function (e) {
    var self = this;

    var swiping = self.isSwiping;
    var panning = self.isPanning;
    var zooming = self.isZooming;
    var scrolling = self.isScrolling;

    self.endPoints = getPointerXY(e);
    self.dMs = Math.max(new Date().getTime() - self.startTime, 1);

    self.$container.removeClass("fancybox-is-grabbing");

    $(document).off(".fb.touch");

    document.removeEventListener("scroll", self.onscroll, true);

    if (self.requestId) {
      cancelAFrame(self.requestId);

      self.requestId = null;
    }

    self.isSwiping = false;
    self.isPanning = false;
    self.isZooming = false;
    self.isScrolling = false;

    self.instance.isDragging = false;

    if (self.canTap) {
      return self.onTap(e);
    }

    self.speed = 100;

    // Speed in px/ms
    self.velocityX = (self.distanceX / self.dMs) * 0.5;
    self.velocityY = (self.distanceY / self.dMs) * 0.5;

    if (panning) {
      self.endPanning();
    } else if (zooming) {
      self.endZooming();
    } else {
      self.endSwiping(swiping, scrolling);
    }

    return;
  };

  Guestures.prototype.endSwiping = function (swiping, scrolling) {
    var self = this,
      ret = false,
      len = self.instance.group.length,
      distanceX = Math.abs(self.distanceX),
      canAdvance = swiping == "x" &amp;&amp; len &gt; 1 &amp;&amp; ((self.dMs &gt; 130 &amp;&amp; distanceX &gt; 10) || distanceX &gt; 50),
      speedX = 300;

    self.sliderLastPos = null;

    // Close if swiped vertically / navigate if horizontally
    if (swiping == "y" &amp;&amp; !scrolling &amp;&amp; Math.abs(self.distanceY) &gt; 50) {
      // Continue vertical movement
      $.fancybox.animate(
        self.instance.current.$slide, {
          top: self.sliderStartPos.top + self.distanceY + self.velocityY * 150,
          opacity: 0
        },
        200
      );
      ret = self.instance.close(true, 250);
    } else if (canAdvance &amp;&amp; self.distanceX &gt; 0) {
      ret = self.instance.previous(speedX);
    } else if (canAdvance &amp;&amp; self.distanceX &lt; 0) {
      ret = self.instance.next(speedX);
    }

    if (ret === false &amp;&amp; (swiping == "x" || swiping == "y")) {
      self.instance.centerSlide(200);
    }

    self.$container.removeClass("fancybox-is-sliding");
  };

  // Limit panning from edges
  // ========================
  Guestures.prototype.endPanning = function () {
    var self = this,
      newOffsetX,
      newOffsetY,
      newPos;

    if (!self.contentLastPos) {
      return;
    }

    if (self.opts.momentum === false || self.dMs &gt; 350) {
      newOffsetX = self.contentLastPos.left;
      newOffsetY = self.contentLastPos.top;
    } else {
      // Continue movement
      newOffsetX = self.contentLastPos.left + self.velocityX * 500;
      newOffsetY = self.contentLastPos.top + self.velocityY * 500;
    }

    newPos = self.limitPosition(newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height);

    newPos.width = self.contentStartPos.width;
    newPos.height = self.contentStartPos.height;

    $.fancybox.animate(self.$content, newPos, 366);
  };

  Guestures.prototype.endZooming = function () {
    var self = this;

    var current = self.instance.current;

    var newOffsetX, newOffsetY, newPos, reset;

    var newWidth = self.newWidth;
    var newHeight = self.newHeight;

    if (!self.contentLastPos) {
      return;
    }

    newOffsetX = self.contentLastPos.left;
    newOffsetY = self.contentLastPos.top;

    reset = {
      top: newOffsetY,
      left: newOffsetX,
      width: newWidth,
      height: newHeight,
      scaleX: 1,
      scaleY: 1
    };

    // Reset scalex/scaleY values; this helps for perfomance and does not break animation
    $.fancybox.setTranslate(self.$content, reset);

    if (newWidth &lt; self.canvasWidth &amp;&amp; newHeight &lt; self.canvasHeight) {
      self.instance.scaleToFit(150);
    } else if (newWidth &gt; current.width || newHeight &gt; current.height) {
      self.instance.scaleToActual(self.centerPointStartX, self.centerPointStartY, 150);
    } else {
      newPos = self.limitPosition(newOffsetX, newOffsetY, newWidth, newHeight);

      $.fancybox.animate(self.$content, newPos, 150);
    }
  };

  Guestures.prototype.onTap = function (e) {
    var self = this;
    var $target = $(e.target);

    var instance = self.instance;
    var current = instance.current;

    var endPoints = (e &amp;&amp; getPointerXY(e)) || self.startPoints;

    var tapX = endPoints[0] ? endPoints[0].x - $(window).scrollLeft() - self.stagePos.left : 0;
    var tapY = endPoints[0] ? endPoints[0].y - $(window).scrollTop() - self.stagePos.top : 0;

    var where;

    var process = function (prefix) {
      var action = current.opts[prefix];

      if ($.isFunction(action)) {
        action = action.apply(instance, [current, e]);
      }

      if (!action) {
        return;
      }

      switch (action) {
        case "close":
          instance.close(self.startEvent);

          break;

        case "toggleControls":
          instance.toggleControls();

          break;

        case "next":
          instance.next();

          break;

        case "nextOrClose":
          if (instance.group.length &gt; 1) {
            instance.next();
          } else {
            instance.close(self.startEvent);
          }

          break;

        case "zoom":
          if (current.type == "image" &amp;&amp; (current.isLoaded || current.$ghost)) {
            if (instance.canPan()) {
              instance.scaleToFit();
            } else if (instance.isScaledDown()) {
              instance.scaleToActual(tapX, tapY);
            } else if (instance.group.length &lt; 2) {
              instance.close(self.startEvent);
            }
          }

          break;
      }
    };

    // Ignore right click
    if (e.originalEvent &amp;&amp; e.originalEvent.button == 2) {
      return;
    }

    // Skip if clicked on the scrollbar
    if (!$target.is("img") &amp;&amp; tapX &gt; $target[0].clientWidth + $target.offset().left) {
      return;
    }

    // Check where is clicked
    if ($target.is(".fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-container")) {
      where = "Outside";
    } else if ($target.is(".fancybox-slide")) {
      where = "Slide";
    } else if (
      instance.current.$content &amp;&amp;
      instance.current.$content
      .find($target)
      .addBack()
      .filter($target).length
    ) {
      where = "Content";
    } else {
      return;
    }

    // Check if this is a double tap
    if (self.tapped) {
      // Stop previously created single tap
      clearTimeout(self.tapped);
      self.tapped = null;

      // Skip if distance between taps is too big
      if (Math.abs(tapX - self.tapX) &gt; 50 || Math.abs(tapY - self.tapY) &gt; 50) {
        return this;
      }

      // OK, now we assume that this is a double-tap
      process("dblclick" + where);
    } else {
      // Single tap will be processed if user has not clicked second time within 300ms
      // or there is no need to wait for double-tap
      self.tapX = tapX;
      self.tapY = tapY;

      if (current.opts["dblclick" + where] &amp;&amp; current.opts["dblclick" + where] !== current.opts["click" + where]) {
        self.tapped = setTimeout(function () {
          self.tapped = null;

          if (!instance.isAnimating) {
            process("click" + where);
          }
        }, 500);
      } else {
        process("click" + where);
      }
    }

    return this;
  };

  $(document)
    .on("onActivate.fb", function (e, instance) {
      if (instance &amp;&amp; !instance.Guestures) {
        instance.Guestures = new Guestures(instance);
      }
    })
    .on("beforeClose.fb", function (e, instance) {
      if (instance &amp;&amp; instance.Guestures) {
        instance.Guestures.destroy();
      }
    });
})(window, document, jQuery);
// ==========================================================================
//
// SlideShow
// Enables slideshow functionality
//
// Example of usage:
// $.fancybox.getInstance().SlideShow.start()
//
// ==========================================================================
(function (document, $) {
  "use strict";

  $.extend(true, $.fancybox.defaults, {
    btnTpl: {
      slideShow: '&lt;button data-fancybox-play class="fancybox-button fancybox-button--play" title="{{PLAY_START}}"&gt;' +
        '&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;path d="M6.5 5.4v13.2l11-6.6z"/&gt;&lt;/svg&gt;' +
        '&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;path d="M8.33 5.75h2.2v12.5h-2.2V5.75zm5.15 0h2.2v12.5h-2.2V5.75z"/&gt;&lt;/svg&gt;' +
        "&lt;/button&gt;"
    },
    slideShow: {
      autoStart: false,
      speed: 3000,
      progress: true
    }
  });

  var SlideShow = function (instance) {
    this.instance = instance;
    this.init();
  };

  $.extend(SlideShow.prototype, {
    timer: null,
    isActive: false,
    $button: null,

    init: function () {
      var self = this,
        instance = self.instance,
        opts = instance.group[instance.currIndex].opts.slideShow;

      self.$button = instance.$refs.toolbar.find("[data-fancybox-play]").on("click", function () {
        self.toggle();
      });

      if (instance.group.length &lt; 2 || !opts) {
        self.$button.hide();
      } else if (opts.progress) {
        self.$progress = $('&lt;div class="fancybox-progress"&gt;&lt;/div&gt;').appendTo(instance.$refs.inner);
      }
    },

    set: function (force) {
      var self = this,
        instance = self.instance,
        current = instance.current;

      // Check if reached last element
      if (current &amp;&amp; (force === true || current.opts.loop || instance.currIndex &lt; instance.group.length - 1)) {
        if (self.isActive &amp;&amp; current.contentType !== "video") {
          if (self.$progress) {
            $.fancybox.animate(self.$progress.show(), {
              scaleX: 1
            }, current.opts.slideShow.speed);
          }

          self.timer = setTimeout(function () {
            if (!instance.current.opts.loop &amp;&amp; instance.current.index == instance.group.length - 1) {
              instance.jumpTo(0);
            } else {
              instance.next();
            }
          }, current.opts.slideShow.speed);
        }
      } else {
        self.stop();
        instance.idleSecondsCounter = 0;
        instance.showControls();
      }
    },

    clear: function () {
      var self = this;

      clearTimeout(self.timer);

      self.timer = null;

      if (self.$progress) {
        self.$progress.removeAttr("style").hide();
      }
    },

    start: function () {
      var self = this,
        current = self.instance.current;

      if (current) {
        self.$button
          .attr("title", (current.opts.i18n[current.opts.lang] || current.opts.i18n.en).PLAY_STOP)
          .removeClass("fancybox-button--play")
          .addClass("fancybox-button--pause");

        self.isActive = true;

        if (current.isComplete) {
          self.set(true);
        }

        self.instance.trigger("onSlideShowChange", true);
      }
    },

    stop: function () {
      var self = this,
        current = self.instance.current;

      self.clear();

      self.$button
        .attr("title", (current.opts.i18n[current.opts.lang] || current.opts.i18n.en).PLAY_START)
        .removeClass("fancybox-button--pause")
        .addClass("fancybox-button--play");

      self.isActive = false;

      self.instance.trigger("onSlideShowChange", false);

      if (self.$progress) {
        self.$progress.removeAttr("style").hide();
      }
    },

    toggle: function () {
      var self = this;

      if (self.isActive) {
        self.stop();
      } else {
        self.start();
      }
    }
  });

  $(document).on({
    "onInit.fb": function (e, instance) {
      if (instance &amp;&amp; !instance.SlideShow) {
        instance.SlideShow = new SlideShow(instance);
      }
    },

    "beforeShow.fb": function (e, instance, current, firstRun) {
      var SlideShow = instance &amp;&amp; instance.SlideShow;

      if (firstRun) {
        if (SlideShow &amp;&amp; current.opts.slideShow.autoStart) {
          SlideShow.start();
        }
      } else if (SlideShow &amp;&amp; SlideShow.isActive) {
        SlideShow.clear();
      }
    },

    "afterShow.fb": function (e, instance, current) {
      var SlideShow = instance &amp;&amp; instance.SlideShow;

      if (SlideShow &amp;&amp; SlideShow.isActive) {
        SlideShow.set();
      }
    },

    "afterKeydown.fb": function (e, instance, current, keypress, keycode) {
      var SlideShow = instance &amp;&amp; instance.SlideShow;

      // "P" or Spacebar
      if (SlideShow &amp;&amp; current.opts.slideShow &amp;&amp; (keycode === 80 || keycode === 32) &amp;&amp; !$(document.activeElement).is("button,a,input")) {
        keypress.preventDefault();

        SlideShow.toggle();
      }
    },

    "beforeClose.fb onDeactivate.fb": function (e, instance) {
      var SlideShow = instance &amp;&amp; instance.SlideShow;

      if (SlideShow) {
        SlideShow.stop();
      }
    }
  });

  // Page Visibility API to pause slideshow when window is not active
  $(document).on("visibilitychange", function () {
    var instance = $.fancybox.getInstance(),
      SlideShow = instance &amp;&amp; instance.SlideShow;

    if (SlideShow &amp;&amp; SlideShow.isActive) {
      if (document.hidden) {
        SlideShow.clear();
      } else {
        SlideShow.set();
      }
    }
  });
})(document, jQuery);
// ==========================================================================
//
// FullScreen
// Adds fullscreen functionality
//
// ==========================================================================
(function (document, $) {
  "use strict";

  // Collection of methods supported by user browser
  var fn = (function () {
    var fnMap = [
      ["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"],
      // new WebKit
      [
        "webkitRequestFullscreen",
        "webkitExitFullscreen",
        "webkitFullscreenElement",
        "webkitFullscreenEnabled",
        "webkitfullscreenchange",
        "webkitfullscreenerror"
      ],
      // old WebKit (Safari 5.1)
      [
        "webkitRequestFullScreen",
        "webkitCancelFullScreen",
        "webkitCurrentFullScreenElement",
        "webkitCancelFullScreen",
        "webkitfullscreenchange",
        "webkitfullscreenerror"
      ],
      [
        "mozRequestFullScreen",
        "mozCancelFullScreen",
        "mozFullScreenElement",
        "mozFullScreenEnabled",
        "mozfullscreenchange",
        "mozfullscreenerror"
      ],
      ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError"]
    ];

    var ret = {};

    for (var i = 0; i &lt; fnMap.length; i++) {
      var val = fnMap[i];

      if (val &amp;&amp; val[1] in document) {
        for (var j = 0; j &lt; val.length; j++) {
          ret[fnMap[0][j]] = val[j];
        }

        return ret;
      }
    }

    return false;
  })();

  if (fn) {
    var FullScreen = {
      request: function (elem) {
        elem = elem || document.documentElement;

        elem[fn.requestFullscreen](elem.ALLOW_KEYBOARD_INPUT);
      },
      exit: function () {
        document[fn.exitFullscreen]();
      },
      toggle: function (elem) {
        elem = elem || document.documentElement;

        if (this.isFullscreen()) {
          this.exit();
        } else {
          this.request(elem);
        }
      },
      isFullscreen: function () {
        return Boolean(document[fn.fullscreenElement]);
      },
      enabled: function () {
        return Boolean(document[fn.fullscreenEnabled]);
      }
    };

    $.extend(true, $.fancybox.defaults, {
      btnTpl: {
        fullScreen: '&lt;button data-fancybox-fullscreen class="fancybox-button fancybox-button--fsenter" title="{{FULL_SCREEN}}"&gt;' +
          '&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/&gt;&lt;/svg&gt;' +
          '&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;path d="M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z"/&gt;&lt;/svg&gt;' +
          "&lt;/button&gt;"
      },
      fullScreen: {
        autoStart: false
      }
    });

    $(document).on(fn.fullscreenchange, function () {
      var isFullscreen = FullScreen.isFullscreen(),
        instance = $.fancybox.getInstance();

      if (instance) {
        // If image is zooming, then force to stop and reposition properly
        if (instance.current &amp;&amp; instance.current.type === "image" &amp;&amp; instance.isAnimating) {
          instance.isAnimating = false;

          instance.update(true, true, 0);

          if (!instance.isComplete) {
            instance.complete();
          }
        }

        instance.trigger("onFullscreenChange", isFullscreen);

        instance.$refs.container.toggleClass("fancybox-is-fullscreen", isFullscreen);

        instance.$refs.toolbar
          .find("[data-fancybox-fullscreen]")
          .toggleClass("fancybox-button--fsenter", !isFullscreen)
          .toggleClass("fancybox-button--fsexit", isFullscreen);
      }
    });
  }

  $(document).on({
    "onInit.fb": function (e, instance) {
      var $container;

      if (!fn) {
        instance.$refs.toolbar.find("[data-fancybox-fullscreen]").remove();

        return;
      }

      if (instance &amp;&amp; instance.group[instance.currIndex].opts.fullScreen) {
        $container = instance.$refs.container;

        $container.on("click.fb-fullscreen", "[data-fancybox-fullscreen]", function (e) {
          e.stopPropagation();
          e.preventDefault();

          FullScreen.toggle();
        });

        if (instance.opts.fullScreen &amp;&amp; instance.opts.fullScreen.autoStart === true) {
          FullScreen.request();
        }

        // Expose API
        instance.FullScreen = FullScreen;
      } else if (instance) {
        instance.$refs.toolbar.find("[data-fancybox-fullscreen]").hide();
      }
    },

    "afterKeydown.fb": function (e, instance, current, keypress, keycode) {
      // "F"
      if (instance &amp;&amp; instance.FullScreen &amp;&amp; keycode === 70) {
        keypress.preventDefault();

        instance.FullScreen.toggle();
      }
    },

    "beforeClose.fb": function (e, instance) {
      if (instance &amp;&amp; instance.FullScreen &amp;&amp; instance.$refs.container.hasClass("fancybox-is-fullscreen")) {
        FullScreen.exit();
      }
    }
  });
})(document, jQuery);
// ==========================================================================
//
// Thumbs
// Displays thumbnails in a grid
//
// ==========================================================================
(function (document, $) {
  "use strict";

  var CLASS = "fancybox-thumbs",
    CLASS_ACTIVE = CLASS + "-active";

  // Make sure there are default values
  $.fancybox.defaults = $.extend(
    true, {
      btnTpl: {
        thumbs: '&lt;button data-fancybox-thumbs class="fancybox-button fancybox-button--thumbs" title="{{THUMBS}}"&gt;' +
          '&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;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"/&gt;&lt;/svg&gt;' +
          "&lt;/button&gt;"
      },
      thumbs: {
        autoStart: false, // Display thumbnails on opening
        hideOnClose: true, // Hide thumbnail grid when closing animation starts
        parentEl: ".fancybox-container", // Container is injected into this element
        axis: "y" // Vertical (y) or horizontal (x) scrolling
      }
    },
    $.fancybox.defaults
  );

  var FancyThumbs = function (instance) {
    this.init(instance);
  };

  $.extend(FancyThumbs.prototype, {
    $button: null,
    $grid: null,
    $list: null,
    isVisible: false,
    isActive: false,

    init: function (instance) {
      var self = this,
        group = instance.group,
        enabled = 0;

      self.instance = instance;
      self.opts = group[instance.currIndex].opts.thumbs;

      instance.Thumbs = self;

      self.$button = instance.$refs.toolbar.find("[data-fancybox-thumbs]");

      // Enable thumbs if at least two group items have thumbnails
      for (var i = 0, len = group.length; i &lt; len; i++) {
        if (group[i].thumb) {
          enabled++;
        }

        if (enabled &gt; 1) {
          break;
        }
      }

      if (enabled &gt; 1 &amp;&amp; !!self.opts) {
        self.$button.removeAttr("style").on("click", function () {
          self.toggle();
        });

        self.isActive = true;
      } else {
        self.$button.hide();
      }
    },

    create: function () {
      var self = this,
        instance = self.instance,
        parentEl = self.opts.parentEl,
        list = [],
        src;

      if (!self.$grid) {
        // Create main element
        self.$grid = $('&lt;div class="' + CLASS + " " + CLASS + "-" + self.opts.axis + '"&gt;&lt;/div&gt;').appendTo(
          instance.$refs.container
          .find(parentEl)
          .addBack()
          .filter(parentEl)
        );

        // Add "click" event that performs gallery navigation
        self.$grid.on("click", "a", function () {
          instance.jumpTo($(this).attr("data-index"));
        });
      }

      // Build the list
      if (!self.$list) {
        self.$list = $('&lt;div class="' + CLASS + '__list"&gt;').appendTo(self.$grid);
      }

      $.each(instance.group, function (i, item) {
        src = item.thumb;

        if (!src &amp;&amp; item.type === "image") {
          src = item.src;
        }

        list.push(
          '&lt;a href="javascript:;" tabindex="0" data-index="' +
          i +
          '"' +
          (src &amp;&amp; src.length ? ' style="background-image:url(' + src + ')"' : 'class="fancybox-thumbs-missing"') +
          "&gt;&lt;/a&gt;"
        );
      });

      self.$list[0].innerHTML = list.join("");

      if (self.opts.axis === "x") {
        // Set fixed width for list element to enable horizontal scrolling
        self.$list.width(
          parseInt(self.$grid.css("padding-right"), 10) +
          instance.group.length *
          self.$list
          .children()
          .eq(0)
          .outerWidth(true)
        );
      }
    },

    focus: function (duration) {
      var self = this,
        $list = self.$list,
        $grid = self.$grid,
        thumb,
        thumbPos;

      if (!self.instance.current) {
        return;
      }

      thumb = $list
        .children()
        .removeClass(CLASS_ACTIVE)
        .filter('[data-index="' + self.instance.current.index + '"]')
        .addClass(CLASS_ACTIVE);

      thumbPos = thumb.position();

      // Check if need to scroll to make current thumb visible
      if (self.opts.axis === "y" &amp;&amp; (thumbPos.top &lt; 0 || thumbPos.top &gt; $list.height() - thumb.outerHeight())) {
        $list.stop().animate({
            scrollTop: $list.scrollTop() + thumbPos.top
          },
          duration
        );
      } else if (
        self.opts.axis === "x" &amp;&amp;
        (thumbPos.left &lt; $grid.scrollLeft() || thumbPos.left &gt; $grid.scrollLeft() + ($grid.width() - thumb.outerWidth()))
      ) {
        $list
          .parent()
          .stop()
          .animate({
              scrollLeft: thumbPos.left
            },
            duration
          );
      }
    },

    update: function () {
      var that = this;
      that.instance.$refs.container.toggleClass("fancybox-show-thumbs", this.isVisible);

      if (that.isVisible) {
        if (!that.$grid) {
          that.create();
        }

        that.instance.trigger("onThumbsShow");

        that.focus(0);
      } else if (that.$grid) {
        that.instance.trigger("onThumbsHide");
      }

      // Update content position
      that.instance.update();
    },

    hide: function () {
      this.isVisible = false;
      this.update();
    },

    show: function () {
      this.isVisible = true;
      this.update();
    },

    toggle: function () {
      this.isVisible = !this.isVisible;
      this.update();
    }
  });

  $(document).on({
    "onInit.fb": function (e, instance) {
      var Thumbs;

      if (instance &amp;&amp; !instance.Thumbs) {
        Thumbs = new FancyThumbs(instance);

        if (Thumbs.isActive &amp;&amp; Thumbs.opts.autoStart === true) {
          Thumbs.show();
        }
      }
    },

    "beforeShow.fb": function (e, instance, item, firstRun) {
      var Thumbs = instance &amp;&amp; instance.Thumbs;

      if (Thumbs &amp;&amp; Thumbs.isVisible) {
        Thumbs.focus(firstRun ? 0 : 250);
      }
    },

    "afterKeydown.fb": function (e, instance, current, keypress, keycode) {
      var Thumbs = instance &amp;&amp; instance.Thumbs;

      // "G"
      if (Thumbs &amp;&amp; Thumbs.isActive &amp;&amp; keycode === 71) {
        keypress.preventDefault();

        Thumbs.toggle();
      }
    },

    "beforeClose.fb": function (e, instance) {
      var Thumbs = instance &amp;&amp; instance.Thumbs;

      if (Thumbs &amp;&amp; Thumbs.isVisible &amp;&amp; Thumbs.opts.hideOnClose !== false) {
        Thumbs.$grid.hide();
      }
    }
  });
})(document, jQuery);
//// ==========================================================================
//
// Share
// Displays simple form for sharing current url
//
// ==========================================================================
(function (document, $) {
  "use strict";

  $.extend(true, $.fancybox.defaults, {
    btnTpl: {
      share: '&lt;button data-fancybox-share class="fancybox-button fancybox-button--share" title="{{SHARE}}"&gt;' +
        '&lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;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"/&gt;&lt;/svg&gt;' +
        "&lt;/button&gt;"
    },
    share: {
      url: function (instance, item) {
        return (
          (!instance.currentHash &amp;&amp; !(item.type === "inline" || item.type === "html") ? item.origSrc || item.src : false) || window.location
        );
      },
      tpl: '&lt;div class="fancybox-share"&gt;' +
        "&lt;h1&gt;{{SHARE}}&lt;/h1&gt;" +
        "&lt;p&gt;" +
        '&lt;a class="fancybox-share__button fancybox-share__button--fb" href="https://www.facebook.com/sharer/sharer.php?u={{url}}"&gt;' +
        '&lt;svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"&gt;&lt;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" /&gt;&lt;/svg&gt;' +
        "&lt;span&gt;Facebook&lt;/span&gt;" +
        "&lt;/a&gt;" +
        '&lt;a class="fancybox-share__button fancybox-share__button--tw" href="https://twitter.com/intent/tweet?url={{url}}&amp;text={{descr}}"&gt;' +
        '&lt;svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"&gt;&lt;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" /&gt;&lt;/svg&gt;' +
        "&lt;span&gt;Twitter&lt;/span&gt;" +
        "&lt;/a&gt;" +
        '&lt;a class="fancybox-share__button fancybox-share__button--pt" href="https://www.pinterest.com/pin/create/button/?url={{url}}&amp;description={{descr}}&amp;media={{media}}"&gt;' +
        '&lt;svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"&gt;&lt;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"/&gt;&lt;/svg&gt;' +
        "&lt;span&gt;Pinterest&lt;/span&gt;" +
        "&lt;/a&gt;" +
        "&lt;/p&gt;" +
        '&lt;p&gt;&lt;input class="fancybox-share__input" type="text" value="{{url_raw}}" onclick="select()" /&gt;&lt;/p&gt;' +
        "&lt;/div&gt;"
    }
  });

  function escapeHtml(string) {
    var entityMap = {
      "&amp;": "&amp;amp;",
      "&lt;": "&amp;lt;",
      "&gt;": "&amp;gt;",
      '"': "&amp;quot;",
      "'": "&amp;#39;",
      "/": "&amp;#x2F;",
      "`": "&amp;#x60;",
      "=": "&amp;#x3D;"
    };

    return String(string).replace(/[&amp;&lt;&gt;"'`=\/]/g, function (s) {
      return entityMap[s];
    });
  }

  $(document).on("click", "[data-fancybox-share]", function () {
    var instance = $.fancybox.getInstance(),
      current = instance.current || null,
      url,
      tpl;

    if (!current) {
      return;
    }

    if ($.type(current.opts.share.url) === "function") {
      url = current.opts.share.url.apply(current, [instance, current]);
    }

    tpl = current.opts.share.tpl
      .replace(/\{\{media\}\}/g, current.type === "image" ? encodeURIComponent(current.src) : "")
      .replace(/\{\{url\}\}/g, encodeURIComponent(url))
      .replace(/\{\{url_raw\}\}/g, escapeHtml(url))
      .replace(/\{\{descr\}\}/g, instance.$caption ? encodeURIComponent(instance.$caption.text()) : "");

    $.fancybox.open({
      src: instance.translate(instance, tpl),
      type: "html",
      opts: {
        touch: false,
        animationEffect: false,
        afterLoad: function (shareInstance, shareCurrent) {
          // Close self if parent instance is closing
          instance.$refs.container.one("beforeClose.fb", function () {
            shareInstance.close(null, 0);
          });

          // Opening links in a popup window
          shareCurrent.$content.find(".fancybox-share__button").click(function () {
            window.open(this.href, "Share", "width=550, height=450");
            return false;
          });
        },
        mobile: {
          autoFocus: false
        }
      }
    });
  });
})(document, jQuery);
// ==========================================================================
//
// Hash
// Enables linking to each modal
//
// ==========================================================================
(function (window, document, $) {
  "use strict";

  // Simple $.escapeSelector polyfill (for jQuery prior v3)
  if (!$.escapeSelector) {
    $.escapeSelector = function (sel) {
      var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
      var fcssescape = function (ch, asCodePoint) {
        if (asCodePoint) {
          // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
          if (ch === "\0") {
            return "\uFFFD";
          }

          // Control characters and (dependent upon position) numbers get escaped as code points
          return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
        }

        // Other potentially-special ASCII characters get backslash-escaped
        return "\\" + ch;
      };

      return (sel + "").replace(rcssescape, fcssescape);
    };
  }

  // Get info about gallery name and current index from url
  function parseUrl() {
    var hash = window.location.hash.substr(1),
      rez = hash.split("-"),
      index = rez.length &gt; 1 &amp;&amp; /^\+?\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10) || 1 : 1,
      gallery = rez.join("-");

    return {
      hash: hash,
      /* Index is starting from 1 */
      index: index &lt; 1 ? 1 : index,
      gallery: gallery
    };
  }

  // Trigger click evnt on links to open new fancyBox instance
  function triggerFromUrl(url) {
    if (url.gallery !== "") {
      // If we can find element matching 'data-fancybox' atribute,
      // then triggering click event should start fancyBox
      $("[data-fancybox='" + $.escapeSelector(url.gallery) + "']")
        .eq(url.index - 1)
        .focus()
        .trigger("click.fb-start");
    }
  }

  // Get gallery name from current instance
  function getGalleryID(instance) {
    var opts, ret;

    if (!instance) {
      return false;
    }

    opts = instance.current ? instance.current.opts : instance.opts;
    ret = opts.hash || (opts.$orig ? opts.$orig.data("fancybox") || opts.$orig.data("fancybox-trigger") : "");

    return ret === "" ? false : ret;
  }

  // Start when DOM becomes ready
  $(function () {
    // Check if user has disabled this module
    if ($.fancybox.defaults.hash === false) {
      return;
    }

    // Update hash when opening/closing fancyBox
    $(document).on({
      "onInit.fb": function (e, instance) {
        var url, gallery;

        if (instance.group[instance.currIndex].opts.hash === false) {
          return;
        }

        url = parseUrl();
        gallery = getGalleryID(instance);

        // Make sure gallery start index matches index from hash
        if (gallery &amp;&amp; url.gallery &amp;&amp; gallery == url.gallery) {
          instance.currIndex = url.index - 1;
        }
      },

      "beforeShow.fb": function (e, instance, current, firstRun) {
        var gallery;

        if (!current || current.opts.hash === false) {
          return;
        }

        // Check if need to update window hash
        gallery = getGalleryID(instance);

        if (!gallery) {
          return;
        }

        // Variable containing last hash value set by fancyBox
        // It will be used to determine if fancyBox needs to close after hash change is detected
        instance.currentHash = gallery + (instance.group.length &gt; 1 ? "-" + (current.index + 1) : "");

        // If current hash is the same (this instance most likely is opened by hashchange), then do nothing
        if (window.location.hash === "#" + instance.currentHash) {
          return;
        }

        if (firstRun &amp;&amp; !instance.origHash) {
          instance.origHash = window.location.hash;
        }

        if (instance.hashTimer) {
          clearTimeout(instance.hashTimer);
        }

        // Update hash
        instance.hashTimer = setTimeout(function () {
          if ("replaceState" in window.history) {
            window.history[firstRun ? "pushState" : "replaceState"]({},
              document.title,
              window.location.pathname + window.location.search + "#" + instance.currentHash
            );

            if (firstRun) {
              instance.hasCreatedHistory = true;
            }
          } else {
            window.location.hash = instance.currentHash;
          }

          instance.hashTimer = null;
        }, 300);
      },

      "beforeClose.fb": function (e, instance, current) {
        if (!current || current.opts.hash === false) {
          return;
        }

        clearTimeout(instance.hashTimer);

        // Goto previous history entry
        if (instance.currentHash &amp;&amp; instance.hasCreatedHistory) {
          window.history.back();
        } else if (instance.currentHash) {
          if ("replaceState" in window.history) {
            window.history.replaceState({}, document.title, window.location.pathname + window.location.search + (instance.origHash || ""));
          } else {
            window.location.hash = instance.origHash;
          }
        }

        instance.currentHash = null;
      }
    });

    // Check if need to start/close after url has changed
    $(window).on("hashchange.fb", function () {
      var url = parseUrl(),
        fb = null;

      // Find last fancyBox instance that has "hash"
      $.each(
        $(".fancybox-container")
        .get()
        .reverse(),
        function (index, value) {
          var tmp = $(value).data("FancyBox");

          if (tmp &amp;&amp; tmp.currentHash) {
            fb = tmp;
            return false;
          }
        }
      );

      if (fb) {
        // Now, compare hash values
        if (fb.currentHash !== url.gallery + "-" + url.index &amp;&amp; !(url.index === 1 &amp;&amp; fb.currentHash == url.gallery)) {
          fb.currentHash = null;

          fb.close();
        }
      } else if (url.gallery !== "") {
        triggerFromUrl(url);
      }
    });

    // Check current hash and trigger click event on matching element to start fancyBox, if needed
    setTimeout(function () {
      if (!$.fancybox.getInstance()) {
        triggerFromUrl(parseUrl());
      }
    }, 50);
  });
})(window, document, jQuery);
// ==========================================================================
//
// Wheel
// Basic mouse weheel support for gallery navigation
//
// ==========================================================================
(function (document, $) {
  "use strict";

  var prevTime = new Date().getTime();

  $(document).on({
    "onInit.fb": function (e, instance, current) {
      instance.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll", function (e) {
        var current = instance.current,
          currTime = new Date().getTime();

        if (instance.group.length &lt; 2 || current.opts.wheel === false || (current.opts.wheel === "auto" &amp;&amp; current.type !== "image")) {
          return;
        }

        e.preventDefault();
        e.stopPropagation();

        if (current.$slide.hasClass("fancybox-animated")) {
          return;
        }

        e = e.originalEvent || e;

        if (currTime - prevTime &lt; 250) {
          return;
        }

        prevTime = currTime;

        instance[(-e.deltaY || -e.deltaX || e.wheelDelta || -e.detail) &lt; 0 ? "next" : "previous"]();
      });
    }
  });
})(document, jQuery);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:70:"/local/templates/aspro_max/js/jquery.flexslider.min.js?171141774823454";s:6:"source";s:50:"/local/templates/aspro_max/js/jquery.flexslider.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
!function(w){var a=!0;function T(e){var t={identifier:0,target:e.target,screenX:e.screenX,screenY:e.screenY,clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY};return{touches:[t],targetTouches:[t],changedTouches:[t],altKey:e.altKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,target:e.target,preventDefault:e.preventDefault.bind(e),type:"mousedown"===e.type?"touchstart":"mousemove"===e.type?"touchmove":"mouseup"===e.type?"touchend":e.type,timeStamp:e.timeStamp||Date.now()}}w.flexslider=function(h,e){var y=w(h);y.vars=w.extend({},w.flexslider.defaults,e);var t,u=y.vars.namespace,S=window.navigator&amp;&amp;window.navigator.msPointerEnabled&amp;&amp;window.MSGesture,v=y.vars.touch,o="click touchend MSPointerUp keyup",l="",x="vertical"===y.vars.direction,b=y.vars.reverse,C=0&lt;y.vars.itemWidth,N="fade"===y.vars.animation,p=""!==y.vars.asNavFor,m={};w.data(h,"flexslider",y),m={init:function(){y.animating=!1,y.currentSlide=parseInt(y.vars.startAt?y.vars.startAt:0,10),isNaN(y.currentSlide)&amp;&amp;(y.currentSlide=0),y.animatingTo=y.currentSlide,y.atEnd=0===y.currentSlide||y.currentSlide===y.last,y.containerSelector=y.vars.selector.substr(0,y.vars.selector.search(" ")),y.slides=w(y.vars.selector,y),y.container=w(y.containerSelector,y),y.count=y.slides.length,y.syncExists=0&lt;w(y.vars.sync).length,"slide"===y.vars.animation&amp;&amp;(y.vars.animation="swing"),y.prop=x?"top":"marginLeft",y.args={},y.manualPause=!1,y.stopped=!1,y.started=!1,y.startTimeout=null,y.transitions=!y.vars.video&amp;&amp;!N&amp;&amp;y.vars.useCSS&amp;&amp;function(){var e=document.createElement("div"),t=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var a in t)if(void 0!==e.style[t[a]])return y.pfx=t[a].replace("Perspective","").toLowerCase(),y.prop="-"+y.pfx+"-transform",!0;return!1}(),(y.ensureAnimationEnd="")!==y.vars.controlsContainer&amp;&amp;(y.controlsContainer=0&lt;w(y.vars.controlsContainer).length&amp;&amp;w(y.vars.controlsContainer)),""!==y.vars.manualControls&amp;&amp;(y.manualControls=0&lt;w(y.vars.manualControls).length&amp;&amp;w(y.vars.manualControls)),""!==y.vars.customDirectionNav&amp;&amp;(y.customDirectionNav=2===w(y.vars.customDirectionNav).length&amp;&amp;w(y.vars.customDirectionNav)),y.vars.randomize&amp;&amp;(y.slides.sort(function(){return Math.round(Math.random())-.5}),y.container.empty().append(y.slides)),y.doMath(),y.setup("init"),y.vars.controlNav&amp;&amp;m.controlNav.setup(),y.vars.directionNav&amp;&amp;m.directionNav.setup(),y.vars.keyboard&amp;&amp;(1===w(y.containerSelector).length||y.vars.multipleKeyboard)&amp;&amp;w(document).bind("keyup",function(e){var t=e.keyCode;if(!y.animating&amp;&amp;(39===t||37===t)){var a=39===t?y.getTarget("next"):37===t&amp;&amp;y.getTarget("prev");y.flexAnimate(a,y.vars.pauseOnAction)}}),y.vars.mousewheel&amp;&amp;y.bind("mousewheel",function(e,t,a,n){e.preventDefault();var i=t&lt;0?y.getTarget("next"):y.getTarget("prev");y.flexAnimate(i,y.vars.pauseOnAction)}),y.vars.pausePlay&amp;&amp;m.pausePlay.setup(),y.vars.slideshow&amp;&amp;y.vars.pauseInvisible&amp;&amp;m.pauseInvisible.init(),y.vars.slideshow&amp;&amp;(y.vars.pauseOnHover&amp;&amp;y.hover(function(){y.manualPlay||y.manualPause||y.pause()},function(){y.manualPause||y.manualPlay||y.stopped||y.play()}),y.vars.pauseInvisible&amp;&amp;m.pauseInvisible.isHidden()||(0&lt;y.vars.initDelay?y.startTimeout=setTimeout(y.play,y.vars.initDelay):y.play())),p&amp;&amp;m.asNav.setup(),v&amp;&amp;y.vars.touch&amp;&amp;m.touch(),(!N||N&amp;&amp;y.vars.smoothHeight)&amp;&amp;w(window).bind("resize orientationchange",m.resize),y.find("img").attr("draggable","false"),setTimeout(function(){y.vars.start(y)},200)},asNav:{setup:function(){y.asNav=!0,y.animatingTo=Math.floor(y.currentSlide/y.move),y.currentItem=y.currentSlide,y.slides.removeClass(u+"active-slide").eq(y.currentItem).addClass(u+"active-slide"),S?(h._slider=y).slides.each(function(){var e=this;e._gesture=new MSGesture,(e._gesture.target=e).addEventListener("MSPointerDown",function(e){e.preventDefault(),e.currentTarget._gesture&amp;&amp;e.currentTarget._gesture.addPointer(e.pointerId)},!1),e.addEventListener("MSGestureTap",function(e){e.preventDefault();var t=w(this),a=t.index();w(y.vars.asNavFor).data("flexslider").animating||t.hasClass("active")||(y.direction=y.currentItem&lt;a?"next":"prev",y.flexAnimate(a,y.vars.pauseOnAction,!1,!0,!0))})}):y.slides.on(o,function(e){e.preventDefault();var t=w(this),a=t.index();t.offset().left-w(y).scrollLeft()&lt;=0&amp;&amp;t.hasClass(u+"active-slide")?y.flexAnimate(y.getTarget("prev"),!0):w(y.vars.asNavFor).data("flexslider").animating||t.hasClass(u+"active-slide")||(y.direction=y.currentItem&lt;a?"next":"prev",y.flexAnimate(a,y.vars.pauseOnAction,!1,!0,!0))})}},controlNav:{setup:function(){y.manualControls?m.controlNav.setupManual():m.controlNav.setupPaging()},setupPaging:function(){var e,t,a="thumbnails"===y.vars.controlNav?"control-thumbs":"control-paging",n=1;if(y.controlNavScaffold=w('&lt;ol class="'+u+"control-nav "+u+a+'"&gt;&lt;/ol&gt;'),1&lt;y.pagingCount)for(var i=0;i&lt;y.pagingCount;i++){void 0===(t=y.slides.eq(i)).attr("data-thumb-alt")&amp;&amp;t.attr("data-thumb-alt","");var r=""!==t.attr("data-thumb-alt")?r=' alt="'+t.attr("data-thumb-alt")+'"':"";if(e="thumbnails"===y.vars.controlNav?'&lt;img src="'+t.attr("data-thumb")+'"'+r+"/&gt;":'&lt;a href="#"&gt;'+n+"&lt;/a&gt;","thumbnails"===y.vars.controlNav&amp;&amp;!0===y.vars.thumbCaptions){var s=t.attr("data-thumbcaption");""!==s&amp;&amp;void 0!==s&amp;&amp;(e+='&lt;span class="'+u+'caption"&gt;'+s+"&lt;/span&gt;")}y.controlNavScaffold.append("&lt;li&gt;"+e+"&lt;/li&gt;"),n++}y.controlsContainer?w(y.controlsContainer).append(y.controlNavScaffold):y.append(y.controlNavScaffold),m.controlNav.set(),m.controlNav.active(),y.controlNavScaffold.delegate("a, img",o,function(e){if(e.preventDefault(),""===l||l===e.type){var t=w(this),a=y.controlNav.index(t);t.hasClass(u+"active")||(y.direction=a&gt;y.currentSlide?"next":"prev",y.flexAnimate(a,y.vars.pauseOnAction))}""===l&amp;&amp;(l=e.type),m.setToClearWatchedEvent()})},setupManual:function(){y.controlNav=y.manualControls,m.controlNav.active(),y.controlNav.bind(o,function(e){if(e.preventDefault(),""===l||l===e.type){var t=w(this),a=y.controlNav.index(t);t.hasClass(u+"active")||(a&gt;y.currentSlide?y.direction="next":y.direction="prev",y.flexAnimate(a,y.vars.pauseOnAction))}""===l&amp;&amp;(l=e.type),m.setToClearWatchedEvent()})},set:function(){var e="thumbnails"===y.vars.controlNav?"img":"a";y.controlNav=w("."+u+"control-nav li "+e,y.controlsContainer?y.controlsContainer:y)},active:function(){y.controlNav.removeClass(u+"active").eq(y.animatingTo).addClass(u+"active")},update:function(e,t){1&lt;y.pagingCount&amp;&amp;"add"===e?y.controlNavScaffold.append(w('&lt;li&gt;&lt;a href="#"&gt;'+y.count+"&lt;/a&gt;&lt;/li&gt;")):1===y.pagingCount?y.controlNavScaffold.find("li").remove():y.controlNav.eq(t).closest("li").remove(),m.controlNav.set(),1&lt;y.pagingCount&amp;&amp;y.pagingCount!==y.controlNav.length?y.update(t,e):m.controlNav.active()}},directionNav:{setup:function(){var e=w('&lt;ul class="'+u+'direction-nav"&gt;&lt;li class="'+u+'nav-prev"&gt;&lt;a class="'+u+'prev" href="#"&gt;'+y.vars.prevText+'&lt;/a&gt;&lt;/li&gt;&lt;li class="'+u+'nav-next"&gt;&lt;a class="'+u+'next" href="#"&gt;'+y.vars.nextText+"&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;");y.customDirectionNav?y.directionNav=y.customDirectionNav:y.controlsContainer?(w(y.controlsContainer).append(e),y.directionNav=w("."+u+"direction-nav li a",y.controlsContainer)):(y.append(e),y.directionNav=w("."+u+"direction-nav li a",y)),m.directionNav.update(),y.directionNav.bind(o,function(e){var t;e.preventDefault(),""!==l&amp;&amp;l!==e.type||(t=w(this).hasClass(u+"next")?y.getTarget("next"):y.getTarget("prev"),y.flexAnimate(t,y.vars.pauseOnAction)),""===l&amp;&amp;(l=e.type),m.setToClearWatchedEvent()})},update:function(){var e=u+"disabled";1===y.pagingCount||y.pagingCount&lt;1?(y.directionNav.addClass(e).attr("tabindex","-1"),y.directionNav.parent().addClass(e)):y.vars.animationLoop?(y.directionNav.removeClass(e).removeAttr("tabindex"),y.directionNav.parent().removeClass(e)):0===y.animatingTo?(y.directionNav.removeClass(e).filter("."+u+"prev").addClass(e).attr("tabindex","-1"),y.directionNav.parent().removeClass(e),y.directionNav.filter("."+u+"prev").parent().addClass(e)):y.animatingTo===y.last?(y.directionNav.removeClass(e).filter("."+u+"next").addClass(e).attr("tabindex","-1"),y.directionNav.parent().removeClass(e),y.directionNav.filter("."+u+"next").parent().addClass(e)):(y.directionNav.removeClass(e).removeAttr("tabindex"),y.directionNav.parent().removeClass(e))}},pausePlay:{setup:function(){var e=w('&lt;div class="'+u+'pauseplay"&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;/div&gt;');y.controlsContainer?(y.controlsContainer.append(e),y.pausePlay=w("."+u+"pauseplay a",y.controlsContainer)):(y.append(e),y.pausePlay=w("."+u+"pauseplay a",y)),m.pausePlay.update(y.vars.slideshow?u+"pause":u+"play"),y.pausePlay.bind(o,function(e){e.preventDefault(),""!==l&amp;&amp;l!==e.type||(w(this).hasClass(u+"pause")?(y.manualPause=!0,y.manualPlay=!1,y.pause()):(y.manualPause=!1,y.manualPlay=!0,y.play())),""===l&amp;&amp;(l=e.type),m.setToClearWatchedEvent()})},update:function(e){"play"===e?y.pausePlay.removeClass(u+"pause").addClass(u+"play").html(y.vars.playText):y.pausePlay.removeClass(u+"play").addClass(u+"pause").html(y.vars.pauseText)}},touch:function(){var i,r,s,o,l,c,t,d,u,e,v,p,m=!1,a=0,n=0,f=0,g=y.vars.simulateTouch;if(S){h.style.msTouchAction="none",h._gesture=new MSGesture,(h._gesture.target=h).addEventListener("MSPointerDown",function(e){e.stopPropagation(),y.animating?e.preventDefault():(y.pause(),h._gesture.addPointer(e.pointerId),f=0,o=x?y.h:y.w,c=Number(new Date),s=C&amp;&amp;b&amp;&amp;y.animatingTo===y.last?0:C&amp;&amp;b?y.limit-(y.itemW+y.vars.itemMargin)*y.move*y.animatingTo:C&amp;&amp;y.currentSlide===y.last?y.limit:C?(y.itemW+y.vars.itemMargin)*y.move*y.currentSlide:b?(y.last-y.currentSlide+y.cloneOffset)*o:(y.currentSlide+y.cloneOffset)*o)},!1),h._slider=y,h.addEventListener("MSGestureChange",function(e){e.stopPropagation();var t=e.target._slider;if(!t)return;var a=-e.translationX,n=-e.translationY;if(l=f+=x?n:a,m=x?Math.abs(f)&lt;Math.abs(-a):Math.abs(f)&lt;Math.abs(-n),e.detail===e.MSGESTURE_FLAG_INERTIA)return void setImmediate(function(){h._gesture.stop()});(!m||500&lt;Number(new Date)-c)&amp;&amp;(e.preventDefault(),!N&amp;&amp;t.transitions&amp;&amp;(t.vars.animationLoop||(l=f/(0===t.currentSlide&amp;&amp;f&lt;0||t.currentSlide===t.last&amp;&amp;0&lt;f?Math.abs(f)/o+2:1)),t.setProps(s+l,"setTouch")))},!1),h.addEventListener("MSGestureEnd",function(e){e.stopPropagation();var t=e.target._slider;if(!t)return;if(t.animatingTo===t.currentSlide&amp;&amp;!m&amp;&amp;null!==l){var a=b?-l:l,n=0&lt;a?t.getTarget("next"):t.getTarget("prev");t.canAdvance(n)&amp;&amp;(Number(new Date)-c&lt;550&amp;&amp;50&lt;Math.abs(a)||Math.abs(a)&gt;o/2)?t.flexAnimate(n,t.vars.pauseOnAction):N||t.flexAnimate(t.currentSlide,t.vars.pauseOnAction,!0)}s=l=r=i=null,f=0},!1)}else t=function(e){var t="touches"in e&amp;&amp;"A"==w(e.target)[0].nodeName;y.animating?e.preventDefault():!window.navigator.msPointerEnabled&amp;&amp;1!==e.touches.length||(y.pause(),o=x?y.h:y.w,c=Number(new Date),a=e.touches[0].pageX,n=e.touches[0].pageY,s=C&amp;&amp;b&amp;&amp;y.animatingTo===y.last?0:C&amp;&amp;b?y.limit-(y.itemW+y.vars.itemMargin)*y.move*y.animatingTo:C&amp;&amp;y.currentSlide===y.last?y.limit:C?(y.itemW+y.vars.itemMargin)*y.move*y.currentSlide:b?(y.last-y.currentSlide+y.cloneOffset)*o:(y.currentSlide+y.cloneOffset)*o,i=x?n:a,r=x?a:n,h.addEventListener("touchmove",d,!1),h.addEventListener("touchend",u,!1),g&amp;&amp;!t&amp;&amp;(h.addEventListener("mousemove",v,!1),h.addEventListener("mouseup",p,!1)))},d=function(e){a=e.touches[0].pageX,n=e.touches[0].pageY,l=x?i-n:i-a;(!(m=x?Math.abs(l)&lt;Math.abs(a-r):Math.abs(l)&lt;Math.abs(n-r))||500&lt;Number(new Date)-c)&amp;&amp;(e.preventDefault(),!N&amp;&amp;y.transitions&amp;&amp;(y.vars.animationLoop||(l/=0===y.currentSlide&amp;&amp;l&lt;0||y.currentSlide===y.last&amp;&amp;0&lt;l?Math.abs(l)/o+2:1),y.setProps(s+l,"setTouch")))},u=function(e){var t="touches"in e&amp;&amp;"A"==w(e.target)[0].nodeName;if(h.removeEventListener("touchmove",d,!1),g&amp;&amp;!t&amp;&amp;h.removeEventListener("mousemove",v,!1),y.animatingTo===y.currentSlide&amp;&amp;!m&amp;&amp;null!==l){var a=b?-l:l,n=0&lt;a?y.getTarget("next"):y.getTarget("prev");y.canAdvance(n)&amp;&amp;(Number(new Date)-c&lt;550&amp;&amp;50&lt;Math.abs(a)||Math.abs(a)&gt;o/2)?y.flexAnimate(n,y.vars.pauseOnAction):N||y.flexAnimate(y.currentSlide,y.vars.pauseOnAction,!0)}h.removeEventListener("touchend",u,!1),g&amp;&amp;!t&amp;&amp;h.removeEventListener("mouseup",p,!1),s=l=r=i=null},e=function(e){t.call(this,T(e))},v=function(e){d.call(this,T(e))},p=function(e){u.call(this,T(e))},h.addEventListener("touchstart",t,!1),g&amp;&amp;h.addEventListener("mousedown",e,!1)},resize:function(){!y.animating&amp;&amp;y.is(":visible")&amp;&amp;(void 0!==y.vars.autoHeight&amp;&amp;y.vars.autoHeight&amp;&amp;y.viewport.find("li").css("height",""),C||y.doMath(),N?m.smoothHeight():C?(y.slides.width(y.computedW),y.update(y.pagingCount)):x?(y.viewport.height(y.h),y.setProps(y.h,"setTotal"),y.viewport.find("li").css("height",y.h)):(y.vars.smoothHeight&amp;&amp;m.smoothHeight(),y.newSlides.width(y.computedW),y.setProps(y.computedW,"setTotal")))},smoothHeight:function(e){if(!x||N){var t=N?y:y.viewport;e?t.animate({height:y.slides.eq(y.animatingTo).innerHeight()},e):t.innerHeight(y.slides.eq(y.animatingTo).innerHeight())}},sync:function(e){var t=w(y.vars.sync).data("flexslider"),a=y.animatingTo;switch(e){case"animate":t.flexAnimate(a,y.vars.pauseOnAction,!1,!0);break;case"play":t.playing||t.asNav||t.play();break;case"pause":t.pause()}},uniqueID:function(e){return e.filter("[id]").add(e.find("[id]")).each(function(){var e=w(this);e.attr("id",e.attr("id")+"_clone")}),e},pauseInvisible:{visProp:null,init:function(){var e=m.pauseInvisible.getHiddenProp();if(e){var t=e.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(t,function(){m.pauseInvisible.isHidden()?y.startTimeout?clearTimeout(y.startTimeout):y.pause():y.started?y.play():0&lt;y.vars.initDelay?setTimeout(y.play,y.vars.initDelay):y.play()})}},isHidden:function(){var e=m.pauseInvisible.getHiddenProp();return!!e&amp;&amp;document[e]},getHiddenProp:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t&lt;e.length;t++)if(e[t]+"Hidden"in document)return e[t]+"Hidden";return null}},setToClearWatchedEvent:function(){clearTimeout(t),t=setTimeout(function(){l=""},3e3)}},y.flexAnimate=function(e,t,a,n,i){if(y.vars.animationLoop||e===y.currentSlide||(y.direction=e&gt;y.currentSlide?"next":"prev"),p&amp;&amp;1===y.pagingCount&amp;&amp;(y.direction=y.currentItem&lt;e?"next":"prev"),!y.animating&amp;&amp;(y.canAdvance(e,i)||a)){if(p&amp;&amp;n){var r=w(y.vars.asNavFor).data("flexslider");y.atEnd=0===e||e===y.count-1,r.flexAnimate(e,!0,!1,!0,i),y.direction=y.currentItem&lt;e?"next":"prev",r.direction=y.direction,y.currentItem=e,y.slides.removeClass(u+"active-slide").eq(e).addClass(u+"active-slide");var s=0&lt;Math.floor((e+1)/y.visible)?Math.floor((e+1-y.visible)/y.move):0;if(s==y.currentSlide)return!1;e=s}if(y.animating=!0,y.animatingTo=e,t&amp;&amp;y.pause(),y.vars.before(y),y.syncExists&amp;&amp;!i&amp;&amp;m.sync("animate"),y.vars.controlNav&amp;&amp;m.controlNav.active(),C||y.slides.removeClass(u+"active-slide").eq(e).addClass(u+"active-slide"),y.atEnd=0===e||e===y.last,y.vars.directionNav&amp;&amp;m.directionNav.update(),e===y.last&amp;&amp;(y.vars.end(y),y.vars.animationLoop||y.pause()),N)v?(y.slides.eq(y.currentSlide).css({opacity:0,zIndex:1}),y.slides.eq(e).css({opacity:1,zIndex:2}),y.wrapup(d)):(y.slides.eq(y.currentSlide).css({zIndex:1}).animate({opacity:0},y.vars.animationSpeed,y.vars.easing),y.slides.eq(e).css({zIndex:2}).animate({opacity:1},y.vars.animationSpeed,y.vars.easing,y.wrapup));else{var o,l,c,d=x?y.slides.filter(":first").height():y.computedW;l=C?(o=y.vars.itemMargin,(c=(y.itemW+o)*y.move*y.animatingTo)&gt;y.limit&amp;&amp;1!==y.visible?y.limit:c):0===y.currentSlide&amp;&amp;e===y.count-1&amp;&amp;y.vars.animationLoop&amp;&amp;"next"!==y.direction?b?(y.count+y.cloneOffset)*d:0:y.currentSlide===y.last&amp;&amp;0===e&amp;&amp;y.vars.animationLoop&amp;&amp;"prev"!==y.direction?b?0:(y.count+1)*d:b?(y.count-1-e+y.cloneOffset)*d:(e+y.cloneOffset)*d,y.setProps(l,"",y.vars.animationSpeed),y.transitions?(y.vars.animationLoop&amp;&amp;y.atEnd||(y.animating=!1,y.currentSlide=y.animatingTo),y.container.unbind("webkitTransitionEnd transitionend"),y.container.bind("webkitTransitionEnd transitionend",function(){clearTimeout(y.ensureAnimationEnd),y.wrapup(d)}),clearTimeout(y.ensureAnimationEnd),y.ensureAnimationEnd=setTimeout(function(){y.wrapup(d)},y.vars.animationSpeed+100)):y.container.animate(y.args,y.vars.animationSpeed,y.vars.easing,function(){y.wrapup(d)})}y.vars.smoothHeight&amp;&amp;m.smoothHeight(y.vars.animationSpeed)}},y.wrapup=function(e){N||C||(0===y.currentSlide&amp;&amp;y.animatingTo===y.last&amp;&amp;y.vars.animationLoop?y.setProps(e,"jumpEnd"):y.currentSlide===y.last&amp;&amp;0===y.animatingTo&amp;&amp;y.vars.animationLoop&amp;&amp;y.setProps(e,"jumpStart")),y.animating=!1,y.currentSlide=y.animatingTo,y.vars.after(y)},y.animateSlides=function(){!y.animating&amp;&amp;a&amp;&amp;y.flexAnimate(y.getTarget("next"))},y.pause=function(){clearInterval(y.animatedSlides),y.animatedSlides=null,y.playing=!1,y.vars.pausePlay&amp;&amp;m.pausePlay.update("play"),y.syncExists&amp;&amp;m.sync("pause")},y.play=function(){y.playing&amp;&amp;clearInterval(y.animatedSlides),y.animatedSlides=y.animatedSlides||setInterval(y.animateSlides,y.vars.slideshowSpeed),y.started=y.playing=!0,y.vars.pausePlay&amp;&amp;m.pausePlay.update("pause"),y.syncExists&amp;&amp;m.sync("play")},y.smoothHeight=function(){m.smoothHeight()},y.stop=function(){y.pause(),y.stopped=!0},y.canAdvance=function(e,t){var a=p?y.pagingCount-1:y.last;return!!t||(p&amp;&amp;y.currentItem===y.count-1&amp;&amp;0===e&amp;&amp;"prev"===y.direction||(!p||0!==y.currentItem||e!==y.pagingCount-1||"next"===y.direction)&amp;&amp;((e!==y.currentSlide||p)&amp;&amp;(!!y.vars.animationLoop||(!y.atEnd||0!==y.currentSlide||e!==a||"next"===y.direction)&amp;&amp;(!y.atEnd||y.currentSlide!==a||0!==e||"next"!==y.direction))))},y.getTarget=function(e){return"next"===(y.direction=e)?y.currentSlide===y.last?0:y.currentSlide+1:0===y.currentSlide?y.last:y.currentSlide-1},y.setProps=function(e,t,a){var n,i=(n=e||(y.itemW+y.vars.itemMargin)*y.move*y.animatingTo,-1*function(){if(C)return"setTouch"===t?e:b&amp;&amp;y.animatingTo===y.last?0:b?y.limit-(y.itemW+y.vars.itemMargin)*y.move*y.animatingTo:y.animatingTo===y.last?y.limit:n;switch(t){case"setTotal":return b?(y.count-1-y.currentSlide+y.cloneOffset)*e:(y.currentSlide+y.cloneOffset)*e;case"setTouch":return e;case"jumpEnd":return b?e:y.count*e;case"jumpStart":return b?y.count*e:e;default:return e}}()+"px");y.transitions&amp;&amp;(i=x?"translate3d(0,"+i+",0)":"translate3d("+i+",0,0)",a=void 0!==a?a/1e3+"s":"0s",y.container.css("-"+y.pfx+"-transition-duration",a),y.container.css("transition-duration",a)),y.args[y.prop]=i,!y.transitions&amp;&amp;void 0!==a||y.container.css(y.args),y.container.css("transform",i)},y.setup=function(e){var t,a;N?(y.slides.css({width:"100%",float:"left",marginRight:"-100%",position:"relative"}),"init"===e&amp;&amp;(v?y.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+y.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(y.currentSlide).css({opacity:1,zIndex:2}):0==y.vars.fadeFirstSlide?y.slides.css({opacity:0,display:"block",zIndex:1}).eq(y.currentSlide).css({zIndex:2}).css({opacity:1}):y.slides.css({opacity:0,display:"block",zIndex:1}).eq(y.currentSlide).css({zIndex:2}).animate({opacity:1},y.vars.animationSpeed,y.vars.easing)),y.vars.smoothHeight&amp;&amp;m.smoothHeight()):("init"===e&amp;&amp;(y.viewport=w('&lt;div class="'+u+'viewport"&gt;&lt;/div&gt;').css({overflow:"hidden",position:"relative"}).appendTo(y).append(y.container),y.cloneCount=0,y.cloneOffset=0,b&amp;&amp;(a=w.makeArray(y.slides).reverse(),y.slides=w(a),y.container.empty().append(y.slides))),y.vars.animationLoop&amp;&amp;!C&amp;&amp;(y.cloneCount=2,y.cloneOffset=1,y.viewport.find("li").css("height",y.h),"init"!==e&amp;&amp;y.container.find(".clone").remove(),y.container.append(m.uniqueID(y.slides.first().clone().addClass("clone")).attr("aria-hidden","true")).prepend(m.uniqueID(y.slides.last().clone().addClass("clone")).attr("aria-hidden","true"))),y.newSlides=w(y.vars.selector,y),t=b?y.count-1-y.currentSlide+y.cloneOffset:y.currentSlide+y.cloneOffset,x&amp;&amp;!C?(y.container.height(200*(y.count+y.cloneCount)+"%").css("position","absolute").width("100%"),setTimeout(function(){y.newSlides.css({display:"block"}),y.doMath(),y.viewport.height(y.h),y.setProps(t*y.h,"init")},"init"===e?100:0)):(y.container.width(200*(y.count+y.cloneCount)+"%"),y.setProps(t*y.computedW,"init"),setTimeout(function(){y.doMath(),y.newSlides.css({width:y.computedW,marginRight:y.computedM,float:"left",display:"block"}),y.vars.smoothHeight&amp;&amp;m.smoothHeight()},"init"===e?100:0)));C||y.slides.removeClass(u+"active-slide").eq(y.currentSlide).addClass(u+"active-slide"),y.vars.init(y)},y.doMath=function(){var e=y.slides.first(),t=y.vars.itemMargin,a=y.vars.minItems,n=y.vars.maxItems;y.w=void 0===y.viewport?y.width():y.viewport.width(),y.h=e.height();var i=0;x&amp;&amp;(y.slides.each(function(e,t){var a=w(t).height();i&lt;a&amp;&amp;(i=a)}),y.h=i),y.boxPadding=e.outerWidth()-e.width(),C?(y.itemT=y.vars.itemWidth+t,y.itemM=t,y.minW=a?a*y.itemT:y.w,y.maxW=n?n*y.itemT-t:y.w,y.itemW=y.minW&gt;y.w?(y.w-t*(a-1))/a:y.maxW&lt;y.w?(y.w-t*(n-1))/n:y.vars.itemWidth&gt;y.w?y.w:y.vars.itemWidth,y.visible=Math.floor(y.w/y.itemW),y.move=0&lt;y.vars.move&amp;&amp;y.vars.move&lt;y.visible?y.vars.move:y.visible,y.pagingCount=Math.ceil((y.count-y.visible)/y.move+1),y.last=y.pagingCount-1,y.limit=1===y.pagingCount?0:y.vars.itemWidth&gt;y.w?y.itemW*(y.count-1)+t*(y.count-1):(y.itemW+t)*y.count-y.w-t):(y.itemW=y.w,y.itemM=t,y.pagingCount=y.count,y.last=y.count-1),y.computedW=y.itemW-y.boxPadding,y.computedM=y.itemM},y.update=function(e,t){y.doMath(),C||(e&lt;y.currentSlide?y.currentSlide+=1:e&lt;=y.currentSlide&amp;&amp;0!==e&amp;&amp;(y.currentSlide-=1),y.animatingTo=y.currentSlide),y.vars.controlNav&amp;&amp;!y.manualControls&amp;&amp;("add"===t&amp;&amp;!C||y.pagingCount&gt;y.controlNav.length?m.controlNav.update("add"):("remove"===t&amp;&amp;!C||y.pagingCount&lt;y.controlNav.length)&amp;&amp;m.controlNav.update("remove",y.last)),y.vars.directionNav&amp;&amp;m.directionNav.update()},y.addSlide=function(e,t){var a=w(e);y.count+=1,y.last=y.count-1,x&amp;&amp;b?void 0!==t?y.slides.eq(y.count-t).after(a):y.container.prepend(a):void 0!==t?y.slides.eq(t).before(a):y.container.append(a),y.update(t,"add"),y.slides=w(y.vars.selector+":not(.clone)",y),y.setup(),y.vars.added(y)},y.removeSlide=function(e){var t=isNaN(e)?y.slides.index(w(e)):e;y.count-=1,y.last=y.count-1,isNaN(e)?w(e,y.slides).remove():x&amp;&amp;b?y.slides.eq(y.last).remove():y.slides.eq(e).remove(),y.doMath(),y.update(t,"remove"),y.slides=w(y.vars.selector+":not(.clone)",y),y.setup(),y.vars.removed(y)},m.init()},w(window).blur(function(e){a=!1}).focus(function(e){a=!0}),w.flexslider.defaults={namespace:"flex-",selector:".slides &gt; li",animation:"fade",easing:"swing",direction:"horizontal",reverse:!1,animationLoop:!0,smoothHeight:!1,startAt:0,slideshow:!0,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:!1,fadeFirstSlide:!0,thumbCaptions:!1,pauseOnAction:!0,pauseOnHover:!1,pauseInvisible:!0,useCSS:!0,touch:!0,video:!1,simulateTouch:!1,controlNav:!0,directionNav:!0,prevText:"Previous",nextText:"Next",keyboard:!0,multipleKeyboard:!1,mousewheel:!1,pausePlay:!1,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",customDirectionNav:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:!0,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){},init:function(){}},w.fn.flexslider=function(n){if(void 0===n&amp;&amp;(n={}),"object"==typeof n)return this.each(function(){var e=w(this),t=n.selector?n.selector:".slides &gt; li",a=e.find(t);1===a.length&amp;&amp;!1===n.allowOneSlide||0===a.length?(a.fadeIn(400),n.start&amp;&amp;n.start(e)):void 0===e.data("flexslider")&amp;&amp;new w.flexslider(this,n)});var e=w(this).data("flexslider");switch(n){case"play":e.play();break;case"pause":e.pause();break;case"stop":e.stop();break;case"next":e.flexAnimate(e.getTarget("next"),!0);break;case"prev":case"previous":e.flexAnimate(e.getTarget("prev"),!0);break;default:"number"==typeof n&amp;&amp;e.flexAnimate(n,!0)}}}(jQuery);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:66:"/local/templates/aspro_max/js/jquery.uniform.min.js?17114177498308";s:6:"source";s:51:"/local/templates/aspro_max/js/jquery.uniform.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
(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)&amp;&amp;(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("&lt;div /&gt;"),r=e("&lt;span /&gt;"),s.autoHide&amp;&amp;t.is(":hidden")&amp;&amp;"none"===t.css("display")&amp;&amp;i.hide(),a.divClass&amp;&amp;i.addClass(a.divClass),s.wrapperClass&amp;&amp;i.addClass(s.wrapperClass),a.spanClass&amp;&amp;r.addClass(a.spanClass),l=n(t,"id"),s.useID&amp;&amp;l&amp;&amp;n(i,"id",s.idPrefix+"-"+l),a.spanHtml&amp;&amp;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("&lt;span /&gt;").addClass(n.wrapperClass),s=o(t,s,"wrap")):null}function f(){var t,n,s,a;return a="rgb(120,2,153)",n=e('&lt;div style="width:0;height:0;color:'+a+'"&gt;'),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("&lt;span /&gt;").text(t).html():""}function m(){return navigator.cpuClass&amp;&amp;!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&gt;=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;for(e in t)Object.prototype.hasOwnProperty.call(t,e)&amp;&amp;(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")&amp;&amp;(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")&amp;&amp;s&amp;&amp;(a=n(e,"target"),i=n(e,"href"),a&amp;&amp;"_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("&lt;span /&gt;").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)&gt;=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&amp;&amp;e.addClass(s),{remove:function(){e.removeClass(t.inputClass),t.inputAddTypeAsClass&amp;&amp;e.removeClass(s),i&amp;&amp;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")&amp;&amp;!h(e)?!0:!1},apply:function(t,n){var r,l,o,d;return n.selectAutoWidth&amp;&amp;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&amp;&amp;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")&amp;&amp;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&amp;&amp;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&amp;&amp;e.unwrap()},update:C}}}];m()&amp;&amp;!v()&amp;&amp;(H=!1),e.uniform={defaults:{activeClass:"active",autoHide:!0,buttonClass:"button",checkboxClass:"checker",checkedClass:"checked",disabledClass:"disabled",eventNamespace:".uniform",fileButtonClass:"action",fileButtonHtml:"Choose 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()&amp;&amp;(H=!1)),H?(t.resetSelector&amp;&amp;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&gt;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&amp;&amp;(n=e.uniform.elements),e(n).each(function(){var t,n,s=e(this);n=s.data("uniformed"),n&amp;&amp;(n.remove(),t=e.inArray(this,e.uniform.elements),t&gt;=0&amp;&amp;e.uniform.elements.splice(t,1),s.removeData("uniformed"))})},e.uniform.update=e.fn.uniform.update=function(n){n===t&amp;&amp;(n=e.uniform.elements),e(n).each(function(){var t,n=e(this);t=n.data("uniformed"),t&amp;&amp;t.update(n,t.options)})}})(jQuery);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:85:"/local/templates/aspro_max/vendor/js/carousel/owl/owl.carousel.min.js?171141775744743";s:6:"source";s:65:"/local/templates/aspro_max/vendor/js/carousel/owl/owl.carousel.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
(function(t,e,i,s){function n(e,i){this.settings=null,this.options=t.extend({},n.Defaults,i),this.$element=t(e),this._handlers={},this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._widths=[],this._invalidated={},this._pipe=[],this._drag={time:null,target:null,pointer:null,stage:{start:null,current:null},direction:null},this._states={current:{},tags:{initializing:["busy"],animating:["busy"],dragging:["interacting"]}},t.each(["onResize","onThrottledResize"],t.proxy(function(e,i){this._handlers[i]=t.proxy(this[i],this)},this)),t.each(n.Plugins,t.proxy(function(t,e){this._plugins[t.charAt(0).toLowerCase()+t.slice(1)]=new e(this)},this)),t.each(n.Workers,t.proxy(function(e,i){this._pipe.push({filter:i.filter,run:t.proxy(i.run,this)})},this)),this.setup(),this.initialize()}n.Defaults={items:3,loop:!1,center:!1,rewind:!1,checkVisibility:!0,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:e,fallbackEasing:"swing",slideTransition:"",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",refreshClass:"owl-refresh",loadedClass:"owl-loaded",loadingClass:"owl-loading",rtlClass:"owl-rtl",responsiveClass:"owl-responsive",dragClass:"owl-drag",itemClass:"owl-item",stageClass:"owl-stage",stageOuterClass:"owl-stage-outer",grabClass:"owl-grab"},n.Width={Default:"default",Inner:"inner",Outer:"outer"},n.Type={Event:"event",State:"state"},n.Plugins={},n.Workers=[{filter:["width","settings"],run:function(){this._width=this.$element.width()}},{filter:["width","items","settings"],run:function(t){t.current=this._items&amp;&amp;this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){this.$stage.children(".cloned").remove()}},{filter:["width","items","settings"],run:function(t){var e=this.settings.margin||"",i=!this.settings.autoWidth,s=this.settings.rtl,n={width:"auto","margin-left":s?e:"","margin-right":s?"":e};!i&amp;&amp;this.$stage.children().css(n),t.css=n}},{filter:["width","items","settings"],run:function(t){var e=(this.width()/this.settings.items).toFixed(3)-this.settings.margin,i=null,s=this._items.length,n=!this.settings.autoWidth,o=[];for(t.items={merge:!1,width:e};s--;)i=this._mergers[s],i=this.settings.mergeFit&amp;&amp;Math.min(i,this.settings.items)||i,t.items.merge=i&gt;1||t.items.merge,o[s]=n?e*i:this._items[s].width();this._widths=o}},{filter:["items","settings"],run:function(){var e=[],i=this._items,s=this.settings,n=Math.max(2*s.items,4),o=2*Math.ceil(i.length/2),r=s.loop&amp;&amp;i.length?s.rewind?n:Math.max(n,o):0,a="",h="";for(r/=2;r&gt;0;)e.push(this.normalize(e.length/2,!0)),a+=i[e[e.length-1]][0].outerHTML,e.push(this.normalize(i.length-1-(e.length-1)/2,!0)),h=i[e[e.length-1]][0].outerHTML+h,r-=1;this._clones=e,t(a).addClass("cloned").appendTo(this.$stage),t(h).addClass("cloned").prependTo(this.$stage)}},{filter:["width","items","settings"],run:function(){var t=this.settings.rtl?1:-1,e=this._clones.length+this._items.length,i=-1,s=0,n=0,o=[],r=!1;for(this._widths[this._widths.length-1]&lt;this._width&amp;&amp;!this.settings.loop&amp;&amp;this.settings.lightDrag&amp;&amp;(r=this._width-this._widths[this._widths.length-1]);++i&lt;e;)s=o[i-1]||0,n=this._widths[this.relative(i)]+this.settings.margin,i==e-2&amp;&amp;r?o.push(s+n*t+r+this.settings.margin):o.push(s+n*t);this._coordinates=o}},{filter:["width","items","settings"],run:function(){var t=this.settings.stagePadding,e=this._coordinates,i={width:Math.ceil(Math.abs(e[e.length-1]))+2*t,"padding-left":t||"","padding-right":t||""};this.$stage.css(i)}},{filter:["width","items","settings"],run:function(t){var e=this._coordinates.length,i=!this.settings.autoWidth,s=this.$stage.children();if(i&amp;&amp;t.items.merge)for(;e--;)t.css.width=this._widths[this.relative(e)],s.eq(e).css(t.css);else i&amp;&amp;(t.css.width=t.items.width,s.css(t.css))}},{filter:["items"],run:function(){this._coordinates.length&lt;1&amp;&amp;this.$stage.removeAttr("style")}},{filter:["width","items","settings"],run:function(t){t.current=t.current?this.$stage.children().index(t.current):0,t.current=Math.max(this.minimum(),Math.min(this.maximum(),t.current)),this.reset(t.current)}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){var t,e,i,s,n=this.settings.rtl?1:-1,o=2*this.settings.stagePadding,r=this.coordinates(this.current())+o,a=r+this.width()*n,h=[];for(i=0,s=this._coordinates.length;i&lt;s;i++)t=this._coordinates[i-1]||0,e=Math.abs(this._coordinates[i])+o*n,(this.op(t,"&lt;=",r)&amp;&amp;this.op(t,"&gt;",a)||this.op(e,"&lt;",r)&amp;&amp;this.op(e,"&gt;",a))&amp;&amp;h.push(i);this.$stage.children(".active").removeClass("active"),this.$stage.children(":eq("+h.join("), :eq(")+")").addClass("active"),this.$stage.children(".center").removeClass("center"),this.settings.center&amp;&amp;this.$stage.children().eq(this.current()).addClass("center")}}],n.prototype.initializeStage=function(){this.$stage=this.$element.find("."+this.settings.stageClass),this.$stage.length||(this.$element.addClass(this.options.loadingClass),this.$stage=t("&lt;"+this.settings.stageElement+"&gt;",{class:this.settings.stageClass}).wrap(t("&lt;div/&gt;",{class:this.settings.stageOuterClass})),this.$element.append(this.$stage.parent()))},n.prototype.initializeItems=function(){var e=this.$element.find(".owl-item");if(e.length)return this._items=e.get().map(function(e){return t(e)}),this._mergers=this._items.map(function(){return 1}),void this.refresh();this.replace(this.$element.children().not(this.$stage.parent())),this.isVisible()?this.refresh():this.invalidate("width"),this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass)},n.prototype.initialize=function(){var t,e,i;(this.enter("initializing"),this.trigger("initialize"),this.$element.toggleClass(this.settings.rtlClass,this.settings.rtl),this.settings.autoWidth&amp;&amp;!this.is("pre-loading"))&amp;&amp;(t=this.$element.find("img"),e=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:s,i=this.$element.children(e).width(),t.length&amp;&amp;i&lt;=0&amp;&amp;this.preloadAutoWidthImages(t));this.initializeStage(),this.initializeItems(),this.registerEventHandlers(),this.leave("initializing"),this.trigger("initialized")},n.prototype.isVisible=function(){return!this.settings.checkVisibility||this.$element.is(":visible")},n.prototype.setup=function(){var e=this.viewport(),i=this.options.responsive,s=-1,n=null;i?(t.each(i,function(t){t&lt;=e&amp;&amp;t&gt;s&amp;&amp;(s=Number(t))}),n=t.extend({},this.options,i[s]),"function"==typeof n.stagePadding&amp;&amp;(n.stagePadding=n.stagePadding()),delete n.responsive,n.responsiveClass&amp;&amp;this.$element.attr("class",this.$element.attr("class").replace(new RegExp("("+this.options.responsiveClass+"-)\\S+\\s","g"),"$1"+s))):n=t.extend({},this.options),this.trigger("change",{property:{name:"settings",value:n}}),this._breakpoint=s,this.settings=n,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}})},n.prototype.optionsLogic=function(){this.settings.autoWidth&amp;&amp;(this.settings.stagePadding=!1,this.settings.merge=!1)},n.prototype.prepare=function(e){var i=this.trigger("prepare",{content:e});return i.data||(i.data=t("&lt;"+this.settings.itemElement+"/&gt;").addClass(this.options.itemClass).append(e)),this.trigger("prepared",{content:i.data}),i.data},n.prototype.update=function(){for(var e=0,i=this._pipe.length,s=t.proxy(function(t){return this[t]},this._invalidated),n={};e&lt;i;)(this._invalidated.all||t.grep(this._pipe[e].filter,s).length&gt;0)&amp;&amp;this._pipe[e].run(n),e++;this._invalidated={},!this.is("valid")&amp;&amp;this.enter("valid")},n.prototype.width=function(t){switch(t=t||n.Width.Default,t){case n.Width.Inner:case n.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},n.prototype.refresh=function(){this.enter("refreshing"),this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$element.addClass(this.options.refreshClass),this.update(),this.$element.removeClass(this.options.refreshClass),this.leave("refreshing"),this.trigger("refreshed")},n.prototype.onThrottledResize=function(){e.clearTimeout(this.resizeTimer),this.resizeTimer=e.setTimeout(this._handlers.onResize,this.settings.responsiveRefreshRate)},n.prototype.onResize=function(){return!!this._items.length&amp;&amp;(this._width!==this.$element.width()&amp;&amp;(!!this.isVisible()&amp;&amp;(this.enter("resizing"),this.trigger("resize").isDefaultPrevented()?(this.leave("resizing"),!1):(this.invalidate("width"),this.refresh(),this.leave("resizing"),void this.trigger("resized")))))},n.prototype.registerEventHandlers=function(){t.support.transition&amp;&amp;this.$stage.on(t.support.transition.end+".owl.core",t.proxy(this.onTransitionEnd,this)),!1!==this.settings.responsive&amp;&amp;this.on(e,"resize",this._handlers.onThrottledResize),this.settings.mouseDrag&amp;&amp;(this.$element.addClass(this.options.dragClass),this.$stage.on("mousedown.owl.core",t.proxy(this.onDragStart,this)),this.$stage.on("dragstart.owl.core selectstart.owl.core",function(){return!1})),this.settings.touchDrag&amp;&amp;(this.$stage.on("touchstart.owl.core",t.proxy(this.onDragStart,this)),this.$stage.on("touchcancel.owl.core",t.proxy(this.onDragEnd,this)))},n.prototype.onDragStart=function(e){var s=null;3!==e.which&amp;&amp;(this.settings.marginMove?(s=this.$stage.css("margin-left").replace("px",""),s={x:s,y:0}):t.support.transform?(s=this.$stage.css("transform").replace(/.*\(|\)| /g,"").split(","),s={x:s[16===s.length?12:4],y:s[16===s.length?13:5]}):(s=this.$stage.position(),s={x:this.settings.rtl?s.left+this.$stage.width()-this.width()+this.settings.margin:s.left,y:s.top}),this.is("animating")&amp;&amp;(t.support.transform?this.animate(s.x):this.$stage.stop(),this.invalidate("position")),this.$element.toggleClass(this.options.grabClass,"mousedown"===e.type),this.speed(0),this._drag.time=(new Date).getTime(),this._drag.target=t(e.target),this._drag.stage.start=s,this._drag.stage.current=s,this._drag.pointer=this.pointer(e),t(i).on("mouseup.owl.core touchend.owl.core",t.proxy(this.onDragEnd,this)),t(i).one("mousemove.owl.core touchmove.owl.core",t.proxy(function(e){var s=this.difference(this._drag.pointer,this.pointer(e));t(i).on("mousemove.owl.core touchmove.owl.core",t.proxy(this.onDragMove,this)),Math.abs(s.x)&lt;Math.abs(s.y)&amp;&amp;this.is("valid")||(e.preventDefault(),this.enter("dragging"),this.trigger("drag"))},this)))},n.prototype.onDragMove=function(t){var e=null,i=null,s=null,n=this.difference(this._drag.pointer,this.pointer(t)),o=this.difference(this._drag.stage.start,n);this.is("dragging")&amp;&amp;(t.preventDefault(),this.settings.loop?(e=this.coordinates(this.minimum()),i=this.coordinates(this.maximum()+1)-e,o.x=((o.x-e)%i+i)%i+e):(e=this.settings.rtl?this.coordinates(this.maximum()):this.coordinates(this.minimum()),i=this.settings.rtl?this.coordinates(this.minimum()):this.coordinates(this.maximum()),s=this.settings.pullDrag?-1*n.x/5:0,o.x=Math.max(Math.min(o.x,e+s),i+s)),this._drag.stage.current=o,this.animate(o.x))},n.prototype.onDragEnd=function(e){var s=this.difference(this._drag.pointer,this.pointer(e)),n=this._drag.stage.current,o=s.x&gt;0^this.settings.rtl?"left":"right";if(t(i).off(".owl.core"),this.$element.removeClass(this.options.grabClass),0!==s.x&amp;&amp;this.is("dragging")||!this.is("valid")){this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(this.closest(n.x,0!==s.x?o:this._drag.direction)),this.invalidate("position");var r=!1;this.settings.loop||(r=0===this.current()?n.x&gt;0:n.x&lt;this.coordinates()[this._items.length-1]),this.settings.lightDrag&amp;&amp;!r||this.update(),this._drag.direction=o,(Math.abs(s.x)&gt;3||(new Date).getTime()-this._drag.time&gt;300)&amp;&amp;this._drag.target.one("click.owl.core",function(){return!1})}this.is("dragging")&amp;&amp;(this.leave("dragging"),this.trigger("dragged"))},n.prototype.closest=function(e,i){var n=-1,o=30,r=this.width(),a=this.coordinates();return this.settings.freeDrag||t.each(a,t.proxy(function(t,h){return"left"===i&amp;&amp;e&gt;h-o&amp;&amp;e&lt;h+o?n=t:"right"===i&amp;&amp;e&gt;h-r-o&amp;&amp;e&lt;h-r+o?n=t+1:this.op(e,"&lt;",h)&amp;&amp;this.op(e,"&gt;",a[t+1]!==s?a[t+1]:h-r)&amp;&amp;(n="left"===i?t+1:t),-1===n},this)),this.settings.loop||(this.op(e,"&gt;",a[this.minimum()])?n=e=this.minimum():this.op(e,"&lt;",a[this.maximum()])&amp;&amp;(n=e=this.maximum())),n},n.prototype.animate=function(e){var i=this.speed()&gt;0;this.is("animating")&amp;&amp;this.onTransitionEnd(),i&amp;&amp;(this.enter("animating"),this.trigger("translate")),this.settings.marginMove?this.$stage.css({"margin-left":e+"px",transition:this.speed()/1e3+"s"+(this.settings.slideTransition?" "+this.settings.slideTransition:"")}):t.support.transform3d&amp;&amp;t.support.transition?this.$stage.css({transform:"translate3d("+e+"px,0px,0px)",transition:this.speed()/1e3+"s"+(this.settings.slideTransition?" "+this.settings.slideTransition:"")}):i?this.$stage.animate({left:e+"px"},this.speed(),this.settings.fallbackEasing,t.proxy(this.onTransitionEnd,this)):this.$stage.css({left:e+"px"})},n.prototype.is=function(t){return this._states.current[t]&amp;&amp;this._states.current[t]&gt;0},n.prototype.current=function(t){if(t===s)return this._current;if(0===this._items.length)return s;if(t=this.normalize(t),this._current!==t){var e=this.trigger("change",{property:{name:"position",value:t}});e.data!==s&amp;&amp;(t=this.normalize(e.data)),this._current=t,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})}return this._current},n.prototype.invalidate=function(e){return"string"===t.type(e)&amp;&amp;(this._invalidated[e]=!0,this.is("valid")&amp;&amp;this.leave("valid")),t.map(this._invalidated,function(t,e){return e})},n.prototype.reset=function(t){t=this.normalize(t),t!==s&amp;&amp;(this._speed=0,this._current=t,this.suppress(["translate","translated"]),this.animate(this.coordinates(t)),this.release(["translate","translated"]))},n.prototype.normalize=function(t,e){var i=this._items.length,n=e?0:this._clones.length;return!this.isNumeric(t)||i&lt;1?t=s:(t&lt;0||t&gt;=i+n)&amp;&amp;(t=((t-n/2)%i+i)%i+n/2),t},n.prototype.relative=function(t){return t-=this._clones.length/2,this.normalize(t,!0)},n.prototype.maximum=function(t){var e,i,s,n=this.settings,o=this._coordinates.length;if(n.loop)o=this._clones.length/2+this._items.length-1;else if(n.autoWidth||n.merge){if(e=this._items.length,e)for(i=this._items[--e].width(),s=this.$element.width();e--&amp;&amp;(i+=this._items[e].width()+this.settings.margin,!(i&gt;s)););o=e+1}else o=n.center?this._items.length-1:this._items.length-n.items;return t&amp;&amp;(o-=this._clones.length/2),Math.max(o,0)},n.prototype.minimum=function(t){return t?0:this._clones.length/2},n.prototype.items=function(t){return t===s?this._items.slice():(t=this.normalize(t,!0),this._items[t])},n.prototype.mergers=function(t){return t===s?this._mergers.slice():(t=this.normalize(t,!0),this._mergers[t])},n.prototype.clones=function(e){var i=this._clones.length/2,n=i+this._items.length,o=function(t){return t%2==0?n+t/2:i-(t+1)/2};return e===s?t.map(this._clones,function(t,e){return o(e)}):t.map(this._clones,function(t,i){return t===e?o(i):null})},n.prototype.speed=function(t){return t!==s&amp;&amp;(this._speed=t),this._speed},n.prototype.coordinates=function(e){var i,n=1,o=e-1;return e===s?t.map(this._coordinates,t.proxy(function(t,e){return this.coordinates(e)},this)):(this.settings.center?(this.settings.rtl&amp;&amp;(n=-1,o=e+1),i=this._coordinates[e],i+=(this.width()-i+(this._coordinates[o]||0))/2*n):i=this._coordinates[o]||0,i=Math.ceil(i),i)},n.prototype.duration=function(t,e,i){return 0===i?0:Math.min(Math.max(Math.abs(e-t),1),6)*Math.abs(i||this.settings.smartSpeed)},n.prototype.to=function(t,e){var i=this.current(),s=null,n=t-this.relative(i),o=(n&gt;0)-(n&lt;0),r=this._items.length,a=this.minimum(),h=this.maximum();this.settings.loop?(!this.settings.rewind&amp;&amp;Math.abs(n)&gt;r/2&amp;&amp;(n+=-1*o*r),t=i+n,s=((t-a)%r+r)%r+a,s!==t&amp;&amp;s-n&lt;=h&amp;&amp;s-n&gt;0&amp;&amp;(i=s-n,t=s,this.reset(i))):this.settings.rewind?(h+=1,t=(t%h+h)%h):t=Math.max(a,Math.min(h,t)),this.speed(this.duration(i,t,e)),this.current(t),this.isVisible()&amp;&amp;this.update()},n.prototype.next=function(t){t=t||!1,this.to(this.relative(this.current())+1,t)},n.prototype.prev=function(t){t=t||!1,this.to(this.relative(this.current())-1,t)},n.prototype.onTransitionEnd=function(t){if(t!==s&amp;&amp;(t.stopPropagation(),(t.target||t.srcElement||t.originalTarget)!==this.$stage.get(0)))return!1;this.leave("animating"),this.trigger("translated")},n.prototype.viewport=function(){var s;return this.options.responsiveBaseElement!==e?s=t(this.options.responsiveBaseElement).width():e.innerWidth?s=e.innerWidth:i.documentElement&amp;&amp;i.documentElement.clientWidth?s=i.documentElement.clientWidth:console.warn("Can not detect viewport width."),s},n.prototype.replace=function(e){this.$stage.empty(),this._items=[],e&amp;&amp;(e=e instanceof jQuery?e:t(e)),this.settings.nestedItemSelector&amp;&amp;(e=e.find("."+this.settings.nestedItemSelector)),e.filter(function(){return 1===this.nodeType}).each(t.proxy(function(t,e){e=this.prepare(e),this.$stage.append(e),this._items.push(e),this._mergers.push(1*e.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)},this)),this.reset(this.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},n.prototype.add=function(e,i){var n=this.relative(this._current);i=i===s?this._items.length:this.normalize(i,!0),e=e instanceof jQuery?e:t(e),this.trigger("add",{content:e,position:i}),e=this.prepare(e),0===this._items.length||i===this._items.length?(0===this._items.length&amp;&amp;this.$stage.append(e),0!==this._items.length&amp;&amp;this._items[i-1].after(e),this._items.push(e),this._mergers.push(1*e.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)):(this._items[i].before(e),this._items.splice(i,0,e),this._mergers.splice(i,0,1*e.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)),this._items[n]&amp;&amp;this.reset(this._items[n].index()),this.invalidate("items"),this.trigger("added",{content:e,position:i})},n.prototype.remove=function(t){t=this.normalize(t,!0),t!==s&amp;&amp;(this.trigger("remove",{content:this._items[t],position:t}),this._items[t].remove(),this._items.splice(t,1),this._mergers.splice(t,1),this.invalidate("items"),this.trigger("removed",{content:null,position:t}))},n.prototype.preloadAutoWidthImages=function(e){e.each(t.proxy(function(e,i){this.enter("pre-loading"),i=t(i),t(new Image).one("load",t.proxy(function(t){i.attr("src",t.target.src),i.css("opacity",1),this.leave("pre-loading"),!this.is("pre-loading")&amp;&amp;!this.is("initializing")&amp;&amp;this.refresh()},this)).attr("src",i.attr("src")||i.attr("data-src")||i.attr("data-src-retina"))},this))},n.prototype.destroy=function(){for(var s in this.$element.off(".owl.core"),this.$stage.off(".owl.core"),t(i).off(".owl.core"),!1!==this.settings.responsive&amp;&amp;(e.clearTimeout(this.resizeTimer),this.off(e,"resize",this._handlers.onThrottledResize)),this._plugins)this._plugins[s].destroy();this.$stage.children(".cloned").remove(),this.$stage.unwrap(),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$stage.remove(),this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class",this.$element.attr("class").replace(new RegExp(this.options.responsiveClass+"-\\S+\\s","g"),"")).removeData("owl.carousel")},n.prototype.op=function(t,e,i){var s=this.settings.rtl;switch(e){case"&lt;":return s?t&gt;i:t&lt;i;case"&gt;":return s?t&lt;i:t&gt;i;case"&gt;=":return s?t&lt;=i:t&gt;=i;case"&lt;=":return s?t&gt;=i:t&lt;=i}},n.prototype.on=function(t,e,i,s){t.addEventListener?t.addEventListener(e,i,s):t.attachEvent&amp;&amp;t.attachEvent("on"+e,i)},n.prototype.off=function(t,e,i,s){t.removeEventListener?t.removeEventListener(e,i,s):t.detachEvent&amp;&amp;t.detachEvent("on"+e,i)},n.prototype.trigger=function(e,i,s,o,r){var a={item:{count:this._items.length,index:this.current()}},h=t.camelCase(t.grep(["on",e,s],function(t){return t}).join("-").toLowerCase()),l=t.Event([e,"owl",s||"carousel"].join(".").toLowerCase(),t.extend({relatedTarget:this},a,i));return this._supress[e]||(t.each(this._plugins,function(t,e){e.onTrigger&amp;&amp;e.onTrigger(l)}),this.register({type:n.Type.Event,name:e}),this.$element.trigger(l),this.settings&amp;&amp;"function"==typeof this.settings[h]&amp;&amp;this.settings[h].call(this,l)),l},n.prototype.enter=function(e){t.each([e].concat(this._states.tags[e]||[]),t.proxy(function(t,e){this._states.current[e]===s&amp;&amp;(this._states.current[e]=0),this._states.current[e]++},this))},n.prototype.leave=function(e){t.each([e].concat(this._states.tags[e]||[]),t.proxy(function(t,e){this._states.current[e]--},this))},n.prototype.register=function(e){if(e.type===n.Type.Event){if(t.event.special[e.name]||(t.event.special[e.name]={}),!t.event.special[e.name].owl){var i=t.event.special[e.name]._default;t.event.special[e.name]._default=function(t){return!i||!i.apply||t.namespace&amp;&amp;-1!==t.namespace.indexOf("owl")?t.namespace&amp;&amp;t.namespace.indexOf("owl")&gt;-1:i.apply(this,arguments)},t.event.special[e.name].owl=!0}}else e.type===n.Type.State&amp;&amp;(this._states.tags[e.name]?this._states.tags[e.name]=this._states.tags[e.name].concat(e.tags):this._states.tags[e.name]=e.tags,this._states.tags[e.name]=t.grep(this._states.tags[e.name],t.proxy(function(i,s){return t.inArray(i,this._states.tags[e.name])===s},this)))},n.prototype.suppress=function(e){t.each(e,t.proxy(function(t,e){this._supress[e]=!0},this))},n.prototype.release=function(e){t.each(e,t.proxy(function(t,e){delete this._supress[e]},this))},n.prototype.pointer=function(t){var i={x:null,y:null};return t=t.originalEvent||t||e.event,t=t.touches&amp;&amp;t.touches.length?t.touches[0]:t.changedTouches&amp;&amp;t.changedTouches.length?t.changedTouches[0]:t,t.pageX?(i.x=t.pageX,i.y=t.pageY):(i.x=t.clientX,i.y=t.clientY),i},n.prototype.isNumeric=function(t){return!isNaN(parseFloat(t))},n.prototype.difference=function(t,e){return{x:t.x-e.x,y:t.y-e.y}},t.fn.owlCarousel=function(e){var i=Array.prototype.slice.call(arguments,1);return this.each(function(){var s=t(this),o=s.data("owl.carousel");o||(o=new n(this,"object"==typeof e&amp;&amp;e),s.data("owl.carousel",o),t.each(["next","prev","to","destroy","refresh","replace","add","remove"],function(e,i){o.register({type:n.Type.Event,name:i}),o.$element.on(i+".owl.carousel.core",t.proxy(function(t){t.namespace&amp;&amp;t.relatedTarget!==this&amp;&amp;(this.suppress([i]),o[i].apply(this,[].slice.call(arguments,1)),this.release([i]))},o))})),"string"==typeof e&amp;&amp;"_"!==e.charAt(0)&amp;&amp;o[e].apply(o,i)})},t.fn.owlCarousel.Constructor=n})(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._interval=null,this._visible=null,this._handlers={"initialized.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;this._core.settings.autoRefresh&amp;&amp;this.watch()},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers)};n.Defaults={autoRefresh:!0,autoRefreshInterval:500},n.prototype.watch=function(){this._interval||(this._visible=this._core.isVisible(),this._interval=e.setInterval(t.proxy(this.refresh,this),this._core.settings.autoRefreshInterval))},n.prototype.refresh=function(){this._core.isVisible()!==this._visible&amp;&amp;(this._visible=!this._visible,this._core.$element.toggleClass("owl-hidden",!this._visible),this._visible&amp;&amp;this._core.invalidate("width")&amp;&amp;this._core.refresh())},n.prototype.destroy=function(){var t,i;for(t in e.clearInterval(this._interval),this._handlers)this._core.$element.off(t,this._handlers[t]);for(i in Object.getOwnPropertyNames(this))"function"!=typeof this[i]&amp;&amp;(this[i]=null)},t.fn.owlCarousel.Constructor.Plugins.AutoRefresh=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel resized.owl.carousel":t.proxy(function(e){if(e.namespace&amp;&amp;this._core.settings&amp;&amp;this._core.settings.lazyLoad&amp;&amp;(e.property&amp;&amp;"position"==e.property.name||"initialized"==e.type)){var i=this._core.settings,n=i.center&amp;&amp;Math.ceil(i.items/2)||i.items,o=i.center&amp;&amp;-1*n||0,r=(e.property&amp;&amp;e.property.value!==s?e.property.value:this._core.current())+o,a=this._core.clones().length,h=t.proxy(function(t,e){this.load(e)},this);for(i.lazyLoadEager&gt;0&amp;&amp;(n+=i.lazyLoadEager,i.loop&amp;&amp;(r-=i.lazyLoadEager,n++));o++&lt;n;)this.load(a/2+this._core.relative(r)),a&amp;&amp;t.each(this._core.clones(this._core.relative(r)),h),r++}},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers)};n.Defaults={lazyLoad:!1,lazyLoadEager:0},n.prototype.load=function(i){var s=this._core.$stage.children().eq(i),n=s&amp;&amp;s.find(".owl-lazy");!n||t.inArray(s.get(0),this._loaded)&gt;-1||(n.each(t.proxy(function(i,s){var n,o=t(s),r=e.devicePixelRatio&gt;1&amp;&amp;o.attr("data-src-retina")||o.attr("data-src")||o.attr("data-srcset");this._core.trigger("load",{element:o,url:r},"lazy"),o.is("img")?o.one("load.owl.lazy",t.proxy(function(){o.css("opacity",1),this._core.trigger("loaded",{element:o,url:r},"lazy")},this)).attr("src",r):o.is("source")?o.one("load.owl.lazy",t.proxy(function(){this._core.trigger("loaded",{element:o,url:r},"lazy")},this)).attr("srcset",r):(n=new Image,n.onload=t.proxy(function(){o.css({"background-image":'url("'+r+'")',opacity:"1"}),this._core.trigger("loaded",{element:o,url:r},"lazy")},this),n.src=r)},this)),this._loaded.push(s.get(0)))},n.prototype.destroy=function(){var t,e;for(t in this.handlers)this._core.$element.off(t,this.handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&amp;&amp;(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.Lazy=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(i){this._core=i,this._previousHeight=null,this._handlers={"initialized.owl.carousel refreshed.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;this._core.settings.autoHeight&amp;&amp;this.update()},this),"changed.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;this._core.settings.autoHeight&amp;&amp;"position"===t.property.name&amp;&amp;this.update()},this),"loaded.owl.lazy":t.proxy(function(t){t.namespace&amp;&amp;this._core.settings.autoHeight&amp;&amp;t.element.closest("."+this._core.settings.itemClass).index()===this._core.current()&amp;&amp;this.update()},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers),this._intervalId=null;var s=this;t(e).on("load",function(){s._core.settings.autoHeight&amp;&amp;s.update()}),t(e).resize(function(){s._core.settings.autoHeight&amp;&amp;(null!=s._intervalId&amp;&amp;clearTimeout(s._intervalId),s._intervalId=setTimeout(function(){s.update()},250))})};n.Defaults={autoHeight:!1,autoHeightClass:"owl-height"},n.prototype.update=function(){var e=this._core._current,i=e+this._core.settings.items,s=this._core.settings.lazyLoad,n=this._core.$stage.children().toArray().slice(e,i),o=[],r=0;t.each(n,function(e,i){o.push(t(i).height())}),r=Math.max.apply(null,o),r&lt;=1&amp;&amp;s&amp;&amp;this._previousHeight&amp;&amp;(r=this._previousHeight),this._previousHeight=r,this._core.$stage.parent().height(r).addClass(this._core.settings.autoHeightClass)},n.prototype.destroy=function(){var t,e;for(t in this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&amp;&amp;(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.AutoHeight=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._videos={},this._playing=null,this._handlers={"initialized.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;this._core.register({type:"state",name:"playing",tags:["interacting"]})},this),"resize.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;this._core.settings.video&amp;&amp;this.isInFullScreen()&amp;&amp;t.preventDefault()},this),"refreshed.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;this._core.is("resizing")&amp;&amp;this._core.$stage.find(".cloned .owl-video-frame").remove()},this),"changed.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;"position"===t.property.name&amp;&amp;this._playing&amp;&amp;this.stop()},this),"prepared.owl.carousel":t.proxy(function(e){if(e.namespace){var i=t(e.content).find(".owl-video");i.length&amp;&amp;(i.css("display","none"),this.fetch(i,t(e.content)))}},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".owl-video-play-icon",t.proxy(function(t){this.play(t)},this))};n.Defaults={video:!1,videoHeight:!1,videoWidth:!1},n.prototype.fetch=function(t,e){var i=t.attr("data-vimeo-id")?"vimeo":t.attr("data-vzaar-id")?"vzaar":"youtube",s=t.attr("data-vimeo-id")||t.attr("data-youtube-id")||t.attr("data-vzaar-id"),n=t.attr("data-width")||this._core.settings.videoWidth,o=t.attr("data-height")||this._core.settings.videoHeight,r=t.attr("href");if(!r)throw new Error("Missing video URL.");if(s=r.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._%-]*)(\&amp;\S+)?/),s[3].indexOf("youtu")&gt;-1)i="youtube";else if(s[3].indexOf("vimeo")&gt;-1)i="vimeo";else{if(!(s[3].indexOf("vzaar")&gt;-1))throw new Error("Video URL not supported.");i="vzaar"}s=s[6],this._videos[r]={type:i,id:s,width:n,height:o},e.attr("data-video",r),this.thumbnail(t,this._videos[r])},n.prototype.thumbnail=function(e,i){var s,n,o,r=i.width&amp;&amp;i.height?"width:"+i.width+"px;height:"+i.height+"px;":"",a=e.find("img"),h="src",l="",c=this._core.settings,p=function(i){n='&lt;div class="owl-video-play-icon"&gt;&lt;/div&gt;',s=c.lazyLoad?t("&lt;div/&gt;",{class:"owl-video-tn "+l,srcType:i}):t("&lt;div/&gt;",{class:"owl-video-tn",style:"opacity:1;background-image:url("+i+")"}),e.after(s),e.after(n)};if(e.wrap(t("&lt;div/&gt;",{class:"owl-video-wrapper",style:r})),this._core.settings.lazyLoad&amp;&amp;(h="data-src",l="owl-lazy"),a.length)return p(a.attr(h)),a.remove(),!1;"youtube"===i.type?(o="//img.youtube.com/vi/"+i.id+"/hqdefault.jpg",p(o)):"vimeo"===i.type?t.ajax({type:"GET",url:"//vimeo.com/api/v2/video/"+i.id+".json",jsonp:"callback",dataType:"jsonp",success:function(t){o=t[0].thumbnail_large,p(o)}}):"vzaar"===i.type&amp;&amp;t.ajax({type:"GET",url:"//vzaar.com/api/videos/"+i.id+".json",jsonp:"callback",dataType:"jsonp",success:function(t){o=t.framegrab_url,p(o)}})},n.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null,this._core.leave("playing"),this._core.trigger("stopped",null,"video")},n.prototype.play=function(e){var i,s=t(e.target),n=s.closest("."+this._core.settings.itemClass),o=this._videos[n.attr("data-video")],r=o.width||"100%",a=o.height||this._core.$stage.height();this._playing||(this._core.enter("playing"),this._core.trigger("play",null,"video"),n=this._core.items(this._core.relative(n.index())),this._core.reset(n.index()),i=t('&lt;iframe frameborder="0" allowfullscreen mozallowfullscreen webkitAllowFullScreen &gt;&lt;/iframe&gt;'),i.attr("height",a),i.attr("width",r),"youtube"===o.type?i.attr("src","//www.youtube.com/embed/"+o.id+"?autoplay=1&amp;rel=0&amp;v="+o.id):"vimeo"===o.type?i.attr("src","//player.vimeo.com/video/"+o.id+"?autoplay=1"):"vzaar"===o.type&amp;&amp;i.attr("src","//view.vzaar.com/"+o.id+"/player?autoplay=true"),t(i).wrap('&lt;div class="owl-video-frame" /&gt;').insertAfter(n.find(".owl-video")),this._playing=n.addClass("owl-video-playing"))},n.prototype.isInFullScreen=function(){var e=i.fullscreenElement||i.mozFullScreenElement||i.webkitFullscreenElement;return e&amp;&amp;t(e).parent().hasClass("owl-video-frame")},n.prototype.destroy=function(){var t,e;for(t in this._core.$element.off("click.owl.video"),this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&amp;&amp;(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.Video=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this.core=e,this.core.options=t.extend({},n.Defaults,this.core.options),
this.swapping=!0,this.previous=s,this.next=s,this.handlers={"change.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;"position"==t.property.name&amp;&amp;(this.previous=this.core.current(),this.next=t.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;(this.swapping="translated"==t.type)},this),"translate.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;this.swapping&amp;&amp;(this.core.options.animateOut||this.core.options.animateIn)&amp;&amp;this.swap()},this)},this.core.$element.on(this.handlers)};n.Defaults={animateOut:!1,animateIn:!1},n.prototype.swap=function(){if(1===this.core.settings.items&amp;&amp;t.support.animation&amp;&amp;t.support.transition){this.core.speed(0);var e,i=t.proxy(this.clear,this),s=this.core.$stage.children().eq(this.previous),n=this.core.$stage.children().eq(this.next),o=this.core.settings.animateIn,r=this.core.settings.animateOut;this.core.current()!==this.previous&amp;&amp;(r&amp;&amp;(e=this.core.coordinates(this.previous)-this.core.coordinates(this.next),s.one(t.support.animation.end,i).css({left:e+"px"}).addClass("animated owl-animated-out").addClass(r)),o&amp;&amp;n.one(t.support.animation.end,i).addClass("animated owl-animated-in").addClass(o))}},n.prototype.clear=function(e){t(e.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},n.prototype.destroy=function(){var t,e;for(t in this.handlers)this.core.$element.off(t,this.handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&amp;&amp;(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.Animate=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){var n=function(e){this._core=e,this._call=null,this._time=0,this._timeout=0,this._paused=!0,this._handlers={"changed.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;"settings"===t.property.name?this._core.settings.autoplay?this.play():this.stop():t.namespace&amp;&amp;"position"===t.property.name&amp;&amp;this._paused&amp;&amp;(this._time=0)},this),"initialized.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;this._core.settings.autoplay&amp;&amp;this.play()},this),"play.owl.autoplay":t.proxy(function(t,e,i){t.namespace&amp;&amp;this.play(e,i)},this),"stop.owl.autoplay":t.proxy(function(t){t.namespace&amp;&amp;this.stop()},this),"mouseover.owl.autoplay":t.proxy(function(){this._core.settings.autoplayHoverPause&amp;&amp;this._core.is("rotating")&amp;&amp;this.pause()},this),"mouseleave.owl.autoplay":t.proxy(function(){this._core.settings.autoplayHoverPause&amp;&amp;this._core.is("rotating")&amp;&amp;this.play()},this),"touchstart.owl.core":t.proxy(function(){this._core.settings.autoplayHoverPause&amp;&amp;this._core.is("rotating")&amp;&amp;this.pause()},this),"touchend.owl.core":t.proxy(function(){this._core.settings.autoplayHoverPause&amp;&amp;this.play()},this)},this._core.$element.on(this._handlers),this._core.options=t.extend({},n.Defaults,this._core.options)};n.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},n.prototype._next=function(s){this._call=e.setTimeout(t.proxy(this._next,this,s),this._timeout*(Math.round(this.read()/this._timeout)+1)-this.read()),this._core.is("interacting")||i.hidden||this._core.next(s||this._core.settings.autoplaySpeed)},n.prototype.read=function(){return(new Date).getTime()-this._time},n.prototype.play=function(i,s){var n;this._core.is("rotating")||this._core.enter("rotating"),i=i||this._core.settings.autoplayTimeout,n=Math.min(this._time%(this._timeout||i),i),this._paused?(this._time=this.read(),this._paused=!1):e.clearTimeout(this._call),this._time+=this.read()%i-n,this._timeout=i,this._call=e.setTimeout(t.proxy(this._next,this,s),i-n)},n.prototype.stop=function(){this._core.is("rotating")&amp;&amp;(this._time=0,this._paused=!0,e.clearTimeout(this._call),this._core.leave("rotating"))},n.prototype.pause=function(){this._core.is("rotating")&amp;&amp;!this._paused&amp;&amp;(this._time=this.read(),this._paused=!0,e.clearTimeout(this._call))},n.prototype.destroy=function(){var t,e;for(t in this.stop(),this._handlers)this._core.$element.off(t,this._handlers[t]);for(e in Object.getOwnPropertyNames(this))"function"!=typeof this[e]&amp;&amp;(this[e]=null)},t.fn.owlCarousel.Constructor.Plugins.autoplay=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){"use strict";var n=function(e){this._core=e,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":t.proxy(function(e){e.namespace&amp;&amp;this._core.settings.dotsData&amp;&amp;this._templates.push('&lt;div class="'+this._core.settings.dotClass+'"&gt;'+t(e.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot")+"&lt;/div&gt;")},this),"added.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;this._core.settings.dotsData&amp;&amp;this._templates.splice(t.position,0,this._templates.pop())},this),"remove.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;this._core.settings.dotsData&amp;&amp;this._templates.splice(t.position,1)},this),"changed.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;"position"==t.property.name&amp;&amp;this.draw()},this),"initialized.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;!this._initialized&amp;&amp;(this._core.trigger("initialize",null,"navigation"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger("initialized",null,"navigation"))},this),"refreshed.owl.carousel":t.proxy(function(t){t.namespace&amp;&amp;this._initialized&amp;&amp;(this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation"))},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this.$element.on(this._handlers)};n.Defaults={nav:!1,navText:['&lt;span aria-label="Previous"&gt;&amp;#x2039;&lt;/span&gt;','&lt;span aria-label="Next"&gt;&amp;#x203a;&lt;/span&gt;'],navSpeed:!1,navElement:'button type="button" role="presentation"',navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},n.prototype.initialize=function(){var e,i=this._core.settings;for(e in this._controls.$relative=(i.navContainer?t(i.navContainer):t("&lt;div&gt;").addClass(i.navContainerClass).appendTo(this.$element)).addClass("disabled"),this._controls.$previous=t("&lt;"+i.navElement+"&gt;").addClass(i.navClass[0]).html(i.navText[0]).prependTo(this._controls.$relative).on("click",t.proxy(function(t){this.prev(i.navSpeed)},this)),this._controls.$next=t("&lt;"+i.navElement+"&gt;").addClass(i.navClass[1]).html(i.navText[1]).appendTo(this._controls.$relative).on("click",t.proxy(function(t){this.next(i.navSpeed)},this)),i.dotsData||(this._templates=[t('&lt;button role="button"&gt;').addClass(i.dotClass).append(t("&lt;span&gt;")).prop("outerHTML")]),this._controls.$absolute=(i.dotsContainer?t(i.dotsContainer):t("&lt;div&gt;").addClass(i.dotsClass).appendTo(this.$element)).addClass("disabled"),this._controls.$absolute.on("click","button",t.proxy(function(e){var s=t(e.target).parent().is(this._controls.$absolute)?t(e.target).index():t(e.target).parent().index();e.preventDefault(),this.to(s,i.dotsSpeed)},this)),this._overrides)this._core[e]=t.proxy(this[e],this)},n.prototype.destroy=function(){var t,e,i,s,n;for(t in n=this._core.settings,this._handlers)this.$element.off(t,this._handlers[t]);for(e in this._controls)"$relative"===e&amp;&amp;n.navContainer?this._controls[e].html(""):this._controls[e].remove();for(s in this.overides)this._core[s]=this._overrides[s];for(i in Object.getOwnPropertyNames(this))"function"!=typeof this[i]&amp;&amp;(this[i]=null)},n.prototype.update=function(){var t,e,i=this._core.clones().length/2,s=i+this._core.items().length,n=this._core.maximum(!0),o=this._core.settings,r=o.center||o.autoWidth||o.dotsData?1:o.dotsEach||o.items;if("page"!==o.slideBy&amp;&amp;(o.slideBy=Math.min(o.slideBy,o.items)),o.dots||"page"==o.slideBy)for(this._pages=[],t=i,e=0,0;t&lt;s;t++){if(e&gt;=r||0===e){if(this._pages.push({start:Math.min(n,t-i),end:t-i+r-1}),Math.min(n,t-i)===n)break;e=0,0}e+=this._core.mergers(this._core.relative(t))}},n.prototype.draw=function(){var e,i=this._core.settings,s=this._core.items().length&lt;=i.items,n=this._core.relative(this._core.current()),o=i.loop||i.rewind;this._controls.$relative.toggleClass("disabled",!i.nav||s),i.nav&amp;&amp;(this._controls.$previous.toggleClass("disabled",!o&amp;&amp;n&lt;=this._core.minimum(!0)),this._controls.$next.toggleClass("disabled",!o&amp;&amp;n&gt;=this._core.maximum(!0))),this._controls.$absolute.toggleClass("disabled",!i.dots||s),i.dots&amp;&amp;(e=this._pages.length-this._controls.$absolute.children().length,i.dotsData&amp;&amp;0!==e?this._controls.$absolute.html(this._templates.join("")):e&gt;0?this._controls.$absolute.append(new Array(e+1).join(this._templates[0])):e&lt;0&amp;&amp;this._controls.$absolute.children().slice(e).remove(),this._controls.$absolute.find(".active").removeClass("active"),this._controls.$absolute.children().eq(t.inArray(this.current(),this._pages)).addClass("active"))},n.prototype.onTrigger=function(e){var i=this._core.settings;e.page={index:t.inArray(this.current(),this._pages),count:this._pages.length,size:i&amp;&amp;(i.center||i.autoWidth||i.dotsData?1:i.dotsEach||i.items)}},n.prototype.current=function(){var e=this._core.relative(this._core.current());return t.grep(this._pages,t.proxy(function(t,i){return t.start&lt;=e&amp;&amp;t.end&gt;=e},this)).pop()},n.prototype.getPosition=function(e){var i,s,n=this._core.settings;return"page"==n.slideBy?(i=t.inArray(this.current(),this._pages),s=this._pages.length,e?++i:--i,i=this._pages[(i%s+s)%s].start):(i=this._core.relative(this._core.current()),s=this._core.items().length,e?i+=n.slideBy:i-=n.slideBy),i},n.prototype.next=function(e){t.proxy(this._overrides.to,this._core)(this.getPosition(!0),e)},n.prototype.prev=function(e){t.proxy(this._overrides.to,this._core)(this.getPosition(!1),e)},n.prototype.to=function(e,i,s){var n;!s&amp;&amp;this._pages.length?(n=this._pages.length,t.proxy(this._overrides.to,this._core)(this._pages[(e%n+n)%n].start,i)):t.proxy(this._overrides.to,this._core)(e,i)},t.fn.owlCarousel.Constructor.Plugins.Navigation=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){"use strict";var n=function(i){this._core=i,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":t.proxy(function(i){i.namespace&amp;&amp;"URLHash"===this._core.settings.startPosition&amp;&amp;t(e).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":t.proxy(function(e){if(e.namespace){var i=t(e.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");if(!i)return;this._hashes[i]=e.content}},this),"changed.owl.carousel":t.proxy(function(i){if(i.namespace&amp;&amp;"position"===i.property.name){var s=this._core.items(this._core.relative(this._core.current())),n=t.map(this._hashes,function(t,e){return t===s?e:null}).join();if(!n||e.location.hash.slice(1)===n)return;e.location.hash=n}},this)},this._core.options=t.extend({},n.Defaults,this._core.options),this.$element.on(this._handlers),t(e).on("hashchange.owl.navigation",t.proxy(function(t){var i=e.location.hash.substring(1),n=this._core.$stage.children(),o=this._hashes[i]&amp;&amp;n.index(this._hashes[i]);o!==s&amp;&amp;o!==this._core.current()&amp;&amp;this._core.to(this._core.relative(o),!1,!0)},this))};n.Defaults={URLhashListener:!1},n.prototype.destroy=function(){var i,s;for(i in t(e).off("hashchange.owl.navigation"),this._handlers)this._core.$element.off(i,this._handlers[i]);for(s in Object.getOwnPropertyNames(this))"function"!=typeof this[s]&amp;&amp;(this[s]=null)},t.fn.owlCarousel.Constructor.Plugins.Hash=n}(window.Zepto||window.jQuery,window,document),function(t,e,i,s){function n(e,i){var n=!1,o=e.charAt(0).toUpperCase()+e.slice(1);return t.each((e+" "+a.join(o+" ")+o).split(" "),function(t,e){if(r[e]!==s)return n=!i||e,!1}),n}function o(t){return n(t,!0)}var r=t("&lt;support&gt;").get(0).style,a="Webkit Moz O ms".split(" "),h={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}},animation:{end:{WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",animation:"animationend"}}},l={csstransforms:function(){return!!n("transform")},csstransforms3d:function(){return!!n("perspective")},csstransitions:function(){return!!n("transition")},cssanimations:function(){return!!n("animation")}};l.csstransitions()&amp;&amp;(t.support.transition=new String(o("transition")),t.support.transition.end=h.transition.end[t.support.transition]),l.cssanimations()&amp;&amp;(t.support.animation=new String(o("animation")),t.support.animation.end=h.animation.end[t.support.animation]),l.csstransforms()&amp;&amp;(t.support.transform=new String(o("transform")),t.support.transform3d=l.csstransforms3d())}(window.Zepto||window.jQuery,window,document);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:66:"/local/templates/aspro_max/vendor/js/moment.min.js?171141775734436";s:6:"source";s:50:"/local/templates/aspro_max/vendor/js/moment.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
//! moment.js
//! version : 2.10.3
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com
!function(a,b){"object"==typeof exports&amp;&amp;"undefined"!=typeof module?module.exports=b():"function"==typeof define&amp;&amp;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&lt;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)&amp;&amp;(a[c]=b[c]);return f(b,"toString")&amp;&amp;(a.toString=b.toString),f(b,"valueOf")&amp;&amp;(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&amp;&amp;(a._pf=i()),a._pf}function k(a){if(null==a._isValid){var b=j(a);a._isValid=!isNaN(a._d.getTime())&amp;&amp;b.overflow&lt;0&amp;&amp;!b.empty&amp;&amp;!b.invalidMonth&amp;&amp;!b.nullInput&amp;&amp;!b.invalidFormat&amp;&amp;!b.userInvalidated,a._strict&amp;&amp;(a._isValid=a._isValid&amp;&amp;0===b.charsLeftOver&amp;&amp;0===b.unusedTokens.length&amp;&amp;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&amp;&amp;(a._isAMomentObject=b._isAMomentObject),"undefined"!=typeof b._i&amp;&amp;(a._i=b._i),"undefined"!=typeof b._f&amp;&amp;(a._f=b._f),"undefined"!=typeof b._l&amp;&amp;(a._l=b._l),"undefined"!=typeof b._strict&amp;&amp;(a._strict=b._strict),"undefined"!=typeof b._tzm&amp;&amp;(a._tzm=b._tzm),"undefined"!=typeof b._isUTC&amp;&amp;(a._isUTC=b._isUTC),"undefined"!=typeof b._offset&amp;&amp;(a._offset=b._offset),"undefined"!=typeof b._pf&amp;&amp;(a._pf=j(b)),"undefined"!=typeof b._locale&amp;&amp;(a._locale=b._locale),Fc.length&gt;0)for(c in Fc)d=Fc[c],e=b[d],"undefined"!=typeof e&amp;&amp;(a[d]=e);return a}function n(b){m(this,b),this._d=new Date(+b._d),Gc===!1&amp;&amp;(Gc=!0,a.updateOffset(this),Gc=!1)}function o(a){return a instanceof n||null!=a&amp;&amp;null!=a._isAMomentObject}function p(a){var b=+a,c=0;return 0!==b&amp;&amp;isFinite(b)&amp;&amp;(c=b&gt;=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&gt;d;d++)(c&amp;&amp;a[d]!==b[d]||!c&amp;&amp;p(a[d])!==p(b[d]))&amp;&amp;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&lt;a.length;){for(e=s(a[f]).split("-"),b=e.length,c=s(a[f+1]),c=c?c.split("-"):null;b&gt;0;){if(d=u(e.slice(0,b).join("-")))return d;if(c&amp;&amp;c.length&gt;=b&amp;&amp;q(e,c,!0)&gt;=b-1)break;b--}f++}return null}function u(a){var b=null;if(!Hc[a]&amp;&amp;"undefined"!=typeof module&amp;&amp;module&amp;&amp;module.exports)try{b=Ec._abbr,require("./locale/"+a),v(b)}catch(c){}return Hc[a]}function v(a,b){var c;return a&amp;&amp;(c="undefined"==typeof b?x(a):w(a,b),c&amp;&amp;(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&amp;&amp;a._locale&amp;&amp;a._locale._abbr&amp;&amp;(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)&amp;&amp;(b=z(c),b&amp;&amp;(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&gt;=0;d.length&lt;b;)d="0"+d;return(e?c?"+":"":"-")+d}function G(a,b,c,d){var e=d;"string"==typeof d&amp;&amp;(e=function(){return this[d]()}),a&amp;&amp;(Mc[a]=e),b&amp;&amp;(Mc[b[0]]=function(){return F(e.apply(this,arguments),b[1],b[2])}),c&amp;&amp;(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&gt;b;b++)Mc[d[b]]?d[b]=Mc[d[b]]:d[b]=H(d[b]);return function(e){var f="";for(b=0;c&gt;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&gt;=0&amp;&amp;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&amp;&amp;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,"\\$&amp;")}function O(a,b){var c,d=b;for("string"==typeof a&amp;&amp;(a=[a]),"number"==typeof b&amp;&amp;(d=function(a,c){c[b]=p(a)}),c=0;c&lt;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&amp;&amp;f(ad,a)&amp;&amp;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&gt;d;d++){if(e=h([2e3,d]),c&amp;&amp;!this._longMonthsParse[d]&amp;&amp;(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&amp;&amp;"MMMM"===b&amp;&amp;this._longMonthsParse[d].test(a))return d;if(c&amp;&amp;"MMM"===b&amp;&amp;this._shortMonthsParse[d].test(a))return d;if(!c&amp;&amp;this._monthsParse[d].test(a))return d}}function V(a,b){var c;return"string"==typeof b&amp;&amp;(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&amp;&amp;-2===j(a).overflow&amp;&amp;(b=c[cd]&lt;0||c[cd]&gt;11?cd:c[dd]&lt;1||c[dd]&gt;R(c[bd],c[cd])?dd:c[ed]&lt;0||c[ed]&gt;24||24===c[ed]&amp;&amp;(0!==c[fd]||0!==c[gd]||0!==c[hd])?ed:c[fd]&lt;0||c[fd]&gt;59?fd:c[gd]&lt;0||c[gd]&gt;59?gd:c[hd]&lt;0||c[hd]&gt;999?hd:-1,j(a)._overflowDayOfYear&amp;&amp;(bd&gt;b||b&gt;dd)&amp;&amp;(b=dd),j(a).overflow=b),a}function Z(b){a.suppressDeprecationWarnings===!1&amp;&amp;"undefined"!=typeof console&amp;&amp;console.warn&amp;&amp;console.warn("Deprecation warning: "+b)}function $(a,b){var c=!0,d=a+"\n"+(new Error).stack;return g(function(){return c&amp;&amp;(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&gt;b;b++)if(md[b][1].exec(d)){a._f=md[b][0]+(e[6]||" ");break}for(b=0,c=nd.length;c&gt;b;b++)if(nd[b][1].exec(d)){a._f+=nd[b][0];break}d.match(Yc)&amp;&amp;(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&amp;&amp;(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&gt;a&amp;&amp;h.setFullYear(a),h}function da(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970&gt;a&amp;&amp;b.setUTCFullYear(a),b}function ea(a){return fa(a)?366:365}function fa(a){return a%4===0&amp;&amp;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&gt;e&amp;&amp;(f-=7),e-7&gt;f&amp;&amp;(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&gt;d?7:0)-(e&gt;h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g&gt;0?a:a-1,dayOfYear:g&gt;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&amp;&amp;null==a._a[dd]&amp;&amp;null==a._a[cd]&amp;&amp;sa(a),a._dayOfYear&amp;&amp;(e=pa(a._a[bd],d[bd]),a._dayOfYear&gt;ea(e)&amp;&amp;(j(a)._overflowDayOfYear=!0),c=da(e,0,a._dayOfYear),a._a[cd]=c.getUTCMonth(),a._a[dd]=c.getUTCDate()),b=0;3&gt;b&amp;&amp;null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7&gt;b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[ed]&amp;&amp;0===a._a[fd]&amp;&amp;0===a._a[gd]&amp;&amp;0===a._a[hd]&amp;&amp;(a._nextDay=!0,a._a[ed]=0),a._d=(a._useUTC?da:ca).apply(null,f),null!=a._tzm&amp;&amp;a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&amp;&amp;(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=a._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&gt;e&amp;&amp;++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&lt;e.length;c++)f=e[c],d=(h.match(M(f,b))||[])[0],d&amp;&amp;(g=h.substr(0,h.indexOf(d)),g.length&gt;0&amp;&amp;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&amp;&amp;!d&amp;&amp;j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length&gt;0&amp;&amp;j(b).unusedInput.push(h),j(b).bigHour===!0&amp;&amp;b._a[ed]&lt;=12&amp;&amp;b._a[ed]&gt;0&amp;&amp;(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&amp;&amp;12&gt;b&amp;&amp;(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&lt;a._f.length;e++)f=0,b=m({},a),null!=a._useUTC&amp;&amp;(b._useUTC=a._useUTC),b._f=a._f[e],ta(b),k(b)&amp;&amp;(f+=j(b).charsLeftOver,f+=10*j(b).unusedTokens.length,j(b).score=f,(null==d||d&gt;f)&amp;&amp;(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&amp;&amp;""===e?l({nullInput:!0}):("string"==typeof e&amp;&amp;(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&amp;&amp;(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&amp;&amp;(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&amp;&amp;c(b[0])&amp;&amp;(b=b[0]),!b.length)return Aa();for(d=b[0],e=1;e&lt;b.length;++e)b[e][a](d)&amp;&amp;(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&gt;a&amp;&amp;(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&amp;&amp;(b=Ha(b)),Math.abs(b)&lt;16&amp;&amp;(b=60*b),!this._isUTC&amp;&amp;c&amp;&amp;(d=Ja(this)),this._offset=b,this._isUTC=!0,null!=d&amp;&amp;this.add(d,"m"),e!==b&amp;&amp;(!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&amp;&amp;(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Ma(a){return this.utcOffset(0,a)}function Na(a){return this._isUTC&amp;&amp;(this.utcOffset(0,a),this._isUTC=!1,a&amp;&amp;this.subtract(Ja(this),"m")),this}function Oa(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&amp;&amp;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()&gt;this.clone().month(0).utcOffset()||this.utcOffset()&gt;this.clone().month(5).utcOffset()}function Ra(){if(this._a){var a=this._isUTC?h(this._a):Aa(this._a);return this.isValid()&amp;&amp;q(this._a,a.toArray())&gt;0}return!1}function Sa(){return!this._isUTC}function Ta(){return this._isUTC}function Ua(){return this._isUTC&amp;&amp;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&amp;&amp;("from"in g||"to"in g)&amp;&amp;(e=Ya(Aa(g.from),Aa(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Ea(g),Fa(a)&amp;&amp;f(a,"_locale")&amp;&amp;(d._locale=a._locale),d}function Wa(a,b){var c=a&amp;&amp;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)&amp;&amp;--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;return 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&amp;&amp;b._d.setTime(+b._d+f*d),g&amp;&amp;D(b,"Date",C(b,"Date")+g*d),h&amp;&amp;V(b,C(b,"Month")+h*d),e&amp;&amp;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&gt;d?"sameElse":-1&gt;d?"lastWeek":0&gt;d?"lastDay":1&gt;d?"sameDay":2&gt;d?"nextDay":7&gt;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&gt;+a):(c=o(a)?+a:+Aa(a),c&lt;+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&gt;+this):(c=o(a)?+a:+Aa(a),+this.clone().endOf(b)&lt;c)}function db(a,b,c){return this.isAfter(a,c)&amp;&amp;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)&lt;=c&amp;&amp;c&lt;=+this.clone().endOf(b))}function fb(a){return 0&gt;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&amp;&amp;(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&gt;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&lt;a.year()&amp;&amp;a.year()&lt;=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&amp;&amp;(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&amp;&amp;this.weekday(0),"isoWeek"===a&amp;&amp;this.isoWeekday(1),"quarter"===a&amp;&amp;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()]}function Lb(a){var b,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7&gt;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&gt;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&amp;&amp;this._longDateFormat[a.toUpperCase()]&amp;&amp;(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&gt;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&amp;&amp;(b=a,a=void 0),a=a||"",null!=b)return ec(a,b,c,e);var f,g=[];for(f=0;d&gt;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&lt;ge.s&amp;&amp;["s",e]||1===f&amp;&amp;["m"]||f&lt;ge.m&amp;&amp;["mm",f]||1===g&amp;&amp;["h"]||g&lt;ge.h&amp;&amp;["hh",g]||1===h&amp;&amp;["d"]||h&lt;ge.d&amp;&amp;["dd",h]||1===i&amp;&amp;["M"]||i&lt;ge.M&amp;&amp;["MM",i]||1===j&amp;&amp;["y"]||["yy",j];return k[2]=b,k[3]=+a&gt;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&amp;&amp;(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&gt;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}|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)&gt;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&gt;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&gt;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=xd,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",
hh:"%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});
/* End */
;
; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_max/vendor/js/footable.js?1711948550268108";s:6:"source";s:48:"/local/templates/aspro_max/vendor/js/footable.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/*
* FooTable v3 - FooTable is a jQuery plugin that aims to make HTML tables on smaller devices look awesome.
* @version 3.1.5
* @link http://fooplugins.com
* @copyright Steven Usher &amp; Brad Vincent 2015
* @license Released under the GPLv3 license.
*/
(function($, F){
	// add in console we use in case it's missing
	window.console = window.console || { log:function(){}, error:function(){} };

	/**
	 * The jQuery plugin initializer.
	 * @function jQuery.fn.footable
	 * @param {(object|FooTable.Defaults)} [options] - The options to initialize the plugin with.
	 * @param {function} [ready] - A callback function to execute for each initialized plugin.
	 * @returns {jQuery}
	 */
	$.fn.footable = function (options, ready) {
		options = options || {};
		// make sure we only work with tables
		return this.filter('table').each(function (i, tbl) {
			F.init(tbl, options, ready);
		});
	};

	var debug_defaults = {
		events: []
	};
	F.__debug__ = JSON.parse(localStorage.getItem('footable_debug')) || false;
	F.__debug_options__ = JSON.parse(localStorage.getItem('footable_debug_options')) || debug_defaults;

	/**
	 * Gets or sets the internal debug variable which enables some additional logging to the console.
	 * When enabled this value is stored in the localStorage so it can persist across page reloads.
	 * @param {boolean} value - Whether or not to enable additional logging.
	 * @param {object} [options] - Any debug specific options.
	 * @returns {(boolean|undefined)}
	 */
	F.debug = function(value, options){
		if (!F.is.boolean(value)) return F.__debug__;
		F.__debug__ = value;
		if (F.__debug__){
			localStorage.setItem('footable_debug', JSON.stringify(F.__debug__));
			F.__debug_options__ = $.extend(true, {}, debug_defaults, options || {});
			if (F.is.hash(options)){
				localStorage.setItem('footable_debug_options', JSON.stringify(F.__debug_options__));
			}
		} else {
			localStorage.removeItem('footable_debug');
			localStorage.removeItem('footable_debug_options');
		}
	};

	/**
	 * Gets the FooTable instance of the supplied table if one exists.
	 * @param {(jQuery|jQuery.selector|HTMLTableElement)} table - The jQuery table object, selector or the HTMLTableElement to retrieve FooTable from.
	 * @returns {(FooTable.Table|undefined)}
	 */
	F.get = function(table){
		return $(table).first().data('__FooTable__');
	};

	/**
	 * Initializes a new instance of FooTable on the supplied table.
	 * @param {(jQuery|jQuery.selector|HTMLTableElement)} table - The jQuery table object, selector or the HTMLTableElement to initialize FooTable on.
	 * @param {object} options - The options to initialize FooTable with.
	 * @param {function} [ready] - A callback function to execute once the plugin is initialized.
	 * @returns {FooTable.Table}
	 */
	F.init = function(table, options, ready){
		var ft = F.get(table);
		if (ft instanceof F.Table) ft.destroy();
		return new F.Table(table, options, ready);
	};

	/**
	 * Gets the FooTable.Row instance for the supplied element.
	 * @param {(jQuery|jQuery.selector|HTMLTableElement)} element - A jQuery object, selector or the HTMLElement of an element to retrieve the FooTable.Row for.
	 * @returns {FooTable.Row}
	 */
	F.getRow = function(element){
		// to get the FooTable.Row object simply walk up the DOM, find the TR and grab the __FooTableRow__ data value
		var $row = $(element).closest('tr');
		// if this is a detail row get the previous row in the table to get the main TR element
		if ($row.hasClass('footable-detail-row')){
			$row = $row.prev();
		}
		// grab the row object
		return $row.data('__FooTableRow__');
	};

	// The below are external type definitions mainly used as pointers to jQuery docs for important information
	/**
	 * jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API
	 * that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.
	 * @name jQuery
	 * @constructor
	 * @returns {jQuery}
	 * @see {@link http://api.jquery.com/}
	 */

	/**
	 * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, and state) to prevent users from changing the state of the Deferred.
	 * @typedef {object} jQuery.Promise
	 * @see {@link http://api.jquery.com/Types/#Promise}
	 */

	/**
	 * As of jQuery 1.5, the Deferred object provides a way to register multiple callbacks into self-managed callback queues, invoke callback queues as appropriate,
	 * and relay the success or failure state of any synchronous or asynchronous function.
	 * @typedef {object} jQuery.Deferred
	 * @see {@link http://api.jquery.com/Types/#Deferred}
	 */

	/**
	 * jQuery's event system normalizes the event object according to W3C standards. The event object is guaranteed to be passed to the event handler. Most properties from
	 * the original event are copied over and normalized to the new event object.
	 * @typedef {object} jQuery.Event
	 * @see {@link http://api.jquery.com/category/events/event-object/}
	 */

	/**
	 * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
	 * @memberof jQuery
	 * @function when
	 * @param {...jQuery.Deferred} deferreds - Any number of deferred objects to wait for.
	 * @returns {jQuery.Promise}
	 * @see {@link http://api.jquery.com/jQuery.when/}
	 */

	/**
	 * The jQuery.fn namespace used to register plugins with jQuery.
	 * @memberof jQuery
	 * @namespace fn
	 * @see {@link http://learn.jquery.com/plugins/basic-plugin-creation/}
	 */
})(
	jQuery,
	/**
	 * The core FooTable namespace containing all the plugin code.
	 * @namespace
	 */
	FooTable = window.FooTable || {}
);
(function(F){
	var returnTrue = function(){ return true; };

	/**
	 * This namespace contains commonly used array utility methods.
	 * @namespace {object} FooTable.arr
	 */
	F.arr = {};

	/**
	 * Iterates over each item in the supplied array and performs the supplied function passing in the current item as the first argument.
	 * @memberof FooTable.arr
	 * @function each
	 * @param {Array} array - The array to iterate
	 * @param {function} func - The function to execute for each item. The first argument supplied to this function is the current item and the second is the current index.
	 */
	F.arr.each = function (array, func) {
		if (!F.is.array(array) || !F.is.fn(func)) return;
		for (var i = 0, len = array.length; i &lt; len; i++) {
			if (func(array[i], i) === false) break;
		}
	};

	/**
	 * Get all items in the supplied array that optionally matches the supplied where function. If no items are found an empty array is returned.
	 * @memberof FooTable.arr
	 * @function get
	 * @param {Array} array - The array to get items from.
	 * @param {function} where - This function must return a boolean value, true includes the item in the result array.
	 * @returns {Array}
	 */
	F.arr.get = function (array, where) {
		var result = [];
		if (!F.is.array(array)) return result;
		if (!F.is.fn(where)) return array;
		for (var i = 0, len = array.length; i &lt; len; i++) {
			if (where(array[i], i)) result.push(array[i]);
		}
		return result;
	};

	/**
	 * Get a boolean value indicating if any item exists in the supplied array that optionally matches the supplied where function.
	 * @memberof FooTable.arr
	 * @function any
	 * @param {Array} array - The array to check.
	 * @param {function} [where] - [Optional] This function must return a boolean value, true indicates that the current item is a valid match.
	 * @returns {boolean}
	 */
	F.arr.any = function (array, where) {
		if (!F.is.array(array)) return false;
		where = F.is.fn(where) ? where : returnTrue;
		for (var i = 0, len = array.length; i &lt; len; i++) {
			if (where(array[i], i)) return true;
		}
		return false;
	};

	/**
	 * Checks if the supplied value exists in the array.
	 * @memberof FooTable.arr
	 * @function contains
	 * @param {Array} array - The array to check.
	 * @param {*} value - The value to check for.
	 * @returns {boolean}
	 */
	F.arr.contains = function(array, value){
		if (!F.is.array(array) || F.is.undef(value)) return false;
		for (var i = 0, len = array.length; i &lt; len; i++) {
			if (array[i] == value) return true;
		}
		return false;
	};

	/**
	 * Get the first item in the supplied array that optionally matches the supplied where function. If no item is found null is returned.
	 * @memberof FooTable.arr
	 * @function first
	 * @param {Array} array - The array to get the item from.
	 * @param {function} [where] - [Optional] This function must return a boolean value, true indicates that the current item can be returned.
	 * @returns {(*|null)}
	 */
	F.arr.first = function (array, where) {
		if (!F.is.array(array)) return null;
		where = F.is.fn(where) ? where : returnTrue;
		for (var i = 0, len = array.length; i &lt; len; i++) {
			if (where(array[i], i)) return array[i];
		}
		return null;
	};

	/**
	 * Creates a new array from the results of the supplied getter function. If no items are found an empty array is returned, to exclude an item from the results return null.
	 * @memberof FooTable.arr
	 * @function map
	 * @param {Array} array - The array to iterate.
	 * @param {function} getter - This function must return either a new value or null.
	 * The first argument is the result being returned at this point in the iteration. The second argument is the current item being iterated.
	 * @returns {(*|null)}
	 */
	F.arr.map = function (array, getter) {
		var result = [], returned = null;
		if (!F.is.array(array) || !F.is.fn(getter)) return result;
		for (var i = 0, len = array.length; i &lt; len; i++) {
			if ((returned = getter(array[i], i)) != null) result.push(returned);
		}
		return result;
	};

	/**
	 * Removes items from the array matching the supplied where function. All removed items are returned in a new array.
	 * @memberof FooTable.arr
	 * @function remove
	 * @param {Array} array - The array to iterate and remove items from.
	 * @param {function} where - This function must return a boolean value, true includes the item in the result array.
	 * @returns {*}
	 */
	F.arr.remove = function (array, where) {
		var remove = [], removed = [];
		if (!F.is.array(array) || !F.is.fn(where)) return removed;
		var i = 0, len = array.length;
		for (; i &lt; len; i++) {
			if (where(array[i], i, removed)){
				remove.push(i);
				removed.push(array[i]);
			}
		}
		// sort the indexes to be removed from largest to smallest
		remove.sort(function(a, b){ return b - a; });
		i = 0; len = remove.length;
		for(; i &lt; len; i++){
			var index = remove[i] - i;
			array.splice(index, 1);
		}
		return removed;
	};

	/**
	 * Deletes a single item from the array. The item if removed is returned.
	 * @memberof FooTable.arr
	 * @function delete
	 * @param {Array} array - The array to iterate and delete the item from.
	 * @param {*} item - The item to find and delete.
	 * @returns {(*|null)}
	 */
	F.arr.delete = function(array, item){
		var remove = -1, removed = null;
		if (!F.is.array(array) || F.is.undef(item)) return removed;
		var i = 0, len = array.length;
		for (; i &lt; len; i++) {
			if (array[i] == item){
				remove = i;
				removed = array[i];
				break;
			}
		}
		if (remove != -1) array.splice(remove, 1);
		return removed;
	};

	/**
	 * Replaces a single item in the array with a new one.
	 * @memberof FooTable.arr
	 * @function replace
	 * @param {Array} array - The array to iterate and replace the item in.
	 * @param {*} oldItem - The item to be replaced.
	 * @param {*} newItem - The item to be inserted.
	 */
	F.arr.replace = function(array, oldItem, newItem){
		var index = array.indexOf(oldItem);
		if (index !== -1) array[index] = newItem;
	};

})(FooTable);
(function (F) {

	/**
	 * This namespace contains commonly used 'is' type methods that return boolean values.
	 * @namespace FooTable.is
	 */
	F.is = {};

	/**
	 * Checks if the type of the value is the same as that supplied.
	 * @memberof FooTable.is
	 * @function type
	 * @param {*} value - The value to check the type of.
	 * @param {string} type - The type to check for.
	 * @returns {boolean}
	 */
	F.is.type = function (value, type) {
		return typeof value === type;
	};

	/**
	 * Checks if the value is defined.
	 * @memberof FooTable.is
	 * @function defined
	 * @param {*} value - The value to check is defined.
	 * @returns {boolean}
	 */
	F.is.defined = function (value) {
		return typeof value !== 'undefined';
	};

	/**
	 * Checks if the value is undefined.
	 * @memberof FooTable.is
	 * @function undef
	 * @param {*} value - The value to check is undefined.
	 * @returns {boolean}
	 */
	F.is.undef = function (value) {
		return typeof value === 'undefined';
	};

	/**
	 * Checks if the value is an array.
	 * @memberof FooTable.is
	 * @function array
	 * @param {*} value - The value to check.
	 * @returns {boolean}
	 */
	F.is.array = function (value) {
		return '[object Array]' === Object.prototype.toString.call(value);
	};

	/**
	 * Checks if the value is a date.
	 * @memberof FooTable.is
	 * @function date
	 * @param {*} value - The value to check.
	 * @returns {boolean}
	 */
	F.is.date = function (value) {
		return '[object Date]' === Object.prototype.toString.call(value) &amp;&amp; !isNaN(value.getTime());
	};

	/**
	 * Checks if the value is a boolean.
	 * @memberof FooTable.is
	 * @function boolean
	 * @param {*} value - The value to check.
	 * @returns {boolean}
	 */
	F.is.boolean = function (value) {
		return '[object Boolean]' === Object.prototype.toString.call(value);
	};

	/**
	 * Checks if the value is a string.
	 * @memberof FooTable.is
	 * @function string
	 * @param {*} value - The value to check.
	 * @returns {boolean}
	 */
	F.is.string = function (value) {
		return '[object String]' === Object.prototype.toString.call(value);
	};

	/**
	 * Checks if the value is a number.
	 * @memberof FooTable.is
	 * @function number
	 * @param {*} value - The value to check.
	 * @returns {boolean}
	 */
	F.is.number = function (value) {
		return '[object Number]' === Object.prototype.toString.call(value) &amp;&amp; !isNaN(value);
	};

	/**
	 * Checks if the value is a function.
	 * @memberof FooTable.is
	 * @function fn
	 * @param {*} value - The value to check.
	 * @returns {boolean}
	 */
	F.is.fn = function (value) {
		return (F.is.defined(window) &amp;&amp; value === window.alert) || '[object Function]' === Object.prototype.toString.call(value);
	};

	/**
	 * Checks if the value is an error.
	 * @memberof FooTable.is
	 * @function error
	 * @param {*} value - The value to check.
	 * @returns {boolean}
	 */
	F.is.error = function (value) {
		return '[object Error]' === Object.prototype.toString.call(value);
	};

	/**
	 * Checks if the value is an object.
	 * @memberof FooTable.is
	 * @function object
	 * @param {*} value - The value to check.
	 * @returns {boolean}
	 */
	F.is.object = function (value) {
		return '[object Object]' === Object.prototype.toString.call(value);
	};

	/**
	 * Checks if the value is a hash.
	 * @memberof FooTable.is
	 * @function hash
	 * @param {*} value - The value to check.
	 * @returns {boolean}
	 */
	F.is.hash = function (value) {
		return F.is.object(value) &amp;&amp; value.constructor === Object &amp;&amp; !value.nodeType &amp;&amp; !value.setInterval;
	};

	/**
	 * Checks if the supplied object is an HTMLElement
	 * @memberof FooTable.is
	 * @function element
	 * @param {object} obj - The object to check.
	 * @returns {boolean}
	 */
	F.is.element = function (obj) {
		return typeof HTMLElement === 'object'
			? obj instanceof HTMLElement
			: obj &amp;&amp; typeof obj === 'object' &amp;&amp; obj !== null &amp;&amp; obj.nodeType === 1 &amp;&amp; typeof obj.nodeName === 'string';
	};

	/**
	 * This is a simple check to determine if an object is a jQuery promise object. It simply checks the object has a "then" and "promise" function defined.
	 * The promise object is created as an object literal inside of jQuery.Deferred.
	 * It has no prototype, nor any other truly unique properties that could be used to distinguish it.
	 * This method should be a little more accurate than the internal jQuery one that simply checks for a "promise" method.
	 * @memberof FooTable.is
	 * @function promise
	 * @param {object} obj - The object to check.
	 * @returns {boolean}
	 */
	F.is.promise = function(obj){
		return F.is.object(obj) &amp;&amp; F.is.fn(obj.then) &amp;&amp; F.is.fn(obj.promise);
	};

	/**
	 * Checks if the supplied object is an instance of a jQuery object.
	 * @memberof FooTable.is
	 * @function jq
	 * @param {object} obj - The object to check.
	 * @returns {boolean}
	 */
	F.is.jq = function(obj){
		return F.is.defined(window.jQuery) &amp;&amp; obj instanceof jQuery &amp;&amp; obj.length &gt; 0;
	};

	/**
	 * Checks if the supplied object is a moment.js date object.
	 * @memberof FooTable.is
	 * @function moment
	 * @param {object} obj - The object to check.
	 * @returns {boolean}
	 */
	F.is.moment = function(obj){
		return F.is.defined(window.moment) &amp;&amp; F.is.object(obj) &amp;&amp; F.is.boolean(obj._isAMomentObject)
	};

	/**
	 * Checks if the supplied value is an object and if it is empty.
	 * @memberof FooTable.is
	 * @function emptyObject
	 * @param {*} value - The value to check.
	 * @returns {boolean}
	 */
	F.is.emptyObject = function(value){
		if (!F.is.hash(value)) return false;
		for(var prop in value) {
			if(value.hasOwnProperty(prop))
				return false;
		}
		return true;
	};

	/**
	 * Checks if the supplied value is an array and if it is empty.
	 * @memberof FooTable.is
	 * @function emptyArray
	 * @param {*} value - The value to check.
	 * @returns {boolean}
	 */
	F.is.emptyArray = function(value){
		return F.is.array(value) ? value.length === 0 : true;
	};

	/**
	 * Checks if the supplied value is a string and if it is empty.
	 * @memberof FooTable.is
	 * @function emptyString
	 * @param {*} value - The value to check.
	 * @returns {boolean}
	 */
	F.is.emptyString = function(value){
		return F.is.string(value) ? value.length === 0 : true;
	};

})(FooTable);
(function (F) {
	/**
	 * This namespace contains commonly used string utility methods.
	 * @namespace FooTable.str
	 */
	F.str = {};

	/**
	 * Checks if the supplied string contains the given substring.
	 * @memberof FooTable.str
	 * @function contains
	 * @param {string} str - The string to check.
	 * @param {string} contains - The string to check for.
	 * @param {boolean} [ignoreCase=false] - Whether or not to ignore casing when performing the check.
	 * @returns {boolean}
	 */
	F.str.contains = function (str, contains, ignoreCase) {
		if (F.is.emptyString(str) || F.is.emptyString(contains)) return false;
		return contains.length &lt;= str.length
			&amp;&amp; (ignoreCase ? str.toUpperCase().indexOf(contains.toUpperCase()) : str.indexOf(contains)) !== -1;
	};

	/**
	 * Checks if the supplied string contains the exact given substring.
	 * @memberof FooTable.str
	 * @function contains
	 * @param {string} str - The string to check.
	 * @param {string} contains - The string to check for.
	 * @param {boolean} [ignoreCase=false] - Whether or not to ignore casing when performing the check.
	 * @returns {boolean}
	 */
	F.str.containsExact = function (str, contains, ignoreCase) {
		if (F.is.emptyString(str) || F.is.emptyString(contains) || contains.length &gt; str.length) return false;
		return new RegExp('\\b'+ F.str.escapeRegExp(contains)+'\\b', ignoreCase ? 'i' : '').test(str);
	};

	/**
	 * Checks if the supplied string contains the given word.
	 * @memberof FooTable.str
	 * @function containsWord
	 * @param {string} str - The string to check.
	 * @param {string} word - The word to check for.
	 * @param {boolean} [ignoreCase=false] - Whether or not to ignore casing when performing the check.
	 * @returns {boolean}
	 */
	F.str.containsWord = function(str, word, ignoreCase){
		if (F.is.emptyString(str) || F.is.emptyString(word) || str.length &lt; word.length)
			return false;
		var parts = str.split(/\W/);
		for (var i = 0, len = parts.length; i &lt; len; i++){
			if (ignoreCase ? parts[i].toUpperCase() == word.toUpperCase() : parts[i] == word) return true;
		}
		return false;
	};

	/**
	 * Returns the remainder of a string split on the first index of the given substring.
	 * @memberof FooTable.str
	 * @function from
	 * @param {string} str - The string to split.
	 * @param {string} from - The substring to split on.
	 * @returns {string}
	 */
	F.str.from = function (str, from) {
		if (F.is.emptyString(str)) return str;
		return F.str.contains(str, from) ? str.substring(str.indexOf(from) + 1) : str;
	};

	/**
	 * Checks if a string starts with the supplied prefix.
	 * @memberof FooTable.str
	 * @function startsWith
	 * @param {string} str - The string to check.
	 * @param {string} prefix - The prefix to check for.
	 * @returns {boolean}
	 */
	F.str.startsWith = function (str, prefix) {
		if (F.is.emptyString(str)) return str == prefix;
		return str.slice(0, prefix.length) == prefix;
	};

	/**
	 * Takes the supplied string and converts it to camel case.
	 * @memberof FooTable.str
	 * @function toCamelCase
	 * @param {string} str - The string to camel case.
	 * @returns {string}
	 */
	F.str.toCamelCase = function (str) {
		if (F.is.emptyString(str)) return str;
		if (str.toUpperCase() === str) return str.toLowerCase();
		return str.replace(/^([A-Z])|[-\s_](\w)/g, function (match, p1, p2) {
			if (F.is.string(p2)) return p2.toUpperCase();
			return p1.toLowerCase();
		});
	};

	/**
	 * Generates a random string 9 characters long using the optional prefix if supplied.
	 * @memberof FooTable.str
	 * @function random
	 * @param {string} [prefix] - The prefix to append to the 9 random characters.
	 * @returns {string}
	 */
	F.str.random = function(prefix){
		prefix = F.is.emptyString(prefix) ? '' : prefix;
		return prefix + Math.random().toString(36).substr(2, 9);
	};

	/**
	 * Escapes a string for use in a regular expression.
	 * @memberof FooTable.str
	 * @function escapeRegExp
	 * @param {string} str - The string to escape.
	 * @returns {string}
	 */
	F.str.escapeRegExp = function(str){
		if (F.is.emptyString(str)) return str;
		return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&amp;");
	};

})(FooTable);
(function (F) {
	"use strict";

	if (!Object.create) {
		Object.create = (function () {
			var Object = function () {};
			return function (prototype) {
				if (arguments.length &gt; 1)
					throw Error('Second argument not supported');

				if (!F.is.object(prototype))
					throw TypeError('Argument must be an object');

				Object.prototype = prototype;
				var result = new Object();
				Object.prototype = null;
				return result;
			};
		})();
	}

	/**
	 * This base implementation does nothing except provide access to the {@link FooTable.Class#extend} method.
	 * @constructs FooTable.Class
	 * @classdesc This class is based off of John Resig's [Simple JavaScript Inheritance]{@link http://ejohn.org/blog/simple-javascript-inheritance} but it has been updated to be ES 5.1
	 * compatible by implementing an [Object.create polyfill]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill}
	 * for older browsers.
	 * @see {@link http://ejohn.org/blog/simple-javascript-inheritance}
	 * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill}
	 * @returns {FooTable.Class}
	 */
	function Class() {}

	var __extendable__ = /xyz/.test(function () {xyz;}) ? /\b_super\b/ : /.*/;

	// this._super() within the context of the new function is a pointer to the original function
	// except if the hook param is specified then the this._super variable is the result of the original function
	Class.__extend__ = function(proto, name, func, original){
		// to all who venture here, here be dragons!
		proto[name] = F.is.fn(original) &amp;&amp; __extendable__.test(func) ?
			(function (name, fn) {
				return function () {
					var tmp, ret;
					tmp = this._super;
					this._super = original;
					ret = fn.apply(this, arguments);
					this._super = tmp;
					return ret;
				};
			})(name, func) : func;
	};

	/**
	 * Creates a new class that inherits from this class which in turn allows itself to be extended or if a name and function is supplied extends only that specific function on the class.
	 * @param {(object|string)} arg1 - An object containing any new methods/members to implement or the name of the method to extend.
	 * @param {function} arg2 - If the first argument is a method name then this is the new function to replace it with.
	 * @returns {FooTable.Class} A new class that inherits from the base class.
	 * @example &lt;caption&gt;The below shows an example of how to implement inheritance using this method.&lt;/caption&gt;
	 * var Person = FooTable.Class.extend({
	 *   construct: function(isDancing){
	 *     this.dancing = isDancing;
	 *   },
	 *   dance: function(){
	 *     return this.dancing;
	 *   }
	 * });
	 *
	 * var Ninja = Person.extend({
	 *   construct: function(){
	 *     this._super( false );
	 *   },
	 *   dance: function(){
	 *     // Call the inherited version of dance()
	 *     return this._super();
	 *   },
	 *   swingSword: function(){
	 *     return true;
	 *   }
	 * });
	 *
	 * var p = new Person(true);
	 * p.dance(); // =&gt; true
	 *
	 * var n = new Ninja();
	 * n.dance(); // =&gt; false
	 * n.swingSword(); // =&gt; true
	 *
	 * // Should all be true
	 * p instanceof Person &amp;&amp; p instanceof FooTable.Class &amp;&amp;
	 * n instanceof Ninja &amp;&amp; n instanceof Person &amp;&amp; n instanceof FooTable.Class
	 */
	Class.extend = function (arg1 , arg2) {
		var args = Array.prototype.slice.call(arguments);
		arg1 = args.shift();
		arg2 = args.shift();

		function __extend__(proto, name, func, original){
			// to all who venture here, here be dragons!
			proto[name] = F.is.fn(original) &amp;&amp; __extendable__.test(func) ?
				(function (name, fn, ofn) {
					return function () {
						var tmp, ret;
						tmp = this._super;
						this._super = ofn;
						ret = fn.apply(this, arguments);
						this._super = tmp;
						return ret;
					};
				})(name, func, original) : func;
		}

		if (F.is.hash(arg1)){
			var proto = Object.create(this.prototype),
				_super = this.prototype;
			for (var name in arg1) {
				if (name === '__ctor__') continue;
				__extend__(proto, name, arg1[name], _super[name]);
			}
			var obj = F.is.fn(proto.__ctor__) ? proto.__ctor__ : function () {
				if (!F.is.fn(this.construct))
					throw new SyntaxError('FooTable class objects must be constructed with the "new" keyword.');
				this.construct.apply(this, arguments);
			};
			proto.construct = F.is.fn(proto.construct) ? proto.construct : function(){};
			obj.prototype = proto;
			proto.constructor = obj;
			obj.extend = Class.extend;
			return obj;
		} else if (F.is.string(arg1) &amp;&amp; F.is.fn(arg2)) {
			__extend__(this.prototype, arg1, arg2, this.prototype[arg1]);
		}
	};

	F.Class = Class;

	F.ClassFactory = F.Class.extend(/** @lends FooTable.ClassFactory */{
		/**
		 * This is a simple factory for {@link FooTable.Class} objects allowing them to be registered using a friendly name
		 * and then new instances can be created using this friendly name.
		 * @constructs
		 * @extends FooTable.Class
		 * @returns {FooTable.ClassFactory}
		 * @this FooTable.ClassFactory
		 */
		construct: function(){
			/**
			 * An object containing all registered classes.
			 * @type {{}}
			 */
			this.registered = {};
		},
		/**
		 * Checks if the factory contains a class registered using the supplied name.
		 * @instance
		 * @param {string} name - The name of the class to check.
		 * @returns {boolean}
		 * @this FooTable.ClassFactory
		 */
		contains: function(name){
			return F.is.defined(this.registered[name]);
		},
		/**
		 * Gets an array of all registered names.
		 * @instance
		 * @returns {Array.&lt;string&gt;}
		 * @this FooTable.ClassFactory
		 */
		names: function(){
			var names = [], name;
			for (name in this.registered){
				if (!this.registered.hasOwnProperty(name)) continue;
				names.push(name);
			}
			return names;
		},
		/**
		 * Registers a class object using the supplied friendly name and priority. The priority is only taken into account when loading all registered classes
		 * using the {@link FooTable.ClassFactory#load} method.
		 * @instance
		 * @param {string} name - The friendly name of the class.
		 * @param {function} klass - The class to register.
		 * @param {number} priority - This determines the order that the class is created when using the {@link FooTable.ClassFactory#load} method, higher values are loaded first.
		 * @this FooTable.ClassFactory
		 */
		register: function(name, klass, priority){
			if (!F.is.string(name) || !F.is.fn(klass)) return;
			var current = this.registered[name];
			this.registered[name] = {
				name: name,
				klass: klass,
				priority: F.is.number(priority) ? priority : (F.is.defined(current) ? current.priority : 0)
			};
		},
		/**
		 * Creates new instances of all registered classes using there priority and the supplied arguments to return them in an array.
		 * @instance
		 * @param {object} subs - An object containing classes to substitute on load.
		 * @param {*} arg1 - The first argument to supply when creating new instances of all registered classes.
		 * @param {*} [argN...] - Any number of additional arguments to supply when creating new instances of all registered classes.
		 * @returns {Array.&lt;FooTable.Class&gt;}
		 * @this FooTable.ClassFactory
		 */
		load: function(subs, arg1, argN){
			var self = this, args = Array.prototype.slice.call(arguments), reg = [], loaded = [], name, klass;
			subs = args.shift() || {};
			for (name in self.registered){
				if (!self.registered.hasOwnProperty(name)) continue;
				var component = self.registered[name];
				if (subs.hasOwnProperty(name)){
					klass = subs[name];
					if (F.is.string(klass)) klass = F.getFnPointer(subs[name]);
					if (F.is.fn(klass)){
						component = {name: name, klass: klass, priority: self.registered[name].priority};
					}
				}
				reg.push(component);
			}
			for (name in subs){
				if (!subs.hasOwnProperty(name) || self.registered.hasOwnProperty(name)) continue;
				klass = subs[name];
				if (F.is.string(klass)) klass = F.getFnPointer(subs[name]);
				if (F.is.fn(klass)){
					reg.push({name: name, klass: klass, priority: 0});
				}
			}
			reg.sort(function(a, b){ return b.priority - a.priority; });
			F.arr.each(reg, function(r){
				if (F.is.fn(r.klass)){
					loaded.push(self._make(r.klass, args));
				}
			});
			return loaded;
		},
		/**
		 * Create a new instance of a single class using the supplied name and arguments.
		 * @instance
		 * @param {string} name - The name of the class to create.
		 * @param {*} arg1 - The first argument to supply to the new instance.
		 * @param {*} [argN...] - Any number of additional arguments to supply to the new instance.
		 * @returns {FooTable.Class}
		 * @this FooTable.ClassFactory
		 */
		make: function(name, arg1, argN){
			var self = this, args = Array.prototype.slice.call(arguments), reg;
			name = args.shift();
			reg = self.registered[name];
			if (F.is.fn(reg.klass)){
				return self._make(reg.klass, args);
			}
			return null;
		},
		/**
		 * This in effect lets us use the "apply" method on a function using the "new" keyword.
		 * @instance
		 * @private
		 * @param {function} klass
		 * @param args
		 * @returns {FooTable.Class}
		 * @this FooTable.ClassFactory
		 */
		_make: function(klass, args){
			function Class() {
				return klass.apply(this, args);
			}
			Class.prototype = klass.prototype;
			return new Class();
		}
	});

})(FooTable);
(function($, F){

	/**
	 * Converts the supplied cssText string into JSON object.
	 * @param {string} cssText - The cssText to convert to a JSON object.
	 * @returns {object}
	 */
	F.css2json = function(cssText){
		if (F.is.emptyString(cssText)) return {};
		var json = {}, props = cssText.split(';'), pair, key, value;
		for (var i = 0, i_len = props.length; i &lt; i_len; i++){
			if (F.is.emptyString(props[i])) continue;
			pair = props[i].split(':');
			if (F.is.emptyString(pair[0]) || F.is.emptyString(pair[1])) continue;
			key = F.str.toCamelCase($.trim(pair[0]));
			value = $.trim(pair[1]);
			json[key] = value;
		}
		return json;
	};

	/**
	 * Attempts to retrieve a function pointer using the given name.
	 * @param {string} functionName - The name of the function to fetch a pointer to.
	 * @returns {(function|object|null)}
	 */
	F.getFnPointer = function(functionName){
		if (F.is.emptyString(functionName)) return null;
		var pointer = window,
			parts = functionName.split('.');
		F.arr.each(parts, function(part){
			if (pointer[part]) pointer = pointer[part];
		});
		return F.is.fn(pointer) ? pointer : null;
	};

	/**
	 * Checks the value for function properties such as the {@link FooTable.Column#formatter} option which could also be specified using just the name
	 * and attempts to return the correct function pointer or null if none was found matching the value.
	 * @param {FooTable.Class} self - The class to use as the 'this' keyword within the context of the function.
	 * @param {(function|string)} value - The actual function or the name of the function for the property.
	 * @param {function} [def] - A default function to return if none is found.
	 * @returns {(function|null)}
	 */
	F.checkFnValue = function(self, value, def){
		def = F.is.fn(def) ? def : null;
		function wrap(t, fn, d){
			if (!F.is.fn(fn)) return d;
			return function(){
				return fn.apply(t, arguments);
			};
		}
		return F.is.fn(value) ? wrap(self, value, def) : (F.is.type(value, 'string') ? wrap(self, F.getFnPointer(value), def) : def);
	};

})(jQuery, FooTable);
(function($, F){

	F.Cell = F.Class.extend(/** @lends FooTable.Cell */{
		/**
		 * The cell class containing all the properties for cells.
		 * @constructs
		 * @extends FooTable.Class
		 * @param {FooTable.Table} table -  The root {@link FooTable.Table} this cell belongs to.
		 * @param {FooTable.Row} row - The parent {@link FooTable.Row} this cell belongs to.
		 * @param {FooTable.Column} column - The {@link FooTable.Column} this cell falls under.
		 * @param {(*|HTMLElement|jQuery)} valueOrElement - Either the value or the element for the cell.
		 * @returns {FooTable.Cell}
		 * @this FooTable.Cell
		 */
		construct: function (table, row, column, valueOrElement) {
			/**
			 * The root {@link FooTable.Table} for the cell.
			 * @instance
			 * @readonly
			 * @type {FooTable.Table}
			 */
			this.ft = table;
			/**
			 * The parent {@link FooTable.Row} for the cell.
			 * @instance
			 * @readonly
			 * @type {FooTable.Row}
			 */
			this.row = row;
			/**
			 * The {@link FooTable.Column} this cell falls under.
			 * @instance
			 * @readonly
			 * @type {FooTable.Column}
			 */
			this.column = column;
			this.created = false;
			this.define(valueOrElement);
		},
		/**
		 * This is supplied either the value or the cell element/jQuery object if it exists.
		 * If supplied the element we need set the $el property and parse the value from it.
		 * @instance
		 * @protected
		 * @param {(*|jQuery)} valueOrElement - The value or element to define the cell.
		 * @this FooTable.Cell
		 */
		define: function(valueOrElement){
			/**
			 * The jQuery table cell object this instance wraps.
			 * @instance
			 * @type {jQuery}
			 */
			this.$el = F.is.element(valueOrElement) || F.is.jq(valueOrElement) ? $(valueOrElement) : null;
			/**
			 * The jQuery row object that represents this cell in the details table.
			 * @type {jQuery}
			 */
			this.$detail = null;

			var hasOptions = F.is.hash(valueOrElement) &amp;&amp; F.is.hash(valueOrElement.options) &amp;&amp; F.is.defined(valueOrElement.value);

			/**
			 * The value of the cell.
			 * @instance
			 * @type {*}
			 */
			this.value = this.column.parser.call(this.column, F.is.jq(this.$el) ? this.$el : (hasOptions ? valueOrElement.value : valueOrElement), this.ft.o);

			/**
			 * Contains any options for the cell. These are the options supplied through the plugin constructor as part of the row object itself.
			 * @type {object}
			 */
			this.o = $.extend(true, {
				classes: null,
				style: null
			}, hasOptions ? valueOrElement.options : {});
			/**
			 * An array of CSS classes for the cell.
			 * @instance
			 * @protected
			 * @type {Array.&lt;string&gt;}
			 */
			this.classes = F.is.jq(this.$el) &amp;&amp; this.$el.attr('class') ? this.$el.attr('class').match(/\S+/g) : (F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []));
			/**
			 * The inline styles for the cell.
			 * @instance
			 * @protected
			 * @type {object}
			 */
			this.style = F.is.jq(this.$el) &amp;&amp; this.$el.attr('style') ? F.css2json(this.$el.attr('style')) : (F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {}));
		},
		/**
		 * After the cell has been defined this ensures that the $el and #detail properties are jQuery objects by either creating or updating them.
		 * @instance
		 * @protected
		 * @this FooTable.Cell
		 */
		$create: function(){
			if (this.created) return;
			/*if(F.is.jq(this.$el))
			{*/
			(this.$el = F.is.jq(this.$el) ? this.$el : $('&lt;td/&gt;'))
				.data('value', this.value)
				.contents().detach().end()
				.append(this.format(this.value));

			this._setClasses(this.$el);
			this._setStyle(this.$el);

			this.$detail = $('&lt;tr/&gt;').addClass(this.row.classes.join(' '))
				.data('__FooTableCell__', this)
				.append($('&lt;th/&gt;'))
				.append($('&lt;td/&gt;'));
			// }
			this.created = true;
		},
		/**
		 * Collapses this cell and displays it in the details row.
		 * @instance
		 * @protected
		 */
		collapse: function(){
			if (!this.created) return;
			this.$detail.children('th').html(this.column.title);
			this.$el.clone()
				.attr('id', this.$el.attr('id') ? this.$el.attr('id') + '-detail' : undefined)
				.css('display', 'table-cell')
				.html('')
				.append(this.$el.contents().detach())
				.replaceAll(this.$detail.children('td').first());

			if (!F.is.jq(this.$detail.parent()))
				this.$detail.appendTo(this.row.$details.find('.footable-details &gt; tbody'));
		},
		/**
		 * Restores this cell from a detail row back into the normal row.
		 * @instance
		 * @protected
		 */
		restore: function(){
			if (!this.created) return;
			if (F.is.jq(this.$detail.parent())){
				var $cell = this.$detail.children('td').first();
				this.$el
					.attr('class', $cell.attr('class'))
					.attr('style', $cell.attr('style'))
					.css('display', (this.column.hidden || !this.column.visible) ? 'none' : 'table-cell')
					.append($cell.contents().detach());
			}
			this.$detail.detach();
		},
		/**
		 * Helper method to call this cell's column parser function supplying the required parameters.
		 * @instance
		 * @protected
		 * @returns {*}
		 * @see FooTable.Column#parser
		 * @this FooTable.Cell
		 */
		parse: function(){
			return this.column.parser.call(this.column, this.$el, this.ft.o);
		},
		/**
		 * Helper method to call this cell's column formatter function using the supplied value and any additional required parameters.
		 * @instance
		 * @protected
		 * @param {*} value - The value to format.
		 * @returns {(string|HTMLElement|jQuery)}
		 * @see FooTable.Column#formatter
		 * @this FooTable.Cell
		 */
		format: function(value){
			return this.column.formatter.call(this.column, value, this.ft.o, this.row.value);
		},
		/**
		 * Allows easy access to getting or setting the cell's value. If the value is set all associated properties are also updated along with the actual element.
		 * Using this method also allows us to supply an object containing options and the value for the cell.
		 * @instance
		 * @param {*} [value] - The value to set for the cell. If not supplied the current value of the cell is returned.
		 * @param {boolean} [redraw=true] - Whether or not to redraw the row once the value has been set.
		 * @param {boolean} [redrawSelf=true] - Whether or not to redraw the cell itself once the value has been set, if `false` this will override the supplied `redraw` value and prevent the row from redrawing as well.
		 * @returns {(*|undefined)}
		 * @this FooTable.Cell
		 */
		val: function(value, redraw, redrawSelf){
			if (F.is.undef(value)){
				// get
				return this.value;
			}
			// set
			var self = this, hasOptions = F.is.hash(value) &amp;&amp; F.is.hash(value.options) &amp;&amp; F.is.defined(value.value);
			this.o = $.extend(true, {
				classes: self.classes,
				style: self.style
			}, hasOptions ? value.options : {});

			this.value = hasOptions ? value.value : value;
			this.classes = F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []);
			this.style = F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {});

			redrawSelf = F.is.boolean(redrawSelf) ? redrawSelf : true;
			if (this.created &amp;&amp; redrawSelf){
				this.$el.data('value', this.value).empty();

				var $detail = this.$detail.children('td').first().empty(),
					$target = F.is.jq(this.$detail.parent()) ? $detail : this.$el;

				$target.append(this.format(this.value));

				this._setClasses($target);
				this._setStyle($target);

				if (F.is.boolean(redraw) ? redraw : true) this.row.draw();
			}
		},
		_setClasses: function($el){
			var hasColClasses = !F.is.emptyArray(this.column.classes),
				hasClasses = !F.is.emptyArray(this.classes),
				classes = null;
			$el.removeAttr('class');
			if (!hasColClasses &amp;&amp; !hasClasses) return;
			if (hasColClasses &amp;&amp; hasClasses){
				classes = this.classes.concat(this.column.classes).join(' ');
			} else if (hasColClasses) {
				classes = this.column.classes.join(' ');
			} else if (hasClasses){
				classes = this.classes.join(' ');
			}
			if (!F.is.emptyString(classes)){
				$el.addClass(classes);
			}
		},
		_setStyle: function($el){
			var hasColStyle = !F.is.emptyObject(this.column.style),
				hasStyle = !F.is.emptyObject(this.style),
				style = null;
			$el.removeAttr('style');
			if (!hasColStyle &amp;&amp; !hasStyle) return;
			if (hasColStyle &amp;&amp; hasStyle){
				style = $.extend({}, this.column.style, this.style);
			} else if (hasColStyle) {
				style = this.column.style;
			} else if (hasStyle){
				style = this.style;
			}
			if (F.is.hash(style)){
				$el.css(style);
			}
		}
	});

})(jQuery, FooTable);
(function($, F){

	F.Column = F.Class.extend(/** @lends FooTable.Column */{
		/**
		 * The column class containing all the properties for columns. All members marked as "readonly" should not be used when defining {@link FooTable.Defaults#columns}.
		 * @constructs
		 * @extends FooTable.Class
		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this component belongs to.
		 * @param {object} definition - An object containing all the properties to set for the column.
		 * @param {string} [type] - The type of column, "text" by default.
		 * @returns {FooTable.Column}
		 * @this FooTable.Column
		 */
		construct: function(instance, definition, type){
			/**
			 * The root {@link FooTable.Table} for the column.
			 * @instance
			 * @readonly
			 * @type {FooTable.Table}
			 */
			this.ft = instance;
			/**
			 * The type of data displayed by the column.
			 * @instance
			 * @readonly
			 * @type {string}
			 */
			this.type = F.is.emptyString(type) ? 'text' : type;
			/**
			 * Whether or not the column was parsed from a standard table row containing data instead of from an actual header row.
			 * @instance
			 * @readonly
			 * @type {boolean}
			 */
			this.virtual = F.is.boolean(definition.virtual) ? definition.virtual : false;
			/**
			 * The jQuery cell object for the column header.
			 * @instance
			 * @readonly
			 * @type {jQuery}
			 */
			this.$el = F.is.jq(definition.$el) ? definition.$el : null;
			/**
			 * The index of the column in the table. This is set by the plugin during initialization.
			 * @instance
			 * @readonly
			 * @type {number}
			 * @default -1
			 */
			this.index = F.is.number(definition.index) ? definition.index : -1;
			/**
			 * Whether or not this in an internal only column.
			 * @instance
			 * @readonly
			 * @type {boolean}
			 * @description Internal columns or there cells will not be returned when calling methods such as `FooTable.Row#val`.
			 */
			this.internal = false;
			this.define(definition);
			this.$create();
		},
		/**
		 * This is supplied the column definition in the form of a simple object created by merging options supplied via the plugin constructor with those parsed from the DOM.
		 * @instance
		 * @protected
		 * @param {object} definition - The object containing the column definition.
		 * @this FooTable.Column
		 */
		define: function(definition){
			/**
			 * Whether or not this column is hidden from view and appears in the details row.
			 * @type {boolean}
			 * @default false
			 */
			this.hidden = F.is.boolean(definition.hidden) ? definition.hidden : false;
			/**
			 * Whether or not this column is completely hidden from view and will not appear in the details row.
			 * @type {boolean}
			 * @default true
			 */
			this.visible = F.is.boolean(definition.visible) ? definition.visible : true;

			/**
			 * The name of the column. This name must correspond to the property name of the JSON row data.
			 * @type {string}
			 * @default null
			 */
			this.name = F.is.string(definition.name) ? definition.name : null;
			if (this.name == null) this.name = 'col'+(definition.index+1);
			/**
			 * The title to display in the column header, this can be HTML.
			 * @type {string}
			 * @default null
			 */
			this.title = F.is.string(definition.title) ? definition.title : null;
			if (!this.virtual &amp;&amp; this.title == null &amp;&amp; F.is.jq(this.$el)) this.title = this.$el.html();
			if (this.title == null) this.title = 'Column '+(definition.index+1);
			/**
			 * The styles to apply to all cells in this column.
			 * @type {object}
			 */
			this.style = F.is.hash(definition.style) ? definition.style : (F.is.string(definition.style) ? F.css2json(definition.style) : {});
			/**
			 * The classes to apply to all cells in this column.
			 * @type {Array.&lt;string&gt;}
			 */
			this.classes = F.is.array(definition.classes) ? definition.classes : (F.is.string(definition.classes) ? definition.classes.match(/\S+/g) : []);

			// override any default functions ensuring when they are executed "this" within the context of the function points to the instance of this object.
			this.parser = F.checkFnValue(this, definition.parser, this.parser);
			this.formatter = F.checkFnValue(this, definition.formatter, this.formatter);
		},
		/**
		 * After the column has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
		 * @instance
		 * @protected
		 * @this FooTable.Column
		 */
		$create: function(){
			(this.$el = !this.virtual &amp;&amp; F.is.jq(this.$el) ? this.$el : $('&lt;th/&gt;')).html(this.title).addClass(this.classes.join(' ')).css(this.style);
		},
		/**
		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and will be provided to the {@link FooTable.Column#format} function
		 * to generate the cell contents.
		 * @instance
		 * @protected
		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
		 * @returns {string}
		 * @this FooTable.Column
		 */
		parser: function(valueOrElement){
			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){ // use jQuery to get the value
				var data = $(valueOrElement).data('value');
				return F.is.defined(data) ? data : $(valueOrElement).html();
			}
			if (F.is.defined(valueOrElement) &amp;&amp; valueOrElement != null) return valueOrElement+''; // use the native toString of the value
			return null; // otherwise we have no value so return null
		},
		/**
		 * This is supplied the value retrieved from the {@link FooTable.Column#parse} function and must return a string, HTMLElement or jQuery object.
		 * The return value from this function is what is displayed in the cell in the table.
		 * @instance
		 * @protected
		 * @param {string} value - The value to format.
		 * @param {object} options - The current plugin options.
		 * @param {object} rowData - An object containing the current row data.
		 * @returns {(string|HTMLElement|jQuery)}
		 * @this FooTable.Column
		 */
		formatter: function(value, options, rowData){
			return value == null ? '' : value;
		},
		/**
		 * Creates a cell for this column from the supplied {@link FooTable.Row} object. This allows different column types to return different types of cells.
		 * @instance
		 * @protected
		 * @param {FooTable.Row} row - The row to create the cell from.
		 * @returns {FooTable.Cell}
		 * @this FooTable.Column
		 */
		createCell: function(row){
			var element = F.is.jq(row.$el) ? row.$el.children('td,th').get(this.index) : null,
				data = F.is.hash(row.value) ? row.value[this.name] : null;
			return new F.Cell(this.ft, row, this, element || data);
		}
	});

	F.columns = new F.ClassFactory();

	F.columns.register('text', F.Column);

})(jQuery, FooTable);
(function ($, F) {

	F.Component = F.Class.extend(/** @lends FooTable.Component */{
		/**
		 * The base class for all FooTable components.
		 * @constructs
		 * @extends FooTable.Class
		 * @param {FooTable.Table} instance - The parent {@link FooTable.Table} object for the component.
		 * @param {boolean} enabled - Whether or not the component is enabled.
		 * @throws {TypeError} The instance parameter must be an instance of {@link FooTable.Table}.
		 * @returns {FooTable.Component}
		 */
		construct: function (instance, enabled) {
			if (!(instance instanceof F.Table))
				throw new TypeError('The instance parameter must be an instance of FooTable.Table.');

			/**
			 * The parent {@link FooTable.Table} for the component.
			 * @type {FooTable.Table}
			 */
			this.ft = instance;
			/**
			 * Whether or not this component is enabled. Disabled components only have there preinit method called allowing for this value to be overridden.
			 * @type {boolean}
			 */
			this.enabled = F.is.boolean(enabled) ? enabled : false;
		},
		/**
		 * The preinit method is called during the parent {@link FooTable.Table} constructor call.
		 * @param {object} data - The jQuery.data() object of the root table.
		 * @instance
		 * @protected
		 * @function
		 */
		preinit: function(data){},
		/**
		 * The init method is called during the parent {@link FooTable.Table} constructor call.
		 * @instance
		 * @protected
		 * @function
		 */
		init: function(){},
		/**
		 * This method is called from the {@link FooTable.Table#destroy} method.
		 * @instance
		 * @protected
		 * @function
		 */
		destroy: function(){},
		/**
		 * This method is called from the {@link FooTable.Table#draw} method.
		 * @instance
		 * @protected
		 * @function
		 */
		predraw: function(){},
		/**
		 * This method is called from the {@link FooTable.Table#draw} method.
		 * @instance
		 * @protected
		 * @function
		 */
		draw: function(){},
		/**
		 * This method is called from the {@link FooTable.Table#draw} method.
		 * @instance
		 * @protected
		 * @function
		 */
		postdraw: function(){}
	});

	F.components = new F.ClassFactory();

})(jQuery, FooTable);
(function ($, F) {
	/**
	 * Contains all the available options for the FooTable plugin.
	 * @name FooTable.Defaults
	 * @function
	 * @constructor
	 * @returns {FooTable.Defaults}
	 */
	F.Defaults = function () {
		/**
		 * Whether or not events raised using the {@link FooTable.Table#raise} method are propagated up the DOM. By default this is set to false and all events bubble up the DOM as per usual
		 * however the reason for this option is if we have nested tables. If false the parent table would receive all the events raised by it's children and any handlers bound to both the
		 * parent and child would be triggered which is not the desired behavior.
		 * @type {boolean}
		 * @default false
		 */
		this.stopPropagation = false;
		/**
		 * An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
		 * @type {object.&lt;string, function&gt;}
		 * @default NULL
		 * @example &lt;caption&gt;This example shows how to pass an object containing the events and handlers.&lt;/caption&gt;
		 * "on": {
		 * 	"click": function(e){
		 * 		// bind a custom click event to do something whenever the table is clicked
		 * 	},
		 * 	"init.ft.table": function(e, ft){
		 * 		// bind to the FooTable initialize event to do something
		 * 	}
		 * }
		 */
		this.on = null;
	};

	/**
	 * Contains all the default options for the plugin.
	 * @type {FooTable.Defaults}
	 */
	F.defaults = new F.Defaults();

})(jQuery, FooTable);
(function($, F){

	F.Row = F.Class.extend(/** @lends FooTable.Row */{
		/**
		 * The row class containing all the properties for a row and its' cells.
		 * @constructs
		 * @extends FooTable.Class
		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
		 * @param {Array.&lt;FooTable.Column&gt;} columns - The array of {@link FooTable.Column} for this row.
		 * @param {(*|HTMLElement|jQuery)} dataOrElement - Either the data for the row (create) or the element (parse) for the row.
		 * @returns {FooTable.Row}
		 */
		construct: function (table, columns, dataOrElement) {
			/**
			 * The {@link FooTable.Table} for the row.
			 * @type {FooTable.Table}
			 */
			this.ft = table;
			/**
			 * The array of {@link FooTable.Column} for this row.
			 * @type {Array.&lt;FooTable.Column&gt;}
			 */
			this.columns = columns;

			this.created = false;
			this.define(dataOrElement);
		},
		/**
		 * This is supplied either the object containing the values for the row or the row element/jQuery object if it exists.
		 * If supplied the element we need to set the $el property and parse the cells from it using the column index.
		 * If we have an object we parse the cells from it using the column name.
		 * @param {(object|jQuery)} dataOrElement - The row object or element to define the row.
		 */
		define: function(dataOrElement){
			/**
			 * The jQuery table row object this instance wraps.
			 * @instance
			 * @protected
			 * @type {jQuery}
			 */
			this.$el = F.is.element(dataOrElement) || F.is.jq(dataOrElement) ? $(dataOrElement) : null;
			/**
			 * The jQuery toggle element for the row.
			 * @instance
			 * @protected
			 * @type {jQuery}
			 */
			this.$toggle = $('&lt;span/&gt;', {'class': 'footable-toggle fooicon fooicon-plus'});

			var isObj = F.is.hash(dataOrElement),
				hasOptions = isObj &amp;&amp; F.is.hash(dataOrElement.options) &amp;&amp; F.is.hash(dataOrElement.value);

			/**
			 * The value of the row.
			 * @instance
			 * @protected
			 * @type {Object}
			 */
			this.value = isObj ? (hasOptions ? dataOrElement.value : dataOrElement) : null;

			/**
			 * Contains any options for the row.
			 * @type {object}
			 */
			this.o = $.extend(true, {
				expanded: false,
				classes: null,
				style: null
			}, hasOptions ? dataOrElement.options : {});

			/**
			 * Whether or not this row is expanded and will display it's detail row when there are any hidden columns.
			 * @instance
			 * @protected
			 * @type {boolean}
			 */
			this.expanded = F.is.jq(this.$el) ? (this.$el.data('expanded') || this.o.expanded) : this.o.expanded;
			/**
			 * An array of CSS classes for the row.
			 * @instance
			 * @protected
			 * @type {Array.&lt;string&gt;}
			 */
			this.classes = F.is.jq(this.$el) &amp;&amp; this.$el.attr('class') ? this.$el.attr('class').match(/\S+/g) : (F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []));
			/**
			 * The inline styles for the row.
			 * @instance
			 * @protected
			 * @type {object}
			 */
			this.style = F.is.jq(this.$el) &amp;&amp; this.$el.attr('style') ? F.css2json(this.$el.attr('style')) : (F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {}));

			/**
			 * The cells array. This is populated before the call to the {@link FooTable.Row#$create} method.
			 * @instance
			 * @type {Array.&lt;FooTable.Cell&gt;}
			 */
			this.cells = this.createCells();

			// this ensures the value contains the parsed cell values and not the supplied values
			var self = this;
			self.value = {};
			F.arr.each(self.cells, function(cell){
				self.value[cell.column.name] = cell.val();
			});
		},
		/**
		 * After the row has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
		 * @instance
		 * @protected
		 * @this FooTable.Row
		 */
		$create: function(){
			if (this.created) return;
			(this.$el = F.is.jq(this.$el) ? this.$el : $('&lt;tr/&gt;'))
				.data('__FooTableRow__', this);

			this._setClasses(this.$el);
			this._setStyle(this.$el);

			if (this.ft.rows.toggleColumn == 'last') this.$toggle.addClass('last-column');

			this.$details = $('&lt;tr/&gt;', { 'class': 'footable-detail-row' })
				.append($('&lt;td/&gt;', { colspan: this.ft.columns.visibleColspan })
					.append($('&lt;table/&gt;', { 'class': 'footable-details ' + this.ft.classes.join(' ') })
						.append('&lt;tbody/&gt;')));

			var self = this;
			F.arr.each(self.cells, function(cell){
				if (!cell.created) cell.$create();
				self.$el.append(cell.$el);
			});
			self.$el.off('click.ft.row').on('click.ft.row', { self: self }, self._onToggle);
			this.created = true;
		},
		/**
		 * This is called during the construct method and uses the current column definitions to create an array of {@link FooTable.Cell} objects for the row.
		 * @instance
		 * @protected
		 * @returns {Array.&lt;FooTable.Cell&gt;}
		 * @this FooTable.Row
		 */
		createCells: function(){
			var self = this;
			return F.arr.map(self.columns, function(col){
				return col.createCell(self);
			});
		},
		/**
		 * Allows easy access to getting or setting the row's data. If the data is set all associated properties are also updated along with the actual element.
		 * Using this method also allows us to supply an object containing options and the data for the row at the same time.
		 * @instance
		 * @param {object} [data] - The data to set for the row. If not supplied the current value of the row is returned.
		 * @param {boolean} [redraw=true] - Whether or not to redraw the table once the value has been set.
		 * @param {boolean} [redrawSelf=true] - Whether or not to redraw the row itself once the value has been set, if `false` this will override the supplied `redraw` value and prevent the table from redrawing as well.
		 * @returns {(*|undefined)}
		 */
		val: function(data, redraw, redrawSelf){
			var self = this;
			if (!F.is.hash(data)){
				// get - check the value property and build it from the cells if required.
				if (!F.is.hash(this.value) || F.is.emptyObject(this.value)){
					this.value = {};
					F.arr.each(this.cells, function(cell){
						if (!cell.column.internal){
							self.value[cell.column.name] = cell.val();
						}
					});
				}
				return this.value;
			}
			// set
			this.collapse(false);
			var isObj = F.is.hash(data),
				hasOptions = isObj &amp;&amp; F.is.hash(data.options) &amp;&amp; F.is.hash(data.value);

			this.o = $.extend(true, {
				expanded: self.expanded,
				classes: self.classes,
				style: self.style
			}, hasOptions ? data.options : {});

			this.expanded = this.o.expanded;
			this.classes = F.is.array(this.o.classes) ? this.o.classes : (F.is.string(this.o.classes) ? this.o.classes.match(/\S+/g) : []);
			this.style = F.is.hash(this.o.style) ? this.o.style : (F.is.string(this.o.style) ? F.css2json(this.o.style) : {});
			if (isObj) {
				if ( hasOptions ) data = data.value;
				if (F.is.hash(this.value)){
					for (var prop in data) {
						if (!data.hasOwnProperty(prop)) continue;
						this.value[prop] = data[prop];
					}
				} else {
					this.value = data;
				}
			} else {
				this.value = null;
			}

			redrawSelf = F.is.boolean(redrawSelf) ? redrawSelf : true;
			F.arr.each(this.cells, function(cell){
				if (!cell.column.internal &amp;&amp; F.is.defined(self.value[cell.column.name])){
					cell.val(self.value[cell.column.name], false, redrawSelf);
				}
			});

			if (this.created &amp;&amp; redrawSelf){
				this._setClasses(this.$el);
				this._setStyle(this.$el);
				if (F.is.boolean(redraw) ? redraw : true) this.draw();
			}
		},
		_setClasses: function($el){
			var hasClasses = !F.is.emptyArray(this.classes),
				classes = null;
			$el.removeAttr('class');
			if (!hasClasses) return;
			else classes = this.classes.join(' ');
			if (!F.is.emptyString(classes)){
				$el.addClass(classes);
			}
		},
		_setStyle: function($el){
			var hasStyle = !F.is.emptyObject(this.style),
				style = null;
			$el.removeAttr('style');
			if (!hasStyle) return;
			else style = this.style;
			if (F.is.hash(style)){
				$el.css(style);
			}
		},
		/**
		 * Sets the current row to an expanded state displaying any hidden columns in a detail row just below it.
		 * @instance
		 * @fires FooTable.Row#"expand.ft.row"
		 */
		expand: function(){
			if (!this.created) return;
			var self = this;
			/**
			 * The expand.ft.row event is raised before the the row is expanded.
			 * Calling preventDefault on this event will stop the row being expanded.
			 * @event FooTable.Row#"expand.ft.row"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {FooTable.Row} row - The row about to be expanded.
			 */
			self.ft.raise('expand.ft.row',[self]).then(function(){
				self.__hidden__ = F.arr.map(self.cells, function(cell){
					return cell.column.hidden &amp;&amp; cell.column.visible ? cell : null;
				});

				if (self.__hidden__.length &gt; 0){
					self.$details.insertAfter(self.$el)
						.children('td').first()
						.attr('colspan', self.ft.columns.visibleColspan);

					F.arr.each(self.__hidden__, function(cell){
						cell.collapse();
					});
				}
				self.$el.attr('data-expanded', true);
				self.$toggle.removeClass('fooicon-plus').addClass('fooicon-minus');
				self.expanded = true;
				self.ft.raise('expanded.ft.row', [self]);
			});
		},
		/**
		 * Sets the current row to a collapsed state removing the detail row if it exists.
		 * @instance
		 * @param {boolean} [setExpanded] - Whether or not to set the {@link FooTable.Row#expanded} property to false.
		 * @fires FooTable.Row#"collapse.ft.row"
		 */
		collapse: function(setExpanded){
			if (!this.created) return;
			var self = this;
			/**
			 * The collapse.ft.row event is raised before the the row is collapsed.
			 * Calling preventDefault on this event will stop the row being collapsed.
			 * @event FooTable.Row#"collapse.ft.row"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {FooTable.Row} row - The row about to be expanded.
			 */
			self.ft.raise('collapse.ft.row',[self]).then(function(){
				F.arr.each(self.__hidden__, function(cell){
					cell.restore();
				});
				self.$details.detach();
				self.$el.removeAttr('data-expanded');
				self.$toggle.removeClass('fooicon-minus').addClass('fooicon-plus');
				if (F.is.boolean(setExpanded) ? setExpanded : true) self.expanded = false;
				self.ft.raise('collapsed.ft.row', [self]);
			});
		},
		/**
		 * Prior to drawing this moves the details contents back to there original cells and detaches the toggle element from the row.
		 * @instance
		 * @param {boolean} [detach] - Whether or not to detach the row.
		 * @this FooTable.Row
		 */
		predraw: function(detach){
			if (this.created){
				if (this.expanded){
					this.collapse(false);
				}
				this.$toggle.detach();
				detach = F.is.boolean(detach) ? detach : true;
				if (detach) this.$el.detach();
			}
		},
		/**
		 * Draws the current row and cells.
		 * @instance
		 * @this FooTable.Row
		 */
		draw: function($parent){
			if (!this.created) this.$create();
			if (F.is.jq($parent)) $parent.append(this.$el);
			var self = this;
			F.arr.each(self.cells, function(cell){
				cell.$el.css('display', (cell.column.hidden || !cell.column.visible  ? 'none' : 'table-cell'));
				if (self.ft.rows.showToggle &amp;&amp; self.ft.columns.hasHidden){
					if ((self.ft.rows.toggleColumn == 'first' &amp;&amp; cell.column.index == self.ft.columns.firstVisibleIndex)
						|| (self.ft.rows.toggleColumn == 'last' &amp;&amp; cell.column.index == self.ft.columns.lastVisibleIndex)) {
						cell.$el.prepend(self.$toggle);
					}
				}
				cell.$el.add(cell.column.$el).removeClass('footable-first-visible footable-last-visible');
				if (cell.column.index == self.ft.columns.firstVisibleIndex){
					cell.$el.add(cell.column.$el).addClass('footable-first-visible');
				}
				if (cell.column.index == self.ft.columns.lastVisibleIndex){
					cell.$el.add(cell.column.$el).addClass('footable-last-visible');
				}
			});
			if (this.expanded){
				this.expand();
			}
		},
		/**
		 * Toggles the row between it's expanded and collapsed state if there are hidden columns.
		 * @instance
		 * @this FooTable.Row
		 */
		toggle: function(){
			if (this.created &amp;&amp; this.ft.columns.hasHidden){
				if (this.expanded) this.collapse();
				else this.expand();
			}
		},
		/**
		 * Handles the toggle click event for rows.
		 * @instance
		 * @param {jQuery.Event} e - The jQuery.Event object for the click event.
		 * @private
		 * @this jQuery
		 */
		_onToggle: function (e) {
			var self = e.data.self;
			// only execute the toggle if the event.target is one of the approved initiators
			if ($(e.target).is(self.ft.rows.toggleSelector)){
				self.toggle();
			}
		}
	});

})(jQuery, FooTable);

(function ($, F) {

	/**
	 * An array of all currently loaded instances of the plugin.
	 * @protected
	 * @readonly
	 * @type {Array.&lt;FooTable.Table&gt;}
	 */
	F.instances = [];

	F.Table = F.Class.extend(/** @lends FooTable.Table */{
		/**
		 * This class is the core of the plugin and drives the logic of all components.
		 * @constructs
		 * @this FooTable.Table
		 * @extends FooTable.Class
		 * @param {(HTMLTableElement|jQuery)} element - The element or jQuery table object to bind the plugin to.
		 * @param {object} options - The options to initialize the plugin with.
		 * @param {function} [ready] - A callback function to execute once the plugin is initialized.
		 * @returns {FooTable.Table}
		 */
		construct: function (element, options, ready) {
			//BEGIN MEMBERS
			/**
			 * The timeout ID for the resize event.
			 * @instance
			 * @private
			 * @type {?number}
			 */
			this._resizeTimeout = null;
			/**
			 * The ID of the FooTable instance.
			 * @instance
			 * @type {number}
			 */
			this.id = F.instances.push(this);
			/**
			 * Whether or not the plugin and all components and add-ons are fully initialized.
			 * @instance
			 * @type {boolean}
			 */
			this.initialized = false;
			/**
			 * The jQuery table object the plugin is bound to.
			 * @instance
			 * @type {jQuery}
			 */
			this.$el = (F.is.jq(element) ? element : $(element)).first(); // ensure one table, one instance
			/**
			 * A loader jQuery instance
			 * @instance
			 * @type {jQuery}
			 */
			this.$loader = $('&lt;div/&gt;', { 'class': 'footable-loader' }).append($('&lt;span/&gt;', {'class': 'fooicon fooicon-loader'}));
			/**
			 * The options for the plugin. This is a merge of user defined options and the default options.
			 * @instance
			 * @type {object}
			 */
			this.o = $.extend(true, {}, F.defaults, options);
			/**
			 * The jQuery data object for the table at initialization.
			 * @instance
			 * @type {object}
			 */
			this.data = this.$el.data() || {};
			/**
			 * An array of all CSS classes on the table that do not start with "footable".
			 * @instance
			 * @protected
			 * @type {Array.&lt;string&gt;}
			 */
			this.classes = [];
			/**
			 * All components for this instance of the plugin. These are executed in the order they appear in the array for the initialize phase and in reverse order for the destroy phase of the plugin.
			 * @instance
			 * @protected
			 * @type {object}
			 * @prop {Array.&lt;FooTable.Component&gt;} internal - The internal components for the plugin. These are executed either before all other components in the initialize phase or after them in the destroy phase of the plugin.
			 * @prop {Array.&lt;FooTable.Component&gt;} core - The core components for the plugin. These are executed either after the internal components in the initialize phase or before them in the destroy phase of the plugin.
			 * @prop {Array.&lt;FooTable.Component&gt;} custom - The custom components for the plugin. These are executed either after the core components in the initialize phase or before them in the destroy phase of the plugin.
			 */
			this.components = F.components.load((F.is.hash(this.data.components) ? this.data.components : this.o.components), this);
			/**
			 * The breakpoints component for this instance of the plugin.
			 * @instance
			 * @type {FooTable.Breakpoints}
			 */
			this.breakpoints = this.use(FooTable.Breakpoints);
			/**
			 * The columns component for this instance of the plugin.
			 * @instance
			 * @type {FooTable.Columns}
			 */
			this.columns = this.use(FooTable.Columns);
			/**
			 * The rows component for this instance of the plugin.
			 * @instance
			 * @type {FooTable.Rows}
			 */
			this.rows = this.use(FooTable.Rows);

			//END MEMBERS
			this._construct(ready);
		},
		/**
		 * Once all properties are set this performs the actual initialization of the plugin calling the {@link FooTable.Table#_preinit} and
		 * {@link FooTable.Table#_init} methods as well as raising the {@link FooTable.Table#"ready.ft.table"} event.
		 * @this FooTable.Table
		 * @instance
		 * @param {function} [ready] - A callback function to execute once the plugin is initialized.
		 * @private
		 * @returns {jQuery.Promise}
		 * @fires FooTable.Table#"ready.ft.table"
		 */
		_construct: function(ready){
			var self = this;
			return this._preinit().then(function(){
				return self._init().then(function(){
					/**
					 * The ready.ft.table event is raised after the plugin has been initialized and the table drawn.
					 * Calling preventDefault on this event will stop the ready callback being executed.
					 * @event FooTable.Table#"ready.ft.table"
					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
					 */
					return self.raise('ready.ft.table').then(function(){
						if (F.is.fn(ready)) ready.call(self, self);
					});
				});
			}).always(function(arg){
				self.$el.show();
				if (F.is.error(arg)){
					console.error('FooTable: unhandled error thrown during initialization.', arg);
				}
			});
		},
		/**
		 * The preinit method is called prior to the plugins actual initialization and provides itself and it's components an opportunity to parse any additional option values.
		 * @instance
		 * @private
		 * @returns {jQuery.Promise}
		 * @fires FooTable.Table#"preinit.ft.table"
		 */
		_preinit: function(){
			var self = this;
			/**
			 * The preinit.ft.table event is raised before any components.
			 * Calling preventDefault on this event will disable the entire plugin.
			 * @event FooTable.Table#"preinit.ft.table"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {object} data - The jQuery data object from the root table element.
			 */
			return this.raise('preinit.ft.table', [self.data]).then(function(){
				var classes = (self.$el.attr('class') || '').match(/\S+/g) || [];

				self.o.ajax = F.checkFnValue(self, self.data.ajax, self.o.ajax);
				self.o.stopPropagation = F.is.boolean(self.data.stopPropagation)
					? self.data.stopPropagation
					: self.o.stopPropagation;

				for (var i = 0, len = classes.length; i &lt; len; i++){
					if (!F.str.startsWith(classes[i], 'footable')) self.classes.push(classes[i]);
				}

				self.$el.hide().after(self.$loader);
				return self.execute(false, false, 'preinit', self.data);
			});
		},
		/**
		 * Initializes this instance of the plugin and calls the callback function if one is supplied once complete.
		 * @this FooTable.Table
		 * @instance
		 * @private
		 * @return {jQuery.Promise}
		 * @fires FooTable.Table#"init.ft.table"
		 */
		_init: function(){
			var self = this;
			/**
			 * The init.ft.table event is raised before any components are initialized.
			 * Calling preventDefault on this event will disable the entire plugin.
			 * @event FooTable.Table#"init.ft.table"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			return self.raise('init.ft.table').then(function(){
				var $thead = self.$el.children('thead'),
					$tbody = self.$el.children('tbody'),
					$tfoot = self.$el.children('tfoot');
				self.$el.addClass('footable footable-' + self.id);
				if (F.is.hash(self.o.on)) self.$el.on(self.o.on);
				if ($tfoot.length == 0) self.$el.append($tfoot = $('&lt;tfoot/&gt;'));
				if ($tbody.length == 0) self.$el.append('&lt;tbody/&gt;');
				if ($thead.length == 0) self.$el.prepend($thead = $('&lt;thead/&gt;'));
				return self.execute(false, true, 'init').then(function(){
					self.$el.data('__FooTable__', self);
					if ($tfoot.children('tr').length == 0) $tfoot.remove();
					if ($thead.children('tr').length == 0) $thead.remove();

					/**
					 * The postinit.ft.table event is raised after any components are initialized but before the table is
					 * drawn for the first time.
					 * Calling preventDefault on this event will disable the initial drawing of the table.
					 * @event FooTable.Table#"postinit.ft.table"
					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
					 */
					return self.raise('postinit.ft.table').then(function(){
						return self.draw();
					}).always(function(){
						$(window).off('resize.ft'+self.id, self._onWindowResize)
							.on('resize.ft'+self.id, { self: self }, self._onWindowResize);
						self.initialized = true;
					});
				});
			});
		},
		/**
		 * Destroys this plugin removing it from the table.
		 * @this FooTable.Table
		 * @instance
		 * @fires FooTable.Table#"destroy.ft.table"
		 */
		destroy: function () {
			var self = this;
			/**
			 * The destroy.ft.table event is called before all core components.
			 * Calling preventDefault on this event will prevent the entire plugin from being destroyed.
			 * @event FooTable.Table#"destroy.ft.table"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			return self.raise('destroy.ft.table').then(function(){
				return self.execute(true, true, 'destroy').then(function () {
					self.$el.removeData('__FooTable__').removeClass('footable-' + self.id);
					if (F.is.hash(self.o.on)) self.$el.off(self.o.on);
					$(window).off('resize.ft'+self.id, self._onWindowResize);
					self.initialized = false;
					F.instances[self.id] = null;
				});
			}).fail(function(err){
				if (F.is.error(err)){
					console.error('FooTable: unhandled error thrown while destroying the plugin.', err);
				}
			});
		},
		/**
		 * Raises an event on this instance supplying the args array as additional parameters to the handlers.
		 * @this FooTable.Table
		 * @instance
		 * @param {string} eventName - The name of the event to raise, this can include namespaces.
		 * @param {Array} [args] - An array containing additional parameters to be passed to any bound handlers.
		 * @returns {jQuery.Event}
		 */
		raise: function(eventName, args){
			var self = this,
				debug = F.__debug__ &amp;&amp; (F.is.emptyArray(F.__debug_options__.events) || F.arr.any(F.__debug_options__.events, function(name){ return F.str.contains(eventName, name); }));
			args = args || [];
			args.unshift(this);
			return $.Deferred(function(d){
				var evt = $.Event(eventName);
				if (self.o.stopPropagation == true){
					self.$el.one(eventName, function (e) {e.stopPropagation();});
				}
				if (debug) console.log('FooTable:'+eventName+': ', args);
				self.$el.trigger(evt, args);
				if (evt.isDefaultPrevented()){
					if (debug) console.log('FooTable: default prevented for the "'+eventName+'" event.');
					d.reject(evt);
				}	else d.resolve(evt);
			});
		},
		/**
		 * Attempts to retrieve the instance of the supplied component type for this instance.
		 * @this FooTable.Table
		 * @instance
		 * @param {object} type - The content type to retrieve for this instance.
		 * @returns {(*|null)}
		 */
		use: function(type){
			for (var i = 0, len = this.components.length; i &lt; len; i++){
				if (this.components[i] instanceof type) return this.components[i];
			}
			return null;
		},
		/**
		 * Performs the drawing of the table.
		 * @this FooTable.Table
		 * @instance
		 * @protected
		 * @returns {jQuery.Promise}
		 * @fires FooTable.Table#"predraw.ft.table"
		 * @fires FooTable.Table#"draw.ft.table"
		 * @fires FooTable.Table#"postdraw.ft.table"
		 */
		draw: function () {
			var self = this;

			// Clone the current table and insert it into the original's place
			var $elCopy = self.$el.clone().insertBefore(self.$el);

			// Detach `self.$el` from the DOM, retaining its event handlers
			self.$el.detach();

			// when drawing the order that the components are executed is important so chain the methods but use promises to retain async safety.
			return self.execute(false, true, 'predraw').then(function(){
				/**
				 * The predraw.ft.table event is raised after all core components and add-ons have executed there predraw functions but before they execute there draw functions.
				 * @event FooTable.Table#"predraw.ft.table"
				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
				 */
				return self.raise('predraw.ft.table').then(function(){
					return self.execute(false, true, 'draw').then(function(){
						/**
						 * The draw.ft.table event is raised after all core components and add-ons have executed there draw functions.
						 * @event FooTable.Table#"draw.ft.table"
						 * @param {jQuery.Event} e - The jQuery.Event object for the event.
						 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
						 */
						return self.raise('draw.ft.table').then(function(){
							return self.execute(false, true, 'postdraw').then(function(){
								/**
								 * The postdraw.ft.table event is raised after all core components and add-ons have executed there postdraw functions.
								 * @event FooTable.Table#"postdraw.ft.table"
								 * @param {jQuery.Event} e - The jQuery.Event object for the event.
								 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
								 */
								return self.raise('postdraw.ft.table');
							});
						});
					});
				});
			}).fail(function(err){
				if (F.is.error(err)){
					console.error('FooTable: unhandled error thrown during a draw operation.', err);
				}
			}).always(function(){
				// Replace the copy that we added above with the modified `self.$el`
				$elCopy.replaceWith(self.$el);
				self.$loader.remove();
			});
		},
		/**
		 * Executes the specified method with the optional number of parameters on all components and waits for the promise from each to be resolved before executing the next.
		 * @this FooTable.Table
		 * @instance
		 * @protected
		 * @param {boolean} reverse - Whether or not to execute the component methods in the reverse order to what they were registered in.
		 * @param {boolean} enabled - Whether or not to execute the method on enabled components only.
		 * @param {string} methodName - The name of the method to execute.
		 * @param {*} [param1] - The first parameter for the method.
		 * @param {...*} [paramN] - Any number of additional parameters for the method.
		 * @returns {jQuery.Promise}
		 */
		execute: function(reverse, enabled, methodName, param1, paramN){
			var self = this, args = Array.prototype.slice.call(arguments);
			reverse = args.shift();
			enabled = args.shift();
			var components = enabled ? F.arr.get(self.components, function(c){ return c.enabled; }) : self.components.slice(0);
			args.unshift(reverse ? components.reverse() : components);
			return self._execute.apply(self, args);
		},
		/**
		 * Executes the specified method with the optional number of parameters on all supplied components waiting for the result of each before executing the next.
		 * @this FooTable.Table
		 * @instance
		 * @private
		 * @param {Array.&lt;FooTable.Component&gt;} components - The components to call the method on.
		 * @param {string} methodName - The name of the method to execute
		 * @param {*} [param1] - The first parameter for the method.
		 * @param {...*} [paramN] - Any additional parameters for the method.
		 * @returns {jQuery.Promise}
		 */
		_execute: function(components, methodName, param1, paramN){
			if (!components || !components.length) return $.when();
			var self = this, args = Array.prototype.slice.call(arguments),
				component;
			components = args.shift();
			methodName = args.shift();
			component = components.shift();

			if (!F.is.fn(component[methodName]))
				return self._execute.apply(self, [components, methodName].concat(args));

			return $.Deferred(function(d){
				try {
					var result = component[methodName].apply(component, args);
					if (F.is.promise(result)){
						return result.then(d.resolve, d.reject);
					} else {
						d.resolve(result);
					}
				} catch (err) {
					d.reject(err);
				}
			}).then(function(){
				return self._execute.apply(self, [components, methodName].concat(args));
			});
		},
		/**
		 * Listens to the window resize event and performs a check to see if the breakpoint has changed.
		 * @this window
		 * @instance
		 * @private
		 * @fires FooTable.Table#"resize.ft.table"
		 */
		_onWindowResize: function (e) {
			var self = e.data.self;
			if (self._resizeTimeout != null) { clearTimeout(self._resizeTimeout); }
			self._resizeTimeout = setTimeout(function () {
				self._resizeTimeout = null;
				/**
				 * The resize event is raised a short time after window resize operations cease.
				 * @event FooTable.Table#"resize.ft.table"
				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
				 */
				self.raise('resize.ft.table').then(function(){
					self.breakpoints.check();
				});
			}, 300);
		}
	});

})(jQuery, FooTable);
(function($, F){

	F.ArrayColumn = F.Column.extend(/** @lends FooTable.ArrayColumn */{
		/**
		 * @summary A column to handle Array values.
		 * @constructs
		 * @extends FooTable.Column
		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
		 * @param {object} definition - An object containing all the properties to set for the column.
		 */
		construct: function(instance, definition) {
			this._super(instance, definition, 'array');
		},
		/**
		 * @summary Parses the supplied value or element to retrieve a column value.
		 * @description This is supplied either the cell value or jQuery object to parse. This method will return either the Array containing the values or null.
		 * @instance
		 * @protected
		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
		 * @returns {(array|null)}
		 */
		parser: function(valueOrElement){
			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){ // use jQuery to get the value
				var $el = $(valueOrElement), data = $el.data('value'); // .data() will automatically convert a JSON string to an array
				if (F.is.array(data)) return data;
				data = $el.html();
				try {
					data = JSON.parse(data);
				} catch(err) {
					data = null;
				}
				return F.is.array(data) ? data : null; // if we have an array return it
			}
			if (F.is.array(valueOrElement)) return valueOrElement; // if we have an array return it
			return null; // otherwise we have no value so return null
		},
		/**
		 * @summary Formats the column value and creates the HTML seen within a cell.
		 * @description This is supplied the value retrieved from the {@link FooTable.ArrayColumn#parser} function and must return a string, HTMLElement or jQuery object.
		 * The return value from this function is what is displayed in the cell in the table.
		 * @instance
		 * @protected
		 * @param {?Array} value - The value to format.
		 * @param {object} options - The current plugin options.
		 * @param {object} rowData - An object containing the current row data.
		 * @returns {(string|HTMLElement|jQuery)}
		 */
		formatter: function(value, options, rowData){
			return F.is.array(value) ? JSON.stringify(value) : '';
		}
	});

	F.columns.register('array', F.ArrayColumn);

})(jQuery, FooTable);
(function($, F){

	if (F.is.undef(window.moment)){
		// The DateColumn requires moment.js to parse and format date values. Goto http://momentjs.com/ to get it.
		return;
	}

	F.DateColumn = F.Column.extend(/** @lends FooTable.DateColumn */{
		/**
		 * The date column class is used to handle date values. This column is dependent on [moment.js]{@link http://momentjs.com/} to provide date parsing and formatting functionality.
		 * @constructs
		 * @extends FooTable.Column
		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
		 * @param {object} definition - An object containing all the properties to set for the column.
		 * @returns {FooTable.DateColumn}
		 */
		construct: function(instance, definition){
			this._super(instance, definition, 'date');
			/**
			 * The format string to use when parsing and formatting dates.
			 * @instance
			 * @type {string}
			 */
			this.formatString = F.is.string(definition.formatString) ? definition.formatString : 'MM-DD-YYYY';
		},
		/**
		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and will be provided to the {@link FooTable.DateColumn#format} function
		 * to generate the cell contents.
		 * @instance
		 * @protected
		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
		 * @returns {(moment|null)}
		 * @this FooTable.DateColumn
		 */
		parser: function(valueOrElement){
			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
				var data = $(valueOrElement).data('value');
				valueOrElement = F.is.defined(data) ? data : $(valueOrElement).text();
				if (F.is.string(valueOrElement)) valueOrElement = isNaN(valueOrElement) ? valueOrElement : +valueOrElement;
			}
			if (F.is.date(valueOrElement)) return moment(valueOrElement);
			if (F.is.object(valueOrElement) &amp;&amp; F.is.boolean(valueOrElement._isAMomentObject)) return valueOrElement;
			if (F.is.string(valueOrElement)){
				// if it looks like a number convert it and do nothing else otherwise create a new moment using the string value and formatString
				if (isNaN(valueOrElement)){
					return moment(valueOrElement, this.formatString);
				} else {
					valueOrElement = +valueOrElement;
				}
			}
			if (F.is.number(valueOrElement)){
				return moment(valueOrElement);
			}
			return null;
		},
		/**
		 * This is supplied the value retrieved from the {@link FooTable.DateColumn#parser} function and must return a string, HTMLElement or jQuery object.
		 * The return value from this function is what is displayed in the cell in the table.
		 * @instance
		 * @protected
		 * @param {*} value - The value to format.
		 * @param {object} options - The current plugin options.
		 * @param {object} rowData - An object containing the current row data.
		 * @returns {(string|HTMLElement|jQuery)}
		 * @this FooTable.DateColumn
		 */
		formatter: function(value, options, rowData){
			return F.is.object(value) &amp;&amp; F.is.boolean(value._isAMomentObject) &amp;&amp; value.isValid() ? value.format(this.formatString) : '';
		},
		/**
		 * This is supplied either the cell value or jQuery object to parse. A string value must be returned from this method and will be used during filtering operations.
		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
		 * @returns {string}
		 * @this FooTable.DateColumn
		 */
		filterValue: function(valueOrElement){
			// if we have an element or a jQuery object use jQuery to get the value
			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)) valueOrElement = $(valueOrElement).data('filterValue') || $(valueOrElement).text();
			// if options are supplied with the value
			if (F.is.hash(valueOrElement) &amp;&amp; F.is.hash(valueOrElement.options)){
				if (F.is.string(valueOrElement.options.filterValue)) valueOrElement = valueOrElement.options.filterValue;
				if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
			}
			// if the value is a moment object just return the formatted value
			if (F.is.object(valueOrElement) &amp;&amp; F.is.boolean(valueOrElement._isAMomentObject)) return valueOrElement.format(this.formatString);
			// if its a string
			if (F.is.string(valueOrElement)){
				// if its not a number return it
				if (isNaN(valueOrElement)){
					return valueOrElement;
				} else { // otherwise convert it and carry on
					valueOrElement = +valueOrElement;
				}
			}
			// if the value is a number or date convert to a moment object and return the formatted result.
			if (F.is.number(valueOrElement) || F.is.date(valueOrElement)){
				return moment(valueOrElement).format(this.formatString);
			}
			// try use the native toString of the value if its not undefined or null
			if (F.is.defined(valueOrElement) &amp;&amp; valueOrElement != null) return valueOrElement+'';
			return ''; // otherwise we have no value so return an empty string
		}
	});

	F.columns.register('date', F.DateColumn);

})(jQuery, FooTable);

(function($, F){

	F.HTMLColumn = F.Column.extend(/** @lends FooTable.HTMLColumn */{
		/**
		 * The HTML column class is used to handle any raw HTML columns.
		 * @constructs
		 * @extends FooTable.Column
		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
		 * @param {object} definition - An object containing all the properties to set for the column.
		 * @returns {FooTable.HTMLColumn}
		 */
		construct: function(instance, definition){
			this._super(instance, definition, 'html');
		},
		/**
		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and will be provided to the {@link FooTable.HTMLColumn#format} function
		 * to generate the cell contents.
		 * @instance
		 * @protected
		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
		 * @returns {(jQuery|null)}
		 * @this FooTable.HTMLColumn
		 */
		parser: function(valueOrElement){
			if (F.is.string(valueOrElement)) valueOrElement = $($.trim(valueOrElement));
			if (F.is.element(valueOrElement)) valueOrElement = $(valueOrElement);
			if (F.is.jq(valueOrElement)){
				var tagName = valueOrElement.prop('tagName').toLowerCase();
				if (tagName == 'td' || tagName == 'th'){
					var data = valueOrElement.data('value');
					return F.is.defined(data) ? data : valueOrElement.contents();
				}
				return valueOrElement;
			}
			return null;
		}
	});

	F.columns.register('html', F.HTMLColumn);

})(jQuery, FooTable);
(function($, F){

	F.NumberColumn = F.Column.extend(/** @lends FooTable.NumberColumn */{
		/**
		 * The number column class is used to handle simple number columns.
		 * @constructs
		 * @extends FooTable.Column
		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
		 * @param {object} definition - An object containing all the properties to set for the column.
		 * @returns {FooTable.NumberColumn}
		 */
		construct: function(instance, definition){
			this._super(instance, definition, 'number');
			this.decimalSeparator = F.is.string(definition.decimalSeparator) ? definition.decimalSeparator : '.';
			this.thousandSeparator = F.is.string(definition.thousandSeparator) ? definition.thousandSeparator : ',';
			this.decimalSeparatorRegex = new RegExp(F.str.escapeRegExp(this.decimalSeparator), 'g');
			this.thousandSeparatorRegex = new RegExp(F.str.escapeRegExp(this.thousandSeparator), 'g');
			this.cleanRegex = new RegExp('[^\-0-9' + F.str.escapeRegExp(this.decimalSeparator) + ']', 'g');
		},
		/**
		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and will be provided to the {@link FooTable.Column#formatter} function
		 * to generate the cell contents.
		 * @instance
		 * @protected
		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
		 * @returns {(number|null)}
		 * @this FooTable.NumberColumn
		 */
		parser: function(valueOrElement){
			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
				var data = $(valueOrElement).data('value');
				valueOrElement = F.is.defined(data) ? data : $(valueOrElement).text().replace(this.cleanRegex, '');
			}
			if (F.is.string(valueOrElement)){
				valueOrElement = valueOrElement.replace(this.thousandSeparatorRegex, '').replace(this.decimalSeparatorRegex, '.');
				valueOrElement = parseFloat(valueOrElement);
			}
			if (F.is.number(valueOrElement)) return valueOrElement;
			return null;
		},
		/**
		 * This is supplied the value retrieved from the {@link FooTable.NumberColumn#parse} function and must return a string, HTMLElement or jQuery object.
		 * The return value from this function is what is displayed in the cell in the table.
		 * @instance
		 * @protected
		 * @param {number} value - The value to format.
		 * @param {object} options - The current plugin options.
		 * @param {object} rowData - An object containing the current row data.
		 * @returns {(string|HTMLElement|jQuery)}
		 * @this FooTable.NumberColumn
		 */
		formatter: function(value, options, rowData){
			if (value == null) return '';
			var s = (value + '').split('.');
			if (s.length == 2 &amp;&amp; s[0].length &gt; 3) {
				s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, this.thousandSeparator);
			}
			return s.join(this.decimalSeparator);
		}
	});

	F.columns.register('number', F.NumberColumn);

})(jQuery, FooTable);
(function($, F){

	F.ObjectColumn = F.Column.extend(/** @lends FooTable.ObjectColumn */{
		/**
		 * @summary A column to handle Object values.
		 * @constructs
		 * @extends FooTable.Column
		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
		 * @param {object} definition - An object containing all the properties to set for the column.
		 */
		construct: function(instance, definition) {
			this._super(instance, definition, 'object');
		},
		/**
		 * @summary Parses the supplied value or element to retrieve a column value.
		 * @description This is supplied either the cell value or jQuery object to parse. This method will return either the Object containing the values or null.
		 * @instance
		 * @protected
		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
		 * @returns {(object|null)}
		 */
		parser: function(valueOrElement){
			if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){ // use jQuery to get the value
				var $el = $(valueOrElement), data = $el.data('value'); // .data() will automatically convert a JSON string to an object
				if (F.is.object(data)) return data;
				data = $el.html();
				try {
					data = JSON.parse(data);
				} catch(err) {
					data = null;
				}
				return F.is.object(data) ? data : null; // if we have an object return it
			}
			if (F.is.object(valueOrElement)) return valueOrElement; // if we have an object return it
			return null; // otherwise we have no value so return null
		},
		/**
		 * @summary Formats the column value and creates the HTML seen within a cell.
		 * @description This is supplied the value retrieved from the {@link FooTable.ObjectColumn#parser} function and must return a string, HTMLElement or jQuery object.
		 * The return value from this function is what is displayed in the cell in the table.
		 * @instance
		 * @protected
		 * @param {*} value - The value to format.
		 * @param {object} options - The current plugin options.
		 * @param {object} rowData - An object containing the current row data.
		 * @returns {(string|HTMLElement|jQuery)}
		 */
		formatter: function(value, options, rowData){
			return F.is.object(value) ? JSON.stringify(value) : '';
		}
	});

	F.columns.register('object', F.ObjectColumn);

})(jQuery, FooTable);
(function($, F){

	F.Breakpoint = F.Class.extend(/** @lends FooTable.Breakpoint */{
		/**
		 * The breakpoint class containing the name and maximum width for the breakpoint.
		 * @constructs
		 * @extends FooTable.Class
		 * @param {string} name - The name of the breakpoint. Must contain no spaces or special characters.
		 * @param {number} width - The width of the breakpoint in pixels.
		 * @returns {FooTable.Breakpoint}
		 */
		construct: function(name, width){
			/**
			 * The name of the breakpoint.
			 * @type {string}
			 */
			this.name = name;
			/**
			 * The maximum width of the breakpoint in pixels.
			 * @type {number}
			 */
			this.width = width;
		}
	});

})(jQuery, FooTable);
(function($, F){
	F.Breakpoints = F.Component.extend(/** @lends FooTable.Breakpoints */{
		/**
		 * Contains the logic to calculate and apply breakpoints for the plugin.
		 * @constructs
		 * @extends FooTable.Component
		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
		 * @returns {FooTable.Breakpoints}
		 */
		construct: function(table){
			// call the base class constructor
			this._super(table, true);

			/* PROTECTED */
			/**
			 * This provides a shortcut to the {@link FooTable.Table#options} object.
			 * @protected
			 * @type {FooTable.Table#options}
			 */
			this.o = table.o;

			/* PUBLIC */
			/**
			 * The current breakpoint.
			 * @type {FooTable.Breakpoint}
			 */
			this.current = null;
			/**
			 * An array of {@link FooTable.Breakpoint} objects created from parsing the options.
			 * @type {Array.&lt;FooTable.Breakpoint&gt;}
			 */
			this.array = [];
			/**
			 * Whether or not breakpoints cascade. When set to true all breakpoints larger than the current will be hidden along with it.
			 * @type {boolean}
			 */
			this.cascade = this.o.cascade;
			/**
			 * Whether or not to calculate breakpoints on the width of the parent element rather than the viewport.
			 * @type {boolean}
			 */
			this.useParentWidth = this.o.useParentWidth;
			/**
			 * This value is updated each time the current breakpoint changes and contains a space delimited string of the names of the current breakpoint and all those smaller than it.
			 * @type {string}
			 */
			this.hidden = null;

			/* PRIVATE */
			/**
			 * This value is set once when the {@link FooTable.Breakpoints#array} is generated and contains a space delimited string of all the breakpoint class names.
			 * @type {string}
			 * @private
			 */
			this._classNames = '';

			// check if a function was supplied to override the default getWidth
			this.getWidth = F.checkFnValue(this, this.o.getWidth, this.getWidth);
		},

		/* PROTECTED */
		/**
		 * Checks the supplied data and options for the breakpoints component.
		 * @instance
		 * @protected
		 * @param {object} data - The jQuery data object from the parent table.
		 * @fires FooTable.Breakpoints#"preinit.ft.breakpoints"
		 */
		preinit: function(data){
			var self = this;
			/**
			 * The preinit.ft.breakpoints event is raised before any UI is created and provides the tables jQuery data object for additional options parsing.
			 * Calling preventDefault on this event will disable the entire plugin.
			 * @event FooTable.Breakpoints#"preinit.ft.breakpoints"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {object} data - The jQuery data object of the table raising the event.
			 */
			return this.ft.raise('preinit.ft.breakpoints', [data]).then(function(){
				self.cascade = F.is.boolean(data.cascade) ? data.cascade : self.cascade;
				self.o.breakpoints = F.is.hash(data.breakpoints) ? data.breakpoints : self.o.breakpoints;
				self.getWidth = F.checkFnValue(self, data.getWidth, self.getWidth);
				if (self.o.breakpoints == null) self.o.breakpoints = { "xs": 480, "sm": 768, "md": 992, "lg": 1200 };
				// Create a nice friendly array to work with out of the breakpoints object.
				for (var name in self.o.breakpoints) {
					if (!self.o.breakpoints.hasOwnProperty(name)) continue;
					self.array.push(new F.Breakpoint(name, self.o.breakpoints[name]));
					self._classNames += 'breakpoint-' + name + ' ';
				}
				// Sort the breakpoints so the largest is checked first
				self.array.sort(function (a, b) {
					return b.width - a.width;
				});
			});
		},
		/**
		 * Initializes the class parsing the options into a sorted array of {@link FooTable.Breakpoint} objects.
		 * @instance
		 * @protected
		 * @fires FooTable.Breakpoints#"init.ft.breakpoints"
		 */
		init: function(){
			var self = this;
			/**
			 * The init.ft.breakpoints event is raised before any UI is generated.
			 * Calling preventDefault on this event will disable the entire plugin.
			 * @event FooTable.Breakpoints#"init.ft.breakpoints"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			return this.ft.raise('init.ft.breakpoints').then(function(){
				self.current = self.get();
			});
		},
		/**
		 * Whenever the table is drawn this ensures the correct breakpoint class is applied to the table.
		 * @instance
		 * @protected
		 */
		draw: function(){
			this.ft.$el.removeClass(this._classNames).addClass('breakpoint-' + this.current.name);
		},

		/* PUBLIC */
		/**
		 * Calculates the current breakpoint from the {@link FooTable.Breakpoints#array} and sets the {@link FooTable.Breakpoints#current} property.
		 * @instance
		 * @returns {FooTable.Breakpoint}
		 */
		calculate: function(){
			var self = this, current = null, hidden = [], breakpoint, prev = null, width = self.getWidth();
			for (var i = 0, len = self.array.length; i &lt; len; i++) {
				breakpoint = self.array[i];
				// if the width is smaller than the smallest breakpoint set the smallest as the current.
				// if the width is larger than the largest breakpoint set the largest as the current.
				// otherwise if the width is somewhere in between check all breakpoints testing if the width
				// is greater than the current but smaller than the previous.
				if ((!current &amp;&amp; i == len -1)
					|| (width &gt;= breakpoint.width &amp;&amp; (prev instanceof F.Breakpoint ? width &lt; prev.width : true))) {
					current = breakpoint;
				}
				if (!current) hidden.push(breakpoint.name);
				prev = breakpoint;
			}
			hidden.push(current.name);
			self.hidden = hidden.join(' ');
			return current;
		},
		/**
		 * Supplied a columns breakpoints this returns a boolean value indicating whether or not the column is visible.
		 * @param {string} breakpoints - A space separated string of breakpoint names.
		 * @returns {boolean}
		 */
		visible: function(breakpoints){
			if (F.is.emptyString(breakpoints)) return true;
			if (breakpoints === 'all') return false;
			var parts = breakpoints.split(' '), i = 0, len = parts.length;
			for (; i &lt; len; i++){
				if (this.cascade ? F.str.containsWord(this.hidden, parts[i]) : parts[i] == this.current.name) return false;
			}
			return true;
		},
		/**
		 * Performs a check between the current breakpoint and the previous breakpoint and performs a redraw if they differ.
		 * @instance
		 * @fires FooTable.Breakpoints#"before.ft.breakpoints"
		 * @fires FooTable.Breakpoints#"after.ft.breakpoints"
		 */
		check: function(){
			var self = this, bp = self.get();
			if (!(bp instanceof F.Breakpoint)
				|| bp == self.current)
				return;

			/**
			 * The before.ft.breakpoints event is raised if the breakpoint has changed but before the UI is redrawn and is supplied both the current breakpoint
			 * and the next "new" one that is about to be applied.
			 * Calling preventDefault on this event will prevent the next breakpoint from being applied.
			 * @event FooTable.Breakpoints#"before.ft.breakpoints"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {FooTable.Breakpoint} current - The current breakpoint.
			 * @param {FooTable.Breakpoint} next - The breakpoint that is about to be applied.
			 */
			self.ft.raise('before.ft.breakpoints', [self.current, bp]).then(function(){
				var previous = self.current;
				self.current = bp;
				return self.ft.draw().then(function(){
					/**
					 * The after.ft.breakpoints event is raised after the breakpoint has changed and the UI is redrawn and is supplied both the "new" current breakpoint
					 * and the previous one that was replaced.
					 * @event FooTable.Breakpoints#"after.ft.breakpoints"
					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
					 * @param {FooTable.Breakpoint} current - The current breakpoint.
					 * @param {FooTable.Breakpoint} previous - The breakpoint that was just replaced.
					 */
					self.ft.raise('after.ft.breakpoints', [self.current, previous]);
				});
			});
		},
		/**
		 * Attempts to return a {@link FooTable.Breakpoint} instance when passed a {@link FooTable.Breakpoint},
		 * the {@link FooTable.Breakpoint#name} string or if nothing is supplied the current breakpoint.
		 * @instance
		 * @param {(FooTable.Breakpoint|string|number)} [breakpoint] - The breakpoint to retrieve.
		 * @returns {FooTable.Breakpoint}
		 */
		get: function(breakpoint){
			if (F.is.undef(breakpoint)) return this.calculate();
			if (breakpoint instanceof F.Breakpoint) return breakpoint;
			if (F.is.string(breakpoint)) return F.arr.first(this.array, function (bp) { return bp.name == breakpoint; });
			if (F.is.number(breakpoint)) return breakpoint &gt;= 0 &amp;&amp; breakpoint &lt; this.array.length ? this.array[breakpoint] : null;
			return null;
		},
		/**
		 * Gets the width used to determine breakpoints whether it be from the viewport, parent or a custom function.
		 * @instance
		 * @returns {number}
		 */
		getWidth: function(){
			if (F.is.fn(this.o.getWidth)) return this.o.getWidth(this.ft);
			if (this.useParentWidth == true) return this.getParentWidth();
			return this.getViewportWidth();
		},
		/**
		 * Gets the tables direct parents width.
		 * @instance
		 * @returns {number}
		 */
		getParentWidth: function(){
			return this.ft.$el.parent().width();
		},
		/**
		 * Gets the current viewport width.
		 * @instance
		 * @returns {number}
		 */
		getViewportWidth: function(){
			return Math.max(document.documentElement.clientWidth, window.innerWidth, 0);
		}
	});

	F.components.register('breakpoints', F.Breakpoints, 1000);

})(jQuery, FooTable);
(function(F){
	/**
	 * A space delimited string of breakpoint names that specify when the column will be hidden. You can also specify "all" to make a column permanently display in an expandable detail row.
	 * @type {string}
	 * @default null
	 * @example &lt;caption&gt;The below shows how this value would be set&lt;/caption&gt;
	 * breakpoints: "md"
	 */
	F.Column.prototype.breakpoints = null;

	F.Column.prototype.__breakpoints_define__ = function(definition){
		this.breakpoints = F.is.emptyString(definition.breakpoints) ? null : definition.breakpoints;
	};

	F.Column.extend('define', function(definition){
		this._super(definition);
		this.__breakpoints_define__(definition);
	});
})(FooTable);
(function(F){
	/**
	 * An object containing the breakpoints for the plugin.
	 * @type {object.&lt;string, number&gt;}
	 * @default { "xs": 480, "sm": 768, "md": 992, "lg": 1200 }
	 */
	F.Defaults.prototype.breakpoints = null;

	/**
	 * Whether or not breakpoints cascade. When set to true all breakpoints larger than the current will also be hidden along with it.
	 * @type {boolean}
	 * @default false
	 */
	F.Defaults.prototype.cascade = false;

	/**
	 * Whether or not to calculate breakpoints on the width of the parent element rather than the viewport.
	 * @type {boolean}
	 * @default false
	 */
	F.Defaults.prototype.useParentWidth = false;

	/**
	 * A function used to override the default getWidth function with a custom one.
	 * @type {function}
	 * @default null
	 * @example &lt;caption&gt;The below shows what the default getWidth function would look like.&lt;/caption&gt;
	 * getWidth: function(instance){
	 * 	if (instance.o.useParentWidth == true) return instance.$el.parent().width();
	 * 	return instance.breakpoints.getViewportWidth();
	 * }
	 */
	F.Defaults.prototype.getWidth = null;
})(FooTable);
(function($, F){
	F.Columns = F.Component.extend(/** @lends FooTable.Columns */{
		/**
		 * The columns class contains all the logic for handling columns.
		 * @constructs
		 * @extends FooTable.Component
		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
		 * @returns {FooTable.Columns}
		 */
		construct: function(table){
			// call the base class constructor
			this._super(table, true);

			/* PROTECTED */
			/**
			 * This provides a shortcut to the {@link FooTable.Table#options} object.
			 * @protected
			 * @type {FooTable.Table#options}
			 */
			this.o = table.o;

			/* PUBLIC */
			/**
			 * An array of {@link FooTable.Column} objects created from parsing the options and/or DOM.
			 * @type {Array.&lt;FooTable.Column&gt;}
			 */
			this.array = [];
			/**
			 * The jQuery header row object.
			 * @type {jQuery}
			 */
			this.$header = null;
			/**
			 * Whether or not to display the header row.
			 * @type {boolean}
			 */
			this.showHeader = table.o.showHeader;

			this._fromHTML = F.is.emptyArray(table.o.columns) &amp;&amp; !F.is.promise(table.o.columns);
		},

		/* PROTECTED */
		/**
		 * This parses the columns from either the tables rows or the supplied options.
		 * @instance
		 * @protected
		 * @param {object} data - The tables jQuery data object.
		 * @returns {jQuery.Promise}
		 * @this FooTable.Columns
		 */
		parse: function(data){
			var self = this;
			return $.Deferred(function(d){
				function merge(cols1, cols2){
					var merged = [];
					// check if either of the arrays is empty as it can save us having to merge them by index.
					if (cols1.length == 0 || cols2.length == 0){
						merged = cols1.concat(cols2);
					} else {
						// at this point we have two arrays of column definitions, we now need to merge them based on there index properties
						// first figure out the highest column index provided so we can loop that many times to merge all columns and provide
						// defaults where nothing was specified (fill in the gaps in the array as it were).
						var highest = 0;
						F.arr.each(cols1.concat(cols2), function(c){
							if (c.index &gt; highest) highest = c.index;
						});
						highest++;
						for (var i = 0, cols1_c, cols2_c; i &lt; highest; i++){
							cols1_c = {};
							F.arr.each(cols1, function(c){
								if (c.index == i){
									cols1_c = c;
									return false;
								}
							});
							cols2_c = {};
							F.arr.each(cols2, function(c){
								if (c.index == i){
									cols2_c = c;
									return false;
								}
							});
							merged.push($.extend(true, {}, cols1_c, cols2_c));
						}
					}
					return merged;
				}

				var json = [], html = [];
				// get the column options from the content
				var $header = self.ft.$el.find('tr.footable-header, thead &gt; tr:last:has([data-breakpoints]), tbody &gt; tr:first:has([data-breakpoints]), thead &gt; tr:last, tbody &gt; tr:first').first(), $cell, cdata;
				if ($header.length &gt; 0){
					var virtual = $header.parent().is('tbody') &amp;&amp; $header.children().length == $header.children('td').length;
					if (!virtual) self.$header = $header.addClass('footable-header');
					$header.children('td,th').each(function(i, cell){
						$cell = $(cell);
						cdata = $cell.data();
						cdata.index = i;
						cdata.$el = $cell;
						cdata.virtual = virtual;
						html.push(cdata);
					});
					if (virtual) self.showHeader = false;
				}
				// get the supplied column options
				if (F.is.array(self.o.columns) &amp;&amp; !F.is.emptyArray(self.o.columns)){
					F.arr.each(self.o.columns, function(c, i){
						c.index = i;
						json.push(c);
					});
					self.parseFinalize(d, merge(json, html));
				} else if (F.is.promise(self.o.columns)){
					self.o.columns.then(function(cols){
						F.arr.each(cols, function(c, i){
							c.index = i;
							json.push(c);
						});
						self.parseFinalize(d, merge(json, html));
					}, function(xhr){
						d.reject(Error('Columns ajax request error: ' + xhr.status + ' (' + xhr.statusText + ')'));
					});
				} else {
					self.parseFinalize(d, merge(json, html));
				}
			});
		},
		/**
		 * Used to finalize the parsing of columns it is supplied the parse deferred object which must be resolved with an array of {@link FooTable.Column} objects
		 * or rejected with an error.
		 * @instance
		 * @protected
		 * @param {jQuery.Deferred} deferred - The deferred object used for parsing.
		 * @param {Array.&lt;object&gt;} cols - An array of all merged column definitions.
		 */
		parseFinalize: function(deferred, cols){
			// we now have a merged array of all column definitions supplied to the plugin, time to make the objects.
			var self = this, columns = [], column;
			F.arr.each(cols, function(def){
				// if we have a column registered using the definition type then create an instance of that column otherwise just create a default text column.
				if (column = F.columns.contains(def.type) ? F.columns.make(def.type, self.ft, def) : new F.Column(self.ft, def))
					columns.push(column);
			});
			if (F.is.emptyArray(columns)){
				deferred.reject(Error("No columns supplied."));
			} else {
				// make sure to sort by the column index as the merge process may have mixed them up
				columns.sort(function(a, b){ return a.index - b.index; });
				deferred.resolve(columns);
			}
		},
		/**
		 * The columns preinit method is used to parse and check the column options supplied from both static content and through the constructor.
		 * @instance
		 * @protected
		 * @param {object} data - The jQuery data object from the root table element.
		 * @this FooTable.Columns
		 */
		preinit: function(data){
			var self = this;
			/**
			 * The preinit.ft.columns event is raised before any UI is created and provides the tables jQuery data object for additional options parsing.
			 * Calling preventDefault on this event will disable the entire plugin.
			 * @event FooTable.Columns#"preinit.ft.columns"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {object} data - The jQuery data object of the table raising the event.
			 */
			return self.ft.raise('preinit.ft.columns', [data]).then(function(){
				return self.parse(data).then(function(columns){
					self.array = columns;
					self.showHeader = F.is.boolean(data.showHeader) ? data.showHeader : self.showHeader;
				});
			});
		},
		/**
		 * Initializes the columns creating the table header if required.
		 * @instance
		 * @protected
		 * @fires FooTable.Columns#"init.ft.columns"
		 * @this FooTable.Columns
		 */
		init: function(){
			var self = this;
			/**
			 * The init.ft.columns event is raised after the header row is created/parsed for column data.
			 * @event FooTable.Columns#"init.ft.columns"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} instance - The instance of the plugin raising the event.
			 * @param {Array.&lt;FooTable.Column&gt;} columns - The array of {@link FooTable.Column} objects parsed from the options and/or DOM.
			 */
			return this.ft.raise('init.ft.columns', [ self.array ]).then(function(){
				self.$create();
			});
		},
		/**
		 * Destroys the columns component removing any UI generated from the table.
		 * @instance
		 * @protected
		 * @fires FooTable.Columns#"destroy.ft.columns"
		 */
		destroy: function(){
			/**
			 * The destroy.ft.columns event is raised before its UI is removed.
			 * Calling preventDefault on this event will prevent the component from being destroyed.
			 * @event FooTable.Columns#"destroy.ft.columns"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			var self = this;
			this.ft.raise('destroy.ft.columns').then(function(){
				if (!self._fromHTML) self.$header.remove();
			});
		},
		/**
		 * The predraw method called from within the {@link FooTable.Table#draw} method.
		 * @instance
		 * @protected
		 * @this FooTable.Columns
		 */
		predraw: function(){
			var self = this, first = true;
			self.visibleColspan = 0;
			self.firstVisibleIndex = 0;
			self.lastVisibleIndex = 0;
			self.hasHidden = false;
			F.arr.each(self.array, function(col){
				col.hidden = !self.ft.breakpoints.visible(col.breakpoints);
				if (!col.hidden &amp;&amp; col.visible){
					if (first){
						self.firstVisibleIndex = col.index;
						first = false;
					}
					self.lastVisibleIndex = col.index;
					self.visibleColspan++;
				}
				if (col.hidden) self.hasHidden = true;
			});
			self.ft.$el.toggleClass('breakpoint', self.hasHidden);
		},
		/**
		 * Performs the actual drawing of the columns, hiding or displaying them depending on there breakpoints.
		 * @instance
		 * @protected
		 * @this FooTable.Columns
		 */
		draw: function(){
			F.arr.each(this.array, function(col){
				col.$el.css('display', (col.hidden || !col.visible  ? 'none' : 'table-cell'));
			});
			if (!this.showHeader &amp;&amp; F.is.jq(this.$header.parent())){
				this.$header.detach();
			}
		},
		/**
		 * Creates the header row for the table from the parsed column definitions.
		 * @instance
		 * @protected
		 * @this FooTable.Columns
		 */
		$create: function(){
			var self = this;
			self.$header = F.is.jq(self.$header) ? self.$header : $('&lt;tr/&gt;', {'class': 'footable-header'});
			self.$header.children('th,td').detach();
			F.arr.each(self.array, function(col){
				self.$header.append(col.$el);
			});
			if (self.showHeader &amp;&amp; !F.is.jq(self.$header.parent())){
				self.ft.$el.children('thead').append(self.$header);
			}
		},
		/**
		 * Attempts to return a {@link FooTable.Column} instance when passed the {@link FooTable.Column} instance, the {@link FooTable.Column#name} string or the {@link FooTable.Column#index} number.
		 * If supplied a function this will return an array by iterating all columns passing the index and column itself to the supplied callback as arguments.
		 * Returning true in the callback will include the column in the result.
		 * @instance
		 * @param {(FooTable.Column|string|number|function)} column - The column to retrieve.
		 * @returns {(Array.&lt;FooTable.Column&gt;|FooTable.Column|null)} The column if one is found otherwise it returns NULL.
		 * @example &lt;caption&gt;This example shows retrieving a column by name assuming a column called "id" exists. The &lt;code&gt;columns&lt;/code&gt; object is an instance of {@link FooTable.Columns}.&lt;/caption&gt;
		 * var column = columns.get('id');
		 * if (column instanceof FooTable.Column){
		 * 	// found the "id" column
		 * } else {
		 * 	// no column with a name of "id" exists
		 * }
		 * // to get an array of all hidden columns
		 * var columns = columns.get(function(col){
		 *  return col.hidden;
		 * });
		 */
		get: function(column){
			if (column instanceof F.Column) return column;
			if (F.is.string(column)) return F.arr.first(this.array, function (col) { return col.name == column; });
			if (F.is.number(column)) return F.arr.first(this.array, function (col) { return col.index == column; });
			if (F.is.fn(column)) return F.arr.get(this.array, column);
			return null;
		},
		/**
		 * Takes an array of column names, index's or actual {@link FooTable.Column} and ensures that an array of only {@link FooTable.Column} is returned.
		 * @instance
		 * @param {(Array.&lt;string&gt;|Array.&lt;number&gt;|Array.&lt;FooTable.Column&gt;)} columns - The array of column names, index's or {@link FooTable.Column} to check.
		 * @returns {Array.&lt;FooTable.Column&gt;}
		 */
		ensure: function(columns){
			var self = this, result = [];
			if (!F.is.array(columns)) return result;
			F.arr.each(columns, function(name){
				result.push(self.get(name));
			});
			return result;
		}
	});

	F.components.register('columns', F.Columns, 900);

})(jQuery, FooTable);
(function(F){
	/**
	 * An array containing the column options or a jQuery promise that resolves returning the columns. The index of the definitions must match the index of each column as it should appear in the table. For more information on the options available see the {@link FooTable.Column} object.
	 * @type {(Array.&lt;object&gt;|jQuery.Promise)}
	 * @default []
	 * @example &lt;caption&gt;The below shows column definitions for a row defined as &lt;code&gt;{ id: Number, name: String, age: Number }&lt;/code&gt;. The ID column has a fixed width, the table is initially sorted on the Name column and the Age column will be hidden on phones.&lt;/caption&gt;
	 * columns: [
	 * 	{ name: 'id', title: 'ID', type: 'number' },
	 *	{ name: 'name', title: 'Name', sorted: true, direction: 'ASC' }
	 *	{ name: 'age', title: 'Age', type: 'number', breakpoints: 'xs' }
	 * ]
	 */
	F.Defaults.prototype.columns = [];

	/**
	 * Specifies whether or not the column headers should be displayed.
	 * @type {boolean}
	 * @default true
	 */
	F.Defaults.prototype.showHeader = true;
})(FooTable);
(function ($, F) {
	F.Rows = F.Component.extend(/** @lends FooTable.Rows */{
		/**
		 * The rows class contains all the logic for handling rows.
		 * @constructs
		 * @extends FooTable.Component
		 * @param {FooTable.Table} table -  The parent {@link FooTable.Table} this component belongs to.
		 * @returns {FooTable.Rows}
		 */
		construct: function (table) {
			// call the base class constructor
			this._super(table, true);

			/**
			 * This provides a shortcut to the {@link FooTable.Table#options} object.
			 * @instance
			 * @protected
			 * @type {FooTable.Table#options}
			 */
			this.o = table.o;
			/**
			 * The current working array of {@link FooTable.Row} objects.
			 * @instance
			 * @protected
			 * @type {Array.&lt;FooTable.Row&gt;}
			 * @default []
			 */
			this.array = [];
			/**
			 * The base array of rows parsed from either the DOM or the constructor options.
			 * The {@link FooTable.Rows#current} member is populated with a shallow clone of this array
			 * during the predraw operation before any core or custom components are executed.
			 * @instance
			 * @protected
			 * @type {Array.&lt;FooTable.Row&gt;}
			 * @default []
			 */
			this.all = [];
			/**
			 * Whether or not to display a toggle in each row when it contains hidden columns.
			 * @type {boolean}
			 * @default true
			 */
			this.showToggle = table.o.showToggle;
			/**
			 * The CSS selector used to filter row click events. If the event.target property matches the selector the row will be toggled.
			 * @type {string}
			 * @default "tr,td,.footable-toggle"
			 */
			this.toggleSelector = table.o.toggleSelector;
			/**
			 * Specifies which column the row toggle is appended to. Supports only two values; "first" and "last"
			 * @type {string}
			 */
			this.toggleColumn = table.o.toggleColumn;
			/**
			 * The text to display when the table has no rows.
			 * @type {string}
			 */
			this.emptyString = table.o.empty;
			/**
			 * Whether or not the first rows details are expanded by default when displayed on a device that hides any columns.
			 * @type {boolean}
			 */
			this.expandFirst = table.o.expandFirst;
			/**
			 * Whether or not all row details are expanded by default when displayed on a device that hides any columns.
			 * @type {boolean}
			 */
			this.expandAll = table.o.expandAll;
			/**
			 * The jQuery object that contains the empty row control.
			 * @type {jQuery}
			 */
			this.$empty = null;
			this._fromHTML = F.is.emptyArray(table.o.rows) &amp;&amp; !F.is.promise(table.o.rows);
		},
		/**
		 * This parses the rows from either the tables rows or the supplied options.
		 * @instance
		 * @protected
		 * @returns {jQuery.Promise}
		 */
		parse: function(){
			var self = this;
			return $.Deferred(function(d){
				var $rows = self.ft.$el.children('tbody').children('tr');
				if (F.is.array(self.o.rows) &amp;&amp; self.o.rows.length &gt; 0){
					self.parseFinalize(d, self.o.rows);
				} else if (F.is.promise(self.o.rows)){
					self.o.rows.then(function(rows){
						self.parseFinalize(d, rows);
					}, function(xhr){
						d.reject(Error('Rows ajax request error: ' + xhr.status + ' (' + xhr.statusText + ')'));
					});
				} else if (F.is.jq($rows)){
					self.parseFinalize(d, $rows);
					$rows.detach();
				} else {
					self.parseFinalize(d, []);
				}
			});
		},
		/**
		 * Used to finalize the parsing of rows it is supplied the parse deferred object which must be resolved with an array of {@link FooTable.Row} objects
		 * or rejected with an error.
		 * @instance
		 * @protected
		 * @param {jQuery.Deferred} deferred - The deferred object used for parsing.
		 * @param {(Array.&lt;object&gt;|jQuery)} rows - An array of row values and options or the jQuery object containing all rows.
		 */
		parseFinalize: function(deferred, rows){
			var self = this, result = $.map(rows, function(r){
				return new F.Row(self.ft, self.ft.columns.array, r);
			});
			deferred.resolve(result);
		},
		/**
		 * The columns preinit method is used to parse and check the column options supplied from both static content and through the constructor.
		 * @instance
		 * @protected
		 * @param {object} data - The jQuery data object from the root table element.
		 * @fires FooTable.Rows#"preinit.ft.rows"
		 */
		preinit: function(data){
			var self = this;
			/**
			 * The preinit.ft.rows event is raised before any UI is created and provides the tables jQuery data object for additional options parsing.
			 * Calling preventDefault on this event will disable the entire plugin.
			 * @event FooTable.Rows#"preinit.ft.rows"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {object} data - The jQuery data object of the table raising the event.
			 */
			return self.ft.raise('preinit.ft.rows', [data]).then(function(){
				return self.parse().then(function(rows){
					self.all = rows;
					self.array = self.all.slice(0);
					self.showToggle = F.is.boolean(data.showToggle) ? data.showToggle : self.showToggle;
					self.toggleSelector = F.is.string(data.toggleSelector) ? data.toggleSelector : self.toggleSelector;
					self.toggleColumn = F.is.string(data.toggleColumn) ? data.toggleColumn : self.toggleColumn;
					if (self.toggleColumn != "first" &amp;&amp; self.toggleColumn != "last") self.toggleColumn = "first";
					self.emptyString = F.is.string(data.empty) ? data.empty : self.emptyString;
					self.expandFirst = F.is.boolean(data.expandFirst) ? data.expandFirst : self.expandFirst;
					self.expandAll = F.is.boolean(data.expandAll) ? data.expandAll : self.expandAll;
				});
			});
		},
		/**
		 * Initializes the rows class using the supplied table and options.
		 * @instance
		 * @protected
		 * @fires FooTable.Rows#"init.ft.rows"
		 */
		init: function () {
			var self = this;
			/**
			 * The init.ft.rows event is raised after the the rows are parsed from either the DOM or the options.
			 * Calling preventDefault on this event will disable the entire plugin.
			 * @event FooTable.Rows#"init.ft.rows"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} instance - The instance of the plugin raising the event.
			 * @param {Array.&lt;FooTable.Row&gt;} rows - The array of {@link FooTable.Row} objects parsed from the DOM or the options.
			 */
			return self.ft.raise('init.ft.rows', [self.all]).then(function(){
				self.$create();
			});
		},
		/**
		 * Destroys the rows component removing any UI generated from the table.
		 * @instance
		 * @protected
		 * @fires FooTable.Rows#"destroy.ft.rows"
		 */
		destroy: function(){
			/**
			 * The destroy.ft.rows event is raised before its UI is removed.
			 * Calling preventDefault on this event will prevent the component from being destroyed.
			 * @event FooTable.Rows#"destroy.ft.rows"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			var self = this;
			this.ft.raise('destroy.ft.rows').then(function(){
				F.arr.each(self.array, function(row){
					row.predraw(!self._fromHTML);
				});
				self.all = self.array = [];
			});
		},
		/**
		 * Performs the predraw operations that are required including creating the shallow clone of the {@link FooTable.Rows#array} to work with.
		 * @instance
		 * @protected
		 */
		predraw: function(){
			F.arr.each(this.array, function(row){
				row.predraw();
			});
			this.array = this.all.slice(0);
		},
		$create: function(){
			this.$empty = $('&lt;tr/&gt;', { 'class': 'footable-empty' }).append($('&lt;td/&gt;').text(this.emptyString));
		},
		/**
		 * Performs the actual drawing of the table rows.
		 * @instance
		 * @protected
		 */
		draw: function(){
			var self = this, $tbody = self.ft.$el.children('tbody'), first = true;
			// if we have rows
			if (self.array.length &gt; 0){
				self.$empty.detach();
				// loop through them appending to the tbody and then drawing
				F.arr.each(self.array, function(row){
					if ((self.expandFirst &amp;&amp; first) || self.expandAll){
						row.expanded = true;
						first = false;
					}
					row.draw($tbody);
				});
			} else {
				// otherwise display the $empty row
				self.$empty.children('td').attr('colspan', self.ft.columns.visibleColspan);
				$tbody.append(self.$empty);
			}
		},
		/**
		 * Loads a JSON array of row objects into the table
		 * @instance
		 * @param {Array.&lt;object&gt;} data - An array of row objects to load.
		 * @param {boolean} [append=false] - Whether or not to append the new rows to the current rows array or to replace them entirely.
		 */
		load: function(data, append){
			var self = this, rows = $.map(data, function(r){
				return new F.Row(self.ft, self.ft.columns.array, r);
			});
			F.arr.each(this.array, function(row){
				row.predraw();
			});
			this.all = (F.is.boolean(append) ? append : false) ? this.all.concat(rows) : rows;
			this.array = this.all.slice(0);
			this.ft.draw();
		},
		/**
		 * Expands all visible rows.
		 * @instance
		 */
		expand: function(){
			F.arr.each(this.array, function(row){
				row.expand();
			});
		},
		/**
		 * Collapses all visible rows.
		 * @instance
		 */
		collapse: function(){
			F.arr.each(this.array, function(row){
				row.collapse();
			});
		}
	});

	F.components.register('rows', F.Rows, 800);

})(jQuery, FooTable);
(function(F){
	/**
	 * An array of JSON objects containing the row data or a jQuery promise that resolves returning the row data.
	 * @type {(Array.&lt;object&gt;|jQuery.Promise)}
	 * @default []
	 */
	F.Defaults.prototype.rows = [];

	/**
	 * A string to display when there are no rows in the table.
	 * @type {string}
	 * @default "No results"
	 */
	F.Defaults.prototype.empty = 'No results';

	/**
	 * Whether or not the toggle is appended to each row.
	 * @type {boolean}
	 * @default true
	 */
	F.Defaults.prototype.showToggle = true;

	/**
	 * The CSS selector used to filter row click events. If the event.target property matches the selector the row will be toggled.
	 * @type {string}
	 * @default "tr,td,.footable-toggle"
	 */
	F.Defaults.prototype.toggleSelector = 'tr,td,.footable-toggle';

	/**
	 * Specifies which column to display the row toggle in. The only supported values are "first" or "last".
	 * @type {string}
	 * @default "first"
	 */
	F.Defaults.prototype.toggleColumn = 'first';

	/**
	 * Whether or not the first rows details are expanded by default when displayed on a device that hides any columns.
	 * @type {boolean}
	 */
	F.Defaults.prototype.expandFirst = false;

	/**
	 * Whether or not all row details are expanded by default when displayed on a device that hides any columns.
	 * @type {boolean}
	 */
	F.Defaults.prototype.expandAll = false;
})(FooTable);
(function(F){
	/**
	 * Loads a JSON array of row objects into the table
	 * @param {Array.&lt;object&gt;} data - An array of row objects to load.
	 * @param {boolean} [append=false] - Whether or not to append the new rows to the current rows array or to replace them entirely.
	 */
	F.Table.prototype.loadRows = function(data, append){
		this.rows.load(data, append);
	};
})(FooTable);
(function(F){
	F.Filter = F.Class.extend(/** @lends FooTable.Filter */{
		/**
		 * The filter object contains the query to filter by and the columns to apply it to.
		 * @constructs
		 * @extends FooTable.Class
		 * @param {string} name - The name for the filter.
		 * @param {(string|FooTable.Query)} query - The query for the filter.
		 * @param {Array.&lt;FooTable.Column&gt;} columns - The columns to apply the query to.
		 * @param {string} [space="AND"] - How the query treats space chars.
		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
		 * @param {boolean} [hidden=true] - Whether or not this is a hidden filter.
		 * @returns {FooTable.Filter}
		 */
		construct: function(name, query, columns, space, connectors, ignoreCase, hidden){
			/**
			 * The name of the filter.
			 * @instance
			 * @type {string}
			 */
			this.name = name;
			/**
			 * A string specifying how the filter treats space characters. Can be either "OR" or "AND".
			 * @instance
			 * @type {string}
			 */
			this.space = F.is.string(space) &amp;&amp; (space == 'OR' || space == 'AND') ? space : 'AND';
			/**
			 * Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
			 * @instance
			 * @type {boolean}
			 */
			this.connectors = F.is.boolean(connectors) ? connectors : true;
			/**
			 * Whether or not ignore case when matching.
			 * @instance
			 * @type {boolean}
			 */
			this.ignoreCase = F.is.boolean(ignoreCase) ? ignoreCase : true;
			/**
			 * Whether or not this is a hidden filter.
			 * @instance
			 * @type {boolean}
			 */
			this.hidden = F.is.boolean(hidden) ? hidden : false;
			/**
			 * The query for the filter.
			 * @instance
			 * @type {(string|FooTable.Query)}
			 */
			this.query = query instanceof F.Query ? query : new F.Query(query, this.space, this.connectors, this.ignoreCase);
			/**
			 * The columns to apply the query to.
			 * @instance
			 * @type {Array.&lt;FooTable.Column&gt;}
			 */
			this.columns = columns;
		},
		/**
		 * Checks if the current filter matches the supplied string.
		 * If the current query property is a string it will be auto converted to a {@link FooTable.Query} object to perform the match.
		 * @instance
		 * @param {string} str - The string to check.
		 * @returns {boolean}
		 */
		match: function(str){
			if (!F.is.string(str)) return false;
			if (F.is.string(this.query)){
				this.query = new F.Query(this.query, this.space, this.connectors, this.ignoreCase);
			}
			return this.query instanceof F.Query ? this.query.match(str) : false;
		},
		/**
		 * Checks if the current filter matches the supplied {@link FooTable.Row}.
		 * @instance
		 * @param {FooTable.Row} row - The row to check.
		 * @returns {boolean}
		 */
		matchRow: function(row){
			var self = this, text = F.arr.map(row.cells, function(cell){
				return F.arr.contains(self.columns, cell.column) ? cell.filterValue : null;
			}).join(' ');
			return self.match(text);
		}
	});

})(FooTable);
(function ($, F) {
	F.Filtering = F.Component.extend(/** @lends FooTable.Filtering */{
		/**
		 * The filtering component adds a search input and column selector dropdown to the table allowing users to filter the using space delimited queries.
		 * @constructs
		 * @extends FooTable.Component
		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
		 * @returns {FooTable.Filtering}
		 */
		construct: function (table) {
			// call the constructor of the base class
			this._super(table, table.o.filtering.enabled);

			/* PUBLIC */
			/**
			 * The filters to apply to the current {@link FooTable.Rows#array}.
			 * @instance
			 * @type {Array.&lt;FooTable.Filter&gt;}
			 */
			this.filters = table.o.filtering.filters;
			/**
			 * The delay in milliseconds before the query is auto applied after a change.
			 * @instance
			 * @type {number}
			 */
			this.delay = table.o.filtering.delay;
			/**
			 * The minimum number of characters allowed in the search input before it is auto applied.
			 * @instance
			 * @type {number}
			 */
			this.min = table.o.filtering.min;
			/**
			 * Specifies how whitespace in a filter query is handled.
			 * @instance
			 * @type {string}
			 */
			this.space = table.o.filtering.space;
			/**
			 * Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
			 * @instance
			 * @type {boolean}
			 */
			this.connectors = table.o.filtering.connectors;
			/**
			 * Whether or not ignore case when matching.
			 * @instance
			 * @type {boolean}
			 */
			this.ignoreCase = table.o.filtering.ignoreCase;
			/**
			 * Whether or not search queries are treated as phrases when matching.
			 * @instance
			 * @type {boolean}
			 */
			this.exactMatch = table.o.filtering.exactMatch;
			/**
			 * The placeholder text to display within the search $input.
			 * @instance
			 * @type {string}
			 */
			this.placeholder = table.o.filtering.placeholder;
			/**
			 * The title to display at the top of the search input column select.
			 * @type {string}
			 */
			this.dropdownTitle = table.o.filtering.dropdownTitle;
			/**
			 * The position of the $search input within the filtering rows cell.
			 * @type {string}
			 */
			this.position = table.o.filtering.position;
			/**
			 * Whether or not to focus the search input after the search/clear button is clicked or after auto applying the search input query.
			 * @type {boolean}
			 */
			this.focus = table.o.filtering.focus;
			/**
			 * A selector specifying where to place the filtering components form, if null the form is displayed within a row in the head of the table.
			 * @type {string}
			 */
			this.container = table.o.filtering.container;
			/**
			 * The jQuery object of the element containing the entire filtering form.
			 * @instance
			 * @type {jQuery}
			 */
			this.$container = null;
			/**
			 * The jQuery row object that contains all the filtering specific elements.
			 * @instance
			 * @type {jQuery}
			 */
			this.$row = null;
			/**
			 * The jQuery cell object that contains the search input and column selector.
			 * @instance
			 * @type {jQuery}
			 */
			this.$cell = null;
			/**
			 * The jQuery form object of the form that contains the search input and column selector.
			 * @instance
			 * @type {jQuery}
			 */
			this.$form = null;
			/**
			 * The jQuery object of the column selector dropdown.
			 * @instance
			 * @type {jQuery}
			 */
			this.$dropdown = null;
			/**
			 * The jQuery object of the search input.
			 * @instance
			 * @type {jQuery}
			 */
			this.$input = null;
			/**
			 * The jQuery object of the search button.
			 * @instance
			 * @type {jQuery}
			 */
			this.$button = null;

			/* PRIVATE */
			/**
			 * The timeout ID for the filter changed event.
			 * @instance
			 * @private
			 * @type {?number}
			 */
			this._filterTimeout = null;
			/**
			 * The regular expression used to check for encapsulating quotations.
			 * @instance
			 * @private
			 * @type {RegExp}
			 */
			this._exactRegExp = /^"(.*?)"$/;
		},

		/* PROTECTED */
		/**
		 * Checks the supplied data and options for the filtering component.
		 * @instance
		 * @protected
		 * @param {object} data - The jQuery data object from the parent table.
		 * @fires FooTable.Filtering#"preinit.ft.filtering"
		 */
		preinit: function(data){
			var self = this;
			/**
			 * The preinit.ft.filtering event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
			 * Calling preventDefault on this event will disable the component.
			 * @event FooTable.Filtering#"preinit.ft.filtering"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {object} data - The jQuery data object of the table raising the event.
			 */
			return self.ft.raise('preinit.ft.filtering').then(function(){
				// first check if filtering is enabled via the class being applied
				if (self.ft.$el.hasClass('footable-filtering'))
					self.enabled = true;
				// then check if the data-filtering-enabled attribute has been set
				self.enabled = F.is.boolean(data.filtering)
					? data.filtering
					: self.enabled;

				// if filtering is not enabled exit early as we don't need to do anything else
				if (!self.enabled) return;

				self.space = F.is.string(data.filterSpace)
					? data.filterSpace
					: self.space;

				self.min = F.is.number(data.filterMin)
					? data.filterMin
					: self.min;

				self.connectors = F.is.boolean(data.filterConnectors)
					? data.filterConnectors
					: self.connectors;

				self.ignoreCase = F.is.boolean(data.filterIgnoreCase)
					? data.filterIgnoreCase
					: self.ignoreCase;

				self.exactMatch = F.is.boolean(data.filterExactMatch)
					? data.filterExactMatch
					: self.exactMatch;

				self.focus = F.is.boolean(data.filterFocus)
					? data.filterFocus
					: self.focus;

				self.delay = F.is.number(data.filterDelay)
					? data.filterDelay
					: self.delay;

				self.placeholder = F.is.string(data.filterPlaceholder)
					? data.filterPlaceholder
					: self.placeholder;

				self.dropdownTitle = F.is.string(data.filterDropdownTitle)
					? data.filterDropdownTitle
					: self.dropdownTitle;

				self.container = F.is.string(data.filterContainer)
					? data.filterContainer
					: self.container;

				self.filters = F.is.array(data.filterFilters)
					? self.ensure(data.filterFilters)
					: self.ensure(self.filters);

				if (self.ft.$el.hasClass('footable-filtering-left'))
					self.position = 'left';
				if (self.ft.$el.hasClass('footable-filtering-center'))
					self.position = 'center';
				if (self.ft.$el.hasClass('footable-filtering-right'))
					self.position = 'right';

				self.position = F.is.string(data.filterPosition)
					? data.filterPosition
					: self.position;
			},function(){
				self.enabled = false;
			});
		},
		/**
		 * Initializes the filtering component for the plugin.
		 * @instance
		 * @protected
		 * @fires FooTable.Filtering#"init.ft.filtering"
		 */
		init: function () {
			var self = this;
			/**
			 * The init.ft.filtering event is raised before its UI is generated.
			 * Calling preventDefault on this event will disable the component.
			 * @event FooTable.Filtering#"init.ft.filtering"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			return self.ft.raise('init.ft.filtering').then(function(){
				self.$create();
			}, function(){
				self.enabled = false;
			});
		},
		/**
		 * Destroys the filtering component removing any UI from the table.
		 * @instance
		 * @protected
		 * @fires FooTable.Filtering#"destroy.ft.filtering"
		 */
		destroy: function () {
			var self = this;
			/**
			 * The destroy.ft.filtering event is raised before its UI is removed.
			 * Calling preventDefault on this event will prevent the component from being destroyed.
			 * @event FooTable.Filtering#"destroy.ft.filtering"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			return self.ft.raise('destroy.ft.filtering').then(function(){
				self.ft.$el.removeClass('footable-filtering')
					.find('thead &gt; tr.footable-filtering').remove();
			});
		},
		/**
		 * Creates the filtering UI from the current options setting the various jQuery properties of this component.
		 * @instance
		 * @protected
		 * @this FooTable.Filtering
		 */
		$create: function () {
			var self = this;
			// generate the cell that actually contains all the UI.
			var $form_grp = $('&lt;div/&gt;', {'class': 'form-group footable-filtering-search'})
					.append($('&lt;label/&gt;', {'class': 'sr-only', text: 'Search'})),
				$input_grp = $('&lt;div/&gt;', {'class': 'input-group'}).appendTo($form_grp),
				$input_grp_btn = $('&lt;div/&gt;', {'class': 'input-group-btn'}),
				$dropdown_toggle = $('&lt;button/&gt;', {type: 'button', 'class': 'btn btn-default dropdown-toggle'})
					.on('click', { self: self }, self._onDropdownToggleClicked)
					.append($('&lt;span/&gt;', {'class': 'caret'})),
				position;

			switch (self.position){
				case 'left': position = 'footable-filtering-left'; break;
				case 'center': position = 'footable-filtering-center'; break;
				default: position = 'footable-filtering-right'; break;
			}
			self.ft.$el.addClass('footable-filtering').addClass(position);

			self.$container = self.container === null ? $() : $(self.container).first();
			if (!self.$container.length){
				// add it to a row and then populate it with the search input and column selector dropdown.
				self.$row = $('&lt;tr/&gt;', {'class': 'footable-filtering'}).prependTo(self.ft.$el.children('thead'));
				self.$cell = $('&lt;th/&gt;').attr('colspan', self.ft.columns.visibleColspan).appendTo(self.$row);
				self.$container = self.$cell;
			} else {
				self.$container.addClass('footable-filtering-external').addClass(position);
			}
			self.$form = $('&lt;form/&gt;', {'class': 'form-inline'}).append($form_grp).appendTo(self.$container);

			self.$input = $('&lt;input/&gt;', {type: 'text', 'class': 'form-control', placeholder: self.placeholder});

			self.$button = $('&lt;button/&gt;', {type: 'button', 'class': 'btn btn-primary'})
				.on('click', { self: self }, self._onSearchButtonClicked)
				.append($('&lt;span/&gt;', {'class': 'fooicon fooicon-search'}));

			self.$dropdown = $('&lt;ul/&gt;', {'class': 'dropdown-menu dropdown-menu-right'});
			if (!F.is.emptyString(self.dropdownTitle)){
				self.$dropdown.append($('&lt;li/&gt;', {'class': 'dropdown-header','text': self.dropdownTitle}));
			}
			self.$dropdown.append(
				F.arr.map(self.ft.columns.array, function (col) {
					return col.filterable ? $('&lt;li/&gt;').append(
						$('&lt;a/&gt;', {'class': 'checkbox'}).append(
							$('&lt;label/&gt;', {html: col.title}).prepend(
								$('&lt;input/&gt;', {type: 'checkbox', checked: true}).data('__FooTableColumn__', col)
							)
						)
					) : null;
				})
			);

			if (self.delay &gt; 0){
				self.$input.on('keypress keyup paste', { self: self }, self._onSearchInputChanged);
				self.$dropdown.on('click', 'input[type="checkbox"]', {self: self}, self._onSearchColumnClicked);
			}

			$input_grp_btn.append(self.$button, $dropdown_toggle, self.$dropdown);
			$input_grp.append(self.$input, $input_grp_btn);
		},
		/**
		 * Performs the filtering of rows before they are appended to the page.
		 * @instance
		 * @protected
		 */
		predraw: function(){
			if (F.is.emptyArray(this.filters))
				return;

			var self = this;
			self.ft.rows.array = $.grep(self.ft.rows.array, function(r){
				return r.filtered(self.filters);
			});
		},
		/**
		 * As the rows are drawn by the {@link FooTable.Rows#draw} method this simply updates the colspan for the UI.
		 * @instance
		 * @protected
		 */
		draw: function(){
			if (F.is.jq(this.$cell)){
				this.$cell.attr('colspan', this.ft.columns.visibleColspan);
			}
			var search = this.find('search');
			if (search instanceof F.Filter){
				var query = search.query.val();
				if (this.exactMatch &amp;&amp; this._exactRegExp.test(query)){
					query = query.replace(this._exactRegExp, '$1');
				}
				this.$input.val(query);
			} else {
				this.$input.val(null);
			}
			this.setButton(!F.arr.any(this.filters, function(f){ return !f.hidden; }));
		},

		/* PUBLIC */
		/**
		 * Adds or updates the filter using the supplied name, query and columns.
		 * @instance
		 * @param {(string|FooTable.Filter|object)} nameOrFilter - The name for the filter or the actual filter object itself.
		 * @param {(string|FooTable.Query)} [query] - The query for the filter. This is only optional when the first parameter is a filter object.
		 * @param {(Array.&lt;number&gt;|Array.&lt;string&gt;|Array.&lt;FooTable.Column&gt;)} [columns] - The columns to apply the filter to.
		 * 	If not supplied the filter will be applied to all selected columns in the search input dropdown.
		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
		 * @param {string} [space="AND"] - How the query treats space chars.
		 * @param {boolean} [hidden=true] - Whether or not this is a hidden filter.
		 */
		addFilter: function(nameOrFilter, query, columns, ignoreCase, connectors, space, hidden){
			var f = this.createFilter(nameOrFilter, query, columns, ignoreCase, connectors, space, hidden);
			if (f instanceof F.Filter){
				this.removeFilter(f.name);
				this.filters.push(f);
			}
		},
		/**
		 * Removes the filter using the supplied name if it exists.
		 * @instance
		 * @param {string} name - The name of the filter to remove.
		 */
		removeFilter: function(name){
			F.arr.remove(this.filters, function(f){ return f.name == name; });
		},
		/**
		 * Performs the required steps to handle filtering including the raising of the {@link FooTable.Filtering#"before.ft.filtering"} and {@link FooTable.Filtering#"after.ft.filtering"} events.
		 * @instance
		 * @param {boolean} [focus=false] - Whether or not to set the focus to the input once filtering is complete.
		 * @returns {jQuery.Promise}
		 * @fires FooTable.Filtering#"before.ft.filtering"
		 * @fires FooTable.Filtering#"after.ft.filtering"
		 */
		filter: function(focus){
			var self = this;
			self.filters = self.ensure(self.filters);
			/**
			 * The before.ft.filtering event is raised before a filter is applied and allows listeners to modify the filter or cancel it completely by calling preventDefault on the jQuery.Event object.
			 * @event FooTable.Filtering#"before.ft.filtering"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {Array.&lt;FooTable.Filter&gt;} filters - The filters that are about to be applied.
			 */
			return self.ft.raise('before.ft.filtering', [self.filters]).then(function(){
				self.filters = self.ensure(self.filters);
				if (focus){
					var start = self.$input.prop('selectionStart'),
						end = self.$input.prop('selectionEnd');
				}
				return self.ft.draw().then(function(){
					if (focus){
						self.$input.focus().prop({
							selectionStart: start,
							selectionEnd: end
						});
					}
					/**
					 * The after.ft.filtering event is raised after a filter has been applied.
					 * @event FooTable.Filtering#"after.ft.filtering"
					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
					 * @param {FooTable.Filter} filter - The filters that were applied.
					 */
					self.ft.raise('after.ft.filtering', [self.filters]);
				});
			});
		},
		/**
		 * Removes the current search filter.
		 * @instance
		 * @returns {jQuery.Promise}
		 * @fires FooTable.Filtering#"before.ft.filtering"
		 * @fires FooTable.Filtering#"after.ft.filtering"
		 */
		clear: function(){
			this.filters = F.arr.get(this.filters, function(f){ return f.hidden; });
			return this.filter(this.focus);
		},
		/**
		 * Toggles the button icon between the search and clear icons based on the supplied value.
		 * @instance
		 * @param {boolean} search - Whether or not to display the search icon.
		 */
		setButton: function(search){
			if (!search){
				this.$button.children('.fooicon').removeClass('fooicon-search').addClass('fooicon-remove');
			} else {
				this.$button.children('.fooicon').removeClass('fooicon-remove').addClass('fooicon-search');
			}
		},
		/**
		 * Finds a filter by name.
		 * @param {string} name - The name of the filter to find.
		 * @returns {(FooTable.Filter|null)}
		 */
		find: function(name){
			return F.arr.first(this.filters, function(f){ return f.name == name; });
		},
		/**
		 * Gets an array of {@link FooTable.Column} to apply the search filter to. This also doubles as the default columns for filters which do not specify any columns.
		 * @instance
		 * @returns {Array.&lt;FooTable.Column&gt;}
		 */
		columns: function(){
			if (F.is.jq(this.$dropdown)){
				// if we have a dropdown containing the column names get the selected columns from there
				return this.$dropdown.find('input:checked').map(function(){
					return $(this).data('__FooTableColumn__');
				}).get();
			} else {
				// otherwise find all columns that are set to be filterable.
				return this.ft.columns.get(function(c){ return c.filterable; });
			}
		},
		/**
		 * Takes an array of plain objects containing the filter values or actual {@link FooTable.Filter} objects and ensures that an array of only {@link FooTable.Filter} is returned.
		 * If supplied a plain object that object must contain a name, query and columns properties which are used to create a new {@link FooTable.Filter}.
		 * @instance
		 * @param {({name: string, query: (string|FooTable.Query), columns: (Array.&lt;string&gt;|Array.&lt;number&gt;|Array.&lt;FooTable.Column&gt;)}|Array.&lt;FooTable.Filter&gt;)} filters - The array of filters to check.
		 * @returns {Array.&lt;FooTable.Filter&gt;}
		 */
		ensure: function(filters){
			var self = this, parsed = [], filterable = self.columns();
			if (!F.is.emptyArray(filters)){
				F.arr.each(filters, function(f){
					f = self._ensure(f, filterable);
					if (f instanceof F.Filter) parsed.push(f);
				});
			}
			return parsed;
		},

		/**
		 * Creates a new filter using the supplied object or individual parameters to populate it.
		 * @instance
		 * @param {(string|FooTable.Filter|object)} nameOrObject - The name for the filter or the actual filter object itself.
		 * @param {(string|FooTable.Query)} [query] - The query for the filter. This is only optional when the first parameter is a filter object.
		 * @param {(Array.&lt;number&gt;|Array.&lt;string&gt;|Array.&lt;FooTable.Column&gt;)} [columns] - The columns to apply the filter to.
		 * 	If not supplied the filter will be applied to all selected columns in the search input dropdown.
		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
		 * @param {string} [space="AND"] - How the query treats space chars.
		 * @param {boolean} [hidden=true] - Whether or not this is a hidden filter.
		 * @returns {*}
		 */
		createFilter: function(nameOrObject, query, columns, ignoreCase, connectors, space, hidden){
			if (F.is.string(nameOrObject)){
				nameOrObject = {name: nameOrObject, query: query, columns: columns, ignoreCase: ignoreCase, connectors: connectors, space: space, hidden: hidden};
			}
			return this._ensure(nameOrObject, this.columns());
		},

		/* PRIVATE */
		_ensure: function(filter, selectedColumns){
			if ((F.is.hash(filter) || filter instanceof F.Filter) &amp;&amp; !F.is.emptyString(filter.name) &amp;&amp; (!F.is.emptyString(filter.query) || filter.query instanceof F.Query)){
				filter.columns = F.is.emptyArray(filter.columns) ? selectedColumns : this.ft.columns.ensure(filter.columns);
				filter.ignoreCase = F.is.boolean(filter.ignoreCase) ? filter.ignoreCase : this.ignoreCase;
				filter.connectors = F.is.boolean(filter.connectors) ? filter.connectors : this.connectors;
				filter.hidden = F.is.boolean(filter.hidden) ? filter.hidden : false;
				filter.space = F.is.string(filter.space) &amp;&amp; (filter.space === 'AND' || filter.space === 'OR') ? filter.space : this.space;
				filter.query = F.is.string(filter.query) ? new F.Query(filter.query, filter.space, filter.connectors, filter.ignoreCase) : filter.query;
				return (filter instanceof F.Filter)
					? filter
					: new F.Filter(filter.name, filter.query, filter.columns, filter.space, filter.connectors, filter.ignoreCase, filter.hidden);
			}
			return null;
		},
		/**
		 * Handles the change event for the {@link FooTable.Filtering#$input}.
		 * @instance
		 * @private
		 * @param {jQuery.Event} e - The event object for the event.
		 */
		_onSearchInputChanged: function (e) {
			var self = e.data.self;
			var alpha = e.type == 'keypress' &amp;&amp; !F.is.emptyString(String.fromCharCode(e.charCode)),
				ctrl = e.type == 'keyup' &amp;&amp; (e.which == 8 || e.which == 46),
				paste = e.type == 'paste'; // backspace &amp; delete

			// if alphanumeric characters or specific control characters
			if(alpha || ctrl || paste) {
				if (e.which == 13) e.preventDefault();
				if (self._filterTimeout != null) clearTimeout(self._filterTimeout);
				self._filterTimeout = setTimeout(function(){
					self._filterTimeout = null;
					var query = self.$input.val();
					if (query.length &gt;= self.min){
						if (self.exactMatch &amp;&amp; !self._exactRegExp.test(query)){
							query = '"' + query + '"';
						}
						self.addFilter('search', query);
						self.filter(self.focus);
					} else if (F.is.emptyString(query)){
						self.clear();
					}
				}, self.delay);
			}
		},
		/**
		 * Handles the click event for the {@link FooTable.Filtering#$button}.
		 * @instance
		 * @private
		 * @param {jQuery.Event} e - The event object for the event.
		 */
		_onSearchButtonClicked: function (e) {
			e.preventDefault();
			var self = e.data.self;
			if (self._filterTimeout != null) clearTimeout(self._filterTimeout);
			var $icon = self.$button.children('.fooicon');
			if ($icon.hasClass('fooicon-remove')) self.clear();
			else {
				var query = self.$input.val();
				if (query.length &gt;= self.min){
					if (self.exactMatch &amp;&amp; !self._exactRegExp.test(query)){
						query = '"' + query + '"';
					}
					self.addFilter('search', query);
					self.filter(self.focus);
				}
			}
		},
		/**
		 * Handles the click event for the column checkboxes in the {@link FooTable.Filtering#$dropdown}.
		 * @instance
		 * @private
		 * @param {jQuery.Event} e - The event object for the event.
		 */
		_onSearchColumnClicked: function (e) {
			var self = e.data.self;
			if (self._filterTimeout != null) clearTimeout(self._filterTimeout);
			self._filterTimeout = setTimeout(function(){
				self._filterTimeout = null;
				var $icon = self.$button.children('.fooicon');
				if ($icon.hasClass('fooicon-remove')){
					$icon.removeClass('fooicon-remove').addClass('fooicon-search');
					self.addFilter('search', self.$input.val());
					self.filter();
				}
			}, self.delay);
		},
		/**
		 * Handles the click event for the {@link FooTable.Filtering#$dropdown} toggle.
		 * @instance
		 * @private
		 * @param {jQuery.Event} e - The event object for the event.
		 */
		_onDropdownToggleClicked: function (e) {
			e.preventDefault();
			e.stopPropagation();
			var self = e.data.self;
			self.$dropdown.parent().toggleClass('open');
			if (self.$dropdown.parent().hasClass('open')) $(document).on('click.footable', { self: self }, self._onDocumentClicked);
			else $(document).off('click.footable', self._onDocumentClicked);
		},
		/**
		 * Checks all click events when the dropdown is visible and closes the menu if the target is not the dropdown.
		 * @instance
		 * @private
		 * @param {jQuery.Event} e - The event object for the event.
		 */
		_onDocumentClicked: function(e){
			if ($(e.target).closest('.dropdown-menu').length == 0){
				e.preventDefault();
				var self = e.data.self;
				self.$dropdown.parent().removeClass('open');
				$(document).off('click.footable', self._onDocumentClicked);
			}
		}
	});

	F.components.register('filtering', F.Filtering, 500);

})(jQuery, FooTable);

(function(F){
	F.Query = F.Class.extend(/** @lends FooTable.Query */{
		/**
		 * The query object is used to parse and test the filtering component's queries
		 * @constructs
		 * @extends FooTable.Class
		 * @param {string} query - The string value of the query.
		 * @param {string} [space="AND"] - How the query treats whitespace.
		 * @param {boolean} [connectors=true] - Whether or not to replace phrase connectors (+.-_) with spaces.
		 * @param {boolean} [ignoreCase=true] - Whether or not ignore case when matching.
		 * @returns {FooTable.Query}
		 */
		construct: function(query, space, connectors, ignoreCase){
			/* PRIVATE */
			/**
			 * Holds the previous value of the query and is used internally in the {@link FooTable.Query#val} method.
			 * @type {string}
			 * @private
			 */
			this._original = null;
			/**
			 * Holds the value for the query. Access to this variable is provided through the {@link FooTable.Query#val} method.
			 * @type {string}
			 * @private
			 */
			this._value = null;
			/* PUBLIC */
			/**
			 * A string specifying how the query treats whitespace. Can be either "OR" or "AND".
			 * @type {string}
			 */
			this.space = F.is.string(space) &amp;&amp; (space == 'OR' || space == 'AND') ? space : 'AND';
			/**
			 * Whether or not to replace phrase connectors (+.-_) with spaces before executing the query.
			 * @instance
			 * @type {boolean}
			 */
			this.connectors = F.is.boolean(connectors) ? connectors : true;
			/**
			 * Whether or not ignore case when matching.
			 * @instance
			 * @type {boolean}
			 */
			this.ignoreCase = F.is.boolean(ignoreCase) ? ignoreCase : true;
			/**
			 * The left side of the query if one exists. OR takes precedence over AND.
			 * @type {FooTable.Query}
			 * @example &lt;caption&gt;The below shows what is meant by the "left" side of a query&lt;/caption&gt;
			 * query = "Dave AND Mary" - "Dave" is the left side of the query.
			 * query = "Dave AND Mary OR John" - "Dave and Mary" is the left side of the query.
			 */
			this.left = null;
			/**
			 * The right side of the query if one exists. OR takes precedence over AND.
			 * @type {FooTable.Query}
			 * @example &lt;caption&gt;The below shows what is meant by the "right" side of a query&lt;/caption&gt;
			 * query = "Dave AND Mary" - "Mary" is the right side of the query.
			 * query = "Dave AND Mary OR John" - "John" is the right side of the query.
			 */
			this.right = null;
			/**
			 * The parsed parts of the query. This contains the information used to actually perform a match against a string.
			 * @type {Array}
			 */
			this.parts = [];
			/**
			 * The type of operand to apply to the results of the individual parts of the query.
			 * @type {string}
			 */
			this.operator = null;
			this.val(query);
		},
		/**
		 * Gets or sets the value for the query. During set the value is parsed setting all properties as required.
		 * @param {string} [value] - If supplied the value to set for this query.
		 * @returns {(string|undefined)}
		 */
		val: function(value){
			// get
			if (F.is.emptyString(value)) return this._value;

			// set
			if (F.is.emptyString(this._original)) this._original = value;
			else if (this._original == value) return;

			this._value = value;
			this._parse();
		},
		/**
		 * Tests the supplied string against the query.
		 * @param {string} str - The string to test.
		 * @returns {boolean}
		 */
		match: function(str){
			if (F.is.emptyString(this.operator) || this.operator === 'OR')
				return this._left(str, false) || this._match(str, false) || this._right(str, false);
			if (this.operator === 'AND')
				return this._left(str, true) &amp;&amp; this._match(str, true) &amp;&amp; this._right(str, true);
		},
		/**
		 * Matches this queries parts array against the supplied string.
		 * @param {string} str - The string to test.
		 * @param {boolean} def - The default value to return based on the operand.
		 * @returns {boolean}
		 * @private
		 */
		_match: function(str, def){
			var self = this, result = false, empty = F.is.emptyString(str);
			if (F.is.emptyArray(self.parts) &amp;&amp; self.left instanceof F.Query) return def;
			if (F.is.emptyArray(self.parts)) return result;
			if (self.space === 'OR'){
				// with OR we give the str every part to test and if any match it is a success, we do exit early if a negated match occurs
				F.arr.each(self.parts, function(p){
					if (p.empty &amp;&amp; empty){
						result = true;
						if (p.negate){
							result = false;
							return result;
						}
					} else {
						var match = (p.exact ? F.str.containsExact : F.str.contains)(str, p.query, self.ignoreCase);
						if (match &amp;&amp; !p.negate) result = true;
						if (match &amp;&amp; p.negate) {
							result = false;
							return result;
						}
					}
				});
			} else {
				// otherwise with AND we check until the first failure and then exit
				result = true;
				F.arr.each(self.parts, function(p){
					if (p.empty){
						if ((!empty &amp;&amp; !p.negate) || (empty &amp;&amp; p.negate)) result = false;
						return result;
					} else {
						var match = (p.exact ? F.str.containsExact : F.str.contains)(str, p.query, self.ignoreCase);
						if ((!match &amp;&amp; !p.negate) || (match &amp;&amp; p.negate)) result = false;
						return result;
					}
				});
			}
			return result;
		},
		/**
		 * Matches the left side of the query if one exists with the supplied string.
		 * @param {string} str - The string to test.
		 * @param {boolean} def - The default value to return based on the operand.
		 * @returns {boolean}
		 * @private
		 */
		_left: function(str, def){
			return (this.left instanceof F.Query) ? this.left.match(str) : def;
		},
		/**
		 * Matches the right side of the query if one exists with the supplied string.
		 * @param {string} str - The string to test.
		 * @param {boolean} def - The default value to return based on the operand.
		 * @returns {boolean}
		 * @private
		 */
		_right: function(str, def){
			return (this.right instanceof F.Query) ? this.right.match(str) : def;
		},
		/**
		 * Parses the private {@link FooTable.Query#_value} property and populates the object.
		 * @private
		 */
		_parse: function(){
			if (F.is.emptyString(this._value)) return;
			// OR takes precedence so test for it first
			if (/\sOR\s/.test(this._value)){
				// we have an OR so split the value on the first occurrence of OR to get the left and right sides of the statement
				this.operator = 'OR';
				var or = this._value.split(/(?:\sOR\s)(.*)?/);
				this.left = new F.Query(or[0], this.space, this.connectors, this.ignoreCase);
				this.right = new F.Query(or[1], this.space, this.connectors, this.ignoreCase);
			} else if (/\sAND\s/.test(this._value)) {
				// there are no more OR's so start with AND
				this.operator = 'AND';
				var and = this._value.split(/(?:\sAND\s)(.*)?/);
				this.left = new F.Query(and[0], this.space, this.connectors, this.ignoreCase);
				this.right = new F.Query(and[1], this.space, this.connectors, this.ignoreCase);
			} else {
				// we have no more statements to parse so set the parts array by parsing each part of the remaining query
				var self = this;
				this.parts = F.arr.map(this._value.match(/(?:[^\s"]+|"[^"]*")+/g), function(str){
					return self._part(str);
				});
			}
		},
		/**
		 * Parses a single part of a query into an object to use during matching.
		 * @param {string} str - The string representation of the part.
		 * @returns {{query: string, negate: boolean, phrase: boolean, exact: boolean}}
		 * @private
		 */
		_part: function(str){
			var p = {
				query: str,
				negate: false,
				phrase: false,
				exact: false,
				empty: false
			};
			// support for NEGATE operand - (minus sign). Remove this first so we can get onto phrase checking
			if (F.str.startsWith(p.query, '-')){
				p.query = F.str.from(p.query, '-');
				p.negate = true;
			}
			// support for PHRASES (exact matches)
			if (/^"(.*?)"$/.test(p.query)){ // if surrounded in quotes strip them and nothing else
				p.query = p.query.replace(/^"(.*?)"$/, '$1');
				p.phrase = true;
				p.exact = true;
			} else if (this.connectors &amp;&amp; /(?:\w)+?([-_\+\.])(?:\w)+?/.test(p.query)) { // otherwise replace supported phrase connectors (-_+.) with spaces
				p.query = p.query.replace(/(?:\w)+?([-_\+\.])(?:\w)+?/g, function(match, p1){
					return match.replace(p1, ' ');
				});
				p.phrase = true;
			}
			p.empty = p.phrase &amp;&amp; F.is.emptyString(p.query);
			return p;
		}
	});

})(FooTable);
(function(F){

	/**
	 * The value used by the filtering component during filter operations. Must be a string and can be set using the data-filter-value attribute on the cell itself.
	 * If this is not supplied it is set to the result of the toString method called on the value for the cell. Added by the {@link FooTable.Filtering} component.
	 * @type {string}
	 * @default null
	 */
	F.Cell.prototype.filterValue = null;

	// this is used to define the filtering specific properties on cell creation
	F.Cell.prototype.__filtering_define__ = function(valueOrElement){
		this.filterValue = this.column.filterValue.call(this.column, valueOrElement);
	};

	// this is used to update the filterValue property whenever the cell value is changed
	F.Cell.prototype.__filtering_val__ = function(value){
		if (F.is.defined(value)){
			// set only
			this.filterValue = this.column.filterValue.call(this.column, value);
		}
	};

	// overrides the public define method and replaces it with our own
	F.Cell.extend('define', function(valueOrElement){
		this._super(valueOrElement);
		this.__filtering_define__(valueOrElement);
	});
	// overrides the public val method and replaces it with our own
	F.Cell.extend('val', function(value, redraw, redrawSelf){
		var val = this._super(value, redraw, redrawSelf);
		this.__filtering_val__(value);
		return val;
	});
})(FooTable);
(function($, F){
	/**
	 * Whether or not the column can be used during filtering. Added by the {@link FooTable.Filtering} component.
	 * @type {boolean}
	 * @default true
	 */
	F.Column.prototype.filterable = true;

	/**
	 * This is supplied either the cell value or jQuery object to parse. A string value must be returned from this method and will be used during filtering operations.
	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
	 * @returns {string}
	 * @this FooTable.Column
	 */
	F.Column.prototype.filterValue = function(valueOrElement){
		// if we have an element or a jQuery object use jQuery to get the value
		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
			var data = $(valueOrElement).data('filterValue');
			return F.is.defined(data) ? ''+data : $(valueOrElement).text();
		}
		// if options are supplied with the value
		if (F.is.hash(valueOrElement) &amp;&amp; F.is.hash(valueOrElement.options)){
			if (F.is.string(valueOrElement.options.filterValue)) return valueOrElement.options.filterValue;
			if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
		}
		if (F.is.defined(valueOrElement) &amp;&amp; valueOrElement != null) return valueOrElement+''; // use the native toString of the value
		return ''; // otherwise we have no value so return an empty string
	};

	// this is used to define the filtering specific properties on column creation
	F.Column.prototype.__filtering_define__ = function(definition){
		this.filterable = F.is.boolean(definition.filterable) ? definition.filterable : this.filterable;
		this.filterValue = F.checkFnValue(this, definition.filterValue, this.filterValue);
	};

	// overrides the public define method and replaces it with our own
	F.Column.extend('define', function(definition){
		this._super(definition); // call the base so we don't have to redefine any previously set properties
		this.__filtering_define__(definition); // then call our own
	});
})(jQuery, FooTable);
(function(F){
	/**
	 * An object containing the filtering options for the plugin. Added by the {@link FooTable.Filtering} component.
	 * @type {object}
	 * @prop {boolean} enabled=false - Whether or not to allow filtering on the table.
	 * @prop {({name: string, query: (string|FooTable.Query), columns: (Array.&lt;string&gt;|Array.&lt;number&gt;|Array.&lt;FooTable.Column&gt;)}|Array.&lt;FooTable.Filter&gt;)} filters - The filters to apply to the current {@link FooTable.Rows#array}.
	 * @prop {number} delay=1200 - The delay in milliseconds before the query is auto applied after a change (any value equal to or less than zero will disable this).
	 * @prop {number} min=1 - The minimum number of characters allowed in the search input before it is auto applied.
	 * @prop {string} space="AND" - Specifies how whitespace in a filter query is handled.
	 * @prop {string} placeholder="Search" - The string used as the placeholder for the search input.
	 * @prop {string} dropdownTitle=null - The title to display at the top of the search input column select.
	 * @prop {string} position="right" - The string used to specify the alignment of the search input.
	 * @prop {string} connectors=true - Whether or not to replace phrase connectors (+.-_) with space before executing the query.
	 * @prop {boolean} ignoreCase=true - Whether or not ignore case when matching.
	 * @prop {boolean} exactMatch=false - Whether or not search queries are treated as phrases when matching.
	 * @prop {boolean} focus=true - Whether or not to focus the search input after the search/clear button is clicked or after auto applying the search input query.
	 * @prop {string} container=null - A selector specifying where to place the filtering components form, if null the form is displayed within a row in the head of the table.
	 */
	F.Defaults.prototype.filtering = {
		enabled: false,
		filters: [],
		delay: 1200,
		min: 1,
		space: 'AND',
		placeholder: 'Search',
		dropdownTitle: null,
		position: 'right',
		connectors: true,
		ignoreCase: true,
		exactMatch: false,
		focus: true,
		container: null
	};
})(FooTable);
(function(F){
	/**
	 * Checks if the row is filtered using the supplied filters.
	 * @this FooTable.Row
	 * @param {Array.&lt;FooTable.Filter&gt;} filters - The filters to apply.
	 * @returns {boolean}
	 */
	F.Row.prototype.filtered = function(filters){
		var result = true, self = this;
		F.arr.each(filters, function(f){
			if ((result = f.matchRow(self)) == false) return false;
		});
		return result;
	};
})(FooTable);
(function($, F){

	F.Sorter = F.Class.extend(/** @lends FooTable.Sorter */{
		/**
		 * The sorter object contains the column and direction to sort by.
		 * @constructs
		 * @extends FooTable.Class
		 * @param {FooTable.Column} column - The column to sort.
		 * @param {string} direction - The direction to sort by.
		 * @returns {FooTable.Sorter}
		 */
		construct: function(column, direction){
			/**
			 * The column to sort.
			 * @type {FooTable.Column}
			 */
			this.column = column;
			/**
			 * The direction to sort by.
			 * @type {string}
			 */
			this.direction = direction;
		}
	});

})(jQuery, FooTable);
(function ($, F) {
	F.Sorting = F.Component.extend(/** @lends FooTable.Sorting */{
		/**
		 * The sorting component adds a small sort button to specified column headers allowing users to sort those columns in the table.
		 * @constructs
		 * @extends FooTable.Component
		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
		 * @returns {FooTable.Sorting}
		 */
		construct: function (table) {
			// call the constructor of the base class
			this._super(table, table.o.sorting.enabled);

			/* PROTECTED */
			/**
			 * This provides a shortcut to the {@link FooTable.Table#options}.[sorting]{@link FooTable.Defaults#sorting} object.
			 * @instance
			 * @protected
			 * @type {object}
			 */
			this.o = table.o.sorting;
			/**
			 * The current sorted column.
			 * @instance
			 * @type {FooTable.Column}
			 */
			this.column = null;
			/**
			 * Whether or not to allow sorting to occur, should be set using the {@link FooTable.Sorting#toggleAllowed} method.
			 * @instance
			 * @type {boolean}
			 */
			this.allowed = true;
			/**
			 * The initial sort state of the table, this value is used for determining if the sorting has occurred or to reset the state to default.
			 * @instance
			 * @type {{isset: boolean, rows: Array.&lt;FooTable.Row&gt;, column: string, direction: ?string}}
			 */
			this.initial = null;
		},

		/* PROTECTED */
		/**
		 * Checks the supplied data and options for the sorting component.
		 * @instance
		 * @protected
		 * @param {object} data - The jQuery data object from the parent table.
		 * @fires FooTable.Sorting#"preinit.ft.sorting"
		 * @this FooTable.Sorting
		 */
		preinit: function(data){
			var self = this;
			/**
			 * The preinit.ft.sorting event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
			 * Calling preventDefault on this event will disable the component.
			 * @event FooTable.Sorting#"preinit.ft.sorting"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {object} data - The jQuery data object of the table raising the event.
			 */
			this.ft.raise('preinit.ft.sorting', [data]).then(function(){
				if (self.ft.$el.hasClass('footable-sorting'))
					self.enabled = true;
				self.enabled = F.is.boolean(data.sorting)
					? data.sorting
					: self.enabled;
				if (!self.enabled) return;
				self.column = F.arr.first(self.ft.columns.array, function(col){ return col.sorted; });
			}, function(){
				self.enabled = false;
			});
		},
		/**
		 * Initializes the sorting component for the plugin using the supplied table and options.
		 * @instance
		 * @protected
		 * @fires FooTable.Sorting#"init.ft.sorting"
		 * @this FooTable.Sorting
		 */
		init: function () {
			/**
			 * The init.ft.sorting event is raised before its UI is generated.
			 * Calling preventDefault on this event will disable the component.
			 * @event FooTable.Sorting#"init.ft.sorting"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			var self = this;
			this.ft.raise('init.ft.sorting').then(function(){
				if (!self.initial){
					var isset = !!self.column;
					self.initial = {
						isset: isset,
						// grab a shallow copy of the rows array prior to sorting - allows us to reset without an initial sort
						rows: self.ft.rows.all.slice(0),
						// if there is a sorted column store its name and direction
						column: isset ? self.column.name : null,
						direction: isset ? self.column.direction : null
					}
				}
				F.arr.each(self.ft.columns.array, function(col){
					if (col.sortable){
						col.$el.addClass('footable-sortable').append($('&lt;span/&gt;', {'class': 'fooicon fooicon-sort'}));
					}
				});
				self.ft.$el.on('click.footable', '.footable-sortable', { self: self }, self._onSortClicked);
			}, function(){
				self.enabled = false;
			});
		},
		/**
		 * Destroys the sorting component removing any UI generated from the table.
		 * @instance
		 * @protected
		 * @fires FooTable.Sorting#"destroy.ft.sorting"
		 */
		destroy: function () {
			/**
			 * The destroy.ft.sorting event is raised before its UI is removed.
			 * Calling preventDefault on this event will prevent the component from being destroyed.
			 * @event FooTable.Sorting#"destroy.ft.sorting"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			var self = this;
			this.ft.raise('destroy.ft.paging').then(function(){
				self.ft.$el.off('click.footable', '.footable-sortable', self._onSortClicked);
				self.ft.$el.children('thead').children('tr.footable-header')
					.children('.footable-sortable').removeClass('footable-sortable footable-asc footable-desc')
					.find('span.fooicon').remove();
			});
		},
		/**
		 * Performs the actual sorting against the {@link FooTable.Rows#current} array.
		 * @instance
		 * @protected
		 */
		predraw: function () {
			if (!this.column) return;
			var self = this, col = self.column;
			self.ft.rows.array.sort(function (a, b) {
				return col.direction == 'DESC'
						? col.sorter(b.cells[col.index].sortValue, a.cells[col.index].sortValue)
						: col.sorter(a.cells[col.index].sortValue, b.cells[col.index].sortValue);
			});
		},
		/**
		 * Updates the sorting UI setting the state of the sort buttons.
		 * @instance
		 * @protected
		 */
		draw: function () {
			if (!this.column) return;
			var self = this,
				$sortable = self.ft.$el.find('thead &gt; tr &gt; .footable-sortable'),
				$active = self.column.$el;

			$sortable.removeClass('footable-asc footable-desc').children('.fooicon').removeClass('fooicon-sort fooicon-sort-asc fooicon-sort-desc');
			$sortable.not($active).children('.fooicon').addClass('fooicon-sort');
			$active.addClass(self.column.direction == 'DESC' ? 'footable-desc' : 'footable-asc')
				.children('.fooicon').addClass(self.column.direction == 'DESC' ? 'fooicon-sort-desc' : 'fooicon-sort-asc');
		},

		/* PUBLIC */
		/**
		 * Sets the sorting options and calls the {@link FooTable.Table#draw} method to perform the actual sorting.
		 * @instance
		 * @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
		 * @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
		 * @returns {jQuery.Promise}
		 * @fires FooTable.Sorting#"before.ft.sorting"
		 * @fires FooTable.Sorting#"after.ft.sorting"
		 */
		sort: function(column, direction){
			return this._sort(column, direction);
		},
		/**
		 * Toggles whether or not sorting is currently allowed.
		 * @param {boolean} [state] - You can optionally specify the state you want it to be, if not supplied the current value is flipped.
		 */
		toggleAllowed: function(state){
			state = F.is.boolean(state) ? state : !this.allowed;
			this.allowed = state;
			this.ft.$el.toggleClass('footable-sorting-disabled', !this.allowed);
		},
		/**
		 * Checks whether any sorting has occurred for the table.
		 * @returns {boolean}
		 */
		hasChanged: function(){
			return !(!this.initial || !this.column ||
				(this.column.name === this.initial.column &amp;&amp;
					(this.column.direction === this.initial.direction || (this.initial.direction === null &amp;&amp; this.column.direction === 'ASC')))
			);
		},
		/**
		 * Resets the table sorting to the initial state recorded in the components init method.
		 */
		reset: function(){
			if (!!this.initial){
				if (this.initial.isset){
					// if the initial value specified a column, sort by it
					this.sort(this.initial.column, this.initial.direction);
				} else {
					// if there was no initial column then we need to reset the rows to there original order
					if (!!this.column){
						// if there is a currently sorted column remove the asc/desc classes and set it to null.
						this.column.$el.removeClass('footable-asc footable-desc');
						this.column = null;
					}
					// replace the current all rows array with the one stored in the initial value
					this.ft.rows.all = this.initial.rows;
					// force the table to redraw itself using the updated rows array
					this.ft.draw();
				}
			}
		},

		/* PRIVATE */
		/**
		 * Performs the required steps to handle sorting including the raising of the {@link FooTable.Sorting#"before.ft.sorting"} and {@link FooTable.Sorting#"after.ft.sorting"} events.
		 * @instance
		 * @private
		 * @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
		 * @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
		 * @returns {jQuery.Promise}
		 * @fires FooTable.Sorting#"before.ft.sorting"
		 * @fires FooTable.Sorting#"after.ft.sorting"
		 */
		_sort: function(column, direction){
			if (!this.allowed) return $.Deferred().reject('sorting disabled');
			var self = this;
			var sorter = new F.Sorter(self.ft.columns.get(column), F.Sorting.dir(direction));
			/**
			 * The before.ft.sorting event is raised before a sort is applied and allows listeners to modify the sorter or cancel it completely by calling preventDefault on the jQuery.Event object.
			 * @event FooTable.Sorting#"before.ft.sorting"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {FooTable.Sorter} sorter - The sorter that is about to be applied.
			 */
			return self.ft.raise('before.ft.sorting', [sorter]).then(function(){
				F.arr.each(self.ft.columns.array, function(col){
					if (col != self.column) col.direction = null;
				});
				self.column = self.ft.columns.get(sorter.column);
				if (self.column) self.column.direction = F.Sorting.dir(sorter.direction);
				return self.ft.draw().then(function(){
					/**
					 * The after.ft.sorting event is raised after a sorter has been applied.
					 * @event FooTable.Sorting#"after.ft.sorting"
					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
					 * @param {FooTable.Sorter} sorter - The sorter that has been applied.
					 */
					self.ft.raise('after.ft.sorting', [sorter]);
				});
			});
		},
		/**
		 * Handles the sort button clicked event.
		 * @instance
		 * @private
		 * @param {jQuery.Event} e - The event object for the event.
		 */
		_onSortClicked: function (e) {
			var self = e.data.self, $header = $(this).closest('th,td'),
				direction = $header.is('.footable-asc, .footable-desc')
					? ($header.hasClass('footable-desc') ? 'ASC' : 'DESC')
					: 'ASC';
			self._sort($header.index(), direction);
		}
	});

	/**
	 * Checks the supplied string is a valid direction and if not returns ASC as default.
	 * @static
	 * @protected
	 * @param {string} str - The string to check.
	 */
	F.Sorting.dir = function(str){
		return F.is.string(str) &amp;&amp; (str == 'ASC' || str == 'DESC') ? str : 'ASC';
	};

	F.components.register('sorting', F.Sorting, 600);

})(jQuery, FooTable);
(function(F){

	/**
	 * The value used by the sorting component during sort operations. Can be set using the data-sort-value attribute on the cell itself.
	 * If this is not supplied it is set to the result of the toString method called on the value for the cell. Added by the {@link FooTable.Sorting} component.
	 * @type {string}
	 * @default null
	 */
	F.Cell.prototype.sortValue = null;

	// this is used to define the sorting specific properties on cell creation
	F.Cell.prototype.__sorting_define__ = function(valueOrElement){
		this.sortValue = this.column.sortValue.call(this.column, valueOrElement);
	};

	// this is used to update the sortValue property whenever the cell value is changed
	F.Cell.prototype.__sorting_val__ = function(value){
		if (F.is.defined(value)){
			// set only
			this.sortValue = this.column.sortValue.call(this.column, value);
		}
	};

	// overrides the public define method and replaces it with our own
	F.Cell.extend('define', function(valueOrElement){
		this._super(valueOrElement);
		this.__sorting_define__(valueOrElement);
	});
	// overrides the public val method and replaces it with our own
	F.Cell.extend('val', function(value, redraw, redrawSelf){
		var val = this._super(value, redraw, redrawSelf);
		this.__sorting_val__(value);
		return val;
	});
})(FooTable);
(function($, F){
	/**
	 * The direction to sort if the {@link FooTable.Column#sorted} property is set to true. Can be "ASC", "DESC" or NULL. Added by the {@link FooTable.Sorting} component.
	 * @type {string}
	 * @default null
	 */
	F.Column.prototype.direction = null;
	/**
	 * Whether or not the column can be sorted. Added by the {@link FooTable.Sorting} component.
	 * @type {boolean}
	 * @default true
	 */
	F.Column.prototype.sortable = true;
	/**
	 * Whether or not the column is sorted. Added by the {@link FooTable.Sorting} component.
	 * @type {boolean}
	 * @default false
	 */
	F.Column.prototype.sorted = false;

	/**
	 * This is supplied two values from the column for a comparison to be made and the result returned. Added by the {@link FooTable.Sorting} component.
	 * @param {*} a - The first value to be compared.
	 * @param {*} b - The second value to compare to the first.
	 * @returns {number}
	 * @example &lt;caption&gt;This example shows using pseudo code what a sort function would look like.&lt;/caption&gt;
	 * "sorter": function(a, b){
	 * 	if (a is less than b by some ordering criterion) {
	 * 		return -1;
	 * 	}
	 * 	if (a is greater than b by the ordering criterion) {
	 * 		return 1;
	 * 	}
	 * 	// a must be equal to b
	 * 	return 0;
	 * }
	 */
	F.Column.prototype.sorter = function(a, b){
		if (typeof a === 'string') a = a.toLowerCase();
		if (typeof b === 'string') b = b.toLowerCase();
		if (a === b) return 0;
		if (a &lt; b) return -1;
		return 1;
	};

	/**
	 * This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
	 * @returns {*}
	 * @this FooTable.Column
	 */
	F.Column.prototype.sortValue = function(valueOrElement){
		// if we have an element or a jQuery object use jQuery to get the value
		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
			var data = $(valueOrElement).data('sortValue');
			return F.is.defined(data) ? data : this.parser(valueOrElement);
		}
		// if options are supplied with the value
		if (F.is.hash(valueOrElement) &amp;&amp; F.is.hash(valueOrElement.options)){
			if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
			if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
		}
		if (F.is.defined(valueOrElement) &amp;&amp; valueOrElement != null) return valueOrElement;
		return null;
	};

	// this is used to define the sorting specific properties on column creation
	F.Column.prototype.__sorting_define__ = function(definition){
		this.sorter = F.checkFnValue(this, definition.sorter, this.sorter);
		this.direction = F.is.type(definition.direction, 'string') ? F.Sorting.dir(definition.direction) : null;
		this.sortable = F.is.boolean(definition.sortable) ? definition.sortable : true;
		this.sorted = F.is.boolean(definition.sorted) ? definition.sorted : false;
		this.sortValue = F.checkFnValue(this, definition.sortValue, this.sortValue);
	};

	// overrides the public define method and replaces it with our own
	F.Column.extend('define', function(definition){
		this._super(definition);
		this.__sorting_define__(definition);
	});

})(jQuery, FooTable);
(function(F){
	/**
	 * An object containing the sorting options for the plugin. Added by the {@link FooTable.Sorting} component.
	 * @type {object}
	 * @prop {boolean} enabled=false - Whether or not to allow sorting on the table.
	 */
	F.Defaults.prototype.sorting = {
		enabled: false
	};
})(FooTable);
(function($, F){

	F.HTMLColumn.extend('__sorting_define__', function(definition){
		this._super(definition);
		this.sortUse = F.is.string(definition.sortUse) &amp;&amp; $.inArray(definition.sortUse, ['html','text']) !== -1 ? definition.sortUse : 'html';
	});

	/**
	 * This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
	 * @returns {*}
	 * @this FooTable.HTMLColumn
	 */
	F.HTMLColumn.prototype.sortValue = function(valueOrElement){
		// if we have an element or a jQuery object use jQuery to get the data value or pass it off to the parser
		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
			var data = $(valueOrElement).data('sortValue');
			return F.is.defined(data) ? data : this.parser(valueOrElement);
		}
		// if options are supplied with the value
		if (F.is.hash(valueOrElement) &amp;&amp; F.is.hash(valueOrElement.options)){
			if (F.is.string(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
			if (F.is.defined(valueOrElement.value)) valueOrElement = valueOrElement.value;
		}
		if (F.is.defined(valueOrElement) &amp;&amp; valueOrElement != null) return valueOrElement;
		return null;
	};

})(jQuery, FooTable);
(function($, F){

	/**
	 * This is supplied either the cell value or jQuery object to parse. A value must be returned from this method and will be used during sorting operations.
	 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
	 * @returns {*}
	 */
	F.NumberColumn.prototype.sortValue = function(valueOrElement){
		// if we have an element or a jQuery object use jQuery to get the data value or pass it off to the parser
		if (F.is.element(valueOrElement) || F.is.jq(valueOrElement)){
			var data = $(valueOrElement).data('sortValue');
			return F.is.number(data) ? data : this.parser(valueOrElement);
		}
		// if options are supplied with the value
		if (F.is.hash(valueOrElement) &amp;&amp; F.is.hash(valueOrElement.options)){
			if (F.is.string(valueOrElement.options.sortValue)) return this.parser(valueOrElement);
			if (F.is.number(valueOrElement.options.sortValue)) return valueOrElement.options.sortValue;
			if (F.is.number(valueOrElement.value)) return valueOrElement.value;
		}
		if (F.is.string(valueOrElement)) return this.parser(valueOrElement);
		if (F.is.number(valueOrElement)) return valueOrElement;
		return null;
	};

})(jQuery, FooTable);
(function(F){
	/**
	 * Sort the table using the specified column and direction. Added by the {@link FooTable.Sorting} component.
	 * @instance
	 * @param {(string|number|FooTable.Column)} column - The column name, index or the actual {@link FooTable.Column} object to sort by.
	 * @param {string} [direction="ASC"] - The direction to sort by, either ASC or DESC.
	 * @returns {jQuery.Promise}
	 * @fires FooTable.Sorting#"change.ft.sorting"
	 * @fires FooTable.Sorting#"changed.ft.sorting"
	 * @see FooTable.Sorting#sort
	 */
	F.Table.prototype.sort = function(column, direction){
		return this.use(F.Sorting).sort(column, direction);
	};
})(FooTable);
(function($, F){

	F.Pager = F.Class.extend(/** @lends FooTable.Pager */{
		/**
		 * The pager object contains the page number and direction to page to.
		 * @constructs
		 * @extends FooTable.Class
		 * @param {number} total - The total number of pages available.
		 * @param {number} current - The current page number.
		 * @param {number} size - The number of rows per page.
		 * @param {number} page - The page number to goto.
		 * @param {boolean} forward - A boolean indicating the direction of paging, TRUE = forward, FALSE = back.
		 * @returns {FooTable.Pager}
		 */
		construct: function(total, current, size, page, forward){
			/**
			 * The total number of pages available.
			 * @type {number}
			 */
			this.total = total;
			/**
			 * The current page number.
			 * @type {number}
			 */
			this.current = current;
			/**
			 * The number of rows per page.
			 * @type {number}
			 */
			this.size = size;
			/**
			 * The page number to goto.
			 * @type {number}
			 */
			this.page = page;
			/**
			 * A boolean indicating the direction of paging, TRUE = forward, FALSE = back.
			 * @type {boolean}
			 */
			this.forward = forward;
		}
	});

})(jQuery, FooTable);
(function($, F){
	F.Paging = F.Component.extend(/** @lends FooTable.Paging */{
		/**
		 * The paging component adds a pagination control to the table allowing users to navigate table rows via pages.
		 * @constructs
		 * @extends FooTable.Component
		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
		 * @returns {FooTable.Filtering}
		 */
		construct: function(table){
			// call the base constructor
			this._super(table, table.o.paging.enabled);

			/* PROTECTED */
			/**
			 * An object containing the strings used by the paging buttons.
			 * @type {{ first: string, prev: string, next: string, last: string }}
			 */
			this.strings = table.o.paging.strings;

			/* PUBLIC */
			/**
			 * The current page number to display.
			 * @instance
			 * @type {number}
			 */
			this.current = table.o.paging.current;
			/**
			 * The number of rows to display per page.
			 * @instance
			 * @type {number}
			 */
			this.size = table.o.paging.size;
			/**
			 * The maximum number of page links to display at once.
			 * @instance
			 * @type {number}
			 */
			this.limit = table.o.paging.limit;
			/**
			 * The position of the pagination control within the paging rows cell.
			 * @instance
			 * @type {string}
			 */
			this.position = table.o.paging.position;
			/**
			 * The format string used to generate the text displayed under the pagination control.
			 * @instance
			 * @type {string}
			 */
			this.countFormat = table.o.paging.countFormat;
			/**
			 * A selector specifying where to place the paging components UI, if null the UI is displayed within a row in the foot of the table.
			 * @instance
			 * @type {string}
			 */
			this.container = table.o.paging.container;
				/**
			 * The total number of pages.
			 * @instance
			 * @type {number}
			 */
			this.total = -1;
			/**
			 * The number of rows in the {@link FooTable.Rows#array} before paging is applied.
			 * @instance
			 * @type {number}
			 */
			this.totalRows = 0;
			/**
			 * A number indicating the previous page displayed.
			 * @instance
			 * @type {number}
			 */
			this.previous = -1;
			/**
			 * The count string generated using the {@link FooTable.Filtering#countFormat} option. This value is only set after the first call to the {@link FooTable.Filtering#predraw} method.
			 * @instance
			 * @type {string}
			 */
			this.formattedCount = null;
			/**
			 * The jQuery object of the element containing the entire paging UI.
			 * @instance
			 * @type {jQuery}
			 */
			this.$container = null;
			/**
			 * The jQuery object of the element wrapping all the paging UI elements.
			 * @instance
			 * @type {jQuery}
			 */
			this.$wrapper = null;
			/** +
			 * The jQuery row object that contains all the paging specific elements.
			 * @instance
			 * @type {jQuery}
			 */
			this.$row = null;
			/**
			 * The jQuery cell object that contains the pagination control and total count.
			 * @instance
			 * @type {jQuery}
			 */
			this.$cell = null;
			/**
			 * The jQuery object that contains the links for the pagination control.
			 * @instance
			 * @type {jQuery}
			 */
			this.$pagination = null;
			/**
			 * The jQuery object that contains the row count.
			 * @instance
			 * @type {jQuery}
			 */
			this.$count = null;
			/**
			 * Whether or not the pagination row is detached from the table.
			 * @instance
			 * @type {boolean}
			 */
			this.detached = true;

			/* PRIVATE */
			/**
			 * Used to hold the number of page links created.
			 * @instance
			 * @type {number}
			 * @private
			 */
			this._createdLinks = 0;
		},

		/* PROTECTED */
		/**
		 * Checks the supplied data and options for the paging component.
		 * @instance
		 * @protected
		 * @param {object} data - The jQuery data object from the parent table.
		 * @fires FooTable.Paging#"preinit.ft.paging"
		 */
		preinit: function(data){
			var self = this;
			/**
			 * The preinit.ft.paging event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
			 * Calling preventDefault on this event will disable the component.
			 * @event FooTable.Paging#"preinit.ft.paging"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {object} data - The jQuery data object of the table raising the event.
			 */
			this.ft.raise('preinit.ft.paging', [data]).then(function(){
				if (self.ft.$el.hasClass('footable-paging'))
					self.enabled = true;
				self.enabled = F.is.boolean(data.paging)
					? data.paging
					: self.enabled;

				if (!self.enabled) return;

				self.size = F.is.number(data.pagingSize)
					? data.pagingSize
					: self.size;

				self.current = F.is.number(data.pagingCurrent)
					? data.pagingCurrent
					: self.current;

				self.limit = F.is.number(data.pagingLimit)
					? data.pagingLimit
					: self.limit;

				if (self.ft.$el.hasClass('footable-paging-left'))
					self.position = 'left';
				if (self.ft.$el.hasClass('footable-paging-center'))
					self.position = 'center';
				if (self.ft.$el.hasClass('footable-paging-right'))
					self.position = 'right';

				self.position = F.is.string(data.pagingPosition)
					? data.pagingPosition
					: self.position;

				self.countFormat = F.is.string(data.pagingCountFormat)
					? data.pagingCountFormat
					: self.countFormat;

				self.container = F.is.string(data.pagingContainer)
					? data.pagingContainer
					: self.container;

				self.total = Math.ceil(self.ft.rows.all.length / self.size);
			}, function(){
				self.enabled = false;
			});
		},
		/**
		 * Initializes the paging component for the plugin using the supplied table and options.
		 * @instance
		 * @protected
		 * @fires FooTable.Paging#"init.ft.paging"
		 */
		init: function(){
			/**
			 * The init.ft.paging event is raised before its UI is generated.
			 * Calling preventDefault on this event will disable the component.
			 * @event FooTable.Paging#"init.ft.paging"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			var self = this;
			this.ft.raise('init.ft.paging').then(function(){
				self.$create();
			}, function(){
				self.enabled = false;
			});
		},
		/**
		 * Destroys the paging component removing any UI generated from the table.
		 * @instance
		 * @protected
		 * @fires FooTable.Paging#"destroy.ft.paging"
		 */
		destroy: function () {
			/**
			 * The destroy.ft.paging event is raised before its UI is removed.
			 * Calling preventDefault on this event will prevent the component from being destroyed.
			 * @event FooTable.Paging#"destroy.ft.paging"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			var self = this;
			this.ft.raise('destroy.ft.paging').then(function(){
				self.ft.$el.removeClass('footable-paging')
					.find('tfoot &gt; tr.footable-paging').remove();
				self.detached = true;
				self._createdLinks = 0;
			});
		},
		/**
		 * Performs the actual paging against the {@link FooTable.Rows#current} array removing all rows that are not on the current visible page.
		 * @instance
		 * @protected
		 */
		predraw: function(){
			this.total = Math.ceil(this.ft.rows.array.length / this.size);
			this.current = this.current &gt; this.total ? this.total : (this.current &lt; 1 ? 1 : this.current);
			this.totalRows = this.ft.rows.array.length;
			if (this.totalRows &gt; this.size){
				this.ft.rows.array = this.ft.rows.array.splice((this.current - 1) * this.size, this.size);
			}
			this.formattedCount = this.format(this.countFormat);
		},
		/**
		 * Updates the paging UI setting the state of the pagination control.
		 * @instance
		 * @protected
		 */
		draw: function(){
			if (this.total &lt;= 1){
				if (!this.detached){
					if (this.$row){
						this.$row.detach();
					} else {
						this.$wrapper.detach();
					}
					this.detached = true;
				}
			} else {
				if (this.detached){
					if (this.$row){
						var $tfoot = this.ft.$el.children('tfoot');
						if ($tfoot.length == 0){
							$tfoot = $('&lt;tfoot/&gt;');
							this.ft.$el.append($tfoot);
						}
						this.$row.appendTo($tfoot);
					} else {
						this.$wrapper.appendTo(this.$container);
					}
					this.detached = false;
				}
				if (F.is.jq(this.$cell)){
					this.$cell.attr('colspan', this.ft.columns.visibleColspan);
				}
				this._createLinks();
				this._setVisible(this.current, this.current &gt; this.previous);
				this._setNavigation(true);
				this.$count.text(this.formattedCount);
			}
		},
		/**
		 * Creates the paging UI from the current options setting the various jQuery properties of this component.
		 * @instance
		 * @protected
		 */
		$create: function(){
			this._createdLinks = 0;
			var position = 'footable-paging-center';
			switch (this.position){
				case 'left': position = 'footable-paging-left'; break;
				case 'right': position = 'footable-paging-right'; break;
			}
			this.ft.$el.addClass('footable-paging').addClass(position);

			this.$container = this.container === null ? null : $(this.container).first();
			if (!F.is.jq(this.$container)){
				var $tfoot = this.ft.$el.children('tfoot');
				if ($tfoot.length == 0){
					$tfoot = $('&lt;tfoot/&gt;');
					this.ft.$el.append($tfoot);
				}
				// add it to a row and then populate it with the search input and column selector dropdown.
				this.$row = $('&lt;tr/&gt;', {'class': 'footable-paging'}).prependTo($tfoot);
				this.$container = this.$cell = $('&lt;td/&gt;').attr('colspan', this.ft.columns.visibleColspan).appendTo(this.$row);
			} else {
				this.$container.addClass('footable-paging-external').addClass(position);
			}
			this.$wrapper = $('&lt;div/&gt;', {'class': 'footable-pagination-wrapper'}).appendTo(this.$container);
			this.$pagination = $('&lt;ul/&gt;', { 'class': 'pagination' }).on('click.footable', 'a.footable-page-link', { self: this }, this._onPageClicked);
			this.$count = $('&lt;span/&gt;', { 'class': 'label label-default' });
			this.$wrapper.append(this.$pagination, $('&lt;div/&gt;', {'class': 'divider'}), this.$count);
			this.detached = false;
		},

		/* PUBLIC */
		/**
		 * @summary Uses the supplied format string and replaces the placeholder strings with the current values.
		 * @description This method is used to generate the short description label for the pagination control. i.e. Showing X of Y records. The placeholders for this string are the following:
		 * * {CP} - The current page number.
		 * * {TP} - The total number of pages.
		 * * {PF} - The first row of the current page.
		 * * {PL} - The last row of the current page.
		 * * {TR} - The total rows available.
		 * These placeholders can be supplied in a string like; "Showing {PF} to {PL} of {TR} rows."
		 * @param {string} formatString - The string to be formatted with the paging specific variables.
		 * @returns {string}
		 */
		format: function(formatString){
			var firstRow = (this.size * (this.current - 1)) + 1,
				lastRow = this.size * this.current;
			if (this.ft.rows.array.length == 0){
				firstRow = 0;
				lastRow = 0;
			} else {
				lastRow = lastRow &gt; this.totalRows ? this.totalRows : lastRow;
			}
			return formatString.replace(/\{CP}/g, this.current)
				.replace(/\{TP}/g, this.total)
				.replace(/\{PF}/g, firstRow)
				.replace(/\{PL}/g, lastRow)
				.replace(/\{TR}/g, this.totalRows);
		},
		/**
		 * Pages to the first page.
		 * @instance
		 * @returns {jQuery.Promise}
		 * @fires FooTable.Paging#"before.ft.paging"
		 * @fires FooTable.Paging#"after.ft.paging"
		 */
		first: function(){
			return this._set(1);
		},
		/**
		 * Pages to the previous page.
		 * @instance
		 * @returns {jQuery.Promise}
		 * @fires FooTable.Paging#"before.ft.paging"
		 * @fires FooTable.Paging#"after.ft.paging"
		 */
		prev: function(){
			return this._set(this.current - 1 &gt; 0 ? this.current - 1 : 1);
		},
		/**
		 * Pages to the next page.
		 * @instance
		 * @returns {jQuery.Promise}
		 * @fires FooTable.Paging#"before.ft.paging"
		 * @fires FooTable.Paging#"after.ft.paging"
		 */
		next: function(){
			return this._set(this.current + 1 &lt; this.total ? this.current + 1 : this.total);
		},
		/**
		 * Pages to the last page.
		 * @instance
		 * @returns {jQuery.Promise}
		 * @fires FooTable.Paging#"before.ft.paging"
		 * @fires FooTable.Paging#"after.ft.paging"
		 */
		last: function(){
			return this._set(this.total);
		},
		/**
		 * Pages to the specified page.
		 * @instance
		 * @param {number} page - The page number to go to.
		 * @returns {jQuery.Promise}
		 * @fires FooTable.Paging#"before.ft.paging"
		 * @fires FooTable.Paging#"after.ft.paging"
		 */
		goto: function(page){
			return this._set(page &gt; this.total ? this.total : (page &lt; 1 ? 1 : page));
		},
		/**
		 * Shows the previous X number of pages in the pagination control where X is the value set by the {@link FooTable.Defaults#paging} - limit option value.
		 * @instance
		 */
		prevPages: function(){
			var page = this.$pagination.children('li.footable-page.visible:first').data('page') - 1;
			this._setVisible(page, true);
			this._setNavigation(false);
		},
		/**
		 * Shows the next X number of pages in the pagination control where X is the value set by the {@link FooTable.Defaults#paging} - limit option value.
		 * @instance
		 */
		nextPages: function(){
			var page = this.$pagination.children('li.footable-page.visible:last').data('page') + 1;
			this._setVisible(page, false);
			this._setNavigation(false);
		},
		/**
		 * Gets or sets the current page size.
		 * @instance
		 * @param {(number|string)} [value] - The new page size to use, this value is supplied to `parseInt` so strings can be used. If not supplied or an invalid valid the current page size is returned.
		 * @returns {(number|undefined)}
		 */
		pageSize: function(value){
			value = parseInt(value);
			if (isNaN(value)){
				return this.size;
			}
			this.size = value;
			this.total = Math.ceil(this.ft.rows.all.length / this.size);
			if (F.is.jq(this.$wrapper)){
				if (this.$container.is("td")){
					this.$row.remove();
				} else {
					this.$wrapper.remove();
				}
			}
			this.$create();
			this.ft.draw();
		},

		/* PRIVATE */
		/**
		 * Performs the required steps to handle paging including the raising of the {@link FooTable.Paging#"before.ft.paging"} and {@link FooTable.Paging#"after.ft.paging"} events.
		 * @instance
		 * @private
		 * @param {number} page - The page to set.
		 * @returns {jQuery.Promise}
		 * @fires FooTable.Paging#"before.ft.paging"
		 * @fires FooTable.Paging#"after.ft.paging"
		 */
		_set: function(page){
			var self = this,
				pager = new F.Pager(self.total, self.current, self.size, page, page &gt; self.current);
			/**
			 * The before.ft.paging event is raised before a sort is applied and allows listeners to modify the pager or cancel it completely by calling preventDefault on the jQuery.Event object.
			 * @event FooTable.Paging#"before.ft.paging"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {FooTable.Pager} pager - The pager that is about to be applied.
			 */
			return self.ft.raise('before.ft.paging', [pager]).then(function(){
				pager.page = pager.page &gt; pager.total ? pager.total	: pager.page;
				pager.page = pager.page &lt; 1 ? 1 : pager.page;
				if (self.current == page) return $.when();
				self.previous = self.current;
				self.current = pager.page;
				return self.ft.draw().then(function(){
					/**
					 * The after.ft.paging event is raised after a pager has been applied.
					 * @event FooTable.Paging#"after.ft.paging"
					 * @param {jQuery.Event} e - The jQuery.Event object for the event.
					 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
					 * @param {FooTable.Pager} pager - The pager that has been applied.
					 */
					self.ft.raise('after.ft.paging', [pager]);
				});
			});
		},
		/**
		 * Creates the pagination links using the current state of the plugin. If the total number of pages is the same as
		 * the last time this function was executed it does nothing.
		 * @instance
		 * @private
		 */
		_createLinks: function(){
			if (this._createdLinks === this.total) return;
			var self = this,
				multiple = self.total &gt; 1,
				link = function(attr, html, klass){
					return $('&lt;li/&gt;', {
						'class': klass
					}).attr('data-page', attr)
						.append($('&lt;a/&gt;', {
							'class': 'footable-page-link',
							href: '#'
						}).data('page', attr).html(html));
				};
			self.$pagination.empty();
			if (multiple) {
				self.$pagination.append(link('first', self.strings.first, 'footable-page-nav'));
				self.$pagination.append(link('prev', self.strings.prev, 'footable-page-nav'));
				if (self.limit &gt; 0 &amp;&amp; self.limit &lt; self.total){
					self.$pagination.append(link('prev-limit', self.strings.prevPages, 'footable-page-nav'));
				}
			}
			for (var i = 0, $li; i &lt; self.total; i++){
				$li = link(i + 1, i + 1, 'footable-page');
				self.$pagination.append($li);
			}
			if (multiple){
				if (self.limit &gt; 0 &amp;&amp; self.limit &lt; self.total){
					self.$pagination.append(link('next-limit', self.strings.nextPages, 'footable-page-nav'));
				}
				self.$pagination.append(link('next', self.strings.next, 'footable-page-nav'));
				self.$pagination.append(link('last', self.strings.last, 'footable-page-nav'));
			}
			self._createdLinks = self.total;
		},
		/**
		 * Sets the state for the navigation links of the pagination control and optionally sets the active class state on the current page link.
		 * @instance
		 * @private
		 * @param {boolean} active - Whether or not to set the active class state on the individual page links.
		 */
		_setNavigation: function(active){
			if (this.current == 1) {
				this.$pagination.children('li[data-page="first"],li[data-page="prev"]').addClass('disabled');
			} else {
				this.$pagination.children('li[data-page="first"],li[data-page="prev"]').removeClass('disabled');
			}

			if (this.current == this.total) {
				this.$pagination.children('li[data-page="next"],li[data-page="last"]').addClass('disabled');
			} else {
				this.$pagination.children('li[data-page="next"],li[data-page="last"]').removeClass('disabled');
			}

			if ((this.$pagination.children('li.footable-page.visible:first').data('page') || 1) == 1) {
				this.$pagination.children('li[data-page="prev-limit"]').addClass('disabled');
			} else {
				this.$pagination.children('li[data-page="prev-limit"]').removeClass('disabled');
			}

			if ((this.$pagination.children('li.footable-page.visible:last').data('page') || this.limit) == this.total) {
				this.$pagination.children('li[data-page="next-limit"]').addClass('disabled');
			} else {
				this.$pagination.children('li[data-page="next-limit"]').removeClass('disabled');
			}

			if (this.limit &gt; 0 &amp;&amp; this.total &lt; this.limit){
				this.$pagination.children('li[data-page="prev-limit"],li[data-page="next-limit"]').css('display', 'none');
			} else {
				this.$pagination.children('li[data-page="prev-limit"],li[data-page="next-limit"]').css('display', '');
			}

			if (active){
				this.$pagination.children('li.footable-page').removeClass('active').filter('li[data-page="' + this.current + '"]').addClass('active');
			}
		},
		/**
		 * Sets the visible page using the supplied parameters.
		 * @instance
		 * @private
		 * @param {number} page - The page to make visible.
		 * @param {boolean} right - If set to true the supplied page will be the right most visible pagination link.
		 */
		_setVisible: function(page, right){
			if (this.limit &gt; 0 &amp;&amp; this.total &gt; this.limit){
				if (!this.$pagination.children('li.footable-page[data-page="'+page+'"]').hasClass('visible')){
					var start = 0, end = 0;
					if (right == true){
						end = page &gt; this.total ? this.total : page;
						start = end - this.limit;
					} else {
						start = page &lt; 1 ? 0 : page - 1;
						end = start + this.limit;
					}
					if (start &lt; 0){
						start = 0;
						end = this.limit &gt; this.total ? this.total : this.limit;
					}
					if (end &gt; this.total){
						end = this.total;
						start = this.total - this.limit &lt; 0 ? 0 : this.total - this.limit;
					}
					this.$pagination.children('li.footable-page').removeClass('visible').slice(start, end).addClass('visible');
				}
			} else {
				this.$pagination.children('li.footable-page').removeClass('visible').slice(0, this.total).addClass('visible');
			}
		},
		/**
		 * Handles the click event for all links in the pagination control.
		 * @instance
		 * @private
		 * @param {jQuery.Event} e - The event object for the event.
		 */
		_onPageClicked: function(e){
			e.preventDefault();
			if ($(e.target).closest('li').is('.active,.disabled')) return;

			var self = e.data.self, page = $(this).data('page');
			switch(page){
				case 'first': self.first();
					return;
				case 'prev': self.prev();
					return;
				case 'next': self.next();
					return;
				case 'last': self.last();
					return;
				case 'prev-limit': self.prevPages();
					return;
				case 'next-limit': self.nextPages();
					return;
				default: self._set(page);
					return;
			}
		}
	});

	F.components.register('paging', F.Paging, 400);

})(jQuery, FooTable);
(function(F){
	/**
	 * An object containing the paging options for the plugin. Added by the {@link FooTable.Paging} component.
	 * @type {object}
	 * @prop {boolean} enabled=false - Whether or not to allow paging on the table.
	 * @prop {string} countFormat="{CP} of {TP}" - A string format used to generate the page count text.
	 * @prop {number} current=1 - The page number to display.
	 * @prop {number} limit=5 - The maximum number of page links to display at once.
	 * @prop {string} position="center" - The string used to specify the alignment of the pagination control.
	 * @prop {number} size=10 - The number of rows displayed per page.
	 * @prop {string} container=null - A selector specifying where to place the paging components UI, if null the UI is displayed within a row in the foot of the table.
	 * @prop {object} strings - An object containing the strings used by the paging buttons.
	 * @prop {string} strings.first="&amp;laquo;" - The string used for the 'first' button.
	 * @prop {string} strings.prev="&amp;lsaquo;" - The string used for the 'previous' button.
	 * @prop {string} strings.next="&amp;rsaquo;" - The string used for the 'next' button.
	 * @prop {string} strings.last="&amp;raquo;" - The string used for the 'last' button.
	 * @prop {string} strings.prevPages="..." - The string used for the 'previous X pages' button.
	 * @prop {string} strings.nextPages="..." - The string used for the 'next X pages' button.
	 */
	F.Defaults.prototype.paging = {
		enabled: false,
		countFormat: '{CP} of {TP}',
		current: 1,
		limit: 5,
		position: 'center',
		size: 10,
		container: null,
		strings: {
			first: '&amp;laquo;',
			prev: '&amp;lsaquo;',
			next: '&amp;rsaquo;',
			last: '&amp;raquo;',
			prevPages: '...',
			nextPages: '...'
		}
	};
})(FooTable);
(function(F){
	/**
	 * Navigates to the specified page number. Added by the {@link FooTable.Paging} component.
	 * @instance
	 * @param {number} num - The page number to go to.
	 * @returns {jQuery.Promise}
	 * @fires FooTable.Paging#paging_changing
	 * @fires FooTable.Paging#paging_changed
	 * @see FooTable.Paging#goto
	 */
	F.Table.prototype.gotoPage = function(num){
		return this.use(F.Paging).goto(num);
	};

	/**
	 * Navigates to the next page. Added by the {@link FooTable.Paging} component.
	 * @instance
	 * @returns {jQuery.Promise}
	 * @fires FooTable.Paging#paging_changing
	 * @fires FooTable.Paging#paging_changed
	 * @see FooTable.Paging#next
	 */
	F.Table.prototype.nextPage = function(){
		return this.use(F.Paging).next();
	};

	/**
	 * Navigates to the previous page. Added by the {@link FooTable.Paging} component.
	 * @instance
	 * @returns {jQuery.Promise}
	 * @fires FooTable.Paging#paging_changing
	 * @fires FooTable.Paging#paging_changed
	 * @see FooTable.Paging#prev
	 */
	F.Table.prototype.prevPage = function(){
		return this.use(F.Paging).prev();
	};

	/**
	 * Navigates to the first page. Added by the {@link FooTable.Paging} component.
	 * @instance
	 * @returns {jQuery.Promise}
	 * @fires FooTable.Paging#paging_changing
	 * @fires FooTable.Paging#paging_changed
	 * @see FooTable.Paging#first
	 */
	F.Table.prototype.firstPage = function(){
		return this.use(F.Paging).first();
	};

	/**
	 * Navigates to the last page. Added by the {@link FooTable.Paging} component.
	 * @instance
	 * @returns {jQuery.Promise}
	 * @fires FooTable.Paging#paging_changing
	 * @fires FooTable.Paging#paging_changed
	 * @see FooTable.Paging#last
	 */
	F.Table.prototype.lastPage = function(){
		return this.use(F.Paging).last();
	};

	/**
	 * Shows the next X number of pages in the pagination control where X is the value set by the {@link FooTable.Defaults#paging} - limit.size option value. Added by the {@link FooTable.Paging} component.
	 * @instance
	 * @see FooTable.Paging#nextPages
	 */
	F.Table.prototype.nextPages = function(){
		return this.use(F.Paging).nextPages();
	};

	/**
	 * Shows the previous X number of pages in the pagination control where X is the value set by the {@link FooTable.Defaults#paging} - limit.size option value. Added by the {@link FooTable.Paging} component.
	 * @instance
	 * @see FooTable.Paging#prevPages
	 */
	F.Table.prototype.prevPages = function(){
		return this.use(F.Paging).prevPages();
	};

	/**
	 * Gets or sets the current page size
	 * @instance
	 * @param {number} [value] - The new page size to use.
	 * @returns {(number|undefined)}
	 * @see FooTable.Paging#pageSize
	 */
	F.Table.prototype.pageSize = function(value){
		return this.use(F.Paging).pageSize(value);
	};
})(FooTable);
(function($, F){

	F.Editing = F.Component.extend(/** @lends FooTable.Editing */{
		/**
		 * The editing component adds a column with edit and delete buttons to each row as well as a single add row button in the footer.
		 * @constructs
		 * @extends FooTable.Component
		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
		 * @returns {FooTable.Editing}
		 */
		construct: function(table){
			// call the base constructor
			this._super(table, table.o.editing.enabled);

			/**
			 * Whether or not to automatically page to a new row when it is added to the table.
			 * @type {boolean}
			 */
			this.pageToNew = table.o.editing.pageToNew;

			/**
			 * Whether or not the editing column and add row button are always visible.
			 * @type {boolean}
			 */
			this.alwaysShow = table.o.editing.alwaysShow;

			/**
			 * The options for the editing column. @see {@link FooTable.EditingColumn} for more info.
			 * @type {object}
			 * @prop {string} classes="footable-editing" - A space separated string of class names to apply to all cells in the column.
			 * @prop {string} name="editing" - The name of the column.
			 * @prop {string} title="" - The title displayed in the header row of the table for the column.
			 * @prop {boolean} filterable=false - Whether or not the column should be filterable when using the filtering component.
			 * @prop {boolean} sortable=false - Whether or not the column should be sortable when using the sorting component.
			 */
			this.column = $.extend(true, {}, table.o.editing.column, {visible: this.alwaysShow});

			/**
			 * The position of the editing column in the table as well as the alignment of the buttons.
			 * @type {string}
			 */
			this.position = table.o.editing.position;


			/**
			 * The text that appears in the show button. This can contain HTML.
			 * @type {string}
			 */
			this.showText = table.o.editing.showText;

			/**
			 * The text that appears in the hide button. This can contain HTML.
			 * @type {string}
			 */
			this.hideText = table.o.editing.hideText;

			/**
			 * The text that appears in the add button. This can contain HTML.
			 * @type {string}
			 */
			this.addText = table.o.editing.addText;

			/**
			 * The text that appears in the edit button. This can contain HTML.
			 * @type {string}
			 */
			this.editText = table.o.editing.editText;

			/**
			 * The text that appears in the delete button. This can contain HTML.
			 * @type {string}
			 */
			this.deleteText = table.o.editing.deleteText;
			
			/**
			 * The text that appears in the view button. This can contain HTML.
			 * @type {string}
			 */
			this.viewText = table.o.editing.viewText;

			/**
			 * Whether or not to show the Add Row button.
			 * @type {boolean}
			 */
			this.allowAdd = table.o.editing.allowAdd;

			/**
			 * Whether or not to show the Edit Row button.
			 * @type {boolean}
			 */
			this.allowEdit = table.o.editing.allowEdit;

			/**
			 * Whether or not to show the Delete Row button.
			 * @type {boolean}
			 */
			this.allowDelete = table.o.editing.allowDelete;

			/**
			 * Whether or not to show the View Row button.
			 * @type {boolean}
			 */
			this.allowView = table.o.editing.allowView;

			/**
			 * Caches the row button elements to help with performance.
			 * @type {(null|jQuery)}
			 * @private
			 */
			this._$buttons = null;

			/**
			 * This object is used to contain the callbacks for the add, edit and delete row buttons.
			 * @type {object}
			 * @prop {function} addRow
			 * @prop {function} editRow
			 * @prop {function} deleteRow
			 * @prop {function} viewRow
			 */
			this.callbacks = {
				addRow: F.checkFnValue(this, table.o.editing.addRow),
				editRow: F.checkFnValue(this, table.o.editing.editRow),
				deleteRow: F.checkFnValue(this, table.o.editing.deleteRow),
				viewRow: F.checkFnValue(this, table.o.editing.viewRow)
			};
		},
		/* PROTECTED */
		/**
		 * Checks the supplied data and options for the editing component.
		 * @instance
		 * @protected
		 * @param {object} data - The jQuery data object from the parent table.
		 * @fires FooTable.Editing#"preinit.ft.editing"
		 */
		preinit: function(data){
			var self = this;
			/**
			 * The preinit.ft.editing event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
			 * Calling preventDefault on this event will disable the component.
			 * @event FooTable.Editing#"preinit.ft.editing"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {object} data - The jQuery data object of the table raising the event.
			 */
			this.ft.raise('preinit.ft.editing', [data]).then(function(){
				if (self.ft.$el.hasClass('footable-editing'))
					self.enabled = true;

				self.enabled = F.is.boolean(data.editing)
					? data.editing
					: self.enabled;

				if (!self.enabled) return;

				self.pageToNew = F.is.boolean(data.editingPageToNew) ? data.editingPageToNew : self.pageToNew;

				self.alwaysShow = F.is.boolean(data.editingAlwaysShow) ? data.editingAlwaysShow : self.alwaysShow;

				self.position = F.is.string(data.editingPosition) ? data.editingPosition : self.position;

				self.showText = F.is.string(data.editingShowText) ? data.editingShowText : self.showText;

				self.hideText = F.is.string(data.editingHideText) ? data.editingHideText : self.hideText;

				self.addText = F.is.string(data.editingAddText) ? data.editingAddText : self.addText;

				self.editText = F.is.string(data.editingEditText) ? data.editingEditText : self.editText;

				self.deleteText = F.is.string(data.editingDeleteText) ? data.editingDeleteText : self.deleteText;

				self.viewText = F.is.string(data.editingViewText) ? data.editingViewText : self.viewText;

				self.allowAdd = F.is.boolean(data.editingAllowAdd) ? data.editingAllowAdd : self.allowAdd;

				self.allowEdit = F.is.boolean(data.editingAllowEdit) ? data.editingAllowEdit : self.allowEdit;

				self.allowDelete = F.is.boolean(data.editingAllowDelete) ? data.editingAllowDelete : self.allowDelete;

				self.allowView = F.is.boolean(data.editingAllowView) ? data.editingAllowView : self.allowView;

				self.column = new F.EditingColumn(self.ft, self, $.extend(true, {}, self.column, data.editingColumn, {visible: self.alwaysShow}));

				if (self.ft.$el.hasClass('footable-editing-left'))
					self.position = 'left';

				if (self.ft.$el.hasClass('footable-editing-right'))
					self.position = 'right';

				if (self.position === 'right'){
					self.column.index = self.ft.columns.array.length;
				} else {
					self.column.index = 0;
					for (var i = 0, len = self.ft.columns.array.length; i &lt; len; i++){
						self.ft.columns.array[i].index += 1;
					}
				}
				self.ft.columns.array.push(self.column);
				self.ft.columns.array.sort(function(a, b){ return a.index - b.index; });

				self.callbacks.addRow = F.checkFnValue(self, data.editingAddRow, self.callbacks.addRow);
				self.callbacks.editRow = F.checkFnValue(self, data.editingEditRow, self.callbacks.editRow);
				self.callbacks.deleteRow = F.checkFnValue(self, data.editingDeleteRow, self.callbacks.deleteRow);
				self.callbacks.viewRow = F.checkFnValue(self, data.editingViewRow, self.callbacks.viewRow);
			}, function(){
				self.enabled = false;
			});
		},
		/**
		 * Initializes the editing component for the plugin using the supplied table and options.
		 * @instance
		 * @protected
		 * @fires FooTable.Editing#"init.ft.editing"
		 */
		init: function(){
			/**
			 * The init.ft.editing event is raised before its UI is generated.
			 * Calling preventDefault on this event will disable the component.
			 * @event FooTable.Editing#"init.ft.editing"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			var self = this;
			this.ft.raise('init.ft.editing').then(function(){
				self.$create();
			}, function(){
				self.enabled = false;
			});
		},
		/**
		 * Destroys the editing component removing any UI generated from the table.
		 * @instance
		 * @protected
		 * @fires FooTable.Editing#"destroy.ft.editing"
		 */
		destroy: function () {
			/**
			 * The destroy.ft.editing event is raised before its UI is removed.
			 * Calling preventDefault on this event will prevent the component from being destroyed.
			 * @event FooTable.Editing#"destroy.ft.editing"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			var self = this;
			this.ft.raise('destroy.ft.editing').then(function(){
				self.ft.$el.removeClass('footable-editing footable-editing-always-show footable-editing-no-add footable-editing-no-edit footable-editing-no-delete footable-editing-no-view')
					.off('click.ft.editing').find('tfoot &gt; tr.footable-editing').remove();
			});
		},
		/**
		 * Creates the editing UI from the current options setting the various jQuery properties of this component.
		 * @instance
		 * @protected
		 */
		$create: function(){
			var self = this, position = self.position === 'right' ? 'footable-editing-right' : 'footable-editing-left';
			self.ft.$el.addClass('footable-editing').addClass(position)
				.on('click.ft.editing', '.footable-show', {self: self}, self._onShowClick)
				.on('click.ft.editing', '.footable-hide', {self: self}, self._onHideClick)
				.on('click.ft.editing', '.footable-edit', {self: self}, self._onEditClick)
				.on('click.ft.editing', '.footable-delete', {self: self}, self._onDeleteClick)
				.on('click.ft.editing', '.footable-view', {self: self}, self._onViewClick)
				.on('click.ft.editing', '.footable-add', {self: self}, self._onAddClick);

			self.$cell = $('&lt;td/&gt;').attr('colspan', self.ft.columns.visibleColspan).append(self.$buttonShow());
			if (self.allowAdd){
				self.$cell.append(self.$buttonAdd());
			}
			self.$cell.append(self.$buttonHide());

			if (self.alwaysShow){
				self.ft.$el.addClass('footable-editing-always-show');
			}

			if (!self.allowAdd) self.ft.$el.addClass('footable-editing-no-add');
			if (!self.allowEdit) self.ft.$el.addClass('footable-editing-no-edit');
			if (!self.allowDelete) self.ft.$el.addClass('footable-editing-no-delete');
			if (!self.allowView) self.ft.$el.addClass('footable-editing-no-view');

			var $tfoot = self.ft.$el.children('tfoot');
			if ($tfoot.length == 0){
				$tfoot = $('&lt;tfoot/&gt;');
				self.ft.$el.append($tfoot);
			}
			self.$row = $('&lt;tr/&gt;', { 'class': 'footable-editing' }).append(self.$cell).appendTo($tfoot);
		},
		/**
		 * Creates the show button for the editing component.
		 * @instance
		 * @protected
		 * @returns {(string|HTMLElement|jQuery)}
		 */
		$buttonShow: function(){
			return '&lt;button type="button" class="btn btn-primary footable-show"&gt;' + this.showText + '&lt;/button&gt;';
		},
		/**
		 * Creates the hide button for the editing component.
		 * @instance
		 * @protected
		 * @returns {(string|HTMLElement|jQuery)}
		 */
		$buttonHide: function(){
			return '&lt;button type="button" class="btn btn-default footable-hide"&gt;' + this.hideText + '&lt;/button&gt;';
		},
		/**
		 * Creates the add button for the editing component.
		 * @instance
		 * @protected
		 * @returns {(string|HTMLElement|jQuery)}
		 */
		$buttonAdd: function(){
			return '&lt;button type="button" class="btn btn-primary footable-add"&gt;' + this.addText + '&lt;/button&gt; ';
		},
		/**
		 * Creates the edit button for the editing component.
		 * @instance
		 * @protected
		 * @returns {(string|HTMLElement|jQuery)}
		 */
		$buttonEdit: function(){
			return '&lt;button type="button" class="btn btn-default footable-edit"&gt;' + this.editText + '&lt;/button&gt; ';
		},
		/**
		 * Creates the delete button for the editing component.
		 * @instance
		 * @protected
		 * @returns {(string|HTMLElement|jQuery)}
		 */
		$buttonDelete: function(){
			return '&lt;button type="button" class="btn btn-default footable-delete"&gt;' + this.deleteText + '&lt;/button&gt;';
		},
		/**
		 * Creates the view button for the editing component.
		 * @instance
		 * @protected
		 * @returns {(string|HTMLElement|jQuery)}
		 */
		$buttonView: function(){
			return '&lt;button type="button" class="btn btn-default footable-view"&gt;' + this.viewText + '&lt;/button&gt; ';
		},
		/**
		 * Creates the button group for the row buttons.
		 * @instance
		 * @protected
		 * @returns {(string|HTMLElement|jQuery)}
		 */
		$rowButtons: function(){
			if (F.is.jq(this._$buttons)) return this._$buttons.clone();
			this._$buttons = $('&lt;div class="btn-group btn-group-xs" role="group"&gt;&lt;/div&gt;');
			if (this.allowView) this._$buttons.append(this.$buttonView());
			if (this.allowEdit) this._$buttons.append(this.$buttonEdit());
			if (this.allowDelete) this._$buttons.append(this.$buttonDelete());
			return this._$buttons;
		},
		/**
		 * Performs the drawing of the component.
		 */
		draw: function(){
			this.$cell.attr('colspan', this.ft.columns.visibleColspan);
		},
		/**
		 * Handles the edit button click event.
		 * @instance
		 * @private
		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
		 * @fires FooTable.Editing#"edit.ft.editing"
		 */
		_onEditClick: function(e){
			e.preventDefault();
			var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
			if (row instanceof F.Row){
				/**
				 * The edit.ft.editing event is raised before its callback is executed.
				 * Calling preventDefault on this event will prevent the callback from being executed.
				 * @event FooTable.Editing#"edit.ft.editing"
				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
				 * @param {FooTable.Row} row - The row to be edited.
				 */
				self.ft.raise('edit.ft.editing', [row]).then(function(){
					self.callbacks.editRow.call(self.ft, row);
				});
			}
		},
		/**
		 * Handles the delete button click event.
		 * @instance
		 * @private
		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
		 * @fires FooTable.Editing#"delete.ft.editing"
		 */
		_onDeleteClick: function(e){
			e.preventDefault();
			var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
			if (row instanceof F.Row){
				/**
				 * The delete.ft.editing event is raised before its callback is executed.
				 * Calling preventDefault on this event will prevent the callback from being executed.
				 * @event FooTable.Editing#"delete.ft.editing"
				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
				 * @param {FooTable.Row} row - The row to be deleted.
				 */
				self.ft.raise('delete.ft.editing', [row]).then(function(){
					self.callbacks.deleteRow.call(self.ft, row);
				});
			}
		},
		/**
		 * Handles the view button click event.
		 * @instance
		 * @private
		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
		 * @fires FooTable.Editing#"view.ft.editing"
		 */
		_onViewClick: function(e){
			e.preventDefault();
			var self = e.data.self, row = $(this).closest('tr').data('__FooTableRow__');
			if (row instanceof F.Row){
				/**
				 * The view.ft.editing event is raised before its callback is executed.
				 * Calling preventDefault on this event will prevent the callback from being executed.
				 * @event FooTable.Editing#"view.ft.editing"
				 * @param {jQuery.Event} e - The jQuery.Event object for the event.
				 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
				 * @param {FooTable.Row} row - The row to be viewed.
				 */
				self.ft.raise('view.ft.editing', [row]).then(function(){
					self.callbacks.viewRow.call(self.ft, row);
				});
			}
		},
		/**
		 * Handles the add button click event.
		 * @instance
		 * @private
		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
		 * @fires FooTable.Editing#"add.ft.editing"
		 */
		_onAddClick: function(e){
			e.preventDefault();
			var self = e.data.self;
			/**
			 * The add.ft.editing event is raised before its callback is executed.
			 * Calling preventDefault on this event will prevent the callback from being executed.
			 * @event FooTable.Editing#"add.ft.editing"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			self.ft.raise('add.ft.editing').then(function(){
				self.callbacks.addRow.call(self.ft);
			});
		},
		/**
		 * Handles the show button click event.
		 * @instance
		 * @private
		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
		 * @fires FooTable.Editing#"show.ft.editing"
		 */
		_onShowClick: function(e){
			e.preventDefault();
			var self = e.data.self;
			/**
			 * The show.ft.editing event is raised before its callback is executed.
			 * Calling preventDefault on this event will prevent the callback from being executed.
			 * @event FooTable.Editing#"show.ft.editing"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			self.ft.raise('show.ft.editing').then(function(){
				self.ft.$el.addClass('footable-editing-show');
				self.column.visible = true;
				self.ft.draw();
			});
		},
		/**
		 * Handles the hide button click event.
		 * @instance
		 * @private
		 * @param {jQuery.Event} e - The jQuery.Event object for the event.
		 * @fires FooTable.Editing#"show.ft.editing"
		 */
		_onHideClick: function(e){
			e.preventDefault();
			var self = e.data.self;
			/**
			 * The hide.ft.editing event is raised before its callback is executed.
			 * Calling preventDefault on this event will prevent the callback from being executed.
			 * @event FooTable.Editing#"hide.ft.editing"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 */
			self.ft.raise('hide.ft.editing').then(function(){
				self.ft.$el.removeClass('footable-editing-show');
				self.column.visible = false;
				self.ft.draw();
			});
		}
	});

	F.components.register('editing', F.Editing, 850);

})(jQuery, FooTable);

(function($, F){

	F.EditingColumn = F.Column.extend(/** @lends FooTable.EditingColumn */{
		/**
		 * The Editing column class is used to create the column containing the editing buttons.
		 * @constructs
		 * @extends FooTable.Column
		 * @param {FooTable.Table} instance -  The parent {@link FooTable.Table} this column belongs to.
		 * @param {FooTable.Editing} editing - The parent {@link FooTable.Editing} component this column is used with.
		 * @param {object} definition - An object containing all the properties to set for the column.
		 * @returns {FooTable.EditingColumn}
		 */
		construct: function(instance, editing, definition){
			this._super(instance, definition, 'editing');
			this.editing = editing;
			this.internal = true;
		},
		/**
		 * After the column has been defined this ensures that the $el property is a jQuery object by either creating or updating the current value.
		 * @instance
		 * @protected
		 * @this FooTable.Column
		 */
		$create: function(){
			(this.$el = !this.virtual &amp;&amp; F.is.jq(this.$el) ? this.$el : $('&lt;th/&gt;', {'class': 'footable-editing'})).html(this.title);
		},
		/**
		 * This is supplied either the cell value or jQuery object to parse. Any value can be returned from this method and
		 * will be provided to the {@link FooTable.EditingColumn#format} function
		 * to generate the cell contents.
		 * @instance
		 * @protected
		 * @param {(*|jQuery)} valueOrElement - The value or jQuery cell object.
		 * @returns {(jQuery)}
		 */
		parser: function(valueOrElement){
			if (F.is.string(valueOrElement)) valueOrElement = $($.trim(valueOrElement));
			if (F.is.element(valueOrElement)) valueOrElement = $(valueOrElement);
			if (F.is.jq(valueOrElement)){
				var tagName = valueOrElement.prop('tagName').toLowerCase();
				if (tagName == 'td' || tagName == 'th') return valueOrElement.data('value') || valueOrElement.contents();
				return valueOrElement;
			}
			return null;
		},
		/**
		 * Creates a cell to be used in the supplied row for this column.
		 * @param {FooTable.Row} row - The row to create the cell for.
		 * @returns {FooTable.Cell}
		 */
		createCell: function(row){
			var $buttons = this.editing.$rowButtons(), $cell = $('&lt;td/&gt;').append($buttons);
			if (F.is.jq(row.$el)){
				if (this.index === 0){
					$cell.prependTo(row.$el);
				} else {
					$cell.insertAfter(row.$el.children().eq(this.index-1));
				}
			}
			return new F.Cell(this.ft, row, this, $cell || $cell.html());
		}
	});

	F.columns.register('editing', F.EditingColumn);

})(jQuery, FooTable);
(function($, F) {

	/**
	 * An object containing the editing options for the plugin. Added by the {@link FooTable.Editing} component.
	 * @type {object}
	 * @prop {boolean} enabled=false - Whether or not to allow editing on the table.
	 * @prop {boolean} pageToNew=true - Whether or not to automatically page to a new row when it is added to the table.
	 * @prop {string} position="right" - The position of the editing column in the table as well as the alignment of the buttons.
	 * @prop {boolean} alwaysShow=false - Whether or not the editing column and add row button are always visible.
	 * @prop {function} addRow - The callback function to execute when the add row button is clicked.
	 * @prop {function} editRow - The callback function to execute when the edit row button is clicked.
	 * @prop {function} deleteRow - The callback function to execute when the delete row button is clicked.
	 * @prop {function} viewRow - The callback function to execute when the view row button is clicked.
	 * @prop {string} showText - The text that appears in the show button. This can contain HTML.
	 * @prop {string} hideText - The text that appears in the hide button. This can contain HTML.
	 * @prop {string} addText - The text that appears in the add button. This can contain HTML.
	 * @prop {string} editText - The text that appears in the edit button. This can contain HTML.
	 * @prop {string} deleteText - The text that appears in the delete button. This can contain HTML.
	 * @prop {string} viewText - The text that appears in the view button. This can contain HTML.
	 * @prop {boolean} allowAdd - Whether or not to show the Add Row button.
	 * @prop {boolean} allowEdit - Whether or not to show the Edit Row button.
	 * @prop {boolean} allowDelete - Whether or not to show the Delete Row button.
	 * @prop {boolean} allowView - Whether or not to show the View Row button.
	 * @prop {object} column - The options for the editing column. @see {@link FooTable.EditingColumn} for more info.
	 * @prop {string} column.classes="footable-editing" - A space separated string of class names to apply to all cells in the column.
	 * @prop {string} column.name="editing" - The name of the column.
	 * @prop {string} column.title="" - The title displayed in the header row of the table for the column.
	 * @prop {boolean} column.filterable=false - Whether or not the column should be filterable when using the filtering component.
	 * @prop {boolean} column.sortable=false - Whether or not the column should be sortable when using the sorting component.
	 */
	F.Defaults.prototype.editing = {
		enabled: false,
		pageToNew: true,
		position: 'right',
		alwaysShow: false,
		addRow: function(){},
		editRow: function(row){},
		deleteRow: function(row){},
		viewRow: function(row){},
		showText: '&lt;span class="fooicon fooicon-pencil" aria-hidden="true"&gt;&lt;/span&gt; Edit rows',
		hideText: 'Cancel',
		addText: 'New row',
		editText: '&lt;span class="fooicon fooicon-pencil" aria-hidden="true"&gt;&lt;/span&gt;',
		deleteText: '&lt;span class="fooicon fooicon-trash" aria-hidden="true"&gt;&lt;/span&gt;',
		viewText: '&lt;span class="fooicon fooicon-stats" aria-hidden="true"&gt;&lt;/span&gt;',
		allowAdd: true,
		allowEdit: true,
		allowDelete: true,
		allowView: false,
		column: {
			classes: 'footable-editing',
			name: 'editing',
			title: '',
			filterable: false,
			sortable: false
		}
	};

})(jQuery, FooTable);

(function($, F){

	if (F.is.defined(F.Paging)){
		/**
		 * Holds a shallow clone of the un-paged {@link FooTable.Rows#array} value before paging occurs and superfluous rows are removed. Added by the {@link FooTable.Editing} component.
		 * @instance
		 * @public
		 * @type {Array&lt;FooTable.Row&gt;}
		 */
		F.Paging.prototype.unpaged = [];

		// override the default predraw method with one that sets the unpaged property.
		F.Paging.extend('predraw', function(){
			this.unpaged = this.ft.rows.array.slice(0); // create a shallow clone for later use
			this._super(); // call the original method
		});
	}

})(jQuery, FooTable);
(function($, F){

	/**
	 * Adds the row to the table.
	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
	 * @returns {jQuery.Deferred}
	 */
	F.Row.prototype.add = function(redraw){
		redraw = F.is.boolean(redraw) ? redraw : true;
		var self = this;
		return $.Deferred(function(d){
			var index = self.ft.rows.all.push(self) - 1;
			if (redraw){
				return self.ft.draw().then(function(){
					d.resolve(index);
				});
			} else {
				d.resolve(index);
			}
		});
	};

	/**
	 * Removes the row from the table.
	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
	 * @returns {jQuery.Deferred}
	 */
	F.Row.prototype.delete = function(redraw){
		redraw = F.is.boolean(redraw) ? redraw : true;
		var self = this;
		return $.Deferred(function(d){
			var index = self.ft.rows.all.indexOf(self);
			if (F.is.number(index) &amp;&amp; index &gt;= 0 &amp;&amp; index &lt; self.ft.rows.all.length){
				self.ft.rows.all.splice(index, 1);
				if (redraw){
					return self.ft.draw().then(function(){
						d.resolve(self);
					});
				}
			}
			d.resolve(self);
		});
	};

	if (F.is.defined(F.Paging)){
		// override the default add method with one that supports paging
		F.Row.extend('add', function(redraw){
			redraw = F.is.boolean(redraw) ? redraw : true;
			var self = this,
				added = this._super(redraw),
				editing = self.ft.use(F.Editing),
				paging;
			if (editing &amp;&amp; editing.pageToNew &amp;&amp; (paging = self.ft.use(F.Paging)) &amp;&amp; redraw){
				return added.then(function(){
					var index = paging.unpaged.indexOf(self); // find this row in the unpaged array (this array will be sorted and filtered)
					var page = Math.ceil((index + 1) / paging.size); // calculate the page the new row is on
					if (paging.current !== page){ // goto the page if we need to
						return paging.goto(page);
					}
				});
			}
			return added;
		});
	}

	if (F.is.defined(F.Sorting)){
		// override the default val method with one that supports sorting and paging
		F.Row.extend('val', function(data, redraw){
			redraw = F.is.boolean(redraw) ? redraw : true;
			var result = this._super(data);
			if (!F.is.hash(data)){
				return result;
			}
			var self = this;
			if (redraw){
				self.ft.draw().then(function(){
					var editing = self.ft.use(F.Editing), paging;
					if (F.is.defined(F.Paging) &amp;&amp; editing &amp;&amp; editing.pageToNew &amp;&amp; (paging = self.ft.use(F.Paging))){
						var index = paging.unpaged.indexOf(self); // find this row in the unpaged array (this array will be sorted and filtered)
						var page = Math.ceil((index + 1) / paging.size); // calculate the page the new row is on
						if (paging.current !== page){ // goto the page if we need to
							return paging.goto(page);
						}
					}
				});
			}
			return result;
		});
	}

})(jQuery, FooTable);
(function(F){

	/**
	 * Adds a row to the underlying {@link FooTable.Rows#all} array.
	 * @param {(object|FooTable.Row)} dataOrRow - A hash containing the row values or an actual {@link FooTable.Row} object.
	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
	 */
	F.Rows.prototype.add = function(dataOrRow, redraw){
		var row = dataOrRow;
		if (F.is.hash(dataOrRow)){
			row = new FooTable.Row(this.ft, this.ft.columns.array, dataOrRow);
		}
		if (row instanceof FooTable.Row){
			row.add(redraw);
		}
	};

	/**
	 * Updates a row in the underlying {@link FooTable.Rows#all} array.
	 * @param {(number|FooTable.Row)} indexOrRow - The index to update or the actual {@link FooTable.Row} object.
	 * @param {object} data - A hash containing the new row values.
	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
	 */
	F.Rows.prototype.update = function(indexOrRow, data, redraw){
		var len = this.ft.rows.all.length, 
			row = indexOrRow;
		if (F.is.number(indexOrRow) &amp;&amp; indexOrRow &gt;= 0 &amp;&amp; indexOrRow &lt; len){
			row = this.ft.rows.all[indexOrRow];
		}
		if (row instanceof FooTable.Row &amp;&amp; F.is.hash(data)){
			row.val(data, redraw);
		}
	};

	/**
	 * Deletes a row from the underlying {@link FooTable.Rows#all} array.
	 * @param {(number|FooTable.Row)} indexOrRow - The index to delete or the actual {@link FooTable.Row} object.
	 * @param {boolean} [redraw=true] - Whether or not to redraw the table, defaults to true but for bulk operations this
	 * can be set to false and then followed by a call to the {@link FooTable.Table#draw} method.
	 */
	F.Rows.prototype.delete = function(indexOrRow, redraw){
		var len = this.ft.rows.all.length, 
			row = indexOrRow;
		if (F.is.number(indexOrRow) &amp;&amp; indexOrRow &gt;= 0 &amp;&amp; indexOrRow &lt; len){
			row = this.ft.rows.all[indexOrRow];
		}
		if (row instanceof FooTable.Row){
			row.delete(redraw);
		}
	};

})(FooTable);

(function($, F){

	// global int to use if the table has no ID
	var _uid = 0,
	// a hash value for the current url
		_url_hash = (function(str){
			var i, l, hval = 0x811c9dc5;
			for (i = 0, l = str.length; i &lt; l; i++) {
				hval ^= str.charCodeAt(i);
				hval += (hval &lt;&lt; 1) + (hval &lt;&lt; 4) + (hval &lt;&lt; 7) + (hval &lt;&lt; 8) + (hval &lt;&lt; 24);
			}
			return hval &gt;&gt;&gt; 0;
		})(location.origin + location.pathname);

	F.State = F.Component.extend(/** @lends FooTable.State */{
		/**
		 * The state component adds the ability for the table to remember its basic state for filtering, paging and sorting.
		 * @constructs
		 * @extends FooTable.Component
		 * @param {FooTable.Table} table - The parent {@link FooTable.Table} object for the component.
		 * @returns {FooTable.State}
		 */
		construct: function(table){
			// call the constructor of the base class
			this._super(table, table.o.state.enabled);
			// Change this value if an update to this component requires any stored data to be reset
			this._key = '1';
			/**
			 * The key to use to store the state for this table.
			 * @type {(null|string)}
			 */
			this.key = this._key + (F.is.string(table.o.state.key) ? table.o.state.key : this._uid());
			/**
			 * Whether or not to allow the filtering component to store it's state.
			 * @type {boolean}
			 */
			this.filtering = F.is.boolean(table.o.state.filtering) ? table.o.state.filtering : true;
			/**
			 * Whether or not to allow the paging component to store it's state.
			 * @type {boolean}
			 */
			this.paging = F.is.boolean(table.o.state.paging) ? table.o.state.paging : true;
			/**
			 * Whether or not to allow the sorting component to store it's state.
			 * @type {boolean}
			 */
			this.sorting = F.is.boolean(table.o.state.sorting) ? table.o.state.sorting : true;
		},
		/* PROTECTED */
		/**
		 * Checks the supplied data and options for the state component.
		 * @instance
		 * @protected
		 * @param {object} data - The jQuery data object from the parent table.
		 * @fires FooTable.State#"preinit.ft.state"
		 * @this FooTable.State
		 */
		preinit: function(data){
			var self = this;
			/**
			 * The preinit.ft.state event is raised before the UI is created and provides the tables jQuery data object for additional options parsing.
			 * Calling preventDefault on this event will disable the component.
			 * @event FooTable.State#"preinit.ft.state"
			 * @param {jQuery.Event} e - The jQuery.Event object for the event.
			 * @param {FooTable.Table} ft - The instance of the plugin raising the event.
			 * @param {object} data - The jQuery data object of the table raising the event.
			 */
			this.ft.raise('preinit.ft.state', [data]).then(function(){

				self.enabled = F.is.boolean(data.state)
					? data.state
					: self.enabled;

				if (!self.enabled) return;

				self.key = self._key + (F.is.string(data.stateKey) ? data.stateKey : self.key);

				self.filtering = F.is.boolean(data.stateFiltering) ? data.stateFiltering : self.filtering;

				self.paging = F.is.boolean(data.statePaging) ? data.statePaging : self.paging;

				self.sorting = F.is.boolean(data.stateSorting) ? data.stateSorting : self.sorting;

			}, function(){
				self.enabled = false;
			});
		},
		/**
		 * Gets the state value for the specified key for this table.
		 * @instance
		 * @param {string} key - The key to get the value for.
		 * @returns {(*|null)}
		 */
		get: function(key){
			return JSON.parse(localStorage.getItem(this.key + ':' + key));
		},
		/**
		 * Sets the state value for the specified key for this table.
		 * @instance
		 * @param {string} key - The key to set the value for.
		 * @param {*} data - The value to store for the key. This value must be JSON.stringify friendly.
		 */
		set: function(key, data){
			localStorage.setItem(this.key + ':' + key, JSON.stringify(data));
		},
		/**
		 * Clears the state value for the specified key for this table.
		 * @instance
		 * @param {string} key - The key to clear the value for.
		 */
		remove: function(key){
			localStorage.removeItem(this.key + ':' + key);
		},
		/**
		 * Executes the {@link FooTable.Component#readState} function on all components.
		 * @instance
		 */
		read: function(){
			this.ft.execute(false, true, 'readState');
		},
		/**
		 * Executes the {@link FooTable.Component#writeState} function on all components.
		 * @instance
		 */
		write: function(){
			this.ft.execute(false, true, 'writeState');
		},
		/**
		 * Executes the {@link FooTable.Component#clearState} function on all components.
		 * @instance
		 */
		clear: function(){
			this.ft.execute(false, true, 'clearState');
		},
		/**
		 * Generates a unique identifier for the current {@link FooTable.Table} if one is not supplied through the options.
		 * This value is a combination of the url hash and either the element ID or an incremented global int value.
		 * @instance
		 * @returns {*}
		 * @private
		 */
		_uid: function(){
			var id = this.ft.$el.attr('id');
			return _url_hash + '_' + (F.is.string(id) ? id : ++_uid);
		}
	});

	F.components.register('state', F.State, 700);

})(jQuery, FooTable);
(function(F){

	/**
	 * This method is called from the {@link FooTable.State#read} method and allows a component to retrieve its' stored state.
	 * @instance
	 * @protected
	 * @function
	 */
	F.Component.prototype.readState = function(){};

	/**
	 * This method is called from the {@link FooTable.State#write} method and allows a component to write its' current state to the store.
	 * @instance
	 * @protected
	 * @function
	 */
	F.Component.prototype.writeState = function(){};

	/**
	 * This method is called from the {@link FooTable.State#clear} method and allows a component to clear any stored state.
	 * @instance
	 * @protected
	 * @function
	 */
	F.Component.prototype.clearState = function(){};

})(FooTable);
(function(F){

	/**
	 * An object containing the state options for the plugin. Added by the {@link FooTable.State} component.
	 * @type {object}
	 * @prop {boolean} enabled=false - Whether or not to allow state to be stored for the table. This overrides the individual component enable options.
	 * @prop {boolean} filtering=true - Whether or not to allow the filtering state to be stored.
	 * @prop {boolean} paging=true - Whether or not to allow the filtering state to be stored.
	 * @prop {boolean} sorting=true - Whether or not to allow the filtering state to be stored.
	 * @prop {string} key=null - The unique key to use to store the table's data.
	 */
	F.Defaults.prototype.state = {
		enabled: false,
		filtering: true,
		paging: true,
		sorting: true,
		key: null
	};

})(FooTable);
(function(F){

	if (!F.Filtering) return;

	/**
	 * Allows the filtering component to retrieve its' stored state.
	 */
	F.Filtering.prototype.readState = function(){
		if (this.ft.state.filtering){
			var state = this.ft.state.get('filtering');
			if (F.is.hash(state) &amp;&amp; !F.is.emptyArray(state.filters)){
				this.filters = this.ensure(state.filters);
			}
		}
	};

	/**
	 * Allows the filtering component to write its' current state to the store.
	 */
	F.Filtering.prototype.writeState = function(){
		if (this.ft.state.filtering) {
			var filters = F.arr.map(this.filters, function (f) {
				return {
					name: f.name,
					query: f.query instanceof F.Query ? f.query.val() : f.query,
					columns: F.arr.map(f.columns, function (c) {
						return c.name;
					}),
					hidden: f.hidden,
					space: f.space,
					connectors: f.connectors,
					ignoreCase: f.ignoreCase
				};
			});
			this.ft.state.set('filtering', {filters: filters});
		}
	};

	/**
	 * Allows the filtering component to clear any stored state.
	 */
	F.Filtering.prototype.clearState = function(){
		if (this.ft.state.filtering) {
			this.ft.state.remove('filtering');
		}
	};

})(FooTable);
(function(F){

	if (!F.Paging) return;

	/**
	 * Allows the paging component to retrieve its' stored state.
	 */
	F.Paging.prototype.readState = function(){
		if (this.ft.state.paging) {
			var state = this.ft.state.get('paging');
			if (F.is.hash(state)) {
				this.current = state.current;
				this.size = state.size;
			}
		}
	};

	/**
	 * Allows the paging component to write its' current state to the store.
	 */
	F.Paging.prototype.writeState = function(){
		if (this.ft.state.paging) {
			this.ft.state.set('paging', {
				current: this.current,
				size: this.size
			});
		}
	};

	/**
	 * Allows the paging component to clear any stored state.
	 */
	F.Paging.prototype.clearState = function(){
		if (this.ft.state.paging) {
			this.ft.state.remove('paging');
		}
	};

})(FooTable);
(function(F){

	if (!F.Sorting) return;

	/**
	 * Allows the sorting component to retrieve its' stored state.
	 */
	F.Sorting.prototype.readState = function(){
		if (this.ft.state.sorting) {
			var state = this.ft.state.get('sorting');
			if (F.is.hash(state)) {
				var column = this.ft.columns.get(state.column);
				if (column instanceof F.Column) {
					this.column = column;
					this.column.direction = state.direction;
				}
			}
		}
	};

	/**
	 * Allows the sorting component to write its' current state to the store.
	 */
	F.Sorting.prototype.writeState = function(){
		if (this.ft.state.sorting &amp;&amp; this.column instanceof F.Column){
			this.ft.state.set('sorting', {
				column: this.column.name,
				direction: this.column.direction
			});
		}
	};

	/**
	 * Allows the sorting component to clear any stored state.
	 */
	F.Sorting.prototype.clearState = function(){
		if (this.ft.state.sorting) {
			this.ft.state.remove('sorting');
		}
	};

})(FooTable);
(function(F){

	// hook into the _construct method so we can add the state property to the table.
	F.Table.extend('_construct', function(ready){
		this.state = this.use(FooTable.State);
		return this._super(ready);
	});

	// hook into the _preinit method so we can trigger a plugin wide read state operation.
	F.Table.extend('_preinit', function(){
		var self = this;
		return self._super().then(function(){
			if (self.state.enabled){
				self.state.read();
			}
		});
	});

	// hook into the draw method so we can trigger a plugin wide write state operation.
	F.Table.extend('draw', function(){
		var self = this;
		return self._super().then(function(){
			if (self.state.enabled){
				self.state.write();
			}
		});
	});

})(FooTable);
(function($, F){

	F.Export = F.Component.extend(/** @lends FooTable.Export */{
		/**
		 * @summary This component provides some basic export functionality.
		 * @memberof FooTable
		 * @constructs Export
		 * @param {FooTable.Table} table - The current instance of the plugin.
		 */
		construct: function(table){
			// call the constructor of the base class
			this._super(table, true);
			/**
			 * @summary A snapshot of the working set of rows prior to being trimmed by the paging component.
			 * @memberof FooTable.Export#
			 * @name snapshot
			 * @type {FooTable.Row[]}
			 */
			this.snapshot = [];
		},
		/**
		 * @summary Hooks into the predraw pipeline after sorting and filtering have taken place but prior to paging.
		 * @memberof FooTable.Export#
		 * @function predraw
		 * @description This method allows us to take a snapshot of the working set of rows before they are trimmed by the paging component and is called by the plugin instance.
		 */
		predraw: function(){
			this.snapshot = this.ft.rows.array.slice(0);
		},
		/**
		 * @summary Return the columns as simple JavaScript objects in an array.
		 * @memberof FooTable.Export#
		 * @function columns
		 * @returns {Object[]}
		 */
		columns: function(){
			var result = [];
			F.arr.each(this.ft.columns.array, function(column){
				if (!column.internal){
					result.push({
						type: column.type,
						name: column.name,
						title: column.title,
						visible: column.visible,
						hidden: column.hidden,
						classes: column.classes,
						style: column.style
					});
				}
			});
			return result;
		},
		/**
		 * @summary Return the rows as simple JavaScript objects in an array.
		 * @memberof FooTable.Export#
		 * @function rows
		 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
		 * @returns {Object[]}
		 */
		rows: function(filtered){
			filtered = F.is.boolean(filtered) ? filtered : false;
			var rows = filtered ? this.ft.rows.all : this.snapshot, result = [];
			F.arr.each(rows, function(row){
				result.push(row.val());
			});
			return result;
		},
		/**
		 * @summary Return the columns and rows as a properly formatted JSON object.
		 * @memberof FooTable.Export#
		 * @function json
		 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
		 * @returns {Object}
		 */
		json: function(filtered){
			return JSON.parse(JSON.stringify({columns: this.columns(),rows: this.rows(filtered)}));
		},
		/**
		 * @summary Return the columns and rows as a properly formatted CSV value.
		 * @memberof FooTable.Export#
		 * @function csv
		 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
		 * @returns {string}
		 */
		csv: function(filtered){
			var csv = "", columns = this.columns(), value, escaped;
			F.arr.each(columns, function(column, i){
				escaped = '"' + column.title.replace(/"/g, '""') + '"';
				csv += (i === 0 ? escaped : "," + escaped);
			});
			csv += "\n";

			var rows = filtered ? this.ft.rows.all : this.snapshot;
			F.arr.each(rows, function(row){
				F.arr.each(row.cells, function(cell, i){
					if (!cell.column.internal){
						value = cell.column.stringify.call(cell.column, cell.value, cell.ft.o, cell.row.value);
						escaped = '"' + value.replace(/"/g, '""') + '"';
						csv += (i === 0 ? escaped : "," + escaped);
					}
				});
				csv += "\n";
			});
			return csv;
		}
	});

	// register the component using a priority of 490 which falls just after filtering (500) and before paging (400).
	F.components.register("export", F.Export, 490);

})(jQuery, FooTable);
(function(F){
	// this is used to define the filtering specific properties on column creation
	F.Column.prototype.__export_define__ = function(definition){
		this.stringify = F.checkFnValue(this, definition.stringify, this.stringify);
	};

	// overrides the public define method and replaces it with our own
	F.Column.extend('define', function(definition){
		this._super(definition); // call the base so we don't have to redefine any previously set properties
		this.__export_define__(definition); // then call our own
	});

	/**
	 * @summary Return the supplied value as a string.
	 * @memberof FooTable.Column#
	 * @function stringify
	 * @returns {string}
	 */
	F.Column.prototype.stringify = function(value, options, rowData){
		return value + "";
	};

	// override the base method for DateColumns
	F.DateColumn.prototype.stringify = function(value, options, rowData){
		return F.is.object(value) &amp;&amp; F.is.boolean(value._isAMomentObject) &amp;&amp; value.isValid() ? value.format(this.formatString) : '';
	};

	// override the base method for ObjectColumns
	F.ObjectColumn.prototype.stringify = function(value, options, rowData){
		return F.is.object(value) ? JSON.stringify(value) : "";
	};

	// override the base method for ArrayColumns
	F.ArrayColumn.prototype.stringify = function(value, options, rowData){
		return F.is.array(value) ? JSON.stringify(value) : "";
	};

})(FooTable);
(function(F){
	/**
	 * @summary Return the columns and rows as a properly formatted JSON object.
	 * @memberof FooTable.Table#
	 * @function toJSON
	 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
	 * @returns {Object}
	 */
	F.Table.prototype.toJSON = function(filtered){
		return this.use(F.Export).json(filtered);
	};

	/**
	 * @summary Return the columns and rows as a properly formatted CSV value.
	 * @memberof FooTable.Table#
	 * @function toCSV
	 * @param {boolean} [filtered=false] - Whether or not to exclude filtered rows from the result.
	 * @returns {string}
	 */
	F.Table.prototype.toCSV = function(filtered){
		return this.use(F.Export).csv(filtered);
	};

})(FooTable);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:68:"/local/templates/aspro_max/vendor/js/ResizeSensor.js?171141775711190";s:6:"source";s:52:"/local/templates/aspro_max/vendor/js/ResizeSensor.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
'use strict';

/**
 * Copyright Marc J. Schmidt. See the LICENSE file at the top-level
 * directory of this distribution and at
 * https://github.com/marcj/css-element-queries/blob/master/LICENSE.
 */
(function (root, factory) {
    if (typeof define === "function" &amp;&amp; define.amd) {
        define(factory);
    } else if (typeof exports === "object") {
        module.exports = factory();
    } else {
        root.ResizeSensor = factory();
    }
}(typeof window !== 'undefined' ? window : this, function () {

    // Make sure it does not throw in a SSR (Server Side Rendering) situation
    if (typeof window === "undefined") {
        return null;
    }
    // https://github.com/Semantic-Org/Semantic-UI/issues/3855
    // https://github.com/marcj/css-element-queries/issues/257
    var globalWindow = typeof window != 'undefined' &amp;&amp; window.Math == Math
        ? window
        : typeof self != 'undefined' &amp;&amp; self.Math == Math
            ? self
            : Function('return this')();
    // Only used for the dirty checking, so the event callback count is limited to max 1 call per fps per sensor.
    // In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and
    // would generate too many unnecessary events.
    var requestAnimationFrame = globalWindow.requestAnimationFrame ||
        globalWindow.mozRequestAnimationFrame ||
        globalWindow.webkitRequestAnimationFrame ||
        function (fn) {
            return globalWindow.setTimeout(fn, 20);
        };

    /**
     * Iterate over each of the provided element(s).
     *
     * @param {HTMLElement|HTMLElement[]} elements
     * @param {Function}                  callback
     */
    function forEachElement(elements, callback){
        var elementsType = Object.prototype.toString.call(elements);
        var isCollectionTyped = ('[object Array]' === elementsType
            || ('[object NodeList]' === elementsType)
            || ('[object HTMLCollection]' === elementsType)
            || ('[object Object]' === elementsType)
            || ('undefined' !== typeof jQuery &amp;&amp; elements instanceof jQuery) //jquery
            || ('undefined' !== typeof Elements &amp;&amp; elements instanceof Elements) //mootools
        );
        var i = 0, j = elements.length;
        if (isCollectionTyped) {
            for (; i &lt; j; i++) {
                callback(elements[i]);
            }
        } else {
            callback(elements);
        }
    }

    /**
    * Get element size
    * @param {HTMLElement} element
    * @returns {Object} {width, height}
    */
    function getElementSize(element) {
        if (!element.getBoundingClientRect) {
            return {
                width: element.offsetWidth,
                height: element.offsetHeight
            }
        }

        var rect = element.getBoundingClientRect();
        return {
            width: Math.round(rect.width),
            height: Math.round(rect.height)
        }
    }

    /**
     * Apply CSS styles to element.
     *
     * @param {HTMLElement} element
     * @param {Object} style
     */
    function setStyle(element, style) {
        Object.keys(style).forEach(function(key) {
            element.style[key] = style[key];
        });
    }

    /**
     * Class for dimension change detection.
     *
     * @param {Element|Element[]|Elements|jQuery} element
     * @param {Function} callback
     *
     * @constructor
     */
    var ResizeSensor = function(element, callback) {
        /**
         *
         * @constructor
         */
        function EventQueue() {
            var q = [];
            this.add = function(ev) {
                q.push(ev);
            };

            var i, j;
            this.call = function(sizeInfo) {
                for (i = 0, j = q.length; i &lt; j; i++) {
                    q[i].call(this, sizeInfo);
                }
            };

            this.remove = function(ev) {
                var newQueue = [];
                for(i = 0, j = q.length; i &lt; j; i++) {
                    if(q[i] !== ev) newQueue.push(q[i]);
                }
                q = newQueue;
            };

            this.length = function() {
                return q.length;
            }
        }

        /**
         *
         * @param {HTMLElement} element
         * @param {Function}    resized
         */
        function attachResizeEvent(element, resized) {
            if (!element) return;
            if (element.resizedAttached) {
                element.resizedAttached.add(resized);
                return;
            }

            element.resizedAttached = new EventQueue();
            element.resizedAttached.add(resized);

            element.resizeSensor = document.createElement('div');
            element.resizeSensor.dir = 'ltr';
            element.resizeSensor.className = 'resize-sensor';

            var style = {
                pointerEvents: 'none',
                position: 'absolute',
                left: '0px',
                top: '0px',
                right: '0px',
                bottom: '0px',
                overflow: 'hidden',
                zIndex: '-1',
                visibility: 'hidden',
                maxWidth: '100%'
            };
            var styleChild = {
                position: 'absolute',
                left: '0px',
                top: '0px',
                transition: '0s',
            };

            setStyle(element.resizeSensor, style);

            var expand = document.createElement('div');
            expand.className = 'resize-sensor-expand';
            setStyle(expand, style);

            var expandChild = document.createElement('div');
            setStyle(expandChild, styleChild);
            expand.appendChild(expandChild);

            var shrink = document.createElement('div');
            shrink.className = 'resize-sensor-shrink';
            setStyle(shrink, style);

            var shrinkChild = document.createElement('div');
            setStyle(shrinkChild, styleChild);
            setStyle(shrinkChild, { width: '200%', height: '200%' });
            shrink.appendChild(shrinkChild);

            element.resizeSensor.appendChild(expand);
            element.resizeSensor.appendChild(shrink);
            element.appendChild(element.resizeSensor);

            var computedStyle = window.getComputedStyle(element);
            var position = computedStyle ? computedStyle.getPropertyValue('position') : null;
            if ('absolute' !== position &amp;&amp; 'relative' !== position &amp;&amp; 'fixed' !== position) {
                element.style.position = 'relative';
            }

            var dirty, rafId;
            var size = getElementSize(element);
            var lastWidth = 0;
            var lastHeight = 0;
            var initialHiddenCheck = true;
            var lastAnimationFrame = 0;

            var resetExpandShrink = function () {
                var width = element.offsetWidth;
                var height = element.offsetHeight;

                expandChild.style.width = (width + 10) + 'px';
                expandChild.style.height = (height + 10) + 'px';

                expand.scrollLeft = width + 10;
                expand.scrollTop = height + 10;

                shrink.scrollLeft = width + 10;
                shrink.scrollTop = height + 10;
            };

            var reset = function() {
                // Check if element is hidden
                if (initialHiddenCheck) {
                    var invisible = element.offsetWidth === 0 &amp;&amp; element.offsetHeight === 0;
                    if (invisible) {
                        // Check in next frame
                        if (!lastAnimationFrame){
                            lastAnimationFrame = requestAnimationFrame(function(){
                                lastAnimationFrame = 0;

                                reset();
                            });
                        }

                        return;
                    } else {
                        // Stop checking
                        initialHiddenCheck = false;
                    }
                }

                resetExpandShrink();
            };
            element.resizeSensor.resetSensor = reset;

            var onResized = function() {
                rafId = 0;

                if (!dirty) return;

                lastWidth = size.width;
                lastHeight = size.height;

                if (element.resizedAttached) {
                    element.resizedAttached.call(size);
                }
            };

            var onScroll = function() {
                size = getElementSize(element);
                dirty = size.width !== lastWidth || size.height !== lastHeight;

                if (dirty &amp;&amp; !rafId) {
                    rafId = requestAnimationFrame(onResized);
                }

                reset();
            };

            var addEvent = function(el, name, cb) {
                if (el.attachEvent) {
                    el.attachEvent('on' + name, cb);
                } else {
                    el.addEventListener(name, cb);
                }
            };

            addEvent(expand, 'scroll', onScroll);
            addEvent(shrink, 'scroll', onScroll);

            // Fix for custom Elements
            requestAnimationFrame(reset);
        }

        forEachElement(element, function(elem){
            attachResizeEvent(elem, callback);
        });

        this.detach = function(ev) {
            ResizeSensor.detach(element, ev);
        };

        this.reset = function() {
            element.resizeSensor.resetSensor();
        };
    };

    ResizeSensor.reset = function(element) {
        forEachElement(element, function(elem){
            elem.resizeSensor.resetSensor();
        });
    };

    ResizeSensor.detach = function(element, ev) {
        forEachElement(element, function(elem){
            if (!elem) return;
            if(elem.resizedAttached &amp;&amp; typeof ev === "function"){
                elem.resizedAttached.remove(ev);
                if(elem.resizedAttached.length()) return;
            }
            if (elem.resizeSensor) {
                if (elem.contains(elem.resizeSensor)) {
                    elem.removeChild(elem.resizeSensor);
                }
                delete elem.resizeSensor;
                delete elem.resizedAttached;
            }
        });
    };

    if (typeof MutationObserver !== "undefined") {
        var observer = new MutationObserver(function (mutations) {
            for (var i in mutations) {
                if (mutations.hasOwnProperty(i)) {
                    var items = mutations[i].addedNodes;
                    for (var j = 0; j &lt; items.length; j++) {
                        if (items[j].resizeSensor) {
                            ResizeSensor.reset(items[j]);
                        }
                    }
                }
            }
        });

        document.addEventListener("DOMContentLoaded", function (event) {
            observer.observe(document.body, {
                childList: true,
                subtree: true,
            });
        });
    }

    return ResizeSensor;

}));

/* End */
;
; /* Start:"a:4:{s:4:"full";s:74:"/local/templates/aspro_max/vendor/js/sticky-sidebar.min.js?171141775711546";s:6:"source";s:54:"/local/templates/aspro_max/vendor/js/sticky-sidebar.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
!function(t,e){"object"==typeof exports&amp;&amp;"undefined"!=typeof module?e(exports):"function"==typeof define&amp;&amp;define.amd?define(["exports"],e):e(t.StickySidebar={})}(this,function(t){"use strict";"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&amp;&amp;self;var e,i,n=(function(t,e){(function(t){function n(t,e){for(var i=0;i&lt;e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&amp;&amp;(n.writable=!0),Object.defineProperty(t,n.key,n)}}Object.defineProperty(t,"__esModule",{value:!0});var c,o,e=(o={topSpacing:0,bottomSpacing:0,containerSelector:!(c=".stickySidebar"),innerWrapperSelector:".inner-wrapper-sticky",stickyClass:"is-affixed",resizeSensor:!0,minWidth:!1},function(t,e,i){return e&amp;&amp;n(t.prototype,e),i&amp;&amp;n(t,i),t}(l,[{key:"initialize",value:function(){var i=this;if(this._setSupportFeatures(),this.options.innerWrapperSelector&amp;&amp;(this.sidebarInner=this.sidebar.querySelector(this.options.innerWrapperSelector),null===this.sidebarInner&amp;&amp;(this.sidebarInner=!1)),!this.sidebarInner){var t=document.createElement("div");for(t.setAttribute("class","inner-wrapper-sticky"),this.sidebar.appendChild(t);this.sidebar.firstChild!=t;)t.appendChild(this.sidebar.firstChild);this.sidebarInner=this.sidebar.querySelector(".inner-wrapper-sticky")}if(this.options.containerSelector){var e=document.querySelectorAll(this.options.containerSelector);if((e=Array.prototype.slice.call(e)).forEach(function(t,e){t.contains(i.sidebar)&amp;&amp;(i.container=t)}),!e.length)throw new Error("The container does not contains on the sidebar.")}"function"!=typeof this.options.topSpacing&amp;&amp;(this.options.topSpacing=parseInt(this.options.topSpacing)||0),"function"!=typeof this.options.bottomSpacing&amp;&amp;(this.options.bottomSpacing=parseInt(this.options.bottomSpacing)||0),this._widthBreakpoint(),this.calcDimensions(),this.stickyPosition(),this.bindEvents(),this._initialized=!0}},{key:"bindEvents",value:function(){window.addEventListener("resize",this,{passive:!0,capture:!1}),window.addEventListener("scroll",this,{passive:!0,capture:!1}),this.sidebar.addEventListener("update"+c,this),this.options.resizeSensor&amp;&amp;"undefined"!=typeof ResizeSensor&amp;&amp;(new ResizeSensor(this.sidebarInner,this.handleEvent),new ResizeSensor(this.container,this.handleEvent))}},{key:"handleEvent",value:function(t){this.updateSticky(t)}},{key:"calcDimensions",value:function(){if(!this._breakpoint){var t=this.dimensions;t.containerTop=l.offsetRelative(this.container).top,t.containerHeight=this.container.clientHeight,t.containerBottom=t.containerTop+t.containerHeight,t.sidebarHeight=this.sidebarInner.offsetHeight,t.sidebarWidth=this.sidebarInner.offsetWidth,t.viewportHeight=window.innerHeight,t.maxTranslateY=t.containerHeight-t.sidebarHeight,this._calcDimensionsWithScroll()}}},{key:"_calcDimensionsWithScroll",value:function(){var t=this.dimensions;t.sidebarLeft=l.offsetRelative(this.sidebar).left,t.viewportTop=document.documentElement.scrollTop||document.body.scrollTop,t.viewportBottom=t.viewportTop+t.viewportHeight,t.viewportLeft=document.documentElement.scrollLeft||document.body.scrollLeft,t.topSpacing=this.options.topSpacing,t.bottomSpacing=this.options.bottomSpacing,"function"==typeof t.topSpacing&amp;&amp;(t.topSpacing=parseInt(t.topSpacing(this.sidebar))||0),"function"==typeof t.bottomSpacing&amp;&amp;(t.bottomSpacing=parseInt(t.bottomSpacing(this.sidebar))||0),"VIEWPORT-TOP"===this.affixedType?t.topSpacing&lt;t.lastTopSpacing&amp;&amp;(t.translateY+=t.lastTopSpacing-t.topSpacing,this._reStyle=!0):"VIEWPORT-BOTTOM"===this.affixedType&amp;&amp;t.bottomSpacing&lt;t.lastBottomSpacing&amp;&amp;(t.translateY+=t.lastBottomSpacing-t.bottomSpacing,this._reStyle=!0),t.lastTopSpacing=t.topSpacing,t.lastBottomSpacing=t.bottomSpacing}},{key:"isSidebarFitsViewport",value:function(){var t=this.dimensions,e="down"===this.scrollDirection?t.lastBottomSpacing:t.lastTopSpacing;return this.dimensions.sidebarHeight+e&lt;this.dimensions.viewportHeight}},{key:"observeScrollDir",value:function(){var t=this.dimensions;if(t.lastViewportTop!==t.viewportTop){var e="down"===this.direction?Math.min:Math.max;t.viewportTop===e(t.viewportTop,t.lastViewportTop)&amp;&amp;(this.direction="down"===this.direction?"up":"down")}}},{key:"getAffixType",value:function(){this._calcDimensionsWithScroll();var t=this.dimensions,e=t.viewportTop+t.topSpacing,i=this.affixedType;return i=e&lt;=t.containerTop||t.containerHeight&lt;t.sidebarHeight?(t.translateY=0,"STATIC"):"up"===this.direction?this._getAffixTypeScrollingUp():this._getAffixTypeScrollingDown(),t.translateY=Math.max(0,t.translateY),t.translateY=Math.min(t.containerHeight,t.translateY),t.translateY=Math.round(t.translateY),t.lastViewportTop=t.viewportTop,i}},{key:"_getAffixTypeScrollingDown",value:function(){var t=this.dimensions,e=t.sidebarHeight+t.containerTop,i=t.viewportTop+t.topSpacing,n=t.viewportBottom-t.bottomSpacing,o=this.affixedType;return this.isSidebarFitsViewport()?t.sidebarHeight+i&gt;=t.containerBottom?(t.translateY=t.containerBottom-e,o="CONTAINER-BOTTOM"):i&gt;=t.containerTop&amp;&amp;(t.translateY=i-t.containerTop,o="VIEWPORT-TOP"):t.containerBottom&lt;=n?(t.translateY=t.containerBottom-e,o="CONTAINER-BOTTOM"):e+t.translateY&lt;=n?(t.translateY=n-e,o="VIEWPORT-BOTTOM"):t.containerTop+t.translateY&lt;=i&amp;&amp;0!==t.translateY&amp;&amp;t.maxTranslateY!==t.translateY&amp;&amp;(o="VIEWPORT-UNBOTTOM"),o}},{key:"_getAffixTypeScrollingUp",value:function(){var t=this.dimensions,e=t.sidebarHeight+t.containerTop,i=t.viewportTop+t.topSpacing,n=t.viewportBottom-t.bottomSpacing,o=this.affixedType;return i&lt;=t.translateY+t.containerTop?(t.translateY=i-t.containerTop,o="VIEWPORT-TOP"):t.containerBottom&lt;=n?(t.translateY=t.containerBottom-e,o="CONTAINER-BOTTOM"):this.isSidebarFitsViewport()||t.containerTop&lt;=i&amp;&amp;0!==t.translateY&amp;&amp;t.maxTranslateY!==t.translateY&amp;&amp;(o="VIEWPORT-UNBOTTOM"),o}},{key:"_getStyle",value:function(t){if(void 0!==t){var e={inner:{},outer:{}},i=this.dimensions;switch(t){case"VIEWPORT-TOP":e.inner={position:"fixed",top:i.topSpacing,left:i.sidebarLeft-i.viewportLeft,width:i.sidebarWidth};break;case"VIEWPORT-BOTTOM":e.inner={position:"fixed",top:"auto",left:i.sidebarLeft,bottom:i.bottomSpacing,width:i.sidebarWidth};break;case"CONTAINER-BOTTOM":case"VIEWPORT-UNBOTTOM":var n=this._getTranslate(0,i.translateY+"px");e.inner=n?{transform:n}:{position:"absolute",top:i.translateY,width:i.sidebarWidth}}switch(t){case"VIEWPORT-TOP":case"VIEWPORT-BOTTOM":case"VIEWPORT-UNBOTTOM":case"CONTAINER-BOTTOM":e.outer={height:i.sidebarHeight,position:"relative"}}return e.outer=l.extend({height:"",position:""},e.outer),e.inner=l.extend({position:"relative",top:"",left:"",bottom:"",width:"",transform:""},e.inner),e}}},{key:"stickyPosition",value:function(t){if(!this._breakpoint){t=this._reStyle||t||!1,this.options.topSpacing,this.options.bottomSpacing;var e=this.getAffixType(),i=this._getStyle(e);if((this.affixedType!=e||t)&amp;&amp;e){var n="affix."+e.toLowerCase().replace("viewport-","")+c;for(var o in l.eventTrigger(this.sidebar,n),"STATIC"===e?l.removeClass(this.sidebar,this.options.stickyClass):l.addClass(this.sidebar,this.options.stickyClass),i.outer){var s="number"==typeof i.outer[o]?"px":"";this.sidebar.style[o]=i.outer[o]+s}for(var r in i.inner){var a="number"==typeof i.inner[r]?"px":"";this.sidebarInner.style[r]=i.inner[r]+a}var p="affixed."+e.toLowerCase().replace("viewport-","")+c;l.eventTrigger(this.sidebar,p)}else this._initialized&amp;&amp;(this.sidebarInner.style.left=i.inner.left);this.affixedType=e}}},{key:"_widthBreakpoint",value:function(){window.innerWidth&lt;=this.options.minWidth?(this._breakpoint=!0,this.affixedType="STATIC",this.sidebar.removeAttribute("style"),l.removeClass(this.sidebar,this.options.stickyClass),this.sidebarInner.removeAttribute("style")):this._breakpoint=!1}},{key:"updateSticky",value:function(t){var e,i=this,n=0&lt;arguments.length&amp;&amp;void 0!==t?t:{};this._running||(this._running=!0,e=n.type,requestAnimationFrame(function(){switch(e){case"scroll":i._calcDimensionsWithScroll(),i.observeScrollDir(),i.stickyPosition();break;case"resize":default:i._widthBreakpoint(),i.calcDimensions(),i.stickyPosition(!0)}i._running=!1}))}},{key:"_setSupportFeatures",value:function(){var t=this.support;t.transform=l.supportTransform(),t.transform3d=l.supportTransform(!0)}},{key:"_getTranslate",value:function(t,e,i){var n=0&lt;arguments.length&amp;&amp;void 0!==t?t:0,o=1&lt;arguments.length&amp;&amp;void 0!==e?e:0,s=2&lt;arguments.length&amp;&amp;void 0!==i?i:0;return this.support.transform3d?"translate3d("+n+", "+o+", "+s+")":!!this.support.translate&amp;&amp;"translate("+n+", "+o+")"}},{key:"destroy",value:function(){window.removeEventListener("resize",this,{capture:!1}),window.removeEventListener("scroll",this,{capture:!1}),this.sidebar.classList.remove(this.options.stickyClass),this.sidebar.style.minHeight="",this.sidebar.removeEventListener("update"+c,this);var t={inner:{},outer:{}};for(var e in t.inner={position:"",top:"",left:"",bottom:"",width:"",transform:""},t.outer={height:"",position:""},t.outer)this.sidebar.style[e]=t.outer[e];for(var i in t.inner)this.sidebarInner.style[i]=t.inner[i];this.options.resizeSensor&amp;&amp;"undefined"!=typeof ResizeSensor&amp;&amp;(ResizeSensor.detach(this.sidebarInner,this.handleEvent),ResizeSensor.detach(this.container,this.handleEvent))}}],[{key:"supportTransform",value:function(t){var i=!1,e=t?"perspective":"transform",n=e.charAt(0).toUpperCase()+e.slice(1),o=document.createElement("support").style;return(e+" "+["Webkit","Moz","O","ms"].join(n+" ")+n).split(" ").forEach(function(t,e){if(void 0!==o[t])return i=t,!1}),i}},{key:"eventTrigger",value:function(t,e,i){try{var n=new CustomEvent(e,{detail:i})}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i)}t.dispatchEvent(n)}},{key:"extend",value:function(t,e){var i={};for(var n in t)void 0!==e[n]?i[n]=e[n]:i[n]=t[n];return i}},{key:"offsetRelative",value:function(t){var e={left:0,top:0};do{var i=t.offsetTop,n=t.offsetLeft;isNaN(i)||(e.top+=i),isNaN(n)||(e.left+=n),t="BODY"===t.tagName?t.parentElement:t.offsetParent}while(t);return e}},{key:"addClass",value:function(t,e){l.hasClass(t,e)||(t.classList?t.classList.add(e):t.className+=" "+e)}},{key:"removeClass",value:function(t,e){l.hasClass(t,e)&amp;&amp;(t.classList?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\b)"+e.split(" ").join("|")+"(\\b|$)","gi")," "))}},{key:"hasClass",value:function(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)}},{key:"defaults",get:function(){return o}}]),l);function l(t){var e=this,i=1&lt;arguments.length&amp;&amp;void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l),this.options=l.extend(o,i),this.sidebar="string"==typeof t?document.querySelector(t):t,void 0===this.sidebar)throw new Error("There is no specific sidebar element.");this.sidebarInner=!1,this.container=this.sidebar.parentElement,this.affixedType="STATIC",this.direction="down",this.support={transform:!1,transform3d:!1},this._initialized=!1,this._reStyle=!1,this._breakpoint=!1,this.dimensions={translateY:0,maxTranslateY:0,topSpacing:0,lastTopSpacing:0,bottomSpacing:0,lastBottomSpacing:0,sidebarHeight:0,sidebarWidth:0,containerTop:0,containerHeight:0,viewportHeight:0,viewportTop:0,lastViewportTop:0},["handleEvent"].forEach(function(t){e[t]=e[t].bind(e)}),this.initialize()}t.default=e,window.StickySidebar=e})(e)}(e={exports:{}},e.exports),e.exports),o=(i=n)&amp;&amp;i.__esModule&amp;&amp;Object.prototype.hasOwnProperty.call(i,"default")?i.default:i;t.default=o,t.__moduleExports=n,Object.defineProperty(t,"__esModule",{value:!0})});
/* End */
;
; /* Start:"a:4:{s:4:"full";s:68:"/local/templates/aspro_max/js/jquery.validate.min.js?171194855022254";s:6:"source";s:52:"/local/templates/aspro_max/js/jquery.validate.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/*! jQuery Validation Plugin - v1.13.1 - 10/14/2014
 * http://jqueryvalidation.org/
 * Copyright (c) 2014 JÃ¶rn Zaefferer; Licensed MIT */
!function(a){"function"==typeof define&amp;&amp;define.amd?define(["jquery"],a):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&amp;&amp;b.debug&amp;&amp;window.console&amp;&amp;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&amp;&amp;(this.validateDelegate(":submit","click",function(b){c.settings.submitHandler&amp;&amp;(c.submitButton=b.target),a(b.target).hasClass("cancel")&amp;&amp;(c.cancelSubmit=!0),void 0!==a(b.target).attr("formnovalidate")&amp;&amp;(c.cancelSubmit=!0)}),this.submit(function(b){function d(){var d,e;return c.settings.submitHandler?(c.submitButton&amp;&amp;(d=a("&lt;input type='hidden'/&gt;").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&amp;&amp;d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&amp;&amp;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(this)&amp;&amp;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&amp;&amp;(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&amp;&amp;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&amp;&amp;(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&amp;&amp;(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&gt;2&amp;&amp;c.constructor!==Array&amp;&amp;(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&amp;&amp;(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&amp;&amp;(this.settings.unhighlight&amp;&amp;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)&amp;&amp;this.optional(a)||this.element(a)},onkeyup:function(a,b){(9!==b.which||""!==this.elementValue(a))&amp;&amp;(a.name in this.submitted||a===this.lastElement)&amp;&amp;this.element(a)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&amp;&amp;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]&amp;&amp;!this.is(e.ignore)&amp;&amp;e[d].call(c,this[0],b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&amp;&amp;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&amp;&amp;(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&amp;&amp;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)),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&amp;&amp;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&amp;&amp;this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&amp;&amp;1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&amp;&amp;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&amp;&amp;b.settings.debug&amp;&amp;window.console&amp;&amp;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&amp;&amp;"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&amp;&amp;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&amp;&amp;window.console&amp;&amp;console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j}}if(!h)return this.objectLength(f)&amp;&amp;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&amp;&amp;(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a&lt;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&amp;&amp;b.title||void 0,a.validator.messages[c],"&lt;strong&gt;Warning: No message defined for "+b.name+"&lt;/strong&gt;")},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)&amp;&amp;(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&amp;&amp;(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&amp;&amp;this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&amp;&amp;(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("&lt;"+this.settings.errorElement+"&gt;").attr("id",h+"-error").addClass(this.settings.errorClass).html(c||""),d=g,this.settings.wrapper&amp;&amp;(d=g.hide().show().wrap("&lt;"+this.settings.wrapper+"/&gt;").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&amp;&amp;(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.name],e&amp;&amp;a.each(this.groups,function(b,c){c===e&amp;&amp;a("[name='"+b+"']",this.currentForm).attr("aria-describedby",g.attr("id"))}))),!c&amp;&amp;this.settings.success&amp;&amp;(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&amp;&amp;(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)&amp;&amp;(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);return!a.validator.methods.required.call(this,c,b)&amp;&amp;"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest&lt;0&amp;&amp;(this.pendingRequest=0),delete this.pending[b.name],c&amp;&amp;0===this.pendingRequest&amp;&amp;this.formSubmitted&amp;&amp;this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&amp;&amp;0===this.pendingRequest&amp;&amp;this.formSubmitted&amp;&amp;(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&amp;&amp;a.each(d.split(" "),function(){this in a.validator.classRuleSettings&amp;&amp;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&amp;&amp;(d=!0),d=!!d):d=f.attr(c),/min|max/.test(c)&amp;&amp;(null===g||/number|range|text/.test(g))&amp;&amp;(d=Number(d)),d||0===d?e[c]=d:g===c&amp;&amp;"range"!==g&amp;&amp;(e[c]=!0);return e.maxlength&amp;&amp;/-1|2147483647|524288/.test(e.maxlength)&amp;&amp;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&amp;&amp;(e[c]=d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&amp;&amp;(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]&amp;&amp;(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&amp;&amp;(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&amp;&amp;(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&amp;&amp;(null!=b.min&amp;&amp;null!=b.max&amp;&amp;(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&amp;&amp;null!=b.maxlength&amp;&amp;(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&lt;3&amp;&amp;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&amp;&amp;e.length&gt;0}return this.checkable(c)?this.getLength(b,c)&gt;0:a.trim(b).length&gt;0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&amp;'*+\/=?^_`{|}~-]+@[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})|[!\$&amp;'\(\)\*\+,;=]|:)*@)?(((\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})|[!\$&amp;'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&amp;'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&amp;'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&amp;'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/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(' ');if(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)&amp;&amp;(xdata.getUTCMonth()===mm-1)&amp;&amp;(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&lt;13||a.length&gt;19)return!1;for(c=a.length-1;c&gt;=0;c--)d=a.charAt(c),f=parseInt(d,10),g&amp;&amp;(f*=2)&gt;9&amp;&amp;(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&gt;=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||d&gt;=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e&gt;=d[0]&amp;&amp;e&lt;=d[1]},min:function(a,b,c){return this.optional(b)||a&gt;=c},max:function(a,b,c){return this.optional(b)||c&gt;=a},range:function(a,b,c){return this.optional(b)||a&gt;=c[0]&amp;&amp;a&lt;=c[1]},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&amp;&amp;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&amp;&amp;{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&amp;&amp;(c[e]&amp;&amp;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]&amp;&amp;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})}})});
/* End */
;
; /* Start:"a:4:{s:4:"full";s:72:"/local/templates/aspro_max/js/aspro_animate_open_fancy.js?17119485501865";s:6:"source";s:57:"/local/templates/aspro_max/js/aspro_animate_open_fancy.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
function retrieveScale(btn) {
	var btnRadius = btn.width()/2,
		left = btn.offset().left + btnRadius,
		top = btn.offset().top + btnRadius - $(window).scrollTop(),
		scale = scaleValue(top, left, btnRadius, $(window).height(), $(window).width());

	btn.css('position', 'fixed').velocity({
		top: top - btnRadius,
		left: left - btnRadius,
		translateX: 0,
	}, 0);

	return scale;
}

function scaleValue( topValue, leftValue, radiusValue, windowW, windowH) {
	var maxDistHor = ( leftValue &gt; windowW/2) ? leftValue : (windowW - leftValue),
		maxDistVert = ( topValue &gt; windowH/2) ? topValue : (windowH - topValue);
	return Math.ceil(Math.sqrt( Math.pow(maxDistHor, 2) + Math.pow(maxDistVert, 2) )/radiusValue);
}

function animateLayer(layer, scaleVal, bool) {
	layer.velocity({ scale: scaleVal }, 400, function(){
		$('body').toggleClass('overflow-hidden', bool);
		(bool)
			? layer.parents('.cd-section').addClass('modal-is-visible').end().off('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend')
			: layer.removeClass('is-visible').removeAttr( 'style' ).siblings('[data-type="modal-trigger"]').removeClass('to-circle');
	});
}

function updateLayer() {
	var layer = $('.cd-section.modal-is-visible .cd-modal-bg'),
		layerRadius = layer.width()/2,
		layerTop = layer.siblings('.btn').offset().top + layerRadius - $(window).scrollTop(),
		layerLeft = layer.siblings('.btn').offset().left + layerRadius,
		scale = scaleValue(layerTop, layerLeft, layerRadius, $(window).height(), $(window).width());

	layer.velocity({
		top: layerTop - layerRadius,
		left: layerLeft - layerRadius,
		scale: scale,
	}, 0);
}

function closeModal() {
	$('.cd-modal-bg').fadeOut();
	animateLayer($('.cd-modal-bg'), 1, false);
	//$('.cd-modal-bg').removeAttr('style');
	//setTimeout(function(){
		$('.cd-modal-bg').removeClass('is-visible');
	//}, 510);
}
/* End */
;
; /* Start:"a:4:{s:4:"full";s:76:"/local/templates/aspro_max/js/jquery.inputmask.bundle.min.js?171141774770933";s:6:"source";s:60:"/local/templates/aspro_max/js/jquery.inputmask.bundle.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
!function(e){function t(n){if(i[n])return i[n].exports;var a=i[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var i={};t.m=e,t.c=i,t.d=function(e,i,n){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var i=e&amp;&amp;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&amp;&amp;Symbol.iterator,a=[i(2)],void 0!==(r="function"==typeof(n=function(e){return e})?n.apply(t,a):n)&amp;&amp;(e.exports=r)},function(e,t,i){"use strict";var n,a,r,o="function"==typeof Symbol&amp;&amp;"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&amp;&amp;"function"==typeof Symbol&amp;&amp;e.constructor===Symbol&amp;&amp;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&amp;&amp;(e.isPlainObject(t)?i=t:(i=i||{},t&amp;&amp;(i.alias=t)),this.opts=e.extend(!0,{},this.defaults,i),this.noMasksCache=i&amp;&amp;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&amp;&amp;r(s.alias,n,o),e.extend(!0,o,s),e.extend(!0,o,i),!0):(null===o.mask&amp;&amp;(o.mask=t),!1)}function s(t,i){function r(t,r,o){var s=!1;if(null!==t&amp;&amp;""!==t||((s=null!==o.regex)?t=(t=o.regex).replace(/^(\^)(.*)(\$)$/,"$2"):(s=!0,t=".*")),1===t.length&amp;&amp;!1===o.greedy&amp;&amp;0!==o.repeat&amp;&amp;(o.placeholder=""),o.repeat&gt;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&amp;&amp;(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)&amp;&amp;(t.mask=t.mask(t)),e.isArray(t.mask)){if(t.mask.length&gt;1){if(null===t.keepStatic){t.keepStatic="auto";for(var o=0;o&lt;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&gt;1&amp;&amp;(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&amp;&amp;t.mask.mask!==n&amp;&amp;!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&amp;&amp;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&lt;u||"number"==typeof c.jitMasking&amp;&amp;isFinite(c.jitMasking)&amp;&amp;c.jitMasking&gt;l)&amp;&amp;s.push(!1===i?r.nativeDef:N(l,r))),"auto"===c.keepStatic&amp;&amp;r.newBlockMarker&amp;&amp;null!==r.fn&amp;&amp;(c.keepStatic=l-1),l++}while(($===n||l&lt;$)&amp;&amp;(null!==r.fn||""!==r.def)||t&gt;l);return""===s[s.length-1]&amp;&amp;s.pop(),!1===i&amp;&amp;h().maskLength!==n||(h().maskLength=l-1),s}function h(){return s}function g(e){var t=h();t.buffer=n,!0!==e&amp;&amp;(t.validPositions={},t.p=0)}function v(e,t,i){var a=-1,r=-1,o=i||h().validPositions;e===n&amp;&amp;(e=-1);for(var s in o){var l=parseInt(s);o[l]&amp;&amp;(t||!0!==o[l].generatedInput)&amp;&amp;(l&lt;=e&amp;&amp;(a=l),l&gt;=e&amp;&amp;(r=l))}return-1!==a&amp;&amp;e-a&gt;1||r&lt;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&gt;=s;o--)h().validPositions[o]!==n&amp;&amp;(!0!==a&amp;&amp;(!h().validPositions[o].match.optionality&amp;&amp;function(e){var t=h().validPositions[e];if(t!==n&amp;&amp;null===t.match.fn){var i=h().validPositions[e-1],a=h().validPositions[e+1];return i!==n&amp;&amp;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&lt;=v();){for(;h().validPositions[s]!==n;)s++;if(o&lt;s&amp;&amp;(o=s+1),h().validPositions[o]===n&amp;&amp;j(o))o++;else{var p=P(o);!1===u&amp;&amp;l[s]&amp;&amp;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)&amp;&amp;(delete h().validPositions[o],o++,u=!0):j(o)||(o++,s--),s++}}if(!0!==r)for(o=v(-1,!0);h().validPositions[o]&amp;&amp;!0===h().validPositions[o].generatedInput;)delete h().validPositions[o--];g(!0)}function y(e,t,i){for(var a,r=S(e=e&gt;0?e-1:0),o=r.alternation!==n?r.locator[r.alternation].toString().split(","):[],s=0;s&lt;t.length&amp;&amp;(!((a=t[s]).match&amp;&amp;(c.greedy&amp;&amp;!0!==a.match.optionalQuantifier||(!1===a.match.optionality||!1===a.match.newBlockMarker)&amp;&amp;!0!==a.match.optionalQuantifier)&amp;&amp;(r.alternation===n||r.alternation!==a.alternation||a.locator[r.alternation]!==n&amp;&amp;D(a.locator[r.alternation].toString().split(","),o)))||!0===i&amp;&amp;(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&amp;&amp;t.length&gt;0&amp;&amp;(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&lt;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&lt;n.length;a++)if(n[a].match&amp;&amp;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&amp;&amp;(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])&amp;&amp;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&lt;o)&amp;&amp;-1!==l&amp;&amp;(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&lt;r;a++)if("-"===e.charAt(a))for(i=e.charCodeAt(a+1);++t&lt;i;)n.push(String.fromCharCode(t));else t=e.charCodeAt(a),n.push(e.charAt(a));return n.join("")}return c.regex&amp;&amp;null!==e.match.fn&amp;&amp;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&amp;&amp;-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&amp;&amp;(i=i.split(",")[0]),e.mloc[i]===n&amp;&amp;(e.mloc[i]=e.locator.slice()),t!==n){for(var a in t.mloc)"string"==typeof a&amp;&amp;(a=a.split(",")[0]),e.mloc[a]===n&amp;&amp;(e.mloc[a]=t.mloc[a]);e.locator[e.alternation]=Object.keys(e.mloc).join(",")}return!0}e.alternation=n}return!1}if(f&gt;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&amp;&amp;s.matches===n)return d.push({match:s,locator:l.reverse(),cd:v,mloc:{}}),!0;if(s.matches!==n){if(s.isGroup&amp;&amp;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&gt;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&lt;S.matches.length;w++)_.push(w.toString());if(h().excludes[t]){for(var j=_.slice(),F=0,T=h().excludes[t].length;F&lt;T;F++)_.splice(_.indexOf(h().excludes[t][F].toString()),1);0===_.length&amp;&amp;(h().excludes[t]=n,_=j)}(!0===c.keepStatic||isFinite(parseInt(c.keepStatic))&amp;&amp;D&gt;=c.keepStatic)&amp;&amp;(_=_.slice(0,1));for(var R=0;R&lt;_.length;R++){w=parseInt(_[R]),d=[],a=k(f,w,M)||O.slice(),S.matches[w]&amp;&amp;u(S.matches[w],[w].concat(l),p)&amp;&amp;(s=!0),P=d.slice(),f=D,d=[];for(var N=0;N&lt;P.length;N++){var G=P[N],B=!1;G.alternation=G.alternation||M,b(G);for(var I=0;I&lt;A.length;I++){var L=A[I];if("string"!=typeof E||G.alternation!==n&amp;&amp;-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)&amp;&amp;(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&amp;&amp;null!==z.match.fn&amp;&amp;z.match.fn.test(U.match.def,h(),t,!1,c,!1)){b(G,L)&amp;&amp;(B=!0,A.splice(A.indexOf(L),0,G));break}}}B||A.push(G)}}d=C.concat(A),f=t,g=d.length&gt;0,s=A.length&gt;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&amp;&amp;p!==i.matches[e.inArray(s,i.matches)-1])for(var H=s,V=a.length&gt;0?a.shift():0;V&lt;(isNaN(H.quantifier.max)?V+1:H.quantifier.max)&amp;&amp;f&lt;=t;V++){var K=i.matches[e.inArray(H,i.matches)-1];if(s=u(K,[V].concat(l),K)){if((o=d[d.length-1].match).optionalQuantifier=V&gt;H.quantifier.min-1,m(o,K)){if(V&gt;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&gt;0?a.shift():0;p&lt;i.matches.length;p++)if(!0!==i.matches[p].isQuantifier){var m=u(i.matches[p],[p].concat(s),l);if(m&amp;&amp;f===t)return m;if(f&gt;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&gt;-1){if(i===n){for(var k,b=t-1;(k=h().validPositions[b]||h().tests[b])===n&amp;&amp;b&gt;-1;)b--;k!==n&amp;&amp;b&gt;-1&amp;&amp;(s=b,l=k,u=[],e.isArray(l)||(l=[l]),l.length&gt;0&amp;&amp;(l[0].alternation===n?0===(u=y(s,l.slice()).locator.slice()).length&amp;&amp;(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&lt;u.length;i++)t.locator[i]&amp;&amp;-1===u[i].toString().indexOf(t.locator[i])&amp;&amp;(u[i]+=","+t.locator[i])})),v=(m=u).join(""),f=b)}if(h().tests[t]&amp;&amp;h().tests[t][0].cd===v)return h().tests[t];for(var x=m.shift();x&lt;p.length&amp;&amp;!(r(p[x],m,[x])&amp;&amp;f===t||f&gt;t);x++);}return(0===d.length||g)&amp;&amp;d.push({match:{fn:null,optionality:!0,casing:null,def:"",placeholder:""},locator:[],mloc:{},cd:v}),i!==n&amp;&amp;h().tests[t]?e.extend(!0,[],d):(h().tests[t]=e.extend(!0,[],d),h().tests[t])}function M(){return h()._buffer===n&amp;&amp;(h()._buffer=d(!1,1),h().buffer===n&amp;&amp;(h().buffer=h()._buffer.slice())),h()._buffer}function E(e){return h().buffer!==n&amp;&amp;!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&lt;t;a++)delete h().validPositions[a];for(r=e,a=e;a&lt;t;a++)if(g(!0),i[a]!==c.skipOptionalPartCharacter){var o=_(r,i[a],!0,!0);!1!==o&amp;&amp;(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&lt;l.length;u++)-1!==(r=t.indexOf(l[u]))&amp;&amp;t.splice(r,1);for(var p=0;p&lt;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&amp;&amp;o===n)l=(p=S(s=0)).alternation;else for(;x&gt;=0;x--)if((u=h().validPositions[x])&amp;&amp;u.alternation!==n){if(p&amp;&amp;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&amp;&amp;h().excludes[d].push(b(p));var P=[],A=0;for(f=d;f&lt;v(n,!0)+1;f++)(m=h().validPositions[f])&amp;&amp;!0!==m.generatedInput&amp;&amp;/[0-9a-bA-Z]/.test(m.input)?P.push(m.input):f&lt;t&amp;&amp;A++,delete h().validPositions[f];for(;h().excludes[d]&amp;&amp;h().excludes[d].length&lt;10;){var C=-1*A,M=P.slice();for(h().tests[d]=n,g(!0),y=!0;M.length&gt;0;){var E=M.shift();if(E!==c.skipOptionalPartCharacter&amp;&amp;!(y=_(v(n,!0)+1,E,!1,r,!0)))break}if(y&amp;&amp;i!==n){var w=v(t)+1;for(f=d;f&lt;v()+1;f++)((m=h().validPositions[f])===n||null==m.match.fn)&amp;&amp;f&lt;t+C&amp;&amp;C++;y=_((t+=C)&gt;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&lt;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&gt;1||e.begin-e.end==1:e.end-e.begin&gt;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)&amp;&amp;""!==d.def&amp;&amp;{c:N(i,d,!0)||d.def,pos:i})){var y=l.c!==n?l.c:r;y=y===c.skipOptionalPartCharacter&amp;&amp;null===d.fn?N(i,d,!0)||d.def:y;var b=i,x=E();if(l.remove!==n&amp;&amp;(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&amp;&amp;(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&amp;&amp;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&amp;&amp;l.pos!==n&amp;&amp;l.pos!==i&amp;&amp;(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)&amp;&amp;(p&gt;0&amp;&amp;g(!0),m(b,e.extend({},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&amp;&amp;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&gt;0&amp;&amp;!h().validPositions[t];t--);for(var o=t;o&lt;i;o++)if(h().validPositions[o]===n&amp;&amp;!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&amp;&amp;c.pop(),e.each(c,function(e,t){l=x(t,u.length);var i=Math.abs(l-u);(p===n||i&lt;p)&amp;&amp;null===t.match.fn&amp;&amp;!0!==t.match.optionality&amp;&amp;!0!==t.match.optionalQuantifier&amp;&amp;(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&amp;&amp;h().validPositions[t]!==n&amp;&amp;a===n){var o,s=e.extend(!0,{},h().validPositions),l=v(n,!0);for(o=t;o&lt;=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&lt;=l;o++){var k=s[o];if(k!==n)for(var y=u;""!==S(y).match.def&amp;&amp;(null===k.match.fn&amp;&amp;m[o]&amp;&amp;(!0===m[o].match.optionalQuantifier||!0===m[o].match.optionality)||null!=k.match.fn);){if(y++,!1===d&amp;&amp;s[y]&amp;&amp;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)&amp;&amp;""===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&amp;&amp;(d=X&amp;&amp;!u(t)?t.end:t.begin);var y=!0,b=e.extend(!0,{},h().validPositions);if(e.isFunction(c.preValidation)&amp;&amp;!r&amp;&amp;!0!==o&amp;&amp;!0!==l&amp;&amp;(y=c.preValidation(E(),d,i,u(t),c)),!0===y){if(f(n,d,!0),u(t)&amp;&amp;(K(0,a.keyCode.DELETE,t,!0,!0),d=h().p),($===n||d&lt;$)&amp;&amp;(y=p(d,i,r),(!r||!0===o)&amp;&amp;!1===y&amp;&amp;!0!==l)){var P=h().validPositions[d];if(!P||null!==P.match.fn||P.match.def!==i&amp;&amp;i!==c.skipOptionalPartCharacter){if((c.insertMode||h().validPositions[F(d)]===n)&amp;&amp;!j(d,!0))for(var M=d+1,D=F(d);M&lt;=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&amp;&amp;(y={pos:d})}if(e.isFunction(c.postValidation)&amp;&amp;!1!==y&amp;&amp;!r&amp;&amp;!0!==o&amp;&amp;!0!==l){var T=c.postValidation(E(!0),y,c);if(T!==n){if(T.refreshFromBuffer&amp;&amp;T.buffer){var R=T.refreshFromBuffer;w(!0===R?R:R.start,R.end,T.buffer)}y=!0===T?y:T}}return y&amp;&amp;y.pos===n&amp;&amp;(y.pos=d),!1!==y&amp;&amp;!0!==l||(g(!0),h().validPositions=e.extend(!0,{},b)),y}function j(e,t){var i=P(e).match;if(""===i.def&amp;&amp;(i=S(e).match),null!=i.fn)return i.fn;if(!0!==t&amp;&amp;e&gt;-1){var n=C(e);return n.length&gt;1+(""===n[n.length-1].match.def?1:0)}return!1}function F(e,t){for(var i=e+1;""!==S(i).match.def&amp;&amp;(!0===t&amp;&amp;(!0!==S(i).match.newBlockMarker||!j(i))||!0!==t&amp;&amp;!j(i));)i++;return i}function T(e,t){var i,n=e;if(n&lt;=0)return 0;for(;--n&gt;0&amp;&amp;(!0===t&amp;&amp;!0!==S(n).match.newBlockMarker||!0!==t&amp;&amp;!j(n)&amp;&amp;((i=C(n)).length&lt;2||2===i.length&amp;&amp;""===i[1].match.def)););return n}function R(t,i,a,r,o){if(r&amp;&amp;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&amp;&amp;(a=s.caret!==n?s.caret:a)}}t!==n&amp;&amp;(t.inputmask._valueSet(i.join("")),a===n||r!==n&amp;&amp;"blur"===r.type?z(t,a,0===i.length):I(t,a),!0===o&amp;&amp;(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&gt;-1&amp;&amp;h().validPositions[t]===n){var r,o=C(t),s=[];if(o.length&gt;1+(""===o[o.length-1].match.def?1:0))for(var l=0;l&lt;o.length;l++)if(!0!==o[l].match.optionality&amp;&amp;!0!==o[l].match.optionalQuantifier&amp;&amp;(null===o[l].match.fn||r===n||!1!==o[l].match.fn.test(r.match.def,h(),t,!0,c))&amp;&amp;(s.push(o[l]),null===o[l].match.fn&amp;&amp;(r=o[l]),s.length&gt;1&amp;&amp;/[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&amp;&amp;k.length&gt;0&amp;&amp;(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&amp;&amp;l[i]===N(i)&amp;&amp;j(i,!0)&amp;&amp;!1===_(i,l[i],!0,n,n,!0))h().p++;else{var o=new e.Event("_checkval");o.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)&amp;&amp;(" "!==S(y).match.nativeDef||S(y+1).match.nativeDef!==b.charAt(0))||r||c.autoUnmask){var k=r?i:null==g.match.fn&amp;&amp;g.match.optionality&amp;&amp;s+1&lt;h().p?s+1:h().p;(f=oe.keypressEvent.call(t,o,!0,!1,r,k))&amp;&amp;(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&amp;&amp;R(t,E(),f?f.forwardPosition:n,s||new e.Event("checkval"),s&amp;&amp;"input"===s.type)}function B(t){if(t){if(t.inputmask===n)return t.value;t.inputmask&amp;&amp;t.inputmask.refreshValue&amp;&amp;oe.setValueEvent.call(t)}var i=[],a=h().validPositions;for(var r in a)a[r].match&amp;&amp;null!=a[r].match.fn&amp;&amp;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&amp;&amp;""===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&amp;&amp;u.commonAncestorContainer!==a||(r=u.startOffset,o=u.endOffset):i.selection&amp;&amp;i.selection.createRange&amp;&amp;(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)&amp;&amp;(o=X?r[0]:r[1],r=X?r[1]:r[0]),r.begin!==n&amp;&amp;(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&gt;a.scrollWidth?p:0,!1===c.insertMode&amp;&amp;r===o&amp;&amp;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&lt;a.inputmask._valueGet().length?r:a.inputmask._valueGet().length),u.setEnd(a.firstChild,o&lt;a.inputmask._valueGet().length?o:a.inputmask._valueGet().length),u.collapse(!0);var m=t.getSelection();m.removeAllRanges(),m.addRange(u)}else a.createTextRange&amp;&amp;((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&lt;r.length;i++)c=(a=P(i,c,i-1)).locator.slice(),l[i]=e.extend(!0,{},a);var p=u&amp;&amp;u.alternation!==n?u.locator[u.alternation]:n;for(i=o-1;i&gt;s&amp;&amp;((a=l[i]).match.optionality||a.match.optionalQuantifier&amp;&amp;a.match.newBlockMarker||p&amp;&amp;(p!==l[i].locator[u.alternation]&amp;&amp;null!=a.match.fn||null===a.match.fn&amp;&amp;a.locator[u.alternation]&amp;&amp;D(a.locator[u.alternation].toString().split(","),p.toString().split(","))&amp;&amp;""!==C(i)[0].def))&amp;&amp;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&lt;a&amp;&amp;!j(i,!0)&amp;&amp;(t=r!==n?P(i,r.locator.slice(""),r):S(i))&amp;&amp;!0!==t.match.optionality&amp;&amp;(!0!==t.match.optionalQuantifier&amp;&amp;!0!==t.match.newBlockMarker||i+1===a&amp;&amp;""===(r!==n?P(i+1,r.locator.slice(""),r):S(i+1)).match.def);)i++;for(;(t=h().validPositions[i-1])&amp;&amp;t&amp;&amp;t.match.optionality&amp;&amp;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&lt;=r;o++){var s=P(o).match;if(null!==s.fn&amp;&amp;h().validPositions[o]===n&amp;&amp;!0!==s.optionality&amp;&amp;!0!==s.optionalQuantifier||null===s.fn&amp;&amp;t[o]!==N(o,s)){i=!1;break}}}return i}function K(e,t,i,r,o){if((c.numericInput||X)&amp;&amp;(t===a.keyCode.BACKSPACE?t=a.keyCode.DELETE:t===a.keyCode.DELETE&amp;&amp;(t=a.keyCode.BACKSPACE),X)){var s=i.end;i.end=i.begin,i.begin=s}if(t===a.keyCode.BACKSPACE&amp;&amp;(i.end-i.begin&lt;1||!1===c.insertMode)?(i.begin=T(i.begin),h().validPositions[i.begin]!==n&amp;&amp;h().validPositions[i.begin].input===c.groupSeparator&amp;&amp;i.begin--):t===a.keyCode.DELETE&amp;&amp;i.begin===i.end&amp;&amp;(i.end=j(i.end,!0)&amp;&amp;h().validPositions[i.end]&amp;&amp;h().validPositions[i.end].input!==c.radixPoint?i.end+1:F(i.end)+1,h().validPositions[i.begin]!==n&amp;&amp;h().validPositions[i.begin].input===c.groupSeparator&amp;&amp;i.end++),k(i.begin,i.end,!1,r),!0!==r&amp;&amp;null!==c.keepStatic&amp;&amp;!1!==c.keepStatic){var l=O(!0);l&amp;&amp;(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&lt;i.begin||-1===i.begin)h().p=F(u);else if(!0!==r&amp;&amp;(h().p=i.begin,!0!==o))for(;h().p&lt;u&amp;&amp;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)&amp;&amp;-1!==o.indexOf("font")&amp;&amp;(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&lt;=s;t++){if(r.innerHTML+=l.charAt(t)||"_",r.offsetWidth&gt;=e){var c=e-u,p=r.offsetWidth-e;r.innerHTML=l.charAt(t),t=(c-=r.offsetWidth/3)&lt;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&amp;&amp;(e=""),p||null!==o.fn&amp;&amp;s.input!==n)if(p&amp;&amp;(null!==o.fn&amp;&amp;s.input!==n||""===o.def)){p=!1;var t=u.length;u[t-1]=u[t-1]+"&lt;/span&gt;",u.push(e)}else u.push(e);else p=!0,u.push("&lt;span class='im-static'&gt;"+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&amp;&amp;(t={begin:t,end:t}),!0!==a){var d=v();do{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&lt;d||"number"==typeof c.jitMasking&amp;&amp;isFinite(c.jitMasking)&amp;&amp;c.jitMasking&gt;f)&amp;&amp;r(N(f,o))),f++}while(($===n||f&lt;$)&amp;&amp;(null!==o.fn||""!==o.def)||d&gt;f||p);p&amp;&amp;r(),i.activeElement===e&amp;&amp;(u.splice(t.begin,0,t.begin===t.end?'&lt;mark class="im-caret" style="border-right-width: 1px;border-right-style: solid;"&gt;':'&lt;mark class="im-caret-select"&gt;'),u.splice(t.end+1,0,"&lt;/mark&gt;"))}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&amp;&amp;"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&amp;&amp;!("keydown"===t.type&amp;&amp;t.ctrlKey&amp;&amp;67===t.keyCode||!1===c.tabThrough&amp;&amp;t.keyCode===a.keyCode.TAB))){switch(t.type){case"input":if(!0===te)return te=!1,t.preventDefault();p&amp;&amp;(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&amp;&amp;(ae=!1,setTimeout(function(){I(i,i.inputmask.caretPos,n,!0)})),!1===l&amp;&amp;(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&amp;&amp;e(t.form).on(i,o):e(t).on(i,o)},off:function(t,i){var n;t.inputmask&amp;&amp;t.inputmask.events&amp;&amp;(i?(n=[])[i]=t.inputmask.events[i]:n=t.inputmask.events,e.each(n,function(i,n){for(;n.length&gt;0;){var a=n.pop();-1!==e.inArray(i,["submit","reset"])?null!==t.form&amp;&amp;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&amp;&amp;r===a.keyCode.BACKSPACE_SAFARI||t.ctrlKey&amp;&amp;r===a.keyCode.X&amp;&amp;!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())&amp;&amp;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&amp;&amp;!t.shiftKey||r===a.keyCode.PAGE_UP?(t.preventDefault(),I(i,0,t.shiftKey?o.begin:0,!0)):(c.undoOnEscape&amp;&amp;r===a.keyCode.ESCAPE||90===r&amp;&amp;t.ctrlKey)&amp;&amp;!0!==t.altKey?(G(i,!0,!1,Q.split("")),n.trigger("click")):r!==a.keyCode.INSERT||t.shiftKey||t.ctrlKey?!0===c.tabThrough&amp;&amp;r===a.keyCode.TAB?(!0===t.shiftKey?(null===S(o.begin).match.fn&amp;&amp;(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&lt;h().maskLength&amp;&amp;o.end--),o.begin&lt;h().maskLength&amp;&amp;(t.preventDefault(),I(i,o.begin,o.end))):t.shiftKey||!1===c.insertMode&amp;&amp;(r===a.keyCode.RIGHT?setTimeout(function(){var e=I(i);I(i,e.begin)},0):r===a.keyCode.LEFT&amp;&amp;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&amp;&amp;t.altKey)&amp;&amp;(t.ctrlKey||t.metaKey||ie))return p===a.keyCode.ENTER&amp;&amp;Q!==E().join("")&amp;&amp;(Q=E().join(""),setTimeout(function(){u.trigger("change")},0)),!0;if(p){46===p&amp;&amp;!1===t.shiftKey&amp;&amp;""!==c.radixPoint&amp;&amp;(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&amp;&amp;(g(!0),f=v.caret!==n?v.caret:F(v.pos.begin?v.pos.begin:v.pos),h().p=f),f=c.numericInput&amp;&amp;v.caret===n?T(f):f,!1!==r&amp;&amp;(setTimeout(function(){c.onKeyValidation.call(l,p,v,c)},0),h().writeOutBuffer&amp;&amp;!1!==v)){var k=E();R(l,k,f,t,!0!==i),!0!==i&amp;&amp;setTimeout(function(){!0===V(k)&amp;&amp;u.trigger("complete")},0)}if(t.preventDefault(),i)return!1!==v&amp;&amp;(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&amp;&amp;(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("")&amp;&amp;(u=""),p===(X?M().reverse():M()).slice(l.end).join("")&amp;&amp;(p=""),X&amp;&amp;(n=u,u=p,p=n),t.clipboardData&amp;&amp;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())&amp;&amp;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)&amp;&amp;""!==c.radixPoint&amp;&amp;((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("");a.splice(i.begin,0,n),t=a.join("")}}return t}(0,o=i,s),E().join("")!==o){var l=E().join(""),u=o.length&gt;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&gt;=d.length)?p.length:d.length,b=0;p.charAt(b)===d.charAt(b)&amp;&amp;b&lt;y;b++);k&amp;&amp;(0===u&amp;&amp;(g.begin=b),v+=p.slice(b,g.end))}if(m!==h&amp;&amp;(m.length&gt;h.length?v+=m.slice(0,1):m.length&lt;h.length&amp;&amp;(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&gt;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&amp;&amp;(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&amp;&amp;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)&amp;&amp;(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)&amp;&amp;this.inputmask._valueGet()===M().join("")&amp;&amp;this.inputmask._valueSet("")},focusEvent:function(e){var t=this,i=t.inputmask._valueGet();c.showMaskOnFocus&amp;&amp;(!c.showMaskOnHover||c.showMaskOnHover&amp;&amp;""===i)&amp;&amp;(t.inputmask._valueGet()!==E().join("")?R(t,E(),F(v())):!1===ne&amp;&amp;I(t,F(v()))),!0===c.positionCaretOnTab&amp;&amp;!1===ne&amp;&amp;oe.clickEvent.apply(t,[e,!0]),Q=E().join("")},mouseleaveEvent:function(e){if(ne=!1,c.clearMaskOnLostFocus&amp;&amp;i.activeElement!==this){var t=E().slice(),n=this.inputmask._valueGet();n!==this.getAttribute("placeholder")&amp;&amp;""!==n&amp;&amp;(-1===v()&amp;&amp;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&amp;&amp;(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&lt;F(-1))return!0;var a=e.inArray(c.radixPoint,E());if(-1!==a){for(var r in i)if(a&lt;r&amp;&amp;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&lt;u)I(r,j(s,!0)||j(s-1,!0)?s:F(s));else{var p=h().validPositions[l],f=P(u,p?p.match.locator:n,p),m=N(u,f.match);if(""!==m&amp;&amp;E()[u]!==m&amp;&amp;!0!==f.match.optionalQuantifier&amp;&amp;!0!==f.match.newBlockMarker||!j(u,!0)&amp;&amp;f.match.def===m){var d=F(u);(s&gt;=d||s===u)&amp;&amp;(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&amp;&amp;i.execCommand("copy"),K(0,a.keyCode.DELETE,o),R(this,E(),h().p,n,Q!==E().join("")),this.inputmask._valueGet()===M().join("")&amp;&amp;r.trigger("cleared")},blurEvent:function(t){var i=e(this);if(this.inputmask){var a=this.inputmask._valueGet(),r=E().slice();""===a&amp;&amp;q===n||(c.clearMaskOnLostFocus&amp;&amp;(-1===v()&amp;&amp;a===M().join("")?r=[]:H(r)),!1===V(r)&amp;&amp;(setTimeout(function(){i.trigger("incomplete")},0),c.clearIncomplete&amp;&amp;(g(),r=c.clearMaskOnLostFocus?[]:M().slice())),R(this,r,n,t)),Q!==E().join("")&amp;&amp;(Q=r.join(""),i.trigger("change"))}},mouseenterEvent:function(e){ne=!0,i.activeElement!==this&amp;&amp;c.showMaskOnHover&amp;&amp;this.inputmask._valueGet()!==E().join("")&amp;&amp;R(this,E())},submitEvent:function(e){Q!==E().join("")&amp;&amp;W.trigger("change"),c.clearMaskOnLostFocus&amp;&amp;-1===v()&amp;&amp;Y.inputmask._valueGet&amp;&amp;Y.inputmask._valueGet()===M().join("")&amp;&amp;Y.inputmask._valueSet(""),c.removeMaskOnSubmit&amp;&amp;(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&amp;&amp;r.value===n||(Z=r.value,Z=(e.isFunction(c.onBeforeMask)&amp;&amp;c.onBeforeMask.call(J,Z,c)||Z).split(""),G(n,!1,!1,X?Z.reverse():Z),e.isFunction(c.onBeforeWrite)&amp;&amp;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&amp;&amp;-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&amp;&amp;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&amp;&amp;e(this).trigger("setvalue")}var l,u,c;if(!t.inputmask.__valueGet){if(!0!==a.noValuePatching){if(Object.getOwnPropertyDescriptor){"function"!=typeof Object.getPrototypeOf&amp;&amp;(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&amp;&amp;p.get&amp;&amp;p.set?(l=p.get,u=p.set,Object.defineProperty(t,"value",{get:r,set:s,configurable:!0})):"INPUT"!==t.tagName&amp;&amp;(l=function(){return this.textContent},u=function(e){this.textContent=e},Object.defineProperty(t,"value",{get:r,set:s,configurable:!0}))}else i.__lookupGetter__&amp;&amp;t.__lookupGetter__("value")&amp;&amp;(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&amp;&amp;!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&amp;&amp;X?e.split("").reverse().join(""):e)},l===n&amp;&amp;(l=function(){return this.value},u=function(e){this.value=e},function(t){if(e.valHooks&amp;&amp;(e.valHooks[t]===n||!0!==e.valHooks[t].inputmaskpatch)){var i=e.valHooks[t]&amp;&amp;e.valHooks[t].get?e.valHooks[t].get:function(e){return e.value},r=e.valHooks[t]&amp;&amp;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&amp;&amp;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("")&amp;&amp;i.trigger("setvalue")}))}}(t):t.inputmask=n,s}(t,c);if(!1!==a&amp;&amp;(W=e(Y=t),-1===($=Y!==n?Y.maxLength:n)&amp;&amp;($=n),!0===c.colorMask&amp;&amp;U(Y),p&amp;&amp;("inputmode"in Y&amp;&amp;(Y.inputmode=c.inputmode,Y.setAttribute("inputmode",c.inputmode)),!0===c.disablePredictiveText&amp;&amp;("autocorrect"in Y?Y.autocorrect=!1:(!0!==c.colorMask&amp;&amp;U(Y),Y.type="password"))),!0===a&amp;&amp;(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&amp;&amp;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)&amp;&amp;c.onBeforeMask.call(J,Y.inputmask._valueGet(!0),c)||Y.inputmask._valueGet(!0);""!==r&amp;&amp;G(Y,!0,!1,X?r.split("").reverse():r.split(""));var s=E().slice();Q=s.join(""),!1===V(s)&amp;&amp;c.clearIncomplete&amp;&amp;g(),c.clearMaskOnLostFocus&amp;&amp;i.activeElement!==Y&amp;&amp;(-1===v()?s=[]:H(s)),R(Y,s),i.activeElement===Y&amp;&amp;I(Y,F(v()))}}(Y);break;case"format":return Z=(e.isFunction(c.onBeforeMask)&amp;&amp;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&gt;le&amp;&amp;!j(ue);ue--);return se.splice(le,ue+1-le),V(se)&amp;&amp;r.value===E().join("");case"getemptymask":return M().join("");case"remove":return Y&amp;&amp;Y.inputmask&amp;&amp;(W=e(Y),Y.inputmask._valueSet(c.autoUnmask?B(Y):Y.inputmask._valueGet(!0)),re.off(Y),Y.inputmask.colorMask&amp;&amp;((q=Y.inputmask.colorMask).removeChild(Y),q.parentNode.insertBefore(Y,q),q.parentNode.removeChild(q)),Object.getOwnPropertyDescriptor&amp;&amp;Object.getPrototypeOf?Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Y),"value")&amp;&amp;Y.inputmask.__valueGet&amp;&amp;Object.defineProperty(Y,"value",{get:Y.inputmask.__valueGet,set:Y.inputmask.__valueSet,configurable:!0}):i.__lookupGetter__&amp;&amp;Y.__lookupGetter__("value")&amp;&amp;Y.inputmask.__valueGet&amp;&amp;(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)&amp;&amp;!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&amp;&amp;(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))&amp;&amp;("string"==typeof a&amp;&amp;(0===e.indexOf("on")?a=t[a]:"false"===a?a=!1:"true"===a&amp;&amp;(a=!0)),o[e]=a)},m=i.getAttribute(s);if(m&amp;&amp;""!==m&amp;&amp;(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&amp;&amp;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)&amp;&amp;(i.style.textAlign="right"),("rtl"===i.dir||a.numericInput)&amp;&amp;(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&amp;&amp;(o.inputmask!==n&amp;&amp;(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&amp;&amp;o[0]&amp;&amp;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&amp;&amp;!0!==i&amp;&amp;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&amp;&amp;/\\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&amp;&amp;(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&amp;&amp;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&amp;&amp;!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&amp;&amp;null!==l.fn,casing:null,def:r.staticDefinitionSymbol||o,placeholder:r.staticDefinitionSymbol!==n?o:n,nativeDef:o}),k=!1)}}function l(){if(b.length&gt;0){if(s(f=b[b.length-1],c),f.isAlternator){m=b.pop();for(var e=0;e&lt;m.matches.length;e++)m.matches[e].isGroup=!1;b.length&gt;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&amp;&amp;(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&amp;&amp;l();break;case r.optionalmarker[1]:case r.groupmarker[1]:if((p=b.pop()).openGroup=!1,p!==n)if(b.length&gt;0){if((f=b[b.length-1]).matches.push(p),f.isAlternator){m=b.pop();for(var P=0;P&lt;m.matches.length;P++)m.matches[P].isGroup=!1,m.matches[P].alternatorGroup=!1;b.length&gt;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&amp;&amp;"+"!==M||(C="*"===M?0:1),S.quantifier={min:C,max:M},b.length&gt;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&amp;&amp;null===u.fn&amp;&amp;"."===u.def&amp;&amp;(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&gt;0){var w=(f=b[b.length-1]).matches[f.matches.length-1];d=f.openGroup&amp;&amp;(w.matches===n||!1===w.isGroup&amp;&amp;!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&gt;0;)p=b.pop(),y.matches.push(p);return y.matches.length&gt;0&amp;&amp;(function t(a){a&amp;&amp;a.matches&amp;&amp;e.each(a.matches,function(e,o){var l=a.matches[e+1];(l===n||l.matches===n||!1===l.isQuantifier)&amp;&amp;o&amp;&amp;o.isGroup&amp;&amp;(o.isGroup=!1,i||(s(o,r.groupmarker[0],0),!0!==o.openGroup&amp;&amp;s(o,r.groupmarker[1]))),t(o)})}(y),x.push(y)),(r.numericInput||r.isRTL)&amp;&amp;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&amp;&amp;t.matches[a+1]&amp;&amp;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]&amp;&amp;(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&amp;&amp;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)&amp;&amp;(e.exports=r)},function(e,t){e.exports=jQuery},function(e,t,i){"use strict";function n(e){return e&amp;&amp;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&amp;&amp;i(10),window.Inputmask=a.default},function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&amp;&amp;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])&amp;&amp;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&lt;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])&amp;&amp;(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&amp;&amp;n.min.year&amp;&amp;n.max&amp;&amp;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&amp;&amp;u.match(/[^0-9]/)?c.min[a]:u,void 0!==s&amp;&amp;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","Friday","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&amp;&amp;c.date.getTime()==c.date.getTime()&amp;&amp;(s=c,l=u,u=(u=(!isFinite(s.day)||"29"==s.day&amp;&amp;!isFinite(s.rawyear)||new Date(s.date.getFullYear(),isFinite(s.month)?s.month:s.date.getMonth()+1,0).getDate()&gt;=s.day)&amp;&amp;l)&amp;&amp;(n=c.date,o=!0,(a=i).min&amp;&amp;a.min.date.getTime()==a.min.date.getTime()&amp;&amp;(o=o&amp;&amp;a.min.date.getTime()&lt;=n.getTime()),a.max&amp;&amp;a.max.date.getTime()==a.max.date.getTime()&amp;&amp;(o=o&amp;&amp;a.max.date.getTime()&gt;=n.getTime()),o)),u},onKeyDown:function(n,r,o,s){if(n.ctrlKey&amp;&amp;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)&amp;&amp;(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)&amp;&amp;(e.exports=r)},function(e,t,i){"use strict";var n;"function"==typeof Symbol&amp;&amp;Symbol.iterator,void 0!==(n=function(){return window}.call(t,i,t,e))&amp;&amp;(e.exports=n)},function(e,t,i){"use strict";var n;"function"==typeof Symbol&amp;&amp;Symbol.iterator,void 0!==(n=function(){return document}.call(t,i,t,e))&amp;&amp;(e.exports=n)},function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&amp;&amp;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"},"&amp;":{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&gt;-1&amp;&amp;"."!==t.buffer[i-1]?(e=t.buffer[i-1]+e,e=i-2&gt;-1&amp;&amp;"."!==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!#$%&amp;'*+/=?^_`{|}~-]",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)&amp;&amp;(e.exports=r)},function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&amp;&amp;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&lt;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&amp;&amp;isNaN(e.integerDigits)&amp;&amp;(e.integerDigits=e.repeat),e.repeat=0,e.groupSeparator===e.radixPoint&amp;&amp;e.digits&amp;&amp;"0"!==e.digits&amp;&amp;("."===e.radixPoint?e.groupSeparator=",":","===e.radixPoint?e.groupSeparator=".":e.groupSeparator="")," "===e.groupSeparator&amp;&amp;(e.skipOptionalPartCharacter=i),e.autoGroup=e.autoGroup&amp;&amp;""!==e.groupSeparator,e.autoGroup&amp;&amp;("string"==typeof e.groupSize&amp;&amp;isFinite(e.groupSize)&amp;&amp;(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&lt;1&amp;&amp;(e.integerDigits="*")}e.placeholder.length&gt;1&amp;&amp;(e.placeholder=e.placeholder.charAt(0)),"radixFocus"===e.positionCaretOnClick&amp;&amp;""===e.placeholder&amp;&amp;!1===e.integerOptional&amp;&amp;(e.positionCaretOnClick="lvp"),e.definitions[";"]=e.definitions["~"],e.definitions[";"].definitionSymbol="~",!0===e.numericInput&amp;&amp;(e.positionCaretOnClick="radixFocus"===e.positionCaretOnClick?"lvp":e.positionCaretOnClick,e.digitsOptional=!1,isNaN(e.digits)&amp;&amp;(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]&amp;&amp;o[1]&amp;&amp;isFinite(o[1]))?r+=e.radixPointDefinitionSymbol+";{"+e.digits+"}":(isNaN(e.digits)||parseInt(e.digits)&gt;0)&amp;&amp;(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&amp;&amp;(o.isNegative=o.isNegative===i||!o.isNegative,""===t.join("")||{caret:n,dopost:!0});if(!1===r&amp;&amp;a===o.radixPoint&amp;&amp;o.digits!==i&amp;&amp;(isNaN(o.digits)||parseInt(o.digits)&gt;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&amp;&amp;a.caret!==i&amp;&amp;!0!==a.dopost)return a;var l=a.caret!==i?a.caret:a.pos,u=n.slice();r.numericInput&amp;&amp;(l=u.length-l-1,u=u.reverse());var c=u[l];if(c===r.groupSeparator&amp;&amp;(c=u[l+=1]),l===u.length-r.suffix.length-1&amp;&amp;c===r.radixPoint)return a;c!==i&amp;&amp;c!==r.radixPoint&amp;&amp;c!==r.negationSymbol.front&amp;&amp;c!==r.negationSymbol.back&amp;&amp;(u[l]="?",r.prefix.length&gt;0&amp;&amp;l&gt;=(!1===r.isNegative?1:0)&amp;&amp;l&lt;r.prefix.length-1+(!1===r.isNegative?1:0)?s[l-(!1===r.isNegative?1:0)]="?":r.suffix.length&gt;0&amp;&amp;l&gt;=u.length-r.suffix.length-(!1===r.isNegative?1:0)&amp;&amp;(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)&amp;&amp;(p=p.replace(new RegExp(t.escapeRegex(r.placeholder),"g"),"")),p.length&gt;1&amp;&amp;1!==p.indexOf(r.radixPoint)&amp;&amp;("0"===c&amp;&amp;(p=p.replace(/^\?/g,"")),p=p.replace(/^0/g,"")),p.charAt(0)===r.radixPoint&amp;&amp;""!==r.radixPoint&amp;&amp;!0!==r.numericInput&amp;&amp;(p="0"+p),""!==p){if(p=p.split(""),(!r.digitsOptional||r.enforceDigitsOnBlur&amp;&amp;"blur"===a.event)&amp;&amp;isFinite(r.digits)){var f=e.inArray(r.radixPoint,p),m=e.inArray(r.radixPoint,u);-1===f&amp;&amp;(p.push(r.radixPoint),f=p.length-1);for(var d=1;d&lt;=r.digits;d++)r.digitsOptional&amp;&amp;(!r.enforceDigitsOnBlur||"blur"!==a.event)||p[f+d]!==i&amp;&amp;p[f+d]!==r.placeholder.charAt(0)?-1!==m&amp;&amp;u[m+d]!==i&amp;&amp;(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&amp;&amp;a.pos===i&amp;&amp;!a.dopost)p=p.join("");else{var h=p[p.length-1]===r.radixPoint&amp;&amp;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]&amp;&amp;(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&amp;&amp;(p+=r.radixPoint),p.charAt(0)===r.groupSeparator&amp;&amp;p.substr(1)}}if(r.isNegative&amp;&amp;"blur"===a.event&amp;&amp;(r.isNegative="0"!==p),p=s+p,p+=o,r.isNegative&amp;&amp;(p=r.negationSymbol.front+p,p+=r.negationSymbol.back),p=p.split(""),c!==i)if(c!==r.radixPoint&amp;&amp;c!==r.negationSymbol.front&amp;&amp;c!==r.negationSymbol.back)(l=e.inArray("?",p))&gt;-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&amp;&amp;(l=g)}r.numericInput&amp;&amp;(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&amp;&amp;(null!==l.min&amp;&amp;(l.min=l.min.toString().replace(new RegExp(t.escapeRegex(l.groupSeparator),"g"),""),","===l.radixPoint&amp;&amp;(l.min=l.min.replace(l.radixPoint,".")),l.min=isFinite(l.min)?parseFloat(l.min):NaN,isNaN(l.min)&amp;&amp;(l.min=Number.MIN_VALUE)),null!==l.max&amp;&amp;(l.max=l.max.toString().replace(new RegExp(t.escapeRegex(l.groupSeparator),"g"),""),","===l.radixPoint&amp;&amp;(l.max=l.max.replace(l.radixPoint,".")),l.max=isFinite(l.max)?parseFloat(l.max):NaN,isNaN(l.max)&amp;&amp;(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&amp;&amp;s&lt;o.min)return o.isNegative=o.min&lt;0,o.postValidation(o.min.toString().replace(".",o.radixPoint).split(""),{caret:r,dopost:!0,placeholder:"0"},o);if(null!==o.max&amp;&amp;s&gt;o.max)return o.isNegative=o.max&lt;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);if(!0===l){if(!0!==o.numericInput&amp;&amp;n.validPositions[a]!==i&amp;&amp;"~"===n.validPositions[a].match.def&amp;&amp;!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&gt;1&amp;&amp;(c[1]=c[1].replace(/0/g,o.placeholder.charAt(0))),"0"===c[0]&amp;&amp;(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&amp;&amp;(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&amp;&amp;("-"===e||e===a.negationSymbol.front)},cardinality:1,placeholder:""},"-":{validator:function(e,t,i,n,a){return a.allowMinus&amp;&amp;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&amp;&amp;i.validPositions[n]&amp;&amp;i.validPositions[n].match.placeholder===r.radixPoint&amp;&amp;(s={caret:n+1}),s},cardinality:1,placeholder:function(e){return e.radixPoint}}},onUnMask:function(e,i,n){if(""===i&amp;&amp;!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)&amp;&amp;(a=a.replace(new RegExp(n.placeholder.charAt(0),"g"),"0")),n.unmaskAsNumber?(""!==n.radixPoint&amp;&amp;-1!==a.indexOf(n.radixPoint)&amp;&amp;(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&amp;&amp;(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&amp;&amp;isFinite(e)){var a=e.split("."),r=""!==n.groupSeparator?parseInt(n.groupSize):0;2===a.length&amp;&amp;(a[0].length&gt;r||a[1].length&gt;r||a[0].length&lt;=r&amp;&amp;a[1].length&lt;r)&amp;&amp;(e=e.replace(".",n.radixPoint))}var o=e.match(/,/g),s=e.match(/\./g);if(e=s&amp;&amp;o?s.length&gt;o.length?(e=e.replace(/\./g,"")).replace(",",n.radixPoint):o.length&gt;s.length?(e=e.replace(/,/g,"")).replace(".",n.radixPoint):e.indexOf(".")&lt;e.indexOf(",")?e.replace(/\./g,""):e.replace(/,/g,""):e.replace(new RegExp(t.escapeRegex(n.groupSeparator),"g"),""),0===n.digits&amp;&amp;(-1!==e.indexOf(".")?e=e.substring(0,e.indexOf(".")):-1!==e.indexOf(",")&amp;&amp;(e=e.substring(0,e.indexOf(",")))),""!==n.radixPoint&amp;&amp;isFinite(n.digits)&amp;&amp;-1!==e.indexOf(n.radixPoint)){var l=e.split(n.radixPoint)[1].match(new RegExp("\\d*"))[0];if(parseInt(n.digits)&lt;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&amp;&amp;!1===a.decimalProtect||r.input===a.radixPoint&amp;&amp;e.validPositions[t+1]&amp;&amp;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&amp;&amp;"-"!==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)&amp;&amp;(e.exports=r)},function(e,t,i){"use strict";var n,a,r;"function"==typeof Symbol&amp;&amp;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)}var n=t.prototype.analyseMask;return t.prototype.analyseMask=function(t,i,a){var r={};return a.phoneCodes&amp;&amp;(a.phoneCodes&amp;&amp;a.phoneCodes.length&gt;1e3&amp;&amp;(function e(i,n,a){n=n||"",a=a||r,""!==n&amp;&amp;(a[n]={});for(var o="",s=a[n]||a,l=i.length-1;l&gt;=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&gt;500&amp;&amp;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:["&lt;","&gt;"],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)&gt;1||-1===i.indexOf(t.countrycode))&amp;&amp;(i="+"+t.countrycode+i),i},onUnMask:function(e,t,i){return e.replace(/[()#-]/g,"")},inputmode:"tel"}}),t})?n.apply(t,a):n)&amp;&amp;(e.exports=r)},function(e,t,i){"use strict";var n,a,r,o="function"==typeof Symbol&amp;&amp;"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&amp;&amp;"function"==typeof Symbol&amp;&amp;e.constructor===Symbol&amp;&amp;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&amp;&amp;(e.fn.inputmask=function(i,n){var a,r=this[0];if(void 0===n&amp;&amp;(n={}),"string"==typeof i)switch(i){case"unmaskedvalue":return r&amp;&amp;r.inputmask?r.inputmask.unmaskedvalue():e(r).val();case"remove":return this.each(function(){this.inputmask&amp;&amp;this.inputmask.remove()});case"getemptymask":return r&amp;&amp;r.inputmask?r.inputmask.getemptymask():"";case"hasMaskedValue":return!(!r||!r.inputmask)&amp;&amp;r.inputmask.hasMaskedValue();case"isComplete":return!r||!r.inputmask||r.inputmask.isComplete();case"getmetadata":return r&amp;&amp;r.inputmask?r.inputmask.getmetadata():void 0;case"setvalue":e(r).val(n),r&amp;&amp;void 0===r.inputmask&amp;&amp;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&amp;&amp;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&amp;&amp;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)&amp;&amp;(e.exports=r)}]);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:69:"/local/templates/aspro_max/js/jquery.easing.1.3.min.js?17114177503338";s:6:"source";s:50:"/local/templates/aspro_max/js/jquery.easing.1.3.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
jQuery.easing.jswing=jQuery.easing.swing,jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(n,e,t,u,a){return jQuery.easing[jQuery.easing.def](n,e,t,u,a)},easeInQuad:function(n,e,t,u,a){return u*(e/=a)*e+t},easeOutQuad:function(n,e,t,u,a){return-u*(e/=a)*(e-2)+t},easeInOutQuad:function(n,e,t,u,a){return(e/=a/2)&lt;1?u/2*e*e+t:-u/2*(--e*(e-2)-1)+t},easeInCubic:function(n,e,t,u,a){return u*(e/=a)*e*e+t},easeOutCubic:function(n,e,t,u,a){return u*((e=e/a-1)*e*e+1)+t},easeInOutCubic:function(n,e,t,u,a){return(e/=a/2)&lt;1?u/2*e*e*e+t:u/2*((e-=2)*e*e+2)+t},easeInQuart:function(n,e,t,u,a){return u*(e/=a)*e*e*e+t},easeOutQuart:function(n,e,t,u,a){return-u*((e=e/a-1)*e*e*e-1)+t},easeInOutQuart:function(n,e,t,u,a){return(e/=a/2)&lt;1?u/2*e*e*e*e+t:-u/2*((e-=2)*e*e*e-2)+t},easeInQuint:function(n,e,t,u,a){return u*(e/=a)*e*e*e*e+t},easeOutQuint:function(n,e,t,u,a){return u*((e=e/a-1)*e*e*e*e+1)+t},easeInOutQuint:function(n,e,t,u,a){return(e/=a/2)&lt;1?u/2*e*e*e*e*e+t:u/2*((e-=2)*e*e*e*e+2)+t},easeInSine:function(n,e,t,u,a){return-u*Math.cos(e/a*(Math.PI/2))+u+t},easeOutSine:function(n,e,t,u,a){return u*Math.sin(e/a*(Math.PI/2))+t},easeInOutSine:function(n,e,t,u,a){return-u/2*(Math.cos(Math.PI*e/a)-1)+t},easeInExpo:function(n,e,t,u,a){return 0==e?t:u*Math.pow(2,10*(e/a-1))+t},easeOutExpo:function(n,e,t,u,a){return e==a?t+u:u*(-Math.pow(2,-10*e/a)+1)+t},easeInOutExpo:function(n,e,t,u,a){return 0==e?t:e==a?t+u:(e/=a/2)&lt;1?u/2*Math.pow(2,10*(e-1))+t:u/2*(-Math.pow(2,-10*--e)+2)+t},easeInCirc:function(n,e,t,u,a){return-u*(Math.sqrt(1-(e/=a)*e)-1)+t},easeOutCirc:function(n,e,t,u,a){return u*Math.sqrt(1-(e=e/a-1)*e)+t},easeInOutCirc:function(n,e,t,u,a){return(e/=a/2)&lt;1?-u/2*(Math.sqrt(1-e*e)-1)+t:u/2*(Math.sqrt(1-(e-=2)*e)+1)+t},easeInElastic:function(n,e,t,u,a){var r=1.70158,i=0,s=u;if(0==e)return t;if(1==(e/=a))return t+u;if(i||(i=.3*a),s&lt;Math.abs(u)){s=u;var r=i/4}else var r=i/(2*Math.PI)*Math.asin(u/s);return-(s*Math.pow(2,10*(e-=1))*Math.sin((e*a-r)*(2*Math.PI)/i))+t},easeOutElastic:function(n,e,t,u,a){var r=1.70158,i=0,s=u;if(0==e)return t;if(1==(e/=a))return t+u;if(i||(i=.3*a),s&lt;Math.abs(u)){s=u;var r=i/4}else var r=i/(2*Math.PI)*Math.asin(u/s);return s*Math.pow(2,-10*e)*Math.sin((e*a-r)*(2*Math.PI)/i)+u+t},easeInOutElastic:function(n,e,t,u,a){var r=1.70158,i=0,s=u;if(0==e)return t;if(2==(e/=a/2))return t+u;if(i||(i=a*(.3*1.5)),s&lt;Math.abs(u)){s=u;var r=i/4}else var r=i/(2*Math.PI)*Math.asin(u/s);return 1&gt;e?-.5*(s*Math.pow(2,10*(e-=1))*Math.sin((e*a-r)*(2*Math.PI)/i))+t:s*Math.pow(2,-10*(e-=1))*Math.sin((e*a-r)*(2*Math.PI)/i)*.5+u+t},easeInBack:function(n,e,t,u,a,r){return void 0==r&amp;&amp;(r=1.70158),u*(e/=a)*e*((r+1)*e-r)+t},easeOutBack:function(n,e,t,u,a,r){return void 0==r&amp;&amp;(r=1.70158),u*((e=e/a-1)*e*((r+1)*e+r)+1)+t},easeInOutBack:function(n,e,t,u,a,r){return void 0==r&amp;&amp;(r=1.70158),(e/=a/2)&lt;1?u/2*(e*e*(((r*=1.525)+1)*e-r))+t:u/2*((e-=2)*e*(((r*=1.525)+1)*e+r)+2)+t},easeInBounce:function(n,e,t,u,a){return u-jQuery.easing.easeOutBounce(n,a-e,0,u,a)+t},easeOutBounce:function(n,e,t,u,a){return(e/=a)&lt;1/2.75?u*(7.5625*e*e)+t:2/2.75&gt;e?u*(7.5625*(e-=1.5/2.75)*e+.75)+t:2.5/2.75&gt;e?u*(7.5625*(e-=2.25/2.75)*e+.9375)+t:u*(7.5625*(e-=2.625/2.75)*e+.984375)+t},easeInOutBounce:function(n,e,t,u,a){return a/2&gt;e?.5*jQuery.easing.easeInBounce(n,2*e,0,u,a)+t:.5*jQuery.easing.easeOutBounce(n,2*e-a,0,u,a)+.5*u+t}});
/* End */
;
; /* Start:"a:4:{s:4:"full";s:59:"/local/templates/aspro_max/js/equalize.min.js?1711417746588";s:6:"source";s:45:"/local/templates/aspro_max/js/equalize.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/**
 * equalize.js
 * Author &amp; copyright (c) 2012: Tim Svensen
 * Dual MIT &amp; GPL license
 *
 * Page: http://tsvensen.github.com/equalize.js
 * Repo: https://github.com/tsvensen/equalize.js/
 */
(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&lt;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&amp;&amp;a.css(e,"");a=a[c]();a&gt;f&amp;&amp;(f=a)});a.css(e,f+"px")})}})(jQuery);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/aspro_max/js/jquery.alphanumeric.js?17119485501901";s:6:"source";s:52:"/local/templates/aspro_max/js/jquery.alphanumeric.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
(function ($) {
    $.fn.alphanumeric = function (p) {
        var input = $(this),
            az = "abcdefghijklmnopqrstuvwxyz",
            options = $.extend({
                ichars: '!@#$%^&amp;*()+=[]\\\';,/{}|":&lt;&gt;?~`.- _',
                nchars: '',
                allow: ''
            }, p),
            s = options.allow.split(''),
            i = 0,
            ch,
            regex;

        for (i; i &lt; s.length; i++) {
            if (options.ichars.indexOf(s[i]) != -1) {
                s[i] = '\\' + s[i];
            }
        }

        if (options.nocaps) {
            options.nchars += az.toUpperCase();
        }
        if (options.allcaps) {
            options.nchars += az;
        }

        options.allow = s.join('|');

        regex = new RegExp(options.allow, 'gi');
        ch = (options.ichars + options.nchars).replace(regex, '');

        input.keypress(function (e) {
            var key = String.fromCharCode(!e.charCode ? e.which : e.charCode);

            if (ch.indexOf(key) != -1 &amp;&amp; !e.ctrlKey) {
                e.preventDefault();
            }
        });

        input.blur(function () {
            var value = input.val(),
                j = 0;

            for (j; j &lt; value.length; j++) {
                if (ch.indexOf(value[j]) != -1) {
                    input.val('');
                    return false;
                }
            }
            return false;
        });

        return input;
    };

    $.fn.numeric = function (p) {
        var az = 'abcdefghijklmnopqrstuvwxyz',
            aZ = az.toUpperCase();

        return this.each(function () {
            $(this).alphanumeric($.extend({ nchars: az + aZ }, p));
        });
    };

    $.fn.alpha = function (p) {
        var nm = '1234567890';
        return this.each(function () {
            $(this).alphanumeric($.extend({ nchars: nm }, p));
        });
    };
})(jQuery);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_max/js/jquery.cookie.min.js?17114177483066";s:6:"source";s:46:"/local/templates/aspro_max/js/jquery.cookie.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/*!
 * jQuery Cookie Plugin v1.4.0
 * https://github.com/carhartl/jquery-cookie
 *
 * Copyright 2013 Klaus Hartl
 * Released under the MIT license
 */
(function (factory) {
	if (typeof define === 'function' &amp;&amp; define.amd) {
		// AMD. Register as anonymous module.
		define(['jquery'], factory);
	} else {
		// Browser globals.
		factory(jQuery);
	}
}(function ($) {

	var pluses = /\+/g;

	function encode(s) {
		return config.raw ? s : encodeURIComponent(s);
	}

	function decode(s) {
		return config.raw ? s : decodeURIComponent(s);
	}

	function stringifyCookieValue(value) {
		return encode(config.json ? JSON.stringify(value) : String(value));
	}

	function parseCookieValue(s) {
		if (s.indexOf('"') === 0) {
			// This is a quoted cookie as according to RFC2068, unescape...
			s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
		}

		try {
			// Replace server-side written pluses with spaces.
			// If we can't decode the cookie, ignore it, it's unusable.
			// If we can't parse the cookie, ignore it, it's unusable.
			s = decodeURIComponent(s.replace(pluses, ' '));
			return config.json ? JSON.parse(s) : s;
		} catch(e) {}
	}

	function read(s, converter) {
		var value = config.raw ? s : parseCookieValue(s);
		return $.isFunction(converter) ? converter(value) : value;
	}

	var config = $.cookie = function (key, value, options) {

		// Write

		if (value !== undefined &amp;&amp; !$.isFunction(value)) {
			options = $.extend({}, config.defaults, options);

			if (typeof options.expires === 'number') {
				var days = options.expires, t = options.expires = new Date();
				t.setTime(+t + days * 864e+5);
			}

			return (document.cookie = [
				encode(key), '=', stringifyCookieValue(value),
				options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
				options.path    ? '; path=' + options.path : '',
				options.domain  ? '; domain=' + options.domain : '',
				options.secure  ? '; secure' : ''
			].join(''));
		}

		// Read

		var result = key ? undefined : {};

		// To prevent the for loop in the first place assign an empty array
		// in case there are no cookies at all. Also prevents odd result when
		// calling $.cookie().
		var cookies = document.cookie ? document.cookie.split('; ') : [];

		for (var i = 0, l = cookies.length; i &lt; l; i++) {
			var parts = cookies[i].split('=');
			var name = decode(parts.shift());
			var cookie = parts.join('=');

			if (key &amp;&amp; key === name) {
				// If second argument (value) is a function it's a converter...
				result = read(cookie, value);
				break;
			}

			// Prevent storing a cookie that we couldn't decode.
			if (!key &amp;&amp; (cookie = read(cookie)) !== undefined) {
				result[name] = cookie;
			}
		}

		return result;
	};

	config.defaults = {};

	$.removeCookie = function (key, options) {
		if ($.cookie(key) === undefined) {
			return false;
		}

		// Must not alter options, thus extending a fresh object...
		$.cookie(key, '', $.extend({}, options, { expires: -1 }));
		return !$.cookie(key);
	};

}));

/* End */
;
; /* Start:"a:4:{s:4:"full";s:65:"/local/templates/aspro_max/js/jquery.plugin.min.js?17119485503178";s:6:"source";s:50:"/local/templates/aspro_max/js/jquery.plugin.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/** Abstract base class for collection plugins v1.0.1.
	Written by Keith Wood (kbwood{at}iinet.com.au) December 2013.
	Licensed under the MIT (http://keith-wood.name/licence.html) license. */
(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'&amp;&amp;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&amp;&amp;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&amp;&amp;this.regionalOptions[''])||{});var c=camelCase(this.name);$[c]=this;$.fn[c]=function(a){var b=Array.prototype.slice.call(arguments,1);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'&amp;&amp;(b.length===0||(b.length===1&amp;&amp;typeof b[0]==='string'))){return true}return $.inArray(a,this._getters)&gt;-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'&amp;&amp;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'&amp;&amp;c==null)){var e=(d||{}).options;return(e&amp;&amp;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);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:69:"/local/templates/aspro_max/js/jquery.countdown.min.js?171141774813137";s:6:"source";s:53:"/local/templates/aspro_max/js/jquery.countdown.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
!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&gt;e?n?performance.now()+performance.timing.navigationStart:s():e||s();a-r&gt;=1e3&amp;&amp;(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&amp;&amp;"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&amp;&amp;t.constructor==Date&amp;&amp;(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)&lt;30?60*e:e)),l.setUTCSeconds(r||0),l.setUTCMilliseconds(a||0),l},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&lt;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&amp;&amp;i._since.setMilliseconds(i._since.getMilliseconds()+s[2]),i._until.setMilliseconds(i._until.getMilliseconds()+s[2])}});for(var i=0;i&lt;t._serverSyncs.length;i++)null!=t._serverSyncs[i][2]&amp;&amp;(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)&gt;-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&gt;=0;e--)this._updateCountdown(this._timerElems[e])},_optionsChanged:function(t,i,s){s.layout&amp;&amp;(s.layout=s.layout.replace(/&amp;lt;/g,"&lt;").replace(/&amp;gt;/g,"&gt;")),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&amp;&amp;i._since&lt;o||i._until&amp;&amp;i._until&gt;o)&amp;&amp;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&amp;&amp;i.options){if(t.html(this._generateHTML(i)).toggleClass(this._rtlClass,i.options.isRTL),e.isFunction(i.options.onTick)){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)&amp;&amp;i.options.onTick.apply(t[0],[s])}var n="pause"!=i._hold&amp;&amp;(i._since?i._now.getTime()&lt;i._since.getTime():i._now.getTime()&gt;=i._until.getTime());if(n&amp;&amp;!i._expiring){if(i._expiring=!0,this._hasElem(t[0])||i.options.alwaysExpire){if(this._removeElem(t[0]),e.isFunction(i.options.onExpiry)&amp;&amp;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&amp;&amp;(window.location=i.options.expiryUrl)}i._expiring=!1}else"pause"==i._hold&amp;&amp;this._removeElem(t[0])}},_resetExtraLabels:function(e,t){for(var i in t)i.match(/[Ll]abels[02-9]|compactLabels1/)&amp;&amp;(e[i]=t[i]);for(var i in e)i.match(/[Ll]abels[02-9]|compactLabels1/)&amp;&amp;"undefined"==typeof t[i]&amp;&amp;(e[i]=null)},_adjustSettings:function(t,i,s){for(var n=null,o=0;o&lt;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&amp;&amp;null==i._until&amp;&amp;null==i._since)&amp;&amp;(i._since=i.options.since,null!=i._since&amp;&amp;(i._since=this.UTCDate(_,this._determineTime(i._since,null)),i._since&amp;&amp;r&amp;&amp;i._since.setMilliseconds(i._since.getMilliseconds()+r)),i._until=this.UTCDate(_,this._determineTime(i.options.until,a)),r&amp;&amp;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&amp;&amp;!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&amp;&amp;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&gt;=h;h++)p|="?"==t._show[h]&amp;&amp;t._periods[h]&gt;0,d[h]="?"!=t._show[h]||p?t._show[h]:null,c+=d[h]?1:0,u-=t._periods[h]&gt;0?1:0;for(var m=[!1,!1,!1,!1,!1,!1,!1],h=l;h&gt;=i;h--)t._show[h]&amp;&amp;(t._periods[h]?m[h]=!0:(m[h]=u&gt;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.options["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&amp;&amp;d[e]||t.options.significant&amp;&amp;m[e]?'&lt;span class="'+_._sectionClass+'"&gt;&lt;span class="'+_._amountClass+'"&gt;'+_._minDigits(t,t._periods[e],y)+'&lt;/span&gt;&lt;span class="'+_._periodClass+'"&gt;'+(i?i[e]:g[e])+"&lt;/span&gt;&lt;/span&gt;":""};return t.options.layout?this._buildLayout(t,d,t.options.layout,t.options.compact,t.options.significant,m):(t.options.compact?'&lt;span class="'+this._rowClass+" "+this._amountClass+(t._hold?" "+this._holdingClass:"")+'"&gt;'+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):""):'&lt;span class="'+this._rowClass+" "+this._showClass+(t.options.significant||c)+(t._hold?" "+this._holdingClass:"")+'"&gt;'+v(i)+v(s)+v(n)+v(o)+v(r)+v(a)+v(l))+"&lt;/span&gt;"+(t.options.description?'&lt;span class="'+this._rowClass+" "+this._descrClass+'"&gt;'+t.options.description+"&lt;/span&gt;":"")},_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&gt;=v;v++){var D="yowdhms".charAt(v),T=new RegExp("\\{"+D+"&lt;\\}([\\s\\S]*)\\{"+D+"&gt;\\}","g");y=y.replace(T,!u&amp;&amp;_[v]||u&amp;&amp;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&gt;=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()&lt;e._since.getTime()?e._now=p=c:p=e._since:(c.setTime(e._until.getTime()),p.getTime()&gt;e._until.getTime()&amp;&amp;(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()&gt;=Math.min(d,h)&amp;&amp;p.getDate()&gt;=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()&lt;p.getDate()&amp;&amp;!m||m&amp;&amp;g(c)&lt;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()&gt;y&amp;&amp;p.setDate(y),p.setFullYear(p.getFullYear()+u[i]),p.setMonth(p.getMonth()+u[s]),w&amp;&amp;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&gt;0&amp;&amp;!e._since)for(var T=[1,12,4.3482,7,24,60,60],M=l,S=1,b=l;b&gt;=i;b--)t[b]&amp;&amp;(u[M]&gt;=S&amp;&amp;(u[M]=0,v=1),v&gt;0&amp;&amp;(u[b]++,v=0,M=b,S=1)),S*=T[b];if(_)for(var b=i;l&gt;=b;b++)_&amp;&amp;u[b]?_--:_||(u[b]=0);return u}})}(jQuery);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:67:"/local/templates/aspro_max/js/jquery.countdown-ru.js?17119485501866";s:6:"source";s:52:"/local/templates/aspro_max/js/jquery.countdown-ru.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/* http://keith-wood.name/countdown.html
 * Russian initialisation for the jQuery countdown extension
 * Written by Sergey K. (xslade{at}gmail.com) June 2010. */
(function($) {
        $.countdown.regionalOptions['ru'] = {
		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')],
		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')],
		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')],
		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')],
		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')],
		whichLabels: function(amount) {
			var units = amount % 10;
			var tens = Math.floor((amount % 100) / 10);
			return (amount == 1 ? 1 : (units &gt;= 2 &amp;&amp; units &lt;= 4 &amp;&amp; tens != 1 ? 2 :
				(units == 1 &amp;&amp; tens != 1 ? 1 : 0)));
		},
		digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
		timeSeparator: ':', isRTL: false};
	$.countdown.setDefaults($.countdown.regionalOptions['ru']);
})(jQuery);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:68:"/local/templates/aspro_max/js/jquery.ikSelect.min.js?171141774817725";s:6:"source";s:48:"/local/templates/aspro_max/js/jquery.ikSelect.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
!function(t,i,e,s){var o,n=t(i),r={syntax:'&lt;div class="ik_select_link"&gt;&lt;div class="ik_select_link_text"&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="ik_select_dropdown"&gt;&lt;div class="ik_select_list"&gt;&lt;/div&gt;&lt;/div&gt;',autoWidth:!0,ddFullWidth:!0,equalWidths:!0,dynamicWidth:!1,extractLink:!1,customClass:"",linkCustomClass:"",ddCustomClass:"",ddMaxHeight:200,filter:!1,nothingFoundText:"Nothing found",isDisabled:!1,onInit:function(){},onShow:function(){},onHide:function(){},onKeyUp:function(){},onKeyDown:function(){},onHoverMove:function(){}};if(!t.browser){var h=function(t){t=t.toLowerCase();var i=/(chrome)[ \/]([\w.]+)/.exec(t)||/(webkit)[ \/]([\w.]+)/.exec(t)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(t)||/(msie) ([\w.]+)/.exec(t)||t.indexOf("compatible")&lt;0&amp;&amp;/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(t)||[];return{browser:i[1]||"",version:i[2]||"0"}}(navigator.userAgent),l={};h.browser&amp;&amp;(l[h.browser]=!0,l.version=h.version),l.chrome?l.webkit=!0:l.webkit&amp;&amp;(l.safari=!0),t.browser=l}function p(i,e){var s={};for(var o in this.el=i,this.$el=t(i),r)s[o]=this.$el.data(o.toLowerCase());this.options=t.extend({},r,e,s),t.browser.mobile&amp;&amp;(this.options.filter=!1),this.init()}t.browser.mobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile/i.test(navigator.userAgent),t.browser.operamini="[object OperaMini]"===Object.prototype.toString.call(i.operamini),t.extend(p.prototype,{init:function(){this.$wrapper=t('&lt;div class="ik_select"&gt;'+this.options.syntax+"&lt;/div&gt;"),this.$link=t(".ik_select_link",this.$wrapper),this.$linkText=t(".ik_select_link_text",this.$wrapper),this.$dropdown=t(".ik_select_dropdown",this.$wrapper),this.$list=t(".ik_select_list",this.$wrapper),this.$listInner=t('&lt;div class="ik_select_list_inner"/&gt;'),this.$active=t([]),this.$hover=t([]),this.hoverIndex=0,this.$optionSet=t([]),this.$optgroupSet=t([]),this.$list.append(this.$listInner),this.options.filter&amp;&amp;(this.$filter=t([]),this.$optionSetOriginal=t([]),this.$nothingFoundText=t('&lt;div class="ik_select_nothing_found"/&gt;').html(this.options.nothingFoundText),this.$filterWrap=t(".ik_select_filter_wrap",this.$wrapper),this.$filterWrap.length||(this.$filterWrap=t('&lt;div class="ik_select_filter_wrap"/&gt;')),this.$filter=t('&lt;input type="text" class="ik_select_filter"&gt;'),this.$filterWrap.append(this.$filter),this.$list.prepend(this.$filterWrap),this.$filter.on({"keydown.ikSelect keyup.ikSelect":t.proxy(this,"_elKeyUpDown"),"keyup.ikSelect":t.proxy(this,"_filterKeyup")})),this.$wrapper.addClass(this.options.customClass),this.$link.addClass(this.options.linkCustomClass||this.options.customClass&amp;&amp;this.options.customClass+"-link"),this.$dropdown.addClass(this.options.ddCustomClass||this.options.customClass&amp;&amp;this.options.customClass+"-dd"),this.reset(),this.toggle(!(this.options.isDisabled||this.$el.prop("disabled")||this.$el.hasClass("hidden"))),this.$link.on("click.ikSelect",t.proxy(this,"_linkClick")),this.$el.on({"focus.ikSelect":t.proxy(this,"_elFocus"),"blur.ikSelect":t.proxy(this,"_elBlur"),"change.ikSelect":t.proxy(this,"_syncOriginalOption"),"keydown.ikSelect keyup.ikSelect":t.proxy(this,"_elKeyUpDown")}),this.$list.on({"click.ikSelect":t.proxy(this,"_optionClick"),"mouseover.ikSelect":t.proxy(this,"_optionMouseover")},".ik_select_option"),this.$wrapper.on("click",function(){return!1}),this.$el.after(this.$wrapper),this.redraw(),this.$el.appendTo(this.$wrapper),this.options.onInit(this),this.$el.trigger("ikinit",this)},_linkClick:function(){this.isDisabled||(this===o?this.hideDropdown():this.showDropdown())},_optionClick:function(){this._makeOptionActive(this.searchIndexes?this.$optionSetOriginal.index(this.$hover):this.hoverIndex,!0),this.hideDropdown(),this.$el.change().focus()},_optionMouseover:function(i){var e=t(i.currentTarget);e.hasClass("ik_select_option_disabled")||(this.$hover.removeClass("ik_select_hover"),this.$hover=e.addClass("ik_select_hover"),this.hoverIndex=this.$optionSet.index(this.$hover))},_makeOptionActive:function(i,e){var s=t(this.el.options[i]),o="";s.data("img_src")&amp;&amp;(o+='&lt;span class="icon_color" style="background: url('+s.data("img_src")+')"&gt;&lt;/span&gt;',this.$link.addClass("img")),s.attr("title")&amp;&amp;this.$link.attr("title",s.attr("title")),o+=s.text(),this.$linkText.html(o),this.$link.toggleClass("ik_select_link_novalue",!s.attr("value")),this.$hover.removeClass("ik_select_hover"),this.$active.removeClass("ik_select_active"),this.$hover=this.$active=this.$optionSet.eq(i).addClass("ik_select_hover ik_select_active"),this.hoverIndex=i,e&amp;&amp;this._syncFakeOption()},_elKeyUpDown:function(i){var e,s=t(i.currentTarget),o=i.type,n=i.which;switch(n){case 38:"keydown"===o&amp;&amp;(i.preventDefault(),this._moveToPrevActive());break;case 40:"keydown"===o&amp;&amp;(i.preventDefault(),this._moveToNextActive());break;case 33:"keydown"===o&amp;&amp;(i.preventDefault(),e=this.$hover.position().top-this.$listInner.height(),this._moveToPrevActive(function(t){return t&lt;=e}));break;case 34:"keydown"===o&amp;&amp;(i.preventDefault(),e=this.$hover.position().top+this.$listInner.height(),this._moveToNextActive(function(t){return t&gt;=e}));break;case 36:"keydown"===o&amp;&amp;s.is(this.$el)&amp;&amp;(i.preventDefault(),this._moveToFirstActive());break;case 35:"keydown"===o&amp;&amp;s.is(this.$el)&amp;&amp;(i.preventDefault(),this._moveToLastActive());break;case 32:"keydown"===o&amp;&amp;s.is(this.$el)&amp;&amp;(i.preventDefault(),this.$dropdown.is(":visible")?this.$hover.click():this._linkClick());break;case 13:"keydown"===o&amp;&amp;this.$dropdown.is(":visible")&amp;&amp;(i.preventDefault(),this.$hover.click());break;case 27:"keydown"===o&amp;&amp;this.$dropdown.is(":visible")&amp;&amp;(i.preventDefault(),this.hideDropdown());break;case 9:"keydown"===o&amp;&amp;(t.browser.webkit&amp;&amp;this.$dropdown.is(":visible")?i.preventDefault():this.hideDropdown());break;default:"keyup"===o&amp;&amp;s.is(this.$el)&amp;&amp;this._syncOriginalOption()}"keyup"===o&amp;&amp;t.browser.mozilla&amp;&amp;this._syncFakeOption(),"keydown"===o&amp;&amp;(this.options.onKeyDown(this,n),this.$el.trigger("ikkeydown",[this,n])),"keyup"===o&amp;&amp;(this.options.onKeyUp(this,n),this.$el.trigger("ikkeyup",[this,n]))},_moveTo:function(i){var e,s,o;if(!this.$dropdown.is(":visible")&amp;&amp;t.browser.webkit)return this.showDropdown(),this;!this.$dropdown.is(":visible")||t.browser.mozilla?this._makeOptionActive(i,!0):(this.$hover.removeClass("ik_select_hover"),this.$hover=this.$optionSet.eq(i).addClass("ik_select_hover"),this.hoverIndex=i),s=(e=this.$hover.position().top)+this.$active.outerHeight(),this.$hover.index()||(o=this.$hover.closest(".ik_select_optgroup")).length&amp;&amp;(e=o.position().top),s&gt;this.$listInner.height()?this.$listInner.scrollTop(this.$listInner.scrollTop()+s-this.$listInner.height()):e&lt;0&amp;&amp;this.$listInner.scrollTop(this.$listInner.scrollTop()+e),this.options.onHoverMove(this),this.$el.trigger("ikhovermove",this)},_moveToFirstActive:function(){for(var t=0;t&lt;this.$optionSet.length;t++)if(!this.$optionSet.eq(t).hasClass("ik_select_option_disabled")){this._moveTo(t);break}},_moveToLastActive:function(){for(var t=this.$optionSet.length-1;t&gt;=0;t++)if(!this.$optionSet.eq(t).hasClass("ik_select_option_disabled")){this._moveTo(t);break}},_moveToPrevActive:function(t){for(var i,e=this.hoverIndex-1;e&gt;=0;e--)if(!(i=this.$optionSet.eq(e)).hasClass("ik_select_option_disabled")&amp;&amp;(void 0===t||t(i.position().top))){this._moveTo(e);break}},_moveToNextActive:function(t){for(var i,e=this.hoverIndex+1;e&lt;this.$optionSet.length;e++)if(!(i=this.$optionSet.eq(e)).hasClass("ik_select_option_disabled")&amp;&amp;(void 0===t||t(i.position().top))){this._moveTo(e);break}},_elFocus:function(){var t,i,e;if(this.isDisabled)return this;this.$link.addClass("ik_select_link_focus"),((t=this.$wrapper.offset().top)+this.$wrapper.height()&gt;(i=n.scrollTop())+(e=n.height())||t&lt;i)&amp;&amp;n.scrollTop(t-e/2)},_elBlur:function(){this.$link.removeClass("ik_select_link_focus")},_filterKeyup:function(){var i,e=t.trim(this.$filter.val());this.$listInner.show(),void 0===this.searchIndexes&amp;&amp;(this.$optionSetOriginal=this.$optionSet,this.searchIndexes=t.makeArray(this.$optionSet.map(function(i,e){return t(e).text().toLowerCase()}))),e!==i&amp;&amp;(""===e?(this.$optionSet=this.$optionSetOriginal.show(),this.$optgroupSet.show(),this.$nothingFoundText.remove()):(this.$optionSet=t([]),this.$optgroupSet.show(),this.$optionSetOriginal.each(t.proxy(function(i,s){var o=t(s);this.searchIndexes[i].indexOf(e.toLowerCase())&gt;=0?(this.$optionSet=this.$optionSet.add(o),o.show()):o.hide()},this)),this.$optionSet.length?(this.$nothingFoundText.remove(),this.$optgroupSet.each(function(i,e){var s=t(e);t(".ik_select_option:visible",s).length||s.hide()}),this.$hover.is(":visible")||this._moveToFirstActive()):(this.$listInner.hide(),this.$list.append(this.$nothingFoundText))),i=e)},_syncFakeOption:function(){this.el.selectedIndex=this.hoverIndex},_syncOriginalOption:function(){this._makeOptionActive(this.el.selectedIndex)},_fixHeight:function(){this.$dropdown.show(),this.$listInner.css("height","auto"),this.$listInner.height()&gt;this.options.ddMaxHeight&amp;&amp;this.$listInner.css({overflow:"auto",height:this.options.ddMaxHeight,position:"relative"}),this.$dropdown.hide()},redraw:function(){var i,e,s;this.options.filter&amp;&amp;this.$filter.hide(),this.$wrapper.css({position:"relative"}),this.$dropdown.css({position:"absolute",zIndex:9998,width:"100%"}),this.$list.css({position:"relative"}),this._fixHeight(),(this.options.dynamicWidth||this.options.autoWidth||this.options.ddFullWidth)&amp;&amp;(this.$wrapper.width(""),this.$dropdown.show().width(9999),this.$listInner.css("float","left"),this.$list.css("float","left"),i=this.$list.outerWidth(!0),e=this.$listInner.width()-this.$listInnerUl.width(),this.$list.css("float",""),this.$listInner.css("float",""),this.$dropdown.css("width","100%"),this.options.ddFullWidth&amp;&amp;this.$dropdown.width(i+e),this.options.dynamicWidth?this.$wrapper.css({display:"inline-block",width:"auto",verticalAlign:"top"}):this.options.autoWidth&amp;&amp;this.$wrapper.width(i+(this.options.equalWidths?e:0)).addClass("ik_select_autowidth"),s=this.$wrapper.parent().width(),this.$wrapper.width()&gt;s&amp;&amp;this.$wrapper.width(s)),this.options.filter&amp;&amp;this.$filter.show().outerWidth(this.$filterWrap.width()),this.$dropdown.hide(),this.$el.css({position:"absolute",margin:0,padding:0,top:0,left:-9999}),t.browser.mobile&amp;&amp;this.$el.css({opacity:0,left:0,height:this.$wrapper.height(),width:this.$wrapper.width()})},reset:function(){var i="";this.$linkText.html(this.$el.val()),this.$listInner.empty(),i="&lt;ul&gt;",this.$el.children().each(t.proxy(function(e,s){var o,n=t(s),r=s.tagName.toLowerCase();"optgroup"===r?(o=n.children().map(t.proxy(function(i,e){return this._generateOptionObject(t(e))},this)),o=t.makeArray(o),i+=this._renderListOptgroup({label:n.attr("label")||"&amp;nbsp;",isDisabled:n.is(":disabled"),options:o})):"option"===r&amp;&amp;(i+=this._renderListOption(this._generateOptionObject(n)))},this)),i+="&lt;/ul&gt;",this.$listInner.append(i),this._syncOriginalOption(),this.$listInnerUl=t("&gt; ul",this.$listInner),this.$optgroupSet=t(".ik_select_optgroup",this.$listInner),this.$optionSet=t(".ik_select_option",this.$listInner)},hideDropdown:function(){this.options.filter&amp;&amp;(this.$filter.val(""),this._filterKeyup()),this.$dropdown.hide().appendTo(this.$wrapper).css({left:"",top:""}),this.options.extractLink&amp;&amp;(this.$wrapper.outerWidth(this.$wrapper.data("outerWidth")),this.$wrapper.height(""),this.$link.removeClass("ik_select_link_extracted").css({position:"",top:"",left:"",zIndex:""}).prependTo(this.$wrapper)),o=null,this.$el.focus(),this.options.onHide(this),this.$el.trigger("ikhide",this)},showDropdown:function(){var i,e,s,r,h,l,p,a,d;o!==this&amp;&amp;this.$optionSet.length&amp;&amp;(o&amp;&amp;o.hideDropdown(),this._syncOriginalOption(),t(".show_un_props").length?this.$dropdown.addClass("show_un_props"):t(".unshow_un_props").length&amp;&amp;this.$dropdown.addClass("unshow_un_props"),this.$dropdown.show(),i=this.$dropdown.offset(),e=this.$dropdown.outerWidth(!0),s=this.$dropdown.outerHeight(!0),r=this.$wrapper.offset(),l=n.width(),p=n.height(),a=n.scrollTop(),this.options.ddFullWidth&amp;&amp;r.left+e&gt;l&amp;&amp;(i.left=l-e),i.top+s&gt;a+p&amp;&amp;(i.top=a+p-s),this.$dropdown.css({left:i.left,top:i.top,width:this.$dropdown.width()}).appendTo("body"),this.options.extractLink&amp;&amp;(d=this.$link.offset(),h=this.$wrapper.outerWidth(),this.$wrapper.data("outerWidth",h),this.$wrapper.outerWidth(h),this.$wrapper.outerHeight(this.$wrapper.outerHeight()),this.$link.outerWidth(this.$link.outerWidth()),this.$link.addClass("ik_select_link_extracted").css({position:"absolute",top:d.top,left:d.left,zIndex:9999}).appendTo("body")),this.$listInner.scrollTop(this.$active.position().top-this.$list.height()/2),this.options.filter?this.$filter.focus():this.$el.focus(),o=this,this.options.onShow(this),this.$el.trigger("ikshow",this))},_generateOptionObject:function(t){return{value:t.val(),label:t.html()||"&amp;nbsp;",isDisabled:t.is(":disabled"),dataParam:t.data(),className:t.attr("class"),title:t.attr("title")}},_renderListOption:function(t){var i,e=t.isDisabled?" ik_select_option_disabled":"",s=t.dataParam.img_src?" img":"",o="hidden"==t.className?" missing":"",n=t.title;return i='&lt;li class="ik_select_option'+e+s+o+'" title="'+n+'" data-value="'+t.value+'"&gt;',i+='&lt;span class="ik_select_option_label" title="'+n+'"&gt;',t.dataParam.img_src&amp;&amp;(i+='&lt;span class="icon_color" style="background: url('+t.dataParam.img_src+')"&gt;&lt;/span&gt;'),i+=t.label,i+="&lt;/span&gt;",i+="&lt;/li&gt;"},_renderListOptgroup:function(i){var e,s=i.isDisabled?" ik_select_optgroup_disabled":"";return e='&lt;li class="ik_select_optgroup'+s+'"&gt;',e+='&lt;div class="ik_select_optgroup_label"&gt;'+i.label+"&lt;/div&gt;",e+="&lt;ul&gt;",t.isArray(i.options)&amp;&amp;t.each(i.options,t.proxy(function(t,i){e+=this._renderListOption({value:i.value,label:i.label||"&amp;nbsp;",isDisabled:i.isDisabled})},this)),e+="&lt;/ul&gt;",e+="&lt;/li&gt;"},_renderOption:function(t){return'&lt;option value="'+t.value+'"&gt;'+t.label+"&lt;/option&gt;"},_renderOptgroup:function(i){var e;return e='&lt;optgroup label="'+i.label+'"&gt;',t.isArray(i.options)&amp;&amp;t.each(i.options,t.proxy(function(t,i){e+=this._renderOption(i)},this)),e+="&lt;/option&gt;"},addOptions:function(i,e,s){var o,n,r="",h="",l=this.$listInnerUl,p=this.$el;i=t.isArray(i)?i:[i],t.each(i,t.proxy(function(t,i){r+=this._renderListOption(i),h+=this._renderOption(i)},this)),t.isNumeric(s)&amp;&amp;s&lt;this.$optgroupSet.length&amp;&amp;(l=this.$optgroupSet.eq(s),p=t("optgroup",this.$el).eq(s)),t.isNumeric(e)&amp;&amp;e&lt;(o=t(".ik_select_option",l)).length&amp;&amp;(o.eq(e).before(r),(n=t("option",p)).eq(e).before(h)),n||(l.append(r),p.append(h)),this.$optionSet=t(".ik_select_option",this.$listInner),this._fixHeight()},addOptgroups:function(i,e){var s="",o="";i&amp;&amp;(i=t.isArray(i)?i:[i],t.each(i,t.proxy(function(t,i){s+=this._renderListOptgroup(i),o+=this._renderOptgroup(i)},this)),t.isNumeric(e)&amp;&amp;e&lt;this.$optgroupSet.length?(this.$optgroupSet.eq(e).before(s),t("optgroup",this.$el).eq(e).before(o)):(this.$listInnerUl.append(s),this.$el.append(o)),this.$optgroupSet=t(".ik_select_optgroup",this.$listInner),this.$optionSet=t(".ik_select_option",this.$listInner),this._fixHeight())},removeOptions:function(i,e){var s,o,n=t([]);t.isNumeric(e)&amp;&amp;(e&lt;0?(s=t("&gt; .ik_select_option",this.$listInnerUl),o=t("&gt; option",this.$el)):e&lt;this.$optgroupSet.length&amp;&amp;(s=t(".ik_select_option",this.$optgroupSet.eq(e)),o=t("optgroup",this.$el).eq(e).find("option"))),s||(s=this.$optionSet,o=t(this.el.options)),t.isArray(i)||(i=[i]),t.each(i,t.proxy(function(t,i){i&lt;s.length&amp;&amp;(n=n.add(s.eq(i)).add(o.eq(i)))},this)),n.remove(),this.$optionSet=t(".ik_select_option",this.$listInner),this._syncOriginalOption(),this._fixHeight()},removeOptgroups:function(i){var e=t([]),s=t("optgroup",this.el);t.isArray(i)||(i=[i]),t.each(i,t.proxy(function(t,i){i&lt;this.$optgroupSet.length&amp;&amp;(e=e.add(this.$optgroupSet.eq(i)).add(s.eq(i)))},this)),e.remove(),this.$optionSet=t(".ik_select_option",this.$listInner),this.$optgroupSet=t(".ik_select_optgroup",this.$listInner),this._syncOriginalOption(),this._fixHeight()},disable:function(){this.toggle(!1)},enable:function(){this.toggle(!0)},toggle:function(t){this.isDisabled=void 0!==t?!t:!this.isDisabled,this.$el.prop("disabled",this.isDisabled),this.$link.toggleClass("ik_select_link_disabled",this.isDisabled)},select:function(t,i){i?this.el.selectedIndex=t:this.$el.val(t),this._syncOriginalOption()},disableOptgroups:function(t){this.toggleOptgroups(t,!1)},enableOptgroups:function(t){this.toggleOptgroups(t,!0)},toggleOptgroups:function(i,e){t.isArray(i)||(i=[i]),t.each(i,t.proxy(function(i,s){var o,n,r,h=[],l=t("optgroup",this.$el).eq(s);o=void 0!==e?e:l.prop("disabled"),l.prop("disabled",!o),this.$optgroupSet.eq(s).toggleClass("ik_select_optgroup_disabled",!o),n=t("option",l);for(var p=r=t(this.el.options).index(n.eq(0));p&lt;r+n.length;p++)h.push(p);this.toggleOptions(h,!0,o)},this)),this._syncOriginalOption()},disableOptions:function(t,i){this.toggleOptions(t,i,!1)},enableOptions:function(t,i){this.toggleOptions(t,i,!0)},toggleOptions:function(i,e,s){var o=t("option",this.el);t.isArray(i)||(i=[i]);var n=t.proxy(function(t,i){var e=void 0!==s?s:t.prop("disabled");t.prop("disabled",!e),this.$optionSet.eq(i).toggleClass("ik_select_option_disabled",!e)},this);t.each(i,function(i,s){e?n(o.eq(s),s):o.each(function(i,e){var o=t(e);if(o.val()===s)return n(o,i),this})}),this._syncOriginalOption()},detach:function(){this.$el.off(".ikSelect").css({width:"",height:"",left:"",top:"",position:"",margin:"",padding:""}),this.$wrapper.before(this.$el),this.$wrapper.remove(),this.$el.removeData("plugin_ikSelect")}}),t.fn.ikSelect=function(i){var e;return t.browser.operamini?this:(e=Array.prototype.slice.call(arguments,1),this.each(function(){var s;t.data(this,"plugin_ikSelect")?"string"==typeof i&amp;&amp;"function"==typeof(s=t.data(this,"plugin_ikSelect"))[i]&amp;&amp;s[i].apply(s,e):t.data(this,"plugin_ikSelect",new p(this,i))}))},t.ikSelect={extendDefaults:function(i){t.extend(r,i)}},t(e).bind("click.ikSelect",function(){o&amp;&amp;o.hideDropdown()})}(jQuery,window,document);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:78:"/local/templates/aspro_max/js/jquery.mobile.custom.touch.min.js?17114177507784";s:6:"source";s:63:"/local/templates/aspro_max/js/jquery.mobile.custom.touch.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/*! jQuery Mobile v1.4.5 | Copyright 2010, 2014 jQuery Foundation, Inc. | jquery.org/license */

(function(e,t,n){typeof define=="function"&amp;&amp;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&amp;&amp;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)/)&gt;-1&amp;&amp;(o=f);if(s)for(p=o.length,l;p;)l=o[--p],t[l]=s[l];i.search(/mouse(down|up)|click/)&gt;-1&amp;&amp;!t.which&amp;&amp;(t.which=1);if(i.search(/^touch/)!==-1){a=T(s),i=a.touches,c=a.changedTouches,h=i&amp;&amp;i.length?i[0]:c&amp;&amp;c.length?c[0]:r;if(h)for(d=0,v=u.length;d&lt;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]&amp;&amp;(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&amp;&amp;(!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&amp;&amp;(clearTimeout(c),c=0)}function P(t,n,r){var i;if(r&amp;&amp;r[t]||!r&amp;&amp;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&amp;&amp;(!E||E!==n)&amp;&amp;(r=P("v"+t.type,t),r&amp;&amp;(r.isDefaultPrevented()&amp;&amp;t.preventDefault(),r.isPropagationStopped()&amp;&amp;t.stopPropagation(),r.isImmediatePropagationStopped()&amp;&amp;t.stopImmediatePropagation()))}function B(t){var n=T(t).touches,r,i,o;n&amp;&amp;n.length===1&amp;&amp;(r=t.target,i=C(r),i.hasVirtualBinding&amp;&amp;(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;d||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)&gt;i||Math.abs(n.pageY-p)&gt;i,d&amp;&amp;!r&amp;&amp;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&amp;&amp;n.isDefaultPrevented()&amp;&amp;(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&amp;&amp;b.bind(n,H),e(this).bind(n,R),y&amp;&amp;(l.touchstart=(l.touchstart||0)+1,l.touchstart===1&amp;&amp;b.bind("touchstart",B).bind("touchend",I).bind("touchmove",F).bind("scroll",j))},teardown:function(){--l[t],l[t]||b.unbind(n,H),y&amp;&amp;(--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&amp;&amp;(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&lt;o.length;x++)e.event.special[o[x]]=U(o[x]);y&amp;&amp;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&lt;n;a++){f=v[a],l=0;if(u===r&amp;&amp;Math.abs(f.x-i)&lt;S&amp;&amp;Math.abs(f.y-o)&lt;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&amp;&amp;(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&amp;&amp;o===e.target?l(t,"tap",e):r&amp;&amp;e.preventDefault()}r=!1;if(s.which&amp;&amp;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&amp;&amp;Math.floor(s)&gt;Math.floor(e.pageY)||e.pageX===0&amp;&amp;Math.floor(i)&gt;Math.floor(e.pageX))i-=n,s-=r;else if(s&lt;e.pageY-r||i&lt;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&lt;e.event.special.swipe.durationThreshold&amp;&amp;Math.abs(t.coords[0]-n.coords[0])&gt;e.event.special.swipe.horizontalDistanceThreshold&amp;&amp;Math.abs(t.coords[1]-n.coords[1])&lt;e.event.special.swipe.verticalDistanceThreshold){var s=t.coords[0]&gt;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&amp;&amp;(e.event.special.swipe.eventInProgress=!1)),Math.abs(o.coords[0]-r.coords[0])&gt;e.event.special.swipe.scrollSupressionThreshold&amp;&amp;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&amp;&amp;(n=t.swipe,delete t.swipe,t.length--,t.length===0&amp;&amp;e.removeData(this,"mobile-events")),n&amp;&amp;(n.start&amp;&amp;e(this).off(u,n.start),n.move&amp;&amp;i.off(f,n.move),n.stop&amp;&amp;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)});
/* End */
;
; /* Start:"a:4:{s:4:"full";s:68:"/local/templates/aspro_max/js/jquery.dotdotdot.min.js?17114177495908";s:6:"source";s:49:"/local/templates/aspro_max/js/jquery.dotdotdot.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
!function(t,e){function n(t,e,n){var r=t.children(),o=!1;t.empty();for(var i=0,d=r.length;d&gt;i;i++){var l=r.eq(i);if(t.append(l),n&amp;&amp;t.append(n),a(t,e)){l.remove(),o=!0;break}n&amp;&amp;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&amp;&amp;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)&amp;&amp;(s=3==f.nodeType?o(h,n,i,d,l):r(h,n,i,d,l),s||(h.detach(),s=!0)),s||l&amp;&amp;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&amp;&amp;0==y&amp;&amp;0==b&amp;&amp;(p="",g=f.split(p),b=g.length-1);b&gt;=y&amp;&amp;(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&amp;&amp;0==y&amp;&amp;0==b&amp;&amp;(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&amp;&amp;0==g[0].length){var T=e.parent();e.detach();var x=d&amp;&amp;d.closest(T).length?d.length:0;T.contents().length&gt;x?c=u(T.contents().eq(-1-x),n):(c=u(T,n,!0),x||T.detach()),c&amp;&amp;(f=i(s(c),o),l(c,f),x&amp;&amp;d&amp;&amp;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()&gt;e.maxHeight}function i(e,n){for(;t.inArray(e.slice(-1),n.lastCharacter.remove)&gt;-1;)e=e.slice(0,-1);return t.inArray(e.slice(-1),n.lastCharacter.noEllipsis)&lt;0&amp;&amp;(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&amp;&amp;(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&amp;&amp;1!==t.nodeType&amp;&amp;3!==t.nodeType);return t}function u(e,n,r){var o,a=e&amp;&amp;e[0];if(a){if(!r){if(3===a.nodeType)return a;if(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&gt;r;r++){var a=parseInt(t.css(n[r]),10);isNaN(a)&amp;&amp;(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&gt;1)return this.each(function(){t(this).dotdotdot(e)});var o=this;o.data("dotdotdot")&amp;&amp;o.trigger("destroy.dot"),o.data("dotdotdot-style",o.attr("style")||""),o.css("word-wrap","break-word"),"nowrap"===o.css("white-space")&amp;&amp;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&amp;&amp;(("string"==typeof d||"nodeType"in d&amp;&amp;1===d.nodeType)&amp;&amp;(d=t("&lt;div /&gt;").append(d).contents()),d instanceof t&amp;&amp;(i=d)),g=o.wrapInner('&lt;div class="dotdotdot" /&gt;').children(),g.contents().detach().end().append(i.clone(!0)).find("br").replaceWith("  &lt;br /&gt;  ").end().css({height:"auto",width:"auto",border:"none",padding:0,margin:0});var c=!1,u=!1;return s.afterElement&amp;&amp;(c=s.afterElement.clone(!0),c.show(),s.afterElement.detach()),a(g,l)&amp;&amp;(u="children"==l.wrap?n(g,l,c):r(g,o,g,l,c)),g.replaceWith(g.contents()),g=null,t.isFunction(l.callback)&amp;&amp;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&amp;&amp;e.call(o[0],s.isTruncated),s.isTruncated}).bind("originalContent.dot",function(t,e){return t.preventDefault(),t.stopPropagation(),"function"==typeof e&amp;&amp;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()&amp;&amp;r==e.height()&amp;&amp;l.windowResizeFix||(n=e.width(),r=e.height(),u&amp;&amp;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)&amp;&amp;(o.trigger("update.dot"),c=t)}},500);return o},o.unwatch=function(){return t(window).unbind("resize.dot"+s.dotId),u&amp;&amp;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&amp;&amp;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&amp;&amp;!t.isFunction(n)&amp;&amp;this.data("dotdotdot")?this.trigger("update",[n]):g.apply(this,arguments)};var v=t.fn.text;t.fn.text=function(n){return n!=e&amp;&amp;!t.isFunction(n)&amp;&amp;this.data("dotdotdot")?(n=t("&lt;div /&gt;").text(n).html(),this.trigger("update",[n])):v.apply(this,arguments)}}}(jQuery);
/* End */
;
; /* Start:"a:4:{s:4:"full";s:61:"/local/templates/aspro_max/js/rating_likes.js?171141774910797";s:6:"source";s:45:"/local/templates/aspro_max/js/rating_likes.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
if (!BXRL)
{
	var BXRL = {};
	var BXRLW = null;
}

RatingLikes = function(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax)
{
	this.enabled = true;
	this.likeId = likeId;
	this.entityTypeId = entityTypeId;
	this.entityId = entityId;
	this.available = (available == 'Y');
	this.userId = userId;
	this.localize = localize;
	this.template = template;
	this.pathToUserProfile = pathToUserProfile;
	this.pathToAjax = typeof(pathToAjax) == "string"? pathToAjax: '/bitrix/components/bitrix/rating.vote/vote.ajax.php';

	this.box = BX('bx-ilike-button-'+likeId);
	if (this.box === null)
	{
		this.enabled = false;
		return false;
	}

	this.button = BX.findChild(this.box, {className:'bx-ilike-left-wrap'}, true, false);
	this.wrapp = BX.findChild(this.box, {className:'all-wrapper'}, true, false);
	this.buttonText = BX.findChild(this.button, {className:'bx-ilike-text'}, true, false);
	this.count = BX.findChild(this.box,  {tagName:'span', className:'bx-ilike-right-wrap'}, true, false);
	this.countText	= BX.findChild(this.count, {tagName:'span', className:'bx-ilike-right'}, true, false);
	this.popup = null;
	this.popupId = null;
	this.popupOpenId = null;
	this.popupTimeoutId = null;
	this.popupContent = BX.findChild(BX('bx-ilike-popup-cont-'+likeId), {tagName:'span', className:'bx-ilike-popup'}, true, false);
	this.popupContentPage = 1;
	this.popupListProcess = false;
	this.popupTimeout = false;
	this.likeTimeout = false;

	this.lastVote = BX.hasClass(template == 'standart'? this.button: this.count, 'bx-you-like')? 'plus': 'cancel';
};

RatingLikes.LiveUpdate = function(params)
{
	if (params.USER_ID == BX.message('USER_ID'))
		return false;

	for(var i in BXRL)
	{
		if (BXRL.hasOwnProperty(i))
		{
			if (BXRL[i].entityTypeId == params.ENTITY_TYPE_ID &amp;&amp; BXRL[i].entityId == params.ENTITY_ID)
			{
				var element = BXRL[i];
				element.countText.innerHTML = parseInt(params.TOTAL_POSITIVE_VOTES);
				element.count.insertBefore(
					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')})
					, element.count.firstChild);

				if (element.popup)
				{
					element.popup.close();
					element.popupContentPage = 1;
				}
			}
		}
	}
};

RatingLikes.Set = function(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax)
{
	if (template === undefined)
		template = 'standart';

	if (!BXRL[likeId] || BXRL[likeId].tryToSet &lt;= 5)
	{
		var tryToSend = BXRL[likeId] &amp;&amp; BXRL[likeId].tryToSet? BXRL[likeId].tryToSet: 1;
		BXRL[likeId] = new RatingLikes(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax);
		if (BXRL[likeId].enabled)
		{
			RatingLikes.Init(likeId);
		}
		else
		{
			setTimeout(function(){
				BXRL[likeId].tryToSet = tryToSend+1;
				RatingLikes.Set(likeId, entityTypeId, entityId, available, userId, localize, template, pathToUserProfile, pathToAjax);
			}, 500);
		}
	}
};

RatingLikes.Init = function(likeId)
{
	// like/unlike button
	if (BXRL[likeId].available)
	{

		BX.bind(BXRL[likeId].template == 'standart'? BXRL[likeId].button: BXRL[likeId].buttonText, 'click' ,function(e) {
			clearTimeout(BXRL[likeId].likeTimeout);
			if (BX.hasClass(BXRL[likeId].template == 'standart'? this: BXRL[likeId].count, 'bx-you-like'))
			{
				BXRL[likeId].buttonText.innerHTML	=	BXRL[likeId].localize['LIKE_N'];
				BXRL[likeId].countText.innerHTML		= 	parseInt(BXRL[likeId].countText.innerHTML)-1;
				BX.removeClass(BXRL[likeId].template == 'standart'? this: BXRL[likeId].count, 'bx-you-like');

				BXRL[likeId].likeTimeout = setTimeout(function(){
					if (BXRL[likeId].lastVote != 'cancel')
						RatingLikes.Vote(likeId, 'cancel');
				}, 1000);
			}
			else
			{
				BXRL[likeId].buttonText.innerHTML	=	BXRL[likeId].localize['LIKE_Y'];
				BXRL[likeId].countText.innerHTML 	= 	parseInt(BXRL[likeId].countText.innerHTML)+1;
				BX.addClass(BXRL[likeId].template == 'standart'? this: BXRL[likeId].count, 'bx-you-like');

				BXRL[likeId].likeTimeout = setTimeout(function(){
					if (BXRL[likeId].lastVote != 'plus')
						RatingLikes.Vote(likeId, 'plus');
				}, 1000);
			}
			BX.removeClass(this.box, 'bx-ilike-button-hover');
			BX.PreventDefault(e);
		});
		// Hover/unHover like-button
		BX.bind(BXRL[likeId].box, 'mouseover', function() {BX.addClass(this, 'bx-ilike-button-hover')});
		BX.bind(BXRL[likeId].box, 'mouseout', function() {BX.removeClass(this, 'bx-ilike-button-hover')});

	}
	else
	{
		if (BXRL[likeId].buttonText != undefined)
			BXRL[likeId].buttonText.innerHTML	=	BXRL[likeId].localize['LIKE_D'];
	}
	// get like-user-list
	RatingLikes.PopupScroll(likeId);
	console.log();
	BX.bind(BXRL[likeId].wrapp, 'mouseover' , function() {
		clearTimeout(BXRL[likeId].popupTimeoutId);
		BXRL[likeId].popupTimeoutId = setTimeout(function(){
			if (BXRLW == likeId)
				return false;
			if (BXRL[likeId].popupContentPage == 1)
				RatingLikes.List(likeId, 1);
			BXRL[likeId].popupTimeoutId = setTimeout(function() {
				RatingLikes.OpenWindow(likeId);
			}, 400);
		}, 400);
	});
	BX.bind(BXRL[likeId].wrapp, 'mouseout' , function() {
		clearTimeout(BXRL[likeId].popupTimeoutId);
	});
	/*BX.bind(BXRL[likeId].count, 'click' , function() {
		clearTimeout(BXRL[likeId].popupTimeoutId);
		if (BXRL[likeId].popupContentPage == 1)
			RatingLikes.List(likeId, 1);
		RatingLikes.OpenWindow(likeId);
	});*/

	BX.bind(BXRL[likeId].box, 'mouseover' , function() {
		clearTimeout(BXRL[likeId].popupTimeout);
	});
	BX.bind(BXRL[likeId].box, 'mouseout' , function() {
		clearTimeout(BXRL[likeId].popupTimeout);
		BXRL[likeId].popupTimeout = setTimeout(function(){
			if (BXRL[likeId].popup !== null)
			{
				BXRL[likeId].popup.close();
				BXRLW = null;
			}
		}, 1000);
	});
};

RatingLikes.OpenWindow = function(likeId)
{
	if (parseInt(BXRL[likeId].countText.innerHTML) == 0)
		return false;

	if (BXRL[likeId].popup == null)
	{
		BXRL[likeId].popup = new BX.PopupWindow('ilike-popup-'+likeId, (BXRL[likeId].template == 'standart'? BXRL[likeId].count: BXRL[likeId].box), {
			lightShadow : true,
			offsetLeft: 5,
			autoHide: true,
			closeByEsc: true,
			zIndex: 2005,
			bindOptions: {position: "top"},
			events : {
				onPopupClose : function() { BXRLW = null; },
				onPopupDestroy : function() {  }
			},
			content : BX('bx-ilike-popup-cont-'+likeId)
		});
		BXRL[likeId].popup.setAngle({});

		BX.bind(BX('ilike-popup-'+likeId), 'mouseout' , function() {
			clearTimeout(BXRL[likeId].popupTimeout);
			BXRL[likeId].popupTimeout = setTimeout(function(){
				BXRL[likeId].popup.close();
			}, 1000);
		});

		BX.bind(BX('ilike-popup-'+likeId), 'mouseover' , function() {
			clearTimeout(BXRL[likeId].popupTimeout);
		});
	}

	if (BXRLW != null)
		BXRL[BXRLW].popup.close();

	BXRLW = likeId;
	BXRL[likeId].popup.show();

	RatingLikes.AdjustWindow(likeId);
};

RatingLikes.Vote = function(likeId, voteAction)
{
	BX.ajax({
		url: BXRL[likeId].pathToAjax,
		method: 'POST',
		dataType: 'json',
		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()},
		onsuccess: function(data)	{
			BXRL[likeId].lastVote = data.action;
			BXRL[likeId].countText.innerHTML = data.items_all;
			BXRL[likeId].popupContentPage = 1;

			BXRL[likeId].popupContent.innerHTML = '';
			spanTag0 = document.createElement("span");
			spanTag0.className = "bx-ilike-wait";
			BXRL[likeId].popupContent.appendChild(spanTag0);
			RatingLikes.AdjustWindow(likeId);

			if(BX('ilike-popup-'+likeId) &amp;&amp; BX('ilike-popup-'+likeId).style.display == "block")
				RatingLikes.List(likeId, null);
		},
		onfailure: function(data)	{}
	});
	return false;
};

RatingLikes.List = function(likeId, page)
{
	if (parseInt(BXRL[likeId].countText.innerHTML) == 0)
		return false;

	if (page == null)
		page = BXRL[likeId].popupContentPage;
	BXRL[likeId].popupListProcess = true;
	BX.ajax({
		url: BXRL[likeId].pathToAjax,
		method: 'POST',
		dataType: 'json',
		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()},
		onsuccess: function(data)
		{
			BXRL[likeId].countText.innerHTML = data.items_all;

			if ( parseInt(data.items_page) == 0 )
				return false;

			if (page == 1)
			{
				BXRL[likeId].popupContent.innerHTML = '';
				spanTag0 = document.createElement("span");
				spanTag0.className = "bx-ilike-bottom_scroll";
				BXRL[likeId].popupContent.appendChild(spanTag0);
			}
			BXRL[likeId].popupContentPage += 1;

			var avatarNode = null;

			for (var i = 0; i &lt; data.items.length; i++)
			{
				if (data.items[i]['PHOTO_SRC'].length &gt; 0)
				{
					avatarNode = BX.create("IMG", {
						attrs: {src: data.items[i]['PHOTO_SRC']},
						props: {className: "bx-ilike-popup-avatar-img"}
					});
				}
				else
				{
					avatarNode = BX.create("IMG", {
						attrs: {src: '/bitrix/images/main/blank.gif'},
						props: {className: "bx-ilike-popup-avatar-img bx-ilike-popup-avatar-img-default"}
					});
				}

				BXRL[likeId].popupContent.appendChild(
					BX.create("div", {
						/*attrs: {
							href: data.items[i]['URL'],
							target: '_blank'
						},*/
						props: {
							className: "bx-ilike-popup-img" + (!!data.items[i]['USER_TYPE'] ? " bx-ilike-popup-img-" + data.items[i]['USER_TYPE'] : "")
						},
						children: [
							BX.create("SPAN", {
								props: {
									className: "bx-ilike-popup-avatar-new"
								},
								children: [
									avatarNode,
									BX.create("SPAN", {
										props: {className: "bx-ilike-popup-avatar-status-icon"}
									})
								]
							}),
							BX.create("SPAN", {
								props: {
									className: "bx-ilike-popup-name-new"
								},
								html: data.items[i]['FULL_NAME']
							})
						]
					})
				);
			}

			RatingLikes.AdjustWindow(likeId);
			RatingLikes.PopupScroll(likeId);

			BXRL[likeId].popupListProcess = false;
		},
		onfailure: function(data)	{}
	});
	return false;
};

RatingLikes.AdjustWindow = function(likeId)
{
	if (BXRL[likeId].popup != null)
	{
		BXRL[likeId].popup.bindOptions.forceBindPosition = true;
		BXRL[likeId].popup.adjustPosition();
		BXRL[likeId].popup.bindOptions.forceBindPosition = false;
	}
};

RatingLikes.PopupScroll = function(likeId)
{
	BX.bind(BXRL[likeId].popupContent, 'scroll' , function() {
		if (this.scrollTop &gt; (this.scrollHeight - this.offsetHeight) / 1.5)
		{
			RatingLikes.List(likeId, null);
			BX.unbindAll(this);
		}
	});
};

/* End */
;
; /* Start:"a:4:{s:4:"full";s:55:"/local/templates/aspro_max/js/mobile.js?171194855024651";s:6:"source";s:39:"/local/templates/aspro_max/js/mobile.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
$(document).ready(function(){
    /*  --- Bind mobile menu  --- */
        var $mobileMenu = $("#mobilemenu")
        if($mobileMenu.length){
            $mobileMenu.isLeftSide = $mobileMenu.hasClass('leftside')
            $mobileMenu.isOpen = $mobileMenu.hasClass('show')
            $mobileMenu.isDowndrop = $mobileMenu.find('&gt;.scroller').hasClass('downdrop')
            $mobileMenuNlo = $mobileMenu.find('[data-nlo]')

            $('#mobileheader .burger').click(function(){
                SwipeMobileMenu()
            })

            if($mobileMenu.isLeftSide){
                $mobileMenu.parent().append('&lt;div id="mobilemenu-overlay"&gt;&lt;/div&gt;')
                var $mobileMenuOverlay = $('#mobilemenu-overlay')

                $mobileMenuOverlay.click(function(){
                    if($mobileMenu.isOpen){
                        CloseMobileMenu()
                    }
                });

                // $(document).swiperight(function(e) {
                //     if(!$(e.target).closest('.flexslider').length &amp;&amp; !$(e.target).closest('.swipeignore').length &amp;&amp; !$(e.target).closest('.jqmWindow.popup').length){
                //         OpenMobileMenu()
                //     }
                // });

                // $(document).swipeleft(function(e) {
                //     if(!$(e.target).closest('.flexslider').length &amp;&amp; !$(e.target).closest('.swipeignore').length &amp;&amp; !$(e.target).closest('.jqmWindow.popup').length){
                //         CloseMobileMenu()
                //     }
                // });
            }
            else{
                $(document).on('click', '#mobileheader', function(e){
                    if(!$(e.target).closest('#mobilemenu').length &amp;&amp; !$(e.target).closest('.burger').length &amp;&amp; $mobileMenu.isOpen){
                        CloseMobileMenu()
                    }
                });
            }

            $(document).on('click', '#mobilemenu .menu a,#mobilemenu .social-icons a', function(e){
                var $this = $(this)
                if($this.hasClass('parent')){
                    e.preventDefault()

                    if(!$mobileMenu.isDowndrop){
                        $this.closest('li').addClass('expanded')
                        MoveMobileMenuWrapNext()
                    }
                    else{
                        if(!$this.closest('li').hasClass('expanded')){
                            $this.closest('li').addClass('expanded')
                        }
                        else{
                            $this.closest('li').removeClass('expanded')
                        }
                    }
                }
                else{
                    if($this.closest('li').hasClass('counters')){
                        var href = $this.attr('href')
                        if(typeof href !== 'undefined'){
                            window.location.href = href
                            window.location.reload()
                        }
                    }

                    if(!$this.closest('.menu_back').length){
                        CloseMobileMenu()
                    }
                }
            })

           $(document).on('click', '#mobilemenu .dropdown .menu_back', function(e){
                e.preventDefault()
                var $this = $(this)
                MoveMobileMenuWrapPrev()
                setTimeout(function(){
                    $this.closest('.expanded').removeClass('expanded')
                }, 400)
            })

            OpenMobileMenu = function(){
                CloseMobilePhone();

                if(!$mobileMenu.isOpen){
                    // hide styleswitcher
                    if($('.style-switcher').hasClass('active')){
                        $('.style-switcher .switch').trigger('click')
                    }
                    $('.style-switcher .switch').hide()

                    if($mobileMenu.isLeftSide){
                        // show overlay
                        setTimeout(function(){
                            $mobileMenuOverlay.fadeIn('fast')
                        }, 100)
                    }
                    else{
                        // scroll body to top &amp; set fixed
                        $('body').scrollTop(0).css({position: 'fixed'})

                        // set menu top = bottom of header
                        $mobileMenu.css({top: + ($('#mobileheader').height() + $('#mobileheader').offset().top) + 'px'})

                        // change burger icon
                        $('#mobileheader .burger').addClass('c')
                    }

                    // show menu
                    $mobileMenu.addClass('show')
                    $mobileMenu.isOpen = true

                    if(!$mobileMenu.isDowndrop){
                        var $wrap = $mobileMenu.find('.wrap').first()
                        var params =  $wrap.data('params')
                        if(typeof params === 'undefined'){
                            params = {
                                depth: 0,
                                scroll: {},
                                height: {}
                            }
                        }
                        $wrap.data('params', params)
                    }

                    if($mobileMenuNlo.length){
                        if(!$mobileMenuNlo.hasClass('nlo-loadings')){
                            $mobileMenuNlo.addClass('nlo-loadings');
                            setTimeout(function(){
                                $.ajax({
                                    data: {nlo: $mobileMenuNlo.attr('data-nlo')},
                                    success: function(response){
                                        $mobileMenuNlo[0].insertAdjacentHTML('beforebegin', $.trim(response));
                                        $mobileMenuNlo.remove();
                                    },
                                    error:function(){
                                        $mobileMenuNlo.removeClass('nlo-loadings');
                                    }
                                });
                            }, 300);
                        }
                    }
                }
            }

            CloseMobileMenu = function(){
                if($mobileMenu.isOpen){
                    // hide menu
                    $mobileMenu.removeClass('show')
                    $mobileMenu.isOpen = false

                    // show styleswitcher
                    $('.style-switcher .switch').show()

                    if($mobileMenu.isLeftSide){
                        // hide overlay
                        setTimeout(function(){
                            $mobileMenuOverlay.fadeOut('fast')
                        }, 100)
                    }
                    else{
                        // change burger icon
                        $('#mobileheader .burger').removeClass('c')

                        // body unset fixed
                        $('body').css({position: ''})
                    }

                    if(!$mobileMenu.isDowndrop){
                        setTimeout(function(){
                            var $scroller = $mobileMenu.find('.scroller').first()
                            var $wrap = $mobileMenu.find('.wrap').first()
                            var params =  $wrap.data('params')
                            params.depth = 0
                            $wrap.data('params', params).attr('style', '')
                            $mobileMenu.scrollTop(0)
                            $scroller.css('height', '')
                        }, 400)
                    }
                }
            }

            SwipeMobileMenu = function(){
                if($mobileMenu.isOpen){
                    CloseMobileMenu()
                }
                else{
                    OpenMobileMenu()
                }
            }

            function MoveMobileMenuWrapNext(){
                if(!$mobileMenu.isDowndrop){
                    var $scroller = $mobileMenu.find('.scroller').first()
                    var $wrap = $mobileMenu.find('.wrap').first()
                    if($wrap.length){
                        var params =  $wrap.data('params')
                        var $dropdownNext = $mobileMenu.find('.expanded&gt;.dropdown').eq(params.depth)
                        if($dropdownNext.length){
                            // save scroll position
                            params.scroll[params.depth] = parseInt($mobileMenu.scrollTop())

                            // height while move animating
                            params.height[params.depth + 1] = Math.max($dropdownNext.height(), (!params.depth ? $wrap.height() : $mobileMenu.find('.expanded&gt;.dropdown').eq(params.depth - 1).height()))
                            $scroller.css('height', params.height[params.depth + 1] + 'px')

                            // inc depth
                            ++params.depth

                            // translateX for move
                            $wrap.css('transform', 'translateX(' + -100 * params.depth + '%)')

                            // scroll to top
                            setTimeout(function() {
                                $mobileMenu.animate({scrollTop : 0}, 200);
                            }, 100)

                            // height on enimating end
                            var h = $dropdownNext.height()
                            setTimeout(function() {
                                if(h){
                                    $scroller.css('height', h + 'px')
                                }
                                else{
                                    $scroller.css('height', '')
                                }
                            }, 200)
                        }

                        $wrap.data('params', params)
                    }
                }
            }

            function MoveMobileMenuWrapPrev(){
                if(!$mobileMenu.isDowndrop){
                    var $scroller = $mobileMenu.find('.scroller').first()
                    var $wrap = $mobileMenu.find('.wrap').first()
                    if($wrap.length){
                        var params =  $wrap.data('params')
                        if(params.depth &gt; 0){
                            var $dropdown = $mobileMenu.find('.expanded&gt;.dropdown').eq(params.depth - 1)
                            if($dropdown.length){
                                // height while move animating
                                $scroller.css('height', params.height[params.depth] + 'px')

                                // dec depth
                                --params.depth

                                // translateX for move
                                $wrap.css('transform', 'translateX(' + -100 * params.depth + '%)')

                                // restore scroll position
                                setTimeout(function() {
                                    $mobileMenu.animate({scrollTop : params.scroll[params.depth]}, 200);
                                }, 100)

                                // height on enimating end
                                var h = (!params.depth ? false : $mobileMenu.find('.expanded&gt;.dropdown').eq(params.depth - 1).height())
                                setTimeout(function() {
                                    if(h){
                                        $scroller.css('height', h + 'px')
                                    }
                                    else{
                                        $scroller.css('height', '')
                                    }
                                }, 200)
                            }
                        }

                        $wrap.data('params', params)
                    }
                }
            }
        }
    /*  --- END Bind mobile menu  --- */

    /*  --- Bind mobile phone  --- */
        var $mobileHeader = $("#mobileheader");
        var $simpleHeader = $('body.simple_basket_mode #header');
        var $mobilePhone = $("#mobilePhone");
        $mobilePhone.isOpen = false;
        if($mobilePhone.length){
            $mobilePhone.isOpen = $mobilePhone.hasClass('show');

            $(document).on('click', '.wrap_phones .svg-inline-phone', function(e){
                SwipeMobilePhone();
                e.stopPropagation();
            });

            $(document).on('click', '.wrap_phones .svg-inline-close', function(e){
                CloseMobilePhone();
                e.stopPropagation();
            });
        }

        SwipeMobilePhone = function(){
            if($mobilePhone.isOpen){
                CloseMobilePhone();
            }
            else{
                OpenMobilePhone();
            }
        }

        OpenMobilePhone = function(){
            if(!$mobilePhone.isOpen){
                CloseMobileMenu();

                // show overlay
                var isSimple = Boolean($simpleHeader.length);
                var positionOffset = isSimple ? $simpleHeader[0].getBoundingClientRect() : $mobileHeader[0].getBoundingClientRect();
                var position = positionOffset.top + positionOffset.height + pageYOffset;
                console.log(positionOffset);
                console.log(position);
                $('&lt;div class="jqmOverlay mobp" style="top:'+(position)+'px;position:absolute"&gt;&lt;/div&gt;').appendTo('body');

                // toggle phones
                setTimeout(function(){
                    $mobilePhone.slideDown('fast', function(){
                        $mobilePhone.addClass('show');
                        $mobilePhone.isOpen = true;
                    });
                }, 100);
            }
        }

        CloseMobilePhone = function(){
            if($mobilePhone.isOpen){
                // toggle phones
                setTimeout(function(){
                    $mobilePhone.slideUp('fast', function(){
                        $mobilePhone.removeClass('show');
                        $mobilePhone.isOpen = false;

                        // hide overlay
                        $('.jqmOverlay.mobp').remove();
                    });
                }, 100);
            }
        }

        checkMobilePhone = function(){
            if((!window.matchMedia('(max-width: 991px)').matches)){
                CloseMobilePhone();
            }
        }
        $(document).on('click', "body.simple_basket_mode .back-mobile-arrow .arrow-back", function(){
            if(document.referrer &amp;&amp; document.referrer != location.href) {
                window.history.back();
            } else {
                location.href = '/';
            }
        })
    /*  --- END Bind mobile phone  --- */

    /*  --- Bind mobile filter  --- */
        var $mobilefilter = $("#mobilefilter");
        if($mobilefilter.length){
            $mobilefilter.isOpen = $mobileMenu.hasClass('show');
            $mobilefilter.isAppendLeft = false;
            $mobilefilter.isWrapFilter = false;
            $mobilefilter.isHorizontalOrCompact = $('.filter_horizontal').length || $('.bx_filter_vertical.compact').length;
            $mobilefilter.close = '&lt;i class="svg svg-close close-icons"&gt;&lt;/i&gt;';

            $(document).on('click', '.bx-filter-title', function(){
                OpenMobileFilter();
            });

            $(document).on('click', '#mobilefilter .svg-close.close-icons', function(){
                CloseMobileFilter();
            });

            $(document).on('click', '.bx_filter_select_block', function(e){
                var bx_filter_select_container = $(e.target).parents('.bx_filter_select_container');
                if(bx_filter_select_container.length) {
                    var prop_id = bx_filter_select_container.closest('.bx_filter_parameters_box').attr('data-property_id');
                    if($('#smartFilterDropDown'+prop_id).length){
                        $('#smartFilterDropDown'+prop_id).css({"max-width":bx_filter_select_container.width(), "z-index":"3020"});
                    }
                }
            });

            $(document).on('mouseup', '.bx_filter_section', function(e){
                if($(e.target).hasClass('bx_filter_search_button')) {
                    CloseMobileFilter();
                }
            });


            $(document).on('mouseup', '.bx_filter_parameters_box_title', function(e){
                $("[id^='smartFilterDropDown']").hide();
                if($(e.target).hasClass('close-icons')) {
                    CloseMobileFilter();
                }
            });

            /*$(document).on('DOMSubtreeModified', "#mobilefilter #modef_num_mobile", function() {
                mobileFilterNum($(this));
            });

            $(document).on('DOMSubtreeModified', "#mobilefilter .bx_filter_container_modef", function() {
                mobileFilterNum($(this));
            });*/

            $mobilefilter.parent().append('&lt;div id="mobilefilter-overlay"&gt;&lt;/div&gt;');
            var $mobilefilterOverlay = $('#mobilefilter-overlay');

            $mobilefilterOverlay.click(function(){
                if($mobilefilter.isOpen){
                    CloseMobileFilter();
                    //e.stopPropagation();
                }
            });

            mobileFilterNum = function(num, def){
                if(def){
                    $('.bx_filter_search_button').text(num.data("f"));;
                }
                else {
                    var str = "";
                    var $prosLeng = $('.bx_filter_parameters_box &gt; span');

                    str += $prosLeng.data("f") + " " + num + " " + declOfNumFilter(num, [$prosLeng.data("fi"), $prosLeng.data("fr"), $prosLeng.data("frm"),]);
                    $('.bx_filter_search_button').text(str);
                }
            }

            declOfNumFilter = function(number, titles){
                cases = [2, 0, 1, 1, 1, 2];
                return titles[ (number%100&gt;4 &amp;&amp; number%100&lt;20)? 2 : cases[(number%10&lt;5)?number%10:5] ];
            }

            OpenMobileFilter = function(){
                if(!$mobilefilter.isOpen)
                {
                    $('body').addClass('jqm-initied wf');

                    $('.bx_filter_vertical .slide-block__head.filter_title').removeClass('closed');
                   
                    $('.bx_filter_vertical .slide-block__head.filter_title + .slide-block__body').show();


                    if(!$mobilefilter.isAppendLeft)
                    {
                        if(!$mobilefilter.isWrapFilter)
                        {
                            $(".bx_filter").wrap("&lt;div id='wrapInlineFilter'&gt;&lt;/div&gt;");
                            $mobilefilter.isWrapFilter = true;
                        }
                        $(".bx_filter").appendTo($("#mobilefilter"));
                        var helper = $('#filter-helper');
                        if(helper.length) {
                            helper.prependTo($("#mobilefilter .bx_filter_parameters"));
                        }
                        $mobilefilter.isAppendLeft = true;

                    }
                    if (typeof checkFilterLandgings === 'function') {
                        checkFilterLandgings()
                    }

                    $("#mobilefilter .bx_filter_parameters").addClass('scrollbar');
                    $("#mobilefilter .slide-block .filter_title").addClass('ignore');
                    $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").addClass('colored_theme_hover_bg-block');

                    /*if (window.matchMedia('(max-width: 767px)').matches) {
                        $('#mobilefilter .bx_filter .scrollbar').addClass('mobile-scroll').removeClass('scroll-init');
                        if($('#mobilefilter .bx_filter .mobile-scroll.scrollbar').length)
                            $('#mobilefilter .bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
                        if($('#mobilefilter .bx_filter .mobile-scroll.srollbar-custom').length)
                            $('#mobilefilter .bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
                    }*/

                    $(".bx_filter_button_box.ajax-btns").addClass('colored_theme_bg');
                    $(".bx_filter_button_box.ajax-btns .filter-bnt-wrapper").removeClass('hidden');
                    InitCustomScrollBar();

                    // show overlay
                    setTimeout(function(){
                        $mobilefilterOverlay.fadeIn('fast');
                    }, 100);

                    // fix body
                    $('body').css({'overflow': 'hidden','height': '100vh'});

                    // show mobile filter
                    $mobilefilter.addClass('show');
                    $mobilefilter.find('.bx_filter').css({'display':'block'});
                    $mobilefilter.isOpen = true;

                    $('#mobilefilter .bx_filter_button_box.btns.ajax-btns').removeClass('hidden');

                    var init =  $mobilefilter.data('init');
                    if(typeof init === 'undefined'){
                        $mobilefilter.scroll(function() {
                            $(".bx_filter_section .bx_filter_select_container").each(function(){
                                var prop_id=$(this).closest('.bx_filter_parameters_box').attr('data-property_id');
                                if($('#smartFilterDropDown'+prop_id).length){
                                    $('#smartFilterDropDown'+prop_id).hide();
                                }
                            });
                        });

                        $mobilefilter.data('init', "Y");
                    };
                };
            }

            CloseMobileFilter = function(append){
                $mobilefilter.find('.bx_filter_parameters').removeClass('scrollbar');

                if($("#mobilefilter .bx_filter_parameters").length)
                    $('body').removeClass('jqm-initied wf');

                $("#mobilefilter .bx_filter_parameters .bx_filter_parameters_box_title").removeClass('colored_theme_hover_bg-block');
                $(".slide-block .filter_title").removeClass('ignore');
                $(".bx_filter_button_box.ajax-btns").removeClass('colored_theme_bg');

                $(".bx_filter:not(.n-ajax) .bx_filter_button_box.ajax-btns .filter-bnt-wrapper").addClass('hidden');

                if($mobilefilter.isOpen){
                    // scroll to top
                    $mobilefilter.find('.bx_filter_parameters').scrollTop(0);

                    // unfix body
                    $('body').css({'overflow': '','height': ''});

                    // hide overlay
                    setTimeout(function(){
                        $mobilefilterOverlay.fadeOut('fast');
                    }, 100);

                    // hide mobile filter
                    $mobilefilter.removeClass('show');
                    $mobilefilter.isOpen = false;
                }

                if(append &amp;&amp; $mobilefilter.isAppendLeft){
                    $(".bx_filter").appendTo($("#wrapInlineFilter")).show();
                    var helper = $('#filter-helper');
                    if(helper.length) {
                        helper.appendTo($('#filter-helper-wrapper'));
                    }
                    $mobilefilter.isAppendLeft = false;
                    $mobilefilter.removeData('init');
                    mobileFilterNum($("#modef_num_mobile"),true);
                }
            }

            checkMobileFilter = function(){
                if((!window.matchMedia('(max-width: 991px)').matches &amp;&amp; !$mobilefilter.isHorizontalOrCompact) || (!window.matchMedia('(max-width: 767px)').matches &amp;&amp; $mobilefilter.isHorizontalOrCompact)){
                    CloseMobileFilter(true);
                }
            }
        }
        else {
            checkTopFilter();
            $(document).on('click', '.bx-filter-title', function(){
                $(this).toggleClass("opened");
                if($('.visible_mobile_filter').length) {
                    $('.visible_mobile_filter').show();
                    $('.bx_filter_vertical, .bx_filter').slideToggle(333);
                }
                else{
                    $('.bx_filter_vertical').closest('div[id^=bx_incl]').show();
                    $('.bx_filter_vertical, .bx_filter').slideToggle(333);
                }
            });
        }
    /*  --- END Bind mobile filter  --- */
})
/* End */
;
; /* Start:"a:4:{s:4:"full";s:69:"/local/templates/aspro_max/js/jquery.mousewheel.min.js?17114177492609";s:6:"source";s:54:"/local/templates/aspro_max/js/jquery.mousewheel.min.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
!function(a){"function"==typeof define&amp;&amp;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&amp;&amp;(m=-1*g.detail),"wheelDelta"in g&amp;&amp;(m=g.wheelDelta),"wheelDeltaY"in g&amp;&amp;(m=g.wheelDeltaY),"wheelDeltaX"in g&amp;&amp;(l=-1*g.wheelDeltaX),"axis"in g&amp;&amp;g.axis===g.HORIZONTAL_AXIS&amp;&amp;(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&amp;&amp;(m=-1*g.deltaY,j=m),"deltaX"in g&amp;&amp;(l=g.deltaX,0===m&amp;&amp;(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&gt;n)&amp;&amp;(f=n,d(g,n)&amp;&amp;(f/=40)),d(g,n)&amp;&amp;(j/=40,l/=40,m/=40),j=Math[j&gt;=1?"floor":"ceil"](j/f),l=Math[l&gt;=1?"floor":"ceil"](l/f),m=Math[m&gt;=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&amp;&amp;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&amp;&amp;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&amp;&amp;"mousewheel"===a.type&amp;&amp;b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode&gt;=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)}})});
/* End */
;
; /* Start:"a:4:{s:4:"full";s:76:"/local/templates/aspro_max/js/jquery.mCustomScrollbar.min.js?171141774642965";s:6:"source";s:56:"/local/templates/aspro_max/js/jquery.mCustomScrollbar.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
!function(e){"function"==typeof define&amp;&amp;define.amd?define(["jquery"],e):"undefined"!=typeof module&amp;&amp;module.exports?module.exports=e:e(jQuery,window,document)}(function(P){var z,f,H,a,n,l,i,p,F,S,U,e,t,o;e="function"==typeof define&amp;&amp;define.amd,t="undefined"!=typeof module&amp;&amp;module.exports,o="https:"==document.location.protocol?"https:":"http:",e||(t?require("jquery-mousewheel")(P):P.event.special.mousewheel||P("head").append(decodeURI("%3Cscript src="+o+"//cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.13/jquery.mousewheel.min.js%3E%3C/script%3E"))),f="mCustomScrollbar",H="mCS",a=".mCustomScrollbar",n={setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:100,autoDraggerLength:!0,alwaysShowScrollbar:0,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",deltaFactor:"auto",disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,documentTouchScroll:!0,advanced:{autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:"auto",autoUpdateTimeout:60},theme:"light",callbacks:{onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0}},l=0,i={},p=window.attachEvent&amp;&amp;!window.addEventListener?1:0,F=!1,U=!(S=["mCSB_dragger_onDrag","mCSB_scrollTools_onDrag","mCS_img_loaded","mCS_disabled","mCS_destroyed","mCS_no_scrollbar","mCS-autoHide","mCS-dir-rtl","mCS_no_scrollbar_y","mCS_no_scrollbar_x","mCS_y_hidden","mCS_x_hidden","mCSB_draggerContainer","mCSB_buttonUp","mCSB_buttonDown","mCSB_buttonLeft colored_theme_hover_text","mCSB_buttonRight colored_theme_hover_text"]),methods={init:function(r){var r=P.extend(!0,{},n,r),e=_selector.call(this);if(r.live){var t=r.liveSelector||this.selector||a,o=P(t);if("off"===r.live)return void removeLiveTimers(t);i[t]=setTimeout(function(){o.mCustomScrollbar(r),"once"===r.live&amp;&amp;o.length&amp;&amp;removeLiveTimers(t)},500)}else removeLiveTimers(t);return r.setWidth=r.set_width?r.set_width:r.setWidth,r.setHeight=r.set_height?r.set_height:r.setHeight,r.axis=r.horizontalScroll?"x":_findAxis(r.axis),r.scrollInertia=0&lt;r.scrollInertia&amp;&amp;r.scrollInertia&lt;17?17:r.scrollInertia,"object"!=typeof r.mouseWheel&amp;&amp;1==r.mouseWheel&amp;&amp;(r.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),r.mouseWheel.scrollAmount=r.mouseWheelPixels?r.mouseWheelPixels:r.mouseWheel.scrollAmount,r.mouseWheel.normalizeDelta=r.advanced.normalizeMouseWheelDelta?r.advanced.normalizeMouseWheelDelta:r.mouseWheel.normalizeDelta,r.scrollButtons.scrollType=_findScrollButtonsType(r.scrollButtons.scrollType),_theme(r),P(e).each(function(){var e=P(this);if(!e.data(H)){e.data(H,{idx:++l,opt:r,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:e.css("direction"),cbOffsets:null,trigger:null,poll:{size:{o:0,n:0},img:{o:0,n:0},change:{o:0,n:0}}});var t=e.data(H),o=t.opt,a=e.data("mcs-axis"),n=e.data("mcs-scrollbar-position"),i=e.data("mcs-theme");a&amp;&amp;(o.axis=a),n&amp;&amp;(o.scrollbarPosition=n),i&amp;&amp;(o.theme=i,_theme(o)),_pluginMarkup.call(this),t&amp;&amp;o.callbacks.onCreate&amp;&amp;"function"==typeof o.callbacks.onCreate&amp;&amp;o.callbacks.onCreate.call(this),P("#mCSB_"+t.idx+"_container img:not(."+S[2]+")").addClass(S[2]),methods.update.call(null,e)}})},update:function(e,l){var t=e||_selector.call(this);return P(t).each(function(){var e=P(this);if(e.data(H)){var t=e.data(H),o=t.opt,a=P("#mCSB_"+t.idx+"_container"),n=P("#mCSB_"+t.idx),i=[P("#mCSB_"+t.idx+"_dragger_vertical"),P("#mCSB_"+t.idx+"_dragger_horizontal")];if(!a.length)return;t.tweenRunning&amp;&amp;_stop(e),l&amp;&amp;t&amp;&amp;o.callbacks.onBeforeUpdate&amp;&amp;"function"==typeof o.callbacks.onBeforeUpdate&amp;&amp;o.callbacks.onBeforeUpdate.call(this),e.hasClass(S[3])&amp;&amp;e.removeClass(S[3]),e.hasClass(S[4])&amp;&amp;e.removeClass(S[4]),n.css("max-height","none"),n.height()!==e.height()&amp;&amp;n.css("max-height",e.height()),_expandContentHorizontally.call(this),"y"===o.axis||o.advanced.autoExpandHorizontalScroll||a.css("width",_contentWidth(a)),t.overflowed=_overflowed.call(this),_scrollbarVisibility.call(this),o.autoDraggerLength&amp;&amp;_setDraggerLength.call(this),_scrollRatio.call(this),_bindEvents.call(this);var r=[Math.abs(a[0].offsetTop),Math.abs(a[0].offsetLeft)];"x"!==o.axis&amp;&amp;(t.overflowed[0]?i[0].height()&gt;i[0].parent().height()?_resetContentPosition.call(this):(_scrollTo(e,r[0].toString(),{dir:"y",dur:0,overwrite:"none"}),t.contentReset.y=null):(_resetContentPosition.call(this),"y"===o.axis?_unbindEvents.call(this):"yx"===o.axis&amp;&amp;t.overflowed[1]&amp;&amp;_scrollTo(e,r[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==o.axis&amp;&amp;(t.overflowed[1]?i[1].width()&gt;i[1].parent().width()?_resetContentPosition.call(this):(_scrollTo(e,r[1].toString(),{dir:"x",dur:0,overwrite:"none"}),t.contentReset.x=null):(_resetContentPosition.call(this),"x"===o.axis?_unbindEvents.call(this):"yx"===o.axis&amp;&amp;t.overflowed[0]&amp;&amp;_scrollTo(e,r[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),l&amp;&amp;t&amp;&amp;(2===l&amp;&amp;o.callbacks.onImageLoad&amp;&amp;"function"==typeof o.callbacks.onImageLoad?o.callbacks.onImageLoad.call(this):3===l&amp;&amp;o.callbacks.onSelectorChange&amp;&amp;"function"==typeof o.callbacks.onSelectorChange?o.callbacks.onSelectorChange.call(this):o.callbacks.onUpdate&amp;&amp;"function"==typeof o.callbacks.onUpdate&amp;&amp;o.callbacks.onUpdate.call(this)),_autoUpdate.call(this)}})},scrollTo:function(l,s){if(void 0!==l&amp;&amp;null!=l){var e=_selector.call(this);return P(e).each(function(){var e=P(this);if(e.data(H)){var t=e.data(H),o=t.opt,a={trigger:"external",scrollInertia:o.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=P.extend(!0,{},a,s),i=_arr.call(this,l),r=0&lt;n.scrollInertia&amp;&amp;n.scrollInertia&lt;17?17:n.scrollInertia;i[0]=_to.call(this,i[0],"y"),i[1]=_to.call(this,i[1],"x"),n.moveDragger&amp;&amp;(i[0]*=t.scrollRatio.y,i[1]*=t.scrollRatio.x),n.dur=_isTabHidden()?0:r,setTimeout(function(){null!==i[0]&amp;&amp;void 0!==i[0]&amp;&amp;"x"!==o.axis&amp;&amp;t.overflowed[0]&amp;&amp;(n.dir="y",n.overwrite="all",_scrollTo(e,i[0].toString(),n)),null!==i[1]&amp;&amp;void 0!==i[1]&amp;&amp;"y"!==o.axis&amp;&amp;t.overflowed[1]&amp;&amp;(n.dir="x",n.overwrite="none",_scrollTo(e,i[1].toString(),n))},n.timeout)}})}},stop:function(){var e=_selector.call(this);return P(e).each(function(){var e=P(this);e.data(H)&amp;&amp;_stop(e)})},disable:function(t){var e=_selector.call(this);return P(e).each(function(){var e=P(this);e.data(H)&amp;&amp;(e.data(H),_autoUpdate.call(this,"remove"),_unbindEvents.call(this),t&amp;&amp;_resetContentPosition.call(this),_scrollbarVisibility.call(this,!0),e.addClass(S[3]))})},destroy:function(){var r=_selector.call(this);return P(r).each(function(){var e=P(this);if(e.data(H)){var t=e.data(H),o=t.opt,a=P("#mCSB_"+t.idx),n=P("#mCSB_"+t.idx+"_container"),i=P(".mCSB_"+t.idx+"_scrollbar");o.live&amp;&amp;removeLiveTimers(o.liveSelector||P(r).selector),_autoUpdate.call(this,"remove"),_unbindEvents.call(this),_resetContentPosition.call(this),e.removeData(H),_delete(this,"mcs"),i.remove(),n.find("img."+S[2]).removeClass(S[2]),a.replaceWith(n.contents()),e.removeClass(f+" _"+H+"_"+t.idx+" "+S[6]+" "+S[7]+" "+S[5]+" "+S[3]).addClass(S[4])}})}},_selector=function(){return"object"!=typeof P(this)||P(this).length&lt;1?a:this},_theme=function(e){e.autoDraggerLength=!(-1&lt;P.inArray(e.theme,["rounded","rounded-dark","rounded-dots","rounded-dots-dark"]))&amp;&amp;e.autoDraggerLength,e.autoExpandScrollbar=!(-1&lt;P.inArray(e.theme,["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"]))&amp;&amp;e.autoExpandScrollbar,e.scrollButtons.enable=!(-1&lt;P.inArray(e.theme,["minimal","minimal-dark"]))&amp;&amp;e.scrollButtons.enable,e.autoHideScrollbar=-1&lt;P.inArray(e.theme,["minimal","minimal-dark"])||e.autoHideScrollbar,e.scrollbarPosition=-1&lt;P.inArray(e.theme,["minimal","minimal-dark"])?"outside":e.scrollbarPosition},removeLiveTimers=function(e){i[e]&amp;&amp;(clearTimeout(i[e]),_delete(i,e))},_findAxis=function(e){return"yx"===e||"xy"===e||"auto"===e?"yx":"x"===e||"horizontal"===e?"x":"y"},_findScrollButtonsType=function(e){return"stepped"===e||"pixels"===e||"step"===e||"click"===e?"stepped":"stepless"},_pluginMarkup=function(){var e=P(this),t=e.data(H),o=t.opt,a=o.autoExpandScrollbar?" "+S[1]+"_expand":"",n=["&lt;div id='mCSB_"+t.idx+"_scrollbar_vertical' class='mCSB_scrollTools mCSB_"+t.idx+"_scrollbar mCS-"+o.theme+" mCSB_scrollTools_vertical"+a+"'&gt;&lt;div class='"+S[12]+"'&gt;&lt;div id='mCSB_"+t.idx+"_dragger_vertical' class='mCSB_dragger' style='position:absolute;'&gt;&lt;div class='mCSB_dragger_bar' /&gt;&lt;/div&gt;&lt;div class='mCSB_draggerRail' /&gt;&lt;/div&gt;&lt;/div&gt;","&lt;div id='mCSB_"+t.idx+"_scrollbar_horizontal' class='mCSB_scrollTools mCSB_"+t.idx+"_scrollbar mCS-"+o.theme+" mCSB_scrollTools_horizontal"+a+"'&gt;&lt;div class='"+S[12]+"'&gt;&lt;div id='mCSB_"+t.idx+"_dragger_horizontal' class='mCSB_dragger' style='position:absolute;'&gt;&lt;div class='mCSB_dragger_bar' /&gt;&lt;/div&gt;&lt;div class='mCSB_draggerRail' /&gt;&lt;/div&gt;&lt;/div&gt;"],i="yx"===o.axis?"mCSB_vertical_horizontal":"x"===o.axis?"mCSB_horizontal":"mCSB_vertical",r="yx"===o.axis?n[0]+n[1]:"x"===o.axis?n[1]:n[0],l="yx"===o.axis?"&lt;div id='mCSB_"+t.idx+"_container_wrapper' class='mCSB_container_wrapper' /&gt;":"",s=o.autoHideScrollbar?" "+S[6]:"",c="x"!==o.axis&amp;&amp;"rtl"===t.langDir?" "+S[7]:"";o.setWidth&amp;&amp;e.css("width",o.setWidth),o.setHeight&amp;&amp;e.css("height",o.setHeight),o.setLeft="y"!==o.axis&amp;&amp;"rtl"===t.langDir?"989999px":o.setLeft,e.addClass(f+" _"+H+"_"+t.idx+s+c).wrapInner("&lt;div id='mCSB_"+t.idx+"' class='mCustomScrollBox mCS-"+o.theme+" "+i+"'&gt;&lt;div id='mCSB_"+t.idx+"_container' class='mCSB_container' style='position:relative; top:"+o.setTop+"; left:"+o.setLeft+";' dir='"+t.langDir+"' /&gt;&lt;/div&gt;");var d=P("#mCSB_"+t.idx),u=P("#mCSB_"+t.idx+"_container");"y"===o.axis||o.advanced.autoExpandHorizontalScroll||u.css("width",_contentWidth(u)),"outside"===o.scrollbarPosition?("static"===e.css("position")&amp;&amp;e.css("position","relative"),e.css("overflow","visible"),d.addClass("mCSB_outside").after(r)):(d.addClass("mCSB_inside").append(r),u.wrap(l)),_scrollButtons.call(this);var h=[P("#mCSB_"+t.idx+"_dragger_vertical"),P("#mCSB_"+t.idx+"_dragger_horizontal")];h[0].css("min-height",h[0].height()),h[1].css("min-width",h[1].width())},_contentWidth=function(e){var t=[e[0].scrollWidth,Math.max.apply(Math,e.children().map(function(){return P(this).outerWidth(!0)}).get())],o=e.parent().width();return o&lt;t[0]?t[0]:o&lt;t[1]?t[1]:"100%"},_expandContentHorizontally=function(){var e=P(this),t=e.data(H),o=t.opt,a=P("#mCSB_"+t.idx+"_container");if(o.advanced.autoExpandHorizontalScroll&amp;&amp;"y"!==o.axis){a.css({width:"auto","min-width":0,"overflow-x":"scroll"});var n=Math.ceil(a[0].scrollWidth);3===o.advanced.autoExpandHorizontalScroll||2!==o.advanced.autoExpandHorizontalScroll&amp;&amp;n&gt;a.parent().width()?a.css({width:n,"min-width":"100%","overflow-x":"inherit"}):a.css({"overflow-x":"inherit",position:"absolute"}).wrap("&lt;div class='mCSB_h_wrapper' style='position:relative; left:0; width:999999px;' /&gt;").css({width:Math.ceil(a[0].getBoundingClientRect().right+.4)-Math.floor(a[0].getBoundingClientRect().left),"min-width":"100%",position:"relative"}).unwrap()}},_scrollButtons=function(){var e=P(this),t=e.data(H),o=t.opt,a=P(".mCSB_"+t.idx+"_scrollbar:first"),n=_isNumeric(o.scrollButtons.tabindex)?"tabindex='"+o.scrollButtons.tabindex+"'":"",i=["&lt;a href='#' class='"+S[13]+"' "+n+" /&gt;","&lt;a href='#' class='"+S[14]+"' "+n+" /&gt;","&lt;a href='#' class='"+S[15]+"' "+n+" &gt;&lt;i class='svg right'&gt;&lt;svg width='12' height='6.969' viewBox='0 0 12 6.969'&gt;&lt;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)'&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/i&gt;&lt;/a&gt;","&lt;a href='#' class='"+S[16]+"' "+n+" &gt;&lt;i class='svg right'&gt;&lt;svg width='12' height='6.969' viewBox='0 0 12 6.969'&gt;&lt;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)'&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/i&gt;&lt;/a&gt;"],r=["x"===o.axis?i[2]:i[0],"x"===o.axis?i[3]:i[1],i[2],i[3]];o.scrollButtons.enable&amp;&amp;a.prepend(r[0]).append(r[1]).next(".mCSB_scrollTools").prepend(r[2]).append(r[3])},_setDraggerLength=function(){var e=P(this),t=e.data(H),o=P("#mCSB_"+t.idx),a=P("#mCSB_"+t.idx+"_container"),n=[P("#mCSB_"+t.idx+"_dragger_vertical"),P("#mCSB_"+t.idx+"_dragger_horizontal")],i=[o.height()/a.outerHeight(!1),o.width()/a.outerWidth(!1)],r=[parseInt(n[0].css("min-height")),Math.round(i[0]*n[0].parent().height()),parseInt(n[1].css("min-width")),Math.round(i[1]*n[1].parent().width())],l=p&amp;&amp;r[1]&lt;r[0]?r[0]:r[1],s=p&amp;&amp;r[3]&lt;r[2]?r[2]:r[3];n[0].css({height:l,"max-height":n[0].parent().height()-10}).find(".mCSB_dragger_bar").css({"line-height":r[0]+"px"}),n[1].css({width:s,"max-width":n[1].parent().width()-10})},_scrollRatio=function(){var e=P(this),t=e.data(H),o=P("#mCSB_"+t.idx),a=P("#mCSB_"+t.idx+"_container"),n=[P("#mCSB_"+t.idx+"_dragger_vertical"),P("#mCSB_"+t.idx+"_dragger_horizontal")],i=[a.outerHeight(!1)-o.height(),a.outerWidth(!1)-o.width()],r=[i[0]/(n[0].parent().height()-n[0].height()),i[1]/(n[1].parent().width()-n[1].width())];t.scrollRatio={y:r[0],x:r[1]}},_onDragClasses=function(e,t,o){var a=o?S[0]+"_expanded":"",n=e.closest(".mCSB_scrollTools");"active"===t?(e.toggleClass(S[0]+" "+a),n.toggleClass(S[1]),e[0]._draggable=e[0]._draggable?0:1):e[0]._draggable||("hide"===t?(e.removeClass(S[0]),n.removeClass(S[1])):(e.addClass(S[0]),n.addClass(S[1])))},_overflowed=function(){var e=P(this),t=e.data(H),o=P("#mCSB_"+t.idx),a=P("#mCSB_"+t.idx+"_container"),n=null==t.overflowed?a.height():a.outerHeight(!1),i=null==t.overflowed?a.width():a.outerWidth(!1),r=a[0].scrollHeight,l=a[0].scrollWidth;return n&lt;r&amp;&amp;(n=r),i&lt;l&amp;&amp;(i=l),[n&gt;o.height(),i&gt;o.width()]},_resetContentPosition=function(){var e=P(this),t=e.data(H),o=t.opt,a=P("#mCSB_"+t.idx),n=P("#mCSB_"+t.idx+"_container"),i=[P("#mCSB_"+t.idx+"_dragger_vertical"),P("#mCSB_"+t.idx+"_dragger_horizontal")];if(_stop(e),("x"!==o.axis&amp;&amp;!t.overflowed[0]||"y"===o.axis&amp;&amp;t.overflowed[0])&amp;&amp;(i[0].add(n).css("top",0),_scrollTo(e,"_resetY")),"y"!==o.axis&amp;&amp;!t.overflowed[1]||"x"===o.axis&amp;&amp;t.overflowed[1]){var r=dx=0;"rtl"===t.langDir&amp;&amp;(r=a.width()-n.outerWidth(!1),dx=Math.abs(r/t.scrollRatio.x)),n.css("left",r),i[1].css("left",dx),_scrollTo(e,"_resetX")}},_bindEvents=function(){var t=P(this),e=t.data(H),o=e.opt;if(!e.bindEvents){var a;if(_draggable.call(this),o.contentTouchScroll&amp;&amp;_contentDraggable.call(this),_selectable.call(this),o.mouseWheel.enable)!function e(){a=setTimeout(function(){P.event.special.mousewheel?(clearTimeout(a),_mousewheel.call(t[0])):e()},100)}();_draggerRail.call(this),_wrapperScroll.call(this),o.advanced.autoScrollOnFocus&amp;&amp;_focus.call(this),o.scrollButtons.enable&amp;&amp;_buttons.call(this),o.keyboard.enable&amp;&amp;_keyboard.call(this),e.bindEvents=!0}},_unbindEvents=function(){var e=P(this),t=e.data(H),o=t.opt,a=H+"_"+t.idx,n=".mCSB_"+t.idx+"_scrollbar",i=P("#mCSB_"+t.idx+",#mCSB_"+t.idx+"_container,#mCSB_"+t.idx+"_container_wrapper,"+n+" ."+S[12]+",#mCSB_"+t.idx+"_dragger_vertical,#mCSB_"+t.idx+"_dragger_horizontal,"+n+"&gt;a"),r=P("#mCSB_"+t.idx+"_container");o.advanced.releaseDraggableSelectors&amp;&amp;i.add(P(o.advanced.releaseDraggableSelectors)),o.advanced.extraDraggableSelectors&amp;&amp;i.add(P(o.advanced.extraDraggableSelectors)),t.bindEvents&amp;&amp;(P(document).add(P(!_canAccessIFrame()||top.document)).unbind("."+a),i.each(function(){P(this).unbind("."+a)}),clearTimeout(e[0]._focusTimeout),_delete(e[0],"_focusTimeout"),clearTimeout(t.sequential.step),_delete(t.sequential,"step"),clearTimeout(r[0].onCompleteTimeout),_delete(r[0],"onCompleteTimeout"),t.bindEvents=!1)},_scrollbarVisibility=function(e){var t=P(this),o=t.data(H),a=o.opt,n=P("#mCSB_"+o.idx+"_container_wrapper"),i=n.length?n:P("#mCSB_"+o.idx+"_container"),r=[P("#mCSB_"+o.idx+"_scrollbar_vertical"),P("#mCSB_"+o.idx+"_scrollbar_horizontal")],l=[r[0].find(".mCSB_dragger"),r[1].find(".mCSB_dragger")];"x"!==a.axis&amp;&amp;(o.overflowed[0]&amp;&amp;!e?(r[0].add(l[0]).add(r[0].children("a")).css("display","block"),i.removeClass(S[8]+" "+S[10])):(a.alwaysShowScrollbar?(2!==a.alwaysShowScrollbar&amp;&amp;l[0].css("display","none"),i.removeClass(S[10])):(r[0].css("display","none"),i.addClass(S[10])),i.addClass(S[8]))),"y"!==a.axis&amp;&amp;(o.overflowed[1]&amp;&amp;!e?(r[1].add(l[1]).add(r[1].children("a")).css("display","block"),i.removeClass(S[9]+" "+S[11])):(a.alwaysShowScrollbar?(2!==a.alwaysShowScrollbar&amp;&amp;l[1].css("display","none"),i.removeClass(S[11])):(r[1].css("display","none"),i.addClass(S[11])),i.addClass(S[9]))),o.overflowed[0]||o.overflowed[1]?t.removeClass(S[5]):t.addClass(S[5])},_coordinates=function(e){var t=e.type,o=e.target.ownerDocument!==document&amp;&amp;null!==frameElement?[P(frameElement).offset().top,P(frameElement).offset().left]:null,a=_canAccessIFrame()&amp;&amp;e.target.ownerDocument!==top.document&amp;&amp;null!==frameElement?[P(e.view.frameElement).offset().top,P(e.view.frameElement).offset().left]:[0,0];switch(t){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return o?[e.originalEvent.pageY-o[0]+a[0],e.originalEvent.pageX-o[1]+a[1],!1]:[e.originalEvent.pageY,e.originalEvent.pageX,!1];case"touchstart":case"touchmove":case"touchend":var n=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],i=e.originalEvent.touches.length||e.originalEvent.changedTouches.length;return e.target.ownerDocument!==document?[n.screenY,n.screenX,1&lt;i]:[n.pageY,n.pageX,1&lt;i];default:return o?[e.pageY-o[0]+a[0],e.pageX-o[1]+a[1],!1]:[e.pageY,e.pageX,!1]}},_draggable=function(){var r,l,s,c=P(this),d=c.data(H),u=d.opt,e=H+"_"+d.idx,h=["mCSB_"+d.idx+"_dragger_vertical","mCSB_"+d.idx+"_dragger_horizontal"],f=P("#mCSB_"+d.idx+"_container"),t=P("#"+h[0]+",#"+h[1]),o=u.advanced.releaseDraggableSelectors?t.add(P(u.advanced.releaseDraggableSelectors)):t,a=u.advanced.extraDraggableSelectors?P(!_canAccessIFrame()||top.document).add(P(u.advanced.extraDraggableSelectors)):P(!_canAccessIFrame()||top.document);function n(e,t,o,a){if(f[0].idleTimer=u.scrollInertia&lt;233?250:0,r.attr("id")===h[1])var n="x",i=(r[0].offsetLeft-t+a)*d.scrollRatio.x;else var n="y",i=(r[0].offsetTop-e+o)*d.scrollRatio.y;_scrollTo(c,i.toString(),{dir:n,drag:!0})}t.bind("contextmenu."+e,function(e){e.preventDefault()}).bind("mousedown."+e+" touchstart."+e+" pointerdown."+e+" MSPointerDown."+e,function(e){if(e.stopImmediatePropagation(),e.preventDefault(),_mouseBtnLeft(e)){F=!0,p&amp;&amp;(document.onselectstart=function(){return!1}),_iframe.call(f,!1),_stop(c);var t=(r=P(this)).offset(),o=_coordinates(e)[0]-t.top,a=_coordinates(e)[1]-t.left,n=r.height()+t.top,i=r.width()+t.left;o&lt;n&amp;&amp;0&lt;o&amp;&amp;a&lt;i&amp;&amp;0&lt;a&amp;&amp;(l=o,s=a),_onDragClasses(r,"active",u.autoExpandScrollbar)}}).bind("touchmove."+e,function(e){e.stopImmediatePropagation(),e.preventDefault();var t=r.offset(),o=_coordinates(e)[0]-t.top,a=_coordinates(e)[1]-t.left;n(l,s,o,a)}),P(document).add(a).bind("mousemove."+e+" pointermove."+e+" MSPointerMove."+e,function(e){if(r){var t=r.offset(),o=_coordinates(e)[0]-t.top,a=_coordinates(e)[1]-t.left;if(l===o&amp;&amp;s===a)return;n(l,s,o,a)}}).add(o).bind("mouseup."+e+" touchend."+e+" pointerup."+e+" MSPointerUp."+e,function(e){r&amp;&amp;(_onDragClasses(r,"active",u.autoExpandScrollbar),r=null),F=!1,p&amp;&amp;(document.onselectstart=null),_iframe.call(f,!0)})},_contentDraggable=function(){var d,c,u,h,f,m,_,p,g,v,x,w,S,b,C=P(this),y=C.data(H),T=y.opt,e=H+"_"+y.idx,B=P("#mCSB_"+y.idx),k=P("#mCSB_"+y.idx+"_container"),M=[P("#mCSB_"+y.idx+"_dragger_vertical"),P("#mCSB_"+y.idx+"_dragger_horizontal")],I=[],D=[],O=0,E="yx"===T.axis?"none":"all",A=[],t=k.find("iframe"),o=["touchstart."+e+" pointerdown."+e+" MSPointerDown."+e,"touchmove."+e+" pointermove."+e+" MSPointerMove."+e,"touchend."+e+" pointerup."+e+" MSPointerUp."+e],L=void 0!==document.body.style.touchAction&amp;&amp;""!==document.body.style.touchAction;function a(e){if(!_pointerTouch(e)||F||_coordinates(e)[2])z=0;else{if(P(e.target).closest(".bx_ui_slider_track").length)return U=!0,void(z=0);U=!1,b=S=0,d=z=1,C.removeClass("mCS_touch_action");var t=k.offset();c=_coordinates(e)[0]-t.top,u=_coordinates(e)[1]-t.left,A=[_coordinates(e)[0],_coordinates(e)[1]]}}function n(e){if(_pointerTouch(e)&amp;&amp;!F&amp;&amp;!_coordinates(e)[2])if(U)z=0;else if(T.documentTouchScroll||e.preventDefault(),e.stopImmediatePropagation(),(!b||S)&amp;&amp;d){_=_getTime();var t=B.offset(),o=_coordinates(e)[0]-t.top,a=_coordinates(e)[1]-t.left,n="mcsLinearOut";if(I.push(o),D.push(a),A[2]=Math.abs(_coordinates(e)[0]-A[0]),A[3]=Math.abs(_coordinates(e)[1]-A[1]),y.overflowed[0])var i=M[0].parent().height()-M[0].height(),r=0&lt;c-o&amp;&amp;o-c&gt;-i*y.scrollRatio.y&amp;&amp;(2*A[3]&lt;A[2]||"yx"===T.axis);if(y.overflowed[1])var l=M[1].parent().width()-M[1].width(),s=0&lt;u-a&amp;&amp;a-u&gt;-l*y.scrollRatio.x&amp;&amp;(2*A[2]&lt;A[3]||"yx"===T.axis);r||s?(L||e.preventDefault(),S=1):(b=1,C.addClass("mCS_touch_action")),L&amp;&amp;e.preventDefault(),x="yx"===T.axis?[c-o,u-a]:"x"===T.axis?[null,u-a]:[c-o,null],k[0].idleTimer=250,y.overflowed[0]&amp;&amp;W(x[0],O,n,"y","all",!0),y.overflowed[1]&amp;&amp;W(x[1],O,n,"x",E,!0)}}function i(e){if(!_pointerTouch(e)||F||_coordinates(e)[2])z=0;else{if(P(e.target).closest(".bx_ui_slider_track").length)return U=!0,void(z=0);U=!1,z=1,e.stopImmediatePropagation(),_stop(C),m=_getTime();var t=B.offset();h=_coordinates(e)[0]-t.top,f=_coordinates(e)[1]-t.left,I=[],D=[]}}function r(e){if(_pointerTouch(e)&amp;&amp;!F&amp;&amp;!_coordinates(e)[2]){if(P(e.target).closest(".bx_ui_slider_track").length)return U=!1,void(z=0);d=0,e.stopImmediatePropagation(),b=S=0,p=_getTime();var t=B.offset(),o=_coordinates(e)[0]-t.top,a=_coordinates(e)[1]-t.left;if(!(30&lt;p-_)){var n="mcsEaseOut",i=(v=1e3/(p-m))&lt;2.5,r=i?[I[I.length-2],D[D.length-2]]:[0,0];g=i?[o-r[0],a-r[1]]:[o-h,a-f];var l=[Math.abs(g[0]),Math.abs(g[1])];v=i?[Math.abs(g[0]/4),Math.abs(g[1]/4)]:[v,v];var s=[Math.abs(k[0].offsetTop)-g[0]*R(l[0]/v[0],v[0]),Math.abs(k[0].offsetLeft)-g[1]*R(l[1]/v[1],v[1])];x="yx"===T.axis?[s[0],s[1]]:"x"===T.axis?[null,s[1]]:[s[0],null],w=[4*l[0]+T.scrollInertia,4*l[1]+T.scrollInertia];var c=parseInt(T.contentTouchScroll)||0;x[0]=c&lt;l[0]?x[0]:0,x[1]=c&lt;l[1]?x[1]:0,y.overflowed[0]&amp;&amp;W(x[0],w[0],n,"y",E,!1),y.overflowed[1]&amp;&amp;W(x[1],w[1],n,"x",E,!1)}}}function R(e,t){var o=[1.5*t,2*t,t/1.5,t/2];return 90&lt;e?4&lt;t?o[0]:o[3]:60&lt;e?3&lt;t?o[3]:o[2]:30&lt;e?8&lt;t?o[1]:6&lt;t?o[0]:4&lt;t?t:o[2]:8&lt;t?t:o[3]}function W(e,t,o,a,n,i){e&amp;&amp;_scrollTo(C,e.toString(),{dur:t,scrollEasing:o,dir:a,overwrite:n,drag:i})}k.bind(o[0],function(e){a(e)}).bind(o[1],function(e){n(e)}),B.bind(o[0],function(e){i(e)}).bind(o[2],function(e){r(e)}),t.length&amp;&amp;t.each(function(){P(this).bind("load",function(){_canAccessIFrame(this)&amp;&amp;P(this.contentDocument||this.contentWindow.document).bind(o[0],function(e){a(e),i(e)}).bind(o[1],function(e){n(e)}).bind(o[2],function(e){r(e)})})})},_selectable=function(){var n,a=P(this),i=a.data(H),r=i.opt,l=i.sequential,e=H+"_"+i.idx,s=P("#mCSB_"+i.idx+"_container"),c=s.parent();function d(e,t,o){l.type=o&amp;&amp;n?"stepped":"stepless",l.scrollAmount=10,_sequentialScroll(a,e,t,"mcsLinearOut",o?60:null)}s.bind("mousedown."+e,function(e){z||n||(n=1,F=!0)}).add(document).bind("mousemove."+e,function(e){if(!z&amp;&amp;n&amp;&amp;(window.getSelection?window.getSelection().toString():document.selection&amp;&amp;"Control"!=document.selection.type&amp;&amp;document.selection.createRange().text)){var t=s.offset(),o=_coordinates(e)[0]-t.top+s[0].offsetTop,a=_coordinates(e)[1]-t.left+s[0].offsetLeft;0&lt;o&amp;&amp;o&lt;c.height()&amp;&amp;0&lt;a&amp;&amp;a&lt;c.width()?l.step&amp;&amp;d("off",null,"stepped"):("x"!==r.axis&amp;&amp;i.overflowed[0]&amp;&amp;(o&lt;0?d("on",38):o&gt;c.height()&amp;&amp;d("on",40)),"y"!==r.axis&amp;&amp;i.overflowed[1]&amp;&amp;(a&lt;0?d("on",37):a&gt;c.width()&amp;&amp;d("on",39)))}}).bind("mouseup."+e+" dragend."+e,function(e){z||(n&amp;&amp;(n=0,d("off",null)),F=!1)})},_mousewheel=function(){if(P(this).data(H)){var u=P(this),h=u.data(H),f=h.opt,e=H+"_"+h.idx,m=P("#mCSB_"+h.idx),_=[P("#mCSB_"+h.idx+"_dragger_vertical"),P("#mCSB_"+h.idx+"_dragger_horizontal")],t=P("#mCSB_"+h.idx+"_container").find("iframe");t.length&amp;&amp;t.each(function(){P(this).bind("load",function(){_canAccessIFrame(this)&amp;&amp;P(this.contentDocument||this.contentWindow.document).bind("mousewheel."+e,function(e,t){o(e,t)})})}),m.bind("mousewheel."+e,function(e,t){o(e,t)})}function o(e,t){if(_stop(u),!_disableMousewheel(u,e.target)){var o="auto"!==f.mouseWheel.deltaFactor?parseInt(f.mouseWheel.deltaFactor):p&amp;&amp;e.deltaFactor&lt;100?100:e.deltaFactor||100,a=f.scrollInertia;if("x"===f.axis||"x"===f.mouseWheel.axis)var n="x",i=[Math.round(o*h.scrollRatio.x),parseInt(f.mouseWheel.scrollAmount)],r="auto"!==f.mouseWheel.scrollAmount?i[1]:i[0]&gt;=m.width()?.9*m.width():i[0],l=Math.abs(P("#mCSB_"+h.idx+"_container")[0].offsetLeft),s=_[1][0].offsetLeft,c=_[1].parent().width()-_[1].width(),d="y"===f.mouseWheel.axis?e.deltaY||t:e.deltaX;else var n="y",i=[Math.round(o*h.scrollRatio.y),parseInt(f.mouseWheel.scrollAmount)],r="auto"!==f.mouseWheel.scrollAmount?i[1]:i[0]&gt;=m.height()?.9*m.height():i[0],l=Math.abs(P("#mCSB_"+h.idx+"_container")[0].offsetTop),s=_[0][0].offsetTop,c=_[0].parent().height()-_[0].height(),d=e.deltaY||t;"y"===n&amp;&amp;!h.overflowed[0]||"x"===n&amp;&amp;!h.overflowed[1]||((f.mouseWheel.invert||e.webkitDirectionInvertedFromDevice)&amp;&amp;(d=-d),f.mouseWheel.normalizeDelta&amp;&amp;(d=d&lt;0?-1:1),(0&lt;d&amp;&amp;0!==s||d&lt;0&amp;&amp;s!==c||f.mouseWheel.preventDefault)&amp;&amp;(e.stopImmediatePropagation(),e.preventDefault()),e.deltaFactor&lt;5&amp;&amp;!f.mouseWheel.normalizeDelta&amp;&amp;(r=e.deltaFactor,a=17),_scrollTo(u,(l-d*r).toString(),{dir:n,dur:a}))}}},_canAccessIFrameCache=new Object,_canAccessIFrame=function(e){var t=!1,o=!1,a=null;if(void 0===e?o="#empty":void 0!==P(e).attr("id")&amp;&amp;(o=P(e).attr("id")),!1!==o&amp;&amp;void 0!==_canAccessIFrameCache[o])return _canAccessIFrameCache[o];if(e){try{var n=e.contentDocument||e.contentWindow.document;a=n.body.innerHTML}catch(e){}t=null!==a}else{try{var n=top.document;a=n.body.innerHTML}catch(e){}t=null!==a}return!1!==o&amp;&amp;(_canAccessIFrameCache[o]=t),t},_iframe=function(e){var t=this.find("iframe");if(t.length){var o=e?"auto":"none";t.css("pointer-events",o)}},_disableMousewheel=function(e,t){var o=t.nodeName.toLowerCase(),a=e.data(H).opt.mouseWheel.disableOver;return-1&lt;P.inArray(o,a)&amp;&amp;!(-1&lt;P.inArray(o,["select","textarea"])&amp;&amp;!P(t).is(":focus"))},_draggerRail=function(){var r,l=P(this),s=l.data(H),e=H+"_"+s.idx,c=P("#mCSB_"+s.idx+"_container"),d=c.parent(),t=P(".mCSB_"+s.idx+"_scrollbar ."+S[12]);t.bind("mousedown."+e+" touchstart."+e+" pointerdown."+e+" MSPointerDown."+e,function(e){F=!0,P(e.target).hasClass("mCSB_dragger")||(r=1)}).bind("touchend."+e+" pointerup."+e+" MSPointerUp."+e,function(e){F=!1}).bind("click."+e,function(e){if(r&amp;&amp;(r=0,P(e.target).hasClass(S[12])||P(e.target).hasClass("mCSB_draggerRail"))){_stop(l);var t=P(this),o=t.find(".mCSB_dragger");if(0&lt;t.parent(".mCSB_scrollTools_horizontal").length){if(!s.overflowed[1])return;var a="x",n=e.pageX&gt;o.offset().left?-1:1,i=Math.abs(c[0].offsetLeft)-n*(.9*d.width())}else{if(!s.overflowed[0])return;var a="y",n=e.pageY&gt;o.offset().top?-1:1,i=Math.abs(c[0].offsetTop)-n*(.9*d.height())}_scrollTo(l,i.toString(),{dir:a,scrollEasing:"mcsEaseInOut"})}})},_focus=function(){var i=P(this),e=i.data(H),r=e.opt,t=H+"_"+e.idx,l=P("#mCSB_"+e.idx+"_container"),s=l.parent();l.bind("focusin."+t,function(e){var n=P(document.activeElement),t=l.find(".mCustomScrollBox").length;n.is(r.advanced.autoScrollOnFocus)&amp;&amp;(_stop(i),clearTimeout(i[0]._focusTimeout),i[0]._focusTimer=t?17*t:0,i[0]._focusTimeout=setTimeout(function(){var e=[_childPos(n)[0],_childPos(n)[1]],t=[l[0].offsetTop,l[0].offsetLeft],o=[0&lt;=t[0]+e[0]&amp;&amp;t[0]+e[0]&lt;s.height()-n.outerHeight(!1),0&lt;=t[1]+e[1]&amp;&amp;t[0]+e[1]&lt;s.width()-n.outerWidth(!1)],a="yx"!==r.axis||o[0]||o[1]?"all":"none";"x"===r.axis||o[0]||_scrollTo(i,e[0].toString(),{dir:"y",scrollEasing:"mcsEaseInOut",overwrite:a,dur:0}),"y"===r.axis||o[1]||_scrollTo(i,e[1].toString(),{dir:"x",scrollEasing:"mcsEaseInOut",overwrite:a,dur:0})},i[0]._focusTimer))})},_wrapperScroll=function(){var e=P(this),t=e.data(H),o=H+"_"+t.idx,a=P("#mCSB_"+t.idx+"_container").parent();a.bind("scroll."+o,function(e){0===a.scrollTop()&amp;&amp;0===a.scrollLeft()||P(".mCSB_"+t.idx+"_scrollbar").css("visibility","hidden")})},_buttons=function(){var a=P(this),n=a.data(H),i=n.opt,r=n.sequential,e=H+"_"+n.idx,t=".mCSB_"+n.idx+"_scrollbar",o=P(t+"&gt;a");o.bind("contextmenu."+e,function(e){e.preventDefault()}).bind("mousedown."+e+" touchstart."+e+" pointerdown."+e+" MSPointerDown."+e+" mouseup."+e+" touchend."+e+" pointerup."+e+" MSPointerUp."+e+" mouseout."+e+" pointerout."+e+" MSPointerOut."+e+" click."+e,function(e){if(e.preventDefault(),_mouseBtnLeft(e)){var t=P(this).attr("class");switch(r.type=i.scrollButtons.scrollType,e.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===r.type)return;F=!0,n.tweenRunning=!1,o("on",t);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===r.type)return;F=!1,r.dir&amp;&amp;o("off",t);break;case"click":if("stepped"!==r.type||n.tweenRunning)return;o("on",t)}}function o(e,t){_sequentialScroll(a,e,t)}})},_keyboard=function(){var l=P(this),s=l.data(H),c=s.opt,d=s.sequential,e=H+"_"+s.idx,t=P("#mCSB_"+s.idx),u=P("#mCSB_"+s.idx+"_container"),h=u.parent(),f="input,textarea,select,datalist,keygen,[contenteditable='true']",o=u.find("iframe"),a=["blur."+e+" keydown."+e+" keyup."+e];function n(e){switch(e.type){case"blur":s.tweenRunning&amp;&amp;d.dir&amp;&amp;r("off",null);break;case"keydown":case"keyup":var t=e.keyCode?e.keyCode:e.which,o="on";if("x"!==c.axis&amp;&amp;(38===t||40===t)||"y"!==c.axis&amp;&amp;(37===t||39===t)){if((38===t||40===t)&amp;&amp;!s.overflowed[0]||(37===t||39===t)&amp;&amp;!s.overflowed[1])return;"keyup"===e.type&amp;&amp;(o="off"),P(document.activeElement).is(f)||(e.preventDefault(),e.stopImmediatePropagation(),r(o,t))}else if(33===t||34===t){if((s.overflowed[0]||s.overflowed[1])&amp;&amp;(e.preventDefault(),e.stopImmediatePropagation()),"keyup"===e.type){_stop(l);var a=34===t?-1:1;if("x"===c.axis||"yx"===c.axis&amp;&amp;s.overflowed[1]&amp;&amp;!s.overflowed[0])var n="x",i=Math.abs(u[0].offsetLeft)-a*(.9*h.width());else var n="y",i=Math.abs(u[0].offsetTop)-a*(.9*h.height());_scrollTo(l,i.toString(),{dir:n,scrollEasing:"mcsEaseInOut"})}}else if((35===t||36===t)&amp;&amp;!P(document.activeElement).is(f)&amp;&amp;((s.overflowed[0]||s.overflowed[1])&amp;&amp;(e.preventDefault(),e.stopImmediatePropagation()),"keyup"===e.type)){if("x"===c.axis||"yx"===c.axis&amp;&amp;s.overflowed[1]&amp;&amp;!s.overflowed[0])var n="x",i=35===t?Math.abs(h.width()-u.outerWidth(!1)):0;else var n="y",i=35===t?Math.abs(h.height()-u.outerHeight(!1)):0;_scrollTo(l,i.toString(),{dir:n,scrollEasing:"mcsEaseInOut"})}}function r(e,t){d.type=c.keyboard.scrollType,d.scrollAmount=c.keyboard.scrollAmount,"stepped"===d.type&amp;&amp;s.tweenRunning||_sequentialScroll(l,e,t)}}o.length&amp;&amp;o.each(function(){P(this).bind("load",function(){_canAccessIFrame(this)&amp;&amp;P(this.contentDocument||this.contentWindow.document).bind(a[0],function(e){n(e)})})}),t.attr("tabindex","0").bind(a[0],function(e){n(e)})},_sequentialScroll=function(u,e,t,h,f){var m=u.data(H),_=m.opt,p=m.sequential,g=P("#mCSB_"+m.idx+"_container"),o="stepped"===p.type,v=_.scrollInertia&lt;26?26:_.scrollInertia,x=_.scrollInertia&lt;1?17:_.scrollInertia;switch(e){case"on":if(p.dir=[t===S[16]||t===S[15]||39===t||37===t?"x":"y",t===S[13]||t===S[15]||38===t||37===t?-1:1],_stop(u),_isNumeric(t)&amp;&amp;"stepped"===p.type)return;w(o);break;case"off":clearTimeout(p.step),_delete(p,"step"),_stop(u),(o||m.tweenRunning&amp;&amp;p.dir)&amp;&amp;w(!0)}function w(e){_.snapAmount&amp;&amp;(p.scrollAmount=_.snapAmount instanceof Array?"x"===p.dir[0]?_.snapAmount[1]:_.snapAmount[0]:_.snapAmount);var t="stepped"!==p.type,o=f||(e?t?v/1.5:x:1e3/60),a=e?t?7.5:40:2.5,n=[Math.abs(g[0].offsetTop),Math.abs(g[0].offsetLeft)],i=[10&lt;m.scrollRatio.y?10:m.scrollRatio.y,10&lt;m.scrollRatio.x?10:m.scrollRatio.x],r="x"===p.dir[0]?n[1]+p.dir[1]*(i[1]*a):n[0]+p.dir[1]*(i[0]*a),l="x"===p.dir[0]?n[1]+p.dir[1]*parseInt(p.scrollAmount):n[0]+p.dir[1]*parseInt(p.scrollAmount),s="auto"!==p.scrollAmount?l:r,c=h||(e?t?"mcsLinearOut":"mcsEaseInOut":"mcsLinear"),d=!!e;e&amp;&amp;o&lt;17&amp;&amp;(s="x"===p.dir[0]?n[1]:n[0]),_scrollTo(u,s.toString(),{dir:p.dir[0],scrollEasing:c,dur:o,onComplete:d}),e?p.dir=!1:(clearTimeout(p.step),p.step=setTimeout(function(){w()},o))}},_arr=function(e){var t=P(this).data(H).opt,o=[];return"function"==typeof e&amp;&amp;(e=e()),e instanceof Array?o=1&lt;e.length?[e[0],e[1]]:"x"===t.axis?[null,e[0]]:[e[0],null]:(o[0]=e.y?e.y:e.x||"x"===t.axis?null:e,o[1]=e.x?e.x:e.y||"y"===t.axis?null:e),"function"==typeof o[0]&amp;&amp;(o[0]=o[0]()),"function"==typeof o[1]&amp;&amp;(o[1]=o[1]()),o},_to=function(e,t){if(null!=e&amp;&amp;void 0!==e){var o=P(this),a=o.data(H),n=a.opt,i=P("#mCSB_"+a.idx+"_container"),r=i.parent(),l=typeof e,s="x"===(t=t||("x"===n.axis?"x":"y"))?i.outerWidth(!1)-r.width():i.outerHeight(!1)-r.height(),c="x"===t?i[0].offsetLeft:i[0].offsetTop,d="x"===t?"left":"top";switch(l){case"function":return e();case"object":var u=e.jquery?e:P(e);if(!u.length)return;return"x"===t?_childPos(u)[1]:_childPos(u)[0];case"string":case"number":if(_isNumeric(e))return Math.abs(e);if(-1!==e.indexOf("%"))return Math.abs(s*parseInt(e)/100);if(-1!==e.indexOf("-="))return Math.abs(c-parseInt(e.split("-=")[1]));if(-1!==e.indexOf("+=")){var h=c+parseInt(e.split("+=")[1]);return 0&lt;=h?0:Math.abs(h)}if(-1!==e.indexOf("px")&amp;&amp;_isNumeric(e.split("px")[0]))return Math.abs(e.split("px")[0]);if("top"===e||"left"===e)return 0;if("bottom"===e)return Math.abs(r.height()-i.outerHeight(!1));if("right"===e)return Math.abs(r.width()-i.outerWidth(!1));if("first"!==e&amp;&amp;"last"!==e)return P(e).length?"x"===t?_childPos(P(e))[1]:_childPos(P(e))[0]:(i.css(d,e),void methods.update.call(null,o[0]));var u=i.find(":"+e);return"x"===t?_childPos(u)[1]:_childPos(u)[0]}}},_autoUpdate=function(e){var t=P(this),o=t.data(H),a=o.opt,n=P("#mCSB_"+o.idx+"_container");if(e)return clearTimeout(n[0].autoUpdate),void _delete(n[0],"autoUpdate");function i(e){if(P(e).hasClass(S[2]))l();else{var t=new Image;t.onload=function(e,t){return function(){return t.apply(e,arguments)}}(t,function(){this.onload=null,P(e).addClass(S[2]),l(2)}),t.src=e.src}}function r(){!0===a.advanced.updateOnSelectorChange&amp;&amp;(a.advanced.updateOnSelectorChange="*");var e=0,t=n.find(a.advanced.updateOnSelectorChange);return a.advanced.updateOnSelectorChange&amp;&amp;0&lt;t.length&amp;&amp;t.each(function(){e+=this.offsetHeight+this.offsetWidth}),e}function l(e){clearTimeout(n[0].autoUpdate),methods.update.call(null,t[0],e)}!function e(){clearTimeout(n[0].autoUpdate),0!==t.parents("html").length?n[0].autoUpdate=setTimeout(function(){return a.advanced.updateOnSelectorChange&amp;&amp;(o.poll.change.n=r(),o.poll.change.n!==o.poll.change.o)?(o.poll.change.o=o.poll.change.n,void l(3)):a.advanced.updateOnContentResize&amp;&amp;(o.poll.size.n=t[0].scrollHeight+t[0].scrollWidth+n[0].offsetHeight+t[0].offsetHeight+t[0].offsetWidth,o.poll.size.n!==o.poll.size.o)?(o.poll.size.o=o.poll.size.n,void l(1)):!a.advanced.updateOnImageLoad||"auto"===a.advanced.updateOnImageLoad&amp;&amp;"y"===a.axis||(o.poll.img.n=n.find("img").length,o.poll.img.n===o.poll.img.o)?void((a.advanced.updateOnSelectorChange||a.advanced.updateOnContentResize||a.advanced.updateOnImageLoad)&amp;&amp;e()):(o.poll.img.o=o.poll.img.n,void n.find("img").each(function(){i(this)}))},a.advanced.autoUpdateTimeout):t=null}()},_snapAmount=function(e,t,o){return Math.round(e/t)*t-o},_stop=function(e){var t=e.data(H),o=P("#mCSB_"+t.idx+"_container,#mCSB_"+t.idx+"_container_wrapper,#mCSB_"+t.idx+"_dragger_vertical,#mCSB_"+t.idx+"_dragger_horizontal");o.each(function(){_stopTween.call(this)})},_scrollTo=function(n,e,i){var t=n.data(H),o=t.opt,a={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:o.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},i=P.extend(a,i),r=[i.dur,i.drag?0:i.dur],l=P("#mCSB_"+t.idx),s=P("#mCSB_"+t.idx+"_container"),c=s.parent(),d=o.callbacks.onTotalScrollOffset?_arr.call(n,o.callbacks.onTotalScrollOffset):[0,0],u=o.callbacks.onTotalScrollBackOffset?_arr.call(n,o.callbacks.onTotalScrollBackOffset):[0,0];if(t.trigger=i.trigger,0===c.scrollTop()&amp;&amp;0===c.scrollLeft()||(P(".mCSB_"+t.idx+"_scrollbar").css("visibility","visible"),c.scrollTop(0).scrollLeft(0)),"_resetY"!==e||t.contentReset.y||(b("onOverflowYNone")&amp;&amp;o.callbacks.onOverflowYNone.call(n[0]),t.contentReset.y=1),"_resetX"!==e||t.contentReset.x||(b("onOverflowXNone")&amp;&amp;o.callbacks.onOverflowXNone.call(n[0]),t.contentReset.x=1),"_resetY"!==e&amp;&amp;"_resetX"!==e){if(!t.contentReset.y&amp;&amp;n[0].mcs||!t.overflowed[0]||(b("onOverflowY")&amp;&amp;o.callbacks.onOverflowY.call(n[0]),t.contentReset.x=null),!t.contentReset.x&amp;&amp;n[0].mcs||!t.overflowed[1]||(b("onOverflowX")&amp;&amp;o.callbacks.onOverflowX.call(n[0]),t.contentReset.x=null),o.snapAmount){var h=o.snapAmount instanceof Array?"x"===i.dir?o.snapAmount[1]:o.snapAmount[0]:o.snapAmount;e=_snapAmount(e,h,o.snapOffset)}switch(i.dir){case"x":var f=P("#mCSB_"+t.idx+"_dragger_horizontal"),m="left",_=s[0].offsetLeft,p=[l.width()-s.outerWidth(!1),f.parent().width()-f.width()],g=[e,0===e?0:e/t.scrollRatio.x],v=d[1],x=u[1],w=0&lt;v?v/t.scrollRatio.x:0,S=0&lt;x?x/t.scrollRatio.x:0;break;case"y":var f=P("#mCSB_"+t.idx+"_dragger_vertical"),m="top",_=s[0].offsetTop,p=[l.height()-s.outerHeight(!1),f.parent().height()-f.height()],g=[e,0===e?0:e/t.scrollRatio.y],v=d[0],x=u[0],w=0&lt;v?v/t.scrollRatio.y:0,S=0&lt;x?x/t.scrollRatio.y:0}g[1]&lt;0||0===g[0]&amp;&amp;0===g[1]?g=[0,0]:g[1]&gt;=p[1]?g=[p[0],p[1]]:g[0]=-g[0],n[0].mcs||(C(),b("onInit")&amp;&amp;o.callbacks.onInit.call(n[0])),clearTimeout(s[0].onCompleteTimeout),_tweenTo(f[0],m,Math.round(g[1]),r[1],i.scrollEasing),!t.tweenRunning&amp;&amp;(0===_&amp;&amp;0&lt;=g[0]||_===p[0]&amp;&amp;g[0]&lt;=p[0])||_tweenTo(s[0],m,Math.round(g[0]),r[0],i.scrollEasing,i.overwrite,{onStart:function(){i.callbacks&amp;&amp;i.onStart&amp;&amp;!t.tweenRunning&amp;&amp;(b("onScrollStart")&amp;&amp;(C(),o.callbacks.onScrollStart.call(n[0])),t.tweenRunning=!0,_onDragClasses(f),t.cbOffsets=[o.callbacks.alwaysTriggerOffsets||_&gt;=p[0]+v,o.callbacks.alwaysTriggerOffsets||_&lt;=-x])},onUpdate:function(){i.callbacks&amp;&amp;i.onUpdate&amp;&amp;b("whileScrolling")&amp;&amp;(C(),o.callbacks.whileScrolling.call(n[0]))},onComplete:function(){if(i.callbacks&amp;&amp;i.onComplete){"yx"===o.axis&amp;&amp;clearTimeout(s[0].onCompleteTimeout);var e=s[0].idleTimer||0;s[0].onCompleteTimeout=setTimeout(function(){b("onScroll")&amp;&amp;(C(),o.callbacks.onScroll.call(n[0])),b("onTotalScroll")&amp;&amp;g[1]&gt;=p[1]-w&amp;&amp;t.cbOffsets[0]&amp;&amp;(C(),o.callbacks.onTotalScroll.call(n[0])),b("onTotalScrollBack")&amp;&amp;g[1]&lt;=S&amp;&amp;t.cbOffsets[1]&amp;&amp;(C(),o.callbacks.onTotalScrollBack.call(n[0])),t.tweenRunning=!1,s[0].idleTimer=0,_onDragClasses(f,"hide")},e)}}})}function b(e){return t&amp;&amp;o.callbacks[e]&amp;&amp;"function"==typeof o.callbacks[e]}function C(){var e=[s[0].offsetTop,s[0].offsetLeft],t=[f[0].offsetTop,f[0].offsetLeft],o=[s.outerHeight(!1),s.outerWidth(!1)],a=[l.height(),l.width()];n[0].mcs={content:s,top:e[0],left:e[1],draggerTop:t[0],draggerLeft:t[1],topPct:Math.round(100*Math.abs(e[0])/(Math.abs(o[0])-a[0])),leftPct:Math.round(100*Math.abs(e[1])/(Math.abs(o[1])-a[1])),direction:i.dir}}},_tweenTo=function(e,t,o,a,n,i,r){e&amp;&amp;!e._mTween&amp;&amp;(e._mTween={top:{},left:{}});var l,s,r=r||{},c=r.onStart||function(){},d=r.onUpdate||function(){},u=r.onComplete||function(){},h=_getTime(),f=0,m=e.offsetTop,_=e.style,p=e._mTween[t];"left"===t&amp;&amp;(m=e.offsetLeft);var g=o-m;function v(){p.stop||(f||c.call(),f=_getTime()-h,x(),f&gt;=p.time&amp;&amp;(p.time=f&gt;p.time?f+l-(f-p.time):f+l-1,p.time&lt;f+1&amp;&amp;(p.time=f+1)),p.time&lt;a?p.id=s(v):u.call())}function x(){0&lt;a?(p.currVal=function(e,t,o,a,n){switch(n){case"linear":case"mcsLinear":return o*e/a+t;case"mcsLinearOut":return e/=a,e--,o*Math.sqrt(1-e*e)+t;case"easeInOutSmooth":return(e/=a/2)&lt;1?o/2*e*e+t:-o/2*(--e*(e-2)-1)+t;case"easeInOutStrong":return(e/=a/2)&lt;1?o/2*Math.pow(2,10*(e-1))+t:(e--,o/2*(2-Math.pow(2,-10*e))+t);case"easeInOut":case"mcsEaseInOut":return(e/=a/2)&lt;1?o/2*e*e*e+t:o/2*((e-=2)*e*e+2)+t;case"easeOutSmooth":return e/=a,-o*(--e*e*e*e-1)+t;case"easeOutStrong":return o*(1-Math.pow(2,-10*e/a))+t;case"easeOut":case"mcsEaseOut":default:var i=(e/=a)*e,r=i*e;return t+o*(.499999999999997*r*i+-2.5*i*i+5.5*r+-6.5*i+4*e)}}(p.time,m,g,a,n),_[t]=Math.round(p.currVal)+"px"):_[t]=o+"px",d.call()}p.stop=0,"none"===i||null!=p.id&amp;&amp;(window.requestAnimationFrame?window.cancelAnimationFrame(p.id):clearTimeout(p.id),p.id=null),l=1e3/60,p.time=f+l,s=window.requestAnimationFrame?window.requestAnimationFrame:function(e){return x(),setTimeout(e,.01)},p.id=s(v)},_getTime=function(){return window.performance&amp;&amp;window.performance.now?window.performance.now():window.performance&amp;&amp;window.performance.webkitNow?window.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},_stopTween=function(){var e=this;e._mTween||(e._mTween={top:{},left:{}});for(var t=["top","left"],o=0;o&lt;t.length;o++){var a=t[o];e._mTween[a].id&amp;&amp;(window.requestAnimationFrame?window.cancelAnimationFrame(e._mTween[a].id):clearTimeout(e._mTween[a].id),e._mTween[a].id=null,e._mTween[a].stop=1)}},_delete=function(t,o){try{delete t[o]}catch(e){t[o]=null}},_mouseBtnLeft=function(e){return!(e.which&amp;&amp;1!==e.which)},_pointerTouch=function(e){var t=e.originalEvent.pointerType;return!(t&amp;&amp;"touch"!==t&amp;&amp;2!==t)},_isNumeric=function(e){return!isNaN(parseFloat(e))&amp;&amp;isFinite(e)},_childPos=function(e){var t=e.parents(".mCSB_container");return[e.offset().top-t.offset().top,e.offset().left-t.offset().left]},_isTabHidden=function(){var e=function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t&lt;e.length;t++)if(e[t]+"Hidden"in document)return e[t]+"Hidden";return null}();return!!e&amp;&amp;document[e]},P.fn[f]=function(e){return methods[e]?methods[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&amp;&amp;e?void P.error("Method "+e+" does not exist"):methods.init.apply(this,arguments)},P[f]=function(e){return methods[e]?methods[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&amp;&amp;e?void P.error("Method "+e+" does not exist"):methods.init.apply(this,arguments)},P[f].defaults=n,window[f]=!0,P(window).bind("load",function(){P(a)[f](),P.extend(P.expr[":"],{mcsInView:P.expr[":"].mcsInView||function(e){var t,o,a=P(e),n=a.parents(".mCSB_container");if(n.length)return t=n.parent(),0&lt;=(o=[n[0].offsetTop,n[0].offsetLeft])[0]+_childPos(a)[0]&amp;&amp;o[0]+_childPos(a)[0]&lt;t.height()-a.outerHeight(!1)&amp;&amp;0&lt;=o[1]+_childPos(a)[1]&amp;&amp;o[1]+_childPos(a)[1]&lt;t.width()-a.outerWidth(!1)},mcsInSight:P.expr[":"].mcsInSight||function(e,t,o){var a,n,i,r,l=P(e),s=l.parents(".mCSB_container"),c="exact"===o[3]?[[1,0],[1,0]]:[[.9,.1],[.6,.4]];if(s.length)return a=[l.outerHeight(!1),l.outerWidth(!1)],i=[s[0].offsetTop+_childPos(l)[0],s[0].offsetLeft+_childPos(l)[1]],n=[s.parent()[0].offsetHeight,s.parent()[0].offsetWidth],i[0]-n[0]*(r=[a[0]&lt;n[0]?c[0]:c[1],a[1]&lt;n[1]?c[0]:c[1]])[0][0]&lt;0&amp;&amp;0&lt;=i[0]+a[0]-n[0]*r[0][1]&amp;&amp;i[1]-n[1]*r[1][0]&lt;0&amp;&amp;0&lt;=i[1]+a[1]-n[1]*r[1][1]},mcsOverflow:P.expr[":"].mcsOverflow||function(e){var t=P(e).data(H);if(t)return t.overflowed[0]||t.overflowed[1]}})})});
/* End */
;
; /* Start:"a:4:{s:4:"full";s:59:"/local/templates/aspro_max/js/scrollTabs.js?171194855012271";s:6:"source";s:43:"/local/templates/aspro_max/js/scrollTabs.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
InitTabsScroll = function(){
	$('.arrow_scroll:not(.arrow_scroll_init)').scrollTab();
}

ResizeScrollTabs = function() {
	var scrollTabs = $('.arrow_scroll_init');

	if(scrollTabs.length) {
		scrollTabs.each(function(i, scrollTab){
			var _scrollTab = $(scrollTab);
			_scrollTab.data('scrollTabOptions').resize();
		});
	}
}

$(document).ready(function(){
	InitTabsScroll();
});

$(window).on('resize', function(){
	if(window.scrollTabsTimeout !== undefined) {
		clearTimeout(window.scrollTabsTimeout);
	}
	
	window.scrollTabsTimeout = setTimeout(
		ResizeScrollTabs,
		20
	);
});

$.fn.scrollTab = function( options ){
	function _scrollTab(element, options) {
		var _scrollTab = $(element);
		var tabs_wrapper = _scrollTab.find(options.tabs_wrapper);
		if( tabs_wrapper === undefined || !tabs_wrapper.length )
			return false;
		
		var tabs = tabs_wrapper.find('&gt; li');
		if(!tabs.length)
			return false;

		var arrow_svg = '&lt;svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"&gt;'+
							'&lt;rect width="12" height="8" fill="#333" fill-opacity="0" /&gt;'+
							'&lt;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)"/&gt;'+
						'&lt;/svg&gt;';
		var arrows_wrapper = '&lt;div class="arrows_wrapper"&gt;'+
								'&lt;div class="arrow arrow_left colored_theme_hover_text"&gt;'+arrow_svg+'&lt;/div&gt;'+
								'&lt;div class="arrow arrow_right colored_theme_hover_text"&gt;'+arrow_svg+'&lt;/div&gt;'+
							'&lt;/div&gt;';

		var arrows = $(arrows_wrapper).insertAfter(tabs_wrapper);
		var arrow_left = arrows.find('.arrow_left');
		var arrow_right = arrows.find('.arrow_right');

		var thisOoptions = $.extend({}, options);

		thisOoptions.scrollTab = _scrollTab;
		thisOoptions.wrapper = tabs_wrapper;
		thisOoptions.tabs = tabs;
		thisOoptions.arrows = {};
		thisOoptions.arrows.wrapper = arrows;
		thisOoptions.arrows.arrow_left = arrow_left;
		thisOoptions.arrows.arrow_right = arrow_right;

		if(thisOoptions.linked_tabs !== undefined &amp;&amp; thisOoptions.linked_tabs.length &amp;&amp; thisOoptions.linked_tabs.data('scrollTabOptions') !== undefined) {
			thisOoptions.linked_options = thisOoptions.linked_tabs.data('scrollTabOptions');
			thisOoptions.linked_options.linked_options = thisOoptions;
		}

		if(options.arrows_css) {
			thisOoptions.arrows.arrow_left.css(options.arrows_css);
			thisOoptions.arrows.arrow_right.css(options.arrows_css);
		}

		thisOoptions.initTabs = function(){
			thisOoptions.wrapperBounds = thisOoptions.wrapper[0].getBoundingClientRect();
			thisOoptions.scrollBounds = thisOoptions.scrollTab[0].getBoundingClientRect();
			elements = $(thisOoptions.tabs);
			if(elements.length) {
				thisOoptions.firstTabBound = elements[0].getBoundingClientRect().left;
				thisOoptions.lastTabBound = elements[ elements.length - 1 ].getBoundingClientRect().right;
			}
			thisOoptions.minTranslate = (thisOoptions.wrapperBounds.right &lt; thisOoptions.lastTabBound ? thisOoptions.wrapperBounds.right - thisOoptions.lastTabBound - 2 : 0);
			thisOoptions.disabled = ( thisOoptions.lastTabBound - thisOoptions.wrapperBounds.left ) &lt;= thisOoptions.scrollBounds.width;
		}

		thisOoptions.wrapper.css({
			'white-space': 'nowrap',
			'min-width': 'auto',
			'overflow': 'visible',
			'z-index': '1',
		});
		thisOoptions.scrollTab.css({
			'overflow': 'hidden',
			'position': 'relative',
		});

		thisOoptions.checkArrows = function(translate){
			if(translate === undefined) {
				translate = thisOoptions.translate;
			}
			
			if( thisOoptions.disabled ) {
				thisOoptions.arrows.arrow_left.addClass('disabled');
				thisOoptions.arrows.arrow_right.addClass('disabled');
			} else {
				if(translate &gt;= thisOoptions.maxTranslate) {
					thisOoptions.arrows.arrow_left.addClass('disabled');
					thisOoptions.arrows.arrow_right.removeClass('disabled');
				} else if(translate &lt;= thisOoptions.minTranslate) {
					thisOoptions.arrows.arrow_right.addClass('disabled');
					thisOoptions.arrows.arrow_left.removeClass('disabled');
				} else {
					thisOoptions.arrows.arrow_left.removeClass('disabled');
					thisOoptions.arrows.arrow_right.removeClass('disabled');
				}
			}

		}

		thisOoptions.directScroll = function(distance, delay, step){
			if(delay === undefined) {
				delay = 5;
			}
			clearInterval(thisOoptions.timerMoveDirect);
			var newTranslate = thisOoptions.translate + distance;

			if(newTranslate &gt; thisOoptions.maxTranslate) {
				newTranslate = thisOoptions.maxTranslate;
			} else if(newTranslate &lt; thisOoptions.minTranslate) {
				newTranslate = thisOoptions.minTranslate;
			}
			var tmpTranslate = thisOoptions.translate;
			thisOoptions.translate = newTranslate;
			
			if(delay == 0) {
				thisOoptions.translate = newTranslate;
				thisOoptions.wrapper.css({
					'transform': 'translateX('+thisOoptions.translate+'px)',
				});
			} else {
				if(step === undefined) {
					step = 1;
				}
				thisOoptions.timerMoveDirect = setInterval(
					function() {
						thisOoptions.wrapper.css({
							'transform': 'translateX('+tmpTranslate+'px)',
						});
						
						if( (distance &lt; 0 &amp;&amp; tmpTranslate &lt;= newTranslate) || (distance &gt; 0 &amp;&amp; tmpTranslate &gt;= newTranslate) ) {
							thisOoptions.initTabs();
							clearInterval(thisOoptions.timerMoveDirect);
						}

						if(tmpTranslate &lt; newTranslate) {
							tmpTranslate += step;
						} else {
							tmpTranslate -= step;
						}
					},
					delay
				);
			}
			
			thisOoptions.checkArrows(newTranslate);
		};
		
		thisOoptions.addArrowsEvents = function() {
			thisOoptions.arrows.arrow_right.on('mouseenter', function() {
				thisOoptions.arrows.arrow_left.removeClass('disabled');
				thisOoptions.timerMoveLeft = setInterval(
					function() {
						if( thisOoptions.translate &lt; thisOoptions.minTranslate ){
							clearInterval(thisOoptions.timerMoveLeft);
							thisOoptions.arrows.arrow_right.addClass('disabled');
						} else {
							thisOoptions.translate -= thisOoptions.translateSpeed;
							thisOoptions.wrapper.css({
								'transform': 'translateX('+thisOoptions.translate+'px)',
							});
						}
					},
					10
				);
			});

			thisOoptions.arrows.arrow_right.on('mouseleave', function() {
				clearInterval(thisOoptions.timerMoveLeft);
			});

			thisOoptions.arrows.arrow_right.on('click', function() {
				thisOoptions.directScroll(-thisOoptions.directTranslate);
				thisOoptions.arrows.arrow_left.removeClass('disabled');
			});

			thisOoptions.arrows.arrow_right.on('touchend', function() {
				setTimeout(function() {
					clearInterval(thisOoptions.timerMoveLeft);
				}, 1);
			});

			thisOoptions.arrows.arrow_left.on('mouseenter', function() {
				thisOoptions.arrows.arrow_right.removeClass('disabled');
				thisOoptions.timerMoveRight = setInterval(
					function() {
						if(thisOoptions.translate &gt;= thisOoptions.maxTranslate){
							clearInterval(thisOoptions.timerMoveRight);
							thisOoptions.arrows.arrow_left.addClass('disabled');
						} else {
							thisOoptions.translate += thisOoptions.translateSpeed;
							thisOoptions.wrapper.css({
								'transform': 'translateX('+thisOoptions.translate+'px)',
							});
						}
					},
					10
				);
			});

			thisOoptions.arrows.arrow_left.on('mouseleave', function() {
				clearInterval(thisOoptions.timerMoveRight);
			});

			thisOoptions.arrows.arrow_left.on('click', function() {
				thisOoptions.directScroll(thisOoptions.directTranslate);
				thisOoptions.arrows.arrow_right.removeClass('disabled');
			});

			thisOoptions.arrows.arrow_left.on('touchend', function() {
				setTimeout(function() {
					clearInterval(thisOoptions.timerMoveRight);
				}, 1);
			});
		};

		thisOoptions.addTabsEvents = function() {
			thisOoptions.tabs.on('click', function() {
				var leftScrollBound = thisOoptions.scrollBounds.left;
				var rightScrollBound = thisOoptions.scrollBounds.right;

				var tabBounds = this.getBoundingClientRect();
				var leftTabScrollBound = tabBounds.left - thisOoptions.arrows.arrow_width;
				var rightTabScrollBound = tabBounds.right + thisOoptions.arrows.arrow_width;

				if(leftTabScrollBound &lt; leftScrollBound) {
					thisOoptions.directScroll(leftScrollBound - leftTabScrollBound, 1, 2);
				} else if(rightTabScrollBound &gt; rightScrollBound) {
					thisOoptions.directScroll(rightScrollBound - rightTabScrollBound, 1, 2);
				}

				thisOoptions.activeTab = $(this);

				if(thisOoptions.linked_options !== undefined) {
					var this_index = $(this).index();
					var linked_tab = $(thisOoptions.linked_options.tabs[this_index]);
					var linked_tabs = {
						leftScrollBound: thisOoptions.linked_options.scrollBounds.left,
						rightScrollBound: thisOoptions.linked_options.scrollBounds.right,
						tabBounds: linked_tab[0].getBoundingClientRect(),
					};
					if(linked_tabs.tabBounds.left &lt; linked_tabs.leftScrollBound) {
						thisOoptions.linked_options.directScroll(linked_tabs.leftScrollBound - linked_tabs.tabBounds.left + thisOoptions.linked_options.arrows.arrow_width + 1, 0);
					} else if(linked_tabs.tabBounds.right &gt; linked_tabs.rightScrollBound) {
						thisOoptions.linked_options.directScroll(linked_tabs.rightScrollBound - linked_tabs.tabBounds.right - thisOoptions.linked_options.arrows.arrow_width - 1, 0);
					}

					thisOoptions.linked_options.activeTab = linked_tab;
				}

				
			});
		};

		thisOoptions.addWrapperEvents = function() {
			thisOoptions.wrapper.on('touchstart', function(event) {
				thisOoptions.touch.posPrev = event.originalEvent.changedTouches[0].pageX;
				clearInterval(thisOoptions.timerMoveRight);
				clearInterval(thisOoptions.timerMoveLeft);
				clearInterval(thisOoptions.timerMoveDirect);
			});

			thisOoptions.wrapper.on('touchmove', function(event) {
				thisOoptions.touch.posCurrent = event.originalEvent.changedTouches[0].pageX - thisOoptions.touch.posPrev;
				thisOoptions.directScroll(thisOoptions.touch.posCurrent, 0);
				thisOoptions.touch.posPrev = event.originalEvent.changedTouches[0].pageX;
			});
		};

		thisOoptions.resize = function(){
			if(thisOoptions.onBeforeResize &amp;&amp; typeof(thisOoptions.onBeforeResize) == 'function') {
				thisOoptions.onBeforeResize(thisOoptions);
			}

			if(thisOoptions.onResize &amp;&amp; typeof(thisOoptions.onResize) == 'function') {
				thisOoptions.onResize(thisOoptions);
			}

			if(thisOoptions.translate &lt; thisOoptions.minTranslate) {
				thisOoptions.directScroll(thisOoptions.minTranslate - thisOoptions.translate);
			} else if(thisOoptions.translate &gt; thisOoptions.maxTranslate) {
				thisOoptions.directScroll(thisOoptions.maxTranslate - thisOoptions.translate);
			}

			if( thisOoptions.activeTab !== undefined &amp;&amp; thisOoptions.activeTab.length ) {
				var activeTabBounds = thisOoptions.activeTab[0].getBoundingClientRect();
				if(activeTabBounds.left &lt; thisOoptions.scrollBounds.left) {
					thisOoptions.directScroll(thisOoptions.scrollBounds.left - activeTabBounds.left);
				} else if(activeTabBounds.right &gt; thisOoptions.scrollBounds.right) {
					thisOoptions.directScroll(thisOoptions.scrollBounds.right - activeTabBounds.right);
				}
			}

			thisOoptions.initTabs();
			thisOoptions.checkArrows();

			if(thisOoptions.onAfterResize &amp;&amp; typeof(thisOoptions.onAfterResize) == 'function') {
				thisOoptions.onAfterResize(thisOoptions);
			}
		};


		_scrollTab.data('scrollTabOptions', thisOoptions );
		_scrollTab.data('scrollTabOptions').addArrowsEvents();
		_scrollTab.data('scrollTabOptions').addTabsEvents();
		_scrollTab.data('scrollTabOptions').addWrapperEvents();
		_scrollTab.addClass('arrow_scroll_init').addClass('swipeignore');
		if (arrow_right !== undefined &amp;&amp; arrow_right.length) {
			thisOoptions.arrows.arrow_width = thisOoptions.arrows.arrow_right[0].getBoundingClientRect().width;
		}
		_scrollTab.data('scrollTabOptions').resize();
		delete thisOoptions;
	}

	var options = $.extend({
		translate: 1,
		translateSpeed: 2,
		directTranslate: 150,
		maxTranslate: 1,
		touch: {},
		arrows_css: false,
		tabs_wrapper: '.nav-tabs',
		onResize: false,
		width_grow: 9,
	}, options);

	var el = $(this);

	if(el.hasClass('arrow_scroll_init'))
		return false;

	el.each(function(i, scrollTab){
		_scrollTab(scrollTab, options);
	});
}
/* End */
;
; /* Start:"a:4:{s:4:"full";s:54:"/local/templates/aspro_max/js/main.js?1711417745305133";s:6:"source";s:37:"/local/templates/aspro_max/js/main.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
var basketTimeoutSlide;
var resizeEventTimer;

var clicked_tab = 0;

if (typeof arAsproOptions === 'undefined') {
	var arAsproOptions = ({
		"SITE_DIR" : '/'
	});
	if($('body').data('site') !== undefined)
		arAsproOptions["SITE_DIR"] = $('body').data('site');
}

InitLazyLoad = function() {}

$(document).on('change', '.uploader input[type=file]', function(){
	if(!$(this).next().length || !$(this).next().hasClass('resetfile')){
		$('&lt;span class="resetfile"&gt;&lt;svg xmlns="http://www.w3.org/2000/svg" width="11" height="11" viewBox="0 0 11 11"&gt;&lt;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)"/&gt;&lt;/svg&gt;&lt;/span&gt;').insertAfter($(this));
	}
});

$(document).on('click', '.uploader.files_add input[type=file] + .resetfile', function(){
	var $input = $(this).prev();
	$input.val('');
	$.uniform.update($input);
	$(this).remove();
});

$(document).on('click', '.top_block h3', function(){
	if(window.matchMedia('(max-width: 550px)').matches)
	{
		var $this = $(this);
		var a = $this.siblings('a');
		if(a.length) {
			a[0].click();
		}
	}
});

$(document).on('click', '.bx-yandex-view-layout .yandex-map__mobile-opener', function(){
	if($(this).hasClass('closer')) {
		closeYandexMap();
	} else {
		openYandexMap(this);
	}
});

function openYandexMap(element) {
	var $this = $(element);
	if($this.hasClass('closer'))
		return;
	var currentMap = $this.parents('.bx-yandex-view-layout');
	var mapId = currentMap.find('.bx-yandex-map').attr('id');
	window.openedYandexMapFrame = mapId;
	var mapContainer = $('&lt;div data-mapId="'+mapId+'"&gt;&lt;/div&gt;');
	if(!$('div[data-mapId='+mapId+']').length) {
		currentMap.after(mapContainer);
	}
	var yandexMapFrame = $('&lt;div class="yandex-map__frame"&gt;&lt;/div&gt;');
	$('body .wrapper1').append(yandexMapFrame);
	currentMap.appendTo(yandexMapFrame);
	currentMap.find('.yandex-map__mobile-opener').addClass('closer');
	window.map.container.fitToViewport();
}

function closeYandexMap() {
	var yandexMapFrame = $('.yandex-map__frame');
	if(yandexMapFrame.length) {
		var currentMap = yandexMapFrame.find('.bx-yandex-view-layout');
		var yandexMapContainer = $('div[data-mapId='+window.openedYandexMapFrame+']');
	
		currentMap.appendTo(yandexMapContainer);
		yandexMapFrame.remove();
		currentMap.find('.yandex-map__mobile-opener').removeClass('closer');
		if(window.map) {
			window.map.container.fitToViewport();
		}
	}
}

function throttle(f, t) {
  return function (args) {
    let previousCall = this.lastCall;
    this.lastCall = Date.now();
    if (previousCall === undefined // function is being called for the first time
        || (this.lastCall - previousCall) &gt; t) { // throttle time has elapsed
      f(args);
    }
  }
}

function debounce(f, t) {
  return function (args) {
    let previousCall = this.lastCall;
    this.lastCall = Date.now();
    if (previousCall &amp;&amp; ((this.lastCall - previousCall) &lt;= t)) {
      clearTimeout(this.lastCallTimer);
    }
    this.lastCallTimer = setTimeout(function() {
			f(args);
		}, t);
  }
}

$(document).on('click', '.flex-control-nav.flex-control-js-click li a:not(.flex-active)', function(e) {
	var _this = $(this);
	var itemIndex = _this.data('index') ? _this.data('index') : _this.closest('li').index();

	var block = '';
	var blocks = _this.closest('.items').find('&gt; .item');
	var activeBlock = _this.closest('.items').find('.item.active');

	var activeLi = _this.closest('.flex-control-nav').find('.flex-active');

	activeBlock.fadeOut(function(){
		activeBlock.removeClass('active');

		block = blocks.eq(itemIndex);
		if (block.length) {
			block.fadeIn(function(){
				block.addClass('active');
			})
		}

		_this.addClass('flex-active');
		activeLi.removeClass('flex-active');
	});

	e.preventDefault();
});

$(document).on('mouseenter', '#headerfixed .menu-item.wide_menu', function() {
	var _this = $(this);
	setTimeout(
		function() {
			var dropdownMenu = _this.find('.wrap &gt; .dropdown-menu');
			var menuOffset = dropdownMenu[0].getBoundingClientRect();
			var headerOffset = document.getElementById('headerfixed').getBoundingClientRect();
			var windowHeight = document.documentElement.clientHeight;

			if(menuOffset.height + headerOffset.height &gt; windowHeight) {
				var maxHeight = windowHeight - headerOffset.height;
				dropdownMenu.css({
					'max-height': maxHeight,
				});
				dropdownMenu.find('.menu-navigation').css({'max-height': maxHeight,});
				dropdownMenu.find('.customScrollbar').css({'max-height': maxHeight,});
				dropdownMenu.find('.menu-wrapper.menu-type-4 &gt; li').css({'min-height': 'auto',});
			} else {
				dropdownMenu.css({
					'max-height': '',
				});
				dropdownMenu.find('.menu-navigation').css({'max-height': '',});
				dropdownMenu.find('.customScrollbar').css({'max-height': '',});
				dropdownMenu.find('.menu-wrapper.menu-type-4 &gt; li').css({'min-height': '',});
			}
		},
	300);


});

BX.addCustomEvent('onAjaxSuccess', function(data) {
	if(typeof(data) === 'object' &amp;&amp; data !== null) {
		if(typeof(data.BASKET_REFRESHED) !== undefined &amp;&amp; data.BASKET_REFRESHED === true) {
			var basketCounts = data.BASKET_DATA.BASKET_ITEMS_COUNT;
			reloadBasketCounters(basketCounts);
		}
	}
});

if(!funcDefined('parseUrlQuery')){
	parseUrlQuery=function() {
	    var data = {};
	    if(location.search) {
	        var pair = (location.search.substr(1)).split('&amp;');
	        for(var i = 0; i &lt; pair.length; i ++) {
	            var param = pair[i].split('=');
	            data[param[0]] = param[1];
			}
	    }
	    return data;
	}
}

if(!funcDefined('setLocationSKU')){
	function setLocationSKU(ID, urlParam){
		if(urlParam === undefined)
			urlParam = 'oid';

		var objUrl = parseUrlQuery(),
			j = 0,
			prefix = '',
			query_string = '',
			url = '';

			objUrl[urlParam] = ID;

			for(var i in objUrl)
			{
				if(parseInt(j)&gt;0)
					prefix = '&amp;';
				query_string = query_string + prefix + i + '='+ objUrl[i];
				j++;
			}
			if(query_string)
			{
				url = location.pathname+'?'+query_string + location.hash;
			}
			try {
				//history.pushState(null, null, url);
				history.replaceState(null, null, url);
				return;
			} catch(e) {}
			location.hash = '#' + url.substr(1);
	}
}

if(!funcDefined('ShowOverlay')){
	ShowOverlay = function(){
		$('&lt;div class="jqmOverlay waiting"&gt;&lt;/div&gt;').appendTo('body');
	}
}

if(!funcDefined('HideOverlay')){
	HideOverlay = function(){
		$('.jqmOverlay').detach();
	}
}

if(!funcDefined('trimPrice')){
	var trimPrice = function trimPrice(s){
		s=s.split(" ").join("");
		s=s.split("&amp;nbsp;").join("");
		return s;
	}
}

if(!funcDefined('pauseYmObserver')){
	// pause ya metrika webvisor MutationObserver callback (DOM indexer)
	// use before insert html with some animation
	pauseYmObserver = function(){
		if(
			typeof MutationObserver === 'function' &amp;&amp;
			typeof MutationObserver.observers === 'object' &amp;&amp;
			typeof MutationObserver.observers.ym === 'object'
		){
			if(typeof pauseYmObserver.cnt === 'undefined'){
				pauseYmObserver.cnt = 0;
			}

			++pauseYmObserver.cnt;

			if(!MutationObserver.observers.ym.paused){
				MutationObserver.observers.ym.pause();
			}
		}
	}
}

if(!funcDefined('resumeYmObserver')){
	// resume ya metrika webvisor MutationObserver callback
	// use when animation finished
	resumeYmObserver = function(){
		if(
			typeof MutationObserver === 'function' &amp;&amp;
			typeof MutationObserver.observers === 'object' &amp;&amp;
			typeof MutationObserver.observers.ym === 'object'
		){
			if(typeof pauseYmObserver.cnt === 'undefined'){
				pauseYmObserver.cnt = 1;
			}

			pauseYmObserver.cnt -= pauseYmObserver.cnt &gt; 0 ? 1 : 0;

			if(!pauseYmObserver.cnt &amp;&amp; MutationObserver.observers.ym.paused){
				MutationObserver.observers.ym.resume();
			}
		}
	}
}

if(!funcDefined('markProductRemoveBasket')){
	var markProductRemoveBasket = function markProductRemoveBasket(id){
		$('.in-cart[data-item='+id+']').hide();
		$('.to-cart[data-item='+id+']').show();
		$('.to-cart[data-item='+id+']').closest('.button_block').removeClass('wide');
		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block').show();
		$('.counter_block[data-item='+id+']').closest('.counter_block_inner').show();
		$('.counter_block[data-item='+id+']').show();
		$('.in-subscribe[data-item='+id+']').hide();
		$('.to-subscribe[data-item='+id+']').show();
		//$('.wish_item[data-item='+id+']').removeClass("added");
		$('.wish_item[data-item='+id+'] .value:not(.added)').show();
		$('.wish_item[data-item='+id+'] .value.added').hide();
		$('.wish_item.to[data-item='+id+']').show();
		$('.wish_item.in[data-item='+id+']').hide();
		$('.banner_buttons.with_actions .wraps_buttons[data-id='+id+'] .basket_item_add').removeClass('added');
		$('.banner_buttons.with_actions .wraps_buttons[data-id='+id+'] .wish_item_add').removeClass('added');
	}
}

if(!funcDefined('markProductAddBasket')){
	var markProductAddBasket = function markProductAddBasket(id){
		$('.to-cart[data-item='+id+']').hide();
		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block_inner').hide();
		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block').hide();
		$('.to-cart[data-item='+id+']').closest('.button_block').addClass('wide');
		$('.in-cart[data-item='+id+']').show();
		//$('.wish_item[data-item='+id+']').removeClass("added");
		$('.wish_item[data-item='+id+'] .value:not(.added)').show();
		$('.wish_item[data-item='+id+'] .value.added').hide();

		$('.wish_item.to[data-item='+id+']').show();
		$('.wish_item.in[data-item='+id+']').hide();
		$('.banner_buttons.with_actions .wraps_buttons[data-id='+id+'] .basket_item_add').addClass('added');
	}
}

if(!funcDefined('markProductDelay')){
	var markProductDelay = function markProductDelay(id){
		$('.in-cart[data-item='+id+']').hide();
		$('.to-cart[data-item='+id+']').show();
		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block_inner').show();
		$('.to-cart[data-item='+id+']').closest('.counter_wrapp').find('.counter_block').show();
		$('.to-cart[data-item='+id+']').closest('.button_block').removeClass('wide');
		//$('.wish_item[data-item='+id+']').addClass("added");
		$('.wish_item[data-item='+id+'] .value:not(.added)').hide();
		$('.wish_item[data-item='+id+'] .value.added').css('display','block');

		$('.wish_item.to[data-item='+id+']').hide();
		$('.wish_item.in[data-item='+id+']').show();

		$('.banner_buttons.with_actions .wraps_buttons[data-id='+id+'] .wish_item_add').addClass('added');

	}
}

if(!funcDefined('markProductSubscribe')){
	var markProductSubscribe = function markProductSubscribe(id){
		$('.to-subscribe[data-item='+id+']').hide();
		$('.in-subscribe[data-item='+id+']').css('display','block');
	}
}

if(!funcDefined('updateBottomIconsPanel')){
	var updateBottomIconsPanel = function updateBottomIconsPanel(options){
		if (options &amp;&amp; $('.bottom-icons-panel').length) {
			var bBasketUpdate = ('READY' in options || 'BASKET_COUNT' in options);
			var basketCount = ('READY' in options ? options.READY.COUNT : 
				('BASKET_COUNT' in options ? options.BASKET_COUNT : 0));
			var basketTitle = ('READY' in options ? options.READY.TITLE : 
				('BASKET_SUMM_TITLE' in options ? options.BASKET_SUMM_TITLE : ''));
			var bDelayUpdate = ('DELAY' in options || 'DELAY_COUNT' in options);
			var delayCount = ('DELAY' in options ? options.DELAY.COUNT : 
				('DELAY_COUNT' in options ? options.DELAY_COUNT : 0));
			var delayTitle = ('DELAY' in options ? options.DELAY.TITLE : 
				('DELAY_SUMM_TITLE' in options ? options.DELAY_SUMM_TITLE : ''));
			var bCompareUpdate = ('COMPARE' in options);
			var compareCount = ('COMPARE' in options ? 
				(typeof options.COMPARE === 'object' &amp;&amp; 'COUNT' in options.COMPARE ? options.COMPARE.COUNT : Object.keys(options.COMPARE).length) : 0);
			
			//basket
			if (bBasketUpdate) {
				if (+basketCount &gt; 0) {
					$('.bottom-icons-panel .basket.counter-state').removeClass('counter-state--empty');
				} else {
					$('.bottom-icons-panel .basket.counter-state').addClass('counter-state--empty');
				}
				$('.bottom-icons-panel .basket .counter-state__content-item-value').text(basketCount);
				$('.bottom-icons-panel .basket').closest('.bottom-icons-panel__content-link').attr('title', $('&lt;div/&gt;').html(basketTitle).text());
			}
			//

			//delay
			if (bDelayUpdate &amp;&amp; bBasketUpdate) {
				if (+delayCount &gt; 0) {
					$('.bottom-icons-panel .delay.counter-state').removeClass('counter-state--empty');
				} else {
					$('.bottom-icons-panel .delay.counter-state').addClass('counter-state--empty');
				}
				$('.bottom-icons-panel .delay .counter-state__content-item-value').text(delayCount);
				$('.bottom-icons-panel .delay').closest('.bottom-icons-panel__content-link').attr('title', $('&lt;div/&gt;').html(delayTitle).text());
			}
			//

			//compare
			if (bCompareUpdate) {
				if (compareCount &gt; 0) {
					$('.bottom-icons-panel .compare.counter-state').removeClass('counter-state--empty');
				} else {
					$('.bottom-icons-panel .compare.counter-state').addClass('counter-state--empty');
				}
				$('.bottom-icons-panel .compare .counter-state__content-item-value').text(compareCount);
			}
		}
	}
}
if(!funcDefined('basketFly')){
	var basketFly = function basketFly(action,opener){
		if(typeof obMaxPredictions === 'object'){
			obMaxPredictions.updateAll();
		}

		/*if(arAsproOptions['PAGES']['BASKET_PAGE'])
			return;*/
		$.post( arAsproOptions['SITE_DIR']+"ajax/basket_fly.php", "PARAMS="+$("#basket_form").find("input#fly_basket_params").val(), $.proxy(function( data ){
			var small=$('.opener .basket_count').hasClass('small'),
				basket_count=$(data).find('.basket_count').find('.items div').text();
			$('#basket_line .basket_fly').addClass('loaded').html(data);

			if(action=="refresh")
				$('li[data-type=AnDelCanBuy]').trigger('click');


			if(typeof(opener) == 'undefined' || $('#basket_line .basket_fly').hasClass('loading') )
			{
				if(window.matchMedia('(min-width: 769px)').matches)
				{
					if(action=='open')
					{
						if(small)
						{
							if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
							{
								$('.opener .basket_count').click();
							}
						}
						else
						{
							$('.opener .basket_count').removeClass('small')
							$('.tabs_content.basket li[item-section="AnDelCanBuy"]').addClass('cur');
							$('#basket_line ul.tabs li[item-section="AnDelCanBuy"]').addClass('cur');

							$("#basket_line .basket_fly .opener &gt; div:eq(0)").addClass("cur");
						}
					}
					else if(action=='wish')
					{
						if(small)
						{
							if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
								$('.opener .wish_count').click();
						}
						else
						{
							$('.opener .wish_count').removeClass('small')
							$('.tabs_content.basket li[item-section="DelDelCanBuy"]').addClass('cur');
							$('#basket_line ul.tabs li[item-section="DelDelCanBuy"]').addClass('cur');
						}
					}
					else
					{
						if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
						{
							$('.opener .basket_count').click();
						}
					}
				}
			}
		}));
	}
}

if(!funcDefined('basketTop')){
	var basketTop = function basketTop(action, hoverBlock){
		if(action=='reload'){
			if($('.basket_hover_block:hover').length) {
				hoverBlock = $('.basket_hover_block:hover');
			}
		}

		if(action=='open')
		{
			if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
			{
				if($('#headerfixed').hasClass('fixed')) {
					hoverBlock = $('#headerfixed .basket_hover_block');
				} else {
					hoverBlock = $('.top_basket .basket_hover_block');
				}
			}
		}

		if( hoverBlock === undefined ) {
			console.trace();
			return false;
		}

		if(action=='close'){
			if(hoverBlock.length) {
				hoverBlock.css({
					'opacity': '',
					'visibility': ''
				});
				return true;
			}
		}

		hoverBlock.removeClass('loaded');
		var firstTime = hoverBlock.find('div').length ? 'false' : 'true';
		var params = $("#basket_form").find("input#fly_basket_params").val();
		var postData = {
			firstTime: firstTime,
		};
		if(params !== undefined) {
			postData.PARAMS = params;
		}

		$.post( arAsproOptions['SITE_DIR']+"ajax/showBasketHover.php", postData, $.proxy(function( data ){
			var ob = BX.processHTML(data);

			// inject
			$('#headerfixed .basket_hover_block, .top_basket .basket_hover_block').html(ob.HTML);
			BX.ajax.processScripts(ob.SCRIPT);

			if(window.matchMedia('(min-width: 992px)').matches)
			{
				hoverBlock.addClass('loaded');

				if(action=='open')
				{
					if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N')
					{
						if($('#headerfixed').hasClass('fixed')) {
							hoverBlock = $('#headerfixed .basket_hover_block');
						} else {
							hoverBlock = $('.top_basket .basket_hover_block');
						}

						hoverBlock.css({
							'opacity': '1',
							'visibility': 'visible'
						});

						setTimeout(
							function() {
								hoverBlock.css({
									'opacity': '',
									'visibility': ''
								});
							},
							2000
						);
					}
				}
			}

		}));
	}
}

//work with hash start
var lastHash = location.hash;
if("onhashchange" in window)
{
	$(window).bind('hashchange', function() {
		var newHash = location.hash;
		if(newHash == '#delayed')
		{
			if($('#basket_toolbar_button_delayed').length)
				$('#basket_toolbar_button_delayed').trigger('click');
		}
		else
		{
			if($('#basket_toolbar_button').length)
				$('#basket_toolbar_button').trigger('click');
		}
		// Do something
		var diff = compareHash(newHash, lastHash);
		// alert("Difference between old and new hash:\n"+diff[0]+"\n\n"+diff[1]);
		//At the end of the func:
		lastHash = newHash;

		if (lastHash) {
			if ('scrollRestoration' in history) {
				history.scrollRestoration = 'manual';
			}
			if ($('.ordered-block .tabs .nav a[href="'+lastHash+'"]').length) {
				$('.ordered-block .tabs .nav a[href="'+lastHash+'"]').trigger('click');
				var content_offset=$('.ordered-block .tabs').offset();
				$('html, body').animate({scrollTop: content_offset.top-90}, 400);
			}
		}
	});

	function compareHash(current, previous){
		for(var i=0, len=Math.min(current.length, previous.length); i&lt;len; i++){
			if(current.charAt(0) != previous.charAt(0)) break;
		}
		current = current.substr(i);
		previous = previous.substr(i);
		for(var i=0, len=Math.min(current.length, previous.length); i&lt;len; i++){
			if(current.substr(-1) != previous.substr(-1)) break;
		}

		//Array: Current = New hash, previous = old hash
		return [current, previous];
	}
}

$(document).on('click', "#basket_toolbar_button", function(){
	if(lastHash)
		location.hash = 'cart';
})
$(document).on('click', "#basket_toolbar_button_delayed", function(){
	if(lastHash)
		location.hash = 'delayed';
})
if (location.hash) {
	var hash = location.hash


}
//work with hash end

$(document).on('click', "#basket_line .basket_fly .opener &gt; div.clicked", function(){
	if(arAsproOptions['PAGES']['BASKET_PAGE'])
		return;
	function onOpenFlyBasket(_this){
		$("#basket_line .basket_fly .tabs li").removeClass("cur");
		$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
		// $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
		if(!$(_this).is(".wish_count.empty"))
		{
			$("#basket_line .basket_fly .tabs_content li[item-section="+$(_this).data("type")+"]").addClass("cur");
			$("#basket_line .basket_fly .tabs li:eq("+$(_this).index()+")").addClass("cur");
			// $("#basket_line .basket_fly .remove_all_basket."+$(_this).data("type")).addClass("cur");
		}
		else
		{
			$("#basket_line .basket_fly .tabs li").first().addClass("cur").siblings().removeClass("cur");
			$("#basket_line .basket_fly .tabs_content li").first().addClass("cur").siblings().removeClass("cur");
			// $("#basket_line .basket_fly .remove_all_basket").first().addClass("cur");
		}
		$("#basket_line .basket_fly .opener &gt; div.clicked").removeClass('small');

		$("#basket_line .basket_fly .opener &gt; div").siblings().removeClass('cur');
		$("#basket_line .basket_fly .opener &gt; div:eq("+$(_this).index()+")").addClass('cur');

	}

	if(window.matchMedia('(min-width: 769px)').matches)
	{
		var _this = this;

		$(_this).siblings().removeClass('cur');
		$(_this).addClass('cur');

		if(parseInt($("#basket_line .basket_fly").css("right")) &lt; 0)
		{
			$("#basket_line .basket_fly").stop().addClass('loading').animate({"right": "0"}, 333, function(){
				if($(_this).closest('.basket_fly.loaded').length)
				{
					onOpenFlyBasket(_this);
				}
				else
				{
					$.ajax({
						url: arAsproOptions['SITE_DIR'] + 'ajax/basket_fly.php',
						type: 'post',
						success: function(html){
							$('#basket_line .basket_fly').removeClass('loading').addClass('loaded').html(html);
							onOpenFlyBasket(_this);
						}
					});
				}
			});
			$('#basket_line .basket_fly').addClass('swiped');
		}
		else if($(this).is(".wish_count:not(.empty)") &amp;&amp; !$("#basket_line .basket_fly .basket_sort ul.tabs li.cur").is("[item-section=DelDelCanBuy]"))
		{
			$("#basket_line .basket_fly .tabs li").removeClass("cur");
			$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
			// $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
			$("#basket_line .basket_fly .tabs_content li[item-section="+$(this).data("type")+"]").addClass("cur");
			$("#basket_line  .basket_fly .tabs li:eq("+$(this).index()+")").first().addClass("cur");
			// $("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur");
		}
		else if($(this).is(".basket_count") &amp;&amp; $("#basket_line .basket_fly .basket_sort ul.tabs li.cur").length &amp;&amp; !$("#basket_line .basket_fly .basket_sort ul.tabs li.cur").is("[item-section=AnDelCanBuy]"))
		{
			$("#basket_line .basket_fly .tabs li").removeClass("cur");
			$("#basket_line .basket_fly .tabs_content li").removeClass("cur");
			// $("#basket_line .basket_fly .remove_all_basket").removeClass("cur");
			$("#basket_line  .basket_fly .tabs_content li:eq("+$(this).index()+")").addClass("cur");
			$("#basket_line  .basket_fly .tabs li:eq("+$(this).index()+")").first().addClass("cur");
			// $("#basket_line .basket_fly .remove_all_basket."+$(this).data("type")).first().addClass("cur");
		}
		else
		{
			$("#basket_line .basket_fly").stop().animate({"right": -$("#basket_line .basket_fly").outerWidth()}, 150);
			$("#basket_line .basket_fly .opener &gt; div.clicked").addClass('small');
			$('#basket_line .basket_fly').removeClass('swiped');
			$("#basket_line .basket_fly .opener &gt; div").removeClass("cur");
		}
	}
});

if(!funcDefined("clearViewedProduct")){
	function clearViewedProduct(){
		try{
			var siteID = arAsproOptions.SITE_ID;
			var localKey = 'MAX_VIEWED_ITEMS_' + siteID;
			var cookieParams = {path: '/', expires: 30};
			if(typeof BX.localStorage !== 'undefined')
			{
				// remove local storage
				BX.localStorage.set(localKey, {}, 0);
			}
			// remove cookie
			$.removeCookie(localKey, cookieParams);
		}
		catch(e){
			console.error(e);
		}
	}
}

if(!funcDefined("setViewedProduct")){
	function setViewedProduct(id, arData){
		try{

			// save $.cookie option
			var bCookieJson = $.cookie.json;
			$.cookie.json = true;

			var siteID = arAsproOptions.SITE_ID;
			var localKey = 'MAX_VIEWED_ITEMS_' + siteID;
			var cookieParams = {path: '/', expires: 30};

			if((typeof BX.localStorage !== 'undefined') &amp;&amp; (typeof id !== 'undefined') &amp;&amp; (typeof arData !== 'undefined')){
				var PRODUCT_ID = (typeof arData.PRODUCT_ID !== 'undefined') ? arData.PRODUCT_ID : id;
				var arViewedLocal = BX.localStorage.get(localKey) ? BX.localStorage.get(localKey) : {};
				var arViewedCookie = $.cookie(localKey) ? $.cookie(localKey) : {};
				var count = 0;

				// delete some items (sync cookie &amp; local storage)
				for(var _id in arViewedLocal){
					arViewedLocal[_id].IS_LAST = false;
					if(typeof arViewedCookie[_id] === 'undefined'){
						delete arViewedLocal[_id];
					}
				}
				for(var _id in arViewedCookie){
					if(typeof arViewedLocal[_id] === 'undefined'){
						delete arViewedCookie[_id];
					}
				}

				for(var _id in arViewedCookie){
					count++;
				}

				// delete item if other item (offer) of that PRODUCT_ID is exists
				if(typeof arViewedLocal[PRODUCT_ID] !== 'undefined'){
					if(arViewedLocal[PRODUCT_ID].ID != id){
						delete arViewedLocal[PRODUCT_ID];
						delete arViewedCookie[PRODUCT_ID];
					}
				}

				var time = new Date().getTime();
				arData.ID = id;
				arData.ACTIVE_FROM = time;
				arData.IS_LAST = true;
				arViewedLocal[PRODUCT_ID] = arData;
				arViewedCookie[PRODUCT_ID] = [time.toString(), arData.PICTURE_ID];

				$.cookie(localKey, arViewedCookie, cookieParams);
				BX.localStorage.set(localKey, arViewedLocal, 2592000);  // 30 days
			}
		}
		catch(e){
			console.error(e);
		}
		finally{
			// restore $.cookie option
			$.cookie.json = bCookieJson;
		}
	}
}



if(!funcDefined('initSelects')){
	function initSelects(target){
		var iOS = ( navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false );
		if ( iOS ) return;
		if($("#bx-soa-order").length)
			return;
		// SELECT STYLING
		$(target).find('.wrapper1 select:visible').ikSelect({
			syntax: '&lt;div class="ik_select_link"&gt; \
						&lt;span class="ik_select_link_text"&gt;&lt;/span&gt; \
						&lt;div class="trigger"&gt;&lt;/div&gt; \
					&lt;/div&gt; \
					&lt;div class="ik_select_dropdown"&gt; \
						&lt;div class="ik_select_list"&gt; \
						&lt;/div&gt; \
					&lt;/div&gt;',
			dynamicWidth: true,
			ddMaxHeight: 112,
			customClass: 'common_select',
			//equalWidths: true,
			onShow: function(inst){
				inst.$dropdown.css('top', (parseFloat(inst.$dropdown.css('top'))-5)+'px');
				if ( inst.$dropdown.outerWidth() &lt; inst.$link.outerWidth() ){
					inst.$dropdown.css('width', inst.$link.outerWidth());
				}
				if ( inst.$dropdown.outerWidth() &gt; inst.$link.outerWidth() ){
					inst.$dropdown.css('width', inst.$link.outerWidth());
				}
				var count=0,
					client_height=0;
				inst.$dropdown.css('left', inst.$link.offset().left);
				$(inst.$listInnerUl).find('li').each(function(){
					if(!$(this).hasClass('ik_select_option_disabled')){
						++count;
						client_height+=$(this).outerHeight();
					}
				})
				if(client_height&lt;112){
					inst.$listInner.css('height', 'auto');
				}else{
					inst.$listInner.css('height', '112px');
				}
				inst.$link.addClass('opened');
				inst.$listInner.addClass('scroller');
				if($('.confirm_region').length)
					$('.confirm_region').remove();
			},
			onHide: function(inst){
				inst.$link.removeClass('opened');
			}
		});
		// END OF SELECT STYLING

		var timeout;
		$(window).on('resize', function(){
			ignoreResize.push(true);
				clearTimeout(timeout);
				timeout = setTimeout(function(){
					//$('select:visible').ikSelect('redraw');
					var inst='';
					if(inst=$('.common_select-link.opened + select').ikSelect().data('plugin_ikSelect')){
						inst.$dropdown.css('left', inst.$link.offset().left+'px');
					}
				}, 20);
			ignoreResize.pop();
		});
	}
}

if(!funcDefined('CheckTopMenuFullCatalogSubmenu')){
	CheckTopMenuFullCatalogSubmenu = function(){
		if(arAsproOptions['THEME'] &amp;&amp; arAsproOptions['THEME']['MENU_TYPE_VIEW'] != 'HOVER')
			return;

		var $menu = $('.left_block .menu_top_block');
		if($menu.length)
		{
			var $wrapmenu = $menu.parents('.wrap_menu');

			var wrapMenuWidth = $menu.closest('.wrapper_inner').actual('width');
			if(!wrapMenuWidth)
				wrapMenuWidth = $menu.closest('.wraps').actual('width');

			var bCatalogFirst = $menu.hasClass('catalogfirst');
			var findMenuLi = $('.left_block .menu_top_block:visible li.full');
			var parentSubmenuWidth = $menu.actual('outerWidth');
			var wrapMenuLeft = 0;
			var wrapMenuRight = 0;

			if($wrapmenu.length)
			{
				wrapMenuWidth = $wrapmenu.actual('outerWidth');
				wrapMenuLeft = $wrapmenu.offset().left;
				wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
			}

			if($('.left_block .catalog_block.menu_top_block').length){
				if($('.left_block .catalog_block.menu_top_block').is(':visible'))
					findMenuLi=$('.left_block .menu_top_block.catalog_block li.full');
			}
			findMenuLi.each(function(){
				var $this = $(this);
				var $submenu = $this.find('&gt;.dropdown');

				if($submenu.length){
					// $submenu.css({left: parentSubmenuWidth + 'px', width: (wrapMenuWidth - parentSubmenuWidth) + 'px', 'padding-left': '0px', 'padding-right': '0px', 'opacity': 1});
					$submenu.css({width: (wrapMenuWidth - parentSubmenuWidth) + 'px'});

					if(!isOnceInited &amp;&amp; arAsproOptions["THEME"]["MENU_POSITION"] == "TOP"){
						$this.on('mouseenter', function(){
							$submenu.css('min-height', $this.closest('.dropdown').actual('outerHeight') + 'px');
						});
					}
				}
			});
		}
	}
}

$.fn.getMaxHeights = function( outer, classNull, minHeight ){
	var maxHeight = this.map( function( i, e ){
		var calc_height=0;
		$(e).css('height', '');

		if( outer == true )
			calc_height=$(e).actual('outerHeight');
		else
			calc_height=$(e).actual('height');

		return calc_height;
	}).get();
	for(var i = 0, c = maxHeight.length; i &lt; c; ++i)
	{
		if(maxHeight[i] % 2)
			--maxHeight[i];
	}
	return Math.max.apply( this, maxHeight );
}

$.fn.equalizeHeights = function( outer, classNull, options ){
	var maxHeight = [];
	var items = [];

	for (var i = 0, itemKey = 0; i &lt; this.length; itemKey++) {
		var item = this[itemKey],
			_item = $(item),
			minus_height=0,
			calc_height=0;

		i++;

		if(options.blockNull !== undefined) {
			if(options.blockNull.class !== undefined) {
				if(_item.hasClass(options.blockNull.class) || _item.closest('.'+options.blockNull.class).length) {
					continue;
				}
			}
		}

		items.push(this[itemKey]);

		if(classNull!==false)
		{
			if(!isMobile) {
				var nulled = _item.find(classNull);
				if(nulled.length) {
					minus_height=parseInt(nulled[0].offsetHeight);
					//minus_height=parseInt(_item.find(classNull).outerHeight(false));
					//minus_height=parseInt(_item.find(classNull).actual('outerHeight'));
				}
			}
		}

		if(minus_height)
			minus_height+=12;

		_item.css('height', '');

		calc_height=item.offsetHeight-minus_height;

		if(options.minHeight!==false)
		{
			if(calc_height&lt;options.minHeight)
				calc_height+=(options.minHeight-calc_height);

			if(window.matchMedia('(max-width: 520px)').matches)
				calc_height=300;

			if(window.matchMedia('(max-width: 400px)').matches)
				calc_height=200;

		}

		if(!calc_height)
			calc_height = 0;

		maxHeight.push(calc_height);
	}

	for(var i = 0, c = maxHeight.length; i &lt; c; ++i){
		if(maxHeight[i] % 2){
			--maxHeight[i];
		}
	}

	var result = $(items).height( Math.max.apply( this, maxHeight ) );

	return result;
}

$.fn.getFloatWidth = function(){
	var width = 0;
	if($(this).length){
		var rect = $(this)[0].getBoundingClientRect();
		if(!(width = rect.width))
			width = rect.right - rect.left;
	}

	$(this).data('floatWidth', width);

	return width;
}

function extendDepthObject(target, FromObj) {
	var to = Object.assign({}, target);
	for(var key in FromObj)
	{
		if( typeof(FromObj[key]) == 'object' ) {
			to[key] = extendDepthObject(to[key], FromObj[key]);
		} else {
			to[key] = FromObj[key];
		}
	}

	return to;
}

$.fn.sliceHeight = function( options ){
	function _slice(el){
		var arBreakpoints = Object.keys(options.breakpoint);
		var resizeOptionsTmp = {};
		if(arBreakpoints.length)
		{
			for(var key in arBreakpoints)
			{
				if(window.matchMedia(arBreakpoints[key].toString()).matches)
				{
					resizeOptionsTmp = options.breakpoint[arBreakpoints[key]];
				}
			}
		}

		var resizeOptions = extendDepthObject(options, resizeOptionsTmp);

		var blockNullClass = resizeOptions.blockNull !== undefined &amp;&amp; resizeOptions.blockNull.class !== undefined ? resizeOptions.blockNull.class : false;
		var parent = (typeof(resizeOptions.row) !== 'undefined' &amp;&amp; resizeOptions.row.length) ?  el.first().parents(resizeOptions.row) : el.first().parents('.items');
		var item = '';

		if(typeof(resizeOptions.item) !== 'undefined' &amp;&amp; resizeOptions.item.length) {
			if(blockNullClass) {
				$(resizeOptions.item).each(function(i, element){
					_element = $(element);
					if(!_element.hasClass(blockNullClass)) {
						item = _element;
					}
				});
				if(!item) // if only ignored blocks
					return false;
			} else {
				item = $(resizeOptions.item).first();
			}
		} else {
			if( el.first().hasClass('item') ) {
				item = el.first();
			} else {
				item = el.first().parents('.item');
			}
		}

		if(typeof(resizeOptions.autoslicecount) == 'undefined' || resizeOptions.autoslicecount !== false){
			var elsw = parent.getFloatWidth(),
				elw = item.getFloatWidth();
			if(!elsw){
				elsw = el.first().parents('.row').getFloatWidth();
			}
			if(!elw)
			{
				if(typeof(resizeOptions.item) !== 'undefined' &amp;&amp; resizeOptions.item.length)
					elw = (($(resizeOptions.item+':eq(1)').getFloatWidth()) ? $(resizeOptions.item+':eq(1)').getFloatWidth() : $(resizeOptions.item+':eq(2)').getFloatWidth());
				else
					elw = (($(el[1]).getFloatWidth()) ? $(el[1]).getFloatWidth() : $(el[2]).getFloatWidth());
			}
			if(elw &amp;&amp; resizeOptions.fixWidth)
				elw -= resizeOptions.fixWidth;

			elw = (parseInt(elw * 100)) / 100;

			if(elsw &amp;&amp; elw){
				resizeOptions.slice = Math.floor(elsw / elw);
			}
		}

		if(resizeOptions.customSlice) //manual slice count
		{
			var bSliceNext = false;
			if(resizeOptions.length)
			{
				elw=(typeof(resizeOptions.item) !== 'undefined' &amp;&amp; resizeOptions.item.length) ? $(resizeOptions.item).last().getFloatWidth() : (el.last().hasClass('item') ? el.last().getFloatWidth() : el.last().parents('.item').getFloatWidth());
				if(elw)
					resizeOptions.sliceNext = Math.floor(elsw / elw);

				bSliceNext = true;
			}
		}

		elements = [];
		if(resizeOptions.classes !== undefined &amp;&amp; resizeOptions.classes.length) {
			for(var i = 0;i &lt; resizeOptions.classes.length;i++) {
				var items = $(resizeOptions.item).find(resizeOptions.classes[i]);
				elements.push( items );
			}
		}
		var elIndex = elements.push(el) - 1;

		if(resizeOptions.mobile == true)
		{
			if(window.matchMedia('(max-width: 500px)').matches) {
				for(var block = 0; block &lt; elements.length; block++){
					var items = $(elements[block]);
					items.css({
						'line-height': '',
						'height': '',
					});
				}
				return;
			}
		}

		if(typeof(resizeOptions.typeResize) == 'undefined' || resizeOptions.typeResize == false)
		{
			if(resizeOptions.slice){
				for(var block = 0; block &lt; elements.length; block++){
					if(resizeOptions.currentRow) {
						var itemNumber = el.index(resizeOptions.currentItem);
						var rowCount = resizeOptions.slice;
						var rowNumber = Math.floor(itemNumber / rowCount);

						var items = $(elements[block].slice(rowNumber * rowCount, rowNumber * rowCount + rowCount));
						var classNull = block == elIndex ? resizeOptions.classNull : false;
						items.css({
							'line-height': '',
							'height': '',
						});
						items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions);
					} else {
						for(var i = 0; i &lt; elements[block].length; ){
							if(resizeOptions.customSlice &amp;&amp; resizeOptions.sliceNext &amp;&amp; bSliceNext &amp;&amp; i) //manual slice count
								resizeOptions.slice = resizeOptions.sliceNext;

							var slice = resizeOptions.slice;
							var items = $(elements[block].slice(i, i + slice));
							if(resizeOptions.blockNull !== undefined) {
								if(resizeOptions.blockNull.class !== undefined) {
									var counts = 0;
									items.each(function(i, item) {
										var _item = $(item);
										if(_item.hasClass(resizeOptions.blockNull.class) || _item.closest('.'+resizeOptions.blockNull.class).length) {
											counts++;
										}
									});
								}
							}
							if(counts) {
								slice -= ( resizeOptions.blockNull.width - 1 ) * counts;
							}

							items = $(elements[block].slice(i, i + slice));
							if(items) {
								var classNull = block == elIndex ? resizeOptions.classNull : false;

								items.css({
									'line-height': '',
									'height': '',
								});
								items.equalizeHeights(resizeOptions.outer, classNull, resizeOptions);
							}
							i += slice || 1;
						}
					}

				}
			}
			if(resizeOptions.lineheight){
				var lineheightAdd = parseInt(resizeOptions.lineheight);
				if(isNaN(lineheightAdd)){
					lineheightAdd = 0;
				}
				el.each(function() {
					$(this).css('line-height', ($(this).actual('height') + lineheightAdd) + 'px');
				});
			}
		}
	}
	var options = $.extend({
		slice: null,
		sliceNext: null,
		outer: false,
		lineheight: false,
		autoslicecount: true,
		classNull: false,
		minHeight: false,
		row:false,
		item:false,
		typeResize:false,
		typeValue:false,
		fixWidth:0,
		resize:true,
		mobile:false,
		customSlice:false,
		breakpoint:{},
		classes: [],
	}, options);

	var el = $(this);

	ignoreResize.push(true);
	_slice(el);
	ignoreResize.pop();

	if(options.resize)
	{
		BX.addCustomEvent('onWindowResize', function(eventdata) {
			try{
				ignoreResize.push(true);
				_slice(el);
			}
			catch(e){}
			finally{
				ignoreResize.pop();
			}
		});
	}
	else
	{
		if(!ignoreResize.length)
		{
			// ignoreResize.push(true);
			_slice(el);
			// ignoreResize.pop();
		}
	}
}

$.fn.sliceHeightNoResize = function( options ){
	function _slice(el){
		el.each(function() {
			$(this).css('line-height', '');
			$(this).css('height', '');
		});
		if(options.mobile == true)
		{
			if(window.matchMedia('(max-width: 550px)').matches)
				return;
		}
		if(typeof(options.autoslicecount) == 'undefined' || options.autoslicecount !== false){
			var elsw=(typeof(options.row) !== 'undefined' &amp;&amp; options.row.length) ?  el.first().parents(options.row).getFloatWidth() : el.first().parents('.items').getFloatWidth(),
				elw=(typeof(options.item) !== 'undefined' &amp;&amp; options.item.length) ? $(options.item).first().getFloatWidth() : (el.first().hasClass('item') ? el.first().getFloatWidth() : el.first().parents('.item').getFloatWidth());

			if(!elsw){
				elsw = el.first().parents('.row').getFloatWidth();
			}
			if(elw &amp;&amp; options.fixWidth)
				elw -= options.fixWidth;

			if(elsw &amp;&amp; elw){
				options.slice = Math.floor(elsw / elw);
			}
		}
		if(options.customSlice) //manual slice count
		{
			var arBreakpoints = Object.keys(options.breakpoint),
				bSliceNext = false;
			if(arBreakpoints.length)
			{
				elw=(typeof(options.item) !== 'undefined' &amp;&amp; options.item.length) ? $(options.item).last().getFloatWidth() : (el.last().hasClass('item') ? el.last().getFloatWidth() : el.last().parents('.item').getFloatWidth());
				if(elw)
					options.sliceNext = Math.floor(elsw / elw);
				for(var key in arBreakpoints)
				{
					if(window.matchMedia(arBreakpoints[key].toString()).matches)
					{
						bSliceNext = true;
						options.slice = options.breakpoint[arBreakpoints[key]];
					}
				}
			}
		}
		if(typeof(options.typeResize) == 'undefined' || options.typeResize == false)
		{
			if(options.slice){
				for(var i = 0; i &lt; el.length; i += options.slice){
					if(options.customSlice &amp;&amp; options.sliceNext &amp;&amp; bSliceNext &amp;&amp; i) //manual slice count
						options.slice = options.sliceNext;
					$(el.slice(i, i + options.slice)).equalizeHeights(options.outer, options.classNull, options.minHeight, options.typeResize, options.typeValue);
				}
			}
			if(options.lineheight){
				var lineheightAdd = parseInt(options.lineheight);
				if(isNaN(lineheightAdd)){
					lineheightAdd = 0;
				}
				el.each(function() {
					$(this).css('line-height', ($(this).actual('height') + lineheightAdd) + 'px');
				});
			}
		}
	}
	var options = $.extend({
		slice: null,
		sliceNext: null,
		outer: false,
		lineheight: false,
		autoslicecount: true,
		classNull: false,
		minHeight: false,
		row:false,
		item:false,
		typeResize:false,
		typeValue:false,
		fixWidth:0,
		resize:true,
		mobile:false,
		customSlice:false,
		breakpoint:{},
	}, options);

	var el = $(this);

	ignoreResize.push(true);
	_slice(el);
	ignoreResize.pop();
}

if(!funcDefined('initHoverBlock')){
	function initHoverBlock(target){
		/*$(target).find('.catalog_item.item_wrap').on('mouseenter', function(){
			$(this).addClass('hover');
		})
		$(target).find('.catalog_item.item_wrap').on('mouseleave', function(){
			$(this).removeClass('hover');
		})*/
	}
}
if(!funcDefined('setStatusButton')){
	function setStatusButton(){
		if(!funcDefined('setItemButtonStatus')){
			setItemButtonStatus = function(data){
				if(data.BASKET){
					for( var i in data.BASKET ){
						var id = data.BASKET[i];
						if(typeof id === 'number' || typeof id === 'string'){
							$('.to-cart[data-item='+id+']').hide();
							$('.counter_block[data-item='+id+']').closest('.counter_block_inner').hide();
							$('.counter_block[data-item='+id+']').hide();
							$('.in-cart[data-item='+id+']').show();
							$('.in-cart[data-item='+id+']').closest('.button_block').addClass('wide');
						}
					}
				}
				if(data.DELAY){
					for( var i in data.DELAY ){
						var id = data.DELAY[i];
						if(typeof id === 'number' || typeof id === 'string'){
							$('.wish_item.to[data-item='+id+']').hide();
							$('.wish_item.in[data-item='+id+']').show();
							if ($('.wish_item[data-item='+id+']').find(".value.added").length) {
								//$('.wish_item[data-item='+id+']').addClass("added");
								$('.wish_item[data-item='+id+']').find(".value").hide();
								$('.wish_item[data-item='+id+']').find(".value.added").show();
							}
						}
					}
				}
				if(data.SUBSCRIBE){
					for( var i in data.SUBSCRIBE ){
						var id = data.SUBSCRIBE[i];
						if(typeof id === 'number' || typeof id === 'string'){
							$('.to-subscribe[data-item='+id+']').hide();
							$('.in-subscribe[data-item='+id+']').show();
						}
					}
				}
				if(data.COMPARE){
					for( var i in data.COMPARE ){
						var id = data.COMPARE[i];
						if(typeof id === 'number' || typeof id === 'string'){
							$('.compare_item.to[data-item='+id+']').hide();
							$('.compare_item.in[data-item='+id+']').show();
							if ($('.compare_item[data-item='+id+']').find(".value.added").length){
								$('.compare_item[data-item='+id+']').find(".value").hide();
								$('.compare_item[data-item='+id+']').find(".value.added").show();
							}
						}
					}
				}
			}
		}
		if(!Object.keys(arStatusBasketAspro).length)
		{
			if(typeof arAsproOptions === 'undefined')
			{
				var arAsproOptions = ({
					"SITE_DIR" : '/'
				});
				if($('body').data('site') !== undefined)
					arAsproOptions["SITE_DIR"] = $('body').data('site');
			}
			$.ajax({
				url: arAsproOptions["SITE_DIR"]+'ajax/getAjaxBasket.php',
				type: 'POST',
				success: function(data){
					arStatusBasketAspro = data;
					setItemButtonStatus(arStatusBasketAspro);
				}
			});
		}
		else
			setItemButtonStatus(arStatusBasketAspro);
	}
}


if(!funcDefined('onLoadjqm')){
	var onLoadjqm = function(name, hash, requestData, selector, requestTitle, isButton, thButton){
		if( hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined &amp;&amp; !hash.c.noOverlay) ) {
			$('body').addClass('jqm-initied');
		}
		if(window.matchMedia('(min-width: 768px)').matches)
		{
			$("body").addClass("swipeignore");
		}

		if(typeof $(hash.t).data('ls') !==' undefined' &amp;&amp; $(hash.t).data('ls'))
		{
			var ls = $(hash.t).data('ls'),
				ls_timeout = 0,
				v = '';

			if($(hash.t).data('ls_timeout'))
				ls_timeout = $(hash.t).data('ls_timeout');

			ls_timeout = ls_timeout ? Date.now() + (ls_timeout*1000) : '';

			if(typeof localStorage !== 'undefined')
			{
				var val = localStorage.getItem(ls);
				try{
					v = JSON.parse(val);
				}
				catch(e){
					v = val
				}
				if(v!= null)
				{
					localStorage.removeItem(ls);
				}
				v={};
				v['VALUE'] = 'Y';
				v['TIMESTAMP'] = ls_timeout; // default: seconds for 1 day

				localStorage.setItem(ls, JSON.stringify(v));
			}
			else
			{
				var val = $.cookie(ls);
				if(!val)
					$.cookie(ls, "Y", {expires: ls_timeout});// default: seconds for 1 day
			}

			var dopClasses = hash.w.find('.marketing-popup').data('classes');
			if(dopClasses) {
				hash.w.addClass(dopClasses);
			}
		}

		$.each($(hash.t).get(0).attributes, function(index, attr){
			if(/^data\-autoload\-(.+)$/.test(attr.nodeName)){
				var key = attr.nodeName.match(/^data\-autoload\-(.+)$/)[1];
				var el = $('input[data-sid="'+key.toUpperCase()+'"]');
				el.val(BX.util.htmlspecialcharsback($(hash.t).data('autoload-'+key))).attr('readonly', 'readonly');
				el.closest('.form-group').addClass('input-filed');
				el.attr('title', el.val());
			}
		});

		//show gift block
		if(hash.w.hasClass('send_gift_frame'))
		{
			var imgHtml = priceHtml = propsHtml = '';
			if($('.offers_img a').length)
				imgHtml = $('.offers_img a').html();
			else if($('.product-detail-gallery__container').length)
				imgHtml = '&lt;img src='+$('.product-detail-gallery__container link[itemprop="image"]').attr('href')+' /&gt;';

			if($('.product-container *[itemprop="offers"]').length) //show price
			{
				if($('.sku-view').length)
				{
					if($('.prices_block .price').length)
						priceHtml = $('.prices_block .cost.prices').html().replace('id', 'data-id');
				}
				else
				{
					if($('.prices_block .js_price_wrapper').length)
						priceHtml = '&lt;div class="with_matrix"&gt;'+$('.prices_block .js_price_wrapper').html()+'&lt;/div&gt;';
					else if($('.prices_block .with_matrix').length)
						priceHtml = '&lt;div class="with_matrix"&gt;'+$('.prices_block .with_matrix').html()+'&lt;/div&gt;';
					else if($('.prices_block .price_group.min').length)
						priceHtml = $('.prices_block .price_group.min').html();
					else if($('.prices_block .price_matrix_wrapper').length)
						priceHtml = $('.prices_block .price_matrix_wrapper').html();
				}
			}

			if($('.buy_block .sku_props').length)
			{
				propsHtml = '&lt;div class="props_item"&gt;';
				$('.buy_block .sku_props .bx_catalog_item_scu &gt; div').each(function(){
					var title = $(this).find('.bx_item_section_name &gt; span').html();
					var props = '';
					var ikSelect = $(this).find('.ik_select_link_text');
					if( ikSelect.length ) {
						props = ikSelect.text();
					} else {
						var activeSku = $(this).find('ul li.active');
						var isPicture = activeSku.find(' &gt; i');
						if( isPicture.length &amp;&amp; isPicture.attr('title') ) {
							var propTitle = isPicture.attr('title').split(':');
							if(propTitle.length) {
								propTitle = propTitle[1].trim();
							} else {
								propTitle = isPicture.attr('title');
							}
							props = propTitle;
						} else {
							props = activeSku.find(' &gt; span').text();
						}
					}

					propsHtml += '&lt;div class="prop_item"&gt;'+
									'&lt;span&gt;'+
										title + '&lt;span class="val"&gt;'+props+'&lt;/span&gt;' +
									'&lt;/span&gt;'+
								'&lt;/div&gt;';

				})
				propsHtml += '&lt;/div&gt;';
			}
			$('&lt;div class="custom_block"&gt;'+
				'&lt;div class="title"&gt;'+BX.message('POPUP_GIFT_TEXT')+'&lt;/div&gt;'+
				'&lt;div class="item_block"&gt;'+
					'&lt;table class="item_list"&gt;&lt;tr&gt;'+
						'&lt;td class="image"&gt;'+
							'&lt;div&gt;'+imgHtml+'&lt;/div&gt;'+
						'&lt;/td&gt;'+
						'&lt;td class="text"&gt;'+
							'&lt;div class="name"&gt;'+$('h1').text()+'&lt;/div&gt;'+
							priceHtml+
							propsHtml+
						'&lt;/td&gt;'+
					'&lt;/tr&gt;&lt;/table&gt;'+
				'&lt;/div&gt;'+
				'&lt;/div&gt;').prependTo(hash.w.find('.form_body'))
		}

		if(arAsproOptions['THEME']['REGIONALITY_SEARCH_ROW'] == 'Y' &amp;&amp; (hash.w.hasClass('city_chooser_frame ') || hash.w.hasClass('city_chooser_small_frame')))
			hash.w.addClass('small_popup_regions');

		if( hash.w.hasClass('city_chooser_frame ') || hash.w.hasClass('city_chooser_small_frame ') ) {
			$('.popup_regions .items .items_block').mCustomScrollbar({
				mouseWheel: {
					scrollAmount: 150,
					preventDefault: true
				}
			});
		}


		if( name == 'fast_view' &amp;&amp; $('.smart-filter-filter').length) {
			var navButtons = '&lt;div class="navigation-wrapper-fast-view"&gt;'+
				'&lt;div class="fast-view-nav prev colored_theme_hover_bg" data-fast-nav="prev"&gt;'+
					'&lt;i class="svg left"&gt;'+
						'&lt;svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"&gt;&lt;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)"/&gt;&lt;/svg&gt;'+
					'&lt;/i&gt;'+
				'&lt;/div&gt;'+

				'&lt;div class="fast-view-nav next colored_theme_hover_bg" data-fast-nav="next"&gt;'+
					'&lt;i class="svg right"&gt;'+
						'&lt;svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"&gt;&lt;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)"/&gt;&lt;/svg&gt;'+
					'&lt;/i&gt;'+
				'&lt;/div&gt;'+
			'&lt;/div&gt;';

			hash.w.closest('#popup_iframe_wrapper').append(navButtons);
		}

		hash.w.addClass('show').css({
			// 'top': (($(window).height() &gt; hash.w.height()) ? Math.floor(($(window).height() - hash.w.height()) / 2) : 0) + 'px',
			// 'margin-left': ($(window).width() &gt; hash.w.outerWidth() ? '-' + hash.w.outerWidth() / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
			'opacity': 1
		});

		hash.w.mCustomScrollbar({
			mouseWheel: {
				scrollAmount: 150,
				preventDefault: true
			}
		});

		if(hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined &amp;&amp; !hash.c.noOverlay)) {
			$('body').css({'overflow': 'hidden','height': '100vh'});
			hash.w.closest('#popup_iframe_wrapper').css({'z-index': 3000, 'display': 'flex'});
		}

		var eventdata = {action:'loadForm'};
		BX.onCustomEvent('onCompleteAction', [eventdata, $(hash.t)[0]]);


		if(typeof(requestData) == 'undefined'){
			requestData = '';
		}
		if(typeof(selector) == 'undefined'){
			selector = false;
		}

		var width = $('.'+name+'_frame').width();
		//$('.'+name+'_frame').css('margin-left', '-'+width/2+'px');

		if(name=='order-popup-call') {
		}
		else if(name=='order-button') {
			$(".order-button_frame").find("div[product_name]").find("input").val(hash.t.title).attr("readonly", "readonly").css({"overflow": "hidden", "text-overflow": "ellipsis"});
		}
		else if(name=='basket_error')
		{
			$(".basket_error_frame .pop-up-title").text(requestTitle);
			$(".basket_error_frame .ajax_text").html(requestData);

			if(window.matchMedia('(max-width: 991px)').matches)
			{
				$("body").addClass("all_viewed");
			}

			initSelects(document);
			if(isButton=="Y" &amp;&amp; thButton)
				$("&lt;div class='popup_button_basket_wr'&gt;&lt;span class='popup_button_basket big_btn button' data-item="+thButton.data("item")+"&gt;&lt;span class='btn btn-default'&gt;"+BX.message("ERROR_BASKET_BUTTON")+"&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;").insertAfter($(".basket_error_frame .ajax_text"));
		}

		$('.'+name+'_frame').show();
	}
}

if(!funcDefined('onHidejqm')){
	var onHidejqm = function(name, hash){
		if (hash.w.find('.one_click_buy_result_success').is(':visible') &amp;&amp; name=="one_click_buy_basket") {
			window.location.href = window.location.href;
		}

		if($('.xzoom-source').length)
			$('.xzoom-source').remove();
		if($('.xzoom-preview').length)
			$('.xzoom-preview').remove();

		// hash.w.css('opacity', 0).hide();
		hash.w.animate({'opacity': 0}, 200, function(){
			hash.w.removeClass('scroll-init').mCustomScrollbar('destroy');
			hash.w.hide();
			hash.w.empty();
			hash.o.remove();
			hash.w.removeClass('show');

			$('body').css({'overflow': '','height': ''});

			if(!hash.w.closest('#popup_iframe_wrapper').find('.jqmOverlay').length) {
				hash.w.closest('#popup_iframe_wrapper').css({'z-index': '', 'display': ''});
			}

			if(window.matchMedia('(max-width: 991px)').matches)
			{
				$("body").removeClass("all_viewed");
			}
			if(!$('.jqmOverlay:not(.mobp)').length || $('.jqmOverlay.waiting').length)
			{
				$('body').removeClass('jqm-initied');
			}

			if(window.matchMedia('(min-width: 768px)').matches)
			{
				$("body").removeClass("swipeignore");
			}

			if(name == 'fast_view') {
				$('.fast_view_popup').remove();

				var navButtons = hash.w.closest('#popup_iframe_wrapper').find('.navigation-wrapper-fast-view');
				navButtons.remove();
			}
		});

		window.b24form = false;
	}
}

$.fn.jqmEx = function(){
	// $(this).each(function(){
		var _this = $(this);
		var name = _this.data('name');

		if(name.length &amp;&amp; _this.attr('disabled') != 'disabled'){
			var extClass = '',
				paramsStr = '',
				trigger = '',
				arTriggerAttrs = {};

			// call counter
			if(typeof $.fn.jqmEx.counter === 'undefined'){
				$.fn.jqmEx.counter = 0;
			}
			else{
				++$.fn.jqmEx.counter;
			}

			// trigger attrs and params
			$.each(_this.get(0).attributes, function(index, attr){
				var attrName = attr.nodeName;
				var attrValue = _this.attr(attrName);
				if (attrName !== 'onclick') {
					trigger += '[' + attrName + '=\"' + attrValue + '\"]';
					arTriggerAttrs[attrName] = attrValue;
				}
				if(/^data\-param\-(.+)$/.test(attrName)){
					var key = attrName.match(/^data\-param\-(.+)$/)[1];
					paramsStr += key + '=' + attrValue + '&amp;';
				}
			});
			var triggerAttrs = JSON.stringify(arTriggerAttrs);
			var encTriggerAttrs = encodeURIComponent(triggerAttrs);

			// popup url
			var script = arAsproOptions['SITE_DIR'] + 'ajax/form.php';
			if(name == 'auth'){
				script += '?' + paramsStr + 'auth=Y';
			}
			else{
				script += '?' + paramsStr + 'data-trigger=' + encTriggerAttrs;
			}

			// ext frame class
			if(_this.closest('#fast_view_item').length){
				extClass = 'fast_view_popup';
			}

			// use overlay?
			var noOverlay = _this.data('noOverlay') == 'Y';

			// unique frame to each trigger
			if(noOverlay) {
				var frame = $('&lt;div class="' + name + '_frame ' + extClass + ' jqmWindow popup" data-popup="' + $.fn.jqmEx.counter + '" data-trigger="' + encTriggerAttrs + '"&gt;&lt;/div&gt;').appendTo('body');
			}
			else{
				var frame = $('&lt;div class="' + name + '_frame ' + extClass + ' jqmWindow popup" data-popup="' + $.fn.jqmEx.counter + '" data-trigger="' + encTriggerAttrs + '"&gt;&lt;/div&gt;').appendTo('#popup_iframe_wrapper');
			}

			frame.jqm({
				ajax: script,
				trigger: trigger,
				noOverlay: noOverlay,
				onLoad: function(hash){
					onLoadjqm(name, hash);
				},
				onHide: function(hash){
					onHidejqm(name, hash);
				}
			});
		}
	// });
}

window.addEventListener("keydown", function(e){
    if (e.keyCode == 27) {
        $('.jqm-init.show').last().jqmHide();

        if($('.inline-search-block.show').length) {

        	$('.inline-search-block').toggleClass('show');
        	$('.jqmOverlay.search').detach();
        }

        $('.mega_fixed_menu').fadeOut(animationTime);
    }
});

if(!funcDefined("scroll_block")) {
	function scroll_block(block, clickedItem){
		if(block.length)
		{

			if(clickedItem !== undefined &amp;&amp; clickedItem.length)
			{
				clickedItem.trigger('click');
			}
			else
			{
				$(".prices_tab").addClass("active").siblings().removeClass("active");
				if($(".prices_tab .opener").length &amp;&amp; !$(".prices_tab .opener .opened").length){
					var item = $(".prices_tab .opener").first();
					item.find(".opener_icon").addClass("opened");
					item.parents("tr").addClass("nb")
					item.parents("tr").next(".offer_stores").find(".stores_block_wrap").slideDown(200);
				}
			}
			var topPos = block.offset().top,
				headerH = $('header').outerHeight(true,true);

			$('html,body').animate({'scrollTop':topPos-88},150);
		}
	}
}

if(!funcDefined("jqmEd")) {
	var jqmEd = function (name, form_id, open_trigger, requestData, selector, requestTitle, isButton, thButton){
		if(typeof(requestData) == "undefined"){
			requestData = '';
		}
		if(typeof(selector) == "undefined"){
			selector = false;
		}
		$('body #popup_iframe_wrapper').find('.'+name+'_frame').remove();
		$('body #popup_iframe_wrapper').append('&lt;div class="'+name+'_frame jqmWindow popup"&gt;&lt;/div&gt;');
		if(typeof open_trigger == "undefined" ){
			$('.'+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 ? '&amp;' + requestData : '')});
		}else{
			if(name == 'enter'){
				$('.'+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/auth.php'});
			}else if(name=='basket_error'){
				$('.'+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'});

			}else{
				$('.'+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 ? '&amp;' + requestData : '')});
			}
			$(open_trigger).dblclick(function(){return false;})
		}
		return true;
	}
}

if (!funcDefined("replaceBasketPopup")){
	function replaceBasketPopup (hash){
		if(typeof hash != "undefined"){
			hash.w.hide();
			hash.o.hide();
		}
	}
}

if(!funcDefined("waitLayer")){
	function waitLayer(delay, callback){
		if((typeof dataLayer !== 'undefined') &amp;&amp; (typeof callback === 'function')){
			callback();
		}
		else{
			setTimeout(function() {
				waitLayer(delay, callback);
			}, delay);
		}
	}
}

if(!funcDefined("checkCounters")){
	function checkCounters(name){
		if(typeof name !== "undefined"){
			if(name == "google" &amp;&amp; (arAsproOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" &amp;&amp; arAsproOptions["COUNTERS"]["GOOGLE_COUNTER"] &gt; 0)){
				return true;
			}
			else if(name == "yandex" &amp;&amp; (arAsproOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" &amp;&amp; arAsproOptions["COUNTERS"]["YANDEX_COUNTER"] &gt; 0)){
				return true;
			}
			else{
				return false;
			}
		}
		else if((arAsproOptions["COUNTERS"]["YANDEX_ECOMERCE"] == "Y" &amp;&amp; arAsproOptions["COUNTERS"]["YANDEX_COUNTER"] &gt; 0) || (arAsproOptions["COUNTERS"]["GOOGLE_ECOMERCE"] == "Y" &amp;&amp; arAsproOptions["COUNTERS"]["GOOGLE_COUNTER"] &gt; 0)) {
			return true;
		}
		else{
			return false;
		}
	}
}

if(!funcDefined("addBasketCounter")){
	function addBasketCounter(id){
		if(arAsproOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N'){
			var eventdata = {goal: 'goal_basket_add', params: {id: id}};
			BX.onCustomEvent('onCounterGoals', [eventdata]);
		}
		if(checkCounters()){
			$.ajax({
				url:arAsproOptions['SITE_DIR'] + "ajax/goals.php",
				dataType: "json",
				type: "POST",
				data: {"ID": id},
				success: function(item){
					if(!!item &amp;&amp; !!item.ID){
						waitLayer(100, function() {
							dataLayer.push({
								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['ADD2BASKET'],
							    "ecommerce": {
							    	"currencyCode": item.CURRENCY,
							        "add": {
							            "products": [{
						                    "id": item.ID,
						                    "name": item.NAME,
						                    "price": item.PRICE,
						                    "brand": item.BRAND,
						                    "category": item.CATEGORY,
						                    "quantity": item.QUANTITY
						                }]
							        }
							    }
							});
						});
					}
				}
			});
		}
	}
}

if(!funcDefined("purchaseCounter")){
	function purchaseCounter(order_id, type, callback){
		if(checkCounters()){
			$.ajax({
				url:arAsproOptions['SITE_DIR'] + "ajax/goals.php",
				dataType: "json",
				type: "POST",
				data: {"ORDER_ID": order_id, "TYPE": type},
				success: function(order){
					var products = [];
					if(order.ITEMS){
						for(var i in order.ITEMS){
							products.push({
								"id": order.ITEMS[i].ID,
								"sku": order.ITEMS[i].ID,
			                    "name": order.ITEMS[i].NAME,
			                    "price": order.ITEMS[i].PRICE,
			                    "brand": order.ITEMS[i].BRAND,
			                    "category": order.ITEMS[i].CATEGORY,
			                    "quantity": order.ITEMS[i].QUANTITY
							});
						}
					}
					if(order.ID){
						waitLayer(100, function() {
							dataLayer.push({
								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['PURCHASE'],
							    "ecommerce": d = {
							    	"purchase": {
								    	"actionField":{
								    		"id": order.ACCOUNT_NUMBER,
								    		"shipping": order.PRICE_DELIVERY,
								    		"tax": order.TAX_VALUE,
								    		"list": type,
								    		"revenue": order.PRICE
								    	},
							            "products": products
							        }
							    }
							});

							if(typeof callback !== 'undefined'){
								callback(d);
							}
						});
					}
					else{
						if(typeof callback !== 'undefined'){
							callback();
						}
					}
				},
				error: function(){
					if(typeof callback !== 'undefined'){
						callback();
					}
				}
			});
		}
	}
}

if(!funcDefined("viewItemCounter")){
	function viewItemCounter(id, price_id){
		if(checkCounters()){
			$.ajax({
				url:arAsproOptions['SITE_DIR'] + "ajax/goals.php",
				dataType: "json",
				type: "POST",
				data: {"PRODUCT_ID": id, "PRICE_ID": price_id},
				success: function(item){
					if(item.ID){
						waitLayer(100, function() {
							dataLayer.push({
								//"event": "",
								"ecommerce": {
									"detail": {
										"products": [{
											"id": item.ID,
											"name": item.NAME,
											"price": item.PRICE,
											"brand": item.BRAND,
											"category": item.CATEGORY
										}]
									}
								}
							});
						});
					}
				}
			});
		}
	}
}

if(!funcDefined("checkoutCounter")){
	function checkoutCounter(step, option, callback){
		if(checkCounters('google')){
			$.ajax({
				url:arAsproOptions['SITE_DIR'] + "ajax/goals.php",
				dataType: "json",
				type: "POST",
				data: {"BASKET": "Y"},
				success: function(basket){
					var products = [];
					if(basket.ITEMS){
						for(var i in basket.ITEMS){
							products.push({
								"id": basket.ITEMS[i].ID,
			                    "name": basket.ITEMS[i].NAME,
			                    "price": basket.ITEMS[i].PRICE,
			                    "brand": basket.ITEMS[i].BRAND,
			                    "category": basket.ITEMS[i].CATEGORY,
			                    "quantity": basket.ITEMS[i].QUANTITY
							});
						}
					}
					if(products){
						waitLayer(100, function() {
							dataLayer.push({
								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['CHECKOUT_ORDER'],
							    "ecommerce": {
							    	'checkout': {
								    	"actionField":{
								    		"step": step,
								    		"option": option
								    	},
								        "products": products
								    }
							    },
							    /*"eventCallback": function() {
							    	if((typeof callback !== 'undefined') &amp;&amp; (typeof callback === 'function')){
							    		callback();
							    	}
							   }*/
							});
						});
					}
				}
			});
		}
	}
}

if(!funcDefined("delFromBasketCounter")){
	function delFromBasketCounter(id, callback){
		if(checkCounters()){
			$.ajax({
				url:arAsproOptions['SITE_DIR'] + "ajax/goals.php",
				dataType: "json",
				type: "POST",
				data: {"ID": id},
				success: function(item){
					if(item.ID){
						waitLayer(100, function() {
							dataLayer.push({
								"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['REMOVE_BASKET'],
							    "ecommerce": {
							        "remove": {
							            "products": [{
						                    "id": item.ID,
						                    "name": item.NAME,
						                    "category": item.CATEGORY
						                }]
							        }
							    }
							});
							if(typeof callback == 'function'){
								callback();
							}
						});
					}
				}
			});
		}
	}
}

if(!funcDefined("setHeightCompany")){
	function setHeightCompany(){
		$('.md-50.img').height($('.md-50.big').outerHeight()-35);
	}
}

if(!funcDefined("initSly")){
	function initSly(){
		/*var $frame  = $(document).find('.frame');
		var $slidee = $frame.children('ul').eq(0);
		var $wrap   = $frame.parent();

		if(arAsproOptions["PAGES"]["CATALOG_PAGE"] &amp;&amp; $frame.length){
			$frame.sly({
				horizontal: 1,
				itemNav: 'basic',
				smart: 1,
				mouseDragging: 0,
				touchDragging: 0,
				releaseSwing: 0,
				startAt: 0,
				scrollBar: $wrap.find('.scrollbar'),
				scrollBy: 1,
				speed: 300,
				elasticBounds: 0,
				easing: 'swing',
				dragHandle: 1,
				dynamicHandle: 1,
				clickBar: 1,

				// Buttons
				forward: $wrap.find('.forward'),
				backward: $wrap.find('.backward'),
			});
			$frame.sly('reload');
		}*/
	}
}

if(!funcDefined("createTableCompare")){
	function createTableCompare(originalTable, appendDiv, cloneTable){

		try{
			var clone = originalTable.clone().removeAttr('id').addClass('clone');
			if(cloneTable.length){
				cloneTable.remove();
				appendDiv.html('');
				appendDiv.html(clone);
			}else{
				appendDiv.append(clone);
			}
		}
		catch(e){}
		finally{

		}
	}
}

if(!funcDefined('fillBasketPropsExt')){
	fillBasketPropsExt = function(that, prop_code, basket_prop_div){
		var
			i = 0,
			propCollection = null,
			foundValues = false,
			basketParams = {},
			obBasketProps = null;

		obBasketProps = BX(basket_prop_div);
		if(!obBasketProps &amp;&amp; that.closest('.item').find('.basket_props_block').length)
			obBasketProps = that.closest('.item').find('.basket_props_block')[0];

		if (!!obBasketProps)
		{
			propCollection = obBasketProps.getElementsByTagName('select');
			if (!!propCollection &amp;&amp; !!propCollection.length)
			{
				for (i = 0; i &lt; propCollection.length; i++)
				{
					if (!propCollection[i].disabled)
					{
						switch(propCollection[i].type.toLowerCase())
						{
							case 'select-one':
								basketParams[propCollection[i].name] = propCollection[i].value;
								foundValues = true;
								break;
							default:
								break;
						}
					}
				}
			}
			propCollection = obBasketProps.getElementsByTagName('input');
			if (!!propCollection &amp;&amp; !!propCollection.length)
			{
				for (i = 0; i &lt; propCollection.length; i++)
				{
					if (!propCollection[i].disabled)
					{
						switch(propCollection[i].type.toLowerCase())
						{
							case 'hidden':
								basketParams[propCollection[i].name] = propCollection[i].value;
								foundValues = true;
								break;
							case 'radio':
								if (propCollection[i].checked)
								{
									basketParams[propCollection[i].name] = propCollection[i].value;
									foundValues = true;
								}
								break;
							default:
								break;
						}
					}
				}
			}
		}
		if (!foundValues)
		{
			basketParams[prop_code] = [];
			basketParams[prop_code][0] = 0;
		}
		return basketParams;
	}
}
if(!funcDefined('showBasketError')){
	showBasketError = function(mess, title, addButton, th, callback){
		var title_set=(title ? title : BX.message("ERROR_BASKET_TITLE")),
			isButton="N",
			thButton="";
		if(typeof addButton!==undefined){
			isButton="Y";
		}
		if(typeof th!==undefined){
			thButton=th;
		}
		$("body").append("&lt;span class='add-error-bakset' style='display:none;'&gt;&lt;/span&gt;");
		jqmEd('basket_error', 'error-bakset', '.add-error-bakset', mess, this, title_set, isButton, thButton);
		$("body .add-error-bakset").click();
		$("body .add-error-bakset").remove();

		if(typeof callback === 'function'){
			callback();
		}
	}
}

CheckTopVisibleMenu = function(that) {
	var dropdownMenu = $('.dropdown-menu:visible');
	if( that !== undefined ) {
		dropdownMenu.push(that);
	}

	if(dropdownMenu.length){
		dropdownMenu.each(function(i, el) {
			var dropdownMenuCurrent = $(el);
			dropdownMenuCurrent.find('a').css('white-space', '');
			dropdownMenuCurrent.css('left', '');
			dropdownMenuCurrent.css('right', '');
			dropdownMenuCurrent.removeClass('toright');

			var dropdownMenuCurrent_left = dropdownMenuCurrent.offset().left;

			if(typeof(dropdownMenuCurrent_left) != 'undefined'){
				var menu = dropdownMenuCurrent.parents('.mega-menu');
				if(!menu.length)
					menu = dropdownMenuCurrent.closest('.logo-row');
				var menu_width = menu.outerWidth();
				var menu_left = menu.offset().left;
				var menu_right = menu_left + menu_width;
				var isToRight = dropdownMenuCurrent.parents('.toright').length &gt; 0;
				var parentsdropdownMenuCurrents = dropdownMenuCurrent.parents('.dropdown-menu');
				var isHasParentdropdownMenuCurrent = parentsdropdownMenuCurrents.length &gt; 0;
				if(isHasParentdropdownMenuCurrent){
					var parentdropdownMenuCurrent_width = parentsdropdownMenuCurrents.first().outerWidth();
					var parentdropdownMenuCurrent_left = parentsdropdownMenuCurrents.first().offset().left;
					var parentdropdownMenuCurrent_right = parentdropdownMenuCurrent_width + parentdropdownMenuCurrent_left;
				}

				if(parentdropdownMenuCurrent_right + dropdownMenuCurrent.outerWidth() &gt; menu_right){
					dropdownMenuCurrent.find('a').css('white-space', 'normal');
				}

				var dropdownMenuCurrent_width = dropdownMenuCurrent.outerWidth();
				var dropdownMenuCurrent_right = dropdownMenuCurrent_left + dropdownMenuCurrent_width;

				if(dropdownMenuCurrent_right &gt; menu_right || isToRight){
					var addleft = 0;
					addleft = menu_right - dropdownMenuCurrent_right;
					if(isHasParentdropdownMenuCurrent || isToRight){
						dropdownMenuCurrent.css('left', 'auto');
						dropdownMenuCurrent.css('right', '100%');
						dropdownMenuCurrent.addClass('toright');
					}
					else{
						var dropdownMenuCurrent_curLeft = parseInt(dropdownMenuCurrent.css('left'));
						dropdownMenuCurrent.css('left', (dropdownMenuCurrent_curLeft + addleft) + 'px');
					}
				}
			}
		});
	}
}

if(!funcDefined("isRealValue")){
	function isRealValue(obj){
		return obj &amp;&amp; obj !== "null" &amp;&amp; obj!== "undefined";
	}
}

if(!funcDefined("rightScroll")){
	function rightScroll(prop, id){
		var el = BX('prop_' + prop + '_' + id);
		if (el) {
			var curVal = parseInt(el.style.marginLeft);
			if (curVal &gt;= 0) el.style.marginLeft = curVal - 20 + '%';
		}
	}
}

if(!funcDefined("leftScroll")){
	function leftScroll(prop, id){
		var el = BX('prop_' + prop + '_' + id);
		if (el) {
			var curVal = parseInt(el.style.marginLeft);
			if (curVal &lt; 0) el.style.marginLeft = curVal + 20 + '%';
		}
	}
}

if(!funcDefined("InitOrderCustom")){
	InitOrderCustom = function () {
		$('.ps_logo img').wrap('&lt;div class="image"&gt;&lt;/div&gt;');

		$('#bx-soa-order .radio-inline').each(function() {
			if ($(this).find('input').attr('checked') == 'checked') {
				$(this).addClass('checked');
			}
		});

		$('#bx-soa-order .checkbox input[type=checkbox]').each(function() {
			if ($(this).attr('checked') == 'checked')
				$(this).parent().addClass('checked');
		});

		$('#bx-soa-order .bx-authform-starrequired').each(function() {
			var html = $(this).html();
			$(this).closest('label').append('&lt;span class="bx-authform-starrequired"&gt; '+ html + '&lt;/span&gt;');
			$(this).detach();
		});
		$('.bx_ordercart_coupon').each(function() {
			if ($(this).find('.bad').length)
				$(this).addClass('bad');
			else if ($(this).find('.good').length)
				$(this).addClass('good');
		});
		/*if (typeof(propsMap) !== 'undefined') {
			$(propsMap).on('click', function () {
				var value = $('#orderDescription').val();
				if ($('#orderDescription')) {
					if (value != '') {
						$('#orderDescription').closest('.form-group').addClass('value_y');
					}
				}
			});
		}*/
	}
}

if(!funcDefined("InitLabelAnimation")){
	InitLabelAnimation = function(className) {
		// Fix order labels
		if (!$(className).length) {
			return;
		}
		$(className).find('.form-group').each(function() {
			if ($(this).find('input[type=text], textarea').length &amp;&amp; !$(this).find('.dropdown-block').length &amp;&amp; $(this).find('input[type=text], textarea').val() != '') {
				$(this).addClass('value_y');
			}
		});

		$(document).on('click', className+' .form-group:not(.bx-soa-pp-field) label', function() {
			$(this).parent().find('input, textarea').focus();
		});

		$(document).on('focusout', className+' .form-group:not(.bx-soa-pp-field) input, '+className+' .form-group:not(.bx-soa-pp-field) textarea', function() {
			var value = $(this).val();
			if (value != '' &amp;&amp; !$(this).closest('.form-group').find('.dropdown-block').length &amp;&amp; !$(this).closest('.form-group').find('#profile_change').length) {
				$(this).closest('.form-group').addClass('value_y');
			}else{
				$(this).closest('.form-group').removeClass('value_y');
			}
		});

		$(document).on('focus', className+' .form-group:not(.bx-soa-pp-field) input, '+className+' .form-group:not(.bx-soa-pp-field) textarea', function() {
			if (!$(this).closest('.form-group').find('.dropdown-block').length &amp;&amp; !$(this).closest('.form-group').find('#profile_change').length &amp;&amp; !$(this).closest('.form-group').find('[name=PERSON_TYPE_OLD]').length ) {
				$(this).closest('.form-group').addClass('value_y');
			}
		});
	};
}

checkPopupWidth = function(){
	$('.popup.show').each(function() {
		var width_form = $(this).actual('width');
		$(this).css({
			'margin-left': ($(window).width() &gt; width_form ? '-' + width_form / 2 + 'px' : '-' + $(window).width() / 2 + 'px'),
		});
	});
}

checkCaptchaWidth = function(){
	$('.captcha-row').each(function() {
		var width = $(this).actual('width');
		if($(this).hasClass('b')){
			if(width &gt; 320){
				$(this).removeClass('b');
			}
		}
		else{
			if(width &lt;= 320){
				$(this).addClass('b');
			}
		}
	});
}

checkFormWidth = function(){
	$('.form .form_left').each(function() {
		var form = $(this).parents('.form');
		var width = form.actual('width');
		if(form.hasClass('b')){
			if(width &gt; 417){
				form.removeClass('b');
			}
		}
		else{
			if(width &lt;= 417){
				form.addClass('b');
			}
		}
	});
}

checkFormControlWidth = function(){
	$('.form-control').each(function() {
		var width = $(this).actual('width');
		var labelWidth = $(this).find('label:not(.error) &gt; span').actual('width');
		var errorWidth = $(this).find('label.error').actual('width');
		if(errorWidth &gt; 0){
			if($(this).hasClass('h')){
				if(width &gt; (labelWidth + errorWidth + 5)){
					$(this).removeClass('h');
				}
			}
			else{
				if(width &lt;= (labelWidth + errorWidth + 5)){
					$(this).addClass('h');
				}
			}
		}
		else{
			$(this).removeClass('h');
		}
	});
}

scrollToTop = function(){
	if(arAsproOptions['THEME']['SCROLLTOTOP_TYPE'] !== 'NONE'){
		var _isScrolling = false;
		// Append Button
		$('body').append($('&lt;a /&gt;').addClass('scroll-to-top ' + arAsproOptions['THEME']['SCROLLTOTOP_TYPE'] + ' ' + arAsproOptions['THEME']['SCROLLTOTOP_POSITION']).attr({'href': '#', 'id': 'scrollToTop'}));

		if(arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM']) {
			$('#scrollToTop').css('bottom', +arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM']+'px');
		}

		if(arAsproOptions['THEME']['SCROLLTOTOP_POSITION_RIGHT']) {
			$('#scrollToTop').css('right', +arAsproOptions['THEME']['SCROLLTOTOP_POSITION_RIGHT']+'px');
		}

		$('#scrollToTop').click(function(e){
			e.preventDefault();
			$('body, html').animate({scrollTop : 0}, 500);
			return false;
		});
		// Show/Hide Button on Window Scroll event.
		$(window).scroll(function(){
			if(!_isScrolling) {
				_isScrolling = true;
				if($(window).scrollTop() &gt; 150){
					$('#scrollToTop').stop(true, true).addClass('visible');
					_isScrolling = false;
				}
				else{
					$('#scrollToTop').stop(true, true).removeClass('visible');
					_isScrolling = false;
				}
				checkScrollToTop();
			}
		});
	}
}

checkScrollToTop = function(){
	if(arAsproOptions['THEME'] &amp;&amp; arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM'])
		var bottom = +arAsproOptions['THEME']['SCROLLTOTOP_POSITION_BOTTOM'];
	else
		var bottom = 55;

	var scrollVal = $(window).scrollTop(),
		windowHeight = $(window).height(),
		footerOffset = 0;
	if($('footer').length)
		footerOffset = $('footer .footer-inner').offset().top;

	if(arAsproOptions['THEME'] &amp;&amp; arAsproOptions['THEME']['SCROLLTOTOP_POSITION'] == 'CONTENT'){
		warpperWidth = $('body &gt; .wrapper &gt; .wrapper_inner').width();
		$('#scrollToTop').css('margin-left', Math.ceil(warpperWidth / 2) + 23);
	}

	if(scrollVal + windowHeight &gt; footerOffset){
		$('#scrollToTop').css('bottom', Math.round(bottom  + scrollVal + windowHeight - footerOffset) + 'px');
	}
	else if(parseInt($('#scrollToTop').css('bottom')) &gt; bottom){
		$('#scrollToTop').css('bottom', Math.round(bottom));
	}
}

CheckObjectsSizes = function() {
	$('.container iframe,.container object,.container video').each(function() {
		var height_attr = $(this).attr('height');
		var width_attr = $(this).attr('width');
		if (height_attr &amp;&amp; width_attr) {
			$(this).css('height', $(this).outerWidth() * height_attr / width_attr);
		}
	});
}

if(!funcDefined('reloadTopBasket')){
	var reloadTopBasket = function reloadTopBasket(action, basketWindow, speed, delay, slideDown, item, sync){
		var obj={
				"PARAMS": $('#top_basket_params').val(),
				"ACTION": action
			};
		if(typeof item !== "undefined" &amp;&amp; item){
			obj.delete_top_item='Y';
			obj.delete_top_item_id=item.data('id');
		}
		// $.post( arAsproOptions['SITE_DIR']+"ajax/show_basket_popup.php", obj, $.proxy(function( data ){
		$.post( arAsproOptions['SITE_DIR']+"ajax/show_basket_actual.php", obj, $.proxy(function( data ){
			$(basketWindow).html(data);

			getActualBasket('', '', sync);

			var eventdata = {action:'loadBasket'};
			BX.onCustomEvent('onCompleteAction', [eventdata]);

			/*if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N'){
				if($(window).outerWidth() &gt; 520){
					if(slideDown=="Y")
						$(basketWindow).find('.basket_popup_wrapp').stop(true,true).slideDown(speed);
					clearTimeout(basketTimeoutSlide);
					basketTimeoutSlide = setTimeout(function() {
						var _this = $('#basket_line').find('.basket_popup_wrapp');
						if (_this.is(':hover')) {
							_this.show();
						}else{
							$('#basket_line').find('.basket_popup_wrapp').slideUp(speed);
						}
					},delay);
				}
			}*/
		}))
	}
}

CheckTabActive = function(){
	if(typeof(clicked_tab) &amp;&amp; clicked_tab)
	{
		if(window.matchMedia('(min-width: 768px)').matches)
		{
			clicked_tab--;
			$('.nav.nav-tabs li').each(function(){
				if($(this).index() == clicked_tab)
					$(this).addClass('active');
			})
			// $('.nav.nav-tabs li:eq('+clicked_tab+')').addClass('active');
			$('.catalog_detail .tab-content .tab-pane:eq('+clicked_tab+')').addClass('active');
			$('.catalog_detail .tab-content .tab-pane .title-tab-heading').next().removeAttr('style');
			clicked_tab = 0;
		}
	}
}

/*countdown start*/
if(!funcDefined('initCountdown')){
	var initCountdown = function initCountdown(){
		if( $('.view_sale_block').size() ){
			$('.view_sale_block').each(function(){
				var activeTo=$(this).find('.active_to').text(),
					dateTo= new Date(activeTo.replace(/(\d+)\.(\d+)\.(\d+)/, '$3/$2/$1'));
				if($(this).hasClass('compact'))
					$(this).find('.countdown').countdown({until: dateTo, format: 'dHMS',compact: true, padZeroes: true, layout: '{d&lt;}&lt;span class="days item"&gt;{dn}&lt;div class="text"&gt;{dl}&lt;/div&gt;&lt;/span&gt;{d&gt;} &lt;span class="hours item"&gt;{hn}&lt;div class="text"&gt;{hl}&lt;/div&gt;&lt;/span&gt; &lt;span class="minutes item"&gt;{mn}&lt;div class="text"&gt;{ml}&lt;/div&gt;&lt;/span&gt; &lt;span class="sec item"&gt;{sn}&lt;div class="text"&gt;{sl}&lt;/div&gt;&lt;/span&gt;'}, $.countdown.regionalOptions['ru']);
				else
					$(this).find('.countdown').countdown({until: dateTo, format: 'dHMS', padZeroes: true, layout: '{d&lt;}&lt;span class="days item"&gt;{dnn}&lt;div class="text"&gt;{dl}&lt;/div&gt;&lt;/span&gt;{d&gt;} &lt;span class="hours item"&gt;{hnn}&lt;div class="text"&gt;{hl}&lt;/div&gt;&lt;/span&gt; &lt;span class="minutes item"&gt;{mnn}&lt;div class="text"&gt;{ml}&lt;/div&gt;&lt;/span&gt; &lt;span class="sec item"&gt;{snn}&lt;div class="text"&gt;{sl}&lt;/div&gt;&lt;/span&gt;'}, $.countdown.regionalOptions['ru']);
			})
		}
	}
}

if(!funcDefined('initCountdownTime')){
	var initCountdownTime = function initCountdownTime(block, time){
		if(time)
		{
			var dateTo= new Date(time.replace(/(\d+)\.(\d+)\.(\d+)/, '$3/$2/$1'));
			block.find('.countdown').countdown('destroy');
			if(block.hasClass('compact'))
				block.find('.countdown').countdown({until: dateTo, format: 'dHM',compact: true, padZeroes: true, layout: '{d&lt;}&lt;span class="days item"&gt;{dn}&lt;div class="text"&gt;{dl}&lt;/div&gt;&lt;/span&gt;{d&gt;} &lt;span class="hours item"&gt;{hn}&lt;div class="text"&gt;{hl}&lt;/div&gt;&lt;/span&gt; &lt;span class="minutes item"&gt;{mn}&lt;div class="text"&gt;{ml}&lt;/div&gt;&lt;/span&gt; &lt;span class="sec item"&gt;{sn}&lt;div class="text"&gt;{sl}&lt;/div&gt;&lt;/span&gt;'}, $.countdown.regionalOptions['ru']);
			else
				block.find('.countdown').countdown({until: dateTo, format: 'dHMS', padZeroes: true, layout: '{d&lt;}&lt;span class="days item"&gt;{dnn}&lt;div class="text"&gt;{dl}&lt;/div&gt;&lt;/span&gt;{d&gt;} &lt;span class="hours item"&gt;{hnn}&lt;div class="text"&gt;{hl}&lt;/div&gt;&lt;/span&gt; &lt;span class="minutes item"&gt;{mnn}&lt;div class="text"&gt;{ml}&lt;/div&gt;&lt;/span&gt; &lt;span class="sec item"&gt;{snn}&lt;div class="text"&gt;{sl}&lt;/div&gt;&lt;/span&gt;'}, $.countdown.regionalOptions['ru']);
			block.find('.view_sale_block').show();
		}
		else
		{
			block.find('.view_sale_block').hide();
		}
	}
}
/*countdown end*/

waitCounter = function(idCounter, delay, callback){
	var obCounter = window['yaCounter' + idCounter];
	if(typeof obCounter == 'object')
	{
		if(typeof callback == 'function')
			callback();

	}
	else
	{
		setTimeout(function(){
			waitCounter(idCounter, delay, callback);
		}, delay);
	}
}

var isOnceInited = insertFilter = false;
var animationTime = 200;
var delayTime = 200;
var topMenuEnterTimer = false;
var previewMode = (window!=window.top)
var isMobile = ((jQuery.browser.mobile || previewMode) &amp;&amp; window.matchMedia('(max-width:767px)').matches) || window.matchMedia('(max-width:400px)').matches;

if(isMobile)
	document.documentElement.className += ' mobile';
if(previewMode)
	document.documentElement.className += ' previewMode';

if(navigator.userAgent.indexOf("Edge") != -1)
	document.documentElement.className += ' bx-ie-edge';

/*filter start*/
if(!funcDefined('checkVerticalMobileFilter')){
	var checkVerticalMobileFilter = function checkVerticalMobileFilter(){
		/*if($('.right_block1.catalog.vertical').length &amp;&amp; !$('.left_block.filter_ajax').length)
		{
			if(typeof window['trackBarOptions'] !== 'undefined')
			{
				window['trackBarValues'] = {}
				for(key in window['trackBarOptions'])
				{
					window['trackBarValues'][key] = {
						'leftPercent': window['trackBar' + key].leftPercent,
						'leftValue': window['trackBar' + key].minInput.value,
						'rightPercent': window['trackBar' + key].rightPercent,
						'rightValue': window['trackBar' + key].maxInput.value,
					}
				}
			}

			if(window.matchMedia('(max-width: 991px)').matches)
			{
				if(!insertFilter)
				{
					$('.js_filter .bx_filter.bx_filter_vertical').html($('.left_block .bx_filter.bx_filter_vertical').html());
					$('.left_block .bx_filter.bx_filter_vertical .bx_filter_section').remove();
					insertFilter=true;
				}
			}
			else
			{
				if(insertFilter)
				{
					$('.left_block .bx_filter.bx_filter_vertical').html($('.js_filter .bx_filter.bx_filter_vertical').html());
					$('.js_filter .bx_filter.bx_filter_vertical .bx_filter_section').remove();
					insertFilter=false;
				}
			}

			if(typeof window['trackBarOptions'] !== 'undefined')
			{
				for(key in window['trackBarOptions'])
				{
					window['trackBarOptions'][key].leftPercent = window['trackBarValues'][key].leftPercent;
					window['trackBarOptions'][key].rightPercent = window['trackBarValues'][key].rightPercent;
					window['trackBarOptions'][key].curMinPrice = window['trackBarValues'][key].leftValue;
					window['trackBarOptions'][key].curMaxPrice = window['trackBarValues'][key].rightValue;
					window['trackBar' + key] = new BX.Iblock.SmartFilter(window['trackBarOptions'][key]);
					window['trackBar' + key].minInput.value = window['trackBarValues'][key].leftValue;
					window['trackBar' + key].maxInput.value = window['trackBarValues'][key].rightValue;
				}
			}
		}
		else if($('.visible_mobile_filter').length)
		{
			var posTopBlock = BX.pos($('.detail.partners')[0]),
				posBlock = $('.ajax_load').position();
			// $('.visible_mobile_filter').css('top', posBottomBlock.top-posTopBlock.top);
			$('.visible_mobile_filter').css('top', posBlock.top);

		}*/
	}
}
/*filter end*/

// ONE CLICK
if(!funcDefined("oneClickBuy")) {
	var oneClickBuy = function (elementID, iblockID, that) {
		var name = 'one_click_buy';
		var elementQuantity = 1;
		var offerProps = false;
		var buy_btn=$(that).closest('.buy_block').find('.to-cart');
		var buy_btn2=$(that).closest('tr').find('.to-cart');

		if(typeof(that) !== 'undefined'){
			elementQuantity = $(that).attr('data-quantity');
			offerProps = $(that).attr('data-props');
		}

		if(elementQuantity &lt; 0){
			elementQuantity = 1;
		}

		var tmp_props=buy_btn.data("props"),
			tmp_props2=buy_btn2.data("props"),
			props='',
			part_props='',
			add_props='N',
			fill_prop={},
			iblockid = buy_btn.data('iblockid'),
			item = buy_btn.attr('data-item');

		if(tmp_props){
			props=tmp_props.split(";");
		}else if(tmp_props2){
			props=tmp_props2.split(";");
		}
		if(buy_btn.data("part_props")){
			part_props=buy_btn.data("part_props");
		}
		if(buy_btn.data("add_props")){
			add_props=buy_btn.data("add_props");
		}

		fill_prop=fillBasketPropsExt(buy_btn, 'prop', buy_btn.data('bakset_div'));
		fill_prop.iblockID=iblockid;
		fill_prop.part_props=part_props;
		fill_prop.add_props=add_props;
		fill_prop.props=JSON.stringify(props);
		fill_prop.item=item;
		fill_prop.ocb_item="Y";

		if(!isMobile)
		{
			if(!$(that).hasClass('clicked'))
			{
				$(that).addClass('clicked');
				$('body').find('.'+name+'_frame').remove();
				$('body').find('.'+name+'_trigger').remove();
				$('body #popup_iframe_wrapper').append('&lt;div class="'+name+'_frame popup"&gt;&lt;/div&gt;');
				$('body #popup_iframe_wrapper').append('&lt;div class="'+name+'_trigger"&gt;&lt;/div&gt;');
				$('.'+name+'_frame').jqm({trigger: '.'+name+'_trigger', onHide: function(hash) { onHidejqm(name,hash); }, toTop: false, onLoad: function( hash ){ onLoadjqm(name, hash ); }, ajax: arAsproOptions["SITE_DIR"]+'ajax/one_click_buy.php?ELEMENT_ID='+elementID+'&amp;IBLOCK_ID='+iblockID+'&amp;ELEMENT_QUANTITY='+elementQuantity+'&amp;OFFER_PROPS='+fill_prop.props});
				$('.'+name+'_trigger').click();
			}
		}
		else
		{
			var script = arAsproOptions['SITE_DIR'] + 'form/';
			script += '?name='+name+'&amp;form_id=ocb&amp;path='+window.location.pathname+'&amp;ELEMENT_ID='+elementID+'&amp;IBLOCK_ID='+iblockID+'&amp;ELEMENT_QUANTITY='+elementQuantity+'&amp;OFFER_PROPS='+fill_prop.props
			location.href = script;
		}
	}
}

if(!funcDefined("oneClickBuyBasket")) {
	var oneClickBuyBasket = function () {
		name = 'one_click_buy_basket';
		if(!isMobile)
		{
			if(!$('.fast_order').hasClass('clicked'))
			{
				$('.fast_order').addClass('clicked');
				$('body').find('.'+name+'_frame').remove();
				$('body').find('.'+name+'_trigger').remove();
				$('body #popup_iframe_wrapper').append('&lt;div class="'+name+'_frame popup"&gt;&lt;/div&gt;');
				$('body #popup_iframe_wrapper').append('&lt;div class="'+name+'_trigger"&gt;&lt;/div&gt;');
				$('.'+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'});
				$('.'+name+'_trigger').click();
			}
		}
		else
		{
			var script = arAsproOptions['SITE_DIR'] + 'form/';
			script += '?name='+name+'&amp;form_id=ocb&amp;path='+window.location.pathname+'&amp;buy_basket=y';
			location.href = script;
		}
	}
}

// TOP MENU ANIMATION
$(document).on('click', '.menu_top_block&gt;li .more a', function(){
	$this = $(this);
	$this.parents('.dropdown').first().find('&gt;.hidden').removeClass('hidden');
	$this.parent().addClass('hidden');
	setTimeout(function(){
		$this.parent().remove();
	}, 500);
});

$(document).on('mouseenter', '.menu_top_block.catalogfirst&gt;li&gt;.dropdown&gt;li.full', function(){
	var $submenu = $(this).find('&gt;.dropdown');

	if($submenu.length){
		if(topMenuEnterTimer){
			clearTimeout(topMenuEnterTimer);
			topMenuEnterTimer = false;
		}
	}
});

$(document).on('mouseenter', '.menu_top_block&gt;li:not(.full)', function(){
	var $submenu = $(this).find('&gt;.dropdown');

	if($submenu.length &amp;&amp; !$submenu.hasClass('visible')){
		var $menu = $(this).parents('.menu');
		var $wrapmenu = $menu.parents('.wrap_menu');
		var wrapMenuWidth = $wrapmenu.actual('outerWidth');
		var wrapMenuLeft = $wrapmenu.offset().left;
		var wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
		var left = wrapMenuRight - ($(this).offset().left + $submenu.actual('outerWidth'));
		if(window.matchMedia('(min-width: 951px)').matches &amp;&amp; $(this).hasClass('catalog') &amp;&amp; ( $('.banner_auto').hasClass('catalog_page') || $('.banner_auto').hasClass('front_page'))){
			return;
		}
		if(left &lt; 0){
			$submenu.css({left: left + 'px'});
		}
		$submenu.stop().slideDown(animationTime, function(){
			$submenu.css({height: '', 'overflow':'visible'});
		});


		$(this).on('mouseleave', function(){
			var leaveTimer = setTimeout(function(){
				$submenu.stop().slideUp(animationTime, function(){
					$submenu.css({left: ''});
				});
			}, delayTime);

			$(this).on('mouseenter', function(){
				if(leaveTimer){
					clearTimeout(leaveTimer);
					leaveTimer = false;
				}
			});
		});
	}
});

$(document).on('mouseenter', '.menu_top_block&gt;li .dropdown&gt;li', function(){
	var $this = $(this);
	var $submenu = $this.find('&gt;.dropdown');

	if($submenu.length &amp;&amp; ((!$this.parents('.full').length &amp;&amp; !$this.hasClass('full')) || $this.parents('.more').length)){
		var $menu = $this.parents('.menu');
		var $wrapmenu = $menu.parents('.wrap_menu');
		var arParentSubmenuForOpacity = [];
		topMenuEnterTimer = setTimeout(function(){

			var wrapMenuWidth = $wrapmenu.actual('outerWidth');
			var wrapMenuLeft = $wrapmenu.offset().left;
			var wrapMenuRight = wrapMenuLeft + wrapMenuWidth;
			var $parentSubmenu = $this.parent();
			var bToLeft = $parentSubmenu.hasClass('toleft') ? true : false;
			if(!bToLeft){
				bToLeft = $this.offset().left + $this.actual('outerWidth') + $submenu.actual('outerWidth') &gt; wrapMenuRight;
			}
			else{
				bToLeft = $this.offset().left + $this.actual('outerWidth') - $submenu.actual('outerWidth') &lt; wrapMenuLeft;
			}

			if(bToLeft){
				$this.find('&gt;.dropdown').addClass('toleft').show();
			}
			else{
				$this.find('&gt;.dropdown').removeClass('toleft').show();
			}
			var submenuLeft = $submenu.offset().left;
			var submenuRight = submenuLeft + $submenu.actual('outerWidth');

			$this.parents('.dropdown').each(function(){
				var $this = $(this);
				var leftOffset = $this.offset().left;
				var rightOffset = leftOffset + $this.actual('outerWidth');
				if(leftOffset &gt;= submenuLeft  &amp;&amp; leftOffset &lt; (submenuRight - 1) || (rightOffset &gt; (submenuLeft + 1) &amp;&amp; rightOffset &lt;= submenuRight)){
					arParentSubmenuForOpacity.push($this);
					$this.find('&gt;li&gt;a').css({opacity: '0.1'});
				}
			});
		}, delayTime);

		$this.unbind('mouseleave');
		$this.on('mouseleave', function(){
			var leaveTimer = setTimeout(function(){
				$this.find('.dropdown').removeClass('toleft').hide();
				if(arParentSubmenuForOpacity.length){
					for(i in arParentSubmenuForOpacity){
						arParentSubmenuForOpacity[i].find('&gt;li&gt;a').css({opacity: ''});
					}
				}
			}, delayTime);

			$this.unbind('mouseenter');
			$this.on('mouseenter', function(){
				if(leaveTimer){
					clearTimeout(leaveTimer);
					leaveTimer = false;
				}
			});
		});
	}
});

/*hover animate*/
	//breadcrumbs
	$(document).on('mouseenter', '.breadcrumbs .breadcrumbs__item, .hover-block .hover-block__item', function () {
		var _this = $(this),
			menu = _this.find('&gt; .breadcrumbs__dropdown-wrapper, &gt; .hover-block__item-wrapper');

		menu.velocity('stop').velocity('transition.slideUpIn', {
			duration: 300,
			delay: 100
		});

		_this.one('mouseleave', function () {

			menu.velocity('stop').velocity('fadeOut', {
				duration: 100,
				// delay: 0
			});
		});
	});

	//top menu
	$(document).on('mouseenter', '.menu .mega-menu table td, .menu-row .mega-menu table td', function(){

		var _this = $(this),
			menu = _this.find('&gt; .wrap &gt; .dropdown-menu');

		if(!_this.hasClass('wide_menu'))
		{
			menu.show();
			CheckTopVisibleMenu();
		}

		var bDarkness = $('.wrapper1.dark-hover-overlay').length &gt; 0;

		menu.velocity('stop');

		if(menu.css('opacity') != 0)
		{
			menu.css('opacity' , '1');
			if(bDarkness) {
				// $('.shadow-block').css('opacity' , '1');
			}
		}
		else
		{
			// menu.velocity('stop').velocity('transition.perspectiveDownIn', {
			// menu.velocity('stop').velocity('transition.slideUpBigIn', {
			// menu.velocity('transition.expandIn', {
			menu.velocity('fadeIn', {
				begin: function(elements) {
					CheckTopVisibleMenu();
				},
				duration: 150,
				delay: 250,
				complete: function(){
					if(bDarkness) {
						$('body').addClass('menu-hovered');
						// if(!$('.shadow-block').length)
						// 	$('&lt;div class="shadow-block"&gt;&lt;/div&gt;').appendTo($('body'));
						// $('.shadow-block').velocity('stop').velocity('fadeIn', 200);
					}

					var bannerMenu = $('.dropdown-menu.with_right_block .owl-carousel-hover');
					if(bannerMenu.length) {
						bannerMenu.removeClass('owl-carousel-hover').addClass('owl-carousel');
						setTimeout(function() {
							InitOwlSlider();
							bannerMenu.removeClass('loader_circle');
						}, 1);
					}
				}
			});
		}

		_this.one('mouseleave', function(){
			menu.velocity('stop').velocity('fadeOut', {
				duration: 50,
				delay: 300,
				complete: function(){
					if(bDarkness) {
						$('.shadow-block').velocity('stop').velocity('fadeOut', {
							duration: 200,
							// delay: 100,
							complete: function(){
								$('body').removeClass('menu-hovered');
							}
						});
					}
				}
			});
		});
	});
/**/

$(document).on('mouseenter', '.menu-item:not(.wide_menu) .dropdown-menu .dropdown-submenu', function(){
	var _this = $(this),
		menu = _this.find('&gt; .dropdown-menu');

	menu.velocity('stop');

	if(menu.css('opacity') != 0)
	{
		menu.css('opacity' , '1');
	}
	else
	{
		menu.velocity('transition.fadeIn', {
			begin: function(element) {
				$(element).css('display', 'block');
				CheckTopVisibleMenu();
			},
			duration: 300,
			delay: 250
		});
	}

	_this.one('mouseleave', function(){
		menu.velocity('stop').velocity('fadeOut', {
			duration: 150,
			delay: 300
		});
	});
})

/*register custom velocity animate*/
if(typeof $.Velocity !== undefined &amp;&amp; ('RegisterEffect' in $.Velocity))
{
	var effects = {
		"transition.slideDownFullIn": {
			defaultDuration: 900,
			calls: [[{ opacity: [1, 0], translateY: [0, '-100%'], translateZ: 0}]]
		},
		"transition.slideDownFullOut": {
			defaultDuration: 900,
			calls: [[{ opacity: [0.4, 1], translateY: ['-100%', 0], translateZ: 0 }]]
		}
	};

	for(var effectName in effects)
	{
		if(effects.hasOwnProperty(effectName))
		{
			$.Velocity.RegisterEffect(effectName, effects[effectName]);
		}
	}
}
/**/

getGridSize = function(counts,slider) {
	var counts_item=1;
		//wide
		if(window.matchMedia('(min-width: 1200px)').matches){
			counts_item=counts[0];
			if(typeof(slider.data('lg_count')) !== 'undefined' &amp;&amp; slider.data('lg_count') &amp;&amp; $('.front.wide_page').length)
				counts_item=slider.data('lg_count');
		}

		//large
		if(window.matchMedia('(max-width: 1200px)').matches){
			counts_item=counts[1];
		}

		//middle
		if(window.matchMedia('(max-width: 992px)').matches){
			counts_item=counts[2];
		}

		//small
		if(counts[3]){
			if(window.matchMedia('(max-width: 600px)').matches){
				counts_item=counts[3];
			}
		}

		//exsmall
		if(counts[4]){
			if(window.matchMedia('(max-width: 400px)').matches){
				counts_item=counts[4];
			}
		}
	return counts_item;
}

CheckFlexSlider = function(){
	$('.flexslider:not(.thmb)').each(function(){
		var slider = $(this);
		if(typeof(slider.data('flexslider')) != 'undefined')
		{
			if('vars' in slider.data('flexslider'))
			{
				slider.resize();

				var counts = slider.data('flexslider').vars.counts;
				if(typeof(counts) != 'undefined' &amp;&amp; slider.is(':visible')){
					var cnt = getGridSize(counts,slider);
					var to0 = (cnt != slider.data('flexslider').vars.minItems || cnt != slider.data('flexslider').vars.maxItems || cnt != slider.data('flexslider').vars.move);
					if(to0){
						slider.data('flexslider').vars.minItems = cnt;
						slider.data('flexslider').vars.maxItems = cnt;
						slider.data('flexslider').vars.move = cnt;
						slider.flexslider(0);
						slider.resize();
						slider.resize(); // twise!
					}
				}
			}
		}
	});
}

$.fn.mCustomScrollbarDeferred = function(config){
	$(this).addClass('scroll-init');

	if ($(this).hasClass('destroyed')) {
		return;
	}
	

	$(this).hover(
		function(e){
			var $this = $(this);
			if(!$this.hasClass('mCustomScrollbar') &amp;&amp; !$(this).hasClass('destroyed')){
				$this.data('scrollTimer', setTimeout(function(){
					$this.mCustomScrollbar(config);
					$this.off('touchstart touchmove touchend mousewheel mouseenter mouseleave');
				}, 200));
			}
		},
		function(e){
			clearTimeout($(this).data('scrollTimer'));
		}
	);

	$(this).on('touchstart touchmove', function(e){
		var $this = $(this);
		if(!$this.hasClass('mCustomScrollbar') &amp;&amp; !$(this).hasClass('destroyed')){
			$this.mCustomScrollbar(config);
		}

		var $scrollContainer = $this.find('&gt;.mCustomScrollBox&gt;.mCSB_container');
		if($scrollContainer.length){
			var touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];

			var newTouch = new Touch({
			    identifier: 42,
			    target: $scrollContainer[0],
			    clientX: touch.clientX,
			    clientY: touch.clientY,
			    screenX: touch.screenX,
			    screenY: touch.screenY,
			    pageX: touch.pageX,
			    pageY: touch.pageY,
			    radiusX: 1,
			    radiusY: 1
			});

			var newEvent = new TouchEvent(e.type, {
			    cancelable: true,
			    bubbles: false,
			    composed: true,
			    touches: [newTouch],
			    targetTouches: [newTouch],
			    changedTouches: [newTouch]
			});

			$scrollContainer[0].dispatchEvent(newEvent);
		}
	});

	$(this).on('touchend', function(e){
		$(this).off('touchstart touchmove touchend mousewheel mouseenter mouseleave');
	});

	if($.event.special.mousewheel){
		$(this).on('mousewheel', function(e){
			var $this = $(this);
			if(!$this.hasClass('mCustomScrollbar') &amp;&amp; !$(this).hasClass('destroyed')){
				$this.mCustomScrollbar(config);
				$this.off('touchstart touchmove touchend mousewheel mouseenter mouseleave');
			}
		});
	}
}

InitScrollBar= function(el, initOptions) {
	var block;
	if(typeof el === 'undefined'){
		block = $('.srollbar-custom:not(.mobile-scroll):not(.scroll-init)');
	}
	else{
		block = el.filter(':not(.scroll-init)');
	}

	if(block.length){
		block.addClass('scroll-init');

		var options,
			defaults = {
				mouseWheel: {
					scrollAmount: 150,
					preventDefault: true
				}
			};
		var config = $.extend({}, defaults, options, block.data('plugin-options'), initOptions);

		config.callbacks = {
			onScroll:function(){
				if($(this).find('.mCSB_buttonLeft').hasClass('disabled'))
					$(this).find('.mCSB_buttonLeft').removeClass('disabled');
				if($(this).find('.mCSB_buttonRight').hasClass('disabled'))
					$(this).find('.mCSB_buttonRight').removeClass('disabled');
			},
			onTotalScrollBack:function(){
				$(this).find('.mCSB_buttonLeft').addClass('disabled');
			},
			onTotalScroll:function(){
				$(this).find('.mCSB_buttonRight').addClass('disabled');
			},
			onInit:function(){
				$(this).find('.mCSB_buttonLeft').addClass('disabled');
			}
		};

		block.filter(':not(.scroll-deferred)').mCustomScrollbar(config);
		block.filter('.scroll-deferred').mCustomScrollbarDeferred(config);
	}
}

InitCustomScrollBar = function(el) {
	var block;
	if(typeof el === 'undefined'){
		block = $('.scrollbar:not(.mobile-scroll):not(.scroll-init)');
	}
	else{
		block = el.filter(':not(.scroll-init)');
	}

	if(block.length){
		block.addClass('scroll-init');

		var options,
			defaults = {
				effect : 'fadeIn',
				effectTime : 300,
				threshold: 0
				// threshold: 30
			};

		var config = $.extend({}, defaults, options, block.data('plugin-options'));

		block.filter(':not(.scroll-deferred)').mCustomScrollbar(config);
		block.filter('.scroll-deferred').mCustomScrollbarDeferred(config);
	}
}

InitFancyBox = function() {
	$('.fancy').fancybox({
		padding: [40,40,64,40],
		openEffect  : 'fade',
		closeEffect : 'fade',
		nextEffect : 'fade',
		prevEffect : 'fade',
		opacity: true,
		tpl:{
			closeBtn: '&lt;span title="'+BX.message('FANCY_CLOSE')+'" class="fancybox-item fancybox-close inline svg"&gt;&lt;svg class="svg svg-close" width="14" height="14" viewBox="0 0 14 14"&gt;&lt;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)"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/span&gt;',
			next     : '&lt;a title="'+BX.message('FANCY_NEXT')+'" class="fancybox-nav fancybox-next" href="javascript:;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt;',
			prev     : '&lt;a title="'+BX.message('FANCY_PREV')+'" class="fancybox-nav fancybox-prev" href="javascript:;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt;'
		},
		touch: 'enabled',
		buttons: [
			// "zoom",
			//"share",
			// "slideShow",
			//"fullScreen",
			//"download",
			// "thumbs",
			"close"
		],
		backFocus: false,
		beforeShow: function(event){
			if(!$('.cd-modal-bg').hasClass('is-visible')){
				var scaleValue = retrieveScale($('.cd-modal-bg'));

				$('.cd-modal-bg').show().addClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
					animateLayer($('.cd-modal-bg'), scaleValue, true);
				});
			}
			var video_block = $('.company-block source.video-block');
			if(video_block.length)
			{
				if(video_block.attr('src') == '#') {
					var video_block_wrapper = video_block.closest('video');
					var video_block_clone = video_block_wrapper.clone();

					video_block_clone.find('source').attr('src', video_block_clone.find('source').data('src'));
					video_block.attr('src', video_block.data('src'));
					video_block_clone.insertAfter(video_block_wrapper);
					video_block_clone.siblings('video').remove();
				}
			}
			var video_block_frame = $('.company-block #company_video_iframe');
			if(video_block_frame.length)
			{
				var data_src_iframe = video_block_frame.attr("data-src");
				video_block_frame.attr("src", data_src_iframe);
				video_block_frame.attr("allow", 'autoplay');
			}
			// $('.detail .galery .overlay_form').hide();
		},
		afterShow: function(){
			if($('.fancybox-overlay').css('opacity') == 0){
				setTimeout(function(){
					$('.fancybox-overlay').css('opacity', 1);
					$('html').addClass('overflow_html');
				}, 200);
			}

			$('.fancybox-nav').css('opacity', 0);
			setTimeout(function(){
				$('.fancybox-nav').css('opacity', 1);
			}, 150);
			if($('.fancybox-inner #company_video').length)
			{
				// var fancyHeight = $('.fancybox-wrap').height();
				// $('.fancybox-inner').height(fancyHeight);
				setTimeout(function(){
					$('.fancybox-wrap video').resize();
					setTimeout(function(){
						$('.fancybox-wrap').addClass('show_video');
						document.getElementById('company_video').currentTime = 0;
						document.getElementById('company_video').play();
					}, 300);
				}, 150);
			}
			else if($('.fancybox-wrap iframe').length)
			{
				$('.fancybox-inner').height('100%');
			}
		},
		beforeClose: function(){
			closeModal();
			$('.fancybox-overlay').fadeOut();
			if($('#company_video').length){
				document.getElementById('company_video').currentTime = 0;
			}
			$('html').removeClass('overflow_html');
			var video_block_frame = $('.company-block .video-block');
			if(video_block_frame.length)
			{
				$("#company_video_iframe").attr("src", '');

			}
		},
		onClosed: function(){
			if($('.fancybox-wrap #company_video').length){
				document.getElementById('company_video').pause();
			}
		},
	});
}

InitFancyBoxVideo = function() {
	$(".video_link").fancybox({
		type: "iframe",
        maxWidth    : 800,
        maxHeight   : 600,
        fitToView   : false,
        width       : '70%',
        height      : '70%',
        autoSize    : false,
        closeClick  : false,
        opacity: true,
		tpl:{
			closeBtn: '&lt;span title="'+BX.message('FANCY_CLOSE')+'" class="fancybox-item fancybox-close inline svg"&gt;&lt;svg class="svg svg-close" width="14" height="14" viewBox="0 0 14 14"&gt;&lt;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)"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/span&gt;',
			next     : '&lt;a title="'+BX.message('FANCY_NEXT')+'" class="fancybox-nav fancybox-next" href="javascript:;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt;',
			prev     : '&lt;a title="'+BX.message('FANCY_PREV')+'" class="fancybox-nav fancybox-prev" href="javascript:;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt;'
		},
        beforeShow: function(event){
			if(!$('.cd-modal-bg').hasClass('is-visible')){
				var scaleValue = retrieveScale($('.cd-modal-bg'));

				$('.cd-modal-bg').show().addClass('is-visible').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function(){
					animateLayer($('.cd-modal-bg'), scaleValue, true);
				});
			}
		},
        afterShow: function(){
			if($('.fancybox-overlay').css('opacity') == 0){
				setTimeout(function(){
					$('.fancybox-overlay').css('opacity', 1);
					$('html').addClass('overflow_html');
				}, 200);
			}

			$('.fancybox-nav').css('opacity', 0);
			setTimeout(function(){
				$('.fancybox-nav').css('opacity', 1);
			}, 150);
			if($('.fancybox-wrap iframe').length)
			{
				$('.fancybox-inner').height('100%');
			}
		},
        beforeClose: function(){
			closeModal();
			$('.fancybox-overlay').fadeOut();
			$('html').removeClass('overflow_html');
		},
    });
}

InitStickySideBar = function(el, container_el) {

	var block = '.sticky-sidebar',
		container_catalog = '.wraps .wrapper_inner .container_inner .main-catalog-wrapper',
		container = '.wraps .wrapper_inner .container_inner';
	if(typeof el !== 'undefined')
		block = el;

	if($(container_catalog).length)
		container = container_catalog;

	if(typeof container_el !== 'undefined')
		container = container_el;


	if($(block).length &amp;&amp; arAsproOptions['THEME']['STICKY_SIDEBAR'] != 'N')
	{
		if(typeof window['stickySidebar'] !== 'undefined')
		{
			window['stickySidebar'].destroy();
		}
		
		window['stickySidebar'] = new StickySidebar(block, {
			topSpacing: 60,
			bottomSpacing: 20,
			containerSelector: container,
			resizeSensor: true,
			innerWrapperSelector: '.sticky-sidebar__inner'
		});

		if($('.sticky-sidebar .sticky-sidebar__inner .banner img').length)
		{
			$('.sticky-sidebar .sticky-sidebar__inner .banner img').load(function(){
				if(typeof window['stickySidebar'] !== 'undefined')
				{
					window['stickySidebar'].updateSticky();
				}
			})
		}
	}
}

InitOwlSlider = function() {
	$('.owl-carousel:not(.owl-loaded):not(.appear-block)').each(function(){
		var slider = $(this);
		var options;
		var svg = '&lt;svg xmlns="http://www.w3.org/2000/svg" width="12" height="6.969" viewBox="0 0 12 6.969"&gt;&lt;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)"/&gt;&lt;/svg&gt;';
		var defaults = {
			navText: [
				'&lt;i class="svg left colored_theme_hover_text"&gt;'+svg+'&lt;/i&gt;',
				'&lt;i class="svg right colored_theme_hover_text"&gt;'+svg+'&lt;/i&gt;',
			]
		}
		var config = $.extend({}, defaults, options, slider.data('plugin-options'));

		slider.on('initialized.owl.carousel', function(event) {

			var eventdata = {slider: event};
			BX.onCustomEvent('onSliderInitialized', [eventdata]);

			$(event.target).removeClass('loading-state');
			$(event.target).find('.owl-item:first').addClass('current');

			// if(typeof (sliceItemBlockSlide) === "function"){
			// 	sliceItemBlockSlide();
			// }

		})
		slider.owlCarousel(config);

		slider.on('change.owl.carousel', function(event) {
			var eventdata = {slider: event};
			BX.onCustomEvent('onSlideChange', [eventdata]);

		})
		slider.on('resized.owl.carousel', function(event) {
			if(typeof (sliceItemBlockSlide) === "function"){
				sliceItemBlockSlide({resize: false});
			}
		})



		slider.on('changed.owl.carousel', function(event) {
			var eventdata = {slider: event};
			BX.onCustomEvent('onSlideChanged', [eventdata]);

			if($(event.target).data('pluginOptions'))
			{
				if(('index' in $(event.target).data('pluginOptions')))
				{
					if($('.switch-item-block').length)
					{
						$('.switch-item-block__count-wrapper--big .switch-item-block__count-value').text(event.item.index+1+'/'+event.item.count);
					}
				}

				if(('relatedTo' in $(event.target).data('pluginOptions')))
				{

					var relatedClass = $(event.target).data('pluginOptions').relatedTo,
						relatedBlock = $(relatedClass);

					if(relatedBlock.length &amp;&amp; $(event.target).data('owl.carousel'))
					{
						if(!$(event.target).data('owl.carousel').loop)
						{
							var current = event.item.index;
						}
						else
						{
							var count = event.item.count-1;
							var current = Math.round(event.item.index - (event.item.count/2) - .5);

							if(current &lt; 0)
								current = count;

							if(current &gt; count)
								current = 0;
						}

						relatedBlock
							.find(".owl-item")
							.removeClass("current")
							.eq(current)
							.addClass("current");

						var onscreen = relatedBlock.find('.owl-item.active').length - 1;
						var start = relatedBlock.find('.owl-item.active').first().index();
						var end = relatedBlock.find('.owl-item.active').last().index();


						if (current &gt; end)
							relatedBlock.data('owl.carousel').to(current, 100, true);

						if (current &lt; start)
							relatedBlock.data('owl.carousel').to(current - onscreen, 100, true);
						// $(".owl-slider-"+id).trigger('to.owl.carousel', [itemCarousel])
					}
				}
			}
		})

		slider.on('translated.owl.carousel', function(event) {
		})

		if(('clickTo' in config))
		{
			var relatedClass = config.clickTo,
				magnifier = ('magnifier' in config);

			slider.on("click", ".owl-item", function(e){
				e.preventDefault();
				var _this = $(this),
					number = _this.index();

				if(magnifier)
				{
					if($(relatedClass).closest('.product-container').find('.zoom_picture').length)
					{
						$(relatedClass).closest('.product-container').find('.zoom_picture').attr('data-large', _this.find('.product-detail-gallery__item').data('big'));
						$(relatedClass).closest('.product-container').find('.zoom_picture').attr('xoriginal', _this.find('.product-detail-gallery__item').data('big'));
						$(relatedClass).closest('.product-container').find('.zoom_picture').attr('src', _this.find('.product-detail-gallery__item img').attr('src'));
					}
					_this.siblings('').removeClass('current');
					_this.addClass('current');
				}
				else
				{
					$(relatedClass).data('owl.carousel').to(number, 300, true);
				}
			});
		}
	});
}

InitFlexSlider = function() {
	// return;
	$('.flexslider:not(.thmb):not(.flexslider-init):not(.appear-block)').each(function(){
		var slider = $(this);
		var options;
		var defaults = {
			animationLoop: false,
			controlNav: false,
			keyboard: false,
			pauseOnAction: false,
			pauseInvisible: false,
			directionNav: true,
			useCSS: false,
			animation: "slide"
		}
		var config = $.extend({}, defaults, options, slider.data('plugin-options'));
		if(!slider.parent().hasClass('top_slider_wrapp') &amp;&amp; slider.is(':visible')){
			if(typeof(config.counts) != 'undefined' &amp;&amp; config.direction !== 'vertical'){
				config.maxItems =  getGridSize(config.counts,slider);
				config.minItems = getGridSize(config.counts,slider);
				config.itemWidth = 200;
			}
			if(typeof(config.move) == 'undefined')
				config.move = 1;

			config.start = function(slider){
				var eventdata = {slider: slider};
				BX.onCustomEvent('onSlideInit', [eventdata]);
			}

			config.after = function(slider){
				var eventdata = {slider: slider};
				BX.onCustomEvent('onSlideComplete', [eventdata]);
			}

			config.end = function(slider){
				var eventdata = {slider: slider};
				BX.onCustomEvent('onSlideEnd', [eventdata]);
			}
			slider.flexslider(config).addClass('flexslider-init');
			if(config.controlNav)
				slider.addClass('flexslider-control-nav');
			if(config.directionNav)
				slider.addClass('flexslider-direction-nav');
		}
	});
}

InitFlexSliderByClass = function($class) {
	if($class.hasClass('flexslider-init'))
		return;
	var slider = $class;
	var options;
	var defaults = {
		animationLoop: false,
		controlNav: false,
		keyboard: false,
		pauseOnAction: false,
		pauseInvisible: false,
		directionNav: true,
		useCSS: false,
		animation: "slide"
	}
	var config = $.extend({}, defaults, options, slider.data('plugin-options'));
	if(!slider.parent().hasClass('top_slider_wrapp') &amp;&amp; slider.is(':visible')){
		if(typeof(config.counts) != 'undefined' &amp;&amp; config.direction !== 'vertical'){
			config.maxItems =  getGridSize(config.counts,slider);
			config.minItems = getGridSize(config.counts,slider);
			config.itemWidth = 200;
		}
		if(typeof(config.move) == 'undefined')
			config.move = 1;

		config.start = function(slider){
			var eventdata = {slider: slider};
			BX.onCustomEvent('onSlideInit', [eventdata]);
		}

		config.after = function(slider){
			var eventdata = {slider: slider};
			BX.onCustomEvent('onSlideComplete', [eventdata]);
		}

		config.end = function(slider){
			var eventdata = {slider: slider};
			BX.onCustomEvent('onSlideEnd', [eventdata]);
		}

		slider.flexslider(config).addClass('flexslider-init');
		if(config.controlNav)
			slider.addClass('flexslider-control-nav');
		if(config.directionNav)
			slider.addClass('flexslider-direction-nav');
	}
}

inIframe = function (){
    try {
        return window.self !== window.top;
    } catch (e) {
        return true;
    }
}

InitZoomPict = function(el) {
	var block = $('.zoom_picture');
	if(typeof el !== 'undefined')
		block = el;
	if(block.length){
		var zoomer = block,
			options,
			defaults = {
				zoomWidth: 200,
				zoomHeight: 200,
				adaptive: false,
				title: true,
				Xoffset: 15,

			};
		var config = $.extend({}, defaults, options, zoomer.data('plugin-options'));
			zoomer.xzoom(config);

		block.on('mouseleave', function(){
			block.data('xzoom').movezoom(event);
		})
	}
}

var arBasketAsproCounters = arStatusBasketAspro = arBasketPrices = {};
SetActualBasketFlyCounters = function(sync){
	if(arBasketAsproCounters.DEFAULT == true){
		$.ajax({
			url: arAsproOptions['SITE_DIR'] + 'ajax/basket_fly.php',
			type: 'post',
			success: function(html){
				$('#basket_line .basket_fly').removeClass('loaded').html(html);

				if(typeof sync !== 'undefined')
				{
					$.ajax({
						type:"GET",
						url:arAsproOptions['SITE_DIR']+"ajax/actualBasket.php",
						// data:data,
						success: function(data){
							if(!$('.js_ajax').length)
								$('body').append('&lt;div class="js_ajax"&gt;&lt;/div&gt;');
							$('.js_ajax').html(data);

							setBasketStatusBtn(true);

						}
					});
				}
			}
		});
	}
	else{
		// insert currency &amp;#8381; by this hack!: $('&lt;div/&gt;').html(arBasketAsproCounters.READY.TITLE).text()
		$('.basket_fly .opener .basket_count .count').attr('class', 'count' + (arBasketAsproCounters.READY.COUNT &gt; 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.READY.COUNT)
		$('.basket_fly .opener .basket_count + a').attr('href', arBasketAsproCounters['READY']['HREF'])
		$('.basket_fly .opener .basket_count').attr('title', $('&lt;div/&gt;').html(arBasketAsproCounters.READY.TITLE).text()).attr('class', 'colored_theme_hover_text basket_count small clicked' + (arBasketAsproCounters.READY.COUNT &gt; 0 ? '' : ' empty'))

		$('.basket_fly .opener .wish_count .count').attr('class', 'count' + (arBasketAsproCounters.DELAY.COUNT &gt; 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.DELAY.COUNT)
		$('.basket_fly .opener .wish_count + a').attr('href', arBasketAsproCounters.DELAY.HREF)
		$('.basket_fly .opener .wish_count').attr('title', $('&lt;div/&gt;').html(arBasketAsproCounters.DELAY.TITLE).text()).attr('class', 'colored_theme_hover_text wish_count small clicked' + (arBasketAsproCounters.DELAY.COUNT &gt; 0 ? '' : ' empty'))

		$('.basket_fly .opener .compare_count .wraps_icon_block').attr('class', 'wraps_icon_block compare' + (arBasketAsproCounters.COMPARE.COUNT &gt; 0 ? '' : ' empty_block'));
		$('.basket_fly .opener .compare_count .count').attr('class', 'count' + (arBasketAsproCounters.COMPARE.COUNT &gt; 0 ? '' : ' empty_items')).find('.items span').text(arBasketAsproCounters.COMPARE.COUNT)
		$('.basket_fly .opener .compare_count + a').attr('href', arBasketAsproCounters.COMPARE.HREF)

		updateBottomIconsPanel(arBasketAsproCounters);
	}
}

CheckHeaderFixed = function(){
	var header = $('header, body.simple_basket_mode #header').first(),
		header_fixed = $('#headerfixed, body.simple_basket_mode #header'),
		header_simple = $('body.simple_basket_mode #header');

	if(header_fixed.length){
		if(header.length){
			var isHeaderFixed = false,
				isTabsFixed = false,
				headerCanFix = true,
				headerFixedHeight = header_fixed.actual('outerHeight'),
				headerNormalHeight = header.actual('outerHeight'),
				headerDiffHeight = headerNormalHeight - headerFixedHeight,
				mobileBtnMenu = $('.btn.btn-responsive-nav'),
				headerTop = $('#panel:visible').actual('outerHeight'),
				topBlock = $('.TOP_HEADER').first(),
				$headerFixedNlo = header_fixed.find('[data-nlo]'),
				isNloLoaded = !$headerFixedNlo.length,
				OnHeaderFixedScrollHandler;

			if(headerDiffHeight &lt;= 0)
				headerDiffHeight = 0;

			if(topBlock.length)
				headerTop += topBlock.actual('outerHeight');

			$(window).scroll(OnHeaderFixedScrollHandler = function(){
				var tabs_fixed = $('.product-item-detail-tabs-container-fixed');

				if(window.matchMedia('(min-width:992px)').matches){
					var scrollTop = $(window).scrollTop(),
						current_is = $('.search-wrapper .search-input:visible'),
						tabs = $('.ordered-block .nav.nav-tabs'),
						headerCanFix = !mobileBtnMenu.is(':visible')/* &amp;&amp; !$('.dropdown-menu:visible').length*/;

					if(!isHeaderFixed){
						if(
							headerCanFix &amp;&amp;
							(scrollTop &gt; headerNormalHeight + headerTop)
						){
							if(!isNloLoaded){
								if(!$headerFixedNlo.hasClass('nlo-loadings')){
									$headerFixedNlo.addClass('nlo-loadings');
									setTimeout(function(){
										$.ajax({
											data: {nlo: $headerFixedNlo.attr('data-nlo')},
											success: function(response){
												// stop ya metrika webvisor DOM indexer
												pauseYmObserver();

												isNloLoaded = true;
												$headerFixedNlo[0].insertAdjacentHTML('beforebegin', $.trim(response));
												$headerFixedNlo.remove();

												InitMenuNavigationAim();
												OnHeaderFixedScrollHandler();

												// init custom scroll
												$('#headerfixed .mega-menu table td.wide_menu .customScrollbar').mCustomScrollbarDeferred({
													mouseWheel: {
														scrollAmount: 150,
														preventDefault: true
													}
												});

												// resume ya metrika webvisor
												// (300ms transition) + (100ms scroll handler)
												setTimeout(resumeYmObserver, 400);
											},
											error:function(){
												$headerFixedNlo.removeClass('nlo-loadings');
											}
										});
									}, 300);
								}
							}
							else{
								isHeaderFixed = true;
								if(header_simple.length) {
									headerSimpleHeight = header_simple.actual('outerHeight');
									header_simple.closest('.header_wrap').css({'margin-top': headerSimpleHeight});
								}
								header_fixed.addClass('fixed');

								$('nav.mega-menu.sliced.initied').removeClass('initied');
								CheckTopMenuDotted();
							}
						}
					}
					if(
						isHeaderFixed ||
						!headerCanFix
					){
						if(
							!headerCanFix ||
							(scrollTop &lt;= headerDiffHeight + headerTop)
						){
							isHeaderFixed = false;
							header_fixed.removeClass('fixed');
							if(header_simple.length) {
								header_simple.closest('.header_wrap').css({'margin-top': ''});
							}
						}
					}

					//fixed tabs
					if(tabs_fixed.length &amp;&amp; tabs.length){
						var tabs_offset = $('.ordered-block .nav.nav-tabs').offset();
						if(scrollTop + headerFixedHeight &gt; tabs_offset.top){
							tabs_fixed.css({'top': header_fixed.actual('outerHeight')});
							tabs_fixed.addClass('fixed');

							header_fixed.addClass('tabs-fixed');
						}
						else if(tabs_fixed.hasClass('fixed')){
							tabs_fixed.removeAttr('style');
							tabs_fixed.removeClass('fixed');

							header_fixed.removeClass('tabs-fixed');
						}
					}
				}
			});
		}
	}

	//mobile fixed
	var headerSimple = $('body.simple_basket_mode .wrapper1.mfixed_Y #header');
	var mfixed = headerSimple.length ? headerSimple : $('.wrapper1.mfixed_Y #mobileheader');
	if(mfixed.length &amp;&amp; isMobile)
	{
		var isMHeaderFixed = false,
			mheaderCanFix = true,
			mheaderFixedHeight = mfixed.actual('outerHeight'),
			// mheaderFixedHeight = 0,
			mheaderTop = $('#panel:visible').actual('outerHeight'),
			mHeaderScrollTop = $('.wrapper1').hasClass('mfixed_view_scroll_top');
		$(window).scroll(function(){
			var scrollTop = $(window).scrollTop();
			if(window.matchMedia('(max-width:991px)').matches)
			{
				if(mHeaderScrollTop)
				{
					if(scrollTop &gt; startScroll)
					{
						if(!$("#mobilePhone.show").length){
							mfixed.removeClass('fixed');
							if(headerSimple.length) {
								headerSimple.closest('.header_wrap').css({'margin-top': ''});
							}
						}
					}
					else if(scrollTop &gt; mheaderFixedHeight + mheaderTop){
						mfixed.addClass('fixed');
						if(headerSimple.length) {
							headerSimple.closest('.header_wrap').css({'margin-top': mheaderFixedHeight});
						}
					}
					else if(scrollTop &lt;= mheaderFixedHeight + mheaderTop){
						mfixed.removeClass('fixed');
						if(headerSimple.length) {
							headerSimple.closest('.header_wrap').css({'margin-top': ''});
						}
					}
					startScroll = scrollTop;
				}
				else
				{
					if(!isMHeaderFixed)
					{
						if((scrollTop &gt; mheaderFixedHeight + mheaderTop))
						{
							isMHeaderFixed = true;
							mfixed.addClass('fixed');
							if(headerSimple.length) {
								headerSimple.closest('.header_wrap').css({'margin-top': mheaderFixedHeight});
							}
						}
					}
					else if(isMHeaderFixed)
					{
						if((scrollTop &lt;= mheaderFixedHeight + mheaderTop))
						{
							isMHeaderFixed = false;
							mfixed.removeClass('fixed');
							if(headerSimple.length) {
								headerSimple.closest('.header_wrap').css({'margin-top': ''});
							}
						}
					}
				}
			}
			else {
				mfixed.removeClass('fixed');
				if(headerSimple.length) {
					headerSimple.closest('.header_wrap').css({'margin-top': ''});
				}
			}
		})
	}
}

CheckHeaderFixedMenu = function(){
	if(arAsproOptions['THEME'] &amp;&amp; arAsproOptions['THEME']['HEADER_FIXED'] == 2 &amp;&amp; $('#headerfixed .js-nav').length &amp;&amp; window.matchMedia('(min-width: 992px)').matches)
	{
		$('#headerfixed .js-nav').css('width','0');
		var all_width = 0,
			cont_width = $('#headerfixed .maxwidth-theme').actual('width'),
			padding_menu = $('#headerfixed .logo-row.v2 .menu-block').actual('outerWidth')-$('#headerfixed .logo-row.v2 .menu-block').actual('width');
		$('#headerfixed .logo-row.v2 &gt; .inner-table-block').each(function(){
			if(!$(this).hasClass('menu-block'))
				all_width += $(this).actual('outerWidth');
		})
		$('#headerfixed .js-nav').width(cont_width-all_width-padding_menu);
	}
}

CheckSearchWidth = function(){
	if($('.logo_and_menu-row .search_wrap').length){
		var searchPosition = $('.logo_and_menu-row .search_wrap').position().left,
			maxWidth = $('.logo_and_menu-row .maxwidth-theme').width() - 2;
			width = 0;
		if($('.logo_and_menu-row .subtop .search_wrap').length)
		{
			maxWidth = $('.logo_and_menu-row .subtop').width() - 2;
			$('.logo_and_menu-row .subtop &gt; .row &gt;div &gt;div').each(function(){
				if(!$(this).hasClass('search_wrap')){
					var elementWidth = $(this).outerWidth();
					if(!$(this).is(':visible') || !$(this).height())
						elementWidth = 0;
					width = (width ? width - elementWidth : maxWidth - elementWidth);
				}
			}).promise().done(function(){
				if($('.logo_and_menu-row .search_wrap.wide_search').length)
					$('.logo_and_menu-row .search_wrap .search-block').outerWidth(width);
				else
					$('.logo_and_menu-row .search_wrap').outerWidth(width);
				$('.logo_and_menu-row .search_wrap').css({'opacity': 1, 'visibility': 'visible'});
			});
		}
		else
		{
			if($('.logo_and_menu-row .subbottom .search_wrap').length)
			{
				maxWidth = $('.logo_and_menu-row .subbottom').width() - 2;
				$('.logo_and_menu-row .subbottom &gt;div').each(function(){
					if(!$(this).hasClass('search_wrap')){
						var elementWidth = $(this).outerWidth();
						if(!$(this).is(':visible') || !$(this).height())
							elementWidth = 0;
						width = (width ? width - elementWidth : maxWidth - elementWidth);
					}
				}).promise().done(function(){
					if($('.logo_and_menu-row .search_wrap.wide_search').length)
						$('.logo_and_menu-row .search_wrap .search-block').outerWidth(width);
					else
						$('.logo_and_menu-row .search_wrap').outerWidth(width);
					$('.logo_and_menu-row .search_wrap').css({'opacity': 1, 'visibility': 'visible'});
				});
			}
			else
			{
				$('.logo_and_menu-row .maxwidth-theme &gt; .row &gt;div &gt;div').each(function(){
					if(!$(this).hasClass('search_wrap')){
						var elementWidth = $(this).outerWidth();
						if(!$(this).is(':visible') || !$(this).height())
							elementWidth = 0;
						width = (width ? width - elementWidth : maxWidth - elementWidth);
					}
				}).promise().done(function(){
					if($('.logo_and_menu-row .search_wrap.wide_search').length)
						$('.logo_and_menu-row .search_wrap .search-block').outerWidth(width);
					else
						$('.logo_and_menu-row .search_wrap').outerWidth(width);
					$('.logo_and_menu-row .search_wrap').css({'opacity': 1, 'visibility': 'visible'});
				});
			}
		}
	}
}

lazyLoadPagenBlock = function(){
	setTimeout(function(){
		if ($('.with-load-block .ajax_load_btn:not(.appear-block)').length) {
			$('.with-load-block .ajax_load_btn:not(.appear-block)').appear(function(){
				var $this = $(this);
				$this.addClass('appear-block').trigger('click');

			}, {accX: 0, accY: 200})
		}
	}, 200)
}

scrollPreviewBlock = function(){
	if(typeof($.cookie('scroll_block')) != 'undefined' &amp;&amp; $.cookie('scroll_block'))
	{
		var scroll_block = $($.cookie('scroll_block'));
		if(scroll_block.length)
		{
			$('body, html').animate({scrollTop: scroll_block.offset().top}, 500);
		}
		$.cookie('scroll_block', null);
	}
}

scrollToBlock = function(block){
	if($(block).length)
	{
		var offset = $(block).offset().top;
		if(typeof($(block).data('toggle')) != 'undefined')
			$(block).click();

		if(typeof($(block).data('offset')) != 'undefined')
			offset += $(block).data('offset');

		$('body, html').animate({scrollTop: offset}, 500);
	}
}

checkMenuLines = function(){
	if($('.front_page .menu-row .left_border').length || $('.front_page .menu-row .right_border').length)
	{
		var positionMenu = ($('.centered .menu-row .mega-menu table').length ? $('.centered .menu-row .mega-menu table').offset().left : 0),
			varFixLineWidth = ($('body').hasClass('with_decorate') &amp;&amp; window.matchMedia('(min-width: 1100px)').matches ? 126 : 7);

		$('.menu-row .left_border, .menu-row .right_border').css('width', positionMenu - varFixLineWidth);
	}
}

SetFixedAskBlock = function(){
	if($('.ask_a_question_wrapper').length)
	{
		var offset = $('.ask_a_question_wrapper').offset(),
			footer_offset = 0,
			block = $('.ask_a_question_wrapper').find('.ask_a_question'),
			block_offset = BX.pos(block[0]),
			block_height = block_offset.bottom-block_offset.top,
			diff_top_scroll = $('#headerfixed').height() + 20;

		if($('footer').length)
			footer_offset = $('footer').offset().top;

		if($('.banner.CONTENT_BOTTOM').length)
			footer_offset = $('.banner.CONTENT_BOTTOM').offset().top;

		/* removed for ISSUE NEXT-414
		if(block_height+130 &gt; block.closest('.fixed_wrapper').height())
			block.addClass('nonfixed');
		else
			block.removeClass('nonfixed');
		*/

		if(block_height+diff_top_scroll+documentScrollTopLast + 130 &gt; footer_offset)
		{
			block.removeClass('fixed').css({'top': 'auto', 'width': 'auto', 'bottom': 0});
			block.parent().css('position', 'static');
			block.parent().parent().css('position', 'static');
		}
		else
		{
			block.parent().removeAttr('style');
			block.parent().parent().removeAttr('style');

			if(documentScrollTopLast + diff_top_scroll &gt; offset.top)
			{
				var fixed_width = $('.fixed_block_fix').width();
				block.addClass('fixed').css({'top': diff_top_scroll, 'bottom': 'auto'});
				if(fixed_width)
					block.css({'width': $('.fixed_block_fix').width()})
			}
			else
				block.removeClass('fixed').css({'top': 0, 'width': 'auto'});
		}
	}
}

MegaMenuFixed = function(){
	var animationTime = 150,
		$megaFixedNlo = $('.mega_fixed_menu').find('[data-nlo]');

	$('header .burger, #headerfixed .burger').on('click', function(){
		if($megaFixedNlo.length){
	        if(!$megaFixedNlo.hasClass('nlo-loadings')){
	            $megaFixedNlo.addClass('nlo-loadings');
	            setTimeout(function(){
	                $.ajax({
	                    data: {nlo: $megaFixedNlo.attr('data-nlo')},
	                    success: function(response){
	                        $megaFixedNlo[0].insertAdjacentHTML('beforebegin', $.trim(response));
	                        $megaFixedNlo.remove();
	                    },
	                    error:function(){
	                        $megaFixedNlo.removeClass('nlo-loadings');
	                    }
	                });
	            }, 300);
	        }
	    }

		$('.mega_fixed_menu').fadeIn(animationTime);
		//$('.header_wrap').toggleClass('zindexed');
		$('.mega_fixed_menu').mCustomScrollbarDeferred({
			mouseWheel: {
				scrollAmount: 150,
				preventDefault: true
			}
		});
	});

	$('.mega_fixed_menu .svg.svg-close').on('click', function(){
		$(this).closest('.mega_fixed_menu').fadeOut(animationTime);
		//$('.header_wrap').toggleClass('zindexed');
	});

	$('.mega_fixed_menu .dropdown-menu .arrow').on('click', function(e){
		e.preventDefault();
		e.stopPropagation();
		$(this).closest('.dropdown-submenu').find('.dropdown-menu').slideToggle(animationTime);
		$(this).closest('.dropdown-submenu').addClass('opened');
	});
}

CheckPopupTop = function(){
	// var popup = $('.jqmWindow.show:last');
	// if(!popup.length)
	// 	popup = $('.jqmWindow.show');
	// if(!popup.length)
	// 	popup = $('.jqm-init.show');
	// if(popup.length){
	// 	var documentScollTop = $(document).scrollTop();
	// 	var windowHeight = $(window).height();
	// 	var popupTop = parseInt(popup.css('top'));
	// 	var popupHeight = popup.height();

	// 	if(windowHeight &gt;= popupHeight){
	// 		// center
	// 		popupTop = (windowHeight - popupHeight) / 2;
	// 	}
	// 	else{
	// 		if(documentScollTop &gt; documentScrollTopLast){
	// 			// up
	// 			popupTop -= documentScollTop - documentScrollTopLast;
	// 		}
	// 		else if(documentScollTop &lt; documentScrollTopLast){
	// 			// down
	// 			popupTop += documentScrollTopLast - documentScollTop;
	// 		}

	// 		if(popupTop + popupHeight &lt; windowHeight){
	// 			// bottom
	// 			popupTop = windowHeight - popupHeight;
	// 		}
	// 		else if(popupTop &gt; 0){
	// 			// top
	// 			popupTop = 0;
	// 		}
	// 	}
	// 	popup.css('top', popupTop + 'px');
	// }
}

AjaxClickLink = function(e){
	var _this = '',
		container = $('.js-load-wrapper'),
		container_inner = $('.js-load-wrapper').find('.ajax_load'),
		dopAction = '';
		url = '';
		if ('preventDefault' in e) {
			e.preventDefault();
			_this = ($(e.target).hasClass('js-load-link') ? $(e.target) : $(e.target).closest('.js-load-link'))
		}
		else
		{
			_this = $(e);
			dopAction = 'Y';
		}

	if (container.length) {
		var objUrl = parseUrlQuery(),
			obGetData = {"ajax_get_filter": "Y", "control_ajax": "Y"};

		obGetData.bitrix_include_areas = 'N';

		if ('clear_cache' in objUrl) {
			if (objUrl.clear_cache == 'Y') {
				obGetData.clear_cache = 'Y';
			}
		}

		if (container_inner.length) {
			container_inner.addClass('loading-state');
		} else {
			container.addClass('loading-state');
		}

		if (_this.data('url')) {
			url = _this.data('url');
		}

		if (_this.data('click_block') &amp;&amp; $(_this.data('click_block')).length) {
			if ($(_this.data('click_block')).data('url')) {
				url = $(_this.data('click_block')).data('url');
			}
		}

		if (dopAction) {
			BX.PopupWindowManager.getCurrentPopup().close();
			$('.bx_filter_select_popup ul li .sort_btn').removeClass('current');
			_this.addClass('current');
			_this.closest('.bx_filter_block').find('.bx_filter_select_text').text(_this.text());
		}

		$('.bx_filter .bx_sort_filter .bx_filter_select_text').text(_this.text());
		$('.bx_filter .bx_sort_filter .bx_filter_select_popup ul li span.current').removeClass('current');
		$('.bx_filter .bx_sort_filter .bx_filter_select_popup ul li').eq(_this.parent().index()).find('span').addClass('current');

		$.ajax({
			url: url,
			data: obGetData,
			success: function(html){
				container.html(html);

				if(container_inner.length)
					container_inner.removeClass('loading-state');
				else
					container.removeClass('loading-state');

				initAnimateLoad();

				var eventdata = {action: 'jsLoadBlock'}
				BX.onCustomEvent('onCompleteAction', [eventdata, _this]);

				initSelects(document);
				InitCustomScrollBar();
				InitScrollBar();

				if(window.FilterHelper !== undefined) {
					FilterHelper.resultDiv = $('#filter-helper');
					FilterHelper.show();
				}
			}
		})
	}
}

initCalculatePreview = function(){
	$('.calculate-delivery.with_preview:not(.inited)').each(function(){
		var $this = $(this);
		var $calculateSpan = $this.find('span[data-event=jqm]');
		var $preview = $this.find('.calculate-delivery-preview');

		$this.addClass('inited');
		$this.appear(function(){

			if($calculateSpan.length){
				if(typeof window['calculate-delivery-preview-index'] === 'undefined'){
					window['calculate-delivery-preview-index'] = 1001;
				}
				else{
					++window['calculate-delivery-preview-index'];
				}

				var productId = $calculateSpan.attr('data-param-product_id') * 1;
				var quantity = $calculateSpan.attr('data-param-quantity') * 1;

				if(productId &gt; 0){
					var areaIndexSended = window['calculate-delivery-preview-index'];
					$calculateSpan.data({areaIndex: areaIndexSended});

					$.ajax({
						url: arAsproOptions['SITE_DIR'] + 'ajax/delivery.php',
						type: 'POST',
						data: {
							is_preview: 'Y',
							index: areaIndexSended,
							product_id: productId,
							quantity: quantity
						},
						beforeSend: function(){
							$this.addClass('loadings');
						},
						success: function(response){
							var areaIndex = $calculateSpan.data('areaIndex');
							if(typeof areaIndex !== 'undefined' &amp;&amp; areaIndex == areaIndexSended){
								$calculateSpan.hide();
								$preview.html(response);
								if(!$preview.find('.catalog-delivery-preview').length){
									$preview.empty();
									$calculateSpan.show();
								}
							}
						},
						error: function(xhr, ajaxOptions, thrownError){
						},
						complete: function(){
							var areaIndex = $calculateSpan.data('areaIndex');
							if(typeof areaIndex !== 'undefined' &amp;&amp; areaIndex == areaIndexSended){
								$this.removeClass('loadings');
							}
						}
					});
				}
			}

		}, {accX: 0, accY: 0});
	});
}

/*set price item*/
if(!funcDefined('setPriceItem')){
	var setPriceItem = function setPriceItem(main_block, quantity, rewrite_price, check_quantity, is_sku, show_percent, percent){
		var old_quantity = main_block.find('.to-cart').attr('data-ratio'),
			value = (typeof rewrite_price !== 'undefined' &amp;&amp; rewrite_price ? rewrite_price : main_block.find('.to-cart').attr('data-value')),
			currency = main_block.find('.to-cart').attr('data-currency'),
			total_block = '&lt;div class="total_summ" style="display:none;"&gt;&lt;div&gt;'+BX.message('TOTAL_SUMM_ITEM')+'&lt;span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;',
			price_block = main_block.find('.cost.prices'),
			use_percent = (typeof show_percent !== 'undefined' &amp;&amp; show_percent == 'Y'),
			percent_number = (typeof percent !== 'undefined' &amp;&amp; percent),
			sku_checked = (main_block.find('.has_offer_prop').length ? 'Y' : 'N'),
			check = (typeof check_quantity !== 'undefined' &amp;&amp; check_quantity);

		if(main_block.find('.counter_wrapp + .wrapp-one-click').length)
		{
			if(!main_block.find('.wrapp-one-click .total_summ').length &amp;&amp; !is_sku)
				$(total_block).appendTo(main_block.find('.counter_wrapp + .wrapp-one-click'))
		}
		else if(main_block.find('.buy_block').length)
		{
			if(!main_block.find('.buy_block .total_summ').length &amp;&amp; !is_sku)
				$(total_block).appendTo(main_block.find('.buy_block'))
		}
		else if(main_block.find('.counter_wrapp').length)
		{
			if(!main_block.find('.counter_wrapp .total_summ').length &amp;&amp; !is_sku)
				$(total_block).appendTo(main_block.find('.counter_wrapp:first'))
		}
		if(main_block.find('.total_summ').length)
		{
			if(value &amp;&amp; currency)
			{
				if((1 == quantity &amp;&amp; old_quantity == quantity) || (typeof is_sku !== 'undefined' &amp;&amp; is_sku &amp;&amp; !check))
				{
					main_block.find('.total_summ').slideUp(50);
				}
				else
				{
					main_block.find('.total_summ span').html(BX.Currency.currencyFormat((value*quantity), currency, true));
					if(main_block.find('.total_summ').is(':hidden')/* || sku_checked == 'Y'*/)
						main_block.find('.total_summ').slideDown(100);
				}
			}
			else
			{
				main_block.find('.total_summ').slideUp(100);
			}
		}
	}
}

if(!funcDefined('getCurrentPrice')){
	var getCurrentPrice = function getCurrentPrice(price, currency, print_price){
		var val = '';
		var format_value = BX.Currency.currencyFormat(price, currency);
		if(print_price.indexOf(format_value) &gt;= 0)
		{
			val = print_price.replace(format_value, '&lt;span class="price_value"&gt;'+format_value+'&lt;/span&gt;&lt;span class="price_currency"&gt;');
			val += '&lt;/span&gt;';
		}
		else
		{
			val = print_price;
		}

		return val;
	}
}

if(!funcDefined('initAnimateLoad')){
	var initAnimateLoad = function initAnimateLoad(){
		$('.animate-load').click(function(){
			if(!jQuery.browser.mobile)
			{
					$(this).parent().addClass('loadings');
			}
		})
	}
}

$(document).ready(function(){
	//check width for menu and search
	CheckSearchWidth();
	MegaMenuFixed();
	InitScrollBar();

	/*ripple effect for buttons*/
	$.ripple(".btn", {
		debug: false, // Turn Ripple.js logging on/off
		on: 'mouseenter', // The event to trigger a ripple effect

		opacity: 0.4, // The opacity of the ripple
		color: "auto", // Set the background color. If set to "auto", it will use the text color
		multi: true, // Allow multiple ripples per element

		duration: 0.6, // The duration of the ripple

		easing: 'linear' // The CSS3 easing function of the ripple
	});
	/**/

	//ecommerce order
	if(arAsproOptions["PAGES"]["ORDER_PAGE"])
	{
		var arUrl = parseUrlQuery();
		if("ORDER_ID" in arUrl)
		{
			var _id = arUrl["ORDER_ID"];
			if(arAsproOptions['COUNTERS']['USE_FULLORDER_GOALS'] !== 'N')
			{
				var eventdata = {goal: 'goal_order_success', result: _id};
				dataLayer.push({event: 'goal_order_success'});
				BX.onCustomEvent('onCounterGoals', [eventdata])
				
				var eventdata_global = {goal: "total_leads"};
                BX.onCustomEvent('onCounterGoals', [eventdata_global]);
                
                var eventdata_global_alt = {goal: "znachimie_deistviya"};
                BX.onCustomEvent('onCounterGoals', [eventdata_global_alt]);
				dataLayer.push({event: 'znachimie_deistviya'});
				_tmr?.push({ type: 'reachGoal', id: 3466488, goal: 'znachimie_deistviya'});
			}
			if(checkCounters())
			{
				if(typeof localStorage !== 'undefined'){
					var val = localStorage.getItem('gtm_e_' + _id),
						d = '';
					try{
						d = JSON.parse(val);
					}
					catch(e){
						d = val
					}
					if(typeof d === 'object'){
						window.dataLayer = window.dataLayer || [];
						dataLayer.push({"event": arAsproOptions["COUNTERS"]['GOOGLE_EVENTS']['PURCHASE'], "ecommerce": d});
					}

					if(typeof localStorage !== 'undefined'){
						localStorage.removeItem('gtm_e_' + _id);
					}
				}
			}
		}
	}
	var bSafary = false;
	if(typeof jQuery.browser == 'object')
		bSafary = jQuery.browser.safari;
	else if(typeof browser == 'object')
		bSafary = browser.safari;
	if(!bSafary){
		CheckTopMenuPadding();
		CheckTopMenuOncePadding();
		CheckTopMenuDotted();
		CheckHeaderFixed();
		checkMenuLines();
		setTimeout(function() {$(window).resize();}, 150); // need to check resize flexslider &amp; menu
		setTimeout(function() {$(window).scroll();}, 250); // need to check position fixed ask block
	}
	else{
		setTimeout(function(){
			$(window).resize(); // need to check resize flexslider &amp; menu
			setTimeout(function(){
				CheckTopMenuPadding();
				CheckTopMenuOncePadding();
				CheckTopMenuDotted();
				CheckHeaderFixed();
				checkMenuLines();

				setTimeout(function(){
					$(window).scroll();
				}, 50);
			}, 50);
		}, 350);
	}


	/*for filter scrol in mobile*/
	if(window.matchMedia('(max-width: 767px)').matches){
		$('.bx_filter .scrollbar').addClass('mobile-scroll').removeClass('scroll-init');
		$('.bx_filter .srollbar-custom').addClass('mobile-scroll').removeClass('scroll-init');
		$('.bx_filter .bx_filter_section form .bx_filter_parameters').addClass('mobile-scroll').removeClass('scroll-init');
		if($('.bx_filter .mobile-scroll.scrollbar').length)
			$('.bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
		if($('.bx_filter .mobile-scroll.srollbar-custom').length)
			$('.bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
	}
	/**/

	if(arAsproOptions['THEME']['USE_DEBUG_GOALS'] === 'Y')
		$.cookie('_ym_debug', 1, {path: '/',});
	else
		$.cookie('_ym_debug', null, {path: '/',});

	/* change type2 menu for fixed */
	if($('#headerfixed .js-nav').length)
	{
		if(arAsproOptions['THEME']['HEADER_FIXED'] == 2)
			CheckHeaderFixedMenu();

		setTimeout(function(){
			$('#headerfixed .js-nav').addClass('opacity1');
		},350);
	}

	// -- scroll after apply option
	if($('.instagram_ajax').length)
	{
		BX.addCustomEvent('onCompleteAction', function(eventdata){
			if(eventdata.action === 'instagrammLoaded')
				scrollPreviewBlock();
		});
	}
	else
		scrollPreviewBlock();


	scrollToTop();
	checkVerticalMobileFilter();

	$('[data-scroll-block]').click(function() {
		var _this = $(this);
		if(_this.data('scrollBlock')) {
			var target = $(_this.data('scrollBlock'));
			if(target.length) {
				scroll_block(target);
			}
		}
	});

	$.extend( $.validator.messages, {
		required: BX.message('JS_REQUIRED'),
		email: BX.message('JS_FORMAT'),
		equalTo: BX.message('JS_PASSWORD_COPY'),
		minlength: BX.message('JS_PASSWORD_LENGTH'),
		remote: BX.message('JS_ERROR')
	});

	$.validator.addMethod(
		'regexp', function( value, element, regexp ){
			var re = new RegExp( regexp );
			return this.optional( element ) || re.test( value );
		},
		BX.message('JS_FORMAT')
	);

	$.validator.addMethod(
		'filesize', function( value, element, param ){
			return this.optional( element ) || ( element.files[0].size &lt;= param )
		},
		BX.message('JS_FILE_SIZE')
	);

	$.validator.addMethod(
		'date', function( value, element, param ) {
			var status = false;
			if(!value || value.length &lt;= 0){
				status = false;
			}
			else{
				// html5 date allways yyyy-mm-dd
				var re = new RegExp('^([0-9]{4})(.)([0-9]{2})(.)([0-9]{2})$');
				var matches = re.exec(value);
				if(matches){
					var composedDate = new Date(matches[1], (matches[3] - 1), matches[5]);
					status = ((composedDate.getMonth() == (matches[3] - 1)) &amp;&amp; (composedDate.getDate() == matches[5]) &amp;&amp; (composedDate.getFullYear() == matches[1]));
				}
				else{
					// firefox
					var re = new RegExp('^([0-9]{2})(.)([0-9]{2})(.)([0-9]{4})$');
					var matches = re.exec(value);
					if(matches){
						var composedDate = new Date(matches[5], (matches[3] - 1), matches[1]);
						status = ((composedDate.getMonth() == (matches[3] - 1)) &amp;&amp; (composedDate.getDate() == matches[1]) &amp;&amp; (composedDate.getFullYear() == matches[5]));
					}
				}
			}
			return status;
		}, BX.message('JS_DATE')
	);

	$.validator.addMethod(
		'extension', function(value, element, param){
			param = typeof param === 'string' ? param.replace(/,/g, '|') : 'png|jpe?g|gif';
			return this.optional(element) || value.match(new RegExp('.(' + param + ')$', 'i'));
		}, BX.message('JS_FILE_EXT')
	);

	$.validator.addMethod(
		'captcha', function( value, element, params ){
			return $.validator.methods.remote.call(this, value, element,{
				url: arAsproOptions['SITE_DIR'] + 'ajax/check-captcha.php',
				type: 'post',
				data:{
					captcha_word: value,
					captcha_sid: function(){
						return $(element).closest('form').find('input[name="captcha_sid"]').val();
					}
				}
			});
		},
		BX.message('JS_ERROR')
	);

	$.validator.addMethod(
		'recaptcha', function(value, element, param){
			var id = $(element).closest('form').find('.g-recaptcha').attr('data-widgetid');
			if(typeof id !== 'undefined'){
				return grecaptcha.getResponse(id) != '';
			}
			else{
				return true;
			}
		}, BX.message('JS_RECAPTCHA_ERROR')
	);

	$.validator.addClassRules({
		'phone':{
			regexp: arAsproOptions['THEME']['VALIDATE_PHONE_MASK']
		},
		'confirm_password':{
			equalTo: 'input[name="REGISTER\[PASSWORD\]"]',
			minlength: 6
		},
		'password':{
			minlength: 6
		},
		'inputfile':{
			extension: arAsproOptions['THEME']['VALIDATE_FILE_EXT'],
			filesize: 5000000
		},
		'captcha':{
			captcha: ''
		},
		'recaptcha':{
			recaptcha: ''
		}
	});

	if(arAsproOptions['THEME']['PHONE_MASK']){
		$('input.phone').inputmask('mask', {'mask': arAsproOptions['THEME']['PHONE_MASK']});
	}

	// init calculate delivery with preview
	initCalculatePreview();

	/*city*/
	$('select.region').on('change', function(){
		var val = parseInt($(this).val());
		if($('select.city').length)
		{
			if(val)
			{
				$('select.city option').hide();
				$('select.city option').prop('disabled', 'disabled');
				$('select.city option[data-parent_section='+val+']').prop('disabled', '');
				$('select.city option:eq(0)').prop('disabled', '');
				$('select.city').ikSelect('reset');
				$('select.city option[data-parent_section='+val+']').show();
			}
			else
				$('select.city option').prop('disabled', 'disabled');
				$('select.city option:eq(0)').prop('disabled', '');
				$('select.city').ikSelect('reset');
		}
	})

	$('select.city, select.region').on('change', function(){
		var _this = $(this),
			val = parseInt(_this.val());
		if(_this.hasClass('region'))
		{
			$('select.city option:eq(0)').show();
			$('select.city').val(0);
		}

		if((_this.hasClass('region') &amp;&amp; !val) || _this.hasClass('city'))
		{
			$.ajax({
				type: 'POST',
				data: {ID: val},
			}).success(function(html){
				var ob = BX.processHTML(html);
				$('.ajax_items')[0].innerHTML = ob.HTML;
				BX.ajax.processScripts(ob.SCRIPT);
			})
		}
	})

	$(document).on('mouseenter', '.section-gallery-wrapper .section-gallery-wrapper__item', function(){
		$(this).siblings().removeClass('_active');
		$(this).addClass('_active');
	});

	const elementGalleryWrapper = document.querySelectorAll('.section-gallery-wrapper');

	const turnToDefaultState = event =&gt; Array.prototype.forEach.call( event.target.children, (element, index) =&gt; index === 0 ? element.classList.add('_active') : element.classList.remove('_active') )

	if (elementGalleryWrapper) {
		elementGalleryWrapper.forEach(element=&gt;element.addEventListener('mouseleave', turnToDefaultState))
	}

	$(document).on('click', ".hint .icon", function(e){
		var tooltipWrapp = $(this).parents(".hint");

		if(tooltipWrapp.hasClass("active")){
			tooltipWrapp.removeClass("active").find(".tooltip").slideUp(200);
		}
		else{
			tooltipWrapp.addClass("active");
			tooltipWrapp.find(".tooltip").slideDown(200);
			tooltipWrapp.find(".tooltip_close").click(function(e){
				e.stopPropagation(); tooltipWrapp.removeClass("active").find(".tooltip").slideUp(100);
			});
		}
		e.stopPropagation();
	});

	$('.mobile_regions .city_item').on('click', function(e){
    	e.preventDefault();
    	var _this = $(this);
    	$.removeCookie('current_region');
		$.cookie('current_region', _this.data('id'), {path: '/',domain: arAsproOptions['SITE_ADDRESS']});
		location.href = _this.attr('href');
    })

	/* toggle */
	var $this = this,
		previewParClosedHeight = 25;

	$('section.toggle &gt; label').prepend($('&lt;i /&gt;').addClass('fa fa-plus'));
	$('section.toggle &gt; label').prepend($('&lt;i /&gt;').addClass('fa fa-minus'));
	$('section.toggle.active &gt; p').addClass('preview-active');
	$('section.toggle.active &gt; div.toggle-content').slideDown(350, function() {});

	$('section.toggle &gt; label').click(function(e){
		var parentSection = $(this).parent(),
			parentWrapper = $(this).parents('div.toogle'),
			previewPar = false,
			isAccordion = parentWrapper.hasClass('toogle-accordion');

		if(isAccordion &amp;&amp; typeof(e.originalEvent) != 'undefined') {
			parentWrapper.find('section.toggle.active &gt; label').trigger('click');
		}

		parentSection.toggleClass('active');

		// Preview Paragraph
		if( parentSection.find('&gt; p').get(0) ){
			previewPar = parentSection.find('&gt; p');
			var previewParCurrentHeight = previewPar.css('height');
			previewPar.css('height', 'auto');
			var previewParAnimateHeight = previewPar.css('height');
			previewPar.css('height', previewParCurrentHeight);
		}

		// Content
		var toggleContent = parentSection.find('&gt; div.toggle-content');

		if( parentSection.hasClass('active') ){
			$(previewPar).animate({
				height: previewParAnimateHeight
			}, 350, function() {
				$(this).addClass('preview-active');
			});
			toggleContent.slideDown(350, function() {});
		}
		else{
			$(previewPar).animate({
				height: previewParClosedHeight
			}, 350, function() {
				$(this).removeClass('preview-active');
			});
			toggleContent.slideUp(350, function() {});
		}
	});

	if( typeof $.fn.footable == 'function' ) {
		$('.tables-responsive .responsive').footable(); //responsive table
	}

	$('a[rel=tooltip]').tooltip();
	$('span[data-toggle=tooltip]').tooltip();

	$('.toggle .more_items').on('click', function(){
		$(this).closest('.toggle').find('.collapsed').css('display','inline-block').removeClass('collapsed');
		$(this).remove();
		if(typeof $(this).data('resize') !== 'undefined' &amp;&amp; $(this).data('resize'))
			$(window).resize();
	})
	$('.toggle_menu .more_items').on('click', function(){
		$(this).closest('.toggle_menu').find('.collapsed').addClass('clicked_exp');
		$(this).remove();
	})

	/* search sync */
	$(document).on('keyup', '.search-input-div input', function(e){
		var inputValue = $(this).val();
		$('.search-input-div input:not(:focus').val(inputValue);

		if($(this).closest('#headerfixed').length)
		{
			if(e.keyCode == 13)
				$('.search form').submit();
		}
	});
	$(document).on('click', '.search-button-div button', function(e){
		if($(this).closest('#headerfixed').length)
			$('.search form').submit();
	});

	$('.inline-search-show, .inline-search-hide').on('click', function(e){
		CloseMobilePhone();
		// if(window.matchMedia('(min-width: 600px)').matches)
		// {
			if(typeof($(this).data('type_search')) != 'undefined' &amp;&amp; $(this).data('type_search') == 'fixed')
				$('.inline-search-block').addClass('fixed');

			if(arAsproOptions['THEME']['TYPE_SEARCH'] == 'fixed'){
				/*setTimeout(function(){
					$('.inline-search-block.fixed.big .search-input').focus();
				}, 200);*/
				$('.inline-search-block.fixed.big .search-input').focus();
			}
			if(arAsproOptions['THEME']['TYPE_SEARCH'] != 'fixed')
			{
				$('#title-search-input').focus();
			}

			$('.inline-search-block').toggleClass('show');
			if($('.top-block').length)
			{
				if($('.inline-search-block').hasClass('show'))
					$('.inline-search-block').css('background', $('.top-block').css('background-color'));
				else
					$('.inline-search-block').css('background', '#fff');
			}
			if(arAsproOptions['THEME']['TYPE_SEARCH'] == 'fixed')
			{
				if($('.inline-search-block').hasClass('show'))
					$('&lt;div class="jqmOverlay search"&gt;&lt;/div&gt;').appendTo('body');
				else{
					$('#title-search-input').blur();
					$('.jqmOverlay').detach();
				}
			}
		// }
		// else
		// 	location.href = arAsproOptions['PAGES']['CATALOG_PAGE_URL']+'?q';
	})

	/* close search block */
	$("html, body").on('mousedown', function(e){
		if(typeof e.target.className == 'string' &amp;&amp; e.target.className.indexOf('adm') &lt; 0)
		{
			e.stopPropagation();
			var search_target = $(e.target).closest('.title-search-result');
			if(!$(e.target).hasClass('inline-search-block') &amp;&amp; !$(e.target).hasClass('svg') &amp;&amp; !search_target.length)
			{
				$('.inline-search-block').removeClass('show');
				$('.title-search-result').hide();
				if(arAsproOptions['THEME']['TYPE_SEARCH'] == 'fixed')
					$('.jqmOverlay.search').detach();
			}

			if($("#mobilePhone").length){
                CloseMobilePhone();
            }

			if($('#basket_line .basket_fly').length &amp;&amp; parseInt($("#basket_line .basket_fly").css("right")) &gt;= 0){
				if(!$(e.target).closest('.basket_wrapp').length)
				{
					$("#basket_line .basket_fly").stop().animate({"right": -$("#basket_line .basket_fly").outerWidth()}, 150);
					$("#basket_line .basket_fly .opener &gt; div").removeClass("cur");
					$('#basket_line .basket_fly').removeClass('swiped');
				}
			}

			if(isMobile)
			{
				if(search_target.length)
					location.href = search_target.attr('href');
			}

			if(!$(e.target).closest('.js-info-block').length &amp;&amp; !$(e.target).closest('.js-show-info-block').length)
			{
				$('.js-show-info-block').removeClass('opened');
				$('.js-info-block').fadeOut();
			}

			var class_name = $(e.target).attr('class');
			if(typeof(class_name) == 'undefined' || class_name.indexOf('tooltip') &lt; 0) //tooltip link
				$('.tooltip-link').tooltip('hide');
		}
	});
	$('.inline-search-block').find('*').on('mousedown', function(e){
		e.stopPropagation();
	});

	initAnimateLoad();

	/*check all opt table items*/
	$(document).on('change', "input#select_all_items", function(){
		var _this = $(this);

		var notOfferCount = $('.table-view__item:not([data-product_type=3])').find('.button_block .to-cart').length;
		var wishCount = $('.table-view__item:not([data-product_type=3])').find('.item-icons .wish_item_button .wish_item.to').length;
		var allGoodsCount = $('.table-view__item').length;

		if(_this.is(':checked'))
		{
			//$('.opt_action').removeClass('no-action');

			//buy &amp;&amp; wish
			if(notOfferCount != 0){
				$('.opt_action:not([data-action=compare])').removeClass('no-action');
			}

			//compare
			$('.opt_action[data-action=compare]').removeClass('no-action');


			$('.opt_action').addClass('animate-load');
			$('.opt_action .text').remove();
			//$('&lt;div class="text muted"&gt;(&lt;span&gt;'+$('.table-view__item').length+'&lt;/span&gt;)&lt;/div&gt;').appendTo($('.opt_action'));
			//$('&lt;div class="text muted"&gt;(&lt;span&gt;' + $('.table-view__item:not([data-product_type=3])').length + '&lt;/span&gt;)&lt;/div&gt;').appendTo($('.opt_action'));

			//buy
			$('&lt;div class="text muted"&gt;(&lt;span&gt;' + notOfferCount + '&lt;/span&gt;)&lt;/div&gt;').appendTo($('.opt_action[data-action=buy]'));

			//wish
			$('&lt;div class="text muted"&gt;(&lt;span&gt;' + wishCount + '&lt;/span&gt;)&lt;/div&gt;').appendTo($('.opt_action[data-action=wish]'));

			//compare
			$('&lt;div class="text muted"&gt;(&lt;span&gt;' + allGoodsCount + '&lt;/span&gt;)&lt;/div&gt;').appendTo($('.opt_action[data-action=compare]'));


			$('input[name="chec_item"]').prop('checked', 'checked');
		}
		else
		{
			$('.opt_action').addClass('no-action');
			$('.opt_action').removeClass('animate-load');
			$('.opt_action .text').remove();

			$('input[name="chec_item"]').removeAttr('checked');
		}
	})

	/*check opt table item*/
	$(document).on('change', "input[name='chec_item']", function(){
		var _this = $(this);

		var canBuy = _this.closest('.table-view__item').find('.button_block .to-cart').length;
		var isOffer = _this.closest('.main_item_wrapper').attr('data-product_type') == '3';

		if(_this.is(':checked'))
		{
			$('.opt_action').each(function(){
				var _this = $(this);

				var isBuyAction = _this.attr('data-action') == 'buy';
				var isWishAction = _this.attr('data-action') == 'wish';

				if(isOffer &amp;&amp; (isBuyAction || isWishAction)){
					return true;
				}

				if(isBuyAction &amp;&amp; !canBuy) {
					return true;
				}

				if(_this.find('.text').length)
				{
					var count = parseInt(_this.find('.text span').text());
					_this.find('.text span').text(++count);
				}
				else
				{
					_this.removeClass('no-action');
					_this.addClass('animate-load');
					$('&lt;div class="text muted"&gt;(&lt;span&gt;1&lt;/span&gt;)&lt;/div&gt;').appendTo(_this);
				}
			})
		}
		else
		{
			$('.opt_action').each(function(){
				var _this = $(this);

				var isBuyAction = _this.attr('data-action') == 'buy';
				var isWishAction = _this.attr('data-action') == 'wish';

				if(isOffer &amp;&amp; (isBuyAction || isWishAction)){
					return true;
				}

				if(isBuyAction &amp;&amp; !canBuy) {
					return true;
				}

				if(_this.find('.text').length)
				{
					var count = parseInt(_this.find('.text span').text());
					--count
					_this.find('.text span').text(count);

					if(!count)
					{
						_this.addClass('no-action');
						_this.removeClass('animate-load');
						_this.find('.text').remove();
					}
				}
			})
		}
	})

	/*buy|wish|compare opt table items*/
	$(document).on('click', ".opt_action", function(){
		var _this = $(this),
			action = _this.data('action'),
			basketParams = {
				type: 'multiple',
				iblock_id: _this.data('iblock_id'),
				action: action,
				items: {}
			};

		if(!_this.hasClass('no-action'))
		{
			$('.opt_action').addClass('no-action');
			_this.removeClass('no-action');

			$('.table-view__item').each(function(){
				var _this = $(this);
				var canBuy = _this.find('.button_block .to-cart').length;
				var add = _this.find('input[name="chec_item"]').is(':checked') &amp;&amp; (canBuy || (action != "buy") );
				if(add)
				{
					basketParams['items'][_this.data('id')] = {};
					basketParams['items'][_this.data('id')]['id'] = _this.data('id');
					basketParams['items'][_this.data('id')]['product_type'] = _this.data('product_type');
					basketParams['items'][_this.data('id')]['quantity'] = _this.find('input[name="quantity"]').val();
				}
			})
			$.ajax({
				type:"POST",
				url:arAsproOptions['SITE_DIR']+"ajax/item.php",
				data:basketParams,
				dataType:"json",
				success:function(data){
					if("STATUS" in data)
					{
						if(data.STATUS !== 'OK')
						{
							showBasketError(BX.message(data.MESSAGE)+' &lt;br/&gt;'+data.MESSAGE_EXT);
						}
						if($('.header-cart.fly').length)
						{
							arBasketAsproCounters.DEFAULT = true;
							SetActualBasketFlyCounters(true);
						}
						else
						{
							if($("#ajax_basket").length)
								reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'N', '', true);
							else
								reloadBasketCounters('', true);
						}
					}
					_this.parent().removeClass('loadings');
					$('.opt_action').removeClass('no-action');
				}
			})
		}
	})



	//fix opt checked for back in browser
	setTimeout(function(){
		if($('.with-opt-buy input[name="chec_item"], .with-opt-buy input[name="select_all_items"]').length){
			$('.with-opt-buy input[name="chec_item"], .with-opt-buy input[name="select_all_items"]').prop('checked', false);
		}
	},1);



	/*check mobile device*/
	if(isMobile){
		$(document).on('click', '*[data-event="jqm"]', function(e){

			e.preventDefault();
			e.stopPropagation();
			var _this = $(this);
			var name = _this.data('name');

			if((window.matchMedia('(min-width:768px)').matches || (typeof _this.data('no-mobile') !== 'undefinde' &amp;&amp; _this.data('no-mobile') == 'Y')))
			{
				if(!$(this).hasClass('clicked'))
				{
					$(this).addClass('clicked');
					$(this).jqmEx();
					$(this).trigger('click');
				}
				return false;
			}
			else if(name.length){
				var script = arAsproOptions['SITE_DIR'] + 'form/';
				var paramsStr = ''; var arTriggerAttrs = {};
				$.each(_this.get(0).attributes, function(index, attr){
					var attrName = attr.nodeName;
					var attrValue = _this.attr(attrName);
					arTriggerAttrs[attrName] = attrValue;
					if(/^data\-param\-(.+)$/.test(attrName)){
						var key = attrName.match(/^data\-param\-(.+)$/)[1];
						paramsStr += key + '=' + attrValue + '&amp;';
					}
				});

				var triggerAttrs = JSON.stringify(arTriggerAttrs);
				var encTriggerAttrs = encodeURIComponent(triggerAttrs);
				script += '?name=' + name + '&amp;' + paramsStr + 'data-trigger=' + encTriggerAttrs;

				if (previewMode &amp;&amp; _this.attr('href') !== undefined) {
					script = _this.attr('href')
				}

				location.href = script;
			}
		});

		$('.fancybox').removeClass('fancybox');
	}
	else
	{
		$(document).on('click', '*[data-event="jqm"]', function(e){
			e.preventDefault();
			e.stopPropagation();

			var _this = $(this);
			var name = _this.data('name');
			if (previewMode &amp;&amp; ((name.length &amp;&amp; name == 'auth') || window.matchMedia('(max-width:400px)').matches)) {

				var script = arAsproOptions['SITE_DIR'] + 'form/';
				var paramsStr = ''; var arTriggerAttrs = {};
				$.each(_this.get(0).attributes, function(index, attr){
					var attrName = attr.nodeName;
					var attrValue = _this.attr(attrName);
					arTriggerAttrs[attrName] = attrValue;
					if(/^data\-param\-(.+)$/.test(attrName)){
						var key = attrName.match(/^data\-param\-(.+)$/)[1];
						paramsStr += key + '=' + attrValue + '&amp;';
					}
				});

				var triggerAttrs = JSON.stringify(arTriggerAttrs);
				var encTriggerAttrs = encodeURIComponent(triggerAttrs);
				script += '?name=' + name + '&amp;' + paramsStr + 'data-trigger=' + encTriggerAttrs;

				if (_this.attr('href') !== undefined) {
					script = _this.attr('href')
				}

					location.href = script;
			} else {
				if(!$(this).hasClass('clicked'))
				{
					$(this).addClass('clicked');
					$(this).jqmEx();
					$(this).trigger('click');
				}
			}

			return false;
		});
	}

	BX.addCustomEvent('onCompleteAction', function(eventdata, _this){
		try{
			if(eventdata.action === 'loadForm')
			{
				$(_this).parent().removeClass('loadings');
				$(_this).removeClass('clicked');

				if($(_this).hasClass('one_click_buy_trigger'))
				{
					$('.wrapp_one_click &gt; span').removeClass('clicked')
					$('.one_click').removeClass('clicked')
				}
				else if($(_this).hasClass('one_click_buy_basket_trigger'))
				{
					$('.fast_order').removeClass('clicked')
				}
			}
			else if(eventdata.action === 'loadBasket')
			{
				$('.basket-link.basket').attr('title', $('&lt;div/&gt;').html(arBasketPrices.BASKET_SUMM_TITLE).text());
				$('.basket-link.delay').attr('title', $('&lt;div/&gt;').html(arBasketPrices.DELAY_SUMM_TITLE).text());

				if(arBasketPrices.BASKET_COUNT&gt;0)
				{
					$('.basket-link.basket').addClass('basket-count');
					$('.basket-link.basket .count').removeClass('empted');
					if($('.basket-link.basket .prices').length)
						$('.basket-link.basket .prices').html(arBasketPrices.BASKET_SUMM);
				}
				else
				{
					$('.basket-link.basket').removeClass('basket-count');
					$('.basket-link.basket .count').addClass('empted');
					if($('.basket-link.basket .prices').length)
						$('.basket-link.basket .prices').html(arBasketPrices.BASKET_SUMM_TITLE_SMALL);
				}
				$('.basket-link.basket .count').text(arBasketPrices.BASKET_COUNT);
				if(arBasketPrices.DELAY_COUNT&gt;0)
				{
					$('.basket-link.delay').addClass('basket-count');
					$('.basket-link.delay .count').removeClass('empted');
				}
				else
				{
					$('.basket-link.delay').removeClass('basket-count');
					$('.basket-link.delay .count').addClass('empted');
				}
				$('.basket-link.delay .count').text(arBasketPrices.DELAY_COUNT);

				updateBottomIconsPanel(arBasketPrices);
			}
			else if(eventdata.action === 'loadActualBasketCompare')
			{
				var compare_count = Object.keys(arBasketAspro.COMPARE).length;
				if(compare_count&gt;0)
				{
					$('.basket-link.compare').addClass('basket-count');
					$('.basket-link.compare .count').removeClass('empted');
					if($('#compare_fly').length)
						$('#compare_fly').removeClass('empty_block');
				}
				else
				{
					$('.basket-link.compare').removeClass('basket-count');
					$('.basket-link.compare .count').addClass('empted');
					if($('#compare_fly').length)
						$('#compare_fly').addClass('empty_block');
				}
				$('.basket-link.compare .count').text(compare_count);

				updateBottomIconsPanel(arBasketAspro);
			}
			else if(eventdata.action === 'loadRSS')
			{
			}
			else if(eventdata.action === 'ajaxContentLoaded')
			{
			}
			else if(eventdata.action === 'jsLoadBlock')
			{
				initCountdown();
				setStatusButton();
				InitFlexSlider();
				InitOwlSlider();
				InitFancyBox();

				checkLinkedArticles();
				lazyLoadPagenBlock();

				if(typeof window['stickySidebar'] !== 'undefined')
				{
					window['stickySidebar'].updateSticky();
				}
			}
		}
		catch(e){
			console.error(e)
		}
	})

	/*slices*/
	if($('.banners-small .item.normal-block').length)
		$('.banners-small .item.normal-block').sliceHeight();
	if($('.teasers .item').length)
		$('.teasers .item').sliceHeight();
	if($('.wrap-portfolio-front .row.items &gt; div').length)
		$('.wrap-portfolio-front .row.items &gt; div').sliceHeight({'row': '.row.items', 'item': '.item1'});

	/* bug fix in ff*/
	$('img').removeAttr('draggable');

	$('.title-tab-heading').on('click', function(){
		var container = $(this).parent(),
			slide_block = $(this).next(),
			bReviewTab = container.hasClass('media_review');

		clicked_tab = container.index()+1;

		container.siblings().removeClass('active');

		$('.nav.nav-tabs li').removeClass('active');

		if(container.hasClass('active'))
		{
			if(bReviewTab)
			{
				$('#reviews_content').slideUp(200, function(){
					container.removeClass('active');
				});
			}
			else
			{
				slide_block.slideUp(200, function(){
					container.removeClass('active');
				});
			}
		}
		else
		{
			container.addClass('active');
			if(bReviewTab)
			{
				$('#reviews_content').slideDown();
			}
			else
			{
				if($('.tabs_section + #reviews_content').length)
					$('.tabs_section + #reviews_content').slideUp();
				slide_block.slideDown();
				if(typeof container.attr('id') !== 'undefined' &amp;&amp; container.attr('id') == 'descr'){
					var $gallery = $('.galerys-block');
					if($gallery.length){
						var bTypeBig = $gallery.find('.big_slider').length;
						var $slider = bTypeBig ? $gallery.find('.big_slider') : $gallery.find('.small_slider');
						InitFlexSlider();
						var interval = setInterval(function(){
							if($slider.find('.slides .item').attr('style').indexOf('height') === -1){
								$(window).resize();
							}
							else{
								clearInterval(interval);
							}
						}, 100);
					}
				}
			}
		}
	})

	InitFlexSlider();
	InitOwlSlider();
	InitStickySideBar();
	InitFancyBox();
	InitFancyBoxVideo();

	setTimeout(function(){
		InitTopestMenuGummi();
		isOnceInited = true;
	},50);

	InitZoomPict();

	$(document).on('click', '.captcha_reload', function(e){
		var captcha = $(this).parents('.captcha-row');
		e.preventDefault();
		$.ajax({
			url: arAsproOptions['SITE_DIR'] + 'ajax/captcha.php'
		}).done(function(text){
			captcha.find('input[name=captcha_sid],input[name=captcha_code]').val(text);
			captcha.find('img').attr('src', '/bitrix/tools/captcha.php?captcha_sid=' + text);
			captcha.find('input[name=captcha_word]').val('').removeClass('error');
			captcha.find('.captcha_input').removeClass('error').find('.error').remove();
		});
	});

	/* show print */
	if(arAsproOptions["PAGES"]["BASKET_PAGE"])
	{
		const pageUrl = new URL(location.href),
			  printLinkUrl = `${pageUrl.pathname}?PRINT=Y`;
		if(arAsproOptions["THEME"]["SHOW_BASKET_PRINT"]=="Y")
		{
			if($('.page-top h1').length)
				$('&lt;div&gt;&lt;a target="_blank" href="'+printLinkUrl+'" class="print-link colored_theme_hover_bg-block" title="'+arAsproOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"]+'"&gt;&lt;i class="svg colored_theme_hover_bg-el-svg"&gt;&lt;svg class="svg svg-print" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"&gt;&lt;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)"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/i&gt;&lt;/a&gt;&lt;/div&gt;').insertBefore($('.page-top .topic .topic__heading'));

		}
	}
	else
	{
		if(arAsproOptions['THEME']['PRINT_BUTTON'] == 'Y')
		{
			setTimeout(function(){

				if($('.period_wrapper.in-detail-news1 .period_wrapper_inner').length)
				{
					$('&lt;div class="print-link colored_theme_hover_bg-block" title="'+arAsproOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"]+'"&gt;&lt;i class="svg colored_theme_hover_bg-el-svg"&gt;&lt;svg class="svg svg-print" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"&gt;&lt;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)"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/i&gt;&lt;/div&gt;').insertBefore($('.detail-news1 .period_wrapper .period_wrapper_inner'));
				}else if($('.page-top .topic .topic__heading').length)
				{
					$('&lt;div class="print-link colored_theme_hover_bg-block" title="'+arAsproOptions["THEME"]["EXPRESSION_FOR_PRINT_PAGE"]+'"&gt;&lt;i class="svg colored_theme_hover_bg-el-svg"&gt;&lt;svg class="svg svg-print" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"&gt;&lt;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)"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/i&gt;&lt;/div&gt;').insertBefore($('.page-top .topic .topic__heading'));
				}


			},150);
		}
	}

	$('.head-block .item-link').on('click', function(){
		var _this = $(this);
		_this.siblings().removeClass('active');
		_this.addClass('active');
	})

	$('table.table').each(function(){
		var _this = $(this),
			first_td = _this.find('thead tr th');
		if(!first_td.length)
			first_td = _this.find('thead tr td');
		if(first_td.length)
		{
			var j = 0;
			_this.find('tbody tr td').each(function(i){
				if(j &gt; first_td.length-1)
					j = 0;
				$('&lt;div class="th-mobile"&gt;'+first_td[j].textContent+'&lt;/div&gt;').appendTo($(this));
				j++;
			})
		}
	})

	if(window.matchMedia('(min-width: 768px)').matches)
		$('.wrapper_middle_menu.wrap_menu').removeClass('mobile');


	if(window.matchMedia('(max-width: 767px)').matches)
		$('.wrapper_middle_menu.wrap_menu').addClass('mobile');



	$('.menu_top_block .v_bottom a').on('click', function(e){
		if($(e.target).hasClass('toggle_block'))
			e.preventDefault();
	})
	$('.menu_top_block .v_bottom a .toggle_block').click(function(e){
		var _this = $(this),
			menu = _this.closest('.has-child').find('&gt; .dropdown'),
			bVisibleMeu = (menu.is(':visible')),
			animate = (bVisibleMeu ? 'slideUp' : 'slideDown');

		if(!_this.hasClass('clicked'))
		{
			_this.addClass('clicked');


			menu.velocity('stop').velocity(animate, {
				duration: 150,
				// delay: 250,
				begin: function(){
					_this.toggleClass('closed');
				},
				complete: function(){
					_this.removeClass('clicked');

					if(typeof window['stickySidebar'] !== 'undefined')
						window['stickySidebar'].updateSticky();
				}
			});
		}

		$(this).closest('.has-child').toggleClass('opened');
	})

	$(document).on('click', '.show_props', function(){
		$(this).prev().stop().slideToggle(333);
		$(this).find('.char_title').toggleClass('opened');
	});

	$('.see_more').on('click', function(e) {
		e.preventDefault();
		var see_more = ($(this).is('.see_more') ? $(this) : $(this).parents('.see_more').first());
		var see_moreText = (see_more.find('&gt; a').length ? see_more.find('&gt; a') : see_more);
		var see_moreHiden = see_more.parent().find('&gt; .d');
		if(see_more.hasClass('open')){
			see_moreText.text(BX.message('CATALOG_VIEW_MORE'));
			see_more.removeClass('open');
			see_moreHiden.hide();
		}
		else{
			see_moreText.text(BX.message('CATALOG_VIEW_LESS'));
			see_more.addClass('open');
			see_moreHiden.show();
		}
		return false;
	});

	$('.button.faq_button').click(function(e){
		e.preventDefault();
		$(this).toggleClass('opened');
		$('.faq_ask .form').slideToggle();
	});

	$('.staff.list .staff_section .staff_section_title a').click(function(e) {
		e.preventDefault();
		$(this).parents('.staff_section').toggleClass('opened');
		$(this).parents('.staff_section').find('.staff_section_items').stop().slideToggle(600);
		$(this).parents('.staff_section_title').find('.opener_icon').toggleClass('opened');
	});

	$('.jobs_wrapp .item .name').click(function(e) {
		$(this).closest('.item').toggleClass('opened');
		$(this).closest('.item').find('.description_wrapp').stop().slideToggle(600);
		$(this).closest('.item').find('.opener_icon').toggleClass('opened');
	});

	$('.faq.list .item .q a').on('click', function(e){
		e.preventDefault();
		$(this).parents('.item').toggleClass('opened');
		$(this).parents('.item').find('.a').stop().slideToggle();
		$(this).parents('.item').find('.q .opener_icon').toggleClass('opened');
	});

	$('.opener_icon').click(function(e) {
		e.preventDefault();
		$(this).parent().find('a').trigger('click');
	});

	$('.dotdot').dotdotdot();

	$('.more_block span').on('click', function() {
		var content_offset=$('.catalog_detail .tabs_section').offset();
		$('html, body').animate({scrollTop: content_offset.top-43}, 400);
	});

	$(document).on("click", ".counter_block:not(.basket) .plus", function(){
		if(!$(this).parents('.basket_wrapp').length){
			if($(this).parent().data("offers")!="Y"){
				var isDetailSKU2 = $(this).parents('.counter_block_wr').length;
					input = $(this).parents(".counter_block").find("input[type=text]")
					tmp_ratio = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
					isDblQuantity = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
					ratio=( isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
					max_value='';
					currentValue = input.val();


				if(isDblQuantity)
					ratio = Math.round(ratio*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor;

				curValue = (isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10));

				curValue += ratio;
				if (isDblQuantity){
					curValue = Math.round(curValue*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor;
				}
				if(parseFloat($(this).data('max'))&gt;0){
					if(input.val() &lt; $(this).data('max')){
						if(curValue&lt;=$(this).data('max'))
							input.val(curValue);

						input.change();
					}
				}else{
					input.val(curValue);
					input.change();
				}
			}
		}
	});
	$(document).on("click", ".counter_block:not(.basket) .minus", function(){
		if(!$(this).parents('.basket_wrapp').length){
			if($(this).parent().data("offers")!="Y"){
				var isDetailSKU2 = $(this).parents('.counter_block_wr').length;
					input = $(this).parents(".counter_block").find("input[type=text]")
					tmp_ratio = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('ratio'),
					isDblQuantity = !isDetailSKU2 ? $(this).parents(".counter_wrapp").find(".to-cart").data('float_ratio') : $(this).parents('tr').first().find("td.buy .to-cart").data('float_ratio'),
					ratio=( isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
					max_value='';
					currentValue = input.val();

				if(isDblQuantity)
					ratio = Math.round(ratio*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor;

				curValue = (isDblQuantity ? parseFloat(currentValue) : parseInt(currentValue, 10));

				curValue -= ratio;
				if (isDblQuantity){
					curValue = Math.round(curValue*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor;
				}

				if(parseFloat($(this).parents(".counter_block").find(".plus").data('max'))&gt;0){
					if(currentValue &gt; ratio){
						if(curValue&lt;ratio){
							input.val(ratio);
						}else{
							input.val(curValue);
						}
						input.change();
					}
				}else{
					if(curValue &gt; ratio){
						input.val(curValue);
					}else{
						if(ratio){
							input.val(ratio);
						}else if(currentValue &gt; 1){
							input.val(curValue);
						}
					}
					input.change();
				}
			}
		}
	});

	$('.counter_block input[type=text]').numeric({allow:"."});

	$(document).on("focus", ".counter_block input[type=text]", function(e){
		$(this).addClass('focus');
	})

	$(document).on("blur", ".counter_block input[type=text]", function(e){
		$(this).removeClass('focus');
	})

	var timerInitCalculateDelivery = false;
	$(document).on("change", ".counter_block input[type=text]", function(e){
		if(!$(this).parents('.basket_wrapp').length){
			var val = $(this).val(),
				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'),
				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'),
				ratio=( isDblQuantity ? parseFloat(tmp_ratio) : parseInt(tmp_ratio, 10)),
				diff = val % ratio;

			if(isDblQuantity)
			{
				ratio = Math.round(ratio*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor;
				if(Math.round(diff*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor == ratio)
					diff = 0;
			}

			if($(this).hasClass('focus'))
			{
				intCount = Math.round(
					Math.round(val * arAsproOptions.JS_ITEM_CLICK.precisionFactor / ratio) / arAsproOptions.JS_ITEM_CLICK.precisionFactor
				) || 1;
				val = (intCount &lt;= 1 ? ratio : intCount * ratio);
				// val -= diff;
				val = Math.round(val*arAsproOptions.JS_ITEM_CLICK.precisionFactor)/arAsproOptions.JS_ITEM_CLICK.precisionFactor;
			}

			if(parseFloat($(this).parents(".counter_block").find(".plus").data('max'))&gt;0){
				if(val&gt;parseFloat($(this).parents(".counter_block").find(".plus").data('max'))){
					val=parseFloat($(this).parents(".counter_block").find(".plus").data('max'));
					// val -= (val % ratio);
				}
			}
			if(val&lt;ratio){
				val=ratio;
			}else if(!parseFloat(val)){
				val=1;
			}

			$(this).parents('.counter_block').parent().parent().find('.to-cart').attr('data-quantity', val);
			$(this).parents('.counter_block').parent().parent().parent().find('.one_click').attr('data-quantity', val);
			$(this).val(val);

			var $calculate = $(this).closest('.item').length ? $(this).closest('.item').find('.calculate-delivery') : $(this).closest('.catalog_detail').find('.calculate-delivery');
			if($calculate.length){
				$calculate.each(function(){
					var $calculateSpan = $(this).find('span[data-event=jqm]').first();

					if($calculateSpan.length){
						var $clone = $calculateSpan.clone();
						$clone.attr('data-param-quantity', val).removeClass('clicked');
						$clone.insertAfter($calculateSpan).on('click', function(){
							if(!jQuery.browser.mobile){
								$(this).parent().addClass('loadings');
							}
						});
						$calculateSpan.remove();
					}

					if($(this).hasClass('with_preview')){
						$(this).removeClass('inited');

						if(timerInitCalculateDelivery){
							clearTimeout(timerInitCalculateDelivery);
						}

						timerInitCalculateDelivery = setTimeout(function(){
							initCalculatePreview();
							timerInitCalculateDelivery = false;
						}, 1000);
					}
				});
			}

			var eventdata = {type: 'change', params: {id: $(this), value: val}};
			BX.onCustomEvent('onCounterProductAction', [eventdata]);
		}
	});

	BX.addCustomEvent('onCounterProductAction', function(eventdata) {
		if(typeof eventdata != 'object'){
			eventdata = {type: 'undefined'};
		}
		try{
			if(typeof eventdata.type != 'undefined'){
				if(!eventdata.params.id.closest('.gifts').length) // no gift
				{
					var obProduct = eventdata.params.id.data('product');
					if(eventdata.params.id.closest('.has_offer_prop').length) // type1 for offers in element list
					{
						if(typeof window['obSkuQuantys'] === 'undefined')
							window["obSkuQuantys"] = {};

						// if(typeof window['obOffers'] === 'undefined')
							window["obSkuQuantys"][eventdata.params.id.closest('.offer_buy_block').find('.to-cart').data('item')] = eventdata.params.value;
					}
					if(typeof window[obProduct] == 'object')
					{
						if(obProduct == "obOffers")
							setPriceAction('', '', 'Y');
						else
							window[obProduct].setPriceAction('Y');
						if ($('.detail_page').length) {
							setNewHeader()
						}
					}
					else if(eventdata.params.id.length)
					{
						if(eventdata.params.id.closest('.main_item_wrapper').length &amp;&amp; arAsproOptions['THEME']['SHOW_TOTAL_SUMM'] == 'Y')
						{
							setPriceItem(eventdata.params.id.closest('.main_item_wrapper'), eventdata.params.value);
						}
					}
					BX.onCustomEvent('onCounterProductActionResize');
				}
			}
		}
		catch(e){
			console.error(e)
		}
	});

	/*show basket on hover */
	var elements = $('.wrap_icon.top_basket, #headerfixed .basket-link.basket').not('.wrap_icon.top_basket.baskets--custom');
	if (elements[0]) {
		$(elements[0]).on('mouseenter', elements[0], function() {
			var _this = $(this);
			var parent = _this.closest('header, #headerfixed');
			var hover_block = parent.find('.basket_hover_block');

			if(hover_block &amp;&amp; !hover_block.hasClass('loaded')) {
				basketTop('', hover_block);
			}
		});
	}
	if (elements[1]) {
		$(elements[1]).on('mouseenter', elements[1], function() {
			var _this = $(this);
			var parent = _this.closest('header, #headerfixed');
			var hover_block = parent.find('.basket_hover_block');
	
			if(hover_block &amp;&amp; !hover_block.hasClass('loaded')) {
				basketTop('', hover_block);
			}
		});
	}

	/*show basket on click mobile */
	$(document).on('click', '.wrap_icon.wrap_basket.top_basket, #headerfixed .basket-link.basket', function(e) {
		var _this = $(this);
		if(isMobile) {
			if(!_this.hasClass('clicked')) {
				e.preventDefault();
				_this.addClass('clicked');
				setTimeout(function(){
					_this.removeClass('clicked');
				}, 3000);
			}
		}
	});

	/*slide cart*/
	$(document).on('mouseenter', '#basket_line .basket_normal:not(.empty_cart):not(.bcart) .basket_block ', function() {
		$(this).closest('.basket_normal').find('.popup').addClass('block');
		$(this).closest('.basket_normal').find('.basket_popup_wrapp').stop(true,true).slideDown(150);
	});
	$(document).on('mouseleave', '#basket_line .basket_normal .basket_block ', function() {
		var th=$(this);
		$(this).closest('.basket_normal').find('.basket_popup_wrapp').stop(true,true).slideUp(150, function(){
			th.closest('.basket_normal').find('.popup').removeClass('block');
		});
	});

	$(document).on('click', '.popup_button_basket', function(){
		var th=$(".to-cart[data-item="+$(this).data("item")+"]");

		var val = th.attr('data-quantity');

		if(!val) $val = 1;

		var tmp_props=th.data("props"),
			props='',
			part_props='',
			add_props='N',
			fill_prop={},
			iblockid = th.data('iblockid'),
			offer = th.data('offers'),
			rid='',
			basket_props='',
			item = th.attr('data-item');

		if(offer!="Y"){
			offer = "N";
		}else{
			basket_props=th.closest('.prices_tab').find('.bx_sku_props input').val();
		}
		if(tmp_props){
			props=tmp_props.split(";");
		}
		if(th.data("part_props")){
			part_props=th.data("part_props");
		}
		if(th.data("add_props")){
			add_props=th.data("add_props");
		}
		if($('.rid_item').length){
			rid=$('.rid_item').data('rid');
		}else if(th.data('rid')){
			rid=th.data('rid');
		}

		fill_prop=fillBasketPropsExt(th, 'prop', 'bx_ajax_text');

		fill_prop.quantity=val;
		fill_prop.add_item='Y';
		fill_prop.rid=rid;
		fill_prop.offers=offer;
		fill_prop.iblockID=iblockid;
		fill_prop.part_props=part_props;
		fill_prop.add_props=add_props;
		fill_prop.props=JSON.stringify(props);
		fill_prop.item=item;
		fill_prop.basket_props=basket_props;

		$.ajax({
			type:"POST",
			url:arAsproOptions['SITE_DIR']+"ajax/item.php",
			data:fill_prop,
			dataType:"json",
			success:function(data){
				$('.basket_error_frame').jqmHide();
				if("STATUS" in data){
					getActualBasket(fill_prop.iblockID);
					if(data.STATUS === 'OK'){
						th.hide();
						th.closest('.counter_wrapp').find('.counter_block_inner').hide();
						th.closest('.counter_wrapp').find('.counter_block').hide();
						th.parents('tr').find('.counter_block_wr .counter_block').hide();
						th.closest('.button_block').addClass('wide');
						th.parent().find('.in-cart').show();

						addBasketCounter(item);
						//$('.wish_item[data-item='+item+']').removeClass("added");
						$('.wish_item[data-item='+item+']').find(".value").show();
						$('.wish_item[data-item='+item+']').find(".value.added").hide();

						if($("#ajax_basket").length)
							reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');

						if($("#basket_line .basket_fly").length){
							if(th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches)
								basketFly('open', 'N');
							else
								basketFly('open');
						}

					}else{
						showBasketError(BX.message(data.MESSAGE));
					}
				}else{
					showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
				}
			}
		});
	})
    
    if(false){
	    $(document).on( 'click', '.to-cart:not(.read_more), .basket_item_add', function(e){
		e.preventDefault();
		var th=$(this);
		if(!th.hasClass('clicked'))
		{
			th.addClass('clicked');
			var val = $(this).attr('data-quantity');
			var tmp_props=$(this).data("props"),
				props='',
				part_props='',
				add_props='N',
				fill_prop={},
				iblockid = $(this).data('iblockid'),
				offer = $(this).data('offers'),
				rid='',
				bBannerAction = false,
				basket_props='',
				item = $(this).attr('data-item');
			if(th.closest('.but-cell').length)
			{
				if($('.counter_block[data-item="'+item+'"]').length)
					val = $('.counter_block[data-item="'+item+'"] input').val();
			}

			if(th.closest('.banner_buttons.with_actions').length) //banner action
			{
				var wrapper_btns = th.closest('.wraps_buttons');
				item = wrapper_btns.data('id');
				bBannerAction = true;
			}

			if(!val)
				val = 1;
			if(offer!="Y"){
				offer = "N";
			}else{
				basket_props=$(this).closest('.prices_tab').find('.bx_sku_props input').val();
			}
			if(tmp_props){
				props=tmp_props.split(";");
			}
			if($(this).data("part_props")){
				part_props=$(this).data("part_props");
			}
			if($(this).data("add_props")){
				add_props=$(this).data("add_props");
			}
			if($('.rid_item').length){
				rid=$('.rid_item').data('rid');
			}else if($(this).data('rid')){
				rid=$(this).data('rid');
			}

			fill_prop=fillBasketPropsExt(th, 'prop', th.data('bakset_div'));

			fill_prop.quantity=val;
			fill_prop.add_item='Y';
			fill_prop.rid=rid;
			fill_prop.offers=offer;
			fill_prop.iblockID=iblockid;
			fill_prop.part_props=part_props;
			fill_prop.add_props=add_props;
			fill_prop.props=JSON.stringify(props);
			fill_prop.item=item;
			fill_prop.basket_props=basket_props;

			if(bBannerAction)
			{

				if(th.hasClass('added'))
				{
					location.href = th.data('href');
					return false;
				}
				else
				{
					th.attr('title', th.data('title2'))
					th.toggleClass('added');
				}

				if(wrapper_btns.find('.wish_item_add').length)
					wrapper_btns.find('.wish_item_add').removeClass('added');
			}

			if(th.data("empty_props")=="N"/* &amp;&amp; fill_prop.part_props != 'Y'*/){
				var basket_popup_html = $("#"+th.data("bakset_div")).html();
				if(!basket_popup_html &amp;&amp; th.closest('.item').find('.basket_props_block').length)
					basket_popup_html = th.closest('.item').find('.basket_props_block').html();

				showBasketError(basket_popup_html, BX.message("ERROR_BASKET_PROP_TITLE"), "Y", th);
				BX.addCustomEvent('onCompleteAction', function(e){
					if(!e.ignoreSelf){
						var eventdata = {action:'loadForm', ignoreSelf: true};
						BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
					}
				});

			}else{
				$.ajax({
					type:"POST",
					url:arAsproOptions['SITE_DIR']+"ajax/item.php",
					data:fill_prop,
					dataType:"json",
					success:function(data){
						getActualBasket(fill_prop.iblockID);

						var eventdata = {action:'loadForm'};
						BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
						arStatusBasketAspro = {};

						if(data !==null){
							if("STATUS" in data){
								if(data.MESSAGE_EXT===null)
									data.MESSAGE_EXT='';
								if(data.STATUS === 'OK'){
									// th.hide();
									$('.to-cart[data-item='+item+']').hide();
									$('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block_inner').hide();
									$('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block').hide();
									$('.to-cart[data-item='+item+']').parents('tr').find('.counter_block_wr .counter_block').hide();
									$('.to-cart[data-item='+item+']').closest('.button_block').addClass('wide');
									// th.parent().find('.in-cart').show();
									$('.in-cart[data-item='+item+']').show();

									addBasketCounter(item);
									//$('.wish_item[data-item='+item+']').removeClass("added");
									$('.wish_item[data-item='+item+']').find(".value").show();
									$('.wish_item[data-item='+item+']').find(".value.added").hide();
									$('.wish_item.to[data-item='+item+']').show();
									$('.wish_item.in[data-item='+item+']').hide();

									if($("#ajax_basket").length)
										reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');

									if($("#basket_line .basket_fly").length){
										if(th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches  || $("#basket_line .basket_fly.loaded").length)
											basketFly('open', 'N');
										else
											basketFly('open');
									}

									if($(".top_basket").length){
										basketTop('open', $(".top_basket").find('.basket_hover_block'));
									}

									if ($('#headerfixed .wproducts .ajax_load .btn').length &amp;&amp; th.next('.in-cart').length) {
										var buttonHtml = '&lt;span class="buy_block"&gt;&lt;span class="btn btn-default btn-sm slide_offer more type_block"&gt;'+th.next('.in-cart').html() +'&lt;/span&gt;&lt;/span&gt;';
										$('#headerfixed .wproducts .ajax_load .item-buttons .but-cell').html(buttonHtml)
									}

								}else{
									showBasketError(BX.message(data.MESSAGE)+' &lt;br/&gt;'+data.MESSAGE_EXT);
								}
							}else{
								showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
							}
						}else{
							// th.hide();
							$('.to-cart[data-item='+item+']').hide();
							$('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block_inner').hide();
							$('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block').hide();
							$('.to-cart[data-item='+item+']').parents('tr').find('.counter_block_wr .counter_block').hide();
							$('.to-cart[data-item='+item+']').closest('.button_block').addClass('wide');
							// th.parent().find('.in-cart').show();
							$('.in-cart[data-item='+item+']').show();

							addBasketCounter(item);
							//$('.wish_item[data-item='+item+']').removeClass("added");
							$('.wish_item[data-item='+item+']').find(".value").show();
							$('.wish_item[data-item='+item+']').find(".value.added").hide();

							if($("#ajax_basket").length)
								reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');

							if($("#basket_line .basket_fly").length)
							{
								if(th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches  || $("#basket_line .basket_fly.loaded").length)
									basketFly('open', 'N');
								else
									basketFly('open');
							}
						}
					}
				});
			}
		}

	})
    }
	$(document).on('click', '.to-subscribe', function(e){
		e.preventDefault();
		var th=$(this);
		if(!th.hasClass('clicked'))
		{
			th.addClass('clicked');
			if($(this).is('.auth'))
			{
				if($(this).hasClass('nsubsc'))
				{
					$(this).jqmEx();
					$(this).trigger('click');
				}
				else
				{
					location.href=arAsproOptions['SITE_DIR']+'auth/?backurl='+location.pathname;
				}
			}
			else
			{
				var item = $(this).attr('data-item'),
					iblockid = $(this).attr('data-iblockid');
				// $(this).hide();
				$('.to-subscribe[data-item='+item+']').hide();
				$('.to-subscribe[data-item='+item+']').parent().find('.in-subscribe').show();
				$.get(arAsproOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&amp;subscribe_item=Y',
					$.proxy(function(data){
						arStatusBasketAspro = {};
						getActualBasket(iblockid);
					})
				);
				th.removeClass('clicked');
			}
		}
	})

	$(document).on('click', '.in-subscribe', function(e){
		e.preventDefault();
		var item = $(this).attr('data-item'),
			iblockid = $(this).attr('data-iblockid');;
		// $(this).hide();
		$('.in-subscribe[data-item='+item+']').hide();
		$('.in-subscribe[data-item='+item+']').parent().find('.to-subscribe').removeClass('clicked');
		$('.in-subscribe[data-item='+item+']').parent().find('.to-subscribe').show();
		$.get(arAsproOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&amp;subscribe_item=Y',
			$.proxy(function(data){
				getActualBasket(iblockid);
				arStatusBasketAspro = {};
			})
		);
	})

	$(document).on('click', '.wish_item, .wish_item_add', function(e){
		e.preventDefault();
		var val = $(this).attr('data-quantity'),
			_this = $(this),
			offer = $(this).data('offers'),
			iblockid = $(this).data('iblock'),
			tmp_props=$(this).data("props"),
			props='',
			bBannerAction = false,
			item = $(this).attr('data-item'),
			item2 = $(this).attr('data-item');

		if(_this.closest('.banner_buttons.with_actions').length) //banner action
		{
			var wrapper_btns = _this.closest('.wraps_buttons');
			item = item2 = wrapper_btns.data('id');
			bBannerAction = true;
		}

		if(!_this.hasClass('clicked'))
		{
			_this.addClass('clicked');
			if(!val) val = 1;
			if(offer!="Y") offer = "N";
			if(tmp_props){
				props=tmp_props.split(";");
			}
			if(!$(this).hasClass('text')){
				if($(this).hasClass('added')){
					if(!bBannerAction)
					{
						$(this).hide();
						$(this).closest('.wish_item_button').find('.to').show();
					}
					$('.like_icons').each(function(){
						if($(this).find('.wish_item.text[data-item="'+item+'"]').length){
							$(this).find('.wish_item.text[data-item="'+item+'"]').removeClass('added');
							$(this).find('.wish_item.text[data-item="'+item+'"]').find('.value').show();
							$(this).find('.wish_item.text[data-item="'+item+'"]').find('.value.added').hide();
						}
						if($(this).find('.wish_item_button').length){
							/*$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').removeClass('added');
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').show();
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').hide();*/
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"].to').show();
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"].in').hide();
						}
					})
				}
				else{
					if(!bBannerAction)
					{
						$(this).hide();
						$(this).closest('.wish_item_button').find('.in').addClass('added').show();
					}

					$('.like_icons').each(function(){
						if($(this).find('.wish_item.text[data-item="'+item+'"]').length){
							$(this).find('.wish_item.text[data-item="'+item+'"]').addClass('added');
							$(this).find('.wish_item.text[data-item="'+item+'"]').find('.value').hide();
							$(this).find('.wish_item.text[data-item="'+item+'"]').find('.value.added').css({"display":"block"})
						}
						if($(this).find('.wish_item_button').length){
							/*$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').addClass('added');
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').hide();
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').show();*/
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"].to').hide();
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"].in').show();
						}
					})
				}
			}else{
				if(!$(this).hasClass('added')){
					$('.wish_item[data-item=' + item + ']').addClass('added');
					$('.wish_item[data-item=' + item + ']').find('.value').hide();
					$('.wish_item[data-item=' + item + ']').find('.value.added').css('display','block');

					$('.wish_item.to[data-item='+item+']').hide();
					$('.wish_item.in[data-item='+item+']').show();


					$('.like_icons').each(function(){
						if($(this).find('.wish_item_button').length){
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').addClass('added');
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').hide();
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').show();
						}
					})
				}else{
					$('.wish_item[data-item=' + item + ']').removeClass('added');
					$('.wish_item[data-item=' + item + ']').find('.value').show();
					$('.wish_item[data-item=' + item + ']').find('.value.added').hide();

					$('.wish_item.to[data-item='+item+']').show();
					$('.wish_item.in[data-item='+item+']').hide();

					$('.like_icons').each(function(){
						if($(this).find('.wish_item_button').length){
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').removeClass('added');
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value').show();
							$(this).find('.wish_item_button').find('.wish_item[data-item="'+item+'"]').find('.value.added').hide();
						}
					})
				}
			}

			$('.in-cart[data-item=' + item + ']').hide();
			$('.to-cart[data-item=' + item + ']').removeClass('clicked');
			$('.to-cart[data-item=' + item + ']').parent().removeClass('wide');
			if(!$('.counter_block[data-item=' + item + ']').closest('.counter_wrapp').find('.to-order').length)
			{
				$('.to-cart[data-item=' + item + ']').show();
				$('.counter_block[data-item=' + item + ']').closest('.counter_block_inner').show();
				$('.counter_block[data-item=' + item + ']').show();
			}

			if(bBannerAction)
			{
				_this.toggleClass('added');

				if(_this.hasClass('added'))
					_this.attr('title', _this.data('title2'))
				else
					_this.attr('title', _this.data('title'))

				if(wrapper_btns.find('.basket_item_add').length)
					wrapper_btns.find('.basket_item_add').removeClass('added');
			}

			if(!$(this).closest('.module-cart').size()){
				$.ajax({
					type:"GET",
					url:arAsproOptions['SITE_DIR']+"ajax/item.php",
					data:"item="+item2+"&amp;quantity="+val+"&amp;wish_item=Y"+"&amp;offers="+offer+"&amp;iblockID="+iblockid+"&amp;props="+JSON.stringify(props),
					dataType:"json",
					success: function(data){
						getActualBasket(iblockid);
						arStatusBasketAspro = {};
						if(data !==null){
							if(data.MESSAGE_EXT===null)
								data.MESSAGE_EXT='';
							if("STATUS" in data){
								if(data.STATUS === 'OK'){
									if(arAsproOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N'){
										var eventdata = {goal: 'goal_wish_add', params: {id: item2}};
										BX.onCustomEvent('onCounterGoals', [eventdata]);
									}
									if($("#ajax_basket").length)
										reloadTopBasket('wish', $('#ajax_basket'), 200, 5000, 'N');

									if($("#basket_line .basket_fly").length){
										if(_this.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
											basketFly('wish', 'N');
										else
											basketFly('wish');
									}
								}else{
									showBasketError(BX.message(data.MESSAGE)+' &lt;br/&gt;'+data.MESSAGE_EXT, BX.message("ERROR_ADD_DELAY_ITEM"));
								}
							}else{
								showBasketError(BX.message(data.MESSAGE)+' &lt;br/&gt;'+data.MESSAGE_EXT, BX.message("ERROR_ADD_DELAY_ITEM"));
							}
						}else{
							if($("#ajax_basket").length)
								reloadTopBasket('wish', $('#ajax_basket'), 200, 5000, 'N');

							if($("#basket_line .basket_fly").length){
								if(_this.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches || $("#basket_line .basket_fly.loaded").length)
									basketFly('wish', 'N');
								else
									basketFly('wish');
							}
						}
					_this.removeClass('clicked');
					}
				});
			}
		}

	})

	$(document).on('click', '.item_main_info .item_slider .flex-direction-nav li span', function(e){
		if($('.inner_slider .slides_block').length)
		{
			if($(this).parent().hasClass('flex-nav-next'))
				$('.inner_slider .slides_block li.current').next().click();
			else
				$('.inner_slider .slides_block li.current').prev().click();
		}
	})

	$(document).on('click', '.compare_item, .compare_item_add', function(e){
		e.preventDefault();
		var item = $(this).attr('data-item');
		var iblockID = $(this).attr('data-iblock'),
			bBannerAction = false,
			th=$(this);

		if(th.closest('.banner_buttons.with_actions').length) //banner action
		{
			var wrapper_btns = th.closest('.wraps_buttons');
			item = wrapper_btns.data('id');
			iblockID = wrapper_btns.data('iblockid');
			bBannerAction = true;

			th.toggleClass('added');

			if(th.hasClass('added'))
				th.attr('title', th.data('title2'))
			else
				th.attr('title', th.data('title'))
		}

		if(!th.hasClass('clicked'))
		{
			th.addClass('clicked');
			if(!$(this).hasClass('text')){
				if($(this).hasClass('added')){
					if(!bBannerAction)
					{
						$(this).hide();
						$(this).closest('.compare_item_button').find('.to').show();
					}

					/*sync other button*/
					$('.like_icons').each(function(){
						if($(this).find('.compare_item.text[data-item="'+item+'"]').length){
							$(this).find('.compare_item.text[data-item="'+item+'"]').removeClass('added');
							$(this).find('.compare_item.text[data-item="'+item+'"]').find('.value').show();
							$(this).find('.compare_item.text[data-item="'+item+'"]').find('.value.added').hide();
						}
						if($(this).find('.compare_item_button').length){
							/*$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').removeClass('added');
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').show();
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').hide();*/
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"].in').hide();
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"].to').show();
						}
					})
				}
				else
				{
					if(!bBannerAction)
					{
						$(this).hide();
						$(this).closest('.compare_item_button').find('.in').show();
					}

					/*sync other button*/
					$('.like_icons').each(function(){
						if($(this).find('.compare_item.text[data-item="'+item+'"]').length){
							$(this).find('.compare_item.text[data-item="'+item+'"]').addClass('added');;
							$(this).find('.compare_item.text[data-item="'+item+'"]').find('.value').hide();
							$(this).find('.compare_item.text[data-item="'+item+'"]').find('.value.added').css({"display":"block"});
						}
						if($(this).find('.compare_item_button').length){
							/*$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').addClass('added');
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').show();
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').hide();*/
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"].to').hide();
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"].in').show();
						}
					})
				}
			}else{
				if(!$(this).hasClass('added')){
					$('.compare_item[data-item=' + item + ']').addClass('added');
					$('.compare_item[data-item=' + item + ']').find('.value').hide();
					$('.compare_item[data-item=' + item + ']').find('.value.added').css('display','block');

					/*sync other button*/
					$('.like_icons').each(function(){
						if($(this).find('.compare_item_button').length){
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').addClass('added');
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').show();
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').hide();
						}
					})
				}else{
					$('.compare_item[data-item=' + item + ']').removeClass('added');
					$('.compare_item[data-item=' + item + ']').find('.value').show();
					$('.compare_item[data-item=' + item + ']').find('.value.added').hide();

					/*sync other button*/
					$('.like_icons').each(function(){
						if($(this).find('.compare_item_button').length){
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').removeClass('added');
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value').show();
							$(this).find('.compare_item_button').find('.compare_item[data-item="'+item+'"]').find('.value.added').hide();
						}
					})
				}
			}

			$.get(arAsproOptions['SITE_DIR'] + 'ajax/item.php?item=' + item + '&amp;compare_item=Y&amp;iblock_id=' + iblockID,
				$.proxy(function(data){
					getActualBasket(iblockID, 'Compare');
					arStatusBasketAspro = {};
					if($('#compare_fly').length){
						jsAjaxUtil.InsertDataToNode(arAsproOptions['SITE_DIR'] + 'ajax/show_compare_preview_fly.php', 'compare_fly', false);
					}
				th.removeClass('clicked');
				})
			);
		}

	});

	$('.fancybox').fancybox({
		backFocus: false,
	});

	$(document).on('click', '.tabs&gt;li', function(){
		var parent = $(this).parent();
		if(!$(this).hasClass('active')){
			var sliderIndex = $(this).index(),
				curLiNav=$(this).closest('.top_block').find('.slider_navigation').find('&gt;li:eq(' + sliderIndex + ')'),
				curLi=$(this).closest('.top_block').siblings('.tabs_content').find('&gt;li:eq(' + sliderIndex + ')');
			$(this).addClass('active').addClass('cur').siblings().removeClass('active').removeClass('cur');
			curLi.addClass('cur').siblings().removeClass('cur');
			curLiNav.addClass('cur').siblings().removeClass('cur');

			if(parent.hasClass('ajax')) // front tabs
			{
				if(!$(this).hasClass('clicked'))
				{
					$.ajax({
						url: arAsproOptions['SITE_DIR'] + 'include/mainpage/comp_catalog_ajax.php',
						type: 'POST',
						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')},
					}).success(function(html){
						curLi.find('.tabs_slider').html(html);
						var container = curLi.closest('.content_wrapper_block');
						if(container.length) {
							var bNav = curLi.find('.bottom_nav .module-pagination').length &gt; 0;
							if(bNav) {
								container.removeClass('without-border');
							} else {
								container.addClass('without-borded');
							}
						}
						setTimeout(function(){
							curLi.addClass('opacity1');
						}, 100);

						/*equal height*/
						// curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible .item-title').sliceHeight({item:'.catalog_item:visible', mobile: true});
						// curLi.find('.catalog_block .catalog_item_wrapp .catalog_item .item_info:visible').sliceHeight({item:'.catalog_item:visible', mobile: true});
						// curLi.find('.catalog_block .catalog_item_wrapp .catalog_item:visible').sliceHeight({classNull: '.footer_button', item:'.catalog_item:visible', mobile: true});

						initCountdown();
					})
					$(this).addClass('clicked');
				} else {
					var container = curLi.closest('.content_wrapper_block');
					if(container.length) {
						var bNav = curLi.find('.bottom_nav .module-pagination').length &gt; 0;
						if(bNav) {
							container.removeClass('without-border');
						} else {
							container.addClass('without-borded');
						}
					}
					$('.cur .catalog_block .catalog_item_wrapp.catalog_item:not(.big):visible').sliceHeight({
						classNull: '.footer_button',
						item:'.cur .catalog_block .catalog_item_wrapp.catalog_item:not(.big):visible',
						classes: [
							'.item_info .item-title',
							'.item_info .sa_block',
							'.item_info .cost.prices',
						],
						mobile: true,
					});
				}
			}

			var eventdata = {index: sliderIndex, target: $(this)};
			BX.onCustomEvent('clickedTabsLi', [eventdata]);
		}
	})

	/*search click*/
	$('.search_block .icon').on('click', function(){
		var th=$(this);
		if($(this).hasClass('open')){
			$(this).closest('.center_block').find('.search_middle_block').removeClass('active');
			$(this).removeClass('open');
			$(this).closest('.center_block').find('.search_middle_block').find('.noborder').hide();
		}else{
			setTimeout(function(){
				th.closest('.center_block').find('.search_middle_block').find('.noborder').show();
			},100);
			$(this).closest('.center_block').find('.search_middle_block').addClass('active');
			$(this).addClass('open');
		}
	})

	$(document).on('click', '.no_goods .button', function(){
		$('.bx_filter .smartfilter .bx_filter_search_reset').trigger('click');
	});

	$(document).on('click', '.js-load-link', function(e){
		AjaxClickLink(e)
	})

	$(document).on('click', '.svg-inline-bottom_nav-icon', function(){
		$(this).next().trigger('click');
	})
	$(document).on('click', '.ajax_load_btn', function(){
		var
			_this = $(this),
			url = _this.closest('.container').find('.module-pagination .flex-direction-nav .flex-next').attr('href'),
			th = _this.find('.more_text_ajax'),
			bottom_nav = _this.closest('.bottom_nav'),
			top_nav = _this.closest('.top_nav'),
			mobileBottomNav = bottom_nav.hasClass('mobile_slider'),
			bLoadingState = _this.closest('.animate-load-state').length;

		if(!th.hasClass('loading'))
		{
			th.addClass('loading');
			if(mobileBottomNav) {
				var icon = bottom_nav.find('.svg-inline-bottom_nav-icon');
				icon.css('display', 'none');
			}
			if(bLoadingState)
				_this.addClass('loadings');

			var objUrl = parseUrlQuery(),
				add_url = ''
				obGetData = {"ajax_get": "Y", "AJAX_REQUEST": "Y"};

			if(_this.closest('.wrapper_inner.front').length) //index page
			{
				var class_block = th.closest('.drag-block').data('class').replace('_drag', '');
				class_block = class_block.replace(/\s/g, '');
				obGetData.BLOCK = class_block;
			}

			if(_this.closest('.tab').length) //tabs block
			{
				var filter = th.closest('.tab').data('filter');
				obGetData.GLOBAL_FILTER = filter;
				url = _this.closest('.bottom_nav').find('.module-pagination .flex-direction-nav .flex-next').attr('href');
			}


			if(_this.closest('.content_linked_goods').length) //linked_goods block in content
			{
				var filterSections = th.closest('.content_linked_goods').attr('data-sections-ids');
				obGetData.ajax_section_id = decodeURIComponent(filterSections);

				url = _this.closest('.bottom_nav').find('.module-pagination .flex-direction-nav .flex-next').attr('href');
			}

			if('clear_cache' in objUrl)
			{
				if(objUrl.clear_cache == 'Y')
					add_url = '&amp;clear_cache=Y';
			}
			if(_this.hasClass('ajax'))
				obGetData.ajax = 'y';

			if(th.closest('.goods-block.ajax_load'))
				obGetData.bitrix_include_areas = 'N';
			$.ajax({
				url: url+add_url,
				data: obGetData,
				success: function(html) {
					pasteAjaxPagination(html, th, bottom_nav, top_nav, bLoadingState, _this);
				},
				error: function(html) {
					pasteAjaxPagination(html.responseText, th, bottom_nav, top_nav, bLoadingState, _this);
				},
			})
		}
	})

	function pasteAjaxPagination(html, th, bottom_nav, top_nav, bLoadingState, _this) {
		var mobileBottomClicked = bottom_nav.hasClass('mobile_slider');
		var hasMobileBottomNav = $(html).find('.bottom_nav.mobile_slider');
		var bottomNav = hasMobileBottomNav.length ? hasMobileBottomNav : $(html).find('.bottom_nav');
		var bottomNavHtml = bottomNav.html();
		var bottomNavScrollClass = bottomNav.data('scroll-class');
		var hasBottomNav = $(html).find('.ajax_load_btn').length;

		if(th.closest('.ajax_load').length &amp;&amp; !mobileBottomClicked)
		{
			th.removeClass('loading');
			if(th.closest('.ajax_load').find('.js_append').length)
			{
				if(_this.closest('.catalog_in_content').length){
					th.closest('.ajax_load').find('.js_append').append($('.inner_wrapper .js_wrapper_items&gt;', html));//need for brands &amp; landings
				}else{
					th.closest('.ajax_load').find('.js_append').append(html);
				}
				th.closest('.ajax_load').find('.bottom_nav_wrapper').remove();
			}
			else
			{
				if($('.display_list').length)
				{
					$('.display_list').append(html);
					th.closest('.display_list').find('.bottom_nav_wrapper').remove();

				}else if($('.block_list').length)
				{
					$('.block_list').append(html);
					touchItemBlock('.catalog_item a');
					th.closest('.block_list').find('.bottom_nav_wrapper').remove();
				}else if($('.module_products_list').length)
				{
					$('.module_products_list &gt; tbody').append(html);
					th.closest('.module_products_list &gt; tbody').find('.bottom_nav_wrapper').remove();
				}

			}


			setStatusButton();
			checkLinkedArticles();

			var eventdata = {action:'ajaxContentLoadedTab'};
			BX.onCustomEvent('onAjaxSuccess', [eventdata]);
			_this.closest('.bottom_nav').html(bottomNavHtml);
			$(document).find('.catalog_block .top_nav').html(bottomNavHtml);
		}
		else
		{
			var eventdata = {action:'ajaxContentLoaded'};

			if($('.banners-small.front').length)
			{
				$('.banners-small .items.row').append(html);
				$('.bottom_nav').html($('.banners-small .items.row .bottom_nav').html());
				$('.banners-small .items.row .bottom_nav').remove();
				if(hasBottomNav) {
					$('.banners-small .items.row').addClass('has-bottom-nav');
				} else {
					$('.banners-small .items.row').removeClass('has-bottom-nav');
				}
			}
			else
			{
				if(bottom_nav.data('append') !== undefined &amp;&amp; bottom_nav.data('parent') !== undefined)
				{
					var target = html;
					if(bottom_nav.data('target') !== undefined) {
						target = $(html).find(bottom_nav.data('target'));
					}
					if(mobileBottomClicked || hasMobileBottomNav.length) {
						var mobileSliderNav = th.closest(bottom_nav.data('parent')).find('.bottom_nav.mobile_slider');
						if(mobileSliderNav.length) {
							mobileSliderNav.before(target);
						} else {
							bottom_nav.before(target);
						}
					} else {
						th.closest(bottom_nav.data('parent')).find(bottom_nav.data('append')).append(target);
					}
					th.closest(bottom_nav.data('parent')).find(bottom_nav.data('append')).find('.bottom_nav_wrapper').remove();

					if (hasBottomNav) {
						if (bottomNavScrollClass !== undefined) {
							th.closest(bottom_nav.data('parent')).find(bottomNavScrollClass).addClass('has-bottom-nav');
						}
						th.closest(bottom_nav.data('parent')).find(bottom_nav.data('append')).addClass('has-bottom-nav');						
					} else {
						if (bottomNavScrollClass !== undefined) {
							th.closest(bottom_nav.data('parent')).find(bottomNavScrollClass).removeClass('has-bottom-nav');
						}
						th.closest(bottom_nav.data('parent')).find(bottom_nav.data('append')).removeClass('has-bottom-nav');
					}

					bottom_nav = th.closest(bottom_nav.data('parent')).find('.bottom_nav');
					bottom_nav.html(bottomNavHtml);
					$(document).find('.catalog_block .top_nav').html(bottomNavHtml);
					var icon = bottom_nav.find('.svg-inline-bottom_nav-icon');
					icon.css('display', '');

					eventdata.container = th.closest(bottom_nav.data('parent'));
				}
				else
				{
					if(th.closest('.item-views').find('.items').length)
					{
						th.closest('.item-views').find('.items').append(html);
					}
					else
					{
						$(html).insertBefore($('.blog .bottom_nav'));
					}

					bottom_nav.html($('.bottom_nav:hidden').html());
					if(hasBottomNav) {
						th.closest('.item-views').find('.items').addClass('has-bottom-nav');
					} else {
						th.closest('.item-views').find('.items').removeClass('has-bottom-nav');
					}
					_this.closest('.item-views').find('.bottom_nav:hidden').remove();
				}
			}

			eventdata.content = html;
			eventdata.container = th;
			BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);

			setTimeout(function(){
				$('.banners-small .item.normal-block').sliceHeight({resize: false});
				if($('.item.slice-item').length)
				{
					$('.item.slice-item .title').sliceHeight({resize: false});
					$('.item.slice-item').sliceHeight({resize: false});
				}
				th.removeClass('loading');
				if(bLoadingState)
					_this.removeClass('loadings');
			}, 100);
		}
		initCountdown();
	}

	// form rating
	$(document).on('mouseenter', '.form .votes_block.with-text .item-rating', function(){
		var $this = $(this),
			index = $this.index(),
			ratingValue = $this.data('rating_value'),
			ratingMessage = $this.data('message');

		$(this).addClass('filed')
		$this.siblings().each(function(){
			if($(this).index() &lt;= index)
				$(this).addClass('filed')
			else
				$(this).removeClass('filed')
		});
		$this.closest('.votes_block').find('.rating_message').text(ratingMessage);
	});

	$(document).on('mouseleave', '.form .votes_block.with-text', function(){
		var $this = $(this),
			index = $this.data('rating'),
			ratingMessage = $this.closest('.votes_block').find('.rating_message').data('message');

		$this.find('.item-rating').each(function(){
			if($(this).index() &lt; index &amp;&amp; index !== undefined)
				$(this).addClass('filed')
			else
				$(this).removeClass('filed')
		});
		$this.closest('.votes_block').find('.rating_message').text(ratingMessage);
	});

	$(document).on('click', '.form .votes_block.with-text .item-rating', function(){
		var $this = $(this),
			rating = $this.closest('.votes_block').data('rating'),
			index = $this.index() + 1,
			ratingMessage = $this.data('message');

		$this.closest('.votes_block').data('rating', index);
		if($this.closest('.form-control').find('input[name=RATING]').length){
			$this.closest('.form-control').find('input[name=RATING]').val(index);
		}
		else{
			$this.closest('.form-control').find('input[data-sid=RATING]').val(index);
		}
		$this.closest('.votes_block').find('.rating_message').data('message', ratingMessage);
	});

	//set cookie for basket link click
	$(document).on('click', '.bx_ordercart_order_table_container .control &gt; a, .basket-item-actions-remove, a[data-entity=basket-item-remove-delayed]', function(e){
		$.removeCookie('click_basket', {path: '/'});
		$.cookie('click_basket', 'Y', {path: '/'});
	})

	$(document).on('click', '.bx_compare .tabs-head li', function(){
		var url=$(this).find('.sortbutton').data('href');
		BX.showWait(BX("bx_catalog_compare_block"));
		$.ajax({
			url: url,
			data: {'ajax_action': 'Y'},
			success: function(html){
				history.pushState(null, null, url);
				$('#bx_catalog_compare_block').html(html);
				BX.closeWait();
			}
		})
	})
	var hoveredTrs;
	$(document).on({
		mouseover: function(e){
			var _ = $(this);
			var tbodyIndex = _.closest('tbody').index()+1; //+1 for nth-child
			var trIndex = _.index()+1; // +1 for nth-child
			hoveredTrs = $(e.delegateTarget).find('.data_table_props')
				.children(':nth-child('+tbodyIndex+')')
				.children(':nth-child('+trIndex+')').addClass('hovered');
		},
		mouseleave: function(e){
			if(hoveredTrs)
				hoveredTrs.removeClass('hovered');
		}
	}, '.bx_compare .data_table_props tbody&gt;tr');
	$(document).on('click', '.fancy_offer', function(e){
		e.preventDefault();
		var arPict=[], index = 0;
		$(this).closest('.item_slider').find('.sliders .slides_block li').each(function(){
			var obImg = {};
			obImg = {
				'title': $(this).find('img').attr('alt'),
				'href': $(this).data('big')
			}
			if($(this).hasClass('current')){
				index = $(this).index();
			}
			arPict.push(obImg);
		})
		$.fancybox(arPict, {
			index: index,
			openEffect  : 'fade',
			closeEffect : 'fade',
			nextEffect : 'fade',
			prevEffect : 'fade',
			type : 'image',
			tpl:{
				closeBtn : '&lt;a title="'+BX.message('FANCY_CLOSE')+'" class="fancybox-item fancybox-close" href="javascript:;"&gt;&lt;/a&gt;',
				next     : '&lt;a title="'+BX.message('FANCY_NEXT')+'" class="fancybox-nav fancybox-next" href="javascript:;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt;',
				prev     : '&lt;a title="'+BX.message('FANCY_PREV')+'" class="fancybox-nav fancybox-prev" href="javascript:;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/a&gt;'
			},
		});
	})

	/*tabs*/
	$(".tabs_section .tabs-head li").on("click", function(){
		if(!$(this).is(".current")){
			$(".tabs_section .tabs-head li").removeClass("current");
			$(this).addClass("current");
			$(".tabs_section ul.tabs_content li").removeClass("current");
			if($(this).attr("id") == "product_reviews_tab"){
				$(".shadow.common").hide(); $("#reviews_content").show();
			}
			else{
				$(".shadow.common").show();
				$("#reviews_content").hide();
				$(".tabs_section ul.tabs_content &gt; li:eq("+$(this).index()+")").addClass("current");
			}
		}
	});

	/*open first section slide*/
	setTimeout(function() {
		$('.jobs_wrapp .item:first .name tr').trigger('click');
	}, 300);

	$('.choise').on('click', function(){
		var _this = $(this);
		if(typeof(_this.data('block')) != 'undefined')
		{
			if($(_this.data('block')).closest('.tab-pane').length)
			{
				$('.ordered-block a[href="#'+$(_this.data('block')).closest('.tab-pane').attr('id')+'"]').click();
				_this.data('block', '.ordered-block');
				$(_this.data('block')).data('offset', -100);
			}
			scrollToBlock(_this.data('block'));
		}
	})

	$(document).on('click', '.buy_block .slide_offer', function(){
		scroll_block($('.js-offers-scroll'));
	});
	$('.share  &gt; .share_wrapp .text').on('click', function(){
		var block = $(this).parent().find('.shares');
		if(!block.is(':visible') &amp;&amp; !$(this).closest('.share.top').length)
			$('#content').css('z-index',3);
		block.fadeToggle(100,function(){
			if(!block.is(':visible'))
				$('#content').css('z-index',2);
		});
	})
	$('html, body').on('mousedown', function(e) {
		if(typeof e.target.className == 'string' &amp;&amp; e.target.className.indexOf('adm') &lt; 0)
		{
			e.stopPropagation();
			$('div.shares').fadeOut(100, function(){
				$('#content').css('z-index',2);
				$('.price_txt .share_wrapp').removeClass('opened');
			});
			$('.search_middle_block').removeClass('active_wide');
		}
	})
	$('.share_wrapp').find('*').on('mousedown', function(e) {
		e.stopPropagation();
	});

	$('.price_txt .share_wrapp .text').click(function(){
		$(this).parent().toggleClass('opened');
		$(this).parent().find('.shares').fadeToggle();
	})

	$(document).on('click', '.reviews-collapse-link', function(){
		$('.reviews-reply-form').slideToggle();
	})

	/* accordion action*/
	$('.panel-collapse').on('hidden.bs.collapse', function(){
		$(this).parent().toggleClass('opened');
	})
	$('.panel-collapse').on('show.bs.collapse', function(){
		$(this).parent().toggleClass('opened');
	})

	/* accordion */
	$('.accordion-head').on('click', function(e){
		e.preventDefault();
		if(!$(this).next().hasClass('collapsing')){
			$(this).toggleClass('accordion-open');
			$(this).toggleClass('accordion-close');
		}
	});

	/* progress bar */
	$('[data-appear-progress-animation]').each(function(){
		var $this = $(this);
		$this.appear(function(){
			var delay = ($this.attr('data-appear-animation-delay') ? $this.attr('data-appear-animation-delay') : 1);
			if( delay &gt; 1 )
				$this.css('animation-delay', delay + 'ms');
			$this.addClass($this.attr('data-appear-animation'));

			setTimeout(function(){
				$this.animate({
					width: $this.attr('data-appear-progress-animation')
				}, 1500, 'easeOutQuad', function() {
					$this.find('.progress-bar-tooltip').animate({
						opacity: 1
					}, 500, 'easeOutQuad');
				});
			}, delay);
		}, {accX: 0, accY: -50});
	});

	initCountdown();

	/* portfolio item */
	if($('.item.animated-block').length)
	{
		$('.item.animated-block').appear(function(){
			var $this = $(this);

			$this.addClass($this.data('animation')).addClass('visible');

		}, {accX: 0, accY: 150})
	}

	/* flexslider appear */
	if($('.appear-block').length)
	{
		$('.appear-block').appear(function(){
			var $this = $(this);
			$this.removeClass('appear-block');

			CheckFlexSlider();
			InitFlexSlider();
			InitOwlSlider();
		}, {accX: 0, accY: 150})
	}

	/* js-load-block appear */
	if($('.js-load-block').length)
	{
		var objUrl = parseUrlQuery();
		var bClearCache = false;
		if('clear_cache' in objUrl){
			if(objUrl.clear_cache == 'Y'){
				bClearCache = true;
			}
		}

		var items = [];
		var bIdle = true;
		var insertNextBlockContent = function(){
			if(bIdle){
				if(items.length){
					bIdle = false;
					var item = items.pop();

					item.content = $.trim(item.content);

					// remove /bitrix/js/main/core/core_window.js if it was loaded already
					if(
						item.content.indexOf('/bitrix/js/main/core/core_window.') !== -1 &amp;&amp;
						BX.WindowManager
					){
						item.content = item.content.replace(/&lt;script src="\/bitrix\/js\/main\/core\/core_window\.[^&gt;]*&gt;&lt;\/script&gt;/gm, '');
					}

					// remove /bitrix/js/currency/core_currency.js if it was loaded already
					if(
						item.content.indexOf('/bitrix/js/currency/core_currency.') !== -1 &amp;&amp;
						typeof BX.Currency === 'object' &amp;&amp;
						BX.Currency.defaultFormat
					){
						item.content = item.content.replace(/&lt;script src="\/bitrix\/js\/currency\/core_currency\.[^&gt;]*&gt;&lt;\/script&gt;/gm, '');
					}

					// remove /bitrix/js/main/pageobject/pageobject.js if it was loaded already
					if(
						item.content.indexOf('/bitrix/js/main/pageobject/pageobject.') !== -1 &amp;&amp;
						BX.PageObject
					){
						item.content = item.content.replace(/&lt;script src="\/bitrix\/js\/main\/pageobject\/pageobject\.[^&gt;]*&gt;&lt;\/script&gt;/gm, '');
					}

					// remove /bitrix/js/main/polyfill/promise/js/promise.js if it not need
					if(
						item.content.indexOf('/bitrix/js/main/polyfill/promise/js/promise.') !== -1 &amp;&amp;
						typeof window.Promise !== 'undefined' &amp;&amp;
						window.Promise.toString().indexOf('[native code]') !== -1
					){
						item.content = item.content.replace(/&lt;script src="\/bitrix\/js\/main\/polyfill\/promise\/js\/promise\.[^&gt;]*&gt;&lt;\/script&gt;/gm, '');
					}

					var ob = BX.processHTML(item.content);

					// stop ya metrika webvisor DOM indexer
					pauseYmObserver();

					item.block.removeAttr('data-file').removeClass('loader_circle');

					if(item.block.data('appendTo')){
						item.block.find(item.block.data('appendTo'))[0].innerHTML = ob.HTML;
					}
					else{
						if(item.block.find('&gt; div[id*="bx_incl_"]').length){
							item.block.find('&gt; div[id*="bx_incl_"]')[0].innerHTML = ob.HTML;
						}
						else{
							item.block[0].innerHTML = ob.HTML;
						}
					}

					BX.ajax.processScripts(ob.SCRIPT);

					var eventdata = {action:'jsLoadBlock'};
					BX.onCustomEvent('onCompleteAction', [eventdata, item.block]);

					// resume ya metrika webvisor
					// 500ms
					setTimeout(resumeYmObserver, 500);

					bIdle = true;
					insertNextBlockContent();
				}
			}
		}

		$('.js-load-block').appear(function(){
			var $this = $(this);

			if($this.data('file')){
				var add_url = bClearCache ? '?clear_cache=Y' : '';
				if($this.data('block')){
					add_url += (bClearCache ? '&amp;' : '?') + 'BLOCK='+$this.data('block');
				}

				// get content
				$.get($this.data('file') + add_url)
				.done(function(html){
					items.push({
						block: $this,
						content: html,
					});

					if(items.length == 1){
						setTimeout(insertNextBlockContent, 100);
					}
				});
			}
		}, {accX: 0, accY: isMobile ? 300 : 150})
	}

	/*show ajax store amount product*/
	$(document).on('click', '.js-show-info-block', function(e){
		if (window.matchMedia('(max-width: 500px)').matches) {
			return
		}
		var $this = $(this);
		e.stopPropagation();
		$('.js-info-block').fadeOut();

		if($this.hasClass('opened'))
		{
			$('.js-show-info-block').removeClass('opened');
		}
		else
		{
			$('.js-show-info-block').removeClass('opened');
			$this.addClass('opened');
		}

		if(!$this.siblings('.js-info-block').length)
		{
			var dataFields = $this.closest('.sa_block').data('fields');
			dataFields = dataFields == 'null' || dataFields === undefined ? '' : dataFields;
			var dataUserFields = $this.closest('.sa_block').data('user-fields');
			dataUserFields = dataUserFields == 'null' || dataUserFields === undefined ? '' : dataUserFields;
			var objUrl = parseUrlQuery(),
				add_url = '';
			if('clear_cache' in objUrl)
			{
				if(objUrl.clear_cache == 'Y')
					add_url += '?clear_cache=Y';
			}

			var obPostParams = {
				'ajax': 'Y',
				'ELEMENT_ID': $this.data('id'),
				'FIELDS': dataFields,
				'USER_FIELDS': dataUserFields,
				'STORES': $this.closest('.sa_block').data('stores') || ''
			};

			$this.addClass('loadings');
			$.post(arAsproOptions['SITE_DIR']+'ajax/productStoreAmountCompact.php'+add_url, obPostParams)
				.done(function(html){
					$this.removeClass('loadings');
					$(html).appendTo($this.closest('.sa_block'));

					$this.siblings('.js-info-block').find('.more-btn a').attr('href', $this.closest('.item_info').find('a').attr('href'));
					InitScrollBar();

					var eventdata = {action:'jsShowStores'};
					BX.onCustomEvent('onCompleteAction', [eventdata, $this]);
				})
		}
		else
		{
			if($this.hasClass('opened'))
			{
				$this.siblings('.js-info-block').find('.more-btn a').attr('href', $this.closest('.item_info').find('a').attr('href'));
				$this.siblings('.js-info-block').fadeIn();
				InitScrollBar();
			}
			else
			{
				$this.siblings('.js-info-block').fadeOut();
			}
		}
	})
	$(document).on('click', '.js-info-block .svg-inline-close', function(){
		$('.js-show-info-block').removeClass('opened');
		$(this).closest('.js-info-block').fadeOut();
	})
	/**/

	/*adaptive menu start*/
	$('.menu.adaptive').on('click', function(){
		$(this).toggleClass('opened');
		if($(this).hasClass('opened')){
			$('.mobile_menu').toggleClass('opened').slideDown();
		}else{
			$('.mobile_menu').toggleClass('opened').slideUp();
		}
	});
	$('.mobile_menu .has-child &gt;a').on('click', function(e){
		var parentLi=$(this).parent();
		e.preventDefault();
		parentLi.toggleClass('opened');
		parentLi.find('.dropdown').slideToggle();
	})

	$('.mobile_menu .search-input-div input').on('keyup', function(e) {
		var inputValue = $(this).val();
		$('.center_block .stitle_form input').val(inputValue);
		if(e.keyCode == 13){
			$('.center_block .stitle_form form').submit();
		}
	});

	$('.center_block .stitle_form input').on('keyup', function(e) {
		var inputValue = $(this).val();
		$('.mobile_menu .search-input-div input').val(inputValue);
		if(e.keyCode == 13){
			$('.center_block .stitle_form form').submit();
		}
	});

	$('.mobile_menu .search-button-div button').on('click', function(e) {
		e.preventDefault();
		var inputValue = $(this).parents().find('input').val();
		$('.center_block .stitle_form input').val(inputValue);
		$('.center_block .stitle_form form').submit();
	});
	/*adaptive menu end*/

	$(document).on('click', '.mega-menu .dropdown-menu', function(e){
		e.stopPropagation()
	});

	$(document).on('click', '.mega-menu .dropdown-toggle.more-items', function(e){
		e.preventDefault();
	});

	$(document).on('mouseenter', '.table-menu .dropdown,.table-menu .dropdown-submenu,.table-menu .dropdown-toggle', function() {
		// setTimeout(
		// 	function() {
		// 		CheckTopVisibleMenu();
		// 	}, 275);

	});
	$(document).on('mouseenter', '#headerfixed .table-menu .dropdown-menu .dropdown-submenu', function() {
		setTimeout(
			function() {
				CheckTopVisibleMenu();
			}, 275);
	});

	$('.mega-menu .search-item .search-icon, .menu-row #title-search .fa-close').on('click', function(e) {
		e.preventDefault();
		$('.menu-row #title-search').toggleClass('hide');
	});

	$('.mega-menu ul.nav .search input').on('keyup', function(e) {
		var inputValue = $(this).val();
		$('.menu-row &gt; .search input').val(inputValue);
		if(e.keyCode == 13){
			$('.menu-row &gt; .search form').submit();
		}
	});

	$('.menu-row &gt; .search input').on('keyup', function(e) {
		var inputValue = $(this).val();
		$('.mega-menu ul.nav .search input').val(inputValue);
		if(e.keyCode == 13){
			$('.menu-row &gt; .search form').submit();
		}
	});

	$('.mega-menu ul.nav .search button').on('click', function(e) {
		e.preventDefault();
		var inputValue = $(this).parents('.search').find('input').val();
		$('.menu-and-search .search input').val(inputValue);
		$('.menu-row &gt; .search form').submit();
	});

	$('.btn.btn-add').on('click', function(){
		$.ajax({
			type:"GET",
			url:arAsproOptions['SITE_DIR']+"ajax/clearBasket.php",
			success: function(data){
			}
		});
	})

	$('.sort_display a').on('click', function(){
		$(this).siblings().removeClass('current');
		$(this).addClass('current');
	})

	/*detail order show payments*/
	$('.sale-order-detail-payment-options-methods-info-change-link').on('click', function(){
		$(this).closest('.sale-order-detail-payment-options-methods-info').addClass('opened').siblings().addClass('opened');
	})

	/*expand/hide filter values*/
	$(document).on('click', '.expand_block', function(){
		togglePropBlock($(this));
	})

	/*touch event*/
	document.addEventListener('touchend', function(event) {
		if(!$(event.target).closest('.menu-item').length &amp;&amp; !$(event.target).hasClass('menu-item')){
			$('.menu-row .dropdown-menu').css({'display':'none','opacity':0});
			$('.menu-item').removeClass('hover');
			$('.bx-breadcrumb-item.drop').removeClass('hover');
		}
		if(!$(event.target).closest('.menu.topest').length){
			$('.menu.topest').css({'overflow': 'hidden'});
			$('.menu.topest &gt; li').removeClass('hover');
		}
		if(!$(event.target).closest('.full.has-child').length){
			$('.menu_top_block.catalog_block li').removeClass('hover');
		}
		if(!$(event.target).closest('.basket_block').length){
			$('.basket_block .link').removeClass('hover');
			$('.basket_block .basket_popup_wrapp').slideUp();
		}
		if(!$(event.target).closest('.catalog_item').length){
			var tabsContentUnhoverHover = $('.tab:visible').attr('data-unhover') * 1;
			$('.tab:visible').stop().animate({'height': tabsContentUnhoverHover}, 100);
			$('.tab:visible').find('.catalog_item').removeClass('hover');
			$('.tab:visible').find('.catalog_item .buttons_block').stop().fadeOut(233);
			if($('.catalog_block').length){
				$('.catalog_block').find('.catalog_item_wrapp').removeClass('hover');
				$('.catalog_block').find('.catalog_item').removeClass('hover');
			}
		}
		//togglePropBlock($(event.target));

	}, false);


	touchMenu('.menu-row .menu-item');
	touchTopMenu('.menu.topest li');
	touchLeftMenu('.menu_top_block:not(.in-search) li.full');
	touchBreadcrumbs('.bx-breadcrumb-item.drop');

	$(document).on('keyup', '.coupon .input_coupon input', function(){
		if($(this).val().length){
			$(this).removeClass('error');
			$(this).closest('.input_coupon').find('.error').remove();
		}else{
			$(this).addClass('error');
			$("&lt;label class='error'&gt;"+BX.message("INPUT_COUPON")+"&lt;/label&gt;").insertBefore($(this));
		}
	})
	showPhoneMask('input[autocomplete=tel]');
	BX.addCustomEvent(window, "onAjaxSuccessFilter", function(e){
		setBasketStatusBtn();
		checkLinkedArticles();
	});

	$(document).on('click', '.block_container .items .item.initied', function(){
		var _this = $(this),
			itemID = _this.data('id'),
			animationTime = 200;

		_this.closest('.items').fadeOut(animationTime, function(){
			_this.closest('.block_container').find('.detail_items').fadeIn(animationTime);
			_this.closest('.block_container').find('.detail_items .item[data-id='+itemID+']').fadeIn(animationTime);

			var arCoordinates = _this.data('coordinates').split(',');

			if(typeof map !== 'undefined')
				map.setCenter([arCoordinates[0], arCoordinates[1]], 15);
		});
	});

	$(document).on('click', '.block_container .top-close', function(){
		var _this = $(this).closest('.block_container').find('.detail_items .item:visible'),
			animationTime = 200;
		_this.fadeOut(animationTime);
		_this.closest('.block_container').find('.detail_items').fadeOut(animationTime, function(){
			_this.closest('.block_container').find('.items').fadeIn(animationTime);

			if(typeof map !== 'undefined' &amp;&amp; typeof clusterer !== 'undefined')
			{
				map.setBounds(clusterer.getBounds(), {
					zoomMargin: 40,
					// checkZoomRange: true
				});
			}
		});
	});

	BX.addCustomEvent(window, "onAjaxSuccess", function(e){
		if(e != 'OK')
		{
			initSelects(document);
			InitOrderCustom();
			showPhoneMask('input[autocomplete=tel]');

			/*scroll in mobile for filter*/
			if($('.bx_filter').length){
				if(window.matchMedia('(min-width: 768px)').matches){
					// min-width: 768px
					$('.bx_filter .scrollbar').removeClass('mobile-scroll');
					$('.bx_filter .srollbar-custom').removeClass('mobile-scroll');
					$('.bx_filter .bx_filter_section form .bx_filter_parameters').removeClass('mobile-scroll');
					InitScrollBar();
					InitCustomScrollBar();
				}
				else{
					// max-width: 767px
					$('.bx_filter .scrollbar').addClass('mobile-scroll').removeClass('scroll-init');
					$('.bx_filter .srollbar-custom').addClass('mobile-scroll').removeClass('scroll-init');
					$('.bx_filter .bx_filter_section form .bx_filter_parameters').addClass('mobile-scroll').removeClass('scroll-init');
					if($('.bx_filter .mobile-scroll.scrollbar').length)
						$('.bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
					if($('.bx_filter .mobile-scroll.srollbar-custom').length)
						$('.bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
				}
			}
			/*end*/

			if ($('.catalog_detail').length &amp;&amp; !$('.fast_view_frame').length) {
				$('.bx_filter').remove();
				InitFlexSlider();
				InitOwlSlider();
			}

			if (arAsproOptions["PAGES"]["CATALOG_PAGE"]) {
				initCountdown();

				if(typeof window['stickySidebar'] !== 'undefined')
					window['stickySidebar'].updateSticky();
			}

			if (arAsproOptions["PAGES"]["ORDER_PAGE"]) {
				orderActions(e);
			}

			if (e &amp;&amp; typeof e === 'object' &amp;&amp; 'action' in e &amp;&amp; e.action === 'ajaxContentLoadedTab') {
				lazyLoadPagenBlock();
			}

			InitStickySideBar();
		}
	});

	//event for default basket quantity change
	BX.addCustomEvent(window, "OnBasketChange", function(e){
		if(arAsproOptions["PAGES"]["BASKET_PAGE"])
		{
			var summ = 0,
				title = '';

			if(typeof BX.Sale !== "undefined")
			{
				if(typeof BX.Sale.BasketComponent !== "undefined")
				{
					summ = BX.Sale.BasketComponent.result.allSum;
					title = BX.message('JS_BASKET_COUNT_TITLE').replace('SUMM', summ);
				}
			}
			else
			{
				summ = $('#allSum_FORMATED').html().replace(/&amp;nbsp;/g, ' ');
				title = BX.message('JS_BASKET_COUNT_TITLE').replace('SUMM', summ);
			}

			if($('.js-basket-block .wrap .prices').length)
				$('.js-basket-block .wrap .prices').html(summ);
			if($('a.basket-link.basket').length)
				$('a.basket-link.basket').attr('title', title);
			if($('.basket_fly .opener .basket_count').length)
				$('.basket_fly .opener .basket_count').attr('title', title);

		}
	})
});

if(!funcDefined('setBasketStatusBtn')){
	setBasketStatusBtn = function(type){
		var bSync = (typeof type !== undefined);
		if(typeof(arBasketAspro) !== 'undefined')
		{
			if('BASKET' in arBasketAspro) // basket items
			{
				if(arBasketAspro.BASKET)
				{
					for(var i in arBasketAspro.BASKET)
					{
						$('.to-cart[data-item='+i+']').hide();
						$('.counter_block[data-item='+i+']').closest('.counter_block_inner').hide();
						$('.counter_block[data-item='+i+']').hide();
						$('.in-cart[data-item='+i+']').show();
						$('.in-cart[data-item='+i+']').closest('.button_block').addClass('wide');

						$('.wish_item.to[data-item='+i+']').show();
						$('.wish_item.in[data-item='+i+']').hide();

						if($('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .basket_item_add').length)
						{
							$('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .basket_item_add').addClass('added')
							$('.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'))
						}


					}
				}
			}

			if('DELAY' in arBasketAspro) // delay items
			{
				if(arBasketAspro.DELAY)
				{
					for(var i in arBasketAspro.DELAY)
					{
						$('.wish_item.to[data-item='+i+']').hide();
						$('.wish_item.in[data-item='+i+']').show();
						if ($('.wish_item[data-item='+i+']').find(".value.added").length)
						{
							//$('.wish_item[data-item='+i+']').addClass("added");
							$('.wish_item[data-item='+i+']').find(".value").hide();
							$('.wish_item[data-item='+i+']').find(".value.added").css('display','block');
						}

						$('.in-cart[data-item='+i+']').hide();
						$('.to-cart[data-item='+i+']').show();
						$('.to-cart[data-item='+i+']').closest('.counter_wrapp').find('.counter_block_inner').show();
						$('.to-cart[data-item='+i+']').closest('.counter_wrapp').find('.counter_block').show();
						$('.to-cart[data-item='+i+']').closest('.button_block').removeClass('wide');

						if($('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .wish_item_add').length)
						{
							$('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .wish_item_add').addClass('added')
							$('.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'))
						}
					}
				}
			}

			if('SUBSCRIBE' in arBasketAspro) // subscribe items
			{
				if(arBasketAspro.SUBSCRIBE)
				{
					for(var i in arBasketAspro.SUBSCRIBE)
					{
						$('.to-subscribe[data-item='+i+']').hide();
						$('.in-subscribe[data-item='+i+']').show();
					}
				}
			}

			if('COMPARE' in arBasketAspro) // compare items
			{
				if(arBasketAspro.COMPARE)
				{
					for(var i in arBasketAspro.COMPARE)
					{
						$('.compare_item.to[data-item='+i+']').hide();
						$('.compare_item.in[data-item='+i+']').show();
						if ($('.compare_item[data-item='+i+']').find(".value.added").length)
						{
							//$('.compare_item[data-item='+i+']').addClass("added");
							$('.compare_item[data-item='+i+']').find(".value").hide();
							$('.compare_item[data-item='+i+']').find(".value.added").css('display','block');
						}

						if($('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .compare_item_add').length)
						{
							$('.banner_buttons.with_actions .wraps_buttons[data-id='+i+'] .compare_item_add').addClass('added')
							$('.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'))
						}
					}
				}
			}
		}
	}
}

if(!funcDefined('togglePropBlock')){
	togglePropBlock=function(className){
		var all_props_block = className.closest('.bx_filter_parameters_box_container').find('.hidden_values');
		if(all_props_block.length &amp;&amp; (className.hasClass('inner_text') || className.hasClass('expand_block')))
		{
			if(all_props_block.is(':visible'))
			{
				className.text(BX.message('FILTER_EXPAND_VALUES'));
				all_props_block.hide();
			}
			else
			{
				className.text(BX.message('FILTER_HIDE_VALUES'));
				all_props_block.show();
			}
		}
	}
}

if(!funcDefined('showPhoneMask')){

	showPhoneMask=function(className, options = {}) {

		const phoneField = document.querySelector(className);
		if(!phoneField) {return;}
		import(`/local/templates/simpleIT/js/inputmask/inputmask.esm.js`).then( lib =&gt; {
			if(window.location.origin.includes("gm.kg")) {
				IMask(phoneField, { mask: '+{996} 000 000 000', lazy: false, overwrite: 'shift'})
			} else if(window.location.origin.includes("promet.uz")) {
				IMask(phoneField, { mask: '+{998} 000 000 000', lazy: false, overwrite: 'shift'})
			} else {
				IMask(phoneField, { mask: '+{7} (000) 000-00-00', lazy: false, overwrite: 'shift'})
			}
		})
	}

}

if(!funcDefined('getActualBasket')){
	getActualBasket=function(iblockID, type, sync){
		var data='';
		if(typeof iblockID !=="undefined" &amp;&amp; iblockID){
			data={"iblockID":iblockID}
		}
		$.ajax({
			type:"GET",
			url:arAsproOptions['SITE_DIR']+"ajax/actualBasket.php",
			data:data,
			success: function(data){
				if(!$('.js_ajax').length)
					$('body').append('&lt;div class="js_ajax"&gt;&lt;/div&gt;');
				$('.js_ajax').html(data);

				if(typeof sync !=="undefined"){
					setBasketStatusBtn(true);
				}

				if(typeof(type) !== undefined)
				{
					var eventdata = {action:'loadActualBasket'+type};
					BX.onCustomEvent('onCompleteAction', [eventdata]);
				}
			}
		});
	}
}

if(!funcDefined('reloadBasketCounters')){
	reloadBasketCounters=function(count, sync){
		var data='';
		if(count) {
			$('.basket-link.basket .count, .wraps_icon_block.basket .count .items &gt; span').text(count);
		} else {
			$.ajax({
				type:"GET",
				url:arAsproOptions['SITE_DIR']+"ajax/actualBasket.php",
				data:data,
				success: function(data){
					if(!$('.js_ajax').length)
						$('body').append('&lt;div class="js_ajax"&gt;&lt;/div&gt;');
					$('.js_ajax').html(data);

					$('.basket-link.basket .count, .wraps_icon_block.basket .count .items &gt; span').text(Object.keys(arBasketAspro.BASKET).length);
					$('.basket-link.delay .count, .wraps_icon_block.delay .count .items &gt; span').text(Object.keys(arBasketAspro.DELAY).length);
					$('.basket-link.compare .count, .wraps_icon_block.compare .count .items &gt; span').text(Object.keys(arBasketAspro.COMPARE).length);

					if(typeof sync !== 'undefined')
					{
						setBasketStatusBtn(true);
					}
				}
			});
		}
	}
}

function touchMenu(selector){
	if(isMobile){
		if($(selector).length)
		{
			$(selector).each(function(){
				var th=$(this);
				th.on('touchend', function(e) {
					var _th = $(e.target).closest('.menu-item');

					$('.menu.topest &gt; li').removeClass('hover');
					$('.menu_top_block.catalog_block li').removeClass('hover');
					$('.bx-breadcrumb-item.drop').removeClass('hover');

					if (_th.find('.dropdown-menu').length &amp;&amp; !_th.hasClass('hover')) {
						e.preventDefault();
						e.stopPropagation();
						_th.siblings().removeClass('hover');
						_th.addClass('hover');
						$('.menu-row .dropdown-menu').css({'display':'none', 'opacity':0});
						if(_th.hasClass('menu-item'))
						{
							_th.closest('.dropdown-menu').css({'display':'block', 'opacity':1});
						}
						if(_th.find('&gt; .wrap &gt; .dropdown-menu'))
						{
							_th.find('&gt; .wrap &gt; .dropdown-menu').css({'display':'block', 'opacity':1});
						}
						else if(_th.find('&gt; .dropdown-menu'))
						{
							_th.find('&gt; .dropdown-menu').css({'display':'block', 'opacity':1});
						}
						CheckTopVisibleMenu();
					}
					else
					{
						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
						if(href &amp;&amp; href !== 'undefined')
							location.href = href;
					}
				})
			})
		}
	}else{
		$(selector).off();
	}
}

function touchTopMenu(selector){
	if(isMobile){
		if($(selector).length)
		{
			$(selector).each(function(){
				var th=$(this);
				th.on('touchend', function(e) {
					var _th = $(e.target).closest('li');

					$('.menu-item').removeClass('hover');
					$('.menu_top_block.catalog_block li').removeClass('hover');
					$('.bx-breadcrumb-item.drop').removeClass('hover');

					if (_th.hasClass('more') &amp;&amp; !_th.hasClass('hover')) {
						e.preventDefault();
						e.stopPropagation();
						_th.siblings().removeClass('hover');
						_th.addClass('hover');
						$('.menu.topest').css({'overflow': 'visible'});
					}
					else
					{
						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
						if(href &amp;&amp; href !== 'undefined')
							location.href = href;
					}
				})
			})
		}
	}else{
		$(selector).off();
	}
}

function touchLeftMenu(selector){
	if(isMobile){
		if($(selector).length)
		{
			$(selector).each(function(){
				var th=$(this);
				th.on('touchend', function(e) {
					var _th = $(e.target).closest('li');

					$('.menu-item').removeClass('hover');
					$('.bx-breadcrumb-item.drop').removeClass('hover');
					$('.menu.topest &gt; li').removeClass('hover');

					if (_th.hasClass('has-child') &amp;&amp; !_th.hasClass('hover')) {
						e.preventDefault();
						e.stopPropagation();
						_th.siblings().removeClass('hover');
						_th.addClass('hover');
					}
					else
					{
						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'))
						if(href &amp;&amp; href !== 'undefined')
							location.href = href;
					}
				})
			})
		}
	}else{
		$(selector).off();
	}
}

function touchBreadcrumbs(selector){
	if(isMobile){
		if($(selector).length)
		{
			$(selector).each(function(){
				var th=$(this);
				th.on('touchend', function(e) {
					var _th = $(e.target).closest('.bx-breadcrumb-item');

					$('.menu-item').removeClass('hover');
					$('.menu.topest &gt; li').removeClass('hover');
					$('.menu_top_block.catalog_block li').removeClass('hover');

					if(!_th.hasClass('hover')) {
						e.preventDefault();
						e.stopPropagation();
						_th.siblings().removeClass('hover');
						_th.addClass('hover');
					}
					else
					{
						_th.removeClass('hover');
						var href = ($(e.target).attr('href') ? $(e.target).attr('href') : $(e.target).closest('a').attr('href'));
						if(href &amp;&amp; href !== 'undefined')
							location.href = href;
					}
				})
			})
		}
	}else{
		$(selector).off();
	}
}

function touchItemBlock(selector){
	/*if(isMobile){
		if($(selector).length)
		{
			$(selector).each(function(){
				var th=$(this),
					item=th.closest('.catalog_item');
				th.on('touchend', function(e) {
					if (!item.hasClass('hover')) {
						e.preventDefault();
						// e.stopPropagation();
						item.siblings().removeClass('hover');
						item.siblings().blur();
						item.closest('.catalog_block').find('.catalog_item').removeClass('hover');
						item.addClass('hover');
						item.addClass('touch');

						var tabsContentHover = th.closest('.tab').attr('data-hover') * 1,
							tabsContentUnhoverHover = th.closest('.tab').attr('data-unhover') * 1;

						th.closest('.tab').stop().animate({'height': tabsContentUnhoverHover}, 100);
						th.closest('.catalog_item').siblings().find('.buttons_block').stop().fadeOut(233)

						th.closest('.tab').fadeTo(100, 1);
						th.closest('.tab').stop().css({'height': tabsContentHover});
						th.closest('.catalog_item').find('.buttons_block').fadeIn(450, 'easeOutCirc');
					}
				})
			})
		}
	}else{
		$(selector).off();
	}*/
}
function touchBasket(selector){
	if(arAsproOptions['THEME']['SHOW_BASKET_ONADDTOCART'] !== 'N'){
		if($(window).outerWidth()&gt;600){
			$(document).find(selector).on('touchend', function(e) {
				if ($(this).parent().find('.basket_popup_wrapp').length &amp;&amp; !$(this).hasClass('hover')) {
					e.preventDefault();
					e.stopPropagation();
					$(this).addClass('hover');
					$(this).parent().find('.basket_popup_wrapp').slideDown();
				}
			})
		}else{
			$(selector).off();
		}
	}
}

function showTotalSummItem(popup){
	//show total summ
	if(arAsproOptions["THEME"]["SHOW_TOTAL_SUMM_TYPE"] == "ALWAYS" &amp;&amp; arAsproOptions["THEME"]["SHOW_TOTAL_SUMM"] == "Y")
	{
		var parent = 'body ';
		if(typeof popup  === 'string' &amp;&amp; popup == 'Y')
			parent = '.popup ';
		$(parent+'.counter_wrapp .counter_block input.text').each(function(){
			var _th = $(this);
			if(_th.data('product'))
			{
				var obProduct = _th.data('product');
				if(typeof window[obProduct] == 'object')
					window[obProduct].setPriceAction('Y');
				else
					setPriceItem(_th.closest('.main_item_wrapper'), _th.val());
			}
			else
				setPriceItem(_th.closest('.main_item_wrapper'), _th.val());
		})
	}
}

function initFull(){
	initSelects(document);
	initHoverBlock(document);
	touchItemBlock('.catalog_item a');
	InitOrderCustom();
	showTotalSummItem();
	basketActions();
	orderActions();

	checkMobileRegion();
}

checkMobileRegion = function(){
	if($('.confirm_region').length)
	{
		if(!$('.top_mobile_region').length)
			$('&lt;div class="top_mobile_region"&gt;&lt;div class="confirm_wrapper"&gt;&lt;div class="confirm_region"&gt;&lt;/div&gt;&lt;div class="close_popup"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;').insertBefore($('#mobileheader'));
		$('.top_mobile_region .confirm_region').html($('.confirm_region').html());

		$('.top_mobile_region .close_popup').click(function(){
			$(this).remove();
			$('.confirm_region').remove();
		})
	}
}
// Ð§Ñ‚Ð¾Ð±Ñ‹ ÑÐ¾Ð±Ñ‹Ñ‚Ð¸Ðµ Ð¾Ñ‚Ð¿Ñ€Ð°Ð²ÐºÐ¸ Ð½Ð¾Ð¼ÐµÑ€Ð° Ñ‚ÐµÐ»ÐµÑ„Ð¾Ð½Ð° Ð½Ðµ Ð½Ð°Ð²ÐµÑˆÐ¸Ð²Ð°Ð»Ð¾ÑÑŒ Ð¿Ð¾Ð²Ñ‚Ð¾Ñ€Ð½Ð¾
if(!funcDefined('orderActions')){
	orderActions = function(e){
		if(arAsproOptions["PAGES"]["ORDER_PAGE"]){
			//phone
			if($('#bx-soa-order input[autocomplete=tel]').length){
				// get property phone
				for(var i = 0;i&lt;BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties.length;++i){
					if(BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties[i].IS_PHONE == 'Y'){
						var arPropertyPhone = BX.Sale.OrderAjaxComponent.result.ORDER_PROP.properties[i];
					}
				}

				// validate input type=tel
				if(typeof(BX.Sale.OrderAjaxComponent) !== 'undefined' &amp;&amp; typeof(BX.Sale.OrderAjaxComponent) === 'object' &amp;&amp; typeof(arPropertyPhone) == 'object' &amp;&amp; arPropertyPhone){
					BX.Sale.OrderAjaxComponent.validatePhone = function(input, arProperty, fieldName)
					{
						// console.log(arProperty)
						if (!input || !arProperty)
							return [];

						var value = input.value,
							errors = [],
							name = BX.util.htmlspecialchars(arProperty.NAME),
							field = BX.message('SOA_FIELD') + ' "' + name + '"',
							re;

						if (arProperty.REQUIRED == 'Y' &amp;&amp; value.length == 0){
							errors.push(field + ' ' + BX.message('SOA_REQUIRED'));
						}

						if(arProperty.IS_PHONE == 'Y' &amp;&amp; value.length &gt; 0 &amp;&amp; !BX.Sale.OrderAjaxComponent.params.FOREIGN_REGION){
							function regexpPhone(value, element, regexp){
								var re = new RegExp( regexp );
								return re.test(value);
							}

							var validPhone = regexpPhone($(input).val(), $(input), arAsproOptions['THEME']['VALIDATE_PHONE_MASK']);

							if(!validPhone){
								errors.push(field + ' ' +BX.message('JS_FORMAT_ORDER'));
							}
						}

						return errors;
					}

					BX.Sale.OrderAjaxComponent.getValidationDataPhone = function(arProperty, propContainer){
						var data = {}, inputs;
						switch (arProperty.TYPE)
						{
							case 'STRING':
								data.action = 'blur';
								data.func = BX.delegate(function(input, fieldName){
									return this.validatePhone(input, arProperty, fieldName);
								}, this);

								inputs = propContainer.querySelectorAll('input[type=tel]');
								if ($(inputs).length)
								{
									data.inputs = inputs;
									break;
								}
						}
						return data;
					};

					BX.Sale.OrderAjaxComponent.bindValidationPhone = function(id, propContainer)
					{
						if (!this.validation.properties || !this.validation.properties[id])
							return;

						var arProperty = this.validation.properties[id],
							data = this.getValidationDataPhone(arProperty, propContainer),
							i, k;

						if (data &amp;&amp; data.inputs &amp;&amp; data.action)
						{
							for (i = 0; i &lt; $(data.inputs).length; i++)
							{
								if (BX.type.isElementNode(data.inputs[i])){
									BX.bind(data.inputs[i], data.action, BX.delegate(function(){
										this.isValidProperty(data);
									}, this));
								}
								else{
									for (k = 0; k &lt; $(data.inputs[i]).length; k++)
										BX.bind(data.inputs[i][k], data.action, BX.delegate(function(){
											this.isValidProperty(data);
										}, this));
								}
							}
						}
					};

					BX.Sale.OrderAjaxComponent.isValidPropertiesBlock = function(excludeLocation)
					{
						if (!this.options.propertyValidation)
							return [];

						var props = this.orderBlockNode.querySelectorAll('.bx-soa-customer-field[data-property-id-row]'),
							propsErrors = [],
							id, propContainer, arProperty, data, i;

						for (i = 0; i &lt; props.length; i++)
						{
							id = props[i].getAttribute('data-property-id-row');

							if (!!excludeLocation &amp;&amp; this.locations[id])
								continue;

							propContainer = props[i].querySelector('.soa-property-container');
							if (propContainer)
							{
								arProperty = this.validation.properties[id];
								data = this.getValidationData(arProperty, propContainer);

								if(arProperty.CODE === 'PHONE') {
									let dataPhone = this.getValidationDataPhone(arProperty, propContainer);
									data = $.extend({}, data, dataPhone);
								}

								propsErrors = propsErrors.concat(this.isValidProperty(data, true));
							}
						}

						return propsErrors;
					};

					// create input type=tel
					var input = $('input[autocomplete=tel]'),
						inputHTML = input[0].outerHTML,
						value = input.val(),
						newInput = input[0].outerHTML.replace('type="text"', 'type="tel" value="'+value+'"');

					if($(input).length &lt; 2)
					{
						input.hide();
						$(newInput).insertAfter(input);
					}
					if (true || !BX.Sale.OrderAjaxComponent.params.FOREIGN_REGION ) {
						showPhoneMask('input[autocomplete=tel][type=tel]');
					}

					// change value input type=text when change input type=tel
					$('input[autocomplete=tel][type=tel]').on('blur', function() {
						var $this = $(this);

						var value = $this.val();
						$this.parent().find('input[autocomplete=tel][type=text]').val(value);
					});

					let phoneField = document.querySelector('#soa-property-3[type=tel]');

					if(phoneField) {
						phoneField.addEventListener('blur', BX.Sale.OrderAjaxComponent.blurPhoneFieldHandler.bind(BX.Sale.OrderAjaxComponent))
						window.onbeforeunload = BX.Sale.OrderAjaxComponent.beforeUnLoadHandler.bind(BX.Sale.OrderAjaxComponent)
					}
					BX.Sale.OrderAjaxComponent.bindValidationPhone(arPropertyPhone.ID, $('input[autocomplete=tel]').parent()[0]);
				}
			}

			if($('.bx-soa-cart-total').length){
				if(!$('.change_basket').length)
					$('.bx-soa-cart-total').prepend('&lt;div class="change_basket"&gt;'+BX.message("BASKET_CHANGE_TITLE")+'&lt;a href="'+arAsproOptions["SITE_DIR"]+'basket/" class="change_link"&gt;'+BX.message("BASKET_CHANGE_LINK")+'&lt;/a&gt;&lt;/div&gt;');

				if(typeof (BX.Sale.OrderAjaxComponent) == "object"){
					if(arAsproOptions['COUNTERS']['USE_FULLORDER_GOALS'] !== 'N'){
						if(typeof BX.Sale.OrderAjaxComponent.reachgoalbegin === 'undefined'){
							BX.Sale.OrderAjaxComponent.reachgoalbegin = true;
							var eventdata = {goal: 'goal_order_begin'};
							BX.onCustomEvent('onCounterGoals', [eventdata])
						}
					}

					if(BX.Sale.OrderAjaxComponent.hasOwnProperty("params")){
						$('.bx-soa-cart-total .change_link').attr('href', BX.Sale.OrderAjaxComponent.params.PATH_TO_BASKET);
						if(arAsproOptions["PRICES"]["MIN_PRICE"]){
							if(arAsproOptions["PRICES"]["MIN_PRICE"]&gt;Number(BX.Sale.OrderAjaxComponent.result.TOTAL.ORDER_PRICE)){
								$('&lt;div class="fademask_ext"&gt;&lt;/div&gt;').appendTo($('body'));
								location.href=BX.Sale.OrderAjaxComponent.params.PATH_TO_BASKET;
							}
						}
					}

					// update oreder auth form
					if($('#bx-soa-auth').length &amp;&amp; !$('#bx-soa-auth .redisigned').length){
						// update input USER_LOGIN
						if($('input[name="USER_LOGIN"]').length){
							var $label = $('input[name="USER_LOGIN"]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
							if(!$label.find('.bx-authform-starrequired').length){
								$label.html($label.html() + '&lt;span class="bx-authform-starrequired"&gt; *&lt;/span&gt;');
							}
						}

						// update input USER_PASSWORD
						if($('input[name="USER_PASSWORD"]').length){
							var $label = $('input[name="USER_PASSWORD"]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
							if(!$label.find('.bx-authform-starrequired').length){
								$label.html($label.html() + '&lt;span class="bx-authform-starrequired"&gt; *&lt;/span&gt;');
							}
						}

						if($('input[name="USER_REMEMBER"]').length){
							var $label = $('input[name="USER_REMEMBER"]').attr('id', 'ORDER_AUTH_USER_REMEMBER').closest('label').attr('for', 'ORDER_AUTH_USER_REMEMBER');
							var html = $('input[name="USER_REMEMBER"]').attr('id', 'ORDER_AUTH_USER_REMEMBER').wrap('&lt;div id="trem_"&gt;&lt;/div&gt;').parent().html();
							$('#trem_').remove();
							$label.html($label.text());
							$(html).insertBefore($label).closest('.bx-authform-formgroup-container').addClass('filter');
							var html = $('#bx-soa-auth .bx-authform&gt;a').addClass('pull-right').addClass('forgot').wrap('&lt;div id="trem_"&gt;&lt;/div&gt;').parent().html();
							$('#trem_').remove();
							$(html).insertAfter($label.closest('.checkbox'));
						}

						$('#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'));

						$('#bx-soa-auth').append('&lt;div class="redisigned hidden&gt;&lt;/div&gt;');
					}

					// update oreder register form
					if($('.bx-soa-section-content.reg').length &amp;&amp; !$('.bx-soa-section-content.reg .redisigned').length){
						var bRebindRegSubmit = false;

						if(arAsproOptions.THEME.LOGIN_EQUAL_EMAIL === 'Y'){
							bRebindRegSubmit = true;

							// update input NEW_LOGIN
							if($('input[name="NEW_LOGIN"]').length){
								$('input[name="NEW_LOGIN"]').closest('.bx-authform-formgroup-container').hide();
							}
						}

						if(arAsproOptions.THEME.PERSONAL_ONEFIO === 'Y'){
							bRebindRegSubmit = true;

							// update input NEW_NAME
							if($('input[name="NEW_NAME"]').length){
								$('input[name="NEW_NAME"]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container').html(BX.message('ORDER_FIO_LABEL') + '&lt;span class="bx-authform-starrequired"&gt; *&lt;/span&gt;');
							}

							// update input NEW_LAST_NAME
							if($('input[name="NEW_LAST_NAME"]').length){
								$('input[name="NEW_LAST_NAME"]').closest('.bx-authform-formgroup-container').hide();
								$('input[name="NEW_LAST_NAME"]').val(' ');
							}
						}

						if(bRebindRegSubmit){
							// bind new handler for submit button
							var $regSubmit = $('#do_register~input[type=submit]');
							if($regSubmit.length){
								BX.unbindAll($regSubmit[0]);
								$(document).on('click', '#do_register~input[type=submit]', function(e){
									e.preventDefault();
									e.stopImmediatePropagation();

									if(arAsproOptions.THEME.LOGIN_EQUAL_EMAIL === 'Y'){
										var email = BX.findChild(BX('bx-soa-auth'), {attribute: {'name': 'NEW_EMAIL'}}, true, false);
										var login = BX.findChild(BX('bx-soa-auth'), {attribute: {'name': 'NEW_LOGIN'}}, true, false);

										if(login &amp;&amp; email){
											login.value = email.value;
										}
									}

									BX('do_register').value = 'Y';
									BX.Sale.OrderAjaxComponent.sendRequest('showAuthForm');
								});
							}
						}

						// update captcha
						var $captcha = $('.bx-soa-section-content.reg').find('.bx-captcha');
						if($captcha.length){
							$captcha.addClass('captcha_image');
							$captcha.append('&lt;div class="captcha_reload"&gt;&lt;/div&gt;');
							$captcha.closest('.bx-authform-formgroup-container').addClass('captcha-row').find('input[name=captcha_word]').closest('.bx-authform-input-container').addClass('captcha_input');
						}

						// update input NEW_NAME &amp;&amp; NEW_LAST_NAME
						if($('input[name=NEW_NAME]').length &amp;&amp; $('input[name=NEW_LAST_NAME]').length &amp;&amp; arAsproOptions.THEME.PERSONAL_ONEFIO !== 'Y'){
							if(!$('input[name=NEW_NAME]').closest('.bx-authform-formgroup-container.col-md-6').length){
								$('input[name=NEW_NAME],input[name=NEW_LAST_NAME]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
								var html = $('input[name=NEW_LAST_NAME]').closest('.bx-authform-formgroup-container').wrap('&lt;div id="trem_"&gt;&lt;/div&gt;').parent().html();
								$('#trem_').remove();
								$(html).insertAfter($('input[name=NEW_NAME]').closest('.bx-authform-formgroup-container').wrap('&lt;div class="row"&gt;&lt;/div&gt;'));
							}
						}

						// update input NEW_EMAIL &amp;&amp; PHONE_NUMBER
						if($('input[name=NEW_EMAIL]').length &amp;&amp; $('input[name=PHONE_NUMBER]').length){
							if(!$('input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container.col-md-6').length){
								$('input[name=NEW_EMAIL],input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
								var html = $('input[name=PHONE_NUMBER]').closest('.bx-authform-formgroup-container').wrap('&lt;div id="trem_"&gt;&lt;/div&gt;').parent().html();
								$('#trem_').remove();
								$(html).insertAfter($('input[name=NEW_EMAIL]').closest('.bx-authform-formgroup-container').wrap('&lt;div class="row"&gt;&lt;/div&gt;'));
							}
						}

						// update input NEW_PASSWORD &amp;&amp; NEW_PASSWORD_CONFIRM
						if($('input[name=NEW_PASSWORD]').length &amp;&amp; $('input[name=NEW_PASSWORD_CONFIRM]').length){
							if(!$('input[name=NEW_PASSWORD]').closest('.bx-authform-formgroup-container.col-md-6').length){
								$('input[name=NEW_PASSWORD],input[name=NEW_PASSWORD_CONFIRM]').closest('.bx-authform-formgroup-container').addClass('col-md-6');
								var html = $('input[name=NEW_PASSWORD_CONFIRM]').closest('.bx-authform-formgroup-container').wrap('&lt;div id="trem_"&gt;&lt;/div&gt;').parent().html();
								$('#trem_').remove();
								$(html).insertAfter($('input[name=NEW_PASSWORD]').closest('.bx-authform-formgroup-container').wrap('&lt;div class="row"&gt;&lt;/div&gt;'));
							}
						}

						// update input PHONE_NUMBER
						if($('input[name=PHONE_NUMBER]').length){
							var input = $('input[name=PHONE_NUMBER]'),
								inputHTML = input[0].outerHTML,
								value = input.val(),
								newInput = input[0].outerHTML.replace('type="text"', 'type="tel" value="'+value+'"');

							if($(input).length &lt; 2){
								input.hide();
								$(newInput).insertAfter(input);

								showPhoneMask('input[name=PHONE_NUMBER][type=tel]');

								$('input[name=PHONE_NUMBER][type=tel]').on('blur', function(){
									var $this = $(this);
									var value = $this.val();
									$this.parent().find('input[name=PHONE_NUMBER][type=text]').val(value);
								});

								var $label = $('input[name=PHONE_NUMBER][type=tel]').closest('.bx-authform-formgroup-container').find('.bx-authform-label-container');
								$label.html(BX.message('ORDER_PHONE_LABEL') + ($label.find('.bx-authform-starrequired').length ? '&lt;span class="bx-authform-starrequired"&gt; *&lt;/span&gt;' : ''));
							}
						}

						$('.bx-soa-section-content.reg').append('&lt;div class="redisigned hidden&gt;&lt;/div&gt;');
					}

					if($('.bx-soa-cart-total-line-total').length &amp;&amp; arAsproOptions["THEME"]["SHOW_LICENCE"] == "Y"){
						if(typeof(e) === 'undefined')
							BX.Sale.OrderAjaxComponent.state_licence = (arAsproOptions['THEME']['LICENCE_CHECKED'] == 'Y' ? 'checked' : '');

						if(!$('.licence_block.filter').length){
							$('&lt;div class="form"&gt;&lt;div class="licence_block filter label_block onoff"&gt;&lt;label data-for="licenses_order" class="hidden error"&gt;'+BX.message('JS_REQUIRED_LICENSES')+'&lt;/label&gt;&lt;input type="checkbox" name="licenses_order" required '+BX.Sale.OrderAjaxComponent.state_licence+' value="Y"&gt;&lt;label data-for="licenses_order" class="license"&gt;'+BX.message('LICENSES_TEXT')+'&lt;/label&gt;&lt;/div&gt;&lt;/div&gt;').insertBefore($('#bx-soa-orderSave'));

							$(document).on('click', '.bx-soa .licence_block label.license', function(){
								var id = $(this).data('for');
								$('.bx-soa .licence_block label.error').addClass('hidden');
								if(!$('input[name='+id+']').prop('checked')){
									$('input[name='+id+']').prop('checked', 'checked');
									BX.Sale.OrderAjaxComponent.state_licence = 'checked';
								}
								else{
									$('input[name='+id+']').prop('checked', '');
									BX.Sale.OrderAjaxComponent.state_licence = '';
								}
							})

							$(document).on('click', '.lic_condition a', function(){
								if(BX.hasClass(BX('bx-soa-order'), 'orderform--v1')){
									if(BX.Sale.OrderAjaxComponent.isValidForm())
									{
										BX.Sale.OrderAjaxComponent.animateScrollTo($('.licence_block')[0], 800, 50);
									}
								}
								else{
									var iCountErrors = BX.Sale.OrderAjaxComponent.isValidPropertiesBlock().length;
									if(!BX.Sale.OrderAjaxComponent.activeSectionId || !iCountErrors)
									{
										BX.Sale.OrderAjaxComponent.animateScrollTo($('.licence_block')[0], 800, 50);
									}
								}
							})
						}

						$('#bx-soa-orderSave, .bx-soa-cart-total-button-container').addClass('lic_condition');

						if(typeof (BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction) === "undefined" &amp;&amp; typeof (BX.Sale.OrderAjaxComponent.clickOrderSaveAction) !== 'undefined'){
							BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction = BX.Sale.OrderAjaxComponent.clickOrderSaveAction;
							BX.Sale.OrderAjaxComponent.clickOrderSaveAction = async function(event){
								if($('input[name="licenses_order"]').prop('checked')){
									$('.bx-soa .licence_block label.error').addClass('hidden');

									if (BX.Sale.OrderAjaxComponent.isValidForm())
									{
										let isPhoneConfirmed = await BX.Sale.OrderAjaxComponent.isOrderConfirmed();
										if ( !isPhoneConfirmed.isPhoneConfirmed ) {
											BX.Sale.OrderAjaxComponent.sendRequest('showCheckPhoneForm');
											return;
										}
										if(typeof BX.Sale.OrderAjaxComponent.allowOrderSave == 'function') {
											BX.Sale.OrderAjaxComponent.allowOrderSave();
										}
										if(typeof BX.Sale.OrderAjaxComponent.doSaveAction == 'function') {
											BX.Sale.OrderAjaxComponent.doSaveAction();
										} else {
											BX.Sale.OrderAjaxComponent.oldClickOrderSaveAction(event);
										}
									}
								}
								else{
									$('.bx-soa .licence_block label.error').removeClass('hidden');
								}
							}
							if(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox'))
							{
								if(typeof browser == 'object')
								{
									if('msie' in browser &amp;&amp; browser.msie)
										$(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox')).remove();
									else
										BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('.checkbox').remove();
								}
							}
							BX.unbindAll(BX.Sale.OrderAjaxComponent.totalInfoBlockNode.querySelector('a.btn-order-save'));
							BX.unbindAll(BX.Sale.OrderAjaxComponent.mobileTotalBlockNode.querySelector('a.btn-order-save'));
							BX.unbindAll(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('a'));
							BX.bind(BX.Sale.OrderAjaxComponent.totalInfoBlockNode.querySelector('a.btn-order-save'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
							BX.bind(BX.Sale.OrderAjaxComponent.mobileTotalBlockNode.querySelector('a.btn-order-save'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
							BX.bind(BX.Sale.OrderAjaxComponent.orderSaveBlockNode.querySelector('a'), 'click', BX.proxy(BX.Sale.OrderAjaxComponent.clickOrderSaveAction, BX.Sale.OrderAjaxComponent));
						}
					}

					// fix hide total block
					$(window).scroll();

					if(checkCounters() &amp;&amp; typeof (BX.Sale.OrderAjaxComponent.oldSaveOrder) === "undefined"){
						var saveFunc = typeof (BX.Sale.OrderAjaxComponent.saveOrder) !== 'undefined' ? 'saveOrder' : 'saveOrderWithJson';
						if(typeof (BX.Sale.OrderAjaxComponent[saveFunc]) !== 'undefined'){
							BX.Sale.OrderAjaxComponent.oldSaveOrder = BX.Sale.OrderAjaxComponent[saveFunc];
							BX.Sale.OrderAjaxComponent[saveFunc] = function(result){
								var res = BX.parseJSON(result);
								if (res &amp;&amp; res.order){
									if (!res.order.SHOW_AUTH){
										if (res.order.REDIRECT_URL &amp;&amp; res.order.REDIRECT_URL.length &amp;&amp; (!res.order.ERROR || BX.util.object_keys(res.order.ERROR).length &lt; 1)){
											if((arMatch = res.order.REDIRECT_URL.match(/ORDER_ID\=[^&amp;=]*/g)) &amp;&amp; arMatch.length &amp;&amp; (_id = arMatch[0].replace(/ORDER_ID\=/g, '', arMatch[0]))){
												$.ajax({
													url:arAsproOptions['SITE_DIR']+"ajax/check_order.php",
													dataType: "json",
													type: "POST",
													data: { "ID": _id },
													success: function(id){
														if(parseInt(id)){
															purchaseCounter(parseInt(id), BX.message('FULL_ORDER'), function(d){
																if(typeof localStorage !== 'undefined' &amp;&amp; typeof d === 'object'){
																	localStorage.setItem('gtm_e_' + _id, JSON.stringify(d));
																}
																BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
															});
														}
														else{
															BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
														}
													},
													error: function(){
														BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
													}
												})
											}
											else{
												BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
											}
										}
										else{
											BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
										}
									}
									else{
										BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
									}
								}
								else{
									BX.Sale.OrderAjaxComponent.oldSaveOrder(result);
								}
							}
						}
					}

					if($('#bx-soa-order-form .captcha-row').length){
						if(window.asproRecaptcha &amp;&amp; window.asproRecaptcha.key &amp;&amp; window.asproRecaptcha.params.recaptchaSize == 'invisible'){
							$('#bx-soa-order-form .captcha-row').addClass('invisible');
							if(asproRecaptcha.params.recaptchaLogoShow === 'n'){
								$('#bx-soa-order-form .captcha-row').addClass('logo_captcha_n');
							}
						}
					}

					if($('#bx-soa-order-form .captcha-row.invisible').length){
						if(typeof (BX.Sale.OrderAjaxComponent.oldSendRequest) === "undefined" &amp;&amp; typeof (BX.Sale.OrderAjaxComponent.sendRequest) !== 'undefined'){
							var tmpAction, tmpActionData;
							BX.Sale.OrderAjaxComponent.oldSendRequest = BX.Sale.OrderAjaxComponent.sendRequest;
							BX.Sale.OrderAjaxComponent.sendRequest = function(action, actionData){
								var bSend = true;

								if($('#bx-soa-order-form .captcha-row.invisible').length){
									if(window.renderRecaptchaById &amp;&amp; window.asproRecaptcha &amp;&amp; window.asproRecaptcha.key){
										if(window.asproRecaptcha.params.recaptchaSize == 'invisible'){
											var form = BX('bx-soa-order-form');
											if($(form).find('.g-recaptcha').length){
												if($(form).find('.g-recaptcha-response').val()){
													bSend = true;
												}
												else{
													if(typeof grecaptcha != 'undefined'){
														grecaptcha.execute($(form).find('.g-recaptcha').data('widgetid'));
														bSend = false;
													}
													else{
														bSend = false;
													}
												}
											}
										}
									}
								}

								if(bSend){
									BX.Sale.OrderAjaxComponent.oldSendRequest(action, actionData);
								}
								else{
									tmpAction = action;
									tmpActionData = actionData;
								}
							}

							$(document).on('submit', '#bx-soa-order-form', function(e){
								e.preventDefault();

								if(typeof tmpAction !== 'undefined' || typeof tmpActionData !== 'undefined'){
									BX.Sale.OrderAjaxComponent.sendRequest(tmpAction, tmpActionData);
									tmpAction = undefined;
									tmpActionData = undefined;
								}
							});
						}
					}
				}

				$('.bx-ui-sls-quick-locations.quick-locations').on('click', function(){
					$(this).siblings().removeClass('active');
					$(this).addClass('active');
				})
			}
		}
	}
}

if(!funcDefined('basketActions')){
	basketActions = function(){
		if(arAsproOptions["PAGES"]["BASKET_PAGE"]){
			checkMinPrice();

			//remove4Cart
			if(typeof(BX.Sale) !== 'undefined' &amp;&amp; typeof(BX.Sale) === 'object')
			{
				if(typeof(BX.Sale.BasketComponent) !== 'undefined' &amp;&amp; typeof(BX.Sale.BasketComponent) === 'object')
				{
					$(document).on('click', '.basket-item-actions-remove', function(){
						var basketID = $(this).closest('.basket-items-list-item-container').data('id');
						delFromBasketCounter(BX.Sale.BasketComponent.items[basketID].PRODUCT_ID);
					})
				}
			}

			if(location.hash)
			{
				var hash = location.hash.substring(1);
				if($('#basket_toolbar_button_'+hash).length)
					$('#basket_toolbar_button_'+hash).trigger('click');

				if($('.basket-items-list-header-filter a[data-filter="'+hash+'"]').length)
					$('.basket-items-list-header-filter a[data-filter="'+hash+'"]')[0].click();
			}
			var svg_cross = '&lt;svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8"&gt;&lt;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)"/&gt;&lt;/svg&gt;';

			$('.bx_sort_container').append('&lt;div class="top_control basket_action"&gt;&lt;span style="opacity:0;" class="delete_all colored_theme_hover_text remove_all_basket"&gt;'+svg_cross+BX.message("BASKET_CLEAR_ALL_BUTTON")+'&lt;/span&gt;&lt;/div&gt;');
			if($('.basket-items-list-header-filter').length)
			{
				$('.basket-items-list-header-filter').append('&lt;div class="top_control basket_action"&gt;&lt;span style="opacity:1;" class="delete_all colored_theme_hover_text remove_all_basket"&gt;'+svg_cross+BX.message("BASKET_CLEAR_ALL_BUTTON")+'&lt;/span&gt;&lt;/div&gt;');

				var cur_index = $('.basket-items-list-header-filter &gt; a.active').index();
				//fix delayed
				if(cur_index == 3)
					cur_index = 2;

				if($('.basket-items-list-header-filter &gt; a.active').data('filter') == 'all')
					cur_index = 'all';

				$('.basket-items-list-header-filter .top_control .delete_all').data("type",cur_index);

				$('.basket-items-list-header-filter &gt; a').on('click', function() {
					var index = $(this).index();

					//fix delayed
					if(index == 3)
						index = 2;

					if($(this).data('filter') == 'all')
						index = 'all';

					$('.basket-items-list-header-filter .top_control .delete_all').data("type", index);
				});
			}
			else
			{
				var cur_index = $('.bx_sort_container a.current').index();
				$('.bx_sort_container .top_control .delete_all').data("type",cur_index);
				if($('.bx_ordercart &gt; div:eq('+cur_index+') table tbody tr td.item').length)
					$('.bx_sort_container .top_control .delete_all').css('opacity',1);

				$('.bx_ordercart .bx_ordercart_coupon #coupon').wrap('&lt;div class="input"&gt;&lt;/div&gt;');

				$('.bx_sort_container &gt; a').on('click', function() {
					var index = $(this).index();
					$('.bx_sort_container .top_control .delete_all').data("type", index);

					if($('.bx_ordercart &gt; div:eq('+index+') table tbody tr td.item').length)
						$('.bx_sort_container .top_control .delete_all').css('opacity',1);
					else
						$('.bx_sort_container .top_control .delete_all').css('opacity',0);
				});
			}


			$('.basket_print').on('click', function() {
				 // window.open(location.pathname+"?print=Y",'_blank');
				 window.print();
			});

			$('.delete_all').on('click', function() {
				if(arAsproOptions['COUNTERS']['USE_BASKET_GOALS'] !== 'N'){
					var eventdata = {goal: 'goal_basket_clear', params: {type: $(this).data('type')}};
					BX.onCustomEvent('onCounterGoals', [eventdata]);
				}
				$.post( arAsproOptions['SITE_DIR']+"ajax/action_basket.php", "TYPE="+$(this).data('type')+"&amp;CLEAR_ALL=Y", $.proxy(function( data ) {
					location.reload();
				}));
			});

			$('.bx_item_list_section .bx_catalog_item').sliceHeight({row:'.bx_item_list_slide', item:'.bx_catalog_item'});

			BX.addCustomEvent('onAjaxSuccess', function(e) {
				checkMinPrice();

				var errorText = $.trim($('#warning_message').text());
				$('#basket_items_list .error_text').detach();
				if (errorText != '') {
					$('#warning_message').hide().text('');
					$('#basket_items_list').prepend('&lt;div class="error_text"&gt;' +errorText+ '&lt;/div&gt;');
				}

				if (typeof e === 'object' &amp;&amp; 'BASKET_DATA' in e) {
					if ($("#ajax_basket").length) {
						reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
					}
					if ($("#basket_line .basket_fly").length) {
						basketFly('open', 'N');
					}
				}
			});
			$(document).on('click', '.bx_ordercart_order_pay_center .checkout, .basket-checkout-section-inner .basket-btn-checkout', function(){
				if(checkCounters('google')){
					checkoutCounter(1, 'start order');
				}
			})
		}
	}
}

if(!funcDefined('checkMinPrice')){
	checkMinPrice = function(){
		if(arAsproOptions["PAGES"]["BASKET_PAGE"]){
			var summ_raw=0,
				summ=0;
			if($('#allSum_FORMATED').length)
			{
				summ_raw=$('#allSum_FORMATED').text().replace(/[^0-9\.,]/g,'');
				summ=parseFloat(summ_raw);
				if($('#basket_items').length)
				{
					var summ = 0;
					$('#basket_items tr').each(function(){
						if(typeof ($(this).data('item-price')) !== 'undefined' &amp;&amp; $(this).data('item-price'))
							summ += $(this).data('item-price')*$(this).find('#QUANTITY_INPUT_'+$(this).attr('id')).val();
					})
				}
				if(!$('.catalog_back').length)
					$('.bx_ordercart_order_pay_center').prepend('&lt;a href="'+arAsproOptions["PAGES"]["CATALOG_PAGE_URL"]+'" class="catalog_back btn btn-default btn-lg white grey"&gt;'+BX.message("BASKET_CONTINUE_BUTTON")+'&lt;/a&gt;');
			}

			if(arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
				$('.basket-coupon-section').addClass('smallest');

			if(typeof BX.Sale !== "undefined")
			{
				if(typeof BX.Sale.BasketComponent !== "undefined" &amp;&amp; typeof BX.Sale.BasketComponent.result !== "undefined")
					summ = BX.Sale.BasketComponent.result.allSum;
			}

			if(arAsproOptions["PRICES"]["MIN_PRICE"]){
				if(arAsproOptions["PRICES"]["MIN_PRICE"]&gt;summ){
					var svgMinPrice = '&lt;i class="svg  svg-inline-price colored_theme_svg" aria-hidden="true"&gt;&lt;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"&gt;&lt;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-.125-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)"&gt;&lt;/path&gt;  &lt;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)"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/i&gt;';
					if($('.oneclickbuy.fast_order').length)
						$('.oneclickbuy.fast_order').remove();

					if($('.basket-checkout-container').length)
					{
						if(!$('.icon_error_wrapper').length){
							$('.basket-checkout-block.basket-checkout-block-btn').html('&lt;div class="icon_error_wrapper"&gt;&lt;div class="icon_error_block"&gt;'+svgMinPrice+BX.message("MIN_ORDER_PRICE_TEXT").replace("#PRICE#", jsPriceFormat(arAsproOptions["PRICES"]["MIN_PRICE"]))+'&lt;/div&gt;&lt;/div&gt;');
						}
					}
					else
					{
						if(!$('.icon_error_wrapper').length  &amp;&amp; typeof jsPriceFormat !== 'undefined'){
							$('.bx_ordercart_order_pay_center').prepend('&lt;div class="icon_error_wrapper"&gt;&lt;div class="icon_error_block"&gt;'+svgMinPrice+BX.message("MIN_ORDER_PRICE_TEXT").replace("#PRICE#", jsPriceFormat(arAsproOptions["PRICES"]["MIN_PRICE"]))+'&lt;/div&gt;&lt;/div&gt;');
						}
						if($('.bx_ordercart_order_pay .checkout').length)
							$('.bx_ordercart_order_pay .checkout').remove();
					}
				}else{
					if($('.icon_error_wrapper').length)
						$('.icon_error_wrapper').remove();

					if($('.basket-checkout-container').length)
					{
						if(!$('.oneclickbuy.fast_order').length &amp;&amp; arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" &amp;&amp; !$('.basket-btn-checkout.disabled').length)
							$('.basket-checkout-section-inner').append('&lt;div class="fastorder"&gt;&lt;span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()"&gt;'+BX.message("BASKET_QUICK_ORDER_BUTTON")+'&lt;/span&gt;&lt;/div&gt;');
					}
					else
					{
						if($('.bx_ordercart_order_pay .checkout').length)
							$('.bx_ordercart .bx_ordercart_order_pay .checkout').css('opacity','1');
						else
							$('.bx_ordercart_order_pay_center').append('&lt;a href="javascript:void(0)" onclick="checkOut();" class="checkout" style="opacity: 1;"&gt;'+BX.message("BASKET_ORDER_BUTTON")+'&lt;/a&gt;');
						if(!$('.oneclickbuy.fast_order').length &amp;&amp; arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
							$('.bx_ordercart_order_pay_center').append('&lt;span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()"&gt;'+BX.message("BASKET_QUICK_ORDER_BUTTON")+'&lt;/span&gt;');
					}
				}
			}else{
				if($('.basket-checkout-container').length)
				{
					if(!$('.oneclickbuy.fast_order').length &amp;&amp; arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y" &amp;&amp; !$('.basket-btn-checkout.disabled').length)
						$('.basket-checkout-section-inner').append('&lt;div class="fastorder"&gt;&lt;span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()"&gt;'+BX.message("BASKET_QUICK_ORDER_BUTTON")+'&lt;/span&gt;&lt;/div&gt;');
				}
				else
				{
					$('.bx_ordercart .bx_ordercart_order_pay .checkout').css('opacity','1');
					if(!$('.oneclickbuy.fast_order').length &amp;&amp; arAsproOptions["THEME"]["SHOW_ONECLICKBUY_ON_BASKET_PAGE"] == "Y")
						$('.bx_ordercart_order_pay_center').append('&lt;span class="oneclickbuy btn btn-lg fast_order btn-transparent-border-color" onclick="oneClickBuyBasket()"&gt;'+BX.message("BASKET_QUICK_ORDER_BUTTON")+'&lt;/span&gt;');
				}
			}

			$('#basket-root .basket-checkout-container .basket-checkout-section .basket-checkout-block .basket-btn-checkout');
			$('#basket-root .basket-checkout-container').addClass('visible');
		}
	}
}

var isFrameDataReceived = false;
if (typeof window.frameCacheVars !== "undefined"){
	BX.addCustomEvent(window, "onFrameDataRequestFail", function(response){
		console.log(response);
	});

	BX.addCustomEvent("onFrameDataReceivedBefore", function (){
		// stop ya metrika webvisor DOM indexer
		pauseYmObserver();
	});

	BX.addCustomEvent("onFrameDataReceived", function (json){
		initFull();

		CheckTopMenuPadding();
		CheckTopMenuOncePadding();
		CheckTopMenuDotted();

		CheckSearchWidth();

		checkLinkedArticles();

		if($('.logo-row.v2').length)
		{
			$(window).resize(); // need to check resize flexslider &amp; menu
			setTimeout(function(){
				CheckTopMenuDotted();
			}, 100);
		}

		if(funcDefined('setNewHeader')) {
			if(typeof BX === 'object' &amp;&amp; (BX.message('TYPE_SKU') != 'TYPE_1' || BX.message('HAS_SKU_PROPS') != 'Y')) {
					setNewHeader();
			} else {
				var objNameWrapper = $('.bx_catalog_item_scu[id]');
				if(objNameWrapper.length) {
					var id = 'ob'+objNameWrapper.attr('id').replace('_skudiv', '');
					if(id &amp;&amp; window[id] !== undefined) {
						var obj = window[id].offers[window[id].offerNum];
						if(obj !== undefined) {
							setNewHeader(obj);
						}
					}
				}
			}
		}

		// resume ya metrika webvisor
		// (100ms sliceHeight) + (200ms mCustomScroll) + (100ms lazyload)
		setTimeout(resumeYmObserver, 400);

		isFrameDataReceived = true;
	});
}else{
	$( document ).ready(initFull);
}

if(!funcDefined('setHeightBlockSlider')){
	setHeightBlockSlider = function(){
		$(document).find('.specials.tab_slider_wrapp .tabs_content &gt; li.cur').equalize({children: '.item-title'});
		$(document).find('.specials.tab_slider_wrapp .tabs_content &gt; li.cur').equalize({children: '.item_info'});
		$(document).find('.specials.tab_slider_wrapp .tabs_content &gt; li.cur').equalize({children: '.catalog_item'});

		var sliderWidth = $(document).find('.specials.tab_slider_wrapp').outerWidth();

		var iCountTabs = $(document).find('.specials.tab_slider_wrapp .tabs_content &gt; li.cur').length;

		if(iCountTabs &lt;= 1)
		{
			$(document).find('.specials.tab_slider_wrapp .tabs_content &gt; li.cur').css('height', '');

			var itemsButtonsHeight = 0;
			if($(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').length)
			{
				$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').css('height', 'auto');
				itemsButtonsHeight = $(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').height();
				$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .tabs_slider li .footer_button').css('height', '');
			}
			var tabsContentUnhover = $(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').height() * 1;
			var tabsContentHover = tabsContentUnhover + itemsButtonsHeight+50;
			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').attr('data-unhover', tabsContentUnhover);
			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur').attr('data-hover', tabsContentHover);
			$(document).find('.specials.tab_slider_wrapp .tabs_content').height(tabsContentUnhover);
			$(document).find('.specials.tab_slider_wrapp .tabs_content .tab.cur .flex-viewport').height(tabsContentUnhover);
		}
		else
		{
			$(document).find('.specials.tab_slider_wrapp .tabs_content &gt; li.cur').each(function(){
				var _th = $(this);
				_th.css('height', '');

				var itemsButtonsHeight = 0;
				if(_th.find('.tabs_slider li .footer_button').length)
				{
					_th.find('.tabs_slider li .footer_button').css('height', 'auto');
					itemsButtonsHeight = _th.find('.tabs_slider li .footer_button').height();
					_th.find('.tabs_slider li .footer_button').css('height', '');
				}

				var tabsContentUnhover = _th.height() * 1;
				var tabsContentHover = tabsContentUnhover + itemsButtonsHeight+50;
				_th.attr('data-unhover', tabsContentUnhover);
				_th.attr('data-hover', tabsContentHover);
				_th.parent().height(tabsContentUnhover);
				_th.find('.flex-viewport').height(tabsContentUnhover);

			})
		}
	}
}

if(!funcDefined('checkTopFilter')){
	checkTopFilter = function() {
		/*if(window.matchMedia('(max-width: 991px)').matches){
			//if($('.group_description_block.top').length){
				var top_pos=$('.adaptive_filter').position().top;
				$('.bx_filter.bx_filter_vertical').css({'top':top_pos+43});
			//}
		}*/
	}
}

if(!funcDefined('checkStickyFooter')){
	checkStickyFooter = function() {
		try{
			ignoreResize.push(true);
			$('#content').css('min-height', '');
			var contentTop = $('#content').offset().top;
			var contentBottom = contentTop + $('#content').outerHeight();
			var footerTop = 0;
			if($('footer').length)
				footerOffset = $('footer').offset().top;

			$('#content').css('min-height', $(window).height() - contentTop - (footerTop - contentBottom) - $('footer').outerHeight() + 'px');
			ignoreResize.pop();
		}
		catch(e){console.error(e);}
	}
}

if(!funcDefined('checkLinkedArticles')){
	checkLinkedArticles = function() {
		try{
			if ($('.linked-blog-list.content .item-views').length) {
				var mobileRow = $('.linked-blog-list').data('mobile_row'),
					desktopRow = $('.linked-blog-list').data('desktop_row'),
					parentBlock = $('.ajax_load .js_append'),
					widthRow = parentBlock.getFloatWidth(),
					elementWidthRow = parentBlock.find('&gt; .item:eq(0)').getFloatWidth(),
					elementsCount = parentBlock.find('&gt; .item').length,
					slice = Math.floor(widthRow / elementWidthRow),
					rowInsertCount = Math.floor(elementsCount/slice),
					bCalculateRows = false;
				if (window.matchMedia('(max-width: 767px)').matches) {
					if (!mobileRow &amp;&amp; desktopRow) {
						mobileRow = desktopRow;
					}
					if (mobileRow &amp;&amp; mobileRow &lt;= rowInsertCount) {
						rowInsertCount = slice*mobileRow;
						bCalculateRows = true;
					}
				} else {
					if (desktopRow &amp;&amp; desktopRow &lt;= rowInsertCount) {
						rowInsertCount = slice*desktopRow;
						bCalculateRows = true;
					}
				}
				if (!bCalculateRows) {
					rowInsertCount = elementsCount;
				}

				$('.linked-blog-list').insertAfter(parentBlock.find('&gt; .item:eq('+(rowInsertCount-1)+')'));
				setTimeout(function(){
					$('.linked-blog-list').addClass('visible');
				}, 0);
			}
		}
		catch(e){console.error(e);}
	}
}

/* EVENTS */
var timerResize = false, ignoreResize = [];
$(window).resize(function(){
	CheckPopupTop();
	checkLinkedArticles();

	// here immediate functions
	if(!ignoreResize.length){

		if(timerResize){
			clearTimeout(timerResize);
			timerResize = false;
		}
		timerResize = setTimeout(function(){
			// here delayed functions in event
			BX.onCustomEvent('onWindowResize', false);
		}, 50);
	}
});

var timerScroll = false, ignoreScroll = [], documentScrollTopLast = $(document).scrollTop(), startScroll = 0;
$(window).scroll(function(){
	CheckPopupTop();
	// here immediate functions
	documentScrollTopLast = $(document).scrollTop();
	SetFixedAskBlock();

	if(!ignoreScroll.length){
		if(timerScroll){
			clearTimeout(timerScroll);
			timerScroll = false;
		}
		timerScroll = setTimeout(function(){
			// here delayed functions in event
			BX.onCustomEvent('onWindowScroll', false);
		}, 50);
	}
});

BX.addCustomEvent('onWindowResize', function(eventdata){
	try{
		ignoreResize.push(true);

		CheckTopMenuPadding();
		CheckTopMenuOncePadding();
		CheckSearchWidth();

		CheckTabActive();
		CheckTopMenuFullCatalogSubmenu();
		CheckHeaderFixedMenu();

		if(window.matchMedia('(min-width:768px)').matches) {
			closeYandexMap();
		}

		CheckTopMenuDotted();
		if($('nav.mega-menu.sliced').length)
			$('nav.mega-menu.sliced').removeClass('initied');


		CheckTopVisibleMenu();

		checkScrollToTop();
		CheckObjectsSizes();

		CheckFlexSlider();
		initSly();

		// checkVerticalMobileFilter();
		if (typeof checkMobilePhone === 'function') {
			checkMobilePhone();
		}
		checkTopFilter();
		if (typeof checkMobileFilter === 'function') {
			checkMobileFilter();
		}

		if(arAsproOptions['THEME'] &amp;&amp; arAsproOptions['THEME']['COMPACT_FOOTER_MOBILE'] == 'Y') {
		    if (window.matchMedia('(max-width:767px)').matches) {
				$('footer').addClass('mobile');
				$('.bottom-menu .items&gt;.wrap_compact_mobile').addClass('accordion-body collapse');
				$('.bottom-menu .items&gt;.item.childs').attr('data-toggle','collapse');
		    } else {
		    	$('footer').removeClass('mobile');
		    	$('.bottom-menu .items&gt;.wrap_compact_mobile').removeClass('accordion-body collapse');
		    	$('.bottom-menu .items&gt;.item.childs').removeAttr('data-toggle');
		    }
		}

		if(typeof window['stickySidebar'] !== 'undefined')
		{
			if(window.matchMedia('(max-width: 991px)').matches)
			{
				window['stickySidebar'].destroy();
			}
			else
			{
				window['stickySidebar'].bindEvents();
			}
		}

		if($('.flexslider.wsmooth').length){
			$('.flexslider.wsmooth').each(function(){
				$(this).data('flexslider').smoothHeight();
			});
		}

		if(window.matchMedia('(min-width: 767px)').matches)
			$('.wrapper_middle_menu.wrap_menu').removeClass('mobile');

		if(window.matchMedia('(max-width: 767px)').matches)
			$('.wrapper_middle_menu.wrap_menu').addClass('mobile');


		if($("#basket_form").length &amp;&amp; $(window).outerWidth()&lt;=600){
			$("#basket_form .tabs_content.basket &gt; li.cur td").each(function() { $(this).css("width","");});
		}

		$(".bx_filter_section .bx_filter_select_container").each(function(){
			var prop_id=$(this).closest('.bx_filter_parameters_box').attr('property_id');
			if($('#smartFilterDropDown'+prop_id).length){
				$('#smartFilterDropDown'+prop_id).css("max-width", $(this).width());
			}
		})

		if(window.matchMedia('(min-width: 768px)').matches){
			// min-width: 768px
			$('.bx_filter .scrollbar').removeClass('mobile-scroll');
			$('.bx_filter .srollbar-custom').removeClass('mobile-scroll');
			$('.bx_filter .bx_filter_section form .bx_filter_parameters').removeClass('mobile-scroll');
			InitScrollBar();
			InitCustomScrollBar();
		}
		else{
			// max-width: 767px
			$('.bx_filter .scrollbar').addClass('mobile-scroll').removeClass('scroll-init');
			$('.bx_filter .srollbar-custom').addClass('mobile-scroll').removeClass('scroll-init');
			$('.bx_filter .bx_filter_section form .bx_filter_parameters').addClass('mobile-scroll').removeClass('scroll-init');
			if($('.bx_filter .mobile-scroll.scrollbar').length)
				$('.bx_filter .mobile-scroll.scrollbar').mCustomScrollbar("destroy");
			if($('.bx_filter .mobile-scroll.srollbar-custom').length)
				$('.bx_filter .mobile-scroll.srollbar-custom').mCustomScrollbar("destroy");
		}

	}
	catch(e){
		console.log(e);
	}
	finally{
		ignoreResize.pop();
	}
});

BX.addCustomEvent('onWindowScroll', function(eventdata){
	try{
		ignoreScroll.push(true);
	}
	catch(e){}
	finally{
		ignoreScroll.pop();
	}
});

BX.addCustomEvent('onSlideInit', function(eventdata) {
	try{
		ignoreResize.push(true);
		if(eventdata){
			var slider = eventdata.slider;
			if(slider){
				if(slider.hasClass('small-gallery'))
					$(window).resize();
				// add classes .curent &amp; .shown to slide
				slider.find('.item').removeClass('current');
				var curSlide = slider.find('.item.flex-active-slide'),
					curSlideId = curSlide.attr('id'),
					nav = slider.find('.flex-direction-nav');

				curSlide.addClass('current');

				slider.find('.visible').css('opacity', '1');
				slider.find('.height0').css('height', 'auto');

				if(curSlide.hasClass('shown')){
					slider.find('.item.clone[id=' + curSlideId + '_clone]').addClass('shown');
				}

				curSlide.addClass('shown');

			}
		}
	}
	catch(e){}
	finally{
		ignoreResize.pop();
	}
});

BX.addCustomEvent('onCounterGoals', function(eventdata){
	if(arAsproOptions['THEME']['YA_GOALS'] == 'Y' &amp;&amp; arAsproOptions['THEME']['YA_COUNTER_ID'])
	{
		var idCounter = arAsproOptions['THEME']['YA_COUNTER_ID'];
		idCounter = parseInt(idCounter);

		if(typeof eventdata != 'object')
			eventdata = {goal: 'undefined'};

		if(typeof eventdata.goal != 'string')
			eventdata.goal = 'undefined';

		if(idCounter)
		{
			try
			{
				waitCounter(idCounter, 50, function(){
					var obCounter = window['yaCounter' + idCounter];
					if(typeof obCounter == 'object'){
						obCounter.reachGoal(eventdata.goal);
					}
				});
			}
			catch(e)
			{
				console.error(e)
			}
		}
		else
		{
			console.info('Bad counter id!', idCounter);
		}
	}
})

var onCaptchaVerifyinvisible = function(response){
	$('.g-recaptcha:last').each(function(){
		var id = $(this).attr('data-widgetid');
		if(typeof(id) !== 'undefined' &amp;&amp; response){
			if(!$(this).closest('form').find('.g-recaptcha-response').val())
				$(this).closest('form').find('.g-recaptcha-response').val(response)
			if($('iframe[src*=recaptcha]').length)
			{
				$('iframe[src*=recaptcha]').each(function(){
					var block = $(this).parent().parent();
					if(!block.hasClass('grecaptcha-badge'))
						block.css('width', '100%');
				})
			}
			$(this).closest('form').submit();
		}
	})
}

var onCaptchaVerifynormal = function(response){
	$('.g-recaptcha').each(function(){
		var id = $(this).attr('data-widgetid');
		if(typeof(id) !== 'undefined'){
			if(grecaptcha.getResponse(id) != ''){
				$(this).closest('form').find('.recaptcha').valid();
			}
		}
	});
}

BX.addCustomEvent('onSubmitForm', function(eventdata){
	try{
		if(!window.renderRecaptchaById || !window.asproRecaptcha || !window.asproRecaptcha.key)
		{
			eventdata.form.submit();
			$(eventdata.form).closest('.form').addClass('sending');
			return true;
		}

		if(window.asproRecaptcha.params.recaptchaSize == 'invisible' &amp;&amp; $(eventdata.form).find('.g-recaptcha').length)
		{
			if($(eventdata.form).find('.g-recaptcha-response').val())
			{
				eventdata.form.submit();
				$(eventdata.form).closest('.form').addClass('sending');
				return true;
			}
			else
			{
				if(typeof grecaptcha != 'undefined'){
					grecaptcha.execute($(eventdata.form).find('.g-recaptcha').data('widgetid'));
				}
				else{
					return false;
				}
			}
		}
		else
		{
			eventdata.form.submit();
			$(eventdata.form).closest('.form').addClass('sending');
			return true;
		}
	}
	catch (e){
		console.error(e);
		return true;
	}
})

$(document).on('click', '.catalog_reviews_extended span.dropdown-select__list-link', function(){
	var _this = $(this);
	var ajaxData = _this.data('review_sort_ajax');
	var container = _this.closest('[id^=comp_]');
	containerId = container.attr('id');
	if(containerId !== undefined &amp;&amp; containerId) {
		ajaxData.containerId = containerId;
	}
	if(ajaxData !== undefined) {
		container.addClass('blur')
		$.ajax({
			type: 'post',
			data: ajaxData,
			success: function(html){
				$('#reviews_sort_continer').html(html);
			}
		});
	}
});

$(document).on('click', '.rating_vote:not(.disable)', function(){

	var _this = $(this);
	var action = _this.data('action');
	var parent = _this.closest('.rating-vote');
	var commentId = parent.data('comment_id');
	var userId = parent.data('user_id');
	var ajaxUrl = parent.data('ajax_url');
	$.ajax({
		url: ajaxUrl,
		dataType: 'json',
		data: {'commentId': commentId, 'action': action, 'userId': userId},
		success: function(data){
			if(data.LIKE !== undefined) {
				_this.siblings('.rating-vote-result.like').text(data.LIKE);
			}
			if(data.DISLIKE !== undefined) {
				_this.siblings('.rating-vote-result.dislike').text(data.DISLIKE);
			}
			if(data.SET_ACTIVE_LIKE !== undefined) {
				parent.find('.rating_vote.plus').toggleClass('active');
			}
			if(data.SET_ACTIVE_DISLIKE !== undefined) {
				parent.find('.rating_vote.minus').toggleClass('active');
			}
		}
	});

});

function fileInputInit(message){
    $('input[type=file]').uniform({fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message});
    $(document).on('change', 'input[type=file]', function(){
        if($(this).val())
        {
            $(this).closest('.uploader').addClass('files_add');
        }
        else
        {
            $(this).closest('.uploader').removeClass('files_add');
        }
    })
    $('.form .add_file').on('click', function(){
        var index = $(this).closest('.input').find('input[type=file]').length+1;

        $(this).closest('.form-group').find('.input').append('&lt;input type="file" id="POPUP_FILE" name="FILE_n'+index+'"   class="inputfile" value="" /&gt;');
        $('input[type=file]').uniform({fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message});
    });

    $('.form .add_file').on('click', function(){
        var index = $(this).closest('.input').find('input[type=file]').length+1;

        $(this).closest('.form-group').find('.input').append('&lt;input type="file" id="POPUP_FILE" name="FILE_n'+index+'"   class="inputfile" value="" /&gt;');
        $('input[type=file]').uniform({fileButtonHtml: BX.message('JS_FILE_BUTTON_NAME'), fileDefaultHtml: message});
    });
}

function declOfNum(number, titles)
{
	var cases = [2, 0, 1, 1, 1, 2];
	return number + " " + titles[ (number%100&gt;4 &amp;&amp; number%100&lt;20)? 2 : cases[Math.min(number%10, 5)] ];
}
/* End */
;
; /* Start:"a:4:{s:4:"full";s:61:"/local/templates/aspro_max/js/blocks/blocks.js?17119485507806";s:6:"source";s:46:"/local/templates/aspro_max/js/blocks/blocks.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
InitMenuNavigationAim = function(){
	var $block = $('.menu-navigation__sections-wrapper .menu-navigation__sections:not(.aim-init)');
	if($block.length){
		$block.addClass('aim-init');
		$block.menuAim({
	        firstActiveRow: true,
	        rowSelector: "&gt; .menu-navigation__sections-item",
	        activate: function activate(a) {
	            var _this = $(a),
	                index = _this.index(),
	                items = _this.closest('.menu-navigation__sections-wrapper').next(),
	                link = _this.find('&gt; a');

	            _this.siblings().find('&gt; a').addClass('dark_link')
	            link.addClass('colored_theme_text').removeClass('dark_link');
	            items.find('.parent-items').siblings().hide();
	            items.find('.parent-items').eq(index).show();
	        },
	        deactivate: function deactivate(a) {
	            var _this = $(a),
	                index = _this.index(),
	                items = _this.closest('.menu-navigation__sections-wrapper').next(),
	                link = _this.find('&gt; a');

	          link.removeClass('colored_theme_text').addClass('dark_link');
	          items.find('.parent-items').siblings().hide();
	        }
	    });
	}
}

$(document).ready(function(){
	//dropdown-select
		$(document).on('click', '.dropdown-select .dropdown-select__title', function(){
			var _this = $(this),
				menu = _this.parent().find('&gt; .dropdown-select__list'),
				bVisibleMeu = (menu.is(':visible')),
				animate = (!bVisibleMeu ? 'transition.slideUpIn' : 'fadeOut');

			if(!_this.hasClass('clicked'))
			{
				_this.addClass('clicked');

				menu.velocity('stop').velocity(animate, {
					duration: 300,
					// delay: 250,
					begin: function(){
						_this.toggleClass('opened');
					},
					complete: function(){
						_this.removeClass('clicked');
					}
				});
			}
		})

		// close select
		$("html, body").on('mousedown', function(e){
			if(typeof e.target.className == 'string' &amp;&amp; e.target.className.indexOf('adm') &lt; 0)
			{
				e.stopPropagation();

				if(!$(e.target).closest('.dropdown-select').length)
				{
					$('.dropdown-select .dropdown-select__title.opened').click();
				}
			}
		})
	/**/


	/*side head block*/
	$(document).on('click', '.slide-block .slide-block__head', function(e){
		var _this = $(this),
			menu = _this.siblings('.slide-block__body'),
			bVisibleMeu = (menu.is(':visible')),
			animate = (bVisibleMeu ? 'slideUp' : 'slideDown');

		if(!_this.hasClass('clicked') &amp;&amp; menu.length &amp;&amp; !_this.hasClass('ignore') &amp;&amp; !$(e.target).attr('href'))
		{
			var type = _this.data('id');
			_this.addClass('clicked');

			if(bVisibleMeu)
				$.cookie(type+'_CLOSED', 'Y');
			else
				$.removeCookie(type+'_CLOSED');

			menu.velocity('stop').velocity(animate, {
				duration: 150,
				// delay: 250,
				begin: function(){
					_this.toggleClass('closed');
				},
				complete: function(){
					_this.removeClass('clicked');

					if(typeof window['stickySidebar'] !== 'undefined')
						window['stickySidebar'].updateSticky();
				}
			});
		}
	})
	/**/

	/*sku change props*/
	if(!('SelectOfferProp' in window) &amp;&amp; typeof window.SelectOfferProp != 'function')
	{
		SelectOfferProp = function(){
			// return false;
			var _this = $(this),
				obParams = {},
				obSelect = {},
				objUrl = parseUrlQuery(),
				add_url = '',
				selectMode = (_this.hasClass('list_values_wrapper') ? true : false),
				container = _this.closest('.bx_catalog_item_scu'),
				img = _this.closest('.item-parent').find('.thumb img');

			/* request params */
			obParams = {
				'PARAMS': _this.closest('.js_wrapper_items').data('params'),
				'ID': container.data('offer_id'),
				'SITE_ID': container.data('site_id'),
				'LINK_ID': container.data('id')+'_'+_this.closest('.cur').data('code'),
				'IBLOCK_ID': container.data('offer_iblockid'),
				'PROPERTY_ID': container.data('propertyid'),
				'DEPTH': _this.closest('.item_wrapper').index(),
				'VALUE': (selectMode ? _this.find('option:selected').data('onevalue') : _this.data('onevalue')),
				'CLASS': 'inner_content',
				'PICTURE': (img.data('src') ? img.data('src') : img.attr('src')),
				'ARTICLE_NAME': _this.closest('.item-parent').find('.article_block').data('name'),
				'ARTICLE_VALUE': _this.closest('.item-parent').find('.article_block').data('value'),
			}
			/**/

			if("clear_cache" in objUrl)
			{
				if(objUrl.clear_cache == "Y")
					add_url += "?clear_cache=Y";
			}

			/* save selected values */
			for (i = 0; i &lt; obParams.DEPTH+1; i++)
			{
				strName = 'PROP_'+container.find('.item_wrapper:eq('+i+') &gt; div').data('id');
				if(container.find('.item_wrapper:eq('+i+') select').length)
				{
					obSelect[strName] = container.find('.item_wrapper:eq('+i+') select option:selected').data('onevalue');
					obParams[strName] = container.find('.item_wrapper:eq('+i+') select option:selected').data('onevalue');
				}
				else
				{
					obSelect[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
					obParams[strName] = container.find('.item_wrapper:eq('+i+') li.item.active').data('onevalue');
				}
			}

			// obParams.SELECTED = JSON.stringify(obSelect);
			/**/

			if(!selectMode)
			{
				_this.siblings().removeClass('active');
				_this.addClass('active');
			}

			if(_this.attr('title'))
			{
				var skuVal = _this.attr('title').split(':')[1];
				_this.closest('.item_wrapper').find('.show_class .val').text(skuVal);
			}
			else
			{
				var img_row = _this.find(' &gt; i');
				if(img_row.length &amp;&amp; img_row.attr('title')) {
					var skuVal = img_row.attr('title').split(':')[1];
					_this.closest('.item_wrapper').find('.show_class .val').text(skuVal);
				}
			}

			/* get sku */
			$.ajax({
				url: arMaxOptions['SITE_DIR']+'ajax/js_item_detail.php'+add_url,
				type: 'POST',
				data: obParams,
			}).success(function(html){
				var ob = BX.processHTML(html);BX.ajax.processScripts(ob.SCRIPT);
				console.log(ob.SCRIPT)
				if($('.counter_wrapp.list'))
				{
					$('.counter_wrapp.list .counter_block.big').removeClass('big');
				}
			})
		}
		$(document).on('click', '.ajax_load .bx_catalog_item_scu li.item', SelectOfferProp)
		$(document).on('change', '.ajax_load .bx_catalog_item_scu select.list_values_wrapper', SelectOfferProp)
	}

	/**/

	/**/
	$('.switch-item-block .switch-item-block__icons').on('click', function(){
		var $this = $(this),
			animationTime = 200;

		if($this.hasClass('switch-item-block__icons--small') &amp;&amp; !$this.hasClass('active')){
			$this.addClass('active');
			$this.siblings('.switch-item-block__icons--big').removeClass('active');
			$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--big').fadeOut(animationTime, function(){
				$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--small').fadeIn(animationTime);
			});

			$this.closest('.switch-item-block').siblings('.big-gallery-block').fadeOut(animationTime, function(){
				$this.closest('.switch-item-block').siblings('.small-gallery-block').fadeIn(animationTime);
			});
		}
		else if($this.hasClass('switch-item-block__icons--big') &amp;&amp; !$this.hasClass('active')){
			$this.addClass('active');
			$this.siblings('.switch-item-block__icons--small').removeClass('active');
			$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--small').fadeOut(animationTime, function(){
				$this.closest('.switch-item-block').find('.switch-item-block__count-wrapper--big').fadeIn(animationTime);
			});

			$this.closest('.switch-item-block').siblings('.small-gallery-block').fadeOut(animationTime, function(){
				$this.closest('.switch-item-block').siblings('.big-gallery-block').fadeIn(animationTime);
			});
		}
		setTimeout(function(){
			InitLazyLoad();
		}, 300);
	});
	/**/

	/*many items menu*/

	InitMenuNavigationAim();
	/**/
})
/* End */
;
; /* Start:"a:4:{s:4:"full";s:63:"/bitrix/components/bitrix/search.title/script.js?17113910979847";s:6:"source";s:48:"/bitrix/components/bitrix/search.title/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
function JCTitleSearch(arParams)
{
	var _this = this;

	this.arParams = {
		'AJAX_PAGE': arParams.AJAX_PAGE,
		'CONTAINER_ID': arParams.CONTAINER_ID,
		'INPUT_ID': arParams.INPUT_ID,
		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
	};
	if(arParams.WAIT_IMAGE)
		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
	if(arParams.MIN_QUERY_LEN &lt;= 0)
		arParams.MIN_QUERY_LEN = 1;

	this.cache = [];
	this.cache_key = null;

	this.startText = '';
	this.running = false;
	this.runningCall = false;
	this.currentRow = -1;
	this.RESULT = null;
	this.CONTAINER = null;
	this.INPUT = null;
	this.WAIT = null;

	this.ShowResult = function(result)
	{
		if(BX.type.isString(result))
		{
			_this.RESULT.innerHTML = result;
		}

		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
		var pos = _this.adjustResultNode();

		//adjust left column to be an outline
		var res_pos;
		var th;
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(tbl)
		{
			th = BX.findChild(tbl, {'tag':'th'}, true);
		}

		if(th)
		{
			var tbl_pos = BX.pos(tbl);
			tbl_pos.width = tbl_pos.right - tbl_pos.left;

			var th_pos = BX.pos(th);
			th_pos.width = th_pos.right - th_pos.left;
			th.style.width = th_pos.width + 'px';

			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';

			//Move table to left by width of the first column
			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';

			//Shrink table when it's too wide
			if((tbl_pos.width - th_pos.width) &gt; pos.width)
				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';

			//Check if table is too wide and shrink result div to it's width
			tbl_pos = BX.pos(tbl);
			res_pos = BX.pos(_this.RESULT);
			if(res_pos.right &gt; tbl_pos.right)
			{
				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
			}
		}

		var fade;
		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
		if(fade &amp;&amp; th)
		{
			res_pos = BX.pos(_this.RESULT);
			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
			fade.style.width = 18 + 'px';
			fade.style.top = 0 + 'px';
			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
			fade.style.display = 'block';
		}
	};

	this.onKeyPress = function(keyCode)
	{
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(!tbl)
			return false;

		var i;
		var cnt = tbl.rows.length;

		switch (keyCode)
		{
		case 27: // escape key - close search div
			_this.RESULT.style.display = 'none';
			_this.currentRow = -1;
			_this.UnSelectAll();
		return true;

		case 40: // down key - navigate down on search results
			if(_this.RESULT.style.display == 'none')
				_this.RESULT.style.display = 'block';

			var first = -1;
			for(i = 0; i &lt; cnt; i++)
			{
				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
				{
					if(first == -1)
						first = i;

					if(_this.currentRow &lt; i)
					{
						_this.currentRow = i;
						break;
					}
					else if(tbl.rows[i].className == 'title-search-selected')
					{
						tbl.rows[i].className = '';
					}
				}
			}

			if(i == cnt &amp;&amp; _this.currentRow != i)
				_this.currentRow = first;

			tbl.rows[_this.currentRow].className = 'title-search-selected';
		return true;

		case 38: // up key - navigate up on search results
			if(_this.RESULT.style.display == 'none')
				_this.RESULT.style.display = 'block';

			var last = -1;
			for(i = cnt-1; i &gt;= 0; i--)
			{
				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
				{
					if(last == -1)
						last = i;

					if(_this.currentRow &gt; i)
					{
						_this.currentRow = i;
						break;
					}
					else if(tbl.rows[i].className == 'title-search-selected')
					{
						tbl.rows[i].className = '';
					}
				}
			}

			if(i &lt; 0 &amp;&amp; _this.currentRow != i)
				_this.currentRow = last;

			tbl.rows[_this.currentRow].className = 'title-search-selected';
		return true;

		case 13: // enter key - choose current search result
			if(_this.RESULT.style.display == 'block')
			{
				for(i = 0; i &lt; cnt; i++)
				{
					if(_this.currentRow == i)
					{
						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
						{
							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
							if(a)
							{
								window.location = a.href;
								return true;
							}
						}
					}
				}
			}
		return false;
		}

		return false;
	};

	this.onTimeout = function()
	{
		_this.onChange(function(){
			setTimeout(_this.onTimeout, 500);
		});
	};

	this.onChange = function(callback)
	{
		if (_this.running)
		{
			_this.runningCall = true;
			return;
		}
		_this.running = true;

		if(_this.INPUT.value != _this.oldValue &amp;&amp; _this.INPUT.value != _this.startText)
		{
			_this.oldValue = _this.INPUT.value;
			if(_this.INPUT.value.length &gt;= _this.arParams.MIN_QUERY_LEN)
			{
				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
				if(_this.cache[_this.cache_key] == null)
				{
					if(_this.WAIT)
					{
						var pos = BX.pos(_this.INPUT);
						var height = (pos.bottom - pos.top)-2;
						_this.WAIT.style.top = (pos.top+1) + 'px';
						_this.WAIT.style.height = height + 'px';
						_this.WAIT.style.width = height + 'px';
						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
						_this.WAIT.style.display = 'block';
					}

					BX.ajax.post(
						_this.arParams.AJAX_PAGE,
						{
							'ajax_call':'y',
							'INPUT_ID':_this.arParams.INPUT_ID,
							'q':_this.INPUT.value,
							'l':_this.arParams.MIN_QUERY_LEN
						},
						function(result)
						{
							_this.cache[_this.cache_key] = result;
							_this.ShowResult(result);
							_this.currentRow = -1;
							_this.EnableMouseEvents();
							if(_this.WAIT)
								_this.WAIT.style.display = 'none';
							if (!!callback)
								callback();
							_this.running = false;
							if (_this.runningCall)
							{
								_this.runningCall = false;
								_this.onChange();
							}
						}
					);
					return;
				}
				else
				{
					_this.ShowResult(_this.cache[_this.cache_key]);
					_this.currentRow = -1;
					_this.EnableMouseEvents();
				}
			}
			else
			{
				_this.RESULT.style.display = 'none';
				_this.currentRow = -1;
				_this.UnSelectAll();
			}
		}
		if (!!callback)
			callback();
		_this.running = false;
	};

	this.onScroll = function ()
	{
		if(BX.type.isElementNode(_this.RESULT)
			&amp;&amp; _this.RESULT.style.display !== "none"
			&amp;&amp; _this.RESULT.innerHTML !== ''
		)
		{
			_this.adjustResultNode();
		}
	};

	this.UnSelectAll = function()
	{
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(tbl)
		{
			var cnt = tbl.rows.length;
			for(var i = 0; i &lt; cnt; i++)
				tbl.rows[i].className = '';
		}
	};

	this.EnableMouseEvents = function()
	{
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(tbl)
		{
			var cnt = tbl.rows.length;
			for(var i = 0; i &lt; cnt; i++)
				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
				{
					tbl.rows[i].id = 'row_' + i;
					tbl.rows[i].onmouseover = function (e) {
						if(_this.currentRow != this.id.substr(4))
						{
							_this.UnSelectAll();
							this.className = 'title-search-selected';
							_this.currentRow = this.id.substr(4);
						}
					};
					tbl.rows[i].onmouseout = function (e) {
						this.className = '';
						_this.currentRow = -1;
					};
				}
		}
	};

	this.onFocusLost = function(hide)
	{
		setTimeout(function(){_this.RESULT.style.display = 'none';}, 250);
	};

	this.onFocusGain = function()
	{
		if(_this.RESULT.innerHTML.length)
			_this.ShowResult();
	};

	this.onKeyDown = function(e)
	{
		if(!e)
			e = window.event;

		if (_this.RESULT.style.display == 'block')
		{
			if(_this.onKeyPress(e.keyCode))
				return BX.PreventDefault(e);
		}
	};

	this.adjustResultNode = function()
	{
		if(!(BX.type.isElementNode(_this.RESULT)
			&amp;&amp; BX.type.isElementNode(_this.CONTAINER))
		)
		{
			return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
		}

		var pos = BX.pos(_this.CONTAINER);

		_this.RESULT.style.position = 'absolute';
		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
		_this.RESULT.style.left = pos.left + 'px';
		_this.RESULT.style.width = pos.width + 'px';

		return pos;
	};

	this._onContainerLayoutChange = function()
	{
		if(BX.type.isElementNode(_this.RESULT)
			&amp;&amp; _this.RESULT.style.display !== "none"
			&amp;&amp; _this.RESULT.innerHTML !== ''
		)
		{
			_this.adjustResultNode();
		}
	};
	this.Init = function()
	{
		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);

		this.RESULT = document.body.appendChild(document.createElement("DIV"));
		this.RESULT.className = 'title-search-result';
		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
		this.startText = this.oldValue = this.INPUT.value;
		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
		this.INPUT.onkeydown = this.onKeyDown;

		if(this.arParams.WAIT_IMAGE)
		{
			this.WAIT = document.body.appendChild(document.createElement("DIV"));
			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
			if(!BX.browser.IsIE())
				this.WAIT.style.backgroundRepeat = 'none';
			this.WAIT.style.display = 'none';
			this.WAIT.style.position = 'absolute';
			this.WAIT.style.zIndex = '1100';
		}

		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});

		var fixedParent = BX.findParent(this.CONTAINER, BX.is_fixed);
		if(BX.type.isElementNode(fixedParent))
		{
			BX.bind(window, 'scroll', BX.throttle(this.onScroll, 100, this));
		}
	};
	BX.ready(function (){_this.Init(arParams)});
}

/* End */
;
; /* Start:"a:4:{s:4:"full";s:93:"/local/templates/aspro_max/components/bitrix/search.title/mega_menu/script.js?171141792410313";s:6:"source";s:77:"/local/templates/aspro_max/components/bitrix/search.title/mega_menu/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
$(document).ready(function(){
	var containerHTML = $('.title-search-input_mega_menu').detach();
	$('#title-search_mega_menu').append(containerHTML);
});

function JCTitleSearch3(arParams)
{
	var _this = this;

	this.arParams = {
		'AJAX_PAGE': arParams.AJAX_PAGE,
		'CONTAINER_ID': arParams.CONTAINER_ID,
		'INPUT_ID': arParams.INPUT_ID,
		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
	};
	if(arParams.WAIT_IMAGE)
		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
	if(arParams.MIN_QUERY_LEN &lt;= 0)
		arParams.MIN_QUERY_LEN = 1;

	this.cache = [];
	this.cache_key = null;

	this.startText = '';
	this.running = false;
	this.needRunAgain = false;
	this.currentRow = -1;
	this.RESULT = null;
	this.CONTAINER = null;
	this.INPUT = null;
	this.WAIT = null;

	this.ShowResult = function(result)
	{
		if(BX.type.isString(result))
		{
			_this.RESULT.innerHTML = result;
		}

		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
		var pos = _this.adjustResultNode();

		//adjust left column to be an outline
		var res_pos;
		var th;
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(tbl)
		{
			th = BX.findChild(tbl, {'tag':'th'}, true);
		}
		if(th)
		{
			var tbl_pos = BX.pos(tbl);
			tbl_pos.width = tbl_pos.right - tbl_pos.left;

			var th_pos = BX.pos(th);
			th_pos.width = th_pos.right - th_pos.left;
			th.style.width = th_pos.width + 'px';

			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';

			//Move table to left by width of the first column
			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';

			//Shrink table when it's too wide
			if((tbl_pos.width - th_pos.width) &gt; pos.width)
				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';

			//Check if table is too wide and shrink result div to it's width
			tbl_pos = BX.pos(tbl);
			res_pos = BX.pos(_this.RESULT);
			if(res_pos.right &gt; tbl_pos.right)
			{
				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
			}
		}

		var fade;
		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
		if(fade &amp;&amp; th)
		{
			res_pos = BX.pos(_this.RESULT);
			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
			fade.style.width = 18 + 'px';
			fade.style.top = 0 + 'px';
			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
			fade.style.display = 'block';
		}

		
		$('.bx_searche.scrollbar').mCustomScrollbar({
			mouseWheel: {
				scrollAmount: 150,
				preventDefault: true
			}
		});
	};

	this.onKeyPress = function(keyCode)
	{
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(!tbl)
			return false;

		var i;
		var cnt = tbl.rows.length;

		switch (keyCode)
		{
		case 27: // escape key - close search div
			_this.RESULT.style.display = 'none';
			_this.currentRow = -1;
			_this.UnSelectAll();
		return true;

		case 40: // down key - navigate down on search results
			if(_this.RESULT.style.display == 'none')
				_this.RESULT.style.display = 'block';

			var first = -1;
			for(i = 0; i &lt; cnt; i++)
			{
				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
				{
					if(first == -1)
						first = i;

					if(_this.currentRow &lt; i)
					{
						_this.currentRow = i;
						break;
					}
					else if(tbl.rows[i].className == 'title-search-selected')
					{
						tbl.rows[i].className = '';
					}
				}
			}

			if(i == cnt &amp;&amp; _this.currentRow != i)
				_this.currentRow = first;

			tbl.rows[_this.currentRow].className = 'title-search-selected';
		return true;

		case 38: // up key - navigate up on search results
			if(_this.RESULT.style.display == 'none')
				_this.RESULT.style.display = 'block';

			var last = -1;
			for(i = cnt-1; i &gt;= 0; i--)
			{
				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
				{
					if(last == -1)
						last = i;

					if(_this.currentRow &gt; i)
					{
						_this.currentRow = i;
						break;
					}
					else if(tbl.rows[i].className == 'title-search-selected')
					{
						tbl.rows[i].className = '';
					}
				}
			}

			if(i &lt; 0 &amp;&amp; _this.currentRow != i)
				_this.currentRow = last;

			tbl.rows[_this.currentRow].className = 'title-search-selected';
		return true;

		case 13: // enter key - choose current search result
			if(_this.RESULT.style.display == 'block')
			{
				for(i = 0; i &lt; cnt; i++)
				{
					if(_this.currentRow == i)
					{
						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
						{
							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
							if(a)
							{
								window.location = a.href;
								return true;
							}
						}
					}
				}
			}
		return false;
		}

		return false;
	};

	this.onTimeout = function()
	{
		_this.onChange(function(){
			setTimeout(_this.onTimeout, 500);
		});
	};

	this.onChange = function(callback)
	{
		if (_this.running) {
			_this.needRunAgain = true;
			return;
		}
		_this.running = true;

		if(_this.INPUT.value != _this.oldValue &amp;&amp; _this.INPUT.value != _this.startText)
		{
			_this.oldValue = _this.INPUT.value;
			if(_this.INPUT.value.length &gt;= _this.arParams.MIN_QUERY_LEN)
			{
				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
				if(_this.cache[_this.cache_key] == null)
				{
					if(_this.WAIT)
					{
						var pos = BX.pos(_this.INPUT);
						var height = (pos.bottom - pos.top)-2;
						_this.WAIT.style.top = (pos.top+1) + 'px';
						_this.WAIT.style.height = height + 'px';
						_this.WAIT.style.width = height + 'px';
						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
						_this.WAIT.style.display = 'block';
					}

					BX.ajax.post(
						_this.arParams.AJAX_PAGE,
						{
							'ajax_call':'y',
							'INPUT_ID':_this.arParams.INPUT_ID,
							'q':_this.INPUT.value,
							'l':_this.arParams.MIN_QUERY_LEN
						},
						function(result)
						{
							_this.cache[_this.cache_key] = result;
							_this.ShowResult(result);
							_this.currentRow = -1;
							_this.EnableMouseEvents();
							if(_this.WAIT)
								_this.WAIT.style.display = 'none';
							if (!!callback)
								callback();
							_this.running = false;

							if(_this.needRunAgain){
								_this.needRunAgain = false;
								_this.onChange(callback);
							}
						}
					);
					return;
				}
				else
				{
					_this.ShowResult(_this.cache[_this.cache_key]);
					_this.currentRow = -1;
					_this.EnableMouseEvents();
				}
			}
			else
			{
				_this.RESULT.style.display = 'none';
				_this.currentRow = -1;
				_this.UnSelectAll();
			}
		}
		if (!!callback)
			callback();
		_this.running = false;
	};

	this.UnSelectAll = function()
	{
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(tbl)
		{
			var cnt = tbl.rows.length;
			for(var i = 0; i &lt; cnt; i++)
				tbl.rows[i].className = '';
		}
	};

	this.EnableMouseEvents = function()
	{
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(tbl)
		{
			var cnt = tbl.rows.length;
			for(var i = 0; i &lt; cnt; i++)
				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
				{
					tbl.rows[i].id = 'row_' + i;
					tbl.rows[i].onmouseover = function (e) {
						if(_this.currentRow != this.id.substr(4))
						{
							_this.UnSelectAll();
							this.className = 'title-search-selected';
							_this.currentRow = this.id.substr(4);
						}
					};
					tbl.rows[i].onmouseout = function (e) {
						this.className = '';
						_this.currentRow = -1;
					};
				}
		}
	};

	this.onFocusLost = function(hide)
	{
		setTimeout(function(){_this.RESULT.style.display = 'none';}, 250);
		//_this.RESULT.style.display = 'none';
	};

	this.onFocusGain = function()
	{
		if(_this.RESULT.innerHTML.length)
			_this.ShowResult();
	};

	this.onKeyDown = function(e)
	{
		if(!e)
			e = window.event;

		if (_this.RESULT.style.display == 'block')
		{
			if(_this.onKeyPress(e.keyCode))
				return BX.PreventDefault(e);
		}
		
		$('.title-search-result.'+_this.arParams.INPUT_ID).removeClass('closed');
	};

	this.adjustResultNode = function()
	{
		var pos, pos_input;
		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
		/*if(!!fixedParent)
		{
			_this.RESULT.style.position = 'fixed';
			_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
			pos = BX.pos(_this.CONTAINER, true);
		}
		else
		{*/
			_this.RESULT.style.position = 'absolute';
			pos = BX.pos(_this.CONTAINER, true);
		//}
		pos_input = BX.pos(_this.INPUT);

		pos.width = pos.right - pos.left;
		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
		//_this.RESULT.style.left = pos_input.left + 'px';
		_this.RESULT.style.left = 0 + 'px';

		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
			_this.RESULT.style.width = pos_input.width + 'px';
		else
			_this.RESULT.style.width = pos.width + 'px';
		return pos;
	};

	this._onContainerLayoutChange = function()
	{
		if(_this.RESULT.style.display !== "none" &amp;&amp; _this.RESULT.innerHTML !== '')
		{
			_this.adjustResultNode();
		}
	};
	this.Init = function()
	{
		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);

		this.RESULT = document.body.appendChild(document.createElement("DIV"));

		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
		this.startText = this.oldValue = this.INPUT.value;
		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});

		if(BX.browser.IsSafari() || BX.browser.IsIE())
			this.INPUT.onkeydown = this.onKeyDown;
		else
			this.INPUT.onkeypress = this.onKeyDown;

		if(this.arParams.WAIT_IMAGE)
		{
			this.WAIT = document.body.appendChild(document.createElement("DIV"));
			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
			if(!BX.browser.IsIE())
				this.WAIT.style.backgroundRepeat = 'none';
			this.WAIT.style.display = 'none';
			this.WAIT.style.position = 'absolute';
			this.WAIT.style.zIndex = '1100';
		}

		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});
	};
	BX.ready(function (){_this.Init(arParams)});
}

/* End */
;
; /* Start:"a:4:{s:4:"full";s:88:"/local/templates/aspro_max/components/bitrix/menu/menu_in_burger/script.js?1711948550201";s:6:"source";s:74:"/local/templates/aspro_max/components/bitrix/menu/menu_in_burger/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
$(document).ready(function(){
	$('.menu-row .mega-menu table td.wide_menu .dropdown-menu &gt; .customScrollbar').mCustomScrollbar({
		mouseWheel: {
			scrollAmount: 150,
			preventDefault: true
		}
	})
})
/* End */
;
; /* Start:"a:4:{s:4:"full";s:68:"/local/components/arturgolubev/search.title/script.js?17114176279674";s:6:"source";s:53:"/local/components/arturgolubev/search.title/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
function JCTitleSearch(arParams)
{
	var _this = this;

	this.arParams = {
		'AJAX_PAGE': arParams.AJAX_PAGE,
		'CONTAINER_ID': arParams.CONTAINER_ID,
		'INPUT_ID': arParams.INPUT_ID,
		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
	};
	if(arParams.WAIT_IMAGE)
		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
	if(arParams.MIN_QUERY_LEN &lt;= 0)
		arParams.MIN_QUERY_LEN = 1;

	this.cache = [];
	this.cache_key = null;

	this.startText = '';
	this.running = false;
	this.currentRow = -1;
	this.RESULT = null;
	this.CONTAINER = null;
	this.INPUT = null;
	this.WAIT = null;

	this.ShowResult = function(result)
	{
		if(BX.type.isString(result))
		{
			_this.RESULT.innerHTML = result;
		}

		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
		var pos = _this.adjustResultNode();

		//adjust left column to be an outline
		var res_pos;
		var th;
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(tbl)
		{
			th = BX.findChild(tbl, {'tag':'th'}, true);
		}

		if(th)
		{
			var tbl_pos = BX.pos(tbl);
			tbl_pos.width = tbl_pos.right - tbl_pos.left;

			var th_pos = BX.pos(th);
			th_pos.width = th_pos.right - th_pos.left;
			th.style.width = th_pos.width + 'px';

			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';

			//Move table to left by width of the first column
			_this.RESULT.style.left = (pos.left - th_pos.width - 1)+ 'px';

			//Shrink table when it's too wide
			if((tbl_pos.width - th_pos.width) &gt; pos.width)
				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';

			//Check if table is too wide and shrink result div to it's width
			tbl_pos = BX.pos(tbl);
			res_pos = BX.pos(_this.RESULT);
			if(res_pos.right &gt; tbl_pos.right)
			{
				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
			}
		}

		var fade;
		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
		if(fade &amp;&amp; th)
		{
			res_pos = BX.pos(_this.RESULT);
			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
			fade.style.width = 18 + 'px';
			fade.style.top = 0 + 'px';
			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
			fade.style.display = 'block';
		}
	};

	this.onKeyPress = function(keyCode)
	{
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(!tbl)
			return false;

		var i;
		var cnt = tbl.rows.length;

		switch (keyCode)
		{
		case 27: // escape key - close search div
			_this.RESULT.style.display = 'none';
			_this.currentRow = -1;
			_this.UnSelectAll();
		return true;

		case 40: // down key - navigate down on search results
			if(_this.RESULT.style.display == 'none')
				_this.RESULT.style.display = 'block';

			var first = -1;
			for(i = 0; i &lt; cnt; i++)
			{
				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
				{
					if(first == -1)
						first = i;

					if(_this.currentRow &lt; i)
					{
						_this.currentRow = i;
						break;
					}
					else if(tbl.rows[i].className == 'title-search-selected')
					{
						tbl.rows[i].className = '';
					}
				}
			}

			if(i == cnt &amp;&amp; _this.currentRow != i)
				_this.currentRow = first;

			tbl.rows[_this.currentRow].className = 'title-search-selected';
		return true;

		case 38: // up key - navigate up on search results
			if(_this.RESULT.style.display == 'none')
				_this.RESULT.style.display = 'block';

			var last = -1;
			for(i = cnt-1; i &gt;= 0; i--)
			{
				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
				{
					if(last == -1)
						last = i;

					if(_this.currentRow &gt; i)
					{
						_this.currentRow = i;
						break;
					}
					else if(tbl.rows[i].className == 'title-search-selected')
					{
						tbl.rows[i].className = '';
					}
				}
			}

			if(i &lt; 0 &amp;&amp; _this.currentRow != i)
				_this.currentRow = last;

			tbl.rows[_this.currentRow].className = 'title-search-selected';
		return true;

		case 13: // enter key - choose current search result
			if(_this.RESULT.style.display == 'block')
			{
				for(i = 0; i &lt; cnt; i++)
				{
					if(_this.currentRow == i)
					{
						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
						{
							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
							if(a)
							{
								window.location = a.href;
								return true;
							}
						}
					}
				}
			}
		return false;
		}

		return false;
	};

	this.onTimeout = function()
	{
		_this.onChange(function(){
			setTimeout(_this.onTimeout, 500);
		});
	};

	this.onChange = function(callback)
	{
		if (_this.running)
			return;
		_this.running = true;

		if(_this.INPUT.value != _this.oldValue &amp;&amp; _this.INPUT.value != _this.startText)
		{
			_this.oldValue = _this.INPUT.value;
			if(_this.INPUT.value.length &gt;= _this.arParams.MIN_QUERY_LEN)
			{
				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
				if(_this.cache[_this.cache_key] == null)
				{
					if(_this.WAIT)
					{
						var pos = BX.pos(_this.INPUT);
						var height = (pos.bottom - pos.top)-2;
						_this.WAIT.style.top = (pos.top+1) + 'px';
						_this.WAIT.style.height = height + 'px';
						_this.WAIT.style.width = height + 'px';
						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
						_this.WAIT.style.display = 'block';
					}

					BX.ajax.post(
						_this.arParams.AJAX_PAGE,
						{
							'ajax_call':'y',
							'INPUT_ID':_this.arParams.INPUT_ID,
							'q':_this.INPUT.value,
							'l':_this.arParams.MIN_QUERY_LEN
						},
						function(result)
						{
							_this.cache[_this.cache_key] = result;
							_this.ShowResult(result);
							_this.currentRow = -1;
							_this.EnableMouseEvents();
							if(_this.WAIT)
								_this.WAIT.style.display = 'none';
							if (!!callback)
								callback();
							_this.running = false;
						}
					);
					return;
				}
				else
				{
					_this.ShowResult(_this.cache[_this.cache_key]);
					_this.currentRow = -1;
					_this.EnableMouseEvents();
				}
			}
			else
			{
				_this.RESULT.style.display = 'none';
				_this.currentRow = -1;
				_this.UnSelectAll();
			}
		}
		if (!!callback)
			callback();
		_this.running = false;
	};

	this.onScroll = function ()
	{
		if(BX.type.isElementNode(_this.RESULT)
			&amp;&amp; _this.RESULT.style.display !== "none"
			&amp;&amp; _this.RESULT.innerHTML !== ''
		)
		{
			_this.adjustResultNode();
		}
	};

	this.UnSelectAll = function()
	{
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(tbl)
		{
			var cnt = tbl.rows.length;
			for(var i = 0; i &lt; cnt; i++)
				tbl.rows[i].className = '';
		}
	};

	this.EnableMouseEvents = function()
	{
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(tbl)
		{
			var cnt = tbl.rows.length;
			for(var i = 0; i &lt; cnt; i++)
				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
				{
					tbl.rows[i].id = 'row_' + i;
					tbl.rows[i].onmouseover = function (e) {
						if(_this.currentRow != this.id.substr(4))
						{
							_this.UnSelectAll();
							this.className = 'title-search-selected';
							_this.currentRow = this.id.substr(4);
						}
					};
					tbl.rows[i].onmouseout = function (e) {
						this.className = '';
						_this.currentRow = -1;
					};
				}
		}
	};

	this.onFocusLost = function(hide)
	{
		setTimeout(function(){_this.RESULT.style.display = 'none';}, 250);
	};

	this.onFocusGain = function()
	{
		if(_this.RESULT.innerHTML.length)
			_this.ShowResult();
	};

	this.onKeyDown = function(e)
	{
		if(!e)
			e = window.event;

		if (_this.RESULT.style.display == 'block')
		{
			if(_this.onKeyPress(e.keyCode))
				return BX.PreventDefault(e);
		}
	};

	this.adjustResultNode = function()
	{
		if(!(BX.type.isElementNode(_this.RESULT)
			&amp;&amp; BX.type.isElementNode(_this.CONTAINER))
		)
		{
			return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
		}

		var pos = BX.pos(_this.CONTAINER);

		_this.RESULT.style.position = 'absolute';
		_this.RESULT.style.top = (pos.bottom + 2) + 'px';
		_this.RESULT.style.left = pos.left + 'px';
		_this.RESULT.style.width = pos.width + 'px';

		return pos;
	};

	this._onContainerLayoutChange = function()
	{
		if(BX.type.isElementNode(_this.RESULT)
			&amp;&amp; _this.RESULT.style.display !== "none"
			&amp;&amp; _this.RESULT.innerHTML !== ''
		)
		{
			_this.adjustResultNode();
		}
	};
	this.Init = function()
	{
		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);

		this.RESULT = document.body.appendChild(document.createElement("DIV"));
		this.RESULT.className = 'title-search-result';
		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
		this.startText = this.oldValue = this.INPUT.value;
		BX.bind(this.INPUT, 'focus', function() {_this.onFocusGain()});
		BX.bind(this.INPUT, 'blur', function() {_this.onFocusLost()});
		this.INPUT.onkeydown = this.onKeyDown;

		if(this.arParams.WAIT_IMAGE)
		{
			this.WAIT = document.body.appendChild(document.createElement("DIV"));
			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
			if(!BX.browser.IsIE())
				this.WAIT.style.backgroundRepeat = 'none';
			this.WAIT.style.display = 'none';
			this.WAIT.style.position = 'absolute';
			this.WAIT.style.zIndex = '1100';
		}

		BX.bind(this.INPUT, 'bxchange', function() {_this.onChange()});

		var fixedParent = BX.findParent(this.CONTAINER, BX.is_fixed);
		if(BX.type.isElementNode(fixedParent))
		{
			BX.bind(window, 'scroll', BX.throttle(this.onScroll, 100, this));
		}
	};
	BX.ready(function (){_this.Init(arParams)});
}

/* End */
;
; /* Start:"a:4:{s:4:"full";s:102:"/local/templates/aspro_max/components/arturgolubev/search.title/corp__custom/script.js?171141776210607";s:6:"source";s:86:"/local/templates/aspro_max/components/arturgolubev/search.title/corp__custom/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
$(document).ready(function(){
	var containerHTML = $('.title-search-input_fixed').detach();
	$('#title-search_fixed').append(containerHTML);
});

$(document).ready(function(){
	var containerHTML = $('.title-search-input_fixedtf').detach();
	$('#title-search_fixedtf').append(containerHTML);
});

$(document).ready(function(){
	var containerHTML = $('.title-search-input').detach();
	$('#title-search').append(containerHTML);
});



function JCTitleSearch4(arParams)
{
	var _this = this;
	
	this.arParams = {
		'AJAX_PAGE': arParams.AJAX_PAGE,
		'CONTAINER_ID': arParams.CONTAINER_ID,
		'INPUT_ID': arParams.INPUT_ID,
		'INPUT_ID_TMP': arParams.INPUT_ID_TMP,
		'MIN_QUERY_LEN': parseInt(arParams.MIN_QUERY_LEN)
	};

	if(arParams.WAIT_IMAGE)
		this.arParams.WAIT_IMAGE = arParams.WAIT_IMAGE;
	if(arParams.MIN_QUERY_LEN &lt;= 0)
		arParams.MIN_QUERY_LEN = 1;

	this.cache = [];
	this.cache_key = null;

	this.startText = '';
	this.running = false;
	this.needRunAgain = false;
	this.currentRow = -1;
	this.RESULT = null;
	this.CONTAINER = null;
	this.INPUT = null;
	this.WAIT = null;

	this.ShowResult = function(result)
	{
		if(BX.type.isString(result))
		{
			_this.RESULT.innerHTML = result;
		}

		_this.RESULT.style.display = _this.RESULT.innerHTML !== '' ? 'block' : 'none';
		var pos = _this.adjustResultNode();

		//adjust left column to be an outline
		var res_pos;
		var th;
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(tbl)
		{
			th = BX.findChild(tbl, {'tag':'th'}, true);
		}
		
		if(th)
		{
			var tbl_pos = BX.pos(tbl);
			tbl_pos.width = tbl_pos.right - tbl_pos.left;

			var th_pos = BX.pos(th);
			th_pos.width = th_pos.right - th_pos.left;
			th.style.width = th_pos.width + 'px';

			_this.RESULT.style.width = (pos.width + th_pos.width) + 'px';

			//Move table to left by width of the first column
			_this.RESULT.style.left = '0px';//(pos.left - th_pos.width - 1)+ 'px';

			//Shrink table when it's too wide
			if((tbl_pos.width - th_pos.width) &gt; pos.width)
				_this.RESULT.style.width = (pos.width + th_pos.width -1) + 'px';

			//Check if table is too wide and shrink result div to it's width
			tbl_pos = BX.pos(tbl);
			res_pos = BX.pos(_this.RESULT);
			if(res_pos.right &gt; tbl_pos.right)
			{
				_this.RESULT.style.width = (tbl_pos.right - tbl_pos.left) + 'px';
			}
		}

		var fade;
		if(tbl) fade = BX.findChild(_this.RESULT, {'class':'title-search-fader'}, true);
		if(fade &amp;&amp; th)
		{
			res_pos = BX.pos(_this.RESULT);
			fade.style.left = (res_pos.right - res_pos.left - 18) + 'px';
			fade.style.width = 18 + 'px';
			fade.style.top = 0 + 'px';
			fade.style.height = (res_pos.bottom - res_pos.top) + 'px';
			fade.style.display = 'block';
		}

		
		$('.bx_searche.scrollbar').mCustomScrollbar({
			mouseWheel: {
				scrollAmount: 150,
				preventDefault: true
			}
		});
	};

	this.onKeyPress = function(keyCode)
	{
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(!tbl)
			return false;

		var i;
		var cnt = tbl.rows.length;

		switch (keyCode)
		{
		case 27: // escape key - close search div
			_this.RESULT.style.display = 'none';
			_this.currentRow = -1;
			_this.UnSelectAll();
		return true;

		case 40: // down key - navigate down on search results
			if(_this.RESULT.style.display == 'none')
				_this.RESULT.style.display = 'block';

			var first = -1;
			for(i = 0; i &lt; cnt; i++)
			{
				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
				{
					if(first == -1)
						first = i;

					if(_this.currentRow &lt; i)
					{
						_this.currentRow = i;
						break;
					}
					else if(tbl.rows[i].className == 'title-search-selected')
					{
						tbl.rows[i].className = '';
					}
				}
			}

			if(i == cnt &amp;&amp; _this.currentRow != i)
				_this.currentRow = first;

			tbl.rows[_this.currentRow].className = 'title-search-selected';
		return true;

		case 38: // up key - navigate up on search results
			if(_this.RESULT.style.display == 'none')
				_this.RESULT.style.display = 'block';

			var last = -1;
			for(i = cnt-1; i &gt;= 0; i--)
			{
				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
				{
					if(last == -1)
						last = i;

					if(_this.currentRow &gt; i)
					{
						_this.currentRow = i;
						break;
					}
					else if(tbl.rows[i].className == 'title-search-selected')
					{
						tbl.rows[i].className = '';
					}
				}
			}

			if(i &lt; 0 &amp;&amp; _this.currentRow != i)
				_this.currentRow = last;

			tbl.rows[_this.currentRow].className = 'title-search-selected';
		return true;

		case 13: // enter key - choose current search result
			if(_this.RESULT.style.display == 'block')
			{
				for(i = 0; i &lt; cnt; i++)
				{
					if(_this.currentRow == i)
					{
						if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
						{
							var a = BX.findChild(tbl.rows[i], {'tag':'a'}, true);
							if(a)
							{
								window.location = a.href;
								return true;
							}
						}
					}
				}
			}
		return false;
		}

		return false;
	};

	this.onTimeout = function()
	{
		_this.onChange(function(){
			setTimeout(_this.onTimeout, 500);
		});
	};

	this.onChange = function(callback)
	{
		if (_this.running){
			_this.needRunAgain = true;
			return;
		}
		_this.running = true;

		if(_this.INPUT.value != _this.oldValue &amp;&amp; _this.INPUT.value != _this.startText)
		{
			_this.oldValue = _this.INPUT.value;
			if(_this.INPUT.value.length &gt;= _this.arParams.MIN_QUERY_LEN)
			{
				_this.cache_key = _this.arParams.INPUT_ID + '|' + _this.INPUT.value;
				if(_this.cache[_this.cache_key] == null)
				{
					if(_this.WAIT)
					{
						var pos = BX.pos(_this.INPUT);
						var height = (pos.bottom - pos.top)-2;
						_this.WAIT.style.top = (pos.top+1) + 'px';
						_this.WAIT.style.height = height + 'px';
						_this.WAIT.style.width = height + 'px';
						_this.WAIT.style.left = (pos.right - height + 2) + 'px';
						_this.WAIT.style.display = 'block';
					}

					BX.ajax.post(
						_this.arParams.AJAX_PAGE,
						{
							'ajax_call':'y',
							'INPUT_ID':_this.arParams.INPUT_ID_TMP,
							'q':_this.INPUT.value,
							'l':_this.arParams.MIN_QUERY_LEN
						},
						function(result)
						{
							_this.cache[_this.cache_key] = result;
							_this.ShowResult(result);
							_this.currentRow = -1;
							_this.EnableMouseEvents();
							if(_this.WAIT)
								_this.WAIT.style.display = 'none';
							if (!!callback)
								callback();
							_this.running = false;

							if(_this.needRunAgain){
								_this.needRunAgain = false;
								_this.onChange(callback);
							}
						}
					);
					return;
				}
				else
				{
					_this.ShowResult(_this.cache[_this.cache_key]);
					_this.currentRow = -1;
					_this.EnableMouseEvents();
				}
			}
			else
			{
				_this.RESULT.style.display = 'none';
				_this.currentRow = -1;
				_this.UnSelectAll();
			}
		}
		if (!!callback)
			callback();
		_this.running = false;
	};

	this.UnSelectAll = function()
	{
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(tbl)
		{
			var cnt = tbl.rows.length;
			for(var i = 0; i &lt; cnt; i++)
				tbl.rows[i].className = '';
		}
	};

	this.EnableMouseEvents = function()
	{
		var tbl = BX.findChild(_this.RESULT, {'tag':'table','class':'title-search-result'}, true);
		if(tbl)
		{
			var cnt = tbl.rows.length;
			for(var i = 0; i &lt; cnt; i++)
				if(!BX.findChild(tbl.rows[i], {'class':'title-search-separator'}, true))
				{
					tbl.rows[i].id = 'row_' + i;
					tbl.rows[i].onmouseover = function (e) {
						if(_this.currentRow != this.id.substr(4))
						{
							_this.UnSelectAll();
							this.className = 'title-search-selected';
							_this.currentRow = this.id.substr(4);
						}
					};
					tbl.rows[i].onmouseout = function (e) {
						this.className = '';
						_this.currentRow = -1;
					};
				}
		}
	};

	this.onFocusLost = function(hide)
	{
		setTimeout(function(){_this.RESULT.style.display = 'none';}, 300);
		// _this.RESULT.style.display = 'none';
	};

	this.onFocusGain = function()
	{
		if(_this.RESULT.innerHTML.length)
			_this.ShowResult();
	};

	this.onKeyDown = function(e)
	{
		if(!e)
			e = window.event;
		if (_this.RESULT.style.display == 'block')
		{
			if(_this.onKeyPress(e.keyCode))
				return BX.PreventDefault(e);
		}
	};

	this.adjustResultNode = function()
	{
		var pos, pos_input;
		var fixedParent = BX.findParent(_this.CONTAINER, BX.is_fixed);
		// if(!!fixedParent)
		// {
		// 	_this.RESULT.style.position = 'fixed';
		// 	_this.RESULT.style.zIndex = BX.style(fixedParent, 'z-index') + 2;
		// 	pos = BX.pos(_this.CONTAINER, true);
		// }
		// else
		// {
			_this.RESULT.style.position = 'absolute';
			pos = BX.pos(_this.CONTAINER);
		// }
		pos_input = BX.pos(_this.INPUT);

		pos.width = pos.right - pos.left;
		_this.RESULT.style.top = '100%';
		_this.RESULT.style.left = '0px';//pos_input.left + 'px';

		if($(_this.INPUT).closest('.inline-search-block.with-close').length)
			_this.RESULT.style.width = pos_input.width + 'px';
		else
			_this.RESULT.style.width = pos.width + 'px';
		return pos;
	};

	this._onContainerLayoutChange = function()
	{
		if(_this.RESULT.style.display !== "none" &amp;&amp; _this.RESULT.innerHTML !== '')
		{
			_this.adjustResultNode();
		}
	};
	this.Init = function()
	{
		this.CONTAINER = document.getElementById(this.arParams.CONTAINER_ID);
		BX.addCustomEvent(this.CONTAINER, "OnNodeLayoutChange", this._onContainerLayoutChange);

		this.RESULT = document.body.appendChild(document.createElement("DIV"));

		this.RESULT.className = 'title-search-result '+this.arParams.INPUT_ID;
		this.INPUT = document.getElementById(this.arParams.INPUT_ID);
		this.startText = this.oldValue = this.INPUT.value;
		BX.bind(this.INPUT, 'focus', function(e) {
			_this.onFocusGain()
		});
		BX.bind(this.INPUT, 'blur', function(e) {
			if(!$(e.relatedTarget).hasClass('bx_item_block'))
				_this.onFocusLost();
		});

		if(BX.browser.IsSafari() || BX.browser.IsIE())
			this.INPUT.onkeydown = this.onKeyDown;
		else
			this.INPUT.onkeypress = this.onKeyDown;

		if(this.arParams.WAIT_IMAGE)
		{
			this.WAIT = document.body.appendChild(document.createElement("DIV"));
			this.WAIT.style.backgroundImage = "url('" + this.arParams.WAIT_IMAGE + "')";
			if(!BX.browser.IsIE())
				this.WAIT.style.backgroundRepeat = 'none';
			this.WAIT.style.display = 'none';
			this.WAIT.style.position = 'absolute';
			this.WAIT.style.zIndex = '1100';
		}

		BX.bind(this.INPUT, 'bxchange', function(e) {_this.onChange()});
	};
	BX.ready(function (){_this.Init(arParams)});
}

/* End */
;
; /* Start:"a:4:{s:4:"full";s:100:"/local/templates/aspro_max/components/bitrix/menu/top_flexible_dropdown_mk1/script.js?17119485503321";s:6:"source";s:85:"/local/templates/aspro_max/components/bitrix/menu/top_flexible_dropdown_mk1/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
$(document).ready(function(){
	$('.menu-row .mega-menu table td.wide_menu .customScrollbar').mCustomScrollbarDeferred({
		mouseWheel: {
			scrollAmount: 150,
			preventDefault: true
		}
	})

	if($("li").is(".flex_dropdown_item")){
		function handlerIn(e){
			let target = $(e.target);
			if (!target.hasClass("flex_dropdown_item")){
				target = $(target.closest(".flex_dropdown_item"));
			}
			let dropDown = $(target.find(".flex_dropdown_wrapper").first());

			hide(target,true);
			dropDown.addClass("visible");
			setPosition(target, dropDown);
		}

		function handlerOut(e){
			let target = $(e.target);
			if (!target.hasClass("flex_dropdown_item")){
				target = $(target.closest(".flex_dropdown_item"));
			}
			let dropDown = $(target.find(".flex_dropdown_wrapper"));
			hide(dropDown);
		}

		function hide(jq_item=null, revert=false){
			if (jq_item==null){
				$(".flex_dropdown_wrapper").removeClass("visible");
			}else{
				if (revert){
					let curLevel = $(jq_item.closest(".flex_dropdown_wrapper").find(".flex_dropdown_wrapper"));
					let except = $(jq_item.closest("li").find(".flex_dropdown_wrapper").not(curLevel));
					$(".flex_dropdown_wrapper").not(except).removeClass("visible");
				}else{
					jq_item.removeClass("visible");
				}
			}
		}

		function setPosition(target, dropDown){
			dropDown = $(dropDown[0]);
			let flex_item;
			if(!target.hasClass("flex_dropdown_item")){
				flex_item = $(target.closest(".flex_dropdown_item"))
			}else{
				flex_item = target;
			}
			let parentOffset = flex_item.offset()
			let selfOffset = dropDown.offset();

			if (flex_item.hasClass("firstSub")){
				dropDown.offset({top:parentOffset.top,left:(parentOffset.left+flex_item.width())});
			}else {
				let container = $(flex_item.closest(".menu-navigation__content"));
				let DdLeftPos = parentOffset.left+30+$(flex_item.find("span.name").first()).width();
				if (flex_item.hasClass("has_img")){
					DdLeftPos += flex_item.find(".menu_img").width();
				}
				let DdRightPos= DdLeftPos+dropDown.width()
				let TopPos = flex_item.find("span.name").offset().top-10;
				let BottomPos = TopPos + dropDown.height();

				let RightPosLimit = container.offset().left+container.width();
				let BottomLimit = container.offset().top+container.height();

				if(DdRightPos &gt; RightPosLimit){
					let delta = $(flex_item.find("span.name").first()).width()+30;
					DdLeftPos = DdLeftPos - delta;
					DdRightPos = DdLeftPos+dropDown.width()

					TopPos+=flex_item.height() - 25;
					BottomPos = TopPos + dropDown.height();

					if (DdRightPos &gt; RightPosLimit){
						delta = DdRightPos-RightPosLimit;
						DdLeftPos = DdLeftPos - delta;
					}
				}

				if(BottomPos &gt; BottomLimit){
					let delta = BottomPos - BottomLimit;
					TopPos = TopPos - delta - 10;

					if ( TopPos &lt; (parentOffset.top + flex_item.height()) ){
						TopPos = TopPos+flex_item.height()
						$(dropDown.find('.flex_dropdown')).height(dropDown.height()-flex_item.height());
					}
				}
				dropDown.offset({top:TopPos,left:DdLeftPos});
			}
		}

		$(".flex_dropdown_item").mouseenter( handlerIn ).mouseleave( handlerOut );
		$(".flex_dropdown_wrapper").mouseleave( function(e){
		    if(!this.closest(".flex_dropdown_item").matches(':hover')) {
		        let $this = $(this);
			    hide($this);
		    }
		});
	}
})

/* End */
;
; /* Start:"a:4:{s:4:"full";s:88:"/bitrix/components/aspro/marketing.popup.max/templates/.default/script.js?17113913371756";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:"";}"*/

function showMarketingPopup(){
	if($('.dyn_mp_jqm').length)
	{
		var allDelays = [];
		$('.dyn_mp_jqm').each(function(i, el) {
			var jqmBlock = $(el),
				delay = 0;

			if(!jqmBlock.hasClass('initied')) // first load
			{
				jqmBlock.addClass('initied');
				
				if(jqmBlock.data('param-delay'))
					delay = jqmBlock.data('param-delay')*1000;

				while(allDelays.indexOf(delay) !== -1) {
					delay += 1000;
				}

				allDelays.push(delay);

				if(typeof localStorage !== 'undefined')
				{
					var dataLS = localStorage.getItem(jqmBlock.data('ls')),
						ls = '';
					try{
						ls = JSON.parse(dataLS);
					}
					catch(e){
						ls = dataLS
					}
					if(!ls || (ls &amp;&amp; (ls.TIMESTAMP &lt; Date.now() &amp;&amp; ls.TIMESTAMP)))
					{
						/*if (timeoutID) {
							clearTimeout(timeoutID);
						}*/
						timeoutID = setTimeout(function(){
							console.log(jqmBlock, delay)
							jqmBlock.click();
						}, delay);
					}
				}
				else
				{
					var ls = $.cookie(jqmBlock.data('ls'));
					if(!ls)
					{
						/*if (timeoutID) {
							clearTimeout(timeoutID);
						}*/
						timeoutID = setTimeout(function(){
							jqmBlock.click();
						}, delay);
					}
				}

			}
			else // ajax popup
			{
				
			}

		});
	}
}




$(document).ready(function(){

	showMarketingPopup();
	
	if(typeof window.frameCacheVars !== "undefined"){
		BX.addCustomEvent("onFrameDataReceived", function (json){
			showMarketingPopup();
		});
	}

	$(document).on('click', '.dyn_mp_jqm_frame .popup-text-info__btn .btn', function() {
		var closeBtn = $(this).closest('.dyn_mp_jqm_frame').find('.jqmClose');

		if(closeBtn.length) {
			closeBtn.trigger('click');
		}
	});
})

/* End */
;
; /* Start:"a:4:{s:4:"full";s:92:"/local/templates/aspro_max/components/bitrix/search.title/fixed/script.min.js?17114179236439";s:6:"source";s:73:"/local/templates/aspro_max/components/bitrix/search.title/fixed/script.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
function JCTitleSearch2(t){var o=this;this.arParams={AJAX_PAGE:t.AJAX_PAGE,CONTAINER_ID:t.CONTAINER_ID,INPUT_ID:t.INPUT_ID,INPUT_ID_TMP:t.INPUT_ID_TMP,MIN_QUERY_LEN:parseInt(t.MIN_QUERY_LEN)},t.WAIT_IMAGE&amp;&amp;(this.arParams.WAIT_IMAGE=t.WAIT_IMAGE),t.MIN_QUERY_LEN&lt;=0&amp;&amp;(t.MIN_QUERY_LEN=1),this.cache=[],this.cache_key=null,this.startText="",this.running=!1,this.needRunAgain=!1,this.currentRow=-1,this.RESULT=null,this.CONTAINER=null,this.INPUT=null,this.WAIT=null,this.ShowResult=function(t){BX.type.isString(t)&amp;&amp;(o.RESULT.innerHTML=t),o.RESULT.style.display=""!==o.RESULT.innerHTML?"block":"none";var e,s,n,i=o.adjustResultNode(),a=BX.findChild(o.RESULT,{tag:"table",class:"title-search-result"},!0);if(a&amp;&amp;(s=BX.findChild(a,{tag:"th"},!0)),s){var l=BX.pos(a);l.width=l.right-l.left;var r=BX.pos(s);r.width=r.right-r.left,s.style.width=r.width+"px",o.RESULT.style.width=i.width+r.width+"px",o.RESULT.style.left=i.left-r.width-1+"px",l.width-r.width&gt;i.width&amp;&amp;(o.RESULT.style.width=i.width+r.width-1+"px"),l=BX.pos(a),(e=BX.pos(o.RESULT)).right&gt;l.right&amp;&amp;(o.RESULT.style.width=l.right-l.left+"px")}a&amp;&amp;(n=BX.findChild(o.RESULT,{class:"title-search-fader"},!0)),n&amp;&amp;s&amp;&amp;(e=BX.pos(o.RESULT),n.style.left=e.right-e.left-18+"px",n.style.width="18px",n.style.top="0px",n.style.height=e.bottom-e.top+"px",n.style.display="block"),$(".bx_searche.scrollbar").mCustomScrollbar({mouseWheel:{scrollAmount:150,preventDefault:!0}})},this.onKeyPress=function(t){var e,s=BX.findChild(o.RESULT,{tag:"table",class:"title-search-result"},!0);if(!s)return!1;var n=s.rows.length;switch(t){case 27:return o.RESULT.style.display="none",o.currentRow=-1,o.UnSelectAll(),!0;case 40:"none"==o.RESULT.style.display&amp;&amp;(o.RESULT.style.display="block");var i=-1;for(e=0;e&lt;n;e++)if(!BX.findChild(s.rows[e],{class:"title-search-separator"},!0)){if(-1==i&amp;&amp;(i=e),o.currentRow&lt;e){o.currentRow=e;break}"title-search-selected"==s.rows[e].className&amp;&amp;(s.rows[e].className="")}return e==n&amp;&amp;o.currentRow!=e&amp;&amp;(o.currentRow=i),s.rows[o.currentRow].className="title-search-selected",!0;case 38:"none"==o.RESULT.style.display&amp;&amp;(o.RESULT.style.display="block");var a=-1;for(e=n-1;0&lt;=e;e--)if(!BX.findChild(s.rows[e],{class:"title-search-separator"},!0)){if(-1==a&amp;&amp;(a=e),o.currentRow&gt;e){o.currentRow=e;break}"title-search-selected"==s.rows[e].className&amp;&amp;(s.rows[e].className="")}return e&lt;0&amp;&amp;o.currentRow!=e&amp;&amp;(o.currentRow=a),s.rows[o.currentRow].className="title-search-selected",!0;case 13:if("block"==o.RESULT.style.display)for(e=0;e&lt;n;e++)if(o.currentRow==e&amp;&amp;!BX.findChild(s.rows[e],{class:"title-search-separator"},!0)){var l=BX.findChild(s.rows[e],{tag:"a"},!0);if(l)return window.location=l.href,!0}return!1}return!1},this.onTimeout=function(){o.onChange(function(){setTimeout(o.onTimeout,500)})},this.onChange=function(e){if(o.running)o.needRunAgain=!0;else{if(o.running=!0,o.INPUT.value!=o.oldValue&amp;&amp;o.INPUT.value!=o.startText)if(o.oldValue=o.INPUT.value,o.INPUT.value.length&gt;=o.arParams.MIN_QUERY_LEN){if(o.cache_key=o.arParams.INPUT_ID+"|"+o.INPUT.value,null==o.cache[o.cache_key]){if(o.WAIT){var t=BX.pos(o.INPUT),s=t.bottom-t.top-2;o.WAIT.style.top=t.top+1+"px",o.WAIT.style.height=s+"px",o.WAIT.style.width=s+"px",o.WAIT.style.left=t.right-s+2+"px",o.WAIT.style.display="block"}return void BX.ajax.post(o.arParams.AJAX_PAGE,{ajax_call:"y",INPUT_ID:o.arParams.INPUT_ID_TMP,q:o.INPUT.value,l:o.arParams.MIN_QUERY_LEN},function(t){o.cache[o.cache_key]=t,o.ShowResult(t),o.currentRow=-1,o.EnableMouseEvents(),o.WAIT&amp;&amp;(o.WAIT.style.display="none"),e&amp;&amp;e(),o.running=!1,o.needRunAgain&amp;&amp;(o.needRunAgain=!1,o.onChange(e))})}o.ShowResult(o.cache[o.cache_key]),o.currentRow=-1,o.EnableMouseEvents()}else o.RESULT.style.display="none",o.currentRow=-1,o.UnSelectAll();e&amp;&amp;e(),o.running=!1}},this.UnSelectAll=function(){var t=BX.findChild(o.RESULT,{tag:"table",class:"title-search-result"},!0);if(t)for(var e=t.rows.length,s=0;s&lt;e;s++)t.rows[s].className=""},this.EnableMouseEvents=function(){var t=BX.findChild(o.RESULT,{tag:"table",class:"title-search-result"},!0);if(t)for(var e=t.rows.length,s=0;s&lt;e;s++)BX.findChild(t.rows[s],{class:"title-search-separator"},!0)||(t.rows[s].id="row_"+s,t.rows[s].onmouseover=function(t){o.currentRow!=this.id.substr(4)&amp;&amp;(o.UnSelectAll(),this.className="title-search-selected",o.currentRow=this.id.substr(4))},t.rows[s].onmouseout=function(t){this.className="",o.currentRow=-1})},this.onFocusLost=function(t){setTimeout(function(){o.RESULT.style.display="none"},300)},this.onFocusGain=function(){o.RESULT.innerHTML.length&amp;&amp;o.ShowResult()},this.onKeyDown=function(t){if(t=t||window.event,"block"==o.RESULT.style.display&amp;&amp;o.onKeyPress(t.keyCode))return BX.PreventDefault(t)},this.adjustResultNode=function(){var t,e,s=BX.findParent(o.CONTAINER,BX.is_fixed);return t=s?(o.RESULT.style.position="fixed",o.RESULT.style.zIndex=BX.style(s,"z-index")+2,BX.pos(o.CONTAINER,!0)):(o.RESULT.style.position="absolute",BX.pos(o.CONTAINER)),e=BX.pos(o.INPUT),t.width=t.right-t.left,o.RESULT.style.top=t.bottom+2+"px",o.RESULT.style.left=e.left+"px",$(o.INPUT).closest(".inline-search-block.with-close").length?o.RESULT.style.width=e.width+"px":o.RESULT.style.width=t.width+"px",t},this._onContainerLayoutChange=function(){"none"!==o.RESULT.style.display&amp;&amp;""!==o.RESULT.innerHTML&amp;&amp;o.adjustResultNode()},this.Init=function(){this.CONTAINER=document.getElementById(this.arParams.CONTAINER_ID),BX.addCustomEvent(this.CONTAINER,"OnNodeLayoutChange",this._onContainerLayoutChange),this.RESULT=document.body.appendChild(document.createElement("DIV")),this.RESULT.className="title-search-result "+this.arParams.INPUT_ID,"title-search-input_fixed"!=this.arParams.INPUT_ID&amp;&amp;(this.RESULT.className+=" "+arMaxOptions.THEME.TYPE_SEARCH+"_type"),this.INPUT=document.getElementById(this.arParams.INPUT_ID),this.startText=this.oldValue=this.INPUT.value,BX.bind(this.INPUT,"focus",function(){o.onFocusGain()}),BX.bind(this.INPUT,"blur",function(){o.onFocusLost()}),BX.browser.IsSafari()||BX.browser.IsIE()?this.INPUT.onkeydown=this.onKeyDown:this.INPUT.onkeypress=this.onKeyDown,this.arParams.WAIT_IMAGE&amp;&amp;(this.WAIT=document.body.appendChild(document.createElement("DIV")),this.WAIT.style.backgroundImage="url('"+this.arParams.WAIT_IMAGE+"')",BX.browser.IsIE()||(this.WAIT.style.backgroundRepeat="none"),this.WAIT.style.display="none",this.WAIT.style.position="absolute",this.WAIT.style.zIndex="1100"),BX.bind(this.INPUT,"bxchange",function(){o.onChange()})},BX.ready(function(){o.Init(t)})}
/* End */
;
; /* Start:"a:4:{s:4:"full";s:55:"/local/templates/aspro_max/js/custom.js?171141774927503";s:6:"source";s:39:"/local/templates/aspro_max/js/custom.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
/*
You can use this file with your scripts.
It will not be overwritten when you upgrade solution.
*/
BX.Event.EventEmitter.setMaxListeners(900);

const closeRegionality = (event) =&gt; {
    event.target.closest('.confirm_region').classList.remove('active')
    setTimeout(() =&gt; {
        event.target.closest('.confirm_region').remove();
    }, 1000)
}

$.fn.jqmExCustom = function(){
    var _this = $(this);
    var name = _this.data('name');
    var sFastViewClass = '';
    
    if(name.length){
        var script = arMaxOptions['SITE_DIR'] + 'ajax/customForm.php';
        var paramsStr = ''; var trigger = ''; var arTriggerAttrs = {};
        
        $.each(_this.get(0).attributes, function(index, attr){
            var attrName = attr.nodeName;
            var attrValue = _this.attr(attrName);
            
            trigger += '[' + attrName + '=\"' + attrValue + '\"]';
            arTriggerAttrs[attrName] = attrValue;
            
            if(/^data\-param\-(.+)$/.test(attrName)){
                var key = attrName.match(/^data\-param\-(.+)$/)[1];
                
                paramsStr += key + '=' + attrValue + '&amp;';
            }
        });
        
        var triggerAttrs = JSON.stringify(arTriggerAttrs);
        var encTriggerAttrs = encodeURIComponent(triggerAttrs);
        
        if(name == 'auth')
            script += '?' + paramsStr + 'auth=Y';
        else
            script += '?' + paramsStr + 'data-trigger=' + encTriggerAttrs;
            
        if(!$('.' + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').length){
            if(_this.attr('disabled') != 'disabled'){
                $('body').find('.' + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').remove();
                $('body').append('&lt;div class="' + name + '_frame '+sFastViewClass+' jqmWindow popup" data-trigger="' + encTriggerAttrs + '"&gt;&lt;/div&gt;');
                $('.' + name + '_frame[data-trigger="' + encTriggerAttrs + '"]').jqm({trigger: trigger, onLoad: function(hash){onLoadjqm(name, hash);}, onHide: function(hash){onHidejqm(name, hash);}, ajax:script});
            }
        }
    }
}

function scrollToAnchor(aid){
    var aTag = $("#"+ aid +"");
    $('html,body').animate({scrollTop: aTag.offset().top-150},'slow');
}

function changePageTitle(newPageTitle) {
    const pageTitle = document.getElementById('pagetitle');
    pageTitle ? pageTitle.innerText = newPageTitle : false;
}

function changeBrowserTitle(newPageTitle) {
    document.title = newPageTitle;
}

const hashChangeHandler = () =&gt; (location.hash === "#delayed") ? location.reload(): false;

function basketTopButtonHandler(event) {
    let _this = $(this),
        parent = _this.closest('.bx-soa-order-header'),
        hover_block = parent.find('.basket_hover_block--custom'),
        target = event.currentTarget;

    if(!hover_block.hasClass('loaded')) {
        basketOrder('open', hover_block);
        target.classList.add('open');
    } else {
        basketOrder('close', hover_block);
        target.classList.remove('open');
    }
}

function basketOrder(action, hoverBlock){

    if(action=='open') {
        if(hoverBlock.length) {
            hoverBlock.addClass('loaded');
        }
    }

    if ( hoverBlock === undefined ) {
        return false;
    }

    if(action=='close'){
        if(hoverBlock.length) {
            hoverBlock.removeClass('loaded');
            return true;
        }
    }

    var firstTime = hoverBlock.find('div').length ? 'false' : 'true';
    var params = $("#basket_form").find("input#fly_basket_params").val();
    var postData = {
        firstTime: firstTime,
    };
    if(params !== undefined) {
        postData.PARAMS = params;
    }

    $.post( arAsproOptions['SITE_DIR']+"ajax/showBasketHoverCustom.php", postData, $.proxy(function( data ){
        var ob = BX.processHTML(data);
        // inject
        $('.bx-soa-order-header .basket_hover_block--custom').html(ob.HTML);
        BX.ajax.processScripts(ob.SCRIPT);

        if(window.matchMedia('(min-width: 992px)').matches)
        {
            hoverBlock.addClass('loaded');
        }

    }));
}

$(document).on('click', '*[data-event="jqmcustom"]', function(e){
    e.preventDefault();
    e.stopPropagation();
    
    if (!$(this).hasClass('clicked')) {
        $(this).addClass('clicked');
        $(this).jqmExCustom();
        $(this).trigger('click');
    }
    
    return false;
});

$(document).on('click','.colored_table', function (e) {
    _this = $(e.target);
    _table = $(_this.closest('table'));
    if(_table.hasClass("colored_table")){
       _tbody = $(_table[0].children[1])
       if(_tbody[0].style.display == "none"){
           _tbody[0].style.display = 'block';
       }else{
           _tbody[0].style.display = 'none';
       }
    }
});

let to_cart = function(e){
    e.preventDefault();
    var th=$(this);
    if(!th.hasClass('clicked'))
    {
        th.addClass('clicked');
        var val = $(this).attr('data-quantity');
        var tmp_props=$(this).data("props"),
            props='',
            part_props='',
            add_props='N',
            fill_prop={},
            iblockid = $(this).data('iblockid'),
            offer = $(this).data('offers'),
            rid='',
            bBannerAction = false,
            basket_props='',
            item = $(this).attr('data-item');
        if(th.closest('.but-cell').length)
        {
            if($('.counter_block[data-item="'+item+'"]').length)
                val = $('.counter_block[data-item="'+item+'"] input').val();
        }

        if(th.closest('.banner_buttons.with_actions').length) //banner action
        {
            var wrapper_btns = th.closest('.wraps_buttons');
            item = wrapper_btns.data('id');
            bBannerAction = true;
        }

        if(!val)
            val = 1;
        if(offer!="Y"){
            offer = "N";
        }else{
            basket_props=$(this).closest('.prices_tab').find('.bx_sku_props input').val();
        }
        if(tmp_props){
            props=tmp_props.split(";");
        }
        if($(this).data("part_props")){
            part_props=$(this).data("part_props");
        }
        if($(this).data("add_props")){
            add_props=$(this).data("add_props");
        }
        if($('.rid_item').length){
            rid=$('.rid_item').data('rid');
        }else if($(this).data('rid')){
            rid=$(this).data('rid');
        }

        fill_prop=fillBasketPropsExt(th, 'prop', th.data('bakset_div'));

        fill_prop.quantity=val;
        fill_prop.add_item='Y';
        fill_prop.rid=rid;
        fill_prop.offers=offer;
        fill_prop.iblockID=iblockid;
        fill_prop.part_props=part_props;
        fill_prop.add_props=add_props;
        fill_prop.props=JSON.stringify(props);
        fill_prop.item=item;
        fill_prop.basket_props=basket_props;
        fill_prop.parent=$(this).data('parent');

        if(bBannerAction)
        {

            if(th.hasClass('added'))
            {
                location.href = th.data('href');
                return false;
            }
            else
            {
                th.attr('title', th.data('title2'))
                th.toggleClass('added');
            }

            if(wrapper_btns.find('.wish_item_add').length)
                wrapper_btns.find('.wish_item_add').removeClass('added');
        }

        if(th.data("empty_props")=="N"/* &amp;&amp; fill_prop.part_props != 'Y'*/){
            var basket_popup_html = $("#"+th.data("bakset_div")).html();
            if(!basket_popup_html &amp;&amp; th.closest('.item').find('.basket_props_block').length)
                basket_popup_html = th.closest('.item').find('.basket_props_block').html();

            showBasketError(basket_popup_html, BX.message("ERROR_BASKET_PROP_TITLE"), "Y", th);
            BX.addCustomEvent('onCompleteAction', function(e){
                if(!e.ignoreSelf){
                    var eventdata = {action:'loadForm', ignoreSelf: true};
                    BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
                }
            });

        }else{
            let $test = "test";
            $.ajax({
                type:"POST",
                url:arAsproOptions['SITE_DIR']+"ajax/item.php",
                data:fill_prop,
                dataType:"json",
                success:function(data){
                    getActualBasket(fill_prop.iblockID);

                    var eventdata = {action:'loadForm'};
                    BX.onCustomEvent('onCompleteAction', [eventdata, th[0]]);
                    arStatusBasketAspro = {};

                    if(data !==null){
                        if("STATUS" in data){
                            if(data.MESSAGE_EXT===null)
                                data.MESSAGE_EXT='';
                            if(data.STATUS === 'OK'){
                                // th.hide();
                                $('.to-cart[data-item='+item+']').hide();
                                $('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block_inner').hide();
                                $('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block').hide();
                                $('.to-cart[data-item='+item+']').parents('tr').find('.counter_block_wr .counter_block').hide();
                                $('.to-cart[data-item='+item+']').closest('.button_block').addClass('wide');
                                // th.parent().find('.in-cart').show();
                                $('.in-cart[data-item='+item+']').show();

                                addBasketCounter(item);
                                //$('.wish_item[data-item='+item+']').removeClass("added");
                                $('.wish_item[data-item='+item+']').find(".value").show();
                                $('.wish_item[data-item='+item+']').find(".value.added").hide();
                                $('.wish_item.to[data-item='+item+']').show();
                                $('.wish_item.in[data-item='+item+']').hide();

                                if($("#ajax_basket").length)
                                    reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');

                                if($("#basket_line .basket_fly").length){
                                    if(th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches  || $("#basket_line .basket_fly.loaded").length)
                                        basketFly('open', 'N');
                                    else
                                        basketFly('open');
                                }

                                if($(".top_basket").length){
                                    let postData = {id:th.data("item"), response:"bool"};
                                    let postData2 = {id:th.data("item"), response:"rules"};
                                    $.post( arAsproOptions['SITE_DIR']+"ajax/complectation.php", postData2,(result)=&gt;{
                                        console.log(JSON.parse(result));
                                    });
                                    $.post( arAsproOptions['SITE_DIR']+"ajax/complectation.php", postData,(result)=&gt;{
                                        if (result === "true" &amp;&amp; false){
                                            basketPopup('open', $(".popup_basket"), e);
                                        }else{
                                            basketTop('open', $(".top_basket").find('.basket_hover_block'));
                                        }
                                    });
                                }

                                if ($('#headerfixed .wproducts .ajax_load .btn').length &amp;&amp; th.next('.in-cart').length) {
                                    var buttonHtml = '&lt;span class="buy_block"&gt;&lt;span class="btn btn-default btn-sm slide_offer more type_block"&gt;'+th.next('.in-cart').html() +'&lt;/span&gt;&lt;/span&gt;';
                                    $('#headerfixed .wproducts .ajax_load .item-buttons .but-cell').html(buttonHtml)
                                }
                            }else{
                                showBasketError(BX.message(data.MESSAGE)+' &lt;br/&gt;'+data.MESSAGE_EXT);
                            }
                        }else{
                            showBasketError(BX.message("CATALOG_PARTIAL_BASKET_PROPERTIES_ERROR"));
                        }
                    }else{
                        // th.hide();
                        $('.to-cart[data-item='+item+']').hide();
                        $('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block_inner').hide();
                        $('.to-cart[data-item='+item+']').closest('.counter_wrapp').find('.counter_block').hide();
                        $('.to-cart[data-item='+item+']').parents('tr').find('.counter_block_wr .counter_block').hide();
                        $('.to-cart[data-item='+item+']').closest('.button_block').addClass('wide');
                        // th.parent().find('.in-cart').show();
                        $('.in-cart[data-item='+item+']').show();

                        addBasketCounter(item);
                        //$('.wish_item[data-item='+item+']').removeClass("added");
                        $('.wish_item[data-item='+item+']').find(".value").show();
                        $('.wish_item[data-item='+item+']').find(".value.added").hide();

                        if($("#ajax_basket").length){
                            reloadTopBasket('add', $('#ajax_basket'), 200, 5000, 'Y');
                        }


                        if($("#basket_line .basket_fly").length)
                        {
                            if(th.closest('.fast_view_frame').length || window.matchMedia('(max-width: 767px)').matches  || $("#basket_line .basket_fly.loaded").length)
                                basketFly('open', 'N');
                            else
                                basketFly('open');
                        }
                    }
                }
            });
        }
    }
}
$(document).on( 'click', '.to-cart:not(.read_more), .basket_item_add', to_cart)
function basketPopup(operation,$container,event) {
    let eTarget = $(event.target);
    if (!eTarget.hasClass('to-cart')){
        eTarget = $(eTarget.closest(".to-cart"));
    }
    let title = $(eTarget.closest(".catalog_item").find(".item-title a"));

    var postData = {
        PARAMS:{
            ITEM_ID:eTarget.data("item"),
            ITEM_URL:title[0].href,
        }
    }

    $.post( arAsproOptions['SITE_DIR']+"ajax/show_basket_popup.php", postData, $.proxy(( data )=&gt;{
        let overlay = $(".popup_basket_overlay");
        overlay[0].style.display="flex";
        $(overlay.find("#basket_preload")).remove();
        let $data = $(data);
        let $closeBtn = $($data.find(".popup_basket_close"));
        let $continueBtn = $($data.find(".continue"));

        $closeBtn.bind("click",()=&gt;{
            closeBasketPopup();
        });

        $continueBtn.bind("click",()=&gt;{
            closeBasketPopup();
        });

        let $input = $($data.find(".main-popup-section .count_input"));
        let $inputPlus = $($data.find(".main-popup-section .plus"));
        let $inputMinus = $($data.find(".main-popup-section .minus"));
        
        $input.bind("change",(event)=&gt;{
            updateBasketFromPopup(event,"input");
        });

        $inputPlus.bind("click",(event)=&gt;{
            updateBasketFromPopup(event, 'plus');
        });

        $inputMinus.bind("click",(event)=&gt;{
            updateBasketFromPopup(event,'minus');
        });

        $data.find(".to-cart:not(.read_more), .basket_item_add").bind("click", to_cart);
        $data.find(".list-popup-section .plus").bind("click", (e)=&gt;{
            let input = $(e.target).closest(".counter_block").find("input");
            input.val(Number(input.val())+1);
            input.change();
        });
        $data.find(".list-popup-section .minus").bind("click", (e)=&gt;{
            let input = $(e.target).closest(".counter_block").find("input");
            input.val(input.val()-1);
            input.change();
        });
        
        $(overlay.find(".popup_basket")).append($data);
    }));
}

function updateBasketFromPopup(event, type= "input") {
    let id;
    let quantity;
    let input;
    switch (type) {
        case "plus":{
            input = $($(event.target).closest('.input-group').find('.count_input'));
            input.val(Number(input.val())+1);
            id = input.data('item');
            quantity = input.val();
            break;
        }
        case "minus":{
            input = $($(event.target).closest('.input-group').find('.count_input'));
            input.val(Number(input.val())-1);
            id = input.data('item');
            quantity = input.val();
            break;
        }
        case "input":{
            input = $(event.target);
            id = input.data('item');
            quantity = input.val();
            break;
        }
    }

    if(quantity &lt; 1){
        quantity = 1;
        input.val(1);
    }

    var postData = {
        ITEM_ID:id,
        ITEM_QUANTITY:quantity,
    }

    $.post( arAsproOptions['SITE_DIR']+"ajax/quantity_update.php", postData, $.proxy(( data )=&gt;{
        let totalPriceSpan = $($(event.target).closest('.container').find('.total_price_basket'));
        totalPriceSpan.html(data+" Ñ€ÑƒÐ±.");
    }));
}

function closeBasketPopup(){
    let overlay = $(".popup_basket_overlay");
    overlay[0].style.display="none";
}

function cartResize(){
    let items = $(".catalog_block.items .item");
    if (items[0] !== undefined){
        if (window.innerWidth &gt; 1980){
            var col_count = 4;
        }else{
            if (window.innerWidth &gt; 1200){
                var col_count = 4;
            }else {
                if (window.innerWidth &gt; 990){
                    var col_count = 3;
                }else {
                    var col_count = 2;
                }
            }
        }
        if(col_count&gt;items.length){
            col_count = items.length;
        }
        
        let i = 0;
        let j = 0;
        let stack = [];
        let max_height = 0;
        while (items[i] !== undefined){
            let element = items[i];
            i++;
            j++;
            if (j === col_count){
                let item_info = $($(element).find(".item_info"));
                if (item_info[0] !== undefined &amp;&amp; item_info.outerHeight() &gt; max_height){
                    max_height = item_info.outerHeight();
                }
                stack.push(element);
                stack.forEach( (st_element) =&gt; {
                    let st_item_info = $($(st_element).find(".item_info"));
                    if(st_item_info[0] !== undefined){
                        st_item_info.css({minHeight:max_height});
                    }
                })
                j=0;
            }else {
                let item_info = $($(element).find(".item_info"));
                if (item_info[0] !== undefined &amp;&amp; item_info.outerHeight() &gt; max_height){
                    max_height = item_info.outerHeight();
                }
                stack.push(element)
            }
        }
        if (stack.length &gt; 0){
            stack.forEach( (st_element) =&gt; {
                let st_item_info = $($(st_element).find(".item_info"));
                if(st_item_info[0] !== undefined){
                    st_item_info.css({minHeight:max_height});
                }
            })
        }
    }
}
$(document).ready(()=&gt;{
    // cartResize();
    $(".expSectionAcordionBtn").bind("click",function (e) {
        let $target = $(e.target);
        let $acordion = $("#expSection__"+$target.attr('data-section'));
        if ($acordion.hasClass('hide'))
        {
            $acordion.removeClass("hide");
            $target.text('ÑÐºÑ€Ñ‹Ñ‚ÑŒ');
        }else{
            $acordion.addClass("hide");
            $target.text('Ð¿Ð¾ÐºÐ°Ð·Ð°Ñ‚ÑŒ Ð²ÑÐµ Ñ‚Ð¾Ð²Ð°Ñ€Ñ‹');
        }
    });

    setTimeout(()=&gt;{
        const closeRegionalityButtons = document.querySelectorAll('.region_wrapper .confirm_region .close'),
              regionalityPopup = document.querySelector('#header .region_wrapper .confirm_region');

        if (regionalityPopup) {
            regionalityPopup.classList.add('active')
        }
        
        if (closeRegionalityButtons) {
            closeRegionalityButtons.forEach(element =&gt; element.addEventListener('click', closeRegionality))
        }
        $('.confirm_region .aprove').on('click', function(e){
            var _this = $(this);
            $.removeCookie('current_region');
            $.cookie('current_region', _this.data('id'), {path: '/',domain: arMaxOptions['SITE_ADDRESS']});
            $('.confirm_region').remove();
            if(typeof _this.data('href') !== 'undefined')
                location.href = _this.data('href');
        })
        $('.js_city_change').on('click', function(){
            var _this = $(this);
            _this.closest('.region_wrapper').find('.js_city_chooser').trigger('click');
            if(_this.closest('.top_mobile_region').length)
            {
                $('.burger').click();
    
                $('.mobile_regions &gt; ul &gt; li &gt; a').click()
            }
            $('.confirm_region').remove();
        })
        $('.js_city_chooser').on('click', function(){
            var _this = $(this);
            $('.confirm_region').remove();
        })
    },3000)

    var lastPageYOffset,
        currPosition = 0,
        delta = 20;

    const url = new URL(location.href),
          basketTopButton = document.querySelector('.bx-soa-order-header .basket-top-btn'),
          basketHoverBlock = document.querySelector('.basket_hover_block--custom');

    $(".popup_basket_close").bind("click", closeBasketPopup)

    $(".popup_basket_overlay").bind("click",(event) =&gt; (event.target.classList.contains("popup_basket_overlay")) ? closeBasketPopup() : false)

    setInterval(()=&gt;{
        /* filter show more */ 
        $(".filter_show_more").unbind("click");
        $(".filter_show_more").on('click',function (e) {
            let target = $(".bx_filter_parameters .hidden_wrap");
            if(target.hasClass("close")){
                target.addClass("open");
                target.removeClass("close");
                $(e.target)[0].innerText = "ÑÐºÑ€Ñ‹Ñ‚ÑŒ"
            }else{
                target.addClass("close");
                target.removeClass("open");
                $(e.target)[0].innerText = "Ð²ÑÐµ Ñ…Ð°Ñ€Ð°ÐºÑ‚ÐµÑ€Ð¸ÑÑ‚Ð¸ÐºÐ¸"
            }
            window['stickySidebar'].updateSticky();
        });
        /* end filter show more */ 
    },1000)

    setInterval(()=&gt;{
        if($('div').is(".stores-list1")){
            let shops_list = $(".stores-list1");
            let shops_height = shops_list[0].offsetHeight;
            if (shops_height &lt; 600){
                shops_list[0].style.overflowY = 'hidden';
            }else{
                shops_list[0].style.overflowY = 'scroll';
            }
        }
    },2000);

    if ($('div').is(".sidebar_menu")){
        $(window).scroll((e)=&gt;{
            let curTgt = e.currentTarget.pageYOffset;
            let container = $('#mCSB_1_container');
            let wrapper = $(container.closest(".menu-wrapper"));
            let max_offset_top = container.height()- wrapper.height();
            if(lastPageYOffset !== undefined){
                if(lastPageYOffset &lt; curTgt){
                    if(currPosition &gt; -max_offset_top){
                        currPosition -= delta;
                        container[0].style.top = currPosition+"px";
                    }
                }else{
                    if(currPosition &lt; 0){
                        currPosition += delta;
                        container[0].style.top = currPosition+"px";
                    }
                }
            }
            lastPageYOffset = curTgt;
        })
    }

    window.changePageTitle = changePageTitle;
    window.changeBrowserTitle = changeBrowserTitle;
    window.addEventListener("hashchange", hashChangeHandler);
    if (window.stickySidebar) {
        window.stickySidebar.updateSticky();
    }

    if (url.hash === '#delayed') {
        changePageTitle('ÐžÑ‚Ð»Ð¾Ð¶ÐµÐ½Ð½Ð¾Ðµ')
        changeBrowserTitle('ÐžÑ‚Ð»Ð¾Ð¶ÐµÐ½Ð½Ð¾Ðµ')
    }

    if (basketTopButton) {
        basketTopButton.addEventListener('click', basketTopButtonHandler)
        window.addEventListener('scroll', (event) =&gt; {
            if (pageYOffset &gt; 120 &amp;&amp; basketHoverBlock.classList.contains('loaded')) {
                basketOrder('close', $(basketHoverBlock) );
                basketTopButton.classList.remove('open');
            }
        })
    }

    // Ð£Ð²ÐµÐ»ÐµÑ‡ÐµÐ½Ð¸Ðµ ÐºÐ°Ñ€Ñ‚Ð¸Ð½Ð¾Ðº Ð¿Ð¾ url contacts/stores/
    const storesList = document.querySelector('.stores-list-custom');

    if (storesList)
        storesList.addEventListener('click', event =&gt; gallery.imageViewHandler({event}))

	const gallery = {
		getImages: ({curentImage}) =&gt; curentImage.parentNode.children,

		getImagesArrayAndIndex: function({curentImage}) {
			const images = this.getImages({curentImage});
			let imagesTemplate = [],
				imageIndex = 0;
			
			Array.from(images).forEach((image, index) =&gt; {
				imagesTemplate.push({
					src: image.src,
					type: "image",
				})
				if (image.isSameNode(curentImage)) {
					imageIndex = index
				}
			})
			return {imagesTemplate, imageIndex}
		},

		imageViewHandler: async function({event}) {
			if (event.target.tagName === 'IMG') {
				BX.loadCSS('/local/templates/simpleIT/css/fancyapp/fancyapp.css')
				BX.loadCSS('/local/templates/simpleIT/css/fancyapp/fancyapp.custom.css')
				const curentImage = event.target,
					{ imagesTemplate, imageIndex } = this.getImagesArrayAndIndex({curentImage}),
					{ Fancybox } = await import("/local/templates/simpleIT/js/fancyapp/fancyapp.esm.js");

				Fancybox.show(imagesTemplate, {
					infinite: false,
					startIndex: imageIndex,
				});
			}
		},
	}
});


document.querySelectorAll("a").forEach((el)=&gt;{
    el.addEventListener("click",(event)=&gt;{
        if( event.currentTarget.href.includes("tel:") ||  event.currentTarget.href.includes("mailto:") ) {
            let eventdata_global_alt = {goal: "znachimie_deistviya"};
            BX.onCustomEvent('onCounterGoals', [eventdata_global_alt]);
        }
    });
});

window.addEventListener("load", ()=&gt;{
    let liveChataBtn = document.querySelector("a[data-b24-crm-button-widget='openline_livechat']");
    let liveChataVkBtn = document.querySelector("a[data-b24-crm-button-widget='openline_vkgroup']");
    // let liveChataInstBtn = document.querySelector("a[data-b24-crm-button-widget='openline_fbinstagramdirect']");
    // let liveChataFaceBookBtn = document.querySelector("a[data-b24-crm-button-widget='openline_facebook']");

    let ttlGoal = () =&gt; {
        let eventdata_global_alt = {goal: "znachimie_deistviya"};
        BX.onCustomEvent('onCounterGoals', [eventdata_global_alt]);
    }
    
    liveChataBtn?.addEventListener("click",ttlGoal);
    liveChataVkBtn?.addEventListener("click",ttlGoal);
    // liveChataInstBtn.addEventListener("click",ttlGoal);
    // liveChataFaceBookBtn.addEventListener("click",ttlGoal);
})

/* End */
;; /* /local/templates/aspro_max/js/observer.js?17119485506712*/
; /* /local/templates/aspro_max/js/jquery.actual.min.js?17119485501238*/
; /* /local/templates/aspro_max/vendor/js/jquery.bxslider.js?171141775966080*/
; /* /local/templates/aspro_max/js/jqModal.min.js?17114177462838*/
; /* /local/templates/aspro_max/vendor/js/bootstrap.js?171141775727908*/
; /* /local/templates/aspro_max/vendor/js/jquery.appear.js?17114177573188*/
; /* /local/templates/aspro_max/vendor/js/ripple.min.js?17114177571624*/
; /* /local/templates/aspro_max/vendor/js/velocity/velocity.js?171141775644791*/
; /* /local/templates/aspro_max/vendor/js/velocity/velocity.ui.js?171141775613257*/
; /* /local/templates/aspro_max/vendor/js/jquery.menu-aim.min.js?17114177571533*/
; /* /local/templates/aspro_max/js/browser.js?1711948550996*/
; /* /local/templates/aspro_max/js/jquery.fancybox.js?1711417750160667*/
; /* /local/templates/aspro_max/js/jquery.flexslider.min.js?171141774823454*/
; /* /local/templates/aspro_max/js/jquery.uniform.min.js?17114177498308*/
; /* /local/templates/aspro_max/vendor/js/carousel/owl/owl.carousel.min.js?171141775744743*/
; /* /local/templates/aspro_max/vendor/js/moment.min.js?171141775734436*/
; /* /local/templates/aspro_max/vendor/js/footable.js?1711948550268108*/
; /* /local/templates/aspro_max/vendor/js/ResizeSensor.js?171141775711190*/
; /* /local/templates/aspro_max/vendor/js/sticky-sidebar.min.js?171141775711546*/
; /* /local/templates/aspro_max/js/jquery.validate.min.js?171194855022254*/
; /* /local/templates/aspro_max/js/aspro_animate_open_fancy.js?17119485501865*/
; /* /local/templates/aspro_max/js/jquery.inputmask.bundle.min.js?171141774770933*/
; /* /local/templates/aspro_max/js/jquery.easing.1.3.min.js?17114177503338*/
; /* /local/templates/aspro_max/js/equalize.min.js?1711417746588*/
; /* /local/templates/aspro_max/js/jquery.alphanumeric.js?17119485501901*/
; /* /local/templates/aspro_max/js/jquery.cookie.min.js?17114177483066*/
; /* /local/templates/aspro_max/js/jquery.plugin.min.js?17119485503178*/
; /* /local/templates/aspro_max/js/jquery.countdown.min.js?171141774813137*/
; /* /local/templates/aspro_max/js/jquery.countdown-ru.js?17119485501866*/
; /* /local/templates/aspro_max/js/jquery.ikSelect.min.js?171141774817725*/
; /* /local/templates/aspro_max/js/jquery.mobile.custom.touch.min.js?17114177507784*/
; /* /local/templates/aspro_max/js/jquery.dotdotdot.min.js?17114177495908*/
; /* /local/templates/aspro_max/js/rating_likes.js?171141774910797*/
; /* /local/templates/aspro_max/js/mobile.js?171194855024651*/
; /* /local/templates/aspro_max/js/jquery.mousewheel.min.js?17114177492609*/
; /* /local/templates/aspro_max/js/jquery.mCustomScrollbar.min.js?171141774642965*/
; /* /local/templates/aspro_max/js/scrollTabs.js?171194855012271*/
; /* /local/templates/aspro_max/js/main.js?1711417745305133*/
; /* /local/templates/aspro_max/js/blocks/blocks.js?17119485507806*/
; /* /bitrix/components/bitrix/search.title/script.js?17113910979847*/
; /* /local/templates/aspro_max/components/bitrix/search.title/mega_menu/script.js?171141792410313*/
; /* /local/templates/aspro_max/components/bitrix/menu/menu_in_burger/script.js?1711948550201*/
; /* /local/components/arturgolubev/search.title/script.js?17114176279674*/
; /* /local/templates/aspro_max/components/arturgolubev/search.title/corp__custom/script.js?171141776210607*/
; /* /local/templates/aspro_max/components/bitrix/menu/top_flexible_dropdown_mk1/script.js?17119485503321*/
; /* /bitrix/components/aspro/marketing.popup.max/templates/.default/script.js?17113913371756*/
; /* /local/templates/aspro_max/components/bitrix/search.title/fixed/script.min.js?17114179236439*/
; /* /local/templates/aspro_max/js/custom.js?171141774927503*/
</pre></body></html>