PageSourceSearch

https://eng.cloocus.com/core/views/325256f28f/js/init.js

js cloocus.com collected 2026-10-02 05:31:11 UTC 686,496 bytes, 17,369 lines download raw bytes

vendor: 9,392 bytes, lines 1-27
1/*-------------------------------------------------------------------------
2
3	1.	Plugin Init
4	2.	Helper Functions
5	3.	Shortcode Stuff
6	4.	Header + Search
7	5.	Page Specific
8	6.  Scroll to top 
9	7.	Cross Browser Fixes
10
11
12-------------------------------------------------------------------------*/
13
14
15
16
17
18
19/*-------------------------------------------------------------------------*/
20/*	1.	Plugin Init
21/*-------------------------------------------------------------------------*/
22
23
24/*!
25Waypoints - 4.0.1
26*/
27!function(){"use strict";function t(o){if(!o)throw new Error("No options passed to Waypoint constructor");if(!o.element)throw new Error("No element option passed to Waypoint constructor");if(!o.handler)throw new Error("No handler option passed to Waypoint constructor");this.key="waypoint-"+e,this.options=t.Adapter.extend({},t.defaults,o),this.element=this.options.element,this.adapter=new t.Adapter(this.element),this.callback=o.handler,this.axis=this.options.horizontal?"horizontal":"vertical",this.enabled=this.options.enabled,this.triggerPoint=null,this.group=t.Group.findOrCreate({name:this.options.group,axis:this.axis}),this.context=t.Context.findOrCreateByElement(this.options.context),t.offsetAliases[this.options.offset]&&(this.options.offset=t.offsetAliases[this.options.offset]),this.group.add(this),this.context.add(this),i[this.key]=this,e+=1}var e=0,i={};t.prototype.queueTrigger=function(t){this.group.queueTrigger(this,t)},t.prototype.trigger=function(t){this.enabled&&this.callback&&this.callback.apply(this,t)},t.prototype.destroy=function(){this.context.remove(this),this.group.remove(this),delete i[this.key]},t.prototype.disable=function(){return this.enabled=!1,this},t.prototype.enable=function(){return this.context.refresh(),this.enabled=!0,this},t.prototype.next=function(){return this.group.next(this)},t.prototype.previous=function(){return this.group.previous(this)},t.invokeAll=function(t){var e=[];for(var o in i)e.push(i[o]);for(var n=0,r=e.length;r>n;n++)e[n][t]()},t.destroyAll=function(){t.invokeAll("destroy")},t.disableAll=function(){t.invokeAll("disable")},t.enableAll=function(){t.Context.refreshAll();for(var e in i)i[e].enabled=!0;return this},t.refreshAll=function(){t.Context.refreshAll()},t.viewportHeight=function(){return window.innerHeight||document.documentElement.clientHeight},t.viewportWidth=function(){return document.documentElement.clientWidth},t.adapters=[],t.defaults={context:window,continuous:!0,enabled:!0,group:"default",horizontal:!1,offset:0},t.offsetAliases={"bottom-in-view":function(){return this.context.innerHeight()-this.adapter.outerHeight()},"right-in-view":function(){return this.context.innerWidth()-this.adapter.outerWidth()}},window.Waypoint=t}(),function(){"use strict";function t(t){window.setTimeout(t,1e3/60)}function e(t){this.element=t,this.Adapter=n.Adapter,this.adapter=new this.Adapter(t),this.key="waypoint-context-"+i,this.didScroll=!1,this.didResize=!1,this.oldScroll={x:this.adapter.scrollLeft(),y:this.adapter.scrollTop()},this.waypoints={vertical:{},horizontal:{}},t.waypointContextKey=this.key,o[t.waypointContextKey]=this,i+=1,n.windowContext||(n.windowContext=!0,n.windowContext=new e(window)),this.createThrottledScrollHandler(),this.createThrottledResizeHandler()}var i=0,o={},n=window.Waypoint,r=window.onload;e.prototype.add=function(t){var e=t.options.horizontal?"horizontal":"vertical";this.waypoints[e][t.key]=t,this.refresh()},e.prototype.checkEmpty=function(){var t=this.Adapter.isEmptyObject(this.waypoints.horizontal),e=this.Adapter.isEmptyObject(this.waypoints.vertical),i=this.element==this.element.window;t&&e&&!i&&(this.adapter.off(".waypoints"),delete o[this.key])},e.prototype.createThrottledResizeHandler=function(){function t(){e.handleResize(),e.didResize=!1}var e=this;this.adapter.on("resize.waypoints",function(){e.didResize||(e.didResize=!0,n.requestAnimationFrame(t))})},e.prototype.createThrottledScrollHandler=function(){function t(){e.handleScroll(),e.didScroll=!1}var e=this;this.adapter.on("scroll.waypoints",function(){(!e.didScroll||n.isTouch)&&(e.didScroll=!0,n.requestAnimationFrame(t))})},e.prototype.handleResize=function(){n.Context.refreshAll()},e.prototype.handleScroll=function(){var t={},e={horizontal:{newScroll:this.adapter.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.adapter.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}};for(var i in e){var o=e[i],n=o.newScroll>o.oldScroll,r=n?o.forward:o.backward;for(var s in this.waypoints[i]){var a=this.waypoints[i][s];if(null!==a.triggerPoint){var l=o.oldScroll<a.triggerPoint,h=o.newScroll>=a.triggerPoint,p=l&&h,u=!l&&!h;(p||u)&&(a.queueTrigger(r),t[a.group.id]=a.group)}}}for(var c in t)t[c].flushTriggers();this.oldScroll={x:e.horizontal.newScroll,y:e.vertical.newScroll}},e.prototype.innerHeight=function(){return this.element==this.element.window?n.viewportHeight():this.adapter.innerHeight()},e.prototype.remove=function(t){delete this.waypoints[t.axis][t.key],this.checkEmpty()},e.prototype.innerWidth=function(){return this.element==this.element.window?n.viewportWidth():this.adapter.innerWidth()},e.prototype.destroy=function(){var t=[];for(var e in this.waypoints)for(var i in this.waypoints[e])t.push(this.waypoints[e][i]);for(var o=0,n=t.length;n>o;o++)t[o].destroy()},e.prototype.refresh=function(){var t,e=this.element==this.element.window,i=e?void 0:this.adapter.offset(),o={};this.handleScroll(),t={horizontal:{contextOffset:e?0:i.left,contextScroll:e?0:this.oldScroll.x,contextDimension:this.innerWidth(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:e?0:i.top,contextScroll:e?0:this.oldScroll.y,contextDimension:this.innerHeight(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};for(var r in t){var s=t[r];for(var a in this.waypoints[r]){var l,h,p,u,c,d=this.waypoints[r][a],f=d.options.offset,w=d.triggerPoint,y=0,g=null==w;d.element!==d.element.window&&(y=d.adapter.offset()[s.offsetProp]),"function"==typeof f?f=f.apply(d):"string"==typeof f&&(f=parseFloat(f),d.options.offset.indexOf("%")>-1&&(f=Math.ceil(s.contextDimension*f/100))),l=s.contextScroll-s.contextOffset,d.triggerPoint=Math.floor(y+l-f),h=w<s.oldScroll,p=d.triggerPoint>=s.oldScroll,u=h&&p,c=!h&&!p,!g&&u?(d.queueTrigger(s.backward),o[d.group.id]=d.group):!g&&c?(d.queueTrigger(s.forward),o[d.group.id]=d.group):g&&s.oldScroll>=d.triggerPoint&&(d.queueTrigger(s.forward),o[d.group.id]=d.group)}}return n.requestAnimationFrame(function(){for(var t in o)o[t].flushTriggers()}),this},e.findOrCreateByElement=function(t){return e.findByElement(t)||new e(t)},e.refreshAll=function(){for(var t in o)o[t].refresh()},e.findByElement=function(t){return o[t.waypointContextKey]},window.onload=function(){r&&r(),e.refreshAll()},n.requestAnimationFrame=function(e){var i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||t;i.call(window,e)},n.Context=e}(),function(){"use strict";function t(t,e){return t.triggerPoint-e.triggerPoint}function e(t,e){return e.triggerPoint-t.triggerPoint}function i(t){this.name=t.name,this.axis=t.axis,this.id=this.name+"-"+this.axis,this.waypoints=[],this.clearTriggerQueues(),o[this.axis][this.name]=this}var o={vertical:{},horizontal:{}},n=window.Waypoint;i.prototype.add=function(t){this.waypoints.push(t)},i.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],right:[]}},i.prototype.flushTriggers=function(){for(var i in this.triggerQueues){var o=this.triggerQueues[i],n="up"===i||"left"===i;o.sort(n?e:t);for(var r=0,s=o.length;s>r;r+=1){var a=o[r];(a.options.continuous||r===o.length-1)&&a.trigger([i])}}this.clearTriggerQueues()},i.prototype.next=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints),o=i===this.waypoints.length-1;return o?null:this.waypoints[i+1]},i.prototype.previous=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints);return i?this.waypoints[i-1]:null},i.prototype.queueTrigger=function(t,e){this.triggerQueues[e].push(t)},i.prototype.remove=function(t){var e=n.Adapter.inArray(t,this.waypoints);e>-1&&this.waypoints.splice(e,1)},i.prototype.first=function(){return this.waypoints[0]},i.prototype.last=function(){return this.waypoints[this.waypoints.length-1]},i.findOrCreate=function(t){return o[t.axis][t.name]||new i(t)},n.Group=i}(),function(){"use strict";function t(t){this.$element=e(t)}var e=window.jQuery,i=window.Waypoint;e.each(["innerHeight","innerWidth","off","offset","on","outerHeight","outerWidth","scrollLeft","scrollTop"],function(e,i){t.prototype[i]=function(){var t=Array.prototype.slice.call(arguments);return this.$element[i].apply(this.$element,t)}}),e.each(["extend","inArray","isEmptyObject"],function(i,o){t[o]=e[o]}),i.adapters.push({name:"jquery",Adapter:t}),i.Adapter=t}(),function(){"use strict";function t(t){return function(){var i=[],o=arguments[0];return t.isFunction(arguments[0])&&(o=t.extend({},arguments[1]),o.handler=arguments[0]),this.each(function(){var n=t.extend({},o,{element:this});"string"==typeof n.context&&(n.context=t(this).closest(n.context)[0]),i.push(new e(n))}),i}}var e=window.Waypoint;window.jQuery&&(window.jQuery.fn.waypoint=t(window.jQuery)),window.Zepto&&(window.Zepto.fn.waypoint=t(window.Zepto))}();
28
29//visible
30!function(t){var i=t(window);t.fn.visible=function(t,e,o){if(!(this.length<1)){var r=this.length>1?this.eq(0):this,n=r.get(0),f=i.width(),h=i.height(),o=o?o:"both",l=e===!0?n.offsetWidth*n.offsetHeight:!0;if("function"==typeof n.getBoundingClientRect){var g=n.getBoundingClientRect(),u=g.top>=0&&g.top<h,s=g.bottom>0&&g.bottom<=h,c=g.left>=0&&g.left<f,a=g.right>0&&g.right<=f,v=t?u||s:u&&s,b=t?c||a:c&&a;if("both"===o)return l&&v&&b;if("vertical"===o)return l&&v;if("horizontal"===o)return l&&b}else{var d=i.scrollTop(),p=d+h,w=i.scrollLeft(),m=w+f,y=r.offset(),z=y.top,B=z+r.height(),C=y.left,R=C+r.width(),j=t===!0?B:z,q=t===!0?z:B,H=t===!0?R:C,L=t===!0?C:R;if("both"===o)return!!l&&p>=q&&j>=d&&m>=L&&H>=w;if("vertical"===o)return!!l&&p>=q&&j>=d;if("horizontal"===o)return!!l&&m>=L&&H>=w}}}}(jQuery);
31
32
33/*
34* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
35*/
36jQuery.easing["jswing"]=jQuery.easing["swing"];jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(a,b,c,d,e){return jQuery.easing[jQuery.easing.def](a,b,c,d,e)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b+c;return-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b+c;return d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b+c;return-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b*b+c;return d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){if(b==0)return c;if(b==e)return c+d;if((b/=e/2)<1)return d/2*Math.pow(2,10*(b-1))+c;return d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){if((b/=e/2)<1)return-d/2*(Math.sqrt(1-b*b)-1)+c;return d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e)==1)return c+d;if(!g)g=e*.3;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g))+c},easeOutElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e)==1)return c+d;if(!g)g=e*.3;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*b)*Math.sin((b*e-f)*2*Math.PI/g)+d+c},easeInOutElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e/2)==2)return c+d;if(!g)g=e*.3*1.5;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);if(b<1)return-.5*h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)+c;return h*Math.pow(2,-10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)*.5+d+c},easeInBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;return d*(b/=e)*b*((f+1)*b-f)+c},easeOutBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;return d*((b=b/e-1)*b*((f+1)*b+f)+1)+c},easeInOutBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;if((b/=e/2)<1)return d/2*b*b*(((f*=1.525)+1)*b-f)+c;return d/2*((b-=2)*b*(((f*=1.525)+1)*b+f)+2)+c},easeInBounce:function(a,b,c,d,e){return d-jQuery.easing.easeOutBounce(a,e-b,0,d,e)+c},easeOutBounce:function(a,b,c,d,e){if((b/=e)<1/2.75){return d*7.5625*b*b+c}else if(b<2/2.75){return d*(7.5625*(b-=1.5/2.75)*b+.75)+c}else if(b<2.5/2.75){return d*(7.5625*(b-=2.25/2.75)*b+.9375)+c}else{return d*(7.5625*(b-=2.625/2.75)*b+.984375)+c}},easeInOutBounce:function(a,b,c,d,e){if(b<e/2)return jQuery.easing.easeInBounce(a,b*2,0,d,e)*.5+c;return jQuery.easing.easeOutBounce(a,b*2-e,0,d,e)*.5+d*.5+c}})
37
38
39/*anime*/
40/*
41 2017 Julian Garnier
42 Released under the MIT license
43*/
44var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(e,r,p){if(p.get||p.set)throw new TypeError("ES3 does not support getters and setters.");e!=Array.prototype&&e!=Object.prototype&&(e[r]=p.value)};$jscomp.getGlobal=function(e){return"undefined"!=typeof window&&window===e?e:"undefined"!=typeof global&&null!=global?global:e};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
45$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(e){return $jscomp.SYMBOL_PREFIX+(e||"")+$jscomp.symbolCounter_++};
46$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var e=$jscomp.global.Symbol.iterator;e||(e=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[e]&&$jscomp.defineProperty(Array.prototype,e,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(e){var r=0;return $jscomp.iteratorPrototype(function(){return r<e.length?{done:!1,value:e[r++]}:{done:!0}})};
47$jscomp.iteratorPrototype=function(e){$jscomp.initSymbolIterator();e={next:e};e[$jscomp.global.Symbol.iterator]=function(){return this};return e};$jscomp.array=$jscomp.array||{};$jscomp.iteratorFromArray=function(e,r){$jscomp.initSymbolIterator();e instanceof String&&(e+="");var p=0,m={next:function(){if(p<e.length){var u=p++;return{value:r(u,e[u]),done:!1}}m.next=function(){return{done:!0,value:void 0}};return m.next()}};m[Symbol.iterator]=function(){return m};return m};
48$jscomp.polyfill=function(e,r,p,m){if(r){p=$jscomp.global;e=e.split(".");for(m=0;m<e.length-1;m++){var u=e[m];u in p||(p[u]={});p=p[u]}e=e[e.length-1];m=p[e];r=r(m);r!=m&&null!=r&&$jscomp.defineProperty(p,e,{configurable:!0,writable:!0,value:r})}};$jscomp.polyfill("Array.prototype.keys",function(e){return e?e:function(){return $jscomp.iteratorFromArray(this,function(e){return e})}},"es6-impl","es3");var $jscomp$this=this;
49(function(e,r){"function"===typeof define&&define.amd?define([],r):"object"===typeof module&&module.exports?module.exports=r():e.anime=r()})(this,function(){function e(a){if(!h.col(a))try{return document.querySelectorAll(a)}catch(c){}}function r(a,c){for(var d=a.length,b=2<=arguments.length?arguments[1]:void 0,f=[],n=0;n<d;n++)if(n in a){var k=a[n];c.call(b,k,n,a)&&f.push(k)}return f}function p(a){return a.reduce(function(a,d){return a.concat(h.arr(d)?p(d):d)},[])}function m(a){if(h.arr(a))return a;
50h.str(a)&&(a=e(a)||a);return a instanceof NodeList||a instanceof HTMLCollection?[].slice.call(a):[a]}function u(a,c){return a.some(function(a){return a===c})}function C(a){var c={},d;for(d in a)c[d]=a[d];return c}function D(a,c){var d=C(a),b;for(b in a)d[b]=c.hasOwnProperty(b)?c[b]:a[b];return d}function z(a,c){var d=C(a),b;for(b in c)d[b]=h.und(a[b])?c[b]:a[b];return d}function T(a){a=a.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(a,c,d,k){return c+c+d+d+k+k});var c=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);
51a=parseInt(c[1],16);var d=parseInt(c[2],16),c=parseInt(c[3],16);return"rgba("+a+","+d+","+c+",1)"}function U(a){function c(a,c,b){0>b&&(b+=1);1<b&&--b;return b<1/6?a+6*(c-a)*b:.5>b?c:b<2/3?a+(c-a)*(2/3-b)*6:a}var d=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(a)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(a);a=parseInt(d[1])/360;var b=parseInt(d[2])/100,f=parseInt(d[3])/100,d=d[4]||1;if(0==b)f=b=a=f;else{var n=.5>f?f*(1+b):f+b-f*b,k=2*f-n,f=c(k,n,a+1/3),b=c(k,n,a);a=c(k,n,a-1/3)}return"rgba("+
52255*f+","+255*b+","+255*a+","+d+")"}function y(a){if(a=/([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(a))return a[2]}function V(a){if(-1<a.indexOf("translate")||"perspective"===a)return"px";if(-1<a.indexOf("rotate")||-1<a.indexOf("skew"))return"deg"}function I(a,c){return h.fnc(a)?a(c.target,c.id,c.total):a}function E(a,c){if(c in a.style)return getComputedStyle(a).getPropertyValue(c.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())||"0"}function J(a,c){if(h.dom(a)&&
53u(W,c))return"transform";if(h.dom(a)&&(a.getAttribute(c)||h.svg(a)&&a[c]))return"attribute";if(h.dom(a)&&"transform"!==c&&E(a,c))return"css";if(null!=a[c])return"object"}function X(a,c){var d=V(c),d=-1<c.indexOf("scale")?1:0+d;a=a.style.transform;if(!a)return d;for(var b=[],f=[],n=[],k=/(\w+)\((.+?)\)/g;b=k.exec(a);)f.push(b[1]),n.push(b[2]);a=r(n,function(a,b){return f[b]===c});return a.length?a[0]:d}function K(a,c){switch(J(a,c)){case "transform":return X(a,c);case "css":return E(a,c);case "attribute":return a.getAttribute(c)}return a[c]||
540}function L(a,c){var d=/^(\*=|\+=|-=)/.exec(a);if(!d)return a;var b=y(a)||0;c=parseFloat(c);a=parseFloat(a.replace(d[0],""));switch(d[0][0]){case "+":return c+a+b;case "-":return c-a+b;case "*":return c*a+b}}function F(a,c){return Math.sqrt(Math.pow(c.x-a.x,2)+Math.pow(c.y-a.y,2))}function M(a){a=a.points;for(var c=0,d,b=0;b<a.numberOfItems;b++){var f=a.getItem(b);0<b&&(c+=F(d,f));d=f}return c}function N(a){if(a.getTotalLength)return a.getTotalLength();switch(a.tagName.toLowerCase()){case "circle":return 2*
55Math.PI*a.getAttribute("r");case "rect":return 2*a.getAttribute("width")+2*a.getAttribute("height");case "line":return F({x:a.getAttribute("x1"),y:a.getAttribute("y1")},{x:a.getAttribute("x2"),y:a.getAttribute("y2")});case "polyline":return M(a);case "polygon":var c=a.points;return M(a)+F(c.getItem(c.numberOfItems-1),c.getItem(0))}}function Y(a,c){function d(b){b=void 0===b?0:b;return a.el.getPointAtLength(1<=c+b?c+b:0)}var b=d(),f=d(-1),n=d(1);switch(a.property){case "x":return b.x;case "y":return b.y;
56case "angle":return 180*Math.atan2(n.y-f.y,n.x-f.x)/Math.PI}}function O(a,c){var d=/-?\d*\.?\d+/g,b;b=h.pth(a)?a.totalLength:a;if(h.col(b))if(h.rgb(b)){var f=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(b);b=f?"rgba("+f[1]+",1)":b}else b=h.hex(b)?T(b):h.hsl(b)?U(b):void 0;else f=(f=y(b))?b.substr(0,b.length-f.length):b,b=c&&!/\s/g.test(b)?f+c:f;b+="";return{original:b,numbers:b.match(d)?b.match(d).map(Number):[0],strings:h.str(a)||c?b.split(d):[]}}function P(a){a=a?p(h.arr(a)?a.map(m):m(a)):[];return r(a,
57function(a,d,b){return b.indexOf(a)===d})}function Z(a){var c=P(a);return c.map(function(a,b){return{target:a,id:b,total:c.length}})}function aa(a,c){var d=C(c);if(h.arr(a)){var b=a.length;2!==b||h.obj(a[0])?h.fnc(c.duration)||(d.duration=c.duration/b):a={value:a}}return m(a).map(function(a,b){b=b?0:c.delay;a=h.obj(a)&&!h.pth(a)?a:{value:a};h.und(a.delay)&&(a.delay=b);return a}).map(function(a){return z(a,d)})}function ba(a,c){var d={},b;for(b in a){var f=I(a[b],c);h.arr(f)&&(f=f.map(function(a){return I(a,
58c)}),1===f.length&&(f=f[0]));d[b]=f}d.duration=parseFloat(d.duration);d.delay=parseFloat(d.delay);return d}function ca(a){return h.arr(a)?A.apply(this,a):Q[a]}function da(a,c){var d;return a.tweens.map(function(b){b=ba(b,c);var f=b.value,e=K(c.target,a.name),k=d?d.to.original:e,k=h.arr(f)?f[0]:k,w=L(h.arr(f)?f[1]:f,k),e=y(w)||y(k)||y(e);b.from=O(k,e);b.to=O(w,e);b.start=d?d.end:a.offset;b.end=b.start+b.delay+b.duration;b.easing=ca(b.easing);b.elasticity=(1E3-Math.min(Math.max(b.elasticity,1),999))/
591E3;b.isPath=h.pth(f);b.isColor=h.col(b.from.original);b.isColor&&(b.round=1);return d=b})}function ea(a,c){return r(p(a.map(function(a){return c.map(function(b){var c=J(a.target,b.name);if(c){var d=da(b,a);b={type:c,property:b.name,animatable:a,tweens:d,duration:d[d.length-1].end,delay:d[0].delay}}else b=void 0;return b})})),function(a){return!h.und(a)})}function R(a,c,d,b){var f="delay"===a;return c.length?(f?Math.min:Math.max).apply(Math,c.map(function(b){return b[a]}
vendor: 4,130 bytes, lines 59-68
59)):f?b.delay:d.offset+b.delay+
60b.duration}function fa(a){var c=D(ga,a),d=D(S,a),b=Z(a.targets),f=[],e=z(c,d),k;for(k in a)e.hasOwnProperty(k)||"targets"===k||f.push({name:k,offset:e.offset,tweens:aa(a[k],d)});a=ea(b,f);return z(c,{children:[],animatables:b,animations:a,duration:R("duration",a,c,d),delay:R("delay",a,c,d)})}function q(a){function c(){return window.Promise&&new Promise(function(a){return p=a})}function d(a){return g.reversed?g.duration-a:a}function b(a){for(var b=0,c={},d=g.animations,f=d.length;b<f;){var e=d[b],
61k=e.animatable,h=e.tweens,n=h.length-1,l=h[n];n&&(l=r(h,function(b){return a<b.end})[0]||l);for(var h=Math.min(Math.max(a-l.start-l.delay,0),l.duration)/l.duration,w=isNaN(h)?1:l.easing(h,l.elasticity),h=l.to.strings,p=l.round,n=[],m=void 0,m=l.to.numbers.length,t=0;t<m;t++){var x=void 0,x=l.to.numbers[t],q=l.from.numbers[t],x=l.isPath?Y(l.value,w*x):q+w*(x-q);p&&(l.isColor&&2<t||(x=Math.round(x*p)/p));n.push(x)}if(l=h.length)for(m=h[0],w=0;w<l;w++)p=h[w+1],t=n[w],isNaN(t)||(m=p?m+(t+p):m+(t+" "));
62else m=n[0];ha[e.type](k.target,e.property,m,c,k.id);e.currentValue=m;b++}if(b=Object.keys(c).length)for(d=0;d<b;d++)H||(H=E(document.body,"transform")?"transform":"-webkit-transform"),g.animatables[d].target.style[H]=c[d].join(" ");g.currentTime=a;g.progress=a/g.duration*100}function f(a){if(g[a])g[a](g)}function e(){g.remaining&&!0!==g.remaining&&g.remaining--}function k(a){var k=g.duration,n=g.offset,w=n+g.delay,r=g.currentTime,x=g.reversed,q=d(a);if(g.children.length){var u=g.children,v=u.length;
63if(q>=g.currentTime)for(var G=0;G<v;G++)u[G].seek(q);else for(;v--;)u[v].seek(q)}if(q>=w||!k)g.began||(g.began=!0,f("begin")),f("run");if(q>n&&q<k)b(q);else if(q<=n&&0!==r&&(b(0),x&&e()),q>=k&&r!==k||!k)b(k),x||e();f("update");a>=k&&(g.remaining?(t=h,"alternate"===g.direction&&(g.reversed=!g.reversed)):(g.pause(),g.completed||(g.completed=!0,f("complete"),"Promise"in window&&(p(),m=c()))),l=0)}a=void 0===a?{}:a;var h,t,l=0,p=null,m=c(),g=fa(a);g.reset=function(){var a=g.direction,c=g.loop;g.currentTime=
640;g.progress=0;g.paused=!0;g.began=!1;g.completed=!1;g.reversed="reverse"===a;g.remaining="alternate"===a&&1===c?2:c;b(0);for(a=g.children.length;a--;)g.children[a].reset()};g.tick=function(a){h=a;t||(t=h);k((l+h-t)*q.speed)};g.seek=function(a){k(d(a))};g.pause=function(){var a=v.indexOf(g);-1<a&&v.splice(a,1);g.paused=!0};g.play=function(){g.paused&&(g.paused=!1,t=0,l=d(g.currentTime),v.push(g),B||ia())};g.reverse=function(){g.reversed=!g.reversed;t=0;l=d(g.currentTime)};g.restart=function(){g.pause();
65g.reset();g.play()};g.finished=m;g.reset();g.autoplay&&g.play();return g}var ga={update:void 0,begin:void 0,run:void 0,complete:void 0,loop:1,direction:"normal",autoplay:!0,offset:0},S={duration:1E3,delay:0,easing:"easeOutElastic",elasticity:500,round:0},W="translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective".split(" "),H,h={arr:function(a){return Array.isArray(a)},obj:function(a){return-1<Object.prototype.toString.call(a).indexOf("Object")},
66pth:function(a){return h.obj(a)&&a.hasOwnProperty("totalLength")},svg:function(a){return a instanceof SVGElement},dom:function(a){return a.nodeType||h.svg(a)},str:function(a){return"string"===typeof a},fnc:function(a){return"function"===typeof a},und:function(a){return"undefined"===typeof a},hex:function(a){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(a)},rgb:function(a){return/^rgb/.test(a)},hsl:function(a){return/^hsl/.test(a)},col:function(a){return h.hex(a)||h.rgb(a)||h.hsl(a)}},A=function(){function a(a,
67d,b){return(((1-3*b+3*d)*a+(3*b-6*d))*a+3*d)*a}return function(c,d,b,f){if(0<=c&&1>=c&&0<=b&&1>=b){var e=new Float32Array(11);if(c!==d||b!==f)for(var k=0;11>k;++k)e[k]=a(.1*k,c,b);return function(k){if(c===d&&b===f)return k;if(0===k)return 0;if(1===k)return 1;for(var h=0,l=1;10!==l&&e[l]<=k;++l)h+=.1;--l;var l=h+(k-e[l])/(e[l+1]-e[l])*.1,n=3*(1-3*b+3*c)*l*l+2*(3*b-6*c)*l+3*c;if(.001<=n){for(h=0;4>h;++h){n=3*(1-3*b+3*c)*l*l+2*(3*b-6*c)*l+3*c;if(0===n)break;var m=a(l,c,b)-k,l=l-m/n}k=l}else if(0===
68n)k=l;else{var l=h,h=h+.1,g=0;
68do m=l+(h-l)/2,n=a(m,c,b)-k,0<n?h=m:l=m;while(1e-7<Math.abs(n)&&10>++g);k=m}return a(k,d,f)}}}}(),Q=function(){function a(a,b){return 0===a||1===a?a:-Math.pow(2,10*(a-1))*Math.sin(2*(a-1-b/(2*Math.PI)*Math.asin(1))*Math.PI/b)}var c="Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "),d={In:[[.55,.085,.68,.53],[.55,.055,.675,.19],[.895,.03,.685,.22],[.755,.05,.855,.06],[.47,0,.745,.715],[.95,.05,.795,.035],[.6,.04,.98,.335],[.6,-.28,.735,.045],a],Out:[[.25,
69.46,.45,.94],[.215,.61,.355,1],[.165,.84,.44,1],[.23,1,.32,1],[.39,.575,.565,1],[.19,1,.22,1],[.075,.82,.165,1],[.175,.885,.32,1.275],function(b,c){return 1-a(1-b,c)}],InOut:[[.455,.03,.515,.955],[.645,.045,.355,1],[.77,0,.175,1],[.86,0,.07,1],[.445,.05,.55,.95],[1,0,0,1],[.785,.135,.15,.86],[.68,-.55,.265,1.55],function(b,c){return.5>b?a(2*b,c)/2:1-a(-2*b+2,c)/2}]},b={linear:A(.25,.25,.75,.75)},f={},e;for(e in d)f.type=e,d[f.type].forEach(function(a){return function(d,f){b["ease"+a.type+c[f]]=h.fnc(d)?
70d:A.apply($jscomp$this,d)}}(f)),f={type:f.type};return b}(),ha={css:function(a,c,d){return a.style[c]=d},attribute:function(a,c,d){return a.setAttribute(c,d)},object:function(a,c,d){return a[c]=d},transform:function(a,c,d,b,f){b[f]||(b[f]=[]);b[f].push(c+"("+d+")")}},v=[],B=0,ia=function(){function a(){B=requestAnimationFrame(c)}function c(c){var b=v.length;if(b){for(var d=0;d<b;)v[d]&&v[d].tick(c),d++;a()}else cancelAnimationFrame(B),B=0}return a}();q.version="2.2.0";q.speed=1;q.running=v;q.remove=
71function(a){a=P(a);for(var c=v.length;c--;)for(var d=v[c],b=d.animations,f=b.length;f--;)u(a,b[f].animatable.target)&&(b.splice(f,1),b.length||d.pause())};q.getValue=K;q.path=function(a,c){var d=h.str(a)?e(a)[0]:a,b=c||100;return function(a){return{el:d,property:a,totalLength:N(d)*(b/100)}}};q.setDashoffset=function(a){var c=N(a);a.setAttribute("stroke-dasharray",c);return c};q.bezier=A;q.easings=Q;q.timeline=function(a){var c=q(a);c.pause();c.duration=0;c.add=function(d){c.children.forEach(function(a){a.began=
72!0;a.completed=!0});m(d).forEach(function(b){var d=z(b,D(S,a||{}));d.targets=d.targets||a.targets;b=c.duration;var e=d.offset;d.autoplay=!1;d.direction=c.direction;d.offset=h.und(e)?b:L(e,b);c.began=!0;c.completed=!0;c.seek(d.offset);d=q(d);d.began=!0;d.completed=!0;d.duration>b&&(c.duration=d.duration);c.children.push(d)});c.seek(0);c.reset();c.autoplay&&c.restart();return c};return c};q.random=function(a,c){return Math.floor(Math.random()*(c-a+1))+a};return q});
73
74
75/*! Mousewheel by Brandon Aaron (http://brandon.aaron.sh) */
76!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
77
78(function($, window, document) {
79
80
81
82jQuery(document).ready(function($){
83	
84	
85	
86  // ========================= smartresize ===============================
87
88  /*
89   * smartresize: debounced resize event for jQuery
90   *
91   * latest version and complete README available on Github:
92   * https://github.com/louisremi/jquery.smartresize.js
93   *
94   * Copyright 2011 @louis_remi
95   * Licensed under the MIT license.
96   */
97
98  var $event = $.event,
99      dispatchMethod = $.event.handle ? 'handle' : 'dispatch',
100      resizeTimeout;
101
102  $event.special.smartresize = {
103    setup: function() {
104      $(this).on( "resize", $event.special.smartresize.handler );
105    },
106    teardown: function() {
107      $(this).off( "resize", $event.special.smartresize.handler );
108    },
109    handler: function( event, execAsap ) {
110      // Save the context
111      var context = this,
112          args = arguments;
113
114      // set correct event type
115      event.type = "smartresize";
116
117      if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
118      resizeTimeout = setTimeout(function() {
119        $event[ dispatchMethod ].apply( context, args );
120      }, execAsap === "execAsap"? 0 : 100 );
121    }
122  };
123
124  $.fn.smartresize = function( fn ) {
125    return fn ? this.on( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
126  };
127
128
129
130	/*!
131	 * jQuery Transit - CSS3 transitions and transformations
132	 * (c) 2011-2012 Rico Sta. Cruz <[email protected]>
133	 * MIT Licensed.
134	 *
135	 * http://ricostacruz.com/jquery.transit
136	 * http://github.com/rstacruz/jquery.transit
137	 */
138	(function(k){k.transit={version:"0.9.9",propertyMap:{marginLeft:"margin",marginRight:"margin",marginBottom:"margin",marginTop:"margin",paddingLeft:"padding",paddingRight:"padding",paddingBottom:"padding",paddingTop:"padding"},enabled:true,useTransitionEnd:false};var d=document.createElement("div");var q={};function b(v){if(v in d.style){return v}var u=["Moz","Webkit","O","ms"];var r=v.charAt(0).toUpperCase()+v.substr(1);if(v in d.style){return v}for(var t=0;t<u.length;++t){var s=u[t]+r;if(s in d.style){return s}}}function e(){d.style[q.transform]="";d.style[q.transform]="rotateY(90deg)";return d.style[q.transform]!==""}var a=navigator.userAgent.toLowerCase().indexOf("chrome")>-1;q.transition=b("transition");q.transitionDelay=b("transitionDelay");q.transform=b("transform");q.transformOrigin=b("transformOrigin");q.transform3d=e();var i={transition:"transitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",WebkitTransition:"webkitTransitionEnd",msTransition:"MSTransitionEnd"};var f=q.transitionEnd=i[q.transition]||null;for(var p in q){if(q.hasOwnProperty(p)&&typeof k.support[p]==="undefined"){k.support[p]=q[p]}}d=null;k.cssEase={_default:"ease","in":"ease-in",out:"ease-out","in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1
138)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(.6,-.28,.735,.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"};k.cssHooks["transit:transform"]={get:function(r){return k(r).data("transform")||new j()},set:function(s,r){var t=r;if(!(t instanceof j)){t=new j(t)}if(q.transform==="WebkitTransform"&&!a){s.style[q.transform]=t.toString(true)}else{s.style[q.transform]=t.toString()}k(s).data("transform",t)}};k.cssHooks.transform={set:k.cssHooks["transit:transform"].set};if(k.fn.jquery<"1.8"){k.cssHooks.transformOrigin={get:function(r){return r.style[q.transformOrigin]},set:function(r,s){r.style[q.transformOrigin]=s}};k.cssHooks.transition={get:function(r){return r.style[q.transition]},set:function(r,s){r.style[q.transition]=s}}}n("scale");n("translate");n("rotate");n("rotateX");n("rotateY");n("rotate3d");n("perspective");n("skewX");n("skewY");n("x",true);n("y",true);function j(r){if(typeof r==="string"){this.parse(r)}return this}j.prototype={setFromString:function(t,s){var r=(typeof s==="string")?s.split(","):(s.constructor===Array)?s:[s];r.unshift(t);j.prototype.set.apply(this,r)},set:function(s){var r=Array.prototype.slice.apply(arguments,[1]);if(this.setter[s]){this.setter[s].apply(this,r)}else{this[s]=r.join(",")}},get:function(r){if(this.getter[r]){return this.getter[r].apply(this)}else{return this[r]||0}},setter:{rotate:function(r){this.rotate=o(r,"deg")},rotateX:function(r){this.rotateX=o(r,"deg")},rotateY:function(r){this.rotateY=o(r,"deg")},scale:function(r,s){if(s===undefined){s=r}this.scale=r+","+s},skewX:function(r){this.skewX=o(r,"deg")},skewY:function(r){this.skewY=o(r,"deg")},perspective:function(r){this.perspective=o(r,"px")},x:function(r){this.set("translate",r,null)},y:function(r){this.set("translate",null,r)},translate:function(r,s){if(this._translateX===undefined){this._translateX=0}if(this._translateY===undefined){this._translateY=0}if(r!==null&&r!==undefined){this._translateX=o(r,"px")}if(s!==null&&s!==undefined){this._translateY=o(s,"px")}
138this.translate=this._translateX+","+this._translateY}},getter:{x:function(){return this._translateX||0},y:function(){return this._translateY||0},scale:function(){var r=(this.scale||"1,1").split(",");if(r[0]){r[0]=parseFloat(r[0])}if(r[1]){r[1]=parseFloat(r[1])}return(r[0]===r[1])?r[0]:r},rotate3d:function(){var t=(this.rotate3d||"0,0,0,0deg").split(",");for(var r=0;r<=3;++r){if(t[r]){t[r]=parseFloat(t[r])}}if(t[3]){t[3]=o(t[3],"deg")}return t}},parse:function(s){var r=this;s.replace(/([a-zA-Z0-9]+)\((.*?)\)/g,function(t,v,u){r.setFromString(v,u)})},toString:function(t){var s=[];for(var r in this){if(this.hasOwnProperty(r)){if((!q.transform3d)&&((r==="rotateX")||(r==="rotateY")||(r==="perspective")||(r==="transformOrigin"))){continue}if(r[0]!=="_"){if(t&&(r==="scale")){s.push(r+"3d("+this[r]+",1)")}else{if(t&&(r==="translate")){s.push(r+"3d("+this[r]+",0)")}else{s.push(r+"("+this[r]+")")}}}}}return s.join(" ")}};function m(s,r,t){if(r===true){s.queue(t)}else{if(r){s.queue(r,t)}else{t()}}}function h(s){var r=[];k.each(s,function(t){t=k.camelCase(t);t=k.transit.propertyMap[t]||k.cssProps[t]||t;t=c(t);if(k.inArray(t,r)===-1){r.push(t)}});return r}function g(s,v,x,r){var t=h(s);if(k.cssEase[x]){x=k.cssEase[x]}var w=""+l(v)+" "+x;if(parseInt(r,10)>0){w+=" "+l(r)}var u=[];k.each(t,function(z,y){u.push(y+" "+w)});return u.join(", ")}k.fn.transition=k.fn.transit=function(z,s,y,C){var D=this;var u=0;var w=true;if(typeof s==="function"){C=s;s=undefined}if(typeof y==="function"){C=y;y=undefined}if(typeof z.easing!=="undefined"){y=z.easing;delete z.easing}if(typeof z.duration!=="undefined"){s=z.duration;delete z.duration}if(typeof z.complete!=="undefined"){C=z.complete;delete z.complete}if(typeof z.queue!=="undefined"){w=z.queue;delete z.queue}if(typeof z.delay!=="undefined"){u=z.delay;delete z.delay}if(typeof s==="undefined"){s=k.fx.speeds._default}if(typeof y==="undefined"){y=k.cssEase._default}s=l(s);var E=g(z,s,y,u);var B=k.transit.enabled&&q.transition;var t=B?(parseInt(s,10)+parseInt(u,10)):0;if(t===0){var A=function(F){D.css(z);if(C){C.apply(D)}if(F){F()}};m(D,w,A);return D}var x={};var r=function(H){var G=false;var F=function(){if(G){D.unbind(f,F)}if(t>0){D.each(function(){this.style[q.transition]=(x[this]||null)})}if(typeof C==="function"){C.apply(D)}if(typeof H==="function"){H()}};if((t>0)&&(f)&&(k.transit.useTransitionEnd)){G=true;D.bind(f,F)}else{window.setTimeout(F,t)}D.each(function(){if(t>0){this.style[q.transition]=E}k(this).css(z)})};var v=function(F){this.offsetWidth;r(F)};m(D,w,v);return this};function n(s,r){if(!r){k.cssNumber[s]=true}k.transit.propertyMap[s]=q.transform;k.cssHooks[s]={get:function(v){var u=k(v).css("transit:transform");return u.get(s)},set:function(v,w){var u=k(v).css("transit:transform");u.setFromString(s,w);k(v).css({"transit:transform":u})}}}function c(r){return r.replace(/([A-Z])/g,function(s){return"-"+s.toLowerCase()})}function o(s,r){if((typeof s==="string")&&(!s.match(/^[\-0-9\.]+$/))){return s}else{return""+s+r}}function l(s){var r=s;if(k.fx.speeds[r]){r=k.fx.speeds[r]}return o(r,"ms")}k.transit.getTransitionValue=g})(jQuery);
139	
140
141
142
143	
144/****************** Nectar ******************/	
145
146// Create cross browser requestAnimationFrame method:
147window.requestAnimationFrame = window.requestAnimationFrame
148|| window.mozRequestAnimationFrame
149|| window.webkitRequestAnimationFrame
150|| window.msRequestAnimationFrame
151|| function(f){setTimeout(f, 1000/60)}
152	 
153var nectarDOMInfo = {
154	
155	usingMobileBrowser: (navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? true : false,
156	
157	usingFrontEndEditor: (typeof window.vc_iframe === 'undefined') ? false : true,
158	
159	getWindowSize: function() {
160		nectarDOMInfo.windowHeight = window.innerHeight;
161		nectarDOMInfo.windowWidth = window.innerWidth;
162		
163		nectarDOMInfo.adminBarHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0;
164		nectarDOMInfo.secondaryHeaderHeight = ($('#header-secondary-outer').length > 0) ? $('#header-secondary-outer').height() : 0;
165	},
166
167	scrollPosMouse: function() {
168		return $(window).scrollTop();
169	},
170	
171	scrollPosRAF: function() {
172		nectarDOMInfo.scrollTop = $(window).scrollTop();
173		requestAnimationFrame(nectarDOMInfo.scrollPosRAF);
174	},
175	
176
177	bindEvents: function() {
178		
179		if(!nectarDOMInfo.usingMobileBrowser) {
180			$(window).on('scroll',function(){ nectarDOMInfo.scrollTop = nectarDOMInfo.scrollPosMouse(); });
181		}
182		
183		$(window).on('resize',nectarDOMInfo.getWindowSize);
184		
185	}
186
187}
188
189nectarDOMInfo.getWindowSize();
190nectarDOMInfo.scrollTop = nectarDOMInfo.scrollPosMouse();
191
192if(nectarDOMInfo.usingMobileBrowser) { requestAnimationFrame(nectarDOMInfo.scrollPosRAF); } 
193
194nectarDOMInfo.bindEvents();
195
196
197//set row sizes
198fullWidthSections();
199fwsClasses();
200
201
202
203
204
205
206
207
208/***************** VC FRONTEND  ******************/
209
210function addRowCtrls() {
211
212
213		//remove padding for rows with only fullwidth ns
214		$('.wpb_row').removeClass('only-ns');
215		$('.nectar-slider-wrap[data-full-width="true"], .page-submenu, .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .blog-fullwidth-wrap').parents('.wpb_row').addClass('only-ns');
216		
217		//padding when column contains item that could get lost under column controls 
218		$('body.vc_editor.compose-mode .wpb_row .vc_vc_column > .wpb_column > .vc_column-inner').each(function(){
219			
220			if($(this).find('> .vc_element-container > div').length > 0) {
221				
222				if( $(this).find('> .vc_element-container > div:first-child').is('.vc_vc_row_inner') ) {
223					$(this).find('> .vc_element-container > div:first-child').addClass('first-inner-row-el');
224				} else {
225					$(this).find('> .vc_element-container > div:first-child').removeClass('first-inner-row-el');
226				}
227				
228			}
229			
230		}); 
231		
232	} //addRowCtrl end
233	
234	
235	function convertFrontEndPadding() {
236		 $('.vc_element > .wpb_column[class*="padding-"][class*="-percent"]').each(function(){
237			 
238				var $elPaddingPercent = 4;
239
240				var elclassName = this.className.match(/padding-\d+/); 
241				if (elclassName) {
242						$elPaddingPercent = elclassName[0].match(/\d+/); 
243						if($elPaddingPercent) {
244							$elPaddingPercent = $elPaddingPercent[0]/100;
245						} else {
246							$elPaddingPercent = 0;
247						}
248				}
249				
250				if($elPaddingPercent) {
251					 var $parentRowWidth = $(this).parents('.span_12').width();
252					 
253					 if($(this).is('[data-padding-pos="all"]')){
254							$(this).css('padding', $parentRowWidth * $elPaddingPercent );
255					 } else if($(this).is('[data-padding-pos="top"]')) {
256						 $(this).css('padding-top', $parentRowWidth * $elPaddingPercent );
257					 } else if($(this).is('[data-padding-pos="bottom"]')) {
258						 $(this).css('padding-bottom', $parentRowWidth * $elPaddingPercent );
259					 } else if($(this).is('[data-padding-pos="left"]')) {
260						 $(this).css('padding-left', $parentRowWidth * $elPaddingPercent );
261					 } else if($(this).is('[data-padding-pos="right"]')) {
262						 $(this).css('padding-right', $parentRowWidth * $elPaddingPercent );
263					 } else if($(this).is('[data-padding-pos="top-bottom"]')) {
264						 $(this).css({
265							 'padding-top': $parentRowWidth * $elPaddingPercent,
266							 'padding-bottom': $parentRowWidth * $elPaddingPercent,
267						 });
268					 } else if($(this).is('[data-padding-pos="top-right"]')) {
269						 $(this).css({
270							 'padding-top': $parentRowWidth * $elPaddingPercent,
271							 'padding-right': $parentRowWidth * $elPaddingPercent,
272						 });
273					 } else if($(this).is('[data-padding-pos="bottom-right"]')) {
274						 $(this).css({
275							 'padding-right': $parentRowWidth * $elPaddingPercent,
276							 'padding-bottom': $parentRowWidth * $elPaddingPercent,
277						 });
278					 } else if($(this).is('[data-padding-pos="bottom-left"]')) {
279						 $(this).css({
280							 'padding-left': $parentRowWidth * $elPaddingPercent,
281							 'padding-bottom': $parentRowWidth * $elPaddingPercent,
282						 });
283					 } else if($(this).is('[data-padding-pos="left-right"]')) {
284						 $(this).css({
285							 'padding-left': $parentRowWidth * $elPaddingPercent,
286							 'padding-right': $parentRowWidth * $elPaddingPercent,
287						 });
288					 }
289			 }
290
291		 }); //each
292		 
293		 //remove margins on element wrappers that are setting custom margin
294		 $('.wpb_row[class*="vc_custom_"]').each(function(){
295			 
296				$(this).parent().addClass('no-bottom-margin');
297		
298		 });
299		 
300	} //convertFrontEndPadding end
301 
302 
303 setTimeout(function(){
304	 
305	if($('body.compose-mode').length > 0) {
306		$('.container-wrap').addClass('visible-editor-controls');
307  }
308	
309	if(nectarDOMInfo.usingFrontEndEditor) {
310		addRowCtrls();
311		convertFrontEndPadding();
312		
313		$(window).smartresize(convertFrontEndPadding);
314	}
315
316},200);
317 
318 
319
320 
321 var $fp_section_length = 0, $fp_section_prev_length = 0;
322 
323 
324 $(window).on( 'vc_reload', function() {
325	 
326	 addRowCtrls();
327	 
328	 columnBGColors();
329	 coloredButtons();
330	 twentytwentyInit();
331	 parallaxRowsBGCals();
332	 
333	 if($('.carousel').length > 0) {
334		standardCarouselInit();
335		clientsCarouselInit();
336		carouselHeightCalcs();
337	}
338	
339	
340	if($('.owl-carousel').length > 0) { 
341		$('.owl-carousel').each(function(){
342			$(this).trigger('destroy.owl.carousel').removeClass('owl-loaded');
343			$(this).find('.owl-stage-outer .owl-stage > *').unwrap();
344			$(this).find('.owl-stage-outer > *').unwrap();
345			$(this).find('.owl-item > *').unwrap();
346			$(this).find('.owl-dots').remove();
347			$(this).find('.owl-nav').remove();
348		});
349		owlCarouselInit();
350	}
351	
352	flexsliderInit();
353	accordionInit();
354	ulChecks();
355	oneFourthClasses();
356	carouselfGrabbingClass();
357	if($('.nectar_cascading_images').length > 0) {
358		imagesLoaded($('.nectar_cascading_images'),function(instance){
359			cascadingImageBGSizing();
360		});
361	}
362	fullWidthSections();
363	fwsClasses();
364	fullwidthImgOnlySizingInit();
365	fullwidthImgOnlySizing();
366	fullWidthRowPaddingAdjustInit();
367	recentPostsFlickityInit();
368	if(nectarDOMInfo.usingMobileBrowser) {
369		fullWidthRowPaddingAdjustCalc();
370	}
371	if($('.nectar-box-roll').length == 0) { boxRollInit(); }
372	
373  /*flickity carousels*/
374	if($flickitySliders.length > 0) {
375		for(var i=0; i<$flickitySliders.length; i++) {
376			
377			$flickitySliders[i].reloadCells();
378			$flickitySliders[i].off( 'scroll.flickity'); 
379			$flickitySliders[i].off( 'dragStart.flickity'); 
380			$flickitySliders[i].off( 'dragEnd.flickity'); 
381
382		 }
383	}
384
385	setTimeout(function(){ 
386		
387		flickityInit();
388		if($flickitySliders.length > 0) { 
389			for(var i=0; i<$flickitySliders.length; i++) {
390				$flickitySliders[i].reloadCells();
391				$flickitySliders[i].resize();
392			 }
393		}
394	
395	},100);
396	
397	/*flickity product carousels*/
398	if($wooFlickityCarousels.length > 0) {
399		for(var i=0; i<$wooFlickityCarousels.length; i++) {
400			
401			$wooFlickityCarousels[i].flickity('reloadCells');
402			$wooFlickityCarousels[i].off( 'scroll.flickity'); 
403			$wooFlickityCarousels[i].off( 'dragStart.flickity'); 
404			$wooFlickityCarousels[i].off( 'dragEnd.flickity'); 
405
406		 }
407	}
408
409	setTimeout(function(){ 
410		
411		if( $('.nectar-woo-flickity').length > 0) { productCarouselInit(); }
412		if($wooFlickityCarousels.length > 0) { 
413			for(var i=0; i<$wooFlickityCarousels.length; i++) {
414				$wooFlickityCarousels[i].flickity('reloadCells');
415				$wooFlickityCarousels[i].flickity('resize');
416			 }
417		}
418	
419	},100);
420	
421	
422	socialSharingInit();
423	hotSpotHoverBind();
424	pricingTableHeight();
425	nectarIconMatchColoring();
426	
427	if($testimonialSlider.length > 0) {
428		for(var i=0; i<$testimonialSlider.length; i++) {
429			var testimonialflkty = $testimonialSlider[i].data('flickity');
430			$testimonialSlider[i].flickity('reloadCells');
431			$testimonialSlider[i].off( 'select.flickity');
432		}
433	} 
434
435	createTestimonialControls();
436	
437	lightBoxInit();
438	
439	imageWithHotspotClickEvents();
440	testimonialSliderHeight(); 
441	largeIconHover();
442	if($('.nectar-box-roll').length == 0) boxRollMouseWheelInit();
443	midnightInit();
444	responsiveVideoIframesInit();
445	responsiveVideoIframes();
446	fullWidthContentColumns();
447	setTimeout(fullWidthContentColumns,1000);
448	videoBGInit();
449	$(window).off('scroll.parallaxSections').off('resize.parallaxSections');
450	parallaxScrollInit();
451	
452	//update blog arr
453	$('.posts-container').each(function(i){
454		$blog_containers[i] = $(this);
455	});
456	masonryBlogInit();
457	masonryPortfolioInit();
458	portfolioAccentColor();
459	portfolioHoverEffects();
460	portfolioFiltersInit();
461	style6Img();
462	
463	fsProjectSliderInit();
464	
465	setTimeout(function(){
466		if($('.nectar_fullscreen_zoom_recent_projects').length > 0){
467			portfolioFullScreenSliderCalcs();
468			splitLineText();
469			$(window).resize(splitLineText);
470			$(window).resize(portfolioFullScreenSliderCalcs);
471		}
472	},300);
473	
474	isotopeCatSelection();
475	$(window).unbind('.infscr');
476	infiniteScrollInit();
477	postNextButtonEffect();
478	mouseParallaxInit();
479	
480	//play video BGs
481	$('.nectar-video-wrap').each(function(i){
482		if($(this).find('video').length > 0) {
483			  $(this).find('video').css('visibility','visible');
484		}
485	});
486	
487	//tablet inherits small desktop
488	$('.wpb_column[data-t-w-inherits]').each(function(){
489		if( $(this).is('[data-t-w-inherits="small_desktop"]') ) {
490			$(this).parent().addClass('inherits-s-desktop-col');
491		} else {
492			$(this).parent().removeClass('inherits-s-desktop-col');
493		}
494	});
495	
496	//full screen page rows
497	if($('#nectar_fullscreen_rows').length > 0) {
498		
499		$fp_section_length = $('#nectar_fullscreen_rows > .vc_element').length;
500		
501		
502		if( $('#nectar_fullscreen_rows > .vc_element').length == 0 ) {
503			$('#nectar_fullscreen_rows').prepend('<div class="vc_element empty_placeholder" />');
504		} 
505		
506		
507		if( $('#nectar_fullscreen_rows > .vc_element:not(.empty_placeholder)').length > 0 ) {
508			$('#nectar_fullscreen_rows >.vc_element.empty_placeholder').remove();
509		}
510		
511		setFPNames();
512
513		
514		//first load	
515		if($('#fp-nav').length == 0) {
516			initNectarFP();
517			
518			var currentFPSectionIndex = ($('#nectar_fullscreen_rows > .vc_element.active').length > 0) ? $('#nectar_fullscreen_rows > .vc_element.active').index() + 1 : 1;
519			setFPNavColoring(currentFPSectionIndex,'na');
520		} 
521		//after
522		////reinit if sections have been added/removed
523		else if($fp_section_length != $fp_section_prev_length) {
524
525			$.fn.fullpage.destroy('all');
526			initNectarFP();
527
528			var currentFPSectionIndex = ($('#nectar_fullscreen_rows > .vc_element.active').length > 0) ? $('#nectar_fullscreen_rows > .vc_element.active').index() + 1 : 1;
529			setFPNavColoring(currentFPSectionIndex,'na');
530
531		}
532		
533
534		//keep tooltip active status
535		var $nectarFPindex = 0;
536		var nectarFPOffsets = [{el: '', offset: 0}]; 
537		
538		////create list of offsets
539		$('#nectar_fullscreen_rows > div.vc_element').each(function(i){
540			nectarFPOffsets[i] = {
541				el: $(this),
542				offset: $(this).offset().top
543			}
544		});
545		
546		////loop to find lowest
547		for(var x in nectarFPOffsets) {
548			
549			if(nectarFPOffsets[x].offset < $(window).height()){
550				$nectarFPindex = x;
551			} 
552			
553		} 
554		////start active on that index
555		//$('#fp-nav ul > li:nth-child(' + (parseInt($nectarFPindex)+1) + ')').find('> a').trigger('click');
556		
557		//move back to first section when all have been deleted but one
558		if($('#nectar_fullscreen_rows > div.vc_element').length === 1) {
559			$('#nectar_fullscreen_rows').css({'transform' : 'translate3d(0,0,0)'});
560		}
561		
562		$('body').scrollTo(0,0);
563			
564		//update prev section length
565		$fp_section_prev_length = $fp_section_length;
566		
567	} else {
568		
569		//remove container wrap padding/margin when needded
570		if($('body .main-content > .row > .vc_element:first > .wpb_row[class*="full-width-"]').length > 0 || $('body .main-content > .row > .vc_element:first .nectar-slider-wrap[data-full-width="true"]').length > 0 ) {
571				$('.container-wrap').css({ 'padding-top': '0', 'margin-top' : '0'});
572		} else {
573			$('.container-wrap').css({ 'padding-top': '40px'});
574		}
575		
576	}
577	
578	
579	//reset svg icon arr
580	$svg_icons = [];
581	$('.svg-icon-holder').removeClass('animated-in').removeClass('bound');
582
583	
584	//gmap
585	if($('.vc_nectar_gmap').length > 0) {
586		
587		setTimeout(function(){
588			
589			if(typeof google === 'object' && typeof google.maps === 'object') {
590				mapAPI_Loaded();
591			} else {
592
593				if(nectarLove.mapApiKey.length > 0) {
594					$.getScript('https://maps.google.com/maps/api/js?sensor=false&key='+nectarLove.mapApiKey+'&callback=mapAPI_Loaded');
595				}
596			}
597			
598		},100);
599}
600	
601	if( $().theiaStickySidebar ) {
602		blogStickySS();
603	}
604	
605	
606	 if(typeof window.Waypoint != 'undefined') {
607		 Waypoint.destroyAll();
608		 waypoints();
609	 }
610	 
611 });
612
613
614
615
616
617/***************** Lightbox Init ******************/
618	
619	function fancyBoxInit() {
620		//convert old pp links
621		$('a.pp').removeClass('pp').attr('data-fancybox','');
622		$("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])").removeAttr('rel').attr('data-fancybox','');
623		
624		//image gallery nectar
625		$('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function(){
626			var $unique_id = Math.floor(Math.random()*10000);
627			$(this).find('.swiper-slide a:not(.ext-url-link)').attr('data-fancybox','group_'+$unique_id);
628		});
629		
630		//flex
631		$('.wpb_gallery_slides.wpb_flexslider').each(function(){
632			var $unique_id = Math.floor(Math.random()*10000);
633			$(this).find('.slides > li > a').attr('data-fancybox','group_'+$unique_id);
634		});
635		
636		//touch enabled gal
637		$('.wpb_gallery_slidesflickity_style').each(function(){
638			var $unique_id = Math.floor(Math.random()*10000);
639			$(this).find('.cell > a:not(.ext-url-link)').attr('data-fancybox','group_'+$unique_id);
640		});
641		
642		//add galleries to portfolios
643		$('.portfolio-items, .wpb_gallery .parallax-grid-item').each(function(){
644			var $unique_id = Math.floor(Math.random()*10000);
645			if($(this).find('.pretty_photo').length > 0) {
646				$(this).find('.pretty_photo').removeClass('pretty_photo').attr('data-fancybox','group_'+$unique_id);
647			} else if($(this).find('a[rel*="prettyPhoto["]').length > 0){
648				$(this).find('a[rel*="prettyPhoto["]').removeAttr('rel').attr('data-fancybox','group_'+$unique_id);
649			}
650
651		});
652		
653		//nectar auto lightbox
654		if($('body').hasClass('nectar-auto-lightbox')){
655			$('.gallery').each(function(){
656				if($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) {
657					var $unique_id = Math.floor(Math.random()*10000);
658					$(this).find('.gallery-item .gallery-icon a[href*=".jpg"], .gallery-item .gallery-icon a[href*=".png"], .gallery-item .gallery-icon a[href*=".gif"], .gallery-item .gallery-icon a[href*=".jpeg"]').attr('data-fancybox','group_'+$unique_id).removeClass('pretty_photo');
659				}
660			});
661			$('.main-content img').each(function(){
662				if($(this).parent().is("[href]") && !$(this).parent().is(".magnific-popup") && $(this).parents('.tiled-gallery').length == 0 && $(this).parents('.product-image').length == 0 && $(this).parents('.iosSlider.product-slider').length == 0) {
663					var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/);
664					if(match) $(this).parent().attr('data-fancybox','');
665				} 
666			});
667		}
668		
669		//regular
670		fbMarginArr = ($('body.admin-bar').length > 0) ? [60,100] : [60,100];
671		if(window.innerWidth < 1000) {
672			fbMarginArr = [0,0];
673		}
674		$("[data-fancybox]").fancybox({
675			animationEffect : "zoom-in-out",
676			animationDuration : 350,
677			buttons : [
678        //'slideShow',
679        'fullScreen',
680        //'thumbs',
681        //'share',
682        //'download',
683        'zoom',
684        'close'
685    	],
686			margin : fbMarginArr,
687			loop     : true,
688			caption : function( instance, item ) {
689				return $(this).attr('title');
690			},
691			beforeLoad: function(instance,current) {
692				//when there's nothing to load
693				if(typeof instance.current.src !== 'string') {  $.fancybox.close(true);  }
694			},
695			mobile : {
696				margin   : 0
697			}
698		});
699	}
700	
701	
702	function magnificInit() {
703		
704		//convert old pp links
705		$('a.pp').removeClass('pp').addClass('magnific-popup');
706		$("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])").removeAttr('rel').addClass('magnific-popup');
707
708
709		//image gallery nectar
710		$('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function(){
711			var $unique_id = Math.floor(Math.random()*10000);
712			$(this).find('.swiper-slide a:not(.ext-url-link)').addClass('pretty_photo');
713		});
714
715		//flex
716		$('.wpb_gallery_slides.wpb_flexslider').each(function(){
717			var $unique_id = Math.floor(Math.random()*10000);
718			$(this).find('.slides > li > a').addClass('pretty_photo');
719		});
720		//touch enabled gal
721		$('.wpb_gallery_slidesflickity_style').each(function(){
722			var $unique_id = Math.floor(Math.random()*10000);
723			$(this).find('.cell > a:not(.ext-url-link)').addClass('pretty_photo');
724		});
725
726		//add galleries to portfolios
727		$('.portfolio-items, .wpb_gallery .swiper-slide, .wpb_gallery_slidesflickity_style .cell, .wpb_gallery_slides.wpb_flexslider ul > li,  .wpb_gallery .parallax-grid-item').each(function(){
728			if($(this).find('.pretty_photo').length > 0) {
729				$(this).find('.pretty_photo').removeClass('pretty_photo').addClass('gallery').addClass('magnific');
730			} else if($(this).find('a[rel*="prettyPhoto["]').length > 0){
731				$(this).find('a[rel*="prettyPhoto["]').removeAttr('rel').addClass('gallery').addClass('magnific');
732			}
733
734		});
735		
736		$("a[data-rel='prettyPhoto[product-gallery]']").each(function(){
737			$(this).removeAttr('data-rel').addClass('magnific').addClass('gallery');
738		});
739		
740		//nectar auto lightbox
741		if($('body').hasClass('nectar-auto-lightbox')){
742			$('.gallery').each(function(){
743				if($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) {
744					var $unique_id = Math.floor(Math.random()*10000);
745					$(this).find('.gallery-item .gallery-icon a[href*=".jpg"], .gallery-item .gallery-icon a[href*=".png"], .gallery-item .gallery-icon a[href*=".gif"], .gallery-item .gallery-icon a[href*=".jpeg"]').addClass('magnific').addClass('gallery').removeClass('pretty_photo');
746				}
747			});
748			$('.main-content img').each(function(){
749				if($(this).parent().is("[href]") && !$(this).parent().is(".magnific-popup") && $(this).parents('.tiled-gallery').length == 0 && $(this).parents('.product-image').length == 0 && $(this).parents('.iosSlider.product-slider').length == 0) {
750					var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/);
751					if(match) $(this).parent().addClass('magnific-popup').addClass('image-link');
752				} 
753			});
754		}
755		
756
757		//regular
758		$('a.magnific-popup:not(.gallery):not(.nectar_video_lightbox)').magnificPopup({ 
759			type: 'image', 
760			callbacks: {
761				
762				imageLoadComplete: function()  {	
763					var $that = this;
764					setTimeout( function() { $that.wrap.addClass('mfp-image-loaded'); }, 10);
765				},
766				beforeOpen: function() {
767				    this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
768			    },
769			    open: function() {
770					    	
771					$.magnificPopup.instance.next = function() {
772						var $that = this;
773
774						this.wrap.removeClass('mfp-image-loaded');
775						setTimeout( function() { $.magnificPopup.proto.next.call($that); }, 100);
776					}
777
778					$.magnificPopup.instance.prev = function() {
779						var $that = this;
780
781						this.wrap.removeClass('mfp-image-loaded');
782						setTimeout( function() { $.magnificPopup.proto.prev.call($that); }, 100);
783					}
784					
785				}
786			},
787			fixedContentPos: false,
788		    mainClass: 'mfp-zoom-in', 
789		    removalDelay: 400 
790		});
791
792		//video
793		$('a.magnific-popup.nectar_video_lightbox, .magnific_nectar_video_lightbox a.link_text, .swiper-slide a[href*=youtube], .swiper-slide a[href*=vimeo], .nectar-video-box a.full-link.magnific-popup').magnificPopup({ 
794			type: 'iframe', 
795			fixedContentPos: false,
796		    mainClass: 'mfp-zoom-in', 
797		    removalDelay: 400 
798		});
799
800
801		//galleries
802		$('a.magnific.gallery').each(function(){
803
804			var $parentRow = ($(this).closest('.wpb_column').length > 0) ? $(this).closest('.wpb_column') : $(this).parents('.row');
805			if($parentRow.length > 0 && !$parentRow.hasClass('lightbox-col')) {
806
807				$parentRow.magnificPopup({
808					type: 'image',
809					delegate: 'a.magnific',
810					mainClass: 'mfp-zoom-in',
811					fixedContentPos: false,
812					callbacks: {
813
814						elementParse: function(item) {
815			
816							 if($(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('iframe=true') != -1 || $(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('https://www.youtube.com/watch') != -1 ) {
817						         item.type = 'iframe';
818						      } else if ($(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('video-popup-') != -1) {
819						      	item.type = 'inline';
820						      } else {
821						         item.type = 'image';
822						      }
823						},
824
825						imageLoadComplete: function()  {	
826							var $that = this;
827							setTimeout( function() { $that.wrap.addClass('mfp-image-loaded'); }, 10);
828						},
829
830						beforeOpen: function() {
831					       this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
832					    },
833
834					    open: function() {
835					    	
836
837					    	//self hosted video
838					    	if($(this.content).find('.mejs-video video').length > 0 && $().mediaelementplayer ) {
839	            				$(this.content).find('.mejs-video video')[0].player.remove();
840	            				
841	            				var $that = this;
842	            				setTimeout(function(){
843	            					$($that.content).find('video').mediaelementplayer();
844	            					$($that.content).find('.mejs-video video')[0].player.play();
845	            				},50);
846	            				
847	            			}
848
849							$.magnificPopup.instance.next = function() {
850								var $that = this;
851
852								this.wrap.removeClass('mfp-image-loaded');
853								setTimeout( function() { 
854									$.magnificPopup.proto.next.call($that); 
855
856									//self hosted video
857									if($($that.content).find('.mejs-video video').length > 0) {
858			            				$($that.content).find('.mejs-video video')[0].play();
859			            			}
860
861								}, 100);
862							}
863
864							$.magnificPopup.instance.prev = function() {
865								var $that = this;
866
867								this.wrap.removeClass('mfp-image-loaded');
868								setTimeout( function() { 
869									$.magnificPopup.proto.prev.call($that); 
870
871									//self hosted video
872									if($($that.content).find('.mejs-video video').length > 0) {
873			            				$($that.content).find('.mejs-video video')[0].play();
874			            			}
875								}, 100);
876							}
877							
878						},
879
880						close: function() {
881							//self hosted video
882					    	if($(this.content).find('.mejs-video video').length > 0) {
883	            				 $(this.content).find('.mejs-video video')[0].load();
884	            			}
885						}
886					},
887					removalDelay: 400, 
888					gallery: {
889			          enabled:true
890			        }
891				});
892
893				$parentRow.addClass('lightbox-col');
894			}
895			
896		});
897
898	}
899
900	function lightBoxInit() {
901		if($('body[data-ls="magnific"]').length > 0 || $('body[data-ls="pretty_photo"]').length > 0 ) {
902			magnificInit();
903		} else if($('body[data-ls="fancybox"]').length > 0) {
904			fancyBoxInit();
905		}
906	}
907
908	lightBoxInit();
909	//check for late links
910	setTimeout(lightBoxInit,500);
911	
912
913
914
915/*nectar liquid*/
916
917function NectarLiquid(bgIMG, type, el_type) {
918	this.canvasContainer = bgIMG[0];
919	this.rowBG = bgIMG;
920	this.animationType = type;
921	this.elType = el_type;
922	
923	this.bgDivWidth = $(this.rowBG).width();
924	this.bgDivHeight = $(this.rowBG).height();
925	this.bgDivRatio = this.bgDivHeight / this.bgDivWidth;
926	
927	
928	this.app = new PIXI.Application({
929		width: this.bgDivWidth, 
930		height: this.bgDivHeight,
931		transparent: true,
932		sharedTicker: true
933	});
934	
935	this.app.stage = new window.PIXI.Container();
936	this.imgContainer = new window.PIXI.Container();
937	
938
939	//grab displacement filter from css
940	$(this.canvasContainer).remove('.nectar-displacement');
941	$(this.canvasContainer).append('<div class="nectar-displacement"></div>');
942	this.displacementIMG_URL = $(this.canvasContainer).find('.nectar-displacement').css('background-image');			
943	this.displacementIMG_URL = this.displacementIMG_URL.replace(/(url\(|\)|")/g, '');
944				
945	//get row BG img
946	this.bgIMG_SRC = bgIMG.css('background-image');
947	this.bgIMG_SRC = this.bgIMG_SRC.replace(/(url\(|\)|")/g, '');
948	
949	
950	//init everything once loaded
951	this.loader = new PIXI.loaders.Loader();
952	this.loader.add('rowBG',this.bgIMG_SRC);
953	this.loader.add('displaceBG', this.displacementIMG_URL);
954	this.loader.load(this.initialize.bind(this));
955
956}
957
958NectarLiquid.prototype.initialize = function() {
959	
960  this.settings = {
961      animationStrength: 1,
962			animationStrengthSpeed: 1,
963		  displacementScaleX: 30,
964			displacementScaleY: 90,
965      time: Math.random()*20,
966			filterMultX: 200,
967			filterMultY: 350,
968			shouldAnimate: true
969  };
970	if(this.animationType == 'displace-filter-fade') {
971		
972		if(this.elType == 'row') {
973			this.settings.filterMultX = 150;
974			this.settings.filterMultY = 375;
975			this.settings.displacementScaleX = 80;
976			this.settings.displacementScaleY = 170;
977			this.settings.animationStrengthSpeed = 2;
978		} else {
979			this.settings.filterMultX = 55;
980			this.settings.filterMultY = 150;
981			this.settings.displacementScaleX = 50;
982			this.settings.displacementScaleY = 160;
983			this.settings.animationStrengthSpeed = 1;
984		}
985	} else {
986		
987		if(this.elType != 'row') {
988			this.settings.displacementScaleY = 70;
989		}
990		
991	}
992	
993
994	//displacement
995	this.filterSprite = new window.PIXI.Sprite( this.loader.resources.displaceBG.texture );
996	this.filterSprite.texture.baseTexture.wrapMode = PIXI.WRAP_MODES.REPEAT;
997	this.filter = new window.PIXI.filters.DisplacementFilter( this.filterSprite );
998
999	//bg	
1000	this.bg = new PIXI.Sprite( this.loader.resources.rowBG.texture );
1001
1002	////store actual img height/ratio
1003	this.imgHeight = this.loader.resources.rowBG.texture.orig.height;
1004	this.imgWidth = this.loader.resources.rowBG.texture.orig.width;
1005	this.imgRatio = this.imgWidth/this.imgHeight;
1006	
1007	// Set image anchor to the center of the image
1008  this.bg.anchor.x = 0.5;
1009  this.bg.anchor.y = 0.5;
1010	
1011	//sim background-size cover
1012	this.bg.height = $(this.rowBG).height();
1013	this.bg.width = this.imgRatio * this.bg.height;
1014	
1015	if( this.bg.width <= $(this.rowBG).width() ) {
1016		
1017		this.bg.width = $(this.rowBG).width() + 100;
1018		this.bg.height = this.bg.width / this.imgRatio;
1019		
1020	} else {
1021		this.bg.height = $(this.rowBG).height() + 100;
1022		this.bg.width = this.imgRatio * this.bg.height;
1023	}
1024
1025	//reset the dimensions for the renderer incase the row height has changed inbetween loading the bg resouce
1026	this.app.renderer.resize( $(this.rowBG).width(), $(this.rowBG).height() ); 
1027
1028  this.buildStage();
1029  this.createFilters();
1030	
1031	this.app.view.setAttribute( "class", "nectar-liquid-bg" );
1032  this.canvasContainer.appendChild( this.app.view );
1033	
1034	
1035	if(this.animationType == 'displace-filter-loop') {
1036		
1037		if($('#nectar_fullscreen_rows').length == 0) {
1038			
1039			this.animateFilters();
1040			
1041			$liquidBGOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '105%';
1042			
1043			var self = this;
1044			var $parentSelector = (self.elType == 'row') ? '.row-bg-wrap' : '.column-image-bg-wrap';
1045			
1046			var waypoint = new Waypoint({
1047				element: $(this.canvasContainer).parents($parentSelector),
1048				handler: function(direction) {
1049					//add bg to container
1050					self.imgContainer.addChild( self.bg );
1051				},
1052				offset: $liquidBGOffsetPos
1053			});
1054			
1055		} else {
1056			
1057			this.animateFilters();
1058			this.imgContainer.addChild( this.bg );
1059			
1060		}
1061
1062		
1063	}
1063 //end displace loop
1064	
1065	else if(this.animationType == 'displace-filter-fade') {
1066		
1067		this.animateFilters();
1068		this.settings.shouldAnimate = false;
1069		
1070		$liquidBGOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '85%';
1071		
1072		var self = this;
1073		var $parentSelector = (self.elType == 'row') ? '.row-bg-wrap' : '.column-image-bg-wrap';
1074			
1075		if($('#nectar_fullscreen_rows').length == 0 || $('#nectar_fullscreen_rows').length > 0 && $(this.canvasContainer).parents('.wpb_row.fp-section').index() == 0 || $disableFPonMobile == 'on') {
1076			
1077			var waypoint = new Waypoint({
1078				 element: $(this.canvasContainer).parents($parentSelector),
1079				 handler: function(direction) {
1080
1081					if($(self.canvasContainer).parents('.wpb_tab').length > 0 && $(self.canvasContainer).parents('.wpb_tab').css('visibility') == 'hidden' || $(self.canvasContainer).hasClass('animated-in')) { 
1082							 waypoint.destroy();
1083							 return;
1084					}
1085				
1086
1087					//add bg to container
1088					self.imgContainer.addChild( self.bg );
1089					
1090					//animate down
1091					self.animateProps(self);
1092					
1093					waypoint.destroy();
1094				},
1095				offset: $liquidBGOffsetPos
1096
1097			}); //waypoint end
1098		}
1099		
1100		
1101	} // end fade in displace
1102	
1103	//resize logic
1104 	$(window).resize(this.resize.bind(this));
1105  $(window).smartresize(this.resize.bind(this));
1106}
1107
1108NectarLiquid.prototype.animateProps = function(self) {
1109	
1110	setTimeout(function(){
1111
1112		$(self.canvasContainer).find('.nectar-liquid-bg').addClass('animated-in');
1113		
1114		self.settings.shouldAnimate = true;
1115		self.settings.animationStrength = 1;
1116		self.settings.animationStrengthSpeed = 2.5;
1117		self.animateFilters();
1118		
1119		//animate displacement down
1120		anime({
1121			targets: self.settings,
1122			animationStrength: 0,
1123			duration: 1900,
1124			easing: [.36,.42,.3,1],
1125			complete: function(anim) {
1126				self.settings.shouldAnimate = false
1127			}
1128		});
1129		
1130		anime({
1131			targets: self.settings,
1132			animationStrengthSpeed: 0.8,
1133			duration: 1900,
1134			easing: [.36,.42,.3,1],
1135			complete: function(anim) {
1136				self.settings.shouldAnimate = false
1137			}
1138		});
1139	
1140	},100);
1141	
1142}
1143
1144NectarLiquid.prototype.resize = function(){
1145	var self = this;
1146
1147  self.bgDivRatio = $(self.rowBG).height() / $(self.rowBG).width();
1148	 
1149	 self.imgContainer.position.x = $(self.rowBG).width() / 2;
1150   self.imgContainer.position.y = $(self.rowBG).height() / 2;
1151	 
1152	 //sim background-size cover
1153	 self.bg.height = $(self.rowBG).height();
1154	 self.bg.width = self.imgRatio * self.bg.height;
1155	 
1156	 if( self.bg.width <= $(self.rowBG).width() ) {
1157		 self.bg.width = $(self.rowBG).width() + 100;
1158		 self.bg.height = self.bg.width / self.imgRatio;
1159		 
1160	 } else {
1161		 self.bg.height = $(self.rowBG).height() + 100;
1162		 self.bg.width = self.imgRatio * self.bg.height;
1163	 }
1164	 
1165	 self.app.stage.scale.x = self.app.stage.scale.y = 1;
1166
1167	 self.app.renderer.resize( $(self.rowBG).width(), $(self.rowBG).height() ); 
1168
1169}
1170
1171NectarLiquid.prototype.createFilters = function() {
1172  this.app.stage.addChild( this.filterSprite );
1173  this.filter.scale.x = this.filter.scale.y = 1;
1174  this.imgContainer.filters = [
1175      this.filter
1176  ];
1177}
1178
1179	
1180NectarLiquid.prototype.buildStage = function() {
1181  this.imgContainer.position.x = $(this.rowBG).width() / 2;
1182  this.imgContainer.position.y = $(this.rowBG).height() / 2;
1183  this.app.stage.scale.x = this.app.stage.scale.y = 1;
1184  this.app.stage.addChild( this.imgContainer );
1185}
1186
1187
1188NectarLiquid.prototype.animateFilters = function() {
1189	this.filterSprite.rotation = this.settings.time * 0.01;
1190	this.filterSprite.x = Math.sin(this.settings.time * 0.1) * this.settings.filterMultX;
1191  this.filterSprite.y = Math.cos(this.settings.time * 0.1) * this.settings.filterMultY;
1192  this.filter.scale.x = this.settings.displacementScaleX * this.settings.animationStrength;
1193  this.filter.scale.y = this.settings.displacementScaleY * this.settings.animationStrength;
1194  
1195	
1196	this.settings.time += 0.05 * this.settings.animationStrengthSpeed;
1197	
1198	if(this.animationType == 'displace-filter-loop') {
1199		requestAnimationFrame(function(){
1200	    this.animateFilters();
1201	  }.bind(this));
1202	}
1203	else if(this.animationType == 'displace-filter-fade' && this.settings.shouldAnimate) {
1204		requestAnimationFrame(function(){
1205	    this.animateFilters();
1206	  }.bind(this));
1207	}
1208	
1209} 
1210
1211function nectarLiquidBGs() {
1212	$liquidBG_EL = [];
1213
1214	$('.row-bg-wrap[data-bg-animation*="displace-filter"] .row-bg.using-image, .column-image-bg-wrap[data-bg-animation*="displace-filter"] .column-image-bg').each(function(i){
1215		
1216		var $that_el = $(this);
1217		
1218		if( $(this).is('.row-bg') ) {
1219			
1220			var $type = $(this).parents('.row-bg-wrap').attr('data-bg-animation');
1221			var $el_type = 'row';
1222			
1223		} else if(  $(this).is('.column-image-bg') ) {
1224			
1225			var $type = $(this).parents('.column-image-bg-wrap').attr('data-bg-animation');
1226			var $el_type = 'col';
1227		}
1228		
1229		$liquidBG_EL[i] = new NectarLiquid($that_el, $type, $el_type);
1230		
1231	});
1232}
1233
1234
1235
1236
1237
1238/***************** Global vars ******************/
1239var $standAnimatedColTimeout = [];
1240var $animatedSVGIconTimeout = [];
1241var $svg_icons = [];
1242var $nectarCustomSliderRotate = [];
1243var $flickitySliders = [];
1244var $wooFlickityCarousels = [];
1245var $liquidBG_EL = [];
1246
1247/***************** Smooth Scrolling ******************/
1248
1249	function niceScrollInit(){
1250		//removed since 9.0.
1251	}
1252
1253	var $smoothActive = 0; 
1254	var $smoothCache = false;
1255	
1256	
1257/***************** Sliders ******************/
1258
1259	//gallery
1260	function flexsliderInit(){
1261		$('.flex-gallery').each(function(){
1262			
1263			var $that = $(this);
1264			
1265			imagesLoaded($(this),function(instance){
1266			
1267				 $that.flexslider({
1268			        animation: 'fade',
1269			        smoothHeight: false, 
1270			        animationSpeed: 500,
1271			        useCSS: false, 
1272			        touch: true
1273			    });
1274				
1275				////gallery slider add arrows
1276				$('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="fa fa-angle-right"></i>');
1277				$('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="fa fa-angle-left"></i>');
1278			
1279			});
1280			
1281		});
1282	}
1283	flexsliderInit();
1284
1285  
1286
1287
1288	function flickityInit() {
1289		if($('.nectar-flickity:not(.masonry)').length == 0) return false;
1290		$flickitySliders = [];
1291		$('.nectar-flickity:not(.masonry)').each(function(i){
1292			
1293			$(this).removeClass(function (index, className) {
1294			    return (className.match (/(^|\s)instance-\S+/g) || []).join(' ');
1295			});
1296			$(this).addClass('instance-'+i);
1297			
1298			var $freeScrollBool = ($(this).is('[data-free-scroll]') && $(this).attr('data-free-scroll') == 'true') ? true : false;
1299			var $groupCellsBool = true;
1300			var $flickContainBool = true;
1301			var $flcikAttr = 0.025;
1302			
1303			var $flickCellAlign = 'center';
1304			if( $(this).is('[data-format="fixed_text_content_fullwidth"]') ) {
1305					$flickCellAlign = 'left';
1306					$groupCellsBool = false;
1307					$flickContainBool = false;
1308					$flcikAttr = 0.02;
1309			}
1310
1311			if($freeScrollBool == true) {
1312				 $groupCellsBool = false;
1313			}
1314
1315			if($(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'next_prev_arrows') {
1316				var $paginationBool = false;
1317				var $nextPrevArrowBool = true;
1318			} else {
1319				var $paginationBool = true;
1320				var $nextPrevArrowBool = false;
1321			}
1322
1323			if($(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'none') {
1324				var $paginationBool = false;
1325				var $nextPrevArrowBool = false;
1326			}
1327
1328			var $flickity_autoplay = false;
1329			var $selectedAttraction = 0.025;
1330
1331			if($(this).is('[data-autoplay]') && $(this).attr('data-autoplay') == 'true') {
1332				
1333				$flickity_autoplay = true;
1334				$selectedAttraction = 0.019;
1335
1336				if($(this).is('[data-autoplay-dur]') && $(this).attr('data-autoplay-dur').length > 0) {
1337
1338					if(parseInt($(this).attr('data-autoplay-dur')) > 100 && parseInt($(this).attr('data-autoplay-dur')) < 30000) {
1339						$flickity_autoplay = parseInt($(this).attr('data-autoplay-dur'));
1340					}
1341					
1342				}
1343
1344			}
1345
1346			var $that = $(this);
1347			var $frontEndEditorDrag =  ($('body.vc_editor').length > 0) ? false: true;
1348			var $frontEndEditorPause =  ($('body.vc_editor').length > 0) ? true: false;
1349			
1350			$flickitySliders[i] = new Flickity('.nectar-flickity.instance-'+i, {
1351			  contain: $flickContainBool,
1352			  draggable:$frontEndEditorDrag,
1353			  lazyLoad: false,
1354			  imagesLoaded: true,
1355			  percentPosition: true,
1356				cellAlign: $flickCellAlign,
1357			  selectedAttraction: $selectedAttraction,
1358			  groupCells: $groupCellsBool,
1359			  prevNextButtons: $nextPrevArrowBool,
1360			  freeScroll: $freeScrollBool,
1361			  pageDots: $paginationBool,
1362			  resize: true,
1363				selectedAttraction: $flcikAttr,
1364			  autoPlay: $flickity_autoplay,
1365				pauseAutoPlayOnHover: $frontEndEditorPause,
1366			  setGallerySize: true,
1367			  wrapAround: true,
1368			  accessibility: false,
1369			  arrowShape: { 
1370				     x0: 20,
1371					  x1: 70, y1: 30,
1372					  x2: 70, y2: 25,
1373					  x3: 70
1374				}
1375			});
1376			
1377
1378			if($(this).is('[data-format="fixed_text_content_fullwidth"]') && !nectarDOMInfo.usingFrontEndEditor) {
1379				
1380				var $onMobileBrowser = navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/);
1381				
1382				$flickitySliders[i].on( 'scroll', function() {
1383					
1384					if($onMobileBrowser) { return; }
1385					
1386					var $curFlkSlid = $flickitySliders[i];
1387					var $flkSlideWidth = $that.find('.cell').outerWidth() + 25;
1388					var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 275 : 0;
1389					var $extraWindowSpace = ( ($(window).width() + $leftHeaderSize) - $that.parents('.main-content').width())/2;
1390					$extraWindowSpace += parseInt($that.css('margin-left')) + 2;
1391					$flickitySliders[i].slides.forEach( function( slide, j ) {
1392
1393							var $scaleAmt = 1;
1394							var $translateXAmt = 0;
1395							var $rotateAmt = 0;
1396							var $slideZIndex = 10;
1397							var $opacityAmt = 1;
1398							
1399							var $slideOffset = $(slide.cells[0].element).offset().left;
1400							
1401							var flkInstanceSlide = $('.nectar-flickity.instance-'+i+' .cell:nth-child('+ (j+1) +')');
1402							
1403							if($slideOffset - $extraWindowSpace < 0 && $slideOffset  - $extraWindowSpace > $flkSlideWidth*-1 ) {
1404								$scaleAmt = 1 + ( ($slideOffset - $extraWindowSpace) / 1500);
1405								$opacityAmt = 1 + ( ($slideOffset - $extraWindowSpace + 70) / 550);
1406								$translateXAmt = ( ($slideOffset - $extraWindowSpace)) * -1;
1407								$rotateAmt = ( ($slideOffset  - $extraWindowSpace) / 25) * -1;
1408							} else {
1409								$scaleAmt = 1;
1410								$opacityAmt = 1;
1411								$translateXAmt = 0;
1412								$rotateAmt = 0;
1413							}
1414							
1415							//handle z separately for an extra cushion of 5px in case
1416							if($slideOffset + 5 - $extraWindowSpace < 0 && $slideOffset  - $extraWindowSpace > $flkSlideWidth*-1 ) {
1417								$slideZIndex = 5;
1418							} else {
1419								$slideZIndex = 10;
1420							}
1421							
1422							flkInstanceSlide.css({
1423								'z-index' : $slideZIndex
1424							});
1425							
1426							flkInstanceSlide.find('.inner-wrap-outer').css({
1427								'transform': 'perspective(800px) translateX('+ $translateXAmt +'px) rotateY('+$rotateAmt+'deg) translateZ(0)',
1428								'opacity' : $opacityAmt
1429							});
1430							
1431							flkInstanceSlide.find('.inner-wrap').css({
1432								'transform': 'scale('+ $scaleAmt +') translateZ(0)'
1433							}); 
1434							
1435						  
1436					
1437					});
1438				});
1439				
1440				
1441			}
1442
1443			var $removeHiddenTimeout;
1444
1445			$flickitySliders[i].on( 'dragStart', function() {
1446			   clearTimeout($removeHiddenTimeout);
1447				 $that.addClass('is-dragging');
1448			   $that.find('.flickity-prev-next-button').addClass('hidden');
1449			});
1450			$flickitySliders[i].on( 'dragEnd', function() {
1451				$that.removeClass('is-dragging');
1452				$removeHiddenTimeout = setTimeout(function(){
1453					$that.find('.flickity-prev-next-button').removeClass('hidden');
1454				},600);
1455			 
1456			});
1457
1458			$('.flickity-prev-next-button').on( 'click', function() {
1459			   clearTimeout($removeHiddenTimeout);
1460			   $(this).parents('.nectar-flickity').find('.flickity-prev-next-button').addClass('hidden');
1461			   $removeHiddenTimeout = setTimeout(function(){
1462					$that.find('.flickity-prev-next-button').removeClass('hidden');
1463				},600);
1464			});
1465			
1466			
1467			//imgs loaded
1468			if($that.hasClass('nectar-carousel')) {
1469				imagesLoaded($that,function(instance){
1470					nectarCarouselFlkEH($that);
1471				});
1472			}
1473			
1474
1475		});
1476		
1477
1478	}
1479	
1480	
1481	setTimeout(flickityInit,100);
1482	
1483	
1484	//nectar carousel flickity equal height
1485	
1486	////loop
1487	function setNectarCarouselFlkEH() {
1488			$('.nectar-carousel.nectar-flickity:not(.masonry)').each(function(){
1489				  nectarCarouselFlkEH($(this));
1490			});
1491	}
1492	
1493	function nectarCarouselFlkEH($slider_instance) {
1494			
1495			var $tallestSlideCol = 0;
1496			
1497			$slider_instance.find('.flickity-slider > .cell').css('height','auto');
1498			
1499			$slider_instance.find('.flickity-slider > .cell').each(function(){
1500				($(this).height() > $tallestSlideCol) ? $tallestSlideCol = $(this).height() : $tallestSlideCol = $tallestSlideCol;
1501			});	
1502			
1503			//safety net incase height couldn't be determined
1504			if($tallestSlideCol < 10) $tallestSlideCol = 'auto';
1505
1506			//set even height
1507			$slider_instance.find('.flickity-slider > .cell').css('height',$tallestSlideCol+'px');
1508
1509	}
1510	
1511	
1512
1513
1514	function flickityBlogInit() {
1515		if($('.nectar-flickity.masonry.not-initialized').length == 0) return false;
1516
1517		$('.nectar-flickity.masonry.not-initialized').each(function(){
1518
1519			//move pos for large_featured
1520			if($(this).parents('article').hasClass('large_featured')) 
1521				$(this).insertBefore( $(this).parents('article').find('.content-inner') );
1522			
1523		});
1524
1525
1526		$('.nectar-flickity.masonry.not-initialized').flickity({
1527		  contain: true,
1528		  draggable: false,
1529		  lazyLoad: false,
1530		  imagesLoaded: true,
1531		  percentPosition: true,
1532		  prevNextButtons: true,
1533		  pageDots: false,
1534		  resize: true,
1535		  setGallerySize: true,
1536		  wrapAround: true,
1537		  accessibility: false
1538		});
1539
1540		$('.nectar-flickity.masonry').removeClass('not-initialized');
1541
1542		//add count
1543		$('.nectar-flickity.masonry:not(.not-initialized)').each(function(){
1544
1545			if($(this).find('.item-count').length == 0) {
1546				
1547				$('<div class="item-count"/>').insertBefore($(this).find('.flickity-prev-next-button.next'));
1548				$(this).find('.item-count').html('<span class="current">1</span>/<span class="total">' + $(this).find('.flickity-slider .cell').length + '</span>');
1549
1550				$(this).find('.flickity-prev-next-button, .item-count').wrapAll('<div class="control-wrap" />');
1551
1552				//move pos for wide_tall
1553				if($(this).parents('article').hasClass('wide_tall') && $(this).parents('.masonry.material').length == 0) 
1554					$(this).find('.control-wrap').insertBefore( $(this) );
1555			}
1556		});
1557
1558		//update count
1559		$('.masonry .flickity-prev-next-button.previous,  .masonry .flickity-prev-next-button.next').on('click',function(){
1560			if($(this).parents('.wide_tall').length > 0) 
1561				$(this).parent().find('.item-count .current').html($(this).parents('article').find('.nectar-flickity .cell.is-selected').index()+1);
1562			else 
1563				$(this).parent().find('.item-count .current').html($(this).parents('.nectar-flickity').find('.cell.is-selected').index()+1);
1564		});
1565
1566		$('body').on('mouseover','.flickity-prev-next-button.next',function(){
1567			$(this).parent().find('.flickity-prev-next-button.previous, .item-count').addClass('next-hovered');
1568		});
1569		$('body').on('mouseleave','.flickity-prev-next-button.next',function(){
1570			$(this).parent().find('.flickity-prev-next-button.previous, .item-count').removeClass('next-hovered');
1571		});
1572	
1573	}
1574/****************twenty twenty******************/
1575function twentytwentyInit() {
1576	$('.twentytwenty-container').each(function(){
1577		var $that = $(this);
1578		
1579		if($that.find('.twentytwenty-handle').length == 0) {
1580			$(this).imagesLoaded(function(){
1581				$that.twentytwenty();
1582			});
1583		}
1584		
1585	});
1586}
1587twentytwentyInit();
1588
1589/****************split line text******************/
1590if($('.nectar-recent-posts-single_featured.multiple_featured').length > 0) {
1591  splitLineText();
1592}
1593	
1594/****************full page******************/
1595var $frontEndEditorFPRDiv = '';
1596var $usingFullScreenRows = false;
1597var $fullscreenSelector = '';
1598var $disableFPonMobile = ($('#nectar_fullscreen_rows[data-mobile-disable]').length > 0) ? $('#nectar_fullscreen_rows').attr('data-mobile-disable') : 'off';
1599var $onMobileBrowser = navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/);
1600
1601if(!$onMobileBrowser) {
1602	$disableFPonMobile = 'off';
1603}
1604
1605//change anchor link IDs for when disabled on mobile
1606if($disableFPonMobile == 'on' && $('#nectar_fullscreen_rows').length > 0) {
1607	$('#nectar_fullscreen_rows > .wpb_row[data-fullscreen-anchor-id]').each(function(){
1608		if($(this).attr('data-fullscreen-anchor-id').length > 0)
1609			$(this).attr('id',$(this).attr('data-fullscreen-anchor-id'));
1610	});
1611
1612
1613	//remove main content row padding
1614	$('.container-wrap .main-content > .row').css({'padding-bottom':'0'});
1615
1616	//extra padding for first row is using transparent header
1617	if( $('#nectar_fullscreen_rows > .wpb_row:nth-child(1)').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && !$('#nectar_fullscreen_rows > .wpb_row:nth-child(1)').hasClass('full-width-content') ) {
1618		$('#nectar_fullscreen_rows > .wpb_row:nth-child(1)').addClass('extra-top-padding');
1619	}
1620}
1621
1622if($('#nectar_fullscreen_rows').length > 0 && $disableFPonMobile != 'on' || $().fullpage && $disableFPonMobile != 'on') {
1623
1624	function setFPNavColoring(index,direction) {
1625			
1626		  if($('#boxed').length > 0 && overallWidth > 750) return;
1627		
1628		  if($('#nectar_fullscreen_rows '+ $frontEndEditorFPRDiv+':nth-child('+index+')').find('.span_12.light').length > 0) {
1629    		$('#fp-nav').addClass('light-controls');
1630
1631    		  if(direction == 'up')
1632    			  $('#header-outer.dark-slide').removeClass('dark-slide');
1633    		  else
1634    		  	setTimeout(function(){ $('#header-outer.dark-slide').removeClass('dark-slide'); },520);
1635    	} else {
1636    		  $('#fp-nav.light-controls').removeClass('light-controls');
1637
1638    		  if(direction == 'up')
1639    		  	$('#header-outer').addClass('dark-slide');
1640    		  else
1641    			  setTimeout(function(){ $('#header-outer').addClass('dark-slide'); },520);
1642    	}
1643			
1644			//handle n slider coloring
1645			if($('#nectar_fullscreen_rows '+ $frontEndEditorFPRDiv+':nth-child('+index+')').find('.nectar-slider-wrap[data-fullscreen="true"]').length > 0) {
1646			 var $currentSlider = $('#nectar_fullscreen_rows '+ $frontEndEditorFPRDiv+':nth-child('+index+')').find('.nectar-slider-wrap[data-fullscreen="true"]');
1647		
1648				if( $currentSlider.is('[data-overall_style="directional"]') && $('#header-outer #logo span.dark').length > 0 ){
1649					$('#header-outer').addClass('directional-nav-effect').removeClass('dne-disabled');
1650				}
1651				
1652				if($currentSlider.find('.swiper-slide-active[data-color-scheme="light"]').length > 0) {
1653					$('#header-outer').removeClass('dark-slide');
1654				} else if($currentSlider.find('.swiper-slide-active[data-color-scheme="dark"]').length > 0) {
1655					$('#header-outer').addClass('dark-slide');
1656				}
1657				
1658			} else {
1659				
1660					$('#header-outer').removeClass('directional-nav-effect').addClass('dne-disabled');
1661				
1662			}
1663			
1664	}
1665	
1666	
1667
1668	var $anchors = [];
1669	var $names = [];
1670	
1671	function setFPNames() {
1672		$anchors = [];
1673		$names = [];
1674		$frontEndEditorFPRDiv =  (window.vc_iframe) ? '> .vc_element': '> .wpb_row';
1675		
1676		$('#nectar_fullscreen_rows '+ $frontEndEditorFPRDiv).each(function(i){
1677			var $id = ($(this).is('[data-fullscreen-anchor-id]')) ? $(this).attr('data-fullscreen-anchor-id') : '';
1678
1679			//anchor checks
1680			if($('#nectar_fullscreen_rows[data-anchors="on"]').length > 0) {
1681				if($id.indexOf('fws_') == -1) $anchors.push($id);
1682				else $anchors.push('section-'+(i+1));
1683			}
1684
1685			//name checks
1686			if($(this).find('.full-page-inner-wrap[data-name]').length > 0) 
1687				$names.push($(this).find('.full-page-inner-wrap').attr('data-name'));
1688			else 
1689				$names.push(' ');
1690		});
1691	}
1692	setFPNames();
1693
1694	function initFullPageFooter() {
1695		var $footerPos = $('#nectar_fullscreen_rows').attr('data-footer');
1696
1697		if($footerPos == 'default') {
1698			$('#footer-outer').appendTo('#nectar_fullscreen_rows').addClass('fp-auto-height').addClass('fp-section').addClass('wpb_row').attr('data-anchor',' ').wrapInner('<div class="span_12" />').wrapInner('<div class="container" />').wrapInner('<div class="full-page-inner" />').wrapInner('<div class="full-page-inner-wrap" />').wrapInner('<div class="full-page-inner-wrap-outer" />');
1699		}
1700		else if($footerPos == 'last_row') {
1701			$('#footer-outer').remove();
1702			$('#nectar_fullscreen_rows > .wpb_row:last-child').attr('id','footer-outer').addClass('fp-auto-height');
1703		} else {
1704			$('#footer-outer').remove();
1705		}
1706		
1707	}	
1708
1709	if($('#nectar_fullscreen_rows').length > 0)
1710		initFullPageFooter();
1711
1712	//fullscreen row logic
1713	function fullscreenRowLogic() {
1714		$('.full-page-inner-wrap .full-page-inner > .span_12 > .wpb_column').each(function(){
1715			if($(this).find('> .vc_column-inner > .wpb_wrapper').find('> .wpb_row').length > 0) {
1716
1717				//add class for css
1718				$(this).find('> .vc_column-inner > .wpb_wrapper').addClass('only_rows');
1719
1720				//set number of rows for css
1721				var $rowNum = $(this).find('> .vc_column-inner > .wpb_wrapper').find('> .wpb_row').length;
1722				$(this).find('> .vc_column-inner > .wpb_wrapper').attr('data-inner-row-num',$rowNum);
1723			} 
1724
1725			else if($(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').find('> .wpb_row').length > 0) {
1726
1727				//add class for css
1728				$(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').addClass('only_rows');
1729
1730				//set number of rows for css
1731				var $rowNum = $(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').find('> .wpb_row').length;
1732				$(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').attr('data-inner-row-num',$rowNum);
1733			}
1734		});
1735	}
1736
1737	fullscreenRowLogic();
1738
1739	function fullHeightRowOverflow() {
1740		//handle rows with full height that are larger than viewport
1741		if($(window).width() >= 1000) {
1742
1743	    	$('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap[data-content-pos="full_height"]').each(function(){
1744
1745	    		//reset mobile calcs incase user plays with window resize
1746	    		$(this).find('> .full-page-inner').css('height','100%');
1747
1748	    		var maxHeight = overallHeight;
1749	    		var columnPaddingTop = 0;
1750	    		var columnPaddingBottom = 0;
1751
1752	    		
1753	    		if($('#nectar_fullscreen_rows').attr('data-animation') == 'none')
1754	    			$(this).find('> .full-page-inner > .span_12 ').css('height','100%');
1755	    		else
1756	    			$(this).find('> .full-page-inner > .span_12 ').css('height',overallHeight);
1757
1758	    		$(this).find('> .full-page-inner > .span_12 > .wpb_column > .vc_column-inner > .wpb_wrapper').each(function(){
1759	    			 columnPaddingTop = parseInt($(this).parents('.wpb_column').css('padding-top'));
1760	    			 columnPaddingBottom = parseInt($(this).parents('.wpb_column').css('padding-bottom'));
1761
1762	    			 maxHeight = maxHeight > $(this).height() + columnPaddingTop + columnPaddingBottom ? maxHeight : $(this).height() + columnPaddingTop + columnPaddingBottom;
1763	    		});
1764	    		
1765	    	
1766	    		if(maxHeight > overallHeight)
1767	    			$(this).find('> .full-page-inner > .span_12').height(maxHeight).css('float','none');
1768	    		
1769	    	});
1770
1771	    }
1772
1773	    else {
1774	    	//mobile min height set
1775	    	$('#nectar_fullscreen_rows > .wpb_row').each(function(){
1776	    		$totalColHeight = 0;
1777	    		$(this).find('.fp-scrollable > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap[data-content-pos="full_height"] > .full-page-inner > .span_12 > .wpb_column').each(function(){
1778	    			$totalColHeight += $(this).outerHeight(true);
1779	    		});
1780
1781	    		$(this).find('.fp-scrollable > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').css('height','100%');
1782	    		if($totalColHeight > $(this).find('.fp-scrollable > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').height())
1783	    			$(this).find('.fp-scrollable  > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').height($totalColHeight);
1784	    	});
1785	    }
1786
1787	}
1788
1789	function fullscreenElementSizing() {
1790		//nectar slider
1791		var $nsSelector = '.nectar-slider-wrap[data-fullscreen="true"][data-full-width="true"], .nectar-slider-wrap[data-fullscreen="true"][data-full-width="boxed-full-width"]';
1792		if($('.nectar-slider-wrap[data-fullscreen="true"][data-full-width="true"]').length > 0 || $('.nectar-slider-wrap[data-fullscreen="true"][data-full-width="boxed-full-width"]').length > 0) {
1793			if($('#nectar_fullscreen_rows .wpb_row').length > 0) 
1794				$($nsSelector).find('.swiper-container').attr('data-height',$('#nectar_fullscreen_rows .wpb_row').height()+1);
1795	        
1796	        $(window).trigger('resize.nsSliderContent');
1797
1798	        $($nsSelector).parents('.full-page-inner').addClass('only-nectar-slider');
1799	    }
1800	}
1801
1802
1803	//kenburns first slide fix
1804	$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').addClass('kenburns');
1805	setTimeout(function(){
1806		//ken burns first slide fix
1807		$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').removeClass('kenburns');
1808	},500);
1809
1810	//remove kenburns from safari
1811	if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) $('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"]').attr('data-row-bg-animation','none');
1812
1813	var overallHeight = $(window).height();
1814	var overallWidth = $(window).width();
1815	var $fpAnimation = $('#nectar_fullscreen_rows').attr('data-animation');
1816	var $fpAnimationSpeed;
1817	var $svgResizeTimeout;
1818	
1819	switch($('#nectar_fullscreen_rows').attr('data-animation-speed')) {
1820		case 'slow':
1821			$fpAnimationSpeed = 1150;
1822			break;
1823		case 'medium':
1824			$fpAnimationSpeed = 850;
1825			break;
1826		case 'fast':
1827			$fpAnimationSpeed = 650;
1828			break;
1829		default:
1830			$fpAnimationSpeed = 850;
1831	}
1832	
1833	function heyFirefoxDrawTheEl(){
1834			var $drawTheEl = $('#nectar_fullscreen_rows > div:first-child').height();
1835			if($('#nectar_fullscreen_rows.trans-animation-active').length > 0){
1836				requestAnimationFrame(heyFirefoxDrawTheEl);
1837			}
1838	}
1839
1840	
1841	function initNectarFP() {
1842		
1843		$frontEndEditorFPRDiv =  (window.vc_iframe) ? '> .vc_element': '> .wpb_row';
1844		
1845		if(window.vc_iframe) {
1846			setTimeout(function(){
1847				$('html,body').css({
1848					'height':'100%',
1849				  'overflow-y':'hidden'
1850			  });
1851			},100);
1852			
1853			//remove scrolling to help performance of FE editor
1854			$('body,html').on("mousewheel.removeScroll", function() {
1855			    return false;
1856			});
1857			
1858		}
1859		
1860		//move row IDs onto parents for front end editor
1861		if($('body.vc_editor').length > 0) {
1862			$('#nectar_fullscreen_rows > .vc_empty-placeholder').remove();
1863			
1864			$('#nectar_fullscreen_rows > .vc_element').each(function(){
1865				var innerRowID = $(this).find('> .wpb_row').attr('id');
1866				$(this).attr('id',innerRowID);
1867			});
1868		}
1869		
1870		$usingFullScreenRows = true;
1871		$fullscreenSelector = (window.vc_iframe) ? '.vc_element.vc_vc_row.active ' : '.wpb_row.active ';
1872
1873		$('.container-wrap, .container-wrap .main-content > .row').css({'padding-bottom':'0', 'margin-bottom': '0'});
1874		$('#nectar_fullscreen_rows').fullpage({
1875			sectionSelector: '#nectar_fullscreen_rows '+$frontEndEditorFPRDiv,
1876			navigation: true,
1877			css3: true,
1878			scrollingSpeed: $fpAnimationSpeed,
1879			anchors: $anchors,
1880			scrollOverflow: true,
1881			navigationPosition: 'right',
1882			navigationTooltips: $names,
1883			afterLoad: function(anchorLink, index, slideAnchor, slideIndex){ 
1884
1885				if($('#nectar_fullscreen_rows').hasClass('afterLoaded')) {
1886				 	
1887					//ensure no scrolling body occurs
1888					if(nectarDOMInfo.scrollTop != 0) {
1889						window.scrollTo(0,0);
1890					}
1891					
1892					//reset slim scroll to top
1893					$('.wpb_row:not(.last-before-footer):not(:nth-child('+index+')) .fp-scrollable').each(function(){
1894						var $scrollable = $(this).data('iscrollInstance');
1895						$scrollable.scrollTo(0,0);
1896					});
1897
1898					//reset carousel
1899					$('.wpb_row:not(:nth-child('+index+')) .owl-carousel').trigger('to.owl.carousel',[0]);
1900
1901					var $row_id = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').attr('id');
1902
1903					$('#nectar_fullscreen_rows '+$frontEndEditorFPRDiv).removeClass('transition-out').removeClass('trans');
1904					
1905
1906					$('#nectar_fullscreen_rows '+ $frontEndEditorFPRDiv +':nth-child('+index+')').removeClass('next-current');
1907					$('#nectar_fullscreen_rows '+ $frontEndEditorFPRDiv +':nth-child('+index+') .full-page-inner-wrap-outer').css({'height': '100%'});
1908					$('#nectar_fullscreen_rows '+ $frontEndEditorFPRDiv +' .full-page-inner-wrap-outer').css({'transform':'none'});
1909					//take care of nav/control coloring
1910					//setFPNavColoring(index,'na');
1911					
1912					//handle waypoints
1913					if($row_id != 'footer-outer' && $('#nectar_fullscreen_rows '+ $frontEndEditorFPRDiv +':nth-child('+index+').last-before-footer').length == 0) {
1914						waypoints();
1915						if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && !nectarDOMInfo.usingFrontEndEditor) {
1916							resetWaypoints();
1917							Waypoint.destroyAll();
1918							startMouseParallax();
1919						}
1920						if(!nectarDOMInfo.usingFrontEndEditor) {
1921							nectarLiquidBGFP();
1922						}
1923						responsiveTooltips();
1924					}
1925					
1926					if($row_id !='footer-outer') {
1927						$('#nectar_fullscreen_rows ' + $frontEndEditorFPRDiv).removeClass('last-before-footer').css('transform','initial');
1928
1929						//reset animation attrs
1930						if(!window.vc_iframe) {
1931
1932							$('#nectar_fullscreen_rows '+ $frontEndEditorFPRDiv +':not(.active):not(#footer-outer)').css({'transform':'translateY(0)','left':'-9999px', 'transition': 'none', 'opacity':'1', 'will-change':'auto'});
1933							$('#nectar_fullscreen_rows '+ $frontEndEditorFPRDiv +':not(#footer-outer)').find('.full-page-inner-wrap-outer').css({'transition': 'none',  'transform':'none', 'will-change':'auto'});
1934							$('#nectar_fullscreen_rows '+ $frontEndEditorFPRDiv +':not(#footer-outer)').find('.fp-tableCell').css({'transition': 'none', 'transform':'none', 'will-change':'auto'});
1935						}
1936						
1937						//stacking fix
1938						$('#nectar_fullscreen_rows '+ $frontEndEditorFPRDiv +':not(#footer-outer)').find('.full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner > .container').css({'backface-visibility':'visible', 'z-index':'auto'});
1939					}
1940				} else {
1941					fullHeightRowOverflow();
1942					overallHeight = $('#nectar_fullscreen_rows').height();
1943					$('#nectar_fullscreen_rows').addClass('afterLoaded');
1944
1945					//for users that have scrolled down prior to turning on full page
1946					setTimeout(function(){ window.scrollTo(0,0); },1800);
1947
1948					//ken burns first slide fix
1949					$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] '+ $frontEndEditorFPRDiv +':first-child .row-bg.using-image').removeClass('kenburns');
1950
1951					//handle fullscreen elements
1952	        fullscreenElementSizing();
1953
1954						
1955				}
1956
1957				
1958				$('#nectar_fullscreen_rows').removeClass('nextSectionAllowed');
1959
1960				
1961			 },
1962	        onLeave: function(index, nextIndex, direction){ 
1963	        	
1964						$('#nectar_fullscreen_rows').addClass('trans-animation-active');
1965						
1966						var $row_id = $('#nectar_fullscreen_rows ' + $frontEndEditorFPRDiv + ':nth-child('+nextIndex+')').attr('id');
1967	        	var $indexRow = $('#nectar_fullscreen_rows ' + $frontEndEditorFPRDiv + ':nth-child('+index+')');
1968	        	var $nextIndexRow = $('#nectar_fullscreen_rows ' + $frontEndEditorFPRDiv + ':nth-child('+nextIndex+')');
1969	        	var $nextIndexRowInner = $nextIndexRow.find('.full-page-inner-wrap-outer');
1970	        	var $nextIndexRowFpTable = $nextIndexRow.find('.fp-tableCell');
1971	        	//mobile/safari  fix
1972	        	var $transformProp = (!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? 'transform' : 'all'; 
1973	        	//if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) $transformProp = 'all';
1974
1975	        	if( $row_id == 'footer-outer') {
1976	        		$indexRow.addClass('last-before-footer'); 
1977	        		$('#footer-outer').css('opacity','1');
1978	        	} else {
1979	        		$('#nectar_fullscreen_rows '+$frontEndEditorFPRDiv+'.last-before-footer').css('transform','translateY(0px)');
1980	        		$('#footer-outer').css('opacity','0');
1981	        	}
1982	        	if($indexRow.attr('id') == 'footer-outer') {
1983	        		$('#footer-outer').css({'transition': $transformProp+' 460ms cubic-bezier(0.60, 0.23, 0.2, 
19830.93)', 'backface-visibility': 'hidden'});
1984	        		$('#footer-outer').css({'transform': 'translateY(45%) translateZ(0)'});
1985	        	}
1986	 			
1987
1988	 			//stacking fix
1989	 			if($nextIndexRow.attr('id') != 'footer-outer') {
1990					$nextIndexRowFpTable.find('.full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner > .container').css({'backface-visibility':'hidden', 'z-index':'110'});
1991				}
1992
1993	        	//animation
1994	        	if($nextIndexRow.attr('id') != 'footer-outer' && $indexRow.attr('id') != 'footer-outer' && $('#nectar_fullscreen_rows[data-animation="none"]').length == 0 ) {
1995
1996	        		//scrolling down
1997	        		if(direction == 'down') {
1998
1999	        			if($fpAnimation == 'parallax') {
2000		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'will-change':'transform', 'transform':'translateZ(0)' ,'z-index': '100'});
2001		        			setTimeout(function() { 
2002		        				$indexRow.css({'transform': 'translateY(-50%) translateZ(0)'});
2003		        			}, 60);
2004
2005		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
2006		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
2007		        			$nextIndexRowInner.css({'transform':'translateY(-50%) translateZ(0)', 'will-change':'transform'});
2008		        			
2009	        			} else if($fpAnimation == 'zoom-out-parallax') {
2010
2011	        				$indexRow.css({'transition': 'opacity '+$fpAnimationSpeed+'ms cubic-bezier(0.37, 0.31, 0.2, 0.85), transform '+$fpAnimationSpeed+'ms cubic-bezier(0.37, 0.31, 0.2, 0.85)', 'z-index': '100', 'will-change':'transform'});
2012		        			setTimeout(function() { 
2013		        				$indexRow.css({'transform': 'scale(0.77) translateZ(0)', 'opacity': '0'});
2014		        			}, 60);
2015
2016		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
2017		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
2018		        			$nextIndexRowInner.css({'transform':'translateY(-50%) translateZ(0)',  'will-change':'transform'});
2019	        			} 
2020
2021	        		}
2022
2023	        		//scrolling up
2024	        		else {
2025
2026	        			if($fpAnimation == 'parallax') {
2027		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'z-index': '100', 'will-change':'transform'});
2028		        			setTimeout(function() { 
2029		        				$indexRow.css({'transform': 'translateY(50%) translateZ(0)'});
2030		        			}, 60);
2031
2032		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
2033		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)','will-change':'transform'});
2034		        			$nextIndexRowInner.css({'transform':'translateY(50%) translateZ(0)','will-change':'transform'});
2035	        			}
2036
2037	        			else if($fpAnimation == 'zoom-out-parallax') {
2038		        			$indexRow.css({'transition': 'opacity '+$fpAnimationSpeed+'ms cubic-bezier(0.37, 0.31, 0.2, 0.85), transform '+$fpAnimationSpeed+'ms cubic-bezier(0.37, 0.31, 0.2, 0.85)', 'z-index': '100', 'will-change':'transform'});
2039		        			setTimeout(function() { 
2040		        				$indexRow.css({'transform': 'scale(0.77) translateZ(0)', 'opacity': '0'});
2041		        			}, 60);
2042
2043		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
2044		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)', 'will-change':'transform'});
2045		        			$nextIndexRowInner.css({'transform':'translateY(50%) translateZ(0)', 'will-change':'transform'});
2046	        			} 
2047
2048	        		}
2049	        		
2050	        		setTimeout(function() { 
2051	    				$nextIndexRowFpTable.css({'transition':$transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1) 0ms', 'transform':'translateY(0%) translateZ(0)'});
2052	    				if($fpAnimation != 'none') { 
2053									$nextIndexRowInner.css({'transition':$transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1) 0ms', 'transform':'translateY(0%) translateZ(0)'});
2054									if(navigator.userAgent.indexOf('Firefox') != -1) {
2055										requestAnimationFrame(heyFirefoxDrawTheEl);
2056									}
2057							}
2058							
2059							
2060
2061							
2062	    			},60);
2063
2064	        	}
2065
2066	        	//adjust transform if larger than row height for parallax
2067	        	if($('#nectar_fullscreen_rows[data-animation="none"]').length == 0 && $nextIndexRow.find('.fp-scrollable').length > 0) {
2068	        		$nextIndexRow.find('.full-page-inner-wrap-outer').css('height',overallHeight);
2069						}
2070
2071	        	setTimeout(function() { 
2072	        		
2073	        		if( $row_id == 'footer-outer') {
2074
2075		        		$indexRow.css('transform','translateY(-'+($('#footer-outer').height()-1)+'px)');
2076
2077		        		$('#footer-outer').css({'transform': 'translateY(45%) translateZ(0)'});
2078		        		$('#footer-outer').css({'transition-duration': '0s', 'backface-visibility': 'hidden'});
2079		        		setTimeout(function() { 
2080		        			$('#footer-outer').css({'transition': $transformProp+' 500ms cubic-bezier(0.60, 0.23, 0.2, 
20800.93)', 'backface-visibility': 'hidden'});
2081	        				$('#footer-outer').css({'transform': 'translateY(0%) translateZ(0)'});
2082	        			},30);
2083		        	}
2084	        	},30);
2085
2086	        	if($row_id!='footer-outer') {
2087	        		
2088	        		stopMouseParallax();
2089
2090	        		//take care of nav/control coloring
2091	        		setFPNavColoring(nextIndex,direction);
2092							
2093							//handle main nav link highlight
2094							setTimeout(function(){
2095								FPActiveMenuItems(nextIndex);
2096							},50);
2097							
2098							
2099	        	}
2100	        		
2101	        },
2102
2103	        afterResize: function(){
2104	        	overallHeight = $('#nectar_fullscreen_rows').height();
2105	        	overallWidth = $(window).width();
2106	        	fullHeightRowOverflow();
2107	        	fullscreenElementSizing();
2108	        	fullscreenFooterCalcs();
2109
2110	        	if( $('#footer-outer.active').length > 0) {
2111	        		setTimeout(function(){
2112	        			$('.last-before-footer').css('transform','translateY(-'+$('#footer-outer').height()+'px)');
2113	        		},200);
2114		        } 
2115
2116		        //fix for svg animations when resizing and iscroll wraps/unwraps
2117		        clearTimeout($svgResizeTimeout);
2118		        $svgResizeTimeout = setTimeout(function(){ 
2119
2120		        	if($svg_icons.length > 0) {
2121			        	$('.svg-icon-holder.animated-in').each(function(i){
2122									$(this).css('opacity','1');
2123									$svg_icons[$(this).find('svg').attr('id').slice(-1)].finish();
2124								});
2125			        }
2126
2127		         },300);
2128	        }
2129
2130		});
2131	}
2132	
2133	if(window.vc_iframe) {
2134		
2135		//do nothing
2136	
2137	}	 else {
2138		if($('#nectar_fullscreen_rows').length > 0)
2139			initNectarFP();
2140	}
2141
2142
2143	$(window).smartresize(function(){
2144		
2145		if($('#nectar_fullscreen_rows').length > 0) {
2146			setTimeout(function(){
2147				$('.wpb_row:not(.last-before-footer) .fp-scrollable').each(function(){
2148					var $scrollable = $(this).data('iscrollInstance');
2149					$scrollable.refresh();
2150				});
2151			},200);
2152
2153			fullHeightRowOverflow();
2154
2155		}
2156	});
2157
2158	function fullscreenFooterCalcs() {
2159		if($('#footer-outer.active').length > 0) {
2160	    		$('.last-before-footer').addClass('fp-notransition').css('transform','translateY(-'+$('#footer-outer').height()+'px)');
2161	    		setTimeout(function(){
2162	    			$('.last-before-footer').removeClass('fp-notransition');
2163	    		},10);
2164	    	}
2165	}
2166
2167
2168
2169	function stopMouseParallax(){
2170		$.each($mouseParallaxScenes,function(k,v){
2171			v.parallax('disable');
2172		});
2173	}
2174
2175	function startMouseParallax(){
2176		if($('#nectar_fullscreen_rows > .wpb_row.active .nectar-parallax-scene').length > 0) {
2177			$.each($mouseParallaxScenes,function(k,v){
2178				v.parallax('enable');
2179			});
2180		}
2181	}
2182
2183	if($('#nectar_fullscreen_rows').length > 0) {
2184		
2185		if(window.vc_iframe) { 
2186			setTimeout(function(){
2187				setFPNavColoring(1,'na'); 
2188			},500);
2189		}
2190		else {
2191			setFPNavColoring(1,'na');
2192		}
2193		
2194		fullscreenElementSizing();
2195		
2196		//slide out right OCM material nav compat
2197		if($('body[data-slide-out-widget-area-style="slide-out-from-right"].material').length > 0) {
2198			$('#slide-out-widget-area .off-canvas-menu-container').find("a[href*='#']").on('click',function(e){
2199					
2200					var $link_hash = $(this).prop("hash");	
2201
2202					if($link_hash != '#' && $link_hash.indexOf("#") != -1 && $('div[data-fullscreen-anchor-id="'+$link_hash.substr($link_hash.indexOf("#")+1)+'"]').length > 0) {
2203						
2204							if($('body.material-ocm-open').length > 0) {
2205									
2206									$('body > .slide_out_area_close').addClass('non-human-allowed').trigger('click');
2207
2208									setTimeout(function(){
2209										$('body > .slide_out_area_close').removeClass('non-human-allowed');
2210									},100);
2211
2212							} 
2213							
2214					} // if a section has been found
2215					
2216			}); //click
2217		}
2218		
2219		
2220	}
2221	
2222	function FPActiveMenuItems(index) {
2223		
2224		if(!$('#nectar_fullscreen_rows[data-anchors="on"]').length > 0 || !index) return;
2225		
2226		var $hash = window.location.hash;
2227		var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1,$hash.length) : '';
2228
2229		 if($('body:not(.mobile) #header-outer[data-has-menu="true"]').length > 0 && $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')[data-fullscreen-anchor-id]').length > 0 && $('header#top nav > ul.sf-menu > li').find('> a[href$="#'+$hashSubstrng+'"]').length > 0 ) {
2230			  $('header#top nav > ul.sf-menu > li').removeClass('current-menu-item');
2231				$('header#top nav > ul.sf-menu > li').find('> a[href$="'+$hashSubstrng+'"]').parent().addClass('current-menu-item');
2232		 } 
2233	}
2234
2235	function resetWaypoints() {
2236		//animated columns / imgs
2237		$('img.img-with-animation.animated-in:not([data-animation="none"])').css({'transition':'none'});
2238		$('img.img-with-animation.animated-in:not([data-animation="none"])').css({'opacity':'0','transform':'none'}).removeClass('animated-in');
2239		$('.col.has-animation.animated-in:not([data-animation*="reveal"]), .wpb_column.has-animation.animated-in:not([data-animation*="reveal"])').css({'transition':'none'});
2240		$('.col.has-animation.animated-in:not([data-animation*="reveal"]), .wpb_column.has-animation.animated-in:not([data-animation*="reveal"]), .nectar_cascading_images .cascading-image:not([data-animation="none"]) .inner-wrap').css({'opacity':'0','transform':'none','left':'auto','right':'auto'}).removeClass('animated-in');	
2241		$('.col.has-animation.boxed:not([data-animation*="reveal"]), .wpb_column.has-animation.boxed:not([data-animation*="reveal"])').addClass('no-pointer-events');
2242		
2243		//row BG animations
2244		$('.row-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .inner-wrap.using-image').removeClass('animated-in');
2245		$('.column-image-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .inner-wrap').removeClass('animated-in');
2246		
2247		//reveal columns
2248		$('.wpb_column.has-animation[data-animation*="reveal"], .nectar_cascading_images').removeClass('animated-in');
2249		if(overallWidth > 1000 && $('.using-mobile-browser').length == 0) {
2250			$('.wpb_column.has-animation[data-animation="reveal-from-bottom"] > .column-inner-wrap').css({'transition':'none','transform':'translate(0, 100%)'});
2251			$('.wpb_column.has-animation[data-animation="reveal-from-bottom"] > .column-inner-wrap > .column-inner').css({'transition':'none','transform':'translate(0, -90%)'});
2252			$('.wpb_column.has-animation[data-animation="reveal-from-top"] > .column-inner-wrap').css({'transition':'none','transform':'translate(0, -100%)'});
2253			$('.wpb_column.has-animation[data-animation="reveal-from-top"] > .column-inner-wrap > .column-inner').css({'transition':'none','transform':'translate(0, 90%)'});
2254			$('.wpb_column.has-animation[data-animation="reveal-from-left"] > .column-inner-wrap').css({'transition-duration':'0s','transform':'translate(-100%, 0)'});
2255			$('.wpb_column.has-animation[data-animation="reveal-from-left"] > .column-inner-wrap > .column-inner').css({'transition-duration':'0s','transform':'translate(90%, 0)'});
2256			$('.wpb_column.has-animation[data-animation="reveal-from-right"] > .column-inner-wrap').css({'transition-duration':'0s','transform':'translate(100%, 0)'});
2257			$('.wpb_column.has-animation[data-animation="reveal-from-right"] > .column-inner-wrap > .column-inner').css({'transition-duration':'0s','transform':'translate(-90%, 0)'});
2258		}
2259		$('.wpb_column.has-animation[data-animation*="reveal"] > .column-inner-wrap, .wpb_column.has-animation[data-animation*="reveal"] > .column-inner-wrap > .column-inner').removeClass('no-transform');
2260
2261		//vcwaypoints
2262		$('.wpb_animate_when_almost_visible.animated').removeClass('wpb_start_animation').removeClass('animated');
2263
2264		//column borders
2265		$('.wpb_column[data-border-animation="true"] .border-wrap.animation').removeClass('animation').removeClass('completed');
2266
2267		//milestone
2268		$('.nectar-milestone.animated-in').removeClass('animated-in').removeClass('in-sight');
2269		$('.nectar-milestone .symbol').removeClass('in-sight');
2270
2271		//fancy ul
2272		$('.nectar-fancy-ul[data-animation="true"]').removeClass('animated-in');
2273		$('.nectar-fancy-ul[data-animation="true"] ul li').css({'opacity':'0','left':'-20px'});
2274
2275		//progress bars
2276		$('.nectar-progress-bar').parent().removeClass('completed');
2277		$('.nectar-progress-bar .bar-wrap > span').css({'width':'0px'});
2278		$('.nectar-progress-bar .bar-wrap > span > strong').css({'opacity':'0'});
2279		//$('.nectar-progress-bar .bar-wrap').css({'opacity':'0'});
2280
2281		//clients
2282		$('.clients.fade-in-animation').removeClass('animated-in');
2283		$('.clients.fade-in-animation > div').css('opacity','0');
2284
2285		//carousel
2286		$('.owl-carousel[data-enable-animation="true"]').removeClass('animated-in');
2287		$('.owl-carousel[data-enable-animation="true"] .owl-stage > .owl-item').css({'transition':'none','opacity':'0','transform':'translate(0, 70px)'});
2288		//dividers
2289		$('.divider-small-border[data-animate="yes"], .divider-border[data-animate="yes"]').removeClass('completed').css({'transition':'none','transform':'scale(0,1)'});
2290
2291		//icon list
2292		$('.nectar-icon-list').removeClass('completed');
2293		$('.nectar-icon-list-item').removeClass('animated');
2294
2295		//portfolio
2296		$('.portfolio-items .col').removeClass('animated-in');
2297
2298		//split line
2299		$('.nectar-split-heading').removeClass('animated-in');
2300		$('.nectar-split-heading .heading-line > div').transit({'y':'200%'},0);
2301
2302		//image with hotspots
2303		$('.nectar_image_with_hotspots[data-animation="true"]').removeClass('completed');
2304		$('.nectar_image_with_hotspots[data-animation="true"] .nectar_hotspot_wrap').removeClass('animated-in');
2305
2306		//animated titles
2307		$('.nectar-animated-title').removeClass('completed');
2308		
2309		//highlighted text
2310		$('.nectar-highlighted-text em').removeClass('animated');
2311
2312		if($('.vc_pie_chart').length > 0) {
2313			vc_pieChart();
2314		}
2315
2316		$('.col.has-animation:not([data-animation*="reveal"]), .wpb_column.has-animation:not([data-animation*="reveal"])').each(function(i) {
2317		   	//clear previous timeout (needed for fullscreen rows)
2318			clearTimeout($standAnimatedColTimeout[i]); 
2319		});
2320
2321	}
2322
2323	
2324
2325} else if($('#nectar_fullscreen_rows').length > 0 && $disableFPonMobile == 'on' || $().fullpage && $disableFPonMobile == 'on') {
2326
2327	//remove markup
2328	$('html,body').css({'height':'auto','overflow-y':'auto'});
2329}
2330
2331
2332function nectarLiquidBGFP(){
2333	
2334	$('.nectar-liquid-bg').removeClass('animated-in');
2335	
2336	for(var k=0; k<$liquidBG_EL.length;k++) {
2337		if($liquidBG_EL[k].animationType == 'displace-filter-fade' && $($liquidBG_EL[k].canvasContainer).parents('.fp-section.active').length > 0) {
2338			
2339			//add bg to container
2340			if($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) {
2341				$liquidBG_EL[k].imgContainer.addChild( $liquidBG_EL[k].bg );
2342			}
2343			$($liquidBG_EL[k].canvasContainer).find('.nectar-liquid-bg').addClass('image-added-to-stage');
2344			
2345			$liquidBG_EL[k].animateProps($liquidBG_EL[k]);
2346
2347		}
2348	}
2349}
2350
2351
2352/***************** Superfish ******************/
2353	
2354	function initSF(){
2355
2356		if($('body[data-header-format="left-header"]').length == 0) {
2357
2358
2359			var $disableHI = ($('body[data-dropdown-style="minimal"]').length > 0 && !($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0) ) ? true : false;
2360
2361			$(".sf-menu").superfish({
2362				 delay: 650,
2363				 speed: 'fast',
2364				 disableHI: $disableHI,
2365				 speedOut:      'fast',             
2366				 animation:   {opacity:'show'}
2367			}); 
2368
2369			//handle initial show on left class for minimal styling
2370			$('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function(){
2371				
2372				if($(this).offset().left + $(this).outerWidth() > $(window).width()) {
2373					$(this).addClass('on-left-side');
2374					$(this).find('ul').addClass('on-left-side');
2375				} 
2376				
2377			});
2378			
2379
2380			//megamenu multi section per column title support
2381			$('body:not([data-header-format="left-header"]) header#top nav > ul > li.megamenu > ul > li > ul > li:has("> ul")').addClass('has-ul'); 
2382
2383			//fullwidth megamenu
2384			if($('body[data-megamenu-width="full-width"]').length > 0 && $('ul.sub-menu').length > 0) {
2385				megamenuFullwidth();
2386				$(window).on('smartresize',megamenuFullwidth);
2387				$('header#top nav > ul > li.megamenu > .sub-menu').css('box-sizing','content-box');
2388			}
2389
2390			//extra hover class for megamenu check
2391			$('header#top nav > ul.sf-menu > li').on('mouseenter',function(){
2392				$(this).addClass('menu-item-over');
2393			});
2394			$('header#top nav > ul.sf-menu > li').on('mouseleave',function(){
2395				$(this).removeClass('menu-item-over');
2396			});
2397
2398			//remove arrows on mega menu item
2399			$('header#top nav .megamenu .sub-menu a.sf-with-ul .sf-sub-indicator, header#top .megamenu .sub-menu a .sf-sub-indicator').remove();
2400
2401			//blank title megamenu columns
2402			////desktop
2403			$('header#top nav > ul > li.megamenu > ul.sub-menu > li > a').each(function(){
2404				if( $(this).text() == '–' ) {
2405					$(this).remove();
2406				}
2407			});
2408
2409		
2410		}
2411		
2412	}
2413
2414	
2415	function megamenuFullwidth() {
2416		var $windowWidth = $(window).width();
2417		var $headerContainerWidth = $('header#top > .container').width();
2418		$('header#top nav > ul > li.megamenu > .sub-menu').css({
2419			'padding-left' : ($windowWidth - $headerContainerWidth)/2 + 'px',
2420			'padding-right' : ($windowWidth+2 - $headerContainerWidth)/2 + 'px',
2421			'width' : $headerContainerWidth,
2422			'left' : '-' + ($windowWidth - $headerContainerWidth)/2 + 'px'
2423		});
2424	}
2425	
2426	var $navLeave;
2427	
2428	function addOrRemoveSF(){
2429		
2430		if( window.innerWidth < 1000 && $('body').attr('data-responsive') == '1'){
2431			$('body').addClass('mobile');
2432			$('header#top nav').css('display','none');
2433		}
2434		
2435		else {
2436			$('body').removeClass('mobile');
2437			$('header#top nav').css('display','');
2438			$('#mobile-menu').hide();
2439			$('.slide-out-widget-area-toggle #toggle-nav .lines-button').removeClass('close');
2440			
2441			//recalc height of dropdown arrow
2442			$('.sf-sub-indicator').css('height',$('a.sf-with-ul').height());
2443		}
2444
2445		//add specific class if on device for better tablet tracking
2446		if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) { $('body').addClass('using-mobile-browser'); }
2447
2448	}
2449
2450	function showOnLeftSubMenu() {
2451		//show on left class for minimal styling
2452		$('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function(){
2453			
2454			$(this).removeClass('on-left-side');
2455
2456			if($(this).offset().left + $(this).outerWidth() > $(window).width()) {
2457				$(this).addClass('on-left-side');
2458				$(this).find('ul').addClass('on-left-side');
2459			} else {
2460				$(this).removeClass('on-left-side');
2461				$(this).find('ul').removeClass('on-left-side');
2462			}
2463			
2464		});
2465	}
2466	
2467	addOrRemoveSF();
2468	initSF();
2469	
2470	$(window).resize(addOrRemoveSF);
2471
2472	
2473	function SFArrows(){
2474
2475		//set height of dropdown arrow
2476		$('.sf-sub-indicator').css('height',$('a.sf-with-ul').height());
2477	}
2478	
2479	SFArrows();
2480	
2481
2482	//deactivate hhun on phone
2483	if( navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/) && $('#header-outer[data-remove-fixed="1"]').length == 0 ) {
2484		$('body').attr('data-hhun','0');
2485	}
2486
2487
2488/***************** Caroufredsel ******************/
2489	
2490	function standardCarouselInit() {
2491		$('ul.carousel:not(".clients")').each(function(){
2492	    	var $that = $(this); 
2493	    	var maxCols = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : 3 ;
2494	    	var scrollNum = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : '' ;
2495	    	var colWidth = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 500 : 453 ;
2496	    	var scrollSpeed, easing;
2497	    	var $autoplayBool = ($(this).attr('data-autorotate') == 'true') ? true : false;
2498			
2499			if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
2500				if($(this).find('li').length % 3 === 0) {
2501					var $themeSkin = true;
2502					var $themeSkin2 = true;
2503				} else {
2504					var $themeSkin = false;
2505					var $themeSkin2 = true;
2506				}
2507	
2508			} else {
2509				var $themeSkin = true;
2510				var $themeSkin2 = true;
2511			}
2512
2513			(parseInt($(this).attr('data-scroll-speed'))) ? scrollSpeed = parseInt($(this).attr('data-scroll-speed')) : scrollSpeed = 700;
2514			($(this).is('[data-easing]')) ? easing = $(this).attr('data-easing') : easing = 'linear';
2515			
2516			
2517			var $element = $that;
2518			if($that.find('img').length == 0) $element = $('body');
2519			
2520			imagesLoaded($element,function(instance){
2521	
2522				
2523		    	$that.carouFredSel({
2524		    		circular: $themeSkin,
2525		    		infinite: $themeSkin2,
2526		    		height : 'auto',
2527		    		responsive: true,
2528			        items       : {
2529						width : colWidth,
2530				        visible     : {
2531				            min         : 1,
2532				            max         : maxCols
2533				        }
2534				    },
2535				    swipe       : {
2536				        onTouch     : true,
2537				        onMouse         : true,
2538				        options      : {
2539				        	excludedElements: "button, input, select, textarea, .noSwipe",
2540				        	tap: function(event, target){ if($(target).attr('href') && !$(target).is('[target="_blank"]') && !$(target).is('[rel^="prettyPhoto"]') && !$(target).is('.magnific-popup') && !$(target).is('.magnific')) window.open($(target).attr('href'), '_self'); }
2541				        },
2542				        onBefore : function(){
2543				    		//hover effect fix
2544				    		$that.find('.work-item').trigger('mouseleave');
2545				    		$that.find('.work-item .work-info a').trigger('mouseup');
2546				    	}
2547				    },
2548				    scroll: {
2549				    	items			: scrollNum,
2550				    	easing          : easing,
2551			            duration        : scrollSpeed,
2552			            onBefore	: function( data ) {
2553			            	
2554			            	 if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
2555			            	 	$that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
2556
2557			            	 }	
2558						},
2559						onAfter	: function( data ) {
2560			            	 if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
2561			            	 	$that.parents('.carousel-wrap').find('.item-count .current').html( $that.triggerHandler('currentPage') +1);
2562			            	 	$that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
2563
2564			            	 }	
2565						}
2566
2567				    },
2568			        prev    : {
2569				        button  : function() {
2570				           return $that.parents('.carousel-wrap').find('.carousel-prev');
2571				        }
2572			    	},
2573				    next    : {
2574			       		button  : function() {
2575				           return $that.parents('.carousel-wrap').find('.carousel-next');
2576				        }
2577				    },
2578				    auto    : {
2579				    	play: $autoplayBool
2580				    }
2581			    }, { transition: true }).animate({'opacity': 1},1300);
2582			    
2583			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
2584
2585			    if($that.parents('.carousel-wrap').attr('data-full-width') == 'true') $that.parents('.carousel-outer').css('overflow','visible');
2586
2587			    //add count for non full width ascend skin
2588			    if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
2589					$('<div class="item-count"><span class="current">1</span>/<span class="total">'+($that.find('> li').length / $that.triggerHandler("currentVisible").length) +'</span></div>').insertAfter($that.parents('.carousel-wrap').find('.carousel-prev'));
2590				}
2591			    
2592			    $that.addClass('finished-loading');
2593
2594			    carouselHeightCalcs();
2595
2596		     });//images loaded
2597		     	     
2598	    });//each
2599
2600		
2601    }
2602    if($('.carousel').length > 0) standardCarouselInit();
2603
2604
2605    function owlCarouselInit() {
2606    	//owl
2607		$('.owl-carousel').each(function(){
2608			
2609			$(this).addClass('owl-theme'); //new version removed this
2610			
2611			var $that = $(this);
2612			var $stagePadding = ($(window).width()<1000) ? 0 : parseInt($(this).attr('data-column-padding'));
2613			var $autoRotateBool = $that.attr('data-autorotate');
2614			var $autoRotateSpeed = $that.attr('data-autorotation-speed');
2615			var $owlLoopBool = ($that.is('[data-loop="true"]')) ? true : false;
2616			
2617			$(this).owlCarousel({
2618			      responsive:{
2619				        0:{
2620				            items: $(this).attr('data-mobile-cols')
2621				        },
2622				        690:{
2623				            items: $(this).attr('data-tablet-cols')
2624				        },
2625				        1000:{
2626				          items: $(this).attr('data-desktop-small-cols')
2627				        },
2628				        1300:{
2629				            items: $(this).attr('data-desktop-cols')
2630				        }
2631				    },
2632			      /*stagePadding: $stagePadding,*/
2633			      autoplay: $autoRotateBool,
2634			      autoplayTimeout: $autoRotateSpeed,
2635						loop: $owlLoopBool,
2636						smartSpeed: 350,
2637			      onTranslate: function(){
2638			      	$that.addClass('moving');
2639			      },
2640			      onTranslated: function(){
2641			      	$that.removeClass('moving');
2642			      }
2643
2644			  });
2645
2646			$(this).on('changed.owl.carousel', function (event) {
2647			    if (event.item.count - event.page.size == event.item.index)
2648			        $(event.target).find('.owl-dots div:last')
2649			          .addClass('active').siblings().removeClass('active');
2650			});	
2651
2652		});	
2653
2654
2655    }
2656
2657
2658
2659	function owl_carousel_animate() {
2660		$($fullscreenSelector+'.owl-carousel[data-enable-animation="true"]').each(function(){
2661
2662			$owlOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
2663
2664			var $animationDelay = ($(this).is('[data-animation-delay]') && $(this).attr('data-animation-delay').length > 0 && $(this).attr('data-animation') != 'false') ? $(this).attr('data-animation-delay') : 0;
2665
2666			var $that = $(this);
2667			var waypoint = new Waypoint({
2668	 			element: $that,
2669	 			 handler: function(direction) {
2670
2671	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
2672					     waypoint.destroy();
2673					     return;
2674					}
2675
2676					setTimeout(function(){
2677		 			 	$that.find('.owl-stage > .owl-item').each(function(i){
2678		 			 		var $that = $(this);
2679							$that.delay(i*200).transition({
2680								'opacity': '1',
2681								'y' : '0'
2682							},600,'easeOutQuart');
2683						});
2684						$that.addClass('animated-in');
2685		 			 },$animationDelay);
2686
2687					waypoint.destroy();
2688				},
2689				offset: $owlOffsetPos
2690
2691			}); 
2692
2693		});
2694	}
2695
2696
2697
2698
2699    function productCarouselInit() {
2700		$('.products-carousel').each(function(){
2701	    	var $that = $(this).find('ul'); 
2702	    	var maxCols = 'auto';
2703	    	var scrollNum = 'auto';
2704	    	var colWidth = ($(this).parents('.full-width-content ').length > 0) ? 400 : 353 ;
2705			var scrollSpeed = 800;
2706			var easing = 'easeInOutQuart';
2707			
2708			
2709			var $element = $that;
2710			if($that.find('img').length == 0) $element = $('body');
2711			
2712			//controls on hover
2713			$(this).append('<a class="carousel-prev" href="#"><i class="icon-salient-left-arrow"></i></a> <a class="carousel-next" href="#"><i class="icon-salient-right-arrow"></i></a>')
2714
2715			imagesLoaded($element,function(instance){
2716	
2717				
2718		    	$that.carouFredSel({
2719		    		circular: true,
2720		    		responsive: true,
2721			        items       : {
2722						width : colWidth,
2723				        visible     : {
2724				            min         : 1,
2725				            max         : maxCols
2726				        }
2727				    },
2728				    swipe       : {
2729				        onTouch     : true,
2730				        onMouse         : true,
2731				        options      : {
2732				        	excludedElements: "button, input, select, textarea, .noSwipe",
2733				        	tap: function(event, target){ 
2734				        		if($(target).attr('href') && !$(target).is('[target="_blank"]') && !$(target).hasClass('add_to_wishlist') && !$(target).hasClass('add_to_cart_button') && !$(target).is('[rel^="prettyPhoto"]')) 
2735				        			window.open($(target).attr('href'), '_self'); 
2736				        		if($(target).parent().attr('href') && !$(target).parent().is('[target="_blank"]') && !$(target).parent().hasClass('add_to_wishlist') && !$(target).parent().hasClass('add_to_cart_button') && !$(target).parent().is('[rel^="prettyPhoto"]')) 
2737				        			window.open($(target).parent().attr('href'), '_self'); 
2738				        	}
2739				        },
2740				        onBefore : function(){
2741				    		//hover effect fix
2742				    		$that.find('.product-wrap').trigger('mouseleave');
2743				    		$that.find('.product a').trigger('mouseup');
2744				    	}
2745				    },
2746				    scroll: {
2747				    	items			: scrollNum,
2748				    	easing          : easing,
2749			            duration        : scrollSpeed
2750				    },
2751			        prev    : {
2752				        button  : function() {
2753				           return $that.parents('.carousel-wrap').find('.carousel-prev');
2754				        }
2755			    	},
2756				    next    : {
2757			       		button  : function() {
2758				           return $that.parents('.carousel-wrap').find('.carousel-next');
2759				        }
2760				    },
2761				    auto    : {
2762				    	play: false
2763				    }
2764			    }).animate({'opacity': 1},1300);
2765			    
2766			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
2767			    
2768			    $that.addClass('finished-loading');
2769			    fullWidthContentColumns();
2770			    $(window).trigger('resize');
2771
2772		     });//images loaded
2773				 
2774		     	     
2775	    });//each
2776			
2777			
2778			
2779		
2780			$wooFlickityCarousels = [];
2781			$('.nectar-woo-flickity').each(function(i){
2782				
2783				var $that = $(this);
2784
2785				$(this).find('.products > li').each(function(){
2786					$(this).wrap('<div class="flickity-cell"></div>');
2787				});
2788				
2789				fullWidthSections();
2790				
2791				var pageDotsBool = ($that.is('[data-controls="bottom-pagination"]')) ? true : false;
2792				var arrowsBool = ($that.is('[data-controls="bottom-pagination"]')) ? false : true;
2793				var $autoplay = ( $that.is('[data-autorotate-speed]') && parseInt( $that.attr('data-autorotate-speed') ) > 800) ? parseInt($that.attr('data-autorotate-speed')) : 5000;
2794				if(!$that.is('[data-autorotate="true"]')) { $autoplay = false; }
2795				
2796				$(this).find('ul').addClass('generate-markup');
2797				
2798				$wooFlickityCarousels[i] = $(this).find('ul');
2799				
2800				if(arrowsBool == true) {
2801					$wooFlickityCarousels[i].on( 'ready.flickity', function() {
2802						var flickityPrv = $that.find('.flickity-prev-next-button.previous').detach();
2803	 				  var flickityNxt = $that.find('.flickity-prev-next-button.next').detach();
2804						
2805						$that.find('.nectar-woo-carousel-top').append(flickityPrv).append(flickityNxt);
2806				  });
2807				}
2808				
2809				$wooFlickityCarousels[i].flickity({
2810					 draggable: true,
2811					 lazyLoad: false,
2812					 imagesLoaded: true,
2813					 cellAlign: 'left',
2814					 groupCells: pageDotsBool,
2815					 prevNextButtons: arrowsBool,
2816					 pageDots: pageDotsBool,
2817					 resize: true,
2818					 percentPosition: true,
2819					 setGallerySize: true,
2820					 wrapAround: true,
2821					 autoPlay: $autoplay,
2822					 accessibility: false
2823				 });
2824				 
2825				 
2826				 //mobile pagination numbers
2827				 if(arrowsBool == true) {
2828					 
2829					 	$that.find('.flickity-prev-next-button').append('<svg width="65px" height="65px" viewBox="0 0 72 72" xmlns="http://www.w3.org/2000/svg"><circle stroke-width="3" fill="none" stroke-linecap="round" cx="33" cy="33" r="28"></circle> <circle class="time" stroke-width="3" fill="none" stroke-linecap="round" cx="33" cy="33" r="28"></circle></svg>');
2830					 
2831						var $wooFlickityCount = $('<div class="woo-flickity-count" />');
2832						$that.append($wooFlickityCount);
2833						var $wooFlickityData = $wooFlickityCarousels[i].data('flickity');
2834						
2835						function updateWooFlickityCount() {
2836						  var slideNumber = $wooFlickityData.selectedIndex + 1;
2837						  $wooFlickityCount.text( slideNumber + '/' + $wooFlickityData.slides.length );
2838						}
2839						updateWooFlickityCount();
2840						$wooFlickityCarousels[i].on( 'select.flickity', updateWooFlickityCount );
2841				 }
2842				 
2843
2844				
2845			});
2846			
2847			
2848    }
2849		
2850    if($('.products-carousel').length > 0 || $('.nectar-woo-flickity').length > 0) { productCarouselInit(); }
2851
2852
2853
2854
2855    
2856    //fullwidth carousel swipe link fix
2857    function fwCarouselLinkFix() {
2858	    var $mousePosStart = 0;
2859	    var $mousePosEnd = 0;
2860	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').mousedown(function(e){
2861	    	$mousePosStart = e.clientX;
2862	    });
2863	    
2864	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').mouseup(function(e){
2865	    	$mousePosEnd = e.clientX;
2866	    });
2867	    
2868	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').click(function(e){
2869	    	if(Math.abs($mousePosStart - $mousePosEnd) > 10)  return false;
2870	    });
2871	}
2872	fwCarouselLinkFix();
2873    
2874     
2875	function carouselHeightCalcs(){
2876		
2877		//recent work carousel
2878		$('.carousel.portfolio-items.finished-loading').each(function(){
2879
2880			var bottomSpace = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true' && $(this).find('.style-2, .style-3, .style-4').length > 0) ? 0 : 28 ;
2881			
2882			var tallestMeta = 0;
2883			
2884			$(this).find('> li').each(function(){
2885				($(this).find('.work-meta').height() > tallestMeta) ? tallestMeta = $(this).find('.work-meta').height() : tallestMeta = tallestMeta;
2886			});	
2887    	 
2888     		$(this).parents('.caroufredsel_wrapper').css({
2889     			'height' : ($(this).find('.work-item').outerHeight() + tallestMeta + bottomSpace -2) + 'px'
2890     		});
2891
2892     		 if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
2893        	 	$(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition")+1)/$(this).triggerHandler("currentVisible").length));
2894        	 	$(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length));
2895        	 }	
2896   	  	});
2897   	  	
2898   	  	//standard carousel
2899   	  	$('.carousel.finished-loading:not(".portfolio-items, .clients"), .caroufredsel_wrapper .products.finished-loading').each(function(){
2900			
2901			var tallestColumn = 0;
2902			
2903			$(this).find('> li').each(function(){
2904				($(this).height() > tallestColumn) ? tallestColumn = $(this).height() : tallestColumn = tallestColumn;
2905			});	
2906
2907         	$(this).css('height',tallestColumn + 5);
2908         	$(this).parents('.caroufredsel_wrapper').css('height',tallestColumn + 5);
2909
2910         	 if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
2911        	 	$(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition")+1)/$(this).triggerHandler("currentVisible").length));
2912        	 	$(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length));
2913        	 }	
2914			
2915   	  	});
2916   	  	
2917	}
2918
2919
2920	function clientsCarouselInit(){
2921	     $('.carousel.clients').each(function(){
2922	    	var $that = $(this);
2923	    	var columns; 
2924	    	var $autoRotate = (!$(this).hasClass('disable-autorotate')) ? true : false;
2925	    	(parseInt($(this).attr('data-max'))) ? columns = parseInt($(this).attr('data-max')) : columns = 5;
2926	    	if($(window).width() < 690 && $('body').attr('data-responsive') == '1') { columns = 2; $(this).addClass('phone') }
2927	    	
2928	    	var $element = $that;
2929			if($that.find('img').length == 0) $element = $('body');
2930			
2931			imagesLoaded($element,function(instance){
2932	    		
2933		    	$that.carouFredSel({
2934			    		circular: true,
2935			    		responsive: true, 
2936				        items       : {
2937							
2938							height : $that.find('> div:first').height(),
2939							width  : $that.find('> div:first').width(),
2940					        visible     : {
2941					            min         : 1,
2942					            max         : columns
2943					        }
2944					    },
2945					    swipe       : {
2946					        onTouch     : true,
2947					        onMouse         : true
2948					    },
2949					    scroll: {
2950					    	items           : 1,
2951					    	easing          : 'easeInOutCubic',
2952				            duration        : '800',
2953				            pauseOnHover    : true
2954					    },
2955					    auto    : {
2956					    	play            : $autoRotate,
2957					    	timeoutDuration : 2700
2958					    }
2959			    }).animate({'opacity': 1},1300);
2960			    
2961			    $that.addClass('finished-loading');
2962
2963			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
2964			     
2965
2966			    $(window).trigger('resize');
2967			    
2968		    
2969		    });
2970	
2971	    });
2972    }
2973   if($('.carousel').length > 0)  clientsCarouselInit();
2974    
2975
2976    function clientsCarouselHeightRecalc(){
2977
2978    	var tallestImage = 0;
2979		  			
2980    	 $('.carousel.clients.finished-loading').each(function(){
2981    	 	
2982    	 	$(this).find('> div').each(function(){
2983				($(this).height() > tallestImage) ? tallestImage = $(this).height() : tallestImage = tallestImage;
2984			});	
2985    	 	
2986         	$(this).css('height',tallestImage);
2987         	$(this).parent().css('height',tallestImage);
2988         });
2989    }
2990
2991
2992    //carousel grabbing class
2993    function carouselfGrabbingClass() {
2994	    $('body').on('mousedown','.caroufredsel_wrapper, .carousel-wrap[data-full-width="true"] .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a',function(){
2995	    	$(this).addClass('active');
2996	    });
2997	    
2998	    $('body').on('mouseup','.caroufredsel_wrapper, .carousel-wrap[data-full-width="true"] .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a',function(){
2999	    	$(this).removeClass('active');
3000	    });
3001	}
3002	carouselfGrabbingClass();
3003	    
3004
3005	//ascend arrow hover class
3006	$('body.ascend, body.material').on('mouseover','.carousel-next',function(){
3007		$(this).parent().find('.carousel-prev, .item-count').addClass('next-hovered');
3008	});
3009	$('body.ascend, body.material').on('mouseleave','.carousel-next',function(){
3010		$(this).parent().find('.carousel-prev, .item-count').removeClass('next-hovered');
3011	});
3012
3013	//fadein for clients / carousels
3014	function clientsFadeIn() {
3015
3016		var $clientsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? 100: 'bottom-in-view';
3017		$($fullscreenSelector+'.clients.fade-in-animation').each(function() {
3018
3019			var $that = $(this);
3020			var waypoint = new Waypoint({
3021 			element: $that,
3022 			 handler: function(direction) {
3023				
3024				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
3025					 waypoint.destroy();
3026					return;
3027				}
3028
3029				 $that.find('> div').each(function(i){
3030					$(this).delay(i*80).transition({'opacity':"1"},450);
3031				});
3032				
3033				
3034				//add the css transition class back in after the aniamtion is done
3035				setTimeout(function(){ $that.addClass('completed'); },($that.find('> div').length*80) + 450);
3036			
3037
3038				$that.addClass('animated-in');
3039				waypoint.destroy();
3040			},
3041			offset: $clientsOffsetPos
3042
3043			}); 
3044		}); 
3045	}
3046	 
3047	//if($('.nectar-box-roll').length == 0) clientsFadeIn();
3048	
3049	
3050/*-------------------------------------------------------------------------*/
3051/*	2.	Helper Functions
3052/*-------------------------------------------------------------------------*/
3053
3054	jQuery.fn.setCursorPosition = function(position){
3055		
3056	    if(this.length == 0) { 
3057				return this; 
3058			}
3059	    return $(this).setSelection(position, position);
3060	}
3061	
3062	jQuery.fn.setSelection = function(selectionStart, selectionEnd) {
3063	    if(this.length == 0) { 
3064				return this;
3065			}
3066	    input = this[0];
3067	
3068	    if (input.createTextRange) {
3069	        var range = input.createTextRange();
3070	        range.collapse(true);
3071	        range.moveEnd('character', selectionEnd);
3072	        range.moveStart('character', selectionStart);
3073	        range.select();
3074	    } else if (input.setSelectionRange) {
3075	        input.focus();
3076	        input.setSelectionRange(selectionStart, selectionEnd);
3077	    }
3078	
3079	    return this;
3080	}
3081	
3082	
3083
3084	$.extend($.expr[':'], {
3085	    transparent: function(elem, i, attr){
3086	      return( $(elem).css("opacity") === "0" );
3087	    }
3088	});
3089	
3090
3091	function getQueryParams(qs) {
3092	    qs = qs.split("+").join(" ");
3093	    var params = {},
3094	        tokens,
3095	        re = /[?&]?([^=]+)=([^&]*)/g;
3096
3097	    while (tokens = re.exec(qs)) {
3098	        params[decodeURIComponent(tokens[1])]
3099	            = decodeURIComponent(tokens[2]);
3100	    }
3101
3102	    return params;
3103	}
3104
3105	var $_GET = getQueryParams(document.location.search);
3106
3107	
3108	//count
3109	var CountUp = function(target, startVal, endVal, decimals, duration, options) {
3110
3111    // make sure requestAnimationFrame and cancelAnimationFrame are defined
3112    // polyfill for browsers without native support
3113    // by Opera engineer Erik Möller
3114    var lastTime = 0;
3115    var vendors = ['webkit', 'moz', 'ms', 'o'];
3116    for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
3117        window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
3118        window.cancelAnimationFrame =
3119          window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
3120    }
3121    if (!window.requestAnimationFrame) {
3122        window.requestAnimationFrame = function(callback, element) {
3123            var currTime = new Date().getTime();
3124            var timeToCall = Math.max(0, 16 - (currTime - lastTime));
3125            var id = window.setTimeout(function() { callback(currTime + timeToCall); },
3126              timeToCall);
3127            lastTime = currTime + timeToCall;
3128            return id;
3129        };
3130    }
3131    if (!window.cancelAnimationFrame) {
3132        window.cancelAnimationFrame = function(id) {
3133            clearTimeout(id);
3134        };
3135    }
3136
3137    var self = this;
3138
3139     // default options
3140    self.options = {
3141        useEasing : true, // toggle easing
3142        useGrouping : true, // 1,000,000 vs 1000000
3143        separator : ',', // character to use as a separator
3144        decimal : '.', // character to use as a decimal
3145        easingFn: null, // optional custom easing closure function, default is Robert Penner's easeOutExpo
vendor: 5,312 bytes, lines 3146-3290
3146        formattingFn: null // optional custom formatting function, default is self.formatNumber below
3147    };
3148    // extend default options with passed options object
3149    for (var key in options) {
3150        if (options.hasOwnProperty(key)) {
3151            self.options[key] = options[key];
3152        }
3153    }
3154    if (self.options.separator === '') { self.options.useGrouping = false; }
3155    if (!self.options.prefix) self.options.prefix = '';
3156    if (!self.options.suffix) self.options.suffix = '';
3157
3158    self.d = (typeof target === 'string') ? document.getElementById(target) : target;
3159    self.startVal = Number(startVal);
3160    self.endVal = Number(endVal);
3161    self.countDown = (self.startVal > self.endVal);
3162    self.frameVal = self.startVal;
3163    self.decimals = Math.max(0, decimals || 0);
3164    self.dec = Math.pow(10, self.decimals);
3165    self.duration = Number(duration) * 1000 || 2000;
3166
3167    self.formatNumber = function(nStr) {
3168        nStr = nStr.toFixed(self.decimals);
3169        nStr += '';
3170        var x, x1, x2, rgx;
3171        x = nStr.split('.');
3172        x1 = x[0];
3173        x2 = x.length > 1 ? self.options.decimal + x[1] : '';
3174        rgx = /(\d+)(\d{3})/;
3175        if (self.options.useGrouping) {
3176            while (rgx.test(x1)) {
3177                x1 = x1.replace(rgx, '$1' + self.options.separator + '$2');
3178            }
3179        }
3180        return self.options.prefix + x1 + x2 + self.options.suffix;
3181    };
3182    // Robert Penner's easeOutExpo
3183    self.easeOutExpo = function(t, b, c, d) {
3184        return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b;
3185    };
3186
3187    self.easingFn = self.options.easingFn ? self.options.easingFn : self.easeOutExpo;
3188    self.formattingFn = self.options.formattingFn ? self.options.formattingFn : self.formatNumber;
3189
3190    self.version = function () { return '1.7.1'; };
3191
3192    // Print value to target
3193    self.printValue = function(value) {
3194        var result = self.formattingFn(value);
3195
3196        if (self.d.tagName === 'INPUT') {
3197            this.d.value = result;
3198        }
3199        else if (self.d.tagName === 'text' || self.d.tagName === 'tspan') {
3200            this.d.textContent = result;
3201        }
3202        else {
3203            this.d.innerHTML = result;
3204        }
3205    };
3206
3207    self.count = function(timestamp) {
3208
3209        if (!self.startTime) { self.startTime = timestamp; }
3210
3211        self.timestamp = timestamp;
3212        var progress = timestamp - self.startTime;
3213        self.remaining = self.duration - progress;
3214
3215        // to ease or not to ease
3216        if (self.options.useEasing) {
3217            if (self.countDown) {
3218                self.frameVal = self.startVal - self.easingFn(progress, 0, self.startVal - self.endVal, self.duration);
3219            } else {
3220                self.frameVal = self.easingFn(progress, self.startVal, self.endVal - self.startVal, self.duration);
3221            }
3222        } else {
3223            if (self.countDown) {
3224                self.frameVal = self.startVal - ((self.startVal - self.endVal) * (progress / self.duration));
3225            } else {
3226                self.frameVal = self.startVal + (self.endVal - self.startVal) * (progress / self.duration);
3227            }
3228        }
3229
3230        // don't go past endVal since progress can exceed duration in the last frame
3231        if (self.countDown) {
3232            self.frameVal = (self.frameVal < self.endVal) ? self.endVal : self.frameVal;
3233        } else {
3234            self.frameVal = (self.frameVal > self.endVal) ? self.endVal : self.frameVal;
3235        }
3236
3237        // decimal
3238        self.frameVal = Math.round(self.frameVal*self.dec)/self.dec;
3239
3240        // format and print value
3241        self.printValue(self.frameVal);
3242
3243        // whether to continue
3244        if (progress < self.duration) {
3245            self.rAF = requestAnimationFrame(self.count);
3246        } else {
3247            if (self.callback) { self.callback(); }
3248        }
3249    };
3250    // start your animation
3251    self.start = function(callback) {
3252        self.callback = callback;
3253        self.rAF = requestAnimationFrame(self.count);
3254        return false;
3255    };
3256    // toggles pause/resume animation
3257    self.pauseResume = function() {
3258        if (!self.paused) {
3259            self.paused = true;
3260            cancelAnimationFrame(self.rAF);
3261        } else {
3262            self.paused = false;
3263            delete self.startTime;
3264            self.duration = self.remaining;
3265            self.startVal = self.frameVal;
3266            requestAnimationFrame(self.count);
3267        }
3268    };
3269    // reset to startVal so animation can be run again
3270    self.reset = function() {
3271        self.paused = false;
3272        delete self.startTime;
3273        self.startVal = startVal;
3274        cancelAnimationFrame(self.rAF);
3275        self.printValue(self.startVal);
3276    };
3277    // pass a new endVal and start animation
3278    self.update = function (newEndVal) {
3279        cancelAnimationFrame(self.rAF);
3280        self.paused = false;
3281        delete self.startTime;
3282        self.startVal = self.frameVal;
3283        self.endVal = Number(newEndVal);
3284        self.countDown = (self.startVal > self.endVal);
3285        self.rAF = requestAnimationFrame(self.count);
3286    };
3287
3288    // format startVal on initialization
3289    self.printValue(self.startVal);
3290};
3291	
3292var easeOutCubic = function(t, b, c, d) {
3293    return c*((t=t/d-1)*t*t + 1) + b;
3294};	
3295	
3296	
3297/*-------------------------------------------------------------------------*/
3298/*	3.	Shortcode Stuff
3299/*-------------------------------------------------------------------------*/
3300
3301
3302function vcWaypoints() {
3303	$($fullscreenSelector+' .wpb_animate_when_almost_visible').each(function() {
3304		  
3305			var $vcOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%';
3306
3307			var $that = $(this);
3308			var waypoint = new Waypoint({
3309	 			element: $that,
3310	 			 handler: function(direction) {
3311
3312	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 
3313					     waypoint.destroy();
3314					     return;
3315					}
3316	 				$that.addClass("animated");
3317	 				$that.addClass("wpb_start_animation");
3318	 				waypoint.destroy();
3319					
3320					if($that.is('.nectar-button') && $('body[data-button-style*="rounded_shadow"]').length > 0) {
3321						setTimeout(function(){
3322							$that.removeClass('wpb_start_animation');
3323						},1100);
3324					}
3325				
3326				},
3327				offset: $vcOffsetPos
3328
3329			}); 
3330
3331	});
3332}
3333			 
3334
3335/***************** Milestone Counter ******************/
3336	
3337	function milestoneInit() {
3338
3339		$('.nectar-milestone').each(function() {
3340			
3341			//symbol
3342			if($(this).is('[data-symbol]')) {
3343				if($(this).find('.symbol-wrap').length == 0) {
3344					if($(this).attr('data-symbol-pos') == 'before') {
3345						$(this).find('.number').prepend('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>');
3346					} else {
3347						$(this).find('.number').append('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>');
3348					}
3349				}
3350
3351				var $symbol_size = (  $(this).attr('data-symbol-size') == $(this).find('.number').attr('data-number-size') && $(this).attr('data-symbol-alignment') == 'superscript' ) ? 32 :  parseInt($(this).attr('data-symbol-size'));
3352			
3353				$(this).find('.symbol-wrap').css({'font-size': $symbol_size + 'px', 'line-height': $symbol_size + 'px'});
3354			}
3355
3356			$(this).find('.number').css({'font-size': $(this).find('.number').attr('data-number-size') +'px', 'line-height': $(this).find('.number').attr('data-number-size') + 'px'});
3357		});
3358		
3359		if(!$('body').hasClass('mobile') && $('.nectar-milestone').length > 0) {
3360			
3361
3362			//blur effect
3363			var $blurCssString = '';
3364			$($fullscreenSelector+'.nectar-milestone.motion_blur').each(function(i){
3365				
3366				$(this).removeClass(function (index, className) {
3367				    return (className.match (/(^|\s)instance-\S+/g) || []).join(' ');
3368				});	
3369					
3370				$(this).addClass('instance-'+i);
3371
3372				var $currentColor = $(this).find('.number').css('color');
3373				var colorInt = parseInt($currentColor.substring(1),16);
3374		   		var R = (colorInt & 0xFF0000) >> 16;
3375		    	var G = (colorInt & 0x00FF00) >> 8;
3376		   		var B = (colorInt & 0x0000FF) >> 0;
3377		   		
3378		   		var $rgbaColorStart = 'rgba('+R+','+G+','+B+',0.2)';
3379				var $rgbaColorEnd = 'rgba('+R+','+G+','+B+',1)';
3380				var $numberSize = parseInt($(this).find('.number').attr('data-number-size'));
3381
3382				$blurCssString += '@keyframes motion-blur-number-'+i+' { ' +
3383				   ' 0% { '+
3384				   		'opacity: 0;'+
3385						'color: '+$rgbaColorStart+'; '+
3386   						'text-shadow: 0 '+$numberSize/20+'px 0 '+$rgbaColorStart+', 0 '+$numberSize/10+'px 0 '+$rgbaColorStart+', 0 '+$numberSize/6+'px 0 '+$rgbaColorStart+', 0 '+$numberSize/5+'px 0 '+$rgbaColorStart+', 0 '+$numberSize/4+'px 0 '+$rgbaColorStart+', 0 -'+$numberSize/20+'px 0 '+$rgbaColorStart+', 0 -'+$numberSize/10+'px 0 '+$rgbaColorStart+', 0 -'+$numberSize/6+'px 0 '+$rgbaColorStart+', 0 -'+$numberSize/5+'px 0 '+$rgbaColorStart+', 0 -'+$numberSize/4+'px 0 '+$rgbaColorStart+'; '+
3387    					'transform: translateZ(0px) translateY(-100%); '+
3388    					'-webkit-transform: translateZ(0px) translateY(-100%); '+
3389    				'} '+
3390    				'33% { opacity: 1 }' +
3391    				'100% { '+
3392						'color: '+$rgbaColorEnd+'; '+
3393   						'text-shadow: none; '+
3394    					'transform: translateZ(0px) translateY(0px); '+
3395    					'-webkit-transform: translateZ(0px) translateY(0px); '+
3396    				'} '+
3397    			'} '+
3398    			'@-webkit-keyframes motion-blur-number-'+i+' { ' +
3399				   ' 0% { '+
3400				  	    'opacity: 0;'+
3401						'color: '+$rgbaColorStart+'; '+
3402   						'text-shadow: 0 '+$numberSize/20+'px 0 '+$rgbaColorStart+', 0 '+$numberSize/10+'px 0 '+$rgbaColorStart+', 0 '+$numberSize/6+'px 0 '+$rgbaColorStart+', 0 '+$numberSize/5+'px 0 '+$rgbaColorStart+', 0 '+$numberSize/4+'px 0 '+$rgbaColorStart+', 0 -'+$numberSize/20+'px 0 '+$rgbaColorStart+', 0 -'+$numberSize/10+'px 0 '+$rgbaColorStart+', 0 -'+$numberSize/6+'px 0 '+$rgbaColorStart+', 0 -'+$numberSize/5+'px 0 '+$rgbaColorStart+', 0 -'+$numberSize/4+'px 0 '+$rgbaColorStart+'; '+
3403    					'transform: translateZ(0px) translateY(-100%); '+
3404    					'-webkit-transform: translateZ(0px) translateY(-100%); '+
3405    				'} '+
3406    				'33% { opacity: 1 }' +
3407    				'100% { '+
3408						'color: '+$rgbaColorEnd+'; '+
3409   						'text-shadow: none; '+
3410    					'transform: translateZ(0px) translateY(0px); '+
3411    					'-webkit-transform: translateZ(0px) translateY(0px); '+
3412    				'} '+
3413    			'} '+
3414    			'.nectar-milestone.motion_blur.instance-'+i+' .number span.in-sight { animation: 0.65s cubic-bezier(0, 0, 0.17, 1) 0s normal backwards 1 motion-blur-number-'+i+'; -webkit-animation: 0.65s cubic-bezier(0, 0, 0.17, 1) 0s normal backwards 1 motion-blur-number-'+i+'; } ';
3415    			
3416    			//separate each character into spans
3417    			$symbol = $(this).find('.symbol-wrap').clone();
3418    			$(this).find('.symbol-wrap').remove();
3419    			var characters = $(this).find('.number').text().split("");
3420    			$this = $(this).find('.number');
3421				$this.empty();
3422    			$.each(characters, function (i, el) {
3423				    $this.append("<span>" + el + "</span");
3424				});
3425
3426				//handle symbol
3427				if($(this).has('[data-symbol]')) {
3428	    			if($(this).attr('data-symbol-pos') == 'after') {
3429	    				$this.append($symbol);
3430	    			} else {
3431	    				$this.prepend($symbol);
3432	    			}
3433	    		}
3434				
3435			});
3436
3437			var head = document.head || document.getElementsByTagName('head')[0];
3438				var style = document.createElement('style');
3439
3440				style.type = 'text/css';
3441			if (style.styleSheet){
3442			  style.styleSheet.cssText = $blurCssString;
3443			} else {
3444			  style.appendChild(document.createTextNode($blurCssString));
3445			}
3446			$(style).attr('id','milestone-blur');
3447			$('head #milestone-blur').remove();
3448			head.appendChild(style);
3449
3450
3451			//activate
3452			milestoneWaypoint();
3453
3454		}
3455
3456	}
3457
3458	function milestoneWaypoint() {
3459		$($fullscreenSelector+'.nectar-milestone').each(function() {
3460			//animation
3461			
3462			var $offset = ($('#nectar_fullscreen_rows').length > 0) ? '250%' : '98%';
3463
3464			var $that = $(this);
3465			var waypoint = new Waypoint({
3466	 			element: $that,
3467	 			 handler: function(direction) {
3468
3469	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
3470					     waypoint.destroy();
3471					     return;
3472					}
3473
3474	 			 	var $endNum = parseInt($that.find('.number span:not(.symbol)').text().replace(/,/g , ''));
3475
3476					if(!$that.hasClass('motion_blur')) {
3477
3478						var countOptions = { easingFn: easeOutCubic };
3479						var $countEle = $that.find('.number span:not(.symbol)')[0];
3480						var numAnim = new CountUp($countEle, 0, $endNum,0,2.2,countOptions);
3481						numAnim.start();
3482
3483					} else {
3484						$that.find('span').each(function(i){
3485							var $that = $(this);
3486							setTimeout(function(){ $that.addClass('in-sight'); },200*i);
3487						});
3488					}
3489
3490
3491					$that.addClass('animated-in');
3492					waypoint.destroy();
3493				},
3494				offset: $offset
3495
3496			}); 
3497
3498		}); 
3499	}
3500
3501	var $animationOnScrollTimeOut = ($('.nectar-box-roll').length > 0) ? 850: 125;	
3502
3503	
3504/***************** Tabbed ******************/
3505	
3506	var $tabbedClickCount = 0;
3507	$('body').on('click','.tabbed > ul li:not(.cta-button) a',function(){
3508		var $id = $(this).parents('li').index()+1;
3509		
3510		var $frontEndEditorTabDiv =  ($('body.vc_editor').length > 0) ? '> .wpb_tab ': '';
3511		
3512		if(!$(this).hasClass('active-tab') && !$(this).hasClass('loading')){
3513			$(this).parents('ul').find('a').removeClass('active-tab');
3514			$(this).addClass('active-tab');
3515			
3516			$(this).parents('.tabbed').find('> div:not(.clear)' + $frontEndEditorTabDiv).css({'visibility':'hidden','position':'absolute','opacity':'0','left':'-9999px'});
3517			
3518			if($('body.vc_editor').length > 0) {
3519				//front end editor locate tab by modal id
3520				var $data_m_id = ($(this).parent().is('[data-m-id]')) ? $(this).parent().attr('data-m-id') : '';
3521				$(this).parents('.tabbed').find('> div[data-model-id="'+$data_m_id+'"]' + $frontEndEditorTabDiv).css({'visibility':'visible', 'position' : 'relative','left':'0','display':'block'}).stop().transition({'opacity':1},400);
3522				//update padding
3523				convertFrontEndPadding();
3524				
3525			} else {
3526				$(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).css({'visibility':'visible', 'position' : 'relative','left':'0','display':'block'}).stop().transition({'opacity':1},400);
3527			}
3528			
3529			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+') .iframe-embed').length > 0 || $(this).parents('.tabbed').find('> div:nth-of-type('+$id+') .portfolio-items').length > 0) setTimeout(function(){ $(window).resize(); },10); 
3530		}
3531		
3532		//waypoint checking
3533		if($tabbedClickCount != 0) {
3534			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.nectar-progress-bar').length > 0 ) 
3535				progressBars();
3536			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.divider-small-border [data-animate="yes"]').length > 0 || $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.divider-border [data-animate="yes"]').length > 0 ) 
3537				dividers();
3538			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('img.img-with-animation').length > 0 ||
3539			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.col.has-animation').length > 0  || 
3540			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.nectar_cascading_images').length > 0  || 
3541			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.wpb_column.has-animation').length > 0 ) {
3542				colAndImgAnimations();
3543				cascadingImageBGSizing();
3544			}
3545			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.column-image-bg-wrap[data-bg-animation="displace-filter-fade"]').length > 0){
3546				for(var k=0; k<$liquidBG_EL.length;k++) {
3547					if($($liquidBG_EL[k].canvasContainer).parents('.wpb_tab').length > 0 && $($liquidBG_EL[k].canvasContainer).parents('.wpb_tab').css('visibility') != 'hidden') {
3548						
3549						//add bg to container
3550						if($($liquidBG_EL[k].canvasContainer).find('.image-added-to-stage').length == 0) {
3551							$liquidBG_EL[k].imgContainer.addChild( $liquidBG_EL[k].bg );
3552						}
3553						$($liquidBG_EL[k].canvasContainer).find('.nectar-liquid-bg').addClass('image-added-to-stage');
3554						
3555						//resize calcs
3556						$liquidBG_EL[k].resize();
3557						
3558						//animate
3559						if($($liquidBG_EL[k].canvasContainer).find('.nectar-liquid-bg.animated-in').length == 0) {
3560							$liquidBG_EL[k].animateProps($liquidBG_EL[k]);
3561						}
3562			
3563					}
3564				}
3565			}
3566			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.nectar-milestone').length > 0 ) 
3567				milestoneWaypoint();
3568			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.nectar_image_with_hotspots[data-animation="true"]').length > 0 ) 
3569				imageWithHotspots();
3570			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.nectar-fancy-ul').length > 0 ) 
3571				nectar_fancy_ul_init();
3572			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.nectar-split-heading').length > 0 ) 
3573				splitLineHeadings();
3574			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.wpb_column[data-border-animation="true"]').length > 0) {
3575				animatedColBorders();
3576			}
3577			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.wpb_animate_when_almost_visible').length > 0) {
3578				vcWaypoints();
3579			}
3580			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.nectar-animated-title').length > 0) {
3581				animated_titles();
3582			}
3583			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.nectar-highlighted-text').length > 0) {
3584				highlighted_text();
3585			}
3586			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.nectar_food_menu_item').length > 0) {
3587				foodMenuItems();
3588			}
3589			if($(this).parents('.wpb_row').length > 0) {
3590				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.vc_pie_chart').length > 0  ||
3591				   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.wp-video-shortcode').length > 0 ||
3592					 $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.post-area.masonry .posts-container').length > 0 ||
3593				   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.twentytwenty-container').length > 0 ||
3594					 $(this).parents('#nectar_fullscreen_rows[data-content-overflow="scrollbar"]').length > 0 ||
3595					 $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wpb_gallery').length > 0 ||
3596				   $(this).parents('.wpb_row').next().hasClass('parallax_section'))
3597					$(window).trigger('resize');
3598					
3599					
3600				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.nectar-flickity').length > 0 && typeof Flickity != 'undefined' ) {
3601					var tabbedFlkty = Flickity.data( $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-flickity')[0] );
3602					tabbedFlkty.resize();
3603				}
3604				
3605				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.nectar-woo-flickity').length > 0 && typeof Flickity != 'undefined' ) {
3606					var wootabbedFlkty = Flickity.data( $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-woo-flickity > ul')[0] );
3607					wootabbedFlkty.resize();
3608				}
3609				
3610			}
3611
3612			//svg icons
3613		
3614			$(this).parents('.tabbed').find('> div:nth-of-type('+$id+')' + $frontEndEditorTabDiv).find('.svg-icon-holder').each(function(i){
3615				var $that = $(this);
3616
3617				setTimeout(function(){
3618
3619					var $animationDelay = ($(this).is('[data-animation-delay]') && $(this).attr('data-animation-delay').length > 0 && $(this).attr('data-animation') != 'false') ? $(this).attr('data-animation-delay') : 0;
3620
3621					clearTimeout($animatedSVGIconTimeout[i]);
3622
3623					if($that.attr('data-animation') == 'false') { 
3624						$animationSpeed = 1;
3625						$that.css('opacity','1');
3626						$svg_icons[$that.find('svg').attr('id').slice(-1)].finish();
3627					} else {
3628						
3629						$svg_icons[$that.find('svg').attr('id').slice(-1)].reset();
3630						$animatedSVGIconTimeout[i] = setTimeout(function(){ $svg_icons[$that.find('svg').attr('id').slice(-1)].play(); },$animationDelay);
3631						
3632					}
3633				},150);
3634			});
3635
3636		}
3637
3638		//fix columns inside tabs
3639		$(this).parents('.tabbed').find('.wpb_row').each(function(){
3640			if( typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') {
3641				
3642				var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left;
3643				$(this).find('[class*="vc_col-"]').each(function(){
3644					$(this).removeClass('no-left-margin');
3645					if($(this).offset().left < $firstChildOffset + 15) { 
3646						$(this).addClass('no-left-margin');
3647					} else {
3648						$(this).removeClass('no-left-margin');
3649					}
3650				});
3651			}
3652		});
3653
3654		$tabbedClickCount++;
3655
3656		//magic line
3657		if($(this).parent().parent().find('.magic-line').length > 0) {
3658			magicLineCalc($(this));
3659	     }
3660
3661		return false;
3662	});
3663
3664
3665	function magicLineCalc($ele) {
3666		var el, leftPos, ratio;
3667	    el = $ele.parent();
3668	    if (el.length) {
3669	        leftPos = el.position().left;
3670	        ratio = el.width();
3671	    } else {
3672	        leftPos = ratio = 0;
3673	    }
3674
3675	    $ele.parent().parent().find('.magic-line').css('transform', 'translateX(' + leftPos + 'px) scaleX(' + ratio + ')');
3676	}
3677	
3678	
3679	function tabbedInit(){ 
3680		$('.tabbed').each(function(){
3681			
3682			//handle icons
3683			$(this).find('.wpb_tab').each(function(i){
3684				
3685				if($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) {
3686					$(this).parents('.tabbed').addClass('using-icons');
3687					$(this).parents('.tabbed').find('.wpb_tabs_nav li:nth-child('+ (i+1) +') > a').prepend('<i class="'+$(this).attr("data-tab-icon")+'"></i>');
3688				}
3689			});
3690			
3691			//make sure the tabs don't have a nectar slider - we'll init this after the sliders load in that case
3692			if($(this).find('.swiper-container').length == 0 && $(this).find('.testimonial_slider').length == 0 && $(this).find('.portfolio-items:not(".carousel")').length == 0 && $(this).find('.wpb_gallery .portfolio-items').length == 0 && $(this).find('iframe').length == 0){
3693				$(this).find('> ul li:first-child a').click();
3694			}	
3695			if($(this).find('.testimonial_slider').length > 0 || $(this).find('.portfolio-items:not(".carousel")').length > 0 || $(this).find('.wpb_gallery .portfolio-items').length > 0 || $(this).find('iframe').length > 0 ){
3696				var $that = $(this);
3697				
3698				$(this).find('.wpb_tab').show().css({'opacity':0,'height':'1px'});
3699				$(this).find('> ul li a').addClass('loading');
3700				
3701				setTimeout(function(){ 
3702					$that.find('.wpb_tab').hide().css({'opacity':1,'height':'auto'}); 
3703					$that.find('> ul li a').removeClass('loading');
3704					$that.find('> ul li:first-child a').click(); 
3705				},900);
3706			}
3707
3708			var $that = $(this);
3709			//minimal alt effect
3710			setTimeout(function(){
3711				if($that.is('[data-style="minimal_alt"]')) {
3712					$that.find('> ul').append('<li class="magic-line" />');
3713					 magicLineCalc($that.find('> ul > li:first-child > a'));
3714				}
3715			},100);
3716
3717
3718		});
3719	}
3720	setTimeout(tabbedInit,60);
3721
3722	//deep linking
3723	function tabbbedDeepLinking(){
3724		if(typeof $_GET['tab'] != 'undefined'){
3725			$('.wpb_tabs_nav').each(function(){
3726
3727				$(this).find('li').each(function(){
3728					var $currentText = $(this).find('a').text();
3729					var $getText = $_GET['tab'];
3730					var $that = $(this);
3731
3732					$currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
3733					$getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
3734
3735					if($currentText == $getText)  { 
3736
3737			          $(this).find('a').click(); 
3738			           setTimeout(function(){ 
3739			              $that.find('a').click(); 
3740			           },901);
3741			        }
3742				})
3743			});
3744		}
3745	}
3746	tabbbedDeepLinking();
3747
3748/***************** Toggle ******************/
3749	
3750	//toggles
3751	$('body').on('click','.toggle h3 a', function(){
3752	
3753		if(!$(this).parents('.toggles').hasClass('accordion')) { 
3754			$(this).parents('.toggle').find('> div').slideToggle(300);
3755			$(this).parents('.toggle').toggleClass('open');
3756			
3757			//switch icon
3758			if( $(this).parents('.toggle').hasClass('open') ){
3759				$(this).find('i').attr('class','icon-minus-sign');
3760			} else {
3761				$(this).find('i').attr('class','icon-plus-sign');
3762			}
3763
3764			if($(this).parents('.toggle').find('> div .iframe-embed').length > 0 && $(this).parents('.toggle').find('> div iframe.iframe-embed').height() == '0') responsiveVideoIframes();
3765			if($(this).parents('.full-width-content').length > 0) setTimeout(function(){ fullWidthContentColumns(); },300);
3766			if($('#nectar_fullscreen_rows').length > 0) setTimeout(function(){ $(window).trigger('smartresize'); },300);
3767			return false;
3768		}
3769	});
3770	
3771	//accordion
3772	$('body').on('click','.accordion .toggle h3 a', function(){
3773		
3774		if($(this).parents('.toggle').hasClass('open')) return false;
3775		
3776		$(this).parents('.toggles').find('.toggle > div').slideUp(300);
3777		$(this).parents('.toggles').find('.toggle h3 a i').attr('class','icon-plus-sign');
3778		$(this).parents('.toggles').find('.toggle').removeClass('open');
3779		
3780		$(this).parents('.toggle').find('> div').slideDown(300);
3781		$(this).parents('.toggle').addClass('open');
3782		
3783		//switch icon
3784		if( $(this).parents('.toggle').hasClass('open') ){
3785			$(this).find('i').attr('class','icon-minus-sign');
3786		} else {
3787			$(this).find('i').attr('class','icon-plus-sign');
3788		}
3789
3790		if($(this).parents('.full-width-content').length > 0) { 
3791			clearTimeout($t);
3792			var $t = setTimeout(function(){ fullWidthContentColumns(); },400);
3793		}
3794		if($('#nectar_fullscreen_rows').length > 0) {
3795			clearTimeout($t);
3796			var $t = setTimeout(function(){ $(window).trigger('smartresize'); },400);
3797		}
3798		
3799		return false;
3800	});
3801	
3802	//accordion start open
3803	function accordionInit(){ 
3804		$('.accordion').each(function(){
3805			$(this).find('> .toggle').first().addClass('open').find('> div').show();
3806			$(this).find('> .toggle').first().find('a i').attr('class','icon-minus-sign');
3807		});
3808		
3809		
3810		$('.toggles').each(function(){
3811			
3812			var $isAccordion = ($(this).hasClass('accordion')) ? true : false;
3813			
3814			$(this).find('.toggle').each(function(){
3815				if($(this).find('> div .testimonial_slider').length > 0 || $(this).find('> div iframe').length > 0) {
3816					var $that = $(this);
3817					$(this).find('> div').show().css({'opacity':0,'height':'1px', 'padding':'0'});
3818					
3819					testimonialHeightResize();
3820					
3821					setTimeout(function(){
3822						$that.find('> div').hide().css({'opacity':1,'height':'auto', 'padding':'10px 14px'}); 
3823						if($isAccordion == true && $that.index() == 0) $that.find('> div').slideDown(300);
3824					},900);
3825				} 
3826			});
3827		})
3828	}
3829	accordionInit();
3830
3831	//deep linking
3832	function accordionDeepLinking(){
3833		if(typeof $_GET['toggle'] != 'undefined'){
3834			$('.toggles').each(function(){
3835
3836				$(this).find('.toggle').each(function(){
3837					var $currentText = $(this).find('h3 a').clone();
3838					var $getText = $_GET['toggle'];
3839
3840					$($currentText).find('i').remove();
3841					$currentText = $currentText.text();
3842					$currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
3843					$getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
3844
3845					if($currentText == $getText) $(this).find('h3 a').click();
3846				});
3847			});
3848		}
3849	}
3850	accordionDeepLinking();
3851
3852/***************** Button ******************/
3853	
3854	$.cssHooks.color = {
3855	    get: function(elem) {
3856	        if (elem.currentStyle)
3857	            var color = elem.currentStyle["color"];
3858	        else if (window.getComputedStyle)
3859	            var color = document.defaultView.getComputedStyle(elem,
3860	                null).getPropertyValue("color");
3861	        if (color.search("rgb") == -1)
3862	            return color;
3863	        else {
3864	            color = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
3865	            function hex(x) {
3866	                return ("0" + parseInt(x).toString(16)).slice(-2);
3867	            }
3868	            if(color) {
3869	            	return "#" + hex(color[1]) + hex(color[2]) + hex(color[3]);
3870	            }
3871	        }
3872	    }
3873	}
3874
3875	$.cssHooks.backgroundColor = {
3876	    get: function(elem) {
3877	        if (elem.currentStyle)
3878	            var bg = elem.currentStyle["backgroundColor"];
3879	        else if (window.getComputedStyle)
3880	            var bg = document.defaultView.getComputedStyle(elem,
3881	                null).getPropertyValue("background-color");
3882	        if (bg.search("rgb") == -1)
3883	            return bg;
3884	        else {
3885	            bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
3886	            function hex(x) {
3887	                return ("0" + parseInt(x).toString(16)).slice(-2);
3888	            }
3889	            if(bg) {
3890	            	return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]);
3891	            }
3892	        }
3893	    }
3894	}
3895	
3896	function shadeColor(hex, lum) {
3897
3898	  // validate hex string
3899		hex = String(hex).replace(/[^0-9a-f]/gi, '');
3900		if (hex.length < 6) {
3901			hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];
3902		}
3903		lum = lum || 0;
3904
3905		// convert to decimal and change luminosity
3906		var rgb = "#", c, i;
3907		for (i = 0; i < 3; i++) {
3908			c = parseInt(hex.substr(i*2,2), 16);
3909			c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
3910			rgb += ("00"+c).substr(c.length);
3911		}
3912
3913		return rgb;
3914	}
3915
3916	//color
3917	function coloredButtons() {
3918		$('.nectar-button.see-through[data-color-override], .nectar-button.see-through-2[data-color-override], .nectar-button.see-through-3[data-color-override]').each(function(){
3919			
3920			var $usingMaterialSkin = ($('body.material[data-button-style^="rounded"]').length > 0) ? true : false;
3921			$(this).css('visibility','visible');
3922			
3923			if($(this).hasClass('see-through-3') && $(this).attr('data-color-override') == 'false') {
3924				return true;
3925			}
3926			//if($(this).attr('data-color-override') != 'false'){
3927
3928				if($(this).attr('data-color-override') != 'false') {
3929					var $color = $(this).attr('data-color-override') ;
3930				} else {
3931					if($(this).parents('.dark').length > 0) 
3932						var $color = '#000000';
3933					else 
3934						var $color = '#ffffff';
3935				}
3936
3937				if(!$(this).hasClass('see-through-3')) $(this).css('color',$color);
3938				$(this).find('i').css('color',$color);
3939				
3940				var colorInt = parseInt($color.substring(1),16);
3941				var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override';
3942				var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff';
3943				
3944	   		var R = (colorInt & 0xFF0000) >> 16;
3945	    	var G = (colorInt & 0x00FF00) >> 8;
3946	   		var B = (colorInt & 0x0000FF) >> 0;
3947	   		
3948	   		var $opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
3949
3950				$(this).css('border-color','rgba('+R+','+G+','+B+','+$opacityStr+')');
3951				
3952				//material buttons w/ icons starting
3953				if($usingMaterialSkin) {
3954					$(this).find('i').css({'background-color': 'rgba('+R+','+G+','+B+',1)', 'box-shadow': '0px 8px 15px rgba('+R+','+G+','+B+',0.24)'});
3955				}
3956				
3957				if($(this).hasClass('see-through')) {
3958					
3959					var $that = $(this);
3960					
3961					$(this).on('mouseenter touchstart', function(){
3962						$that.css('border-color','rgba('+R+','+G+','+B+',1)');
3963					});
3964					
3965					$(this).on('mouseleave touchtouchend', function(){
3966						$that.css('border-color','rgba('+R+','+G+','+B+',1)');
3967						$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
3968						$that.css('border-color','rgba('+R+','+G+','+B+','+$opacityStr+')');
3969					});
3970					
3971					
3972				} else {
3973					
3974					$(this).find('i').css('color', $hoverTextColor);
3975					
3976					if($hoverColor != 'no-override'){
3977						
3978						var $that = $(this);
3979						
3980						$(this).on('mouseenter touchstart', function(){
3981							
3982							$that.css({
3983								'border-color': $hoverColor,
3984								'background-color': $hoverColor,
3985								'color': $hoverTextColor
3986							});
3987							
3988							//material buttons w/ icons over
3989							if($usingMaterialSkin) {
3990								$that.find('i').css({'background-color': '', 'box-shadow': ''});
3991							}
3992							
3993						});
3994						
3995						$(this).on('mouseleave touchtouchend', function(){
3996								
3997								$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
3998								
3999								//material buttons w/ icons leave
4000								if($usingMaterialSkin) {
4001									$that.find('i').css({'background-color': 'rgba('+R+','+G+','+B+',1)', 'box-shadow': '0px 8px 15px rgba('+R+','+G+','+B+',0.24)'});
4002								}
4003								
4004								if(!$that.hasClass('see-through-3')) {
4005									$that.css({
4006										'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
4007										'background-color': 'transparent',
4008										'color': $color
4009									});
4010								} else {
4011									$that.css({
4012										'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
4013										'background-color': 'transparent'
4014									});
4015								}
4016							
4017						});
4018							
4019
4020					
4021					} else {
4022						
4023						var $that = $(this);
4024						
4025						$(this).on('mouseenter touchstart', function(){
4026							
4027								$that.css({
4028									'border-color': $hoverColor,
4029									'color': $hoverTextColor
4030								});
4031								
4032						});
4033						
4034						$(this).on('mouseleave touchtouchend', function(){
4035							
4036								$opacityStr = ($that.hasClass('see-through-3')) ? '1': '0.75';
4037								$that.css({
4038									'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
4039									'color':  $hoverTextColor
4040								});
4041								
4042						});
4043							
4044
4045					
4046					}
4047			//	}
4048			
4049			}
4050		});
4051		
4052		$('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function(){
4053			
4054			$(this).css('visibility','visible');
4055			
4056			if($(this).attr('data-color-override') != 'false'){
4057				
4058				var $color = $(this).attr('data-color-override');
4059				$(this).removeClass('accent-color').removeClass('extra-color-1').removeClass('extra-color-2').removeClass('extra-color-3');
4060				$(this).css('background-color',$color);
4061				
4062			}
4063			
4064		});
4065
4066
4067		//solid color tilt 
4068		if($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) {
4069
4070			var $tiltButtonCssString = '';
4071
4072			$('.swiper-slide .solid_color_2 a').each(function(i){
4073				
4074				$(this).addClass('instance-'+i);
4075
4076				if($(this).attr('data-color-override') != 'false') {
4077					var $color = $(this).attr('data-color-override');
4078				} else {
4079					if($(this).parents('.dark').length > 0) 
4080						var $color = '#000000';
4081					else 
4082						var $color = '#ffffff';
4083				}
4084
4085				$(this).css('color',$color);
4086				$(this).find('i').css('color',$color);
4087				
4088				var $currentColor = $(this).css('background-color');
4089				var $topColor = shadeColor($currentColor, 0.13);
4090				var $bottomColor = shadeColor($currentColor, -0.15);
4091	
4092				$tiltButtonCssString += '.swiper-slide .solid_color_2 a.instance-'+i + ':after { background-color: '+$topColor+';  }' + ' .swiper-slide .solid_color_2 a.instance-'+i + ':before { background-color: '+$bottomColor+'; } ';
4093
4094			});
4095
4096
4097			$('.tilt-button-wrap a').each(function(i){
4098				
4099				$(this).addClass('instance-'+i);
4100
4101				var $currentColor = $(this).css('background-color');
4102
4103				if($(this).attr('data-color-override') != 'false') {
4104					var $color = $(this).attr('data-color-override');
4105					$(this).css('background-color',$color);
4106					$currentColor = $color;
4107				} 
4108			
4109				var $topColor = shadeColor($currentColor, 0.13);
4110				var $bottomColor = shadeColor($currentColor, -0.15);
4111	
4112				$tiltButtonCssString += '.tilt-button-wrap a.instance-'+i + ':after { background-color: '+$topColor+';  }' + ' .tilt-button-wrap a.instance-'+i + ':before { background-color: '+$bottomColor+'; } ';
4113
4114			});
4115
4116			var head = document.head || document.getElementsByTagName('head')[0];
4117   			var style = document.createElement('style');
4118
4119   			style.type = 'text/css';
4120			if (style.styleSheet){
4121			  style.styleSheet.cssText = $tiltButtonCssString;
4122			} else {
4123			  style.appendChild(document.createTextNode($tiltButtonCssString));
4124			}
4125
4126			head.appendChild(style);
4127		}
4128
4129
4130		//transparent 3d
4131		if($('.nectar-3d-transparent-button').length > 0) {
4132
4133			var $3dTransButtonCssString = '';
4134			$('.nectar-3d-transparent-button').each(function(i){
4135
4136				var $that = $(this);
4137				var $size = $that.attr('data-size');
4138				var $padding = 0;
4139				var $font_size;
4140		
4141
4142				//size
4143
4144				if($size == 'large') {
4145					$padding = 46;
4146					$font_size = 16;
4147				} else if($size == 'medium') {
4148					$padding = 30;
4149					$font_size = 16;
4150				} else if($size == 'small') {
4151					$padding = 20;
4152					$font_size = 12;
4153				} else if($size == 'jumbo') {
4154					$padding = 54;
4155					$font_size = 24;
4156				} else if($size == 'extra_jumbo') {
4157					$padding = 100;
4158					$font_size = 64;
4159				}
4160
4161				$that.find('svg text').attr('font-size',$font_size);
4162				var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect();
4163
4164				var $text_width = $boundingRect.width;
4165				var $text_height = $font_size*1.5;
4166
4167				var $extraMult = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 0 : 1;
4168
4169				$that.css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'});
4170				$that.find('> a').css({'height': ($text_height+$padding)+'px'});
4171
4172				$that.find('.back-3d svg, .front-3d svg').css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'}).attr('viewBox','0 0 '+ ($text_width+$padding) + ' ' + ($text_height+$padding));
4173				if($size == 'jumbo')
4174					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.68) +')');
4175				else if($size == 'extra_jumbo')
4176					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.6)/2 +' ' + (($text_height+$padding) / 1.6) +')');
4177				else if($size == 'large') {
4178					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.7) +')');
4179				}
4180				else {
4181					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.65) +')');
4182				}
4183				$that.find('.front-3d ').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
4184				$that.find('.back-3d').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
4185
4186				//mask
4187				$(this).find('.front-3d svg > rect').attr('id','masked-rect-id-'+i);
4188				$(this).find('.front-3d defs mask').attr('id','button-text-mask-'+i);
4189
4190				$that.css('visibility','visible');
4191				$3dTransButtonCssString+= '#masked-rect-id-'+i+' { mask: url(#button-text-mask-'+i+'); -webkit-mask: url(#button-text-mask-'+i+')} ';
4192
4193			});
4194
4195			//extra jumbo resize
4196			function createExtraJumboSize() {
4197				$('.nectar-3d-transparent-button').each(function(i){
4198					
4199					if($(this).css('visibility') != 'visible') return;
4200
4201					var $that = $(this);
4202					var $size = $that.attr('data-size');
4203					if($size == 'extra_jumbo') {
4204						
4205						var $font_size;
4206						
4207						var $extraMult = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 0 : 1;
4208
4209						if(window.innerWidth < 1000 && window.innerWidth > 690) {
4210							$padding = 64;
4211							$font_size = 34;
4212							$that.find('.back-3d rect').attr('stroke-width','12');
4213							$vert_height_divider = 1.7;
4214						} else if(window.innerWidth <= 690 ) {
4215							$padding = 46;
4216							$font_size = 16;
4217							$that.find('.back-3d rect').attr('stroke-width','10');
4218							$vert_height_divider = 1.7;
4219						}  else {
4220							$padding = 100;
4221							$font_size = 64;
4222							$that.find('.back-3d rect').attr('stroke-width','20');
4223							$vert_height_divider = 1.6;
4224						}
4225			
4226
4227						$that.find('svg text').attr('font-size',$font_size);
4228
4229						var $boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect();
4230						var $text_width = $boundingRect.width;
4231						var $text_height = $font_size*1.5;
4232
4233						$that.css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'});
4234						$that.find('> a').css({'height': ($text_height+$padding)+'px'});
4235
4236						$that.find('.back-3d svg, .front-3d svg').css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'}).attr('viewBox','0 0 '+ ($text_width+$padding) + ' ' + ($text_height+$padding));
4237
4238						$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.6)/2 +' ' + (($text_height+$padding) / $vert_height_divider) +')');
4239
4240						$that.find('.front-3d ').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
4241						$that.find('.back-3d').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
4242
4243					}
4244				});
4245			}
4246			createExtraJumboSize();
4247			$(window).on('smartresize',createExtraJumboSize);
4248
4249			var head = document.head || document.getElementsByTagName('head')[0];
4250				var style = document.createElement('style');
4251
4252				style.type = 'text/css';
4253			if (style.styleSheet){
4254			  style.styleSheet.cssText = $3dTransButtonCssString;
4255			} else {
4256			  style.appendChild(document.createTextNode($3dTransButtonCssString));
4257			}
4258
4259			head.appendChild(style);
4260		}
4261
4262		//gradient btn init
4263		setTimeout(function(){
4264			$('.nectar-button.extra-color-gradient-1 .start, .nectar-button.extra-color-gradient-2 .start, .nectar-button.see-through-extra-color-gradient-1 .start, .nectar-button.see-through-extra-color-gradient-2 .start').removeClass('loading');
4265		},150);
4266		//no grad for ff
4267		if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) {
4268			$('.nectar-button.extra-color-gradient-1, .nectar-button.extra-color-gradient-2, .nectar-button.see-through-extra-color-gradient-1, .nectar-button.see-through-extra-color-gradient-2').addClass('no-text-grad');
4269		}
4270	}	
4271
4272	coloredButtons();
4273
4274
4275	//large icon hover
4276	function largeIconHover(){
4277		$('.icon-3x').each(function(){
4278			
4279			$(this).closest('.col').on('mouseenter',function(){
4280				$(this).find('.icon-3x').addClass('hovered')
4281			});
4282			$(this).closest('.col').on('mouseleave',function(){
4283				$(this).find('.icon-3x').removeClass('hovered')
4284			});
4285			
4286		});
4287
4288		//remove gradient from FF
4289		if( navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./))
4290			$('[class^="icon-"].extra-color-gradient-1, [class^="icon-"].extra-color-gradient-2, [class^="icon-"][data-color="extra-color-gradient-1"], [class^="icon-"][data-color="extra-color-gradient-2"], .nectar_icon_wrap[data-color*="extra-color-gradient"] .nectar_icon, .nectar-gradient-text').addClass('no-grad');
4291	}
4292	largeIconHover();
4293
4294
4295/***************** Team Member ******************/
4296function teamMemberFullscreen() {
4297
4298	//open
4299	$('body').on('click','.team-member[data-style="bio_fullscreen"]',function(){
4300		
4301		if($('.nectar_team_member_overlay').length > 0) return;
4302
4303		var $usingBoxedClass = ($('body > #boxed').length > 0) ? 'in-boxed' : null;
4304
4305		$teamMemberMeta = $(this).find('.nectar_team_bio').html();
4306		$teamMemberImg = ($(this).find('.nectar_team_bio_img[data-img-src]').length > 0) ? $(this).find('.nectar_team_bio_img').attr('data-img-src') : '';
4307		$('body').append('<div class="nectar_team_member_overlay '+$usingBoxedClass+'"><div class="inner-wrap"><div class="team_member_details"><div class="bio-inner"><span class="mobile-close"></span><h2>'+$(this).find('.team-meta h3').html()+'</h2><div class="title">'+$(this).find('.team-meta p').html()+'</div><div class="team-desc">'+$teamMemberMeta+'</div></div></div><div class="team_member_picture"><div class="team_member_image_bg_cover"></div><div class="team_member_picture_wrap"><div class="team_member_image"></div></div></div></div></div><div class="nectar_team_member_close '+$usingBoxedClass+'"><div class="inner"></div></div>');
4308		if($teamMemberImg.length > 0) {
4309
4310			//fadein img on load
4311			var teamTmpImg = new Image();
4312			teamTmpImg.src = $teamMemberImg;
4313		    teamTmpImg.onload = function() {
4314		        $('.nectar_team_member_overlay .team_member_image').css('opacity','1');
4315		    };
4316			$('.nectar_team_member_overlay .team_member_image').css({ 'background-image': 'url("'+$teamMemberImg+'")'});
4317		}
4318		
4319		
4320		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').height();
4321		$('.nectar_team_member_overlay .inner-wrap').css({ 'padding-top': $headerNavSpace });
4322		
4323		//no-scroll class - ios ready
4324		if($('.using-mobile-browser').length > 0) {
4325			$('body,html').addClass('nectar-no-scrolling');
4326		}
4327		
4328		teamFullscreenResize();
4329
4330		//transition in
4331		$('.nectar_team_member_overlay').addClass('open').addClass('animating');
4332
4333		setTimeout(function(){
4334			$('.nectar_team_member_close').addClass('visible');
4335			$('.nectar_team_member_overlay').removeClass('animating');
4336		},500);
4337
4338		//bind close mousemove
4339		$(document).on('mousemove',teamMousemoveOn);
4340
4341		//bind overflow
4342		if($('.using-mobile-browser').length == 0) {
4343			fullscreenBioScrolling();
4344		}
4345
4346		if($('.team-member[data-style="bio_fullscreen"]').length > 0 && navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)) { 
4347			$('.nectar_team_member_overlay').addClass('on-mobile');
4348		}
4349
4350	});
4351
4352	//close
4353	$('body').on('click','.nectar_team_member_overlay',function(){
4354		if(!$(this).hasClass('animating')) {
4355
4356			$('.nectar_team_member_overlay').removeClass('open');
4357			$('.nectar_team_member_close').removeClass('visible');
4358			
4359			if($('.using-mobile-browser').length > 0) {
4360				$('body,html').removeClass('nectar-no-scrolling');
4361			}
4362			
4363			setTimeout(function(){
4364				
4365				//unbind close mousemove
4366				$(document).off('mousemove',teamMousemoveOn);
4367
4368				$('.nectar_team_member_overlay, .nectar_team_member_close').remove();
4369
4370			},820);
4371		}
4372	});
4373
4374	if($('.team-member[data-style="bio_fullscreen"]').length > 0) {
4375		$(window).resize(teamFullscreenResize);
4376	}
4377
4378	
4379}
4380
4381function teamFullscreenResize() {
4382	var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 275 : 0;
4383	$('.nectar_team_member_overlay').css({'width' : $(window).width()-$leftHeaderSize, 'left': $leftHeaderSize});
4384}
4385
4386function fullscreenBioScrolling(){ 
4387	$('.nectar_team_member_overlay .inner-wrap').mousewheel(function(event, delta) {
4388
4389	     this.scrollTop -= (delta * 30);
4390	     event.preventDefault();
4391
4392	});
4393
4394}
4395
4396function teamMousemoveOn(e) {
4397	
4398	if($('a:hover').length > 0) {
4399		$('.nectar_team_member_close .inner').removeClass('visible');
4400	} else {
4401		$('.nectar_team_member_close .inner').addClass('visible');
4402	}
4403    $('.nectar_team_member_close').css({
4404       left:  e.pageX - 26,
4405       top:   e.pageY - $(window).scrollTop() - 29
4406    });
4407}
4408
4409if($('.team-member').length > 0) {
4410	teamMemberFullscreen();
4411}
4412
4413/***************** Column Hover BG ******************/
4414
4415function columnBGColors() {	
4416	
4417	var $columnColorCSS = '';
4418
4419	$('.wpb_column').each(function(i){
4420		
4421		$(this).removeClass(function (index, className) {
4422		    return (className.match (/(^|\s)instance-\S+/g) || []).join(' ');
4423		});
4424		
4425		$(this).addClass('instance-'+i);
4426
4427		//bg color
4428		if($(this).attr('data-has-bg-color') == 'true') {
4429			if($(this).is('[data-animation*="reveal"]') && $(this).hasClass('has-animation')) {
4430				$columnColorCSS += '.wpb_column.instance-'+i+ ' > .column-bg-overlay { background-color:' + $(this).attr('data-bg-color') + ';  opacity: '+$(this).attr('data-bg-opacity')+'; }';
4431			}
4432			else {
4433				$columnColorCSS += '.wpb_column.instance-'+i+ ' > .column-bg-overlay{ background-color:' + $(this).attr('data-bg-color') + ';  opacity: '+$(this).attr('data-bg-opacity')+'; }';
4434			}
4435		}
4436
4437		//hover bg color
4438		if($(this).is('[data-hover-bg^="#"]')) {
4439			if($(this).is('[data-animation*="reveal"]') && $(this).hasClass('has-animation')) {
4440				 $columnColorCSS += '.wpb_column.instance-'+i+ ':hover > .column-bg-overlay { background-color: '+$(this).attr('data-hover-bg') + '!important; opacity: '+$(this).attr('data-hover-bg-opacity')+'!important; }';
4441			}
4442			else {
4443	   		 $columnColorCSS += '.wpb_column.instance-'+i+ ':hover > .column-bg-overlay { background-color: '+$(this).attr('data-hover-bg') + '!important; opacity: '+$(this).attr('data-hover-bg-opacity')+'!important; }';
4444			}
4445
4446		}
4447	});
4448	
4449	if($('head #column-bg-colors').length > 0) {
4450		$('head #column-bg-colors').remove();
4451	}
4452	if($columnColorCSS.length > 1) {
4453		var head = document.head || document.getElementsByTagName('head')[0];
4454		var style = document.createElement('style');
4455
4456		style.type = 'text/css';
4457		if (style.styleSheet){
4458		  style.styleSheet.cssText = $columnColorCSS;
4459		} else {
4460		  style.appendChild(document.createTextNode($columnColorCSS));
4461		}
4462		
4463		$(style).attr('id','column-bg-colors');
4464		head.appendChild(style);
4465	}
4466
4467}
4468columnBGColors();
4469
4470
4471
4472
4473
4474
4475/***************** morphing button ******************/
4476
4477function morphingOutlines() {
4478
4479	if($('.morphing-outline').length > 0) {
4480
4481		$morphingOutlineCSS = '';
4482		var $frontEndEditorMOSelector =  ($('body.vc_editor').length > 0) ? '' : '>';
4483		
4484		$('.morphing-outline').each(function(i){
4485			
4486			$(this).removeClass(function (index, className) {
4487			    return (className.match (/(^|\s)instance-\S+/g) || []).join(' ');
4488			});
4489			
4490			$(this).addClass('instance-'+i).css({'visibility':'visible'});
4491			var $width = $(this).find('.inner').width();
4492			var $height = $(this).find('.inner').height();
4493			var $border = parseInt($(this).attr("data-border-thickness"));
4494			var $hover = ($('body[data-button-style*="rounded"]').length > 0) ? ':hover': '';
4495			var $hover2 = ($('body[data-button-style*="rounded"]').length > 0) ? '': ':hover';
4496
4497			$morphingOutlineCSS += 'body .morphing-outline.instance-'+i+' .inner > * { color: '+$(this).attr("data-starting-color")+'; } ';
4498			$morphingOutlineCSS += 'body .morphing-outline.instance-'+i+' .inner:after  { border-width:'+$(this).attr("data-border-thickness")+'px ; border-color: '+$(this).attr("data-starting-color")+'; } ';
4499			
4500			$morphingOutlineCSS += 'body .wpb_column:hover > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner > *, body .wpb_column:hover > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner > * { color: '+$(this).attr("data-hover-color")+'; } ';
4501			$morphingOutlineCSS += 'body .wpb_column:hover > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner:after, body .wpb_column:hover > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner:after  { border-color: '+$(this).attr("data-hover-color")+'; } ';
4502			//padding calcs
4503			$morphingOutlineCSS += 'body .wpb_column'+$hover2+' > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner:after, body .wpb_column'+$hover2+' > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner:after { padding: '+(($width+100 + $border*2 - $height)/2 - $border) +'px 50px}';
4504			$morphingOutlineCSS += '.morphing-outline.instance-'+i+' { padding: '+(30+($width+80 + $border*2 - $height)/2 - $border) +'px 50px}'; //extra space on the outer for mobile/close elements
4505			$morphingOutlineCSS += 'body .wpb_column'+$hover2+' > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner:after, body .wpb_column'+$hover2+' > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner:after { top: -'+ parseInt((($width+100 + $border*2 - $height)/2 - $border) + $border)+ 'px }';
4506
4507			$morphingOutlineCSS += 'body .wpb_column > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner:after, body .wpb_column > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner:after { left: -' + parseInt(50+$border) + 'px }';
4508			////hover
4509			$morphingOutlineCSS += 'body .wpb_column'+$hover+' > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner:after, body .wpb_column'+$hover+' > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner:after { padding: 50px 50px}';
4510			$morphingOutlineCSS += 'body .wpb_column'+$hover+' > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner:after, body .wpb_column'+$hover+' > .vc_column-inner > .wpb_wrapper ' + $frontEndEditorMOSelector + ' .morphing-outline.instance-'+i+' .inner:after { top: -'+parseInt(50+$border) +'px }';
4511
4512		});
4513
4514		var head = document.head || document.getElementsByTagName('head')[0];
4515		var style = document.createElement('style');
4516
4517		style.type = 'text/css';
4518		style.id = 'morphing-outlines';
4519		if (style.styleSheet){
4520		  style.styleSheet.cssText = $morphingOutlineCSS;
4521		} else {
4522		  style.appendChild(document.createTextNode($morphingOutlineCSS));
4523		}
4524
4525		$('#morphing-outlines').remove();
4526		head.appendChild(style);
4527	}
4528}
4529
4530setTimeout(morphingOutlines,100); 
4531setTimeout(fullWidthContentColumns,126);
4532
4533
4534/***************** svg icons *******************/
4535
4536var $svg_icons = [];
4537function svgAnimations() {
4538	
4539	var $svgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
4540
4541	if($svg_icons.length == 0) {
4542
4543		$('.svg-icon-holder:not(.animated-in)').has('svg').each(function(i){
4544			var $that = $(this);
4545
4546			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)) $that.attr('data-animation','false');
4547
4548			//size
4549			$that.find('svg').css({'height': parseInt($that.attr('data-size')) +'px', 'width': parseInt($that.attr('data-size')) +'px'});
4550
4551			//animation
4552			$(this).find('svg').attr('id','nectar-svg-animation-instance-'+i);
4553			var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200;
4554			if($that.attr('data-animation') == 'false') { 
4555				$animationSpeed = 1;
4556				$that.css('opacity','1');
4557			}
4558
4559			if(!$that.hasClass('bound')) {
4560				$svg_icons[i] = new Vivus($that.find('svg').attr('id'), {type: 'delayed', pathTimingFunction: Vivus.EASE_OUT, animTimingFunction: Vivus.LINEAR, duration: $animationSpeed, onReady: svgInit });
4561			}
4562
4563			if($animationSpeed !== 1) {
4564
4565				var $that = $(this);
4566				var waypoint = new Waypoint({
4567		 			element: $that,
4568		 			 handler: function(direction) {
4569		 			 	if( $that.hasClass('animated-in')) { 
4570						     waypoint.destroy();
4571						     return;
4572						}
4573
4574		 			 	checkIfReady();
4575						$that.addClass('animated-in');
4576						waypoint.destroy();
4577					},
4578					offset: $svgOffsetPos
4579
4580				}); 
4581
4582			} else {
4583				checkIfReady();
4584			}
4585
4586			function checkIfReady() {
4587				var $animationDelay = ($that.is('[data-animation-delay]') && $that.attr('data-animation-delay').length > 0 && $that.attr('data-animation') != 'false') ? $that.attr('data-animation-delay') : 0;
4588				
4589				var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g,'');
4590
4591				if($svg_icons[$iconID].isReady == true) {
4592					 setTimeout(function(){ $that.css('opacity','1'); $svg_icons[$iconID].reset().play(); },$animationDelay);
4593				} else {
4594					setTimeout(checkIfReady,50);
4595				}
4596			}
4597
4598			function svgInit() {
4599
4600				//set size
4601				$that.css({'height': parseInt($that.attr('data-size')) +'px', 'width': parseInt($that.attr('data-size')) +'px'});
4602
4603
4604			}
4605
4606			$that.addClass('bound');
4607
4608		});	
4609	} else {
4610		$('.svg-icon-holder').addClass('animated-in').css('opacity','1');
4611	}
4612	
4613	//full vc row support
4614	$('#nectar_fullscreen_rows .svg-icon-holder.animated-in').has('svg').each(function(i){
4615		
4616		var $animationDelay = ($(this).is('[data-animation-delay]') && $(this).attr('data-animation-delay').length > 0 && $(this).attr('data-animation') != 'false') ? $(this).attr('data-animation-delay') : 0;
4617		var $that = $(this);
4618
4619		var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g,'');
4620
4621		clearTimeout($animatedSVGIconTimeout[i]);
4622
4623		if($that.attr('data-animation') == 'false') { 
4624			$animationSpeed = 1;
4625			$that.css('opacity','1');
4626			$svg_icons[$iconID].finish();
4627		} else {
4628			if($(this).parents('.active').length > 0 || $(this).parents('#footer-outer').length > 0 || $('body.mobile').length > 0) {
4629				$svg_icons[$iconID].reset();
4630				$animatedSVGIconTimeout[i] = setTimeout(function(){ $svg_icons[$iconID].play(); },$animationDelay);
4631			}
4632
4633			else {
4634				$svg_icons[$iconID].reset().stop();
4635			}
4636		}
4637	});
4638}
4639//svg in equal height column resize
4640if($('.vc_row-o-equal-height .svg-icon-holder[data-animation="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) {
4641	 $(window).on('smartresize', function(){
4642	    clearTimeout($svgResizeTimeout);
4643	    $svgResizeTimeout = setTimeout(function(){ 
4644
4645	    	if($svg_icons.length > 0) {
4646	        	$('.svg-icon-holder.animated-in').each(function(i){
4647					$(this).css('opacity','1');
4648					var $iconID = $(this).attr('id').replace(/[^0-9]/g,'');
4649					$svg_icons[$iconID].finish();
4650				});
4651	        }
4652
4653	     },300);
4654	});
4655}
4656
4657
4658/***************** fancy ul ******************/
4659
4660	function nectar_fancy_ul_init() {
4661		$($fullscreenSelector+'.nectar-fancy-ul').each(function(){
4662
4663
4664			var $icon = $(this).attr('data-list-icon');
4665			var $color = $(this).attr('data-color');
4666			var $animation = $(this).attr('data-animation');
4667			var $animationDelay = ($(this).is('[data-animation-delay]') && $(this).attr('data-animation-delay').length > 0 && $(this).attr('data-animation') != 'false') ? $(this).attr('data-animation-delay') : 0;
4668			
4669			$(this).find('li').each(function(){
4670				
4671				if($(this).find('> i').length == 0) 
4672					$(this).prepend('<i class="icon-default-style '+$icon+ ' ' + $color +'"></i> ');
4673			});
4674
4675			
4676			if($animation == 'true') {
4677
4678
4679				var $that = $(this);
4680				var waypoint = new Waypoint({
4681		 			element: $that,
4682		 			 handler: function(direction) {
4683
4684		 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
4685						     waypoint.destroy();
4686						     return;
4687						}
4688
4689						setTimeout(function(){
4690			 			 	$that.find('li').each(function(i){
4691			 			 		var $that = $(this);
4692								$that.delay(i*220).transition({
4693									'opacity': '1',
4694									'left' : '0'
4695								},220,'easeOutCubic');
4696							});
4697			 			 },$animationDelay);
4698
4699						$that.addClass('animated-in');
4700						waypoint.destroy();
4701					},
4702					offset: 'bottom-in-view'
4703
4704				}); 
4705
4706			} 
4707			
4708			
4709			
4710		});
4711	}
4712
4713
4714	
4715
4716/***************** flip box min heights ******************/
4717//if content height exceeds min height change it
4718function flipBoxHeights() {
4719	$('.nectar-flip-box').each(function(){
4720		
4721		var $flipBoxMinHeight = parseInt($(this).attr('data-min-height'));
4722		var $flipBoxHeight = ( $(this).find('.flip-box-back .inner').height() > $(this).find('.flip-box-front .inner').height() ) ? $(this).find('.flip-box-back .inner').height() : $(this).find('.flip-box-front .inner').height();
4723
4724		if($flipBoxHeight >= $flipBoxMinHeight - 80) {
4725			$(this).find('> div').css('height', $flipBoxHeight + 80);
4726		} else 
4727			$(this).find('> div').css('height','auto');
4728
4729	});
4730}
4731flipBoxHeights();
4732
4733if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
4734	$('body').on('click','.nectar-flip-box', function(){
4735		$(this).toggleClass('flipped');
4736	});
4737}
4738
4739/***************** PARALLAX SECTIONS ******************/
4740	
4741	var $window = $(window);
4742	var windowHeight = $window.height();
4743
4744		
4745	$window.off('scroll.parallaxSections').off('resize.parallaxSections');
4746	$window.unbind('resize.parallaxSectionsUpdateHeight');
4747	$window.unbind('load.parallaxSectionsOffsetL');
4748	$window.unbind('resize.parallaxSectionsOffsetR');
4749
4750	$window.on('resize.parallaxSectionsUpdateHeight',psUpdateWindowHeight);
4751
4752	function psUpdateWindowHeight() {
4753		windowHeight = $window.height();
4754	}
4755
4756	function psUpdateOffset($this) {
4757		$this.each(function(){
4758	  	    firstTop = $this.offset().top;
4759		});
4760	}
4761	
4762	var firstTop;
4763	
4764	$.fn.parallaxScroll = function(xpos, speedFactor, outerHeight) {
4765		var $this = $(this);
4766		var getHeight;
4767		var paddingTop = 0;
4768		
4769		var $windowDOMWidth = window.innerWidth, $windowDOMHeight = window.innerHeight;
4770		var $orientationChange = 0;
4771		
4772		//get the starting position of each element to have parallax applied to it		
4773		$this.each(function(){
4774		    firstTop = $this.offset().top;
4775		});
4776
4777		
4778		$window.on('resize.parallaxSectionsOffsetR',psUpdateOffset($this));
4779		$window.on('load.parallaxSectionsOffsetL',psUpdateOffset($this));
4780	
4781		getHeight = function(jqo) {
4782			return jqo.outerHeight(true);
4783		};
4784		 
4785			
4786		// setup defaults if arguments aren't specified
4787		if (arguments.length < 1 || xpos === null) xpos = "50%";
4788		if (arguments.length < 2 || speedFactor === null) speedFactor = 0.25;
4789		if (arguments.length < 3 || outerHeight === null) outerHeight = true;
4790		
4791		// function to be called whenever the window is scrolled or resized
4792
4793		var $element, top, height;
4794		
4795		var ua = window.navigator.userAgent;
4796		var msie = ua.indexOf("MSIE ");
4797		var $onMobileBrowser = navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/);		
4798		
4799		var $toTransformOrNot = ($smoothCache == true) ? true : false;
4800		
4801		if(!$toTransformOrNot) {
4802			$this.find('.row-bg.using-image, .page-header-bg-image, .image-bg, .video-wrap').addClass('translate');
4803		}
4804		
4805		var $ifFast = 0;
4806		$element = $this;
4807		
4808		height = getHeight($element);
4809		
4810		var classic_mobile_menu_open = false;
4811		
4812		setInterval(function(){
4813			height = getHeight($element);
4814			
4815			classic_mobile_menu_open = ( $('body.classic_mobile_menu_open.mobile').length > 0 ) ? true : false;
4816			
4817		},600);
4818		
4819		var firstSection = ( ($element.parents('.top-level').length > 0 && $element.parents('.parallax_slider_outer').length > 0) || ($element.parents('.top-level').length > 0 && $element.is('.nectar-recent-posts-single_featured') ) || $element.is('.wpb_row.top-level') || $('.wpb_row').length == 0) ? true : false;
4820		
4821		//for first nectar slider shortcode without page builder or portfolio first
4822		if( $('.wpb_row').length == 0 && $element.parents('.parallax_slider_outer').length > 0 && $element.is('[data-full-width="true"]') ||
4823	      ($('#portfolio-extra').length > 0 && $element.parents('.parallax_slider_outer').length > 0 && $element.parents('.wpb_row').length > 0 && $element.parents('.wpb_row').index() == '0') ) {
4824			firstSection = true;
4825		}
4826		
4827		if(nectarDOMInfo.usingFrontEndEditor) {
4828			firstSection = false;
4829		}
4830		
4831		var nectarSliderElBool = $this.is('.nectar-slider-wrap');
4832		var pageHeaderBool = ($this.find('.page-header-bg-image').length > 0) ? true : false;
4833		
4834		var $elToParallax = false;
4835		
4836		if(nectarSliderElBool) {
4837			
4838				if($this.find('.video-wrap').length > 0 || $this.find('.image-bg').length > 0) {
4839					$elToParallax = $this.find('.video-wrap, .image-bg');
4840				} 
4841		}
4842		else {
4843			
4844				if($this.find('.row-bg.using-image').length > 0) {
4845					
4846					$elToParallax = $this.find('.row-bg.using-image');
4847					
4848				} else if($this.find('.page-header-bg-image').length > 0) {
4849					
4850					$elToParallax = $this.find('.page-header-bg-image');
4851				}
4852				
4853		}
4854		
4855
4856		function update(){
4857				
4858				firstTop = $element.offset().top;
4859				
4860				// Check if totally above or totally below viewport
4861				if ($elToParallax == false || firstTop + height < nectarDOMInfo.scrollTop || firstTop > nectarDOMInfo.scrollTop + windowHeight || $('body.material-ocm-open').length > 0) {
4862					
4863				} else {
4864
4865		        //for IE, Safari or any setup using the styled scrollbar default to animating the BG pos
4866		        if ($toTransformOrNot) {
4867		        	$this.find('.row-bg.using-image').css('backgroundPosition', xpos + " " + Math.round((firstTop - nectarDOMInfo.scrollTop) * speedFactor) + "px");
4868		        }
4869		       	//for Firefox/Chrome use a higher performing method
4870		        else  {
4871							
4872							//nectar slider
4873							if(nectarSliderElBool) {
4874									
4875								 if(firstSection) {
4876									 //top level row
4877 										if(!classic_mobile_menu_open) {
4878									 		$this.find('.video-wrap, .image-bg').css({ 'transform':  'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor)  + 'px, 0)' }); 
4879									  }
4880								 } else {
4881									 	$this.find('.video-wrap, .image-bg').css({ 'transform':  'translate3d(0, ' + parseFloat((($windowDOMHeight + nectarDOMInfo.scrollTop -  firstTop) * speedFactor) ) + 'px, 0)' }); 
4882								 }
4883								
4884							} else {
4885								
4886								//rows
4887								if(firstSection) {
4888									//top level row
4889									if(!classic_mobile_menu_open) {
4890		        				$elToParallax.css({ 'transform':  'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor)  + 'px, 0)' });
4891									}
4892								} else {
4893									//regular rows
4894									$elToParallax.css({ 'transform':  'translate3d(0, ' + parseFloat((($windowDOMHeight + nectarDOMInfo.scrollTop -  firstTop) * speedFactor) ) + 'px, 0), scale(1.005)' });
4895								}
4896								
4897								//page header
4898								if(pageHeaderBool && !classic_mobile_menu_open) {
4899									$elToParallax.css({ 'transform':  'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' });
4900								}
4901							
4902							}
4903							
4904						} 
4905				
4906				}
4907				
4908
4909			//if on mobile, auto RAF
4910			if($onMobileBrowser){
4911				requestAnimationFrame(update); 
4912			}
4913			
4914		}		
4915
4916		if (window.addEventListener) {
4917			
4918			if(nectarDOMInfo.usingFrontEndEditor) {
4919				$(window).on('scroll.parallaxSections', update);
4920				
4921				$(window).resize(function(){
4922					$windowDOMWidth = window.innerWidth;
4923					$windowDOMHeight = window.innerHeight;
4924				});
4925				
4926			}
4927			else if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
4928					 window.addEventListener('scroll', function(){ 
4929			          requestAnimationFrame(update); 
4930			     }, false);
4931					 
4932					 $(window).resize(function(){
4933						 $windowDOMWidth = window.innerWidth;
4934						 $windowDOMHeight = window.innerHeight;
4935					 });
4936					 
4937			 } else {
4938				 	//if on mobile, auto RAF
4939					requestAnimationFrame(update); 
4940					
4941
4942					window.addEventListener("orientationchange", function() {
4943						 $orientationChange = 1;
4944					});
4945					
4946					$(window).resize(function(){
4947							if( ($(window).width() != $windowDOMWidth && $(window).height != $windowDOMHeight) || $orientationChange == 1){
4948
4949									//store the current window dimensions
4950									$windowDOMWidth = window.innerWidth;
4951									$windowDOMHeight = window.innerHeight;
4952									
4953									$orientationChange = 0;
4954							}
4955					});
4956					 
4957			 }
4958			 
4959		}
4960
4961		$window.on('resize.parallaxSections',update);
4962
4963		update();
4964	};
4965
4966 
4967
4968	
4969/***************** Full Width Section ******************/
4970
4971	//nectar slider in container but fullwidth fix
4972	$('.wpb_row .vc_col-sm-12 .nectar-slider-wrap[data-full-width="true"]').each(function(){
4973		if($(this).parents('.wpb_row.full-width-section').length == 0 && $(this).parents('.wpb_row.full-width-content').length == 0) {
4974			$(this).parents('.wpb_row').addClass('full-width-section');
4975		}
4976	});
4977
4978	function fullWidthSections(){
4979
4980		var $windowInnerWidth = window.innerWidth;
4981		var $scrollBar = ($('#ascrail2000').length > 0 && $windowInnerWidth > 1000) ? -13 : 0;
4982		var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? parseInt($('.body-border-right').width())*2 : 0;
4983		var $justOutOfSight;
4984		
4985		if($('#boxed').length == 1){
4986			$justOutOfSight = ((parseInt($('.container-wrap').width()) - parseInt($('.main-content').width())) / 2) + 4;
4987		} else {
4988			
4989			//if the ext responsive mode is on - add the extra padding into the calcs
4990			var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && $windowInnerWidth >= 1000) ? 180 : 0;
4991			var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0;
4992			if($(window).width() - $leftHeaderSize - $bodyBorderWidth  <= parseInt($('.main-content').css('max-width'))) { 
4993				var $windowWidth = parseInt($('.main-content').css('max-width'));
4994
4995				//no need for the scrollbar calcs with ext responsive on desktop views
4996				if($extResponsivePadding == 180) $windowWidth = $windowWidth - $scrollBar;
4997
4998			} else { 
4999				var $windowWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth;
5000			}
5001
5002			
5003			var $contentWidth = parseInt($('.main-content').css('max-width'));
5004
5005			//single post fullwidth
5006			if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 ) {
5007				$contentWidth = $('.post-area').width();
5008				$extResponsivePadding = 0;
5009			}
5010			
5011			$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
5012		}
5013		
5014	
5015	    //full width content sections
5016	    $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow','visible');
5017	    
5018	    $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .full-width-content').each(function(){
5019			
5020			var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0;
5021			var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? (parseInt($('.body-border-right').width())*2) - 2 : 0;
5022
5023			//single post fullwidth
5024			if($('#boxed').length == 1){
5025
5026				var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
5027
5028				if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) {
5029					$contentWidth = $('.post-area').width();
5030					$extResponsivePadding = 0;
5031					$windowWidth = $(window).width() - $bodyBorderWidth;
5032					$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
5033				} else {
5034					if($(this).parents('.page-submenu').length > 0)
5035						$justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2);
5036					else 
5037						$justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4;
5038				}
5039			} else {
5040				if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) {
5041					$contentWidth = $('.post-area').width();
5042					$extResponsivePadding = 0;
5043					$windowWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth;
5044				} else {
5045
5046					var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').css('max-width')) : parseInt($(this).parents('.container').css('max-width'));
5047
5048					//when using gutter on portfolio don't add extra space for scroll bar
5049			    	if($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') {
5050			    		$scrollBar = ($('#ascrail2000').length > 0 && $windowInnerWidth > 1000) ? -13 : 0;
5051			    	}
5052
5053					if($(window).width() - $leftHeaderSize - $bodyBorderWidth <= $mainContentMaxWidth) { 
5054						$windowWidth = $mainContentMaxWidth;
5055						//no need for the scrollbar calcs with ext responsive on desktop views
5056						if($extResponsivePadding == 180) $windowWidth = $windowWidth - $scrollBar;
5057					}
5058					$contentWidth = $mainContentMaxWidth;
5059					$extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1000) ? 180 : 0;
5060					if($leftHeaderSize > 0) $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1000) ? 120 : 0;
5061				}
5062
5063				$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
5064			}
5065
5066			var $extraSpace = 0;
5067			if( $(this).hasClass('carousel-wrap')) $extraSpace = 1;
5068			if( $(this).hasClass('portfolio-items')) $extraSpace = 5;
5069			
5070	    	var $carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width() - $leftHeaderSize - $bodyBorderWidth +$extraSpace  + $scrollBar ;
5071
5072	    	//when using gutter on portfolio don't add extra space
5073	    	if($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') {
5074	    		if($(window).width() > 1000)
5075	    			$carouselWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth + $scrollBar + 3
5076	    		else 
5077	    			$carouselWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth + $scrollBar 
5078	    	}
5079
5080	    	if($(this).parent().hasClass('default-style')) { 
5081
5082	    		var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
5083	    		
5084	    		if($('#boxed').length != 0) {
5085	    			$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width() - $leftHeaderSize + $extraSpace + $scrollBar ;
5086				}
5087				else {
5088					$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : ($(window).width() - $leftHeaderSize - $bodyBorderWidth) - (($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.025) + $extraSpace + $scrollBar ;
5089					$windowWidth = ($(window).width() - $leftHeaderSize - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($(window).width() - $leftHeaderSize - $bodyBorderWidth) - (($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.025);
5090					$justOutOfSight = Math.ceil( (($windowWidth + $scrollBar - $mainContentWidth) / 2) )
5091				}
5092			}
5093
5094			else if($(this).parent().hasClass('spaced')) { 
5095
5096				var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
5097
5098				if($('#boxed').length != 0) {
5099	    			$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) - ($(window).width()*.02) : $(window).width() + $extraSpace + $scrollBar ;
5100				} else {
5101					$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : ($(window).width()- $leftHeaderSize - $bodyBorderWidth)  - Math.ceil(($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.02) + $extraSpace + $scrollBar ;
5102					var $windowWidth2 = ($(window).width() - $leftHeaderSize - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($(window).width() - $leftHeaderSize - $bodyBorderWidth) - (($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.02);
5103					$justOutOfSight = Math.ceil( (($windowWidth2 + $scrollBar - $mainContentWidth) / 2) +2)
5104				}
5105			}
5106	    	
5107	    	if(!$(this).parents('.span_9').length > 0 && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner' && $(this).parent().attr('id') != 'portfolio-extra' 
5108	      && !$(this).find('.carousel-wrap[data-full-width="true"]').length > 0
5109				&& !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0
5110	    	&& !$(this).find('.portfolio-items:not(".carousel")[data-col-num="elastic"]').length > 0){
5111
5112	    		//escape if inside woocoommerce page and not using applicable layout
5113	    		if($('.single-product').length > 0 && $(this).parents('#tab-description').length > 0 && $(this).parents('.full-width-tabs').length == 0) {
5114	    			$(this).css({
5115						'visibility': 'visible'
5116					});	
5117	    		} else {
5118	    			if($(this).hasClass('portfolio-items')) {
5119		    				$(this).css({
5120								'transform': 'translateX(-'+ $justOutOfSight + 'px)',
5121								'margin-left': 0,
5122								'left': 0,
5123								'width': $carouselWidth,
5124								'visibility': 'visible'
5125							});	
5126	    			} else {
5127							
5128							//fullscreen page rows left fix
5129							if($('#nectar_fullscreen_rows').length > 0 && $(this).hasClass('wpb_row')) {
5130								$(this).css({
5131									'margin-left': - $justOutOfSight,
5132									'width': $carouselWidth,
5133									'visibility': 'visible'
5134								});	
5135							} else {
5136								$(this).css({
5137									'left': 0,
5138									'margin-left': - $justOutOfSight,
5139									'width': $carouselWidth,
5140									'visibility': 'visible'
5141								});	
5142							}
5143							
5144	    			}
5145					
5146				}
5147			}  else if($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) {
5148				$(this).css({
5149					'left': 0,
5150					'margin-left': - $justOutOfSight,
5151					'width': $carouselWidth,
5152					'visibility': 'visible'
5153				});	
5154			}
5155			
5156			else {
5157
5158				$(this).css({
5159					'margin-left': 0,
5160					'width': 'auto',
5161					'left': '0',
5162					'visibility': 'visible'
5163				});	
5164			}
5165	    	
5166	    });
5167			
5168	}
5169	
5170	var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length ;
5171
5172	function parallaxSrollSpeed(speedString) {
5173
5174		var ua = window.navigator.userAgent;	
5175		var msie = ua.indexOf("MSIE ");
5176		var speed;
5177
5178		 //not as modern browsers
5179		 if ($smoothCache == true) {
5180			 switch(speedString) {
5181			   	  case 'slow':
5182			   	      speed = 0.2;
5183			   	      break;
5184			   	  case 'medium': 
5185			   	  	  speed = 0.4;
5186			   	      break;
5187			   	  case 'fast': 
5188			    	  speed = 0.6;
5189			   	       break;
5190			   }
5191		}
5192		 //chrome/ff
5193		 else {
5194		 	 switch(speedString) {
5195			   	  case 'slow':
5196			   	      speed = 0.6;
5197			   	      break;
5198			   	  case 'medium': 
5199			   	  	  speed = 0.4;
5200			   	      break;
5201			   	  case 'fast': 
5202			    	  speed = 0.25;
5203			   	       break;
5204			   }
5205		}
5206
5207		   return speed;
5208	}
5209
5210	function parallaxScrollInit(){
5211		
5212		if(nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) {
5213			return;
5214		}
5215		
5216		parallaxRowsBGCals();
5217		
5218		$('.nectar-recent-posts-single_featured, .wpb_row.parallax_section, #page-header-bg[data-parallax="1"] .page-header-bg-image-wrap, .parallax_slider_outer .nectar-slider-wrap').each(function(){
5219		   var $id = $(this).attr('id');	
5220
5221		    var ua = window.navigator.userAgent;	
5222		    var msie = ua.indexOf("MSIE ");
5223
5224			if ($smoothCache == true)  {
5225				
5226		   		if($(this).find('[data-parallax-speed="fixed"]').length == 0) { 
5227						
5228							if($(this).find('.row-bg').length == 0) {
5229								$('#'+$id).parallaxScroll("50%", 0.25);
5230							} else {
5231								$('#'+$id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) );
5232							}
5233					}
5234					
5235		  } else if($(this).find('[data-parallax-speed="fixed"]').length == 0) {
5236				
5237					if($(this).find('.row-bg').length == 0) {
5238							//set default scroll speed if not defined
5239							$('#'+$id).parallaxScroll("50%", 0.25);
5240					} else {
5241							$('#'+$id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) );
5242					}
5243		  }
5244			
5245			$(this).addClass('nectar-parallax-enabled');
5246			
5247		});
5248		
5249	}
5250	
5251	
5252	
5253	//add first class for rows for page header trans effect (zoom only as of now)
5254	$('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function(){
5255		
5256		if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
5257			
5258			
5259			if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
5260				
5261			if($(this).index() == '0' && $('#page-header-bg').length == 0 && $('.page-header-no-bg').length == 0 
5262							 && $('.project-title').length == 0 && $('body.single').length == 0 
5263							 && $('.project-title').length == 0 ) {
5264
5265				$(this).addClass('first-section');
5266				var $that = $(this);
5267				setTimeout( function() { $that.addClass('loaded'); },50);
5268				
5269			} 
5270				
5271
5272		}
5273	});	
5274	
5275	
5276	
5277
5278	parallaxScrollInit();
5279	parallaxRowsBGCals();
5280
5281	function parallaxRowsBGCals(){
5282		
5283		if(nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) {
5284			return;
5285		}
5286
5287		$('.nectar-recent-posts-single_featured, .wpb_row.parallax_section, #page-header-bg[data-parallax="1"] .page-header-bg-image-wrap, .parallax_slider_outer .nectar-slider-wrap .slide-bg-wrap').each(function(){
5288			
5289			 var ua = window.navigator.userAgent;
5290		   var msie = ua.indexOf("MSIE ");
5291
5292			 if ($smoothCache == true) {
5293			 	 $(this).find('.row-bg').css({'height': $(this).outerHeight(true)*2.8, 'margin-top': '-' + ($(this).outerHeight(true)*2.8)/2 + 'px' });
5294			 } else {
5295				 
5296				 if($(this).find('.row-bg').length == 0 && $(this).find('.page-header-bg-image').length > 0 ) {
5297					 	//$(this).find('.page-header-bg-image').css({'height': $(this).outerHeight(true)   });
5298				 } 
5299				 else if($(this).find('.row-bg').length == 0 && $(this).find('.image-bg').length > 0 ) {
5300					 	
5301						var $non_page_builder_slider = false;
5302						//for first nectar slider shortcode without page builder
5303				 		if( $('.wpb_row').length == 0 && $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && $(this).parents('.parallax_slider_outer').length > 0 && $(this).parents('.parallax_slider_outer').index() == '0' ) {
5304				 			$non_page_builder_slider = true;
5305				 		}
5306						//portfolio first
5307						if($('#portfolio-extra').length > 0 && $(this).parents('.wpb_row').length > 0 && $(this).parents('.parallax_slider_outer').length > 0 && $(this).parents('.wpb_row').index() == '0' ) {
5308								$non_page_builder_slider = true;
5309						}
5310					 
5311					 if($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) {
5312						 $(this).find('.image-bg').css({'height':  Math.ceil( $(this).parent().offset().top * 0.25 ) + $(this).outerHeight(true) });
5313					 } else {
5314						 	$(this).find('.image-bg').css({'height': Math.ceil( $(window).height() * 0.25 ) + $(this).outerHeight(true)   });
5315					 }
5316					 
5317				 }
5318				 else if($(this).find('.row-bg').length == 0 && $(this).find('.video-wrap').length > 0 ) {
5319					 
5320					 
5321					 var $non_page_builder_slider = false;
5322					 //for first nectar slider shortcode without page builder
5323					 if( $('.wpb_row').length == 0 && $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && $(this).parents('.parallax_slider_outer').length > 0 && $(this).parents('.parallax_slider_outer').index() == '0' ) {
5324						 $non_page_builder_slider = true;
5325					 } 
5326					 //portfolio first
5327					 if($('#portfolio-extra').length > 0 && $(this).parents('.wpb_row').length > 0 && $(this).parents('.parallax_slider_outer').length > 0 && $(this).parents('.wpb_row').index() == '0' ) {
5328							 $non_page_builder_slider = true;
5329					 }
5330					 
5331					 if($(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor || $non_page_builder_slider && !nectarDOMInfo.usingFrontEndEditor) {
5332						 $(this).find('.video-wrap').css({'height': Math.ceil( $(this).parent().offset().top * 0.25 ) + $(this).outerHeight(true) });
5333					 } else {
5334						 	$(this).find('.video-wrap').css({'height': Math.ceil( $(window).height() * 0.25 ) + $(this).outerHeight(true)   });
5335					 }
5336					 
5337					 var vid = $(this).find('.video-wrap video');
5338					 var vid_w_orig = 1280;
5339					 var vid_h_orig = 720;
5340
5341					 // get the parent element size
5342					 var container_w = vid.parent().width();
5343					 var container_h = vid.parent().height();	 
5344					 var scale_w = container_w / vid_w_orig;
5345					 var scale_h = container_h / vid_h_orig;
5346					 var scale = scale_w > scale_h ? scale_w : scale_h;
5347					 
5348					 // scale the video
5349					 vid.width(scale * vid_w_orig);
5350					 vid.height(scale * vid_h_orig);
5351
5352				 }  
5353				 else {
5354					  
5355					 	if($(this).is('.nectar-recent-posts-single_featured') && $(this).parents('.top-level').length > 0 && !nectarDOMInfo.usingFrontEndEditor ) {
5356							
5357						}
5358					 	else if( !$(this).hasClass('top-level') || nectarDOMInfo.usingFrontEndEditor) {
5359							var $ifFast = ($(this).find('.row-bg[data-parallax-speed="fast"]').length > 0) ? 60 : 0;
5360						 	$(this).find('.row-bg').css({'height': Math.ceil( $(window).height() * parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) ) + $(this).outerHeight(true) + $ifFast  });
5361						} 
5362						
5363				 }
5364			 
5365			 }
5366			 
5367		});
5368	}
5369	
5370	//if fullwidth section is first or last, remove the margins so it fits flush against header/footer
5371	function fwsClasses() {
5372		
5373		$('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function(){
5374			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
5375				if($(this).parents('.wpb_row').index() == '0'){
5376					$(this).addClass('first-nectar-slider');
5377				} 
5378			}
5379		});
5380
5381		if($('#portfolio-extra').length == 0) {
5382			$contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length;
5383		} else {
5384			$contentElementsNum = $('.main-content > .row #portfolio-extra > *').length;
5385		}
5386
5387		$('.full-width-section, .full-width-content:not(.page-submenu .full-width-content):not(.blog-fullwidth-wrap), .row > .nectar-slider-wrap[data-full-width="true"], .wpb_wrapper > .nectar-slider-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]').each(function(){
5388			
5389			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
5390				
5391				if($(this).parents('.wpb_row').length > 0){ 
5392				
5393					if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
5394					
5395					////first
5396					if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length != 0 ){
5397						//$(this).css('margin-top','-2.1em').addClass('first-section nder-page-header');
5398					} 
5399					else if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length == 0 && $('.page-header-no-bg').length == 0 
5400					         && $('.project-title').length == 0 && $(this).parents('.wpb_row').index() == '0' 
5401					         && $('.project-title').length == 0 
5402					         && $('body[data-bg-header="true"]').length == 0) {
5403
5404					     if($('.single').length == 0) {
5405					     	$('.container-wrap').css('padding-top','0px');
5406					     } else {
5407					     	$(this).addClass('first-section');
5408					     } 	
5409						
5410					} 
5411					
5412					//check if it's also last (i.e. the only fws)
5413					if($(this).parents('.wpb_row').index() == $contentElementsNum-1 && $('#respond').length == 0 ) { 
5414						if($(this).attr('id') != 'portfolio-filters-inline') {
5415							$('.container-wrap').css('padding-bottom','0px');
5416							$('#call-to-action .triangle').remove();
5417						}
5418					} 
5419				
5420				} else {
5421
5422					if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
5423					
5424					if( $(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area' ) {
5425						
5426						////first
5427						if($(this).index() == '0' && $('#page-header-bg').length != 0 ){
5428							//$(this).css('margin-top','-2.1em').addClass('first-section nder-page-header');
5429			
5430						} 
5431						else if($(this).index() == '0' && $('#page-header-bg').length == 0 && $(this).index() == '0' && $('.page-header-no-bg').length == 0 && 
5432						        $(this).index() == '0' && !$(this).hasClass('blog_next_prev_buttons') && !$(this).hasClass('nectar-shop-outer') && $(this).parents('.pum-container').length == 0 ) {
5433						     
5434						      if($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0 || $('body.material').length > 0 && $('.single').length == 0) { 
5435											
5436											if(!$('body.blog .blog-fullwidth-wrap > .masonry:not(.meta-overlaid)').length > 0) {
5437						          	$('.container-wrap').css('padding-top','0px');
5438											}
5439											
5440						      } else {
5441						      	  $(this).addClass('first-section');
5442						      }   	
5443							
5444						} 
5445						
5446						//check if it's also last (i.e. the only fws)
5447						if($(this).index() == $contentElementsNum-1 && $('#respond').length == 0 && $('body.woocommerce-checkout').length == 0) { 
5448							$('.container-wrap').css('padding-bottom','0px');
5449							$('.bottom_controls').css('margin-top','0px');
5450							$('#call-to-action .triangle').remove();
5451						} 
5452					}
5453					
5454				}
5455			}
5456		});
5457
5458
5459		$('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function(){
5460			//check if it's last 
5461			if($(this).index() == $contentElementsNum-1 && $('#commentform').length == 0 && $('#pagination').length == 0) { 
5462				if(parseInt($('.container-wrap').css('padding-bottom')) > 0) $(this).css('margin-bottom','-40px');
5463				$('#call-to-action .triangle').remove();
5464			}
5465		});
5466		
5467
5468		$('.portfolio-filters').each(function(){
5469			////first
5470			if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' ){
5471				$(this).addClass('first-section nder-page-header');
5472			}  else if($(this).index() == '0' && $('#page-header-bg').length == 0 || $(this).index() == '0'){
5473				$(this).css({'margin-top':'0px'}).addClass('first-section');
5474			}
5475		});
5476		
5477		$('.portfolio-filters-inline').each(function(){
5478			////first
5479			if($(this).parents('.wpb_row').length > 0){ 
5480				
5481				if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length != 0 || $(this).parents('.wpb_row').index() == '0' ){
5482					if($('body[data-header-resize="0"]').length == 0) { 
5483						//$(this).css({'margin-top':'-2.1em', 'padding-top' : '19px'}).addClass('first-section nder-page-header');
5484					}
5485				}  
5486				
5487			} else {
5488				if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' ){
5489					$(this).css({'margin-top':'-2.1em', 'padding-top' : '19px'}).addClass('first-section nder-page-header');
5490				}  else if($(this).index() == '0' && $('#page-header-bg').length == 0 || $(this).index() == '0'){
5491					
5492					//if($('body[data-header-resize="0"]').length == 1 || $('body.material').length > 0) { 
5493				          $(this).css({'margin-top':'-30px', 'padding-top' : '50px'}).addClass('first-section');
5494				      //} else {
5495				      //	  $(this).css({'margin-top':'-70px', 'padding-top' : '50px'}).addClass('first-section');
5496				      //} 
5497
5498				
5499				}
5500			}
5501			
5502		});
5503		
5504
5505	}
5506	
5507
5508	//sizing for fullwidth sections that are image only
5509
5510	function fullwidthImgOnlySizingInit(){
5511		////set inital sizes
5512		$('.full-width-section:not(.custom-skip)').each(function(){
5513			
5514			var $fwsHeight = $(this).outerHeight(true);
5515
5516			//make sure it's empty and also not being used as a small dvider
5517			if($(this).find('.span_12 *').length == 0 && $.trim( $(this).find('.span_12').text() ).length == 0  && $fwsHeight > 40){
5518				$(this).addClass('bg-only');
5519				$(this).css({'height': $fwsHeight, 'padding-top': '0px', 'padding-bottom': '0px'});
5520				$(this).attr('data-image-height',$fwsHeight);
5521			}
5522
5523		});
5524	}
5525
5526	function fullwidthImgOnlySizing(){
5527
5528		$('.full-width-section.bg-only').each(function(){
5529			var $initialHeight = $(this).attr('data-image-height');
5530			
5531			if( window.innerWidth < 1000 && window.innerWidth > 690 ) {
5532				$(this).css('height', $initialHeight - $initialHeight*.60);
5533			} 
5534			
5535			else if( window.innerWidth <= 690 ) {
5536				$(this).css('height', $initialHeight - $initialHeight*.78);
5537			} 
5538			
5539			else if( window.innerWidth < 1300 && window.innerWidth >= 1000  ) {
5540				$(this).css('height', $initialHeight - $initialHeight*.33);
5541			} 
5542			
5543			else {
5544				$(this).css('height', $initialHeight);
5545			}
5546			
5547		});
5548		
5549	}
5550
5551	fullwidthImgOnlySizingInit();
5552	fullwidthImgOnlySizing();
5553	
5554	
5555	
5556	//change % padding on rows to be relative to screen
5557	function fullWidthRowPaddingAdjustInit(){
5558		if($('#boxed').length == 0){
5559			$('.full-width-section, .full-width-content').each(function(){
5560				var $topPadding = $(this)[0].style.paddingTop;
5561				var $bottomPadding = $(this)[0].style.paddingBottom;
5562
5563				if($topPadding.indexOf("%") >= 0) $(this).attr('data-top-percent',$topPadding);
5564				if($bottomPadding.indexOf("%") >= 0) $(this).attr('data-bottom-percent',$bottomPadding);
5565				
5566
5567			});
5568		}
5569	}
5570
5571	function fullWidthRowPaddingAdjustCalc(){
5572		if($('#boxed').length == 0){
5573			$('.full-width-section[data-top-percent], .full-width-section[data-bottom-percent], .full-width-content[data-top-percent],  .full-width-content[data-bottom-percent]').each(function(){
5574
5575				var $windowHeight = $(window).width();
5576				var $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip';
5577				var $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip';
5578
5579				//top
5580				if($topPadding != 'skip') {
5581					$(this).css('padding-top',$windowHeight*(parseInt($topPadding)/100));
5582				}
5583
5584				//bottom
5585				if($bottomPadding != 'skip'){
5586					$(this).css('padding-bottom',$windowHeight*(parseInt($bottomPadding)/100));
5587				}
5588				
5589
5590			});
5591		}
5592	}
5593	if(nectarDOMInfo.usingMobileBrowser) {
5594		fullWidthRowPaddingAdjustCalc();
5595	}
5596
5597	
5598	//full width content column sizing
5599	function fullWidthContentColumns(){
5600		
5601		var $frontEndEditorElDiv = ($('body.vc_editor').length > 0) ? '.vc_element > ': '';
5602		
5603		//standard carousel
5604		$('.main-content > .row > '+$frontEndEditorElDiv+' .full-width-content, #portfolio-extra > '+$frontEndEditorElDiv+' .full-width-content, .woocommerce-tabs #tab-description > .full-width-content, .post-area.span_12 article .content-inner > .full-width-content').each(function(){
5605			
5606			//only set the height if more than one column
5607			if($(this).find('> .span_12 > '+$frontEndEditorElDiv+' .col').length > 1){
5608				
5609				var tallestColumn = 0;
5610				var $columnInnerHeight = 0;
5611				var $column_inner_selector; 
5612				
5613				$(this).find('> .span_12 > '+$frontEndEditorElDiv+'  .col').each(function(){
5614
5615					$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
5616					
5617					var $padding = parseInt($(this).css('padding-top'));
5618					var $frontEndEditorElPadding = ($frontEndEditorElDiv.length > 2 && $(this).find('> .vc_column-inner').length > 0) ? parseInt($(this).find('> .vc_column-inner').css('padding-top')) : 0;
5619
5620					($(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height() + ($padding*2) + $frontEndEditorElPadding > tallestColumn) ? tallestColumn = $(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height() + ($padding*2) + $frontEndEditorElPadding : tallestColumn = tallestColumn;
5621				});	
5622	    	 	
5623	    	 	$(this).find('> .span_12 > '+$frontEndEditorElDiv+' .col').each(function(){
5624
5625	    	 		$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
5626					
5627	    	 		//columns with content
5628		    	 	if($(this).find('> '+$column_inner_selector+' > .wpb_wrapper > *').length > 0){
5629		    	 		//added in 7.6 to fix equal height columns 
5630							if($frontEndEditorElDiv.length < 2 && !$(this).parent().parent().hasClass('vc_row-o-equal-height')) { $(this).css('height',tallestColumn); }
5631							else if($frontEndEditorElDiv.length > 2 && !$(this).parent().parent().parent().hasClass('vc_row-o-equal-height')) { $(this).css('height',tallestColumn); }
5632		    	 	} 
5633		    	 	//empty columns
5634		    	 	else {
5635		    	 		$(this).css('min-height',tallestColumn);
5636		    	 		if($(this).is('[data-animation*="reveal"]')) $(this).find('.column-inner').css('min-height',tallestColumn);
5637		    	 	}
5638	    	 	});
5639	         	
5640	         	//nested column height
5641						var $childRows = $(this).find('> .span_12 > '+$frontEndEditorElDiv+' .col .wpb_row').length;
5642	         	if(window.innerWidth > 1000) { 
5643	         		
5644	         		var $padding = parseInt($(this).find('> .span_12 > '+$frontEndEditorElDiv+' .col').css('padding-top'));
5645	         		
5646	         		//$(this).find('> .span_12 > .col .wpb_row .col').css('min-height',(tallestColumn-($padding*2))/$childRows + 'px'); 
5647	         	} else {
5648	         		$(this).find('> .span_12 > '+$frontEndEditorElDiv+' .col .wpb_row .col').css('min-height','0px'); 
5649	         	}
5650	         	
5651	         	
5652	         	//vertically center
5653	         	if($(this).hasClass('vertically-align-columns') && window.innerWidth > 1000 && !$(this).hasClass('vc_row-o-equal-height')){
5654	         		
5655	         		//parent columns
5656		         	$(this).find('> .span_12 > '+$frontEndEditorElDiv+' .col').each(function(){
5657
5658		         		$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
5659						
5660						$columnInnerHeight = $(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height();
5661						var $marginCalc = ($(this).height()/2)-($columnInnerHeight/2);
5662						if($marginCalc <= 0) $marginCalc = 0;
5663						
5664						$(this).find('> '+$column_inner_selector+' > .wpb_wrapper').css('margin-top',$marginCalc);
5665						$(this).find('> '+$column_inner_selector+' > .wpb_wrapper').css('margin-bottom',$marginCalc);
5666						
5667					});	
5668	
5669					
5670				}
5671			
5672			}
5673			
5674   	  	});
5675
5676		//equal height columns in container type with reveal columns
5677		$('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function(){
5678			if($(this).find('>.span_12 > '+$frontEndEditorElDiv+' .wpb_column[data-animation*="reveal"]').length >0) {
5679				var tallestColumn = 0;
5680				var $columnInnerHeight = 0;
5681				
5682			$(this).find('> .span_12 > '+$frontEndEditorElDiv+' .col').each(function(){
5683					
5684					var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top'));
5685					($(this).find('> .column-inner-wrap > .column-inner').height() + ($padding*2) > tallestColumn) ? tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding*2)  : tallestColumn = tallestColumn;
5686				});	
5687	    	 	
5688	    	 	$(this).find('> .span_12 > '+$frontEndEditorElDiv+' .col').each(function(){
5689					
5690	    	 		//columns with content
5691		    	 	if($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0){
5692		    	 		$(this).find('> .column-inner-wrap').css('height',tallestColumn);
5693		    	 	} 
5694		    	 	//empty columns
5695		    	 	else {
5696		    	 		$(this).css('min-height',tallestColumn);
5697		    	 		if($(this).is('[data-animation*="reveal"]')) $(this).find('.column-inner').css('min-height',tallestColumn);
5698		    	 	}
5699	    	 	});
5700
5701			}	
5702		});
5703
5704		//using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug)
5705		$('.wpb_row.vc_row-o-equal-height>.span_12> '+$frontEndEditorElDiv+'.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function(){
5706			if($(this).parents('.tabbed').length == 0) {
5707				$(this).css({ 'padding-top': $(this).css('padding-left'), 'padding-bottom': $(this).css('padding-left')});
5708			}
5709		});
5710		
5711	}
5712	
5713	fullWidthContentColumns();
5714	if($('.owl-carousel').length > 0) owlCarouselInit();
5715
5716
5717var $mouseParallaxScenes = [];
5718function mouseParallaxInit(){
5719	$('.wpb_row:has(.nectar-parallax-scene)').each(function(i){
5720
5721		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').height();
5722		
5723		var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength'));
5724
5725		$mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({
5726			scalarX: $strength,
5727	  		scalarY: $strength
5728		});
5729
5730		//wait until the images in the scene have loaded
5731		var images = $(this).find('.nectar-parallax-scene li');
5732		
5733		$.each(images, function(){
5734			if($(this).find('div').length > 0) {
5735			    var el = $(this).find('div'),
5736			    image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, '');
5737			    if(image && image !== '' && image !== 'none')
5738			        images = images.add($('<img>').attr('src', image));
5739			}
5740		});
5741
5742		var $that = $(this);
5743
5744
5745	});
5746}
5747mouseParallaxInit();
5748
5749
5750	
5751/***************** Checkmarks ******************/
5752
5753function ulChecks() {
5754	$('ul.checks li').each(function(){
5755		if( $(this).find('i.icon-ok-sign').length == 0 ) {
5756			$(this).prepend('<i class="icon-ok-sign"></i>');
5757		}
5758	});
5759}
5760ulChecks();
5761
5762
5763
5764function rowBGAnimations() {
5765	var $rowBGAnimationsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '93%';
5766	
5767	$($fullscreenSelector+'.row-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .row-bg.using-image').each(function() {
5768		
5769		var $that = $(this);
5770		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
5771		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
5772		
5773		var waypoint = new Waypoint({
5774			 element: $that.parents('.row-bg-wrap'),
5775			 handler: function(direction) {
5776				 
5777				 if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
5778						waypoint.destroy();
5779					 return;
5780				 }
5781				 
5782					$that.parents('.inner-wrap').addClass('animated-in');
5783				 
5784				 waypoint.destroy();
5785			 },
5786			 offset: $rowBGAnimationsOffsetPos
5787		});
5788		
5789	});
5790	
5791}
5792
5793function columnBGAnimations() {
5794	var $rowBGAnimationsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '93%';
5795	
5796	$($fullscreenSelector+'.column-image-bg-wrap[data-bg-animation]:not([data-bg-animation="none"]):not([data-bg-animation*="displace-filter"]) .column-image-bg').each(function() {
5797		
5798		var $that = $(this);
5799		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
5800		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
5801		
5802		var waypoint = new Waypoint({
5803			 element: $that.parents('.column-image-bg-wrap'),
5804			 handler: function(direction) {
5805				 
5806				 if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
5807						waypoint.destroy();
5808					 return;
5809				 }
5810				 
5811					$that.parents('.inner-wrap').addClass('animated-in');
5812				 
5813				 waypoint.destroy();
5814			 },
5815			 offset: $rowBGAnimationsOffsetPos
5816		});
5817		
5818	});
5819	
5820}
5821
5822/***************** Image with Animation / Col Animation *******************/
5823
5824
5825	
5826function colAndImgAnimations(){
5827
5828	var $colAndImgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '88%';
5829	var $colAndImgOffsetPos2 = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '70%';
5830
5831	$($fullscreenSelector+'img.img-with-animation').each(function() {
5832		
5833		var $that = $(this);
5834		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
5835		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
5836
5837		var waypoint = new Waypoint({
5838 			element: $that,
5839 			 handler: function(direction) {
5840			   
5841					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
5842						 waypoint.destroy();
5843						return;
5844					}
5845
5846					if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
5847				
5848						if($that.attr('data-animation') == 'fade-in-from-left'){
5849							$that.delay($that.attr('data-delay')).transition({
5850								'opacity' : 1,
5851								'x' : '0px'
5852							},$animationDuration, $animationEasing);
5853						} else if($that.attr('data-animation') == 'fade-in-from-right'){
5854							$that.delay($that.attr('data-delay')).transition({
5855								'opacity' : 1,
5856								'x' : '0px'
5857							},$animationDuration, $animationEasing);
5858						} else if($that.attr('data-animation') == 'fade-in-from-bottom'){
5859							$that.delay($that.attr('data-delay')).transition({
5860								'opacity' : 1,
5861								'y' : '0px'
5862							},$animationDuration, $animationEasing);
5863						} else if($that.attr('data-animation') == 'fade-in') {
5864							$that.delay($that.attr('data-delay')).transition({
5865								'opacity' : 1
5866							},$animationDuration, $animationEasing);	
5867						} else if($that.attr('data-animation') == 'grow-in') {
5868							setTimeout(function(){ 
5869								$that.transition({ scale: 1, 'opacity':1 },$animationDuration,$animationEasing);
5870							},$that.attr('data-delay'));
5871						}
5872						else if($that.attr('data-animation') == 'flip-in') {
5873							setTimeout(function(){ 
5874								$that.transition({  rotateY: 0, 'opacity':1 },$animationDuration, $animationEasing);
5875							},$that.attr('data-delay'));
5876						}
5877						else if($that.attr('data-animation') == 'flip-in-vertical') {
5878							setTimeout(function(){ 
5879								$that.transition({  rotateX: 0, 'opacity':1 },$animationDuration, $animationEasing);
5880							},$that.attr('data-delay'));
5881						}
5882
5883						$that.addClass('animated-in');
5884						
5885					}
5886
5887					waypoint.destroy();
5888
5889			  },
5890			  offset: $colAndImgOffsetPos
5891		});
5892
5893		
5894	
5895	});
5896
5897
5898	$($fullscreenSelector+'.nectar_cascading_images').each(function() {
5899		
5900		var $that = $(this);
5901		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
5902		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
5903		var $animationDelay = ($(this).is('[data-animation-timing]')) ? $(this).attr('data-animation-timing') : 175;
5904		$animationDelay = parseInt($animationDelay);
5905
5906		var waypoint = new Waypoint({
5907 			element: $that,
5908 			 handler: function(direction) {
5909			   
5910					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
5911						 waypoint.destroy();
5912						return;
5913					}
5914
5915					if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
5916					
5917						$that.find('.cascading-image').each(function(i){
5918
5919							var $that2 = $(this);
5920
5921							if($that2.attr('data-animation') == 'flip-in' || $that2.attr('data-animation') == 'flip-in-vertical') {
5922								setTimeout(function(){
5923									$that2.find('.inner-wrap').css({
5924										'opacity' : 1,
5925										'transform' : 'rotate(0deg) translateZ(0px)'
5926									});
5927								}, i* $animationDelay);
5928							} else {
5929								setTimeout(function(){
5930									$that2.find('.inner-wrap').css({
5931										'opacity' : 1,
5932										'transform' : 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)'
5933									});
5934								}, i* $animationDelay);
5935							}
5936					
5937
5938						});
5939
5940						$that.addClass('animated-in');
5941						
5942					}
5943
5944					waypoint.destroy();
5945
5946			  },
5947			  offset: $colAndImgOffsetPos
5948		});
5949
5950		
5951	
5952	});
5953	
5954
5955	
5956	$($fullscreenSelector+'.col.has-animation:not([data-animation*="reveal"]), '+$fullscreenSelector+'.wpb_column.has-animation:not([data-animation*="reveal"]), '+$fullscreenSelector+'.nectar-fancy-box.has-animation').each(function(i) {
5957	    
5958		var $that = $(this);
5959		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
5960		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
5961
5962		//set perspective for vertical flip
5963		if($that.is('[data-animation="flip-in-vertical"]')) {
5964			$that.parents('.col.span_12').addClass('flip-in-vertical-wrap');
5965		}
5966
5967		var waypoint = new Waypoint({
5968 			element: $that,
5969 			 handler: function(direction) {
5970				
5971				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
5972					 waypoint.destroy();
5973					return;
5974				}
5975
5976				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
5977				 	
5978				 	
5979					if($that.attr('data-animation') == 'fade-in-from-left'){
5980						$standAnimatedColTimeout[i] = setTimeout(function(){ 
5981							$that.transition({
5982								'opacity' : 1,
5983								'x' : '0px'
5984							},$animationDuration,$animationEasing);
5985						},$that.attr('data-delay'));
5986					} else if($that.attr('data-animation') == 'fade-in-from-right'){
5987						$standAnimatedColTimeout[i] = setTimeout(function(){ 
5988							$that.transition({
5989								'opacity' : 1,
5990								'x' : '0px'
5991							},$animationDuration,$animationEasing);
5992						},$that.attr('data-delay'));
5993					} else if($that.attr('data-animation') == 'fade-in-from-bottom'){
5994						$standAnimatedColTimeout[i] = setTimeout(function(){ 
5995							$that.transition({
5996								'opacity' : 1,
5997								'y' : '0px'
5998							},$animationDuration,$animationEasing);
5999						},$that.attr('data-delay'));
6000					} else if($that.attr('data-animation') == 'fade-in') {
6001						$standAnimatedColTimeout[i] = setTimeout(function(){ 
6002							$that.transition({
6003								'opacity' : 1
6004							},$animationDuration,$animationEasing);	
6005						},$that.attr('data-delay'));
6006					} else if($that.attr('data-animation') == 'grow-in' || $that.attr('data-animation') == 'zoom-out') {
6007						$standAnimatedColTimeout[i] = setTimeout(function(){ 
6008							$that.transition({ scale: 1, 'opacity':1 },$animationDuration,$animationEasing);
6009						},$that.attr('data-delay'));
6010					} else if($that.attr('data-animation') == 'flip-in') {
6011						$standAnimatedColTimeout[i] = setTimeout(function(){ 
6012							$that.transition({  rotateY: 0, 'opacity':1 },$animationDuration, $animationEasing);
6013						},$that.attr('data-delay'));
6014					} else if($that.attr('data-animation') == 'flip-in-vertical') {
6015						$standAnimatedColTimeout[i] = setTimeout(function(){ 
6016							$that.transition({  rotateX: 0, y: 0, 'opacity':1 },$animationDuration, $animationEasing);
6017						},$that.attr('data-delay'));
6018					}
6019
6020					//boxed column hover fix
6021					if($that.hasClass('boxed')) {
6022						$that.addClass('no-pointer-events');
6023						setTimeout(function(){
6024							$that.removeClass('no-pointer-events');
6025						},parseInt($animationDuration) + parseInt($that.attr('data-delay')) + 30 );
6026					}
6027
6028					$that.addClass('animated-in');
6029				
6030				}
6031
6032				waypoint.destroy();
6033			},
6034			offset: $colAndImgOffsetPos
6035		});
6036	
6037	});
6038
6039	
6040	$($fullscreenSelector+'.wpb_column.has-animation[data-animation*="reveal"]').each(function() {
6041	    
6042		var $that = $(this);
6043		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
6044		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
6045
6046		var waypoint = new Waypoint({
6047 			element: $that,
6048 			 handler: function(direction) {
6049				
6050				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
6051					 waypoint.destroy();
6052					return;
6053				}
6054
6055				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
6056					
6057					if($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') {
6058						setTimeout(function(){ 
6059							if($that.hasClass('animated-in')) $that.find('.column-inner-wrap, .column-inner').transition({  'y': 0 },$animationDuration, $animationEasing,function(){ if($that.hasClass('animated-in')) $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); });
6060						},$that.attr('data-delay'));
6061					} else if($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') {
6062						setTimeout(function(){ 
6063							if($that.hasClass('animated-in'))  $that.find('.column-inner-wrap, .column-inner').transition({  'x': 0 },$animationDuration, $animationEasing,function(){ if($that.hasClass('animated-in')) $that.find('.column-inner-wrap, .column-inner').addClass('no-transform'); });
6064						},$that.attr('data-delay'));
6065					} 
6066
6067					$that.addClass('animated-in');
6068				
6069				}
6070
6071				waypoint.destroy();
6072			},
6073			offset: $colAndImgOffsetPos2
6074		});
6075	
6076	}); 	
6077
6078	
6079}
6080
6081
6082
6083function cascadingImageBGSizing() {
6084	$('.nectar_cascading_images').each(function(){
6085
6086		//handle max width for cascading images in equal height columns
6087		if($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) 
6088			$(this).css('max-width',$(this).parents('.wpb_column').width());
6089
6090		//set size for layers with no images
6091		$(this).find('.bg-color').each(function(){
6092			var $bgColorHeight = 0;
6093			var $bgColorWidth = 0;
6094			if($(this).parent().find('.img-wrap').length == 0) {
6095				var $firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first();
6096
6097				$firstSibling.css({'position':'relative', 'visiblity':'hidden'});
6098				$bgColorHeight = $firstSibling.find('.img-wrap').height();
6099				$bgColorWidth = $firstSibling.find('.img-wrap').width();
6100				if($firstSibling.index() == 0) {
6101					$firstSibling.css({'visiblity':'visible'});
6102				} else {
6103					$firstSibling.css({'position':'absolute', 'visiblity':'visible'});
6104				}
6105			} else {
6106				$bgColorHeight = $(this).parent().find('.img-wrap').height();
6107				$bgColorWidth = $(this).parent().find('.img-wrap').width();
6108			}
6109
6110			$(this).css({'height': $bgColorHeight,'width': $bgColorWidth});
6111		});
6112	});
6113}
6114
6115if($('.nectar_cascading_images').length > 0) {
6116	imagesLoaded($('.nectar_cascading_images'),function(instance){
6117		cascadingImageBGSizing();
6118	});
6119}
6120
6121function splitLineHeadings() {
6122
6123	var $splitLineOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
6124	$($fullscreenSelector+'.nectar-split-heading').each(function() {
6125
6126		var $that = $(this);
6127		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
6128		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
6129
6130		var waypoint = new Waypoint({
6131				element: $that,
6132				 handler: function(direction) {
6133				
6134				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
6135					 waypoint.destroy();
6136					return;
6137				}
6138
6139				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
6140				 	
6141					
6142					$that.find('.heading-line').each(function(i){
6143						//if($that.parents('.first-section').length > 0 && $('body[data-aie="zoom-out"]').length > 0) i = i+4;
6144						$(this).find('> div').delay(i*70).transition({
6145							'y' : '0px'
6146						},$animationDuration,$animationEasing);
6147
6148					});
6149					
6150
6151					$that.addClass('animated-in');
6152				
6153				}
6154
6155				waypoint.destroy();
6156			},
6157			offset: $splitLineOffsetPos
6158		});
6159
6160	});
6161}
6162
6163	
6164/***************** Custom tablet default column widths  ******************/
6165	
6166	//add one-fourth class
6167	function oneFourthClasses() {
6168		$('.col.span_3, .vc_span3, .vc_col-sm-3').each(function(){
6169			if( !$(this).is('[data-t-w-inherits="small_desktop"]') ) {
6170				var $currentDiv = $(this);
6171				var $nextDiv = $(this).next('div');
6172				if( $nextDiv.hasClass('span_3') && !$currentDiv.hasClass('one-fourths') || $nextDiv.hasClass('vc_span3') && !$currentDiv.hasClass('one-fourths') || $nextDiv.hasClass('vc_col-sm-3') && !$currentDiv.hasClass('one-fourths') ) {
6173					$currentDiv.addClass('one-fourths clear-both');
6174					$nextDiv.addClass('one-fourths right-edge');
6175				}
6176			}
6177		});
6178		
6179		//make empty second 1/2 half columsn display right on iPad
6180		$('.span_12 .col.span_6').each(function(){
6181			if($(this).next('div').hasClass('span_6') && $.trim( $(this).next('div').html() ).length == 0 ) {
6182				$(this).addClass('empty-second')
6183			}
6184		}); 
6185		
6186	}
6187	oneFourthClasses();
6188	
6189/***************** Bar Graph ******************/
6190function progressBars(){
6191	var $progressBarsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
6192	$($fullscreenSelector+'.nectar-progress-bar').parent().each(function(i){
6193		
6194		var $that = $(this);
6195		var waypoint = new Waypoint({
6196 			element: $that,
6197 			 handler: function(direction) {
6198			   
6199					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
6200						 waypoint.destroy();
6201						return;
6202					}
6203
6204					if($progressBarsOffsetPos == '100%') $that.find('.nectar-progress-bar .bar-wrap').css('opacity','1');
6205
6206					$that.find('.nectar-progress-bar').each(function(i){
6207
6208
6209						var percent = $(this).find('span').attr('data-width');
6210						var $endNum = parseInt($(this).find('span strong i').text());
6211						var $that = $(this);
6212						
6213						$that.find('span').delay(i*90).transition({
6214							'width' : percent + '%'
6215						},1050, 'easeInOutQuint',function(){
6216						});
6217	
6218						setTimeout(function(){
6219
6220							var countOptions = { useEasing : false };
6221							var $countEle = $that.find('span strong i')[0];
6222							var numAnim = new CountUp($countEle, 0, $endNum,0,1,countOptions);
6223							numAnim.start();
6224
6225							$that.find('span strong').transition({
6226								'opacity' : 1
6227							},550, 'easeInCirc');
6228						}, (i*90) );
6229					
6230						////100% progress bar 
6231						if(percent == '100'){
6232							$that.find('span strong').addClass('full');
6233						}
6234					});
6235
6236					$that.addClass('completed');
6237
6238					waypoint.destroy();
6239
6240			  },
6241			  offset: $progressBarsOffsetPos
6242		});
6243
6244	});
6245}
6246
6247
6248/***************** Column Borders ******************/
6249function animatedColBorders(){
6250	var $progressBarsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '75%';
6251	$($fullscreenSelector+'.wpb_column[data-border-animation="true"]').each(function(i){
6252
6253		var $that = $(this);
6254		var waypoint = new Waypoint({
6255 			element: $that,
6256 			 handler: function(direction) {
6257			   
6258					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
6259						 waypoint.destroy();
6260						return;
6261					}
6262
6263					var $borderDelay = ($that.attr('data-border-animation-delay').length > 0) ? parseInt($that.attr('data-border-animation-delay')) : 0;
6264					setTimeout(function(){
6265						$that.find('.border-wrap').addClass('animation');
6266						$that.find('.border-wrap').addClass('completed');
6267					},$borderDelay)
6268					
6269
6270					waypoint.destroy();
6271
6272			  },
6273			  offset: $progressBarsOffsetPos
6274		});
6275
6276	});
6277}
6278
6279/***************** Food Menu Item ******************/
6280function foodMenuItems() {
6281	var $foodItemOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '80%';
6282	$($fullscreenSelector+'.nectar_food_menu_item').parent().each(function(i){
6283
6284		var $that = $(this);
6285		var waypoint = new Waypoint({
6286 			element: $that,
6287 			 handler: function(direction) {
6288			   
6289					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
6290						 waypoint.destroy();
6291						return;
6292					}
6293
6294					$that.find('.nectar_food_menu_item').each(function(i){
6295
6296						var $that = $(this);
6297
6298						setTimeout(function(){
6299							$that.addClass('animated-in');
6300						},i*150);
6301						
6302					});
6303					
6304					waypoint.destroy();
6305
6306			  },
6307			  offset: $foodItemOffsetPos
6308		});
6309
6310	});
6311}
6312
6313
6314/***************** Dividers ******************/
6315function dividers() {
6316	var $dividerOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
6317
6318	$($fullscreenSelector+'.divider-small-border[data-animate="yes"], '+$fullscreenSelector+'.divider-border[data-animate="yes"]').each(function(i){
6319
6320		var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500;
6321		var $that = $(this);
6322		var waypoint = new Waypoint({
6323 			element: $that,
6324 			 handler: function(direction) {
6325			   
6326					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
6327						 waypoint.destroy();
6328						return;
6329					}
6330				
6331					$that.each(function(i){
6332
6333						$(this).css({'transform':'scale(0,1)', 'visibility': 'visible'});
6334						var $that = $(this);
6335						
6336						$that.delay($that.attr('data-animation-delay')).transition({
6337							'transform' : 'scale(1, 1)'
6338						},$lineDur, 'cubic-bezier(.18,1,.22,1)');
6339						
6340					});
6341
6342					$that.addClass('completed');
6343
6344					waypoint.destroy();
6345
6346			  },
6347			  offset: $dividerOffsetPos
6348		});
6349
6350	});
6351}
6352
6353
6354
6355/***************** Icon List ******************/
6356function iconList() {
6357	var $iconListOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '250%' : '75%';
6358
6359	$($fullscreenSelector+'.nectar-icon-list[data-animate="true"]').each(function(i){
6360
6361		var $that = $(this);
6362		var waypoint = new Waypoint({
6363 			element: $that,
6364 			 handler: function(direction) {
6365			   
6366					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
6367						 waypoint.destroy();
6368						return;
6369					}
6370				
6371					$that.each(function(i){
6372						
6373						var $listItemAnimationDelay = ( $that.is('[data-direction="horizontal"]') ) ? 100 : 300;
6374						
6375						$(this).find('.nectar-icon-list-item').each(function(i){
6376							var $thatt = $(this);
6377							setTimeout(function(){ $thatt.addClass('animated') },i*$listItemAnimationDelay);
6378						});
6379						
6380					});
6381
6382					$that.addClass('completed');
6383
6384					waypoint.destroy();
6385
6386			  },
6387			  offset: $iconListOffsetPos
6388		});
6389
6390	});
6391}
6392
6393//bg color match 
6394
6395function narrowParentBGC(element) {
6396	
6397	var narrowedBGC;
6398	
6399	if(element.parents('.wpb_column[data-bg-color*="#"]').length > 0 && element.parents('.wpb_column[data-bg-opacity="1"]').length > 0) {
6400		var narrowedBGC = element.parents('.wpb_column').attr('data-bg-color');
6401	}
6402	else if(element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color').length > 0) {
6403		var narrowedBGC = element.parents('.wpb_row').find('.row-bg.using-bg-color').css('background-color');
6404	}
6405	else {
6406		if($('#nectar_fullscreen_rows').length > 0)
6407			var narrowedBGC = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color');
6408		else 
6409			var narrowedBGC = $('.container-wrap').css('background-color');
6410	}
6411	
6412	return narrowedBGC;
6413	
6414}
6415
6416var nectarMatchingBGCss = '';
6417
6418function nectarIconMatchColoring() {
6419	
6420	//icon list
6421	$('.nectar-icon-list[data-icon-style="border"], .nectar_icon_wrap[data-style="border-animation"][data-color*="extra-color-gradient-"]').each(function(i){
6422		
6423		var $bgColorToSet = narrowParentBGC($(this));
6424		
6425		if($(this).hasClass('nectar-icon-list')) 
6426			$(this).find('.list-icon-holder').css('background-color',$bgColorToSet);
6427		else {
6428			//must be set in css, can't manip pseudo
6429			$(this).removeClass(function (index, className) {
6430			    return (className.match (/(^|\s)instance-\S+/g) || []).join(' ');
6431			});
6432			$(this).addClass('instance-'+i);
6433			nectarMatchingBGCss += '.nectar_icon_wrap.instance-'+i+' .nectar_icon:before { background-color: '+$bgColorToSet+'!important; }';
6434		}
6435			
6436	});
6437
6438	//material gradient btns
6439	$('body.material .nectar-button.see-through[class*="m-extra-color-gradient"]').each(function(i){
6440		
6441		var $bgColorToSet = narrowParentBGC($(this));
6442		
6443		$(this).removeClass(function (index, className) {
6444				return (className.match (/(^|\s)instance-\S+/g) || []).join(' ');
6445		});
6446		$(this).addClass('instance-'+i);
6447		nectarMatchingBGCss += '.nectar-button.see-through.instance-'+i+':after { background-color: '+$bgColorToSet+'!important; }';
6448		
6449	});
6450
6451	if(nectarMatchingBGCss.length > 0) {
6452		var head = document.head || document.getElementsByTagName('head')[0];
6453		var style = document.createElement('style');
6454
6455		style.type = 'text/css';
6456		if (style.styleSheet){
6457		  style.styleSheet.cssText = nectarMatchingBGCss;
6458		} else {
6459		  style.appendChild(document.createTextNode(nectarMatchingBGCss));
6460		}
6461		
6462		$(style).attr('id','nectaricon-color-match');
6463		$('head #nectaricon-color-match').remove();
6464		head.appendChild(style);
6465	}
6466	
6467}
6468nectarIconMatchColoring();
6469
6470
6471/***************** Hotspot ******************/
6472//add pulse animation
6473$('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function(){
6474	$(this).find('.nectar_hotspot_wrap').each(function(i){
6475		var $that = $(this);
6476		setTimeout(function(){
6477			$that.find('.nectar_hotspot').addClass('pulse');
6478		},i*300);	
6479	});
6480});
6481
6482
6483
6484function hotSpotHoverBind() {
6485
6486	var hotSpotHoverTimeout = [];
6487
6488	$('.nectar_image_with_hotspots:not([data-tooltip-func="click"]) .nectar_hotspot').each(function(i){
6489		
6490		hotSpotHoverTimeout[i] = '';
6491
6492		$(this).on('mouseover', function(){
6493			clearTimeout(hotSpotHoverTimeout[i]);
6494			$(this).parent().css({'z-index':'400', 'height':'auto','width':'auto'});
6495		});
6496
6497		$(this).on('mouseleave', function(){
6498
6499			var $that = $(this);
6500			$that.parent().css({'z-index':'auto'});
6501
6502			hotSpotHoverTimeout[i] = setTimeout(function(){
6503				$that.parent().css({'height':'30px','width':'30px'});
6504			},300);
6505
6506		});
6507
6508	});
6509
6510}
6511
6512hotSpotHoverBind();
6513
6514function responsiveTooltips() {
6515
6516	$('.nectar_image_with_hotspots').each(function(){
6517		$(this).find('.nectar_hotspot_wrap').each(function(i){
6518			
6519			if(  window.innerWidth > 690) {
6520
6521				//remove click if applicable
6522				if($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) {
6523					$(this).find('.nectar_hotspot').removeClass('click');
6524					$(this).find('.nttip').removeClass('open');
6525				}
6526				$(this).find('.nttip .inner a.tipclose').remove();
6527				$('.nttip').css('height','auto');
6528
6529				//reset for positioning
6530				$(this).css({'width': 'auto','height': 'auto'});
6531				$(this).find('.nttip').removeClass('force-right').removeClass('force-left').removeClass('force-top').css('width','auto');
6532
6533				var $tipOffset = $(this).find('.nttip').offset();
6534
6535				//against right side fix
6536				if($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200)
6537					$(this).find('.nttip').css('width','250px');
6538				else 
6539					$(this).find('.nttip').css('width','auto');
6540
6541				//responsive
6542				if($tipOffset.left < 0)
6543					$(this).find('.nttip').addClass('force-right');
6544				else if($tipOffset.left + $(this).find('.nttip').outerWidth(true) >  window.innerWidth )
6545					$(this).find('.nttip').addClass('force-left').css('width','250px');
6546				else if($tipOffset.top + $(this).find('.nttip').height() + 35 > $(window).height() && $('#nectar_fullscreen_rows').length > 0)
6547					$(this).find('.nttip').addClass('force-top');
6548
6549				if($(this).find('> .open').length == 0)
6550					$(this).css({'width': '30px','height': '30px'});
6551
6552			} else {
6553				//fixed position
6554				$(this).find('.nttip').removeClass('force-left').removeClass('force-right').removeClass('force-top');
6555				$(this).find('.nectar_hotspot').addClass('click');
6556			
6557				if($(this).find('.nttip a.tipclose').length == 0)
6558					$(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span></span></a>');
6559
6560				//change height of fixed
6561				$('.nttip').css('height',$(window).height());
6562			}
6563		});
6564	});
6565
6566
6567}
6568responsiveTooltips();
6569
6570function imageWithHotspotClickEvents() {
6571	//click
6572	$('body').on('click','.nectar_hotspot.click',function(){
6573		$(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
6574		$(this).parent().find('.nttip').addClass('open');
6575
6576		$(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open');
6577		$(this).parent().find('.nectar_hotspot').addClass('open');
6578
6579		if( window.innerWidth > 690) {
6580			$(this).parent().css({'z-index':'120', 'height':'auto','width':'auto'});
6581
6582			var $that = $(this);
6583
6584			setTimeout(function(){
6585				$that.parents('.nectar_image_with_hotspots').find('.nectar_hotspot_wrap').each(function(){
6586					if($(this).find('> .open').length == 0)
6587						$(this).css({'height':'30px','width':'30px', 'z-index':'auto'});
6588				});
6589			},300);
6590		}
6591
6592		if(  window.innerWidth <= 690) $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index','200');
6593
6594		return false;
6595	});
6596
6597	$('body').on('click','.nectar_hotspot.open',function(){
6598		$(this).parent().find('.nttip').removeClass('open');
6599		$(this).parent().find('.nectar_hotspot').removeClass('open');
6600
6601		$(this).parents('.wpb_row').css('z-index','auto');
6602
6603		return false;
6604	});
6605
6606	$('body').on('click','.nttip.open',function(){
6607		if(  window.innerWidth < 690) {
6608			$(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
6609			$(this).parents('.wpb_row').css('z-index','auto');
6610			return false;
6611		}
6612	});
6613}
6614imageWithHotspotClickEvents();
6615
6616function imageWithHotspots() {
6617
6618	var $imageWithHotspotsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '50%';
6619
6620	$($fullscreenSelector+'.nectar_image_with_hotspots[data-animation="true"]').each(function(i){
6621
6622		var $that = $(this);
6623		var waypoint = new Waypoint({
6624 			element: $that,
6625 			 handler: function(direction) {
6626			   
6627					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
6628						 waypoint.destroy();
6629						return;
6630					}
6631
6632					$that.addClass('completed');
6633					$that.find('.nectar_hotspot_wrap').each(function(i){
6634						var $that2 = $(this);
6635						var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0;
6636						setTimeout(function(){
6637							$that2.addClass('animated-in');
6638						},175*(i+$extrai));
6639					});
6640
6641					waypoint.destroy();
6642
6643			  },
6644			  offset: $imageWithHotspotsOffsetPos
6645		});
6646
6647	});
6648}
6649
6650
6651/***************** Animated Title ******************/
6652function animated_titles() {
6653	var $animatedTitlesOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
6654
6655	$($fullscreenSelector+'.nectar-animated-title').each(function(i){
6656
6657		var $that = $(this);
6658		var waypoint = new Waypoint({
6659 			element: $that,
6660 			 handler: function(direction) {
6661			   
6662					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
6663						 waypoint.destroy();
6664						return;
6665					}
6666
6667					$that.addClass('completed');
6668
6669					waypoint.destroy();
6670
6671			  },
6672			  offset: $animatedTitlesOffsetPos
6673		});
6674
6675	});
6676}
6677
6678
6679/***************** Highlighted Text ******************/
6680function highlighted_text() {
6681	var $highlightedTextOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
6682
6683	$($fullscreenSelector+'.nectar-highlighted-text').each(function(i){
6684		
6685		/*custom color*/
6686		if($(this).is('[data-using-custom-color="true"]')) {
6687			
6688				var highlightedColorCss = '';
6689				var $custom_highlight_color = $(this).attr('data-color');
6690			
6691				$(this).addClass('instance-'+i);
6692			
6693				highlightedColorCss += '.nectar-highlighted-text.instance-' + i + ' em:before { background-color: ' + $custom_highlight_color + '; }';
6694			
6695				if(highlightedColorCss.length > 1) {
6696		
6697					var head = document.head || document.getElementsByTagName('head')[0];
6698					var style = document.createElement('style');
6699		
6700						style.type = 'text/css';
6701					if (style.styleSheet){
6702					  style.styleSheet.cssText = highlightedColorCss;
6703					} else {
6704					  style.appendChild(document.createTextNode(highlightedColorCss));
6705					}
6706		
6707					head.appendChild(style);
6708				}
6709			
6710		}
6711		
6712		if(nectarDOMInfo.usingMobileBrowser) {
6713			$(this).find('em').addClass('animated');
6714		}
6715		
6716		/*waypoint*/
6717		var $that = $(this);
6718		var waypoint = new Waypoint({
6719 			element: $that,
6720 			 handler: function(direction) {
6721			   
6722					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 
6723						 waypoint.destroy();
6724						return;
6725					}
6726					
6727					$that.find('em').each(function(i){
6728						var $highlighted_em = $(this);
6729						setTimeout(function(){
6730							$highlighted_em.addClass('animated');
6731						},i*300);
6732
6733					});
6734
6735					waypoint.destroy();
6736
6737			  },
6738			  offset: $highlightedTextOffsetPos
6739		});
6740
6741	});
6742}
6743
6744
6745
6746/***************** Pricing Tables ******************/
6747
6748
6749var $tallestCol;
6750
6751function pricingTableHeight(){
6752	$('.pricing-table[data-style="default"]').each(function(){
6753		$tallestCol = 0;
6754		
6755		$(this).find('> div ul').each(function(){
6756			($(this).height() > $tallestCol) ? $tallestCol = $(this).height() : $tallestCol = $tallestCol;
6757		});	
6758		
6759		//safety net incase pricing tables height couldn't be determined
6760		if($tallestCol == 0) $tallestCol = 'auto';
6761		
6762		//set even height
6763		$(this).find('> div ul').css('height',$tallestCol);
6764
6765	});
6766}
6767
6768pricingTableHeight();
6769
6770 
6771/***************** Testimonial Slider ******************/
6772
6773//testimonial slider controls
6774
6775//non minimal
6776$('body').on('click','.testimonial_slider:not([data-style*="multiple_visible"]):not([data-style="minimal"]) .controls li', function(){
6777	
6778	if($(this).find('span').hasClass('active')) return false;
6779	
6780	var $frontEndEditorTestimonialDiv =  ($('body.vc_editor').length > 0) ? '> div': 'blockquote';
6781	var $index = $(this).index();
6782	var currentHeight = $(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).height();
6783	
6784	$(this).parents('.testimonial_slider').find('li span').removeClass('active');
6785	$(this).find('span').addClass('active');
6786	
6787	$(this).parents('.testimonial_slider').find('.slides '+$frontEndEditorTestimonialDiv).addClass('no-trans');
6788	$(this).parents('.testimonial_slider').find('.slides '+$frontEndEditorTestimonialDiv).css({'opacity':'0', 'transform': 'translateX(-25px)', 'z-index': '1'});
6789	$(this).parents('.testimonial_slider').find('.slides '+$frontEndEditorTestimonialDiv).eq($index).removeClass('no-trans').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
6790	$(this).parents('.testimonial_slider:not(.disable-height-animation)').find('.slides').stop(true,true).animate({'height' : currentHeight + 40 + 'px' },450,'easeOutCubic');
6791	
6792	resizeVideoToCover();
6793});
6794
6795//minimal
6796$('body').on('click','.testimonial_slider[data-style="minimal"] .testimonial-next-prev a', function(){
6797	
6798	var $frontEndEditorTestimonialDiv =  ($('body.vc_editor').length > 0) ? '> div': 'blockquote';
6799	var $index = $(this).parents('.testimonial_slider').find('.slides '+$frontEndEditorTestimonialDiv+'.active').index();
6800	var $actualIndex = $index;
6801
6802	$(this).parents('.testimonial_slider').find('.slides '+$frontEndEditorTestimonialDiv).addClass('no-trans');
6803	$(this).parents('.testimonial_slider').find('.slides '+$frontEndEditorTestimonialDiv).css({'opacity':'0', 'transform': 'translateX(-25px)', 'z-index': '1'});
6804
6805
6806	$(this).parents('.testimonial_slider').find('.slides '+$frontEndEditorTestimonialDiv).eq($index).removeClass('active');
6807
6808	if($(this).hasClass('next')) {
6809		if($index+1 >= $(this).parents('.testimonial_slider').find('.slides '+$frontEndEditorTestimonialDiv).length) { 
6810			$actualIndex = 0; 
6811		} else {
6812			$actualIndex = $index+1; 
6813		}
6814		var currentHeight = $(this).parents('.testimonial_slider').find('.slides '+$frontEndEditorTestimonialDiv).eq($actualIndex).height();
6815		//show slide
6816		$(this).parents('.testimonial_slider').find('.slides '+$frontEndEditorTestimonialDiv).eq($actualIndex).addClass('active').removeClass('no-trans').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
6817		//change pag #
6818		$(this).parents('.testimonial_slider').find('.control-wrap ul').css({'transform':'translateX(-'+(20*$actualIndex)+'px)'});
6819	} else {
6820		if($index-1 == -1) { 
6821			$actualIndex = $(this).parents('.testimonial_slider').find('.slides '+$frontEndEditorTestimonialDiv).length-1; 
6822		} else {
6823			$actualIndex = $index-1; 
6824		}
6825		var currentHeight = $(this).parents('.testimonial_slider').find('.slides '+$frontEndEditorTestimonialDiv).eq($index-1).height();
6826		//show slide
6827		$(this).parents('.testimonial_slider').find('.slides '+$frontEndEditorTestimonialDiv).eq($index-1).addClass('active').removeClass('no-trans').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
6828		//change pag #
6829		$(this).parents('.testimonial_slider').find('.control-wrap ul').css({'transform':'translateX(-'+(20*$actualIndex)+'px)'});
6830	}
6831	
6832	
6833	$(this).parents('.testimonial_slider:not(.disable-height-animation)').find('.slides').stop(true,true).animate({'height' : currentHeight + 40 + 'px' },450,'easeOutCubic');
6834	
6835	resizeVideoToCover();
6836
6837	return false;
6838});
6839
6840
6841var $tallestQuote;
6842
6843var $testimonialSlider = [];
6844
6845//create controls
6846function createTestimonialControls() {
6847	
6848	var $frontEndEditorTestimonialDiv =  ($('body.vc_editor').length > 0) ? '> div': 'blockquote';
6849	
6850	//fadeIn
6851	$('.testimonial_slider:not([data-style*="multiple_visible"])').animate({'opacity':'1'},800);
6852
6853	$('.testimonial_slider:not([data-style*="multiple_visible"])').each(function(i){
6854		
6855		if($(this).find('blockquote').length > 1) {
6856			$(this).find('.controls, .testimonial-next-prev').remove();
6857			$(this).append('<div class="controls"><ul></ul></div>');
6858			
6859			var slideNum = $(this).find('blockquote').length;
6860			var $that = $(this);
6861			
6862			for(var i=0;i<slideNum;i++) {
6863
6864				if( !$(this).is('[data-style="minimal"]') ) {
6865					$that.find('.controls ul').append('<li><span class="pagination-switch"></span></li>');
6866				} else {
6867					$that.find('.controls ul').append('<li>'+(i+1)+'</li>');
6868				}
6869			}
6870			
6871			//minimal
6872			if( $(this).is('[data-style="minimal"]') ) {
6873
6874				//add next/prev
6875				$(this).append('<div class="testimonial-next-prev"><a href="#" class="prev fa fa-angle-left"></a><a href="#" class="next fa fa-angle-right"></a></div>');
6876
6877				//start on first
6878				if($(this).find('.active').length == 0) {
6879					$(this).find('.slides '+$frontEndEditorTestimonialDiv +':first-child').addClass('active').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
6880					if(	!$(this).hasClass('disable-height-animation') ) {
6881						$(this).find('.slides').css({'height' : $(this).find('.slides '+$frontEndEditorTestimonialDiv +':first-child').height() + 40 + 'px' });
6882					}
6883				}
6884
6885				//autorotate
6886				if($(this).attr('data-autorotate').length > 0) {
6887					var slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
6888					var $that = $(this);
6889					var $rotate = setInterval(function(){ testimonialRotate($that) },slide_interval);
6890				}
6891				$(this).find('.testimonial-next-prev a').on('click',function(e){
6892					if(typeof e.clientX != 'undefined') clearInterval($rotate);
6893				});
6894
6895				//wrap bullets
6896				$(this).find('.controls ul').wrap('<div class="control-wrap" />');
6897				$(this).find('.controls ul').css('width', (($(this).find('.controls ul li').length * 20) +1) + 'px');
6898				$(this).find('.controls').append('<span class="out-of">/</span><span class="total">'+$(this).find('blockquote').length+'</span>');
6899
6900				////swipe for testimonials
6901				$(this).swipe({
6902				
6903					swipeLeft : function(e) {
6904						$(this).find('.testimonial-next-prev .next').trigger('click');
6905						e.stopImmediatePropagation();
6906						clearInterval($rotate);
6907						return false;
6908					 },
6909					 swipeRight : function(e) {
6910						$(this).find('.testimonial-next-prev .prev').trigger('click');
6911						e.stopImmediatePropagation();
6912						clearInterval($rotate);
6913						return false;
6914					 }    
6915				});
6916
6917
6918			}
6919
6920			//non minimal
6921			if( !$(this).is('[data-style="minimal"]') ) {
6922
6923				//activate first slide
6924				$(this).find('.controls ul li').first().click();
6925
6926				//autorotate
6927				if($(this).attr('data-autorotate').length > 0) {
6928					var slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
6929					var $that = $(this);
6930					var $rotate = setInterval(function(){ testimonialRotate($that) },slide_interval);
6931				}
6932				
6933				$(this).find('.controls li').on('click',function(e){
6934					if(typeof e.clientX != 'undefined') clearInterval($rotate);
6935				});
6936				
6937				////swipe for testimonials
6938				$(this).swipe({
6939				
6940					swipeLeft : function(e) {
6941						$(this).find('.controls ul li span.active').parent().next('li').find('span').trigger('click');
6942						e.stopImmediatePropagation();
6943						clearInterval($rotate);
6944						return false;
6945					 },
6946					 swipeRight : function(e) {
6947						$(this).find('.controls ul li span.active').parent().prev('li').find('span').trigger('click');
6948						e.stopImmediatePropagation();
6949						clearInterval($rotate);
6950						return false;
6951					 }    
6952				});
6953
6954		}
6955		} 
6956		//only one testimonial
6957		else if($(this).find('.controls').length == 0) {
6958			var currentHeight = $(this).find('.slides blockquote').height();
6959			$(this).find('.slides blockquote').css({'opacity':'0', 'transform': 'translateX(-25px)', 'z-index': '1'});
6960			$(this).find('.slides blockquote').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
6961			$(this).find('.slides').stop(true,true).animate({'height' : currentHeight + 20 + 'px' },450,'easeOutCubic');
6962		}
6963	});
6964
6965
6966  $testimonialSlider = [];
6967		
6968	$('.testimonial_slider[data-style*="multiple_visible"] .slides').each(function(i){
6969	    	var $that = $(this); 
6970	    	var $element = $that;
6971	    	var $autoplay = ($that.parents('.testimonial_slider').attr('data-autorotate').length > 1 && parseInt($that.parents('.testimonial_slider').attr('data-autorotate')) > 100) ? parseInt($that.parents('.testimonial_slider').attr('data-autorotate')) : false;
6972			if($that.find('img').length == 0) $element = $('body');
6973
6974			//move img pos
6975			if( $(this).parents('.testimonial_slider').attr('data-style') != 'multiple_visible_minimal') {
6976				$(this).find('blockquote').each(function(){
6977					$(this).find('.image-icon').insertAfter($(this).find('p'));
6978				});
6979			} else {
6980				//has alf class
6981				if($(this).find('blockquote').length > 4) {
6982					$(this).parents('.testimonial_slider').addClass('has-alf');
6983				}
6984			}
6985			
6986			var $testimonialGroupCells = ($(this).parents('.testimonial_slider').attr('data-style') == 'multiple_visible_minimal') ? true : false;
6987
6988			imagesLoaded($element,function(instance){
6989				
6990				var $frontEndEditorDrag =  ($('body.vc_editor').length > 0) ? false: true;
6991				var $frontEndEditorPause =  ($('body.vc_editor').length > 0) ? true: false;
6992
6993		    	$testimonialSlider[i] = $that.flickity({
6994		    		contain: true,
6995					  draggable: $frontEndEditorDrag,
6996					  groupCells: $testimonialGroupCells,
6997					  lazyLoad: false,
6998					  imagesLoaded: true,
6999					  percentPosition: true,
7000					  prevNextButtons: false,
7001					  pageDots: true,
7002					  resize: true,
7003					  setGallerySize: true,
7004					  wrapAround: true,
7005					  autoPlay: $autoplay,
7006						pauseAutoPlayOnHover: $frontEndEditorPause,
7007					  accessibility: false
7008		    	});
7009					
7010					if($testimonialSlider[i].find('.vc_element.is-selected > blockquote').length > 0) {
7011						
7012						//starting
7013						$testimonialSlider[i].find('.vc_element.is-selected > blockquote').addClass('is-selected');
7014						
7015						//changed
7016						$testimonialSlider[i].on( 'select.flickity', function() {
7017							$testimonialSlider[i].find('.vc_element > blockquote').removeClass('is-selected');
7018							$testimonialSlider[i].find('.vc_element.is-selected > blockquote').addClass('is-selected');
7019						});
7020					}
7021					
7022
7023			    $that.parents('.testimonial_slider').css('opacity','1');
7024			    
7025
7026		     });//images loaded
7027		     	     
7028	    });//each	
7029
7030
7031}
7032createTestimonialControls();
7033
7034function testimonialRotate(slider){
7035	
7036	var $testimonialLength = slider.find('li').length;
7037	var $currentTestimonial = slider.find('.pagination-switch.active').parent().index();
7038	
7039	//stop the rotation when toggles are closed
7040	if( slider.parents('.toggle').length > 0 && slider.parents('.toggle').hasClass('open') ) {
7041
7042		if( !slider.is('[data-style="minimal"]') ) {
7043			if( $currentTestimonial+1 == $testimonialLength) {
7044				slider.find('ul li:first-child').click();
7045			} else {
7046				slider.find('.pagination-switch.active').parent().next('li').click();
7047			}
7048		} else {
7049			slider.find('.testimonial-next-prev .next').click();
7050		}
7051			
7052	} else {
7053		
7054		if( !slider.is('[data-style="minimal"]') ) {
7055			if( $currentTestimonial+1 == $testimonialLength) {
7056				slider.find('ul li:first-child').click();
7057			} else {
7058				slider.find('.pagination-switch.active').parent().next('li').click();
7059			}
7060		} else {
7061			slider.find('.testimonial-next-prev .next').click();
7062		}
7063	
7064	}
7065
7066}
7067
7068function testimonialHeightResize(){
7069	$('.testimonial_slider:not(.disable-height-animation):not([data-style*="multiple_visible"])').each(function(){
7070		
7071		var $frontEndEditorTestimonialDiv =  ($('body.vc_editor').length > 0) ? '> div': 'blockquote';
7072		
7073		var $index = $(this).find('.controls ul li span.active').parent().index();
7074		var currentHeight = $(this).find('.slides '+$frontEndEditorTestimonialDiv).eq($index).height();
7075		$(this).find('.slides').stop(true,true).css({'height' : currentHeight + 40 + 'px' });
7076		
7077	});
7078}
7079
7080
7081function testimonialSliderHeight() {
7082		
7083	$('.testimonial_slider.disable-height-animation:not([data-style*="multiple_visible"])').each(function(){
7084		$tallestQuote = 0;
7085			
7086		$(this).find('blockquote').each(function(){
7087			($(this).height() > $tallestQuote) ? $tallestQuote = $(this).height() : $tallestQuote = $tallestQuote;
7088		});	
7089		
7090		//safety net incase height couldn't be determined
7091		if($tallestQuote == 0) $tallestQuote = 100;
7092		
7093		//set even height
7094		$(this).find('.slides').css('height',$tallestQuote+40+'px');
7095		
7096		//show the slider once height is set
7097		$(this).animate({'opacity':'1'});
7098
7099		fullWidthContentColumns();
7100
7101	});
7102
7103
7104}
7105
7106function testimonialSliderHeightMinimalMult() {
7107		
7108	$('.testimonial_slider[data-style="multiple_visible_minimal"]').each(function(){
7109		$tallestQuote = 0;
7110		
7111		$(this).find('blockquote > .inner p').css('height','auto');
7112		
7113		$(this).find('blockquote > .inner p').each(function(){
7114			($(this).height() > $tallestQuote) ? $tallestQuote = $(this).height() : $tallestQuote = $tallestQuote;
7115		});	
7116		
7117		//safety net incase height couldn't be determined
7118		if($tallestQuote == 0) $tallestQuote = 200;
7119		
7120		//set even height
7121		$(this).find('blockquote > .inner p').css('height',$tallestQuote+'px');
7122		
7123	});
7124
7125}
7126
7127if($('.testimonial_slider.disable-height-animation:not([data-style*="multiple_visible"])').length > 0) {
7128	testimonialSliderHeight(); 
7129	setTimeout(testimonialSliderHeight,500);
7130}
7131
7132if($('.testimonial_slider[data-style="multiple_visible_minimal"]').length > 0) {
7133	testimonialSliderHeightMinimalMult();
7134	setTimeout(testimonialSliderHeightMinimalMult,500);
7135}
7136
7137
7138/***************** WP Media Embed / External Embed ******************/
7139
7140//this isn't the for the video shortcode* This is to help any external iframe embed fit & resize correctly 
7141function responsiveVideoIframesInit(){
7142	$('iframe').each(function(){
7143		
7144		//make sure the iframe has a src (things like adsense don't)
7145		if(typeof $(this).attr('src') != 'undefined' && !$(this).hasClass('iframe-embed') && $(this).parents('.ult_modal').length == 0 && $(this).parents('.ls-slide').length == 0 && $(this).parents('.esg-entry-media').length == 0 && $(this).parents('.wpb_video_widget.wpb_content_element').length == 0){
7146			
7147			if( $(this).attr('src').toLowerCase().indexOf("youtube") >= 0 || $(this).attr('src').toLowerCase().indexOf("vimeo") >= 0  || $(this).attr('src').toLowerCase().indexOf("twitch.tv") >= 0 || $(this).attr('src').toLowerCase().indexOf("kickstarter") >= 0 || $(this).attr('src').toLowerCase().indexOf("embed-ssl.ted") >= 0  || $(this).attr('src').toLowerCase().indexOf("dailymotion") >= 0) {
7148				
7149				$(this).addClass('iframe-embed');	
7150
7151				$(this).attr('data-aspectRatio', $(this).height() / $(this).width()).removeAttr('height').removeAttr('width');
7152				
7153				if($(this).parents('.post-area.masonry.classic').length > 0) {
7154						$(this).attr('data-aspectRatio', '0.56').removeAttr('height').removeAttr('width');
7155				}
7156
7157			}
7158			 
7159		}
7160		
7161	});
7162
7163
7164}
7165
7166function responsiveVideoIframes(){
7167	 $('iframe[data-aspectRatio]').each(function() {
7168	 	var newWidth = $(this).parent().width();
7169	 	 
7170		var $el = $(this);
7171		
7172		//in nectar slider
7173		if($(this).parents('.swiper-slide').length > 0) {
7174			if($(this).is(':visible')) $el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
7175		} 
7176		//all others
7177		else {
7178			$el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
7179		}
7180		
7181		
7182	});
7183}
7184
7185
7186function videoshortcodeSize(){
7187	//removed in 9.0.
7188}
7189
7190responsiveVideoIframesInit();
7191responsiveVideoIframes();
7192
7193
7194//unwrap post and protfolio videos
7195$('.video-wrap iframe').unwrap();
7196$('#sidebar iframe[src]').unwrap();
7197
7198$('audio').attr('width','100%');
7199$('audio').attr('height','100%');
7200
7201$('audio').css('visibility','visible');
7202
7203if($('body').hasClass('mobile')){
7204	$('video').css('visibility','hidden');
7205} else {
7206	$('video').css('visibility','visible');
7207}
7208
7209
7210$('.wp-video').each(function(){
7211	 var video = $(this).find('video').get(0);
7212	 video.addEventListener('loadeddata', function() {
7213	   $(window).trigger('resize');
7214	 }, false);
7215});
7216
7217//webkit video back button fix 
7218$('.main-content iframe[src]').each(function(){
7219	$(this).css({'opacity':'1', 'visibility':'visible'});
7220});
7221
7222
7223/***************** Nectar Video BG ******************/
7224
7225	$('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function(i){
7226		$(this).css('z-index',100 + i);
7227	});
7228
7229	var min_w = 1200; // minimum video width allowed
7230	var vid_w_orig;  // original video dimensions
7231	var vid_h_orig;
7232	
7233    vid_w_orig = 1280;
7234    vid_h_orig = 720;
7235 
7236	function resizeVideoToCover() {
7237		$('.nectar-video-wrap').each(function(i){
7238			if($(this).find('video').length == 0 ) return;
7239
7240			if($(this).parents('#page-header-bg').length > 0) {
7241				if($('.container-wrap.auto-height').length > 0) return false;
7242				var $containerHeight = $(this).parents('#page-header-bg').outerHeight();			
7243				var $containerWidth = $(this).parents('#page-header-bg').outerWidth();
7244			} else {
7245				
7246				if($(this).hasClass('column-video')) {
7247					var $containerHeight = $(this).parents('.wpb_column').outerHeight();			
7248					var $containerWidth = $(this).parents('.wpb_column').outerWidth();			
7249				} else {
7250					var $containerHeight = $(this).parents('.wpb_row').outerHeight();			
7251					var $containerWidth = ($(this).parents('.full-width-section').length > 0) ? window.innerWidth : $(this).parents('.wpb_row').outerWidth();			
7252				}	
7253			}
7254			
7255		    // set the video viewport to the window size
7256		    $(this).width($containerWidth);
7257				if($(this).parents('#page-header-bg').length > 0) {
7258			    $(this).height($containerHeight);
7259				}
7260		
7261		    // use largest scale factor of horizontal/vertical
7262		    var scale_h = $containerWidth / vid_w_orig;
7263		    var scale_v = ($containerHeight - $containerHeight) / vid_h_orig; 
7264		    var scale = scale_h > scale_v ? scale_h : scale_v;
7265			
7266			//update minium width to never allow excess space
7267		    min_w = 1280/720 * ($containerHeight+40);
7268		    
7269		    // don't allow scaled width < minimum video width
7270		    if (scale * vid_w_orig < min_w) {scale = min_w / vid_w_orig;}
7271		        
7272		    // now scale the video
7273		    $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig +0));
7274		    $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig +0));
7275		    
7276		    // and center it by scrolling the video viewport
7277		    $(this).scrollLeft(($(this).find('video').width() - $containerWidth) / 2);
7278		    $(this).scrollTop(($(this).find('video').height() - ($containerHeight)) / 2);
7279		    $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($containerHeight)) / 2);
7280
7281
7282		    //align bottom
7283		    if($(this).attr('data-bg-alignment') == 'center bottom' || $(this).attr('data-bg-alignment') == 'bottom'){
7284		    	$(this).scrollTop(($(this).find('video').height() - ($containerHeight+6)));
7285		    }
7286		    //align top
7287		    else if($(this).attr('data-bg-alignment') == 'center top' || $(this).attr('data-bg-alignment') == 'top') {
7288		    	$(this).scrollTop(0);
7289		    } 
7290				
7291				//add loaded class
7292				$(this).addClass('position-loaded');
7293		});
7294	}
7295    
7296    //init
7297    function videoBGInit(){
7298	    setTimeout(function(){
7299	    	resizeVideoToCover();
7300	    	$('.video-color-overlay').each(function(){
7301	    		$(this).css('background-color',$(this).attr('data-color'));
7302	    	});
7303	    	$('.nectar-video-wrap').each(function(i){
7304
7305	    		if($(this).find('video').length == 0) return;
7306
7307	    		var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false;
7308	    		var $that = $(this);
7309
7310	    		 var videoReady = setInterval(function(){
7311
7312	        		if($that.find('video').get(0).readyState > 3) {
7313								
7314								if(!nectarDOMInfo.usingMobileBrowser) {
7315		        			$that.transition({'opacity':'1'},400);
7316				    			$that.find('video').transition({'opacity':'1'},400);
7317				    			$that.parent().find('.video-color-overlay').transition({'opacity':'0.7'},400);
7318									if($headerVideo == true) {
7319					    			pageHeaderTextEffect();
7320								  }
7321								}
7322
7323							//remove page loading screen
7324							$('#ajax-loading-screen').addClass('loaded');
7325							setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
7326					
7327
7328							clearInterval(videoReady);
7329						}
7330						
7331	    		},60);
7332					
7333					if(nectarDOMInfo.usingMobileBrowser) {
7334						if($that.parents('.full-width-section').length > 0 && $that.parents('#nectar_fullscreen_rows').length == 0) {
7335							$that.css('left','50%');
7336						} else {
7337							$that.css('left','0px');
7338						}
7339						
7340						if($headerVideo == true) {
7341							pageHeaderTextEffect();
7342						}
7343						$that.find('video')[0].onplay = function(){
7344							$that.transition({'opacity':'1'},400);
7345							$that.find('video').transition({'opacity':'1'},400);
7346							$that.parent().find('.video-color-overlay').transition({'opacity':'0.7'},400);
7347						};
7348					}
7349	    		
7350	    	});
7351	    },300);
7352
7353		if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)){
7354
7355				
7356				$('.nectar-video-wrap').each(function(){
7357					
7358						if(!$(this).find('video').is('[muted]')) {
7359
7360								//autoplay not supported unless muted
7361								$(this).parent().find('.mobile-video-image').show();
7362								$(this).remove();
7363						}
7364						
7365				});
7366		
7367		
7368		}
7369
7370		
7371		 if(navigator.userAgent.indexOf('Chrome') > 0 && !/Edge\/12./i.test(navigator.userAgent) && !/Edge\/\d./i.test(navigator.userAgent)) { 
7372		 	
7373		 	$('.nectar-video-wrap').each(function(i){
7374		 		if(jQuery(this).find('video source[type="video/webm"]').length > 0 ) {
7375				  	var webmSource = jQuery(this).find('video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
7376		          	var firstVideo = jQuery(this).find('video').get(0);
7377		          	firstVideo.src = webmSource;
7378		          	firstVideo.load();
7379		         }
7380            });
7381	    }
7382
7383
7384
7385
7386	    jQuery(".vc_row").each(function() {
7387	        var youtubeUrl, youtubeId, $row = jQuery(this);
7388	        $row.find('.nectar-youtube-bg').length > 0 ? (youtubeUrl = $row.find('.nectar-youtube-bg span').text(), youtubeId = nectarExtractYoutubeId(youtubeUrl), youtubeId && ($row.find(".vc_video-bg").remove(), nectarInsertYoutubeVideoAsBackgroun
7388d($row.find('.nectar-youtube-bg'), youtubeId))) : $row.find(".nectar-youtube-bg").remove()
7389
7390	        //remove yt url
7391	        $row.find('.nectar-youtube-bg span').remove();
7392					
7393					if(!nectarDOMInfo.usingMobileBrowser) {
7394		        $row.find('.nectar-video-wrap, .nectar-youtube-bg').css({'opacity':'1','width':'100%', 'height':'100%'});
7395					}
7396	         $row.find('.video-color-overlay').transition({'opacity':'0.7'},400);
7397	    });
7398		
7399
7400		function nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter) {
7401		    if ("undefined" == typeof YT || void 0 === YT.Player) return 100 < (counter = void 0 === counter ? 0 : counter) ? void console.warn("Too many attempts to load YouTube api") : void setTimeout(function() {
7402		        nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter++)
7403		    }, 100);
7404		    var $container = $element.prepend('<div class="vc_video-bg"><div class="inner"></div></div>').find(".inner");
7405		    new YT.Player($container[0], {
7406		        width: "100%",
7407		        height: "100%",
7408		        videoId: youtubeId,
7409		        playerVars: {
7410		            playlist: youtubeId,
7411		            iv_load_policy: 3,
7412		            enablejsapi: 1,
7413		            disablekb: 1,
7414		            autoplay: 1,
7415		            controls: 0,
7416		            showinfo: 0,
7417		            rel: 0,
7418		            loop: 1
7419		        },
7420		        events: {
7421		            onReady: function(event) {
7422		                event.target.mute().setLoop(!0);
7423										nectarResizeVideoBackground($element);
7424		            }
7425		        }
7426		    }), nectarResizeVideoBackground($element), jQuery(window).on("resize", function() {
7427		        nectarResizeVideoBackground($element);
7428		    });
7429				
7430				setTimeout(function(){
7431					 nectarResizeVideoBackground($element);
7432				},100);
7433		}
7434
7435		function nectarResizeVideoBackground($element) {
7436		    var iframeW, iframeH, marginLeft, marginTop, containerW = $element.innerWidth(),
7437		        containerH = $element.innerHeight(),
7438		        ratio1 = 16,
7439		        ratio2 = 9;
7440		    ratio1 / ratio2 > containerW / containerH ? (iframeW = containerH * (ratio1 / ratio2), 
7441		    	iframeH = containerH, marginLeft = -Math.round((iframeW - containerW) / 2) + "px", marginTop = -Math.round((iframeH - containerH) / 2) + "px", iframeW += "px", iframeH += "px") : (iframeW = containerW, iframeH = containerW * (ratio2 / ratio1), marginTop = -Math.round((iframeH - containerH) / 2) + "px", 
7442		    	marginLeft = -Math.round((iframeW - containerW) / 2) + "px", iframeW += "px", iframeH += "px"), 
7443		    	$element.find(".vc_video-bg iframe").css({
7444			        maxWidth: "1000%",
7445			        marginLeft: marginLeft,
7446			        marginTop: marginTop,
7447			        width: iframeW,
7448			        height: iframeH
7449			    })
7450		}
7451
7452		function nectarExtractYoutubeId(url) {
7453		    if ("undefined" == typeof url) return !1;
7454		    var id = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/);
7455		    return null !== id ? id[1] : !1
7456		}
7457
7458
7459	}
7460
7461	if($('.nectar-video-wrap').length > 0 || $('.nectar-youtube-bg').length > 0) {
7462		videoBGInit();
7463	}
7464
7465
7466/*-------------------------------------------------------------------------*/
7467/*	4.	Header + Search
7468/*-------------------------------------------------------------------------*/	 
7469
7470////mobile megamenus without titles / nested groupings
7471var $mobileNavSelector = ($('.off-canvas-menu-container.mobile-only').length > 0) ? '.off-canvas-menu-container.mobile-only ': '#mobile-menu .container ';
7472$($mobileNavSelector+'.megamenu > ul > li > a').each(function(){
7473	if( $(this).text() == '–' ) {
7474		$navLIs = $(this).parent().find('> ul > li').clone();
7475		$(this).parent().find('ul').remove();
7476		$(this).parent().parent().append($navLIs);
7477		$(this).parent().remove();
7478	}
7479});
7480
7481/***************** Slide Out Widget Area **********/
7482
7483var $bodyBorderHeaderColorMatch = ($('.body-border-top').css('background-color') == '#ffffff' && $('body').attr('data-header-color') == 'light' || $('.body-border-top').css('background-color') == $('#header-outer').attr('data-user-set-bg')) ? true : false;
7484var $bodyBorderWidth = ($('.body-border-right').length > 0) ? $('.body-border-right').width() : 0;
7485var $resetHeader;
7486
7487
7488function mobileBreakPointCheck() {
7489	var $mobileBreakpoint = ( $('body[data-header-breakpoint]').length > 0 && $('body').attr('data-header-breakpoint') != '1000' ) ? parseInt($('body').attr('data-header-breakpoint')) : 1000;
7490	var $withinCustomBreakpoint = false;
7491
7492	if($mobileBreakpoint != 1000) {
7493		if( $('body[data-user-set-ocm="1"][data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0 && window.innerWidth > 1000 && window.innerWidth <= $mobileBreakpoint ) {
7494			$withinCustomBreakpoint = true;
7495		}
7496	}
7497
7498	return $withinCustomBreakpoint;
7499}
7500
7501//icon effect html creation
7502if($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) {
7503
7504	if($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) {
7505		$('<div class="slide-out-widget-area-toggle slide-out-hover-icon-effect" data-icon-animation="simple-transform"><div> <a href="#sidewidgetarea" class="closed"> <span> <i class="lines-button x2"> <i class="lines"></i> </i> </span> </a> </div> </div>').insertAfter('#slide-out-widget-area');
7506		if($('#header-outer[data-has-menu="true"]').length > 0 || $('body[data-header-search="true"]').length > 0) $('#ajax-content-wrap > .slide-out-widget-area-toggle').addClass('small');
7507	}
7508
7509
7510	function calculateHoverNavMinHeight() {
7511		$widgetHeights = 0;
7512		$('#slide-out-widget-area > .widget').each(function(){
7513			$widgetHeights += $(this).height();
7514		});
7515		$menuHeight = ( ($('#slide-out-widget-area').height() - 25 - $('.bottom-meta-wrap').outerHeight(true) -$widgetHeights) > $('#slide-out-widget-area .off-canvas-menu-container:last-child').height() ) ? $('#slide-out-widget-area').height() - 25 - $('.bottom-meta-wrap').outerHeight(true) -$widgetHeights : $('#slide-out-widget-area .off-canvas-menu-container:last-child').height();
7516
7517		$('#slide-out-widget-area .inner').css({'height':'auto', 'min-height': $menuHeight  });
7518
7519		$('#slide-out-widget-area.slide-out-from-right-hover > .inner .off-canvas-menu-container').transition({ y : '-' + ($('#slide-out-widget-area.slide-out-from-right-hover > .inner .off-canvas-menu-container:last-child').height()/2) + 'px' },0);
7520	
7521	}
7522
7523	function openRightHoverNav() {
7524
7525		
7526
7527			calculateHoverNavMinHeight();
7528
7529			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && $('#slide-out-widget-area.open').length > 0) {
7530				mobileCloseNavCheck();
7531				return;
7532			}
7533			
7534
7535			$('#slide-out-widget-area').css({ 'transform': 'translate3d(0,0,0)' }).addClass('open');
7536
7537			var $bodyBorderHeaderColorMatch = ($('.body-border-top').length > 0 && $('.body-border-top').css('background-color') == '#ffffff' && $('body').attr('data-header-color') == 'light' || $('.body-border-top').length > 0 && $('.body-border-top').css('background-color') == $('#header-outer').attr('data-user-set-bg')) ? true : false;
7538
7539			//icon effect
7540			////set pos 
7541			if($('header#top .container .span_9 > .slide-out-widget-area-toggle').length > 0) {
7542				
7543				var secondaryBarHeight = ($('#header-secondary-outer').length > 0) ? $('#header-secondary-outer').height() : 0; 
7544				
7545
7546				if($('body.mobile').length > 0) {
7547
7548					$('.slide-out-hover-icon-effect').css({'top': $('header#top .span_9 > .slide-out-widget-area-toggle a').offset().top - $(window).scrollTop(), 'right': parseInt($('#header-outer header > .container').css('padding-right')) + 1 });
7549				} else {
7550
7551					if($bodyBorderHeaderColorMatch) {
7552
7553						var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1;
7554						$('.slide-out-hover-icon-effect').css({
7555							'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')), 
7556							'right': 29 + $extraCushion });
7557
7558					} else {
7559
7560						var $withinCustomBreakpoint = mobileBreakPointCheck();
7561
7562						if($('body.ascend').length > 0 && $withinCustomBreakpoint != true) {
7563							var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1;
7564							$('.slide-out-hover-icon-effect').css({'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')), 'right': parseInt($('#header-outer header >.container').css('padding-right')) + $extraCushion });
7565						} else {
7566
7567							if($('body.material').length > 0) {
7568								if($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) {
7569									var $nectarHamMenuPos = ($('header#top .span_9 > .slide-out-widget-area-toggle').css('display') == 'block') ? $('#header-outer header#top > .container .span_9 > .slide-out-widget-area-toggle.mobile-icon').position() : $('header#top .span_3 .right-side .slide-out-widget-area-toggle > div').offset();
7570									if($('#header-secondary-outer.hide-up').length > 0) { secondaryBarHeight = 0; }
7571									$('.slide-out-hover-icon-effect').css({'top': secondaryBarHeight + parseInt($nectarHamMenuPos.top) - nectarDOMInfo.scrollTop , 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2  });
7572								} else {
7573									var $nectarHamMenuPos = ($('header#top .span_9 > .slide-out-widget-area-toggle').css('display') == 'block') ? $('#header-outer header#top > .container .span_9 > .slide-out-widget-area-toggle.mobile-icon').position() : $('header#top nav .buttons .slide-out-widget-area-toggle > div').position();
7574									if($('#header-secondary-outer.hide-up').length > 0) { secondaryBarHeight = 0; }
7575									$('.slide-out-hover-icon-effect').css({'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($nectarHamMenuPos.top) , 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2  });
7576								}
7577								
7578								
7579							} else {
7580								$menuToggleSelector = ($('header#top nav > ul .slide-out-widget-area-toggle').length > 0 && $('header#top nav > ul .slide-out-widget-area-toggle').css('display') != 'none') ? $('header#top nav > ul .slide-out-widget-area-toggle') : $('body header#top .span_9 >.slide-out-widget-area-toggle');
7581								$('.slide-out-hover-icon-effect').css({'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($menuToggleSelector.css('padding-top')) + parseInt($('#header-outer').css('padding-top')), 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 1 + parseInt($menuToggleSelector.css('margin-right')) });
7582							}
7583						}
7584					}
7585					
7586				}
7587			}
7588
7589			////open
7590
7591			$('.slide-out-hover-icon-effect .lines-button').removeClass('no-delay').addClass('unhidden-line');
7592			
7593
7594			if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#nectar_fullscreen_rows').length == 0 && !nectarDOMInfo.usingFrontEndEditor) {
7595
7596				if(!($(window).scrollTop() == 0 && $('#header-outer.transparent').length > 0)) {
7597
7598					if($('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
7599
7600						$('#header-outer').attr('data-transparent','true').addClass('no-bg-color').addClass('slide-out-hover');
7601						$('#header-outer header, #header-outer > .cart-outer').addClass('all-hidden');
7602					}
7603
7604				}
7605
7606				if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
7607					var headerResize = $('#header-outer').attr('data-header-resize');
7608					if(headerResize == 1) {
7609
7610						$(window).off('scroll',bigNav);
7611						$(window).off('scroll',smallNav);
7612
7613
7614					} else {
7615						
7616						$(window).off('scroll',opaqueCheck);
7617						$(window).off('scroll',transparentCheck);
7618					}
7619				}
7620
7621			}
7622
7623			if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
7624				$(window).on('mousemove.rightOffsetCheck',closeNavCheck);
7625			}
7626
7627	}
7628
7629	function closeNavCheck(e) {
7630		var $windowWidth = $(window).width();
7631		if(e.clientX < $windowWidth - 340 - $bodyBorderWidth) {
7632
7633				$(window).off('mousemove.rightOffsetCheck',closeNavCheck);
7634
7635				$('#slide-out-widget-area').css({ 'transform': 'translate3d(341px,0,0)' }).removeClass('open');
7636
7637				$('#header-outer').removeClass('style-slide-out-from-right');
7638
7639				$('.slide-out-hover-icon-effect .lines-button').removeClass('unhidden-line').addClass('no-delay');
7640
7641				var $bodyBorderHeaderColorMatch = ($('.body-border-top').length > 0 && $('.body-border-top').css('background-color') == '#ffffff' && $('body').attr('data-header-color') == 'light' || $('.body-border-top').length > 0 && $('.body-border-top').css('background-color') == $('#header-outer').attr('data-user-set-bg')) ? true : false;
7642
7643				if($('#header-outer[data-permanent-transparent="1"]').length == 0) {
7644
7645					if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
7646
7647						if($('body.mobile').length == 0) {
7648							$('#header-outer').removeClass('no-bg-color');
7649							$('#header-outer header, #header-outer > .cart-outer').removeClass('all-hidden');
7650						}
7651					}
7652
7653					if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
7654						var headerResize = $('#header-outer').attr('data-header-resize');
7655						if(headerResize == 1) {
7656						
7657							$(window).off('scroll.headerResizeEffect');
7658							if($(window).scrollTop() == 0) {
7659								$(window).on('scroll.headerResizeEffect',smallNav); 
7660
7661								if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true && $('#header-outer.pseudo-data-transparent').length > 0) {
7662									$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
7663										'padding' : '0'			
7664									},{queue:false, duration:250, easing: 'easeOutCubic'});	
7665								}
7666							}
7667							else {
7668								$(window).on('scroll.headerResizeEffect',bigNav);
7669							}
7670							
7671				
7672						} else {
7673							
7674							$(window).off('scroll.headerResizeEffectOpaque');
7675							$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
7676						}
7677					}
7678				}
7679
7680			}
7681
7682	}
7683
7684	function mobileCloseNavCheck(e) {
7685		
7686
7687				$('#slide-out-widget-area').css({ 'transform': 'translate3d(341px,0,0)' }).removeClass('open');
7688
7689				$('#header-outer').removeClass('style-slide-out-from-right');
7690
7691				$('.slide-out-hover-icon-effect .lines-button').removeClass('unhidden-line').addClass('no-delay');
7692
7693				if($('#header-outer[data-permanent-transparent="1"]').length == 0) {
7694
7695					$('#header-outer').removeClass('no-bg-color');
7696					$('#header-outer header').removeClass('all-hidden');
7697
7698				}
7699
7700				var $bodyBorderHeaderColorMatch = ($('.body-border-top').length > 0 && $('.body-border-top').css('background-color') == '#ffffff' && $('body').attr('data-header-color') == 'light' || $('.body-border-top').length > 0 && $('.body-border-top').css('background-color') == $('#header-outer').attr('data-user-set-bg')) ? true : false;
7701
7702				if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
7703					
7704					var headerResize = $('#header-outer').attr('data-header-resize');
7705					if(headerResize == 1) {
7706					
7707						$(window).off('scroll.headerResizeEffect');
7708						if($(window).scrollTop() == 0) {
7709							$(window).on('scroll.headerResizeEffect',smallNav); 
7710
7711							if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true && $('#header-outer.pseudo-data-transparent').length > 0) {
7712								$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
7713									'padding' : '0'			
7714								},{queue:false, duration:250, easing: 'easeOutCubic'});	
7715							}
7716						}
7717						else {
7718							$(window).on('scroll.headerResizeEffect',bigNav);
7719						}
7720						
7721			
7722					} else {
7723						
7724						$(window).off('scroll.headerResizeEffectOpaque');
7725						$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
7726					}
7727			}
7728
7729			
7730
7731	}
7732
7733	//hover triggered
7734	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
7735		$('body').on('mouseenter','#header-outer .slide-out-widget-area-toggle:not(.std-menu) a',openRightHoverNav);
7736	}
7737	else {
7738		$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a',openRightHoverNav);
7739	}
7740
7741	$(window).on('smartresize',calculateHoverNavMinHeight);
7742
7743}
7744
7745
7746
7747function setMaterialWidth() {
7748	
7749	
7750	$('#slide-out-widget-area.slide-out-from-right').css({
7751		'padding-top' : $(window).height()*0.1,
7752		'padding-bottom' : $(window).height()*0.1
7753	});
7754
7755	slideOutWidgetOverflowState();
7756}
7757
7758if($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) {
7759	setMaterialWidth();
7760}
7761
7762//icon hover effect
7763if($('body.material').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0) {
7764
7765	if($('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0) {
7766		var $menuIconClone = $('header#top nav ul .slide-out-widget-area-toggle a > span > i').clone();
7767		$menuIconClone.addClass('hover-effect');
7768		$('header#top nav ul .slide-out-widget-area-toggle a > span').append($menuIconClone);
7769
7770		var $menuIconClone2 = $('header#top .slide-out-widget-area-toggle.mobile-icon a > span > i').clone();
7771		$menuIconClone2.addClass('hover-effect');
7772		$('header#top .slide-out-widget-area-toggle.mobile-icon a > span').append($menuIconClone2);
7773	}
7774
7775	$('body:not([data-slide-out-widget-area-style="slide-out-from-right"]) header#top .slide-out-widget-area-toggle a > span').append($('<span class="close-wrap"> <span class="close-line close-line1"></span> <span class="close-line close-line2"></span> </span>'));
7776}
7777
7778if($('body.material #boxed').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) {
7779	$('#ajax-content-wrap > .slide-out-widget-area-toggle.slide-out-hover-icon-effect.small').insertAfter('.ocm-effect-wrap');
7780}
7781
7782//move material skin default ocm
7783if($('body.material').length > 0 && $('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0) {
7784	$('body.material #slide-out-widget-area.slide-out-from-right .slide_out_area_close').insertAfter('.ocm-effect-wrap');
7785	$('#slide-out-widget-area-bg').insertAfter('.ocm-effect-wrap');
7786	$('#slide-out-widget-area').insertAfter('.ocm-effect-wrap');
7787	
7788}
7789
7790//remove trans on material search/ocm when resizing 
7791if($('body.material[data-header-search="true"]').length > 0 || $('body.material .ocm-effect-wrap').length > 0 ) {
7792		
7793	var materialTransTO;
7794
7795	$(window).resize(function(){
7796
7797		clearTimeout(materialTransTO);
7798
7799		$('body[data-slide-out-widget-area-style="slide-out-from-right"] > a.slide_out_area_close, .material #header-outer, .ocm-effect-wrap, .ocm-effect-wrap-shadow').addClass('no-material-transition');
7800
7801		materialTransTO = setTimeout(function(){
7802			$('body[data-slide-out-widget-area-style="slide-out-from-right"] > a.slide_out_area_close, .material #header-outer, .ocm-effect-wrap, .ocm-effect-wrap-shadow').removeClass('no-material-transition');
7803		},250);
7804
7805		setMaterialWidth();
7806
7807	});
7808}
7809
7810
7811function materialOCM_Size() {
7812	if($('.ocm-effect-wrap.material-ocm-open').length > 0 ) {
7813
7814		//$('#ajax-content-wrap').css({'position' : 'relative', 'top' : '-' + $(window).scrollTop() + 'px' });
7815		$('.ocm-effect-wrap').css({'height': $(window).height() });
7816		$('.ocm-effect-wrap-inner').css({'padding-top': nectarDOMInfo.adminBarHeight });
7817		
7818		
7819	}
7820}
7821$(window).resize(materialOCM_Size);
7822
7823
7824function OCM_dropdown_function() {
7825	var $nectar_ocm_dropdown_func = ($('#slide-out-widget-area[data-dropdown-func]').length > 0) ? $('#slide-out-widget-area').attr('data-dropdown-func') : 'default';
7826	if($nectar_ocm_dropdown_func == 'separate-dropdown-parent-link') {
7827		$('#slide-out-widget-area .off-canvas-menu-container li.menu-item-has-children').append('<span class="ocm-dropdown-arrow"><i class="fa-angle-down"></i></span>');
7828	}
7829}
7830
7831OCM_dropdown_function();
7832
7833//click triggered
7834$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating)',function(){
7835	if(animating == 'true' || $('.slide-out-from-right-hover').length > 0) return false;
7836	var $that = $(this);
7837
7838	$('#header-outer').removeClass('no-transition');
7839
7840	//slide out from right
7841	if($('#slide-out-widget-area').hasClass('slide-out-from-right')) {
7842
7843		var $slideOutAmount = ($('.body-border-top').length > 0 && $('body.mobile').length == 0) ? $('.body-border-top').height() : 0;
7844
7845
7846		if($('body.material').length == 0) {
7847
7848				//calc height if used bottom meta
7849				$('#slide-out-widget-area .inner').css({'height':'auto', 'min-height': $('#slide-out-widget-area').height() - 25 - $('.bottom-meta-wrap').height() });
7850
7851				if($('#boxed').length == 0) {
7852					$('.container-wrap, .home-wrap, #header-secondary-outer, #footer-outer:not(#nectar_fullscreen_rows #footer-outer), .nectar-box-roll,   #page-header-wrap .page-header-bg-image,  #page-header-wrap .nectar-video-wrap, #page-header-wrap .mobile-video-image, #page-header-wrap #page-header-bg > .container, .page-header-no-bg, div:not(.container) > .project-title').stop(true).transition({ x: '-300px' },700,'easeInOutCubic');
7853
7854					var $withinCustomBreakpoint = mobileBreakPointCheck();
7855
7856					if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0 || $withinCustomBreakpoint) {
7857						if($('#header-outer[data-transparency-option="1"]').length == 0 || ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#header-outer[data-full-width="true"]').length == 0) || $('body.mobile').length > 0) {
7858							$('#header-outer').stop(true).css('transform','translateY(0)').transition({ x: '-' + (300+$slideOutAmount) +'px'},700,'easeInOutCubic');
7859						} else {
7860							$('#header-outer').stop(true).css('transform','translateY(0)').transition({ x: '-' + (300+$slideOutAmount) +'px', 'background-color':'transparent', 'border-bottom': '1px solid rgba(255,255,255,0.22)' },700,'easeInOutCubic');
7861						}
7862					} else {
7863						$('#header-outer header#top nav > ul.buttons, body:not(.material) #header-outer .cart-outer .cart-menu-wrap').transition({ x: '-300px'},700,'easeInOutCubic');
7864					}
7865
7866					$('#ascrail2000').transition({ 'x': '-' + (300+$slideOutAmount) +'px' },700,'easeInOutCubic');
7867					$('body:not(.ascend):not(.material) #header-outer .cart-menu').stop(true).transition({ 'x': '300px' },700,'easeInOutCubic');
7868				}
7869
7870				$('#slide-out-widget-area').stop(true).transition({ x: '-' + $slideOutAmount +'px' },700,'easeInOutCubic').addClass('open');
7871
7872
7873				if($('#boxed').length == 0) {
7874					//full width menu adjustments
7875					if($('#header-outer[data-full-width="true"]').length > 0 && !$('body').hasClass('mobile')) { 
7876						$('#header-outer').addClass('highzI'); 
7877						$('#ascrail2000').addClass('z-index-adj');
7878
7879						if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
7880							if($bodyBorderWidth == 0)
7881								$('header#top #logo').stop(true).transition({ x: (300+$slideOutAmount) +'px' },700,'easeInOutCubic'); 
7882							
7883						}
7884
7885						$('header#top .slide-out-widget-area-toggle .lines-button').addClass('close');
7886
7887						if($('#header-outer[data-remove-border="true"]').length > 0) {
7888							$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '64px' },700,'easeInOutCubic');
7889						} else {
7890							$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '89px' },700,'easeInOutCubic'); 
7891						}
7892
7893						$('body #header-outer nav > ul > li > a').css({'margin-bottom':'0'});
7894						
7895					}
7896				}
7897
7898				$('#header-outer').addClass('style-slide-out-from-right');
7899
7900				//fade In BG Overlay
7901				$('#slide-out-widget-area-bg').css({'height':'100%','width':'100%'}).stop(true).transition({
7902					'opacity' : 1
7903				},700,'easeInOutCubic',function(){
7904					$('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating');
7905				});
7906				
7907				//hide menu if no space
7908				if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
7909					$logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width();
7910					if($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) $('#header-outer').addClass('hidden-menu');
7911				} else {
7912					$('#header-outer').addClass('hidden-menu-items');
7913				}
7914
7915				var headerResize = $('#header-outer').attr('data-header-resize');
7916
7917				if($('#header-outer[data-remove-fixed="1"]').length == 0) {
7918					if($bodyBorderHeaderColorMatch == true && headerResize == 1) {
7919						
7920						$('#header-outer').stop(true).transition({ y: '0' },0).addClass('transparent').css('transition','transform');
7921						if($('#header-outer').attr('data-transparent-header') != 'true') {
7922							$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
7923						}
7924
7925						$(window).off('scroll',bigNav);
7926						$(window).off('scroll',smallNav);
7927
7928					} else if ($bodyBorderHeaderColorMatch == true) {
7929						$('#header-outer').addClass('transparent');
7930						$(window).off('scroll',opaqueCheck);
7931						$(window).off('scroll',transparentCheck);
7932
7933						if($('#header-outer').attr('data-transparent-header') != 'true') {
7934							$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
7935						}
7936					}
7937				}
7938
7939		} else if ( $('body.material').length > 0 ) {
7940
7941			//material
7942			
7943			//move ajax loading outside
7944			if($('#ajax-loading-screen').length > 0 && $('.ocm-effect-wrap #ajax-loading-screen').length > 0) {
7945				$('#ajax-loading-screen').insertBefore('.ocm-effect-wrap');
7946			}
7947			
7948			////hide secondary header when not at top with hhun
7949			if($(window).scrollTop() > 40) {
7950				
7951				$('body[data-hhun="1"] #header-secondary-outer').addClass('hidden');
7952			}
7953
7954
7955			setTimeout(function(){ $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); },300);
7956			$('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').addClass('material-open');
7957
7958
7959			//handle bottom bar nav
7960			if($('body:not(.mobile) #header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0  && $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none') {
7961				$('#header-outer:not(.fixed-menu)').css('top', nectarDOMInfo.adminBarHeight - $(window).scrollTop() + 'px' );
7962				
7963				if($('#header-secondary-outer').length > 0  && $('#header-outer.fixed-menu').length > 0) {
7964					$('#header-secondary-outer').css('visibility','hidden');
7965				}
7966				
7967			}
7968			
7969			$('#ajax-content-wrap').css({'position' : 'relative', 'top' : '-' + $(window).scrollTop() + 'px' });
7970			$('.ocm-effect-wrap-inner').css({'padding-top': nectarDOMInfo.adminBarHeight });
7971			$('#fp-nav').addClass('material-ocm-open');
7972			$('body').addClass('material-ocm-open');
7973			$('.ocm-effect-wrap').css({'height': window.innerHeight });
7974
7975			setTimeout(function(){
7976				$('.ocm-effect-wrap').addClass('material-ocm-open');
7977			},40);
7978			
7979			
7980			$('body > .slide_out_area_close').addClass('follow-body');
7981
7982			//icon effect
7983			$('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('effect-shown');
7984
7985			//handle hhun when at top
7986			$('body[data-hhun="1"]:not(.no-scroll):not(.mobile) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({'transition':'none', 'transform':'translateY('+ nectarDOMInfo.adminBarHeight +'px)'});
7987
7988			setTimeout(function(){
7989				$('body > .slide_out_area_close').addClass('material-ocm-open');
7990			},350);
7991
7992
7993		}
7994
7995
7996	}
7997     else if($('#slide-out-widget-area').hasClass('fullscreen')) {
7998
7999     	if ( $('body.material').length > 0 ) {
8000     		$('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out');
8001     	}
8002
8003		//scroll away from fixed reveal footer if shown (firefox bug with bluring over it)
8004		var $scrollDelay = 0;
8005		var $scrollDelay2 = 0;
8006
8007		if($(window).scrollTop() + $(window).height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) {
8008			$('body,html').stop().animate({
8009				scrollTop: $('.blurred-wrap').height() - $(window).height()
8010			},600,'easeInOutCubic');
8011			$scrollDelay = 550;
8012			$scrollDelay2 = 200;
8013		}
8014
8015		$('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close');
8016		setTimeout(function(){ $('.blurred-wrap').addClass('blurred'); },$scrollDelay);
8017		$('#slide-out-widget-area.fullscreen').show().addClass('open');
8018
8019		if($('.nectar-social-sharing-fixed').length == 0) {
8020			hideToTop();
8021		}
8022
8023		//remove box shadow incase at the top of the page with nectar box roll above
8024		$('.container-wrap').addClass('no-shadow');
8025		$('#header-outer').stop(true).css('transform','translateY(0)');
8026
8027		setTimeout(function(){
8028
8029			$('.off-canvas-menu-container .menu > li').each(function(i){
8030				$(this).delay(i*50).transition({y: 0, 'opacity': 1},800,'easeOutExpo');
8031			});
8032
8033			$('#slide-out-widget-area.fullscreen .widget').each(function(i){
8034				$(this).delay(i*100).transition({y: 0, 'opacity': 1},800,'easeOutExpo');
8035			});
8036		},370+$scrollDelay2);
8037
8038		setTimeout(function(){
8039			$('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
8040
8041			$('#slide-out-widget-area .off-canvas-social-links li').each(function(i){
8042				$(this).delay(i*50).transition({'scale':1},400,'easeOutCubic');
8043			});
8044			$('#slide-out-widget-area .bottom-text').transition({'opacity':0.7},400,'easeOutCubic');
8045		},750+$scrollDelay2);
8046		
8047		//fade In BG Overlay
8048		setTimeout(function(){
8049			$easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint';
8050			$('#slide-out-widget-area-bg').css({'height':'100%','width':'100%'}).show().stop(true).transition({
8051				'y' : '0%'
8052			},920,$easing,function(){
8053				$('.slide-out-widget-area-toggle > div > a').removeClass('animating');
8054			});
8055		},50+$scrollDelay2);
8056
8057		//overflow state 
8058		slideOutWidgetOverflowState();
8059		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').addClass('at-content');
8060		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 || $('.mobile').length == 0 && $('#header-outer.transparent').length == 0) $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', $('#header-outer').height());
8061	} 
8062
8063	else if($('#slide-out-widget-area').hasClass('fullscreen-alt')) {
8064
8065		if ( $('body.material').length > 0 ) {
8066     		$('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out');
8067     	}
8068
8069		$('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close');
8070		$('#slide-out-widget-area.fullscreen-alt').show().addClass('open');
8071		$('#slide-out-widget-area-bg').addClass('open');
8072
8073		$('body > div[class*="body-border"]').css('z-index','9995');
8074
8075		$('.off-canvas-menu-container .menu').transition({y: '0px', 'opacity': 1},0);	
8076
8077		if($('.nectar-social-sharing-fixed').length == 0) {
8078			hideToTop();
8079		}
8080
8081		if($('#header-outer.transparent').length == 0) {
8082
8083
8084		}
8085		else { 
8086
8087			if($('.body-border-top').length > 0) {
8088				$('.admin-bar #slide-out-widget-area-bg.fullscreen-alt').css({'padding-top': ($('.body-border-top').outerHeight(true)+32) + 'px'});
8089				$('body:not(.admin-bar) #slide-out-widget-area-bg.fullscreen-alt').css({'padding-top': ($('.body-border-top').outerHeight(true))+ 'px'});
8090			}
8091		}
8092		
8093		//set translateY to 0 in all cases
8094		$('#header-outer').stop(true).css('transform','translateY(0)');
8095
8096		if($('#logo .starting-logo').length > 0 && $(window).width() > 1000 && $('#header-outer[data-format="centered-menu-bottom-bar"].fixed-menu').length == 0 && $('body.material #header-outer[data-condense="true"]').length == 0 && !nectarDOMInfo.usingFrontEndEditor) {
8097
8098			$('#header-outer').stop(true).css('transform','translateY(0)').addClass('transparent');
8099			if($('#header-outer').attr('data-transparent-header') != 'true') {
8100				$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
8101			}
8102		}
8103
8104		$('.off-canvas-menu-container .clip-wrap').css('transition-duration','0s');
8105
8106		setTimeout(function(){
8107
8108			$('.off-canvas-menu-container .menu > li').each(function(i){
8109				$(this).delay(i*50).transition({y: 0, 'opacity': 1},750,'easeOutCubic').addClass('no-pointer-events');
8110			});
8111
8112			setTimeout(function(){
8113				$('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
8114				$('.off-canvas-menu-container .clip-wrap').css('transition-duration','.45s');
8115			},500);
8116
8117			$('#slide-out-widget-area.fullscreen-alt .widget').each(function(i){
8118				$(this).delay(i*100).transition({y: 0, 'opacity': 1},650,'easeOutCubic');
8119			});
8120		},200);
8121
8122		setTimeout(function(){
8123			$('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
8124
8125			$('#slide-out-widget-area .off-canvas-social-links li').css('opacity','1').each(function(i){
8126				$(this).delay(i*50).transition({'scale':1},400,'easeOutCubic');
8127			});
8128			$('#slide-out-widget-area .bottom-text').transition({'opacity':1},600,'easeOutCubic');
8129		},200);
8130		
8131		//fade In BG Overlay
8132		if($('#slide-out-widget-area-bg').hasClass('solid')) $opacity = 1;
8133		if($('#slide-out-widget-area-bg').hasClass('dark')) $opacity = 0.97;
8134		if($('#slide-out-widget-area-bg').hasClass('medium')) $opacity = 0.6;
8135		if($('#slide-out-widget-area-bg').hasClass('light')) $opacity = 0.4;
8136		$('#slide-out-widget-area-bg').removeClass('no-transition');
8137		
8138
8139		$('#slide-out-widget-area-bg').addClass('padding-removed').css({'height':'100%','width':'100%', 'left':'0','opacity': $opacity});
8140		
8141
8142		setTimeout(function(){
8143			$('.slide-out-widget-area-toggle > div > a').removeClass('animating');
8144		},600);
8145			
8146
8147		//overflow state 
8148		slideOutWidgetOverflowState();
8149		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').addClass('at-content');
8150		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 || $('.mobile').length == 0 && $('#header-outer.transparent').length == 0) $('#slide-out-widget-area.fullscreen-alt .inner-wrap').css('padding-top', $('#header-outer').height());
8151	}
8152
8153
8154
8155	//add open class
8156	$('#header-outer').removeClass('side-widget-closed').addClass('side-widget-open');
8157
8158	//give header transparent state
8159	if($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0 && $('#header-outer[data-full-width="true"]').length > 0 && !nectarDOMInfo.usingFrontEndEditor) {
8160			if($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length == 0 && $('body.material #header-outer[data-condense="true"]').length == 0) {
8161				$('#header-outer').addClass('transparent');
8162			}
8163	}
8164
8165	//dark slide transparent nav
8166	if($('#header-outer.dark-slide.transparent').length > 0  && $('#boxed').length == 0 && $('body.material-ocm-open').length == 0) $('#header-outer').removeClass('dark-slide').addClass('temp-removed-dark-slide');
8167	
8168	$('.slide-out-widget-area-toggle > div > a').removeClass('closed').addClass('open');
8169	$('.slide-out-widget-area-toggle > div > a').addClass('animating');
8170
8171	return false;
8172});
8173
8174$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a.open:not(.animating), #slide-out-widget-area .slide_out_area_close,  > .slide_out_area_close, #slide-out-widget-area-bg.slide-out-from-right, .material-ocm-open #ajax-content-wrap',function(e){
8175
8176	if (e.originalEvent == undefined && $('.slide_out_area_close.non-human-allowed').length == 0 ) { return; }
8177
8178	if($('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) return;
8179
8180	$('#header-outer').removeClass('no-transition');
8181
8182
8183	var $that = $(this);
8184
8185	$('.slide-out-widget-area-toggle:not(.std-menu) a').removeClass('open').addClass('closed');
8186	$('.slide-out-widget-area-toggle:not(.std-menu) a').addClass('animating');
8187
8188	//slide out from right
8189	if($('#slide-out-widget-area').hasClass('slide-out-from-right')) {
8190
8191			if($('body.material').length == 0) {
8192
8193				$('.container-wrap, .home-wrap, #header-secondary-outer, #footer-outer:not(#nectar_fullscreen_rows #footer-outer), .nectar-box-roll, #page-header-wrap .page-header-bg-image,  #page-header-wrap .nectar-video-wrap, #page-header-wrap .mobile-video-image, #page-header-wrap #page-header-bg > .container, .page-header-no-bg, div:not(.container) > .project-title').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
8194
8195				if($('#header-outer[data-transparency-option="1"]').length > 0  && $('#boxed').length == 0) {
8196					$currentRowBG = ($('#header-outer[data-current-row-bg-color]').length > 0) ? $('#header-outer').attr('data-current-row-bg-color') : $('#header-outer').attr('data-user-set-bg');
8197					$('#header-outer').stop(true).transition({ x: '0px', 'background-color': $currentRowBG },700,'easeInOutCubic');
8198				} else {
8199					$('#header-outer').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
8200				}
8201
8202				$('#ascrail2000').stop(true).transition({ 'x': '0px' },700,'easeInOutCubic');
8203				$('body:not(.ascend):not(.material) #header-outer .cart-menu').stop(true).transition({ 'x': '0px' },700,'easeInOutCubic');
8204
8205				$('#slide-out-widget-area').stop(true).transition({ x: '301px' },700,'easeInOutCubic').removeClass('open');
8206
8207
8208				if($('#boxed').length == 0) {
8209					if($('#header-outer[data-full-width="true"]').length > 0) {  
8210						$('#header-outer').removeClass('highzI'); 
8211						$('header#top #logo').stop(true).transition({ x: '0px' },700,'easeInOutCubic'); 
8212						$('.lines-button').removeClass('close');
8213
8214						$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
8215
8216					}
8217				}
8218
8219				if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) {
8220					$('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({ x: '0px' },700,'easeInOutCubic'); 
8221				}
8222
8223				//fade out overlay
8224				$('#slide-out-widget-area-bg').stop(true).transition({
8225					'opacity' : 0
8226				},700,'easeInOutCubic',function(){
8227					$('.slide-out-widget-area-toggle a').removeClass('animating');
8228					$(this).css({'height':'1px','width':'1px'});
8229
8230					if($('#header-outer[data-remove-fixed="1"]').length == 0) {
8231						//hide menu if transparent, user has scrolled down and hhun is on
8232						if($('#header-outer').hasClass('parallax-contained') && $(window).scrollTop() > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) {
8233							$('#header-outer').removeClass('parallax-contained').addClass('detached').removeClass('transparent');
8234						}
8235						else if($(window).scrollTop() == 0 && $('body[data-hhun="1"]').length > 0 && $('#page-header-bg[data-parallax="1"]').length > 0 ||
8236							$(window).scrollTop() == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) {
8237
8238							if($('#header-outer[data-transparency-option="1"]').length > 0) $('#header-outer').addClass('transparent');
8239							$('#header-outer').addClass('parallax-contained').removeClass('detached');
8240						}
8241					}
8242
8243					//fix for fixed subpage menu
8244					$('.container-wrap').css('transform','none');
8245				});
8246
8247
8248				$('#header-outer').removeClass('style-slide-out-from-right');
8249
8250
8251				var headerResize = $('#header-outer').attr('data-header-resize');
8252				if($('#header-outer[data-remove-fixed="1"]').length == 0) {
8253
8254					if($bodyBorderHeaderColorMatch == true && headerResize == 1) {
8255					
8256						$(window).off('scroll.headerResizeEffect');
8257						if($(window).scrollTop() == 0) {
8258							$(window).on('scroll.headerResizeEffect',smallNav); 
8259
8260							if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true && $('#header-outer.pseudo-data-transparent').length > 0) {
8261								$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
8262									'padding' : '0'			
8263								},{queue:false, duration:250, easing: 'easeOutCubic'});	
8264							}
8265						}
8266						else
8267							$(window).on('scroll.headerResizeEffect',bigNav); 
8268							//smallNav();
8269
8270						if($('#header-outer').hasClass('pseudo-data-transparent')) {
8271							$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
8272						}
8273
8274						$('#header-outer').css('transition','transform');
8275
8276					} else if ($bodyBorderHeaderColorMatch == true) {
8277						
8278						$(window).off('scroll.headerResizeEffectOpaque');
8279						$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
8280
8281						$('#header-outer').css('transition','transform');
8282
8283						if($('#header-outer').hasClass('pseudo-data-transparent')) {
8284							$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
8285						}
8286					}
8287				}
8288		}
8289
8290		else if ( $('body.material').length > 0 ) {
8291
8292			//material
8293			$('#slide-out-widget-area').removeClass('open');
8294
8295			$('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').removeClass('material-open');
8296			$('.ocm-effect-wrap, .ocm-effect-wrap-shadow, body > .slide_out_area_close, #fp-nav').removeClass('material-ocm-open');
8297
8298			$('body > .slide_out_area_close').removeClass('follow-body');
8299
8300			setTimeout(function(){
8301				$('.slide-out-widget-area-toggle a').removeClass('animating');
8302				$('body').removeClass('material-ocm-open');
8303				$('.ocm-effect-wrap').css({'height': '100%'});
8304				$('.ocm-effect-wrap-inner').css({'padding-top': '0' });
8305				$(window).scrollTop(Math.abs( parseInt($('#ajax-content-wrap').css('top')) ) );
8306				$('#ajax-content-wrap').css({'position' : '', 'top' : '' });
8307				
8308
8309				//handle bottom bar nav
8310				if($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0 && $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none' && $('body.mobile').length == 0) {
8311					$('#header-outer:not(.fixed-menu)').css('top', '');
8312					$('#header-secondary-outer').css('visibility','');
8313				}
8314				
8315				//handle hhun when at top
8316				$('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({'transform':''});
8317				setTimeout(function(){
8318					$('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({'transition':''});
8319				},30);
8320				
8321
8322				$('body[data-hhun="1"] #header-secondary-outer.hidden').removeClass('hidden');
8323
8324			},900);
8325
8326			setTimeout(function(){
8327				//icon effect
8328				$('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('no-trans').removeClass('effect-shown');
8329			},200);
8330
8331			setTimeout(function(){
8332				//icon
8333				$('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').removeClass('no-trans')
8334			},500);
8335			
8336		}
8337
8338
8339	} 
8340
8341	else if($('#slide-out-widget-area').hasClass('fullscreen')) {
8342
8343
8344		if ( $('body.material').length > 0 ) {
8345			setTimeout(function(){
8346				$('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out');
8347			},350);
8348     	}
8349
8350		$('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close');
8351		$('.blurred-wrap').removeClass('blurred');
8352		$('#slide-out-widget-area.fullscreen').transition({'opacity': 0 },700,'easeOutQuad',function(){ $('#slide-out-widget-area.fullscreen').hide().css('opacity','1'); }).removeClass('open');
8353		$('#slide-out-widget-area.fullscreen .widget').transition({'opacity': 0},700,'easeOutQuad',function(){
8354			$(this).transition({y: '110px'},0);
8355		});
8356
8357		setTimeout(function(){
8358			$('.off-canvas-menu-container .menu > li').transition({y: '80px', 'opacity': 0},0);		
8359			$('#slide-out-widget-area .off-canvas-social-links li').transition({'scale':0},0);
8360			$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
8361			$('#slide-out-widget-area .bottom-text').transition({'opacity':0},0);	
8362
8363			//close submenu items
8364			$('#slide-out-widget-area .menuwrapper .menu').removeClass( 'subview' );
8365			$('#slide-out-widget-area .menuwrapper .menu li').removeClass( 'subview subviewopen' );
8366			$('#slide-out-widget-area.fullscreen .inner .off-canvas-menu-container').css('height','auto');
8367		},800);
8368
8369		setTimeout(function(){
8370			if($('.nectar-social-sharing-fixed').length == 0) {
8371				showToTop();
8372			}
8373			$('.container-wrap').removeClass('no-shadow');
8374		},500);
8375
8376		//fade out overlay
8377		$('#slide-out-widget-area-bg').stop(true).transition({'opacity': 0},900,'easeOutQuad',function(){
8378			if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').removeClass('at-content');
8379			if($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', '0');
8380			$('.slide-out-widget-area-toggle a').removeClass('animating');
8381			if($('#slide-out-widget-area-bg').hasClass('solid')) $opacity = 1;
8382			if($('#slide-out-widget-area-bg').hasClass('dark')) $opacity = 0.93;
8383			if($('#slide-out-widget-area-bg').hasClass('medium')) $opacity = 0.6;
8384			if($('#slide-out-widget-area-bg').hasClass('light')) $opacity = 0.4;
8385			$(this).css({'height':'1px','width':'1px', 'opacity': $opacity}).transition({ y : '-100%'},0);
8386		});
8387
8388		
8389	}
8390
8391	else if($('#slide-out-widget-area').hasClass('fullscreen-alt')) {
8392
8393
8394		if ( $('body.material').length > 0 ) {
8395			setTimeout(function(){
8396				$('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out');
8397			},350);
8398     	}
8399
8400		$('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close');
8401		$('.blurred-wrap').removeClass('blurred');
8402		$('#slide-out-widget-area-bg').removeClass('open');
8403		
8404		$('#slide-out-widget-area.fullscreen-alt .widget').transition({'opacity': 0},500,'easeOutQuad',function(){
8405			$(this).transition({y: '40px'},0);
8406		});
8407		$('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({'opacity': 0},250,'easeOutQuad');
8408		$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
8409
8410		$('.off-canvas-menu-container .menu').transition({y: '-13px', 'opacity': 0},400);	
8411
8412
8413		setTimeout(function(){
8414			$('.off-canvas-menu-container .menu > li').stop(true,true).transition({y: '40px', 'opacity': 0},0);		
8415			$('#slide-out-widget-area .off-canvas-social-links li').transition({'scale':0},0);
8416			$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');	
8417
8418			//close submenu items
8419			$('#slide-out-widget-area .menuwrapper .menu').removeClass( 'subview' );
8420			$('#slide-out-widget-area .menuwrapper .menu li').removeClass( 'subview subviewopen' );
8421			$('#slide-out-widget-area.fullscreen-alt .inner .off-canvas-menu-container').css('height','auto');
8422
8423			if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').removeClass('at-content');
8424			if($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) $('#slide-out-widget-area.fullscreen-alt .inner-wrap').css('padding-top', '0');
8425			$('.slide-out-widget-area-toggle a').removeClass('animating');
8426			$('#slide-out-widget-area-bg').css({'height':'1px','width':'1px','left':'-100%'});
8427			$('#slide-out-widget-area.fullscreen-alt').hide().removeClass('open');
8428		},550);
8429
8430		setTimeout(function(){
8431			if($('.nectar-social-sharing-fixed').length == 0) {
8432				showToTop();
8433			}
8434		},600);
8435
8436		//fade out overlay
8437		setTimeout(function(){
8438			$('#slide-out-widget-area-bg').removeClass('padding-removed');
8439		},50);	
8440
8441		
8442		var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 150: 50;
8443
8444		setTimeout(function(){
8445			$('#slide-out-widget-area-bg').stop(true).css({'opacity': 0});
8446			if($('[data-transparent-header="true"]').length > 0) $('body > div[class*="body-border"]').css('z-index','10000');
8447		},borderDelay);
8448
8449		setTimeout(function(){
8450			$('#header-outer.transparent.small-nav, #header-outer.transparent.detached, #header-outer:not([data-permanent-transparent="1"]).transparent.scrolled-down').removeClass('transparent');
8451			
8452			if($('#header-outer').hasClass('pseudo-data-transparent')) {
8453				$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
8454			}
8455
8456		},100);
8457		
8458	}
8459
8460
8461	//dark slide transparent nav
8462	if($('#header-outer.temp-removed-dark-slide.transparent').length > 0  && $('#boxed').length == 0) $('#header-outer').removeClass('temp-removed-dark-slide').addClass('dark-slide');
8463
8464	//remove header transparent state
8465	if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) {
8466
8467		if($('.nectar-box-roll').length == 0) {
8468			if($('#header-outer.small-nav').length > 0 || $('#header-outer.scrolled-down').length > 0 || $('#header-outer.detached').length > 0) $('#header-outer').removeClass('transparent');
8469		} else {
8470			if($('#header-outer.small-nav').length > 0 || $('#header-outer.scrolled-down').length > 0 || $('.container-wrap.auto-height').length > 0) $('#header-outer').removeClass('transparent');
8471		}
8472	} 
8473
8474
8475
8476	//remove hidden menu
8477	$('#header-outer').removeClass('hidden-menu');
8478
8479	$('#header-outer').removeClass('side-widget-open').addClass('side-widget-closed');
8480
8481	return false;
8482});
8483
8484function slideOutWidgetOverflowState() {
8485
8486	//switch position of social media/extra info based on screen size
8487	if(window.innerWidth < 1000 || $('body > #boxed').length > 0 || $('.ocm-effect-wrap-inner > #boxed').length > 0) {
8488
8489		$('#slide-out-widget-area.fullscreen .off-canvas-social-links, #slide-out-widget-area.fullscreen-alt .off-canvas-social-links').appendTo('#slide-out-widget-area .inner');
8490		$('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner');
8491	} else {
8492		$('#slide-out-widget-area.fullscreen .off-canvas-social-links,#slide-out-widget-area.fullscreen-alt .off-canvas-social-links').appendTo('#slide-out-widget-area .inner-wrap');
8493		$('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap');
8494	}
8495
8496	//add overflow
8497	if( $('#slide-out-widget-area[class*="fullscreen"] .inner').height() >= $(window).height()-100) { $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').addClass('overflow-state'); }
8498	else { $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').removeClass('overflow-state'); }
8499
8500	$('#slide-out-widget-area[class*="fullscreen"] .inner').transition({ y : '-' + ($('#slide-out-widget-area[class*="fullscreen"] .inner').height()/2) + 'px' },0);
8501
8502	//close mobile only slide out widget area if switching back to desktop
8503	if($('.slide-out-from-right.open .off-canvas-menu-container.mobile-only').length > 0 && $('body.mobile').length == 0) { $('#slide-out-widget-area .slide_out_area_close').trigger('click'); }
8504
8505	//sizing for dropdown
8506	OCM_Dropdown_Icon_Pos();
8507
8508
8509}
8510
8511
8512function OCM_Dropdown_Icon_Pos() {
8513	$('#slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children').each(function(){
8514		$(this).find('.ocm-dropdown-arrow').css({'top': $(this).find('a').height()/2 });
8515	});
8516}
8517OCM_Dropdown_Icon_Pos();
8518
8519
8520function fullWidthHeaderSlidingWidgetMenuCalc() {
8521	$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': $(window).width() - 360, 'left': '300px' },700,'easeInOutCubic');
8522}
8523
8524//slide out widget area scrolling 
8525function slideOutWidgetAreaScrolling(){ 
8526	$('#slide-out-widget-area').mousewheel(function(event, delta) {
8527
8528	     this.scrollTop -= (delta * 30);
8529	    
8530	     event.preventDefault();
8531
8532	});
8533}
8534setTimeout(slideOutWidgetAreaScrolling,500);
8535
8536
8537//handle mobile scrolling
8538if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
8539	$('#slide-out-widget-area').addClass('mobile');
8540}
8541
8542
8543function closeOCM(item) {
8544    if($('#slide-out-widget-area.open').length > 0) {
8545
8546    	var $windowCurrentLocation = window.location.href.split("#")[0];
8547		  var $windowClickedLocation = item.find('> a').attr('href').split("#")[0];
8548
8549    	if($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) {
8550				if(item.parents('.slide-out-from-right-hover').length > 0) {
8551					$('.slide-out-widget-area-toggle.slide-out-hover-icon-effect a').trigger('click');
8552				} else {
8553					$('.slide-out-widget-area-toggle a').trigger('click');
8554				}
8555        
8556			}
8557    } 
8558		
8559}
8560
8561
8562//left header
8563function leftHeaderSubmenus() {
8564
8565	//remove megamenu class
8566	$('#header-outer[data-format="left-header"] nav li.megamenu').removeClass('megamenu');
8567
8568	var $ocm_link_selector = ($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) ? '#slide-out-widget-area .off-canvas-menu-container li.menu-item-has-children > .ocm-dropdown-arrow' : 'body.material #slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children > a';
8569	//click
8570	$('#header-outer[data-format="left-header"]  li.menu-item-has-children > a, '+$ocm_link_selector).on('click',function(e){
8571		
8572		if($(this).parent().hasClass('open-submenu')) {
8573			$(this).parent().find('.sub-menu').css({
8574				'max-height' : '0'
8575			});
8576			$(this).parent().removeClass('open-submenu');
8577		}
8578		else {
8579
8580			//get max height
8581			var $that = $(this);
8582			var $maxSubMenuHeight;
8583
8584			$that.parent().find('> .sub-menu').addClass('no-trans');
8585
8586			setTimeout(function(){
8587
8588				$that.parent().find('> .sub-menu').css({
8589					'max-height' : 'none',
8590					'position' : 'absolute',
8591					'visibility' : 'hidden'
8592				});
8593				
8594				$maxSubMenuHeight =  $that.parent().find('> .sub-menu').height();
8595
8596				$that.parent().find('> .sub-menu').removeClass('no-trans');
8597				$that.parent().find('> .sub-menu').css({
8598					'max-height' : '0',
8599					'position' : 'relative',
8600					'visibility' : 'visible'
8601				});
8602
8603			},25);
8604
8605			setTimeout(function(){
8606				
8607				//reset
8608				$that.closest('ul').find('li.menu-item-has-children').removeClass('open-submenu');
8609				$that.closest('ul').find('li.menu-item-has-children > .sub-menu').css({
8610					'max-height' : '0'
8611				});
8612
8613				$that.parent().addClass('open-submenu');
8614
8615				$that.parent().find('> .sub-menu').css('max-height', $maxSubMenuHeight);
8616
8617				//add height to open parents
8618				if($that.parents('ul').length > 0) {
8619
8620					$that.parents('ul:not(.sf-menu)').each(function(){
8621						$(this).css('max-height');
8622						$(this).css('max-height', parseInt($(this).height() + parseInt($(this).css('padding-top'))*2 + $maxSubMenuHeight)+'px');
8623					});
8624				} 
8625					
8626
8627			},50);
8628		}
8629		
8630		return false;
8631	});
8632	
8633	//start open for current page items
8634	var $maxSubMenuHeightArr = [];
8635
8636	$('#header-outer[data-format="left-header"] .current-menu-ancestor').find('.current-menu-item').parents('ul.sub-menu').each(function(i){
8637
8638		
8639
8640		$maxSubMenuHeightArr[i] =  $(this).parent().find('> .sub-menu').height();
8641
8642
8643		var $that = $(this);
8644		setTimeout(function(){
8645
8646			var $totalSubMenuHeight = 0;
8647
8648			for(var $i=0; $i < $maxSubMenuHeightArr.length; $i++) {
8649				$totalSubMenuHeight += parseInt($maxSubMenuHeightArr[i]);
8650			}
8651	
8652			$that.parent().addClass('open-submenu');
8653			$that.css('max-height', $totalSubMenuHeight);
8654
8655		},40);
8656	});
8657}
8658
8659if($('#header-outer[data-format="left-header"]').length > 0 || $('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length > 0 || $('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) {
8660	leftHeaderSubmenus();
8661}
8662
8663
8664//fullscreen submenu
8665;( function( $, window, undefined ) {
8666
8667	'use strict';
8668
8669	// global
8670	var Modernizr = window.Modernizr, $body = $( 'body' );
8671
8672	$.DLMenu = function( options, element ) {
8673		this.$el = $( element );
8674		this._init( options );
8675	};
8676
8677	// the options
8678	$.DLMenu.defaults = {
8679		// classes for the animation effects
8680		animationClasses : { classin : 'dl-animate-in-1', classout : 'dl-animate-out-1' },
8681		onLevelClick : function( el, name ) { return false; },
8682		onLinkClick : function( el, ev ) { return false; }
8683	};
8684
8685	$.DLMenu.prototype = {
8686		_init : function( options ) {
8687
8688			// options
8689			this.options = $.extend( true, {}, $.DLMenu.defaults, options );
8690			this._config();
8691			
8692			var animEndEventNames = {
8693					'WebkitAnimation' : 'webkitAnimationEnd',
8694					'OAnimation' : 'oAnimationEnd',
8695					'msAnimation' : 'MSAnimationEnd',
8696					'animation' : 'animationend'
8697				},
8698				transEndEventNames = {
8699					'WebkitTransition' : 'webkitTransitionEnd',
8700					'MozTransition' : 'transitionend',
8701					'OTransition' : 'oTransitionEnd',
8702					'msTransition' : 'MSTransitionEnd',
8703					'transition' : 'transitionend'
8704				};
8705			// animation end event name
8706			this.animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' ) ] + '.menu';
8707			// transition end event name
8708			this.transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ] + '.menu',
8709			// support for css animations and css transitions
8710			this.supportAnimations = Modernizr.cssanimations,
8711			this.supportTransitions = Modernizr.csstransitions;
8712
8713			this._initEvents();
8714
8715		},
8716		_config : function() {
8717			this.open = false;
8718			this.$trigger = this.$el.children( '.trigger' );
8719			this.$menu = this.$el.children( 'ul.menu' );
8720			this.$menuitems = this.$menu.find( 'li:not(.back) > a' );
8721			this.$el.find( 'ul.sub-menu' ).prepend( '<li class="back"><a href="#"> '+$('#slide-out-widget-area').attr('data-back-txt')+' </a></li>' );
8722			this.$back = this.$menu.find( 'li.back' );
8723		},
8724		_initEvents : function() {
8725
8726			var self = this;
8727
8728			this.$trigger.on( 'click.menu', function() {
8729				
8730				if( self.open ) {
8731					self._closeMenu();
8732				} 
8733				else {
8734					self._openMenu();
8735				}
8736				return false;
8737
8738			} );
8739			
8740			this.$menuitems.on( 'click.menu', function( event ) {
8741
8742
8743				var $item = $(this).parent('li'),
8744					$submenu = $item.children( 'ul.sub-menu' );
8745
8746				$('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration','0s');	
8747	
8748				if( $submenu.length > 0 ) {
8749
8750					var $flyin = $submenu.clone().css( 'opacity', 0 ).insertAfter( self.$menu ),
8751						onAnimationEndFn = function() {
8752							self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classout ).addClass( 'subview' );
8753							$item.addClass( 'subviewopen' ).parents( '.subviewopen:first' ).removeClass( 'subviewopen' ).addClass( 'subview' );
8754							$flyin.remove();
8755							setTimeout(function(){
8756								$('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
8757								$('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration','.45s');
8758							},300);
8759							
8760			
8761						};
8762
8763					setTimeout( function() {
8764						$flyin.addClass( self.options.animationClasses.classin );
8765						self.$menu.addClass( self.options.animationClasses.classout );
8766						if( self.supportAnimations ) {
8767							self.$menu.on( self.animEndEventName, onAnimationEndFn );
8768						}
8769						else {
8770							onAnimationEndFn.call();
8771						}
8772
8773						self.options.onLevelClick( $item, $item.children( 'a:first' ).text() );
8774					} );
8775
8776
8777					$item.parents('.off-canvas-menu-container').css('height',$item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({ 'height': $flyin.height() },500,'easeInOutQuad' );
8778
8779
8780					return false;
8781
8782				}
8783				else {
8784		
8785					self.options.onLinkClick( $item.find('> a'), event );
8786				}
8787
8788				closeOCM($item);
8789
8790			});
8791
8792			
8793
8794
8795			this.$back.on( 'click.menu', function( event ) {
8796				
8797				var $this = $( this ),
8798					$submenu = $this.parents( 'ul.sub-menu:first' ),
8799					$item = $submenu.parent(),
8800
8801					$flyin = $submenu.clone().insertAfter( self.$menu );
8802
8803				var onAnimationEndFn = function() {
8804					self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classin );
8805					$flyin.remove();
8806				};
8807
8808				setTimeout( function() {
8809					$flyin.addClass( self.options.animationClasses.classout );
8810					self.$menu.addClass( self.options.animationClasses.classin );
8811					if( self.supportAnimations ) {
8812						self.$menu.on( self.animEndEventName, onAnimationEndFn );
8813					}
8814					else {
8815						onAnimationEndFn.call();
8816					}
8817
8818					$item.removeClass( 'subviewopen' );
8819					
8820					var $subview = $this.parents( '.subview:first' );
8821					if( $subview.is( 'li' ) ) {
8822						$subview.addClass( 'subviewopen' );
8823					}
8824					$subview.removeClass( 'subview' );
8825				} );
8826
8827		
8828				$item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height())
8829				setTimeout(function() { 
8830					$item.parents('.off-canvas-menu-container').transition({ 'height': $item.parent().height() },500,'easeInOutQuad');
8831				},50);
8832
8833
8834				return false;
8835
8836			} );
8837			
8838		},
8839		closeMenu : function() {
8840			if( this.open ) {
8841				this._closeMenu();
8842			}
8843		},
8844		_closeMenu : function() {
8845			var self = this,
8846				onTransitionEndFn = function() {
8847					self.$menu.off( self.transEndEventName );
8848					self._resetMenu();
8849				};
8850			
8851			this.$menu.removeClass( 'menuopen' );
8852			this.$menu.addClass( 'menu-toggle' );
8853			this.$trigger.removeClass( 'active' );
8854			
8855			if( this.supportTransitions ) {
8856				this.$menu.on( this.transEndEventName, onTransitionEndFn );
8857			}
8858			else {
8859				onTransitionEndFn.call();
8860			}
8861
8862			this.open = false;
8863		},
8864		openMenu : function() {
8865			if( !this.open ) {
8866				this._openMenu();
8867			}
8868		},
8869		_openMenu : function() {
8870			var self = this;
8871			$body.off( 'click' ).on( 'click.menu', function() {
8872				self._closeMenu() ;
8873			} );
8874			this.$menu.addClass( 'menuopen menu-toggle' ).on( this.transEndEventName, function() {
8875				$( this ).removeClass( 'menu-toggle' );
8876			} );
8877			this.$trigger.addClass( 'active' );
8878			this.open = true;
8879		},
8880		_resetMenu : function() {
8881			this.$menu.removeClass( 'subview' );
8882			this.$menuitems.removeClass( 'subview subviewopen' );
8883		}
8884	};
8885
8886	var logError = function( message ) {
8887		if ( window.console ) {
8888			window.console.error( message );
8889		}
8890	};
8891
8892	$.fn.dlmenu = function( options ) {
8893		if ( typeof options === 'string' ) {
8894			var args = Array.prototype.slice.call( arguments, 1 );
8895			this.each(function() {
8896				var instance = $.data( this, 'menu' );
8897				if ( !instance ) {
8898					logError( "cannot call methods on menu prior to initialization; " +
8899					"attempted to call method '" + options + "'" );
8900					return;
8901				}
8902				if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
8903					logError( "no such method '" + options + "' for menu instance" );
8904					return;
8905				}
8906				instance[ options ].apply( instance, args );
8907			});
8908		} 
8909		else {
8910			this.each(function() {	
8911				var instance = $.data( this, 'menu' );
8912				if ( instance ) {
8913					instance._init();
8914				}
8915				else {
8916					instance = $.data( this, 'menu', new $.DLMenu( options, this ) );
8917				}
8918			});
8919		}
8920		return this;
8921	};
8922
8923} )( jQuery, window );
8924
8925function fullscreenMenuInit() {
8926	$('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />');
8927	$('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen');
8928	$ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0) ? '4' : '5';
8929	$('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({ animationClasses : { classin : 'dl-animate-in-'+$ocmAnimationClassNum, classout : 'dl-animate-out-'+$ocmAnimationClassNum } });
8930	
8931}
8932
8933if($('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length == 0 && $('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length == 0 ) {
8934	fullscreenMenuInit();
8935} else if($('body.using-mobile-browser[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0){
8936	
8937	//close OCM on mobile when clicking anchor on same page 
8938	$('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click',function(){
8939
8940		  if($(this).attr('href') != '#') {
8941				closeOCM($(this).parent());	
8942			}
8943
8944	});
8945	
8946} 
8947
8948
8949
8950//submenu link hover fix
8951$('body').on('mouseover','#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a',function(){
8952	var $currentTxt = $(this).text();
8953	$('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
8954	$('.off-canvas-menu-container .menuwrapper .menu li > a:contains('+$currentTxt+')').addClass('hovered');
8955});
8956$('body').on('mouseover','.off-canvas-menu-container .menuwrapper .menu li > a',function(){
8957	$('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
8958});
8959
8960
8961
8962/***************** Page Headers ******************/
8963
8964var pageHeaderHeight;
8965var pageHeaderHeightCopy;
8966var pageHeadingHeight;
8967var extraSpaceFromResize = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.nectar-box-roll').length == 0) ? 0 : 1;
8968var $headerRemoveStickyness = ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0) ? 1 : 0;
8969
8970if($('body.material').length > 0 ) { extraSpaceFromResize = 0; }
8971
8972//full screen header
8973function fullScreenHeaderInit(){
8974	
8975	pageHeaderHeight = parseInt($('#page-header-bg').height());
8976	
8977	return;
8978	
8979	pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
8980	pageHeaderHeightCopy = parseInt($('#page-header-bg').attr('data-height'));
8981
8982	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && window.innerWidth > 1000) ? 0 : $('#header-outer').height();
8983
8984	if($('.fullscreen-header').length > 0) {
8985
8986		if($('#header-outer[data-transparency-option]').length > 0 && $('#header-outer').attr('data-transparency-option') != '0'){
8987			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() : $(window).height() - parseInt($headerNavSpace) ;
8988		} else {
8989			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() - parseInt($headerNavSpace) + extraSpaceFromResize : $(window).height() - parseInt($headerNavSpace) ;
8990		}
8991		var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
8992		if($('.nectar-box-roll').length > 0) extraHeight = 0;
8993		pageHeaderHeight =   calculatedNum  - extraHeight; 
8994		pageHeaderHeightCopy = calculatedNum - extraHeight; 
8995	}
8996
8997	$('#page-header-bg').css('height',pageHeaderHeight+'px').removeClass('not-loaded');
8998	setTimeout(function(){ $('#page-header-bg').css('overflow','visible') },800);
8999
9000}
9001
9002fullScreenHeaderInit();
9003
9004function pageHeader(){
9005	
9006	pageHeaderHeight = parseInt($('#page-header-bg').height());
9007	
9008	//handle slide down effect
9009	$('body[data-aie="slide-down"] #page-header-wrap:not(.fullscreen-header)').css('height',pageHeaderHeight +'px');
9010  
9011  //as of 9.0
9012	return;
9013	
9014	
9015	var $scrollTop = 0;
9016	var $windowInnerWidth = window.innerWidth;
9017	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $windowInnerWidth > 1000) ? 0 : $('#header-outer').height();
9018	var $windowHeight = $(window).height();
9019
9020	//full screen header
9021	if($('.fullscreen-header').length > 0) {
9022		if($('#header-outer[data-transparency-option]').length > 0 && $('#header-outer').attr('data-transparency-option') != '0'){
9023			var calculatedNum = (!$('body').hasClass('mobile')) ? $windowHeight : $windowHeight - parseInt($headerNavSpace) ;
9024			if($('body[data-permanent-transparent="1"]').length > 0) calculatedNum = $windowHeight;
9025		} else {
9026			var calculatedNum = (!$('body').hasClass('mobile')) ? $windowHeight - parseInt($headerNavSpace) + extraSpaceFromResize : $windowHeight - parseInt($headerNavSpace);
9027		}
9028		var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
9029		if($('.nectar-box-roll').length > 0) extraHeight = 0;
9030		pageHeaderHeight =   calculatedNum  - extraHeight; 
9031		pageHeaderHeightCopy = calculatedNum - extraHeight; 
9032	}
9033
9034	if( $windowInnerWidth < 1000 && $windowInnerWidth > 690 && !$('body').hasClass('salient_non_responsive') ) {
9035		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 1.6;
9036		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
9037		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
9038		
9039	} else if( $windowInnerWidth <= 690 && $windowInnerWidth > 480 && !$('body').hasClass('salient_non_responsive')) {
9040		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 2.1;
9041		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
9042		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
9043		
9044	} else if( $windowInnerWidth <= 480 && !$('body').hasClass('salient_non_responsive')) {
9045		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 2.5;
9046		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
9047		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
9048		
9049	} else {
9050		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy).css('height',pageHeaderHeightCopy +'px');
9051		if($('.fullscreen-header').length > 0){
9052			$('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
9053		} else {
9054			$('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
9055		}
9056
9057		if($('#page-header-bg[data-parallax="1"]').length == 0) { $('#page-header-wrap').css('height',pageHeaderHeightCopy +'px'); }
9058	}
9059
9060
9061	//handle left header 
9062	if($('body[data-header-format="left-header"]').length > 0 ) { $('#page-header-bg[data-parallax="1"]').css('width',$('#ajax-content-wrap').width()) }
9063	
9064	
9065	if(!$('body').hasClass('mobile')){
9066		
9067		//recalc
9068		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
9069		$('#page-header-bg .container > .row').css('top',0);
9070		var $divisionMultipler = ($('#header-outer[data-remove-border="true"]').length > 0 && $('#header-outer[data-format="centered-menu-under-logo"]').length == 0) ? 2 : 1;
9071
9072		//center the heading
9073		pageHeadingHeight = $('#page-header-bg .col.span_6').height();
9074		
9075		
9076		if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.fullscreen-header').length == 0) {
9077
9078		} else {
9079			var $extraResizeHeight = ($('#header-outer[data-header-resize="1"]').length > 0) ? 22: 0;
9080		}
9081		
9082		//center portfolio filters
9083		$('#page-header-bg:not("[data-parallax=1]") .portfolio-filters').css('top', (pageHeaderHeight/2) + 2);	
9084		
9085		if($('#page-header-bg[data-parallax="1"]').length > 0) {
9086			$scrollTop = $(window).scrollTop();
9087		}
9088
9089		if($('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap').css('opacity') > 0) {
9090			
9091			if($('#header-outer[data-transparent-header="true"]').length > 0 && $('body.single-post .fullscreen-header').length == 0) {
9092				//center the parallax heading
9093
9094				if($headerRemoveStickyness) {
9095					
9096				    //center parllax portfolio filters
9097				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
9098						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
9099				    });
9100
9101				} else {
9102
9103				    //center parllax portfolio filters
9104				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
9105						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
9106						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
9107				    });
9108				}
9109			    
9110		  } else {
9111
9112		  		if($headerRemoveStickyness) {
9113			  		//center the parallax heading
9114
9115				    //center parllax portfolio filters
9116				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
9117						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
9118				    });
9119				} else {
9120 
9121				    //center parllax portfolio filters
9122				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
9123						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
9124						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
9125				    });
9126				}
9127		  }
9128	   }
9129	}
9130	
9131	else {
9132		//recalc
9133		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
9134		
9135		//center the heading
9136		var pageHeadingHeight = $('#page-header-bg .container > .row').height();
9137		$('#page-header-bg .container > .row').css('top', (pageHeaderHeight/2) - (pageHeadingHeight/2) + 5);
9138		
9139	}
9140
9141
9142	$('#page-header-bg .container > .row').css('visibility','visible');
9143}
9144
9145var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0; 
9146
9147if($('#page-header-bg').length > 0) { 
9148	setTimeout(function(){ pageHeader(); },$pt_timeout);
9149}
9150
9151
9152if($('#header-outer').attr('data-header-resize') == '' || $('#header-outer').attr('data-header-resize') == '0'){
9153	$('#page-header-wrap').css('margin-top','0');
9154}
9155
9156
9157function extractUrl(input) {
9158	return input.replace(/"/g,"").replace(/url\(|\)$/ig, "");
9159}
9160 
9161/***************** Parallax Page Headers ******************/
9162if($('#page-header-bg[data-parallax="1"]').length > 0) {
9163
9164	//fadeIn
9165
9166	var img = new Image();
9167	
9168	var imgX, imgY, aspectRatio;
9169	var diffX, diffY;
9170	var pageHeadingHeight = $('#page-header-bg .col.span_6').height();
9171	var pageHeaderHeight = parseInt($('#page-header-bg').height());
9172	var headerPadding2 = parseInt($('#header-outer').attr('data-padding'))*2;
9173	var wooCommerceHeader = ($('.demo_store').length > 0) ? 32 : 0 ;
9174	
9175	
9176	var $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
9177	
9178	if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) {    
9179		img.onload = function() {
9180		   pageHeaderInit(); 
9181		}
9182		
9183		img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
9184		
9185	} else {
9186		 pageHeaderInit();
9187	}
9188
9189	
9190	
9191	var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
9192
9193
9194	 if($('body[data-hhun="1"]').length > 0 && !$('#header-outer[data-remove-fixed="1"]').length > 0)  $('#header-outer').addClass('parallax-contained');
9195
9196	 window.addEventListener('scroll', function(){ 
9197        window.requestAnimationFrame(bindHeaderParallax);
9198    }, false);
9199
9200}
9201
9202					
9203function bindHeaderParallax(){
9204
9205	var $scrollTop = $(window).scrollTop();
9206	var pageHeadingHeight = $('#page-header-bg .col.span_6').height();
9207	
9208	if(!$('body').hasClass('mobile') && navigator.userAgent.match(/iPad/i) == null && $('body.material-ocm-open').length == 0 ){
9209
9210
9211		//material needs to set top for when effect wrap sets transform
9212		if(window.innerWidth > 1000) {
9213        $('body:not("[data-header-format=\'left-header\']") #page-header-bg[data-parallax="1"]').css('top',$('#ajax-content-wrap').offset().top);
9214    } else {
9215        $('body:not("[data-header-format=\'left-header\']") #page-header-bg[data-parallax="1"]').css('top','0');
9216    }
9217
9218		var $multiplier1 =  ($('body[data-hhun="1"]').length > 0 || $('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0) ? 0.40: 0.4;
9219    var $multiplier2 = ($('body[data-hhun="1"]').length > 0 || $('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0) ? 0.09: 0.09;
9220    var $parallaxHeaderHUN = ($('#header-outer[data-transparency-option="1"]').length > 0) ? 0.49: 0.4;
9221
9222		//calc bg pos
9223		if($('#page-header-bg.out-of-sight').length == 0) {
9224
9225			if($headerRemoveStickyness) {
9226				$('#page-header-bg[data-parallax="1"]').css({ 'transform': 'translateY('+ $scrollTop*-0.55 +'px)' });	
9227			} else {
9228				$('#page-header-bg[data-parallax="1"]').css({ 'transform': 'translateY('+ $scrollTop*-$multiplier1 +'px)' });
9229			}
9230
9231			var multipler = ($('body').hasClass('single')) ? 1 : 2;
9232			if(!$headerRemoveStickyness) {
9233				$('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap,  #page-header-bg[data-parallax="1"][data-post-hs="default_minimal"] .author-section').css({ 
9234					'opacity' : 1-($scrollTop/(pageHeaderHeight-60))
9235				});
9236			}
9237			
9238			if($headerRemoveStickyness) {
9239				$('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap, body[data-button-style="rounded"] #page-header-bg[data-parallax="1"] .scroll-down-wrap, #page-header-bg[data-parallax="1"][data-post-hs="default_minimal"] .author-section').css({ 'transform': 'translateY('+ $scrollTop*- 0.45+'px)' });
9240			} else {
9241				$('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap, body[data-button-style="rounded"] #page-header-bg[data-parallax="1"] .section-down-arrow, #page-header-bg[data-parallax="1"][data-post-hs="default_minimal"] .author-section').css({ 'transform': 'translateY('+ $scrollTop*- $multiplier2+'px)' });
9242			}
9243			
9244			if($('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap').css('opacity') == 0){
9245				$('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap, #page-header-bg[data-parallax="1"] .portfolio-filters').hide();
9246			} else {
9247				$('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap, #page-header-bg[data-parallax="1"] .portfolio-filters').show();
9248			}
9249
9250			if($('body[data-hhun="1"]').length > 0  && !$('#header-outer').hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) { 
9251          $('#header-outer.parallax-contained').css({ 'transform': 'translateY('+$scrollTop*-$parallaxHeaderHUN+'px)' });
9252      }
9253			
9254		
9255		}
9256		else if($('#page-header-bg.out-of-sight').length == 0) {
9257			//alt parallax effect
9258			var multipler = ($('body').hasClass('single')) ? 1 : 2;
9259			$('#page-header-wrap .nectar-particles .fade-out').css({ 
9260				'opacity' : 0+($scrollTop/(pageHeaderHeight+pageHeaderHeight*$multiplier))
9261			});
9262		}
9263
9264
9265		//hide elements to allow other parallax sections to work in webkit browsers
9266		if( ($scrollTop / (pageHeaderHeight + $('#header-space').height() + extraHeight)) > 1 ) {
9267			$('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility','hidden').hide().addClass('out-of-sight');
9268		}
9269		else {
9270		 	$('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility','visible').show().removeClass('out-of-sight');
9271
9272		 		//ensure header is centered
9273		 		pageHeaderHeight = parseInt($('#page-header-bg').height());
9274				$('#page-header-bg .container > .row').css('top',0);
9275				var $divisionMultipler = ($('#header-outer[data-remove-border="true"]').length > 0 && $('#header-outer[data-format="centered-menu-under-logo"]').length == 0) ? 2 : 1;
9276				pageHeadingHeight = $('#page-header-bg .col.span_6').height();
9277
9278	    }
9279		
9280
9281	}
9282
9283
9284
9285}
9286
9287if($('#page-header-bg').length > 0) {
9288	var $initialImgCheckAscend = extractUrl($('#page-header-bg').css('background-image'));
9289	if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) {    
9290		   $('#page-header-bg').addClass('has-bg');
9291	}
9292}
9293
9294
9295function pageHeaderInit(){
9296
9297	 var wooCommerceHeader = ($('.demo_store').length > 0) ? 32 : 0 ;
9298	 var centeredNavAltSpace = ($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) ? $('header#top nav > .sf-menu').height() -20 : null;
9299	 //transparent
9300	  if($('#header-outer[data-transparent-header="true"]').length > 0) {	
9301	     $('#page-header-bg[data-parallax="1"]').css({'top': extraHeight+wooCommerceHeader });
9302	  } else {
9303
9304	   var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
9305		 var headerPadding = parseInt($('#header-outer').attr('data-padding'));
9306		 var headerPadding2 = parseInt($('#header-outer').attr('data-padding'));
9307		 var extraDef = 10;
9308		 var headerResize = ($('body').hasClass('pp-video-function')) ? '1' : $('#header-outer').attr('data-header-resize');
9309		 var headerResizeOffExtra = 0;
9310		 var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
9311		 var usingLogoImage = true;
9312	     var mediaElement = ($('.wp-video-shortcode').length > 0) ? 36 : 0;
9313	     var secondaryHeader = ($('#header-outer').attr('data-using-secondary') == '1') ? 32 : 0 ;
9314	  	 if($('body[data-header-resize="0"]').length == 0 && $('body.material').length == 0) {
9315				 $('#page-header-bg[data-parallax="1"]').css({'top': ($('#page-header-wrap').offset().top)  + 'px' });
9316			 }
9317	  }
9318	  
9319	  //fade in header
9320	  if($('#ajax-content-wrap').length == 0 || !$('body').hasClass('ajax-loaded')){
9321	  	$('#page-header-bg[data-parallax="1"]').animate({ 'opacity' : 1},350,'easeInCubic');
9322	  } else if($('#ajax-content-wrap').length == 1) {
9323	  	$('#page-header-bg[data-parallax="1"]').css({ 'opacity' : 1});
9324	  }
9325
9326	  //verify smooth scorlling
9327	  if( $smoothCache == true && $(window).width() > 690 && $('body').outerHeight(true) > $(window).height() && Modernizr.csstransforms3d && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)){ niceScrollInit(); $(window).trigger('resize') } 
9328	  
9329
9330	  $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />');
9331}
9332
9333
9334
9335
9336function nectarPageHeader() {
9337
9338	if($('#page-header-bg').length > 0) {
9339		fullScreenHeaderInit();
9340		pageHeader();
9341	}
9342
9343
9344	if($('#page-header-bg[data-parallax="1"]').length > 0) {
9345
9346		var img = new Image();
9347		var $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
9348			
9349		if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) {    
9350			img.onload = function() {
9351			   pageHeaderInit();    
9352					
9353			}
9354			
9355			img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
9356			
9357		} else {
9358			 pageHeaderInit();
9359		}
9360
9361		//bindHeaderParallax();
9362		$('#page-header-bg[data-parallax="1"] .span_6').css({ 
9363			'opacity' : 1
9364		});
9365
9366		
9367
9368		if (window.addEventListener) {
9369			 window.addEventListener('scroll', function(){ 
9370	          requestAnimationFrame(bindHeaderParallax); 
9371	        }, false);
9372		}
9373
9374	} 
9375
9376	if($('#page-header-bg').length > 0) {
9377		var $initialImgCheckAscend = extractUrl($('#page-header-bg').css('background-image'));
9378		if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) {    
9379			   $('#page-header-bg').addClass('has-bg');
9380		}
9381	}
9382}
9383
9384if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
9385	window.onunload = function(){ nectarPageHeader(); };
9386}
9387
9388
9389/***************** header text effects *****************/
9390
9391// rotate in
9392function pageHeaderTextEffectInit() {
9393	$('#page-header-bg').each(function(){
9394		if($(this).attr('data-text-effect') == 'rotate_in') {
9395			var $topHeading = 'none';
9396
9397			if($(this).find('.span_6 h1').length > 0) {
9398				$topHeading = 'h1';
9399			} 
9400
9401
9402			if($topHeading != 'none') {
9403
9404				var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6';
9405
9406				$(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () {
9407			        return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, "");
9408			    }).wrap('<span class="wraped"></span>');
9409
9410			    $(this).find($selector).find('.wraped').each(function () {
9411
9412				    textNode = $(this);
9413
9414				    text = textNode.text().split(' ');
9415				    replace = '';
9416
9417				    $.each(text, function (index, value) {
9418				        if (value.replace(/\s+/, "")) {
9419				            replace += '<span class="wraped"><span>' + value + '</span></span> ';
9420				        }
9421				    });
9422				    textNode.replaceWith($(replace));
9423				    
9424				});
9425			}//make sure suitable heading was found
9426
9427		}//tilt
9428	});
9429	
9430}
9431function pageHeaderTextEffect() {
9432
9433	if($('#page-header-bg .nectar-particles').length == 0 && $('#page-header-bg[data-text-effect="none"]').length == 0 || $('.nectar-box-roll').length > 0 && $('#page-header-bg .nectar-particles').length == 0) {
9434
9435		var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6';
9436
9437		$($selector).find('.wraped').each(function(i){
9438			$(this).find('span').delay(i*370).transition({ rotateX: '0', 'opacity' : 1, y: 0},400,'easeOutQuad');
9439		});
9440
9441		setTimeout(function(){
9442
9443			$($selector).find('.inner-wrap > *:not(.top-heading)').each(function(i){
9444				$(this).delay(i*370).transition({ rotateX: '0', 'opacity' : 1, y: 0 },650,'easeOutQuad');
9445			});
9446
9447			$('.scroll-down-wrap').removeClass('hidden');
9448
9449		}, $($selector).find('.wraped').length * 370);
9450	}
9451
9452}
9453var $effectTimeout = ($('#ajax-loading-screen').length > 0) ? 800 : 0;
9454
9455pageHeaderTextEffectInit();
9456
9457if($('#page-header-bg .nectar-video-wrap video').length == 0) { setTimeout(pageHeaderTextEffect,$effectTimeout); }
9458
9459
9460
9461
9462 //submenu fix
9463  if($('header#top nav > ul.sf-menu ul').length > 0) {
9464
9465  	var $midnightSubmenuTimeout;
9466  	$('body').on('mouseover','#header-outer .midnightHeader .sf-with-ul, #header-outer .midnightHeader .cart-menu',function(){
9467
9468  		if($(this).parents('.midnightHeader').offset().top - $(window).scrollTop() < 50){
9469  		
9470  			$(this).parents('.midnightHeader').css({'z-index': '9999'}).addClass('overflow');
9471  			$(this).parents('.midnightInner').css('overflow','visible');
9472  		}
9473  	});
9474  	$('body').on('mouseleave','#header-outer .midnightHeader',function(){
9475  		var $that = $(this);
9476  		clearTimeout($midnightSubmenuTimeout);
9477  		$midnightSubmenuTimeout = setTimeout(function(){
9478  			if(!$that.is(':hover')) {
9479  				$that.css({'z-index': 'auto'}).removeClass('overflow');
9480  				$that.find('.midnightInner').css('overflow','hidden');
9481  		
9482  			}
9483
9484  		},900);
9485  	});
9486  }
9487
9488  function midnightInit() {
9489
9490  	if( $('#header-outer[data-permanent-transparent="1"]').length > 0 && $('body[data-bg-header="true"]').length > 0) {
9491
9492			//perma trans
9493			
9494			////fix pages that set no midnight coloring
9495			if($('.container-wrap div[data-midnight]').length == 0) {
9496				$('.container-wrap').attr('data-midnight','dark');
9497			}
9498
9499			////cache midnighgt compat divs
9500			var $midnightCompatArr = [];
9501			$('div[data-midnight]').each(function(){
9502
9503				if($(this).attr('data-midnight') == 'light' || $(this).attr('data-midnight') == 'dark') {
9504					$midnightCompatArr.push($(this));
9505				}
9506
9507			});
9508
9509
9510			if($midnightCompatArr.length > 0) {
9511
9512				$.each($midnightCompatArr,function(k,v){
9513
9514						if(v.attr('data-midnight') == 'light' || v.attr('data-midnight') == 'dark') {
9515
9516							var $that = v;
9517							var waypoint = new Waypoint({
9518				 				element: $that,
9519					 			handler: function(direction) {
9520				
9521					 				if($('body.material-ocm-open').length > 0) return;
9522
9523									if(direction == 'down') {
9524										var $textColor = ($that.attr('data-midnight') == 'light') ? '' : 'dark-slide';
9525										$('#header-outer').removeClass('dark-slide').addClass($textColor);
9526								
9527									} else {
9528
9529										if(k-1 >= 0) { 
9530											var $prevMidItem = k-1;
9531										} else {
9532											var $prevMidItem = k;
9533										}
9534
9535										var $textColor = ($midnightCompatArr[$prevMidItem].attr('data-midnight') == 'light') ? '' : 'dark-slide';
9536										$('#header-outer').removeClass('dark-slide').addClass($textColor);
9537
9538									} 
9539
9540							
9541								},
9542								offset: $('#header-outer').height()
9543
9544							}); 
9545
9546						}
9547
9548				}); //each
9549
9550			} //if rows with color set are found
9551
9552  	} //if page is using trans effect
9553
9554  
9555  } 
9556
9557
9558
9559//box roll
9560function getScrollbarWidth() {
9561    var outer = document.createElement("div");
9562    outer.style.visibility = "hidden";
9563    outer.style.width = "100px";
9564    outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
9565
9566    document.body.appendChild(outer);
9567
9568    var widthNoScroll = outer.offsetWidth;
9569    // force scrollbars
9570    outer.style.overflow = "scroll";
9571
9572    // add innerdiv
9573    var inner = document.createElement("div");
9574    inner.style.width = "100%";
9575    outer.appendChild(inner);        
9576
9577    var widthWithScroll = inner.offsetWidth;
9578
9579    // remove divs
9580    outer.parentNode.removeChild(outer);
9581
9582    return widthNoScroll - widthWithScroll;
9583}
9584
9585
9586function boxRollInit() {
9587	if($('.nectar-box-roll').length > 0) { 
9588
9589		$('body').attr('data-scrollbar-width',getScrollbarWidth());
9590		
9591		$('body, html, #ajax-content-wrap, .container-wrap, .blurred-wrap').addClass('no-scroll');
9592		$('body,html').stop().animate({ scrollTop:0 },0);
9593		$('.container-wrap').css('opacity',0).addClass('no-transform-animation-bottom-out').addClass('bottomBoxOut');
9594		//keep loading icon centered if scrollbar is going away
9595		if($('.mobile').length == 0) $('#ajax-loading-screen .loading-icon > span').css({ 'left' : '-'+getScrollbarWidth()/2 +'px'});
9596
9597		//change content pos
9598		var $overlaid = $('#page-header-bg .overlaid-content').clone();
9599		var $scrollDownOverlaid = $('.scroll-down-wrap').clone();
9600		$('#page-header-bg').removeAttr('data-midnight');
9601		$('#page-header-bg .overlaid-content, #page-header-bg .scroll-down-wrap').remove();
9602		$('.nectar-box-roll').append($overlaid);
9603		if($('#header-outer.dark-slide').length == 0) {
9604			$('.nectar-box-roll').attr('data-midnight','light');
9605		} else {
9606			$('.nectar-box-roll').attr('data-midnight','dark');
9607		}
9608		$('.overlaid-content').append($scrollDownOverlaid);
9609
9610		if($('.page-submenu[data-sticky="true"]').length > 0) {
9611			$('.container-wrap').addClass('no-trans');
9612		}
9613		
9614		nectarBoxRollContentHeight();
9615		
9616		$('html').addClass('nectar-box-roll-loaded');
9617		
9618		setTimeout(function() { pageLoadHash(); },700);
9619	} else {
9620		$('#ajax-content-wrap, .blurred-wrap').addClass('at-content');
9621		$('body, html, #ajax-content-wrap, .container-wrap, .blurred-wrap').removeClass('no-scroll');
9622		$('.container-wrap').css('opacity',1).removeClass('no-transform-animation-bottom-out').removeClass('bottomBoxOut').removeClass('bottomBoxIn');
9623		perspect = 'not-rolled';
9624	}
9625}
9626if($('.nectar-box-roll').length > 0) { 
9627	boxRollInit();
9628}
9629
9630function nectarBoxRollContentHeight() {
9631
9632	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').height();
9633
9634	if($('#header-outer[data-transparent-header="true"]').length == 0) {
9635			$('.nectar-box-roll .overlaid-content, .nectar-box-roll .canvas-bg, .container-wrap').css({'height':window.innerHeight - $headerNavSpace, 'min-height':window.innerHeight - $headerNavSpace });
9636			if($('.mobile').length == 0 && $('body[data-header-format="left-header"]').length == 0) { 
9637				$('#ajax-content-wrap').css('margin-top',$headerNavSpace); 
9638				$('#slide-out-widget-area.fullscreen').css('margin-top','-'+$headerNavSpace+'px'); 
9639			}
9640			else { 
9641				$('#ajax-content-wrap, #slide-out-widget-area.fullscreen').css('margin-top','0'); 
9642			}
9643	} else {
9644		
9645		if($('.mobile').length > 0 && $('body[data-permanent-transparent="1"]').length == 0 ) {
9646			$('.nectar-box-roll .overlaid-content, .nectar-box-roll .canvas-bg, .container-wrap').css('height',window.innerHeight - $headerNavSpace);
9647		} else {
9648			$('.nectar-box-roll .overlaid-content, .nectar-box-roll .canvas-bg, .container-wrap').css('height',window.innerHeight);
9649		}
9650		
9651	}
9652}
9653
9654if($('.nectar-box-roll').length > 0) $(window).on('resize',nectarBoxRollContentHeight);
9655
9656
9657var perspect = 'not-rolled';
9658var animating = 'false';
9659function boxRoll(e,d) {
9660	
9661	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').height();
9662
9663	if($('#slide-out-widget-area.open').length > 0) return false;
9664	if( $('.nectar-box-roll canvas').length > 0 && $('.nectar-box-roll canvas[data-loaded="true"]').length == 0) return false;
9665
9666	if(perspect == 'not-rolled' && animating == 'false' && d == -1) {
9667		perspect = 'rolled';
9668		animating = 'true';
9669		$('body').addClass('box-animating').addClass('box-perspective-rolled').addClass('box-rolling');
9670
9671		$('.nectar-box-roll #page-header-bg').removeClass('topBoxIn').addClass('topBoxOut').css('will-change','transform');
9672		
9673		$('.nectar-box-roll .overlaid-content').removeClass('topBoxIn2').removeClass('topBoxIn').addClass('topBoxOut2').css('will-change','transform');
9674		
9675		$('.container-wrap').removeClass('bottomBoxOut').addClass('bottomBoxIn').removeClass('no-transform-animation-bottom-out').addClass('nectar-box-roll-class').css('will-change','transform');
9676		if($('#header-outer[data-transparent-header="true"]').length == 0) {
9677			$('.container-wrap').css({'height':$(window).height() - $headerNavSpace, 'opacity': 1});
9678			$('#slide-out-widget-area.fullscreen').css('margin-top','0px');
9679		} else {
9680			$('.container-wrap').css({'height':$(window).height(), 'opacity': 1});
9681		}
9682		
9683
9684		$('.nectar-slider-wrap').css({'opacity':0});
9685
9686		updateRowRightPadding(d);
9687		pauseVideoBG();
9688
9689		//old browser workaround
9690		var timeout1 = 1220;
9691		var timeout2 = 1650;
9692		var timeout3 = 1700;
9693		var timeout4 = 1350;
9694		if( $('html.no-cssanimations').length > 0) {
9695			timeout1 = 1;
9696			timeout2 = 1;
9697			timeout3 = 1;
9698			timeout4 = 1;
9699		}
9700
9701		$('.container-wrap').css('padding-right',$('body').attr('data-scrollbar-width') + 'px');
9702		setTimeout(function(){
9703			$('#header-outer, #wpadminbar, body:not(.material) .cart-outer .cart-menu, .midnightHeader .midnightInner').animate({'padding-right': $('body').attr('data-scrollbar-width')},250);
9704			$('.nectar-box-roll .canvas-bg').addClass('out-of-sight');
9705			if($('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent');
9706
9707			if($('body.mobile').length > 0) $('.nectar-box-roll').css({'z-index':'1'});
9708			
9709			//perma trans coloring
9710			$first_row_coloring = ($('.container-wrap > .main-content > .row > .wpb_row').length > 0) ? $('.container-wrap > .main-content > .row > .wpb_row:first-child').attr('data-midnight') : 'dark';
9711			if($('#header-outer[data-permanent-transparent="1"]').length > 0) {
9712				
9713				if($first_row_coloring == 'dark') {
9714					$('#header-outer').addClass('dark-slide');
9715				} else {
9716					$('#header-outer').removeClass('dark-slide');
9717				}
9718				
9719			}
9720			
9721		},timeout1);
9722		setTimeout(function(){ 
9723			updateRowRightPadding(1);
9724			$('body,html,#ajax-content-wrap, .container-wrap, .blurred-wrap').removeClass('no-scroll'); 
9725			$('#ajax-content-wrap, .blurred-wrap').addClass('at-content');
9726			$('.container-wrap, #footer-outer').removeClass('bottomBoxIn').removeClass('nectar-box-roll-class').addClass('auto-height');
9727			$('#header-outer, #wpadminbar, .container-wrap, .cart-outer .cart-menu, .midnightHeader .midnightInner').stop().css('padding-right',0);
9728
9729			if( $smoothActive == 1 && $(window).width() > 690  && Modernizr.csstransforms3d && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){ 
9730				niceScrollInit();
9731			}
9732			
9733			$('.nectar-box-roll').css({'z-index':'-1000'}).transition({'y': '-200%'},0);
9734			$('.nectar-box-roll canvas').hide();
9735			$('body').removeClass('box-rolling');
9736			$('.nectar-slider-wrap').transition({'opacity':1},600,'easeOutCubic');
9737
9738			$('.nectar-box-roll #page-header-bg, .nectar-box-roll .overlaid-content, .container-wrap').css('will-change','auto');
9739			if($waypointsBound == false) { 
9740				waypoints();	
9741				midnightInit();
9742			}
9743			
9744		},timeout2);
9745		
9746		//fadeIn
9747		setTimeout(function(){ 
9748			$('.container-wrap .main-content > .row > div > div[class*="col"]').css({'opacity':1});
9749		},timeout4);
9750
9751		setTimeout(function(){ 
9752					animating ='false'; 
9753					$('body').removeClass('box-animating');		
9754		},timeout3);
9755
9756		//header position when transparent nav was used
9757		if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length != 0) { 
9758			$('#ajax-content-wrap').transition({'margin-top':$('#header-outer').outerHeight(true) + $('#header-outer').offset().top},2000,'easeInOutQuad');
9759		}
9760
9761		//remove header if not fixed
9762		if($('.mobile #header-outer[data-permanent-transparent="1"]').length > 0 && $('.mobile #header-outer[data-mobile-fixed="false"]').length == 1) $('#header-outer').transition({'y':'-100%'},400,'easeOutCubic');
9763
9764	}
9765
9766	else if(perspect == 'rolled' && animating == 'false' && d == 1 && $(window).scrollTop() < 100) {
9767
9768		$('.container-wrap').removeClass('auto-height');
9769		if($('#header-outer[data-transparent-header="true"]').length == 0) {
9770			$('.container-wrap').css({'height':$(window).height() - $headerNavSpace, 'opacity': 1});
9771		} else {
9772			$('.container-wrap').css({'height':$(window).height(), 'opacity': 1});
9773		}
9774		
9775		$('#footer-outer').removeClass('auto-height');
9776		$('body').addClass('box-rolling');
9777
9778		perspect = 'not-rolled';
9779		animating = 'true';
9780		$('body').addClass('box-animating').addClass('box-perspective-not-rolled');
9781
9782		$('#header-outer, #wpadminbar, .container-wrap, .cart-outer .cart-menu, .midnightHeader .midnightInner').css('padding-right',$('body').attr('data-scrollbar-width') + 'px');
9783		$('.nectar-slider-wrap').transition({'opacity':0},600,'easeOutCubic');
9784		$('.container-wrap .main-content > .row > div > div[class*="col"]').stop(true).css({'opacity':0});
9785		setTimeout(function(){
9786			$('#header-outer, #wpadminbar, .cart-outer .cart-menu, .midnightHeader .midnightInner').animate({'padding-right': 0},250);
9787			$('.nectar-box-roll .canvas-bg').removeClass('out-of-sight');
9788			resizeVideoToCover();
9789			//header position when transparent nav was used
9790			if($('#header-outer[data-transparent-header="true"]').length != 0) { 
9791				$('#ajax-content-wrap').stop(true,true).transition({'margin-top':0},2000,'easeInOutCubic');
9792			} else {
9793				if($('.mobile').length == 0) $('#slide-out-widget-area.fullscreen').css('margin-top','-'+$headerNavSpace+'px');
9794			}
9795
9796		},30);
9797
9798		//old browser workaround
9799		var timeout1 = 1700;
9800		var timeout2 = 1600;
9801		var timeout3 = 1300;
9802		if( $('html.no-cssanimations').length > 0) {
9803			timeout1 = 1;
9804			timeout2 = 1;
9805			timeout3 = 1;
9806		}
9807
9808		if($('body.mobile').length > 0) {
9809			setTimeout(function(){
9810				$('.nectar-box-roll').css('z-index','1000');
9811			},timeout3);
9812		} else {
9813			$('.nectar-box-roll').css('z-index','1000');
9814		}
9815
9816		updateRowRightPadding(d);
9817		removeNiceScroll();
9818		$('.nectar-box-roll').transition({'y': '0'},0);
9819		$('.nectar-box-roll canvas').show();
9820		setTimeout(function(){ 
9821			updateRowRightPadding(1);
9822			animating ='false'; 
9823			$('body').removeClass('box-animating');
9824			$('#page-header-bg').removeClass('topBoxIn');
9825			$('.overlaid-content').removeClass('topBoxIn2');	
9826			$('body').removeClass('box-rolling');
9827			resumeVideoBG();
9828			$('.nectar-box-roll #page-header-bg, .nectar-box-roll .overlaid-content, .container-wrap').css('will-change','auto');
9829			
9830			
9831			//perma trans coloring
9832			if($('#header-outer[data-permanent-transparent="1"]').length > 0) {
9833				
9834				if( $('.nectar-box-roll[data-midnight="dark"]').length > 0 ) {
9835					$('#header-outer').addClass('dark-slide');
9836				} else {
9837					$('#header-outer').removeClass('dark-slide');
9838				}
9839				
9840			}
9841			
9842		},timeout1);
9843
9844		setTimeout(function(){
9845			if($('.mobile #header-outer[data-permanent-transparent="1"]').length > 0 && $('.mobile #header-outer[data-mobile-fixed="false"]').length == 1) $('#header-outer').transition({'y':'0%'},400,'easeOutCubic');
9846		},timeout2);
9847
9848		$('body,html,#ajax-content-wrap, .container-wrap, .blurred-wrap').addClass('no-scroll');
9849		$('#ajax-content-wrap, .blurred-wrap').removeClass('at-content');
9850		$('.container-wrap').addClass('nectar-box-roll-class');
9851		$('.nectar-box-roll #page-header-bg').removeClass('topBoxOut').addClass('topBoxIn').css('will-change','transform');
9852		
9853		$('.container-wrap').removeClass('bottomBoxIn').addClass('bottomBoxOut').css('will-change','transform');
9854
9855		if($('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').addClass('transparent');
9856
9857		$('.nectar-box-roll .overlaid-content').removeClass('topBoxOut2').removeClass('topBoxOut').addClass('topBoxIn2').css('will-change','transform');
9858	
9859		if($('#header-outer[data-header-resize="1"]').length > 0) { bigNav(); }
9860
9861		$('.nectar-box-roll .trigger-scroll-down').removeClass('hovered');
9862	}
9863
9864	
9865}
9866
9867function boxScrollEvent(event, delta) {
9868	if($('#slide-out-widget-area.open.fullscreen').length > 0 || $('.material-ocm-open').length > 0 ||  $('#search-outer.material-open').length > 0 ) return false;
9869	boxRoll(event,delta);
9870}
9871
9872function boxRollMouseWheelInit() {
9873	if($('.nectar-box-roll').length > 0) {
9874		$('body').on("mousewheel", boxScrollEvent);
9875	} else {
9876		$('body').off("mousewheel", boxScrollEvent);
9877	}
9878}
9879
9880if($('.nectar-box-roll').length > 0) {
9881	boxRollMouseWheelInit();
9882}
9883
9884$('body').on('click','.nectar-box-roll .section-down-arrow',function(){
9885	boxRoll(null,-1);
9886	$(this).addClass('hovered');
9887	setTimeout(function(){ $('.nectar-box-roll .section-down-arrow').removeClass('hovered'); },2000);
9888	return false;
9889});
9890
9891
9892
9893function updateRowRightPadding(d){
9894	$('.wpb_row.full-width-section').each(function(){
9895		if($(this).hasClass('extraPadding') && d == 1) {
9896			$(this).css('padding-right',parseInt($(this).css('padding-right')) - parseInt($('body').attr('data-scrollbar-width')) + 'px' ).removeClass('extraPadding');
9897		} else {
9898			$(this).css('padding-right',parseInt($('body').attr('data-scrollbar-width')) + parseInt($(this).css('padding-right')) + 'px' ).addClass('extraPadding');
9899		}	
9900	});
9901	$('.wpb_row.full-width-content').each(function(){
9902		if($(this).find('.row-bg.using-image').length == 0) {
9903			if($(this).hasClass('extraPadding') && d == 1) {
9904				$(this).find('.row-bg').css('width',parseInt($(this).width()) - parseInt($('body').attr('data-scrollbar-width')) + 'px' ).removeClass('extraPadding');
9905			} else {
9906				$(this).find('.row-bg').css('width',parseInt($('body').attr('data-scrollbar-width')) + $(this).width() + 'px' ).addClass('extraPadding');
9907			}	
9908		}
9909	});
9910}
9911
9912function pauseVideoBG() {
9913	if($('.nectar-box-roll video').length > 0 && !nectarDOMInfo.usingMobileBrowser) { $('.nectar-box-roll video')[0].pause(); }
9914}
9915function resumeVideoBG() {
9916	if($('.nectar-box-roll video').length > 0 && !nectarDOMInfo.usingMobileBrowser) { $('.nectar-box-roll video')[0].play(); }
9917}
9918
9919//touch 
9920if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && $('.nectar-box-roll').length > 0) {
9921	$('body').swipe({
9922		tap: function(event,target) {
9923			if($(target).parents('.nectar-flip-box').length > 0)
9924				$(target).parents('.nectar-flip-box').trigger('click');
9925			if($(target).is('.nectar-flip-box'))
9926				$(target).trigger('click');
9927		},
9928		swipeStatus: function(event, phase, direction, distance, duration, fingers) {
9929			if($('#slide-out-widget-area.open').length > 0) return false;
9930			if(direction == 'up') {
9931				boxRoll(null,-1);
9932				if($('#ajax-content-wrap.no-scroll').length == 0) $('body').swipe("option", "allowPageScroll", 'vertical');
9933			} else if(direction == "down" && $(window).scrollTop() == 0) {
9934				boxRoll(null,1);
9935				$('body').swipe("option", "allowPageScroll", 'auto');
9936			}
9937		}
9938	});
9939
9940}
9941
9942function removeNiceScroll() {
9943		if($().niceScroll && $("html").getNiceScroll()){
9944			var nice = $("html").getNiceScroll();
9945			nice.stop();
9946			
9947			$('html').removeClass('no-overflow-y');
9948			$('.nicescroll-rails').hide();
9949			if($('#boxed').length == 0){
9950				$('body, body #header-outer, body #header-secondary-outer, body #search-outer, .midnightHeader .midnightInner').css('padding-right','0px');
9951			} else if($('body[data-ext-responsive="true"]').length == 0 ) {
9952				$('body').css('padding-right','0px');
9953			}
9954
9955			$('body').attr('data-smooth-scrolling','0');
9956		}
9957	}
9958//called after box roll
9959var $waypointsBound = false;
9960function waypoints() {
9961	rowBGAnimations();
9962	columnBGAnimations();
9963	colAndImgAnimations(); 
9964	progressBars(); 
9965	dividers();
9966	iconList();
9967	animated_titles();
9968	highlighted_text();
9969	imageWithHotspots();
9970	clientsFadeIn(); 
9971	splitLineHeadings();
9972	svgAnimations(); 
9973	milestoneInit();
9974	nectar_fancy_ul_init();
9975	owl_carousel_animate();
9976	headerRowColorInheritInit();
9977	morphingOutlines(); 
9978	portfolioLoadIn();
9979	animatedColBorders();
9980	foodMenuItems();
9981	vcWaypoints();
9982	$waypointsBound = true;
9983}
9984
9985
9986
9987/***************** WooCommerce Cart *****************/
9988var timeout;
9989var productToAdd;
9990var $dropdownStyle = ($('body[data-dropdown-style="minimal"]').length > 0)  ? 'minimal' : 'default';
9991//notification
9992$('body').on('click','.product .add_to_cart_button', function(){
9993
9994	var $productHeading = ($(this).parents('li').find('h2').length > 0) ? 'h2' : 'h3';
9995
9996	productToAdd = $(this).parents('li').find($productHeading).text();
9997	$('#header-outer .cart-notification span.item-name').html(productToAdd);
9998	
9999});
10000
10001//notification hover
10002$('body').on('mouseenter','#header-outer .cart-notification',function(){
10003	if($dropdownStyle == 'minimal') {
10004		$(this).hide();
10005		$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).show();
10006		$('#header-outer .cart_list').stop(true,true).show();
10007	} else {
10008		$(this).fadeOut(400);
10009		$('#header-outer .widget_shopping_cart').stop(true,true).fadeIn(300);
10010		$('#header-outer .cart_list').stop(true,true).fadeIn(300);
10011	}
10012	
10013	clearTimeout(timeout);
10014});
10015
10016//cart dropdown
10017var $headerCartSelector = ($('body.material').length > 0) ? '#header-outer .nectar-woo-cart' : '#header-outer  div.cart-outer';
10018
10019if($($headerCartSelector).length > 0) {
10020	$($headerCartSelector).hoverIntent(function(){
10021
10022		if($dropdownStyle == 'minimal') { 
10023			$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).show()
10024			$('#header-outer .cart_list').stop(true,true).show();
10025			clearTimeout(timeout);
10026			$('#header-outer .cart-notification').hide();
10027		} else {
10028			$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).fadeIn(300);
10029			$('#header-outer .cart_list').stop(true,true).fadeIn(300);
10030			clearTimeout(timeout);
10031			$('#header-outer .cart-notification').fadeOut(300);
10032		}
10033		
10034	});
10035}
10036
10037
10038$('body').on('mouseleave',$headerCartSelector,function(){
10039	var $that = $(this);
10040	setTimeout(function(){
10041		if(!$that.is(':hover')){
10042			$('#header-outer .widget_shopping_cart').removeClass('open').stop(true,true).fadeOut(300);
10043			$('#header-outer .cart_list').stop(true,true).fadeOut(300);
10044		}
10045	},200);
10046});
10047
10048if($('#header-outer[data-cart="false"]').length == 0) {
10049	$('body').on('added_to_cart', shopping_cart_dropdown_show);
10050	$('body').on('added_to_cart', shopping_cart_dropdown);
10051	
10052	//update header cart markup after ajax remove
10053	$('body').on('removed_from_cart', wooCartImgPos);
10054}
10055
10056function shopping_cart_dropdown() {
10057		
10058		if(!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 ) {
10059			$('.cart-menu-wrap').addClass('has_products');
10060			$('header#top nav > ul, #search-outer #search #close a, header#top .span_9 >.slide-out-widget-area-toggle').addClass('product_added');
10061
10062			if(!$('.cart-menu-wrap').hasClass('static')) $('.cart-menu-wrap, #mobile-cart-link').addClass('first-load');
10063			
10064			//change position of img in cart nav dropdown
10065			wooCartImgPos();
10066			
10067			//nectar slider nav directional effect
10068			if($('#header-outer').hasClass('directional-nav-effect') && $('#header-outer .cart-icon-wrap .dark').length == 0 && $('body.ascend').length > 0){
10069				$('#header-outer .cart-outer .cart-icon-wrap').each(function(){
10070                    $(this).find('> i, > span.light, > span.dark, > span.original').remove();
10071                    $(this).append('<span class="dark"><span><i class="icon-salient-cart"></i></span></span><span class="light"><span><i class="icon-salient-cart"></i></span></span><span class="original"><span><i class="icon-salient-cart"></i></span></span>');
10072                	$(this).find('.original').attr('data-w',$(this).find('span.original').width()+1);
10073                });
10074			}
10075		}
10076
10077}
10078
10079
10080function shopping_cart_dropdown_show(e) {
10081		
10082		clearTimeout(timeout);
10083		
10084		if(!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 && typeof e.type != 'undefined' ) {
10085			
10086			//fix for standalone woocommerce add to cart buttons
10087			if( $('#header-outer .cart-notification .item-name').length > 0 && $('#header-outer .cart-notification .item-name').text().length == 0 ) { return; }
10088			
10089			//before cart has slide in
10090			if(!$('#header-outer .cart-menu-wrap').hasClass('has_products')) {
10091				setTimeout(function(){ $('#header-outer .cart-notification').fadeIn(400); },400);
10092			}
10093			else if(!$('#header-outer .cart-notification').is(':visible')) {
10094				$('#header-outer .cart-notification').fadeIn(400);
10095			} else {
10096				$('#header-outer .cart-notification').show();
10097			}
10098			timeout = setTimeout(hideCart,2700);
10099
10100			$('.cart-menu a, .widget_shopping_cart a').addClass('no-ajaxy');
10101		}
10102}
10103
10104function hideCart() {
10105	$('#header-outer .cart-notification').stop(true,true).fadeOut();
10106}
10107
10108function checkForWooItems(){ 
10109	
10110	var checkForCartItems = setInterval(shopping_cart_dropdown,250);
10111	setTimeout(function(){ clearInterval(checkForCartItems); },4500);
10112	
10113}
10114
10115function wooCartImgPos() {
10116	$('#header-outer .widget_shopping_cart .cart_list li').each(function(){
10117		
10118		if( $(this).find('> img').length == 0 && $(this).find('.product-meta').length == 0 ) {
10119			
10120			var productCartImgLinkSrc = ($(this).find('> a[href]:not(.remove)').length > 0) ? $(this).find('> a[href]:not(.remove)').attr('href') : '';
10121			var productCartImg = $(this).find('> a > img').clone();
10122			
10123			$(this).wrapInner('<div class="product-meta" />');
10124			
10125			$(this).prepend(productCartImg);
10126			
10127			if(productCartImgLinkSrc.length > 0) {
10128			   productCartImg.wrap('<a href="'+productCartImgLinkSrc+'"></a>');
10129			}
10130			
10131		}
10132		
10133	});
10134}
10135
10136if($('#header-outer[data-cart="false"]').length == 0) {
10137	checkForWooItems();
10138}
10139
10140function nectarAccountPageTabs() {
10141	
10142	//if not on account page
10143	if($('body.woocommerce-account #customer_login').length == 0) return;
10144	
10145	//create HTML
10146	$('.woocommerce-account .woocommerce > #customer_login').prepend('<div class="nectar-form-controls" />');
10147	
10148	$('.woocommerce-account .woocommerce > #customer_login > div:not(.nectar-form-controls)').each(function(){
10149			var $title = $(this).find('> h2').text();
10150			$('#customer_login .nectar-form-controls').append('<div class="control">' + $title + '</div>');
10151	});
10152	
10153	//event
10154	$('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').on('click',function(){
10155		
10156		$('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').removeClass('active');
10157		$(this).addClass('active');
10158		
10159		var formIndex = $(this).index() + 1;
10160		$('#customer_login div[class*="u-column"]').hide();
10161		$('#customer_login div[class*="u-column"].col-'+formIndex).show();
10162		
10163		setTimeout(function(){
10164			$('#customer_login div[class*="u-column"]').removeClass('visible');
10165			$('#customer_login div[class*="u-column"].col-'+formIndex).addClass('visible');
10166		},30);
10167		
10168	});
10169	
10170	//starting
10171	$('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control:nth-child(1)').trigger('click');
10172	
10173}
10174
10175nectarAccountPageTabs();
10176
10177var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
10178var secondaryHeader = ($('#header-outer').attr('data-using-secondary') == '1') ? 32 : 0 ;
10179function searchFieldCenter(){
10180	var $headerHeightSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
10181	$('#search-outer').css('top', $headerHeightSpace + extraHeight + secondaryHeader);
10182	$('#search-outer > #search #search-box').css('top',($(window).height()/2) - ($('#search-outer > #search input').height()/2) - $headerHeightSpace );
10183}
10184
10185
10186
10187//text on hover effect
10188$('body').on('mouseover','.text_on_hover .product-wrap',function(){
10189	$(this).parent().addClass('hovered');
10190});
10191$('body').on('mouseover','.text_on_hover > a:first-child',function(){
10192	$(this).parent().addClass('hovered');
10193});
10194
10195$('body').on('mouseout','.text_on_hover .product-wrap',function(){
10196	$(this).parent().removeClass('hovered');
10197});
10198$('body').on('mouseout','.text_on_hover > a:first-child',function(){
10199	$(this).parent().removeClass('hovered');
10200});
10201
10202
10203//material/fancy parallax hover effect zindex
10204if($('.material.product').length > 0 || $('.minimal.product').length > 0 || $('.nectar-fancy-box[data-style="parallax_hover"]').length > 0 || $('.nectar-category-grid[data-shadow-hover="yes"]').length > 0){
10205
10206	var $productZindex = 101;
10207	
10208	$('body').on('mouseenter','.material.product, .minimal.product, .nectar-fancy-box[data-style="parallax_hover"], .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item',function(){
10209		
10210		$productZindex++;
10211
10212		$(this).css('z-index',$productZindex+1);
10213		
10214	});
10215	$('body').on('mouseleave','.material.product, .minimal.product, .nectar-fancy-box[data-style="parallax_hover"], .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item',function(){
10216		
10217		var $that = $(this);
10218		setTimeout(function(){ if(!$that.is(':hover')) $that.css('z-index',100); },350);
10219	});
10220
10221	//reset to stop zindex from getting too high
10222	setInterval(function(){ 
10223		if($('.nectar-fancy-box[data-style="parallax_hover"]:hover').length > 0 || $('.minimal.product:hover').length > 0) {
10224			 return;
10225		}
10226
10227		$('.material.product:not(:hover), .minimal.product:not(:hover), .nectar-fancy-box[data-style="parallax_hover"]:not(:hover), .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item:not(:hover)').css('z-index',100);
10228		$productZindex = 101; 
10229	},10000);
10230
10231}
10232
10233function minimalProductHover() {
10234	
10235	//add icons
10236	$('.products .classic .product-wrap .add_to_cart_button').wrapInner('<span />');
10237	$('.products .classic .product-wrap .add_to_cart_button').prepend('<i class="normal icon-salient-cart"></i>');
10238	
10239	//bind hover
10240	$('body').on('mouseover', '.products .minimal.product',function(){
10241		minimalProductCalc($(this));
10242	});
10243	
10244	$('body').on('mouseleave', '.products .minimal.product',function(){
10245		
10246		$(this).find('.background-color-expand').css({
10247			'transform': 'scale(1)'
10248		});
10249		
10250	});
10251	
10252	//starting trigger mouse over
10253	$('.products .minimal.product').each(function(){
10254		if($(this).is(':hover')) {
10255			$(this).trigger('mouseover');
10256		}
10257	});
10258}
10259
10260function minimalProductCalc(el) {
10261	var $item = el;
10262	var $itemWidth = $item.width();
10263	var $itemHeight = $item.height();
10264	
10265	var $wChange = (parseInt($itemWidth) + 40) / parseInt($itemWidth);
10266	var $hChange = (parseInt($itemHeight) + 40) / parseInt($itemHeight);
10267	
10268	$item.addClass('hover-bound');
10269	
10270	$item.find('.background-color-expand').css({
10271		'transform': 'scale('+ $wChange + ',' + $hChange  +') translateY(0px)'
10272	});
10273}
10274
10275minimalProductHover();
10276
10277
10278
10279
10280//mobile widget filters
10281////skip widgets without any titles
10282$('.woocommerce #sidebar .widget.woocommerce').each(function(){
10283	if($(this).find('> h4').length == 0) {
10284		$(this).addClass('no-widget-title');
10285	}
10286});
10287
10288$('body').on('click','#sidebar .widget.woocommerce:not(.widget_price_filter) h4',function(){
10289	if($(window).width() < 1000) {
10290		$(this).parent().find('> ul').slideToggle();
10291		$(this).parent().toggleClass('open-filter');
10292	}
10293});
10294
10295	//slide in cart
10296	$('body').on('mouseenter','#header-outer [data-cart-style="slide_in"] .cart-menu-wrap',openRightCart);
10297
10298	function openRightCart() {
10299
10300		if($('.nectar-slide-in-cart ul.cart_list li:not(.empty)').length > 0) {
10301			$('.nectar-slide-in-cart').addClass('open');
10302
10303			$(window).on('mousemove.rightCartOffsetCheck',closeCartCheck);
10304		}
10305	}
10306
10307	function closeCartCheck(e) {
10308		var $windowWidth = $(window).width();
10309		if(e.clientX < $windowWidth - 370 - $bodyBorderWidth) {
10310
10311			$(window).off('mousemove.rightCartOffsetCheck',closeNavCheck);
10312
10313			$('.nectar-slide-in-cart').removeClass('open');
10314
10315		}
10316
10317	}
10318
10319
10320
10321
10322
10323/***************** Search ******************/
10324	var $placeholder = ($('#search-outer #search input[type=text][data-placeholder]').length > 0) ? $('#search-outer #search input[type=text]').attr('data-placeholder') : '';
10325	var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
10326	
10327
10328	if($('body').hasClass('material') && $('#header-outer .bg-color-stripe').length == 0) {
10329		$('#header-outer').append('<div class="bg-color-stripe" />');
10330	} 
10331
10332	////search box event
10333	$('body').on('click', '#search-btn a', function(){ return false; });
10334	$('body').on('mouseup', '#search-btn a:not(.inactive), #header-outer .mobile-search', function(){
10335
10336		if($(this).hasClass('open-search')) { return false; } 
10337
10338
10339		if($('body').hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0 ){ 
10340			$('#search-outer > #search form, #search-outer #search .span_12 span').css('opacity',0);
10341			$('#search-outer > #search form').css('bottom','10px');
10342			$('#search-outer #search .span_12 span').css('top','10px');
10343			$('#search-outer').show();
10344			$('#search-outer').stop().transition({scale: '1,0', 'opacity': 1},0).transition({ scale: '1,1'},400,'easeInOutCubic');
10345
10346			$('#search-outer > #search form').delay(400).animate({'opacity':1, 'bottom':0},'easeOutCirc');
10347			$('#search-outer #search .span_12 span').delay(470).animate({'opacity':1, 'top':0},'easeOutCirc');
10348			
10349		} else if( !$('body').hasClass('material') ) {
10350			$('#search-outer').stop(true).fadeIn(600,'easeOutExpo');
10351		} else {
10352
10353			/*material*/
10354			$('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition',''); 
10355
10356			$('#search-outer').addClass('material-open');
10357			$('#ajax-content-wrap').addClass('material-open');
10358			$('#header-outer').addClass('material-search-open');
10359			$('#fp-nav').addClass('material-ocm-open');
10360
10361
10362		}
10363
10364
10365		if($('body[data-header-format="left-header"]').length == 0) {
10366			$('body.original #search-outer > #search input[type="text"]').css({
10367				'top' : $('#search-outer').height()/2 - $('#search-outer > #search input[type="text"]').height()/2
10368			});
10369		}
10370		
10371		setTimeout(function(){
10372
10373			$('#search input[type=text]').focus();
10374			
10375			if($('#search input[type=text]').attr('value') == $placeholder){
10376				$('#search input[type=text]').setCursorPosition(0);	
10377			}
10378
10379		},300);
10380
10381		//ascend
10382		if($('body').hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0){ 
10383			searchFieldCenter();
10384		}
10385
10386		$(this).toggleClass('open-search');
10387
10388		//close slide out widget area
10389		$('.slide-out-widget-area-toggle a:not(#toggle-nav).open:not(.animating)').trigger('click');
10390
10391		return false;
10392	});
10393	
10394	$('body:not(.material)').on('keydown','#search input[type=text]',function(){
10395		if($(this).attr('value') == $placeholder){
10396			$(this).attr('value', '');
10397		}
10398	});
10399	
10400	$('body:not(.material)').on('keyup','#search input[type=text]',function(){
10401		if($(this).attr('value') == ''){
10402			$(this).attr('value', $placeholder);
10403			$(this).setCursorPosition(0);
10404		}
10405	});
10406	
10407	
10408	////close search btn event
10409	$('body').on('click','#close',function(){
10410		closeSearch();
10411		$('#search-btn a, #header-outer .mobile-search').removeClass('open-search');
10412		return false;
10413	});
10414
10415	//close material when clicking off the search
10416	$('body.material').on('click', '#ajax-content-wrap', function(e){
10417		if (e.originalEvent !== undefined) {
10418			closeSearch();
10419			$('#search-btn a, #header-outer .mobile-search').removeClass('open-search');
10420		}
10421	});
10422
10423	//material gets esc
10424	if($('body.material').length > 0) {
10425		$(document).keyup(function(e) {
10426
10427	     if (e.keyCode == 27) { 
10428	     	closeSearch();  
10429	     	$('#search-btn a').removeClass('open-search'); 
10430
10431	     	//close ocm material
10432	     	if($('.ocm-effect-wrap.material-ocm-open').length > 0) {
10433	     		$('.slide-out-widget-area-toggle.material-open a').trigger('click');
10434	     	}
10435	     }
10436
10437		});
10438	}
10439
10440	//if user clicks away from the search close it
10441	$('body:not(.material)').on('blur','#search-box input[type=text]',function(e){
10442		closeSearch();
10443		$('#search-btn a, #header-outer .mobile-search').removeClass('open-search');
10444	});
10445
10446	
10447	function closeSearch(){
10448		if($('body').hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0){ 
10449			$('#search-outer').stop().transition({'opacity' :0},300,'easeOutCubic');
10450			$('#search-btn a').addClass('inactive');
10451			setTimeout(function(){ $('#search-outer').hide(); $('#search-btn a').removeClass('inactive'); },300);
10452		} else if($('body.material').length == 0) {
10453			$('#search-outer').stop(true).fadeOut(450,'easeOutExpo');
10454		}
10455
10456		if($('body').hasClass('material')) {
10457			$('#ajax-content-wrap').removeClass('material-open');
10458			$('#header-outer').removeClass('material-search-open');
10459			$('#search-outer').removeClass('material-open');
10460			$('#fp-nav').removeClass('material-ocm-open');
10461		}
10462	}
10463	
10464	
10465	//mobile search
10466	$('body').on('click', '#mobile-menu #mobile-search .container a#show-search',function(){
10467		$('#mobile-menu .container > ul').slideUp(500);
10468		return false;
10469	});
10470	
10471/***************** Nav ******************/
10472	
10473
10474	function centeredNavBottomBarReposition() {
10475		
10476		var $headerOuter = $('#header-outer');
10477		var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
10478		var $headerSpan3 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_3');
10479		var $secondaryHeader = $('#header-secondary-outer');
10480		var $headerBtns = $headerSpan3.find('nav >ul.buttons');
10481		var $bodyBorderSize = ($('.body-border-top').length > 0 && $(window).width() > 1000) ? $('.body-border-top').height(): 0;
10482		var override_remove_check = false;
10483		
10484		function centeredNavBottomBarSecondary() {
10485			if($('body.mobile').length > 0) {
10486				$('#header-outer').css('margin-top','');
10487			} else {
10488				if($('#header-outer').css('top') == '0px') {
10489						
10490						$(window).off('scroll', centeredNavBottomFixed_Add);
10491						$(window).off('scroll', centeredNavBottomFixed_Remove);
10492						
10493						$navLogoMargin = parseInt($('body.material #header-outer #logo').css('margin-top'));
10494						if($headerSpan9.offset().top - $navLogoMargin - nectarDOMInfo.scrollTop <= $headerOuter.offset().top - parseInt($secondaryHeader.height()) ) {
10495								$(window).on('scroll', centeredNavBottomFixed_Add);
10496						} else {
10497								$(window).on('scroll', centeredNavBottomFixed_Remove);
10498						}
10499					
10500				}
10501
10502				
10503				$('#header-outer').css('margin-top',nectarDOMInfo.secondaryHeaderHeight);
10504				
10505				// custom mobile breakpoint
10506				if($('#header-outer .span_9').css('display') == 'none') {
10507					 $('#header-outer').css('margin-top','');
10508				} else if($('#header-outer .span_9').css('display') != 'none' && parseInt($('#header-outer').css('top')) > 0) {
10509					 $('#header-outer').css('top','');
10510				}
10511				
10512				
10513			}
10514			
10515		}
10516		
10517		if($secondaryHeader.length > 0) {
10518			
10519			if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
10520				setTimeout(function(){
10521					nectarDOMInfo.secondaryHeaderHeight = $('#header-secondary-outer').height();
10522					centeredNavBottomBarSecondary();
10523				},50);
10524				$(window).smartresize(centeredNavBottomBarSecondary);
10525			}
10526		
10527		} 
10528		
10529
10530		var $navLogoMargin = parseInt($('body.material #header-outer #logo').css('margin-top'));
10531		
10532
10533		if($('#header-outer[data-condense="true"]').length > 0) {
10534			
10535				$(window).on('scroll',centeredNavBottomFixed_Add);
10536				$(window).trigger('scroll');
10537				
10538				
10539				$(window).smartresize(function(){
10540					
10541					condenseCustomBreakPointHelper();
10542					
10543					//trigger condense if switching from mobile to desktop and user has scrolled down
10544					if(nectarDOMInfo.windowWidth > 1000 && $('#header-outer').css('position') == 'fixed' && $('#header-outer').css('top') == '0px' && override_remove_check == false) {
10545						setTimeout(function(){
10546							$(window).off('scroll', centeredNavBottomFixed_Add);
10547							$(window).off('scroll', centeredNavBottomFixed_Remove);
10548							override_remove_check = true;
10549							centeredNavBottomFixed_Remove();
10550						},100);
10551							
10552					}
10553				});
10554				
10555				function condenseCustomBreakPointHelper() {
10556					var $withinCustomBreakpoint = mobileBreakPointCheck();
10557					
10558					//adding class to prevent logo from hiding when opening OCM
10559					if($withinCustomBreakpoint) {
10560						$('#header-outer').addClass('within-custom-breakpoint');
10561					} else {
10562						$('#header-outer').removeClass('within-custom-breakpoint');
10563					}
10564				}
10565				
10566				condenseCustomBreakPointHelper();
10567
10568		}
10569
10570		
10571		
10572		
10573		function centeredNavBottomFixed_Add() {
10574				
10575				if(nectarDOMInfo.windowWidth < 1000 || $('body.material-ocm-open').length > 0 || $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9').css('display') == 'none') { return; }
10576				
10577				$navLogoMargin = parseInt($('body.material #header-outer #logo').css('margin-top'));
10578				
10579				var $bodyBorderTop = ($('.body-border-top').length > 0 && nectarDOMInfo.secondaryHeaderHeight > 0) ? $('.body-border-top').height() : 0;
10580				
10581				if($headerSpan9.offset().top - $navLogoMargin - nectarDOMInfo.scrollTop <= $headerOuter.offset().top - parseInt(nectarDOMInfo.secondaryHeaderHeight) + $bodyBorderTop ) {
10582						
10583						var amountToMove = (parseInt($headerSpan9.position().top) - $navLogoMargin - parseInt(nectarDOMInfo.adminBarHeight)) + parseInt(nectarDOMInfo.secondaryHeaderHeight) - $bodyBorderTop;
10584						
10585						//megamenu RT
10586						if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer .megamenu').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0) {
10587							$('#header-outer').removeClass('no-transition');	
10588						}
10589						
10590						$headerOuter.addClass('fixed-menu').removeClass('transparent').css({
10591							'top' : '-' + amountToMove + 'px',
10592							'position': 'fixed'
10593						});
10594						
10595						var $headerNavBarOffset = $('header#top .span_9 nav >ul').offset().top;
10596						var $headerButtonsOffset = $headerBtns.offset().top;
10597						
10598						if($('#boxed > #header-outer').length > 0) {
10599							$headerButtonsOffset = $headerButtonsOffset + 20;
10600						}
10601
10602						var $headerButtonsHeight = ($headerSpan9.find('.sf-menu > li > a').length > 0) ? (20 - parseInt($headerSpan9.find('.sf-menu > li > a').height())) / 2 : 2;
10603						$headerBtns.css('transform','translateY('+ (parseInt($headerNavBarOffset) - parseInt($headerButtonsOffset) - $headerButtonsHeight - 1) +'px)');
10604						
10605						$headerBtns.find('.nectar-woo-cart').css('height',$headerOuter.height() + parseInt($headerOuter.css('top')) - parseInt(nectarDOMInfo.adminBarHeight) + parseInt(nectarDOMInfo.secondaryHeaderHeight) );
10606
10607						//search
10608
10609						$(window).off('scroll', centeredNavBottomFixed_Add);
10610						$(window).on('scroll', centeredNavBottomFixed_Remove);
10611				}
10612		}
10613		
10614		function centeredNavBottomFixed_Remove() {
10615			
10616			if(nectarDOMInfo.windowWidth < 1000 || $('body.material-ocm-open').length > 0 || $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9').css('display') == 'none') { return; }
10617			
10618			$navLogoMargin = parseInt($('body.material #header-outer #logo').css('margin-top'));
10619			
10620			if($headerSpan9.offset().top - $navLogoMargin - nectarDOMInfo.scrollTop > $headerOuter.offset().top - parseInt(nectarDOMInfo.secondaryHeaderHeight) || override_remove_check ) {
10621						$headerOuter.removeClass('fixed-menu').css({
10622							'top' : '0',
10623							'position': 'absolute'
10624						});
10625						
10626						//reset override_remove_check
10627						override_remove_check = false;
10628						
10629						//search
10630						//$('#search-outer .container').css('transform','translateY(0px)');
10631						
10632						$headerBtns.css('transform','translateY(0px)');
10633						
10634						$headerBtns.find('.nectar-woo-cart').css('height','');
10635						
10636						if($('#header-outer.transparent').length == 0) {
10637							
10638							if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer .megamenu').length > 0) {
10639								$('#header-outer').removeClass('no-transition');	
10640							}
10641							
10642							if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
10643								
10644								if($('#header-outer').attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0 && $('.megamenu.sfHover').length == 0) {
10645									$('#header-outer').addClass('transparent');
10646									$('#header-outer').removeClass('no-transition');	
10647								}
10648								
10649								else if($('#header-outer').attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0 && $('.megamenu.sfHover').length > 0) {
10650									$('#header-outer').addClass('no-transition');	
10651								}
10652								
10653							} else {
10654								if($('#header-outer').attr('data-transparent-header') == 'true'  && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent');
10655							}
10656						}
10657						
10658						$(window).off('scroll', centeredNavBottomFixed_Remove);
10659						$(window).on('scroll', centeredNavBottomFixed_Add);
10660							
10661			}
10662			
10663		}
10664		
10665		
10666		
10667}
10668	
10669	
10670
10671function condenseHeaderMobileOverride() {
10672	var $transCondenseHeader = $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"][data-condense="true"][data-transparent-header="true"] .span_9');
10673	
10674	if($transCondenseHeader.length > 0 && nectarDOMInfo.windowWidth > 1000 && $transCondenseHeader.css('display') == 'none') {
10675		$('#header-outer').removeClass('transparent').addClass('no-transition');
10676	} else if($transCondenseHeader.length > 0 && nectarDOMInfo.scrollTop < 20 && nectarDOMInfo.windowWidth > 1000 && $transCondenseHeader.css('display') != 'none') {
10677		$('#header-outer:not(.transparent)').addClass('transparent');
10678	}
10679
10680	
10681}
10682
10683
10684	
10685	if($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) {
10686		centeredNavBottomBarReposition();
10687		
10688		condenseHeaderMobileOverride();
10689		$(window).smartresize(condenseHeaderMobileOverride);
10690	}
10691	
10692	
10693	function centeredLogoMargins() {
10694
10695		if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $(window).width() > 1000) {
10696			$midnightSelector = ($('#header-outer .midnightHeader').length > 0) ? '> .midnightHeader:first-child' : '';
10697			var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] '+$midnightSelector+' nav > .sf-menu > li').length;
10698			if($('#header-outer #social-in-menu').length > 0) { $navItemLength--; }
10699
10700			$centerLogoWidth = ($('#header-outer .row .col.span_3 #logo img:visible').length == 0) ? parseInt($('#header-outer .row .col.span_3').width()) : parseInt($('#header-outer .row .col.span_3 img:visible').width());
10701
10702			$extraMenuSpace = ($('#header-outer[data-lhe="animated_underline"]').length > 0) ? parseInt($('#header-outer header#top nav > ul > li:first-child > a').css('margin-right')) : parseInt($('#header-outer header#top nav > ul > li:first-child > a').css('padding-right'));
10703			
10704			if($extraMenuSpace > 30) {
10705				$extraMenuSpace += 45;
10706			} else if($extraMenuSpace > 20) {
10707				$extraMenuSpace += 40;
10708			} else {
10709				$extraMenuSpace += 30;
10710			}
10711
10712			$('#header-outer[data-format="centered-logo-between-menu"] nav > .sf-menu > li:nth-child('+Math.floor($navItemLength/2)+')').css({'margin-right': ($centerLogoWidth+$extraMenuSpace) + 'px'}).addClass('menu-item-with-margin');
10713			$leftMenuWidth = 0;
10714			$rightMenuWidth = 0;
10715			$('#header-outer[data-format="centered-logo-between-menu"] '+$midnightSelector+' nav > .sf-menu > li:not(#social-in-menu)').each(function(i){
10716				if(i+1 <= Math.floor($navItemLength/2)) {
10717					$leftMenuWidth += $(this).width();
10718				} else {
10719					$rightMenuWidth += $(this).width();
10720				}
10721
10722			});
10723
10724			var $menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth);
10725
10726			if($leftMenuWidth > $rightMenuWidth)  {
10727				$('#header-outer .row > .col.span_9').css('padding-right',$menuDiff);
10728			}
10729			else {
10730				$('#header-outer .row > .col.span_9').css('padding-left',$menuDiff);
10731			}
10732
10733			$('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility','visible');
10734		}
10735	}
10736	
10737	var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
10738	var headerPadding = parseInt($('#header-outer').attr('data-padding'));
10739	var usingLogoImage = $('#header-outer').attr('data-using-logo');
10740	
10741	if( isNaN(headerPadding) || headerPadding.length == 0 ) { headerPadding = 28; }
10742	if( isNaN(logoHeight) || usingLogoImage.length == 0 ) { usingLogoImage = false; logoHeight = 30;}
10743	
10744	if($('header#top nav > ul li#search-btn a').length > 0) {
10745		var $searchBtnHeight = $('header#top nav > ul li#search-btn a').height();
10746	} else {
10747		var $searchBtnHeight = 24;
10748	}
10749
10750	//inital calculations
10751	function headerInit() {
10752		
10753		if($('#header-outer[data-format="left-header"]').length > 0) return;
10754
10755
10756		if($('body.material').length == 0) {
10757
10758			$('#header-outer #logo img').css({
10759				'height' : logoHeight				
10760			});	
10761
10762			$('body:not(.material) #header-outer, .ascend #header-outer[data-full-width="true"][data-using-pr-menu="true"] header#top nav ul.buttons li.menu-item, .ascend #header-outer[data-full-width="true"][data-format="centered-menu"] header#top nav ul.buttons li#social-in-menu').css({
10763				'padding-top' : headerPadding
10764			});	
10765			
10766			if($('body.mobile').length == 0) {
10767				$('header#top nav > ul > li:not(#social-in-menu) > a').css({
10768					'padding-bottom' : Math.floor( ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding),
10769					'padding-top' : Math.floor( (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2))
10770				});	
10771				
10772				var $socialInMenuHeight = ($('header#top nav > .sf-menu > li:not(#social-in-menu) a').length > 0 && $('header#top nav > .sf-menu > li:not(#social-in-menu) a').height() > 22) ? $('header#top nav > .sf-menu > li:not(#social-in-menu) a').height() : $('header#top nav > ul > li#social-in-menu > a i').height();
10773				
10774				$('header#top nav > ul > li#social-in-menu > a').css({
10775					'margin-top' : Math.ceil(logoHeight/2) - Math.ceil($socialInMenuHeight/2)
10776				});	
10777			}
10778			
10779			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
10780				$('#header-outer .cart-menu').css({  
10781					'padding-bottom' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding),
10782					'padding-top' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding)
10783				});	
10784			} 
10785			
10786			
10787			$('header#top nav > ul li#search-btn, header#top nav > ul li#nectar-user-account, header#top nav > ul li.slide-out-widget-area-toggle').css({
10788				'padding-bottom' : (logoHeight/2) - ($searchBtnHeight/2),
10789				'padding-top' : (logoHeight/2) - ($searchBtnHeight/2)
10790			});	
10791			
10792
10793			
10794			if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
10795				$('header#top nav > ul li#search-btn, header#top nav > ul li#nectar-user-account, header#top nav > ul li.slide-out-widget-area-toggle').css({
10796					'padding-top': 0,
10797					'padding-bottom': 0
10798				});
10799
10800				$('header#top nav > ul.buttons').css({
10801					'margin-top' : - headerPadding,
10802					'height' : Math.floor(logoHeight + headerPadding*2) -1
10803				});
10804
10805				$('header#top nav > ul li#search-btn a, header#top nav > ul li#nectar-user-account a, header#top nav > ul li.slide-out-widget-area-toggle a').css({
10806					'visibility' : 'visible',
10807					'padding-top': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding),
10808					'padding-bottom': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding)
10809				});
10810			}
10811			
10812			$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').css({
10813				'top' : $('header#top nav > ul.sf-menu > li > a').outerHeight() 
10814			});	
10815			
10816			
10817			setTimeout(function(){ 
10818				$('body:not(.ascend):not(.material) #search-outer #search-box .ui-autocomplete').css({
10819					'top': parseInt($('#header-outer').outerHeight())+'px'
10820				}); 
10821			},1000);
10822			
10823			$('body:not(.ascend):not(.material) #search-outer #search-box .ui-autocomplete').css({
10824				'top': parseInt($('#header-outer').outerHeight())+'px'
10825			});
10826
10827		}//not material skin
10828
10829		//header space
10830		if($('.nectar-parallax-scene.first-section').length == 0) {
10831
10832			if($('#header-outer').attr('data-using-secondary') == '1'){
10833				if($('#header-outer[data-mobile-fixed="false"]').length > 0  || $('body.mobile').length == 0 ) {
10834					$('#header-space').css('height', parseInt($('#header-outer').outerHeight()) + $('#header-secondary-outer').height());
10835					
10836				} else {
10837					$('#header-space').css('height', parseInt($('#header-outer').outerHeight()));
10838					
10839				}
10840				
10841			} else {
10842
10843				$('#header-space').css('height', $('#header-outer').outerHeight() );
10844			} 
10845		}
10846		
10847		$('#header-outer .container, #header-outer .cart-menu').css('visibility','visible');
10848		
10849
10850		if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
10851			$('body:not(.ascend):not(.material) #search-outer, #search .container').css({
10852				'height' : logoHeight + headerPadding*2
10853			});	
10854			
10855			$('body:not(.ascend):not(.material) #search-outer > #search input[type="text"]').css({
10856				'font-size'  : 43,
10857				'height' : '59px',
10858				'top' : ((logoHeight + headerPadding*2)/2) - $('#search-outer > #search input[type="text"]').height()/2
10859			});
10860			
10861			$('body:not(.ascend):not(.material) #search-outer > #search #close a').css({
10862				'top' : ((logoHeight + headerPadding*2)/2) - 8
10863			});	
10864		} else {
10865			$('body:not(.ascend):not(.material) #search-outer, #search .container').css({
10866				'height' : logoHeight + headerPadding*2 + logoHeight + 17
10867			});	
10868			
10869			$('body:not(.ascend):not(.material) #search-outer > #search input[type="text"]').css({
10870				'font-size'  : 43,
10871				'height' : '59px',
10872				'top' : ((logoHeight + headerPadding*2)/2) - ($('#search-outer > #search input[type="text"]').height()/2) + logoHeight/2 + 17
10873			});
10874			
10875			$('body:not(.ascend):not(.material) #search-outer > #search #close a').css({
10876				'top' : ((logoHeight + headerPadding*2)/2) - 8 + logoHeight/2 + 17
10877			});	
10878		}
10879		
10880
10881	}
10882
10883	
10884	//is header resize on scroll enabled?
10885	var headerResize = $('#header-outer').attr('data-header-resize');
10886	var headerHideUntilNeeded = $('body').attr('data-hhun');
10887
10888	//transparent fix
10889
10890	if($('#header-outer[data-remove-fixed="1"]').length == 0) {
10891		if($(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) $('#header-outer').removeClass('transparent');
10892	}
10893
10894	if( headerResize == 1 && headerHideUntilNeeded != '1'){
10895		
10896		headerInit();
10897
10898		$(window).off('scroll.headerResizeEffect');
10899
10900		if($('#nectar_fullscreen_rows').length == 0) {
10901			$(window).on('scroll.headerResizeEffect',smallNav);
10902		}
10903		else if($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) ) {
10904			$(window).on('scroll.headerResizeEffect',smallNav);
10905		}
10906
10907	} else if(headerHideUntilNeeded != '1') {
10908		headerInit();
10909		$(window).off('scroll.headerResizeEffectOpaque');
10910		$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
10911		
10912	}
10912 else if(headerHideUntilNeeded == '1') {
10913
10914		headerInit();
10915
10916		if($('.nectar-box-roll').length > 0) $('#header-outer').addClass('at-top-before-box');
10917
10918		var previousScroll = 0, // previous scroll position
10919        menuOffset = $('#header-space').height()*2, // height of menu (once scroll passed it, menu is hidden)
10920        detachPoint = ($('body.mobile').length > 0) ? 150 : 600, // point of detach (after scroll passed it, menu is fixed)
10921        hideShowOffset = 6; // scrolling value after which triggers hide/show menu
10922
10923	    // on scroll hide/show menu
10924	    function hhunCalcs(e) {
10925
10926	     //stop scrolling while animated anchors
10927	     if($('body.animated-scrolling').length > 0 && $('#header-outer.detached').length > 0) return false;
10928
10929	     //stop when material ocm or material search is open
10930	     if($('body.material-ocm-open').length > 0 || $('#search-outer.material-open').length > 0) { return false; }
10931
10932	     //stop on mobile if not using sticky option
10933	      if($('#header-outer[data-mobile-fixed="false"]').length > 0 && $('body.mobile').length > 0) {  $('#header-outer').removeClass('detached'); return false; }
10934
10935	      var currentScroll = $(this).scrollTop(), // gets current scroll position
10936	            scrollDifference = Math.abs(currentScroll - previousScroll); // calculates how fast user is scrolling
10937
10938	      if (!$('#header-outer').hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) {
10939	       
10940	        // if scrolled past menu
10941	        if (currentScroll > menuOffset) {
10942	          // if scrolled past detach point add class to fix menu
10943	          if (currentScroll > detachPoint) {
10944	            if (!$('#header-outer').hasClass('detached'))
10945	              $('#header-outer').addClass('detached').removeClass('parallax-contained');
10946	          	   $('#header-outer').removeClass('no-transition');	
10947
10948
10949	          	  if($('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent');
10950	          }
10951
10952	          // if scrolling faster than hideShowOffset hide/show menu
10953	          if (scrollDifference >= hideShowOffset) {
10954	            if (currentScroll > previousScroll) {
10955	              // scrolling down; hide menu
10956	              if (!$('#header-outer').hasClass('invisible')) {
10957								
10958									if($('#header-outer.at-top').length > 0) {
10959									
10960										//prevent header from transitioning when first hiding
10961										$('#header-outer').addClass('no-trans-hidden');
10962										setTimeout(function(){
10963											$('#header-outer').addClass('invisible').removeClass('at-top');
10964											$('#header-outer').removeClass('no-trans-hidden');
10965										},30);
10966										
10967									} else {
10968										
10969										$('#header-outer').addClass('invisible').removeClass('at-top');
10970									}
10971								
10972	                
10973									
10974	                 //close submenus
10975	                 if( $(".sf-menu").length > 0 && $().superfish ) {
10976		          		 $(".sf-menu").superfish('hide');
10977		          		 $('header#top nav > ul.sf-menu > li.menu-item-over').removeClass('menu-item-over');
10978		          	 }
10979
10980	              }
10981	                $('.page-submenu.stuck').css('transform','translateY(0px)').addClass('header-not-visible');
10982
10983	            	
10984	            } else {
10985	              // scrolling up; show menu
10986	              if ($('#header-outer').hasClass('invisible'))
10987	                $('#header-outer').removeClass('invisible');
10988
10989	            	if($('.body-border-top').length > 0 && $('body.mobile').length == 0) {
10990
10991	            		var $bodyBorderHeaderColorMatch = ($('.body-border-top').css('background-color') == '#ffffff' && $('body').attr('data-header-color') == 'light' || $('.body-border-top').css('background-color') == $('#header-outer').attr('data-user-set-bg')) ? true : false;
10992	            		var $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $('.body-border-top').height() : 0;
10993	          	    	$('.page-submenu.stuck').css('transform','translateY('+ ($('#header-outer').outerHeight()-$bodyBorderSizeToRemove) +'px)').removeClass('header-not-visible');
10994
10995	            	} else {
10996	            		$('.page-submenu.stuck').css('transform','translateY('+$('#header-outer').outerHeight()+'px)').removeClass('header-not-visible');
10997	            	}
10998	            }
10999	          }
11000	        } else {
11001	          // only remove "detached" class if user is at the top of document (menu jump fix)
11002	          $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 : 0;
11003	          if($('.body-border-top').length > 0) {
11004	          		$topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 + $('.body-border-top').height() : $('.body-border-top').height();
11005	          }
11006
11007	          if (currentScroll <= $topDetachNum){
11008	            $('#header-outer').removeClass('detached').removeClass('invisible').addClass('at-top');
11009	            
11010	            if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
11011		            if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.nectar-box-roll').length == 0 && $('.megamenu.sfHover').length == 0) { 
11012		            	$('#header-outer').addClass('transparent').css('transform','translateY(0)');
11013		            	$('#header-outer').removeClass('no-transition');	
11014		            }
11015		            else if($('.nectar-box-roll').length > 0) $('#header-outer').css('transform','translateY(0)').addClass('at-top-before-box');
11016		          
11017		        } else {
11018		        	 if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent').css('transform','translateY(0)');
11019		            else if($('.nectar-box-roll').length > 0) $('#header-outer').css('transform','translateY(0)').addClass('at-top-before-box');
11020		        }
11021
11022	            if( $('#page-header-bg[data-parallax="1"]').length > 0) $('#header-outer').addClass('parallax-contained').css('transform','translateY(0)');
11023	          }
11024	        }
11025
11026	        // if user is at the bottom of document show menu
11027	        if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
11028	          $('#header-outer').removeClass('invisible');
11029
11030	            if($('.body-border-top').length > 0 && $('body.mobile').length == 0) {
11031
11032            		var $bodyBorderHeaderColorMatch = ($('.body-border-top').css('background-color') == '#ffffff' && $('body').attr('data-header-color') == 'light' || $('.body-border-top').css('background-color') == $('#header-outer').attr('data-user-set-bg')) ? true : false;
11033            		var $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $('.body-border-top').height() : 0;
11034          	    	$('.page-submenu.stuck').css('transform','translateY('+ ($('#header-outer').outerHeight()-$bodyBorderSizeToRemove) +'px)').removeClass('header-not-visible');
11035	            }
11036	            else {
11037	            	$('.page-submenu.stuck').css('transform','translateY('+$('#header-outer').outerHeight()+'px)').removeClass('header-not-visible');
11038	            }
11039	          
11040	        }
11041
11042	      }
11043
11044	      // replace previous scroll position with new one
11045	      previousScroll = currentScroll;
11046
11047	    }
11048
11049	    //don't trigger for header remove stickiness
11050	    if($('#header-outer[data-remove-fixed="1"]').length == 0) {
11051		    hhunCalcs();
11052		    $(window).scroll(hhunCalcs);
11053		}
11054
11055
11056	}//end if hhun
11057	
11058	if($('#nectar_fullscreen_rows').length == 0 && $('.nectar-box-roll').length == 0) { midnightInit(); }	
11059	
11060	if($('#nectar_fullscreen_rows').length > 0 ) { ($('#header-outer').attr('data-permanent-transparent','false')) }
11061
11062	var shrinkNum = 6;
11063	var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
11064	var $bodyBorderHeaderColorMatch = ($('.body-border-top').css('background-color') == '#ffffff' && $('body').attr('data-header-color') == 'light' || $('.body-border-top').css('background-color') == $('#header-outer').attr('data-user-set-bg')) ? true : false;
11065	var $scrollTriggerOffset = ( $('body.material').length > 0 ) ? 150 : 0;
11066
11067	if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
11068
11069	function smallNav(){
11070		var $offset = $(window).scrollTop();
11071		var $windowWidth = $(window).width();
11072		
11073
11074		if($offset > $scrollTriggerOffset && $windowWidth > 1000 && $('body.material-ocm-open').length == 0) {
11075		
11076
11077			//if going to small when material search is closing, it must be closed immediately
11078			if($('body.material').length > 0) {
11079				if($('#search-outer.material-open').length == 0) {
11080					$('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition','none');
11081				}
11082
11083				//secondary header
11084				if($('#header-secondary-outer').length > 0) {
11085					$('#header-secondary-outer').addClass('hide-up').css('transform','translateY(-100%)');
11086					$('#header-outer').css('transform', 'translateY(-' +$('#header-secondary-outer').height()+ 'px)');
11087				}
11088
11089			}
11090
11091			if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
11092				if($('#header-outer').attr('data-transparent-header') == 'true' && $('#header-outer.side-widget-open').length == 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0 && $('.megamenu.sfHover').length == 0) { 
11093					$('#header-outer').removeClass('transparent');
11094					$('#header-outer').removeClass('no-transition');	
11095				}
11096			} else {
11097				if($('#header-outer').attr('data-transparent-header') == 'true' && $('#header-outer.side-widget-open').length == 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent');
11098			}
11099
11100			
11101			$('#header-outer, #search-outer').addClass('small-nav');
11102			
11103			//body border full width side padding
11104			if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true) {
11105				$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
11106					'padding' : '0'			
11107				},{queue:false, duration:250, easing: 'easeOutCubic'});	
11108			}
11109
11110			if($('body.material').length > 0) {
11111				$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
11112					'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(shrinkNum)*3) +'px'
11113				},{queue:false, duration:310, easing: 'easeOutQuad'});	
11114			}
11115			if($('body.material').length == 0) {
11116
11117				$('#header-outer #logo img').stop(true,true).animate({
11118					'height' : logoHeight - shrinkNum
11119				},{queue:false, duration:250, easing: 'easeOutCubic'});	
11120					
11121				$('body:not(.material) #header-outer, .ascend #header-outer[data-full-width="true"][data-using-pr-menu="true"] header#top nav ul.buttons li.menu-item, .ascend #header-outer[data-full-width="true"][data-format="centered-menu"] header#top nav ul.buttons li#social-in-menu').stop(true,true).animate({
11122					'padding-top' : Math.ceil(headerPadding / 1.8)
11123				},{queue:false, duration:250, easing: 'easeOutCubic'});	
11124				
11125				if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
11126					$('#header-outer .row > .span_3').stop(true,true).animate({
11127						'padding-bottom' : Math.ceil(headerPadding / 1.8)
11128					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11129				}
11130
11131				$('header#top nav > ul > li:not(#social-in-menu) > a').stop(true,true).animate({
11132					'padding-bottom' :  Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding / 1.8) ,
11133					'padding-top' :  Math.floor(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) 
11134				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
11135
11136				
11137
11138				$('header#top nav > ul > li#social-in-menu > a').stop(true,true).animate({
11139					'margin-bottom' :  Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li#social-in-menu > a').height()/2)) + headerPadding / 1.8) ,
11140					'margin-top' :  Math.floor(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li#social-in-menu > a').height()/2)) 
11141				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
11142				
11143				$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
11144					'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(shrinkNum)*3) +'px'
11145				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
11146
11147				if($bodyBorderHeaderColorMatch == true) {
11148					$('.body-border-top').stop(true,true).animate({
11149						'margin-top': '-'+$('.body-border-top').height()+'px'
11150					},{queue:false, duration:400, easing: 'easeOutCubic', complete: function() { $(this).css('margin-top',0)} });	 
11151				}
11152
11153				if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
11154					$('#header-outer .cart-menu').stop(true,true).animate({
11155						'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7),
11156						'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7) +1
11157					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11158				} 
11159				
11160				if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
11161					$('header#top nav > ul.buttons').stop(true,true).animate({
11162						'margin-top' : - Math.ceil(headerPadding/ 1.8),
11163						'height' : Math.floor((headerPadding*2)/ 1.8 + logoHeight-shrinkNum)
11164					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11165
11166					$('header#top nav > ul li#search-btn a, header#top nav > ul li#nectar-user-account a, header#top nav > ul li.slide-out-widget-area-toggle a').stop(true,true).animate({
11167						'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7),
11168						'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7) +1
11169					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11170
11171				} else {
11172					$('header#top nav > ul li#search-btn, header#top nav > ul li#nectar-user-account, header#top nav > ul li.slide-out-widget-area-toggle').stop(true,true).animate({
11173						'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2)),
11174						'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2))
11175					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11176				}
11177
11178				if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
11179					$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
11180						'top' : Math.floor($('header#top nav > ul > li > a').outerHeight())
11181					},{queue:false, duration:250, easing: 'easeOutCubic'});		
11182				} else {
11183					$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
11184						'top' : Math.floor($('header#top nav > ul > li > a').height() + (((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2))*2 + headerPadding / 1.8),
11185					},{queue:false, duration:250, easing: 'easeOutCubic'});		
11186				}
11187				
11188				$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').stop(true,true).animate({
11189					'top': Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8) +'px'
11190				},{queue:false, duration:250, easing: 'easeOutCubic'});	
11191			
11192
11193				if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
11194					$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
11195						'height' : Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8)
11196					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11197
11198					$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
11199						'font-size'  : 30,
11200						'line-height' : '30px',
11201						'height' : '44px',
11202						'top' : ((logoHeight-shrinkNum+headerPadding+5)/2) - ($('#search-outer > #search input[type="text"]').height()-15)/2
11203					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11204				
11205					$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
11206						'top' : ((logoHeight-shrinkNum + headerPadding+5)/2) - 10
11207					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11208
11209				} else {
11210					$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
11211						'height' : Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8) + logoHeight - shrinkNum + 17
11212					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11213
11214					$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
11215						'font-size'  : 30,
11216						'line-height' : '30px',
11217						'height' : '44px',
11218						'top' : ((logoHeight-shrinkNum+headerPadding+5)/2) - ($('#search-outer > #search input[type="text"]').height()-15)/2 + (logoHeight- shrinkNum)/2 + 8
11219					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11220
11221					$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
11222						'top' : ((logoHeight-shrinkNum + headerPadding+5)/2) - 10 + (logoHeight- shrinkNum)/2 + 8
11223					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11224				}
11225
11226			}//not material skin
11227		
11228			
11229
11230			//box roll
11231			if($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#ajax-content-wrap').animate({'margin-top':  (Math.floor((logoHeight-shrinkNum) +(headerPadding*2)/ 1.8 + extraHeight + secondaryHeader))  },{queue:false, duration:250, easing: 'easeOutCubic'})
11232			
11233			
11234			if($('body').hasClass('ascend')){ 
11235				$('#search-outer').stop(true,true).animate({
11236					'top' : Math.floor((logoHeight-shrinkNum) +(headerPadding*2)/ 1.8 + extraHeight + secondaryHeader)
11237				},{queue:false, duration:250, easing: 'easeOutCubic'});	
11238			}
11239			
11240			//if no image is being used
11241			if(usingLogoImage == false) $('body:not(.material) header#top #logo').stop(true,true).animate({
11242				'margin-top' : 0
11243			},{queue:false, duration:450, easing: 'easeOutExpo'});	
11244			
11245			$(window).off('scroll',smallNav);
11246			$(window).on('scroll',bigNav);
11247
11248			//dark slider coloring border fix
11249			$('#header-outer[data-transparent-header="true"]').css('transition','transform 0.3s ease, background-color 0.30s ease, opacity 0.3s ease, box-shadow 0.30s ease, margin 0.25s ease-out');
11250			$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','none');
11251			setTimeout(function(){ 
11252				$('#header-outer[data-transparent-header="true"]').css('transition','transform 0.3s ease, background-color 0.30s ease, opacity 0.3s ease, box-shadow 0.30s ease, border-color 0.30s ease, margin 0.25s ease-out'); 
11253				$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','border-color 0.30s ease');
11254			},300);
11255
11256		}
11257
11258	}
11259	
11260	function bigNav(){
11261		var $offset = $(window).scrollTop();
11262		var $windowWidth = $(window).width();
11263
11264		if($('body.material-ocm-open').length > 0) { return false; }
11265
11266		if($offset <= $scrollTriggerOffset && $windowWidth > 1000 || $('.small-nav').length > 0 && $('#ajax-content-wrap.no-scroll').length > 0 ) {
11267			
11268
11269			$('#header-outer, #search-outer').removeClass('small-nav');
11270			
11271			if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
11272				if($('#header-outer').attr('data-transparent-header') == 'true'  && $('.nectar-box-roll').length == 0 && $('.megamenu.sfHover').length == 0) {
11273					$('#header-outer').addClass('transparent');
11274					$('#header-outer').removeClass('no-transition');	
11275				}
11276			} else {
11277				if($('#header-outer').attr('data-transparent-header') == 'true'  && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent');
11278			}
11279
11280			
11281
11282
11283			//body border full width side padding
11284			if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true) {
11285				$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
11286					'padding' : '0 28px'			
11287				},{queue:false, duration:250, easing: 'easeOutCubic'});	
11288			}
11289
11290
11291			if($('body.material').length > 0) {
11292
11293				$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
11294					'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(shrinkNum)*3) +'px'
11295				},{queue:false, duration:140, easing: 'easeOutQuad'});
11296
11297				//secondary header
11298				if($('#header-secondary-outer').length > 0) {
11299					$('#header-secondary-outer, #header-outer').removeClass('hide-up').css('transform','translateY(0%)');
11300				}
11301		
11302			}
11303
11304			if($('body.material').length == 0) {
11305
11306				$('#header-outer #logo img').stop(true,true).animate({
11307					'height' : logoHeight,				
11308				},{queue:false, duration:250, easing: 'easeOutCubic'});	
11309
11310				$('body:not(.material) #header-outer, .ascend #header-outer[data-full-width="true"][data-using-pr-menu="true"] header#top nav ul.buttons li.menu-item, .ascend #header-outer[data-full-width="true"][data-format="centered-menu"] header#top nav ul.buttons li#social-in-menu').stop(true,true).animate({
11311					'padding-top' : headerPadding 
11312				},{queue:false, duration:250, easing: 'easeOutCubic'});	
11313				
11314				if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
11315					$('#header-outer .row > .span_3').stop(true,true).animate({
11316						'padding-bottom' : headerPadding 
11317					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11318				}
11319
11320				$('header#top nav > ul > li:not(#social-in-menu) > a').stop(true,true).animate({
11321					'padding-bottom' : ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding,
11322					'padding-top' : (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2) 
11323				},{queue:false, duration:250, easing: 'easeOutCubic'});	
11324				
11325				var $socialInMenuHeight = ($('header#top nav > .sf-menu > li:not(#social-in-menu) a').length > 0 && $('header#top nav > .sf-menu > li:not(#social-in-menu) a').height() > 22) ? $('header#top nav > .sf-menu > li:not(#social-in-menu) a').height() : $('header#top nav > ul > li#social-in-menu > a i').height();
11326				
11327				$('header#top nav > ul > li#social-in-menu > a').stop(true,true).animate({
11328					'margin-top' : Math.ceil(logoHeight/2) - Math.ceil($socialInMenuHeight/2)
11329				},{queue:false, duration:250, easing: 'easeOutCubic'});	
11330					
11331				$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
11332					'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(shrinkNum)*3) +'px'
11333				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
11334
11335				if($bodyBorderHeaderColorMatch == true) {
11336					$('.body-border-top').css({ 'margin-top': '-'+$('.body-border-top').height()+'px'}).stop(true,true).animate({
11337						'margin-top': '0'
11338					},{queue:false, duration:250, easing: 'easeOutCubic'});	 
11339				}
11340
11341				if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
11342					$('#header-outer .cart-menu').stop(true,true).animate({
11343						'padding-bottom' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding),
11344						'padding-top' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding)
11345					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11346				}
11347
11348				if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
11349					$('header#top nav > ul.buttons').stop(true,true).animate({
11350						'margin-top' : - Math.ceil(headerPadding),
11351						'height' : Math.floor(headerPadding*2 + logoHeight) -1
11352					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11353
11354					$('header#top nav > ul li#search-btn a, header#top nav > ul li#nectar-user-account a, header#top nav > ul li.slide-out-widget-area-toggle a').stop(true,true).animate({
11355						'padding-top': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding),
11356						'padding-bottom': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding)
11357					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11358				} else {
11359					$('header#top nav > ul li#search-btn, header#top nav > ul li#nectar-user-account, header#top nav > ul li.slide-out-widget-area-toggle').stop(true,true).animate({
11360						'padding-bottom' : Math.floor((logoHeight/2) - ($searchBtnHeight/2)),
11361						'padding-top' : Math.ceil((logoHeight/2) - ($searchBtnHeight/2))
11362					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11363				}
11364				
11365				if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
11366					$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
11367						'top' : Math.floor($('header#top nav > ul > li > a').outerHeight())
11368					},{queue:false, duration:250, easing: 'easeOutCubic'});		
11369				} else {
11370					$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
11371						'top' : Math.ceil($('header#top nav > ul > li > a').height() + (((logoHeight)/2) - ($('header#top nav > ul > li > a').height()/2))*2 + headerPadding),
11372					},{queue:false, duration:250, easing: 'easeOutCubic'});		
11373				}
11374				
11375				$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').stop(true,true).animate({
11376					'top': Math.ceil(logoHeight + headerPadding*2) +'px'
11377				},{queue:false, duration:250, easing: 'easeOutCubic'});	
11378				
11379				
11380				if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
11381					$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
11382						'height' : Math.ceil(logoHeight + headerPadding*2)
11383					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11384					
11385					$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
11386						'font-size'  : 43,
11387						'line-height' : '43px',
11388						'height' : '59px',
11389						'top' : ((logoHeight + headerPadding*2)/2) - 30
11390					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11391					
11392					
11393					$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
11394						'top' : ((logoHeight + headerPadding*2)/2) - 8
11395					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11396					
11397				} else {
11398					$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
11399						'height' : Math.ceil(logoHeight + headerPadding*2) + logoHeight + 17
11400					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11401					
11402					$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
11403						'font-size'  : 43,
11404						'line-height' : '43px',
11405						'height' : '59px',
11406						'top' : ((logoHeight + headerPadding*2)/2) - 30 + (logoHeight)/2 + 8
11407					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11408					
11409					
11410					$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
11411						'top' : ((logoHeight + headerPadding*2)/2) - 8 + (logoHeight)/2 + 8
11412					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11413				}
11414
11415
11416				if($('body').hasClass('ascend')){ 
11417					$('#search-outer').stop(true,true).animate({
11418						'top' : (logoHeight) +(headerPadding*2) + extraHeight + secondaryHeader
11419					},{queue:false, duration:250, easing: 'easeOutCubic'});	
11420				}
11421
11422				//if no image is being used
11423				if(usingLogoImage == false) $('header#top #logo').stop(true,true).animate({
11424					'margin-top' : 4
11425				},{queue:false, duration:450, easing: 'easeOutExpo'});	
11426				
11427
11428
11429			}//not material skin
11430
11431
11432				//box roll
11433			if($('.nectar-box-roll').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#ajax-content-wrap').animate({'margin-top':  (Math.floor((logoHeight) +(headerPadding*2) + extraHeight + secondaryHeader))  },{queue:false, duration:250, easing: 'easeOutCubic'})
11434			
11435
11436			$(window).off('scroll',bigNav);
11437			$(window).on('scroll',smallNav);
11438
11439
11440			//dark slider coloring border fix
11441			$('#header-outer[data-transparent-header="true"]').css('transition','transform 0.3s ease, background-color 0.30s ease, opacity 0.3s ease, box-shadow 0.30s ease, margin 0.25s ease-out');
11442			$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','none');
11443			setTimeout(function(){ 
11444				$('#header-outer[data-transparent-header="true"]').css('transition','transform 0.3s ease, background-color 0.30s ease, opacity 0.3s ease, box-shadow 0.30s ease, border-color 0.30s ease, margin 0.25s ease-out'); 
11445				$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','border-color 0.30s ease');
11446			},300);
11447		}
11448
11449	}
11450	
11451	
11452	function headerSpace() {
11453		if($('.mobile').length > 0) {
11454			if(window.innerHeight < window.innerWidth && window.innerWidth > 1000) {
11455				if($('#header-outer.small-nav').length == 0)
11456					$('#header-space').css('height', $('#header-outer').outerHeight() + $('#header-secondary-outer').height());
11457			} else {
11458				$('#header-space').css('height', $('#header-outer').outerHeight());
11459			}
11460			
11461		} else {
11462			if($('.nectar-parallax-scene.first-section').length == 0) {
11463
11464				var shrinkNum = 6;	
11465				var headerPadding = parseInt($('#header-outer').attr('data-padding'));
11466				if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
11467				var headerPadding2 = headerPadding - headerPadding/1.8;
11468				var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0 ) ? $('#header-outer').outerHeight() + (parseInt(shrinkNum) + headerPadding2*2) : $('#header-outer').outerHeight();
11469
11470				if($('#header-outer').attr('data-using-secondary') == '1'){
11471					$('#header-space').css('height', $headerHeight + $('#header-secondary-outer').height());
11472				} else {
11473					$('#header-space').css('height', $headerHeight);
11474				} 
11475			}
11476		}
11477		
11478	}
11479
11480	//call immediately on mobile to make sure there's no gap with fixed setups
11481	if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/) && $('#header-outer[data-mobile-fixed="1"]').length > 0 && $('#header-outer[data-permanent-transparent="false"]').length > 0) {
11482		$('#header-space').css('height', $('#header-outer').outerHeight());
11483	}
11484
11485
11486	var lastPosition = -1;
11487	var $headerScrollTop = nectarDOMInfo.scrollTop;
11488
11489	function headerOffsetAdjust(){
11490		if($('body.compose-mode').length > 0) { return; }
11491		$headerScrollTop = nectarDOMInfo.scrollTop;
11492
11493		 if (lastPosition == $headerScrollTop) {
11494            requestAnimationFrame(headerOffsetAdjust);
11495            return false;
11496        } else lastPosition = $headerScrollTop;
11497		
11498		headerOffsetAdjustCalc();
11499
11500		requestAnimationFrame(headerOffsetAdjust);
11501
11502	}
11503	var condenseHeaderLayout = $('#header-outer[data-condense="true"]').length > 0 ? true : false;
11504	var headerOuterCached = $('#header-outer');
11505	
11506	function headerOffsetAdjustCalc() {
11507		if($('body.mobile').length > 0 || condenseHeaderLayout == true && $('#header-outer .span_9').css('display') == 'none') {
11508			var $eleHeight = 0;
11509
11510			var $endOffset = ($('#wpadminbar').css('position') == 'fixed') ? $('#wpadminbar').height() : 0;
11511			$eleHeight += ($('#header-secondary-outer').length > 0 && $('#header-secondary-outer').css('display') == 'block') ? nectarDOMInfo.secondaryHeaderHeight : 0;
11512			$eleHeight += nectarDOMInfo.adminBarHeight;
11513			
11514			if( $eleHeight - $headerScrollTop > $endOffset) { 
11515				headerOuterCached.css('top', $eleHeight - $headerScrollTop + 'px');
11516			}
11517			else { headerOuterCached.css('top', $endOffset); }
11518
11519		} else {
11520				if(condenseHeaderLayout == false) {
11521					var $eleHeight = 0;
11522					
11523					$eleHeight += nectarDOMInfo.secondaryHeaderHeight;
11524					$eleHeight += nectarDOMInfo.adminBarHeight;
11525					headerOuterCached.css('top',$eleHeight+'px');
11526				}
11527		}
11528	}
11529
11530	if($('#header-outer[data-mobile-fixed="1"]').length > 0 && $('#wpadminbar').length > 0 || $('#header-outer[data-mobile-fixed="1"]').length > 0 && $('#header-secondary-outer').length > 0) {
11531		if($('#nectar_fullscreen_rows').length == 0) { requestAnimationFrame(headerOffsetAdjust); }
11532		else if($('#nectar_fullscreen_rows').length > 0 && $onMobileBrowser) {
11533			requestAnimationFrame(headerOffsetAdjust);
11534		}
11535		$(window).smartresize(headerOffsetAdjustCalc);
11536	}
11537		
11538
11539	function footerRevealCalcs() {
11540		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
11541
11542		if($(window).height() - $('#wpadminbar').height() - $headerNavSpace - $('#footer-outer').height() - 1 -$('#page-header-bg').height()  - $('.page-header-no-bg').height() > 0) {
11543			var $resizeExtra = ($('body:not(.material) #header-outer[data-header-resize="1"]').length > 0) ? 55: 0;
11544			$('body[data-footer-reveal="1"] .container-wrap').css({'margin-bottom': $('#footer-outer').height()-1 });
11545			//let even non reveal footer have min height set when using material ocm
11546			$('.container-wrap').css({'min-height': $(window).height() - $('#wpadminbar').height() - $headerNavSpace - $('#footer-outer').height() -1  - $('.page-header-no-bg').height() -$('#page-header-bg').height() + $resizeExtra });
11547		} else {
11548			$('body[data-footer-reveal="1"] .container-wrap').css({'margin-bottom': $('#footer-outer').height()-1 });
11549		}
11550		
11551		if( $(window).width() < 1000) $('#footer-outer').attr('data-midnight','light');
11552		else $('#footer-outer').removeAttr('data-midnight');
11553	}
11554	if($('body[data-footer-reveal="1"]').length > 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 
11555		setTimeout(function(){
11556			footerRevealCalcs();
11557		},60);
11558		footerRevealCalcs();
11559		//set shadow to match BG color if applicable
11560		if($('bodybody[data-footer-reveal="1"][data-footer-reveal-shadow="large_2"]').length > 0) $('.container-wrap').css({ boxShadow: '0 70px 110px -30px '+$('#footer-outer').css('backgroundColor') });
11561	}
11562	
11563	
11564	function opaqueCheck(){
11565		if($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0) { return; }
11566		
11567		var $offset = $(window).scrollTop();
11568		var $windowWidth = $(window).width();
11569
11570		if($offset > 0 && $windowWidth > 1000) {
11571			
11572			if($('body.material').length > 0) {
11573				$('#header-outer').addClass('scrolled-down');
11574
11575				//secondary header
11576				if($('#header-secondary-outer').length > 0) {
11577					$('#header-secondary-outer').addClass('hide-up').css('transform','translateY(-100%)');
11578					$('#header-outer').css('transform', 'translateY(-' +$('#header-secondary-outer').height()+ 'px)');
11579				}
11580			}
11581
11582			if($('#header-outer').attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent').addClass('scrolled-down');
11583			
11584			$(window).off('scroll',opaqueCheck);
11585			$(window).on('scroll',transparentCheck);
11586		}
11587	}
11588	
11589	
11590	function transparentCheck(){
11591		
11592		if($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0) { return; }
11593		
11594		var $offset = $(window).scrollTop();
11595		var $windowWidth = $(window).width();
11596
11597		if($offset == 0 && $windowWidth > 1000 && $('body.material-ocm-open').length == 0) {
11598			
11599			if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
11600				
11601				if($('#header-outer').attr('data-transparent-header') == 'true' && $('.megamenu.sfHover').length == 0) { 
11602					$('#header-outer').addClass('transparent').removeClass('scrolled-down');
11603					$('#header-outer').removeClass('no-transition');	
11604				}
11605				else if($('#header-outer').attr('data-transparent-header') == 'true') { $('#header-outer').removeClass('scrolled-down'); }
11606				
11607			} else {
11608				if($('#header-outer').attr('data-transparent-header') == 'true') { $('#header-outer').addClass('transparent').removeClass('scrolled-down'); }
11609			}
11610
11611			if($('body.material').length > 0) {
11612				$('#header-outer').removeClass('scrolled-down');
11613
11614				//secondary header
11615				if($('#header-secondary-outer').length > 0) {
11616					$('#header-secondary-outer, #header-outer').removeClass('hide-up').css('transform','translateY(0%)');
11617				}
11618			}
11619
11620			
11621			$(window).off('scroll',transparentCheck);
11622			$(window).on('scroll',opaqueCheck);
11623		}
11624	}
11625	
11626
11627	
11628	
11629	//header inherit row color effect
11630	function headerRowColorInheritInit(){
11631		if($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0){
11632			
11633			var headerOffset = ($('#header-outer[data-permanent-transparent="1"]').length == 0) ? (logoHeight - shrinkNum) + Math.ceil((headerPadding*2) / 1.8) + nectarDOMInfo.adminBarHeight : logoHeight/2 + headerPadding + nectarDOMInfo.adminBarHeight;
11634			
11635			$('.main-content > .row > .wpb_row').each(function(){
11636
11637				var $that = $(this);
11638				var waypoint = new Waypoint({
11639	 				element: $that,
11640		 			handler: function(direction) {
11641
11642						if(direction == 'down') {
11643							
11644							if($that.find('.row-bg.using-bg-color').length > 0) {
11645								
11646								var $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
11647								$('#header-outer').css('background-color',$that.find('.row-bg').css('background-color')).removeClass('light-text').removeClass('dark-text').addClass($textColor);
11648								$('#header-outer').attr('data-current-row-bg-color',$that.find('.row-bg').css('background-color'));
11649
11650								$('body.material #header-outer .bg-color-stripe').css('background-color',$that.find('.row-bg').css('background-color'));
11651							} else {
11652								$('#header-outer').css('background-color',$('#header-outer').attr('data-user-set-bg')).removeClass('light-text').removeClass('dark-text');
11653								$('#header-outer').attr('data-current-row-bg-color',$('#header-outer').attr('data-user-set-bg'));
11654
11655								$('body.material #header-outer .bg-color-stripe').css('background-color', '');
11656							}
11657						
11658						} else {
11659
11660							if($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) {
11661								var $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
11662								$('#header-outer').css('background-color',$that.prev('div.wpb_row').find('.row-bg').css('background-color')).removeClass('light-text').removeClass('dark-text').addClass($textColor);
11663								$('#header-outer').attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color'));
11664
11665								$('body.material #header-outer .bg-color-stripe').css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color'));
11666							} else {
11667								$('#header-outer').css('background-color',$('#header-outer').attr('data-user-set-bg')).removeClass('light-text').removeClass('dark-text');
11668								$('#header-outer').attr('data-current-row-bg-color',$('#header-outer').attr('data-user-set-bg'));
11669
11670								$('body.material #header-outer .bg-color-stripe').css('background-color', '');
11671							}
11672
11673						} 
11674
11675				
11676					},
11677					offset: headerOffset
11678
11679				}); 
11680
11681
11682			});
11683		}
11684	}
11685
11686
11687
11688/****************sticky page submenu******************/
11689	if($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) {
11690
11691		(function() {
11692		  'use strict'
11693
11694		  var $ = window.jQuery
11695		  var Waypoint = window.Waypoint
11696		  var $offsetHeight = 0; 
11697		  var shrinkNum = 6;	
11698		  var headerPadding = parseInt($('#header-outer').attr('data-padding'));
11699
11700		  if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
11701		  var headerPadding2 = headerPadding - headerPadding/1.8;
11702		  var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
11703		  var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('body.mobile').length == 0) ? $headerNavSpace - (parseInt(shrinkNum) + headerPadding2*2) : $headerNavSpace;
11704			
11705			if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
11706				
11707					var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
11708					var $secondaryHeader = $('#header-secondary-outer');
11709					
11710					$headerHeight = $('#header-outer').height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top')) ) -  parseInt(nectarDOMInfo.secondaryHeaderHeight);
11711			}
11712			
11713		  if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; $headerHeight = 0; }
11714
11715		  if($('#header-secondary-outer').length > 0 && $('body.mobile').length == 0 && $('body.material').length == 0) $headerHeight += $('#header-secondary-outer').height();
11716		  
11717
11718		  $(window).on('smartresize',function(){
11719
11720		    $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
11721		  	$headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length == 0 && $('body.mobile').length == 0) ? $headerNavSpace - (parseInt(shrinkNum) + headerPadding2*2) : $headerNavSpace;
11722		  	
11723				if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
11724					
11725						var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
11726						var $secondaryHeader = $('#header-secondary-outer');
11727						
11728						$headerHeight = $('#header-outer').height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top')) ) - parseInt(nectarDOMInfo.secondaryHeaderHeight);
11729				}
11730				
11731				if($('#header-secondary-outer').length > 0  && $('body.mobile').length == 0 && $('body.material').length == 0) $headerHeight += $('#header-secondary-outer').height();
11732
11733		  	$offsetHeight = 0; 
11734		
11735		  	  if($('#wpadminbar').length > 0 && $('#wpadminbar').css('position') == 'fixed') $offsetHeight += $('#wpadminbar').height();
11736 			  if($('body[data-hhun="0"] #header-outer').length > 0 && !($('body.mobile').length > 0 && $('#header-outer[data-mobile-fixed="false"]').length > 0) ) {
11737 			  	  $offsetHeight += $headerHeight;
11738 			  }
11739
11740 			  if($('.body-border-top').length > 0 && $(window).width() > 1000 && $('body[data-hhun="1"]').length > 0) $offsetHeight += $('.body-border-top').height();
11741 	
11742 			
11743 			 //recalc for resizing (same as stuck/unstuck logic below)
11744 			 if($('.page-submenu.stuck').length > 0) {
11745
11746		        	$('.page-submenu.stuck').addClass('no-trans').css('top',$offsetHeight).css('transform','translateY(0)').addClass('stuck');
11747		        	var $that = this;
11748		        	setTimeout(function(){ $('.page-submenu.stuck').removeClass('no-trans'); },50);
11749		        	$('.page-submenu.stuck').parents('.wpb_row').css('z-index',10000);
11750
11751		        	//boxed
11752		        	if($('#boxed').length > 0) { 
11753		        		var $negMargin = ($(window).width() > 1000) ? $('.container-wrap').width()*0.04 :39;
11754		        		$('.page-submenu.stuck').css({'margin-left':'-'+$negMargin+'px', 'width' : $('.container-wrap').width()});
11755		        	}
11756
11757		        }
11758		        else { 
11759		        	$('.page-submenu.stuck').css('top','0').removeClass('stuck');
11760		       	   $('.page-submenu.stuck').parents('.wpb_row').css('z-index','auto');
11761
11762		       	    if($('#boxed').length > 0) $('.page-submenu.stuck').css({'margin-left':'0px', 'width' : '100%'});
11763		       	}
11764
11765		  });
11766
11767		  /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */
11768		  function Sticky(options) {
11769		    this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options)
11770		    this.element = this.options.element
11771		    this.$element = $(this.element)
11772		    this.createWrapper()
11773		    this.createWaypoint()
11774		  }
11775
11776		  /* Private */
11777		  Sticky.prototype.createWaypoint = function() {
11778		    var originalHandler = this.options.handler
11779
11780		    $offsetHeight = 0; 
11781		    if($('#wpadminbar').length > 0 && $('#wpadminbar').css('position') == 'fixed') $offsetHeight += $('#wpadminbar').height();
11782 			if($('body[data-hhun="0"] #header-outer').length > 0 && !($('body.mobile').length > 0 && $('#header-outer[data-mobile-fixed="false"]').length > 0) ) { 
11783 				$offsetHeight += $headerHeight;
11784 			}
11785 			 if($('.body-border-top').length > 0 && $(window).width() > 1000 && $('body[data-hhun="1"]').length > 0) $offsetHeight += $('.body-border-top').height();
11786 		
11787		    this.waypoint = new Waypoint($.extend({}, this.options, {
11788		      element: this.wrapper,
11789		      handler: $.proxy(function(direction) {
11790		        var shouldBeStuck = this.options.direction.indexOf(direction) > -1
11791		        var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''
11792
11793		        this.$wrapper.height(wrapperHeight)
11794		        if(shouldBeStuck) {
11795		        	this.$element.addClass('no-trans').css('top',$offsetHeight).css('transform','translateY(0)').addClass('stuck');
11796		        	var $that = this;
11797		        	setTimeout(function(){ $that.$element.removeClass('no-trans'); },50);
11798		        	this.$element.parents('.wpb_row').css('z-index',10000);
11799
11800		        	//boxed
11801		        	if($('#boxed').length > 0) { 
11802		        		var $negMargin = ($(window).width() > 1000) ? $('.container-wrap').width()*0.04 :39;
11803		        		this.$element.css({'margin-left':'-'+$negMargin+'px', 'width' : $('.container-wrap').width()});
11804		        	}
11805
11806		        }
11807		        else { 
11808		        	this.$element.css('top','0').removeClass('stuck');
11809
11810		       	    if($('#boxed').length > 0) this.$element.css({'margin-left':'0px', 'width' : '100%'});
11811		       	}
11812
11813		        if (originalHandler) {
11814		          originalHandler.call(this, direction)
11815		        }
11816		      }, this),
11817		      offset: $offsetHeight
11818		    }))
11819
11820		    var $that = this;
11821
11822			    setInterval(function(){ 
11823
11824			    	if($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0)
11825		        		$that.waypoint.options.offset = $offsetHeight + $headerHeight;
11826		        	else 
11827		        		$that.waypoint.options.offset = $offsetHeight;
11828			    	Waypoint.refreshAll();
11829			
11830			    },100); 
11831			
11832
11833		  }
11834
11835		  /* Private */
11836		  Sticky.prototype.createWrapper = function() {
11837		    if (this.options.wrapper) {
11838		      this.$element.wrap(this.options.wrapper)
11839		    }
11840		    this.$wrapper = this.$element.parent()
11841		    this.wrapper = this.$wrapper[0]
11842		  }
11843
11844		  /* Public */
11845		  Sticky.prototype.destroy = function() {
11846		    if (this.$element.parent()[0] === this.wrapper) {
11847		      this.waypoint.destroy()
11848		      this.$element.removeClass(this.options.stuckClass)
11849		      if (this.options.wrapper) {
11850		        this.$element.unwrap()
11851		      }
11852		    }
11853		  }
11854
11855		  Sticky.defaults = {
11856		    wrapper: '<div class="sticky-wrapper" />',
11857		    stuckClass: 'stuck',
11858		    direction: 'down right'
11859		  }
11860
11861		  Waypoint.Sticky = Sticky
11862		}())
11863		;
11864
11865		//remove outside of column setups 
11866		if($('.page-submenu').parents('.span_12').find('> .wpb_column').length > 1){
11867			var pageMenu = $('.page-submenu').clone();
11868			var pageMenuParentRow = $('.page-submenu').parents('.wpb_row');
11869			$('.page-submenu').remove();
11870			pageMenuParentRow.before(pageMenu);
11871		}
11872
11873		var sticky = new Waypoint.Sticky({
11874		  element: $('.page-submenu[data-sticky="true"]')[0]
11875		});
11876
11877
11878	}
11879
11880	if($('#nectar_fullscreen_rows').length == 0)
11881		$('.page-submenu').parents('.wpb_row').css('z-index',10000);
11882
11883	$('.page-submenu .mobile-menu-link').on('click',function(){
11884		$(this).parents('.page-submenu').find('ul').stop(true).slideToggle(350);
11885		return false;
11886	});
11887
11888	$('.page-submenu ul li a').on('click',function(){
11889		if($('body.mobile').length > 0) $(this).parents('.page-submenu').find('ul').stop(true).slideToggle(350);
11890	});
11891
11892
11893	//responsive nav
11894	$('body').on('click','#toggle-nav',function(){
11895		if(window.innerWidth > 1000) {
11896			window.scrollTo(0,0);	
11897		}
11898
11899		$(this).find('.lines-button').toggleClass('close');
11900		
11901		
11902		if( $('body').hasClass('classic_mobile_menu_open') ) {
11903			
11904			$('#mobile-menu').hide();
11905			$('body').removeClass('classic_mobile_menu_open');
11906			
11907		} else {
11908			
11909			if($('#header-outer[data-transparent-header="true"][data-permanent-transparent="1"][data-mobile-fixed="false"].transparent').length > 0) {
11910				$('#mobile-menu').css({
11911					'top': parseInt($('#header-outer').outerHeight() + nectarDOMInfo.adminBarHeight) + 'px' ,
11912					'position': 'absolute',
11913					'width': '100%',
11914					'left': '0' 
11915				});
11916			}
11917			
11918			$('#mobile-menu').show();
11919			$('body').addClass('classic_mobile_menu_open');
11920			
11921		}
11922		
11923		
11924		return false;
11925	});
11926	
11927	
11928	//add wpml to mobile menu
11929	if($('header#top nav > ul > li.menu-item-language').length > 0 && $('#header-secondary-outer ul > li.menu-item-language').length == 0){
11930		var $langSelector = $('header#top nav > ul > li.menu-item-language').clone();
11931		$langSelector.insertBefore('#mobile-menu ul #mobile-search');
11932	}
11933	
11934	////append dropdown indicators / give classes
11935	$('#mobile-menu .container ul li').each(function(){
11936		if($(this).find('> ul').length > 0) {
11937			 $(this).addClass('has-ul');
11938			 $(this).find('> a').append('<span class="sf-sub-indicator"><i class="icon-angle-down"></i></span>');
11939		}
11940	});
11941	
11942	////events
11943	$('#mobile-menu .container ul li:has(">ul") > a .sf-sub-indicator').on('click',function(e){
11944		$(this).parent().parent().toggleClass('open');
11945		$(this).parent().parent().find('> ul').stop(true,true).slideToggle();
11946		return false;
11947	});
11948	
11949
11950
11951/*-------------------------------------------------------------------------*/
11952/*	5.	Page Specific
11953/*-------------------------------------------------------------------------*/	
11954	
11955	function vcFullHeightRow() {
11956        var $element = $(".vc_row-o-full-height:first");
11957        if ($element.length) {
11958            var $window, windowHeight, offsetTop, fullHeight;
11959            $window = $(window), 
11960            windowHeight = $window.height();
11961
11962            $(".vc_row-o-full-height").each(function(){
11963            	offsetTop = $(this).offset().top;
11964
11965            	var $realRowIndex = ($(this).parent().hasClass('vc_ie-flexbox-fixer')) ? $(this).parent().index() : $(this).index();
11966
11967            	if(offsetTop < windowHeight && $(this).hasClass('top-level') && !nectarDOMInfo.usingFrontEndEditor) {
11968            		fullHeight = 100 - offsetTop / (windowHeight / 100);
11969          	    	$(this).css("min-height", fullHeight + "vh");
11970          	    	$(this).find('> .col.span_12').css("min-height", fullHeight + "vh");
11971            	} else {
11972            		$(this).css("min-height", windowHeight);
11973            		$(this).find('> .col.span_12').css("min-height", windowHeight);
11974            	}
11975          	   
11976            });
11977
11978            
11979        }
11980
11981    }
11982    function fixIeFlexbox() {
11983        var ua = window.navigator.userAgent,
11984            msie = ua.indexOf("MSIE ");
11985        (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) && $(".vc_row-o-full-height").each(function() {
11986            "flex" === $(this).find('> .span_12').css("display") && $(this).wrap('<div class="vc_ie-flexbox-fixer"></div>')
11987        })
11988    }
11989    fixIeFlexbox();
11990
11991    vcFullHeightRow();
11992		
11993		if(!nectarDOMInfo.usingFrontEndEditor) {
11994			nectarLiquidBGs();
11995		}
11996
11997	//recent work
11998	function piVertCenter() {
11999		$('.portfolio-items  > .col').each(function(){
12000				
12001			//style 4
12002			$(this).find('.style-4 .work-info .bottom-meta:not(.shown)').stop().animate({
12003				'bottom' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()-2+'px'
12004			},420,'easeOutCubic');
12005
12006			
12007		});	 
12008	}
12009	
12010	
12011	//ie8 width fix
12012	function ie8Width(){
12013		if( $(window).width() >= 1300 ) {
12014			$('.container').css('max-width','1100px');
12015		} else {
12016			$('.container').css('max-width','880px');
12017		}
12018	}
12019	
12020	if( $(window).width() >= 1300 && $('html').hasClass('no-video')) { $('.container').css('max-width','1100px'); $(window).resize(ie8Width); };
12021	
12022
12023
12024	function smartResizeInit() {
12025		
12026		 //carousel height calcs
12027		 carouselHeightCalcs();
12028		 clientsCarouselHeightRecalc();
12029
12030		 //portfolio comment order
12031		 portfolioCommentOrder();
12032		 
12033		 //testimonial slider height
12034		 testimonialHeightResize(); //animated
12035		 testimonialSliderHeight(); //non-animated
12036		 
12037		 //full width content columns sizing
12038		 fullWidthContentColumns();
12039		 
12040		 //parallax BG Calculations
12041		 parallaxRowsBGCals();
12042		 
12043		
12044		 vcFullHeightRow();
12045		 headerSpace();
12046
12047		 centeredLogoMargins();
12048
12049		 slideOutWidgetOverflowState();
12050		 recentPostHeight();
12051
12052		 morphingOutlines();
12053
12054		 flipBoxHeights();
12055
12056		 showOnLeftSubMenu();
12057
12058		 //minimal alt effect
12059		if($('.tabbed[data-style="minimal_alt"]').length > 0) {
12060			 magicLineCalc($('.tabbed[data-style="minimal_alt"] > ul > li > a.active-tab'));
12061		}
12062		
12063	}
12064
12065  $(window).off('smartresize.srInit'); 
12066	$(window).on('smartresize.srInit', smartResizeInit); 
12067	
12068	
12069	var $usingNectarCarouselFlk = ($('.nectar-carousel.nectar-flickity:not(.masonry)').length > 0) ? true : false;
12070	
12071	function resizeInit() {
12072		 portfolioDeviceCheck();
12073
12074		 //fullwidth page section calcs
12075		 fullWidthSections(); 
12076		 fullwidthImgOnlySizing();
12077		 fullWidthContentColumns();
12078		 if(nectarDOMInfo.usingMobileBrowser) {
12079		  fullWidthRowPaddingAdjustCalc();
12080		}
12081		 
12082		 //iframe video emebeds
12083		 responsiveVideoIframes();
12084		 
12085		 //parallax BG Calculations
12086		 if(!nectarDOMInfo.usingMobileBrowser){
12087		   parallaxRowsBGCals();
12088		 }
12089		 
12090		 testimonialSliderHeightMinimalMult();
12091		 if($usingNectarCarouselFlk) {
12092			 setNectarCarouselFlkEH();
12093		 }
12094		 
12095		 if($('.nectar-social.full-width').length > 0) {
12096		 	nectarLoveFWCenter();
12097		 }
12098
12099		 if($('body').hasClass('ascend') ){ 
12100			searchFieldCenter();
12101		 }
12102
12103		 if($('body').hasClass('single-post')) { centerPostNextButtonImg(); }
12104
12105		 cascadingImageBGSizing();
12106
12107		 responsiveTooltips();
12108
12109		 //vc mobile columns
12110		 if($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) { vcMobileColumns(); }
12111
12112		 if($('body[data-footer-reveal="1"]').length > 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { footerRevealCalcs(); }
12113
12114		 if($('#page-header-bg').length > 0) { pageHeader(); }
12115
12116		 if($('.nectar-video-bg').length > 0) {
12117		 	resizeVideoToCover();
12118		 }
12119	}
12120
12121	$(window).off('resize.srInit'); 
12122	$(window).on('resize.srInit', resizeInit); 
12123	
12124	
12125	$(window).load(function(){
12126		
12127		if($(window).scrollTop() == 0 ) { headerSpace(); }
12128		setTimeout(portfolioSidebarFollow,200);
12129		
12130		$('video').css('visibility','visible');
12131		
12132		if($('body[data-animated-anchors="true"]').length > 0) { 
12133				if($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) { 
12134					
12135					//inside tabs
12136					if( typeof $_GET['tab'] != 'undefined' ) {
12137							setTimeout(function(){
12138								pageLoadHash(); 
12139							},500);
12140					} 
12141					//regular
12142					else {
12143						pageLoadHash(); 
12144					}
12145					
12146				}
12147				
12148				if($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && $('.nectar-box-roll').length == 0 && nectarDOMInfo.usingMobileBrowser) {
12149					pageLoadHash();
12150				}
12151		}
12152		
12153		parallaxRowsBGCals();
12154		portfolioCommentOrder();
12155		fullWidthContentColumns();
12156		resizeVideoToCover();
12157
12158	});
12159
12160
12161	$(window).on("orientationchange",function(){
12162	  setTimeout(clientsCarouselHeightRecalc,200);
12163	});
12164	
12165	//blog next post button
12166	function postNextButtonEffect(){
12167
12168		$('.blog_next_prev_buttons').imagesLoaded(function(){
12169
12170			centerPostNextButtonImg();
12171			
12172			$('.blog_next_prev_buttons img').css('opacity','1');
12173
12174		});
12175	}
12176
12177	function centerPostNextButtonImg(){
12178		
12179		if($('.blog_next_prev_buttons').length == 0) return false;
12180
12181		if( $('.blog_next_prev_buttons img').height() >= $('.blog_next_prev_buttons').height() + 50 ) {
12182			var $height = 'auto';
12183			var $width = $('.blog_next_prev_buttons').width();
12184		} else {
12185
12186			if( $('.blog_next_prev_buttons').width() < $('.blog_next_prev_buttons img').width()) {
12187				var $height = $('.blog_next_prev_buttons').height() + 49;
12188				var $width = 'auto';
12189			} else {
12190				var $height = 'auto';
12191				var $width = '100%';
12192			}
12193			
12194		}
12195
12196		$('.blog_next_prev_buttons img').css({ 'height' : $height, 'width': $width });
12197
12198		$('.blog_next_prev_buttons img').css({
12199			'top' : ($('.blog_next_prev_buttons').height()/2) - ($('.blog_next_prev_buttons img').height()/2) + 'px',
12200			'left' : ($('.blog_next_prev_buttons').width()/2) - ($('.blog_next_prev_buttons img').width()/2) + 'px'
12201		});
12202
12203		$('.blog_next_prev_buttons .inner').each(function(){
12204			$(this).css({'top': $(this).parent().height()/2 - ($(this).height()/2), 'opacity':'1' });
12205		})
12206	}
12207	
12208	postNextButtonEffect();
12209
12210
12211	function recentPostHeight() {
12212		$('.blog-recent[data-style="title_only"]').each(function(){
12213			if($(this).find('> .col').length > 1) return false;
12214			if($(this).parent().parent().parent().hasClass('vc_col-sm-3') || 
12215				$(this).parent().parent().parent().hasClass('vc_col-sm-4') || 
12216				$(this).parent().parent().parent().hasClass('vc_col-sm-6') || 
12217				$(this).parent().parent().parent().hasClass('vc_col-sm-8') || 
12218				$(this).parent().parent().parent().hasClass('vc_col-sm-9')) {
12219				
12220				if($('body.mobile').length == 0 && $(this).next('div').length == 0) {
12221					var tallestColumn = 0;
12222					
12223					$(this).find('> .col').css('padding', '50px 20px');
12224
12225					$(this).parents('.span_12').find(' > .wpb_column').each(function(){
12226						(Math.floor($(this).height()) > tallestColumn) ? tallestColumn = Math.floor($(this).height()) : tallestColumn = tallestColumn;
12227					});	
12228			
12229					if(Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) {
12230						$(this).find('> .col').css('padding-top',(tallestColumn-$(this).find('> .col').height())/2 + 'px');
12231						$(this).find('> .col').css('padding-bottom',(tallestColumn-$(this).find('> .col').height())/2 + 'px');
12232					}
12233					
12234				}
12235				 else {
12236				 		$(this).find('> .col').css('padding', '50px 20px');
12237				}
12238			}
12239		});
12240	}
12241	recentPostHeight();
12242
12243
12244	//recent post slider
12245	function recentPostsFlickityInit() {
12246
12247		//classic enhanced specific 
12248    $('.blog-recent[data-style="classic_enhanced_alt"] .inner-wrap').each(function(){
12249        	$(this).find('.post-featured-img').each(function(){
12250				var $src = $(this).find('img').attr('src');
12251				$(this).css('background-image','url('+$src+')');
12252			});
12253        });
12254		$('.blog-recent[data-style="classic_enhanced"]').each(function(){
12255			if($(this).find('.inner-wrap.has-post-thumbnail').length == 0) {
12256				$(this).addClass('no-thumbs');
12257			}
12258		});
12259
12260		if($('.nectar-recent-posts-slider-inner').length > 0) {
12261		
12262			var $rpFGroupCells = ($('.nectar-recent-posts-slider_multiple_visible').length > 0) ? '90%' : false;
12263			
12264			var $rpF = $('.nectar-recent-posts-slider-inner').flickity({
12265				  contain: true,
12266					groupCells: $rpFGroupCells,
12267				  draggable: true,
12268				  lazyLoad: false,
12269				  imagesLoaded: true,
12270				  percentPosition: true,
12271				  prevNextButtons: false,
12272				  pageDots: true,
12273				  resize: true,
12274				  setGallerySize: true,
12275				  wrapAround: true,
12276				  accessibility: false
12277			});
12278			
12279			setTimeout(function(){
12280				$('.nectar-recent-posts-slider-inner').addClass('loaded');
12281			},1150);
12282			var flkty = $rpF.data('flickity');
12283			
12284			$rpF.on( 'dragStart.flickity', function() {
12285				$('.flickity-viewport').addClass('is-moving');
12286			});
12287			
12288			$rpF.on( 'dragEnd.flickity', function() {
12289				$('.flickity-viewport').removeClass('is-moving');
12290			});
12291			
12292			var $dragTimeout;
12293			
12294			$rpF.on( 'select.flickity', function() {
12295
12296				  $('.flickity-viewport').addClass('no-hover');
12297				  clearTimeout( $dragTimeout);
12298				   $dragTimeout = setTimeout(function(){ $('.flickity-viewport').removeClass('no-hover'); },400);
12299			 
12300			});
12301			
12302			
12303	  
12304			recentPostSliderHeight();
12305			$(window).resize(recentPostSliderHeight);
12306
12307			if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/) && ! nectarDOMInfo.usingFrontEndEditor) {
12308				$(window).resize(recentPostSliderParallaxMargins);
12309			}
12310
12311			function recentPostSliderHeight(){
12312
12313				$('.nectar-recent-posts-slider').each(function(){
12314						
12315							var $heightCalc;
12316							var $minHeight = 250;
12317							var $windowWidth = $(window).width();
12318							var $definedHeight = parseInt($(this).attr('data-height'));
12319
12320							var dif = ($('body[data-ext-responsive="true"]').length > 0) ? $(window).width() / 1400 : $(window).width() / 1100;
12321
12322							if( window.innerWidth > 1000 && $('#boxed').length == 0) {
12323
12324								if($(this).parents('.full-width-content').length == 0) {
12325									if($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1400){
12326										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight));
12327									} else if($('body[data-ext-responsive="true"]').length == 0 && window.innerWidth >= 1100) {
12328										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight));
12329									} else {
12330										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
12331									}
12332									
12333								} else {
12334									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
12335								}
12336								
12337							} else {
12338								
12339								//column sliders
12340								var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col') ;
12341								if($parentCol.length == 0) $parentCol = $('.main-content');
12342									
12343								if(!$parentCol.hasClass('vc_span12') && !$parentCol.hasClass('main-content') && !$parentCol.hasClass('span_12') && !$parentCol.hasClass('vc_col-sm-12') ) {
12344								
12345									var $parentColWidth = sliderColumnDesktopWidth($parentCol);
12346									var $aspectRatio = $definedHeight/$parentColWidth;
12347
12348									
12349									//min height
12350									if( $aspectRatio*$parentCol.width() <= $minHeight ){
12351										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$minHeight);
12352									} else {
12353										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$aspectRatio*$parentCol.width());
12354									}
12355								  
12356								} 
12357								
12358								//regular
12359								else {
12360									
12361									//min height
12362									if( $definedHeight*dif <= $minHeight ){
12363										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$minHeight);
12364									} else {
12365										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.
12365ceil($definedHeight*dif));
12366									}
12367									
12368								}
12369								
12370							}
12371							
12372		
12373						
12374					});
12375			
12376			}
12377
12378			////helper function
12379			function sliderColumnDesktopWidth(parentCol) {
12380				
12381				var $parentColWidth = 1100;
12382				var $columnNumberParsed = $(parentCol).attr('class').match(/\d+/);
12383				
12384				if($columnNumberParsed == '2') { $parentColWidth = 170 }
12385				else if($columnNumberParsed == '3') { $parentColWidth = 260 } 
12386				else if($columnNumberParsed == '4') { $parentColWidth = 340 } 
12387				else if($columnNumberParsed == '6') { $parentColWidth = 530 } 
12388				else if($columnNumberParsed == '8') { $parentColWidth = 700 } 
12389				else if($columnNumberParsed == '9') { $parentColWidth = 805 }
12390				else if($columnNumberParsed == '10') { $parentColWidth = 916.3 }
12391				else if($columnNumberParsed == '12') { $parentColWidth = 1100 }
12392			
12393				return $parentColWidth;
12394			}
12395		
12396		}//if using rp slider
12397		
12398		
12399		//multiple featured controls
12400		
12401		function multipleLargeFeaturedInit() {
12402			 $('.nectar-recent-posts-single_featured.multiple_featured').each(function(sliderIndex){
12403					 if($(this).find('> .normal-container').length > 0) {
12404					 	$(this).find('> .normal-container').remove();
12405					}
12406				 	$(this).append('<div class="normal-container container"> <ul class="controls" data-color="' + $(this).attr('data-button-color') + '" data-num="'+ $(this).find('.nectar-recent-post-slide').length +'"></ul> </div>');
12407					var $that = $(this);
12408					
12409					//store instance
12410					$nectarCustomSliderRotate[sliderIndex] = { autorotate: '' };
12411					
12412					var tallestFeaturedSlide = 0;
12413					$(this).find('.nectar-recent-post-slide').each(function(i){
12414						
12415						if($(this).find('.recent-post-container').height() > tallestFeaturedSlide) {
12416							$(this).siblings().removeClass('tallest');
12417							$(this).addClass('tallest');
12418							tallestFeaturedSlide = $(this).find('.recent-post-container').height();
12419						} 
12420						
12421						var $activeClass = (i == 0 && $(this).parents('.nectar-recent-posts-single_featured.multiple_featured[data-autorotate="none"]').length > 0) ? 'class="active"': '';
12422						 $that.find('.controls').append('<li '+$activeClass+'><span class="title">'+ $(this).find('h2').text() +'</span></li>');
12423					});
12424					
12425					$(this).addClass('js-loaded');
12426					
12427					var $slideClickTimeout;
12428					
12429					//click Functionality
12430					$(this).find('.controls li').on('click',function(e){
12431						
12432							if($(this).hasClass('active')) 
12433								return;
12434								
12435							if(e.originalEvent !== undefined)
12436								$(this).parent().find('.active').addClass('trans-out');
12437							
12438							var $index = $(this).index();
12439							var $oldIndex = $(this).parent().find('.active').index();
12440							var $that = $(this);
12441							
12442							clearTimeout($slideClickTimeout);
12443							
12444							$(this).siblings().removeClass('active');
12445							$(this).addClass('active');
12446							$slideClickTimeout = setTimeout( function() { 
12447								$that.parents('.multiple_featured').find('.nectar-recent-post-slide:not(:eq('+$index+'))').css('opacity','0').removeClass('active');
12448								$that.parent().find('.trans-out').removeClass('trans-out');
12449							}, 300);
12450							$that.parents('.multiple_featured').find('.nectar-recent-post-slide:not(:eq('+$index+'))').css('z-index','10');
12451							$that.parents('.multiple_featured').find('.nectar-recent-post-slide:eq('+$oldIndex+')').css('z-index','15');
12452							
12453							$(this).parents('.multiple_featured').find('.nectar-recent-post-slide').eq($index).css({'opacity':'1', 'z-index':'20'}).addClass('active');
12454							
12455							if($(this).parents('.multiple_featured').attr('data-autorotate') != 'none') {
12456								nectarCustomSliderResetRotate($that.parents('.nectar-recent-posts-single_featured.multiple_featured'),sliderIndex);
12457							}
12458					});
12459					
12460					
12461				//autorotate
12462				var $that = $(this);
12463				 if($(this).attr('data-autorotate').length > 0 && $(this).attr('data-autorotate') != 'none' && $('body.vc_editor').length == 0 ) {
12464					 
12465					 setTimeout(function(){
12466							 var slide_interval = (parseInt($that.attr('data-autorotate')) < 100) ? 4000 : parseInt($that.attr('data-autorotate'));
12467							 $nectarCustomSliderRotate[sliderIndex].autorotate = setInterval(function(){ nectarCustomSliderRotate($that) },slide_interval);
12468							 
12469							 //set first active class
12470							 $that.find('.controls > li:first-child').addClass('active');
12471
12472					 },30);
12473					 
12474				 }
12475				 
12476			 });
12477			 
12478			 splitLineText();
12479			 $(window).resize(splitLineText);
12480			 
12481
12482		}
12483		
12484		multipleLargeFeaturedInit();
12485	
12486	}
12487	
12488	recentPostsFlickityInit();
12489
12490	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)) {
12491		if($('.nectar-recent-posts-slider').length > 0 && ! nectarDOMInfo.usingFrontEndEditor) {
12492			window.requestAnimationFrame(recentPostSliderParallax);
12493		}
12494	}
12495	
12496	function recentPostSliderParallax(){
12497
12498		$('.nectar-recent-posts-slider').each(function(){
12499			var $offset = parseInt($(this).find('.flickity-slider').position().left);
12500			var $slideLength = $(this).find('.nectar-recent-post-slide').length;
12501			var $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index();
12502			var $slideWidth = $(this).find('.nectar-recent-post-slide').width();
12503			//wrapped fix
12504
12505			////first going to first
12506			if($offset >= -3) {
12507				$(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg').css('margin-left',parseInt(Math.ceil($slideWidth/3.5))+'px');
12508			} else {
12509				$(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg').css('margin-left','-'+parseInt(Math.ceil($slideWidth/3.5*$lastChildIndex))+'px');
12510			}
12511			////last going to first
12512			if(Math.abs($offset) >= ($slideLength-1) * $slideWidth) {
12513				$(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg').css('margin-left','-'+parseInt(Math.ceil(($slideWidth/3.5)*$slideLength))+'px');
12514			} else {
12515				$(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg').css('margin-left','0px');
12516			}
12517
12518			$(this).find('.nectar-recent-post-bg').css('transform','translateX('+Math.ceil($(this).find('.flickity-slider').position().left/-3.5)+'px)');
12519			
12520			
12521		});
12522		requestAnimationFrame(recentPostSliderParallax);
12523	}
12524
12525	function recentPostSliderParallaxMargins(){
12526
12527		$('.nectar-recent-posts-slider').each(function(){		
12528			var $slideWidth = $(this).find('.nectar-recent-post-slide').width();
12529			$(this).find('.nectar-recent-post-slide').each(function(i){
12530				$(this).find('.nectar-recent-post-bg').css('margin-left','-'+  parseInt(Math.ceil($slideWidth/3.5)*i)+'px');
12531			});
12532		
12533		});
12534	}
12535
12536	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/) && ! nectarDOMInfo.usingFrontEndEditor) {
12537		recentPostSliderParallaxMargins();
12538	}
12539
12540	//portfolio item hover effect
12541	
12542	////desktop event 
12543	function portfolioHoverEffects() { 
12544
12545		if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(iPad|IEMobile)/)) {
12546			
12547			//style 1 & 2
12548			$('.portfolio-items:not([data-ps="7"]) .col .work-item:not(.style-3-alt):not(.style-3):not([data-custom-content="on"])').on('mouseenter',function(){
12549				$(this).find('.work-info .vert-center').css({'margin-top' : 0});
12550				$(this).find('.work-info, .work-info .vert-center > *, .work-info > i').css({'opacity' : 1});
12551				$(this).find('.work-info-bg').css({ 'opacity' : 0.9 });
12552			});
12553			$('.portfolio-items:not([data-ps="7"]) .col .work-item:not(.style-3-alt):not(.style-3):not([data-custom-content="on"])').on('mouseleave',function(){	
12554				$(this).find('.work-info .vert-center').css({ 'margin-top' : -20 });
12555				$(this).find('.work-info, .work-info .vert-center > *:not(.mfp-figure), .work-info > i').css({ 'opacity' : 0 });
12556				$(this).find('.work-info-bg').css({ 'opacity' : 0 });
12557			});
12558			
12559			
12560			//style 3
12561			$('.portfolio-items .col .work-item.style-3').on('mouseenter',function(){
12562				$(this).find('.work-info-bg').css({ 'opacity' : 0 });
12563			});
12564			$('.portfolio-items .col .work-item.style-3').on('mouseleave',function(){
12565				$(this).find('.work-info-bg').css({ 'opacity' : 0.45 });
12566			});
12567			
12568			
12569			//style 4
12570			$('.portfolio-items .col .work-item.style-4').on('mouseenter',function(){
12571				$(this).find('img').stop().animate({
12572					'top' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()/2+'px'
12573				},250,'easeOutCubic');
12574				
12575				$(this).find('.work-info .bottom-meta').addClass('shown').stop().animate({
12576					'bottom' : '0px'
12577				},320,'easeOutCubic');
12578
12579			});
12580			$('.portfolio-items .col .work-item.style-4').on('mouseleave',function(){
12581				$(this).find('img').stop().animate({
12582					'top' : '0px'
12583				},250,'easeOutCubic');
12584				
12585				$(this).find('.work-info .bottom-meta').removeClass('shown').stop().animate({
12586					'bottom' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()-2+'px'
12587				},320,'easeOutCubic');
12588				
12589			});
12590		
12591		} 
12592		////mobile event
12593		else {
12594			portfolioDeviceCheck();
12595		}
12596
12597	}
12598
12599	portfolioHoverEffects();
12600
12601	function style6Img(){
12602  
12603		//change sizer pos
12604		$('.style-5').each(function(){
12605			$(this).find('.sizer').insertBefore($(this).find('.parallaxImg'));
12606		});
12607
12608		//set parent zindex
12609		$('.style-5').parents('.wpb_row').css('z-index','100');
12610
12611		var d = document,
12612			de = d.documentElement,
12613			bd = d.getElementsByTagName('body')[0],
12614			htm = d.getElementsByTagName('html')[0],
12615			win = window,
12616			imgs = d.querySelectorAll('.parallaxImg'),
12617			totalImgs = imgs.length,
12618			supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints;
12619
12620		if(totalImgs <= 0){
12621			return;
12622		}
12623
12624		// build HTML
12625		for(var l=0;l<totalImgs;l++){
12626
12627			var thisImg = imgs[l],
12628				layerElems = thisImg.querySelectorAll('.parallaxImg-layer'),
12629				totalLayerElems = layerElems.length;
12630
12631			if(totalLayerElems <= 0){
12632				continue;
12633			}
12634
12635			while(thisImg.firstChild) {
12636				thisImg.removeChild(thisImg.firstChild);
12637			}
12638			
12639			var lastMove = 0;
12640
12641			//throttle performance for all browser other than chrome
12642			var eventThrottle = $('html').hasClass('cssreflections') ? 1 : 80;
12643			if(eventThrottle == 80) $('body').addClass('cssreflections');
12644
12645			var containerHTML = d.createElement('div'),
12646				shineHTML = d.createElement('div'),
12647				shadowHTML = d.createElement('div'),
12648				layersHTML = d.createElement('div'),
12649				layers = [];
12650
12651			thisImg.id = 'parallaxImg__'+l;
12652			containerHTML.className = 'parallaxImg-container';
12653			//shineHTML.className = 'parallaxImg-shine';
12654			shadowHTML.className = 'parallaxImg-shadow';
12655			layersHTML.className = 'parallaxImg-layers';
12656
12657			for(var i=0;i<totalLayerElems;i++){
12658				var layer = d.createElement('div'),
12659					layerInner = d.createElement('div'),
12660					imgSrc = layerElems[i].getAttribute('data-img');
12661
12662				$(layer).html($(layerElems[i]).html());
12663				layer.className = 'parallaxImg-rendered-layer';
12664				layer.setAttribute('data-layer',i);
12665
12666				if(i==0 && $(thisImg).parents('.wpb_gallery').length == 0) { 
12667					layerInner.className = 'bg-img';
12668					layerInner.style.backgroundImage = 'url('+imgSrc+')';
12669					layer.appendChild(layerInner);
12670				}
12671				layersHTML.appendChild(layer);
12672
12673				layers.push(layer);
12674			}
12675
12676			containerHTML.appendChild(layersHTML);
12677			thisImg.appendChild(containerHTML);
12678			$(thisImg).wrap('<div class="parallaxImg-wrap" />');
12679			if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { $(thisImg).parent().append(shadowHTML); }
12680
12681			var w = thisImg.clientWidth || thisImg.offsetWidth || thisImg.scrollWidth;
12682
12683			if(supportsTouch && $('body.using-mobile-browser').length > 0 ){
12684				
12685		    } else {
12686		    	(function(_thisImg,_layers,_totalLayers,_shine) {
12687					$(thisImg).parents('.style-5').on('mousemove', function(e){
12688						
12689						var parentEl = $(this);
12690					 	var now = Date.now();
12691				        if (now > lastMove + eventThrottle) {
12692				            lastMove = now;
12693							window.requestAnimationFrame(function(){
12694								processMovement(e,false,_thisImg,_layers,_totalLayers,_shine,parentEl);		
12695							});
12696						}
12697
12698
12699					});
12700		            $(thisImg).parents('.style-5').on('mouseenter', function(e){
12701						processEnter(e,_thisImg,_layers,_totalLayers,_shine);		
12702					});
12703					$(thisImg).parents('.style-5').on('mouseleave', function(e){
12704						processExit(e,_thisImg,_layers,_totalLayers,_shine);		
12705					});
12706		        })(thisImg,layers,totalLayerElems,shineHTML);
12707		    }
12708
12709		    //set the depths
12710		    (function(_thisImg,_layers,_totalLayers,_shine) {
12711			    depths(false,_thisImg,_layers,_totalLayers,_shine);
12712			     window.addEventListener('resize', function(e){
12713			    	  depths(false,_thisImg,_layers,_totalLayers,_shine);
12714			    });
12715			 })(thisImg,layers,totalLayerElems,shineHTML);
12716		}
12717
12718		function processMovement(e, touchEnabled, elem, layers, totalLayers, shine, parentEl){
12719			
12720			//stop raf if exit already called
12721			if(!$(elem.firstChild).hasClass('over')) { processExit(e,elem,layers,totalLayers,shine); return false }
12722
12723			//set up multipliers
12724
12725			if($(elem).parents('.col.wide').length > 0 ) {
12726				var yMult = 0.03;
12727				var xMult = 0.063;
12728			} else if( $(elem).parents('.col.regular').length > 0  || $(elem).parents('.wpb_gallery').length > 0) {
12729				var yMult = 0.045;
12730				var xMult = 0.045;
12731			} else if($(elem).parents('.col.tall').length > 0 ) {
12732				var yMult = 0.05;
12733				var xMult = 0.015;
12734			} else if($(elem).parents('.col.wide_tall').length > 0) {
12735				var yMult = 0.04;
12736				var xMult = 0.04;
12737			} else if(parentEl.hasClass('nectar-fancy-box')) {
12738				var yMult = 0.045;
12739				var xMult = 0.022;
12740			} else {
12741				var yMult = 0.045;
12742				var xMult = 0.075;
12743			}
12744			
12745			var bdst = $(window).scrollTop(),
12746				bdsl = bd.scrollLeft,
12747				pageX = (touchEnabled)? e.touches[0].pageX : e.pageX,
12748				pageY = (touchEnabled)? e.touches[0].pageY : e.pageY,
12749				offsets = elem.getBoundingClientRect(),
12750				w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, // width
12751				h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, // height
12752				wMultiple = 320/w,
12753				offsetX = 0.52 - (pageX - offsets.left - bdsl)/w, //cursor position X
12754				offsetY = 0.52 - (pageY - offsets.top - bdst)/h, //cursor position Y
12755				dy = (pageY - offsets.top - bdst) - h / 2, //@h/2 = center of container
12756				dx = (pageX - offsets.left - bdsl) - w / 2, //@w/2 = center of container
12757				yRotate = (offsetX - dx)*(yMult * wMultiple), //rotation for container Y
12758				xRotate = (dy - offsetY)*(xMult * wMultiple); //rotation for container X //old
12759
12760				if($(elem).parents('.wpb_gallery').length > 0) {
12761					var imgCSS = ' perspective('+ w*3 +'px) rotateX(' + -xRotate*1.9 + 'deg) rotateY(' + -yRotate*1.3 + 'deg)'; //img transform	
12762				} else {
12763					if($(elem).parents('.wide_tall').length == 0 && $(elem).parents('.wide').length == 0 && $(elem).parents('.tall').length == 0) {
12764						var $scaleAmount = (parentEl.hasClass('nectar-fancy-box')) ? '1.06' : '1.03';
12765						var $offsetAmount = (parentEl.hasClass('nectar-fancy-box')) ? '-2' : '-10';
12766						
12767						var imgCSS = ' perspective('+ w*3 +'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg)  translateY('+offsetY*$offsetAmount+'px) translateX('+offsetX*$offsetAmount+'px) scale('+$scaleAmount+')'; //img transform
12768					} else {
12769						var imgCSS = ' perspective('+ w*3 +'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg)  translateY('+offsetY*-10+'px) translateX('+offsetX*-10+'px) scale(1.013)'; //img transform	
12770					}
12771				}
12772
12773				
12774			//container transform
12775
12776
12777			$(elem).find('.parallaxImg-container').css('transform',imgCSS);
12778
12779			if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) {
12780				$(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform',imgCSS);
12781			}
12782
12783			
12784		}
12785
12786		function processShineMovement(e, touchEnabled, elem, layers, totalLayers, shine){
12787
12788		}
12789
12790		function processEnter(e, elem, layers, totalLayers, shine){
12791
12792			elem.firstChild.className += ' over';
12793			elem.className += ' over';
12794
12795
12796				$(elem).addClass('transition');
12797
12798				if($(elem).parents('.wpb_gallery').length > 0) {
12799					var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },450);
12800				} else {
12801					var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },200);
12802				}
12803
12804		}
12805
12806		function processExit(e, elem, layers, totalLayers, shine){
12807
12808			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
12809			var container = elem.firstChild;
12810
12811			container.className = container.className.replace(' over','');
12812			elem.className = elem.className.replace(' over','');
12813			$(container).css('transform', 'perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
12814			$(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform','perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
12815
12816			$(elem).addClass('transition');
12817				var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },200);
12818
12819
12820		}
12821
12822		function depths(touchEnabled, elem, layers, totalLayers, shine) {
12823			
12824			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
12825			var revNum = totalLayers;
12826			var container = elem.firstChild;
12827			
12828			//set z
12829			for(var ly=0;ly<totalLayers;ly++){
12830				if(ly == 0) $(layers[ly]).css('transform', 'translateZ(0px)');
12831				else $(layers[ly]).css('transform','translateZ(' +(w*3)/27*(ly*1.1) + 'px) ');
12832
12833				revNum--;
12834			}
12835			
12836			totalLayers = totalLayers + 3;
12837
12838			//set perspective from beginning
12839			$(container).css('transform','perspective('+ w*3 +'px)');
12840
12841		}
12842
12843		function removeDepths(touchEnabled, elem, layers, totalLayers, shine) {
12844			
12845			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
12846			var revNum = totalLayers;
12847			
12848			//set z
12849			for(var ly=0;ly<totalLayers;ly++){
12850				
12851				if(ly == 0) $(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)');
12852				else $(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)');
12853
12854				revNum--;
12855			}
12856			
12857			totalLayers = totalLayers + 3;
12858			
12859		}
12860	}
12861
12862	style6Img();
12863
12864	function portfolioDeviceCheck(){
12865		if($('body').hasClass('mobile') || navigator.userAgent.match(/(iPad|IEMobile)/) ){
12866			
12867			//if using more details
12868			if($('.portfolio-items .col .work-item').find('a:not(".pp")').length > 0){
12869				$('.portfolio-items .col .work-item').find('a.pp').css('display','none');
12870			} 
12871			
12872			//if only using pp
12873			else {
12874				$('.portfolio-items .col .work-item').find('a:not(".pp")').css('display','none');
12875			}
12876		
12877		} else {
12878			$('.portfolio-items .col .work-item').find('a').css('display','inline');
12879		}
12880	}
12881	
12882	
12883	//portfolio fullscreen zoom slider
12884
12885	//remove outside of column setups 
12886	$('.nectar_fullscreen_zoom_recent_projects').each(function(){
12887		if($(this).parents('.span_12').find('> .wpb_column').length > 1){
12888			var $zoomProjects = $(this).clone();
12889			var $zoomProjectsRow = $(this).parents('.span_12');
12890			$(this).remove();
12891			$zoomProjectsRow.prepend($zoomProjects);
12892		}
12893	});
12894
12895	 $.fn.lines = function (opts) {
12896        var s = $.extend({
12897            'lineClass' : 'line'
12898        },opts);
12899        return this.each(function () {
12900            var self = this,
12901                $self = $(self),
12902                $line,
12903                $prev;
12904            $self.find('.' + s.lineClass).contents().unwrap();
12905            $self.html(function (i, h) {
12906                return h.replace(/(\b[\w']+\b)/g, '<span class="' + s.lineClass + '">$1</span>');
12907            });
12908
12909            $self.find('.line + .line').each(function(i, el){
12910                $line = $(this),
12911                $prev = $line.prev('.line');
12912                if ($line.offset().top === $prev.offset().top) {
12913                    $prev.append(el.previousSibling, $line.contents());
12914                    $line.remove();
12915                }
12916            });
12917        });
12918    };
12919
12920	function splitLineText() {
12921		$('.nectar_fullscreen_zoom_recent_projects, .nectar-recent-posts-single_featured.multiple_featured').each(function(){
12922			
12923			var $slideClass = ($(this).find('.project-slides').length > 0) ? '.project-slide' : '.nectar-recent-post-slide';
12924			var $slideInfoClass = ($(this).find('.project-slides').length > 0) ? '.project-info h1' : '.inner-wrap h2 a';
12925			
12926			$(this).find($slideClass).each(function(i){
12927				
12928				$(this).find($slideInfoClass).each(function(){
12929					
12930					var textArr = $(this).text();
12931		      textArr = textArr.trim();
12932		      textArr = textArr.split(' ');
12933		
12934		      $(this)[0].innerHTML = '';
12935		      
12936		      for(var i=0;i<textArr.length;i++) {
12937		          $(this)[0].innerHTML += '<span>'+ textArr[i] + '</span> ';
12938		      }
12939					
12940				});
12941
12942				$(this).find($slideInfoClass + ' > span').wrapInner('<span class="inner" />');
12943
12944			});
12945			
12946		});
12947		
12948	}
12949
12950	function portfolioFullScreenSliderCalcs() {
12951
12952		var $bodyBorderSize = ($('.body-border-top').length > 0 && $(window).width() > 1000) ? $('.body-border-top').height(): 0;
12953
12954		$('.nectar_fullscreen_zoom_recent_projects').each(function(){
12955			
12956			//frontend editor fix
12957			if(nectarDOMInfo.usingFrontEndEditor) {
12958				if($(this).parents('.wpb_row').parent().index() > 1) { $(this).parents('.first-section').removeClass('first-section'); }
12959			}
12960			
12961			if($(this).parents('.first-section').length > 0) {
12962				$(this).css('height',$(window).height() - $(this).offset().top - $bodyBorderSize);
12963			} else {
12964				$(this).css('height',$(window).height());
12965			}
12966		});
12967
12968	}
12969
12970				
12971	function nectarCustomSliderRotate(slider){
12972		
12973		if($('body.vc_editor').length > 0) { return; }
12974		
12975		var $controlSelector = (slider.find('.project-slides').length > 0) ? '.dot-nav > span' : '.controls > li';
12976		var $controlSelectorInd = (slider.find('.project-slides').length > 0) ? 'span' : ' li';
12977		
12978		var $slideLength = slider.find($controlSelector).length;
12979		var $currentSlide = slider.find($controlSelector+'.active').index();
12980		if( $currentSlide+1 == $slideLength) {
12981			slider.find($controlSelector+':first-child').click();
12982		} else {
12983			slider.find($controlSelector+'.active').next($controlSelectorInd).click();
12984		}
12985	}
12986	
12987	function nectarCustomSliderResetRotate(slider,index){
12988		clearInterval($nectarCustomSliderRotate[index].autorotate);
12989
12990		//reinit autorotate
12991		if(slider.attr('data-autorotate').length > 0) {
12992			var slide_interval = (parseInt(slider.attr('data-autorotate')) < 100) ? 4000 : parseInt(slider.attr('data-autorotate'));
12993			$nectarCustomSliderRotate[index].autorotate = setInterval(function(){ nectarCustomSliderRotate(slider) },slide_interval);
12994		}
12995	}
12996
12997
12998	if($('.nectar_fullscreen_zoom_recent_projects').length > 0){
12999		portfolioFullScreenSliderCalcs();
13000		splitLineText();
13001		$(window).resize(splitLineText);
13002		$(window).resize(portfolioFullScreenSliderCalcs);
13003	}
13004	
13005	
13006	function fsProjectSliderInit() {
13007		
13008		$('.nectar_fullscreen_zoom_recent_projects').each(function(recentProjectSliderIndex){
13009
13010			
13011			//store instance
13012			$nectarCustomSliderRotate[recentProjectSliderIndex] = { autorotate: '' };
13013			
13014			var $projLength = $(this).find('.project-slide').length;
13015			
13016			//autorotate
13017			if($(this).attr('data-autorotate').length > 0) {
13018				var slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
13019				var $that = $(this);
13020				$nectarCustomSliderRotate[recentProjectSliderIndex].autorotate = setInterval(function(){ nectarCustomSliderRotate($that) },slide_interval);
13021			}
13022
13023			//next/prev
13024			$(this).find('.zoom-slider-controls .next').on('click',function(e){
13025
13026				//thres
13027				
13028				var $that = $(this);
13029				if(!$that.parent().hasClass('timeout')) {
13030					setTimeout(function(){
13031						$that.parent().removeClass('timeout');
13032					},1150);
13033				}
13034
13035				if($(this).parent().hasClass('timeout')) return false;
13036				$(this).parent().addClass('timeout');
13037				//switch logic
13038
13039				nectarCustomSliderResetRotate($that.parents('.nectar_fullscreen_zoom_recent_projects'), recentProjectSliderIndex);
13040				
13041				var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current');
13042				var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects');
13043
13044				$sliderInstance.find('.project-slide').removeClass('next').removeClass('prev');
13045				$sliderInstance.find('.project-slide').each(function(i){
13046
13047					if(i < $current.index()+1 && $current.index()+1 < $projLength)
13048						$(this).addClass('prev');
13049					else
13050						$(this).addClass('next');
13051				});
13052
13053				if($current.index()+1 == $projLength) {
13054					$sliderInstance.find('.project-slide:first-child').addClass('no-trans');
13055				}
13056
13057				setTimeout(function(){
13058
13059					if($current.index()+1 == $projLength) {
13060						$sliderInstance.find('.project-slide:first-child').removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
13061						$sliderInstance.find('.project-slide:last-child').removeClass('next').removeClass('current').addClass('prev');
13062					} else {
13063						$current.next('.project-slide').removeClass('next').removeClass('prev').addClass('current');
13064						$current.removeClass('current').addClass('prev');
13065					}
13066
13067					//update dot nav
13068					if($sliderInstance.find('.dot-nav').length > 0) {
13069						$sliderInstance.find('.dot-nav span.active').removeClass('active');
13070						$sliderInstance.find('.dot-nav span:nth-child('+ ($sliderInstance.find('.project-slide.current').index() + 1) +')').addClass('active');
13071					}
13072
13073				},30);
13074
13075				return false;
13076				
13077			});
13078
13079			$(this).find('.zoom-slider-controls .prev').on('click',function(e){
13080
13081				//thres
13082				var $that = $(this);
13083				if(!$that.parent().hasClass('timeout')) {
13084					setTimeout(function(){
13085						$that.parent().removeClass('timeout');
13086					},1150);
13087				}
13088
13089				if($(this).parent().hasClass('timeout')) return false;
13090				$(this).parent().addClass('timeout');
13091				
13092				nectarCustomSliderResetRotate($that.parents('.nectar_fullscreen_zoom_recent_projects'), recentProjectSliderIndex);
13093
13094				//switch logic
13095				var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current');
13096				var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects');
13097
13098				
13099				$sliderInstance.find('.project-slide').removeClass('next').removeClass('prev');
13100				$sliderInstance.find('.project-slide').each(function(i){
13101
13102					if(i < $current.index() || $current.index() == 0)
13103						$(this).addClass('prev');
13104					else
13105						$(this).addClass('next');
13106				});
13107
13108				if($current.index() == 0)
13109					$sliderInstance.find('.project-slide:last-child').addClass('no-trans');
13110
13111				setTimeout(function(){
13112
13113					if($current.index() == 0) {
13114						$sliderInstance.find('.project-slide:last-child').removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
13115						$sliderInstance.find('.project-slide:first-child').removeClass('next').removeClass('prev').removeClass('current').addClass('next');
13116					} else {
13117						$current.prev('.project-slide').removeClass('next').removeClass('prev').addClass('current');
13118						$current.removeClass('current').addClass('next');
13119					}
13120
13121					//update dot nav
13122					if($sliderInstance.find('.dot-nav').length > 0) {
13123						$sliderInstance.find('.dot-nav span.active').removeClass('active');
13124						$sliderInstance.find('.dot-nav span:nth-child('+ ($sliderInstance.find('.project-slide.current').index() + 1) +')').addClass('active');
13125					}
13126
13127				},30);
13128
13129
13130				return false;
13131
13132			});
13133
13134			//pagination
13135				$(this).find('> .normal-container > .dot-nav').remove();
13136				$(this).find('> .normal-container').append('<div class="dot-nav"></div>');
13137				for(var $i=0;$i < $projLength;$i++) {
13138					if($i == 0) {
13139						$(this).find('.dot-nav').append('<span class="dot active"><span></span></span>');
13140					} else {
13141						$(this).find('.dot-nav').append('<span class="dot"><span></span></span>');
13142					}
13143			
13144				}
13145	
13146
13147			var $dotIndex = 1;
13148
13149			$('.nectar_fullscreen_zoom_recent_projects .dot-nav > span').on('click',function(e){
13150
13151				if($(this).hasClass('active')) return;
13152
13153				//thres
13154				var $that = $(this);
13155				if(!$that.parent().hasClass('timeout')) {
13156					setTimeout(function(){
13157						$that.parent().removeClass('timeout');
13158					},1150);
13159				}
13160
13161				if($(this).parent().hasClass('timeout')) return;
13162				$(this).parent().addClass('timeout');
13163
13164				nectarCustomSliderResetRotate($that.parents('.nectar_fullscreen_zoom_recent_projects'), recentProjectSliderIndex);
13165
13166				//switch logic
13167				$(this).parent().find('span.active').removeClass('active');
13168				$(this).addClass('active');
13169
13170				$dotIndex = $(this).index() + 1;
13171
13172				var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current');
13173				var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects');
13174
13175				var $prevIndex = $current.index() + 1;
13176
13177				$sliderInstance.find('.project-slide').removeClass('next').removeClass('prev');
13178
13179				$sliderInstance.find('.project-slide').each(function(i){
13180					if(i < $dotIndex-1)
13181						$(this).addClass('prev');
13182					else
13183						$(this).addClass('next');
13184				});
13185
13186				//going prev
13187				if($prevIndex > $dotIndex) {
13188					$sliderInstance.find('.project-slide').eq($dotIndex-1).addClass('no-trans').addClass('prev').removeClass('next');
13189					setTimeout(function(){
13190						$sliderInstance.find('.project-slide').eq($dotIndex-1).removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
13191						$current.removeClass('current').addClass('next');
13192					},30);
13193				
13194				} 
13195
13196				//going forawrd
13197				else {
13198					$sliderInstance.find('.project-slide').eq($dotIndex-1).addClass('no-trans').addClass('next').removeClass('prev');
13199					setTimeout(function(){
13200						$sliderInstance.find('.project-slide').eq($dotIndex-1).removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
13201						$current.removeClass('current').addClass('prev');
13202					},30);
13203
13204				}
13205				
13206			});	
13207
13208
13209		});
13210		
13211	}
13212	fsProjectSliderInit();
13213 	
13214
13215	//portfolio accent color
13216	function portfolioAccentColor() {
13217
13218		var portfolioSocialColorCss = '';
13219
13220		$('.portfolio-items .col').each(function(){
13221			if ($(this).has('[data-project-color]')) { 
13222				$(this).find('.work-info-bg, .bottom-meta').css('background-color',$(this).attr('data-project-color'));
13223
13224				//style5
13225				$(this).find('.parallaxImg-rendered-layer .bg-overlay').css('border-color',$(this).attr('data-project-color'));
13226
13227				var	$projColor = $(this).attr('data-project-color');
13228				if($(this).find('.custom-content .nectar-social').length > 0 && $('body[data-button-style="rounded"]') ) portfolioSocialColorCss += 'body[data-button-style="rounded"] .col[data-
13228project-color="'+$projColor+'"] .custom-content .nectar-social > *:hover i { color: '+ $projColor +'!important; } ';
13229
13230			}
13231		});
13232		
13233		if(portfolioSocialColorCss.length > 1) {
13234
13235			var head = document.head || document.getElementsByTagName('head')[0];
13236			var style = document.createElement('style');
13237
13238				style.type = 'text/css';
13239			if (style.styleSheet){
13240			  style.styleSheet.cssText = portfolioSocialColorCss;
13241			} else {
13242			  style.appendChild(document.createTextNode(portfolioSocialColorCss));
13243			}
13244
13245			head.appendChild(style);
13246		}
13247	}
13248	portfolioAccentColor();
13249	
13250	//portfolio sort
13251	$('body').on('mouseenter','.portfolio-filters',function(){
13252		if(!portfolioFiltersOnMobile) {
13253			$(this).find('> ul').stop(true,true).slideDown(500,'easeOutExpo');
13254		}
13255		$(this).find('a#sort-portfolio span').html($(this).find('a#sort-portfolio').attr('data-sortable-label'));
13256	});
13257
13258	$('body').on('mouseleave','.portfolio-filters',function(){
13259		var $activeCat = $(this).find('a.active').html();
13260		if( typeof $activeCat == 'undefined' || $activeCat.length == 0) $activeCat = $(this).attr('data-sortable-label');
13261		$(this).find('a#sort-portfolio span').html($activeCat);
13262		if(!portfolioFiltersOnMobile) {
13263			$(this).find('> ul').stop(true,true).slideUp(500,'easeOutExpo');
13264		}
13265	});
13266	
13267	//portfolio selected category
13268	$('body').on('click','.portfolio-filters ul li a', function(){
13269		$(this).parents('.portfolio-filters').find('#sort-portfolio span').html($(this).html());
13270	});
13271	
13272	//portfolio prevent jump on parent dropdown click
13273	$('body').on('click','.portfolio-filters > a#sort-portfolio', function(){
13274		return false;
13275	});
13276	
13277	//inline portfolio selected category
13278	$('body').on('click','.portfolio-filters-inline ul li a',function(){
13279
13280		$(this).parents('ul').find('li a').removeClass('active');
13281		$(this).addClass('active');
13282		$(this).parents('.portfolio-filters-inline').find('#current-category').html($(this).html());
13283		
13284	});
13285	
13286	var portfolioFiltersOnMobile = false;
13287	
13288	function portfolioFiltersInit() {
13289		//mobile sort menu fix
13290		if($('body').hasClass('mobile') || navigator.userAgent.match(/(iPad|IEMobile)/)){
13291			portfolioFiltersOnMobile = true;
13292			$('.portfolio-filters').unbind('mouseenter mouseleave');
13293			$('.portfolio-filters > a, .portfolio-filters ul li a').on('click',function(e){
13294				if(e.originalEvent !== undefined) $(this).parents('.portfolio-filters').find('> ul').stop(true,true).slideToggle(600,'easeOutCubic');
13295			});
13296		}
13297
13298		if($('.portfolio-filters-inline[data-alignment="left"]').length > 0 || $('.portfolio-filters-inline[data-alignment="center"]').length > 0) {
13299			$('.portfolio-filters-inline .container > ul > li:nth-child(1) a').click();
13300		} else {
13301			$('.portfolio-filters-inline .container > ul > li:nth-child(2) a').click();
13302		}
13303		
13304		//portfolio more details page menu highlight
13305		$('body.single-portfolio #header-outer nav > ul > li > a:contains("Portfolio")').parents('li').addClass('current-menu-item');
13306		
13307		//blog page highlight
13308		$('body.single-post #header-outer nav > ul > li > a:contains("Blog")').parents('li').addClass('current-menu-item');
13309	}
13310
13311	portfolioFiltersInit();
13312
13313	
13314	//blog love center
13315	function centerLove(){
13316		$('.post').each(function(){
13317			
13318			var $loveWidth = $(this).find('.post-meta .nectar-love').outerWidth();
13319			var $loveWrapWidth = $(this).find('.post-meta  .nectar-love-wrap').width();
13320			
13321			//center
13322			$(this).find('.post-meta .nectar-love').css('margin-left', $loveWrapWidth/2 - $loveWidth/2 + 'px' );
13323			$(this).find('.nectar-love-wrap').css('visibility','visible');
13324		});
13325	}
13326	
13327	$('.nectar-love').on('click',function(){
13328		centerLove();
13329	});
13330	
13331	centerLove();	
13332	
13333
13334	//portfolio single comment order
13335	function portfolioCommentOrder(){
13336	
13337		if($('body').hasClass('mobile') && $('body').hasClass('single-portfolio') && $('#respond').length > 0){
13338			$('#sidebar').insertBefore('.comments-section');
13339		}
13340		 
13341		else if($('body').hasClass('single-portfolio') && $('#respond').length > 0) {
13342			$('#sidebar').insertAfter('.post-area');
13343		}
13344		
13345	}
13346
13347	portfolioCommentOrder();
13348	 
13349	
13350	//portfolio sidebar follow
13351	var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
13352	
13353	function portfolioSidebarFollow(){
13354		
13355		if($('body.single-portfolio').length == 0 || $('#sidebar[data-follow-on-scroll]').length == 0) { return; }
13356
13357		sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
13358	
13359		if( sidebarFollow == 1 && !$('body').hasClass('mobile') && parseInt($('#sidebar').height()) + 50 <= parseInt($('.post-area').height())) {
13360			
13361			 
13362			 //padding from top of screen
13363			 var $ssExtraTopSpace = 50;
13364
13365			 if($('#header-outer[data-remove-fixed="0"]').length > 0 && $('body[data-hhun="1"]').length == 0) { 
13366				 $ssExtraTopSpace += $('#header-outer').outerHeight();	
13367				 
13368				 //resize effect
13369				 if($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0 ) {
13370						var shrinkNum = 6;		
13371						var headerPadding2 = parseInt($('#header-outer').attr('data-padding')) - parseInt($('#header-outer').attr('data-padding'))/1.8;
13372						shrinkNum = $('#header-outer').attr('data-shrink-num');
13373						$ssExtraTopSpace -= shrinkNum;
13374						$ssExtraTopSpace -= headerPadding2;
13375				 }
13376				 
13377				 //condesne
13378				 if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
13379					 
13380						 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
13381						 var $secondaryHeader = $('#header-secondary-outer');
13382						 
13383						 $ssExtraTopSpace = 50;
13384						 $ssExtraTopSpace += $('#header-outer').height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top')) ) - parseInt(nectarDOMInfo.secondaryHeaderHeight);
13385				 }
13386				 
13387
13388			 }
13389
13390			 if($('#wpadminbar').length > 0) {
13391				 $ssExtraTopSpace += $('#wpadminbar').outerHeight();
13392			 }
13393
13394			if($('#header-outer').attr('data-using-secondary') == '1' && $('body.material').length == 0) {
13395				 $ssExtraTopSpace += $('#header-secondary-outer').outerHeight();
13396			 }
13397			 
13398			 $('.single-portfolio #sidebar').theiaStickySidebar({
13399				 additionalMarginTop: $ssExtraTopSpace,
13400				 updateSidebarHeight: false
13401			 });
13402
13403			 
13404		} //if sticky sidebar is active and needs to be called
13405		
13406	} // end  portfolioSidebarFollow function
13407	
13408
13409	
13410	
13411	
13412	//remove the portfolio filters that are not found in the current page
13413	function isotopeCatSelection() {
13414
13415
13416		$('.portfolio-items:not(".carousel")').each(function(){
13417			
13418			var isotopeCatArr = [];
13419			var $portfolioCatCount = 0;
13420			$(this).parent().parent().find('div[class^=portfolio-filters] ul li').each(function(i){
13421				if($(this).find('a').length > 0) {
13422					isotopeCatArr[$portfolioCatCount] = $(this).find('a').attr('data-filter').substring(1);	
13423					$portfolioCatCount++;
13424				}
13425			});
13426		
13427			
13428			////ice the first (all)
13429			isotopeCatArr.shift();
13430			
13431			
13432			var itemCats = '';
13433			
13434			$(this).find('> div').each(function(i){
13435				itemCats += $(this).attr('data-project-cat');
13436			});
13437			itemCats = itemCats.split(' ');
13438			
13439			////remove the extra item on the end of blank space
13440			itemCats.pop();
13441			
13442			////make sure the array has no duplicates
13443			itemCats = $.unique(itemCats);
13444			
13445			////if user has chosen a set of filters to display - only show those
13446			if($(this).is('[data-categories-to-show]') && $(this).attr('data-categories-to-show').length != 0 && $(this).attr('data-categories-to-show') != 'all') {
13447				var $userSelectedCats = $(this).attr('data-categories-to-show').replace(/,/g , ' ');
13448				$userSelectedCats = $userSelectedCats.split(' ');
13449				
13450				if(!$(this).hasClass('infinite_scroll')) $(this).removeAttr('data-categories-to-show');
13451			} else {
13452				var $userSelectedCats = itemCats;
13453			}
13454			
13455			
13456			////Find which categories are actually on the current page
13457			var notFoundCats = [];
13458			$.grep(isotopeCatArr, function(el) {
13459
13460		    	if ($.inArray(el, itemCats) == -1) notFoundCats.push(el);
13461		    	if ($.inArray(el, $userSelectedCats) == -1) notFoundCats.push(el);
13462
13463			});
13464			
13465			//manipulate the list
13466			if(notFoundCats.length != 0){
13467				$(this).parent().parent().find('div[class^=portfolio-filters] ul li').each(function(){
13468					if($(this).find('a').length > 0) {
13469						if( $.inArray($(this).find('a').attr('data-filter').substring(1), notFoundCats) != -1 ){ 
13470							
13471							if($(this).find('> ul.children').length > 0) {
13472								$(this).find('> a').hide(); 
13473							} else {
13474								$(this).hide(); 
13475							}
13476							
13477						} else {
13478							$(this).show();
13479						}
13480					}
13481				})
13482			}
13483		});
13484	}
13485	
13486	isotopeCatSelection();
13487	
13488	
13489	//sharing buttons
13490
13491	var completed = 0;
13492	var windowLocation = window.location.href.replace(window.location.hash, '');
13493
13494	function facebookShare(){
13495		windowLocation = window.location.href.replace(window.location.hash, '');
13496		window.open( 'https://www.facebook.com/sharer/sharer.php?u='+windowLocation, "facebookWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 
13497		return false;
13498	}
13499
13500	function googlePlusShare(){
13501		windowLocation = window.location.href.replace(window.location.hash, '');
13502		window.open( 'https://plus.google.com/share?url='+windowLocation, "googlePlusWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 
13503		return false;
13504	}
13505
13506	function twitterShare(){
13507        windowLocation = window.location.href.replace(window.location.hash, '');		
13508		if($(".section-title h1").length > 0) {
13509			var $pageTitle = encodeURIComponent($(".section-title h1").text());
13510		} else {
13511			var $pageTitle = encodeURIComponent($(document).find("title").text());
13512		}
13513		window.open( 'http://twitter.com/intent/tweet?text='+$pageTitle +' '+windowLocation, "twitterWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 
13514		return false;
13515	}
13516
13517	function wooTwitterShare(){
13518		windowLocation = window.location.href.replace(window.location.hash, '');
13519		window.open( 'http://twitter.com/intent/tweet?text='+$("h1.product_title").text() +' '+windowLocation, "twitterWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 
13520		return false;
13521	}
13522
13523	function linkedInShare(){
13524	    windowLocation = window.location.href.replace(window.location.hash, '');	
13525		if($(".section-title h1").length > 0) {
13526			var $pageTitle = encodeURIComponent($(".section-title h1").text());
13527		} else {
13528			var $pageTitle = encodeURIComponent($(document).find("title").text());
13529		}
13530		window.open( 'http://www.linkedin.com/shareArticle?mini=true&url='+windowLocation+'&title='+$pageTitle+'', "linkedInWindow", "height=480,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 
13531		return false;
13532	}
13533
13534	function woolinkedInShare(){
13535	    windowLocation = window.location.href.replace(window.location.hash, '');	
13536		window.open( 'http://www.linkedin.com/shareArticle?mini=true&url='+windowLocation+'&title='+$("h1.product_title").text(), "twitterWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 
13537		return false;
13538	}
13539
13540	function pinterestShare(){
13541		windowLocation = window.location.href.replace(window.location.hash, '');
13542		var $sharingImg = ($('.single-portfolio').length > 0 && $('div[data-featured-img]').attr('data-featured-img') != 'empty' ) ? $('div[data-featured-img]').attr('data-featured-img') : $('#ajax-content-wrap img').first().attr('src'); 
13543		
13544		if($(".section-title h1").length > 0) {
13545			var $pageTitle = encodeURIComponent($(".section-title h1").text());
13546		} else {
13547			var $pageTitle = encodeURIComponent($(document).find("title").text());
13548		}
13549		
13550		window.open( 'http://pinterest.com/pin/create/button/?url='+windowLocation+'&media='+$sharingImg+'&description='+$pageTitle, "pinterestWindow", "height=640,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 
13551		return false;
13552	}
13553	
13554	function wooPinterestShare(){
13555		$imgToShare = ($('img.attachment-shop_single').length > 0) ? $('img.attachment-shop_single').first().attr('src') : $('.single-product-main-image img').first().attr('src');
13556		windowLocation = window.location.href.replace(window.location.hash, '');
13557		window.open( 'http://pinterest.com/pin/create/button/?url='+windowLocation+'&media='+$imgToShare+'&description='+$('h1.product_title').text(), "pinterestWindow", "height=640,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ) 
13558		return false;
13559	}
13560
13561
13562	function socialFade(){
13563
13564			if(completed == $('a.nectar-sharing').length && $('a.nectar-sharing').parent().hasClass('in-sight')) {
13565
13566					//love fadein
13567					$('.nectar-social .nectar-love span').show(350,'easeOutSine',function(){
13568						$(this).stop().animate({'opacity':1},800);
13569					});
13570					
13571					//sharing loadin
13572					$('.nectar-social > a').each(function(i){
13573						var $that = $(this);
13574						
13575						$(this).find('> span').show(350,'easeOutSine',function(){
13576							$that.find('> span').stop().animate({'opacity':1},800);
13577						});
13578						
13579					});
13580
13581
13582				//alt blog layout total share count
13583				var $totalShares = 0;
13584				$('.nectar-social > a .count').each(function(){
13585					$totalShares += parseInt($(this).html());
13586				});
13587				
13588				if($totalShares != 1){
13589					$('.single .meta-share-count .plural').css({'opacity':'1', 'display':'inline'});
13590					$('.single .meta-share-count .singular').remove();
13591				} else {
13592					$('.single .meta-share-count .singular').css({'opacity':'1', 'position':'relative',  'display':'inline'});
13593					$('.single .meta-share-count .plural').remove();
13594				}
13595
13596				$('.meta-share-count .share-count-total').html($totalShares).css('opacity',1);
13597			}
13598		}
13599
13600	$('body').on('click','#single-below-header .nectar-social a', function(){ return false; });
13601
13602	$('body').on('click','.facebook-share:not(.inactive)', facebookShare);
13603	$('body').on('click','.google-plus-share:not(.inactive)', googlePlusShare);
13604	$('body').on('click','.nectar-social:not(".woo") .twitter-share:not(.inactive)', twitterShare);
13605	$('body').on('click','.nectar-social.woo .twitter-share', wooTwitterShare);
13606	$('body').on('click','.nectar-social:not(".woo") .linkedin-share:not(.inactive)', linkedInShare);
13607	$('body').on('click','.nectar-social.woo .linkedin-share', woolinkedInShare);
13608	$('body').on('click','.nectar-social:not(".woo") .pinterest-share:not(.inactive)', pinterestShare);
13609	$('body').on('click','.nectar-social.woo .pinterest-share', wooPinterestShare);
13610	$('body').on('click','.nectar-social-sharing-fixed > a', function(){ return false; });
13611
13612	function socialSharingInit() {
13613
13614		//mobile fullscreen blog class for click event fix
13615		if($('body').hasClass('mobile') && $('.single-post .fullscreen-header').length > 0) {
13616			$('#single-below-header .nectar-social .nectar-sharing, #single-below-header .nectar-social .nectar-sharing-alt').addClass('inactive');
13617		}
13618
13619		completed = 0;
13620
13621		if( $('a.facebook-share').length > 0 || $('a.twitter-share').length > 0 || $('a.google-plus-share').length > 0 || $('a.linkedin-share').length > 0 || $('a.pinterest-share').length > 0) {
13622  
13623		 
13624			////facebook
13625			if($('a.facebook-share:not(.sharing-default-minimal a.facebook-share)').length > 0 && $('body[data-button-style="rounded"]').length == 0 || $('#project-meta a.facebook-share').length > 0 || $('#single-meta a.facebook-share').length > 0 || $('#single-below-header .facebook-share').length > 0) {
13626				
13627				//load share count on load  
13628				$.getJSON("https://graph.facebook.com/?id="+ windowLocation +"&callback=?", function(data) {
13629					if( data.share != undefined && data.share.share_count != undefined && data.share.share_count != 0 && (data.share.share_count != null)) { 
13630						$('.facebook-share a span.count, a.facebook-share span.count').html( data.share.share_count );	
13631					}
13632					else {
13633						$('.facebook-share a span.count, a.facebook-share span.count').html( 0 );	
13634					}
13635					completed++;
13636					socialFade();
13637				});
13638			 
13639				
13640				
13641			} else if($('a.facebook-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.facebook-share').length > 0) {
13642				completed++;
13643				socialFade();
13644			}
13645			
13646			
13647			////twitter
13648			if($('a.twitter-share:not(.sharing-default-minimal a.twitter-share)').length > 0 && $('body[data-button-style="rounded"]').length == 0 || $('#project-meta a.twitter-share').length > 0 || $('#single-meta a.twitter-share').length > 0 || $('#single-below-header .twitter-share').length > 0) {
13649				//load tweet count on load 
13650			
13651					$('.twitter-share a span.count, a.twitter-share span.count').html( 0 );
13652				
13653					completed++;
13654					socialFade();
13655				
13656
13657
13658			} else if($('a.twitter-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.twitter-share').length > 0 ) {
13659				completed++;
13660				socialFade();
13661			}
13662			
13663			
13664			////linkedIn
13665			if($('a.linkedin-share:not(.sharing-default-minimal a.linkedin-share)').length > 0 && $('body[data-button-style="rounded"]').length == 0 || $('#project-meta a.linkedin-share').length > 0 || $('#single-meta a.linkedin-share').length > 0 || $('#single-below-header .linkedin-share').length > 0) {
13666				//load share count on load 
13667			
13668						$('.linkedin-share a span.count, a.linkedin-share span.count').html( 0 );
13669			
13670					completed++;
13671					socialFade();
13672
13673				
13674			} else if($('a.linkedin-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.linkedin-share').length > 0) {
13675				completed++;
13676				socialFade();
13677			}
13678			
13679			
13680			////pinterest
13681			if(nectarDOMInfo.usingFrontEndEditor) {
13682				completed++;
13683				socialFade();
13684			}
13685			else {
13686				if($('a.pinterest-share:not(.sharing-default-minimal a.pinterest-share)').length > 0 && $('body[data-button-style="rounded"]').length == 0 || $('#project-meta a.pinterest-share').length > 0 || $('#single-meta a.pinterest-share').length > 0 || $('#single-below-header .pinterest-share').length > 0) {
13687					//load pin count on load 
13688					$.getJSON('https://api.pinterest.com/v1/urls/count.json?url='+windowLocation+'&callback=?', function(data) {
13689						if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
13690							$('.pinterest-share a span.count, a.pinterest-share span.count').html( data.count );
13691						}
13692						else {
13693							$('.pinterest-share a span.count, a.pinterest-share span.count').html( 0 );
13694						}
13695						completed++;
13696						socialFade();
13697					});
13698
13699				} else if($('a.pinterest-share').length > 0 && $('body[data-button-style="rounded"]').length >  0 || $('.sharing-default-minimal a.pinterest-share').length > 0) {
13700					completed++;
13701					socialFade();
13702				}
13703		}
13704
13705		//fadeIn
13706		$('a.nectar-sharing > span.count, a.nectar-sharing-alt > span.count').hide().css('width','auto');
13707
13708
13709		//social light up
13710		$('.nectar-social').each(function() {
13711			if($(this).parents('.custom-content').length == 0 && $(this).parents('.nectar-social-sharing-fixed').length == 0) {
13712
13713
13714				var $that = $(this);
13715				var waypoint = new Waypoint({
13716	 			element: $that,
13717	 			 handler: function(direction) {
13718
13719					var $slide_timeout = ($('#page-header-bg[data-animate-in-effect="slide-down"] .nectar-social').length > 0 ) ? 900 : 1;
13720
13721					setTimeout(function(){
13722
13723						$that.addClass('in-sight');
13724						socialFade();
13725						
13726						if($('#page-header-bg .nectar-social').length == 0) {
13727							$that.find('> *').each(function(i){
13728								
13729								var $that = $(this);
13730								var $timeout = ($('body[data-button-style="rounded"]').length > 0) ? 0: 750;
13731
13732								setTimeout(function(){ 
13733									
13734									$that.delay(i*80).queue(function(){ 
13735										
13736										var $that = $(this); $(this).addClass('hovered'); 
13737										
13738										setTimeout(function(){ 
13739											$that.removeClass('hovered');
13740										},300); 
13741										
13742									});
13743								
13744								},$timeout);
13745							});
13746						}
13747
13748					},$slide_timeout );
13749
13750					$that.addClass('animated-in');
13751					waypoint.destroy();
13752				},
13753				offset: 'bottom-in-view'
13754
13755			}); 
13756
13757				
13758			}
13759			}); 
13760
13761		}
13762
13763	}
13764	
13765	socialSharingInit();
13766
13767
13768	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
13769
13770		var $socialTimeout;
13771		$('body').on('mouseenter','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
13772			clearTimeout($socialTimeout);
13773
13774			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
13775				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'right':'0px'},0);
13776			else 
13777				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'left':'0px'},0);
13778
13779			$(this).parents('[id*="-meta"]').addClass('social-hovered');
13780
13781			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':0},250);
13782			$(this).find('.nectar-social a').each(function(i){
13783				$(this).stop(true).delay(i*40).animate({'opacity': 1,  'left':'0px'}, 150);
13784			});
13785
13786		});
13787
13788	
13789		$('body').on('mouseleave','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
13790			$(this).parents('[id*="-meta"]').removeClass('social-hovered');
13791
13792			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
13793				$(this).find('.nectar-social').stop(true).animate({'opacity': 0,  'right':'-20px'}, 200);
13794			else 
13795				$(this).find('.nectar-social').stop(true).animate({'opacity': 0,  'left':'-20px'}, 200);
13796
13797			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':1},250);
13798
13799			var $that = $(this);
13800			
13801			$socialTimeout = setTimeout(function(){ 
13802				$that.find('.nectar-social').hide(); 
13803				if($that.parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
13804					$that.find('.nectar-social a').stop(true).animate({'opacity': 0,  'left':'20px'},0);   
13805				else 
13806					$that.find('.nectar-social a').stop(true).animate({'opacity': 0,  'left':'-20px'},0);   
13807			}, 200);
13808		});
13809	} else {
13810		var $socialTimeout;
13811		$('body').on('click','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
13812			clearTimeout($socialTimeout);
13813
13814			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
13815				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'right':'0px'},0);
13816			else 
13817				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'left':'0px'},0);
13818
13819			$(this).parents('[id*="-meta"]').addClass('social-hovered');
13820
13821			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':0},250);
13822			$(this).find('.nectar-social a').each(function(i){
13823				$(this).stop(true).delay(i*40).animate({'opacity': 1,  'left':'0px'}, 150);
13824			});
13825
13826			return false;
13827		});
13828
13829	}
13830
13831	$('body').on('mouseenter','.fullscreen-header  .meta-share-count', function(){
13832		$(this).find('> a, > i').stop(true).animate({'opacity': 0},400);
13833		$(this).find('.nectar-social > *').each(function(i){
13834			$(this).stop(true).delay(i*50).animate({'opacity':'1', 'top': '0px'},250,'easeOutCubic');
13835		});
13836		//allow clickable on mobile
13837		setTimeout(function(){ $('.meta-share-count .nectar-sharing, .meta-share-count .nectar-sharing-alt').removeClass('inactive'); },300);
13838	});
13839
13840	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
13841		$('body').on('mouseleave','.fullscreen-header  .meta-share-count', function(){
13842			$(this).find('> a, > i').stop(true).animate({'opacity': 1},300,'easeInCubic');
13843			$(this).find('.nectar-social > *').each(function(i){
13844				$(this).stop(true).animate({'opacity':'0', 'top': '10px'},200,'easeInCubic');
13845			});
13846		});
13847	}
13848
13849	//full width love center
13850	function nectarLoveFWCenter(){
13851		$('.nectar-social.full-width').each(function(){ 
13852			$(this).find('.n-shortcode .nectar-love').css('padding-top', $(this).find('> a').css('padding-top'));
13853		});
13854	}
13855	
13856	nectarLoveFWCenter();
13857	
13858
13859	//-----------------------------------------------------------------
13860	// NectarLove
13861	//-----------------------------------------------------------------
13862	
13863	////love iwth txt
13864	$('.fullscreen-header .nectar-love').each(function(){
13865		if($(this).find('.nectar-love-count').text() == '1') {
13866			$(this).find('span.love-txt.single').css({'visibility':'visible', 'text-indent':'0'});
13867			$(this).find('span.love-txt.plural').css({'visibility':'hidden', 'text-indent':'-9999px'});
13868		} else {
13869			$(this).find('span.love-txt.single').css({'visibility':'hidden', 'text-indent':'-9999px'});
13870			$(this).find('span.love-txt.plural').css({'visibility':'visible', 'text-indent':'0'});
13871		}
13872	});
13873
13874	$('body').on('click','.nectar-love', function() {
13875			
13876
13877			var $loveLink = $(this);
13878			var $id = $(this).attr('id');
13879			var $that = $(this);
13880			
13881			if($loveLink.hasClass('loved')) return false;
13882			if($(this).hasClass('inactive')) return false;
13883			
13884			var $dataToPass = {
13885				action: 'nectar-love', 
13886				loves_id: $id,
13887				love_nonce: nectarLove.loveNonce
13888			}
13889			
13890			$.post(nectarLove.ajaxurl, $dataToPass, function(data){
13891				$loveLink.find('span:not(.love-txt)').html(data);
13892				$loveLink.addClass('loved').attr('title','You already love this!');
13893				$loveLink.find('span:not(.love-txt)').css({'opacity': 1,'width':'auto'});
13894
13895				if($(data).text() == '1') {
13896					$loveLink.find('span.love-txt.single').css({'visibility':'visible', 'text-indent':'0'});
13897					$loveLink.find('span.love-txt.plural').css({'visibility':'hidden', 'text-indent':'-9999px'});
13898				} else {
13899					$loveLink.find('span.love-txt.single').css({'visibility':'hidden', 'text-indent':'-9999px'});
13900					$loveLink.find('span.love-txt.plural').css({'visibility':'visible', 'text-indent':'0'});
13901				}
13902
13903				//ascend
13904				if($('body').hasClass('ascend') && $that.parents('.classic_enhanced').length == 0 ){
13905					$that.find('.icon-salient-heart-2').addClass('loved');
13906				} else if($that.parents('.classic_enhanced').length > 0 ) {
13907					$that.find('.icon-salient-heart-2').addClass('loved');
13908				}
13909			});
13910			
13911			$(this).addClass('inactive');
13912			
13913			return false;
13914	});
13915
13916
13917	
13918	//infinite scroll
13919	function infiniteScrollInit() {
13920
13921		if($('.infinite_scroll').length > 0) {
13922			
13923			//portfolio
13924			$('.portfolio-items.infinite_scroll').infinitescroll({
13925		    	navSelector  : "div#pagination",            
13926		   	    nextSelector : "div#pagination a:first",    
13927		   	    itemSelector : ".portfolio-items.infinite_scroll .element",
13928		   	    finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
13929		        msgText: " ",         
13930		   },function(newElements){
13931		   	
13932
13933				var $container = $('.portfolio-items.infinite_scroll:not(.carousel)');
13934				//loading effect   
13935
13936		        var $newElems = $( newElements ).css('opacity',0);
13937		        //// ensure that images load before adding to masonry layout
13938		        $newElems.imagesLoaded(function(){
13939		          
13940		          $( newElements ).css('opacity',1);
13941
13942		          $container.isotope( 'appended', $( newElements ));
13943		          
13944		          $( newElements ).find('.work-item').addClass('ajax-loaded');
13945		          $( newElements ).addClass('ajax-loaded');
13946		          ///// show elems now they're ready
13947		          
13948		          $(newElements).find('.work-meta, .nectar-love-wrap').css({'opacity':1});
13949		          
13950		          //keep filtering
13951		          if($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) {
13952		          	
13953		          	  if($('.portfolio-filters-inline').length > 0) {
13954		          	  	 var selector = $('.portfolio-filters-inline a.active').attr('data-filter');
13955		          	  } else {
13956		          	  	 var selector = $('.portfolio-filters a.active').attr('data-filter');
13957		          	  }
13958		          	  
13959		          	  $('.portfolio-filters-inline a.active').attr('data-filter');
13960			  	 	  $container.isotope({ filter: selector });
13961		          }
13962		          
13963			  	//set width
13964			  	//portfolioItemWidths();
13965			  	reLayout();
13966
13967		        if($(newElements).find('.work-item.style-5').length > 0) style6Img();
13968
13969	          	if($(newElements).find('.inner-wrap').attr('data-animation') == 'none') {
13970					$('.portfolio-items .col .inner-wrap').removeClass('animated');
13971				} else {
13972
13973					masonryZindex();
13974					$(newElements).each(function(i){
13975						
13976						var $portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%';
13977						
13978						//not already visible
13979						var $that = $(this);
13980						var waypoint = new Waypoint({
13981			 			element: $that,
13982			 			 handler: function(direction) {
13983							
13984							var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 115;
13985						
13986							setTimeout(function(){
13987								$that.addClass("animated-in");
13988							},$portfolioAnimationDelay * $that.attr('data-delay-amount'));
13989						
13990							
13991							waypoint.destroy();
13992						},
13993						offset: $portfolioOffsetPos
13994
13995						}); //waypoint
13996
13997	
13998					}); //each
13999				}
14000
14001		       
14002		    portfolioHoverEffects();	
14003				portfolioAccentColor();
14004		         
14005		    //verify smooth scorlling
14006				if( $smoothCache == true && $(window).width() > 690 && $('body').outerHeight(true) > $(window).height() && Modernizr.csstransforms3d && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){ niceScrollInit(); $(window).trigger('resize') } 
14007				
14008				
14009				
14010				//prettyphoto
14011				$('.portfolio-items').each(function(){
14012					var $unique_id = Math.floor(Math.random()*10000);
14013					$(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel','prettyPhoto['+$unique_id+'_gal]').removeClass('pretty_photo');
14014				});
14015		
14016				lightBoxInit();
14017				
14018				piVertCenter();
14019
14020				setTimeout(function(){masonryZindex(); reLayout(); $( newElements ).removeClass('ajax-loaded'); },700);
14021		        
14022		        //recalc the filters
14023		        isotopeCatSelection();
14024
14025		        parallaxRowsBGCals();
14026	          
14027	          }); 
14028
14029				
14030		   });
14031
14032			//blog
14033			$('.post-area.infinite_scroll .posts-container').infinitescroll({
14034		    	navSelector  : "div#pagination",            
14035		   	    nextSelector : "div#pagination a:first",    
14036		   	    itemSelector : ".post-area .posts-container .post",
14037		   	    finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
14038		        msgText: " " 
14039		   },function(newElements){
14040		   	
14041		   	if($('.masonry.meta_overlaid').length == 0) { 
14042			   	//reinit js
14043			   	centerLove();
14044			   	
14045			   	//gallery
14046				$(newElements).find('.flex-gallery').each(function(){
14047					
14048					var $that = $(this);
14049					
14050					 $that.flexslider({
14051				        animation: 'fade',
14052				        smoothHeight: false, 
14053				        animationSpeed: 500,
14054				        useCSS: false, 
14055				        touch: true
14056				    });
14057					
14058					////gallery slider add arrows
14059					$('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="fa fa-angle-right"></i>');
14060					$('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="fa fa-angle-left"></i>');
14061
14062				});
14063			   	
14064			   	
14065			   	//media players
14066			   	if($().mediaelementplayer) $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer();
14067			   	
14068			   	
14069			   	//lightbox
14070			    lightBoxInit();
14071			   	
14072			   	//carousels
14073			   	if($('.carousel').length > 0) {
14074				   	standardCarouselInit();
14075			    	clientsCarouselInit();
14076			    }
14077			   	
14078
14079			   	//milestone
14080			   	$(newElements).find('.nectar-milestone').each(function() {
14081					//symbol
14082					if($(this).has('[data-symbol]')) {
14083						if($(this).attr('data-symbol-pos') == 'before') {
14084							$(this).find('.number').prepend($(this).attr('data-symbol'));
14085						} else {
14086							$(this).find('.number').append($(this).attr('data-symbol'));
14087						}
14088					}
14089				});
14090				
14091				if(!$('body').hasClass('mobile')) {
14092					
14093					$(newElements).find('.nectar-milestone').each(function() {
14094						//animation
14095
14096							var $that = $(this);
14097							var waypoint = new Waypoint({
14098				 			element: $that,
14099				 			 handler: function(direction) {
14100								if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
14101								     waypoint.destroy();
14102								     return;
14103								}
14104
14105								var $endNum = parseInt($that.find('.number span').text());
14106
14107								var countOptions = { easingFn: easeOutCubic };
14108								var $countEle = $that.find('.number span:not(.symbol)')[0];
14109								var numAnim = new CountUp($countEle, 0, $endNum,0,2.2,countOptions);
14110								numAnim.start();
14111
14112
14113								$that.addClass('animated-in');
14114								waypoint.destroy();
14115							},
14116							offset: 'bottom-in-view'
14117
14118						}); 
14119
14120						
14121					}); 
14122				}
14123				
14124				//pie chart		
14125			    if($().vcChat) $(newElements).find('.vc_pie_chart').vcChat();
14126		    	
14127		    	//fancy ul
14128		    	nectar_fancy_ul_init();
14129		    	
14130		    	//testimonial slider
14131		    	$('.testimonial_slider').animate({'opacity':'1'},800);
14132		    	createTestimonialControls();
14133				testimonialSliderHeight(); 
14134				testimonialHeightResize();
14135		    	
14136				//bar graph
14137				$(newElements).find('.nectar-progress-bar').each(function(i){
14138				
14139
14140				var $that = $(this);
14141				var waypoint = new Waypoint({
14142		 			element: $that,
14143		 			 handler: function(direction) {
14144						if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
14145						     waypoint.destroy();
14146						     return;
14147						}
14148
14149						var percent = $that.find('span').attr('data-width');
14150						var $endNum = parseInt($that.find('span strong i').text());
14151						
14152						$that.find('span').transition({
14153							'width' : percent + '%'
14154						},1600, 'easeInOutCirc',function(){
14155						});
14156						
14157						$that.find('span strong').transition({
14158							'opacity' : 1
14159						},1350);
14160						
14161						
14162						var countOptions = { useEasing : false };
14163						var $countEle = $that.find('span strong i')[0];
14164						var numAnim = new CountUp($countEle, 0, $endNum,0,1.2,countOptions);
14165						numAnim.start();
14166
14167						
14168						////100% progress bar 
14169						if(percent == '100'){
14170							$that.find('span strong').addClass('full');
14171						}
14172
14173
14174						$that.addClass('animated-in');
14175						waypoint.destroy();
14176					},
14177					offset: 'bottom-in-view'
14178
14179				}); 
14180
14181
14182			
14183				});
14184				
14185				
14186				//columns & images with animation
14187				colAndImgAnimations();
14188				splitLineHeadings();
14189
14190				setTimeout(function(){
14191					responsiveVideoIframesInit();
14192					responsiveVideoIframes();
14193					$(window).trigger('resize');
14194				},500);
14195
14196
14197				parallaxRowsBGCals();
14198
14199				$(window).trigger('resize');
14200			   	
14201		   	}//non meta overlaid style 
14202		   	else {
14203		   		parallaxRowsBGCals();
14204
14205				  $(window).trigger('resize');
14206		   	}
14207
14208		   	// trigger Masonry as a callback
14209		   	var $container = $('.posts-container');
14210		    if($container.parent().hasClass('masonry')) { 
14211		    	 
14212		    	$(newElements).addClass('masonry-blog-item');
14213				$(newElements).prepend('<span class="bottom-line"></span>');
14214				
14215				//move the meta to the bottom
14216				$(newElements).each(function(){
14217					
14218					var $metaClone = $(this).find('.post-meta').clone();
14219		
14220					$(this).find('.post-meta').remove();
14221					
14222					if($('.post-area.meta_overlaid').length > 0){
14223						$(this).find('.post-header h2').after($metaClone);
14224					} else {
14225						$(this).find('.content-inner').after($metaClone);
14226					}
14227					
14228				});
14229			
14230		    	}//if masonry
14231
14232
14233		    	//loading effect   
14234		    	
14235		        //// hide new items while they are loading
14236		        var $newElems = $( newElements );
14237		        //// ensure that images load before adding to masonry layout
14238						
14239		        if($newElems.find('img').length == 0) $newElems = $('body');
14240		        
14241		        $newElems.imagesLoaded(function(){
14242							
14243							if($container.parent().hasClass('masonry') && !$container.parent().hasClass('auto_meta_overlaid_spaced')) {
14244			          $container.isotope( 'appended', $( newElements ));
14245							}
14246
14247		          flickityBlogInit();
14248
14249		          $( newElements ).addClass('ajax-loaded');
14250		          ///// show elems now they're ready
14251
14252
14253		        //classic enhanced specific 
14254		        if($container.parent().hasClass('classic_enhanced')){
14255					$container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function(){
14256						var $src = $(this).find('img').attr('src');
14257						$(this).css('background-image','url('+$src+')');
14258					});
14259
14260					$container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function(){
14261
14262						$(this).find('.cell').each(function(){
14263							var $src = $(this).find('img').attr('src');
14264							$(this).css('background-image','url('+$src+')');
14265						});
14266						
14267					});
14268				}
14269
14270
14271		          if($(newElements).parents('.posts-container').attr('data-animation') == 'none') {
14272						$( newElements ).find('.inner-wrap').removeClass('animated');
14273					} else {
14274						blogMasonryZindex();
14275						$(newElements).each(function(i){
14276
14277							var $that = $(this);
14278							var waypoint = new Waypoint({
14279
14280					 			element: $that,
14281					 			 handler: function(direction) {
14282									
14283									setTimeout(function(){
14284									    $that.addClass("animated-in");
14285									},80*$that.attr('data-delay-amount'));
14286
14287									waypoint.destroy();
14288								},
14289								offset: '90%'
14290
14291							}); 
14292
14293		
14294						}); //each
14295					}
14296
14297					setTimeout(function(){$( newElements ).removeClass('ajax-loaded'); },700);
14298
14299		        
14300		        });
14301		        
14302		    
14303		   	
14304		   });
14305		   
14306	   }
14307
14308}
14309
14310infiniteScrollInit();
14311
14312function destroyInfiniteScroll(){
14313	$('.post-area.infinite_scroll .posts-container').infinitescroll('destroy');
14314	$('.portfolio-items.infinite_scroll').infinitescroll('destroy');
14315}
14316	
14317/*-------------------------------------------------------------------------*/
14318/*	6.	Scroll to top
14319/*-------------------------------------------------------------------------*/	
14320
14321var $scrollTop = $(window).scrollTop();
14322
14323//starting bind
14324function toTopBind() {
14325	if( $('#to-top').length > 0 && $(window).width() > 1020 || $('#to-top').length > 0 &&  $('#to-top.mobile-enabled').length > 0 ) {
14326		
14327		if($scrollTop > 350){
14328			$(window).on('scroll',hideToTop);
14329		}
14330		else {
14331			$(window).on('scroll',showToTop);
14332		}
14333	}
14334}
14335
14336if($('.nectar-social-sharing-fixed').length == 0) {
14337	toTopBind();
14338} else {
14339	if($(window).width() < 1000 && $('body.single').length > 0) {
14340		if($scrollTop > 150){
14341			$(window).on('scroll',hideFixedSharing);
14342		}
14343		else {
14344			$(window).on('scroll',showFixedSharing);
14345		}
14346	}
14347
14348	$(window).smartresize(function(){
14349		if($(window).width() > 1000) { 
14350			$('.nectar-social-sharing-fixed').addClass('visible');
14351		}	
14352		else if($scrollTop < 150) { 
14353			$(window).off('scroll',hideFixedSharing);
14354			$(window).on('scroll',showFixedSharing);
14355			$('.nectar-social-sharing-fixed').removeClass('visible');	
14356		} else {
14357			$(window).off('scroll',showFixedSharing);
14358			$(window).on('scroll',hideFixedSharing);
14359		}
14360	});
14361}
14362
14363function showFixedSharing(){
14364	
14365  $scrollTop = $(window).scrollTop();
14366	if( $scrollTop > 150){
14367
14368		$('.nectar-social-sharing-fixed').addClass('visible');	
14369		
14370		$(window).off('scroll',showFixedSharing);
14371		$(window).on('scroll',hideFixedSharing);
14372	}
14373
14374}
14375
14376function hideFixedSharing(){
14377  
14378	$scrollTop = $(window).scrollTop();
14379	if( $scrollTop < 150){
14380
14381		$('.nectar-social-sharing-fixed').removeClass('visible');	
14382		
14383		$(window).off('scroll',hideFixedSharing);
14384		$(window).on('scroll',showFixedSharing);
14385	}
14386
14387}
14388
14389
14390
14391function showToTop(){
14392
14393	if( nectarDOMInfo.scrollTop > 350 && $('#slide-out-widget-area.fullscreen.open').length == 0){
14394
14395		$('#to-top').stop().transition({
14396			'bottom' : '17px'
14397		},350,'easeInOutCubic');	
14398		
14399		$(window).off('scroll',showToTop);
14400		$(window).on('scroll',hideToTop);
14401	}
14402
14403}
14404
14405function hideToTop(){
14406	
14407	if( nectarDOMInfo.scrollTop < 350 || $('#slide-out-widget-area.fullscreen.open').length > 0){
14408
14409		var $animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350;
14410
14411		$('#to-top').stop().transition({
14412			'bottom' : '-30px'
14413		},$animationTiming,'easeInOutQuint');	
14414		
14415		$(window).off('scroll',hideToTop);
14416		$(window).on('scroll',showToTop);	
14417		
14418	}
14419}
14420
14421
14422//to top color
14423if( $('#to-top').length > 0 ) {
14424	
14425	var $windowHeight, $pageHeight, $footerHeight, $ctaHeight;
14426	
14427	function calcToTopColor(){
14428		$scrollTop = $(window).scrollTop();
14429		$windowHeight = $(window).height();
14430		$pageHeight = $('body').height();
14431		$footerHeight = $('#footer-outer').height();
14432		$ctaHeight = ($('#call-to-action').length > 0) ? $('#call-to-action').height() : 0;
14433		
14434		if( ($scrollTop-35 + $windowHeight) >= ($pageHeight - $footerHeight) && $('#boxed').length == 0){
14435			$('#to-top').addClass('dark');
14436		}
14437		
14438		else {
14439			$('#to-top').removeClass('dark');
14440		}
14441	}
14442	
14443	if(!nectarDOMInfo.usingMobileBrowser) {
14444		//calc on scroll
14445		$(window).scroll(calcToTopColor);
14446		
14447		//calc on resize
14448		$(window).resize(calcToTopColor);
14449	}
14450
14451}
14452
14453//alt style
14454if($('body[data-button-style*="rounded"]').length > 0){
14455	var $clone = $('#to-top .fa-angle-up').clone();
14456	$clone.addClass('top-icon');
14457	$('#to-top').prepend($clone)
14458}
14459
14460//scroll up event
14461$('body').on('click','#to-top, a[href="#top"]',function(){
14462	$('body,html').stop().animate({
14463		scrollTop:0
14464	},800,'easeOutQuad',function(){
14465		if($('.nectar-box-roll').length > 0) {
14466			$('body').trigger('mousewheel', [1, 0, 0]);
14467		}
14468	})
14469	return false;
14470});
14471
14472
14473/* one page scrolling */
14474function scrollSpyInit(){ 
14475
14476	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
14477
14478	if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; }
14479
14480	//prevent jump to rop on empty items
14481	$('header#top .sf-menu li a[href="#"]').on('click',function(e){
14482		e.preventDefault();
14483	});
14484	
14485	if( $('#nectar_fullscreen_rows').length == 0 || $disableFPonMobile == 'on') {
14486
14487		$('a.nectar-next-section').each(function(){
14488			
14489			if($(this).parents('.wpb_row:not(.inner_row)').length > 0) {
14490				
14491				var $parentRow = $(this).parents('.wpb_row:not(.inner_row)');
14492				var $parentRowIndex = $(this).parents('.wpb_row:not(.inner_row)').index();
14493				
14494				if($parentRow.parent().find('> .wpb_row[id]:eq('+($parentRowIndex+1)+')').length > 0) {
14495					var $nextRowID = $parentRow.parent().find('> .wpb_row:eq('+($parentRowIndex+1)+')').attr('id');
14496					$(this).attr('href', '#' + $nextRowID);
14497				} 
14498				
14499			}
14500			
14501		});
14502	} else if( $().fullpage ) {
14503			$('a.nectar-next-section').on('click',function(){
14504				$.fn.fullpage.moveSectionDown();
14505				return false;
14506			});
14507	}
14508
14509	//remove full page URLs from hash if located on same page to fix current menu class
14510	//if(location.pathname.length > 1) {
14511	
14512	  //ocm
14513		if($('#slide-out-widget-area .off-canvas-menu-container').length > 0) {
14514			$('#slide-out-widget-area .off-canvas-menu-container').find("a[href*='" + location.pathname + "']").each(function(){
14515					
14516					var $href = $(this).attr('href');
14517
14518					//regular animated anchors
14519					if($href != '#' && $href.indexOf("#") != -1 && $('div'+$href.substr($href.indexOf("#"))).length > 0 ) {
14520						$(this).attr('href',$href.substr($href.indexOf("#")));
14521						$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
14522					}
14523					
14524					//fullpage is a little different
14525					if($('div[data-fullscreen-anchor-id="'+$href.substr($href.indexOf("#")+1)+'"]').length > 0) {
14526						$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
14527					}
14528					
14529			});
14530		}
14531		
14532	  //header
14533		$("#header-outer").find("a[href*='" + location.pathname + "']").each(function(){
14534			var $href = $(this).attr('href');
14535
14536			//regular animated anchors
14537			if($href.indexOf("#") != -1 && $('div'+$href.substr($href.indexOf("#"))).length > 0 ) {
14538
14539				$(this).attr('href',$href.substr($href.indexOf("#")));
14540				$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
14541			}
14542
14543			//fullpage is a little different
14544			if($('div[data-fullscreen-anchor-id="'+$href.substr($href.indexOf("#")+1)+'"]').length > 0) {
14545				$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
14546			}
14547
14548		});
14549	//}
14550
14551	var $target = ($('.page-submenu[data-sticky="true"]').length == 0) ? '#header-outer nav': '.page-submenu';
14552	$('body').scrollspy({
14553		target: $target,
14554		offset: $headerNavSpace + nectarDOMInfo.adminBarHeight + 40
14555	});
14556
14557}
14558
14559
14560/*helper function to scroll the page in an animated manner*/
14561function nectar_scrollToY(scrollTargetY, speed, easing) {
14562
14563		var scrollY = window.scrollY || document.documentElement.scrollTop,
14564				scrollTargetY = scrollTargetY || 0,
14565				speed = speed || 2000,
14566				easing = easing || 'easeOutSine',
14567				currentTime = 0;
14568
14569		var time = Math.max(.1, Math.min(Math.abs(scrollY - scrollTargetY) / speed, .8));
14570
14571
14572		var easingEquations = {
14573						easeInOutQuint: function (pos) {
14574								if ((pos /= 0.5) < 1) {
14575										return 0.5 * Math.pow(pos, 5);
14576								}
14577								return 0.5 * (Math.pow((pos - 2), 5) + 2);
14578						}
14579				};
14580
14581
14582		function tick() {
14583				currentTime += 1 / 60;
14584
14585				var p = currentTime / time;
14586				var t = easingEquations[easing](p);
14587
14588				if (p < 1) {
14589						requestAnimationFrame(tick);
14590
14591						window.scrollTo(0, scrollY + ((scrollTargetY - scrollY) * t));
14592				} else {
14593						window.scrollTo(0, scrollTargetY);
14594				}
14595		}
14596
14597		tick();
14598}
14599
14600
14601function pageLoadHash() {
14602
14603	var $hash = window.location.hash;
14604	
14605	var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1,$hash.length) : 0;
14606
14607	//if hash has slashes 
14608	var $hasSlashLength = 0;
14609	if($hashSubstrng) {
14610		$hasSlashLength = $hashSubstrng.split("/");
14611		$hasSlashLength = $hasSlashLength.length;
14612	}
14613	
14614	if($hashSubstrng && $hasSlashLength > 1 ) { 
14615		$hashSubstrng = $hashSubstrng.replace(/\//g, ""); 
14616		$hash = $hash.replace(/\//g, ""); 
14617	}
14618
14619	if($hash && $('.main-content').find($hash).length > 0 || $hash && $('.main-content').find('[data-fullscreen-anchor-id="'+$hashSubstrng+'"]').length > 0) {
14620
14621		var $hashObj = ($('.main-content').find($hash).length > 0) ? $('.main-content').find($hash) : $('.main-content').find('[data-fullscreen-anchor-id="'+$hashSubstrng+'"]');
14622
14623		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').outerHeight();
14624		if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; }
14625
14626		$timeoutVar = 0;
14627		if($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
14628			boxRoll(null,-1);
14629			$timeoutVar = 2050;
14630		} 
14631		setTimeout(function(){
14632		
14633			if( $('body[data-permanent-transparent="1"]').length == 0 ) {
14634				
14635				if(!$('body').hasClass('mobile')){
14636					$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
14637					if($('#header-outer[data-remove-fixed="1"]').length > 0) { 
14638						$headerNavSpace = 0;
14639					}
14640					var $scrollTopDistance =  $hashObj.offset().top - parseInt($headerNavSpace) +$resize + 3 - nectarDOMInfo.adminBarHeight;
14641					
14642					
14643					
14644					//condesne
14645					if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
14646						
14647							var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
14648							var $secondaryHeader = $('#header-secondary-outer');
14649							var $headerHeightStored = $('#header-outer').height();
14650							
14651							$headerHeightCondensed = $headerHeightStored - ( parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top')) );
14652						
14653							$scrollTopDistance =  $hashObj.offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight;
14654					}
14655						
14656					
14657					
14658				} else {
14659					var $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $hashObj.offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1;	
14660				}
14661
14662			} else {
14663				var $scrollTopDistance = $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1;
14664			}
14665
14666			if($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
14667				//alter offset 
14668				if($('#header-outer.detached').length == 0) 
14669					$scrollTopDistance = $scrollTopDistance + $headerNavSpace;
14670			}
14671
14672			var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0;
14673			
14674			if($('body.material').length > 0 && 
14675				 $('#header-secondary-outer').length > 0 &&
14676				 $('body[data-hhun="1"]').length == 0 && 
14677				 $('#header-outer[data-remove-fixed="1"]').length == 0 && 
14678				 !$('body').hasClass('mobile')) { 
14679					 
14680					 var $headerSecondary = $('#header-secondary-outer').height();
14681					 
14682			 } else {
14683					 var $headerSecondary = 0;
14684			 }
14685			 
14686			nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint');
14687
14688		},$timeoutVar);
14689	}
14690}
14691
14692if($('body[data-animated-anchors="true"]').length > 0 || $('.single-product [data-gallery-style="left_thumb_sticky"]').length > 0) { 
14693
14694
14695+ function(t) {
14696    "use strict";
14697
14698    function s(e, i) {
14699        var r = t.proxy(this.process, this);
14700        this.$body = t("body"), this.$scrollElement = t(t(e).is("body") ? window : e), this.options = t.extend({}, s.DEFAULTS, i), this.selector = (this.options.target || "") + " ul li > a", this.offsets = [], this.targets = [], this.activeTarget = null, this.scrollHeight = 0, this.$scrollElement.on("scroll.bs.scrollspy", r), this.refresh(), this.process()
14701    }
14702
14703    function e(e) {
14704        return this.each(function() {
14705            var i = t(this),
14706                r = i.data("bs.scrollspy"),
14707                o = "object" == typeof e && e;
14708            r || i.data("bs.scrollspy", r = new s(this, o)), "string" == typeof e && r[e]()
14709        })
14710    }
14711    s.VERSION = "3.2.0", s.DEFAULTS = {
14712        offset: 10
14713    }, s.prototype.getScrollHeight = function() {
14714        return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
14715    }, s.prototype.refresh = function() {
14716        var s = "offset",
14717            e = 0;
14718        t.isWindow(this.$scrollElement[0]) || (s = "position", e = this.$scrollElement.scrollTop()), this.offsets = [], this.targets = [], this.scrollHeight = this.getScrollHeight();
14719        var i = this;
14720        this.$body.find(this.selector).map(function() {
14721            var i = t(this),
14722                r = i.data("target") || i.attr("href"),
14723                o = /^#./.test(r) && t(r);
14724            return o && o.length && o.is(":visible") && [
14725                [o[s]().top + e, r]
14726            ] || null
14727        }).sort(function(t, s) {
14728            return t[0] - s[0]
14729        }).each(function() {
14730            i.offsets.push(this[0]), i.targets.push(this[1])
14731        })
14732    }, s.prototype.process = function() {
14733    	var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0 && $('body[data-hhun="1"]').length == 0 || $('.page-submenu[data-sticky="true"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0 ) ? $('.page-submenu').height() : 0;
14734
14735        var t, s = this.$scrollElement.scrollTop() + this.options.offset + $pageSubMenu,
14736            e = this.getScrollHeight(),
14737            i = this.options.offset + e - this.$scrollElement.height() -$pageSubMenu,
14738            r = this.offsets,
14739            o = this.targets,
14740            l = this.activeTarget;
14741        if (this.scrollHeight != e && this.refresh(), s >= i) return l != (t = o[o.length - 1]) && this.activate(t);
14742        if (l && s <= r[0]) return l != (t = o[0]) && this.activate(t);
14743        for (t = r.length; t--;) l != o[t] && s >= r[t] && (!r[t + 1] || s <= r[t + 1]) && this.activate(o[t])
14744    }, s.prototype.activate = function(s) {
14745        this.activeTarget = s, t(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover');
14746        var e = this.selector + '[data-target="' + s + '"],' + this.selector + '[href="' + s + '"]',
14747            i = t(e).parents("li").addClass("current-menu-item");
14748        i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("current-menu-item")), i.trigger("activate.bs.scrollspy")
14749    };
14750    var i = t.fn.scrollspy;
14751    t.fn.scrollspy = e, t.fn.scrollspy.Constructor = s, t.fn.scrollspy.noConflict = function() {
14752        return t.fn.scrollspy = i, this
14753    }
14754}(jQuery);
14755
14756
14757var shrinkNum = 6;	
14758if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
14759headerPadding2 = headerPadding - headerPadding/1.8;
14760
14761setTimeout(scrollSpyInit,200);
14762
14763var $animatedScrollingTimeout;
14764
14765$('body').on('click','#header-outer nav .sf-menu a, #footer-outer .nectar-button, .container-wrap a:not(.wpb_tabs_nav a):not(.magnific):not([data-fancybox]):not(.woocommerce-tabs a):not(.testimonial-next-prev a), .swiper-slide .button a, #slide-out-widget-area a, #mobile-menu .container ul li a, #slide-out-widget-area .inner div a',function(e){
14766	
14767
14768
14769	var $hash = $(this).prop("hash");	
14770
14771	$('body').addClass('animated-scrolling');
14772	clearTimeout($animatedScrollingTimeout);
14773	$animatedScrollingTimeout = setTimeout(function(){ $('body').removeClass('animated-scrolling'); },850);
14774	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').outerHeight();
14775	if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; }
14776
14777	if($hash && $('body').find($hash).length > 0 && $hash != '#top' && $hash != '' && $(this).attr('href').indexOf(window.location.href.split("#")[0]) !== -1 || $(this).is('[href^="#"]') && $hash != '' && $('body').find($hash).length > 0 && $hash != '#top') {
14778
14779
14780		//update hash
14781		if(!$(this).hasClass('skip-hash')) {
14782			if(history.pushState) {
14783			    history.pushState(null, null, $hash);
14784			}
14785			else {
14786			    location.hash = $hash;
14787			}
14788		}
14789
14790		if($(this).parents('ul').length > 0) { 
14791			$(this).parents('ul').find('li').removeClass('current-menu-item');
14792		}
14793
14794		//side widget area click
14795		if($(this).parents('#slide-out-widget-area').length > 0){
14796			
14797			if($('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) {
14798				$('body > .slide_out_area_close').addClass('non-human-allowed').trigger('click');
14799				//scroll
14800				var $clickedLinkStore = $(this);
14801				setTimeout(function(){
14802					$clickedLinkStore.trigger('click');
14803				},1000);
14804				
14805			} else {
14806				$('#slide-out-widget-area .slide_out_area_close').addClass('non-human-allowed').trigger('click');
14807			}
14808			
14809			setTimeout(function(){
14810				if($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) {
14811					$('body > .slide_out_area_close').removeClass('non-human-allowed');
14812
14813				} else {
14814					$('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed');
14815				}
14816			},100);
14817		}
14818
14819		//mobile menu click
14820		if($(this).parents('#mobile-menu').length > 0) $('#toggle-nav').trigger('click');
14821		var $mobileMenuHeight = ($(this).parents('#mobile-menu').length > 0) ? $(this).parents('#mobile-menu').height() : null;
14822		
14823		$timeoutVar = 1;
14824		if($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
14825			boxRoll(null,-1);
14826			$timeoutVar = 2050;
14827		} 
14828
14829		var $that = $(this);
14830
14831		setTimeout(function(){
14832
14833			//scrolling
14834			var $headerSpace = ($('body[data-permanent-transparent="1"]').length > 0) ? 0 : parseInt($headerNavSpace);
14835			
14836			if( $('body[data-permanent-transparent="1"]').length == 0 ) {
14837				
14838				if(!$('body').hasClass('mobile')){
14839					$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
14840					if($('#header-outer[data-remove-fixed="1"]').length > 0) { 
14841						$headerNavSpace = 0;
14842					}
14843					
14844					var $scrollTopDistance =  $($hash).offset().top - $mobileMenuHeight - parseInt($headerNavSpace) +$resize + 3 - nectarDOMInfo.adminBarHeight;
14845					
14846					
14847					//condesne
14848					if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
14849							var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
14850							var $secondaryHeader = $('#header-secondary-outer');
14851							var $headerHeightStored = $('#header-outer').height();
14852							
14853							$headerHeightCondensed = $headerHeightStored - ( parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top')) );
14854						
14855							$scrollTopDistance =  $($hash).offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight;
14856					}
14857					
14858					
14859				} else {
14860					var $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $($hash).offset().top - $mobileMenuHeight - nectarDOMInfo.adminBarHeight + 1;	
14861				}
14862
14863			} else {
14864				var $scrollTopDistance = $($hash).offset().top - nectarDOMInfo.adminBarHeight + 1;
14865			}
14866
14867			if($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
14868				//alter offset 
14869				if($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) 
14870					$scrollTopDistance = $scrollTopDistance + $headerNavSpace;
14871
14872				//hide top header
14873				if($that.parents('.page-submenu[data-sticky="true"]').length > 0) { 
14874					$('#header-outer.detached').addClass('invisible');
14875					$('.page-submenu').addClass('header-not-visible').css('transform','translateY(0px)');
14876				}
14877			} 
14878
14879			var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0;
14880			
14881			 if($('body.material').length > 0 && 
14882			 		$('#header-secondary-outer').length > 0 &&
14883			    $('body[data-hhun="1"]').length == 0 && 
14884			    $('#header-outer[data-remove-fixed="1"]').length == 0 && 
14885					!$('body').hasClass('mobile')) { 
14886						
14887						var $headerSecondary = $('#header-secondary-outer').height();
14888						
14889				} else {
14890						var $headerSecondary = 0;
14891				}
14892
14893			nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint');
14894			
14895
14896		},$timeoutVar);
14897		
14898
14899		e.preventDefault();
14900
14901	}
14902
14903	if($hash == '#top') {
14904		//side widget area click
14905		if($(this).parents('#slide-out-widget-area').length > 0){
14906			$('#slide-out-widget-area .slide_out_area_close').trigger('click');
14907		}
14908	}
14909
14910
14911});
14912
14913
14914
14915}
14916
14917
14918
14919
14920function searchResultMasonry() {
14921	var $searchContainer = $('#search-results');
14922	var $dividerNum = ($searchContainer.is('[data-layout="masonry-no-sidebar"]')) ? 4 : 3;
14923	
14924	$searchContainer.imagesLoaded(function(){
14925		
14926		$searchContainer.isotope({
14927			 itemSelector: '.result',
14928			 layoutMode: 'packery',
14929			 packery: { columnWidth: $('#search-results').width() / $dividerNum }
14930		});
14931		
14932		$searchContainer.find('article').css('opacity','1');
14933		
14934	});
14935				
14936
14937	$(window).resize(function(){
14938		 $searchContainer.isotope({
14939				layoutMode: 'packery',
14940				packery: { columnWidth: $('#search-results').width() / $dividerNum }
14941		 });
14942	});
14943	
14944}
14945
14946if($('body.search-results').length > 0 && $('#search-results article').length > 0 && $('#search-results[data-layout="list-no-sidebar"]').length == 0) { searchResultMasonry(); }
14947
14948
14949
14950	//portfolio colors
14951	if($('.portfolio-items .col .style-3-alt').length > 0 || $('.portfolio-items .col .style-3').length > 0 || $('.portfolio-items .col .style-2').length > 0 || $('.portfolio-items .col .style-5').length > 0 ) {
14952		var portfolioColorCss = '';
14953		$('.portfolio-items .col').each(function(){
14954			var $titleColor = $(this).attr('data-title-color');
14955			var $subTitleColor = $(this).attr('data-subtitle-color');
14956
14957			 if($titleColor.length > 0 ) { 
14958			 	portfolioColorCss += '.col[data-title-color="'+$titleColor+'"] .vert-center h3, .portfolio-items[data-ps="6"] .col[data-title-color="'+$titleColor+'"] .work-meta h4 { color: '+$titleColor+'!important; } ';
14959			 	portfolioColorCss += ' .portfolio-items[data-ps="8"] .col[data-title-color="'+$titleColor+'"] .line { background-color: '+$titleColor+'; }';
14960			 	portfolioColorCss += '.portfolio-items[data-ps="8"] .col[data-title-color="'+$titleColor+'"] .next-arrow line { stroke: '+$titleColor+'; } ';
14961			 }
14962			 if($subTitleColor.length > 0 ) portfolioColorCss += '.col[data-subtitle-color="'+$subTitleColor+'"] .vert-center p, .portfolio-items[data-ps="6"] .col[data-title-color="'+$titleColor+'"] .work-meta p { color: '+$subTitleColor+'; } ';
14963	
14964		});
14965
14966
14967		var head = document.head || document.getElementsByTagName('head')[0];
14968		var style = document.createElement('style');
14969
14970			style.type = 'text/css';
14971		if (style.styleSheet){
14972		  style.styleSheet.cssText = portfolioColorCss;
14973		} else {
14974		  style.appendChild(document.createTextNode(portfolioColorCss));
14975		}
14976
14977		head.appendChild(style);
14978	}
14979
14980	//bottom controls 2
14981	$('body').on('mouseleave','.container-wrap[data-nav-pos="after_project_2"] #portfolio-nav ul li, .blog_next_prev_buttons[data-style="fullwidth_next_prev"] ul li',function(){
14982		$(this).addClass('mouse-leaving');
14983	});	
14984
14985	// masonryPortfolio
14986
14987	var $portfolio_containers = [];
14988
14989	$('.portfolio-items:not(.carousel)').each(function(i){
14990		$portfolio_containers[i] = $(this);
14991	});
14992
14993	function masonryPortfolioInit() {
14994
14995		$portfolio_containers = [];
14996		$('.portfolio-items:not(.carousel)').each(function(i){
14997			$portfolio_containers[i] = $(this);
14998		});
14999
15000		//// cache window
15001		var $window = jQuery(window);	
15002		
15003			
15004			$.each($portfolio_containers,function(i){
15005
15006				
15007				//// start up isotope with default settings
15008				$portfolio_containers[i].imagesLoaded(function(){
15009					
15010					//verify smooth scorlling
15011					if( $smoothCache == true && $(window).width() > 690 && $('body').outerHeight(true) > $(window).height() && Modernizr.csstransforms3d && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){ niceScrollInit(); $(window).trigger('resize') } 
15012					
15013					//transformns enabled logic
15014					var $isoUseTransforms = true;
15015					
15016					//Panr 
15017					if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
15018
15019						$isoUseTransforms = true;
15020						
15021					}
15022
15023					piVertCenter();
15024
15025					//initial call to setup isotope
15026					var $layoutMode = ( $portfolio_containers[i].hasClass('masonry-items')) ? 'packery' : 'fitRows';
15027					var $startingFilter = ($portfolio_containers[i].attr('data-starting-filter') != '' && $portfolio_containers[i].attr('data-starting-filter') != 'default') ? '.' + $portfolio_containers[i].attr('data-starting-filter') : '*';
15028
15029					reLayout();
15030					
15031					$portfolio_containers[i].addClass('isotope-activated');
15032					
15033					$portfolio_containers[i].isotope({
15034					  itemSelector : '.element',
15035					  filter: $startingFilter,
15036					  layoutMode: $layoutMode,
15037					  transitionDuration: '0.6s',
15038					  packery: {
15039						 gutter: 0
15040					  }
15041					}).isotope( 'layout' );
15042					
15043					
15044					if($startingFilter != '*'){
15045						$('.portfolio-filters ul a[data-filter="'+$startingFilter+'"], .portfolio-filters-inline ul a[data-filter="'+$startingFilter+'"]').click();
15046					}
15047
15048					//call the reLayout to get things rollin'
15049					masonryZindex();
15050					setTimeout(function(){masonryZindex(); },800);
15051					
15052				
15053					
15054					//inside fwc fix
15055					if($portfolio_containers[i].parents('.full-width-content').length > 0) { setTimeout(function(){ fullWidthContentColumns(); },200);  }
15056
15057					//fadeout the loading animation
15058					$('.portfolio-loading').stop(true,true).fadeOut(200);
15059					
15060					//fadeIn items one by one
15061					if($portfolio_containers[i].find('.inner-wrap').attr('data-animation') == 'none') {
15062						$portfolio_containers[i].find('.inner-wrap').removeClass('animated');
15063					} 
15064
15065			
15066				});
15067				
15068
15069
15070			});//each
15071			
15072			if($portfolio_containers.length > 0) {
15073				$window.resize( reLayout );
15074
15075				$window.smartresize( function(){
15076					setTimeout(masonryZindex,700);
15077				});
15078			}
15079			
15080		
15081
15082	}
15083
15084	masonryPortfolioInit();
15085
15086	function portfolioLoadIn() {
15087
15088		$($fullscreenSelector+'.portfolio-items').each(function(){
15089
15090			var $portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%';
15091
15092			if($(this).find('.inner-wrap').attr('data-animation') == 'none') return;
15093		
15094			$(this).find('.col').each(function(i){
15095
15096				var $that = $(this);
15097
15098				//loaded visible
15099				if($(this).visible(true) || $(this).parents('#nectar_fullscreen_rows').length > 0) {
15100
15101					var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 90 : 115;
15102					$(this).delay($portfolioAnimationDelay *i).queue(function(next){
15103					    $(this).addClass("animated-in");
15104					    next();
15105					});
15106
15107				} else {
15108
15109					//not already visible
15110					var waypoint = new Waypoint({
15111		 			element: $that,
15112		 			 handler: function(direction) {
15113						
15114						if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
15115						     waypoint.destroy();
15116						     return;
15117						}
15118
15119						var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 100;
15120					
15121						setTimeout(function(){
15122							$that.addClass("animated-in");
15123						},$portfolioAnimationDelay * $that.attr('data-delay-amount'));
15124					
15125						
15126						waypoint.destroy();
15127					},
15128					offset: $portfolioOffsetPos
15129
15130					}); //waypoint
15131				}
15132
15133			}); //each
15134		}); //each
15135					
15136	}
15137
15138
15139	//perspective load in
15140	if($('.portfolio-items .inner-wrap[data-animation="perspective"]').length > 0 || $('.posts-container[data-load-animation="perspective"]').length > 0) {
15141
15142		var lastScrollTop = $(window).scrollTop();
15143
15144		$('.portfolio-items, .posts-container[data-load-animation="perspective"]').css('perspective-origin','50% '+ (lastScrollTop + $(window).height()) + 'px');
15145
15146		requestAnimationFrame(updatePerspectiveOrigin);
15147		
15148		function updatePerspectiveOrigin() {
15149
15150			var scrollTop = $(window).scrollTop();
15151
15152			if (lastScrollTop === scrollTop) {
15153				requestAnimationFrame(updatePerspectiveOrigin);
15154				return;
15155			} else {
15156				lastScrollTop = scrollTop;
15157				$('.portfolio-items,.posts-container[data-load-animation="perspective"]').css('perspective-origin','50% '+ (lastScrollTop + $(window).height()) + 'px');
15158				requestAnimationFrame(updatePerspectiveOrigin);
15159			}
15160		}
15161
15162	}
15163
15164	var mediaQuerySize;
15165	function reLayout() {
15166
15167		clearTimeout(clearIsoAnimation);
15168	    $('.portfolio-items .col').addClass('no-transition');
15169	    clearIsoAnimation = setTimeout(function(){  $('.portfolio-items .col').removeClass('no-transition'); },700); 
15170
15171		var windowSize = $window.width();
15172		var masonryObj;
15173		var masonryObjHolder = [];
15174
15175
15176		//user defined cols
15177		var userDefinedColWidth;
15178
15179		$.each($portfolio_containers,function(i,v){
15180
15181			if( $portfolio_containers[i].attr('data-user-defined-cols') == 'span4') {
15182				userDefinedColWidth = 3
15183			} 
15184			
15185			else if( $portfolio_containers[i].attr('data-user-defined-cols') == 'span3') {
15186				userDefinedColWidth = 4
15187			} 
15188			
15189			var isFullWidth = $portfolio_containers[i].attr('data-col-num') == 'elastic';
15190			
15191			
15192			//chrome 33 approved method for getting column sizing
15193			if(window.innerWidth > 1600){
15194				
15195				if($portfolio_containers[i].hasClass('fullwidth-constrained')) {
15196					if($portfolio_containers[i].is('[data-masonry-type="photography"]')) {
15197						mediaQuerySize = 'three';
15198					} else {
15199						mediaQuerySize = 'four';
15200					}
15201	
15202				} else {
15203					if($portfolio_containers[i].hasClass('constrain-max-cols')) {
15204						mediaQuerySize = 'four';
15205					} else {
15206						mediaQuerySize = 'five';
15207					}
15208				}
15209				
15210			} else if(window.innerWidth <= 1600 && window.innerWidth > 1300){
15211
15212				if($portfolio_containers[i].hasClass('fullwidth-constrained')) {
15213					if($portfolio_containers[i].is('[data-masonry-type="photography"]')) {
15214						mediaQuerySize = 'three';
15215					} else {
15216						mediaQuerySize = 'four';
15217					}
15218				} else {
15219					mediaQuerySize = 'four';
15220				}
15221			} else if(window.innerWidth <= 1300 && window.innerWidth > 990){
15222				
15223				if($portfolio_containers[i].hasClass('constrain-max-cols')) {
15224					mediaQuerySize = 'four';
15225				} else {
15226					mediaQuerySize = 'three';
15227				}
15228				
15229			} else if(window.innerWidth <= 990 && window.innerWidth > 470){
15230				mediaQuerySize = 'two';
15231			} else if(window.innerWidth <= 470){
15232				mediaQuerySize = 'one';
15233			}
15234			
15235			//boxed
15236			if($('#boxed').length > 0) {
15237				if(window.innerWidth > 1300){
15238					mediaQuerySize = 'four';
15239				} else if(window.innerWidth < 1300 && window.innerWidth > 990){
15240					
15241					if($portfolio_containers[i].hasClass('constrain-max-cols')) {
15242						mediaQuerySize = 'four';
15243					} else {
15244						mediaQuerySize = 'three';
15245					}
15246
15247				} else if(window.innerWidth < 990){
15248					mediaQuerySize = 'one';
15249				}
15250				
15251			}
15252			
15253			//change masonry columns depending on screen size
15254			var colWidth;
15255			
15256			switch (mediaQuerySize) {
15257				case 'five':
15258					(isFullWidth) ? colWidth = 5 : colWidth = userDefinedColWidth;
15259					//change cols for photography
15260					if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]')) colWidth = 6;
15261
15262					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
15263				break;
15264				
15265				case 'four':
15266					(isFullWidth) ? colWidth = 4 : colWidth = userDefinedColWidth;
15267					//change cols for photography
15268					if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]')) colWidth = 5;
15269
15270					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
15271				break;
15272				
15273				case 'three':
15274					(isFullWidth) ? colWidth = 3 : colWidth = userDefinedColWidth;
15275					//change cols for photography
15276					if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]')) colWidth = 4;
15277					
15278					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
15279				break;
15280				
15281				case 'two':
15282					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / 2) };
15283				break;
15284				
15285				case 'one':
15286					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / 1) };
15287				break;
15288			}
15289
15290
15291			 //set widths
15292			 portfolioItemWidths(i,v);
15293			
15294
15295			//sizing for large items
15296			if(!$portfolio_containers[i].is('[data-bypass-cropping="true"]')) {
15297				
15298				if( $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="regular"]:visible').length > 0 || $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="wide"]:visible').length > 0 || $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="tall"]:visible').length > 0 || $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="wide_tall"]:visible').length > 0) {
15299
15300					var $gutterSize = ($portfolio_containers[i].is('[data-gutter*="px"]') && $portfolio_containers[i].attr('data-gutter').length > 0 && $portfolio_containers[i].attr('data-gutter') != 'none') ? parseInt($portfolio_containers[i].attr('data-gutter')) : 0;
15301					var multipler = (window.innerWidth > 470) ? 2 : 1;
15302
15303					//reset height for calcs
15304					$itemClassForSizing = 'regular';
15305
15306					if($portfolio_containers[i].find('.col.elastic-portfolio-item[class*="regular"]:visible').length == 0 && $portfolio_containers[i].find('.col.elastic-portfolio-item.wide:visible').length > 0) {
15307						$itemClassForSizing = 'wide';
15308					} else if($portfolio_containers[i].find('.col.elastic-portfolio-item[class*="regular"]:visible').length == 0 && $portfolio_containers[i].find('.col.elastic-portfolio-item.wide_tall:visible').length > 0) {
15309						$itemClassForSizing = 'wide_tall';
15310						multipler = 1;
15311					} else if($portfolio_containers[i].find('.col.elastic-portfolio-item[class*="regular"]:visible').length == 0 && $portfolio_containers[i].find('.col.elastic-portfolio-item.tall:visible').length > 0) {
15312						$itemClassForSizing = 'tall';
15313						multipler = 1;
15314					}
15315
15316				    $portfolio_containers[i].find('.col.elastic-portfolio-item.'+$itemClassForSizing+' img').css('height','auto');
15317
15318					var tallColHeight = $portfolio_containers[i].find('.col.elastic-portfolio-item.'+$itemClassForSizing+':visible img').height();
15319					
15320					 $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="tall"] img, .col.elastic-portfolio-item.wide img, .col.elastic-portfolio-item.regular img').removeClass('auto-height');
15321					 $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="tall"] img:not(.custom-thumbnail)').css('height',(tallColHeight*multipler) + ($gutterSize*2));
15322
15323					 if($itemClassForSizing == 'regular' || $itemClassForSizing == 'wide') {
15324					 	$portfolio_containers[i].find('.col.elastic-portfolio-item.wide img:not(.custom-thumbnail), .col.elastic-portfolio-item.regular img:not(.custom-thumbnail)').css('height',tallColHeight);
15325					 } else {
15326					 	$portfolio_containers[i].find('.col.elastic-portfolio-item.wide img:not(.custom-thumbnail), .col.elastic-portfolio-item.regular img:not(.custom-thumbnail)').css('height',(tallColHeight/2) - ($gutterSize*2));
15327					 }
15328
15329					 $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="tall"] .parallaxImg').css('height',(tallColHeight*multipler) + parseInt($portfolio_containers[i].find('.col.elastic-portfolio-item').css('padding-bottom'))*2 );
15330					 
15331					 if($itemClassForSizing == 'regular' || $itemClassForSizing == 'wide') {
15332						 $portfolio_containers[i].find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',tallColHeight);
15333					} else {
15334					 	 $portfolio_containers[i].find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',(tallColHeight/2) - ($gutterSize*2));
15335					 }
15336
15337				} else {
15338					$portfolio_containers[i].find('.col.elastic-portfolio-item[class*="tall"] img, .col.elastic-portfolio-item.wide img, .col.elastic-portfolio-item.regular img').addClass('auto-height');
15339				}
15340			
15341			} //bypass cropping option
15342
15343			//non masonry
15344			if($portfolio_containers[i].hasClass('no-masonry') && $portfolio_containers[i].find('.col:first:visible').length > 0 && $portfolio_containers[i].parents('.wpb_gallery').length == 0){
15345			  
15346				//skip style 9
15347				if( !$portfolio_containers[i].is('[data-ps="9"]') && !$portfolio_containers[i].is('[data-bypass-cropping="true"]') ) {
15348
15349				   	//reset height for calcs
15350			   	   $portfolio_containers[i].find('.col img').css('height','auto');
15351			   	   var tallColHeight = $portfolio_containers[i].find('.col:first:visible img').height();
15352			   	   $portfolio_containers[i].find('.col img:not(.custom-thumbnail)').css('height',tallColHeight);
15353			   	   $portfolio_containers[i].find('.col .parallaxImg').css('height',tallColHeight);
15354				 }
15355				 
15356			}
15357	
15358
15359
15360			masonryObjHolder[i] = masonryObj;
15361			
15362			if($portfolio_containers[i].isotope()) $portfolio_containers[i].isotope( 'layout' ); 
15363				
15364			
15365
15366		}); //each
15367	
15368	}
15369
15370	function portfolioItemWidths(i,v) {
15371		// passing each index value where function is called first to avoid nested loops
15372
15373		 		var isFullWidth = $portfolio_containers[i].attr('data-col-num') == 'elastic';
15374
15375		 		if(isFullWidth) { 
15376
15377				 	var $colSize = 4;
15378				 	var $mult = (mediaQuerySize == 'one') ? 1 : 2;
15379				 	if(mediaQuerySize == 'five') $colSize = 5;
15380				 	if(mediaQuerySize == 'four') $colSize = 4;
15381				 	if(mediaQuerySize == 'three') $colSize = 3;
15382				 	if(mediaQuerySize == 'two') $colSize = 2;
15383				 	if(mediaQuerySize == 'one') $colSize = 1;
15384				 	if($(v).is('[data-ps="6"]') && $colSize == 5) $colSize = 4;
15385
15386				 	//photography
15387				 	if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]') && !$portfolio_containers[i].hasClass('no-masonry')) {
15388				 		if(mediaQuerySize == 'five') $colSize = 6;
15389				 		if(mediaQuerySize == 'four') $colSize = 5;
15390				 		if(mediaQuerySize == 'three') $colSize = 4;
15391				 	}
15392				 	
15393				 	if($(v).width() % $colSize == 0) {
15394					 	$(v).find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',Math.floor($(v).width()/$colSize) +'px');
15395					 	$(v).find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',Math.floor($(v).width()/$colSize*$mult) +'px');
15396					 } else {
15397					 	var $loopEndNum = ($(window).width() > 1000) ? 6 : 3;
15398					 	if($portfolio_containers[i].hasClass('fullwidth-constrained') && $(window).width() > 1000) $loopEndNum = 4;
15399					 	//find closest number to give 0
15400					 	for(var i = 1; i<$loopEndNum; i++) {
15401
15402					 		if(($(v).width() - i) % $colSize == 0) {
15403					 			$(v).find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',($(v).width()- i)/$colSize +'px');
15404					 			$(v).find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',($(v).width()-i)/$colSize*$mult +'px');
15405					 		}
15406
15407					 	}
15408					 }
15409
15410				} // isFullWidth
15411
15412	}
15413
15414	//z-index for masonry
15415	function masonryZindex(){
15416
15417		//escape if no browser support
15418		if($('body .portfolio-items:not(".carousel") > .col').length > 0 && $('body .portfolio-items:not(".carousel") > .col').offset().left) {
15419
15420			$('body .portfolio-items:not(".carousel")').each(function(){
15421
15422				var $coords = {};
15423				var $zindexRelation = {};
15424				var $that = $(this);
15425
15426				$(this).find('> .col').each(function(){
15427					var $itemOffset = $(this).offset();
15428					$itemOffset = $itemOffset.left;
15429
15430					$coords[$(this).index()] = $itemOffset;
15431					$(this).css('z-index',Math.abs(Math.floor($(this).offset().left/20)));
15432				});
15433
15434				var $corrdsArr = $.map($coords, function (value) { return value; });
15435
15436				$corrdsArr = removeDuplicates($corrdsArr);
15437				$corrdsArr.sort(function(a,b){return a-b});
15438
15439				for(var i = 0; i < $corrdsArr.length; i++){
15440					$zindexRelation[$corrdsArr[i]] = i; 
15441				}
15442		
15443				$.each($coords,function(k,v){
15444					
15445					var $zindex;
15446					var $coordCache = v;
15447					$.each($zindexRelation,function(k,v){
15448						if($coordCache == k) {
15449							$zindex = v;
15450						}
15451					});
15452				
15453					$that.find('> .col:eq('+k+')').attr('data-delay-amount',$zindex);
15454				});
15455
15456				
15457			});
15458			
15459			
15460			
15461		}
15462
15463
15464	}
15465
15466	function blogMasonryZindex(){
15467	
15468		//escape if no browser support
15469		if($('body .post-area .masonry-blog-item').length > 0 && $('body .post-area .masonry-blog-item').offset().left) {
15470		
15471			$('body .post-area.masonry').each(function(){
15472				
15473				var $coords = {};
15474				var $zindexRelation = {};
15475				var $that = $(this);
15476
15477				$(this).find('.masonry-blog-item').each(function(){
15478					var $itemOffset = $(this).offset();
15479					$itemOffset = $itemOffset.left;
15480
15481					$coords[$(this).index()] = $itemOffset;
15482					$(this).css('z-index',Math.abs(Math.floor($(this).offset().left/20)));
15483				});
15484
15485				var $corrdsArr = $.map($coords, function (value) { return value; });
15486
15487				$corrdsArr = removeDuplicates($corrdsArr);
15488				$corrdsArr.sort(function(a,b){return a-b});
15489		
15490				for(var i = 0; i < $corrdsArr.length; i++){
15491					$zindexRelation[$corrdsArr[i]] = i*1; 
15492				}
15493		
15494				$.each($coords,function(k,v){
15495					
15496					var $zindex;
15497					var $coordCache = v;
15498					$.each($zindexRelation,function(k,v){
15499						if($coordCache == k) {
15500							$zindex = v;
15501						}
15502					});
15503		
15504					$that.find('.masonry-blog-item:eq('+k+')').css('z-index',$zindex).attr('data-delay-amount',$zindex);
15505					
15506				});
15507			
15508			});
15509			
15510		}
15511		
15512	}
15513	
15514	function matrixToArray(matrix) {
15515	    return matrix.substr(7, matrix.length - 8).split(', ');
15516	}
15517	
15518	function removeDuplicates(inputArray) {
15519        var i;
15520        var len = inputArray.length;
15521        var outputArray = [];
15522        var temp = {};
15523
15524        for (i = 0; i < len; i++) {
15525            temp[inputArray[i]] = 0;
15526        }
15527        for (i in temp) {
15528            outputArray.push(i);
15529        }
15530        return outputArray;
15531    }
15532
15533    //// filter items when filter link is clicked
15534	var clearIsoAnimation = null;
15535	var $checkForScrollBar = null;
15536
15537
15538	//number portfolios so multiple sortable ones can work easily on same page
15539	$('.portfolio-items:not(".carousel")').each(function(i){
15540		$(this).attr('instance',i);
15541		$(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance',i);
15542	});
15543
15544    function isoClickFilter(){
15545		 var $timeout;		 
15546		 if(window.innerWidth > 690 && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
15547		 	
15548			  
15549			 clearTimeout($timeout);
15550			 $timeout = setTimeout(function(){masonryZindex();  },600);
15551
15552			  
15553		 }
15554		  
15555		  var selector = $(this).attr('data-filter');
15556		  var $instance = $(this).parents('div[class^=portfolio-filters]').attr('instance');
15557
15558		  $.each($portfolio_containers,function(i){
15559		  	if($portfolio_containers[i].attr('instance') == $instance) { 
15560		  		$portfolio_containers[i].isotope({ filter: selector }).attr('data-current-cat',selector);
15561
15562		  		//fade in all incase user hasn't scrolled down yet
15563		  		if($portfolio_containers[i].find('.inner-wrap[data-animation="none"]').length == 0) {
15564			   		$portfolio_containers[i].find('.col').addClass('animated-in');
15565				}
15566		  	}
15567		  });
15568
15569
15570
15571
15572		  //active classes
15573		  $(this).parent().parent().find('li a').removeClass('active');
15574		  $(this).addClass('active');
15575		  
15576		  //update pp
15577		  if($('.portfolio-items a[rel^="prettyPhoto"]').length > 0) {
15578		  	setTimeout(updatePrettyPhotoGallery,170);
15579		  }
15580
15581		  else {
15582		  	setTimeout(updateMagPrettyPhotoGallery,170);
15583		  }
15584
15585		  return false;
15586	}
15587
15588	////filter event
15589	$('body').on('click','.portfolio-filters ul li a, .portfolio-filters-inline ul li a', isoClickFilter);
15590
15591
15592	function updatePrettyPhotoGallery(){
15593		$('.portfolio-items').each(function(){
15594
15595			if($(this).find('a[rel^="prettyPhoto"]').length > 0) {
15596
15597			var $unique_id = Math.floor(Math.random()*10000);
15598			var $currentCat = $(this).attr('data-current-cat');
15599			$(this).find('.col'+$currentCat).find('a[rel^="prettyPhoto"]').attr('rel','prettyPhoto['+$unique_id+'_sorted]');
15600			
15601			} 
15602			
15603		});
15604	}
15605
15606	function updateMagPrettyPhotoGallery(){
15607		$('.portfolio-items').each(function(){
15608
15609			var $currentCat = $(this).attr('data-current-cat');
15610			var $unique_id = Math.floor(Math.random()*10000);
15611			
15612			if($(this).is('[data-lightbox-only="true"]')){
15613				
15614					$(this).find('.col').each(function(){
15615		
15616						$(this).find('a.gallery').removeClass('gallery').removeClass('magnific');
15617						
15618						if($(this).is($currentCat)) {
15619							
15620							//parallax styles
15621							if($(this).find('.parallaxImg-wrap').length > 0) {
15622								
15623									if($('body[data-ls="fancybox"]').length > 0) {
15624										$(this).find('.work-item > a').attr('data-fancybox','group_'+$unique_id);
15625									} else {
15626										$(this).find('.work-item > a').addClass('gallery').addClass('magnific');
15627									}
15628									
15629							} else {
15630								//others
15631								
15632									if($('body[data-ls="fancybox"]').length > 0) {
15633										$(this).find('.work-item a').attr('data-fancybox','group_'+$unique_id);
15634									} else {
15635										$(this).find('.work-info a').addClass('gallery').addClass('magnific');
15636									}
15637									
15638							}
15639							
15640						}
15641		
15642					});
15643				
15644			}
15645			
15646			else if ($(this).find('.work-item.style-1').length > 0){
15647				
15648					$(this).find('.col').each(function(){
15649		
15650						$(this).find('a.gallery').removeClass('gallery').removeClass('magnific');
15651						
15652						if($(this).is($currentCat)) {
15653							
15654								if($('body[data-ls="fancybox"]').length > 0) {
15655									$(this).find('.work-info .vert-center a:first-of-type').attr('data-fancybox','group_'+$unique_id);
15656								} 
15657								else {
15658									$(this).find('.work-info .vert-center a:first-of-type').addClass('gallery').addClass('magnific');
15659								}
15660								
15661						}
15662		
15663					});
15664			}
15665			
15666		
15667			
15668		});
15669	}
15670
15671
15672
15673	var $blog_containers = [];
15674
15675	$('.posts-container').each(function(i){
15676		$blog_containers[i] = $(this);
15677	});
15678
15679  function masonryBlogInit() {
15680
15681		//// cache window
15682		var $window = jQuery(window);	
15683		
15684			
15685		$.each($blog_containers,function(i){
15686
15687			
15688				if($blog_containers[i].parent().hasClass('masonry') && !$blog_containers[i].parent().hasClass('auto_meta_overlaid_spaced')) { 
15689					
15690					$blog_containers[i].find('article').addClass('masonry-blog-item');
15691					
15692					if($blog_containers[i].parents('.masonry.classic').length > 0) {
15693						$blog_containers[i].find('article').prepend('<span class="bottom-line"></span>');
15694					}
15695					
15696					//move the meta to the bottom
15697					$blog_containers[i].find('article').each(function(){
15698						
15699						var $metaClone = $(this).find('.post-meta').clone();
15700
15701						$(this).find('.post-meta').remove();
15702
15703						if($blog_containers[i].parents('.post-area.meta_overlaid').length > 0){
15704							$(this).find('.post-header h2').after($metaClone);
15705						} else {
15706							$(this).find('.content-inner').after($metaClone);
15707						}
15708						
15709						$blog_containers[i].addClass('meta-moved');
15710						
15711					});
15712				
15713					
15714					if($blog_containers[i].parent().hasClass('masonry') && $blog_containers[i].parents('.blog-fullwidth-wrap').length > 0){
15715
15716						//page header animation fix
15717						if( $blog_containers[i].parents('.wpb_row').length > 0 ) $blog_containers[i].parents('.wpb_row').css('z-index',100);
15718
15719						if(!$blog_containers[i].parent().hasClass('meta_overlaid') && !$blog_containers[i].parent().hasClass('auto_meta_overlaid_spaced')) {
15720
15721							if($blog_containers[i].parent().hasClass('classic_enhanced')) {
15722								$blog_containers[i].parent().parents('.full-width-content').css({
15723									'padding' : '0px 0.2% 0px 2.4%'
15724								});
15725							} else {
15726								$blog_containers[i].parent().parents('.full-width-content').css({
15727									'padding' : '0px 0.2% 0px 3.2%'
15728								});
15729							}
15730							
15731						} else {
15732							$blog_containers[i].parent().parents('.full-width-content').addClass('meta-overlaid');
15733							$('.container-wrap').addClass('meta_overlaid_blog');
15734						}
15735
15736						fullWidthSections(); 
15737					}
15738					
15739					var $cols = 3;
15740					var $element = $blog_containers[i];
15741					
15742					if($blog_containers[i].find('img').length == 0) $element = $('<img />');
15743					
15744					imagesLoaded($element,function(instance){
15745						
15746						var $multiplier;
15747						
15748						if($('body').hasClass('mobile') || $blog_containers[i].parents('.post-area').hasClass('span_9')) {
15749							$cols = 2;
15750						}
15751
15752						//set img as BG if masonry classic enhanced
15753						if($blog_containers[i].parent().hasClass('classic_enhanced')){
15754							$blog_containers[i].find('.large_featured.has-post-thumbnail .post-featured-img, .wide_tall.has-post-thumbnail .post-featured-img').each(function(){
15755								var $src = $(this).find('img').attr('src');
15756								$(this).css('background-image','url('+$src+')');
15757							});
15758
15759							$blog_containers[i].find('.large_featured .nectar-flickity, .wide_tall .nectar-flickity').each(function(){
15760
15761								$(this).find('.cell').each(function(){
15762									var $src = $(this).find('img').attr('src');
15763									$(this).css('background-image','url('+$src+')');
15764								});
15765								
15766							});
15767						}
15768
15769						$cols = blogColumnNumbCalcs($blog_containers[i]);
15770						blogHeightCalcs($blog_containers[i], $cols);
15771
15772						if($blog_containers[i].parents('.post-area.meta_overlaid').length > 0) {
15773							$blog_containers[i].isotope({
15774							   itemSelector: 'article',
15775							   transitionDuration: '0s',
15776							   layoutMode: 'packery',
15777							   packery: { 
15778							   	 gutter: 0
15779							   	}
15780							}).isotope( 'layout' );
15781
15782						   
15783						} else if ($blog_containers[i].parents('.auto_meta_overlaid_spaced').length > 0) {
15784							
15785							$multiplier = .025;
15786							if($blog_containers[i].parents('.blog-fullwidth-wrap').length > 0) {
15787									$multiplier = .02;
15788							}
15789							
15790							$blog_containers[i].isotope({
15791								layoutMode: 'packery',
15792								transitionDuration: '0s',
15793								packery: {
15794									 gutter: 0
15795								}
15796						 });
15797						 
15798						}  else {
15799						   if($blog_containers[i].parent().hasClass('classic_enhanced')) {
15800							   	if($blog_containers[i].parents('.span_9.masonry').length == 0) {
15801							   		$multiplier = (window.innerWidth >= 1600) ? .015 : .02;
15802							   	} else {
15803							   		$multiplier = .04;
15804							    } 
15805						    }
15806							else {
15807 								 		$multiplier = ($blog_containers[i].parents('.span_9.masonry').length == 0) ? .03: .055;
15808 							 }
15809						   
15810							$blog_containers[i].isotope({
15811							   itemSelector: 'article',
15812							   transitionDuration: '0s',
15813							   layoutMode: 'packery',
15814							   packery: { 
15815							   	 gutter: $blog_containers[i].parents('.post-area').width()*$multiplier
15816							   	}
15817							}).isotope( 'layout' );
15818						}
15819
15820						blogLoadIn($blog_containers[i]);
15821						flickityBlogInit();
15822						
15823						$(window).trigger('resize');
15824
15825							
15826					});
15827					
15828					$(window).resize(function(){
15829						
15830
15831					   //size all items in grid 
15832					   //sizing for large items
15833						 if(typeof $blog_containers[i] !== 'undefined') { 
15834							  
15835								var $multiplier;
15836								
15837							  $cols = blogColumnNumbCalcs($blog_containers[i]);
15838								blogHeightCalcs($blog_containers[i], $cols);
15839								
15840								if($blog_containers[i].parents('.post-area.meta_overlaid').length > 0) {
15841								
15842								    $blog_containers[i].isotope({
15843								      layoutMode: 'packery',
15844								      packery: {
15845								      	 gutter: 0
15846								      }
15847								   });
15848								} else if ($blog_containers[i].parents('.auto_meta_overlaid_spaced').length > 0) {
15849									
15850									$multiplier = .025;
15851									if($blog_containers[i].parents('.blog-fullwidth-wrap').length > 0) {
15852											$multiplier = .02;
15853									}
15854									
15855									$blog_containers[i].isotope({
15856										layoutMode: 'packery',
15857										transitionDuration: '0s',
15858										packery: {
15859											 gutter: 0
15860										}
15861								 });
15862								} else {
15863								   
15864								   if($blog_containers[i].parent().hasClass('classic_enhanced')) {
15865								   		if($blog_containers[i].parents('.span_9.masonry').length == 0) {
15866									   		$multiplier = (window.innerWidth >= 1600) ? .015 : .02;
15867									   	} else {
15868									   		$multiplier = .04;
15869									    } 
15870								   } else {
15871										 		$multiplier = ($blog_containers[i].parents('.span_9.masonry').length == 0) ? .03: .055;
15872												if($blog_containers[i].parents('.blog-fullwidth-wrap').length > 0) {
15873														$multiplier = .02;
15874												}
15875									 } 
15876								  
15877								   $blog_containers[i].isotope({
15878								   	layoutMode: 'packery',
15879								      packery: { 
15880								      	gutter: $blog_containers[i].parents('.post-area').width()*$multiplier
15881								      }
15882								   });
15883								}
15884								
15885							} // if $blog_containers[i]
15886
15887					});
15888					
15889					
15890			    } else {
15891			    	blogLoadIn($blog_containers[i]);
15892			    }
15893
15894		});
15895		
15896		//set z-index / animation order only once
15897		setTimeout(blogMasonryZindex,700);
15898		$window.smartresize( function(){
15899			setTimeout(blogMasonryZindex,700);
15900		});
15901		
15902	}
15903	
15904	masonryBlogInit();
15905
15906	function blogLoadIn(post_container){
15907
15908
15909		if(post_container.attr('data-load-animation') == 'none') {
15910		
15911			post_container.find('.inner-wrap').removeClass('animated');
15912
15913		} else {
15914
15915			post_container.find('article').each(function(i){
15916
15917				//loaded visible
15918				if($(this).visible(true)) {
15919
15920					$(this).delay(110*i).queue(function(next){
15921					    $(this).addClass("animated-in");
15922					    next();
15923					});
15924
15925
15926				} else {
15927					//not already visible
15928					var $that = $(this);
15929					var waypoint = new Waypoint({
15930
15931			 			element: $that,
15932			 			 handler: function(direction) {
15933							
15934							setTimeout(function(){
15935							    $that.addClass("animated-in");
15936							},80*$that.attr('data-delay-amount'));
15937
15938							waypoint.destroy();
15939						},
15940						offset: '90%'
15941
15942					}); 
15943				}
15944
15945
15946			});
15947	
15948			
15949		}
15950
15951	}
15952
15953	function blogHeightCalcs($posts_container, cols) {
15954		if( $posts_container.parent().hasClass('meta_overlaid') && $posts_container.find('article[class*="regular"]').length > 0) {
15955
15956			//widths
15957			$.each($posts_container,function(i,v){
15958			 	var $colSize = 4;
15959			 	var $mult = (cols == 1) ? 1 : 2;
15960
15961			 	//check if higher than IE9 -- bugs out with width calc
15962			 	if($('html.no-csstransitions').length == 0) {
15963			 		$(v).find('article[class*="regular"]').css('width',Math.floor($(v).width()/cols) +'px');
15964			 		$(v).find('article[class*="tall"]').css('width',Math.floor($(v).width()/cols*$mult) +'px');
15965			 	} else {
15966			 		$('.post-area.masonry').css('width','100%');
15967			 	}
15968			 	
15969			 	
15970			 });
15971
15972			   //reset height for calcs
15973			   $posts_container.find('article[class*="regular"] img').css('height','auto');
15974
15975			   var tallColHeight = Math.ceil($posts_container.find('article[class*="regular"]:not(".format-link"):not(".format-quote") img').first().height());
15976			   var multipler = (window.innerWidth > 690) ? 2 : 1 ;
15977			   $posts_container.find('article[class*="tall"] img, .article.wide img, article.regular img').removeClass('auto-height');
15978			   $posts_container.find('article[class*="tall"] img').css('height',(tallColHeight*multipler));
15979			   $posts_container.find('article[class*="regular"] img').css('height',(tallColHeight));
15980			   //quote/links
15981			   $posts_container.find('article.regular.format-link,article.regular.format-quote').each(function(){
15982
15983			   		if(window.innerWidth > 690) {
15984			   			$(this).css({
15985			  	 			'height': tallColHeight
15986			   			});
15987			   		} else {
15988			   			$(this).css({
15989			  	 			'height': 'auto'
15990			   			});			 		
15991			   		}
15992			  	 	
15993			   	});
15994
15995
15996		} else {
15997			$posts_container.find('article[class*="tall"] img, article.regular img').addClass('auto-height');
15998		}
15999
16000
16001		if( $posts_container.parent().hasClass('classic_enhanced') && $posts_container.find('article[class*="regular"]').length > 0) {
16002			
16003			if($(window).width() > 690 ) {
16004				classicEnhancedSizing($posts_container.find('article:not(.large_featured):not(.wide_tall)'));
16005			}
16006			else { 
16007				classicEnhancedSizing($posts_container.find('article:not(.wide_tall)'));
16008			}
16009
16010			var tallColHeight = ($posts_container.find('article[class*="regular"]:not(".format-link"):not(".format-quote").has-post-thumbnail').first().length > 0) ? Math.ceil($posts_container.find('article[class*="regular"]:not(".format-link"):not(".format-quote").has-post-thumbnail').first().css('height','auto').height()) : 600;
16011
16012			if($(window).width() > 690 ) {
16013				$posts_container.find('article.large_featured, article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
16014			}
16015			else {
16016				$posts_container.find('article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
16017			}
16018
16019		//for when no regular articles exist	
16020		} else if( $posts_container.parent().hasClass('classic_enhanced') && $posts_container.find('article[class*="regular"]').length == 0) {
16021			var tallColHeight = ($posts_container.find('article[class*="regular"]:not(".format-link"):not(".format-quote").has-post-thumbnail').first().length > 0) ? Math.ceil($posts_container.find('article[class*="regular"]:not(".format-link"):not(".format-quote").has-post-thumbnail').first().css('height','auto').height()) : 600;
16022
16023			if($(window).width() > 690 ) {
16024				$posts_container.find('article.large_featured, article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
16025			}
16026			else {
16027				$posts_container.find('article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
16028			}
16029		}
16030
16031		//IE9 fix
16032		if($('html.no-csstransitions').length > 0) 		
16033			$('.post-area.masonry').css('width','100%');
16034			 	
16035			 	
16036	}
16037
16038	function classicEnhancedSizing(elements) {
16039
16040		var tallestCol = 0;
16041		elements.find('.article-content-wrap').css('height','auto');
16042		elements.filter('.has-post-thumbnail').each(function(){
16043			($(this).find('.article-content-wrap').outerHeight(true) > tallestCol) ? tallestCol = $(this).find('.article-content-wrap').outerHeight(true) : tallestCol = tallestCol;
16044		});	
16045		
16046		elements.filter('.has-post-thumbnail').find('.article-content-wrap').css('height',(tallestCol));
16047
16048	}
16049
16050
16051	function blogStickySS() {
16052		$('#sidebar[data-nectar-ss="true"], #sidebar[data-nectar-ss="1"]').each(function(){
16053
16054			//padding from top of screen
16055			var $ssExtraTopSpace = 50;
16056
16057			if($('#header-outer[data-remove-fixed="0"]').length > 0 && $('body[data-hhun="1"]').length == 0 && $('#header-outer[data-format="left-header"]').length == 0) { 
16058			 	$ssExtraTopSpace += $('#header-outer').outerHeight();	
16059				
16060				//resize effect
16061				if($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0 ) {
16062					 var shrinkNum = 6;		
16063					 var headerPadding2 = parseInt($('#header-outer').attr('data-padding')) - parseInt($('#header-outer').attr('data-padding'))/1.8;
16064					 shrinkNum = $('#header-outer').attr('data-shrink-num');
16065					 $ssExtraTopSpace -= shrinkNum;
16066					 $ssExtraTopSpace -= headerPadding2;
16067				}
16068				
16069				//condesne
16070				if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
16071					
16072						var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
16073						var $secondaryHeader = $('#header-secondary-outer');
16074						
16075						$ssExtraTopSpace = 50;
16076						$ssExtraTopSpace += $('#header-outer').height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top')) ) - parseInt(nectarDOMInfo.secondaryHeaderHeight);
16077				}
16078				
16079
16080			}
16081
16082			if($('#wpadminbar').length > 0) {
16083				$ssExtraTopSpace += $('#wpadminbar').outerHeight();
16084			}
16085
16086 			if($('#header-outer').attr('data-using-secondary') == '1') {
16087				$ssExtraTopSpace += $('#header-secondary-outer').outerHeight();
16088			}
16089			
16090			if($(this).parents('.wpb_widgetised_column').length > 0) {
16091				
16092				if($('body.vc_editor').length > 0) {
16093
16094				} else {
16095						$(this).parents('.wpb_column').theiaStickySidebar({
16096							additionalMarginTop: $ssExtraTopSpace,
16097							updateSidebarHeight: false
16098						});
16099				}
16100				
16101			} 
16102			
16103			else {
16104				$(this).theiaStickySidebar({
16105			      additionalMarginTop: $ssExtraTopSpace,
16106						updateSidebarHeight: false
16107			    });
16108			}
16109			
16110		});
16111	}
16112
16113	if( $().theiaStickySidebar ) {
16114		blogStickySS();
16115	}
16116
16117	var blogMediaQuerySize;
16118	function blogColumnNumbCalcs(post_container){
16119		
16120			 var $cols = 3;
16121				
16122		   if($('body').hasClass('mobile') && window.innerWidth < 990 || post_container.parents('.post-area').hasClass('span_9') && post_container.parents('.post-area.meta_overlaid').length == 0) {
16123			   $cols = 2;
16124		   } else if( post_container.parents('.post-area').hasClass('full-width-content') || post_container.parents('.post-area').parent().hasClass('full-width-content') && $('#boxed').length == 0 || post_container.parents('.post-area.meta_overlaid').length > 0 ){
16125		   		
16126				var windowSize = $(window).width();
16127
16128				
16129				if(window.innerWidth >= 1600){
16130					blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'four' :'five';
16131				} else if(window.innerWidth < 1600 && window.innerWidth >= 1300){
16132					blogMediaQuerySize = 'four';
16133				} else if(window.innerWidth < 1300 && window.innerWidth >= 990){
16134					blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'four' :'three';
16135				} else if(window.innerWidth < 990 && window.innerWidth >= 470){
16136					blogMediaQuerySize = 'two';
16137				} else if(window.innerWidth < 470){
16138					blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'two' :'one';
16139				}
16140			
16141				
16142				//boxed
16143				if($('#boxed').length > 0) {
16144					if(window.innerWidth > 1300){
16145						blogMediaQuerySize = 'four';
16146					} else if(window.innerWidth < 1300 && window.innerWidth > 990){
16147						blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'four' :'three';
16148					} else if(window.innerWidth < 990){
16149						blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'two' :'one';
16150					}
16151					
16152				}
16153				
16154				
16155				switch (blogMediaQuerySize) {
16156					case 'five':
16157						$cols = 5;
16158					break;
16159					
16160					case 'four':
16161						$cols = 4;
16162					break;
16163					
16164					case 'three':
16165						$cols = 3;
16166					break;
16167					
16168					case 'two':
16169						$cols = 2;
16170					break;
16171					
16172					case 'one':
16173						$cols = 1;
16174					break;
16175				}
16176		   		
16177			
16178		   } else {
16179
16180		   	   $cols = 3;
16181		   }
16182
16183		   return $cols;
16184
16185	}
16186
16187
16188var shrinkNum = 6;
16189		
16190if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
16191
16192headerPadding2 = headerPadding - headerPadding/1.8;
16193
16194$('body').on('click','.section-down-arrow',function(){
16195	
16196	if($(this).parents('.nectar-box-roll').length > 0) return false;
16197
16198	var $currentSection = $(this).parents('#page-header-bg');
16199	var $topDistance = $currentSection.height();
16200	var $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0;
16201	var $bodyBorderSize = ($('.body-border-top').length > 0 && $(window).width() > 1000) ? $('.body-border-top').height(): 0;
16202	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0) ? 0 : $('#header-space').height();
16203	
16204	var $materialSecondary = 0;
16205	if($('body.material').length > 0 && $('#header-secondary-outer').length > 0) { $materialSecondary = $('#header-secondary-outer').height(); }
16206	
16207	if($('body[data-permanent-transparent="1"]').length == 0) {
16208		//regular
16209		if(!$('body').hasClass('mobile')){
16210			
16211			if($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
16212				$('body,html').stop().animate({
16213					scrollTop: parseInt($topDistance) + $offset + 2 - $bodyBorderSize*2
16214				},1000,'easeInOutCubic')
16215			} 
16216			else {
16217				
16218				$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
16219				if($('#header-outer[data-remove-fixed="1"]').length > 0) { 
16220					$headerNavSpace = 0;
16221					$offset = 0;
16222				}
16223					
16224				//condesne
16225				if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
16226					
16227						var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
16228						var $secondaryHeader = $('#header-secondary-outer');
16229						
16230						$headerNavSpace = $('#header-outer').height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top')) ) - parseInt(nectarDOMInfo.secondaryHeaderHeight);
16231				}
16232				
16233				
16234				$('body,html').stop().animate({
16235					scrollTop: parseInt($topDistance - $headerNavSpace) +$resize + 3 + $offset + $materialSecondary
16236				},1000,'easeInOutCubic')
16237
16238			}
16239			
16240		} else {
16241			$scrollPos = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? parseInt($topDistance) - $headerNavSpace + parseInt($currentSection.offset().top) + 2 : parseInt($topDistance) + parseInt($currentSection.offset().top) + 2;
16242			$('body,html').stop().animate({
16243				scrollTop: $scrollPos - $bodyBorderSize*2
16244			},1000,'easeInOutCubic')
16245		}
16246	} else {
16247		//permanent transparent
16248		$('body,html').stop().animate({
16249			scrollTop: parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize*2
16250		},1000,'easeInOutCubic')
16251	}
16252	return false;
16253});
16254
16255
16256$('body').on('mouseover','.post-area.featured_img_left .grav-wrap .text a, .masonry.material .masonry-blog-item .grav-wrap .text a, .blog-recent[data-style="material"] .grav-wrap .text a',function(){
16257	$(this).parents('.grav-wrap').find('img').addClass('hovered');
16258});
16259$('body').on('mouseleave','.post-area.featured_img_left .grav-wrap .text a, .masonry.material .masonry-blog-item .grav-wrap .text a, .blog-recent[data-style="material"] .grav-wrap .text a',function(){
16260	$(this).parents('.grav-wrap').find('img').removeClass('hovered');
16261});  
16262
16263
16264
16265/*-------------------------------------------------------------------------*/
16266/*	7.	Cross Browser Fixes
16267/*-------------------------------------------------------------------------*/	
16268	 
16269	 function crossBrowserFixes() {
16270	
16271		 
16272		//Fix current class in menu 
16273		if ($("body").hasClass("single-portfolio") || $('body').hasClass("error404") || $('body').hasClass("search-results")) {   
16274			$("li").removeClass("current_page_parent").removeClass("current-menu-ancestor").removeClass('current_page_ancestor');   
16275		}
16276		
16277		//for users updating to 8 with a custom, old header template file
16278		if($('html.js').length == 0) { $('html').removeClass('no-js').addClass('js'); }
16279		
16280		//remove br's from code tag
16281		$('code').find('br').remove();	
16282		
16283		//if a clear is the last div, remove the padding
16284		if($('.container.main-content > .row > div:last-child').hasClass('clear')) {
16285			$('.container.main-content > .row > div:last-child').css('padding-bottom','0');
16286		}
16287		
16288		//homepage recent blog for IE8
16289		$('.container-wrap .blog-recent > div:last-child').addClass('col_last');
16290		
16291		//blog ascend bottom padding
16292		if($('.single .blog_next_prev_buttons').length > 0) $('.container-wrap').css('padding-bottom',0);
16293
16294		//contact form
16295		$('.wpcf7-form p:has(input[type=submit])').css('padding-bottom','0px');
16296
16297		$('.full-width-content .wpcf7-submit').on('click',function(){ setTimeout(function(){ fullWidthContentColumns() },1000); setTimeout(function(){ fullWidthContentColumns() },2000); });
16298		
16299		//no caption home slider fix
16300		$('#featured article').each(function(){
16301			if($(this).find('h2').attr('data-has-caption') == '0') {
16302				$(this).parents('.slide').addClass('no-caption');
16303			}
16304		});
16305		
16306		//add class for IE
16307		var ua = window.navigator.userAgent;
16308		var msie = ua.indexOf("Edge/");
16309		if(msie > 0) {
16310			$('body').addClass('msie');
16311		}
16312
16313		//gravity form inside fw content row
16314		$('.gform_body').on('click',function(e){
16315		   setTimeout(function(){ fullWidthContentColumns(); },200);
16316		 });
16317		 
16318		//pum salient close 
16319		$('.pum.pum-theme-salient-page-builder-optimized button.pum-close').wrapInner('<span />'); 
16320		
16321		//pum inside fspr
16322		if($('#nectar_fullscreen_rows').length > 0 && $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').length > 0) {
16323			$('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').unwrap();
16324		}
16325
16326		//chat post format nth child color
16327		$('article.post.format-chat .content-inner dt:odd').css('color','#333');
16328		
16329		//remove margin on last cols inside of full width sections 
16330		$('.full-width-section').each(function(){
16331			$(this).find('> .span_12 > div.col_last').last().css('margin-bottom','0');
16332		});
16333		
16334		//remove p tags from extra content editor when warpping only an img 
16335		$('#portfolio-extra p').each(function(){
16336			if($(this).find('*').length == 1 && $(this).find('img').length == 1) {
16337				$(this).find('img').unwrap();
16338			}
16339		});
16340	
16341
16342		//vc text_separator color
16343		$('.vc_text_separator').each(function(){
16344			if( $(this).parents('.full-width-section').length > 0 ) $(this).find('div').css('background-color',$(this).parents('.full-width-section').find('.row-bg').css('background-color'));
16345		});
16346		
16347		//carousel head button alignment  
16348		$('.carousel-heading').each(function(){
16349			if($(this).find('h2').length > 0) $(this).find('.carousel-prev, .carousel-next').css('top','7px');
16350		});
16351		
16352		//remove carousel heading if not being used
16353		$('.carousel-wrap').each(function(){
16354			if($(this).find('.carousel-heading .container:empty').length > 0) $(this).find('.carousel-heading').remove();
16355		});
16356		
16357		//woocommerce product thuimbnails
16358		$('.woocommerce div.product div.images div.thumbnails a:nth-child(4n+4)').css('margin-right','0px');
16359		
16360		//remove extra galleries when using the nectar gallery slider on projects and posts
16361		$('article.post .gallery-slider .gallery,  article.post .gallery-slider .jetpack-slideshow, .single-portfolio .gallery-slider .gallery, .single-portfolio .gallery-slider .jetpack-slideshow').remove();
16362		
16363		
16364		$('.woocommerce .span_9 .products.related .products li:nth-child(4), .woocommerce .span_9 .products.upsells .products li:nth-child(4)').remove();
16365		$('.woocommerce .span_9 .products.related .products li:nth-child(3), .woocommerce .span_9 .products.upsells .products li:nth-child(3)').css('margin-right','0');	
16366		
16367		$('.cart-menu a, .widget_shopping_cart a').addClass('no-ajaxy');
16368
16369		//clients no hover if no link
16370		$('div.clients').each(function(){
16371			$(this).find('> div').each(function(){
16372				if($(this).find('a').length == 0) {
16373					$(this).addClass('no-link');
16374				}
16375			});
16376		});
16377
16378		//remove ajaxy from single posts when using disqus
16379		if(nectarLove.disqusComments == 'true') $('.post-area article a, .blog_next_prev_buttons a, #portfolio-nav #prev-link a, #portfolio-nav #next-link a, .portfolio-items .col .work-item .work-info a').addClass('no-ajaxy');
16380
16381		//blog next color bg only 
16382		if($('.blog_next_prev_buttons').find('.bg-color-only-indicator').length > 0) $('.blog_next_prev_buttons').addClass('bg-color-only').find('.bg-color-only-indicator').remove();
16383		
16384		if($('#single-below-header').hasClass('fullscreen-header') && $('.blog_next_prev_buttons').length == 0 ) $('#author-bio, .comment-wrap').addClass('lighter-grey');
16385
16386		//shop header parallax margin 
16387		if($('body.woocommerce').find('#page-header-bg').length > 0){
16388			$('.container-wrap').css({'margin-top':'0px','padding-top':'30px'});
16389		}
16390		
16391		//if using wooCommerce sitewide notice
16392		if($('.demo_store').length > 0) $('#header-outer, #header-space').css('margin-top','32px');
16393	
16394		
16395		//nectar slider external links
16396		$('.swiper-slide.external-button-1 .buttons > div:nth-child(1) a').attr('target','_blank');
16397		$('.swiper-slide.external-button-2 .buttons > div:nth-child(2) a').attr('target','_blank');
16398		
16399		//portfolio external links
16400		$(".portfolio-items").find("a[href*='http://']:not([href*='"+window.location.hostname+"'])").attr("target","_blank"); 
16401		$(".recent_projects_widget").find("a[href*='http://']:not([href*='"+window.location.hostname+"'])").attr("target","_blank"); 
16402		
16403		$(".portfolio-items").find("a[href*='https://']:not([href*='"+window.location.hostname+"'])").attr("target","_blank"); 
16404		$(".recent_projects_widget").find("a[href*='https://']:not([href*='"+window.location.hostname+"'])").attr("target","_blank"); 
16405		
16406		//remove excess inner content when empty row
16407		$('.container-wrap .row > .wpb_row').each(function(){
16408			if($(this).find('> .span_12 > .wpb_column > .wpb_wrapper').length > 0 && $(this).find('> .span_12 > .wpb_column > .wpb_wrapper').find('*').length == 0) $(this).find('> .span_12 ').remove();
16409		});
16410		
16411		//remove boxed style from full width content
16412		$('.full-width-content .col.boxed').removeClass('boxed');
16413		
16414		//remove full width attribute on slider in full width content section
16415		$('.full-width-content .wpb_column .nectar-slider-wrap[data-full-width="true"]').attr('data-full-width','false');	
16416
16417	    //neg marg z-index
16418	    $('.wpb_column.neg-marg').parents('.wpb_row').css('z-index','110');
16419
16420
16421	    //portfolio description remove on hover
16422	    var $tmpTitle = null;
16423	    $('.portfolio-items > .col a[title]').on('mouseenter',function(){
16424	    	$tmpTitle = $(this).attr('title');
16425	    	$(this).attr('title','');
16426	    });
16427			$('.portfolio-items > .col a[title]').on('mouseleave',function(){
16428	    	$(this).attr('title', $tmpTitle);
16429	    });
16430			
16431	    $('.portfolio-items > .col a[title]').on('click',function(e){
16432			$(this).attr('title', $tmpTitle);
16433	    });
16434
16435	};
16436
16437	crossBrowserFixes();
16438
16439
16440
16441	jQuery( document.body ).on( 'updated_cart_totals', function() { 
16442		if($('.plus').length == 0) 
16443			$( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '<input type="button" value="+" class="plus" />' ).prepend( '<input type="button" value="-" class="minus" />' );
16444	});
16445
16446	// Quantity buttons
16447	if($('.plus').length == 0) {
16448		$( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '<input type="button" value="+" class="plus" />' ).prepend( '<input type="button" value="-" class="minus" />' );
16449
16450		$( document ).on( 'click', '.plus, .minus', function() {
16451
16452			// Get values
16453			var $qty		= $( this ).closest( '.quantity' ).find( '.qty' ),
16454				currentVal	= parseFloat( $qty.val() ),
16455				max			= parseFloat( $qty.attr( 'max' ) ),
16456				min			= parseFloat( $qty.attr( 'min' ) ),
16457				step		= $qty.attr( 'step' );
16458
16459			// Format values
16460			if ( ! currentVal || currentVal === '' || currentVal === 'NaN' ) currentVal = 0;
16461			if ( max === '' || max === 'NaN' ) max = '';
16462			if ( min === '' || min === 'NaN' ) min = 0;
16463			if ( step === 'any' || step === '' || step === undefined || parseFloat( step ) === 'NaN' ) step = 1;
16464
16465			// Change the value
16466			if ( $( this ).is( '.plus' ) ) {
16467
16468				if ( max && ( max == currentVal || currentVal > max ) ) {
16469					$qty.val( max );
16470				} else {
16471					$qty.val( currentVal + parseFloat( step ) );
16472				}
16473
16474			} else {
16475
16476				if ( min && ( min == currentVal || currentVal < min ) ) {
16477					$qty.val( min );
16478				} else if ( currentVal > 0 ) {
16479					$qty.val( currentVal - parseFloat( step ) );
16480				}
16481
16482			}
16483
16484			// Trigger change event
16485			$qty.trigger( 'change' );
16486
16487		});
16488	}
16489
16490	function wooPriceSlider(){
16491
16492
16493		// woocommerce_price_slider_params is required to continue, ensure the object exists
16494		if ( typeof woocommerce_price_slider_params === 'undefined' || !$('body').hasClass('woocommerce') ) {
16495			return false;
16496		}
16497
16498		// Get markup ready for slider
16499		$( 'input#min_price, input#max_price' ).hide();
16500		$( '.price_slider, .price_label' ).show();
16501
16502		// Price slider uses jquery ui
16503		var min_price = $( '.price_slider_amount #min_price' ).data( 'min' ),
16504			max_price = $( '.price_slider_amount #max_price' ).data( 'max' );
16505
16506		current_min_price = parseInt( min_price, 10 );
16507		current_max_price = parseInt( max_price, 10 );
16508
16509		if ( woocommerce_price_slider_params.min_price ) current_min_price = parseInt( woocommerce_price_slider_params.min_price, 10 );
16510		if ( woocommerce_price_slider_params.max_price ) current_max_price = parseInt( woocommerce_price_slider_params.max_price, 10 );
16511
16512		$( 'body' ).bind( 'price_slider_create price_slider_slide', function( event, min, max ) {
16513			if ( woocommerce_price_slider_params.currency_pos === 'left' ) {
16514
16515				$( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + min );
16516				$( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + max );
16517
16518			} else if ( woocommerce_price_slider_params.currency_pos === 'left_space' ) {
16519
16520				$( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + " " + min );
16521				$( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + " " + max );
16522
16523			} else if ( woocommerce_price_slider_params.currency_pos === 'right' ) {
16524
16525				$( '.price_slider_amount span.from' ).html( min + woocommerce_price_slider_params.currency_symbol );
16526				$( '.price_slider_amount span.to' ).html( max + woocommerce_price_slider_params.currency_symbol );
16527
16528			} else if ( woocommerce_price_slider_params.currency_pos === 'right_space' ) {
16529
16530				$( '.price_slider_amount span.from' ).html( min + " " + woocommerce_price_slider_params.currency_symbol );
16531				$( '.price_slider_amount span.to' ).html( max + " " + woocommerce_price_slider_params.currency_symbol );
16532
16533			}
16534
16535			$( 'body' ).trigger( 'price_slider_updated', min, max );
16536		});
16537
16538		$( '.price_slider' ).slider({
16539			range: true,
16540			animate: true,
16541			min: min_price,
16542			max: max_price,
16543			values: [ current_min_price, current_max_price ],
16544			create : function( event, ui ) {
16545
16546				$( '.price_slider_amount #min_price' ).val( current_min_price );
16547				$( '.price_slider_amount #max_price' ).val( current_max_price );
16548
16549				$( 'body' ).trigger( 'price_slider_create', [ current_min_price, current_max_price ] );
16550			},
16551			slide: function( event, ui ) {
16552
16553				$( 'input#min_price' ).val( ui.values[0] );
16554				$( 'input#max_price' ).val( ui.values[1] );
16555
16556				$( 'body' ).trigger( 'price_slider_slide', [ ui.values[0], ui.values[1] ] );
16557			},
16558			change: function( event, ui ) {
16559
16560				$( 'body' ).trigger( 'price_slider_change', [ ui.values[0], ui.values[1] ] );
16561
16562			},
16563		});
16564
16565	}
16566	
16567
16568//vc col mobile fixes
16569function vcMobileColumns() {
16570
16571	$('.wpb_row').each(function(){
16572		if(typeof $(this).find('.span_12').offset() != 'undefined' ) {
16573		
16574			$(this).find('[class*="vc_col-"]').each(function(){
16575
16576				var $firstChildOffset = $(this).parents('.span_12').offset().left;
16577				
16578				$(this).removeClass('no-left-margin');
16579				if($(this).offset().left < $firstChildOffset + 27) { 
16580					$(this).addClass('no-left-margin');
16581				} else {
16582					$(this).removeClass('no-left-margin');
16583				}
16584			});
16585		}
16586	});
16587}
16588
16589if( $('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) { vcMobileColumns(); }
16590
16591
16592/*-------------------------------------------------------------------------*/
16593/*	8.	Form Styling
16594/*-------------------------------------------------------------------------*/	
16595
16596
16597if($('body[data-fancy-form-rcs="1"]').length > 0) {
16598
16599
16600    //select only as of v9
16601    $('select:not(.comment-form-rating #rating)').each(function(){
16602			
16603			var $selector;
16604
16605    	//cf7
16606    	if($(this).parents('.wpcf7-form-control-wrap').length > 0) {
16607
16608    		//select 2 already initialized
16609	    	if($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) {
16610	    		$selector = $($(this).prev('.select2-container'));
16611	    	} else {
16612	    		$selector = $(this);
16613	    	}
16614
16615	    	//if label is found
16616	    	if($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) {
16617	    		$selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />');
16618	    	} else {
16619	    		//default wrap
16620	    		$selector.wrap('<div class="fancy-select-wrap" />');
16621	    	}
16622    	} 
16623    	//default
16624    	else {
16625
16626	    	//select 2 already initialized
16627	    	if($(this).prev('.select2-container').length > 0) {
16628	    		$selector = $(this).prev('.select2-container');
16629	    	} else {
16630	    		$selector = $(this);
16631	    	}
16632				
16633				if($(this).parents('#buddypress').length == 0) {
16634			    	//if label is found
16635			    	if($selector.prev('label').length == 1) {
16636			    		$selector.prev('label').andSelf().wrapAll('<div class="fancy-select-wrap" />');
16637			    	} else if($selector.next('label').length == 1) {
16638			    		$selector.next('label').andSelf().wrapAll('<div class="fancy-select-wrap" />');
16639			    	} else {
16640			    		//default wrap
16641			    		$selector.wrap('<div class="fancy-select-wrap" />');
16642			    	}
16643				}
16644				
16645    	}
16646    });
16647	
16648	function select2Init(){
16649		$('select:not(.state_select):not(.country_select):not(.comment-form-rating #rating):not(#tribe-bar-form select):not(.woocommerce-currency-switcher)' ).each( function() {
16650			
16651			if($(this).parents('#buddypress').length == 0) {
16652			
16653						if($(this).parents('.woocommerce-ordering').length == 0) {
16654							$( this ).select2({
16655								minimumResultsForSearch: 7,
16656								width: '100%'
16657							});
16658						} else {
16659							$( this ).select2({
16660								minimumResultsForSearch: 7,
16661								dropdownAutoWidth: true
16662							});
16663						}
16664			}
16665
16666		});
16667	}
16668   
16669	select2Init();
16670
16671}
16672	
16673
16674
16675//Back/forward cache OCM close
16676if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
16677	
16678	window.onpageshow = function(event) {
16679		
16680			if(event.persisted) {
16681					
16682					//play video BGs
16683					$('.nectar-video-wrap, .nectar-slider-wrap .swiper-slide .video-wrap').each(function(i){
16684						
16685						if($(this).find('video').length > 0) {
16686							  $(this).find('video')[0].play();
16687						}
16688						
16689					});
16690	
16691
16692					//close mobile nav
16693					
16694					////material
16695					if($('body.material-ocm-open').length > 0) {	
16696							$('body > .slide_out_area_close').addClass('non-human-allowed').trigger('click');
16697
16698							setTimeout(function(){
16699								$('body > .slide_out_area_close').removeClass('non-human-allowed');
16700							},100);
16701						
16702					} 
16703					else if( $('#slide-out-widget-area.slide-out-from-right-hover.open').length > 0 && navigator.userAgent.match(/(iPod|iPhone|iPad)/) ) {
16704						mobileCloseNavCheck();
16705					}
16706					////others
16707					else if( $('#slide-out-widget-area.fullscreen.open').length > 0 || $('#slide-out-widget-area.fullscreen-alt.open').length > 0 || $('#slide-out-widget-area.slide-out-from-right.open').length > 0 ) {
16708						
16709							$('#slide-out-widget-area .slide_out_area_close').addClass('non-human-allowed');
16710							$('.slide-out-widget-area-toggle:not(.std-menu) a.open').addClass('non-human-allowed').trigger('click');
16711							setTimeout(function(){
16712								$('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed');
16713							},100);
16714						
16715					}
16716
16717			} // if loaded from bf cache
16718			
16719		} //onpage show
16720		
16721} // only used on Safari or mobile
16722	
16723	
16724/*-------------------------------------------------------------------------*/
16725/*	10.	Page transitions
16726/*-------------------------------------------------------------------------*/	
16727
16728	if($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="ajax"]').length > 0 && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && $(window).width() > 690 ) {
16729
16730		$('#ajax-content-wrap').ajaxify({
16731			'selector':'#ajax-content-wrap a:not(.no-ajaxy):not([target="_blank"]):not([href^="#"]):not(.comment-edit-link):not(#cancel-comment-reply-link):not(.comment-reply-link):not(#toggle-nav):not(.cart_list a):not(.logged-in-as a):not(.no-widget-added a):not(.add_to_cart_button):not(.product-wrap a):not(.section-down-arrow):not([data-filter]):not([data-fancybox]):not(.product_list_widget a):not(.magnific):not(.pp):not([rel^="prettyPhoto"]):not(.pretty_photo), #header-outer li:not(.no-ajaxy) > a:not(.no-ajaxy), #header-outer #logo',
16732			'verbosity': 0, 
16733			requestDelay: 400,
16734			previewoff : true,
16735			memoryoff: true,
16736			turbo : false
16737		});
16738
16739		$(window).on("pronto.render", initPage)
16740		.on("pronto.load", destroyPage)
16741		.on("pronto.request", transitionPage);
16742
16743		if($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) setTimeout(function() { waypoints(); }, 750);
16744		else if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },300);
16745
16746		if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
16747			setTimeout(function(){ 
16748				$('#ajax-loading-screen').addClass('loaded');
16749			},30);
16750		}
16751
16752		initPage();
16753
16754	} else if($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="standard"]').length > 0 ) {
16755		
16756		//chrome white BG flash fix
16757		$('html').addClass('page-trans-loaded');
16758
16759		//fadeout loading animation
16760		if($('#ajax-loading-screen[data-effect="standard"]').length > 0) {
16761
16762			if($('.nectar-particles').length == 0) {
16763
16764					$('#ajax-loading-screen').transition({'opacity':0},500,function(){ 
16765						$(this).css({'display':'none'}); 
16766					}); 
16767					$('#ajax-loading-screen .loading-icon').transition({'opacity':0},500) 
16768				
16769			}
16770
16771			//bind waypoints after loading screen has left
16772			if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },550);
16773
16774			//safari back/prev fix
16775			if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
16776				window.onunload = function(){ $('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ $(this).css({'display':'none'}); }); $('#ajax-loading-screen .loading-icon').transition({'opacity':0},600) };
16777				window.onpageshow = function(event) {
16778					
16779		    		if (event.persisted) {
16780							
16781							
16782		    			$('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ 
16783		    				$(this).css({'display':'none'}); 
16784		    			}); 
16785		    			$('#ajax-loading-screen .loading-icon').transition({'opacity':0},600);
16786							
16787		    		} //presisted
16788						
16789		    	}
16790					
16791			} else if(navigator.userAgent.indexOf('Firefox') != -1) {
16792				window.onunload = function(){};
16793			}
16794
16795	    		
16796	    	
16797			
16798		} else {
16799
16800			//for swipe trans add loaded immediately
16801			if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
16802				setTimeout(function(){ 
16803					$('#ajax-loading-screen').addClass('loaded');
16804				},60);
16805			}
16806
16807			if($('#page-header-wrap #page-header-bg[data-animate-in-effect="zoom-out"] .nectar-video-wrap').length == 0 && $('.first-nectar-slider').length == 0) {
16808				setTimeout(function(){ 
16809					$('#ajax-loading-screen:not(.loaded)').addClass('loaded');
16810					setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
16811				},150);
16812			}
16813
16814			//safari back/prev fix
16815			if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
16816				window.onunload = function(){ $('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ $(this).css({'display':'none'}); }); $('#ajax-loading-screen .loading-icon').transition({'opacity':0},600) };
16817				window.onpageshow = function(event) {
16818		    		if (event.persisted) { 
16819		    			$('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ 
16820		    				$(this).css({'display':'none'}); 
16821		    			}); 
16822		    			$('#ajax-loading-screen .loading-icon').transition({'opacity':0},600);
16823		    		}
16824		    	}
16825			} else if(navigator.userAgent.indexOf('Firefox') != -1) {
16826				window.onunload = function(){};
16827			}
16828			
16829			//bind waypoints after loading screen has left
16830			if($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { setTimeout(function() { waypoints(); }, 750); }
16831			else if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },350);
16832
16833		}
16834
16835		//remove excess loading images now
16836		$('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();
16837
16838
16839		if($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) {
16840				
16841				if( $('body.using-mobile-browser #ajax-loading-screen[data-method="standard"][data-disable-mobile="1"]').length == 0) {
16842					
16843					var ignore_onbeforeunload = false;
16844					$('a[href^="mailto"], a[href^="tel"]').on('click',function(){
16845			        ignore_onbeforeunload = true;
16846			    });
16847					window.addEventListener('beforeunload', function () {
16848								
16849								if (!ignore_onbeforeunload){
16850									$('#ajax-loading-screen').addClass('set-to-fade');
16851									transitionPageStandard();
16852								}
16853								ignore_onbeforeunload = false;
16854					});
16855				}
16856
16857		} // if disable fade out is not on
16858		
16859		
16860	} else {	
16861		//bind waypoints regularly
16862		if($('.nectar-box-roll').length == 0 && !nectarDOMInfo.usingFrontEndEditor) setTimeout(function() { waypoints(); },100);
16863	}
16864
16865
16866	function transitionPage(e) {
16867		
16868		if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
16869
16870			if($(window).scrollTop() > 0) {
16871
16872				//stop nicescroll
16873				if($().niceScroll && $("html").getNiceScroll()){
16874					var nice = $("html").getNiceScroll();
16875					nice.stop();
16876				}
16877				
16878				$('body,html').stop(true,true).animate({
16879					scrollTop:0
16880				},500,'easeOutQuad',function(){ 
16881					
16882					//close widget area
16883					setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
16884					$('#ajax-loading-screen').removeClass('loaded');
16885					$('#ajax-loading-screen').addClass('in-from-right');
16886					setTimeout(function(){
16887						$('#ajax-loading-screen').addClass('loaded');
16888					},30);
16889
16890				});
16891			}
16892			else { 
16893				//close widget area
16894				setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
16895				$('#ajax-loading-screen').removeClass('loaded');
16896				$('#ajax-loading-screen').addClass('in-from-right');
16897				setTimeout(function(){
16898					$('#ajax-loading-screen').addClass('loaded');
16899				},30);
16900			}
16901
16902		} else {
16903			if($(window).scrollTop() > 0) {
16904
16905				//stop nicescroll
16906				if($().niceScroll && $("html").getNiceScroll()){
16907					var nice = $("html").getNiceScroll();
16908					nice.stop();
16909				}
16910				
16911				$('body,html').stop(true,true).animate({
16912					scrollTop:0
16913				},500,'easeOutQuad',function(){ 
16914					$('#ajax-loading-screen').css({'opacity':'1', 'display':'none'});
16915					$('#ajax-loading-screen').stop(true,true).fadeIn(600,function(){
16916						$('#ajax-loading-screen .loading-icon').animate({'opacity':1},400);
16917						//close widget area
16918						setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
16919					});
16920				});
16921
16922			} else {
16923				$('#ajax-loading-screen').css('opacity','1').stop().fadeIn(600,function(){
16924					$('#ajax-loading-screen .loading-icon').animate({'opacity':1},400);
16925				});
16926
16927				//close widget area
16928				setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
16929			}
16930		}
16931
16932		
16933	}
16934
16935	function transitionPageStandard(e) {
16936
16937		if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
16938			$('#ajax-loading-screen').removeClass('loaded');
16939			$('#ajax-loading-screen').addClass('in-from-right');
16940			setTimeout(function(){
16941				$('#ajax-loading-screen').addClass('loaded');
16942			},30);
16943		} else {
16944			if($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0) {
16945				$('#ajax-loading-screen').css('opacity','0').css('display','block').transition({'opacity':'1'},450);
16946			} else {
16947				$('#ajax-loading-screen').show().transition({'opacity':'1'},450);
16948			}
16949		}
16950		
16951	}
16952
16953	function destroyPage(e) {
16954		$(window).off('scroll.appear');
16955		if($('#nectar_fullscreen_rows').length > 0 && $().fullpage) 
16956			$.fn.fullpage.destroy('all');
16957	}
16958
16959	function initPage(e) {
16960
16961		if(!$('body').hasClass('ajax-loaded')) return false;
16962
16963
16964		//init js
16965		lightBoxInit();
16966		addOrRemoveSF();
16967		
16968		if($('body[data-header-format="left-header"]').length == 0) {
16969			$(".sf-menu").superfish('destroy');
16970		}
16971
16972		initSF();
16973		SFArrows();
16974		headerInit();
16975		var $effectTimeout = ($('#ajax-loading-screen').length > 0) ? 800 : 0;
16976		pageHeaderTextEffectInit();
16977		if($('#page-header-bg .nectar-video-wrap video').length == 0) { setTimeout(pageHeaderTextEffect,$effectTimeout); }
16978		coloredButtons();
16979		columnBGColors();
16980		fwCarouselLinkFix();
16981		if($('.carousel').length > 0) {
16982			standardCarouselInit();
16983			clientsCarouselInit();
16984			carouselHeightCalcs();
16985		}
16986		if($('.owl-carousel').length > 0) owlCarouselInit();
16987		if($('.products-carousel').length > 0 || $('.nectar-woo-flickity').length > 0) productCarouselInit();
16988		if($('#nectar_fullscreen_rows').length > 0 && $().fullpage) {
16989			setFPNames();
16990			initFullPageFooter();
16991			fullscreenRowLogic();
16992			initNectarFP();
16993		}
16994		flexsliderInit();
16995		accordionInit();
16996		tabbedInit();
16997		nectarLiquidBGs();
16998		tabbbedDeepLinking();
16999		accordionDeepLinking();
17000		ulChecks();
17001		oneFourthClasses();
17002		carouselfGrabbingClass();
17003		cascadingImageBGSizing();
17004		fullWidthSections();
17005		fwsClasses();
17006		fullwidthImgOnlySizingInit();
17007		fullwidthImgOnlySizing();
17008		if(nectarDOMInfo.usingMobileBrowser) {
17009			fullWidthRowPaddingAdjustCalc();
17010		}
17011		boxRollInit();
17012		setTimeout(function(){ 
17013		   waypoints();
17014		   flickityInit();
17015		},100); 
17016		if($('body[data-animated-anchors="true"]').length > 0) setTimeout(scrollSpyInit,200);
17017		socialSharingInit();
17018		hotSpotHoverBind();
17019		pricingTableHeight();
17020		createTestimonialControls();
17021		imageWithHotspotClickEvents();
17022		testimonialSliderHeight(); 
17023		largeIconHover();
17024		if($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length == 0) {
17025			fullscreenMenuInit();
17026		}
17027		boxRollMouseWheelInit();
17028		midnightInit();
17029		responsiveVideoIframesInit();
17030		responsiveVideoIframes();
17031		fullWidthContentColumns();
17032		videoBGInit();
17033		$window.unbind('scroll.parallaxSections').unbind('resize.parallaxSections');
17034		parallaxScrollInit();
17035		
17036		$blog_containers = [];
17037		$('.posts-container').each(function(i){
17038			$blog_containers[i] = $(this);
17039		});
17040		
17041		nectarAccountPageTabs();
17042		masonryBlogInit();
17043		masonryPortfolioInit();
17044		portfolioAccentColor();
17045		portfolioHoverEffects();
17046		portfolioFiltersInit();
17047		style6Img();
17048		isotopeCatSelection();
17049		$(window).unbind('.infscr');
17050		infiniteScrollInit();
17051		toTopBind();
17052		centerLove();
17053		postNextButtonEffect();
17054		pageLoadHash();
17055		slideOutWidgetAreaScrolling();
17056		
17057		//search results
17058		if($('body.search-results').length > 0 && $('#search-results article').length > 0) { searchResultMasonry(); }
17059		
17060		//cf7
17061		if($().wpcf7InitForm) $('div.wpcf7 > form').wpcf7InitForm();
17062
17063		//woocommerce price slider
17064		wooPriceSlider();
17065
17066		//twitter widget 
17067		if(typeof twttr != 'undefined') { twttr.widgets.load(); }
17068
17069		//Calendarize.it
17070		if(typeof init_rhc === 'function') { init_rhc(); }
17071
17072		//unwrap post and protfolio videos
17073		$('.video-wrap iframe').unwrap();
17074		$('#sidebar iframe[src]').unwrap();
17075
17076		$('video:not(.slider-video)').attr('width','100%');
17077		$('video:not(.slider-video)').attr('height','100%'); 
17078
17079		$('.wp-video-shortcode.mejs-container').each(function(){
17080			$(this).attr('data-aspectRatio', parseInt($(this).css('height')) / parseInt($(this).css('width')));
17081		});
17082
17083		//mediaElement
17084		$('video.wp-media-shortcode-ajax, audio.wp-media-shortcode-ajax').each(function(){ 
17085			if(!$(this).parent().hasClass('mejs-mediaelement') && $().mediaelementplayer) {
17086				$(this).mediaelementplayer();  
17087			}
17088		});
17089
17090		$('.mejs-container').css({'height': '100%', 'width': '100%'});
17091		
17092		$('audio').attr('width','100%');
17093		$('audio').attr('height','100%');
17094
17095		$('audio').css('visibility','visible');
17096
17097		if($('body').hasClass('mobile')){
17098			$('video').css('visibility','hidden');
17099		} else {
17100			$('video').css('visibility','visible');
17101		}
17102
17103		$('.wpb_row:has(".nectar-video-wrap")').each(function(i){
17104			$(this).css('z-index',100 + i);
17105		});
17106
17107		mouseParallaxInit();
17108
17109		//chrome self hosted slider bg video correct
17110		 if(navigator.userAgent.indexOf('Chrome') > 0) { 
17111		 	$('.swiper-wrapper .video-wrap').each(function(i){
17112			  	var webmSource = jQuery(this).find('video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
17113	          	var firstVideo = jQuery(this).find('video').get(0);
17114	          	firstVideo.src = webmSource;
17115	          	firstVideo.load();
17116            });
17117	    }
17118
17119
17120		if($('.nectar-video-bg').length > 0) {
17121			setTimeout(function(){
17122			    	resizeVideoToCover();
17123			    	$('.video-color-overlay').each(function(){
17124			    		$(this).css('background-color',$(this).attr('data-color'));
17125			    	});
17126			    	$('.nectar-video-wrap').transition({'opacity':'1'},0);
17127			    	$('.video-color-overlay').transition({'opacity':'0.7'},0);
17128			    	
17129			    },400);
17130		}
17131
17132		
17133		nectarPageHeader();
17134	
17135
17136		//cart dropdown
17137		$('#header-outer div.cart-outer').hoverIntent(function(){
17138			$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).fadeIn(400);
17139			$('#header-outer .cart_list').stop(true,true).fadeIn(400);
17140			clearTimeout(timeout);
17141			$('#header-outer .cart-notification').fadeOut(300);
17142		});
17143
17144
17145		//remove excess loading images now
17146		$('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();
17147
17148		setTimeout(portfolioSidebarFollow,250);
17149		setTimeout(portfolioSidebarFollow,500);
17150		setTimeout(portfolioSidebarFollow,1000);
17151
17152		crossBrowserFixes();
17153
17154
17155		$(window).trigger('resize');
17156
17157		//fix admin bar
17158		$("#wpadminbar").show();	
17159
17160
17161		//close widget area
17162		if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click'); 
17163
17164		if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
17165			closeSearch();
17166			$('#ajax-loading-screen').removeClass('in-from-right').removeClass('loaded');
17167			setTimeout(function(){ $('#ajax-loading-screen').addClass('loaded'); },30);
17168		} else {
17169			//fade in page
17170			setTimeout(function(){ $('#ajax-loading-screen').stop(true,true).fadeOut(500, function(){ $('#ajax-loading-screen .loading-icon').css({'opacity':0}); }); closeSearch();  },200);
17171			setTimeout(function(){ $('#ajax-loading-screen').stop(true,true).fadeOut(500, function(){ $('#ajax-loading-screen .loading-icon').css({'opacity':0}); }); closeSearch(); },900);
17172		}
17173	} 
17174
17175
17176
17177(function($){
17178	if(!$.fn.textareaCount) { 
17179		$.fn.textareaCount = function(options, fn) {
17180	        var defaults = {
17181				maxCharacterSize: -1,
17182				originalStyle: 'originalTextareaInfo',
17183				warningStyle: 'warningTextareaInfo',
17184				warningNumber: 20,
17185				displayFormat: '#input characters | #words words'
17186			};
17187
17188			var options = $.extend(defaults, options);
17189
17190			var container = $(this);
17191
17192			$("<div class='charleft'>&nbsp;</div>").insertAfter(container);
17193
17194
17195			//create charleft css
17196			var charLeftCss = {
17197				'width' : container.width()
17198			};
17199
17200			var charLeftInfo = getNextCharLeftInformation(container);
17201			charLeftInfo.addClass(options.originalStyle);
17202			//charLeftInfo.css(charLeftCss);
17203
17204
17205			var numInput = 0;
17206			var maxCharacters = options.maxCharacterSize;
17207			var numLeft = 0;
17208			var numWords = 0;
17209
17210			container.on('keyup', function(event){limitTextAreaByCharacterCount();})
17211					 .on('mouseover', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);})
17212					 .on('paste', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);});
17213
17214	        limitTextAreaByCharacterCount();
17215
17216			function limitTextAreaByCharacterCount(){
17217				charLeftInfo.html(countByCharacters());
17218
17219				//function call back
17220				if(typeof fn != 'undefined'){
17221					fn.call(this, getInfo());
17222				}
17223				return true;
17224			}
17225
17226			function countByCharacters(){
17227				var content = container.val();
17228				var contentLength = content.length;
17229				//Start Cut
17230				if(options.maxCharacterSize > 0){
17231					//If copied content is already more than maxCharacterSize, chop it to maxCharacterSize.
17232					if(contentLength >= options.maxCharacterSize) {
17233						content = content.substring(0, options.maxCharacterSize);
17234					}
17235
17236					var newlineCount = getNewlineCount(content);
17237
17238					// newlineCount new line character. For windows, it occupies 2 characters
17239					var systemmaxCharacterSize = options.maxCharacterSize - newlineCount;
17240					if (!isWin()){
17241						 systemmaxCharacterSize = options.maxCharacterSize
17242					}
17243					if(contentLength > systemmaxCharacterSize){
17244						//avoid scroll bar moving
17245						var originalScrollTopPosition = this.scrollTop;
17246						container.val(content.substring(0, systemmaxCharacterSize));
17247						this.scrollTop = originalScrollTopPosition;
17248					}
17249					charLeftInfo.removeClass(options.warningStyle);
17250					if(systemmaxCharacterSize - contentLength <= options.warningNumber){
17251						charLeftInfo.addClass(options.warningStyle);
17252					}
17253
17254					numInput = container.val().length + newlineCount;
17255					if(!isWin()){
17256						numInput = container.val().length;
17257					}
17258
17259					numWords = countWord(getCleanedWordString(container.val()));
17260
17261					numLeft = maxCharacters - numInput;
17262				} else {
17263					//normal count, no cut
17264					var newlineCount = getNewlineCount(content);
17265					numInput = container.val().length + newlineCount;
17266					if(!isWin()){
17267						numInput = container.val().length;
17268					}
17269					numWords = countWord(getCleanedWordString(container.val()));
17270				}
17271
17272				return formatDisplayInfo();
17273			}
17274
17275			function formatDisplayInfo(){
17276				var format = options.displayFormat;
17277				format = format.replace('#input', numInput);
17278				format = format.replace('#words', numWords);
17279				//When maxCharacters <= 0, #max, #left cannot be substituted.
17280				if(maxCharacters > 0){
17281					format = format.replace('#max', maxCharacters);
17282					format = format.replace('#left', numLeft);
17283				}
17284				return format;
17285			}
17286
17287			function getInfo(){
17288				var info = {
17289					input: numInput,
17290					max: maxCharacters,
17291					left: numLeft,
17292					words: numWords
17293				};
17294				return info;
17295			}
17296
17297			function getNextCharLeftInformation(container){
17298					return container.next('.charleft');
17299			}
17300
17301			function isWin(){
17302				var strOS = navigator.appVersion;
17303				if (strOS.toLowerCase().indexOf('win') != -1){
17304					return true;
17305				}
17306				return false;
17307			}
17308
17309			function getNewlineCount(content){
17310				var newlineCount = 0;
17311				for(var i=0; i<content.length;i++){
17312					if(content.charAt(i) == '\n'){
17313						newlineCount++;
17314					}
17315				}
17316				return newlineCount;
17317			}
17318
17319			function getCleanedWordString(content){
17320				var fullStr = content + " ";
17321				var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
17322				var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
17323				var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
17324				var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
17325				var splitString = cleanedStr.split(" ");
17326				return splitString;
17327			}
17328
17329			function countWord(cleanedWordString){
17330				var word_count = cleanedWordString.length-1;
17331				return word_count;
17332			}
17333		};
17334	}
17335})(jQuery);	
17336	
17337	
17338	
17339	
17340});
17341
17342
17343 }(window.jQuery, window, document));
17344
17345
17346function resizeIframe() {
17347	var element = document.getElementById("pp_full_res").getElementsByTagName("iframe");
17348	var height = element[0].contentWindow.document.body.scrollHeight;
17349    
17350    //iframe height
17351    element[0].style.height = height + 'px';
17352	
17353	//pp height
17354	document.getElementsByClassName("pp_content_container")[0].style.height = height+40+ 'px';
17355	document.getElementsByClassName("pp_content")[0].style.height = height+40+ 'px';
17356	
17357}
17358
17359
17360
17361/*!
17362 * hoverIntent v1.9.0 // 2017.09.01 // jQuery v1.7.0+
17363 * http://briancherne.github.io/jquery-hoverIntent/
17364 *
17365 * You may use hoverIntent under the terms of the MIT license. Basically that
17366 * means you are free to use hoverIntent as long as this header is left intact.
17367 * Copyright 2007-2017 Brian Cherne
17368 */
17369!function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery"],factory):jQuery&&!jQuery.fn.hoverIntent&&factory(jQuery)}(function($){"use strict";var cX,cY,_cfg={interval:100,sensitivity:6,timeout:0},INSTANCE_COUNT=0,track=function(ev){cX=ev.pageX,cY=ev.pageY},compare=function(ev,$el,s,cfg){if(Math.sqrt((s.pX-cX)*(s.pX-cX)+(s.pY-cY)*(s.pY-cY))<cfg.sensitivity)return $el.off(s.event,track),delete s.timeoutId,s.isActive=!0,ev.pageX=cX,ev.pageY=cY,delete s.pX,delete s.pY,cfg.over.apply($el[0],[ev]);s.pX=cX,s.pY=cY,s.timeoutId=setTimeout(function(){compare(ev,$el,s,cfg)},cfg.interval)},delay=function(ev,$el,s,out){return delete $el.data("hoverIntent")[s.id],out.apply($el[0],[ev])};$.fn.hoverIntent=function(handlerIn,handlerOut,selector){var instanceId=INSTANCE_COUNT++,cfg=$.extend({},_cfg);$.isPlainObject(handlerIn)?(cfg=$.extend(cfg,handlerIn),$.isFunction(cfg.out)||(cfg.out=cfg.over)):cfg=$.isFunction(handlerOut)?$.extend(cfg,{over:handlerIn,out:handlerOut,selector:selector}):$.extend(cfg,{over:handlerIn,out:handlerIn,selector:handlerOut});var handleHover=function(e){var ev=$.extend({},e),$el=$(this),hoverIntentData=$el.data("hoverIntent");hoverIntentData||$el.data("hoverIntent",hoverIntentData={});var state=hoverIntentData[instanceId];state||(hoverIntentData[instanceId]=state={id:instanceId}),state.timeoutId&&(state.timeoutId=clearTimeout(state.timeoutId));
17369var mousemove=state.event="mousemove.hoverIntent.hoverIntent"+instanceId;if("mouseenter"===e.type){if(state.isActive)return;state.pX=ev.pageX,state.pY=ev.pageY,$el.off(mousemove,track).on(mousemove,track),state.timeoutId=setTimeout(function(){compare(ev,$el,state,cfg)},cfg.interval)}else{if(!state.isActive)return;$el.off(mousemove,track),state.timeoutId=setTimeout(function(){delay(ev,$el,state,cfg.out)},cfg.timeout)}};return this.on({"mouseenter.hoverIntent":handleHover,"mouseleave.hoverIntent":handleHover},cfg.selector)}});

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.