PageSourceSearch

https://getmusicplays.com/wp-content/themes/pinakincode/js/init.js?ver=8.5.6

js getmusicplays.com collected 2026-10-05 23:37:09 UTC 639,344 bytes, 15,773 lines download raw bytes

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/*	1.	Plugin Init
17/*-------------------------------------------------------------------------*/
18
19/*!
20 * imagesLoaded PACKAGED v3.1.1
21 * JavaScript is all like "You images are done yet or what?"
22 * MIT License
23 */
24
25(function(){function e(){}function t(e,t){for(var n=e.length;n--;)if(e[n].listener===t)return n;return-1}function n(e){return function(){return this[e].apply(this,arguments)}}var i=e.prototype,r=this,o=r.EventEmitter;i.getListeners=function(e){var t,n,i=this._getEvents();if("object"==typeof e){t={};for(n in i)i.hasOwnProperty(n)&&e.test(n)&&(t[n]=i[n])}else t=i[e]||(i[e]=[]);return t},i.flattenListeners=function(e){var t,n=[];for(t=0;e.length>t;t+=1)n.push(e[t].listener);return n},i.getListenersAsObject=function(e){var t,n=this.getListeners(e);return n instanceof Array&&(t={},t[e]=n),t||n},i.addListener=function(e,n){var i,r=this.getListenersAsObject(e),o="object"==typeof n;for(i in r)r.hasOwnProperty(i)&&-1===t(r[i],n)&&r[i].push(o?n:{listener:n,once:!1});return this},i.on=n("addListener"),i.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},i.once=n("addOnceListener"),i.defineEvent=function(e){return this.getListeners(e),this},i.defineEvents=function(e){for(var t=0;e.length>t;t+=1)this.defineEvent(e[t]);return this},i.removeListener=function(e,n){var i,r,o=this.getListenersAsObject(e);for(r in o)o.hasOwnProperty(r)&&(i=t(o[r],n),-1!==i&&o[r].splice(i,1));return this},i.off=n("removeListener"),i.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},i.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},i.manipulateListeners=function(e,t,n){var i,r,o=e?this.removeListener:this.addListener,s=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(i=n.length;i--;)o.call(this,t,n[i]);else for(i in t)t.hasOwnProperty(i)&&(r=t[i])&&("function"==typeof r?o.call(this,i,r):s.call(this,i,r));return this},i.removeEvent=function(e){var t,n=typeof e,i=this._getEvents();if("string"===n)delete i[e];else if("object"===n)for(t in i)i.hasOwnProperty(t)&&e.test(t)&&delete i[t];else delete this._events;return this},i.removeAllListeners=n("removeEvent"),i.emitEvent=function(e,t){var n,i,r,o,s=this.getListenersAsObject(e);for(r in s)if(s.hasOwnProperty(r))for(i=s[r].length;i--;)n=s[r][i],n.once===!0&&this.removeListener(e,n.listener),o=n.listener.apply(this,t||[]),o===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},i.trigger=n("emitEvent"),i.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},i.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},i._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},i._getEvents=function(){return this._events||(this._events={})},e.noConflict=function(){return r.EventEmitter=o,e},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return e}):"object"==typeof module&&module.exports?module.exports=e:this.EventEmitter=e}).call(this),function(e){function t(t){var n=e.event;return n.target=n.target||n.srcElement||t,n}var n=document.documentElement,i=function(){};n.addEventListener?i=function(e,t,n){e.addEventListener(t,n,!1)}:n.attachEvent&&(i=function(e,n,i){e[n+i]=i.handleEvent?function(){var n=t(e);i.handleEvent.call(i,n)}:function(){var n=t(e);i.call(e,n)},e.attachEvent("on"+n,e[n+i])});var r=function(){};n.removeEventListener?r=function(e,t,n){e.removeEventListener(t,n,!1)}:n.detachEvent&&(r=function(e,t,n){e.detachEvent("on"+t,e[t+n]);try{delete e[t+n]}catch(i){e[t+n]=void 0}});var o={bind:i,unbind:r};"function"==typeof define&&define.amd?define("eventie/eventie",o):e.eventie=o}(this),function(e){function t(e,t){for(var n in t)e[n]=t[n];return e}function n(e){return"[object Array]"===f.call(e)}function i(e){var t=[];if(n(e))t=e;else if("number"==typeof e.length)for(var i=0,r=e.length;r>i;i++)t.push(e[i]);else t.push(e);return t}function r(e,n){function r(e,n,s){if(!(this instanceof r))return new r(e,n);"string"==typeof e&&(e=document.querySelectorAll(e)),this.elements=i(e),this.options=t({},this.options),"function"==typeof n?s=n:t(this.options,n),s&&this.on("always",s),this.getImages(),o&&(this.jqDeferred=new o.Deferred);var c=this;setTimeout(function(){c.check()})}function f(e){this.img=e}function a(e){this.src=e,h[e]=this}r.prototype=new e,r.prototype.options={},r.prototype.getImages=function(){this.images=[];for(var e=0,t=this.elements.length;t>e;e++){var n=this.elements[e];"IMG"===n.nodeName&&this.addImage(n);for(var i=n.querySelectorAll("img"),r=0,o=i.length;o>r;r++){var s=i[r];this.addImage(s)}}},r.prototype.addImage=function(e){var t=new f(e);this.images.push(t)},r.prototype.check=function(){function e(e,r){return t.options.debug&&c&&s.log("confirm",e,r),t.progress(e),n++,n===i&&t.complete(),!0}var t=this,n=0,i=this.images.length;if(this.hasAnyBroken=!1,!i)return this.complete(),void 0;for(var r=0;i>r;r++){var o=this.images[r];o.on("confirm",e),o.check()}},r.prototype.progress=function(e){this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded;var t=this;setTimeout(function(){t.emit("progress",t,e),t.jqDeferred&&t.jqDeferred.notify(t,e)})},r.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0;var t=this;setTimeout(function(){if(t.emit(e,t),t.emit("always",t),t.jqDeferred){var n=t.hasAnyBroken?"reject":"resolve";t.jqDeferred[n](t)}})},o&&(o.fn.imagesLoaded=function(e,t){var n=new r(this,e,t);return n.jqDeferred.promise(o(this))}),f.prototype=new e,f.prototype.check=function(){var e=h[this.img.src]||new a(this.img.src);if(e.isConfirmed)return this.confirm(e.isLoaded,"cached was confirmed"),void 0;
vendor: 10,035 bytes, lines 25-31
25if(this.img.complete&&void 0!==this.img.naturalWidth)return this.confirm(0!==this.img.naturalWidth,"naturalWidth"),void 0;var t=this;e.on("confirm",function(e,n){return t.confirm(e.isLoaded,n),!0}),e.check()},f.prototype.confirm=function(e,t){this.isLoaded=e,this.emit("confirm",this,t)};var h={};return a.prototype=new e,a.prototype.check=function(){if(!this.isChecked){var e=new Image;n.bind(e,"load",this),n.bind(e,"error",this),e.src=this.src,this.isChecked=!0}},a.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},a.prototype.onload=function(e){this.confirm(!0,"onload"),this.unbindProxyEvents(e)},a.prototype.onerror=function(e){this.confirm(!1,"onerror"),this.unbindProxyEvents(e)},a.prototype.confirm=function(e,t){this.isConfirmed=!0,this.isLoaded=e,this.emit("confirm",this,t)},a.prototype.unbindProxyEvents=function(e){n.unbind(e.target,"load",this),n.unbind(e.target,"error",this)},r}var o=e.jQuery,s=e.console,c=s!==void 0,f=Object.prototype.toString;"function"==typeof define&&define.amd?define(["eventEmitter/EventEmitter","eventie/eventie"],r):e.imagesLoaded=r(e.EventEmitter,e.eventie)}(window);	
26
27
28/*!
29Waypoints - 4.0.1
30*/
31!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))}();
vendor: 4,679 bytes, lines 32-44
32
33//visible
34!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);
35
36
37/*
38* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
39*/
40jQuery.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}})
41
42
43/*! Mousewheel by Brandon Aaron (http://brandon.aaron.sh) */
44!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
44),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)}})});
45
46(function($, window, document) {
47
48
49
50jQuery(document).ready(function($){
51	
52
53/***************** Lightbox Init ******************/
54	
55	function fancyBoxInit() {
56		//convert old pp links
57		$('a.pp').removeClass('pp').attr('data-fancybox','');
58		$("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])").removeAttr('rel').attr('data-fancybox','');
59		
60		//image gallery nectar
61		$('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function(){
62			var $unique_id = Math.floor(Math.random()*10000);
63			$(this).find('.swiper-slide a:not(.ext-url-link)').attr('data-fancybox','group_'+$unique_id);
64		});
65		
66		//flex
67		$('.wpb_gallery_slides.wpb_flexslider').each(function(){
68			var $unique_id = Math.floor(Math.random()*10000);
69			$(this).find('.slides > li > a').attr('data-fancybox','group_'+$unique_id);
70		});
71		
72		//touch enabled gal
73		$('.wpb_gallery_slidesflickity_style').each(function(){
74			var $unique_id = Math.floor(Math.random()*10000);
75			$(this).find('.cell > a:not(.ext-url-link)').attr('data-fancybox','group_'+$unique_id);
76		});
77		
78		//add galleries to portfolios
79		$('.portfolio-items, .wpb_gallery .parallax-grid-item').each(function(){
80			var $unique_id = Math.floor(Math.random()*10000);
81			if($(this).find('.pretty_photo').length > 0) {
82				$(this).find('.pretty_photo').removeClass('pretty_photo').attr('data-fancybox','group_'+$unique_id);
83			} else if($(this).find('a[rel*="prettyPhoto["]').length > 0){
84				$(this).find('a[rel*="prettyPhoto["]').removeAttr('rel').attr('data-fancybox','group_'+$unique_id);
85			}
86
87		});
88		
89		//nectar auto lightbox
90		if($('body').hasClass('nectar-auto-lightbox')){
91			$('.gallery').each(function(){
92				if($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) {
93					var $unique_id = Math.floor(Math.random()*10000);
94					$(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');
95				}
96			});
97			$('.main-content img').each(function(){
98				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) {
99					var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/);
100					if(match) $(this).parent().attr('data-fancybox','');
101				} 
102			});
103		}
104		
105		//regular
106		fbMarginArr = ($('body.admin-bar').length > 0) ? [60,100] : [60,100];
107		if(window.innerWidth < 1000) {
108			fbMarginArr = [0,0];
109		}
110		$("[data-fancybox]").fancybox({
111			animationEffect : "zoom-in-out",
112			animationDuration : 350,
113			buttons : [
114        //'slideShow',
115        'fullScreen',
116        //'thumbs',
117        //'share',
118        //'download',
119        'zoom',
120        'close'
121    	],
122			margin : fbMarginArr,
123			loop     : true,
124			caption : function( instance, item ) {
125				return $(this).attr('title');
126			},
127			beforeLoad: function(instance,current) {
128				//when there's nothing to load
129				if(typeof instance.current.src !== 'string') {  $.fancybox.close(true);  }
130			},
131			mobile : {
132				margin   : 0
133			}
134		});
135	}
136	
137	
138	function magnificInit() {
139		
140		//convert old pp links
141		$('a.pp').removeClass('pp').addClass('magnific-popup');
142		$("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])").removeAttr('rel').addClass('magnific-popup');
143
144
145		//image gallery nectar
146		$('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function(){
147			var $unique_id = Math.floor(Math.random()*10000);
148			$(this).find('.swiper-slide a:not(.ext-url-link)').addClass('pretty_photo');
149		});
150
151		//flex
152		$('.wpb_gallery_slides.wpb_flexslider').each(function(){
153			var $unique_id = Math.floor(Math.random()*10000);
154			$(this).find('.slides > li > a').addClass('pretty_photo');
155		});
156		//touch enabled gal
157		$('.wpb_gallery_slidesflickity_style').each(function(){
158			var $unique_id = Math.floor(Math.random()*10000);
159			$(this).find('.cell > a:not(.ext-url-link)').addClass('pretty_photo');
160		});
161
162		//add galleries to portfolios
163		$('.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(){
164			if($(this).find('.pretty_photo').length > 0) {
165				$(this).find('.pretty_photo').removeClass('pretty_photo').addClass('gallery').addClass('magnific');
166			} else if($(this).find('a[rel*="prettyPhoto["]').length > 0){
167				$(this).find('a[rel*="prettyPhoto["]').removeAttr('rel').addClass('gallery').addClass('magnific');
168			}
169
170		});
171		
172		$("a[data-rel='prettyPhoto[product-gallery]']").each(function(){
173			$(this).removeAttr('data-rel').addClass('magnific').addClass('gallery');
174		});
175		
176		//nectar auto lightbox
177		if($('body').hasClass('nectar-auto-lightbox')){
178			$('.gallery').each(function(){
179				if($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) {
180					var $unique_id = Math.floor(Math.random()*10000);
181					$(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');
182				}
183			});
184			$('.main-content img').each(function(){
185				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) {
186					var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/);
187					if(match) $(this).parent().addClass('magnific-popup').addClass('image-link');
188				} 
189			});
190		}
191		
192
193		//regular
194		$('a.magnific-popup:not(.gallery):not(.nectar_video_lightbox)').magnificPopup({ 
195			type: 'image', 
196			callbacks: {
197				
198				imageLoadComplete: function()  {	
199					var $that = this;
200					setTimeout( function() { $that.wrap.addClass('mfp-image-loaded'); }, 10);
201				},
202				beforeOpen: function() {
203				    this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
204			    },
205			    open: function() {
206					    	
207					$.magnificPopup.instance.next = function() {
208						var $that = this;
209
210						this.wrap.removeClass('mfp-image-loaded');
211						setTimeout( function() { $.magnificPopup.proto.next.call($that); }, 100);
212					}
213
214					$.magnificPopup.instance.prev = function() {
215						var $that = this;
216
217						this.wrap.removeClass('mfp-image-loaded');
218						setTimeout( function() { $.magnificPopup.proto.prev.call($that); }, 100);
219					}
220					
221				}
222			},
223			fixedContentPos: false,
224		    mainClass: 'mfp-zoom-in', 
225		    removalDelay: 400 
226		});
227
228		//video
229		$('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({ 
230			type: 'iframe', 
231			fixedContentPos: false,
232		    mainClass: 'mfp-zoom-in', 
233		    removalDelay: 400 
234		});
235
236
237		//galleries
238		$('a.magnific.gallery').each(function(){
239
240			var $parentRow = ($(this).closest('.wpb_column').length > 0) ? $(this).closest('.wpb_column') : $(this).parents('.row');
241			if($parentRow.length > 0 && !$parentRow.hasClass('lightbox-col')) {
242
243				$parentRow.magnificPopup({
244					type: 'image',
245					delegate: 'a.magnific',
246					mainClass: 'mfp-zoom-in',
247					fixedContentPos: false,
248					callbacks: {
249
250						elementParse: function(item) {
251			
252							 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 ) {
253						         item.type = 'iframe';
254						      } else if ($(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('video-popup-') != -1) {
255						      	item.type = 'inline';
256						      } else {
257						         item.type = 'image';
258						      }
259						},
260
261						imageLoadComplete: function()  {	
262							var $that = this;
263							setTimeout( function() { $that.wrap.addClass('mfp-image-loaded'); }, 10);
264						},
265
266						beforeOpen: function() {
267					       this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
268					    },
269
270					    open: function() {
271					    	
272
273					    	//self hosted video
274					    	if($(this.content).find('.mejs-video video').length > 0 && $().mediaelementplayer ) {
275	            				$(this.content).find('.mejs-video video')[0].player.remove();
276	            				
277	            				var $that = this;
278	            				setTimeout(function(){
279	            					$($that.content).find('video').mediaelementplayer();
280	            					$($that.content).find('.mejs-video video')[0].player.play();
281	            				},50);
282	            				
283	            			}
284
285							$.magnificPopup.instance.next = function() {
286								var $that = this;
287
288								this.wrap.removeClass('mfp-image-loaded');
289								setTimeout( function() { 
290									$.magnificPopup.proto.next.call($that); 
291
292									//self hosted video
293									if($($that.content).find('.mejs-video video').length > 0) {
294			            				$($that.content).find('.mejs-video video')[0].play();
295			            			}
296
297								}, 100);
298							}
299
300							$.magnificPopup.instance.prev = function() {
301								var $that = this;
302
303								this.wrap.removeClass('mfp-image-loaded');
304								setTimeout( function() { 
305									$.magnificPopup.proto.prev.call($that); 
306
307									//self hosted video
308									if($($that.content).find('.mejs-video video').length > 0) {
309			            				$($that.content).find('.mejs-video video')[0].play();
310			            			}
311								}, 100);
312							}
313							
314						},
315
316						close: function() {
317							//self hosted video
318					    	if($(this.content).find('.mejs-video video').length > 0) {
319	            				 $(this.content).find('.mejs-video video')[0].load();
320	            			}
321						}
322					},
323					removalDelay: 400, 
324					gallery: {
325			          enabled:true
326			        }
327				});
328
329				$parentRow.addClass('lightbox-col');
330			}
331			
332		});
333
334	}
335
336	function lightBoxInit() {
337		if($('body[data-ls="magnific"]').length > 0 || $('body[data-ls="pretty_photo"]').length > 0 ) {
338			magnificInit();
339		} else if($('body[data-ls="fancybox"]').length > 0) {
340			fancyBoxInit();
341		}
342	}
343
344	lightBoxInit();
345	//check for late links
346	setTimeout(lightBoxInit,500);
347	
348/*!
349 * jQuery Transit - CSS3 transitions and transformations
350 * (c) 2011-2012 Rico Sta. Cruz <[email protected]>
351 * MIT Licensed.
352 *
353 * http://ricostacruz.com/jquery.transit
354 * http://github.com/rstacruz/jquery.transit
355 */
356(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
356)",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")}
356this.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);
357
358
359
360
361  // ========================= smartresize ===============================
362
363  /*
364   * smartresize: debounced resize event for jQuery
365   *
366   * latest version and complete README available on Github:
367   * https://github.com/louisremi/jquery.smartresize.js
368   *
369   * Copyright 2011 @louis_remi
370   * Licensed under the MIT license.
371   */
372
373  var $event = $.event,
374      dispatchMethod = $.event.handle ? 'handle' : 'dispatch',
375      resizeTimeout;
376
377  $event.special.smartresize = {
378    setup: function() {
379      $(this).bind( "resize", $event.special.smartresize.handler );
380    },
381    teardown: function() {
382      $(this).unbind( "resize", $event.special.smartresize.handler );
383    },
384    handler: function( event, execAsap ) {
385      // Save the context
386      var context = this,
387          args = arguments;
388
389      // set correct event type
390      event.type = "smartresize";
391
392      if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
393      resizeTimeout = setTimeout(function() {
394        $event[ dispatchMethod ].apply( context, args );
395      }, execAsap === "execAsap"? 0 : 100 );
396    }
397  };
398
399  $.fn.smartresize = function( fn ) {
400    return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
401  };
402
403
404/***************** Global vars ******************/
405var $standAnimatedColTimeout = [];
406var $animatedSVGIconTimeout = [];
407var $svg_icons = [];
408var $nectarCustomSliderRotate;
409
410/***************** Smooth Scrolling ******************/
411
412	function niceScrollInit(){
413		$("html").niceScroll({
414			scrollspeed: 60,
415			mousescrollstep: 40,
416			cursorwidth: 15,
417			cursorborder: 0,
418			cursorcolor: '#303030',
419			cursorborderradius: 6,
420			autohidemode: false,
421			horizrailenabled: false
422		});
423		
424		
425		if($('#boxed').length == 0){
426			$('body, body #header-outer, body #header-secondary-outer, body #search-outer').css('padding-right','16px');
427		} else if($('body[data-ext-responsive="true"]').length == 0 ) {
428			$('body').css('padding-right','16px');
429		}
430		
431		$('html').addClass('no-overflow-y');
432	}
433
434	var $smoothActive = $('body').attr('data-smooth-scrolling'); 
435	var $smoothCache = ( $smoothActive == 1 ) ? true : false;
436	
437	if( $smoothActive == 1 && $(window).width() > 690 && $('body').outerHeight(true) > $(window).height() && Modernizr.csstransforms3d && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){ niceScrollInit(); } else {
438		$('body').attr('data-smooth-scrolling','0');
439	}
440	
441	//chrome ss
442	if($smoothCache == false && $('body.material').length == 0 && navigator.platform.toUpperCase().indexOf('MAC') === -1 && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/) && $(window).width() > 690 && $('#nectar_fullscreen_rows').length == 0) {
443		!function(){function e(){var e=!1;e&&c("keydown",r),v.keyboardSupport&&!e&&u("keydown",r)}function t(){if(document.body){var t=document.body,n=document.documentElement,o=window.innerHeight,r=t.scrollHeight;if(S=document.compatMode.indexOf("CSS")>=0?n:t,w=t,e(),x=!0,top!=self)y=!0;else if(r>o&&(t.offsetHeight<=o||n.offsetHeight<=o)){var a=!1,i=function(){a||n.scrollHeight==document.height||(a=!0,setTimeout(function(){n.style.height=document.height+"px",a=!1},500))};if(n.style.height="auto",setTimeout(i,10),S.offsetHeight<=o){var l=document.createElement("div");l.style.clear="both",t.appendChild(l)}}v.fixedBackground||b||(t.style.backgroundAttachment="scroll",n.style.backgroundAttachment="scroll")}}function n(e,t,n,o){if(o||(o=1e3),d(t,n),1!=v.accelerationMax){var r=+new Date,a=r-C;if(a<v.accelerationDelta){var i=(1+30/a)/2;i>1&&(i=Math.min(i,v.accelerationMax),t*=i,n*=i)}C=+new Date}if(M.push({x:t,y:n,lastX:0>t?.99:-.99,lastY:0>n?.99:-.99,start:+new Date}),!T){var l=e===document.body,u=function(){for(var r=+new Date,a=0,i=0,c=0;c<M.length;c++){var s=M[c],d=r-s.start,f=d>=v.animationTime,h=f?1:d/v.animationTime;v.pulseAlgorithm&&(h=p(h));var m=s.x*h-s.lastX>>0,w=s.y*h-s.lastY>>0;a+=m,i+=w,s.lastX+=m,s.lastY+=w,f&&(M.splice(c,1),c--)}l?window.scrollBy(a,i):(a&&(e.scrollLeft+=a),i&&(e.scrollTop+=i)),t||n||(M=[]),M.length?N(u,e,o/v.frameRate+1):T=!1};N(u,e,0),T=!0}}function o(e){x||t();var o=e.target,r=l(o);if(!r||e.defaultPrevented||s(w,"embed")||s(o,"embed")&&/\.pdf/i.test(o.src))return!0;var a=e.wheelDeltaX||0,i=e.wheelDeltaY||0;return a||i||(i=e.wheelDelta||0),!v.touchpadSupport&&f(i)?!0:(Math.abs(a)>1.2&&(a*=v.stepSize/120),Math.abs(i)>1.2&&(i*=v.stepSize/120),n(r,-a,-i),void e.preventDefault())}function r(e){var t=e.target,o=e.ctrlKey||e.altKey||e.metaKey||e.shiftKey&&e.keyCode!==H.spacebar;if(/input|textarea|select|embed/i.test(t.nodeName)||t.isContentEditable||e.defaultPrevented||o)return!0;if(s(t,"button")&&e.keyCode===H.spacebar)return!0;var r,a=0,i=0,u=l(w),c=u.clientHeight;switch(u==document.body&&(c=window.innerHeight),e.keyCode){case H.up:i=-v.arrowScroll;break;case H.down:i=v.arrowScroll;break;case H.spacebar:r=e.shiftKey?1:-1,i=-r*c*.9;break;case H.pageup:i=.9*-c;break;case H.pagedown:i=.9*c;break;case H.home:i=-u.scrollTop;break;case H.end:var d=u.scrollHeight-u.scrollTop-c;i=d>0?d+10:0;break;case H.left:a=-v.arrowScroll;break;case H.right:a=v.arrowScroll;break;default:return!0}n(u,a,i),e.preventDefault()}function a(e){w=e.target}function i(e,t){for(var n=e.length;n--;)E[A(e[n])]=t;return t}function l(e){var t=[],n=S.scrollHeight;do{var o=E[A(e)];if(o)return i(t,o);if(t.push(e),n===e.scrollHeight){if(!y||S.clientHeight+10<n)return i(t,document.body)}else if(e.clientHeight+10<e.scrollHeight&&(overflow=getComputedStyle(e,"").getPropertyValue("overflow-y"),"scroll"===overflow||"auto"===overflow))return i(t,e)}while(e=e.parentNode)}function u(e,t,n){window.addEventListener(e,t,n||!1)}function c(e,t,n){window.removeEventListener(e,t,n||!1)}function s(e,t){return(e.nodeName||"").toLowerCase()===t.toLowerCase()}function d(e,t){e=e>0?1:-1,t=t>0?1:-1,(k.x!==e||k.y!==t)&&(k.x=e,k.y=t,M=[],C=0)}function f(e){if(e){e=Math.abs(e),D.push(e),D.shift(),clearTimeout(z);
443var t=h(D[0],120)&&h(D[1],120)&&h(D[2],120);return!t}}function h(e,t){return Math.floor(e/t)==e/t}function m(e){var t,n,o;return e*=v.pulseScale,1>e?t=e-(1-Math.exp(-e)):(n=Math.exp(-1),e-=1,o=1-Math.exp(-e),t=n+o*(1-n)),t*v.pulseNormalize}function p(e){return e>=1?1:0>=e?0:(1==v.pulseNormalize&&(v.pulseNormalize/=m(1)),m(e))}var w,g={frameRate:150,animationTime:500,stepSize:120,pulseAlgorithm:!0,pulseScale:8,pulseNormalize:1,accelerationDelta:20,accelerationMax:1,keyboardSupport:!0,arrowScroll:50,touchpadSupport:!0,fixedBackground:!0,excluded:""},v=g,b=!1,y=!1,k={x:0,y:0},x=!1,S=document.documentElement,D=[120,120,120],H={left:37,up:38,right:39,down:40,spacebar:32,pageup:33,pagedown:34,end:35,home:36},v=g,M=[],T=!1,C=+new Date,E={};setInterval(function(){E={}},1e4);var z,A=function(){var e=0;return function(t){return t.uniqueID||(t.uniqueID=e++)}}(),N=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(e,t,n){window.setTimeout(e,n||1e3/60)}}(),K=/chrome/i.test(window.navigator.userAgent),L=null;"onwheel"in document.createElement("div")?L="wheel":"onmousewheel"in document.createElement("div")&&(L="mousewheel"),L&&K&&(u(L,o),u("mousedown",a),u("load",t))}();
444	}
445
446
447
448
449
450
451
452/***************** Sliders ******************/
453
454	//gallery
455	function flexsliderInit(){
456		$('.flex-gallery').each(function(){
457			
458			var $that = $(this);
459			
460			imagesLoaded($(this),function(instance){
461			
462				 $that.flexslider({
463			        animation: 'fade',
464			        smoothHeight: false, 
465			        animationSpeed: 500,
466			        useCSS: false, 
467			        touch: true
468			    });
469				
470				////gallery slider add arrows
471				$('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="fa fa-angle-right"></i>');
472				$('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="fa fa-angle-left"></i>');
473			
474			});
475			
476		});
477	}
478	flexsliderInit();
479
480  
481
482
483	function flickityInit() {
484		if($('.nectar-flickity:not(.masonry)').length == 0) return false;
485
486		var $flickitySliders = [];
487
488		$('.nectar-flickity:not(.masonry)').each(function(i){
489			
490			$(this).addClass('instance-'+i);
491			
492			var $freeScrollBool = ($(this).is('[data-free-scroll]') && $(this).attr('data-free-scroll') == 'true') ? true : false;
493			var $groupCellsBool = true;
494			var $flickContainBool = true;
495			var $flcikAttr = 0.025;
496			
497			var $flickCellAlign = 'center';
498			if( $(this).is('[data-format="fixed_text_content_fullwidth"]') ) {
499					$flickCellAlign = 'left';
500					$groupCellsBool = false;
501					$flickContainBool = false;
502					$flcikAttr = 0.02;
503			}
504
505			if($freeScrollBool == true) {
506				 $groupCellsBool = false;
507			}
508
509			if($(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'next_prev_arrows') {
510				var $paginationBool = false;
511				var $nextPrevArrowBool = true;
512			} else {
513				var $paginationBool = true;
514				var $nextPrevArrowBool = false;
515			}
516
517			if($(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'none') {
518				var $paginationBool = false;
519				var $nextPrevArrowBool = false;
520			}
521
522			var $flickity_autoplay = false;
523			var $selectedAttraction = 0.025;
524
525			if($(this).is('[data-autoplay]') && $(this).attr('data-autoplay') == 'true') {
526				
527				$flickity_autoplay = true;
528				$selectedAttraction = 0.019;
529
530				if($(this).is('[data-autoplay-dur]') && $(this).attr('data-autoplay-dur').length > 0) {
531
532					if(parseInt($(this).attr('data-autoplay-dur')) > 100 && parseInt($(this).attr('data-autoplay-dur')) < 30000) {
533						$flickity_autoplay = parseInt($(this).attr('data-autoplay-dur'));
534					}
535					
536				}
537
538			}
539
540			var $that = $(this);
541
542			$flickitySliders[i] = new Flickity('.nectar-flickity.instance-'+i, {
543			  contain: $flickContainBool,
544			  draggable: true,
545			  lazyLoad: false,
546			  imagesLoaded: true,
547			  percentPosition: true,
548				cellAlign: $flickCellAlign,
549			  selectedAttraction: $selectedAttraction,
550			  groupCells: $groupCellsBool,
551			  prevNextButtons: $nextPrevArrowBool,
552			  freeScroll: $freeScrollBool,
553			  pageDots: $paginationBool,
554			  resize: true,
555				selectedAttraction: $flcikAttr,
556			  autoPlay: $flickity_autoplay,
557			  pauseAutoPlayOnHover: false,
558			  setGallerySize: true,
559			  wrapAround: true,
560			  accessibility: false,
561			  arrowShape: { 
562				     x0: 20,
563					  x1: 70, y1: 30,
564					  x2: 70, y2: 25,
565					  x3: 70
566				}
567			});
568			
569
570			if($(this).is('[data-format="fixed_text_content_fullwidth"]')) {
571				
572				var $onMobileBrowser = navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/);
573				
574				$flickitySliders[i].on( 'scroll', function() {
575					
576					if($onMobileBrowser) { return; }
577					
578					var $curFlkSlid = $flickitySliders[i];
579					var $flkSlideWidth = $that.find('.cell').outerWidth() + 25;
580					var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 275 : 0;
581					var $extraWindowSpace = ( ($(window).width() + $leftHeaderSize) - $that.parents('.main-content').width())/2;
582					$extraWindowSpace += parseInt($that.css('margin-left')) + 2;
583					$flickitySliders[i].slides.forEach( function( slide, j ) {
584
585							var $scaleAmt = 1;
586							var $translateXAmt = 0;
587							var $rotateAmt = 0;
588							var $slideZIndex = 10;
589							var $opacityAmt = 1;
590							
591							var $slideOffset = $(slide.cells[0].element).offset().left;
592							
593							var flkInstanceSlide = $('.nectar-flickity.instance-'+i+' .cell:nth-child('+ (j+1) +')');
594							
595							if($slideOffset - $extraWindowSpace < 0 && $slideOffset  - $extraWindowSpace > $flkSlideWidth*-1 ) {
596								$scaleAmt = 1 + ( ($slideOffset - $extraWindowSpace) / 1500);
597								$opacityAmt = 1 + ( ($slideOffset - $extraWindowSpace + 70) / 550);
598								$translateXAmt = ( ($slideOffset - $extraWindowSpace)) * -1;
599								$rotateAmt = ( ($slideOffset  - $extraWindowSpace) / 25) * -1;
600							} else {
601								$scaleAmt = 1;
602								$opacityAmt = 1;
603								$translateXAmt = 0;
604								$rotateAmt = 0;
605							}
606							
607							//handle z separately for an extra cushion of 5px in case
608							if($slideOffset + 5 - $extraWindowSpace < 0 && $slideOffset  - $extraWindowSpace > $flkSlideWidth*-1 ) {
609								$slideZIndex = 5;
610							} else {
611								$slideZIndex = 10;
612							}
613							
614							flkInstanceSlide.css({
615								'z-index' : $slideZIndex
616							});
617							
618							flkInstanceSlide.find('.inner-wrap-outer').css({
619								'transform': 'perspective(800px) translateX('+ $translateXAmt +'px) rotateY('+$rotateAmt+'deg) translateZ(0)',
620								'opacity' : $opacityAmt
621							});
622							
623							flkInstanceSlide.find('.inner-wrap').css({
624								'transform': 'scale('+ $scaleAmt +') translateZ(0)'
625							}); 
626							
627						  
628					
629					});
630				});
631				
632				
633			}
634
635			var $removeHiddenTimeout;
636
637			$flickitySliders[i].on( 'dragStart', function() {
638			   clearTimeout($removeHiddenTimeout);
639				 $that.addClass('is-dragging');
640			   $that.find('.flickity-prev-next-button').addClass('hidden');
641			});
642			$flickitySliders[i].on( 'dragEnd', function() {
643				$that.removeClass('is-dragging');
644				$removeHiddenTimeout = setTimeout(function(){
645					$that.find('.flickity-prev-next-button').removeClass('hidden');
646				},600);
647			 
648			});
649
650			$('.flickity-prev-next-button').on( 'click', function() {
651			   clearTimeout($removeHiddenTimeout);
652			   $(this).parents('.nectar-flickity').find('.flickity-prev-next-button').addClass('hidden');
653			   $removeHiddenTimeout = setTimeout(function(){
654					$that.find('.flickity-prev-next-button').removeClass('hidden');
655				},600);
656			});
657			
658			
659			//imgs loaded
660			if($that.hasClass('nectar-carousel')) {
661				imagesLoaded($that,function(instance){
662					nectarCarouselFlkEH($that);
663				});
664			}
665			
666
667		});
668		
669
670	}
671	
672	
673	setTimeout(flickityInit,100);
674	
675	
676	//nectar carousel flickity equal height
677	
678	////loop
679	function setNectarCarouselFlkEH() {
680			$('.nectar-carousel.nectar-flickity:not(.masonry)').each(function(){
681				  nectarCarouselFlkEH($(this));
682			});
683	}
684	
685	function nectarCarouselFlkEH($slider_instance) {
686			
687			var $tallestSlideCol = 0;
688			
689			$slider_instance.find('.flickity-slider > .cell').css('height','auto');
690			
691			$slider_instance.find('.flickity-slider > .cell').each(function(){
692				($(this).height() > $tallestSlideCol) ? $tallestSlideCol = $(this).height() : $tallestSlideCol = $tallestSlideCol;
693			});	
694			
695			//safety net incase height couldn't be determined
696			if($tallestSlideCol < 10) $tallestSlideCol = 'auto';
697
698			//set even height
699			$slider_instance.find('.flickity-slider > .cell').css('height',$tallestSlideCol+'px');
700
701	}
702	
703	
704
705
706	function flickityBlogInit() {
707		if($('.nectar-flickity.masonry.not-initialized').length == 0) return false;
708
709		$('.nectar-flickity.masonry.not-initialized').each(function(){
710
711			//move pos for large_featured
712			if($(this).parents('article').hasClass('large_featured')) 
713				$(this).insertBefore( $(this).parents('article').find('.content-inner') );
714			
715		});
716
717
718		$('.nectar-flickity.masonry.not-initialized').flickity({
719		  contain: true,
720		  draggable: false,
721		  lazyLoad: false,
722		  imagesLoaded: true,
723		  percentPosition: true,
724		  prevNextButtons: true,
725		  pageDots: false,
726		  resize: true,
727		  setGallerySize: true,
728		  wrapAround: true,
729		  accessibility: false
730		});
731
732		$('.nectar-flickity.masonry').removeClass('not-initialized');
733
734		//add count
735		$('.nectar-flickity.masonry:not(.not-initialized)').each(function(){
736
737			if($(this).find('.item-count').length == 0) {
738				
739				$('<div class="item-count"/>').insertBefore($(this).find('.flickity-prev-next-button.next'));
740				$(this).find('.item-count').html('<span class="current">1</span>/<span class="total">
740' + $(this).find('.flickity-slider .cell').length + '</span>');
741
742				$(this).find('.flickity-prev-next-button, .item-count').wrapAll('<div class="control-wrap" />');
743
744				//move pos for wide_tall
745				if($(this).parents('article').hasClass('wide_tall') && $(this).parents('.masonry.material').length == 0) 
746					$(this).find('.control-wrap').insertBefore( $(this) );
747			}
748		});
749
750		//update count
751		$('.masonry .flickity-prev-next-button.previous,  .masonry .flickity-prev-next-button.next').click(function(){
752			if($(this).parents('.wide_tall').length > 0) 
753				$(this).parent().find('.item-count .current').html($(this).parents('article').find('.nectar-flickity .cell.is-selected').index()+1);
754			else 
755				$(this).parent().find('.item-count .current').html($(this).parents('.nectar-flickity').find('.cell.is-selected').index()+1);
756		});
757
758		$('body').on('mouseover','.flickity-prev-next-button.next',function(){
759			$(this).parent().find('.flickity-prev-next-button.previous, .item-count').addClass('next-hovered');
760		});
761		$('body').on('mouseleave','.flickity-prev-next-button.next',function(){
762			$(this).parent().find('.flickity-prev-next-button.previous, .item-count').removeClass('next-hovered');
763		});
764	
765	}
766/****************twenty twenty******************/
767	$('.twentytwenty-container').each(function(){
768		var $that = $(this);
769		$(this).imagesLoaded(function(){
770			$that.twentytwenty();
771		});
772	});
773
774/****************full page******************/
775var $usingFullScreenRows = false;
776var $fullscreenSelector = '';
777var $disableFPonMobile = ($('#nectar_fullscreen_rows[data-mobile-disable]').length > 0) ? $('#nectar_fullscreen_rows').attr('data-mobile-disable') : 'off';
778var $onMobileBrowser = navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/);
779
780if(!$onMobileBrowser)
781	$disableFPonMobile = 'off';
782
783//change anchor link IDs for when disabled on mobile
784if($disableFPonMobile == 'on' && $('#nectar_fullscreen_rows').length > 0) {
785	$('#nectar_fullscreen_rows > .wpb_row[data-fullscreen-anchor-id]').each(function(){
786		if($(this).attr('data-fullscreen-anchor-id').length > 0)
787			$(this).attr('id',$(this).attr('data-fullscreen-anchor-id'));
788	});
789
790
791	//remove main content row padding
792	$('.container-wrap .main-content > .row').css({'padding-bottom':'0'});
793
794	//extra padding for first row is using transparent header
795	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') ) {
796		$('#nectar_fullscreen_rows > .wpb_row:nth-child(1)').addClass('extra-top-padding');
797	}
798}
799
800if($('#nectar_fullscreen_rows').length > 0 && $disableFPonMobile != 'on' || $().fullpage && $disableFPonMobile != 'on') {
801
802	function setFPNavColoring(index,direction) {
803			
804		  if($('#boxed').length > 0 && overallWidth > 750) return;
805		
806		  if($('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').find('.span_12.light').length > 0) {
807    		$('#fp-nav').addClass('light-controls');
808
809    		  if(direction == 'up')
810    			  $('#header-outer.dark-slide').removeClass('dark-slide');
811    		  else
812    		  	setTimeout(function(){ $('#header-outer.dark-slide').removeClass('dark-slide'); },520);
813    	} else {
814    		  $('#fp-nav.light-controls').removeClass('light-controls');
815
816    		  if(direction == 'up')
817    		  	$('#header-outer').addClass('dark-slide');
818    		  else
819    			  setTimeout(function(){ $('#header-outer').addClass('dark-slide'); },520);
820    	}
821			
822			//handle n slider coloring
823			 if($('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').find('.nectar-slider-wrap[data-fullscreen="true"]').length > 0) {
824				var $currentSlider = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').find('.nectar-slider-wrap[data-fullscreen="true"]');
825		
826				if( $currentSlider.is('[data-overall_style="directional"]') && $('#header-outer #logo span.dark').length > 0 ){
827					$('#header-outer').addClass('directional-nav-effect').removeClass('dne-disabled');
828				}
829				
830				if($currentSlider.find('.swiper-slide-active[data-color-scheme="light"]').length > 0) {
831					$('#header-outer').removeClass('dark-slide');
832				} else if($currentSlider.find('.swiper-slide-active[data-color-scheme="dark"]').length > 0) {
833					$('#header-outer').addClass('dark-slide');
834				}
835				
836			} else {
837				
838					$('#header-outer').removeClass('directional-nav-effect').addClass('dne-disabled');
839				
840			}
841			
842	}
843	
844	
845
846	var $anchors = [];
847	var $names = [];
848	
849	function setFPNames() {
850		$anchors = [];
851		$names = [];
852		$('#nectar_fullscreen_rows > .wpb_row').each(function(i){
853			$id = ($(this).is('[data-fullscreen-anchor-id]')) ? $(this).attr('data-fullscreen-anchor-id') : '';
854
855			//anchor checks
856			if($('#nectar_fullscreen_rows[data-anchors="on"]').length > 0) {
857				if($id.indexOf('fws_') == -1) $anchors.push($id);
858				else $anchors.push('section-'+(i+1));
859			}
860
861			//name checks
862			if($(this).find('.full-page-inner-wrap[data-name]').length > 0) 
863				$names.push($(this).find('.full-page-inner-wrap').attr('data-name'));
864			else 
865				$names.push(' ');
866		});
867	}
868	setFPNames();
869
870	function initFullPageFooter() {
871		var $footerPos = $('#nectar_fullscreen_rows').attr('data-footer');
872
873		if($footerPos == 'default') {
874			$('#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" />');
875		}
876		else if($footerPos == 'last_row') {
877			$('#footer-outer').remove();
878			$('#nectar_fullscreen_rows > .wpb_row:last-child').attr('id','footer-outer').addClass('fp-auto-height');
879		} else {
880			$('#footer-outer').remove();
881		}
882		
883	}	
884
885	if($('#nectar_fullscreen_rows').length > 0)
886		initFullPageFooter();
887
888	//fullscreen row logic
889	function fullscreenRowLogic() {
890		$('.full-page-inner-wrap .full-page-inner > .span_12 > .wpb_column').each(function(){
891			if($(this).find('> .vc_column-inner > .wpb_wrapper').find('> .wpb_row').length > 0) {
892
893				//add class for css
894				$(this).find('> .vc_column-inner > .wpb_wrapper').addClass('only_rows');
895
896				//set number of rows for css
897				$rowNum = $(this).find('> .vc_column-inner > .wpb_wrapper').find('> .wpb_row').length;
898				$(this).find('> .vc_column-inner > .wpb_wrapper').attr('data-inner-row-num',$rowNum);
899			} 
900
901			else if($(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').find('> .wpb_row').length > 0) {
902
903				//add class for css
904				$(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').addClass('only_rows');
905
906				//set number of rows for css
907				$rowNum = $(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').find('> .wpb_row').length;
908				$(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').attr('data-inner-row-num',$rowNum);
909			}
910		});
911	}
912
913	fullscreenRowLogic();
914
915	function fullHeightRowOverflow() {
916		//handle rows with full height that are larger than viewport
917		if($(window).width() >= 1000) {
918
919	    	$('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap[data-content-pos="full_height"]').each(function(){
920
921	    		//reset mobile calcs incase user plays with window resize
922	    		$(this).find('> .full-page-inner').css('height','100%');
923
924	    		var maxHeight = overallHeight;
925	    		var columnPaddingTop = 0;
926	    		var columnPaddingBottom = 0;
927
928	    		
929	    		if($('#nectar_fullscreen_rows').attr('data-animation') == 'none')
930	    			$(this).find('> .full-page-inner > .span_12 ').css('height','100%');
931	    		else
932	    			$(this).find('> .full-page-inner > .span_12 ').css('height',overallHeight);
933
934	    		$(this).find('> .full-page-inner > .span_12 > .wpb_column > .vc_column-inner > .wpb_wrapper').each(function(){
935	    			 columnPaddingTop = parseInt($(this).parents('.wpb_column').css('padding-top'));
936	    			 columnPaddingBottom = parseInt($(this).parents('.wpb_column').css('padding-bottom'));
937
938	    			 maxHeight = maxHeight > $(this).height() + columnPaddingTop + columnPaddingBottom ? maxHeight : $(this).height() + columnPaddingTop + columnPaddingBottom;
939	    		});
940	    		
941	    	
942	    		if(maxHeight > overallHeight)
943	    			$(this).find('> .full-page-inner > .span_12').height(maxHeight).css('float','none');
944	    		
945	    	});
946
947	    }
948
949	    else {
950	    	//mobile min height set
951	    	$('#nectar_fullscreen_rows > .wpb_row').each(function(){
952	    		$totalColHeight = 0;
953	    		$(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(){
954	    			$totalColHeight += $(this).outerHeight(true);
955	    		});
956
957	    		$(this).find('.fp-scrollable > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').css('height','100%');
958	    		if($totalColHeight > $(this).find('.fp-scrollable > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').height())
959	    			$(this).find('.fp-scrollable  > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').height($totalColHeight);
960	    	});
961	    }
962
963	}
964
965	function fullscreenElementSizing() {
966		//nectar slider
967		$nsSelector = '.nectar-slider-wrap[data-fullscreen="true"][data-full-width="true"], .nectar-slider-wrap[data-fullscreen="true"][data-full-width="boxed-full-width"]';
968		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) {
969			if($('#nectar_fullscreen_rows .wpb_row').length > 0) 
970				$($nsSelector).find('.swiper-container').attr('data-height',$('#nectar_fullscreen_rows .wpb_row').height()+1);
971	        
972	        $(window).trigger('resize.nsSliderContent');
973
974	        $($nsSelector).parents('.full-page-inner').addClass('only-nectar-slider');
975	    }
976	}
977
978
979	//kenburns first slide fix
980	$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').addClass('kenburns');
981	setTimeout(function(){
982		//ken burns first slide fix
983		$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').removeClass('kenburns');
984	},500);
985
986	//remove kenburns from safari
987	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');
988
989	var overallHeight = $(window).height();
990	var overallWidth = $(window).width();
991	var $fpAnimation = $('#nectar_fullscreen_rows').attr('data-animation');
992	var $fpAnimationSpeed;
993	var $svgResizeTimeout;
994	
995	switch($('#nectar_fullscreen_rows').attr('data-animation-speed')) {
996		case 'slow':
997			$fpAnimationSpeed = 1150;
998			break;
999		case 'medium':
1000			$fpAnimationSpeed = 850;
1001			break;
1002		case 'fast':
1003			$fpAnimationSpeed = 650;
1004			break;
1005		default:
1006			$fpAnimationSpeed = 850;
1007	}
1008	
1009	function heyFirefoxDrawTheEl(){
1010			var $drawTheEl = $('#nectar_fullscreen_rows > div:first-child').height();
1011			if($('#nectar_fullscreen_rows.trans-animation-active').length > 0){
1012				requestAnimationFrame(heyFirefoxDrawTheEl);
1013			}
1014	}
1015
1016	
1017	function initNectarFP() {
1018
1019		$usingFullScreenRows = true;
1020		$fullscreenSelector = '.wpb_row.active ';
1021
1022		$('.container-wrap, .container-wrap .main-content > .row').css({'padding-bottom':'0', 'margin-bottom': '0'});
1023		$('#nectar_fullscreen_rows').fullpage({
1024			sectionSelector: '#nectar_fullscreen_rows > .wpb_row',
1025			navigation: true,
1026			css3: true,
1027			scrollingSpeed: $fpAnimationSpeed,
1028			anchors: $anchors,
1029			scrollOverflow: true,
1030			navigationPosition: 'right',
1031			navigationTooltips: $names,
1032			afterLoad: function(anchorLink, index, slideAnchor, slideIndex){ 
1033
1034				if($('#nectar_fullscreen_rows').hasClass('afterLoaded')) {
1035
1036					//reset slim scroll to top
1037					$('.wpb_row:not(.last-before-footer):not(:nth-child('+index+')) .fp-scrollable').each(function(){
1038						$scrollable = $(this).data('iscrollInstance');
1039						$scrollable.scrollTo(0,0);
1040					});
1041
1042					//reset carousel
1043					$('.wpb_row:not(:nth-child('+index+')) .owl-carousel').trigger('to.owl.carousel',[0]);
1044
1045					var $row_id = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').attr('id');
1046
1047					$('#nectar_fullscreen_rows > .wpb_row').removeClass('transition-out').removeClass('trans');
1048					
1049
1050					$('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').removeClass('next-current');
1051					$('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+') .full-page-inner-wrap-outer').css({'height': '100%'});
1052					$('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap-outer').css({'transform':'none'});
1053					//take care of nav/control coloring
1054					//setFPNavColoring(index,'na');
1055					
1056					//handle waypoints
1057					if($row_id != 'footer-outer' && $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+').last-before-footer').length == 0) {
1058						waypoints();
1059						if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
1060							resetWaypoints();
1061							Waypoint.destroyAll();
1062							startMouseParallax();
1063							//portfolioLoadIn();
1064						}
1065						responsiveTooltips();
1066					}
1067					
1068					if($row_id !='footer-outer') {
1069						$('#nectar_fullscreen_rows > .wpb_row').removeClass('last-before-footer').css('transform','initial');
1070
1071						//reset animation attrs
1072						$('#nectar_fullscreen_rows > .wpb_row:not(.active):not(#footer-outer)').css({'transform':'translateY(0)','left':'-9999px', 'transition': 'none', 'opacity':'1', 'will-change':'auto'});
1073						$('#nectar_fullscreen_rows > .wpb_row:not(#footer-outer)').find('.full-page-inner-wrap-outer').css({'transition': 'none',  'transform':'none', 'will-change':'auto'});
1074						$('#nectar_fullscreen_rows > .wpb_row:not(#footer-outer)').find('.fp-tableCell').css({'transition': 'none', 'transform':'none', 'will-change':'auto'});
1075						
1076						//stacking fix
1077						$('#nectar_fullscreen_rows > .wpb_row:not(#footer-outer)').find('.full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner > .container').css({'backface-visibility':'visible', 'z-index':'auto'});
1078					}
1079				} else {
1080					fullHeightRowOverflow();
1081					overallHeight = $('#nectar_fullscreen_rows').height();
1082					$('#nectar_fullscreen_rows').addClass('afterLoaded');
1083
1084					//for users that have scrolled down prior to turning on full page
1085					setTimeout(function(){ window.scrollTo(0,0); },1800);
1086
1087					//ken burns first slide fix
1088					$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').removeClass('kenburns');
1089
1090					//handle fullscreen elements
1091	        		fullscreenElementSizing();
1092				}
1093
1094				
1095				$('#nectar_fullscreen_rows').removeClass('nextSectionAllowed');
1096
1097				
1098			 },
1099	        onLeave: function(index, nextIndex, direction){ 
1100	        	
1101						$('#nectar_fullscreen_rows').addClass('trans-animation-active');
1102						
1103	        	var $row_id = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+nextIndex+')').attr('id');
1104	        	var $indexRow = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')');
1105	        	var $nextIndexRow = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+nextIndex+')');
1106	        	var $nextIndexRowInner = $nextIndexRow.find('.full-page-inner-wrap-outer');
1107	        	var $nextIndexRowFpTable = $nextIndexRow.find('.fp-tableCell');
1108	        	//mobile/safari  fix
1109	        	var $transformProp = (!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? 'transform' : 'all'; 
1110	        	//if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) $transformProp = 'all';
1111
1112	        	if( $row_id == 'footer-outer') {
1113	        		$indexRow.addClass('last-before-footer'); 
1114	        		$('#footer-outer').css('opacity','1');
1115	        	} else {
1116	        		$('#nectar_fullscreen_rows > .wpb_row.last-before-footer').css('transform','translateY(0px)');
1117	        		$('#footer-outer').css('opacity','0');
1118	        	}
1119	        	if($indexRow.attr('id') == 'footer-outer') {
1120	        		$('#footer-outer').css({'transition': $transformProp+' 460ms cubic-bezier(0.60, 0.23, 0.2, 0.93)', 'backface-visibility': 'hidden'});
1121	        		$('#footer-outer').css({'transform': 'translateY(45%) translateZ(0)'});
1122	        	}
1123	 			
1124
1125	 			//stacking fix
1126	 			if($nextIndexRow.attr('id') != 'footer-outer') {
1127					$nextIndexRowFpTable.find('.full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner > .container').css({'backface-visibility':'hidden', 'z-index':'110'});
1128				}
1129
1130	        	//animation
1131	        	if($nextIndexRow.attr('id') != 'footer-outer' && $indexRow.attr('id') != 'footer-outer' && $('#nectar_fullscreen_rows[data-animation="none"]').length == 0 ) {
1132
1133	        		//scrolling down
1134	        		if(direction == 'down') {
1135
1136	        			if($fpAnimation == 'parallax') {
1137		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'will-change':'transform', 'transform':'translateZ(0)' ,'z-index': '100'});
1138		        			setTimeout(function() { 
1139		        				$indexRow.css({'transform': 'translateY(-50%) translateZ(0)'});
1140		        			}, 60);
1141
1142		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1143		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
1144		        			$nextIndexRowInner.css({'transform':'translateY(-50%) translateZ(0)', 'will-change':'transform'});
1145		        			
1146	        			} else if($fpAnimation == 'zoom-out-parallax') {
1147
1148	        				$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'});
1149		        			setTimeout(function() { 
1150		        				$indexRow.css({'transform': 'scale(0.77) translateZ(0)', 'opacity': '0'});
1151		        			}, 60);
1152
1153		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1154		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
1155		        			$nextIndexRowInner.css({'transform':'translateY(-50%) translateZ(0)',  'will-change':'transform'});
1156	        			} 
1157	        			/*else if($fpAnimation == 'none') {
1158
1159	        				$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'z-index': '100'});
1160	        				$indexRow.css({'will-change':'transform'});
1161
1162		        			setTimeout(function() { 
1163		        				$indexRow.css({'transform': 'translateY(-100%) translateZ(0)'});
1164		        			}, 80);
1165
1166		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
1167		        			setTimeout(function() { 
1168		        				$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1169		        			}, 30);
1170	        			}*/
1171	        		}
1172
1173	        		//scrolling up
1174	        		else {
1175
1176	        			if($fpAnimation == 'parallax') {
1177		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'z-index': '100', 'will-change':'transform'});
1178		        			setTimeout(function() { 
1179		        				$indexRow.css({'transform': 'translateY(50%) translateZ(0)'});
1180		        			}, 60);
1181
1182		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1183		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)','will-change':'transform'});
1184		        			$nextIndexRowInner.css({'transform':'translateY(50%) translateZ(0)','will-change':'transform'});
1185	        			}
1186
1187	        			else if($fpAnimation == 'zoom-out-parallax') {
1188		        			$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'});
1189		        			setTimeout(function() { 
1190		        				$indexRow.css({'transform': 'scale(0.77) translateZ(0)', 'opacity': '0'});
1191		        			}, 60);
1192
1193		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1194		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)', 'will-change':'transform'});
1195		        			$nextIndexRowInner.css({'transform':'translateY(50%) translateZ(0)', 'will-change':'transform'});
1196	        			} 
1197	        			/*else if($fpAnimation == 'none') {
1198		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'z-index': '100'});
1199		        			$indexRow.css({'will-change':'transform'});
1200
1201		        			setTimeout(function() { 
1202		        				$indexRow.css({'transform': 'translateY(100%) translateZ(0)'});
1203		        			}, 80);
1204
1205		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)', 'will-change':'transform'});
1206		        			setTimeout(function() { 
1207		        				$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1208		        			}, 30);
1209	        			}*/
1210	        			
1211	        			
1212	        		}
1213	        		
1214	        		setTimeout(function() { 
1215	    				$nextIndexRowFpTable.css({'transition':$transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1) 0ms', 'transform':'translateY(0%) translateZ(0)'});
1216	    				if($fpAnimation != 'none') { 
1217									$nextIndexRowInner.css({'transition':$transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1) 0ms', 'transform':'translateY(0%) translateZ(0)'});
1218									if(navigator.userAgent.indexOf('Firefox') != -1) {
1219										requestAnimationFrame(heyFirefoxDrawTheEl);
1220									}
1221							}
1222							
1223							
1224
1225							
1226	    			},60);
1227
1228	        	}
1229
1230	        	//adjust transform if larger than row height for parallax
1231	        	if($('#nectar_fullscreen_rows[data-animation="none"]').length == 0 && $nextIndexRow.find('.fp-scrollable').length > 0)
1232	        		$nextIndexRow.find('.full-page-inner-wrap-outer').css('height',overallHeight);
1233
1234	        	setTimeout(function() { 
1235	        		
1236	        		if( $row_id == 'footer-outer') {
1237
1238		        		$indexRow.css('transform','translateY(-'+($('#footer-outer').height()-1)+'px)');
1239
1240		        		$('#footer-outer').css({'transform': 'translateY(45%) translateZ(0)'});
1241		        		$('#footer-outer').css({'transition-duration': '0s', 'backface-visibility': 'hidden'});
1242		        		setTimeout(function() { 
1243		        			$('#footer-outer').css({'transition': $transformProp+' 500ms cubic-bezier(0.60, 0.23, 0.2, 
12430.93)', 'backface-visibility': 'hidden'});
1244	        				$('#footer-outer').css({'transform': 'translateY(0%) translateZ(0)'});
1245	        			},30);
1246		        	}
1247	        	},30);
1248
1249	        	if($row_id!='footer-outer') {
1250	        		
1251	        		stopMouseParallax();
1252
1253	        		//take care of nav/control coloring
1254	        		setFPNavColoring(nextIndex,direction);
1255							
1256							//handle main nav link highlight
1257							setTimeout(function(){
1258								FPActiveMenuItems(nextIndex);
1259							},50);
1260							
1261							
1262	        	}
1263	        		
1264	        },
1265
1266	        afterResize: function(){
1267	        	overallHeight = $('#nectar_fullscreen_rows').height();
1268	        	overallWidth = $(window).width();
1269	        	fullHeightRowOverflow();
1270	        	fullscreenElementSizing();
1271	        	fullscreenFooterCalcs();
1272
1273	        	if( $('#footer-outer.active').length > 0) {
1274	        		setTimeout(function(){
1275	        			$('.last-before-footer').css('transform','translateY(-'+$('#footer-outer').height()+'px)');
1276	        		},200);
1277		        } 
1278
1279		        //fix for svg animations when resizing and iscroll wraps/unwraps
1280		        clearTimeout($svgResizeTimeout);
1281		        $svgResizeTimeout = setTimeout(function(){ 
1282
1283		        	if($svg_icons.length > 0) {
1284			        	$('.svg-icon-holder.animated-in').each(function(i){
1285									$(this).css('opacity','1');
1286									$svg_icons[$(this).find('svg').attr('id').slice(-1)].finish();
1287								});
1288			        }
1289
1290		         },300);
1291	        }
1292
1293		});
1294	}
1295	
1296	if($('#nectar_fullscreen_rows').length > 0)
1297		initNectarFP();
1298
1299
1300	$(window).smartresize(function(){
1301		
1302		if($('#nectar_fullscreen_rows').length > 0) {
1303			setTimeout(function(){
1304				$('.wpb_row:not(.last-before-footer) .fp-scrollable').each(function(){
1305					$scrollable = $(this).data('iscrollInstance');
1306					$scrollable.refresh();
1307				});
1308			},200);
1309
1310			fullHeightRowOverflow();
1311
1312		}
1313	});
1314
1315	function fullscreenFooterCalcs() {
1316		if($('#footer-outer.active').length > 0) {
1317	    		$('.last-before-footer').addClass('fp-notransition').css('transform','translateY(-'+$('#footer-outer').height()+'px)');
1318	    		setTimeout(function(){
1319	    			$('.last-before-footer').removeClass('fp-notransition');
1320	    		},10);
1321	    	}
1322	}
1323
1324
1325
1326	function stopMouseParallax(){
1327		$.each($mouseParallaxScenes,function(k,v){
1328			v.parallax('disable');
1329		});
1330	}
1331
1332	function startMouseParallax(){
1333		if($('#nectar_fullscreen_rows > .wpb_row.active .nectar-parallax-scene').length > 0) {
1334			$.each($mouseParallaxScenes,function(k,v){
1335				v.parallax('enable');
1336			});
1337		}
1338	}
1339
1340	if($('#nectar_fullscreen_rows').length > 0) {
1341		setFPNavColoring(1,'na');
1342		fullscreenElementSizing();
1343	}
1344	
1345	function FPActiveMenuItems(index) {
1346		
1347		if(!$('#nectar_fullscreen_rows[data-anchors="on"]').length > 0 || !index) return;
1348		
1349		var $hash = window.location.hash;
1350		var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1,$hash.length) : '';
1351
1352		 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 > a[href$="#'+$hashSubstrng+'"]').length > 0 ) {
1353			  $('header#top nav > ul.sf-menu > li').removeClass('current-menu-item');
1354				$('header#top nav > ul.sf-menu > li > a[href$="'+$hashSubstrng+'"]').parent().addClass('current-menu-item');
1355		 } 
1356	}
1357
1358	function resetWaypoints() {
1359		//animated columns / imgs
1360		$('img.img-with-animation.animated-in:not([data-animation="none"])').css({'transition':'none'});
1361		$('img.img-with-animation.animated-in:not([data-animation="none"])').css({'opacity':'0','transform':'none'}).removeClass('animated-in');
1362		$('.col.has-animation.animated-in:not([data-animation*="reveal"]), .wpb_column.has-animation.animated-in:not([data-animation*="reveal"])').css({'transition':'none'});
1363		$('.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');	
1364		$('.col.has-animation.boxed:not([data-animation*="reveal"]), .wpb_column.has-animation.boxed:not([data-animation*="reveal"])').addClass('no-pointer-events');
1365
1366		//reveal columns
1367		$('.wpb_column.has-animation[data-animation*="reveal"], .nectar_cascading_images').removeClass('animated-in');
1368		if(overallWidth > 1000 && $('.using-mobile-browser').length == 0) {
1369			$('.wpb_column.has-animation[data-animation="reveal-from-bottom"] > .column-inner-wrap').css({'transition':'none','transform':'translate(0, 100%)'});
1370			$('.wpb_column.has-animation[data-animation="reveal-from-bottom"] > .column-inner-wrap > .column-inner').css({'transition':'none','transform':'translate(0, -90%)'});
1371			$('.wpb_column.has-animation[data-animation="reveal-from-top"] > .column-inner-wrap').css({'transition':'none','transform':'translate(0, -100%)'});
1372			$('.wpb_column.has-animation[data-animation="reveal-from-top"] > .column-inner-wrap > .column-inner').css({'transition':'none','transform':'translate(0, 90%)'});
1373			$('.wpb_column.has-animation[data-animation="reveal-from-left"] > .column-inner-wrap').css({'transition-duration':'0s','transform':'translate(-100%, 0)'});
1374			$('.wpb_column.has-animation[data-animation="reveal-from-left"] > .column-inner-wrap > .column-inner').css({'transition-duration':'0s','transform':'translate(90%, 0)'});
1375			$('.wpb_column.has-animation[data-animation="reveal-from-right"] > .column-inner-wrap').css({'transition-duration':'0s','transform':'translate(100%, 0)'});
1376			$('.wpb_column.has-animation[data-animation="reveal-from-right"] > .column-inner-wrap > .column-inner').css({'transition-duration':'0s','transform':'translate(-90%, 0)'});
1377		}
1378		$('.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');
1379
1380		//vcwaypoints
1381		$('.wpb_animate_when_almost_visible.animated').removeClass('wpb_start_animation').removeClass('animated');
1382
1383		//column borders
1384		$('.wpb_column[data-border-animation="true"] .border-wrap.animation').removeClass('animation').removeClass('completed');
1385
1386		//milestone
1387		$('.nectar-milestone.animated-in').removeClass('animated-in').removeClass('in-sight');
1388		$('.nectar-milestone .symbol').removeClass('in-sight');
1389
1390		//fancy ul
1391		$('.nectar-fancy-ul[data-animation="true"]').removeClass('animated-in');
1392		$('.nectar-fancy-ul[data-animation="true"] ul li').css({'opacity':'0','left':'-20px'});
1393
1394		//progress bars
1395		$('.nectar-progress-bar').parent().removeClass('completed');
1396		$('.nectar-progress-bar .bar-wrap > span').css({'width':'0px'});
1397		$('.nectar-progress-bar .bar-wrap > span > strong').css({'opacity':'0'});
1398		//$('.nectar-progress-bar .bar-wrap').css({'opacity':'0'});
1399
1400		//clients
1401		$('.clients.fade-in-animation').removeClass('animated-in');
1402		$('.clients.fade-in-animation > div').css('opacity','0');
1403
1404		//carousel
1405		$('.owl-carousel[data-enable-animation="true"]').removeClass('animated-in');
1406		$('.owl-carousel[data-enable-animation="true"] .owl-stage > .owl-item').css({'transition':'none','opacity':'0','transform':'translate(0, 70px)'});
1407		//dividers
1408		$('.divider-small-border[data-animate="yes"], .divider-border[data-animate="yes"]').removeClass('completed').css({'transition':'none','transform':'scale(0,1)'});
1409
1410		//icon list
1411		$('.nectar-icon-list').removeClass('completed');
1412		$('.nectar-icon-list-item').removeClass('animated');
1413
1414		//portfolio
1415		$('.portfolio-items .col').removeClass('animated-in');
1416
1417		//split line
1418		$('.nectar-split-heading').removeClass('animated-in');
1419		$('.nectar-split-heading .heading-line > div').transit({'y':'200%'},0);
1420
1421		//image with hotspots
1422		$('.nectar_image_with_hotspots[data-animation="true"]').removeClass('completed');
1423		$('.nectar_image_with_hotspots[data-animation="true"] .nectar_hotspot_wrap').removeClass('animated-in');
1424
1425		//animated titles
1426		$('.nectar-animated-title').removeClass('completed');
1427
1428		if($('.vc_pie_chart').length > 0)
1429			vc_pieChart();
1430
1431		$('.col.has-animation:not([data-animation*="reveal"]), .wpb_column.has-animation:not([data-animation*="reveal"])').each(function(i) {
1432		   	//clear previous timeout (needed for fullscreen rows)
1433			clearTimeout($standAnimatedColTimeout[i]); 
1434		});
1435
1436	}
1437
1438	
1439
1440} else if($('#nectar_fullscreen_rows').length > 0 && $disableFPonMobile == 'on' || $().fullpage && $disableFPonMobile == 'on') {
1441
1442	//remove markup
1443	//$('#nectar_fullscreen_rows > div.wpb_row .row-bg-wrap').unwrap().unwrap().unwrap();
1444	//$('#nectar_fullscreen_rows > div.wpb_row:first-child').unwrap();
1445	$('html,body').css({'height':'auto','overflow-y':'auto'});
1446}
1447
1448
1449
1450/***************** Superfish ******************/
1451	
1452	function initSF(){
1453
1454		if($('body[data-header-format="left-header"]').length == 0) {
1455
1456
1457			$disableHI = ($('body[data-dropdown-style="minimal"]').length > 0) ? true : false;
1458
1459			$(".sf-menu").superfish({
1460				 delay: 650,
1461				 speed: 'fast',
1462				 /*disableHI: $disableHI,*/
1463				 speedOut:      'fast',             
1464				 animation:   {opacity:'show'}
1465			}); 
1466
1467			//handle initial show on left class for minimal styling
1468			$('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function(){
1469				
1470				if($(this).offset().left + $(this).outerWidth() > $(window).width()) {
1471					$(this).addClass('on-left-side');
1472					$(this).find('ul').addClass('on-left-side');
1473				} 
1474				
1475			});
1476			
1477
1478			//megamenu multi section per column title support
1479			$('body:not([data-header-format="left-header"]) header#top nav > ul > li.megamenu > ul > li > ul > li:has("> ul")').addClass('has-ul'); 
1480
1481			//fullwidth megamenu
1482			if($('body[data-megamenu-width="full-width"]').length > 0 && $('ul.sub-menu').length > 0) {
1483				megamenuFullwidth();
1484				$(window).on('smartresize',megamenuFullwidth);
1485				$('header#top nav > ul > li.megamenu > .sub-menu').css('box-sizing','content-box');
1486			}
1487
1488			//extra hover class for megamenu check
1489			$('header#top nav > ul.sf-menu > li').on('mouseenter',function(){
1490				$(this).addClass('menu-item-over');
1491			});
1492			$('header#top nav > ul.sf-menu > li').on('mouseleave',function(){
1493				$(this).removeClass('menu-item-over');
1494			});
1495
1496			//remove arrows on mega menu item
1497			$('header#top nav .megamenu .sub-menu a.sf-with-ul .sf-sub-indicator, header#top .megamenu .sub-menu a .sf-sub-indicator').remove();
1498
1499			//blank title megamenu columns
1500			////desktop
1501			$('header#top nav > ul > li.megamenu > ul.sub-menu > li > a').each(function(){
1502				if( $(this).text() == '–' ) {
1503					$(this).remove();
1504				}
1505			});
1506
1507		
1508		}
1509		
1510	}
1511
1512	
1513	function megamenuFullwidth() {
1514		var $windowWidth = $(window).width();
1515		var $headerContainerWidth = $('header#top > .container').width();
1516		$('header#top nav > ul > li.megamenu > .sub-menu').css({
1517			'padding-left' : ($windowWidth - $headerContainerWidth)/2 + 'px',
1518			'padding-right' : ($windowWidth+2 - $headerContainerWidth)/2 + 'px',
1519			'width' : $headerContainerWidth,
1520			'left' : '-' + ($windowWidth - $headerContainerWidth)/2 + 'px'
1521		});
1522	}
1523	
1524	var $navLeave;
1525	
1526	function addOrRemoveSF(){
1527		
1528		if( window.innerWidth < 1000 && $('body').attr('data-responsive') == '1'){
1529			$('body').addClass('mobile');
1530			$('header#top nav').css('display','none');
1531		}
1532		
1533		else {
1534			$('body').removeClass('mobile');
1535			$('header#top nav').css('display','');
1536			$('#mobile-menu').hide();
1537			$('.slide-out-widget-area-toggle #toggle-nav .lines-button').removeClass('close');
1538			
1539			//recalc height of dropdown arrow
1540			$('.sf-sub-indicator').css('height',$('a.sf-with-ul').height());
1541		}
1542
1543		//add specific class if on device for better tablet tracking
1544		if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) $('body').addClass('using-mobile-browser');
1545
1546	}
1547
1548	function showOnLeftSubMenu() {
1549		//show on left class for minimal styling
1550		$('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function(){
1551			
1552			$(this).removeClass('on-left-side');
1553
1554			if($(this).offset().left + $(this).outerWidth() > $(window).width()) {
1555				$(this).addClass('on-left-side');
1556				$(this).find('ul').addClass('on-left-side');
1557			} else {
1558				$(this).removeClass('on-left-side');
1559				$(this).find('ul').removeClass('on-left-side');
1560			}
1561			
1562		});
1563	}
1564	
1565	addOrRemoveSF();
1566	initSF();
1567	
1568	$(window).resize(addOrRemoveSF);
1569
1570	
1571	function SFArrows(){
1572
1573		//set height of dropdown arrow
1574		$('.sf-sub-indicator').css('height',$('a.sf-with-ul').height());
1575	}
1576	
1577	SFArrows();
1578	
1579
1580	//deactivate hhun on phone
1581	if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
1582		$('body').attr('data-hhun','0');
1583
1584
1585/***************** Caroufredsel ******************/
1586	
1587	function standardCarouselInit() {
1588		$('ul.carousel:not(".clients")').each(function(){
1589	    	var $that = $(this); 
1590	    	var maxCols = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : 3 ;
1591	    	var scrollNum = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : '' ;
1592	    	var colWidth = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 500 : 453 ;
1593	    	var scrollSpeed, easing;
1594	    	var $autoplayBool = ($(this).attr('data-autorotate') == 'true') ? true : false;
1595			
1596			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') {
1597				if($(this).find('li').length % 3 === 0) {
1598					var $themeSkin = true;
1599					var $themeSkin2 = true;
1600				} else {
1601					var $themeSkin = false;
1602					var $themeSkin2 = true;
1603				}
1604	
1605			} else {
1606				var $themeSkin = true;
1607				var $themeSkin2 = true;
1608			}
1609
1610			(parseInt($(this).attr('data-scroll-speed'))) ? scrollSpeed = parseInt($(this).attr('data-scroll-speed')) : scrollSpeed = 700;
1611			($(this).is('[data-easing]')) ? easing = $(this).attr('data-easing') : easing = 'linear';
1612			
1613			
1614			var $element = $that;
1615			if($that.find('img').length == 0) $element = $('body');
1616			
1617			imagesLoaded($element,function(instance){
1618	
1619				
1620		    	$that.carouFredSel({
1621		    		circular: $themeSkin,
1622		    		infinite: $themeSkin2,
1623		    		height : 'auto',
1624		    		responsive: true,
1625			        items       : {
1626						width : colWidth,
1627				        visible     : {
1628				            min         : 1,
1629				            max         : maxCols
1630				        }
1631				    },
1632				    swipe       : {
1633				        onTouch     : true,
1634				        onMouse         : true,
1635				        options      : {
1636				        	excludedElements: "button, input, select, textarea, .noSwipe",
1637				        	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'); }
1638				        },
1639				        onBefore : function(){
1640				    		//hover effect fix
1641				    		$that.find('.work-item').trigger('mouseleave');
1642				    		$that.find('.work-item .work-info a').trigger('mouseup');
1643				    	}
1644				    },
1645				    scroll: {
1646				    	items			: scrollNum,
1647				    	easing          : easing,
1648			            duration        : scrollSpeed,
1649			            onBefore	: function( data ) {
1650			            	
1651			            	 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') {
1652			            	 	$that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
1653
1654			            	 }	
1655						},
1656						onAfter	: function( data ) {
1657			            	 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') {
1658			            	 	$that.parents('.carousel-wrap').find('.item-count .current').html( $that.triggerHandler('currentPage') +1);
1659			            	 	$that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
1660
1661			            	 }	
1662						}
1663
1664				    },
1665			        prev    : {
1666				        button  : function() {
1667				           return $that.parents('.carousel-wrap').find('.carousel-prev');
1668				        }
1669			    	},
1670				    next    : {
1671			       		button  : function() {
1672				           return $that.parents('.carousel-wrap').find('.carousel-next');
1673				        }
1674				    },
1675				    auto    : {
1676				    	play: $autoplayBool
1677				    }
1678			    }, { transition: true }).animate({'opacity': 1},1300);
1679			    
1680			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1681
1682			    if($that.parents('.carousel-wrap').attr('data-full-width') == 'true') $that.parents('.carousel-outer').css('overflow','visible');
1683
1684			    //add count for non full width ascend skin
1685			    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') {
1686					$('<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'));
1687				}
1688			    
1689			    $that.addClass('finished-loading');
1690
1691			    carouselHeightCalcs();
1692
1693				
1694			    
1695		     });//images loaded
1696		     	     
1697	    });//each
1698
1699		
1700    }
1701    if($('.carousel').length > 0) standardCarouselInit();
1702
1703
1704    function owlCarouselInit() {
1705    	//owl
1706		$('.owl-carousel').each(function(){
1707			
1708			$(this).addClass('owl-theme'); //new version removed this
1709			
1710			var $that = $(this);
1711			var $stagePadding = ($(window).width()<1000) ? 0 : parseInt($(this).attr('data-column-padding'));
1712			var $autoRotateBool = $that.attr('data-autorotate');
1713			var $autoRotateSpeed = $that.attr('data-autorotation-speed');
1714			var $owlLoopBool = ($that.is('[data-loop="true"]')) ? true : false;
1715			
1716			$(this).owlCarousel({
1717			      responsive:{
1718				        0:{
1719				            items: $(this).attr('data-mobile-cols')
1720				        },
1721				        690:{
1722				            items: $(this).attr('data-tablet-cols')
1723				        },
1724				        1000:{
1725				          items: $(this).attr('data-desktop-small-cols')
1726				        },
1727				        1300:{
1728				            items: $(this).attr('data-desktop-cols')
1729				        }
1730				    },
1731			      /*stagePadding: $stagePadding,*/
1732			      autoplay: $autoRotateBool,
1733			      autoplayTimeout: $autoRotateSpeed,
1734						loop: $owlLoopBool,
1735						smartSpeed: 350,
1736			      onTranslate: function(){
1737			      	$that.addClass('moving');
1738			      },
1739			      onTranslated: function(){
1740			      	$that.removeClass('moving');
1741			      }
1742
1743			  });
1744
1745			$(this).on('changed.owl.carousel', function (event) {
1746			    if (event.item.count - event.page.size == event.item.index)
1747			        $(event.target).find('.owl-dots div:last')
1748			          .addClass('active').siblings().removeClass('active');
1749			});	
1750
1751		});	
1752
1753
1754    }
1755
1756
1757
1758	function owl_carousel_animate() {
1759		$($fullscreenSelector+'.owl-carousel[data-enable-animation="true"]').each(function(){
1760
1761			$owlOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
1762
1763			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;
1764
1765			var $that = $(this);
1766			var waypoint = new Waypoint({
1767	 			element: $that,
1768	 			 handler: function(direction) {
1769
1770	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
1771					     waypoint.destroy();
1772					     return;
1773					}
1774
1775					setTimeout(function(){
1776		 			 	$that.find('.owl-stage > .owl-item').each(function(i){
1777		 			 		var $that = $(this);
1778							$that.delay(i*200).transition({
1779								'opacity': '1',
1780								'y' : '0'
1781							},600,'easeOutQuart');
1782						});
1783						$that.addClass('animated-in');
1784		 			 },$animationDelay);
1785
1786					waypoint.destroy();
1787				},
1788				offset: $owlOffsetPos
1789
1790			}); 
1791
1792		});
1793	}
1794
1795
1796
1797
1798    function productCarouselInit() {
1799		$('.products-carousel').each(function(){
1800	    	var $that = $(this).find('ul'); 
1801	    	var maxCols = 'auto';
1802	    	var scrollNum = 'auto';
1803	    	var colWidth = ($(this).parents('.full-width-content ').length > 0) ? 400 : 353 ;
1804			var scrollSpeed = 800;
1805			var easing = 'easeInOutQuart';
1806			
1807			
1808			var $element = $that;
1809			if($that.find('img').length == 0) $element = $('body');
1810			
1811			//controls on hover
1812			$(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>')
1813
1814			imagesLoaded($element,function(instance){
1815	
1816				
1817		    	$that.carouFredSel({
1818		    		circular: true,
1819		    		responsive: true,
1820			        items       : {
1821						width : colWidth,
1822				        visible     : {
1823				            min         : 1,
1824				            max         : maxCols
1825				        }
1826				    },
1827				    swipe       : {
1828				        onTouch     : true,
1829				        onMouse         : true,
1830				        options      : {
1831				        	excludedElements: "button, input, select, textarea, .noSwipe",
1832				        	tap: function(event, target){ 
1833				        		if($(target).attr('href') && !$(target).is('[target="_blank"]') && !$(target).hasClass('add_to_wishlist') && !$(target).hasClass('add_to_cart_button') && !$(target).is('[rel^="prettyPhoto"]')) 
1834				        			window.open($(target).attr('href'), '_self'); 
1835				        		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"]')) 
1836				        			window.open($(target).parent().attr('href'), '_self'); 
1837				        	}
1838				        },
1839				        onBefore : function(){
1840				    		//hover effect fix
1841				    		$that.find('.product-wrap').trigger('mouseleave');
1842				    		$that.find('.product a').trigger('mouseup');
1843				    	}
1844				    },
1845				    scroll: {
1846				    	items			: scrollNum,
1847				    	easing          : easing,
1848			            duration        : scrollSpeed
1849				    },
1850			        prev    : {
1851				        button  : function() {
1852				           return $that.parents('.carousel-wrap').find('.carousel-prev');
1853				        }
1854			    	},
1855				    next    : {
1856			       		button  : function() {
1857				           return $that.parents('.carousel-wrap').find('.carousel-next');
1858				        }
1859				    },
1860				    auto    : {
1861				    	play: false
1862				    }
1863			    }).animate({'opacity': 1},1300);
1864			    
1865			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1866			    
1867			    $that.addClass('finished-loading');
1868			    fullWidthContentColumns();
1869			    $(window).trigger('resize');
1870
1871		     });//images loaded
1872		     	     
1873	    });//each
1874    }
1875    if($('.products-carousel').length > 0) productCarouselInit();
1876
1877
1878
1879
1880    
1881    //fullwidth carousel swipe link fix
1882    function fwCarouselLinkFix() {
1883	    var $mousePosStart = 0;
1884	    var $mousePosEnd = 0;
1885	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').mousedown(function(e){
1886	    	$mousePosStart = e.clientX;
1887	    });
1888	    
1889	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').mouseup(function(e){
1890	    	$mousePosEnd = e.clientX;
1891	    });
1892	    
1893	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').click(function(e){
1894	    	if(Math.abs($mousePosStart - $mousePosEnd) > 10)  return false;
1895	    });
1896	}
1897	fwCarouselLinkFix();
1898    
1899     
1900	function carouselHeightCalcs(){
1901		
1902		//recent work carousel
1903		$('.carousel.portfolio-items.finished-loading').each(function(){
1904
1905			var bottomSpace = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true' && $(this).find('.style-2, .style-3, .style-4').length > 0) ? 0 : 28 ;
1906			
1907			var tallestMeta = 0;
1908			
1909			$(this).find('> li').each(function(){
1910				($(this).find('.work-meta').height() > tallestMeta) ? tallestMeta = $(this).find('.work-meta').height() : tallestMeta = tallestMeta;
1911			});	
1912    	 
1913     		$(this).parents('.caroufredsel_wrapper').css({
1914     			'height' : ($(this).find('.work-item').outerHeight() + tallestMeta + bottomSpace -2) + 'px'
1915     		});
1916
1917     		 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') {
1918        	 	$(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition")+1)/$(this).triggerHandler("currentVisible").length));
1919        	 	$(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length));
1920        	 }	
1921   	  	});
1922   	  	
1923   	  	//standard carousel
1924   	  	$('.carousel.finished-loading:not(".portfolio-items, .clients"), .caroufredsel_wrapper .products.finished-loading').each(function(){
1925			
1926			var tallestColumn = 0;
1927			
1928			$(this).find('> li').each(function(){
1929				($(this).height() > tallestColumn) ? tallestColumn = $(this).height() : tallestColumn = tallestColumn;
1930			});	
1931
1932         	$(this).css('height',tallestColumn + 5);
1933         	$(this).parents('.caroufredsel_wrapper').css('height',tallestColumn + 5);
1934
1935         	 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') {
1936        	 	$(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition")+1)/$(this).triggerHandler("currentVisible").length));
1937        	 	$(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length));
1938        	 }	
1939			
1940   	  	});
1941   	  	
1942	}
1943
1944
1945	function clientsCarouselInit(){
1946	     $('.carousel.clients').each(function(){
1947	    	var $that = $(this);
1948	    	var columns; 
1949	    	var $autoRotate = (!$(this).hasClass('disable-autorotate')) ? true : false;
1950	    	(parseInt($(this).attr('data-max'))) ? columns = parseInt($(this).attr('data-max')) : columns = 5;
1951	    	if($(window).width() < 690 && $('body').attr('data-responsive') == '1') { columns = 2; $(this).addClass('phone') }
1952	    	
1953	    	var $element = $that;
1954			if($that.find('img').length == 0) $element = $('body');
1955			
1956			imagesLoaded($element,function(instance){
1957	    		
1958		    	$that.carouFredSel({
1959			    		circular: true,
1960			    		responsive: true, 
1961				        items       : {
1962							
1963							height : $that.find('> div:first').height(),
1964							width  : $that.find('> div:first').width(),
1965					        visible     : {
1966					            min         : 1,
1967					            max         : columns
1968					        }
1969					    },
1970					    swipe       : {
1971					        onTouch     : true,
1972					        onMouse         : true
1973					    },
1974					    scroll: {
1975					    	items           : 1,
1976					    	easing          : 'easeInOutCubic',
1977				            duration        : '800',
1978				            pauseOnHover    : true
1979					    },
1980					    auto    : {
1981					    	play            : $autoRotate,
1982					    	timeoutDuration : 2700
1983					    }
1984			    }).animate({'opacity': 1},1300);
1985			    
1986			    $that.addClass('finished-loading');
1987
1988			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1989			     
1990
1991			    $(window).trigger('resize');
1992			    
1993		    
1994		    });
1995	
1996	    });
1997    }
1998   if($('.carousel').length > 0)  clientsCarouselInit();
1999    
2000
2001    function clientsCarouselHeightRecalc(){
2002
2003    	var tallestImage = 0;
2004		  			
2005    	 $('.carousel.clients.finished-loading').each(function(){
2006    	 	
2007    	 	$(this).find('> div').each(function(){
2008				($(this).height() > tallestImage) ? tallestImage = $(this).height() : tallestImage = tallestImage;
2009			});	
2010    	 	
2011         	$(this).css('height',tallestImage);
2012         	$(this).parent().css('height',tallestImage);
2013         });
2014    }
2015
2016
2017    //carousel grabbing class
2018    function carouselfGrabbingClass() {
2019	    $('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(){
2020	    	$(this).addClass('active');
2021	    });
2022	    
2023	    $('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(){
2024	    	$(this).removeClass('active');
2025	    });
2026	}
2027	carouselfGrabbingClass();
2028	    
2029
2030	//ascend arrow hover class
2031	$('body.ascend, body.material').on('mouseover','.carousel-next',function(){
2032		$(this).parent().find('.carousel-prev, .item-count').addClass('next-hovered');
2033	});
2034	$('body.ascend, body.material').on('mouseleave','.carousel-next',function(){
2035		$(this).parent().find('.carousel-prev, .item-count').removeClass('next-hovered');
2036	});
2037
2038	//fadein for clients / carousels
2039	function clientsFadeIn() {
2040
2041		$clientsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? 100: 'bottom-in-view';
2042		$($fullscreenSelector+'.clients.fade-in-animation').each(function() {
2043
2044			var $that = $(this);
2045			var waypoint = new Waypoint({
2046 			element: $that,
2047 			 handler: function(direction) {
2048				
2049				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
2050					 waypoint.destroy();
2051					return;
2052				}
2053
2054				 $that.find('> div').each(function(i){
2055					$(this).delay(i*80).transition({'opacity':"1"},450);
2056				});
2057				
2058				
2059				//add the css transition class back in after the aniamtion is done
2060				setTimeout(function(){ $that.addClass('completed'); },($that.find('> div').length*80) + 450);
2061			
2062
2063				$that.addClass('animated-in');
2064				waypoint.destroy();
2065			},
2066			offset: $clientsOffsetPos
2067
2068			}); 
2069		}); 
2070	}
2071	 
2072	//if($('.nectar-box-roll').length == 0) clientsFadeIn();
2073	
2074	
2075/*-------------------------------------------------------------------------*/
2076/*	2.	Helper Functions
2077/*-------------------------------------------------------------------------*/
2078
2079	jQuery.fn.setCursorPosition = function(position){
2080	    if(this.lengh == 0) return this;
2081	    return $(this).setSelection(position, position);
2082	}
2083	
2084	jQuery.fn.setSelection = function(selectionStart, selectionEnd) {
2085	    if(this.lengh == 0) return this;
2086	    input = this[0];
2087	
2088	    if (input.createTextRange) {
2089	        var range = input.createTextRange();
2090	        range.collapse(true);
2091	        range.moveEnd('character', selectionEnd);
2092	        range.moveStart('character', selectionStart);
2093	        range.select();
2094	    } else if (input.setSelectionRange) {
2095	        input.focus();
2096	        input.setSelectionRange(selectionStart, selectionEnd);
2097	    }
2098	
2099	    return this;
2100	}
2101	
2102	
2103
2104	$.extend($.expr[':'], {
2105	    transparent: function(elem, i, attr){
2106	      return( $(elem).css("opacity") === "0" );
2107	    }
2108	});
2109	
2110
2111	function getQueryParams(qs) {
2112	    qs = qs.split("+").join(" ");
2113	    var params = {},
2114	        tokens,
2115	        re = /[?&]?([^=]+)=([^&]*)/g;
2116
2117	    while (tokens = re.exec(qs)) {
2118	        params[decodeURIComponent(tokens[1])]
2119	            = decodeURIComponent(tokens[2]);
2120	    }
2121
2122	    return params;
2123	}
2124
2125	var $_GET = getQueryParams(document.location.search);
2126
2127	
2128	//count
2129	var CountUp = function(target, startVal, endVal, decimals, duration, options) {
2130
2131    // make sure requestAnimationFrame and cancelAnimationFrame are defined
2132    // polyfill for browsers without native support
2133    // by Opera engineer Erik Möller
2134    var lastTime = 0;
2135    var vendors = ['webkit', 'moz', 'ms', 'o'];
2136    for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
2137        window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
2138        window.cancelAnimationFrame =
2139          window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
2140    }
2141    if (!window.requestAnimationFrame) {
2142        window.requestAnimationFrame = function(callback, element) {
2143            var currTime = new Date().getTime();
2144            var timeToCall = Math.max(0, 16 - (currTime - lastTime));
2145            var id = window.setTimeout(function() { callback(currTime + timeToCall); },
2146              timeToCall);
2147            lastTime = currTime + timeToCall;
2148            return id;
2149        };
2150    }
2151    if (!window.cancelAnimationFrame) {
2152        window.cancelAnimationFrame = function(id) {
2153            clearTimeout(id);
2154        };
2155    }
2156
2157    var self = this;
2158
2159     // default options
2160    self.options = {
2161        useEasing : true, // toggle easing
2162        useGrouping : true, // 1,000,000 vs 1000000
2163        separator : ',', // character to use as a separator
2164        decimal : '.', // character to use as a decimal
2165        easingFn: null, // optional custom easing closure function, default is Robert Penner's easeOutExpo
vendor: 5,312 bytes, lines 2166-2310
2166        formattingFn: null // optional custom formatting function, default is self.formatNumber below
2167    };
2168    // extend default options with passed options object
2169    for (var key in options) {
2170        if (options.hasOwnProperty(key)) {
2171            self.options[key] = options[key];
2172        }
2173    }
2174    if (self.options.separator === '') { self.options.useGrouping = false; }
2175    if (!self.options.prefix) self.options.prefix = '';
2176    if (!self.options.suffix) self.options.suffix = '';
2177
2178    self.d = (typeof target === 'string') ? document.getElementById(target) : target;
2179    self.startVal = Number(startVal);
2180    self.endVal = Number(endVal);
2181    self.countDown = (self.startVal > self.endVal);
2182    self.frameVal = self.startVal;
2183    self.decimals = Math.max(0, decimals || 0);
2184    self.dec = Math.pow(10, self.decimals);
2185    self.duration = Number(duration) * 1000 || 2000;
2186
2187    self.formatNumber = function(nStr) {
2188        nStr = nStr.toFixed(self.decimals);
2189        nStr += '';
2190        var x, x1, x2, rgx;
2191        x = nStr.split('.');
2192        x1 = x[0];
2193        x2 = x.length > 1 ? self.options.decimal + x[1] : '';
2194        rgx = /(\d+)(\d{3})/;
2195        if (self.options.useGrouping) {
2196            while (rgx.test(x1)) {
2197                x1 = x1.replace(rgx, '$1' + self.options.separator + '$2');
2198            }
2199        }
2200        return self.options.prefix + x1 + x2 + self.options.suffix;
2201    };
2202    // Robert Penner's easeOutExpo
2203    self.easeOutExpo = function(t, b, c, d) {
2204        return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b;
2205    };
2206
2207    self.easingFn = self.options.easingFn ? self.options.easingFn : self.easeOutExpo;
2208    self.formattingFn = self.options.formattingFn ? self.options.formattingFn : self.formatNumber;
2209
2210    self.version = function () { return '1.7.1'; };
2211
2212    // Print value to target
2213    self.printValue = function(value) {
2214        var result = self.formattingFn(value);
2215
2216        if (self.d.tagName === 'INPUT') {
2217            this.d.value = result;
2218        }
2219        else if (self.d.tagName === 'text' || self.d.tagName === 'tspan') {
2220            this.d.textContent = result;
2221        }
2222        else {
2223            this.d.innerHTML = result;
2224        }
2225    };
2226
2227    self.count = function(timestamp) {
2228
2229        if (!self.startTime) { self.startTime = timestamp; }
2230
2231        self.timestamp = timestamp;
2232        var progress = timestamp - self.startTime;
2233        self.remaining = self.duration - progress;
2234
2235        // to ease or not to ease
2236        if (self.options.useEasing) {
2237            if (self.countDown) {
2238                self.frameVal = self.startVal - self.easingFn(progress, 0, self.startVal - self.endVal, self.duration);
2239            } else {
2240                self.frameVal = self.easingFn(progress, self.startVal, self.endVal - self.startVal, self.duration);
2241            }
2242        } else {
2243            if (self.countDown) {
2244                self.frameVal = self.startVal - ((self.startVal - self.endVal) * (progress / self.duration));
2245            } else {
2246                self.frameVal = self.startVal + (self.endVal - self.startVal) * (progress / self.duration);
2247            }
2248        }
2249
2250        // don't go past endVal since progress can exceed duration in the last frame
2251        if (self.countDown) {
2252            self.frameVal = (self.frameVal < self.endVal) ? self.endVal : self.frameVal;
2253        } else {
2254            self.frameVal = (self.frameVal > self.endVal) ? self.endVal : self.frameVal;
2255        }
2256
2257        // decimal
2258        self.frameVal = Math.round(self.frameVal*self.dec)/self.dec;
2259
2260        // format and print value
2261        self.printValue(self.frameVal);
2262
2263        // whether to continue
2264        if (progress < self.duration) {
2265            self.rAF = requestAnimationFrame(self.count);
2266        } else {
2267            if (self.callback) { self.callback(); }
2268        }
2269    };
2270    // start your animation
2271    self.start = function(callback) {
2272        self.callback = callback;
2273        self.rAF = requestAnimationFrame(self.count);
2274        return false;
2275    };
2276    // toggles pause/resume animation
2277    self.pauseResume = function() {
2278        if (!self.paused) {
2279            self.paused = true;
2280            cancelAnimationFrame(self.rAF);
2281        } else {
2282            self.paused = false;
2283            delete self.startTime;
2284            self.duration = self.remaining;
2285            self.startVal = self.frameVal;
2286            requestAnimationFrame(self.count);
2287        }
2288    };
2289    // reset to startVal so animation can be run again
2290    self.reset = function() {
2291        self.paused = false;
2292        delete self.startTime;
2293        self.startVal = startVal;
2294        cancelAnimationFrame(self.rAF);
2295        self.printValue(self.startVal);
2296    };
2297    // pass a new endVal and start animation
2298    self.update = function (newEndVal) {
2299        cancelAnimationFrame(self.rAF);
2300        self.paused = false;
2301        delete self.startTime;
2302        self.startVal = self.frameVal;
2303        self.endVal = Number(newEndVal);
2304        self.countDown = (self.startVal > self.endVal);
2305        self.rAF = requestAnimationFrame(self.count);
2306    };
2307
2308    // format startVal on initialization
2309    self.printValue(self.startVal);
2310};
2311	
2312var easeOutCubic = function(t, b, c, d) {
2313    return c*((t=t/d-1)*t*t + 1) + b;
2314};	
2315	
2316	
2317/*-------------------------------------------------------------------------*/
2318/*	3.	Shortcode Stuff
2319/*-------------------------------------------------------------------------*/
2320
2321
2322function vcWaypoints() {
2323	$($fullscreenSelector+' .wpb_animate_when_almost_visible').each(function() {
2324		  
2325			var $vcOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%';
2326
2327			var $that = $(this);
2328			var waypoint = new Waypoint({
2329	 			element: $that,
2330	 			 handler: function(direction) {
2331
2332	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 
2333					     waypoint.destroy();
2334					     return;
2335					}
2336	 				$that.addClass("animated");
2337	 				$that.addClass("wpb_start_animation");
2338	 				waypoint.destroy();
2339				},
2340				offset: $vcOffsetPos
2341
2342			}); 
2343
2344	});
2345}
2346			 
2347
2348/***************** Milestone Counter ******************/
2349	
2350	function milestoneInit() {
2351
2352		$('.nectar-milestone').each(function() {
2353			
2354			//symbol
2355			if($(this).is('[data-symbol]')) {
2356				if($(this).find('.symbol-wrap').length == 0) {
2357					if($(this).attr('data-symbol-pos') == 'before') {
2358						$(this).find('.number').prepend('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>');
2359					} else {
2360						$(this).find('.number').append('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>');
2361					}
2362				}
2363
2364				$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'));
2365			
2366				$(this).find('.symbol-wrap').css({'font-size': $symbol_size + 'px', 'line-height': $symbol_size + 'px'});
2367			}
2368
2369			$(this).find('.number').css({'font-size': $(this).find('.number').attr('data-number-size') +'px', 'line-height': $(this).find('.number').attr('data-number-size') + 'px'});
2370		});
2371		
2372		if(!$('body').hasClass('mobile') && $('.nectar-milestone').length > 0) {
2373			
2374
2375			//blur effect
2376			var $blurCssString = '';
2377			$($fullscreenSelector+'.nectar-milestone.motion_blur').each(function(i){
2378					
2379				$(this).addClass('instance-'+i);
2380
2381				var $currentColor = $(this).find('.number').css('color');
2382				var colorInt = parseInt($currentColor.substring(1),16);
2383		   		var R = (colorInt & 0xFF0000) >> 16;
2384		    	var G = (colorInt & 0x00FF00) >> 8;
2385		   		var B = (colorInt & 0x0000FF) >> 0;
2386		   		
2387		   		var $rgbaColorStart = 'rgba('+R+','+G+','+B+',0.2)';
2388				var $rgbaColorEnd = 'rgba('+R+','+G+','+B+',1)';
2389				var $numberSize = parseInt($(this).find('.number').attr('data-number-size'));
2390
2391				$blurCssString += '@keyframes motion-blur-number-'+i+' { ' +
2392				   ' 0% { '+
2393				   		'opacity: 0;'+
2394						'color: '+$rgbaColorStart+'; '+
2395   						'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+'; '+
2396    					'transform: translateZ(0px) translateY(-100%); '+
2397    					'-webkit-transform: translateZ(0px) translateY(-100%); '+
2398    				'} '+
2399    				'33% { opacity: 1 }' +
2400    				'100% { '+
2401						'color: '+$rgbaColorEnd+'; '+
2402   						'text-shadow: none; '+
2403    					'transform: translateZ(0px) translateY(0px); '+
2404    					'-webkit-transform: translateZ(0px) translateY(0px); '+
2405    				'} '+
2406    			'} '+
2407    			'@-webkit-keyframes motion-blur-number-'+i+' { ' +
2408				   ' 0% { '+
2409				  	    'opacity: 0;'+
2410						'color: '+$rgbaColorStart+'; '+
2411   						'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+'; '+
2412    					'transform: translateZ(0px) translateY(-100%); '+
2413    					'-webkit-transform: translateZ(0px) translateY(-100%); '+
2414    				'} '+
2415    				'33% { opacity: 1 }' +
2416    				'100% { '+
2417						'color: '+$rgbaColorEnd+'; '+
2418   						'text-shadow: none; '+
2419    					'transform: translateZ(0px) translateY(0px); '+
2420    					'-webkit-transform: translateZ(0px) translateY(0px); '+
2421    				'} '+
2422    			'} '+
2423    			'.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+'; } ';
2424    			
2425    			//separate each character into spans
2426    			$symbol = $(this).find('.symbol-wrap').clone();
2427    			$(this).find('.symbol-wrap').remove();
2428    			var characters = $(this).find('.number').text().split("");
2429    			$this = $(this).find('.number');
2430				$this.empty();
2431    			$.each(characters, function (i, el) {
2432				    $this.append("<span>" + el + "</span");
2433				});
2434
2435				//handle symbol
2436				if($(this).has('[data-symbol]')) {
2437	    			if($(this).attr('data-symbol-pos') == 'after') {
2438	    				$this.append($symbol);
2439	    			} else {
2440	    				$this.prepend($symbol);
2441	    			}
2442	    		}
2443				
2444			});
2445
2446			var head = document.head || document.getElementsByTagName('head')[0];
2447				var style = document.createElement('style');
2448
2449				style.type = 'text/css';
2450			if (style.styleSheet){
2451			  style.styleSheet.cssText = $blurCssString;
2452			} else {
2453			  style.appendChild(document.createTextNode($blurCssString));
2454			}
2455			$(style).attr('id','milestone-blur');
2456			$('head #milestone-blur').remove();
2457			head.appendChild(style);
2458
2459
2460			//activate
2461			milestoneWaypoint();
2462
2463		}
2464
2465	}
2466
2467	function milestoneWaypoint() {
2468		$($fullscreenSelector+'.nectar-milestone').each(function() {
2469			//animation
2470			
2471			var $offset = ($('#nectar_fullscreen_rows').length > 0) ? '250%' : '98%';
2472
2473			var $that = $(this);
2474			var waypoint = new Waypoint({
2475	 			element: $that,
2476	 			 handler: function(direction) {
2477
2478	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
2479					     waypoint.destroy();
2480					     return;
2481					}
2482
2483	 			 	var $endNum = parseInt($that.find('.number span:not(.symbol)').text().replace(/,/g , ''));
2484
2485					if(!$that.hasClass('motion_blur')) {
2486
2487						var countOptions = { easingFn: easeOutCubic };
2488						var $countEle = $that.find('.number span:not(.symbol)')[0];
2489						var numAnim = new CountUp($countEle, 0, $endNum,0,2.2,countOptions);
2490						numAnim.start();
2491
2492					} else {
2493						$that.find('span').each(function(i){
2494							var $that = $(this);
2495							setTimeout(function(){ $that.addClass('in-sight'); },200*i);
2496						});
2497					}
2498
2499
2500					$that.addClass('animated-in');
2501					waypoint.destroy();
2502				},
2503				offset: $offset
2504
2505			}); 
2506
2507		}); 
2508	}
2509
2510	var $animationOnScrollTimeOut = ($('.nectar-box-roll').length > 0) ? 850: 125;	
2511	//if($('.nectar-box-roll').length == 0) setTimeout(function(){  milestoneInit(); },125); 
2512	
2513/***************** Tabbed ******************/
2514	
2515	$tabbedClickCount = 0;
2516	$('body').on('click','.tabbed > ul li:not(.cta-button) a',function(){
2517		var $id = $(this).parents('li').index()+1;
2518		
2519		if(!$(this).hasClass('active-tab') && !$(this).hasClass('loading')){
2520			$(this).parents('ul').find('a').removeClass('active-tab');
2521			$(this).addClass('active-tab');
2522			
2523			$(this).parents('.tabbed').find('> div:not(.clear)').css({'visibility':'hidden','position':'absolute','opacity':'0','left':'-9999px','display':'none'});
2524			$(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').css({'visibility':'visible', 'position' : 'relative','left':'0','display':'block'}).stop().transition({'opacity':1},400);
2525			
2526			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); 
2527		}
2528		
2529		//waypoint checking
2530		if($tabbedClickCount != 0) {
2531			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-progress-bar').length > 0 ) 
2532				progressBars();
2533			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').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 ) 
2534				dividers();
2535			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('img.img-with-animation').length > 0 ||
2536			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.col.has-animation').length > 0  || 
2537			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar_cascading_images').length > 0  || 
2538			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wpb_column.has-animation').length > 0 ) {
2539				colAndImgAnimations();
2540				cascadingImageBGSizing();
2541			}
2542			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-milestone').length > 0 ) 
2543				milestoneWaypoint();
2544			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar_image_with_hotspots[data-animation="true"]').length > 0 ) 
2545				imageWithHotspots();
2546			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-fancy-ul').length > 0 ) 
2547				nectar_fancy_ul_init();
2548			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-split-heading').length > 0 ) 
2549				splitLineHeadings();
2550			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wpb_column[data-border-animation="true"]').length > 0) {
2551				animatedColBorders();
2552			}
2553			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wpb_animate_when_almost_visible').length > 0) {
2554				vcWaypoints();
2555			}
2556			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-animated-title').length > 0) {
2557				animated_titles();
2558			}
2559			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar_food_menu_item').length > 0) {
2560				foodMenuItems();
2561			}
2562			if($(this).parents('.wpb_row').length > 0) {
2563				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.vc_pie_chart').length > 0  ||
2564				   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wp-video-shortcode').length > 0 ||
2565					 $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.post-area.masonry .posts-container').length > 0 ||
2566				   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.twentytwenty-container').length > 0 ||
2567					 $(this).parents('#nectar_fullscreen_rows[data-content-overflow="scrollbar"]').length > 0 ||
2568				   $(this).parents('.wpb_row').next().hasClass('parallax_section'))
2569					$(window).trigger('resize');
2570
2571				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-flickity').length > 0 )
2572					$('.nectar-flickity:not(.masonry)').flickity('resize');
2573			}
2574
2575			//svg icons
2576		
2577			$(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.svg-icon-holder').each(function(i){
2578				var $that = $(this);
2579
2580				setTimeout(function(){
2581
2582					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;
2583
2584					clearTimeout($animatedSVGIconTimeout[i]);
2585
2586					if($that.attr('data-animation') == 'false') { 
2587						$animationSpeed = 1;
2588						$that.css('opacity','1');
2589						$svg_icons[$that.find('svg').attr('id').slice(-1)].finish();
2590					} else {
2591						
2592						$svg_icons[$that.find('svg').attr('id').slice(-1)].reset();
2593						$animatedSVGIconTimeout[i] = setTimeout(function(){ $svg_icons[$that.find('svg').attr('id').slice(-1)].play(); },$animationDelay);
2594						
2595					}
2596				},150);
2597			});
2598
2599		}
2600
2601		//fix columns inside tabs
2602		$(this).parents('.tabbed').find('.wpb_row').each(function(){
2603			if( typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') {
2604				
2605				var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left;
2606				$(this).find('[class*="vc_col-"]').each(function(){
2607					$(this).removeClass('no-left-margin');
2608					if($(this).offset().left < $firstChildOffset + 15) { 
2609						$(this).addClass('no-left-margin');
2610					} else {
2611						$(this).removeClass('no-left-margin');
2612					}
2613				});
2614			}
2615		});
2616
2617		$tabbedClickCount++;
2618
2619		//magic line
2620		if($(this).parent().parent().find('.magic-line').length > 0) {
2621			magicLineCalc($(this));
2622	     }
2623
2624		return false;
2625	});
2626
2627
2628	function magicLineCalc($ele) {
2629		var el, leftPos, ratio;
2630	    el = $ele.parent();
2631	    if (el.length) {
2632	        leftPos = el.position().left;
2633	        ratio = el.width();
2634	    } else {
2635	        leftPos = ratio = 0;
2636	    }
2637
2638	    $ele.parent().parent().find('.magic-line').css('transform', 'translateX(' + leftPos + 'px) scaleX(' + ratio + ')');
2639	}
2640	
2641	
2642	function tabbedInit(){ 
2643		$('.tabbed').each(function(){
2644			
2645			//handle icons
2646			$(this).find('.wpb_tab').each(function(i){
2647				
2648				if($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) {
2649					 $(this).parent().addClass('using-icons');
2650					 $(this).parent().find('.wpb_tabs_nav li:nth-child('+ (i+1) +') > a').prepend('<i class="'+$(this).attr("data-tab-icon")+'"></i>');
2651				}
2652			});
2653			
2654			//make sure the tabs don't have a nectar slider - we'll init this after the sliders load in that case
2655			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){
2656				$(this).find('> ul li:first-child a').click();
2657			}	
2658			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 ){
2659				var $that = $(this);
2660				
2661				$(this).find('.wpb_tab').show().css({'opacity':0,'height':'1px'});
2662				$(this).find('> ul li a').addClass('loading');
2663				
2664				setTimeout(function(){ 
2665					$that.find('.wpb_tab').hide().css({'opacity':1,'height':'auto'}); 
2666					$that.find('> ul li a').removeClass('loading');
2667					$that.find('> ul li:first-child a').click(); 
2668				},900);
2669			}
2670
2671			var $that = $(this);
2672			//minimal alt effect
2673			setTimeout(function(){
2674				if($that.is('[data-style="minimal_alt"]')) {
2675					$that.find('> ul').append('<li class="magic-line" />');
2676					 magicLineCalc($that.find('> ul > li:first-child > a'));
2677				}
2678			},100);
2679
2680
2681		});
2682	}
2683	tabbedInit();
2684
2685	//deep linking
2686	function tabbbedDeepLinking(){
2687		if(typeof $_GET['tab'] != 'undefined'){
2688			$('.wpb_tabs_nav').each(function(){
2689
2690				$(this).find('li').each(function(){
2691					var $currentText = $(this).find('a').text();
2692					var $getText = $_GET['tab'];
2693					var $that = $(this);
2694
2695					$currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
2696					$getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
2697
2698					if($currentText == $getText)  { 
2699
2700			          $(this).find('a').click(); 
2701			           setTimeout(function(){ 
2702			              $that.find('a').click(); 
2703			           },901);
2704			        }
2705				})
2706			});
2707		}
2708	}
2709	tabbbedDeepLinking();
2710
2711/***************** Toggle ******************/
2712	
2713	//toggles
2714	$('body').on('click','.toggle h3 a', function(){
2715	
2716		if(!$(this).parents('.toggles').hasClass('accordion')) { 
2717			$(this).parents('.toggle').find('> div').slideToggle(300);
2718			$(this).parents('.toggle').toggleClass('open');
2719			
2720			//switch icon
2721			if( $(this).parents('.toggle').hasClass('open') ){
2722				$(this).find('i').attr('class','icon-minus-sign');
2723			} else {
2724				$(this).find('i').attr('class','icon-plus-sign');
2725			}
2726
2727			if($(this).parents('.toggle').find('> div .iframe-embed').length > 0 && $(this).parents('.toggle').find('> div iframe.iframe-embed').height() == '0') responsiveVideoIframes();
2728			if($(this).parents('.full-width-content').length > 0) setTimeout(function(){ fullWidthContentColumns(); },300);
2729			if($('#nectar_fullscreen_rows').length > 0) setTimeout(function(){ $(window).trigger('smartresize'); },300);
2730			return false;
2731		}
2732	});
2733	
2734	//accordion
2735	$('body').on('click','.accordion .toggle h3 a', function(){
2736		
2737		if($(this).parents('.toggle').hasClass('open')) return false;
2738		
2739		$(this).parents('.toggles').find('.toggle > div').slideUp(300);
2740		$(this).parents('.toggles').find('.toggle h3 a i').attr('class','icon-plus-sign');
2741		$(this).parents('.toggles').find('.toggle').removeClass('open');
2742		
2743		$(this).parents('.toggle').find('> div').slideDown(300);
2744		$(this).parents('.toggle').addClass('open');
2745		
2746		//switch icon
2747		if( $(this).parents('.toggle').hasClass('open') ){
2748			$(this).find('i').attr('class','icon-minus-sign');
2749		} else {
2750			$(this).find('i').attr('class','icon-plus-sign');
2751		}
2752
2753		if($(this).parents('.full-width-content').length > 0) { 
2754			clearTimeout($t);
2755			var $t = setTimeout(function(){ fullWidthContentColumns(); },400);
2756		}
2757		if($('#nectar_fullscreen_rows').length > 0) {
2758			clearTimeout($t);
2759			var $t = setTimeout(function(){ $(window).trigger('smartresize'); },400);
2760		}
2761		
2762		return false;
2763	});
2764	
2765	//accordion start open
2766	function accordionInit(){ 
2767		$('.accordion').each(function(){
2768			$(this).find('> .toggle').first().addClass('open').find('> div').show();
2769			$(this).find('> .toggle').first().find('a i').attr('class','icon-minus-sign');
2770		});
2771		
2772		
2773		$('.toggles').each(function(){
2774			
2775			var $isAccordion = ($(this).hasClass('accordion')) ? true : false;
2776			
2777			$(this).find('.toggle').each(function(){
2778				if($(this).find('> div .testimonial_slider').length > 0 || $(this).find('> div iframe').length > 0) {
2779					var $that = $(this);
2780					$(this).find('> div').show().css({'opacity':0,'height':'1px', 'padding':'0'});
2781					
2782					testimonialHeightResize();
2783					
2784					setTimeout(function(){
2785						$that.find('> div').hide().css({'opacity':1,'height':'auto', 'padding':'10px 14px'}); 
2786						if($isAccordion == true && $that.index() == 0) $that.find('> div').slideDown(300);
2787					},900);
2788				} 
2789			});
2790		})
2791	}
2792	accordionInit();
2793
2794	//deep linking
2795	function accordionDeepLinking(){
2796		if(typeof $_GET['toggle'] != 'undefined'){
2797			$('.toggles').each(function(){
2798
2799				$(this).find('.toggle').each(function(){
2800					var $currentText = $(this).find('h3 a').clone();
2801					var $getText = $_GET['toggle'];
2802
2803					$($currentText).find('i').remove();
2804					$currentText = $currentText.text();
2805					$currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
2806					$getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
2807
2808					if($currentText == $getText) $(this).find('h3 a').click();
2809				});
2810			});
2811		}
2812	}
2813	accordionDeepLinking();
2814
2815/***************** Button ******************/
2816	
2817	$.cssHooks.color = {
2818	    get: function(elem) {
2819	        if (elem.currentStyle)
2820	            var color = elem.currentStyle["color"];
2821	        else if (window.getComputedStyle)
2822	            var color = document.defaultView.getComputedStyle(elem,
2823	                null).getPropertyValue("color");
2824	        if (color.search("rgb") == -1)
2825	            return color;
2826	        else {
2827	            color = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
2828	            function hex(x) {
2829	                return ("0" + parseInt(x).toString(16)).slice(-2);
2830	            }
2831	            if(color) {
2832	            	return "#" + hex(color[1]) + hex(color[2]) + hex(color[3]);
2833	            }
2834	        }
2835	    }
2836	}
2837
2838	$.cssHooks.backgroundColor = {
2839	    get: function(elem) {
2840	        if (elem.currentStyle)
2841	            var bg = elem.currentStyle["backgroundColor"];
2842	        else if (window.getComputedStyle)
2843	            var bg = document.defaultView.getComputedStyle(elem,
2844	                null).getPropertyValue("background-color");
2845	        if (bg.search("rgb") == -1)
2846	            return bg;
2847	        else {
2848	            bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
2849	            function hex(x) {
2850	                return ("0" + parseInt(x).toString(16)).slice(-2);
2851	            }
2852	            if(bg) {
2853	            	return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]);
2854	            }
2855	        }
2856	    }
2857	}
2858	
2859	function shadeColor(hex, lum) {
2860
2861	  // validate hex string
2862		hex = String(hex).replace(/[^0-9a-f]/gi, '');
2863		if (hex.length < 6) {
2864			hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];
2865		}
2866		lum = lum || 0;
2867
2868		// convert to decimal and change luminosity
2869		var rgb = "#", c, i;
2870		for (i = 0; i < 3; i++) {
2871			c = parseInt(hex.substr(i*2,2), 16);
2872			c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
2873			rgb += ("00"+c).substr(c.length);
2874		}
2875
2876		return rgb;
2877	}
2878
2879	//color
2880	function coloredButtons() {
2881		$('.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(){
2882			
2883			var $usingMaterialSkin = ($('body.material[data-button-style^="rounded"]').length > 0) ? true : false;
2884			$(this).css('visibility','visible');
2885			
2886			if($(this).hasClass('see-through-3') && $(this).attr('data-color-override') == 'false') {
2887				return true;
2888			}
2889			//if($(this).attr('data-color-override') != 'false'){
2890
2891				if($(this).attr('data-color-override') != 'false') {
2892					var $color = $(this).attr('data-color-override') ;
2893				} else {
2894					if($(this).parents('.dark').length > 0) 
2895						var $color = '#000000';
2896					else 
2897						var $color = '#ffffff';
2898				}
2899
2900				if(!$(this).hasClass('see-through-3')) $(this).css('color',$color);
2901				$(this).find('i').css('color',$color);
2902				
2903				var colorInt = parseInt($color.substring(1),16);
2904				var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override';
2905				var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff';
2906				
2907		   		var R = (colorInt & 0xFF0000) >> 16;
2908		    	var G = (colorInt & 0x00FF00) >> 8;
2909		   		var B = (colorInt & 0x0000FF) >> 0;
2910		   		
2911		   		$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2912
2913				$(this).css('border-color','rgba('+R+','+G+','+B+','+$opacityStr+')');
2914				
2915				//material buttons w/ icons starting
2916				if($usingMaterialSkin) {
2917					$(this).find('i').css({'background-color': 'rgba('+R+','+G+','+B+',1)', 'box-shadow': '0px 8px 15px rgba('+R+','+G+','+B+',0.24)'});
2918				}
2919				
2920				if($(this).hasClass('see-through')) {
2921					
2922					$(this).hover(function(){
2923						$(this).css('border-color','rgba('+R+','+G+','+B+',1)');
2924					},function(){
2925						$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2926						$(this).css('border-color','rgba('+R+','+G+','+B+','+$opacityStr+')');
2927					});
2928					
2929				} else {
2930					
2931					$(this).find('i').css('color', $hoverTextColor);
2932					
2933					if($hoverColor != 'no-override'){
2934						
2935						$(this).hover(function(){
2936							$(this).css({
2937								'border-color': $hoverColor,
2938								'background-color': $hoverColor,
2939								'color': $hoverTextColor
2940							});
2941							
2942							//material buttons w/ icons over
2943							if($usingMaterialSkin) {
2944								$(this).find('i').css({'background-color': '', 'box-shadow': ''});
2945							}
2946							
2947						},function(){
2948							$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2949							
2950							//material buttons w/ icons leave
2951							if($usingMaterialSkin) {
2952								$(this).find('i').css({'background-color': 'rgba('+R+','+G+','+B+',1)', 'box-shadow': '0px 8px 15px rgba('+R+','+G+','+B+',0.24)'});
2953							}
2954							
2955							if(!$(this).hasClass('see-through-3')) {
2956								$(this).css({
2957									'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
2958									'background-color': 'transparent',
2959									'color': $color
2960								});
2961							} else {
2962								$(this).css({
2963									'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
2964									'background-color': 'transparent'
2965								});
2966							}
2967						});
2968					
2969					} else {
2970						$(this).hover(function(){
2971							$(this).css({
2972								'border-color': $hoverColor,
2973								'color': $hoverTextColor
2974							});
2975						},function(){
2976							$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2977							$(this).css({
2978								'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
2979								'color':  $hoverTextColor
2980							});
2981						});
2982					
2983					}
2984			//	}
2985			
2986			}
2987		});
2988		
2989		$('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function(){
2990			
2991			$(this).css('visibility','visible');
2992			
2993			if($(this).attr('data-color-override') != 'false'){
2994				
2995				var $color = $(this).attr('data-color-override');
2996				$(this).removeClass('accent-color').removeClass('extra-color-1').removeClass('extra-color-2').removeClass('extra-color-3');
2997				$(this).css('background-color',$color);
2998				
2999			}
3000			
3001		});
3002
3003
3004		//solid color tilt 
3005		if($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) {
3006
3007			var $tiltButtonCssString = '';
3008
3009			$('.swiper-slide .solid_color_2 a').each(function(i){
3010				
3011				$(this).addClass('instance-'+i);
3012
3013				if($(this).attr('data-color-override') != 'false') {
3014					var $color = $(this).attr('data-color-override');
3015				} else {
3016					if($(this).parents('.dark').length > 0) 
3017						var $color = '#000000';
3018					else 
3019						var $color = '#ffffff';
3020				}
3021
3022				$(this).css('color',$color);
3023				$(this).find('i').css('color',$color);
3024				
3025				var $currentColor = $(this).css('background-color');
3026				var $topColor = shadeColor($currentColor, 0.13);
3027				var $bottomColor = shadeColor($currentColor, -0.15);
3028	
3029				$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+'; } ';
3030
3031			});
3032
3033
3034			$('.tilt-button-wrap a').each(function(i){
3035				
3036				$(this).addClass('instance-'+i);
3037
3038				var $currentColor = $(this).css('background-color');
3039
3040				if($(this).attr('data-color-override') != 'false') {
3041					var $color = $(this).attr('data-color-override');
3042					$(this).css('background-color',$color);
3043					$currentColor = $color;
3044				} 
3045			
3046				var $topColor = shadeColor($currentColor, 0.13);
3047				var $bottomColor = shadeColor($currentColor, -0.15);
3048	
3049				$tiltButtonCssString += '.tilt-button-wrap a.instance-'+i + ':after { background-color: '+$topColor+';  }' + ' .tilt-button-wrap a.instance-'+i + ':before { background-color: '+$bottomColor+'; } ';
3050
3051			});
3052
3053			var head = document.head || document.getElementsByTagName('head')[0];
3054   			var style = document.createElement('style');
3055
3056   			style.type = 'text/css';
3057			if (style.styleSheet){
3058			  style.styleSheet.cssText = $tiltButtonCssString;
3059			} else {
3060			  style.appendChild(document.createTextNode($tiltButtonCssString));
3061			}
3062
3063			head.appendChild(style);
3064		}
3065
3066
3067		//transparent 3d
3068		if($('.nectar-3d-transparent-button').length > 0) {
3069
3070			var $3dTransButtonCssString = '';
3071			$('.nectar-3d-transparent-button').each(function(i){
3072
3073				var $that = $(this);
3074				var $size = $that.attr('data-size');
3075				var $padding = 0;
3076
3077		
3078
3079				//size
3080
3081				if($size == 'large') {
3082					$padding = 46;
3083					$font_size = 16;
3084				} else if($size == 'medium') {
3085					$padding = 30;
3086					$font_size = 16;
3087				} else if($size == 'small') {
3088					$padding = 20;
3089					$font_size = 12;
3090				} else if($size == 'jumbo') {
3091					$padding = 54;
3092					$font_size = 24;
3093				} else if($size == 'extra_jumbo') {
3094					$padding = 100;
3095					$font_size = 64;
3096				}
3097
3098				$that.find('svg text').attr('font-size',$font_size);
3099				$boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect();
3100
3101				$text_width = $boundingRect.width;
3102				$text_height = $font_size*1.5;
3103
3104				$extraMult = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 0 : 1;
3105
3106				$that.css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'});
3107				$that.find('> a').css({'height': ($text_height+$padding)+'px'});
3108
3109				$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));
3110				if($size == 'jumbo')
3111					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.68) +')');
3112				else if($size == 'extra_jumbo')
3113					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.6)/2 +' ' + (($text_height+$padding) / 1.6) +')');
3114				else if($size == 'large') {
3115					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.7) +')');
3116				}
3117				else {
3118					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.65) +')');
3119				}
3120				$that.find('.front-3d ').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
3121				$that.find('.back-3d').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
3122
3123				//mask
3124				$(this).find('.front-3d svg >
3124 rect').attr('id','masked-rect-id-'+i);
3125				$(this).find('.front-3d defs mask').attr('id','button-text-mask-'+i);
3126
3127				$that.css('visibility','visible');
3128				$3dTransButtonCssString+= '#masked-rect-id-'+i+' { mask: url(#button-text-mask-'+i+'); -webkit-mask: url(#button-text-mask-'+i+')} ';
3129
3130			});
3131
3132			//extra jumbo resize
3133			function createExtraJumboSize() {
3134				$('.nectar-3d-transparent-button').each(function(i){
3135					
3136					if($(this).css('visibility') != 'visible') return;
3137
3138					var $that = $(this);
3139					var $size = $that.attr('data-size');
3140					if($size == 'extra_jumbo') {
3141
3142						$extraMult = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 0 : 1;
3143
3144						if(window.innerWidth < 1000 && window.innerWidth > 690) {
3145							$padding = 64;
3146							$font_size = 34;
3147							$that.find('.back-3d rect').attr('stroke-width','12');
3148							$vert_height_divider = 1.7;
3149						} else if(window.innerWidth <= 690 ) {
3150							$padding = 46;
3151							$font_size = 16;
3152							$that.find('.back-3d rect').attr('stroke-width','10');
3153							$vert_height_divider = 1.7;
3154						}  else {
3155							$padding = 100;
3156							$font_size = 64;
3157							$that.find('.back-3d rect').attr('stroke-width','20');
3158							$vert_height_divider = 1.6;
3159						}
3160			
3161
3162						$that.find('svg text').attr('font-size',$font_size);
3163
3164						$boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect();
3165						$text_width = $boundingRect.width;
3166						$text_height = $font_size*1.5;
3167
3168						$that.css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'});
3169						$that.find('> a').css({'height': ($text_height+$padding)+'px'});
3170
3171						$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));
3172
3173						$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.6)/2 +' ' + (($text_height+$padding) / $vert_height_divider) +')');
3174
3175						$that.find('.front-3d ').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
3176						$that.find('.back-3d').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
3177
3178					}
3179				});
3180			}
3181			createExtraJumboSize();
3182			$(window).on('smartresize',createExtraJumboSize);
3183
3184			var head = document.head || document.getElementsByTagName('head')[0];
3185				var style = document.createElement('style');
3186
3187				style.type = 'text/css';
3188			if (style.styleSheet){
3189			  style.styleSheet.cssText = $3dTransButtonCssString;
3190			} else {
3191			  style.appendChild(document.createTextNode($3dTransButtonCssString));
3192			}
3193
3194			head.appendChild(style);
3195		}
3196
3197		//gradient btn init
3198		setTimeout(function(){
3199			$('.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');
3200		},150);
3201		//no grad for ff
3202		if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) {
3203			$('.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');
3204		}
3205	}	
3206
3207	coloredButtons();
3208
3209
3210	//large icon hover
3211	function largeIconHover(){
3212		$('.icon-3x').each(function(){
3213			$(this).closest('.col').hover(function(){
3214				$(this).find('.icon-3x').addClass('hovered')
3215			},function(){
3216				$('.icon-3x').removeClass('hovered')
3217			});
3218		});
3219
3220		//remove gradient from FF
3221		if( navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./))
3222			$('[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');
3223	}
3224	largeIconHover();
3225
3226
3227/***************** Team Member ******************/
3228function teamMemberFullscreen() {
3229
3230	//open
3231	$('body').on('click','.team-member[data-style="bio_fullscreen"]',function(){
3232		
3233		if($('.nectar_team_member_overlay').length > 0) return;
3234
3235		var $usingBoxedClass = ($('body > #boxed').length > 0) ? 'in-boxed' : null;
3236
3237		$teamMemberMeta = $(this).find('.nectar_team_bio').html();
3238		$teamMemberImg = ($(this).find('.nectar_team_bio_img[data-img-src]').length > 0) ? $(this).find('.nectar_team_bio_img').attr('data-img-src') : '';
3239		$('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>');
3240		if($teamMemberImg.length > 0) {
3241
3242			//fadein img on load
3243			var teamTmpImg = new Image();
3244			teamTmpImg.src = $teamMemberImg;
3245		    teamTmpImg.onload = function() {
3246		        $('.nectar_team_member_overlay .team_member_image').css('opacity','1');
3247		    };
3248			$('.nectar_team_member_overlay .team_member_image').css({ 'background-image': 'url("'+$teamMemberImg+'")'});
3249		}
3250		
3251		
3252		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').height();
3253		$('.nectar_team_member_overlay .inner-wrap').css({ 'padding-top': $headerNavSpace });
3254
3255		teamFullscreenResize();
3256
3257		//transition in
3258		$('.nectar_team_member_overlay').addClass('open').addClass('animating');
3259
3260		setTimeout(function(){
3261			$('.nectar_team_member_close').addClass('visible');
3262			$('.nectar_team_member_overlay').removeClass('animating');
3263		},500);
3264
3265		//bind close mousemove
3266		$(document).on('mousemove',teamMousemoveOn);
3267		
3268		//bind overflow
3269		fullscreenBioScrolling();
3270
3271		if($('.team-member[data-style="bio_fullscreen"]').length > 0 && navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)) { 
3272			$('.nectar_team_member_overlay').addClass('on-mobile');
3273		}
3274
3275	});
3276
3277	//close
3278	$('body').on('click','.nectar_team_member_overlay',function(){
3279		if(!$(this).hasClass('animating')) {
3280
3281			$('.nectar_team_member_overlay').removeClass('open');
3282			$('.nectar_team_member_close').removeClass('visible');
3283
3284			setTimeout(function(){
3285				
3286				//unbind close mousemove
3287				$(document).off('mousemove',teamMousemoveOn);
3288
3289				$('.nectar_team_member_overlay, .nectar_team_member_close').remove();
3290
3291			},820);
3292		}
3293	});
3294
3295	if($('.team-member[data-style="bio_fullscreen"]').length > 0) {
3296		$(window).resize(teamFullscreenResize);
3297	}
3298
3299	
3300}
3301
3302function teamFullscreenResize() {
3303	var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 275 : 0;
3304	$('.nectar_team_member_overlay').css({'width' : $(window).width()-$leftHeaderSize, 'left': $leftHeaderSize});
3305}
3306
3307function fullscreenBioScrolling(){ 
3308	$('.nectar_team_member_overlay .inner-wrap').mousewheel(function(event, delta) {
3309
3310	     this.scrollTop -= (delta * 30);
3311	     event.preventDefault();
3312
3313	});
3314}
3315
3316function teamMousemoveOn(e) {
3317	
3318	if($('a:hover').length > 0) {
3319		$('.nectar_team_member_close .inner').removeClass('visible');
3320	} else {
3321		$('.nectar_team_member_close .inner').addClass('visible');
3322	}
3323    $('.nectar_team_member_close').css({
3324       left:  e.pageX - 26,
3325       top:   e.pageY - $(window).scrollTop() - 29
3326    });
3327}
3328
3329if($('.team-member').length > 0) {
3330	teamMemberFullscreen();
3331}
3332
3333/***************** Column Hover BG ******************/
3334
3335function columnBGColors() {	
3336	
3337	var $columnColorCSS = '';
3338
3339	$('.wpb_column').each(function(i){
3340
3341		$(this).addClass('instance-'+i);
3342
3343		//bg color
3344		if($(this).attr('data-has-bg-color') == 'true') {
3345			if($(this).is('[data-animation*="reveal"]') && $(this).hasClass('has-animation')) 
3346				$columnColorCSS += '.wpb_column.instance-'+i+ ' .column-inner-wrap .column-inner:before { background-color:' + $(this).attr('data-bg-color') + ';  opacity: '+$(this).attr('data-bg-opacity')+'; }';
3347			else 
3348				$columnColorCSS += '.wpb_column.instance-'+i+ ':before { background-color:' + $(this).attr('data-bg-color') + ';  opacity: '+$(this).attr('data-bg-opacity')+'; }';
3349		}
3350
3351		//hover bg color
3352		if($(this).is('[data-hover-bg^="#"]')) {
3353			if($(this).is('[data-animation*="reveal"]') && $(this).hasClass('has-animation')) 
3354				$columnColorCSS += '.wpb_column.instance-'+i+ ':hover .column-inner:before { background-color: '+$(this).attr('data-hover-bg') + '; opacity: '+$(this).attr('data-hover-bg-opacity')+'; }';
3355			else 
3356	   			$columnColorCSS += '.wpb_column.instance-'+i+ ':hover:before { background-color: '+$(this).attr('data-hover-bg') + '; opacity: '+$(this).attr('data-hover-bg-opacity')+'; }';
3357
3358		}
3359	});
3360
3361	if($columnColorCSS.length > 1) {
3362		var head = document.head || document.getElementsByTagName('head')[0];
3363		var style = document.createElement('style');
3364
3365		style.type = 'text/css';
3366		if (style.styleSheet){
3367		  style.styleSheet.cssText = $columnColorCSS;
3368		} else {
3369		  style.appendChild(document.createTextNode($columnColorCSS));
3370		}
3371
3372		head.appendChild(style);
3373	}
3374
3375}
3376columnBGColors();
3377
3378
3379
3380/***************** Row Color Overlay ******************/
3381function rowColorOverlay() {	
3382	
3383	var $rowOverlayCSS = '';
3384
3385	$('.row > .wpb_row > .row-bg-wrap .row-bg[data-color_overlay],  #nectar_fullscreen_rows .full-page-inner-wrap > .full-page-inner > .row-bg-wrap .row-bg[data-color_overlay], #portfolio-extra > .wpb_row > .row-bg-wrap .row-bg[data-color_overlay], .single .post-area .content-inner > .wpb_row > .row-bg-wrap .row-bg[data-color_overlay]').each(function(i){
3386
3387		$(this).parents('.row-bg-wrap').addClass('instance-'+i);
3388
3389		$overlayOpacity = ($(this).attr('data-overlay_strength').length > 0) ? $(this).attr('data-overlay_strength') : '1';
3390		
3391		var $using_img_trans = false;
3392
3393		if($overlayOpacity == 'image_trans') { 
3394			$overlayOpacity = '1';
3395			$using_img_trans = true;
3396		}
3397
3398		$overlay1 = ($(this).attr('data-color_overlay').length > 0) ? $(this).attr('data-color_overlay') : 'transparent';
3399		$overlay2 = ($(this).attr('data-color_overlay_2').length > 0) ? $(this).attr('data-color_overlay_2') : 'transparent';
3400		$gradientDirection = ($(this).attr('data-gradient_direction').length > 0) ? $(this).attr('data-gradient_direction') : 'left_t_right';
3401		switch($gradientDirection) {
3402			case 'left_to_right' : 
3403				var $gradientDirectionDeg = '90deg';
3404				break;
3405			case 'left_t_to_right_b' : 
3406				var $gradientDirectionDeg = '135deg';
3407				break;
3408			case 'left_b_to_right_t' : 
3409				var $gradientDirectionDeg = '45deg';
3410				break;
3411			case 'top_to_bottom' : 
3412				var $gradientDirectionDeg = 'to bottom';
3413				break;
3414		} 
3415		$enableGradient = ($(this).attr('data-enable_gradient') == 'true') ? true : false;
3416
3417		if($enableGradient) {
3418			
3419			//safari transparent white fix
3420			if($overlay1 == '#ffffff' && $overlay2 == 'transparent') $overlay2 = 'rgba(255,255,255,0.001)';
3421			if($overlay1 == 'transparent' && $overlay2 == '#ffffff') $overlay1 = 'rgba(255,255,255,0.001)';
3422			
3423			if($gradientDirection == 'top_to_bottom') {
3424			
3425				if($overlay2 == 'transparent' || $overlay2 == 'rgba(255,255,255,0.001)') {
3426	 
3427					$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 0%,' + $overlay2 + ' 75%);  opacity: '+$overlayOpacity+'; }';
3428				}
3429
3430				if($overlay1 == 'transparent' || $overlay1 == 'rgba(255,255,255,0.001)') { 
3431					$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 25%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
3432				}
3433				
3434				if( $overlay1 != 'transparent' && $overlay2 != 'transparent') { 
3435					$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after {  background: '+$overlay1+'; background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 0%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
3436				}
3437			
3438			} 
3439			else if($gradientDirection == 'left_to_right') {
3440
3441				if($overlay1 == 'transparent' || $overlay1 == 'rgba(255,255,255,0.001)') { 
3442					$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: '+$overlay1+'; background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 25%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
3443				}
3444
3445				if( $overlay1 != 'transparent' && $overlay2 != 'transparent') { 
3446					$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: '+$overlay1+'; background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 0%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
3447				}
3448			}
3449
3450			else {
3451				$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: '+$overlay1+'; background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 0%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
3452			}
3453
3454
3455		} else {
3456
3457			if($(this).attr('data-color_overlay').length > 0) {
3458				$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background-color:' + $overlay1 + ';  opacity: '+$overlayOpacity+'; }';
3459			}
3460
3461		}
3462	
3463
3464
3465	});
3466	
3467	if($rowOverlayCSS.length > 1) {
3468		var head = document.head || document.getElementsByTagName('head')[0];
3469		var style = document.createElement('style');
3470
3471		style.type = 'text/css';
3472		if (style.styleSheet){
3473		  style.styleSheet.cssText = $rowOverlayCSS;
3474		} else {
3475		  style.appendChild(document.createTextNode($rowOverlayCSS));
3476		}
3477
3478		head.appendChild(style);
3479	}
3480
3481}
3482
3483rowColorOverlay();
3484
3485
3486/***************** morphing button ******************/
3487
3488function morphingOutlines() {
3489
3490	if($('.morphing-outline').length > 0) {
3491
3492		$morphingOutlineCSS = '';
3493
3494		$('.morphing-outline').each(function(i){
3495			$(this).addClass('instance-'+i).css({'visibility':'visible'});
3496			var $width = $(this).find('.inner').width();
3497			var $height = $(this).find('.inner').height();
3498			var $border = parseInt($(this).attr("data-border-thickness"));
3499			var $hover = ($('body[data-button-style*="rounded"]').length > 0) ? ':hover': '';
3500			var $hover2 = ($('body[data-button-style*="rounded"]').length > 0) ? '': ':hover';
3501
3502			$morphingOutlineCSS += 'body .morphing-outline.instance-'+i+' .inner > * { color: '+$(this).attr("data-starting-color")+'; } ';
3503			$morphingOutlineCSS += 'body .morphing-outline.instance-'+i+' .inner:after  { border-width:'+$(this).attr("data-border-thickness")+'px ; border-color: '+$(this).attr("data-starting-color")+'; } ';
3504			
3505			$morphingOutlineCSS += 'body .wpb_column:hover > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner > *, body .wpb_column:hover > .vc_column-inner > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner > * { color: '+$(this).attr("data-hover-color")+'; } ';
3506			$morphingOutlineCSS += 'body .wpb_column:hover > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner:after, body .wpb_column:hover > .vc_column-inner > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner:after  { border-color: '+$(this).attr("data-hover-color")+'; } ';
3507			//padding calcs
3508			$morphingOutlineCSS += 'body .wpb_column'+$hover2+' > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner:after, body .wpb_column'+$hover2+' > .vc_column-inner > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner:after { padding: '+(($width+100 + $border*2 - $height)/2 - $border) +'px 50px}';
3509			$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
3510			$morphingOutlineCSS += 'body .wpb_column'+$hover2+' > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner:after, body .wpb_column'+$hover2+' > .vc_column-inner > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner:after { top: -'+ parseInt((($width+100 + $border*2 - $height)/2 - $border) + $border)+ 'px }';
3511
3512			$morphingOutlineCSS += 'body .wpb_column > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner:after, body .wpb_column > .vc_column-inner > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner:after { left: -' + parseInt(50+$border) + 'px }';
3513			////hover
3514			$morphingOutlineCSS += 'body .wpb_column'+$hover+' > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner:after, body .wpb_column'+$hover+' > .vc_column-inner > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner:after { padding: 50px 50px}';
3515			$morphingOutlineCSS += 'body .wpb_column'+$hover+' > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner:after, body .wpb_column'+$hover+' > .vc_column-inner > .wpb_wrapper > .morphing-outline.instance-'+i+' .inner:after { top: -'+parseInt(50+$border) +'px }';
3516
3517		});
3518
3519		var head = document.head || document.getElementsByTagName('head')[0];
3520		var style = document.createElement('style');
3521
3522		style.type = 'text/css';
3523		style.id = 'morphing-outlines';
3524		if (style.styleSheet){
3525		  style.styleSheet.cssText = $morphingOutlineCSS;
3526		} else {
3527		  style.appendChild(document.createTextNode($morphingOutlineCSS));
3528		}
3529
3530		$('#morphing-outlines').remove();
3531		head.appendChild(style);
3532	}
3533}
3534
3535setTimeout(morphingOutlines,100); 
3536setTimeout(fullWidthContentColumns,126);
3537
3538
3539/***************** svg icons *******************/
3540
3541var $svg_icons = [];
3542function svgAnimations() {
3543	
3544	$svgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
3545
3546	if($svg_icons.length == 0) {
3547
3548		$('.svg-icon-holder:not(.animated-in)').has('svg').each(function(i){
3549			var $that = $(this);
3550
3551			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)) $that.attr('data-animation','false');
3552
3553			//size
3554			$that.find('svg').css({'height': parseInt($that.attr('data-size')) +'px', 'width': parseInt($that.attr('data-size')) +'px'});
3555
3556			//animation
3557			$(this).find('svg').attr('id','nectar-svg-animation-instance-'+i);
3558			var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200;
3559			if($that.attr('data-animation') == 'false') { 
3560				$animationSpeed = 1;
3561				$that.css('opacity','1');
3562			}
3563
3564			if(!$that.hasClass('bound')) {
3565				$svg_icons[i] = new Vivus($that.find('svg').attr('id'), {type: 'delayed', pathTimingFunction: Vivus.EASE_OUT, animTimingFunction: Vivus.LINEAR, duration: $animationSpeed, onReady: svgInit });
3566			}
3567
3568			if($animationSpeed !== 1) {
3569
3570				var $that = $(this);
3571				var waypoint = new Waypoint({
3572		 			element: $that,
3573		 			 handler: function(direction) {
3574		 			 	if( $that.hasClass('animated-in')) { 
3575						     waypoint.destroy();
3576						     return;
3577						}
3578
3579		 			 	checkIfReady();
3580						$that.addClass('animated-in');
3581						waypoint.destroy();
3582					},
3583					offset: $svgOffsetPos
3584
3585				}); 
3586
3587			} else {
3588				checkIfReady();
3589			}
3590
3591			function checkIfReady() {
3592				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;
3593				
3594				var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g,'');
3595
3596				if($svg_icons[$iconID].isReady == true) {
3597					 setTimeout(function(){ $that.css('opacity','1'); $svg_icons[$iconID].reset().play(); },$animationDelay);
3598				} else {
3599					setTimeout(checkIfReady,50);
3600				}
3601			}
3602
3603			function svgInit() {
3604
3605				//set size
3606				$that.css({'height': parseInt($that.attr('data-size')) +'px', 'width': parseInt($that.attr('data-size')) +'px'});
3607
3608				//var $iconID = $that.find('svg').attr('id');
3609				//$iconID = $iconID.replace(/[^0-9]/g,'');
3610				
3611				//stop animation until user scrolls to it
3612				//svg_icons[$iconID].reset().stop();
3613
3614				//set color
3615				//var svgDoc = $that.find('object')[0].contentDocument;
3616
3617				//var styleElement = svgDoc.createElementNS("http://www.w3.org/2000/svg", "style");
3618				//styleElement.textContent = "svg, svg path { stroke: "+$that.css('color')+"; fill: none; }"; 
3619				//svgDoc.getElementById("Layer_1").appendChild(styleElement);
3620
3621			}
3622
3623			$that.addClass('bound');
3624
3625		});	
3626	} else {
3627		$('.svg-icon-holder').addClass('animated-in').css('opacity','1');
3628	}
3629	
3630	//full vc row support
3631	$('#nectar_fullscreen_rows .svg-icon-holder.animated-in').has('svg').each(function(i){
3632		
3633		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;
3634		var $that = $(this);
3635
3636		var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g,'');
3637
3638		clearTimeout($animatedSVGIconTimeout[i]);
3639
3640		if($that.attr('data-animation') == 'false') { 
3641			$animationSpeed = 1;
3642			$that.css('opacity','1');
3643			$svg_icons[$iconID].finish();
3644		} else {
3645			if($(this).parents('.active').length > 0 || $(this).parents('#footer-outer').length > 0 || $('body.mobile').length > 0) {
3646				$svg_icons[$iconID].reset();
3647				$animatedSVGIconTimeout[i] = setTimeout(function(){ $svg_icons[$iconID].play(); },$animationDelay);
3648			}
3649
3650			else {
3651				$svg_icons[$iconID].reset().stop();
3652			}
3653		}
3654	});
3655}
3656//svg in equal height column resize
3657if($('.vc_row-o-equal-height .svg-icon-holder[data-animation="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) {
3658	 $(window).on('smartresize', function(){
3659	    clearTimeout($svgResizeTimeout);
3660	    $svgResizeTimeout = setTimeout(function(){ 
3661
3662	    	if($svg_icons.length > 0) {
3663	        	$('.svg-icon-holder.animated-in').each(function(i){
3664					$(this).css('opacity','1');
3665					var $iconID = $(this).attr('id').replace(/[^0-9]/g,'');
3666					$svg_icons[$iconID].finish();
3667				});
3668	        }
3669
3670	     },300);
3671	});
3672}
3673
3674//if($('.nectar-box-roll').length == 0 || $('body.mobile').length > 0) setTimeout(svgAnimations,100);
3675
3676/***************** fancy ul ******************/
3677
3678	function nectar_fancy_ul_init() {
3679		$($fullscreenSelector+'.nectar-fancy-ul').each(function(){
3680
3681
3682			var $icon = $(this).attr('data-list-icon');
3683			var $color = $(this).attr('data-color');
3684			var $animation = $(this).attr('data-animation');
3685			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;
3686			
3687			$(this).find('li').each(function(){
3688				
3689				if($(this).find('> i').length == 0) 
3690					$(this).prepend('<i class="icon-default-style '+$icon+ ' ' + $color +'"></i> ');
3691			});
3692
3693			
3694			if($animation == 'true') {
3695
3696
3697				var $that = $(this);
3698				var waypoint = new Waypoint({
3699		 			element: $that,
3700		 			 handler: function(direction) {
3701
3702		 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
3703						     waypoint.destroy();
3704						     return;
3705						}
3706
3707						setTimeout(function(){
3708			 			 	$that.find('li').each(function(i){
3709			 			 		var $that = $(this);
3710								$that.delay(i*220).transition({
3711									'opacity': '1',
3712									'left' : '0'
3713								},220,'easeOutCubic');
3714							});
3715			 			 },$animationDelay);
3716
3717						$that.addClass('animated-in');
3718						waypoint.destroy();
3719					},
3720					offset: 'bottom-in-view'
3721
3722				}); 
3723
3724			} 
3725			
3726			
3727			
3728		});
3729	}
3730	setTimeout(function(){ 
3731		//if($('.nectar-box-roll').length == 0) nectar_fancy_ul_init();
3732	},$animationOnScrollTimeOut); 
3733
3734	
3735
3736/***************** flip box min heights ******************/
3737//if content height exceeds min height change it
3738function flipBoxHeights() {
3739	$('.nectar-flip-box').each(function(){
3740		
3741		var $flipBoxMinHeight = parseInt($(this).attr('data-min-height'));
3742		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();
3743
3744		if($flipBoxHeight >= $flipBoxMinHeight - 80) {
3745			$(this).find('> div').css('height', $flipBoxHeight + 80);
3746		} else 
3747			$(this).find('> div').css('height','auto');
3748
3749	});
3750}
3751flipBoxHeights();
3752
3753if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
3754	$('body').on('click','.nectar-flip-box', function(){
3755		$(this).toggleClass('flipped');
3756	});
3757}
3758
3759/***************** PARALLAX SECTIONS ******************/
3760	
3761	// Create cross browser requestAnimationFrame method:
3762    window.requestAnimationFrame = window.requestAnimationFrame
3763     || window.mozRequestAnimationFrame
3764     || window.webkitRequestAnimationFrame
3765     || window.msRequestAnimationFrame
3766     || function(f){setTimeout(f, 1000/60)}
3767
3768
3769	var $window = $(window);
3770	var windowHeight = $window.height();
3771	
3772	$window.unbind('scroll.parallaxSections').unbind('resize.parallaxSections');
3773	$window.unbind('resize.parallaxSectionsUpdateHeight');
3774	$window.unbind('load.parallaxSectionsOffsetL');
3775	$window.unbind('resize.parallaxSectionsOffsetR');
3776
3777	$window.on('resize.parallaxSectionsUpdateHeight',psUpdateWindowHeight);
3778
3779	function psUpdateWindowHeight() {
3780		windowHeight = $window.height();
3781	}
3782
3783	function psUpdateOffset($this) {
3784		$this.each(function(){
3785	  	    firstTop = $this.offset().top;
3786		});
3787	}
3788	
3789	$.fn.parallaxScroll = function(xpos, speedFactor, outerHeight) {
3790		var $this = $(this);
3791		var getHeight;
3792		var firstTop;
3793		var paddingTop = 0;
3794		
3795		//get the starting position of each element to have parallax applied to it		
3796		$this.each(function(){
3797		    firstTop = $this.offset().top;
3798		});
3799		
3800		
3801		$window.on('resize.parallaxSectionsOffsetR',psUpdateOffset($this));
3802		$window.on('load.parallaxSectionsOffsetL',psUpdateOffset($this));
3803	
3804		getHeight = function(jqo) {
3805			return jqo.outerHeight(true);
3806		};
3807		 
3808			
3809		// setup defaults if arguments aren't specified
3810		if (arguments.length < 1 || xpos === null) xpos = "50%";
3811		if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1;
3812		if (arguments.length < 3 || outerHeight === null) outerHeight = true;
3813		
3814		// function to be called whenever the window is scrolled or resized
3815
3816		var $element, top, height, pos;
3817
3818		function update(){
3819
3820
3821			pos = $window.scrollTop();				
3822			
3823			$this.each(function(){
3824
3825				firstTop = $this.offset().top;
3826
3827				$element = $(this);
3828				top = $element.offset().top;
3829				height = getHeight($element);
3830				
3831				// Check if totally above or totally below viewport
3832				if (top + height < pos || top > pos + windowHeight) {
3833					return;
3834				}
3835
3836				var ua = window.navigator.userAgent;
3837		        var msie = ua.indexOf("MSIE ");
3838
3839		        //for IE, Safari or any setup using the styled scrollbar default to animating the BG pos
3840		        if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true) {
3841		        	$this.find('.row-bg.using-image').css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px");
3842		        }
3843		       	//for Firefox/Chrome use a higher performing method
3844		        else  {
3845		        	var $ifFast = ($this.find('.row-bg[data-parallax-speed="fast"]').length > 0) ? ($element.find('.row-bg').height() - height)/2.5 : 0;
3846		        	$this.find('.row-bg.using-image').addClass('translate').css({ 'transform':  'translate3d(0, ' + Math.round(((window.innerHeight + pos -  firstTop) * speedFactor) -($ifFast)) + 'px, 0), scale(1.005)' });
3847		        } 
3848
3849				
3850			});
3851		}		
3852
3853		if (window.addEventListener) {
3854			 window.addEventListener('scroll', function(){ 
3855	          requestAnimationFrame(update); 
3856	        }, false);
3857		}
3858
3859		$window.on('resize.parallaxSections',update);
3860
3861		update();
3862	};
3863
3864
3865
3866	
3867/***************** Full Width Section ******************/
3868
3869	//nectar slider in container but fullwidth fix
3870	$('.wpb_row .vc_col-sm-12 .nectar-slider-wrap[data-full-width="true"]').each(function(){
3871		if($(this).parents('.wpb_row.full-width-section').length == 0 && $(this).parents('.wpb_row.full-width-content').length == 0) {
3872			$(this).parents('.wpb_row').addClass('full-width-section');
3873		}
3874	});
3875
3876	function fullWidthSections(){
3877		
3878		var $windowInnerWidth = window.innerWidth;
3879		var $scrollBar = ($('#ascrail2000').length > 0 && $windowInnerWidth > 1000) ? -13 : 0;
3880		var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? parseInt($('.body-border-right').width())*2 : 0;
3881
3882		if($('#boxed').length == 1){
3883			$justOutOfSight = ((parseInt($('.container-wrap').width()) - parseInt($('.main-content').width())) / 2) + 4;
3884		} else {
3885			
3886			//if the ext responsive mode is on - add the extra padding into the calcs
3887			var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && $windowInnerWidth >= 1000) ? 180 : 0;
3888			var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0;
3889			if($(window).width() - $leftHeaderSize - $bodyBorderWidth  <= parseInt($('.main-content').css('max-width'))) { 
3890				var $windowWidth = parseInt($('.main-content').css('max-width'));
3891
3892				//no need for the scrollbar calcs with ext responsive on desktop views
3893				if($extResponsivePadding == 180) $windowWidth = $windowWidth - $scrollBar;
3894
3895			} else { 
3896				var $windowWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth;
3897			}
3898
3899			
3900			$contentWidth = parseInt($('.main-content').css('max-width'));
3901
3902			//single post fullwidth
3903			if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 ) {
3904				$contentWidth = $('.post-area').width();
3905				$extResponsivePadding = 0;
3906			}
3907			
3908			$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
3909		}
3910		
3911		$('.full-width-section').each(function(){
3912			
3913			if(!$(this).parents('.span_9').length > 0 && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner' && $(this).parent().attr('id') != 'portfolio-extra' &&
3914			!$(this).hasClass('non-fw')){
3915
3916				$(this).css({
3917					'margin-left': - $justOutOfSight,
3918					'padding-left': $justOutOfSight,
3919					'padding-right': $justOutOfSight,
3920					'visibility': 'visible'
3921				});	
3922
3923			if($('#boxed').length > 0 && $('#nectar_fullscreen_rows').length > 0) $(this).css({ 'padding-left': 0, 'padding-right': 0 });
3924
3925			}  else if($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) {
3926				$(this).css({
3927					'margin-left': - $justOutOfSight,
3928					'padding-left': $justOutOfSight,
3929					'padding-right': $justOutOfSight,
3930					'visibility': 'visible'
3931				});	
3932			}
3933			
3934			else {
3935				$(this).css({
3936					'margin-left': 0,
3937					'padding-left': 0,
3938					'padding-right': 0,
3939					'visibility': 'visible'
3940				});	
3941			}
3942			
3943		});
3944	
3945		
3946	    //full width content sections
3947	    $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow','visible');
3948	    
3949	    $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .full-width-content').each(function(){
3950			
3951			var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0;
3952			var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? parseInt($('.body-border-right').width())*2 : 0;
3953
3954			//single post fullwidth
3955			if($('#boxed').length == 1){
3956
3957				var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
3958
3959				if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) {
3960					$contentWidth = $('.post-area').width();
3961					$extResponsivePadding = 0;
3962					$windowWidth = $(window).width() - $bodyBorderWidth;
3963					$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
3964				} else {
3965					if($(this).parents('.page-submenu').length > 0)
3966						$justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2);
3967					else 
3968						$justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4;
3969				}
3970			} else {
3971				if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) {
3972					$contentWidth = $('.post-area').width();
3973					$extResponsivePadding = 0;
3974					$windowWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth;
3975				} else {
3976
3977					var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').css('max-width')) : parseInt($(this).parents('.container').css('max-width'));
3978
3979					//when using gutter on portfolio don't add extra space for scroll bar
3980			    	if($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') {
3981			    		$scrollBar = ($('#ascrail2000').length > 0 && $windowInnerWidth > 1000) ? -13 : 0;
3982			    	}
3983
3984					if($(window).width() - $leftHeaderSize - $bodyBorderWidth <= $mainContentMaxWidth) { 
3985						$windowWidth = $mainContentMaxWidth;
3986						//no need for the scrollbar calcs with ext responsive on desktop views
3987						if($extResponsivePadding == 180) $windowWidth = $windowWidth - $scrollBar;
3988					}
3989					$contentWidth = $mainContentMaxWidth;
3990					$extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1000) ? 180 : 0;
3991					if($leftHeaderSize > 0) $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1000) ? 120 : 0;
3992				}
3993
3994				$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
3995			}
3996
3997			$extraSpace = 0;
3998			if( $(this).hasClass('carousel-wrap')) $extraSpace = 1;
3999			if( $(this).hasClass('portfolio-items')) $extraSpace = 5;
4000			
4001	    	$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width() - $leftHeaderSize - $bodyBorderWidth +$extraSpace  + $scrollBar ;
4002
4003	    	//when using gutter on portfolio don't add extra space
4004	    	if($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') {
4005	    		if($(window).width() > 1000)
4006	    			$carouselWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth + $scrollBar + 3
4007	    		else 
4008	    			$carouselWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth + $scrollBar 
4009	    	}
4010
4011	    	if($(this).parent().hasClass('default-style')) { 
4012
4013	    		var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
4014	    		
4015	    		if($('#boxed').length != 0) {
4016	    			$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width() - $leftHeaderSize + $extraSpace + $scrollBar ;
4017				}
4018				else {
4019					$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : ($(window).width() - $leftHeaderSize - $bodyBorderWidth) - (($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.025) + $extraSpace + $scrollBar ;
4020					$windowWidth = ($(window).width() - $leftHeaderSize - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($(window).width() - $leftHeaderSize - $bodyBorderWidth) - (($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.025);
4021					$justOutOfSight = Math.ceil( (($windowWidth + $scrollBar - $mainContentWidth) / 2) )
4022				}
4023			}
4024
4025			else if($(this).parent().hasClass('spaced')) { 
4026
4027				var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
4028
4029				if($('#boxed').length != 0) {
4030	    			$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) - ($(window).width()*.02) : $(window).width() + $extraSpace + $scrollBar ;
4031				} else {
4032					$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : ($(window).width()- $leftHeaderSize - $bodyBorderWidth)  - Math.
4032ceil(($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.02) + $extraSpace + $scrollBar ;
4033					var $windowWidth2 = ($(window).width() - $leftHeaderSize - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($(window).width() - $leftHeaderSize - $bodyBorderWidth) - (($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.02);
4034					$justOutOfSight = Math.ceil( (($windowWidth2 + $scrollBar - $mainContentWidth) / 2) +2)
4035				}
4036			}
4037	    	
4038	    	if(!$(this).parents('.span_9').length > 0 && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner' && $(this).parent().attr('id') != 'portfolio-extra' 
4039	      && !$(this).find('.carousel-wrap[data-full-width="true"]').length > 0
4040				&& !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0
4041	    	&& !$(this).find('.portfolio-items:not(".carousel")[data-col-num="elastic"]').length > 0){
4042
4043	    		//escape if inside woocoommerce page and not using applicable layout
4044	    		if($('.single-product').length > 0 && $(this).parents('#tab-description').length > 0 && $(this).parents('.full-width-tabs').length == 0) {
4045	    			$(this).css({
4046						'visibility': 'visible'
4047					});	
4048	    		} else {
4049	    			if($(this).hasClass('portfolio-items')) {
4050	    				$(this).css({
4051							'transform': 'translateX(-'+ $justOutOfSight + 'px)',
4052							'margin-left': 0,
4053							'width': $carouselWidth,
4054							'visibility': 'visible'
4055						});	
4056	    			} else {
4057	    				$(this).css({
4058							'margin-left': - $justOutOfSight,
4059							'width': $carouselWidth,
4060							'visibility': 'visible'
4061						});	
4062	    			}
4063					
4064				}
4065			}  else if($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) {
4066				$(this).css({
4067					'margin-left': - $justOutOfSight,
4068					'width': $carouselWidth,
4069					'visibility': 'visible'
4070				});	
4071			}
4072			
4073			else {
4074				$(this).css({
4075					'margin-left': 0,
4076					'visibility': 'visible'
4077				});	
4078			}
4079	    	
4080	    });
4081
4082	}
4083	
4084	var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length ;
4085
4086	function parallaxSrollSpeed(speedString) {
4087
4088		var ua = window.navigator.userAgent;	
4089		var msie = ua.indexOf("MSIE ");
4090		var speed;
4091
4092		 //not as modern browsers
4093		 if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true) {
4094			 switch(speedString) {
4095			   	  case 'slow':
4096			   	      speed = 0.2;
4097			   	      break;
4098			   	  case 'medium': 
4099			   	  	  speed = 0.4;
4100			   	      break;
4101			   	  case 'fast': 
4102			    	  speed = 0.6;
4103			   	       break;
4104			   }
4105		}
4106		 //chrome/ff
4107		 else {
4108		 	 switch(speedString) {
4109			   	  case 'slow':
4110			   	      speed = 0.6;
4111			   	      break;
4112			   	  case 'medium': 
4113			   	  	  speed = 0.4;
4114			   	      break;
4115			   	  case 'fast': 
4116			    	  speed = 0.25;
4117			   	       break;
4118			   }
4119		}
4120
4121		   return speed;
4122	}
4123
4124	function parallaxScrollInit(){
4125		 parallaxRowsBGCals();
4126		$('.nectar-recent-posts-single_featured, .wpb_row.parallax_section').each(function(){
4127		   var $id = $(this).attr('id');	
4128		  
4129		    var ua = window.navigator.userAgent;	
4130		    var msie = ua.indexOf("MSIE ");
4131
4132			if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true)  {
4133		   		if($(this).find('[data-parallax-speed="fixed"]').length == 0) $('#'+$id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) );
4134		   	} else if($(this).find('[data-parallax-speed="fixed"]').length == 0) {
4135		   		$('#'+$id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) );
4136		   	}
4137		});
4138	}
4139
4140	
4141	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
4142		parallaxScrollInit();
4143		$(window).load(parallaxRowsBGCals);
4144		setTimeout(parallaxRowsBGCals,100);
4145	}
4146
4147	function parallaxRowsBGCals(){
4148
4149		$('.nectar-recent-posts-single_featured, .wpb_row.parallax_section').each(function(){
4150
4151			 var ua = window.navigator.userAgent;
4152		     var msie = ua.indexOf("MSIE ");
4153
4154			 if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true) {
4155			 	$(this).find('.row-bg').css({'height': $(this).outerHeight(true)*2.8, 'margin-top': '-' + ($(this).outerHeight(true)*2.8)/2 + 'px' });
4156			 } else {
4157			 	$(this).find('.row-bg').css({'height': Math.ceil( $(window).height() * parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) ) + $(this).outerHeight(true)   });
4158			 }
4159			 
4160		});
4161	}
4162	
4163	//if fullwidth section is first or last, remove the margins so it fits flush against header/footer
4164	function fwsClasses() {
4165		
4166		$('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function(){
4167			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
4168				if($(this).parents('.wpb_row').index() == '0'){
4169					$(this).addClass('first-nectar-slider');
4170				} 
4171			}
4172		});
4173
4174		if($('#portfolio-extra').length == 0) {
4175			$contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length;
4176		} else {
4177			$contentElementsNum = $('.main-content > .row #portfolio-extra > *').length;
4178		}
4179
4180		$('.full-width-section, .full-width-content:not(.page-submenu .full-width-content), .row > .nectar-slider-wrap[data-full-width="true"], .wpb_wrapper > .nectar-slider-wrap[data-full-width="true"], .parallax_slider_outer, .portfolio-items[data-col-num="elastic"]').each(function(){
4181			
4182			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
4183				
4184				if($(this).parents('.wpb_row').length > 0){ 
4185				
4186					if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
4187					
4188					////first
4189					if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length != 0 || $(this).parents('.wpb_row').index() == '0' && $('.parallax_slider_outer').length != 0){
4190						//$(this).css('margin-top','-2.1em').addClass('first-section nder-page-header');
4191					} 
4192					else if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length == 0 && $('.page-header-no-bg').length == 0 
4193					         && $('.project-title').length == 0 && $(this).parents('.wpb_row').index() == '0' 
4194					         && $('.parallax_slider_outer').length == 0 && $('.project-title').length == 0 
4195					         && $('body[data-bg-header="true"]').length == 0) {
4196
4197					     if($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0 || $('body.material').length > 0 && $('.single').length == 0) {
4198					     	$('.container-wrap').css('padding-top','0px');
4199					     } else {
4200					     	$(this).css('margin-top','-70px').addClass('first-section');
4201					     } 	
4202						
4203					} 
4204					
4205					//check if it's also last (i.e. the only fws)
4206					if($(this).parents('.wpb_row').index() == $contentElementsNum-1 && $('#respond').length == 0 ) { 
4207						if($(this).attr('id') != 'portfolio-filters-inline') {
4208							$('.container-wrap').css('padding-bottom','0px');
4209							$('#call-to-action .triangle').remove();
4210						}
4211					} 
4212				
4213				} else {
4214
4215					if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
4216					
4217					if( $(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area' ) {
4218						
4219						////first
4220						if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' && $('.parallax_slider_outer').length != 0){
4221							//$(this).css('margin-top','-2.1em').addClass('first-section nder-page-header');
4222			
4223						} 
4224						else if($(this).index() == '0' && $('#page-header-bg').length == 0 && $(this).index() == '0' && $('.page-header-no-bg').length == 0 && 
4225						        $(this).index() == '0' && $('.parallax_slider_outer').length == 0 && !$(this).hasClass('blog_next_prev_buttons') ) {
4226						     
4227						      if($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0 || $('body.material').length > 0 && $('.single').length == 0) { 
4228						          $('.container-wrap').css('padding-top','0px');
4229						      } else {
4230						      	  $(this).css('margin-top','-70px').addClass('first-section');
4231						      }   	
4232							
4233						} 
4234						
4235						//check if it's also last (i.e. the only fws)
4236						if($(this).index() == $contentElementsNum-1 && $('#respond').length == 0 && $('body.woocommerce-checkout').length == 0) { 
4237							$('.container-wrap').css('padding-bottom','0px');
4238							$('.bottom_controls').css('margin-top','0px');
4239							$('#call-to-action .triangle').remove();
4240						} 
4241					}
4242					
4243				}
4244			}
4245		});
4246
4247
4248		//add first class for rows for page header trans effect (zoom only as of now)
4249		$('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function(){
4250			
4251			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
4252				
4253				
4254				if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
4255					
4256				if($(this).index() == '0' && $('#page-header-bg').length == 0 && $('.page-header-no-bg').length == 0 
4257				         && $('.project-title').length == 0 && $('body.single').length == 0 
4258				         && $('.parallax_slider_outer').length == 0 && $('.project-title').length == 0 ) {
4259
4260					$(this).addClass('first-section');
4261					var $that = $(this);
4262					setTimeout( function() { $that.addClass('loaded'); },50);
4263					
4264				} 
4265					
4266	
4267			}
4268		});	
4269
4270
4271		
4272		$('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function(){
4273			//check if it's last 
4274			if($(this).index() == $contentElementsNum-1 && $('#commentform').length == 0 && $('#pagination').length == 0) { 
4275				if(parseInt($('.container-wrap').css('padding-bottom')) > 0) $(this).css('margin-bottom','-40px');
4276				$('#call-to-action .triangle').remove();
4277			}
4278		});
4279		
4280		
4281		
4282		$('.portfolio-filters').each(function(){
4283			////first
4284			if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' && $('.parallax_slider_outer').length != 0){
4285				$(this).css({'margin-top':'-2.1em'}).addClass('first-section nder-page-header');
4286			}  else if($(this).index() == '0' && $('#page-header-bg').length == 0 || $(this).index() == '0' && $('.parallax_slider_outer').length == 0){
4287				$(this).css({'margin-top':'0px'}).addClass('first-section');
4288			}
4289		});
4290		
4291		$('.portfolio-filters-inline').each(function(){
4292			////first
4293			if($(this).parents('.wpb_row').length > 0){ 
4294				
4295				if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length != 0 || $(this).parents('.wpb_row').index() == '0' && $('.parallax_slider_outer').length != 0){
4296					if($('body[data-header-resize="0"]').length == 0) $(this).css({'margin-top':'-2.1em', 'padding-top' : '19px'}).addClass('first-section nder-page-header');
4297				}  else if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length == 0 || $(this).parents('.wpb_row').index() == '0' && $('.parallax_slider_outer').length == 0){
4298					
4299					 if($('body[data-header-resize="0"]').length == 1 || $('body.material').length > 0 ) { 
4300				          // $(this).css({'margin-top':'-30px', 'padding-top' : '50px'}).addClass('first-section');
4301				      } else {
4302				      	  $(this).css({'margin-top':'-70px', 'padding-top' : '50px'}).addClass('first-section');
4303				      } 
4304
4305				}
4306				
4307			} else {
4308				if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' && $('.parallax_slider_outer').length != 0){
4309					$(this).css({'margin-top':'-2.1em', 'padding-top' : '19px'}).addClass('first-section nder-page-header');
4310				}  else if($(this).index() == '0' && $('#page-header-bg').length == 0 || $(this).index() == '0' && $('.parallax_slider_outer').length == 0){
4311					
4312					if($('body[data-header-resize="0"]').length == 1 || $('body.material').length > 0) { 
4313				          $(this).css({'margin-top':'-30px', 'padding-top' : '50px'}).addClass('first-section');
4314				      } else {
4315				      	  $(this).css({'margin-top':'-70px', 'padding-top' : '50px'}).addClass('first-section');
4316				      } 
4317
4318				
4319				}
4320			}
4321			
4322		});
4323		
4324		
4325		
4326		$('.parallax_slider_outer').each(function(){
4327			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
4328				
4329				if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
4330				////first
4331				if($(this).parent().index() == '0' && $('#page-header-bg').length != 0){
4332					$(this).addClass('first-section nder-page-header');
4333
4334				} 
4335				else if($(this).parent().index() == '0' && $('#page-header-bg').length == 0){
4336					$(this).css('margin-top','-40px').addClass('first-section');
4337					if(!$('body').hasClass('single-post')) $('.container-wrap').css('padding-top', '0px');
4338				} 
4339				
4340				//check if it's also last (i.e. the only fws)
4341				if($(this).parent().index() == $contentElementsNum-1 && $('.post-area').length == 0) {
4342					$('#call-to-action .triangle').remove();
4343					$('.container-wrap').hide();
4344				}
4345			}
4346		});
4347	}
4348	
4349	//if not using a fullwidth slider first, ajdust the top padding
4350	//if( $('.nectar-slider-wrap.first-section').length > 0 && $('.nectar-slider-wrap.first-section').attr('data-full-width') != 'true' || $('.nectar-slider-wrap.first-section').length > 0 && $('.nectar-slider-wrap.first-section').attr('data-full-width') != 'boxed-full-width' ) $('body').attr('data-bg-header','false');
4351	//if( $('.wpb_row.first-section:not(".full-width-content") .nectar-slider-wrap').length > 0 && $('.wpb_row.first-section:not(".full-width-content") .nectar-slider-wrap').attr('data-full-width') != 'true' || $('.wpb_row.first-section:not(".full-width-content") .nectar-slider-wrap').length > 0 && $('.wpb_row.first-section:not(".full-width-content") .nectar-slider-wrap').attr('data-full-width') != 'boxed-full-width' ) $('body').attr('data-bg-header','false');
4352	
4353	
4354	//set sizes
4355	fullWidthSections();
4356	fwsClasses();
4357	
4358	//sizing for fullwidth sections that are image only
4359
4360	function fullwidthImgOnlySizingInit(){
4361		////set inital sizes
4362		$('.full-width-section:not(.custom-skip)').each(function(){
4363			
4364			var $fwsHeight = $(this).outerHeight(true);
4365
4366			//make sure it's empty and also not being used as a small dvider
4367			if($(this).find('.span_12 *').length == 0 && $.trim( $(this).find('.span_12').text() ).length == 0  && $fwsHeight > 40){
4368				$(this).addClass('bg-only');
4369				$(this).css({'height': $fwsHeight, 'padding-top': '0px', 'padding-bottom': '0px'});
4370				$(this).attr('data-image-height',$fwsHeight);
4371			}
4372
4373		});
4374	}
4375
4376	function fullwidthImgOnlySizing(){
4377
4378		$('.full-width-section.bg-only').each(function(){
4379			var $initialHeight = $(this).attr('data-image-height');
4380			
4381			if( window.innerWidth < 1000 && window.innerWidth > 690 ) {
4382				$(this).css('height', $initialHeight - $initialHeight*.60);
4383			} 
4384			
4385			else if( window.innerWidth <= 690 ) {
4386				$(this).css('height', $initialHeight - $initialHeight*.78);
4387			} 
4388			
4389			else if( window.innerWidth < 1300 && window.innerWidth >= 1000  ) {
4390				$(this).css('height', $initialHeight - $initialHeight*.33);
4391			} 
4392			
4393			else {
4394				$(this).css('height', $initialHeight);
4395			}
4396			
4397		});
4398		
4399	}
4400
4401	fullwidthImgOnlySizingInit();
4402	fullwidthImgOnlySizing();
4403	
4404	
4405	
4406	//change % padding on rows to be relative to screen
4407	function fullWidthRowPaddingAdjustInit(){
4408		if($('#boxed').length == 0){
4409			$('.full-width-section, .full-width-content').each(function(){
4410				var $topPadding = $(this)[0].style.paddingTop;
4411				var $bottomPadding = $(this)[0].style.paddingBottom;
4412
4413				if($topPadding.indexOf("%") >= 0) $(this).attr('data-top-percent',$topPadding);
4414				if($bottomPadding.indexOf("%") >= 0) $(this).attr('data-bottom-percent',$bottomPadding);
4415				
4416
4417			});
4418		}
4419	}
4420
4421	function fullWidthRowPaddingAdjustCalc(){
4422		if($('#boxed').length == 0){
4423			$('.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(){
4424
4425				var $windowHeight = $(window).width();
4426				var $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip';
4427				var $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip';
4428
4429				//top
4430				if($topPadding != 'skip') {
4431					$(this).css('padding-top',$windowHeight*(parseInt($topPadding)/100));
4432				}
4433
4434				//bottom
4435				if($bottomPadding != 'skip'){
4436					$(this).css('padding-bottom',$windowHeight*(parseInt($bottomPadding)/100));
4437				}
4438				
4439
4440			});
4441		}
4442	}
4443	fullWidthRowPaddingAdjustInit();
4444	fullWidthRowPaddingAdjustCalc();
4445
4446	
4447	//full width content column sizing
4448	function fullWidthContentColumns(){
4449
4450		//standard carousel
4451   	  	$('.main-content > .row > .full-width-content, #portfolio-extra > .full-width-content, .woocommerce-tabs #tab-description > .full-width-content, .post-area.span_12 article .content-inner > .full-width-content').each(function(){
4452			
4453
4454			//only set the height if more than one column
4455			if($(this).find('> .span_12 > .col').length > 1){
4456				
4457				var tallestColumn = 0;
4458				var $columnInnerHeight = 0;
4459				
4460				$(this).find('> .span_12 > .col').each(function(){
4461
4462					$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
4463					
4464					var $padding = parseInt($(this).css('padding-top'));
4465					//var $padding = (!$(this).is('[data-animation*="reveal"]')) ? parseInt($(this).css('padding-top')) : parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top')); start to reveal fix
4466					($(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height() + ($padding*2) > tallestColumn) ? tallestColumn = $(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height() + ($padding*2)  : tallestColumn = tallestColumn;
4467				});	
4468	    	 	
4469	    	 	$(this).find('> .span_12 > .col').each(function(){
4470
4471	    	 		$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
4472					
4473	    	 		//columns with content
4474		    	 	if($(this).find('> '+$column_inner_selector+' > .wpb_wrapper > *').length > 0){
4475		    	 		//added in 7.6 to fix equal height columns 
4476		    	 		if(!$(this).parent().parent().hasClass('vc_row-o-equal-height')) $(this).css('height',tallestColumn);
4477		    	 	} 
4478		    	 	//empty columns
4479		    	 	else {
4480		    	 		$(this).css('min-height',tallestColumn);
4481		    	 		if($(this).is('[data-animation*="reveal"]')) $(this).find('.column-inner').css('min-height',tallestColumn);
4482		    	 	}
4483	    	 	});
4484	         	
4485	         	//nested column height
4486	         	var $childRows = $(this).find('> .span_12 > .col .wpb_row').length;
4487	         	if(window.innerWidth > 1000) { 
4488	         		
4489	         		var $padding = parseInt($(this).find('> .span_12 > .col').css('padding-top'));
4490	         		
4491	         		//$(this).find('> .span_12 > .col .wpb_row .col').css('min-height',(tallestColumn-($padding*2))/$childRows + 'px'); 
4492	         	} else {
4493	         		$(this).find('> .span_12 > .col .wpb_row .col').css('min-height','0px'); 
4494	         	}
4495	         	
4496	         	
4497	         	//vertically center
4498	         	if($(this).hasClass('vertically-align-columns') && window.innerWidth > 1000 && !$(this).hasClass('vc_row-o-equal-height')){
4499	         		
4500	         		//parent columns
4501		         	$(this).find('> .span_12 > .col').each(function(){
4502
4503		         		$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
4504						
4505						$columnInnerHeight = $(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height();
4506						var $marginCalc = ($(this).height()/2)-($columnInnerHeight/2);
4507						if($marginCalc <= 0) $marginCalc = 0;
4508						
4509						$(this).find('> '+$column_inner_selector+' > .wpb_wrapper').css('margin-top',$marginCalc);
4510						$(this).find('> '+$column_inner_selector+' > .wpb_wrapper').css('margin-bottom',$marginCalc);
4511						
4512					});	
4513	
4514					
4515				}
4516			
4517			}
4518			
4519   	  	});
4520
4521		//requal height columns in container type with reveal columns
4522		$('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function(){
4523			if($(this).find('>.span_12>.wpb_column[data-animation*="reveal"]').length >0) {
4524				var tallestColumn = 0;
4525				var $columnInnerHeight = 0;
4526				
4527				$(this).find('> .span_12 > .col').each(function(){
4528					
4529					var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top'));
4530					($(this).find('> .column-inner-wrap > .column-inner').height() + ($padding*2) > tallestColumn) ? tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding*2)  : tallestColumn = tallestColumn;
4531				});	
4532	    	 	
4533	    	 	$(this).find('> .span_12 > .col').each(function(){
4534					
4535	    	 		//columns with content
4536		    	 	if($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0){
4537		    	 		$(this).find('> .column-inner-wrap').css('height',tallestColumn);
4538		    	 	} 
4539		    	 	//empty columns
4540		    	 	else {
4541		    	 		$(this).css('min-height',tallestColumn);
4542		    	 		if($(this).is('[data-animation*="reveal"]')) $(this).find('.column-inner').css('min-height',tallestColumn);
4543		    	 	}
4544	    	 	});
4545
4546			}	
4547		});
4548
4549		//using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug)
4550		$('.wpb_row.vc_row-o-equal-height>.span_12>.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function(){
4551			$(this).css({ 'padding-top': $(this).css('padding-left'), 'padding-bottom': $(this).css('padding-left')});
4552		});
4553		
4554	}
4555	
4556	fullWidthContentColumns();
4557	if($('.owl-carousel').length > 0) owlCarouselInit();
4558
4559
4560var $mouseParallaxScenes = [];
4561function mouseParallaxInit(){
4562	$('.wpb_row:has(.nectar-parallax-scene)').each(function(i){
4563
4564		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').height();
4565
4566		if($(this).hasClass('first-section')) { 
4567			$('body #header-outer[data-transparent-header="true"] .ns-loading-cover').show();
4568
4569			if($('body #header-outer[data-transparent-header="true"]').length > 0) { 
4570				$(this).css('overflow','hidden');
4571				$(this).find('.nectar-slider-loading').css({
4572					'top': $headerNavSpace,
4573					'margin-top' : '-1px'
4574				});
4575				$(this).find('.nectar-slider-loading .loading-icon').css({
4576					'height' :  $('.first-section .nectar-parallax-scene').height() - $headerNavSpace + 'px',
4577					'opacity' : '1'
4578				});
4579			}
4580		}
4581
4582		var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength'));
4583
4584		$mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({
4585			scalarX: $strength,
4586	  		scalarY: $strength
4587		});
4588
4589		//wait until the images in the scene have loaded
4590		var images = $(this).find('.nectar-parallax-scene li');
4591		
4592		$.each(images, function(){
4593			if($(this).find('div').length > 0) {
4594			    var el = $(this).find('div'),
4595			    image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, '');
4596			    if(image && image !== '' && image !== 'none')
4597			        images = images.add($('<img>').attr('src', image));
4598			}
4599		});
4600
4601		var $that = $(this);
4602		images.imagesLoaded(function(){
4603
4604			$that.find('> .nectar-slider-loading, .full-page-inner > .nectar-slider-loading').fadeOut(800,'easeInOutExpo');
4605			if($that.hasClass('first-section')) { 
4606				$('body #header-outer[data-transparent-header="true"] .ns-loading-cover').fadeOut(800,'easeInOutExpo',function(){
4607    				$(this).remove();
4608    			});
4609			}
4610		});
4611
4612	});
4613}
4614mouseParallaxInit();
4615
4616
4617	
4618/***************** Checkmarks ******************/
4619
4620function ulChecks() {
4621	$('ul.checks li').prepend('<i class="icon-ok-sign"></i>');
4622}
4623ulChecks();
4624
4625/***************** Image with Animation / Col Animation *******************/
4626
4627
4628	
4629function colAndImgAnimations(){
4630
4631	$colAndImgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '88%';
4632	$colAndImgOffsetPos2 = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '70%';
4633
4634	$($fullscreenSelector+'img.img-with-animation').each(function() {
4635		
4636		var $that = $(this);
4637		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
4638		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
4639
4640		var waypoint = new Waypoint({
4641 			element: $that,
4642 			 handler: function(direction) {
4643			   
4644					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
4645						 waypoint.destroy();
4646						return;
4647					}
4648
4649					if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
4650				
4651						if($that.attr('data-animation') == 'fade-in-from-left'){
4652							$that.delay($that.attr('data-delay')).transition({
4653								'opacity' : 1,
4654								'x' : '0px'
4655							},$animationDuration, $animationEasing);
4656						} else if($that.attr('data-animation') == 'fade-in-from-right'){
4657							$that.delay($that.attr('data-delay')).transition({
4658								'opacity' : 1,
4659								'x' : '0px'
4660							},$animationDuration, $animationEasing);
4661						} else if($that.attr('data-animation') == 'fade-in-from-bottom'){
4662							$that.delay($that.attr('data-delay')).transition({
4663								'opacity' : 1,
4664								'y' : '0px'
4665							},$animationDuration, $animationEasing);
4666						} else if($that.attr('data-animation') == 'fade-in') {
4667							$that.delay($that.attr('data-delay')).transition({
4668								'opacity' : 1
4669							},$animationDuration, $animationEasing);	
4670						} else if($that.attr('data-animation') == 'grow-in') {
4671							setTimeout(function(){ 
4672								$that.transition({ scale: 1, 'opacity':1 },$animationDuration,$animationEasing);
4673							},$that.attr('data-delay'));
4674						}
4675						else if($that.attr('data-animation') == 'flip-in') {
4676							setTimeout(function(){ 
4677								$that.transition({  rotateY: 0, 'opacity':1 },$animationDuration, $animationEasing);
4678							},$that.attr('data-delay'));
4679						}
4680						else if($that.attr('data-animation') == 'flip-in-vertical') {
4681							setTimeout(function(){ 
4682								$that.transition({  rotateX: 0, 'opacity':1 },$animationDuration, $animationEasing);
4683							},$that.attr('data-delay'));
4684						}
4685
4686						$that.addClass('animated-in');
4687						
4688					}
4689
4690					waypoint.destroy();
4691
4692			  },
4693			  offset: $colAndImgOffsetPos
4694		});
4695
4696		
4697	
4698	});
4699
4700
4701	$($fullscreenSelector+'.nectar_cascading_images').each(function() {
4702		
4703		var $that = $(this);
4704		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
4705		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
4706		var $animationDelay = ($(this).is('[data-animation-timing]')) ? $(this).attr('data-animation-timing') : 175;
4707		$animationDelay = parseInt($animationDelay);
4708
4709		var waypoint = new Waypoint({
4710 			element: $that,
4711 			 handler: function(direction) {
4712			   
4713					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
4714						 waypoint.destroy();
4715						return;
4716					}
4717
4718					if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
4719					
4720						$that.find('.cascading-image').each(function(i){
4721
4722							var $that2 = $(this);
4723
4724							if($that2.attr('data-animation') == 'flip-in' || $that2.attr('data-animation') == 'flip-in-vertical') {
4725								setTimeout(function(){
4726									$that2.find('.inner-wrap').css({
4727										'opacity' : 1,
4728										'transform' : 'rotate(0deg) translateZ(0px)'
4729									});
4730								}, i* $animationDelay);
4731							} else {
4732								setTimeout(function(){
4733									$that2.find('.inner-wrap').css({
4734										'opacity' : 1,
4735										'transform' : 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)'
4736									});
4737								}, i* $animationDelay);
4738							}
4739					
4740
4741						});
4742
4743						$that.addClass('animated-in');
4744						
4745					}
4746
4747					waypoint.destroy();
4748
4749			  },
4750			  offset: $colAndImgOffsetPos
4751		});
4752
4753		
4754	
4755	});
4756	
4757
4758	
4759	$($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) {
4760	    
4761		var $that = $(this);
4762		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
4763		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
4764
4765		//set perspective for vertical flip
4766		if($that.is('[data-animation="flip-in-vertical"]')) {
4767			$that.parents('.col.span_12').addClass('flip-in-vertical-wrap');
4768		}
4769
4770		var waypoint = new Waypoint({
4771 			element: $that,
4772 			 handler: function(direction) {
4773				
4774				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
4775					 waypoint.destroy();
4776					return;
4777				}
4778
4779				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
4780				 	
4781				 	
4782					if($that.attr('data-animation') == 'fade-in-from-left'){
4783						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4784							$that.transition({
4785								'opacity' : 1,
4786								'x' : '0px'
4787							},$animationDuration,$animationEasing);
4788						},$that.attr('data-delay'));
4789					} else if($that.attr('data-animation') == 'fade-in-from-right'){
4790						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4791							$that.transition({
4792								'opacity' : 1,
4793								'x' : '0px'
4794							},$animationDuration,$animationEasing);
4795						},$that.attr('data-delay'));
4796					} else if($that.attr('data-animation') == 'fade-in-from-bottom'){
4797						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4798							$that.transition({
4799								'opacity' : 1,
4800								'y' : '0px'
4801							},$animationDuration,$animationEasing);
4802						},$that.attr('data-delay'));
4803					} else if($that.attr('data-animation') == 'fade-in') {
4804						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4805							$that.transition({
4806								'opacity' : 1
4807							},$animationDuration,$animationEasing);	
4808						},$that.attr('data-delay'));
4809					} else if($that.attr('data-animation') == 'grow-in') {
4810						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4811							$that.transition({ scale: 1, 'opacity':1 },$animationDuration,$animationEasing);
4812						},$that.attr('data-delay'));
4813					} else if($that.attr('data-animation') == 'flip-in') {
4814						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4815							$that.transition({  rotateY: 0, 'opacity':1 },$animationDuration, $animationEasing);
4816						},$that.attr('data-delay'));
4817					} else if($that.attr('data-animation') == 'flip-in-vertical') {
4818						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4819							$that.transition({  rotateX: 0, y: 0, 'opacity':1 },$animationDuration, $animationEasing);
4820						},$that.attr('data-delay'));
4821					}
4822
4823					//boxed column hover fix
4824					if($that.hasClass('boxed')) {
4825						$that.addClass('no-pointer-events');
4826						setTimeout(function(){
4827							$that.removeClass('no-pointer-events');
4828						},parseInt($animationDuration) + parseInt($that.attr('data-delay')) + 30 );
4829					}
4830
4831					$that.addClass('animated-in');
4832				
4833				}
4834
4835				waypoint.destroy();
4836			},
4837			offset: $colAndImgOffsetPos
4838		});
4839	
4840	});
4841
4842	
4843	$($fullscreenSelector+'.wpb_column.has-animation[data-animation*="reveal"]').each(function() {
4844	    
4845		var $that = $(this);
4846		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
4847		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
4848
4849		var waypoint = new Waypoint({
4850 			element: $that,
4851 			 handler: function(direction) {
4852				
4853				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
4854					 waypoint.destroy();
4855					return;
4856				}
4857
4858				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
4859					
4860					if($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') {
4861						setTimeout(function(){ 
4862							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'); });
4863						},$that.attr('data-delay'));
4864					} else if($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') {
4865						setTimeout(function(){ 
4866							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'); });
4867						},$that.attr('data-delay'));
4868					} 
4869
4870					$that.addClass('animated-in');
4871				
4872				}
4873
4874				waypoint.destroy();
4875			},
4876			offset: $colAndImgOffsetPos2
4877		});
4878	
4879	}); 	
4880
4881	
4882}
4883
4884setTimeout(function(){ 
4885	//if($('.nectar-box-roll').length == 0) colAndImgAnimations();
4886},$animationOnScrollTimeOut); 	
4887
4888
4889function cascadingImageBGSizing() {
4890	$('.nectar_cascading_images').each(function(){
4891
4892		//handle max width for cascading images in equal height columns
4893		if($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) 
4894			$(this).css('max-width',$(this).parents('.wpb_column').width());
4895
4896		//set size for layers with no images
4897		$(this).find('.bg-color').each(function(){
4898			var $bgColorHeight = 0;
4899			var $bgColorWidth = 0;
4900			if($(this).parent().find('.img-wrap').length == 0) {
4901				$firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first();
4902
4903				$firstSibling.css({'position':'relative', 'visiblity':'hidden'});
4904				$bgColorHeight = $firstSibling.find('.img-wrap').height();
4905				$bgColorWidth = $firstSibling.find('.img-wrap').width();
4906				if($firstSibling.index() == 0) {
4907					$firstSibling.css({'visiblity':'visible'});
4908				} else {
4909					$firstSibling.css({'position':'absolute', 'visiblity':'visible'});
4910				}
4911			} else {
4912				$bgColorHeight = $(this).parent().find('.img-wrap').height();
4913				$bgColorWidth = $(this).parent().find('.img-wrap').width();
4914			}
4915
4916			$(this).css({'height': $bgColorHeight,'width': $bgColorWidth});
4917		});
4918	});
4919}
4920imagesLoaded($('.nectar_cascading_images'),function(instance){
4921	cascadingImageBGSizing();
4922});
4923
4924function splitLineHeadings() {
4925
4926	$splitLineOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
4927	$($fullscreenSelector+'.nectar-split-heading').each(function() {
4928
4929		var $that = $(this);
4930		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
4931		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
4932
4933		var waypoint = new Waypoint({
4934				element: $that,
4935				 handler: function(direction) {
4936				
4937				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
4938					 waypoint.destroy();
4939					return;
4940				}
4941
4942				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
4943				 	
4944					
4945					$that.find('.heading-line').each(function(i){
4946						//if($that.parents('.first-section').length > 0 && $('body[data-aie="zoom-out"]').length > 0) i = i+4;
4947						$(this).find('> div').delay(i*70).transition({
4948							'y' : '0px'
4949						},$animationDuration,$animationEasing);
4950
4951					});
4952					
4953
4954					$that.addClass('animated-in');
4955				
4956				}
4957
4958				waypoint.destroy();
4959			},
4960			offset: $splitLineOffsetPos
4961		});
4962
4963	});
4964}
4965
4966	
4967/***************** 4 Col Grid in iPad ******************/
4968	
4969	//add one-fourth class
4970	function oneFourthClasses() {
4971		$('.col.span_3, .vc_span3, .vc_col-sm-3').each(function(){
4972			var $currentDiv = $(this);
4973			var $nextDiv = $(this).next('div');
4974			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') ) {
4975				$currentDiv.addClass('one-fourths clear-both');
4976				$nextDiv.addClass('one-fourths right-edge');
4977			}
4978		});
4979		
4980		//make empty second 1/2 half columsn display right on iPad
4981		$('.span_12 .col.span_6').each(function(){
4982			if($(this).next('div').hasClass('span_6') && $.trim( $(this).next('div').html() ).length == 0 ) {
4983				$(this).addClass('empty-second')
4984			}
4985		}); 
4986	}
4987	oneFourthClasses();
4988	
4989/***************** Bar Graph ******************/
4990function progressBars(){
4991	$progressBarsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
4992	$($fullscreenSelector+'.nectar-progress-bar').parent().each(function(i){
4993		
4994		var $that = $(this);
4995		var waypoint = new Waypoint({
4996 			element: $that,
4997 			 handler: function(direction) {
4998			   
4999					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5000						 waypoint.destroy();
5001						return;
5002					}
5003
5004					if($progressBarsOffsetPos == '100%') $that.find('.nectar-progress-bar .bar-wrap').css('opacity','1');
5005
5006					$that.find('.nectar-progress-bar').each(function(i){
5007
5008
5009						var percent = $(this).find('span').attr('data-width');
5010						var $endNum = parseInt($(this).find('span strong i').text());
5011						var $that = $(this);
5012						
5013						$that.find('span').delay(i*90).transition({
5014							'width' : percent + '%'
5015						},1050, 'easeInOutQuint',function(){
5016						});
5017	
5018						setTimeout(function(){
5019
5020							var countOptions = { useEasing : false };
5021							var $countEle = $that.find('span strong i')[0];
5022							var numAnim = new CountUp($countEle, 0, $endNum,0,1,countOptions);
5023							numAnim.start();
5024
5025							$that.find('span strong').transition({
5026								'opacity' : 1
5027							},550, 'easeInCirc');
5028						}, (i*90) );
5029					
5030						////100% progress bar 
5031						if(percent == '100'){
5032							$that.find('span strong').addClass('full');
5033						}
5034					});
5035
5036					$that.addClass('completed');
5037
5038					waypoint.destroy();
5039
5040			  },
5041			  offset: $progressBarsOffsetPos
5042		});
5043
5044	});
5045}
5046
5047
5048/***************** Column Borders ******************/
5049function animatedColBorders(){
5050	$progressBarsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '75%';
5051	$($fullscreenSelector+'.wpb_column[data-border-animation="true"]').each(function(i){
5052
5053		var $that = $(this);
5054		var waypoint = new Waypoint({
5055 			element: $that,
5056 			 handler: function(direction) {
5057			   
5058					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5059						 waypoint.destroy();
5060						return;
5061					}
5062
5063					$borderDelay = ($that.attr('data-border-animation-delay').length > 0) ? parseInt($that.attr('data-border-animation-delay')) : 0;
5064					setTimeout(function(){
5065						$that.find('.border-wrap').addClass('animation');
5066						$that.find('.border-wrap').addClass('completed');
5067					},$borderDelay)
5068					
5069
5070					waypoint.destroy();
5071
5072			  },
5073			  offset: $progressBarsOffsetPos
5074		});
5075
5076	});
5077}
5078
5079/***************** Food Menu Item ******************/
5080function foodMenuItems() {
5081	$foodItemOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '80%';
5082	$($fullscreenSelector+'.nectar_food_menu_item').parent().each(function(i){
5083
5084		var $that = $(this);
5085		var waypoint = new Waypoint({
5086 			element: $that,
5087 			 handler: function(direction) {
5088			   
5089					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5090						 waypoint.destroy();
5091						return;
5092					}
5093
5094					$that.find('.nectar_food_menu_item').each(function(i){
5095
5096						var $that = $(this);
5097
5098						setTimeout(function(){
5099							$that.addClass('animated-in');
5100						},i*150);
5101						
5102					});
5103					
5104					waypoint.destroy();
5105
5106			  },
5107			  offset: $foodItemOffsetPos
5108		});
5109
5110	});
5111}
5112
5113
5114/***************** Dividers ******************/
5115function dividers() {
5116	$dividerOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
5117
5118	$($fullscreenSelector+'.divider-small-border[data-animate="yes"], '+$fullscreenSelector+'.divider-border[data-animate="yes"]').each(function(i){
5119
5120		var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500;
5121		var $that = $(this);
5122		var waypoint = new Waypoint({
5123 			element: $that,
5124 			 handler: function(direction) {
5125			   
5126					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5127						 waypoint.destroy();
5128						return;
5129					}
5130				
5131					$that.each(function(i){
5132
5133						$(this).css({'transform':'scale(0,1)', 'visibility': 'visible'});
5134						var $that = $(this);
5135						
5136						$that.delay($that.attr('data-animation-delay')).transition({
5137							'transform' : 'scale(1, 1)'
5138						},$lineDur, 'cubic-bezier(.18,1,.22,1)');
5139						
5140					});
5141
5142					$that.addClass('completed');
5143
5144					waypoint.destroy();
5145
5146			  },
5147			  offset: $dividerOffsetPos
5148		});
5149
5150	});
5151}
5152
5153//if($('.nectar-box-roll').length == 0) dividers();
5154
5155
5156/***************** Icon List ******************/
5157function iconList() {
5158	$iconListOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '250%' : '75%';
5159
5160	$($fullscreenSelector+'.nectar-icon-list[data-animate="true"]').each(function(i){
5161
5162		var $that = $(this);
5163		var waypoint = new Waypoint({
5164 			element: $that,
5165 			 handler: function(direction) {
5166			   
5167					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5168						 waypoint.destroy();
5169						return;
5170					}
5171				
5172					$that.each(function(i){
5173
5174						$(this).find('.nectar-icon-list-item').each(function(i){
5175							var $thatt = $(this);
5176							setTimeout(function(){ $thatt.addClass('animated') },i*300);
5177						});
5178						
5179					});
5180
5181					$that.addClass('completed');
5182
5183					waypoint.destroy();
5184
5185			  },
5186			  offset: $iconListOffsetPos
5187		});
5188
5189	});
5190}
5191
5192//bg color match 
5193
5194function narrowParentBGC(element) {
5195	
5196	var narrowedBGC;
5197	
5198	if(element.parents('.wpb_column[data-bg-color*="#"]').length > 0 && element.parents('.wpb_column[data-bg-opacity="1"]').length > 0) {
5199		var narrowedBGC = element.parents('.wpb_column').attr('data-bg-color');
5200	}
5201	else if(element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color').length > 0) {
5202		var narrowedBGC = element.parents('.wpb_row').find('.row-bg.using-bg-color').css('background-color');
5203	}
5204	else {
5205		if($('#nectar_fullscreen_rows').length > 0)
5206			var narrowedBGC = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color');
5207		else 
5208			var narrowedBGC = $('.container-wrap').css('background-color');
5209	}
5210	
5211	return narrowedBGC;
5212	
5213}
5214
5215var nectarMatchingBGCss = '';
5216
5217//icon list
5218$('.nectar-icon-list[data-icon-style="border"], .nectar_icon_wrap[data-style="border-animation"][data-color*="extra-color-gradient-"]').each(function(i){
5219	
5220	var $bgColorToSet = narrowParentBGC($(this));
5221	
5222	if($(this).hasClass('nectar-icon-list')) 
5223		$(this).find('.list-icon-holder').css('background-color',$bgColorToSet);
5224	else {
5225		//must be set in css, can't manip pseudo
5226		$(this).addClass('instance-'+i);
5227		nectarMatchingBGCss += '.nectar_icon_wrap.instance-'+i+' .nectar_icon:before { background-color: '+$bgColorToSet+'!important; }';
5228	}
5229		
5230});
5231
5232//material gradient btns
5233$('body.material .nectar-button.see-through[class*="m-extra-color-gradient"]').each(function(i){
5234	
5235	var $bgColorToSet = narrowParentBGC($(this));
5236
5237	$(this).addClass('instance-'+i);
5238	nectarMatchingBGCss += '.nectar-button.see-through.instance-'+i+':after { background-color: '+$bgColorToSet+'!important; }';
5239	
5240});
5241
5242if(nectarMatchingBGCss.length > 0) {
5243	var head = document.head || document.getElementsByTagName('head')[0];
5244	var style = document.createElement('style');
5245
5246	style.type = 'text/css';
5247	if (style.styleSheet){
5248	  style.styleSheet.cssText = nectarMatchingBGCss;
5249	} else {
5250	  style.appendChild(document.createTextNode(nectarMatchingBGCss));
5251	}
5252
5253	head.appendChild(style);
5254}
5255
5256/***************** Hotspot ******************/
5257//add pulse animation
5258$('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function(){
5259	$(this).find('.nectar_hotspot_wrap').each(function(i){
5260		var $that = $(this);
5261		setTimeout(function(){
5262			$that.find('.nectar_hotspot').addClass('pulse');
5263		},i*300);	
5264	});
5265});
5266
5267
5268
5269function hotSpotHoverBind() {
5270
5271	var hotSpotHoverTimeout = [];
5272
5273	$('.nectar_image_with_hotspots:not([data-tooltip-func="click"]) .nectar_hotspot').each(function(i){
5274		
5275		hotSpotHoverTimeout[i] = '';
5276
5277		$(this).on('mouseover', function(){
5278			clearTimeout(hotSpotHoverTimeout[i]);
5279			$(this).parent().css({'z-index':'400', 'height':'auto','width':'auto'});
5280		});
5281
5282		$(this).on('mouseleave', function(){
5283
5284			var $that = $(this);
5285			$that.parent().css({'z-index':'auto'});
5286
5287			hotSpotHoverTimeout[i] = setTimeout(function(){
5288				$that.parent().css({'height':'30px','width':'30px'});
5289			},300);
5290
5291		});
5292
5293	});
5294
5295}
5296
5297hotSpotHoverBind();
5298
5299function responsiveTooltips() {
5300
5301	$('.nectar_image_with_hotspots').each(function(){
5302		$(this).find('.nectar_hotspot_wrap').each(function(i){
5303			
5304			if(  window.innerWidth > 690) {
5305
5306				//remove click if applicable
5307				if($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) {
5308					$(this).find('.nectar_hotspot').removeClass('click');
5309					$(this).find('.nttip').removeClass('open');
5310				}
5311				$(this).find('.nttip .inner a.tipclose').remove();
5312				$('.nttip').css('height','auto');
5313
5314				//reset for positioning
5315				$(this).css({'width': 'auto','height': 'auto'});
5316				$(this).find('.nttip').removeClass('force-right').removeClass('force-left').removeClass('force-top').css('width','auto');
5317
5318				var $tipOffset = $(this).find('.nttip').offset();
5319
5320				//against right side fix
5321				if($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200)
5322					$(this).find('.nttip').css('width','250px');
5323				else 
5324					$(this).find('.nttip').css('width','auto');
5325
5326				//responsive
5327				if($tipOffset.left < 0)
5328					$(this).find('.nttip').addClass('force-right');
5329				else if($tipOffset.left + $(this).find('.nttip').outerWidth(true) >  window.innerWidth )
5330					$(this).find('.nttip').addClass('force-left').css('width','250px');
5331				else if($tipOffset.top + $(this).find('.nttip').height() + 35 > $(window).height() && $('#nectar_fullscreen_rows').length > 0)
5332					$(this).find('.nttip').addClass('force-top');
5333
5334				if($(this).find('> .open').length == 0)
5335					$(this).css({'width': '30px','height': '30px'});
5336
5337			} else {
5338				//fixed position
5339				$(this).find('.nttip').removeClass('force-left').removeClass('force-right').removeClass('force-top');
5340				$(this).find('.nectar_hotspot').addClass('click');
5341			
5342				if($(this).find('.nttip a.tipclose').length == 0)
5343					$(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span></span></a>');
5344
5345				//change height of fixed
5346				$('.nttip').css('height',$(window).height());
5347			}
5348		});
5349	});
5350
5351
5352}
5353responsiveTooltips();
5354
5355function imageWithHotspotClickEvents() {
5356	//click
5357	$('body').on('click','.nectar_hotspot.click',function(){
5358		$(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
5359		$(this).parent().find('.nttip').addClass('open');
5360
5361		$(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open');
5362		$(this).parent().find('.nectar_hotspot').addClass('open');
5363
5364		if( window.innerWidth > 690) {
5365			$(this).parent().css({'z-index':'120', 'height':'auto','width':'auto'});
5366
5367			var $that = $(this);
5368
5369			setTimeout(function(){
5370				$that.parents('.nectar_image_with_hotspots').find('.nectar_hotspot_wrap').each(function(){
5371					if($(this).find('> .open').length == 0)
5372						$(this).css({'height':'30px','width':'30px', 'z-index':'auto'});
5373				});
5374			},300);
5375		}
5376
5377		if(  window.innerWidth <= 690) $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index','200');
5378
5379		return false;
5380	});
5381
5382	$('body').on('click','.nectar_hotspot.open',function(){
5383		$(this).parent().find('.nttip').removeClass('open');
5384		$(this).parent().find('.nectar_hotspot').removeClass('open');
5385
5386		$(this).parents('.wpb_row').css('z-index','auto');
5387
5388		return false;
5389	});
5390
5391	$('body').on('click','.nttip.open',function(){
5392		if(  window.innerWidth < 690) {
5393			$(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
5394			$(this).parents('.wpb_row').css('z-index','auto');
5395			return false;
5396		}
5397	});
5398}
5399imageWithHotspotClickEvents();
5400
5401function imageWithHotspots() {
5402
5403	$imageWithHotspotsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '50%';
5404
5405	$($fullscreenSelector+'.nectar_image_with_hotspots[data-animation="true"]').each(function(i){
5406
5407		var $that = $(this);
5408		var waypoint = new Waypoint({
5409 			element: $that,
5410 			 handler: function(direction) {
5411			   
5412					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5413						 waypoint.destroy();
5414						return;
5415					}
5416
5417					$that.addClass('completed');
5418					$that.find('.nectar_hotspot_wrap').each(function(i){
5419						var $that2 = $(this);
5420						var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0;
5421						setTimeout(function(){
5422							$that2.addClass('animated-in');
5423						},175*(i+$extrai));
5424					});
5425
5426					waypoint.destroy();
5427
5428			  },
5429			  offset: $imageWithHotspotsOffsetPos
5430		});
5431
5432	});
5433}
5434
5435
5436/***************** Animated Title ******************/
5437function animated_titles() {
5438	$animatedTitlesOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
5439
5440	$($fullscreenSelector+'.nectar-animated-title').each(function(i){
5441
5442		var $that = $(this);
5443		var waypoint = new Waypoint({
5444 			element: $that,
5445 			 handler: function(direction) {
5446			   
5447					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5448						 waypoint.destroy();
5449						return;
5450					}
5451
5452					$that.addClass('completed');
5453
5454					waypoint.destroy();
5455
5456			  },
5457			  offset: $animatedTitlesOffsetPos
5458		});
5459
5460	});
5461}
5462
5463//if($('.nectar-box-roll').length == 0) animated_titles();
5464
5465
5466/***************** Pricing Tables ******************/
5467
5468
5469var $tallestCol;
5470
5471function pricingTableHeight(){
5472	$('.pricing-table[data-style="default"]').each(function(){
5473		$tallestCol = 0;
5474		
5475		$(this).find('> div ul').each(function(){
5476			($(this).height() > $tallestCol) ? $tallestCol = $(this).height() : $tallestCol = $tallestCol;
5477		});	
5478		
5479		//safety net incase pricing tables height couldn't be determined
5480		if($tallestCol == 0) $tallestCol = 'auto';
5481		
5482		//set even height
5483		$(this).find('> div ul').css('height',$tallestCol);
5484
5485	});
5486}
5487
5488pricingTableHeight();
5489
5490 
5491/***************** Testimonial Slider ******************/
5492
5493//testimonial slider controls
5494
5495//non minimal
5496$('body').on('click','.testimonial_slider:not([data-style*="multiple_visible"]):not([data-style="minimal"]) .controls li', function(){
5497	
5498	if($(this).find('span').hasClass('active')) return false;
5499	
5500	var $index = $(this).index();
5501	var currentHeight = $(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).height();
5502	
5503	$(this).parents('.testimonial_slider').find('li span').removeClass('active');
5504	$(this).find('span').addClass('active');
5505	
5506	$(this).parents('.testimonial_slider').find('.slides blockquote').addClass('no-trans');
5507	$(this).parents('.testimonial_slider').find('.slides blockquote').css({'opacity':'0', 'transform': 'translateX(-25px)', 'z-index': '1'});
5508	$(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).removeClass('no-trans').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
5509	$(this).parents('.testimonial_slider:not(.disable-height-animation)').find('.slides').stop(true,true).animate({'height' : currentHeight + 40 + 'px' },450,'easeOutCubic');
5510	
5511	resizeVideoToCover();
5512});
5513
5514//minimal
5515$('body').on('click','.testimonial_slider[data-style="minimal"] .testimonial-next-prev a', function(){
5516	
5517	var $index = $(this).parents('.testimonial_slider').find('.slides blockquote.active').index();
5518	var $actualIndex = $index;
5519
5520	$(this).parents('.testimonial_slider').find('.slides blockquote').addClass('no-trans');
5521	$(this).parents('.testimonial_slider').find('.slides blockquote').css({'opacity':'0', 'transform': 'translateX(-25px)', 'z-index': '1'});
5522
5523
5524	$(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).removeClass('active');
5525
5526	if($(this).hasClass('next')) {
5527		if($index+1 >= $(this).parents('.testimonial_slider').find('.slides blockquote').length) { 
5528			$actualIndex = 0; 
5529		} else {
5530			$actualIndex = $index+1; 
5531		}
5532		var currentHeight = $(this).parents('.testimonial_slider').find('.slides blockquote').eq($actualIndex).height();
5533		//show slide
5534		$(this).parents('.testimonial_slider').find('.slides blockquote').eq($actualIndex).addClass('active').removeClass('no-trans').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
5535		//change pag #
5536		$(this).parents('.testimonial_slider').find('.control-wrap ul').css({'transform':'translateX(-'+(20*$actualIndex)+'px)'});
5537	} else {
5538		if($index-1 == -1) { 
5539			$actualIndex = $(this).parents('.testimonial_slider').find('.slides blockquote').length-1; 
5540		} else {
5541			$actualIndex = $index-1; 
5542		}
5543		var currentHeight = $(this).parents('.testimonial_slider').find('.slides blockquote').eq($index-1).height();
5544		//show slide
5545		$(this).parents('.testimonial_slider').find('.slides blockquote').eq($index-1).addClass('active').removeClass('no-trans').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
5546		//change pag #
5547		$(this).parents('.testimonial_slider').find('.control-wrap ul').css({'transform':'translateX(-'+(20*$actualIndex)+'px)'});
5548	}
5549	
5550	
5551	$(this).parents('.testimonial_slider:not(.disable-height-animation)').find('.slides').stop(true,true).animate({'height' : currentHeight + 40 + 'px' },450,'easeOutCubic');
5552	
5553	resizeVideoToCover();
5554
5555	return false;
5556});
5557
5558
5559var $tallestQuote;
5560
5561//create controls
5562function createTestimonialControls() {
5563
5564	//fadeIn
5565	$('.testimonial_slider:not([data-style*="multiple_visible"])').animate({'opacity':'1'},800);
5566
5567	$('.testimonial_slider:not([data-style*="multiple_visible"])').each(function(i){
5568		
5569		if($(this).find('blockquote').length > 1 && $(this).find('.controls').length == 0) {
5570			$(this).append('<div class="controls"><ul></ul></div>');
5571			
5572			var slideNum = $(this).find('blockquote').length;
5573			var $that = $(this);
5574			
5575			for(var i=0;i<slideNum;i++) {
5576
5577				if( !$(this).is('[data-style="minimal"]') ) {
5578					$that.find('.controls ul').append('<li><span class="pagination-switch"></span></li>');
5579				} else {
5580					$that.find('.controls ul').append('<li>'+(i+1)+'</li>');
5581				}
5582			}
5583			
5584			//minimal
5585			if( $(this).is('[data-style="minimal"]') ) {
5586
5587				//add next/prev
5588				$(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>');
5589
5590				//start on first
5591				$(this).find('.slides blockquote:first-child').addClass('active').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
5592				if(	!$(this).hasClass('disable-height-animation') ) {
5593					$(this).find('.slides').css({'height' : $(this).find('.slides blockquote:first-child').height() + 40 + 'px' });
5594				}
5595
5596				//autorotate
5597				if($(this).attr('data-autorotate').length > 0) {
5598					slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
5599					var $that = $(this);
5600					var $rotate = setInterval(function(){ testimonialRotate($that) },slide_interval);
5601				}
5602				$(this).find('.testimonial-next-prev a').click(function(e){
5603					if(typeof e.clientX != 'undefined') clearInterval($rotate);
5604				});
5605
5606				//wrap bullets
5607				$(this).find('.controls ul').wrap('<div class="control-wrap" />');
5608				$(this).find('.controls ul').css('width', (($(this).find('.controls ul li').length * 20) +1) + 'px');
5609				$(this).find('.controls').append('<span class="out-of">/</span><span class="total">'+$(this).find('blockquote').length+'</span>');
5610
5611				////swipe for testimonials
5612				$(this).swipe({
5613				
5614					swipeLeft : function(e) {
5615						$(this).find('.testimonial-next-prev .next').trigger('click');
5616						e.stopImmediatePropagation();
5617						clearInterval($rotate);
5618						return false;
5619					 },
5620					 swipeRight : function(e) {
5621						$(this).find('.testimonial-next-prev .prev').trigger('click');
5622						e.stopImmediatePropagation();
5623						clearInterval($rotate);
5624						return false;
5625					 }    
5626				});
5627
5628
5629			}
5630
5631			//non minimal
5632			if( !$(this).is('[data-style="minimal"]') ) {
5633
5634				//activate first slide
5635				$(this).find('.controls ul li').first().click();
5636
5637				//autorotate
5638				if($(this).attr('data-autorotate').length > 0) {
5639					slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
5640					var $that = $(this);
5641					var $rotate = setInterval(function(){ testimonialRotate($that) },slide_interval);
5642				}
5643				
5644				$(this).find('.controls li').click(function(e){
5645					if(typeof e.clientX != 'undefined') clearInterval($rotate);
5646				});
5647				
5648				////swipe for testimonials
5649				$(this).swipe({
5650				
5651					swipeLeft : function(e) {
5652						$(this).find('.controls ul li span.active').parent().next('li').find('span').trigger('click');
5653						e.stopImmediatePropagation();
5654						clearInterval($rotate);
5655						return false;
5656					 },
5657					 swipeRight : function(e) {
5658						$(this).find('.controls ul li span.active').parent().prev('li').find('span').trigger('click');
5659						e.stopImmediatePropagation();
5660						clearInterval($rotate);
5661						return false;
5662					 }    
5663				});
5664
5665		}
5666		} 
5667		//only one testimonial
5668		else if($(this).find('.controls').length == 0) {
5669			var currentHeight = $(this).find('.slides blockquote').height();
5670			$(this).find('.slides blockquote').css({'opacity':'0', 'transform': 'translateX(-25px)', 'z-index': '1'});
5671			$(this).find('.slides blockquote').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
5672			$(this).find('.slides').stop(true,true).animate({'height' : currentHeight + 20 + 'px' },450,'easeOutCubic');
5673		}
5674	});
5675
5676
5677
5678		
5679	$('.testimonial_slider[data-style*="multiple_visible"] .slides').each(function(){
5680	    	var $that = $(this); 
5681	    	var $element = $that;
5682	    	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')) : 4000;
5683			if($that.find('img').length == 0) $element = $('body');
5684
5685			//move img pos
5686			if( $(this).parents('.testimonial_slider').attr('data-style') != 'multiple_visible_minimal') {
5687				$(this).find('blockquote').each(function(){
5688					$(this).find('.image-icon').insertAfter($(this).find('p'));
5689				});
5690			} else {
5691				//has alf class
5692				if($(this).find('blockquote').length > 4) {
5693					$(this).parents('.testimonial_slider').addClass('has-alf');
5694				}
5695			}
5696			
5697			var $testimonialGroupCells = ($(this).parents('.testimonial_slider').attr('data-style') == 'multiple_visible_minimal') ? true : false;
5698
5699			imagesLoaded($element,function(instance){
5700
5701		    	$that.flickity({
5702		    		  contain: true,
5703					  draggable: true,
5704					  groupCells: $testimonialGroupCells,
5705					  lazyLoad: false,
5706					  imagesLoaded: true,
5707					  percentPosition: true,
5708					  prevNextButtons: false,
5709					  pageDots: true,
5710					  resize: true,
5711					  setGallerySize: true,
5712					  wrapAround: true,
5713					  autoPlay: $autoplay,
5714					  accessibility: false
5715		    	});
5716
5717			    $that.parents('.testimonial_slider').css('opacity','1');
5718			    
5719
5720		     });//images loaded
5721		     	     
5722	    });//each	
5723
5724
5725}
5726createTestimonialControls();
5727
5728function testimonialRotate(slider){
5729	
5730	var $testimonialLength = slider.find('li').length;
5731	var $currentTestimonial = slider.find('.pagination-switch.active').parent().index();
5732	
5733	//stop the rotation when toggles are closed
5734	if( slider.parents('.toggle').length > 0 && slider.parents('.toggle').hasClass('open') ) {
5735
5736		if( !slider.is('[data-style="minimal"]') ) {
5737			if( $currentTestimonial+1 == $testimonialLength) {
5738				slider.find('ul li:first-child').click();
5739			} else {
5740				slider.find('.pagination-switch.active').parent().next('li').click();
5741			}
5742		} else {
5743			slider.find('.testimonial-next-prev .next').click();
5744		}
5745			
5746	} else {
5747		
5748		if( !slider.is('[data-style="minimal"]') ) {
5749			if( $currentTestimonial+1 == $testimonialLength) {
5750				slider.find('ul li:first-child').click();
5751			} else {
5752				slider.find('.pagination-switch.active').parent().next('li').click();
5753			}
5754		} else {
5755			slider.find('.testimonial-next-prev .next').click();
5756		}
5757	
5758	}
5759
5760}
5761
5762function testimonialHeightResize(){
5763	$('.testimonial_slider:not(.disable-height-animation):not([data-style*="multiple_visible"])').each(function(){
5764		
5765		var $index = $(this).find('.controls ul li span.active').parent().index();
5766		var currentHeight = $(this).find('.slides blockquote').eq($index).height();
5767		$(this).find('.slides').stop(true,true).css({'height' : currentHeight + 40 + 'px' });
5768		
5769	});
5770}
5771
5772
5773function testimonialSliderHeight() {
5774		
5775	$('.testimonial_slider.disable-height-animation:not([data-style*="multiple_visible"])').each(function(){
5776		$tallestQuote = 0;
5777			
5778		$(this).find('blockquote').each(function(){
5779			($(this).height() > $tallestQuote) ? $tallestQuote = $(this).height() : $tallestQuote = $tallestQuote;
5780		});	
5781		
5782		//safety net incase height couldn't be determined
5783		if($tallestQuote == 0) $tallestQuote = 100;
5784		
5785		//set even height
5786		$(this).find('.slides').css('height',$tallestQuote+40+'px');
5787		
5788		//show the slider once height is set
5789		$(this).animate({'opacity':'1'});
5790
5791		fullWidthContentColumns();
5792
5793	});
5794
5795
5796}
5797
5798function testimonialSliderHeightMinimalMult() {
5799		
5800	$('.testimonial_slider[data-style="multiple_visible_minimal"]').each(function(){
5801		$tallestQuote = 0;
5802		
5803		$(this).find('blockquote > .inner p').css('height','auto');
5804		
5805		$(this).find('blockquote > .inner p').each(function(){
5806			($(this).height() > $tallestQuote) ? $tallestQuote = $(this).height() : $tallestQuote = $tallestQuote;
5807		});	
5808		
5809		//safety net incase height couldn't be determined
5810		if($tallestQuote == 0) $tallestQuote = 200;
5811		
5812		//set even height
5813		$(this).find('blockquote > .inner p').css('height',$tallestQuote+'px');
5814		
5815	});
5816
5817}
5818
5819if($('.testimonial_slider.disable-height-animation:not([data-style*="multiple_visible"])').length > 0) {
5820	testimonialSliderHeight(); 
5821	setTimeout(testimonialSliderHeight,500);
5822}
5823
5824if($('.testimonial_slider[data-style="multiple_visible_minimal"]').length > 0) {
5825	testimonialSliderHeightMinimalMult();
5826	setTimeout(testimonialSliderHeightMinimalMult,500);
5827}
5828
5829
5830/***************** WP Media Embed / External Embed ******************/
5831
5832//this isn't the for the video shortcode* This is to help any external iframe embed fit & resize correctly 
5833function responsiveVideoIframesInit(){
5834	$('iframe').each(function(){
5835		
5836		//make sure the iframe has a src (things like adsense don't)
5837		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){
5838			
5839			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) {
5840				
5841				$(this).addClass('iframe-embed');	
5842				
5843				$(this).attr('data-aspectRatio', this.height / this.width).removeAttr('height').removeAttr('width');
5844	
5845				//add wmode=transparent to all youytube embeds to fix z-index issues in IE
5846				/*if($(this).attr('src').indexOf('wmode=transparent') == -1) {
5847					if($(this).attr('src').indexOf('?') == -1){
5848						$(this).attr('src',$(this).attr('src') + '?wmode=transparent');
5849					} else {
5850						$(this).attr('src',$(this).attr('src') + '&wmode=transparent');
5851					}
5852				} */
5853			}
5854			 
5855		} else {
5856			//if($(this).parents('ins').length == 0){ 
5857			//	$(this).wrap('<div class="iframe-embed-standard"/>');	
5858			//}
5859		}
5860		
5861	});
5862
5863
5864}
5865
5866function responsiveVideoIframes(){
5867	 $('iframe[data-aspectRatio]').each(function() {
5868	 	var newWidth = $(this).parent().width();
5869	 	 
5870		var $el = $(this);
5871		
5872		//in nectar slider
5873		if($(this).parents('.swiper-slide').length > 0) {
5874			if($(this).is(':visible')) $el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
5875		} 
5876		//all others
5877		else {
5878			$el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
5879		}
5880		
5881		
5882	});
5883}
5884
5885
5886function videoshortcodeSize(){
5887	$('.wp-video').each(function(){
5888
5889
5890		//if($(this).find('.mejs-poster-img').length > 0){
5891		//	$(this).attr('data-aspectRatio', parseInt($(this).find('.mejs-poster-img').height()) / parseInt($(this).find('.wp-video-shortcode').css('width')));
5892		//} else {
5893		//	$(this).attr('data-aspectRatio', parseInt($(this).find('.mejs-overlay').height()) / parseInt($(this).find('.wp-video-shortcode').css('width')));
5894
5895		//}
5896
5897		//var newWidth = $(this).width();
5898	 	 
5899		//var $el = $(this).find('.wp-video-shortcode');
5900		//$(this).width(newWidth).height(newWidth * $(this).attr('data-aspectRatio'));
5901		//$(this).find('.mejs-container').css('height','100%');
5902	});
5903}
5904
5905responsiveVideoIframesInit();
5906responsiveVideoIframes();
5907
5908
5909//unwrap post and protfolio videos
5910$('.video-wrap iframe').unwrap();
5911$('#sidebar iframe[src]').unwrap();
5912
5913//$('video:not(.slider-video)').attr('width','100%');
5914//$('video:not(.slider-video)').attr('height','100%'); 
5915
5916$('audio').attr('width','100%');
5917$('audio').attr('height','100%');
5918
5919$('audio').css('visibility','visible');
5920
5921if($('body').hasClass('mobile')){
5922	$('video').css('visibility','hidden');
5923} else {
5924	$('video').css('visibility','visible');
5925}
5926
5927
5928$(window).load(function(){
5929	$('video').css('visibility','visible');
5930	showLateIframes();
5931	videoshortcodeSize();
5932});
5933
5934$('.wp-video').each(function(){
5935	 video = $(this).find('video').get(0);
5936	 video.addEventListener('loadeddata', function() {
5937	   videoshortcodeSize();
5938	   $(window).trigger('resize');
5939	 }, false);
5940});
5941
5942//webkit video back button fix 
5943$('.main-content iframe[src]').each(function(){
5944	//$(this).attr('src',$(this).attr('src'));
5945	$(this).css({'opacity':'1', 'visibility':'visible'});
5946});
5947
5948showLateIframes();
5949
5950function showLateIframes(){
5951	$('iframe[src]').css('opacity','1');
5952	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 100);
5953	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 500);
5954	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 1000);
5955	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 1500);
5956	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 2500);
5957}
5958
5959
5960/***************** Nectar Video BG ******************/
5961
5962	$('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function(i){
5963		$(this).css('z-index',100 + i);
5964	});
5965
5966	var min_w = 1200; // minimum video width allowed
5967	var vid_w_orig;  // original video dimensions
5968	var vid_h_orig;
5969	
5970    vid_w_orig = 1280;
5971    vid_h_orig = 720;
5972 
5973	function resizeVideoToCover() {
5974		$('.nectar-video-wrap').each(function(i){
5975			if($(this).find('video').length == 0 ) return;
5976
5977			if($(this).parents('#page-header-bg').length > 0) {
5978				if($('.container-wrap.auto-height').length > 0) return false;
5979				var $containerHeight = $(this).parents('#page-header-bg').outerHeight();			
5980				var $containerWidth = $(this).parents('#page-header-bg').outerWidth();
5981			} else {
5982				var $containerHeight = $(this).parents('.wpb_row').outerHeight();			
5983				var $containerWidth = $(this).parents('.wpb_row').outerWidth();
5984			}
5985			
5986		    // set the video viewport to the window size
5987		    $(this).width($containerWidth);
5988		    $(this).height($containerHeight);
5989		
5990		    // use largest scale factor of horizontal/vertical
5991		    var scale_h = $containerWidth / vid_w_orig;
5992		    var scale_v = ($containerHeight - $containerHeight) / vid_h_orig; 
5993		    var scale = scale_h > scale_v ? scale_h : scale_v;
5994			
5995			//update minium width to never allow excess space
5996		    min_w = 1280/720 * ($containerHeight+40);
5997		    
5998		    // don't allow scaled width < minimum video width
5999		    if (scale * vid_w_orig < min_w) {scale = min_w / vid_w_orig;}
6000		        
6001		    // now scale the video
6002		    $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig +0));
6003		    $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig +0));
6004		    
6005		    // and center it by scrolling the video viewport
6006		    $(this).scrollLeft(($(this).find('video').width() - $containerWidth) / 2);
6007		    $(this).scrollTop(($(this).find('video').height() - ($containerHeight)) / 2);
6008		    $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($containerHeight)) / 2);
6009
6010
6011		    //align bottom
6012		    if($(this).attr('data-bg-alignment') == 'center bottom' || $(this).attr('data-bg-alignment') == 'bottom'){
6013		    	$(this).scrollTop(($(this).find('video').height() - ($containerHeight+6)));
6014		    }
6015		    //align top
6016		    else if($(this).attr('data-bg-alignment') == 'center top' || $(this).attr('data-bg-alignment') == 'top') {
6017		    	$(this).scrollTop(0);
6018		    } 
6019
6020		});
6021	}
6022    
6023    //init
6024    function videoBGInit(){
6025	    setTimeout(function(){
6026	    	resizeVideoToCover();
6027	    	$('.video-color-overlay').each(function(){
6028	    		$(this).css('background-color',$(this).attr('data-color'));
6029	    	});
6030	    	$('.nectar-video-wrap').each(function(i){
6031
6032	    		if($(this).find('video').length == 0) return;
6033
6034	    		var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false;
6035	    		var $that = $(this);
6036
6037	    		 var videoReady = setInterval(function(){
6038
6039        			if($that.find('video').get(0).readyState > 3) {
6040
6041        				$that.transition({'opacity':'1'},400);
6042		    			$that.find('video').transition({'opacity':'1'},400);
6043		    			$that.parent().find('.video-color-overlay').transition({'opacity':'0.7'},400);
6044
6045		    			if($headerVideo == true) {
6046			    			pageHeaderTextEffect();
6047						}
6048
6049						//remove page loading screen
6050						$('#ajax-loading-screen').addClass('loaded');
6051						setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
6052				
6053
6054						clearInterval(videoReady);
6055					}
6056	    		},60);
6057	    		
6058	    	});
6059	    },300);
6060
6061		if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)){
6062			$('.wpb_row .mobile-video-image, #page-header-wrap .mobile-video-image, .fullscreen-header .mobile-video-image').show();
6063			$('.nectar-video-wrap').remove();
6064		}
6065
6066		
6067		 if(navigator.userAgent.indexOf('Chrome') > 0 && !/Edge\/12./i.test(navigator.userAgent) && !/Edge\/\d./i.test(navigator.userAgent)) { 
6068		 	
6069		 	$('.nectar-video-wrap').each(function(i){
6070		 		if(jQuery(this).find('video source[type="video/webm"]').length > 0 ) {
6071				  	var webmSource = jQuery(this).find('video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
6072		          	var firstVideo = jQuery(this).find('video').get(0);
6073		          	firstVideo.src = webmSource;
6074		          	firstVideo.load();
6075		         }
6076            });
6077	    }
6078
6079
6080
6081
6082	    jQuery(".vc_row").each(function() {
6083	        var youtubeUrl, youtubeId, $row = jQuery(this);
6084	        $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(), nectarInsertYoutubeVideoAsBackground($row.find('.nectar-youtube-bg'), youtubeId))) : $row.find(".nectar-youtube-bg").remove()
6085
6086	        //remove yt url
6087	        $row.find('.nectar-youtube-bg span').remove();
6088	        $row.find('.nectar-video-wrap, .nectar-youtube-bg').css({'opacity':'1','width':'100%', 'height':'100%'});
6089	         $row.find('.video-color-overlay').transition({'opacity':'0.7'},400);
6090	    });
6091		
6092
6093		function nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter) {
6094		    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() {
6095		        nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter++)
6096		    }, 100);
6097		    var $container = $element.prepend('<div class="vc_video-bg"><div class="inner"></div></div>').find(".inner");
6098		    new YT.Player($container[0], {
6099		        width: "100%",
6100		        height: "100%",
6101		        videoId: youtubeId,
6102		        playerVars: {
6103		            playlist: youtubeId,
6104		            iv_load_policy: 3,
6105		            enablejsapi: 1,
6106		            disablekb: 1,
6107		            autoplay: 1,
6108		            controls: 0,
6109		            showinfo: 0,
6110		            rel: 0,
6111		            loop: 1
6112		        },
6113		        events: {
6114		            onReady: function(event) {
6115		                event.target.mute().setLoop(!0);
6116										nectarResizeVideoBackground($element);
6117		            }
6118		        }
6119		    }), nectarResizeVideoBackground($element), jQuery(window).bind("resize", function() {
6120		        nectarResizeVideoBackground($element);
6121		    });
6122				
6123				setTimeout(function(){
6124					 nectarResizeVideoBackground($element);
6125				},100);
6126		}
6127
6128		function nectarResizeVideoBackground($element) {
6129		    var iframeW, iframeH, marginLeft, marginTop, containerW = $element.innerWidth(),
6130		        containerH = $element.innerHeight(),
6131		        ratio1 = 16,
6132		        ratio2 = 9;
6133		    ratio1 / ratio2 > containerW / containerH ? (iframeW = containerH * (ratio1 / ratio2), 
6134		    	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", 
6135		    	marginLeft = -Math.round((iframeW - containerW) / 2) + "px", iframeW += "px", iframeH += "px"), 
6136		    	$element.find(".vc_video-bg iframe").css({
6137			        maxWidth: "1000%",
6138			        marginLeft: marginLeft,
6139			        marginTop: marginTop,
6140			        width: iframeW,
6141			        height: iframeH
6142			    })
6143		}
6144
6145		function nectarExtractYoutubeId(url) {
6146		    if ("undefined" == typeof url) return !1;
6147		    var id = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/);
6148		    return null !== id ? id[1] : !1
6149		}
6150
6151
6152	}
6153
6154	if($('.nectar-video-wrap').length > 0 || $('.nectar-youtube-bg').length > 0) {
6155		videoBGInit();
6156	}
6157
6158
6159/*-------------------------------------------------------------------------*/
6160/*	4.	Header + Search
6161/*-------------------------------------------------------------------------*/	 
6162
6163////mobile megamenus without titles / nested groupings
6164$mobileNavSelector = ($('.off-canvas-menu-container.mobile-only').length > 0) ? '.off-canvas-menu-container.mobile-only ': '#mobile-menu .container ';
6165$($mobileNavSelector+'.megamenu > ul > li > a').each(function(){
6166	if( $(this).text() == '–' ) {
6167		$navLIs = $(this).parent().find('> ul > li').clone();
6168		$(this).parent().find('ul').remove();
6169		$(this).parent().parent().append($navLIs);
6170		$(this).parent().remove();
6171	}
6172});
6173
6174/***************** Slide Out Widget Area **********/
6175
6176var $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;
6177var $bodyBorderWidth = ($('.body-border-right').length > 0) ? $('.body-border-right').width() : 0;
6178var $resetHeader;
6179
6180
6181function mobileBreakPointCheck() {
6182	var $mobileBreakpoint = ( $('body[data-header-breakpoint]').length > 0 && $('body').attr('data-header-breakpoint') != '1000' ) ? parseInt($('body').attr('data-header-breakpoint')) : 1000;
6183	var $withinCustomBreakpoint = false;
6184
6185	if($mobileBreakpoint != 1000) {
6186		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 ) {
6187			$withinCustomBreakpoint = true;
6188		}
6189	}
6190
6191	return $withinCustomBreakpoint;
6192}
6193
6194//icon effect html creation
6195if($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) {
6196
6197	if($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) {
6198		$('<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');
6199		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');
6200	}
6201
6202
6203	function calculateHoverNavMinHeight() {
6204		$widgetHeights = 0;
6205		$('#slide-out-widget-area > .widget').each(function(){
6206			$widgetHeights += $(this).height();
6207		});
6208		$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();
6209
6210		$('#slide-out-widget-area .inner').css({'height':'auto', 'min-height': $menuHeight  });
6211
6212		$('#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);
6213	
6214	}
6215
6216	function openRightHoverNav() {
6217
6218		
6219
6220			calculateHoverNavMinHeight();
6221
6222			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && $('#slide-out-widget-area.open').length > 0) {
6223				mobileCloseNavCheck();
6224				return;
6225			}
6226			
6227
6228			$('#slide-out-widget-area').css({ 'transform': 'translate3d(0,0,0)' }).addClass('open');
6229
6230			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;
6231
6232			//icon effect
6233			////set pos 
6234			if($('header#top .container .span_9 > .slide-out-widget-area-toggle').length > 0) {
6235
6236				var adminBarHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
6237				
6238				var secondaryBarHeight = ($('#header-secondary-outer').length > 0) ? $('#header-secondary-outer').height() : 0; 
6239				
6240
6241				if($('body.mobile').length > 0) {
6242
6243					$('.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 });
6244				} else {
6245
6246					if($bodyBorderHeaderColorMatch) {
6247
6248						var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1;
6249						$('.slide-out-hover-icon-effect').css({
6250							'top': adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')), 
6251							'right': 29 + $extraCushion });
6252
6253					} else {
6254
6255						var $withinCustomBreakpoint = mobileBreakPointCheck();
6256
6257						if($('body.ascend').length > 0 && $withinCustomBreakpoint != true) {
6258							var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1;
6259							$('.slide-out-hover-icon-effect').css({'top': 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 });
6260						} else {
6261
6262							if($('body.material').length > 0) {
6263								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();
6264								if($('#header-secondary-outer.hide-up').length > 0) { secondaryBarHeight = 0; }
6265								$('.slide-out-hover-icon-effect').css({'top': adminBarHeight + secondaryBarHeight + parseInt($nectarHamMenuPos.top) , 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2  });
6266							} else {
6267								$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');
6268								$('.slide-out-hover-icon-effect').css({'top': 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')) });
6269							}
6270						}
6271					}
6272					
6273				}
6274			}
6275
6276			////open
6277
6278			$('.slide-out-hover-icon-effect .lines-button').removeClass('no-delay').addClass('unhidden-line');
6279			
6280
6281			if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#nectar_fullscreen_rows').length == 0) {
6282
6283				if(!($(window).scrollTop() == 0 && $('#header-outer.transparent').length > 0)) {
6284
6285					if($('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6286
6287						$('#header-outer').attr('data-transparent','true').addClass('no-bg-color').addClass('slide-out-hover');
6288						$('#header-outer header, #header-outer > .cart-outer').addClass('all-hidden');
6289					}
6290
6291				}
6292
6293				if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6294					var headerResize = $('#header-outer').attr('data-header-resize');
6295					if(headerResize == 1) {
6296
6297						$(window).off('scroll',bigNav);
6298						$(window).off('scroll',smallNav);
6299
6300
6301					} else {
6302						
6303						$(window).off('scroll',opaqueCheck);
6304						$(window).off('scroll',transparentCheck);
6305					}
6306				}
6307
6308			}
6309
6310			if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
6311				$(window).on('mousemove.rightOffsetCheck',closeNavCheck);
6312			}
6313
6314	}
6315
6316	function closeNavCheck(e) {
6317		var $windowWidth = $(window).width();
6318		if(e.clientX < $windowWidth - 340 - $bodyBorderWidth) {
6319
6320				$(window).off('mousemove.rightOffsetCheck',closeNavCheck);
6321
6322				$('#slide-out-widget-area').css({ 'transform': 'translate3d(341px,0,0)' }).removeClass('open');
6323
6324				$('#header-outer').removeClass('style-slide-out-from-right');
6325
6326				$('.slide-out-hover-icon-effect .lines-button').removeClass('unhidden-line').addClass('no-delay');
6327
6328				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;
6329
6330				if($('#header-outer[data-permanent-transparent="1"]').length == 0) {
6331
6332					if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6333
6334						if($('body.mobile').length == 0) {
6335							$('#header-outer').removeClass('no-bg-color');
6336							$('#header-outer header, #header-outer > .cart-outer').removeClass('all-hidden');
6337						}
6338					}
6339
6340					if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6341						var headerResize = $('#header-outer').attr('data-header-resize');
6342						if(headerResize == 1) {
6343						
6344							$(window).off('scroll.headerResizeEffect');
6345							if($(window).scrollTop() == 0) {
6346								$(window).on('scroll.headerResizeEffect',smallNav); 
6347
6348								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) {
6349									$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
6350										'padding' : '0'			
6351									},{queue:false, duration:250, easing: 'easeOutCubic'});	
6352								}
6353							}
6354							else {
6355								$(window).on('scroll.headerResizeEffect',bigNav);
6356							}
6357							
6358				
6359						} else {
6360							
6361							$(window).off('scroll.headerResizeEffectOpaque');
6362							$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
6363						}
6364					}
6365				}
6366
6367			}
6368
6369	}
6370
6371	function mobileCloseNavCheck(e) {
6372		
6373
6374				$('#slide-out-widget-area').css({ 'transform': 'translate3d(341px,0,0)' }).removeClass('open');
6375
6376				$('#header-outer').removeClass('style-slide-out-from-right');
6377
6378				$('.slide-out-hover-icon-effect .lines-button').removeClass('unhidden-line').addClass('no-delay');
6379
6380				if($('#header-outer[data-permanent-transparent="1"]').length == 0) {
6381
6382					$('#header-outer').removeClass('no-bg-color');
6383					$('#header-outer header').removeClass('all-hidden');
6384
6385				}
6386
6387				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;
6388
6389				if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6390					
6391					var headerResize = $('#header-outer').attr('data-header-resize');
6392					if(headerResize == 1) {
6393					
6394						$(window).off('scroll.headerResizeEffect');
6395						if($(window).scrollTop() == 0) {
6396							$(window).on('scroll.headerResizeEffect',smallNav); 
6397
6398							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) {
6399								$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
6400									'padding' : '0'			
6401								},{queue:false, duration:250, easing: 'easeOutCubic'});	
6402							}
6403						}
6404						else {
6405							$(window).on('scroll.headerResizeEffect',bigNav);
6406						}
6407						
6408			
6409					} else {
6410						
6411						$(window).off('scroll.headerResizeEffectOpaque');
6412						$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
6413					}
6414			}
6415
6416			
6417
6418	}
6419
6420	//hover triggered
6421	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/))
6422		$('body').on('mouseenter','#header-outer .slide-out-widget-area-toggle:not(.std-menu) a',openRightHoverNav);
6423	else 
6424		$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a',openRightHoverNav);
6425
6426	$(window).on('smartresize',calculateHoverNavMinHeight);
6427
6428}
6429
6430
6431
6432function setMaterialWidth() {
6433	
6434	
6435	$('#slide-out-widget-area.slide-out-from-right').css({
6436		'padding-top' : $(window).height()*0.1,
6437		'padding-bottom' : $(window).height()*0.1
6438	});
6439
6440	slideOutWidgetOverflowState();
6441}
6442
6443if($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) {
6444	setMaterialWidth();
6445}
6446
6447//icon hover effect
6448if($('body.material').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0) {
6449
6450	if($('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0) {
6451		var $menuIconClone = $('header#top nav ul .slide-out-widget-area-toggle a > span > i').clone();
6452		$menuIconClone.addClass('hover-effect');
6453		$('header#top nav ul .slide-out-widget-area-toggle a > span').append($menuIconClone);
6454
6455		var $menuIconClone2 = $('header#top .slide-out-widget-area-toggle.mobile-icon a > span > i').clone();
6456		$menuIconClone2.addClass('hover-effect');
6457		$('header#top .slide-out-widget-area-toggle.mobile-icon a > span').append($menuIconClone2);
6458	}
6459
6460	$('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>'));
6461}
6462
6463if($('body.material #boxed').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) {
6464	$('#ajax-content-wrap > .slide-out-widget-area-toggle.slide-out-hover-icon-effect.small').insertAfter('.ocm-effect-wrap');
6465}
6466
6467//move material skin default ocm
6468if($('body.material').length > 0 && $('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0) {
6469	$('body.material #slide-out-widget-area.slide-out-from-right .slide_out_area_close').insertAfter('.ocm-effect-wrap');
6470	$('#slide-out-widget-area-bg').insertAfter('.ocm-effect-wrap');
6471	$('#slide-out-widget-area').insertAfter('.ocm-effect-wrap');
6472	
6473}
6474
6475//remove trans on material search/ocm when resizing 
6476if($('body.material[data-header-search="true"]').length > 0 || $('body.material .ocm-effect-wrap').length > 0 ) {
6477		
6478	var materialTransTO;
6479
6480	$(window).resize(function(){
6481
6482		clearTimeout(materialTransTO);
6483
6484		$('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');
6485
6486		materialTransTO = setTimeout(function(){
6487			$('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');
6488		},250);
6489
6490		setMaterialWidth();
6491
6492	});
6493}
6494
6495
6496function materialOCM_Size() {
6497	if($('.ocm-effect-wrap.material-ocm-open').length > 0 ) {
6498		var adminBarHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; 
6499		//$('#ajax-content-wrap').css({'position' : 'relative', 'top' : '-' + $(window).scrollTop() + 'px' });
6500		$('.ocm-effect-wrap').css({'height': $(window).height() });
6501		$('.ocm-effect-wrap-inner').css({'padding-top': adminBarHeight });
6502	}
6503}
6504$(window).resize(materialOCM_Size);
6505
6506
6507function OCM_dropdown_function() {
6508	var $nectar_ocm_dropdown_func = ($('#slide-out-widget-area[data-dropdown-func]').length > 0) ? $('#slide-out-widget-area').attr('data-dropdown-func') : 'default';
6509	if($nectar_ocm_dropdown_func == 'separate-dropdown-parent-link') {
6510		$('#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>');
6511	}
6512}
6513
6514OCM_dropdown_function();
6515
6516//click triggered
6517$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating)',function(){
6518	if(animating == 'true' || $('.slide-out-from-right-hover').length > 0) return false;
6519	var $that = $(this);
6520
6521	$('#header-outer').removeClass('no-transition');
6522
6523	//slide out from right
6524	if($('#slide-out-widget-area').hasClass('slide-out-from-right')) {
6525
6526		$slideOutAmount = ($('.body-border-top').length > 0 && $('body.mobile').length == 0) ? $('.body-border-top').height() : 0;
6527
6528
6529		if($('body.material').length == 0) {
6530
6531				//calc height if used bottom meta
6532				$('#slide-out-widget-area .inner').css({'height':'auto', 'min-height': $('#slide-out-widget-area').height() - 25 - $('.bottom-meta-wrap').height() });
6533
6534				if($('#boxed').length == 0) {
6535					$('.container-wrap, .home-wrap, #header-secondary-outer, #footer-outer:not(#nectar_fullscreen_rows #footer-outer), .nectar-box-roll, .parallax_slider_outer .swiper-slide .image-bg, .parallax_slider_outer .swiper-slide .video-wrap, .parallax_slider_outer .swiper-slide .mobile-video-image, .parallax_slider_outer .swiper-slide .container, #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');
6536
6537					var $withinCustomBreakpoint = mobileBreakPointCheck();
6538
6539					if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0 || $withinCustomBreakpoint) {
6540						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) {
6541							$('#header-outer').stop(true).css('transform','translateY(0)').transition({ x: '-' + (300+$slideOutAmount) +'px'},700,'easeInOutCubic');
6542						} else {
6543							$('#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');
6544						}
6545					} else {
6546						$('#header-outer header#top nav > ul.buttons, body:not(.material) #header-outer .cart-outer .cart-menu-wrap').transition({ x: '-300px'},700,'easeInOutCubic');
6547					}
6548
6549					$('#ascrail2000').transition({ 'x': '-' + (300+$slideOutAmount) +'px' },700,'easeInOutCubic');
6550					$('body:not(.ascend):not(.material) #header-outer .cart-menu').stop(true).transition({ 'x': '300px' },700,'easeInOutCubic');
6551				}
6552
6553				$('#slide-out-widget-area').stop(true).transition({ x: '-' + $slideOutAmount +'px' },700,'easeInOutCubic').addClass('open');
6554
6555
6556				if($('#boxed').length == 0) {
6557					//full width menu adjustments
6558					if($('#header-outer[data-full-width="true"]').length > 0 && !$('body').hasClass('mobile')) { 
6559						$('#header-outer').addClass('highzI'); 
6560						$('#ascrail2000').addClass('z-index-adj');
6561
6562						if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
6563							if($bodyBorderWidth == 0)
6564								$('header#top #logo').stop(true).transition({ x: (300+$slideOutAmount) +'px' },700,'easeInOutCubic'); 
6565							
6566							//$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': $(window).width() - 360, 'left': '300px' },700,'easeInOutCubic');
6567
6568						}
6569
6570						$('header#top .slide-out-widget-area-toggle .lines-button').addClass('close');
6571
6572						if($('#header-outer[data-remove-border="true"]').length > 0) {
6573							$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '64px' },700,'easeInOutCubic');
6574						} else {
6575							$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '89px' },700,'easeInOutCubic'); 
6576						}
6577
6578						$('body #header-outer nav > ul > li > a').css({'margin-bottom':'0'});
6579						
6580					}
6581				}
6582
6583				$('#header-outer').addClass('style-slide-out-from-right');
6584
6585				//fade In BG Overlay
6586				$('#slide-out-widget-area-bg').css({'height':'100%','width':'100%'}).stop(true).transition({
6587					'opacity' : 1
6588				},700,'easeInOutCubic',function(){
6589					$('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating');
6590				});
6591				
6592				//hide menu if no space
6593				if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
6594					$logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width();
6595					if($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) $('#header-outer').addClass('hidden-menu');
6596				} else {
6597					$('#header-outer').addClass('hidden-menu-items');
6598				}
6599
6600				var headerResize = $('#header-outer').attr('data-header-resize');
6601
6602				if($('#header-outer[data-remove-fixed="1"]').length == 0) {
6603					if($bodyBorderHeaderColorMatch == true && headerResize == 1) {
6604						
6605						$('#header-outer').stop(true).transition({ y: '0' },0).addClass('transparent').css('transition','transform');
6606						if($('#header-outer').attr('data-transparent-header') != 'true') {
6607							$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
6608						}
6609
6610						$(window).off('scroll',bigNav);
6611						//if($('.small-nav').length > 0 || $('#header-outer').hasClass('pseudo-data-transparent')) bigNav();
6612						$(window).off('scroll',smallNav);
6613
6614					} else if ($bodyBorderHeaderColorMatch == true) {
6615						$('#header-outer').addClass('transparent');
6616						$(window).off('scroll',opaqueCheck);
6617						$(window).off('scroll',transparentCheck);
6618
6619						if($('#header-outer').attr('data-transparent-header') != 'true') {
6620							$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
6621						}
6622					}
6623				}
6624
6625		} else if ( $('body.material').length > 0 ) {
6626
6627			//material
6628			
6629			//move ajax loading outside
6630			if($('#ajax-loading-screen').length > 0 && $('.ocm-effect-wrap #ajax-loading-screen').length > 0) {
6631				$('#ajax-loading-screen').insertBefore('.ocm-effect-wrap');
6632			}
6633			
6634			////hide secondary header when not at top with hhun
6635			if($(window).scrollTop() > 40) {
6636				
6637				$('body[data-hhun="1"] #header-secondary-outer').addClass('hidden');
6638			}
6639
6640
6641			setTimeout(function(){ $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); },300);
6642			$('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').addClass('material-open');
6643
6644
6645			var adminBarHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; 
6646			$('#ajax-content-wrap').css({'position' : 'relative', 'top' : '-' + $(window).scrollTop() + 'px' });
6647			$('.ocm-effect-wrap-inner').css({'padding-top': adminBarHeight });
6648			$('#fp-nav').addClass('material-ocm-open');
6649			$('body').addClass('material-ocm-open');
6650			$('.ocm-effect-wrap').css({'height': window.innerHeight });
6651
6652			setTimeout(function(){
6653				$('.ocm-effect-wrap').addClass('material-ocm-open');
6654			},40);
6655			
6656			
6657			$('body > .slide_out_area_close').addClass('follow-body');
6658
6659			//icon effect
6660			$('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('effect-shown');
6661
6662			//handle hhun when at top
6663			$('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('+adminBarHeight+'px)'});
6664
6665			setTimeout(function(){
6666				$('body > .slide_out_area_close').addClass('material-ocm-open');
6667			},350);
6668
6669
6670		}
6671
6672
6673	}
6674     else if($('#slide-out-widget-area').hasClass('fullscreen')) {
6675
6676     	if ( $('body.material').length > 0 ) {
6677     		$('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out');
6678     	}
6679
6680		//scroll away from fixed reveal footer if shown (firefox bug with bluring over it)
6681		var $scrollDelay = 0;
6682		var $scrollDelay2 = 0;
6683
6684		if($(window).scrollTop() + $(window).height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) {
6685			$('body,html').stop().animate({
6686				scrollTop: $('.blurred-wrap').height() - $(window).height()
6687			},600,'easeInOutCubic');
6688			$scrollDelay = 550;
6689			$scrollDelay2 = 200;
6690		}
6691
6692		$('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close');
6693		setTimeout(function(){ $('.blurred-wrap').addClass('blurred'); },$scrollDelay);
6694		$('#slide-out-widget-area.fullscreen').show().addClass('open');
6695
6696		if($('.nectar-social-sharing-fixed').length == 0) {
6697			hideToTop();
6698		}
6699
6700		//remove box shadow incase at the top of the page with nectar box roll above
6701		$('.container-wrap').addClass('no-shadow');
6702		$('#header-outer').stop(true).css('transform','translateY(0)');
6703
6704		setTimeout(function(){
6705
6706			$('.off-canvas-menu-container .menu > li').each(function(i){
6707				$(this).delay(i*50).transition({y: 0, 'opacity': 1},800,'easeOutExpo');
6708			});
6709
6710			$('#slide-out-widget-area.fullscreen .widget').each(function(i){
6711				$(this).delay(i*100).transition({y: 0, 'opacity': 1},800,'easeOutExpo');
6712			});
6713		},370+$scrollDelay2);
6714
6715		setTimeout(function(){
6716			$('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
6717
6718			$('#slide-out-widget-area .off-canvas-social-links li').each(function(i){
6719				$(this).delay(i*50).transition({'scale':1},400,'easeOutCubic');
6720			});
6721			$('#slide-out-widget-area .bottom-text').transition({'opacity':0.7},400,'easeOutCubic');
6722		},750+$scrollDelay2);
6723		
6724		//fade In BG Overlay
6725		setTimeout(function(){
6726			$easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint';
6727			$('#slide-out-widget-area-bg').css({'height':'100%','width':'100%'}).show().stop(true).transition({
6728				'y' : '0%'
6729			},920,$easing,function(){
6730				$('.slide-out-widget-area-toggle > div > a').removeClass('animating');
6731			});
6732		},50+$scrollDelay2);
6733
6734		//overflow state 
6735		slideOutWidgetOverflowState();
6736		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').addClass('at-content');
6737		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());
6738	} 
6739
6740	else if($('#slide-out-widget-area').hasClass('fullscreen-alt')) {
6741
6742		if ( $('body.material').length > 0 ) {
6743     		$('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out');
6744     	}
6745
6746		$('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close');
6747		$('#slide-out-widget-area.fullscreen-alt').show().addClass('open');
6748		$('#slide-out-widget-area-bg').addClass('open');
6749
6750		$('body > div[class*="body-border"]').css('z-index','9995');
6751
6752		$('.off-canvas-menu-container .menu').transition({y: '0px', 'opacity': 1},0);	
6753
6754		if($('.nectar-social-sharing-fixed').length == 0) {
6755			hideToTop();
6756		}
6757
6758		if($('#header-outer.transparent').length == 0) {
6759
6760
6761		}
6762		else { 
6763
6764			//$('#header-outer-bg-only').hide();
6765			if($('.body-border-top').length > 0) {
6766				$('.admin-bar #slide-out-widget-area-bg.fullscreen-alt').css({'padding-top': ($('.body-border-top').outerHeight(true)+32) + 'px'});
6767				$('body:not(.admin-bar) #slide-out-widget-area-bg.fullscreen-alt').css({'padding-top': ($('.body-border-top').outerHeight(true))+ 'px'});
6768			}
6769		}
6770		
6771		//set translateY to 0 in all cases
6772		$('#header-outer').stop(true).css('transform','translateY(0)');
6773
6774		if($('#logo .starting-logo').length > 0 && $(window).width() > 1000) {
6775			
6776			//$('#header-outer').addClass('no-transition').addClass('no-bg-color');
6777			
6778			$('#header-outer').stop(true).css('transform','translateY(0)').addClass('transparent');
6779			if($('#header-outer').attr('data-transparent-header') != 'true') {
6780				$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
6781			}
6782		}
6783
6784		$('.off-canvas-menu-container .clip-wrap').css('transition-duration','0s');
6785
6786		setTimeout(function(){
6787
6788			$('.off-canvas-menu-container .menu > li').each(function(i){
6789				$(this).delay(i*50).transition({y: 0, 'opacity': 1},750,'easeOutCubic').addClass('no-pointer-events');
6790			});
6791
6792			setTimeout(function(){
6793				$('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
6794				$('.off-canvas-menu-container .clip-wrap').css('transition-duration','.45s');
6795			},500);
6796			
6797		
6798
6799			$('#slide-out-widget-area.fullscreen-alt .widget').each(function(i){
6800				$(this).delay(i*100).transition({y: 0, 'opacity': 1},650,'easeOutCubic');
6801			});
6802		},200);
6803
6804		setTimeout(function(){
6805			$('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
6806
6807			$('#slide-out-widget-area .off-canvas-social-links li').css('opacity','1').each(function(i){
6808				$(this).delay(i*50).transition({'scale':1},400,'easeOutCubic');
6809			});
6810			$('#slide-out-widget-area .bottom-text').transition({'opacity':1},600,'easeOutCubic');
6811		},200);
6812		
6813		//fade In BG Overlay
6814		if($('#slide-out-widget-area-bg').hasClass('solid')) $opacity = 1;
6815		if($('#slide-out-widget-area-bg').hasClass('dark')) $opacity = 0.97;
6816		if($('#slide-out-widget-area-bg').hasClass('medium')) $opacity = 0.6;
6817		if($('#slide-out-widget-area-bg').hasClass('light')) $opacity = 0.4;
6818		$('#slide-out-widget-area-bg').removeClass('no-transition');
6819		
6820
6821		$('#slide-out-widget-area-bg').addClass('padding-removed').css({'height':'100%','width':'100%', 'left':'0','opacity': $opacity});
6822		
6823
6824		setTimeout(function(){
6825			$('.slide-out-widget-area-toggle > div > a').removeClass('animating');
6826		},600);
6827			
6828		
6829
6830		//overflow state 
6831		slideOutWidgetOverflowState();
6832		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').addClass('at-content');
6833		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());
6834	}
6835
6836
6837
6838	//add open class
6839	$('#header-outer').removeClass('side-widget-closed').addClass('side-widget-open');
6840
6841	//give header transparent state
6842	if($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0 && $('#header-outer[data-full-width="true"]').length > 0) {
6843		$('#header-outer').addClass('transparent');
6844	}
6845
6846	//dark slide transparent nav
6847	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');
6848	
6849	$('.slide-out-widget-area-toggle > div > a').removeClass('closed').addClass('open');
6850	$('.slide-out-widget-area-toggle > div > a').addClass('animating');
6851
6852	return false;
6853});
6854
6855$('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){
6856
6857	if (e.originalEvent == undefined && $('.slide_out_area_close.non-human-allowed').length == 0 ) { return; }
6858	
6859	if($('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) return;
6860
6861
6862	$('#header-outer').removeClass('no-transition');
6863
6864	
6865
6866	var $that = $(this);
6867
6868	$('.slide-out-widget-area-toggle:not(.std-menu) a').removeClass('open').addClass('closed');
6869	$('.slide-out-widget-area-toggle:not(.std-menu) a').addClass('animating');
6870
6871	//slide out from right
6872	if($('#slide-out-widget-area').hasClass('slide-out-from-right')) {
6873
6874			if($('body.material').length == 0) {
6875
6876				$('.container-wrap, .home-wrap, #header-secondary-outer, #footer-outer:not(#nectar_fullscreen_rows #footer-outer), .nectar-box-roll, .parallax_slider_outer .swiper-slide .image-bg, .parallax_slider_outer .swiper-slide .container, .parallax_slider_outer .swiper-slide .video-wrap, .parallax_slider_outer .swiper-slide .mobile-video-image, #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');
6877
6878				if($('#header-outer[data-transparency-option="1"]').length > 0  && $('#boxed').length == 0) {
6879					$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');
6880					$('#header-outer').stop(true).transition({ x: '0px', 'background-color': $currentRowBG },700,'easeInOutCubic');
6881				} else {
6882					$('#header-outer').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
6883				}
6884
6885				$('#ascrail2000').stop(true).transition({ 'x': '0px' },700,'easeInOutCubic');
6886				$('body:not(.ascend):not(.material) #header-outer .cart-menu').stop(true).transition({ 'x': '0px' },700,'easeInOutCubic');
6887
6888				$('#slide-out-widget-area').stop(true).transition({ x: '301px' },700,'easeInOutCubic').removeClass('open');
6889
6890
6891				if($('#boxed').length == 0) {
6892					if($('#header-outer[data-full-width="true"]').length > 0) {  
6893						$('#header-outer').removeClass('highzI'); 
6894						$('header#top #logo').stop(true).transition({ x: '0px' },700,'easeInOutCubic'); 
6895						//$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': '100%', 'left': '0' },700,'easeInOutCubic');
6896						$('.lines-button').removeClass('close');
6897
6898						$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
6899
6900					}
6901				}
6902
6903				if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) {
6904					$('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({ x: '0px' },700,'easeInOutCubic'); 
6905				}
6906
6907				//fade out overlay
6908				$('#slide-out-widget-area-bg').stop(true).transition({
6909					'opacity' : 0
6910				},700,'easeInOutCubic',function(){
6911					$('.slide-out-widget-area-toggle a').removeClass('animating');
6912					$(this).css({'height':'1px','width':'1px'});
6913
6914					if($('#header-outer[data-remove-fixed="1"]').length == 0) {
6915						//hide menu if transparent, user has scrolled down and hhun is on
6916						if($('#header-outer').hasClass('parallax-contained') && $(window).scrollTop() > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) {
6917							$('#header-outer').removeClass('parallax-contained').addClass('detached').removeClass('transparent');
6918						}
6919						else if($(window).scrollTop() == 0 && $('body[data-hhun="1"]').length > 0 && $('#page-header-bg[data-parallax="1"]').length > 0 ||
6920							$(window).scrollTop() == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) {
6921
6922							if($('#header-outer[data-transparency-option="1"]').length > 0) $('#header-outer').addClass('transparent');
6923							$('#header-outer').addClass('parallax-contained').removeClass('detached');
6924						}
6925					}
6926
6927					//fix for fixed subpage menu
6928					$('.container-wrap').css('transform','none');
6929				});
6930
6931
6932				$('#header-outer').removeClass('style-slide-out-from-right');
6933
6934
6935				var headerResize = $('#header-outer').attr('data-header-resize');
6936				if($('#header-outer[data-remove-fixed="1"]').length == 0) {
6937
6938					if($bodyBorderHeaderColorMatch == true && headerResize == 1) {
6939					
6940						$(window).off('scroll.headerResizeEffect');
6941						if($(window).scrollTop() == 0) {
6942							$(window).on('scroll.headerResizeEffect',smallNav); 
6943
6944							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) {
6945								$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
6946									'padding' : '0'			
6947								},{queue:false, duration:250, easing: 'easeOutCubic'});	
6948							}
6949						}
6950						else
6951							$(window).on('scroll.headerResizeEffect',bigNav); 
6952							//smallNav();
6953
6954						if($('#header-outer').hasClass('pseudo-data-transparent')) {
6955							$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
6956						}
6957
6958						$('#header-outer').css('transition','transform');
6959
6960					} else if ($bodyBorderHeaderColorMatch == true) {
6961						
6962						$(window).off('scroll.headerResizeEffectOpaque');
6963						$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
6964
6965						$('#header-outer').css('transition','transform');
6966
6967						if($('#header-outer').hasClass('pseudo-data-transparent')) {
6968							$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
6969						}
6970					}
6971				}
6972		}
6973
6974		else if ( $('body.material').length > 0 ) {
6975
6976			//material
6977			$('#slide-out-widget-area').removeClass('open');
6978
6979			$('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').removeClass('material-open');
6980			$('.ocm-effect-wrap, .ocm-effect-wrap-shadow, body > .slide_out_area_close, #fp-nav').removeClass('material-ocm-open');
6981
6982			$('body > .slide_out_area_close').removeClass('follow-body');
6983
6984			setTimeout(function(){
6985				$('.slide-out-widget-area-toggle a').removeClass('animating');
6986				$('body').removeClass('material-ocm-open');
6987				$('.ocm-effect-wrap').css({'height': '100%'});
6988				$('.ocm-effect-wrap-inner').css({'padding-top': '0' });
6989				$(window).scrollTop(Math.abs( parseInt($('#ajax-content-wrap').css('top')) ) );
6990				$('#ajax-content-wrap').css({'position' : '', 'top' : '' });
6991
6992				//handle hhun when at top
6993				$('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':''});
6994				setTimeout(function(){
6995					$('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':''});
6996				},30);
6997				
6998
6999				$('body[data-hhun="1"] #header-secondary-outer.hidden').removeClass('hidden');
7000
7001			},900);
7002
7003			setTimeout(function(){
7004				//icon effect
7005				$('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('no-trans').removeClass('effect-shown');
7006			},200);
7007
7008			setTimeout(function(){
7009				//icon
7010				$('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').removeClass('no-trans')
7011			},500);
7012			
7013		}
7014
7015
7016	} 
7017
7018	else if($('#slide-out-widget-area').hasClass('fullscreen')) {
7019
7020
7021		if ( $('body.material').length > 0 ) {
7022			setTimeout(function(){
7023				$('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out');
7024			},350);
7025     	}
7026
7027		$('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close');
7028		//$('.slide-out-widget-area-toggle a').removeClass('animating');
7029		$('.blurred-wrap').removeClass('blurred');
7030		$('#slide-out-widget-area.fullscreen').transition({'opacity': 0 },700,'easeOutQuad',function(){ $('#slide-out-widget-area.fullscreen').hide().css('opacity','1'); }).removeClass('open');
7031		$('#slide-out-widget-area.fullscreen .widget').transition({'opacity': 0},700,'easeOutQuad',function(){
7032			$(this).transition({y: '110px'},0);
7033		});
7034
7035		setTimeout(function(){
7036			$('.off-canvas-menu-container .menu > li').transition({y: '80px', 'opacity': 0},0);		
7037			$('#slide-out-widget-area .off-canvas-social-links li').transition({'scale':0},0);
7038			$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
7039			$('#slide-out-widget-area .bottom-text').transition({'opacity':0},0);	
7040
7041			//close submenu items
7042			$('#slide-out-widget-area .menuwrapper .menu').removeClass( 'subview' );
7043			$('#slide-out-widget-area .menuwrapper .menu li').removeClass( 'subview subviewopen' );
7044			$('#slide-out-widget-area.fullscreen .inner .off-canvas-menu-container').css('height','auto');
7045		},800);
7046
7047		setTimeout(function(){
7048			if($('.nectar-social-sharing-fixed').length == 0) {
7049				showToTop();
7050			}
7051			$('.container-wrap').removeClass('no-shadow');
7052		},500);
7053
7054		//fade out overlay
7055		$('#slide-out-widget-area-bg').stop(true).transition({'opacity': 0},900,'easeOutQuad',function(){
7056			if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').removeClass('at-content');
7057			if($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', '0');
7058			$('.slide-out-widget-area-toggle a').removeClass('animating');
7059			if($('#slide-out-widget-area-bg').hasClass('solid')) $opacity = 1;
7060			if($('#slide-out-widget-area-bg').hasClass('dark')) $opacity = 0.93;
7061			if($('#slide-out-widget-area-bg').hasClass('medium')) $opacity = 0.6;
7062			if($('#slide-out-widget-area-bg').hasClass('light')) $opacity = 0.4;
7063			$(this).css({'height':'1px','width':'1px', 'opacity': $opacity}).transition({ y : '-100%'},0);
7064		});
7065
7066		
7067	}
7068
7069	else if($('#slide-out-widget-area').hasClass('fullscreen-alt')) {
7070
7071
7072		if ( $('body.material').length > 0 ) {
7073			setTimeout(function(){
7074				$('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out');
7075			},350);
7076     	}
7077
7078		$('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close');
7079		//$('.slide-out-widget-area-toggle a').removeClass('animating');
7080		$('.blurred-wrap').removeClass('blurred');
7081		$('#slide-out-widget-area-bg').removeClass('open');
7082		
7083		$('#slide-out-widget-area.fullscreen-alt .widget').transition({'opacity': 0},500,'easeOutQuad',function(){
7084			$(this).transition({y: '40px'},0);
7085		});
7086		$('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({'opacity': 0},250,'easeOutQuad');
7087		$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
7088
7089		$('.off-canvas-menu-container .menu').transition({y: '-13px', 'opacity': 0},400);	
7090
7091
7092		setTimeout(function(){
7093			$('.off-canvas-menu-container .menu > li').stop(true,true).transition({y: '40px', 'opacity': 0},0);		
7094			$('#slide-out-widget-area .off-canvas-social-links li').transition({'scale':0},0);
7095			$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');	
7096
7097			//close submenu items
7098			$('#slide-out-widget-area .menuwrapper .menu').removeClass( 'subview' );
7099			$('#slide-out-widget-area .menuwrapper .menu li').removeClass( 'subview subviewopen' );
7100			$('#slide-out-widget-area.fullscreen-alt .inner .off-canvas-menu-container').css('height','auto');
7101
7102			if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').removeClass('at-content');
7103			if($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) $('#slide-out-widget-area.fullscreen-alt .inner-wrap').css('padding-top', '0');
7104			$('.slide-out-widget-area-toggle a').removeClass('animating');
7105			$('#slide-out-widget-area-bg').css({'height':'1px','width':'1px','left':'-100%'});
7106			$('#slide-out-widget-area.fullscreen-alt').hide().removeClass('open');
7107		},550);
7108
7109		setTimeout(function(){
7110			if($('.nectar-social-sharing-fixed').length == 0) {
7111				showToTop();
7112			}
7113		},600);
7114
7115		//fade out overlay
7116		setTimeout(function(){
7117			$('#slide-out-widget-area-bg').removeClass('padding-removed');
7118		},50);	
7119
7120		
7121		var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 150: 50;
7122
7123		setTimeout(function(){
7124			$('#slide-out-widget-area-bg').stop(true).css({'opacity': 0});
7125			if($('[data-transparent-header="true"]').length > 0) $('body > div[class*="body-border"]').css('z-index','10000');
7126		},borderDelay);
7127
7128		setTimeout(function(){
7129			$('#header-outer.transparent.small-nav, #header-outer.transparent.detached, #header-outer:not([data-permanent-transparent="1"]).transparent.scrolled-down').removeClass('transparent');
7130			
7131			if($('#header-outer').hasClass('pseudo-data-transparent')) {
7132				$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
7133			}
7134
7135			
7136
7137		},100);
7138		
7139	}
7140
7141
7142	
7143
7144	//dark slide transparent nav
7145	if($('#header-outer.temp-removed-dark-slide.transparent').length > 0  && $('#boxed').length == 0) $('#header-outer').removeClass('temp-removed-dark-slide').addClass('dark-slide');
7146
7147	//remove header transparent state
7148
7149	if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) {
7150
7151		if($('.nectar-box-roll').length == 0) {
7152			if($('#header-outer.small-nav').length > 0 || $('#header-outer.scrolled-down').length > 0 || $('#header-outer.detached').length > 0) $('#header-outer').removeClass('transparent');
7153		} else {
7154			if($('#header-outer.small-nav').length > 0 || $('#header-outer.scrolled-down').length > 0 || $('.container-wrap.auto-height').length > 0) $('#header-outer').removeClass('transparent');
7155		}
7156	} 
7157
7158
7159
7160	//remove hidden menu
7161	$('#header-outer').removeClass('hidden-menu');
7162
7163	$('#header-outer').removeClass('side-widget-open').addClass('side-widget-closed');
7164
7165	return false;
7166});
7167
7168function slideOutWidgetOverflowState() {
7169
7170
7171	//switch position of social media/extra info based on screen size
7172	if(window.innerWidth < 1000 || $('body > #boxed').length > 0 || $('.ocm-effect-wrap-inner > #boxed').length > 0) {
7173
7174		$('#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');
7175		$('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner');
7176	} else {
7177		$('#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');
7178		$('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap');
7179	}
7180
7181	//add overflow
7182	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'); }
7183	else { $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').removeClass('overflow-state'); }
7184
7185	$('#slide-out-widget-area[class*="fullscreen"] .inner').transition({ y : '-' + ($('#slide-out-widget-area[class*="fullscreen"] .inner').height()/2) + 'px' },0);
7186
7187	//close mobile only slide out widget area if switching back to desktop
7188	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');
7189
7190	//sizing for dropdown
7191	OCM_Dropdown_Icon_Pos();
7192
7193	
7194
7195}
7196
7197
7198function OCM_Dropdown_Icon_Pos() {
7199	$('#slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children').each(function(){
7200		$(this).find('.ocm-dropdown-arrow').css({'top': $(this).find('a').height()/2 });
7201	});
7202}
7203OCM_Dropdown_Icon_Pos();
7204
7205
7206function fullWidthHeaderSlidingWidgetMenuCalc() {
7207	$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': $(window).width() - 360, 'left': '300px' },700,'easeInOutCubic');
7208}
7209
7210//slide out widget area scrolling 
7211function slideOutWidgetAreaScrolling(){ 
7212	$('#slide-out-widget-area').mousewheel(function(event, delta) {
7213
7214	     this.scrollTop -= (delta * 30);
7215	    
7216	     event.preventDefault();
7217
7218	});
7219}
7220setTimeout(slideOutWidgetAreaScrolling,500);
7221
7222
7223//handle mobile scrolling
7224if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
7225	$('#slide-out-widget-area').addClass('mobile');
7226}
7227
7228
7229function closeOCM(item) {
7230    if($('#slide-out-widget-area.open').length > 0) {
7231
7232    	var $windowCurrentLocation = window.location.href.split("#")[0];
7233		var $windowClickedLocation = item.find('> a').attr('href').split("#")[0];
7234
7235    	if($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) 
7236        $('.slide-out-widget-area-toggle a').trigger('click');
7237    }
7238}
7239
7240
7241//left header
7242function leftHeaderSubmenus() {
7243
7244	//remove megamenu class
7245	$('#header-outer[data-format="left-header"] nav li.megamenu').removeClass('megamenu');
7246
7247	$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';
7248	//click
7249	$('#header-outer[data-format="left-header"]  li.menu-item-has-children > a, '+$ocm_link_selector).click(function(){
7250
7251		if($(this).parent().hasClass('open-submenu')) {
7252			$(this).parent().find('.sub-menu').css({
7253				'max-height' : '0'
7254			});
7255			$(this).parent().removeClass('open-submenu');
7256		}
7257		else {
7258
7259			//get max height
7260
7261			var $that = $(this);
7262			var $maxSubMenuHeight;
7263
7264			$that.parent().find('> .sub-menu').addClass('no-trans');
7265
7266			setTimeout(function(){
7267
7268				$that.parent().find('> .sub-menu').css({
7269					'max-height' : 'none',
7270					'position' : 'absolute',
7271					'visibility' : 'hidden'
7272				});
7273				
7274				$maxSubMenuHeight =  $that.parent().find('> .sub-menu').height();
7275
7276				$that.parent().find('> .sub-menu').removeClass('no-trans');
7277				$that.parent().find('> .sub-menu').css({
7278					'max-height' : '0',
7279					'position' : 'relative',
7280					'visibility' : 'visible'
7281				});
7282
7283			},25);
7284
7285			setTimeout(function(){
7286				
7287				//reset
7288				$that.closest('ul').find('li.menu-item-has-children').removeClass('open-submenu');
7289				$that.closest('ul').find('li.menu-item-has-children > .sub-menu').css({
7290					'max-height' : '0'
7291				});
7292
7293				$that.parent().addClass('open-submenu');
7294
7295				$that.parent().find('> .sub-menu').css('max-height', $maxSubMenuHeight);
7296
7297				//add height to open parents
7298				if($that.parents('ul').length > 0) {
7299
7300					$that.parents('ul:not(.sf-menu)').each(function(){
7301						$(this).css('max-height');
7302						$(this).css('max-height', parseInt($(this).height() + parseInt($(this).css('padding-top'))*2 + $maxSubMenuHeight)+'px');
7303					});
7304				} 
7305					
7306
7307			},50);
7308		}
7309		
7310		return false;
7311	});
7312	
7313	//start open for current page items
7314	var $maxSubMenuHeightArr = [];
7315
7316	$('#header-outer[data-format="left-header"] .current-menu-ancestor').find('.current-menu-item').parents('ul.sub-menu').each(function(i){
7317
7318		
7319
7320		$maxSubMenuHeightArr[i] =  $(this).parent().find('> .sub-menu').height();
7321
7322
7323		var $that = $(this);
7324		setTimeout(function(){
7325
7326			var $totalSubMenuHeight = 0;
7327
7328			for(var $i=0; $i < $maxSubMenuHeightArr.length; $i++) {
7329				$totalSubMenuHeight += parseInt($maxSubMenuHeightArr[i]);
7330			}
7331	
7332			$that.parent().addClass('open-submenu');
7333			$that.css('max-height', $totalSubMenuHeight);
7334
7335		},40);
7336	});
7337}
7338
7339if($('#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) {
7340	leftHeaderSubmenus();
7341}
7342
7343
7344
7345
7346//fullscreen submenu
7347;( function( $, window, undefined ) {
7348
7349	'use strict';
7350
7351	// global
7352	var Modernizr = window.Modernizr, $body = $( 'body' );
7353
7354	$.DLMenu = function( options, element ) {
7355		this.$el = $( element );
7356		this._init( options );
7357	};
7358
7359	// the options
7360	$.DLMenu.defaults = {
7361		// classes for the animation effects
7362		animationClasses : { classin : 'dl-animate-in-1', classout : 'dl-animate-out-1' },
7363		onLevelClick : function( el, name ) { return false; },
7364		onLinkClick : function( el, ev ) { return false; }
7365	};
7366
7367	$.DLMenu.prototype = {
7368		_init : function( options ) {
7369
7370			// options
7371			this.options = $.extend( true, {}, $.DLMenu.defaults, options );
7372			// cache some elements and initialize some variables
7373			this._config();
7374			
7375			var animEndEventNames = {
7376					'WebkitAnimation' : 'webkitAnimationEnd',
7377					'OAnimation' : 'oAnimationEnd',
7378					'msAnimation' : 'MSAnimationEnd',
7379					'animation' : 'animationend'
7380				},
7381				transEndEventNames = {
7382					'WebkitTransition' : 'webkitTransitionEnd',
7383					'MozTransition' : 'transitionend',
7384					'OTransition' : 'oTransitionEnd',
7385					'msTransition' : 'MSTransitionEnd',
7386					'transition' : 'transitionend'
7387				};
7388			// animation end event name
7389			this.animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' ) ] + '.menu';
7390			// transition end event name
7391			this.transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ] + '.menu',
7392			// support for css animations and css transitions
7393			this.supportAnimations = Modernizr.cssanimations,
7394			this.supportTransitions = Modernizr.csstransitions;
7395
7396			this._initEvents();
7397
7398		},
7399		_config : function() {
7400			this.open = false;
7401			this.$trigger = this.$el.children( '.trigger' );
7402			this.$menu = this.$el.children( 'ul.menu' );
7403			this.$menuitems = this.$menu.find( 'li:not(.back) > a' );
7404			this.$el.find( 'ul.sub-menu' ).prepend( '<li class="back"><a href="#"> '+$('#slide-out-widget-area').attr('data-back-txt')+' </a></li>' );
7405			this.$back = this.$menu.find( 'li.back' );
7406		},
7407		_initEvents : function() {
7408
7409			var self = this;
7410
7411			this.$trigger.on( 'click.menu', function() {
7412				
7413				if( self.open ) {
7414					self._closeMenu();
7415				} 
7416				else {
7417					self._openMenu();
7418				}
7419				return false;
7420
7421			} );
7422			
7423			this.$menuitems.on( 'click.menu', function( event ) {
7424				
7425				//event.stopPropagation();
7426
7427				var $item = $(this).parent('li'),
7428					$submenu = $item.children( 'ul.sub-menu' );
7429
7430				$('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration','0s');	
7431	
7432				//exit if clicking on background LI (avoids effect wrongly triggering)
7433				//if( $item.find('> a').length > 0 && $item.find('> a').css('display') === 'none') return false;
7434			
7435				if( $submenu.length > 0 ) {
7436
7437					var $flyin = $submenu.clone().css( 'opacity', 0 ).insertAfter( self.$menu ),
7438						onAnimationEndFn = function() {
7439							self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classout ).addClass( 'subview' );
7440							$item.addClass( 'subviewopen' ).parents( '.subviewopen:first' ).removeClass( 'subviewopen' ).addClass( 'subview' );
7441							$flyin.remove();
7442							setTimeout(function(){
7443								$('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
7444								$('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration','.45s');
7445							},300);
7446							
7447			
7448						};
7449
7450					setTimeout( function() {
7451						$flyin.addClass( self.options.animationClasses.classin );
7452						self.$menu.addClass( self.options.animationClasses.classout );
7453						if( self.supportAnimations ) {
7454							self.$menu.on( self.animEndEventName, onAnimationEndFn );
7455						}
7456						else {
7457							onAnimationEndFn.call();
7458						}
7459
7460						self.options.onLevelClick( $item, $item.children( 'a:first' ).text() );
7461					} );
7462
7463
7464					//adjust height for mobile / widgets below
7465					$item.parents('.off-canvas-menu-container').css('height',$item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({ 'height': $flyin.height() },500,'easeInOutQuad' );
7466
7467
7468					return false;
7469
7470				}
7471				else {
7472		
7473					self.options.onLinkClick( $item.find('> a'), event );
7474				}
7475
7476				closeOCM($item);
7477
7478			});
7479
7480			
7481
7482
7483			this.$back.on( 'click.menu', function( event ) {
7484				
7485				var $this = $( this ),
7486					$submenu = $this.parents( 'ul.sub-menu:first' ),
7487					$item = $submenu.parent(),
7488
7489					$flyin = $submenu.clone().insertAfter( self.$menu );
7490
7491				var onAnimationEndFn = function() {
7492					self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classin );
7493					$flyin.remove();
7494				};
7495
7496				setTimeout( function() {
7497					$flyin.addClass( self.options.animationClasses.classout );
7498					self.$menu.addClass( self.options.animationClasses.classin );
7499					if( self.supportAnimations ) {
7500						self.$menu.on( self.animEndEventName, onAnimationEndFn );
7501					}
7502					else {
7503						onAnimationEndFn.call();
7504					}
7505
7506					$item.removeClass( 'subviewopen' );
7507					
7508					var $subview = $this.parents( '.subview:first' );
7509					if( $subview.is( 'li' ) ) {
7510						$subview.addClass( 'subviewopen' );
7511					}
7512					$subview.removeClass( 'subview' );
7513				} );
7514
7515		
7516				//adjust height for mobile / widgets below
7517				$item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height())
7518				setTimeout(function() { 
7519					$item.parents('.off-canvas-menu-container').transition({ 'height': $item.parent().height() },500,'easeInOutQuad');
7520				},50);
7521
7522
7523				return false;
7524
7525			} );
7526			
7527		},
7528		closeMenu : function() {
7529			if( this.open ) {
7530				this._closeMenu();
7531			}
7532		},
7533		_closeMenu : function() {
7534			var self = this,
7535				onTransitionEndFn = function() {
7536					self.$menu.off( self.transEndEventName );
7537					self._resetMenu();
7538				};
7539			
7540			this.$menu.removeClass( 'menuopen' );
7541			this.$menu.addClass( 'menu-toggle' );
7542			this.$trigger.removeClass( 'active' );
7543			
7544			if( this.supportTransitions ) {
7545				this.$menu.on( this.transEndEventName, onTransitionEndFn );
7546			}
7547			else {
7548				onTransitionEndFn.call();
7549			}
7550
7551			this.open = false;
7552		},
7553		openMenu : function() {
7554			if( !this.open ) {
7555				this._openMenu();
7556			}
7557		},
7558		_openMenu : function() {
7559			var self = this;
7560			// clicking somewhere else makes the menu close
7561			$body.off( 'click' ).on( 'click.menu', function() {
7562				self._closeMenu() ;
7563			} );
7564			this.$menu.addClass( 'menuopen menu-toggle' ).on( this.transEndEventName, function() {
7565				$( this ).removeClass( 'menu-toggle' );
7566			} );
7567			this.$trigger.addClass( 'active' );
7568			this.open = true;
7569		},
7570		// resets the menu to its original state (first level of options)
7571		_resetMenu : function() {
7572			this.$menu.removeClass( 'subview' );
7573			this.$menuitems.removeClass( 'subview subviewopen' );
7574		}
7575	};
7576
7577	var logError = function( message ) {
7578		if ( window.console ) {
7579			window.console.error( message );
7580		}
7581	};
7582
7583	$.fn.dlmenu = function( options ) {
7584		if ( typeof options === 'string' ) {
7585			var args = Array.prototype.slice.call( arguments, 1 );
7586			this.each(function() {
7587				var instance = $.data( this, 'menu' );
7588				if ( !instance ) {
7589					logError( "cannot call methods on menu prior to initialization; " +
7590					"attempted to call method '" + options + "'" );
7591					return;
7592				}
7593				if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
7594					logError( "no such method '" + options + "' for menu instance" );
7595					return;
7596				}
7597				instance[ options ].apply( instance, args );
7598			});
7599		} 
7600		else {
7601			this.each(function() {	
7602				var instance = $.data( this, 'menu' );
7603				if ( instance ) {
7604					instance._init();
7605				}
7606				else {
7607					instance = $.data( this, 'menu', new $.DLMenu( options, this ) );
7608				}
7609			});
7610		}
7611		return this;
7612	};
7613
7614} )( jQuery, window );
7615
7616function fullscreenMenuInit() {
7617	$('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />');
7618	$('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen');
7619	$ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0) ? '4' : '5';
7620	$('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({ animationClasses : { classin : 'dl-animate-in-'+$ocmAnimationClassNum, classout : 'dl-animate-out-'+$ocmAnimationClassNum } });
7621
7622	//for slide out right, verify no link ares multiple lines, if so - remove effect
7623	$('#slide-out-widget-area.slide-out-from-right-hover .off-canvas-menu-container .menu > li').each(function(){
7624
7625		if($(this).find('a').length > 0) {
7626				
7627			var $ocmLinkHeight = $(this).find('a').height();
7628			var $ocmLinkLineHeight = parseFloat($(this).find('a').css('line-height'));
7629			var $ocmTextLines = $ocmLinkHeight / $ocmLinkLineHeight;
7630			if(Math.round($ocmTextLines) > 1) {
7631				$(this).parents('.slide-out-from-right-hover').addClass('no-text-effect');
7632				return false;
7633			}
7634			
7635		}
7636
7637	});
7638
7639	//add fullscreen alt text effect 
7640	setTimeout(function(){
7641		$('#slide-out-widget-area.fullscreen-alt .menu li, #slide-out-widget-area.slide-out-from-right-hover:not(.no-text-effect) .off-canvas-menu-container .menu li').each(function(){
7642
7643			var $menuItemText = $(this).find('> a').html();
7644			$(this).find('> a ').html($menuItemText.replace(/ /g, "&nbsp;"));
7645			$(this).find('> a').append('<span class="clip-wrap"><span>'+$(this).find('> a').text()+'</span></span>');
7646		});
7647	},500);
7648
7649
7650	$('body').on('mouseover','#slide-out-widget-area.fullscreen-alt .menu li a',function(){
7651		var $that = $(this);
7652
7653		$(this).find('> .clip-wrap').css({'transition-duration': '0s' });
7654		$(this).find('> .clip-wrap span ').css({'transition-duration': '0s' });
7655
7656	
7657			$that.find('> .clip-wrap').css({'width':'0%', 'transform':'translateX(0%)' });
7658			$that.find('> .clip-wrap span').css({'transform':'translateX(0%)' });
7659
7660		setTimeout(function(){
7661
7662			$that.find('> .clip-wrap').css({'transition-duration': '0.45s' });
7663
7664			$that.find('> .clip-wrap').css({'width':'100%', 'left': '0', 'right': 'auto' });
7665			//$that.find('> .clip-wrap span').css({'transform':'translateX(0%)'});
7666		},50);
7667		
7668		
7669	});
7670	$('body').on('mouseleave','#slide-out-widget-area.fullscreen-alt .menu li a',function(){
7671
7672		var $that = $(this);
7673
7674		$(this).find('> .clip-wrap').css({'transition-duration': '0s' });
7675		$(this).find('> .clip-wrap span ').css({'transition-duration': '0s' });
7676
7677		
7678		$that.find('> .clip-wrap').css({'width':'100%', 'transform':'translateX(0%)' });
7679		$that.find('> .clip-wrap span').css({'transform':'translateX(0%)' });
7680
7681
7682		$that.find('> .clip-wrap').css({'transition-duration': '0.45s' });
7683		$that.find('> .clip-wrap span').css({'transition-duration': '0.45s' });
7684
7685		$that.find('> .clip-wrap').css({'transform':'translateX(100%)'});
7686		$that.find('> .clip-wrap span').css({'transform':'translateX(-100%)'});
7687		
7688
7689	});
7690}
7691
7692if($('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 ) {
7693	fullscreenMenuInit();
7694} else if($('body.using-mobile-browser[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0){
7695	
7696	//close OCM on mobile when clicking anchor on same page 
7697	$('body #slide-out-widget-area .inner .off-canvas-menu-container li a').on('click',function(){
7698			closeOCM($(this).parent());	
7699	});
7700	
7701}
7702
7703//submenu link hover fix
7704$('body').on('mouseover','#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a',function(){
7705	var $currentTxt = $(this).text();
7706	$('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
7707	$('.off-canvas-menu-container .menuwrapper .menu li > a:contains('+$currentTxt+')').addClass('hovered');
7708});
7709$('body').on('mouseover','.off-canvas-menu-container .menuwrapper .menu li > a',function(){
7710	$('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
7711});
7712
7713
7714
7715/***************** Page Headers ******************/
7716
7717var pageHeaderHeight;
7718var pageHeaderHeightCopy;
7719var pageHeadingHeight;
7720var extraSpaceFromResize = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.nectar-box-roll').length == 0) ? 51 : 1;
7721var $headerRemoveStickyness = ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0) ? 1 : 0;
7722
7723//full screen header
7724function fullScreenHeaderInit(){
7725
7726	pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
7727	pageHeaderHeightCopy = parseInt($('#page-header-bg').attr('data-height'));
7728
7729	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && window.innerWidth > 1000) ? 0 : $('#header-outer').height();
7730
7731	if($('.fullscreen-header').length > 0) {
7732
7733		if($('#header-outer[data-transparency-option]').length > 0 && $('#header-outer').attr('data-transparency-option') != '0'){
7734			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() : $(window).height() - parseInt($headerNavSpace) ;
7735		} else {
7736			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() - parseInt($headerNavSpace) + extraSpaceFromResize : $(window).height() - parseInt($headerNavSpace) ;
7737		}
7738		var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
7739		if($('.nectar-box-roll').length > 0) extraHeight = 0;
7740		pageHeaderHeight =   calculatedNum  - extraHeight; 
7741		pageHeaderHeightCopy = calculatedNum - extraHeight; 
7742	}
7743
7744	$('#page-header-bg').css('height',pageHeaderHeight+'px').removeClass('not-loaded');
7745	setTimeout(function(){ $('#page-header-bg').css('overflow','visible') },800);
7746
7747}
7748
7749fullScreenHeaderInit();
7750
7751function pageHeader(){
7752	
7753	//add loaded class
7754	$('#page-header-bg[data-animate-in-effect="zoom-out"]').addClass('loaded');
7755
7756	var $scrollTop = 0;
7757	var $windowInnerWidth = window.innerWidth;
7758	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $windowInnerWidth > 1000) ? 0 : $('#header-outer').height();
7759	var $windowHeight = $(window).height();
7760
7761	//full screen header
7762	if($('.fullscreen-header').length > 0) {
7763		if($('#header-outer[data-transparency-option]').length > 0 && $('#header-outer').attr('data-transparency-option') != '0'){
7764			var calculatedNum = (!$('body').hasClass('mobile')) ? $windowHeight : $windowHeight - parseInt($headerNavSpace) ;
7765			if($('body[data-permanent-transparent="1"]').length > 0) calculatedNum = $windowHeight;
7766		} else {
7767			var calculatedNum = (!$('body').hasClass('mobile')) ? $windowHeight - parseInt($headerNavSpace) + extraSpaceFromResize : $windowHeight - parseInt($headerNavSpace);
7768		}
7769		var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
7770		if($('.nectar-box-roll').length > 0) extraHeight = 0;
7771		pageHeaderHeight =   calculatedNum  - extraHeight; 
7772		pageHeaderHeightCopy = calculatedNum - extraHeight; 
7773	}
7774
7775	if( $windowInnerWidth < 1000 && $windowInnerWidth > 690 && !$('body').hasClass('salient_non_responsive') ) {
7776		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 1.6;
7777		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
7778		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
7779		
7780	} else if( $windowInnerWidth <= 690 && $windowInnerWidth > 480 && !$('body').hasClass('salient_non_responsive')) {
7781		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 2.1;
7782		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
7783		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
7784		
7785	} else if( $windowInnerWidth <= 480 && !$('body').hasClass('salient_non_responsive')) {
7786		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 2.5;
7787		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
7788		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
7789		
7790	} else {
7791		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy).css('height',pageHeaderHeightCopy +'px');
7792		if($('.fullscreen-header').length > 0){
7793			$('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
7794		} else {
7795			$('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
7796		}
7797
7798		if($('#page-header-bg[data-parallax="1"]').length == 0) $('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
7799	}
7800
7801
7802	//handle left header 
7803	if($('body[data-header-format="left-header"]').length > 0 ) $('#page-header-bg[data-parallax="1"]').css('width',$('#ajax-content-wrap').width())
7804	
7805	
7806	if(!$('body').hasClass('mobile')){
7807		
7808		//recalc
7809		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
7810		$('#page-header-bg .container > .row').css('top',0);
7811		var $divisionMultipler = ($('#header-outer[data-remove-border="true"]').length > 0 && $('#header-outer[data-format="centered-menu-under-logo"]').length == 0) ? 2 : 1;
7812
7813		//center the heading
7814		pageHeadingHeight = $('#page-header-bg .col.span_6').height();
7815		
7816		if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.fullscreen-header').length == 0) {
7817			$('#page-header-bg:not("[data-parallax=1]") .col.span_6').css('top', ((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2));
7818		} else {
7819			var $extraResizeHeight = ($('#header-outer[data-header-resize="1"]').length > 0) ? 22: 0;
7820			$('#page-header-bg:not("[data-parallax=1]") .col.span_6').css('top', (pageHeaderHeight/2) - (pageHeadingHeight/2) + $extraResizeHeight);
7821		}
7822		
7823		//center portfolio filters
7824		$('#page-header-bg:not("[data-parallax=1]") .portfolio-filters').css('top', (pageHeaderHeight/2) + 2);	
7825		
7826		if($('#page-header-bg[data-parallax="1"]').length > 0) {
7827			$scrollTop = $(window).scrollTop();
7828		}
7829
7830		if($('#page-header-bg[data-parallax="1"] .span_6').css('opacity') > 0) {
7831			
7832			if($('#header-outer[data-transparent-header="true"]').length > 0 && $('body.single-post .fullscreen-header').length == 0) {
7833				//center the parallax heading
7834
7835				if($headerRemoveStickyness) {
7836
7837					$('#page-header-bg[data-parallax="1"] .span_6').css({ 
7838						'top' : (((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2)) +"px"
7839				    });
7840				    
7841				    //center parllax portfolio filters
7842				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
7843						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
7844				    });
7845
7846				} else {
7847					$('#page-header-bg[data-parallax="1"] .span_6').css({ 
7848						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+60)),
7849						'top' : (((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2)) +"px"
7850				    });
7851				    
7852				    //center parllax portfolio filters
7853				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
7854						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
7855						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
7856				    });
7857				}
7858			    
7859		  } else {
7860
7861		  		if($headerRemoveStickyness) {
7862			  		//center the parallax heading
7863				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
7864						'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
7865				    });
7866				    
7867				    //center parllax portfolio filters
7868				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
7869						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
7870				    });
7871				} else {
7872					//center the parallax heading
7873				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
7874						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+60)),
7875						'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
7876				    });
7877				    
7878				    //center parllax portfolio filters
7879				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
7880						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
7881						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
7882				    });
7883				}
7884		  }
7885	   }
7886	}
7887	
7888	else {
7889		//recalc
7890		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
7891		
7892		//center the heading
7893		var pageHeadingHeight = $('#page-header-bg .container > .row').height();
7894		$('#page-header-bg .container > .row').css('top', (pageHeaderHeight/2) - (pageHeadingHeight/2) + 5);
7895		
7896	}
7897
7898
7899	$('#page-header-bg .container > .row').css('visibility','visible');
7900}
7901
7902var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0; 
7903
7904if($('#page-header-bg').length > 0) { 
7905	setTimeout(function(){ pageHeader(); },$pt_timeout);
7906}
7907
7908
7909if($('#header-outer').attr('data-header-resize') == '' || $('#header-outer').attr('data-header-resize') == '0'){
7910	$('#page-header-wrap').css('margin-top','0');
7911}
7912
7913
7914function extractUrl(input) {
7915	return input.replace(/"/g,"").replace(/url\(|\)$/ig, "");
7916}
7917 
7918/***************** Parallax Page Headers ******************/
7919if($('#page-header-bg[data-parallax="1"]').length > 0) {
7920
7921	//fadeIn
7922
7923	var img = new Image();
7924	
7925	var imgX, imgY, aspectRatio;
7926	var diffX, diffY;
7927	var pageHeadingHeight = $('#page-header-bg .col.span_6').height();
7928	var pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
7929	var headerPadding2 = parseInt($('#header-outer').attr('data-padding'))*2;
7930	var wooCommerceHeader = ($('.demo_store').length > 0) ? 32 : 0 ;
7931	
7932	
7933	var $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
7934	
7935	if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) {    
7936		img.onload = function() {
7937		   pageHeaderInit(); 
7938		}
7939		
7940		img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
7941		
7942	} else {
7943		 pageHeaderInit();
7944	}
7945
7946	
7947	
7948	var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
7949
7950
7951	 if($('body[data-hhun="1"]').length > 0 && !$('#header-outer[data-remove-fixed="1"]').length > 0)  $('#header-outer').addClass('parallax-contained');
7952
7953	 window.addEventListener('scroll', function(){ 
7954        window.requestAnimationFrame(bindHeaderParallax);
7955    }, false);
7956
7957}
7958
7959					
7960function bindHeaderParallax(){
7961
7962	var $scrollTop = $(window).scrollTop();
7963	var pageHeadingHeight = $('#page-header-bg .col.span_6').height();
7964	
7965
7966
7967	if(!$('body').hasClass('mobile') && navigator.userAgent.match(/iPad/i) == null && $('body.material-ocm-open').length == 0 ){
7968
7969
7970		//material needs to set top for when effect wrap sets transform
7971		if(window.innerWidth > 1000) {
7972	        $('body.material:not("[data-header-format=\'left-header\']") #page-header-bg[data-parallax="1"]').css('top',$('#ajax-content-wrap').offset().top);
7973	    } else {
7974	        $('body.material:not("[data-header-format=\'left-header\']") #page-header-bg[data-
7974parallax="1"]').css('top','0');
7975	    }
7976
7977		var $multiplier1 =  ($('body[data-hhun="1"]').length > 0) ? 0.40: 0.2;
7978   	    var $multiplier2 = ($('body[data-hhun="1"]').length > 0) ? 0.09: 0.14;
7979   	    var $parallaxHeaderHUN = ($('#header-outer[data-transparency-option="1"]').length > 0) ? 0.49: 0.4;
7980
7981		//calc bg pos
7982		//$('#page-header-bg[data-parallax="1"]').css({'top': ((- $scrollTop / 5)+logoHeight+headerPadding+headerResizeOffExtra+extraHeight-extraDef+secondaryHeader)  + 'px' });
7983		if($('#page-header-bg.out-of-sight').length == 0) {
7984
7985			if($headerRemoveStickyness) {
7986				$('#page-header-bg[data-parallax="1"]').css({ 'transform': 'translateY('+ $scrollTop*-0.55 +'px)' });	
7987			} else {
7988				$('#page-header-bg[data-parallax="1"]').css({ 'transform': 'translateY('+ $scrollTop*-$multiplier1 +'px)' });
7989			}
7990
7991			var multipler = ($('body').hasClass('single')) ? 1 : 2;
7992			if(!$headerRemoveStickyness) {
7993				$('#page-header-bg[data-parallax="1"] .span_6,  #page-header-bg[data-parallax="1"][data-post-hs="default_minimal"] .author-section').css({ 
7994					'opacity' : 1-($scrollTop/(pageHeaderHeight-60))
7995				});
7996			}
7997			
7998			if($headerRemoveStickyness) {
7999				$('#page-header-bg[data-parallax="1"] .span_6, 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)' });
8000			} else {
8001				$('#page-header-bg[data-parallax="1"] .span_6, 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)' });
8002			}
8003			
8004			if($('#page-header-bg[data-parallax="1"] .span_6').css('opacity') == 0){
8005				$('#page-header-bg[data-parallax="1"] .span_6, #page-header-bg[data-parallax="1"] .portfolio-filters').hide();
8006			} else {
8007				$('#page-header-bg[data-parallax="1"] .span_6, #page-header-bg[data-parallax="1"] .portfolio-filters').show();
8008			}
8009
8010			if($('body[data-hhun="1"]').length > 0  && !$('#header-outer').hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) { 
8011	            $('#header-outer.parallax-contained').css({ 'transform': 'translateY('+$scrollTop*-$parallaxHeaderHUN+'px)' });
8012	        }
8013			
8014		
8015		}
8016		else if($('#page-header-bg.out-of-sight').length == 0) {
8017			//alt parallax effect
8018			var multipler = ($('body').hasClass('single')) ? 1 : 2;
8019			$('#page-header-wrap .nectar-particles .fade-out').css({ 
8020				'opacity' : 0+($scrollTop/(pageHeaderHeight+pageHeaderHeight*$multiplier))
8021			});
8022		}
8023
8024
8025		//hide elements to allow other parallax sections to work in webkit browsers
8026		if( ($scrollTop / (pageHeaderHeight + $('#header-space').height() + extraHeight)) > 1 ) {
8027			$('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility','hidden').hide().addClass('out-of-sight');
8028		}
8029		else {
8030		 	$('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility','visible').show().removeClass('out-of-sight');
8031
8032		 		//ensure header is centered
8033		 		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
8034				$('#page-header-bg .container > .row').css('top',0);
8035				var $divisionMultipler = ($('#header-outer[data-remove-border="true"]').length > 0 && $('#header-outer[data-format="centered-menu-under-logo"]').length == 0) ? 2 : 1;
8036				pageHeadingHeight = $('#page-header-bg .col.span_6').height();
8037
8038				if($('#header-outer[data-transparent-header="true"]').length > 0 && $('body.single-post .fullscreen-header').length == 0) {
8039					//center the parallax heading
8040				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
8041						'top' : (((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2)) +"px"
8042				    });
8043
8044			  	} else {
8045			  		//center the parallax heading
8046				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
8047						'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
8048				    });
8049			  	}
8050	    }
8051		
8052
8053	}
8054
8055
8056
8057}
8058
8059if($('#page-header-bg').length > 0) {
8060	var $initialImgCheckAscend = extractUrl($('#page-header-bg').css('background-image'));
8061	if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) {    
8062		   $('#page-header-bg').addClass('has-bg');
8063	}
8064}
8065
8066
8067function pageHeaderInit(){
8068
8069	 var wooCommerceHeader = ($('.demo_store').length > 0) ? 32 : 0 ;
8070	 var centeredNavAltSpace = ($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) ? $('header#top nav > .sf-menu').height() -20 : null;
8071	 //transparent
8072	  if($('#header-outer[data-transparent-header="true"]').length > 0) {	
8073	     $('#page-header-bg[data-parallax="1"]').css({'top': extraHeight+wooCommerceHeader });
8074	  } else {
8075
8076	  	 var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
8077		 var headerPadding = parseInt($('#header-outer').attr('data-padding'));
8078		 var headerPadding2 = parseInt($('#header-outer').attr('data-padding'));
8079		 var extraDef = 10;
8080		 var headerResize = ($('body').hasClass('pp-video-function')) ? '1' : $('#header-outer').attr('data-header-resize');
8081		 var headerResizeOffExtra = 0;
8082		 var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
8083		 var usingLogoImage = true;
8084	     var mediaElement = ($('.wp-video-shortcode').length > 0) ? 36 : 0;
8085	     var secondaryHeader = ($('#header-outer').attr('data-using-secondary') == '1') ? 32 : 0 ;
8086	  	 if($('body[data-header-resize="0"]').length == 0) $('#page-header-bg[data-parallax="1"]').css({'top': (logoHeight+headerPadding+centeredNavAltSpace+headerResizeOffExtra+extraHeight-extraDef+secondaryHeader+wooCommerceHeader)  + 'px' });
8087	  }
8088	  
8089	  //fade in header
8090	  if($('#ajax-content-wrap').length == 0 || !$('body').hasClass('ajax-loaded')){
8091	  	$('#page-header-bg[data-parallax="1"]').animate({ 'opacity' : 1},650,'easeInCubic');
8092	  } else if($('#ajax-content-wrap').length == 1) {
8093	  	$('#page-header-bg[data-parallax="1"]').css({ 'opacity' : 1});
8094	  }
8095
8096	  //$('#page-header-wrap').css({'height' : pageHeaderHeight});
8097	  
8098	  //verify smooth scorlling
8099	  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') } 
8100	  
8101
8102	  $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />');
8103}
8104
8105
8106
8107
8108function nectarPageHeader() {
8109
8110	if($('#page-header-bg').length > 0) {
8111		fullScreenHeaderInit();
8112		pageHeader();
8113	}
8114
8115
8116	if($('#page-header-bg[data-parallax="1"]').length > 0) {
8117
8118		var img = new Image();
8119		var $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
8120			
8121		if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) {    
8122			img.onload = function() {
8123			   pageHeaderInit();    
8124					
8125			}
8126			
8127			img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
8128			
8129		} else {
8130			 pageHeaderInit();
8131		}
8132
8133		//bindHeaderParallax();
8134		$('#page-header-bg[data-parallax="1"] .span_6').css({ 
8135			'opacity' : 1
8136		});
8137
8138		
8139
8140		if (window.addEventListener) {
8141			 window.addEventListener('scroll', function(){ 
8142	          requestAnimationFrame(bindHeaderParallax); 
8143	        }, false);
8144		}
8145
8146	} 
8147
8148	if($('#page-header-bg').length > 0) {
8149		var $initialImgCheckAscend = extractUrl($('#page-header-bg').css('background-image'));
8150		if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) {    
8151			   $('#page-header-bg').addClass('has-bg');
8152		}
8153	}
8154}
8155
8156if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
8157	window.onunload = function(){ nectarPageHeader(); };
8158}
8159
8160
8161/***************** header text effects *****************/
8162
8163// rotate in
8164function pageHeaderTextEffectInit() {
8165	$('#page-header-bg').each(function(){
8166		if($(this).attr('data-text-effect') == 'rotate_in') {
8167			var $topHeading = 'none';
8168
8169			if($(this).find('.span_6 h1').length > 0) {
8170				$topHeading = 'h1';
8171			} 
8172			//else if ($(this).find('.span_6 h2').length > 0) {
8173			//	$topHeading = 'h2';
8174			//}
8175
8176			if($topHeading != 'none') {
8177
8178				var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6';
8179
8180				$(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () {
8181			        return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, "");
8182			    }).wrap('<span class="wraped"></span>');
8183
8184			    $(this).find($selector).find('.wraped').each(function () {
8185
8186				    textNode = $(this);
8187
8188				    text = textNode.text().split(' ');
8189				    replace = '';
8190
8191				    $.each(text, function (index, value) {
8192				        if (value.replace(/\s+/, "")) {
8193				            replace += '<span class="wraped"><span>' + value + '</span></span> ';
8194				        }
8195				    });
8196				    textNode.replaceWith($(replace));
8197				    
8198				});
8199			}//make sure suitable heading was found
8200
8201		}//tilt
8202	});
8203	
8204}
8205function pageHeaderTextEffect() {
8206
8207	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) {
8208
8209		var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6';
8210
8211		$($selector).find('.wraped').each(function(i){
8212			$(this).find('span').delay(i*370).transition({ rotateX: '0', 'opacity' : 1, y: 0},400,'easeOutQuad');
8213		});
8214
8215		setTimeout(function(){
8216
8217			$($selector).find('.inner-wrap > *:not(.top-heading)').each(function(i){
8218				$(this).delay(i*370).transition({ rotateX: '0', 'opacity' : 1, y: 0 },650,'easeOutQuad');
8219			});
8220
8221			$('.scroll-down-wrap').removeClass('hidden');
8222
8223		}, $($selector).find('.wraped').length * 370);
8224	}
8225
8226}
8227var $effectTimeout = ($('#ajax-loading-screen').length > 0) ? 800 : 0;
8228pageHeaderTextEffectInit();
8229if($('#page-header-bg .nectar-video-wrap video').length == 0) setTimeout(pageHeaderTextEffect,$effectTimeout);
8230
8231
8232
8233
8234 //submenu fix
8235  if($('header#top nav > ul.sf-menu ul').length > 0) {
8236
8237  	var $midnightSubmenuTimeout;
8238  	$('body').on('mouseover','#header-outer .midnightHeader .sf-with-ul, #header-outer .midnightHeader .cart-menu',function(){
8239
8240  		if($(this).parents('.midnightHeader').offset().top - $(window).scrollTop() < 50){
8241  		
8242  			$(this).parents('.midnightHeader').css({'z-index': '9999'}).addClass('overflow');
8243  			$(this).parents('.midnightInner').css('overflow','visible');
8244  		}
8245  	});
8246  	$('body').on('mouseleave','#header-outer .midnightHeader',function(){
8247  		var $that = $(this);
8248  		clearTimeout($midnightSubmenuTimeout);
8249  		$midnightSubmenuTimeout = setTimeout(function(){
8250  			if(!$that.is(':hover')) {
8251  				$that.css({'z-index': 'auto'}).removeClass('overflow');
8252  				$that.find('.midnightInner').css('overflow','hidden');
8253  		
8254  			}
8255
8256  		},900);
8257  	});
8258  }
8259
8260  function midnightInit() {
8261
8262  	if( $('#header-outer[data-permanent-transparent="1"]').length > 0 && $('body[data-bg-header="true"]').length > 0 && $('body.material').length > 0) {
8263
8264  			//material perma trans
8265
8266  			////cache midnighgt compat divs
8267  			var $midnightCompatArr = [];
8268			$('div[data-midnight]').each(function(){
8269
8270				if($(this).attr('data-midnight') == 'light' || $(this).attr('data-midnight') == 'dark') {
8271					$midnightCompatArr.push($(this));
8272				}
8273
8274			});
8275
8276
8277			if($midnightCompatArr.length > 0) {
8278
8279				$.each($midnightCompatArr,function(k,v){
8280
8281						if(v.attr('data-midnight') == 'light' || v.attr('data-midnight') == 'dark') {
8282
8283							var $that = v;
8284							var waypoint = new Waypoint({
8285				 				element: $that,
8286					 			handler: function(direction) {
8287				
8288					 				if($('body.material-ocm-open').length > 0) return;
8289
8290									if(direction == 'down') {
8291										var $textColor = ($that.attr('data-midnight') == 'light') ? '' : 'dark-slide';
8292										$('#header-outer').removeClass('dark-slide').addClass($textColor);
8293								
8294									} else {
8295
8296										if(k-1 >= 0) { 
8297											var $prevMidItem = k-1;
8298										} else {
8299											var $prevMidItem = k;
8300										}
8301
8302										var $textColor = ($midnightCompatArr[$prevMidItem].attr('data-midnight') == 'light') ? '' : 'dark-slide';
8303										$('#header-outer').removeClass('dark-slide').addClass($textColor);
8304
8305									} 
8306
8307							
8308								},
8309								offset: $('#header-outer').height()
8310
8311							}); 
8312
8313						}
8314
8315				});
8316
8317			}
8318
8319		
8320
8321  	}
8322
8323  	if( $('#header-outer[data-permanent-transparent="1"]').length > 0 && $('body[data-bg-header="true"]').length > 0 && $('body.material').length == 0) {
8324  		 $('#header-outer').midnight();
8325
8326  	    //set width for left aligned menu
8327  		if($('#header-outer[data-format="menu-left-aligned"] #logo img:visible').length > 0) {
8328  			$('#header-outer #logo').css({'width':$('#header-outer #logo img:visible').width(), 'height': $('#header-outer #logo img:visible').height()});
8329  		}
8330
8331  		 //no menu
8332  		 if($('#header-outer[data-has-menu="false"]').length > 0 && $('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
8333  			 //fix the pointer events
8334  			 //var enableHandler = false;
8335
8336  			 var $buttonsOffset = ($('#social-in-menu').length > 0) ? $('#social-in-menu').position() : $('#header-outer header#top nav > ul.buttons').position();
8337  			 if($('#header-outer #logo img:visible').length > 0) {
8338  			 	var $logoOffset = $('#header-outer #logo img:visible').position();
8339  			 	var $logoOffsetTop = $('#header-outer #logo img:visible').position().top;
8340  			 	var $logoMargin = parseInt($('#header-outer #logo img:visible').css('margin-top'));
8341  			 	var $logoWidth = $('#header-outer #logo img:visible').width(); 
8342
8343  			 } else {
8344  			 	var $logoOffset = $('#header-outer .span_3 #logo:visible').offset();
8345  			 	var $logoOffsetTop = $('#header-outer .span_3 #logo:visible').offset().top - $(window).scrollTop();
8346  			 	var $logoMargin = parseInt($('#header-outer .span_3 #logo:visible').css('margin-top'));
8347  			 	var $logoWidth = $('#header-outer #logo').width();
8348  			 }
8349  			 var $bodyBorderSize = ($('.body-border-top').length > 0) ? $('.body-border-top').height() : 0;
8350
8351  			 var $containerMargin = parseInt($('#header-outer header > .container').css('padding-left'));
8352  			 var $headerOffset = $('#header-outer').position();
8353  			 //recalc offsets
8354  			 $(window).on('smartresize', function(){
8355  			 	if($('#header-outer #logo img').length > 0) {
8356  				 	$logoMargin = parseInt($('#header-outer #logo img:visible').css('margin-top'));
8357  				 	$logoOffset = $('#header-outer #logo img:visible').position();
8358  				 	$logoOffsetTop = $('#header-outer #logo img:visible').position().top;
8359  				 	$logoWidth = $('#header-outer #logo img:visible').width();
8360  				 } else {
8361  				 	$logoMargin = parseInt($('#header-outer .span_3 #logo:visible').css('margin-top'));
8362  				 	$logoOffset = $('#header-outer .span_3 #logo:visible').offset();
8363  				 	$logoOffsetTop = $('#header-outer .span_3 #logo:visible').offset().top - $(window).scrollTop();
8364  				 	$logoWidth = $('#header-outer #logo').width();
8365  				 }
8366  			 	$containerMargin = parseInt($('#header-outer header > .container').css('padding-left'));
8367  			    $buttonsOffset = ($('#social-in-menu').length > 0) ? $('#social-in-menu').position() : $('#header-outer header#top nav > ul.buttons').position();
8368  			    $headerOffset = $('#header-outer').position();
8369  			 });
8370
8371  			 $('body').mousemove(function(e){
8372  			 	if($('body.mobile').length == 0 && $('#header-outer header').length > 0) {
8373  			 	
8374  					 	//hover over buttons || logo check
8375  					 	if(e.clientX >= $buttonsOffset.left + $containerMargin && 
8376  					 	   e.clientY >= $buttonsOffset.top + $bodyBorderSize && 
8377  					 	   e.clientY <= $buttonsOffset.top + $headerOffset.top + $bodyBorderSize + $('#header-outer header#top nav > ul.buttons').height() ||
8378  					 	   e.clientX <= $logoOffset.left + $containerMargin + $logoWidth &&
8379  					 	   e.clientY >= $logoOffsetTop + $bodyBorderSize&& 
8380  					 	   e.clientY <= $logoOffsetTop + $logoMargin + $bodyBorderSize + $headerOffset.top + $('#header-outer #logo img:visible').height() ) {
8381  					 		$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
8382
8383  					 	} else {
8384  					 		$('.midnightHeader, #header-outer').addClass('no-pointer-events');
8385  					 	}
8386
8387  					
8388  				} else {
8389  					$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
8390  				}
8391  			 });
8392
8393  	
8394  		}
8395
8396  		//using menu
8397  		else if($('#header-outer[data-has-menu="true"]').length > 0) {
8398
8399  			 var $headerPos = $('header#top .container').position();
8400  			 var $headerOffset = $('header#top .container').offset();
8401  			 var $bodyBorderSize = ($('.body-border-top').length > 0) ? $('.body-border-top').height() : 0;
8402
8403  			 //recalc offsets
8404  			 $(window).on('smartresize', function(){
8405  			 	
8406  			    $headerPos = $('header#top .container').position();
8407  			    $headerOffset = $('header#top .container').offset();
8408
8409  			 });
8410
8411  			 $('body').mousemove(function(e){
8412  			 	if($('body.mobile').length == 0 && $('#header-outer header').length > 0) {
8413
8414  					 	//hover over buttons || logo check
8415  					 	if(e.clientX >= $headerOffset.left &&
8416  					 	   e.clientY >= $headerPos.top  + $bodyBorderSize && 
8417  					 	   e.clientY <= $('header#top .container .row').height() + $bodyBorderSize) {
8418  					 		$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
8419  					 	} else if($('li.sfHover').length == 0) {
8420  					 		$('.midnightHeader, #header-outer').addClass('no-pointer-events');
8421  					 	}
8422
8423  					
8424  				} else {
8425  					$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
8426  				}
8427  			 });
8428
8429  		}
8430  	}
8431  }
8432
8433
8434
8435//box roll
8436function getScrollbarWidth() {
8437    var outer = document.createElement("div");
8438    outer.style.visibility = "hidden";
8439    outer.style.width = "100px";
8440    outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
8441
8442    document.body.appendChild(outer);
8443
8444    var widthNoScroll = outer.offsetWidth;
8445    // force scrollbars
8446    outer.style.overflow = "scroll";
8447
8448    // add innerdiv
8449    var inner = document.createElement("div");
8450    inner.style.width = "100%";
8451    outer.appendChild(inner);        
8452
8453    var widthWithScroll = inner.offsetWidth;
8454
8455    // remove divs
8456    outer.parentNode.removeChild(outer);
8457
8458    return widthNoScroll - widthWithScroll;
8459}
8460
8461
8462function boxRollInit() {
8463	if($('.nectar-box-roll').length > 0) { 
8464
8465		$('body').attr('data-scrollbar-width',getScrollbarWidth());
8466
8467		$('body, html, #ajax-content-wrap, .container-wrap, .blurred-wrap').addClass('no-scroll');
8468		$('body,html').stop().animate({ scrollTop:0 },0);
8469		$('.container-wrap').css('opacity',0).addClass('no-transform-animation-bottom-out').addClass('bottomBoxOut');
8470		//keep loading icon centered if scrollbar is going away
8471		if($('.mobile').length == 0) $('#ajax-loading-screen .loading-icon > span').css({ 'left' : '-'+getScrollbarWidth()/2 +'px'});
8472
8473		//change content pos
8474		var $overlaid = $('#page-header-bg .overlaid-content').clone();
8475		var $scrollDownOverlaid = $('.scroll-down-wrap').clone();
8476		$('#page-header-bg').removeAttr('data-midnight');
8477		$('#page-header-bg .overlaid-content, #page-header-bg .scroll-down-wrap').remove();
8478		$('.nectar-box-roll').append($overlaid).attr('data-midnight','light');
8479		$('.overlaid-content').append($scrollDownOverlaid);
8480
8481		if($('.page-submenu[data-sticky="true"]').length > 0) {
8482			$('.container-wrap').addClass('no-trans');
8483		}
8484
8485		nectarBoxRollContentHeight();
8486		setTimeout(function() { pageLoadHash(); },700);
8487	} else {
8488		$('#ajax-content-wrap, .blurred-wrap').addClass('at-content');
8489		$('body, html, #ajax-content-wrap, .container-wrap, .blurred-wrap').removeClass('no-scroll');
8490		$('.container-wrap').css('opacity',1).removeClass('no-transform-animation-bottom-out').removeClass('bottomBoxOut').removeClass('bottomBoxIn');
8491		perspect = 'not-rolled';
8492	}
8493}
8494boxRollInit();
8495
8496function nectarBoxRollContentHeight() {
8497	/*if($('#header-outer[data-transparent-header="true"]').length == 0 && $('.mobile').length == 0) {
8498		$('.nectar-box-roll').css('top',$('#header-space').height());
8499	} else {
8500		$('.nectar-box-roll').css('top','0');
8501	}*/
8502	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').height();
8503
8504	if($('#header-outer[data-transparent-header="true"]').length == 0) {
8505		$('.nectar-box-roll .overlaid-content, .nectar-box-roll .canvas-bg, .container-wrap').css({'height':window.innerHeight - $headerNavSpace, 'min-height':window.innerHeight - $headerNavSpace });
8506		if($('.mobile').length == 0 && $('body[data-header-format="left-header"]').length == 0) { $('#ajax-content-wrap').css('margin-top',$headerNavSpace); $('#slide-out-widget-area.fullscreen').css('margin-top','-'+$headerNavSpace+'px'); }
8507		else $('#ajax-content-wrap, #slide-out-widget-area.fullscreen').css('margin-top','0');
8508	} else {
8509		$('.nectar-box-roll .overlaid-content, .nectar-box-roll .canvas-bg, .container-wrap').css('height',window.innerHeight);
8510	}
8511}
8512
8513if($('.nectar-box-roll').length > 0) $(window).on('resize',nectarBoxRollContentHeight);
8514
8515
8516var perspect = 'not-rolled';
8517var animating = 'false';
8518function boxRoll(e,d) {
8519	
8520	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').height();
8521
8522	if($('#slide-out-widget-area.open').length > 0) return false;
8523	if( $('.nectar-box-roll canvas').length > 0 && $('.nectar-box-roll canvas[data-loaded="true"]').length == 0) return false;
8524
8525	if(perspect == 'not-rolled' && animating == 'false' && d == -1) {
8526		perspect = 'rolled';
8527		animating = 'true';
8528		$('body').addClass('box-animating').addClass('box-perspective-rolled').addClass('box-rolling');
8529
8530		$('.nectar-box-roll #page-header-bg').removeClass('topBoxIn').addClass('topBoxOut').css('will-change','transform');
8531		
8532		$('.nectar-box-roll .overlaid-content').removeClass('topBoxIn2').removeClass('topBoxIn').addClass('topBoxOut2').css('will-change','transform');
8533		
8534		$('.container-wrap').removeClass('bottomBoxOut').addClass('bottomBoxIn').removeClass('no-transform-animation-bottom-out').addClass('nectar-box-roll-class').css('will-change','transform');
8535		if($('#header-outer[data-transparent-header="true"]').length == 0) {
8536			$('.container-wrap').css({'height':$(window).height() - $headerNavSpace, 'opacity': 1});
8537			$('#slide-out-widget-area.fullscreen').css('margin-top','0px');
8538		} else {
8539			$('.container-wrap').css({'height':$(window).height(), 'opacity': 1});
8540		}
8541		
8542
8543		$('.nectar-slider-wrap').css({'opacity':0});
8544
8545		updateRowRightPadding(d);
8546		pauseVideoBG();
8547
8548		//old browser workaround
8549		var timeout1 = 1220;
8550		var timeout2 = 1650;
8551		var timeout3 = 1700;
8552		var timeout4 = 1350;
8553		if( $('html.no-cssanimations').length > 0) {
8554			timeout1 = 1;
8555			timeout2 = 1;
8556			timeout3 = 1;
8557			timeout4 = 1;
8558		}
8559
8560		$('.container-wrap').css('padding-right',$('body').attr('data-scrollbar-width') + 'px');
8561		setTimeout(function(){
8562			$('#header-outer, #wpadminbar, .cart-outer .cart-menu, .midnightHeader .midnightInner').animate({'padding-right': $('body').attr('data-scrollbar-width')},250);
8563			$('.nectar-box-roll .canvas-bg').addClass('out-of-sight');
8564			if($('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent');
8565
8566			if($('body.mobile').length > 0) $('.nectar-box-roll').css({'z-index':'1'});
8567		},timeout1);
8568		setTimeout(function(){ 
8569			updateRowRightPadding(1);
8570			$('body,html,#ajax-content-wrap, .container-wrap, .blurred-wrap').removeClass('no-scroll'); 
8571			$('#ajax-content-wrap, .blurred-wrap').addClass('at-content');
8572			$('.container-wrap, #footer-outer').removeClass('bottomBoxIn').removeClass('nectar-box-roll-class').addClass('auto-height');
8573			$('#header-outer, #wpadminbar, .container-wrap, .cart-outer .cart-menu, .midnightHeader .midnightInner').stop().css('padding-right',0);
8574
8575			if( $smoothActive == 1 && $(window).width() > 690  && Modernizr.csstransforms3d && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){ 
8576				niceScrollInit();
8577			}
8578			
8579			$('.nectar-box-roll').css({'z-index':'-1000'}).transition({'y': '-200%'},0);
8580			$('.nectar-box-roll canvas').hide();
8581			$('body').removeClass('box-rolling');
8582			$('.nectar-slider-wrap').transition({'opacity':1},600,'easeOutCubic');
8583
8584			$('.nectar-box-roll #page-header-bg, .nectar-box-roll .overlaid-content, .container-wrap').css('will-change','auto');
8585			if($waypointsBound == false) waypoints();	
8586		},timeout2);
8587		
8588		//fadeIn
8589		setTimeout(function(){ 
8590			$('.container-wrap .main-content > .row > div > div[class*="col"]').css({'opacity':1});
8591		},timeout4);
8592
8593		setTimeout(function(){ 
8594					animating ='false'; 
8595					$('body').removeClass('box-animating');		
8596		},timeout3);
8597
8598		//header position when transparent nav was used
8599		if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length != 0) { 
8600			$('#ajax-content-wrap').transition({'margin-top':$('#header-outer').outerHeight(true) + $('#header-outer').offset().top},2000,'easeInOutQuad');
8601		}
8602		/*if($('#header-outer[data-transparent-header="true"]').length == 0 && $('.mobile').length == 0) {
8603			$('.nectar-box-roll').transition({'top': 0},2000,'easeInOutQuad');
8604		}*/
8605		
8606
8607		//remove header if not fixed
8608		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');
8609
8610	}
8611
8612	else if(perspect == 'rolled' && animating == 'false' && d == 1 && $(window).scrollTop() < 100) {
8613
8614		$('.container-wrap').removeClass('auto-height');
8615		if($('#header-outer[data-transparent-header="true"]').length == 0) {
8616			$('.container-wrap').css({'height':$(window).height() - $headerNavSpace, 'opacity': 1});
8617		} else {
8618			$('.container-wrap').css({'height':$(window).height(), 'opacity': 1});
8619		}
8620		
8621		$('#footer-outer').removeClass('auto-height');
8622		$('body').addClass('box-rolling');
8623
8624		perspect = 'not-rolled';
8625		animating = 'true';
8626		$('body').addClass('box-animating').addClass('box-perspective-not-rolled');
8627
8628		$('#header-outer, #wpadminbar, .container-wrap, .cart-outer .cart-menu, .midnightHeader .midnightInner').css('padding-right',$('body').attr('data-scrollbar-width') + 'px');
8629		$('.nectar-slider-wrap').transition({'opacity':0},600,'easeOutCubic');
8630		$('.container-wrap .main-content > .row > div > div[class*="col"]').stop(true).css({'opacity':0});
8631		setTimeout(function(){
8632			$('#header-outer, #wpadminbar, .cart-outer .cart-menu, .midnightHeader .midnightInner').animate({'padding-right': 0},250);
8633			$('.nectar-box-roll .canvas-bg').removeClass('out-of-sight');
8634			resizeVideoToCover();
8635			//header position when transparent nav was used
8636			if($('#header-outer[data-transparent-header="true"]').length != 0) { 
8637				$('#ajax-content-wrap').stop(true,true).transition({'margin-top':0},2000,'easeInOutCubic');
8638			} else {
8639				if($('.mobile').length == 0) $('#slide-out-widget-area.fullscreen').css('margin-top','-'+$headerNavSpace+'px');
8640			}
8641			//if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('.mobile').length == 0 ) $('.nectar-box-roll').transition({'top': $('#header-space').height() },2000,'easeInOutQuad');
8642			
8643		},30);
8644
8645		//old browser workaround
8646		var timeout1 = 1700;
8647		var timeout2 = 1600;
8648		var timeout3 = 1300;
8649		if( $('html.no-cssanimations').length > 0) {
8650			timeout1 = 1;
8651			timeout2 = 1;
8652			timeout3 = 1;
8653		}
8654
8655		if($('body.mobile').length > 0) {
8656			setTimeout(function(){
8657				$('.nectar-box-roll').css('z-index','1000');
8658			},timeout3);
8659		} else {
8660			$('.nectar-box-roll').css('z-index','1000');
8661		}
8662
8663		updateRowRightPadding(d);
8664		removeNiceScroll();
8665		$('.nectar-box-roll').transition({'y': '0'},0);
8666		$('.nectar-box-roll canvas').show();
8667		setTimeout(function(){ 
8668			updateRowRightPadding(1);
8669			animating ='false'; 
8670			$('body').removeClass('box-animating');
8671			$('#page-header-bg').removeClass('topBoxIn');
8672			$('.overlaid-content').removeClass('topBoxIn2');	
8673			$('body').removeClass('box-rolling');
8674			resumeVideoBG();
8675			$('.nectar-box-roll #page-header-bg, .nectar-box-roll .overlaid-content, .container-wrap').css('will-change','auto');
8676		},timeout1);
8677
8678		setTimeout(function(){
8679			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');
8680		},timeout2);
8681
8682		$('body,html,#ajax-content-wrap, .container-wrap, .blurred-wrap').addClass('no-scroll');
8683		$('#ajax-content-wrap, .blurred-wrap').removeClass('at-content');
8684		$('.container-wrap').addClass('nectar-box-roll-class');
8685		$('.nectar-box-roll #page-header-bg').removeClass('topBoxOut').addClass('topBoxIn').css('will-change','transform');
8686		
8687		$('.container-wrap').removeClass('bottomBoxIn').addClass('bottomBoxOut').css('will-change','transform');
8688
8689		if($('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').addClass('transparent');
8690
8691		$('.nectar-box-roll .overlaid-content').removeClass('topBoxOut2').removeClass('topBoxOut').addClass('topBoxIn2').css('will-change','transform');
8692	
8693		if($('#header-outer[data-header-resize="1"]').length > 0) { bigNav(); }
8694
8695		$('.nectar-box-roll .trigger-scroll-down').removeClass('hovered');
8696	}
8697
8698	
8699}
8700
8701function boxScrollEvent(event, delta) {
8702	if($('#slide-out-widget-area.open.fullscreen').length > 0 || $('.material-ocm-open').length > 0 ||  $('#search-outer.material-open').length > 0 ) return false;
8703	boxRoll(event,delta);
8704}
8705
8706function boxRollMouseWheelInit() {
8707	if($('.nectar-box-roll').length > 0) {
8708		$('body').on("mousewheel", boxScrollEvent);
8709	} else {
8710		$('body').off("mousewheel", boxScrollEvent);
8711	}
8712}
8713
8714boxRollMouseWheelInit();
8715
8716$('body').on('click','.nectar-box-roll .section-down-arrow',function(){
8717	boxRoll(null,-1);
8718	$(this).addClass('hovered');
8719	setTimeout(function(){ $('.nectar-box-roll .section-down-arrow').removeClass('hovered'); },2000);
8720	return false;
8721});
8722
8723
8724
8725function updateRowRightPadding(d){
8726	$('.wpb_row.full-width-section').each(function(){
8727		if($(this).hasClass('extraPadding') && d == 1) {
8728			$(this).css('padding-right',parseInt($(this).css('padding-right')) - parseInt($('body').attr('data-scrollbar-width')) + 'px' ).removeClass('extraPadding');
8729		} else {
8730			$(this).css('padding-right',parseInt($('body').attr('data-scrollbar-width')) + parseInt($(this).css('padding-right')) + 'px' ).addClass('extraPadding');
8731		}	
8732	});
8733	$('.wpb_row.full-width-content').each(function(){
8734		if($(this).find('.row-bg.using-image').length == 0) {
8735			if($(this).hasClass('extraPadding') && d == 1) {
8736				$(this).find('.row-bg').css('width',parseInt($(this).width()) - parseInt($('body').attr('data-scrollbar-width')) + 'px' ).removeClass('extraPadding');
8737			} else {
8738				$(this).find('.row-bg').css('width',parseInt($('body').attr('data-scrollbar-width')) + $(this).width() + 'px' ).addClass('extraPadding');
8739			}	
8740		}
8741	});
8742}
8743
8744function pauseVideoBG() {
8745	if($('.nectar-box-roll video').length > 0) $('.nectar-box-roll video')[0].pause(); 
8746}
8747function resumeVideoBG() {
8748	if($('.nectar-box-roll video').length > 0) $('.nectar-box-roll video')[0].play(); 
8749}
8750
8751//touch 
8752if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && $('.nectar-box-roll').length > 0) {
8753	$('body').swipe({
8754		tap: function(event,target) {
8755			if($(target).parents('.nectar-flip-box').length > 0)
8756				$(target).parents('.nectar-flip-box').trigger('click');
8757			if($(target).is('.nectar-flip-box'))
8758				$(target).trigger('click');
8759		},
8760		swipeStatus: function(event, phase, direction, distance, duration, fingers) {
8761			if($('#slide-out-widget-area.open').length > 0) return false;
8762			if(direction == 'up') {
8763				boxRoll(null,-1);
8764				if($('#ajax-content-wrap.no-scroll').length == 0) $('body').swipe("option", "allowPageScroll", 'vertical');
8765			} else if(direction == "down" && $(window).scrollTop() == 0) {
8766				boxRoll(null,1);
8767				$('body').swipe("option", "allowPageScroll", 'auto');
8768			}
8769		}
8770	});
8771
8772}
8773
8774function removeNiceScroll() {
8775		if($().niceScroll && $("html").getNiceScroll()){
8776			var nice = $("html").getNiceScroll();
8777			nice.stop();
8778			
8779			$('html').removeClass('no-overflow-y');
8780			$('.nicescroll-rails').hide();
8781			if($('#boxed').length == 0){
8782				$('body, body #header-outer, body #header-secondary-outer, body #search-outer, .midnightHeader .midnightInner').css('padding-right','0px');
8783			} else if($('body[data-ext-responsive="true"]').length == 0 ) {
8784				$('body').css('padding-right','0px');
8785			}
8786
8787			$('body').attr('data-smooth-scrolling','0');
8788		}
8789	}
8790//called after box roll
8791$waypointsBound = false;
8792function waypoints() {
8793	colAndImgAnimations(); 
8794	progressBars(); 
8795	dividers();
8796	iconList();
8797	animated_titles();
8798	imageWithHotspots();
8799	clientsFadeIn(); 
8800	splitLineHeadings();
8801	svgAnimations(); 
8802	milestoneInit();
8803	nectar_fancy_ul_init();
8804	owl_carousel_animate();
8805	headerRowColorInheritInit();
8806	morphingOutlines(); 
8807	portfolioLoadIn();
8808	animatedColBorders();
8809	foodMenuItems();
8810	vcWaypoints();
8811	$waypointsBound = true;
8812}
8813
8814
8815
8816/***************** WooCommerce Cart *****************/
8817var timeout;
8818var productToAdd;
8819var $dropdownStyle = ($('body[data-dropdown-style="minimal"]').length > 0)  ? 'minimal' : 'default';
8820//notification
8821$('body').on('click','.product .add_to_cart_button', function(){
8822
8823	var $productHeading = ($(this).parents('li').find('h2').length > 0) ? 'h2' : 'h3';
8824
8825	productToAdd = $(this).parents('li').find($productHeading).text();
8826	$('#header-outer .cart-notification span.item-name').html(productToAdd);
8827
8828	//if($('.cart-menu-wrap').hasClass('first-load')) $('.cart-menu-wrap').removeClass('first-load').addClass('static');
8829});
8830
8831//notification hover
8832$('body').on('mouseenter','#header-outer .cart-notification',function(){
8833	if($dropdownStyle == 'minimal') {
8834		$(this).hide();
8835		$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).show();
8836		$('#header-outer .cart_list').stop(true,true).show();
8837	} else {
8838		$(this).fadeOut(400);
8839		$('#header-outer .widget_shopping_cart').stop(true,true).fadeIn(300);
8840		$('#header-outer .cart_list').stop(true,true).fadeIn(300);
8841	}
8842	
8843	clearTimeout(timeout);
8844});
8845
8846//cart dropdown
8847var $headerCartSelector = ($('body.material').length > 0) ? '#header-outer .nectar-woo-cart' : '#header-outer  div.cart-outer';
8848
8849$($headerCartSelector).hoverIntent(function(){
8850
8851	if($dropdownStyle == 'minimal') { 
8852		$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).show()
8853		$('#header-outer .cart_list').stop(true,true).show();
8854		clearTimeout(timeout);
8855		$('#header-outer .cart-notification').hide();
8856	} else {
8857		$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).fadeIn(300);
8858		$('#header-outer .cart_list').stop(true,true).fadeIn(300);
8859		clearTimeout(timeout);
8860		$('#header-outer .cart-notification').fadeOut(300);
8861	}
8862	
8863});
8864
8865
8866$('body').on('mouseleave',$headerCartSelector,function(){
8867	var $that = $(this);
8868	setTimeout(function(){
8869		if(!$that.is(':hover')){
8870			$('#header-outer .widget_shopping_cart').removeClass('open').stop(true,true).fadeOut(300);
8871			$('#header-outer .cart_list').stop(true,true).fadeOut(300);
8872		}
8873	},100);
8874});
8875
8876if($('#header-outer[data-cart="false"]').length == 0) {
8877	$('body').on('added_to_cart', shopping_cart_dropdown_show);
8878	$('body').on('added_to_cart', shopping_cart_dropdown);
8879}
8880
8881function shopping_cart_dropdown() {
8882		
8883		if(!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 ) {
8884			$('.cart-menu-wrap').addClass('has_products');
8885			$('header#top nav > ul, #search-outer #search #close a, header#top .span_9 >.slide-out-widget-area-toggle').addClass('product_added');
8886
8887			if(!$('.cart-menu-wrap').hasClass('static')) $('.cart-menu-wrap, #mobile-cart-link').addClass('first-load');
8888
8889			//nectar slider nav directional effect
8890			if($('#header-outer').hasClass('directional-nav-effect') && $('#header-outer .cart-icon-wrap .dark').length == 0 && $('body.ascend').length > 0){
8891				$('#header-outer .cart-outer .cart-icon-wrap').each(function(){
8892                    $(this).find('> i, > span.light, > span.dark, > span.original').remove();
8893                    $(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>');
8894                	$(this).find('.original').attr('data-w',$(this).find('span.original').width()+1);
8895                });
8896			}
8897		}
8898
8899}
8900
8901
8902function shopping_cart_dropdown_show(e) {
8903		
8904		clearTimeout(timeout);
8905		
8906		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' ) {
8907			//before cart has slide in
8908			if(!$('#header-outer .cart-menu-wrap').hasClass('has_products')) {
8909				setTimeout(function(){ $('#header-outer .cart-notification').fadeIn(400); },400);
8910			}
8911			else if(!$('#header-outer .cart-notification').is(':visible')) {
8912				$('#header-outer .cart-notification').fadeIn(400);
8913			} else {
8914				$('#header-outer .cart-notification').show();
8915			}
8916			timeout = setTimeout(hideCart,2700);
8917
8918			$('.cart-menu a, .widget_shopping_cart a').addClass('no-ajaxy');
8919		}
8920}
8921
8922function hideCart() {
8923	$('#header-outer .cart-notification').stop(true,true).fadeOut();
8924}
8925
8926function checkForWooItems(){ 
8927	var checkForCartItems = setInterval(shopping_cart_dropdown,250);
8928	setTimeout(function(){ clearInterval(checkForCartItems); },4500);
8929}
8930if($('#header-outer[data-cart="false"]').length == 0) {
8931	checkForWooItems();
8932}
8933
8934var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
8935var secondaryHeader = ($('#header-outer').attr('data-using-secondary') == '1') ? 32 : 0 ;
8936function searchFieldCenter(){
8937	var $headerHeightSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
8938	$('#search-outer').css('top', $headerHeightSpace + extraHeight + secondaryHeader);
8939	$('#search-outer > #search #search-box').css('top',($(window).height()/2) - ($('#search-outer > #search input').height()/2) - $headerHeightSpace );
8940}
8941
8942
8943
8944//text on hover effect
8945$('body').on('mouseover','.text_on_hover .product-wrap',function(){
8946	$(this).parent().addClass('hovered');
8947	//if($(this).find('.star-rating span').length > 0) $(this).find('.star-rating span').stop().animate({ width: $(this).find('.star-rating span').attr('data-width') },400,'easeOutCirc');
8948});
8949$('body').on('mouseover','.text_on_hover > a:first-child',function(){
8950	$(this).parent().addClass('hovered');
8951});
8952
8953$('body').on('mouseout','.text_on_hover .product-wrap',function(){
8954	$(this).parent().removeClass('hovered');
8955	//if($(this).find('.star-rating span').length > 0) $(this).find('.star-rating span').stop().animate({ width: $(this).find('.star-rating span').attr('data-width') - 40 },500);
8956});
8957$('body').on('mouseout','.text_on_hover > a:first-child',function(){
8958	$(this).parent().removeClass('hovered');
8959});
8960
8961
8962//material/fancy parallax hover effect zindex
8963if($('.material.product').length > 0 || $('.nectar-fancy-box[data-style="parallax_hover"]').length > 0){
8964
8965	$productZindex = 101;
8966	$('body').on('mouseenter','.material.product, .nectar-fancy-box[data-style="parallax_hover"]',function(){
8967		
8968		$productZindex++;
8969
8970		$(this).css('z-index',$productZindex+1);
8971		
8972	});
8973	$('body').on('mouseleave','.material.product, .nectar-fancy-box[data-style="parallax_hover"]',function(){
8974		
8975		var $that = $(this);
8976		setTimeout(function(){ if(!$that.is(':hover')) $that.css('z-index',100); },280);
8977	});
8978
8979	//reset to stop zindex from getting too high
8980	setInterval(function(){ 
8981		if($('.nectar-fancy-box[data-style="parallax_hover"]:hover').length > 0) {
8982			 return;
8983		}
8984		$('.material.product:not(:hover), .nectar-fancy-box[data-style="parallax_hover"]:not(:hover)').css('z-index',100);
8985		$productZindex = 101; 
8986	},10000);
8987
8988}
8989
8990//mobile widget filters
8991$('body').on('click','#sidebar .widget.woocommerce:not(.widget_price_filter) h4',function(){
8992	if($(window).width() < 1000) {
8993		$(this).parent().find('> ul').slideToggle();
8994		$(this).parent().toggleClass('open-filter');
8995	}
8996});
8997
8998	//slide in cart
8999	$('body').on('mouseenter','#header-outer [data-cart-style="slide_in"] .cart-menu-wrap',openRightCart);
9000
9001	function openRightCart() {
9002
9003		if($('.nectar-slide-in-cart ul.cart_list li:not(.empty)').length > 0) {
9004			$('.nectar-slide-in-cart').addClass('open');
9005
9006			$(window).on('mousemove.rightCartOffsetCheck',closeCartCheck);
9007		}
9008	}
9009
9010	function closeCartCheck(e) {
9011		var $windowWidth = $(window).width();
9012		if(e.clientX < $windowWidth - 370 - $bodyBorderWidth) {
9013
9014			$(window).off('mousemove.rightCartOffsetCheck',closeNavCheck);
9015
9016			$('.nectar-slide-in-cart').removeClass('open');
9017
9018		}
9019
9020	}
9021
9022
9023
9024
9025
9026/***************** Search ******************/
9027	var $placeholder = $('#search input[type=text]').attr('data-placeholder');
9028	var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
9029	
9030
9031	if($('body').hasClass('material') && $('#header-outer .bg-color-stripe').length == 0) {
9032		$('#header-outer').append('<div class="bg-color-stripe" />');
9033	} 
9034
9035	////search box event
9036	$('body').on('click', '#search-btn a', function(){ return false; });
9037	$('body').on('mouseup', '#search-btn a:not(.inactive), #header-outer .mobile-search', function(){
9038
9039		if($(this).hasClass('open-search')) { return false; } 
9040
9041
9042		if($('body').hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0 ){ 
9043			$('#search-outer > #search form, #search-outer #search .span_12 span').css('opacity',0);
9044			$('#search-outer > #search form').css('bottom','10px');
9045			$('#search-outer #search .span_12 span').css('top','10px');
9046			$('#search-outer').show();
9047			$('#search-outer').stop().transition({scale: '1,0', 'opacity': 1},0).transition({ scale: '1,1'},400,'easeInOutCubic');
9048
9049			$('#search-outer > #search form').delay(400).animate({'opacity':1, 'bottom':0},'easeOutCirc');
9050			$('#search-outer #search .span_12 span').delay(470).animate({'opacity':1, 'top':0},'easeOutCirc');
9051			
9052		} else if( !$('body').hasClass('material') ) {
9053			$('#search-outer').stop(true).fadeIn(600,'easeOutExpo');
9054		} else {
9055
9056			/*material*/
9057			$('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition',''); //remove element.tyle of no transition in case it was removed from smallNav
9058
9059			$('#search-outer').addClass('material-open');
9060			$('#ajax-content-wrap').addClass('material-open');
9061			$('#header-outer').addClass('material-search-open');
9062			$('#fp-nav').addClass('material-ocm-open');
9063
9064
9065		}
9066
9067
9068		if($('body[data-header-format="left-header"]').length == 0) {
9069			$('body.original #search-outer > #search input[type="text"]').css({
9070				'top' : $('#search-outer').height()/2 - $('#search-outer > #search input[type="text"]').height()/2
9071			});
9072		}
9073		
9074		setTimeout(function(){
9075
9076			$('#search input[type=text]').focus();
9077			
9078			if($('#search input[type=text]').attr('value') == $placeholder){
9079				$('#search input[type=text]').setCursorPosition(0);	
9080			}
9081
9082		},300);
9083
9084		//ascend
9085		if($('body').hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0){ 
9086			searchFieldCenter();
9087		}
9088
9089		$(this).toggleClass('open-search');
9090
9091		//close slide out widget area
9092		$('.slide-out-widget-area-toggle a:not(#toggle-nav).open:not(.animating)').trigger('click');
9093
9094		return false;
9095	});
9096	
9097	$('body:not(.material)').on('keydown','#search input[type=text]',function(){
9098		if($(this).attr('value') == $placeholder){
9099			$(this).attr('value', '');
9100		}
9101	});
9102	
9103	$('body:not(.material)').on('keyup','#search input[type=text]',function(){
9104		if($(this).attr('value') == ''){
9105			$(this).attr('value', $placeholder);
9106			$(this).setCursorPosition(0);
9107		}
9108	});
9109	
9110	
9111	////close search btn event
9112	$('body').on('click','#close',function(){
9113		closeSearch();
9114		$('#search-btn a, #header-outer .mobile-search').removeClass('open-search');
9115		return false;
9116	});
9117
9118	//close material when clicking off the search
9119	$('body.material').on('click', '#ajax-content-wrap', function(e){
9120		if (e.originalEvent !== undefined) {
9121			closeSearch();
9122			$('#search-btn a, #header-outer .mobile-search').removeClass('open-search');
9123		}
9124	});
9125
9126	//material gets esc
9127	if($('body.material').length > 0) {
9128		$(document).keyup(function(e) {
9129
9130	     if (e.keyCode == 27) { 
9131	     	closeSearch();  
9132	     	$('#search-btn a').removeClass('open-search'); 
9133
9134	     	//close ocm material
9135	     	if($('.ocm-effect-wrap.material-ocm-open').length > 0) {
9136	     		$('.slide-out-widget-area-toggle.material-open a').trigger('click');
9137	     	}
9138	     }
9139
9140		});
9141	}
9142
9143	//if user clicks away from the search close it
9144	$('body:not(.material)').on('blur','#search-box input[type=text]',function(e){
9145		closeSearch();
9146		$('#search-btn a, #header-outer .mobile-search').removeClass('open-search');
9147	});
9148
9149	
9150	function closeSearch(){
9151		if($('body').hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0){ 
9152			$('#search-outer').stop().transition({'opacity' :0},300,'easeOutCubic');
9153			$('#search-btn a').addClass('inactive');
9154			setTimeout(function(){ $('#search-outer').hide(); $('#search-btn a').removeClass('inactive'); },300);
9155		} else if($('body.material').length == 0) {
9156			$('#search-outer').stop(true).fadeOut(450,'easeOutExpo');
9157		}
9158
9159		if($('body').hasClass('material')) {
9160			$('#ajax-content-wrap').removeClass('material-open');
9161			$('#header-outer').removeClass('material-search-open');
9162			$('#search-outer').removeClass('material-open');
9163			$('#fp-nav').removeClass('material-ocm-open');
9164		}
9165	}
9166	
9167	
9168	//mobile search
9169	$('body').on('click', '#mobile-menu #mobile-search .container a#show-search',function(){
9170		$('#mobile-menu .container > ul').slideUp(500);
9171		return false;
9172	});
9173	
9174/***************** Nav ******************/
9175
9176	function centeredLogoMargins() {
9177
9178		if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $(window).width() > 1000) {
9179			$midnightSelector = ($('#header-outer .midnightHeader').length > 0) ? '> .midnightHeader:first-child' : '';
9180			var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] '+$midnightSelector+' nav > .sf-menu > li').length;
9181			if($('#header-outer #social-in-menu').length > 0) $navItemLength--;
9182
9183			$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());
9184
9185			$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'));
9186			
9187			if($extraMenuSpace > 30) {
9188				$extraMenuSpace += 45;
9189			} else if($extraMenuSpace > 20) {
9190				$extraMenuSpace += 40;
9191			} else {
9192				$extraMenuSpace += 30;
9193			}
9194
9195			$('#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');
9196			$leftMenuWidth = 0;
9197			$rightMenuWidth = 0;
9198			$('#header-outer[data-format="centered-logo-between-menu"] '+$midnightSelector+' nav > .sf-menu > li:not(#social-in-menu)').each(function(i){
9199				if(i+1 <= Math.floor($navItemLength/2)) {
9200					$leftMenuWidth += $(this).width();
9201				} else {
9202					$rightMenuWidth += $(this).width();
9203				}
9204
9205			});
9206
9207			$menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth);
9208
9209			if($leftMenuWidth > $rightMenuWidth) 
9210				$('#header-outer .row > .col.span_9').css('padding-right',$menuDiff);
9211			else 
9212				$('#header-outer .row > .col.span_9').css('padding-left',$menuDiff);
9213
9214			$('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility','visible');
9215		}
9216	}
9217	
9218	var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
9219	var headerPadding = parseInt($('#header-outer').attr('data-padding'));
9220	var usingLogoImage = $('#header-outer').attr('data-using-logo');
9221	
9222	if( isNaN(headerPadding) || headerPadding.length == 0 ) { headerPadding = 28; }
9223	if( isNaN(logoHeight) || usingLogoImage.length == 0 ) { usingLogoImage = false; logoHeight = 30;}
9224	
9225	if($('header#top nav > ul li#search-btn a').length > 0) {
9226		$searchBtnHeight = $('header#top nav > ul li#search-btn a').height();
9227	} else {
9228		$searchBtnHeight = 24;
9229	}
9230
9231	//inital calculations
9232	function headerInit() {
9233		
9234		if($('#header-outer[data-format="left-header"]').length > 0) return;
9235
9236
9237		if($('body.material').length == 0) {
9238
9239			$('#header-outer #logo img').css({
9240				'height' : logoHeight,				
9241			});	
9242
9243			$('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({
9244				'padding-top' : headerPadding
9245			});	
9246			
9247			if($('body.mobile').length == 0) {
9248				$('header#top nav > ul > li:not(#social-in-menu) > a').css({
9249					'padding-bottom' : Math.floor( ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding),
9250					'padding-top' : Math.floor( (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2))
9251				});	
9252
9253				$('header#top nav > ul > li#social-in-menu > a').css({
9254					'margin-bottom' : Math.floor( ((logoHeight/2) - ($('header#top nav > ul > li#social-in-menu > a i').height()/2)) + headerPadding),
9255					'margin-top' : Math.floor( (logoHeight/2) - ($('header#top nav > ul > li#social-in-menu > a i').height()/2))
9256				});	
9257			}
9258			
9259			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
9260				$('#header-outer .cart-menu').css({  
9261					'padding-bottom' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding),
9262					'padding-top' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding)
9263				});	
9264			} 
9265			
9266			
9267			$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').css({
9268				'padding-bottom' : (logoHeight/2) - ($searchBtnHeight/2),
9269				'padding-top' : (logoHeight/2) - ($searchBtnHeight/2)
9270			});	
9271			
9272
9273			
9274			if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
9275				$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').css({
9276					'padding-top': 0,
9277					'padding-bottom': 0
9278				});
9279
9280				$('header#top nav > ul.buttons').css({
9281					'margin-top' : - headerPadding,
9282					'height' : Math.floor(logoHeight + headerPadding*2) -1
9283				});
9284
9285				$('header#top nav > ul li#search-btn a, header#top nav > ul li.slide-out-widget-area-toggle a').css({
9286					'visibility' : 'visible',
9287					'padding-top': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding),
9288					'padding-bottom': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding)
9289				});
9290			}
9291			
9292			$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').css({
9293				'top' : $('header#top nav > ul.sf-menu > li > a').outerHeight() 
9294			});	
9295			
9296			
9297			setTimeout(function(){ 
9298				$('body:not(.ascend):not(.material) #search-outer #search-box .ui-autocomplete').css({
9299					'top': parseInt($('#header-outer').outerHeight())+'px'
9300				}); 
9301			},1000);
9302			
9303			$('body:not(.ascend):not(.material) #search-outer #search-box .ui-autocomplete').css({
9304				'top': parseInt($('#header-outer').outerHeight())+'px'
9305			});
9306
9307		}//not material skin
9308
9309		//header space
9310		if($('.nectar-parallax-scene.first-section').length == 0) {
9311
9312			if($('#header-outer').attr('data-using-secondary') == '1'){
9313				if($('#header-outer[data-mobile-fixed="false"]').length > 0  || $('body.mobile').length == 0 ) {
9314					$('#header-space').css('height', parseInt($('#header-outer').outerHeight()) + $('#header-secondary-outer').height());
9315					
9316				} else {
9317					$('#header-space').css('height', parseInt($('#header-outer').outerHeight()));
9318					
9319				}
9320				
9321			} else {
9322
9323				$('#header-space').css('height', $('#header-outer').outerHeight() );
9324			} 
9325		}
9326		
9327		$('#header-outer .container, #header-outer .cart-menu').css('visibility','visible');
9328		
9329		centeredLogoMargins();
9330
9331		if(usingLogoImage && $('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $('header#top #logo img:first-child[src]').length > 0) {
9332			
9333			//fadein img on load
9334			var tempLogoImg = new Image();
9335			tempLogoImg.src = $('header#top #logo img:first-child').attr('src');
9336
9337		    tempLogoImg.onload = function() {
9338		       centeredLogoMargins();
9339		    };
9340			
9341		}
9342
9343		if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
9344			$('body:not(.ascend):not(.material) #search-outer, #search .container').css({
9345				'height' : logoHeight + headerPadding*2
9346			});	
9347			
9348			$('body:not(.ascend):not(.material) #search-outer > #search input[type="text"]').css({
9349				'font-size'  : 43,
9350				'height' : '59px',
9351				'top' : ((logoHeight + headerPadding*2)/2) - $('#search-outer > #search input[type="text"]').height()/2
9352			});
9353			
9354			$('body:not(.ascend):not(.material) #search-outer > #search #close a').css({
9355				'top' : ((logoHeight + headerPadding*2)/2) - 8
9356			});	
9357		} else {
9358			$('body:not(.ascend):not(.material) #search-outer, #search .container').css({
9359				'height' : logoHeight + headerPadding*2 + logoHeight + 17
9360			});	
9361			
9362			$('body:not(.ascend):not(.material) #search-outer > #search input[type="text"]').css({
9363				'font-size'  : 43,
9364				'height' : '59px',
9365				'top' : ((logoHeight + headerPadding*2)/2) - ($('#search-outer > #search input[type="text"]').height()/2) + logoHeight/2 + 17
9366			});
9367			
9368			$('body:not(.ascend):not(.material) #search-outer > #search #close a').css({
9369				'top' : ((logoHeight + headerPadding*2)/2) - 8 + logoHeight/2 + 17
9370			});	
9371		}
9372		
9373		//if no image is being used
9374		//if(usingLogoImage == false) $('header#top #logo').addClass('no-image');
9375		
9376	}
9377	
9378	//one last check to make sure the header space is correct (only if the user hasn't scrolled yet)
9379	$(window).load(function(){
9380		if($(window).scrollTop() == 0 ) headerSpace();
9381	});
9382	
9383	
9384	//is header resize on scroll enabled?
9385	var headerResize = $('#header-outer').attr('data-header-resize');
9386	var headerHideUntilNeeded = $('body').attr('data-hhun');
9387
9388	//transparent fix
9389
9390	if($('#header-outer[data-remove-fixed="1"]').length == 0) {
9391		if($(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) $('#header-outer').removeClass('transparent');
9392	}
9393
9394	if( headerResize == 1 && headerHideUntilNeeded != '1'){
9395		
9396		headerInit();
9397
9398		$(window).off('scroll.headerResizeEffect');
9399
9400		if($('#nectar_fullscreen_rows').length == 0) {
9401			$(window).on('scroll.headerResizeEffect',smallNav);
9402		}
9403		else if($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) ) {
9404			$(window).on('scroll.headerResizeEffect',smallNav);
9405		}
9406
9407	} else if(headerHideUntilNeeded != '1') {
9408		headerInit();
9409		$(window).off('scroll.headerResizeEffectOpaque');
9410		$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
9411		
9412	} else if(headerHideUntilNeeded == '1') {
9413
9414		headerInit();
9415
9416		if($('.nectar-box-roll').length > 0) $('#header-outer').addClass('at-top-before-box');
9417
9418		var previousScroll = 0, // previous scroll position
9419        menuOffset = $('#header-space').height()*2, // height of menu (once scroll passed it, menu is hidden)
9420        detachPoint = ($('body.mobile').length > 0) ? 150 : 600, // point of detach (after scroll passed it, menu is fixed)
9421        hideShowOffset = 6; // scrolling value after which triggers hide/show menu
9422
9423	    // on scroll hide/show menu
9424	    function hhunCalcs(e) {
9425
9426	     //stop scrolling while animated anchors
9427	     if($('body.animated-scrolling').length > 0 && $('#header-outer.detached').length > 0) return false;
9428
9429	     //stop when material ocm or material search is open
9430	     if($('body.material-ocm-open').length > 0 || $('#search-outer.material-open').length > 0) { return false; }
9431
9432	     //stop on mobile if not using sticky option
9433	      if($('#header-outer[data-mobile-fixed="false"]').length > 0 && $('body.mobile').length > 0) {  $('#header-outer').removeClass('detached'); return false; }
9434
9435	      var currentScroll = $(this).scrollTop(), // gets current scroll position
9436	            scrollDifference = Math.abs(currentScroll - previousScroll); // calculates how fast user is scrolling
9437
9438	      if (!$('#header-outer').hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) {
9439	       
9440	        // if scrolled past menu
9441	        if (currentScroll > menuOffset) {
9442	          // if scrolled past detach point add class to fix menu
9443	          if (currentScroll > detachPoint) {
9444	            if (!$('#header-outer').hasClass('detached'))
9445	              $('#header-outer').addClass('detached').removeClass('parallax-contained');
9446	          	   $('#header-outer').removeClass('no-transition');	
9447
9448
9449	          	  if($('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent');
9450	          }
9451
9452	          // if scrolling faster than hideShowOffset hide/show menu
9453	          if (scrollDifference >= hideShowOffset) {
9454	            if (currentScroll > previousScroll) {
9455	              // scrolling down; hide menu
9456	              if (!$('#header-outer').hasClass('invisible')) {
9457								
9458									if($('#header-outer.at-top').length > 0) {
9459									
9460										//prevent header from transitioning when first hiding
9461										$('#header-outer').addClass('no-trans-hidden');
9462										setTimeout(function(){
9463											$('#header-outer').addClass('invisible').removeClass('at-top');
9464											$('#header-outer').removeClass('no-trans-hidden');
9465										},30);
9466										
9467									} else {
9468										
9469										$('#header-outer').addClass('invisible').removeClass('at-top');
9470									}
9471								
9472	                
9473									
9474	                 //close submenus
9475	                 if( $(".sf-menu").length > 0 && $().superfish ) {
9476		          		 $(".sf-menu").superfish('hide');
9477		          		 $('header#top nav > ul.sf-menu > li.menu-item-over').removeClass('menu-item-over');
9478		          	 }
9479
9480	              }
9481	                $('.page-submenu.stuck').css('transform','translateY(0px)').addClass('header-not-visible');
9482
9483	            	
9484	            } else {
9485	              // scrolling up; show menu
9486	              if ($('#header-outer').hasClass('invisible'))
9487	                $('#header-outer').removeClass('invisible');
9488
9489	            	if($('.body-border-top').length > 0 && $('body.mobile').length == 0) {
9490
9491	            		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;
9492	            		var $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $('.body-border-top').height() : 0;
9493	          	    	$('.page-submenu.stuck').css('transform','translateY('+ ($('#header-outer').outerHeight()-$bodyBorderSizeToRemove) +'px)').removeClass('header-not-visible');
9494
9495	            	} else {
9496	            		$('.page-submenu.stuck').css('transform','translateY('+$('#header-outer').outerHeight()+'px)').removeClass('header-not-visible');
9497	            	}
9498	            }
9499	          }
9500	        } else {
9501	          // only remove "detached" class if user is at the top of document (menu jump fix)
9502	          $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 : 0;
9503	          if($('.body-border-top').length > 0) {
9504	          		$topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 + $('.body-border-top').height() : $('.body-border-top').height();
9505	          }
9506
9507	          if (currentScroll <= $topDetachNum){
9508	            $('#header-outer').removeClass('detached').removeClass('invisible').addClass('at-top');
9509	            
9510	            if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
9511		            if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.nectar-box-roll').length == 0 && $('.megamenu.sfHover').length == 0) { 
9512		            	$('#header-outer').addClass('transparent').css('transform','translateY(0)');
9513		            	$('#header-outer').removeClass('no-transition');	
9514		            }
9515		            else if($('.nectar-box-roll').length > 0) $('#header-outer').css('transform','translateY(0)').addClass('at-top-before-box');
9516		          
9517		        } else {
9518		        	 if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent').css('transform','translateY(0)');
9519		            else if($('.nectar-box-roll').length > 0) $('#header-outer').css('transform','translateY(0)').addClass('at-top-before-box');
9520		        }
9521
9522	            if($('.parallax_slider_outer').length >
9522 0 || $('#page-header-bg[data-parallax="1"]').length > 0) $('#header-outer').addClass('parallax-contained').css('transform','translateY(0)');
9523	          }
9524	        }
9525
9526	        // if user is at the bottom of document show menu
9527	        if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
9528	          $('#header-outer').removeClass('invisible');
9529
9530	            if($('.body-border-top').length > 0 && $('body.mobile').length == 0) {
9531
9532            		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;
9533            		var $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $('.body-border-top').height() : 0;
9534          	    	$('.page-submenu.stuck').css('transform','translateY('+ ($('#header-outer').outerHeight()-$bodyBorderSizeToRemove) +'px)').removeClass('header-not-visible');
9535	            }
9536	            else {
9537	            	$('.page-submenu.stuck').css('transform','translateY('+$('#header-outer').outerHeight()+'px)').removeClass('header-not-visible');
9538	            }
9539	          
9540	        }
9541
9542	      }
9543
9544	      // replace previous scroll position with new one
9545	      previousScroll = currentScroll;
9546
9547	    }
9548
9549	    //don't trigger for header remove stickiness
9550	    if($('#header-outer[data-remove-fixed="1"]').length == 0) {
9551		    hhunCalcs();
9552		    $(window).scroll(hhunCalcs);
9553		}
9554
9555
9556	}//end if hhun
9557	
9558	if($('#nectar_fullscreen_rows').length == 0) midnightInit(); //init midnight	
9559	else ($('#header-outer').attr('data-permanent-transparent','false'))
9560
9561	var shrinkNum = 6;
9562	var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
9563	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;
9564	var $scrollTriggerOffset = ( $('body.material').length > 0 ) ? 150 : 0;
9565
9566	if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
9567
9568	function smallNav(){
9569		var $offset = $(window).scrollTop();
9570		var $windowWidth = $(window).width();
9571		
9572
9573		if($offset > $scrollTriggerOffset && $windowWidth > 1000 && $('body.material-ocm-open').length == 0) {
9574		
9575
9576			//if going to small when material search is closing, it must be closed immediately
9577			if($('body.material').length > 0) {
9578				if($('#search-outer.material-open').length == 0) {
9579					$('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition','none');
9580				}
9581
9582				//secondary header
9583				if($('#header-secondary-outer').length > 0) {
9584					$('#header-secondary-outer').addClass('hide-up').css('transform','translateY(-100%)');
9585					$('#header-outer').css('transform', 'translateY(-' +$('#header-secondary-outer').height()+ 'px)');
9586				}
9587
9588			}
9589
9590			if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
9591				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) { 
9592					$('#header-outer').removeClass('transparent');
9593					$('#header-outer').removeClass('no-transition');	
9594				}
9595			} else {
9596				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');
9597			}
9598
9599			$('.ns-loading-cover').hide();
9600			
9601			$('#header-outer, #search-outer').addClass('small-nav');
9602			
9603			//body border full width side padding
9604			if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true) {
9605				$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
9606					'padding' : '0'			
9607				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9608			}
9609
9610			if($('body.material').length > 0) {
9611				$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
9612					'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(shrinkNum)*3) +'px'
9613				},{queue:false, duration:310, easing: 'easeOutQuad'});	
9614			}
9615			if($('body.material').length == 0) {
9616
9617				$('#header-outer #logo img').stop(true,true).animate({
9618					'height' : logoHeight - shrinkNum
9619				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9620					
9621				$('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({
9622					'padding-top' : Math.ceil(headerPadding / 1.8)
9623				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9624				
9625				if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
9626					$('#header-outer .row > .span_3').stop(true,true).animate({
9627						'padding-bottom' : Math.ceil(headerPadding / 1.8)
9628					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9629				}
9630
9631				$('header#top nav > ul > li:not(#social-in-menu) > a').stop(true,true).animate({
9632					'padding-bottom' :  Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding / 1.8) ,
9633					'padding-top' :  Math.floor(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) 
9634				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
9635
9636				
9637
9638				$('header#top nav > ul > li#social-in-menu > a').stop(true,true).animate({
9639					'margin-bottom' :  Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li#social-in-menu > a').height()/2)) + headerPadding / 1.8) ,
9640					'margin-top' :  Math.floor(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li#social-in-menu > a').height()/2)) 
9641				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
9642				
9643				$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
9644					'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(shrinkNum)*3) +'px'
9645				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
9646
9647				if($bodyBorderHeaderColorMatch == true) {
9648					$('.body-border-top').stop(true,true).animate({
9649						'margin-top': '-'+$('.body-border-top').height()+'px'
9650					},{queue:false, duration:400, easing: 'easeOutCubic', complete: function() { $(this).css('margin-top',0)} });	 
9651				}
9652
9653				if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
9654					$('#header-outer .cart-menu').stop(true,true).animate({
9655						'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7),
9656						'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7) +1
9657					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9658				} 
9659				
9660				if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
9661					$('header#top nav > ul.buttons').stop(true,true).animate({
9662						'margin-top' : - Math.ceil(headerPadding/ 1.8),
9663						'height' : Math.floor((headerPadding*2)/ 1.8 + logoHeight-shrinkNum)
9664					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9665
9666					$('header#top nav > ul li#search-btn a, header#top nav > ul li.slide-out-widget-area-toggle a').stop(true,true).animate({
9667						'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7),
9668						'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7) +1
9669					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9670
9671				} else {
9672					$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').stop(true,true).animate({
9673						'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2)),
9674						'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2))
9675					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9676				}
9677
9678				if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
9679					$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
9680						'top' : Math.floor($('header#top nav > ul > li > a').outerHeight())
9681					},{queue:false, duration:250, easing: 'easeOutCubic'});		
9682				} else {
9683					$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
9684						'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),
9685					},{queue:false, duration:250, easing: 'easeOutCubic'});		
9686				}
9687				
9688				$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').stop(true,true).animate({
9689					'top': Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8) +'px'
9690				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9691			
9692
9693				if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
9694					$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
9695						'height' : Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8)
9696					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9697
9698					$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
9699						'font-size'  : 30,
9700						'line-height' : '30px',
9701						'height' : '44px',
9702						'top' : ((logoHeight-shrinkNum+headerPadding+5)/2) - ($('#search-outer > #search input[type="text"]').height()-15)/2
9703					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9704				
9705					$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
9706						'top' : ((logoHeight-shrinkNum + headerPadding+5)/2) - 10
9707					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9708
9709				} else {
9710					$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
9711						'height' : Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8) + logoHeight - shrinkNum + 17
9712					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9713
9714					$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
9715						'font-size'  : 30,
9716						'line-height' : '30px',
9717						'height' : '44px',
9718						'top' : ((logoHeight-shrinkNum+headerPadding+5)/2) - ($('#search-outer > #search input[type="text"]').height()-15)/2 + (logoHeight- shrinkNum)/2 + 8
9719					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9720
9721					$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
9722						'top' : ((logoHeight-shrinkNum + headerPadding+5)/2) - 10 + (logoHeight- shrinkNum)/2 + 8
9723					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9724				}
9725
9726			}//not material skin
9727		
9728			
9729
9730			//box roll
9731			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'})
9732			
9733			
9734			if($('body').hasClass('ascend')){ 
9735				$('#search-outer').stop(true,true).animate({
9736					'top' : Math.floor((logoHeight-shrinkNum) +(headerPadding*2)/ 1.8 + extraHeight + secondaryHeader)
9737				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9738			}
9739			
9740			//if no image is being used
9741			if(usingLogoImage == false) $('body:not(.material) header#top #logo').stop(true,true).animate({
9742				'margin-top' : 0
9743			},{queue:false, duration:450, easing: 'easeOutExpo'});	
9744			
9745			$(window).off('scroll',smallNav);
9746			$(window).on('scroll',bigNav);
9747
9748			//dark slider coloring border fix
9749			$('#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');
9750			$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','none');
9751			setTimeout(function(){ 
9752				$('#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'); 
9753				$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','border-color 0.30s ease');
9754			},300);
9755
9756		}
9757
9758	}
9759	
9760	function bigNav(){
9761		var $offset = $(window).scrollTop();
9762		var $windowWidth = $(window).width();
9763
9764		if($('body.material-ocm-open').length > 0) { return false; }
9765
9766		if($offset <= $scrollTriggerOffset && $windowWidth > 1000 || $('.small-nav').length > 0 && $('#ajax-content-wrap.no-scroll').length > 0 ) {
9767			
9768
9769			$('#header-outer, #search-outer').removeClass('small-nav');
9770			
9771			if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
9772				if($('#header-outer').attr('data-transparent-header') == 'true'  && $('.nectar-box-roll').length == 0 && $('.megamenu.sfHover').length == 0) {
9773					$('#header-outer').addClass('transparent');
9774					$('#header-outer').removeClass('no-transition');	
9775				}
9776			} else {
9777				if($('#header-outer').attr('data-transparent-header') == 'true'  && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent');
9778			}
9779
9780			$('.ns-loading-cover').show();
9781			
9782			
9783
9784
9785			//body border full width side padding
9786			if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true) {
9787				$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
9788					'padding' : '0 28px'			
9789				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9790			}
9791
9792
9793			if($('body.material').length > 0) {
9794
9795				$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
9796					'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(shrinkNum)*3) +'px'
9797				},{queue:false, duration:140, easing: 'easeOutQuad'});
9798
9799				//secondary header
9800				if($('#header-secondary-outer').length > 0) {
9801					$('#header-secondary-outer, #header-outer').removeClass('hide-up').css('transform','translateY(0%)');
9802				}
9803		
9804			}
9805
9806			if($('body.material').length == 0) {
9807
9808				$('#header-outer #logo img').stop(true,true).animate({
9809					'height' : logoHeight,				
9810				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9811
9812				$('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({
9813					'padding-top' : headerPadding 
9814				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9815				
9816				if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
9817					$('#header-outer .row > .span_3').stop(true,true).animate({
9818						'padding-bottom' : headerPadding 
9819					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9820				}
9821
9822				$('header#top nav > ul > li:not(#social-in-menu) > a').stop(true,true).animate({
9823					'padding-bottom' : ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding,
9824					'padding-top' : (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2) 
9825				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9826
9827				$('header#top nav > ul > li#social-in-menu > a').stop(true,true).animate({
9828					'margin-bottom' : ((logoHeight/2) - ($('header#top nav > ul > li#social-in-menu > a').height()/2)) + headerPadding,
9829					'margin-top' : (logoHeight/2) - ($('header#top nav > ul > li#social-in-menu > a').height()/2) 
9830				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9831					
9832				$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
9833					'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(shrinkNum)*3) +'px'
9834				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
9835
9836				if($bodyBorderHeaderColorMatch == true) {
9837					$('.body-border-top').css({ 'margin-top': '-'+$('.body-border-top').height()+'px'}).stop(true,true).animate({
9838						'margin-top': '0'
9839					},{queue:false, duration:250, easing: 'easeOutCubic'});	 
9840				}
9841
9842				if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
9843					$('#header-outer .cart-menu').stop(true,true).animate({
9844						'padding-bottom' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding),
9845						'padding-top' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding)
9846					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9847				}
9848
9849				if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
9850					$('header#top nav > ul.buttons').stop(true,true).animate({
9851						'margin-top' : - Math.ceil(headerPadding),
9852						'height' : Math.floor(headerPadding*2 + logoHeight) -1
9853					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9854
9855					$('header#top nav > ul li#search-btn a, header#top nav > ul li.slide-out-widget-area-toggle a').stop(true,true).animate({
9856						'padding-top': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding),
9857						'padding-bottom': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding)
9858					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9859				} else {
9860					$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').stop(true,true).animate({
9861						'padding-bottom' : Math.floor((logoHeight/2) - ($searchBtnHeight/2)),
9862						'padding-top' : Math.ceil((logoHeight/2) - ($searchBtnHeight/2))
9863					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9864				}
9865				
9866				if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
9867					$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
9868						'top' : Math.floor($('header#top nav > ul > li > a').outerHeight())
9869					},{queue:false, duration:250, easing: 'easeOutCubic'});		
9870				} else {
9871					$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
9872						'top' : Math.ceil($('header#top nav > ul > li > a').height() + (((logoHeight)/2) - ($('header#top nav > ul > li > a').height()/2))*2 + headerPadding),
9873					},{queue:false, duration:250, easing: 'easeOutCubic'});		
9874				}
9875				
9876				$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').stop(true,true).animate({
9877					'top': Math.ceil(logoHeight + headerPadding*2) +'px'
9878				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9879				
9880				
9881				if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
9882					$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
9883						'height' : Math.ceil(logoHeight + headerPadding*2)
9884					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9885					
9886					$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
9887						'font-size'  : 43,
9888						'line-height' : '43px',
9889						'height' : '59px',
9890						'top' : ((logoHeight + headerPadding*2)/2) - 30
9891					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9892					
9893					
9894					$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
9895						'top' : ((logoHeight + headerPadding*2)/2) - 8
9896					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9897					
9898				} else {
9899					$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
9900						'height' : Math.ceil(logoHeight + headerPadding*2) + logoHeight + 17
9901					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9902					
9903					$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
9904						'font-size'  : 43,
9905						'line-height' : '43px',
9906						'height' : '59px',
9907						'top' : ((logoHeight + headerPadding*2)/2) - 30 + (logoHeight)/2 + 8
9908					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9909					
9910					
9911					$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
9912						'top' : ((logoHeight + headerPadding*2)/2) - 8 + (logoHeight)/2 + 8
9913					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9914				}
9915
9916
9917				if($('body').hasClass('ascend')){ 
9918					$('#search-outer').stop(true,true).animate({
9919						'top' : (logoHeight) +(headerPadding*2) + extraHeight + secondaryHeader
9920					},{queue:false, duration:250, easing: 'easeOutCubic'});	
9921				}
9922
9923				//if no image is being used
9924				if(usingLogoImage == false) $('header#top #logo').stop(true,true).animate({
9925					'margin-top' : 4
9926				},{queue:false, duration:450, easing: 'easeOutExpo'});	
9927				
9928
9929
9930			}//not material skin
9931
9932
9933				//box roll
9934			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'})
9935			
9936
9937			$(window).off('scroll',bigNav);
9938			$(window).on('scroll',smallNav);
9939
9940
9941			//dark slider coloring border fix
9942			$('#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');
9943			$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','none');
9944			setTimeout(function(){ 
9945				$('#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'); 
9946				$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','border-color 0.30s ease');
9947			},300);
9948		}
9949
9950	}
9951	
9952	
9953	function headerSpace() {
9954		if($('.mobile').length > 0) {
9955			if(window.innerHeight < window.innerWidth && window.innerWidth > 1000) {
9956				if($('#header-outer.small-nav').length == 0)
9957					$('#header-space').css('height', $('#header-outer').outerHeight() + $('#header-secondary-outer').height());
9958			} else {
9959				$('#header-space').css('height', $('#header-outer').outerHeight());
9960			}
9961			
9962		} else {
9963			if($('.nectar-parallax-scene.first-section').length == 0) {
9964
9965				var shrinkNum = 6;	
9966				var headerPadding = parseInt($('#header-outer').attr('data-padding'));
9967				if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
9968				var headerPadding2 = headerPadding - headerPadding/1.8;
9969				var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0 ) ? $('#header-outer').outerHeight() + (parseInt(shrinkNum) + headerPadding2*2) : $('#header-outer').outerHeight();
9970
9971				if($('#header-outer').attr('data-using-secondary') == '1'){
9972					$('#header-space').css('height', $headerHeight + $('#header-secondary-outer').height());
9973				} else {
9974					$('#header-space').css('height', $headerHeight);
9975				} 
9976			}
9977		}
9978		
9979	}
9980
9981	//call immediately on mobile to make sure there's no gap with fixed setups
9982	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) {
9983		$('#header-space').css('height', $('#header-outer').outerHeight());
9984	}
9985
9986
9987	var lastPosition = -1;
9988	var $headerScrollTop = $(window).scrollTop();
9989
9990	function headerOffsetAdjust(){
9991		
9992		$headerScrollTop = $(window).scrollTop();
9993
9994		 if (lastPosition == $headerScrollTop) {
9995            requestAnimationFrame(headerOffsetAdjust);
9996            return false;
9997        } else lastPosition = $headerScrollTop;
9998		
9999		headerOffsetAdjustCalc();
10000
10001		requestAnimationFrame(headerOffsetAdjust);
10002
10003	}
10004
10005	function headerOffsetAdjustCalc() {
10006		if($('body.mobile').length > 0) {
10007			var $eleHeight = 0;
10008
10009			var $endOffset = ($('#wpadminbar').css('position') == 'fixed') ? $('#wpadminbar').height() : 0;
10010			if($('#header-secondary-outer').length > 0) $eleHeight += $('#header-secondary-outer').height();
10011			if($('#wpadminbar').length > 0) $eleHeight += $('#wpadminbar').height();
10012
10013			if( $eleHeight - $headerScrollTop > $endOffset) { 
10014				$('#header-outer').css('top', $eleHeight - $headerScrollTop + 'px');
10015			}
10016			else { $('#header-outer').css('top', $endOffset); }
10017
10018		} else {
10019			var $eleHeight = 0;
10020			if($('#header-secondary-outer').length > 0) $eleHeight += $('#header-secondary-outer').height();
10021			if($('#wpadminbar').length > 0) $eleHeight += $('#wpadminbar').height();
10022			$('#header-outer').css('top',$eleHeight+'px');
10023		}
10024	}
10025
10026	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) {
10027		if($('#nectar_fullscreen_rows').length == 0) { requestAnimationFrame(headerOffsetAdjust); }
10028		else if($('#nectar_fullscreen_rows').length > 0 && $onMobileBrowser) {
10029			requestAnimationFrame(headerOffsetAdjust);
10030		}
10031		$(window).smartresize(headerOffsetAdjustCalc);
10032	}
10033		
10034
10035	function footerRevealCalcs() {
10036		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
10037
10038		if($(window).height() - $('#wpadminbar').height() - $headerNavSpace - $('#footer-outer').height() - 1 -$('#page-header-bg').height() -$('.parallax_slider_outer').height() - $('.page-header-no-bg').height() > 0) {
10039			$resizeExtra = ($('body:not(.material) #header-outer[data-header-resize="1"]').length > 0) ? 55: 0;
10040			$('body[data-footer-reveal="1"] .container-wrap').css({'margin-bottom': $('#footer-outer').height()-1 });
10041			//let even non reveal footer have min height set when using material ocm
10042			$('.container-wrap').css({'min-height': $(window).height() - $('#wpadminbar').height() - $headerNavSpace - $('#footer-outer').height() -1  - $('.page-header-no-bg').height() -$('#page-header-bg').height() -$('.parallax_slider_outer').height() + $resizeExtra });
10043		} else {
10044			$('body[data-footer-reveal="1"] .container-wrap').css({'margin-bottom': $('#footer-outer').height()-1 });
10045		}
10046		
10047		if( $(window).width() < 1000) $('#footer-outer').attr('data-midnight','light');
10048		else $('#footer-outer').removeAttr('data-midnight');
10049	}
10050	if($('body[data-footer-reveal="1"]').length > 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 
10051		setTimeout(function(){
10052			footerRevealCalcs();
10053		}
10053,60);
10054		footerRevealCalcs();
10055		//set shadow to match BG color if applicable
10056		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') });
10057	}
10058	
10059	
10060	function opaqueCheck(){
10061		var $offset = $(window).scrollTop();
10062		var $windowWidth = $(window).width();
10063
10064		if($offset > 0 && $windowWidth > 1000) {
10065			
10066			if($('body.material').length > 0) {
10067				$('#header-outer').addClass('scrolled-down');
10068
10069				//secondary header
10070				if($('#header-secondary-outer').length > 0) {
10071					$('#header-secondary-outer').addClass('hide-up').css('transform','translateY(-100%)');
10072					$('#header-outer').css('transform', 'translateY(-' +$('#header-secondary-outer').height()+ 'px)');
10073				}
10074			}
10075
10076			if($('#header-outer').attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent').addClass('scrolled-down');
10077			$('.ns-loading-cover').hide();
10078			
10079			$(window).off('scroll',opaqueCheck);
10080			$(window).on('scroll',transparentCheck);
10081		}
10082	}
10083	
10084	
10085	function transparentCheck(){
10086
10087		var $offset = $(window).scrollTop();
10088		var $windowWidth = $(window).width();
10089
10090		if($offset == 0 && $windowWidth > 1000 && $('body.material-ocm-open').length == 0) {
10091			
10092			if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
10093				if($('#header-outer').attr('data-transparent-header') == 'true' && $('.megamenu.sfHover').length == 0) { 
10094					$('#header-outer').addClass('transparent').removeClass('scrolled-down');
10095					$('#header-outer').removeClass('no-transition');	
10096				}
10097				else if($('#header-outer').attr('data-transparent-header') == 'true') $('#header-outer').removeClass('scrolled-down');
10098			} else {
10099				if($('#header-outer').attr('data-transparent-header') == 'true') $('#header-outer').addClass('transparent').removeClass('scrolled-down');
10100			}
10101
10102			if($('body.material').length > 0) {
10103				$('#header-outer').removeClass('scrolled-down');
10104
10105				//secondary header
10106				if($('#header-secondary-outer').length > 0) {
10107					$('#header-secondary-outer, #header-outer').removeClass('hide-up').css('transform','translateY(0%)');
10108				}
10109			}
10110
10111			$('.ns-loading-cover').show();
10112			
10113			$(window).off('scroll',transparentCheck);
10114			$(window).on('scroll',opaqueCheck);
10115		}
10116	}
10117	
10118	var adminBarHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
10119
10120	//header inherit row color effect
10121	function headerRowColorInheritInit(){
10122		if($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0){
10123			
10124			var headerOffset = ($('#header-outer[data-permanent-transparent="1"]').length == 0) ? (logoHeight - shrinkNum) + Math.ceil((headerPadding*2) / 1.8) + adminBarHeight : logoHeight/2 + headerPadding + adminBarHeight;
10125			
10126			$('.main-content > .row > .wpb_row').each(function(){
10127
10128
10129				var $that = $(this);
10130				var waypoint = new Waypoint({
10131	 				element: $that,
10132		 			handler: function(direction) {
10133	
10134
10135						if(direction == 'down') {
10136							
10137							if($that.find('.row-bg.using-bg-color').length > 0) {
10138								
10139								var $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
10140								$('#header-outer').css('background-color',$that.find('.row-bg').css('background-color')).removeClass('light-text').removeClass('dark-text').addClass($textColor);
10141								$('#header-outer').attr('data-current-row-bg-color',$that.find('.row-bg').css('background-color'));
10142
10143								$('body.material #header-outer .bg-color-stripe').css('background-color',$that.find('.row-bg').css('background-color'));
10144							} else {
10145								$('#header-outer').css('background-color',$('#header-outer').attr('data-user-set-bg')).removeClass('light-text').removeClass('dark-text');
10146								$('#header-outer').attr('data-current-row-bg-color',$('#header-outer').attr('data-user-set-bg'));
10147
10148								$('body.material #header-outer .bg-color-stripe').css('background-color', '');
10149							}
10150						
10151						} else {
10152
10153							if($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) {
10154								var $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
10155								$('#header-outer').css('background-color',$that.prev('div.wpb_row').find('.row-bg').css('background-color')).removeClass('light-text').removeClass('dark-text').addClass($textColor);
10156								$('#header-outer').attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color'));
10157
10158								$('body.material #header-outer .bg-color-stripe').css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color'));
10159							} else {
10160								$('#header-outer').css('background-color',$('#header-outer').attr('data-user-set-bg')).removeClass('light-text').removeClass('dark-text');
10161								$('#header-outer').attr('data-current-row-bg-color',$('#header-outer').attr('data-user-set-bg'));
10162
10163								$('body.material #header-outer .bg-color-stripe').css('background-color', '');
10164							}
10165
10166						} 
10167
10168				
10169					},
10170					offset: headerOffset
10171
10172				}); 
10173
10174
10175			});
10176		}
10177	}
10178
10179	//if($('.nectar-box-roll').length == 0) headerRowColorInheritInit();
10180
10181
10182
10183/****************sticky page submenu******************/
10184	if($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) {
10185
10186		(function() {
10187		  'use strict'
10188
10189		  var $ = window.jQuery
10190		  var Waypoint = window.Waypoint
10191		  var $offsetHeight = 0; 
10192		  var shrinkNum = 6;	
10193		  var headerPadding = parseInt($('#header-outer').attr('data-padding'));
10194
10195		  if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
10196		  var headerPadding2 = headerPadding - headerPadding/1.8;
10197		  var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
10198		  var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('body.mobile').length == 0) ? $headerNavSpace - (parseInt(shrinkNum) + headerPadding2*2) : $headerNavSpace;
10199
10200		  if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; $headerHeight = 0; }
10201
10202		  if($('#header-secondary-outer').length > 0 && $('body.mobile').length == 0) $headerHeight += $('#header-secondary-outer').height();
10203		  
10204
10205		  $(window).on('smartresize',function(){
10206
10207		    $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
10208		  	$headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length == 0 && $('body.mobile').length == 0) ? $headerNavSpace - (parseInt(shrinkNum) + headerPadding2*2) : $headerNavSpace;
10209		  	if($('#header-secondary-outer').length > 0  && $('body.mobile').length == 0) $headerHeight += $('#header-secondary-outer').height();
10210
10211		  	$offsetHeight = 0; 
10212		
10213		  	  if($('#wpadminbar').length > 0 && $('#wpadminbar').css('position') == 'fixed') $offsetHeight += $('#wpadminbar').height();
10214 			  if($('body[data-hhun="0"] #header-outer').length > 0 && !($('body.mobile').length > 0 && $('#header-outer[data-mobile-fixed="false"]').length > 0) ) {
10215 			  	  $offsetHeight += $headerHeight;
10216 			  }
10217
10218 			  if($('.body-border-top').length > 0 && $(window).width() > 1000 && $('body[data-hhun="1"]').length > 0) $offsetHeight += $('.body-border-top').height();
10219 	
10220 			 // else if($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) $offsetHeight += $headerHeight;
10221 			
10222 			 //recalc for resizing (same as stuck/unstuck logic below)
10223 			 if($('.page-submenu.stuck').length > 0) {
10224
10225		        	$('.page-submenu.stuck').addClass('no-trans').css('top',$offsetHeight).css('transform','translateY(0)').addClass('stuck');
10226		        	var $that = this;
10227		        	setTimeout(function(){ $('.page-submenu.stuck').removeClass('no-trans'); },50);
10228		        	$('.page-submenu.stuck').parents('.wpb_row').css('z-index',10000);
10229
10230		        	//boxed
10231		        	if($('#boxed').length > 0) { 
10232		        		var $negMargin = ($(window).width() > 1000) ? $('.container-wrap').width()*0.04 :39;
10233		        		$('.page-submenu.stuck').css({'margin-left':'-'+$negMargin+'px', 'width' : $('.container-wrap').width()});
10234		        	}
10235
10236		        }
10237		        else { 
10238		        	$('.page-submenu.stuck').css('top','0').removeClass('stuck');
10239		       	   $('.page-submenu.stuck').parents('.wpb_row').css('z-index','auto');
10240
10241		       	    if($('#boxed').length > 0) $('.page-submenu.stuck').css({'margin-left':'0px', 'width' : '100%'});
10242		       	}
10243
10244		  });
10245
10246		  /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */
10247		  function Sticky(options) {
10248		    this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options)
10249		    this.element = this.options.element
10250		    this.$element = $(this.element)
10251		    this.createWrapper()
10252		    this.createWaypoint()
10253		  }
10254
10255		  /* Private */
10256		  Sticky.prototype.createWaypoint = function() {
10257		    var originalHandler = this.options.handler
10258
10259		    $offsetHeight = 0; 
10260		    if($('#wpadminbar').length > 0 && $('#wpadminbar').css('position') == 'fixed') $offsetHeight += $('#wpadminbar').height();
10261 			if($('body[data-hhun="0"] #header-outer').length > 0 && !($('body.mobile').length > 0 && $('#header-outer[data-mobile-fixed="false"]').length > 0) ) { 
10262 				$offsetHeight += $headerHeight;
10263 			}
10264 			 if($('.body-border-top').length > 0 && $(window).width() > 1000 && $('body[data-hhun="1"]').length > 0) $offsetHeight += $('.body-border-top').height();
10265 		
10266		    this.waypoint = new Waypoint($.extend({}, this.options, {
10267		      element: this.wrapper,
10268		      handler: $.proxy(function(direction) {
10269		        var shouldBeStuck = this.options.direction.indexOf(direction) > -1
10270		        var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''
10271
10272		        this.$wrapper.height(wrapperHeight)
10273		        if(shouldBeStuck) {
10274		        	this.$element.addClass('no-trans').css('top',$offsetHeight).css('transform','translateY(0)').addClass('stuck');
10275		        	var $that = this;
10276		        	setTimeout(function(){ $that.$element.removeClass('no-trans'); },50);
10277		        	this.$element.parents('.wpb_row').css('z-index',10000);
10278
10279		        	//boxed
10280		        	if($('#boxed').length > 0) { 
10281		        		var $negMargin = ($(window).width() > 1000) ? $('.container-wrap').width()*0.04 :39;
10282		        		this.$element.css({'margin-left':'-'+$negMargin+'px', 'width' : $('.container-wrap').width()});
10283		        	}
10284
10285		        }
10286		        else { 
10287		        	this.$element.css('top','0').removeClass('stuck');
10288		       	    //this.$element.parents('.wpb_row').css('z-index','10000');
10289
10290		       	    if($('#boxed').length > 0) this.$element.css({'margin-left':'0px', 'width' : '100%'});
10291		       	}
10292
10293		        if (originalHandler) {
10294		          originalHandler.call(this, direction)
10295		        }
10296		      }, this),
10297		      offset: $offsetHeight
10298		    }))
10299
10300		    var $that = this;
10301
10302		   // if($('body[data-hhun="1"]').length > 0 ) {
10303			    setInterval(function(){ 
10304
10305			    	if($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0)
10306		        		$that.waypoint.options.offset = $offsetHeight + $headerHeight;
10307		        	else 
10308		        		$that.waypoint.options.offset = $offsetHeight;
10309			    	Waypoint.refreshAll();
10310			
10311			    },100); 
10312			//}
10313
10314		  }
10315
10316		  /* Private */
10317		  Sticky.prototype.createWrapper = function() {
10318		    if (this.options.wrapper) {
10319		      this.$element.wrap(this.options.wrapper)
10320		    }
10321		    this.$wrapper = this.$element.parent()
10322		    this.wrapper = this.$wrapper[0]
10323		  }
10324
10325		  /* Public */
10326		  Sticky.prototype.destroy = function() {
10327		    if (this.$element.parent()[0] === this.wrapper) {
10328		      this.waypoint.destroy()
10329		      this.$element.removeClass(this.options.stuckClass)
10330		      if (this.options.wrapper) {
10331		        this.$element.unwrap()
10332		      }
10333		    }
10334		  }
10335
10336		  Sticky.defaults = {
10337		    wrapper: '<div class="sticky-wrapper" />',
10338		    stuckClass: 'stuck',
10339		    direction: 'down right'
10340		  }
10341
10342		  Waypoint.Sticky = Sticky
10343		}())
10344		;
10345
10346		//remove outside of column setups 
10347		if($('.page-submenu').parents('.span_12').find('> .wpb_column').length > 1){
10348			var pageMenu = $('.page-submenu').clone();
10349			var pageMenuParentRow = $('.page-submenu').parents('.wpb_row');
10350			$('.page-submenu').remove();
10351			pageMenuParentRow.before(pageMenu);
10352		}
10353
10354		var sticky = new Waypoint.Sticky({
10355		  element: $('.page-submenu[data-sticky="true"]')[0]
10356		});
10357
10358
10359	}
10360
10361	if($('#nectar_fullscreen_rows').length == 0)
10362		$('.page-submenu').parents('.wpb_row').css('z-index',10000);
10363
10364	$('.page-submenu .mobile-menu-link').on('click',function(){
10365		$(this).parents('.page-submenu').find('ul').stop(true).slideToggle(350);
10366		return false;
10367	});
10368
10369	$('.page-submenu ul li a').on('click',function(){
10370		if($('body.mobile').length > 0) $(this).parents('.page-submenu').find('ul').stop(true).slideToggle(350);
10371	});
10372
10373
10374	//responsive nav
10375	$('body').on('click','#toggle-nav',function(){
10376		if(window.innerWidth > 1000) {
10377			window.scrollTo(0,0);	
10378		}
10379
10380		$(this).find('.lines-button').toggleClass('close');
10381		$('#mobile-menu').stop(true,true).slideToggle(500);
10382		return false;
10383	});
10384	
10385	
10386	//add wpml to mobile menu
10387	if($('header#top nav > ul > li.menu-item-language').length > 0 && $('#header-secondary-outer ul > li.menu-item-language').length == 0){
10388		var $langSelector = $('header#top nav > ul > li.menu-item-language').clone();
10389		$langSelector.insertBefore('#mobile-menu ul #mobile-search');
10390	}
10391	
10392	////append dropdown indicators / give classes
10393	$('#mobile-menu .container ul li').each(function(){
10394		if($(this).find('> ul').length > 0) {
10395			 $(this).addClass('has-ul');
10396			 $(this).find('> a').append('<span class="sf-sub-indicator"><i class="icon-angle-down"></i></span>');
10397		}
10398	});
10399	
10400	////events
10401	$('#mobile-menu .container ul li:has(">ul") > a .sf-sub-indicator').click(function(){
10402		$(this).parent().parent().toggleClass('open');
10403		$(this).parent().parent().find('> ul').stop(true,true).slideToggle();
10404		return false;
10405	});
10406	
10407
10408
10409/*-------------------------------------------------------------------------*/
10410/*	5.	Page Specific
10411/*-------------------------------------------------------------------------*/	
10412	
10413	function vcFullHeightRow() {
10414        var $element = $(".vc_row-o-full-height:first");
10415        if ($element.length) {
10416            var $window, windowHeight, offsetTop, fullHeight;
10417            $window = $(window), 
10418            windowHeight = $window.height();
10419
10420            $(".vc_row-o-full-height").each(function(){
10421            	offsetTop = $(this).offset().top;
10422
10423            	var $realRowIndex = ($(this).parent().hasClass('vc_ie-flexbox-fixer')) ? $(this).parent().index() : $(this).index();
10424
10425            	if(offsetTop < windowHeight && $realRowIndex == 0) {
10426            		fullHeight = 100 - offsetTop / (windowHeight / 100);
10427          	    	$(this).css("min-height", fullHeight + "vh");
10428          	    	$(this).find('> .col.span_12').css("min-height", fullHeight + "vh");
10429            	} else {
10430            		$(this).css("min-height", windowHeight);
10431            		$(this).find('> .col.span_12').css("min-height", windowHeight);
10432            	}
10433          	   
10434            });
10435
10436            
10437        }
10438
10439    }
10440    function fixIeFlexbox() {
10441        var ua = window.navigator.userAgent,
10442            msie = ua.indexOf("MSIE ");
10443        (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) && $(".vc_row-o-full-height").each(function() {
10444            "flex" === $(this).find('> .span_12').css("display") && $(this).wrap('<div class="vc_ie-flexbox-fixer"></div>')
10445        })
10446    }
10447    fixIeFlexbox();
10448
10449    vcFullHeightRow();
10450
10451	//recent work
10452	function piVertCenter() {
10453		$('.portfolio-items  > .col').each(function(){
10454				
10455			//style 4
10456			$(this).find('.style-4 .work-info .bottom-meta:not(.shown)').stop().animate({
10457				'bottom' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()-2+'px'
10458			},420,'easeOutCubic');
10459
10460			
10461		});	 
10462	}
10463	
10464	$(window).load(function(){
10465	 	 portfolioCommentOrder();
10466	 	 fullWidthContentColumns();
10467	 	 resizeVideoToCover();
10468	});
10469	
10470	
10471	//ie8 width fix
10472	function ie8Width(){
10473		if( $(window).width() >= 1300 ) {
10474			$('.container').css('max-width','1100px');
10475		} else {
10476			$('.container').css('max-width','880px');
10477		}
10478	}
10479	
10480	if( $(window).width() >= 1300 && $('html').hasClass('no-video')) { $('.container').css('max-width','1100px'); $(window).resize(ie8Width); };
10481	
10482
10483
10484	function smartResizeInit() {
10485
10486		 //carousel height calcs
10487		 carouselHeightCalcs();
10488		 clientsCarouselHeightRecalc();
10489
10490		 //portfolio comment order
10491		 portfolioCommentOrder();
10492		 
10493		 //testimonial slider height
10494		 testimonialHeightResize(); //animated
10495		 testimonialSliderHeight(); //non-animated
10496		 
10497		 //full width content columns sizing
10498		 fullWidthContentColumns();
10499
10500		 //parallax BG Calculations
10501		 if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
10502		   parallaxRowsBGCals();
10503		 }
10504		 vcFullHeightRow();
10505		 headerSpace();
10506
10507		 centeredLogoMargins();
10508
10509		 slideOutWidgetOverflowState();
10510		 recentPostHeight();
10511
10512		 morphingOutlines();
10513
10514		 flipBoxHeights();
10515
10516		 showOnLeftSubMenu();
10517
10518		 //minimal alt effect
10519		if($('.tabbed[data-style="minimal_alt"]').length > 0) {
10520			 magicLineCalc($('.tabbed[data-style="minimal_alt"] > ul > li > a.active-tab'));
10521		}
10522
10523		 //full width menu megamenu adjust
10524		//if($('.slide-out-widget-area-toggle a.open').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) fullWidthHeaderSlidingWidgetMenuCalc();
10525		  
10526	}
10527
10528    $(window).off('smartresize.srInit'); 
10529	$(window).on('smartresize.srInit', smartResizeInit); 
10530	
10531	
10532	$usingNectarCarouselFlk = ($('.nectar-carousel.nectar-flickity:not(.masonry)').length > 0) ? true : false;
10533	
10534	function resizeInit() {
10535		 portfolioDeviceCheck();
10536
10537		 //fullwidth page section calcs
10538		 fullWidthSections(); 
10539		 fullwidthImgOnlySizing();
10540		 fullWidthContentColumns();
10541	  	 fullWidthRowPaddingAdjustCalc();
10542		 
10543		 //iframe video emebeds
10544		 responsiveVideoIframes();
10545		 videoshortcodeSize();
10546
10547		 testimonialSliderHeightMinimalMult();
10548		 if($usingNectarCarouselFlk) {
10549			 setNectarCarouselFlkEH();
10550		 }
10551		 
10552		 if($('.nectar-social.full-width').length > 0) {
10553		 	nectarLoveFWCenter();
10554		 }
10555
10556		 if($('body').hasClass('ascend') ){ 
10557			searchFieldCenter();
10558		 }
10559
10560		 if($('body').hasClass('single-post')) centerPostNextButtonImg();
10561		 
10562		 //fixed sidebar for portfolio
10563		 sidebarPxConversion();
10564
10565		 cascadingImageBGSizing();
10566
10567		 responsiveTooltips();
10568
10569		 //vc mobile columns
10570		 if($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) vcMobileColumns();
10571
10572		 if($('body[data-footer-reveal="1"]').length > 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) footerRevealCalcs();
10573
10574		 if($('#page-header-bg').length > 0) pageHeader();
10575
10576		 if($('.nectar-video-bg').length > 0) {
10577		 	resizeVideoToCover();
10578		 }
10579	}
10580
10581	$(window).off('resize.srInit'); 
10582	$(window).on('resize.srInit', resizeInit); 
10583
10584	$(window).on("orientationchange",function(){
10585	  setTimeout(clientsCarouselHeightRecalc,200);
10586	});
10587	
10588	//blog next post button
10589	function postNextButtonEffect(){
10590
10591		$('.blog_next_prev_buttons').imagesLoaded(function(){
10592
10593			centerPostNextButtonImg();
10594			
10595			$('.blog_next_prev_buttons img').css('opacity','1');
10596
10597		});
10598	}
10599
10600	function centerPostNextButtonImg(){
10601		
10602		if($('.blog_next_prev_buttons').length == 0) return false;
10603
10604		if( $('.blog_next_prev_buttons img').height() >= $('.blog_next_prev_buttons').height() + 50 ) {
10605			var $height = 'auto';
10606			var $width = $('.blog_next_prev_buttons').width();
10607		} else {
10608
10609			if( $('.blog_next_prev_buttons').width() < $('.blog_next_prev_buttons img').width()) {
10610				var $height = $('.blog_next_prev_buttons').height() + 49;
10611				var $width = 'auto';
10612			} else {
10613				var $height = 'auto';
10614				var $width = '100%';
10615			}
10616			
10617		}
10618
10619		$('.blog_next_prev_buttons img').css({ 'height' : $height, 'width': $width });
10620
10621		$('.blog_next_prev_buttons img').css({
10622			'top' : ($('.blog_next_prev_buttons').height()/2) - ($('.blog_next_prev_buttons img').height()/2) + 'px',
10623			'left' : ($('.blog_next_prev_buttons').width()/2) - ($('.blog_next_prev_buttons img').width()/2) + 'px'
10624		});
10625
10626		$('.blog_next_prev_buttons .inner').each(function(){
10627			$(this).css({'top': $(this).parent().height()/2 - ($(this).height()/2), 'opacity':'1' });
10628		})
10629	}
10630	
10631	postNextButtonEffect();
10632
10633
10634	function recentPostHeight() {
10635		$('.blog-recent[data-style="title_only"]').each(function(){
10636			if($(this).find('> .col').length > 1) return false;
10637			if($(this).parent().parent().parent().hasClass('vc_col-sm-3') || 
10638				$(this).parent().parent().parent().hasClass('vc_col-sm-4') || 
10639				$(this).parent().parent().parent().hasClass('vc_col-sm-6') || 
10640				$(this).parent().parent().parent().hasClass('vc_col-sm-8') || 
10641				$(this).parent().parent().parent().hasClass('vc_col-sm-9')) {
10642				
10643				if($('body.mobile').length == 0 && $(this).next('div').length == 0) {
10644					var tallestColumn = 0;
10645					
10646					$(this).find('> .col').css('padding', '50px 20px');
10647
10648					$(this).parents('.span_12').find(' > .wpb_column').each(function(){
10649						(Math.floor($(this).height()) > tallestColumn) ? tallestColumn = Math.floor($(this).height()) : tallestColumn = tallestColumn;
10650					});	
10651			
10652					if(Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) {
10653						$(this).find('> .col').css('padding-top',(tallestColumn-$(this).find('> .col').height())/2 + 'px');
10654						$(this).find('> .col').css('padding-bottom',(tallestColumn-$(this).find('> .col').height())/2 + 'px');
10655					}
10656					
10657				}
10658				 else {
10659				 		$(this).find('> .col').css('padding', '50px 20px');
10660				}
10661			}
10662		});
10663	}
10664	recentPostHeight();
10665
10666
10667	//recent post slider
10668	function recentPostsFlickityInit() {
10669
10670		//classic enhanced specific 
10671    $('.blog-recent[data-style="classic_enhanced_alt"] .inner-wrap').each(function(){
10672        	$(this).find('.post-featured-img').each(function(){
10673				var $src = $(this).find('img').attr('src');
10674				$(this).css('background-image','url('+$src+')');
10675			});
10676        });
10677		$('.blog-recent[data-style="classic_enhanced"]').each(function(){
10678			if($(this).find('.inner-wrap.has-post-thumbnail').length == 0) {
10679				$(this).addClass('no-thumbs');
10680			}
10681		});
10682
10683		if($('.nectar-recent-posts-slider-inner').length > 0) {
10684		
10685			var $rpFGroupCells = ($('.nectar-recent-posts-slider_multiple_visible').length > 0) ? '90%' : false;
10686			
10687			var $rpF = $('.nectar-recent-posts-slider-inner').flickity({
10688				  contain: true,
10689					groupCells: $rpFGroupCells,
10690				  draggable: true,
10691				  lazyLoad: false,
10692				  imagesLoaded: true,
10693				  percentPosition: true,
10694				  prevNextButtons: false,
10695				  pageDots: true,
10696				  resize: true,
10697				  setGallerySize: true,
10698				  wrapAround: true,
10699				  accessibility: false
10700			});
10701			
10702			setTimeout(function(){
10703				$('.nectar-recent-posts-slider-inner').addClass('loaded');
10704			},1150);
10705			var flkty = $rpF.data('flickity');
10706			
10707			$rpF.on( 'dragStart.flickity', function() {
10708				$('.flickity-viewport').addClass('is-moving');
10709			});
10710			
10711			$rpF.on( 'dragEnd.flickity', function() {
10712				$('.flickity-viewport').removeClass('is-moving');
10713			});
10714			
10715			var $dragTimeout;
10716			
10717			$rpF.on( 'select.flickity', function() {
10718				//don't trigger no hover if user is still on same item
10719				//if() {
10720				  $('.flickity-viewport').addClass('no-hover');
10721				  clearTimeout( $dragTimeout);
10722				   $dragTimeout = setTimeout(function(){ $('.flickity-viewport').removeClass('no-hover'); },400);
10723			 //}
10724			});
10725			
10726			
10727	  
10728			recentPostSliderHeight();
10729			$(window).resize(recentPostSliderHeight);
10730
10731			if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
10732				$(window).resize(recentPostSliderParallaxMargins);
10733
10734			function recentPostSliderHeight(){
10735
10736				$('.nectar-recent-posts-slider').each(function(){
10737						
10738							var $heightCalc;
10739							var $minHeight = 250;
10740							var $windowWidth = $(window).width();
10741							var $definedHeight = parseInt($(this).attr('data-height'));
10742
10743							var dif = ($('body[data-ext-responsive="true"]').length > 0) ? $(window).width() / 1400 : $(window).width() / 1100;
10744
10745							if( window.innerWidth > 1000 && $('#boxed').length == 0) {
10746
10747								if($(this).parents('.full-width-content').length == 0) {
10748									if($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1400){
10749										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight));
10750									} else if($('body[data-ext-responsive="true"]').length == 0 && window.innerWidth >= 1100) {
10751										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight));
10752									} else {
10753										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
10754									}
10755									
10756								} else {
10757									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
10758								}
10759								
10760							} else {
10761								
10762								//column sliders
10763								var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col') ;
10764								if($parentCol.length == 0) $parentCol = $('.main-content');
10765									
10766								if(!$parentCol.hasClass('vc_span12') && !$parentCol.hasClass('main-content') && !$parentCol.hasClass('span_12') && !$parentCol.hasClass('vc_col-sm-12') ) {
10767								
10768									var $parentColWidth = sliderColumnDesktopWidth($parentCol);
10769									var $aspectRatio = $definedHeight/$parentColWidth;
10770
10771									
10772									//min height
10773									if( $aspectRatio*$parentCol.width() <= $minHeight ){
10774										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$minHeight);
10775									} else {
10776										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$aspectRatio*$parentCol.width());
10777									}
10778								  
10779								} 
10780								
10781								
10782
10783								//regular
10784								else {
10785									
10786									//min height
10787									if( $definedHeight*dif <= $minHeight ){
10788										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$minHeight);
10789									} else {
10790										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.
10790ceil($definedHeight*dif));
10791									}
10792									
10793								}
10794								
10795							}
10796							
10797		
10798						
10799					});
10800			
10801			}
10802
10803			////helper function
10804			function sliderColumnDesktopWidth(parentCol) {
10805				
10806				var $parentColWidth = 1100;
10807				var $columnNumberParsed = $(parentCol).attr('class').match(/\d+/);
10808				
10809				if($columnNumberParsed == '2') { $parentColWidth = 170 }
10810				else if($columnNumberParsed == '3') { $parentColWidth = 260 } 
10811				else if($columnNumberParsed == '4') { $parentColWidth = 340 } 
10812				else if($columnNumberParsed == '6') { $parentColWidth = 530 } 
10813				else if($columnNumberParsed == '8') { $parentColWidth = 700 } 
10814				else if($columnNumberParsed == '9') { $parentColWidth = 805 }
10815				else if($columnNumberParsed == '10') { $parentColWidth = 916.3 }
10816				else if($columnNumberParsed == '12') { $parentColWidth = 1100 }
10817			
10818				return $parentColWidth;
10819			}
10820		
10821		}//if using rp slider
10822		
10823		
10824		//multiple featured controls
10825		
10826		function multipleLargeFeaturedInit() {
10827			 $('.nectar-recent-posts-single_featured.multiple_featured').each(function(){
10828				 	$(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>');
10829					var $that = $(this);
10830					
10831					var tallestFeaturedSlide = 0;
10832					$(this).find('.nectar-recent-post-slide').each(function(i){
10833						
10834						if($(this).find('.recent-post-container').height() > tallestFeaturedSlide) {
10835							$(this).siblings().removeClass('tallest');
10836							$(this).addClass('tallest');
10837							tallestFeaturedSlide = $(this).find('.recent-post-container').height();
10838						} 
10839						
10840						var $activeClass = (i == 0 && $(this).parents('.nectar-recent-posts-single_featured.multiple_featured[data-autorotate="none"]').length > 0) ? 'class="active"': '';
10841						 $that.find('.controls').append('<li '+$activeClass+'><span class="title">'+ $(this).find('h2').text() +'</span></li>');
10842					});
10843					
10844					$(this).addClass('js-loaded');
10845					
10846					var $slideClickTimeout;
10847					
10848					//click Functionality
10849					$(this).find('.controls li').click(function(e){
10850						
10851							if($(this).hasClass('active')) 
10852								return;
10853								
10854							if(e.originalEvent !== undefined)
10855								$(this).parent().find('.active').addClass('trans-out');
10856							
10857							var $index = $(this).index();
10858							var $oldIndex = $(this).parent().find('.active').index();
10859							var $that = $(this);
10860							
10861							clearTimeout($slideClickTimeout);
10862							
10863							$(this).siblings().removeClass('active');
10864							$(this).addClass('active');
10865							$slideClickTimeout = setTimeout( function() { 
10866								$that.parents('.multiple_featured').find('.nectar-recent-post-slide:not(:eq('+$index+'))').css('opacity','0').removeClass('active');
10867								$that.parent().find('.trans-out').removeClass('trans-out');
10868							}, 300);
10869							$that.parents('.multiple_featured').find('.nectar-recent-post-slide:not(:eq('+$index+'))').css('z-index','10');
10870							$that.parents('.multiple_featured').find('.nectar-recent-post-slide:eq('+$oldIndex+')').css('z-index','15');
10871							
10872							$(this).parents('.multiple_featured').find('.nectar-recent-post-slide').eq($index).css({'opacity':'1', 'z-index':'20'}).addClass('active');
10873							
10874							if($(this).parents('.multiple_featured').attr('data-autorotate') != 'none') {
10875								nectarCustomSliderResetRotate($that.parents('.nectar-recent-posts-single_featured.multiple_featured'));
10876							}
10877					});
10878					
10879					
10880				//autorotate
10881				var $that = $(this);
10882				 if($(this).attr('data-autorotate').length > 0 && $(this).attr('data-autorotate') != 'none') {
10883					 
10884					 setTimeout(function(){
10885							 slide_interval = (parseInt($that.attr('data-autorotate')) < 100) ? 4000 : parseInt($that.attr('data-autorotate'));
10886							 $nectarCustomSliderRotate = setInterval(function(){ nectarCustomSliderRotate($that) },slide_interval);
10887							 
10888							 //set first active class
10889							 $that.find('.controls > li:first-child').addClass('active');
10890
10891					 },30);
10892					 
10893				 }
10894				 
10895			 });
10896			 
10897			 splitLineText();
10898			 $(window).resize(splitLineText);
10899			 
10900			
10901			
10902		}
10903		
10904		multipleLargeFeaturedInit();
10905	
10906	}
10907	
10908	recentPostsFlickityInit();
10909
10910	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
10911		if($('.nectar-recent-posts-slider').length > 0) window.requestAnimationFrame(recentPostSliderParallax);
10912
10913	function recentPostSliderParallax(){
10914
10915		$('.nectar-recent-posts-slider').each(function(){
10916			var $offset = parseInt($(this).find('.flickity-slider').position().left);
10917			var $slideLength = $(this).find('.nectar-recent-post-slide').length;
10918			var $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index();
10919			var $slideWidth = $(this).find('.nectar-recent-post-slide').width();
10920			//wrapped fix
10921
10922			////first going to first
10923			if($offset >= -3) {
10924				$(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg').css('margin-left',parseInt(Math.ceil($slideWidth/3.5))+'px');
10925			} else {
10926				$(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg').css('margin-left','-'+parseInt(Math.ceil($slideWidth/3.5*$lastChildIndex))+'px');
10927			}
10928			////last going to first
10929			if(Math.abs($offset) >= ($slideLength-1) * $slideWidth) {
10930				$(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg').css('margin-left','-'+parseInt(Math.ceil(($slideWidth/3.5)*$slideLength))+'px');
10931			} else {
10932				$(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg').css('margin-left','0px');
10933			}
10934
10935			$(this).find('.nectar-recent-post-bg').css('transform','translateX('+Math.ceil($(this).find('.flickity-slider').position().left/-3.5)+'px)');
10936			
10937			
10938		});
10939		requestAnimationFrame(recentPostSliderParallax);
10940	}
10941
10942	function recentPostSliderParallaxMargins(){
10943
10944		$('.nectar-recent-posts-slider').each(function(){		
10945			var $slideWidth = $(this).find('.nectar-recent-post-slide').width();
10946			$(this).find('.nectar-recent-post-slide').each(function(i){
10947				$(this).find('.nectar-recent-post-bg').css('margin-left','-'+  parseInt(Math.ceil($slideWidth/3.5)*i)+'px');
10948			});
10949		
10950		});
10951	}
10952
10953	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
10954		recentPostSliderParallaxMargins();
10955
10956
10957	//portfolio item hover effect
10958	
10959	////desktop event 
10960	function portfolioHoverEffects() { 
10961
10962		if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(iPad|IEMobile)/)) {
10963			
10964			//style 1 & 2
10965			$('.portfolio-items:not([data-ps="7"]) .col .work-item:not(.style-3-alt):not(.style-3):not([data-custom-content="on"])').hover(function(){
10966				$(this).find('.work-info .vert-center').css({'margin-top' : 0});
10967				$(this).find('.work-info, .work-info .vert-center > *, .work-info > i').css({'opacity' : 1});
10968				$(this).find('.work-info-bg').css({ 'opacity' : 0.9 });
10969			},function(){
10970				$(this).find('.work-info .vert-center').css({ 'margin-top' : -20 });
10971				$(this).find('.work-info, .work-info .vert-center > *:not(.mfp-figure), .work-info > i').css({ 'opacity' : 0 });
10972				$(this).find('.work-info-bg').css({ 'opacity' : 0 });
10973			});
10974			
10975			
10976			//style 3
10977			$('.portfolio-items .col .work-item.style-3').hover(function(){
10978
10979				$(this).find('.work-info-bg').css({ 'opacity' : 0 });
10980
10981			},function(){
10982				
10983				$(this).find('.work-info-bg').css({ 'opacity' : 0.45 });
10984
10985			});
10986			
10987			
10988			//style 4
10989			$('.portfolio-items .col .work-item.style-4').hover(function(){
10990				
10991				$(this).find('img').stop().animate({
10992					'top' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()/2+'px'
10993				},250,'easeOutCubic');
10994				
10995				$(this).find('.work-info .bottom-meta').addClass('shown').stop().animate({
10996					'bottom' : '0px'
10997				},320,'easeOutCubic');
10998
10999			},function(){
11000				
11001				$(this).find('img').stop().animate({
11002					'top' : '0px'
11003				},250,'easeOutCubic');
11004				
11005				$(this).find('.work-info .bottom-meta').removeClass('shown').stop().animate({
11006					'bottom' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()-2+'px'
11007				},320,'easeOutCubic');
11008				
11009			});
11010		
11011		} 
11012		////mobile event
11013		else {
11014			portfolioDeviceCheck();
11015		}
11016
11017	}
11018
11019	portfolioHoverEffects();
11020
11021	function style6Img(){
11022  
11023		//change sizer pos
11024		$('.style-5').each(function(){
11025			$(this).find('.sizer').insertBefore($(this).find('.parallaxImg'));
11026		});
11027
11028		//set parent zindex
11029		$('.style-5').parents('.wpb_row').css('z-index','100');
11030
11031		var d = document,
11032			de = d.documentElement,
11033			bd = d.getElementsByTagName('body')[0],
11034			htm = d.getElementsByTagName('html')[0],
11035			win = window,
11036			imgs = d.querySelectorAll('.parallaxImg'),
11037			totalImgs = imgs.length,
11038			supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints;
11039
11040		if(totalImgs <= 0){
11041			return;
11042		}
11043
11044		// build HTML
11045		for(var l=0;l<totalImgs;l++){
11046
11047			var thisImg = imgs[l],
11048				layerElems = thisImg.querySelectorAll('.parallaxImg-layer'),
11049				totalLayerElems = layerElems.length;
11050
11051			if(totalLayerElems <= 0){
11052				continue;
11053			}
11054
11055			while(thisImg.firstChild) {
11056				thisImg.removeChild(thisImg.firstChild);
11057			}
11058			
11059			var lastMove = 0;
11060
11061			//throttle performance for all browser other than chrome
11062			var eventThrottle = $('html').hasClass('cssreflections') ? 1 : 80;
11063			if(eventThrottle == 80) $('body').addClass('cssreflections');
11064
11065			var containerHTML = d.createElement('div'),
11066				shineHTML = d.createElement('div'),
11067				shadowHTML = d.createElement('div'),
11068				layersHTML = d.createElement('div'),
11069				layers = [];
11070
11071			thisImg.id = 'parallaxImg__'+l;
11072			containerHTML.className = 'parallaxImg-container';
11073			//shineHTML.className = 'parallaxImg-shine';
11074			shadowHTML.className = 'parallaxImg-shadow';
11075			layersHTML.className = 'parallaxImg-layers';
11076
11077			for(var i=0;i<totalLayerElems;i++){
11078				var layer = d.createElement('div'),
11079					layerInner = d.createElement('div'),
11080					imgSrc = layerElems[i].getAttribute('data-img');
11081
11082				$(layer).html($(layerElems[i]).html());
11083				layer.className = 'parallaxImg-rendered-layer';
11084				layer.setAttribute('data-layer',i);
11085
11086				if(i==0 && $(thisImg).parents('.wpb_gallery').length == 0) { 
11087					layerInner.className = 'bg-img';
11088					layerInner.style.backgroundImage = 'url('+imgSrc+')';
11089					layer.appendChild(layerInner);
11090				}
11091				layersHTML.appendChild(layer);
11092
11093				layers.push(layer);
11094			}
11095
11096			containerHTML.appendChild(layersHTML);
11097			//containerHTML.appendChild(shineHTML);
11098			thisImg.appendChild(containerHTML);
11099			$(thisImg).wrap('<div class="parallaxImg-wrap" />');
11100			if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { $(thisImg).parent().append(shadowHTML); }
11101
11102			var w = thisImg.clientWidth || thisImg.offsetWidth || thisImg.scrollWidth;
11103			//thisImg.style.transform = 'perspective('+ w*3 +'px)';
11104
11105			if(supportsTouch && $('body.using-mobile-browser').length > 0 ){
11106				
11107		    } else {
11108		    	(function(_thisImg,_layers,_totalLayers,_shine) {
11109					$(thisImg).parents('.style-5').on('mousemove', function(e){
11110						
11111						var parentEl = $(this);
11112					 	var now = Date.now();
11113				        if (now > lastMove + eventThrottle) {
11114				            lastMove = now;
11115							window.requestAnimationFrame(function(){
11116								processMovement(e,false,_thisImg,_layers,_totalLayers,_shine,parentEl);		
11117							});
11118						}
11119
11120						//window.requestAnimationFrame(function(){
11121						//	processShineMovement(e,false,_thisImg,_layers,_totalLayers,_shine);		
11122						//});
11123					});
11124		            $(thisImg).parents('.style-5').on('mouseenter', function(e){
11125						processEnter(e,_thisImg,_layers,_totalLayers,_shine);		
11126					});
11127					$(thisImg).parents('.style-5').on('mouseleave', function(e){
11128						processExit(e,_thisImg,_layers,_totalLayers,_shine);		
11129					});
11130		        })(thisImg,layers,totalLayerElems,shineHTML);
11131		    }
11132
11133		    //set the depths
11134		    (function(_thisImg,_layers,_totalLayers,_shine) {
11135			    depths(false,_thisImg,_layers,_totalLayers,_shine);
11136			     window.addEventListener('resize', function(e){
11137			    	  depths(false,_thisImg,_layers,_totalLayers,_shine);
11138			    });
11139			 })(thisImg,layers,totalLayerElems,shineHTML);
11140		}
11141
11142		function processMovement(e, touchEnabled, elem, layers, totalLayers, shine, parentEl){
11143			
11144			//stop raf if exit already called
11145			if(!$(elem.firstChild).hasClass('over')) { processExit(e,elem,layers,totalLayers,shine); return false }
11146
11147			//set up multipliers
11148
11149			if($(elem).parents('.col.wide').length > 0 ) {
11150				var yMult = 0.03;
11151				var xMult = 0.063;
11152			} else if( $(elem).parents('.col.regular').length > 0  || $(elem).parents('.wpb_gallery').length > 0) {
11153				var yMult = 0.045;
11154				var xMult = 0.045;
11155			} else if($(elem).parents('.col.tall').length > 0 ) {
11156				var yMult = 0.05;
11157				var xMult = 0.015;
11158			} else if($(elem).parents('.col.wide_tall').length > 0) {
11159				var yMult = 0.04;
11160				var xMult = 0.04;
11161			} else if(parentEl.hasClass('nectar-fancy-box')) {
11162				var yMult = 0.045;
11163				var xMult = 0.022;
11164			} else {
11165				var yMult = 0.045;
11166				var xMult = 0.075;
11167			}
11168			
11169			var bdst = $(window).scrollTop(),
11170				bdsl = bd.scrollLeft,
11171				pageX = (touchEnabled)? e.touches[0].pageX : e.pageX,
11172				pageY = (touchEnabled)? e.touches[0].pageY : e.pageY,
11173				offsets = elem.getBoundingClientRect(),
11174				w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, // width
11175				h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, // height
11176				wMultiple = 320/w,
11177				offsetX = 0.52 - (pageX - offsets.left - bdsl)/w, //cursor position X
11178				offsetY = 0.52 - (pageY - offsets.top - bdst)/h, //cursor position Y
11179				dy = (pageY - offsets.top - bdst) - h / 2, //@h/2 = center of container
11180				dx = (pageX - offsets.left - bdsl) - w / 2, //@w/2 = center of container
11181				yRotate = (offsetX - dx)*(yMult * wMultiple), //rotation for container Y
11182				xRotate = (dy - offsetY)*(xMult * wMultiple); //rotation for container X //old
11183
11184				//imgCSS = ' rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateZ(0)'; //img transform
11185
11186				if($(elem).parents('.wpb_gallery').length > 0) {
11187					var imgCSS = ' perspective('+ w*3 +'px) rotateX(' + -xRotate*1.9 + 'deg) rotateY(' + -yRotate*1.3 + 'deg)'; //img transform	
11188				} else {
11189					if($(elem).parents('.wide_tall').length == 0 && $(elem).parents('.wide').length == 0 && $(elem).parents('.tall').length == 0) {
11190						var $scaleAmount = (parentEl.hasClass('nectar-fancy-box')) ? '1.06' : '1.03';
11191						var $offsetAmount = (parentEl.hasClass('nectar-fancy-box')) ? '-2' : '-10';
11192						
11193						var imgCSS = ' perspective('+ w*3 +'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg)  translateY('+offsetY*$offsetAmount+'px) translateX('+offsetX*$offsetAmount+'px) scale('+$scaleAmount+')'; //img transform
11194					} else {
11195						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	
11196					}
11197				}
11198				//imgCSS2 = 'perspective('+ w*3 +'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateZ(0) translateY('+offsetY*-10+'px) translateX('+offsetX*-10+'px)'; //img transform //old
11199
11200				
11201			//container transform
11202			if(elem.firstChild.className.indexOf(' over') != -1){
11203				if($(elem).parents('.portfolio-items.masonry-items').length > 0){
11204					//imgCSS2 = ' scale3d(1.025,1.025,1.025)';
11205				} else {
11206					//imgCSS2 = ' scale3d(1.06,1.06,1.06)';
11207				}
11208			
11209				
11210
11211			}
11212		
11213			//elem.firstChild.style.transform = imgCSS;
11214			$(elem).find('.parallaxImg-container').css('transform',imgCSS);
11215
11216			if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) {
11217				$(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform',imgCSS);
11218			}
11219			//elem.style.transform = imgCSS2;
11220
11221			
11222		}
11223
11224		function processShineMovement(e, touchEnabled, elem, layers, totalLayers, shine){
11225
11226		}
11227
11228		function processEnter(e, elem, layers, totalLayers, shine){
11229
11230			elem.firstChild.className += ' over';
11231			elem.className += ' over';
11232
11233			//if(Idx == -1) {
11234				//$('body').addClass('cssreflections');
11235				//$(elem).addClass('transition');
11236			//	//var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },150);
11237			//} else {
11238				$(elem).addClass('transition');
11239
11240				if($(elem).parents('.wpb_gallery').length > 0) {
11241					var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },450);
11242				} else {
11243					var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },200);
11244				}
11245			//}
11246
11247			//depths(false, elem, layers, totalLayers, shine);
11248		}
11249
11250		function processExit(e, elem, layers, totalLayers, shine){
11251
11252			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
11253			var container = elem.firstChild;
11254
11255			container.className = container.className.replace(' over','');
11256			elem.className = elem.className.replace(' over','');
11257			$(container).css('transform', 'perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
11258			$(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform','perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
11259
11260			$(elem).addClass('transition');
11261				var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },200);
11262
11263			//removeDepths(false, elem, layers, totalLayers, shine);
11264
11265		}
11266
11267		function depths(touchEnabled, elem, layers, totalLayers, shine) {
11268			
11269			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
11270			var revNum = totalLayers;
11271			var container = elem.firstChild;
11272			
11273			//set z
11274			for(var ly=0;ly<totalLayers;ly++){
11275				//layers[ly].style.transform = 'translateX(' + (offsetX * revNum) * ((ly * 2.5) / wMultiple) + 'px) translateY(' + (offsetY * totalLayers) * ((ly * 2.5) / wMultiple) + 'px) translateZ(0)';
11276				if(ly == 0) $(layers[ly]).css('transform', 'translateZ(0px)');
11277				else $(layers[ly]).css('transform','translateZ(' +(w*3)/27*(ly*1.1) + 'px) ');
11278
11279				revNum--;
11280			}
11281			
11282			totalLayers = totalLayers + 3;
11283
11284			//set perspective from beginning
11285			$(container).css('transform','perspective('+ w*3 +'px)');
11286
11287			//$(elem).parents('.col').find('.parallaxImg-shine').css('transform','translateZ('+(w*3)/70*(totalLayers*1.1) +'px)');
11288		}
11289
11290		function removeDepths(touchEnabled, elem, layers, totalLayers, shine) {
11291			
11292			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
11293			var revNum = totalLayers;
11294			
11295			//set z
11296			for(var ly=0;ly<totalLayers;ly++){
11297				
11298				if(ly == 0) $(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)');
11299				else $(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)');
11300
11301				revNum--;
11302			}
11303			
11304			totalLayers = totalLayers + 3;
11305			
11306		}
11307	}
11308
11309	style6Img();
11310
11311	function portfolioDeviceCheck(){
11312		if($('body').hasClass('mobile') || navigator.userAgent.match(/(iPad|IEMobile)/) ){
11313			
11314			//if using more details
11315			if($('.portfolio-items .col .work-item').find('a:not(".pp")').length > 0){
11316				$('.portfolio-items .col .work-item').find('a.pp').css('display','none');
11317			} 
11318			
11319			//if only using pp
11320			else {
11321				$('.portfolio-items .col .work-item').find('a:not(".pp")').css('display','none');
11322			}
11323		
11324		} else {
11325			$('.portfolio-items .col .work-item').find('a').css('display','inline');
11326		}
11327	}
11328	
11329	
11330	//portfolio fullscreen zoom slider
11331
11332	//remove outside of column setups 
11333	$('.nectar_fullscreen_zoom_recent_projects').each(function(){
11334		if($(this).parents('.span_12').find('> .wpb_column').length > 1){
11335			var $zoomProjects = $(this).clone();
11336			var $zoomProjectsRow = $(this).parents('.span_12');
11337			$(this).remove();
11338			$zoomProjectsRow.prepend($zoomProjects);
11339		}
11340	});
11341
11342	 $.fn.lines = function (opts) {
11343        var s = $.extend({
11344            'lineClass' : 'line'
11345        },opts);
11346        return this.each(function () {
11347            var self = this,
11348                $self = $(self),
11349                $line,
11350                $prev;
11351            $self.find('.' + s.lineClass).contents().unwrap();
11352            $self.html(function (i, h) {
11353                return h.replace(/(\b[\w']+\b)/g, '<span class="' + s.lineClass + '">$1</span>');
11354            });
11355
11356            $self.find('.line + .line').each(function(i, el){
11357                $line = $(this),
11358                $prev = $line.prev('.line');
11359                if ($line.offset().top === $prev.offset().top) {
11360                    $prev.append(el.previousSibling, $line.contents());
11361                    $line.remove();
11362                }
11363            });
11364        });
11365    };
11366
11367	function splitLineText() {
11368		$('.nectar_fullscreen_zoom_recent_projects, .nectar-recent-posts-single_featured.multiple_featured').each(function(){
11369			
11370			var $slideClass = ($(this).find('.project-slides').length > 0) ? '.project-slide' : '.nectar-recent-post-slide';
11371			var $slideInfoClass = ($(this).find('.project-slides').length > 0) ? '.project-info h1' : '.inner-wrap h2 a';
11372			
11373			$(this).find($slideClass).each(function(i){
11374
11375				$(this).find($slideInfoClass + ' > span > span.inner').unwrap();
11376
11377				$(this).find($slideInfoClass + ' > span').each(function(){
11378					var spantext = $(this).text();
11379   					 $(this).replaceWith(spantext);
11380				});
11381
11382				var spanInserted = $(this).find($slideInfoClass).html().split(" ").join(" </span> <span>");
11383				var wrapped = ("<span>").concat(spanInserted, "</span>");
11384				$(this).find($slideInfoClass).html(wrapped);
11385				var refPos = $(this).find($slideInfoClass + ' > span:first-child').position().top;
11386				var newPos;
11387
11388				$(this).find($slideInfoClass + ' > span').each(function(index) {
11389					if($(this).text().trim().length > 0) {
11390
11391					    newPos = $(this).position().top   
11392	
11393					    if (index == 0){
11394					       return;
11395					    }
11396					    if (newPos == refPos){
11397					        $(this).prepend($(this).prev().text());
11398					        $(this).prev().remove();
11399					    } 
11400					    refPos = newPos;
11401					} else {
11402						//remove empty space spans
11403						$(this).remove();
11404					}
11405				});
11406
11407				$(this).find($slideInfoClass + ' > span').wrapInner('<span class="inner" />');
11408
11409			});
11410		});
11411		
11412	}
11413
11414	function portfolioFullScreenSliderCalcs() {
11415
11416		var $bodyBorderSize = ($('.body-border-top').length > 0 && $(window).width() > 1000) ? $('.body-border-top').height(): 0;
11417
11418		$('.nectar_fullscreen_zoom_recent_projects').each(function(){
11419			if($(this).parents('.first-section').length > 0) {
11420				$(this).css('height',$(window).height() - $(this).offset().top - $bodyBorderSize);
11421			} else {
11422				$(this).css('height',$(window).height());
11423			}
11424		});
11425
11426	}
11427
11428				
11429	function nectarCustomSliderRotate(slider){
11430		var $controlSelector = (slider.find('.project-slides').length > 0) ? '.dot-nav > span' : '.controls > li';
11431		var $controlSelectorInd = (slider.find('.project-slides').length > 0) ? 'span' : ' li';
11432		
11433		var $slideLength = slider.find($controlSelector).length;
11434		var $currentSlide = slider.find($controlSelector+'.active').index();
11435		if( $currentSlide+1 == $slideLength) {
11436			slider.find($controlSelector+':first-child').click();
11437		} else {
11438			slider.find($controlSelector+'.active').next($controlSelectorInd).click();
11439		}
11440	}
11441	
11442	function nectarCustomSliderResetRotate(slider){
11443		clearInterval($nectarCustomSliderRotate);
11444
11445		//reinit autorotate
11446		if(slider.attr('data-autorotate').length > 0) {
11447			slide_interval = (parseInt(slider.attr('data-autorotate')) < 100) ? 4000 : parseInt(slider.attr('data-autorotate'));
11448			$nectarCustomSliderRotate = setInterval(function(){ nectarCustomSliderRotate(slider) },slide_interval);
11449		}
11450	}
11451
11452
11453	if($('.nectar_fullscreen_zoom_recent_projects').length > 0){
11454		portfolioFullScreenSliderCalcs();
11455		splitLineText();
11456		$(window).resize(splitLineText);
11457		$(window).resize(portfolioFullScreenSliderCalcs);
11458	}
11459
11460	$('.nectar_fullscreen_zoom_recent_projects').each(function(){
11461
11462
11463		var $projLength = $(this).find('.project-slide').length;
11464
11465		//autorotate
11466		if($(this).attr('data-autorotate').length > 0) {
11467			slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
11468			var $that = $(this);
11469			$nectarCustomSliderRotate = setInterval(function(){ nectarCustomSliderRotate($that) },slide_interval);
11470		}
11471
11472		//next/prev
11473		$(this).find('.zoom-slider-controls .next').click(function(){
11474
11475			//thres
11476			
11477			var $that = $(this);
11478			if(!$that.parent().hasClass('timeout')) {
11479				setTimeout(function(){
11480					$that.parent().removeClass('timeout');
11481				},1150);
11482			}
11483
11484			if($(this).parent().hasClass('timeout')) return false;
11485			$(this).parent().addClass('timeout');
11486			//switch logic
11487
11488			nectarCustomSliderResetRotate($that.parents('.nectar_fullscreen_zoom_recent_projects'));
11489			
11490			var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current');
11491			var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects');
11492
11493			$sliderInstance.find('.project-slide').removeClass('next').removeClass('prev');
11494			$sliderInstance.find('.project-slide').each(function(i){
11495
11496				if(i < $current.index()+1 && $current.index()+1 < $projLength)
11497					$(this).addClass('prev');
11498				else
11499					$(this).addClass('next');
11500			});
11501
11502			if($current.index()+1 == $projLength) {
11503				$sliderInstance.find('.project-slide:first-child').addClass('no-trans');
11504			}
11505
11506			setTimeout(function(){
11507
11508				if($current.index()+1 == $projLength) {
11509					$sliderInstance.find('.project-slide:first-child').removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
11510					$sliderInstance.find('.project-slide:last-child').removeClass('next').removeClass('current').addClass('prev');
11511				} else {
11512					$current.next('.project-slide').removeClass('next').removeClass('prev').addClass('current');
11513					$current.removeClass('current').addClass('prev');
11514				}
11515
11516				//update dot nav
11517				if($sliderInstance.find('.dot-nav').length > 0) {
11518					$sliderInstance.find('.dot-nav span.active').removeClass('active');
11519					$sliderInstance.find('.dot-nav span:nth-child('+ ($sliderInstance.find('.project-slide.current').index() + 1) +')').addClass('active');
11520				}
11521
11522			},30);
11523
11524			return false;
11525			
11526		});
11527
11528		$(this).find('.zoom-slider-controls .prev').click(function(){
11529
11530			//thres
11531			var $that = $(this);
11532			if(!$that.parent().hasClass('timeout')) {
11533				setTimeout(function(){
11534					$that.parent().removeClass('timeout');
11535				},1150);
11536			}
11537
11538			if($(this).parent().hasClass('timeout')) return false;
11539			$(this).parent().addClass('timeout');
11540			
11541			nectarCustomSliderResetRotate($that.parents('.nectar_fullscreen_zoom_recent_projects'));
11542
11543			//switch logic
11544			var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current');
11545			var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects');
11546
11547			
11548			$sliderInstance.find('.project-slide').removeClass('next').removeClass('prev');
11549			$sliderInstance.find('.project-slide').each(function(i){
11550
11551				if(i < $current.index() || $current.index() == 0)
11552					$(this).addClass('prev');
11553				else
11554					$(this).addClass('next');
11555			});
11556
11557			if($current.index() == 0)
11558				$sliderInstance.find('.project-slide:last-child').addClass('no-trans');
11559
11560			setTimeout(function(){
11561
11562				if($current.index() == 0) {
11563					$sliderInstance.find('.project-slide:last-child').removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
11564					$sliderInstance.find('.project-slide:first-child').removeClass('next').removeClass('prev').removeClass('current').addClass('next');
11565				} else {
11566					$current.prev('.project-slide').removeClass('next').removeClass('prev').addClass('current');
11567					$current.removeClass('current').addClass('next');
11568				}
11569
11570				//update dot nav
11571				if($sliderInstance.find('.dot-nav').length > 0) {
11572					$sliderInstance.find('.dot-nav span.active').removeClass('active');
11573					$sliderInstance.find('.dot-nav span:nth-child('+ ($sliderInstance.find('.project-slide.current').index() + 1) +')').addClass('active');
11574				}
11575
11576			},30);
11577
11578
11579			return false;
11580
11581		});
11582
11583		//pagination
11584		//if($(this).is('[data-slider-controls="both"]') || $(this).is('[data-slider-controls="pagination"]')) {
11585			$(this).find('> .normal-container').append('<div class="dot-nav"></div>');
11586			for(var $i=0;$i < $projLength;$i++) {
11587				if($i == 0) {
11588					$(this).find('.dot-nav').append('<span class="dot active"><span></span></span>');
11589				} else {
11590					$(this).find('.dot-nav').append('<span class="dot"><span></span></span>');
11591				}
11592		
11593			}
11594		//}
11595
11596		var $dotIndex = 1;
11597
11598		$('.nectar_fullscreen_zoom_recent_projects .dot-nav > span').click(function(){
11599
11600			if($(this).hasClass('active')) return;
11601
11602			//thres
11603			var $that = $(this);
11604			if(!$that.parent().hasClass('timeout')) {
11605				setTimeout(function(){
11606					$that.parent().removeClass('timeout');
11607				},1150);
11608			}
11609
11610			if($(this).parent().hasClass('timeout')) return;
11611			$(this).parent().addClass('timeout');
11612
11613			nectarCustomSliderResetRotate($that.parents('.nectar_fullscreen_zoom_recent_projects'));
11614
11615			//switch logic
11616			$(this).parent().find('span.active').removeClass('active');
11617			$(this).addClass('active');
11618
11619			$dotIndex = $(this).index() + 1;
11620
11621			var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current');
11622			var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects');
11623
11624			var $prevIndex = $current.index() + 1;
11625
11626			$sliderInstance.find('.project-slide').removeClass('next').removeClass('prev');
11627
11628			$sliderInstance.find('.project-slide').each(function(i){
11629				if(i < $dotIndex-1)
11630					$(this).addClass('prev');
11631				else
11632					$(this).addClass('next');
11633			});
11634
11635			//going prev
11636			if($prevIndex > $dotIndex) {
11637				$sliderInstance.find('.project-slide').eq($dotIndex-1).addClass('no-trans').addClass('prev').removeClass('next');
11638				setTimeout(function(){
11639					$sliderInstance.find('.project-slide').eq($dotIndex-1).removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
11640					$current.removeClass('current').addClass('next');
11641				},30);
11642			
11643			} 
11644
11645			//going forawrd
11646			else {
11647				$sliderInstance.find('.project-slide').eq($dotIndex-1).addClass('no-trans').addClass('next').removeClass('prev');
11648				setTimeout(function(){
11649					$sliderInstance.find('.project-slide').eq($dotIndex-1).removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
11650					$current.removeClass('current').addClass('prev');
11651				},30);
11652
11653			}
11654			
11655		});	
11656
11657
11658	});
11659
11660	
11661 	
11662
11663	//portfolio accent color
11664	function portfolioAccentColor() {
11665
11666		var portfolioSocialColorCss = '';
11667
11668		$('.portfolio-items .col').each(function(){
11669			if ($(this).has('[data-project-color]')) { 
11670				$(this).find('.work-info-bg, .bottom-meta').css('background-color',$(this).attr('data-project-color'));
11671
11672				//style5
11673				$(this).find('.parallaxImg-rendered-layer .bg-overlay').css('border-color',$(this).attr('data-project-color'));
11674
11675				var	$projColor = $(this).attr('data-project-color');
11676				if($(this).find('.custom-content .nectar-social').length > 0 && $('body[data-button-style="rounded"]') ) portfolioSocialColorCss += 'body[data-button-style="rounded"] .col[data-
11676project-color="'+$projColor+'"] .custom-content .nectar-social > *:hover i { color: '+ $projColor +'!important; } ';
11677
11678			}
11679		});
11680		
11681		if(portfolioSocialColorCss.length > 1) {
11682
11683			var head = document.head || document.getElementsByTagName('head')[0];
11684			var style = document.createElement('style');
11685
11686				style.type = 'text/css';
11687			if (style.styleSheet){
11688			  style.styleSheet.cssText = portfolioSocialColorCss;
11689			} else {
11690			  style.appendChild(document.createTextNode(portfolioSocialColorCss));
11691			}
11692
11693			head.appendChild(style);
11694		}
11695	}
11696	portfolioAccentColor();
11697	
11698	//portfolio sort
11699	$('body').on('mouseenter','.portfolio-filters',function(){
11700		$(this).find('> ul').stop(true,true).slideDown(500,'easeOutExpo');
11701		$(this).find('a#sort-portfolio span').html($(this).find('a#sort-portfolio').attr('data-sortable-label'));
11702	});
11703
11704	$('body').on('mouseleave','.portfolio-filters',function(){
11705		var $activeCat = $(this).find('a.active').html();
11706		if( typeof $activeCat == 'undefined' || $activeCat.length == 0) $activeCat = $(this).attr('data-sortable-label');
11707		$(this).find('a#sort-portfolio span').html($activeCat);
11708		$(this).find('> ul').stop(true,true).slideUp(500,'easeOutExpo');
11709	});
11710	
11711	//portfolio selected category
11712	$('body').on('click','.portfolio-filters ul li a', function(){
11713		$(this).parents('.portfolio-filters').find('#sort-portfolio span').html($(this).html());
11714	});
11715	
11716	//portfolio prevent jump on parent dropdown click
11717	$('body').on('click','.portfolio-filters > a#sort-portfolio', function(){
11718		return false;
11719	});
11720	
11721	//inline portfolio selected category
11722	$('body').on('click','.portfolio-filters-inline ul li a',function(){
11723
11724		$(this).parents('ul').find('li a').removeClass('active');
11725		$(this).addClass('active');
11726		$(this).parents('.portfolio-filters-inline').find('#current-category').html($(this).html());
11727		
11728	});
11729	
11730
11731	function portfolioFiltersInit() {
11732		//mobile sort menu fix
11733		if($('body').hasClass('mobile') || navigator.userAgent.match(/(iPad|IEMobile)/)){
11734			$('.portfolio-filters').unbind('mouseenter mouseleave');
11735			$('.portfolio-filters > a, .portfolio-filters ul li a').click(function(e){
11736				if(e.originalEvent !== undefined) $(this).parents('.portfolio-filters').find('> ul').stop(true,true).slideToggle(600,'easeOutCubic');
11737			});
11738		}
11739
11740		if($('.portfolio-filters-inline[data-alignment="left"]').length > 0 || $('.portfolio-filters-inline[data-alignment="center"]').length > 0) {
11741			$('.portfolio-filters-inline .container > ul > li:nth-child(1) a').click();
11742		} else {
11743			$('.portfolio-filters-inline .container > ul > li:nth-child(2) a').click();
11744		}
11745		
11746		//portfolio more details page menu highlight
11747		$('body.single-portfolio #header-outer nav > ul > li > a:contains("Portfolio")').parents('li').addClass('current-menu-item');
11748		
11749		//blog page highlight
11750		$('body.single-post #header-outer nav > ul > li > a:contains("Blog")').parents('li').addClass('current-menu-item');
11751	}
11752
11753	portfolioFiltersInit();
11754
11755	
11756	//blog love center
11757	function centerLove(){
11758		$('.post').each(function(){
11759			
11760			var $loveWidth = $(this).find('.post-meta .nectar-love').outerWidth();
11761			var $loveWrapWidth = $(this).find('.post-meta  .nectar-love-wrap').width();
11762			
11763			//center
11764			$(this).find('.post-meta .nectar-love').css('margin-left', $loveWrapWidth/2 - $loveWidth/2 + 'px' );
11765			$(this).find('.nectar-love-wrap').css('visibility','visible');
11766		});
11767	}
11768	
11769	$('.nectar-love').on('click',function(){
11770		centerLove();
11771	});
11772	
11773	centerLove();	
11774	
11775
11776	//portfolio single comment order
11777	function portfolioCommentOrder(){
11778	
11779		if($('body').hasClass('mobile') && $('body').hasClass('single-portfolio') && $('#respond').length > 0){
11780			$('#sidebar').insertBefore('.comments-section');
11781		}
11782		 
11783		else if($('body').hasClass('single-portfolio') && $('#respond').length > 0) {
11784			$('#sidebar').insertAfter('.post-area');
11785		}
11786		
11787	}
11788
11789	 portfolioCommentOrder();
11790	 
11791	
11792	//portfolio sidebar follow
11793	
11794	var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
11795	
11796	function portfolioSidebarFollow(){
11797
11798		sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
11799	
11800		if( $('body.single-portfolio').length > 0 && sidebarFollow == 1 && !$('body').hasClass('mobile') && parseInt($('#sidebar').height()) + 50 <= parseInt($('.post-area').height())) {
11801			
11802			 $('#sidebar').addClass('fixed-sidebar');
11803			 
11804			 var $footer = ($('.comment-wrap.full-width-section').length == 0) ? '#footer-outer' : '.comment-wrap';
11805			 if( $('#call-to-action').length > 0 ) $footer = '#call-to-action';
11806			 
11807			 //convert width into px
11808			 sidebarPxConversion();
11809			 
11810			 $('#sidebar').stickyMojo({footerID: $footer, contentID: '.post-area'});
11811			 
11812		}
11813		
11814	}
11815	
11816	function sidebarPxConversion(){
11817		
11818		if( $('body.single-portfolio').length > 0 && sidebarFollow == 1 && !$('body').hasClass('mobile') ) {
11819			
11820			var $containerWidth = $('.main-content > .row').width();
11821			var $sidebarWidth = $containerWidth*.235;
11822			
11823			if(window.innerWidth > 1300){
11824				$sidebarWidth = $containerWidth*.235;
11825			} else if(window.innerWidth < 1300 && window.innerWidth > 1000 ) {
11826				$sidebarWidth = $containerWidth*.273;
11827			}
11828			
11829			$('#sidebar').css('width',$sidebarWidth+'px');
11830		}
11831	}
11832	
11833	$(window).load(function(){
11834		setTimeout(portfolioSidebarFollow,200);
11835	});
11836	
11837	
11838	//remove the portfolio filters that are not found in the current page
11839	function isotopeCatSelection() {
11840
11841
11842		$('.portfolio-items:not(".carousel")').each(function(){
11843
11844			var isotopeCatArr = [];
11845			var $portfolioCatCount = 0;
11846			$(this).parent().parent().find('div[class^=portfolio-filters] ul li').each(function(i){
11847				if($(this).find('a').length > 0) {
11848					isotopeCatArr[$portfolioCatCount] = $(this).find('a').attr('data-filter').substring(1);	
11849					$portfolioCatCount++;
11850				}
11851			});
11852			
11853			////ice the first (all)
11854			isotopeCatArr.shift();
11855			
11856			
11857			var itemCats = '';
11858			
11859			$(this).find('> div').each(function(i){
11860				itemCats += $(this).attr('data-project-cat');
11861			});
11862			itemCats = itemCats.split(' ');
11863			
11864			////remove the extra item on the end of blank space
11865			itemCats.pop();
11866			
11867			////make sure the array has no duplicates
11868			itemCats = $.unique(itemCats);
11869			
11870			////if user has chosen a set of filters to display - only show those
11871			if($(this).attr('data-categories-to-show').length != 0 && $(this).attr('data-categories-to-show') != 'all') {
11872				$userSelectedCats = $(this).attr('data-categories-to-show').replace(/,/g , ' ');
11873				$userSelectedCats = $userSelectedCats.split(' ');
11874				
11875				if(!$(this).hasClass('infinite_scroll')) $(this).removeAttr('data-categories-to-show');
11876			} else {
11877				$userSelectedCats = itemCats;
11878			}
11879			
11880			
11881			////Find which categories are actually on the current page
11882			var notFoundCats = [];
11883			$.grep(isotopeCatArr, function(el) {
11884
11885		    	if ($.inArray(el, itemCats) == -1) notFoundCats.push(el);
11886		    	if ($.inArray(el, $userSelectedCats) == -1) notFoundCats.push(el);
11887
11888			});
11889			
11890			//manipulate the list
11891			if(notFoundCats.length != 0){
11892				$(this).parent().parent().find('div[class^=portfolio-filters] ul li').each(function(){
11893					if($(this).find('a').length > 0) {
11894						if( $.inArray($(this).find('a').attr('data-filter').substring(1), notFoundCats) != -1 ){ 
11895							$(this).hide(); 
11896						} else {
11897							$(this).show();
11898						}
11899					}
11900				})
11901			}
11902		});
11903	}
11904	
11905	isotopeCatSelection();
11906	
11907	
11908	//sharing buttons
11909
11910	var completed = 0;
11911	var windowLocation = window.location.href.replace(window.location.hash, '');
11912
11913	function facebookShare(){
11914		windowLocation = window.location.href.replace(window.location.hash, '');
11915		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" ) 
11916		return false;
11917	}
11918
11919	function googlePlusShare(){
11920		windowLocation = window.location.href.replace(window.location.hash, '');
11921		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" ) 
11922		return false;
11923	}
11924
11925	function twitterShare(){
11926        windowLocation = window.location.href.replace(window.location.hash, '');		
11927		if($(".section-title h1").length > 0) {
11928			var $pageTitle = encodeURIComponent($(".section-title h1").text());
11929		} else {
11930			var $pageTitle = encodeURIComponent($(document).find("title").text());
11931		}
11932		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" ) 
11933		return false;
11934	}
11935
11936	function wooTwitterShare(){
11937		windowLocation = window.location.href.replace(window.location.hash, '');
11938		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" ) 
11939		return false;
11940	}
11941
11942	function linkedInShare(){
11943	    windowLocation = window.location.href.replace(window.location.hash, '');	
11944		if($(".section-title h1").length > 0) {
11945			var $pageTitle = encodeURIComponent($(".section-title h1").text());
11946		} else {
11947			var $pageTitle = encodeURIComponent($(document).find("title").text());
11948		}
11949		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" ) 
11950		return false;
11951	}
11952
11953	function woolinkedInShare(){
11954	    windowLocation = window.location.href.replace(window.location.hash, '');	
11955		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" ) 
11956		return false;
11957	}
11958
11959	function pinterestShare(){
11960		windowLocation = window.location.href.replace(window.location.hash, '');
11961		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'); 
11962		
11963		if($(".section-title h1").length > 0) {
11964			var $pageTitle = encodeURIComponent($(".section-title h1").text());
11965		} else {
11966			var $pageTitle = encodeURIComponent($(document).find("title").text());
11967		}
11968		
11969		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" ) 
11970		return false;
11971	}
11972	
11973	function wooPinterestShare(){
11974		$imgToShare = ($('img.attachment-shop_single').length > 0) ? $('img.attachment-shop_single').first().attr('src') : $('.single-product-main-image img').first().attr('src');
11975		windowLocation = window.location.href.replace(window.location.hash, '');
11976		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" ) 
11977		return false;
11978	}
11979
11980
11981	function socialFade(){
11982			if(completed == $('a.nectar-sharing').length && $('a.nectar-sharing').parent().hasClass('in-sight')) {
11983
11984
11985					//love fadein
11986					$('.nectar-social .nectar-love span').show(350,'easeOutSine',function(){
11987						$(this).stop().animate({'opacity':1},800);
11988					});
11989					
11990					//sharing loadin
11991					$('.nectar-social > a').each(function(i){
11992						var $that = $(this);
11993						
11994						$(this).find('> span').show(350,'easeOutSine',function(){
11995							$that.find('> span').stop().animate({'opacity':1},800);
11996						});
11997						
11998					});
11999
12000
12001				//alt blog layout total share count
12002				var $totalShares = 0;
12003				$('.nectar-social > a .count').each(function(){
12004					$totalShares += parseInt($(this).html());
12005				});
12006
12007				if($totalShares != 1){
12008					$('.single .meta-share-count .plural').css({'opacity':'1', 'display':'inline'});
12009					$('.single .meta-share-count .singular').remove();
12010				} else {
12011					$('.single .meta-share-count .singular').css({'opacity':'1', 'position':'relative',  'display':'inline'});
12012					$('.single .meta-share-count .plural').remove();
12013				}
12014
12015				$('.meta-share-count .share-count-total').html($totalShares).css('opacity',1);
12016			}
12017		}
12018
12019	$('body').on('click','#single-below-header .nectar-social a', function(){ return false; });
12020
12021	$('body').on('click','.facebook-share:not(.inactive)', facebookShare);
12022	$('body').on('click','.google-plus-share:not(.inactive)', googlePlusShare);
12023	$('body').on('click','.nectar-social:not(".woo") .twitter-share:not(.inactive)', twitterShare);
12024	$('body').on('click','.nectar-social.woo .twitter-share', wooTwitterShare);
12025	$('body').on('click','.nectar-social:not(".woo") .linkedin-share:not(.inactive)', linkedInShare);
12026	$('body').on('click','.nectar-social.woo .linkedin-share', woolinkedInS
12026hare);
12027	$('body').on('click','.nectar-social:not(".woo") .pinterest-share:not(.inactive)', pinterestShare);
12028	$('body').on('click','.nectar-social.woo .pinterest-share', wooPinterestShare);
12029	$('body').on('click','.nectar-social-sharing-fixed > a', function(){ return false; });
12030
12031	function socialSharingInit() {
12032
12033		//mobile fullscreen blog class for click event fix
12034		if($('body').hasClass('mobile') && $('.single-post .fullscreen-header').length > 0) {
12035			$('#single-below-header .nectar-social .nectar-sharing, #single-below-header .nectar-social .nectar-sharing-alt').addClass('inactive');
12036		}
12037
12038		completed = 0;
12039
12040		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) {
12041  
12042		 
12043			////facebook
12044			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) {
12045				
12046				//load share count on load  
12047				$.getJSON("https://graph.facebook.com/?id="+ windowLocation +"&callback=?", function(data) {
12048					if( data.share != undefined && data.share.share_count != undefined && data.share.share_count != 0 && (data.share.share_count != null)) { 
12049						$('.facebook-share a span.count, a.facebook-share span.count').html( data.share.share_count );	
12050					}
12051					else {
12052						$('.facebook-share a span.count, a.facebook-share span.count').html( 0 );	
12053					}
12054					completed++;
12055					socialFade();
12056				});
12057			 
12058				
12059				
12060			} else if($('a.facebook-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.facebook-share').length > 0) {
12061				completed++;
12062				socialFade();
12063			}
12064			
12065			
12066			////twitter
12067			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) {
12068				//load tweet count on load 
12069				//$.getJSON('https://cdn.api.twitter.com/1/urls/count.json?url='+windowLocation+'&callback=?', function(data) {
12070				//	if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
12071					//	$('.twitter-share a span.count, a.twitter-share span.count').html( data.count );
12072					//}
12073					//else {
12074					$('.twitter-share a span.count, a.twitter-share span.count').html( 0 );
12075					//}
12076					completed++;
12077					socialFade();
12078				//});
12079
12080
12081			} else if($('a.twitter-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.twitter-share').length > 0 ) {
12082				completed++;
12083				socialFade();
12084			}
12085			
12086			
12087			////linkedIn
12088			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) {
12089				//load share count on load 
12090				//$.getJSON('https://www.linkedin.com/countserv/count/share?url='+windowLocation+'&callback=', function(data) {
12091				//	if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
12092				//		$('.linkedin-share a span.count, a.linkedin-share span.count').html( data.count );
12093				//	}
12094				//	else {
12095						$('.linkedin-share a span.count, a.linkedin-share span.count').html( 0 );
12096				//	}
12097					completed++;
12098					socialFade();
12099				//});
12100
12101				
12102			} else if($('a.linkedin-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.linkedin-share').length > 0) {
12103				completed++;
12104				socialFade();
12105			}
12106			
12107			
12108			////pinterest
12109			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) {
12110				//load pin count on load 
12111				$.getJSON('https://api.pinterest.com/v1/urls/count.json?url='+windowLocation+'&callback=?', function(data) {
12112					if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
12113						$('.pinterest-share a span.count, a.pinterest-share span.count').html( data.count );
12114					}
12115					else {
12116						$('.pinterest-share a span.count, a.pinterest-share span.count').html( 0 );
12117					}
12118					completed++;
12119					socialFade();
12120				});
12121
12122			} else if($('a.pinterest-share').length > 0 && $('body[data-button-style="rounded"]').length >  0 || $('.sharing-default-minimal a.pinterest-share').length > 0) {
12123				completed++;
12124				socialFade();
12125
12126			}
12127
12128		//fadeIn
12129		$('a.nectar-sharing > span.count, a.nectar-sharing-alt > span.count').hide().css('width','auto');
12130
12131
12132		//social light up
12133		$('.nectar-social').each(function() {
12134			if($(this).parents('.custom-content').length == 0) {
12135
12136
12137				var $that = $(this);
12138				var waypoint = new Waypoint({
12139	 			element: $that,
12140	 			 handler: function(direction) {
12141
12142					$slide_timeout = ($('#page-header-bg[data-animate-in-effect="slide-down"] .nectar-social').length > 0 ) ? 900 : 1;
12143
12144					setTimeout(function(){
12145
12146						$that.addClass('in-sight');
12147						socialFade();
12148						
12149						if($('#page-header-bg .nectar-social').length == 0) {
12150							$that.find('> *').each(function(i){
12151								
12152								var $that = $(this);
12153								var $timeout = ($('body[data-button-style="rounded"]').length > 0) ? 0: 750;
12154
12155								setTimeout(function(){ 
12156									
12157									$that.delay(i*80).queue(function(){ 
12158										
12159										var $that = $(this); $(this).addClass('hovered'); 
12160										
12161										setTimeout(function(){ 
12162											$that.removeClass('hovered');
12163										},300); 
12164										
12165									});
12166								
12167								},$timeout);
12168							});
12169						}
12170
12171					},$slide_timeout );
12172
12173					$that.addClass('animated-in');
12174					waypoint.destroy();
12175				},
12176				offset: 'bottom-in-view'
12177
12178			}); 
12179
12180
12181				
12182			}
12183			}); 
12184
12185		}
12186
12187	}
12188	
12189	socialSharingInit();
12190
12191
12192	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
12193
12194		var $socialTimeout;
12195		$('body').on('mouseenter','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
12196			clearTimeout($socialTimeout);
12197
12198			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
12199				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'right':'0px'},0);
12200			else 
12201				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'left':'0px'},0);
12202
12203			$(this).parents('[id*="-meta"]').addClass('social-hovered');
12204
12205			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':0},250);
12206			$(this).find('.nectar-social a').each(function(i){
12207				$(this).stop(true).delay(i*40).animate({'opacity': 1,  'left':'0px'}, 150);
12208			});
12209
12210		});
12211
12212	
12213		$('body').on('mouseleave','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
12214			$(this).parents('[id*="-meta"]').removeClass('social-hovered');
12215
12216			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
12217				$(this).find('.nectar-social').stop(true).animate({'opacity': 0,  'right':'-20px'}, 200);
12218			else 
12219				$(this).find('.nectar-social').stop(true).animate({'opacity': 0,  'left':'-20px'}, 200);
12220
12221			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':1},250);
12222
12223			var $that = $(this);
12224			
12225			$socialTimeout = setTimeout(function(){ 
12226				$that.find('.nectar-social').hide(); 
12227				if($that.parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
12228					$that.find('.nectar-social a').stop(true).animate({'opacity': 0,  'left':'20px'},0);   
12229				else 
12230					$that.find('.nectar-social a').stop(true).animate({'opacity': 0,  'left':'-20px'},0);   
12231			}, 200);
12232		});
12233	} else {
12234		var $socialTimeout;
12235		$('body').on('click','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
12236			clearTimeout($socialTimeout);
12237
12238			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
12239				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'right':'0px'},0);
12240			else 
12241				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'left':'0px'},0);
12242
12243			$(this).parents('[id*="-meta"]').addClass('social-hovered');
12244
12245			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':0},250);
12246			$(this).find('.nectar-social a').each(function(i){
12247				$(this).stop(true).delay(i*40).animate({'opacity': 1,  'left':'0px'}, 150);
12248			});
12249
12250			return false;
12251		});
12252
12253	}
12254
12255	$('body').on('mouseenter','.fullscreen-header  .meta-share-count', function(){
12256		$(this).find('> a, > i').stop(true).animate({'opacity': 0},400);
12257		$(this).find('.nectar-social > *').each(function(i){
12258			$(this).stop(true).delay(i*50).animate({'opacity':'1', 'top': '0px'},250,'easeOutCubic');
12259		});
12260		//allow clickable on mobile
12261		setTimeout(function(){ $('.meta-share-count .nectar-sharing, .meta-share-count .nectar-sharing-alt').removeClass('inactive'); },300);
12262	});
12263
12264	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
12265		$('body').on('mouseleave','.fullscreen-header  .meta-share-count', function(){
12266			$(this).find('> a, > i').stop(true).animate({'opacity': 1},300,'easeInCubic');
12267			$(this).find('.nectar-social > *').each(function(i){
12268				$(this).stop(true).animate({'opacity':'0', 'top': '10px'},200,'easeInCubic');
12269			});
12270		});
12271	}
12272
12273	//full width love center
12274	function nectarLoveFWCenter(){
12275		$('.nectar-social.full-width').each(function(){ 
12276			$(this).find('.n-shortcode .nectar-love').css('padding-top', $(this).find('> a').css('padding-top'));
12277		});
12278	}
12279	
12280	nectarLoveFWCenter();
12281	
12282
12283	//-----------------------------------------------------------------
12284	// NectarLove
12285	//-----------------------------------------------------------------
12286	
12287	////love iwth txt
12288	$('.fullscreen-header .nectar-love').each(function(){
12289		if($(this).find('.nectar-love-count').text() == '1') {
12290			$(this).find('span.love-txt.single').css({'visibility':'visible', 'text-indent':'0'});
12291			$(this).find('span.love-txt.plural').css({'visibility':'hidden', 'text-indent':'-9999px'});
12292		} else {
12293			$(this).find('span.love-txt.single').css({'visibility':'hidden', 'text-indent':'-9999px'});
12294			$(this).find('span.love-txt.plural').css({'visibility':'visible', 'text-indent':'0'});
12295		}
12296	});
12297
12298	$('body').on('click','.nectar-love', function() {
12299			
12300
12301			var $loveLink = $(this);
12302			var $id = $(this).attr('id');
12303			var $that = $(this);
12304			
12305			if($loveLink.hasClass('loved')) return false;
12306			if($(this).hasClass('inactive')) return false;
12307			
12308			var $dataToPass = {
12309				action: 'nectar-love', 
12310				loves_id: $id,
12311				love_nonce: nectarLove.loveNonce
12312			}
12313			
12314			$.post(nectarLove.ajaxurl, $dataToPass, function(data){
12315				$loveLink.find('span:not(.love-txt)').html(data);
12316				$loveLink.addClass('loved').attr('title','You already love this!');
12317				$loveLink.find('span:not(.love-txt)').css({'opacity': 1,'width':'auto'});
12318
12319				if($(data).text() == '1') {
12320					$loveLink.find('span.love-txt.single').css({'visibility':'visible', 'text-indent':'0'});
12321					$loveLink.find('span.love-txt.plural').css({'visibility':'hidden', 'text-indent':'-9999px'});
12322				} else {
12323					$loveLink.find('span.love-txt.single').css({'visibility':'hidden', 'text-indent':'-9999px'});
12324					$loveLink.find('span.love-txt.plural').css({'visibility':'visible', 'text-indent':'0'});
12325				}
12326
12327				//ascend
12328				if($('body').hasClass('ascend') && $that.parents('.classic_enhanced').length == 0 ){
12329					$that.find('.icon-salient-heart-2').addClass('loved');
12330				} else if($that.parents('.classic_enhanced').length > 0 ) {
12331					$that.find('.icon-salient-heart-2').addClass('loved');
12332				}
12333			});
12334			
12335			$(this).addClass('inactive');
12336			
12337			return false;
12338	});
12339
12340
12341	
12342	//infinite scroll
12343	function infiniteScrollInit() {
12344
12345		if($('.infinite_scroll').length > 0) {
12346			
12347			//portfolio
12348			$('.portfolio-items.infinite_scroll').infinitescroll({
12349		    	navSelector  : "div#pagination",            
12350		   	    nextSelector : "div#pagination a:first",    
12351		   	    itemSelector : ".portfolio-items.infinite_scroll .element",
12352		   	    finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
12353		        msgText: " ",         
12354		   },function(newElements){
12355		   	
12356
12357				var $container = $('.portfolio-items.infinite_scroll:not(.carousel)');
12358				//loading effect   
12359
12360		        var $newElems = $( newElements ).css('opacity',0);
12361		        //// ensure that images load before adding to masonry layout
12362		        $newElems.imagesLoaded(function(){
12363		          
12364		          $( newElements ).css('opacity',1);
12365
12366		          $container.isotope( 'appended', $( newElements ));
12367		          
12368		          $( newElements ).find('.work-item').addClass('ajax-loaded');
12369		          $( newElements ).addClass('ajax-loaded');
12370		          ///// show elems now they're ready
12371		          
12372		          $(newElements).find('.work-meta, .nectar-love-wrap').css({'opacity':1});
12373		          
12374		          //keep filtering
12375		          if($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) {
12376		          	
12377		          	  if($('.portfolio-filters-inline').length > 0) {
12378		          	  	 var selector = $('.portfolio-filters-inline a.active').attr('data-filter');
12379		          	  } else {
12380		          	  	 var selector = $('.portfolio-filters a.active').attr('data-filter');
12381		          	  }
12382		          	  
12383		          	  $('.portfolio-filters-inline a.active').attr('data-filter');
12384			  	 	  $container.isotope({ filter: selector });
12385		          }
12386		          
12387			  	//set width
12388			  	//portfolioItemWidths();
12389			  	reLayout();
12390
12391		        if($(newElements).find('.work-item.style-5').length > 0) style6Img();
12392
12393	          	if($(newElements).find('.inner-wrap').attr('data-animation') == 'none') {
12394					$('.portfolio-items .col .inner-wrap').removeClass('animated');
12395				} else {
12396
12397					masonryZindex();
12398					$(newElements).each(function(i){
12399
12400						//not already visible
12401						var $that = $(this);
12402						var waypoint = new Waypoint({
12403			 			element: $that,
12404			 			 handler: function(direction) {
12405							
12406							var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 115;
12407						
12408							setTimeout(function(){
12409								$that.addClass("animated-in");
12410							},$portfolioAnimationDelay * $that.attr('data-delay-amount'));
12411						
12412							
12413							waypoint.destroy();
12414						},
12415						offset: $portfolioOffsetPos
12416
12417						}); //waypoint
12418
12419	
12420					}); //each
12421				}
12422
12423		       
12424		    portfolioHoverEffects();	
12425				portfolioAccentColor();
12426		         
12427		    //verify smooth scorlling
12428				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') } 
12429				
12430				
12431				
12432				//prettyphoto
12433				$('.portfolio-items').each(function(){
12434					var $unique_id = Math.floor(Math.random()*10000);
12435					$(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel','prettyPhoto['+$unique_id+'_gal]').removeClass('pretty_photo');
12436				});
12437		
12438				lightBoxInit();
12439				
12440				piVertCenter();
12441
12442				setTimeout(function(){masonryZindex(); reLayout(); $( newElements ).removeClass('ajax-loaded'); },700);
12443		        
12444		        //recalc the filters
12445		        isotopeCatSelection();
12446
12447		        parallaxRowsBGCals();
12448	          
12449	          }); 
12450
12451				
12452		   });
12453
12454			//blog
12455			$('.post-area.infinite_scroll .posts-container').infinitescroll({
12456		    	navSelector  : "div#pagination",            
12457		   	    nextSelector : "div#pagination a:first",    
12458		   	    itemSelector : ".post-area .posts-container .post",
12459		   	    finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
12460		        msgText: " " 
12461		   },function(newElements){
12462		   	
12463		   	if($('.masonry.meta_overlaid').length == 0) { 
12464			   	//reinit js
12465			   	centerLove();
12466			   	
12467			   	//gallery
12468				$(newElements).find('.flex-gallery').each(function(){
12469					
12470					var $that = $(this);
12471					
12472					 $that.flexslider({
12473				        animation: 'fade',
12474				        smoothHeight: false, 
12475				        animationSpeed: 500,
12476				        useCSS: false, 
12477				        touch: true
12478				    });
12479					
12480					////gallery slider add arrows
12481					$('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="fa fa-angle-right"></i>');
12482					$('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="fa fa-angle-left"></i>');
12483
12484				});
12485			   	
12486			   	
12487			   	//media players
12488			   	if($().mediaelementplayer) $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer();
12489			   	
12490			   	
12491			   	//lightbox
12492			    lightBoxInit();
12493			   	
12494			   	//carousels
12495			   	if($('.carousel').length > 0) {
12496				   	standardCarouselInit();
12497			    	clientsCarouselInit();
12498			    }
12499			   	
12500			   	//iframes
12501			   	showLateIframes();
12502
12503			   	//milestone
12504			   	$(newElements).find('.nectar-milestone').each(function() {
12505					//symbol
12506					if($(this).has('[data-symbol]')) {
12507						if($(this).attr('data-symbol-pos') == 'before') {
12508							$(this).find('.number').prepend($(this).attr('data-symbol'));
12509						} else {
12510							$(this).find('.number').append($(this).attr('data-symbol'));
12511						}
12512					}
12513				});
12514				
12515				if(!$('body').hasClass('mobile')) {
12516					
12517					$(newElements).find('.nectar-milestone').each(function() {
12518						//animation
12519
12520							var $that = $(this);
12521							var waypoint = new Waypoint({
12522				 			element: $that,
12523				 			 handler: function(direction) {
12524								if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
12525								     waypoint.destroy();
12526								     return;
12527								}
12528
12529								var $endNum = parseInt($that.find('.number span').text());
12530
12531								var countOptions = { easingFn: easeOutCubic };
12532								var $countEle = $that.find('.number span:not(.symbol)')[0];
12533								var numAnim = new CountUp($countEle, 0, $endNum,0,2.2,countOptions);
12534								numAnim.start();
12535
12536
12537								$that.addClass('animated-in');
12538								waypoint.destroy();
12539							},
12540							offset: 'bottom-in-view'
12541
12542						}); 
12543
12544						
12545					}); 
12546				}
12547				
12548				//pie chart		
12549			    if($().vcChat) $(newElements).find('.vc_pie_chart').vcChat();
12550		    	
12551		    	//fancy ul
12552		    	nectar_fancy_ul_init();
12553		    	
12554		    	//testimonial slider
12555		    	$('.testimonial_slider').animate({'opacity':'1'},800);
12556		    	createTestimonialControls();
12557				testimonialSliderHeight(); 
12558				testimonialHeightResize();
12559		    	
12560				//bar graph
12561				$(newElements).find('.nectar-progress-bar').each(function(i){
12562				
12563
12564				var $that = $(this);
12565				var waypoint = new Waypoint({
12566		 			element: $that,
12567		 			 handler: function(direction) {
12568						if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
12569						     waypoint.destroy();
12570						     return;
12571						}
12572
12573						var percent = $that.find('span').attr('data-width');
12574						var $endNum = parseInt($that.find('span strong i').text());
12575						
12576						$that.find('span').transition({
12577							'width' : percent + '%'
12578						},1600, 'easeInOutCirc',function(){
12579						});
12580						
12581						$that.find('span strong').transition({
12582							'opacity' : 1
12583						},1350);
12584						
12585						
12586						var countOptions = { useEasing : false };
12587						var $countEle = $that.find('span strong i')[0];
12588						var numAnim = new CountUp($countEle, 0, $endNum,0,1.2,countOptions);
12589						numAnim.start();
12590
12591						
12592						////100% progress bar 
12593						if(percent == '100'){
12594							$that.find('span strong').addClass('full');
12595						}
12596
12597
12598						$that.addClass('animated-in');
12599						waypoint.destroy();
12600					},
12601					offset: 'bottom-in-view'
12602
12603				}); 
12604
12605
12606			
12607				});
12608				
12609				
12610				//columns & images with animation
12611				colAndImgAnimations();
12612				splitLineHeadings();
12613
12614				setTimeout(function(){
12615					videoshortcodeSize();
12616					responsiveVideoIframesInit();
12617					responsiveVideoIframes();
12618					$(window).trigger('resize');
12619				},500);
12620
12621
12622				parallaxRowsBGCals();
12623
12624				$(window).trigger('resize');
12625			   	
12626		   	}//non meta overlaid style 
12627		   	else {
12628		   		parallaxRowsBGCals();
12629
12630				$(window).trigger('resize');
12631		   	}
12632
12633		   	// trigger Masonry as a callback
12634		   	var $container = $('.posts-container');
12635		    if($container.parent().hasClass('masonry')) { 
12636		    	 
12637		    	$(newElements).addClass('masonry-blog-item');
12638				$(newElements).prepend('<span class="bottom-line"></span>');
12639				
12640				//move the meta to the bottom
12641				$(newElements).each(function(){
12642					
12643					var $metaClone = $(this).find('.post-meta').clone();
12644		
12645					$(this).find('.post-meta').remove();
12646					
12647					if($('.post-area.meta_overlaid').length > 0){
12648						$(this).find('.post-header h2').after($metaClone);
12649					} else {
12650						$(this).find('.content-inner').after($metaClone);
12651					}
12652					
12653				});
12654			
12655		    	}//if masonry
12656
12657
12658		    	//loading effect   
12659		    	
12660		        //// hide new items while they are loading
12661		        var $newElems = $( newElements );
12662		        //// ensure that images load before adding to masonry layout
12663
12664		        if($newElems.find('img').length == 0) $newElems = $('body');
12665		        
12666		        $newElems.imagesLoaded(function(){
12667
12668		          $container.isotope( 'appended', $( newElements ));
12669
12670		          flickityBlogInit();
12671
12672		          $( newElements ).addClass('ajax-loaded');
12673		          ///// show elems now they're ready
12674
12675
12676		        //classic enhanced specific 
12677		        if($container.parent().hasClass('classic_enhanced')){
12678					$container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function(){
12679						var $src = $(this).find('img').attr('src');
12680						$(this).css('background-image','url('+$src+')');
12681					});
12682
12683					$container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function(){
12684
12685						$(this).find('.cell').each(function(){
12686							var $src = $(this).find('img').attr('src');
12687							$(this).css('background-image','url('+$src+')');
12688						});
12689						
12690					});
12691				}
12692
12693
12694		          if($(newElements).parents('.posts-container').attr('data-animation') == 'none') {
12695						$( newElements ).find('.inner-wrap').removeClass('animated');
12696					} else {
12697						blogMasonryZindex();
12698						$(newElements).each(function(i){
12699
12700							var $that = $(this);
12701							var waypoint = new Waypoint({
12702
12703					 			element: $that,
12704					 			 handler: function(direction) {
12705									
12706									setTimeout(function(){
12707									    $that.addClass("animated-in");
12708									},80*$that.attr('data-delay-amount'));
12709
12710									waypoint.destroy();
12711								},
12712								offset: '90%'
12713
12714							}); 
12715
12716		
12717						}); //each
12718					}
12719
12720					setTimeout(function(){$( newElements ).removeClass('ajax-loaded'); },700);
12721
12722		        
12723		        });
12724		        
12725		    
12726		   	
12727		   });
12728		   
12729	   }
12730
12731}
12732
12733infiniteScrollInit();
12734
12735function destroyInfiniteScroll(){
12736	$('.post-area.infinite_scroll .posts-container').infinitescroll('destroy');
12737	$('.portfolio-items.infinite_scroll').infinitescroll('destroy');
12738}
12739	
12740/*-------------------------------------------------------------------------*/
12741/*	6.	Scroll to top
12742/*-------------------------------------------------------------------------*/	
12743
12744var $scrollTop = $(window).scrollTop();
12745
12746//starting bind
12747function toTopBind() {
12748	if( $('#to-top').length > 0 && $(window).width() > 1020 || $('#to-top').length > 0 &&  $('#to-top.mobile-enabled').length > 0 ) {
12749		
12750		if($scrollTop > 350){
12751			$(window).on('scroll',hideToTop);
12752		}
12753		else {
12754			$(window).on('scroll',showToTop);
12755		}
12756	}
12757}
12758
12759if($('.nectar-social-sharing-fixed').length == 0) {
12760	toTopBind();
12761} else {
12762	if($(window).width() < 1000 && $('body.single').length > 0) {
12763		if($scrollTop > 150){
12764			$(window).on('scroll',hideFixedSharing);
12765		}
12766		else {
12767			$(window).on('scroll',showFixedSharing);
12768		}
12769	}
12770
12771	$(window).smartresize(function(){
12772		if($(window).width() > 1000) { 
12773			$('.nectar-social-sharing-fixed').addClass('visible');
12774		}	
12775		else if($scrollTop < 150) { 
12776			$(window).off('scroll',hideFixedSharing);
12777			$(window).on('scroll',showFixedSharing);
12778			$('.nectar-social-sharing-fixed').removeClass('visible');	
12779		} else {
12780			$(window).off('scroll',showFixedSharing);
12781			$(window).on('scroll',hideFixedSharing);
12782		}
12783	});
12784}
12785
12786function showFixedSharing(){
12787	
12788  $scrollTop = $(window).scrollTop();
12789	if( $scrollTop > 150){
12790
12791		$('.nectar-social-sharing-fixed').addClass('visible');	
12792		
12793		$(window).off('scroll',showFixedSharing);
12794		$(window).on('scroll',hideFixedSharing);
12795	}
12796
12797}
12798
12799function hideFixedSharing(){
12800  
12801	$scrollTop = $(window).scrollTop();
12802	if( $scrollTop < 150){
12803
12804		$('.nectar-social-sharing-fixed').removeClass('visible');	
12805		
12806		$(window).off('scroll',hideFixedSharing);
12807		$(window).on('scroll',showFixedSharing);
12808	}
12809
12810}
12811
12812
12813
12814function showToTop(){
12815
12816	if( $scrollTop > 350 && $('#slide-out-widget-area.fullscreen.open').length == 0){
12817
12818		$('#to-top').stop().transition({
12819			'bottom' : '17px'
12820		},350,'easeInOutCubic');	
12821		
12822		$(window).off('scroll',showToTop);
12823		$(window).on('scroll',hideToTop);
12824	}
12825
12826}
12827
12828function hideToTop(){
12829	
12830	if( $scrollTop < 350 || $('#slide-out-widget-area.fullscreen.open').length > 0){
12831
12832		$animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350;
12833
12834		$('#to-top').stop().transition({
12835			'bottom' : '-30px'
12836		},$animationTiming,'easeInOutQuint');	
12837		
12838		$(window).off('scroll',hideToTop);
12839		$(window).on('scroll',showToTop);	
12840		
12841	}
12842}
12843
12844
12845//to top color
12846if( $('#to-top').length > 0 ) {
12847	
12848	var $windowHeight, $pageHeight, $footerHeight, $ctaHeight;
12849	
12850	function calcToTopColor(){
12851		$scrollTop = $(window).scrollTop();
12852		$windowHeight = $(window).height();
12853		$pageHeight = $('body').height();
12854		$footerHeight = $('#footer-outer').height();
12855		$ctaHeight = ($('#call-to-action').length > 0) ? $('#call-to-action').height() : 0;
12856		
12857		if( ($scrollTop-35 + $windowHeight) >= ($pageHeight - $footerHeight) && $('#boxed').length == 0){
12858			$('#to-top').addClass('dark');
12859		}
12860		
12861		else {
12862			$('#to-top').removeClass('dark');
12863		}
12864	}
12865	
12866	//calc on scroll
12867	$(window).scroll(calcToTopColor);
12868	
12869	//calc on resize
12870	$(window).resize(calcToTopColor);
12871
12872}
12873
12874//alt style
12875if($('body[data-button-style*="rounded"]').length > 0){
12876	var $clone = $('#to-top .fa-angle-up').clone();
12877	$clone.addClass('top-icon');
12878	$('#to-top').prepend($clone)
12879}
12880
12881//scroll up event
12882$('body').on('click','#to-top, a[href="#top"]',function(){
12883	$('body,html').stop().animate({
12884		scrollTop:0
12885	},800,'easeOutQuad',function(){
12886		if($('.nectar-box-roll').length > 0) {
12887			$('body').trigger('mousewheel', [1, 0, 0]);
12888		}
12889	})
12890	return false;
12891});
12892
12893
12894/* one page scrolling */
12895function scrollSpyInit(){ 
12896
12897	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
12898
12899	if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; }
12900
12901	//prevent jump to rop on empty items
12902	$('header#top .sf-menu li a[href="#"]').on('click',function(e){
12903		e.preventDefault();
12904	});
12905
12906	//remove full page URLs from hash if located on same page to fix current menu class
12907	//if(location.pathname.length > 1) {
12908		$("#header-outer a[href*='" + location.pathname + "']").each(function(){
12909			var $href = $(this).attr('href');
12910
12911			//regular animated anchors
12912			if($href.indexOf("#") != -1 && $('div'+$href.substr($href.indexOf("#"))).length > 0 ) {
12913
12914				$(this).attr('href',$href.substr($href.indexOf("#")));
12915				$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
12916			}
12917
12918			//fullpage is a little different
12919			if($('div[data-fullscreen-anchor-id="'+$href.substr($href.indexOf("#")+1)+'"]').length > 0) {
12920				$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
12921			}
12922
12923		});
12924	//}
12925
12926	$target = ($('.page-submenu[data-sticky="true"]').length == 0) ? '#header-outer nav': '.page-submenu';
12927	$('body').scrollspy({
12928		target: $target,
12929		offset: $headerNavSpace + adminBarHeight + 40
12930	});
12931
12932}
12933
12934function pageLoadHash() {
12935
12936	var $hash = window.location.hash;
12937	
12938	var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1,$hash.length) : 0;
12939
12940	//if hash has slashes 
12941	var $hasSlashLength = 0;
12942	if($hashSubstrng) {
12943		$hasSlashLength = $hashSubstrng.split("/");
12944		$hasSlashLength = $hasSlashLength.length;
12945	}
12946	
12947	if($hashSubstrng && $hasSlashLength > 1 ) { 
12948		$hashSubstrng = $hashSubstrng.replace(/\//g, ""); 
12949		$hash = $hash.replace(/\//g, ""); 
12950	}
12951
12952	if($hash && $($hash).length > 0 || $hash && $('[data-fullscreen-anchor-id="'+$hashSubstrng+'"]').length > 0) {
12953
12954		$hashObj = ($($hash).length > 0) ? $($hash) : $('div[data-fullscreen-anchor-id="'+$hashSubstrng+'"]');
12955
12956		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').outerHeight();
12957		if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; }
12958
12959		$timeoutVar = 0;
12960		if($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
12961			boxRoll(null,-1);
12962			$timeoutVar = 2050;
12963		} 
12964		setTimeout(function(){
12965		
12966			if( $('body[data-permanent-transparent="1"]').length == 0 ) {
12967				
12968				if(!$('body').hasClass('mobile')){
12969					$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
12970					if($('#header-outer[data-remove-fixed="1"]').length > 0) { 
12971						$headerNavSpace = 0;
12972					}
12973					var $scrollTopDistance =  $hashObj.offset().top - parseInt($headerNavSpace) +$resize + 3 - adminBarHeight;
12974				} else {
12975					var $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $hashObj.offset().top + 2 - $headerNavSpace + adminBarHeight : $hashObj.offset().top - adminBarHeight + 1;	
12976				}
12977
12978			} else {
12979				var $scrollTopDistance = $hashObj.offset().top - adminBarHeight + 1;
12980			}
12981
12982			if($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
12983				//alter offset 
12984				if($('#header-outer.detached').length == 0) 
12985					$scrollTopDistance = $scrollTopDistance + $headerNavSpace;
12986			}
12987
12988			var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0;
12989
12990			$('body,html').stop().animate({
12991				scrollTop: $scrollTopDistance - $pageSubMenu
12992			},800,'easeInOutCubic');
12993
12994		},$timeoutVar);
12995	}
12996}
12997
12998if($('body[data-animated-anchors="true"]').length > 0) { 
12999
13000
13001+ function(t) {
13002    "use strict";
13003
13004    function s(e, i) {
13005        var r = t.proxy(this.process, this);
13006        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()
13007    }
13008
13009    function e(e) {
13010        return this.each(function() {
13011            var i = t(this),
13012                r = i.data("bs.scrollspy"),
13013                o = "object" == typeof e && e;
13014            r || i.data("bs.scrollspy", r = new s(this, o)), "string" == typeof e && r[e]()
13015        })
13016    }
13017    s.VERSION = "3.2.0", s.DEFAULTS = {
13018        offset: 10
13019    }, s.prototype.getScrollHeight = function() {
13020        return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
13021    }, s.prototype.refresh = function() {
13022        var s = "offset",
13023            e = 0;
13024        t.isWindow(this.$scrollElement[0]) || (s = "position", e = this.$scrollElement.scrollTop()), this.offsets = [], this.targets = [], this.scrollHeight = this.get
13024ScrollHeight();
13025        var i = this;
13026        this.$body.find(this.selector).map(function() {
13027            var i = t(this),
13028                r = i.data("target") || i.attr("href"),
13029                o = /^#./.test(r) && t(r);
13030            return o && o.length && o.is(":visible") && [
13031                [o[s]().top + e, r]
13032            ] || null
13033        }).sort(function(t, s) {
13034            return t[0] - s[0]
13035        }).each(function() {
13036            i.offsets.push(this[0]), i.targets.push(this[1])
13037        })
13038    }, s.prototype.process = function() {
13039    	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;
13040
13041        var t, s = this.$scrollElement.scrollTop() + this.options.offset + $pageSubMenu,
13042            e = this.getScrollHeight(),
13043            i = this.options.offset + e - this.$scrollElement.height() -$pageSubMenu,
13044            r = this.offsets,
13045            o = this.targets,
13046            l = this.activeTarget;
13047        if (this.scrollHeight != e && this.refresh(), s >= i) return l != (t = o[o.length - 1]) && this.activate(t);
13048        if (l && s <= r[0]) return l != (t = o[0]) && this.activate(t);
13049        for (t = r.length; t--;) l != o[t] && s >= r[t] && (!r[t + 1] || s <= r[t + 1]) && this.activate(o[t])
13050    }, s.prototype.activate = function(s) {
13051        this.activeTarget = s, t(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover');
13052        var e = this.selector + '[data-target="' + s + '"],' + this.selector + '[href="' + s + '"]',
13053            i = t(e).parents("li").addClass("current-menu-item");
13054        i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("current-menu-item")), i.trigger("activate.bs.scrollspy")
13055    };
13056    var i = t.fn.scrollspy;
13057    t.fn.scrollspy = e, t.fn.scrollspy.Constructor = s, t.fn.scrollspy.noConflict = function() {
13058        return t.fn.scrollspy = i, this
13059    }
13060}(jQuery);
13061
13062
13063var shrinkNum = 6;	
13064if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
13065headerPadding2 = headerPadding - headerPadding/1.8;
13066
13067setTimeout(scrollSpyInit,200);
13068
13069var $animatedScrollingTimeout;
13070
13071$('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), .swiper-slide .button a, #slide-out-widget-area a, #mobile-menu .container ul li a, #slide-out-widget-area .inner div a',function(e){
13072
13073	var $hash = $(this).prop("hash");	
13074
13075	$('body').addClass('animated-scrolling');
13076	clearTimeout($animatedScrollingTimeout);
13077	$animatedScrollingTimeout = setTimeout(function(){ $('body').removeClass('animated-scrolling'); },850);
13078	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').outerHeight();
13079	if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; }
13080
13081	if($hash && $($hash).length > 0 && $hash != '#top' && $hash != '' && $(this).attr('href').indexOf(window.location.href.split("#")[0]) !== -1 || $(this).is('[href^="#"]') && $hash != '' && $($hash).length > 0 && $hash != '#top') {
13082
13083		//stop scrolling for certain elements
13084		//if($(this).parents('.tabbed').length > 0) return false;
13085		
13086		//update hash
13087		if(history.pushState) {
13088		    history.pushState(null, null, $hash);
13089		}
13090		else {
13091		    location.hash = $hash;
13092		}
13093
13094		if($(this).parents('ul').length > 0) { 
13095			$(this).parents('ul').find('li').removeClass('current-menu-item');
13096			//$(this).parents('li').addClass('current-menu-item');
13097		}
13098
13099		//side widget area click
13100		if($(this).parents('#slide-out-widget-area').length > 0){
13101			$('#slide-out-widget-area .slide_out_area_close').addClass('non-human-allowed').trigger('click');
13102			setTimeout(function(){
13103				$('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed');
13104			},100);
13105		}
13106
13107		//mobile menu click
13108		if($(this).parents('#mobile-menu').length > 0) $('#toggle-nav').trigger('click');
13109		var $mobileMenuHeight = ($(this).parents('#mobile-menu').length > 0) ? $(this).parents('#mobile-menu').height() : null;
13110		
13111		$timeoutVar = 1;
13112		if($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
13113			boxRoll(null,-1);
13114			$timeoutVar = 2050;
13115		} 
13116
13117		var $that = $(this);
13118
13119		setTimeout(function(){
13120
13121			//scrolling
13122			var $headerSpace = ($('body[data-permanent-transparent="1"]').length > 0) ? 0 : parseInt($headerNavSpace);
13123
13124			if( $('body[data-permanent-transparent="1"]').length == 0 ) {
13125				
13126				if(!$('body').hasClass('mobile')){
13127					$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
13128					if($('#header-outer[data-remove-fixed="1"]').length > 0) { 
13129						$headerNavSpace = 0;
13130					}
13131					var $scrollTopDistance =  $($hash).offset().top - $mobileMenuHeight - parseInt($headerNavSpace) +$resize + 3 - adminBarHeight;
13132				} else {
13133					var $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $headerNavSpace + adminBarHeight : $($hash).offset().top - $mobileMenuHeight - adminBarHeight + 1;	
13134				}
13135
13136			} else {
13137				var $scrollTopDistance = $($hash).offset().top - adminBarHeight + 1;
13138			}
13139
13140			if($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
13141				//alter offset 
13142				if($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) 
13143					$scrollTopDistance = $scrollTopDistance + $headerNavSpace;
13144
13145				//hide top header
13146				if($that.parents('.page-submenu[data-sticky="true"]').length > 0) { 
13147					$('#header-outer.detached').addClass('invisible');
13148					$('.page-submenu').addClass('header-not-visible').css('transform','translateY(0px)');
13149				}
13150			} 
13151
13152			var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0;
13153
13154			$('body,html').stop().animate({
13155				scrollTop: $scrollTopDistance - $pageSubMenu
13156			},800,'easeInOutCubic');
13157
13158		},$timeoutVar);
13159		
13160
13161		e.preventDefault();
13162
13163	}
13164
13165	if($hash == '#top') {
13166		//side widget area click
13167		if($(this).parents('#slide-out-widget-area').length > 0){
13168			$('#slide-out-widget-area .slide_out_area_close').trigger('click');
13169		}
13170	}
13171
13172
13173});
13174
13175
13176if($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) $(window).load(pageLoadHash);
13177
13178if($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && $('.nectar-box-roll').length == 0 && $onMobileBrowser ) {
13179	$(window).load(pageLoadHash);
13180}
13181
13182}
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193	//portfolio colors
13194	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 ) {
13195		var portfolioColorCss = '';
13196		$('.portfolio-items .col').each(function(){
13197			$titleColor = $(this).attr('data-title-color');
13198			$subTitleColor = $(this).attr('data-subtitle-color');
13199
13200			 if($titleColor.length > 0 ) { 
13201			 	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; } ';
13202			 	portfolioColorCss += ' .portfolio-items[data-ps="8"] .col[data-title-color="'+$titleColor+'"] .line { background-color: '+$titleColor+'; }';
13203			 	portfolioColorCss += '.portfolio-items[data-ps="8"] .col[data-title-color="'+$titleColor+'"] .next-arrow line { stroke: '+$titleColor+'; } ';
13204			 }
13205			 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+'; } ';
13206	
13207		});
13208
13209
13210		var head = document.head || document.getElementsByTagName('head')[0];
13211		var style = document.createElement('style');
13212
13213			style.type = 'text/css';
13214		if (style.styleSheet){
13215		  style.styleSheet.cssText = portfolioColorCss;
13216		} else {
13217		  style.appendChild(document.createTextNode(portfolioColorCss));
13218		}
13219
13220		head.appendChild(style);
13221	}
13222
13223	//bottom controls 2
13224	$('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(){
13225		$(this).addClass('mouse-leaving');
13226	});	
13227
13228	// masonryPortfolio
13229
13230	var $portfolio_containers = [];
13231
13232	$('.portfolio-items:not(.carousel)').each(function(i){
13233		$portfolio_containers[i] = $(this);
13234	});
13235
13236	function masonryPortfolioInit() {
13237
13238		$portfolio_containers = [];
13239		$('.portfolio-items:not(.carousel)').each(function(i){
13240			$portfolio_containers[i] = $(this);
13241		});
13242
13243		//// cache window
13244		var $window = jQuery(window);	
13245		
13246			
13247			$.each($portfolio_containers,function(i){
13248
13249				
13250				//// start up isotope with default settings
13251				$portfolio_containers[i].imagesLoaded(function(){
13252					
13253					//verify smooth scorlling
13254					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') } 
13255					
13256					//transformns enabled logic
13257					var $isoUseTransforms = true;
13258					
13259					//Panr 
13260					if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
13261
13262						$isoUseTransforms = true;
13263						
13264					}
13265
13266					piVertCenter();
13267
13268					//initial call to setup isotope
13269					var $layoutMode = ( $portfolio_containers[i].hasClass('masonry-items')) ? 'packery' : 'fitRows';
13270					var $startingFilter = ($portfolio_containers[i].attr('data-starting-filter') != '' && $portfolio_containers[i].attr('data-starting-filter') != 'default') ? '.' + $portfolio_containers[i].attr('data-starting-filter') : '*';
13271
13272					reLayout();
13273					
13274					$portfolio_containers[i].isotope({
13275					  itemSelector : '.element',
13276					  filter: $startingFilter,
13277					  layoutMode: $layoutMode,
13278					  transitionDuration: '0.6s',
13279					  packery: {
13280						 gutter: 0
13281					  }
13282					}).isotope( 'layout' );
13283					
13284					
13285					if($startingFilter != '*'){
13286						$('.portfolio-filters ul a[data-filter="'+$startingFilter+'"], .portfolio-filters-inline ul a[data-filter="'+$startingFilter+'"]').click();
13287					}
13288
13289					//call the reLayout to get things rollin'
13290					masonryZindex();
13291					setTimeout(function(){masonryZindex(); },800);
13292					
13293				
13294					
13295					//inside fwc fix
13296					if($portfolio_containers[i].parents('.full-width-content').length > 0) { setTimeout(function(){ fullWidthContentColumns(); },200);  }
13297
13298					//fadeout the loading animation
13299					$('.portfolio-loading').stop(true,true).fadeOut(200);
13300					
13301					//fadeIn items one by one
13302					if($portfolio_containers[i].find('.inner-wrap').attr('data-animation') == 'none') {
13303						$portfolio_containers[i].find('.inner-wrap').removeClass('animated');
13304					} else {
13305
13306						//portfolioLoadIn(); moved to waypoints
13307					}
13308			
13309				});
13310				
13311
13312
13313			});//each
13314			
13315			if($portfolio_containers.length > 0) {
13316				$window.resize( reLayout );
13317
13318				$window.smartresize( function(){
13319					setTimeout(masonryZindex,700);
13320				});
13321			}
13322			
13323		
13324
13325	}
13326
13327	masonryPortfolioInit();
13328
13329	function portfolioLoadIn() {
13330
13331		$($fullscreenSelector+'.portfolio-items').each(function(){
13332
13333			$portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%';
13334
13335			if($(this).find('.inner-wrap').attr('data-animation') == 'none') return;
13336		
13337			$(this).find('.col').each(function(i){
13338
13339				var $that = $(this);
13340
13341				//loaded visible
13342				if($(this).visible(true) || $(this).parents('#nectar_fullscreen_rows').length > 0) {
13343
13344					var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 90 : 115;
13345					$(this).delay($portfolioAnimationDelay *i).queue(function(next){
13346					    $(this).addClass("animated-in");
13347					    next();
13348					});
13349
13350				} else {
13351
13352					//not already visible
13353					var waypoint = new Waypoint({
13354		 			element: $that,
13355		 			 handler: function(direction) {
13356						
13357						if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
13358						     waypoint.destroy();
13359						     return;
13360						}
13361
13362						var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 100;
13363					
13364						setTimeout(function(){
13365							$that.addClass("animated-in");
13366						},$portfolioAnimationDelay * $that.attr('data-delay-amount'));
13367					
13368						
13369						waypoint.destroy();
13370					},
13371					offset: $portfolioOffsetPos
13372
13373					}); //waypoint
13374				}
13375
13376			}); //each
13377		}); //each
13378					
13379	}
13380
13381
13382	//perspective load in
13383	if($('.portfolio-items .inner-wrap[data-animation="perspective"]').length > 0 || $('.posts-container[data-load-animation="perspective"]').length > 0) {
13384
13385		var lastScrollTop = $(window).scrollTop();
13386
13387		$('.portfolio-items, .posts-container[data-load-animation="perspective"]').css('perspective-origin','50% '+ (lastScrollTop + $(window).height()) + 'px');
13388
13389		requestAnimationFrame(updatePerspectiveOrigin);
13390		
13391		function updatePerspectiveOrigin() {
13392
13393			var scrollTop = $(window).scrollTop();
13394
13395			if (lastScrollTop === scrollTop) {
13396				requestAnimationFrame(updatePerspectiveOrigin);
13397				return;
13398			} else {
13399				lastScrollTop = scrollTop;
13400				$('.portfolio-items,.posts-container[data-load-animation="perspective"]').css('perspective-origin','50% '+ (lastScrollTop + $(window).height()) + 'px');
13401				requestAnimationFrame(updatePerspectiveOrigin);
13402			}
13403		}
13404
13405	}
13406
13407	var mediaQuerySize;
13408	function reLayout() {
13409
13410		clearTimeout(clearIsoAnimation);
13411	    $('.portfolio-items .col').addClass('no-transition');
13412	    clearIsoAnimation = setTimeout(function(){  $('.portfolio-items .col').removeClass('no-transition'); },700); 
13413
13414		var windowSize = $window.width();
13415		var masonryObj;
13416		var masonryObjHolder = [];
13417
13418		//remove double quotes for FF
13419		//if (navigator.userAgent.match('MSIE 8') == null) {
13420		//	mediaQuerySize = mediaQuerySize.replace(/"/g, '');
13421		//}
13422		
13423		//user defined cols
13424		var userDefinedColWidth;
13425
13426		$.each($portfolio_containers,function(i,v){
13427
13428			if( $portfolio_containers[i].attr('data-user-defined-cols') == 'span4') {
13429				userDefinedColWidth = 3
13430			} 
13431			
13432			else if( $portfolio_containers[i].attr('data-user-defined-cols') == 'span3') {
13433				userDefinedColWidth = 4
13434			} 
13435			
13436			var isFullWidth = $portfolio_containers[i].attr('data-col-num') == 'elastic';
13437			
13438			
13439			//chrome 33 approved method for getting column sizing
13440			if(window.innerWidth > 1600){
13441				
13442				if($portfolio_containers[i].hasClass('fullwidth-constrained')) {
13443					if($portfolio_containers[i].is('[data-masonry-type="photography"]')) {
13444						mediaQuerySize = 'three';
13445					} else {
13446						mediaQuerySize = 'four';
13447					}
13448	
13449				} else {
13450					if($portfolio_containers[i].hasClass('constrain-max-cols')) {
13451						mediaQuerySize = 'four';
13452					} else {
13453						mediaQuerySize = 'five';
13454					}
13455				}
13456				
13457			} else if(window.innerWidth <= 1600 && window.innerWidth > 1300){
13458
13459				if($portfolio_containers[i].hasClass('fullwidth-constrained')) {
13460					if($portfolio_containers[i].is('[data-masonry-type="photography"]')) {
13461						mediaQuerySize = 'three';
13462					} else {
13463						mediaQuerySize = 'four';
13464					}
13465				} else {
13466					mediaQuerySize = 'four';
13467				}
13468			} else if(window.innerWidth <= 1300 && window.innerWidth > 990){
13469				
13470				if($portfolio_containers[i].hasClass('constrain-max-cols')) {
13471					mediaQuerySize = 'four';
13472				} else {
13473					mediaQuerySize = 'three';
13474				}
13475				
13476			} else if(window.innerWidth <= 990 && window.innerWidth > 470){
13477				mediaQuerySize = 'two';
13478			} else if(window.innerWidth <= 470){
13479				mediaQuerySize = 'one';
13480			}
13481			
13482			//boxed
13483			if($('#boxed').length > 0) {
13484				if(window.innerWidth > 1300){
13485					mediaQuerySize = 'four';
13486				} else if(window.innerWidth < 1300 && window.innerWidth > 990){
13487					
13488					if($portfolio_containers[i].hasClass('constrain-max-cols')) {
13489						mediaQuerySize = 'four';
13490					} else {
13491						mediaQuerySize = 'three';
13492					}
13493
13494				} else if(window.innerWidth < 990){
13495					mediaQuerySize = 'one';
13496				}
13497				
13498			}
13499			
13500			//change masonry columns depending on screen size
13501			switch (mediaQuerySize) {
13502				case 'five':
13503					(isFullWidth) ? colWidth = 5 : colWidth = userDefinedColWidth;
13504					//change cols for photography
13505					if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]')) colWidth = 6;
13506
13507					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
13508				break;
13509				
13510				case 'four':
13511					(isFullWidth) ? colWidth = 4 : colWidth = userDefinedColWidth;
13512					//change cols for photography
13513					if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]')) colWidth = 5;
13514
13515					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
13516				break;
13517				
13518				case 'three':
13519					(isFullWidth) ? colWidth = 3 : colWidth = userDefinedColWidth;
13520					//change cols for photography
13521					if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]')) colWidth = 4;
13522					
13523					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
13524				break;
13525				
13526				case 'two':
13527					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / 2) };
13528				break;
13529				
13530				case 'one':
13531					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / 1) };
13532				break;
13533			}
13534
13535
13536			 //set widths
13537			 portfolioItemWidths(i,v);
13538			
13539
13540			//sizing for large items
13541			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) {
13542
13543				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;
13544				var multipler = (window.innerWidth > 470) ? 2 : 1;
13545
13546				//reset height for calcs
13547				$itemClassForSizing = 'regular';
13548
13549				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) {
13550					$itemClassForSizing = 'wide';
13551				} 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) {
13552					$itemClassForSizing = 'wide_tall';
13553					multipler = 1;
13554				} 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) {
13555					$itemClassForSizing = 'tall';
13556					multipler = 1;
13557				}
13558
13559			    $portfolio_containers[i].find('.col.elastic-portfolio-item.'+$itemClassForSizing+' img').css('height','auto');
13560
13561				var tallColHeight = $portfolio_containers[i].find('.col.elastic-portfolio-item.'+$itemClassForSizing+':visible img').height();
13562				
13563				 $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');
13564				 $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="tall"] img:not(.custom-thumbnail)').css('height',(tallColHeight*multipler) + ($gutterSize*2));
13565
13566				 if($itemClassForSizing == 'regular' || $itemClassForSizing == 'wide') {
13567				 	$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);
13568				 } else {
13569				 	$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));
13570				 }
13571
13572				 $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 );
13573				 
13574				 if($itemClassForSizing == 'regular' || $itemClassForSizing == 'wide') {
13575					 $portfolio_containers[i].find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',tallColHeight);
13576				} else {
13577				 	 $portfolio_containers[i].find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',(tallColHeight/2) - ($gutterSize*2));
13578				 }
13579
13580			} else {
13581				$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');
13582			}
13583
13584			//non masonry
13585			if($portfolio_containers[i].hasClass('no-masonry') && $portfolio_containers[i].find('.col:first:visible').length > 0 && $portfolio_containers[i].parents('.wpb_gallery').length == 0){
13586			  
13587				//skip style 9
13588				if( !$portfolio_containers[i].is('[data-ps="9"]') ) {
13589
13590				   	//reset height for calcs
13591			   	   $portfolio_containers[i].find('.col img').css('height','auto');
13592			   	   var tallColHeight = $portfolio_containers[i].find('.col:first:visible img').height();
13593			   	   $portfolio_containers[i].find('.col img:not(.custom-thumbnail)').css('height',tallColHeight);
13594			   	   $portfolio_containers[i].find('.col .parallaxImg').css('height',tallColHeight);
13595				 }
13596				 
13597			}
13598	
13599
13600
13601			masonryObjHolder[i] = masonryObj;
13602			
13603			if($portfolio_containers[i].isotope()) $portfolio_containers[i].isotope( 'layout' ); 
13604				
13605			
13606
13607		}); //each
13608	
13609	}
13610
13611	function portfolioItemWidths(i,v) {
13612		// passing each index value where function is called first to avoid nested loops
13613		// $.each($portfolio_containers,function(i,v){
13614		 		var isFullWidth = $portfolio_containers[i].attr('data-col-num') == 'elastic';
13615
13616		 		if(isFullWidth) { 
13617
13618				 	var $colSize = 4;
13619				 	var $mult = (mediaQuerySize == 'one') ? 1 : 2;
13620				 	if(mediaQuerySize == 'five') $colSize = 5;
13621				 	if(mediaQuerySize == 'four') $colSize = 4;
13622				 	if(mediaQuerySize == 'three') $colSize = 3;
13623				 	if(mediaQuerySize == 'two') $colSize = 2;
13624				 	if(mediaQuerySize == 'one') $colSize = 1;
13625				 	if($(v).is('[data-ps="6"]') && $colSize == 5) $colSize = 4;
13626
13627				 	//photography
13628				 	if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]') && !$portfolio_containers[i].hasClass('no-masonry')) {
13629				 		if(mediaQuerySize == 'five') $colSize = 6;
13630				 		if(mediaQuerySize == 'four') $colSize = 5;
13631				 		if(mediaQuerySize == 'three') $colSize = 4;
13632				 	}
13633				 	
13634				 	if($(v).width() % $colSize == 0) {
13635					 	$(v).find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',Math.floor($(v).width()/$colSize) +'px');
13636					 	$(v).find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',Math.floor($(v).width()/$colSize*$mult) +'px');
13637					 } else {
13638					 	var $loopEndNum = ($(window).width() > 1000) ? 6 : 3;
13639					 	if($portfolio_containers[i].hasClass('fullwidth-constrained') && $(window).width() > 1000) $loopEndNum = 4;
13640					 	//find closest number to give 0
13641					 	for(var i = 1; i<$loopEndNum; i++) {
13642
13643					 		if(($(v).width() - i) % $colSize == 0) {
13644					 			$(v).find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',($(v).width()- i)/$colSize +'px');
13645					 			$(v).find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',($(v).width()-i)/$colSize*$mult +'px');
13646					 		}
13647
13648					 	}
13649					 }
13650
13651				} // isFullWidth
13652
13653		 	
13654		// });
13655	}
13656
13657	//z-index for masonry
13658	function masonryZindex(){
13659
13660		//escape if no browser support
13661		if($('body .portfolio-items:not(".carousel") > .col').length > 0 && $('body .portfolio-items:not(".carousel") > .col').offset().left) {
13662
13663			$('body .portfolio-items:not(".carousel")').each(function(){
13664
13665				var $coords = {};
13666				var $zindexRelation = {};
13667				var $that = $(this);
13668
13669				$(this).find('> .col').each(function(){
13670					var $itemOffset = $(this).offset();
13671					$itemOffset = $itemOffset.left;
13672
13673					$coords[$(this).index()] = $itemOffset;
13674					$(this).css('z-index',Math.abs(Math.floor($(this).offset().left/20)));
13675				});
13676
13677				var $corrdsArr = $.map($coords, function (value) { return value; });
13678
13679				$corrdsArr = removeDuplicates($corrdsArr);
13680				$corrdsArr.sort(function(a,b){return a-b});
13681
13682				for(var i = 0; i < $corrdsArr.length; i++){
13683					$zindexRelation[$corrdsArr[i]] = i; 
13684				}
13685		
13686				$.each($coords,function(k,v){
13687					
13688					var $zindex;
13689					var $coordCache = v;
13690					$.each($zindexRelation,function(k,v){
13691						if($coordCache == k) {
13692							$zindex = v;
13693						}
13694					});
13695				
13696					$that.find('> .col:eq('+k+')').attr('data-delay-amount',$zindex);
13697				});
13698
13699				
13700			});
13701			
13702			
13703			
13704		}
13705
13706
13707	}
13708
13709	function blogMasonryZindex(){
13710	
13711		//escape if no browser support
13712		if($('body .post-area .masonry-blog-item').length > 0 && $('body .post-area .masonry-blog-item').offset().left) {
13713		
13714			$('body .post-area.masonry').each(function(){
13715				
13716				var $coords = {};
13717				var $zindexRelation = {};
13718				var $that = $(this);
13719
13720				$(this).find('.masonry-blog-item').each(function(){
13721					var $itemOffset = $(this).offset();
13722					$itemOffset = $itemOffset.left;
13723
13724					$coords[$(this).index()] = $itemOffset;
13725					$(this).css('z-index',Math.abs(Math.floor($(this).offset().left/20)));
13726				});
13727
13728				var $corrdsArr = $.map($coords, function (value) { return value; });
13729
13730				$corrdsArr = removeDuplicates($corrdsArr);
13731				$corrdsArr.sort(function(a,b){return a-b});
13732		
13733				for(var i = 0; i < $corrdsArr.length; i++){
13734					$zindexRelation[$corrdsArr[i]] = i*1; 
13735				}
13736		
13737				$.each($coords,function(k,v){
13738					
13739					var $zindex;
13740					var $coordCache = v;
13741					$.each($zindexRelation,function(k,v){
13742						if($coordCache == k) {
13743							$zindex = v;
13744						}
13745					});
13746		
13747					$that.find('.masonry-blog-item:eq('+k+')').css('z-index',$zindex).attr('data-delay-amount',$zindex);
13748					
13749				});
13750			
13751			});
13752			
13753		}
13754		
13755	}
13756	
13757	function matrixToArray(matrix) {
13758	    return matrix.substr(7, matrix.length - 8).split(', ');
13759	}
13760	
13761	function removeDuplicates(inputArray) {
13762        var i;
13763        var len = inputArray.length;
13764        var outputArray = [];
13765        var temp = {};
13766
13767        for (i = 0; i < len; i++) {
13768            temp[inputArray[i]] = 0;
13769        }
13770        for (i in temp) {
13771            outputArray.push(i);
13772        }
13773        return outputArray;
13774    }
13775
13776    //// filter items when filter link is clicked
13777	var clearIsoAnimation = null;
13778	var $checkForScrollBar = null;
13779
13780
13781	//number portfolios so multiple sortable ones can work easily on same page
13782	$('.portfolio-items:not(".carousel")').each(function(i){
13783		$(this).attr('instance',i);
13784		$(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance',i);
13785	});
13786
13787    function isoClickFilter(){
13788		 var $timeout;		 
13789		 if(window.innerWidth > 690 && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
13790		 	
13791			  
13792			 clearTimeout($timeout);
13793			 $timeout = setTimeout(function(){masonryZindex();  },600);
13794
13795			  
13796		 }
13797		  
13798		  var selector = $(this).attr('data-filter');
13799		  var $instance = $(this).parents('div[class^=portfolio-filters]').attr('instance');
13800
13801		  $.each($portfolio_containers,function(i){
13802		  	if($portfolio_containers[i].attr('instance') == $instance) { 
13803		  		$portfolio_containers[i].isotope({ filter: selector }).attr('data-current-cat',selector);
13804
13805		  		//fade in all incase user hasn't scrolled down yet
13806		  		if($portfolio_containers[i].find('.inner-wrap[data-animation="none"]').length == 0) {
13807			   		$portfolio_containers[i].find('.col').addClass('animated-in');
13808				}
13809		  	}
13810		  });
13811
13812
13813
13814
13815		  //active classes
13816		  $(this).parent().parent().find('li a').removeClass('active');
13817		  $(this).addClass('active');
13818		  
13819		  //update pp
13820		  if($('.portfolio-items a[rel^="prettyPhoto"]').length > 0) {
13821		  	setTimeout(updatePrettyPhotoGallery,170);
13822		  }
13823
13824		  else {
13825		  	setTimeout(updateMagPrettyPhotoGallery,170);
13826		  }
13827
13828		  return false;
13829	}
13830
13831	////filter event
13832	$('body').on('click','.portfolio-filters ul li a, .portfolio-filters-inline ul li a', isoClickFilter);
13833
13834
13835	function updatePrettyPhotoGallery(){
13836		$('.portfolio-items').each(function(){
13837
13838			if($(this).find('a[rel^="prettyPhoto"]').length > 0) {
13839
13840			var $unique_id = Math.floor(Math.random()*10000);
13841			var $currentCat = $(this).attr('data-current-cat');
13842			$(this).find('.col'+$currentCat).find('a[rel^="prettyPhoto"]').attr('rel','prettyPhoto['+$unique_id+'_sorted]');
13843			
13844			} 
13845			
13846		});
13847	}
13848
13849	function updateMagPrettyPhotoGallery(){
13850		$('.portfolio-items').each(function(){
13851
13852			var $currentCat = $(this).attr('data-current-cat');
13853			var $unique_id = Math.floor(Math.random()*10000);
13854			
13855			if($(this).is('[data-lightbox-only="true"]')){
13856				
13857					$(this).find('.col').each(function(){
13858		
13859						$(this).find('a.gallery').removeClass('gallery').removeClass('magnific');
13860						
13861						if($(this).is($currentCat)) {
13862							
13863							//parallax styles
13864							if($(this).find('.parallaxImg-wrap').length > 0) {
13865								
13866									if($('body[data-ls="fancybox"]').length > 0) {
13867										$(this).find('.work-item > a').attr('data-fancybox','group_'+$unique_id);
13868									} else {
13869										$(this).find('.work-item > a').addClass('gallery').addClass('magnific');
13870									}
13871									
13872							} else {
13873								//others
13874								
13875									if($('body[data-ls="fancybox"]').length > 0) {
13876										$(this).find('.work-item a').attr('data-fancybox','group_'+$unique_id);
13877									} else {
13878										$(this).find('.work-info a').addClass('gallery').addClass('magnific');
13879									}
13880									
13881							}
13882							
13883						}
13884		
13885					});
13886				
13887			}
13888			
13889			else if ($(this).find('.work-item.style-1').length > 0){
13890				
13891					$(this).find('.col').each(function(){
13892		
13893						$(this).find('a.gallery').removeClass('gallery').removeClass('magnific');
13894						
13895						if($(this).is($currentCat)) {
13896							
13897								if($('body[data-ls="fancybox"]').length > 0) {
13898									$(this).find('.work-info .vert-center a:first-of-type').attr('data-fancybox','group_'+$unique_id);
13899								} 
13900								else {
13901									$(this).find('.work-info .vert-center a:first-of-type').addClass('gallery').addClass('magnific');
13902								}
13903								
13904						}
13905		
13906					});
13907			}
13908			
13909		
13910			
13911		});
13912	}
13913
13914
13915
13916	$blog_containers = [];
13917
13918	$('.posts-container').each(function(i){
13919		$blog_containers[i] = $(this);
13920	});
13921
13922  function masonryBlogInit() {
13923
13924		//// cache window
13925		var $window = jQuery(window);	
13926		
13927			
13928		$.each($blog_containers,function(i){
13929
13930			
13931				if($blog_containers[i].parent().hasClass('masonry')) { 
13932					
13933					$blog_containers[i].find('article').addClass('masonry-blog-item');
13934					
13935					if($blog_containers[i].parents('.masonry.classic').length > 0) {
13936						$blog_containers[i].find('article').prepend('<span class="bottom-line"></span>');
13937					}
13938					
13939					//move the meta to the bottom
13940					$blog_containers[i].find('article').each(function(){
13941						
13942						var $metaClone = $(this).find('.post-meta').clone();
13943
13944						$(this).find('.post-meta').remove();
13945
13946						if($blog_containers[i].parents('.post-area.meta_overlaid').length > 0){
13947							$(this).find('.post-header h2').after($metaClone);
13948						} else {
13949							$(this).find('.content-inner').after($metaClone);
13950						}
13951						
13952					});
13953				
13954					
13955					if($blog_containers[i].parent().hasClass('masonry') && $blog_containers[i].parent().hasClass('full-width-content')){
13956						$blog_containers[i].parent().wrap('<div class="full-width-content blog-fullwidth-wrap"> </div>').removeClass('full-width-content').css({'margin-left':'0','width':'auto'});
13957						
13958						//page header animation fix
13959						if( $blog_containers[i].parents('.wpb_row').length > 0 ) $blog_containers[i].parents('.wpb_row').css('z-index',100);
13960
13961						if(!$blog_containers[i].parent().hasClass('meta_overlaid') && !$blog_containers[i].parent().hasClass('auto_meta_overlaid_spaced')) {
13962
13963							if($blog_containers[i].parent().hasClass('classic_enhanced')) {
13964								$blog_containers[i].parent().parents('.full-width-content').css({
13965									'padding' : '0px 0.2% 0px 2.4%'
13966								});
13967							} else {
13968								$blog_containers[i].parent().parents('.full-width-content').css({
13969									'padding' : '0px 0.2% 0px 3.2%'
13970								});
13971							}
13972							
13973						} else {
13974							$blog_containers[i].parent().parents('.full-width-content').addClass('meta-overlaid');
13975							$('.container-wrap').addClass('meta_overlaid_blog');
13976						}
13977
13978						fullWidthSections(); 
13979					}
13980					
13981					var $cols = 3;
13982					var $element = $blog_containers[i];
13983					
13984					if($blog_containers[i].find('img').length == 0) $element = $('<img />');
13985				
13986					imagesLoaded($element,function(instance){
13987						
13988						if($('body').hasClass('mobile') || $blog_containers[i].parents('.post-area').hasClass('span_9')) {
13989							$cols = 2;
13990						}
13991
13992						//set img as BG if masonry classic enhanced
13993						if($blog_containers[i].parent().hasClass('classic_enhanced')){
13994							$blog_containers[i].find('.large_featured.has-post-thumbnail .post-featured-img, .wide_tall.has-post-thumbnail .post-featured-img').each(function(){
13995								var $src = $(this).find('img').attr('src');
13996								$(this).css('background-image','url('+$src+')');
13997							});
13998
13999							$blog_containers[i].find('.large_featured .nectar-flickity, .wide_tall .nectar-flickity').each(function(){
14000
14001								$(this).find('.cell').each(function(){
14002									var $src = $(this).find('img').attr('src');
14003									$(this).css('background-image','url('+$src+')');
14004								});
14005								
14006							});
14007						}
14008
14009						$cols = blogColumnNumbCalcs($blog_containers[i]);
14010						blogHeightCalcs($blog_containers[i], $cols);
14011
14012						if($blog_containers[i].parents('.post-area.meta_overlaid').length > 0) {
14013							$blog_containers[i].isotope({
14014							   itemSelector: 'article',
14015							   transitionDuration: '0s',
14016							   layoutMode: 'packery',
14017							   packery: { 
14018							   	 gutter: 0
14019							   	}
14020							}).isotope( 'layout' );
14021
14022						   
14023						} else if ($blog_containers[i].parents('.auto_meta_overlaid_spaced').length > 0) {
14024							
14025							$multiplier = .025;
14026							if($blog_containers[i].parents('.blog-fullwidth-wrap').length > 0) {
14027									$multiplier = .02;
14028							}
14029							
14030							$blog_containers[i].isotope({
14031								layoutMode: 'packery',
14032								transitionDuration: '0s',
14033								packery: {
14034									 /* gutter: $blog_containers[i].parents('.post-area').width() * $multiplier */
14035									 gutter: 0
14036								}
14037						 });
14038						 
14039						}  else {
14040						   if($blog_containers[i].parent().hasClass('classic_enhanced')) {
14041							   	if($blog_containers[i].parents('.span_9.masonry').length == 0) {
14042							   		$multiplier = (window.innerWidth >= 1600) ? .015 : .02;
14043							   	} else {
14044							   		$multiplier = .04;
14045							    } 
14046						    }
14047							else {
14048 								 		$multiplier = ($blog_containers[i].parents('.span_9.masonry').length == 0) ? .03: .055;
14049 							 }
14050						   
14051							$blog_containers[i].isotope({
14052							   itemSelector: 'article',
14053							   transitionDuration: '0s',
14054							   layoutMode: 'packery',
14055							   packery: { 
14056							   	 gutter: $blog_containers[i].parents('.post-area').width()*$multiplier
14057							   	}
14058							}).isotope( 'layout' );
14059						}
14060
14061						blogLoadIn($blog_containers[i]);
14062						flickityBlogInit();
14063						
14064						$(window).trigger('resize');
14065
14066							
14067					});
14068					
14069					$(window).resize(function(){
14070						
14071
14072					   //size all items in grid 
14073					   //sizing for large items
14074						 if(typeof $blog_containers[i] !== 'undefined') { 
14075							 
14076							  $cols = blogColumnNumbCalcs($blog_containers[i]);
14077								blogHeightCalcs($blog_containers[i], $cols);
14078								
14079								if($blog_containers[i].parents('.post-area.meta_overlaid').length > 0) {
14080								
14081								    $blog_containers[i].isotope({
14082								      layoutMode: 'packery',
14083								      packery: {
14084								      	 gutter: 0
14085								      }
14086								   });
14087								} else if ($blog_containers[i].parents('.auto_meta_overlaid_spaced').length > 0) {
14088									
14089									$multiplier = .025;
14090									if($blog_containers[i].parents('.blog-fullwidth-wrap').length > 0) {
14091											$multiplier = .02;
14092									}
14093									
14094									$blog_containers[i].isotope({
14095										layoutMode: 'packery',
14096										transitionDuration: '0s',
14097										packery: {
14098											/*
14099											 gutter: $blog_containers[i].parents('.post-area').width() * $multiplier
14100											 */
14101											 gutter: 0
14102										}
14103								 });
14104								} else {
14105								   
14106								   if($blog_containers[i].parent().hasClass('classic_enhanced')) {
14107								   		if($blog_containers[i].parents('.span_9.masonry').length == 0) {
14108									   		$multiplier = (window.innerWidth >= 1600) ? .015 : .02;
14109									   	} else {
14110									   		$multiplier = .04;
14111									    } 
14112								   } else {
14113										 		$multiplier = ($blog_containers[i].parents('.span_9.masonry').length == 0) ? .03: .055;
14114												if($blog_containers[i].parents('.blog-fullwidth-wrap').length > 0) {
14115														$multiplier = .02;
14116												}
14117									 } 
14118								  
14119								   $blog_containers[i].isotope({
14120								   	layoutMode: 'packery',
14121								      packery: { 
14122								      	gutter: $blog_containers[i].parents('.post-area').width()*$multiplier
14123								      }
14124								   });
14125								}
14126								
14127							} // if $blog_containers[i]
14128
14129					});
14130					
14131					
14132			    } else {
14133			    	blogLoadIn($blog_containers[i]);
14134			    }
14135
14136		});
14137		
14138		//set z-index / animation order only once
14139		setTimeout(blogMasonryZindex,700);
14140		$window.smartresize( function(){
14141			setTimeout(blogMasonryZindex,700);
14142		});
14143		
14144	}
14145	
14146	masonryBlogInit();
14147
14148	function blogLoadIn(post_container){
14149
14150
14151		if(post_container.attr('data-load-animation') == 'none') {
14152		
14153			post_container.find('.inner-wrap').removeClass('animated');
14154
14155		} else {
14156
14157			post_container.find('article').each(function(i){
14158
14159				//loaded visible
14160				if($(this).visible(true)) {
14161
14162					$(this).delay(110*i).queue(function(next){
14163					    $(this).addClass("animated-in");
14164					    next();
14165					});
14166
14167
14168				} else {
14169					//not already visible
14170					var $that = $(this);
14171					var waypoint = new Waypoint({
14172
14173			 			element: $that,
14174			 			 handler: function(direction) {
14175							
14176							setTimeout(function(){
14177							    $that.addClass("animated-in");
14178							},80*$that.attr('data-delay-amount'));
14179
14180							waypoint.destroy();
14181						},
14182						offset: '90%'
14183
14184					}); 
14185				}
14186
14187
14188			});
14189	
14190			
14191		}
14192
14193	}
14194
14195	function blogHeightCalcs($posts_container, cols) {
14196		if( $posts_container.parent().hasClass('meta_overlaid') && $posts_container.find('article[class*="regular"]').length > 0) {
14197
14198			//widths
14199			$.each($posts_container,function(i,v){
14200			 	var $colSize = 4;
14201			 	var $mult = (cols == 1) ? 1 : 2;
14202
14203			 	//check if higher than IE9 -- bugs out with width calc
14204			 	if($('html.no-csstransitions').length == 0) {
14205			 		$(v).find('article[class*="regular"]').css('width',Math.floor($(v).width()/cols) +'px');
14206			 		$(v).find('article[class*="tall"]').css('width',Math.floor($(v).width()/cols*$mult) +'px');
14207			 	} else {
14208			 		$('.post-area.masonry').css('width','100%');
14209			 	}
14210			 	
14211			 	
14212			 });
14213
14214			   //reset height for calcs
14215			   $posts_container.find('article[class*="regular"] img').css('height','auto');
14216
14217			   var tallColHeight = Math.ceil($posts_container.find('article[class*="regular"]:not(".format-link"):not(".format-quote") img').first().height());
14218			   var multipler = (window.innerWidth > 690) ? 2 : 1 ;
14219			   $posts_container.find('article[class*="tall"] img, .article.wide img, article.regular img').removeClass('auto-height');
14220			   $posts_container.find('article[class*="tall"] img').css('height',(tallColHeight*multipler));
14221			   $posts_container.find('article[class*="regular"] img').css('height',(tallColHeight));
14222			   //quote/links
14223			   $posts_container.find('article.regular.format-link,article.regular.format-quote').each(function(){
14224
14225			   		if(window.innerWidth > 690) {
14226			   			$(this).css({
14227			  	 			'height': tallColHeight
14228			   			});
14229			   		} else {
14230			   			$(this).css({
14231			  	 			'height': 'auto'
14232			   			});			 		
14233			   		}
14234			  	 	
14235			   	});
14236
14237
14238		} else {
14239			$posts_container.find('article[class*="tall"] img, article.regular img').addClass('auto-height');
14240		}
14241
14242
14243		if( $posts_container.parent().hasClass('classic_enhanced') && $posts_container.find('article[class*="regular"]').length > 0) {
14244			if($(window).width() > 690 ) 
14245				classicEnhancedSizing($posts_container.find('article:not(.large_featured):not(.wide_tall)'));
14246			else 
14247				classicEnhancedSizing($posts_container.find('article:not(.wide_tall)'));
14248
14249			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;
14250
14251			if($(window).width() > 690 ) 
14252				$posts_container.find('article.large_featured, article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
14253			else 
14254				$posts_container.find('article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
14255
14256		//for when no regular articles exist	
14257		} else if( $posts_container.parent().hasClass('classic_enhanced') && $posts_container.find('article[class*="regular"]').length == 0) {
14258			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;
14259
14260			if($(window).width() > 690 ) 
14261				$posts_container.find('article.large_featured, article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
14262			else 
14263				$posts_container.find('article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
14264		}
14265
14266		//IE9 fix
14267		if($('html.no-csstransitions').length > 0) 		
14268			$('.post-area.masonry').css('width','100%');
14269			 	
14270			 	
14271	}
14272
14273	function classicEnhancedSizing(elements) {
14274
14275		var tallestCol = 0;
14276		elements.find('.article-content-wrap').css('height','auto');
14277		elements.filter('.has-post-thumbnail').each(function(){
14278			($(this).find('.article-content-wrap').outerHeight(true) > tallestCol) ? tallestCol = $(this).find('.article-content-wrap').outerHeight(true) : tallestCol = tallestCol;
14279		});	
14280		
14281		elements.filter('.has-post-thumbnail').find('.article-content-wrap').css('height',(tallestCol));
14282
14283	}
14284
14285
14286	function blogStickySS() {
14287		$('#sidebar[data-nectar-ss="true"], #sidebar[data-nectar-ss="1"]').each(function(){
14288
14289			//padding from top of screen
14290			$ssExtraTopSpace = 50;
14291
14292			if($('#header-outer[data-remove-fixed="0"]').length > 0 && $('body[data-hhun="1"]').length == 0) { 
14293			 	$ssExtraTopSpace += $('#header-outer').outerHeight();	
14294				
14295				//resize effect
14296				if($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0 ) {
14297					 var shrinkNum = 6;		
14298					 var headerPadding2 = parseInt($('#header-outer').attr('data-padding')) - parseInt($('#header-outer').attr('data-padding'))/1.8;
14299					 shrinkNum = $('#header-outer').attr('data-shrink-num');
14300					 $ssExtraTopSpace -= shrinkNum;
14301					 $ssExtraTopSpace -= headerPadding2;
14302				}
14303
14304			}
14305
14306			if($('#wpadminbar').length > 0) {
14307				$ssExtraTopSpace += $('#wpadminbar').outerHeight();
14308			}
14309
14310 			if($('#header-outer').attr('data-using-secondary') == '1') {
14311				$ssExtraTopSpace += $('#header-secondary-outer').outerHeight();
14312			}
14313			
14314			if($(this).parents('.wpb_widgetised_column').length > 0) {
14315				$(this).parents('.wpb_column').theiaStickySidebar({
14316			      additionalMarginTop: $ssExtraTopSpace,
14317						updateSidebarHeight: false
14318			    });
14319			} else {
14320				$(this).theiaStickySidebar({
14321			      additionalMarginTop: $ssExtraTopSpace,
14322						updateSidebarHeight: false
14323			    });
14324			}
14325			
14326		});
14327	}
14328
14329	if( $().theiaStickySidebar ) {
14330		blogStickySS();
14331	}
14332
14333	var blogMediaQuerySize;
14334	function blogColumnNumbCalcs(post_container){
14335		   if($('body').hasClass('mobile') && window.innerWidth < 990 || post_container.parents('.post-area').hasClass('span_9') && post_container.parents('.post-area.meta_overlaid').length == 0) {
14336			   $cols = 2;
14337		   } 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 ){
14338		   		
14339				var windowSize = $(window).width();
14340
14341				
14342				if(window.innerWidth >= 1600){
14343					blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'four' :'five';
14344				} else if(window.innerWidth < 1600 && window.innerWidth >= 1300){
14345					blogMediaQuerySize = 'four';
14346				} else if(window.innerWidth < 1300 && window.innerWidth >= 990){
14347					blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'four' :'three';
14348				} else if(window.innerWidth < 990 && window.innerWidth >= 470){
14349					blogMediaQuerySize = 'two';
14350				} else if(window.innerWidth < 470){
14351					blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'two' :'one';
14352				}
14353			
14354				
14355				//boxed
14356				if($('#boxed').length > 0) {
14357					if(window.innerWidth > 1300){
14358						blogMediaQuerySize = 'four';
14359					} else if(window.innerWidth < 1300 && window.innerWidth > 990){
14360						blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'four' :'three';
14361					} else if(window.innerWidth < 990){
14362						blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'two' :'one';
14363					}
14364					
14365				}
14366				
14367				
14368				switch (blogMediaQuerySize) {
14369					case 'five':
14370						$cols = 5;
14371					break;
14372					
14373					case 'four':
14374						$cols = 4;
14375					break;
14376					
14377					case 'three':
14378						$cols = 3;
14379					break;
14380					
14381					case 'two':
14382						$cols = 2;
14383					break;
14384					
14385					case 'one':
14386						$cols = 1;
14387					break;
14388				}
14389		   		
14390			
14391		   } else {
14392
14393		   	   $cols = 3;
14394		   }
14395
14396		   return $cols;
14397
14398	}
14399
14400
14401
14402
14403
14404
14405var shrinkNum = 6;
14406		
14407if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
14408
14409headerPadding2 = headerPadding - headerPadding/1.8;
14410
14411$('body').on('click','.section-down-arrow',function(){
14412	
14413	if($(this).parents('.nectar-box-roll').length > 0) return false;
14414
14415	var $currentSection = $(this).parents('#page-header-bg');
14416	var $topDistance = $currentSection.attr('data-height');
14417	var $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0;
14418	var $bodyBorderSize = ($('.body-border-top').length > 0 && $(window).width() > 1000) ? $('.body-border-top').height(): 0;
14419	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0) ? 0 : $('#header-space').height();
14420	if($('body[data-permanent-transparent="1"]').length == 0) {
14421		//regular
14422		if(!$('body').hasClass('mobile')){
14423			if($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
14424				$('body,html').stop().animate({
14425					scrollTop: parseInt($topDistance) + $offset + 2 - $bodyBorderSize*2
14426				},1000,'easeInOutCubic')
14427			} else {
14428				$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
14429				if($('#header-outer[data-remove-fixed="1"]').length > 0) { 
14430					$headerNavSpace = 0;
14431					$offset = 0;
14432				}
14433				$('body,html').stop().animate({
14434					scrollTop: parseInt($topDistance - $headerNavSpace) +$resize + 3 + $offset 
14435				},1000,'easeInOutCubic')
14436
14437			}
14438			
14439		} else {
14440			$scrollPos = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? parseInt($topDistance) - $headerNavSpace + parseInt($currentSection.offset().top) + 2 : parseInt($topDistance) + parseInt($currentSection.offset().top) + 2;
14441			$('body,html').stop().animate({
14442				scrollTop: $scrollPos - $bodyBorderSize*2
14443			},1000,'easeInOutCubic')
14444		}
14445	} else {
14446		//permanent transparent
14447		$('body,html').stop().animate({
14448			scrollTop: parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize*2
14449		},1000,'easeInOutCubic')
14450	}
14451	return false;
14452});
14453
14454
14455$('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(){
14456	$(this).parents('.grav-wrap').find('img').addClass('hovered');
14457});
14458$('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(){
14459	$(this).parents('.grav-wrap').find('img').removeClass('hovered');
14460});  
14461
14462
14463
14464
14465/*-------------------------------------------------------------------------*/
14466/*	7.	Cross Browser Fixes
14467/*-------------------------------------------------------------------------*/	
14468	 
14469	 function crossBrowserFixes() {
14470	
14471		 
14472		//Fix current class in menu 
14473		if ($("body").hasClass("single-portfolio") || $('body').hasClass("error404") || $('body').hasClass("search-results")) {   
14474			$("li").removeClass("current_page_parent").removeClass("current-menu-ancestor").removeClass('current_page_ancestor');   
14475		}
14476		
14477		//for users updating to 8 with a custom, old header template file
14478		if($('html.js').length == 0) { $('html').removeClass('no-js').addClass('js'); }
14479
14480		//fix for IE8 nth-child
14481		$('.recent_projects_widget div a:nth-child(3n+3), #sidebar #flickr div:nth-child(3n+3) a, #footer-outer #flickr div:nth-child(3n+3) a').css('margin-right','0px');
14482		
14483		//remove br's from code tag
14484		$('code').find('br').remove();	
14485		
14486		//if a clear is the last div, remove the padding
14487		if($('.container.main-content > .row > div:last-child').hasClass('clear')) {
14488			$('.container.main-content > .row > div:last-child').css('padding-bottom','0');
14489		}
14490		
14491		//homepage recent blog for IE8
14492		$('.container-wrap .blog-recent > div:last-child').addClass('col_last');
14493		
14494		//blog ascend bottom padding
14495		if($('.single .blog_next_prev_buttons').length > 0) $('.container-wrap').css('padding-bottom',0);
14496
14497		//contact form
14498		$('.wpcf7-form p:has(input[type=submit])').css('padding-bottom','0px');
14499
14500		$('.full-width-content .wpcf7-submit').on('click',function(){ setTimeout(function(){ fullWidthContentColumns() },1000); setTimeout(function(){ fullWidthContentColumns() },2000); });
14501		
14502		//no caption home slider fix
14503		$('#featured article').each(function(){
14504			if($(this).find('h2').attr('data-has-caption') == '0') {
14505				$(this).parents('.slide').addClass('no-caption');
14506			}
14507		});
14508		
14509		//add class for IE
14510		var ua = window.navigator.userAgent;
14511		var msie = ua.indexOf("Edge/");
14512		if(msie > 0)
14513			$('body').addClass('msie');
14514
14515		//gravity form inside fw content row
14516		$('.gform_body').click(function(){
14517		   setTimeout(function(){ fullWidthContentColumns(); },200);
14518		 });
14519
14520		//chat post format nth child color
14521		$('article.post.format-chat .content-inner dt:odd').css('color','#333');
14522		
14523		//remove margin on last cols inside of full width sections 
14524		$('.full-width-section').each(function(){
14525			$(this).find('> .span_12 > div.col_last').last().css('margin-bottom','0');
14526		});
14527		
14528		//remove p tags from extra content editor when warpping only an img 
14529		$('#portfolio-extra p').each(function(){
14530			if($(this).find('*').length == 1 && $(this).find('img').length == 1) {
14531				$(this).find('img').unwrap();
14532			}
14533		});
14534	
14535
14536		//vc text_separator color
14537		$('.vc_text_separator').each(function(){
14538			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'));
14539		});
14540		
14541		//carousel head button alignment  
14542		$('.carousel-heading').each(function(){
14543			if($(this).find('h2').length > 0) $(this).find('.carousel-prev, .carousel-next').css('top','7px');
14544		});
14545		
14546		//remove carousel heading if not being used
14547		$('.carousel-wrap').each(function(){
14548			if($(this).find('.carousel-heading .container:empty').length > 0) $(this).find('.carousel-heading').remove();
14549		});
14550		
14551		//woocommerce product thuimbnails
14552		$('.woocommerce div.product div.images div.thumbnails a:nth-child(4n+4)').css('margin-right','0px');
14553		
14554		//remove extra galleries when using the nectar gallery slider on projects and posts
14555		$('article.post .gallery-slider .gallery,  article.post .gallery-slider .jetpack-slideshow, .single-portfolio .gallery-slider .gallery, .single-portfolio .gallery-slider .jetpack-slideshow').remove();
14556		
14557		
14558		$('.woocommerce .span_9 .products.related .products li:nth-child(4), .woocommerce .span_9 .products.upsells .products li:nth-child(4)').remove();
14559		$('.woocommerce .span_9 .products.related .products li:nth-child(3), .woocommerce .span_9 .products.upsells .products li:nth-child(3)').css('margin-right','0');	
14560		
14561		$('.cart-menu a, .widget_shopping_cart a').addClass('no-ajaxy');
14562
14563		//clients no hover if no link
14564		$('div.clients').each(function(){
14565			$(this).find('> div').each(function(){
14566				if($(this).find('a').length == 0) {
14567					$(this).addClass('no-link');
14568				}
14569			});
14570		});
14571
14572		//remove ajaxy from single posts when using disqus
14573		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');
14574
14575		//blog next color bg only 
14576		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();
14577		
14578		if($('#single-below-header').hasClass('fullscreen-header') && $('.blog_next_prev_buttons').length == 0 ) $('#author-bio, .comment-wrap').addClass('lighter-grey');
14579
14580		//shop header parallax margin 
14581		if($('body.woocommerce').find('#page-header-bg').length > 0){
14582			$('.container-wrap').css({'margin-top':'0px','padding-top':'30px'});
14583		}
14584		
14585		//if using wooCommerce sitewide notice
14586		if($('.demo_store').length > 0) $('#header-outer, #header-space').css('margin-top','32px');
14587		
14588		//footer last column class for IE8
14589		$('#footer-widgets .container .row > div:last-child').addClass('col_last');
14590		
14591		//nectar slider external links
14592		$('.swiper-slide.external-button-1 .buttons > div:nth-child(1) a').attr('target','_blank');
14593		$('.swiper-slide.external-button-2 .buttons > div:nth-child(2) a').attr('target','_blank');
14594		
14595		//portfolio external links
14596		$(".portfolio-items a[href*='http://']:not([href*='"+window.location.hostname+"']), .recent_projects_widget a[href*='http://']:not([href*='"+window.location.hostname+"'])").attr("target","_blank"); 
14597		$(".portfolio-items a[href*='https://']:not([href*='"+window.location.hostname+"']), .recent_projects_widget a[href*='https://']:not([href*='"+window.location.hostname+"'])").attr("target","_blank"); 
14598		
14599		//remove excess inner content when empty row
14600		$('.container-wrap .row > .wpb_row').each(function(){
14601			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();
14602		});
14603		
14604		//remove boxed style from full width content
14605		$('.full-width-content .col.boxed').removeClass('boxed');
14606		
14607		//remove full width attribute on slider in full width content section
14608		$('.full-width-content .wpb_column .nectar-slider-wrap[data-full-width="true"]').attr('data-full-width','false');	
14609
14610		if( $('.nectar-slider-wrap.first-section').length == 0 && 
14611			$('.full-width-section.first-section > .span_12 > .vc_span12 > .wpb_wrapper > .nectar-slider-wrap').length == 0  && 
14612			$('.parallax_slider_outer.first-section').length == 0 && 
14613			$('.full-width-content.first-section .wpb_wrapper > .nectar-slider-wrap').length == 0  && 
14614			!($('.wpb_row.first-section > .nectar-parallax-scene').length == 1 && $('#header-outer[data-transparent-header="true"]').length == 1) ) { 
14615			$('#header-outer .ns-loading-cover').remove(); 
14616	    }
14617
14618	    //neg marg z-index
14619	    $('.wpb_column.neg-marg').parents('.wpb_row').css('z-index','110');
14620
14621
14622	    //portfolio description remove on hover
14623	    var $tmpTitle = null;
14624	    $('.portfolio-items > .col a[title]').hover(function(){
14625	    	$tmpTitle = $(this).attr('title');
14626	    	$(this).attr('title',' ');
14627	    },function(){
14628	    	$(this).attr('title', $tmpTitle);
14629	    });
14630	    $('.portfolio-items > .col a[title]').click(function(){
14631			$(this).attr('title', $tmpTitle);
14632	    });
14633
14634	};
14635
14636	crossBrowserFixes();
14637
14638
14639
14640	jQuery( document.body ).on( 'updated_cart_totals', function() { 
14641		if($('.plus').length == 0) 
14642			$( '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" />' );
14643	});
14644
14645	// Quantity buttons
14646	if($('.plus').length == 0) {
14647		$( '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" />' );
14648
14649		$( document ).on( 'click', '.plus, .minus', function() {
14650
14651			// Get values
14652			var $qty		= $( this ).closest( '.quantity' ).find( '.qty' ),
14653				currentVal	= parseFloat( $qty.val() ),
14654				max			= parseFloat( $qty.attr( 'max' ) ),
14655				min			= parseFloat( $qty.attr( 'min' ) ),
14656				step		= $qty.attr( 'step' );
14657
14658			// Format values
14659			if ( ! currentVal || currentVal === '' || currentVal === 'NaN' ) currentVal = 0;
14660			if ( max === '' || max === 'NaN' ) max = '';
14661			if ( min === '' || min === 'NaN' ) min = 0;
14662			if ( step === 'any' || step === '' || step === undefined || parseFloat( step ) 
14662=== 'NaN' ) step = 1;
14663
14664			// Change the value
14665			if ( $( this ).is( '.plus' ) ) {
14666
14667				if ( max && ( max == currentVal || currentVal > max ) ) {
14668					$qty.val( max );
14669				} else {
14670					$qty.val( currentVal + parseFloat( step ) );
14671				}
14672
14673			} else {
14674
14675				if ( min && ( min == currentVal || currentVal < min ) ) {
14676					$qty.val( min );
14677				} else if ( currentVal > 0 ) {
14678					$qty.val( currentVal - parseFloat( step ) );
14679				}
14680
14681			}
14682
14683			// Trigger change event
14684			$qty.trigger( 'change' );
14685
14686		});
14687	}
14688
14689	function wooPriceSlider(){
14690
14691
14692		// woocommerce_price_slider_params is required to continue, ensure the object exists
14693		if ( typeof woocommerce_price_slider_params === 'undefined' || !$('body').hasClass('woocommerce') ) {
14694			return false;
14695		}
14696
14697		// Get markup ready for slider
14698		$( 'input#min_price, input#max_price' ).hide();
14699		$( '.price_slider, .price_label' ).show();
14700
14701		// Price slider uses jquery ui
14702		var min_price = $( '.price_slider_amount #min_price' ).data( 'min' ),
14703			max_price = $( '.price_slider_amount #max_price' ).data( 'max' );
14704
14705		current_min_price = parseInt( min_price, 10 );
14706		current_max_price = parseInt( max_price, 10 );
14707
14708		if ( woocommerce_price_slider_params.min_price ) current_min_price = parseInt( woocommerce_price_slider_params.min_price, 10 );
14709		if ( woocommerce_price_slider_params.max_price ) current_max_price = parseInt( woocommerce_price_slider_params.max_price, 10 );
14710
14711		$( 'body' ).bind( 'price_slider_create price_slider_slide', function( event, min, max ) {
14712			if ( woocommerce_price_slider_params.currency_pos === 'left' ) {
14713
14714				$( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + min );
14715				$( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + max );
14716
14717			} else if ( woocommerce_price_slider_params.currency_pos === 'left_space' ) {
14718
14719				$( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + " " + min );
14720				$( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + " " + max );
14721
14722			} else if ( woocommerce_price_slider_params.currency_pos === 'right' ) {
14723
14724				$( '.price_slider_amount span.from' ).html( min + woocommerce_price_slider_params.currency_symbol );
14725				$( '.price_slider_amount span.to' ).html( max + woocommerce_price_slider_params.currency_symbol );
14726
14727			} else if ( woocommerce_price_slider_params.currency_pos === 'right_space' ) {
14728
14729				$( '.price_slider_amount span.from' ).html( min + " " + woocommerce_price_slider_params.currency_symbol );
14730				$( '.price_slider_amount span.to' ).html( max + " " + woocommerce_price_slider_params.currency_symbol );
14731
14732			}
14733
14734			$( 'body' ).trigger( 'price_slider_updated', min, max );
14735		});
14736
14737		$( '.price_slider' ).slider({
14738			range: true,
14739			animate: true,
14740			min: min_price,
14741			max: max_price,
14742			values: [ current_min_price, current_max_price ],
14743			create : function( event, ui ) {
14744
14745				$( '.price_slider_amount #min_price' ).val( current_min_price );
14746				$( '.price_slider_amount #max_price' ).val( current_max_price );
14747
14748				$( 'body' ).trigger( 'price_slider_create', [ current_min_price, current_max_price ] );
14749			},
14750			slide: function( event, ui ) {
14751
14752				$( 'input#min_price' ).val( ui.values[0] );
14753				$( 'input#max_price' ).val( ui.values[1] );
14754
14755				$( 'body' ).trigger( 'price_slider_slide', [ ui.values[0], ui.values[1] ] );
14756			},
14757			change: function( event, ui ) {
14758
14759				$( 'body' ).trigger( 'price_slider_change', [ ui.values[0], ui.values[1] ] );
14760
14761			},
14762		});
14763
14764	}
14765	
14766
14767//vc col mobile fixes
14768function vcMobileColumns() {
14769
14770	$('.wpb_row').each(function(){
14771		if(typeof $(this).find('.span_12').offset() != 'undefined' ) {
14772		
14773			$(this).find('[class*="vc_col-"]').each(function(){
14774
14775				var $firstChildOffset = $(this).parents('.span_12').offset().left;
14776				
14777				$(this).removeClass('no-left-margin');
14778				if($(this).offset().left < $firstChildOffset + 27) { 
14779					$(this).addClass('no-left-margin');
14780				} else {
14781					$(this).removeClass('no-left-margin');
14782				}
14783			});
14784		}
14785	});
14786}
14787
14788if( $('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) vcMobileColumns();
14789
14790
14791/*-------------------------------------------------------------------------*/
14792/*	8.	Form Styling
14793/*-------------------------------------------------------------------------*/	
14794
14795if($('body[data-form-style="minimal"]').length > 0) {
14796
14797
14798	//turn user set place holders into labels for effect
14799	function convertPlaceholders() {
14800		$('form input[placeholder]:not([name="min_price"]):not(#search-outer input):not([name="max_price"]), form textarea[placeholder]').each(function(i){
14801			if($(this).attr('placeholder').length > 1) {
14802				var $placeholder = $(this).attr('placeholder');
14803				var $inputID = ($(this).is('[id]')) ? $(this).attr('id') : 'id-'+i;
14804				//add placeholder as label if label doesn't already exist
14805				
14806				//skip cf7                               //|| $(this).prev('label').length == 1 && $placeholder.length > $(this).prev('label').text().length
14807				if($(this).parents('.wpcf7-form-control-wrap').length == 0) {
14808					if($(this).prev('label').length == 0 || $(this).is('textarea')) {
14809						$('<label for="'+$inputID+'">'+$placeholder+'</label>').insertBefore($(this));
14810					}
14811				} else {
14812					if($(this).parents('.wpcf7-form-control-wrap').find('label').length == 0) {
14813						$('<label for="'+$inputID+'">'+$placeholder+'</label>').insertBefore($(this).parents('.wpcf7-form-control-wrap '));
14814					}
14815				}
14816				$(this).removeAttr('placeholder');
14817			}
14818		});
14819	}
14820	convertPlaceholders();
14821	setTimeout(convertPlaceholders,500);
14822	
14823	//woocommerce placeholder fix
14824	$( '#billing_country, #shipping_country, .country_to_state' ).on('change',function(){
14825		convertPlaceholders();
14826		removeExcessLabels();
14827		var $wooDynamicPlaceholders = setInterval(function(){
14828			convertPlaceholders();
14829			convertToMinimalStyle('form label');
14830			removeExcessLabels();
14831		},30);
14832		setTimeout(function(){ clearInterval($wooDynamicPlaceholders); },600);
14833		
14834	});
14835
14836	function convertToMinimalStyle(selector){
14837
14838		$(selector).each(function(){
14839			if($(this).parent().find('input:not([type="checkbox"]):not([type="hidden"]):not(#search-outer input):not(.adminbar-input):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="date"]):not([type="color"]):not([type="range"]):not([role="button"]):not([role="combobox"]):not(.select2-focusser):not([name="min_price"]):not([name="max_price"]):not([class="input-text qty text"])').length == 1 || $(this).parent().find('textarea').length == 1) {
14840				
14841				if($(this).parents('.minimal-form-input').length == 0 && $(this).parents('#wc-stripe-cc-form').length == 0) {
14842
14843					//if there's a direct input next to label
14844					
14845					if($(this).next('input').length == 1) {
14846		
14847						$(this).next('input').andSelf().wrapAll('<div class="minimal-form-input"/>');
14848					} else if($(this).find('.wpcf7-form-control-wrap').length > 0) {
14849						var $cloneInput = $(this).find('.wpcf7-form-control-wrap');
14850						$(this).find('.wpcf7-form-control-wrap').remove();
14851						$cloneInput.insertAfter($(this));
14852						$(this).parent().wrapInner('<div class="minimal-form-input" />');
14853					} else {
14854						//if we need to traverse to parent instead	
14855						$(this).parent().wrapInner('<div class="minimal-form-input" />');
14856					}
14857					$html = $(this).html();
14858					$(this)[0].innerHTML = '<span class="text"><span class="text-inner">'+$html+'</span></span>';
14859			
14860					if($(this).parent().find('textarea').length == 1) $(this).parents('.minimal-form-input').addClass('textarea');
14861				}
14862			}
14863
14864		});
14865
14866		//for labels that changed that already have minimal form markup - just need to update content
14867		$(selector).each(function(){
14868			if($(this).parents('.minimal-form-input').length == 1 && $(this).find('.text').length == 0) {
14869				
14870				$html = $(this).html();
14871				$(this)[0].innerHTML = '<span class="text"><span class="text-inner">'+$html+'</span></span>';
14872				
14873			}
14874
14875		});
14876	}
14877	
14878	convertToMinimalStyle('form label');
14879
14880	jQuery( document.body ).on( 'updated_cart_totals', function() { 
14881		convertPlaceholders();
14882		convertToMinimalStyle('form label');
14883		checkValueOnLoad();
14884	});
14885
14886	setTimeout(function(){ convertToMinimalStyle('form label'); removeExcessLabels(); checkValueOnLoad(); },501);
14887
14888	//remove excess labels
14889	function removeExcessLabels() {
14890		$('.minimal-form-input').each(function(){
14891			if($(this).find('label').length > 1) {
14892				$lngth = 0;
14893				$(this).find('label').each(function(){
14894					if($(this).text().length >= $lngth) {
14895						$lngth = $(this).text().length;
14896						$(this).parents('.minimal-form-input').find('label').addClass('tbr');
14897						$(this).removeClass('tbr');
14898					}
14899				});
14900				$(this).find('label.tbr').remove();
14901			}
14902		});
14903	}
14904	removeExcessLabels();
14905	
14906
14907	//add labels to inputs that don't have them
14908	$('input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not(#search-outer input):not([type="hidden"]):not([type="button"]):not([type="date"]):not([type="color"]):not([type="number"]):not([type="range"]):not([role="button"]):not([role="combobox"]):not(.select2-focusser):not([name="min_price"]):not([name="max_price"]), textarea').each(function(){
14909		if($(this).parents('.minimal-form-input').length == 0) {
14910
14911			$('<label></label>').insertBefore($(this));
14912			convertToMinimalStyle($(this).prev('label'));
14913		}
14914	});
14915
14916
14917	$('body').on('focus','.minimal-form-input input, .minimal-form-input textarea',function(){
14918		$(this).parents('.minimal-form-input').addClass('filled').removeClass('no-text');
14919	});
14920	$('body').on('blur','.minimal-form-input input, .minimal-form-input textarea',function(){
14921		if($(this).val().length > 0) $(this).parents('.minimal-form-input').addClass('has-text').removeClass('no-text');
14922		else $(this).parents('.minimal-form-input').removeClass('has-text').addClass('no-text');
14923		$(this).parents('.minimal-form-input').removeClass('filled');
14924	});
14925
14926
14927	//on load
14928	function checkValueOnLoad() {
14929		$('.minimal-form-input input, .minimal-form-input textarea').each(function(){
14930			if($(this).val().length > 0) $(this).parents('.minimal-form-input').addClass('has-text').removeClass('no-text');
14931		});
14932	}
14933	checkValueOnLoad();
14934
14935	 // Textarea Auto Resize
14936    var hiddenDiv = $('.hiddendiv').first();
14937    if (!hiddenDiv.length) {
14938      hiddenDiv = $('<div class="textareahiddendiv common"></div>');
14939      $('body').append(hiddenDiv);
14940    }
14941    var text_area_selector = 'textarea';
14942
14943    function textareaAutoResize($textarea) {
14944      // Set font properties of hiddenDiv
14945
14946      var fontFamily = $textarea.css('font-family');
14947      var fontSize = $textarea.css('font-size');
14948
14949      if (fontSize) { hiddenDiv.css('font-size', fontSize); }
14950      if (fontFamily) { hiddenDiv.css('font-family', fontFamily); }
14951
14952      if ($textarea.attr('wrap') === "off") {
14953        hiddenDiv.css('overflow-wrap', "normal")
14954                 .css('white-space', "pre");
14955      }
14956
14957
14958
14959
14960      hiddenDiv.text($textarea.val() + '\n');
14961      var content = hiddenDiv.html().replace(/\n/g, '<br>');
14962      hiddenDiv.html(content);
14963
14964
14965      // When textarea is hidden, width goes crazy.
14966      // Approximate with half of window size
14967
14968      if ($textarea.is(':visible')) {
14969        hiddenDiv.css('width', $textarea.width());
14970      }
14971      else {
14972        hiddenDiv.css('width', $(window).width()/2);
14973      }
14974
14975      $textarea.css('height', hiddenDiv.height());
14976    }
14977
14978    $(text_area_selector).each(function () {
14979      var $textarea = $(this);
14980      if ($textarea.val().length) {
14981        textareaAutoResize($textarea);
14982      }
14983    });
14984
14985    $('body').on('keyup keydown autoresize', text_area_selector, function () {
14986      textareaAutoResize($(this));
14987    });
14988
14989}
14990
14991
14992if($('body[data-fancy-form-rcs="1"]').length > 0) {
14993
14994	 //radio / checkbox markup conversion 
14995	 
14996    ////default
14997    $('input[type="checkbox"]').each(function(){
14998    	//check if for relationship exists
14999    	$id = $(this).attr('id');
15000    	if(typeof $id !== typeof undefined && $id !== false && $('label[for="'+$id+'"]').length > 0) {
15001    		$('label[for="'+$id+'"]').prepend('<span></span>');
15002    	} else {
15003    		if($(this).parents('.wpcf7-checkbox').length == 0) {
15004	    		$(this).addClass('non-minimal');
15005	    	}
15006    	}
15007			
15008			if($(this).is('[name="mailchimp_woocommerce_newsletter"]')) { $(this).addClass('non-minimal'); }
15009
15010    });	
15011
15012    ////for cf7
15013    $('.wpcf7-radio .wpcf7-list-item-label').each(function(i){
15014    	var $data = $(this).html();
15015    	var $name = $(this).parent().find('input').attr('name') + i;
15016    	$(this).parent().find('input').attr('id',$name);
15017    	$(this).replaceWith('<label for="'+$name+'">'+$data+'</label>');
15018    });
15019
15020     $('.wpcf7-checkbox .wpcf7-list-item-label').each(function(){
15021    	var $data = $(this).html();
15022    	var $name = $(this).parent().find('input').attr('value');
15023    	$(this).parent().find('input').attr('id',$name);
15024    	$(this).replaceWith('<label for="'+$name+'"><span></span>'+$data+'</label>');
15025    });
15026		
15027		////woocommerce checkout
15028		if($('.woocommerce-checkout #ship-to-different-address .woocommerce-form__label input[type="checkbox"]').length > 0){
15029			
15030			var $shipToDifLabel = $('.woocommerce-checkout #ship-to-different-address .woocommerce-form__label');
15031			var $shipToDifInputClone = $shipToDifLabel.find('input[type="checkbox"]').removeClass('non-minimal').clone();
15032			var $shipToDifId = ($shipToDifLabel.find('input[type="checkbox"][id]').length > 0) ? $shipToDifInputClone.attr('id') : '';
15033			
15034			$shipToDifLabel.find('span').contents().unwrap();
15035			$shipToDifLabel.prepend('<span></span>');
15036			$shipToDifLabel.attr('for',$shipToDifId);
15037			$shipToDifLabel.find('input[type="checkbox"]').remove();
15038			$shipToDifInputClone.insertBefore($shipToDifLabel);
15039
15040		}
15041		
15042		if($('.woocommerce-checkout #customer_details .woocommerce-account-fields .create-account .woocommerce-form__label').length > 0){
15043			
15044			var $createAccountLabel = $('.woocommerce-checkout #customer_details .woocommerce-account-fields .create-account .woocommerce-form__label');
15045			var $createAccountClone = $createAccountLabel.find('input[type="checkbox"]').removeClass('non-minimal').clone();
15046			var $createAccountId = ($createAccountLabel.find('input[type="checkbox"][id]').length > 0) ? $createAccountClone.attr('id') : '';
15047			
15048			$createAccountLabel.find('span').contents().unwrap();
15049			$createAccountLabel.prepend('<span></span>');
15050			$createAccountLabel.attr('for',$createAccountId);
15051			$createAccountLabel.find('input[type="checkbox"]').remove();
15052			$createAccountClone.insertBefore($createAccountLabel);
15053		
15054		}
15055		
15056    //select
15057    $('select:not(.comment-form-rating #rating)').each(function(){
15058
15059    	//cf7
15060    	if($(this).parents('.wpcf7-form-control-wrap').length > 0) {
15061
15062    		//select 2 already initialized
15063	    	if($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) {
15064	    		$selector = $($(this).prev('.select2-container'));
15065	    	} else {
15066	    		$selector = $(this);
15067	    	}
15068
15069	    	//if label is found
15070	    	if($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) {
15071	    		$selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />');
15072	    	} else {
15073	    		//default wrap
15074	    		$selector.wrap('<div class="fancy-select-wrap" />');
15075	    	}
15076    	} 
15077    	//default
15078    	else {
15079
15080	    	//select 2 already initialized
15081	    	if($(this).prev('.select2-container').length > 0) {
15082	    		$selector = $(this).prev('.select2-container');
15083	    	} else {
15084	    		$selector = $(this);
15085	    	}
15086
15087	    	//if label is found
15088	    	if($selector.prev('label').length == 1) {
15089	    		$selector.prev('label').andSelf().wrapAll('<div class="fancy-select-wrap" />');
15090	    	} else if($selector.next('label').length == 1) {
15091	    		$selector.next('label').andSelf().wrapAll('<div class="fancy-select-wrap" />');
15092	    	} else {
15093	    		//default wrap
15094	    		$selector.wrap('<div class="fancy-select-wrap" />');
15095	    	}
15096    	}
15097    });
15098	
15099	function select2Init(){
15100		$('select:not(.state_select):not(.country_select):not(.comment-form-rating #rating):not(#tribe-bar-form select)' ).each( function() {
15101
15102			if($(this).parents('.woocommerce-ordering').length == 0) {
15103				$( this ).select2({
15104					minimumResultsForSearch: 7,
15105					width: '100%'
15106				});
15107			} else {
15108				$( this ).select2({
15109					minimumResultsForSearch: 7,
15110					dropdownCssClass : 'bigdrop',
15111					dropdownAutoWidth: true
15112				});
15113			}
15114
15115		});
15116	}
15117   
15118	select2Init();
15119
15120}
15121	
15122	
15123
15124	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 ) {
15125
15126		$('#ajax-content-wrap').ajaxify({
15127			'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',
15128			'verbosity': 0, 
15129			requestDelay: 400,
15130			previewoff : true,
15131			memoryoff: true,
15132			turbo : false
15133		});
15134
15135		$(window).on("pronto.render", initPage)
15136		.on("pronto.load", destroyPage)
15137		.on("pronto.request", transitionPage);
15138
15139		if($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) setTimeout(function() { waypoints(); }, 750);
15140		else if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },300);
15141
15142		if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
15143			setTimeout(function(){ 
15144				$('#ajax-loading-screen').addClass('loaded');
15145			},30);
15146		}
15147
15148		initPage();
15149
15150	} else if($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="standard"]').length > 0 ) {
15151		
15152		//chrome white BG flash fix
15153		$('html').addClass('page-trans-loaded');
15154
15155		//fadeout loading animation
15156		if($('#ajax-loading-screen[data-effect="standard"]').length > 0) {
15157
15158			if($('.nectar-particles').length == 0) {
15159				setTimeout(function(){ 
15160					$('#ajax-loading-screen').transition({'opacity':0},500,function(){ 
15161						$(this).css({'display':'none'}); 
15162					}); 
15163					$('#ajax-loading-screen .loading-icon').transition({'opacity':0},500) 
15164				},30);
15165			}
15166
15167			//bind waypoints after loading screen has left
15168			if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },550);
15169
15170			//safari back/prev fix
15171			if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
15172				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) };
15173				window.onpageshow = function(event) {
15174		    		if (event.persisted) { 
15175		    			$('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ 
15176		    				$(this).css({'display':'none'}); 
15177		    			}); 
15178		    			$('#ajax-loading-screen .loading-icon').transition({'opacity':0},600);
15179		    		}
15180		    	}
15181			} else if(navigator.userAgent.indexOf('Firefox') != -1) {
15182				window.onunload = function(){};
15183			}
15184
15185	    		
15186	    	
15187			
15188		} else {
15189
15190			//for swipe trans add loaded immediately
15191			if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
15192				setTimeout(function(){ 
15193					$('#ajax-loading-screen').addClass('loaded');
15194				},60);
15195			}
15196
15197			if($('#page-header-wrap #page-header-bg[data-animate-in-effect="zoom-out"] .nectar-video-wrap').length == 0 && $('.parallax_slider_outer').length == 0 && $('.first-nectar-slider').length == 0) {
15198				setTimeout(function(){ 
15199					$('#ajax-loading-screen:not(.loaded)').addClass('loaded');
15200					setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
15201				},150);
15202			}
15203
15204			//safari back/prev fix
15205			if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
15206				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) };
15207				window.onpageshow = function(event) {
15208		    		if (event.persisted) { 
15209		    			$('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ 
15210		    				$(this).css({'display':'none'}); 
15211		    			}); 
15212		    			$('#ajax-loading-screen .loading-icon').transition({'opacity':0},600);
15213		    		}
15214		    	}
15215			} else if(navigator.userAgent.indexOf('Firefox') != -1) {
15216				window.onunload = function(){};
15217			}
15218			
15219			//bind waypoints after loading screen has left
15220			if($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { setTimeout(function() { waypoints(); }, 750); }
15221			else if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },350);
15222
15223		}
15224
15225		//remove excess loading images now
15226		$('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();
15227
15228
15229		if($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) {
15230			$('a[href]:not(.no-ajaxy):not([target="_blank"]):not([href^="#"]):not([href^="mailto:"]):not(.comment-edit-link):not(.magnific-popup):not([data-fancybox]):not(.magnific):not(.meta-comment-count a):not(.comments-link):not(#cancel-comment-reply-link):not(.comment-reply-link):not(#toggle-nav):not(.logged-in-as a):not(.add_to_cart_button):not(.section-down-arrow):not([data-filter]):not(.pp):not
15230([rel^="prettyPhoto"]):not(.pretty_photo)').click(function(e){
15231				
15232				//need to check on click again if link is just [href^="#"] since URLs could have been shortended via JS in scrollSpyInit
15233				if($(this).is('[href^="#"]')) return;
15234
15235				var $windowCurrentLocation = window.location.href.split("#")[0];
15236				var $windowClickedLocation = $(this).attr('href').split("#")[0];
15237
15238				if($(this).parents('#header-outer[data-format="left-header"]').length > 0 && $(this).parent().hasClass('menu-item-has-children')) 
15239					return;
15240
15241				if($(this).parent('.menu-item-has-children').length > 0 && $(this).parents('.off-canvas-menu-container').length > 0 || ($windowClickedLocation == $windowCurrentLocation)) {
15242
15243				} else {
15244					if(!$(this).parent().hasClass('no-ajaxy')) {
15245
15246						var $targetLocation = $(this).attr('href');
15247						var $timeOutDur = 0;
15248						if($targetLocation != '') {
15249
15250							$('#ajax-loading-screen').addClass('set-to-fade');
15251
15252							transitionPageStandard();
15253
15254							setTimeout(function(){
15255								window.location = $targetLocation;
15256							},$timeOutDur)
15257							
15258							return false;
15259						}
15260					}
15261				}
15262
15263			});
15264		} // if disable fade out is not on
15265	} else {	
15266		//bind waypoints regularly
15267		if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },100);
15268	}
15269
15270
15271	function transitionPage(e) {
15272		
15273		if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
15274
15275			if($(window).scrollTop() > 0) {
15276
15277				//stop nicescroll
15278				if($().niceScroll && $("html").getNiceScroll()){
15279					var nice = $("html").getNiceScroll();
15280					nice.stop();
15281				}
15282				
15283				$('body,html').stop(true,true).animate({
15284					scrollTop:0
15285				},500,'easeOutQuad',function(){ 
15286					
15287					//close widget area
15288					setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
15289					$('#ajax-loading-screen').removeClass('loaded');
15290					$('#ajax-loading-screen').addClass('in-from-right');
15291					setTimeout(function(){
15292						$('#ajax-loading-screen').addClass('loaded');
15293					},30);
15294
15295				});
15296			}
15297			else { 
15298				//close widget area
15299				setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
15300				$('#ajax-loading-screen').removeClass('loaded');
15301				$('#ajax-loading-screen').addClass('in-from-right');
15302				setTimeout(function(){
15303					$('#ajax-loading-screen').addClass('loaded');
15304				},30);
15305			}
15306
15307		} else {
15308			if($(window).scrollTop() > 0) {
15309
15310				//stop nicescroll
15311				if($().niceScroll && $("html").getNiceScroll()){
15312					var nice = $("html").getNiceScroll();
15313					nice.stop();
15314				}
15315				
15316				$('body,html').stop(true,true).animate({
15317					scrollTop:0
15318				},500,'easeOutQuad',function(){ 
15319					$('#ajax-loading-screen').css({'opacity':'1', 'display':'none'});
15320					$('#ajax-loading-screen').stop(true,true).fadeIn(600,function(){
15321						$('#ajax-loading-screen .loading-icon').animate({'opacity':1},400);
15322						//close widget area
15323						setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
15324					});
15325				});
15326
15327			} else {
15328				$('#ajax-loading-screen').css('opacity','1').stop().fadeIn(600,function(){
15329					$('#ajax-loading-screen .loading-icon').animate({'opacity':1},400);
15330				});
15331
15332				//close widget area
15333				setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
15334			}
15335		}
15336
15337		
15338	}
15339
15340	function transitionPageStandard(e) {
15341
15342		if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
15343			$('#ajax-loading-screen').removeClass('loaded');
15344			$('#ajax-loading-screen').addClass('in-from-right');
15345			setTimeout(function(){
15346				$('#ajax-loading-screen').addClass('loaded');
15347			},30);
15348		} else {
15349			if($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0) {
15350				$('#ajax-loading-screen').css('opacity','0').css('display','block').transition({'opacity':'1'},450);
15351			} else {
15352				$('#ajax-loading-screen').show().transition({'opacity':'1'},450);
15353			}
15354		}
15355		
15356		//setTimeout(function(){ $('#ajax-loading-screen .loading-icon').animate({'opacity':1},500); },400);
15357
15358	}
15359
15360	function destroyPage(e) {
15361		$(window).off('scroll.appear');
15362		if($('#nectar_fullscreen_rows').length > 0 && $().fullpage) 
15363			$.fn.fullpage.destroy('all');
15364	}
15365
15366	function initPage(e) {
15367
15368		if(!$('body').hasClass('ajax-loaded')) return false;
15369
15370
15371		//init js
15372		lightBoxInit();
15373		addOrRemoveSF();
15374		
15375		if($('body[data-header-format="left-header"]').length == 0) 
15376			$(".sf-menu").superfish('destroy');
15377		
15378		$('#header-outer').removeClass('dark-slide');
15379		initSF();
15380		SFArrows();
15381		headerInit();
15382		var $effectTimeout = ($('#ajax-loading-screen').length > 0) ? 800 : 0;
15383		pageHeaderTextEffectInit();
15384		if($('#page-header-bg .nectar-video-wrap video').length == 0) setTimeout(pageHeaderTextEffect,$effectTimeout);
15385		coloredButtons();
15386		columnBGColors();
15387		fwCarouselLinkFix();
15388		if($('.carousel').length > 0) {
15389			standardCarouselInit();
15390			clientsCarouselInit();
15391			carouselHeightCalcs();
15392		}
15393		if($('.owl-carousel').length > 0) owlCarouselInit();
15394		if($('.products-carousel').length > 0) productCarouselInit();
15395		if($('#nectar_fullscreen_rows').length > 0 && $().fullpage) {
15396			setFPNames();
15397			initFullPageFooter();
15398			fullscreenRowLogic();
15399			initNectarFP();
15400		}
15401		flexsliderInit();
15402		accordionInit();
15403		tabbedInit();
15404		tabbbedDeepLinking();
15405		accordionDeepLinking();
15406		ulChecks();
15407		oneFourthClasses();
15408		carouselfGrabbingClass();
15409		cascadingImageBGSizing();
15410		fullWidthSections();
15411		fwsClasses();
15412		fullwidthImgOnlySizingInit();
15413		fullwidthImgOnlySizing();
15414		fullWidthRowPaddingAdjustInit();
15415		fullWidthRowPaddingAdjustCalc();
15416		boxRollInit();
15417		rowColorOverlay();
15418		setTimeout(function(){ 
15419		   waypoints();
15420		   flickityInit();
15421		},100); 
15422		if($('body[data-animated-anchors="true"]').length > 0) setTimeout(scrollSpyInit,200);
15423		socialSharingInit();
15424		hotSpotHoverBind();
15425		pricingTableHeight();
15426		createTestimonialControls();
15427		imageWithHotspotClickEvents();
15428		testimonialSliderHeight(); 
15429		largeIconHover();
15430		if($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length == 0) {
15431			fullscreenMenuInit();
15432		}
15433		boxRollMouseWheelInit();
15434		midnightInit();
15435		responsiveVideoIframesInit();
15436		responsiveVideoIframes();
15437		fullWidthContentColumns();
15438		videoBGInit();
15439		$window.unbind('scroll.parallaxSections').unbind('resize.parallaxSections');
15440		parallaxScrollInit();
15441		
15442		$blog_containers = [];
15443		$('.posts-container').each(function(i){
15444			$blog_containers[i] = $(this);
15445		});
15446		
15447		masonryBlogInit();
15448		masonryPortfolioInit();
15449		portfolioAccentColor();
15450		portfolioHoverEffects();
15451		portfolioFiltersInit();
15452		style6Img();
15453		isotopeCatSelection();
15454		$(window).unbind('.infscr');
15455		infiniteScrollInit();
15456		toTopBind();
15457		centerLove();
15458		postNextButtonEffect();
15459		pageLoadHash();
15460		slideOutWidgetAreaScrolling();
15461
15462		//cf7
15463		if($().wpcf7InitForm) $('div.wpcf7 > form').wpcf7InitForm();
15464
15465		//woocommerce price slider
15466		wooPriceSlider();
15467
15468		//twitter widget 
15469		if(typeof twttr != 'undefined') { twttr.widgets.load(); }
15470
15471		//Calendarize.it
15472		if(typeof init_rhc === 'function') { init_rhc(); }
15473
15474		//unwrap post and protfolio videos
15475		$('.video-wrap iframe').unwrap();
15476		$('#sidebar iframe[src]').unwrap();
15477
15478		$('video:not(.slider-video)').attr('width','100%');
15479		$('video:not(.slider-video)').attr('height','100%'); 
15480
15481		$('.wp-video-shortcode.mejs-container').each(function(){
15482			$(this).attr('data-aspectRatio', parseInt($(this).css('height')) / parseInt($(this).css('width')));
15483		});
15484
15485		//mediaElement
15486		$('video.wp-media-shortcode-ajax, audio.wp-media-shortcode-ajax').each(function(){ 
15487			if(!$(this).parent().hasClass('mejs-mediaelement') && $().mediaelementplayer) {
15488				$(this).mediaelementplayer();  
15489			}
15490		});
15491
15492		$('.mejs-container').css({'height': '100%', 'width': '100%'});
15493		
15494		$('audio').attr('width','100%');
15495		$('audio').attr('height','100%');
15496
15497		$('audio').css('visibility','visible');
15498
15499		if($('body').hasClass('mobile')){
15500			$('video').css('visibility','hidden');
15501		} else {
15502			$('video').css('visibility','visible');
15503		}
15504
15505		$('.wpb_row:has(".nectar-video-wrap")').each(function(i){
15506			$(this).css('z-index',100 + i);
15507		});
15508
15509		showLateIframes();
15510
15511		mouseParallaxInit();
15512
15513		//chrome self hosted slider bg video correct
15514		 if(navigator.userAgent.indexOf('Chrome') > 0) { 
15515		 	$('.swiper-wrapper .video-wrap').each(function(i){
15516			  	var webmSource = jQuery(this).find('video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
15517	          	var firstVideo = jQuery(this).find('video').get(0);
15518	          	firstVideo.src = webmSource;
15519	          	firstVideo.load();
15520            });
15521	    }
15522
15523
15524		if($('.nectar-video-bg').length > 0) {
15525			setTimeout(function(){
15526			    	resizeVideoToCover();
15527			    	$('.video-color-overlay').each(function(){
15528			    		$(this).css('background-color',$(this).attr('data-color'));
15529			    	});
15530			    	$('.nectar-video-wrap').transition({'opacity':'1'},0);
15531			    	$('.video-color-overlay').transition({'opacity':'0.7'},0);
15532			    	
15533			    },400);
15534		}
15535
15536		
15537		nectarPageHeader();
15538	
15539
15540		//cart dropdown
15541		$('#header-outer div.cart-outer').hoverIntent(function(){
15542			$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).fadeIn(400);
15543			$('#header-outer .cart_list').stop(true,true).fadeIn(400);
15544			clearTimeout(timeout);
15545			$('#header-outer .cart-notification').fadeOut(300);
15546		});
15547
15548
15549		//remove excess loading images now
15550		$('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();
15551
15552		setTimeout(portfolioSidebarFollow,250);
15553		setTimeout(portfolioSidebarFollow,500);
15554		setTimeout(portfolioSidebarFollow,1000);
15555
15556		crossBrowserFixes();
15557
15558
15559		$(window).trigger('resize');
15560
15561		//fix admin bar
15562		$("#wpadminbar").show();	
15563
15564
15565		//close widget area
15566		if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click'); 
15567
15568		if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
15569			closeSearch();
15570			$('#ajax-loading-screen').removeClass('in-from-right').removeClass('loaded');
15571			setTimeout(function(){ $('#ajax-loading-screen').addClass('loaded'); },30);
15572		} else {
15573			//fade in page
15574			setTimeout(function(){ $('#ajax-loading-screen').stop(true,true).fadeOut(500, function(){ $('#ajax-loading-screen .loading-icon').css({'opacity':0}); }); closeSearch();  },200);
15575			setTimeout(function(){ $('#ajax-loading-screen').stop(true,true).fadeOut(500, function(){ $('#ajax-loading-screen .loading-icon').css({'opacity':0}); }); closeSearch(); },900);
15576		}
15577	} 
15578
15579
15580
15581(function($){
15582	if(!$.fn.textareaCount) { 
15583		$.fn.textareaCount = function(options, fn) {
15584	        var defaults = {
15585				maxCharacterSize: -1,
15586				originalStyle: 'originalTextareaInfo',
15587				warningStyle: 'warningTextareaInfo',
15588				warningNumber: 20,
15589				displayFormat: '#input characters | #words words'
15590			};
15591
15592			var options = $.extend(defaults, options);
15593
15594			var container = $(this);
15595
15596			$("<div class='charleft'>&nbsp;</div>").insertAfter(container);
15597
15598
15599			//create charleft css
15600			var charLeftCss = {
15601				'width' : container.width()
15602			};
15603
15604			var charLeftInfo = getNextCharLeftInformation(container);
15605			charLeftInfo.addClass(options.originalStyle);
15606			//charLeftInfo.css(charLeftCss);
15607
15608
15609			var numInput = 0;
15610			var maxCharacters = options.maxCharacterSize;
15611			var numLeft = 0;
15612			var numWords = 0;
15613
15614			container.bind('keyup', function(event){limitTextAreaByCharacterCount();})
15615					 .bind('mouseover', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);})
15616					 .bind('paste', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);});
15617
15618	        limitTextAreaByCharacterCount();
15619
15620			function limitTextAreaByCharacterCount(){
15621				charLeftInfo.html(countByCharacters());
15622
15623				//function call back
15624				if(typeof fn != 'undefined'){
15625					fn.call(this, getInfo());
15626				}
15627				return true;
15628			}
15629
15630			function countByCharacters(){
15631				var content = container.val();
15632				var contentLength = content.length;
15633				//Start Cut
15634				if(options.maxCharacterSize > 0){
15635					//If copied content is already more than maxCharacterSize, chop it to maxCharacterSize.
15636					if(contentLength >= options.maxCharacterSize) {
15637						content = content.substring(0, options.maxCharacterSize);
15638					}
15639
15640					var newlineCount = getNewlineCount(content);
15641
15642					// newlineCount new line character. For windows, it occupies 2 characters
15643					var systemmaxCharacterSize = options.maxCharacterSize - newlineCount;
15644					if (!isWin()){
15645						 systemmaxCharacterSize = options.maxCharacterSize
15646					}
15647					if(contentLength > systemmaxCharacterSize){
15648						//avoid scroll bar moving
15649						var originalScrollTopPosition = this.scrollTop;
15650						container.val(content.substring(0, systemmaxCharacterSize));
15651						this.scrollTop = originalScrollTopPosition;
15652					}
15653					charLeftInfo.removeClass(options.warningStyle);
15654					if(systemmaxCharacterSize - contentLength <= options.warningNumber){
15655						charLeftInfo.addClass(options.warningStyle);
15656					}
15657
15658					numInput = container.val().length + newlineCount;
15659					if(!isWin()){
15660						numInput = container.val().length;
15661					}
15662
15663					numWords = countWord(getCleanedWordString(container.val()));
15664
15665					numLeft = maxCharacters - numInput;
15666				} else {
15667					//normal count, no cut
15668					var newlineCount = getNewlineCount(content);
15669					numInput = container.val().length + newlineCount;
15670					if(!isWin()){
15671						numInput = container.val().length;
15672					}
15673					numWords = countWord(getCleanedWordString(container.val()));
15674				}
15675
15676				return formatDisplayInfo();
15677			}
15678
15679			function formatDisplayInfo(){
15680				var format = options.displayFormat;
15681				format = format.replace('#input', numInput);
15682				format = format.replace('#words', numWords);
15683				//When maxCharacters <= 0, #max, #left cannot be substituted.
15684				if(maxCharacters > 0){
15685					format = format.replace('#max', maxCharacters);
15686					format = format.replace('#left', numLeft);
15687				}
15688				return format;
15689			}
15690
15691			function getInfo(){
15692				var info = {
15693					input: numInput,
15694					max: maxCharacters,
15695					left: numLeft,
15696					words: numWords
15697				};
15698				return info;
15699			}
15700
15701			function getNextCharLeftInformation(container){
15702					return container.next('.charleft');
15703			}
15704
15705			function isWin(){
15706				var strOS = navigator.appVersion;
15707				if (strOS.toLowerCase().indexOf('win') != -1){
15708					return true;
15709				}
15710				return false;
15711			}
15712
15713			function getNewlineCount(content){
15714				var newlineCount = 0;
15715				for(var i=0; i<content.length;i++){
15716					if(content.charAt(i) == '\n'){
15717						newlineCount++;
15718					}
15719				}
15720				return newlineCount;
15721			}
15722
15723			function getCleanedWordString(content){
15724				var fullStr = content + " ";
15725				var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
15726				var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
15727				var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
15728				var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
15729				var splitString = cleanedStr.split(" ");
15730				return splitString;
15731			}
15732
15733			function countWord(cleanedWordString){
15734				var word_count = cleanedWordString.length-1;
15735				return word_count;
15736			}
15737		};
15738	}
15739})(jQuery);	
15740	
15741	
15742	
15743	
15744});
15745
15746
15747 }(window.jQuery, window, document));
15748
15749
15750function resizeIframe() {
15751	var element = document.getElementById("pp_full_res").getElementsByTagName("iframe");
15752	var height = element[0].contentWindow.document.body.scrollHeight;
15753    
15754    //iframe height
15755    element[0].style.height = height + 'px';
15756	
15757	//pp height
15758	document.getElementsByClassName("pp_content_container")[0].style.height = height+40+ 'px';
15759	document.getElementsByClassName("pp_content")[0].style.height = height+40+ 'px';
15760	
15761}
15762
15763
15764
15765/*!
15766 * hoverIntent v1.9.0 // 2017.09.01 // jQuery v1.7.0+
15767 * http://briancherne.github.io/jquery-hoverIntent/
15768 *
15769 * You may use hoverIntent under the terms of the MIT license. Basically that
15770 * means you are free to use hoverIntent as long as this header is left intact.
15771 * Copyright 2007-2017 Brian Cherne
15772 */
15773!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));
15773var 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.