PageSourceSearch

https://www.deox.it/wp-content/themes/salient/js/build/third-party/jquery.fullPage.min.js?ver=16.1.0

js deox.it collected 2026-10-05 23:20:39 UTC 183,269 bytes, 4,382 lines download raw bytes

1
2/*! iScroll v5.2.0 ~ (c) 2008-2016 Matteo Spinelli ~ http://cubiq.org/license */
3(function(g, q, f) {
4    function p(a, b) {
5        this.wrapper = "string" == typeof a ? q.querySelector(a) : a;
6        this.scroller = this.wrapper.children[0];
7        this.scrollerStyle = this.scroller.style;
8        this.options = {
9            resizeScrollbars: !0,
10            mouseWheelSpeed: 20,
11            snapThreshold: .334,
12            disablePointer: !d.hasPointer,
13            disableTouch: d.hasPointer || !d.hasTouch,
14            disableMouse: d.hasPointer || d.hasTouch,
15            startX: 0,
16            startY: 0,
17            scrollY: !0,
18            directionLockThreshold: 5,
19            momentum: !0,
20            bounce: !0,
21            bounceTime: 600,
22            bounceEasing: "",
23            preventDefault: !0,
24            preventDefaultException: {
25                tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/
26            },
27            HWCompositing: !0,
28            useTransition: !0,
29            useTransform: !0,
30            bindToWrapper: "undefined" === typeof g.onmousedown
31        };
32        for (var c in b) this.options[c] = b[c];
33        this.translateZ = this.options.HWCompositing && d.hasPerspective ? " translateZ(0)" : "";
34        this.options.useTransition = d.hasTransition && this.options.useTransition;
35        this.options.useTransform = d.hasTransform && this.options.useTransform;
36        this.options.eventPassthrough = !0 === this.options.eventPassthrough ? "vertical" : this.options.eventPassthrough;
37        this.options.preventDefault = !this.options.eventPassthrough &&
38            this.options.preventDefault;
39        this.options.scrollY = "vertical" == this.options.eventPassthrough ? !1 : this.options.scrollY;
40        this.options.scrollX = "horizontal" == this.options.eventPassthrough ? !1 : this.options.scrollX;
41        this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough;
42        this.options.directionLockThreshold = this.options.eventPassthrough ? 0 : this.options.directionLockThreshold;
43        this.options.bounceEasing = "string" == typeof this.options.bounceEasing ? d.ease[this.options.bounceEasing] || d.ease.circular :
44            this.options.bounceEasing;
45        this.options.resizePolling = void 0 === this.options.resizePolling ? 60 : this.options.resizePolling;
46        !0 === this.options.tap && (this.options.tap = "tap");
47        this.options.useTransition || this.options.useTransform || /relative|absolute/i.test(this.scrollerStyle.position) || (this.scrollerStyle.position = "relative");
48        "scale" == this.options.shrinkScrollbars && (this.options.useTransition = !1);
49        this.options.invertWheelDirection = this.options.invertWheelDirection ? -1 : 1;
50        this.directionY = this.directionX = this.y =
51            this.x = 0;
52        this._events = {};
53        this._init();
54        this.refresh();
55        this.scrollTo(this.options.startX, this.options.startY);
56        this.enable()
57    }
58
59    function u(a, b, c) {
60        var e = q.createElement("div"),
61            d = q.createElement("div");
62        !0 === c && (e.style.cssText = "position:absolute;z-index:9999", d.style.cssText = "-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px");
63        d.className = "iScrollIndicator";
64        "h" == a ? (!0 === c && (e.style.cssText +=
65            ";height:7px;left:2px;right:2px;bottom:0", d.style.height = "100%"), e.className = "iScrollHorizontalScrollbar") : (!0 === c && (e.style.cssText += ";width:7px;bottom:2px;top:2px;right:1px", d.style.width = "100%"), e.className = "iScrollVerticalScrollbar");
66        e.style.cssText += ";overflow:hidden";
67        b || (e.style.pointerEvents = "none");
68        e.appendChild(d);
69        return e
70    }
71
72    function v(a, b) {
73        this.wrapper = "string" == typeof b.el ? q.querySelector(b.el) : b.el;
74        this.wrapperStyle = this.wrapper.style;
75        this.indicator = this.wrapper.children[0];
76        this.indicatorStyle =
77            this.indicator.style;
78        this.scroller = a;
79        this.options = {
80            listenX: !0,
81            listenY: !0,
82            interactive: !1,
83            resize: !0,
84            defaultScrollbars: !1,
85            shrink: !1,
86            fade: !1,
87            speedRatioX: 0,
88            speedRatioY: 0
89        };
90        for (var c in b) this.options[c] = b[c];
91        this.sizeRatioY = this.sizeRatioX = 1;
92        this.maxPosY = this.maxPosX = 0;
93        this.options.interactive && (this.options.disableTouch || (d.addEvent(this.indicator, "touchstart", this), d.addEvent(g, "touchend", this)), this.options.disablePointer || (d.addEvent(this.indicator, d.prefixPointerEvent("pointerdown"), this), d.addEvent(g,
94            d.prefixPointerEvent("pointerup"), this)), this.options.disableMouse || (d.addEvent(this.indicator, "mousedown", this), d.addEvent(g, "mouseup", this)));
95        if (this.options.fade) {
96            this.wrapperStyle[d.style.transform] = this.scroller.translateZ;
97            var e = d.style.transitionDuration;
98            if (e) {
99                this.wrapperStyle[e] = d.isBadAndroid ? "0.0001ms" : "0ms";
100                var f = this;
101                d.isBadAndroid && t(function() {
102                    "0.0001ms" === f.wrapperStyle[e] && (f.wrapperStyle[e] = "0s")
103                });
104                this.wrapperStyle.opacity = "0"
105            }
106        }
107    }
108    var t = g.requestAnimationFrame || g.webkitRequestAnimationFrame ||
109        g.mozRequestAnimationFrame || g.oRequestAnimationFrame || g.msRequestAnimationFrame || function(a) {
110            g.setTimeout(a, 1E3 / 60)
111        },
112        d = function() {
113            function a(a) {
114                return !1 === e ? !1 : "" === e ? a : e + a.charAt(0).toUpperCase() + a.substr(1)
115            }
116            var b = {},
117                c = q.createElement("div").style,
118                e = function() {
119                    for (var a = ["t", "webkitT", "MozT", "msT", "OT"], b, e = 0, d = a.length; e < d; e++)
120                        if (b = a[e] + "ransform", b in c) return a[e].substr(0, a[e].length - 1);
121                    return !1
122                }();
123            b.getTime = Date.now || function() {
124                return (new Date).getTime()
125            };
126            b.extend = function(a, b) {
127                for (var c in b) a[c] =
128                    b[c]
129            };
130            b.addEvent = function(a, b, c, e) {
131                a.addEventListener(b, c, !!e)
132            };
133            b.removeEvent = function(a, b, c, e) {
134                a.removeEventListener(b, c, !!e)
135            };
136            b.prefixPointerEvent = function(a) {
137                return g.MSPointerEvent ? "MSPointer" + a.charAt(7).toUpperCase() + a.substr(8) : a
138            };
139            b.momentum = function(a, b, c, e, d, k) {
140                b = a - b;
141                c = f.abs(b) / c;
142                var g;
143                k = void 0 === k ? 6E-4 : k;
144                g = a + c * c / (2 * k) * (0 > b ? -1 : 1);
145                k = c / k;
146                g < e ? (g = d ? e - d / 2.5 * (c / 8) : e, b = f.abs(g - a), k = b / c) : 0 < g && (g = d ? d / 2.5 * (c / 8) : 0, b = f.abs(a) + g, k = b / c);
147                return {
148                    destination: f.round(g),
149                    duration: k
150                }
151            };
152            var d = a("transform");
153            b.extend(b, {
154                hasTransform: !1 !== d,
155                hasPerspective: a("perspective") in c,
156                hasTouch: "ontouchstart" in g,
157                hasPointer: !(!g.PointerEvent && !g.MSPointerEvent),
158                hasTransition: a("transition") in c
159            });
160            b.isBadAndroid = function() {
161                var a = g.navigator.appVersion;
162                return /Android/.test(a) && !/Chrome\/\d/.test(a) ? (a = a.match(/Safari\/(\d+.\d)/)) && "object" === typeof a && 2 <= a.length ? 535.19 > parseFloat(a[1]) : !0 : !1
163            }();
164            b.extend(b.style = {}, {
165                transform: d,
166                transitionTimingFunction: a("transitionTimingFunction"),
167                transitionDuration: a("transitionDuration"),
168                transitionDelay: a("transitionDelay"),
169                transformOrigin: a("transformOrigin")
170            });
171            b.hasClass = function(a, b) {
172                return (new RegExp("(^|\\s)" + b + "(\\s|$)")).test(a.className)
173            };
174            b.addClass = function(a, c) {
175                if (!b.hasClass(a, c)) {
176                    var e = a.className.split(" ");
177                    e.push(c);
178                    a.className = e.join(" ")
179                }
180            };
181            b.removeClass = function(a, c) {
182                b.hasClass(a, c) && (a.className = a.className.replace(new RegExp("(^|\\s)" + c + "(\\s|$)", "g"), " "))
183            };
184            b.offset = function(a) {
185                for (var b = -a.offsetLeft, c = -a.offsetTop; a = a.offsetParent;) b -= a.offsetLeft, c -= a.offsetTop;
186                return {
187                    left: b,
188                    top: c
189                }
190            };
191            b.preventDefaultException = function(a, b) {
192                for (var c in b)
193                    if (b[c].test(a[c])) return !0;
194                return !1
195            };
196            b.extend(b.eventType = {}, {
197                touchstart: 1,
198                touchmove: 1,
199                touchend: 1,
200                mousedown: 2,
201                mousemove: 2,
202                mouseup: 2,
203                pointerdown: 3,
204                pointermove: 3,
205                pointerup: 3,
206                MSPointerDown: 3,
207                MSPointerMove: 3,
208                MSPointerUp: 3
209            });
210            b.extend(b.ease = {}, {
211                quadratic: {
212                    style: "cubic-bezier(0.25, 0.46, 0.45, 0.94)",
213                    fn: function(a) {
214                        return a * (2 - a)
215                    }
216                },
217                circular: {
218                    style: "cubic-bezier(0.1, 0.57, 0.1, 1)",
219                    fn: function(a) {
220                        return f.sqrt(1 - --a * a)
221                    }
222                },
223                back: {
224                    style: "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
225                    fn: function(a) {
226                        return --a * a * (5 * a + 4) + 1
227                    }
228                },
229                bounce: {
230                    style: "",
231                    fn: function(a) {
232                        return (a /= 1) < 1 / 2.75 ? 7.5625 * a * a : a < 2 / 2.75 ? 7.5625 * (a -= 1.5 / 2.75) * a + .75 : a < 2.5 / 2.75 ? 7.5625 * (a -= 2.25 / 2.75) * a + .9375 : 7.5625 * (a -= 2.625 / 2.75) * a + .984375
233                    }
234                },
235                elastic: {
236                    style: "",
237                    fn: function(a) {
238                        return 0 === a ? 0 : 1 == a ? 1 : .4 * f.pow(2, -10 * a) * f.sin(2 * (a - .055) * f.PI / .22) + 1
239                    }
240                }
241            });
242            b.tap = function(a, b) {
243                var c = q.createEvent("Event");
244                c.initEvent(b, !0, !0);
245                c.pageX = a.pageX;
246                c.pageY = a.pageY;
247                a.target.dispatchEvent(c)
248            };
249            b.click = function(a) {
250                var b = a.target,
251                    c;
252
253                // nectar addition.
254                 var activateEvent = false;
255                 if( (/(INPUT)/i).test(b.tagName) ) {
256
257                   if( b.getAttribute("type") == 'submit' || b.getAttribute("type") == 'button' ) {
258                     activateEvent = true;
259                   }
260
261                 }
262
263                 if ( !(/(SELECT|INPUT|TEXTAREA)/i).test(b.tagName) || activateEvent ) {
264                   (c = q.createEvent(g.MouseEvent ? "MouseEvents" : "Event"),
265                   c.initEvent("click", !0, !0), c.view = a.view || g, c.detail = 1, c.screenX = b.screenX || 0, c.screenY = b.screenY || 0, c.clientX = b.clientX || 0, c.clientY = b.clientY || 0, c.ctrlKey = !!a.ctrlKey, c.altKey = !!a.altKey, c.shiftKey = !!a.shiftKey, c.metaKey = !!a.metaKey, c.button = 0, c.relatedTarget = null, c._constructed = !0, b.dispatchEvent(c))
266                 }
267
268            };
269            return b
270        }();
271    p.prototype = {
272        version: "5.2.0",
273        _init: function() {
274            this._initEvents();
275            (this.options.scrollbars || this.options.indicators) && this._initIndicators();
276            this.options.mouseWheel && this._initWheel();
277            this.options.snap && this._initSnap();
278            this.options.keyBindings && this._initKeys()
279        },
280        destroy: function() {
281            this._initEvents(!0);
282            clearTimeout(this.resizeTimeout);
283            this.resizeTimeout = null;
284            this._execEvent("destroy")
285        },
286        _transitionEnd: function(a) {
287            a.target == this.scroller && this.isInTransition && (this._transitionTime(), this.resetPosition(this.options.bounceTime) || (this.isInTransition = !1, this._execEvent("scrollEnd")))
288        },
289        _start: function(a) {
290            if (!(1 != d.eventType[a.type] && 0 !== (a.which ?
291                    a.button : 2 > a.button ? 0 : 4 == a.button ? 1 : 2) || !this.enabled || this.initiated && d.eventType[a.type] !== this.initiated)) {
292                !this.options.preventDefault || d.isBadAndroid || d.preventDefaultException(a.target, this.options.preventDefaultException) || a.preventDefault();
293                var b = a.touches ? a.touches[0] : a;
294                this.initiated = d.eventType[a.type];
295                this.moved = !1;
296                this.directionLocked = this.directionY = this.directionX = this.distY = this.distX = 0;
297                this.startTime = d.getTime();
298                this.options.useTransition && this.isInTransition ? (this._transitionTime(),
299                    this.isInTransition = !1, a = this.getComputedPosition(), this._translate(f.round(a.x), f.round(a.y)), this._execEvent("scrollEnd")) : !this.options.useTransition && this.isAnimating && (this.isAnimating = !1, this._execEvent("scrollEnd"));
300                this.startX = this.x;
301                this.startY = this.y;
302                this.absStartX = this.x;
303                this.absStartY = this.y;
304                this.pointX = b.pageX;
305                this.pointY = b.pageY;
306                this._execEvent("beforeScrollStart")
307            }
308        },
309        _move: function(a) {
310            if (this.enabled && d.eventType[a.type] === this.initiated) {
311                this.options.preventDefault && a.preventDefault();
312                var b = a.touches ? a.touches[0] : a,
313                    c = b.pageX - this.pointX,
314                    e = b.pageY - this.pointY,
315                    k = d.getTime(),
316                    h;
317                this.pointX = b.pageX;
318                this.pointY = b.pageY;
319                this.distX += c;
320                this.distY += e;
321                b = f.abs(this.distX);
322                h = f.abs(this.distY);
323                if (!(300 < k - this.endTime && 10 > b && 10 > h)) {
324                    this.directionLocked || this.options.freeScroll || (this.directionLocked 
324= b > h + this.options.directionLockThreshold ? "h" : h >= b + this.options.directionLockThreshold ? "v" : "n");
325                    if ("h" == this.directionLocked) {
326                        if ("vertical" == this.options.eventPassthrough) a.preventDefault();
327                        else if ("horizontal" ==
328                            this.options.eventPassthrough) {
329                            this.initiated = !1;
330                            return
331                        }
332                        e = 0
333                    } else if ("v" == this.directionLocked) {
334                        if ("horizontal" == this.options.eventPassthrough) a.preventDefault();
335                        else if ("vertical" == this.options.eventPassthrough) {
336                            this.initiated = !1;
337                            return
338                        }
339                        c = 0
340                    }
341                    c = this.hasHorizontalScroll ? c : 0;
342                    e = this.hasVerticalScroll ? e : 0;
343                    a = this.x + c;
344                    b = this.y + e;
345                    if (0 < a || a < this.maxScrollX) a = this.options.bounce ? this.x + c / 3 : 0 < a ? 0 : this.maxScrollX;
346                    if (0 < b || b < this.maxScrollY) b = this.options.bounce ? this.y + e / 3 : 0 < b ? 0 : this.maxScrollY;
347                    this.directionX =
348                        0 < c ? -1 : 0 > c ? 1 : 0;
349                    this.directionY = 0 < e ? -1 : 0 > e ? 1 : 0;
350                    this.moved || this._execEvent("scrollStart");
351                    this.moved = !0;
352                    this._translate(a, b);
353                    300 < k - this.startTime && (this.startTime = k, this.startX = this.x, this.startY = this.y)
354                }
355            }
356        },
357        _end: function(a) {
358            if (this.enabled && d.eventType[a.type] === this.initiated) {
359                this.options.preventDefault && !d.preventDefaultException(a.target, this.options.preventDefaultException) && a.preventDefault();
360                var b, c;
361                c = d.getTime() - this.startTime;
362                var e = f.round(this.x),
363                    k = f.round(this.y),
364                    h = f.abs(e - this.startX),
365                    g = f.abs(k - this.startY);
366                b = 0;
367                var l = "";
368                this.initiated = this.isInTransition = 0;
369                this.endTime = d.getTime();
370                if (!this.resetPosition(this.options.bounceTime))
371                    if (this.scrollTo(e, k), this.moved)
372                        if (this._events.flick && 200 > c && 100 > h && 100 > g) this._execEvent("flick");
373                        else if (this.options.momentum && 300 > c && (b = this.hasHorizontalScroll ? d.momentum(this.x, this.startX, c, this.maxScrollX, this.options.bounce ? this.wrapperWidth : 0, this.options.deceleration) : {
374                        destination: e,
375                        duration: 0
376                    }, c = this.hasVerticalScroll ? d.momentum(this.y, this.startY,
377                        c, this.maxScrollY, this.options.bounce ? this.wrapperHeight : 0, this.options.deceleration) : {
378                        destination: k,
379                        duration: 0
380                    }, e = b.destination, k = c.destination, b = f.max(b.duration, c.duration), this.isInTransition = 1), this.options.snap && (this.currentPage = l = this._nearestSnap(e, k), b = this.options.snapSpeed || f.max(f.max(f.min(f.abs(e - l.x), 1E3), f.min(f.abs(k - l.y), 1E3)), 300), e = l.x, k = l.y, this.directionY = this.directionX = 0, l = this.options.bounceEasing), e != this.x || k != this.y) {
381                    if (0 < e || e < this.maxScrollX || 0 < k || k < this.maxScrollY) l =
382                        d.ease.quadratic;
383                    this.scrollTo(e, k, b, l)
384                } else this._execEvent("scrollEnd");
385                else this.options.tap && d.tap(a, this.options.tap), this.options.click && d.click(a), this._execEvent("scrollCancel")
386            }
387        },
388        _resize: function() {
389            var a = this;
390            clearTimeout(this.resizeTimeout);
391            this.resizeTimeout = setTimeout(function() {
392                a.refresh()
393            }, this.options.resizePolling)
394        },
395        resetPosition: function(a) {
396            var b = this.x,
397                c = this.y;
398            !this.hasHorizontalScroll || 0 < this.x ? b = 0 : this.x < this.maxScrollX && (b = this.maxScrollX);
399            !this.hasVerticalScroll || 0 < this.y ? c =
400                0 : this.y < this.maxScrollY && (c = this.maxScrollY);
401            if (b == this.x && c == this.y) return !1;
402            this.scrollTo(b, c, a || 0, this.options.bounceEasing);
403            return !0
404        },
405        disable: function() {
406            this.enabled = !1
407        },
408        enable: function() {
409            this.enabled = !0
410        },
411        refresh: function() {
412            this.wrapperWidth = this.wrapper.clientWidth;
413            this.wrapperHeight = this.wrapper.clientHeight;
414            this.scrollerWidth = this.scroller.offsetWidth;
415            this.scrollerHeight = this.scroller.offsetHeight;
416            this.maxScrollX = this.wrapperWidth - this.scrollerWidth;
417            this.maxScrollY = this.wrapperHeight - this.scrollerHeight;
418            this.hasHorizontalScroll = this.options.scrollX && 0 > this.maxScrollX;
419            this.hasVerticalScroll = this.options.scrollY && 0 > this.maxScrollY;
420            this.hasHorizontalScroll || (this.maxScrollX = 0, this.scrollerWidth = this.wrapperWidth);
421            this.hasVerticalScroll || (this.maxScrollY = 0, this.scrollerHeight = this.wrapperHeight);
422            this.directionY = this.directionX = this.endTime = 0;
423            this.wrapperOffset = d.offset(this.wrapper);
424            this._execEvent("refresh");
425            this.resetPosition()
426        },
427        on: function(a, b) {
428            this._events[a] || (this._events[a] = []);
429            this._events[a].push(b)
430        },
431        off: function(a, b) {
432            if (this._events[a]) {
433                var c = this._events[a].indexOf(b); - 1 < c && this._events[a].splice(c, 1)
434            }
435        },
436        _execEvent: function(a) {
437            if (this._events[a]) {
438                var b = 0,
439                    c = this._events[a].length;
440                if (c)
441                    for (; b < c; b++) this._events[a][b].apply(this, [].slice.call(arguments, 1))
442            }
443        },
444        scrollBy: function(a, b, c, e) {
445            a = this.x + a;
446            b = this.y + b;
447            this.scrollTo(a, b, c || 0, e)
448        },
449        scrollTo: function(a, b, c, e) {
450            e = e || d.ease.circular;
451            this.isInTransition = this.options.useTransition && 0 < c;
452            var f = this.options.useTransition && e.style;
453            !c || f ? (f && (this._transitionTimingFunction(e.style),
454                this._transitionTime(c)), this._translate(a, b)) : this._animate(a, b, c, e.fn)
455        },
456        scrollToElement: function(a, b, c, e, k) {
457            if (a = a.nodeType ? a : this.scroller.querySelector(a)) {
458                var h = d.offset(a);
459                h.left -= this.wrapperOffset.left;
460                h.top -= this.wrapperOffset.top;
461                !0 === c && (c = f.round(a.offsetWidth / 2 - this.wrapper.offsetWidth / 2));
462                !0 === e && (e = f.round(a.offsetHeight / 2 - this.wrapper.offsetHeight / 2));
463                h.left -= c || 0;
464                h.top -= e || 0;
465                h.left = 0 < h.left ? 0 : h.left < this.maxScrollX ? this.maxScrollX : h.left;
466                h.top = 0 < h.top ? 0 : h.top < this.maxScrollY ? this.maxScrollY :
467                    h.top;
468                b = void 0 === b || null === b || "auto" === b ? f.max(f.abs(this.x - h.left), f.abs(this.y - h.top)) : b;
469                this.scrollTo(h.left, h.top, b, k)
470            }
471        },
472        _transitionTime: function(a) {
473            if (this.options.useTransition) {
474                a = a || 0;
475                var b = d.style.transitionDuration;
476                if (b) {
477                    this.scrollerStyle[b] = a + "ms";
478                    if (!a && d.isBadAndroid) {
479                        this.scrollerStyle[b] = "0.0001ms";
480                        var c = this;
481                        t(function() {
482                            "0.0001ms" === c.scrollerStyle[b] && (c.scrollerStyle[b] = "0s")
483                        })
484                    }
485                    if (this.indicators)
486                        for (var e = this.indicators.length; e--;) this.indicators[e].transitionTime(a)
487                }
488            }
489        },
490        _transitionTimingFunction: function(a) {
491            this.scrollerStyle[d.style.transitionTimingFunction] =
492                a;
493            if (this.indicators)
494                for (var b = this.indicators.length; b--;) this.indicators[b].transitionTimingFunction(a)
495        },
496        _translate: function(a, b) {
497            this.options.useTransform ? this.scrollerStyle[d.style.transform] = "translate(" + a + "px," + b + "px)" + this.translateZ : (a = f.round(a), b = f.round(b), this.scrollerStyle.left = a + "px", this.scrollerStyle.top = b + "px");
498            this.x = a;
499            this.y = b;
500            if (this.indicators)
501                for (var c = this.indicators.length; c--;) this.indicators[c].updatePosition()
502        },
503        _initEvents: function(a) {
504            a = a ? d.removeEvent : d.addEvent;
505            var b =
506                this.options.bindToWrapper ? this.wrapper : g;
507            a(g, "orientationchange", this);
508            a(g, "resize", this);
509            this.options.click && a(this.wrapper, "click", this, !0);
510            this.options.disableMouse || (a(this.wrapper, "mousedown", this), a(b, "mousemove", this), a(b, "mousecancel", this), a(b, "mouseup", this));
511            d.hasPointer && !this.options.disablePointer && (a(this.wrapper, d.prefixPointerEvent("pointerdown"), this), a(b, d.prefixPointerEvent("pointermove"), this), a(b, d.prefixPointerEvent("pointercancel"), this), a(b, d.prefixPointerEvent("pointerup"),
512                this));
513            d.hasTouch && !this.options.disableTouch && (a(this.wrapper, "touchstart", this), a(b, "touchmove", this), a(b, "touchcancel", this), a(b, "touchend", this));
514            a(this.scroller, "transitionend", this);
515            a(this.scroller, "webkitTransitionEnd", this);
516            a(this.scroller, "oTransitionEnd", this);
517            a(this.scroller, "MSTransitionEnd", this)
518        },
519        getComputedPosition: function() {
520            var a = g.getComputedStyle(this.scroller, null),
521                b;
522            this.options.useTransform ? (a = a[d.style.transform].split(")")[0].split(", "), b = +(a[12] || a[4]), a = +(a[13] || a[5])) :
523                (b = +a.left.replace(/[^-\d.]/g, ""), a = +a.top.replace(/[^-\d.]/g, ""));
524            return {
525                x: b,
526                y: a
527            }
528        },
529        _initIndicators: function() {
530            function a(a) {
531                if (f.indicators)
532                    for (var b = f.indicators.length; b--;) a.call(f.indicators[b])
533            }
534            var b = this.options.interactiveScrollbars,
535                c = "string" != typeof this.options.scrollbars,
536                e = [],
537                d, f = this;
538            this.indicators = [];
539            this.options.scrollbars && (this.options.scrollY && (d = {
540                el: u("v", b, this.options.scrollbars),
541                interactive: b,
542                defaultScrollbars: !0,
543                customStyle: c,
544                resize: this.options.resizeScrollbars,
545                shrink: this.options.shrinkScrollbars,
546                fade: this.options.fadeScrollbars,
547                listenX: !1
548            }, this.wrapper.appendChild(d.el), e.push(d)), this.options.scrollX && (d = {
549                el: u("h", b, this.options.scrollbars),
550                interactive: b,
551                defaultScrollbars: !0,
552                customStyle: c,
553                resize: this.options.resizeScrollbars,
554                shrink: this.options.shrinkScrollbars,
555                fade: this.options.fadeScrollbars,
556                listenY: !1
557            }, this.wrapper.appendChild(d.el), e.push(d)));
558            this.options.indicators && (e = e.concat(this.options.indicators));
559            for (b = e.length; b--;) this.indicators.push(new v(this, e[b]));
560            this.options.fadeScrollbars &&
561                (this.on("scrollEnd", function() {
562                    a(function() {
563                        this.fade()
564                    })
565                }), this.on("scrollCancel", function() {
566                    a(function() {
567                        this.fade()
568                    })
569                }), this.on("scrollStart", function() {
570                    a(function() {
571                        this.fade(1)
572                    })
573                }), this.on("beforeScrollStart", function() {
574                    a(function() {
575                        this.fade(1, !0)
576                    })
577                }));
578            this.on("refresh", function() {
579                a(function() {
580                    this.refresh()
581                })
582            });
583            this.on("destroy", function() {
584                a(function() {
585                    this.destroy()
586                });
587                delete this.indicators
588            })
589        },
590        _initWheel: function() {
591            d.addEvent(this.wrapper, "wheel", this);
592            d.addEvent(this.wrapper, "mousewheel",
593                this);
594            d.addEvent(this.wrapper, "DOMMouseScroll", this);
595            this.on("destroy", function() {
596                clearTimeout(this.wheelTimeout);
597                this.wheelTimeout = null;
598                d.removeEvent(this.wrapper, "wheel", this);
599                d.removeEvent(this.wrapper, "mousewheel", this);
600                d.removeEvent(this.wrapper, "DOMMouseScroll", this)
601            })
602        },
603        _wheel: function(a) {
604            if (this.enabled) {
605                var b, c, e, d = this;
606                void 0 === this.wheelTimeout && d._execEvent("scrollStart");
607                clearTimeout(this.wheelTimeout);
608                this.wheelTimeout = setTimeout(function() {
609                    d.options.snap || d._execEvent("scrollEnd");
610                    d.wheelTimeout =
611                        void 0
612                }, 400);
613                if ("deltaX" in a) 1 === a.deltaMode ? (b = -a.deltaX * this.options.mouseWheelSpeed, a = -a.deltaY * this.options.mouseWheelSpeed) : (b = -a.deltaX, a = -a.deltaY);
614                else if ("wheelDeltaX" in a) b = a.wheelDeltaX / 120 * this.options.mouseWheelSpeed, a = a.wheelDeltaY / 120 * this.options.mouseWheelSpeed;
615                else if ("wheelDelta" in a) b = a = a.wheelDelta / 120 * this.options.mouseWheelSpeed;
616                else if ("detail" in a) b = a = -a.detail / 3 * this.options.mouseWheelSpeed;
617                else return;
618                b *= this.options.invertWheelDirection;
619                a *= this.options.invertWheelDirection;
620                this.hasVerticalScroll || (b = a, a = 0);
621                this.options.snap ? (c = this.currentPage.pageX, e = this.currentPage.pageY, 0 < b ? c-- : 0 > b && c++, 0 < a ? e-- : 0 > a && e++, this.goToPage(c, e)) : (c = this.x + f.round(this.hasHorizontalScroll ? b : 0), e = this.y + f.round(this.hasVerticalScroll ? a : 0), this.directionX = 0 < b ? -1 : 0 > b ? 1 : 0, this.directionY = 0 < a ? -1 : 0 > a ? 1 : 0, 0 < c ? c = 0 : c < this.maxScrollX && (c = this.maxScrollX), 0 < e ? e = 0 : e < this.maxScrollY && (e = this.maxScrollY), this.scrollTo(c, e, 0))
622            }
623        },
624        _initSnap: function() {
625            this.currentPage = {};
626            "string" == typeof this.options.snap &&
627                (this.options.snap = this.scroller.querySelectorAll(this.options.snap));
628            this.on("refresh", function() {
629                var a = 0,
630                    b, c = 0,
631                    e, d, g, n = 0,
632                    l;
633                e = this.options.snapStepX || this.wrapperWidth;
634                var m = this.options.snapStepY || this.wrapperHeight;
635                this.pages = [];
636                if (this.wrapperWidth && this.wrapperHeight && this.scrollerWidth && this.scrollerHeight) {
637                    if (!0 === this.options.snap)
638                        for (d = f.round(e / 2), g = f.round(m / 2); n > -this.scrollerWidth;) {
639                            this.pages[a] = [];
640                            for (l = b = 0; l > -this.scrollerHeight;) this.pages[a][b] = {
641                                x: f.max(n, this.maxScrollX),
642                                y: f.max(l,
643                                    this.maxScrollY),
644                                width: e,
645                                height: m,
646                                cx: n - d,
647                                cy: l - g
648                            }, l -= m, b++;
649                            n -= e;
650                            a++
651                        } else
652                            for (m = this.options.snap, b = m.length, e = -1; a < b; a++) {
653                                if (0 === a || m[a].offsetLeft <= m[a - 1].offsetLeft) c = 0, e++;
654                                this.pages[c] || (this.pages[c] = []);
655                                n = f.max(-m[a].offsetLeft, this.maxScrollX);
656                                l = f.max(-m[a].offsetTop, this.maxScrollY);
657                                d = n - f.round(m[a].offsetWidth / 2);
658                                g = l - f.round(m[a].offsetHeight / 2);
659                                this.pages[c][e] = {
660                                    x: n,
661                                    y: l,
662                                    width: m[a].offsetWidth,
663                                    height: m[a].offsetHeight,
664                                    cx: d,
665                                    cy: g
666                                };
667                                n > this.maxScrollX && c++
668                            }
669                    this.goToPage(this.currentPage.pageX ||
670                        0, this.currentPage.pageY || 0, 0);
671                    0 === this.options.snapThreshold % 1 ? this.snapThresholdY = this.snapThresholdX = this.options.snapThreshold : (this.snapThresholdX = f.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width * this.options.snapThreshold), this.snapThresholdY = f.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height * this.options.snapThreshold))
672                }
673            });
674            this.on("flick", function() {
675                var a = this.options.snapSpeed || f.max(f.max(f.min(f.abs(this.x - this.startX), 1E3), f.min(f.abs(this.y -
676                    this.startY), 1E3)), 300);
677                this.goToPage(this.currentPage.pageX + this.directionX, this.currentPage.pageY + this.directionY, a)
678            })
679        },
680        _nearestSnap: function(a, b) {
681            if (!this.pages.length) return {
682                x: 0,
683                y: 0,
684                pageX: 0,
685                pageY: 0
686            };
687            var c = 0,
688                e = this.pages.length,
689                d = 0;
690            if (f.abs(a - this.absStartX) < this.snapThresholdX && f.abs(b - this.absStartY) < this.snapThresholdY) return this.currentPage;
691            0 < a ? a = 0 : a < this.maxScrollX && (a = this.maxScrollX);
692            0 < b ? b = 0 : b < this.maxScrollY && (b = this.maxScrollY);
693            for (; c < e; c++)
694                if (a >= this.pages[c][0].cx) {
695                    a = this.pages[c][0].x;
696                    break
697                } for (e = this.pages[c].length; d < e; d++)
698                if (b >= this.pages[0][d].cy) {
699                    b = this.pages[0][d].y;
700                    break
701                } c == this.currentPage.pageX && (c += this.directionX, 0 > c ? c = 0 : c >= this.pages.length && (c = this.pages.length - 1), a = this.pages[c][0].x);
702            d == this.currentPage.pageY && (d += this.directionY, 0 > d ? d = 0 : d >= this.pages[0].length && (d = this.pages[0].length - 1), b = this.pages[0][d].y);
703            return {
704                x: a,
705                y: b,
706                pageX: c,
707                pageY: d
708            }
709        },
710        goToPage: function(a, b, c, d) {
711            d = d || this.options.bounceEasing;
712            a >= this.pages.length ? a = this.pages.length - 1 : 0 > a && (a = 0);
713            b >= this.pages[a].length ?
714                b = this.pages[a].length - 1 : 0 > b && (b = 0);
715            var g = this.pages[a][b].x,
716                h = this.pages[a][b].y;
717            c = void 0 === c ? this.options.snapSpeed || f.max(f.max(f.min(f.abs(g - this.x), 1E3), f.min(f.abs(h - this.y), 1E3)), 300) : c;
718            this.currentPage = {
719                x: g,
720                y: h,
721                pageX: a,
722                pageY: b
723            };
724            this.scrollTo(g, h, c, d)
725        },
726        next: function(a, b) {
727            var c = this.currentPage.pageX,
728                d = this.currentPage.pageY;
729            c++;
730            c >= this.pages.length && this.hasVerticalScroll && (c = 0, d++);
731            this.goToPage(c, d, a, b)
732        },
733        prev: function(a, b) {
734            var c = this.currentPage.pageX,
735                d = this.currentPage.pageY;
736            c--;
737            0 > c && this.hasVerticalScroll &&
738                (c = 0, d--);
739            this.goToPage(c, d, a, b)
740        },
741        _initKeys: function(a) {
742            a = {
743                pageUp: 33,
744                pageDown: 34,
745                end: 35,
746                home: 36,
747                left: 37,
748                up: 38,
749                right: 39,
750                down: 40
751            };
752            var b;
753            if ("object" == typeof this.options.keyBindings)
754                for (b in this.options.keyBindings) "string" == typeof this.options.keyBindings[b] && (this.options.keyBindings[b] = this.options.keyBindings[b].toUpperCase().charCo
754deAt(0));
755            else this.options.keyBindings = {};
756            for (b in a) this.options.keyBindings[b] = this.options.keyBindings[b] || a[b];
757            d.addEvent(g, "keydown", this);
758            this.on("destroy", function() {
759                d.removeEvent(g,
760                    "keydown", this)
761            })
762        },
763        _key: function(a) {
764            if (this.enabled) {
765                var b = this.options.snap,
766                    c = b ? this.currentPage.pageX : this.x,
767                    e = b ? this.currentPage.pageY : this.y,
768                    g = d.getTime(),
769                    h = this.keyTime || 0,
770                    n;
771                this.options.useTransition && this.isInTransition && (n = this.getComputedPosition(), this._translate(f.round(n.x), f.round(n.y)), this.isInTransition = !1);
772                this.keyAcceleration = 200 > g - h ? f.min(this.keyAcceleration + .25, 50) : 0;
773                switch (a.keyCode) {
774                    case this.options.keyBindings.pageUp:
775                        this.hasHorizontalScroll && !this.hasVerticalScroll ? c += b ?
776                            1 : this.wrapperWidth : e += b ? 1 : this.wrapperHeight;
777                        break;
778                    case this.options.keyBindings.pageDown:
779                        this.hasHorizontalScroll && !this.hasVerticalScroll ? c -= b ? 1 : this.wrapperWidth : e -= b ? 1 : this.wrapperHeight;
780                        break;
781                    case this.options.keyBindings.end:
782                        c = b ? this.pages.length - 1 : this.maxScrollX;
783                        e = b ? this.pages[0].length - 1 : this.maxScrollY;
784                        break;
785                    case this.options.keyBindings.home:
786                        e = c = 0;
787                        break;
788                    case this.options.keyBindings.left:
789                        c += b ? -1 : 5 + this.keyAcceleration >> 0;
790                        break;
791                    case this.options.keyBindings.up:
792                        e += b ? 1 : 5 + this.keyAcceleration >>
793                            0;
794                        break;
795                    case this.options.keyBindings.right:
796                        c -= b ? -1 : 5 + this.keyAcceleration >> 0;
797                        break;
798                    case this.options.keyBindings.down:
799                        e -= b ? 1 : 5 + this.keyAcceleration >> 0;
800                        break;
801                    default:
802                        return
803                }
804                b ? this.goToPage(c, e) : (0 < c ? this.keyAcceleration = c = 0 : c < this.maxScrollX && (c = this.maxScrollX, this.keyAcceleration = 0), 0 < e ? this.keyAcceleration = e = 0 : e < this.maxScrollY && (e = this.maxScrollY, this.keyAcceleration = 0), this.scrollTo(c, e, 0), this.keyTime = g)
805            }
806        },
807        _animate: function(a, b, c, e) {
808            function f() {
809                var r = d.getTime(),
810                    p;
811                r >= q ? (g.isAnimating = !1, g._translate(a,
812                    b), g.resetPosition(g.options.bounceTime) || g._execEvent("scrollEnd")) : (r = (r - m) / c, p = e(r), r = (a - n) * p + n, p = (b - l) * p + l, g._translate(r, p), g.isAnimating && t(f))
813            }
814            var g = this,
815                n = this.x,
816                l = this.y,
817                m = d.getTime(),
818                q = m + c;
819            this.isAnimating = !0;
820            f()
821        },
822        handleEvent: function(a) {
823            switch (a.type) {
824                case "touchstart":
825                case "pointerdown":
826                case "MSPointerDown":
827                case "mousedown":
828                    this._start(a);
829                    break;
830                case "touchmove":
831                case "pointermove":
832                case "MSPointerMove":
833                case "mousemove":
834                    this._move(a);
835                    break;
836                case "touchend":
837                case "pointerup":
838                case "MSPointerUp":
839                case "mouseup":
840                case "touchcancel":
841                case "pointercancel":
842                case "MSPointerCancel":
843                case "mousecancel":
844                    this._end(a);
845                    break;
846                case "orientationchange":
847                case "resize":
848                    this._resize();
849                    break;
850                case "transitionend":
851                case "webkitTransitionEnd":
852                case "oTransitionEnd":
853                case "MSTransitionEnd":
854                    this._transitionEnd(a);
855                    break;
856                case "wheel":
857                case "DOMMouseScroll":
858                case "mousewheel":
859                    this._wheel(a);
860                    break;
861                case "keydown":
862                    this._key(a);
863                    break;
864                case "click":
865                    this.enabled && !a._constructed && (a.preventDefault(), a.stopPropagation())
866            }
867        }
868    };
869    v.prototype = {
870        handleEvent: function(a) {
871            switch (a.type) {
872                case "touchstart":
873                case "pointerdown":
874                case "MSPointerDown":
875                case "mousedown":
876                    this._start(a);
877                    break;
878                case "touchmove":
879                case "pointermove":
880                case "MSPointerMove":
881                case "mousemove":
882                    this._move(a);
883                    break;
884                case "touchend":
885                case "pointerup":
886                case "MSPointerUp":
887                case "mouseup":
888                case "touchcancel":
889                case "pointercancel":
890                case "MSPointerCancel":
891                case "mousecancel":
892                    this._end(a)
893            }
894        },
895        destroy: function() {
896            this.options.fadeScrollbars && (clearTimeout(this.fadeTimeout), this.fadeTimeout = null);
897            this.options.interactive && (d.removeEvent(this.indicator, "touchstart", this), d.removeEvent(this.indicator, d.prefixPointerEvent("pointerdown"),
898                this), d.removeEvent(this.indicator, "mousedown", this), d.removeEvent(g, "touchmove", this), d.removeEvent(g, d.prefixPointerEvent("pointermove"), this), d.removeEvent(g, "mousemove", this), d.removeEvent(g, "touchend", this), d.removeEvent(g, d.prefixPointerEvent("pointerup"), this), d.removeEvent(g, "mouseup", this));
899            this.options.defaultScrollbars && this.wrapper.parentNode.removeChild(this.wrapper)
900        },
901        _start: function(a) {
902            var b = a.touches ? a.touches[0] : a;
903            a.preventDefault();
904            a.stopPropagation();
905            this.transitionTime();
906            this.initiated = !0;
907            this.moved = !1;
908            this.lastPointX = b.pageX;
909            this.lastPointY = b.pageY;
910            this.startTime = d.getTime();
911            this.options.disableTouch || d.addEvent(g, "touchmove", this);
912            this.options.disablePointer || d.addEvent(g, d.prefixPointerEvent("pointermove"), this);
913            this.options.disableMouse || d.addEvent(g, "mousemove", this);
914            this.scroller._execEvent("beforeScrollStart")
915        },
916        _move: function(a) {
917            var b = a.touches ? a.touches[0] : a,
918                c, e;
919            d.getTime();
920            this.moved || this.scroller._execEvent("scrollStart");
921            this.moved = !0;
922            c = b.pageX - this.lastPointX;
923            this.lastPointX =
924                b.pageX;
925            e = b.pageY - this.lastPointY;
926            this.lastPointY = b.pageY;
927            this._pos(this.x + c, this.y + e);
928            a.preventDefault();
929            a.stopPropagation()
930        },
931        _end: function(a) {
932            if (this.initiated) {
933                this.initiated = !1;
934                a.preventDefault();
935                a.stopPropagation();
936                d.removeEvent(g, "touchmove", this);
937                d.removeEvent(g, d.prefixPointerEvent("pointermove"), this);
938                d.removeEvent(g, "mousemove", this);
939                if (this.scroller.options.snap) {
940                    a = this.scroller._nearestSnap(this.scroller.x, this.scroller.y);
941                    var b = this.options.snapSpeed || f.max(f.max(f.min(f.abs(this.scroller.x -
942                        a.x), 1E3), f.min(f.abs(this.scroller.y - a.y), 1E3)), 300);
943                    if (this.scroller.x != a.x || this.scroller.y != a.y) this.scroller.directionX = 0, this.scroller.directionY = 0, this.scroller.currentPage = a, this.scroller.scrollTo(a.x, a.y, b, this.scroller.options.bounceEasing)
944                }
945                this.moved && this.scroller._execEvent("scrollEnd")
946            }
947        },
948        transitionTime: function(a) {
949            a = a || 0;
950            var b = d.style.transitionDuration;
951            if (b && (this.indicatorStyle[b] = a + "ms", !a && d.isBadAndroid)) {
952                this.indicatorStyle[b] = "0.0001ms";
953                var c = this;
954                t(function() {
955                    "0.0001ms" === c.indicatorStyle[b] &&
956                        (c.indicatorStyle[b] = "0s")
957                })
958            }
959        },
960        transitionTimingFunction: function(a) {
961            this.indicatorStyle[d.style.transitionTimingFunction] = a
962        },
963        refresh: function() {
964            this.transitionTime();
965            this.indicatorStyle.display = this.options.listenX && !this.options.listenY ? this.scroller.hasHorizontalScroll ? "block" : "none" : this.options.listenY && !this.options.listenX ? this.scroller.hasVerticalScroll ? "block" : "none" : this.scroller.hasHorizontalScroll || this.scroller.hasVerticalScroll ? "block" : "none";
966            this.scroller.hasHorizontalScroll && this.scroller.hasVerticalScroll ?
967                (d.addClass(this.wrapper, "iScrollBothScrollbars"), d.removeClass(this.wrapper, "iScrollLoneScrollbar"), this.options.defaultScrollbars && this.options.customStyle && (this.options.listenX ? this.wrapper.style.right = "8px" : this.wrapper.style.bottom = "8px")) : (d.removeClass(this.wrapper, "iScrollBothScrollbars"), d.addClass(this.wrapper, "iScrollLoneScrollbar"), this.options.defaultScrollbars && this.options.customStyle && (this.options.listenX ? this.wrapper.style.right = "2px" : this.wrapper.style.bottom = "2px"));
968            this.options.listenX &&
969                (this.wrapperWidth = this.wrapper.clientWidth, this.options.resize ? (this.indicatorWidth = f.max(f.round(this.wrapperWidth * this.wrapperWidth / (this.scroller.scrollerWidth || this.wrapperWidth || 1)), 8), this.indicatorStyle.width = this.indicatorWidth + "px") : this.indicatorWidth = this.indicator.clientWidth, this.maxPosX = this.wrapperWidth - this.indicatorWidth, "clip" == this.options.shrink ? (this.minBoundaryX = -this.indicatorWidth + 8, this.maxBoundaryX = this.wrapperWidth - 8) : (this.minBoundaryX = 0, this.maxBoundaryX = this.maxPosX),
970                    this.sizeRatioX = this.options.speedRatioX || this.scroller.maxScrollX && this.maxPosX / this.scroller.maxScrollX);
971            this.options.listenY && (this.wrapperHeight = this.wrapper.clientHeight, this.options.resize ? (this.indicatorHeight = f.max(f.round(this.wrapperHeight * this.wrapperHeight / (this.scroller.scrollerHeight || this.wrapperHeight || 1)), 8), this.indicatorStyle.height = this.indicatorHeight + "px") : this.indicatorHeight = this.indicator.clientHeight, this.maxPosY = this.wrapperHeight - this.indicatorHeight, "clip" == this.options.shrink ?
972                (this.minBoundaryY = -this.indicatorHeight + 8, this.maxBoundaryY = this.wrapperHeight - 8) : (this.minBoundaryY = 0, this.maxBoundaryY = this.maxPosY), this.maxPosY = this.wrapperHeight - this.indicatorHeight, this.sizeRatioY = this.options.speedRatioY || this.scroller.maxScrollY && this.maxPosY / this.scroller.maxScrollY);
973            this.updatePosition()
974        },
975        updatePosition: function() {
976            var a = this.options.listenX && f.round(this.sizeRatioX * this.scroller.x) || 0,
977                b = this.options.listenY && f.round(this.sizeRatioY * this.scroller.y) || 0;
978            this.options.ignoreBoundaries ||
979                (a < this.minBoundaryX ? ("scale" == this.options.shrink && (this.width = f.max(this.indicatorWidth + a, 8), this.indicatorStyle.width = this.width + "px"), a = this.minBoundaryX) : a > this.maxBoundaryX ? "scale" == this.options.shrink ? (this.width = f.max(this.indicatorWidth - (a - this.maxPosX), 8), this.indicatorStyle.width = this.width + "px", a = this.maxPosX + this.indicatorWidth - this.width) : a = this.maxBoundaryX : "scale" == this.options.shrink && this.width != this.indicatorWidth && (this.width = this.indicatorWidth, this.indicatorStyle.width = this.width +
980                    "px"), b < this.minBoundaryY ? ("scale" == this.options.shrink && (this.height = f.max(this.indicatorHeight + 3 * b, 8), this.indicatorStyle.height = this.height + "px"), b = this.minBoundaryY) : b > this.maxBoundaryY ? "scale" == this.options.shrink ? (this.height = f.max(this.indicatorHeight - 3 * (b - this.maxPosY), 8), this.indicatorStyle.height = this.height + "px", b = this.maxPosY + this.indicatorHeight - this.height) : b = this.maxBoundaryY : "scale" == this.options.shrink && this.height != this.indicatorHeight && (this.height = this.indicatorHeight, this.indicatorStyle.height =
981                    this.height + "px"));
982            this.x = a;
983            this.y = b;
984            this.scroller.options.useTransform ? this.indicatorStyle[d.style.transform] = "translate(" + a + "px," + b + "px)" + this.scroller.translateZ : (this.indicatorStyle.left = a + "px", this.indicatorStyle.top = b + "px")
985        },
986        _pos: function(a, b) {
987            0 > a ? a = 0 : a > this.maxPosX && (a = this.maxPosX);
988            0 > b ? b = 0 : b > this.maxPosY && (b = this.maxPosY);
989            a = this.options.listenX ? f.round(a / this.sizeRatioX) : this.scroller.x;
990            b = this.options.listenY ? f.round(b / this.sizeRatioY) : this.scroller.y;
991            this.scroller.scrollTo(a, b)
992        },
993        fade: function(a,
994            b) {
995            if (!b || this.visible) {
996                clearTimeout(this.fadeTimeout);
997                this.fadeTimeout = null;
998                var c = a ? 0 : 300;
999                this.wrapperStyle[d.style.transitionDuration] = (a ? 250 : 500) + "ms";
1000                this.fadeTimeout = setTimeout(function(a) {
1001                    this.wrapperStyle.opacity = a;
1002                    this.visible = +a
1003                }.bind(this, a ? "1" : "0"), c)
1004            }
1005        }
1006    };
1007    p.utils = d;
1008    "undefined" != typeof module && module.exports ? module.exports = p : "function" == typeof define && define.amd ? define(function() {
1009        return p
1010    }) : g.IScroll = p
1011})(window, document, Math);
1012
1013
1014
1015
1016
1017
1018/*!
1019 * fullPage 2.8.1
1020 * https://github.com/alvarotrigo/fullPage.js
1021 * @license MIT licensed
1022 *
1023 * Copyright (C) 2015 alvarotrigo.com - A project by Alvaro Trigo
1024 */
1025(function(global, factory) {
1026    'use strict';
1027    if (typeof define === 'function' && define.amd) {
1028        define(['jquery'], function($) {
1029          return factory($, global, global.document, global.Math);
1030        });
1031    } else if (typeof exports !== 'undefined') {
1032        module.exports = factory(require('jquery'), global, global.document, global.Math);
1033    } else {
1034        factory(jQuery, global, global.document, global.Math);
1035    }
1036})(typeof window !== 'undefined' ? window : this, function($, window, document, Math, undefined) {
1037    'use strict';
1038
1039    // keeping central set of classnames and selectors
1040    var WRAPPER =               'fullpage-wrapper';
1041    var WRAPPER_SEL =           '.' + WRAPPER;
1042
1043    // slimscroll
1044    var SCROLLABLE =            'fp-scrollable';
1045    var SCROLLABLE_SEL =        '.' + SCROLLABLE;
1046
1047    // util
1048    var RESPONSIVE =            'fp-responsive';
1049    var NO_TRANSITION =         'fp-notransition';
1050    var DESTROYED =             'fp-destroyed';
1051    var ENABLED =               'fp-enabled';
1052    var VIEWING_PREFIX =        'fp-viewing';
1053    var ACTIVE =                'active';
1054    var ACTIVE_SEL =            '.' + ACTIVE;
1055    var COMPLETELY =            'fp-completely';
1056    var COMPLETELY_SEL =        '.' + COMPLETELY;
1057
1058    // section
1059    var SECTION_DEFAULT_SEL =   '.section';
1060    var SECTION =               'fp-section';
1061    var SECTION_SEL =           '.' + SECTION;
1062    var SECTION_ACTIVE_SEL =    SECTION_SEL + ACTIVE_SEL;
1063    var SECTION_FIRST_SEL =     SECTION_SEL + ':first';
1064    var SECTION_LAST_SEL =      SECTION_SEL + ':last';
1065    var TABLE_CELL =            'fp-tableCell';
1066    var TABLE_CELL_SEL =        '.' + TABLE_CELL;
1067    var AUTO_HEIGHT =           'fp-auto-height';
1068    var AUTO_HEIGHT_SEL =       '.fp-auto-height';
1069    var NORMAL_SCROLL =         'fp-normal-scroll';
1070    var NORMAL_SCROLL_SEL =     '.fp-normal-scroll';
1071
1072    // section nav
1073    var SECTION_NAV =           'fp-nav';
1074    var SECTION_NAV_SEL =       '#' + SECTION_NAV;
1075    var SECTION_NAV_TOOLTIP =   'fp-tooltip';
1076    var SECTION_NAV_TOOLTIP_SEL='.'+SECTION_NAV_TOOLTIP;
1077    var SHOW_ACTIVE_TOOLTIP =   'fp-show-active';
1078
1079    // slide
1080    var SLIDE_DEFAULT_SEL =     '.slide';
1081    var SLIDE =                 'fp-slide';
1082    var SLIDE_SEL =             '.' + SLIDE;
1083    var SLIDE_ACTIVE_SEL =      SLIDE_SEL + ACTIVE_SEL;
1084    var SLIDES_WRAPPER =        'fp-slides';
1085    var SLIDES_WRAPPER_SEL =    '.' + SLIDES_WRAPPER;
1086    var SLIDES_CONTAINER =      'fp-slidesContainer';
1087    var SLIDES_CONTAINER_SEL =  '.' + SLIDES_CONTAINER;
1088    var TABLE =                 'fp-table';
1089
1090    // slide nav
1091    var SLIDES_NAV =            'fp-slidesNav';
1092    var SLIDES_NAV_SEL =        '.' + SLIDES_NAV;
1093    var SLIDES_NAV_LINK_SEL =   SLIDES_NAV_SEL + ' a';
1094    var SLIDES_ARROW =          'fp-controlArrow';
1095    var SLIDES_ARROW_SEL =      '.' + SLIDES_ARROW;
1096    var SLIDES_PREV =           'fp-prev';
1097    var SLIDES_PREV_SEL =       '.' + SLIDES_PREV;
1098    var SLIDES_ARROW_PREV =     SLIDES_ARROW + ' ' + SLIDES_PREV;
1099    var SLIDES_ARROW_PREV_SEL = SLIDES_ARROW_SEL + SLIDES_PREV_SEL;
1100    var SLIDES_NEXT =           'fp-next';
1101    var SLIDES_NEXT_SEL =       '.' + SLIDES_NEXT;
1102    var SLIDES_ARROW_NEXT =     SLIDES_ARROW + ' ' + SLIDES_NEXT;
1103    var SLIDES_ARROW_NEXT_SEL = SLIDES_ARROW_SEL + SLIDES_NEXT_SEL;
1104
1105    /* nectar addition */
1106    var HASHCHANGE = false;
1107    var HASHCHANGETIMEOUT;
1108    /* nectar addition end */
1109
1110    var $window = $(window);
1111    var $document = $(document);
1112
1113    // Default options for iScroll.js used when using scrollOverflow
1114
1115    /* nectar addition */
1116    //changing click param depending on mobile device
1117    if('ontouchstart' in document.documentElement) {
1118    	var iscrollOptions = {
1119	        scrollbars: true,
1120	        mouseWheel: true,
1121	        hideScrollbars: false,
1122	        disableMouse: true,
1123	        useTransition: true,
1124	        interactiveScrollbars: true,
1125	        click: true
1126	    };
1127    } else {
1128    	var iscrollOptions = {
1129	        scrollbars: true,
1130	        mouseWheel: true,
1131	        hideScrollbars: false,
1132	        disableMouse: true,
1133	        useTransition: true,
1134	        interactiveScrollbars: true,
1135	        click: false
1136	    };
1137    }
1138
1139    if($('.nectar_using_pfsr.nectar_pfsr_compose_mode:not(.using-mobile-browser)').length > 0) {
1140     
1141      var iscrollOptions = {
1142          scrollbars: true,
1143          mouseWheel: false,
1144          hideScrollbars: false,
1145          useTransition: true,
1146          interactiveScrollbars: true,
1147          disableMouse: true,
1148          disableTouch: true,
1149          disablePointer: false,
1150          click: false
1151      };
1152    }
1153
1154
1155    $.fn.fullpage = function(options) {
1156        //only once my friend!
1157        if($('html').hasClass(ENABLED)){ displayWarnings(); return; }
1158
1159
1160
1161        // common jQuery objects
1162        var $htmlBody = $('html, body');
1163        var $body = $('body');
1164
1165        var FP = $.fn.fullpage;
1166
1167        // Create some defaults, extending them with any options that were provided
1168        options = $.extend({
1169            //navigation
1170            menu: false,
1171            anchors:[],
1172            lockAnchors: false,
1173            navigation: false,
1174            navigationPosition: 'right',
1175            navigationTooltips: [],
1176            showActiveTooltip: false,
1177            slidesNavigation: false,
1178            slidesNavPosition: 'bottom',
1179            scrollBar: false,
1180            hybrid: false,
1181
1182            //scrolling
1183            css3: true,
1184            scrollingSpeed: 700,
1185            autoScrolling: true,
1186            fitToSection: true,
1187            fitToSectionDelay: 1000,
1188            easing: 'easeInOutCubic',
1189            easingcss3: 'ease',
1190            loopBottom: false,
1191            loopTop: false,
1192            loopHorizontal: true,
1193            continuousVertical: false,
1194            normalScrollElements: null,
1195            scrollOverflow: false,
1196            scrollOverflowHandler: iscrollHandler,
1197            scrollOverflowOptions: null,
1198            touchSensitivity: 5,
1199            normalScrollElementTouchThreshold: 5,
1200
1201            //Accessibility
1202            keyboardScrolling: true,
1203            animateAnchor: true,
1204            recordHistory: true,
1205
1206            //design
1207            controlArrows: true,
1208            controlArrowColor: '#fff',
1209            verticalCentered: true,
1210            sectionsColor : [],
1211            paddingTop: 0,
1212            paddingBottom: 0,
1213            fixedElements: null,
1214            responsive: 0, //backwards compabitility with responsiveWiddth
1215            responsiveWidth: 0,
1216            responsiveHeight: 0,
1217
1218            //Custom selectors
1219            sectionSelector: SECTION_DEFAULT_SEL,
1220            slideSelector: SLIDE_DEFAULT_SEL,
1221
1222
1223            //events
1224            afterLoad: null,
1225            onLeave: null,
1226            afterRender: null,
1227            afterResize: null,
1228            afterReBuild: null,
1229            afterSlideLoad: null,
1230            onSlideLeave: null
1231        }, options);
1232
1233        displayWarnings();
1234
1235        //extending iScroll options with the user custom ones
1236        iscrollOptions = $.extend(iscrollOptions, options.scrollOverflowOptions);
1237
1238        //easeInOutCubic animation included in the plugin
1239        $.extend($.easing,{ easeInOutCubic: function (x, t, b, c, d) {if ((t/=d/2) < 1) return c/2*t*t*t + b;return c/2*((t-=2)*t*t + 2) + b;}});
1240
1241        /**
1242        * Sets the autoScroll option.
1243        * It changes the scroll bar visibility and the history of the site as a result.
1244        */
1245        FP.setAutoScrolling = function(value, type){
1246            setVariableState('autoScrolling', value, type);
1247
1248            var element = $(SECTION_ACTIVE_SEL);
1249
1250            if(options.autoScrolling && !options.scrollBar){
1251                $htmlBody.css({
1252                    'overflow' : 'hidden',
1253                    'height' : '100%'
1254                });
1255
1256                FP.setRecordHistory(originals.recordHistory, 'internal');
1257
1258                //for IE touch devices
1259                container.css({
1260                    '-ms-touch-action': 'none',
1261                    'touch-action': 'none'
1262                });
1263
1264                if(element.length){
1265                    //moving the container up
1266                    silentScroll(element.position().top);
1267                }
1268
1269            }else{
1270                $htmlBody.css({
1271                    'overflow' : 'visible',
1272                    'height' : 'initial'
1273                });
1274
1275                FP.setRecordHistory(false, 'internal');
1276
1277                //for IE touch devices
1278                container.css({
1279                    '-ms-touch-action': '',
1280                    'touch-action': ''
1281                });
1282
1283                silentScroll(0);
1284
1285                //scrolling the page to the section with no animation
1286                if (element.length) {
1287
1288                    $htmlBody.scrollTop(element.position().top);
1289                }
1290            }
1291        };
1292
1293        /**
1294        * Defines wheter to record the history for each hash change in the URL.
1295        */
1296        FP.setRecordHistory = function(value, type){
1297            setVariableState('recordHistory', value, type);
1298        };
1299
1300        /**
1301        * Defines the scrolling speed
1302        */
1303        FP.setScrollingSpeed = function(value, type){
1304            setVariableState('scrollingSpeed', value, type);
1305        };
1306
1307        /**
1308        * Sets fitToSection
1309        */
1310        FP.setFitToSection = function(value, type){
1311            setVariableState('fitToSection', value, type);
1312        };
1313
1314        /**
1315        * Sets lockAnchors
1316        */
1317        FP.setLockAnchors = function(value){
1318            options.lockAnchors = value;
1319        };
1320
1321        /**
1322        * Adds or remove the possiblity of scrolling through sections by using the mouse wheel or the trackpad.
1323        */
1324        FP.setMouseWheelScrolling = function (value){
1325            if(value){
1326                addMouseWheelHandler();
1327                addMiddleWheelHandler();
1328            }else{
1329                removeMouseWheelHandler();
1330                removeMiddleWheelHandler();
1331            }
1332        };
1333
1334        /**
1335        * Adds or remove the possiblity of scrolling through sections by using the mouse wheel/trackpad or touch gestures.
1336        * Optionally a second parameter can be used to specify the direction for which the action will be applied.
1337        *
1338        * @param directions string containing the direction or directions separated by comma.
1339        */
1340        FP.setAllowScrolling = function (value, directions){
1341            if(typeof directions !== 'undefined'){
1342                directions = directions.replace(/ /g,'').split(',');
1343
1344                $.each(directions, function (index, direction){
1345                    setIsScrollAllowed(value, direction, 'm');
1346                });
1347            }
1348            else if(value){
1349                FP.setMouseWheelScrolling(true);
1350                addTouchHandler();
1351            }else{
1352                FP.setMouseWheelScrolling(false);
1353                removeTouchHandler();
1354            }
1355        };
1356
1357        /**
1358        * Adds or remove the possiblity of scrolling through sections by using the keyboard arrow keys
1359        */
1360        FP.setKeyboardScrolling = function (value, directions){
1361            if(typeof directions !== 'undefined'){
1362                directions = directions.replace(/ /g,'').split(',');
1363
1364                $.each(directions, function (index, direction){
1365                    setIsScrollAllowed(value, direction, 'k');
1366                });
1367            }else{
1368                options.keyboardScrolling = value;
1369            }
1370        };
1371
1372        /**
1373        * Moves the page up one section.
1374        */
1375        FP.moveSectionUp = function(){
1376
1377            /* nectar addition */
1378            if(canScroll == false) return false;
1379
1380            var prev = $(SECTION_ACTIVE_SEL).prev(SECTION_SEL);
1381
1382            //looping to the bottom if there's no more sections above
1383            if (!prev.length && (options.loopTop || options.continuousVertical)) {
1384                prev = $(SECTION_SEL).last();
1385            }
1386
1387            if (prev.length) {
1388                scrollPage(prev, null, true);
1389            }
1390        };
1391
1392        /**
1393        * Moves the page down one section.
1394        */
1395        FP.moveSectionDown = function (){
1396
1397            /* nectar addition */
1398            if(canScroll == false) return false;
1399
1400            var next = $(SECTION_ACTIVE_SEL).next(SECTION_SEL);
1401
1402            //looping to the top if there's no more sections below
1403            if(!next.length &&
1404                (options.loopBottom || options.continuousVertical)){
1405                next = $(SECTION_SEL).first();
1406            }
1407
1408            if(next.length){
1409                scrollPage(next, null, false);
1410            }
1411        };
1412
1413        /**
1414        * Moves the page to the given section and slide with no animation.
1415        * Anchors or index positions can be used as params.
1416        */
1417        FP.silentMoveTo = function(sectionAnchor, slideAnchor){
1418            FP.setScrollingSpeed (0, 'internal');
1419            FP.moveTo(sectionAnchor, slideAnchor);
1420            FP.setScrollingSpeed (originals.scrollingSpeed, 'internal');
1421        };
1422
1423        /**
1424        * Moves the page to the given section and slide.
1425        * Anchors or index positions can be used as params.
1426        */
1427        FP.moveTo = function (sectionAnchor, slideAnchor){
1428            var destiny = getSectionByAnchor(sectionAnchor);
1429
1430            if (typeof slideAnchor !== 'undefined'){
1431                scrollPageAndSlide(sectionAnchor, slideAnchor);
1432            }else if(destiny.length > 0){
1433                scrollPage(destiny);
1434            }
1435        };
1436
1437        /**
1438        * Slides right the slider of the active section.
1439        * Optional `section` param.
1440        */
1441        FP.moveSlideRight = function(section){
1442            moveSlide('next', section);
1443        };
1444
1445        /**
1446        * Slides left the slider of the active section.
1447        * Optional `section` param.
1448        */
1449        FP.moveSlideLeft = function(section){
1450            moveSlide('prev', section);
1451        };
1452
1453        /**
1454         * When resizing is finished, we adjust the slides sizes and positions
1455         */
1456        FP.reBuild = function(resizing){
1457
1458            if(container.hasClass(DESTROYED)){ return; }  //nothing to do if the plugin was destroyed
1459
1460            isResizing = true;
1461
1462            /* nectar addition */
1463            var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
1464            var $adminBar = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
1465            if(window.vc_iframe) { $adminBar = 0; }
1466            var $headerHeight = ($('#header-outer.transparent').length == 0 ) ? $headerNavSpace : 0 ;
1467            // Handle mobile secondary nav
1468            if( $('#header-outer.transparent').length > 0 && $('#header-secondary-outer[data-mobile="display_full"]').length > 0 && $(window).width() <= 1000 ) {
1469              $headerHeight += $('#header-secondary-outer').height();
1470            }
1471            var $borderMultiplier = ($('.body-border-right').length > 0 && $('#header-outer').css('background-color') == $('.body-border-right').css('background-color')) ? 1 : 2;
1472            var $borderHeight = ($('.body-border-right').length > 0 && $(window).width()>1000) ? $('.body-border-right').width()*$borderMultiplier : 0;
1473            var windowsWidth = $window.outerWidth();
1474            var $materialExtra = ($('body.material .ocm-effect-wrap').length > 0) ? 2 : 0; //fix for showing material ocm BG since overflow is hidden on effect wrap
1475            windowsHeight = $window.height() - $adminBar - $headerHeight - $borderHeight + $materialExtra;  //updating global var
1476
1477            $(SECTION_SEL).each(function(){
1478                var slidesWrap = $(this).find(SLIDES_WRAPPER_SEL);
1479                var slides = $(this).find(SLIDE_SEL);
1480
1481                //adjusting the height of the table-cell for IE and Firefox
1482                if(options.verticalCentered){
1483                    $(this).find(TABLE_CELL_SEL).css('height', getTableHeight($(this)) + 'px');
1484                }
1485
1486                $(this).css('height', windowsHeight + 'px');
1487
1488
1489                //adjusting the position fo the FULL WIDTH slides...
1490                if (slides.length > 1) {
1491                    landscapeScroll(slidesWrap, slidesWrap.find(SLIDE_ACTIVE_SEL));
1492                }
1493            });
1494
1495             /* nectar addition */
1496            if($('#nectar_fullscreen_rows[data-animation="none"]').length == 0 &&
1497               $('#nectar_fullscreen_rows[data-animation="free-scroll"]').length == 0) {
1498                $('#nectar_fullscreen_rows').css('height', windowsHeight + 'px');
1499            }
1500
1501            //middle alignment of rows when desktop scroll overflow is turned off
1502            if($('#nectar_fullscreen_rows[data-content-overflow="hidden"]').length > 0) {
1503            	$('#nectar_fullscreen_rows>.vc_row.vc_row-flex:not(#footer-outer)>.fp-tableCell>.full-page-inner-wrap-outer>.full-page-inner-wrap[data-content-pos="middle"] > .full-page-inner>.container>.span_12').css('height', windowsHeight + 'px');
1504            	$('#nectar_fullscreen_rows>.vc_row.vc_row-flex:not(#footer-outer)>.fp-tableCell>.full-page-inner-wrap-outer>.full-page-inner-wrap[data-content-pos="middle"]').css('overflow', 'hidden');
1505            }
1506
1507            var activeSection = $(SECTION_ACTIVE_SEL);
1508            var sectionIndex = activeSection.index(SECTION_SEL);
1509
1510            //isn't it the first section?
1511            if(sectionIndex){
1512                //adjusting the position for the current section
1513                FP.silentMoveTo(sectionIndex + 1);
1514
1515            }
1516
1517            isResizing = false;
1518            $.isFunction( options.afterResize ) && resizing && options.afterResize.call(container);
1519            $.isFunction( options.afterReBuild ) && !resizing && options.afterReBuild.call(container);
1520        };
1521
1522        /**
1523        * Turns fullPage.js to normal scrolling mode when the viewport `width` or `height`
1524        * are smaller than the set limit values.
1525        */
1526        FP.setResponsive = function (active){
1527            var isResponsive = $body.hasClass(RESPONSIVE);
1528
1529            if(active){
1530                if(!isResponsive){
1531                    FP.setAutoScrolling(false, 'internal');
1532                    FP.setFitToSection(false, 'internal');
1533                    $(SECTION_NAV_SEL).hide();
1534                    $body.addClass(RESPONSIVE);
1535                }
1536            }
1537            else if(isResponsive){
1538                FP.setAutoScrolling(originals.autoScrolling, 'internal');
1539                FP.setFitToSection(originals.autoScrolling, 'internal');
1540                $(SECTION_NAV_SEL).show();
1541                $body.removeClass(RESPONSIVE);
1542            }
1543        };
1544
1545        //flag to avoid very fast sliding for landscape sliders
1546        var slideMoving = false;
1547
1548        var isTouchDevice = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/);
1549        var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0) || (navigator.maxTouchPoints));
1550        var container = $(this);
1551        /* nectar addition */
1552        var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
1553        var $adminBar = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
1554        if(window.vc_iframe) { $adminBar = 0; }
1555        var $borderMultiplier = ($('.body-border-right').length > 0 && $('#header-outer').css('background-color') == $('.body-border-right').css('background-color')) ? 1 : 2;
1556        var $borderHeight = ($('.body-border-right').length > 0 && $(window).width()>1000) ? $('.body-border-right').width()*$borderMultiplier : 0;
1557        var $headerHeight = ($('#header-outer.transparent').length == 0)  ? $headerNavSpace : 0 ;
1558        if( $('#header-outer.transparent').length > 0 && $('#header-secondary-outer[data-mobile="display_full"]').length > 0 && $(window).width() <= 1000 ) {
1559          $headerHeight += $('#header-secondary-outer').height();
1560        }
1561        var $materialExtra = ($('body.material .ocm-effect-wrap').length > 0) ? 2 : 0; //fix for showing material ocm BG since overflow is hidden on effect wrap
1562        var windowsHeight = $window.height() - $adminBar - $headerHeight - $borderHeight + $materialExtra;
1563        var isResizing = false;
1564        var isWindowFocused = true;
1565        var lastScrolledDestiny;
1566        var lastScrolledSlide;
1567        var canScroll = true;
1568        var clickedNavigation = false; // Nectar addition.
1569        var scrollings = [];
1570        var nav;
1571        var controlPressed;
1572        var isScrollAllowed = {};
1573        isScrollAllowed.m = {  'up':true, 'down':true, 'left':true, 'right':true };
1574        isScrollAllowed.k = $.extend(true,{}, isScrollAllowed.m);
1575        var originals = $.extend(true, {}, options); //deep copy
1576
1577        //timeouts
1578        var resizeId;
1579        var afterSectionLoadsId;
1580        var afterSlideLoadsId;
1581        var scrollId;
1582        var scrollId2;
1583        var keydownId;
1584
1585        if($(this).length){
1586            init();
1587            bindEvents();
1588        }
1589
1590        function init(){
1591            //if css3 is not supported, it will use jQuery animations
1592            if(options.css3){
1593                options.css3 = support3d();
1594            }
1595
1596            options.scrollBar = options.scrollBar || options.hybrid;
1597
1598
1599            setOptionsFromDOM();
1600
1601            prepareDom();
1602            FP.setAllowScrolling(true);
1603
1604            FP.setAutoScrolling(options.autoScrolling, 'internal');
1605
1606            //the starting point is a slide?
1607            var activeSlide = $(SECTION_ACTIVE_SEL).find(SLIDE_ACTIVE_SEL);
1608
1609            //the active section isn't the first one? Is not the first slide of the first section? Then we load that section/sl
1609ide by default.
1610            if( activeSlide.length &&  ($(SECTION_ACTIVE_SEL).index(SECTION_SEL) !== 0 || ($(SECTION_ACTIVE_SEL).index(SECTION_SEL) === 0 && activeSlide.index() !== 0))){
1611                silentLandscapeScroll(activeSlide);
1612            }
1613
1614            responsive();
1615
1616            //setting the class for the body element
1617            setBodyClass();
1618
1619            if(document.readyState === 'complete'){
1620                scrollToAnchor();
1621            }
1622            $window.on('load', scrollToAnchor);
1623        }
1624
1625        function bindEvents(){
1626            $window
1627                //when scrolling...
1628                .on('scroll', scrollHandler)
1629
1630                //detecting any change on the URL to scroll to the given anchor link
1631                //(a way to detect back history button as we play with the hashes on the URL)
1632                .on('hashchange', hashChangeHandler)
1633
1634                // window focus
1635                .on('focus', focusHandler)
1636
1637                //when opening a new tab (ctrl + t), `control` won't be pressed when comming back.
1638                .blur(blurHandler)
1639
1640                //when resizing the site, we adjust the heights of the sections, slimScroll...
1641                .resize(resizeHandler)
1642                /* nectar addition */
1643                .on('smartresize', checkScrollOverflow);
1644                $(window).on( 'vc_reload',function(){
1645
1646                  var currentRowIndex = ($('.fp-table.active').length > 0) ? $('.fp-table.active').index() + 1 : 'default';
1647
1648                  $('#nectar_fullscreen_rows > div.vc_element').addClass('fp-section');
1649                  $('#nectar_fullscreen_rows > div.vc_element').each(function(){
1650                    if( $(this).find('> .wpb_row > .fp-tableCell').length == 0 ) {
1651                      currentRowIndex = $(this).index() + 1;
1652                      addTableClass( $(this) );
1653                    }
1654                  });
1655
1656                  if(currentRowIndex != 'default') {
1657                    FP.silentMoveTo(currentRowIndex);
1658
1659                    //$('#fp-nav ul > li:nth-child(' + (currentRowIndex) + ')').find('> a').trigger('click');
1660                    //FP.reBuild(true);
1661                  }
1662
1663
1664                });
1665            $document
1666                //Sliding with arrow keys, both, vertical and horizontal
1667                .keydown(keydownHandler)
1668
1669                //to prevent scrolling while zooming
1670                .keyup(keyUpHandler)
1671
1672                //Scrolls to the section when clicking the navigation bullet
1673                .on('click touchstart', SECTION_NAV_SEL + ' a', sectionBulletHandler)
1674
1675                //Scrolls the slider to the given slide destination for the given section
1676                .on('click touchstart', SLIDES_NAV_LINK_SEL, slideBulletHandler)
1677
1678                .on('click', SECTION_NAV_TOOLTIP_SEL, tooltipTextHandler);
1679
1680            //Scrolling horizontally when clicking on the slider controls.
1681            $(SECTION_SEL).on('click touchstart', SLIDES_ARROW_SEL, slideArrowHandler);
1682
1683            /**
1684            * Applying normalScroll elements.
1685            * Ignoring the scrolls over the specified selectors.
1686            */
1687            if(options.normalScrollElements){
1688                $document.on('mouseenter', options.normalScrollElements, function () {
1689                    FP.setMouseWheelScrolling(false);
1690                });
1691
1692                $document.on('mouseleave', options.normalScrollElements, function(){
1693                    FP.setMouseWheelScrolling(true);
1694                });
1695            }
1696        }
1697
1698        /**
1699        * Setting options from DOM elements if they are not provided.
1700        */
1701        function setOptionsFromDOM(){
1702            var sections = container.find(options.sectionSelector);
1703
1704            //no anchors option? Checking for them in the DOM attributes
1705            if(!options.anchors.length){
1706                options.anchors = sections.filter('[data-anchor]').map(function(){
1707                    return $(this).data('anchor').toString();
1708                }).get();
1709            }
1710
1711            //no tooltipos option? Checking for them in the DOM attributes
1712            if(!options.navigationTooltips.length){
1713                options.navigationTooltips = sections.filter('[data-tooltip]').map(function(){
1714                    return $(this).data('tooltip').toString();
1715                }).get();
1716            }
1717        }
1718
1719        /**
1720        * Works over the DOM structure to set it up for the current fullpage optionss.
1721        */
1722        function prepareDom(){
1723            container.css({
1724                'height': '100%',
1725                'position': 'relative'
1726            });
1727
1728            //adding a class to recognize the container internally in the code
1729            container.addClass(WRAPPER);
1730            $('html').addClass(ENABLED);
1731
1732            //due to https://github.com/alvarotrigo/fullPage.js/issues/1502
1733            /* nectar addition */
1734            var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
1735            var $adminBar = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
1736            if(window.vc_iframe) { $adminBar = 0; }
1737            var $borderMultiplier = ($('.body-border-right').length > 0 && $('#header-outer').css('background-color') == $('.body-border-right').css('background-color')) ? 1 : 2;
1738            var $borderHeight = ($('.body-border-right').length > 0 && $(window).width()>1000) ? $('.body-border-right').width()*$borderMultiplier : 0;
1739            var $headerHeight = ($('#header-outer.transparent').length == 0 ) ? $headerNavSpace : 0 ;
1740            if( $('#header-outer.transparent').length > 0 && $('#header-secondary-outer[data-mobile="display_full"]').length > 0 && $(window).width() <= 1000 ) {
1741              $headerHeight += $('#header-secondary-outer').height();
1742            }
1743            var $materialExtra = ($('body.material .ocm-effect-wrap').length > 0) ? 2 : 0; //fix for showing material ocm BG since overflow is hidden on effect wrap
1744            windowsHeight = $window.height() - $adminBar - $headerHeight - $borderHeight + $materialExtra;
1745
1746            container.removeClass(DESTROYED); //in case it was destroyed before initilizing it again
1747
1748            addInternalSelectors();
1749
1750             //styling the sections / slides / menu
1751            $(SECTION_SEL).each(function(index){
1752                var section = $(this);
1753                var slides = section.find(SLIDE_SEL);
1754                var numSlides = slides.length;
1755
1756                styleSection(section, index);
1757                styleMenu(section, index);
1758
1759                // if there's any slide
1760                if (numSlides > 0) {
1761                    styleSlides(section, slides, numSlides);
1762                }else{
1763                    if(options.verticalCentered){
1764                        addTableClass(section);
1765                    }
1766                }
1767            });
1768
1769            //fixed elements need to be moved out of the plugin container due to problems with CSS3.
1770            if(options.fixedElements && options.css3){
1771                $(options.fixedElements).appendTo($body);
1772            }
1773
1774            //vertical centered of the navigation + active bullet
1775            if(options.navigation){
1776                addVerticalNavigation();
1777            }
1778
1779            enableYoutubeAPI();
1780            enableVidemoAPI();
1781
1782            if(options.scrollOverflow){
1783                if(document.readyState === 'complete'){
1784                    createSlimScrollingHandler();
1785                }
1786                //after DOM and images are loaded
1787                /* nectar addition */
1788                afterRenderActions();
1789                //$window.on('load', createSlimScrollingHandler);
1790                $window.on('load', function() { setTimeout(function(){
1791
1792                	 $(SECTION_SEL).each(function(){
1793		                var slides = $(this).find(SLIDE_SEL);
1794
1795		                if(slides.length){
1796		                    slides.each(function(){
1797		                        createSlimScrolling($(this));
1798		                    });
1799		                }else{
1800		                    createSlimScrolling($(this));
1801		                }
1802
1803		            });
1804
1805                },100); });
1806            }else{
1807                afterRenderActions();
1808            }
1809        }
1810
1811        /**
1812        * Styles the horizontal slides for a section.
1813        */
1814        function styleSlides(section, slides, numSlides){
1815            var sliderWidth = numSlides * 100;
1816            var slideWidth = 100 / numSlides;
1817
1818            slides.wrapAll('<div class="' + SLIDES_CONTAINER + '" />');
1819            slides.parent().wrap('<div class="' + SLIDES_WRAPPER + '" />');
1820
1821            section.find(SLIDES_CONTAINER_SEL).css('width', sliderWidth + '%');
1822
1823            if(numSlides > 1){
1824                if(options.controlArrows){
1825                    createSlideArrows(section);
1826                }
1827
1828                if(options.slidesNavigation){
1829                    addSlidesNavigation(section, numSlides);
1830                }
1831            }
1832
1833            slides.each(function(index) {
1834                $(this).css('width', slideWidth + '%');
1835
1836                if(options.verticalCentered){
1837                    addTableClass($(this));
1838                }
1839            });
1840
1841            var startingSlide = section.find(SLIDE_ACTIVE_SEL);
1842
1843            //if the slide won't be an starting point, the default will be the first one
1844            //the active section isn't the first one? Is not the first slide of the first section? Then we load that section/sl
1844ide by default.
1845            if( startingSlide.length &&  ($(SECTION_ACTIVE_SEL).index(SECTION_SEL) !== 0 || ($(SECTION_ACTIVE_SEL).index(SECTION_SEL) === 0 && startingSlide.index() !== 0))){
1846                silentLandscapeScroll(startingSlide);
1847            }else{
1848                slides.eq(0).addClass(ACTIVE);
1849            }
1850        }
1851
1852        /**
1853        * Styling vertical sections
1854        */
1855        function styleSection(section, index){
1856            //if no active section is defined, the 1st one will be the default one
1857            if(!index && $(SECTION_ACTIVE_SEL).length === 0) {
1858                section.addClass(ACTIVE);
1859            }
1860
1861            section.css('height', windowsHeight + 'px');
1862
1863            /* nectar addition */
1864            if($('#nectar_fullscreen_rows[data-animation="none"]').length == 0 &&
1865               $('#nectar_fullscreen_rows[data-animation="free-scroll"]').length == 0 ) {
1866            	$('#nectar_fullscreen_rows').css('height', windowsHeight + 'px');
1867            }
1868            if($('#nectar_fullscreen_rows[data-content-overflow="hidden"]').length > 0) $('#nectar_fullscreen_rows>.vc_row.vc_row-flex:not(#footer-outer)>.fp-tableCell>.full-page-inner-wrap-outer>.full-page-inner-wrap[data-content-pos="middle"] > .full-page-inner>.container>.span_12').css('height', windowsHeight + 'px');
1869
1870            if(options.paddingTop){
1871                section.css('padding-top', options.paddingTop);
1872            }
1873
1874            if(options.paddingBottom){
1875                section.css('padding-bottom', options.paddingBottom);
1876            }
1877
1878            if (typeof options.sectionsColor[index] !==  'undefined') {
1879                section.css('background-color', options.sectionsColor[index]);
1880            }
1881
1882            if (typeof options.anchors[index] !== 'undefined') {
1883                section.attr('data-anchor', options.anchors[index]);
1884            }
1885
1886            /* nectar addition */
1887            $(window).on('load', function(){
1888                $(window).trigger('resize');
1889            });
1890        }
1891
1892        /**
1893        * Sets the data-anchor attributes to the menu elements and activates the current one.
1894        */
1895        function styleMenu(section, index){
1896            if (typeof options.anchors[index] !== 'undefined') {
1897                //activating the menu / nav element on load
1898                if(section.hasClass(ACTIVE)){
1899                    activateMenuAndNav(options.anchors[index], index);
1900                }
1901            }
1902
1903            //moving the menu outside the main container if it is inside (avoid problems with fixed positions when using CSS3 tranforms)
1904            if(options.menu && options.css3 && $(options.menu).closest(WRAPPER_SEL).length){
1905                $(options.menu).appendTo($body);
1906            }
1907        }
1908
1909        /**
1910        * Adds internal classes to be able to provide customizable selectors
1911        * keeping the link with the style sheet.
1912        */
1913        function addInternalSelectors(){
1914            //adding internal class names to void problem with common ones
1915            $(options.sectionSelector).each(function(){
1916                $(this).addClass(SECTION);
1917            });
1918            $(options.slideSelector).each(function(){
1919                $(this).addClass(SLIDE);
1920            });
1921        }
1922
1923        /**
1924        * Creates the control arrows for the given section
1925        */
1926        function createSlideArrows(section){
1927            section.find(SLIDES_WRAPPER_SEL).after('<div class="' + SLIDES_ARROW_PREV + '"></div><div class="' + SLIDES_ARROW_NEXT + '"></div>');
1928
1929            if(options.controlArrowColor!='#fff'){
1930                section.find(SLIDES_ARROW_NEXT_SEL).css('border-color', 'transparent transparent transparent '+options.controlArrowColor);
1931                section.find(SLIDES_ARROW_PREV_SEL).css('border-color', 'transparent '+ options.controlArrowColor + ' transparent transparent');
1932            }
1933
1934            if(!options.loopHorizontal){
1935                section.find(SLIDES_ARROW_PREV_SEL).hide();
1936            }
1937        }
1938
1939        /**
1940        * Creates a vertical navigation bar.
1941        */
1942        /* nectar addition */
1943        function addVerticalNavigation(){
1944            if($('#nectar_fullscreen_rows').attr('data-dot-navigation') == 'hidden') { return; }
1945
1946            if($('#boxed').length > 0) {
1947            	$('#boxed').append('<div id="' + SECTION_NAV + '" class="'+$('#nectar_fullscreen_rows').attr('data-dot-navigation')+'"><ul></ul></div>');
1948            }
1949            else {
1950            	$body.append('<div id="' + SECTION_NAV + '" class="'+$('#nectar_fullscreen_rows').attr('data-dot-navigation')+'"><ul></ul></div>');
1951            }
1952
1953            var nav = $(SECTION_NAV_SEL);
1954
1955            nav.addClass(function() {
1956                return options.showActiveTooltip ? SHOW_ACTIVE_TOOLTIP + ' ' + options.navigationPosition : options.navigationPosition;
1957            });
1958
1959            for (var i = 0; i < $(SECTION_SEL).length; i++) {
1960
1961                var link = '';
1962                if (options.anchors.length) {
1963                    link = options.anchors[i];
1964                }
1965
1966                var li = '<li><a href="#' + link + '"><span></span></a>';
1967
1968                // Only add tooltip if needed (defined by user)
1969                var tooltip = options.navigationTooltips[i];
1970
1971                if (typeof tooltip !== 'undefined' && tooltip !== '') {
1972
1973                    if(tooltip.length == 1) {
1974                        li += '<div class="' + SECTION_NAV_TOOLTIP + ' ' + options.navigationPosition + '"></div>';
1975                      }
1976                    else {
1977                        li += '<div class="' + SECTION_NAV_TOOLTIP + ' ' + options.navigationPosition + '"><div class="tooltip-inner"><span>' + tooltip + '</span></div></div>';
1978                      }
1979                }
1980
1981                li += '</li>';
1982
1983                nav.find('ul').append(li);
1984            }
1985
1986            /*nectar addition - front end editor create new section control */
1987            if(window.vc_iframe) {
1988              var $addnewElClone = $('#nectar_fullscreen_rows > #vc_no-content-helper').clone();
1989              setTimeout(function(){
1990                if ( $addnewElClone.length > 0 ) {
1991                    $('#fp-nav ul').append('<li class="vc_add_new_row"><a href="#">
1991' + $addnewElClone.find('#vc_not-empty-add-element').html() + '</a> <div class="fp-tooltip right"><div class="tooltip-inner"><span>Add New Section</span></div></div> </li>');
1992                }
1993              },300);
1994
1995              $('body').off('click.vc_fp_new_section_rel');
1996              $('body').on('click.vc_fp_new_section_rel','#fp-nav ul .vc-c-icon-add',function(e) {
1997                 $('#nectar_fullscreen_rows > #vc_no-content-helper #vc_not-empty-add-element .vc-c-icon-add').trigger('click');
1998                 e.preventDefault();
1999                 return false;
2000              });
2001            }
2002            /*nectar addition end */
2003
2004            //centering it vertically
2005            $(SECTION_NAV_SEL).css('margin-top', '-' + (($(SECTION_NAV_SEL).height()/2) - $adminBar - $headerHeight/2) + 'px');
2006
2007            //activating the current active section
2008            $(SECTION_NAV_SEL).find('li').eq($(SECTION_ACTIVE_SEL).index(SECTION_SEL)).find('a').addClass(ACTIVE);
2009
2010            if($('#nectar_fullscreen_rows[data-footer="last_row"]').length > 0 || $('#nectar_fullscreen_rows[data-footer="default"]').length > 0) {
2011                nav.find('ul li:last-child').remove();
2012            }
2013        }
2014
2015        /**
2016        * Creates the slim scroll scrollbar for the sections and slides inside them.
2017        */
2018        function createSlimScrollingHandler(){
2019
2020            $(SECTION_SEL).each(function(){
2021                var slides = $(this).find(SLIDE_SEL);
2022
2023                if(slides.length){
2024                    slides.each(function(){
2025                        createSlimScrolling($(this));
2026                    });
2027                }else{
2028                    createSlimScrolling($(this));
2029                }
2030
2031            });
2032
2033            afterRenderActions();
2034        }
2035
2036        /*
2037        * Enables the Youtube videos API so we can control their flow if necessary.
2038        */
2039        function enableYoutubeAPI(){
2040            container.find('iframe[src*="youtube.com/embed/"]').each(function(){
2041                var sign = getUrlParamSign($(this).attr('src'));
2042                $(this).attr('src', $(this).attr('src') + sign + 'enablejsapi=1');
2043            });
2044        }
2045
2046        /*
2047        * Enables the Vimeo videos API so we can control their flow if necessary.
2048        */
2049        function enableVidemoAPI(){
2050            container.find('iframe[src*="player.vimeo.com/"]').each(function(){
2051                var sign = getUrlParamSign($(this).attr('src'));
2052                $(this).attr('src', $(this).attr('src') + sign + 'api=1');
2053            });
2054        }
2055
2056        /*
2057        * Returns the prefix sign to use for a new parameter in an existen URL.
2058        *
2059        * @return {String}  ? | &
2060        */
2061        function getUrlParamSign(url){
2062            return ( !/\?/.test( url ) ) ? '?' : '&';
2063        }
2064
2065        /**
2066        * Actions and callbacks to fire afterRender
2067        */
2068        function afterRenderActions(){
2069            var section = $(SECTION_ACTIVE_SEL);
2070
2071            section.addClass(COMPLETELY);
2072
2073            if(options.scrollOverflowHandler.afterRender){
2074                options.scrollOverflowHandler.afterRender(section);
2075            }
2076            lazyLoad(section);
2077            playMedia(section);
2078
2079            $.isFunction( options.afterLoad ) && options.afterLoad.call(section, section.data('anchor'), (section.index(SECTION_SEL) + 1));
2080            $.isFunction( options.afterRender ) && options.afterRender.call(container);
2081        }
2082
2083
2084        var isScrolling = false;
2085        var lastScroll = 0;
2086
2087        //when scrolling...
2088        function scrollHandler(){
2089            var currentSection;
2090
2091            if(!options.autoScrolling || options.scrollBar){
2092                var currentScroll = $window.scrollTop();
2093                var scrollDirection = getScrollDirection(currentScroll);
2094                var visibleSectionIndex = 0;
2095                var screen_mid = currentScroll + ($window.height() / 2.0);
2096
2097                //taking the section which is showing more content in the viewport
2098                var sections =  document.querySelectorAll(SECTION_SEL);
2099                for (var i = 0; i < sections.length; ++i) {
2100                    var section = sections[i];
2101
2102                    // Pick the the last section which passes the middle line of the screen.
2103                    if (section.offsetTop <= screen_mid)
2104                    {
2105                        visibleSectionIndex = i;
2106                    }
2107                }
2108
2109                if(isCompletelyInViewPort(scrollDirection)){
2110                    if(!$(SECTION_ACTIVE_SEL).hasClass(COMPLETELY)){
2111                        $(SECTION_ACTIVE_SEL).addClass(COMPLETELY).siblings().removeClass(COMPLETELY);
2112                    }
2113                }
2114
2115                //geting the last one, the current one on the screen
2116                currentSection = $(sections).eq(visibleSectionIndex);
2117
2118                //setting the visible section as active when manually scrolling
2119                //executing only once the first time we reach the section
2120                if(!currentSection.hasClass(ACTIVE)){
2121                    isScrolling = true;
2122                    var leavingSection = $(SECTION_ACTIVE_SEL);
2123                    var leavingSectionIndex = leavingSection.index(SECTION_SEL) + 1;
2124                    var yMovement = getYmovement(currentSection);
2125                    var anchorLink  = currentSection.data('anchor');
2126                    var sectionIndex = currentSection.index(SECTION_SEL) + 1;
2127                    var activeSlide = currentSection.find(SLIDE_ACTIVE_SEL);
2128
2129                    if(activeSlide.length){
2130                        var slideAnchorLink = activeSlide.data('anchor');
2131                        var slideIndex = activeSlide.index();
2132                    }
2133
2134                    if(canScroll){
2135                        currentSection.addClass(ACTIVE).siblings().removeClass(ACTIVE);
2136
2137                        $.isFunction( options.onLeave ) && options.onLeave.call( leavingSection, leavingSectionIndex, sectionIndex, yMovement);
2138
2139                        $.isFunction( options.afterLoad ) && options.afterLoad.call( currentSection, anchorLink, sectionIndex);
2140                        lazyLoad(currentSection);
2141
2142                        activateMenuAndNav(anchorLink, sectionIndex - 1);
2143
2144                        if(options.anchors.length){
2145                            //needed to enter in hashChange event when using the menu with anchor links
2146                            lastScrolledDestiny = anchorLink;
2147
2148                            setState(slideIndex, slideAnchorLink, anchorLink, sectionIndex);
2149                        }
2150                    }
2151
2152                    //small timeout in order to avoid entering in hashChange event when scrolling is not finished yet
2153                    clearTimeout(scrollId);
2154                    scrollId = setTimeout(function(){
2155                        isScrolling = false;
2156                    }, 100);
2157                }
2158
2159                if(options.fitToSection){
2160                    //for the auto adjust of the viewport to fit a whole section
2161                    clearTimeout(scrollId2);
2162
2163                    scrollId2 = setTimeout(function(){
2164                        //checking fitToSection again in case it was set to false before the timeout delay
2165                        if(canScroll && options.fitToSection){
2166                            //allows to scroll to an active section and
2167                            //if the section is already active, we prevent firing callbacks
2168                            if($(SECTION_ACTIVE_SEL).is(currentSection)){
2169                                isResizing = true;
2170                            }
2171                            scrollPage($(SECTION_ACTIVE_SEL));
2172
2173                            isResizing = false;
2174                        }
2175                    }, options.fitToSectionDelay);
2176                }
2177            }
2178        }
2179
2180        /**
2181        * Determines whether the active section has seen in its whole or not.
2182        */
2183        function isCompletelyInViewPort(movement){
2184            var top = $(SECTION_ACTIVE_SEL).position().top;
2185            var bottom = top + $window.height();
2186
2187            if(movement == 'up'){
2188                return bottom >= ($window.scrollTop() + $window.height());
2189            }
2190            return top <= $window.scrollTop();
2191        }
2192
2193        /**
2194        * Gets the directon of the the scrolling fired by the scroll event.
2195        */
2196        function getScrollDirection(currentScroll){
2197            var direction = currentScroll > lastScroll ? 'down' : 'up';
2198
2199            lastScroll = currentScroll;
2200
2201            return direction;
2202        }
2203
2204        /**
2205        * Determines the way of scrolling up or down:
2206        * by 'automatically' scrolling a section or by using the default and normal scrolling.
2207        */
2208        function scrolling(type, scrollable){
2209        	/* nectar addition */
2210            if (!isScrollAllowed.m[type] || $('#slide-out-widget-area.open[class*="fullscreen"]').length > 0){
2211                return;
2212            }
2213            /* nectar addition end */
2214            var check, scrollSection;
2215
2216            if(type == 'down'){
2217                check = 'bottom';
2218                scrollSection = FP.moveSectionDown;
2219            }else{
2220                check = 'top';
2221                scrollSection = FP.moveSectionUp;
2222            }
2223
2224            if(scrollable.length > 0 ){
2225                //is the scrollbar at the start/end of the scroll?
2226                if(options.scrollOverflowHandler.isScrolled(check, scrollable)){
2227
2228                	//* nectar addition */
2229                	if( $('#nectar_fullscreen_rows.nextSectionAllowed').length > 0) {
2230                   		scrollSection();
2231                   	}
2232                    $('#nectar_fullscreen_rows').addClass('nextSectionAllowed');
2233                }else{
2234                    return true;
2235                }
2236            }else{
2237                // moved up/down
2238                scrollSection();
2239            }
2240        }
2241
2242
2243        var touchStartY = 0;
2244        var touchStartX = 0;
2245        var touchEndY = 0;
2246        var touchEndX = 0;
2247
2248        /* Detecting touch events
2249
2250        * As we are changing the top property of the page on scrolling, we can not use the traditional way to detect it.
2251        * This way, the touchstart and the touch moves shows an small difference between them which is the
2252        * used one to determine the direction.
2253        */
2254        function touchMoveHandler(event){
2255            var e = event.originalEvent;
2256
2257            // additional: if one of the normalScrollElements isn't within options.normalScrollElementTouchThreshold hops up the DOM chain
2258            if (!checkParentForNormalScrollElement(event.target) && isReallyTouch(e) ) {
2259
2260                if(options.autoScrolling){
2261                    //preventing the easing on iOS devices
2262                    event.preventDefault();
2263                }
2264
2265                var activeSection = $(SECTION_ACTIVE_SEL);
2266                var scrollable = options.scrollOverflowHandler.scrollable(activeSection);
2267
2268                if (canScroll && !slideMoving) { //if theres any #
2269                    var touchEvents = getEventsPage(e);
2270
2271                    touchEndY = touchEvents.y;
2272                    touchEndX = touchEvents.x;
2273
2274                    //if movement in the X axys is greater than in the Y and the currect section has slides...
2275                    if (activeSection.find(SLIDES_WRAPPER_SEL).length && Math.abs(touchStartX - touchEndX) > (Math.abs(touchStartY - touchEndY))) {
2276
2277                        //is the movement greater than the minimum resistance to scroll?
2278                        if (Math.abs(touchStartX - touchEndX) > ($window.outerWidth() / 100 * options.touchSensitivity)) {
2279                            if (touchStartX > touchEndX) {
2280                                if(isScrollAllowed.m.right){
2281                                    FP.moveSlideRight(); //next
2282                                }
2283                            } else {
2284                                if(isScrollAllowed.m.left){
2285                                    FP.moveSlideLeft(); //prev
2286                                }
2287                            }
2288                        }
2289                    }
2290
2291                    //vertical scrolling (only when autoScrolling is enabled)
2292                    else if(options.autoScrolling){
2293
2294                        //is the movement greater than the minimum resistance to scroll?
2295                        if (Math.abs(touchStartY - touchEndY) > ($window.height() / 100 * options.touchSensitivity)) {
2296                            if (touchStartY > touchEndY) {
2297                                scrolling('down', scrollable);
2298                            } else if (touchEndY > touchStartY) {
2299                                scrolling('up', scrollable);
2300                            }
2301                        }
2302                    }
2303                }
2304            }
2305
2306        }
2307
2308        /**
2309         * recursive function to loop up the parent nodes to check if one of them exists in options.normalScrollElements
2310         * Currently works well for iOS - Android might need some testing
2311         * @param  {Element} el  target element / jquery selector (in subsequent nodes)
2312         * @param  {int}     hop current hop compared to options.normalScrollElementTouchThreshold
2313         * @return {boolean} true if there is a match to options.normalScrollElements
2314         */
2315        function checkParentForNormalScrollElement (el, hop) {
2316            hop = hop || 0;
2317            var parent = $(el).parent();
2318
2319            if (hop < options.normalScrollElementTouchThreshold &&
2320                parent.is(options.normalScrollElements) ) {
2321                return true;
2322            } else if (hop == options.normalScrollElementTouchThreshold) {
2323                return false;
2324            } else {
2325                return checkParentForNormalScrollElement(parent, ++hop);
2326            }
2327        }
2328
2329        /**
2330        * As IE >= 10 fires both touch and mouse events when using a mouse in a touchscreen
2331        * this way we make sure that is really a touch event what IE is detecting.
2332        */
2333        function isReallyTouch(e){
2334            //if is not IE   ||  IE is detecting `touch` or `pen`
2335            return typeof e.pointerType === 'undefined' || e.pointerType != 'mouse';
2336        }
2337
2338        /**
2339        * Handler for the touch start event.
2340        */
2341        function touchStartHandler(event){
2342            var e = event.originalEvent;
2343
2344            //stopping the auto scroll to adjust to a section
2345            if(options.fitToSection){
2346                $htmlBody.stop();
2347            }
2348
2349            if(isReallyTouch(e)){
2350                var touchEvents = getEventsPage(e);
2351                touchStartY = touchEvents.y;
2352                touchStartX = touchEvents.x;
2353            }
2354        }
2355
2356        /**
2357        * Gets the average of the last `number` elements of the given array.
2358        */
2359        function getAverage(elements, number){
2360            var sum = 0;
2361
2362            //taking `number` elements from the end to make the average, if there are not enought, 1
2363            var lastElements = elements.slice(Math.max(elements.length - number, 1));
2364
2365            for(var i = 0; i < lastElements.length; i++){
2366                sum = sum + lastElements[i];
2367            }
2368
2369            return Math.ceil(sum/number);
2370        }
2371
2372        /**
2373         * Detecting mousewheel scrolling
2374         *
2375         * http://blogs.sitepointstatic.com/examples/tech/mouse-wheel/index.html
2376         * http://www.sitepoint.com/html5-javascript-mouse-wheel/
2377         */
2378        var prevTime = new Date().getTime();
2379
2380        function MouseWheelHandler(e) {
2381
2382
2383            var curTime = new Date().getTime();
2384            var isNormalScroll = $(COMPLETELY_SEL).hasClass(NORMAL_SCROLL);
2385
2386            //autoscrolling and not zooming?
2387            if(options.autoScrolling && !controlPressed && !isNormalScroll){
2388
2389              /* Nectar addition - tracked whether clicked or scrolled to */
2390                clickedNavigation = false;
2391              /* Nectar addition end */
2392
2393                // cross-browser wheel delta
2394                e = e || window.event;
2395                var value = e.wheelDelta || -e.deltaY || -e.detail;
2396                var delta = Math.max(-1, Math.min(1, value));
2397
2398                var horizontalDetection = typeof e.wheelDeltaX !== 'undefined' || typeof e.deltaX !== 'undefined';
2399                var isScrollingVertically = (Math.abs(e.wheelDeltaX) < Math.abs(e.wheelDelta)) || (Math.abs(e.deltaX ) < Math.abs(e.deltaY) || !horizontalDetection);
2400
2401                //Limiting the array to 150 (lets not waste memory!)
2402                if(scrollings.length > 149){
2403                    scrollings.shift();
2404                }
2405
2406                //keeping record of the previous scrollings
2407                scrollings.push(Math.abs(value));
2408
2409                //preventing to scroll the site on mouse wheel when scrollbar is present
2410                if(options.scrollBar){
2411                    e.preventDefault ? e.preventDefault() : e.returnValue = false;
2412                }
2413
2414                var activeSection = $(SECTION_ACTIVE_SEL);
2415                var scrollable = options.scrollOverflowHandler.scrollable(activeSection);
2416
2417                //time difference between the last scroll and the current one
2418                var timeDiff = curTime-prevTime;
2419                prevTime = curTime;
2420
2421                //haven't they scrolled in a while?
2422                //(enough to be consider a different scrolling action to scroll another section)
2423                if(timeDiff > 200){
2424                    //emptying the array, we dont care about old scrollings for our averages
2425                    scrollings = [];
2426                }
2427                
2428                if(canScroll && $('#nectar_fullscreen_rows.trans-animation-active').length == 0){
2429                    var averageEnd = getAverage(scrollings, 10);
2430                    var averageMiddle = getAverage(scrollings, 70);
2431                    var isAccelerating = averageEnd >= averageMiddle;
2432
2433                    //to avoid double swipes...
2434                    if(isAccelerating && isScrollingVertically && $('.next-current').length == 0){
2435                        //scrolling down?
2436                        if (delta < 0) {
2437                            scrolling('down', scrollable);
2438
2439                        //scrolling up?
2440                        }else {
2441                            scrolling('up', scrollable);
2442                        }
2443                    }
2444                }
2445
2446                return false;
2447            }
2448
2449            if(options.fitToSection){
2450                //stopping the auto scroll to adjust to a section
2451                $htmlBody.stop();
2452            }
2453        }
2454
2455        /**
2456        * Slides a slider to the given direction.
2457        * Optional `section` param.
2458        */
2459        function moveSlide(direction, section){
2460            var activeSection = typeof section === 'undefined' ? $(SECTION_ACTIVE_SEL) : section;
2461            var slides = activeSection.find(SLIDES_WRAPPER_SEL);
2462            var numSlides = slides.find(SLIDE_SEL).length;
2463
2464            // more than one slide needed and nothing should be sliding
2465            if (!slides.length || slideMoving || numSlides < 2) {
2466                return;
2467            }
2468
2469            var currentSlide = slides.find(SLIDE_ACTIVE_SEL);
2470            var destiny = null;
2471
2472            if(direction === 'prev'){
2473                destiny = currentSlide.prev(SLIDE_SEL);
2474            }else{
2475                destiny = currentSlide.next(SLIDE_SEL);
2476            }
2477
2478            //isn't there a next slide in the secuence?
2479            if(!destiny.length){
2480                //respect loopHorizontal settin
2481                if (!options.loopHorizontal) return;
2482
2483                if(direction === 'prev'){
2484                    destiny = currentSlide.siblings(':last');
2485                }else{
2486                    destiny = currentSlide.siblings(':first');
2487                }
2488            }
2489
2490            slideMoving = true;
2491
2492            landscapeScroll(slides, destiny);
2493        }
2494
2495        /**
2496        * Maintains the active slides in the viewport
2497        * (Because he `scroll` animation might get lost with some actions, such as when using continuousVertical)
2498        */
2499        function keepSlidesPosition(){
2500            $(SLIDE_ACTIVE_SEL).each(function(){
2501                silentLandscapeScroll($(this), 'internal');
2502            });
2503        }
2504
2505        var previousDestTop = 0;
2506        /**
2507        * Returns the destination Y position based on the scrolling direction and
2508        * the height of the section.
2509        */
2510        function getDestinationPosition(element){
2511            var elemPosition = element.position();
2512
2513            //top of the desination will be at the top of the viewport
2514            var position = elemPosition.top;
2515            var isScrollingDown =  elemPosition.top > previousDestTop;
2516            var sectionBottom = position - windowsHeight + element.outerHeight();
2517
2518            //is the destination element bigger than the viewport?
2519            if(element.outerHeight() > windowsHeight){
2520                //scrolling up?
2521                if(!isScrollingDown){
2522                    position = sectionBottom;
2523                }
2524            }
2525
2526            //sections equal or smaller than the viewport height && scrolling down? ||  is resizing and its in the last section
2527            else if(isScrollingDown || (isResizing && element.is(':last-child')) ){
2528                //The bottom of the destination will be at the bottom of the viewport
2529                position = sectionBottom;
2530            }
2531
2532            /*
2533            Keeping record of the last scrolled position to determine the scrolling direction.
2534            No conventional methods can be used as the scroll bar might not be present
2535            AND the section might not be active if it is auto-height and didnt reach the middle
2536            of the viewport.
2537            */
2538            previousDestTop = position;
2539            return position;
2540        }
2541
2542        /**
2543        * Scrolls the site to the given element and scrolls to the slide if a callback is given.
2544        */
2545        function scrollPage(element, callback, isMovementUp){
2546        	/* nectar addition of ||canScroll and element.length == 0  */
2547            if(typeof element === 'undefined' || 
2548            element.length == 0 || 
2549            ( $('#nectar_fullscreen_rows[data-animation="none"]').length == 0 && canScroll == false ) || 
2550            $('.ocm-effect-wrap.material-ocm-open').length > 0 ||
2551            $('.nectar_team_member_overlay.open').length > 0 ) { 
2552              return; 
2553            } //there's no element to scroll, leaving the function
2554
2555            var dtop = getDestinationPosition(element);
2556 
2557            //local variables
2558            var v = {
2559                element: element,
2560                callback: callback,
2561                isMovementUp: isMovementUp,
2562                dtop: dtop,
2563                yMovement: getYmovement(element),
2564                anchorLink: element.data('anchor'),
2565                sectionIndex: element.index(SECTION_SEL),
2566                activeSlide: element.find(SLIDE_ACTIVE_SEL),
2567                activeSection: $(SECTION_ACTIVE_SEL),
2568                leavingSection: $(SECTION_ACTIVE_SEL).index(SECTION_SEL) + 1,
2569
2570                //caching the value of isResizing at the momment the function is called
2571                //because it will be checked later inside a setTimeout and the value might change
2572                localIsResizing: isResizing
2573            };
2574
2575            //quiting when destination scroll is the same as the current one
2576            if((v.activeSection.is(element) && !isResizing) || (options.scrollBar && $window.scrollTop() === v.dtop && !element.hasClass(AUTO_HEIGHT) )){ return; }
2577      
2578            if(v.activeSlide.length){
2579                var slideAnchorLink = v.activeSlide.data('anchor');
2580                var slideIndex = v.activeSlide.index();
2581            }
2582
2583            // If continuousVertical && we need to wrap around
2584            if (options.autoScrolling && options.continuousVertical && typeof (v.isMovementUp) !== "undefined" &&
2585                ((!v.isMovementUp && v.yMovement == 'up') || // Intending to scroll down but about to go up or
2586                (v.isMovementUp && v.yMovement == 'down'))) { // intending to scroll up but about to go down
2587
2588                v = createInfiniteSections(v);
2589            }
2590
2591            //callback (onLeave) if the site is not just resizing and readjusting the slides
2592            if($.isFunction(options.onLeave) && !v.localIsResizing){
2593                if(options.onLeave.call(v.activeSection, v.leavingSection, (v.sectionIndex + 1), v.yMovement) === false){
2594                    return;
2595                }
2596            }
2597
2598            stopMedia(v.activeSection);
2599            /* nectar addition */
2600            //element.addClass(ACTIVE).siblings().removeClass(ACTIVE); - moved to after section loads location
2601            if( $('#nectar_fullscreen_rows[data-animation="none"]').length > 0 && clickedNavigation == true ) {
2602              // Allow for instant changing between sections from clicking.
2603              clearTimeout(afterSectionLoadsId);
2604              element.removeClass(ACTIVE).siblings().removeClass(ACTIVE)
2605            } 
2606            lazyLoad(element);
2607            options.scrollOverflowHandler.onLeave();
2608
2609
2610            //preventing from activating the MouseWheelHandler event
2611            //more than once if the page is scrolling
2612            if( !window.vc_iframe) {
2613              canScroll = false;
2614            }
2615
2616            setState(slideIndex, slideAnchorLink, v.anchorLink, v.sectionIndex);
2617
2618            // Nectar addition - regular scrolling handling footer.
2619            setTimeout(function(){
2620              if( $('#nectar_fullscreen_rows[data-animation="none"]').length > 0 && 
2621              $('.last-before-footer').length > 0 && 
2622              clickedNavigation == true && 
2623              !$('#fp-nav ul > li:last-child a').hasClass('active') ) {
2624                setTimeout(function(){
2625                  var translate3d = 'translate3d(0px, -' + v.dtop + 'px, 0px)';
2626                  transformContainer(translate3d, true);
2627                },600);
2628              }
2629            },100);
2630           
2631            performMovement(v);
2632
2633            //flag to avoid callingn `scrollPage()` twice in case of using anchor links
2634            lastScrolledDestiny = v.anchorLink;
2635
2636            //avoid firing it twice (as it does also on scroll)
2637            activateMenuAndNav(v.anchorLink, v.sectionIndex);
2638        }
2639
2640        /**
2641        * Performs the movement (by CSS3 or by jQuery)
2642        */
2643        function performMovement(v){
2644          
2645            /* nectar addition */
2646            function switchedSection() {
2647
2648              var current = +new Date(),
2649                  remaining = end - current;
2650
2651              if(remaining < 60) {
2652                afterSectionLoads(v);
2653
2654              } else {
2655                requestAnimationFrame(switchedSection);
2656              }
2657
2658            }
2659
2660            scrollings = [];
2661
2662            if($('#nectar_fullscreen_rows[data-animation-speed="medium"]').length > 0) {
2663                    var $timeOutDur = ($('.last-before-footer').length == 0) ? 910 : 530;
2664                }
2665                else if($('#nectar_fullscreen_rows[data-animation-speed="slow"]').length > 0) {
2666                    var $timeOutDur = ($('.last-before-footer').length == 0) ? 1200 : 530;
2667                  }
2668                else {
2669                    var $timeOutDur = ($('.last-before-footer').length == 0) ? 720 : 530;
2670                  }
2671
2672            // using CSS3 translate functionality
2673            if (options.css3 && !options.scrollBar && $('#nectar_fullscreen_rows[data-animation="none"]').length == 0) {
2674                var translate3d = 'translate3d(0px, -' + v.dtop + 'px, 0px)';
2675                /* nectar addition */
2676                //transformContainer(translate3d, true);
2677
2678                //even when the scrollingSpeed is 0 there's a little delay, which might cause the
2679                //scrollingSpeed to change in case of using silentMoveTo();
2680                if(options.scrollingSpeed){
2681                    afterSectionLoadsId = setTimeout(function () {
2682                        afterSectionLoads(v);
2683                        HASHCHANGE = false;
2684                    }, $timeOutDur);
2685                }else{
2686                    afterSectionLoads(v);
2687                }
2688            }
2689
2690            // using jQuery animate
2691            else{
2692
2693                var scrollSettings = getScrollSettings(v);
2694
2695                if($('#nectar_fullscreen_rows[data-animation="none"]').length > 0) {
2696
2697                  if($('.last-before-footer').length == 0) {
2698
2699                         var translate3d = 'translate3d(0px, -' + v.dtop + 'px, 0px)';
2700                        transformContainer(translate3d, true);
2701    
2702                        //even when the scrollingSpeed is 0 there's a little delay, which might cause the
2703                        //scrollingSpeed to change in case of using silentMoveTo();
2704                        if(options.scrollingSpeed){
2705
2706                          if(window.vc_iframe) {
2707
2708                            var duration = 950,
2709                            end = +new Date() + duration;
2710                            var $cur_section = $('#nectar_fullscreen_rows > .active');
2711                            requestAnimationFrame(switchedSection);
2712
2713                          } else {
2714                            afterSectionLoadsId = setTimeout(function () {
2715                                afterSectionLoads(v);
2716                            }, options.scrollingSpeed);
2717                          }
2718
2719                        }else{
2720                            afterSectionLoads(v);
2721                        }
2722
2723
2724                    }
2725
2726                   else {
2727
2728                      setTimeout(function(){
2729
2730                         if(options.scrollBar){
2731                            setTimeout(function(){
2732                                afterSectionLoads(v);
2733                            },30);
2734                        }else{
2735                            afterSectionLoads(v);
2736                        }
2737                        },$timeOutDur);
2738                  }
2739
2740                }
2741
2742                else {
2743                    setTimeout(function(){
2744
2745                         if(options.scrollBar){
2746                            setTimeout(function(){
2747                                afterSectionLoads(v);
2748                            },30);
2749                        }else{
2750                            afterSectionLoads(v);
2751                        }
2752                        HASHCHANGE = false;
2753                    },$timeOutDur);
2754                }
2755
2756
2757
2758            }
2759        }
2760
2761        /**
2762        * Gets the scrolling settings depending on the plugin autoScrolling option
2763        */
2764        function getScrollSettings(v){
2765            var scroll = {};
2766
2767            if(options.autoScrolling && !options.scrollBar){
2768                scroll.options = { 'top': -v.dtop};
2769                scroll.element = WRAPPER_SEL;
2770            }else{
2771                scroll.options = { 'scrollTop': v.dtop};
2772                scroll.element = 'html, body';
2773            }
2774
2775            return scroll;
2776        }
2777
2778        /**
2779        * Adds sections before or after the current one to create the infinite effect.
2780        */
2781        function createInfiniteSections(v){
2782            // Scrolling down
2783            if (!v.isMovementUp) {
2784                // Move all previous sections to after the active section
2785                $(SECTION_ACTIVE_SEL).after(v.activeSection.prevAll(SECTION_SEL).get().reverse());
2786            }
2787            else { // Scrolling up
2788                // Move all next sections to before the active section
2789                $(SECTION_ACTIVE_SEL).before(v.activeSection.nextAll(SECTION_SEL));
2790            }
2791
2792            // Maintain the displayed position (now that we changed the element order)
2793            silentScroll($(SECTION_ACTIVE_SEL).position().top);
2794
2795            // Maintain the active slides visible in the viewport
2796            keepSlidesPosition();
2797
2798            // save for later the elements that still need to be reordered
2799            v.wrapAroundElements = v.activeSection;
2800
2801            // Recalculate animation variables
2802            v.dtop = v.element.position().top;
2803            v.yMovement = getYmovement(v.element);
2804
2805            return v;
2806        }
2807
2808        /**
2809        * Fix section order after continuousVertical changes have been animated
2810        */
2811        function continuousVerticalFixSectionOrder (v) {
2812            // If continuousVertical is in effect (and autoScrolling would also be in effect then),
2813            // finish moving the elements around so the direct navigation will function more simply
2814            if (!v.wrapAroundElements || !v.wrapAroundElements.length) {
2815                return;
2816            }
2817
2818            if (v.isMovementUp) {
2819                $(SECTION_FIRST_SEL).before(v.wrapAroundElements);
2820            }
2821            else {
2822                $(SECTION_LAST_SEL).after(v.wrapAroundElements);
2823            }
2824
2825            silentScroll($(SECTION_ACTIVE_SEL).position().top);
2826
2827            // Maintain the active slides visible in the viewport
2828            keepSlidesPosition();
2829        }
2830
2831
2832        /**
2833        * Actions to do once the section is loaded.
2834        */
2835        function afterSectionLoads (v){
2836
2837            continuousVerticalFixSectionOrder(v);
2838            /* nectar addition */
2839            //v.element.find('.fp-scrollable').mouseover();
2840
2841            //resizing the scrolling divs
2842            //$(SECTION_SEL).each(function(){
2843             //   if(options.scrollOverflow){
2844             //       createSlimScrolling($(this));
2845             //   }
2846            //});
2847          $('#nectar_fullscreen_rows').removeClass('trans-animation-active');
2848          v.element.addClass(ACTIVE).siblings().removeClass(ACTIVE);
2849
2850            //callback (afterLoad) if the site is not just resizing and readjusting the slides
2851            $.isFunction(options.afterLoad) && !v.localIsResizing && options.afterLoad.call(v.element, v.anchorLink, (v.sectionIndex + 1));
2852            options.scrollOverflowHandler.afterLoad();
2853
2854            playMedia(v.element);
2855            v.element.addClass(COMPLETELY).siblings().removeClass(COMPLETELY);
2856
2857            $.isFunction(v.callback) && v.callback.call(this);
2858
2859            // Delay a little for mac smooth scroll
2860            if( clickedNavigation == true ) {
2861                canScroll = true;
2862            }
2863
2864            if( $('#nectar_fullscreen_rows[data-animation-speed="fast"]').length > 0 ) {
2865              setTimeout(function(){
2866                canScroll = true;
2867              },425);
2868            } else {
2869              setTimeout(function(){
2870                canScroll = true;
2871              },250);
2872            }
2873
2874        }
2875
2876        /**
2877        * Lazy loads image, video and audio elements.
2878        */
2879        function lazyLoad(destiny){
2880            var destiny = getSlideOrSection(destiny);
2881
2882            destiny.find('img[data-src], source[data-src], audio[data-src], iframe[data-src]').each(function(){
2883                $(this).attr('src', $(this).data('src'));
2884                $(this).removeAttr('data-src');
2885
2886                if($(this).is('source')){
2887                    $(this).closest('video').get(0).load();
2888                }
2889            });
2890        }
2891
2892        /**
2893        * Plays video and audio elements.
2894        */
2895        function playMedia(destiny){
2896
2897        	 /* nectar addition */
2898
2899            var destiny = getSlideOrSection(destiny);
2900
2901            //playing HTML5 media elements
2902            destiny.find('video.nectar-video-bg').each(function(){
2903                var element = $(this).get(0);
2904                var videoBGStored = $(this);
2905
2906                if(  typeof element.play === 'function' ) {
2907
2908                    if( navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
2909                        element.onplay = function(){
2910                           videoBGStored.parents('.nectar-video-wrap').animate({'opacity':'1'},200);
2911                        }
2912                    }
2913
2914                    element.play();
2915
2916                }
2917            });
2918
2919            //youtube videos
2920            destiny.find('.nectar-youtube-bg iframe[src*="youtube.com/embed/"]').each(function(){
2921                var element = $(this).get(0);
2922
2923                if( /youtube\.com\/embed\//.test($(this).attr('src'))){
2924
2925                    element.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*');
2926                }
2927            });
2928
2929			 /* nectar addition end */
2930        }
2931
2932        /**
2933        * Stops video and audio elements.
2934        */
2935        function stopMedia(destiny){
2936            var destiny = getSlideOrSection(destiny);
2937
2938            //stopping HTML5 media elements
2939            destiny.find('video, audio').each(function(){
2940                var element = $(this).get(0);
2941                
2942                if( !element.hasAttribute('data-keepplaying') && typeof element.pause === 'function' ) {
2943                     /* nectar addition */
2944                    if( $(this).parents('.nectar_video_player_self_hosted').length > 0 && $(this).is('[autoplay][muted]') ) {
2945
2946                    } else {
2947                      element.pause();
2948                    }
2949                    /* nectar addition end */
2950                }
2951            });
2952
2953            //youtube videos
2954            destiny.find('.nectar-youtube-bg iframe[src*="youtube.com/embed/"]').each(function(){
2955                var element = $(this).get(0);
2956
2957                if( /youtube\.com\/embed\//.test($(this).attr('src')) && !element.hasAttribute('data-keepplaying')){
2958                    $(this).get(0).contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}','*');
2959                }
2960            });
2961        }
2962
2963        /**
2964        * Gets the active slide (or section) for the given section
2965        */
2966        function getSlideOrSection(destiny){
2967            var slide = destiny.find(SLIDE_ACTIVE_SEL);
2968            if( slide.length ) {
2969                destiny = $(slide);
2970            }
2971
2972            return destiny;
2973        }
2974
2975        /**
2976        * Scrolls to the anchor in the URL when loading the site
2977        */
2978        function scrollToAnchor(){
2979
2980            //getting the anchor link in the URL and deleting the `#`
2981            var value =  window.location.hash.replace('#', '').split('/');
2982            var section = decodeURIComponent(value[0]);
2983            var slide = decodeURIComponent(value[1]);
2984            /* nectar addition */
2985            if(section && $('.vc_row[data-fullscreen-anchor-id="'+section+'"]').length > 0){  //if theres any #
2986            /* nectar addition end */
2987                if(options.animateAnchor){
2988                    scrollPageAndSlide(section, slide);
2989                }else{
2990                    FP.silentMoveTo(section, slide);
2991                }
2992            }
2993        }
2994
2995        /**
2996        * Detecting any change on the URL to scroll to the given anchor link
2997        * (a way to detect back history button as we play with the hashes on the URL)
2998        */
2999        function hashChangeHandler(){
3000
3001            if(!isScrolling && !options.lockAnchors){
3002                var value =  window.location.hash.replace('#', '').split('/');
3003                var section = decodeURIComponent(value[0]);
3004                var slide = decodeURIComponent(value[1]);
3005
3006                    //when moving to a slide in the first section for the first time (first time to add an anchor to the URL)
3007                    var isFirstSlideMove =  (typeof lastScrolledDestiny === 'undefined');
3008                    var isFirstScrollMove = (typeof lastScrolledDestiny === 'undefined' && typeof slide === 'undefined' && !slideMoving);
3009
3010
3011                if(section.length){
3012                    /*in order to call scrollpage() only once for each destination at a time
3013                    It is called twice for each scroll otherwise, as in case of using anchorlinks `hashChange`
3014                    event is fired on every scroll too.*/
3015                    if ((section && section !== lastScrolledDestiny) && !isFirstSlideMove || isFirstScrollMove || (!slideMoving && lastScrolledSlide != slide ))  {
3016                        scrollPageAndSlide(section, slide);
3017                    }
3018                }
3019
3020
3021            }
3022
3023            /* nectar addition */
3024
3025            //make page history work when clicking faster than transition speed
3026            if($('#nectar_fullscreen_rows[data-animation-speed="medium"]').length > 0)
3027                var $timeOutDur = ($('.last-before-footer').length == 0) ? 900 : 530;
3028            else if($('#nectar_fullscreen_rows[data-animation-speed="slow"]').length > 0)
3029                var $timeOutDur = ($('.last-before-footer').length == 0) ? 1180 : 530;
3030            else
3031                var $timeOutDur = ($('.last-before-footer').length == 0) ? 710 : 530;
3032
3033            if(HASHCHANGE == true) {
3034            	clearInterval(HASHCHANGETIMEOUT);
3035
3036            	HASHCHANGETIMEOUT = setInterval(function(){
3037            		if(canScroll) {
3038	            		hashChangeHandler();
3039	            		//reset
3040	            		clearInterval(HASHCHANGETIMEOUT);
3041	            	}
3042            	},100);
3043            }
3044
3045            HASHCHANGE = true;
3046             /* nectar addition */
3047        }
3048
3049        //Sliding with arrow keys, both, vertical and horizontal
3050        function keydownHandler(e) {
3051
3052            clearTimeout(keydownId);
3053
3054            var activeElement = $(':focus');
3055
3056            if(!activeElement.is('textarea') && !activeElement.is('input') && !activeElement.is('select') &&
3057                activeElement.attr('contentEditable') !== "true" && activeElement.attr('contentEditable') !== '' &&
3058                options.keyboardScrolling && options.autoScrolling){
3059                var keyCode = e.which;
3060
3061                //preventing the scroll with arrow keys & spacebar & Page Up & Down keys
3062                var keyControls = [40, 38, 32, 33, 34];
3063                if($.inArray(keyCode, keyControls) > -1){
3064                    e.preventDefault();
3065                }
3066
3067                controlPressed = e.ctrlKey;
3068
3069                keydownId = setTimeout(function(){
3070                    onkeydown(e);
3071                },150);
3072            }
3073        }
3074
3075        function tooltipTextHandler(){
3076            $(this).prev().trigger('click');
3077        }
3078
3079        //to prevent scrolling while zooming
3080        function keyUpHandler(e){
3081            if(isWindowFocused){ //the keyup gets fired on new tab ctrl + t in Firefox
3082                controlPressed = e.ctrlKey;
3083            }
3084        }
3085
3086        //binding the mousemove when the mouse's middle button is released
3087        function mouseDownHandler(e){
3088            //middle button
3089            if (e.which == 2){
3090                oldPageY = e.pageY;
3091                container.on('mousemove', mouseMoveHandler);
3092            }
3093        }
3094
3095        //unbinding the mousemove when the mouse's middle button is released
3096        function mouseUpHandler(e){
3097            //middle button
3098            if (e.which == 2){
3099                container.off('mousemove');
3100            }
3101        }
3102
3103        //Scrolling horizontally when clicking on the slider controls.
3104        function slideArrowHandler(){
3105            var section = $(this).closest(SECTION_SEL);
3106
3107            if ($(this).hasClass(SLIDES_PREV)) {
3108                if(isScrollAllowed.m.left){
3109                    FP.moveSlideLeft(section);
3110                }
3111            } else {
3112                if(isScrollAllowed.m.right){
3113                    FP.moveSlideRight(section);
3114                }
3115            }
3116        }
3117
3118        function focusHandler() {
3119          isWindowFocused = true;
3120        }
3121
3122        //when opening a new tab (ctrl + t), `control` won't be pressed when comming back.
3123        function blurHandler(){
3124            isWindowFocused = false;
3125            controlPressed = false;
3126        }
3127
3128        //Scrolls to the section when clicking the navigation bullet
3129        function sectionBulletHandler(e){
3130
3131            e.preventDefault();
3132            /* nectar addition */
3133            clickedNavigation = true;
3134            if( $('#nectar_fullscreen_rows[data-animation="none"]').length > 0 ) {
3135              var index = $(this).parent().index();
3136              scrollPage($(SECTION_SEL).eq(index));
3137            } else {
3138  
3139              if($('#nectar_fullscreen_rows .wpb_row.transition-out').length == 0 && $('#nectar_fullscreen_rows.trans-animation-active').length == 0) {
3140                var index = $(this).parent().index();
3141                scrollPage($(SECTION_SEL).eq(index));
3142               }
3143            }
3144            
3145        }
3146
3147        //Scrolls the slider to the given slide destination for the given section
3148        function slideBulletHandler(e){
3149            e.preventDefault();
3150            var slides = $(this).closest(SECTION_SEL).find(SLIDES_WRAPPER_SEL);
3151            var destiny = slides.find(SLIDE_SEL).eq($(this).closest('li').index());
3152
3153            landscapeScroll(slides, destiny);
3154        }
3155
3156        /**
3157        * Keydown event
3158        */
3159        function onkeydown(e){
3160            var shiftPressed = e.shiftKey;
3161
3162            switch (e.which) {
3163                //up
3164                case 38:
3165                case 33:
3166                    if(isScrollAllowed.k.up){
3167                        FP.moveSectionUp();
3168                    }
3169                    break;
3170
3171                //down
3172                case 32: //spacebar
3173                    if(shiftPressed && isScrollAllowed.k.up){
3174                        FP.moveSectionUp();
3175                        break;
3176                    }
3177                case 40:
3178                case 34:
3179                    if(isScrollAllowed.k.down){
3180                        FP.moveSectionDown();
3181                    }
3182                    break;
3183
3184                //Home
3185                case 36:
3186                    if(isScrollAllowed.k.up){
3187                        FP.moveTo(1);
3188                    }
3189                    break;
3190
3191                //End
3192                case 35:
3193                     if(isScrollAllowed.k.down){
3194                        FP.moveTo( $(SECTION_SEL).length );
3195                    }
3196                    break;
3197
3198                //left
3199                case 37:
3200                    if(isScrollAllowed.k.left){
3201                        FP.moveSlideLeft();
3202                    }
3203                    break;
3204
3205                //right
3206                case 39:
3207                    if(isScrollAllowed.k.right){
3208                        FP.moveSlideRight();
3209                    }
3210                    break;
3211
3212                default:
3213                    return; // exit this handler for other keys
3214            }
3215        }
3216
3217        /**
3218        * Detecting the direction of the mouse movement.
3219        * Used only for the middle button of the mouse.
3220        */
3221        var oldPageY = 0;
3222        function mouseMoveHandler(e){
3223            if(canScroll){
3224                // moving up
3225                if (e.pageY < oldPageY && isScrollAllowed.m.up){
3226                    FP.moveSectionUp();
3227                }
3228
3229                // moving down
3230                else if(e.pageY > oldPageY && isScrollAllowed.m.down){
3231                    FP.moveSectionDown();
3232                }
3233            }
3234            oldPageY = e.pageY;
3235        }
3236
3237        /**
3238        * Scrolls horizontal sliders.
3239        */
3240        function landscapeScroll(slides, destiny){
3241            var destinyPos = destiny.position();
3242            var slideIndex = destiny.index();
3243            var section = slides.closest(SECTION_SEL);
3244            var sectionIndex = section.index(SECTION_SEL);
3245            var anchorLink = section.data('anchor');
3246            var slidesNav = section.find(SLIDES_NAV_SEL);
3247            var slideAnchor = getAnchor(destiny);
3248            var prevSlide = section.find(SLIDE_ACTIVE_SEL);
3249
3250            //caching the value of isResizing at the momment the function is called
3251            //because it will be checked later inside a setTimeout and the value might change
3252            var localIsResizing = isResizing;
3253
3254            if(options.onSlideLeave){
3255                var prevSlideIndex = prevSlide.index();
3256                var xMovement = getXmovement(prevSlideIndex, slideIndex);
3257
3258                //if the site is not just resizing and readjusting the slides
3259                if(!localIsResizing && xMovement!=='none'){
3260                    if($.isFunction( options.onSlideLeave )){
3261                        if(options.onSlideLeave.call( prevSlide, anchorLink, (sectionIndex + 1), prevSlideIndex, xMovement, slideIndex ) === false){
3262                            slideMoving = false;
3263                            return;
3264                        }
3265                    }
3266                }
3267            }
3268            stopMedia(prevSlide);
3269
3270            destiny.addClass(ACTIVE).siblings().removeClass(ACTIVE);
3271            if(!localIsResizing){
3272                lazyLoad(destiny);
3273            }
3274
3275            if(!options.loopHorizontal && options.controlArrows){
3276                //hidding it for the fist slide, showing for the rest
3277                section.find(SLIDES_ARROW_PREV_SEL).toggle(slideIndex!==0);
3278
3279                //hidding it for the last slide, showing for the rest
3280                section.find(SLIDES_ARROW_NEXT_SEL).toggle(!destiny.is(':last-child'));
3281            }
3282
3283            //only changing the URL if the slides are in the current section (not for resize re-adjusting)
3284            if(section.hasClass(ACTIVE)){
3285                setState(slideIndex, slideAnchor, anchorLink, sectionIndex);
3286            }
3287
3288            var afterSlideLoads = function(){
3289                //if the site is not just resizing and readjusting the slides
3290                if(!localIsResizing){
3291                    $.isFunction( options.afterSlideLoad ) && options.afterSlideLoad.call( destiny, anchorLink, (sectionIndex + 1), slideAnchor, slideIndex);
3292                }
3293                playMedia(destiny);
3294
3295                //letting them slide again
3296                slideMoving = false;
3297            };
3298
3299            if(options.css3){
3300                var translate3d = 'translate3d(-' + Math.round(destinyPos.left) + 'px, 0px, 0px)';
3301
3302                addAnimation(slides.find(SLIDES_CONTAINER_SEL), options.scrollingSpeed>0).css(getTransforms(translate3d));
3303
3304                afterSlideLoadsId = setTimeout(function(){
3305                    afterSlideLoads();
3306                }, options.scrollingSpeed, options.easing);
3307            }else{
3308                slides.animate({
3309                    scrollLeft : Math.round(destinyPos.left)
3310                }, options.scrollingSpeed, options.easing, function() {
3311
3312                    afterSlideLoads();
3313                });
3314            }
3315
3316            slidesNav.find(ACTIVE_SEL).removeClass(ACTIVE);
3317            slidesNav.find('li').eq(slideIndex).find('a').addClass(ACTIVE);
3318        }
3319
3320        var previousHeight = windowsHeight;
3321
3322        //when resizing the site, we adjust the heights of the sections, slimScroll...
3323        function resizeHandler(){
3324        	if($('#nectar_fullscreen_rows.afterLoaded').length == 0) return false;
3325            //checking if it needs to get responsive
3326            responsive();
3327
3328            // rebuild immediately on touch devices
3329            if (isTouchDevice) {
3330                var activeElement = $(document.activeElement);
3331
3332                //if the keyboard is NOT visible
3333                if (!activeElement.is('textarea') && !activeElement.is('input') && !activeElement.is('select')) {
3334                    var currentHeight = $window.height();
3335
3336                    //making sure the change in the viewport size is enough to force a rebuild. (20 % of the window to avoid problems when hidding scroll bars)
3337                    /* nectar addition */
3338                    //if( Math.abs(currentHeight - previousHeight) > (20 * Math.max(previousHeight, currentHeight) / 100) ){
3339                        FP.reBuild(true);
3340                        previousHeight = currentHeight;
3341                    //}
3342                    /* nectar addition end */
3343                }
3344            }else{
3345                //in order to call the functions only when the resize is finished
3346                //http://stackoverflow.com/questions/4298612/jquery-how-to-call-resize-event-only-once-its-finished-resizing
3347                clearTimeout(resizeId);
3348
3349                 /* nectar addition */
3350               // resizeId = setTimeout(function(){
3351                    FP.reBuild(true);
3352               // }, 230);
3353            }
3354        }
3355        /* nectar addition */
3356        function checkScrollOverflow() {
3357
3358        	if($('#nectar_fullscreen_rows.afterLoaded').length ==0) return false;
3359        	$(SECTION_SEL).each(function(){
3360
3361                //resizing the scrolling divs
3362                if(options.scrollOverflow){
3363
3364                    createSlimScrolling($(this));
3365
3366                }
3367
3368            });
3369        }
3370        /**
3371        * Checks if the site needs to get responsive and disables autoScrolling if so.
3372        * A class `fp-responsive` is added to the plugin's container in case the user wants to use it for his own responsive CSS.
3373        */
3374        function responsive(){
3375            var widthLimit = options.responsive || options.responsiveWidth; //backwards compatiblity
3376            var heightLimit = options.responsiveHeight;
3377
3378            //only calculating what we need. Remember its called on the resize event.
3379            var isBreakingPointWidth = widthLimit && $window.outerWidth() < widthLimit;
3380            var isBreakingPointHeight = heightLimit && $window.height() < heightLimit;
3381
3382            if(widthLimit && heightLimit){
3383                FP.setResponsive(isBreakingPointWidth || isBreakingPointHeight);
3384            }
3385            else if(widthLimit){
3386                FP.setResponsive(isBreakingPointWidth);
3387            }
3388            else if(heightLimit){
3389                FP.setResponsive(isBreakingPointHeight);
3390            }
3391
3392            /* nectar addition */
3393            $(SECTION_NAV_SEL).css('margin-top', '-' + (($(SECTION_NAV_SEL).height()/2) - $adminBar - $headerHeight/2) + 'px');
3394        }
3395
3396        /**
3397        * Adds transition animations for the given element
3398        */
3399        function addAnimation(element){
3400            var transition = 'all ' + options.scrollingSpeed + 'ms ' + options.easingcss3;
3401
3402            element.removeClass(NO_TRANSITION);
3403            return element.css({
3404                '-webkit-transition': transition,
3405                'transition': transition
3406            });
3407        }
3408
3409        /**
3410        * Remove transition animations for the given element
3411        */
3412        function removeAnimation(element){
3413            return element.addClass(NO_TRANSITION);
3414        }
3415
3416        /**
3417         * Activating the website navigation dots according to the given slide name.
3418         */
3419        function activateNavDots(name, sectionIndex){
3420            if(options.navigation){
3421                $(SECTION_NAV_SEL).find(ACTIVE_SEL).removeClass(ACTIVE);
3422                if(name){
3423                    $(SECTION_NAV_SEL).find('a[href="#' + name + '"]').addClass(ACTIVE);
3424                }else{
3425                    $(SECTION_NAV_SEL).find('li').eq(sectionIndex).find('a').addClass(ACTIVE);
3426                }
3427            }
3428        }
3429
3430        /**
3431         * Activating the website main menu elements according to the given slide name.
3432         */
3433        function activateMenuElement(name){
3434            if(options.menu){
3435                $(options.menu).find(ACTIVE_SEL).removeClass(ACTIVE);
3436                $(options.menu).find('[data-menuanchor="'+name+'"]').addClass(ACTIVE);
3437            }
3438        }
3439
3440        /**
3441        * Sets to active the current menu and vertical nav items.
3442        */
3443        function activateMenuAndNav(anchor, index){
3444            activateMenuElement(anchor);
3445            activateNavDots(anchor, index);
3446        }
3447
3448        /**
3449        * Retuns `up` or `down` depending on the scrolling movement to reach its destination
3450        * from the current section.
3451        */
3452        function getYmovement(destiny){
3453            var fromIndex = $(SECTION_ACTIVE_SEL).index(SECTION_SEL);
3454            var toIndex = destiny.index(SECTION_SEL);
3455            if( fromIndex == toIndex){
3456                return 'none';
3457            }
3458            if(fromIndex > toIndex){
3459                return 'up';
3460            }
3461            return 'down';
3462        }
3463
3464        /**
3465        * Retuns `right` or `left` depending on the scrolling movement to reach its destination
3466        * from the current slide.
3467        */
3468        function getXmovement(fromIndex, toIndex){
3469            if( fromIndex == toIndex){
3470                return 'none';
3471            }
3472            if(fromIndex > toIndex){
3473                return 'left';
3474            }
3475            return 'right';
3476        }
3477
3478        /**
3479        * Checks if the element needs scrollbar and if the user wants to apply it.
3480        * If so it creates it.
3481        *
3482        * @param {Object} element   jQuery object of the section or slide
3483        */
3484        function createSlimScrolling(element){
3485
3486        	var $fpScrollOverflow = ($('#nectar_fullscreen_rows').attr('data-content-overflow') == 'hidden') ? false : true;
3487           if( $('#nectar_fullscreen_rows[data-animation="free-scroll"]').length > 0 ) {
3488            $fpScrollOverflow = false;
3489            return;
3490           }
3491            //User doesn't want scrollbar here? Sayonara baby!
3492            if(element.hasClass('fp-noscroll')) return;
3493
3494            //needed to make `scrollHeight` work under Opera 12
3495            element.css('overflow', 'hidden');
3496
3497            var scrollOverflowHandler = options.scrollOverflowHandler;
3498            var wrap = scrollOverflowHandler.wrapContent();
3499            //in case element is a slide
3500            var section = element.closest(SECTION_SEL);
3501            var scrollable = scrollOverflowHandler.scrollable(element);
3502            var contentHeight;
3503
3504            //if there was scroll, the contentHeight will be the one in the scrollable section
3505            if(scrollable.length){
3506            	/* nectar addition */
3507                //contentHeight = scrollOverflowHandler.scrollHeight(element);
3508                 contentHeight = ( element.find('.full-page-inner-wrap > .full-page-inner > .container > .span_12').length > 0 ) ? element.find('.full-page-inner-wrap > .full-page-inner > .container > .span_12').outerHeight(true) : element.find('.full-page-inner-wrap > .full-page-inner > .span_12').outerHeight(true);
3509           		/* nectar addition end */
3510            } else{
3511            	/* nectar addition */
3512                contentHeight = ( element.find('.full-page-inner-wrap > .full-page-inner > .container > .span_12').length > 0 ) ? element.find('.full-page-inner-wrap > .full-page-inner > .container > .span_12').outerHeight(true) : element.find('.full-page-inner-wrap > .full-page-inner > .span_12').outerHeight(true);
3513                if(options.verticalCentered){
3514                    contentHeight = ( element.find('.full-page-inner-wrap > .full-page-inner > .container > .span_12').length > 0 ) ? element.find('.full-page-inner-wrap > .full-page-inner > .container > .span_12').outerHeight(true) : element.find('.full-page-inner-wrap > .full-page-inner > .span_12').outerHeight(true);
3515                }
3516            }
3517
3518            /* nectar addition */
3519            var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
3520            var $adminBar = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
3521            if(window.vc_iframe) { $adminBar = 0; }
3522            var $headerHeight = ($('#header-outer.transparent').length == 0 ) ? $headerNavSpace : 0 ;
3523            if( $('#header-outer.transparent').length > 0 && $('#header-secondary-outer[data-mobile="display_full"]').length > 0 && $(window).width() <= 1000 ) {
3524              $headerHeight += $('#header-secondary-outer').height();
3525            }
3526            var $borderMultiplier = ($('.body-border-right').length > 0 && $('#header-outer').css('background-color') == $('.body-border-right').css('background-color')) ? 1 : 2;
3527            var $borderHeight = ($('.body-border-right').length > 0 && $(window).width()>1000) ? $('.body-border-right').width()*$borderMultiplier : 0;
3528            var $materialExtra = ($('body.material .ocm-effect-wrap').length > 0) ? 2 : 0; //fix for showing material ocm BG since overflow is hidden on effect wrap
3529
3530            windowsHeight = $window.height() - $adminBar - $headerHeight - $borderHeight + $materialExtra;
3531            var scrollHeight = windowsHeight - parseInt(section.css('padding-bottom')) - parseInt(section.css('padding-top'));
3532
3533            //needs scroll?
3534             if ( contentHeight > windowsHeight+5 && $(element).find('.nectar-slider-wrap[data-fullscreen="true"]').length == 0 && !($(window).width() > 1000 && $fpScrollOverflow == false) ) {
3535
3536
3537                //was there already an scroll ? Updating it
3538                if(scrollable.length){
3539                    scrollOverflowHandler.update(element, scrollHeight);
3540                }
3541                //creating the scrolling
3542                else{
3543
3544                    if(options.verticalCentered){
3545                        element.find(TABLE_CELL_SEL).wrapInner(wrap);
3546                    }else{
3547                        element.wrapInner(wrap);
3548                    }
3549                    scrollOverflowHandler.create(element, scrollHeight);
3550                }
3551            }
3552            //removing the scrolling when it is not necessary anymore
3553            else{
3554                scrollOverflowHandler.remove(element);
3555            }
3556
3557            //undo
3558            element.css('overflow', '');
3559        }
3560
3561        function addTableClass(element){
3562            /*nectar addition - front end editor*/
3563            if(window.vc_iframe) {
3564              element.addClass(TABLE).find('> .wpb_row').wrapInner('<div class="' + TABLE_CELL + '" style="height:' + getTableHeight(element) + 'px;" />');
3565            } else {
3566              element.addClass(TABLE).wrapInner('<div class="' + TABLE_CELL + '" style="height:' + getTableHeight(element) + 'px;" />');
3567            }
3568        }
3569
3570        function getTableHeight(element){
3571            var sectionHeight = windowsHeight;
3572
3573            if(options.paddingTop || options.paddingBottom){
3574                var section = element;
3575                if(!section.hasClass(SECTION)){
3576                    section = element.closest(SECTION_SEL);
3577                }
3578
3579                var paddings = parseInt(section.css('padding-top')) + parseInt(section.css('padding-bottom'));
3580                sectionHeight = (windowsHeight - paddings);
3581            }
3582
3583            return sectionHeight;
3584        }
3585
3586        /**
3587        * Adds a css3 transform property to the container class with or without animation depending on the animated param.
3588        */
3589        function transformContainer(translate3d, animated){
3590            if(animated){
3591                addAnimation(container);
3592            }else{
3593                removeAnimation(container);
3594            }
3595
3596            container.css(getTransforms(translate3d));
3597
3598            //syncronously removing the class after the animation has been applied.
3599            setTimeout(function(){
3600                container.removeClass(NO_TRANSITION);
3601            },10);
3602        }
3603
3604        /**
3605        * Gets a section by its anchor / index
3606        */
3607        function getSectionByAnchor(sectionAnchor){
3608            //section
3609            var section = container.find(SECTION_SEL + '[data-anchor="'+sectionAnchor+'"]');
3610            if(!section.length){
3611                section = $(SECTION_SEL).eq( (sectionAnchor -1) );
3612            }
3613
3614            return section;
3615        }
3616
3617        /**
3618        * Gets a slide inside a given section by its anchor / index
3619        */
3620        function getSlideByAnchor(slideAnchor, section){
3621            var slides = section.find(SLIDES_WRAPPER_SEL);
3622            var slide =  slides.find(SLIDE_SEL + '[data-anchor="'+slideAnchor+'"]');
3623
3624            if(!slide.length){
3625                slide = slides.find(SLIDE_SEL).eq(slideAnchor);
3626            }
3627
3628            return slide;
3629        }
3630
3631        /**
3632        * Scrolls to the given section and slide anchors
3633        */
3634        function scrollPageAndSlide(destiny, slide){
3635            var section = getSectionByAnchor(destiny);
3636
3637            //default slide
3638            if (typeof slide === 'undefined') {
3639                slide = 0;
3640            }
3641
3642            //we need to scroll to the section and then to the slide
3643            if (destiny !== lastScrolledDestiny && !section.hasClass(ACTIVE)){
3644                scrollPage(section, function(){
3645                    scrollSlider(section, slide);
3646                });
3647            }
3648            //if we were already in the section
3649            else{
3650                scrollSlider(section, slide);
3651            }
3652        }
3653
3654        /**
3655        * Scrolls the slider to the given slide destination for the given section
3656        */
3657        function scrollSlider(section, slideAnchor){
3658            if(typeof slideAnchor !== 'undefined'){
3659                var slides = section.find(SLIDES_WRAPPER_SEL);
3660                var destiny =  getSlideByAnchor(slideAnchor, section);
3661
3662                if(destiny.length){
3663                    landscapeScroll(slides, destiny);
3664                }
3665            }
3666        }
3667
3668        /**
3669        * Creates a landscape navigation bar with dots for horizontal sliders.
3670        */
3671        function addSlidesNavigation(section, numSlides){
3672            section.append('<div class="' + SLIDES_NAV + '"><ul></ul></div>');
3673            var nav = section.find(SLIDES_NAV_SEL);
3674
3675            //top or bottom
3676            nav.addClass(options.slidesNavPosition);
3677
3678            for(var i=0; i< numSlides; i++){
3679                nav.find('ul').append('<li><a href="#"><span></span></a></li>');
3680            }
3681
3682            //centering it
3683            nav.css('margin-left', '-' + (nav.width()/2) + 'px');
3684
3685            nav.find('li').first().find('a').addClass(ACTIVE);
3686        }
3687
3688
3689        /**
3690        * Sets the state of the website depending on the active section/slide.
3691        * It changes the URL hash when needed and updates the body class.
3692        */
3693        function setState(slideIndex, slideAnchor, anchorLink, sectionIndex){
3694            var sectionHash = '';
3695
3696            if(options.anchors.length && !options.lockAnchors){
3697
3698                //isn't it the first slide?
3699                if(slideIndex){
3700                    if(typeof anchorLink !== 'undefined'){
3701                        sectionHash = anchorLink;
3702                    }
3703
3704                    //slide without anchor link? We take the index instead.
3705                    if(typeof slideAnchor === 'undefined'){
3706                        slideAnchor = slideIndex;
3707                    }
3708
3709                    lastScrolledSlide = slideAnchor;
3710                    setUrlHash(sectionHash + '/' + slideAnchor);
3711
3712                //first slide won't have slide anchor, just the section one
3713                }else if(typeof slideIndex !== 'undefined'){
3714                    lastScrolledSlide = slideAnchor;
3715                    setUrlHash(anchorLink);
3716                }
3717
3718                //section without slides
3719                else{
3720
3721                  // nectar addition - stop empty anchor sections (including footer) from causing page jump
3722                  if(anchorLink) {
3723                    setUrlHash(anchorLink);
3724                  }
3725                  // nectar addition end
3726
3727                }
3728            }
3729
3730            setBodyClass();
3731        }
3732
3733        /**
3734        * Sets the URL hash.
3735        */
3736        function setUrlHash(url){
3737            if(options.recordHistory){
3738                location.hash = url;
3739            }else{
3740                //Mobile Chrome doesn't work the normal way, so... lets use HTML5 for phones :)
3741                if(isTouchDevice || isTouch){
3742                    window.history.replaceState(undefined, undefined, '#' + url);
3743                }else{
3744                    var baseUrl = window.location.href.split('#')[0];
3745                    window.location.replace( baseUrl + '#' + url );
3746                }
3747            }
3748        }
3749
3750        /**
3751        * Gets the anchor for the given slide / section. Its index will be used if there's none.
3752        */
3753        function getAnchor(element){
3754            var anchor = element.data('anchor');
3755            var index = element.index();
3756
3757            //Slide without anchor link? We take the index instead.
3758            if(typeof anchor === 'undefined'){
3759                anchor = index;
3760            }
3761
3762            return anchor;
3763        }
3764
3765        /**
3766        * Sets a class for the body of the page depending on the active section / slide
3767        */
3768        function setBodyClass(){
3769            /* nectar addition */
3770            /*
3771            var section = $(SECTION_ACTIVE_SEL);
3772            var slide = section.find(SLIDE_ACTIVE_SEL);
3773
3774            var sectionAnchor = getAnchor(section);
3775            var slideAnchor = getAnchor(slide);
3776
3777            var text = String(sectionAnchor);
3778
3779            if(slide.length){
3780                text = text + '-' + slideAnchor;
3781            }
3782
3783            //changing slash for dash to make it a valid CSS style
3784            text = text.replace('/', '-').replace('#','');
3785
3786            //removing previous anchor classes
3787            var classRe = new RegExp('\\b\\s?' + VIEWING_PREFIX + '-[^\\s]+\\b', "g");
3788            $body[0].className = $body[0].className.replace(classRe, '');
3789
3790            //adding the current anchor
3791            $body.addClass(VIEWING_PREFIX + '-' + text);
3792            */
3793        }
3794
3795        /**
3796        * Checks for translate3d support
3797        * @return boolean
3798        * http://stackoverflow.com/questions/5661671/detecting-transform-translate3d-support
3799        */
3800        function support3d() {
3801            var el = document.createElement('p'),
3802                has3d,
3803                transforms = {
3804                    'webkitTransform':'-webkit-transform',
3805                    'OTransform':'-o-transform',
3806                    'msTransform':'-ms-transform',
3807                    'MozTransform':'-moz-transform',
3808                    'transform':'transform'
3809                };
3810
3811            // Add it to the body to get the computed style.
3812            document.body.insertBefore(el, null);
3813
3814            for (var t in transforms) {
3815                if (el.style[t] !== undefined) {
3816                    el.style[t] = 'translate3d(1px,1px,1px)';
3817                    has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]);
3818                }
3819            }
3820
3821            document.body.removeChild(el);
3822
3823            return (has3d !== undefined && has3d.length > 0 && has3d !== 'none');
3824        }
3825
3826        /**
3827        * Removes the auto scrolling action fired by the mouse wheel and trackpad.
3828        * After this function is called, the mousewheel and trackpad movements won't scroll through sections.
3829        */
3830        function removeMouseWheelHandler(){
3831            if (document.addEventListener) {
3832                document.removeEventListener('mousewheel', MouseWheelHandler, false); //IE9, Chrome, Safari, Oper
3833                document.removeEventListener('wheel', MouseWheelHandler, false); //Firefox
3834                document.removeEventListener('MozMousePixelScroll', MouseWheelHandler, false); //old Firefox
3835            } else {
3836                document.detachEvent('onmousewheel', MouseWheelHandler); //IE 6/7/8
3837            }
3838        }
3839
3840        /**
3841        * Adds the auto scrolling action for the mouse wheel and trackpad.
3842        * After this function is called, the mousewheel and trackpad movements will scroll through sections
3843        * https://developer.mozilla.org/en-US/docs/Web/Events/wheel
3844        */
3845        function addMouseWheelHandler(){
3846            var prefix = '';
3847            var _addEventListener;
3848
3849            if (window.addEventListener){
3850                _addEventListener = "addEventListener";
3851            }else{
3852                _addEventListener = "attachEvent";
3853                prefix = 'on';
3854            }
3855
3856             // detect available wheel event
3857            var support = 'onwheel' in document.createElement('div') ? 'wheel' : // Modern browsers support "wheel"
3858                      document.onmousewheel !== undefined ? 'mousewheel' : // Webkit and IE support at least "mousewheel"
3859                      'DOMMouseScroll'; // let's assume that remaining browsers are older Firefox
3860
3861
3862            if(support == 'DOMMouseScroll'){
3863                document[ _addEventListener ](prefix + 'MozMousePixelScroll', MouseWheelHandler, false);
3864            }
3865
3866            //handle MozMousePixelScroll in older Firefox
3867            else{
3868                document[ _addEventListener ](prefix + support, MouseWheelHandler, false);
3869            }
3870        }
3871
3872        /**
3873        * Binding the mousemove when the mouse's middle button is pressed
3874        */
3875        function addMiddleWheelHandler(){
3876            container
3877                .on('mousedown', mouseDownHandler)
3878                .on('mouseup', mouseUpHandler);
3879        }
3880
3881        /**
3882        * Unbinding the mousemove when the mouse's middle button is released
3883        */
3884        function removeMiddleWheelHandler(){
3885            container
3886                .off('mousedown', mouseDownHandler)
3887                .off('mouseup', mouseUpHandler);
3888        }
3889
3890        /**
3891        * Adds the possibility to auto scroll through sections on touch devices.
3892        */
3893        function addTouchHandler(){
3894            if(isTouchDevice || isTouch){
3895                //Microsoft pointers
3896                var MSPointer = getMSPointer();
3897
3898                $(WRAPPER_SEL).off('touchstart ' +  MSPointer.down).on('touchstart ' + MSPointer.down, touchStartHandler);
3899                $(WRAPPER_SEL).off('touchmove ' + MSPointer.move).on('touchmove ' + MSPointer.move, touchMoveHandler);
3900            }
3901        }
3902
3903        /**
3904        * Removes the auto scrolling for touch devices.
3905        */
3906        function removeTouchHandler(){
3907            if(isTouchDevice || isTouch){
3908                //Microsoft pointers
3909                var MSPointer = getMSPointer();
3910
3911                $(WRAPPER_SEL).off('touchstart ' + MSPointer.down);
3912                $(WRAPPER_SEL).off('touchmove ' + MSPointer.move);
3913            }
3914        }
3915
3916        /*
3917        * Returns and object with Microsoft pointers (for IE<11 and for IE >= 11)
3918        * http://msdn.microsoft.com/en-us/library/ie/dn304886(v=vs.85).aspx
3919        */
3920        function getMSPointer(){
3921            var pointer;
3922
3923            //IE >= 11 & rest of browsers
3924            if(window.PointerEvent){
3925                pointer = { down: 'pointerdown', move: 'pointermove'};
3926            }
3927
3928            //IE < 11
3929            else{
3930                pointer = { down: 'MSPointerDown', move: 'MSPointerMove'};
3931            }
3932
3933            return pointer;
3934        }
3935
3936        /**
3937        * Gets the pageX and pageY properties depending on the browser.
3938        * https://github.com/alvarotrigo/fullPage.js/issues/194#issuecomment-34069854
3939        */
3940        function getEventsPage(e){
3941            var events = [];
3942
3943            events.y = (typeof e.pageY !== 'undefined' && (e.pageY || e.pageX) ? e.pageY : e.touches[0].pageY);
3944            events.x = (typeof e.pageX !== 'undefined' && (e.pageY || e.pageX) ? e.pageX : e.touches[0].pageX);
3945
3946            //in touch devices with scrollBar:true, e.pageY is detected, but we have to deal with touch events. #1008
3947            if(isTouch && isReallyTouch(e) && options.scrollBar){
3948                events.y = e.touches[0].pageY;
3949                events.x = e.touches[0].pageX;
3950            }
3951
3952            return events;
3953        }
3954
3955        /**
3956        * Slides silently (with no animation) the active slider to the given slide.
3957        */
3958        function silentLandscapeScroll(activeSlide, noCallbacks){
3959            FP.setScrollingSpeed (0, 'internal');
3960
3961            if(typeof noCallbacks !== 'undefined'){
3962                //preventing firing callbacks afterSlideLoad etc.
3963                isResizing = true;
3964            }
3965
3966            landscapeScroll(activeSlide.closest(SLIDES_WRAPPER_SEL), activeSlide);
3967
3968            if(typeof noCallbacks !== 'undefined'){
3969                isResizing = false;
3970            }
3971
3972            FP.setScrollingSpeed(originals.scrollingSpeed, 'internal');
3973        }
3974
3975        /**
3976        * Scrolls silently (with no animation) the page to the given Y position.
3977        */
3978        function silentScroll(top){
3979            if(options.scrollBar){
3980                container.scrollTop(top);
3981            }
3982            else if (options.css3) {
3983                var translate3d = 'translate3d(0px, -' + top + 'px, 0px)';
3984                transformContainer(translate3d, false);
3985            }
3986            else {
3987                container.css('top', -top);
3988            }
3989        }
3990
3991        /**
3992        * Returns the cross-browser transform string.
3993        */
3994        function getTransforms(translate3d){
3995            return {
3996                '-webkit-transform': translate3d,
3997                '-moz-transform': translate3d,
3998                '-ms-transform':translate3d,
3999                'transform': translate3d
4000            };
4001        }
4002
4003        /**
4004        * Allowing or disallowing the mouse/swipe scroll in a given direction. (not for keyboard)
4005        * @type  m (mouse) or k (keyboard)
4006        */
4007        function setIsScrollAllowed(value, direction, type){
4008            switch (direction){
4009                case 'up': isScrollAllowed[type].up = value; break;
4010                case 'down': isScrollAllowed[type].down = value; break;
4011                case 'left': isScrollAllowed[type].left = value; break;
4012                case 'right': isScrollAllowed[type].right = value; break;
4013                case 'all':
4014                    if(type == 'm'){
4015                        FP.setAllowScrolling(value);
4016                    }else{
4017                        FP.setKeyboardScrolling(value);
4018                    }
4019            }
4020        }
4021
4022        /*
4023        * Destroys fullpage.js plugin events and optinally its html markup and styles
4024        */
4025        FP.destroy = function(all){
4026            FP.setAutoScrolling(false, 'internal');
4027            FP.setAllowScrolling(false);
4028            FP.setKeyboardScrolling(false);
4029            container.addClass(DESTROYED);
4030
4031            clearTimeout(afterSlideLoadsId);
4032            clearTimeout(afterSectionLoadsId);
4033            clearTimeout(resizeId);
4034            clearTimeout(scrollId);
4035            clearTimeout(scrollId2);
4036
4037            $window
4038                .off('scroll', scrollHandler)
4039                .off('hashchange', hashChangeHandler)
4040                .off('resize', resizeHandler);
4041
4042            $document
4043                .off('click', SECTION_NAV_SEL + ' a')
4044                .off('mouseenter', SECTION_NAV_SEL + ' li')
4045                .off('mouseleave', SECTION_NAV_SEL + ' li')
4046                .off('click', SLIDES_NAV_LINK_SEL)
4047                .off('mouseover', options.normalScrollElements)
4048                .off('mouseout', options.normalScrollElements);
4049
4050            $(SECTION_SEL)
4051                .off('click', SLIDES_ARROW_SEL);
4052
4053            clearTimeout(afterSlideLoadsId);
4054            clearTimeout(afterSectionLoadsId);
4055
4056            //lets make a mess!
4057            if(all){
4058                destroyStructure();
4059            }
4060        };
4061
4062        /*
4063        * Removes inline styles added by fullpage.js
4064        */
4065        function destroyStructure(){
4066            //reseting the `top` or `translate` properties to 0
4067            silentScroll(0);
4068
4069            $(SECTION_NAV_SEL + ', ' + SLIDES_NAV_SEL +  ', ' + SLIDES_ARROW_SEL).remove();
4070
4071            //removing inline styles
4072            $(SECTION_SEL).css( {
4073                'height': '',
4074                'background-color' : '',
4075                'padding': ''
4076            });
4077
4078            $(SLIDE_SEL).css( {
4079                'width': ''
4080            });
4081
4082            container.css({
4083                'height': '',
4084                'position': '',
4085                '-ms-touch-action': '',
4086                'touch-action': ''
4087            });
4088
4089            $htmlBody.css({
4090                'overflow': '',
4091                'height': ''
4092            });
4093
4094            // remove .fp-enabled class
4095            $('html').removeClass(ENABLED);
4096
4097            // remove all of the .fp-viewing- classes
4098            $.each($body.get(0).className.split(/\s+/), function (index, className) {
4099                if (className.indexOf(VIEWING_PREFIX) === 0) {
4100                    $body.removeClass(className);
4101                }
4102            });
4103
4104            //removing added classes
4105            $(SECTION_SEL + ', ' + SLIDE_SEL).each(function(){
4106                options.scrollOverflowHandler.remove($(this));
4107                $(this).removeClass(TABLE + ' ' + ACTIVE);
4108            });
4109
4110            removeAnimation(container);
4111
4112            //Unwrapping content
4113            container.find(TABLE_CELL_SEL + ', ' + SLIDES_CONTAINER_SEL + ', ' + SLIDES_WRAPPER_SEL).each(function(){
4114                //unwrap not being use in case there's no child element inside and its just text
4115                $(this).replaceWith(this.childNodes);
4116            });
4117
4118            //scrolling the page to the top with no animation
4119            $htmlBody.scrollTop(0);
4120
4121            //removing selectors
4122            var usedSelectors = [SECTION, SLIDE, SLIDES_CONTAINER];
4123            $.each(usedSelectors, function(index, value){
4124                $('.' + value).removeClass(value);
4125            });
4126        }
4127
4128        /*
4129        * Sets the state for a variable with multiple states (original, and temporal)
4130        * Some variables such as `autoScrolling` or `recordHistory` might change automatically its state when using `responsive` or `autoScrolling:false`.
4131        * This function is used to keep track of both states, the original and the temporal one.
4132        * If type is not 'internal', then we assume the user is globally changing the variable.
4133        */
4134        function setVariableState(variable, value, type){
4135            options[variable] = value;
4136            if(type !== 'internal'){
4137                originals[variable] = value;
4138            }
4139        }
4140
4141        /**
4142        * Displays warnings
4143        */
4144        function displayWarnings(){
4145            if($('html').hasClass(ENABLED)){
4146                showError('error', 'Fullpage.js can only be initialized once and you are doing it multiple times!');
4147                return;
4148            }
4149
4150            // Disable mutually exclusive settings
4151            if (options.continuousVertical &&
4152                (options.loopTop || options.loopBottom)) {
4153                options.continuousVertical = false;
4154                showError('warn', 'Option `loopTop/loopBottom` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled');
4155            }
4156
4157            if(options.scrollBar && options.scrollOverflow){
4158                showError('warn', 'Option `scrollBar` is mutually exclusive with `scrollOverflow`. Sections with scrollOverflow might not work well in Firefox');
4159            }
4160
4161            if(options.continuousVertical && options.scrollBar){
4162                options.continuousVertical = false;
4163                showError('warn', 'Option `scrollBar` is mutually exclusive with `continuousVertical`; `continuousVertical` disabled');
4164            }
4165
4166            //anchors can not have the same value as any element ID or NAME
4167            $.each(options.anchors, function(index, name){
4168
4169                //case insensitive selectors (http://stackoverflow.com/a/19465187/1081396)
4170                var nameAttr = $document.find('[name]').filter(function() {
4171                    return $(this).attr('name') && $(this).attr('name').toLowerCase() == name.toLowerCase();
4172                });
4173
4174                var idAttr = $document.find('[id]').filter(function() {
4175                    return $(this).attr('id') && $(this).attr('id').toLowerCase() == name.toLowerCase();
4176                });
4177
4178                if(idAttr.length || nameAttr.length ){
4179                    showError('error', 'data-anchor tags can not have the same value as any `id` element on the site (or `name` element for IE).');
4180                    idAttr.length && showError('error', '"' + name + '" is is being used by another element `id` property');
4181                    nameAttr.length && showError('error', '"' + name + '" is is being used by another element `name` property');
4182                }
4183            });
4184        }
4185
4186        /**
4187        * Shows a message in the console of the given type.
4188        */
4189        function showError(type, text){
4190            console && console[type] && console[type]('fullPage: ' + text);
4191        }
4192    }; //end of $.fn.fullpage
4193
4194    if(typeof IScroll !== 'undefined'){
4195        /*
4196        * Turns iScroll `mousewheel` option off dynamically
4197        * https://github.com/cubiq/iscroll/issues/1036
4198        */
4199        IScroll.prototype.wheelOn = function () {
4200            this.wrapper.addEventListener('wheel', this);
4201            this.wrapper.addEventListener('mousewheel', this);
4202            this.wrapper.addEventListener('DOMMouseScroll', this);
4203        };
4204
4205        /*
4206        * Turns iScroll `mousewheel` option on dynamically
4207        * https://github.com/cubiq/iscroll/issues/1036
4208        */
4209        IScroll.prototype.wheelOff = function () {
4210            this.wrapper.removeEventListener('wheel', this);
4211            this.wrapper.removeEventListener('mousewheel', this);
4212            this.wrapper.removeEventListener('DOMMouseScroll', this);
4213        };
4214    }
4215
4216    /**
4217     * An object to handle overflow scrolling.
4218     * This uses jquery.slimScroll to accomplish overflow scrolling.
4219     * It is possible to pass in an alternate scrollOverflowHandler
4220     * to the fullpage.js option that implements the same functions
4221     * as this handler.
4222     *
4223     * @type {Object}
4224     */
4225    var iscrollHandler = {
4226        refreshId: null,
4227        iScrollInstances: [],
4228
4229        /**
4230        * Turns off iScroll for the destination section.
4231        * When scrolling very fast on some trackpads (and Apple laptops) the inertial scrolling would
4232        * scroll the destination section/slide before the sections animations ends.
4233        */
4234        onLeave: function(){
4235            var scroller = $(SECTION_ACTIVE_SEL).find(SCROLLABLE_SEL).data('iscrollInstance');
4236
4237            if(typeof scroller !== 'undefined' && scroller){
4238                scroller.wheelOff();
4239            }
4240
4241
4242        },
4243
4244        // Turns on iScroll on section load
4245        afterLoad: function(){
4246
4247            var scroller = $(SECTION_ACTIVE_SEL).find(SCROLLABLE_SEL).data('iscrollInstance');
4248            if(typeof scroller !== 'undefined' && scroller){
4249                scroller.wheelOn();
4250            }
4251        },
4252
4253        /**
4254         * Called when overflow scrolling is needed for a section.
4255         *
4256         * @param  {Object}
4256 element      jQuery object containing current section
4257         * @param  {Number} scrollHeight Current window height in pixels
4258         */
4259        create: function(element, scrollHeight) {
4260            var scrollable = element.find(SCROLLABLE_SEL);
4261
4262            scrollable.height(scrollHeight);
4263            scrollable.each(function() {
4264                var $this = jQuery(this);
4265                var iScrollInstance = $this.data('iscrollInstance');
4266                if (iScrollInstance) {
4267                    $.each(iscrollHandler.iScrollInstances, function(){
4268                        $(this).destroy();
4269                    });
4270                }
4271                iScrollInstance = new IScroll($this.get(0), iscrollOptions);
4272                iscrollHandler.iScrollInstances.push(iScrollInstance);
4273                $this.data('iscrollInstance', iScrollInstance);
4274            });
4275        },
4276
4277        /**
4278         * Return a boolean depending on whether the scrollable element is a
4279         * the end or at the start of the scrolling depending on the given type.
4280         *
4281         * @param  {String}  type       Either 'top' or 'bottom'
4282         * @param  {Object}  scrollable jQuery object for the scrollable element
4283         * @return {Boolean}
4284         */
4285        isScrolled: function(type, scrollable) {
4286            var scroller = scrollable.data('iscrollInstance');
4287
4288            if (!scroller) {
4289                return false;
4290            }
4291
4292            /* nectar addition */
4293            if (type === 'top') {
4294            	$('#nectar_fullscreen_rows').addClass('nextSectionAllowed');
4295                return scroller.y >= 0 && !scrollable.scrollTop();
4296            } else if (type === 'bottom') {
4297
4298            	//also changed >= scrollable[0].scrollHeight-4 to scrollable.find('.fp-scroller').height()-4
4299              return (0 - scroller.y) + scrollable.scrollTop() + 1 + scrollable.innerHeight() >= scrollable.find('.fp-scroller').height() - 4;
4300            }
4301            /* nectar addition end */
4302        },
4303
4304        /**
4305         * Returns the scrollable element for the given section.
4306         * If there are landscape slides, will only return a scrollable element
4307         * if it is in the active slide.
4308         *
4309         * @param  {Object}  activeSection jQuery object containing current section
4310         * @return {Boolean}
4311         */
4312        scrollable: function(activeSection){
4313            // if there are landscape slides, we check if the scrolling bar is in the current one or not
4314            if (activeSection.find(SLIDES_WRAPPER_SEL).length) {
4315                return activeSection.find(SLIDE_ACTIVE_SEL).find(SCROLLABLE_SEL);
4316            }
4317            return activeSection.find(SCROLLABLE_SEL);
4318        },
4319
4320        /**
4321         * Returns the scroll height of the wrapped content.
4322         * If this is larger than the window height minus section padding,
4323         * overflow scrolling is needed.
4324         *
4325         * @param  {Object} element jQuery object containing current section
4326         * @return {Number}
4327         */
4328        scrollHeight: function(element) {
4329            return element.find(SCROLLABLE_SEL).children().first().get(0).scrollHeight;
4330        },
4331
4332        /**
4333         * Called when overflow scrolling is no longer needed for a section.
4334         *
4335         * @param  {Object} element      jQuery object containing current section
4336         */
4337        remove: function(element) {
4338            var scrollable = element.find(SCROLLABLE_SEL);
4339            if (scrollable.length) {
4340                var iScrollInstance = scrollable.data('iscrollInstance');
4341                iScrollInstance.destroy();
4342
4343                scrollable.data('iscrollInstance', 'undefined');
4344            }
4345            element.find(SCROLLABLE_SEL).children().first().children().first().unwrap().unwrap();
4346        },
4347
4348        /**
4349         * Called when overflow scrolling has already been setup but the
4350         * window height has potentially changed.
4351         *
4352         * @param  {Object} element      jQuery object containing current section
4353         * @param  {Number} scrollHeight Current window height in pixels
4354         */
4355        update: function(element, scrollHeight) {
4356            //using a timeout in order to execute the refresh function only once when `update` is called multiple times in a
4357            //short period of time.
4358            //it also comes on handy because iScroll requires the use of timeout when using `refresh`.
4359            clearTimeout(iscrollHandler.refreshId);
4360            iscrollHandler.refreshId = setTimeout(function(){
4361                $.each(iscrollHandler.iScrollInstances, function(){
4362                    $(this).get(0).refresh();
4363                });
4364            }, 150);
4365
4366            //updating the wrappers height
4367            element.find(SCROLLABLE_SEL).css('height', scrollHeight + 'px').parent().css('height', scrollHeight + 'px');
4368        },
4369
4370        /**
4371         * Called to get any additional elements needed to wrap the section
4372         * content in order to facilitate overflow scrolling.
4373         *
4374         * @return {String|Object} Can be a string containing HTML,
4375         *                         a DOM element, or jQuery object.
4376         */
4377        wrapContent: function() {
4378            return '<div class="' + SCROLLABLE + '"><div class="fp-scroller"></div></div>';
4379        }
4380    };
4381
4382});

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.