PageSourceSearch

https://mesverdbenicalap.eu/wp-content/themes/salient/js/init.js?ver=8.0.1

js mesverdbenicalap.eu collected 2026-10-06 19:46:43 UTC 588,661 bytes, 14,920 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,068 bytes, lines 25-34
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))}();
32
33//visible
34!function(t){var i=t(window);
vendor: 4,627 bytes, lines 34-44
34t.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/***************** Pretty Photo ******************/
54	
55	function prettyPhotoInit(){
56		
57		//add galleries to portfolios
58		$('.portfolio-items').each(function(){
59			var $unique_id = Math.floor(Math.random()*10000);
60			$(this).find('.pretty_photo').attr('rel','prettyPhoto['+$unique_id+'_gal]').removeClass('pretty_photo');
61		});
62		
63		$("a[data-rel='prettyPhoto[product-gallery]'], a[data-rel='prettyPhoto']").each(function(){
64			$(this).attr('rel',$(this).attr('data-rel'));
65			$(this).removeAttr('data-rel');
66		});
67		
68		//image gallery basic/nectar
69		$('.wpb_gallery .wpb_flexslider').each(function(){
70			var $unique_id = Math.floor(Math.random()*10000);
71			$(this).find('.slides li a').attr('rel','prettyPhoto['+$unique_id+'_gal]');
72		});
73		$('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function(){
74			var $unique_id = Math.floor(Math.random()*10000);
75			$(this).find('.swiper-slide a:not(.ext-url-link)').attr('rel','prettyPhoto['+$unique_id+'_gal]');
76		});
77
78		$('.wpb_gallery .wpb_gallery_slidesflickity_style').each(function(){
79			var $unique_id = Math.floor(Math.random()*10000);
80			$(this).find('.cell > a:not(.ext-url-link)').attr('rel','prettyPhoto['+$unique_id+'_gal]');
81		});
82
83		$('.wpb_gallery .wpb_gallery_slidesparallax_image_grid').each(function(){
84			var $unique_id = Math.floor(Math.random()*10000);
85			$(this).find('.parallaxImg-layer a.pretty_photo:not(.ext-url-link)').attr('rel','prettyPhoto['+$unique_id+'_gal]');
86		});
87
88		//nectar auto lightbox
89		if($('body').hasClass('nectar-auto-lightbox')){
90			$('.gallery').each(function(){
91				if($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) {
92					var $unique_id = Math.floor(Math.random()*10000);
93					$(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('rel','prettyPhoto['+$unique_id+'_gal]').removeClass('pretty_photo');
94				}
95			});
96			$('.main-content img').each(function(){
97				if($(this).parent().is("[href]") && !$(this).parent().is("[rel*='prettyPhoto']") && $(this).parents('.product-image').length == 0 && $(this).parents('.iosSlider.product-slider').length == 0) {
98					var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/);
99					if(match) $(this).parent().attr('rel','prettyPhoto');
100				} 
101			});
102		}
103		
104		
105		//convert class usage into rel
106		$('a.pp').removeClass('pp').attr('rel','prettyPhoto');
107		
108		 var loading_animation = ($('body[data-loading-animation]').attr('data-loading-animation') != 'none') ? $('body').attr('data-loading-animation') : null ;
109		 var ascend_loader = ($('body').hasClass('ascend')) ? '<span class="default-loading-icon spin"></span>' :'';
110		 var ascend_loader_class = ($('body').hasClass('ascend')) ? 'default_loader ' : '';
111		$("a[rel^='prettyPhoto']").prettyPhoto({
112			theme: 'dark_rounded',
113			allow_resize: true,
114			default_width: 1024,
115			opacity: 0.85, 
116			animation_speed: 'normal',
117			deeplinking: false,
118			default_height: 576,
119			social_tools: '',
120			markup: '<div class="pp_pic_holder"> \
121						   <div class="ppt">&nbsp;</div> \
122							<div class="pp_details"> \
123								<div class="pp_nav"> \
124								    <a href="#" class="pp_arrow_previous"> <i class="icon-salient-left-arrow-thin icon-default-style"></i> </a> \
125									<a href="#" class="pp_arrow_next"> <i class="icon-salient-right-arrow-thin icon-default-style"></i> </a> \
126									<p class="currentTextHolder">0/0</p> \
127								</div> \
128								<a class="pp_close" href="#"><span class="icon-salient-x icon-default-style"></span></a> \
129							</div> \
130							<div class="pp_content_container"> \
131								<div class="pp_left"> \
132								<div class="pp_right"> \
133									<div class="pp_content"> \
134										<div class="pp_fade"> \
135											<div class="pp_hoverContainer"> \
136											</div> \
137											<div id="pp_full_res"></div> \
138											<p class="pp_description"></p> \
139										</div> \
140									</div> \
141								</div> \
142								</div> \
143							</div> \
144						</div> \
145						<div class="pp_loaderIcon ' + ascend_loader_class + loading_animation+'"> '+ascend_loader+' </div> \
146						<div class="pp_overlay"></div>'
147		});
148		
149	}
150
151
152	function magnificInit() {
153		
154		//convert old pp links
155		$('a.pp').removeClass('pp').addClass('magnific-popup');
156		$("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])").removeAttr('rel').addClass('magnific-popup');
157
158
159		//image gallery nectar
160		$('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function(){
161			var $unique_id = Math.floor(Math.random()*10000);
162			$(this).find('.swiper-slide a:not(.ext-url-link)').addClass('pretty_photo');
163		});
164
165		//flex
166		$('.wpb_gallery_slides.wpb_flexslider').each(function(){
167			var $unique_id = Math.floor(Math.random()*10000);
168			$(this).find('.slides > li > a').addClass('pretty_photo');
169		});
170		//touch enabled gal
171		$('.wpb_gallery_slidesflickity_style').each(function(){
172			var $unique_id = Math.floor(Math.random()*10000);
173			$(this).find('.cell > a:not(.ext-url-link)').addClass('pretty_photo');
174		});
175
176		//add galleries to portfolios
177		$('.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(){
178			if($(this).find('.pretty_photo').length > 0) {
179				$(this).find('.pretty_photo').removeClass('pretty_photo').addClass('gallery').addClass('magnific');
180			} else if($(this).find('a[rel*="prettyPhoto["]').length > 0){
181				$(this).find('a[rel*="prettyPhoto["]').removeAttr('rel').addClass('gallery').addClass('magnific');
182			}
183
184		});
185		
186		$("a[data-rel='prettyPhoto[product-gallery]']").each(function(){
187			$(this).removeAttr('data-rel').addClass('magnific').addClass('gallery');
188		});
189		
190		//nectar auto lightbox
191		if($('body').hasClass('nectar-auto-lightbox')){
192			$('.gallery').each(function(){
193				if($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) {
194					var $unique_id = Math.floor(Math.random()*10000);
195					$(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');
196				}
197			});
198			$('.main-content img').each(function(){
199				if($(this).parent().is("[href]") && !$(this).parent().is(".magnific-popup") && $(this).parents('.product-image').length == 0 && $(this).parents('.iosSlider.product-slider').length == 0) {
200					var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/);
201					if(match) $(this).parent().addClass('magnific-popup').addClass('image-link');
202				} 
203			});
204		}
205		
206
207		//regular
208		$('a.magnific-popup:not(.gallery):not(.nectar_video_lightbox)').magnificPopup({ 
209			type: 'image', 
210			callbacks: {
211				
212				imageLoadComplete: function()  {	
213					var $that = this;
214					setTimeout( function() { $that.wrap.addClass('mfp-image-loaded'); }, 10);
215				},
216				beforeOpen: function() {
217				    this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
218			    },
219			    open: function() {
220					    	
221					$.magnificPopup.instance.next = function() {
222						var $that = this;
223
224						this.wrap.removeClass('mfp-image-loaded');
225						setTimeout( function() { $.magnificPopup.proto.next.call($that); }, 100);
226					}
227
228					$.magnificPopup.instance.prev = function() {
229						var $that = this;
230
231						this.wrap.removeClass('mfp-image-loaded');
232						setTimeout( function() { $.magnificPopup.proto.prev.call($that); }, 100);
233					}
234					
235				}
236			},
237			fixedContentPos: false,
238		    mainClass: 'mfp-zoom-in', 
239		    removalDelay: 400 
240		});
241
242		//video
243		$('a.magnific-popup.nectar_video_lightbox, .swiper-slide a[href*=youtube], .swiper-slide a[href*=vimeo], .nectar-video-box > a.full-link.magnific-popup').magnificPopup({ 
244			type: 'iframe', 
245			fixedContentPos: false,
246		    mainClass: 'mfp-zoom-in', 
247		    removalDelay: 400 
248		});
249
250
251		//galleries
252		$('a.magnific.gallery').each(function(){
253
254			var $parentRow = ($(this).closest('.wpb_column').length > 0) ? $(this).closest('.wpb_column') : $(this).parents('.row');
255			if($parentRow.length > 0 && !$parentRow.hasClass('lightbox-col')) {
256
257				$parentRow.magnificPopup({
258					type: 'image',
259					delegate: 'a.magnific',
260					mainClass: 'mfp-zoom-in',
261					fixedContentPos: false,
262					callbacks: {
263
264						elementParse: function(item) {
265			
266							 if($(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('iframe=true') != -1) {
267						         item.type = 'iframe';
268						      } else {
269						         item.type = 'image';
270						      }
271						},
272
273						imageLoadComplete: function()  {	
274							var $that = this;
275							setTimeout( function() { $that.wrap.addClass('mfp-image-loaded'); }, 10);
276						},
277
278						beforeOpen: function() {
279					       this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
280					    },
281
282					    open: function() {
283					    	
284							$.magnificPopup.instance.next = function() {
285								var $that = this;
286
287								this.wrap.removeClass('mfp-image-loaded');
288								setTimeout( function() { $.magnificPopup.proto.next.call($that); }, 100);
289							}
290
291							$.magnificPopup.instance.prev = function() {
292								var $that = this;
293
294								this.wrap.removeClass('mfp-image-loaded');
295								setTimeout( function() { $.magnificPopup.proto.prev.call($that); }, 100);
296							}
297							
298						}
299					},
300					removalDelay: 400, 
301					gallery: {
302			          enabled:true
303			        }
304				});
305
306				$parentRow.addClass('lightbox-col');
307			}
308			
309		});
310
311	}
312
313	function lightBoxInit() {
314		if($('body[data-ls="pretty_photo"]').length > 0) {
315			prettyPhotoInit();
316		} else if($('body[data-ls="magnific"]').length > 0) {
317			magnificInit();
318		}
319	}
320
321	lightBoxInit();
322	//check for late links
323	setTimeout(lightBoxInit,500);
324	
325/*!
326 * jQuery Transit - CSS3 transitions and transformations
327 * (c) 2011-2012 Rico Sta. Cruz <[email protected]>
328 * MIT Licensed.
329 *
330 * http://ricostacruz.com/jquery.transit
331 * http://github.com/rstacruz/jquery.transit
332 */
333(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
333)",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")}
333this.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);
334
335
336
337
338  // ========================= smartresize ===============================
339
340  /*
341   * smartresize: debounced resize event for jQuery
342   *
343   * latest version and complete README available on Github:
344   * https://github.com/louisremi/jquery.smartresize.js
345   *
346   * Copyright 2011 @louis_remi
347   * Licensed under the MIT license.
348   */
349
350  var $event = $.event,
351      dispatchMethod = $.event.handle ? 'handle' : 'dispatch',
352      resizeTimeout;
353
354  $event.special.smartresize = {
355    setup: function() {
356      $(this).bind( "resize", $event.special.smartresize.handler );
357    },
358    teardown: function() {
359      $(this).unbind( "resize", $event.special.smartresize.handler );
360    },
361    handler: function( event, execAsap ) {
362      // Save the context
363      var context = this,
364          args = arguments;
365
366      // set correct event type
367      event.type = "smartresize";
368
369      if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
370      resizeTimeout = setTimeout(function() {
371        $event[ dispatchMethod ].apply( context, args );
372      }, execAsap === "execAsap"? 0 : 100 );
373    }
374  };
375
376  $.fn.smartresize = function( fn ) {
377    return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
378  };
379
380
381/***************** Global vars ******************/
382var $standAnimatedColTimeout = [];
383var $animatedSVGIconTimeout = [];
384var $svg_icons = [];
385
386/***************** Smooth Scrolling ******************/
387
388	function niceScrollInit(){
389		$("html").niceScroll({
390			scrollspeed: 60,
391			mousescrollstep: 40,
392			cursorwidth: 15,
393			cursorborder: 0,
394			cursorcolor: '#303030',
395			cursorborderradius: 6,
396			autohidemode: false,
397			horizrailenabled: false
398		});
399		
400		
401		if($('#boxed').length == 0){
402			$('body, body #header-outer, body #header-secondary-outer, body #search-outer').css('padding-right','16px');
403		} else if($('body[data-ext-responsive="true"]').length == 0 ) {
404			$('body').css('padding-right','16px');
405		}
406		
407		$('html').addClass('no-overflow-y');
408	}
409
410	var $smoothActive = $('body').attr('data-smooth-scrolling'); 
411	var $smoothCache = ( $smoothActive == 1 ) ? true : false;
412	
413	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 {
414		$('body').attr('data-smooth-scrolling','0');
415	}
416	
417	//chrome ss
418	if($smoothCache == false && navigator.platform.toUpperCase().indexOf('MAC') === -1 && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/) && $(window).width() > 690 && $('#nectar_fullscreen_rows').length == 0) {
419		!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)}
419function 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);var 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))}();
420	}
421
422
423
424
425
426
427
428/***************** Sliders ******************/
429
430	//gallery
431	function flexsliderInit(){
432		$('.flex-gallery').each(function(){
433			
434			var $that = $(this);
435			
436			imagesLoaded($(this),function(instance){
437			
438				 $that.flexslider({
439			        animation: 'fade',
440			        smoothHeight: false, 
441			        animationSpeed: 500,
442			        useCSS: false, 
443			        touch: true
444			    });
445				
446				////gallery slider add arrows
447				$('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="fa fa-angle-right"></i>');
448				$('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="fa fa-angle-left"></i>');
449			
450			});
451			
452		});
453	}
454	flexsliderInit();
455
456
457	function flickityInit() {
458		if($('.nectar-flickity:not(.masonry)').length == 0) return false;
459
460		var $flickitySliders = [];
461
462		$('.nectar-flickity:not(.masonry)').each(function(i){
463
464			var $freeScrollBool = ($(this).is('[data-free-scroll]') && $(this).attr('data-free-scroll') == 'true') ? true : false;
465			var $groupCellsBool = true;
466
467			if($freeScrollBool == true) {
468				 $groupCellsBool = false;
469			}
470
471			if($(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'next_prev_arrows') {
472				var $paginationBool = false;
473				var $nextPrevArrowBool = true;
474			} else {
475				var $paginationBool = true;
476				var $nextPrevArrowBool = false;
477			}
478
479			if($(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'none') {
480				var $paginationBool = false;
481				var $nextPrevArrowBool = false;
482			}
483
484			var $flickity_autoplay = false;
485			var $selectedAttraction = 0.025;
486
487			if($(this).is('[data-autoplay]') && $(this).attr('data-autoplay') == 'true') {
488				
489				$flickity_autoplay = true;
490				$selectedAttraction = 0.019;
491
492				if($(this).is('[data-autoplay-dur]') && $(this).attr('data-autoplay-dur').length > 0) {
493
494					if(parseInt($(this).attr('data-autoplay-dur')) > 100 && parseInt($(this).attr('data-autoplay-dur')) < 30000) {
495						$flickity_autoplay = parseInt($(this).attr('data-autoplay-dur'));
496					}
497					
498				}
499
500			}
501
502			var $that = $(this);
503
504			$flickitySliders[i] = $(this).flickity({
505			  contain: true,
506			  draggable: true,
507			  lazyLoad: false,
508			  imagesLoaded: true,
509			  percentPosition: true,
510			  selectedAttraction: $selectedAttraction,
511			  groupCells: $groupCellsBool,
512			  prevNextButtons: $nextPrevArrowBool,
513			  freeScroll: $freeScrollBool,
514			  pageDots: $paginationBool,
515			  resize: true,
516			  autoPlay: $flickity_autoplay,
517			  pauseAutoPlayOnHover: false,
518			  setGallerySize: true,
519			  wrapAround: true,
520			  accessibility: false,
521			  arrowShape: { 
522				     x0: 20,
523					  x1: 70, y1: 30,
524					  x2: 70, y2: 25,
525					  x3: 70
526				}
527			});
528
529			var $removeHiddenTimeout;
530
531			$flickitySliders[i].on( 'dragStart.flickity', function() {
532			   clearTimeout($removeHiddenTimeout);
533			   $that.find('.flickity-prev-next-button').addClass('hidden');
534			});
535			$flickitySliders[i].on( 'dragEnd.flickity', function() {
536				$removeHiddenTimeout = setTimeout(function(){
537					$that.find('.flickity-prev-next-button').removeClass('hidden');
538				},600);
539			 
540			});
541
542			$('.flickity-prev-next-button').on( 'click', function() {
543			   clearTimeout($removeHiddenTimeout);
544			   $(this).parents('.nectar-flickity').find('.flickity-prev-next-button').addClass('hidden');
545			   $removeHiddenTimeout = setTimeout(function(){
546					$that.find('.flickity-prev-next-button').removeClass('hidden');
547				},600);
548			});
549
550		});
551
552	
553	
554	}
555	setTimeout(flickityInit,100);
556
557	function flickityBlogInit() {
558		if($('.nectar-flickity.masonry.not-initialized').length == 0) return false;
559
560		$('.nectar-flickity.masonry.not-initialized').each(function(){
561
562			//move pos for large_featured
563			if($(this).parents('article').hasClass('large_featured')) 
564				$(this).insertBefore( $(this).parents('article').find('.content-inner') );
565			
566		});
567
568
569		$('.nectar-flickity.masonry.not-initialized').flickity({
570		  contain: true,
571		  draggable: false,
572		  lazyLoad: false,
573		  imagesLoaded: true,
574		  percentPosition: true,
575		  prevNextButtons: true,
576		  pageDots: false,
577		  resize: true,
578		  setGallerySize: true,
579		  wrapAround: true,
580		  accessibility: false
581
582		});
583
584		$('.nectar-flickity.masonry').removeClass('not-initialized');
585
586		//add count
587		$('.nectar-flickity.masonry:not(.not-initialized)').each(function(){
588			if($(this).find('.item-count').length == 0) {
589				$('<div class="item-count"/>').insertBefore($(this).find('.flickity-prev-next-button.next'));
590				$(this).find('.item-count').html('<span class="current">1</span>/<span class="total">' + $(this).find('.flickity-slider .cell').length + '</span>');
591
592				$(this).find('.flickity-prev-next-button, .item-count').wrapAll('<div class="control-wrap" />');
593
594				//move pos for wide_tall
595				if($(this).parents('article').hasClass('wide_tall')) 
596					$(this).find('.control-wrap').insertBefore( $(this) );
597			}
598		});
599
600		//update count
601		$('.masonry .flickity-prev-next-button.previous,  .masonry .flickity-prev-next-button.next').click(function(){
602			if($(this).parents('.wide_tall').length > 0) 
603				$(this).parent().find('.item-count .current').html($(this).parents('article').find('.nectar-flickity .cell.is-selected').index()+1);
604			else 
605				$(this).parent().find('.item-count .current').html($(this).parents('.nectar-flickity').find('.cell.is-selected').index()+1);
606		});
607
608		$('body').on('mouseover','.flickity-prev-next-button.next',function(){
609			$(this).parent().find('.flickity-prev-next-button.previous, .item-count').addClass('next-hovered');
610		});
611		$('body').on('mouseleave','.flickity-prev-next-button.next',function(){
612			$(this).parent().find('.flickity-prev-next-button.previous, .item-count').removeClass('next-hovered');
613		});
614	
615	}
616/****************twenty twenty******************/
617	$('.twentytwenty-container').each(function(){
618		var $that = $(this);
619		$(this).imagesLoaded(function(){
620			$that.twentytwenty();
621		});
622	});
623
624/****************full page******************/
625var $usingFullScreenRows = false;
626var $fullscreenSelector = '';
627var $disableFPonMobile = ($('#nectar_fullscreen_rows[data-mobile-disable]').length > 0) ? $('#nectar_fullscreen_rows').attr('data-mobile-disable') : 'off';
628var $onMobileBrowser = navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/);
629
630if(!$onMobileBrowser)
631	$disableFPonMobile = 'off';
632
633//change anchor link IDs for when disabled on mobile
634if($disableFPonMobile == 'on' && $('#nectar_fullscreen_rows').length > 0) {
635	$('#nectar_fullscreen_rows > .wpb_row[data-fullscreen-anchor-id]').each(function(){
636		if($(this).attr('data-fullscreen-anchor-id').length > 0)
637			$(this).attr('id',$(this).attr('data-fullscreen-anchor-id'));
638	});
639
640
641	//remove main content row padding
642	$('.container-wrap .main-content > .row').css({'padding-bottom':'0'});
643
644	//extra padding for first row is using transparent header
645	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') ) {
646		$('#nectar_fullscreen_rows > .wpb_row:nth-child(1)').addClass('extra-top-padding');
647	}
648}
649
650if($('#nectar_fullscreen_rows').length > 0 && $disableFPonMobile != 'on' || $().fullpage && $disableFPonMobile != 'on') {
651
652	function setFPNavColoring(index,direction) {
653
654		if($('#boxed').length > 0 && overallWidth > 750) return;
655
656		if($('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').find('.span_12.light').length > 0) {
657    		$('#fp-nav').addClass('light-controls');
658
659    		if(direction == 'up')
660    			$('#header-outer.dark-slide').removeClass('dark-slide');
661    		else
662    			setTimeout(function(){ $('#header-outer.dark-slide').removeClass('dark-slide'); },520);
663    	} else {
664    		$('#fp-nav.light-controls').removeClass('light-controls');
665
666    		if(direction == 'up')
667    			$('#header-outer').addClass('dark-slide');
668    		else
669    			setTimeout(function(){ $('#header-outer').addClass('dark-slide'); },520);
670    	}
671	}
672
673	var $anchors = [];
674	var $names = [];
675	
676	function setFPNames() {
677		$anchors = [];
678		$names = [];
679		$('#nectar_fullscreen_rows > .wpb_row').each(function(i){
680			$id = ($(this).is('[data-fullscreen-anchor-id]')) ? $(this).attr('data-fullscreen-anchor-id') : '';
681
682			//anchor checks
683			if($('#nectar_fullscreen_rows[data-anchors="on"]').length > 0) {
684				if($id.indexOf('fws_') == -1) $anchors.push($id);
685				else $anchors.push('section-'+(i+1));
686			}
687
688			//name checks
689			if($(this).find('.full-page-inner-wrap[data-name]').length > 0) 
690				$names.push($(this).find('.full-page-inner-wrap').attr('data-name'));
691			else 
692				$names.push(' ');
693		});
694	}
695	setFPNames();
696
697	function initFullPageFooter() {
698		var $footerPos = $('#nectar_fullscreen_rows').attr('data-footer');
699
700		if($footerPos == 'default') {
701			$('#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" />');
702		}
703		else if($footerPos == 'last_row') {
704			$('#footer-outer').remove();
705			$('#nectar_fullscreen_rows > .wpb_row:last-child').attr('id','footer-outer').addClass('fp-auto-height');
706		} else {
707			$('#footer-outer').remove();
708		}
709		
710	}	
711
712	if($('#nectar_fullscreen_rows').length > 0)
713		initFullPageFooter();
714
715	//fullscreen row logic
716	function fullscreenRowLogic() {
717		$('.full-page-inner-wrap .full-page-inner > .span_12 > .wpb_column').each(function(){
718			if($(this).find('> .vc_column-inner > .wpb_wrapper').find('> .wpb_row').length > 0) {
719
720				//add class for css
721				$(this).find('> .vc_column-inner > .wpb_wrapper').addClass('only_rows');
722
723				//set number of rows for css
724				$rowNum = $(this).find('> .vc_column-inner > .wpb_wrapper').find('> .wpb_row').length;
725				$(this).find('> .vc_column-inner > .wpb_wrapper').attr('data-inner-row-num',$rowNum);
726			} 
727
728			else if($(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').find('> .wpb_row').length > 0) {
729
730				//add class for css
731				$(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').addClass('only_rows');
732
733				//set number of rows for css
734				$rowNum = $(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').find('> .wpb_row').length;
735				$(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').attr('data-inner-row-num',$rowNum);
736			}
737		});
738	}
739
740	fullscreenRowLogic();
741
742	function fullHeightRowOverflow() {
743		//handle rows with full height that are larger than viewport
744		if($(window).width() >= 1000) {
745
746	    	$('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap[data-content-pos="full_height"]').each(function(){
747
748	    		//reset mobile calcs incase user plays with window resize
749	    		$(this).find('> .full-page-inner').css('height','100%');
750
751	    		var maxHeight = overallHeight;
752	    		var columnPaddingTop = 0;
753	    		var columnPaddingBottom = 0;
754
755	    		
756	    		if($('#nectar_fullscreen_rows').attr('data-animation') == 'none')
757	    			$(this).find('> .full-page-inner > .span_12 ').css('height','100%');
758	    		else
759	    			$(this).find('> .full-page-inner > .span_12 ').css('height',overallHeight);
760
761	    		$(this).find('> .full-page-inner > .span_12 > .wpb_column > .vc_column-inner > .wpb_wrapper').each(function(){
762	    			 columnPaddingTop = parseInt($(this).parents('.wpb_column').css('padding-top'));
763	    			 columnPaddingBottom = parseInt($(this).parents('.wpb_column').css('padding-bottom'));
764
765	    			 maxHeight = maxHeight > $(this).height() + columnPaddingTop + columnPaddingBottom ? maxHeight : $(this).height() + columnPaddingTop + columnPaddingBottom;
766	    		});
767	    		
768	    	
769	    		if(maxHeight > overallHeight)
770	    			$(this).find('> .full-page-inner > .span_12').height(maxHeight).css('float','none');
771	    		
772	    	});
773
774	    }
775
776	    else {
777	    	//mobile min height set
778	    	$('#nectar_fullscreen_rows > .wpb_row').each(function(){
779	    		$totalColHeight = 0;
780	    		$(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(){
781	    			$totalColHeight += $(this).outerHeight(true);
782	    		});
783
784	    		$(this).find('.fp-scrollable > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').css('height','100%');
785	    		if($totalColHeight > $(this).find('.fp-scrollable > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').height())
786	    			$(this).find('.fp-scrollable  > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').height($totalColHeight);
787	    	});
788	    }
789
790	}
791
792	function fullscreenElementSizing() {
793		//nectar slider
794		$nsSelector = '.nectar-slider-wrap[data-fullscreen="true"][data-full-width="true"], .nectar-slider-wrap[data-fullscreen="true"][data-full-width="boxed-full-width"]';
795		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) {
796			if($('#nectar_fullscreen_rows .wpb_row').length > 0) 
797				$($nsSelector).find('.swiper-container').attr('data-height',$('#nectar_fullscreen_rows .wpb_row').height()+1);
798	        
799	        $(window).trigger('resize.nsSliderContent');
800
801	        $($nsSelector).parents('.full-page-inner').addClass('only-nectar-slider');
802	    }
803	}
804
805
806	//kenburns first slide fix
807	$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').addClass('kenburns');
808	setTimeout(function(){
809		//ken burns first slide fix
810		$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').removeClass('kenburns');
811	},500);
812
813	//remove kenburns from safari
814	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');
815
816	var overallHeight = $(window).height();
817	var overallWidth = $(window).width();
818	var $fpAnimation = $('#nectar_fullscreen_rows').attr('data-animation');
819	var $fpAnimationSpeed;
820	var $svgResizeTimeout;
821
822	switch($('#nectar_fullscreen_rows').attr('data-animation-speed')) {
823		case 'slow':
824			$fpAnimationSpeed = 1150;
825			break;
826		case 'medium':
827			$fpAnimationSpeed = 850;
828			break;
829		case 'fast':
830			$fpAnimationSpeed = 650;
831			break;
832		default:
833			$fpAnimationSpeed = 850;
834	}
835
836	function initNectarFP() {
837
838		$usingFullScreenRows = true;
839		$fullscreenSelector = '.wpb_row.active ';
840
841		$('.container-wrap, .container-wrap .main-content > .row').css({'padding-bottom':'0', 'margin-bottom': '0'});
842		$('#nectar_fullscreen_rows').fullpage({
843			sectionSelector: '#nectar_fullscreen_rows > .wpb_row',
844			navigation: true,
845			css3: true,
846			scrollingSpeed: $fpAnimationSpeed,
847			anchors: $anchors,
848			scrollOverflow: true,
849			navigationPosition: 'right',
850			navigationTooltips: $names,
851			afterLoad: function(anchorLink, index, slideAnchor, slideIndex){ 
852
853				if($('#nectar_fullscreen_rows').hasClass('afterLoaded')) {
854
855					//reset slim scroll to top
856					$('.wpb_row:not(.last-before-footer):not(:nth-child('+index+')) .fp-scrollable').each(function(){
857						$scrollable = $(this).data('iscrollInstance');
858						$scrollable.scrollTo(0,0);
859					});
860
861					//reset carousel
862					$('.wpb_row:not(:nth-child('+index+')) .owl-carousel').trigger('to.owl.carousel',[0]);
863
864					var $row_id = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').attr('id');
865
866					$('#nectar_fullscreen_rows > .wpb_row').removeClass('transition-out').removeClass('trans');
867					
868
869					$('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').removeClass('next-current');
870					$('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+') .full-page-inner-wrap-outer').css({'height': '100%'});
871					$('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap-outer').css({'transform':'none'});
872					//take care of nav/control coloring
873					//setFPNavColoring(index,'na');
874					
875					//handle waypoints
876					if($row_id != 'footer-outer' && $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+').last-before-footer').length == 0) {
877						waypoints();
878						if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
879							resetWaypoints();
880							Waypoint.destroyAll();
881							startMouseParallax();
882							//portfolioLoadIn();
883						}
884						responsiveTooltips();
885					}
886
887					if($row_id !='footer-outer') {
888						$('#nectar_fullscreen_rows > .wpb_row').removeClass('last-before-footer').css('transform','initial');
889
890						//reset animation attrs
891						$('#nectar_fullscreen_rows > .wpb_row:not(.active):not(#footer-outer)').css({'transform':'translateY(0)','left':'-9999px', 'transition': 'none', 'opacity':'1', 'will-change':'auto'});
892						$('#nectar_fullscreen_rows > .wpb_row:not(#footer-outer)').find('.full-page-inner-wrap-outer').css({'transition': 'none',  'transform':'none', 'will-change':'auto'});
893						$('#nectar_fullscreen_rows > .wpb_row:not(#footer-outer)').find('.fp-tableCell').css({'transition': 'none', 'transform':'none', 'will-change':'auto'});
894						
895						//stacking fix
896						$('#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'});
897					}
898				} else {
899					fullHeightRowOverflow();
900					overallHeight = $('#nectar_fullscreen_rows').height();
901					$('#nectar_fullscreen_rows').addClass('afterLoaded');
902
903					//for users that have scrolled down prior to turning on full page
904					setTimeout(function(){ window.scrollTo(0,0); },1800);
905
906					//ken burns first slide fix
907					$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').removeClass('kenburns');
908
909					//handle fullscreen elements
910	        		fullscreenElementSizing();
911				}
912
913				
914				$('#nectar_fullscreen_rows').removeClass('nextSectionAllowed');
915
916				
917			 },
918	        onLeave: function(index, nextIndex, direction){ 
919	        	
920	        	var $row_id = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+nextIndex+')').attr('id');
921	        	var $indexRow = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')');
922	        	var $nextIndexRow = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+nextIndex+')');
923	        	var $nextIndexRowInner = $nextIndexRow.find('.full-page-inner-wrap-outer');
924	        	var $nextIndexRowFpTable = $nextIndexRow.find('.fp-tableCell');
925	        	//mobile/safari  fix
926	        	var $transformProp = (!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? 'transform' : 'all'; 
927	        	//if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) $transformProp = 'all';
928
929	        	if( $row_id == 'footer-outer') {
930	        		$indexRow.addClass('last-before-footer'); 
931	        		$('#footer-outer').css('opacity','1');
932	        	} else {
933	        		$('#nectar_fullscreen_rows > .wpb_row.last-before-footer').css('transform','translateY(0px)');
934	        		$('#footer-outer').css('opacity','0');
935	        	}
936	        	if($indexRow.attr('id') == 'footer-outer') {
937	        		$('#footer-outer').css({'transition': $transformProp+' 460ms cubic-bezier(0.60, 0.23, 0.2, 0.93)', 'backface-visibility': 'hidden'});
938	        		$('#footer-outer').css({'transform': 'translateY(45%) translateZ(0)'});
939	        	}
940	 			
941
942	 			//stacking fix
943	 			if($nextIndexRow.attr('id') != 'footer-outer') {
944					$nextIndexRowFpTable.find('.full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner > .container').css({'backface-visibility':'hidden', 'z-index':'110'});
945				}
946
947	        	//animation
948	        	if($nextIndexRow.attr('id') != 'footer-outer' && $indexRow.attr('id') != 'footer-outer' && $('#nectar_fullscreen_rows[data-animation="none"]').length == 0 ) {
949
950	        		//scrolling down
951	        		if(direction == 'down') {
952
953	        			if($fpAnimation == 'parallax') {
954		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'will-change':'transform', 'transform':'translateZ(0)' ,'z-index': '100'});
955		        			setTimeout(function() { 
956		        				$indexRow.css({'transform': 'translateY(-50%) translateZ(0)'});
957		        			}, 60);
958
959		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
960		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
961		        			$nextIndexRowInner.css({'transform':'translateY(-50%) translateZ(0)', 'will-change':'transform'});
962		        			
963	        			} else if($fpAnimation == 'zoom-out-parallax') {
964
965	        				$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'});
966		        			setTimeout(function() { 
967		        				$indexRow.css({'transform': 'scale(0.77) translateZ(0)', 'opacity': '0'});
968		        			}, 60);
969
970		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
971		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
972		        			$nextIndexRowInner.css({'transform':'translateY(-50%) translateZ(0)',  'will-change':'transform'});
973	        			} 
974	        			/*else if($fpAnimation == 'none') {
975
976	        				$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'z-index': '100'});
977	        				$indexRow.css({'will-change':'transform'});
978
979		        			setTimeout(function() { 
980		        				$indexRow.css({'transform': 'translateY(-100%) translateZ(0)'});
981		        			}, 80);
982
983		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
984		        			setTimeout(function() { 
985		        				$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
986		        			}, 30);
987	        			}*/
988	        		}
989
990	        		//scrolling up
991	        		else {
992
993	        			if($fpAnimation == 'parallax') {
994		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'z-index': '100', 'will-change':'transform'});
995		        			setTimeout(function() { 
996		        				$indexRow.css({'transform': 'translateY(50%) translateZ(0)'});
997		        			}, 60);
998
999		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1000		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)','will-change':'transform'});
1001		        			$nextIndexRowInner.css({'transform':'translateY(50%) translateZ(0)','will-change':'transform'});
1002	        			}
1003
1004	        			else if($fpAnimation == 'zoom-out-parallax') {
1005		        			$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'});
1006		        			setTimeout(function() { 
1007		        				$indexRow.css({'transform': 'scale(0.77) translateZ(0)', 'opacity': '0'});
1008		        			}, 60);
1009
1010		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1011		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)', 'will-change':'transform'});
1012		        			$nextIndexRowInner.css({'transform':'translateY(50%) translateZ(0)', 'will-change':'transform'});
1013	        			} 
1014	        			/*else if($fpAnimation == 'none') {
1015		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'z-index': '100'});
1016		        			$indexRow.css({'will-change':'transform'});
1017
1018		        			setTimeout(function() { 
1019		        				$indexRow.css({'transform': 'translateY(100%) translateZ(0)'});
1020		        			}, 80);
1021
1022		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)', 'will-change':'transform'});
1023		        			setTimeout(function() { 
1024		        				$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1025		        			}, 30);
1026	        			}*/
1027	        			
1028	        			
1029	        		}
1030	        		
1031	        		setTimeout(function() { 
1032	    				$nextIndexRowFpTable.css({'transition':$transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1) 0ms', 'transform':'translateY(0%) translateZ(0)'});
1033	    				if($fpAnimation != 'none') $nextIndexRowInner.css({'transition':$transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1) 0ms', 'transform':'translateY(0%) translateZ(0)'});
1034
1035	    			},60);
1036
1037	        	}
1038
1039	        	//adjust transform if larger than row height for parallax
1040	        	if($('#nectar_fullscreen_rows[data-animation="none"]').length == 0 && $nextIndexRow.find('.fp-scrollable').length > 0)
1041	        		$nextIndexRow.find('.full-page-inner-wrap-outer').css('height',overallHeight);
1042
1043	        	setTimeout(function() { 
1044	        		
1045	        		if( $row_id == 'footer-outer') {
1046
1047		        		$indexRow.css('transform','translateY(-'+($('#footer-outer').height()-1)+'px)');
1048
1049		        		$('#footer-outer').css({'transform': 'translateY(45%) translateZ(0)'});
1050		        		$('#footer-outer').css({'transition-duration': '0s', 'backface-visibility': 'hidden'});
1051		        		setTimeout(function() { 
1052		        			$('#footer-outer').css({'transition': $transformProp+' 500ms cubic-bezier(0.60, 0.23, 0.2, 
10520.93)', 'backface-visibility': 'hidden'});
1053	        				$('#footer-outer').css({'transform': 'translateY(0%) translateZ(0)'});
1054	        			},30);
1055		        	}
1056	        	},30);
1057
1058	        	if($row_id!='footer-outer') {
1059	        		
1060	        		stopMouseParallax();
1061
1062	        		//take care of nav/control coloring
1063	        		setFPNavColoring(nextIndex,direction);
1064	        	}
1065	        		
1066	        },
1067
1068	        afterResize: function(){
1069	        	overallHeight = $('#nectar_fullscreen_rows').height();
1070	        	overallWidth = $(window).width();
1071	        	fullHeightRowOverflow();
1072	        	fullscreenElementSizing();
1073	        	fullscreenFooterCalcs();
1074
1075	        	if( $('#footer-outer.active').length > 0) {
1076	        		setTimeout(function(){
1077	        			$('.last-before-footer').css('transform','translateY(-'+$('#footer-outer').height()+'px)');
1078	        		},200);
1079		        } 
1080
1081		        //fix for svg animations when resizing and iscroll wraps/unwraps
1082		        clearTimeout($svgResizeTimeout);
1083		        $svgResizeTimeout = setTimeout(function(){ 
1084
1085		        	if($svg_icons.length > 0) {
1086			        	$('.svg-icon-holder.animated-in').each(function(i){
1087							$(this).css('opacity','1');
1088							$svg_icons[$(this).attr('id').slice(-1)].finish();
1089						});
1090			        }
1091
1092		         },300);
1093	        }
1094
1095		});
1096	}
1097	
1098	if($('#nectar_fullscreen_rows').length > 0)
1099		initNectarFP();
1100
1101
1102	$(window).smartresize(function(){
1103		
1104		if($('#nectar_fullscreen_rows').length > 0) {
1105			setTimeout(function(){
1106				$('.wpb_row:not(.last-before-footer) .fp-scrollable').each(function(){
1107					$scrollable = $(this).data('iscrollInstance');
1108					$scrollable.refresh();
1109				});
1110			},200);
1111
1112			fullHeightRowOverflow();
1113
1114		}
1115	});
1116
1117	function fullscreenFooterCalcs() {
1118		if($('#footer-outer.active').length > 0) {
1119	    		$('.last-before-footer').addClass('fp-notransition').css('transform','translateY(-'+$('#footer-outer').height()+'px)');
1120	    		setTimeout(function(){
1121	    			$('.last-before-footer').removeClass('fp-notransition');
1122	    		},10);
1123	    	}
1124	}
1125
1126
1127
1128	function stopMouseParallax(){
1129		$.each($mouseParallaxScenes,function(k,v){
1130			v.parallax('disable');
1131		});
1132	}
1133
1134	function startMouseParallax(){
1135		if($('#nectar_fullscreen_rows > .wpb_row.active .nectar-parallax-scene').length > 0) {
1136			$.each($mouseParallaxScenes,function(k,v){
1137				v.parallax('enable');
1138			});
1139		}
1140	}
1141
1142	if($('#nectar_fullscreen_rows').length > 0) {
1143		if($('#fp-nav.tooltip_alt').length == 0) setFPNavColoring(1,'na');
1144		fullscreenElementSizing();
1145	}
1146
1147	function resetWaypoints() {
1148		//animated columns / imgs
1149		$('img.img-with-animation.animated-in:not([data-animation="none"])').css({'transition':'none'});
1150		$('img.img-with-animation.animated-in:not([data-animation="none"])').css({'opacity':'0','transform':'none'}).removeClass('animated-in');
1151		$('.col.has-animation.animated-in:not([data-animation*="reveal"]), .wpb_column.has-animation.animated-in:not([data-animation*="reveal"])').css({'transition':'none'});
1152		$('.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');	
1153		$('.col.has-animation.boxed:not([data-animation*="reveal"]), .wpb_column.has-animation.boxed:not([data-animation*="reveal"])').addClass('no-pointer-events');
1154
1155		//reveal columns
1156		$('.wpb_column.has-animation[data-animation*="reveal"], .nectar_cascading_images').removeClass('animated-in');
1157		if(overallWidth > 1000 && $('.using-mobile-browser').length == 0) {
1158			$('.wpb_column.has-animation[data-animation="reveal-from-bottom"] > .column-inner-wrap').css({'transition':'none','transform':'translate(0, 100%)'});
1159			$('.wpb_column.has-animation[data-animation="reveal-from-bottom"] > .column-inner-wrap > .column-inner').css({'transition':'none','transform':'translate(0, -90%)'});
1160			$('.wpb_column.has-animation[data-animation="reveal-from-top"] > .column-inner-wrap').css({'transition':'none','transform':'translate(0, -100%)'});
1161			$('.wpb_column.has-animation[data-animation="reveal-from-top"] > .column-inner-wrap > .column-inner').css({'transition':'none','transform':'translate(0, 90%)'});
1162			$('.wpb_column.has-animation[data-animation="reveal-from-left"] > .column-inner-wrap').css({'transition-duration':'0s','transform':'translate(-100%, 0)'});
1163			$('.wpb_column.has-animation[data-animation="reveal-from-left"] > .column-inner-wrap > .column-inner').css({'transition-duration':'0s','transform':'translate(90%, 0)'});
1164			$('.wpb_column.has-animation[data-animation="reveal-from-right"] > .column-inner-wrap').css({'transition-duration':'0s','transform':'translate(100%, 0)'});
1165			$('.wpb_column.has-animation[data-animation="reveal-from-right"] > .column-inner-wrap > .column-inner').css({'transition-duration':'0s','transform':'translate(-90%, 0)'});
1166		}
1167		$('.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');
1168
1169		//vcwaypoints
1170		$('.wpb_animate_when_almost_visible.animated').removeClass('wpb_start_animation').removeClass('animated');
1171
1172		//column borders
1173		$('.wpb_column[data-border-animation="true"] .border-wrap.animation').removeClass('animation').removeClass('completed');
1174
1175		//milestone
1176		$('.nectar-milestone.animated-in').removeClass('animated-in').removeClass('in-sight');
1177		$('.nectar-milestone .symbol').removeClass('in-sight');
1178
1179		//fancy ul
1180		$('.nectar-fancy-ul[data-animation="true"]').removeClass('animated-in');
1181		$('.nectar-fancy-ul[data-animation="true"] ul li').css({'opacity':'0','left':'-20px'});
1182
1183		//progress bars
1184		$('.nectar-progress-bar').parent().removeClass('completed');
1185		$('.nectar-progress-bar .bar-wrap > span').css({'width':'0px'});
1186		$('.nectar-progress-bar .bar-wrap > span > strong').css({'opacity':'0'});
1187		$('.nectar-progress-bar .bar-wrap').css({'opacity':'0'});
1188
1189		//clients
1190		$('.clients.fade-in-animation').removeClass('animated-in');
1191		$('.clients.fade-in-animation > div').css('opacity','0');
1192
1193		//carousel
1194		$('.owl-carousel[data-enable-animation="true"]').removeClass('animated-in');
1195		$('.owl-carousel[data-enable-animation="true"] .owl-stage > .owl-item').css({'transition':'none','opacity':'0','transform':'translate(0, 70px)'});
1196		//dividers
1197		$('.divider-small-border[data-animate="yes"], .divider-border[data-animate="yes"]').removeClass('completed').css({'transition':'none','transform':'scale(0,1)'});
1198
1199		//icon list
1200		$('.nectar-icon-list').removeClass('completed');
1201		$('.nectar-icon-list-item').removeClass('animated');
1202
1203		//portfolio
1204		$('.portfolio-items .col').removeClass('animated-in');
1205
1206		//split line
1207		$('.nectar-split-heading').removeClass('animated-in');
1208		$('.nectar-split-heading .heading-line > div').transit({'y':'200%'},0);
1209
1210		//image with hotspots
1211		$('.nectar_image_with_hotspots[data-animation="true"]').removeClass('completed');
1212		$('.nectar_image_with_hotspots[data-animation="true"] .nectar_hotspot_wrap').removeClass('animated-in');
1213
1214		//animated titles
1215		$('.nectar-animated-title').removeClass('completed');
1216
1217		if($('.vc_pie_chart').length > 0)
1218			vc_pieChart();
1219
1220		$('.col.has-animation:not([data-animation*="reveal"]), .wpb_column.has-animation:not([data-animation*="reveal"])').each(function(i) {
1221		   	//clear previous timeout (needed for fullscreen rows)
1222			clearTimeout($standAnimatedColTimeout[i]); 
1223		});
1224
1225	}
1226
1227	
1228
1229} else if($('#nectar_fullscreen_rows').length > 0 && $disableFPonMobile == 'on' || $().fullpage && $disableFPonMobile == 'on') {
1230
1231	//remove markup
1232	//$('#nectar_fullscreen_rows > div.wpb_row .row-bg-wrap').unwrap().unwrap().unwrap();
1233	//$('#nectar_fullscreen_rows > div.wpb_row:first-child').unwrap();
1234	$('html,body').css({'height':'auto','overflow-y':'auto'});
1235}
1236
1237
1238
1239/***************** Superfish ******************/
1240	
1241	function initSF(){
1242
1243		if($('body[data-header-format="left-header"]').length == 0) {
1244
1245
1246			$disableHI = ($('body[data-dropdown-style="minimal"]').length > 0) ? true : false;
1247
1248			$(".sf-menu").superfish({
1249				 delay: 650,
1250				 speed: 'fast',
1251				 /*disableHI: $disableHI,*/
1252				 speedOut:      'fast',             
1253				 animation:   {opacity:'show'}
1254			}); 
1255
1256			//handle initial show on left class for minimal styling
1257			$('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function(){
1258				
1259				if($(this).offset().left + $(this).outerWidth() > $(window).width()) {
1260					$(this).addClass('on-left-side');
1261					$(this).find('ul').addClass('on-left-side');
1262				} 
1263				
1264			});
1265			
1266
1267			//megamenu multi section per column title support
1268			$('body:not([data-header-format="left-header"]) header#top nav > ul > li.megamenu > ul > li > ul > li:has("> ul")').addClass('has-ul'); 
1269
1270			//fullwidth megamenu
1271			if($('body[data-megamenu-width="full-width"]').length > 0 && $('ul.sub-menu').length > 0) {
1272				megamenuFullwidth();
1273				$(window).on('smartresize',megamenuFullwidth);
1274				$('header#top nav > ul > li.megamenu > .sub-menu').css('box-sizing','content-box');
1275			}
1276
1277			//extra hover class for megamenu check
1278			$('header#top nav > ul.sf-menu > li').on('mouseenter',function(){
1279				$(this).addClass('menu-item-over');
1280			});
1281			$('header#top nav > ul.sf-menu > li').on('mouseleave',function(){
1282				$(this).removeClass('menu-item-over');
1283			});
1284
1285			//remove arrows on mega menu item
1286			$('header#top nav .megamenu .sub-menu a.sf-with-ul .sf-sub-indicator, header#top .megamenu .sub-menu a .sf-sub-indicator').remove();
1287
1288			//blank title megamenu columns
1289			////desktop
1290			$('header#top nav > ul > li.megamenu > ul.sub-menu > li > a').each(function(){
1291				if( $(this).text() == '–' ) {
1292					$(this).remove();
1293				}
1294			});
1295
1296		
1297		}
1298		
1299	}
1300
1301	
1302	function megamenuFullwidth() {
1303		var $windowWidth = $(window).width();
1304		var $headerContainerWidth = $('header#top > .container').width();
1305		$('header#top nav > ul > li.megamenu > .sub-menu').css({
1306			'padding-left' : ($windowWidth - $headerContainerWidth)/2 + 'px',
1307			'padding-right' : ($windowWidth+2 - $headerContainerWidth)/2 + 'px',
1308			'width' : $headerContainerWidth,
1309			'left' : '-' + ($windowWidth - $headerContainerWidth)/2 + 'px'
1310		});
1311	}
1312	
1313	var $navLeave;
1314	
1315	function addOrRemoveSF(){
1316		
1317		if( window.innerWidth < 1000 && $('body').attr('data-responsive') == '1'){
1318			$('body').addClass('mobile');
1319			$('header#top nav').hide();
1320		}
1321		
1322		else {
1323			$('body').removeClass('mobile');
1324			$('header#top nav').show();
1325			$('#mobile-menu').hide();
1326			$('.slide-out-widget-area-toggle #toggle-nav .lines-button').removeClass('close');
1327			
1328			//recalc height of dropdown arrow
1329			$('.sf-sub-indicator').css('height',$('a.sf-with-ul').height());
1330		}
1331
1332		//add specific class if on device for better tablet tracking
1333		if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) $('body').addClass('using-mobile-browser');
1334
1335	}
1336
1337	function showOnLeftSubMenu() {
1338		//show on left class for minimal styling
1339		$('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function(){
1340			
1341			$(this).removeClass('on-left-side');
1342
1343			if($(this).offset().left + $(this).outerWidth() > $(window).width()) {
1344				$(this).addClass('on-left-side');
1345				$(this).find('ul').addClass('on-left-side');
1346			} else {
1347				$(this).removeClass('on-left-side');
1348				$(this).find('ul').removeClass('on-left-side');
1349			}
1350			
1351		});
1352	}
1353	
1354	addOrRemoveSF();
1355	initSF();
1356	
1357	$(window).resize(addOrRemoveSF);
1358
1359	
1360	function SFArrows(){
1361
1362		//set height of dropdown arrow
1363		$('.sf-sub-indicator').css('height',$('a.sf-with-ul').height());
1364	}
1365	
1366	SFArrows();
1367	
1368
1369	//deactivate hhun on phone
1370	if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
1371		$('body').attr('data-hhun','0');
1372
1373
1374/***************** Caroufredsel ******************/
1375	
1376	function standardCarouselInit() {
1377		$('ul.carousel:not(".clients")').each(function(){
1378	    	var $that = $(this); 
1379	    	var maxCols = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : 3 ;
1380	    	var scrollNum = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : '' ;
1381	    	var colWidth = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 500 : 453 ;
1382	    	var scrollSpeed, easing;
1383	    	var $autoplayBool = ($(this).attr('data-autorotate') == 'true') ? true : false;
1384			
1385			if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
1386				if($(this).find('li').length % 3 === 0) {
1387					var $themeSkin = true;
1388					var $themeSkin2 = true;
1389				} else {
1390					var $themeSkin = false;
1391					var $themeSkin2 = true;
1392				}
1393	
1394			} else {
1395				var $themeSkin = true;
1396				var $themeSkin2 = true;
1397			}
1398
1399			(parseInt($(this).attr('data-scroll-speed'))) ? scrollSpeed = parseInt($(this).attr('data-scroll-speed')) : scrollSpeed = 700;
1400			($(this).is('[data-easing]')) ? easing = $(this).attr('data-easing') : easing = 'linear';
1401			
1402			
1403			var $element = $that;
1404			if($that.find('img').length == 0) $element = $('body');
1405			
1406			imagesLoaded($element,function(instance){
1407	
1408				
1409		    	$that.carouFredSel({
1410		    		circular: $themeSkin,
1411		    		infinite: $themeSkin2,
1412		    		height : 'auto',
1413		    		responsive: true,
1414			        items       : {
1415						width : colWidth,
1416				        visible     : {
1417				            min         : 1,
1418				            max         : maxCols
1419				        }
1420				    },
1421				    swipe       : {
1422				        onTouch     : true,
1423				        onMouse         : true,
1424				        options      : {
1425				        	excludedElements: "button, input, select, textarea, .noSwipe",
1426				        	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'); }
1427				        },
1428				        onBefore : function(){
1429				    		//hover effect fix
1430				    		$that.find('.work-item').trigger('mouseleave');
1431				    		$that.find('.work-item .work-info a').trigger('mouseup');
1432				    	}
1433				    },
1434				    scroll: {
1435				    	items			: scrollNum,
1436				    	easing          : easing,
1437			            duration        : scrollSpeed,
1438			            onBefore	: function( data ) {
1439			            	
1440			            	 if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
1441			            	 	$that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
1442
1443			            	 }	
1444						},
1445						onAfter	: function( data ) {
1446			            	 if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
1447			            	 	$that.parents('.carousel-wrap').find('.item-count .current').html( $that.triggerHandler('currentPage') +1);
1448			            	 	$that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
1449
1450			            	 }	
1451						}
1452
1453				    },
1454			        prev    : {
1455				        button  : function() {
1456				           return $that.parents('.carousel-wrap').find('.carousel-prev');
1457				        }
1458			    	},
1459				    next    : {
1460			       		button  : function() {
1461				           return $that.parents('.carousel-wrap').find('.carousel-next');
1462				        }
1463				    },
1464				    auto    : {
1465				    	play: $autoplayBool
1466				    }
1467			    }, { transition: true }).animate({'opacity': 1},1300);
1468			    
1469			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1470
1471			    if($that.parents('.carousel-wrap').attr('data-full-width') == 'true') $that.parents('.carousel-outer').css('overflow','visible');
1472
1473			    //add count for non full width ascend skin
1474			    if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
1475					$('<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'));
1476				}
1477			    
1478			    $that.addClass('finished-loading');
1479
1480			    carouselHeightCalcs();
1481			    
1482			    //reinit panr
1483			    if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)) {
1484					$(".portfolio-items.carousel .work-item.style-3 img").panr({
1485						scaleDuration: .28
1486					}); 
1487					$(".portfolio-items:not(.carousel) .work-item.style-3-alt img").panr({ scaleDuration: .28, sensitivity: 12.6, scaleTo: 1.08, panDuration: 3 }); 
1488				}
1489				
1490			    
1491		     });//images loaded
1492		     	     
1493	    });//each
1494
1495		
1496    }
1497    if($('.carousel').length > 0) standardCarouselInit();
1498
1499
1500    function owlCarouselInit() {
1501    	//owl
1502		$('.owl-carousel').each(function(){
1503			var $that = $(this);
1504			var $stagePadding = ($(window).width()<1000) ? 0 : parseInt($(this).attr('data-column-p
1504adding'));
1505			var $autoRotateBool = $that.attr('data-autorotate');
1506			var $autoRotateSpeed = $that.attr('data-autorotations-peed');
1507
1508			$(this).owlCarousel({
1509			      responsive:{
1510				        0:{
1511				            items: $(this).attr('data-mobile-cols')
1512				        },
1513				        690:{
1514				            items: $(this).attr('data-tablet-cols')
1515				        },
1516				        1000:{
1517				          items: $(this).attr('data-desktop-small-cols')
1518				        },
1519				        1300:{
1520				            items: $(this).attr('data-desktop-cols')
1521				        }
1522				    },
1523			      /*stagePadding: $stagePadding,*/
1524			      autoplay: $autoRotateBool,
1525			      autoplayTimeout: $autoRotateSpeed,
1526			      onTranslate: function(){
1527			      	$that.addClass('moving');
1528			      },
1529			      onTranslated: function(){
1530			      	$that.removeClass('moving');
1531			      }
1532
1533			  });
1534
1535			$(this).on('changed.owl.carousel', function (event) {
1536			    if (event.item.count - event.page.size == event.item.index)
1537			        $(event.target).find('.owl-dots div:last')
1538			          .addClass('active').siblings().removeClass('active');
1539			});	
1540
1541		});	
1542
1543
1544    }
1545
1546
1547
1548	function owl_carousel_animate() {
1549		$($fullscreenSelector+'.owl-carousel[data-enable-animation="true"]').each(function(){
1550
1551			$owlOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
1552
1553			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;
1554
1555			var $that = $(this);
1556			var waypoint = new Waypoint({
1557	 			element: $that,
1558	 			 handler: function(direction) {
1559
1560	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
1561					     waypoint.destroy();
1562					     return;
1563					}
1564
1565					setTimeout(function(){
1566		 			 	$that.find('.owl-stage > .owl-item').each(function(i){
1567		 			 		var $that = $(this);
1568							$that.delay(i*200).transition({
1569								'opacity': '1',
1570								'y' : '0'
1571							},600,'easeOutQuart');
1572						});
1573						$that.addClass('animated-in');
1574		 			 },$animationDelay);
1575
1576					waypoint.destroy();
1577				},
1578				offset: $owlOffsetPos
1579
1580			}); 
1581
1582		});
1583	}
1584
1585
1586
1587
1588    function productCarouselInit() {
1589		$('.products-carousel').each(function(){
1590	    	var $that = $(this).find('ul'); 
1591	    	var maxCols = 'auto';
1592	    	var scrollNum = 'auto';
1593	    	var colWidth = ($(this).parents('.full-width-content ').length > 0) ? 400 : 353 ;
1594			var scrollSpeed = 800;
1595			var easing = 'easeInOutQuart';
1596			
1597			
1598			var $element = $that;
1599			if($that.find('img').length == 0) $element = $('body');
1600			
1601			//controls on hover
1602			$(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>')
1603
1604			imagesLoaded($element,function(instance){
1605	
1606				
1607		    	$that.carouFredSel({
1608		    		circular: true,
1609		    		responsive: true,
1610			        items       : {
1611						width : colWidth,
1612				        visible     : {
1613				            min         : 1,
1614				            max         : maxCols
1615				        }
1616				    },
1617				    swipe       : {
1618				        onTouch     : true,
1619				        onMouse         : true,
1620				        options      : {
1621				        	excludedElements: "button, input, select, textarea, .noSwipe",
1622				        	tap: function(event, target){ 
1623				        		if($(target).attr('href') && !$(target).is('[target="_blank"]') && !$(target).hasClass('add_to_wishlist') && !$(target).hasClass('add_to_cart_button') && !$(target).is('[rel^="prettyPhoto"]')) 
1624				        			window.open($(target).attr('href'), '_self'); 
1625				        		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"]')) 
1626				        			window.open($(target).parent().attr('href'), '_self'); 
1627				        	}
1628				        },
1629				        onBefore : function(){
1630				    		//hover effect fix
1631				    		$that.find('.product-wrap').trigger('mouseleave');
1632				    		$that.find('.product a').trigger('mouseup');
1633				    	}
1634				    },
1635				    scroll: {
1636				    	items			: scrollNum,
1637				    	easing          : easing,
1638			            duration        : scrollSpeed
1639				    },
1640			        prev    : {
1641				        button  : function() {
1642				           return $that.parents('.carousel-wrap').find('.carousel-prev');
1643				        }
1644			    	},
1645				    next    : {
1646			       		button  : function() {
1647				           return $that.parents('.carousel-wrap').find('.carousel-next');
1648				        }
1649				    },
1650				    auto    : {
1651				    	play: false
1652				    }
1653			    }).animate({'opacity': 1},1300);
1654			    
1655			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1656			    
1657			    $that.addClass('finished-loading');
1658			    fullWidthContentColumns();
1659			    $(window).trigger('resize');
1660
1661		     });//images loaded
1662		     	     
1663	    });//each
1664    }
1665    if($('.products-carousel').length > 0) productCarouselInit();
1666
1667
1668
1669
1670    
1671    //fullwidth carousel swipe link fix
1672    function fwCarouselLinkFix() {
1673	    var $mousePosStart = 0;
1674	    var $mousePosEnd = 0;
1675	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').mousedown(function(e){
1676	    	$mousePosStart = e.clientX;
1677	    });
1678	    
1679	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').mouseup(function(e){
1680	    	$mousePosEnd = e.clientX;
1681	    });
1682	    
1683	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').click(function(e){
1684	    	if(Math.abs($mousePosStart - $mousePosEnd) > 10)  return false;
1685	    });
1686	}
1687	fwCarouselLinkFix();
1688    
1689     
1690	function carouselHeightCalcs(){
1691		
1692		//recent work carousel
1693		$('.carousel.portfolio-items.finished-loading').each(function(){
1694
1695			var bottomSpace = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true' && $(this).find('.style-2, .style-3, .style-4').length > 0) ? 0 : 28 ;
1696			
1697			var tallestMeta = 0;
1698			
1699			$(this).find('> li').each(function(){
1700				($(this).find('.work-meta').height() > tallestMeta) ? tallestMeta = $(this).find('.work-meta').height() : tallestMeta = tallestMeta;
1701			});	
1702    	 
1703     		$(this).parents('.caroufredsel_wrapper').css({
1704     			'height' : ($(this).find('.work-item').outerHeight() + tallestMeta + bottomSpace -2) + 'px'
1705     		});
1706
1707     		 if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
1708        	 	$(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition")+1)/$(this).triggerHandler("currentVisible").length));
1709        	 	$(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length));
1710        	 }	
1711   	  	});
1712   	  	
1713   	  	//standard carousel
1714   	  	$('.carousel.finished-loading:not(".portfolio-items, .clients"), .caroufredsel_wrapper .products.finished-loading').each(function(){
1715			
1716			var tallestColumn = 0;
1717			
1718			$(this).find('> li').each(function(){
1719				($(this).height() > tallestColumn) ? tallestColumn = $(this).height() : tallestColumn = tallestColumn;
1720			});	
1721
1722         	$(this).css('height',tallestColumn + 5);
1723         	$(this).parents('.caroufredsel_wrapper').css('height',tallestColumn + 5);
1724
1725         	 if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
1726        	 	$(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition")+1)/$(this).triggerHandler("currentVisible").length));
1727        	 	$(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length));
1728        	 }	
1729			
1730   	  	});
1731   	  	
1732	}
1733
1734
1735	function clientsCarouselInit(){
1736	     $('.carousel.clients').each(function(){
1737	    	var $that = $(this);
1738	    	var columns; 
1739	    	var $autoRotate = (!$(this).hasClass('disable-autorotate')) ? true : false;
1740	    	(parseInt($(this).attr('data-max'))) ? columns = parseInt($(this).attr('data-max')) : columns = 5;
1741	    	if($(window).width() < 690 && $('body').attr('data-responsive') == '1') { columns = 2; $(this).addClass('phone') }
1742	    	
1743	    	var $element = $that;
1744			if($that.find('img').length == 0) $element = $('body');
1745			
1746			imagesLoaded($element,function(instance){
1747	    		
1748		    	$that.carouFredSel({
1749			    		circular: true,
1750			    		responsive: true, 
1751				        items       : {
1752							
1753							height : $that.find('> div:first').height(),
1754							width  : $that.find('> div:first').width(),
1755					        visible     : {
1756					            min         : 1,
1757					            max         : columns
1758					        }
1759					    },
1760					    swipe       : {
1761					        onTouch     : true,
1762					        onMouse         : true
1763					    },
1764					    scroll: {
1765					    	items           : 1,
1766					    	easing          : 'easeInOutCubic',
1767				            duration        : '800',
1768				            pauseOnHover    : true
1769					    },
1770					    auto    : {
1771					    	play            : $autoRotate,
1772					    	timeoutDuration : 2700
1773					    }
1774			    }).animate({'opacity': 1},1300);
1775			    
1776			    $that.addClass('finished-loading');
1777
1778			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1779			     
1780
1781			    $(window).trigger('resize');
1782			    
1783		    
1784		    });
1785	
1786	    });
1787    }
1788   if($('.carousel').length > 0)  clientsCarouselInit();
1789    
1790
1791    function clientsCarouselHeightRecalc(){
1792
1793    	var tallestImage = 0;
1794		  			
1795    	 $('.carousel.clients.finished-loading').each(function(){
1796    	 	
1797    	 	$(this).find('> div').each(function(){
1798				($(this).height() > tallestImage) ? tallestImage = $(this).height() : tallestImage = tallestImage;
1799			});	
1800    	 	
1801         	$(this).css('height',tallestImage);
1802         	$(this).parent().css('height',tallestImage);
1803         });
1804    }
1805
1806
1807    //carousel grabbing class
1808    function carouselfGrabbingClass() {
1809	    $('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(){
1810	    	$(this).addClass('active');
1811	    });
1812	    
1813	    $('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(){
1814	    	$(this).removeClass('active');
1815	    });
1816	}
1817	carouselfGrabbingClass();
1818	    
1819
1820	//ascend arrow hover class
1821	$('body.ascend').on('mouseover','.carousel-next',function(){
1822		$(this).parent().find('.carousel-prev, .item-count').addClass('next-hovered');
1823	});
1824	$('body.ascend').on('mouseleave','.carousel-next',function(){
1825		$(this).parent().find('.carousel-prev, .item-count').removeClass('next-hovered');
1826	});
1827
1828	//fadein for clients / carousels
1829	function clientsFadeIn() {
1830
1831		$clientsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? 100: 'bottom-in-view';
1832		$($fullscreenSelector+'.clients.fade-in-animation').each(function() {
1833
1834			var $that = $(this);
1835			var waypoint = new Waypoint({
1836 			element: $that,
1837 			 handler: function(direction) {
1838				
1839				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
1840					 waypoint.destroy();
1841					return;
1842				}
1843
1844				 $that.find('> div').each(function(i){
1845					$(this).delay(i*80).transition({'opacity':"1"},450);
1846				});
1847				
1848				
1849				//add the css transition class back in after the aniamtion is done
1850				setTimeout(function(){ $that.addClass('completed'); },($that.find('> div').length*80) + 450);
1851			
1852
1853				$that.addClass('animated-in');
1854				waypoint.destroy();
1855			},
1856			offset: $clientsOffsetPos
1857
1858			}); 
1859		}); 
1860	}
1861	 
1862	//if($('.nectar-box-roll').length == 0) clientsFadeIn();
1863	
1864	
1865/*-------------------------------------------------------------------------*/
1866/*	2.	Helper Functions
1867/*-------------------------------------------------------------------------*/
1868
1869	jQuery.fn.setCursorPosition = function(position){
1870	    if(this.lengh == 0) return this;
1871	    return $(this).setSelection(position, position);
1872	}
1873	
1874	jQuery.fn.setSelection = function(selectionStart, selectionEnd) {
1875	    if(this.lengh == 0) return this;
1876	    input = this[0];
1877	
1878	    if (input.createTextRange) {
1879	        var range = input.createTextRange();
1880	        range.collapse(true);
1881	        range.moveEnd('character', selectionEnd);
1882	        range.moveStart('character', selectionStart);
1883	        range.select();
1884	    } else if (input.setSelectionRange) {
1885	        input.focus();
1886	        input.setSelectionRange(selectionStart, selectionEnd);
1887	    }
1888	
1889	    return this;
1890	}
1891	
1892	
1893
1894	$.extend($.expr[':'], {
1895	    transparent: function(elem, i, attr){
1896	      return( $(elem).css("opacity") === "0" );
1897	    }
1898	});
1899	
1900
1901	function getQueryParams(qs) {
1902	    qs = qs.split("+").join(" ");
1903	    var params = {},
1904	        tokens,
1905	        re = /[?&]?([^=]+)=([^&]*)/g;
1906
1907	    while (tokens = re.exec(qs)) {
1908	        params[decodeURIComponent(tokens[1])]
1909	            = decodeURIComponent(tokens[2]);
1910	    }
1911
1912	    return params;
1913	}
1914
1915	var $_GET = getQueryParams(document.location.search);
1916
1917	
1918	//count
1919	var CountUp = function(target, startVal, endVal, decimals, duration, options) {
1920
1921    // make sure requestAnimationFrame and cancelAnimationFrame are defined
1922    // polyfill for browsers without native support
1923    // by Opera engineer Erik Möller
1924    var lastTime = 0;
1925    var vendors = ['webkit', 'moz', 'ms', 'o'];
1926    for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
1927        window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
1928        window.cancelAnimationFrame =
1929          window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
1930    }
1931    if (!window.requestAnimationFrame) {
1932        window.requestAnimationFrame = function(callback, element) {
1933            var currTime = new Date().getTime();
1934            var timeToCall = Math.max(0, 16 - (currTime - lastTime));
1935            var id = window.setTimeout(function() { callback(currTime + timeToCall); },
1936              timeToCall);
1937            lastTime = currTime + timeToCall;
1938            return id;
1939        };
1940    }
1941    if (!window.cancelAnimationFrame) {
1942        window.cancelAnimationFrame = function(id) {
1943            clearTimeout(id);
1944        };
1945    }
1946
1947    var self = this;
1948
1949     // default options
1950    self.options = {
1951        useEasing : true, // toggle easing
1952        useGrouping : true, // 1,000,000 vs 1000000
1953        separator : ',', // character to use as a separator
1954        decimal : '.', // character to use as a decimal
1955        easingFn: null, // optional custom easing closure function, default is Robert Penner's easeOutExpo
vendor: 4,251 bytes, lines 1956-2072
1956        formattingFn: null // optional custom formatting function, default is self.formatNumber below
1957    };
1958    // extend default options with passed options object
1959    for (var key in options) {
1960        if (options.hasOwnProperty(key)) {
1961            self.options[key] = options[key];
1962        }
1963    }
1964    if (self.options.separator === '') { self.options.useGrouping = false; }
1965    if (!self.options.prefix) self.options.prefix = '';
1966    if (!self.options.suffix) self.options.suffix = '';
1967
1968    self.d = (typeof target === 'string') ? document.getElementById(target) : target;
1969    self.startVal = Number(startVal);
1970    self.endVal = Number(endVal);
1971    self.countDown = (self.startVal > self.endVal);
1972    self.frameVal = self.startVal;
1973    self.decimals = Math.max(0, decimals || 0);
1974    self.dec = Math.pow(10, self.decimals);
1975    self.duration = Number(duration) * 1000 || 2000;
1976
1977    self.formatNumber = function(nStr) {
1978        nStr = nStr.toFixed(self.decimals);
1979        nStr += '';
1980        var x, x1, x2, rgx;
1981        x = nStr.split('.');
1982        x1 = x[0];
1983        x2 = x.length > 1 ? self.options.decimal + x[1] : '';
1984        rgx = /(\d+)(\d{3})/;
1985        if (self.options.useGrouping) {
1986            while (rgx.test(x1)) {
1987                x1 = x1.replace(rgx, '$1' + self.options.separator + '$2');
1988            }
1989        }
1990        return self.options.prefix + x1 + x2 + self.options.suffix;
1991    };
1992    // Robert Penner's easeOutExpo
1993    self.easeOutExpo = function(t, b, c, d) {
1994        return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b;
1995    };
1996
1997    self.easingFn = self.options.easingFn ? self.options.easingFn : self.easeOutExpo;
1998    self.formattingFn = self.options.formattingFn ? self.options.formattingFn : self.formatNumber;
1999
2000    self.version = function () { return '1.7.1'; };
2001
2002    // Print value to target
2003    self.printValue = function(value) {
2004        var result = self.formattingFn(value);
2005
2006        if (self.d.tagName === 'INPUT') {
2007            this.d.value = result;
2008        }
2009        else if (self.d.tagName === 'text' || self.d.tagName === 'tspan') {
2010            this.d.textContent = result;
2011        }
2012        else {
2013            this.d.innerHTML = result;
2014        }
2015    };
2016
2017    self.count = function(timestamp) {
2018
2019        if (!self.startTime) { self.startTime = timestamp; }
2020
2021        self.timestamp = timestamp;
2022        var progress = timestamp - self.startTime;
2023        self.remaining = self.duration - progress;
2024
2025        // to ease or not to ease
2026        if (self.options.useEasing) {
2027            if (self.countDown) {
2028                self.frameVal = self.startVal - self.easingFn(progress, 0, self.startVal - self.endVal, self.duration);
2029            } else {
2030                self.frameVal = self.easingFn(progress, self.startVal, self.endVal - self.startVal, self.duration);
2031            }
2032        } else {
2033            if (self.countDown) {
2034                self.frameVal = self.startVal - ((self.startVal - self.endVal) * (progress / self.duration));
2035            } else {
2036                self.frameVal = self.startVal + (self.endVal - self.startVal) * (progress / self.duration);
2037            }
2038        }
2039
2040        // don't go past endVal since progress can exceed duration in the last frame
2041        if (self.countDown) {
2042            self.frameVal = (self.frameVal < self.endVal) ? self.endVal : self.frameVal;
2043        } else {
2044            self.frameVal = (self.frameVal > self.endVal) ? self.endVal : self.frameVal;
2045        }
2046
2047        // decimal
2048        self.frameVal = Math.round(self.frameVal*self.dec)/self.dec;
2049
2050        // format and print value
2051        self.printValue(self.frameVal);
2052
2053        // whether to continue
2054        if (progress < self.duration) {
2055            self.rAF = requestAnimationFrame(self.count);
2056        } else {
2057            if (self.callback) { self.callback(); }
2058        }
2059    };
2060    // start your animation
2061    self.start = function(callback) {
2062        self.callback = callback;
2063        self.rAF = requestAnimationFrame(self.count);
2064        return false;
2065    };
2066    // toggles pause/resume animation
2067    self.pauseResume = function() {
2068        if (!self.paused) {
2069            self.paused = true;
2070            cancelAnimationFrame(self.rAF);
2071        } else {
2072            self.paused = false;
2073            delete self.startTime;
2074            self.duration = self.remaining;
2075            self.startVal = self.frameVal;
2076            requestAnimationFrame(self.count);
2077        }
2078    };
2079    // reset to startVal so animation can be run again
2080    self.reset = function() {
2081        self.paused = false;
2082        delete self.startTime;
2083        self.startVal = startVal;
2084        cancelAnimationFrame(self.rAF);
2085        self.printValue(self.startVal);
2086    };
2087    // pass a new endVal and start animation
2088    self.update = function (newEndVal) {
2089        cancelAnimationFrame(self.rAF);
2090        self.paused = false;
2091        delete self.startTime;
2092        self.startVal = self.frameVal;
2093        self.endVal = Number(newEndVal);
2094        self.countDown = (self.startVal > self.endVal);
2095        self.rAF = requestAnimationFrame(self.count);
2096    };
2097
2098    // format startVal on initialization
2099    self.printValue(self.startVal);
2100};
2101	
2102var easeOutCubic = function(t, b, c, d) {
2103    return c*((t=t/d-1)*t*t + 1) + b;
2104};	
2105	
2106	
2107/*-------------------------------------------------------------------------*/
2108/*	3.	Shortcode Stuff
2109/*-------------------------------------------------------------------------*/
2110
2111
2112function vcWaypoints() {
2113	$($fullscreenSelector+' .wpb_animate_when_almost_visible').each(function() {
2114
2115			var $vcOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%';
2116
2117			var $that = $(this);
2118			var waypoint = new Waypoint({
2119	 			element: $that,
2120	 			 handler: function(direction) {
2121
2122	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 
2123					     waypoint.destroy();
2124					     return;
2125					}
2126	 				$that.addClass("animated");
2127	 				$that.addClass("wpb_start_animation");
2128	 				waypoint.destroy();
2129				},
2130				offset: $vcOffsetPos
2131
2132			}); 
2133
2134	});
2135}
2136			 
2137
2138/***************** Milestone Counter ******************/
2139	
2140	function milestoneInit() {
2141
2142		$('.nectar-milestone').each(function() {
2143			
2144			//symbol
2145			if($(this).is('[data-symbol]')) {
2146				if($(this).find('.symbol-wrap').length == 0) {
2147					if($(this).attr('data-symbol-pos') == 'before') {
2148						$(this).find('.number').prepend('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>');
2149					} else {
2150						$(this).find('.number').append('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>');
2151					}
2152				}
2153
2154				$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'));
2155			
2156				$(this).find('.symbol-wrap').css({'font-size': $symbol_size + 'px', 'line-height': $symbol_size + 'px'});
2157			}
2158
2159			$(this).find('.number').css({'font-size': $(this).find('.number').attr('data-number-size') +'px', 'line-height': $(this).find('.number').attr('data-number-size') + 'px'});
2160		});
2161		
2162		if(!$('body').hasClass('mobile') && $('.nectar-milestone').length > 0) {
2163			
2164
2165			//blur effect
2166			var $blurCssString = '';
2167			$($fullscreenSelector+'.nectar-milestone.motion_blur').each(function(i){
2168					
2169				$(this).addClass('instance-'+i);
2170
2171				var $currentColor = $(this).find('.number').css('color');
2172				var colorInt = parseInt($currentColor.substring(1),16);
2173		   		var R = (colorInt & 0xFF0000) >> 16;
2174		    	var G = (colorInt & 0x00FF00) >> 8;
2175		   		var B = (colorInt & 0x0000FF) >> 0;
2176		   		
2177		   		var $rgbaColorStart = 'rgba('+R+','+G+','+B+',0.2)';
2178				var $rgbaColorEnd = 'rgba('+R+','+G+','+B+',1)';
2179				var $numberSize = parseInt($(this).find('.number').attr('data-number-size'));
2180
2181				$blurCssString += '@keyframes motion-blur-number-'+i+' { ' +
2182				   ' 0% { '+
2183				   		'opacity: 0;'+
2184						'color: '+$rgbaColorStart+'; '+
2185   						'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+'; '+
2186    					'transform: translateZ(0px) translateY(-100%); '+
2187    					'-webkit-transform: translateZ(0px) translateY(-100%); '+
2188    				'} '+
2189    				'33% { opacity: 1 }' +
2190    				'100% { '+
2191						'color: '+$rgbaColorEnd+'; '+
2192   						'text-shadow: none; '+
2193    					'transform: translateZ(0px) translateY(0px); '+
2194    					'-webkit-transform: translateZ(0px) translateY(0px); '+
2195    				'} '+
2196    			'} '+
2197    			'@-webkit-keyframes motion-blur-number-'+i+' { ' +
2198				   ' 0% { '+
2199				  	    'opacity: 0;'+
2200						'color: '+$rgbaColorStart+'; '+
2201   						'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+'; '+
2202    					'transform: translateZ(0px) translateY(-100%); '+
2203    					'-webkit-transform: translateZ(0px) translateY(-100%); '+
2204    				'} '+
2205    				'33% { opacity: 1 }' +
2206    				'100% { '+
2207						'color: '+$rgbaColorEnd+'; '+
2208   						'text-shadow: none; '+
2209    					'transform: translateZ(0px) translateY(0px); '+
2210    					'-webkit-transform: translateZ(0px) translateY(0px); '+
2211    				'} '+
2212    			'} '+
2213    			'.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+'; } ';
2214    			
2215    			//separate each character into spans
2216    			$symbol = $(this).find('.symbol-wrap').clone();
2217    			$(this).find('.symbol-wrap').remove();
2218    			var characters = $(this).find('.number').text().split("");
2219    			$this = $(this).find('.number');
2220				$this.empty();
2221    			$.each(characters, function (i, el) {
2222				    $this.append("<span>" + el + "</span");
2223				});
2224
2225				//handle symbol
2226				if($(this).has('[data-symbol]')) {
2227	    			if($(this).attr('data-symbol-pos') == 'after') {
2228	    				$this.append($symbol);
2229	    			} else {
2230	    				$this.prepend($symbol);
2231	    			}
2232	    		}
2233				
2234			});
2235
2236			var head = document.head || document.getElementsByTagName('head')[0];
2237				var style = document.createElement('style');
2238
2239				style.type = 'text/css';
2240			if (style.styleSheet){
2241			  style.styleSheet.cssText = $blurCssString;
2242			} else {
2243			  style.appendChild(document.createTextNode($blurCssString));
2244			}
2245			$(style).attr('id','milestone-blur');
2246			$('head #milestone-blur').remove();
2247			head.appendChild(style);
2248
2249
2250			//activate
2251			milestoneWaypoint();
2252
2253		}
2254
2255	}
2256
2257	function milestoneWaypoint() {
2258		$($fullscreenSelector+'.nectar-milestone').each(function() {
2259			//animation
2260			var $offset = ($(this).hasClass('motion_blur')) ? '90%' : '105%';
2261
2262
2263			var $that = $(this);
2264			var waypoint = new Waypoint({
2265	 			element: $that,
2266	 			 handler: function(direction) {
2267
2268	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
2269					     waypoint.destroy();
2270					     return;
2271					}
2272
2273	 			 	var $endNum = parseInt($that.find('.number span:not(.symbol)').text());
2274					if(!$that.hasClass('motion_blur')) {
2275
2276						var countOptions = { easingFn: easeOutCubic };
2277						var $countEle = $that.find('.number span:not(.symbol)')[0];
2278						var numAnim = new CountUp($countEle, 0, $endNum,0,2.2,countOptions);
2279						numAnim.start();
2280
2281					} else {
2282						$that.find('span').each(function(i){
2283							var $that = $(this);
2284							setTimeout(function(){ $that.addClass('in-sight'); },200*i);
2285						});
2286					}
2287
2288
2289					$that.addClass('animated-in');
2290					waypoint.destroy();
2291				},
2292				offset: 'bottom-in-view'
2293
2294			}); 
2295
2296		}); 
2297	}
2298
2299	var $animationOnScrollTimeOut = ($('.nectar-box-roll').length > 0) ? 850: 125;	
2300	//if($('.nectar-box-roll').length == 0) setTimeout(function(){  milestoneInit(); },125); 
2301	
2302/***************** Tabbed ******************/
2303	
2304	$tabbedClickCount = 0;
2305	$('body').on('click','.tabbed > ul li:not(.cta-button) a',function(){
2306		var $id = $(this).parents('li').index()+1;
2307		
2308		if(!$(this).hasClass('active-tab') && !$(this).hasClass('loading')){
2309			$(this).parents('ul').find('a').removeClass('active-tab');
2310			$(this).addClass('active-tab');
2311			
2312			$(this).parents('.tabbed').find('> div:not(.clear)').css({'visibility':'hidden','position':'absolute','opacity':'0','left':'-9999px','display':'none'});
2313			$(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').css({'visibility':'visible', 'position' : 'relative','left':'0','display':'block'}).stop().transition({'opacity':1},300);
2314			
2315			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); 
2316		}
2317		
2318		//waypoint checking
2319		if($tabbedClickCount != 0) {
2320			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-progress-bar').length > 0 ) 
2321				progressBars();
2322			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 ) 
2323				dividers();
2324			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('img.img-with-animation').length > 0 ||
2325			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.col.has-animation').length > 0  || 
2326			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar_cascading_images').length > 0  || 
2327			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wpb_column.has-animation').length > 0 ) {
2328				colAndImgAnimations();
2329				cascadingImageBGSizing();
2330			}
2331			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-milestone').length > 0 ) 
2332				milestoneWaypoint();
2333			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar_image_with_hotspots[data-animation="true"]').length > 0 ) 
2334				imageWithHotspots();
2335			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-fancy-ul').length > 0 ) 
2336				nectar_fancy_ul_init();
2337			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-split-heading').length > 0 ) 
2338				splitLineHeadings();
2339			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wpb_column[data-border-animation="true"]').length > 0) {
2340				animatedColBorders();
2341			}
2342			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wpb_animate_when_almost_visible').length > 0) {
2343				vcWaypoints();
2344			}
2345			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-animated-title').length > 0) {
2346				animated_titles();
2347			}
2348			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar_food_menu_item').length > 0) {
2349				foodMenuItems();
2350			}
2351			if($(this).parents('.wpb_row').length > 0) {
2352				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.vc_pie_chart').length > 0  ||
2353				   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wp-video-shortcode').length > 0 ||
2354				   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.twentytwenty-container').length > 0 ||
2355				   $(this).parents('.wpb_row').next().hasClass('parallax_section'))
2356					$(window).trigger('resize');
2357
2358				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-flickity').length > 0 )
2359					$('.nectar-flickity:not(.masonry)').flickity('resize');
2360			}
2361
2362			//svg icons
2363		
2364			$(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.svg-icon-holder').each(function(i){
2365				var $that = $(this);
2366
2367				setTimeout(function(){
2368
2369					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;
2370
2371					clearTimeout($animatedSVGIconTimeout[i]);
2372
2373					if($that.attr('data-animation') == 'false') { 
2374						$animationSpeed = 1;
2375						$that.css('opacity','1');
2376						$svg_icons[$that.attr('id').slice(-1)].finish();
2377					} else {
2378						
2379						$svg_icons[$that.attr('id').slice(-1)].reset();
2380						$animatedSVGIconTimeout[i] = setTimeout(function(){ $svg_icons[$that.attr('id').slice(-1)].play(); },$animationDelay);
2381						
2382					}
2383				},150);
2384			});
2385
2386		}
2387
2388		//fix columns inside tabs
2389		$(this).parents('.tabbed').find('.wpb_row').each(function(){
2390			if(typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') {
2391				
2392				var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left;
2393				$(this).find('[class*="vc_col-"]').each(function(){
2394					$(this).removeClass('no-left-margin');
2395					if($(this).offset().left < $firstChildOffset + 15) { 
2396						$(this).addClass('no-left-margin');
2397					} else {
2398						$(this).removeClass('no-left-margin');
2399					}
2400				});
2401			}
2402		});
2403
2404		$tabbedClickCount++;
2405
2406		//magic line
2407		if($(this).parent().parent().find('.magic-line').length > 0) {
2408			magicLineCalc($(this));
2409	     }
2410
2411		return false;
2412	});
2413
2414
2415	function magicLineCalc($ele) {
2416		var el, leftPos, ratio;
2417	    el = $ele.parent();
2418	    if (el.length) {
2419	        leftPos = el.position().left;
2420	        ratio = el.width();
2421	    } else {
2422	        leftPos = ratio = 0;
2423	    }
2424
2425	    $ele.parent().parent().find('.magic-line').css('transform', 'translateX(' + leftPos + 'px) scaleX(' + ratio + ')');
2426	}
2427	
2428	//make sure the tabs don't have a nectar slider - we'll init this after the sliders load in that case
2429	function tabbedInit(){ 
2430		$('.tabbed').each(function(){
2431			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){
2432				$(this).find('> ul li:first-child a').click();
2433			}	
2434			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 ){
2435				var $that = $(this);
2436				
2437				$(this).find('.wpb_tab').show().css({'opacity':0,'height':'1px'});
2438				$(this).find('> ul li a').addClass('loading');
2439				
2440				setTimeout(function(){ 
2441					$that.find('.wpb_tab').hide().css({'opacity':1,'height':'auto'}); 
2442					$that.find('> ul li a').removeClass('loading');
2443					$that.find('> ul li:first-child a').click(); 
2444				},900);
2445			}
2446
2447			var $that = $(this);
2448			//minimal alt effect
2449			setTimeout(function(){
2450				if($that.is('[data-style="minimal_alt"]')) {
2451					$that.find('> ul').append('<li class="magic-line" />');
2452					 magicLineCalc($that.find('> ul > li:first-child > a'));
2453				}
2454			},100);
2455
2456
2457		});
2458	}
2459	tabbedInit();
2460
2461	//deep linking
2462	function tabbbedDeepLinking(){
2463		if(typeof $_GET['tab'] != 'undefined'){
2464			$('.wpb_tabs_nav').each(function(){
2465
2466				$(this).find('li').each(function(){
2467					var $currentText = $(this).find('a').text();
2468					var $getText = $_GET['tab'];
2469					var $that = $(this);
2470
2471					$currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
2472					$getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
2473
2474					if($currentText == $getText)  { 
2475
2476			          $(this).find('a').click(); 
2477			           setTimeout(function(){ 
2478			              $that.find('a').click(); 
2479			           },901);
2480			        }
2481				})
2482			});
2483		}
2484	}
2485	tabbbedDeepLinking();
2486
2487/***************** Toggle ******************/
2488	
2489	//toggles
2490	$('body').on('click','.toggle h3 a', function(){
2491	
2492		if(!$(this).parents('.toggles').hasClass('accordion')) { 
2493			$(this).parents('.toggle').find('> div').slideToggle(300);
2494			$(this).parents('.toggle').toggleClass('open');
2495			
2496			//switch icon
2497			if( $(this).parents('.toggle').hasClass('open') ){
2498				$(this).find('i').attr('class','icon-minus-sign');
2499			} else {
2500				$(this).find('i').attr('class','icon-plus-sign');
2501			}
2502
2503			if($(this).parents('.toggle').find('> div .iframe-embed').length > 0 && $(this).parents('.toggle').find('> div .iframe-embed iframe').height() == '0') responsiveVideoIframes();
2504			if($(this).parents('.full-width-content').length > 0) setTimeout(function(){ fullWidthContentColumns(); },300);
2505			if($('#nectar_fullscreen_rows').length > 0) setTimeout(function(){ $(window).trigger('smartresize'); },300);
2506			return false;
2507		}
2508	});
2509	
2510	//accordion
2511	$('body').on('click','.accordion .toggle h3 a', function(){
2512		
2513		if($(this).parents('.toggle').hasClass('open')) return false;
2514		
2515		$(this).parents('.toggles').find('.toggle > div').slideUp(300);
2516		$(this).parents('.toggles').find('.toggle h3 a i').attr('class','icon-plus-sign');
2517		$(this).parents('.toggles').find('.toggle').removeClass('open');
2518		
2519		$(this).parents('.toggle').find('> div').slideDown(300);
2520		$(this).parents('.toggle').addClass('open');
2521		
2522		//switch icon
2523		if( $(this).parents('.toggle').hasClass('open') ){
2524			$(this).find('i').attr('class','icon-minus-sign');
2525		} else {
2526			$(this).find('i').attr('class','icon-plus-sign');
2527		}
2528
2529		if($(this).parents('.full-width-content').length > 0) { 
2530			clearTimeout($t);
2531			var $t = setTimeout(function(){ fullWidthContentColumns(); },400);
2532		}
2533		if($('#nectar_fullscreen_rows').length > 0) {
2534			clearTimeout($t);
2535			var $t = setTimeout(function(){ $(window).trigger('smartresize'); },400);
2536		}
2537		
2538		return false;
2539	});
2540	
2541	//accordion start open
2542	function accordionInit(){ 
2543		$('.accordion').each(function(){
2544			$(this).find('> .toggle').first().addClass('open').find('> div').show();
2545			$(this).find('> .toggle').first().find('a i').attr('class','icon-minus-sign');
2546		});
2547		
2548		
2549		$('.toggles').each(function(){
2550			
2551			var $isAccordion = ($(this).hasClass('accordion')) ? true : false;
2552			
2553			$(this).find('.toggle').each(function(){
2554				if($(this).find('> div .testimonial_slider').length > 0 || $(this).find('> div iframe').length > 0) {
2555					var $that = $(this);
2556					$(this).find('> div').show().css({'opacity':0,'height':'1px', 'padding':'0'});
2557					
2558					testimonialHeightResize();
2559					
2560					setTimeout(function(){
2561						$that.find('> div').hide().css({'opacity':1,'height':'auto', 'padding':'10px 14px'}); 
2562						if($isAccordion == true && $that.index() == 0) $that.find('> div').slideDown(300);
2563					},900);
2564				} 
2565			});
2566		})
2567	}
2568	accordionInit();
2569
2570	//deep linking
2571	function accordionDeepLinking(){
2572		if(typeof $_GET['toggle'] != 'undefined'){
2573			$('.toggles').each(function(){
2574
2575				$(this).find('.toggle').each(function(){
2576					var $currentText = $(this).find('h3 a').clone();
2577					var $getText = $_GET['toggle'];
2578
2579					$($currentText).find('i').remove();
2580					$currentText = $currentText.text();
2581					$currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
2582					$getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
2583
2584					if($currentText == $getText) $(this).find('h3 a').click();
2585				});
2586			});
2587		}
2588	}
2589	accordionDeepLinking();
2590
2591/***************** Button ******************/
2592	
2593	$.cssHooks.color = {
2594	    get: function(elem) {
2595	        if (elem.currentStyle)
2596	            var color = elem.currentStyle["color"];
2597	        else if (window.getComputedStyle)
2598	            var color = document.defaultView.getComputedStyle(elem,
2599	                null).getPropertyValue("color");
2600	        if (color.search("rgb") == -1)
2601	            return color;
2602	        else {
2603	            color = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
2604	            function hex(x) {
2605	                return ("0" + parseInt(x).toString(16)).slice(-2);
2606	            }
2607	            if(color) {
2608	            	return "#" + hex(color[1]) + hex(color[2]) + hex(color[3]);
2609	            }
2610	        }
2611	    }
2612	}
2613
2614	$.cssHooks.backgroundColor = {
2615	    get: function(elem) {
2616	        if (elem.currentStyle)
2617	            var bg = elem.currentStyle["backgroundColor"];
2618	        else if (window.getComputedStyle)
2619	            var bg = document.defaultView.getComputedStyle(elem,
2620	                null).getPropertyValue("background-color");
2621	        if (bg.search("rgb") == -1)
2622	            return bg;
2623	        else {
2624	            bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
2625	            function hex(x) {
2626	                return ("0" + parseInt(x).toString(16)).slice(-2);
2627	            }
2628	            if(bg) {
2629	            	return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]);
2630	            }
2631	        }
2632	    }
2633	}
2634	
2635	function shadeColor(hex, lum) {
2636
2637	  // validate hex string
2638		hex = String(hex).replace(/[^0-9a-f]/gi, '');
2639		if (hex.length < 6) {
2640			hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];
2641		}
2642		lum = lum || 0;
2643
2644		// convert to decimal and change luminosity
2645		var rgb = "#", c, i;
2646		for (i = 0; i < 3; i++) {
2647			c = parseInt(hex.substr(i*2,2), 16);
2648			c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
2649			rgb += ("00"+c).substr(c.length);
2650		}
2651
2652		return rgb;
2653	}
2654
2655	//color
2656	function coloredButtons() {
2657		$('.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(){
2658			
2659			$(this).css('visibility','visible');
2660			
2661			if($(this).hasClass('see-through-3') && $(this).attr('data-color-override') == 'false') {
2662				return true;
2663			}
2664			//if($(this).attr('data-color-override') != 'false'){
2665
2666				if($(this).attr('data-color-override') != 'false') {
2667					var $color = $(this).attr('data-color-override') ;
2668				} else {
2669					if($(this).parents('.dark').length > 0) 
2670						var $color = '#000000';
2671					else 
2672						var $color = '#ffffff';
2673				}
2674
2675				if(!$(this).hasClass('see-through-3')) $(this).css('color',$color);
2676				$(this).find('i').css('color',$color);
2677				
2678				var colorInt = parseInt($color.substring(1),16);
2679				var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override';
2680				var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff';
2681				
2682		   		var R = (colorInt & 0xFF0000) >> 16;
2683		    	var G = (colorInt & 0x00FF00) >> 8;
2684		   		var B = (colorInt & 0x0000FF) >> 0;
2685		   		
2686		   		$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2687
2688				$(this).css('border-color','rgba('+R+','+G+','+B+','+$opacityStr+')');
2689				
2690				if($(this).hasClass('see-through')) {
2691					$(this).hover(function(){
2692						$(this).css('border-color','rgba('+R+','+G+','+B+',1)');
2693					},function(){
2694						$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2695						$(this).css('border-color','rgba('+R+','+G+','+B+','+$opacityStr+')');
2696					});
2697				} else {
2698					
2699					$(this).find('i').css('color', $hoverTextColor);
2700					
2701					if($hoverColor != 'no-override'){
2702						$(this).hover(function(){
2703				
2704							$(this).css({
2705								'border-color': $hoverColor,
2706								'background-color': $hoverColor,
2707								'color': $hoverTextColor
2708							});
2709						},function(){
2710							$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2711
2712							if(!$(this).hasClass('see-through-3')) {
2713								$(this).css({
2714									'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
2715									'background-color': 'transparent',
2716									'color': $color
2717								});
2718							} else {
2719								$(this).css({
2720									'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
2721									'background-color': 'transparent'
2722								});
2723							}
2724						});
2725					
2726					} else {
2727						$(this).hover(function(){
2728							$(this).css({
2729								'border-color': $hoverColor,
2730								'color': $hoverTextColor
2731							});
2732						},function(){
2733							$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2734							$(this).css({
2735								'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
2736								'color':  $hoverTextColor
2737							});
2738						});
2739					
2740					}
2741			//	}
2742			
2743			}
2744		});
2745		
2746		$('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function(){
2747			
2748			$(this).css('visibility','visible');
2749			
2750			if($(this).attr('data-color-override') != 'false'){
2751				
2752				var $color = $(this).attr('data-color-override');
2753				$(this).removeClass('accent-color').removeClass('extra-color-1').removeClass('extra-color-2').removeClass('extra-color-3');
2754				$(this).css('background-color',$color);
2755				
2756			}
2757			
2758		});
2759
2760
2761		//solid color tilt 
2762		if($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) {
2763
2764			var $tiltButtonCssString = '';
2765
2766			$('.swiper-slide .solid_color_2 a').each(function(i){
2767				
2768				$(this).addClass('instance-'+i);
2769
2770				if($(this).attr('data-color-override') != 'false') {
2771					var $color = $(this).attr('data-color-override');
2772				} else {
2773					if($(this).parents('.dark').length > 0) 
2774						var $color = '#000000';
2775					else 
2776						var $color = '#ffffff';
2777				}
2778
2779				$(this).css('color',$color);
2780				$(this).find('i').css('color',$color);
2781				
2782				var $currentColor = $(this).css('background-color');
2783				var $topColor = shadeColor($currentColor, 0.13);
2784				var $bottomColor = shadeColor($currentColor, -0.15);
2785	
2786				$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+'; } ';
2787
2788			});
2789
2790
2791			$('.tilt-button-wrap a').each(function(i){
2792				
2793				$(this).addClass('instance-'+i);
2794
2795				var $currentColor = $(this).css('background-color');
2796
2797				if($(this).attr('data-color-override') != 'false') {
2798					var $color = $(this).attr('data-color-override');
2799					$(this).css('background-color',$color);
2800					$currentColor = $color;
2801				} 
2802			
2803				var $topColor = shadeColor($currentColor, 0.13);
2804				var $bottomColor = shadeColor($currentColor, -0.15);
2805	
2806				$tiltButtonCssString += '.tilt-button-wrap a.instance-'+i + ':after { background-color: '+$topColor+';  }' + ' .tilt-button-wrap a.instance-'+i + ':before { background-color: '+$bottomColor+'; } ';
2807
2808			});
2809
2810			var head = document.head || document.getElementsByTagName('head')[0];
2811   			var style = document.createElement('style');
2812
2813   			style.type = 'text/css';
2814			if (style.styleSheet){
2815			  style.styleSheet.cssText = $tiltButtonCssString;
2816			} else {
2817			  style.appendChild(document.createTextNode($tiltButtonCssString));
2818			}
2819
2820			head.appendChild(style);
2821		}
2822
2823
2824		//transparent 3d
2825		if($('.nectar-3d-transparent-button').length > 0) {
2826
2827			var $3dTransButtonCssString = '';
2828			$('.nectar-3d-transparent-button').each(function(i){
2829
2830				var $that = $(this);
2831				var $size = $that.attr('data-size');
2832				var $padding = 0;
2833
2834		
2835
2836				//size
2837
2838				if($size == 'large') {
2839					$padding = 46;
2840					$font_size = 16;
2841				} else if($size == 'medium') {
2842					$padding = 30;
2843					$font_size = 16;
2844				} else if($size == 'small') {
2845					$padding = 20;
2846					$font_size = 12;
2847				} else if($size == 'jumbo') {
2848					$padding = 54;
2849					$font_size = 24;
2850				} else if($size == 'extra_jumbo') {
2851					$padding = 100;
2852					$font_size = 64;
2853				}
2854
2855				$that.find('svg text').attr('font-size',$font_size);
2856				$boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect();
2857
2858				$text_width = $boundingRect.width;
2859				$text_height = $font_size*1.5;
2860
2861				$extraMult = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 0 : 1;
2862
2863				$that.css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'});
2864				$that.find('> a').css({'height': ($text_height+$padding)+'px'});
2865
2866				$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));
2867				if($size == 'jumbo')
2868					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.68) +')');
2869				else if($size == 'extra_jumbo')
2870					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.6)/2 +' ' + (($text_height+$padding) / 1.6) +')');
2871				else if($size == 'large') {
2872					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.7) +')');
2873				}
2874				else {
2875					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.65) +')');
2876				}
2877				$that.find('.front-3d ').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
2878				$that.find('.back-3d').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
2879
2880				//mask
2881				$(this).find('.front-3d svg > rect').attr('id','masked-rect-id-'+i);
2882				$(this).find('.front-3d defs mask').attr('id','button-text-mask-'+i);
2883
2884				$that.css('visibility','visible');
2885				$3dTransButtonCssString+= '#masked-rect-id-'+i+' { mask: url(#button-text-mask-'+i+'); -webkit-mask: url(#button-text-mask-'+i+')} ';
2886
2887			});
2888
2889			//extra jumbo resize
2890			function createExtraJumboSize() {
2891				$('.nectar-3d-transparent-button').each(function(i){
2892					
2893					if($(this).css('visibility') != 'visible') return;
2894
2895					var $that = $(this);
2896					var $size = $that.attr('data-size');
2897					if($size == 'extra_jumbo') {
2898
2899						$extraMult = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 0 : 1;
2900
2901						if(window.innerWidth < 1000 && window.innerWidth > 690) {
2902							$padding = 64;
2903							$font_size = 34;
2904							$that.find('.back-3d rect').attr('stroke-width','12');
2905							$vert_height_divider = 1.7;
2906						} else if(window.innerWidth <= 690 ) {
2907							$padding = 46;
2908							$font_size = 16;
2909							$that.find('.back-3d rect').attr('stroke-width','10');
2910							$vert_height_divider = 1.7;
2911						}  else {
2912							$padding = 100;
2913							$font_size = 64;
2914							$that.find('.back-3d rect').attr('stroke-width','20');
2915							$vert_height_divider = 1.6;
2916						}
2917			
2918
2919						$that.find('svg text').attr('font-size',$font_size);
2920
2921						$boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect();
2922						$text_width = $boundingRect.width;
2923						$text_height = $font_size*1.5;
2924
2925						$that.css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'});
2926						$that.find('> a').css({'height': ($text_height+$padding)+'px'});
2927
2928						$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));
2929
2930						$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.6)/2 +' ' + (($text_height+$padding) / $vert_height_divider) +')');
2931
2932						$that.find('.front-3d ').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
2933						$that.find('.back-3d').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
2934
2935					}
2936				});
2937			}
2938			createExtraJumboSize();
2939			$(window).on('smartresize',createExtraJumboSize);
2940
2941			var head = document.head || document.getElementsByTagName('head')[0];
2942				var style = document.createElement('style');
2943
2944				style.type = 'text/css';
2945			if (style.styleSheet){
2946			  style.styleSheet.cssText = $3dTransButtonCssString;
2947			} else {
2948			  style.appendChild(document.createTextNode($3dTransButtonCssString));
2949			}
2950
2951			head.appendChild(style);
2952		}
2953
2954		//gradient btn init
2955		setTimeout(function(){
2956			$('.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');
2957		},150);
2958		//no grad for ff
2959		if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) {
2960			$('.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');
2961		}
2962	}	
2963
2964	coloredButtons();
2965
2966
2967	//large icon hover
2968	function largeIconHover(){
2969		$('.icon-3x').each(function(){
2970			$(this).closest('.col').hover(function(){
2971				$(this).find('.icon-3x').addClass('hovered')
2972			},function(){
2973				$('.icon-3x').removeClass('hovered')
2974			});
2975		});
2976
2977		//remove gradient from FF
2978		if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./))
2979			$('[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');
2980	}
2981	largeIconHover();
2982
2983
2984/***************** Team Member ******************/
2985function teamMemberFullscreen() {
2986
2987	//open
2988	$('body').on('click','.team-member[data-style="bio_fullscreen"]',function(){
2989		
2990		if($('.nectar_team_member_overlay').length > 0) return;
2991
2992		var $usingBoxedClass = ($('body > #boxed').length > 0) ? 'in-boxed' : null;
2993
2994		$teamMemberMeta = $(this).find('.nectar_team_bio').html();
2995		$teamMemberImg = ($(this).find('.nectar_team_bio_img[data-img-src]').length > 0) ? $(this).find('.nectar_team_bio_img').attr('data-img-src') : '';
2996		$('body').append('<div class="nectar_team_member_overlay '+$usingBoxedClass+'"><div class="inner-wrap"><div class="team_member_details"><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 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>');
2997		if($teamMemberImg.length > 0) {
2998
2999			//fadein img on load
3000			var teamTmpImg = new Image();
3001			teamTmpImg.src = $teamMemberImg;
3002		    teamTmpImg.onload = function() {
3003		        $('.nectar_team_member_overlay .team_member_image').css('opacity','1');
3004		    };
3005			$('.nectar_team_member_overlay .team_member_image').css({ 'background-image': 'url("'+$teamMemberImg+'")'});
3006		}
3007		
3008		
3009		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').height();
3010		$('.nectar_team_member_overlay .inner-wrap').css({ 'top': $headerNavSpace });
3011
3012		teamFullscreenResize();
3013
3014		//transition in
3015		$('.nectar_team_member_overlay').addClass('open').addClass('animating');
3016
3017		setTimeout(function(){
3018			$('.nectar_team_member_close').addClass('visible');
3019			$('.nectar_team_member_overlay').removeClass('animating');
3020		},500);
3021
3022		//bind close mousemove
3023		$(document).on('mousemove',teamMousemoveOn);
3024
3025		if($('.team-member[data-style="bio_fullscreen"]').length > 0 && navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)) { 
3026			$('.nectar_team_member_overlay').addClass('on-mobile');
3027		}
3028
3029	});
3030
3031	//close
3032	$('body').on('click','.nectar_team_member_overlay',function(){
3033		if(!$(this).hasClass('animating')) {
3034
3035			$('.nectar_team_member_overlay').removeClass('open');
3036			$('.nectar_team_member_close').removeClass('visible');
3037
3038			setTimeout(function(){
3039				
3040				//unbind close mousemove
3041				$(document).off('mousemove',teamMousemoveOn);
3042
3043				$('.nectar_team_member_overlay, .nectar_team_member_close').remove();
3044
3045			},820);
3046		}
3047	});
3048
3049	if($('.team-member[data-style="bio_fullscreen"]').length > 0) {
3050		$(window).resize(teamFullscreenResize);
3051	}
3052
3053	
3054}
3055
3056function teamFullscreenResize() {
3057	var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 275 : 0;
3058	$('.nectar_team_member_overlay').css({'width' : $(window).width()-$leftHeaderSize, 'left': $leftHeaderSize});
3059}
3060
3061function teamMousemoveOn(e) {
3062	
3063	if($('a:hover').length > 0) {
3064		$('.nectar_team_member_close .inner').removeClass('visible');
3065	} else {
3066		$('.nectar_team_member_close .inner').addClass('visible');
3067	}
3068    $('.nectar_team_member_close').css({
3069       left:  e.pageX - 26,
3070       top:   e.pageY - $(window).scrollTop() - 29
3071    });
3072}
3073
3074if($('.team-member').length > 0) {
3075	teamMemberFullscreen();
3076}
3077
3078/***************** Column Hover BG ******************/
3079
3080function columnBGColors() {	
3081	
3082	var $columnColorCSS = '';
3083
3084	$('.wpb_column').each(function(i){
3085
3086		$(this).addClass('instance-'+i);
3087
3088		//bg color
3089		if($(this).attr('data-has-bg-color') == 'true') {
3090			if($(this).is('[data-animation*="reveal"]') && $(this).hasClass('has-animation')) 
3091				$columnColorCSS += '.wpb_column.instance-'+i+ ' .column-inner-wrap .column-inner:before { background-color:' + $(this).attr('data-bg-color') + ';  opacity: '+$(this).attr('data-bg-opacity')+'; }';
3092			else 
3093				$columnColorCSS += '.wpb_column.instance-'+i+ ':before { background-color:' + $(this).attr('data-bg-color') + ';  opacity: '+$(this).attr('data-bg-opacity')+'; }';
3094		}
3095
3096		//hover bg color
3097		if($(this).is('[data-hover-bg^="#"]')) {
3098			if($(this).is('[data-animation*="reveal"]') && $(this).hasClass('has-animation')) 
3099				$columnColorCSS += '.wpb_column.instance-'+i+ ':hover .column-inner:before { background-color: '+$(this).attr('data-hover-bg') + '; opacity: '+$(this).attr('data-hover-bg-opacity')+'; }';
3100			else 
3101	   			$columnColorCSS += '.wpb_column.instance-'+i+ ':hover:before { background-color: '+$(this).attr('data-hover-bg') + '; opacity: '+$(this).attr('data-hover-bg-opacity')+'; }';
3102
3103		}
3104	});
3105
3106	if($columnColorCSS.length > 1) {
3107		var head = document.head || document.getElementsByTagName('head')[0];
3108		var style = document.createElement('style');
3109
3110		style.type = 'text/css';
3111		if (style.styleSheet){
3112		  style.styleSheet.cssText = $columnColorCSS;
3113		} else {
3114		  style.appendChild(document.createTextNode($columnColorCSS));
3115		}
3116
3117		head.appendChild(style);
3118	}
3119
3120}
3121columnBGColors();
3122
3123
3124
3125/***************** Row Color Overlay ******************/
3126function rowColorOverlay() {	
3127	
3128	var $rowOverlayCSS = '';
3129
3130	$('.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){
3131
3132		$(this).parents('.row-bg-wrap').addClass('instance-'+i);
3133
3134		$overlayOpacity = ($(this).attr('data-overlay_strength').length > 0) ? $(this).attr('data-overlay_strength') : '1';
3135		
3136		var $using_img_trans = false;
3137
3138		if($overlayOpacity == 'image_trans') { 
3139			$overlayOpacity = '1';
3140			$using_img_trans = true;
3141		}
3142
3143		$overlay1 = ($(this).attr('data-color_overlay').length > 0) ? $(this).attr('data-color_overlay') : 'transparent';
3144		$overlay2 = ($(this).attr('data-color_overlay_2').length > 0) ? $(this).attr('data-color_overlay_2') : 'transparent';
3145		$gradientDirection = ($(this).attr('data-gradient_direction').length > 0) ? $(this).attr('data-gradient_direction') : 'left_t_right';
3146		switch($gradientDirection) {
3147			case 'left_to_right' : 
3148				var $gradientDirectionDeg = '90deg';
3149				break;
3150			case 'left_t_to_right_b' : 
3151				var $gradientDirectionDeg = '135deg';
3152				break;
3153			case 'left_b_to_right_t' : 
3154				var $gradientDirectionDeg = '45deg';
3155				break;
3156			case 'top_to_bottom' : 
3157				var $gradientDirectionDeg = 'to bottom';
3158				break;
3159		} 
3160		$enableGradient = ($(this).attr('data-enable_gradient') == 'true') ? true : false;
3161
3162		if($enableGradient) {
3163			
3164			//safari transparent white fix
3165			if($overlay1 == '#ffffff' && $overlay2 == 'transparent') $overlay2 = 'rgba(255,255,255,0.001)';
3166			if($overlay1 == 'transparent' && $overlay2 == '#ffffff') $overlay1 = 'rgba(255,255,255,0.001)';
3167			
3168			if($gradientDirection == 'top_to_bottom') {
3169			
3170				if($overlay2 == 'transparent' || $overlay2 == 'rgba(255,255,255,0.001)') {
3171	 
3172					$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 0%,' + $overlay2 + ' 75%);  opacity: '+$overlayOpacity+'; }';
3173				}
3174
3175				if($overlay1 == 'transparent' || $overlay1 == 'rgba(255,255,255,0.001)') { 
3176					$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 25%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
3177				}
3178				
3179				if( $overlay1 != 'transparent' && $overlay2 != 'transparent') { 
3180					$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after {  background: '+$overlay1+'; background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 0%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
3181				}
3182			
3183			} 
3184			else if($gradientDirection == 'left_to_right') {
3185
3186				if($overlay1 == 'transparent' || $overlay1 == 'rgba(255,255,255,0.001)') { 
3187					$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: '+$overlay1+'; background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 25%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
3188				}
3189
3190				if( $overlay1 != 'transparent' && $overlay2 != 'transparent') { 
3191					$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: '+$overlay1+'; background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 0%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
3192				}
3193			}
3194
3195			else {
3196				$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: '+$overlay1+'; background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 0%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
3197			}
3198
3199
3200		} else {
3201
3202			if($(this).attr('data-color_overlay').length > 0) {
3203				$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background-color:' + $overlay1 + ';  opacity: '+$overlayOpacity+'; }';
3204			}
3205
3206		}
3207	
3208
3209
3210	});
3211	
3212	if($rowOverlayCSS.length > 1) {
3213		var head = document.head || document.getElementsByTagName('head')[0];
3214		var style = document.createElement('style');
3215
3216		style.type = 'text/css';
3217		if (style.styleSheet){
3218		  style.styleSheet.cssText = $rowOverlayCSS;
3219		} else {
3220		  style.appendChild(document.createTextNode($rowOverlayCSS));
3221		}
3222
3223		head.appendChild(style);
3224	}
3225
3226}
3227
3228rowColorOverlay();
3229
3230
3231/***************** morphing button ******************/
3232
3233function morphingOutlines() {
3234
3235	if($('.morphing-outline').length > 0) {
3236
3237		$morphingOutlineCSS = '';
3238
3239		$('.morphing-outline').each(function(i){
3240			$(this).addClass('instance-'+i).css({'visibility':'visible'});
3241			var $width = $(this).find('.inner').width();
3242			var $height = $(this).find('.inner').height();
3243			var $border = parseInt($(this).attr("data-border-thickness"));
3244			var $hover = ($('body[data-button-style*="rounded"]').length > 0) ? ':hover': '';
3245			var $hover2 = ($('body[data-button-style*="rounded"]').length > 0) ? '': ':hover';
3246
3247			$morphingOutlineCSS += 'body .morphing-outline.instance-'+i+' .inner > * { color: '+$(this).attr("data-starting-color")+'; } ';
3248			$morphingOutlineCSS += 'body .morphing-outline.instance-'+i+' .inner:after  { border-width:'+$(this).attr("data-border-thickness")+'px ; border-color: '+$(this).attr("data-starting-color")+'; } ';
3249			
3250			$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")+'; } ';
3251			$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")+'; } ';
3252			//padding calcs
3253			$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}';
3254			$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
3255			$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 }';
3256
3257			$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 }';
3258			////hover
3259			$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}';
3260			$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 }';
3261
3262		});
3263
3264		var head = document.head || document.getElementsByTagName('head')[0];
3265		var style = document.createElement('style');
3266
3267		style.type = 'text/css';
3268		style.id = 'morphing-outlines';
3269		if (style.styleSheet){
3270		  style.styleSheet.cssText = $morphingOutlineCSS;
3271		} else {
3272		  style.appendChild(document.createTextNode($morphingOutlineCSS));
3273		}
3274
3275		$('#morphing-outlines').remove();
3276		head.appendChild(style);
3277	}
3278}
3279
3280setTimeout(morphingOutlines,100); 
3281setTimeout(fullWidthContentColumns,126);
3282
3283
3284/***************** svg icons *******************/
3285
3286var $svg_icons = [];
3287function svgAnimations() {
3288	
3289	$svgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
3290
3291	if($svg_icons.length == 0) {
3292
3293		$('.svg-icon-holder:not(.animated-in)').each(function(i){
3294			var $that = $(this);
3295
3296			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)) $that.attr('data-animation','false');
3297
3298			//size
3299			$that.css({'height': parseInt($that.attr('data-size')) +'px', 'width': parseInt($that.attr('data-size')) +'px'});
3300
3301			//animation
3302			$(this).attr('id','nectar-svg-animation-instance-'+i);
3303			var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200;
3304			if($that.attr('data-animation') == 'false') { 
3305				$animationSpeed = 1;
3306				$that.css('opacity','1');
3307			}
3308
3309			if(!$that.hasClass('bound')) {
3310				$svg_icons[i] = new Vivus($that.attr('id'), {type: 'delayed', pathTimingFunction: Vivus.EASE_OUT, animTimingFunction: Vivus.LINEAR, duration: $animationSpeed, file: $that.text(), onReady: svgInit });
3311			}
3312
3313			$that.find('span').remove();
3314			if($animationSpeed !== 1) {
3315
3316				var $that = $(this);
3317				var waypoint = new Waypoint({
3318		 			element: $that,
3319		 			 handler: function(direction) {
3320		 			 	if( $that.hasClass('animated-in')) { 
3321						     waypoint.destroy();
3322						     return;
3323						}
3324
3325		 			 	checkIfReady();
3326						$that.addClass('animated-in');
3327						waypoint.destroy();
3328					},
3329					offset: $svgOffsetPos
3330
3331				}); 
3332
3333			} else {
3334				checkIfReady();
3335			}
3336
3337			function checkIfReady() {
3338				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;
3339				
3340				var $iconID = $that.attr('id').replace(/[^0-9]/g,'');
3341
3342				if($svg_icons[$iconID].isReady == true) {
3343					$that.css('opacity','1');
3344					 setTimeout(function(){ $svg_icons[$iconID].reset().play(); },$animationDelay);
3345				} else {
3346					setTimeout(checkIfReady,50);
3347				}
3348			}
3349
3350			function svgInit() {
3351
3352				//set size
3353				$that.find('object').css({'height': parseInt($that.attr('data-size')) +'px', 'width': parseInt($that.attr('data-size')) +'px'});
3354
3355				var $iconID = $that.attr('id').replace(/[^0-9]/g,'');
3356
3357				//stop animation until user scrolls to it
3358				$svg_icons[$iconID].reset().stop();
3359
3360				//set color
3361				var svgDoc = $that.find('object')[0].contentDocument;
3362
3363				var styleElement = svgDoc.createElementNS("http://www.w3.org/2000/svg", "style");
3364				styleElement.textContent = "svg, svg path { stroke: "+$that.css('color')+"; fill: none; }"; 
3365				svgDoc.getElementById("Layer_1").appendChild(styleElement);
3366
3367			}
3368
3369			$that.addClass('bound');
3370
3371		});	
3372	} else {
3373		$('.svg-icon-holder').addClass('animated-in').css('opacity','1');
3374	}
3375	
3376	//full vc row support
3377	$('#nectar_fullscreen_rows .svg-icon-holder.animated-in').each(function(i){
3378		
3379		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;
3380		var $that = $(this);
3381
3382		var $iconID = $that.attr('id').replace(/[^0-9]/g,'');
3383
3384		clearTimeout($animatedSVGIconTimeout[i]);
3385
3386		if($that.attr('data-animation') == 'false') { 
3387			$animationSpeed = 1;
3388			$that.css('opacity','1');
3389			$svg_icons[$iconID].finish();
3390		} else {
3391			if($(this).parents('.active').length > 0 || $(this).parents('#footer-outer').length > 0 || $('body.mobile').length > 0) {
3392				$svg_icons[$iconID].reset();
3393				$animatedSVGIconTimeout[i] = setTimeout(function(){ $svg_icons[$iconID].play(); },$animationDelay);
3394			}
3395
3396			else {
3397				$svg_icons[$iconID].reset().stop();
3398			}
3399		}
3400	});
3401}
3402//svg in equal height column resize
3403if($('.vc_row-o-equal-height .svg-icon-holder[data-animation="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) {
3404	 $(window).on('smartresize', function(){
3405	    clearTimeout($svgResizeTimeout);
3406	    $svgResizeTimeout = setTimeout(function(){ 
3407
3408	    	if($svg_icons.length > 0) {
3409	        	$('.svg-icon-holder.animated-in').each(function(i){
3410					$(this).css('opacity','1');
3411					var $iconID = $(this).attr('id').replace(/[^0-9]/g,'');
3412					$svg_icons[$iconID].finish();
3413				});
3414	        }
3415
3416	     },300);
3417	});
3418}
3419
3420//if($('.nectar-box-roll').length == 0 || $('body.mobile').length > 0) setTimeout(svgAnimations,100);
3421
3422/***************** fancy ul ******************/
3423
3424	function nectar_fancy_ul_init() {
3425		$($fullscreenSelector+'.nectar-fancy-ul').each(function(){
3426
3427
3428			var $icon = $(this).attr('data-list-icon');
3429			var $color = $(this).attr('data-color');
3430			var $animation = $(this).attr('data-animation');
3431			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;
3432			
3433			$(this).find('li').each(function(){
3434				
3435				if($(this).find('> i').length == 0) 
3436					$(this).prepend('<i class="icon-default-style '+$icon+ ' ' + $color +'"></i> ');
3437			});
3438
3439			
3440			if($animation == 'true') {
3441
3442
3443				var $that = $(this);
3444				var waypoint = new Waypoint({
3445		 			element: $that,
3446		 			 handler: function(direction) {
3447
3448		 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
3449						     waypoint.destroy();
3450						     return;
3451						}
3452
3453						setTimeout(function(){
3454			 			 	$that.find('li').each(function(i){
3455			 			 		var $that = $(this);
3456								$that.delay(i*220).transition({
3457									'opacity': '1',
3458									'left' : '0'
3459								},220,'easeOutCubic');
3460							});
3461			 			 },$animationDelay);
3462
3463						$that.addClass('animated-in');
3464						waypoint.destroy();
3465					},
3466					offset: 'bottom-in-view'
3467
3468				}); 
3469
3470			} 
3471			
3472			
3473			
3474		});
3475	}
3476	setTimeout(function(){ 
3477		//if($('.nectar-box-roll').length == 0) nectar_fancy_ul_init();
3478	},$animationOnScrollTimeOut); 
3479
3480	
3481
3482/***************** flip box min heights ******************/
3483//if content height exceeds min height change it
3484function flipBoxHeights() {
3485	$('.nectar-flip-box').each(function(){
3486		
3487		var $flipBoxMinHeight = parseInt($(this).attr('data-min-height'));
3488		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();
3489
3490		if($flipBoxHeight >= $flipBoxMinHeight - 80) {
3491			$(this).find('> div').css('height', $flipBoxHeight + 80);
3492		} else 
3493			$(this).find('> div').css('height','auto');
3494
3495	});
3496}
3497flipBoxHeights();
3498
3499if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
3500	$('body').on('click','.nectar-flip-box', function(){
3501		$(this).toggleClass('flipped');
3502	});
3503}
3504
3505/***************** PARALLAX SECTIONS ******************/
3506	
3507	// Create cross browser requestAnimationFrame method:
3508    window.requestAnimationFrame = window.requestAnimationFrame
3509     || window.mozRequestAnimationFrame
3510     || window.webkitRequestAnimationFrame
3511     || window.msRequestAnimationFrame
3512     || function(f){setTimeout(f, 1000/60)}
3513
3514
3515	var $window = $(window);
3516	var windowHeight = $window.height();
3517	
3518	$window.unbind('scroll.parallaxSections').unbind('resize.parallaxSections');
3519	$window.unbind('resize.parallaxSectionsUpdateHeight');
3520	$window.unbind('load.parallaxSectionsOffsetL');
3521	$window.unbind('resize.parallaxSectionsOffsetR');
3522
3523	$window.on('resize.parallaxSectionsUpdateHeight',psUpdateWindowHeight);
3524
3525	function psUpdateWindowHeight() {
3526		windowHeight = $window.height();
3527	}
3528
3529	function psUpdateOffset($this) {
3530		$this.each(function(){
3531	  	    firstTop = $this.offset().top;
3532		});
3533	}
3534	
3535	$.fn.parallaxScroll = function(xpos, speedFactor, outerHeight) {
3536		var $this = $(this);
3537		var getHeight;
3538		var firstTop;
3539		var paddingTop = 0;
3540		
3541		//get the starting position of each element to have parallax applied to it		
3542		$this.each(function(){
3543		    firstTop = $this.offset().top;
3544		});
3545		
3546		
3547		$window.on('resize.parallaxSectionsOffsetR',psUpdateOffset($this));
3548		$window.on('load.parallaxSectionsOffsetL',psUpdateOffset($this));
3549	
3550		getHeight = function(jqo) {
3551			return jqo.outerHeight(true);
3552		};
3553		 
3554			
3555		// setup defaults if arguments aren't specified
3556		if (arguments.length < 1 || xpos === null) xpos = "50%";
3557		if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1;
3558		if (arguments.length < 3 || outerHeight === null) outerHeight = true;
3559		
3560		// function to be called whenever the window is scrolled or resized
3561
3562		var $element, top, height, pos;
3563
3564		function update(){
3565
3566
3567			pos = $window.scrollTop();				
3568			
3569			$this.each(function(){
3570
3571				firstTop = $this.offset().top;
3572
3573				$element = $(this);
3574				top = $element.offset().top;
3575				height = getHeight($element);
3576
3577				// Check if totally above or totally below viewport
3578				if (top + height < pos || top > pos + windowHeight) {
3579					return;
3580				}
3581
3582				var ua = window.navigator.userAgent;
3583		        var msie = ua.indexOf("MSIE ");
3584
3585		        //for IE, Safari or any setup using the styled scrollbar default to animating the BG pos
3586		        if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true || navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
3587		        	$this.find('.row-bg.using-image').css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px");
3588		        }
3589		       	//for Firefox/Chrome use a higher performing method
3590		        else  {
3591		        	var $ifFast = ($this.find('.row-bg[data-parallax-speed="fast"]').length > 0) ? ($element.find('.row-bg').height() - height)/2.5 : 0;
3592		        	$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)' });
3593		        } 
3594
3595				
3596			});
3597		}		
3598
3599		if (window.addEventListener) {
3600			 window.addEventListener('scroll', function(){ 
3601	          requestAnimationFrame(update); 
3602	        }, false);
3603		}
3604
3605		$window.on('resize.parallaxSections',update);
3606
3607		update();
3608	};
3609
3610
3611
3612	
3613/***************** Full Width Section ******************/
3614
3615	//nectar slider in container but fullwidth fix
3616	$('.wpb_row .vc_col-sm-12 .nectar-slider-wrap[data-full-width="true"]').each(function(){
3617		if($(this).parents('.wpb_row.full-width-section').length == 0 && $(this).parents('.wpb_row.full-width-content').length == 0) {
3618			$(this).parents('.wpb_row').addClass('full-width-section');
3619		}
3620	});
3621
3622	function fullWidthSections(){
3623		
3624		var $windowInnerWidth = window.innerWidth;
3625		var $scrollBar = ($('#ascrail2000').length > 0 && $windowInnerWidth > 1000) ? -13 : 0;
3626		var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? parseInt($('.body-border-right').width())*2 : 0;
3627
3628		if($('#boxed').length == 1){
3629			$justOutOfSight = ((parseInt($('.container-wrap').width()) - parseInt($('.main-content').width())) / 2) + 4;
3630		} else {
3631			
3632			//if the ext responsive mode is on - add the extra padding into the calcs
3633			var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && $windowInnerWidth >= 1000) ? 180 : 0;
3634			var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0;
3635			if($(window).width() - $leftHeaderSize - $bodyBorderWidth  <= parseInt($('.main-content').css('max-width'))) { 
3636				var $windowWidth = parseInt($('.main-content').css('max-width'));
3637
3638				//no need for the scrollbar calcs with ext responsive on desktop views
3639				if($extResponsivePadding == 180) $windowWidth = $windowWidth - $scrollBar;
3640
3641			} else { 
3642				var $windowWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth;
3643			}
3644
3645			
3646			$contentWidth = parseInt($('.main-content').css('max-width'));
3647
3648			//single post fullwidth
3649			if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 ) {
3650				$contentWidth = $('#post-area').width();
3651				$extResponsivePadding = 0;
3652			}
3653			
3654			$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
3655		}
3656		
3657		$('.full-width-section').each(function(){
3658			
3659			if(!$(this).parents('.span_9').length > 0 && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner' && $(this).parent().attr('id') != 'portfolio-extra' &&
3660			!$(this).hasClass('non-fw')){
3661
3662				$(this).css({
3663					'margin-left': - $justOutOfSight,
3664					'padding-left': $justOutOfSight,
3665					'padding-right': $justOutOfSight,
3666					'visibility': 'visible'
3667				});	
3668
3669			if($('#boxed').length > 0 && $('#nectar_fullscreen_rows').length > 0) $(this).css({ 'padding-left': 0, 'padding-right': 0 });
3670
3671			}  else if($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) {
3672				$(this).css({
3673					'margin-left': - $justOutOfSight,
3674					'padding-left': $justOutOfSight,
3675					'padding-right': $justOutOfSight,
3676					'visibility': 'visible'
3677				});	
3678			}
3679			
3680			else {
3681				$(this).css({
3682					'margin-left': 0,
3683					'padding-left': 0,
3684					'padding-right': 0,
3685					'visibility': 'visible'
3686				});	
3687			}
3688			
3689		});
3690	
3691		
3692	    //full width content sections
3693	    $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow','visible');
3694	    
3695	    $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .full-width-content').each(function(){
3696			
3697			var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0;
3698			var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? parseInt($('.body-border-right').width())*2 : 0;
3699
3700			//single post fullwidth
3701			if($('#boxed').length == 1){
3702
3703				var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
3704
3705				if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('#post-area').length > 0) {
3706					$contentWidth = $('#post-area').width();
3707					$extResponsivePadding = 0;
3708					$windowWidth = $(window).width() - $bodyBorderWidth;
3709					$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
3710				} else {
3711					if($(this).parents('.page-submenu').length > 0)
3712						$justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2);
3713					else 
3714						$justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4;
3715				}
3716			} else {
3717				if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('#post-area').length > 0) {
3718					$contentWidth = $('#post-area').width();
3719					$extResponsivePadding = 0;
3720					$windowWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth;
3721				} else {
3722
3723					var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').css('max-width')) : parseInt($(this).parents('.container').css('max-width'));
3724
3725					//when using gutter on portfolio don't add extra space for scroll bar
3726			    	if($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') {
3727			    		$scrollBar = ($('#ascrail2000').length > 0 && $windowInnerWidth > 1000) ? -13 : 0;
3728			    	}
3729
3730					if($(window).width() - $leftHeaderSize - $bodyBorderWidth <= $mainContentMaxWidth) { 
3731						$windowWidth = $mainContentMaxWidth;
3732						//no need for the scrollbar calcs with ext responsive on desktop views
3733						if($extResponsivePadding == 180) $windowWidth = $windowWidth - $scrollBar;
3734					}
3735					$contentWidth = $mainContentMaxWidth;
3736					$extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1000) ? 180 : 0;
3737					if($leftHeaderSize > 0) $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1000) ? 120 : 0;
3738				}
3739
3740				$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
3741			}
3742
3743			$extraSpace = 0;
3744			if( $(this).hasClass('carousel-wrap')) $extraSpace = 1;
3745			if( $(this).hasClass('portfolio-items')) $extraSpace = 5;
3746			
3747	    	$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width() - $leftHeaderSize - $bodyBorderWidth +$extraSpace  + $scrollBar ;
3748
3749	    	//when using gutter on portfolio don't add extra space
3750	    	if($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') {
3751	    		if($(window).width() > 1000)
3752	    			$carouselWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth + $scrollBar + 3
3753	    		else 
3754	    			$carouselWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth + $scrollBar 
3755	    	}
3756
3757	    	if($(this).parent().hasClass('default-style')) { 
3758
3759	    		var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
3760	    		
3761	    		if($('#boxed').length != 0) {
3762	    			$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width() - $leftHeaderSize + $extraSpace + $scrollBar ;
3763				}
3764				else {
3765					$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : ($(window).width() - $leftHeaderSize - $bodyBorderWidth) - (($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.025) + $extraSpace + $scrollBar ;
3766					$windowWidth = ($(window).width() - $leftHeaderSize - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($(window).width() - $leftHeaderSize - $bodyBorderWidth) - (($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.025);
3767					$justOutOfSight = Math.ceil( (($windowWidth + $scrollBar - $mainContentWidth) / 2) )
3768				}
3769			}
3770
3771			else if($(this).parent().hasClass('spaced')) { 
3772
3773				var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
3774
3775				if($('#boxed').length != 0) {
3776	    			$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) - ($(window).width()*.02) : $(window).width() + $extraSpace + $scrollBar ;
3777				} else {
3778					$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : ($(window).width()- $leftHeaderSize - $bodyBorderWidth)  - Math.
3778ceil(($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.02) + $extraSpace + $scrollBar ;
3779					var $windowWidth2 = ($(window).width() - $leftHeaderSize - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($(window).width() - $leftHeaderSize - $bodyBorderWidth) - (($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.02);
3780					$justOutOfSight = Math.ceil( (($windowWidth2 + $scrollBar - $mainContentWidth) / 2) +2)
3781				}
3782			}
3783	    	
3784	    	if(!$(this).parents('.span_9').length > 0 && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner' && $(this).parent().attr('id') != 'portfolio-extra' 
3785	        && !$(this).find('.carousel-wrap[data-full-width="true"]').length > 0
3786	    	&& !$(this).find('.portfolio-items:not(".carousel")[data-col-num="elastic"]').length > 0){
3787
3788	    		//escape if inside woocoommerce page and not using applicable layout
3789	    		if($('.single-product').length > 0 && $(this).parents('#tab-description').length > 0 && $(this).parents('.full-width-tabs').length == 0) {
3790	    			$(this).css({
3791						'visibility': 'visible'
3792					});	
3793	    		} else {
3794	    			if($(this).hasClass('portfolio-items')) {
3795	    				$(this).css({
3796							'transform': 'translateX(-'+ $justOutOfSight + 'px)',
3797							'margin-left': 0,
3798							'width': $carouselWidth,
3799							'visibility': 'visible'
3800						});	
3801	    			} else {
3802	    				$(this).css({
3803							'margin-left': - $justOutOfSight,
3804							'width': $carouselWidth,
3805							'visibility': 'visible'
3806						});	
3807	    			}
3808					
3809				}
3810			}  else if($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) {
3811				$(this).css({
3812					'margin-left': - $justOutOfSight,
3813					'width': $carouselWidth,
3814					'visibility': 'visible'
3815				});	
3816			}
3817			
3818			else {
3819				$(this).css({
3820					'margin-left': 0,
3821					'visibility': 'visible'
3822				});	
3823			}
3824	    	
3825	    });
3826
3827	}
3828	
3829	var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length ;
3830
3831	function parallaxSrollSpeed(speedString) {
3832
3833		var ua = window.navigator.userAgent;	
3834		var msie = ua.indexOf("MSIE ");
3835		var speed;
3836
3837		 //not as modern browsers
3838		 if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true || navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
3839			 switch(speedString) {
3840			   	  case 'slow':
3841			   	      speed = 0.2;
3842			   	      break;
3843			   	  case 'medium': 
3844			   	  	  speed = 0.4;
3845			   	      break;
3846			   	  case 'fast': 
3847			    	  speed = 0.6;
3848			   	       break;
3849			   }
3850		}
3851		 //chrome/ff
3852		 else {
3853		 	 switch(speedString) {
3854			   	  case 'slow':
3855			   	      speed = 0.6;
3856			   	      break;
3857			   	  case 'medium': 
3858			   	  	  speed = 0.4;
3859			   	      break;
3860			   	  case 'fast': 
3861			    	  speed = 0.25;
3862			   	       break;
3863			   }
3864		}
3865
3866		   return speed;
3867	}
3868
3869	function parallaxScrollInit(){
3870		 parallaxRowsBGCals();
3871		$('.full-width-section.parallax_section, .full-width-content.parallax_section').each(function(){
3872		   var $id = $(this).attr('id');	
3873		  
3874		    var ua = window.navigator.userAgent;	
3875		    var msie = ua.indexOf("MSIE ");
3876
3877			if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true || navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)  {
3878		   		if($(this).find('[data-parallax-speed="fixed"]').length == 0) $('#'+$id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) );
3879		   	} else if($(this).find('[data-parallax-speed="fixed"]').length == 0) {
3880		   		$('#'+$id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) );
3881		   	}
3882		});
3883	}
3884
3885	
3886	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
3887		parallaxScrollInit();
3888		$(window).load(parallaxRowsBGCals);
3889		setTimeout(parallaxRowsBGCals,100);
3890	}
3891
3892	function parallaxRowsBGCals(){
3893
3894		$('.full-width-section.parallax_section, .full-width-content.parallax_section').each(function(){
3895
3896			 var ua = window.navigator.userAgent;
3897		     var msie = ua.indexOf("MSIE ");
3898
3899			 if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true || navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
3900			 	$(this).find('.row-bg').css({'height': $(this).outerHeight(true)*2.8, 'margin-top': '-' + ($(this).outerHeight(true)*2.8)/2 + 'px' });
3901			 } else {
3902			 	$(this).find('.row-bg').css({'height': Math.ceil( $(window).height() * parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) ) + $(this).outerHeight(true)   });
3903			 }
3904			 
3905		});
3906	}
3907	
3908	//if fullwidth section is first or last, remove the margins so it fits flush against header/footer
3909	function fwsClasses() {
3910		
3911		$('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function(){
3912			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
3913				if($(this).parents('.wpb_row').index() == '0'){
3914					$(this).addClass('first-nectar-slider');
3915				} 
3916			}
3917		});
3918
3919		if($('#portfolio-extra').length == 0) {
3920			$contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length;
3921		} else {
3922			$contentElementsNum = $('.main-content > .row #portfolio-extra > *').length;
3923		}
3924
3925		$('.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(){
3926			
3927			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
3928				
3929				if($(this).parents('.wpb_row').length > 0){ 
3930				
3931					if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
3932					
3933					////first
3934					if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length != 0 || $(this).parents('.wpb_row').index() == '0' && $('.parallax_slider_outer').length != 0){
3935						//$(this).css('margin-top','-2.1em').addClass('first-section nder-page-header');
3936					} 
3937					else if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length == 0 && $('.page-header-no-bg').length == 0 
3938					         && $('.project-title').length == 0 && $(this).parents('.wpb_row').index() == '0' 
3939					         && $('.parallax_slider_outer').length == 0 && $('.project-title').length == 0 
3940					         && $('body[data-bg-header="true"]').length == 0) {
3941
3942					     if($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0) {
3943					     	$('.container-wrap').css('padding-top','0px');
3944					     } else {
3945					     	$(this).css('margin-top','-70px').addClass('first-section');
3946					     } 	
3947						
3948					} 
3949					
3950					//check if it's also last (i.e. the only fws)
3951					if($(this).parents('.wpb_row').index() == $contentElementsNum-1 && $('#respond').length == 0 ) { 
3952						if($(this).attr('id') != 'portfolio-filters-inline') {
3953							$('.container-wrap').css('padding-bottom','0px');
3954							$('#call-to-action .triangle').remove();
3955						}
3956					} 
3957				
3958				} else {
3959					
3960					if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
3961					
3962					if( $(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area' ) {
3963						
3964						////first
3965						if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' && $('.parallax_slider_outer').length != 0){
3966							//$(this).css('margin-top','-2.1em').addClass('first-section nder-page-header');
3967			
3968						} 
3969						else if($(this).index() == '0' && $('#page-header-bg').length == 0 && $(this).index() == '0' && $('.page-header-no-bg').length == 0 && 
3970						        $(this).index() == '0' && $('.parallax_slider_outer').length == 0 && !$(this).hasClass('blog_next_prev_buttons') ) {
3971						     
3972						      if($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0) { 
3973						          $('.container-wrap').css('padding-top','0px');
3974						      } else {
3975						      	  $(this).css('margin-top','-70px').addClass('first-section');
3976						      }   	
3977							
3978						} 
3979						
3980						//check if it's also last (i.e. the only fws)
3981						if($(this).index() == $contentElementsNum-1 && $('#respond').length == 0 ) { 
3982							$('.container-wrap').css('padding-bottom','0px');
3983							$('.bottom_controls').css('margin-top','0px');
3984							$('#call-to-action .triangle').remove();
3985						} 
3986					}
3987					
3988				}
3989			}
3990		});
3991
3992
3993		//add first class for rows for page header trans effect (zoom only as of now)
3994		$('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function(){
3995			
3996			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
3997				
3998				
3999				if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
4000					
4001				if($(this).index() == '0' && $('#page-header-bg').length == 0 && $('.page-header-no-bg').length == 0 
4002				         && $('.project-title').length == 0 && $('body.single').length == 0 
4003				         && $('.parallax_slider_outer').length == 0 && $('.project-title').length == 0 ) {
4004
4005					$(this).addClass('first-section');
4006					var $that = $(this);
4007					setTimeout( function() { $that.addClass('loaded'); },50);
4008					
4009				} 
4010					
4011	
4012			}
4013		});	
4014
4015
4016		
4017		$('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function(){
4018			//check if it's last 
4019			if($(this).index() == $contentElementsNum-1 && $('#commentform').length == 0 && $('#pagination').length == 0) { 
4020				if(parseInt($('.container-wrap').css('padding-bottom')) > 0) $(this).css('margin-bottom','-40px');
4021				$('#call-to-action .triangle').remove();
4022			}
4023		});
4024		
4025		
4026		
4027		$('.portfolio-filters').each(function(){
4028			////first
4029			if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' && $('.parallax_slider_outer').length != 0){
4030				$(this).css({'margin-top':'-2.1em'}).addClass('first-section nder-page-header');
4031			}  else if($(this).index() == '0' && $('#page-header-bg').length == 0 || $(this).index() == '0' && $('.parallax_slider_outer').length == 0){
4032				$(this).css({'margin-top':'0px'}).addClass('first-section');
4033			}
4034		});
4035		
4036		$('.portfolio-filters-inline').each(function(){
4037			////first
4038			if($(this).parents('.wpb_row').length > 0){ 
4039				
4040				if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length != 0 || $(this).parents('.wpb_row').index() == '0' && $('.parallax_slider_outer').length != 0){
4041					if($('body[data-header-resize="0"]').length == 0) $(this).css({'margin-top':'-2.1em', 'padding-top' : '19px'}).addClass('first-section nder-page-header');
4042				}  else if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length == 0 || $(this).parents('.wpb_row').index() == '0' && $('.parallax_slider_outer').length == 0){
4043					
4044					 if($('body[data-header-resize="0"]').length == 1) { 
4045				          // $(this).css({'margin-top':'-30px', 'padding-top' : '50px'}).addClass('first-section');
4046				      } else {
4047				      	  $(this).css({'margin-top':'-70px', 'padding-top' : '50px'}).addClass('first-section');
4048				      } 
4049
4050				}
4051				
4052			} else {
4053				if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' && $('.parallax_slider_outer').length != 0){
4054					$(this).css({'margin-top':'-2.1em', 'padding-top' : '19px'}).addClass('first-section nder-page-header');
4055				}  else if($(this).index() == '0' && $('#page-header-bg').length == 0 || $(this).index() == '0' && $('.parallax_slider_outer').length == 0){
4056					
4057					if($('body[data-header-resize="0"]').length == 1) { 
4058				          $(this).css({'margin-top':'-30px', 'padding-top' : '50px'}).addClass('first-section');
4059				      } else {
4060				      	  $(this).css({'margin-top':'-70px', 'padding-top' : '50px'}).addClass('first-section');
4061				      } 
4062
4063				
4064				}
4065			}
4066			
4067		});
4068		
4069		
4070		
4071		$('.parallax_slider_outer').each(function(){
4072			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
4073				
4074				if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
4075				////first
4076				if($(this).parent().index() == '0' && $('#page-header-bg').length != 0){
4077					$(this).addClass('first-section nder-page-header');
4078
4079				} 
4080				else if($(this).parent().index() == '0' && $('#page-header-bg').length == 0){
4081					$(this).css('margin-top','-40px').addClass('first-section');
4082					if(!$('body').hasClass('single-post')) $('.container-wrap').css('padding-top', '0px');
4083				} 
4084				
4085				//check if it's also last (i.e. the only fws)
4086				if($(this).parent().index() == $contentElementsNum-1 && $('#post-area').length == 0) {
4087					$('#call-to-action .triangle').remove();
4088					$('.container-wrap').hide();
4089				}
4090			}
4091		});
4092	}
4093	
4094	//if not using a fullwidth slider first, ajdust the top padding
4095	//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');
4096	//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');
4097	
4098	
4099	//set sizes
4100	fullWidthSections();
4101	fwsClasses();
4102	
4103	//sizing for fullwidth sections that are image only
4104
4105	function fullwidthImgOnlySizingInit(){
4106		////set inital sizes
4107		$('.full-width-section:not(.custom-skip)').each(function(){
4108			
4109			var $fwsHeight = $(this).outerHeight(true);
4110
4111			//make sure it's empty and also not being used as a small dvider
4112			if($(this).find('.span_12 *').length == 0 && $.trim( $(this).find('.span_12').text() ).length == 0  && $fwsHeight > 40){
4113				$(this).addClass('bg-only');
4114				$(this).css({'height': $fwsHeight, 'padding-top': '0px', 'padding-bottom': '0px'});
4115				$(this).attr('data-image-height',$fwsHeight);
4116			}
4117
4118		});
4119	}
4120
4121	function fullwidthImgOnlySizing(){
4122
4123		$('.full-width-section.bg-only').each(function(){
4124			var $initialHeight = $(this).attr('data-image-height');
4125			
4126			if( window.innerWidth < 1000 && window.innerWidth > 690 ) {
4127				$(this).css('height', $initialHeight - $initialHeight*.60);
4128			} 
4129			
4130			else if( window.innerWidth <= 690 ) {
4131				$(this).css('height', $initialHeight - $initialHeight*.78);
4132			} 
4133			
4134			else if( window.innerWidth < 1300 && window.innerWidth >= 1000  ) {
4135				$(this).css('height', $initialHeight - $initialHeight*.33);
4136			} 
4137			
4138			else {
4139				$(this).css('height', $initialHeight);
4140			}
4141			
4142		});
4143		
4144	}
4145
4146	fullwidthImgOnlySizingInit();
4147	fullwidthImgOnlySizing();
4148	
4149	
4150	
4151	//change % padding on rows to be relative to screen
4152	function fullWidthRowPaddingAdjustInit(){
4153		if($('#boxed').length == 0){
4154			$('.full-width-section, .full-width-content').each(function(){
4155				var $topPadding = $(this)[0].style.paddingTop;
4156				var $bottomPadding = $(this)[0].style.paddingBottom;
4157
4158				if($topPadding.indexOf("%") >= 0) $(this).attr('data-top-percent',$topPadding);
4159				if($bottomPadding.indexOf("%") >= 0) $(this).attr('data-bottom-percent',$bottomPadding);
4160				
4161
4162			});
4163		}
4164	}
4165
4166	function fullWidthRowPaddingAdjustCalc(){
4167		if($('#boxed').length == 0){
4168			$('.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(){
4169
4170				var $windowHeight = $(window).width();
4171				var $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip';
4172				var $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip';
4173
4174				//top
4175				if($topPadding != 'skip') {
4176					$(this).css('padding-top',$windowHeight*(parseInt($topPadding)/100));
4177				}
4178
4179				//bottom
4180				if($bottomPadding != 'skip'){
4181					$(this).css('padding-bottom',$windowHeight*(parseInt($bottomPadding)/100));
4182				}
4183				
4184
4185			});
4186		}
4187	}
4188	fullWidthRowPaddingAdjustInit();
4189	fullWidthRowPaddingAdjustCalc();
4190
4191	
4192	//full width content column sizing
4193	function fullWidthContentColumns(){
4194
4195		//standard carousel
4196   	  	$('.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(){
4197			
4198
4199			//only set the height if more than one column
4200			if($(this).find('> .span_12 > .col').length > 1){
4201				
4202				var tallestColumn = 0;
4203				var $columnInnerHeight = 0;
4204				
4205				$(this).find('> .span_12 > .col').each(function(){
4206
4207					$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
4208					
4209					var $padding = parseInt($(this).css('padding-top'));
4210					//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
4211					($(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height() + ($padding*2) > tallestColumn) ? tallestColumn = $(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height() + ($padding*2)  : tallestColumn = tallestColumn;
4212				});	
4213	    	 	
4214	    	 	$(this).find('> .span_12 > .col').each(function(){
4215
4216	    	 		$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
4217					
4218	    	 		//columns with content
4219		    	 	if($(this).find('> '+$column_inner_selector+' > .wpb_wrapper > *').length > 0){
4220		    	 		//added in 7.6 to fix equal height columns 
4221		    	 		if(!$(this).parent().parent().hasClass('vc_row-o-equal-height')) $(this).css('height',tallestColumn);
4222		    	 	} 
4223		    	 	//empty columns
4224		    	 	else {
4225		    	 		$(this).css('min-height',tallestColumn);
4226		    	 		if($(this).is('[data-animation*="reveal"]')) $(this).find('.column-inner').css('min-height',tallestColumn);
4227		    	 	}
4228	    	 	});
4229	         	
4230	         	//nested column height
4231	         	var $childRows = $(this).find('> .span_12 > .col .wpb_row').length;
4232	         	if(window.innerWidth > 1000) { 
4233	         		
4234	         		var $padding = parseInt($(this).find('> .span_12 > .col').css('padding-top'));
4235	         		
4236	         		//$(this).find('> .span_12 > .col .wpb_row .col').css('min-height',(tallestColumn-($padding*2))/$childRows + 'px'); 
4237	         	} else {
4238	         		$(this).find('> .span_12 > .col .wpb_row .col').css('min-height','0px'); 
4239	         	}
4240	         	
4241	         	
4242	         	//vertically center
4243	         	if($(this).hasClass('vertically-align-columns') && window.innerWidth > 1000 && !$(this).hasClass('vc_row-o-equal-height')){
4244	         		
4245	         		//parent columns
4246		         	$(this).find('> .span_12 > .col').each(function(){
4247
4248		         		$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
4249						
4250						$columnInnerHeight = $(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height();
4251						var $marginCalc = ($(this).height()/2)-($columnInnerHeight/2);
4252						if($marginCalc <= 0) $marginCalc = 0;
4253						
4254						$(this).find('> '+$column_inner_selector+' > .wpb_wrapper').css('margin-top',$marginCalc);
4255						$(this).find('> '+$column_inner_selector+' > .wpb_wrapper').css('margin-bottom',$marginCalc);
4256						
4257					});	
4258	
4259					
4260				}
4261			
4262			}
4263			
4264   	  	});
4265
4266		//requal height columns in container type with reveal columns
4267		$('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function(){
4268			if($(this).find('>.span_12>.wpb_column[data-animation*="reveal"]').length >0) {
4269				var tallestColumn = 0;
4270				var $columnInnerHeight = 0;
4271				
4272				$(this).find('> .span_12 > .col').each(function(){
4273					
4274					var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top'));
4275					($(this).find('> .column-inner-wrap > .column-inner').height() + ($padding*2) > tallestColumn) ? tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding*2)  : tallestColumn = tallestColumn;
4276				});	
4277	    	 	
4278	    	 	$(this).find('> .span_12 > .col').each(function(){
4279					
4280	    	 		//columns with content
4281		    	 	if($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0){
4282		    	 		$(this).find('> .column-inner-wrap').css('height',tallestColumn);
4283		    	 	} 
4284		    	 	//empty columns
4285		    	 	else {
4286		    	 		$(this).css('min-height',tallestColumn);
4287		    	 		if($(this).is('[data-animation*="reveal"]')) $(this).find('.column-inner').css('min-height',tallestColumn);
4288		    	 	}
4289	    	 	});
4290
4291			}	
4292		});
4293
4294		//using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug)
4295		$('.vc_row.vc_row-o-equal-height>.span_12>.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function(){
4296			$(this).css({ 'padding-top': $(this).css('padding-left'), 'padding-bottom': $(this).css('padding-left')});
4297		});
4298		
4299	}
4300	
4301	fullWidthContentColumns();
4302	if($('.owl-carousel').length > 0) owlCarouselInit();
4303
4304
4305var $mouseParallaxScenes = [];
4306function mouseParallaxInit(){
4307	$('.wpb_row:has(.nectar-parallax-scene)').each(function(i){
4308
4309		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').height();
4310
4311		if($(this).hasClass('first-section')) { 
4312			$('body #header-outer[data-transparent-header="true"] .ns-loading-cover').show();
4313
4314			if($('body #header-outer[data-transparent-header="true"]').length > 0) { 
4315				$(this).css('overflow','hidden');
4316				$(this).find('.nectar-slider-loading').css({
4317					'top': $headerNavSpace,
4318					'margin-top' : '-1px'
4319				});
4320				$(this).find('.nectar-slider-loading .loading-icon').css({
4321					'height' :  $('.first-section .nectar-parallax-scene').height() - $headerNavSpace + 'px',
4322					'opacity' : '1'
4323				});
4324			}
4325		}
4326
4327		var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength'));
4328
4329		$mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({
4330			scalarX: $strength,
4331	  		scalarY: $strength
4332		});
4333
4334		//wait until the images in the scene have loaded
4335		var images = $(this).find('.nectar-parallax-scene li');
4336		
4337		$.each(images, function(){
4338			if($(this).find('div').length > 0) {
4339			    var el = $(this).find('div'),
4340			    image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, '');
4341			    if(image && image !== '' && image !== 'none')
4342			        images = images.add($('<img>').attr('src', image));
4343			}
4344		});
4345
4346		var $that = $(this);
4347		images.imagesLoaded(function(){
4348
4349			$that.find('> .nectar-slider-loading, .full-page-inner > .nectar-slider-loading').fadeOut(800,'easeInOutExpo');
4350			if($that.hasClass('first-section')) { 
4351				$('body #header-outer[data-transparent-header="true"] .ns-loading-cover').fadeOut(800,'easeInOutExpo',function(){
4352    				$(this).remove();
4353    			});
4354			}
4355		});
4356
4357	});
4358}
4359mouseParallaxInit();
4360
4361
4362	
4363/***************** Checkmarks ******************/
4364
4365function ulChecks() {
4366	$('ul.checks li').prepend('<i class="icon-ok-sign"></i>');
4367}
4368ulChecks();
4369
4370/***************** Image with Animation / Col Animation *******************/
4371
4372
4373	
4374function colAndImgAnimations(){
4375
4376	$colAndImgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '88%';
4377	$colAndImgOffsetPos2 = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '70%';
4378
4379	$($fullscreenSelector+'img.img-with-animation').each(function() {
4380		
4381		var $that = $(this);
4382		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
4383		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
4384
4385		var waypoint = new Waypoint({
4386 			element: $that,
4387 			 handler: function(direction) {
4388			   
4389					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
4390						 waypoint.destroy();
4391						return;
4392					}
4393
4394					if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
4395				
4396						if($that.attr('data-animation') == 'fade-in-from-left'){
4397							$that.delay($that.attr('data-delay')).transition({
4398								'opacity' : 1,
4399								'x' : '0px'
4400							},$animationDuration, $animationEasing);
4401						} else if($that.attr('data-animation') == 'fade-in-from-right'){
4402							$that.delay($that.attr('data-delay')).transition({
4403								'opacity' : 1,
4404								'x' : '0px'
4405							},$animationDuration, $animationEasing);
4406						} else if($that.attr('data-animation') == 'fade-in-from-bottom'){
4407							$that.delay($that.attr('data-delay')).transition({
4408								'opacity' : 1,
4409								'y' : '0px'
4410							},$animationDuration, $animationEasing);
4411						} else if($that.attr('data-animation') == 'fade-in') {
4412							$that.delay($that.attr('data-delay')).transition({
4413								'opacity' : 1
4414							},$animationDuration, $animationEasing);	
4415						} else if($that.attr('data-animation') == 'grow-in') {
4416							setTimeout(function(){ 
4417								$that.transition({ scale: 1, 'opacity':1 },$animationDuration,$animationEasing);
4418							},$that.attr('data-delay'));
4419						}
4420						else if($that.attr('data-animation') == 'flip-in') {
4421							setTimeout(function(){ 
4422								$that.transition({  rotateY: 0, 'opacity':1 },$animationDuration, $animationEasing);
4423							},$that.attr('data-delay'));
4424						}
4425						else if($that.attr('data-animation') == 'flip-in-vertical') {
4426							setTimeout(function(){ 
4427								$that.transition({  rotateX: 0, 'opacity':1 },$animationDuration, $animationEasing);
4428							},$that.attr('data-delay'));
4429						}
4430
4431						$that.addClass('animated-in');
4432						
4433					}
4434
4435					waypoint.destroy();
4436
4437			  },
4438			  offset: $colAndImgOffsetPos
4439		});
4440
4441		
4442	
4443	});
4444
4445
4446	$($fullscreenSelector+'.nectar_cascading_images').each(function() {
4447		
4448		var $that = $(this);
4449		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
4450		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
4451		var $animationDelay = ($(this).is('[data-animation-timing]')) ? $(this).attr('data-animation-timing') : 175;
4452		$animationDelay = parseInt($animationDelay);
4453
4454		var waypoint = new Waypoint({
4455 			element: $that,
4456 			 handler: function(direction) {
4457			   
4458					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
4459						 waypoint.destroy();
4460						return;
4461					}
4462
4463					if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
4464					
4465						$that.find('.cascading-image').each(function(i){
4466
4467							var $that2 = $(this);
4468
4469							if($that2.attr('data-animation') == 'flip-in' || $that2.attr('data-animation') == 'flip-in-vertical') {
4470								setTimeout(function(){
4471									$that2.find('.inner-wrap').css({
4472										'opacity' : 1,
4473										'transform' : 'rotate(0deg) translateZ(0px)'
4474									});
4475								}, i* $animationDelay);
4476							} else {
4477								setTimeout(function(){
4478									$that2.find('.inner-wrap').css({
4479										'opacity' : 1,
4480										'transform' : 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)'
4481									});
4482								}, i* $animationDelay);
4483							}
4484					
4485
4486						});
4487
4488						$that.addClass('animated-in');
4489						
4490					}
4491
4492					waypoint.destroy();
4493
4494			  },
4495			  offset: $colAndImgOffsetPos
4496		});
4497
4498		
4499	
4500	});
4501	
4502
4503	
4504	$($fullscreenSelector+'.col.has-animation:not([data-animation*="reveal"]), '+$fullscreenSelector+'.wpb_column.has-animation:not([data-animation*="reveal"])').each(function(i) {
4505	    
4506		var $that = $(this);
4507		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
4508		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
4509
4510		//set perspective for vertical flip
4511		if($that.is('[data-animation="flip-in-vertical"]')) {
4512			$that.parents('.col.span_12').addClass('flip-in-vertical-wrap');
4513		}
4514
4515		var waypoint = new Waypoint({
4516 			element: $that,
4517 			 handler: function(direction) {
4518				
4519				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
4520					 waypoint.destroy();
4521					return;
4522				}
4523
4524				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
4525				 	
4526				 	
4527					if($that.attr('data-animation') == 'fade-in-from-left'){
4528						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4529							$that.transition({
4530								'opacity' : 1,
4531								'x' : '0px'
4532							},$animationDuration,$animationEasing);
4533						},$that.attr('data-delay'));
4534					} else if($that.attr('data-animation') == 'fade-in-from-right'){
4535						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4536							$that.transition({
4537								'opacity' : 1,
4538								'x' : '0px'
4539							},$animationDuration,$animationEasing);
4540						},$that.attr('data-delay'));
4541					} else if($that.attr('data-animation') == 'fade-in-from-bottom'){
4542						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4543							$that.transition({
4544								'opacity' : 1,
4545								'y' : '0px'
4546							},$animationDuration,$animationEasing);
4547						},$that.attr('data-delay'));
4548					} else if($that.attr('data-animation') == 'fade-in') {
4549						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4550							$that.transition({
4551								'opacity' : 1
4552							},$animationDuration,$animationEasing);	
4553						},$that.attr('data-delay'));
4554					} else if($that.attr('data-animation') == 'grow-in') {
4555						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4556							$that.transition({ scale: 1, 'opacity':1 },$animationDuration,$animationEasing);
4557						},$that.attr('data-delay'));
4558					} else if($that.attr('data-animation') == 'flip-in') {
4559						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4560							$that.transition({  rotateY: 0, 'opacity':1 },$animationDuration, $animationEasing);
4561						},$that.attr('data-delay'));
4562					} else if($that.attr('data-animation') == 'flip-in-vertical') {
4563						$standAnimatedColTimeout[i] = setTimeout(function(){ 
4564							$that.transition({  rotateX: 0, y: 0, 'opacity':1 },$animationDuration, $animationEasing);
4565						},$that.attr('data-delay'));
4566					}
4567
4568					//boxed column hover fix
4569					if($that.hasClass('boxed')) {
4570						$that.addClass('no-pointer-events');
4571						setTimeout(function(){
4572							$that.removeClass('no-pointer-events');
4573						},parseInt($animationDuration) + parseInt($that.attr('data-delay')) + 30 );
4574					}
4575
4576					$that.addClass('animated-in');
4577				
4578				}
4579
4580				waypoint.destroy();
4581			},
4582			offset: $colAndImgOffsetPos
4583		});
4584	
4585	});
4586
4587	
4588	$($fullscreenSelector+'.wpb_column.has-animation[data-animation*="reveal"]').each(function() {
4589	    
4590		var $that = $(this);
4591		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
4592		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
4593
4594		var waypoint = new Waypoint({
4595 			element: $that,
4596 			 handler: function(direction) {
4597				
4598				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
4599					 waypoint.destroy();
4600					return;
4601				}
4602
4603				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
4604					
4605					if($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') {
4606						setTimeout(function(){ 
4607							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'); });
4608						},$that.attr('data-delay'));
4609					} else if($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') {
4610						setTimeout(function(){ 
4611							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'); });
4612						},$that.attr('data-delay'));
4613					} 
4614
4615					$that.addClass('animated-in');
4616				
4617				}
4618
4619				waypoint.destroy();
4620			},
4621			offset: $colAndImgOffsetPos2
4622		});
4623	
4624	}); 	
4625
4626	
4627}
4628
4629setTimeout(function(){ 
4630	//if($('.nectar-box-roll').length == 0) colAndImgAnimations();
4631},$animationOnScrollTimeOut); 	
4632
4633
4634function cascadingImageBGSizing() {
4635	$('.nectar_cascading_images').each(function(){
4636
4637		//handle max width for cascading images in equal height columns
4638		if($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) 
4639			$(this).css('max-width',$(this).parents('.wpb_column').width());
4640
4641		//set size for layers with no images
4642		$(this).find('.bg-color').each(function(){
4643			var $bgColorHeight = 0;
4644			var $bgColorWidth = 0;
4645			if($(this).parent().find('.img-wrap').length == 0) {
4646				$firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first();
4647
4648				$firstSibling.css({'position':'relative', 'visiblity':'hidden'});
4649				$bgColorHeight = $firstSibling.find('.img-wrap').height();
4650				$bgColorWidth = $firstSibling.find('.img-wrap').width();
4651				if($firstSibling.index() == 0) {
4652					$firstSibling.css({'visiblity':'visible'});
4653				} else {
4654					$firstSibling.css({'position':'absolute', 'visiblity':'visible'});
4655				}
4656			} else {
4657				$bgColorHeight = $(this).parent().find('.img-wrap').height();
4658				$bgColorWidth = $(this).parent().find('.img-wrap').width();
4659			}
4660
4661			$(this).css({'height': $bgColorHeight,'width': $bgColorWidth});
4662		});
4663	});
4664}
4665imagesLoaded($('.nectar_cascading_images'),function(instance){
4666	cascadingImageBGSizing();
4667});
4668
4669function splitLineHeadings() {
4670
4671	$splitLineOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
4672	$($fullscreenSelector+'.nectar-split-heading').each(function() {
4673
4674		var $that = $(this);
4675		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
4676		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
4677
4678		var waypoint = new Waypoint({
4679				element: $that,
4680				 handler: function(direction) {
4681				
4682				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
4683					 waypoint.destroy();
4684					return;
4685				}
4686
4687				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
4688				 	
4689					
4690					$that.find('.heading-line').each(function(i){
4691						//if($that.parents('.first-section').length > 0 && $('body[data-aie="zoom-out"]').length > 0) i = i+4;
4692						$(this).find('> div').delay(i*70).transition({
4693							'y' : '0px'
4694						},$animationDuration,$animationEasing);
4695
4696					});
4697					
4698
4699					$that.addClass('animated-in');
4700				
4701				}
4702
4703				waypoint.destroy();
4704			},
4705			offset: $splitLineOffsetPos
4706		});
4707
4708	});
4709}
4710
4711	
4712/***************** 4 Col Grid in iPad ******************/
4713	
4714	//add one-fourth class
4715	function oneFourthClasses() {
4716		$('.col.span_3, .vc_span3, .vc_col-sm-3').each(function(){
4717			var $currentDiv = $(this);
4718			var $nextDiv = $(this).next('div');
4719			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') ) {
4720				$currentDiv.addClass('one-fourths clear-both');
4721				$nextDiv.addClass('one-fourths right-edge');
4722			}
4723		});
4724		
4725		/*$('.vc_span4').each(function(){
4726			if($(this).find('.team-member').length > 0 && $(this).parents('.full-width-content').length > 0) {
4727				var $currentDiv = $(this);
4728				var $nextDiv = $(this).next('div');
4729				if( !$currentDiv.hasClass('one-fourths')) {
4730					$currentDiv.addClass('one-fourths clear-both');
4731					$nextDiv.addClass('one-fourths right-edge');
4732				}
4733			}
4734		});*/
4735		
4736		//make empty second 1/2 half columsn display right on iPad
4737		$('.span_12 .col.span_6').each(function(){
4738			if($(this).next('div').hasClass('span_6') && $.trim( $(this).next('div').html() ).length == 0 ) {
4739				$(this).addClass('empty-second')
4740			}
4741		}); 
4742	}
4743	oneFourthClasses();
4744	
4745/***************** Bar Graph ******************/
4746function progressBars(){
4747	$progressBarsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
4748	$($fullscreenSelector+'.nectar-progress-bar').parent().each(function(i){
4749
4750		var $that = $(this);
4751		var waypoint = new Waypoint({
4752 			element: $that,
4753 			 handler: function(direction) {
4754			   
4755					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4756						 waypoint.destroy();
4757						return;
4758					}
4759
4760					if($progressBarsOffsetPos == '100%') $that.find('.nectar-progress-bar .bar-wrap').css('opacity','1');
4761
4762					$that.find('.nectar-progress-bar').each(function(i){
4763
4764
4765						var percent = $(this).find('span').attr('data-width');
4766						var $endNum = parseInt($(this).find('span strong i').text());
4767						var $that = $(this);
4768						
4769						$that.find('span').delay(i*90).transition({
4770							'width' : percent + '%'
4771						},1050, 'easeInOutQuint',function(){
4772						});
4773						
4774	
4775					
4776						setTimeout(function(){
4777
4778							var countOptions = { useEasing : false };
4779							var $countEle = $that.find('span strong i')[0];
4780							var numAnim = new CountUp($countEle, 0, $endNum,0,1,countOptions);
4781							numAnim.start();
4782
4783							$that.find('span strong').transition({
4784								'opacity' : 1
4785							},550, 'easeInCirc');
4786						}, (i*90) );
4787					
4788						////100% progress bar 
4789						if(percent == '100'){
4790							$that.find('span strong').addClass('full');
4791						}
4792					});
4793
4794					$that.addClass('completed');
4795
4796					waypoint.destroy();
4797
4798			  },
4799			  offset: $progressBarsOffsetPos
4800		});
4801
4802	});
4803}
4804
4805
4806/***************** Column Borders ******************/
4807function animatedColBorders(){
4808	$progressBarsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : '75%';
4809	$($fullscreenSelector+'.wpb_column[data-border-animation="true"]').each(function(i){
4810
4811		var $that = $(this);
4812		var waypoint = new Waypoint({
4813 			element: $that,
4814 			 handler: function(direction) {
4815			   
4816					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4817						 waypoint.destroy();
4818						return;
4819					}
4820
4821					$borderDelay = ($that.attr('data-border-animation-delay').length > 0) ? parseInt($that.attr('data-border-animation-delay')) : 0;
4822					setTimeout(function(){
4823						$that.find('.border-wrap').addClass('animation');
4824						$that.find('.border-wrap').addClass('completed');
4825					},$borderDelay)
4826					
4827
4828					waypoint.destroy();
4829
4830			  },
4831			  offset: $progressBarsOffsetPos
4832		});
4833
4834	});
4835}
4836
4837/***************** Food Menu Item ******************/
4838function foodMenuItems() {
4839	$foodItemOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : '80%';
4840	$($fullscreenSelector+'.nectar_food_menu_item').parent().each(function(i){
4841
4842		var $that = $(this);
4843		var waypoint = new Waypoint({
4844 			element: $that,
4845 			 handler: function(direction) {
4846			   
4847					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4848						 waypoint.destroy();
4849						return;
4850					}
4851
4852					$that.find('.nectar_food_menu_item').each(function(i){
4853
4854						var $that = $(this);
4855
4856						setTimeout(function(){
4857							$that.addClass('animated-in');
4858						},i*150);
4859						
4860					});
4861					
4862					waypoint.destroy();
4863
4864			  },
4865			  offset: $foodItemOffsetPos
4866		});
4867
4868	});
4869}
4870
4871
4872/***************** Dividers ******************/
4873function dividers() {
4874	$dividerOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
4875
4876	$($fullscreenSelector+'.divider-small-border[data-animate="yes"], '+$fullscreenSelector+'.divider-border[data-animate="yes"]').each(function(i){
4877
4878		var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500;
4879		var $that = $(this);
4880		var waypoint = new Waypoint({
4881 			element: $that,
4882 			 handler: function(direction) {
4883			   
4884					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4885						 waypoint.destroy();
4886						return;
4887					}
4888				
4889					$that.each(function(i){
4890
4891						$(this).css({'transform':'scale(0,1)', 'visibility': 'visible'});
4892						var $that = $(this);
4893						
4894						$that.delay($that.attr('data-animation-delay')).transition({
4895							'transform' : 'scale(1, 1)'
4896						},$lineDur, 'cubic-bezier(.18,1,.22,1)');
4897						
4898					});
4899
4900					$that.addClass('completed');
4901
4902					waypoint.destroy();
4903
4904			  },
4905			  offset: $dividerOffsetPos
4906		});
4907
4908	});
4909}
4910
4911//if($('.nectar-box-roll').length == 0) dividers();
4912
4913
4914/***************** Icon List ******************/
4915function iconList() {
4916	$iconListOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : '75%';
4917
4918	$($fullscreenSelector+'.nectar-icon-list[data-animate="true"]').each(function(i){
4919
4920		var $that = $(this);
4921		var waypoint = new Waypoint({
4922 			element: $that,
4923 			 handler: function(direction) {
4924			   
4925					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4926						 waypoint.destroy();
4927						return;
4928					}
4929				
4930					$that.each(function(i){
4931
4932						$(this).find('.nectar-icon-list-item').each(function(i){
4933							var $thatt = $(this);
4934							setTimeout(function(){ $thatt.addClass('animated') },i*300);
4935						});
4936						
4937					});
4938
4939					$that.addClass('completed');
4940
4941					waypoint.destroy();
4942
4943			  },
4944			  offset: $iconListOffsetPos
4945		});
4946
4947	});
4948}
4949
4950//bg color match 
4951var nectarIconBGCss = '';
4952
4953$('.nectar-icon-list[data-icon-style="border"], .nectar_icon_wrap[data-style="border-animation"][data-color*="extra-color-gradient-"]').each(function(i){
4954	if($(this).parents('.wpb_column[data-bg-color*="#"]').length > 0 && $(this).parents('.wpb_column[data-bg-opacity="1"]').length > 0) {
4955		var $bgColorToSet = $(this).parents('.wpb_column').attr('data-bg-color');
4956	}
4957	else if($(this).parents('.wpb_row').length > 0 && $(this).parents('.wpb_row').find('.row-bg.using-bg-color').length > 0) {
4958		var $bgColorToSet = $(this).parents('.wpb_row').find('.row-bg.using-bg-color').css('background-color');
4959	}
4960	else {
4961		if($('#nectar_fullscreen_rows').length > 0)
4962			var $bgColorToSet = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color');
4963		else 
4964			var $bgColorToSet = $('.container-wrap').css('background-color');
4965	}
4966
4967	if($(this).hasClass('nectar-icon-list')) 
4968		$(this).find('.list-icon-holder').css('background-color',$bgColorToSet);
4969	else {
4970		//must be set in css, can't manip pseudo
4971		$(this).addClass('instance-'+i);
4972		nectarIconBGCss += '.nectar_icon_wrap.instance-'+i+' .nectar_icon:before { background-color: '+$bgColorToSet+'!important; }';
4973		
4974	}
4975		
4976});
4977
4978if(nectarIconBGCss.length > 0) {
4979	var head = document.head || document.getElementsByTagName('head')[0];
4980	var style = document.createElement('style');
4981
4982	style.type = 'text/css';
4983	if (style.styleSheet){
4984	  style.styleSheet.cssText = nectarIconBGCss;
4985	} else {
4986	  style.appendChild(document.createTextNode(nectarIconBGCss));
4987	}
4988
4989	head.appendChild(style);
4990}
4991
4992/***************** Hotspot ******************/
4993//add pulse animation
4994$('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function(){
4995	$(this).find('.nectar_hotspot_wrap').each(function(i){
4996		var $that = $(this);
4997		setTimeout(function(){
4998			$that.find('.nectar_hotspot').addClass('pulse');
4999		},i*300);	
5000	});
5001});
5002
5003
5004
5005function hotSpotHoverBind() {
5006
5007	var hotSpotHoverTimeout = [];
5008
5009	$('.nectar_image_with_hotspots:not([data-tooltip-func="click"]) .nectar_hotspot').each(function(i){
5010		
5011		hotSpotHoverTimeout[i] = '';
5012
5013		$(this).on('mouseover', function(){
5014			clearTimeout(hotSpotHoverTimeout[i]);
5015			$(this).parent().css({'z-index':'400', 'height':'auto','width':'auto'});
5016		});
5017
5018		$(this).on('mouseleave', function(){
5019
5020			var $that = $(this);
5021			$that.parent().css({'z-index':'auto'});
5022
5023			hotSpotHoverTimeout[i] = setTimeout(function(){
5024				$that.parent().css({'height':'30px','width':'30px'});
5025			},300);
5026
5027		});
5028
5029	});
5030
5031}
5032
5033hotSpotHoverBind();
5034
5035function responsiveTooltips() {
5036
5037	$('.nectar_image_with_hotspots').each(function(){
5038		$(this).find('.nectar_hotspot_wrap').each(function(i){
5039			
5040			if($(window).width() > 690) {
5041
5042				//remove click if applicable
5043				if($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) {
5044					$(this).find('.nectar_hotspot').removeClass('click');
5045					$(this).find('.nttip').removeClass('open');
5046				}
5047				$(this).find('.nttip .inner a.tipclose').remove();
5048				$('.nttip').css('height','auto');
5049
5050				//reset for positioning
5051				$(this).css({'width': 'auto','height': 'auto'});
5052				$(this).find('.nttip').removeClass('force-right').removeClass('force-left').removeClass('force-top').css('width','auto');
5053
5054				var $tipOffset = $(this).find('.nttip').offset();
5055
5056				//against right side fix
5057				if($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200)
5058					$(this).find('.nttip').css('width','250px');
5059				else 
5060					$(this).find('.nttip').css('width','auto');
5061
5062				//responsive
5063				if($tipOffset.left < 0)
5064					$(this).find('.nttip').addClass('force-right');
5065				else if($tipOffset.left + $(this).find('.nttip').outerWidth(true) > $(window).width())
5066					$(this).find('.nttip').addClass('force-left').css('width','250px');
5067				else if($tipOffset.top + $(this).find('.nttip').height() + 35 > $(window).height() && $('#nectar_fullscreen_rows').length > 0)
5068					$(this).find('.nttip').addClass('force-top');
5069
5070				if($(this).find('> .open').length == 0)
5071					$(this).css({'width': '30px','height': '30px'});
5072
5073			} else {
5074				//fixed position
5075				$(this).find('.nttip').removeClass('force-left').removeClass('force-right').removeClass('force-top');
5076				$(this).find('.nectar_hotspot').addClass('click');
5077			
5078				if($(this).find('.nttip a.tipclose').length == 0)
5079					$(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span></span></a>');
5080
5081				//change height of fixed
5082				$('.nttip').css('height',$(window).height());
5083			}
5084		});
5085	});
5086
5087
5088}
5089responsiveTooltips();
5090
5091function imageWithHotspotClickEvents() {
5092	//click
5093	$('body').on('click','.nectar_hotspot.click',function(){
5094		$(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
5095		$(this).parent().find('.nttip').addClass('open');
5096
5097		$(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open');
5098		$(this).parent().find('.nectar_hotspot').addClass('open');
5099
5100		if($(window).width() > 690) {
5101			$(this).parent().css({'z-index':'10', 'height':'auto','width':'auto'});
5102
5103			var $that = $(this);
5104
5105			setTimeout(function(){
5106				$that.parents('.nectar_image_with_hotspots').find('.nectar_hotspot_wrap').each(function(){
5107					if($(this).find('> .open').length == 0)
5108						$(this).css({'height':'30px','width':'30px', 'z-index':'auto'});
5109				});
5110			},300);
5111		}
5112
5113		if($(window).width() <= 690) $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index','200');
5114
5115		return false;
5116	});
5117
5118	$('body').on('click','.nectar_hotspot.open',function(){
5119		$(this).parent().find('.nttip').removeClass('open');
5120		$(this).parent().find('.nectar_hotspot').removeClass('open');
5121
5122		$(this).parents('.wpb_row').css('z-index','auto');
5123
5124		return false;
5125	});
5126
5127	$('body').on('click','.nttip.open',function(){
5128		$(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
5129
5130		$(this).parents('.wpb_row').css('z-index','auto');
5131		return false;
5132	});
5133}
5134imageWithHotspotClickEvents();
5135
5136function imageWithHotspots() {
5137
5138	$imageWithHotspotsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : '50%';
5139
5140	$($fullscreenSelector+'.nectar_image_with_hotspots[data-animation="true"]').each(function(i){
5141
5142		var $that = $(this);
5143		var waypoint = new Waypoint({
5144 			element: $that,
5145 			 handler: function(direction) {
5146			   
5147					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5148						 waypoint.destroy();
5149						return;
5150					}
5151
5152					$that.addClass('completed');
5153					$that.find('.nectar_hotspot_wrap').each(function(i){
5154						var $that2 = $(this);
5155						var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0;
5156						setTimeout(function(){
5157							$that2.addClass('animated-in');
5158						},175*(i+$extrai));
5159					});
5160
5161					waypoint.destroy();
5162
5163			  },
5164			  offset: $imageWithHotspotsOffsetPos
5165		});
5166
5167	});
5168}
5169
5170
5171/***************** Animated Title ******************/
5172function animated_titles() {
5173	$animatedTitlesOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
5174
5175	$($fullscreenSelector+'.nectar-animated-title').each(function(i){
5176
5177		var $that = $(this);
5178		var waypoint = new Waypoint({
5179 			element: $that,
5180 			 handler: function(direction) {
5181			   
5182					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5183						 waypoint.destroy();
5184						return;
5185					}
5186
5187					$that.addClass('completed');
5188
5189					waypoint.destroy();
5190
5191			  },
5192			  offset: $animatedTitlesOffsetPos
5193		});
5194
5195	});
5196}
5197
5198//if($('.nectar-box-roll').length == 0) animated_titles();
5199
5200
5201/***************** Pricing Tables ******************/
5202
5203
5204var $tallestCol;
5205
5206function pricingTableHeight(){
5207	$('.pricing-table[data-style="default"]').each(function(){
5208		$tallestCol = 0;
5209		
5210		$(this).find('> div ul').each(function(){
5211			($(this).height() > $tallestCol) ? $tallestCol = $(this).height() : $tallestCol = $tallestCol;
5212		});	
5213		
5214		//safety net incase pricing tables height couldn't be determined
5215		if($tallestCol == 0) $tallestCol = 'auto';
5216		
5217		//set even height
5218		$(this).find('> div ul').css('height',$tallestCol);
5219
5220	});
5221}
5222
5223pricingTableHeight();
5224
5225 
5226/***************** Testimonial Slider ******************/
5227
5228//testimonial slider controls
5229
5230//non minimal
5231$('body').on('click','.testimonial_slider:not([data-style*="multiple_visible"]):not([data-style="minimal"]) .controls li', function(){
5232	
5233	if($(this).find('span').hasClass('active')) return false;
5234	
5235	var $index = $(this).index();
5236	var currentHeight = $(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).height();
5237	
5238	$(this).parents('.testimonial_slider').find('li span').removeClass('active');
5239	$(this).find('span').addClass('active');
5240	
5241	$(this).parents('.testimonial_slider').find('.slides blockquote').addClass('no-trans');
5242	$(this).parents('.testimonial_slider').find('.slides blockquote').css({'opacity':'0', 'transform': 'translateX(-25px)', 'z-index': '1'});
5243	$(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).removeClass('no-trans').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
5244	$(this).parents('.testimonial_slider:not(.disable-height-animation)').find('.slides').stop(true,true).animate({'height' : currentHeight + 40 + 'px' },450,'easeOutCubic');
5245	
5246	resizeVideoToCover();
5247});
5248
5249//minimal
5250$('body').on('click','.testimonial_slider[data-style="minimal"] .testimonial-next-prev a', function(){
5251	
5252	var $index = $(this).parents('.testimonial_slider').find('.slides blockquote.active').index();
5253	var $actualIndex = $index;
5254
5255	$(this).parents('.testimonial_slider').find('.slides blockquote').addClass('no-trans');
5256	$(this).parents('.testimonial_slider').find('.slides blockquote').css({'opacity':'0', 'transform': 'translateX(-25px)', 'z-index': '1'});
5257
5258
5259	$(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).removeClass('active');
5260
5261	if($(this).hasClass('next')) {
5262		if($index+1 >= $(this).parents('.testimonial_slider').find('.slides blockquote').length) { 
5263			$actualIndex = 0; 
5264		} else {
5265			$actualIndex = $index+1; 
5266		}
5267		var currentHeight = $(this).parents('.testimonial_slider').find('.slides blockquote').eq($actualIndex).height();
5268		//show slide
5269		$(this).parents('.testimonial_slider').find('.slides blockquote').eq($actualIndex).addClass('active').removeClass('no-trans').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
5270		//change pag #
5271		$(this).parents('.testimonial_slider').find('.control-wrap ul').css({'transform':'translateX(-'+(20*$actualIndex)+'px)'});
5272	} else {
5273		if($index-1 == -1) { 
5274			$actualIndex = $(this).parents('.testimonial_slider').find('.slides blockquote').length-1; 
5275		} else {
5276			$actualIndex = $index-1; 
5277		}
5278		var currentHeight = $(this).parents('.testimonial_slider').find('.slides blockquote').eq($index-1).height();
5279		//show slide
5280		$(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');
5281		//change pag #
5282		$(this).parents('.testimonial_slider').find('.control-wrap ul').css({'transform':'translateX(-'+(20*$actualIndex)+'px)'});
5283	}
5284	
5285	
5286	$(this).parents('.testimonial_slider:not(.disable-height-animation)').find('.slides').stop(true,true).animate({'height' : currentHeight + 40 + 'px' },450,'easeOutCubic');
5287	
5288	resizeVideoToCover();
5289
5290	return false;
5291});
5292
5293
5294var $tallestQuote;
5295
5296//create controls
5297function createTestimonialControls() {
5298
5299	//fadeIn
5300	$('.testimonial_slider:not([data-style*="multiple_visible"])').animate({'opacity':'1'},800);
5301
5302	$('.testimonial_slider:not([data-style*="multiple_visible"])').each(function(i){
5303		
5304		if($(this).find('blockquote').length > 1 && $(this).find('.controls').length == 0) {
5305			$(this).append('<div class="controls"><ul></ul></div>');
5306			
5307			var slideNum = $(this).find('blockquote').length;
5308			var $that = $(this);
5309			
5310			for(var i=0;i<slideNum;i++) {
5311
5312				if( !$(this).is('[data-style="minimal"]') ) {
5313					$that.find('.controls ul').append('<li><span class="pagination-switch"></span></li>');
5314				} else {
5315					$that.find('.controls ul').append('<li>'+(i+1)+'</li>');
5316				}
5317			}
5318			
5319			//minimal
5320			if( $(this).is('[data-style="minimal"]') ) {
5321
5322				//add next/prev
5323				$(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>');
5324
5325				//start on first
5326				$(this).find('.slides blockquote:first-child').addClass('active').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
5327				if(	!$(this).hasClass('disable-height-animation') ) {
5328					$(this).find('.slides').css({'height' : $(this).find('.slides blockquote:first-child').height() + 40 + 'px' });
5329				}
5330
5331				//autorotate
5332				if($(this).attr('data-autorotate').length > 0) {
5333					slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
5334					var $that = $(this);
5335					var $rotate = setInterval(function(){ testimonialRotate($that) },slide_interval);
5336				}
5337				$(this).find('.testimonial-next-prev a').click(function(e){
5338					if(typeof e.clientX != 'undefined') clearInterval($rotate);
5339				});
5340
5341				//wrap bullets
5342				$(this).find('.controls ul').wrap('<div class="control-wrap" />');
5343				$(this).find('.controls ul').css('width', (($(this).find('.controls ul li').length * 20) +1) + 'px');
5344				$(this).find('.controls').append('<span class="out-of">/</span><span class="total">'+$(this).find('blockquote').length+'</span>');
5345
5346				////swipe for testimonials
5347				$(this).swipe({
5348				
5349					swipeLeft : function(e) {
5350						$(this).find('.testimonial-next-prev .next').trigger('click');
5351						e.stopImmediatePropagation();
5352						clearInterval($rotate);
5353						return false;
5354					 },
5355					 swipeRight : function(e) {
5356						$(this).find('.testimonial-next-prev .prev').trigger('click');
5357						e.stopImmediatePropagation();
5358						clearInterval($rotate);
5359						return false;
5360					 }    
5361				});
5362
5363
5364			}
5365
5366			//non minimal
5367			if( !$(this).is('[data-style="minimal"]') ) {
5368
5369				//activate first slide
5370				$(this).find('.controls ul li').first().click();
5371
5372				//autorotate
5373				if($(this).attr('data-autorotate').length > 0) {
5374					slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
5375					var $that = $(this);
5376					var $rotate = setInterval(function(){ testimonialRotate($that) },slide_interval);
5377				}
5378				
5379				$(this).find('.controls li').click(function(e){
5380					if(typeof e.clientX != 'undefined') clearInterval($rotate);
5381				});
5382				
5383				////swipe for testimonials
5384				$(this).swipe({
5385				
5386					swipeLeft : function(e) {
5387						$(this).find('.controls ul li span.active').parent().next('li').find('span').trigger('click');
5388						e.stopImmediatePropagation();
5389						clearInterval($rotate);
5390						return false;
5391					 },
5392					 swipeRight : function(e) {
5393						$(this).find('.controls ul li span.active').parent().prev('li').find('span').trigger('click');
5394						e.stopImmediatePropagation();
5395						clearInterval($rotate);
5396						return false;
5397					 }    
5398				});
5399
5400		}
5401		} 
5402		//only one testimonial
5403		else if($(this).find('.controls').length == 0) {
5404			var currentHeight = $(this).find('.slides blockquote').height();
5405			$(this).find('.slides blockquote').css({'opacity':'0', 'transform': 'translateX(-25px)', 'z-index': '1'});
5406			$(this).find('.slides blockquote').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
5407			$(this).find('.slides').stop(true,true).animate({'height' : currentHeight + 20 + 'px' },450,'easeOutCubic');
5408		}
5409	});
5410
5411
5412
5413		
5414	$('.testimonial_slider[data-style*="multiple_visible"] .slides').each(function(){
5415	    	var $that = $(this); 
5416	    	var $element = $that;
5417	    	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;
5418			if($that.find('img').length == 0) $element = $('body');
5419
5420			//move img pos
5421			if( $(this).parents('.testimonial_slider').attr('data-style') != 'multiple_visible_minimal') {
5422				$(this).find('blockquote').each(function(){
5423					$(this).find('.image-icon').insertAfter($(this).find('p'));
5424				});
5425			} else {
5426				//has alf class
5427				if($(this).find('blockquote').length > 4) {
5428					$(this).parents('.testimonial_slider').addClass('has-alf');
5429				}
5430			}
5431			
5432			var $testimonialGroupCells = ($(this).parents('.testimonial_slider').attr('data-style') == 'multiple_visible_minimal') ? true : false;
5433
5434			imagesLoaded($element,function(instance){
5435
5436		    	$that.flickity({
5437		    		  contain: true,
5438					  draggable: true,
5439					  groupCells: $testimonialGroupCells,
5440					  lazyLoad: false,
5441					  imagesLoaded: true,
5442					  percentPosition: true,
5443					  prevNextButtons: false,
5444					  pageDots: true,
5445					  resize: true,
5446					  setGallerySize: true,
5447					  wrapAround: true,
5448					  autoPlay: $autoplay,
5449					  accessibility: false
5450		    	});
5451
5452			    $that.parents('.testimonial_slider').css('opacity','1');
5453			    
5454
5455		     });//images loaded
5456		     	     
5457	    });//each	
5458
5459
5460}
5461createTestimonialControls();
5462
5463function testimonialRotate(slider){
5464	
5465	var $testimonialLength = slider.find('li').length;
5466	var $currentTestimonial = slider.find('.pagination-switch.active').parent().index();
5467	
5468	//stop the rotation when toggles are closed
5469	if( slider.parents('.toggle').length > 0 && slider.parents('.toggle').hasClass('open') ) {
5470
5471		if( !slider.is('[data-style="minimal"]') ) {
5472			if( $currentTestimonial+1 == $testimonialLength) {
5473				slider.find('ul li:first-child').click();
5474			} else {
5475				slider.find('.pagination-switch.active').parent().next('li').click();
5476			}
5477		} else {
5478			slider.find('.testimonial-next-prev .next').click();
5479		}
5480			
5481	} else {
5482		
5483		if( !slider.is('[data-style="minimal"]') ) {
5484			if( $currentTestimonial+1 == $testimonialLength) {
5485				slider.find('ul li:first-child').click();
5486			} else {
5487				slider.find('.pagination-switch.active').parent().next('li').click();
5488			}
5489		} else {
5490			slider.find('.testimonial-next-prev .next').click();
5491		}
5492	
5493	}
5494
5495}
5496
5497function testimonialHeightResize(){
5498	$('.testimonial_slider:not(.disable-height-animation):not([data-style*="multiple_visible"])').each(function(){
5499		
5500		var $index = $(this).find('.controls ul li span.active').parent().index();
5501		var currentHeight = $(this).find('.slides blockquote').eq($index).height();
5502		$(this).find('.slides').stop(true,true).css({'height' : currentHeight + 40 + 'px' });
5503		
5504	});
5505}
5506
5507
5508function testimonialSliderHeight() {
5509		
5510	$('.testimonial_slider.disable-height-animation:not([data-style*="multiple_visible"])').each(function(){
5511		$tallestQuote = 0;
5512			
5513		$(this).find('blockquote').each(function(){
5514			($(this).height() > $tallestQuote) ? $tallestQuote = $(this).height() : $tallestQuote = $tallestQuote;
5515		});	
5516		
5517		//safety net incase height couldn't be determined
5518		if($tallestQuote == 0) $tallestQuote = 100;
5519		
5520		//set even height
5521		$(this).find('.slides').css('height',$tallestQuote+40+'px');
5522		
5523		//show the slider once height is set
5524		$(this).animate({'opacity':'1'});
5525
5526		fullWidthContentColumns();
5527
5528	});
5529
5530
5531}
5532
5533function testimonialSliderHeightMinimalMult() {
5534		
5535	$('.testimonial_slider[data-style="multiple_visible_minimal"]').each(function(){
5536		$tallestQuote = 0;
5537		
5538		$(this).find('blockquote > .inner p').css('height','auto');
5539		
5540		$(this).find('blockquote > .inner p').each(function(){
5541			($(this).height() > $tallestQuote) ? $tallestQuote = $(this).height() : $tallestQuote = $tallestQuote;
5542		});	
5543		
5544		//safety net incase height couldn't be determined
5545		if($tallestQuote == 0) $tallestQuote = 200;
5546		
5547		//set even height
5548		$(this).find('blockquote > .inner p').css('height',$tallestQuote+'px');
5549		
5550	});
5551
5552}
5553
5554if($('.testimonial_slider.disable-height-animation:not([data-style*="multiple_visible"])').length > 0) {
5555	testimonialSliderHeight(); 
5556	setTimeout(testimonialSliderHeight,500);
5557}
5558
5559if($('.testimonial_slider[data-style="multiple_visible_minimal"]').length > 0) {
5560	testimonialSliderHeightMinimalMult();
5561	setTimeout(testimonialSliderHeightMinimalMult,500);
5562}
5563
5564
5565/***************** WP Media Embed / External Embed ******************/
5566
5567//this isn't the for the video shortcode* This is to help any external iframe embed fit & resize correctly 
5568function responsiveVideoIframesInit(){
5569	$('iframe').each(function(){
5570		
5571		//make sure the iframe has a src (things like adsense don't)
5572		if(typeof $(this).attr('src') != 'undefined' && !$(this).parent().hasClass('iframe-embed') && $(this).parents('.ult_modal').length == 0 && $(this).parents('.ls-slide').length == 0 && $(this).parents('.esg-entry-media').length == 0){
5573			
5574			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) {
5575				$(this).wrap('<div class="iframe-embed"/>');	
5576				
5577				$(this).attr('data-aspectRatio', this.height / this.width).removeAttr('height').removeAttr('width');
5578	
5579				//add wmode=transparent to all youytube embeds to fix z-index issues in IE
5580				if($(this).attr('src').indexOf('wmode=transparent') == -1) {
5581					if($(this).attr('src').indexOf('?') == -1){
5582						$(this).attr('src',$(this).attr('src') + '?wmode=transparent');
5583					} else {
5584						$(this).attr('src',$(this).attr('src') + '&wmode=transparent');
5585					}
5586				}
5587			}
5588			 
5589		} else {
5590			//if($(this).parents('ins').length == 0){ 
5591			//	$(this).wrap('<div class="iframe-embed-standard"/>');	
5592			//}
5593		}
5594		
5595	});
5596
5597
5598}
5599
5600function responsiveVideoIframes(){
5601	 $('iframe[data-aspectRatio]').each(function() {
5602	 	var newWidth = $(this).parent().width();
5603	 	 
5604		var $el = $(this);
5605		
5606		//in nectar slider
5607		if($(this).parents('.swiper-slide').length > 0) {
5608			if($(this).is(':visible')) $el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
5609		} 
5610		//all others
5611		else {
5612			$el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
5613		}
5614		
5615		
5616	});
5617}
5618
5619
5620function videoshortcodeSize(){
5621	$('.wp-video').each(function(){
5622
5623		$(this).attr('data-aspectRatio', parseInt($(this).find('.mejs-overlay').height()) / parseInt($(this).find('.wp-video-shortcode').css('width')));
5624
5625		var newWidth = $(this).width();
5626	 	 
5627		var $el = $(this).find('.wp-video-shortcode');
5628		$(this).width(newWidth).height(newWidth * $(this).attr('data-aspectRatio'));
5629	});
5630}
5631
5632responsiveVideoIframesInit();
5633responsiveVideoIframes();
5634videoshortcodeSize();
5635
5636//unwrap post and protfolio videos
5637$('.video-wrap iframe').unwrap();
5638$('#sidebar iframe[src]').unwrap();
5639
5640$('video:not(.slider-video)').attr('width','100%');
5641$('video:not(.slider-video)').attr('height','100%'); 
5642
5643$('audio').attr('width','100%');
5644$('audio').attr('height','100%');
5645
5646$('audio').css('visibility','visible');
5647
5648if($('body').hasClass('mobile')){
5649	$('video').css('visibility','hidden');
5650} else {
5651	$('video').css('visibility','visible');
5652}
5653
5654
5655$(window).load(function(){
5656	$('video').css('visibility','visible');
5657	showLateIframes();
5658	videoshortcodeSize();
5659});
5660
5661$('.wp-video').each(function(){
5662	 video = $(this).find('video').get(0);
5663	 video.addEventListener('loadeddata', function() {
5664	   videoshortcodeSize();
5665	   $(window).trigger('resize');
5666	 }, false);
5667});
5668
5669//webkit video back button fix 
5670$('.main-content iframe[src]').each(function(){
5671	$(this).attr('src',$(this).attr('src'));
5672	$(this).css({'opacity':'1', 'visibility':'visible'});
5673});
5674
5675showLateIframes();
5676
5677function showLateIframes(){
5678	$('iframe[src]').css('opacity','1');
5679	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 100);
5680	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 500);
5681	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 1000);
5682	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 1500);
5683	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 2500);
5684}
5685
5686
5687/***************** Nectar Video BG ******************/
5688
5689
5690	
5691	$('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function(i){
5692		$(this).css('z-index',100 + i);
5693	});
5694
5695	var min_w = 1200; // minimum video width allowed
5696	var vid_w_orig;  // original video dimensions
5697	var vid_h_orig;
5698	
5699    vid_w_orig = 1280;
5700    vid_h_orig = 720;
5701 
5702	function resizeVideoToCover() {
5703		$('.nectar-video-wrap').each(function(i){
5704			if($(this).find('video').length == 0 ) return;
5705
5706			if($(this).parents('#page-header-bg').length > 0) {
5707				if($('.container-wrap.auto-height').length > 0) return false;
5708				var $containerHeight = $(this).parents('#page-header-bg').outerHeight();			
5709				var $containerWidth = $(this).parents('#page-header-bg').outerWidth();
5710			} else {
5711				var $containerHeight = $(this).parents('.wpb_row').outerHeight();			
5712				var $containerWidth = $(this).parents('.wpb_row').outerWidth();
5713			}
5714			
5715		    // set the video viewport to the window size
5716		    $(this).width($containerWidth);
5717		    $(this).height($containerHeight);
5718		
5719		    // use largest scale factor of horizontal/vertical
5720		    var scale_h = $containerWidth / vid_w_orig;
5721		    var scale_v = ($containerHeight - $containerHeight) / vid_h_orig; 
5722		    var scale = scale_h > scale_v ? scale_h : scale_v;
5723			
5724			//update minium width to never allow excess space
5725		    min_w = 1280/720 * ($containerHeight+40);
5726		    
5727		    // don't allow scaled width < minimum video width
5728		    if (scale * vid_w_orig < min_w) {scale = min_w / vid_w_orig;}
5729		        
5730		    // now scale the video
5731		    $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig +0));
5732		    $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig +0));
5733		    
5734		    // and center it by scrolling the video viewport
5735		    $(this).scrollLeft(($(this).find('video').width() - $containerWidth) / 2);
5736		    $(this).scrollTop(($(this).find('video').height() - ($containerHeight)) / 2);
5737		    $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($containerHeight)) / 2);
5738
5739
5740		    //align bottom
5741		    if($(this).attr('data-bg-alignment') == 'center bottom' || $(this).attr('data-bg-alignment') == 'bottom'){
5742		    	$(this).scrollTop(($(this).find('video').height() - ($containerHeight+6)));
5743		    }
5744		    //align top
5745		    else if($(this).attr('data-bg-alignment') == 'center top' || $(this).attr('data-bg-alignment') == 'top') {
5746		    	$(this).scrollTop(0);
5747		    } 
5748
5749		});
5750	}
5751    
5752    //init
5753    function videoBGInit(){
5754	    setTimeout(function(){
5755	    	resizeVideoToCover();
5756	    	$('.video-color-overlay').each(function(){
5757	    		$(this).css('background-color',$(this).attr('data-color'));
5758	    	});
5759	    	$('.nectar-video-wrap').each(function(i){
5760
5761	    		if($(this).find('video').length == 0) return;
5762
5763	    		var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false;
5764	    		var $that = $(this);
5765
5766	    		 var videoReady = setInterval(function(){
5767
5768        			if($that.find('video').get(0).readyState > 3) {
5769
5770        				$that.transition({'opacity':'1'},400);
5771		    			$that.find('video').transition({'opacity':'1'},400);
5772		    			$that.parent().find('.video-color-overlay').transition({'opacity':'0.7'},400);
5773
5774		    			if($headerVideo == true) {
5775			    			pageHeaderTextEffect();
5776						}
5777
5778						//remove page loading screen
5779						$('#ajax-loading-screen').addClass('loaded');
5780						setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
5781				
5782
5783						clearInterval(videoReady);
5784					}
5785	    		},60);
5786	    		
5787	    	});
5788	    },300);
5789
5790		if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)){
5791			$('.wpb_row .mobile-video-image, #page-header-wrap .mobile-video-image, .fullscreen-header .mobile-video-image').show();
5792			$('.nectar-video-wrap').remove();
5793		}
5794
5795		
5796		 if(navigator.userAgent.indexOf('Chrome') > 0 && !/Edge\/12./i.test(navigator.userAgent) && !/Edge\/\d./i.test(navigator.userAgent)) { 
5797		 	
5798		 	$('.nectar-video-wrap').each(function(i){
5799		 		if(jQuery(this).find('video source[type="video/webm"]').length > 0 ) {
5800				  	var webmSource = jQuery(this).find('video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
5801		          	var firstVideo = jQuery(this).find('video').get(0);
5802		          	firstVideo.src = webmSource;
5803		          	firstVideo.load();
5804		         }
5805            });
5806	    }
5807
5808
5809
5810
5811	    jQuery(".vc_row").each(function() {
5812	        var youtubeUrl, youtubeId, $row = jQuery(this);
5813	        $row.find('.nectar-youtube-bg').length > 0 ? (youtubeUrl = $row.find('.nectar-youtube-bg span').text(), youtubeId = nectarExtractYoutubeId(youtubeUrl), youtubeId && ($row.find(".vc_video-bg").remove(), nectarInsertYoutubeVideoAsBackgroun
5813d($row.find('.nectar-youtube-bg'), youtubeId))) : $row.find(".nectar-youtube-bg").remove()
5814
5815	        //remove yt url
5816	        $row.find('.nectar-youtube-bg span').remove();
5817	        $row.find('.nectar-video-wrap, .nectar-youtube-bg').css({'opacity':'1','width':'100%', 'height':'100%'});
5818	         $row.find('.video-color-overlay').transition({'opacity':'0.7'},400);
5819	    });
5820		
5821
5822		function nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter) {
5823		    if ("undefined" == typeof YT.Player) return counter = "undefined" == typeof counter ? 0 : counter, counter > 100 ? void console.warn("Too many attempts to load YouTube api") : void setTimeout(function() {
5824		        nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter++)
5825		    }, 100);
5826		    var $container = $element.prepend('<div class="vc_video-bg"><div class="inner"></div></div>').find(".inner");
5827		    new YT.Player($container[0], {
5828		        width: "100%",
5829		        height: "100%",
5830		        videoId: youtubeId,
5831		        playerVars: {
5832		            playlist: youtubeId,
5833		            iv_load_policy: 3,
5834		            enablejsapi: 1,
5835		            disablekb: 1,
5836		            autoplay: 1,
5837		            controls: 0,
5838		            showinfo: 0,
5839		            rel: 0,
5840		            loop: 1
5841		        },
5842		        events: {
5843		            onReady: function(event) {
5844		                event.target.mute().setLoop(!0);
5845		            }
5846		        }
5847		    }), nectarResizeVideoBackground($element), jQuery(window).bind("resize", function() {
5848		        nectarResizeVideoBackground($element)
5849		    })
5850		}
5851
5852		function nectarResizeVideoBackground($element) {
5853		    var iframeW, iframeH, marginLeft, marginTop, containerW = $element.innerWidth(),
5854		        containerH = $element.innerHeight(),
5855		        ratio1 = 16,
5856		        ratio2 = 9;
5857		    ratio1 / ratio2 > containerW / containerH ? (iframeW = containerH * (ratio1 / ratio2), 
5858		    	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", 
5859		    	marginLeft = -Math.round((iframeW - containerW) / 2) + "px", iframeW += "px", iframeH += "px"), 
5860		    	$element.find(".vc_video-bg iframe").css({
5861			        maxWidth: "1000%",
5862			        marginLeft: marginLeft,
5863			        marginTop: marginTop,
5864			        width: iframeW,
5865			        height: iframeH
5866			    })
5867		}
5868
5869		function nectarExtractYoutubeId(url) {
5870		    if ("undefined" == typeof url) return !1;
5871		    var id = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/);
5872		    return null !== id ? id[1] : !1
5873		}
5874
5875
5876	}
5877
5878	if($('.nectar-video-wrap').length > 0 || $('.nectar-youtube-bg').length > 0) {
5879		videoBGInit();
5880	}
5881
5882
5883/*-------------------------------------------------------------------------*/
5884/*	4.	Header + Search
5885/*-------------------------------------------------------------------------*/	 
5886
5887////mobile megamenus without titles / nested groupings
5888$mobileNavSelector = ($('.off-canvas-menu-container.mobile-only').length > 0) ? '.off-canvas-menu-container.mobile-only ': '#mobile-menu .container ';
5889$($mobileNavSelector+'.megamenu > ul > li > a').each(function(){
5890	if( $(this).text() == '–' ) {
5891		$navLIs = $(this).parent().find('> ul > li').clone();
5892		$(this).parent().find('ul').remove();
5893		$(this).parent().parent().append($navLIs);
5894		$(this).parent().remove();
5895	}
5896});
5897
5898/***************** Slide Out Widget Area **********/
5899
5900var $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;
5901var $bodyBorderWidth = ($('.body-border-right').length > 0) ? $('.body-border-right').width() : 0;
5902var $resetHeader;
5903
5904
5905function mobileBreakPointCheck() {
5906	var $mobileBreakpoint = ( $('body[data-header-breakpoint]').length > 0 && $('body').attr('data-header-breakpoint') != '1000' ) ? parseInt($('body').attr('data-header-breakpoint')) : 1000;
5907	var $withinCustomBreakpoint = false;
5908
5909	if($mobileBreakpoint != 1000) {
5910		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 ) {
5911			$withinCustomBreakpoint = true;
5912		}
5913	}
5914
5915	return $withinCustomBreakpoint;
5916}
5917
5918//icon effect html creation
5919if($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) {
5920
5921	if($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) {
5922		$('<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');
5923		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');
5924	}
5925
5926
5927	function calculateHoverNavMinHeight() {
5928		$widgetHeights = 0;
5929		$('#slide-out-widget-area > .widget').each(function(){
5930			$widgetHeights += $(this).height();
5931		});
5932		$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();
5933
5934		$('#slide-out-widget-area .inner').css({'height':'auto', 'min-height': $menuHeight  });
5935
5936		$('#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);
5937	
5938	}
5939
5940	function openRightHoverNav() {
5941
5942		
5943
5944			calculateHoverNavMinHeight();
5945
5946			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && $('#slide-out-widget-area.open').length > 0) {
5947				mobileCloseNavCheck();
5948				return;
5949			}
5950			
5951
5952			$('#slide-out-widget-area').css({ 'transform': 'translate3d(0,0,0)' }).addClass('open');
5953
5954			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;
5955
5956			//icon effect
5957			////set pos 
5958			if($('header#top .container .span_9 > .slide-out-widget-area-toggle').length > 0) {
5959
5960				var adminBarHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
5961				
5962				var secondaryBarHeight = ($('#header-secondary-outer').length > 0) ? $('#header-secondary-outer').height() : 0; 
5963				
5964
5965				if($('body.mobile').length > 0) {
5966
5967					$('.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 });
5968				} else {
5969
5970					if($bodyBorderHeaderColorMatch) {
5971
5972						var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1;
5973						$('.slide-out-hover-icon-effect').css({
5974							'top': adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')), 
5975							'right': 29 + $extraCushion });
5976
5977					} else {
5978
5979						var $withinCustomBreakpoint = mobileBreakPointCheck();
5980
5981						if($('body.ascend').length > 0 && $withinCustomBreakpoint != true) {
5982							var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1;
5983							$('.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 });
5984						} else {
5985
5986							$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');
5987							$('.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')) });
5988						}
5989					}
5990					
5991				}
5992			}
5993
5994			////open
5995
5996			$('.slide-out-hover-icon-effect .lines-button').removeClass('no-delay').addClass('unhidden-line');
5997			
5998
5999			if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#nectar_fullscreen_rows').length == 0) {
6000
6001				if(!($(window).scrollTop() == 0 && $('#header-outer.transparent').length > 0)) {
6002
6003					if($('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6004
6005						$('#header-outer').attr('data-transparent','true').addClass('no-bg-color').addClass('slide-out-hover');
6006						$('#header-outer header, #header-outer > .cart-outer').addClass('all-hidden');
6007					}
6008
6009				}
6010
6011				if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6012					var headerResize = $('#header-outer').attr('data-header-resize');
6013					if(headerResize == 1) {
6014
6015						$(window).off('scroll',bigNav);
6016						$(window).off('scroll',smallNav);
6017
6018
6019					} else {
6020						
6021						$(window).off('scroll',opaqueCheck);
6022						$(window).off('scroll',transparentCheck);
6023					}
6024				}
6025
6026			}
6027
6028			if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
6029				$(window).on('mousemove.rightOffsetCheck',closeNavCheck);
6030			}
6031
6032	}
6033
6034	function closeNavCheck(e) {
6035		var $windowWidth = $(window).width();
6036		if(e.clientX < $windowWidth - 340 - $bodyBorderWidth) {
6037
6038				$(window).off('mousemove.rightOffsetCheck',closeNavCheck);
6039
6040				$('#slide-out-widget-area').css({ 'transform': 'translate3d(341px,0,0)' }).removeClass('open');
6041
6042				$('#header-outer').removeClass('style-slide-out-from-right');
6043
6044				$('.slide-out-hover-icon-effect .lines-button').removeClass('unhidden-line').addClass('no-delay');
6045
6046				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;
6047
6048				if($('#header-outer[data-permanent-transparent="1"]').length == 0) {
6049
6050					if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6051
6052						if($('body.mobile').length == 0) {
6053							$('#header-outer').removeClass('no-bg-color');
6054							$('#header-outer header, #header-outer > .cart-outer').removeClass('all-hidden');
6055						}
6056					}
6057
6058					if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6059						var headerResize = $('#header-outer').attr('data-header-resize');
6060						if(headerResize == 1) {
6061						
6062							$(window).off('scroll.headerResizeEffect');
6063							if($(window).scrollTop() == 0) {
6064								$(window).on('scroll.headerResizeEffect',smallNav); 
6065
6066								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) {
6067									$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
6068										'padding' : '0'			
6069									},{queue:false, duration:250, easing: 'easeOutCubic'});	
6070								}
6071							}
6072							else {
6073								$(window).on('scroll.headerResizeEffect',bigNav);
6074							}
6075							
6076				
6077						} else {
6078							
6079							$(window).off('scroll.headerResizeEffectOpaque');
6080							$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
6081						}
6082					}
6083				}
6084
6085			}
6086
6087	}
6088
6089	function mobileCloseNavCheck(e) {
6090		
6091
6092				$('#slide-out-widget-area').css({ 'transform': 'translate3d(341px,0,0)' }).removeClass('open');
6093
6094				$('#header-outer').removeClass('style-slide-out-from-right');
6095
6096				$('.slide-out-hover-icon-effect .lines-button').removeClass('unhidden-line').addClass('no-delay');
6097
6098				if($('#header-outer[data-permanent-transparent="1"]').length == 0) {
6099
6100					$('#header-outer').removeClass('no-bg-color');
6101					$('#header-outer header').removeClass('all-hidden');
6102
6103				}
6104
6105				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;
6106
6107				if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6108					
6109					var headerResize = $('#header-outer').attr('data-header-resize');
6110					if(headerResize == 1) {
6111					
6112						$(window).off('scroll.headerResizeEffect');
6113						if($(window).scrollTop() == 0) {
6114							$(window).on('scroll.headerResizeEffect',smallNav); 
6115
6116							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) {
6117								$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
6118									'padding' : '0'			
6119								},{queue:false, duration:250, easing: 'easeOutCubic'});	
6120							}
6121						}
6122						else {
6123							$(window).on('scroll.headerResizeEffect',bigNav);
6124						}
6125						
6126			
6127					} else {
6128						
6129						$(window).off('scroll.headerResizeEffectOpaque');
6130						$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
6131					}
6132			}
6133
6134			
6135
6136	}
6137
6138	//hover triggered
6139	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/))
6140		$('body').on('mouseenter','#header-outer .slide-out-widget-area-toggle:not(.std-menu) a',openRightHoverNav);
6141	else 
6142		$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a',openRightHoverNav);
6143
6144	$(window).on('smartresize',calculateHoverNavMinHeight);
6145
6146}
6147
6148
6149//click triggered
6150$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating)',function(){
6151	if(animating == 'true' || $('.slide-out-from-right-hover').length > 0) return false;
6152	var $that = $(this);
6153
6154	$('#header-outer').removeClass('no-transition');
6155
6156	//slide out from right
6157	if($('#slide-out-widget-area').hasClass('slide-out-from-right')) {
6158
6159		$slideOutAmount = ($('.body-border-top').length > 0 && $('body.mobile').length == 0) ? $('.body-border-top').height() : 0;
6160
6161		//calc height if used bottom meta
6162		$('#slide-out-widget-area .inner').css({'height':'auto', 'min-height': $('#slide-out-widget-area').height() - 25 - $('.bottom-meta-wrap').height() });
6163
6164		if($('#boxed').length == 0) {
6165			$('.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');
6166
6167			var $withinCustomBreakpoint = mobileBreakPointCheck();
6168
6169			if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0 || $withinCustomBreakpoint) {
6170				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) {
6171					$('#header-outer').stop(true).css('transform','translateY(0)').transition({ x: '-' + (300+$slideOutAmount) +'px'},700,'easeInOutCubic');
6172				} else {
6173					$('#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');
6174				}
6175			} else {
6176				$('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').transition({ x: '-300px'},700,'easeInOutCubic');
6177			}
6178
6179			$('#ascrail2000').transition({ 'x': '-' + (300+$slideOutAmount) +'px' },700,'easeInOutCubic');
6180			$('body:not(.ascend) #header-outer .cart-menu').stop(true).transition({ 'x': '300px' },700,'easeInOutCubic');
6181		}
6182
6183		$('#slide-out-widget-area').stop(true).transition({ x: '-' + $slideOutAmount +'px' },700,'easeInOutCubic').addClass('open');
6184
6185
6186		if($('#boxed').length == 0) {
6187			//full width menu adjustments
6188			if($('#header-outer[data-full-width="true"]').length > 0 && !$('body').hasClass('mobile')) { 
6189				$('#header-outer').addClass('highzI'); 
6190				$('#ascrail2000').addClass('z-index-adj');
6191
6192				if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
6193					if($bodyBorderWidth == 0)
6194						$('header#top #logo').stop(true).transition({ x: (300+$slideOutAmount) +'px' },700,'easeInOutCubic'); 
6195					
6196					//$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': $(window).width() - 360, 'left': '300px' },700,'easeInOutCubic');
6197
6198				}
6199
6200				$('header#top .slide-out-widget-area-toggle .lines-button').addClass('close');
6201
6202				if($('#header-outer[data-remove-border="true"]').length > 0) {
6203					$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '64px' },700,'easeInOutCubic');
6204				} else {
6205					$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '89px' },700,'easeInOutCubic'); 
6206				}
6207
6208				$('body #header-outer nav > ul > li > a').css({'margin-bottom':'0'});
6209				
6210			}
6211		}
6212
6213		$('#header-outer').addClass('style-slide-out-from-right');
6214
6215		//fade In BG Overlay
6216		$('#slide-out-widget-area-bg').css({'height':'100%','width':'100%'}).stop(true).transition({
6217			'opacity' : 1
6218		},700,'easeInOutCubic',function(){
6219			$('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating');
6220		});
6221		
6222		//hide menu if no space
6223		if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
6224			$logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width();
6225			if($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) $('#header-outer').addClass('hidden-menu');
6226		} else {
6227			$('#header-outer').addClass('hidden-menu-items');
6228		}
6229
6230		var headerResize = $('#header-outer').attr('data-header-resize');
6231
6232		if($('#header-outer[data-remove-fixed="1"]').length == 0) {
6233			if($bodyBorderHeaderColorMatch == true && headerResize == 1) {
6234				
6235				$('#header-outer').stop(true).transition({ y: '0' },0).addClass('transparent').css('transition','transform');
6236				if($('#header-outer').attr('data-transparent-header') != 'true') {
6237					$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
6238				}
6239
6240				$(window).off('scroll',bigNav);
6241				//if($('.small-nav').length > 0 || $('#header-outer').hasClass('pseudo-data-transparent')) bigNav();
6242				$(window).off('scroll',smallNav);
6243
6244			} else if ($bodyBorderHeaderColorMatch == true) {
6245				$('#header-outer').addClass('transparent');
6246				$(window).off('scroll',opaqueCheck);
6247				$(window).off('scroll',transparentCheck);
6248
6249				if($('#header-outer').attr('data-transparent-header') != 'true') {
6250					$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
6251				}
6252			}
6253		}
6254
6255
6256	}
6257     else if($('#slide-out-widget-area').hasClass('fullscreen')) {
6258
6259		//scroll away from fixed reveal footer if shown (firefox bug with bluring over it)
6260		var $scrollDelay = 0;
6261		var $scrollDelay2 = 0;
6262
6263		if($(window).scrollTop() + $(window).height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) {
6264			$('body,html').stop().animate({
6265				scrollTop: $('.blurred-wrap').height() - $(window).height()
6266			},600,'easeInOutCubic');
6267			$scrollDelay = 550;
6268			$scrollDelay2 = 200;
6269		}
6270
6271		$('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close');
6272		setTimeout(function(){ $('.blurred-wrap').addClass('blurred'); },$scrollDelay);
6273		$('#slide-out-widget-area.fullscreen').show().addClass('open');
6274
6275		if($('.nectar-social-sharing-fixed').length == 0) {
6276			hideToTop();
6277		}
6278
6279		//remove box shadow incase at the top of the page with nectar box roll above
6280		$('.container-wrap').addClass('no-shadow');
6281		$('#header-outer').stop(true).css('transform','translateY(0)');
6282
6283		setTimeout(function(){
6284
6285			$('.off-canvas-menu-container .menu > li').each(function(i){
6286				$(this).delay(i*50).transition({y: 0, 'opacity': 1},800,'easeOutExpo');
6287			});
6288
6289			$('#slide-out-widget-area.fullscreen .widget').each(function(i){
6290				$(this).delay(i*100).transition({y: 0, 'opacity': 1},800,'easeOutExpo');
6291			});
6292		},370+$scrollDelay2);
6293
6294		setTimeout(function(){
6295			$('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
6296
6297			$('#slide-out-widget-area .off-canvas-social-links li').each(function(i){
6298				$(this).delay(i*50).transition({'scale':1},400,'easeOutCubic');
6299			});
6300			$('#slide-out-widget-area .bottom-text').transition({'opacity':0.7},400,'easeOutCubic');
6301		},750+$scrollDelay2);
6302		
6303		//fade In BG Overlay
6304		setTimeout(function(){
6305			$easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint';
6306			$('#slide-out-widget-area-bg').css({'height':'100%','width':'100%'}).show().stop(true).transition({
6307				'y' : '0%'
6308			},920,$easing,function(){
6309				$('.slide-out-widget-area-toggle > div > a').removeClass('animating');
6310			});
6311		},50+$scrollDelay2);
6312
6313		//overflow state 
6314		slideOutWidgetOverflowState();
6315		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').addClass('at-content');
6316		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());
6317	} 
6318
6319	else if($('#slide-out-widget-area').hasClass('fullscreen-alt')) {
6320
6321		$('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close');
6322		$('#slide-out-widget-area.fullscreen-alt').show().addClass('open');
6323		$('#slide-out-widget-area-bg').addClass('open');
6324
6325		$('body > div[class*="body-border"]').css('z-index','9995');
6326
6327		$('.off-canvas-menu-container .menu').transition({y: '0px', 'opacity': 1},0);	
6328
6329		if($('.nectar-social-sharing-fixed').length == 0) {
6330			hideToTop();
6331		}
6332
6333		//if($('#header-outer-bg-only').length == 0 ) {
6334			//$('body').prepend($('<div id="header-outer-bg-only"/>'));
6335			//$('#header-outer-bg-only').css({'height':$('#header-outer').outerHeight(true), 'background-color': $('#header-outer').css('background-color')});	
6336		//} 
6337
6338		if($('#header-outer.transparent').length == 0) {
6339
6340			//$('#header-outer-bg-only').show();
6341			//$('#header-outer-bg-only').css({'height':$('#header-outer').outerHeight(true), 'background-color': $('#header-outer').css('background-color')});
6342
6343			//if($('.body-border-top').length > 0) {
6344				//$('.admin-bar #slide-out-widget-area-bg.fullscreen-alt').addClass('no-transition').css({'padding-top': ($('#header-outer').outerHeight(true)+32) + 'px'});
6345				//$('body:not(.admin-bar) #slide-out-widget-area-bg.fullscreen-alt').addClass('no-transition').css({'padding-top': ($('#header-outer').outerHeight(true))+ 'px'});
6346			//}
6347		}
6348		else { 
6349
6350			//$('#header-outer-bg-only').hide();
6351			if($('.body-border-top').length > 0) {
6352				$('.admin-bar #slide-out-widget-area-bg.fullscreen-alt').css({'padding-top': ($('.body-border-top').outerHeight(true)+32) + 'px'});
6353				$('body:not(.admin-bar) #slide-out-widget-area-bg.fullscreen-alt').css({'padding-top': ($('.body-border-top').outerHeight(true))+ 'px'});
6354			}
6355		}
6356
6357		if($('#logo .starting-logo').length > 0 && $(window).width() > 1000) {
6358			
6359			//$('#header-outer').addClass('no-transition').addClass('no-bg-color');
6360			
6361			$('#header-outer').stop(true).css('transform','translateY(0)').addClass('transparent');
6362			if($('#header-outer').attr('data-transparent-header') != 'true') {
6363				$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
6364			}
6365		}
6366
6367		$('.off-canvas-menu-container .clip-wrap').css('transition-duration','0s');
6368
6369		setTimeout(function(){
6370
6371			$('.off-canvas-menu-container .menu > li').each(function(i){
6372				$(this).delay(i*50).transition({y: 0, 'opacity': 1},750,'easeOutCubic').addClass('no-pointer-events');
6373			});
6374
6375			setTimeout(function(){
6376				$('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
6377				$('.off-canvas-menu-container .clip-wrap').css('transition-duration','.45s');
6378			},500);
6379			
6380		
6381
6382			$('#slide-out-widget-area.fullscreen-alt .widget').each(function(i){
6383				$(this).delay(i*100).transition({y: 0, 'opacity': 1},650,'easeOutCubic');
6384			});
6385		},200);
6386
6387		setTimeout(function(){
6388			$('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
6389
6390			$('#slide-out-widget-area .off-canvas-social-links li').css('opacity','1').each(function(i){
6391				$(this).delay(i*50).transition({'scale':1},400,'easeOutCubic');
6392			});
6393			$('#slide-out-widget-area .bottom-text').transition({'opacity':1},600,'easeOutCubic');
6394		},200);
6395		
6396		//fade In BG Overlay
6397		if($('#slide-out-widget-area-bg').hasClass('solid')) $opacity = 1;
6398		if($('#slide-out-widget-area-bg').hasClass('dark')) $opacity = 0.97;
6399		if($('#slide-out-widget-area-bg').hasClass('medium')) $opacity = 0.6;
6400		if($('#slide-out-widget-area-bg').hasClass('light')) $opacity = 0.4;
6401		$('#slide-out-widget-area-bg').removeClass('no-transition');
6402		
6403
6404		$('#slide-out-widget-area-bg').addClass('padding-removed').css({'height':'100%','width':'100%', 'left':'0','opacity': $opacity});
6405		
6406
6407		setTimeout(function(){
6408			$('.slide-out-widget-area-toggle > div > a').removeClass('animating');
6409		},600);
6410			
6411		
6412
6413		//overflow state 
6414		slideOutWidgetOverflowState();
6415		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').addClass('at-content');
6416		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());
6417	}
6418
6419
6420
6421	
6422		
6423
6424	//add open class
6425	$('#header-outer').removeClass('side-widget-closed').addClass('side-widget-open');
6426
6427	//give header transparent state
6428	if($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0 && $('#header-outer[data-full-width="true"]').length > 0) {
6429		$('#header-outer').addClass('transparent');
6430	}
6431
6432	//dark slide transparent nav
6433	if($('#header-outer.dark-slide.transparent').length > 0  && $('#boxed').length == 0) $('#header-outer').removeClass('dark-slide').addClass('temp-removed-dark-slide');
6434	
6435	$('.slide-out-widget-area-toggle > div > a').removeClass('closed').addClass('open');
6436	$('.slide-out-widget-area-toggle > div > a').addClass('animating');
6437
6438	return false;
6439});
6440
6441$('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-widget-area-bg.slide-out-from-right',function(){
6442	
6443	if($('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) return;
6444
6445	$('#header-outer').removeClass('no-transition');
6446
6447	var $that = $(this);
6448
6449	$('.slide-out-widget-area-toggle:not(.std-menu) a').removeClass('open').addClass('closed');
6450	$('.slide-out-widget-area-toggle:not(.std-menu) a').addClass('animating');
6451
6452	//slide out from right
6453	if($('#slide-out-widget-area').hasClass('slide-out-from-right')) {
6454
6455		$('.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');
6456
6457		if($('#header-outer[data-transparency-option="1"]').length > 0  && $('#boxed').length == 0) {
6458			$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');
6459			$('#header-outer').stop(true).transition({ x: '0px', 'background-color': $currentRowBG },700,'easeInOutCubic');
6460		} else {
6461			$('#header-outer').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
6462		}
6463
6464		$('#ascrail2000').stop(true).transition({ 'x': '0px' },700,'easeInOutCubic');
6465		$('body:not(.ascend) #header-outer .cart-menu').stop(true).transition({ 'x': '0px' },700,'easeInOutCubic');
6466
6467		$('#slide-out-widget-area').stop(true).transition({ x: '301px' },700,'easeInOutCubic').removeClass('open');
6468
6469
6470		if($('#boxed').length == 0) {
6471			if($('#header-outer[data-full-width="true"]').length > 0) {  
6472				$('#header-outer').removeClass('highzI'); 
6473				$('header#top #logo').stop(true).transition({ x: '0px' },700,'easeInOutCubic'); 
6474				//$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': '100%', 'left': '0' },700,'easeInOutCubic');
6475				$('.lines-button').removeClass('close');
6476
6477				$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
6478
6479			}
6480		}
6481
6482		if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) {
6483			$('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({ x: '0px' },700,'easeInOutCubic'); 
6484		}
6485
6486		//fade out overlay
6487		$('#slide-out-widget-area-bg').stop(true).transition({
6488			'opacity' : 0
6489		},700,'easeInOutCubic',function(){
6490			$('.slide-out-widget-area-toggle a').removeClass('animating');
6491			$(this).css({'height':'1px','width':'1px'});
6492
6493			if($('#header-outer[data-remove-fixed="1"]').length == 0) {
6494				//hide menu if transparent, user has scrolled down and hhun is on
6495				if($('#header-outer').hasClass('parallax-contained') && $(window).scrollTop() > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) {
6496					$('#header-outer').removeClass('parallax-contained').addClass('detached').removeClass('transparent');
6497				}
6498				else if($(window).scrollTop() == 0 && $('body[data-hhun="1"]').length >
6498 0 && $('#page-header-bg[data-parallax="1"]').length > 0 ||
6499					$(window).scrollTop() == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) {
6500
6501					if($('#header-outer[data-transparency-option="1"]').length > 0) $('#header-outer').addClass('transparent');
6502					$('#header-outer').addClass('parallax-contained').removeClass('detached');
6503				}
6504			}
6505
6506			//fix for fixed subpage menu
6507			$('.container-wrap').css('transform','none');
6508		});
6509
6510
6511		$('#header-outer').removeClass('style-slide-out-from-right');
6512
6513
6514		var headerResize = $('#header-outer').attr('data-header-resize');
6515		if($('#header-outer[data-remove-fixed="1"]').length == 0) {
6516
6517			if($bodyBorderHeaderColorMatch == true && headerResize == 1) {
6518			
6519				$(window).off('scroll.headerResizeEffect');
6520				if($(window).scrollTop() == 0) {
6521					$(window).on('scroll.headerResizeEffect',smallNav); 
6522
6523					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) {
6524						$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
6525							'padding' : '0'			
6526						},{queue:false, duration:250, easing: 'easeOutCubic'});	
6527					}
6528				}
6529				else
6530					$(window).on('scroll.headerResizeEffect',bigNav); 
6531					//smallNav();
6532
6533				if($('#header-outer').hasClass('pseudo-data-transparent')) {
6534					$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
6535				}
6536
6537				$('#header-outer').css('transition','transform');
6538
6539			} else if ($bodyBorderHeaderColorMatch == true) {
6540				
6541				$(window).off('scroll.headerResizeEffectOpaque');
6542				$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
6543
6544				$('#header-outer').css('transition','transform');
6545
6546				if($('#header-outer').hasClass('pseudo-data-transparent')) {
6547					$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
6548				}
6549			}
6550		}
6551
6552
6553	} 
6554
6555	else if($('#slide-out-widget-area').hasClass('fullscreen')) {
6556
6557
6558		$('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close');
6559		//$('.slide-out-widget-area-toggle a').removeClass('animating');
6560		$('.blurred-wrap').removeClass('blurred');
6561		$('#slide-out-widget-area.fullscreen').transition({'opacity': 0 },700,'easeOutQuad',function(){ $('#slide-out-widget-area.fullscreen').hide().css('opacity','1'); }).removeClass('open');
6562		$('#slide-out-widget-area.fullscreen .widget').transition({'opacity': 0},700,'easeOutQuad',function(){
6563			$(this).transition({y: '110px'},0);
6564		});
6565
6566		setTimeout(function(){
6567			$('.off-canvas-menu-container .menu > li').transition({y: '80px', 'opacity': 0},0);		
6568			$('#slide-out-widget-area .off-canvas-social-links li').transition({'scale':0},0);
6569			$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
6570			$('#slide-out-widget-area .bottom-text').transition({'opacity':0},0);	
6571
6572			//close submenu items
6573			$('#slide-out-widget-area .menuwrapper .menu').removeClass( 'subview' );
6574			$('#slide-out-widget-area .menuwrapper .menu li').removeClass( 'subview subviewopen' );
6575			$('#slide-out-widget-area.fullscreen .inner .off-canvas-menu-container').css('height','auto');
6576		},800);
6577
6578		setTimeout(function(){
6579			if($('.nectar-social-sharing-fixed').length == 0) {
6580				showToTop();
6581			}
6582			$('.container-wrap').removeClass('no-shadow');
6583		},500);
6584
6585		//fade out overlay
6586		$('#slide-out-widget-area-bg').stop(true).transition({'opacity': 0},900,'easeOutQuad',function(){
6587			if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').removeClass('at-content');
6588			if($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', '0');
6589			$('.slide-out-widget-area-toggle a').removeClass('animating');
6590			if($('#slide-out-widget-area-bg').hasClass('solid')) $opacity = 1;
6591			if($('#slide-out-widget-area-bg').hasClass('dark')) $opacity = 0.93;
6592			if($('#slide-out-widget-area-bg').hasClass('medium')) $opacity = 0.6;
6593			if($('#slide-out-widget-area-bg').hasClass('light')) $opacity = 0.4;
6594			$(this).css({'height':'1px','width':'1px', 'opacity': $opacity}).transition({ y : '-100%'},0);
6595		});
6596
6597		
6598	}
6599
6600	else if($('#slide-out-widget-area').hasClass('fullscreen-alt')) {
6601
6602		$('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close');
6603		//$('.slide-out-widget-area-toggle a').removeClass('animating');
6604		$('.blurred-wrap').removeClass('blurred');
6605		$('#slide-out-widget-area-bg').removeClass('open');
6606		
6607		$('#slide-out-widget-area.fullscreen-alt .widget').transition({'opacity': 0},500,'easeOutQuad',function(){
6608			$(this).transition({y: '40px'},0);
6609		});
6610		$('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({'opacity': 0},250,'easeOutQuad');
6611		$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
6612
6613		$('.off-canvas-menu-container .menu').transition({y: '-13px', 'opacity': 0},400);	
6614
6615
6616		setTimeout(function(){
6617			$('.off-canvas-menu-container .menu > li').stop(true,true).transition({y: '40px', 'opacity': 0},0);		
6618			$('#slide-out-widget-area .off-canvas-social-links li').transition({'scale':0},0);
6619			$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');	
6620
6621			//close submenu items
6622			$('#slide-out-widget-area .menuwrapper .menu').removeClass( 'subview' );
6623			$('#slide-out-widget-area .menuwrapper .menu li').removeClass( 'subview subviewopen' );
6624			$('#slide-out-widget-area.fullscreen-alt .inner .off-canvas-menu-container').css('height','auto');
6625
6626			if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').removeClass('at-content');
6627			if($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) $('#slide-out-widget-area.fullscreen-alt .inner-wrap').css('padding-top', '0');
6628			$('.slide-out-widget-area-toggle a').removeClass('animating');
6629			$('#slide-out-widget-area-bg').css({'height':'1px','width':'1px','left':'-100%'});
6630			$('#slide-out-widget-area.fullscreen-alt').hide().removeClass('open');
6631		},550);
6632
6633		setTimeout(function(){
6634			if($('.nectar-social-sharing-fixed').length == 0) {
6635				showToTop();
6636			}
6637		},600);
6638
6639		//fade out overlay
6640		setTimeout(function(){
6641			$('#slide-out-widget-area-bg').removeClass('padding-removed');
6642		},50);	
6643
6644		
6645		var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 150: 50;
6646
6647		setTimeout(function(){
6648			$('#slide-out-widget-area-bg').stop(true).css({'opacity': 0});
6649			if($('[data-transparent-header="true"]').length > 0) $('body > div[class*="body-border"]').css('z-index','10000');
6650		},borderDelay);
6651
6652		setTimeout(function(){
6653			$('#header-outer.transparent.small-nav, #header-outer.transparent.detached, #header-outer.transparent.scrolled-down').removeClass('transparent');
6654			
6655			if($('#header-outer').hasClass('pseudo-data-transparent')) {
6656				$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
6657			}
6658
6659			
6660				/*setTimeout(function(){
6661					$('#header-outer').removeClass('no-bg-color');
6662					$('#header-outer-bg-only').hide();
6663					setTimeout(function(){
6664						$('#header-outer').removeClass('no-transition');
6665					},50);
6666				},250);*/
6667			
6668
6669		},100);
6670		
6671	}
6672
6673
6674	
6675
6676	//dark slide transparent nav
6677	if($('#header-outer.temp-removed-dark-slide.transparent').length > 0  && $('#boxed').length == 0) $('#header-outer').removeClass('temp-removed-dark-slide').addClass('dark-slide');
6678
6679	//remove header transparent state
6680
6681	if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) {
6682
6683		if($('.nectar-box-roll').length == 0) {
6684			if($('#header-outer.small-nav').length > 0 || $('#header-outer.scrolled-down').length > 0 || $('#header-outer.detached').length > 0) $('#header-outer').removeClass('transparent');
6685		} else {
6686			if($('#header-outer.small-nav').length > 0 || $('#header-outer.scrolled-down').length > 0 || $('.container-wrap.auto-height').length > 0) $('#header-outer').removeClass('transparent');
6687		}
6688	} 
6689
6690
6691
6692	//remove hidden menu
6693	$('#header-outer').removeClass('hidden-menu');
6694
6695	$('#header-outer').removeClass('side-widget-open').addClass('side-widget-closed');
6696
6697	return false;
6698});
6699
6700function slideOutWidgetOverflowState() {
6701
6702
6703	//switch position of social media/extra info based on screen size
6704	if(window.innerWidth < 1000 || $('body > #boxed').length > 0) {
6705		$('#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');
6706		$('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner');
6707	} else {
6708		$('#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');
6709		$('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap');
6710	}
6711
6712	//add overflow
6713	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'); }
6714	else { $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').removeClass('overflow-state'); }
6715
6716	$('#slide-out-widget-area[class*="fullscreen"] .inner').transition({ y : '-' + ($('#slide-out-widget-area[class*="fullscreen"] .inner').height()/2) + 'px' },0);
6717
6718	//close mobile only slide out widget area if switching back to desktop
6719	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');
6720
6721}
6722
6723
6724function fullWidthHeaderSlidingWidgetMenuCalc() {
6725	$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': $(window).width() - 360, 'left': '300px' },700,'easeInOutCubic');
6726}
6727
6728//slide out widget area scrolling 
6729function slideOutWidgetAreaScrolling(){ 
6730	$('#slide-out-widget-area').mousewheel(function(event, delta) {
6731
6732	     this.scrollTop -= (delta * 30);
6733	    
6734	     event.preventDefault();
6735
6736	});
6737}
6738setTimeout(slideOutWidgetAreaScrolling,500);
6739
6740
6741//handle mobile scrolling
6742if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
6743	$('#slide-out-widget-area').addClass('mobile');
6744}
6745
6746
6747function closeOCM(item) {
6748    if($('#slide-out-widget-area.open').length > 0) {
6749
6750    	var $windowCurrentLocation = window.location.href.split("#")[0];
6751		var $windowClickedLocation = item.find('> a').attr('href').split("#")[0];
6752
6753    	if($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) 
6754        $('.slide-out-widget-area-toggle a').trigger('click');
6755    }
6756}
6757
6758
6759//left header
6760function leftHeaderSubmenus() {
6761
6762	//remove megamenu class
6763	$('#header-outer nav li.megamenu').removeClass('megamenu');
6764
6765	//click
6766	$('#header-outer li.menu-item-has-children > a').click(function(){
6767
6768		if($(this).parent().hasClass('open-submenu')) {
6769			$(this).parent().find('.sub-menu').css({
6770				'max-height' : '0'
6771			});
6772			$(this).parent().removeClass('open-submenu');
6773		}
6774		else {
6775
6776			//get max height
6777
6778			var $that = $(this);
6779			var $maxSubMenuHeight;
6780
6781			$that.parent().find('> .sub-menu').addClass('no-trans');
6782
6783			setTimeout(function(){
6784
6785				$that.parent().find('> .sub-menu').css({
6786					'max-height' : 'none',
6787					'position' : 'absolute',
6788					'visibility' : 'hidden'
6789				});
6790				
6791				$maxSubMenuHeight =  $that.parent().find('> .sub-menu').height();
6792
6793				$that.parent().find('> .sub-menu').removeClass('no-trans');
6794				$that.parent().find('> .sub-menu').css({
6795					'max-height' : '0',
6796					'position' : 'relative',
6797					'visibility' : 'visible'
6798				});
6799
6800			},25);
6801
6802			setTimeout(function(){
6803				
6804				//reset
6805				$that.closest('ul').find('li.menu-item-has-children').removeClass('open-submenu');
6806				$that.closest('ul').find('li.menu-item-has-children > .sub-menu').css({
6807					'max-height' : '0'
6808				});
6809
6810				$that.parent().addClass('open-submenu');
6811
6812				$that.parent().find('> .sub-menu').css('max-height', $maxSubMenuHeight);
6813
6814				//add height to open parents
6815				if($that.parents('ul').length > 0) {
6816
6817					$that.parents('ul:not(.sf-menu)').each(function(){
6818						$(this).css('max-height');
6819						$(this).css('max-height', parseInt($(this).height() + parseInt($(this).css('padding-top'))*2 + $maxSubMenuHeight)+'px');
6820					});
6821				} 
6822					
6823
6824			},50);
6825		}
6826		return false;
6827	});
6828	
6829	//start open for current page items
6830	var $maxSubMenuHeightArr = [];
6831
6832	$('.current-menu-ancestor').find('.current-menu-item').parents('ul.sub-menu').each(function(i){
6833
6834		
6835
6836		$maxSubMenuHeightArr[i] =  $(this).parent().find('> .sub-menu').height();
6837
6838
6839		var $that = $(this);
6840		setTimeout(function(){
6841
6842			var $totalSubMenuHeight = 0;
6843
6844			for(var $i=0; $i < $maxSubMenuHeightArr.length; $i++) {
6845				$totalSubMenuHeight += parseInt($maxSubMenuHeightArr[i]);
6846			}
6847	
6848			$that.parent().addClass('open-submenu');
6849			$that.css('max-height', $totalSubMenuHeight);
6850
6851		},40);
6852	});
6853}
6854
6855if($('#header-outer[data-format="left-header"]').length > 0)
6856	leftHeaderSubmenus();
6857
6858
6859//fullscreen submenu
6860
6861
6862/**
6863 * jquery.dlmenu.js v1.0.1
6864 * http://www.codrops.com
6865 *
6866 * Licensed under the MIT license.
6867 * http://www.opensource.org/licenses/mit-license.php
6868 * 
6869 * Copyright 2013, Codrops
6870 * http://www.codrops.com
6871 */
6872;( function( $, window, undefined ) {
6873
6874	'use strict';
6875
6876	// global
6877	var Modernizr = window.Modernizr, $body = $( 'body' );
6878
6879	$.DLMenu = function( options, element ) {
6880		this.$el = $( element );
6881		this._init( options );
6882	};
6883
6884	// the options
6885	$.DLMenu.defaults = {
6886		// classes for the animation effects
6887		animationClasses : { classin : 'dl-animate-in-1', classout : 'dl-animate-out-1' },
6888		// callback: click a link that has a sub menu
6889		// el is the link element (li); name is the level name
6890		onLevelClick : function( el, name ) { return false; },
6891		// callback: click a link that does not have a sub menu
6892		// el is the link element (li); ev is the event obj
6893		onLinkClick : function( el, ev ) { return false; }
6894	};
6895
6896	$.DLMenu.prototype = {
6897		_init : function( options ) {
6898
6899			// options
6900			this.options = $.extend( true, {}, $.DLMenu.defaults, options );
6901			// cache some elements and initialize some variables
6902			this._config();
6903			
6904			var animEndEventNames = {
6905					'WebkitAnimation' : 'webkitAnimationEnd',
6906					'OAnimation' : 'oAnimationEnd',
6907					'msAnimation' : 'MSAnimationEnd',
6908					'animation' : 'animationend'
6909				},
6910				transEndEventNames = {
6911					'WebkitTransition' : 'webkitTransitionEnd',
6912					'MozTransition' : 'transitionend',
6913					'OTransition' : 'oTransitionEnd',
6914					'msTransition' : 'MSTransitionEnd',
6915					'transition' : 'transitionend'
6916				};
6917			// animation end event name
6918			this.animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' ) ] + '.menu';
6919			// transition end event name
6920			this.transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ] + '.menu',
6921			// support for css animations and css transitions
6922			this.supportAnimations = Modernizr.cssanimations,
6923			this.supportTransitions = Modernizr.csstransitions;
6924
6925			this._initEvents();
6926
6927		},
6928		_config : function() {
6929			this.open = false;
6930			this.$trigger = this.$el.children( '.trigger' );
6931			this.$menu = this.$el.children( 'ul.menu' );
6932			this.$menuitems = this.$menu.find( 'li:not(.back) > a' );
6933			this.$el.find( 'ul.sub-menu' ).prepend( '<li class="back"><a href="#"> '+$('#slide-out-widget-area').attr('data-back-txt')+' </a></li>' );
6934			this.$back = this.$menu.find( 'li.back' );
6935		},
6936		_initEvents : function() {
6937
6938			var self = this;
6939
6940			this.$trigger.on( 'click.menu', function() {
6941				
6942				if( self.open ) {
6943					self._closeMenu();
6944				} 
6945				else {
6946					self._openMenu();
6947				}
6948				return false;
6949
6950			} );
6951			
6952			this.$menuitems.on( 'click.menu', function( event ) {
6953				
6954				//event.stopPropagation();
6955
6956				var $item = $(this).parent('li'),
6957					$submenu = $item.children( 'ul.sub-menu' );
6958
6959				$('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration','0s');	
6960	
6961				//exit if clicking on background LI (avoids effect wrongly triggering)
6962				//if( $item.find('> a').length > 0 && $item.find('> a').css('display') === 'none') return false;
6963			
6964				if( $submenu.length > 0 ) {
6965
6966					var $flyin = $submenu.clone().css( 'opacity', 0 ).insertAfter( self.$menu ),
6967						onAnimationEndFn = function() {
6968							self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classout ).addClass( 'subview' );
6969							$item.addClass( 'subviewopen' ).parents( '.subviewopen:first' ).removeClass( 'subviewopen' ).addClass( 'subview' );
6970							$flyin.remove();
6971							setTimeout(function(){
6972								$('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
6973								$('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration','.45s');
6974							},300);
6975							
6976			
6977						};
6978
6979					setTimeout( function() {
6980						$flyin.addClass( self.options.animationClasses.classin );
6981						self.$menu.addClass( self.options.animationClasses.classout );
6982						if( self.supportAnimations ) {
6983							self.$menu.on( self.animEndEventName, onAnimationEndFn );
6984						}
6985						else {
6986							onAnimationEndFn.call();
6987						}
6988
6989						self.options.onLevelClick( $item, $item.children( 'a:first' ).text() );
6990					} );
6991
6992
6993					//adjust height for mobile / widgets below
6994					$item.parents('.off-canvas-menu-container').css('height',$item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({ 'height': $flyin.height() },500,'easeInOutQuad' );
6995
6996
6997					return false;
6998
6999				}
7000				else {
7001		
7002					self.options.onLinkClick( $item.find('> a'), event );
7003				}
7004
7005				closeOCM($item);
7006
7007			});
7008
7009			
7010
7011
7012			this.$back.on( 'click.menu', function( event ) {
7013				
7014				var $this = $( this ),
7015					$submenu = $this.parents( 'ul.sub-menu:first' ),
7016					$item = $submenu.parent(),
7017
7018					$flyin = $submenu.clone().insertAfter( self.$menu );
7019
7020				var onAnimationEndFn = function() {
7021					self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classin );
7022					$flyin.remove();
7023				};
7024
7025				setTimeout( function() {
7026					$flyin.addClass( self.options.animationClasses.classout );
7027					self.$menu.addClass( self.options.animationClasses.classin );
7028					if( self.supportAnimations ) {
7029						self.$menu.on( self.animEndEventName, onAnimationEndFn );
7030					}
7031					else {
7032						onAnimationEndFn.call();
7033					}
7034
7035					$item.removeClass( 'subviewopen' );
7036					
7037					var $subview = $this.parents( '.subview:first' );
7038					if( $subview.is( 'li' ) ) {
7039						$subview.addClass( 'subviewopen' );
7040					}
7041					$subview.removeClass( 'subview' );
7042				} );
7043
7044		
7045				//adjust height for mobile / widgets below
7046				$item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height())
7047				setTimeout(function() { 
7048					$item.parents('.off-canvas-menu-container').transition({ 'height': $item.parent().height() },500,'easeInOutQuad');
7049				},50);
7050
7051
7052				return false;
7053
7054			} );
7055			
7056		},
7057		closeMenu : function() {
7058			if( this.open ) {
7059				this._closeMenu();
7060			}
7061		},
7062		_closeMenu : function() {
7063			var self = this,
7064				onTransitionEndFn = function() {
7065					self.$menu.off( self.transEndEventName );
7066					self._resetMenu();
7067				};
7068			
7069			this.$menu.removeClass( 'menuopen' );
7070			this.$menu.addClass( 'menu-toggle' );
7071			this.$trigger.removeClass( 'active' );
7072			
7073			if( this.supportTransitions ) {
7074				this.$menu.on( this.transEndEventName, onTransitionEndFn );
7075			}
7076			else {
7077				onTransitionEndFn.call();
7078			}
7079
7080			this.open = false;
7081		},
7082		openMenu : function() {
7083			if( !this.open ) {
7084				this._openMenu();
7085			}
7086		},
7087		_openMenu : function() {
7088			var self = this;
7089			// clicking somewhere else makes the menu close
7090			$body.off( 'click' ).on( 'click.menu', function() {
7091				self._closeMenu() ;
7092			} );
7093			this.$menu.addClass( 'menuopen menu-toggle' ).on( this.transEndEventName, function() {
7094				$( this ).removeClass( 'menu-toggle' );
7095			} );
7096			this.$trigger.addClass( 'active' );
7097			this.open = true;
7098		},
7099		// resets the menu to its original state (first level of options)
7100		_resetMenu : function() {
7101			this.$menu.removeClass( 'subview' );
7102			this.$menuitems.removeClass( 'subview subviewopen' );
7103		}
7104	};
7105
7106	var logError = function( message ) {
7107		if ( window.console ) {
7108			window.console.error( message );
7109		}
7110	};
7111
7112	$.fn.dlmenu = function( options ) {
7113		if ( typeof options === 'string' ) {
7114			var args = Array.prototype.slice.call( arguments, 1 );
7115			this.each(function() {
7116				var instance = $.data( this, 'menu' );
7117				if ( !instance ) {
7118					logError( "cannot call methods on menu prior to initialization; " +
7119					"attempted to call method '" + options + "'" );
7120					return;
7121				}
7122				if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
7123					logError( "no such method '" + options + "' for menu instance" );
7124					return;
7125				}
7126				instance[ options ].apply( instance, args );
7127			});
7128		} 
7129		else {
7130			this.each(function() {	
7131				var instance = $.data( this, 'menu' );
7132				if ( instance ) {
7133					instance._init();
7134				}
7135				else {
7136					instance = $.data( this, 'menu', new $.DLMenu( options, this ) );
7137				}
7138			});
7139		}
7140		return this;
7141	};
7142
7143} )( jQuery, window );
7144
7145function fullscreenMenuInit() {
7146	$('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />');
7147	$('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen');
7148	$ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0) ? '4' : '5';
7149	$('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({ animationClasses : { classin : 'dl-animate-in-'+$ocmAnimationClassNum, classout : 'dl-animate-out-'+$ocmAnimationClassNum } });
7150
7151	//for slide out right, verify no link ares multiple lines, if so - remove effect
7152	$('#slide-out-widget-area.slide-out-from-right-hover .off-canvas-menu-container .menu > li').each(function(){
7153
7154		if($(this).find('a').length > 0) {
7155				
7156			var $ocmLinkHeight = $(this).find('a').height();
7157			var $ocmLinkLineHeight = parseFloat($(this).find('a').css('line-height'));
7158			var $ocmTextLines = $ocmLinkHeight / $ocmLinkLineHeight;
7159			if(Math.round($ocmTextLines) > 1) {
7160				$(this).parents('.slide-out-from-right-hover').addClass('no-text-effect');
7161				return false;
7162			}
7163			
7164		}
7165
7166	});
7167
7168	//add fullscreen alt text effect 
7169	setTimeout(function(){
7170		$('#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(){
7171
7172			var $menuItemText = $(this).find('> a').html();
7173			$(this).find('> a ').html($menuItemText.replace(/ /g, "&nbsp;"));
7174			$(this).find('> a').append('<span class="clip-wrap"><span>'+$(this).find('> a').text()+'</span></span>');
7175		});
7176	},500);
7177
7178
7179	$('body').on('mouseover','#slide-out-widget-area.fullscreen-alt .menu li a',function(){
7180		var $that = $(this);
7181
7182		$(this).find('> .clip-wrap').css({'transition-duration': '0s' });
7183		$(this).find('> .clip-wrap span ').css({'transition-duration': '0s' });
7184
7185	
7186			$that.find('> .clip-wrap').css({'width':'0%', 'transform':'translateX(0%)' });
7187			$that.find('> .clip-wrap span').css({'transform':'translateX(0%)' });
7188
7189		setTimeout(function(){
7190
7191			$that.find('> .clip-wrap').css({'transition-duration': '0.45s' });
7192
7193			$that.find('> .clip-wrap').css({'width':'100%', 'left': '0', 'right': 'auto' });
7194			//$that.find('> .clip-wrap span').css({'transform':'translateX(0%)'});
7195		},50);
7196		
7197		
7198	});
7199	$('body').on('mouseleave','#slide-out-widget-area.fullscreen-alt .menu li a',function(){
7200
7201		var $that = $(this);
7202
7203		$(this).find('> .clip-wrap').css({'transition-duration': '0s' });
7204		$(this).find('> .clip-wrap span ').css({'transition-duration': '0s' });
7205
7206		
7207		$that.find('> .clip-wrap').css({'width':'100%', 'transform':'translateX(0%)' });
7208		$that.find('> .clip-wrap span').css({'transform':'translateX(0%)' });
7209
7210
7211		$that.find('> .clip-wrap').css({'transition-duration': '0.45s' });
7212		$that.find('> .clip-wrap span').css({'transition-duration': '0.45s' });
7213
7214		$that.find('> .clip-wrap').css({'transform':'translateX(100%)'});
7215		$that.find('> .clip-wrap span').css({'transform':'translateX(-100%)'});
7216		
7217
7218	});
7219}
7220fullscreenMenuInit();
7221
7222//submenu link hover fix
7223$('body').on('mouseover','#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a',function(){
7224	var $currentTxt = $(this).text();
7225	$('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
7226	$('.off-canvas-menu-container .menuwrapper .menu li > a:contains('+$currentTxt+')').addClass('hovered');
7227});
7228$('body').on('mouseover','.off-canvas-menu-container .menuwrapper .menu li > a',function(){
7229	$('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
7230});
7231
7232
7233
7234/***************** Page Headers ******************/
7235
7236var pageHeaderHeight;
7237var pageHeaderHeightCopy;
7238var pageHeadingHeight;
7239var extraSpaceFromResize = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.nectar-box-roll').length == 0) ? 51 : 1;
7240var $headerRemoveStickyness = ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0) ? 1 : 0;
7241
7242//full screen header
7243function fullScreenHeaderInit(){
7244
7245	pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
7246	pageHeaderHeightCopy = parseInt($('#page-header-bg').attr('data-height'));
7247
7248	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && window.innerWidth > 1000) ? 0 : $('#header-outer').height();
7249
7250	if($('.fullscreen-header').length > 0) {
7251
7252		if($('#header-outer[data-transparency-option]').length > 0 && $('#header-outer').attr('data-transparency-option') != '0'){
7253			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() : $(window).height() - parseInt($headerNavSpace) ;
7254		} else {
7255			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() - parseInt($headerNavSpace) + extraSpaceFromResize : $(window).height() - parseInt($headerNavSpace) ;
7256		}
7257		var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
7258		if($('.nectar-box-roll').length > 0) extraHeight = 0;
7259		pageHeaderHeight =   calculatedNum  - extraHeight; 
7260		pageHeaderHeightCopy = calculatedNum - extraHeight; 
7261	}
7262
7263	$('#page-header-bg').css('height',pageHeaderHeight+'px').removeClass('not-loaded');
7264	setTimeout(function(){ $('#page-header-bg').css('overflow','visible') },800);
7265
7266}
7267
7268fullScreenHeaderInit();
7269
7270function pageHeader(){
7271	
7272	//add loaded class
7273	$('#page-header-bg[data-animate-in-effect="zoom-out"]').addClass('loaded');
7274
7275	var $scrollTop = 0;
7276	var $windowInnerWidth = window.innerWidth;
7277	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $windowInnerWidth > 1000) ? 0 : $('#header-outer').height();
7278	var $windowHeight = $(window).height();
7279
7280	//full screen header
7281	if($('.fullscreen-header').length > 0) {
7282		if($('#header-outer[data-transparency-option]').length > 0 && $('#header-outer').attr('data-transparency-option') != '0'){
7283			var calculatedNum = (!$('body').hasClass('mobile')) ? $windowHeight : $windowHeight - parseInt($headerNavSpace) ;
7284			if($('body[data-permanent-transparent="1"]').length > 0) calculatedNum = $windowHeight;
7285		} else {
7286			var calculatedNum = (!$('body').hasClass('mobile')) ? $windowHeight - parseInt($headerNavSpace) + extraSpaceFromResize : $windowHeight - parseInt($headerNavSpace);
7287		}
7288		var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
7289		if($('.nectar-box-roll').length > 0) extraHeight = 0;
7290		pageHeaderHeight =   calculatedNum  - extraHeight; 
7291		pageHeaderHeightCopy = calculatedNum - extraHeight; 
7292	}
7293
7294	if( $windowInnerWidth < 1000 && $windowInnerWidth > 690 && !$('body').hasClass('salient_non_responsive') ) {
7295		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 1.6;
7296		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
7297		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
7298		
7299	} else if( $windowInnerWidth <= 690 && $windowInnerWidth > 480 && !$('body').hasClass('salient_non_responsive')) {
7300		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 2.1;
7301		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
7302		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
7303		
7304	} else if( $windowInnerWidth <= 480 && !$('body').hasClass('salient_non_responsive')) {
7305		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 2.5;
7306		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
7307		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
7308		
7309	} else {
7310		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy).css('height',pageHeaderHeightCopy +'px');
7311		if($('.fullscreen-header').length > 0){
7312			$('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
7313		} else {
7314			$('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
7315		}
7316
7317		if($('#page-header-bg[data-parallax="1"]').length == 0) $('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
7318	}
7319
7320
7321	//handle left header 
7322	if($('body[data-header-format="left-header"]').length > 0 ) $('#page-header-bg[data-parallax="1"]').css('width',$('#ajax-content-wrap').width())
7323	
7324	
7325	if(!$('body').hasClass('mobile')){
7326		
7327		//recalc
7328		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
7329		$('#page-header-bg .container > .row').css('top',0);
7330		var $divisionMultipler = ($('#header-outer[data-remove-border="true"]').length > 0 && $('#header-outer[data-format="centered-menu-under-logo"]').length == 0) ? 2 : 1;
7331
7332		//center the heading
7333		pageHeadingHeight = $('#page-header-bg .col.span_6').height();
7334		
7335		if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.fullscreen-header').length == 0) {
7336			$('#page-header-bg:not("[data-parallax=1]") .col.span_6').css('top', ((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2));
7337		} else {
7338			var $extraResizeHeight = ($('#header-outer[data-header-resize="1"]').length > 0) ? 22: 0;
7339			$('#page-header-bg:not("[data-parallax=1]") .col.span_6').css('top', (pageHeaderHeight/2) - (pageHeadingHeight/2) + $extraResizeHeight);
7340		}
7341		
7342		//center portfolio filters
7343		$('#page-header-bg:not("[data-parallax=1]") .portfolio-filters').css('top', (pageHeaderHeight/2) + 2);	
7344		
7345		if($('#page-header-bg[data-parallax="1"]').length > 0) {
7346			$scrollTop = $(window).scrollTop();
7347		}
7348
7349		if($('#page-header-bg[data-parallax="1"] .span_6').css('opacity') > 0) {
7350			
7351			if($('#header-outer[data-transparent-header="true"]').length > 0 && $('body.single-post .fullscreen-header').length == 0) {
7352				//center the parallax heading
7353
7354				if($headerRemoveStickyness) {
7355
7356					$('#page-header-bg[data-parallax="1"] .span_6').css({ 
7357						'top' : (((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2)) +"px"
7358				    });
7359				    
7360				    //center parllax portfolio filters
7361				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
7362						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
7363				    });
7364
7365				} else {
7366					$('#page-header-bg[data-parallax="1"] .span_6').css({ 
7367						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+60)),
7368						'top' : (((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2)) +"px"
7369				    });
7370				    
7371				    //center parllax portfolio filters
7372				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
7373						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
7374						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
7375				    });
7376				}
7377			    
7378		  } else {
7379
7380		  		if($headerRemoveStickyness) {
7381			  		//center the parallax heading
7382				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
7383						'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
7384				    });
7385				    
7386				    //center parllax portfolio filters
7387				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
7388						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
7389				    });
7390				} else {
7391					//center the parallax heading
7392				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
7393						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+60)),
7394						'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
7395				    });
7396				    
7397				    //center parllax portfolio filters
7398				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
7399						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
7400						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
7401				    });
7402				}
7403		  }
7404	   }
7405	}
7406	
7407	else {
7408		//recalc
7409		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
7410		
7411		//center the heading
7412		var pageHeadingHeight = $('#page-header-bg .container > .row').height();
7413		$('#page-header-bg .container > .row').css('top', (pageHeaderHeight/2) - (pageHeadingHeight/2) + 5);
7414		
7415	}
7416
7417
7418	$('#page-header-bg .container > .row').css('visibility','visible');
7419}
7420
7421var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0; 
7422
7423if($('#page-header-bg').length > 0) { 
7424	setTimeout(function(){ pageHeader(); },$pt_timeout);
7425}
7426
7427
7428if($('#header-outer').attr('data-header-resize') == '' || $('#header-outer').attr('data-header-resize') == '0'){
7429	$('#page-header-wrap').css('margin-top','0');
7430}
7431
7432
7433function extractUrl(input) {
7434	return input.replace(/"/g,"").replace(/url\(|\)$/ig, "");
7435}
7436 
7437/***************** Parallax Page Headers ******************/
7438if($('#page-header-bg[data-parallax="1"]').length > 0) {
7439
7440	//fadeIn
7441
7442	var img = new Image();
7443	
7444	var imgX, imgY, aspectRatio;
7445	var diffX, diffY;
7446	var pageHeadingHeight = $('#page-header-bg .col.span_6').height();
7447	var pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
7448	var headerPadding2 = parseInt($('#header-outer').attr('data-padding'))*2;
7449	var wooCommerceHeader = ($('.demo_store').length > 0) ? 32 : 0 ;
7450	
7451	
7452	var $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
7453	
7454	if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) {    
7455		img.onload = function() {
7456		   pageHeaderInit(); 
7457		}
7458		
7459		img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
7460		
7461	} else {
7462		 pageHeaderInit();
7463	}
7464	
7465	
7466	
7467	var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
7468
7469
7470	 if($('body[data-hhun="1"]').length > 0 && !$('#header-outer[data-remove-fixed="1"]').length > 0)  $('#header-outer').addClass('parallax-contained');
7471
7472	 window.addEventListener('scroll', function(){ 
7473        window.requestAnimationFrame(bindHeaderParallax);
7474    }, false);
7475
7476}
7477
7478					
7479function bindHeaderParallax(){
7480
7481	var $scrollTop = $(window).scrollTop();
7482	var pageHeadingHeight = $('#page-header-bg .col.span_6').height();
7483	
7484	
7485	if(!$('body').hasClass('mobile') && navigator.userAgent.match(/iPad/i) == null){
7486
7487		var $multiplier1 =  ($('body[data-hhun="1"]').length > 0) ? 0.40: 0.2;
7488   	    var $multiplier2 = ($('body[data-hhun="1"]').length > 0) ? 0.09: 0.14;
7489   	    var $parallaxHeaderHUN = ($('#header-outer[data-transparency-option="1"]').length > 0) ? 0.49: 0.4;
7490
7491		//calc bg pos
7492		//$('#page-header-bg[data-parallax="1"]').css({'top': ((- $scrollTop / 5)+logoHeight+headerPadding+headerResizeOffExtra+extraHeight-extraDef+secondaryHeader)  + 'px' });
7493		if($('#page-header-bg.out-of-sight').length == 0) {
7494
7495			if($headerRemoveStickyness) {
7496				$('#page-header-bg[data-parallax="1"]').css({ 'transform': 'translateY('+ $scrollTop*-0.55 +'px)' });	
7497			} else {
7498				$('#page-header-bg[data-parallax="1"]').css({ 'transform': 'translateY('+ $scrollTop*-$multiplier1 +'px)' });
7499			}
7500
7501			var multipler = ($('body').hasClass('single')) ? 1 : 2;
7502			if(!$headerRemoveStickyness) {
7503				$('#page-header-bg[data-parallax="1"] .span_6,  #page-header-bg[data-parallax="1"][data-post-hs="default_minimal"] .author-section').css({ 
7504					'opacity' : 1-($scrollTop/(pageHeaderHeight-60))
7505				});
7506			}
7507			
7508			if($headerRemoveStickyness) {
7509				$('#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)' });
7510			} else {
7511				$('#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)' });
7512			}
7513			
7514			if($('#page-header-bg[data-parallax="1"] .span_6').css('opacity') == 0){
7515				$('#page-header-bg[data-parallax="1"] .span_6, #page-header-bg[data-parallax="1"] .portfolio-filters').hide();
7516			} else {
7517				$('#page-header-bg[data-parallax="1"] .span_6, #page-header-bg[data-parallax="1"] .portfolio-filters').show();
7518			}
7519
7520			if($('body[data-hhun="1"]').length > 0  && !$('#header-outer').hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) { 
7521	            $('#header-outer.parallax-contained').css({ 'transform': 'translateY('+$scrollTop*-$parallaxHeaderHUN+'px)' });
7522	        }
7523			
7524		
7525		}
7526		else if($('#page-header-bg.out-of-sight').length == 0) {
7527			//alt parallax effect
7528			var multipler = ($('body').hasClass('single')) ? 1 : 2;
7529			$('#page-header-wrap .nectar-particles .fade-out').css({ 
7530				'opacity' : 0+($scrollTop/(pageHeaderHeight+pageHeaderHeight*$multiplier))
7531			});
7532		}
7533
7534
7535		//hide elements to allow other parallax sections to work in webkit browsers
7536		if( ($scrollTop / (pageHeaderHeight + $('#header-space').height() + extraHeight)) > 1 ) {
7537			$('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility','hidden').hide().addClass('out-of-sight');
7538		}
7539		else {
7540		 	$('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility','visible').show().removeClass('out-of-sight');
7541
7542		 		//ensure header is centered
7543		 		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
7544				$('#page-header-bg .container > .row').css('top',0);
7545				var $divisionMultipler = ($('#header-outer[data-remove-border="true"]').length > 0 && $('#header-outer[data-format="centered-menu-under-logo"]').length == 0) ? 2 : 1;
7546				pageHeadingHeight = $('#page-header-bg .col.span_6').height();
7547
7548				if($('#header-outer[data-transparent-header="true"]').length > 0 && $('body.single-post .fullscreen-header').length == 0) {
7549					//center the parallax heading
7550				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
7551						'top' : (((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2)) +"px"
7552				    });
7553
7554			  	} else {
7555			  		//center the parallax heading
7556				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
7557						'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
7558				    });
7559			  	}
7560	    }
7561		
7562
7563	}
7564
7565}
7566
7567if($('#page-header-bg').length > 0) {
7568	var $initialImgCheckAscend = extractUrl($('#page-header-bg').css('background-image'));
7569	if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) {    
7570		   $('#page-header-bg').addClass('has-bg');
7571	}
7572}
7573
7574
7575function pageHeaderInit(){
7576
7577	 var wooCommerceHeader = ($('.demo_store').length > 0) ? 32 : 0 ;
7578	 var centeredNavAltSpace = ($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) ? $('header#top nav > .sf-menu').height() -20 : null;
7579	 //transparent
7580	  if($('#header-outer[data-transparent-header="true"]').length > 0) {	
7581	     $('#page-header-bg[data-parallax="1"]').css({'top': extraHeight+wooCommerceHeader });
7582	  } else {
7583
7584	  	 var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
7585		 var headerPadding = parseInt($('#header-outer').attr('data-padding'));
7586		 var headerPadding2 = parseInt($('#header-outer').attr('data-padding'));
7587		 var extraDef = 10;
7588		 var headerResize = ($('body').hasClass('pp-video-function')) ? '1' : $('#header-outer').attr('data-header-resize');
7589		 var headerResizeOffExtra = 0;
7590		 var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
7591		 var usingLogoImage = true;
7592	     var mediaElement = ($('.wp-video-shortcode').length > 0) ? 36 : 0;
7593	     var secondaryHeader = ($('#header-outer').attr('data-using-secondary') == '1') ? 32 : 0 ;
7594	  	 if($('body[data-header-resize="0"]').length == 0) $('#page-header-bg[data-
7594parallax="1"]').css({'top': (logoHeight+headerPadding+centeredNavAltSpace+headerResizeOffExtra+extraHeight-extraDef+secondaryHeader+wooCommerceHeader)  + 'px' });
7595	  }
7596	  
7597	  //fade in header
7598	  if($('#ajax-content-wrap').length == 0 || !$('body').hasClass('ajax-loaded')){
7599	  	$('#page-header-bg[data-parallax="1"]').animate({ 'opacity' : 1},650,'easeInCubic');
7600	  } else if($('#ajax-content-wrap').length == 1) {
7601	  	$('#page-header-bg[data-parallax="1"]').css({ 'opacity' : 1});
7602	  }
7603
7604	  //$('#page-header-wrap').css({'height' : pageHeaderHeight});
7605	  
7606	  //verify smooth scorlling
7607	  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') } 
7608	  
7609	  /* $('#page-header-bg[data-parallax="1"] .span_6').css({ 
7610			'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+60))
7611			'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
7612	   });
7613	   
7614	   $('#page-header-bg[data-parallax="1"] #portfolio-filters').css({ 
7615			'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
7616			'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
7617	   }); */
7618	  
7619	  $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />');
7620}
7621
7622
7623
7624
7625function nectarPageHeader() {
7626
7627	if($('#page-header-bg').length > 0) {
7628		fullScreenHeaderInit();
7629		pageHeader();
7630	}
7631
7632
7633	if($('#page-header-bg[data-parallax="1"]').length > 0) {
7634
7635		var img = new Image();
7636		var $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
7637			
7638		if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) {    
7639			img.onload = function() {
7640			   pageHeaderInit();    
7641					
7642			}
7643			
7644			img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
7645			
7646		} else {
7647			 pageHeaderInit();
7648		}
7649
7650		//bindHeaderParallax();
7651		$('#page-header-bg[data-parallax="1"] .span_6').css({ 
7652			'opacity' : 1
7653		});
7654
7655		
7656
7657		if (window.addEventListener) {
7658			 window.addEventListener('scroll', function(){ 
7659	          requestAnimationFrame(bindHeaderParallax); 
7660	        }, false);
7661		}
7662
7663	} 
7664
7665	if($('#page-header-bg').length > 0) {
7666		var $initialImgCheckAscend = extractUrl($('#page-header-bg').css('background-image'));
7667		if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) {    
7668			   $('#page-header-bg').addClass('has-bg');
7669		}
7670	}
7671}
7672
7673if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
7674	window.onunload = function(){ nectarPageHeader(); };
7675}
7676
7677
7678/***************** header text effects *****************/
7679
7680// rotate in
7681function pageHeaderTextEffectInit() {
7682	$('#page-header-bg').each(function(){
7683		if($(this).attr('data-text-effect') == 'rotate_in') {
7684			var $topHeading = 'none';
7685
7686			if($(this).find('.span_6 h1').length > 0) {
7687				$topHeading = 'h1';
7688			} 
7689			//else if ($(this).find('.span_6 h2').length > 0) {
7690			//	$topHeading = 'h2';
7691			//}
7692
7693			if($topHeading != 'none') {
7694
7695				var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6';
7696
7697				$(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () {
7698			        return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, "");
7699			    }).wrap('<span class="wraped"></span>');
7700
7701			    $(this).find($selector).find('.wraped').each(function () {
7702
7703				    textNode = $(this);
7704
7705				    text = textNode.text().split(' ');
7706				    replace = '';
7707
7708				    $.each(text, function (index, value) {
7709				        if (value.replace(/\s+/, "")) {
7710				            replace += '<span class="wraped"><span>' + value + '</span></span> ';
7711				        }
7712				    });
7713				    textNode.replaceWith($(replace));
7714				    
7715				});
7716			}//make sure suitable heading was found
7717
7718		}//tilt
7719	});
7720	
7721}
7722function pageHeaderTextEffect() {
7723
7724	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) {
7725
7726		var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6';
7727
7728		$($selector).find('.wraped').each(function(i){
7729			$(this).find('span').delay(i*370).transition({ rotateX: '0', 'opacity' : 1, y: 0},400,'easeOutQuad');
7730		});
7731
7732		setTimeout(function(){
7733
7734			$($selector).find('.inner-wrap > *:not(.top-heading)').each(function(i){
7735				$(this).delay(i*370).transition({ rotateX: '0', 'opacity' : 1, y: 0 },650,'easeOutQuad');
7736			});
7737
7738			$('.scroll-down-wrap').removeClass('hidden');
7739
7740		}, $($selector).find('.wraped').length * 370);
7741	}
7742
7743}
7744var $effectTimeout = ($('#ajax-loading-screen').length > 0) ? 800 : 0;
7745pageHeaderTextEffectInit();
7746if($('#page-header-bg .nectar-video-wrap video').length == 0) setTimeout(pageHeaderTextEffect,$effectTimeout);
7747
7748
7749
7750
7751 //submenu fix
7752  if($('header#top nav > ul.sf-menu ul').length > 0) {
7753
7754  	var $midnightSubmenuTimeout;
7755  	$('body').on('mouseover','#header-outer .midnightHeader .sf-with-ul, #header-outer .midnightHeader .cart-menu',function(){
7756
7757  		if($(this).parents('.midnightHeader').offset().top - $(window).scrollTop() < 50){
7758  		
7759  			$(this).parents('.midnightHeader').css({'z-index': '9999'}).addClass('overflow');
7760  			$(this).parents('.midnightInner').css('overflow','visible');
7761  		}
7762  	});
7763  	$('body').on('mouseleave','#header-outer .midnightHeader',function(){
7764  		var $that = $(this);
7765  		clearTimeout($midnightSubmenuTimeout);
7766  		$midnightSubmenuTimeout = setTimeout(function(){
7767  			if(!$that.is(':hover')) {
7768  				$that.css({'z-index': 'auto'}).removeClass('overflow');
7769  				$that.find('.midnightInner').css('overflow','hidden');
7770  		
7771  			}
7772
7773  		},900);
7774  	});
7775  }
7776
7777  function midnightInit() {
7778  	if( $('#header-outer[data-permanent-transparent="1"]').length > 0 && $('body[data-bg-header="true"]').length > 0) {
7779  		 $('#header-outer').midnight();
7780
7781  	    //set width for left aligned menu
7782  		if($('#header-outer[data-format="menu-left-aligned"] #logo img:visible').length > 0) {
7783  			$('#header-outer #logo').css({'width':$('#header-outer #logo img:visible').width(), 'height': $('#header-outer #logo img:visible').height()});
7784  		}
7785
7786  		 //no menu
7787  		 if($('#header-outer[data-has-menu="false"]').length > 0 && $('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
7788  			 //fix the pointer events
7789  			 //var enableHandler = false;
7790
7791  			 var $buttonsOffset = ($('#social-in-menu').length > 0) ? $('#social-in-menu').position() : $('#header-outer header#top nav > ul.buttons').position();
7792  			 if($('#header-outer #logo img:visible').length > 0) {
7793  			 	var $logoOffset = $('#header-outer #logo img:visible').position();
7794  			 	var $logoOffsetTop = $('#header-outer #logo img:visible').position().top;
7795  			 	var $logoMargin = parseInt($('#header-outer #logo img:visible').css('margin-top'));
7796  			 	var $logoWidth = $('#header-outer #logo img:visible').width(); 
7797
7798  			 } else {
7799  			 	var $logoOffset = $('#header-outer .span_3 #logo:visible').offset();
7800  			 	var $logoOffsetTop = $('#header-outer .span_3 #logo:visible').offset().top - $(window).scrollTop();
7801  			 	var $logoMargin = parseInt($('#header-outer .span_3 #logo:visible').css('margin-top'));
7802  			 	var $logoWidth = $('#header-outer #logo').width();
7803  			 }
7804  			 var $bodyBorderSize = ($('.body-border-top').length > 0) ? $('.body-border-top').height() : 0;
7805
7806  			 var $containerMargin = parseInt($('#header-outer header > .container').css('padding-left'));
7807  			 var $headerOffset = $('#header-outer').position();
7808  			 //recalc offsets
7809  			 $(window).on('smartresize', function(){
7810  			 	if($('#header-outer #logo img').length > 0) {
7811  				 	$logoMargin = parseInt($('#header-outer #logo img:visible').css('margin-top'));
7812  				 	$logoOffset = $('#header-outer #logo img:visible').position();
7813  				 	$logoOffsetTop = $('#header-outer #logo img:visible').position().top;
7814  				 	$logoWidth = $('#header-outer #logo img:visible').width();
7815  				 } else {
7816  				 	$logoMargin = parseInt($('#header-outer .span_3 #logo:visible').css('margin-top'));
7817  				 	$logoOffset = $('#header-outer .span_3 #logo:visible').offset();
7818  				 	$logoOffsetTop = $('#header-outer .span_3 #logo:visible').offset().top - $(window).scrollTop();
7819  				 	$logoWidth = $('#header-outer #logo').width();
7820  				 }
7821  			 	$containerMargin = parseInt($('#header-outer header > .container').css('padding-left'));
7822  			    $buttonsOffset = ($('#social-in-menu').length > 0) ? $('#social-in-menu').position() : $('#header-outer header#top nav > ul.buttons').position();
7823  			    $headerOffset = $('#header-outer').position();
7824  			 });
7825
7826  			 $('body').mousemove(function(e){
7827  			 	if($('body.mobile').length == 0 && $('#header-outer header').length > 0) {
7828  			 	
7829  					 	//hover over buttons || logo check
7830  					 	if(e.clientX >= $buttonsOffset.left + $containerMargin && 
7831  					 	   e.clientY >= $buttonsOffset.top + $bodyBorderSize && 
7832  					 	   e.clientY <= $buttonsOffset.top + $headerOffset.top + $bodyBorderSize + $('#header-outer header#top nav > ul.buttons').height() ||
7833  					 	   e.clientX <= $logoOffset.left + $containerMargin + $logoWidth &&
7834  					 	   e.clientY >= $logoOffsetTop + $bodyBorderSize&& 
7835  					 	   e.clientY <= $logoOffsetTop + $logoMargin + $bodyBorderSize + $headerOffset.top + $('#header-outer #logo img:visible').height() ) {
7836  					 		$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
7837
7838  					 	} else {
7839  					 		$('.midnightHeader, #header-outer').addClass('no-pointer-events');
7840  					 	}
7841
7842  					
7843  				} else {
7844  					$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
7845  				}
7846  			 });
7847
7848  	
7849  		}
7850
7851  		//using menu
7852  		else if($('#header-outer[data-has-menu="true"]').length > 0) {
7853
7854  			 var $headerPos = $('header#top .container').position();
7855  			 var $headerOffset = $('header#top .container').offset();
7856  			 var $bodyBorderSize = ($('.body-border-top').length > 0) ? $('.body-border-top').height() : 0;
7857
7858  			 //recalc offsets
7859  			 $(window).on('smartresize', function(){
7860  			 	
7861  			    $headerPos = $('header#top .container').position();
7862  			    $headerOffset = $('header#top .container').offset();
7863
7864  			 });
7865
7866  			 $('body').mousemove(function(e){
7867  			 	if($('body.mobile').length == 0 && $('#header-outer header').length > 0) {
7868
7869  					 	//hover over buttons || logo check
7870  					 	if(e.clientX >= $headerOffset.left &&
7871  					 	   e.clientY >= $headerPos.top  + $bodyBorderSize && 
7872  					 	   e.clientY <= $('header#top .container .row').height() + $bodyBorderSize) {
7873  					 		$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
7874  					 	} else if($('li.sfHover').length == 0) {
7875  					 		$('.midnightHeader, #header-outer').addClass('no-pointer-events');
7876  					 	}
7877
7878  					
7879  				} else {
7880  					$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
7881  				}
7882  			 });
7883
7884  		}
7885  	}
7886  }
7887
7888
7889
7890//box roll
7891function getScrollbarWidth() {
7892    var outer = document.createElement("div");
7893    outer.style.visibility = "hidden";
7894    outer.style.width = "100px";
7895    outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
7896
7897    document.body.appendChild(outer);
7898
7899    var widthNoScroll = outer.offsetWidth;
7900    // force scrollbars
7901    outer.style.overflow = "scroll";
7902
7903    // add innerdiv
7904    var inner = document.createElement("div");
7905    inner.style.width = "100%";
7906    outer.appendChild(inner);        
7907
7908    var widthWithScroll = inner.offsetWidth;
7909
7910    // remove divs
7911    outer.parentNode.removeChild(outer);
7912
7913    return widthNoScroll - widthWithScroll;
7914}
7915
7916
7917function boxRollInit() {
7918	if($('.nectar-box-roll').length > 0) { 
7919
7920		$('body').attr('data-scrollbar-width',getScrollbarWidth());
7921
7922		$('body, html, #ajax-content-wrap, .container-wrap, .blurred-wrap').addClass('no-scroll');
7923		$('body,html').stop().animate({ scrollTop:0 },0);
7924		$('.container-wrap').css('opacity',0).addClass('no-transform-animation-bottom-out').addClass('bottomBoxOut');
7925		//keep loading icon centered if scrollbar is going away
7926		if($('.mobile').length == 0) $('#ajax-loading-screen .loading-icon > span').css({ 'left' : '-'+getScrollbarWidth()/2 +'px'});
7927
7928		//change content pos
7929		var $overlaid = $('#page-header-bg .overlaid-content').clone();
7930		var $scrollDownOverlaid = $('.scroll-down-wrap').clone();
7931		$('#page-header-bg').removeAttr('data-midnight');
7932		$('#page-header-bg .overlaid-content, #page-header-bg .scroll-down-wrap').remove();
7933		$('.nectar-box-roll').append($overlaid).attr('data-midnight','light');
7934		$('.overlaid-content').append($scrollDownOverlaid);
7935
7936		if($('.page-submenu[data-sticky="true"]').length > 0) {
7937			$('.container-wrap').addClass('no-trans');
7938		}
7939
7940		nectarBoxRollContentHeight();
7941		setTimeout(function() { pageLoadHash(); },700);
7942	} else {
7943		$('#ajax-content-wrap, .blurred-wrap').addClass('at-content');
7944		$('body, html, #ajax-content-wrap, .container-wrap, .blurred-wrap').removeClass('no-scroll');
7945		$('.container-wrap').css('opacity',1).removeClass('no-transform-animation-bottom-out').removeClass('bottomBoxOut').removeClass('bottomBoxIn');
7946		perspect = 'not-rolled';
7947	}
7948}
7949boxRollInit();
7950
7951function nectarBoxRollContentHeight() {
7952	/*if($('#header-outer[data-transparent-header="true"]').length == 0 && $('.mobile').length == 0) {
7953		$('.nectar-box-roll').css('top',$('#header-space').height());
7954	} else {
7955		$('.nectar-box-roll').css('top','0');
7956	}*/
7957	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').height();
7958
7959	if($('#header-outer[data-transparent-header="true"]').length == 0) {
7960		$('.nectar-box-roll .overlaid-content, .nectar-box-roll .canvas-bg, .container-wrap').css({'height':window.innerHeight - $headerNavSpace, 'min-height':window.innerHeight - $headerNavSpace });
7961		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'); }
7962		else $('#ajax-content-wrap, #slide-out-widget-area.fullscreen').css('margin-top','0');
7963	} else {
7964		$('.nectar-box-roll .overlaid-content, .nectar-box-roll .canvas-bg, .container-wrap').css('height',window.innerHeight);
7965	}
7966}
7967
7968if($('.nectar-box-roll').length > 0) $(window).on('resize',nectarBoxRollContentHeight);
7969
7970
7971var perspect = 'not-rolled';
7972var animating = 'false';
7973function boxRoll(e,d) {
7974	
7975	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').height();
7976
7977	if($('#slide-out-widget-area.open').length > 0) return false;
7978	if( $('.nectar-box-roll canvas').length > 0 && $('.nectar-box-roll canvas[data-loaded="true"]').length == 0) return false;
7979
7980	if(perspect == 'not-rolled' && animating == 'false' && d == -1) {
7981		perspect = 'rolled';
7982		animating = 'true';
7983		$('body').addClass('box-animating').addClass('box-perspective-rolled').addClass('box-rolling');
7984
7985		$('.nectar-box-roll #page-header-bg').removeClass('topBoxIn').addClass('topBoxOut').css('will-change','transform');
7986		
7987		$('.nectar-box-roll .overlaid-content').removeClass('topBoxIn2').removeClass('topBoxIn').addClass('topBoxOut2').css('will-change','transform');
7988		
7989		$('.container-wrap').removeClass('bottomBoxOut').addClass('bottomBoxIn').removeClass('no-transform-animation-bottom-out').addClass('nectar-box-roll-class').css('will-change','transform');
7990		if($('#header-outer[data-transparent-header="true"]').length == 0) {
7991			$('.container-wrap').css({'height':$(window).height() - $headerNavSpace, 'opacity': 1});
7992			$('#slide-out-widget-area.fullscreen').css('margin-top','0px');
7993		} else {
7994			$('.container-wrap').css({'height':$(window).height(), 'opacity': 1});
7995		}
7996		
7997
7998		$('.nectar-slider-wrap').css({'opacity':0});
7999
8000		updateRowRightPadding(d);
8001		pauseVideoBG();
8002
8003		//old browser workaround
8004		var timeout1 = 1220;
8005		var timeout2 = 1650;
8006		var timeout3 = 1700;
8007		var timeout4 = 1350;
8008		if( $('html.no-cssanimations').length > 0) {
8009			timeout1 = 1;
8010			timeout2 = 1;
8011			timeout3 = 1;
8012			timeout4 = 1;
8013		}
8014
8015		$('.container-wrap').css('padding-right',$('body').attr('data-scrollbar-width') + 'px');
8016		setTimeout(function(){
8017			$('#header-outer, #wpadminbar, .cart-outer .cart-menu, .midnightHeader .midnightInner').animate({'padding-right': $('body').attr('data-scrollbar-width')},250);
8018			$('.nectar-box-roll .canvas-bg').addClass('out-of-sight');
8019			if($('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent');
8020
8021			if($('body.mobile').length > 0) $('.nectar-box-roll').css({'z-index':'1'});
8022		},timeout1);
8023		setTimeout(function(){ 
8024			updateRowRightPadding(1);
8025			$('body,html,#ajax-content-wrap, .container-wrap, .blurred-wrap').removeClass('no-scroll'); 
8026			$('#ajax-content-wrap, .blurred-wrap').addClass('at-content');
8027			$('.container-wrap, #footer-outer').removeClass('bottomBoxIn').removeClass('nectar-box-roll-class').addClass('auto-height');
8028			$('#header-outer, #wpadminbar, .container-wrap, .cart-outer .cart-menu, .midnightHeader .midnightInner').stop().css('padding-right',0);
8029
8030			if( $smoothActive == 1 && $(window).width() > 690  && Modernizr.csstransforms3d && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){ 
8031				niceScrollInit();
8032			}
8033			
8034			$('.nectar-box-roll').css({'z-index':'-1000'}).transition({'y': '-200%'},0);
8035			$('.nectar-box-roll canvas').hide();
8036			$('body').removeClass('box-rolling');
8037			$('.nectar-slider-wrap').transition({'opacity':1},600,'easeOutCubic');
8038
8039			$('.nectar-box-roll #page-header-bg, .nectar-box-roll .overlaid-content, .container-wrap').css('will-change','auto');
8040			if($waypointsBound == false) waypoints();	
8041		},timeout2);
8042		
8043		//fadeIn
8044		setTimeout(function(){ 
8045			$('.container-wrap .main-content > .row > div > div[class*="col"]').css({'opacity':1});
8046		},timeout4);
8047
8048		setTimeout(function(){ 
8049					animating ='false'; 
8050					$('body').removeClass('box-animating');		
8051		},timeout3);
8052
8053		//header position when transparent nav was used
8054		if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length != 0) { 
8055			$('#ajax-content-wrap').transition({'margin-top':$('#header-outer').outerHeight(true) + $('#header-outer').offset().top},2000,'easeInOutQuad');
8056		}
8057		/*if($('#header-outer[data-transparent-header="true"]').length == 0 && $('.mobile').length == 0) {
8058			$('.nectar-box-roll').transition({'top': 0},2000,'easeInOutQuad');
8059		}*/
8060		
8061
8062		//remove header if not fixed
8063		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');
8064
8065	}
8066
8067	else if(perspect == 'rolled' && animating == 'false' && d == 1 && $(window).scrollTop() < 100) {
8068
8069		$('.container-wrap').removeClass('auto-height');
8070		if($('#header-outer[data-transparent-header="true"]').length == 0) {
8071			$('.container-wrap').css({'height':$(window).height() - $headerNavSpace, 'opacity': 1});
8072		} else {
8073			$('.container-wrap').css({'height':$(window).height(), 'opacity': 1});
8074		}
8075		
8076		$('#footer-outer').removeClass('auto-height');
8077		$('body').addClass('box-rolling');
8078
8079		perspect = 'not-rolled';
8080		animating = 'true';
8081		$('body').addClass('box-animating').addClass('box-perspective-not-rolled');
8082
8083		$('#header-outer, #wpadminbar, .container-wrap, .cart-outer .cart-menu, .midnightHeader .midnightInner').css('padding-right',$('body').attr('data-scrollbar-width') + 'px');
8084		$('.nectar-slider-wrap').transition({'opacity':0},600,'easeOutCubic');
8085		$('.container-wrap .main-content > .row > div > div[class*="col"]').stop(true).css({'opacity':0});
8086		setTimeout(function(){
8087			$('#header-outer, #wpadminbar, .cart-outer .cart-menu, .midnightHeader .midnightInner').animate({'padding-right': 0},250);
8088			$('.nectar-box-roll .canvas-bg').removeClass('out-of-sight');
8089			resizeVideoToCover();
8090			//header position when transparent nav was used
8091			if($('#header-outer[data-transparent-header="true"]').length != 0) { 
8092				$('#ajax-content-wrap').stop(true,true).transition({'margin-top':0},2000,'easeInOutCubic');
8093			} else {
8094				if($('.mobile').length == 0) $('#slide-out-widget-area.fullscreen').css('margin-top','-'+$headerNavSpace+'px');
8095			}
8096			//if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('.mobile').length == 0 ) $('.nectar-box-roll').transition({'top': $('#header-space').height() },2000,'easeInOutQuad');
8097			
8098		},30);
8099
8100		//old browser workaround
8101		var timeout1 = 1700;
8102		var timeout2 = 1600;
8103		var timeout3 = 1300;
8104		if( $('html.no-cssanimations').length > 0) {
8105			timeout1 = 1;
8106			timeout2 = 1;
8107			timeout3 = 1;
8108		}
8109
8110		if($('body.mobile').length > 0) {
8111			setTimeout(function(){
8112				$('.nectar-box-roll').css('z-index','1000');
8113			},timeout3);
8114		} else {
8115			$('.nectar-box-roll').css('z-index','1000');
8116		}
8117
8118		updateRowRightPadding(d);
8119		removeNiceScroll();
8120		$('.nectar-box-roll').transition({'y': '0'},0);
8121		$('.nectar-box-roll canvas').show();
8122		setTimeout(function(){ 
8123			updateRowRightPadding(1);
8124			animating ='false'; 
8125			$('body').removeClass('box-animating');
8126			$('#page-header-bg').removeClass('topBoxIn');
8127			$('.overlaid-content').removeClass('topBoxIn2');	
8128			$('body').removeClass('box-rolling');
8129			resumeVideoBG();
8130			$('.nectar-box-roll #page-header-bg, .nectar-box-roll .overlaid-content, .container-wrap').css('will-change','auto');
8131		},timeout1);
8132
8133		setTimeout(function(){
8134			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');
8135		},timeout2);
8136
8137		$('body,html,#ajax-content-wrap, .container-wrap, .blurred-wrap').addClass('no-scroll');
8138		$('#ajax-content-wrap, .blurred-wrap').removeClass('at-content');
8139		$('.container-wrap').addClass('nectar-box-roll-class');
8140		$('.nectar-box-roll #page-header-bg').removeClass('topBoxOut').addClass('topBoxIn').css('will-change','transform');
8141		
8142		$('.container-wrap').removeClass('bottomBoxIn').addClass('bottomBoxOut').css('will-change','transform');
8143
8144		if($('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').addClass('transparent');
8145
8146		$('.nectar-box-roll .overlaid-content').removeClass('topBoxOut2').removeClass('topBoxOut').addClass('topBoxIn2').css('will-change','transform');
8147	
8148		if($('#header-outer[data-header-resize="1"]').length > 0) { bigNav(); }
8149
8150		$('.nectar-box-roll .trigger-scroll-down').removeClass('hovered');
8151	}
8152
8153	
8154}
8155
8156function boxScrollEvent(event, delta) {
8157	if($('#slide-out-widget-area.open.fullscreen').length > 0) return false;
8158	boxRoll(event,delta);
8159}
8160
8161function boxRollMouseWheelInit() {
8162	if($('.nectar-box-roll').length > 0) {
8163		$('body').on("mousewheel", boxScrollEvent);
8164	} else {
8165		$('body').off("mousewheel", boxScrollEvent);
8166	}
8167}
8168
8169boxRollMouseWheelInit();
8170
8171$('body').on('click','.nectar-box-roll .section-down-arrow',function(){
8172	boxRoll(null,-1);
8173	$(this).addClass('hovered');
8174	setTimeout(function(){ $('.nectar-box-roll .section-down-arrow').removeClass('hovered'); },2000);
8175	return false;
8176});
8177
8178
8179
8180function updateRowRightPadding(d){
8181	$('.wpb_row.full-width-section').each(function(){
8182		if($(this).hasClass('extraPadding') && d == 1) {
8183			$(this).css('padding-right',parseInt($(this).css('padding-right')) - parseInt($('body').attr('data-scrollbar-width')) + 'px' ).removeClass('extraPadding');
8184		} else {
8185			$(this).css('padding-right',parseInt($('body').attr('data-scrollbar-width')) + parseInt($(this).css('padding-right')) + 'px' ).addClass('extraPadding');
8186		}	
8187	});
8188	$('.wpb_row.full-width-content').each(function(){
8189		if($(this).find('.row-bg.using-image').length == 0) {
8190			if($(this).hasClass('extraPadding') && d == 1) {
8191				$(this).find('.row-bg').css('width',parseInt($(this).width()) - parseInt($('body').attr('data-scrollbar-width')) + 'px' ).removeClass('extraPadding');
8192			} else {
8193				$(this).find('.row-bg').css('width',parseInt($('body').attr('data-scrollbar-width')) + $(this).width() + 'px' ).addClass('extraPadding');
8194			}	
8195		}
8196	});
8197}
8198
8199function pauseVideoBG() {
8200	if($('.nectar-box-roll video').length > 0) $('.nectar-box-roll video')[0].pause(); 
8201}
8202function resumeVideoBG() {
8203	if($('.nectar-box-roll video').length > 0) $('.nectar-box-roll video')[0].play(); 
8204}
8205
8206//touch 
8207if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && $('.nectar-box-roll').length > 0) {
8208	$('body').swipe({
8209		tap: function(event,target) {
8210			if($(target).parents('.nectar-flip-box').length > 0)
8211				$(target).parents('.nectar-flip-box').trigger('click');
8212			if($(target).is('.nectar-flip-box'))
8213				$(target).trigger('click');
8214		},
8215		swipeStatus: function(event, phase, direction, distance, duration, fingers) {
8216			if($('#slide-out-widget-area.open').length > 0) return false;
8217			if(direction == 'up') {
8218				boxRoll(null,-1);
8219				if($('#ajax-content-wrap.no-scroll').length == 0) $('body').swipe("option", "allowPageScroll", 'vertical');
8220			} else if(direction == "down" && $(window).scrollTop() == 0) {
8221				boxRoll(null,1);
8222				$('body').swipe("option", "allowPageScroll", 'auto');
8223			}
8224		}
8225	});
8226
8227}
8228
8229function removeNiceScroll() {
8230		if($().niceScroll && $("html").getNiceScroll()){
8231			var nice = $("html").getNiceScroll();
8232			nice.stop();
8233			
8234			$('html').removeClass('no-overflow-y');
8235			$('.nicescroll-rails').hide();
8236			if($('#boxed').length == 0){
8237				$('body, body #header-outer, body #header-secondary-outer, body #search-outer, .midnightHeader .midnightInner').css('padding-right','0px');
8238			} else if($('body[data-ext-responsive="true"]').length == 0 ) {
8239				$('body').css('padding-right','0px');
8240			}
8241
8242			$('body').attr('data-smooth-scrolling','0');
8243		}
8244	}
8245//called after box roll
8246$waypointsBound = false;
8247function waypoints() {
8248	colAndImgAnimations(); 
8249	progressBars(); 
8250	dividers();
8251	iconList();
8252	animated_titles();
8253	imageWithHotspots();
8254	clientsFadeIn(); 
8255	splitLineHeadings();
8256	svgAnimations(); 
8257	milestoneInit();
8258	nectar_fancy_ul_init();
8259	owl_carousel_animate();
8260	headerRowColorInheritInit();
8261	morphingOutlines(); 
8262	portfolioLoadIn();
8263	animatedColBorders();
8264	foodMenuItems();
8265	vcWaypoints();
8266	$waypointsBound = true;
8267}
8268
8269
8270
8271/***************** WooCommerce Cart *****************/
8272var timeout;
8273var productToAdd;
8274var $dropdownStyle = ($('body[data-dropdown-style="minimal"]').length > 0)  ? 'minimal' : 'default';
8275//notification
8276$('body').on('click','.product .add_to_cart_button', function(){
8277
8278	var $productHeading = ($(this).parents('li').find('h2').length > 0) ? 'h2' : 'h3';
8279
8280	productToAdd = $(this).parents('li').find($productHeading).text();
8281	$('#header-outer .cart-notification span.item-name').html(productToAdd);
8282
8283	//if($('.cart-menu-wrap').hasClass('first-load')) $('.cart-menu-wrap').removeClass('first-load').addClass('static');
8284});
8285
8286//notification hover
8287$('body').on('mouseenter','#header-outer .cart-notification',function(){
8288	if($dropdownStyle == 'minimal') {
8289		$(this).hide();
8290		$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).show();
8291		$('#header-outer .cart_list').stop(true,true).show();
8292	} else {
8293		$(this).fadeOut(400);
8294		$('#header-outer .widget_shopping_cart').stop(true,true).fadeIn(300);
8295		$('#header-outer .cart_list').stop(true,true).fadeIn(300);
8296	}
8297	
8298	clearTimeout(timeout);
8299});
8300
8301//cart dropdown
8302$('#header-outer div.cart-outer').hoverIntent(function(){
8303
8304	if($dropdownStyle == 'minimal') { 
8305		$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).show()
8306		$('#header-outer .cart_list').stop(true,true).show();
8307		clearTimeout(timeout);
8308		$('#header-outer .cart-notification').hide();
8309	} else {
8310		$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).fadeIn(300);
8311		$('#header-outer .cart_list').stop(true,true).fadeIn(300);
8312		clearTimeout(timeout);
8313		$('#header-outer .cart-notification').fadeOut(300);
8314	}
8315	
8316});
8317
8318
8319$('body').on('mouseleave','#header-outer div.cart-outer',function(){
8320	var $that = $(this);
8321	setTimeout(function(){
8322		if(!$that.is(':hover')){
8323			$('#header-outer .widget_shopping_cart').removeClass('open').stop(true,true).fadeOut(300);
8324			$('#header-outer .cart_list').stop(true,true).fadeOut(300);
8325		}
8326	},100);
8327});
8328
8329if($('#header-outer[data-cart="false"]').length == 0) {
8330	$('body').on('added_to_cart', shopping_cart_dropdown_show);
8331	$('body').on('added_to_cart', shopping_cart_dropdown);
8332}
8333
8334function shopping_cart_dropdown() {
8335		
8336		if(!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 ) {
8337			$('.cart-menu-wrap').addClass('has_products');
8338			$('header#top nav > ul, #search-outer #search #close a, header#top .span_9 >.slide-out-widget-area-toggle').addClass('product_added');
8339
8340			if(!$('.cart-menu-wrap').hasClass('static')) $('.cart-menu-wrap').addClass('first-load');
8341
8342			//nectar slider nav directional effect
8343			if($('#header-outer').hasClass('directional-nav-effect') && $('#header-outer .cart-icon-wrap .dark').length == 0 && $('body.ascend').length > 0){
8344				$('#header-outer .cart-outer .cart-icon-wrap').each(function(){
8345                    $(this).find('> i, > span.light, > span.dark, > span.original').remove();
8346                    $(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>');
8347                	$(this).find('.original').attr('data-w',$(this).find('span.original').width()+1);
8348                });
8349			}
8350		}
8351
8352}
8353
8354
8355function shopping_cart_dropdown_show(e) {
8356		
8357		clearTimeout(timeout);
8358		
8359		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' ) {
8360			//before cart has slide in
8361			if(!$('#header-outer .cart-menu-wrap').hasClass('has_products')) {
8362				setTimeout(function(){ $('#header-outer .cart-notification').fadeIn(400); },400);
8363			}
8364			else if(!$('#header-outer .cart-notification').is(':visible')) {
8365				$('#header-outer .cart-notification').fadeIn(400);
8366			} else {
8367				$('#header-outer .cart-notification').show();
8368			}
8369			timeout = setTimeout(hideCart,2700);
8370
8371			$('.cart-menu a, .widget_shopping_cart a').addClass('no-ajaxy');
8372		}
8373}
8374
8375function hideCart() {
8376	$('#header-outer .cart-notification').stop(true,true).fadeOut();
8377}
8378
8379function checkForWooItems(){ 
8380	var checkForCartItems = setInterval(shopping_cart_dropdown,250);
8381	setTimeout(function(){ clearInterval(checkForCartItems); },4500);
8382}
8383if($('#header-outer[data-cart="false"]').length == 0) {
8384	checkForWooItems();
8385}
8386
8387var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
8388var secondaryHeader = ($('#header-outer').attr('data-using-secondary') == '1') ? 32 : 0 ;
8389function searchFieldCenter(){
8390	var $headerHeightSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
8391	$('#search-outer').css('top', $headerHeightSpace + extraHeight + secondaryHeader);
8392	$('#search-outer > #search #search-box').css('top',($(window).height()/2) - ($('#search-outer > #search input').height()/2) - $headerHeightSpace );
8393}
8394
8395//text on hover effect
8396$('body').on('mouseover','.text_on_hover .product-wrap',function(){
8397	$(this).parent().addClass('hovered');
8398	//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');
8399});
8400$('body').on('mouseover','.text_on_hover > a:first-child',function(){
8401	$(this).parent().addClass('hovered');
8402});
8403
8404$('body').on('mouseout','.text_on_hover .product-wrap',function(){
8405	$(this).parent().removeClass('hovered');
8406	//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);
8407});
8408$('body').on('mouseout','.text_on_hover > a:first-child',function(){
8409	$(this).parent().removeClass('hovered');
8410});
8411
8412
8413//material hover effect
8414if($('.material.product').length > 0){
8415
8416	$productZindex = 101;
8417	$('body').on('mouseenter','.material.product',function(){
8418		
8419		$productZindex++;
8420
8421		$(this).css('z-index',$productZindex+1);
8422		
8423	});
8424	$('body').on('mouseleave','.material.product',function(){
8425		
8426		var $that = $(this);
8427		setTimeout(function(){ if(!$that.is(':hover')) $that.css('z-index',100); },280);
8428	});
8429
8430	//reset to stop zindex from getting too high
8431	setInterval(function(){ 
8432		$('.material.product:not(:hover)').css('z-index',100);
8433		$productZindex = 101; 
8434	},10000);
8435
8436}
8437
8438//mobile widget filters
8439$('body').on('click','#sidebar .widget.woocommerce:not(.widget_price_filter) h4',function(){
8440	if($(window).width() < 1000) {
8441		$(this).parent().find('> ul').slideToggle();
8442		$(this).parent().toggleClass('open-filter');
8443	}
8444});
8445
8446	//slide in cart
8447	$('body').on('mouseenter','#header-outer [data-cart-style="slide_in"] .cart-menu-wrap',openRightCart);
8448
8449	function openRightCart() {
8450
8451		if($('.nectar-slide-in-cart ul.cart_list li:not(.empty)').length > 0) {
8452			$('.nectar-slide-in-cart').addClass('open');
8453
8454			$(window).on('mousemove.rightCartOffsetCheck',closeCartCheck);
8455		}
8456	}
8457
8458	function closeCartCheck(e) {
8459		var $windowWidth = $(window).width();
8460		if(e.clientX < $windowWidth - 370 - $bodyBorderWidth) {
8461
8462			$(window).off('mousemove.rightCartOffsetCheck',closeNavCheck);
8463
8464			$('.nectar-slide-in-cart').removeClass('open');
8465
8466		}
8467
8468	}
8469
8470
8471
8472
8473
8474/***************** Search ******************/
8475	var $placeholder = $('#search input[type=text]').attr('data-placeholder');
8476	var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
8477	
8478	////search box event
8479	$('body').on('click', '#search-btn a', function(){ return false; });
8480	$('body').on('mousedown', '#search-btn a:not(.inactive)', function(){
8481
8482		if($(this).hasClass('open-search')) { return false; } 
8483
8484		if($('body').hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0){ 
8485			$('#search-outer > #search form, #search-outer #search .span_12 span').css('opacity',0);
8486			$('#search-outer > #search form').css('bottom','10px');
8487			$('#search-outer #search .span_12 span').css('top','10px');
8488			$('#search-outer').show();
8489			$('#search-outer').stop().transition({scale: '1,0', 'opacity': 1},0).transition({ scale: '1,1'},400,'easeInOutCubic');
8490
8491			$('#search-outer > #search form').delay(400).animate({'opacity':1, 'bottom':0},'easeOutCirc');
8492			$('#search-outer #search .span_12 span').delay(470).animate({'opacity':1, 'top':0},'easeOutCirc');
8493			
8494		} else {
8495			$('#search-outer').stop(true).fadeIn(600,'easeOutExpo');
8496		}
8497
8498		if($('body[data-header-format="left-header"]').length == 0) {
8499			$('body:not(.ascend) #search-outer > #search input[type="text"]').css({
8500				'top' : $('#search-outer').height()/2 - $('#search-outer > #search input[type="text"]').height()/2
8501			});
8502		}
8503		
8504		setTimeout(function(){
8505
8506			$('#search input[type=text]').focus();
8507			
8508			if($('#search input[type=text]').attr('value') == $placeholder){
8509				$('#search input[type=text]').setCursorPosition(0);	
8510			}
8511
8512		},300);
8513
8514		//ascend
8515		if($('body').hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0){ 
8516			searchFieldCenter();
8517		}
8518
8519		$(this).toggleClass('open-search');
8520
8521		//close slide out widget area
8522		$('.slide-out-widget-area-toggle a:not(#toggle-nav).open:not(.animating)').trigger('click');
8523
8524		return false;
8525	});
8526	
8527	$('body').on('keydown','#search input[type=text]',function(){
8528		if($(this).attr('value') == $placeholder){
8529			$(this).attr('value', '');
8530		}
8531	});
8532	
8533	$('body').on('keyup','#search input[type=text]',function(){
8534		if($(this).attr('value') == ''){
8535			$(this).attr('value', $placeholder);
8536			$(this).setCursorPosition(0);
8537		}
8538	});
8539	
8540	
8541	////close search btn event
8542	$('body').on('click','#close',function(){
8543		closeSearch();
8544		$('#search-btn a').removeClass('open-search');
8545		return false;
8546	});
8547
8548	//if user clicks away from the search close it
8549	$('body').on('blur','#search-box input[type=text]',function(e){
8550		closeSearch();
8551		$('#search-btn a').removeClass('open-search');
8552	});
8553	
8554	
8555	function closeSearch(){
8556		if($('body').hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0){ 
8557			$('#search-outer').stop().transition({'opacity' :0},300,'easeOutCubic');
8558			$('#search-btn a').addClass('inactive');
8559			setTimeout(function(){ $('#search-outer').hide(); $('#search-btn a').removeClass('inactive'); },300);
8560		} else {
8561			$('#search-outer').stop(true).fadeOut(450,'easeOutExpo');
8562		}
8563	}
8564	
8565	
8566	//mobile search
8567	$('body').on('click', '#mobile-menu #mobile-search .container a#show-search',function(){
8568		$('#mobile-menu .container > ul').slideUp(500);
8569		return false;
8570	});
8571	
8572/***************** Nav ******************/
8573
8574	function centeredLogoMargins() {
8575
8576		if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $(window).width() > 1000) {
8577			$midnightSelector = ($('#header-outer .midnightHeader').length > 0) ? '> .midnightHeader:first-child' : '';
8578			var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] '+$midnightSelector+' nav > .sf-menu > li').length;
8579			if($('#header-outer #social-in-menu').length > 0) $navItemLength--;
8580
8581			$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());
8582
8583			$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'));
8584			
8585			if($extraMenuSpace > 30) {
8586				$extraMenuSpace += 45;
8587			} else if($extraMenuSpace > 20) {
8588				$extraMenuSpace += 40;
8589			} else {
8590				$extraMenuSpace += 30;
8591			}
8592
8593			$('#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');
8594			$leftMenuWidth = 0;
8595			$rightMenuWidth = 0;
8596			$('#header-outer[data-format="centered-logo-between-menu"] '+$midnightSelector+' nav > .sf-menu > li:not(#social-in-menu)').each(function(i){
8597				if(i+1 <= Math.floor($navItemLength/2)) {
8598					$leftMenuWidth += $(this).width();
8599				} else {
8600					$rightMenuWidth += $(this).width();
8601				}
8602
8603			});
8604
8605			$menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth);
8606
8607			if($leftMenuWidth > $rightMenuWidth) 
8608				$('#header-outer .row > .col.span_9').css('padding-right',$menuDiff);
8609			else 
8610				$('#header-outer .row > .col.span_9').css('padding-left',$menuDiff);
8611
8612			$('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility','visible');
8613		}
8614	}
8615	
8616	var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
8617	var headerPadding = parseInt($('#header-outer').attr('data-padding'));
8618	var usingLogoImage = $('#header-outer').attr('data-using-logo');
8619	
8620	if( isNaN(headerPadding) || headerPadding.length == 0 ) { headerPadding = 28; }
8621	if( isNaN(logoHeight) || usingLogoImage.length == 0 ) { usingLogoImage = false; logoHeight = 30;}
8622	
8623	if($('header#top nav > ul li#search-btn a').length > 0) {
8624		$searchBtnHeight = $('header#top nav > ul li#search-btn a').height();
8625	} else {
8626		$searchBtnHeight = 24;
8627	}
8628
8629	//inital calculations
8630	function headerInit() {
8631		
8632		if($('#header-outer[data-format="left-header"]').length > 0) return;
8633
8634		$('#header-outer #logo img').css({
8635			'height' : logoHeight,				
8636		});	
8637		
8638		$('#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({
8639			'padding-top' : headerPadding
8640		});	
8641		
8642		if($('body.mobile').length == 0) {
8643			$('header#top nav > ul > li:not(#social-in-menu) > a').css({
8644				'padding-bottom' : Math.floor( ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding),
8645				'padding-top' : Math.floor( (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2))
8646			});	
8647
8648			$('header#top nav > ul > li#social-in-menu > a').css({
8649				'margin-bottom' : Math.floor( ((logoHeight/2) - ($('header#top nav > ul > li#social-in-menu > a i').height()/2)) + headerPadding),
8650				'margin-top' : Math.floor( (logoHeight/2) - ($('header#top nav > ul > li#social-in-menu > a i').height()/2))
8651			});	
8652		}
8653		
8654		if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
8655			$('#header-outer .cart-menu').css({  
8656				'padding-bottom' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding),
8657				'padding-top' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding)
8658			});	
8659		} 
8660		
8661		
8662		$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').css({
8663			'padding-bottom' : (logoHeight/2) - ($searchBtnHeight/2),
8664			'padding-top' : (logoHeight/2) - ($searchBtnHeight/2)
8665		});	
8666		
8667
8668		
8669		if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
8670			$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').css({
8671				'padding-top': 0,
8672				'padding-bottom': 0
8673			});
8674
8675			$('header#top nav > ul.buttons').css({
8676				'margin-top' : - headerPadding,
8677				'height' : Math.floor(logoHeight + headerPadding*2) -1
8678			});
8679
8680			$('header#top nav > ul li#search-btn a, header#top nav > ul li.slide-out-widget-area-toggle a').css({
8681				'visibility' : 'visible',
8682				'padding-top': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding),
8683				'padding-bottom': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding)
8684			});
8685		}
8686		
8687		$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').css({
8688			'top' : $('header#top nav > ul.sf-menu > li > a').outerHeight() 
8689		});	
8690		
8691		
8692		setTimeout(function(){ 
8693			$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').css({
8694				'top': parseInt($('#header-outer').outerHeight())+'px'
8695			}); 
8696		},1000);
8697		
8698		$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').css({
8699			'top': parseInt($('#header-outer').outerHeight())+'px'
8700		});
8701
8702		//header space
8703		if($('.nectar-parallax-scene.first-section').length == 0) {
8704
8705			if($('#header-outer').attr('data-using-secondary') == '1'){
8706				if($('#header-outer[data-mobile-fixed="false"]').length > 0  || $('body.mobile').length == 0 ) {
8707					$('#header-space').css('height', parseInt($('#header-outer').outerHeight()) + $('#header-secondary-outer').height());
8708					
8709				} else {
8710					$('#header-space').css('height', parseInt($('#header-outer').outerHeight()));
8711					
8712				}
8713				
8714			} else {
8715
8716				$('#header-space').css('height', $('#header-outer').outerHeight() );
8717			} 
8718		}
8719		
8720		$('#header-outer .container, #header-outer .cart-menu').css('visibility','visible');
8721		
8722		centeredLogoMargins();
8723
8724		if(usingLogoImage && $('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $('header#top #logo img:first-child[src]').length > 0) {
8725			
8726			//fadein img on load
8727			var tempLogoImg = new Image();
8728			tempLogoImg.src = $('header#top #logo img:first-child').attr('src');
8729
8730		    tempLogoImg.onload = function() {
8731		       centeredLogoMargins();
8732		    };
8733			
8734		}
8735
8736		if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
8737			$('body:not(.ascend) #search-outer, #search .container').css({
8738				'height' : logoHeight + headerPadding*2
8739			});	
8740			
8741			$('body:not(.ascend) #search-outer > #search input[type="text"]').css({
8742				'font-size'  : 43,
8743				'height' : '59px',
8744				'top' : ((logoHeight + headerPadding*2)/2) - $('#search-outer > #search input[type="text"]').height()/2
8745			});
8746			
8747			$('body:not(.ascend) #search-outer > #search #close a').css({
8748				'top' : ((logoHeight + headerPadding*2)/2) - 8
8749			});	
8750		} else {
8751			$('body:not(.ascend) #search-outer, #search .container').css({
8752				'height' : logoHeight + headerPadding*2 + logoHeight + 17
8753			});	
8754			
8755			$('body:not(.ascend) #search-outer > #search input[type="text"]').css({
8756				'font-size'  : 43,
8757				'height' : '59px',
8758				'top' : ((logoHeight + headerPadding*2)/2) - ($('#search-outer > #search input[type="text"]').height()/2) + logoHeight/2 + 17
8759			});
8760			
8761			$('body:not(.ascend) #search-outer > #search #close a').css({
8762				'top' : ((logoHeight + headerPadding*2)/2) - 8 + logoHeight/2 + 17
8763			});	
8764		}
8765		
8766		//if no image is being used
8767		//if(usingLogoImage == false) $('header#top #logo').addClass('no-image');
8768		
8769	}
8770	
8771	//one last check to make sure the header space is correct (only if the user hasn't scrolled yet)
8772	$(window).load(function(){
8773		if($(window).scrollTop() == 0 ) headerSpace();
8774	});
8775	
8776	
8777	//is header resize on scroll enabled?
8778	var headerResize = $('#header-outer').attr('data-header-resize');
8779	var headerHideUntilNeeded = $('body').attr('data-hhun');
8780
8781	//transparent fix
8782
8783	if($('#header-outer[data-remove-fixed="1"]').length == 0) {
8784		if($(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) $('#header-outer').removeClass('transparent');
8785	}
8786
8787	if( headerResize == 1 && headerHideUntilNeeded != '1'){
8788		
8789		headerInit();
8790
8791		$(window).off('scroll.headerResizeEffect');
8792
8793		if($('#nectar_fullscreen_rows').length == 0) {
8794			$(window).on('scroll.headerResizeEffect',smallNav);
8795		}
8796		else if($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) ) {
8797			$(window).on('scroll.headerResizeEffect',smallNav);
8798		}
8799
8800	} else if(headerHideUntilNeeded != '1') {
8801		headerInit();
8802		$(window).off('scroll.headerResizeEffectOpaque');
8803		$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
8804		
8805	} else if(headerHideUntilNeeded == '1') {
8806
8807		headerInit();
8808
8809		if($('.nectar-box-roll').length > 0) $('#header-outer').addClass('at-top-before-box');
8810
8811		var previousScroll = 0, // previous scroll position
8812        menuOffset = $('#header-space').height()*2, // height of menu (once scroll passed it, menu is hidden)
8813        detachPoint = ($('body.mobile').length > 0) ? 150 : 600, // point of detach (after scroll passed it, menu is fixed)
8814        hideShowOffset = 6; // scrolling value after which triggers hide/show menu
8815
8816	    // on scroll hide/show menu
8817	    function hhunCalcs(e) {
8818
8819	     //stop scrolling while animated anchors
8820	     if($('body.animated-scrolling').length > 0 && $('#header-outer.detached').length > 0) return false;
8821
8822	     //stop on mobile if not using sticky option
8823	      if($('#header-outer[data-mobile-fixed="false"]').length > 0 && $('body.mobile').length > 0) {  $('#header-outer').removeClass('detached'); return false; }
8824
8825	      var currentScroll = $(this).scrollTop(), // gets current scroll position
8826	            scrollDifference = Math.abs(currentScroll - previousScroll); // calculates how fast user is scrolling
8827
8828	      if (!$('#header-outer').hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) {
8829	       
8830	        // if scrolled past menu
8831	        if (currentScroll > menuOffset) {
8832	          // if scrolled past detach point add class to fix menu
8833	          if (currentScroll > detachPoint) {
8834	            if (!$('#header-outer').hasClass('detached'))
8835	              $('#header-outer').addClass('detached').removeClass('parallax-contained');
8836	          	   $('#header-outer').removeClass('no-transition');	
8837
8838
8839	          	  if($('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent');
8840	          }
8841
8842	          // if scrolling faster than hideShowOffset hide/show menu
8843	          if (scrollDifference >= hideShowOffset) {
8844	            if (currentScroll > previousScroll) {
8845	              // scrolling down; hide menu
8846	              if (!$('#header-outer').hasClass('invisible')) {
8847	                $('#header-outer').addClass('invisible').removeClass('at-top');
8848
8849	                 //close submenus
8850	                 if( $(".sf-menu").length > 0 && $().superfish ) {
8851		          		 $(".sf-menu").superfish('hide');
8852		          		 $('header#top nav > ul.sf-menu > li.menu-item-over').removeClass('menu-item-over');
8853		          	 }
8854
8855	              }
8856	                $('.page-submenu.stuck').css('transform','translateY(0px)').addClass('header-not-visible');
8857
8858	            	
8859	            } else {
8860	              // scrolling up; show menu
8861	              if ($('#header-outer').hasClass('invisible'))
8862	                $('#header-outer').removeClass('invisible');
8863
8864	            	if($('.body-border-top').length > 0 && $('body.mobile').length == 0) {
8865
8866	            		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;
8867	            		var $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $('.body-border-top').height() : 0;
8868	          	    	$('.page-submenu.stuck').css('transform','translateY('+ ($('#header-outer').outerHeight()-$bodyBorderSizeToRemove) +'px)').removeClass('header-not-visible');
8869
8870	            	} else {
8871	            		$('.page-submenu.stuck').css('transform','translateY('+$('#header-outer').outerHeight()+'px)').removeClass('header-not-visible');
8872	            	}
8873	            }
8874	          }
8875	        } else {
8876	          // only remove "detached" class if user is at the top of document (menu jump fix)
8877	          $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 : 0;
8878	          if($('.body-border-top').length > 0) {
8879	          		$topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 + $('.body-border-top').height() : $('.body-border-top').height();
8880	          }
8881
8882	          if (currentScroll <= $topDetachNum){
8883	            $('#header-outer').removeClass('detached').addClass('at-top');
8884	            
8885	            if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
8886		            if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.nectar-box-roll').length == 0 && $('.megamenu.sfHover').length == 0) { 
8887		            	$('#header-outer').addClass('transparent').css('transform','translateY(0)');
8888		            	$('#header-outer').removeClass('no-transition');	
8889		            }
8890		            else if($('.nectar-box-roll').length > 0) $('#header-outer').css('transform','translateY(0)').addClass('at-top-before-box');
8891		          
8892		        } else {
8893		        	 if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent').css('transform','translateY(0)');
8894		            else if($('.nectar-box-roll').length > 0) $('#header-outer').css('transform','translateY(0)').addClass('at-top-before-box');
8895		        }
8896
8897	            if($('.parallax_slider_outer').length > 0 || $('#page-header-bg[data-parallax="1"]').length > 0) $('#header-outer').addClass('parallax-contained').css('transform','translateY(0)');
8898	          }
8899	        }
8900
8901	        // if user is at the bottom of document show menu
8902	        if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
8903	          $('#header-outer').removeClass('invisible');
8904
8905	            if($('.body-border-top').length > 0 && $('body.mobile').length == 0) {
8906
8907            		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;
8908            		var $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $('.body-border-top').height() : 0;
8909          	    	$('.page-submenu.stuck').css('transform','translateY('+ ($('#header-outer').outerHeight()-$bodyBorderSizeToRemove) +'px)').removeClass('header-not-visible');
8910	            }
8911	            else {
8912	            	$('.page-submenu.stuck').css('transform','translateY('+$('#header-outer').outerHeight()+'px)').removeClass('header-not-visible');
8913	            }
8914	          
8915	        }
8916
8917	      }
8918
8919	      // replace previous scroll position with new one
8920	      previousScroll = currentScroll;
8921
8922	    }
8923
8924	    //don't trigger for header remove stickiness
8925	    if($('#header-outer[data-remove-fixed="1"]').length == 0) {
8926		    hhunCalcs();
8927		    $(window).scroll(hhunCalcs);
8928		}
8929
8930
8931	}//end if hhun
8932	
8933	if($('#nectar_fullscreen_rows').length == 0) midnightInit(); //init midnight	
8934	else ($('#header-outer').attr('data-permanent-transparent','false'))
8935
8936	var shrinkNum = 6;
8937	var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
8938	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;
8939	if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
8940
8941	function smallNav(){
8942		var $offset = $(window).scrollTop();
8943		var $windowWidth = $(window).width();
8944		
8945
8946		if($offset > 0 && $windowWidth > 1000) {
8947		
8948
8949			if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
8950				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) { 
8951					$('#header-outer').removeClass('transparent');
8952					$('#header-outer').removeClass('no-transition');	
8953				}
8954			} else {
8955				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');
8956			}
8957
8958			$('.ns-loading-cover').hide();
8959			
8960			$('#header-outer, #search-outer').addClass('small-nav');
8961			
8962			$('#header-outer #logo img').stop(true,true).animate({
8963				'height' : logoHeight - shrinkNum
8964			},{queue:false, duration:250, easing: 'easeOutCubic'});	
8965				
8966			$('#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({
8967				'padding-top' : Math.ceil(headerPadding / 1.8)
8968			},{queue:false, duration:250, easing: 'easeOutCubic'});	
8969			
8970			if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
8971				$('#header-outer .row > .span_3').stop(true,true).animate({
8972					'padding-bottom' : Math.ceil(headerPadding / 1.8)
8973				},{queue:false, duration:250, easing: 'easeOutCubic'});	
8974			}
8975
8976			$('header#top nav > ul > li:not(#social-in-menu) > a').stop(true,true).animate({
8977				'padding-bottom' :  Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding / 1.8) ,
8978				'padding-top' :  Math.floor(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) 
8979			},{queue:false, duration:250, easing: 'easeOutCubic'});	 
8980
8981			//body border full width side padding
8982			if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true) {
8983				$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
8984					'padding' : '0'			
8985				},{queue:false, duration:250, easing: 'easeOutCubic'});	
8986			}
8987
8988			$('header#top nav > ul > li#social-in-menu > a').stop(true,true).animate({
8989				'margin-bottom' :  Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li#social-in-menu > a').height()/2)) + headerPadding / 1.8) ,
8990				'margin-top' :  Math.floor(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li#social-in-menu > a').height()/2)) 
8991			},{queue:false, duration:250, easing: 'easeOutCubic'});	 
8992			
8993			$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
8994				'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(shrinkNum)*3) +'px'
8995			},{queue:false, duration:250, easing: 'easeOutCubic'});	 
8996
8997			if($bodyBorderHeaderColorMatch == true) {
8998				$('.body-border-top').stop(true,true).animate({
8999					'margin-top': '-'+$('.body-border-top').height()+'px'
9000				},{queue:false, duration:400, easing: 'easeOutCubic', complete: function() { $(this).css('margin-top',0)} });	 
9001			}
9002
9003			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
9004				$('#header-outer .cart-menu').stop(true,true).animate({
9005					'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7),
9006					'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7) +1
9007				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9008			} 
9009			
9010			if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
9011				$('header#top nav > ul.buttons').stop(true,true).animate({
9012					'margin-top' : - Math.ceil(headerPadding/ 1.8),
9013					'height' : Math.floor((headerPadding*2)/ 1.8 + logoHeight-shrinkNum)
9014				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9015
9016				$('header#top nav > ul li#search-btn a, header#top nav > ul li.slide-out-widget-area-toggle a').stop(true,true).animate({
9017					'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7),
9018					'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7) +1
9019				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9020
9021			} else {
9022				$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').stop(true,true).animate({
9023					'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2)),
9024					'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2))
9025				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9026			}
9027
9028			if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
9029				$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
9030					'top' : Math.floor($('header#top nav > ul > li > a').outerHeight())
9031				},{queue:false, duration:250, easing: 'easeOutCubic'});		
9032			} else {
9033				$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
9034					'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),
9035				},{queue:false, duration:250, easing: 'easeOutCubic'});		
9036			}
9037			
9038			$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').stop(true,true).animate({
9039				'top': Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8) +'px'
9040			},{queue:false, duration:250, easing: 'easeOutCubic'});	
9041		
9042
9043			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
9044				$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
9045					'height' : Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8)
9046				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9047
9048				$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
9049					'font-size'  : 30,
9050					'line-height' : '30px',
9051					'height' : '44px',
9052					'top' : ((logoHeight-shrinkNum+headerPadding+5)/2) - ($('#search-outer > #search input[type="text"]').height()-15)/2
9053				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9054			
9055				$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
9056					'top' : ((logoHeight-shrinkNum + headerPadding+5)/2) - 10
9057				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9058
9059			} else {
9060				$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
9061					'height' : Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8) + logoHeight - shrinkNum + 17
9062				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9063
9064				$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
9065					'font-size'  : 30,
9066					'line-height' : '30px',
9067					'height' : '44px',
9068					'top' : ((logoHeight-shrinkNum+headerPadding+5)/2) - ($('#search-outer > #search input[type="text"]').height()-15)/2 + (logoHeight- shrinkNum)/2 + 8
9069				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9070
9071				$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
9072					'top' : ((logoHeight-shrinkNum + headerPadding+5)/2) - 10 + (logoHeight- shrinkNum)/2 + 8
9073				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9074			}
9075
9076		
9077			
9078
9079			//box roll
9080			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'})
9081			
9082			
9083			if($('body').hasClass('ascend')){ 
9084				$('#search-outer').stop(true,true).animate({
9085					'top' : Math.floor((logoHeight-shrinkNum) +(headerPadding*2)/ 1.8 + extraHeight + secondaryHeader)
9086				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9087			}
9088			
9089			//if no image is being used
9090			if(usingLogoImage == false) $('header#top #logo').stop(true,true).animate({
9091				'margin-top' : 0
9092			},{queue:false, duration:450, easing: 'easeOutExpo'});	
9093			
9094			$(window).off('scroll',smallNav);
9095			$(window).on('scroll',bigNav);
9096
9097			//dark slider coloring border fix
9098			$('#header-outer[data-transparent-header="true"]').css('transition','background-color 0.30s ease, box-shadow 0.30s ease, margin 0.25s ease-out');
9099			$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','none');
9100			setTimeout(function(){ 
9101				$('#header-outer[data-transparent-header="true"]').css('transition','background-color 0.30s ease, box-shadow 0.30s ease, border-color 0.30s ease, margin 0.25s ease-out'); 
9102				$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','border-color 0.30s ease');
9103			},300);
9104
9105		}
9106
9107	}
9108	
9109	function bigNav(){
9110		var $offset = $(window).scrollTop();
9111		var $windowWidth = $(window).width();
9112
9113		if($offset == 0 && $windowWidth > 1000 || $('.small-nav').length > 0 && $('#ajax-content-wrap.no-scroll').length > 0 ) {
9114			
9115			$('#header-outer, #search-outer').removeClass('small-nav');
9116			
9117			if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
9118				if($('#header-outer').attr('data-transparent-header') == 'true'  && $('.nectar-box-roll').length == 0 && $('.megamenu.sfHover').length == 0) {
9119					$('#header-outer').addClass('transparent');
9120					$('#header-outer').removeClass('no-transition');	
9121				}
9122			} else {
9123				if($('#header-outer').attr('data-transparent-header') == 'true'  && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent');
9124			}
9125
9126			$('.ns-loading-cover').show();
9127			
9128			$('#header-outer #logo img').stop(true,true).animate({
9129				'height' : logoHeight,				
9130			},{queue:false, duration:250, easing: 'easeOutCubic'});	
9131			
9132
9133			//body border full width side padding
9134			if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true) {
9135				$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
9136					'padding' : '0 28px'			
9137				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9138			}
9139
9140			$('#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({
9141				'padding-top' : headerPadding 
9142			},{queue:false, duration:250, easing: 'easeOutCubic'});	
9143			
9144			if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
9145				$('#header-outer .row > .span_3').stop(true,true).animate({
9146					'padding-bottom' : headerPadding 
9147				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9148			}
9149
9150			$('header#top nav > ul > li:not(#social-in-menu) > a').stop(true,true).animate({
9151				'padding-bottom' : ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding,
9152				'padding-top' : (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2) 
9153			},{queue:false, duration:250, easing: 'easeOutCubic'});	
9154
9155			$('header#top nav > ul > li#social-in-menu > a').stop(true,true).animate({
9156				'margin-bottom' : ((logoHeight/2) - ($('header#top nav > ul > li#social-in-menu > a').height()/2)) + headerPadding,
9157				'margin-top' : (logoHeight/2) - ($('header#top nav > ul > li#social-in-menu > a').height()/2) 
9158			},{queue:false, duration:250, easing: 'easeOutCubic'});	
9159				
9160			$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
9161				'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(shrinkNum)*3) +'px'
9162			},{queue:false, duration:250, easing: 'easeOutCubic'});	 
9163
9164			if($bodyBorderHeaderColorMatch == true) {
9165				$('.body-border-top').css({ 'margin-top': '-'+$('.body-border-top').height()+'px'}).stop(true,true).animate({
9166					'margin-top': '0'
9167				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
9168			}
9169
9170			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
9171				$('#header-outer .cart-menu').stop(true,true).animate({
9172					'padding-bottom' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding),
9173					'padding-top' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding)
9174				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9175			}
9176
9177			if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
9178				$('header#top nav > ul.buttons').stop(true,true).animate({
9179					'margin-top' : - Math.ceil(headerPadding),
9180					'height' : Math.floor(headerPadding*2 + logoHeight) -1
9181				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9182
9183				$('header#top nav > ul li#search-btn a, header#top nav > ul li.slide-out-widget-area-toggle a').stop(true,true).animate({
9184					'padding-top': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding),
9185					'padding-bottom': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding)
9186				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9187			} else {
9188				$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').stop(true,true).animate({
9189					'padding-bottom' : Math.floor((logoHeight/2) - ($searchBtnHeight/2)),
9190					'padding-top' : Math.ceil((logoHeight/2) - ($searchBtnHeight/2))
9191				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9192			}
9193			
9194			if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
9195				$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
9196					'top' : Math.floor($('header#top nav > ul > li > a').outerHeight())
9197				},{queue:false, duration:250, easing: 'easeOutCubic'});		
9198			} else {
9199				$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
9200					'top' : Math.ceil($('header#top nav > ul > li > a').height() + (((logoHeight)/2) - ($('header#top nav > ul > li > a').height()/2))*2 + headerPadding),
9201				},{queue:false, duration:250, easing: 'easeOutCubic'});		
9202			}
9203			
9204			$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').stop(true,true).animate({
9205				'top': Math.ceil(logoHeight + headerPadding*2) +'px'
9206			},{queue:false, duration:250, easing: 'easeOutCubic'});	
9207			
9208			
9209			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
9210				$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
9211					'height' : Math.ceil(logoHeight + headerPadding*2)
9212				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9213				
9214				$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
9215					'font-size'  : 43,
9216					'line-height' : '43px',
9217					'height' : '59px',
9218					'top' : ((logoHeight + headerPadding*2)/2) - 30
9219				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9220				
9221				
9222				$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
9223					'top' : ((logoHeight + headerPadding*2)/2) - 8
9224				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9225				
9226			} else {
9227				$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
9228					'height' : Math.ceil(logoHeight + headerPadding*2) + logoHeight + 17
9229				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9230				
9231				$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
9232					'font-size'  : 43,
9233					'line-height' : '43px',
9234					'height' : '59px',
9235					'top' : ((logoHeight + headerPadding*2)/2) - 30 + (logoHeight)/2 + 8
9236				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9237				
9238				
9239				$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
9240					'top' : ((logoHeight + headerPadding*2)/2) - 8 + (logoHeight)/2 + 8
9241				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9242			}
9243
9244
9245			if($('body').hasClass('ascend')){ 
9246				$('#search-outer').stop(true,true).animate({
9247					'top' : (logoHeight) +(headerPadding*2) + extraHeight + secondaryHeader
9248				},{queue:false, duration:250, easing: 'easeOutCubic'});	
9249			}
9250
9251			//if no image is being used
9252			if(usingLogoImage == false) $('header#top #logo').stop(true,true).animate({
9253				'margin-top' : 4
9254			},{queue:false, duration:450, easing: 'easeOutExpo'});	
9255			
9256
9257				//box roll
9258			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'})
9259			
9260
9261			$(window).off('scroll',bigNav);
9262			$(window).on('scroll',smallNav);
9263
9264
9265			//dark slider coloring border fix
9266			$('#header-outer[data-transparent-header="true"]').css('transition','background-color 0.30s ease, box-shadow 0.30s ease, margin 0.25s ease-out');
9267			$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','none');
9268			setTimeout(function(){ 
9269				$('#header-outer[data-transparent-header="true"]').css('transition','background-color 0.30s ease, box-shadow 0.30s ease, border-color 0.30s ease, margin 0.25s ease-out'); 
9270				$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','border-color 0.30s ease');
9271			},300);
9272		}
9273
9274	}
9275	
9276	
9277	function headerSpace() {
9278		if($('.mobile').length > 0) {
9279			if(window.innerHeight < window.innerWidth && window.innerWidth > 1000) {
9280				if($('#header-outer.small-nav').length == 0)
9281					$('#header-space').css('height', $('#header-outer').outerHeight() + $('#header-secondary-outer').height());
9282			} else {
9283				$('#header-space').css('height', $('#header-outer').outerHeight());
9284			}
9285			
9286		} else {
9287			if($('.nectar-parallax-scene.first-section').length == 0) {
9288
9289				var shrinkNum = 6;	
9290				var headerPadding = parseInt($('#header-outer').attr('data-padding'));
9291				if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
9292				var headerPadding2 = headerPadding - headerPadding/1.8;
9293				var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0 ) ? $('#header-outer').outerHeight() + (parseInt(shrinkNum) + headerPadding2*2) : $('#header-outer').outerHeight();
9294
9295				if($('#header-outer').attr('data-using-secondary') == '1'){
9296					$('#header-space').css('height', $headerHeight + $('#header-secondary-outer').height());
9297				} else {
9298					$('#header-space').css('height', $headerHeight);
9299				} 
9300			}
9301		}
9302		
9303	}
9304
9305	//call immediately on mobile to make sure there's no gap with fixed setups
9306	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) {
9307		$('#header-space').css('height', $('#header-outer').outerHeight());
9308	}
9309
9310
9311	var lastPosition = -1;
9312	function headerOffsetAdjust(){
9313		
9314		var $scrollTop = $(window).scrollTop();
9315
9316		 if (lastPosition == $scrollTop) {
9317            requestAnimationFrame(headerOffsetAdjust);
9318            return false;
9319        } else lastPosition = $scrollTop;
9320		
9321		headerOffsetAdjustCalc();
9322
9323		requestAnimationFrame(headerOffsetAdjust);
9324
9325	}
9326
9327	function headerOffsetAdjustCalc() {
9328		if($('body.mobile').length > 0) {
9329			var $eleHeight = 0;
9330			var $endOffset = ($('#wpadminbar').css('position') == 'fixed') ? $('#wpadminbar').height() : 0;
9331			if($('#header-secondary-outer').length > 0) $eleHeight += $('#header-secondary-outer').height();
9332			if($('#wpadminbar').length > 0) $eleHeight += $('#wpadminbar').height();
9333
9334			if( $eleHeight - $scrollTop > $endOffset) { 
9335				$('#header-outer').css('top', $eleHeight - $scrollTop + 'px');
9336			}
9337			else { $('#header-outer').css('top', $endOffset); }
9338
9339		} else {
9340			var $eleHeight = 0;
9341			if($('#header-secondary-outer').length > 0) $eleHeight += $('#header-secondary-outer').height();
9342			if($('#wpadminbar').length > 0) $eleHeight += $('#wpadminbar').height();
9343			$('#header-outer').css('top',$eleHeight+'px');
9344		}
9345	}
9346
9347	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) {
9348		if($('#nectar_fullscreen_rows').length == 0) { requestAnimationFrame(headerOffsetAdjust); }
9349		else if($('#nectar_fullscreen_rows').length > 0 && $onMobileBrowser) {
9350			requestAnimationFrame(headerOffsetAdjust);
9351		}
9352		$(window).smartresize(headerOffsetAdjustCalc);
9353	}
9354		
9355
9356	function footerRevealCalcs() {
9357		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
9358
9359		if($(window).height() - $('#wpadminbar').height() - $headerNavSpace - $('#footer-outer').height() - 1 -$('#page-header-bg').height() -$('.parallax_slider_outer').height() - $('.page-header-no-bg').height() > 0) {
9360			$resizeExtra = ($('#header-outer[data-header-resize="1"]').length > 0) ? 55: 0;
9361			$('.container-wrap').css({'margin-bottom': $('#footer-outer').height()-1, '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 });
9362		} else {
9363			$('.container-wrap').css({'margin-bottom': $('#footer-outer').height()-1 });
9364		}
9365		
9366		if( $(window).width() < 1000) $('#footer-outer').attr('data-midnight','light');
9367		else $('#footer-outer').removeAttr('data-midnight');
9368	}
9369	if($('body[data-footer-reveal="1"]').length > 0) { 
9370		footerRevealCalcs();
9371		//set shadow to match BG color if applicable
9372		if($('body[data-footer-reveal-shadow="large_2"]').length > 0) $('.container-wrap').css({ boxShadow: '0 70px 110px -30px '+$('#footer-outer').css('backgroundColor') });
9373	}
9374	
9375	function opaqueCheck(){
9376		var $offset = $(window).scrollTop();
9377		var $windowWidth = $(window).width();
9378
9379		if($offset > 0 && $windowWidth > 1000) {
9380		
9381			if($('#header-outer').attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent').addClass('scrolled-down');
9382			$('.ns-loading-cover').hide();
9383			
9384			$(window).off('scroll',opaqueCheck);
9385			$(window).on('scroll',transparentCheck);
9386		}
9387	}
9388	
9389	
9390	function transparentCheck(){
9391
9392		var $offset = $(window).scrollTop();
9393		var $windowWidth = $(window).width();
9394
9395		if($offset == 0 && $windowWidth > 1000) {
9396			
9397			if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
9398				if($('#header-outer').attr('data-transparent-header') == 'true' && $('.megamenu.sfHover').length == 0) { 
9399					$('#header-outer').addClass('transparent').removeClass('scrolled-down');
9400					$('#header-outer').removeClass('no-transition');	
9401				}
9402				else if($('#header-outer').attr('data-transparent-header') == 'true') $('#header-outer').removeClass('scrolled-down');
9403			} else {
9404				if($('#header-outer').attr('data-transparent-header') == 'true') $('#header-outer').addClass('transparent').removeClass('scrolled-down');
9405			}
9406
9407			$('.ns-loading-cover').show();
9408			
9409			$(window).off('scroll',transparentCheck);
9410			$(window).on('scroll',opaqueCheck);
9411		}
9412	}
9413	
9414	var adminBarHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
9415
9416	//header inherit row color effect
9417	function headerRowColorInheritInit(){
9418		if($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0){
9419			
9420			var headerOffset = ($('#header-outer[data-permanent-transparent="1"]').length == 0) ? (logoHeight - shrinkNum) + Math.ceil((headerPadding*2) / 1.8) + adminBarHeight : logoHeight/2 + headerPadding + adminBarHeight;
9421			
9422			$('.main-content > .row > .wpb_row').each(function(){
9423
9424
9425				var $that = $(this);
9426				var waypoint = new Waypoint({
9427	 				element: $that,
9428		 			handler: function(direction) {
9429	
9430
9431						if(direction == 'down') {
9432							
9433							if($that.find('.row-bg.using-bg-color').length > 0) {
9434								
9435								var $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
9436								$('#header-outer').css('background-color',$that.find('.row-bg').css('background-color')).removeClass('light-text').removeClass('dark-text').addClass($textColor);
9437								$('#header-outer').attr('data-current-row-bg-color',$that.find('.row-bg').css('background-color'));
9438							} else {
9439								$('#header-outer').css('background-color',$('#header-outer').attr('data-user-set-bg')).removeClass('light-text').removeClass('dark-text');
9440								$('#header-outer').attr('data-current-row-bg-color',$('#header-outer').attr('data-user-set-bg'));
9441							}
9442						
9443						} else {
9444
9445							if($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) {
9446								var $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
9447								$('#header-outer').css('background-color',$that.prev('div.wpb_row').find('.row-bg').css('background-color')).removeClass('light-text').removeClass('dark-text').addClass($textColor);
9448								$('#header-outer').attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color'));
9449							} else {
9450								$('#header-outer').css('background-color',$('#header-outer').attr('data-user-set-bg')).removeClass('light-text').removeClass('dark-text');
9451								$('#header-outer').attr('data-current-row-bg-color',$('#header-outer').attr('data-user-set-bg'));
9452							}
9453
9454						} 
9455
9456				
9457					},
9458					offset: headerOffset
9459
9460				}); 
9461
9462
9463			});
9464		}
9465	}
9466
9467	//if($('.nectar-box-roll').length == 0) headerRowColorInheritInit();
9468
9469
9470
9471/****************sticky page submenu******************/
9472	if($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) {
9473
9474		(function() {
9475		  'use strict'
9476
9477		  var $ = window.jQuery
9478		  var Waypoint = window.Waypoint
9479		  var $offsetHeight = 0; 
9480		  var shrinkNum = 6;	
9481		  var headerPadding = parseInt($('#header-outer').attr('data-padding'));
9482
9483		  if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
9484		  var headerPadding2 = headerPadding - headerPadding/1.8;
9485		  var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
9486		  var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('body.mobile').length == 0) ? $headerNavSpace - (parseInt(shrinkNum) + headerPadding2*2) : $headerNavSpace;
9487
9488		  if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; $headerHeight = 0; }
9489
9490		  if($('#header-secondary-outer').length > 0 && $('body.mobile').length == 0) $headerHeight += $('#header-secondary-outer').height();
9491		  
9492
9493		  $(window).on('smartresize',function(){
9494
9495		    $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
9496		  	$headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length == 0 && $('body.mobile').length == 0) ? $headerNavSpace - (parseInt(shrinkNum) + headerPadding2*2) : $headerNavSpace;
9497		  	if($('#header-secondary-outer').length > 0  && $('body.mobile').length == 0) $headerHeight += $('#header-secondary-outer').height();
9498
9499		  	$offsetHeight = 0; 
9500		
9501		  	  if($('#wpadminbar').length > 0 && $('#wpadminbar').css('position') == 'fixed') $offsetHeight += $('#wpadminbar').height();
9502 			  if($('body[data-hhun="0"] #header-outer').length > 0 && !($('body.mobile').length > 0 && $('#header-outer[data-mobile-fixed="false"]').length > 0) ) {
9503 			  	  $offsetHeight += $headerHeight;
9504 			  }
9505
9506 			  if($('.body-border-top').length > 0 && $(window).width() > 1000 && $('body[data-hhun="1"]').length > 0) $offsetHeight += $('.body-border-top').height();
9507 	
9508 			 // else if($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) $offsetHeight += $headerHeight;
9509 			
9510 			 //recalc for resizing (same as stuck/unstuck logic below)
9511 			 if($('.page-submenu.stuck').length > 0) {
9512
9513		        	$('.page-submenu.stuck').addClass('no-trans').css('top',$offsetHeight).css('transform','translateY(0)').addClass('stuck');
9514		        	var $that = this;
9515		        	setTimeout(function(){ $('.page-submenu.stuck').removeClass('no-trans'); },50);
9516		        	$('.page-submenu.stuck').parents('.wpb_row').css('z-index',10000);
9517
9518		        	//boxed
9519		        	if($('#boxed').length > 0) { 
9520		        		var $negMargin = ($(window).width() > 1000) ? $('.container-wrap').width()*0.04 :39;
9521		        		$('.page-submenu.stuck').css({'margin-left':'-'+$negMargin+'px', 'width' : $('.container-wrap').width()});
9522		        	}
9523
9524		        }
9525		        else { 
9526		        	$('.page-submenu.stuck').css('top','0').removeClass('stuck');
9527		       	   $('.page-submenu.stuck').parents('.wpb_row').css('z-index','auto');
9528
9529		       	    if($('#boxed').length > 0) $('.page-submenu.stuck').css({'margin-left':'0px', 'width' : '100%'});
9530		       	}
9531
9532		  });
9533
9534		  /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */
9535		  function Sticky(options) {
9536		    this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options)
9537		    this.element = this.options.element
9538		    this.$element = $(this.element)
9539		    this.createWrapper()
9540		    this.createWaypoint()
9541		  }
9542
9543		  /* Private */
9544		  Sticky.prototype.createWaypoint = function() {
9545		    var originalHandler = this.options.handler
9546
9547		    $offsetHeight = 0; 
9548		    if($('#wpadminbar').length > 0 && $('#wpadminbar').css('position') == 'fixed') $offsetHeight += $('#wpadminbar').height();
9549 			if($('body[data-hhun="0"] #header-outer').length > 0 && !($('body.mobile').length > 0 && $('#header-outer[data-mobile-fixed="false"]').length > 0) ) { 
9550 				$offsetHeight += $headerHeight;
9551 			}
9552 			 if($('.body-border-top').length > 0 && $(window).width() > 1000 && $('body[data-hhun="1"]').length > 0) $offsetHeight += $('.body-border-top').height();
9553 		
9554		    this.waypoint = new Waypoint($.extend({}, this.options, {
9555		      element: this.wrapper,
9556		      handler: $.proxy(function(direction) {
9557		        var shouldBeStuck = this.options.direction.indexOf(direction) > -1
9558		        var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''
9559
9560		        this.$wrapper.height(wrapperHeight)
9561		        if(shouldBeStuck) {
9562		        	this.$element.addClass('no-trans').css('top',$offsetHeight).css('transform','translateY(0)').addClass('stuck');
9563		        	var $that = this;
9564		        	setTimeout(function(){ $that.$element.removeClass('no-trans'); },50);
9565		        	this.$element.parents('.wpb_row').css('z-index',10000);
9566
9567		        	//boxed
9568		        	if($('#boxed').length > 0) { 
9569		        		var $negMargin = ($(window).width() > 1000) ? $('.container-wrap').width()*0.04 :39;
9570		        		this.$element.css({'margin-left':'-'+$negMargin+'px', 'width' : $('.container-wrap').width()});
9571		        	}
9572
9573		        }
9574		        else { 
9575		        	this.$element.css('top','0').removeClass('stuck');
9576		       	    //this.$element.parents('.wpb_row').css('z-index','10000');
9577
9578		       	    if($('#boxed').length > 0) this.$element.css({'margin-left':'0px', 'width' : '100%'});
9579		       	}
9580
9581		        if (originalHandler) {
9582		          originalHandler.call(this, direction)
9583		        }
9584		      }, this),
9585		      offset: $offsetHeight
9586		    }))
9587
9588		    var $that = this;
9589
9590		   // if($('body[data-hhun="1"]').length > 0 ) {
9591			    setInterval(function(){ 
9592
9593			    	if($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0)
9594		        		$that.waypoint.options.offset = $offsetHeight + $headerHeight;
9595		        	else 
9596		        		$that.waypoint.options.offset = $offsetHeight;
9597			    	Waypoint.refreshAll();
9598			
9599			    },100); 
9600			//}
9601
9602		  }
9603
9604		  /* Private */
9605		  Sticky.prototype.createWrapper = function() {
9606		    if (this.options.wrapper) {
9607		      this.$element.wrap(this.options.wrapper)
9608		    }
9609		    this.$wrapper = this.$element.parent()
9610		    this.wrapper = this.$wrapper[0]
9611		  }
9612
9613		  /* Public */
9614		  Sticky.prototype.destroy = function() {
9615		    if (this.$element.parent()[0] === this.wrapper) {
9616		      this.waypoint.destroy()
9617		      this.$element.removeClass(this.options.stuckClass)
9618		      if (this.options.wrapper) {
9619		        this.$element.unwrap()
9620		      }
9621		    }
9622		  }
9623
9624		  Sticky.defaults = {
9625		    wrapper: '<div class="sticky-wrapper" />',
9626		    stuckClass: 'stuck',
9627		    direction: 'down right'
9628		  }
9629
9630		  Waypoint.Sticky = Sticky
9631		}())
9632		;
9633
9634		//remove outside of column setups 
9635		if($('.page-submenu').parents('.span_12').find('> .wpb_column').length > 1){
9636			var pageMenu = $('.page-submenu').clone();
9637			var pageMenuParentRow = $('.page-submenu').parents('.wpb_row');
9638			$('.page-submenu').remove();
9639			pageMenuParentRow.before(pageMenu);
9640		}
9641
9642		var sticky = new Waypoint.Sticky({
9643		  element: $('.page-submenu[data-sticky="true"]')[0]
9644		});
9645
9646
9647	}
9648
9649	if($('#nectar_fullscreen_rows').length == 0)
9650		$('.page-submenu').parents('.wpb_row').css('z-index',10000);
9651
9652	$('.page-submenu .mobile-menu-link').on('click',function(){
9653		$(this).parents('.page-submenu').find('ul').stop(true).slideToggle(350);
9654		return false;
9655	});
9656
9657	$('.page-submenu ul li a').on('click',function(){
9658		if($('body.mobile').length > 0) $(this).parents('.page-submenu').find('ul').stop(true).slideToggle(350);
9659	});
9660
9661
9662	//responsive nav
9663	$('body').on('click','#toggle-nav',function(){
9664		if(window.innerWidth > 1000) {
9665			window.scrollTo(0,0);	
9666		}
9667
9668		$(this).find('.lines-button').toggleClass('close');
9669		$('#mobile-menu').stop(true,true).slideToggle(500);
9670		return false;
9671	});
9672	
9673	
9674	//add wpml to mobile menu
9675	if($('header#top nav > ul > li.menu-item-language').length > 0 && $('#header-secondary-outer ul > li.menu-item-language').length == 0){
9676		var $langSelector = $('header#top nav > ul > li.menu-item-language').clone();
9677		$langSelector.insertBefore('#mobile-menu ul #mobile-search');
9678	}
9679	
9680	////append dropdown indicators / give classes
9681	$('#mobile-menu .container ul li').each(function(){
9682		if($(this).find('> ul').length > 0) {
9683			 $(this).addClass('has-ul');
9684			 $(this).find('> a').append('<span class="sf-sub-indicator"><i class="icon-angle-down"></i></span>');
9685		}
9686	});
9687	
9688	////events
9689	$('#mobile-menu .container ul li:has(">ul") > a .sf-sub-indicator').click(function(){
9690		$(this).parent().parent().toggleClass('open');
9691		$(this).parent().parent().find('> ul').stop(true,true).slideToggle();
9692		return false;
9693	});
9694	
9695
9696
9697/*-------------------------------------------------------------------------*/
9698/*	5.	Page Specific
9699/*-------------------------------------------------------------------------*/	
9700	
9701	function vcFullHeightRow() {
9702        var $element = $(".vc_row-o-full-height:first");
9703        if ($element.length) {
9704            var $window, windowHeight, offsetTop, fullHeight;
9705            $window = $(window), 
9706            windowHeight = $window.height();
9707
9708            $(".vc_row-o-full-height").each(function(){
9709            	offsetTop = $(this).offset().top;
9710
9711            	var $realRowIndex = ($(this).parent().hasClass('vc_ie-flexbox-fixer')) ? $(this).parent().index() : $(this).index();
9712
9713            	if(offsetTop < windowHeight && $realRowIndex == 0) {
9714            		fullHeight = 100 - offsetTop / (windowHeight / 100);
9715          	    	$(this).css("min-height", fullHeight + "vh");
9716          	    	$(this).find('> .col.span_12').css("min-height", fullHeight + "vh");
9717            	} else {
9718            		$(this).css("min-height", windowHeight);
9719            		$(this).find('> .col.span_12').css("min-height", windowHeight);
9720            	}
9721          	   
9722            });
9723
9724            
9725        }
9726
9727    }
9728    function fixIeFlexbox() {
9729        var ua = window.navigator.userAgent,
9730            msie = ua.indexOf("MSIE ");
9731        (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) && $(".vc_row-o-full-height").each(function() {
9732            "flex" === $(this).find('> .span_12').css("display") && $(this).wrap('<div class="vc_ie-flexbox-fixer"></div>')
9733        })
9734    }
9735    fixIeFlexbox();
9736
9737    vcFullHeightRow();
9738
9739	//recent work
9740	function piVertCenter() {
9741		$('.portfolio-items  > .col').each(function(){
9742				
9743			//style 4
9744			$(this).find('.style-4 .work-info .bottom-meta:not(.shown)').stop().animate({
9745				'bottom' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()-2+'px'
9746			},420,'easeOutCubic');
9747
9748			
9749		});	 
9750	}
9751	
9752	$(window).load(function(){
9753	 	 portfolioCommentOrder();
9754	 	 fullWidthContentColumns();
9755	 	 resizeVideoToCover();
9756	});
9757	
9758	
9759	//ie8 width fix
9760	function ie8Width(){
9761		if( $(window).width() >= 1300 ) {
9762			$('.container').css('max-width','1100px');
9763		} else {
9764			$('.container').css('max-width','880px');
9765		}
9766	}
9767	
9768	if( $(window).width() >= 1300 && $('html').hasClass('no-video')) { $('.container').css('max-width','1100px'); $(window).resize(ie8Width); };
9769	
9770
9771
9772	function smartResizeInit() {
9773
9774		 //carousel height calcs
9775		 carouselHeightCalcs();
9776		 clientsCarouselHeightRecalc();
9777
9778		 //portfolio comment order
9779		 portfolioCommentOrder();
9780		 
9781		 //testimonial slider height
9782		 testimonialHeightResize(); //animated
9783		 testimonialSliderHeight(); //non-animated
9784		 
9785		 //full width content columns sizing
9786		 fullWidthContentColumns();
9787
9788		 //parallax BG Calculations
9789		 if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
9790		   parallaxRowsBGCals();
9791		 }
9792		 vcFullHeightRow();
9793		 headerSpace();
9794
9795		 centeredLogoMargins();
9796
9797		 slideOutWidgetOverflowState();
9798		 recentPostHeight();
9799
9800		 morphingOutlines();
9801
9802		 flipBoxHeights();
9803
9804		 showOnLeftSubMenu();
9805
9806		 //minimal alt effect
9807		if($('.tabbed[data-style="minimal_alt"]').length > 0) {
9808			 magicLineCalc($('.tabbed[data-style="minimal_alt"] > ul > li > a.active-tab'));
9809		}
9810
9811		 //full width menu megamenu adjust
9812		//if($('.slide-out-widget-area-toggle a.open').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) fullWidthHeaderSlidingWidgetMenuCalc();
9813		  
9814	}
9815
9816    $(window).off('smartresize.srInit'); 
9817	$(window).on('smartresize.srInit', smartResizeInit); 
9818	
9819	
9820	
9821	function resizeInit() {
9822		 portfolioDeviceCheck();
9823
9824		 //fullwidth page section calcs
9825		 fullWidthSections(); 
9826		 fullwidthImgOnlySizing();
9827		 fullWidthContentColumns();
9828	  	 fullWidthRowPaddingAdjustCalc();
9829		 
9830		 //iframe video emebeds
9831		 responsiveVideoIframes();
9832		 videoshortcodeSize();
9833
9834		 testimonialSliderHeightMinimalMult();
9835		 
9836		 if($('.nectar-social.full-width').length > 0) {
9837		 	nectarLoveFWCenter();
9838		 }
9839
9840		 if($('body').hasClass('ascend')){ 
9841			searchFieldCenter();
9842		 }
9843
9844		 if($('body').hasClass('single-post')) centerPostNextButtonImg();
9845		 
9846		 //fixed sidebar for portfolio
9847		 sidebarPxConversion();
9848
9849		 cascadingImageBGSizing();
9850
9851		 responsiveTooltips();
9852
9853		 //vc mobile columns
9854		 if($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) vcMobileColumns();
9855
9856		 if($('body[data-footer-reveal="1"]').length > 0) footerRevealCalcs();
9857
9858		 if($('#page-header-bg').length > 0) pageHeader();
9859
9860		 if($('.nectar-video-bg').length > 0) {
9861		 	resizeVideoToCover();
9862		 }
9863	}
9864
9865	$(window).off('resize.srInit'); 
9866	$(window).on('resize.srInit', resizeInit); 
9867
9868	$(window).on("orientationchange",function(){
9869	  setTimeout(clientsCarouselHeightRecalc,200);
9870	});
9871	
9872	//blog next post button
9873	function postNextButtonEffect(){
9874
9875		$('.blog_next_prev_buttons').imagesLoaded(function(){
9876
9877			centerPostNextButtonImg();
9878			
9879			$('.blog_next_prev_buttons img').css('opacity','1');
9880
9881			if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
9882				$('.blog_next_prev_buttons img').panr({
9883					scaleDuration: .28,
9884					sensitivity: 22,
9885					scaleTo: 1.06
9886				}); 
9887			}
9888
9889		});
9890	}
9891
9892	function centerPostNextButtonImg(){
9893		
9894		if($('.blog_next_prev_buttons').length == 0) return false;
9895
9896		if( $('.blog_next_prev_buttons img').height() >= $('.blog_next_prev_buttons').height() + 50 ) {
9897			var $height = 'auto';
9898			var $width = $('.blog_next_prev_buttons').width();
9899		} else {
9900
9901			if( $('.blog_next_prev_buttons').width() < $('.blog_next_prev_buttons img').width()) {
9902				var $height = $('.blog_next_prev_buttons').height() + 49;
9903				var $width = 'auto';
9904			} else {
9905				var $height = 'auto';
9906				var $width = '100%';
9907			}
9908			
9909		}
9910
9911		$('.blog_next_prev_buttons img').css({ 'height' : $height, 'width': $width });
9912
9913		$('.blog_next_prev_buttons img').css({
9914			'top' : ($('.blog_next_prev_buttons').height()/2) - ($('.blog_next_prev_buttons img').height()/2) + 'px',
9915			'left' : ($('.blog_next_prev_buttons').width()/2) - ($('.blog_next_prev_buttons img').width()/2) + 'px'
9916		});
9917
9918		$('.blog_next_prev_buttons .inner').each(function(){
9919			$(this).css({'top': $(this).parent().height()/2 - ($(this).height()/2), 'opacity':'1' });
9920		})
9921	}
9922	
9923	postNextButtonEffect();
9924
9925
9926	function recentPostHeight() {
9927		$('.blog-recent[data-style="title_only"]').each(function(){
9928			if($(this).find('> .col').length > 1) return false;
9929			if($(this).parent().parent().parent().hasClass('vc_col-sm-3') || 
9930				$(this).parent().parent().parent().hasClass('vc_col-sm-4') || 
9931				$(this).parent().parent().parent().hasClass('vc_col-sm-6') || 
9932				$(this).parent().parent().parent().hasClass('vc_col-sm-8') || 
9933				$(this).parent().parent().parent().hasClass('vc_col-sm-9')) {
9934				
9935				if($('body.mobile').length == 0 && $(this).next('div').length == 0) {
9936					var tallestColumn = 0;
9937					
9938					$(this).find('> .col').css('padding', '50px 20px');
9939
9940					$(this).parents('.span_12').find(' > .wpb_column').each(function(){
9941						(Math.floor($(this).height()) > tallestColumn) ? tallestColumn = Math.floor($(this).height()) : tallestColumn = tallestColumn;
9942					});	
9943			
9944					if(Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) {
9945						$(this).find('> .col').css('padding-top',(tallestColumn-$(this).find('> .col').height())/2 + 'px');
9946						$(this).find('> .col').css('padding-bottom',(tallestColumn-$(this).find('> .col').height())/2 + 'px');
9947					}
9948					
9949				}
9950				 else {
9951				 		$(this).find('> .col').css('padding', '50px 20px');
9952				}
9953			}
9954		});
9955	}
9956	recentPostHeight();
9957
9958
9959	//recent post slider
9960	function recentPostsFlickityInit() {
9961
9962		//classic enhanced specific 
9963        $('.blog-recent[data-style="classic_enhanced_alt"] .inner-wrap').each(function(){
9964        	$(this).find('.post-featured-img').each(function(){
9965				var $src = $(this).find('img').attr('src');
9966				$(this).css('background-image','url('+$src+')');
9967			});
9968        });
9969		$('.blog-recent[data-style="classic_enhanced"]').each(function(){
9970			if($(this).find('.inner-wrap.has-post-thumbnail').length == 0) {
9971				$(this).addClass('no-thumbs');
9972			}
9973		});
9974
9975		if($('.nectar-recent-posts-slider-inner').length == 0) return false;
9976
9977		var $rpF = $('.nectar-recent-posts-slider-inner').flickity({
9978			  contain: true,
9979			  draggable: true,
9980			  lazyLoad: false,
9981			  imagesLoaded: true,
9982			  percentPosition: true,
9983			  prevNextButtons: false,
9984			  pageDots: true,
9985			  resize: true,
9986			  setGallerySize: true,
9987			  wrapAround: true,
9988			  accessibility: false
9989		});
9990
9991		setTimeout(function(){
9992			$('.nectar-recent-posts-slider-inner').addClass('loaded');
9993		},1150);
9994		var flkty = $rpF.data('flickity');
9995	
9996
9997		$rpF.on( 'dragStart', function() {
9998			$('.flickity-viewport').addClass('is-moving');
9999		});
10000		$rpF.on( 'dragEnd', function() {
10001			$('.flickity-viewport').removeClass('is-moving');
10002		});
10003
10004		recentPostSliderHeight();
10005		$(window).resize(recentPostSliderHeight);
10006
10007		if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
10008			$(window).resize(recentPostSliderParallaxMargins);
10009
10010		function recentPostSliderHeight(){
10011
10012			$('.nectar-recent-posts-slider').each(function(){
10013					
10014						var $heightCalc;
10015						var $minHeight = 250;
10016						var $windowWidth = $(window).width();
10017						var $definedHeight = parseInt($(this).attr('data-height'));
10018
10019						var dif = ($('body[data-ext-responsive="true"]').length > 0) ? $(window).width() / 1400 : $(window).width() / 1100;
10020
10021						if( window.innerWidth > 1000 && $('#boxed').length == 0) {
10022
10023							if($(this).parents('.full-width-content').length == 0) {
10024								if($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1400){
10025									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight));
10026								} else if($('body[data-ext-responsive="true"]').length == 0 && window.innerWidth >= 1100) {
10027									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight));
10028								} else {
10029									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
10030								}
10031								
10032							} else {
10033								$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
10034							}
10035							
10036						} else {
10037							
10038							//column sliders
10039							var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col') ;
10040							if($parentCol.length == 0) $parentCol = $('.main-content');
10041								
10042							if(!$parentCol.hasClass('vc_span12') && !$parentCol.hasClass('main-content') && !$parentCol.hasClass('span_12') && !$parentCol.hasClass('vc_col-sm-12') ) {
10043							
10044								var $parentColWidth = sliderColumnDesktopWidth($parentCol);
10045								var $aspectRatio = $definedHeight/$parentColWidth;
10046
10047								
10048								//min height
10049								if( $aspectRatio*$parentCol.width() <= $minHeight ){
10050									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$minHeight);
10051								} else {
10052									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$aspectRatio*$parentCol.width());
10053								}
10054							  
10055							} 
10056							
10057							
10058
10059							//regular
10060							else {
10061								
10062								//min height
10063								if( $definedHeight*dif <= $minHeight ){
10064									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$minHeight);
10065								} else {
10066									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
10067								}
10068								
10069							}
10070							
10071						}
10072						
10073	
10074					
10075				});
10076		
10077		}
10078
10079		////helper function
10080		function sliderColumnDesktopWidth(parentCol) {
10081			
10082			var $parentColWidth = 1100;
10083			var $columnNumberParsed = $(parentCol).attr('class').match(/\d+/);
10084			
10085			if($columnNumberParsed == '2') { $parentColWidth = 170 }
10086			else if($columnNumberParsed == '3') { $parentColWidth = 260 } 
10087			else if($columnNumberParsed == '4') { $parentColWidth = 340 } 
10088			else if($columnNumberParsed == '6') { $parentColWidth = 530 } 
10089			else if($columnNumberParsed == '8') { $parentColWidth = 700 } 
10090			else if($columnNumberParsed == '9') { $parentColWidth = 805 }
10091			else if($columnNumberParsed == '10') { $parentColWidth = 916.3 }
10092			else if($columnNumberParsed == '12') { $parentColWidth = 1100 }
10093		
10094			return $parentColWidth;
10095		}
10096
10097	
10098	}
10099	
10100	recentPostsFlickityInit();
10101
10102	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
10103		if($('.nectar-recent-posts-slider').length > 0) window.requestAnimationFrame(recentPostSliderParallax);
10104
10105	function recentPostSliderParallax(){
10106
10107		$('.nectar-recent-posts-slider').each(function(){
10108			var $offset = parseInt($(this).find('.flickity-slider').position().left);
10109			var $slideLength = $(this).find('.nectar-recent-post-slide').length;
10110			var $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index();
10111			var $slideWidth = $(this).find('.nectar-recent-post-slide').width();
10112			//wrapped fix
10113
10114			////first going to first
10115			if($offset >= -3) {
10116				$(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg').css('margin-left',parseInt(Math.ceil($slideWidth/3.5))+'px');
10117			} else {
10118				$(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg').css('margin-left','-'+parseInt(Math.ceil($slideWidth/3.5*$lastChildIndex))+'px');
10119			}
10120			////last going to first
10121			if(Math.abs($offset) >= ($slideLength-1) * $slideWidth) {
10122				$(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg').css('margin-left','-'+parseInt(Math.ceil(($slideWidth/3.5)*$slideLength))+'px');
10123			} else {
10124				$(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg').css('margin-left','0px');
10125			}
10126
10127			$(this).find('.nectar-recent-post-bg').css('transform','translateX('+Math.ceil($(this).find('.flickity-slider').position().left/-3.5)+'px)');
10128			
10129			
10130		});
10131		requestAnimationFrame(recentPostSliderParallax);
10132	}
10133
10134	function recentPostSliderParallaxMargins(){
10135
10136		$('.nectar-recent-posts-slider').each(function(){		
10137			var $slideWidth = $(this).find('.nectar-recent-post-slide').width();
10138			$(this).find('.nectar-recent-post-slide').each(function(i){
10139				$(this).find('.nectar-recent-post-bg').css('margin-left','-'+  parseInt(Math.ceil($slideWidth/3.5)*i)+'px');
10140			});
10141		
10142		});
10143	}
10144
10145	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
10146		recentPostSliderParallaxMargins();
10147
10148
10149	//portfolio item hover effect
10150	
10151	////desktop event 
10152	function portfolioHoverEffects() { 
10153
10154		if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(iPad|IEMobile)/)) {
10155			
10156			//style 1 & 2
10157			$('.portfolio-items:not([data-ps="7"]) .col .work-item:not(.style-3-alt):not(.style-3):not([data-custom-content="on"])').hover(function(){
10158				$(this).find('.work-info .vert-center').css({'margin-top' : 0});
10159				$(this).find('.work-info, .work-info .vert-center *, .work-info > i').css({'opacity' : 1});
10160				$(this).find('.work-info-bg').css({ 'opacity' : 0.9 });
10161			},function(){
10162				$(this).find('.work-info .vert-center').css({ 'margin-top' : -20 });
10163				$(this).find('.work-info, .work-info .vert-center *, .work-info > i').css({ 'opacity' : 0 });
10164				$(this).find('.work-info-bg').css({ 'opacity' : 0 });
10165			});
10166			
10167			
10168			//style 3
10169			$('.portfolio-items .col .work-item.style-3').hover(function(){
10170
10171				$(this).find('.work-info-bg').css({ 'opacity' : 0 });
10172
10173			},function(){
10174				
10175				$(this).find('.work-info-bg').css({ 'opacity' : 0.45 });
10176
10177			});
10178			
10179			
10180			//style 4
10181			$('.portfolio-items .col .work-item.style-4').hover(function(){
10182				
10183				$(this).find('img').stop().animate({
10184					'top' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()/2+'px'
10185				},250,'easeOutCubic');
10186				
10187				$(this).find('.work-info .bottom-meta').addClass('shown').stop().animate({
10188					'bottom' : '0px'
10189				},320,'easeOutCubic');
10190
10191			},function(){
10192				
10193				$(this).find('img').stop().animate({
10194					'top' : '0px'
10195				},250,'easeOutCubic');
10196				
10197				$(this).find('.work-info .bottom-meta').removeClass('shown').stop().animate({
10198					'bottom' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()-2+'px'
10199				},320,'easeOutCubic');
10200				
10201			});
10202		
10203		} 
10204		////mobile event
10205		else {
10206			portfolioDeviceCheck();
10207		}
10208
10209	}
10210
10211	portfolioHoverEffects();
10212
10213	function style6Img(){
10214
10215		//change sizer pos
10216		$('.style-5').each(function(){
10217			$(this).find('.sizer').insertBefore($(this).find('.parallaxImg'));
10218		});
10219
10220		//set parent zindex
10221		$('.style-5').parents('.wpb_row').css('z-index','100');
10222
10223		var d = document,
10224			de = d.documentElement,
10225			bd = d.getElementsByTagName('body')[0],
10226			htm = d.getElementsByTagName('html')[0],
10227			win = window,
10228			imgs = d.querySelectorAll('.parallaxImg'),
10229			totalImgs = imgs.length,
10230			supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints;
10231
10232		if(totalImgs <= 0){
10233			return;
10234		}
10235
10236		// build HTML
10237		for(var l=0;l<totalImgs;l++){
10238
10239			var thisImg = imgs[l],
10240				layerElems = thisImg.querySelectorAll('.parallaxImg-layer'),
10241				totalLayerElems = layerElems.length;
10242
10243			if(totalLayerElems <= 0){
10244				continue;
10245			}
10246
10247			while(thisImg.firstChild) {
10248				thisImg.removeChild(thisImg.firstChild);
10249			}
10250			
10251			var lastMove = 0;
10252
10253			//throttle performance for all browser other than chrome
10254			var eventThrottle = $('html').hasClass('cssreflections') ? 1 : 80;
10255			if(eventThrottle == 80) $('body').addClass('cssreflections');
10256
10257			var containerHTML = d.createElement('div'),
10258				shineHTML = d.createElement('div'),
10259				shadowHTML = d.createElement('div'),
10260				layersHTML = d.createElement('div'),
10261				layers = [];
10262
10263			thisImg.id = 'parallaxImg__'+l;
10264			containerHTML.className = 'parallaxImg-container';
10265			//shineHTML.className = 'parallaxImg-shine';
10266			shadowHTML.className = 'parallaxImg-shadow';
10267			layersHTML.className = 'parallaxImg-layers';
10268
10269			for(var i=0;i<totalLayerElems;i++){
10270				var layer = d.createElement('div'),
10271					layerInner = d.createElement('div'),
10272					imgSrc = layerElems[i].getAttribute('data-img');
10273
10274				$(layer).html($(layerElems[i]).html());
10275				layer.className = 'parallaxImg-rendered-layer';
10276				layer.setAttribute('data-layer',i);
10277
10278				if(i==0 && $(thisImg).parents('.wpb_gallery').length == 0) { 
10279					layerInner.className = 'bg-img';
10280					layerInner.style.backgroundImage = 'url('+imgSrc+')';
10281					layer.appendChild(layerInner);
10282				}
10283				layersHTML.appendChild(layer);
10284
10285				layers.push(layer);
10286			}
10287
10288			containerHTML.appendChild(layersHTML);
10289			//containerHTML.appendChild(shineHTML);
10290			thisImg.appendChild(containerHTML);
10291			$(thisImg).wrap('<div class="parallaxImg-wrap" />');
10292			if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { $(thisImg).parent().append(shadowHTML); }
10293
10294			var w = thisImg.clientWidth || thisImg.offsetWidth || thisImg.scrollWidth;
10295			//thisImg.style.transform = 'perspective('+ w*3 +'px)';
10296
10297			if(supportsTouch){
10298				
10299		    } else {
10300		    	(function(_thisImg,_layers,_totalLayers,_shine) {
10301					$(thisImg).parents('.style-5').on('mousemove', function(e){
10302
10303					 	var now = Date.now();
10304				        if (now > lastMove + eventThrottle) {
10305				            lastMove = now;
10306							window.requestAnimationFrame(function(){
10307								processMovement(e,false,_thisImg,_layers,_totalLayers,_shine);		
10308							});
10309						}
10310
10311						//window.requestAnimationFrame(function(){
10312						//	processShineMovement(e,false,_thisImg,_layers,_totalLayers,_shine);		
10313						//});
10314					});
10315		            $(thisImg).parents('.style-5').on('mouseenter', function(e){
10316						processEnter(e,_thisImg,_layers,_totalLayers,_shine);		
10317					});
10318					$(thisImg).parents('.style-5').on('mouseleave', function(e){
10319						processExit(e,_thisImg,_layers,_totalLayers,_shine);		
10320					});
10321		        })(thisImg,layers,totalLayerElems,shineHTML);
10322		    }
10323
10324		    //set the depths
10325		    (function(_thisImg,_layers,_totalLayers,_shine) {
10326			    depths(false,_thisImg,_layers,_totalLayers,_shine);
10327			     window.addEventListener('resize', function(e){
10328			    	  depths(false,_thisImg,_layers,_totalLayers,_shine);
10329			    });
10330			 })(thisImg,layers,totalLayerElems,shineHTML);
10331		}
10332
10333		function processMovement(e, touchEnabled, elem, layers, totalLayers, shine){
10334
10335			//stop raf if exit already called
10336			if(!$(elem.firstChild).hasClass('over')) { processExit(e,elem,layers,totalLayers,shine); return false }
10337
10338			//set up multipliers
10339
10340			if($(elem).parents('.col.wide').length > 0 ) {
10341				var yMult = 0.03;
10342				var xMult = 0.063;
10343			} else if( $(elem).parents('.col.regular').length > 0  || $(elem).parents('.wpb_gallery').length > 0) {
10344				var yMult = 0.045;
10345				var xMult = 0.045;
10346			} else if($(elem).parents('.col.tall').length > 0 ) {
10347				var yMult = 0.05;
10348				var xMult = 0.015;
10349			} else if($(elem).parents('.col.wide_tall').length > 0) {
10350				var yMult = 0.04;
10351				var xMult = 0.04;
10352			} else {
10353				var yMult = 0.045;
10354				var xMult = 0.075;
10355			}
10356			
10357			var bdst = bd.scrollTop || htm.scrollTop,
10358				bdsl = bd.scrollLeft,
10359				pageX = (touchEnabled)? e.touches[0].pageX : e.pageX,
10360				pageY = (touchEnabled)? e.touches[0].pageY : e.pageY,
10361				offsets = elem.getBoundingClientRect(),
10362				w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, // width
10363				h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, // height
10364				wMultiple = 320/w,
10365				offsetX = 0.52 - (pageX - offsets.left - bdsl)/w, //cursor position X
10366				offsetY = 0.52 - (pageY - offsets.top - bdst)/h, //cursor position Y
10367				dy = (pageY - offsets.top - bdst) - h / 2, //@h/2 = center of container
10368				dx = (pageX - offsets.left - bdsl) - w / 2, //@w/2 = center of container
10369				yRotate = (offsetX - dx)*(yMult * wMultiple), //rotation for container Y
10370				xRotate = (dy - offsetY)*(xMult * wMultiple); //rotation for container X //old
10371
10372				//imgCSS = ' rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateZ(0)'; //img transform
10373				if($(elem).parents('.wpb_gallery').length > 0) {
10374					var imgCSS = ' perspective('+ w*3 +'px) rotateX(' + -xRotate*1.9 + 'deg) rotateY(' + -yRotate*1.3 + 'deg)'; //img transform	
10375				} else {
10376					if($(elem).parents('.wide_tall').length == 0 && $(elem).parents('.wide').length == 0 && $(elem).parents('.tall').length == 0) {
10377						var imgCSS = ' perspective('+ w*3 +'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg)  translateY('+offsetY*-10+'px) translateX('+offsetX*-10+'px) scale(1.03)'; //img transform
10378					} else {
10379						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	
10380					}
10381				}
10382				//imgCSS2 = 'perspective('+ w*3 +'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateZ(0) translateY('+offsetY*-10+'px) translateX('+offsetX*-10+'px)'; //img transform //old
10383
10384				
10385			//container transform
10386			if(elem.firstChild.className.indexOf(' over') != -1){
10387				if($(elem).parents('.portfolio-items.masonry-items').length > 0){
10388					//imgCSS2 = ' scale3d(1.025,1.025,1.025)';
10389				} else {
10390					//imgCSS2 = ' scale3d(1.06,1.06,1.06)';
10391				}
10392			
10393				
10394
10395			}
10396		
10397			//elem.firstChild.style.transform = imgCSS;
10398			$(elem).find('.parallaxImg-container').css('transform',imgCSS);
10399
10400			if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) {
10401				$(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform',imgCSS);
10402			}
10403			//elem.style.transform = imgCSS2;
10404
10405			
10406		}
10407
10408		function processShineMovement(e, touchEnabled, elem, layers, totalLayers, shine){
10409
10410			var bdst = bd.scrollTop || htm.scrollTop,
10411				bdsl = bd.scrollLeft,
10412				pageX = (touchEnabled)? e.touches[0].pageX : e.pageX,
10413				pageY = (touchEnabled)? e.touches[0].pageY : e.pageY,
10414				offsets = elem.getBoundingClientRect(),
10415				w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, // width
10416				h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, // height
10417				wMultiple = 320/w,
10418				offsetX = 0.52 - (pageX - offsets.left - bdsl)/w, //cursor position X
10419				offsetY = 0.52 - (pageY - offsets.top - bdst)/h, //cursor position Y
10420				dy = (pageY - offsets.top - bdst) - h / 2, //@h/2 = center of container
10421				dx = (pageX - offsets.left - bdsl) - w / 2, //@w/2 = center of container
10422				yRotate = (offsetX - dx)*(0.040 * wMultiple), //rotation for container Y
10423				xRotate = (dy - offsetY)*(0.070 * wMultiple), //rotation for container X
10424				
10425				arad = Math.atan2(dy, dx), //angle between cursor and center of container in RAD
10426				angle = arad * 180 / Math.PI - 90; //convert rad in degrees
10427
10428
10429			//get angle between 0-360
10430			if (angle < 0) {
10431				angle = angle + 360;
10432			}
10433
10434			//gradient angle and opacity for shine
10435			shine.style.background = 'linear-gradient(' + angle + 'deg, rgba(255,255,255,' + (pageY - offsets.top - bdst)/h * 0.3 + ') 0%,rgba(255,255,255,0) 80%)';
10436			shine.style.transform = 'translateX(' + (offsetX * totalLayers) - 0.1 + 'px) translateY(' + (offsetY * totalLayers) - 0.1 + 'px) ';	
10437
10438			
10439		}
10440
10441		function processEnter(e, elem, layers, totalLayers, shine){
10442			//var sAgent = window.navigator.userAgent;
10443  			//var Idx = sAgent.indexOf("Edge");
10444
10445			elem.firstChild.className += ' over';
10446			elem.className += ' over';
10447
10448			//if(Idx == -1) {
10449				//$('body').addClass('cssreflections');
10450				//$(elem).addClass('transition');
10451			//	//var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },150);
10452			//} else {
10453				$(elem).addClass('transition');
10454
10455				if($(elem).parents('.wpb_gallery').length > 0) {
10456					var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },450);
10457				} else {
10458					var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },200);
10459				}
10460			//}
10461
10462			//depths(false, elem, layers, totalLayers, shine);
10463		}
10464
10465		function processExit(e, elem, layers, totalLayers, shine){
10466
10467			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
10468			var container = elem.firstChild;
10469
10470			container.className = container.className.replace(' over','');
10471			elem.className = elem.className.replace(' over','');
10472			$(container).css('transform', 'perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
10473			$(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform','perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
10474			//elem.style.transform = 'perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0) translateX(0) translateY(0)';
10475			//shine.style.cssText = '';
10476			
10477			//for(var ly=0;ly<totalLayers;ly++){
10478				//layers[ly].style.transform = '';
10479			//}
10480
10481			$(elem).addClass('transition');
10482				var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },200);
10483
10484			//removeDepths(false, elem, layers, totalLayers, shine);
10485
10486		}
10487
10488		function depths(touchEnabled, elem, layers, totalLayers, shine) {
10489			
10490			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
10491			var revNum = totalLayers;
10492			var container = elem.firstChild;
10493			
10494			//set z
10495			for(var ly=0;ly<totalLayers;ly++){
10496				//layers[ly].style.transform = 'translateX(' + (offsetX * revNum) * ((ly * 2.5) / wMultiple) + 'px) translateY(' + (offsetY * totalLayers) * ((ly * 2.5) / wMultiple) + 'px) translateZ(0)';
10497				if(ly == 0) $(layers[ly]).css('transform', 'translateZ(0px)');
10498				else $(layers[ly]).css('transform','translateZ(' +(w*3)/27*(ly*1.1) + 'px) ');
10499
10500				revNum--;
10501			}
10502			
10503			totalLayers = totalLayers + 3;
10504
10505			//set perspective from beginning
10506			$(container).css('transform','perspective('+ w*3 +'px)');
10507
10508			//$(elem).parents('.col').find('.parallaxImg-shine').css('transform','translateZ('+(w*3)/70*(totalLayers*1.1) +'px)');
10509		}
10510
10511		function removeDepths(touchEnabled, elem, layers, totalLayers, shine) {
10512			
10513			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
10514			var revNum = totalLayers;
10515			
10516			//set z
10517			for(var ly=0;ly<totalLayers;ly++){
10518				
10519				if(ly == 0) $(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)');
10520				else $(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)');
10521
10522				revNum--;
10523			}
10524			
10525			totalLayers = totalLayers + 3;
10526			
10527		}
10528	}
10529
10530	style6Img();
10531
10532	function portfolioDeviceCheck(){
10533		if($('body').hasClass('mobile') || navigator.userAgent.match(/(iPad|IEMobile)/) ){
10534			
10535			//if using more details
10536			if($('.portfolio-items .col .work-item').find('a:not(".pp")').length > 0){
10537				$('.portfolio-items .col .work-item').find('a.pp').css('display','none');
10538			} 
10539			
10540			//if only using pp
10541			else {
10542				$('.portfolio-items .col .work-item').find('a:not(".pp")').css('display','none');
10543			}
10544		
10545		} else {
10546			$('.portfolio-items .col .work-item').find('a').css('display','inline');
10547		}
10548	}
10549	
10550	
10551	//portfolio fullscreen zoom slider
10552
10553	//remove outside of column setups 
10554	$('.nectar_fullscreen_zoom_recent_projects').each(function(){
10555		if($(this).parents('.span_12').find('> .wpb_column').length > 1){
10556			var $zoomProjects = $(this).clone();
10557			var $zoomProjectsRow = $(this).parents('.span_12');
10558			$(this).remove();
10559			$zoomProjectsRow.prepend($zoomProjects);
10560		}
10561	});
10562
10563	 $.fn.lines = function (opts) {
10564        var s = $.extend({
10565            'lineClass' : 'line'
10566        },opts);
10567        return this.each(function () {
10568            var self = this,
10569                $self = $(self),
10570                $line,
10571                $prev;
10572            $self.find('.' + s.lineClass).contents().unwrap();
10573            $self.html(function (i, h) {
10574                return h.replace(/(\b[\w']+\b)/g, '<span class="' + s.lineClass + '">$1</span>');
10575            });
10576
10577            $self.find('.line + .line').each(function(i, el){
10578                $line = $(this),
10579                $prev = $line.prev('.line');
10580                if ($line.offset().top === $prev.offset().top) {
10581                    $prev.append(el.previousSibling, $line.contents());
10582                    $line.remove();
10583                }
10584            });
10585        });
10586    };
10587
10588	function portfolioFullScreenText() {
10589		$('.nectar_fullscreen_zoom_recent_projects').each(function(){
10590			$(this).find('.project-slide').each(function(i){
10591
10592				$(this).find('.project-info h1 > span > span.inner').unwrap();
10593
10594				$(this).find('.project-info h1 > span').each(function(){
10595					var spantext = $(this).text();
10596   					 $(this).replaceWith(spantext);
10597				});
10598
10599				var spanInserted = $(this).find('.project-info h1').html().split(" ").join(" </span> <span>");
10600				var wrapped = ("<span>").concat(spanInserted, "</span>");
10601				$(this).find('.project-info h1').html(wrapped);
10602				var refPos = $(this).find('.project-info h1 > span:first-child').position().top;
10603				var newPos;
10604
10605				$(this).find('.project-info h1 > span').each(function(index) {
10606					if($(this).text().trim().length > 0) {
10607
10608					    newPos = $(this).position().top   
10609	
10610					    if (index == 0){
10611					       return;
10612					    }
10613					    if (newPos == refPos){
10614					        $(this).prepend($(this).prev().text());
10615					        $(this).prev().remove();
10616					    } 
10617					    refPos = newPos;
10618					} else {
10619						//remove empty space spans
10620						$(this).remove();
10621					}
10622				});
10623
10624				$(this).find('.project-info h1 > span').wrapInner('<span class="inner" />');
10625
10626			});
10627		});
10628		
10629	}
10630
10631	function portfolioFullScreenSliderCalcs() {
10632
10633		var $bodyBorderSize = ($('.body-border-top').length > 0 && $(window).width() > 1000) ? $('.body-border-top').height(): 0;
10634
10635		$('.nectar_fullscreen_zoom_recent_projects').each(function(){
10636			if($(this).parents('.first-section').length > 0) {
10637				$(this).css('height',$(window).height() - $(this).offset().top - $bodyBorderSize);
10638			} else {
10639				$(this).css('height',$(window).height());
10640			}
10641		});
10642
10643	}
10644
10645				
10646	function portfolioSliderRotate(slider){
10647		
10648		var $slideLength = slider.find('.dot-nav > span').length;
10649		var $currentSlide = slider.find('.dot-nav > span.active').index();
10650		if( $currentSlide+1 == $slideLength) {
10651			slider.find('.dot-nav > span:first-child').click();
10652		} else {
10653			slider.find('.dot-nav > span.active').next('span').click();
10654		}
10655	}
10656	
10657	function portfolioSliderResetRotate(slider){
10658		clearInterval($portfolioSliderRotate);
10659
10660		//reinit autorotate
10661		if(slider.attr('data-autorotate').length > 0) {
10662			slide_interval = (parseInt(slider.attr('data-autorotate')) < 100) ? 4000 : parseInt(slider.attr('data-autorotate'));
10663			$portfolioSliderRotate = setInterval(function(){ portfolioSliderRotate(slider) },slide_interval);
10664		}
10665	}
10666
10667	var $portfolioSliderRotate;
10668
10669	if($('.nectar_fullscreen_zoom_recent_projects').length > 0){
10670		portfolioFullScreenSliderCalcs();
10671		portfolioFullScreenText();
10672		$(window).resize(portfolioFullScreenText);
10673		$(window).resize(portfolioFullScreenSliderCalcs);
10674	}
10675
10676	$('.nectar_fullscreen_zoom_recent_projects').each(function(){
10677
10678
10679		var $projLength = $(this).find('.project-slide').length;
10680
10681		//autorotate
10682		if($(this).attr('data-autorotate').length > 0) {
10683			slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
10684			var $that = $(this);
10685			$portfolioSliderRotate = setInterval(function(){ portfolioSliderRotate($that) },slide_interval);
10686		}
10687
10688		//next/prev
10689		$(this).find('.zoom-slider-controls .next').click(function(){
10690
10691			//thres
10692			
10693			var $that = $(this);
10694			if(!$that.parent().hasClass('timeout')) {
10695				setTimeout(function(){
10696					$that.parent().removeClass('timeout');
10697				},1150);
10698			}
10699
10700			if($(this).parent().hasClass('timeout')) return false;
10701			$(this).parent().addClass('timeout');
10702			//switch logic
10703
10704			portfolioSliderResetRotate($that.parents('.nectar_fullscreen_zoom_recent_projects'));
10705			
10706			var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current');
10707			var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects');
10708
10709			$sliderInstance.find('.project-slide').removeClass('next').removeClass('prev');
10710			$sliderInstance.find('.project-slide').each(function(i){
10711
10712				if(i < $current.index()+1 && $current.index()+1 < $projLength)
10713					$(this).addClass('prev');
10714				else
10715					$(this).addClass('next');
10716			});
10717
10718			if($current.index()+1 == $projLength) {
10719				$sliderInstance.find('.project-slide:first-child').addClass('no-trans');
10720			}
10721
10722			setTimeout(function(){
10723
10724				if($current.index()+1 == $projLength) {
10725					$sliderInstance.find('.project-slide:first-child').removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
10726					$sliderInstance.find('.project-slide:last-child').removeClass('next').removeClass('current').addClass('prev');
10727				} else {
10728					$current.next('.project-slide').removeClass('next').removeClass('prev').addClass('current');
10729					$current.removeClass('current').addClass('prev');
10730				}
10731
10732				//update dot nav
10733				if($sliderInstance.find('.dot-nav').length > 0) {
10734					$sliderInstance.find('.dot-nav span.active').removeClass('active');
10735					$sliderInstance.find('.dot-nav span:nth-child('+ ($sliderInstance.find('.project-slide.current').index() + 1) +')').addClass('active');
10736				}
10737
10738			},30);
10739
10740			return false;
10741			
10742		});
10743
10744		$(this).find('.zoom-slider-controls .prev').click(function(){
10745
10746			//thres
10747			var $that = $(this);
10748			if(!$that.parent().hasClass('timeout')) {
10749				setTimeout(function(){
10750					$that.parent().removeClass('timeout');
10751				},1150);
10752			}
10753
10754			if($(this).parent().hasClass('timeout')) return false;
10755			$(this).parent().addClass('timeout');
10756			
10757			portfolioSliderResetRotate($that.parents('.nectar_fullscreen_zoom_recent_projects'));
10758
10759			//switch logic
10760			var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current');
10761			var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects');
10762
10763			
10764			$sliderInstance.find('.project-slide').removeClass('next').removeClass('prev');
10765			$sliderInstance.find('.project-slide').each(function(i){
10766
10767				if(i < $current.index() || $current.index() == 0)
10768					$(this).addClass('prev');
10769				else
10770					$(this).addClass('next');
10771			});
10772
10773			if($current.index() == 0)
10774				$sliderInstance.find('.project-slide:last-child').addClass('no-trans');
10775
10776			setTimeout(function(){
10777
10778				if($current.index() == 0) {
10779					$sliderInstance.find('.project-slide:last-child').removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
10780					$sliderInstance.find('.project-slide:first-child').removeClass('next').removeClass('prev').removeClass('current').addClass('next');
10781				} else {
10782					$current.prev('.project-slide').removeClass('next').removeClass('prev').addClass('current');
10783					$current.removeClass('current').addClass('next');
10784				}
10785
10786				//update dot nav
10787				if($sliderInstance.find('.dot-nav').length > 0) {
10788					$sliderInstance.find('.dot-nav span.active').removeClass('active');
10789					$sliderInstance.find('.dot-nav span:nth-child('+ ($sliderInstance.find('.project-slide.current').index() + 1) +')').addClass('active');
10790				}
10791
10792			},30);
10793
10794
10795			return false;
10796
10797			
10798		});
10799
10800		//pagination
10801		//if($(this).is('[data-slider-controls="both"]') || $(this).is('[data-slider-controls="pagination"]')) {
10802			$(this).find('> .normal-container').append('<div class="dot-nav"></div>');
10803			for(var $i=0;$i < $projLength;$i++) {
10804				if($i == 0) {
10805					$(this).find('.dot-nav').append('<span class="dot active"><span></span></span>');
10806				} else {
10807					$(this).find('.dot-nav').append('<span class="dot"><span></span></span>');
10808				}
10809		
10810			}
10811		//}
10812
10813		var $dotIndex = 1;
10814
10815		$('.nectar_fullscreen_zoom_recent_projects .dot-nav > span').click(function(){
10816
10817			if($(this).hasClass('active')) return;
10818
10819			//thres
10820			var $that = $(this);
10821			if(!$that.parent().hasClass('timeout')) {
10822				setTimeout(function(){
10823					$that.parent().removeClass('timeout');
10824				},1150);
10825			}
10826
10827			if($(this).parent().hasClass('timeout')) return;
10828			$(this).parent().addClass('timeout');
10829
10830			portfolioSliderResetRotate($that.parents('.nectar_fullscreen_zoom_recent_projects'));
10831
10832			//switch logic
10833			$(this).parent().find('span.active').removeClass('active');
10834			$(this).addClass('active');
10835
10836			$dotIndex = $(this).index() + 1;
10837
10838			var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current');
10839			var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects');
10840
10841			var $prevIndex = $current.index() + 1;
10842
10843			$sliderInstance.find('.project-slide').removeClass('next').removeClass('prev');
10844
10845			$sliderInstance.find('.project-slide').each(function(i){
10846				if(i < $dotIndex-1)
10847					$(this).addClass('prev');
10848				else
10849					$(this).addClass('next');
10850			});
10851
10852			//going prev
10853			if($prevIndex > $dotIndex) {
10854				$sliderInstance.find('.project-slide').eq($dotIndex-1).addClass('no-trans').addClass('prev').removeClass('next');
10855				setTimeout(function(){
10856					$sliderInstance.find('.project-slide').eq($dotIndex-1).removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
10857					$current.removeClass('current').addClass('next');
10858				},30);
10859			
10860			} 
10861
10862			//going forawrd
10863			else {
10864				$sliderInstance.find('.project-slide').eq($dotIndex-1).addClass('no-trans').addClass('next').removeClass('prev');
10865				setTimeout(function(){
10866					$sliderInstance.find('.project-slide').eq($dotIndex-1).removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
10867					$current.removeClass('current').addClass('prev');
10868				},30);
10869
10870			}
10871			
10872		});	
10873
10874
10875	});
10876
10877	
10878 	
10879
10880	//portfolio accent color
10881	function portfolioAccentColor() {
10882
10883		var portfolioSocialColorCss = '';
10884
10885		$('.portfolio-items .col').each(function(){
10886			if ($(this).has('[data-project-color]')) { 
10887				$(this).find('.work-info-bg, .bottom-meta').css('background-color',$(this).attr('data-project-color'));
10888
10889				//style5
10890				$(this).find('.parallaxImg-rendered-layer .bg-overlay').css('border-color',$(this).attr('data-project-color'));
10891
10892				var	$projColor = $(this).attr('data-project-color');
10893				if($(this).find('.custom-content .nectar-social').length > 0 && $('body[data-button-style="rounded"]') ) portfolioSocialColorCss += 'body[data-button-style="rounded"] .col[data-
10893project-color="'+$projColor+'"] .custom-content .nectar-social > *:hover i { color: '+ $projColor +'!important; } ';
10894
10895			}
10896		});
10897		
10898		if(portfolioSocialColorCss.length > 1) {
10899
10900			var head = document.head || document.getElementsByTagName('head')[0];
10901			var style = document.createElement('style');
10902
10903				style.type = 'text/css';
10904			if (style.styleSheet){
10905			  style.styleSheet.cssText = portfolioSocialColorCss;
10906			} else {
10907			  style.appendChild(document.createTextNode(portfolioSocialColorCss));
10908			}
10909
10910			head.appendChild(style);
10911		}
10912	}
10913	portfolioAccentColor();
10914	
10915	//portfolio sort
10916	$('body').on('mouseenter','.portfolio-filters',function(){
10917		$(this).find('> ul').stop(true,true).slideDown(500,'easeOutExpo');
10918		$(this).find('a#sort-portfolio span').html($(this).find('a#sort-portfolio').attr('data-sortable-label'));
10919	});
10920
10921	$('body').on('mouseleave','.portfolio-filters',function(){
10922		var $activeCat = $(this).find('a.active').html();
10923		if( typeof $activeCat == 'undefined' || $activeCat.length == 0) $activeCat = $(this).attr('data-sortable-label');
10924		$(this).find('a#sort-portfolio span').html($activeCat);
10925		$(this).find('> ul').stop(true,true).slideUp(500,'easeOutExpo');
10926	});
10927	
10928	//portfolio selected category
10929	$('body').on('click','.portfolio-filters ul li a', function(){
10930		$(this).parents('.portfolio-filters').find('#sort-portfolio span').html($(this).html());
10931	});
10932	
10933	//inline portfolio selected category
10934	$('body').on('click','.portfolio-filters-inline ul li a',function(){
10935
10936		$(this).parents('ul').find('li a').removeClass('active');
10937		$(this).addClass('active');
10938		$(this).parents('.portfolio-filters-inline').find('#current-category').html($(this).html());
10939		
10940	});
10941	
10942
10943	function portfolioFiltersInit() {
10944		//mobile sort menu fix
10945		if($('body').hasClass('mobile') || navigator.userAgent.match(/(iPad|IEMobile)/)){
10946			$('.portfolio-filters').unbind('mouseenter mouseleave');
10947			$('.portfolio-filters > a, .portfolio-filters ul li a').click(function(e){
10948				if(e.originalEvent !== undefined) $(this).parents('.portfolio-filters').find('> ul').stop(true,true).slideToggle(600,'easeOutCubic');
10949			});
10950		}
10951
10952		if($('.portfolio-filters-inline[data-alignment="left"]').length > 0 || $('.portfolio-filters-inline[data-alignment="center"]').length > 0) {
10953			$('.portfolio-filters-inline .container > ul > li:nth-child(1) a').click();
10954		} else {
10955			$('.portfolio-filters-inline .container > ul > li:nth-child(2) a').click();
10956		}
10957		
10958		//portfolio more details page menu highlight
10959		$('body.single-portfolio #header-outer nav > ul > li > a:contains("Portfolio")').parents('li').addClass('current-menu-item');
10960		
10961		//blog page highlight
10962		$('body.single-post #header-outer nav > ul > li > a:contains("Blog")').parents('li').addClass('current-menu-item');
10963	}
10964
10965	portfolioFiltersInit();
10966
10967	
10968	//blog love center
10969	function centerLove(){
10970		$('.post').each(function(){
10971			
10972			var $loveWidth = $(this).find('.post-meta .nectar-love').outerWidth();
10973			var $loveWrapWidth = $(this).find('.post-meta  .nectar-love-wrap').width();
10974			
10975			//center
10976			$(this).find('.post-meta .nectar-love').css('margin-left', $loveWrapWidth/2 - $loveWidth/2 + 'px' );
10977			$(this).find('.nectar-love-wrap').css('visibility','visible');
10978		});
10979	}
10980	
10981	$('.nectar-love').on('click',function(){
10982		centerLove();
10983	});
10984	
10985	centerLove();	
10986	
10987
10988	//portfolio single comment order
10989	function portfolioCommentOrder(){
10990	
10991		if($('body').hasClass('mobile') && $('body').hasClass('single-portfolio') && $('#respond').length > 0){
10992			$('#sidebar').insertBefore('.comments-section');
10993		}
10994		 
10995		else if($('body').hasClass('single-portfolio') && $('#respond').length > 0) {
10996			$('#sidebar').insertAfter('#post-area');
10997		}
10998		
10999	}
11000
11001	 portfolioCommentOrder();
11002	 
11003	
11004	//portfolio sidebar follow
11005	
11006	var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
11007	
11008	function portfolioSidebarFollow(){
11009
11010		sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
11011	
11012		if( $('body.single-portfolio').length > 0 && sidebarFollow == 1 && !$('body').hasClass('mobile') && parseInt($('#sidebar').height()) + 50 <= parseInt($('#post-area').height())) {
11013			
11014			 $('#sidebar').addClass('fixed-sidebar');
11015			 
11016			 var $footer = ($('.comment-wrap.full-width-section').length == 0) ? '#footer-outer' : '.comment-wrap';
11017			 if( $('#call-to-action').length > 0 ) $footer = '#call-to-action';
11018			 
11019			 //convert width into px
11020			 sidebarPxConversion();
11021			 
11022			 $('#sidebar').stickyMojo({footerID: $footer, contentID: '#post-area'});
11023			 
11024		}
11025		
11026	}
11027	
11028	function sidebarPxConversion(){
11029		
11030		if( $('body.single-portfolio').length > 0 && sidebarFollow == 1 && !$('body').hasClass('mobile') ) {
11031			
11032			var $containerWidth = $('.main-content > .row').width();
11033			var $sidebarWidth = $containerWidth*.235;
11034			
11035			if(window.innerWidth > 1300){
11036				$sidebarWidth = $containerWidth*.235;
11037			} else if(window.innerWidth < 1300 && window.innerWidth > 1000 ) {
11038				$sidebarWidth = $containerWidth*.273;
11039			}
11040			
11041			$('#sidebar').css('width',$sidebarWidth+'px');
11042		}
11043	}
11044	
11045	$(window).load(function(){
11046		setTimeout(portfolioSidebarFollow,200);
11047	});
11048	
11049	
11050	//remove the portfolio filters that are not found in the current page
11051	function isotopeCatSelection() {
11052
11053
11054		$('.portfolio-items:not(".carousel")').each(function(){
11055
11056			var isotopeCatArr = [];
11057			var $portfolioCatCount = 0;
11058			$(this).parent().parent().find('div[class^=portfolio-filters] ul li').each(function(i){
11059				if($(this).find('a').length > 0) {
11060					isotopeCatArr[$portfolioCatCount] = $(this).find('a').attr('data-filter').substring(1);	
11061					$portfolioCatCount++;
11062				}
11063			});
11064			
11065			////ice the first (all)
11066			isotopeCatArr.shift();
11067			
11068			
11069			var itemCats = '';
11070			
11071			$(this).find('> div').each(function(i){
11072				itemCats += $(this).attr('data-project-cat');
11073			});
11074			itemCats = itemCats.split(' ');
11075			
11076			////remove the extra item on the end of blank space
11077			itemCats.pop();
11078			
11079			////make sure the array has no duplicates
11080			itemCats = $.unique(itemCats);
11081			
11082			////if user has chosen a set of filters to display - only show those
11083			if($(this).attr('data-categories-to-show').length != 0 && $(this).attr('data-categories-to-show') != 'all') {
11084				$userSelectedCats = $(this).attr('data-categories-to-show').replace(/,/g , ' ');
11085				$userSelectedCats = $userSelectedCats.split(' ');
11086				
11087				if(!$(this).hasClass('infinite_scroll')) $(this).removeAttr('data-categories-to-show');
11088			} else {
11089				$userSelectedCats = itemCats;
11090			}
11091			
11092			
11093			////Find which categories are actually on the current page
11094			var notFoundCats = [];
11095			$.grep(isotopeCatArr, function(el) {
11096
11097		    	if ($.inArray(el, itemCats) == -1) notFoundCats.push(el);
11098		    	if ($.inArray(el, $userSelectedCats) == -1) notFoundCats.push(el);
11099
11100			});
11101			
11102			//manipulate the list
11103			if(notFoundCats.length != 0){
11104				$(this).parent().parent().find('div[class^=portfolio-filters] ul li').each(function(){
11105					if($(this).find('a').length > 0) {
11106						if( $.inArray($(this).find('a').attr('data-filter').substring(1), notFoundCats) != -1 ){ 
11107							$(this).hide(); 
11108						} else {
11109							$(this).show();
11110						}
11111					}
11112				})
11113			}
11114		});
11115	}
11116	
11117	isotopeCatSelection();
11118	
11119	
11120	//sharing buttons
11121
11122	var completed = 0;
11123	var windowLocation = window.location.href.replace(window.location.hash, '');
11124
11125	function facebookShare(){
11126		windowLocation = window.location.href.replace(window.location.hash, '');
11127		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" ) 
11128		return false;
11129	}
11130
11131	function googlePlusShare(){
11132		windowLocation = window.location.href.replace(window.location.hash, '');
11133		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" ) 
11134		return false;
11135	}
11136
11137	function twitterShare(){
11138        windowLocation = window.location.href.replace(window.location.hash, '');		
11139		if($(".section-title h1").length > 0) {
11140			var $pageTitle = encodeURIComponent($(".section-title h1").text());
11141		} else {
11142			var $pageTitle = encodeURIComponent($(document).find("title").text());
11143		}
11144		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" ) 
11145		return false;
11146	}
11147
11148	function wooTwitterShare(){
11149		windowLocation = window.location.href.replace(window.location.hash, '');
11150		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" ) 
11151		return false;
11152	}
11153
11154	function linkedInShare(){
11155	    windowLocation = window.location.href.replace(window.location.hash, '');	
11156		if($(".section-title h1").length > 0) {
11157			var $pageTitle = encodeURIComponent($(".section-title h1").text());
11158		} else {
11159			var $pageTitle = encodeURIComponent($(document).find("title").text());
11160		}
11161		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" ) 
11162		return false;
11163	}
11164
11165	function woolinkedInShare(){
11166	    windowLocation = window.location.href.replace(window.location.hash, '');	
11167		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" ) 
11168		return false;
11169	}
11170
11171	function pinterestShare(){
11172		windowLocation = window.location.href.replace(window.location.hash, '');
11173		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'); 
11174		
11175		if($(".section-title h1").length > 0) {
11176			var $pageTitle = encodeURIComponent($(".section-title h1").text());
11177		} else {
11178			var $pageTitle = encodeURIComponent($(document).find("title").text());
11179		}
11180		
11181		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" ) 
11182		return false;
11183	}
11184	
11185	function wooPinterestShare(){
11186		$imgToShare = ($('img.attachment-shop_single').length > 0) ? $('img.attachment-shop_single').first().attr('src') : $('.single-product-main-image img').first().attr('src');
11187		windowLocation = window.location.href.replace(window.location.hash, '');
11188		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" ) 
11189		return false;
11190	}
11191
11192
11193	function socialFade(){
11194			if(completed == $('a.nectar-sharing').length && $('a.nectar-sharing').parent().hasClass('in-sight')) {
11195
11196				//$timeout = ($('#page-header-bg[data-animate-in-effect="slide-down"] .nectar-social').length > 0 ) ? 500 : 1;
11197			//	setTimeout(function(){
11198					//$('.nectar-social > a').stop(true,true).transition({'padding-right':'15px'},350,'easeOutSine');
11199					
11200					//love fadein
11201					$('.nectar-social .nectar-love span').show(350,'easeOutSine',function(){
11202						$(this).stop().animate({'opacity':1},800);
11203					});
11204					
11205					//sharing loadin
11206					$('.nectar-social > a').each(function(i){
11207						var $that = $(this);
11208						
11209						$(this).find('> span').show(350,'easeOutSine',function(){
11210							$that.find('> span').stop().animate({'opacity':1},800);
11211						});
11212						
11213					});
11214				//},$timeout);
11215
11216				//alt blog layout total share count
11217				var $totalShares = 0;
11218				$('.nectar-social > a .count').each(function(){
11219					$totalShares += parseInt($(this).html());
11220				});
11221
11222				if($totalShares != 1){
11223					$('.single .meta-share-count .plural').css({'opacity':'1', 'display':'inline'});
11224					$('.single .meta-share-count .singular').remove();
11225				} else {
11226					$('.single .meta-share-count .singular').css({'opacity':'1', 'position':'relative',  'display':'inline'});
11227					$('.single .meta-share-count .plural').remove();
11228				}
11229
11230				$('.meta-share-count .share-count-total').html($totalShares).css('opacity',1);
11231			}
11232		}
11233
11234	$('body').on('click','#single-below-header .nectar-social a', function(){ return false; });
11235
11236	$('body').on('click','.facebook-share:not(.inactive)', facebookShare);
11237	$('body').on('click','.google-plus-share:not(.inactive)', googlePlusShare);
11238	$('body').on('click','.nectar-social:not(".woo") .twitter-share:not(.inactive)', twitterShare);
11239	$('body').on('click','.nectar-social.woo .twitter-share', wooTwitterShare);
11240	$('body').on('click','.nectar-social:not(".woo") .linkedin-share:not(.inactive)', linkedInShare);
11241	$('body').on('click','.nectar-social.woo .linkedin-share', woolinkedInShare);
11242	$('body').on('click','.nectar-social:not(".woo") .pinterest-share:not(.inactive)', pinterestShare);
11243	$('body').on('click','.nectar-social.woo .pinterest-share', wooPinterestShare);
11244	$('body').on('click','.nectar-social-sharing-fixed > a', function(){ return false; });
11245
11246	function socialSharingInit() {
11247
11248		//mobile fullscreen blog class for click event fix
11249		if($('body').hasClass('mobile') && $('.single-post .fullscreen-header').length > 0) {
11250			$('#single-below-header .nectar-social .nectar-sharing, #single-below-header .nectar-social .nectar-sharing-alt').addClass('inactive');
11251		}
11252
11253		completed = 0;
11254
11255		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) {
11256  
11257		 
11258			////facebook
11259			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) {
11260				
11261				//load share count on load  
11262				$.getJSON("https://graph.facebook.com/?id="+ windowLocation +"&callback=?", function(data) {
11263					if( data.share != undefined && data.share.share_count != undefined && data.share.share_count != 0 && (data.share.share_count != null)) { 
11264						$('.facebook-share a span.count, a.facebook-share span.count').html( data.share.share_count );	
11265					}
11266					else {
11267						$('.facebook-share a span.count, a.facebook-share span.count').html( 0 );	
11268					}
11269					completed++;
11270					socialFade();
11271				});
11272			 
11273				
11274				
11275			} else if($('a.facebook-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.facebook-share').length > 0) {
11276				completed++;
11277				socialFade();
11278			}
11279			
11280			
11281			////twitter
11282			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) {
11283				//load tweet count on load 
11284				//$.getJSON('https://cdn.api.twitter.com/1/urls/count.json?url='+windowLocation+'&callback=?', function(data) {
11285				//	if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
11286					//	$('.twitter-share a span.count, a.twitter-share span.count').html( data.count );
11287					//}
11288					//else {
11289					$('.twitter-share a span.count, a.twitter-share span.count').html( 0 );
11290					//}
11291					completed++;
11292					socialFade();
11293				//});
11294
11295
11296			} else if($('a.twitter-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.twitter-share').length > 0 ) {
11297				completed++;
11298				socialFade();
11299			}
11300			
11301			
11302			////linkedIn
11303			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) {
11304				//load share count on load 
11305				//$.getJSON('https://www.linkedin.com/countserv/count/share?url='+windowLocation+'&callback=', function(data) {
11306				//	if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
11307				//		$('.linkedin-share a span.count, a.linkedin-share span.count').html( data.count );
11308				//	}
11309				//	else {
11310						$('.linkedin-share a span.count, a.linkedin-share span.count').html( 0 );
11311				//	}
11312					completed++;
11313					socialFade();
11314				//});
11315
11316				
11317			} else if($('a.linkedin-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.linkedin-share').length > 0) {
11318				completed++;
11319				socialFade();
11320			}
11321			
11322			
11323			////pinterest
11324			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) {
11325				//load pin count on load 
11326				$.getJSON('https://api.pinterest.com/v1/urls/count.json?url='+windowLocation+'&callback=?', function(data) {
11327					if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
11328						$('.pinterest-share a span.count, a.pinterest-share span.count').html( data.count );
11329					}
11330					else {
11331						$('.pinterest-share a span.count, a.pinterest-share span.count').html( 0 );
11332					}
11333					completed++;
11334					socialFade();
11335				});
11336
11337			} else if($('a.pinterest-share').length > 0 && $('body[data-button-style="rounded"]').length >  0 || $('.sharing-default-minimal a.pinterest-share').length > 0) {
11338				completed++;
11339				socialFade();
11340
11341			}
11342
11343		//fadeIn
11344		$('a.nectar-sharing > span.count, a.nectar-sharing-alt > span.count').hide().css('width','auto');
11345
11346
11347		//social light up
11348
11349		$('.nectar-social').each(function() {
11350			if($(this).parents('.custom-content').length == 0) {
11351
11352
11353				var $that = $(this);
11354				var waypoint = new Waypoint({
11355	 			element: $that,
11356	 			 handler: function(direction) {
11357
11358					$slide_timeout = ($('#page-header-bg[data-animate-in-effect="slide-down"] .nectar-social').length > 0 ) ? 900 : 1;
11359
11360					setTimeout(function(){
11361
11362						$that.addClass('in-sight');
11363						socialFade();
11364						
11365						if($('#page-header-bg .nectar-social').length == 0) {
11366							$that.find('> *').each(function(i){
11367								
11368								var $that = $(this);
11369								var $timeout = ($('body[data-button-style="rounded"]').length > 0) ? 0: 750;
11370
11371								setTimeout(function(){ 
11372									
11373									$that.delay(i*80).queue(function(){ 
11374										
11375										var $that = $(this); $(this).addClass('hovered'); 
11376										
11377										setTimeout(function(){ 
11378											$that.removeClass('hovered');
11379										},300); 
11380										
11381									});
11382								
11383								},$timeout);
11384							});
11385						}
11386
11387					},$slide_timeout );
11388
11389					$that.addClass('animated-in');
11390					waypoint.destroy();
11391				},
11392				offset: 'bottom-in-view'
11393
11394			}); 
11395
11396
11397				
11398			}
11399			}); 
11400
11401		}
11402
11403	}
11404	
11405	socialSharingInit();
11406
11407
11408	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
11409
11410		var $socialTimeout;
11411		$('body').on('mouseenter','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
11412			clearTimeout($socialTimeout);
11413
11414			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
11415				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'right':'0px'},0);
11416			else 
11417				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'left':'0px'},0);
11418
11419			$(this).parents('[id*="-meta"]').addClass('social-hovered');
11420
11421			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':0},250);
11422			$(this).find('.nectar-social a').each(function(i){
11423				$(this).stop(true).delay(i*40).animate({'opacity': 1,  'left':'0px'}, 150);
11424			});
11425
11426		});
11427
11428	
11429		$('body').on('mouseleave','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
11430			$(this).parents('[id*="-meta"]').removeClass('social-hovered');
11431
11432			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
11433				$(this).find('.nectar-social').stop(true).animate({'opacity': 0,  'right':'-20px'}, 200);
11434			else 
11435				$(this).find('.nectar-social').stop(true).animate({'opacity': 0,  'left':'-20px'}, 200);
11436
11437			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':1},250);
11438
11439			var $that = $(this);
11440			
11441			$socialTimeout = setTimeout(function(){ 
11442				$that.find('.nectar-social').hide(); 
11443				if($that.parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
11444					$that.find('.nectar-social a').stop(true).animate({'opacity': 0,  'left':'20px'},0);   
11445				else 
11446					$that.find('.nectar-social a').stop(true).animate({'opacity': 0,  'left':'-20px'},0);   
11447			}, 200);
11448		});
11449	} else {
11450		var $socialTimeout;
11451		$('body').on('click','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
11452			clearTimeout($socialTimeout);
11453
11454			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
11455				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'right':'0px'},0);
11456			else 
11457				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'left':'0px'},0);
11458
11459			$(this).parents('[id*="-meta"]').addClass('social-hovered');
11460
11461			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':0},250);
11462			$(this).find('.nectar-social a').each(function(i){
11463				$(this).stop(true).delay(i*40).animate({'opacity': 1,  'left':'0px'}, 150);
11464			});
11465
11466			return false;
11467		});
11468
11469	}
11470
11471	$('body').on('mouseenter','.fullscreen-header  .meta-share-count', function(){
11472		$(this).find('> a, > i').stop(true).animate({'opacity': 0},400);
11473		$(this).find('.nectar-social > *').each(function(i){
11474			$(this).stop(true).delay(i*50).animate({'opacity':'1', 'top': '0px'},250,'easeOutCubic');
11475		});
11476		//allow clickable on mobile
11477		setTimeout(function(){ $('.meta-share-count .nectar-sharing, .meta-share-count .nectar-sharing-alt').removeClass('inactive'); },300);
11478	});
11479
11480	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
11481		$('body').on('mouseleave','.fullscreen-header  .meta-share-count', function(){
11482			$(this).find('> a, > i').stop(true).animate({'opacity': 1},300,'easeInCubic');
11483			$(this).find('.nectar-social > *').each(function(i){
11484				$(this).stop(true).animate({'opacity':'0', 'top': '10px'},200,'easeInCubic');
11485			});
11486		});
11487	}
11488
11489
11490
11491
11492	//full width love center
11493	function nectarLoveFWCenter(){
11494		$('.nectar-social.full-width').each(function(){ 
11495			$(this).find('.n-shortcode .nectar-love').css('padding-top', $(this).find('> a').css('padding-top'));
11496		});
11497	}
11498	
11499	nectarLoveFWCenter();
11500	
11501
11502	//-----------------------------------------------------------------
11503	// NectarLove
11504	//-----------------------------------------------------------------
11505	
11506	////love iwth txt
11507	$('.fullscreen-header .nectar-love').each(function(){
11508		if($(this).find('.nectar-love-count').text() == '1') {
11509			$(this).find('span.love-txt.single').css({'visibility':'visible', 'text-indent':'0'});
11510			$(this).find('span.love-txt.plural').css({'visibility':'hidden', 'text-indent':'-9999px'});
11511		} else {
11512			$(this).find('span.love-txt.single').css({'visibility':'hidden', 'text-indent':'-9999px'});
11513			$(this).find('span.love-txt.plural').css({'visibility':'visible', 'text-indent':'0'});
11514		}
11515	});
11516
11517	$('body').on('click','.nectar-love', function() {
11518			
11519
11520			var $loveLink = $(this);
11521			var $id = $(this).attr('id');
11522			var $that = $(this);
11523			
11524			if($loveLink.hasClass('loved')) return false;
11525			if($(this).hasClass('inactive')) return false;
11526			
11527			var $dataToPass = {
11528				action: 'nectar-love', 
11529				loves_id: $id,
11530				love_nonce: nectarLove.loveNonce
11531			}
11532			
11533			$.post(nectarLove.ajaxurl, $dataToPass, function(data){
11534				$loveLink.find('span:not(.love-txt)').html(data);
11535				$loveLink.addClass('loved').attr('title','You already love this!');
11536				$loveLink.find('span:not(.love-txt)').css({'opacity': 1,'width':'auto'});
11537
11538				if($(data).text() == '1') {
11539					$loveLink.find('span.love-txt.single').css({'visibility':'visible', 'text-indent':'0'});
11540					$loveLink.find('span.love-txt.plural').css({'visibility':'hidden', 'text-indent':'-9999px'});
11541				} else {
11542					$loveLink.find('span.love-txt.single').css({'visibility':'hidden', 'text-indent':'-9999px'});
11543					$loveLink.find('span.love-txt.plural').css({'visibility':'visible', 'text-indent':'0'});
11544				}
11545
11546				//ascend
11547				if($('body').hasClass('ascend') && $that.parents('.classic_enhanced').length == 0 ){
11548					//$loveLink.find('.icon-salient-heart.loved').show().transition({ scale: 1 },800,'cubic-bezier(0.15, 0.84, 0.35, 1.5)');
11549					//setTimeout(function(){ $loveLink.find('.icon-salient-heart-2').css('opacity','0'); },400);
11550					//if($loveLink.parents('.sharing-default-minimal').length > 0 && $loveLink.parents('.bottom-meta').length >0 ) $loveLink.find('.icon-salient-heart-2').remove();
11551					$that.find('.icon-salient-heart-2').addClass('loved');
11552				} else if($that.parents('.classic_enhanced').length > 0 ) {
11553					$that.find('.icon-salient-heart-2').addClass('loved');
11554				}
11555			});
11556			
11557			$(this).addClass('inactive');
11558			
11559			return false;
11560	});
11561
11562
11563	
11564	//infinite scroll
11565	function infiniteScrollInit() {
11566
11567		if($('.infinite_scroll').length > 0) {
11568			
11569			//portfolio
11570			$('.portfolio-items.infinite_scroll').infinitescroll({
11571		    	navSelector  : "div#pagination",            
11572		   	    nextSelector : "div#pagination a:first",    
11573		   	    itemSelector : ".portfolio-items.infinite_scroll .element",
11574		   	    finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
11575		        msgText: " ",         
11576		   },function(newElements){
11577		   	
11578
11579				var $container = $('.portfolio-items.infinite_scroll:not(.carousel)');
11580				//loading effect   
11581
11582		        var $newElems = $( newElements ).css('opacity',0);
11583		        //// ensure that images load before adding to masonry layout
11584		        $newElems.imagesLoaded(function(){
11585		          
11586		          $( newElements ).css('opacity',1);
11587
11588		          $container.isotope( 'appended', $( newElements ));
11589		          
11590		          $( newElements ).find('.work-item').addClass('ajax-loaded');
11591		          $( newElements ).addClass('ajax-loaded');
11592		          ///// show elems now they're ready
11593		          
11594		          $(newElements).find('.work-meta, .nectar-love-wrap').css({'opacity':1});
11595		          
11596		          //keep filtering
11597		          if($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) {
11598		          	
11599		          	  if($('.portfolio-filters-inline').length > 0) {
11600		          	  	 var selector = $('.portfolio-filters-inline a.active').attr('data-filter');
11601		          	  } else {
11602		          	  	 var selector = $('.portfolio-filters a.active').attr('data-filter');
11603		          	  }
11604		          	  
11605		          	  $('.portfolio-filters-inline a.active').attr('data-filter');
11606			  	 	  $container.isotope({ filter: selector });
11607		          }
11608		          
11609			  	//set width
11610			  	//portfolioItemWidths();
11611			  	reLayout();
11612
11613		        if($(newElements).find('.work-item.style-5').length > 0) style6Img();
11614
11615	          	if($(newElements).find('.inner-wrap').attr('data-animation') == 'none') {
11616					$('.portfolio-items .col .inner-wrap').removeClass('animated');
11617				} else {
11618
11619					masonryZindex();
11620					$(newElements).each(function(i){
11621
11622						//not already visible
11623						var $that = $(this);
11624						var waypoint = new Waypoint({
11625			 			element: $that,
11626			 			 handler: function(direction) {
11627							
11628							var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 115;
11629						
11630							setTimeout(function(){
11631								$that.addClass("animated-in");
11632							},$portfolioAnimationDelay * $that.attr('data-delay-amount'));
11633						
11634							
11635							waypoint.destroy();
11636						},
11637						offset: $portfolioOffsetPos
11638
11639						}); //waypoint
11640
11641						/*$(this).delay(130*i).queue(function(next){
11642						    $(this).addClass("animated-in");
11643						    next();
11644						});*/
11645	
11646					}); //each
11647				}
11648
11649		       
11650		        portfolioHoverEffects();	
11651				portfolioAccentColor();
11652		         
11653		        //verify smooth scorlling
11654				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') } 
11655				
11656				
11657				//Panr 
11658				if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)) {
11659					
11660					$(".portfolio-items:not(.carousel) .work-item.style-3 img").panr({
11661						scaleDuration: .28
11662					}); 
11663					$(".portfolio-items:not(.carousel) .work-item.style-3-alt img").panr({ scaleDuration: .28, sensitivity: 12.6, scaleTo: 1.08, panDuration: 3 }); 
11664					
11665				}
11666				
11667				//prettyphoto
11668				$('.portfolio-items').each(function(){
11669					var $unique_id = Math.floor(Math.random()*10000);
11670					$(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel','prettyPhoto['+$unique_id+'_gal]').removeClass('pretty_photo');
11671				});
11672		
11673				lightBoxInit();
11674				
11675				piVertCenter();
11676
11677				setTimeout(function(){masonryZindex(); reLayout(); $( newElements ).removeClass('ajax-loaded'); },700);
11678		        
11679		        //recalc the filters
11680		        isotopeCatSelection();
11681
11682		        parallaxRowsBGCals();
11683	          
11684	          }); 
11685		          
11686		       
11687				
11688				
11689				
11690		   });
11691			
11692			
11693			
11694			//blog
11695			$('#post-area.infinite_scroll .posts-container').infinitescroll({
11696		    	navSelector  : "div#pagination",            
11697		   	    nextSelector : "div#pagination a:first",    
11698		   	    itemSelector : "#post-area .posts-container .post",
11699		   	    finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
11700		        msgText: " " 
11701		   },function(newElements){
11702		   	
11703		   	if($('.masonry.meta_overlaid').length == 0) { 
11704			   	//reinit js
11705			   	centerLove();
11706			   	
11707			   	//gallery
11708				$(newElements).find('.flex-gallery').each(function(){
11709					
11710					var $that = $(this);
11711					
11712					 $that.flexslider({
11713				        animation: 'fade',
11714				        smoothHeight: false, 
11715				        animationSpeed: 500,
11716				        useCSS: false, 
11717				        touch: true
11718				    });
11719					
11720					////gallery slider add arrows
11721					$('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="fa fa-angle-right"></i>');
11722					$('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="fa fa-angle-left"></i>');
11723
11724				});
11725			   	
11726			   	
11727			   	//media players
11728			   	if($().mediaelementplayer) $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer();
11729			   	
11730			   	
11731			   	//lightbox
11732			    lightBoxInit();
11733			   	
11734			   	//carousels
11735			   	if($('.carousel').length > 0) {
11736				   	standardCarouselInit();
11737			    	clientsCarouselInit();
11738			    }
11739			   	
11740			   	//iframes
11741			   	showLateIframes();
11742
11743			   	//milestone
11744			   	$(newElements).find('.nectar-milestone').each(function() {
11745					//symbol
11746					if($(this).has('[data-symbol]')) {
11747						if($(this).attr('data-symbol-pos') == 'before') {
11748							$(this).find('.number').prepend($(this).attr('data-symbol'));
11749						} else {
11750							$(this).find('.number').append($(this).attr('data-symbol'));
11751						}
11752					}
11753				});
11754				
11755				if(!$('body').hasClass('mobile')) {
11756					
11757					$(newElements).find('.nectar-milestone').each(function() {
11758						//animation
11759
11760							var $that = $(this);
11761							var waypoint = new Waypoint({
11762				 			element: $that,
11763				 			 handler: function(direction) {
11764								if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
11765								     waypoint.destroy();
11766								     return;
11767								}
11768
11769								var $endNum = parseInt($that.find('.number span').text());
11770
11771								var countOptions = { easingFn: easeOutCubic };
11772								var $countEle = $that.find('.number span:not(.symbol)')[0];
11773								var numAnim = new CountUp($countEle, 0, $endNum,0,2.2,countOptions);
11774								numAnim.start();
11775
11776
11777								$that.addClass('animated-in');
11778								waypoint.destroy();
11779							},
11780							offset: 'bottom-in-view'
11781
11782						}); 
11783
11784						
11785					}); 
11786				}
11787				
11788				//pie chart		
11789			    if($().vcChat) $(newElements).find('.vc_pie_chart').vcChat();
11790		    	
11791		    	//fancy ul
11792		    	nectar_fancy_ul_init();
11793		    	
11794		    	//testimonial slider
11795		    	$('.testimonial_slider').animate({'opacity':'1'},800);
11796		    	createTestimonialControls();
11797				testimonialSliderHeight(); 
11798				testimonialHeightResize();
11799		    	
11800				//bar graph
11801				$(newElements).find('.nectar-progress-bar').each(function(i){
11802				
11803
11804				var $that = $(this);
11805				var waypoint = new Waypoint({
11806		 			element: $that,
11807		 			 handler: function(direction) {
11808						if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
11809						     waypoint.destroy();
11810						     return;
11811						}
11812
11813						var percent = $that.find('span').attr('data-width');
11814						var $endNum = parseInt($that.find('span strong i').text());
11815						
11816						$that.find('span').transition({
11817							'width' : percent + '%'
11818						},1600, 'easeInOutCirc',function(){
11819						});
11820						
11821						$that.find('span strong').transition({
11822							'opacity' : 1
11823						},1350);
11824						
11825						
11826						var countOptions = { useEasing : false };
11827						var $countEle = $that.find('span strong i')[0];
11828						var numAnim = new CountUp($countEle, 0, $endNum,0,1.2,countOptions);
11829						numAnim.start();
11830
11831						
11832						////100% progress bar 
11833						if(percent == '100'){
11834							$that.find('span strong').addClass('full');
11835						}
11836
11837
11838						$that.addClass('animated-in');
11839						waypoint.destroy();
11840					},
11841					offset: 'bottom-in-view'
11842
11843				}); 
11844
11845
11846			
11847				});
11848				
11849				
11850				//columns & images with animation
11851				colAndImgAnimations();
11852				splitLineHeadings();
11853
11854				setTimeout(function(){
11855					videoshortcodeSize();
11856					responsiveVideoIframesInit();
11857					responsiveVideoIframes();
11858					$(window).trigger('resize');
11859				},500);
11860
11861
11862				parallaxRowsBGCals();
11863
11864				$(window).trigger('resize');
11865			   	
11866		   	}//non meta overlaid style 
11867		   	else {
11868		   		parallaxRowsBGCals();
11869
11870				$(window).trigger('resize');
11871		   	}
11872
11873		   	// trigger Masonry as a callback
11874		   	var $container = $('.posts-container');
11875		    if($container.parent().hasClass('masonry')) { 
11876		    	 
11877		    	$(newElements).addClass('masonry-blog-item');
11878				$(newElements).prepend('<span class="bottom-line"></span>');
11879				
11880				//move the meta to the bottom
11881				$(newElements).each(function(){
11882					
11883					var $metaClone = $(this).find('.post-meta').clone();
11884		
11885					$(this).find('.post-meta').remove();
11886					
11887					if($('#post-area.meta_overlaid').length > 0){
11888						$(this).find('.post-header h2').after($metaClone);
11889					} else {
11890						$(this).find('.content-inner').after($metaClone);
11891					}
11892					
11893				});
11894			
11895		    	}//if masonry
11896
11897
11898		    	//loading effect   
11899		    	
11900		        //// hide new items while they are loading
11901		        var $newElems = $( newElements );
11902		        //// ensure that images load before adding to masonry layout
11903
11904		        if($newElems.find('img').length == 0) $newElems = $('body');
11905		        
11906		        $newElems.imagesLoaded(function(){
11907
11908		          $container.isotope( 'appended', $( newElements ));
11909
11910		          flickityBlogInit();
11911
11912		          $( newElements ).addClass('ajax-loaded');
11913		          ///// show elems now they're ready
11914
11915
11916		        //classic enhanced specific 
11917		        if($container.parent().hasClass('classic_enhanced')){
11918					$container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function(){
11919						var $src = $(this).find('img').attr('src');
11920						$(this).css('background-image','url('+$src+')');
11921					});
11922
11923					$container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function(){
11924
11925						$(this).find('.cell').each(function(){
11926							var $src = $(this).find('img').attr('src');
11927							$(this).css('background-image','url('+$src+')');
11928						});
11929						
11930					});
11931				}
11932
11933
11934		          if($(newElements).parents('.posts-container').attr('data-animation') == 'none') {
11935						$( newElements ).find('.inner-wrap').removeClass('animated');
11936					} else {
11937						blogMasonryZindex();
11938						$(newElements).each(function(i){
11939
11940							var $that = $(this);
11941							var waypoint = new Waypoint({
11942
11943					 			element: $that,
11944					 			 handler: function(direction) {
11945									
11946									setTimeout(function(){
11947									    $that.addClass("animated-in");
11948									},80*$that.attr('data-delay-amount'));
11949
11950									waypoint.destroy();
11951								},
11952								offset: '90%'
11953
11954							}); 
11955
11956		
11957						}); //each
11958					}
11959
11960					setTimeout(function(){$( newElements ).removeClass('ajax-loaded'); },700);
11961
11962		        
11963		        });
11964		        
11965		    
11966		   	
11967		   });
11968		   
11969	   }
11970
11971}
11972
11973infiniteScrollInit();
11974
11975function destroyInfiniteScroll(){
11976	$('#post-area.infinite_scroll .posts-container').infinitescroll('destroy');
11977	$('.portfolio-items.infinite_scroll').infinitescroll('destroy');
11978}
11979	
11980/*-------------------------------------------------------------------------*/
11981/*	6.	Scroll to top
11982/*-------------------------------------------------------------------------*/	
11983
11984var $scrollTop = $(window).scrollTop();
11985
11986//starting bind
11987function toTopBind() {
11988	if( $('#to-top').length > 0 && $(window).width() > 1020 || $('#to-top').length > 0 &&  $('#to-top.mobile-enabled').length > 0 ) {
11989		
11990		if($scrollTop > 350){
11991			$(window).on('scroll',hideToTop);
11992		}
11993		else {
11994			$(window).on('scroll',showToTop);
11995		}
11996	}
11997}
11998
11999if($('.nectar-social-sharing-fixed').length == 0) {
12000	toTopBind();
12001} else {
12002	if($(window).width() < 1000) {
12003		if($scrollTop > 150){
12004			$(window).on('scroll',hideFixedSharing);
12005		}
12006		else {
12007			$(window).on('scroll',showFixedSharing);
12008		}
12009	}
12010
12011	$(window).smartresize(function(){
12012		if($(window).width() > 1000) { 
12013			$('.nectar-social-sharing-fixed').addClass('visible');
12014		}	
12015		else if($scrollTop < 150) { 
12016			$(window).off('scroll',hideFixedSharing);
12017			$(window).on('scroll',showFixedSharing);
12018			$('.nectar-social-sharing-fixed').removeClass('visible');	
12019		} else {
12020			$(window).off('scroll',showFixedSharing);
12021			$(window).on('scroll',hideFixedSharing);
12022		}
12023	});
12024}
12025
12026function showFixedSharing(){
12027	
12028	if( $scrollTop > 150){
12029
12030		$('.nectar-social-sharing-fixed').addClass('visible');	
12031		
12032		$(window).off('scroll',showFixedSharing);
12033		$(window).on('scroll',hideFixedSharing);
12034	}
12035
12036}
12037
12038function hideFixedSharing(){
12039	
12040	if( $scrollTop < 150){
12041
12042		$('.nectar-social-sharing-fixed').removeClass('visible');	
12043		
12044		$(window).off('scroll',hideFixedSharing);
12045		$(window).on('scroll',showFixedSharing);
12046	}
12047
12048}
12049
12050
12051
12052function showToTop(){
12053
12054	if( $scrollTop > 350 && $('#slide-out-widget-area.fullscreen.open').length == 0){
12055
12056		$('#to-top').stop().transition({
12057			'bottom' : '17px'
12058		},350,'easeInOutCubic');	
12059		
12060		$(window).off('scroll',showToTop);
12061		$(window).on('scroll',hideToTop);
12062	}
12063
12064}
12065
12066function hideToTop(){
12067	
12068	if( $scrollTop < 350 || $('#slide-out-widget-area.fullscreen.open').length > 0){
12069
12070		$animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350;
12071
12072		$('#to-top').stop().transition({
12073			'bottom' : '-30px'
12074		},$animationTiming,'easeInOutQuint');	
12075		
12076		$(window).off('scroll',hideToTop);
12077		$(window).on('scroll',showToTop);	
12078		
12079	}
12080}
12081
12082
12083//to top color
12084if( $('#to-top').length > 0 ) {
12085	
12086	var $windowHeight, $pageHeight, $footerHeight, $ctaHeight;
12087	
12088	function calcToTopColor(){
12089		$scrollTop = $(window).scrollTop();
12090		$windowHeight = $(window).height();
12091		$pageHeight = $('body').height();
12092		$footerHeight = $('#footer-outer').height();
12093		$ctaHeight = ($('#call-to-action').length > 0) ? $('#call-to-action').height() : 0;
12094		
12095		if( ($scrollTop-35 + $windowHeight) >= ($pageHeight - $footerHeight) && $('#boxed').length == 0){
12096			$('#to-top').addClass('dark');
12097		}
12098		
12099		else {
12100			$('#to-top').removeClass('dark');
12101		}
12102	}
12103	
12104	//calc on scroll
12105	$(window).scroll(calcToTopColor);
12106	
12107	//calc on resize
12108	$(window).resize(calcToTopColor);
12109
12110}
12111
12112//alt style
12113if($('body[data-button-style*="rounded"]').length > 0){
12114	var $clone = $('#to-top .fa-angle-up').clone();
12115	$clone.addClass('top-icon');
12116	$('#to-top').prepend($clone)
12117}
12118
12119//scroll up event
12120$('body').on('click','#to-top, a[href="#top"]',function(){
12121	$('body,html').stop().animate({
12122		scrollTop:0
12123	},800,'easeOutQuad',function(){
12124		if($('.nectar-box-roll').length > 0) {
12125			$('body').trigger('mousewheel', [1, 0, 0]);
12126		}
12127	})
12128	return false;
12129});
12130
12131
12132/* one page scrolling */
12133function scrollSpyInit(){ 
12134
12135	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
12136
12137	if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; }
12138
12139	//prevent jump to rop on empty items
12140	$('header#top .sf-menu li a[href="#"]').on('click',function(e){
12141		e.preventDefault();
12142	});
12143
12144	//remove full page URLs from hash if located on same page to fix current menu class
12145	//if(location.pathname.length > 1) {
12146		$("#header-outer a[href*='" + location.pathname + "']").each(function(){
12147			var $href = $(this).attr('href');
12148
12149			//regular animated anchors
12150			if($href.indexOf("#") != -1 && $('div'+$href.substr($href.indexOf("#"))).length > 0 ) {
12151
12152				$(this).attr('href',$href.substr($href.indexOf("#")));
12153				$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
12154			}
12155
12156			//fullpage is a little different
12157			if($('div[data-fullscreen-anchor-id="'+$href.substr($href.indexOf("#")+1)+'"]').length > 0) {
12158				$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
12159			}
12160
12161		});
12162	//}
12163
12164	$target = ($('.page-submenu[data-sticky="true"]').length == 0) ? '#header-outer nav': '.page-submenu';
12165	$('body').scrollspy({
12166		target: $target,
12167		offset: $headerNavSpace + adminBarHeight + 40
12168	});
12169
12170}
12171
12172function pageLoadHash() {
12173
12174	var $hash = window.location.hash;
12175	var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1,$hash.length) : 0;
12176
12177	if($hash && $($hash).length > 0 || $hash && $('[data-fullscreen-anchor-id="'+$hashSubstrng+'"]').length > 0) {
12178
12179		$hashObj = ($($hash).length > 0) ? $($hash) : $('div[data-fullscreen-anchor-id="'+$hashSubstrng+'"]');
12180
12181		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').outerHeight();
12182		if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; }
12183
12184		$timeoutVar = 0;
12185		if($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
12186			boxRoll(null,-1);
12187			$timeoutVar = 2050;
12188		} 
12189		setTimeout(function(){
12190		
12191			if( $('body[data-permanent-transparent="1"]').length == 0 ) {
12192				
12193				if(!$('body').hasClass('mobile')){
12194					$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
12195					if($('#header-outer[data-remove-fixed="1"]').length > 0) { 
12196						$headerNavSpace = 0;
12197					}
12198					var $scrollTopDistance =  $hashObj.offset().top - parseInt($headerNavSpace) +$resize + 3 - adminBarHeight;
12199				} else {
12200					var $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $hashObj.offset().top + 2 - $headerNavSpace + adminBarHeight : $hashObj.offset().top - adminBarHeight + 1;	
12201				}
12202
12203			} else {
12204				var $scrollTopDistance = $hashObj.offset().top - adminBarHeight + 1;
12205			}
12206
12207			if($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
12208				//alter offset 
12209				if($('#header-outer.detached').length == 0) 
12210					$scrollTopDistance = $scrollTopDistance + $headerNavSpace;
12211			}
12212
12213			var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0;
12214
12215			$('body,html').stop().animate({
12216				scrollTop: $scrollTopDistance - $pageSubMenu
12217			},800,'easeInOutCubic');
12218
12219		},$timeoutVar);
12220	}
12221}
12222
12223if($('body[data-animated-anchors="true"]').length > 0) { 
12224
12225
12226+ function(t) {
12227    "use strict";
12228
12229    function s(e, i) {
12230        var r = t.proxy(this.process, this);
12231        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()
12232    }
12233
12234    function e(e) {
12235        return this.each(function() {
12236            var i = t(this),
12237                r = i.data("bs.scrollspy"),
12238                o = "object" == typeof e && e;
12239            r || i.data("bs.scrollspy", r = new s(this, o)), "string" == typeof e && r[e]()
12240        })
12241    }
12242    s.VERSION = "3.2.0", s.DEFAULTS = {
12243        offset: 10
12244    }, s.prototype.getScrollHeight = function() {
12245        return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
12246    }, s.prototype.refresh = function() {
12247        var s = "offset",
12248            e = 0;
12249        t.isWindow(this.$scrollElement[0]) || (s = "position", e = this.$scrollElement.scrollTop()), this.offsets = [], this.targets = [], this.scrollHeight = this.get
12249ScrollHeight();
12250        var i = this;
12251        this.$body.find(this.selector).map(function() {
12252            var i = t(this),
12253                r = i.data("target") || i.attr("href"),
12254                o = /^#./.test(r) && t(r);
12255            return o && o.length && o.is(":visible") && [
12256                [o[s]().top + e, r]
12257            ] || null
12258        }).sort(function(t, s) {
12259            return t[0] - s[0]
12260        }).each(function() {
12261            i.offsets.push(this[0]), i.targets.push(this[1])
12262        })
12263    }, s.prototype.process = function() {
12264    	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;
12265
12266        var t, s = this.$scrollElement.scrollTop() + this.options.offset + $pageSubMenu,
12267            e = this.getScrollHeight(),
12268            i = this.options.offset + e - this.$scrollElement.height() -$pageSubMenu,
12269            r = this.offsets,
12270            o = this.targets,
12271            l = this.activeTarget;
12272        if (this.scrollHeight != e && this.refresh(), s >= i) return l != (t = o[o.length - 1]) && this.activate(t);
12273        if (l && s <= r[0]) return l != (t = o[0]) && this.activate(t);
12274        for (t = r.length; t--;) l != o[t] && s >= r[t] && (!r[t + 1] || s <= r[t + 1]) && this.activate(o[t])
12275    }, s.prototype.activate = function(s) {
12276        this.activeTarget = s, t(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover');
12277        var e = this.selector + '[data-target="' + s + '"],' + this.selector + '[href="' + s + '"]',
12278            i = t(e).parents("li").addClass("current-menu-item");
12279        i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("current-menu-item")), i.trigger("activate.bs.scrollspy")
12280    };
12281    var i = t.fn.scrollspy;
12282    t.fn.scrollspy = e, t.fn.scrollspy.Constructor = s, t.fn.scrollspy.noConflict = function() {
12283        return t.fn.scrollspy = i, this
12284    }
12285}(jQuery);
12286
12287
12288var shrinkNum = 6;	
12289if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
12290headerPadding2 = headerPadding - headerPadding/1.8;
12291
12292setTimeout(scrollSpyInit,200);
12293
12294var $animatedScrollingTimeout;
12295
12296$('body').on('click','#header-outer nav .sf-menu a, #footer-outer .nectar-button, .container-wrap a:not(.wpb_tabs_nav a):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){
12297
12298	var $hash = $(this).prop("hash");	
12299
12300	$('body').addClass('animated-scrolling');
12301	clearTimeout($animatedScrollingTimeout);
12302	$animatedScrollingTimeout = setTimeout(function(){ $('body').removeClass('animated-scrolling'); },850);
12303	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').outerHeight();
12304	if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; }
12305
12306	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') {
12307
12308		//stop scrolling for certain elements
12309		//if($(this).parents('.tabbed').length > 0) return false;
12310		
12311		//update hash
12312		if(history.pushState) {
12313		    history.pushState(null, null, $hash);
12314		}
12315		else {
12316		    location.hash = $hash;
12317		}
12318
12319		if($(this).parents('ul').length > 0) { 
12320			$(this).parents('ul').find('li').removeClass('current-menu-item');
12321			//$(this).parents('li').addClass('current-menu-item');
12322		}
12323
12324		//side widget area click
12325		if($(this).parents('#slide-out-widget-area').length > 0){
12326			$('#slide-out-widget-area .slide_out_area_close').trigger('click');
12327		}
12328
12329		//mobile menu click
12330		if($(this).parents('#mobile-menu').length > 0) $('#toggle-nav').trigger('click');
12331		var $mobileMenuHeight = ($(this).parents('#mobile-menu').length > 0) ? $(this).parents('#mobile-menu').height() : null;
12332		
12333		$timeoutVar = 1;
12334		if($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
12335			boxRoll(null,-1);
12336			$timeoutVar = 2050;
12337		} 
12338
12339		var $that = $(this);
12340
12341		setTimeout(function(){
12342
12343			//scrolling
12344			var $headerSpace = ($('body[data-permanent-transparent="1"]').length > 0) ? 0 : parseInt($headerNavSpace);
12345
12346			if( $('body[data-permanent-transparent="1"]').length == 0 ) {
12347				
12348				if(!$('body').hasClass('mobile')){
12349					$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
12350					if($('#header-outer[data-remove-fixed="1"]').length > 0) { 
12351						$headerNavSpace = 0;
12352					}
12353					var $scrollTopDistance =  $($hash).offset().top - $mobileMenuHeight - parseInt($headerNavSpace) +$resize + 3 - adminBarHeight;
12354				} else {
12355					var $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $headerNavSpace + adminBarHeight : $($hash).offset().top - $mobileMenuHeight - adminBarHeight + 1;	
12356				}
12357
12358			} else {
12359				var $scrollTopDistance = $($hash).offset().top - adminBarHeight + 1;
12360			}
12361
12362			if($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
12363				//alter offset 
12364				if($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) 
12365					$scrollTopDistance = $scrollTopDistance + $headerNavSpace;
12366
12367				//hide top header
12368				if($that.parents('.page-submenu[data-sticky="true"]').length > 0) { 
12369					$('#header-outer.detached').addClass('invisible');
12370					$('.page-submenu').addClass('header-not-visible').css('transform','translateY(0px)');
12371				}
12372			} 
12373
12374			var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0;
12375
12376			$('body,html').stop().animate({
12377				scrollTop: $scrollTopDistance - $pageSubMenu
12378			},800,'easeInOutCubic');
12379
12380		},$timeoutVar);
12381		
12382
12383		e.preventDefault();
12384
12385	}
12386
12387	if($hash == '#top') {
12388		//side widget area click
12389		if($(this).parents('#slide-out-widget-area').length > 0){
12390			$('#slide-out-widget-area .slide_out_area_close').trigger('click');
12391		}
12392	}
12393
12394
12395});
12396
12397
12398if($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) $(window).load(pageLoadHash);
12399
12400if($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && $('.nectar-box-roll').length == 0 && $onMobileBrowser ) {
12401	$(window).load(pageLoadHash);
12402}
12403
12404}
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415	//portfolio colors
12416	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 ) {
12417		var portfolioColorCss = '';
12418		$('.portfolio-items .col').each(function(){
12419			$titleColor = $(this).attr('data-title-color');
12420			$subTitleColor = $(this).attr('data-subtitle-color');
12421
12422			 if($titleColor.length > 0 ) { 
12423			 	portfolioColorCss += '.col[data-title-color="'+$titleColor+'"] .vert-center h3, .portfolio-items[data-ps="6"] .col[data-title-color="'+$titleColor+'"] .work-meta h4 { color: '+$titleColor+'; } ';
12424			 	portfolioColorCss += ' .portfolio-items[data-ps="8"] .col[data-title-color="'+$titleColor+'"] .line { background-color: '+$titleColor+'; }';
12425			 	portfolioColorCss += '.portfolio-items[data-ps="8"] .col[data-title-color="'+$titleColor+'"] .next-arrow line { stroke: '+$titleColor+'; } ';
12426			 }
12427			 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+'; } ';
12428	
12429		});
12430
12431
12432		var head = document.head || document.getElementsByTagName('head')[0];
12433		var style = document.createElement('style');
12434
12435			style.type = 'text/css';
12436		if (style.styleSheet){
12437		  style.styleSheet.cssText = portfolioColorCss;
12438		} else {
12439		  style.appendChild(document.createTextNode(portfolioColorCss));
12440		}
12441
12442		head.appendChild(style);
12443	}
12444
12445	//bottom controls 2
12446	$('body').on('mouseleave','.container-wrap[data-nav-pos="after_project_2"] #portfolio-nav ul li',function(){
12447		$(this).addClass('mouse-leaving');
12448	});	
12449
12450	// masonryPortfolio
12451
12452	var $portfolio_containers = [];
12453
12454	$('.portfolio-items:not(.carousel)').each(function(i){
12455		$portfolio_containers[i] = $(this);
12456	});
12457
12458	function masonryPortfolioInit() {
12459
12460		$portfolio_containers = [];
12461		$('.portfolio-items:not(.carousel)').each(function(i){
12462			$portfolio_containers[i] = $(this);
12463		});
12464
12465		//// cache window
12466		var $window = jQuery(window);	
12467		
12468			
12469			$.each($portfolio_containers,function(i){
12470
12471				
12472				//// start up isotope with default settings
12473				$portfolio_containers[i].imagesLoaded(function(){
12474					
12475					//verify smooth scorlling
12476					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') } 
12477					
12478					//transformns enabled logic
12479					var $isoUseTransforms = true;
12480					
12481					//Panr 
12482					if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
12483						
12484						$(".portfolio-items:not(.carousel) .work-item.style-3 img").panr({ scaleDuration: .28 }); 
12485						$(".portfolio-items:not(.carousel) .work-item.style-3-alt img").panr({ scaleDuration: .28, sensitivity: 20, scaleTo: 1.12, panDuration: 1 }); 
12486
12487						$isoUseTransforms = true;
12488						
12489					}
12490
12491					piVertCenter();
12492
12493					//initial call to setup isotope
12494					var $layoutMode = ( $portfolio_containers[i].hasClass('masonry-items')) ? 'packery' : 'fitRows';
12495					var $startingFilter = ($portfolio_containers[i].attr('data-starting-filter') != '' && $portfolio_containers[i].attr('data-starting-filter') != 'default') ? '.' + $portfolio_containers[i].attr('data-starting-filter') : '*';
12496
12497					reLayout();
12498					
12499					$portfolio_containers[i].isotope({
12500					  itemSelector : '.element',
12501					  filter: $startingFilter,
12502					  layoutMode: $layoutMode,
12503					  transitionDuration: '0.6s',
12504					  packery: {
12505						 gutter: 0
12506					  }
12507					}).isotope( 'layout' );
12508					
12509					
12510					if($startingFilter != '*'){
12511						$('.portfolio-filters ul a[data-filter="'+$startingFilter+'"], .portfolio-filters-inline ul a[data-filter="'+$startingFilter+'"]').click();
12512					}
12513
12514					//call the reLayout to get things rollin'
12515					masonryZindex();
12516					setTimeout(function(){masonryZindex(); },800);
12517					$window.resize( reLayout );
12518					$window.smartresize( function(){
12519						setTimeout(masonryZindex,700);
12520					});
12521					
12522					//inside fwc fix
12523					if($portfolio_containers[i].parents('.full-width-content').length > 0) { setTimeout(function(){ fullWidthContentColumns(); },200);  }
12524
12525					//fadeout the loading animation
12526					$('.portfolio-loading').stop(true,true).fadeOut(200);
12527					
12528					//fadeIn items one by one
12529					if($portfolio_containers[i].find('.inner-wrap').attr('data-animation') == 'none') {
12530						$portfolio_containers[i].find('.inner-wrap').removeClass('animated');
12531					} else {
12532
12533						//portfolioLoadIn(); moved to waypoints
12534					}
12535			
12536				});
12537				
12538
12539
12540			});//each
12541			
12542		
12543
12544	}
12545
12546	masonryPortfolioInit();
12547
12548	function portfolioLoadIn() {
12549
12550		$($fullscreenSelector+'.portfolio-items').each(function(){
12551
12552			$portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : '90%';
12553
12554			if($(this).find('.inner-wrap').attr('data-animation') == 'none') return;
12555		
12556			$(this).find('.col').each(function(i){
12557
12558				var $that = $(this);
12559
12560				//loaded visible
12561				if($(this).visible(true) || $(this).parents('#nectar_fullscreen_rows').length > 0) {
12562
12563					var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 90 : 115;
12564					$(this).delay($portfolioAnimationDelay *i).queue(function(next){
12565					    $(this).addClass("animated-in");
12566					    next();
12567					});
12568
12569				} else {
12570
12571					//not already visible
12572					var waypoint = new Waypoint({
12573		 			element: $that,
12574		 			 handler: function(direction) {
12575						
12576						if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
12577						     waypoint.destroy();
12578						     return;
12579						}
12580
12581						var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 100;
12582					
12583						setTimeout(function(){
12584							$that.addClass("animated-in");
12585						},$portfolioAnimationDelay * $that.attr('data-delay-amount'));
12586					
12587						
12588						waypoint.destroy();
12589					},
12590					offset: $portfolioOffsetPos
12591
12592					}); //waypoint
12593				}
12594
12595			}); //each
12596		}); //each
12597					
12598	}
12599
12600
12601	//perspective load in
12602	if($('.portfolio-items .inner-wrap[data-animation="perspective"]').length > 0 || $('.posts-container[data-load-animation="perspective"]').length > 0) {
12603
12604		var lastScrollTop = $(window).scrollTop();
12605
12606		$('.portfolio-items, .posts-container[data-load-animation="perspective"]').css('perspective-origin','50% '+ (lastScrollTop + $(window).height()) + 'px');
12607
12608		requestAnimationFrame(updatePerspectiveOrigin);
12609		
12610		function updatePerspectiveOrigin() {
12611
12612			var scrollTop = $(window).scrollTop();
12613
12614			if (lastScrollTop === scrollTop) {
12615				requestAnimationFrame(updatePerspectiveOrigin);
12616				return;
12617			} else {
12618				lastScrollTop = scrollTop;
12619				$('.portfolio-items,.posts-container[data-load-animation="perspective"]').css('perspective-origin','50% '+ (lastScrollTop + $(window).height()) + 'px');
12620				requestAnimationFrame(updatePerspectiveOrigin);
12621			}
12622		}
12623
12624	}
12625
12626	var mediaQuerySize;
12627	function reLayout() {
12628
12629		clearTimeout(clearIsoAnimation);
12630	    $('.portfolio-items .col').addClass('no-transition');
12631	    clearIsoAnimation = setTimeout(function(){  $('.portfolio-items .col').removeClass('no-transition'); },700); 
12632
12633		var windowSize = $window.width();
12634		var masonryObj;
12635		var masonryObjHolder = [];
12636
12637		//remove double quotes for FF
12638		//if (navigator.userAgent.match('MSIE 8') == null) {
12639		//	mediaQuerySize = mediaQuerySize.replace(/"/g, '');
12640		//}
12641		
12642		//user defined cols
12643		var userDefinedColWidth;
12644
12645		$.each($portfolio_containers,function(i,v){
12646
12647			if( $portfolio_containers[i].attr('data-user-defined-cols') == 'span4') {
12648				userDefinedColWidth = 3
12649			} 
12650			
12651			else if( $portfolio_containers[i].attr('data-user-defined-cols') == 'span3') {
12652				userDefinedColWidth = 4
12653			} 
12654			
12655			var isFullWidth = $portfolio_containers[i].attr('data-col-num') == 'elastic';
12656			
12657			
12658			//chrome 33 approved method for getting column sizing
12659			if(window.innerWidth > 1600){
12660				
12661				if($portfolio_containers[i].hasClass('fullwidth-constrained')) {
12662					if($portfolio_containers[i].is('[data-masonry-type="photography"]')) {
12663						mediaQuerySize = 'three';
12664					} else {
12665						mediaQuerySize = 'four';
12666					}
12667	
12668				} else {
12669					if($portfolio_containers[i].hasClass('constrain-max-cols')) {
12670						mediaQuerySize = 'four';
12671					} else {
12672						mediaQuerySize = 'five';
12673					}
12674				}
12675				
12676			} else if(window.innerWidth <= 1600 && window.innerWidth > 1300){
12677
12678				if($portfolio_containers[i].hasClass('fullwidth-constrained')) {
12679					if($portfolio_containers[i].is('[data-masonry-type="photography"]')) {
12680						mediaQuerySize = 'three';
12681					} else {
12682						mediaQuerySize = 'four';
12683					}
12684				} else {
12685					mediaQuerySize = 'four';
12686				}
12687			} else if(window.innerWidth <= 1300 && window.innerWidth > 990){
12688				
12689				if($portfolio_containers[i].hasClass('constrain-max-cols')) {
12690					mediaQuerySize = 'four';
12691				} else {
12692					mediaQuerySize = 'three';
12693				}
12694				
12695			} else if(window.innerWidth <= 990 && window.innerWidth > 470){
12696				mediaQuerySize = 'two';
12697			} else if(window.innerWidth <= 470){
12698				mediaQuerySize = 'one';
12699			}
12700			
12701			//boxed
12702			if($('#boxed').length > 0) {
12703				if(window.innerWidth > 1300){
12704					mediaQuerySize = 'four';
12705				} else if(window.innerWidth < 1300 && window.innerWidth > 990){
12706					
12707					if($portfolio_containers[i].hasClass('constrain-max-cols')) {
12708						mediaQuerySize = 'four';
12709					} else {
12710						mediaQuerySize = 'three';
12711					}
12712
12713				} else if(window.innerWidth < 990){
12714					mediaQuerySize = 'one';
12715				}
12716				
12717			}
12718			
12719			//change masonry columns depending on screen size
12720			switch (mediaQuerySize) {
12721				case 'five':
12722					(isFullWidth) ? colWidth = 5 : colWidth = userDefinedColWidth;
12723					//change cols for photography
12724					if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]')) colWidth = 6;
12725
12726					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
12727				break;
12728				
12729				case 'four':
12730					(isFullWidth) ? colWidth = 4 : colWidth = userDefinedColWidth;
12731					//change cols for photography
12732					if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]')) colWidth = 5;
12733
12734					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
12735				break;
12736				
12737				case 'three':
12738					(isFullWidth) ? colWidth = 3 : colWidth = userDefinedColWidth;
12739					//change cols for photography
12740					if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]')) colWidth = 4;
12741					
12742					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
12743				break;
12744				
12745				case 'two':
12746					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / 2) };
12747				break;
12748				
12749				case 'one':
12750					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / 1) };
12751				break;
12752			}
12753
12754
12755			 //set widths
12756			 portfolioItemWidths(i,v);
12757			
12758
12759			//sizing for large items
12760			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) {
12761
12762				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;
12763				var multipler = (window.innerWidth > 470) ? 2 : 1;
12764
12765				//reset height for calcs
12766				$itemClassForSizing = 'regular';
12767
12768				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) {
12769					$itemClassForSizing = 'wide';
12770				} 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) {
12771					$itemClassForSizing = 'wide_tall';
12772					multipler = 1;
12773				} 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) {
12774					$itemClassForSizing = 'tall';
12775					multipler = 1;
12776				}
12777
12778			    $portfolio_containers[i].find('.col.elastic-portfolio-item.'+$itemClassForSizing+' img').css('height','auto');
12779
12780				var tallColHeight = $portfolio_containers[i].find('.col.elastic-portfolio-item.'+$itemClassForSizing+':visible img').height();
12781				
12782				 $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');
12783				 $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="tall"] img:not(.custom-thumbnail)').css('height',(tallColHeight*multipler) + ($gutterSize*2));
12784
12785				 if($itemClassForSizing == 'regular' || $itemClassForSizing == 'wide') {
12786				 	$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);
12787				 } else {
12788				 	$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));
12789				 }
12790
12791				 $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 );
12792				 
12793				 if($itemClassForSizing == 'regular' || $itemClassForSizing == 'wide') {
12794					 $portfolio_containers[i].find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',tallColHeight);
12795				} else {
12796				 	 $portfolio_containers[i].find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',(tallColHeight/2) - ($gutterSize*2));
12797				 }
12798
12799			} else {
12800				$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');
12801			}
12802
12803			//non masonry
12804
12805			if($portfolio_containers[i].hasClass('no-masonry') && $portfolio_containers[i].find('.col:first:visible').length > 0 && $portfolio_containers[i].parents('.wpb_gallery').length == 0){
12806			  
12807			   //reset height for calcs
12808		   	   $portfolio_containers[i].find('.col img').css('height','auto');
12809		   	   var tallColHeight = $portfolio_containers[i].find('.col:first:visible img').height();
12810		   	   $portfolio_containers[i].find('.col img:not(.custom-thumbnail)').css('height',tallColHeight);
12811		   	   $portfolio_containers[i].find('.col .parallaxImg').css('height',tallColHeight);
12812			}
12813	
12814
12815
12816			masonryObjHolder[i] = masonryObj;
12817			
12818			if($portfolio_containers[i].isotope()) $portfolio_containers[i].isotope( 'layout' ); 
12819				
12820			
12821
12822		}); //each
12823	
12824	}
12825
12826	function portfolioItemWidths(i,v) {
12827		// passing each index value where function is called first to avoid nested loops
12828		// $.each($portfolio_containers,function(i,v){
12829		 		var isFullWidth = $portfolio_containers[i].attr('data-col-num') == 'elastic';
12830
12831		 		if(isFullWidth) { 
12832
12833				 	var $colSize = 4;
12834				 	var $mult = (mediaQuerySize == 'one') ? 1 : 2;
12835				 	if(mediaQuerySize == 'five') $colSize = 5;
12836				 	if(mediaQuerySize == 'four') $colSize = 4;
12837				 	if(mediaQuerySize == 'three') $colSize = 3;
12838				 	if(mediaQuerySize == 'two') $colSize = 2;
12839				 	if(mediaQuerySize == 'one') $colSize = 1;
12840				 	if($(v).is('[data-ps="6"]') && $colSize == 5) $colSize = 4;
12841
12842				 	//photography
12843				 	if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]') && !$portfolio_containers[i].hasClass('no-masonry')) {
12844				 		if(mediaQuerySize == 'five') $colSize = 6;
12845				 		if(mediaQuerySize == 'four') $colSize = 5;
12846				 		if(mediaQuerySize == 'three') $colSize = 4;
12847				 	}
12848				 	
12849				 	if($(v).width() % $colSize == 0) {
12850					 	$(v).find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',Math.floor($(v).width()/$colSize) +'px');
12851					 	$(v).find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',Math.floor($(v).width()/$colSize*$mult) +'px');
12852					 } else {
12853					 	var $loopEndNum = ($(window).width() > 1000) ? 6 : 3;
12854					 	if($portfolio_containers[i].hasClass('fullwidth-constrained') && $(window).width() > 1000) $loopEndNum = 4;
12855					 	//find closest number to give 0
12856					 	for(var i = 1; i<$loopEndNum; i++) {
12857
12858					 		if(($(v).width() - i) % $colSize == 0) {
12859					 			$(v).find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',($(v).width()- i)/$colSize +'px');
12860					 			$(v).find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',($(v).width()-i)/$colSize*$mult +'px');
12861					 		}
12862
12863					 	}
12864					 }
12865
12866				} // isFullWidth
12867
12868		 	
12869		// });
12870	}
12871
12872	//z-index for masonry
12873	function masonryZindex(){
12874		
12875		//escape if no browser support
12876		if($('body .portfolio-items:not(".carousel") .elastic-portfolio-item').length > 0 && $('body .portfolio-items:not(".carousel") .elastic-portfolio-item').offset().left) {
12877			
12878			var $coords = {};
12879			var $zindexRelation = {};
12880			
12881			$('body .portfolio-items:not(".carousel") .elastic-portfolio-item').each(function(){
12882
12883				var $itemOffset = $(this).offset();
12884				$itemOffset = $itemOffset.left;
12885
12886				$coords[$(this).index()] = $itemOffset;
12887				$(this).css('z-index',Math.abs(Math.floor($(this).offset().left/20)));
12888			});
12889			
12890			var $corrdsArr = $.map($coords, function (value) { return value; });
12891
12892			$corrdsArr = removeDuplicates($corrdsArr);
12893			$corrdsArr.sort(function(a,b){return a-b});
12894
12895			for(var i = 0; i < $corrdsArr.length; i++){
12896				$zindexRelation[$corrdsArr[i]] = i; 
12897			}
12898	
12899			$.each($coords,function(k,v){
12900				
12901				var $zindex;
12902				var $coordCache = v;
12903				$.each($zindexRelation,function(k,v){
12904					if($coordCache == k) {
12905						$zindex = v;
12906					}
12907				});
12908		
12909				$('body .portfolio-items:not(".carousel") .elastic-portfolio-item:eq('+k+')').attr('data-delay-amount',$zindex);
12910			});
12911			
12912		}
12913
12914
12915	}
12916
12917	function blogMasonryZindex(){
12918		
12919		//escape if no browser support
12920		if($('body #post-area .masonry-blog-item').length > 0 && $('body #post-area .masonry-blog-item').offset().left) {
12921		
12922			var $coords = {};
12923			var $zindexRelation = {};
12924			
12925			$('body #post-area .masonry-blog-item').each(function(){
12926
12927				var $itemOffset = $(this).offset();
12928				$itemOffset = $itemOffset.left;
12929
12930				$coords[$(this).index()] = $itemOffset;
12931			});
12932			
12933			var $corrdsArr = $.map($coords, function (value) { return value; });
12934			$corrdsArr = removeDuplicates($corrdsArr);
12935			$corrdsArr.sort(function(a,b){return a-b});
12936	
12937			for(var i = 0; i < $corrdsArr.length; i++){
12938				$zindexRelation[$corrdsArr[i]] = i*1; 
12939			}
12940	
12941			$.each($coords,function(k,v){
12942				
12943				var $zindex;
12944				var $coordCache = v;
12945				$.each($zindexRelation,function(k,v){
12946					if($coordCache == k) {
12947						$zindex = v;
12948					}
12949				});
12950	
12951				$('body #post-area .masonry-blog-item:eq('+k+')').css('z-index',$zindex).attr('data-delay-amount',$zindex);
12952			});
12953			
12954		}
12955		
12956	}
12957	
12958	function matrixToArray(matrix) {
12959	    return matrix.substr(7, matrix.length - 8).split(', ');
12960	}
12961	
12962	function removeDuplicates(inputArray) {
12963        var i;
12964        var len = inputArray.length;
12965        var outputArray = [];
12966        var temp = {};
12967
12968        for (i = 0; i < len; i++) {
12969            temp[inputArray[i]] = 0;
12970        }
12971        for (i in temp) {
12972            outputArray.push(i);
12973        }
12974        return outputArray;
12975    }
12976
12977    //// filter items when filter link is clicked
12978	var clearIsoAnimation = null;
12979	var $che
12979ckForScrollBar = null;
12980
12981
12982	//number portfolios so multiple sortable ones can work easily on same page
12983	$('.portfolio-items:not(".carousel")').each(function(i){
12984		$(this).attr('instance',i);
12985		$(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance',i);
12986	});
12987
12988    function isoClickFilter(){
12989		 var $timeout;		 
12990		 if(window.innerWidth > 690 && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
12991		 	
12992			  
12993			 clearTimeout($timeout);
12994			 $timeout = setTimeout(function(){masonryZindex();  },600);
12995
12996			  
12997		 }
12998		  
12999		  var selector = $(this).attr('data-filter');
13000		  var $instance = $(this).parents('div[class^=portfolio-filters]').attr('instance');
13001
13002		  $.each($portfolio_containers,function(i){
13003		  	if($portfolio_containers[i].attr('instance') == $instance) { 
13004		  		$portfolio_containers[i].isotope({ filter: selector }).attr('data-current-cat',selector);
13005
13006		  		//fade in all incase user hasn't scrolled down yet
13007		  		if($portfolio_containers[i].find('.inner-wrap[data-animation="none"]').length == 0) {
13008			   		$portfolio_containers[i].find('.col').addClass('animated-in');
13009				}
13010		  	}
13011		  });
13012
13013
13014
13015
13016		  //active classes
13017		  $(this).parent().parent().find('li a').removeClass('active');
13018		  $(this).addClass('active');
13019		  
13020		  //update pp
13021		  if($('.portfolio-items a[rel^="prettyPhoto"]').length > 0) {
13022		  	setTimeout(updatePrettyPhotoGallery,170);
13023		  }
13024
13025		  else {
13026		  	setTimeout(updateMagPrettyPhotoGallery,170);
13027		  }
13028
13029		  return false;
13030	}
13031
13032	////filter event
13033	$('body').on('click','.portfolio-filters ul li a, .portfolio-filters-inline ul li a', isoClickFilter);
13034
13035
13036	function updatePrettyPhotoGallery(){
13037		$('.portfolio-items').each(function(){
13038
13039			if($(this).find('a[rel^="prettyPhoto"]').length > 0) {
13040
13041			var $unique_id = Math.floor(Math.random()*10000);
13042			var $currentCat = $(this).attr('data-current-cat');
13043			$(this).find('.col'+$currentCat).find('a[rel^="prettyPhoto"]').attr('rel','prettyPhoto['+$unique_id+'_sorted]');
13044			
13045			} 
13046			
13047		});
13048	}
13049
13050	function updateMagPrettyPhotoGallery(){
13051		$('.portfolio-items').each(function(){
13052			
13053			var $currentCat = $(this).attr('data-current-cat');
13054
13055			$(this).find('.col').each(function(){
13056
13057				$(this).find('a.gallery').removeClass('gallery').removeClass('magnific');
13058				
13059				if($(this).is($currentCat))
13060					$(this).find('.work-info a').addClass('gallery').addClass('magnific');
13061
13062			});
13063		
13064			
13065		});
13066	}
13067
13068
13069
13070    function masonryBlogInit() {
13071
13072		var $posts_container = $('.posts-container')
13073		
13074		if($posts_container.parent().hasClass('masonry')) { 
13075			
13076			$posts_container.find('article').addClass('masonry-blog-item');
13077			$posts_container.find('article').prepend('<span class="bottom-line"></span>');
13078			
13079			//move the meta to the bottom
13080			$posts_container.find('article').each(function(){
13081				
13082				var $metaClone = $(this).find('.post-meta').clone();
13083
13084				$(this).find('.post-meta').remove();
13085
13086				if($('#post-area.meta_overlaid').length > 0){
13087					$(this).find('.post-header h2').after($metaClone);
13088				} else {
13089					$(this).find('.content-inner').after($metaClone);
13090				}
13091				
13092			});
13093		
13094			
13095			if($posts_container.parent().hasClass('masonry') && $posts_container.parent().hasClass('full-width-content')){
13096				$posts_container.parent().wrap('<div class="full-width-content blog-fullwidth-wrap"> </div>').removeClass('full-width-content').css({'margin-left':'0','width':'auto'});
13097				
13098				//page header animation fix
13099				if( $posts_container.parents('.wpb_row').length > 0 ) $posts_container.parents('.wpb_row').css('z-index',100);
13100
13101				if($('.masonry.meta_overlaid').length == 0) {
13102
13103					if($('.masonry.classic_enhanced').length > 0) {
13104						$posts_container.parent().parents('.full-width-content').css({
13105							'padding' : '0px 0.2% 0px 2.4%'
13106						});
13107					} else {
13108						$posts_container.parent().parents('.full-width-content').css({
13109							'padding' : '0px 0.2% 0px 3.2%'
13110						});
13111					}
13112					
13113				} else {
13114					$posts_container.parent().parents('.full-width-content').addClass('meta-overlaid');
13115					$('.container-wrap').addClass('meta_overlaid_blog');
13116				}
13117
13118				fullWidthSections(); 
13119			}
13120			
13121			var $cols = 3;
13122			var $element = $posts_container;
13123			
13124			if($posts_container.find('img').length == 0) $element = $('<img />');
13125		
13126			imagesLoaded($element,function(instance){
13127				
13128				if($('body').hasClass('mobile') || $('#post-area').hasClass('span_9')) {
13129					$cols = 2;
13130				}
13131
13132				//set img as BG if masonry classic enhanced
13133				if($posts_container.parent().hasClass('classic_enhanced')){
13134					$posts_container.find('.large_featured.has-post-thumbnail .post-featured-img, .wide_tall.has-post-thumbnail .post-featured-img').each(function(){
13135						var $src = $(this).find('img').attr('src');
13136						$(this).css('background-image','url('+$src+')');
13137					});
13138
13139					$posts_container.find('.large_featured .nectar-flickity, .wide_tall .nectar-flickity').each(function(){
13140
13141						$(this).find('.cell').each(function(){
13142							var $src = $(this).find('img').attr('src');
13143							$(this).css('background-image','url('+$src+')');
13144						});
13145						
13146					});
13147				}
13148
13149				$cols = blogColumnNumbCalcs();
13150				blogHeightCalcs($posts_container, $cols);
13151
13152				if($('#post-area.meta_overlaid').length > 0) {
13153					$posts_container.isotope({
13154					   itemSelector: 'article',
13155					   transitionDuration: '0s',
13156					   layoutMode: 'packery',
13157					   packery: { 
13158					   	 gutter: 0
13159					   	}
13160					}).isotope( 'layout' );
13161
13162				   
13163				} else {
13164				   if($posts_container.parent().hasClass('classic_enhanced')) {
13165					   	if($('.span_9.masonry').length == 0) {
13166					   		$multiplier = (window.innerWidth >= 1600) ? .015 : .02;
13167					   	} else {
13168					   		$multiplier = .04;
13169					    } 
13170				    }
13171				   else {
13172				   	$multiplier = ($('.span_9.masonry').length == 0) ? .02: .04;
13173				   }	
13174					$posts_container.isotope({
13175					   itemSelector: 'article',
13176					   transitionDuration: '0s',
13177					   layoutMode: 'packery',
13178					   packery: { 
13179					   	 gutter: $('#post-area').width()*$multiplier
13180					   	}
13181					}).isotope( 'layout' );
13182				}
13183
13184				blogLoadIn();
13185				flickityBlogInit();
13186				
13187				$(window).trigger('resize');
13188
13189				blogMasonryZindex();
13190				setTimeout(blogMasonryZindex,700);
13191				$window.smartresize( function(){
13192					setTimeout(blogMasonryZindex,700);
13193				});
13194					
13195			});
13196			
13197			$(window).resize(function(){
13198				
13199
13200			   //size all items in grid 
13201			   //sizing for large items
13202			    $cols = blogColumnNumbCalcs();
13203				blogHeightCalcs($posts_container, $cols);
13204
13205				if($('#post-area.meta_overlaid').length > 0) {
13206				
13207				    $posts_container.isotope({
13208				      layoutMode: 'packery',
13209				      packery: {
13210				      	 gutter: 0
13211				      }
13212				   });
13213				} else {
13214				   
13215				   if($posts_container.parent().hasClass('classic_enhanced')) {
13216				   		if($('.span_9.masonry').length == 0) {
13217					   		$multiplier = (window.innerWidth >= 1600) ? .015 : .02;
13218					   	} else {
13219					   		$multiplier = .04;
13220					    } 
13221				   } else {
13222				   	$multiplier = ($('.span_9.masonry').length == 0) ? .02: .04;
13223				   }	
13224				  
13225				   $posts_container.isotope({
13226				   	layoutMode: 'packery',
13227				      packery: { 
13228				      	gutter: $('#post-area').width()*$multiplier
13229				      }
13230				   });
13231				}
13232
13233			});
13234			
13235			
13236	    } else {
13237	    	blogLoadIn();
13238	    }
13239
13240	}
13241	
13242	masonryBlogInit();
13243
13244	function blogLoadIn(){
13245
13246		$('.posts-container').each(function(){
13247
13248			if($(this).attr('data-load-animation') == 'none') {
13249			
13250				$(this).find('.inner-wrap').removeClass('animated');
13251			} else {
13252
13253
13254
13255				$(this).find('article').each(function(i){
13256
13257					//loaded visible
13258					if($(this).visible(true)) {
13259
13260						$(this).delay(110*i).queue(function(next){
13261						    $(this).addClass("animated-in");
13262						    next();
13263						});
13264
13265
13266					} else {
13267						//not already visible
13268						var $that = $(this);
13269						var waypoint = new Waypoint({
13270
13271				 			element: $that,
13272				 			 handler: function(direction) {
13273								
13274								setTimeout(function(){
13275								    $that.addClass("animated-in");
13276								},80*$that.attr('data-delay-amount'));
13277
13278								waypoint.destroy();
13279							},
13280							offset: '90%'
13281
13282						}); 
13283					}
13284
13285
13286				});
13287
13288
13289
13290				
13291				
13292			}
13293
13294		}); //each
13295	}
13296
13297	function blogHeightCalcs($posts_container, cols) {
13298		if( $posts_container.parent().hasClass('meta_overlaid') && $posts_container.find('article[class*="regular"]').length > 0) {
13299
13300			//widths
13301			$.each($posts_container,function(i,v){
13302			 	var $colSize = 4;
13303			 	var $mult = (cols == 1) ? 1 : 2;
13304
13305			 	//check if higher than IE9 -- bugs out with width calc
13306			 	if($('html.no-csstransitions').length == 0) {
13307			 		$(v).find('article[class*="regular"]').css('width',Math.floor($(v).width()/cols) +'px');
13308			 		$(v).find('article[class*="tall"]').css('width',Math.floor($(v).width()/cols*$mult) +'px');
13309			 	} else {
13310			 		$('#post-area.masonry').css('width','100%');
13311			 	}
13312			 	
13313			 	
13314			 });
13315
13316			   //reset height for calcs
13317			   $posts_container.find('article[class*="regular"] img').css('height','auto');
13318
13319			   var tallColHeight = Math.ceil($posts_container.find('article[class*="regular"]:not(".format-link"):not(".format-quote") img').first().height());
13320			   var multipler = (window.innerWidth > 690) ? 2 : 1 ;
13321			   $posts_container.find('article[class*="tall"] img, .article.wide img, article.regular img').removeClass('auto-height');
13322			   $posts_container.find('article[class*="tall"] img').css('height',(tallColHeight*multipler));
13323			   $posts_container.find('article[class*="regular"] img').css('height',(tallColHeight));
13324			   //quote/links
13325			   $posts_container.find('article.regular.format-link,article.regular.format-quote').each(function(){
13326
13327			   		if(window.innerWidth > 690) {
13328			   			$(this).css({
13329			  	 			'height': tallColHeight
13330			   			});
13331			   		} else {
13332			   			$(this).css({
13333			  	 			'height': 'auto'
13334			   			});			 		
13335			   		}
13336			  	 	
13337			   	});
13338
13339
13340		} else {
13341			$posts_container.find('article[class*="tall"] img, article.regular img').addClass('auto-height');
13342		}
13343
13344
13345		if( $posts_container.parent().hasClass('classic_enhanced') && $posts_container.find('article[class*="regular"]').length > 0) {
13346			if($(window).width() > 690 ) 
13347				classicEnhancedSizing($posts_container.find('article:not(.large_featured):not(.wide_tall)'));
13348			else 
13349				classicEnhancedSizing($posts_container.find('article:not(.wide_tall)'));
13350
13351			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;
13352
13353			if($(window).width() > 690 ) 
13354				$posts_container.find('article.large_featured, article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
13355			else 
13356				$posts_container.find('article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
13357
13358		//for when no regular articles exist	
13359		} else if( $posts_container.parent().hasClass('classic_enhanced') && $posts_container.find('article[class*="regular"]').length == 0) {
13360			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;
13361
13362			if($(window).width() > 690 ) 
13363				$posts_container.find('article.large_featured, article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
13364			else 
13365				$posts_container.find('article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
13366		}
13367
13368		//IE9 fix
13369		if($('html.no-csstransitions').length > 0) 		
13370			$('#post-area.masonry').css('width','100%');
13371			 	
13372			 	
13373	}
13374
13375	function classicEnhancedSizing(elements) {
13376
13377		var tallestCol = 0;
13378		elements.find('.article-content-wrap').css('height','auto');
13379		elements.filter('.has-post-thumbnail').each(function(){
13380			($(this).find('.article-content-wrap').outerHeight(true) > tallestCol) ? tallestCol = $(this).find('.article-content-wrap').outerHeight(true) : tallestCol = tallestCol;
13381		});	
13382		
13383		elements.filter('.has-post-thumbnail').find('.article-content-wrap').css('height',(tallestCol));
13384
13385	}
13386
13387
13388	var blogMediaQuerySize;
13389	function blogColumnNumbCalcs(){
13390		   if($('body').hasClass('mobile') && window.innerWidth < 990 || $('#post-area').hasClass('span_9') && $('#post-area.meta_overlaid').length == 0) {
13391			   $cols = 2;
13392		   } else if( $('#post-area').hasClass('full-width-content') || $('#post-area').parent().hasClass('full-width-content') && $('#boxed').length == 0 || $('#post-area.meta_overlaid').length > 0 ){
13393		   		
13394				var windowSize = $(window).width();
13395
13396				
13397				if(window.innerWidth >= 1600){
13398					blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'four' :'five';
13399				} else if(window.innerWidth < 1600 && window.innerWidth >= 1300){
13400					blogMediaQuerySize = 'four';
13401				} else if(window.innerWidth < 1300 && window.innerWidth >= 990){
13402					blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'four' :'three';
13403				} else if(window.innerWidth < 990 && window.innerWidth >= 470){
13404					blogMediaQuerySize = 'two';
13405				} else if(window.innerWidth < 470){
13406					blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'two' :'one';
13407				}
13408			
13409				
13410				//boxed
13411				if($('#boxed').length > 0) {
13412					if(window.innerWidth > 1300){
13413						blogMediaQuerySize = 'four';
13414					} else if(window.innerWidth < 1300 && window.innerWidth > 990){
13415						blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'four' :'three';
13416					} else if(window.innerWidth < 990){
13417						blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'two' :'one';
13418					}
13419					
13420				}
13421				
13422				
13423				switch (blogMediaQuerySize) {
13424					case 'five':
13425						$cols = 5;
13426					break;
13427					
13428					case 'four':
13429						$cols = 4;
13430					break;
13431					
13432					case 'three':
13433						$cols = 3;
13434					break;
13435					
13436					case 'two':
13437						$cols = 2;
13438					break;
13439					
13440					case 'one':
13441						$cols = 1;
13442					break;
13443				}
13444		   		
13445			
13446		   } else {
13447
13448		   	   $cols = 3;
13449		   }
13450
13451		   return $cols;
13452
13453	}
13454
13455
13456
13457
13458
13459
13460var shrinkNum = 6;
13461		
13462if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
13463
13464headerPadding2 = headerPadding - headerPadding/1.8;
13465
13466$('body').on('click','.section-down-arrow',function(){
13467	
13468	if($(this).parents('.nectar-box-roll').length > 0) return false;
13469
13470	var $currentSection = $(this).parents('#page-header-bg');
13471	var $topDistance = $currentSection.attr('data-height');
13472	var $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0;
13473	var $bodyBorderSize = ($('.body-border-top').length > 0 && $(window).width() > 1000) ? $('.body-border-top').height(): 0;
13474	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0) ? 0 : $('#header-space').height();
13475	if($('body[data-permanent-transparent="1"]').length == 0) {
13476		//regular
13477		if(!$('body').hasClass('mobile')){
13478			if($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
13479				$('body,html').stop().animate({
13480					scrollTop: parseInt($topDistance) + $offset + 2 - $bodyBorderSize*2
13481				},1000,'easeInOutCubic')
13482			} else {
13483				$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
13484				if($('#header-outer[data-remove-fixed="1"]').length > 0) { 
13485					$headerNavSpace = 0;
13486					$offset = 0;
13487				}
13488				$('body,html').stop().animate({
13489					scrollTop: parseInt($topDistance - $headerNavSpace) +$resize + 3 + $offset 
13490				},1000,'easeInOutCubic')
13491
13492			}
13493			
13494		} else {
13495			$scrollPos = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? parseInt($topDistance) - $headerNavSpace + parseInt($currentSection.offset().top) + 2 : parseInt($topDistance) + parseInt($currentSection.offset().top) + 2;
13496			$('body,html').stop().animate({
13497				scrollTop: $scrollPos - $bodyBorderSize*2
13498			},1000,'easeInOutCubic')
13499		}
13500	} else {
13501		//permanent transparent
13502		$('body,html').stop().animate({
13503			scrollTop: parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize*2
13504		},1000,'easeInOutCubic')
13505	}
13506	return false;
13507});
13508
13509
13510
13511
13512
13513
13514
13515/*-------------------------------------------------------------------------*/
13516/*	7.	Cross Browser Fixes
13517/*-------------------------------------------------------------------------*/	
13518	 
13519	 function crossBrowserFixes() {
13520
13521		//Fix current class in menu 
13522		if ($("body").hasClass("single-portfolio") || $('body').hasClass("error404") || $('body').hasClass("search-results")) {   
13523			$("li").removeClass("current_page_parent").removeClass("current-menu-ancestor").removeClass('current_page_ancestor');   
13524		}
13525		
13526		//for users updating to 8 with a custom, old header template file
13527		if($('html.js').length == 0) { $('html').removeClass('no-js').addClass('js'); }
13528
13529		//fix for IE8 nth-child
13530		$('.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');
13531		
13532		//remove br's from code tag
13533		$('code').find('br').remove();	
13534		
13535		//if a clear is the last div, remove the padding
13536		if($('.container.main-content > .row > div:last-child').hasClass('clear')) {
13537			$('.container.main-content > .row > div:last-child').css('padding-bottom','0');
13538		}
13539		
13540		//homepage recent blog for IE8
13541		$('.container-wrap .blog-recent > div:last-child').addClass('col_last');
13542		
13543		//blog ascend bottom padding
13544		if($('.single .blog_next_prev_buttons').length > 0) $('.container-wrap').css('padding-bottom',0);
13545
13546		//contact form
13547		$('.wpcf7-form p:has(input[type=submit])').css('padding-bottom','0px');
13548
13549		$('.full-width-content .wpcf7-submit').on('click',function(){ setTimeout(function(){ fullWidthContentColumns() },1000); setTimeout(function(){ fullWidthContentColumns() },2000); });
13550		
13551		//no caption home slider fix
13552		$('#featured article').each(function(){
13553			if($(this).find('h2').attr('data-has-caption') == '0') {
13554				$(this).parents('.slide').addClass('no-caption');
13555			}
13556		});
13557		
13558		//add class for IE
13559		var ua = window.navigator.userAgent;
13560		var msie = ua.indexOf("Edge/");
13561		if(msie > 0)
13562			$('body').addClass('msie');
13563
13564		//gravity form inside fw content row
13565		$('.gform_body').click(function(){
13566		   setTimeout(function(){ fullWidthContentColumns(); },200);
13567		 });
13568
13569		//chat post format nth child color
13570		$('article.post.format-chat .content-inner dt:odd').css('color','#333');
13571		
13572		//remove margin on last cols inside of full width sections 
13573		$('.full-width-section').each(function(){
13574			$(this).find('> .span_12 > div.col_last').last().css('margin-bottom','0');
13575		});
13576		
13577		//remove p tags from extra content editor when warpping only an img 
13578		$('#portfolio-extra p').each(function(){
13579			if($(this).find('*').length == 1 && $(this).find('img').length == 1) {
13580				$(this).find('img').unwrap();
13581			}
13582		});
13583	
13584
13585		//vc text_separator color
13586		$('.vc_text_separator').each(function(){
13587			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'));
13588		});
13589		
13590		//carousel head button alignment  
13591		$('.carousel-heading').each(function(){
13592			if($(this).find('h2').length > 0) $(this).find('.carousel-prev, .carousel-next').css('top','7px');
13593		});
13594		
13595		//remove carousel heading if not being used
13596		$('.carousel-wrap').each(function(){
13597			if($(this).find('.carousel-heading .container:empty').length > 0) $(this).find('.carousel-heading').remove();
13598		});
13599		
13600		//woocommerce product thuimbnails
13601		$('.woocommerce div.product div.images div.thumbnails a:nth-child(4n+4)').css('margin-right','0px');
13602		
13603		//remove extra galleries when using the nectar gallery slider on projects and posts
13604		$('article.post .gallery-slider .gallery,  article.post .gallery-slider .jetpack-sli
13604deshow, .single-portfolio .gallery-slider .gallery, .single-portfolio .gallery-slider .jetpack-slideshow').remove();
13605		
13606		
13607		$('.woocommerce .span_9 .products.related .products li:nth-child(4), .woocommerce .span_9 .products.upsells .products li:nth-child(4)').remove();
13608		$('.woocommerce .span_9 .products.related .products li:nth-child(3), .woocommerce .span_9 .products.upsells .products li:nth-child(3)').css('margin-right','0');	
13609		
13610		$('.cart-menu a, .widget_shopping_cart a').addClass('no-ajaxy');
13611
13612		//clients no hover if no link
13613		$('div.clients').each(function(){
13614			$(this).find('> div').each(function(){
13615				if($(this).find('a').length == 0) {
13616					$(this).addClass('no-link');
13617				}
13618			});
13619		});
13620
13621		//remove ajaxy from single posts when using disqus
13622		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');
13623
13624		//blog next color bg only 
13625		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();
13626		
13627		if($('#single-below-header').hasClass('fullscreen-header') && $('.blog_next_prev_buttons').length == 0 ) $('#author-bio, .comment-wrap').addClass('lighter-grey');
13628
13629		//shop header parallax margin 
13630		if($('body.woocommerce').find('#page-header-bg').length > 0){
13631			$('.container-wrap').css({'margin-top':'0px','padding-top':'30px'});
13632		}
13633		
13634		//if using wooCommerce sitewide notice
13635		if($('.demo_store').length > 0) $('#header-outer, #header-space').css('margin-top','32px');
13636		
13637		//footer last column class for IE8
13638		$('#footer-widgets .container .row > div:last-child').addClass('col_last');
13639		
13640		//nectar slider external links
13641		$('.swiper-slide.external-button-1 .buttons > div:nth-child(1) a').attr('target','_blank');
13642		$('.swiper-slide.external-button-2 .buttons > div:nth-child(2) a').attr('target','_blank');
13643		
13644		//portfolio external links
13645		$(".portfolio-items a[href*='http://']:not([href*='"+window.location.hostname+"']), .recent_projects_widget a[href*='http://']:not([href*='"+window.location.hostname+"'])").attr("target","_blank"); 
13646		
13647		//remove excess inner content when empty row
13648		$('.container-wrap .row > .wpb_row').each(function(){
13649			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();
13650		});
13651		
13652		//remove boxed style from full width content
13653		$('.full-width-content .col.boxed').removeClass('boxed');
13654		
13655		//remove full width attribute on slider in full width content section
13656		$('.full-width-content .wpb_column .nectar-slider-wrap[data-full-width="true"]').attr('data-full-width','false');	
13657
13658		if( $('.nectar-slider-wrap.first-section').length == 0 && 
13659			$('.full-width-section.first-section > .span_12 > .vc_span12 > .wpb_wrapper > .nectar-slider-wrap').length == 0  && 
13660			$('.parallax_slider_outer.first-section').length == 0 && 
13661			$('.full-width-content.first-section .wpb_wrapper > .nectar-slider-wrap').length == 0  && 
13662			!($('.wpb_row.first-section > .nectar-parallax-scene').length == 1 && $('#header-outer[data-transparent-header="true"]').length == 1) ) { 
13663			$('#header-outer .ns-loading-cover').remove(); 
13664	    }
13665
13666	    //neg marg z-index
13667	    $('.wpb_column.neg-marg').parents('.wpb_row').css('z-index','110');
13668
13669
13670	    //portfolio description remove on hover
13671	    var $tmpTitle = null;
13672	    $('.portfolio-items > .col a[title]').hover(function(){
13673	    	$tmpTitle = $(this).attr('title');
13674	    	$(this).attr('title',' ');
13675	    },function(){
13676	    	$(this).attr('title', $tmpTitle);
13677	    });
13678	    $('.portfolio-items > .col a[title]').click(function(){
13679			$(this).attr('title', $tmpTitle);
13680	    });
13681
13682	};
13683
13684	crossBrowserFixes();
13685
13686
13687
13688	jQuery( document.body ).on( 'updated_cart_totals', function() { 
13689		if($('.plus').length == 0) 
13690			$( '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" />' );
13691	});
13692
13693	// Quantity buttons
13694	if($('.plus').length == 0) {
13695		$( '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" />' );
13696
13697		$( document ).on( 'click', '.plus, .minus', function() {
13698
13699			// Get values
13700			var $qty		= $( this ).closest( '.quantity' ).find( '.qty' ),
13701				currentVal	= parseFloat( $qty.val() ),
13702				max			= parseFloat( $qty.attr( 'max' ) ),
13703				min			= parseFloat( $qty.attr( 'min' ) ),
13704				step		= $qty.attr( 'step' );
13705
13706			// Format values
13707			if ( ! currentVal || currentVal === '' || currentVal === 'NaN' ) currentVal = 0;
13708			if ( max === '' || max === 'NaN' ) max = '';
13709			if ( min === '' || min === 'NaN' ) min = 0;
13710			if ( step === 'any' || step === '' || step === undefined || parseFloat( step ) 
13710=== 'NaN' ) step = 1;
13711
13712			// Change the value
13713			if ( $( this ).is( '.plus' ) ) {
13714
13715				if ( max && ( max == currentVal || currentVal > max ) ) {
13716					$qty.val( max );
13717				} else {
13718					$qty.val( currentVal + parseFloat( step ) );
13719				}
13720
13721			} else {
13722
13723				if ( min && ( min == currentVal || currentVal < min ) ) {
13724					$qty.val( min );
13725				} else if ( currentVal > 0 ) {
13726					$qty.val( currentVal - parseFloat( step ) );
13727				}
13728
13729			}
13730
13731			// Trigger change event
13732			$qty.trigger( 'change' );
13733
13734		});
13735	}
13736
13737	function wooPriceSlider(){
13738
13739
13740		// woocommerce_price_slider_params is required to continue, ensure the object exists
13741		if ( typeof woocommerce_price_slider_params === 'undefined' || !$('body').hasClass('woocommerce') ) {
13742			return false;
13743		}
13744
13745		// Get markup ready for slider
13746		$( 'input#min_price, input#max_price' ).hide();
13747		$( '.price_slider, .price_label' ).show();
13748
13749		// Price slider uses jquery ui
13750		var min_price = $( '.price_slider_amount #min_price' ).data( 'min' ),
13751			max_price = $( '.price_slider_amount #max_price' ).data( 'max' );
13752
13753		current_min_price = parseInt( min_price, 10 );
13754		current_max_price = parseInt( max_price, 10 );
13755
13756		if ( woocommerce_price_slider_params.min_price ) current_min_price = parseInt( woocommerce_price_slider_params.min_price, 10 );
13757		if ( woocommerce_price_slider_params.max_price ) current_max_price = parseInt( woocommerce_price_slider_params.max_price, 10 );
13758
13759		$( 'body' ).bind( 'price_slider_create price_slider_slide', function( event, min, max ) {
13760			if ( woocommerce_price_slider_params.currency_pos === 'left' ) {
13761
13762				$( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + min );
13763				$( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + max );
13764
13765			} else if ( woocommerce_price_slider_params.currency_pos === 'left_space' ) {
13766
13767				$( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + " " + min );
13768				$( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + " " + max );
13769
13770			} else if ( woocommerce_price_slider_params.currency_pos === 'right' ) {
13771
13772				$( '.price_slider_amount span.from' ).html( min + woocommerce_price_slider_params.currency_symbol );
13773				$( '.price_slider_amount span.to' ).html( max + woocommerce_price_slider_params.currency_symbol );
13774
13775			} else if ( woocommerce_price_slider_params.currency_pos === 'right_space' ) {
13776
13777				$( '.price_slider_amount span.from' ).html( min + " " + woocommerce_price_slider_params.currency_symbol );
13778				$( '.price_slider_amount span.to' ).html( max + " " + woocommerce_price_slider_params.currency_symbol );
13779
13780			}
13781
13782			$( 'body' ).trigger( 'price_slider_updated', min, max );
13783		});
13784
13785		$( '.price_slider' ).slider({
13786			range: true,
13787			animate: true,
13788			min: min_price,
13789			max: max_price,
13790			values: [ current_min_price, current_max_price ],
13791			create : function( event, ui ) {
13792
13793				$( '.price_slider_amount #min_price' ).val( current_min_price );
13794				$( '.price_slider_amount #max_price' ).val( current_max_price );
13795
13796				$( 'body' ).trigger( 'price_slider_create', [ current_min_price, current_max_price ] );
13797			},
13798			slide: function( event, ui ) {
13799
13800				$( 'input#min_price' ).val( ui.values[0] );
13801				$( 'input#max_price' ).val( ui.values[1] );
13802
13803				$( 'body' ).trigger( 'price_slider_slide', [ ui.values[0], ui.values[1] ] );
13804			},
13805			change: function( event, ui ) {
13806
13807				$( 'body' ).trigger( 'price_slider_change', [ ui.values[0], ui.values[1] ] );
13808
13809			},
13810		});
13811
13812	}
13813	
13814
13815//vc col mobile fixes
13816function vcMobileColumns() {
13817
13818	$('.wpb_row').each(function(){
13819		if(typeof $(this).find('.span_12').offset() != 'undefined' ) {
13820		
13821			$(this).find('[class*="vc_col-"]').each(function(){
13822
13823				var $firstChildOffset = $(this).parents('.span_12').offset().left;
13824
13825				$(this).removeClass('no-left-margin');
13826				if($(this).offset().left < $firstChildOffset + 27) { 
13827					$(this).addClass('no-left-margin');
13828				} else {
13829					$(this).removeClass('no-left-margin');
13830				}
13831			});
13832		}
13833	});
13834}
13835
13836if($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) vcMobileColumns();
13837
13838
13839/*-------------------------------------------------------------------------*/
13840/*	8.	Form Styling
13841/*-------------------------------------------------------------------------*/	
13842
13843if($('body[data-form-style="minimal"]').length > 0) {
13844
13845
13846	//turn user set place holders into labels for effect
13847	function convertPlaceholders() {
13848		$('form input[placeholder]:not([name="min_price"]):not([name="max_price"]), form textarea[placeholder]').each(function(i){
13849			if($(this).attr('placeholder').length > 1) {
13850				var $placeholder = $(this).attr('placeholder');
13851				var $inputID = ($(this).is('[id]')) ? $(this).attr('id') : 'id-'+i;
13852				//add placeholder as label if label doesn't already exist
13853				
13854				//skip cf7                               //|| $(this).prev('label').length == 1 && $placeholder.length > $(this).prev('label').text().length
13855				if($(this).parents('.wpcf7-form-control-wrap').length == 0) {
13856					if($(this).prev('label').length == 0 || $(this).is('textarea')) {
13857						$('<label for="'+$inputID+'">'+$placeholder+'</label>').insertBefore($(this));
13858					}
13859				} else {
13860					if($(this).parents('.wpcf7-form-control-wrap').find('label').length == 0) {
13861						$('<label for="'+$inputID+'">'+$placeholder+'</label>').insertBefore($(this).parents('.wpcf7-form-control-wrap '));
13862					}
13863				}
13864				$(this).removeAttr('placeholder');
13865			}
13866		});
13867	}
13868	convertPlaceholders();
13869	setTimeout(convertPlaceholders,500);
13870	
13871	//woocommerce placeholder fix
13872	$( '#billing_country, #shipping_country, .country_to_state' ).on('change',function(){
13873		convertPlaceholders();
13874		removeExcessLabels();
13875		var $wooDynamicPlaceholders = setInterval(function(){
13876			convertPlaceholders();
13877			convertToMinimalStyle('form label');
13878			removeExcessLabels();
13879		},30);
13880		setTimeout(function(){ clearInterval($wooDynamicPlaceholders); },600);
13881		
13882	});
13883
13884	function convertToMinimalStyle(selector){
13885
13886		$(selector).each(function(){
13887			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"])').length == 1 || $(this).parent().find('textarea').length == 1) {
13888				
13889				if($(this).parents('.minimal-form-input').length == 0) {
13890
13891					//if there's a direct input next to label
13892					
13893					if($(this).next('input').length == 1) {
13894		
13895						$(this).next('input').andSelf().wrapAll('<div class="minimal-form-input"/>');
13896					} else if($(this).find('.wpcf7-form-control-wrap').length > 0) {
13897						var $cloneInput = $(this).find('.wpcf7-form-control-wrap');
13898						$(this).find('.wpcf7-form-control-wrap').remove();
13899						$cloneInput.insertAfter($(this));
13900						$(this).parent().wrapInner('<div class="minimal-form-input" />');
13901					} else {
13902						//if we need to traverse to parent instead	
13903						$(this).parent().wrapInner('<div class="minimal-form-input" />');
13904					}
13905					$html = $(this).html();
13906					$(this)[0].innerHTML = '<span class="text"><span class="text-inner">'+$html+'</span></span>';
13907			
13908					if($(this).parent().find('textarea').length == 1) $(this).parents('.minimal-form-input').addClass('textarea');
13909				}
13910			}
13911
13912		});
13913
13914		//for labels that changed that already have minimal form markup - just need to update content
13915		$(selector).each(function(){
13916			if($(this).parents('.minimal-form-input').length == 1 && $(this).find('.text').length == 0) {
13917				
13918				$html = $(this).html();
13919				$(this)[0].innerHTML = '<span class="text"><span class="text-inner">'+$html+'</span></span>';
13920				
13921			}
13922
13923		});
13924	}
13925	
13926	convertToMinimalStyle('form label');
13927
13928	jQuery( document.body ).on( 'updated_cart_totals', function() { 
13929		convertToMinimalStyle('form label');
13930	});
13931
13932	setTimeout(function(){ convertToMinimalStyle('form label'); removeExcessLabels(); checkValueOnLoad(); },501);
13933
13934	//remove excess labels
13935	function removeExcessLabels() {
13936		$('.minimal-form-input').each(function(){
13937			if($(this).find('label').length > 1) {
13938				$lngth = 0;
13939				$(this).find('label').each(function(){
13940					if($(this).text().length >= $lngth) {
13941						$lngth = $(this).text().length;
13942						$(this).parents('.minimal-form-input').find('label').addClass('tbr');
13943						$(this).removeClass('tbr');
13944					}
13945				});
13946				$(this).find('label.tbr').remove();
13947			}
13948		});
13949	}
13950	removeExcessLabels();
13951	
13952
13953	//add labels to inputs that don't have them
13954	$('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(){
13955		if($(this).parents('.minimal-form-input').length == 0) {
13956
13957			$('<label></label>').insertBefore($(this));
13958			convertToMinimalStyle($(this).prev('label'));
13959		}
13960	});
13961
13962
13963	$('body').on('focus','.minimal-form-input input, .minimal-form-input textarea',function(){
13964		$(this).parents('.minimal-form-input').addClass('filled').removeClass('no-text');
13965	});
13966	$('body').on('blur','.minimal-form-input input, .minimal-form-input textarea',function(){
13967		if($(this).val().length > 0) $(this).parents('.minimal-form-input').addClass('has-text').removeClass('no-text');
13968		else $(this).parents('.minimal-form-input').removeClass('has-text').addClass('no-text');
13969		$(this).parents('.minimal-form-input').removeClass('filled');
13970	});
13971
13972
13973	//on load
13974	function checkValueOnLoad() {
13975		$('.minimal-form-input input, .minimal-form-input textarea').each(function(){
13976			if($(this).val().length > 0) $(this).parents('.minimal-form-input').addClass('has-text').removeClass('no-text');
13977		});
13978	}
13979	checkValueOnLoad();
13980
13981	 // Textarea Auto Resize
13982    var hiddenDiv = $('.hiddendiv').first();
13983    if (!hiddenDiv.length) {
13984      hiddenDiv = $('<div class="textareahiddendiv common"></div>');
13985      $('body').append(hiddenDiv);
13986    }
13987    var text_area_selector = 'textarea';
13988
13989    function textareaAutoResize($textarea) {
13990      // Set font properties of hiddenDiv
13991
13992      var fontFamily = $textarea.css('font-family');
13993      var fontSize = $textarea.css('font-size');
13994
13995      if (fontSize) { hiddenDiv.css('font-size', fontSize); }
13996      if (fontFamily) { hiddenDiv.css('font-family', fontFamily); }
13997
13998      if ($textarea.attr('wrap') === "off") {
13999        hiddenDiv.css('overflow-wrap', "normal")
14000                 .css('white-space', "pre");
14001      }
14002
14003
14004
14005
14006      hiddenDiv.text($textarea.val() + '\n');
14007      var content = hiddenDiv.html().replace(/\n/g, '<br>');
14008      hiddenDiv.html(content);
14009
14010
14011      // When textarea is hidden, width goes crazy.
14012      // Approximate with half of window size
14013
14014      if ($textarea.is(':visible')) {
14015        hiddenDiv.css('width', $textarea.width());
14016      }
14017      else {
14018        hiddenDiv.css('width', $(window).width()/2);
14019      }
14020
14021      $textarea.css('height', hiddenDiv.height());
14022    }
14023
14024    $(text_area_selector).each(function () {
14025      var $textarea = $(this);
14026      if ($textarea.val().length) {
14027        textareaAutoResize($textarea);
14028      }
14029    });
14030
14031    $('body').on('keyup keydown autoresize', text_area_selector, function () {
14032      textareaAutoResize($(this));
14033    });
14034
14035}
14036
14037
14038if($('body[data-fancy-form-rcs="1"]').length > 0) {
14039
14040	 //radio / checkbox markup conversion 
14041
14042    ////default
14043    $('input[type="checkbox"]').each(function(){
14044    	//check if for relationship exists
14045    	$id = $(this).attr('id');
14046    	if(typeof $id !== typeof undefined && $id !== false && $('label[for="'+$id+'"]').length > 0) {
14047    		$('label[for="'+$id+'"]').prepend('<span></span>');
14048    	} else {
14049    		if($(this).parents('.wpcf7-checkbox').length == 0) {
14050	    		$(this).addClass('non-minimal');
14051	    	}
14052    	}
14053
14054    });	
14055
14056    ////for cf7
14057    $('.wpcf7-radio .wpcf7-list-item-label').each(function(i){
14058    	var $data = $(this).html();
14059    	var $name = $(this).parent().find('input').attr('name') + i;
14060    	$(this).parent().find('input').attr('id',$name);
14061    	$(this).replaceWith('<label for="'+$name+'">'+$data+'</label>');
14062    });
14063
14064     $('.wpcf7-checkbox .wpcf7-list-item-label').each(function(){
14065    	var $data = $(this).html();
14066    	var $name = $(this).parent().find('input').attr('value');
14067    	$(this).parent().find('input').attr('id',$name);
14068    	$(this).replaceWith('<label for="'+$name+'"><span></span>'+$data+'</label>');
14069    });
14070		
14071		////woocommerce checkout
14072		if($('.woocommerce-checkout #ship-to-different-address .woocommerce-form__label input[type="checkbox"]').length > 0){
14073			
14074			var $shipToDifLabel = $('.woocommerce-checkout #ship-to-different-address .woocommerce-form__label');
14075			var $shipToDifInputClone = $shipToDifLabel.find('input[type="checkbox"]').removeClass('non-minimal').clone();
14076			var $shipToDifId = ($shipToDifLabel.find('input[type="checkbox"][id]').length > 0) ? $shipToDifInputClone.attr('id') : '';
14077			
14078			$shipToDifLabel.find('span').contents().unwrap();
14079			$shipToDifLabel.prepend('<span></span>');
14080			$shipToDifLabel.attr('for',$shipToDifId);
14081			$shipToDifLabel.find('input[type="checkbox"]').remove();
14082			$shipToDifInputClone.insertBefore($shipToDifLabel);
14083			
14084		}
14085
14086
14087    //select
14088    $('select:not(.comment-form-rating #rating)').each(function(){
14089
14090    	//cf7
14091    	if($(this).parents('.wpcf7-form-control-wrap').length > 0) {
14092
14093    		//select 2 already initialized
14094	    	if($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) {
14095	    		$selector = $($(this).prev('.select2-container'));
14096	    	} else {
14097	    		$selector = $(this);
14098	    	}
14099
14100	    	//if label is found
14101	    	if($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) {
14102	    		$selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />');
14103	    	} else {
14104	    		//default wrap
14105	    		$selector.wrap('<div class="fancy-select-wrap" />');
14106	    	}
14107    	} 
14108    	//default
14109    	else {
14110
14111	    	//select 2 already initialized
14112	    	if($(this).prev('.select2-container').length > 0) {
14113	    		$selector = $(this).prev('.select2-container');
14114	    	} else {
14115	    		$selector = $(this);
14116	    	}
14117
14118	    	//if label is found
14119	    	if($selector.prev('label').length == 1) {
14120	    		$selector.prev('label').andSelf().wrapAll('<div class="fancy-select-wrap" />');
14121	    	} else if($selector.next('label').length == 1) {
14122	    		$selector.next('label').andSelf().wrapAll('<div class="fancy-select-wrap" />');
14123	    	} else {
14124	    		//default wrap
14125	    		$selector.wrap('<div class="fancy-select-wrap" />');
14126	    	}
14127    	}
14128    });
14129	
14130	function select2Init(){
14131		$('select:not(.state_select):not(.country_select):not(.comment-form-rating #rating)' ).each( function() {
14132
14133			if($(this).parents('.woocommerce-ordering').length == 0) {
14134				$( this ).select2({
14135					minimumResultsForSearch: 7,
14136				});
14137			} else {
14138				$( this ).select2({
14139					minimumResultsForSearch: 7,
14140					dropdownCssClass : 'bigdrop',
14141					dropdownAutoWidth: true
14142				});
14143			}
14144
14145		});
14146	}
14147   
14148	select2Init();
14149
14150}
14151	
14152	
14153
14154	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 ) {
14155
14156		$('#ajax-content-wrap').ajaxify({
14157			'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(.product_list_widget a):not(.pp):not([rel^="prettyPhoto"]):not(.pretty_photo), #header-outer li:not(.no-ajaxy) > a:not(.no-ajaxy), #header-outer #logo',
14158			'verbosity': 0, 
14159			requestDelay: 400,
14160			previewoff : true,
14161			memoryoff: true,
14162			turbo : false
14163		});
14164
14165		$(window).on("pronto.render", initPage)
14166		.on("pronto.load", destroyPage)
14167		.on("pronto.request", transitionPage);
14168
14169		if($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect="horizontal_swipe"]').length > 0) setTimeout(function() { waypoints(); }, 750);
14170		else if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },300);
14171
14172		if($('#ajax-loading-screen[data-effect="horizontal_swipe"]').length > 0) {
14173			setTimeout(function(){ 
14174				$('#ajax-loading-screen').addClass('loaded');
14175			},30);
14176		}
14177
14178		initPage();
14179
14180	} else if($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="standard"]').length > 0 ) {
14181		
14182		//chrome white BG flash fix
14183		$('html').addClass('page-trans-loaded');
14184
14185		//fadeout loading animation
14186		if($('#ajax-loading-screen[data-effect="standard"]').length > 0) {
14187
14188			if($('.nectar-particles').length == 0) {
14189				setTimeout(function(){ 
14190					$('#ajax-loading-screen').transition({'opacity':0},500,function(){ 
14191						$(this).css({'display':'none'}); 
14192					}); 
14193					$('#ajax-loading-screen .loading-icon').transition({'opacity':0},500) 
14194				},30);
14195			}
14196
14197			//bind waypoints after loading screen has left
14198			if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },750);
14199
14200			//safari back/prev fix
14201			if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
14202				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) };
14203				window.onpageshow = function(event) {
14204		    		if (event.persisted) { 
14205		    			$('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ 
14206		    				$(this).css({'display':'none'}); 
14207		    			}); 
14208		    			$('#ajax-loading-screen .loading-icon').transition({'opacity':0},600);
14209		    		}
14210		    	}
14211			} else if(navigator.userAgent.indexOf('Firefox') != -1) {
14212				window.onunload = function(){};
14213			}
14214
14215	    		
14216	    	
14217			
14218		} else {
14219
14220			//for swipe trans add loaded immediately
14221			if($('#ajax-loading-screen[data-effect="horizontal_swipe"]').length > 0) {
14222				setTimeout(function(){ 
14223					$('#ajax-loading-screen').addClass('loaded');
14224				},60);
14225			}
14226
14227			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) {
14228				setTimeout(function(){ 
14229					$('#ajax-loading-screen:not(.loaded)').addClass('loaded');
14230					setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
14231				},150);
14232			}
14233
14234			//safari back/prev fix
14235			if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
14236				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) };
14237				window.onpageshow = function(event) {
14238		    		if (event.persisted) { 
14239		    			$('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ 
14240		    				$(this).css({'display':'none'}); 
14241		    			}); 
14242		    			$('#ajax-loading-screen .loading-icon').transition({'opacity':0},600);
14243		    		}
14244		    	}
14245			} else if(navigator.userAgent.indexOf('Firefox') != -1) {
14246				window.onunload = function(){};
14247			}
14248			
14249			//bind waypoints after loading screen has left
14250			if($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect="horizontal_swipe"]').length > 0) { setTimeout(function() { waypoints(); }, 850); }
14251			else if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },350);
14252
14253		}
14254
14255		//remove excess loading images now
14256		$('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();
14257
14258
14259		if($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) {
14260			$('a[href]:not(.no-ajaxy):not([target="_blank"]):not([href^="#"]):not([href^="mailto:"]):not(.comment-edit-link):not(.magnific-popup):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
14260([rel^="prettyPhoto"]):not(.pretty_photo)').click(function(e){
14261				
14262				//need to check on click again if link is just [href^="#"] since URLs could have been shortended via JS in scrollSpyInit
14263				if($(this).is('[href^="#"]')) return;
14264
14265				var $windowCurrentLocation = window.location.href.split("#")[0];
14266				var $windowClickedLocation = $(this).attr('href').split("#")[0];
14267
14268				if($(this).parents('#header-outer[data-format="left-header"]').length > 0 && $(this).parent().hasClass('menu-item-has-children')) 
14269					return;
14270
14271				if($(this).parent('.menu-item-has-children').length > 0 && $(this).parents('.off-canvas-menu-container').length > 0 || ($windowClickedLocation == $windowCurrentLocation)) {
14272
14273				} else {
14274					if(!$(this).parent().hasClass('no-ajaxy')) {
14275
14276						var $targetLocation = $(this).attr('href');
14277						var $timeOutDur = 0;
14278						if($targetLocation != '') {
14279
14280							$('#ajax-loading-screen').addClass('set-to-fade');
14281
14282							transitionPageStandard();
14283
14284							setTimeout(function(){
14285								window.location = $targetLocation;
14286							},$timeOutDur)
14287							
14288							return false;
14289						}
14290					}
14291				}
14292
14293			});
14294		} // if disable fade out is not on
14295	} else {	
14296		//bind waypoints regularly
14297		if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },100);
14298	}
14299
14300
14301	function transitionPage(e) {
14302		
14303		if($('#ajax-loading-screen[data-effect="horizontal_swipe"]').length > 0) {
14304
14305			if($(window).scrollTop() > 0) {
14306
14307				//stop nicescroll
14308				if($().niceScroll && $("html").getNiceScroll()){
14309					var nice = $("html").getNiceScroll();
14310					nice.stop();
14311				}
14312				
14313				$('body,html').stop(true,true).animate({
14314					scrollTop:0
14315				},500,'easeOutQuad',function(){ 
14316					
14317					//close widget area
14318					setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
14319					$('#ajax-loading-screen').removeClass('loaded');
14320					$('#ajax-loading-screen').addClass('in-from-right');
14321					setTimeout(function(){
14322						$('#ajax-loading-screen').addClass('loaded');
14323					},30);
14324
14325				});
14326			}
14327			else { 
14328				//close widget area
14329				setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
14330				$('#ajax-loading-screen').removeClass('loaded');
14331				$('#ajax-loading-screen').addClass('in-from-right');
14332				setTimeout(function(){
14333					$('#ajax-loading-screen').addClass('loaded');
14334				},30);
14335			}
14336
14337		} else {
14338			if($(window).scrollTop() > 0) {
14339
14340				//stop nicescroll
14341				if($().niceScroll && $("html").getNiceScroll()){
14342					var nice = $("html").getNiceScroll();
14343					nice.stop();
14344				}
14345				
14346				$('body,html').stop(true,true).animate({
14347					scrollTop:0
14348				},500,'easeOutQuad',function(){ 
14349					$('#ajax-loading-screen').css({'opacity':'1', 'display':'none'});
14350					$('#ajax-loading-screen').stop(true,true).fadeIn(600,function(){
14351						$('#ajax-loading-screen .loading-icon').animate({'opacity':1},400);
14352						//close widget area
14353						setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
14354					});
14355				});
14356
14357			} else {
14358				$('#ajax-loading-screen').css('opacity','1').stop().fadeIn(600,function(){
14359					$('#ajax-loading-screen .loading-icon').animate({'opacity':1},400);
14360				});
14361
14362				//close widget area
14363				setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
14364			}
14365		}
14366
14367		
14368	}
14369
14370	function transitionPageStandard(e) {
14371
14372		if($('#ajax-loading-screen[data-effect="horizontal_swipe"]').length > 0) {
14373			$('#ajax-loading-screen').removeClass('loaded');
14374			$('#ajax-loading-screen').addClass('in-from-right');
14375			setTimeout(function(){
14376				$('#ajax-loading-screen').addClass('loaded');
14377			},30);
14378		} else {
14379			if($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0) {
14380				$('#ajax-loading-screen').css('opacity','0').css('display','block').transition({'opacity':'1'},450);
14381			} else {
14382				$('#ajax-loading-screen').show().transition({'opacity':'1'},450);
14383			}
14384		}
14385		
14386		//setTimeout(function(){ $('#ajax-loading-screen .loading-icon').animate({'opacity':1},500); },400);
14387
14388	}
14389
14390	function destroyPage(e) {
14391		$(window).off('scroll.appear');
14392		if($('#nectar_fullscreen_rows').length > 0 && $().fullpage) 
14393			$.fn.fullpage.destroy('all');
14394	}
14395
14396	function initPage(e) {
14397
14398		if(!$('body').hasClass('ajax-loaded')) return false;
14399
14400
14401		//init js
14402		lightBoxInit();
14403		addOrRemoveSF();
14404		
14405		if($('body[data-header-format="left-header"]').length == 0) 
14406			$(".sf-menu").superfish('destroy');
14407		
14408		$('#header-outer').removeClass('dark-slide');
14409		initSF();
14410		SFArrows();
14411		headerInit();
14412		var $effectTimeout = ($('#ajax-loading-screen').length > 0) ? 800 : 0;
14413		pageHeaderTextEffectInit();
14414		if($('#page-header-bg .nectar-video-wrap video').length == 0) setTimeout(pageHeaderTextEffect,$effectTimeout);
14415		coloredButtons();
14416		columnBGColors();
14417		fwCarouselLinkFix();
14418		if($('.carousel').length > 0) {
14419			standardCarouselInit();
14420			clientsCarouselInit();
14421			carouselHeightCalcs();
14422		}
14423		if($('.owl-carousel').length > 0) owlCarouselInit();
14424		if($('.products-carousel').length > 0) productCarouselInit();
14425		if($('#nectar_fullscreen_rows').length > 0 && $().fullpage) {
14426			setFPNames();
14427			initFullPageFooter();
14428			fullscreenRowLogic();
14429			initNectarFP();
14430		}
14431		flexsliderInit();
14432		accordionInit();
14433		tabbedInit();
14434		tabbbedDeepLinking();
14435		accordionDeepLinking();
14436		ulChecks();
14437		oneFourthClasses();
14438		carouselfGrabbingClass();
14439		cascadingImageBGSizing();
14440		fullWidthSections();
14441		fwsClasses();
14442		fullwidthImgOnlySizingInit();
14443		fullwidthImgOnlySizing();
14444		fullWidthRowPaddingAdjustInit();
14445		fullWidthRowPaddingAdjustCalc();
14446		boxRollInit();
14447		rowColorOverlay();
14448		setTimeout(function(){ 
14449		   waypoints();
14450		   flickityInit();
14451		},100); 
14452		if($('body[data-animated-anchors="true"]').length > 0) setTimeout(scrollSpyInit,200);
14453		socialSharingInit();
14454		hotSpotHoverBind();
14455		pricingTableHeight();
14456		createTestimonialControls();
14457		imageWithHotspotClickEvents();
14458		testimonialSliderHeight(); 
14459		largeIconHover();
14460		fullscreenMenuInit();
14461		boxRollMouseWheelInit();
14462		midnightInit();
14463		responsiveVideoIframesInit();
14464		responsiveVideoIframes();
14465		fullWidthContentColumns();
14466		videoBGInit();
14467		$window.unbind('scroll.parallaxSections').unbind('resize.parallaxSections');
14468		parallaxScrollInit();
14469		masonryBlogInit();
14470		masonryPortfolioInit();
14471		portfolioAccentColor();
14472		portfolioHoverEffects();
14473		portfolioFiltersInit();
14474		style6Img();
14475		isotopeCatSelection();
14476		$(window).unbind('.infscr');
14477		infiniteScrollInit();
14478		toTopBind();
14479		centerLove();
14480		postNextButtonEffect();
14481		pageLoadHash();
14482		slideOutWidgetAreaScrolling();
14483
14484		//cf7
14485		if($().wpcf7InitForm) $('div.wpcf7 > form').wpcf7InitForm();
14486
14487		//woocommerce price slider
14488		wooPriceSlider();
14489
14490		//twitter widget 
14491		if(typeof twttr != 'undefined') { twttr.widgets.load(); }
14492
14493		//Calendarize.it
14494		if(typeof init_rhc === 'function') { init_rhc(); }
14495
14496		//unwrap post and protfolio videos
14497		$('.video-wrap iframe').unwrap();
14498		$('#sidebar iframe[src]').unwrap();
14499
14500		$('video:not(.slider-video)').attr('width','100%');
14501		$('video:not(.slider-video)').attr('height','100%'); 
14502
14503		$('.wp-video-shortcode.mejs-container').each(function(){
14504			$(this).attr('data-aspectRatio', parseInt($(this).css('height')) / parseInt($(this).css('width')));
14505		});
14506
14507		//mediaElement
14508		$('video.wp-media-shortcode-ajax, audio.wp-media-shortcode-ajax').each(function(){ 
14509			if(!$(this).parent().hasClass('mejs-mediaelement') && $().mediaelementplayer) {
14510				$(this).mediaelementplayer();  
14511			}
14512		});
14513
14514		$('.mejs-container').css({'height': '100%', 'width': '100%'});
14515		
14516		$('audio').attr('width','100%');
14517		$('audio').attr('height','100%');
14518
14519		$('audio').css('visibility','visible');
14520
14521		if($('body').hasClass('mobile')){
14522			$('video').css('visibility','hidden');
14523		} else {
14524			$('video').css('visibility','visible');
14525		}
14526
14527		$('.wpb_row:has(".nectar-video-wrap")').each(function(i){
14528			$(this).css('z-index',100 + i);
14529		});
14530
14531		showLateIframes();
14532
14533		mouseParallaxInit();
14534
14535		//chrome self hosted slider bg video correct
14536		 if(navigator.userAgent.indexOf('Chrome') > 0) { 
14537		 	$('.swiper-wrapper .video-wrap').each(function(i){
14538			  	var webmSource = jQuery(this).find('video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
14539	          	var firstVideo = jQuery(this).find('video').get(0);
14540	          	firstVideo.src = webmSource;
14541	          	firstVideo.load();
14542            });
14543	    }
14544
14545
14546		if($('.nectar-video-bg').length > 0) {
14547			setTimeout(function(){
14548			    	resizeVideoToCover();
14549			    	$('.video-color-overlay').each(function(){
14550			    		$(this).css('background-color',$(this).attr('data-color'));
14551			    	});
14552			    	$('.nectar-video-wrap').transition({'opacity':'1'},0);
14553			    	$('.video-color-overlay').transition({'opacity':'0.7'},0);
14554			    	
14555			    },400);
14556		}
14557
14558		
14559		nectarPageHeader();
14560	
14561
14562		//cart dropdown
14563		$('#header-outer div.cart-outer').hoverIntent(function(){
14564			$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).fadeIn(400);
14565			$('#header-outer .cart_list').stop(true,true).fadeIn(400);
14566			clearTimeout(timeout);
14567			$('#header-outer .cart-notification').fadeOut(300);
14568		});
14569
14570
14571		//remove excess loading images now
14572		$('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();
14573
14574		setTimeout(portfolioSidebarFollow,250);
14575		setTimeout(portfolioSidebarFollow,500);
14576		setTimeout(portfolioSidebarFollow,1000);
14577
14578		crossBrowserFixes();
14579
14580
14581		$(window).trigger('resize');
14582
14583		//fix admin bar
14584		$("#wpadminbar").show();	
14585
14586
14587		//close widget area
14588		if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click'); 
14589
14590		if($('#ajax-loading-screen[data-effect="horizontal_swipe"]').length > 0) {
14591			closeSearch();
14592			$('#ajax-loading-screen').removeClass('in-from-right').removeClass('loaded');
14593			setTimeout(function(){ $('#ajax-loading-screen').addClass('loaded'); },30);
14594		} else {
14595			//fade in page
14596			setTimeout(function(){ $('#ajax-loading-screen').stop(true,true).fadeOut(500, function(){ $('#ajax-loading-screen .loading-icon').css({'opacity':0}); }); closeSearch();  },200);
14597			setTimeout(function(){ $('#ajax-loading-screen').stop(true,true).fadeOut(500, function(){ $('#ajax-loading-screen .loading-icon').css({'opacity':0}); }); closeSearch(); },900);
14598		}
14599	} 
14600
14601
14602
14603/*
14604 * jQuery Textarea Characters Counter Plugin v 2.0
14605 * Examples and documentation at: http://roy-jin.appspot.com/jsp/textareaCounter.jsp
14606 * Copyright (c) 2010 Roy Jin
14607 * Version: 2.0 (11-JUN-2010)
14608 * Dual licensed under the MIT and GPL licenses:
14609 * http://www.opensource.org/licenses/mit-license.php
14610 * http://www.gnu.org/licenses/gpl.html
14611 * Requires: jQuery v1.4.2 or later
14612 */
14613(function($){
14614	if(!$.fn.textareaCount) { 
14615		$.fn.textareaCount = function(options, fn) {
14616	        var defaults = {
14617				maxCharacterSize: -1,
14618				originalStyle: 'originalTextareaInfo',
14619				warningStyle: 'warningTextareaInfo',
14620				warningNumber: 20,
14621				displayFormat: '#input characters | #words words'
14622			};
14623
14624			var options = $.extend(defaults, options);
14625
14626			var container = $(this);
14627
14628			$("<div class='charleft'>&nbsp;</div>").insertAfter(container);
14629
14630
14631			//create charleft css
14632			var charLeftCss = {
14633				'width' : container.width()
14634			};
14635
14636			var charLeftInfo = getNextCharLeftInformation(container);
14637			charLeftInfo.addClass(options.originalStyle);
14638			//charLeftInfo.css(charLeftCss);
14639
14640
14641			var numInput = 0;
14642			var maxCharacters = options.maxCharacterSize;
14643			var numLeft = 0;
14644			var numWords = 0;
14645
14646			container.bind('keyup', function(event){limitTextAreaByCharacterCount();})
14647					 .bind('mouseover', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);})
14648					 .bind('paste', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);});
14649
14650	        limitTextAreaByCharacterCount();
14651
14652			function limitTextAreaByCharacterCount(){
14653				charLeftInfo.html(countByCharacters());
14654
14655				//function call back
14656				if(typeof fn != 'undefined'){
14657					fn.call(this, getInfo());
14658				}
14659				return true;
14660			}
14661
14662			function countByCharacters(){
14663				var content = container.val();
14664				var contentLength = content.length;
14665				//Start Cut
14666				if(options.maxCharacterSize > 0){
14667					//If copied content is already more than maxCharacterSize, chop it to maxCharacterSize.
14668					if(contentLength >= options.maxCharacterSize) {
14669						content = content.substring(0, options.maxCharacterSize);
14670					}
14671
14672					var newlineCount = getNewlineCount(content);
14673
14674					// newlineCount new line character. For windows, it occupies 2 characters
14675					var systemmaxCharacterSize = options.maxCharacterSize - newlineCount;
14676					if (!isWin()){
14677						 systemmaxCharacterSize = options.maxCharacterSize
14678					}
14679					if(contentLength > systemmaxCharacterSize){
14680						//avoid scroll bar moving
14681						var originalScrollTopPosition = this.scrollTop;
14682						container.val(content.substring(0, systemmaxCharacterSize));
14683						this.scrollTop = originalScrollTopPosition;
14684					}
14685					charLeftInfo.removeClass(options.warningStyle);
14686					if(systemmaxCharacterSize - contentLength <= options.warningNumber){
14687						charLeftInfo.addClass(options.warningStyle);
14688					}
14689
14690					numInput = container.val().length + newlineCount;
14691					if(!isWin()){
14692						numInput = container.val().length;
14693					}
14694
14695					numWords = countWord(getCleanedWordString(container.val()));
14696
14697					numLeft = maxCharacters - numInput;
14698				} else {
14699					//normal count, no cut
14700					var newlineCount = getNewlineCount(content);
14701					numInput = container.val().length + newlineCount;
14702					if(!isWin()){
14703						numInput = container.val().length;
14704					}
14705					numWords = countWord(getCleanedWordString(container.val()));
14706				}
14707
14708				return formatDisplayInfo();
14709			}
14710
14711			function formatDisplayInfo(){
14712				var format = options.displayFormat;
14713				format = format.replace('#input', numInput);
14714				format = format.replace('#words', numWords);
14715				//When maxCharacters <= 0, #max, #left cannot be substituted.
14716				if(maxCharacters > 0){
14717					format = format.replace('#max', maxCharacters);
14718					format = format.replace('#left', numLeft);
14719				}
14720				return format;
14721			}
14722
14723			function getInfo(){
14724				var info = {
14725					input: numInput,
14726					max: maxCharacters,
14727					left: numLeft,
14728					words: numWords
14729				};
14730				return info;
14731			}
14732
14733			function getNextCharLeftInformation(container){
14734					return container.next('.charleft');
14735			}
14736
14737			function isWin(){
14738				var strOS = navigator.appVersion;
14739				if (strOS.toLowerCase().indexOf('win') != -1){
14740					return true;
14741				}
14742				return false;
14743			}
14744
14745			function getNewlineCount(content){
14746				var newlineCount = 0;
14747				for(var i=0; i<content.length;i++){
14748					if(content.charAt(i) == '\n'){
14749						newlineCount++;
14750					}
14751				}
14752				return newlineCount;
14753			}
14754
14755			function getCleanedWordString(content){
14756				var fullStr = content + " ";
14757				var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
14758				var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
14759				var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
14760				var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
14761				var splitString = cleanedStr.split(" ");
14762				return splitString;
14763			}
14764
14765			function countWord(cleanedWordString){
14766				var word_count = cleanedWordString.length-1;
14767				return word_count;
14768			}
14769		};
14770	}
14771})(jQuery);	
14772	
14773	
14774	
14775	
14776});
14777
14778
14779 }(window.jQuery, window, document));
14780
14781
14782function resizeIframe() {
14783	var element = document.getElementById("pp_full_res").getElementsByTagName("iframe");
14784	var height = element[0].contentWindow.document.body.scrollHeight;
14785    
14786    //iframe height
14787    element[0].style.height = height + 'px';
14788	
14789	//pp height
14790	document.getElementsByClassName("pp_content_container")[0].style.height = height+40+ 'px';
14791	document.getElementsByClassName("pp_content")[0].style.height = height+40+ 'px';
14792	
14793}
14794
14795
14796//don't load if mobile
14797if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) ){
14798
14799	
14800	/*
14801	panr - v0.0.1 by Robert Bue (@robert_bue)
14802	*/
14803	;(function ( $, window, document, undefined ) {
14804	// Create the defaults once
14805				
14806	var pluginName = "panr",
14807		defaults = {
14808		sensitivity: 22,
14809		moveTarget: "parent",
14810		scale: false,
14811		scaleOnHover: false,
14812		scaleTo: 1.1,
14813		scaleDuration: .28,
14814		panY: true,
14815		panX: true,
14816		panDuration: 0.7,
14817		resetPanOnMouseLeave: true,
14818		onEnter: function(){},
14819		onLeave: function(){}
14820	};
14821	// The actual plugin constructor
14822	function Plugin ( element, options ) {
14823		this.element = element;
14824		//console.log(element);
14825		this.settings = $.extend( {}, defaults, options );
14826		this._defaults = defaults;
14827		this._name = pluginName;
14828		this.init();
14829	}
14830	Plugin.prototype = {
14831		init: function () {
14832		if ( Modernizr.touch ) {
14833			return;
14834		}
14835		// call them like so: this.yourOtherFunction(this.element, this.settings).
14836		//console.log(this.settings);
14837		var settings = this.settings,
14838		target = $(this.element),
14839		w = target.width(),
14840		targetWidth = target.width() - settings.sensitivity,
14841		cx = (w-targetWidth)/targetWidth,
14842		x,
14843		y,
14844		panVars,
14845		xPanVars,
14846		yPanVars,
14847		mouseleaveVars;
14848		//console.log(cx);
14849		if ( settings.scale || (!settings.scaleOnHover && settings.scale) ) {
14850			TweenMax.set(target, { scale: settings.scaleTo });
14851		}
14852		// If no target provided we'll use the hovered element
14853		if ( !settings.moveTarget ) {
14854			settings.moveTarget = $(this.element);
14855		}
14856		if ( settings.moveTarget == "parent" ) {
14857			settings.moveTarget = $(this.element).parent();
14858		}
14859		if ( settings.moveTarget == "parent parent" ) {
14860			settings.moveTarget = $(this.element).parent().parent();
14861		}
14862		if ( settings.moveTarget == "parent parent parent" ) {
14863			settings.moveTarget = $(this.element).parent().parent().parent();
14864		}
14865	
14866		settings.moveTarget.on('mousemove', function(e){
14867			x = e.pageX - target.offset().left - target.width()/2; // mouse x coordinate relative to the container
14868			y = e.pageY - target.offset().top - target.height()/2; // mouse x coordinate relative to the container
14869			if ( settings.panX ) {
14870				xPanVars = { x: -cx*x };
14871			}
14872			if ( settings.panY ) {
14873				yPanVars = { y: -cx*y };
14874			}
14875			panVars = $.extend({}, xPanVars, yPanVars);
14876	
14877			// Pan element
14878			TweenMax.to(target, settings.panDuration, panVars);
14879		});
14880		// On mouseover
14881		settings.moveTarget.on('mouseenter', function(e){
14882			// Scale up element
14883			TweenMax.to(target, settings.scaleDuration, { scale: settings.scaleTo });
14884			settings.onEnter(target);
14885		});
14886		if ( !settings.scale || (!settings.scaleOnHover && !settings.scale) ) {
14887			mouseleaveVars = { scale: 1.005, x: 0, y: 0 };
14888		} else {
14889		
14890		if ( settings.resetPanOnMouseLeave ) {
14891			mouseleaveVars = { x: 0, y: 0 };
14892		}
14893		}
14894		settings.moveTarget.on('mouseleave', function(e){
14895		// Reset element
14896		TweenMax.to(target, .35, mouseleaveVars );
14897		settings.onLeave(target);
14898		});
14899		}
14900	};
14901	// A really lightweight plugin wrapper around the constructor,
14902	// preventing against multiple instantiations
14903	$.fn[ pluginName ] = function ( options ) {
14904		return this.each(function() {
14905			if ( !$.data( this, "plugin_" + pluginName ) ) {
14906			$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
14907		}
14908	  });
14909	};
14910	})( jQuery, window, document ); 
14911
14912}
14913
14914
14915
14916/*!
14917 * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+
14918 * http://cherne.net/brian/resources/jquery.hoverIntent.html
14919 */
14920(function(e){e.fn.hoverIntent=function(t,n,r){var i={interval:100,sensitivity:6,timeout:0};if(typeof t==="object"){i=e.extend(i,t)}else if(e.isFunction(n)){i=e.extend(i,{over:t,out:n,selector:r})}else{i=e.extend(i,{over:t,out:t,selector:n})}var s,o,u,a;var f=function(e){s=e.pageX;o=e.pageY};var l=function(t,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);if(Math.abs(u-s)+Math.abs(a-o)<i.sensitivity){e(n).off("mousemove.hoverIntent",f);n.hoverIntent_s=1;return i.over.apply(n,[t])}else{u=s;a=o;n.hoverIntent_t=setTimeout(function(){l(t,n)},i.interval)}};var c=function(e,t){t.hoverIntent_t=clearTimeout(t.hoverIntent_t);t.hoverIntent_s=0;return i.out.apply(t,[e])};var h=function(t){var n=jQuery.extend({},t);var r=this;if(r.hoverIntent_t){r.hoverIntent_t=clearTimeout(r.hoverIntent_t)}if(t.type=="mouseenter"){u=n.pageX;a=n.pageY;e(r).on("mousemove.hoverIntent",f);if(r.hoverIntent_s!=1){r.hoverIntent_t=setTimeout(function(){l(n,r)},i.interval)}}else{e(r).off("mousemove.hoverIntent",f);if(r.hoverIntent_s==1){r.hoverIntent_t=setTimeout(function(){c(n,r)},i.timeout)}}};return this.on({"mouseenter.hoverIntent":h,"mouseleave.hoverIntent":h},i.selector)}})(jQuery)

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.