PageSourceSearch

https://www.ati.tn/wp-content/plugins/salient-nectar-slider/js/nectar-slider.js?ver=1.7.3

js ati.tn collected 2026-09-24 18:23:33 UTC 219,619 bytes, 5,728 lines download raw bytes

1/* global anime */
2
3/*
4 * http://www.idangero.us/sliders/swiper/
5 *
6 * Copyright 2012-2013, Vladimir Kharlampidi
7 * The iDangero.us
8 * http://www.idangero.us/
9 *
10 * Licensed under GPL & MIT
11*/
12
13if(!jQuery().nectarswiper) {
14
15var NectarSwiper = function (selector, params) {
16    if (document.body.__defineGetter__) {
17        
18        var testOuterHTML = document.querySelector('div');
19      
20        if( typeof testOuterHTML.outerHTML === "undefined" ) {
21
22          if (HTMLElement) {
23              var element = HTMLElement.prototype;
24              if (element.__defineGetter__) {
25                  element.__defineGetter__("outerHTML", function () { return new XMLSerializer().serializeToString(this); } );
26              }
27          }
28          
29      }
30      
31    }
32
33    if (!window.getComputedStyle) {
34        window.getComputedStyle = function (el, pseudo) {
35            this.el = el;
36            this.getPropertyValue = function (prop) {
37                var re = /(\-([a-z]){1})/g;
38                if (prop === 'float') prop = 'styleFloat';
39                if (re.test(prop)) {
40                    prop = prop.replace(re, function () {
41                        return arguments[2].toUpperCase();
42                    });
43                }
44                return el.currentStyle[prop] ? el.currentStyle[prop] : null;
45            };
46            return this;
47        };
48    }
49    if (!Array.prototype.indexOf) {
50        Array.prototype.indexOf = function(obj, start) {
51            for (var i = (start || 0), j = this.length; i < j; i++) {
52                if (this[i] === obj) { return i; }
53            }
54            return -1;
55        };
56    }
57    if (!document.querySelectorAll) {
58        if (!window.jQuery) return;
59    }
60    function $$(selector, context) {
61        if (document.querySelectorAll)
62            return (context || document).querySelectorAll(selector);
63        else
64            return jQuery(selector, context);
65    }
66
67    /*=========================
68      Check for correct selector
69      ===========================*/
70    if(typeof selector === 'undefined') return;
71
72    if(!(selector.nodeType)){
73        if ($$(selector).length === 0) return;
74    }
75
76     /*=========================
77      _this
78      ===========================*/
79    var _this = this;
80
81     /*=========================
82      Default Flags and vars
83      ===========================*/
84    _this.touches = {
85        start:0,
86        startX:0,
87        startY:0,
88        current:0,
89        currentX:0,
90        currentY:0,
91        diff:0,
92        abs:0
93    };
94    _this.positions = {
95        start:0,
96        abs:0,
97        diff:0,
98        current:0
99    };
100    _this.times = {
101        start:0,
102        end:0
103    };
104
105    _this.id = (new Date()).getTime();
106    _this.container = (selector.nodeType) ? selector : $$(selector)[0];
107    _this.isTouched = false;
108    _this.isMoved = false;
109    _this.activeIndex = 0;
110    _this.activeLoaderIndex = 0;
111    _this.activeLoopIndex = 0;
112    _this.previousIndex = null;
113    _this.velocity = 0;
114    _this.snapGrid = [];
115    _this.slidesGrid = [];
116    _this.imagesToLoad = [];
117    _this.imagesLoaded = 0;
118    _this.wrapperLeft=0;
119    _this.wrapperRight=0;
120    _this.wrapperTop=0;
121    _this.wrapperBottom=0;
122    var wrapper, slideSize, wrapperSize, direction, isScrolling, containerSize;
123
124    /*=========================
125      Default Parameters
126      ===========================*/
127    var defaults = {
128        mode : 'horizontal', // or 'vertical'
129        touchRatio : 1,
130        speed : 300,
131        freeMode : false,
132        freeModeFluid : false,
133        momentumRatio: 1,
134        momentumBounce: true,
135        momentumBounceRatio: 1,
136        slidesPerView : 1,
137        slidesPerGroup : 1,
138        simulateTouch : true,
139        followFinger : true,
140        shortSwipes : true,
141        moveStartThreshold:false,
142        autoplay: false,
143        onlyExternal : false,
144        createPagination : true,
145        pagination : false,
146        paginationElement: 'span',
147        paginationClickable: false,
148        paginationAsRange: true,
149        resistance : true, // or false or 100%
150        scrollContainer : false,
151        preventLinks : true,
152        noSwiping : false, // or class
153        noSwipingClass : 'swiper-no-swiping', //:)
154        initialSlide: 0,
155        keyboardControl: false,
156        mousewheelControl : false,
157        mousewheelDebounce: 600,
158        useCSS3Transforms : true,
159        //Loop mode
160        loop:false,
161        loopAdditionalSlides:0,
162        //Auto Height
163        calculateHeight: false,
164        //Images Preloader
165        updateOnImagesReady : true,
166        //Form elements
167        releaseFormElements : true,
168        //Watch for active slide, useful when use effects on different slide states
169        watchActiveIndex: false,
170        //Slides Visibility Fit
171        visibilityFullFit : false,
172        //Slides Offset
173        offsetPxBefore : 0,
174        offsetPxAfter : 0,
175        offsetSlidesBefore : 0,
176        offsetSlidesAfter : 0,
177        centeredSlides: false,
178        //Queue callbacks
179        queueStartCallbacks : false,
180        queueEndCallbacks : false,
181        //Auto Resize
182        autoResize : true,
183        resizeReInit : false,
184        //DOMAnimation
185        DOMAnimation : true,
186        //Slides Loader
187        loader: {
188            slides:[], //array with slides
189            slidesHTMLType:'inner', // or 'outer'
190            surroundGroups: 1, //keep preloaded slides groups around view
191            logic: 'reload', //or 'change'
192            loadAllSlides: false
193        },
194        //Namespace
195        slideElement : 'div',
196        slideClass : 'swiper-slide',
197        slideActiveClass : 'swiper-slide-active',
198        slideVisibleClass : 'swiper-slide-visible',
199        wrapperClass : 'swiper-wrapper',
200        paginationElementClass: 'swiper-pagination-switch',
201        /*nectar addition*/
202        paginationActiveClass : 'swiper-active-switch ar-vis',
203        /*nectar addition end*/
204        paginationVisibleClass : 'swiper-visible-switch'
205    };
206    params = params || {};
207    for (var prop in defaults) {
208        if (prop in params && typeof params[prop]==='object') {
209            for (var subProp in defaults[prop]) {
210                if (! (subProp in params[prop])) {
211                    params[prop][subProp] = defaults[prop][subProp];
212                }
213            }
214        }
215        else if (! (prop in params)) {
216            params[prop] = defaults[prop];
217        }
218    }
219    _this.params = params;
220    if (params.scrollContainer) {
221        params.freeMode = true;
222        params.freeModeFluid = true;
223    }
224    if (params.loop) {
225        params.resistance = '100%';
226    }
227    var isH = params.mode==='horizontal';
228
229    /*=========================
230      Define Touch Events
231      ===========================*/
232
233    _this.touchEvents = {
234        touchStart : _this.support.touch || !params.simulateTouch  ? 'touchstart' : (_this.browser.ie10 ? 'MSPointerDown' : 'mousedown'),
235        touchMove : _this.support.touch || !params.simulateTouch ? 'touchmove' : (_this.browser.ie10 ? 'MSPointerMove' : 'mousemove'),
236        touchEnd : _this.support.touch || !params.simulateTouch ? 'touchend' : (_this.browser.ie10 ? 'MSPointerUp' : 'mouseup')
237    };
238
239    /*=========================
240      Wrapper
241      ===========================*/
242    for (var i = _this.container.childNodes.length - 1; i >= 0; i--) {
243        if (_this.container.childNodes[i].className) {
244            var _wrapperClasses = _this.container.childNodes[i].className.split(/\s+/);
245            for (var j = 0; j < _wrapperClasses.length; j++) {
246                if (_wrapperClasses[j] === params.wrapperClass) {
247                    wrapper = _this.container.childNodes[i];
248                }
249            }
250        }
251    }
252
253    _this.wrapper = wrapper;
254    /*=========================
255      Slide API
256      ===========================*/
257    _this._extendSwiperSlide = function  (el) {
258        el.append = function () {
259            if (params.loop) {
260                el.insertAfter(_this.slides.length-_this.loopedSlides);
261                _this.removeLoopedSlides();
262                _this.calcSlides();
263                _this.createLoop();
264            }
265            else {
266                _this.wrapper.appendChild(el);
267            }
268
269            _this.reInit();
270            return el;
271        };
272        el.prepend = function () {
273            if (params.loop) {
274                _this.wrapper.insertBefore(el, _this.slides[_this.loopedSlides]);
275                _this.removeLoopedSlides();
276                _this.calcSlides();
277                _this.createLoop();
278            }
279            else {
280                _this.wrapper.insertBefore(el, _this.wrapper.firstChild);
281            }
282            _this.reInit();
283            return el;
284        };
285        el.insertAfter = function (index) {
286            if(typeof index === 'undefined') return false;
287            var beforeSlide;
288
289            if (params.loop) {
290                beforeSlide = _this.slides[index + 1 + _this.loopedSlides];
291                _this.wrapper.insertBefore(el, beforeSlide);
292                _this.removeLoopedSlides();
293                _this.calcSlides();
294                _this.createLoop();
295            }
296            else {
297                beforeSlide = _this.slides[index + 1];
298                _this.wrapper.insertBefore(el, beforeSlide);
299            }
300            _this.reInit();
301            return el;
302        };
303        el.clone = function () {
304            return _this._extendSwiperSlide(el.cloneNode(true));
305        };
306        el.remove = function () {
307            _this.wrapper.removeChild(el);
308            _this.reInit();
309        };
310        el.html = function (html) {
311            if (typeof html === 'undefined') {
312                return el.innerHTML;
313            }
314            else {
315                el.innerHTML = html;
316                return el;
317            }
318        };
319        el.index = function () {
320            var index;
321            for (var i = _this.slides.length - 1; i >= 0; i--) {
322                if(el === _this.slides[i]) index = i;
323            }
324            return index;
325        };
326        el.isActive = function () {
327            if (el.index() === _this.activeIndex) { return true; }
328            else return false;
329        };
330        if (!el.swiperSlideDataStorage) el.swiperSlideDataStorage={};
331        el.getData = function (name) {
332            return el.swiperSlideDataStorage[name];
333        };
334        el.setData = function (name, value) {
335            el.swiperSlideDataStorage[name] = value;
336            return el;
337        };
338        el.data = function (name, value) {
339            if (!value) {
340                return el.getAttribute('data-'+name);
341            }
342            else {
343                el.setAttribute('data-'+name,value);
344                return el;
345            }
346        };
347        el.getWidth = function (outer) {
348            return _this.h.getWidth(el, outer);
349        };
350        el.getHeight = function (outer) {
351            return _this.h.getHeight(el, outer);
352        };
353        el.getOffset = function() {
354            return _this.h.getOffset(el);
355        };
356        return el;
357    };
358
359    //Calculate information about number of slides
360    _this.calcSlides = function (forceCalcSlides) {
361        var oldNumber = _this.slides ? _this.slides.length : false;
362        _this.slides = [];
363        _this.displaySlides = [];
364        for (var i = 0; i < _this.wrapper.childNodes.length; i++) {
365            if (_this.wrapper.childNodes[i].className) {
366                var _className = _this.wrapper.childNodes[i].className;
367                var _slideClasses = _className.split(' ');
368                for (var j = 0; j < _slideClasses.length; j++) {
369                    if(_slideClasses[j]===params.slideClass) {
370                        _this.slides.push(_this.wrapper.childNodes[i]);
371                    }
372                }
373            }
374        }
375        for (i = _this.slides.length - 1; i >= 0; i--) {
376            _this._extendSwiperSlide(_this.slides[i]);
377        }
378        if (!oldNumber) return;
379        if(oldNumber!==_this.slides.length || forceCalcSlides) {
380            // Number of slides has been changed
381            removeSlideEvents();
382            addSlideEvents();
383            _this.updateActiveSlide();
384            if (params.createPagination && _this.params.pagination) _this.createPagination();
385            _this.callPlugins('numberOfSlidesChanged');
386        }
387    };
388
389    //Create Slide
390    _this.createSlide = function (html, slideClassList, el) {
391        var slideClassList = slideClassList || _this.params.slideClass;
392        var el = el||params.slideElement;
393        var newSlide = document.createElement(el);
394        newSlide.innerHTML = html||'';
395        newSlide.className = slideClassList;
396        return _this._extendSwiperSlide(newSlide);
397    };
398
399    //Append Slide
400    _this.appendSlide = function (html, slideClassList, el) {
401        if (!html) return;
402        if (html.nodeType) {
403            return _this._extendSwiperSlide(html).append();
404        }
405        else {
406            return _this.createSlide(html, slideClassList, el).append();
407        }
408    };
409    _this.prependSlide = function (html, slideClassList, el) {
410        if (!html) return;
411        if (html.nodeType) {
412            return _this._extendSwiperSlide(html).prepend();
413        }
414        else {
415            return _this.createSlide(html, slideClassList, el).prepend();
416        }
417    };
418    _this.insertSlideAfter = function (index, html, slideClassList, el) {
419        if (typeof index === 'undefined') return false;
420        if (html.nodeType) {
421            return _this._extendSwiperSlide(html).insertAfter(index);
422        }
423        else {
424            return _this.createSlide(html, slideClassList, el).insertAfter(index);
425        }
426    };
427    _this.removeSlide = function (index) {
428        if (_this.slides[index]) {
429            if (params.loop) {
430                if (!_this.slides[index+_this.loopedSlides]) return false;
431                _this.slides[index+_this.loopedSlides].remove();
432                _this.removeLoopedSlides();
433                _this.calcSlides();
434                _this.createLoop();
435            }
436            else _this.slides[index].remove();
437            return true;
438        }
439        else return false;
440    };
441    _this.removeLastSlide = function () {
442        if (_this.slides.length>0) {
443            if (params.loop) {
444                _this.slides[_this.slides.length - 1 - _this.loopedSlides].remove();
445                _this.removeLoopedSlides();
446                _this.calcSlides();
447                _this.createLoop();
448            }
449            else _this.slides[ (_this.slides.length-1) ].remove();
450            return true;
451        }
452        else {
453            return false;
454        }
455    };
456    _this.removeAllSlides = function () {
457        for (var i = _this.slides.length - 1; i >= 0; i--) {
458            _this.slides[i].remove();
459        }
460    };
461    _this.getSlide = function (index) {
462        return _this.slides[index];
463    };
464    _this.getLastSlide = function () {
465        return _this.slides[ _this.slides.length-1 ];
466    };
467    _this.getFirstSlide = function () {
468        return _this.slides[0];
469    };
470
471    //Currently Active Slide
472    _this.activeSlide = function () {
473        return _this.slides[_this.activeIndex];
474    };
475
476    /*=========================
477      Plugins API
478      ===========================*/
479    var _plugins = [];
480    for (var plugin in _this.plugins) {
481        if (params[plugin]) {
482            var p = _this.plugins[plugin](_this, params[plugin]);
483            if (p) _plugins.push( p );
484        }
485    }
486    _this.callPlugins = function(method, args) {
487        if (!args) args = {}
488        for (var i=0; i<_plugins.length; i++) {
489            if (method in _plugins[i]) {
490                _plugins[i][method](args);
491            }
492        }
493    };
494
495
496         /*=========================
497
498     Wrapper for Callbacks : Allows additive callbacks via function arrays
499
500     ===========================*/
501
502    _this.fireCallback = function() {
503
504        var callback = arguments[0];
505
506        if( Object.prototype.toString.call( callback ) === '[object Array]' ) {
507
508            for (var i = 0; i < callback.length; i++) {
509
510                if (typeof callback[i] === 'function') {
511
512                    callback[i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
513
514                }
515
516            }
517
518        } else {
519
520            callback(arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
521
522        }
523
524    };
525
526    function isArray (obj) {
527
528        "use strict";
529
530        if (Object.prototype.toString.apply( obj ) === '[object Array]') {
531          return true;
532        }
533
534        return false;
535
536    }
537
538
539
540    /**
541
542+     * Allows user to add callbacks, rather than replace them
543
544+     * @param callback
545
546+     * @param func
547
548+     * @return {*}
549
550+     */
551
552    _this.addCallback = function (callback, func) {
553
554        "use strict";
555
556        var _this = this, tempFunc;
557
558        if (_this.params['on' + callback]) {
559
560           if (isArray(this.params['on' + callback])) {
561
562                return this.params['on' + callback].push(func);
563
564            } else if (typeof this.params['on' + callback] === 'function') {
565
566                tempFunc = this.params['on' + callback];
567
568                this.params['on' + callback] = [];
569
570                this.params['on' + callback].push(tempFunc);
571
572               return this.params['on' + callback].push(func);
573
574            }
575
576        } else {
577
578            this.params['on' + callback] = [];
579
580           return this.params['on' + callback].push(func);
581
582        }
583
584    };
585
586    _this.removeCallbacks = function (callback) {
587
588        if (_this.params['on' + callback]) {
589
590            return _this.params['on' + callback] = null;
591
592        }
593
594    };
595
596
597
598    /*=========================
599
600
601    /*=========================
602      WP8 Fix
603      ===========================*/
604    if (_this.browser.ie10 && !params.onlyExternal) {
605        _this.wrapper.classList.add('swiper-wp8-' + (isH ? 'horizontal' : 'vertical'));
606    }
607
608    /*=========================
609      Free Mode Class
610      ===========================*/
611    if (params.freeMode) {
612        _this.container.className+=' swiper-free-mode';
613    }
614
615    /*==================================================
616        Init/Re-init/Resize Fix
617    ====================================================*/
618    _this.initialized = false;
619    _this.init = function(force, forceCalcSlides) {
620        var _width = _this.h.getWidth(_this.container);
621        var _height = _this.h.getHeight(_this.container);
622        if (_width===_this.width && _height===_this.height && !force) return;
623        _this.width = _width;
624        _this.height = _height;
625
626        containerSize = isH ? _width : _height;
627        var wrapper = _this.wrapper;
628
629        if (force) {
630            _this.calcSlides(forceCalcSlides);
631        }
632
633        if (params.slidesPerView==='auto') {
634            //Auto mode
635            var slidesWidth = 0;
636            var slidesHeight = 0;
637
638            //Unset Styles
639            if (params.slidesOffset>0) {
640                wrapper.style.paddingLeft = '';
641                wrapper.style.paddingRight = '';
642                wrapper.style.paddingTop = '';
643                wrapper.style.paddingBottom = '';
644            }
645            wrapper.style.width = '';
646            wrapper.style.height = '';
647            if (params.offsetPxBefore>0) {
648                if (isH) _this.wrapperLeft = params.offsetPxBefore;
649                else _this.wrapperTop = params.offsetPxBefore;
650            }
651            if (params.offsetPxAfter>0) {
652                if (isH) _this.wrapperRight = params.offsetPxAfter;
653                else _this.wrapperBottom = params.offsetPxAfter;
654            }
655
656            if (params.centeredSlides) {
657                if (isH) {
658                    _this.wrapperLeft = (containerSize - this.slides[0].getWidth(true) )/2;
659                    _this.wrapperRight = (containerSize - _this.slides[ _this.slides.length-1 ].getWidth(true))/2;
660                }
661                else {
662                    _this.wrapperTop = (containerSize - _this.slides[0].getHeight(true))/2;
663                    _this.wrapperBottom = (containerSize - _this.slides[ _this.slides.length-1 ].getHeight(true))/2;
664                }
665            }
666
667            if (isH) {
668                if (_this.wrapperLeft>=0) wrapper.style.paddingLeft = _this.wrapperLeft+'px';
669                if (_this.wrapperRight>=0) wrapper.style.paddingRight = _this.wrapperRight+'px';
670            }
671            else {
672                if (_this.wrapperTop>=0) wrapper.style.paddingTop = _this.wrapperTop+'px';
673                if (_this.wrapperBottom>=0) wrapper.style.paddingBottom = _this.wrapperBottom+'px';
674            }
675            var slideLeft = 0;
676            var centeredSlideLeft=0;
677            _this.snapGrid = [];
678            _this.slidesGrid = [];
679
680            var slideMaxHeight = 0;
681            for(var i = 0; i<_this.slides.length; i++) {
682                var slideWidth = _this.slides[i].getWidth(true);
683                var slideHeight = _this.slides[i].getHeight(true);
684                if (params.calculateHeight) {
685                    slideMaxHeight = Math.max(slideMaxHeight, slideHeight);
686                }
687                var _slideSize = isH ? slideWidth : slideHeight;
688                if (params.centeredSlides) {
689                    var nextSlideWidth = i === _this.slides.length-1 ? 0 : _this.slides[i+1].getWidth(true);
690                    var nextSlideHeight = i === _this.slides.length-1 ? 0 : _this.slides[i+1].getHeight(true);
691                    var nextSlideSize = isH ? nextSlideWidth : nextSlideHeight;
692                    if (_slideSize>containerSize) {
693                        for (var j=0; j<=Math.floor(_slideSize/(containerSize+_this.wrapperLeft)); j++) {
694                            if (j === 0) _this.snapGrid.push(slideLeft+_this.wrapperLeft);
695                            else _this.snapGrid.push(slideLeft+_this.wrapperLeft+containerSize*j);
696                        }
697                        _this.slidesGrid.push(slideLeft+_this.wrapperLeft);
698                    }
699                    else {
700                        _this.snapGrid.push(centeredSlideLeft);
701                        _this.slidesGrid.push(centeredSlideLeft);
702                    }
703
704                    centeredSlideLeft += _slideSize/2 + nextSlideSize/2;
705
706                }
707                else {
708                    if (_slideSize>containerSize) {
709                        for (var j=0; j<=Math.floor(_slideSize/containerSize); j++) {
710                            _this.snapGrid.push(slideLeft+containerSize*j);
711                        }
712                    }
713                    else {
714                        _this.snapGrid.push(slideLeft);
715                    }
716                    _this.slidesGrid.push(slideLeft);
717                }
718
719                slideLeft += _slideSize;
720
721                slidesWidth += slideWidth;
722                slidesHeight += slideHeight;
723            }
724            if (params.calculateHeight) _this.height = slideMaxHeight;
725            if(isH) {
726                wrapperSize = slidesWidth + _this.wrapperRight + _this.wrapperLeft;
727                wrapper.style.width = (slidesWidth)+'px';
728                wrapper.style.height = (_this.height)+'px';
729            }
730            else {
731                wrapperSize = slidesHeight + _this.wrapperTop + _this.wrapperBottom;
732                wrapper.style.width = (_this.width)+'px';
733                wrapper.style.height = (slidesHeight)+'px';
734            }
735
736        }
737        else if (params.scrollContainer) {
738            //Scroll Container
739            wrapper.style.width = '';
740            wrapper.style.height = '';
741            var wrapperWidth = _this.slides[0].getWidth(true);
742            var wrapperHeight = _this.slides[0].getHeight(true);
743            wrapperSize = isH ? wrapperWidth : wrapperHeight;
744            wrapper.style.width = wrapperWidth+'px';
745            wrapper.style.height = wrapperHeight+'px';
746            slideSize = isH ? wrapperWidth : wrapperHeight;
747
748        }
749        else {
750            //For usual slides
751            if (params.calculateHeight) {
752                var slideMaxHeight = 0;
753                var wrapperHeight = 0;
754                //ResetWrapperSize
755                if (!isH) _this.container.style.height= '';
756                wrapper.style.height='';
757
758                for (var i=0; i<_this.slides.length; i++) {
759                    //ResetSlideSize
760                    _this.slides[i].style.height='';
761                    slideMaxHeight = Math.max( _this.slides[i].getHeight(true), slideMaxHeight );
762                    if (!isH) wrapperHeight+=_this.slides[i].getHeight(true);
763                }
764                var slideHeight = slideMaxHeight;
765                _this.height = slideHeight;
766
767                if (isH) wrapperHeight = slideHeight;
768                else containerSize = slideHeight, _this.container.style.height= containerSize+'px';
769            }
770            else {
771                var slideHeight = isH ? _this.height : _this.height/params.slidesPerView;
772                var wrapperHeight = isH ? _this.height : _this.slides.length*slideHeight;
773            }
774            var slideWidth = isH ? _this.width/params.slidesPerView : _this.width;
775            var wrapperWidth = isH ? _this.slides.length*slideWidth : _this.width;
776            slideSize = isH ? slideWidth : slideHeight;
777
778            if (params.offsetSlidesBefore>0) {
779                if (isH) _this.wrapperLeft = slideSize*params.offsetSlidesBefore;
780                else _this.wrapperTop = slideSize*params.offsetSlidesBefore;
781            }
782            if (params.offsetSlidesAfter>0) {
783                if (isH) _this.wrapperRight = slideSize*params.offsetSlidesAfter;
784                else _this.wrapperBottom = slideSize*params.offsetSlidesAfter;
785            }
786            if (params.offsetPxBefore>0) {
787                if (isH) _this.wrapperLeft = params.offsetPxBefore;
788                else _this.wrapperTop = params.offsetPxBefore;
789            }
790            if (params.offsetPxAfter>0) {
791                if (isH) _this.wrapperRight = params.offsetPxAfter;
792                else _this.wrapperBottom = params.offsetPxAfter;
793            }
794            if (params.centeredSlides) {
795                if (isH) {
796                    _this.wrapperLeft = (containerSize - slideSize)/2;
797                    _this.wrapperRight = (containerSize - slideSize)/2;
798                }
799                else {
800                    _this.wrapperTop = (containerSize - slideSize)/2;
801                    _this.wrapperBottom = (containerSize - slideSize)/2;
802                }
803            }
804            if (isH) {
805                if (_this.wrapperLeft>0) wrapper.style.paddingLeft = _this.wrapperLeft+'px';
806                if (_this.wrapperRight>0) wrapper.style.paddingRight = _this.wrapperRight+'px';
807            }
808            else {
809                if (_this.wrapperTop>0) wrapper.style.paddingTop = _this.wrapperTop+'px';
810                if (_this.wrapperBottom>0) wrapper.style.paddingBottom = _this.wrapperBottom+'px';
811            }
812
813            wrapperSize = isH ? wrapperWidth + _this.wrapperRight + _this.wrapperLeft : wrapperHeight + _this.wrapperTop + _this.wrapperBottom;
814            if (!params.cssWidthAndHeight) {
815                if (parseFloat(wrapperWidth) > 0) {
816                    wrapper.style.width = wrapperWidth+'px';
817
818                }
819
820                if (parseFloat(wrapperHeight) > 0) {
821                    wrapper.style.height = wrapperHeight+'px';
822
823                }
824
825            }
826            var slideLeft = 0;
827            _this.snapGrid = [];
828            _this.slidesGrid = [];
829            for (var i=0; i<_this.slides.length; i++) {
830                _this.snapGrid.push(slideLeft);
831                _this.slidesGrid.push(slideLeft);
832                slideLeft+=slideSize;
833                if (!params.cssWidthAndHeight) {
834                    if (parseFloat(slideWidth) > 0) {
835                        _this.slides[i].style.width = slideWidth+'px';
836
837                    }
838
839                    if (parseFloat(slideHeight) > 0) {
840                        _this.slides[i].style.height = slideHeight+'px';
841
842                    }
843
844                }
845            }
846
847        }
848
849        if (!_this.initialized) {
850            _this.callPlugins('onFirstInit');
851            if (params.onFirstInit) _this.fireCallback(params.onFirstInit,_this);
852        }
853        else {
854            _this.callPlugins('onInit');
855             if (params.onInit) _this.fireCallback(params.onInit,_this);
856        }
857        _this.initialized = true;
858    };
859    
860    _this.reInit = function (forceCalcSlides) {
861        _this.init(true, forceCalcSlides);
862    };
863    
864    _this.resizeFix = function (reInit) {
865
866        _this.callPlugins('beforeResizeFix');
867        
868        _this.init(params.resizeReInit || reInit);
869        
870        // swipe to active slide in fixed mode
871        if (!params.freeMode) {
872            _this.swipeTo((params.loop ? _this.activeLoopIndex : _this.activeIndex), 0, false);
873        }
874        
875        // move wrapper to the beginning in free mode
876        else if (_this.getWrapperTranslate() < -maxWrapperPosition()) {
877        	_this.setWrapperTransition(0);
878            _this.setWrapperTranslate(-maxWrapperPosition());
879        }
880        
881        _this.callPlugins('afterResizeFix');
882    };
883
884    /*==========================================
885        Max and Min Positions
886    ============================================*/
887    function maxWrapperPosition() {
888        var a = (wrapperSize - containerSize);
889        if (params.freeMode) {
890            a = wrapperSize - containerSize;
891        }
892        // if (params.loop) a -= containerSize;
893        if (params.slidesPerView > _this.slides.length) a = 0;
894        if (a<0) a = 0;
895        return a;
896    }
897    function minWrapperPosition() {
898        var a = 0;
899        // if (params.loop) a = containerSize;
900        return a;
901    }
902
903    /*==========================================
904        Event Listeners
905    ============================================*/
906    function initEvents() {
907        var bind = _this.h.addEventListener;
908        
909        //Touch Events
910        if (!_this.browser.ie10) {
911            if (_this.support.touch) {
912                bind(_this.wrapper, 'touchstart', onTouchStart);
913                bind(_this.wrapper, 'touchmove', onTouchMove);
914                bind(_this.wrapper, 'touchend', onTouchEnd);
915            }
916            if (params.simulateTouch) {
917                bind(_this.wrapper, 'mousedown', onTouchStart);
918                bind(document, 'mousemove', onTouchMove);
919                bind(document, 'mouseup', onTouchEnd);
920            }
921        }
922        else {
923            bind(_this.wrapper, _this.touchEvents.touchStart, onTouchStart);
924            bind(document, _this.touchEvents.touchMove, onTouchMove);
925            bind(document, _this.touchEvents.touchEnd, onTouchEnd);
926        }
927
928        //Resize Event
929        if (params.autoResize) {
930            bind(window, 'resize', _this.resizeFix);
931        }
932        //Slide Events
933        addSlideEvents();
934        //Mousewheel
935        _this._wheelEvent = false;
936        if (params.mousewheelControl) {
937            if ( document.onmousewheel !== undefined ) {
938                _this._wheelEvent = "mousewheel";
939            }
940            try {
941                WheelEvent("wheel");
942                _this._wheelEvent = "wheel";
943            } catch (e) {}
944            if ( !_this._wheelEvent ) {
945                _this._wheelEvent = "DOMMouseScroll";
946            }
947
948            if (_this._wheelEvent) {
949                bind(_this.container, _this._wheelEvent, handleMousewheel);
950            }
951        }
952
953        //Keyboard
954        if (params.keyboardControl) {
955            bind(document, 'keydown', handleKeyboardKeys);
956        }
957        if (params.updateOnImagesReady) {
958            _this.imagesToLoad = $$('img', _this.container);
959
960            for (var i=0; i<_this.imagesToLoad.length; i++) {
961                _loadImage(_this.imagesToLoad[i].getAttribute('src'));
962            }
963        }
964        function _loadImage(src) {
965            var image = new Image();
966            image.onload = function(){
967                _this.imagesLoaded++;
968                if (_this.imagesLoaded==_this.imagesToLoad.length) {
969                    _this.reInit();
970                    if (params.onImagesReady) _this.fireCallback(params.onImagesReady, _this);
971                }
972            };
973            image.src = src;
974        }
975    }
976
977    //Remove Event Listeners
978    _this.destroy = function(removeResizeFix){
979    	var unbind = _this.h.removeEventListener;
980    	
981        //Touch Events
982        if (!_this.browser.ie10) {
983            if (_this.support.touch) {
984                unbind(_this.wrapper, 'touchstart', onTouchStart);
985                unbind(_this.wrapper, 'touchmove', onTouchMove);
986                unbind(_this.wrapper, 'touchend', onTouchEnd);
987            }
988            if (params.simulateTouch) {
989                unbind(_this.wrapper, 'mousedown', onTouchStart);
990                unbind(document, 'mousemove', onTouchMove);
991                unbind(document, 'mouseup', onTouchEnd);
992            }
993        }
994        else {
995            unbind(_this.wrapper, _this.touchEvents.touchStart, onTouchStart);
996            unbind(document, _this.touchEvents.touchMove, onTouchMove);
997            unbind(document, _this.touchEvents.touchEnd, onTouchEnd);
998        }
999
1000        //Resize Event
1001        if (params.autoResize) {
1002            unbind(window, 'resize', _this.resizeFix);
1003        }
1004        
1005        //Init Slide Events
1006        removeSlideEvents();
1007
1008        //Pagination
1009        if (params.paginationClickable) {
1010            removePaginationEvents();
1011        }
1012
1013        //Mousewheel
1014        if (params.mousewheelControl && _this._wheelEvent) {
1015           unbind(_this.container, _this._wheelEvent, handleMousewheel);
1016        }
1017
1018        //Keyboard
1019        if (params.keyboardControl) {
1020            unbind(document, 'keydown', handleKeyboardKeys);
1021        }
1022
1023        //Stop autoplay
1024        if (params.autoplay) {
1025            _this.stopAutoplay();
1026        }
1027        _this.callPlugins('onDestroy');
1028
1029        //Destroy variable
1030        _this = null;
1031    };
1032    
1033    function addSlideEvents() {
1034    	var bind = _this.h.addEventListener,
1035    		i;
1036
1037        //Prevent Links Events
1038        if (params.preventLinks) {
1039            var links = $$('a', _this.container);
1040            for (i=0; i<links.length; i++) {
1041                bind(links[i], 'click', preventClick);
1042            }
1043        }
1044        //Release Form Elements
1045        if (params.releaseFormElements) {
1046            var formElements = $$('input, textarea, select', _this.container);
1047            for (i=0; i<formElements.length; i++) {
1048                bind(formElements[i], _this.touchEvents.touchStart, releaseForms, true);
1049            }
1050        }
1051
1052        //Slide Clicks & Touches
1053        if (params.onSlideClick) {
1054            for (i=0; i<_this.slides.length; i++) {
1055                bind(_this.slides[i], 'click', slideClick);
1056            }
1057        }
1058        if (params.onSlideTouch) {
1059            for (i=0; i<_this.slides.length; i++) {
1060                bind(_this.slides[i], _this.touchEvents.touchStart, slideTouch);
1061            }
1062        }
1063    }
1064    function removeSlideEvents() {
1065    	var unbind = _this.h.removeEventListener,
1066    		i;
1067
1068        //Slide Clicks & Touches
1069        if (params.onSlideClick) {
1070            for (i=0; i<_this.slides.length; i++) {
1071                unbind(_this.slides[i], 'click', slideClick);
1072            }
1073        }
1074        if (params.onSlideTouch) {
1075            for (i=0; i<_this.slides.length; i++) {
1076                unbind(_this.slides[i], _this.touchEvents.touchStart, slideTouch);
1077            }
1078        }
1079        //Release Form Elements
1080        if (params.releaseFormElements) {
1081            var formElements = $$('input, textarea, select', _this.container);
1082            for (i=0; i<formElements.length; i++) {
1083                unbind(formElements[i], _this.touchEvents.touchStart, releaseForms, true);
1084            }
1085        }
1086        //Prevent Links Events
1087        if (params.preventLinks) {
1088            var links = $$('a', _this.container);
1089            for (i=0; i<links.length; i++) {
1090                unbind(links[i], 'click', preventClick);
1091            }
1092        }
1093    }
1094    /*==========================================
1095        Keyboard Control
1096    ============================================*/
1097    function handleKeyboardKeys (e) {
1098        var kc = e.keyCode || e.charCode;
1099        if (kc==37 || kc==39 || kc==38 || kc==40) {
1100            var inView = false;
1101            //Check that swiper should be inside of visible area of window
1102            var swiperOffset = _this.h.getOffset( _this.container );
1103            var scrollLeft = _this.h.windowScroll().left;
1104            var scrollTop = _this.h.windowScroll().top;
1105            var windowWidth = _this.h.windowWidth();
1106            var windowHeight = _this.h.windowHeight();
1107            var swiperCoord = [
1108                [swiperOffset.left, swiperOffset.top],
1109                [swiperOffset.left + _this.width, swiperOffset.top],
1110                [swiperOffset.left, swiperOffset.top + _this.height],
1111                [swiperOffset.left + _this.width, swiperOffset.top + _this.height]
1112            ];
1113            for (var i=0; i<swiperCoord.length; i++) {
1114                var point = swiperCoord[i];
1115                if (
1116                    point[0]>=scrollLeft && point[0]<=scrollLeft+windowWidth &&
1117                    point[1]>=scrollTop && point[1]<=scrollTop+windowHeight
1118                ) {
1119                    inView = true;
1120                }
1121
1122            }
1123            if (!inView) return;
1124        }
1125        if (isH) {
1126            if (kc==37 || kc==39) {
1127                if (e.preventDefault) e.preventDefault();
1128                else e.returnValue = false;
1129            }
1130            if (kc == 39) _this.swipeNext();
1131            if (kc == 37) _this.swipePrev();
1132        }
1133        else {
1134            if (kc==38 || kc==40) {
1135                if (e.preventDefault) e.preventDefault();
1136                else e.returnValue = false;
1137            }
1138            if (kc == 40) _this.swipeNext();
1139            if (kc == 38) _this.swipePrev();
1140        }
1141    }
1142
1143    /*==========================================
1144        Mousewheel Control
1145    ============================================*/
1146    var allowScrollChange = true;
1147    var lastScrollTime = (new Date()).getTime();
1148    function handleMousewheel (e) {
1149        var we = _this._wheelEvent;
1150        var delta = 0;
1151        //Opera & IE
1152        if (e.detail) delta = -e.detail;
1153        //WebKits
1154        else if (we == 'mousewheel') delta = e.wheelDelta;
1155        //Old FireFox
1156        else if (we == 'DOMMouseScroll') delta = -e.detail;
1157        //New FireFox
1158        else if (we == 'wheel') {
1159            delta = Math.abs(e.deltaX)>Math.abs(e.deltaY) ? - e.deltaX : - e.deltaY;
1160        }
1161        if (!params.freeMode) {
1162            if(delta<0) _this.swipeNext();
1163            else _this.swipePrev();
1164        }
1165        else {
1166            //Freemode or scrollContainer:
1167            var position = _this.getWrapperTranslate() + delta;
1168            
1169            if (position > 0) position = 0;
1170            if (position < -maxWrapperPosition()) position = -maxWrapperPosition();
1171            
1172            _this.setWrapperTransition(0);
1173            _this.setWrapperTranslate(position);
1174            _this.updateActiveSlide(position);
1175        }
1176        if (params.autoplay) _this.stopAutoplay();
1177
1178        if(e.preventDefault) e.preventDefault();
1179        else e.returnValue = false;
1180        return false;
1181    }
1182
1183    /*=========================
1184      Grab Cursor
1185      ===========================*/
1186    if (params.grabCursor) {
1187    	var containerStyle = _this.container.style;
1188        containerStyle.cursor = 'move';
1189        containerStyle.cursor = 'grab';
1190        containerStyle.cursor = '-moz-grab';
1191        containerStyle.cursor = '-webkit-grab';
1192    }
1193
1194    /*=========================
1195      Slides Events Handlers
1196      ===========================*/
1197    
1198    _this.allowSlideClick = true;
1199    function slideClick(event) {
1200        if (_this.allowSlideClick) {
1201            
1202            setClickedSlide(event);
1203            this.fireCallback(params.onSlideClick, _this, event);
1204        }
1205    }
1206    
1207    function slideTouch(event) {
1208    	
1209        setClickedSlide(event);
1210       _this.fireCallback(params.onSlideTouch, _this, event);
1211    }
1212    
1213    function setClickedSlide(event) {
1214		
1215		// IE 6-8 support
1216		if (!event.currentTarget) {
1217			var element = event.srcElement;
1218			do {
1219				if (element.className.indexOf(params.slideClass) > -1) {
1220                	break;
1221        		}
1222			}
1223			while (element = element.parentNode);
1224			_this.clickedSlide = element;
1225		}
1226		else {
1227			_this.clickedSlide = event.currentTarget;
1228		}
1229		
1230        _this.clickedSlideIndex     = _this.slides.indexOf(_this.clickedSlide);
1231        _this.clickedSlideLoopIndex = _this.clickedSlideIndex - (_this.loopedSlides || 0);
1232    }
1233    
1234    _this.allowLinks = true;
1235    function preventClick(e) {
1236        if (!_this.allowLinks) {
1237            if(e.preventDefault) e.preventDefault();
1238            else e.returnValue = false;
1239            return false;
1240        }
1241    }
1242    function releaseForms(e) {
1243        if (e.stopPropagation) e.stopPropagation();
1244        else e.returnValue = false;
1245        return false;
1246    }
1247
1248    /*==================================================
1249        Event Handlers
1250    ====================================================*/
1251    var isTouchEvent = false;
1252    var allowThresholdMove;
1253    var allowMomentumBounce = true;
1254    function onTouchStart(event) {
1255
1256    //vc gallery when using lightbox fix
1257    if(jQuery(event.target).parents('.wpb_gallery').length > 0 && jQuery(event.target).parents('.swiper-container').attr('data-desktop-swipe') == 'false' && !Modernizr.touch) {
1258      return false;
1259    }
1260    	
1261    //deactivate touch if only one slide
1262		if(jQuery(event.target).parents('.swiper-container').find('.swiper-slide').length == 1) {
1263      return false;
1264    }
1265		
1266		//deactivate touch for duplicate transitions
1267		if(jQuery(event.target).parents('.swiper-container').find('.swiper-slide.duplicate-transition').length > 0) return false;
1268		
1269        if (params.preventLinks) _this.allowLinks = true;
1270        //Exit if slider is already was touched
1271        if (_this.isTouched || params.onlyExternal) {
1272            return false;
1273        }
1274
1275        if (params.noSwiping && (event.target || event.srcElement) && noSwipingSlide(event.target || event.srcElement)) return false;
1276        allowMomentumBounce = false;
1277
1278        //Check For Nested Swipers
1279        _this.isTouched = true;
1280        isTouchEvent = event.type=='touchstart';
1281
1282        if (!isTouchEvent || event.targetTouches.length == 1 ) {
1283            _this.callPlugins('onTouchStartBegin');
1284
1285            if(!isTouchEvent) {
1286                if(event.preventDefault) event.preventDefault();
1287                else event.returnValue = false;
1288            }
1289            
1290            var pageX = isTouchEvent ? event.targetTouches[0].pageX : (event.pageX || event.clientX);
1291            var pageY = isTouchEvent ? event.targetTouches[0].pageY : (event.pageY || event.clientY);
1292
1293            //Start Touches to check the scrolling
1294            _this.touches.startX = _this.touches.currentX = pageX;
1295            _this.touches.startY = _this.touches.currentY = pageY;
1296
1297            _this.touches.start = _this.touches.current = isH ? pageX : pageY;
1298
1299            //Set Transition Time to 0
1300            _this.setWrapperTransition(0);
1301
1302            //Get Start Translate Position
1303            _this.positions.start = _this.positions.current = _this.getWrapperTranslate();
1304
1305            //Set Transform
1306            _this.setWrapperTranslate(_this.positions.start);
1307
1308            //TouchStartTime
1309            _this.times.start = (new Date()).getTime();
1310
1311            //Unset Scrolling
1312            isScrolling = undefined;
1313
1314            //Set Treshold
1315            if (params.moveStartThreshold>0) allowThresholdMove = false;
1316
1317            //CallBack
1318            if (params.onTouchStart) _this.fireCallback(params.onTouchStart, _this);
1319            _this.callPlugins('onTouchStartEnd');
1320
1321        }
1322    }
1323    var velocityPrevPosition, velocityPrevTime;
1324    function onTouchMove(event) {
1325        // If slider is not touched - exit
1326        if (!_this.isTouched || params.onlyExternal) return;
1327        if (isTouchEvent && event.type=='mousemove') return;
1328
1329        var pageX = isTouchEvent ? event.targetTouches[0].pageX : (event.pageX || event.clientX);
1330        var pageY = isTouchEvent ? event.targetTouches[0].pageY : (event.pageY || event.clientY);
1331
1332        //check for scrolling
1333        if ( typeof isScrolling === 'undefined' && isH) {
1334          isScrolling = !!( isScrolling || Math.abs(pageY - _this.touches.startY) > Math.abs( pageX - _this.touches.startX ) );
1335        }
1336        if ( typeof isScrolling === 'undefined' && !isH) {
1337          isScrolling = !!( isScrolling || Math.abs(pageY - _this.touches.startY) < Math.abs( pageX - _this.touches.startX ) );
1338        }
1339        if (isScrolling ) {
1340            _this.isTouched = false;
1341            return;
1342        }
1343
1344        //Check For Nested Swipers
1345        if (event.assignedToSwiper) {
1346            _this.isTouched = false;
1347            return;
1348        }
1349        event.assignedToSwiper = true;
1350
1351        //Block inner links
1352        if (params.preventLinks) {
1353            _this.allowLinks = false;
1354        }
1355        if (params.onSlideClick) {
1356            _this.allowSlideClick = false;
1357        }
1358
1359        //Stop AutoPlay if exist
1360        if (params.autoplay) {
1361            _this.stopAutoplay();
1362        }
1363        if (!isTouchEvent || event.touches.length == 1) {
1364
1365        	//Moved Flag
1366        	if (!_this.isMoved) {
1367        		_this.callPlugins('onTouchMoveStart');
1368        		
1369				if (params.loop) {
1370					_this.fixLoop();
1371					_this.positions.start = _this.getWrapperTranslate();
1372				}
1373				if (params.onTouchMoveStart) _this.fireCallback(params.onTouchMoveStart, _this);
1374        	}
1375        	_this.isMoved = true;
1376        	
1377        	// cancel event
1378            if(event.preventDefault) event.preventDefault();
1379            else event.returnValue = false;
1380
1381            _this.touches.current = isH ? pageX : pageY ;
1382
1383            _this.positions.current = (_this.touches.current - _this.touches.start) * params.touchRatio + _this.positions.start;
1384
1385            //Resistance Callbacks
1386            if(_this.positions.current > 0 && params.onResistanceBefore) {
1387                _this.fireCallback(params.onResistanceBefore, _this, _this.positions.current);
1388            }
1389            if(_this.positions.current < -maxWrapperPosition() && params.onResistanceAfter) {
1390                _this.fireCallback(params.onResistanceAfter, _this, Math.abs(_this.positions.current + maxWrapperPosition()));
1391            }
1392            //Resistance
1393            if (params.resistance && params.resistance!='100%') {
1394                //Resistance for Negative-Back sliding
1395                if(_this.positions.current > 0) {
1396                    var resistance = 1 - _this.positions.current/containerSize/2;
1397                    if (resistance < 0.5)
1398                        _this.positions.current = (containerSize/2);
1399                    else
1400                        _this.positions.current = _this.positions.current * resistance;
1401                }
1402                //Resistance for After-End Sliding
1403                if ( _this.positions.current < -maxWrapperPosition() ) {
1404
1405                    var diff = (_this.touches.current - _this.touches.start)*params.touchRatio + (maxWrapperPosition()+_this.positions.start);
1406                    var resistance = (containerSize+diff)/(containerSize);
1407                    var newPos = _this.positions.current-diff*(1-resistance)/2;
1408                    var stopPos = -maxWrapperPosition() - containerSize/2;
1409
1410                    if (newPos < stopPos || resistance<=0)
1411                        _this.positions.current = stopPos;
1412                    else
1413                        _this.positions.current = newPos;
1414                }
1415            }
1416            if (params.resistance && params.resistance=='100%') {
1417                //Resistance for Negative-Back sliding
1418                if(_this.positions.current > 0 && !(params.freeMode&&!params.freeModeFluid)) {
1419                    _this.positions.current = 0;
1420                }
1421                //Resistance for After-End Sliding
1422                if ( (_this.positions.current) < -maxWrapperPosition() && !(params.freeMode&&!params.freeModeFluid)) {
1423                    _this.positions.current = -maxWrapperPosition();
1424                }
1425            }
1426            //Move Slides
1427            if (!params.followFinger) return;
1428
1429            if (!params.moveStartThreshold) {
1430                _this.setWrapperTranslate(_this.positions.current);
1431            }
1432            else {
1433                if ( Math.abs(_this.touches.current - _this.touches.start)>params.moveStartThreshold || allowThresholdMove) {
1434                    allowThresholdMove = true;
1435                    _this.setWrapperTranslate(_this.positions.current);
1436                }
1437                else {
1438                    _this.positions.current = _this.positions.start;
1439                }
1440            }
1441
1442            if (params.freeMode || params.watchActiveIndex) {
1443                _this.updateActiveSlide(_this.positions.current);
1444            }
1445
1446            //Grab Cursor
1447             //Grab Cursor
1448            if (params.grabCursor) {
1449                _this.container.style.cursor = 'move';
1450                _this.container.style.cursor = 'grabbing';
1451                _this.container.style.cursor = '-moz-grabbing';
1452                _this.container.style.cursor = '-webkit-grabbing';
1453            }  
1454            //Velocity
1455            if (!velocityPrevPosition) velocityPrevPosition = _this.touches.current;
1456            if (!velocityPrevTime) velocityPrevTime = (new Date).getTime();
1457            _this.velocity = (_this.touches.current - velocityPrevPosition)/((new Date).getTime() - velocityPrevTime)/2;
1458
1459            if (Math.abs(_this.touches.current - velocityPrevPosition)<2) _this.velocity=0;
1460            velocityPrevPosition = _this.touches.current;
1461            velocityPrevTime = (new Date).getTime();
1462            //Callbacks
1463            _this.callPlugins('onTouchMoveEnd');
1464            if (params.onTouchMove) _this.fireCallback(params.onTouchMove, _this);
1465
1466            return false;
1467        }
1468    }
1469    function onTouchEnd(event) {
1470        //Check For scrolling
1471        if (isScrolling) {
1472            _this.swipeReset();
1473        }
1474        // If slider is not touched exit
1475        if ( params.onlyExternal || !_this.isTouched ) { return; }
1476        _this.isTouched = false;
1477
1478        //Return Grab Cursor
1479        if (params.grabCursor) {
1480            _this.container.style.cursor = 'move';
1481            _this.container.style.cursor = 'grab';
1482            _this.container.style.cursor = '-moz-grab';
1483            _this.container.style.cursor = '-webkit-grab';
1484        }
1485
1486        //Check for Current Position
1487        if (!_this.positions.current && _this.positions.current!==0) {
1488            _this.positions.current = _this.positions.start;
1489        }
1490
1491        //For case if slider touched but not moved
1492        if (params.followFinger) {
1493            _this.setWrapperTranslate(_this.positions.current);
1494        }
1495
1496        // TouchEndTime
1497        _this.times.end = (new Date()).getTime();
1498
1499        //Difference
1500        _this.touches.diff = _this.touches.current - _this.touches.start;
1501        _this.touches.abs = Math.abs(_this.touches.diff);
1502
1503        _this.positions.diff = _this.positions.current - _this.positions.start;
1504        _this.positions.abs = Math.abs(_this.positions.diff);
1505
1506        var diff = _this.positions.diff;
1507        var diffAbs =_this.positions.abs;
1508        var timeDiff = _this.times.end - _this.times.start;
1509
1510        if(diffAbs < 5 && (timeDiff) < 300 && _this.allowLinks == false) {
1511            if (!params.freeMode && diffAbs!=0) { 
1512              _this.swipeReset(); 
1513            }
1514            //Release inner links
1515            if (params.preventLinks) {
1516                _this.allowLinks = true;
1517            }
1518            if (params.onSlideClick) {
1519                _this.allowSlideClick = true;
1520            }
1521        }
1522        
1523        setTimeout(function () {
1524            //Release inner links
1525            if (params.preventLinks) {
1526                _this.allowLinks = true;
1527            }
1528            if (params.onSlideClick) {
1529                _this.allowSlideClick = true;
1530            }
1531        }, 100);
1532
1533        var maxPosition = maxWrapperPosition();
1534
1535        //Not moved or Prevent Negative Back Sliding/After-End Sliding
1536        if (!_this.isMoved && params.freeMode) {
1537            _this.isMoved = false;
1538            if (params.onTouchEnd) _this.fireCallback(params.onTouchEnd, _this);
1539            _this.callPlugins('onTouchEnd');
1540            return;   
1541        }
1542        if (!_this.isMoved || _this.positions.current > 0 || _this.positions.current < -maxPosition) {
1543            _this.swipeReset();
1544           if (params.onTouchEnd) _this.fireCallback(params.onTouchEnd, _this);
1545            _this.callPlugins('onTouchEnd');
1546            return;
1547        }
1548
1549        _this.isMoved = false;
1550
1551        //Free Mode
1552        if (params.freeMode) {
1553            if ( params.freeModeFluid ) {
1554                var momentumDuration = 1000*params.momentumRatio;
1555                var momentumDistance = _this.velocity*momentumDuration;
1556                var newPosition = _this.positions.current + momentumDistance;
1557                var doBounce = false;
1558                var afterBouncePosition;
1559                var bounceAmount = Math.abs( _this.velocity )*20*params.momentumBounceRatio;
1560                if (newPosition < -maxPosition) {
1561                    if (params.momentumBounce && _this.support.transitions) {
1562                        if (newPosition + maxPosition < -bounceAmount) newPosition = -maxPosition-bounceAmount;
1563                        afterBouncePosition = -maxPosition;
1564                        doBounce=true;
1565                        allowMomentumBounce = true;
1566                    }
1567                    else newPosition = -maxPosition;
1568                }
1569                if (newPosition > 0) {
1570                    if (params.momentumBounce && _this.support.transitions) {
1571                        if (newPosition>bounceAmount) newPosition = bounceAmount;
1572                        afterBouncePosition = 0;
1573                        doBounce = true;
1574                        allowMomentumBounce = true;
1575                    }
1576                    else newPosition = 0;
1577                }
1578                //Fix duration
1579                if (_this.velocity!=0) momentumDuration = Math.abs((newPosition - _this.positions.current)/_this.velocity);
1580
1581                _this.setWrapperTranslate(newPosition);
1582
1583                _this.setWrapperTransition( momentumDuration );
1584
1585                if (params.momentumBounce && doBounce) {
1586                    _this.wrapperTransitionEnd(function () {
1587                        if (!allowMomentumBounce) return;
1588                        
1589                        if (params.onMomentumBounce) params.onMomentumBounce(_this);
1590                        
1591                        _this.setWrapperTranslate(afterBouncePosition);
1592                        _this.setWrapperTransition(300);
1593                    });
1594                }
1595
1596                _this.updateActiveSlide(newPosition);
1597            }
1598            if (!params.freeModeFluid || timeDiff >= 300) _this.updateActiveSlide(_this.positions.current);
1599
1600            if (params.onTouchEnd) params.onTouchEnd(_this);
1601            _this.callPlugins('onTouchEnd');
1602            return;
1603        }
1604
1605        //Direction
1606        direction = diff < 0 ? "toNext" : "toPrev";
1607
1608        //Short Touches
1609        if (direction=="toNext" && ( timeDiff <= 300 ) ) {
1610            if (diffAbs < 30 || !params.shortSwipes) _this.swipeReset();
1611            else _this.swipeNext(true);
1612        }
1613
1614        if (direction=="toPrev" && ( timeDiff <= 300 ) ) {
1615            if (diffAbs < 30 || !params.shortSwipes) _this.swipeReset();
1616            else _this.swipePrev(true);
1617        }
1618
1619        //Long Touches
1620        var targetSlideSize = 0;
1621        if(params.slidesPerView == 'auto') {
1622            //Define current slide's width
1623            var currentPosition = Math.abs(_this.getWrapperTranslate());
1624            var slidesOffset = 0;
1625            var _slideSize;
1626            for (var i=0; i<_this.slides.length; i++) {
1627                _slideSize = isH ? _this.slides[i].getWidth(true) : _this.slides[i].getHeight(true);
1628                slidesOffset+= _slideSize;
1629                if (slidesOffset>currentPosition) {
1630                    targetSlideSize = _slideSize;
1631                    break;
1632                }
1633            }
1634            if (targetSlideSize>containerSize) targetSlideSize = containerSize;
1635        }
1636        else {
1637            targetSlideSize = slideSize * params.slidesPerView;
1638        }
1639        if (direction=="toNext" && ( timeDiff > 300 ) ) {
1640            if (diffAbs >= targetSlideSize*0.5) {
1641                _this.swipeNext(true);
1642            }
1643            else {
1644                _this.swipeReset();
1645            }
1646        }
1647        if (direction=="toPrev" && ( timeDiff > 300 ) ) {
1648            if (diffAbs >= targetSlideSize*0.5) {
1649                _this.swipePrev(true);
1650            }
1651            else {
1652                _this.swipeReset();
1653            }
1654        }
1655        if (params.onTouchEnd) params.onTouchEnd(_this);
1656        _this.callPlugins('onTouchEnd');
1657    }
1658
1659
1660    /*==================================================
1661        noSwiping Bubble Check by Isaac Strack
1662    ====================================================*/
1663    function noSwipingSlide(el){
1664        /*This function is specifically designed to check the parent elements for the noSwiping class, up to the wrapper.
1665        We need to check parents because while onTouchStart bubbles, _this.isTouched is checked in onTouchStart, which stops the bubbling.
1666        So, if a text box, for example, is the initial target, and the parent slide container has the noSwiping class, the _this.isTouched
1667        check will never find it, and what was supposed to be noSwiping is able to be swiped.
1668        This function will iterate up and check for the noSwiping class in parents, up through the wrapperClass.*/
1669
1670        // First we create a truthy variable, which is that swiping is allowd (noSwiping = false)
1671        var noSwiping = false;
1672    
1673        // Now we iterate up (parentElements) until we reach the node with the wrapperClass.
1674        do{
1675
1676            // Each time, we check to see if there's a 'swiper-no-swiping' class (noSwipingClass).
1677            if (el.className.indexOf(params.noSwipingClass)>-1)
1678            {
1679                noSwiping = true; // If there is, we set noSwiping = true;
1680            }
1681
1682            el = el.parentElement;  // now we iterate up (parent node)
1683
1684        } while(!noSwiping && el.parentElement && el.className.indexOf(params.wrapperClass)==-1); // also include el.parentElement truthy, just in case.
1685
1686        // because we didn't check the wrapper itself, we do so now, if noSwiping is false:
1687        if (!noSwiping && el.className.indexOf(params.wrapperClass)>-1 && el.className.indexOf(params.noSwipingClass)>-1)
1688            noSwiping = true; // if the wrapper has the noSwipingClass, we set noSwiping = true;
1689
1690        return noSwiping;
1691    }
1692
1693    /*==================================================
1694        Swipe Functions
1695    ====================================================*/
1696    _this.swipeNext = function(internal){
1697        if (!internal && params.loop) _this.fixLoop();
1698        _this.callPlugins('onSwipeNext');
1699        var currentPosition = _this.getWrapperTranslate();
1700        var newPosition = currentPosition;
1701        if (params.slidesPerView=='auto') {
1702            for (var i=0; i<_this.snapGrid.length; i++) {
1703                if (-currentPosition >= _this.snapGrid[i] && -currentPosition<_this.snapGrid[i+1]) {
1704                    newPosition = -_this.snapGrid[i+1];
1705                    break;
1706                }
1707            }
1708        }
1709        else {
1710            var groupSize = slideSize * params.slidesPerGroup;
1711            newPosition = -(Math.floor(Math.abs(currentPosition)/Math.floor(groupSize))*groupSize + groupSize);
1712        }
1713        if (newPosition < - maxWrapperPosition()) {
1714            newPosition = - maxWrapperPosition();
1715        }
1716
1717        if (newPosition == currentPosition) { return false; }
1718
1719        swipeToPosition(newPosition, 'next');
1720        return true;
1721    };
1722    _this.swipePrev = function(internal){
1723        if (!internal && params.loop) _this.fixLoop();
1724        if (!internal && params.autoplay) _this.stopAutoplay();
1725        _this.callPlugins('onSwipePrev');
1726
1727        var currentPosition = Math.ceil(_this.getWrapperTranslate());
1728        var newPosition;
1729        if (params.slidesPerView=='auto') {
1730            newPosition = 0;
1731            for (var i=1; i<_this.snapGrid.length; i++) {
1732                if (-currentPosition == _this.snapGrid[i]) {
1733                    newPosition = -_this.snapGrid[i-1];
1734                    break;
1735                }
1736                if (-currentPosition > _this.snapGrid[i] && -currentPosition<_this.snapGrid[i+1]) {
1737                    newPosition = -_this.snapGrid[i];
1738                    break;
1739                }
1740            }
1741        }
1742        else {
1743            var groupSize = slideSize * params.slidesPerGroup;
1744            newPosition = -(Math.ceil(-currentPosition/groupSize)-1)*groupSize;
1745        }
1746
1747        if (newPosition > 0) newPosition = 0;
1748
1749        if (newPosition == currentPosition) {
1750          return false;
1751        }
1752        swipeToPosition(newPosition, 'prev');
1753        return true;
1754
1755    };
1756    _this.swipeReset = function(){
1757        _this.callPlugins('onSwipeReset');
1758        var currentPosition = _this.getWrapperTranslate();
1759        var groupSize = slideSize * params.slidesPerGroup;
1760        var newPosition;
1761        var maxPosition = -maxWrapperPosition();
1762        if (params.slidesPerView=='auto') {
1763            newPosition = 0;
1764            for (var i=0; i<_this.snapGrid.length; i++) {
1765                if (-currentPosition===_this.snapGrid[i]) return;
1766                if (-currentPosition >= _this.snapGrid[i] && -currentPosition<_this.snapGrid[i+1]) {
1767                    if(_this.positions.diff>0) newPosition = -_this.snapGrid[i+1];
1768                    else newPosition = -_this.snapGrid[i];
1769                    break;
1770                }
1771            }
1772            if (-currentPosition >= _this.snapGrid[_this.snapGrid.length-1]) newPosition = -_this.snapGrid[_this.snapGrid.length-1];
1773            if (currentPosition <= -maxWrapperPosition()) newPosition = -maxWrapperPosition();
1774        }
1775        else {
1776            newPosition = currentPosition<0 ? Math.round(currentPosition/groupSize)*groupSize : 0;
1777        }
1778        if (params.scrollContainer)  {
1779            newPosition = currentPosition<0 ? currentPosition : 0;
1780        }
1781        if (newPosition < -maxWrapperPosition()) {
1782            newPosition = -maxWrapperPosition();
1783        }
1784        if (params.scrollContainer && (containerSize>slideSize)) {
1785            newPosition = 0;
1786        }
1787
1788        if (newPosition == currentPosition) { return false; }
1789
1790        swipeToPosition(newPosition, 'reset');
1791        return true;
1792    };
1793    
1794    _this.swipeTo = function(index, speed, runCallbacks) {
1795        index = parseInt(index, 10);
1796        _this.callPlugins('onSwipeTo', {index:index, speed:speed});
1797        if (params.loop) index = index + _this.loopedSlides;
1798        var currentPosition = _this.getWrapperTranslate();
1799        if (index > (_this.slides.length-1) || index < 0) {
1800          return;
1801        }
1802        var newPosition;
1803        if (params.slidesPerView=='auto') {
1804            newPosition = -_this.slidesGrid[ index ];
1805        }
1806        else {
1807            newPosition =  -index*slideSize;
1808        }
1809        if (newPosition < - maxWrapperPosition()) {
1810            newPosition = - maxWrapperPosition();
1811        }
1812
1813        if (newPosition == currentPosition) {
1814          return false;
1815        }
1816
1817        runCallbacks = runCallbacks===false ? false : true;
1818        swipeToPosition(newPosition, 'to', {index:index, speed:speed, runCallbacks:runCallbacks});
1819        return true;
1820    };
1821    
1822    function swipeToPosition(newPosition, action, toOptions) {
1823    	var speed = (action=='to' && toOptions.speed >= 0) ? toOptions.speed : params.speed;
1824    	
1825        var timeOld = + new Date();
1826        if (_this.support.transitions || !params.DOMAnimation) {
1827            _this.setWrapperTranslate(newPosition);
1828            _this.setWrapperTransition(speed);
1829        }
1830        else {
1831            //Try the DOM animation
1832            var currentPosition = _this.getWrapperTranslate();
1833            var animationStep = Math.ceil( (newPosition - currentPosition)/speed*(1000/60) );
1834            var direction = currentPosition > newPosition ? 'toNext' : 'toPrev';
1835            var condition = direction=='toNext' ? currentPosition > newPosition : currentPosition < newPosition;
1836            if (_this._DOMAnimating) return;
1837
1838            anim();
1839        }
1840        function anim(){
1841            var timeNew = + new Date();
1842            var time = timeNew - timeOld;
1843            currentPosition += animationStep * time / (1000/60);
1844
1845            condition = direction=='toNext' ? currentPosition > newPosition : currentPosition < newPosition;
1846            if (condition) {
1847                _this.setWrapperTranslate(Math.round(currentPosition));
1848                _this._DOMAnimating = true;
1849                window.setTimeout(function(){
1850                    anim();
1851                }, 1000 / 60);
1852            }
1853            else {
1854                if (params.onSlideChangeEnd) { 
1855                  _this.fireCallback(params.onSlideChangeEnd, _this);
1856                }
1857                _this.setWrapperTranslate(newPosition);
1858                _this._DOMAnimating = false;
1859            }
1860        }
1861
1862        //Update Active Slide Index
1863        _this.updateActiveSlide(newPosition);
1864
1865        //Callbacks
1866        if (params.onSlideNext && action=='next') {
1867            _this.fireCallback(params.onSlideNext, _this, newPosition);
1868        }
1869        if (params.onSlidePrev && action=='prev') {
1870            _this.fireCallback(params.onSlidePrev, _this, newPosition);
1871        }
1872        //"Reset" Callback
1873        if (params.onSlideReset && action=='reset') {
1874             _this.fireCallback(params.onSlideReset, _this, newPosition);
1875        }
1876
1877        //"Next", "Prev" and "To" Callbacks
1878        if (action=='next' || action=='prev' || (action=='to' && toOptions.runCallbacks==true))
1879            slideChangeCallbacks(action);
1880    }
1881    /*==================================================
1882        Transition Callbacks
1883    ====================================================*/
1884    //Prevent Multiple Callbacks
1885    _this._queueStartCallbacks = false;
1886    _this._queueEndCallbacks = false;
1887    function slideChangeCallbacks(direction) {
1888        //Transition Start Callback
1889        _this.callPlugins('onSlideChangeStart');
1890        if (params.onSlideChangeStart) {
1891            if (params.queueStartCallbacks && _this.support.transitions) {
1892                if (_this._queueStartCallbacks) {
1893                  return;
1894                }
1895                _this._queueStartCallbacks = true;
1896                _this.fireCallback(params.onSlideChangeStart, _this, direction);
1897                _this.wrapperTransitionEnd(function(){
1898                    _this._queueStartCallbacks = false;
1899                });
1900            }
1901            else _this.fireCallback(params.onSlideChangeStart, _this, direction);
1902        }
1903        //Transition End Callback
1904        if (params.onSlideChangeEnd) {
1905            if (_this.support.transitions) {
1906                if (params.queueEndCallbacks) {
1907                    if (_this._queueEndCallbacks) {
1908                      return;
1909                    }
1910                    _this._queueEndCallbacks = true;
1911                    _this.wrapperTransitionEnd(function(swiper){ 
1912                        setTimeout(function(){ if (params.loop) _this.fixLoop(); },50);
1913                        _this.fireCallback(params.onSlideChangeEnd, swiper, direction);
1914                    });
1915                     
1916                }
1917                else _this.wrapperTransitionEnd(function(swiper){
1918                    //setTimeout(function(){ if (params.loop) _this.fixLoop(); },50);
1919                    _this.fireCallback(params.onSlideChangeEnd, swiper, direction);
1920                });
1921            }
1922            else {
1923                if (!params.DOMAnimation) {
1924                    setTimeout(function(){
1925                       _this.fireCallback(params.onSlideChangeStart, _this, direction);
1926                    },10);
1927                }
1928            }
1929        }
1930    }
1931    
1932    /*==================================================
1933        Update Active Slide Index
1934    ====================================================*/
1935    _this.updateActiveSlide = function(position) {
1936        if (!_this.initialized) return;
1937        if (_this.slides.length==0) return;
1938        _this.previousIndex = _this.activeIndex;
1939        if (typeof position=='undefined') position = _this.getWrapperTranslate();
1940        if (position>0) position=0;
1941        
1942        if (params.slidesPerView == 'auto') {
1943            var slidesOffset = 0;
1944            _this.activeIndex = _this.slidesGrid.indexOf(-position);
1945            if (_this.activeIndex<0) {
1946                for (var i=0; i<_this.slidesGrid.length-1; i++) {
1947                    if (-position>_this.slidesGrid[i] && -position<_this.slidesGrid[i+1]) {
1948                        break;
1949                    }
1950                }
1951                var leftDistance = Math.abs( _this.slidesGrid[i] + position );
1952                var rightDistance = Math.abs( _this.slidesGrid[i+1] + position );
1953                if (leftDistance<=rightDistance) _this.activeIndex = i;
1954                else _this.activeIndex = i+1;
1955            }
1956        }
1957        else {
1958        	_this.activeIndex = Math[params.visibilityFullFit ? 'ceil' : 'round']( -position/slideSize );
1959        }
1960        
1961        if (_this.activeIndex == _this.slides.length ) _this.activeIndex = _this.slides.length - 1;
1962        if (_this.activeIndex < 0) _this.activeIndex = 0;
1963        
1964        // Check for slide
1965        if (!_this.slides[_this.activeIndex]) return;
1966        
1967        // Calc Visible slides
1968        _this.calcVisibleSlides(position);
1969
1970        // Mark visible and active slides with additonal classes
1971        var activeClassRegexp = new RegExp( "\\s*" + params.slideActiveClass );
1972        var inViewClassRegexp = new RegExp( "\\s*" + params.slideVisibleClass );
1973
1974        for (var i = 0; i < _this.slides.length; i++) {
1975            _this.slides[ i ].className = _this.slides[ i ].className.replace( activeClassRegexp, '' ).replace( inViewClassRegexp, '' );
1976            if ( _this.visibleSlides.indexOf( _this.slides[ i ] )>=0 ) {
1977                _this.slides[ i ].className += ' ' + params.slideVisibleClass;
1978            }
1979
1980        }
1981        _this.slides[ _this.activeIndex ].className += ' ' + params.slideActiveClass;
1982
1983        //Update loop index
1984        if (params.loop) {
1985            var ls = _this.loopedSlides;
1986            _this.activeLoopIndex = _this.activeIndex - ls;
1987            if (_this.activeLoopIndex >= _this.slides.length - ls*2 ) {
1988                _this.activeLoopIndex = _this.slides.length - ls*2 - _this.activeLoopIndex;
1989            }
1990            if (_this.activeLoopIndex<0) {
1991                _this.activeLoopIndex = _this.slides.length - ls*2 + _this.activeLoopIndex;
1992            }
1993        }
1994        else {
1995            _this.activeLoopIndex = _this.activeIndex;
1996        }
1997        //Update Pagination
1998        if (params.pagination) {
1999            _this.updatePagination(position);
2000        }
2001    };
2002    /*==================================================
2003        Pagination
2004    ====================================================*/
2005    _this.createPagination = function (firstInit) {
2006        if (params.paginationClickable && _this.paginationButtons) {
2007            removePaginationEvents();
2008        }
2009        var paginationHTML = "";
2010        var numOfSlides = _this.slides.length;
2011        var numOfButtons = numOfSlides;
2012        if (params.loop) { numOfButtons -= _this.loopedSlides*2; }
2013        for (var i = 0; i < numOfButtons; i++) {
2014            paginationHTML += '<'+params.paginationElement+' class="'+params.paginationElementClass+'"></'+params.paginationElement+'>';
2015        }
2016        _this.paginationContainer = params.pagination.nodeType ? params.pagination : $$(params.pagination)[0];
2017        _this.paginationContainer.innerHTML = paginationHTML;
2018        _this.paginationButtons = $$('.'+params.paginationElementClass, _this.paginationContainer);
2019        if (!firstInit) {
2020          _this.updatePagination();
2021        }
2022        _this.callPlugins('onCreatePagination');
2023        if (params.paginationClickable) {
2024            addPaginationEvents();
2025        }
2026    };
2027    function removePaginationEvents() {
2028        var pagers = _this.paginationButtons;
2029        for (var i=0; i<pagers.length; i++) {
2030            _this.h.removeEventListener(pagers[i], 'click', paginationClick);
2031        }
2032    }
2033    function addPaginationEvents() {
2034        var pagers = _this.paginationButtons;
2035        for (var i=0; i<pagers.length; i++) {
2036            _this.h.addEventListener(pagers[i], 'click', paginationClick);
2037        }
2038    }
2039    function paginationClick(e){
2040        var index;
2041        var target = e.target || e.srcElement;
2042        var pagers = _this.paginationButtons;
2043        for (var i=0; i<pagers.length; i++) {
2044            if (target===pagers[i]) index = i;
2045        }
2046        _this.swipeTo(index);
2047    }
2048    _this.updatePagination = function(position) {
2049        if (!params.pagination) return;
2050        if (_this.slides.length<1) return;
2051
2052        var activePagers = $$('.'+params.paginationActiveClass, _this.paginationContainer);
2053        if(!activePagers) return;
2054
2055        //Reset all Buttons' class to not active
2056        var pagers = _this.paginationButtons;
2057        if (pagers.length==0) return;
2058        for (var i=0; i < pagers.length; i++) {
2059            pagers[i].className = params.paginationElementClass;
2060        }
2061
2062        var indexOffset = params.loop ? _this.loopedSlides : 0;
2063        if (params.paginationAsRange) {
2064            if (!_this.visibleSlides) _this.calcVisibleSlides(position);
2065            //Get Visible Indexes
2066            var visibleIndexes = [];
2067            for (var i = 0; i < _this.visibleSlides.length; i++) {
2068                var visIndex = _this.slides.indexOf( _this.visibleSlides[i] ) - indexOffset
2069
2070                if (params.loop && visIndex<0) {
2071                    visIndex = _this.slides.length - _this.loopedSlides*2 + visIndex;
2072                }
2073                if (params.loop && visIndex>=_this.slides.length-_this.loopedSlides*2) {
2074                    visIndex = _this.slides.length - _this.loopedSlides*2 - visIndex;
2075                    visIndex = Math.abs(visIndex);
2076                }
2077                visibleIndexes.push( visIndex );
2078            }
2079            
2080            for (i=0; i<visibleIndexes.length; i++) {
2081                if (pagers[ visibleIndexes[i] ]) pagers[ visibleIndexes[i] ].className += ' ' + params.paginationVisibleClass;
2082            }
2083            
2084            if (params.loop) {
2085                pagers[ _this.activeLoopIndex ].className += ' ' + params.paginationActiveClass;
2086            }
2087            else {
2088                pagers[ _this.activeIndex ].className += ' ' + params.paginationActiveClass;
2089            }
2090            
2091        }
2092        else {
2093            if (params.loop) {
2094                pagers[ _this.activeLoopIndex ].className+=' '+params.paginationActiveClass+' '+params.paginationVisibleClass;
2095            }
2096            else {
2097                pagers[ _this.activeIndex ].className+=' '+params.paginationActiveClass+' '+params.paginationVisibleClass;
2098            }
2099
2100        }
2101
2102    };
2103    _this.calcVisibleSlides = function(position){
2104        var visibleSlides = [];
2105        var _slideLeft = 0, _slideSize = 0, _slideRight = 0;
2106        if (isH && _this.wrapperLeft>0) position = position+_this.wrapperLeft;
2107        if (!isH && _this.wrapperTop>0) position = position+_this.wrapperTop;
2108
2109        for (var i=0; i<_this.slides.length; i++) {
2110            _slideLeft += _slideSize;
2111            if (params.slidesPerView == 'auto')
2112                _slideSize  = isH ? _this.h.getWidth(_this.slides[i],true) : _this.h.getHeight(_this.slides[i],true);
2113            else _slideSize = slideSize;
2114
2115            _slideRight = _slideLeft + _slideSize;
2116            var isVisibile = false;
2117            if (params.visibilityFullFit) {
2118                if (_slideLeft >= -position && _slideRight <= -position+containerSize) isVisibile = true;
2119                if (_slideLeft <= -position && _slideRight >= -position+containerSize) isVisibile = true;
2120            }
2121            else {
2122
2123                if (_slideRight > -position && _slideRight <= ((-position+containerSize))) isVisibile = true;
2124                if (_slideLeft >= -position && _slideLeft < ((-position+containerSize))) isVisibile = true;
2125                if (_slideLeft < -position && _slideRight > ((-position+containerSize))) isVisibile = true;
2126            }
2127
2128            if (isVisibile) visibleSlides.push(_this.slides[i]);
2129
2130        }
2131        if (visibleSlides.length==0) visibleSlides = [ _this.slides[ _this.activeIndex ] ];
2132
2133        _this.visibleSlides = visibleSlides;
2134    };
2135
2136    /*==========================================
2137        Autoplay
2138    ============================================*/
2139    _this.autoPlayIntervalId = undefined;
2140    _this.startAutoplay = function () {
2141        if (typeof _this.autoPlayIntervalId !== 'undefined') return false;
2142        if (params.autoplay && !params.loop) {
2143            _this.autoPlayIntervalId = setInterval(function(){
2144                if (!_this.swipeNext(true)) _this.swipeTo(0);
2145            }, params.autoplay);
2146        }
2147        if (params.autoplay && params.loop) {
2148            _this.autoPlayIntervalId = setInterval(function(){
2149                _this.swipeNext();
2150            }, params.autoplay);
2151        }
2152        _this.callPlugins('onAutoplayStart');
2153    };
2154    _this.stopAutoplay = function () {
2155        if (_this.autoPlayIntervalId) clearInterval(_this.autoPlayIntervalId);
2156        _this.autoPlayIntervalId = undefined;
2157        _this.callPlugins('onAutoplayStop');
2158    };
2159    
2160    /*==================================================
2161        Loop
2162    ====================================================*/
2163    _this.loopCreated = false;
2164    _this.removeLoopedSlides = function(){
2165        if (_this.loopCreated) {
2166            for (var i=0; i<_this.slides.length; i++) {
2167                if (_this.slides[i].getData('looped')===true) _this.wrapper.removeChild(_this.slides[i]);
2168            }
2169        }
2170    };
2171    
2172    _this.createLoop = function() {
2173        if (_this.slides.length==0) return;
2174        
2175        _this.loopedSlides = params.slidesPerView + params.loopAdditionalSlides;
2176        if (_this.loopedSlides > _this.slides.length) {
2177			_this.loopedSlides = _this.slides.length;
2178        }
2179        
2180        var slideFirstHTML = '',
2181        	slideLastHTML = '',
2182        	i;
2183
2184        //Grab First Slides
2185        for (i=0; i<_this.loopedSlides; i++) {
2186            slideFirstHTML += _this.slides[i].outerHTML;
2187        }
2188        //Grab Last Slides
2189        for (i=_this.slides.length-_this.loopedSlides; i<_this.slides.length; i++) {
2190            slideLastHTML += _this.slides[i].outerHTML;
2191        }
2192        wrapper.innerHTML = slideLastHTML + wrapper.innerHTML + slideFirstHTML;
2193
2194        _this.loopCreated = true;
2195        _this.calcSlides();
2196
2197        //Update Looped Slides with special class
2198        for (i=0; i<_this.slides.length; i++) {
2199            if (i<_this.loopedSlides || i>=_this.slides.length-_this.loopedSlides) _this.slides[i].setData('looped', true);
2200        }
2201        _this.callPlugins('onCreateLoop');
2202
2203    };
2204    
2205    _this.fixLoop = function() {
2206    	
2207    	if(_this.params.loop == true) {
2208    		
2209	    	var newIndex;
2210	        //Fix For Negative Oversliding
2211	        if (_this.activeIndex < _this.loopedSlides) {
2212	            newIndex = _this.slides.length - _this.loopedSlides*3 + _this.activeIndex;
2213	            _this.swipeTo(newIndex, 0, false);
2214	        }
2215	        //Fix For Positive Oversliding
2216	        else if (_this.activeIndex > _this.slides.length - params.slidesPerView*2) {
2217	            newIndex = -_this.slides.length + _this.activeIndex + _this.loopedSlides
2218	            _this.swipeTo(newIndex, 0, false);
2219	        }
2220       }
2221       
2222    };
2223    
2224    /*==================================================
2225        Slides Loader
2226    ====================================================*/
2227    _this.loadSlides = function(){
2228        var slidesHTML = '';
2229        _this.activeLoaderIndex = 0;
2230        var slides = params.loader.slides;
2231        var slidesToLoad = params.loader.loadAllSlides ? slides.length : params.slidesPerView*(1+params.loader.surroundGroups);
2232        for (var i=0; i< slidesToLoad; i++) {
2233            if (params.loader.slidesHTMLType=='outer') slidesHTML+=slides[i];
2234            else {
2235                slidesHTML+='<'+params.slideElement+' class="'+params.slideClass+'" data-swiperindex="'+i+'">'+slides[i]+'</'+params.slideElement+'>';
2236            }
2237        }
2238        _this.wrapper.innerHTML = slidesHTML;
2239        _this.calcSlides(true);
2240        //Add permanent transitionEnd callback
2241        if (!params.loader.loadAllSlides) {
2242            _this.wrapperTransitionEnd(_this.reloadSlides, true);
2243        }
2244    };
2245    
2246    _this.reloadSlides = function(){
2247        var slides = params.loader.slides;
2248        var newActiveIndex = parseInt(_this.activeSlide().data('swiperindex'),10);
2249        
2250        if (newActiveIndex<0 || newActiveIndex>slides.length-1) {
2251          return;
2252        }
2253          
2254        _this.activeLoaderIndex = newActiveIndex;
2255        var firstIndex = Math.max(0, newActiveIndex - params.slidesPerView*params.loader.surroundGroups);
2256        var lastIndex = Math.min(newActiveIndex+params.slidesPerView*(1+params.loader.surroundGroups)-1, slides.length-1);
2257        //Update Transforms
2258        if (newActiveIndex>0) {
2259            var newTransform = -slideSize*(newActiveIndex-firstIndex);
2260            _this.setWrapperTranslate(newTransform);
2261            _this.setWrapperTransition(0);
2262        }
2263        //New Slides
2264        if (params.loader.logic==='reload') {
2265            _this.wrapper.innerHTML = '';
2266            var slidesHTML = '';
2267            for (var i = firstIndex; i<=lastIndex; i++) {
2268                slidesHTML += params.loader.slidesHTMLType == 'outer' ? slides[i] : '<'+params.slideElement+' class="'+params.slideClass+'" data-swiperindex="'+i+'">'+slides[i]+'</'+params.slideElement+'>';
2269            }
2270            _this.wrapper.innerHTML = slidesHTML;
2271        }
2272        else {
2273            var minExistIndex=1000;
2274            var maxExistIndex=0;
2275            for (var i=0; i<_this.slides.length; i++) {
2276                var index = _this.slides[i].data('swiperindex');
2277                if (index<firstIndex || index>lastIndex) {
2278                    _this.wrapper.removeChild(_this.slides[i]);
2279                }
2280                else {
2281                    minExistIndex = Math.min(index, minExistIndex);
2282                    maxExistIndex = Math.max(index, maxExistIndex);
2283                }
2284            }
2285            for (var i=firstIndex; i<=lastIndex; i++) {
2286                if (i<minExistIndex) {
2287                    var newSlide = document.createElement(params.slideElement);
2288                    newSlide.className = params.slideClass;
2289                    newSlide.setAttribute('data-swiperindex',i);
2290                    newSlide.innerHTML = slides[i];
2291                    _this.wrapper.insertBefore(newSlide, _this.wrapper.firstChild);
2292                }
2293                if (i>maxExistIndex) {
2294                    var newSlide = document.createElement(params.slideElement);
2295                    newSlide.className = params.slideClass;
2296                    newSlide.setAttribute('data-swiperindex',i);
2297                    newSlide.innerHTML = slides[i];
2298                    _this.wrapper.appendChild(newSlide);
2299                }
2300            }
2301        }
2302        //reInit
2303        _this.reInit(true);
2304    };
2305    
2306    /*==================================================
2307        Make Swiper
2308    ====================================================*/
2309    function makeSwiper(){
2310        _this.calcSlides();
2311        if (params.loader.slides.length>0 && _this.slides.length==0) {
2312            _this.loadSlides();
2313        }
2314        if (params.loop) {
2315            _this.createLoop();
2316        }
2317        _this.init();
2318        initEvents();
2319        if (params.pagination && params.createPagination) {
2320            _this.createPagination(true);
2321        }
2322        if (params.loop || params.initialSlide>0) {
2323            _this.swipeTo( params.initialSlide, 0, false );
2324        }
2325        else {
2326            _this.updateActiveSlide(0);
2327        }
2328        if (params.autoplay) {
2329            _this.startAutoplay();
2330        }
2331
2332    }
2333    
2334    makeSwiper();
2335};
2336
2337NectarSwiper.prototype = {
2338    plugins : {},
2339    
2340    /*==================================================
2341        Wrapper Operations
2342    ====================================================*/
2343    wrapperTransitionEnd : function(callback, permanent) {
2344        var a = this,
2345        	el = a.wrapper,
2346        	events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'],
2347        	i;
2348        
2349        function fireCallBack() {
2350            callback(a);
2351            if (a.params.queueEndCallbacks) a._queueEndCallbacks = false;
2352            if (!permanent) {
2353                for (i=0; i<events.length; i++) {
2354                    a.h.removeEventListener(el, events[i], fireCallBack);
2355                }
2356            }
2357        }
2358        
2359        if (callback) {
2360            for (i=0; i<events.length; i++) {
2361                a.h.addEventListener(el, events[i], fireCallBack);
2362            }
2363        }
2364    },
2365
2366    getWrapperTranslate : function (axis) {
2367        var el = this.wrapper,
2368        	matrix, curTransform, curStyle, transformMatrix;
2369        
2370        // automatic axis detection
2371        if (typeof axis == 'undefined') {
2372			axis = this.params.mode == 'horizontal' ? 'x' : 'y';
2373        }
2374        
2375       curStyle = window.getComputedStyle(el, null);
2376
2377            if (window.WebKitCSSMatrix) {
2378                transformMatrix = new WebKitCSSMatrix(curStyle.webkitTransform);
2379            }
2380
2381            else {
2382                transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform  || curStyle.transform || curStyle.getPropertyValue("transform").replace("translate(", "matrix(1, 0, 0, 1,");
2383                matrix = transformMatrix.toString().split(',');
2384            }
2385        
2386        if (this.support.transforms && this.params.useCSS3Transforms) {
2387            if (axis=='x') {
2388            	//Latest Chrome and webkits Fix
2389                if (window.WebKitCSSMatrix)
2390                    curTransform = transformMatrix.m41;
2391                //Crazy IE10 Matrix
2392                else if (matrix.length==16)
2393                    curTransform = parseFloat( matrix[12] );
2394                //Normal Browsers
2395                else
2396                    curTransform = parseFloat( matrix[4] );
2397            }
2398            if (axis=='y') {
2399            	//Latest Chrome and webkits Fix
2400                if (window.WebKitCSSMatrix)
2401                    curTransform = transformMatrix.m42;
2402                //Crazy IE10 Matrix
2403                else if (matrix.length==16)
2404                    curTransform = parseFloat( matrix[13] );
2405                //Normal Browsers
2406                else
2407                    curTransform = parseFloat( matrix[5] );
2408            }
2409        }
2410        else {
2411            if (axis=='x') curTransform = parseFloat(el.style.left,10) || 0;
2412            if (axis=='y') curTransform = parseFloat(el.style.top,10) || 0;
2413        }
2414        return curTransform || 0;
2415    },
2416
2417    setWrapperTranslate : function (x, y, z) {
2418        var es = this.wrapper.style,
2419        	coords = {x: 0, y: 0, z: 0},
2420        	translate;
2421
2422        // passed all coordinates
2423        if (arguments.length == 3) {
2424			coords.x = x;
2425			coords.y = y;
2426			coords.z = z;
2427        }
2428        
2429        // passed one coordinate and optional axis
2430        else {
2431        	if (typeof y == 'undefined') {
2432				y = this.params.mode == 'horizontal' ? 'x' : 'y';
2433        	}
2434        	coords[y] = x;
2435        }
2436
2437        if (this.support.transforms && this.params.useCSS3Transforms) {
2438        	translate = this.support.transforms3d ? 'translate3d(' + coords.x + 'px, ' + coords.y + 'px, ' + coords.z + 'px)' : 'translate(' + coords.x + 'px, ' + coords.y + 'px)';
2439            es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = translate;
2440        }
2441        else {
2442            es.left = coords.x + 'px';
2443            es.top  = coords.y + 'px';
2444        }
2445        this.callPlugins('onSetWrapperTransform', coords);
2446        if (this.params.onSetWrapperTransform) this.fireCallback(this.params.onSetWrapperTransform, this, coords);
2447    },
2448
2449    setWrapperTransition : function (duration) {
2450        var es = this.wrapper.style;
2451        es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = (duration / 1000) + 's';
2452        this.callPlugins('onSetWrapperTransition', {duration: duration});
2453        if (this.params.onSetWrapperTransition) this.fireCallback(this.params.onSetWrapperTransition, this, duration);
2454    },
2455
2456    /*==================================================
2457        Helpers
2458    ====================================================*/
2459    h : {
2460        getWidth: function (el, outer) {
2461            var width = window.getComputedStyle(el, null).getPropertyValue('width');
2462            var returnWidth = parseFloat(width);
2463            //IE Fixes
2464            if(isNaN(returnWidth) || width.indexOf('%')>0) {
2465                returnWidth = el.offsetWidth - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-left')) - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-right'));
2466            }
2467            if (outer) returnWidth += parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-left')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-right'));
2468
2469            return returnWidth;
2470        },
2471        getHeight: function(el, outer) {
2472            if (outer) return el.offsetHeight;
2473
2474            var height = window.getComputedStyle(el, null).getPropertyValue('height');
2475            var returnHeight = parseFloat(height);
2476            //IE Fixes
2477            if(isNaN(returnHeight) || height.indexOf('%')>0) {
2478                returnHeight = el.offsetHeight - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-top')) - parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-bottom'));
2479            }
2480            if (outer) returnHeight += parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-top')) + parseFloat(window.getComputedStyle(el, null).getPropertyValue('padding-bottom'));
2481            return returnHeight;
2482        },
2483        getOffset: function(el) {
2484            var box = el.getBoundingClientRect();
2485            var body = document.body;
2486            var clientTop  = el.clientTop  || body.clientTop  || 0;
2487            var clientLeft = el.clientLeft || body.clientLeft || 0;
2488            var scrollTop  = window.pageYOffset || el.scrollTop;
2489            var scrollLeft = window.pageXOffset || el.scrollLeft;
2490            if (document.documentElement && !window.pageYOffset) {
2491                //IE7-8
2492                scrollTop  = document.documentElement.scrollTop;
2493                scrollLeft = document.documentElement.scrollLeft;
2494            }
2495            return {
2496                top: box.top  + scrollTop  - clientTop,
2497                left: box.left + scrollLeft - clientLeft
2498            };
2499        },
2500        windowWidth : function() {
2501            if (window.innerWidth) { return window.innerWidth; }
2502            else if (document.documentElement && document.documentElement.clientWidth) { return document.documentElement.clientWidth; }
2503        },
2504        windowHeight : function() {
2505            if (window.innerHeight) { return window.innerHeight; }
2506            else if (document.documentElement && document.documentElement.clientHeight) { return document.documentElement.clientHeight; }
2507        },
2508        windowScroll : function() {
2509            var left=0, top=0;
2510            if (typeof pageYOffset != 'undefined') {
2511                return {
2512                    left: window.pageXOffset,
2513                    top: window.pageYOffset
2514                };
2515            }
2516            else if (document.documentElement) {
2517                return {
2518                    left: document.documentElement.scrollLeft,
2519                    top: document.documentElement.scrollTop
2520                };
2521            }
2522        },
2523
2524        addEventListener : function (el, event, listener, useCapture) {
2525        	if (typeof useCapture == 'undefined') {
2526				useCapture = false;
2527        	}
2528        	
2529            if (el.addEventListener) {
2530                el.addEventListener(event, listener, useCapture);
2531            }
2532            else if (el.attachEvent) {
2533                el.attachEvent('on' + event, listener);
2534            }
2535        },
2536        
2537        removeEventListener : function (el, event, listener, useCapture) {
2538        	if (typeof useCapture == 'undefined') {
2539				useCapture = false;
2540        	}
2541        	
2542            if (el.removeEventListener) {
2543                el.removeEventListener(event, listener, useCapture);
2544            }
2545            else if (el.detachEvent) {
2546                el.detachEvent('on' + event, listener);
2547            }
2548        }
2549    },
2550    setTransform : function (el, transform) {
2551        var es = el.style;
2552        es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transform;
2553    },
2554    setTranslate : function (el, translate) {
2555        var es = el.style;
2556        var pos = {
2557            x : translate.x || 0,
2558            y : translate.y || 0,
2559            z : translate.z || 0
2560        };
2561        var transformString = this.support.transforms3d ? 'translate3d('+(pos.x)+'px,'+(pos.y)+'px,'+(pos.z)+'px)' : 'translate('+(pos.x)+'px,'+(pos.y)+'px)';
2562        es.webkitTransform = es.MsTransform = es.msTransform = es.MozTransform = es.OTransform = es.transform = transformString;
2563        if (!this.support.transforms) {
2564            es.left = pos.x+'px';
2565            es.top = pos.y+'px';
2566        }
2567    },
2568    setTransition : function (el, duration) {
2569        var es = el.style;
2570        es.webkitTransitionDuration = es.MsTransitionDuration = es.msTransitionDuration = es.MozTransitionDuration = es.OTransitionDuration = es.transitionDuration = duration+'ms';
2571    },
2572    /*==================================================
2573        Feature Detection
2574    ====================================================*/
2575    support: {
2576
2577        touch : (window.Modernizr && Modernizr.touch===true) || (function() {
2578            return !!(("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch);
2579        })(),
2580
2581        transforms3d : (window.Modernizr && Modernizr.csstransforms3d===true) || (function() {
2582            var div = document.createElement('div').style;
2583            return ("webkitPerspective" in div || "MozPerspective" in div || "OPerspective" in div || "MsPerspective" in div || "perspective" in div);
2584        })(),
2585
2586        transforms : (window.Modernizr && Modernizr.csstransforms===true) || (function(){
2587            var div = document.createElement('div').style;
2588            return ('transform' in div || 'WebkitTransform' in div || 'MozTransform' in div || 'msTransform' in div || 'MsTransform' in div || 'OTransform' in div);
2589        })(),
2590
2591        transitions : (window.Modernizr && Modernizr.csstransitions===true) || (function(){
2592            var div = document.createElement('div').style;
2593            return ('transition' in div || 'WebkitTransition' in div || 'MozTransition' in div || 'msTransition' in div || 'MsTransition' in div || 'OTransition' in div);
2594        })()
2595    },
2596
2597    browser : {
2598
2599        ie8 : (function(){
2600            var rv = -1; // Return value assumes failure.
2601            if (navigator.appName == 'Microsoft Internet Explorer') {
2602                var ua = navigator.userAgent;
2603                var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
2604                if (re.exec(ua) != null)
2605                    rv = parseFloat(RegExp.$1);
2606            }
2607            return rv != -1 && rv < 9;
2608        })(),
2609
2610        ie10 : window.navigator.msPointerEnabled
2611    }
2612};
2613
2614/*=========================
2615  jQuery & Zepto Plugins
2616  ===========================*/
2617if (window.jQuery||window.Zepto) {
2618    (function($){
2619        if(!jQuery().nectarswiper) {
2620            $.fn.nectarswiper = function(params) {
2621                var s = new NectarSwiper($(this)[0], params);
2622                $(this).data('swiper',s);
2623                return s;
2624            };
2625        }
2626    })(window.jQuery||window.Zepto);
2627}
2628
2629// component
2630if ( typeof( module ) !== 'undefined' )
2631{
2632    module.exports = NectarSwiper;
2633}
2634
2635
2636
2637
2638
2639}
2640
2641
2642
2643
2644/*
2645 * Swiper Smooth Progress 1.1.0
2646 * Smooth progress plugin for Swiper
2647 *
2648 * http://www.idangero.us/sliders/swiper/plugins/progress.php
2649 *
2650 * Copyright 2010-2014, Vladimir Kharlampidi
2651 * The iDangero.us
2652 * http://www.idangero.us/
2653 *
2654 * Licensed under GPL & MIT
2655 *
2656 * Released on: January 29, 2014
2657*/
2658NectarSwiper.prototype.plugins.progress=function(a){function b(){for(var b=0;b<a.slides.length;b++){var c=a.slides[b];c.progressSlideSize=e?a.h.getWidth(c):a.h.getHeight(c),c.progressSlideOffset="offsetLeft"in c?e?c.offsetLeft:c.offsetTop:e?c.getOffset().left-a.h.getOffset(a.container).left:c.getOffset().top-a.h.getOffset(a.container).top}d=e?a.h.getWidth(a.wrapper)+a.wrapperLeft+a.wrapperRight-a.width:a.h.getHeight(a.wrapper)+a.wrapperTop+a.wrapperBottom-a.height}function c(b){var c,b=b||{x:0,y:0,z:0};c=1==a.params.centeredSlides?e?-b.x+a.width/2:-b.y+a.height/2:e?-b.x:-b.y;for(var f=0;f<a.slides.length;f++){var g=a.slides[f],h=1==a.params.centeredSlides?g.progressSlideSize/2:0,i=(c-g.progressSlideOffset-h)/g.progressSlideSize;g.progress=i}a.progress=e?-b.x/d:-b.y/d,a.params.onProgressChange&&a.fireCallback(a.params.onProgressChange,a)}var d,e="horizontal"==a.params.mode,f={onFirstInit:function(){b(),c({x:a.getWrapperTranslate("x"),y:a.getWrapperTranslate("y")})},onInit:function(){b()},onSetWrapperTransform:function(a){c(a)}};return f};
2659
2660
2661
2662/*
2663* jQuery Easing v1.4.1 - http://gsgd.co.uk/sandbox/jquery/easing/
2664*/
2665!function(n){"function"==typeof define&&define.amd?define(["jquery"],function(e){return n(e)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=n(require("jquery")):n(jQuery)}(function(n){function e(n){var e=7.5625,t=2.75;return n<1/t?e*n*n:n<2/t?e*(n-=1.5/t)*n+.75:n<2.5/t?e*(n-=2.25/t)*n+.9375:e*(n-=2.625/t)*n+.984375}void 0!==n.easing&&(n.easing.jswing=n.easing.swing);var t=Math.pow,u=Math.sqrt,r=Math.sin,i=Math.cos,a=Math.PI,o=1.70158,c=1.525*o,s=2*a/3,f=2*a/4.5;return n.extend(n.easing,{def:"easeOutQuad",swing:function(e){return n.easing[n.easing.def](e)},easeInQuad:function(n){return n*n},easeOutQuad:function(n){return 1-(1-n)*(1-n)},easeInOutQuad:function(n){return n<.5?2*n*n:1-t(-2*n+2,2)/2},easeInCubic:function(n){return n*n*n},easeOutCubic:function(n){return 1-t(1-n,3)},easeInOutCubic:function(n){return n<.5?4*n*n*n:1-t(-2*n+2,3)/2},easeInQuart:function(n){return n*n*n*n},easeOutQuart:function(n){return 1-t(1-n,4)},easeInOutQuart:function(n){return n<.5?8*n*n*n*n:1-t(-2*n+2,4)/2},easeInQuint:function(n){return n*n*n*n*n},easeOutQuint:function(n){return 1-t(1-n,5)},easeInOutQuint:function(n){return n<.5?16*n*n*n*n*n:1-t(-2*n+2,5)/2},easeInSine:function(n){return 1-i(n*a/2)},easeOutSine:function(n){return r(n*a/2)},easeInOutSine:function(n){return-(i(a*n)-1)/2},easeInExpo:function(n){return 0===n?0:t(2,10*n-10)},easeOutExpo:function(n){return 1===n?1:1-t(2,-10*n)},easeInOutExpo:function(n){return 0===n?0:1===n?1:n<.5?t(2,20*n-10)/2:(2-t(2,-20*n+10))/2},easeInCirc:function(n){return 1-u(1-t(n,2))},easeOutCirc:function(n){return u(1-t(n-1,2))},easeInOutCirc:function(n){return n<.5?(1-u(1-t(2*n,2)))/2:(u(1-t(-2*n+2,2))+1)/2}
2665,easeInElastic:function(n){return 0===n?0:1===n?1:-t(2,10*n-10)*r((10*n-10.75)*s)},easeOutElastic:function(n){return 0===n?0:1===n?1:t(2,-10*n)*r((10*n-.75)*s)+1},easeInOutElastic:function(n){return 0===n?0:1===n?1:n<.5?-t(2,20*n-10)*r((20*n-11.125)*f)/2:t(2,-20*n+10)*r((20*n-11.125)*f)/2+1},easeInBack:function(n){return 2.70158*n*n*n-o*n*n},easeOutBack:function(n){return 1+2.70158*t(n-1,3)+o*t(n-1,2)},easeInOutBack:function(n){return n<.5?t(2*n,2)*(7.189819*n-c)/2:(t(2*n-2,2)*((c+1)*(2*n-2)+c)+2)/2},easeInBounce:function(n){return 1-e(1-n)},easeOutBounce:e,easeInOutBounce:function(n){return n<.5?(1-e(1-2*n))/2:(1+e(2*n-1))/2}}),n});
2666
2667
2668 
2669 
2670
2671jQuery(document).ready(function($){ 
2672  
2673  "use strict";
2674  
2675  Array.prototype.nectarGetKeyByValue = function( value ) {
2676    for( var prop in this ) {
2677      if( this.hasOwnProperty( prop ) ) {
2678        if( this[ prop ] === value )
2679        return prop;
2680      }
2681    }
2682  }
2683  
2684  var doneVideoInit = false;
2685  var $captionTrans = 0;
2686  var $loading_bg_storage = $('.first-section .nectar-slider-loading').css('background-image');
2687  
2688  function transparentheaderLoadingCalcs() {
2689
2690    if($('body #header-outer[data-transparent-header="true"]').length > 0) {
2691      
2692      if($('#page-header-bg').length === 0) {
2693        
2694        $('.nectar-slider-wrap.first-section .swiper-container .swiper-wrapper .swiper-slide').addClass('not-loaded');
2695        
2696        if($('.container-wrap .main-content > .row > div').find('.nectar-slider-wrap.first-section').length > 0) {
2697          $('.container-wrap .main-content > .row > div').first().css('padding-top','0');
2698        }
2699        
2700        if($('#header-outer[data-remove-border="true"]').length === 0) {
2701
2702          if($('.first-section .nectar-slider-wrap[data-flexible-height="true"]').length === 0 && 
2703          $('.first-section .nectar-slider-wrap[data-fullscreen="true"]').length === 0) {
2704            
2705            $('.first-section .nectar-slider-loading').css({
2706              'top': $('#header-space').height(),
2707              'background-position' : 'center ' + ((($('.first-section .swiper-container').height()/2) + 15) - $('#header-space').height()) +'px'
2708            });
2709            
2710            $('.first-section .nectar-slider-wrap .nectar-slider-loading .loading-icon').css({
2711              'opacity' : '1',
2712              'height' :  $('.first-section .swiper-container').height() - $('#header-space').height() + 'px'
2713            });
2714            
2715          } else {
2716            $loading_bg_storage = $('.first-section .nectar-slider-loading').css('background-image');
2717            
2718            $('.first-section .nectar-slider-loading').css({
2719              'top': $('#header-space').height(),
2720              'background-image': 'none'
2721            });
2722          }
2723        }
2724        
2725      }
2726    } 
2727  }
2728  transparentheaderLoadingCalcs();
2729  
2730  
2731  var $onMobileBrowser = navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/);
2732  var $smoothSrollWidth = 0; 
2733  var nectarSliderKenBurns;
2734  
2735  
2736  function prevArrowAnimation(e) {
2737    
2738    if($(this).hasClass('inactive')) { 
2739      return false;
2740    }
2741    
2742    var i = e.data.i;
2743    var $that = $(this); 
2744    var $timeout;
2745      
2746    //non looped slider
2747    if($(this).parents('.swiper-container').attr('data-loop') != 'true') {
2748      
2749      
2750      if( $(this).parents('.swiper-container').find('.swiper-slide-active').index()+1 == 1 && !$('html').hasClass('no-video')){
2751        
2752        //make sure the animation is complete
2753        clearTimeout($timeout);
2754        $timeout = setTimeout(function(){ $that.removeClass('inactive'); } ,700);
2755        
2756        if( $(this).parents('.nectar-slider-wrap ').attr('data-transition') != 'fade') {
2757          
2758          $that = $(this);
2759          
2760          $(this).parents('.swiper-container').animate({
2761            'left' : 25+'px'
2762          },250,function(){
2763            $that.parents('.swiper-container').stop().animate({
2764              'left' : 0+'px'
2765            },250);
2766          });
2767        }
2768        
2769        $(this).addClass('inactive');
2770        
2771      }    
2772      
2773    }
2774    
2775    e.preventDefault();
2776    $nectarSliders[i].swipePrev();
2777    
2778    if( $(this).parents('.nectar-slider-wrap ').attr('data-transition') === 'fade') {
2779
2780      clearTimeout($timeout);
2781      $timeout = setTimeout(function(){ $that.removeClass('inactive'); } ,800);
2782      
2783      $(this).addClass('inactive');
2784    }
2785  }
2786  
2787  function nextArrowAnimation(e) {
2788    
2789    if($(this).hasClass('inactive')) {
2790      return false;
2791    }
2792    
2793    var i = e.data.i;
2794    var $that = $(this);     
2795    var $slideNum = $(this).parents('.swiper-container').find('.swiper-wrapper > div').length;
2796    var $timeout;
2797    
2798    //non looped slider
2799    if($(this).parents('.swiper-container').attr('data-loop') != 'true') {
2800      
2801      if( $(this).parents('.swiper-container').find('.swiper-slide-active').index()+1 == $slideNum && !$('html').hasClass('no-video')) {
2802        
2803        //make sure the animation is complete
2804        clearTimeout($timeout);
2805        $timeout = setTimeout(function(){ $that.removeClass('inactive'); } ,700);
2806        
2807        if( $(this).parents('.nectar-slider-wrap ').attr('data-transition') != 'fade') {
2808          $that = $(this);
2809          
2810          $(this).parents('.swiper-container').animate({
2811            'left' : -25+'px'
2812          },250,function(){
2813            $that.parents('.swiper-container').stop().animate({
2814              'left' : 0+'px'
2815            },250);
2816          });
2817        }
2818        $(this).addClass('inactive');
2819      }
2820    }
2821    
2822    
2823    e.preventDefault();
2824    $nectarSliders[i].swipeNext();
2825    
2826    if( $(this).parents('.nectar-slider-wrap ').attr('data-transition') === 'fade') {
2827
2828      clearTimeout($timeout);
2829      $timeout = setTimeout(function(){ $that.removeClass('inactive'); } ,800);
2830      
2831      $(this).addClass('inactive');
2832    }
2833    
2834  }
2835  
2836  function prevArrowAnimationWithPreview(e) {
2837    if($(this).hasClass('inactive')) {
2838      return false;
2839    }
2840    
2841    var i = e.data.i;
2842    var $that = $(this);     
2843    
2844    //make sure the animation is complete
2845    var $timeout;
2846    
2847    clearTimeout($timeout);
2848    $timeout = setTimeout(function(){ $that.removeClass('inactive'); } ,1000);
2849    
2850    var $timeout2;
2851    
2852    clearTimeout($timeout2);
2853    $timeout2 = setTimeout(function(){ $that.removeClass('stophover'); } ,500);
2854    
2855    $(this).addClass('inactive').addClass('stophover');
2856    
2857    $(this).parents('.nectar-slider-wrap').find('.swiper-slide-active').prev('.swiper-slide').removeClass('prev-high-z-index');
2858    $(this).parents('.nectar-slider-wrap').find('.swiper-slide-active').stop().removeClass('prev-move');
2859    
2860    e.preventDefault();
2861    $nectarSliders[i].swipePrev();
2862  }
2863  
2864  function nextArrowAnimationWithPreview(e) {
2865    if($(this).hasClass('inactive')) {
2866      return false;
2867    }
2868    
2869    var i = e.data.i;
2870    var $that = $(this);     
2871    
2872    //make sure the animation is complete
2873    var $timeout;
2874    
2875    clearTimeout($timeout);
2876    $timeout = setTimeout(function(){ $that.removeClass('inactive'); } ,1000);
2877    
2878    var $timeout2;
2879    
2880    clearTimeout($timeout2);
2881    $timeout2 = setTimeout(function(){ $that.removeClass('stophover'); } ,500);
2882    
2883    $(this).addClass('inactive').addClass('stophover');
2884    
2885    $(this).parents('.nectar-slider-wrap').find('.swiper-slide-active').next('.swiper-slide').removeClass('high-z-index');
2886    $(this).parents('.nectar-slider-wrap').find('.swiper-slide-active').stop().removeClass('next-move');
2887    
2888    e.preventDefault();
2889    $nectarSliders[i].swipeNext();
2890  }
2891  
2892  function darkSlideNextMouseOver(currentSlider, activeIndex) { 
2893    var $indexAdd = ($(currentSlider).find('.swiper-container').attr('data-loop') === 'true') ? 2 : 2;
2894    
2895    if($(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex + 1) +')').attr('data-color-scheme') === 'dark') {
2896      if($(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex + $indexAdd) +')').attr('data-color-scheme') === 'dark') {
2897        $(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex + $indexAdd) +') .video-texture').addClass('half-light-overlay').addClass('no-trans');
2898      }
2899      else {
2900        $(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex + $indexAdd) +') .video-texture').addClass('light-overlay').addClass('no-trans');
2901      }
2902    } else {
2903      if($(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex + $indexAdd) +')').attr('data-color-scheme') === 'light') {
2904        $(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex + $indexAdd) +') .video-texture').addClass('half-dark-overlay').addClass('no-trans');
2905      } else {
2906        $(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex + $indexAdd) +') .video-texture').addClass('dark-overlay').addClass('no-trans');
2907      }
2908    }
2909  }
2910  
2911  function darkSlidePrevMouseOver(currentSlider, activeIndex) { 
2912    var $indexAdd = ($(currentSlider).find('.swiper-container').attr('data-loop') === 'true') ? 0 : 0;
2913    
2914    if($(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex + 1) +')').attr('data-color-scheme') === 'dark') {
2915      if($(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex - $indexAdd) +')').attr('data-color-scheme') === 'dark') {
2916        $(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex - $indexAdd) +') .video-texture').addClass('half-light-overlay').addClass('no-trans');
2917      } else {
2918        $(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex - $indexAdd) +') .video-texture').addClass('light-overlay').addClass('no-trans');
2919      }
2920    } else {
2921      if($(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex - $indexAdd) +')').attr('data-color-scheme') === 'light') {
2922        $(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex - $indexAdd) +') .video-texture').addClass('half-dark-overlay').addClass('no-trans');
2923      } else {
2924        $(currentSlider).find('.swiper-slide:nth-child('+ (activeIndex - $indexAdd) +') .video-texture').addClass('dark-overlay').addClass('no-trans');
2925      }
2926    }
2927  }
2928  
2929  
2930  function resetContentPos(i) {
2931    $($nectarSliders[i].container).find('.swiper-slide .content > *').css({ 'transform': 'translateX(0px)' }); 
2932  }
2933  
2934  function prevArrowAnimationDirectional(e) {
2935    
2936    if($(this).hasClass('inactive') || $(this).parents('.swiper-container').find('.slider-next').hasClass('inactive')) {
2937      return false;
2938    }
2939    
2940    var i = e.data.i;
2941    var $that = $(this);     
2942    
2943    //make sure the animation is complete
2944    var $timeout;
2945    
2946    clearTimeout($timeout);
2947    $timeout = setTimeout(function(){ 
2948      
2949      $that.parents('.swiper-container').removeClass('directional-trans-prev');
2950      
2951      $that.parents('.swiper-container').find('.swiper-wrapper').css({ 'transform': 'translateX(0)', 'left': parseInt($that.parents('.swiper-container').find('.swiper-wrapper').css('left')) + $that.parents('.swiper-container').width() });
2952      setTimeout(function(){ 
2953        $nectarSliders[i].updateActiveSlide();
2954        $nectarSliders[i].fixLoop();
2955        $that.removeClass('inactive');
2956      },50);
2957      
2958      resetContentPos(i);
2959      
2960    } ,1100);
2961    
2962    //call the dark/light slide coloring half way through transition
2963    var $timeout2;
2964    
2965    clearTimeout($timeout2);
2966    $timeout2 = setTimeout(function(){ 
2967      
2968      if($that.parents('.swiper-container').attr('data-loop') != 'true') {
2969        if( $that.parents('.swiper-container').find('.swiper-slide-active').index()+1 != 1) {
2970          onChangeStart($nectarSliders[i]); 
2971        }
2972      }
2973      
2974      else {
2975        onChangeStart($nectarSliders[i]); 
2976      }
2977      
2978    } ,100);
2979    
2980    //non looped slider
2981    if($(this).parents('.swiper-container').attr('data-loop') != 'true') {
2982      
2983      
2984      $(this).parents('.swiper-container').find('.swiper-wrapper').find('.swiper-slide-active .content').children().each(function(i){
2985        
2986        anime({
2987          targets: $(this)[0],
2988          translateX: [0, $that.parents('.swiper-container').width()/2.5 ],
2989          easing: 'easeInOutCubic',
2990          duration: 850
2991        });
2992        
2993      });
2994      
2995      
2996    }
2997    
2998    $(this).addClass('inactive');
2999    
3000    //move the slide with eaising
3001    anime({
3002      targets: $(this).parents('.swiper-container').find('.swiper-wrapper')[0],
3003      translateX: [0, $(this).parents('.swiper-container').width() ],
3004      easing: 'easeInOutCubic',
3005      duration: 1000
3006    });
3007    
3008    if($(this).parents('.swiper-container').attr('data-loop') === 'true') {
3009      
3010      
3011      $(this).parents('.swiper-container').find('.swiper-wrapper').find('.swiper-slide-active .content > *').each(function(i){
3012        
3013        anime({
3014          targets: $(this)[0],
3015          translateX: [0, $that.parents('.swiper-container').width()/2.5 ],
3016          easing: 'easeInOutCubic',
3017          duration: 850,
3018          delay: i*50
3019        });
3020        
3021      });
3022    }
3023    
3024    //kenburns
3025    
3026    if($that.parents('.nectar-slider-wrap').is('[data-bg-animation="ken_burns"]')) {
3027      
3028      $that.parents('.swiper-container').find('.swiper-slide').attr('data-ken-burns','active');
3029      
3030      clearTimeout(nectarSliderKenBurns);
3031      nectarSliderKenBurns = setTimeout(function(){
3032        $that.parents('.swiper-container').find('.swiper-slide:not(".swiper-slide-active")').attr('data-ken-burns','inactive');
3033      },1350);
3034      
3035    }
3036    
3037    
3038    $that.parents('.swiper-container').find('.swiper-wrapper').find('.swiper-slide-active').prev('.swiper-slide').find('.content > *').css({
3039      'transform': 'translateX(-' + $that.parents('.swiper-container').width() + "px)"
3040    }, 0);
3041    
3042    setTimeout(function(){
3043      
3044      $that.parents('.swiper-container').find('.swiper-wrapper').find('.swiper-slide-active').prev('.swiper-slide').find('.content > *').each(function(i){
3045        
3046        anime({
3047          targets: $(this)[0],
3048          translateX: 0,
3049          easing: 'easeInOutCubic',
3050          duration: 700,
3051          delay: i*50
3052        });
3053        
3054        
3055      });
3056    },200);
3057    
3058    $that.parents('.swiper-container').addClass('directional-trans-prev');
3059    
3060    e.preventDefault();
3061    
3062  }
3063  
3064  function nextArrowAnimationDirectional(e) {
3065    
3066    if($(this).hasClass('inactive') || $(this).parents('.swiper-container').find('.slider-prev').hasClass('inactive')) {
3067      return false;
3068    }
3069    
3070    var i = e.data.i;
3071    var $that = $(this);     
3072    
3073    //make sure the animation is complete
3074    var $timeout;
3075    
3076    clearTimeout($timeout);
3077    $timeout = setTimeout(function(){ 
3078      
3079      $that.parents('.swiper-container').removeClass('directional-trans-next');
3080      $that.parents('.swiper-container').find('.swiper-wrapper').css({ 'transform': 'translateX(0)', 'left': parseInt($that.parents('.swiper-container').find('.swiper-wrapper').css('left')) - $that.parents('.swiper-container').width() });
3081      setTimeout(function(){ 
3082        $nectarSliders[i].updateActiveSlide();
3083        $nectarSliders[i].fixLoop(); 
3084        $that.removeClass('inactive');
3085      },50);
3086      resetContentPos(i);
3087      
3088    } ,1100);
3089    
3090    var $timeout2;
3091    
3092    clearTimeout($timeout2);
3093    $timeout2 = setTimeout(function(){ 
3094      
3095      if($that.parents('.swiper-container').attr('data-loop') != 'true') {
3096        if( $that.parents('.swiper-container').find('.swiper-slide-active').index()+1 != $slideNum) {
3097          onChangeStart($nectarSliders[i]); 
3098        }
3099      }
3100      
3101      else {
3102        onChangeStart($nectarSliders[i]); 
3103      }
3104      
3105    } ,100);
3106    
3107    
3108    
3109    var $slideNum = $(this).parents('.swiper-container').find('.swiper-wrapper > div').length;
3110    
3111    //non looped slider
3112    if($(this).parents('.swiper-container').attr('data-loop') != 'true') {
3113      
3114      if( $(this).parents('.swiper-container').find('.swiper-slide-active').index()+1 == $slideNum && !$('html').hasClass('no-video')) {
3115        
3116        if( $(this).parents('.nectar-slider-wrap ').attr('data-transition') != 'fade') {
3117          $(this).parents('.swiper-container').find('.swiper-wrapper').stop(true,false).css('transition','none').animate({
3118            'left' : parseInt($(this).parents('.swiper-container').find('.swiper-wrapper').css('left')) - 20
3119          },200,function(){
3120            $(this).parents('.swiper-container').find('.swiper-wrapper').stop(true,false).css('transition','left,top');
3121            $nectarSliders[i].swipeReset();
3122          });
3123        }
3124      } else {
3125        
3126        $(this).parents('.swiper-container').find('.swiper-wrapper').find('.swiper-slide-active .content > *').each(function(i){
3127          
3128          anime({
3129            targets: $(this)[0],
3130            translateX: '-' + $that.parents('.swiper-container').width()/2.5 + "px",
3131            easing: 'easeInOutCubic',
3132            duration: 850,
3133            delay: i*50
3134          });
3135          
3136        });
3137      }
3138    }
3139    
3140    $(this).addClass('inactive');
3141    
3142    
3143    //move the slide with easing
3144    anime({
3145      targets: $(this).parents('.swiper-container').find('.swiper-wrapper')[0],
3146      translateX: '-' + $that.parents('.swiper-container').width() + "px",
3147      easing: 'easeInOutCubic',
3148      duration: 1000
3149    });
3150    
3151    
3152    if($(this).parents('.swiper-container').attr('data-loop') === 'true') {
3153      
3154      
3155      $(this).parents('.swiper-container').find('.swiper-wrapper').find('.swiper-slide-active .content > *').each(function(i){
3156        
3157        anime({
3158          targets: $(this)[0],
3159          translateX: '-' + $that.parents('.swiper-container').width()/2.5 + "px",
3160          easing: 'easeInOutCubic',
3161          duration: 850,
3162          delay: i*50
3163        });
3164        
3165      });
3166    }
3167    
3168    
3169    //kenburns
3170    if($that.parents('.nectar-slider-wrap').is('[data-bg-animation="ken_burns"]')) {
3171      
3172      $that.parents('.swiper-container').find('.swiper-slide').attr('data-ken-burns','active');
3173      
3174      clearTimeout(nectarSliderKenBurns);
3175      nectarSliderKenBurns = setTimeout(function(){
3176        $that.parents('.swiper-container').find('.swiper-slide:not(".swiper-slide-active")').attr('data-ken-burns','inactive');  
3177      },1350);
3178      
3179    }
3180    
3181    
3182    $that.parents('.swiper-container').find('.swiper-wrapper').find('.swiper-slide-active').next('.swiper-slide').find('.content > *').css({
3183      'transform': 'translateX(' + $that.parents('.swiper-container').width() + "px)"
3184    });
3185    
3186    setTimeout(function(){
3187      
3188      
3189      $that.parents('.swiper-container').find('.swiper-wrapper').find('.swiper-slide-active').next('.swiper-slide').find('.content > *').each(function(i){
3190        
3191        anime({
3192          targets: $(this)[0],
3193          translateX: '0px',
3194          easing: 'easeInOutCubic',
3195          duration: 700,
3196          delay: i*50
3197        });
3198        
3199        
3200      });
3201    },200);
3202    
3203    
3204    $that.parents('.swiper-container').addClass('directional-trans-next');
3205    
3206    e.preventDefault();
3207
3208  }
3209  
3210  
3211  /*=========================
3212  Begin Nectar Slider Main Construction
3213  ===========================*/
3214  var $nectarSliders = [];
3215  
3216  function nectarSliderMainInit() { 
3217    
3218    $nectarSliders = [];
3219    
3220    // remove boxed full width attr when not needed
3221    $('.nectar-slider-wrap[data-full-width="boxed-full-width"]').each(function(){ 
3222      if($(this).parents('.wpb_column').length > 0 && 
3223      $(this).parents('.full-width-content').length > 0) {
3224        $(this).attr('data-full-width','false'); 
3225      }
3226    });
3227    
3228    // remove full width attribute on slider in full width content section
3229    $('.full-width-content .wpb_column .nectar-slider-wrap[data-full-width="true"]').attr('data-full-width', 'false');
3230    
3231    var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && window.innerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0;
3232    var $windowWidth = $(window).width() - $leftHeaderSize;
3233    
3234    if($('body > #boxed').length === 0 && 
3235    $('.nectar-slider-wrap[data-full-width="true"]').parent().attr('id') != 'portfolio-extra' && 
3236    $('.nectar-slider-wrap[data-full-width="true"]').parents('.post-area:not(".span_12")').length === 0){ 
3237      
3238      $('.nectar-slider-wrap[data-full-width="true"], .parallax_slider_outer.first-section .nectar-slider-wrap')
3239        .css({'left': -( ($windowWidth-$smoothSrollWidth)/2 - $('.main-content').width()/2), 'margin-left': '0' });
3240        
3241      $('.nectar-slider-wrap[data-full-width="true"] .swiper-container, .nectar-slider-wrap[data-full-width="true"], .parallax_slider_outer.first-section .swiper-container, .parallax_slider_outer.first-section .nectar-slider-wrap')
3242        .css('width',$windowWidth);
3243    } 
3244    
3245    else if( $('.nectar-slider-wrap[data-full-width="true"]').parent().attr('id') === 'portfolio-extra' && $('#full_width_portfolio').length !== 0){  
3246      
3247      $('.nectar-slider-wrap[data-full-width="true"], .parallax_slider_outer.first-section .nectar-slider-wrap')
3248        .css({'left': -( ($windowWidth-$smoothSrollWidth)/2 - $('.main-content').width()/2), 'margin-left': '0' });
3249        
3250      $('.nectar-slider-wrap[data-full-width="true"] .swiper-container, .nectar-slider-wrap[data-full-width="true"], .parallax_slider_outer.first-section .swiper-container, .parallax_slider_outer.first-section .nectar-slider-wrap')
3251        .css('width',$windowWidth);
3252    }
3253    
3254    else { 
3255      var $container = ($('body > #boxed').length === 0) ? '.post-area' : '.container-wrap';
3256      
3257      if($($container).width() == '0' && $('body > #boxed').length > 0) {
3258        $container = '#boxed';
3259      }
3260      
3261      $('.nectar-slider-wrap[data-full-width="true"] .swiper-container, .nectar-slider-wrap[data-full-width="true"], .parallax_slider_outer.first-section .swiper-container, .parallax_slider_outer.first-section .nectar-slider-wrap')
3262        .css('width',$($container).width());
3263    
3264    }
3265    
3266    //show slider once full width calcs have taken place
3267    $('.nectar-slider-wrap, .slide-bg-overlay').show();
3268    
3269    //set bg colors / textures after js has made the slider fullwidth
3270    $('.swiper-container').each(function(){
3271      if( $(this).parents('.wpb_gallery').length == 0 ) {
3272        $(this).css('background-color','#000');
3273        $(this).find('.swiper-slide').css('background-color','#000');
3274      } 
3275    });
3276
3277    
3278    $('.video-texture').css('opacity','1');
3279    
3280    
3281    
3282    $('.nectar-slider-wrap').each(function(i){
3283      var $arrows = $(this).find('.swiper-container').attr('data-arrows');
3284      var $bullets = $(this).find('.swiper-container').attr('data-bullets');
3285      var $swipe = $(this).find('.swiper-container').attr('data-desktop-swipe');
3286      var $loop = $(this).find('.swiper-container').attr('data-loop');
3287      var $grab = 1;
3288      var $desktopSwipe = 1;
3289      
3290      //swipe  
3291      if($swipe == 'true' && $('#'+$(this).attr('id') +' .swiper-wrapper > div').length > 1 && 
3292      $(this).attr('data-overall_style') != 'directional' ){
3293        $grab = 1;
3294        $desktopSwipe = 1;
3295      } else {
3296        $grab = 0;
3297        $desktopSwipe = 0;
3298      }
3299      
3300      ////set swipe as true for mobile
3301      if( $(window).width() < 1000 && $(this).attr('data-overall_style') != 'directional') {
3302        $grab = 1;
3303        $desktopSwipe = 1;
3304      }
3305
3306      //bullets
3307      if($bullets == 'true' && $(this).find('.swiper-wrapper > div').length > 1 && 
3308      $(this).attr('data-overall_style') != 'directional' ){
3309        $bullets = '#'+$(this).attr('id')+' .slider-pagination';
3310      } else {
3311        $bullets = null;
3312      }
3313      
3314      //loop
3315      var $useLoop = ($loop == 'true' && $(this).find('.swiper-wrapper > div').length > 1 && !$('html').hasClass('no-video') || $(this).attr('data-overall_style') === 'directional' && $(this).find('.swiper-wrapper > div').length > 1 && !$('html').hasClass('no-video')) ? true : false;
3316      if($useLoop == false) {
3317        $(this).find('.swiper-container').attr('data-loop','false');
3318      }
3319      
3320      //obj config
3321      var $sliderOptions, touchRatio;
3322      
3323      if($(this).attr('data-transition') === 'fade' && 
3324      $(this).attr('data-overall_style') !== 'directional' && 
3325      $(this).attr('data-button-styling') !== 'btn_with_preview'){
3326        
3327        var progressVar = true;
3328        touchRatio = 1.3;
3329        
3330        $sliderOptions = {
3331          loop: $useLoop,
3332          grabCursor: $grab,
3333          touchRatio: touchRatio,
3334          speed: 600,
3335          pagination : $bullets,
3336          simulateTouch: $desktopSwipe,
3337          onSlideChangeEnd: nectarSlideRotateReset,
3338          onTouchEnd: nectarSlideRotateResetTouch,
3339          onSlideChangeStart: onChangeStart,
3340          onTouchMove: clearAutoplay,
3341          onFirstInit: nectarInit,
3342          progress: progressVar,
3343          onProgressChange: function(swiper){
3344            
3345            if($(swiper.container).parents('.nectar-slider-wrap').hasClass('loaded')) {
3346              for (var i = 0; i < swiper.slides.length; i++){
3347                var slide = swiper.slides[i];
3348                var progress = slide.progress;
3349                var translate = progress*swiper.width;  
3350                
3351                var opacity = Math.max(1 - Math.abs(progress), 0);
3352                slide.style.opacity = opacity;
3353                swiper.setTransform(slide,'translate3d('+translate+'px,0,0)');
3354              }
3355            }
3356          },
3357          onTouchStart: function(swiper){
3358            for (var i = 0; i < swiper.slides.length; i++){
3359              swiper.setTransition(swiper.slides[i], 0);
3360            }
3361          },
3362          onSetWrapperTransition:  function(swiper, speed) {
3363            for (var i = 0; i < swiper.slides.length; i++){
3364              swiper.setTransition(swiper.slides[i], speed);
3365            }
3366          }
3367        }
3368        
3369        
3370      } else {
3371        
3372        touchRatio = 0.6;
3373        var css3Trans = ($('#'+$(this).attr('id') + '.nectar-slider-wrap[data-overall_style="directional"]').length == 1) ? false: true;
3374        $sliderOptions = {
3375          loop: $useLoop,
3376          grabCursor: $grab,
3377          touchRatio: touchRatio,
3378          speed: 500,
3379          useCSS3Transforms: css3Trans,
3380          pagination : $bullets,
3381          simulateTouch: $desktopSwipe,
3382          onSlideChangeEnd: nectarSlideRotateReset,
3383          onTouchEnd: nectarSlideRotateResetTouch,
3384          onSlideChangeStart: onChangeStart,
3385          onTouchMove: clearAutoplay,
3386          onFirstInit: nectarInit
3387          
3388        }
3389      }
3390      
3391      
3392      $nectarSliders[i] = new NectarSwiper('#'+$(this).attr('id')+' .swiper-container', $sliderOptions);
3393
3394      /* Workaround for hidden sliders */
3395      if( isNaN($nectarSliders[i].activeIndex) ) {
3396        $nectarSliders[i].activeIndex = $useLoop ? 1 : -0;
3397      }
3398      if( isNaN($nectarSliders[i].previousIndex) ) {
3399        $nectarSliders[i].previousIndex = $useLoop ? 1 : 0;
3400      }
3401
3402      $nectarSliders[i].swipeReset();
3403      
3404      $('#'+$(this).attr('id')).addClass('nectar-slider-enabled');
3405      
3406
3407      //webkit looped slider first video fix
3408      if(navigator.userAgent.indexOf('Chrome') > 0 && 
3409      !/Edge\/12./i.test(navigator.userAgent) && 
3410      !/Edge\/\d./i.test(navigator.userAgent)) { 
3411        
3412        var webmSource, webmSource2, firstVideo, lastVideo;
3413        
3414        if( jQuery(this).find('.swiper-slide:nth-child(2) video source[type="video/webm"]').length > 0 && 
3415        jQuery(this).find('.swiper-container').attr('data-loop') === 'true') {
3416          
3417          webmSource = jQuery(this).find('.swiper-slide:nth-child(2) video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
3418          firstVideo = jQuery(this).find('.swiper-slide:nth-child(2) video').get(0);
3419          firstVideo.src = webmSource;
3420          firstVideo.load();
3421          
3422          webmSource2 = jQuery(this).find('.swiper-slide:last-child video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
3423          lastVideo = jQuery(this).find('.swiper-slide:last-child video').get(0);
3424          lastVideo.src = webmSource2;
3425          lastVideo.load();
3426        }
3427        
3428        if( jQuery(this).find('.swiper-slide:eq(-2) video source[type="video/webm"]').length > 0 && 
3429        jQuery(this).find('.swiper-container').attr('data-loop') === 'true') {
3430          
3431          webmSource = jQuery(this).find('.swiper-slide:eq(-2) video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
3432          firstVideo = jQuery(this).find('.swiper-slide:eq(-2) video').get(0);
3433          firstVideo.src = webmSource;
3434          firstVideo.load();
3435          
3436          webmSource2 = jQuery(this).find('.swiper-slide:nth-child(1) video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
3437          lastVideo = jQuery(this).find('.swiper-slide:nth-child(1) video').get(0);
3438          lastVideo.src = webmSource2;
3439          lastVideo.load();
3440        }
3441      }
3442      
3443      
3444      //autorotation visualized style
3445      if($('#'+$(this).attr('id') + ' [data-bullet_style="see_through_ar_visualized"]').length == 1) {
3446        $('#'+$(this).attr('id'))
3447          .find('.slider-pagination .swiper-pagination-switch')
3448          .append('<svg width="65px" height="65px" viewBox="0 0 72 72" xmlns="http://www.w3.org/2000/svg"><circle stroke-width="9" fill="none" stroke-linecap="round" cx="33" cy="33" r="28"></circle> <circle class="time" stroke-width="9" fill="none" stroke-linecap="round" cx="33" cy="33" r="28"></circle></svg>');
3449      } 
3450      
3451      //Navigation arrows
3452      
3453      ////default arrows
3454      if($arrows == 'true' && $('#'+$(this).attr('id') +' .swiper-wrapper > div').length > 1 && 
3455      $('#'+$(this).attr('id') + '.nectar-slider-wrap[data-button-styling="btn_with_preview"]').length === 0 && 
3456      $('#'+$(this).attr('id') + '.nectar-slider-wrap[data-overall_style="directional"]').length === 0 ){
3457        
3458        
3459        $('.slide-count i').css({ 'transform': 'scale(0.5)', 'opacity': '0' });
3460        
3461        //hover event
3462        $('body').on('mouseenter','.nectar-slider-wrap[data-button-styling="btn_with_count"][data-overall_style="classic"] .swiper-container .slider-prev, .nectar-slider-wrap[data-button-styling="btn_with_count"][data-overall_style="classic"] .swiper-container .slider-next',function(){
3463          
3464          anime({
3465            targets: $(this).find('.slide-count i')[0],
3466            scale: [0,1],
3467            translateZ: 0,
3468            opacity: 1,
3469            easing: 'easeOutCubic',
3470            duration: 250,
3471            delay: 110
3472          });
3473          
3474          anime({
3475            targets: $(this)[0],
3476            width: [50,100],
3477            easing: 'easeOutCubic',
3478            duration: 300
3479          });
3480          
3481          anime({
3482            targets: $(this)[0].querySelectorAll('.slide-count span'),
3483            opacity: 1,
3484            easing: 'easeOutCubic',
3485            duration: 225,
3486            delay: 100
3487          });
3488          
3489          
3490        });
3491        
3492        $('body').on('mouseleave','.nectar-slider-wrap[data-button-styling="btn_with_count"][data-overall_style="classic"] .swiper-container .slider-prev, .nectar-slider-wrap[data-button-styling="btn_with_count"][data-overall_style="classic"] .swiper-container .slider-next',function(){
3493          
3494          anime.remove('.slide-count i, .slider-next, .slider-prev, .slide-count span');
3495          
3496          anime({
3497            targets: $(this).find('.slide-count i')[0],
3498            scale: 0,
3499            translateZ: 0,
3500            opacity: 0,
3501            easing: 'easeOutCubic',
3502            duration: 250
3503          });
3504          
3505          anime({
3506            targets: $(this)[0],
3507            width: 50,
3508            easing: 'easeOutCubic',
3509            duration: 300
3510          });
3511          
3512          anime({
3513            targets: $(this)[0].querySelectorAll('.slide-count span'),
3514            opacity: 0,
3515            easing: 'easeOutCubic',
3516            duration: 225
3517          });
3518          
3519        });
3520        
3521        //add slide counts
3522        var $slideCount = ($(this).find('.swiper-container').attr('data-loop') != 'true' ) ? $('#'+$(this).attr('id') + ' .swiper-wrapper > div').length :  $('#'+$(this).attr('id') + ' .swiper-wrapper > div').length - 2;
3523        
3524        //ie8
3525        if($('html').hasClass('no-video')) $slideCount = $('#'+$(this).attr('id') + ' .swiper-wrapper > div').length;
3526        
3527        $('#'+$(this).attr('id')+' .slider-prev .slide-count .slide-total').html( $slideCount );
3528        $('#'+$(this).attr('id')+' .slider-next .slide-count .slide-total').html( $slideCount );
3529        
3530
3531        //prev
3532        $('body').off('click','#'+$(this).attr('id')+' .slider-prev',prevArrowAnimation);
3533        $('body').on('click','#'+$(this).attr('id')+' .slider-prev', {i: i}, prevArrowAnimation);
3534        
3535        
3536        //next
3537        $('body').off('click','#'+$(this).attr('id')+' .slider-next',  nextArrowAnimation);
3538        $('body').on('click','#'+$(this).attr('id')+' .slider-next', {i: i}, nextArrowAnimation);
3539        
3540
3541      }
3542      
3543      
3544      ////button with preview on hover
3545      else if($arrows == 'true' && $('#'+$(this).attr('id') +' .swiper-wrapper > div').length > 1 && $('#'+$(this).attr('id') + '.nectar-slider-wrap[data-button-styling="btn_with_preview"]').length == 1 && $('#'+$(this).attr('id') + '.nectar-slider-wrap[data-overall_style="directional"]').length == 0){
3546
3547        
3548        $('body').off('click','#'+$(this).attr('id')+' .slider-prev', prevArrowAnimationWithPreview);
3549        $('body').on('click','#'+$(this).attr('id')+' .slider-prev', {i: i}, prevArrowAnimationWithPreview);
3550        
3551        //next
3552        $('body').off('click','#'+$(this).attr('id')+' .slider-next', nextArrowAnimationWithPreview);
3553        $('body').on('click','#'+$(this).attr('id')+' .slider-next', {i: i}, nextArrowAnimationWithPreview);
3554        
3555        //hover event
3556        $('body').on('mouseenter','.nectar-slider-wrap[data-button-styling="btn_with_preview"] .swiper-container .slider-next:not(.stophover)',function(){
3557          
3558          $(this).parents('.nectar-slider-wrap')
3559            .find('.swiper-slide-active')
3560            .next('.swiper-slide')
3561            .addClass('high-z-index');
3562            
3563          $(this).parents('.nectar-slider-wrap')
3564            .find('.swiper-slide-active')
3565            .stop()
3566            .addClass('next-move');
3567          
3568          $(this).stop()
3569            .addClass('next-arrow-move');
3570          
3571          darkSlideNextMouseOver($(this).parents('.nectar-slider-wrap'), $(this).parents('.nectar-slider-wrap').find('.swiper-slide-active').index());
3572          
3573        });
3574        
3575        $('body').on('mouseleave','.nectar-slider-wrap[data-button-styling="btn_with_preview"] .swiper-container .slider-next',function(){
3576          
3577          $(this).parents('.nectar-slider-wrap').find('.swiper-slide-active').next('.swiper-slide').removeClass('high-z-index');
3578          $(this).parents('.nectar-slider-wrap').find('.swiper-slide-active').stop().removeClass('next-move');
3579          $(this).stop().removeClass('next-arrow-move');
3580        });
3581        
3582        
3583        $('body').on('mouseenter','.nectar-slider-wrap[data-button-styling="btn_with_preview"] .swiper-container .slider-prev:not(.stophover)',function(){
3584          
3585          $(this).parents('.nectar-slider-wrap').find('.swiper-slide-active').prev('.swiper-slide').addClass('prev-high-z-index');
3586          $(this).parents('.nectar-slider-wrap').find('.swiper-slide-active').stop().addClass('prev-move');
3587          $(this).stop().addClass('prev-arrow-move');
3588          darkSlidePrevMouseOver($(this).parents('.nectar-slider-wrap'), $(this).parents('.nectar-slider-wrap').find('.swiper-slide-active').index());
3589        });
3590        
3591        $('body').on('mouseleave','.nectar-slider-wrap[data-button-styling="btn_with_preview"] .swiper-container .slider-prev',function(){
3592          
3593          $(this).parents('.nectar-slider-wrap').find('.swiper-slide-active').prev('.swiper-slide').removeClass('prev-high-z-index');
3594          $(this).parents('.nectar-slider-wrap').find('.swiper-slide-active').stop().removeClass('prev-move');
3595          $(this).stop().removeClass('prev-arrow-move');
3596          
3597        });
3598        
3599      } else if($('#'+$(this).attr('id') + '.nectar-slider-wrap[data-overall_style="directional"]').length == 1) {
3600        
3601        
3602        //prev
3603        $('body').off('click','#'+$(this).attr('id')+' .slider-prev', prevArrowAnimationDirectional);
3604        $('body').on('click','#'+$(this).attr('id')+' .slider-prev', {i: i}, prevArrowAnimationDirectional);
3605        
3606        //next
3607        $('body').off('click','#'+$(this).attr('id')+' .slider-next',  nextArrowAnimationDirectional);
3608        $('body').on('click','#'+$(this).attr('id')+' .slider-next',  {i: i}, nextArrowAnimationDirectional);
3609
3610        
3611      }
3612      
3613      
3614      //scale pagination style
3615      if($('#'+$(this).attr('id') +' .swiper-container').attr('data-bullet_style') === 'scale' ){
3616        $('#'+$(this).attr('id')+' .slider-pagination .swiper-pagination-switch').append('<i />');
3617      }
3618      //Clickable pagination
3619      if($bullets != null && $('#'+$(this).attr('id') +' .swiper-wrapper > div').length > 1 ){
3620        $('#'+$(this).attr('id')+' .slider-pagination .swiper-pagination-switch').on('click', function(){
3621          $nectarSliders[i].swipeTo($(this).index());
3622        });
3623      }
3624    });
3625    
3626    
3627    
3628  }
3629  
3630  nectarSliderMainInit();
3631  
3632$(window).on('vc_reload', function() {
3633  nectarSliderMainInit();
3634  initialSlideLoad();
3635});
3636
3637/* Viewport tracking */
3638if ('IntersectionObserver' in window) {
3639
3640  var options = {
3641    rootMargin: '0px',
3642  }
3643
3644  var sliderObserver = new IntersectionObserver(function(entries) {
3645
3646    entries.forEach(function(entry) {
3647
3648      if (entry.isIntersecting) {
3649        entry.target.classList.remove('out-of-view');
3650        
3651        setTimeout(function(){
3652          if($(entry.target).find('.swiper-slide-active').is('[data-color-scheme="dark"]') ) {
3653            $('#header-outer.transparent').addClass('dark-slide');
3654          } else {
3655            $('#header-outer.transparent').removeClass('dark-slide');
3656          }
3657        },200);
3658        
3659
3660      } else {
3661        entry.target.classList.add('out-of-view');
3662        
3663      }
3664
3665    });
3666
3667  }, options);
3668
3669  if( $('#nectar_fullscreen_rows').length == 0 && $('#header-outer[data-permanent-transparent="1"]').length > 0 ) {
3670    $('.top-level .nectar-slider-wrap').each(function(slider){
3671      sliderObserver.observe($(this)[0]);
3672    });
3673  }
3674  
3675    
3676  
3677
3678}
3679  
3680  
3681  function darkFirstSlide(slider){
3682    if( slider.parents('.parallax_slider_outer').length > 0 && slider.parents('.first-section').length > 0 && slider.find('.swiper-slide-active[data-color-scheme="dark"]').length > 0 ) {
3683      $('#header-outer').addClass('dark-slide');
3684    } else if(slider.parents('.parallax_slider_outer').length > 0 || slider.parents('.first-section').length > 0 ) {
3685      
3686      if( slider.find('.swiper-slide-active[data-color-scheme="dark"]').length > 0 && slider.parents('.first-section').length > 0 && slider.is('[data-full-width="true"]') ) {
3687        //dont remove if needed
3688      } else {
3689        $('#header-outer').removeClass('dark-slide');
3690      }
3691    }
3692  }
3693  
3694  
3695  //initial slide load 
3696  var $animating = false;
3697  
3698  //responsive slider
3699  var $sliderHeights = [];
3700  var $existingSliders = [];
3701  var slideAnimationQueues = [];
3702  
3703  var sliderLength = $('.swiper-container').length;
3704  var sliderLoadedLength = 0;
3705  
3706  function initialSlideLoad() {
3707    
3708    $animating = false;
3709    
3710    //add class to first video slide
3711    $('.swiper-wrapper').each(function(){
3712      if($(this).find('.swiper-slide:nth-child(2) video').length > 0) $(this).find('.swiper-slide:nth-child(2)').addClass('first_video_slide');
3713      
3714      //ken burns start
3715      if($(this).parents('.nectar-slider-wrap[data-bg-animation="ken_burns"]').length > 0) {
3716        if( $('#nectar_fullscreen_rows').length > 0 ) {
3717          var $that = $(this);
3718          setTimeout(function(){
3719            $that.find('.swiper-slide.swiper-slide-active').addClass('ken-burns').attr('data-ken-burns','active');
3720          },100);
3721        } else {
3722          $(this).find('.swiper-slide.swiper-slide-active').addClass('ken-burns').attr('data-ken-burns','active');
3723        }
3724      }
3725      
3726      
3727    });
3728    
3729    
3730    $('.nectar-slider-wrap').each(function(i){
3731      
3732      
3733      slideAnimationQueues[i] = {
3734        sliderID: $(this).attr('id'),
3735        captionInterval: '',
3736        kenBurnsInterval: '' 
3737      } 
3738      
3739      var $that = $(this);
3740      
3741      //store animation queue arr obj
3742      if($(this).find('.swiper-slide-active video').length > 0){
3743        
3744        if(!$('html').hasClass('no-video') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/) ){
3745          
3746          showSliderControls();
3747          resizeToCover();
3748          slideContentPos();
3749          sliderLoadIn($that,i);
3750          
3751          var $timeoutDelay = 0;
3752          if($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0 && $that.parents('.parallax_slider_outer').length > 0 ||
3753          $('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0 && $that.hasClass('first-nectar-slider') ) {
3754            $timeoutDelay = 450;
3755          } 
3756          
3757          setTimeout(function(){ captionTransition($nectarSliders[i]); onChangeStart($nectarSliders[i]); }, $timeoutDelay); 
3758          darkFirstSlide($that);
3759          
3760          
3761          $that.addClass('loaded');
3762          if($that.parents('.parallax_slider_outer').length > 0 || $that.hasClass('first-nectar-slider')) {
3763            $('#ajax-loading-screen').addClass('loaded');
3764            setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
3765          }
3766          
3767        } 
3768        //ie8
3769        else {
3770          showSliderControls();
3771          resizeToCover();
3772          slideContentPos();
3773          sliderLoadIn($that,i);
3774          captionTransition($nectarSliders[i]);
3775          darkFirstSlide($that);
3776        }
3777      } 
3778      
3779      else {
3780        
3781        showSliderControls();
3782        resizeToCover();
3783        slideContentPos();
3784        sliderLoadIn($that,i);
3785        var $timeout = 0;
3786        
3787        if($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0 && 
3788        $that.parents('.parallax_slider_outer').length > 0 &&
3789        $that.parents('.first-section').length > 0 ||
3790        $('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0 && $that.hasClass('first-nectar-slider') ) {
3791          $timeout = 450;
3792        } 
3793        
3794        setTimeout(function(){ 
3795          captionTransition($nectarSliders[i]);  
3796          onChangeStart($nectarSliders[i]); 
3797        },$timeout); 
3798        
3799        darkFirstSlide($that);
3800        
3801        $that.addClass('loaded');
3802        if($that.parents('.parallax_slider_outer').length > 0 || 
3803        $that.hasClass('first-nectar-slider')) {
3804          $('#ajax-loading-screen').addClass('loaded');
3805          setTimeout(function(){ 
3806            $('#ajax-loading-screen').addClass('hidden'); 
3807          },1000);
3808        }
3809        
3810      }
3811      
3812      //mobile check
3813      if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
3814        
3815        
3816        $that.find('.video-wrap').each(function(){
3817          
3818          var $videoSlide = $(this);
3819          
3820          $(this).css('bottom','0');
3821          $(this).find('video')[0].onplay = function(){    
3822            $videoSlide.find('video').css({'opacity':'1'});
3823            setTimeout(function(){
3824              $videoSlide.parents('.swiper-slide').find('.mobile-video-image').transition({'opacity':'0'},250);
3825              
3826              anime({
3827                targets: $videoSlide.parents('.swiper-slide').find('.mobile-video-image')[0],
3828                opacity: 0,
3829                easing: 'easeOutCubic',
3830                duration: 250
3831              });
3832              
3833            },100);
3834            
3835          };
3836          
3837        });
3838        
3839
3840        captionTransition($nectarSliders[i]);
3841        showSliderControls();
3842        resizeToCover();
3843        slideContentPos();
3844        darkFirstSlide($that);
3845        
3846        setTimeout(function(){ 
3847          resizeToCover(); 
3848          slideContentPos(); 
3849        },400);
3850        
3851        $('.nectar-slider-wrap').find('.nectar-slider-loading').fadeOut(800,'easeInOutExpo');
3852        $('.nectar-slider-wrap.first-section .swiper-container .swiper-wrapper .swiper-slide').removeClass('not-loaded');
3853        
3854
3855        $(this).addClass('loaded');
3856        
3857        if($that.parents('.parallax_slider_outer').length > 0 || $that.hasClass('first-nectar-slider')) {
3858          $('#ajax-loading-screen').addClass('loaded');
3859          setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
3860        }
3861        
3862        autorotateInit($(this),i);
3863      }
3864      
3865      
3866      if($('header#top #logo img').length > 0) {
3867        var logoImg = new Image();
3868        logoImg.src = $('header#top #logo img:first').attr('src');
3869        
3870        $(logoImg).on('load', function(){
3871          if($that.attr('data-overall_style') === 'directional') {
3872            $that.find('.swiper-container').addClass('directional-trans-current'); 
3873            onChangeStart($nectarSliders[i]);
3874          } 
3875        });
3876      } else {
3877        if($that.attr('data-overall_style') === 'directional') {
3878          $that.find('.swiper-container').addClass('directional-trans-current'); 
3879          onChangeStart($nectarSliders[i]);
3880        } 
3881      }
3882      
3883    });
3884    
3885    
3886    ////get slider heights
3887    $('.swiper-container').each(function(){
3888      
3889      //left and right pagination room
3890      if( $(this).is('[data-bullet_position="left"]') ) {
3891        if($(this).find('[data-x-pos="left"]').length > 0) {
3892          $(this).find('.slider-pagination-wrap').addClass('extra-room');
3893        }
3894      }
3895      if( $(this).is('[data-bullet_position="right"]') ) {
3896        if($(this).find('[data-x-pos="right"]').length > 0) {
3897          $(this).find('.slider-pagination-wrap').addClass('extra-room');
3898        }
3899      }
3900      
3901    });
3902    
3903    
3904  }
3905  
3906  
3907  
3908  
3909  function nectarInit() {
3910    if(doneVideoInit == true) { 
3911      return; 
3912    }
3913    
3914    
3915    $('.swiper-slide iframe[data-aspectRatio]').each(function() {
3916      var newWidth = $(this).parent().width();
3917      
3918      var $el = $(this);
3919      
3920      //in nectar slider
3921      if($(this).parents('.swiper-slide').length > 0) {
3922        if($(this).is(':visible')) $el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
3923      } 
3924      //all others
3925      else {
3926        $el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
3927      }
3928      
3929      
3930    });
3931    
3932    
3933    doneVideoInit = true;
3934  }
3935  
3936  
3937  
3938  //autoplay - set vars before init call
3939  var autoplay = [];
3940  var sliderAutoplayCount = 0;
3941  
3942  function nsSliderArrStore() {
3943    $sliderHeights = [];
3944    $existingSliders = [];
3945    $('.swiper-container').each(function(i){
3946      $sliderHeights[i] = parseInt($(this).attr('data-height'));  
3947      $existingSliders[i] = $(this).parent().attr('id');
3948    });
3949  }
3950  
3951  nsSliderArrStore();
3952  dynamicHeightSliders();  
3953  sliderSize();
3954  resizeToCover();
3955  
3956  for(var nsCount=0; nsCount<$nectarSliders.length; nsCount++) {
3957    $nectarSliders[nsCount].resizeFix();
3958  }
3959  
3960  $('.parallax_slider_outer .nectar-slider-wrap .slide-bg-wrap').each(function(){
3961    if($(this).parents('.top-level').length > 0) {
3962      if($(this).find('.image-bg').length > 0) { 
3963        $(this).find('.image-bg').css({'height':  Math.ceil( $(this).parent().offset().top * 0.25 ) + $(this).outerHeight(true) });
3964      }
3965      if($(this).find('.video-wrap').length > 0) { 
3966        $(this).find('.video-wrap').css({'height': Math.ceil( $(this).parent().offset().top * 0.25 ) + $(this).outerHeight(true) }); 
3967      }
3968    } 
3969  });
3970  
3971  
3972  
3973  initialSlideLoad();
3974  
3975  document.addEventListener("visibilitychange", function() {
3976    if (document.hidden){
3977      //browser tab is hidden
3978    } else {
3979      //browser tab is vis
3980      $('.nectar-slider-wrap').each(function(i) {
3981        if( typeof $nectarSliders[i] != 'undefined' ) {
3982          $nectarSliders[i].resizeFix();
3983        }
3984
3985      });
3986      
3987    }
3988  });
3989  
3990  
3991  
3992  
3993  var headerPadding = parseInt($('#header-outer').attr('data-padding'));
3994  var shrinkNum = 8;
3995  
3996  if($('#header-outer[data-shrink-num]').length > 0 ) {
3997    shrinkNum = $('#header-outer').attr('data-shrink-num');
3998  }
3999  
4000  var feEditorStored = false;
4001  function dynamicHeightSliders(){
4002 
4003    var $adminBarHeight = ($('#wpadminbar').length > 0) ? 28 : 0 ;
4004    
4005    if( $('body.compose-mode').length > 0 && feEditorStored == false) {
4006      nsSliderArrStore();
4007      feEditorStored = true;
4008    }
4009
4010    $('.nectar-slider-wrap').each(function(){
4011      
4012      var $heightCalc, $heightCal;
4013      var $minHeight = $('.swiper-container').attr('data-min-height');
4014      
4015      //material header nav parallax top
4016      if(window.innerWidth > 1000 && $('#ajax-content-wrap').length > 0) {
4017        $('body.material:not("[data-header-format=\'left-header\']") .parallax_slider_outer.first-section .nectar-slider-wrap').css('top',$('#ajax-content-wrap').offset().top);
4018      } else {
4019        $('body.material:not("[data-header-format=\'left-header\']") .parallax_slider_outer.first-section .nectar-slider-wrap').css('top','0');
4020      }
4021      
4022      //fullscreen
4023      if($(this).attr('data-fullscreen') === 'true' && $(this).attr('data-full-width') === 'true' || 
4024      $(this).attr('data-fullscreen') === 'true' && $(this).attr('data-full-width') === 'boxed-full-width' ||
4025      $(this).attr('data-fullscreen') === 'true' && $(this).parents('.full-width-content').length > 0 && $(this).parents('.vc_col-sm-12').length > 0 ) {
4026        
4027        if($(this).parents('#nectar_fullscreen_rows').length === 0) {
4028          
4029          //first slider on page
4030          if($(this).hasClass('first-section') && $(this).index() === 0 || 
4031          $(this).parents('.wpb_row').length > 0 && $(this).parents('.wpb_row').hasClass('first-section') && $(this).index() === 0 && $(this).parents('.parallax_slider_outer').length === 0 ||
4032          $(this).parents('.wpb_row').length > 0 && $(this).parents('.wpb_row').hasClass('top-level') && $(this).parents('.parallax_slider_outer').length === 0){
4033            //min height
4034            $heightCal = ( ($(window).height() - $(this).offset().top + 2) <= $minHeight ) ? $minHeight : $(window).height() - $(this).offset().top + 2;
4035            $(this).find('.swiper-container').attr('data-height',$heightCal);
4036            
4037          }
4038          //first parallax slider on page
4039          else if($(this).parents('.first-section').length > 0 && $(this).parents('.parallax_slider_outer').length > 0 && $(this).parents('#full_width_portfolio').length === 0 || 
4040          $(this).parents('.top-level').length > 0 && $(this).parents('.parallax_slider_outer').length > 0 && $(this).parents('#full_width_portfolio').length === 0){ 
4041            
4042            //min height
4043            $heightCal = ( ($(window).height() - $(this).offset().top + 2) <= $minHeight ) ? $minHeight : $(window).height() - $(this).offset().top + 2;
4044            $(this).find('.swiper-container').attr('data-height',$heightCal);
4045            
4046          } 
4047          //first portfolio slider on page
4048          else if($(this).parents('#full_width_portfolio').length > 0 && $(this).attr('data-parallax') != 'true' && $(this).index() === 0){ 
4049            //min height
4050            $heightCal = ( ($(window).height() - $(this).offset().top + 2) <= $minHeight ) ? $minHeight : $(window).height() - $(this).offset().top + 2;
4051            $(this).find('.swiper-container').attr('data-height',$heightCal);
4052            
4053          }
4054          //first portfolio parallax slider on page
4055          else if($(this).parents('#full_width_portfolio').length > 0 && $(this).attr('data-parallax') === 'true'){ 
4056            
4057            //min height
4058            $heightCal = ( ($(window).height() - $(this).offset().top + 2) <= $minHeight ) ? $minHeight : $(window).height() - $(this).offset().top + 2;
4059            $(this).find('.swiper-container').attr('data-height',$heightCal);
4060          }
4061          //all others
4062          else { 
4063            
4064            var headerPadding = parseInt($('#header-outer').attr('data-padding'));
4065            var shrinkNum = 8;
4066            if($('#header-outer[data-shrink-num]').length > 0 ) { 
4067              shrinkNum = $('#header-outer').attr('data-shrink-num'); 
4068            }
4069            
4070            var $resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding*2;
4071            var $headerSize = ($('#header-outer[data-permanent-transparent="false"]').length > 0) ? $('#header-space').height() - $resize-3 : -3;
4072            
4073            if($('#nectar_fullscreen_rows').length > 0 || 
4074            ($('body[data-header-format="left-header"]').length > 0 && window.innerWidth >= 1000)) {
4075              $headerSize = $adminBarHeight;
4076            }
4077            
4078            //min height
4079            $heightCal = ( $(window).height() - $headerSize <= $minHeight ) ? $minHeight : $(window).height() - $headerSize;
4080            $(this).find('.swiper-container').attr('data-height',$heightCal);
4081          }
4082          
4083          //transparent header loading icon center
4084          if($('#header-outer[data-remove-border="true"]').length === 0) {
4085            if($('body #header-outer[data-transparent-header="true"]').length > 0
4086            && $('.first-section .nectar-slider-wrap[data-fullscreen="true"]').length > 0 
4087            && $('#page-header-bg').length === 0) {
4088              
4089              $('.first-section .nectar-slider-loading').css({
4090                'background-image': $loading_bg_storage,
4091                'background-position' : 'center ' + ((($(window).height() /2) + 15) - $('#header-space').height()) +'px'
4092              });
4093              
4094              $('.first-section .nectar-slider-wrap .nectar-slider-loading .loading-icon').css({
4095                'opacity' : '1',
4096                'height' :  $(window).height() - $('#header-space').height() + 'px'
4097              });
4098            }
4099          }
4100          
4101        }
4102        
4103      }
4104      
4105      //flexible height
4106      if($(this).attr('data-flexible-height') === 'true' && 
4107      $(this).attr('data-fullscreen') !== 'true') {
4108        
4109        //escape if not placed in a flexible ready position
4110        if($(this).parents('.wpb_row.full-width-content').length === 0 && 
4111        $(this).attr('data-full-width') === 'false') { 
4112          $(this).attr('data-flexible-height','false'); 
4113          return false; 
4114        }
4115        
4116        $minHeight = $('.swiper-container').attr('data-min-height');
4117        
4118        var currentKey = $existingSliders.nectarGetKeyByValue($(this).attr('id')); 
4119        var $definedHeight = $sliderHeights[currentKey];
4120        
4121        var dif = $(window).width() / 1600;
4122        
4123        if( window.innerWidth > 1000 && $('#boxed').length === 0) {
4124          $(this).find('.swiper-container').attr('data-height',Math.
4124ceil($definedHeight*dif));
4125        } else {
4126          
4127          //column sliders
4128          var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col') ;
4129          if($parentCol.length == 0) $parentCol = $('.main-content');
4130          
4131          if(!$parentCol.hasClass('vc_span12') && 
4132          !$parentCol.hasClass('main-content') && 
4133          !$parentCol.hasClass('span_12') && 
4134          !$parentCol.hasClass('vc_col-sm-12') ) {
4135            
4136            var $parentColWidth = sliderColumnDesktopWidth($parentCol);
4137            var $parentColRatio = 1100/$parentColWidth;
4138            
4139            //min height
4140            if( $definedHeight*dif <= $minHeight ){
4141              $(this).find('.swiper-container').attr('data-height',$minHeight);
4142            } else {
4143              $(this).find('.swiper-container').attr('data-height',Math.ceil($parentColRatio*$definedHeight*dif));	
4144            }
4145            
4146          } 
4147          
4148          
4149          //boxed
4150          else if($('#boxed').length > 0) {
4151            
4152            dif = $('#boxed').width() / 1600;
4153            
4154            if( window.innerWidth > 1300 ) {
4155              
4156              if($('body[data-ext-responsive="true"]').length > 0){
4157                
4158                if($(this).has('[data-full-width="boxed-full-width"]')) {
4159                  ($('#boxed').width() < 1400) ? $(this).find('.swiper-container').attr('data-height',Math.ceil($definedHeight*dif)) : $(this).find('.swiper-container').attr('data-height',$definedHeight*(1400/1600));
4160                  
4161                }
4162                
4163              } else {
4164                
4165                if($(this).has('[data-full-width="boxed-full-width"]')) { 
4166                  $(this).find('.swiper-container').attr('data-height',Math.ceil($definedHeight*(1200/1600)));
4167                }
4168                
4169              }
4170              
4171            } else if( window.innerWidth <= 1300 && window.innerWidth >= 1000  ) {
4172              
4173              if($('body[data-ext-responsive="true"]').length > 0){
4174                $(this).find('.swiper-container').attr('data-height',Math.ceil($definedHeight*dif));
4175              } else {
4176                if($(this).has('[data-full-width="boxed-full-width"]')) {
4177                  $(this).find('.swiper-container').attr('data-height',Math.ceil($definedHeight*(980/1600)));
4178                }
4179              }
4180              
4181            } else if( window.innerWidth < 1000 && window.innerWidth > 690 ) {
4182              
4183              $heightCalc = ( $definedHeight*(679/1600) <= $minHeight ) ? $minHeight : $definedHeight*(679/1600);
4184              if($(this).has('[data-full-width="boxed-full-width"]')) {
4185                $(this).find('.swiper-container').attr('data-height',$minHeight);
4186              }
4187              
4188            } else if( window.innerWidth <= 690 ) {
4189              
4190              $heightCalc = ( $definedHeight*dif <= $minHeight ) ? $minHeight : $definedHeight*dif;
4191              if($(this).has('[data-full-width="boxed-full-width"]')) {
4192                //mobile transparent
4193                if( $(this).parents('.full-width-ns').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 ) {
4194                  $(this).find('.swiper-container').attr('data-height', $height
4194Calc + 50);
4195                } else {
4196                  $(this).find('.swiper-container').attr('data-height', $heightCalc);
4197                }
4198                
4199              }
4200              
4201            } 
4202            
4203          }
4204          
4205          
4206          //regular
4207          else {
4208            
4209            //min height
4210            if( $definedHeight*dif <= $minHeight ){
4211              $(this).find('.swiper-container').attr('data-height',$minHeight);
4212            } else {
4213              
4214              //mobile transparent
4215              if(window.innerWidth < 690 && 
4216                $(this).parents('.full-width-ns').length > 0 &&
4217                $('#header-outer[data-transparent-header="true"]').length > 0 ) {
4218                $(this).find('.swiper-container').attr('data-height',Math.ceil($definedHeight*dif) + 50);
4219              } else {
4220                $(this).find('.swiper-container').attr('data-height',Math.ceil($definedHeight*dif));
4221              }
4222              
4223            }
4224            
4225          }
4226          
4227        }
4228        
4229        
4230        //transparent header loading icon center
4231        if($('body #header-outer[data-transparent-header="true"]').length > 0 && 
4232        $('.first-section .nectar-slider-wrap[data-flexible-height="true"]').length > 0) {
4233          
4234          $('.first-section .nectar-slider-loading').css({
4235            'background-image': $loading_bg_storage,
4236            'background-position' : 'center ' + (((($definedHeight*dif)/2) + 15) - $('#header-space').height()) +'px'
4237          });
4238          
4239          $('.first-section .nectar-slider-wrap .nectar-slider-loading .loading-icon').css({
4240            'opacity' : '1',
4241            'height' :  $definedHeight*dif - $('#header-space').height() + 'px'
4242          });
4243        }
4244        
4245      }
4246    });
4247  }
4248  
4249  var usingMobileBrowser = (navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? true : false;
4250
4251  if(!usingMobileBrowser){
4252
4253    $(window).on('resize', function() {
4254      dynamicHeightSliders();
4255      nsSliderContentResize();
4256    });
4257    $(window).on('smartresize', function(){
4258      setTimeout(function(){
4259        dynamicHeightSliders();
4260        nsSliderContentResize();
4261      }, 100);
4262      
4263    });
4264
4265  } else {
4266    
4267    //stop mobile browsers from firing the resize event on scroll (when toolbar hides)
4268    var $windowWidth = $(window).width(), $windowHeight = $(window).height();
4269    var $orientationChange = 0;
4270    
4271    window.addEventListener("orientationchange", function() {
4272      $orientationChange = 1;
4273    });
4274    
4275    $(window).on('resize', function() {
4276
4277      if( ($(window).width() != $windowWidth && $(window).height != $windowHeight) || $orientationChange == 1) {
4278    
4279        dynamicHeightSliders(); 
4280        nsSliderContentResize();
4281        $(window).trigger('salient-parallax-bg-recalculate');
4282
4283        $windowWidth = $(window).width();
4284        $windowHeight = $(window).height();
4285
4286        $orientationChange = 0;
4287      }
4288    });
4289  }
4290  
4291  setTimeout(function(){
4292    dynamicHeightSliders(); 
4293  },100);
4294  
4295  
4296  ////helper function
4297  function sliderColumnDesktopWidth(parentCol) {
4298    
4299    var $parentColWidth = 1100;
4300    var $columnNumberParsed = $(parentCol).attr('class').match(/\d+/);
4301    
4302    if($columnNumberParsed == '2') { $parentColWidth = 170 }
4303    else if($columnNumberParsed == '3') { $parentColWidth = 260 } 
4304    else if($columnNumberParsed == '4') { $parentColWidth = 340 } 
4305    else if($columnNumberParsed == '6') { $parentColWidth = 530 } 
4306    else if($columnNumberParsed == '8') { $parentColWidth = 700 } 
4307    else if($columnNumberParsed == '9') { $parentColWidth = 805 }
4308    else if($columnNumberParsed == '10') { $parentColWidth = 916.3 }
4309    else if($columnNumberParsed == '12') { $parentColWidth = 1100 }
4310    
4311    return $parentColWidth;
4312  }
4313  
4314  
4315  
4316  $(window).on('resize', sliderSize);
4317  
4318  function sliderSize(){
4319    
4320    //check for mobile first
4321    if( window.innerWidth < 1000 && window.innerWidth > 690 ) {
4322      
4323      var currentKey;
4324      
4325      //fullwidth sliders
4326      $('.nectar-slider-wrap[data-full-width="true"]:not([data-fullscreen="true"],[data-flexible-height="true"])').each(function(){
4327        currentKey = $existingSliders.nectarGetKeyByValue($(this).attr('id')); 
4328        $(this).find('.swiper-container').attr('data-height',$sliderHeights[currentKey]/1.4 )	
4329      });
4330      
4331      //column sliders
4332      $('.nectar-slider-wrap[data-full-width="false"]:not([data-fullscreen="true"]):not([data-flexible-height="true"])').each(function(){
4333        currentKey = $existingSliders.nectarGetKeyByValue($(this).attr('id')); 
4334        
4335        var $currentSliderHeight = $sliderHeights[currentKey];
4336        var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col');
4337        
4338        //fullwidth but inside the span_9 post area
4339        if($(this).parents('.post-area').length > 0 && $(this).parents('.vc_span12').length > 0) $parentCol = $(this).parents('.post-area');
4340        
4341        //last resort
4342        if($parentCol.length === 0) {
4343          $parentCol = $('.main-content');
4344        }
4345        
4346        var $parentColWidth = sliderColumnDesktopWidth($parentCol);
4347        var $aspectRatio = $currentSliderHeight/$parentColWidth;
4348        
4349        $(this).find('.swiper-container').attr('data-height',$aspectRatio*$parentCol.width());
4350        
4351      });
4352      
4353      //boxed sliders
4354      $('.nectar-slider-wrap[data-full-width="boxed-full-width"]:not([data-flexible-height="true"]):not([data-fullscreen="true"])').each(function(){
4355        currentKey = $existingSliders.nectarGetKeyByValue($(this).attr('id')); 
4356        $(this).find('.swiper-container').attr('data-height',$sliderHeights[currentKey]/1.9 )	
4357      });
4358    } 
4359    
4360    else if( window.innerWidth <= 690 ) {
4361      
4362      //fullwidth sliders		
4363      $('.nectar-slider-wrap[data-full-width="true"]:not([data-fullscreen="true"],[data-flexible-height="true"])').each(function(){
4364        currentKey = $existingSliders.nectarGetKeyByValue($(this).attr('id')); 
4365        //mobile transparent.
4366        if($(this).parents('.full-width-ns').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 ) {
4367          $(this).find('.swiper-container').attr('data-height',($sliderHeights[currentKey]/2.7) + 50);
4368        } else {
4369          $(this).find('.swiper-container').attr('data-height',$sliderHeights[currentKey]/2.7 )	
4370        }
4371        
4372      });
4373      
4374      //column sliders
4375      $('.nectar-slider-wrap[data-full-width="false"]:not([data-fullscreen="true"]):not([data-flexible-height="true"])').each(function(){
4376        currentKey = $existingSliders.nectarGetKeyByValue($(this).attr('id')); 
4377        
4378        var $currentSliderHeight = $sliderHeights[currentKey];
4379        var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col');
4380        
4381        //fullwidth but inside the span_9 post area
4382        if($(this).parents('.post-area').length > 0 && $(this).parents('.vc_span12').length > 0) {
4383          $parentCol = $(this).parents('.post-area');
4384        }
4385        
4386        //last resort
4387        if($parentCol.length === 0) {
4388          $parentCol = $('.main-content');
4389        }
4390        
4391        var $parentColWidth = sliderColumnDesktopWidth($parentCol);
4392        
4393        var $aspectRatio = $currentSliderHeight/$parentColWidth;
4394        
4395        $(this).find('.swiper-container').attr('data-height',$aspectRatio*$parentCol.width());	
4396      });
4397      
4398      //boxed sliders		
4399      $('.nectar-slider-wrap[data-full-width="boxed-full-width"]:not([data-flexible-height="true"]):not([data-fullscreen="true"])').each(function(){
4400        currentKey = $existingSliders.nectarGetKeyByValue($(this).attr('id')); 
4401        //mobile transparent.
4402        if($(this).parents('.full-width-ns').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 ) {
4403            $(this).find('.swiper-container').attr('data-height', ($sliderHeights[currentKey]/2.9) + 50 );
4404        }
4405       else {
4406         $(this).find('.swiper-container').attr('data-height',$sliderHeights[currentKey]/2.9 );
4407       }
4408        
4409      });
4410      
4411    } 
4412    
4413    else if( window.innerWidth < 1300 && window.innerWidth >= 1000  ) {
4414      
4415      //fullwidth sliders		
4416      $('.nectar-slider-wrap[data-full-width="true"]:not([data-fullscreen="true"],[data-flexible-height="true"])').each(function(){
4417        currentKey = $existingSliders.nectarGetKeyByValue($(this).attr('id')); 
4418        $(this).find('.swiper-container').attr('data-height',$sliderHeights[currentKey]/1.2 )	
4419      });
4420      
4421      //column sliders
4422      $('.nectar-slider-wrap[data-full-width="false"]:not([data-fullscreen="true"]):not([data-flexible-height="true"])').each(function(){
4423        currentKey = $existingSliders.nectarGetKeyByValue($(this).attr('id')); 
4424        
4425        var $currentSliderHeight = $sliderHeights[currentKey];
4426        var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col') ;
4427        
4428        //fullwidth but inside the span_9 post area
4429        if($(this).parents('.post-area').length > 0 && $(this).parents('.vc_span12').length > 0) {
4430          $parentCol = $(this).parents('.post-area');
4431        }
4432        
4433        if($parentCol.length === 0) {
4434          $parentCol = $('.main-content');
4435        }
4436        
4437        var $parentColWidth = sliderColumnDesktopWidth($parentCol);
4438        var $aspectRatio = $currentSliderHeight/$parentColWidth;
4439        
4440        $(this).find('.swiper-container').attr('data-height',$aspectRatio*$parentCol.width());	
4441        
4442      });
4443      
4444      //boxed sliders		
4445      $('.nectar-slider-wrap[data-full-width="boxed-full-width"]:not([data-flexible-height="true"]):not([data-fullscreen="true"])').each(function(){
4446        currentKey = $existingSliders.nectarGetKeyByValue($(this).attr('id')); 
4447        $(this).find('.swiper-container').attr('data-height',$sliderHeights[currentKey]/1.2 )	
4448      });
4449      
4450    } 
4451    
4452    else {
4453      
4454      //fullwidth sliders
4455      $('.nectar-slider-wrap[data-full-width="true"]:not([data-fullscreen="true"],[data-flexible-height="true"])').each(function(){
4456        currentKey = $existingSliders.nectarGetKeyByValue($(this).attr('id'));
4457        if($(this).attr('data-flexible-height') != 'true') $(this).find('.swiper-container').attr('data-height',$sliderHeights[currentKey])	
4458      });
4459      
4460      //boxed sliders
4461      $('.nectar-slider-wrap[data-full-width="false"]:not([data-fullscreen="true"]), .nectar-slider-wrap[data-full-width="boxed-full-width"]:not([data-flexible-height="true"]):not([data-fullscreen="true"])').each(function(){
4462        currentKey = $existingSliders.nectarGetKeyByValue($(this).attr('id')); 
4463        if($(this).attr('data-flexible-height') != 'true') $(this).find('.swiper-container').attr('data-height',$sliderHeights[currentKey] )	
4464      });
4465    }
4466    
4467  }
4468  
4469  
4470  //remove transform if single slide
4471  $('.nectar-slider-wrap').each(function(){
4472    if($(this).find('.swiper-wrapper .swiper-slide').length == 1) {
4473      $(this).find('.swiper-slide').addClass('no-transform');
4474      $(this).find('.swiper-wrapper').addClass('no-transform');
4475    }
4476  });
4477  
4478  
4479  
4480  //slider height
4481  var min_w = 1500; // minimum video width allowed
4482  var vid_w_orig;  // original video dimensions
4483  var vid_h_orig;
4484  
4485  vid_w_orig = 1280;
4486  vid_h_orig = 720;
4487  var $headerHeight = $('header').height()-1;
4488  
4489  function nsSliderContentResize(){
4490
4491    resizeToCover(); 
4492    slideContentPos(); 
4493    
4494    for(var i=0; i < $nectarSliders.length; i++){
4495      
4496      //make sure the parent is not hidden
4497      if($($nectarSliders[i].container).parent().attr('data-transition') && 
4498      $($nectarSliders[i].container).parent().attr('data-transition') === 'fade') {
4499        
4500        for(var k=0; k < $nectarSliders[i].slides.length; k++){
4501          $nectarSliders[i].setTransition($nectarSliders[i].slides[k], 0);
4502        }
4503        
4504        $('.swiper-wrapper').stop(true,true).css('transition-duration','0s');
4505        
4506        if($('.nectar-slider-loading').css('display') === 'none') {
4507          
4508          $('.swiper-wrapper .swiper-slide.swiper-slide-active .content > *').css({
4509            'opacity': 1,
4510            'transform' : 'translateY(0)'
4511          });
4512        }
4513      }
4514      
4515      $nectarSliders[i].reInit();
4516      $nectarSliders[i].resizeFix();
4517      
4518    }
4519    
4520  }
4521  
4522
4523  
4524  
4525  function resizeToCover() {
4526    $('.nectar-slider-wrap').each(function(i){
4527      
4528      
4529      if( $(this).css('visibility') != 'hidden') {
4530        var $that = $(this);
4531        var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && window.innerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0;
4532        var $windowWidth = $(window).width() - $leftHeaderSize;
4533        
4534        //width resize 
4535        if($('body > #boxed').length === 0 && 
4536        $('.nectar-slider-wrap[data-full-width="true"]').parent().attr('id') != 'portfolio-extra' && 
4537        $(this).parents('.post-area:not(".span_12")').length === 0){ 
4538          $('.nectar-slider-wrap[data-full-width="true"], .parallax_slider_outer.first-section .nectar-slider-wrap').css({'left': -( ($windowWidth-$smoothSrollWidth)/2 - $('.main-content').width()/2), 'margin-left': '0' });
4539          $('.nectar-slider-wrap[data-full-width="true"] .swiper-container, .nectar-slider-wrap[data-full-width="true"], .parallax_slider_outer.first-section .swiper-container, .parallax_slider_outer.first-section .nectar-slider-wrap').css('width',$windowWidth);
4540          
4541        } 
4542        else if( $('.nectar-slider-wrap[data-full-width="true"]').parent().attr('id') === 'portfolio-extra' && 
4543        $('#full_width_portfolio').length !== 0){   
4544          $('.nectar-slider-wrap[data-full-width="true"], .parallax_slider_outer.first-section .nectar-slider-wrap').css({'left': -( ($windowWidth-$smoothSrollWidth)/2 - $('.main-content').width()/2), 'margin-left': '0' });
4545          $('.nectar-slider-wrap[data-full-width="true"] .swiper-container, .nectar-slider-wrap[data-full-width="true"], .parallax_slider_outer.first-section .swiper-container, .parallax_slider_outer.first-section .nectar-slider-wrap').css('width',$windowWidth);
4546        }
4547        else {
4548          var $container = ($('body > #boxed').length === 0) ? '.post-area' : '.container-wrap';
4549          if($($container).width() == '0' && $('body > #boxed').length > 0) $container = '#boxed';
4550          $('.nectar-slider-wrap[data-full-width="true"] .swiper-container, .nectar-slider-wrap[data-full-width="true"], .parallax_slider_outer.first-section .swiper-container, .parallax_slider_outer.first-section .nectar-slider-wrap').css({'width':$($container).width(), 'margin-left': '0'});
4551        }
4552        
4553        
4554        var $sliderHeight = parseInt($(this).find('.swiper-container').attr('data-height'));
4555        var $sliderMinHeight = ( $(this).find('.swiper-container').is('[data-min-height]') && $(this).find('.swiper-container').attr('data-min-height').length > 0 ) ? parseInt($(this).find('.swiper-container').attr('data-min-height')) : 0;
4556        
4557        if($sliderMinHeight > $sliderHeight) { 
4558          $sliderHeight = $sliderMinHeight; 
4559        }
4560        
4561        var isFullWidthCompatible = ($(this).attr('data-full-width') === 'true') ? 'true' : 'false';
4562        
4563        if($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length === 0 || 
4564        $(this).parents('.post-area').length > 0) { 
4565          isFullWidthCompatible = 'false'; 
4566        }
4567        
4568        var $sliderWidth = (isFullWidthCompatible === 'true') ? $windowWidth-$smoothSrollWidth : $(this).width();
4569        
4570        var lrPadding = ( $(this).parents('.span_12').length > 0 && parseInt($(this).parents('.span_12').css('padding-left')) > 0 ) ? true : false;
4571      
4572        if($(this).parents('.full-width-content').length > 0 && 
4573        $(this).parents('.vc_col-sm-12').length > 0 &&
4574         $('#boxed').length === 0 &&
4575         lrPadding === false ) {
4576
4577          $sliderWidth = $windowWidth;
4578
4579          /* nested column setup */
4580          if( $(this).parents('.vc_col-sm-12.child_column').length > 0 ) {
4581    
4582            var parentChildCol = $(this).parents('.vc_col-sm-12.child_column');
4583            if( parentChildCol.parents('.vc_col-sm-12').length == 0 ) {
4584   
4585              $sliderWidth = $that.width();
4586            }
4587          }
4588
4589        }
4590
4591
4592        $(this).parents('.parallax_slider_outer').css('height',$sliderHeight);
4593        $(this).css('height',$sliderHeight);
4594        $(this).find('.swiper-container, .swiper-slide').css({'height':$sliderHeight+1});
4595        $(this).find('.swiper-container').css('width', $sliderWidth);
4596
4597        //when using parallax, let that calc height/width
4598        if(!$(this).is('[data-parallax="true"]')) { 
4599          
4600          // set the video viewport to the window size
4601          $(this).find('.video-wrap').width($sliderWidth+2);
4602          $(this).find('.video-wrap').height($sliderHeight+2);
4603          
4604          
4605          // use largest scale factor of horizontal/vertical
4606          var scale_h = $sliderWidth / vid_w_orig;
4607          var scale_v = ($sliderHeight - $headerHeight) / vid_h_orig; 
4608          var scale = scale_h > scale_v ? scale_h : scale_v;
4609          
4610          //update minium width to never allow excess space
4611          min_w = 1280/720 * ($sliderHeight+20);
4612          
4613          // don't allow scaled width < minimum video width
4614          if (scale * vid_w_orig < min_w) {scale = min_w / vid_w_orig;}
4615          
4616          // now scale the video
4617          $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig +2));
4618          $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig +2));
4619          
4620          // and center it by scrolling the video viewport
4621          $(this).find('.video-wrap').scrollLeft(($(this).find('video').width() - $sliderWidth) / 2);
4622          
4623          $(this).find('.swiper-slide').each(function(){
4624            
4625            //video alignment
4626            if($(this).find('.video-wrap').length > 0){
4627              //align  middle
4628              if($(this).attr('data-bg-alignment') === 'center'){
4629                $(this).find('.video-wrap, .mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($sliderHeight)) / 2);
4630              }
4631              //align bottom
4632              else if($(this).attr('data-bg-alignment') === 'bottom'){
4633                $(this).find('.video-wrap').scrollTop(($(this).find('video').height() - ($sliderHeight+2)));
4634              }
4635              //align top
4636              else {
4637                $(this).find('.video-wrap').scrollTop(0);
4638              } 
4639            }
4640            
4641          });
4642          
4643        } //if visible
4644        
4645      }//parallax
4646    });
4647  }
4648  
4649  ////initial call
4650  resizeToCover();
4651  
4652  
4653  //caption transitions 
4654  function captionTransition(obj){ 
4655    
4656    resizeToCover(); 
4657    
4658    var $containerClass;
4659    
4660    (typeof obj == 'undefined') ? $containerClass = 'div[id^=ns-id-]' : $containerClass = '#'+$(obj.container).parents('.nectar-slider-wrap').attr('id');
4661    
4662    
4663    var fromLeft = Math.abs(parseInt($($containerClass+' .swiper-wrapper').css('left')));
4664    var currentSlide = Math.round(fromLeft/$($containerClass+' .swiper-slide').width()); 
4665    var $slideNum =  $($containerClass+':first .swiper-wrapper > div').length;  
4666    
4667    var captionTransString = $($containerClass).is('[data-caption-trans]') ? $($containerClass).attr('data-caption-trans') : 'fade_in_from_bottom';
4668    
4669    
4670    currentSlide = $($containerClass + ' .swiper-slide-active').index();
4671    
4672    //make sure user isn't going back to same slide 
4673    if( $($containerClass+' .swiper-slide:nth-child('+ (currentSlide + 1) +')').find('.content *').length > 0 && captionTransString !== 'reveal_title') {
4674      if($($containerClass+' .swiper-slide:nth-child('+ (currentSlide + 1) +')').find('.content *').css('opacity') != '0' && !$('html').hasClass('no-video')) {
4675        //play video if there's one
4676        playVideoBG(currentSlide + 1, $containerClass);
4677        
4678        if(!$($containerClass+' .swiper-slide:nth-child('+ (currentSlide + 1) +')').hasClass('autorotate-shown')) {
4679          return false;
4680        } else {
4681          $($containerClass+' .swiper-slide').removeClass('autorotate-shown');
4682        }
4683        
4684      }
4685    } 
4686    
4687    if( $($containerClass+' .swiper-slide:nth-child('+ (currentSlide + 1) +')').find('.content .ns-heading-el').length > 0 && captionTransString === 'reveal_title') {
4688      if($($containerClass+' .swiper-slide:nth-child('+ (currentSlide + 1) +')').find('.content .ns-heading-el .word').css('opacity') != '0' && !$('html').hasClass('no-video')) {
4689        //play video if there's one
4690        playVideoBG(currentSlide + 1, $containerClass);
4691        
4692        if(!$($containerClass+' .swiper-slide:nth-child('+ (currentSlide + 1) +')').hasClass('autorotate-shown')) {
4693          return false;
4694        } else {
4695          $($containerClass+' .swiper-slide').removeClass('autorotate-shown');
4696        }
4697        
4698      }
4699    } 
4700    
4701    //hide all
4702    if(!$('html').hasClass('no-video')) {
4703      if(captionTransString === 'fade_in_from_bottom') {
4704        
4705        if( $($containerClass).parents('.wpb_gallery').length == 0 ) {
4706          anime.remove($containerClass+' .swiper-slide .content p, '+$containerClass+' .swiper-slide .content h2, '+$containerClass+' .swiper-slide .content h1, '+$containerClass+' .swiper-slide .content h3, '+$containerClass+' .swiper-slide .content .buttons');
4707        }
4708        
4709        $($containerClass+' .swiper-slide .content p, '+$containerClass+' .swiper-slide .content h2, '+$containerClass+' .swiper-slide .content h1, '+$containerClass+' .swiper-slide .content h3, '+$containerClass+' .swiper-slide .content .buttons').stop(true,true).css({'opacity':0, 'transform' : 'translateZ(0) translateY(40px)'});
4710      } else if(captionTransString === 'reveal_title') {
4711        
4712        //$($containerClass+' .swiper-slide .content > h1').stop(true,true).css({'opacity': '0'});
4713        //$($containerClass+' .swiper-slide .content > h3').stop(true,true).css({'opacity': '0'});
4714        
4715        $($containerClass+' .swiper-slide .content .ns-heading-el .word').stop(true,true).css({'opacity': '0'});
4716        $($containerClass+' .swiper-slide .content .ns-heading-el .word > [class*="char"]').css({ 'opacity': '0'});
4717        $($containerClass+' .swiper-slide .content .ns-heading-el .word > [class*="char"] > span').css({'transform' : 'scale(0) translateZ(0)'});
4718        
4719        anime.remove($containerClass+' .swiper-slide .content p, '+$containerClass+' .swiper-slide .content .buttons');
4720        $($containerClass+' .swiper-slide .content p, '+$containerClass+' .swiper-slide .content .buttons').stop(true,true).css({'opacity':0, 'transform' : 'translateZ(0) translateY(40px)'});
4721      }
4722      
4723    }
4724    
4725    //pause video if there's one
4726    $($containerClass+' .swiper-slide').each(function(){
4727      if($(this).find('.video-wrap video').length > 0 && !$('html').hasClass('no-video') && !$onMobileBrowser) { 
4728        $(this).find('.video-wrap video').get(0).pause(); 
4729      }
4730    });
4731    
4732    $($containerClass+' .swiper-slide:not(".swiper-slide-active")').each(function(){
4733      if($(this).find('.video-wrap video').length > 0) { 
4734        if($(this).find('.video-wrap video').get(0).currentTime != 0 ){ 
4735          $(this).find('.video-wrap video').get(0).currentTime = 0;
4736        }
4737      }
4738    });
4739    
4740    
4741    if($($containerClass +' .swiper-container').attr('data-loop') === 'true') {
4742      
4743      
4744      //webkit video fix
4745      if(  $($containerClass+' .swiper-slide-active').index()+1 == 2 && 
4746      $($containerClass+' .swiper-slide-active video').length > 0 && 
4747      !$('html').hasClass('no-video') && !$onMobileBrowser) { 
4748        
4749        $($containerClass+' .swiper-slide:last-child').find('.video-wrap video').get(0).play();
4750        $($containerClass+' .swiper-slide:last-child').find('.video-wrap video').get(0).pause();
4751      }
4752      if(  $($containerClass+' .swiper-slide-active').index()+1 == $slideNum-1 && 
4753      $($containerClass+' .swiper-slide-active video').length > 0 && 
4754      !$('html').hasClass('no-video') && !$onMobileBrowser) { 
4755        
4756        $($containerClass+' .swiper-slide:first-child').find('.video-wrap video').get(0).play();
4757        $($containerClass+' .swiper-slide:first-child').find('.video-wrap video').get(0).pause();
4758      }
4759      if($($containerClass+' .swiper-slide-active').index()+1 != 2 && 
4760      $($containerClass+' .swiper-slide:nth-child(2) video').length > 0 && 
4761      !$('html').hasClass('no-video') && !$onMobileBrowser) {
4762        
4763        $($containerClass+' .swiper-slide:last-child').find('.video-wrap video').get(0).play();
4764        $($containerClass+' .swiper-slide:last-child').find('.video-wrap video').get(0).pause();
4765        
4766        $($containerClass+' .swiper-slide:nth-child(2) video').get(0).pause();
4767        if($($containerClass+' .swiper-slide:nth-child(2) video').get(0).currentTime != 0 ) {
4768          $($containerClass+' .swiper-slide:nth-child(2) video').get(0).currentTime = 0;
4769        }
4770      }
4771      
4772      //also show duplicate slide if applicable
4773      if($($containerClass).attr('data-overall_style') != 'directional') {
4774        
4775        ////first
4776        if( $($containerClass+' .swiper-slide-active').index()+1 == $slideNum-1 ){
4777          
4778          $($containerClass+' .swiper-slide:nth-child(1)').find('.content').children().each(function(i){
4779            captionTransAnimation($(this),i,captionTransString); 
4780          });
4781          
4782        }
4783        
4784        ////last
4785        if( $($containerClass+' .swiper-slide-active').index()+1 == 2 ){
4786          $($containerClass+' .swiper-slide:nth-child('+ ($slideNum) + ')').find('.content').children().each(function(i){
4787            captionTransAnimation($(this),i,captionTransString); 
4788          });
4789        }
4790        
4791        
4792        //looped last going to first
4793        if( $($containerClass+' .swiper-slide-active').index()+1 == $slideNum ){
4794          $($containerClass+' .swiper-slide:nth-child(2)').find('.content').children().each(function(i){
4795            captionTransAnimation($(this),i,captionTransString); 
4796          });
4797        }
4798        
4799        //looped first going to last
4800        if( $($containerClass+' .swiper-slide-active').index()+1 == 1 ){  
4801          $($containerClass+' .swiper-slide:eq(-2)').find('.content').children().each(function(i){
4802            captionTransAnimation($(this),i,captionTransString); 
4803          });
4804        }
4805        
4806        
4807      }//directional
4808      
4809      
4810    }//if using loop
4811    
4812    //play video if there's one
4813    setTimeout(function(){ 
4814      playVideoBG($($containerClass + ' .swiper-slide-active').index() + 1, $containerClass); 
4815    },50);
4816    
4817    
4818    //fadeIn active slide
4819    if($($containerClass).attr('data-overall_style') != 'directional') {
4820      $($containerClass+' .swiper-slide:nth-child('+ (currentSlide + 1) +')').find('.content').children().each(function(i){
4821        captionTransAnimation($(this),i,captionTransString);
4822      });
4823    }
4824    
4825    
4826    $captionTrans++;
4827    if($captionTrans == $('.swiper-wrapper').length) { 
4828      $('div.first_video_slide').addClass('nulled'); 
4829    }
4830    
4831    
4832    //slider arrows with preview effect
4833    setTimeout(function(){
4834      
4835      if($('.slider-next').hasClass('next-arrow-move')) {
4836        $('.nectar-slider-wrap[data-button-styling="btn_with_preview"] .swiper-container .slider-next').trigger('mouseenter');
4837      } else if($('.slider-prev').hasClass('prev-arrow-move')) {
4838        $('.nectar-slider-wrap[data-button-styling="btn_with_preview"] .swiper-container .slider-prev').trigger('mouseenter');
4839      }
4840      
4841      
4842      if($($containerClass).attr('data-button-styling') === 'btn_with_preview') {     
4843        $($containerClass+' .swiper-slide').addClass('prev-high-z-index-static');
4844        $($containerClass+' .swiper-slide.swiper-slide-active').removeClass('prev-high-z-index-static');
4845      }
4846      
4847    },175);
4848    
4849    
4850    
4851    
4852  } 
4853  
4854  
4855  function NSsplitLineText() {
4856    $('.nectar-slider-wrap[data-caption-trans="reveal_title"] .content .ns-heading-el').each(function(){
4857      
4858      var storedCSSOpacity = ($(this).parents('.swiper-slide-active').length > 0 && $(this).find('.word').length > 0 ) ? $(this).find('> .word').css('opacity') : '0';
4859      
4860      var textArr = $(this).text();
4861      textArr = textArr.trim();
4862      textArr = textArr.split(' ');
4863      
4864      $(this)[0].innerHTML = '';
4865      
4866      for(var i=0;i<textArr.length;i++) {
4867        $(this)[0].innerHTML += '<span class="word">'+ textArr[i] + '</span> ';
4868      }
4869      
4870      $(this).find('.word').each(function(){
4871        charming($(this)[0]);
4872      });
4873      
4874      $(this).find('[class*="char"]').wrapInner('<span class="char-inner" />');
4875      
4876      if($(this).parents('.swiper-slide-active').length > 0) {
4877        $(this).find('> .word').css('opacity', storedCSSOpacity);
4878      }
4879      
4880    });
4881    
4882  }
4883  
4884  function charming(element, options) {
4885    options = options || {}
4886    element.normalize()
4887    var splitRegex = options.splitRegex
4888    
4889    var tagName = options.tagName || 'span'
4890    var classPrefix = options.classPrefix != null ? options.classPrefix : 'char'
4891    var count = 1
4892    
4893    function inject (element) {
4894      var parentNode = element.parentNode
4895      var string = element.nodeValue
4896      var split = splitRegex ? string.split(splitRegex) : string
4897      var length = split.length
4898      var i = -1
4899      while (++i < length) {
4900        var node = document.createElement(tagName)
4901        if (classPrefix) {
4902          node.className = classPrefix + count
4903          count++
4904        }
4905        node.appendChild(document.createTextNode(split[i]))
4906        node.setAttribute('aria-hidden', 'true')
4907        parentNode.insertBefore(node, element)
4908      }
4909      if (string.trim() !== '') {
4910        parentNode.setAttribute('aria-label', string)
4911      }
4912      parentNode.removeChild(element)
4913    }
4914    
4915    ;(function traverse (element) {
4916      if (element.nodeType === 3) {
4917        return inject(element)
4918      }
4919      
4920      var childNodes = Array.prototype.slice.call(element.childNodes) 
4921      var length = childNodes.length
4922      if (length === 1 && childNodes[0].nodeType === 3) {
4923        return inject(childNodes[0])
4924      }
4925      var i = -1
4926      while (++i < length) {
4927        traverse(childNodes[i])
4928      }
4929    })(element)
4930  }
4931  
4932  NSsplitLineText();
4933
4934  
4935  //caption trans helper
4936  var charCount = 0;
4937  function captionTransAnimation(obj,index,animationName) {
4938    
4939    if(animationName === 'reveal_title') {
4940      
4941      if(obj.parent().find('.word').length === 0) charCount = 0;
4942      
4943      if(index === 0 && obj.parent().find('.word').length > 0) {
4944        
4945        charCount = obj.find('.word > [class*="char"]').length;
4946        
4947        obj.find('.word').css('opacity','1');
4948        
4949        obj.find('.word > [class*="char"]').each(function(i) {
4950          
4951          anime({
4952            targets: $(this)[0],
4953            translateY: [50,0],
4954            translateZ: 0,
4955            opacity: 1,
4956            easing: 'cubicBezier(.25,.25,.1,1)',
4957            duration: 700,
4958            delay: i*18
4959          });
4960          
4961          anime({
4962            targets: $(this).find('> span')[0],
4963            scale: [0,1],
4964            translateZ: 0,
4965            easing: 'cubicBezier(.25,.25,.1,1)',
4966            duration: 700,
4967            delay: i*18
4968          });
4969          
4970          
4971        }); //char loop
4972        
4973        
4974        
4975      } else {
4976        
4977        anime({
4978          targets: obj[0],
4979          translateY: [50,0],
4980          translateZ: 0,
4981          opacity: 1,
4982          easing: 'cubicBezier(.25,.25,.1,1)',
4983          duration: 850,
4984          delay: (index*150 + (charCount*18))
4985        });
4986        
4987      }
4988      
4989      
4990    } else if(animationName === 'fade_in_from_bottom') {
4991      
4992      anime({
4993        targets: obj[0],
4994        translateY: [50,0],
4995        translateZ: 0,
4996        opacity: 1,
4997        easing: 'cubicBezier(.25,.25,.1,1)',
4998        duration: 800,
4999        delay: (index*130)
5000      });
5001      
5002      
5003    }
5004    
5005  }
5006  
5007  //used in caption transition
5008  function playVideoBG(nthChild, containerClass){
5009    
5010    if($(containerClass+' .swiper-slide:nth-child('+ (nthChild) +')').find('.video-wrap video').length > 0){ 
5011      
5012      if(!$('html').hasClass('no-video') && !$onMobileBrowser) {
5013        $(containerClass+' .swiper-slide:nth-child('+ (nthChild) +')').find('.video-wrap video').get(0).play();
5014      }
5015      
5016      if(!$(containerClass+' .swiper-slide:nth-child('+ (nthChild) +')').find('.mejs-overlay.mejs-overlay-play').hasClass('playing') && 
5017      $(containerClass+' .swiper-slide:nth-child('+ (nthChild) +')').find('.mejs-overlay.mejs-overlay-play').hasClass('mobile-played')) { 
5018        $(containerClass+' .swiper-slide:nth-child('+ (nthChild) +')').find('.mejs-overlay.mejs-overlay-play').addClass('playing'); 
5019      }
5020      
5021      if(!$(containerClass+' .swiper-slide:nth-child('+ (nthChild) +')').find('.mejs-poster').hasClass('playing') && 
5022      $(containerClass+' .swiper-slide:nth-child('+ (nthChild) +')').find('.mejs-poster').hasClass('mobile-played')) {
5023        $(containerClass+' .swiper-slide:nth-child('+ (nthChild) +')').find('.mejs-poster').addClass('playing');
5024      }
5025      
5026      var $that = $(containerClass+' .swiper-slide:nth-child('+ (nthChild) +')').find('.mejs-overlay.mejs-overlay-play');
5027      var $that2 = $(containerClass+' .swiper-slide:nth-child('+ (nthChild) +')').find('.mejs-poster');
5028      
5029      if($that.hasClass('playing') && $that.hasClass('mobile-played')) {
5030        setTimeout(function(){ 
5031          $that.addClass('behind-buttons'); 
5032          $that2.addClass('behind-buttons');},200);
5033      } else {
5034        $that.removeClass('behind-buttons'); 
5035        $that2.removeClass('behind-buttons');
5036      }
5037    }
5038    
5039  }
5040  
5041  
5042  function slideContentPos() {
5043    
5044    $('.swiper-wrapper').each(function(){
5045      
5046      var $sliderHeight = parseInt($(this).parents('.swiper-container').attr('data-height'));
5047      var $minimumHeight = ($(this).parents('.swiper-container').css('min-height')) ? parseInt($(this).parents('.swiper-container').css('min-height')) : 0;
5048      
5049      // min height addition
5050      if($minimumHeight > $sliderHeight) {
5051        $sliderHeight = $minimumHeight;
5052      }
5053      
5054      var $transparentHeader = ($('#header-outer[data-transparent-header="true"]').length > 0) ? $('#header-outer').height() : 0;
5055      
5056      if($(this).parents('.first-section').length == 0 && $(this).parents('.top-level').length == 0 || window.innerWidth < 1000) { 
5057        $transparentHeader = 0;
5058      } else if($transparentHeader != 0 && $('#header-outer[data-remove-border="true"]').length > 0){
5059        $transparentHeader = $transparentHeader/2
5060      }
5061      
5062      
5063      if($(this).parents('.swiper-container[data-bullet_position="right"][data-bullets="true"]').length > 0 && $transparentHeader > 0 || 
5064      $(this).parents('.swiper-container[data-bullet_position="left"][data-bullets="true"]').length > 0 && $transparentHeader > 0) {
5065        
5066        var secondaryHeaderHeight = ($('#header-secondary-outer').length > 0) ? $('#header-secondary-outer').height() : 0;
5067        $(this).parents('.swiper-container').find('.slider-pagination-wrap').css({
5068          'margin-top': ($transparentHeader + secondaryHeaderHeight)/2
5069        });
5070      }
5071      
5072      $(this).find('.swiper-slide').each(function(){
5073        
5074        var $contentHeight2 = 0;
5075        
5076        $(this).find('.content > *').each(function(){
5077          $contentHeight2 += $(this).height() + parseInt($(this).css('margin-bottom')) + parseInt($(this).css('padding-bottom')); 
5078        });
5079        
5080        if($(this).attr('data-y-pos') === 'top' && window.innerWidth > 690 ){
5081          var secondaryHeaderHeight = ($('#header-secondary-outer').length > 0) ? $('#header-secondary-outer').height() : 0;
5082          var $topHeight = ($transparentHeader > 0) ? $transparentHeader + secondaryHeaderHeight + 60 : 60;
5083          $(this).find('.content').css('top', $topHeight + 'px');
5084        } 
5085        
5086        else if($(this).attr('data-y-pos') === 'middle' || window.innerWidth <= 690) {
5087
5088          $(this).find('.content').css('top', ((($sliderHeight + $transparentHeader)/2) - ($contentHeight2/2)) + 'px');
5089        } 
5090        
5091        else {
5092          $(this).find('.content').css({'bottom': '75px', 'top': 'auto'});
5093        }
5094        
5095      });
5096    });
5097  }
5098  
5099  
5100  
5101  function showSliderControls() {
5102    $('.swiper-container .slider-prev, .swiper-container .slider-next, .slider-pagination').animate({'opacity':1},550,'easeOutCubic');
5103  }
5104  
5105  
5106  
5107  function sliderLoadIn(slider,index) { 
5108    
5109    slider.find('.nectar-slider-loading').fadeOut(800,'easeInOutExpo');
5110    
5111    setTimeout(function(){
5112      slider.find('.nectar-slider-loading').css('display','none');
5113    },1000);
5114    
5115    $('.nectar-slider-wrap.first-section .swiper-container .swiper-wrapper .swiper-slide').removeClass('not-loaded');
5116    
5117    slider.find('span.ie-fix').remove();
5118    
5119    //ar visualized start
5120    if(slider.find('.swiper-container[data-bullet_style="see_through_ar_visualized"][data-bullets="true"]').length > 0) {
5121      slider.find('.swiper-active-switch').removeClass('ar-vis');
5122      setTimeout(function(){
5123        slider.parent().find('.swiper-active-switch').addClass('ar-vis');
5124      },50);  
5125    }
5126    
5127    
5128    sliderLoadedLength++;
5129 
5130    
5131    
5132    if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)) { autorotateInit(slider,index); }
5133    
5134  }
5135  
5136  
5137  
5138  //play video user is hovering over
5139  $('body').on('mouseover','.swiper-slide', function(){
5140    if(!$onMobileBrowser && 
5141      $(this).find('video').length > 0 && 
5142      $(this).find('video').get(0).paused == true && 
5143      $animating == false){
5144      $(this).find('video').get(0).play();
5145    }
5146  });
5147  
5148  
5149  //mobile play event
5150  $('body').on('click', '.mejs-overlay.mejs-overlay-play',function(){
5151    $(this).toggleClass('playing');
5152    $(this).addClass('mobile-played');
5153    
5154    $(this).parent().find('.mejs-poster').toggleClass('playing');
5155    $(this).parent().find('.mejs-poster').addClass('mobile-played');
5156    
5157    var $that = $(this);
5158    var $that2 = $(this).parent().find('.mejs-poster');
5159    
5160    if($(this).hasClass('playing') && $(this).hasClass('mobile-played')) {
5161      
5162      setTimeout(function(){ 
5163        $that.addClass('behind-buttons'); 
5164        $that2.addClass('behind-buttons'); 
5165      },200);
5166    } else {
5167      setTimeout(function(){ 
5168        $that.removeClass('behind-buttons'); 
5169        $that2.removeClass('behind-buttons'); 
5170      },1);
5171    }
5172  }); 
5173  
5174  
5175  function autorotateInit(slider,num) {
5176    
5177    var $autoplayVal = slider.attr('data-autorotate');
5178    var $sliderNum = num;
5179    
5180    if(typeof $autoplayVal !='undefined' && 
5181    $autoplayVal.length != '0' && parseInt($autoplayVal)) { 
5182      nectarSlideRotateInit(slider,$autoplayVal,$sliderNum);
5183      
5184    }	
5185
5186  }
5187  
5188  
5189  function nectarSlideRotateInit(slider,interval,sliderNum){
5190    
5191    autoplay[sliderAutoplayCount] = { 
5192      interval: setInterval(function(){ nectarSlideRotate(slider, sliderNum); } ,interval), 
5193      nectarSliderNum: sliderNum, 
5194      autoplayNum: sliderAutoplayCount, 
5195      nectarSliderID: slider.attr('id') 
5196    };
5197    
5198    $('#'+slider.attr('id')).attr('autoplay-id',sliderAutoplayCount);
5199    
5200    //ar visualized style
5201    if( $('#'+slider.attr('id')).find('[data-bullet_style="see_through_ar_visualized"]').length > 0 ) {
5202      $('#'+slider.attr('id')).find('.slider-pagination svg circle.time').css('transition', 'stroke-dashoffset '+ (parseInt(interval) + 100) +'ms linear, stroke 0.2s ease');
5203    }
5204    
5205    var sliderClosure = slider;
5206    var sliderAutoplayCountClosure = sliderAutoplayCount;
5207    var intervalClosure = interval;
5208    var sliderNumClosure = sliderNum;
5209    
5210    
5211    $('#'+slider.attr('id') + ' a.slider-prev, #'+slider.attr('id') + ' a.slider-next, #' + slider.attr('id') + ' .slider-pagination span:not(.swiper-active-switch)').on('click', function(){ 
5212      
5213      nectarSlideRotateReset(sliderClosure, sliderAutoplayCountClosure, intervalClosure, sliderNumClosure);
5214      
5215    });
5216    
5217    sliderAutoplayCount++;
5218  }
5219  
5220  
5221  function nectarSlideRotateReset(slider, sliderAutoplayCount, interval,sliderNum){
5222    
5223    slider = (typeof slider.activeIndex === 'undefined') ? slider : $(slider.container).parent();
5224    
5225    sliderAutoplayCount = (typeof sliderAutoplayCount !== 'undefined' && typeof sliderAutoplayCount === 'number') ? sliderAutoplayCount : 'unknown';
5226    
5227    if( sliderAutoplayCount === 'unknown') {
5228      
5229      $.each(autoplay,function(k,v){
5230        
5231        if( $('body').find('#' + v.nectarSliderID).length > 0 && v.nectarSliderID == $(slider).attr('id') ) {
5232          
5233          sliderAutoplayCount = v.autoplayNum;
5234          interval = ($('body').find('#' + v.nectarSliderID).attr('data-autorotate').length > 0 && parseInt($('body').find('#' + v.nectarSliderID).attr('data-autorotate')) > 1000) ? $('body').find('#' + v.nectarSliderID).attr('data-autorotate') : 4000;
5235          sliderNum = v.nectarSliderNum;
5236          
5237        }
5238        
5239      });
5240    }
5241    
5242    
5243    
5244    //only reset and restart when slider was found and link was made
5245    if( sliderAutoplayCount !== 'unknown') {
5246      clearInterval(autoplay[$('#'+slider.attr('id')).attr('autoplay-id')].interval); 
5247      autoplay[sliderAutoplayCount].interval = setInterval(function(){ nectarSlideRotate(slider, sliderNum); } ,interval);
5248    }
5249    
5250    
5251  }
5252  
5253  
5254  
5255  var resetTouchIndex = 1;
5256  var resetTouchIndexLast = 'unknown';
5257  
5258  function nectarSlideRotateResetTouch(slider){
5259    
5260    
5261    //if user has not dragged any significant distance
5262    if(Math.abs(slider.touches.diff) < 15) { return } 
5263    
5264    //first time run set last index
5265    if(resetTouchIndexLast == 'unknown' && $(slider.container).is('[data-loop="true"]')) {
5266      resetTouchIndexLast = 1;
5267    } else if(resetTouchIndexLast == 'unknown') {
5268      resetTouchIndexLast = 0;
5269    }
5270    
5271    resetTouchIndex = slider.activeIndex;
5272    
5273    nectarSlideRotateReset(slider);
5274    
5275    //if going back to same slide on touch - reset visualization
5276    if($(slider.container).is('[data-bullets="true"][data-bullet_style="see_through_ar_visualized"]') && resetTouchIndex == resetTouchIndexLast) {
5277      var dotIndexStored = $(slider.container).find('.ar-vis').index();
5278      
5279      $(slider.container).find('.ar-vis').removeClass('ar-vis');
5280      setTimeout(function(){
5281        $(slider.container).find('.slider-pagination > span:nth-child('+ (dotIndexStored + 1) +')').addClass('ar-vis');
5282      },50);
5283      
5284      
5285    }  
5286    
5287    resetTouchIndexLast = slider.activeIndex;
5288    
5289  }
5290  
5291  
5292  
5293  
5294  function nectarSlideRotate(slider, sliderNum){
5295
5296
5297    if($(slider).hasClass('out-of-view')) {
5298      return true;
5299    }
5300
5301    if($('#nectar_fullscreen_rows').length > 0) {
5302      if($(slider).parents('.wpb_row.active').length == 0) {
5303        return true;
5304      }
5305    }
5306    //non looped
5307    if($nectarSliders[sliderNum].activeIndex + 1 < $(slider).find('.swiper-wrapper > div.swiper-slide').length){
5308      
5309      //btn with preview hover effect clear
5310      if($(slider).attr('data-button-styling') === 'btn_with_preview') {    
5311        $(slider).find('.swiper-slide').removeClass('high-z-index').removeClass('prev-high-z-index');
5312        $(slider).find('.swiper-slide').removeClass('next-move').removeClass('prev-move');
5313      }
5314      
5315      //classic style
5316      if($(slider).attr('data-overall_style') != 'directional') {
5317        $nectarSliders[sliderNum].updateActiveSlide();
5318        $nectarSliders[sliderNum].swipeNext();
5319        
5320      } else {
5321        //directional based
5322        $($nectarSliders[sliderNum].container).find('.slider-next').trigger('click');
5323      }
5324      
5325    } else {
5326     
5327      //looped sliders
5328      if($(slider).find('.swiper-container').is("[data-loop]") && $(slider).find('.swiper-container').attr('data-loop') === 'true') {
5329        
5330        //classic style
5331        if($(slider).attr('data-overall_style') != 'directional') {
5332          $nectarSliders[sliderNum].swipeNext();
5333        } else {
5334          //directional based
5335          $($nectarSliders[sliderNum].container).find('.slider-next').trigger('click');
5336        } 
5337        
5338      } 
5339      //regular sliders
5340      else {
5341        
5342        if($(slider).attr('data-overall_style') != 'directional') {
5343          $nectarSliders[sliderNum].swipeTo(0,550);
5344        } else {
5345          $(slider).find('.swiper-container').addClass('directional-trans-prev');
5346          $nectarSliders[sliderNum].swipeTo(0,550);
5347          var $timeout2;     
5348          clearTimeout($timeout2);
5349          $timeout2 = setTimeout(function(){ onChangeStart($nectarSliders[sliderNum]); } ,100);
5350        }
5351        
5352      }
5353    }
5354  }
5355  
5356  function clearAutoplay(e){ 
5357    var $autoplayVal = $('#'+$(e.container).parent().attr('id')).attr('data-autorotate');
5358    
5359    if(typeof $autoplayVal !='undefined' && $autoplayVal.length != '0' && parseInt($autoplayVal)) {
5360      
5361      clearInterval(autoplay[$('#'+$(e.container).parent().attr('id')).attr('autoplay-id')].interval); 
5362    }
5363  }
5364  
5365  
5366  function onChangeStart(e){
5367    //cache slider obj
5368    var $obj = e;
5369    
5370    $animating = true;
5371    
5372    var $slideNum = $($obj.container).find('.swiper-wrapper > div').length;
5373    
5374    //one for effects and one for basic slide arrow count 
5375    var $activeIndex = ($($obj.container).attr('data-loop') === 'true') ? $obj.activeIndex + 1: $obj.activeIndex+1;
5376    var $activeIndex2 = ($($obj.container).attr('data-loop') === 'true') ? $obj.activeIndex: $obj.activeIndex+1;
5377    
5378    if(isNaN($activeIndex)) {
5379      $activeIndex = 1;
5380    }
5381    if(isNaN($activeIndex2)) {
5382      $activeIndex2 = 1;
5383    }
5384
5385    //dark slide header 
5386    if($($obj.container).parent().attr('data-overall_style') !== 'directional') {
5387      if( $($obj.container).parents('.first-section').length > 0 && $($obj.container).find('.swiper-slide-active[data-color-scheme="dark"]').length > 0 ||
5388      $('#nectar_fullscreen_rows').length > 0 && $($obj.container).find('.swiper-slide-active[data-color-scheme="dark"]').length > 0) {
5389        $('#header-outer').addClass('dark-slide');
5390      } else if( $($obj.container).parents('.first-section').length > 0 || $('#nectar_fullscreen_rows').length > 0) {
5391        $('#header-outer').removeClass('dark-slide');
5392      }
5393    } 
5394    ////directional trans - will be called early so need to adjust the slide being looked for
5395    else {
5396      if($($obj.container).hasClass('directional-trans-next')) {
5397        
5398        if($($obj.container).parents('.first-section').length > 0 && $($obj.container).find('.swiper-slide-active').next('.swiper-slide').is('[data-color-scheme="dark"]') ) {
5399          $('#header-outer').addClass('dark-slide');
5400        } else {
5401          $('#header-outer').removeClass('dark-slide');
5402        }
5403      } 
5404      
5405      else if($($obj.container).hasClass('directional-trans-prev')) {
5406        if( $($obj.container).parents('.first-section').length > 0 && $($obj.container).find('.swiper-slide-active').prev('.swiper-slide').is('[data-color-scheme="dark"]') ) {
5407          $('#header-outer').addClass('dark-slide');
5408        } else {
5409          $('#header-outer').removeClass('dark-slide');
5410        }
5411      }
5412      
5413      else if($($obj.container).hasClass('directional-trans-current')) {
5414        if( $($obj.container).parents('.first-section').length > 0 && $($obj.container).find('.swiper-slide-active').is('[data-color-scheme="dark"]') ) {
5415          $('#header-outer').addClass('dark-slide');
5416        } else {
5417          $('#header-outer').removeClass('dark-slide');
5418        }
5419      }
5420      
5421      
5422    }
5423    
5424    //light and dark controls
5425    if($($obj.container).parent().attr('data-overall_style') != 'directional') {
5426      if($($obj.container).find('.swiper-slide:nth-child('+ ($activeIndex) +')').attr('data-color-scheme') === 'dark') {
5427        $($obj.container).find('.slider-pagination').addClass('dark-cs');
5428        $($obj.container).find('.slider-prev, .slider-next').addClass('dark-cs');
5429      } else {
5430        $($obj.container).find('.slider-pagination').removeClass('dark-cs');
5431        $($obj.container).find('.slider-prev, .slider-next').removeClass('dark-cs');
5432      }
5433    } 
5434    ////directional trans - will be called early so need to adjust the slide being looked for
5435    else {
5436      if($($obj.container).hasClass('directional-trans-next')) {
5437        if($($obj.container).find('.swiper-slide:nth-child('+ ($activeIndex+1) +')').attr('data-color-scheme') === 'dark') {
5438          $($obj.container).find('.slider-pagination').addClass('dark-cs');
5439          $($obj.container).find('.slider-prev, .slider-next').addClass('dark-cs');
5440        } else {
5441          $($obj.container).find('.slider-pagination').removeClass('dark-cs');
5442          $($obj.container).find('.slider-prev, .slider-next').removeClass('dark-cs');
5443        }
5444      } else if($($obj.container).hasClass('directional-trans-prev')) {
5445        if($($obj.container).find('.swiper-slide:nth-child('+ ($activeIndex-1) +')').attr('data-color-scheme') === 'dark') {
5446          $($obj.container).find('.slider-pagination').addClass('dark-cs');
5447          $($obj.container).find('.slider-prev, .slider-next').addClass('dark-cs');
5448        } else {
5449          $($obj.container).find('.slider-pagination').removeClass('dark-cs');
5450          $($obj.container).find('.slider-prev, .slider-next').removeClass('dark-cs');
5451        }
5452        
5453      } else if($($obj.container).hasClass('directional-trans-current')) {
5454        if($($obj.container).find('.swiper-slide:nth-child('+ ($activeIndex) +')').attr('data-color-scheme') === 'dark') {
5455          $($obj.container).find('.slider-pagination').addClass('dark-cs');
5456          $($obj.container).find('.slider-prev, .slider-next').addClass('dark-cs');
5457        } else {
5458          $($obj.container).find('.slider-pagination').removeClass('dark-cs');
5459          $($obj.container).find('.slider-prev, .slider-next').removeClass('dark-cs');
5460        }
5461        
5462      }
5463    }
5464    
5465    
5466    $($obj.container)
5467      .find('.swiper-slide .video-texture')
5468      .removeClass('no-trans')
5469      .removeClass('light-overlay')
5470      .removeClass('dark-overlay')
5471      .removeClass('half-dark-overlay')
5472      .removeClass('half-light-overlay');
5473    
5474    //add slide counts
5475    $($obj.container).find('.slider-prev .slide-count .slide-current').html( $activeIndex2 );
5476    $($obj.container).find('.slider-next .slide-count .slide-current').html( $activeIndex2 );
5477    
5478    if($($obj.container).attr('data-loop') === 'true'){
5479      //duplicate first slide
5480      if( $($obj.container).find('.swiper-slide-active').index()+1 == 1) { 
5481        $($obj.container).find('.slider-next .slide-count .slide-current, .slider-prev .slide-count .slide-current').html( $slideNum - 2 );
5482      }
5483      //duplicate last slide
5484      else if( $($obj.container).find('.swiper-slide-active').index()+1 == $slideNum) {
5485        $($obj.container).find('.slider-next .slide-count .slide-current, .slider-prev .slide-count .slide-current').html( 1 );
5486      }
5487    }
5488    
5489    if($obj.activeIndex >= 10) { $($obj.container).find('.slider-next .slide-count .slide-current').addClass('double-digits'); } else {
5490      $($obj.container).find('.slider-next .slide-count .slide-current').removeClass('double-digits');
5491    }
5492    
5493    
5494    //don't allow swiping on duplicate transition
5495    if($($obj.container).attr('data-loop') === 'true'){
5496      if($obj.previousIndex == 1 && $obj.activeIndex == 0 || $obj.previousIndex == $slideNum - 2 && $obj.activeIndex == $slideNum - 1 ){
5497        $('.swiper-slide').addClass('duplicate-transition');	
5498      }
5499    }
5500    
5501    
5502    //reset ken_burns
5503    
5504    var sliderIndex = 0;
5505    
5506    slideAnimationQueues.forEach(function(val,index) {
5507      if(typeof val === 'undefined') return;
5508      
5509      if( val.sliderID == $($obj.container).parent().attr('id') )  {
5510        sliderIndex = index;
5511      }
5512      
5513    });
5514    
5515    
5516    if($($obj.container).parent().is('[data-bg-animation="ken_burns"]') && $($obj.container).parents('.nectar-slider-wrap[data-overall_style="directional"]').length === 0 ) {
5517      $($obj.container).find('.swiper-slide').addClass('ken-burns');
5518      clearTimeout(slideAnimationQueues[sliderIndex].kenBurnsInterval);
5519      slideAnimationQueues[sliderIndex].kenBurnsInterval = setTimeout(function(){
5520        $($obj.container).find('.swiper-slide:not(".swiper-slide-active")').removeClass('ken-burns');
5521      },600);
5522    }
5523    
5524    
5525    var nsTimeout = ($($obj.container).parents('.nectar-slider-wrap[data-transition="fade"]').length > 0) ? 350 : 525;
5526    
5527    clearTimeout(slideAnimationQueues[sliderIndex].captionInterval);
5528    if($($obj.container).parents('.nectar-slider-wrap[data-overall_style="directional"]').length === 0) {
5529      
5530      slideAnimationQueues[sliderIndex].captionInterval = setTimeout(function(){ 
5531        
5532        $animating = false; 
5533        
5534        if( $($obj.container).attr('data-loop') === 'true' ) {
5535          $('.swiper-slide').removeClass('duplicate-transition');
5536          
5537          $.each($nectarSliders,function(k){
5538            $nectarSliders[k].updateActiveSlide();
5539            $nectarSliders[k].fixLoop(); 
5540          });
5541        }
5542        
5543        captionTransition($obj);
5544        
5545      },nsTimeout);
5546      
5547    }
5548    
5549    
5550  }
5551  
5552
5553  // Create cross browser requestAnimationFrame method:
5554  window.requestAnimationFrame = window.requestAnimationFrame
5555  || window.mozRequestAnimationFrame
5556  || window.webkitRequestAnimationFrame
5557  || window.msRequestAnimationFrame
5558  || function(f){setTimeout(f, 1000/60)}
5559  
5560  var $sliderHeight;
5561  function sliderParallaxUpdateHeight(){
5562    $sliderHeight = parseInt($('.parallax_slider_outer.first-section .swiper-container').attr('data-height'));
5563  }
5564  
5565  
5566  var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').height();
5567  
5568  function sliderParallaxInit() {
5569    
5570    if($('#portfolio-extra').length > 0 && $('#full_width_portfolio').length === 0) { 
5571      return false; 
5572    }
5573    
5574    $('.parallax_slider_outer').addClass('element-in-view');
5575    
5576    
5577    if(!$onMobileBrowser) {
5578
5579      //caption alignment if portfolio fullwidth parallax
5580      if($('.project-title.parallax-effect').length > 0) {
5581        $('.parallax_slider_outer.first-section .swiper-slide .content, .nectar-slider-wrap.first-section .swiper-slide .content').css('margin-top','0px');
5582        $('.swiper-container .slider-prev, .swiper-container .slider-next').css('margin-top','-28px');
5583      }
5584      
5585      //if using wooCommerce sitewide notice
5586      if($('.demo_store').length > 0) $('.project-title.parallax-effect').css('margin-top','-25px');
5587      
5588      if($('#full_width_portfolio').length > 0){
5589        $('.parallax_slider_outer.first-section').css('margin-top','93px');
5590      }
5591      
5592      $(window).off('resize.nsHeightUpdate');
5593      $(window).on('resize.nsHeightUpdate',sliderParallaxUpdateHeight);
5594    }
5595    
5596  } 
5597  
5598  //parallax
5599  function parallaxCheck(){
5600    
5601    $(window).off('scroll.nsParallaxScroll'); 
5602    
5603    if($('.parallax_slider_outer').length > 0){
5604      sliderParallaxInit();
5605      if($('body[data-hhun="1"]').length > 0 && !$('#header-outer[data-remove-fixed="1"]').length > 0) {
5606        $('#header-outer').addClass('parallax-contained');
5607      }
5608      
5609    } 
5610  }
5611  parallaxCheck();
5612  
5613  //pause video backgrounds if popup video player is started
5614  $('.portfolio-items a.pp:contains(Video), .swiper-container .buttons a.pp').on('click', function(){
5615    $('.swiper-slide').each(function(){
5616      if($(this).find('.video-wrap video').length > 0) { 
5617        $(this).find('.video-wrap video').get(0).pause();
5618      }
5619    });
5620  });
5621  
5622  
5623  //solid button hover effect
5624  function hexConvert(x) {
5625    return ("0" + parseInt(x).toString(16)).slice(-2);
5626  }
5627  
5628  $.cssHooks.backgroundColor = {
5629    get: function(elem) {
5630      var bg;
5631      
5632      if (elem.currentStyle) {
5633        bg = elem.currentStyle["backgroundColor"];
5634      }
5635      else if (window.getComputedStyle) {
5636        bg = document.defaultView.getComputedStyle(elem,null).getPropertyValue("background-color");
5637      }
5638      
5639      if (bg.search("rgb") == -1) {
5640        return bg;
5641      }
5642      else {
5643        bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
5644        if(bg) {
5645          return "#" + hexConvert(bg[1]) + hexConvert(bg[2]) + hexConvert(bg[3]);
5646        }
5647      }
5648    }
5649  }
5650
5651    
5652    //nectar slider external links
5653    $('.swiper-slide.external-full-link a.entire-slide-link').attr('target', '_blank');
5654    $('.swiper-slide.external-button-1 .buttons > div:nth-child(1) a').attr('target', '_blank');
5655    $('.swiper-slide.external-button-2 .buttons > div:nth-child(2) a').attr('target', '_blank');
5656    
5657    //headerPadding/shinkNum moved up before fullscreen calcs
5658    headerPadding = headerPadding - headerPadding/1.8;
5659    
5660    $('body').on('click','.slider-down-arrow',function(){
5661      
5662      //within full page row
5663      if($(this).parents('#nectar_fullscreen_rows').length > 0) {
5664        if($('#fp-nav li .active').parent().next('li').length > 0) {
5665          $('#fp-nav li .active').parent().next('li').find('a').trigger('click');
5666        }
5667        return;
5668      }
5669      
5670      var $currentSlider = $(this).parents('.swiper-container');
5671      var $topDistance = $currentSlider.attr('data-height');
5672      var $offset = ($currentSlider.parents('.first-section').length === 0 || $('#header-outer[data-transparent-header="true"]').length === 0) ? $currentSlider.offset().top : 0;
5673      var materialSecondary = 0;
5674      
5675      if($('body.material').length > 0 && $('#header-secondary-outer').length > 0) { materialSecondary = $('#header-secondary-outer').height(); }
5676      
5677      if($('body[data-permanent-transparent="1"]').length === 0) {
5678        //regular
5679        if(!$('body').hasClass('mobile')){
5680          
5681          //hhun
5682          if($('body[data-hhun="1"]').length > 0) {
5683            $('body,html').stop().animate({
5684              scrollTop: parseInt($topDistance) + $offset + 2
5685            },1000,'easeInOutCubic')
5686          } else {
5687            
5688            
5689            if( $('#header-outer[data-condense="true"]').length > 0) {
5690              
5691              var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
5692              var $secondaryHeaderHeight = ($('#header-secondary-outer').length > 0) ? $('#header-secondary-outer').height() : 0;
5693              
5694              $headerNavSpace = $('#header-outer').height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top')) ) - parseInt($secondaryHeaderHeight);
5695              
5696              $('body,html').stop().animate({
5697                scrollTop: parseInt($topDistance - $headerNavSpace) + 2
5698              },1000,'easeInOutCubic');
5699              
5700            } else {
5701              
5702              $('body,html').stop().animate({
5703                scrollTop: parseInt($topDistance - $('#header-space').height()) + parseInt(shrinkNum) + headerPadding*2 + $offset + 2 + materialSecondary
5704              },1000,'easeInOutCubic');
5705              
5706            }
5707            
5708            
5709          }
5710          
5711        } else {
5712          var $scrollPos = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? parseInt($topDistance) - $('#header-space').height() + parseInt($currentSlider.offset().top) + 2 : parseInt($topDistance) + parseInt($currentSlider.offset().top) + 2;
5713          $('body,html').stop().animate({
5714            scrollTop: $scrollPos
5715          },1000,'easeInOutCubic')
5716        }
5717      } else {
5718        //permanent transparent
5719        $('body,html').stop().animate({
5720          scrollTop: parseInt($topDistance) + parseInt($currentSlider.offset().top) + 2
5721        },1000,'easeInOutCubic')
5722      }
5723      return false;
5724    });
5725    
5726    
5727    
5728  });

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.