PageSourceSearch

https://burgessforcongress.org/wp-content/themes/salient/js/init.js?ver=7.5.02

js burgessforcongress.org collected 2026-10-09 17:01:25 UTC 513,280 bytes, 12,693 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;
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/*jQuery Waypoints */
29!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.invokeAll("enable")},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,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);t&&e&&(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],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}}
vendor: 4,521 bytes, line 29
29,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=y+l-f,h=w<s.oldScroll,p=d.triggerPoint>=s.oldScroll,u=h&&p,c=!h&&!p,!g&&u?(d.queueTrigger(s.backward),o[d.group.id]=d.group):!g&&c?(d.queueTrigger(s.forward),o[d.group.id]=d.group):g&&s.oldScroll>=d.triggerPoint&&(d.queueTrigger(s.forward),o[d.group.id]=d.group)}}return n.requestAnimationFrame(function(){for(var t in o)o[t].flushTriggers()}),this},e.findOrCreateByElement=function(t){return e.findByElement(t)||new e(t)},e.refreshAll=function(){for(var t in o)o[t].refresh()},e.findByElement=function(t){return o[t.waypointContextKey]},window.onload=function(){r&&r(),e.refreshAll()},n.requestAnimationFrame=function(e){var i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||t;i.call(window,e)},n.Context=e}(),function(){"use strict";function t(t,e){return t.triggerPoint-e.triggerPoint}function e(t,e){return e.triggerPoint-t.triggerPoint}function i(t){this.name=t.name,this.axis=t.axis,this.id=this.name+"-"+this.axis,this.waypoints=[],this.clearTriggerQueues(),o[this.axis][this.name]=this}var o={vertical:{},horizontal:{}},n=window.Waypoint;i.prototype.add=function(t){this.waypoints.push(t)},i.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],right:[]}},i.prototype.flushTriggers=function(){for(var i in this.triggerQueues){var o=this.triggerQueues[i],n="up"===i||"left"===i;o.sort(n?e:t);for(var r=0,s=o.length;s>r;r+=1){var a=o[r];(a.options.continuous||r===o.length-1)&&a.trigger([i])}}this.clearTriggerQueues()},i.prototype.next=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints),o=i===this.waypoints.length-1;return o?null:this.waypoints[i+1]},i.prototype.previous=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints);return i?this.waypoints[i-1]:null},i.prototype.queueTrigger=function(t,e){this.triggerQueues[e].push(t)},i.prototype.remove=function(t){var e=n.Adapter.inArray(t,this.waypoints);e>-1&&this.waypoints.splice(e,1)},i.prototype.first=function(){return this.waypoints[0]},i.prototype.last=function(){return this.waypoints[this.waypoints.length-1]},i.findOrCreate=function(t){return o[t.axis][t.name]||new i(t)},n.Group=i}(),function(){"use strict";function t(t){this.$element=e(t)}var e=window.jQuery,i=window.Waypoint;e.each(["innerHeight","innerWidth","off","offset","on","outerHeight","outerWidth","scrollLeft","scrollTop"],function(e,i){t.prototype[i]=function(){var t=Array.prototype.slice.call(arguments);return this.$element[i].apply(this.$element,t)}}),e.each(["extend","inArray","isEmptyObject"],function(i,o){t[o]=e[o]}),i.adapters.push({name:"jquery",Adapter:t}),i.Adapter=t}(),function(){"use strict";function t(t){return function(){var i=[],o=arguments[0];return t.isFunction(arguments[0])&&(o=t.extend({},arguments[1]),o.handler=arguments[0]),this.each(function(){var n=t.extend({},o,{element:this});"string"==typeof n.context&&(n.context=t(this).closest(n.context)[0]),i.push(new e(n))}),i}}var e=window.Waypoint;window.jQuery&&(window.jQuery.fn.waypoint=t(window.jQuery)),window.Zepto&&(window.Zepto.fn.waypoint=t(window.Zepto))}();
vendor: 4,433 bytes, lines 30-38
30
31/*
32* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
33*/
34jQuery.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}})
35
36
37/*! Mousewheel by Brandon Aaron (http://brandon.aaron.sh) */
38!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>
38n)&&(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)}})});
39
40(function($, window, document) {
41
42
43
44jQuery(document).ready(function($){
45	
46
47/***************** Pretty Photo ******************/
48	
49	function prettyPhotoInit(){
50		
51		//add galleries to portfolios
52		$('.portfolio-items').each(function(){
53			var $unique_id = Math.floor(Math.random()*10000);
54			$(this).find('.pretty_photo').attr('rel','prettyPhoto['+$unique_id+'_gal]').removeClass('pretty_photo');
55		});
56		
57		$("a[data-rel='prettyPhoto[product-gallery]'], a[data-rel='prettyPhoto']").each(function(){
58			$(this).attr('rel',$(this).attr('data-rel'));
59			$(this).removeAttr('data-rel');
60		});
61		
62		//nectar auto lightbox
63		if($('body').hasClass('nectar-auto-lightbox')){
64			$('.gallery').each(function(){
65				if($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) {
66					var $unique_id = Math.floor(Math.random()*10000);
67					$(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');
68				}
69			});
70			$('.main-content img').each(function(){
71				if($(this).parent().is("[href]") && !$(this).parent().is("[rel*='prettyPhoto']") && $(this).parents('.product-image').length == 0 && $(this).parents('.iosSlider.product-slider').length == 0) {
72					var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/);
73					if(match) $(this).parent().attr('rel','prettyPhoto');
74				} 
75			});
76		}
77		
78		
79		//convert class usage into rel
80		$('a.pp').removeClass('pp').attr('rel','prettyPhoto');
81		
82		 var loading_animation = ($('body[data-loading-animation]').attr('data-loading-animation') != 'none') ? $('body').attr('data-loading-animation') : null ;
83		 var ascend_loader = ($('body').hasClass('ascend')) ? '<span class="default-loading-icon spin"></span>' :'';
84		 var ascend_loader_class = ($('body').hasClass('ascend')) ? 'default_loader ' : '';
85		$("a[rel^='prettyPhoto']").prettyPhoto({
86			theme: 'dark_rounded',
87			allow_resize: true,
88			default_width: 1024,
89			opacity: 0.85, 
90			animation_speed: 'normal',
91			deeplinking: false,
92			default_height: 576,
93			social_tools: '',
94			markup: '<div class="pp_pic_holder"> \
95						   <div class="ppt">&nbsp;</div> \
96							<div class="pp_details"> \
97								<div class="pp_nav"> \
98								    <a href="#" class="pp_arrow_previous"> <i class="icon-salient-left-arrow-thin icon-default-style"></i> </a> \
99									<a href="#" class="pp_arrow_next"> <i class="icon-salient-right-arrow-thin icon-default-style"></i> </a> \
100									<p class="currentTextHolder">0/0</p> \
101								</div> \
102								<a class="pp_close" href="#"><span class="icon-salient-x icon-default-style"></span></a> \
103							</div> \
104							<div class="pp_content_container"> \
105								<div class="pp_left"> \
106								<div class="pp_right"> \
107									<div class="pp_content"> \
108										<div class="pp_fade"> \
109											<div class="pp_hoverContainer"> \
110											</div> \
111											<div id="pp_full_res"></div> \
112											<p class="pp_description"></p> \
113										</div> \
114									</div> \
115								</div> \
116								</div> \
117							</div> \
118						</div> \
119						<div class="pp_loaderIcon ' + ascend_loader_class + loading_animation+'"> '+ascend_loader+' </div> \
120						<div class="pp_overlay"></div>'
121		});
122		
123	}
124
125
126	function magnificInit() {
127		
128		//convert old pp links
129		$('a.pp').removeClass('pp').addClass('magnific-popup');
130		$("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])").removeAttr('rel').addClass('magnific-popup');
131
132
133		//add galleries to portfolios
134		$('.portfolio-items').each(function(){
135			if($(this).find('.pretty_photo').length > 0) {
136				$(this).find('.pretty_photo').removeClass('pretty_photo').addClass('gallery').addClass('magnific');
137			} else if($(this).find('a[rel*="prettyPhoto["]').length > 0){
138				$(this).find('a[rel*="prettyPhoto["]').removeAttr('rel').addClass('gallery').addClass('magnific');
139			}
140
141		});
142		
143		$("a[data-rel='prettyPhoto[product-gallery]']").each(function(){
144			$(this).removeAttr('data-rel').addClass('magnific').addClass('gallery');
145		});
146		
147		//nectar auto lightbox
148		if($('body').hasClass('nectar-auto-lightbox')){
149			$('.gallery').each(function(){
150				if($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) {
151					var $unique_id = Math.floor(Math.random()*10000);
152					$(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');
153				}
154			});
155			$('.main-content img').each(function(){
156				if($(this).parent().is("[href]") && !$(this).parent().is(".magnific-popup") && $(this).parents('.product-image').length == 0 && $(this).parents('.iosSlider.product-slider').length == 0) {
157					var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/);
158					if(match) $(this).parent().addClass('magnific-popup').addClass('image-link');
159				} 
160			});
161		}
162		
163
164		//regular
165		$('a.magnific-popup:not(.gallery):not(.nectar_video_lightbox)').magnificPopup({ 
166			type: 'image', 
167			callbacks: {
168				
169				imageLoadComplete: function()  {	
170					var $that = this;
171					setTimeout( function() { $that.wrap.addClass('mfp-image-loaded'); }, 10);
172				},
173				beforeOpen: function() {
174				    this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
175			    },
176			    open: function() {
177					    	
178					$.magnificPopup.instance.next = function() {
179						var $that = this;
180
181						this.wrap.removeClass('mfp-image-loaded');
182						setTimeout( function() { $.magnificPopup.proto.next.call($that); }, 100);
183					}
184
185					$.magnificPopup.instance.prev = function() {
186						var $that = this;
187
188						this.wrap.removeClass('mfp-image-loaded');
189						setTimeout( function() { $.magnificPopup.proto.prev.call($that); }, 100);
190					}
191					
192				}
193			},
194			fixedContentPos: false,
195		    mainClass: 'mfp-zoom-in', 
196		    removalDelay: 400 
197		});
198
199		//video
200		$('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({ 
201			type: 'iframe', 
202			fixedContentPos: false,
203		    mainClass: 'mfp-zoom-in', 
204		    removalDelay: 400 
205		});
206
207
208		//galleries
209		$('a.magnific.gallery').each(function(){
210
211			var $parentRow = ($(this).parents('.wpb_row').length > 0) ? $(this).parents('.wpb_row') : $(this).parents('.row');
212			if($parentRow.length > 0 && !$parentRow.hasClass('lightbox-row')) {
213
214				$parentRow.magnificPopup({
215					type: 'image',
216					delegate: 'a.magnific',
217					mainClass: 'mfp-zoom-in',
218					fixedContentPos: false,
219					callbacks: {
220
221						elementParse: function(item) {
222			
223							 if($(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('iframe=true') != -1) {
224						         item.type = 'iframe';
225						      } else {
226						         item.type = 'image';
227						      }
228						},
229
230						imageLoadComplete: function()  {	
231							var $that = this;
232							setTimeout( function() { $that.wrap.addClass('mfp-image-loaded'); }, 10);
233						},
234
235						beforeOpen: function() {
236					       this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
237					    },
238
239					    open: function() {
240					    	
241							$.magnificPopup.instance.next = function() {
242								var $that = this;
243
244								this.wrap.removeClass('mfp-image-loaded');
245								setTimeout( function() { $.magnificPopup.proto.next.call($that); }, 100);
246							}
247
248							$.magnificPopup.instance.prev = function() {
249								var $that = this;
250
251								this.wrap.removeClass('mfp-image-loaded');
252								setTimeout( function() { $.magnificPopup.proto.prev.call($that); }, 100);
253							}
254							
255						}
256					},
257					removalDelay: 400, 
258					gallery: {
259			          enabled:true
260			        }
261				});
262
263				$parentRow.addClass('lightbox-row');
264			}
265			
266		});
267
268	}
269
270	function lightBoxInit() {
271		if($('body[data-ls="pretty_photo"]').length > 0) {
272			prettyPhotoInit();
273		} else if($('body[data-ls="magnific"]').length > 0) {
274			magnificInit();
275		}
276	}
277
278	lightBoxInit();
279	//check for late links
280	setTimeout(lightBoxInit,500);
281	
282/*!
283 * jQuery Transit - CSS3 transitions and transformations
284 * (c) 2011-2012 Rico Sta. Cruz <[email protected]>
285 * MIT Licensed.
286 *
287 * http://ricostacruz.com/jquery.transit
288 * http://github.com/rstacruz/jquery.transit
289 */
290(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
290)",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")}
290this.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);
291
292
293
294
295  // ========================= smartresize ===============================
296
297  /*
298   * smartresize: debounced resize event for jQuery
299   *
300   * latest version and complete README available on Github:
301   * https://github.com/louisremi/jquery.smartresize.js
302   *
303   * Copyright 2011 @louis_remi
304   * Licensed under the MIT license.
305   */
306
307  var $event = $.event,
308      dispatchMethod = $.event.handle ? 'handle' : 'dispatch',
309      resizeTimeout;
310
311  $event.special.smartresize = {
312    setup: function() {
313      $(this).bind( "resize", $event.special.smartresize.handler );
314    },
315    teardown: function() {
316      $(this).unbind( "resize", $event.special.smartresize.handler );
317    },
318    handler: function( event, execAsap ) {
319      // Save the context
320      var context = this,
321          args = arguments;
322
323      // set correct event type
324      event.type = "smartresize";
325
326      if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
327      resizeTimeout = setTimeout(function() {
328        $event[ dispatchMethod ].apply( context, args );
329      }, execAsap === "execAsap"? 0 : 100 );
330    }
331  };
332
333  $.fn.smartresize = function( fn ) {
334    return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
335  };
336
337
338
339/***************** Smooth Scrolling ******************/
340
341	function niceScrollInit(){
342		$("html").niceScroll({
343			scrollspeed: 60,
344			mousescrollstep: 40,
345			cursorwidth: 15,
346			cursorborder: 0,
347			cursorcolor: '#303030',
348			cursorborderradius: 6,
349			autohidemode: false,
350			horizrailenabled: false
351		});
352		
353		
354		if($('#boxed').length == 0){
355			$('body, body #header-outer, body #header-secondary-outer, body #search-outer').css('padding-right','16px');
356		} else if($('body[data-ext-responsive="true"]').length == 0 ) {
357			$('body').css('padding-right','16px');
358		}
359		
360		$('html').addClass('no-overflow-y');
361	}
362
363	var $smoothActive = $('body').attr('data-smooth-scrolling'); 
364	var $smoothCache = ( $smoothActive == 1 ) ? true : false;
365	
366	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 {
367		$('body').attr('data-smooth-scrolling','0');
368	}
369	
370	//chrome ss
371	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) {
372		!function(){function e(){var e=!1;e&&c("keydown",r),v.keyboardSupport&&!e&&u("keydown",r)}function t(){if(document.body){var t=document.body,n=document.documentElement,o=window.innerHeight,r=t.scrollHeight;if(S=document.compatMode.indexOf("CSS")>=0?n:t,w=t,e(),x=!0,top!=self)y=!0;else if(r>o&&(t.offsetHeight<=o||n.offsetHeight<=o)){var a=!1,i=function(){a||n.scrollHeight==document.height||(a=!0,setTimeout(function(){n.style.height=document.height+"px",a=!1},500))};if(n.style.height="auto",setTimeout(i,10),S.offsetHeight<=o){var l=document.createElement("div");l.style.clear="both",t.appendChild(l)}}v.fixedBackground||b||(t.style.backgroundAttachment="scroll",n.style.backgroundAttachment="scroll")}}function n(e,t,n,o){if(o||(o=1e3),d(t,n),1!=v.accelerationMax){var r=+new Date,a=r-C;if(a<v.accelerationDelta){var i=(1+30/a)/2;i>1&&(i=Math.min(i,v.accelerationMax),t*=i,n*=i)}C=+new Date}if(M.push({x:t,y:n,lastX:0>t?.99:-.99,lastY:0>n?.99:-.99,start:+new Date}),!T){var l=e===document.body,u=function(){for(var r=+new Date,a=0,i=0,c=0;c<M.length;c++){var s=M[c],d=r-s.start,f=d>=v.animationTime,h=f?1:d/v.animationTime;v.pulseAlgorithm&&(h=p(h));var m=s.x*h-s.lastX>>0,w=s.y*h-s.lastY>>0;a+=m,i+=w,s.lastX+=m,s.lastY+=w,f&&(M.splice(c,1),c--)}l?window.scrollBy(a,i):(a&&(e.scrollLeft+=a),i&&(e.scrollTop+=i)),t||n||(M=[]),M.length?N(u,e,o/v.frameRate+1):T=!1};N(u,e,0),T=!0}}function o(e){x||t();var o=e.target,r=l(o);if(!r||e.defaultPrevented||s(w,"embed")||s(o,"embed")&&/\.pdf/i.test(o.src))return!0;var a=e.wheelDeltaX||0,i=e.wheelDeltaY||0;return a||i||(i=e.wheelDelta||0),!v.touchpadSupport&&f(i)?!0:(Math.abs(a)>1.2&&(a*=v.stepSize/120),Math.abs(i)>1.2&&(i*=v.stepSize/120),n(r,-a,-i),void e.preventDefault())}function r(e){var t=e.target,o=e.ctrlKey||e.altKey||e.metaKey||e.shiftKey&&e.keyCode!==H.spacebar;if(/input|textarea|select|embed/i.test(t.nodeName)||t.isContentEditable||e.defaultPrevented||o)return!0;if(s(t,"button")&&e.keyCode===H.spacebar)return!0;var r,a=0,i=0,u=l(w),c=u.clientHeight;switch(u==document.body&&(c=window.innerHeight),e.keyCode){case H.up:i=-v.arrowScroll;break;case H.down:i=v.arrowScroll;break;case H.spacebar:r=e.shiftKey?1:-1,i=-r*c*.9;break;case H.pageup:i=.9*-c;break;case H.pagedown:i=.9*c;break;case H.home:i=-u.scrollTop;break;case H.end:var d=u.scrollHeight-u.scrollTop-c;i=d>0?d+10:0;break;case H.left:a=-v.arrowScroll;break;case H.right:a=v.arrowScroll;break;default:return!0}n(u,a,i),e.preventDefault()}function a(e){w=e.target}function i(e,t){for(var n=e.length;n--;)E[A(e[n])]=t;return t}function l(e){var t=[],n=S.scrollHeight;do{var o=E[A(e)];if(o)return i(t,o);if(t.push(e),n===e.scrollHeight){if(!y||S.clientHeight+10<n)return i(t,document.body)}else if(e.clientHeight+10<e.scrollHeight&&(overflow=getComputedStyle(e,"").getPropertyValue("overflow-y"),"scroll"===overflow||"auto"===overflow))return i(t,e)}while(e=e.parentNode)}function u(e,t,n){window.addEventListener(e,t,n||!1)}function c(e,t,n){window.removeEventListener(e,t,n||!1)}function s(e,t){return(e.nodeName||"").toLowerCase()===t.toLowerCase()}function d(e,t){e=e>0?1:-1,t=t>0?1:-1,(k.x!==e||k.y!==t)&&(k.x=e,k.y=t,M=[],C=0)}function f(e){if(e){e=Math.abs(e),D.push(e),D.shift(),clearTimeout(z);
372var 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))}();
373	}
374
375
376
377
378
379
380
381/***************** Sliders ******************/
382
383	//gallery
384	function flexsliderInit(){
385		$('.flex-gallery').each(function(){
386			
387			var $that = $(this);
388			
389			imagesLoaded($(this),function(instance){
390			
391				 $that.flexslider({
392			        animation: 'fade',
393			        smoothHeight: false, 
394			        animationSpeed: 500,
395			        useCSS: false, 
396			        touch: true
397			    });
398				
399				////gallery slider add arrows
400				$('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="icon-angle-right"></i>');
401				$('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="icon-angle-left"></i>');
402			
403			});
404			
405		});
406	}
407	flexsliderInit();
408
409
410	function flickityInit() {
411		if($('.nectar-flickity:not(.masonry)').length == 0) return false;
412
413		var $flickitySliders = [];
414
415		$('.nectar-flickity:not(.masonry)').each(function(i){
416
417			if($(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'next_prev_arrows') {
418				var $paginationBool = false;
419				var $nextPrevArrowBool = true;
420			} else {
421				var $paginationBool = true;
422				var $nextPrevArrowBool = false;
423			}
424			var $that = $(this);
425
426			$flickitySliders[i] = $(this).flickity({
427			  contain: true,
428			  draggable: true,
429			  lazyLoad: false,
430			  imagesLoaded: true,
431			  percentPosition: true,
432			  prevNextButtons: $nextPrevArrowBool,
433			  pageDots: $paginationBool,
434			  resize: true,
435			  setGallerySize: true,
436			  wrapAround: true,
437			  accessibility: false,
438			  arrowShape: { 
439				     x0: 20,
440  x1: 70, y1: 30,
441  x2: 70, y2: 25,
442  x3: 70
443				}
444			});
445
446			var $removeHiddenTimeout;
447
448			$flickitySliders[i].on( 'dragStart.flickity', function() {
449			   clearTimeout($removeHiddenTimeout);
450			   $that.find('.flickity-prev-next-button').addClass('hidden');
451			});
452			$flickitySliders[i].on( 'dragEnd.flickity', function() {
453				$removeHiddenTimeout = setTimeout(function(){
454					$that.find('.flickity-prev-next-button').removeClass('hidden');
455				},600);
456			 
457			});
458
459			$('.flickity-prev-next-button').on( 'click', function() {
460			   clearTimeout($removeHiddenTimeout);
461			   $(this).parents('.nectar-flickity').find('.flickity-prev-next-button').addClass('hidden');
462			   $removeHiddenTimeout = setTimeout(function(){
463					$that.find('.flickity-prev-next-button').removeClass('hidden');
464				},600);
465			});
466
467		});
468
469	
470	
471	}
472	setTimeout(flickityInit,100);
473
474	function flickityBlogInit() {
475		if($('.nectar-flickity.masonry.not-initialized').length == 0) return false;
476
477		$('.nectar-flickity.masonry.not-initialized').each(function(){
478
479			//move pos for large_featured
480			if($(this).parents('article').hasClass('large_featured')) 
481				$(this).insertBefore( $(this).parents('article').find('.content-inner') );
482			
483		});
484
485
486		$('.nectar-flickity.masonry.not-initialized').flickity({
487		  contain: true,
488		  draggable: false,
489		  lazyLoad: false,
490		  imagesLoaded: true,
491		  percentPosition: true,
492		  prevNextButtons: true,
493		  pageDots: false,
494		  resize: true,
495		  setGallerySize: true,
496		  wrapAround: true,
497		  accessibility: false
498
499		});
500
501		$('.nectar-flickity.masonry').removeClass('not-initialized');
502
503		//add count
504		$('.nectar-flickity.masonry:not(.not-initialized)').each(function(){
505			if($(this).find('.item-count').length == 0) {
506				$('<div class="item-count"/>').insertBefore($(this).find('.flickity-prev-next-button.next'));
507				$(this).find('.item-count').html('<span class="current">1</span>/<span class="total">
507' + $(this).find('.flickity-slider .cell').length + '</span>');
508
509				$(this).find('.flickity-prev-next-button, .item-count').wrapAll('<div class="control-wrap" />');
510
511				//move pos for wide_tall
512				if($(this).parents('article').hasClass('wide_tall')) 
513					$(this).find('.control-wrap').insertBefore( $(this) );
514			}
515		});
516
517		//update count
518		$('.masonry .flickity-prev-next-button.previous,  .masonry .flickity-prev-next-button.next').click(function(){
519			if($(this).parents('.wide_tall').length > 0) 
520				$(this).parent().find('.item-count .current').html($(this).parents('article').find('.nectar-flickity .cell.is-selected').index()+1);
521			else 
522				$(this).parent().find('.item-count .current').html($(this).parents('.nectar-flickity').find('.cell.is-selected').index()+1);
523		});
524
525		$('body').on('mouseover','.flickity-prev-next-button.next',function(){
526			$(this).parent().find('.flickity-prev-next-button.previous, .item-count').addClass('next-hovered');
527		});
528		$('body').on('mouseleave','.flickity-prev-next-button.next',function(){
529			$(this).parent().find('.flickity-prev-next-button.previous, .item-count').removeClass('next-hovered');
530		});
531	
532	}
533/****************twenty twenty******************/
534	$('.twentytwenty-container').each(function(){
535		var $that = $(this);
536		$(this).imagesLoaded(function(){
537			$that.twentytwenty();
538		});
539	});
540
541/****************full page******************/
542$usingFullScreenRows = false;
543$fullscreenSelector = '';
544
545
546if($('#nectar_fullscreen_rows').length > 0 || $().fullpage) {
547
548	function setFPNavColoring(index,direction) {
549
550		if($('#boxed').length > 0 && overallWidth > 750) return;
551
552		if($('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').find('.span_12.light').length > 0) {
553    		$('#fp-nav').addClass('light-controls');
554
555    		if(direction == 'up')
556    			$('#header-outer.dark-slide').removeClass('dark-slide');
557    		else
558    			setTimeout(function(){ $('#header-outer.dark-slide').removeClass('dark-slide'); },520);
559    	} else {
560    		$('#fp-nav.light-controls').removeClass('light-controls');
561
562    		if(direction == 'up')
563    			$('#header-outer').addClass('dark-slide');
564    		else
565    			setTimeout(function(){ $('#header-outer').addClass('dark-slide'); },520);
566    	}
567	}
568
569	var $anchors = [];
570	var $names = [];
571	
572	function setFPNames() {
573		$anchors = [];
574		$names = [];
575		$('#nectar_fullscreen_rows > .wpb_row').each(function(i){
576			$id = ($(this).is('[data-fullscreen-anchor-id]')) ? $(this).attr('data-fullscreen-anchor-id') : '';
577
578			//anchor checks
579			if($('#nectar_fullscreen_rows[data-anchors="on"]').length > 0) {
580				if($id.indexOf('fws_') == -1) $anchors.push($id);
581				else $anchors.push('section-'+(i+1));
582			}
583
584			//name checks
585			if($(this).find('.full-page-inner-wrap[data-name]').length > 0) 
586				$names.push($(this).find('.full-page-inner-wrap').attr('data-name'));
587			else 
588				$names.push(' ');
589		});
590	}
591	setFPNames();
592
593	function initFullPageFooter() {
594		var $footerPos = $('#nectar_fullscreen_rows').attr('data-footer');
595
596		if($footerPos == 'default') {
597			$('#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" />');
598		}
599		else if($footerPos == 'last_row') {
600			$('#footer-outer').remove();
601			$('#nectar_fullscreen_rows > .wpb_row:last-child').attr('id','footer-outer').addClass('fp-auto-height');
602		} else {
603			$('#footer-outer').remove();
604		}
605		
606	}	
607
608	if($('#nectar_fullscreen_rows').length > 0)
609		initFullPageFooter();
610
611	//fullscreen row logic
612	function fullscreenRowLogic() {
613		$('.full-page-inner-wrap .full-page-inner > .span_12 > .wpb_column').each(function(){
614			if($(this).find('> .vc_column-inner > .wpb_wrapper').find('> .wpb_row').length > 0) {
615
616				//add class for css
617				$(this).find('> .vc_column-inner > .wpb_wrapper').addClass('only_rows');
618
619				//set number of rows for css
620				$rowNum = $(this).find('> .vc_column-inner > .wpb_wrapper').find('> .wpb_row').length;
621				$(this).find('> .vc_column-inner > .wpb_wrapper').attr('data-inner-row-num',$rowNum);
622			} 
623
624			else if($(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').find('> .wpb_row').length > 0) {
625
626				//add class for css
627				$(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').addClass('only_rows');
628
629				//set number of rows for css
630				$rowNum = $(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').find('> .wpb_row').length;
631				$(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').attr('data-inner-row-num',$rowNum);
632			}
633		});
634	}
635
636	fullscreenRowLogic();
637
638	function fullHeightRowOverflow() {
639		//handle rows with full height that are larger than viewport
640		if($(window).width() >= 1000) {
641
642	    	$('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap[data-content-pos="full_height"]').each(function(){
643
644	    		//reset mobile calcs incase user plays with window resize
645	    		$(this).find('> .full-page-inner').css('height','100%');
646
647	    		var maxHeight = overallHeight;
648	    		var columnPaddingTop = 0;
649	    		var columnPaddingBottom = 0;
650
651	    		$(this).find('> .full-page-inner > .span_12 ').css('height','100%');
652
653	    		$(this).find('> .full-page-inner > .span_12 > .wpb_column > .vc_column-inner > .wpb_wrapper').each(function(){
654	    			 columnPaddingTop = parseInt($(this).parents('.wpb_column').css('padding-top'));
655	    			 columnPaddingBottom = parseInt($(this).parents('.wpb_column').css('padding-bottom'));
656
657	    			 maxHeight = maxHeight > $(this).height() + columnPaddingTop + columnPaddingBottom ? maxHeight : $(this).height() + columnPaddingTop + columnPaddingBottom;
658	    		});
659	    	
660	    		if(maxHeight > overallHeight)
661	    			$(this).find('> .full-page-inner > .span_12').height(maxHeight).css('float','none');
662	    		
663	    	});
664
665	    }
666
667	    else {
668	    	//mobile min height set
669	    	$('#nectar_fullscreen_rows > .wpb_row').each(function(){
670	    		$totalColHeight = 0;
671	    		$(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(){
672	    			$totalColHeight += $(this).outerHeight(true);
673	    		});
674
675	    		$(this).find('.fp-scrollable > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').css('height','100%');
676	    		if($totalColHeight > $(this).find('.fp-scrollable > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').height())
677	    			$(this).find('.fp-scrollable  > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').height($totalColHeight);
678	    	});
679	    }
680
681	}
682
683	function fullscreenElementSizing() {
684		//nectar slider
685		$nsSelector = '.nectar-slider-wrap[data-fullscreen="true"][data-full-width="true"], .nectar-slider-wrap[data-fullscreen="true"][data-full-width="boxed-full-width"]';
686		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) {
687			$($nsSelector).find('.swiper-container').attr('data-height',$('#nectar_fullscreen_rows').height()+1);
688	        $(window).trigger('resize.nsSliderContent');
689
690	        $($nsSelector).parents('.full-page-inner').addClass('only-nectar-slider');
691	    }
692	}
693
694
695	//kenburns first slide fix
696	$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').addClass('kenburns');
697	setTimeout(function(){
698		//ken burns first slide fix
699		$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').removeClass('kenburns');
700	},500);
701
702	//remove kenburns from safari
703	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');
704
705	var overallHeight = $(window).height();
706	var overallWidth = $(window).width();
707	var $fpAnimation = $('#nectar_fullscreen_rows').attr('data-animation');
708	var $fpAnimationSpeed;
709	var $svgResizeTimeout;
710
711	switch($('#nectar_fullscreen_rows').attr('data-animation-speed')) {
712		case 'slow':
713			$fpAnimationSpeed = 1150;
714			break;
715		case 'medium':
716			$fpAnimationSpeed = 850;
717			break;
718		case 'fast':
719			$fpAnimationSpeed = 650;
720			break;
721		default:
722			$fpAnimationSpeed = 850;
723	}
724
725	function initNectarFP() {
726
727		$usingFullScreenRows = true;
728		$fullscreenSelector = '.wpb_row.active ';
729
730		$('.container-wrap, .container-wrap .main-content > .row').css({'padding-bottom':'0', 'margin-bottom': '0'});
731		$('#nectar_fullscreen_rows').fullpage({
732			sectionSelector: '#nectar_fullscreen_rows > .wpb_row',
733			navigation: true,
734			css3: true,
735			scrollingSpeed: $fpAnimationSpeed,
736			anchors: $anchors,
737			scrollOverflow: true,
738			navigationPosition: 'right',
739			navigationTooltips: $names,
740			afterLoad: function(anchorLink, index, slideAnchor, slideIndex){ 
741
742				if($('#nectar_fullscreen_rows').hasClass('afterLoaded')) {
743
744					//reset slim scroll to top
745					$('.wpb_row:not(.last-before-footer):not(:nth-child('+index+')) .fp-scrollable').each(function(){
746						$scrollable = $(this).data('iscrollInstance');
747						$scrollable.scrollTo(0,0);
748					});
749
750					//reset carousel
751					$('.wpb_row:not(:nth-child('+index+')) .owl-carousel').trigger('to.owl.carousel',[0]);
752
753					var $row_id = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').attr('id');
754
755					$('#nectar_fullscreen_rows > .wpb_row').removeClass('transition-out').removeClass('trans');
756					
757
758					$('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').removeClass('next-current');
759					$('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+') .full-page-inner-wrap-outer').css({'height': '100%'});
760					$('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap-outer').css({'transform':'none'});
761					//take care of nav/control coloring
762					//setFPNavColoring(index,'na');
763					
764					//handle waypoints
765					if($row_id != 'footer-outer' && $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+').last-before-footer').length == 0) {
766						if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
767							resetWaypoints();
768							waypoints();
769							Waypoint.destroyAll();
770							startMouseParallax();
771							portfolioLoadIn();
772						}
773						responsiveTooltips();
774					}
775
776					if($row_id !='footer-outer') {
777						$('#nectar_fullscreen_rows > .wpb_row').removeClass('last-before-footer').css('transform','initial');
778
779						//reset animation attrs
780						$('#nectar_fullscreen_rows > .wpb_row:not(.active):not(#footer-outer)').css({'transform':'translateY(0)','left':'-9999px', 'transition': 'none', 'opacity':'1', 'will-change':'auto'});
781						$('#nectar_fullscreen_rows > .wpb_row:not(#footer-outer)').find('.full-page-inner-wrap-outer').css({'transition': 'none',  'transform':'none', 'will-change':'auto'});
782						$('#nectar_fullscreen_rows > .wpb_row:not(#footer-outer)').find('.fp-tableCell').css({'transition': 'none', 'transform':'none', 'will-change':'auto'});
783					}
784				} else {
785					fullHeightRowOverflow();
786					overallHeight = $('#nectar_fullscreen_rows').height();
787					$('#nectar_fullscreen_rows').addClass('afterLoaded');
788
789					//for users that have scrolled down prior to turning on full page
790					setTimeout(function(){ window.scrollTo(0,0); },1800);
791
792					//ken burns first slide fix
793					$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').removeClass('kenburns');
794
795					//handle fullscreen elements
796	        		fullscreenElementSizing();
797				}
798
799				
800				$('#nectar_fullscreen_rows').removeClass('nextSectionAllowed');
801
802				
803			 },
804	        onLeave: function(index, nextIndex, direction){ 
805	        	
806	        	var $row_id = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+nextIndex+')').attr('id');
807	        	var $indexRow = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')');
808	        	var $nextIndexRow = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+nextIndex+')');
809	        	var $nextIndexRowInner = $nextIndexRow.find('.full-page-inner-wrap-outer');
810	        	var $nextIndexRowFpTable = $nextIndexRow.find('.fp-tableCell');
811	        	//mobile/safari  fix
812	        	var $transformProp = (!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? 'transform' : 'all'; 
813	        	//if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) $transformProp = 'all';
814
815	        	if( $row_id == 'footer-outer') {
816	        		$indexRow.addClass('last-before-footer'); 
817	        		$('#footer-outer').css('opacity','1');
818	        	} else {
819	        		$('#nectar_fullscreen_rows > .wpb_row.last-before-footer').css('transform','translateY(0px)');
820	        		$('#footer-outer').css('opacity','0');
821	        	}
822	        	if($indexRow.attr('id') == 'footer-outer') {
823	        		$('#footer-outer').css({'transition': $transformProp+' 460ms cubic-bezier(0.60, 0.23, 0.2, 0.93)', 'backface-visibility': 'hidden'});
824	        		$('#footer-outer').css({'transform': 'translateY(45%) translateZ(0)'});
825	        	}
826	 
827
828	        	//animation
829	        	if($nextIndexRow.attr('id') != 'footer-outer' && $indexRow.attr('id') != 'footer-outer' && $('#nectar_fullscreen_rows[data-animation="none"]').length == 0 ) {
830
831	        		//scrolling down
832	        		if(direction == 'down') {
833
834	        			if($fpAnimation == 'parallax') {
835		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'will-change':'transform', 'transform':'translateZ(0)' ,'z-index': '100'});
836		        			setTimeout(function() { 
837		        				$indexRow.css({'transform': 'translateY(-50%) translateZ(0)'});
838		        			}, 60);
839
840		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
841		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
842		        			$nextIndexRowInner.css({'transform':'translateY(-50%) translateZ(0)', 'will-change':'transform'});
843		        			
844	        			} else if($fpAnimation == 'zoom-out-parallax') {
845
846	        				$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'});
847		        			setTimeout(function() { 
848		        				$indexRow.css({'transform': 'scale(0.77) translateZ(0)', 'opacity': '0'});
849		        			}, 60);
850
851		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
852		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
853		        			$nextIndexRowInner.css({'transform':'translateY(-50%) translateZ(0)',  'will-change':'transform'});
854	        			} 
855	        			/*else if($fpAnimation == 'none') {
856
857	        				$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'z-index': '100'});
858	        				$indexRow.css({'will-change':'transform'});
859
860		        			setTimeout(function() { 
861		        				$indexRow.css({'transform': 'translateY(-100%) translateZ(0)'});
862		        			}, 80);
863
864		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
865		        			setTimeout(function() { 
866		        				$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
867		        			}, 30);
868	        			}*/
869	        		}
870
871	        		//scrolling up
872	        		else {
873
874	        			if($fpAnimation == 'parallax') {
875		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'z-index': '100', 'will-change':'transform'});
876		        			setTimeout(function() { 
877		        				$indexRow.css({'transform': 'translateY(50%) translateZ(0)'});
878		        			}, 60);
879
880		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
881		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)','will-change':'transform'});
882		        			$nextIndexRowInner.css({'transform':'translateY(50%) translateZ(0)','will-change':'transform'});
883	        			}
884
885	        			else if($fpAnimation == 'zoom-out-parallax') {
886		        			$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'});
887		        			setTimeout(function() { 
888		        				$indexRow.css({'transform': 'scale(0.77) translateZ(0)', 'opacity': '0'});
889		        			}, 60);
890
891		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
892		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)', 'will-change':'transform'});
893		        			$nextIndexRowInner.css({'transform':'translateY(50%) translateZ(0)', 'will-change':'transform'});
894	        			} 
895	        			/*else if($fpAnimation == 'none') {
896		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'z-index': '100'});
897		        			$indexRow.css({'will-change':'transform'});
898
899		        			setTimeout(function() { 
900		        				$indexRow.css({'transform': 'translateY(100%) translateZ(0)'});
901		        			}, 80);
902
903		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)', 'will-change':'transform'});
904		        			setTimeout(function() { 
905		        				$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
906		        			}, 30);
907	        			}*/
908	        			
909	        			
910	        		}
911	        		
912	        		setTimeout(function() { 
913	    				$nextIndexRowFpTable.css({'transition':$transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1) 0ms', 'transform':'translateY(0%) translateZ(0)'});
914	    				if($fpAnimation != 'none') $nextIndexRowInner.css({'transition':$transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1) 0ms', 'transform':'translateY(0%) translateZ(0)'});
915	    			},60);
916
917	        	}
918
919	        	//adjust transform if larger than row height for parallax
920	        	if($('#nectar_fullscreen_rows[data-animation="none"]').length == 0 && $nextIndexRow.find('.fp-scrollable').length > 0)
921	        		$nextIndexRow.find('.full-page-inner-wrap-outer').css('height',overallHeight);
922
923	        	setTimeout(function() { 
924	        		
925	        		if( $row_id == 'footer-outer') {
926
927		        		$indexRow.css('transform','translateY(-'+($('#footer-outer').height()-1)+'px)');
928
929		        		$('#footer-outer').css({'transform': 'translateY(45%) translateZ(0)'});
930		        		$('#footer-outer').css({'transition-duration': '0s', 'backface-visibility': 'hidden'});
931		        		setTimeout(function() { 
932		        			$('#footer-outer').css({'transition': $transformProp+' 500ms cubic-bezier(0.60, 0.23, 0.2, 0.93)', 'backface-visibility': 'hidden'});
933	        				$('#footer-outer').css({'transform': 'translateY(0%) translateZ(0)'});
934	        			},30);
935		        	}
936	        	},30);
937
938	        	if($row_id!='footer-outer') {
939	        		
940	        		stopMouseParallax();
941
942	        		//take care of nav/control coloring
943	        		setFPNavColoring(nextIndex,direction);
944	        	}
945	        		
946	        },
947
948	        afterResize: function(){
949	        	overallHeight = $('#nectar_fullscreen_rows').height();
950	        	overallWidth = $(window).width();
951	        	fullHeightRowOverflow();
952	        	fullscreenElementSizing();
953	        	fullscreenFooterCalcs();
954
955	        	if( $('#footer-outer.active').length > 0) {
956	        		setTimeout(function(){
957	        			$('.last-before-footer').css('transform','translateY(-'+$('#footer-outer').height()+'px)');
958	        		},200);
959		        } 
960
961		        //fix for svg animations when resizing and iscroll wraps/unwraps
962		        clearTimeout($svgResizeTimeout);
963		        $svgResizeTimeout = setTimeout(function(){ 
964
965		        	if($svg_icons.length > 0) {
966			        	$('.svg-icon-holder.animated-in').each(function(i){
967							$(this).css('opacity','1');
968							$svg_icons[$(this).attr('id').slice(-1)].finish();
969						});
970			        }
971
972		         },300);
973	        }
974
975		});
976	}
977	
978	if($('#nectar_fullscreen_rows').length > 0)
979		initNectarFP();
980
981
982	$(window).smartresize(function(){
983		
984		if($('#nectar_fullscreen_rows').length > 0) {
985			setTimeout(function(){
986				$('.wpb_row:not(.last-before-footer) .fp-scrollable').each(function(){
987					$scrollable = $(this).data('iscrollInstance');
988					$scrollable.refresh();
989				});
990			},200);
991
992			fullHeightRowOverflow();
993
994		}
995	});
996
997	function fullscreenFooterCalcs() {
998		if($('#footer-outer.active').length > 0) {
999	    		$('.last-before-footer').addClass('fp-notransition').css('transform','translateY(-'+$('#footer-outer').height()+'px)');
1000	    		setTimeout(function(){
1001	    			$('.last-before-footer').removeClass('fp-notransition');
1002	    		},10);
1003	    	}
1004	}
1005
1006
1007
1008	function stopMouseParallax(){
1009		$.each($mouseParallaxScenes,function(k,v){
1010			v.parallax('disable');
1011		});
1012	}
1013
1014	function startMouseParallax(){
1015		if($('#nectar_fullscreen_rows > .wpb_row.active .nectar-parallax-scene').length > 0) {
1016			$.each($mouseParallaxScenes,function(k,v){
1017				v.parallax('enable');
1018			});
1019		}
1020	}
1021
1022	if($('#nectar_fullscreen_rows').length > 0) {
1023		if($('#fp-nav.tooltip_alt').length == 0) setFPNavColoring(1,'na');
1024		fullscreenElementSizing();
1025	}
1026
1027	function resetWaypoints() {
1028		//animated columns / imgs
1029		$('img.img-with-animation.animated-in:not([data-animation="none"])').css({'transition':'none'});
1030		$('img.img-with-animation.animated-in:not([data-animation="none"])').css({'opacity':'0','transform':'none'}).removeClass('animated-in');
1031		$('.col.has-animation.animated-in:not([data-animation*="reveal"]), .wpb_column.has-animation.animated-in:not([data-animation*="reveal"])').css({'transition':'none'});
1032		$('.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');	
1033		$('.col.has-animation.boxed:not([data-animation*="reveal"]), .wpb_column.has-animation.boxed:not([data-animation*="reveal"])').addClass('no-pointer-events');
1034
1035		//reveal columns
1036		$('.wpb_column.has-animation[data-animation*="reveal"], .nectar_cascading_images').removeClass('animated-in');
1037		if(overallWidth > 1000 && $('.using-mobile-browser').length == 0) {
1038			$('.wpb_column.has-animation[data-animation="reveal-from-bottom"] > .column-inner-wrap').css({'transition':'none','transform':'translate(0, 100%)'});
1039			$('.wpb_column.has-animation[data-animation="reveal-from-bottom"] > .column-inner-wrap > .column-inner').css({'transition':'none','transform':'translate(0, -90%)'});
1040			$('.wpb_column.has-animation[data-animation="reveal-from-top"] > .column-inner-wrap').css({'transition':'none','transform':'translate(0, -100%)'});
1041			$('.wpb_column.has-animation[data-animation="reveal-from-top"] > .column-inner-wrap > .column-inner').css({'transition':'none','transform':'translate(0, 90%)'});
1042			$('.wpb_column.has-animation[data-animation="reveal-from-left"] > .column-inner-wrap').css({'transition-duration':'0s','transform':'translate(-100%, 0)'});
1043			$('.wpb_column.has-animation[data-animation="reveal-from-left"] > .column-inner-wrap > .column-inner').css({'transition-duration':'0s','transform':'translate(90%, 0)'});
1044			$('.wpb_column.has-animation[data-animation="reveal-from-right"] > .column-inner-wrap').css({'transition-duration':'0s','transform':'translate(100%, 0)'});
1045			$('.wpb_column.has-animation[data-animation="reveal-from-right"] > .column-inner-wrap > .column-inner').css({'transition-duration':'0s','transform':'translate(-90%, 0)'});
1046		}
1047		$('.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');
1048
1049		//milestone
1050		$('.nectar-milestone.animated-in').removeClass('animated-in').removeClass('in-sight');
1051		$('.nectar-milestone .symbol').removeClass('in-sight');
1052
1053		//fancy ul
1054		$('.nectar-fancy-ul[data-animation="true"]').removeClass('animated-in');
1055		$('.nectar-fancy-ul[data-animation="true"] ul li').css({'opacity':'0','left':'-20px'});
1056
1057		//progress bars
1058		$('.nectar-progress-bar').parent().removeClass('completed');
1059		$('.nectar-progress-bar .bar-wrap > span').css({'width':'0px'});
1060		$('.nectar-progress-bar .bar-wrap > span > strong').css({'opacity':'0'});
1061		$('.nectar-progress-bar .bar-wrap').css({'opacity':'0'});
1062
1063		//clients
1064		$('.clients.fade-in-animation').removeClass('animated-in');
1065		$('.clients.fade-in-animation > div').css('opacity','0');
1066
1067		//carousel
1068		$('.owl-carousel[data-enable-animation="true"]').removeClass('animated-in');
1069		$('.owl-carousel[data-enable-animation="true"] .owl-stage > .owl-item').css({'transition':'none','opacity':'0','transform':'translate(0, 70px)'});
1070		//dividers
1071		$('.divider-small-border[data-animate="yes"], .divider-border[data-animate="yes"]').removeClass('completed').css({'transition':'none','transform':'scale(0,1)'});
1072
1073		//icon list
1074		$('.nectar-icon-list').removeClass('completed');
1075		$('.nectar-icon-list-item').removeClass('animated');
1076
1077		//portfolio
1078		$('.portfolio-items .col').removeClass('animated-in');
1079
1080		//split line
1081		$('.nectar-split-heading').removeClass('animated-in');
1082		$('.nectar-split-heading .heading-line > span').transit({'y':'200%'},0);
1083
1084		//image with hotspots
1085		$('.nectar_image_with_hotspots[data-animation="true"]').removeClass('completed');
1086		$('.nectar_image_with_hotspots[data-animation="true"] .nectar_hotspot_wrap').removeClass('animated-in');
1087
1088		//animated titles
1089		$('.nectar-animated-title').removeClass('completed');
1090
1091		if($('.vc_pie_chart').length > 0)
1092			vc_pieChart();
1093	}
1094
1095	
1096
1097}
1098
1099
1100
1101/***************** Superfish ******************/
1102	
1103	function initSF(){
1104
1105		$(".sf-menu").superfish({
1106			 delay: 700,
1107			 speed: 'fast',
1108			 speedOut:      'fast',             
1109			 animation:   {opacity:'show'}
1110		}); 
1111
1112	}
1113	
1114	var $navLeave;
1115	
1116	/*$('header#top nav > ul > li').hover(function(){
1117		if(!$(this).hasClass('megamenu')){
1118			
1119		}
1120	});*/
1121
1122	
1123	function addOrRemoveSF(){
1124		
1125		if( window.innerWidth < 1000 && $('body').attr('data-responsive') == '1'){
1126			$('body').addClass('mobile');
1127			$('header#top nav').hide();
1128		}
1129		
1130		else {
1131			$('body').removeClass('mobile');
1132			$('header#top nav').show();
1133			$('#mobile-menu').hide();
1134			$('.slide-out-widget-area-toggle #toggle-nav .lines-button').removeClass('close');
1135			
1136			//recalc height of dropdown arrow
1137			$('.sf-sub-indicator').css('height',$('a.sf-with-ul').height());
1138		}
1139
1140		//add specific class if on device for better tablet tracking
1141		if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) $('body').addClass('using-mobile-browser');
1142
1143	}
1144	
1145	addOrRemoveSF();
1146	initSF();
1147	
1148	$(window).resize(addOrRemoveSF);
1149
1150	
1151	function SFArrows(){
1152
1153		//set height of dropdown arrow
1154		$('.sf-sub-indicator').css('height',$('a.sf-with-ul').height());
1155	}
1156	
1157	SFArrows();
1158	
1159
1160	//deactivate hhun on phone
1161	if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
1162		$('body').attr('data-hhun','0');
1163
1164
1165/***************** Caroufredsel ******************/
1166	
1167	function standardCarouselInit() {
1168		$('.carousel:not(".clients")').each(function(){
1169	    	var $that = $(this); 
1170	    	var maxCols = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : 3 ;
1171	    	var scrollNum = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : '' ;
1172	    	var colWidth = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 500 : 453 ;
1173	    	var scrollSpeed, easing;
1174	    	var $autoplayBool = ($(this).attr('data-autorotate') == 'true') ? true : false;
1175			
1176			if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
1177				if($(this).find('li').length % 3 === 0) {
1178					var $themeSkin = true;
1179					var $themeSkin2 = true;
1180				} else {
1181					var $themeSkin = false;
1182					var $themeSkin2 = true;
1183				}
1184	
1185			} else {
1186				var $themeSkin = true;
1187				var $themeSkin2 = true;
1188			}
1189
1190			(parseInt($(this).attr('data-scroll-speed'))) ? scrollSpeed = parseInt($(this).attr('data-scroll-speed')) : scrollSpeed = 700;
1191			($(this).attr('data-easing').length > 0) ? easing = $(this).attr('data-easing') : easing = 'linear';
1192			
1193			
1194			var $element = $that;
1195			if($that.find('img').length == 0) $element = $('body');
1196			
1197			imagesLoaded($element,function(instance){
1198	
1199				
1200		    	$that.carouFredSel({
1201		    		circular: $themeSkin,
1202		    		infinite: $themeSkin2,
1203		    		height : 'auto',
1204		    		responsive: true,
1205			        items       : {
1206						width : colWidth,
1207				        visible     : {
1208				            min         : 1,
1209				            max         : maxCols
1210				        }
1211				    },
1212				    swipe       : {
1213				        onTouch     : true,
1214				        onMouse         : true,
1215				        options      : {
1216				        	excludedElements: "button, input, select, textarea, .noSwipe",
1217				        	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'); }
1218				        },
1219				        onBefore : function(){
1220				    		//hover effect fix
1221				    		$that.find('.work-item').trigger('mouseleave');
1222				    		$that.find('.work-item .work-info a').trigger('mouseup');
1223				    	}
1224				    },
1225				    scroll: {
1226				    	items			: scrollNum,
1227				    	easing          : easing,
1228			            duration        : scrollSpeed,
1229			            onBefore	: function( data ) {
1230			            	
1231			            	 if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
1232			            	 	$that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
1233
1234			            	 }	
1235						},
1236						onAfter	: function( data ) {
1237			            	 if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
1238			            	 	$that.parents('.carousel-wrap').find('.item-count .current').html( $that.triggerHandler('currentPage') +1);
1239			            	 	$that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
1240
1241			            	 }	
1242						}
1243
1244				    },
1245			        prev    : {
1246				        button  : function() {
1247				           return $that.parents('.carousel-wrap').find('.carousel-prev');
1248				        }
1249			    	},
1250				    next    : {
1251			       		button  : function() {
1252				           return $that.parents('.carousel-wrap').find('.carousel-next');
1253				        }
1254				    },
1255				    auto    : {
1256				    	play: $autoplayBool
1257				    }
1258			    }, { transition: true }).animate({'opacity': 1},1300);
1259			    
1260			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1261
1262			    if($that.parents('.carousel-wrap').attr('data-full-width') == 'true') $that.parents('.carousel-outer').css('overflow','visible');
1263
1264			    //add count for non full width ascend skin
1265			    if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
1266					$('<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'));
1267				}
1268			    
1269			    $that.addClass('finished-loading');
1270
1271			    carouselHeightCalcs();
1272			    
1273			    //reinit panr
1274			    if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)) {
1275					$(".portfolio-items.carousel .work-item.style-3 img").panr({
1276						scaleDuration: .28
1277					}); 
1278					$(".portfolio-items:not(.carousel) .work-item.style-3-alt img").panr({ scaleDuration: .28, sensitivity: 12.6, scaleTo: 1.08, panDuration: 3 }); 
1279				}
1280				
1281			    
1282		     });//images loaded
1283		     	     
1284	    });//each
1285
1286		
1287    }
1288    if($('.carousel').length > 0) standardCarouselInit();
1289
1290
1291    function owlCarouselInit() {
1292    	//owl
1293		$('.owl-carousel').each(function(){
1294			var $that = $(this);
1295			var $stagePadding = ($(window).width()<1000) ? 0 : parseInt($(this).attr('data-column-padding'));
1296			var $autoRotateBool = $that.attr('data-autorotate');
1297			var $autoRotateSpeed = $that.attr('data-autorotations-peed');
1298
1299			$(this).owlCarousel({
1300			      responsive:{
1301				        0:{
1302				            items: $(this).attr('data-mobile-cols')
1303				        },
1304				        690:{
1305				            items: $(this).attr('data-tablet-cols')
1306				        },
1307				        1000:{
1308				          items: $(this).attr('data-desktop-small-cols')
1309				        },
1310				        1300:{
1311				            items: $(this).attr('data-desktop-cols')
1312				        }
1313				    },
1314			      /*stagePadding: $stagePadding,*/
1315			      autoplay: $autoRotateBool,
1316			      autoplayTimeout: $autoRotateSpeed,
1317			      onTranslate: function(){
1318			      	$that.addClass('moving');
1319			      },
1320			      onTranslated: function(){
1321			      	$that.removeClass('moving');
1322			      }
1323
1324			  });
1325
1326			$(this).on('changed.owl.carousel', function (event) {
1327			    if (event.item.count - event.page.size == event.item.index)
1328			        $(event.target).find('.owl-dots div:last')
1329			          .addClass('active').siblings().removeClass('active');
1330			});	
1331
1332		});	
1333
1334
1335    }
1336
1337
1338
1339	function owl_carousel_animate() {
1340		$($fullscreenSelector+'.owl-carousel[data-enable-animation="true"]').each(function(){
1341
1342			$owlOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
1343
1344			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;
1345
1346			var $that = $(this);
1347			var waypoint = new Waypoint({
1348	 			element: $that,
1349	 			 handler: function(direction) {
1350
1351	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
1352					     waypoint.destroy();
1353					     return;
1354					}
1355
1356					setTimeout(function(){
1357		 			 	$that.find('.owl-stage > .owl-item').each(function(i){
1358		 			 		var $that = $(this);
1359							$that.delay(i*200).transition({
1360								'opacity': '1',
1361								'y' : '0'
1362							},600,'easeOutQuart');
1363						});
1364						$that.addClass('animated-in');
1365		 			 },$animationDelay);
1366
1367					waypoint.destroy();
1368				},
1369				offset: $owlOffsetPos
1370
1371			}); 
1372
1373		});
1374	}
1375
1376
1377
1378
1379    function productCarouselInit() {
1380		$('.products-carousel').each(function(){
1381	    	var $that = $(this).find('ul'); 
1382	    	var maxCols = 'auto';
1383	    	var scrollNum = 'auto';
1384	    	var colWidth = ($(this).parents('.full-width-content ').length > 0) ? 400 : 353 ;
1385			var scrollSpeed = 800;
1386			var easing = 'easeInOutQuart';
1387			
1388			
1389			var $element = $that;
1390			if($that.find('img').length == 0) $element = $('body');
1391			
1392			//controls on hover
1393			$(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>')
1394
1395			imagesLoaded($element,function(instance){
1396	
1397				
1398		    	$that.carouFredSel({
1399		    		circular: true,
1400		    		responsive: true,
1401			        items       : {
1402						width : colWidth,
1403				        visible     : {
1404				            min         : 1,
1405				            max         : maxCols
1406				        }
1407				    },
1408				    swipe       : {
1409				        onTouch     : true,
1410				        onMouse         : true,
1411				        options      : {
1412				        	excludedElements: "button, input, select, textarea, .noSwipe",
1413				        	tap: function(event, target){ 
1414				        		if($(target).attr('href') && !$(target).is('[target="_blank"]') && !$(target).hasClass('add_to_wishlist') && !$(target).hasClass('add_to_cart_button') && !$(target).is('[rel^="prettyPhoto"]')) 
1415				        			window.open($(target).attr('href'), '_self'); 
1416				        		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"]')) 
1417				        			window.open($(target).parent().attr('href'), '_self'); 
1418				        	}
1419				        },
1420				        onBefore : function(){
1421				    		//hover effect fix
1422				    		$that.find('.product-wrap').trigger('mouseleave');
1423				    		$that.find('.product a').trigger('mouseup');
1424				    	}
1425				    },
1426				    scroll: {
1427				    	items			: scrollNum,
1428				    	easing          : easing,
1429			            duration        : scrollSpeed
1430				    },
1431			        prev    : {
1432				        button  : function() {
1433				           return $that.parents('.carousel-wrap').find('.carousel-prev');
1434				        }
1435			    	},
1436				    next    : {
1437			       		button  : function() {
1438				           return $that.parents('.carousel-wrap').find('.carousel-next');
1439				        }
1440				    },
1441				    auto    : {
1442				    	play: false
1443				    }
1444			    }).animate({'opacity': 1},1300);
1445			    
1446			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1447			    
1448			    $that.addClass('finished-loading');
1449			    fullWidthContentColumns();
1450			    $(window).trigger('resize');
1451
1452		     });//images loaded
1453		     	     
1454	    });//each
1455    }
1456    if($('.products-carousel').length > 0) productCarouselInit();
1457
1458
1459
1460
1461    
1462    //fullwidth carousel swipe link fix
1463    function fwCarouselLinkFix() {
1464	    var $mousePosStart = 0;
1465	    var $mousePosEnd = 0;
1466	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').mousedown(function(e){
1467	    	$mousePosStart = e.clientX;
1468	    });
1469	    
1470	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').mouseup(function(e){
1471	    	$mousePosEnd = e.clientX;
1472	    });
1473	    
1474	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').click(function(e){
1475	    	if(Math.abs($mousePosStart - $mousePosEnd) > 10)  return false;
1476	    });
1477	}
1478	fwCarouselLinkFix();
1479    
1480     
1481	function carouselHeightCalcs(){
1482		
1483		//recent work carousel
1484		$('.carousel.portfolio-items.finished-loading').each(function(){
1485
1486			var bottomSpace = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true' && $(this).find('.style-2, .style-3, .style-4').length > 0) ? 0 : 28 ;
1487			
1488			var tallestMeta = 0;
1489			
1490			$(this).find('> li').each(function(){
1491				($(this).find('.work-meta').height() > tallestMeta) ? tallestMeta = $(this).find('.work-meta').height() : tallestMeta = tallestMeta;
1492			});	
1493    	 
1494     		$(this).parents('.caroufredsel_wrapper').css({
1495     			'height' : ($(this).find('.work-item').outerHeight() + tallestMeta + bottomSpace -2) + 'px'
1496     		});
1497
1498     		 if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
1499        	 	$(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition")+1)/$(this).triggerHandler("currentVisible").length));
1500        	 	$(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length));
1501        	 }	
1502   	  	});
1503   	  	
1504   	  	//standard carousel
1505   	  	$('.carousel.finished-loading:not(".portfolio-items, .clients"), .caroufredsel_wrapper .products.finished-loading').each(function(){
1506			
1507			var tallestColumn = 0;
1508			
1509			$(this).find('> li').each(function(){
1510				($(this).height() > tallestColumn) ? tallestColumn = $(this).height() : tallestColumn = tallestColumn;
1511			});	
1512
1513         	$(this).css('height',tallestColumn + 5);
1514         	$(this).parents('.caroufredsel_wrapper').css('height',tallestColumn + 5);
1515
1516         	 if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
1517        	 	$(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition")+1)/$(this).triggerHandler("currentVisible").length));
1518        	 	$(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length));
1519        	 }	
1520			
1521   	  	});
1522   	  	
1523	}
1524
1525
1526	function clientsCarouselInit(){
1527	     $('.carousel.clients').each(function(){
1528	    	var $that = $(this);
1529	    	var columns; 
1530	    	var $autoRotate = (!$(this).hasClass('disable-autorotate')) ? true : false;
1531	    	(parseInt($(this).attr('data-max'))) ? columns = parseInt($(this).attr('data-max')) : columns = 5;
1532	    	if($(window).width() < 690 && $('body').attr('data-responsive') == '1') { columns = 2; $(this).addClass('phone') }
1533	    	
1534	    	var $element = $that;
1535			if($that.find('img').length == 0) $element = $('body');
1536			
1537			imagesLoaded($element,function(instance){
1538	    		
1539		    	$that.carouFredSel({
1540			    		circular: true,
1541			    		responsive: true, 
1542				        items       : {
1543							
1544							height : $that.find('> div:first').height(),
1545							width  : $that.find('> div:first').width(),
1546					        visible     : {
1547					            min         : 1,
1548					            max         : columns
1549					        }
1550					    },
1551					    swipe       : {
1552					        onTouch     : true,
1553					        onMouse         : true
1554					    },
1555					    scroll: {
1556					    	items           : 1,
1557					    	easing          : 'easeInOutCubic',
1558				            duration        : '800',
1559				            pauseOnHover    : true
1560					    },
1561					    auto    : {
1562					    	play            : $autoRotate,
1563					    	timeoutDuration : 2700
1564					    }
1565			    }).animate({'opacity': 1},1300);
1566			    
1567			    $that.addClass('finished-loading');
1568
1569			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1570			     
1571
1572			    $(window).trigger('resize');
1573			    
1574		    
1575		    });
1576	
1577	    });
1578    }
1579   if($('.carousel').length > 0)  clientsCarouselInit();
1580    
1581
1582    function clientsCarouselHeightRecalc(){
1583
1584    	var tallestImage = 0;
1585		  			
1586    	 $('.carousel.clients.finished-loading').each(function(){
1587    	 	
1588    	 	$(this).find('> div').each(function(){
1589				($(this).height() > tallestImage) ? tallestImage = $(this).height() : tallestImage = tallestImage;
1590			});	
1591    	 	
1592         	$(this).css('height',tallestImage);
1593         	$(this).parent().css('height',tallestImage);
1594         });
1595    }
1596
1597
1598    //carousel grabbing class
1599    function carouselfGrabbingClass() {
1600	    $('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(){
1601	    	$(this).addClass('active');
1602	    });
1603	    
1604	    $('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(){
1605	    	$(this).removeClass('active');
1606	    });
1607	}
1608	carouselfGrabbingClass();
1609	    
1610
1611	//ascend arrow hover class
1612	$('body.ascend').on('mouseover','.carousel-next',function(){
1613		$(this).parent().find('.carousel-prev, .item-count').addClass('next-hovered');
1614	});
1615	$('body.ascend').on('mouseleave','.carousel-next',function(){
1616		$(this).parent().find('.carousel-prev, .item-count').removeClass('next-hovered');
1617	});
1618
1619	//fadein for clients / carousels
1620	function clientsFadeIn() {
1621
1622		$clientsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? 100: 'bottom-in-view';
1623		$($fullscreenSelector+'.clients.fade-in-animation').each(function() {
1624
1625			var $that = $(this);
1626			var waypoint = new Waypoint({
1627 			element: $that,
1628 			 handler: function(direction) {
1629				
1630				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
1631					 waypoint.destroy();
1632					return;
1633				}
1634
1635				 $that.find('> div').each(function(i){
1636					$(this).delay(i*80).transition({'opacity':"1"},450);
1637				});
1638				
1639				
1640				//add the css transition class back in after the aniamtion is done
1641				setTimeout(function(){ $that.addClass('completed'); },($that.find('> div').length*80) + 450);
1642			
1643
1644				$that.addClass('animated-in');
1645				waypoint.destroy();
1646			},
1647			offset: $clientsOffsetPos
1648
1649			}); 
1650		}); 
1651	}
1652	 
1653	//if($('.nectar-box-roll').length == 0) clientsFadeIn();
1654	
1655	
1656/*-------------------------------------------------------------------------*/
1657/*	2.	Helper Functions
1658/*-------------------------------------------------------------------------*/
1659
1660	jQuery.fn.setCursorPosition = function(position){
1661	    if(this.lengh == 0) return this;
1662	    return $(this).setSelection(position, position);
1663	}
1664	
1665	jQuery.fn.setSelection = function(selectionStart, selectionEnd) {
1666	    if(this.lengh == 0) return this;
1667	    input = this[0];
1668	
1669	    if (input.createTextRange) {
1670	        var range = input.createTextRange();
1671	        range.collapse(true);
1672	        range.moveEnd('character', selectionEnd);
1673	        range.moveStart('character', selectionStart);
1674	        range.select();
1675	    } else if (input.setSelectionRange) {
1676	        input.focus();
1677	        input.setSelectionRange(selectionStart, selectionEnd);
1678	    }
1679	
1680	    return this;
1681	}
1682	
1683	
1684
1685	$.extend($.expr[':'], {
1686	    transparent: function(elem, i, attr){
1687	      return( $(elem).css("opacity") === "0" );
1688	    }
1689	});
1690	
1691
1692	function getQueryParams(qs) {
1693	    qs = qs.split("+").join(" ");
1694	    var params = {},
1695	        tokens,
1696	        re = /[?&]?([^=]+)=([^&]*)/g;
1697
1698	    while (tokens = re.exec(qs)) {
1699	        params[decodeURIComponent(tokens[1])]
1700	            = decodeURIComponent(tokens[2]);
1701	    }
1702
1703	    return params;
1704	}
1705
1706	var $_GET = getQueryParams(document.location.search);
1707
1708	
1709	//count
1710	$.fn.countTo = function (options) {
1711		options = options || {};
1712		
1713		return $(this).each(function () {
1714			// set options for current element
1715			var settings = $.extend({}, $.fn.countTo.defaults, {
1716				from:            $(this).data('from'),
1717				to:              $(this).data('to'),
1718				speed:           $(this).data('speed'),
1719				refreshInterval: $(this).data('refresh-interval'),
1720				decimals:        $(this).data('decimals')
1721			}, options);
1722			
1723			// how many times to update the value, and how much to increment the value on each update
1724			var loops = Math.ceil(settings.speed / settings.refreshInterval),
1725				increment = (settings.to - settings.from) / loops;
1726			
1727			// references & variables that will change with each update
1728			var self = this,
1729				$self = $(this),
1730				loopCount = 0,
1731				value = settings.from,
1732				data = $self.data('countTo') || {};
1733			
1734			$self.data('countTo', data);
1735			
1736			// if an existing interval can be found, clear it first
1737			if (data.interval) {
1738				clearInterval(data.interval);
1739			}
1740			data.interval = setInterval(updateTimer, settings.refreshInterval);
1741			
1742			// initialize the element with the starting value
1743			render(value);
1744			
1745			function updateTimer() {
1746				value += increment;
1747				loopCount++;
1748				
1749				render(value);
1750				
1751				if (typeof(settings.onUpdate) == 'function') {
1752					settings.onUpdate.call(self, value);
1753				}
1754				
1755				if (loopCount >= loops) {
1756					// remove the interval
1757					$self.removeData('countTo');
1758					clearInterval(data.interval);
1759					value = settings.to;
1760					
1761					if (typeof(settings.onComplete) == 'function') {
1762						settings.onComplete.call(self, value);
1763					}
1764				}
1765			}
1766			
1767			function render(value) {
1768				var formattedValue = settings.formatter.call(self, value, settings);
1769				$self.html(formattedValue);
1770			}
1771		});
1772	};
1773	
1774	$.fn.countTo.defaults = {
1775		from: 0,               // the number the element should start at
1776		to: 0,                 // the number the element should end at
1777		speed: 1000,           // how long it should take to count between the target numbers
1778		refreshInterval: 100,  // how often the element should be updated
1779		decimals: 0,           // the number of decimal places to show
1780		formatter: formatter,  // handler for formatting the value before rendering
1781		onUpdate: null,        // callback method for every time the element is updated
1782		onComplete: null       // callback method for when the element finishes updating
1783	};
1784	
1785	function formatter(value, settings) {
1786		return value.toFixed(settings.decimals);
1787	}
1788	
1789	
1790	
1791	
1792/*-------------------------------------------------------------------------*/
1793/*	3.	Shortcode Stuff
1794/*-------------------------------------------------------------------------*/
1795
1796
1797/***************** Milestone Counter ******************/
1798	
1799	function milestoneInit() {
1800
1801		$('.nectar-milestone').each(function() {
1802			
1803			//symbol
1804			if($(this).is('[data-symbol]')) {
1805				if($(this).find('.symbol-wrap').length == 0) {
1806					if($(this).attr('data-symbol-pos') == 'before') {
1807						$(this).find('.number').prepend('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>');
1808					} else {
1809						$(this).find('.number').append('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>');
1810					}
1811				}
1812
1813				$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'));
1814			
1815				$(this).find('.symbol-wrap').css({'font-size': $symbol_size + 'px', 'line-height': $symbol_size + 'px'});
1816			}
1817
1818			$(this).find('.number').css({'font-size': $(this).find('.number').attr('data-number-size') +'px', 'line-height': $(this).find('.number').attr('data-number-size') + 'px'});
1819		});
1820		
1821		if(!$('body').hasClass('mobile') && $('.nectar-milestone').length > 0) {
1822			
1823
1824			//blur effect
1825			var $blurCssString = '';
1826			$($fullscreenSelector+'.nectar-milestone.motion_blur').each(function(i){
1827					
1828				$(this).addClass('instance-'+i);
1829
1830				var $currentColor = $(this).find('.number').css('color');
1831				var colorInt = parseInt($currentColor.substring(1),16);
1832		   		var R = (colorInt & 0xFF0000) >> 16;
1833		    	var G = (colorInt & 0x00FF00) >> 8;
1834		   		var B = (colorInt & 0x0000FF) >> 0;
1835		   		
1836		   		var $rgbaColorStart = 'rgba('+R+','+G+','+B+',0.2)';
1837				var $rgbaColorEnd = 'rgba('+R+','+G+','+B+',1)';
1838				var $numberSize = parseInt($(this).find('.number').attr('data-number-size'));
1839
1840				$blurCssString += '@keyframes motion-blur-number-'+i+' { ' +
1841				   ' 0% { '+
1842				   		'opacity: 0;'+
1843						'color: '+$rgbaColorStart+'; '+
1844   						'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+'; '+
1845    					'transform: translateZ(0px) translateY(-100%); '+
1846    					'-webkit-transform: translateZ(0px) translateY(-100%); '+
1847    				'} '+
1848    				'33% { opacity: 1 }' +
1849    				'100% { '+
1850						'color: '+$rgbaColorEnd+'; '+
1851   						'text-shadow: none; '+
1852    					'transform: translateZ(0px) translateY(0px); '+
1853    					'-webkit-transform: translateZ(0px) translateY(0px); '+
1854    				'} '+
1855    			'} '+
1856    			'@-webkit-keyframes motion-blur-number-'+i+' { ' +
1857				   ' 0% { '+
1858				  	    'opacity: 0;'+
1859						'color: '+$rgbaColorStart+'; '+
1860   						'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+'; '+
1861    					'transform: translateZ(0px) translateY(-100%); '+
1862    					'-webkit-transform: translateZ(0px) translateY(-100%); '+
1863    				'} '+
1864    				'33% { opacity: 1 }' +
1865    				'100% { '+
1866						'color: '+$rgbaColorEnd+'; '+
1867   						'text-shadow: none; '+
1868    					'transform: translateZ(0px) translateY(0px); '+
1869    					'-webkit-transform: translateZ(0px) translateY(0px); '+
1870    				'} '+
1871    			'} '+
1872    			'.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+'; } ';
1873    			
1874    			//separate each character into spans
1875    			$symbol = $(this).find('.symbol-wrap').clone();
1876    			$(this).find('.symbol-wrap').remove();
1877    			var characters = $(this).find('.number').text().split("");
1878    			$this = $(this).find('.number');
1879				$this.empty();
1880    			$.each(characters, function (i, el) {
1881				    $this.append("<span>" + el + "</span");
1882				});
1883
1884				//handle symbol
1885				if($(this).has('[data-symbol]')) {
1886	    			if($(this).attr('data-symbol-pos') == 'after') {
1887	    				$this.append($symbol);
1888	    			} else {
1889	    				$this.prepend($symbol);
1890	    			}
1891	    		}
1892				
1893			});
1894
1895			var head = document.head || document.getElementsByTagName('head')[0];
1896				var style = document.createElement('style');
1897
1898				style.type = 'text/css';
1899			if (style.styleSheet){
1900			  style.styleSheet.cssText = $blurCssString;
1901			} else {
1902			  style.appendChild(document.createTextNode($blurCssString));
1903			}
1904			$(style).attr('id','milestone-blur');
1905			$('head #milestone-blur').remove();
1906			head.appendChild(style);
1907
1908
1909			//activate
1910			milestoneWaypoint();
1911
1912		}
1913
1914	}
1915
1916	function milestoneWaypoint() {
1917		$($fullscreenSelector+'.nectar-milestone').each(function() {
1918			//animation
1919			var $offset = ($(this).hasClass('motion_blur')) ? '90%' : '105%';
1920
1921
1922			var $that = $(this);
1923			var waypoint = new Waypoint({
1924	 			element: $that,
1925	 			 handler: function(direction) {
1926
1927	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
1928					     waypoint.destroy();
1929					     return;
1930					}
1931
1932	 			 	var $endNum = parseInt($that.find('.number span:not(.symbol)').text());
1933					if(!$that.hasClass('motion_blur')) {
1934						$that.find('.number span:not(.symbol)').countTo({
1935							from: 0,
1936							to: $endNum,
1937							speed: 1500,
1938							refreshInterval: 30
1939						});
1940					} else {
1941						$that.find('span').each(function(i){
1942							var $that = $(this);
1943							setTimeout(function(){ $that.addClass('in-sight'); },200*i);
1944						});
1945					}
1946
1947
1948					$that.addClass('animated-in');
1949					waypoint.destroy();
1950				},
1951				offset: 'bottom-in-view'
1952
1953			}); 
1954
1955		}); 
1956	}
1957
1958	var $animationOnScrollTimeOut = ($('.nectar-box-roll').length > 0) ? 850: 125;	
1959	//if($('.nectar-box-roll').length == 0) setTimeout(function(){  milestoneInit(); },125); 
1960	
1961/***************** Tabbed ******************/
1962	
1963	$tabbedClickCount = 0;
1964	$('body').on('click','.tabbed > ul li:not(.cta-button) a',function(){
1965		var $id = $(this).parents('li').index()+1;
1966		
1967		if(!$(this).hasClass('active-tab') && !$(this).hasClass('loading')){
1968			$(this).parents('ul').find('a').removeClass('active-tab');
1969			$(this).addClass('active-tab');
1970			
1971			$(this).parents('.tabbed').find('> div:not(.clear)').css({'visibility':'hidden','position':'absolute','opacity':'0','left':'-9999px','display':'none'});
1972			$(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').css({'visibility':'visible', 'position' : 'relative','left':'0','display':'block'}).stop().transition({'opacity':1},300);
1973			
1974			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); 
1975		}
1976		
1977		//waypoint checking
1978		if($tabbedClickCount != 0) {
1979			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-progress-bar').length > 0 ) 
1980				progressBars();
1981			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 ) 
1982				dividers();
1983			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('img.img-with-animation').length > 0 ||
1984			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.col.has-animation').length > 0  || 
1985			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar_cascading_images').length > 0  || 
1986			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wpb_column.has-animation').length > 0 ) {
1987				colAndImgAnimations();
1988				cascadingImageBGSizing();
1989			}
1990			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-milestone').length > 0 ) 
1991				milestoneWaypoint();
1992			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar_image_with_hotspots[data-animation="true"]').length > 0 ) 
1993				imageWithHotspots();
1994			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-fancy-ul').length > 0 ) 
1995				nectar_fancy_ul_init();
1996			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-split-heading').length > 0 ) 
1997				splitLineHeadings();
1998			if($(this).parents('.wpb_row').length > 0) {
1999				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.vc_pie_chart').length > 0  ||
2000				   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wp-video-shortcode').length > 0 ||
2001				   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.twentytwenty-container').length > 0 ||
2002				   $(this).parents('.wpb_row').next().hasClass('parallax_section'))
2003					$(window).trigger('resize');
2004
2005				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-flickity').length > 0 )
2006					$('.nectar-flickity:not(.masonry)').flickity('resize');
2007			}
2008		}
2009
2010		//fix columns inside tabs
2011		$(this).parents('.tabbed').find('.wpb_row').each(function(){
2012			if(typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') {
2013				
2014				var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left;
2015				$(this).find('[class*="vc_col-"]').each(function(){
2016					$(this).removeClass('no-left-margin');
2017					if($(this).offset().left < $firstChildOffset + 15) { 
2018						$(this).addClass('no-left-margin');
2019					} else {
2020						$(this).removeClass('no-left-margin');
2021					}
2022				});
2023			}
2024		});
2025
2026		$tabbedClickCount++;
2027
2028		return false;
2029	});
2030	
2031	//make sure the tabs don't have a nectar slider - we'll init this after the sliders load in that case
2032	function tabbedInit(){ 
2033		$('.tabbed').each(function(){
2034			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){
2035				$(this).find('> ul li:first-child a').click();
2036			}	
2037			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 ){
2038				var $that = $(this);
2039				
2040				$(this).find('.wpb_tab').show().css({'opacity':0,'height':'1px'});
2041				$(this).find('> ul li a').addClass('loading');
2042				
2043				setTimeout(function(){ 
2044					$that.find('.wpb_tab').hide().css({'opacity':1,'height':'auto'}); 
2045					$that.find('> ul li a').removeClass('loading');
2046					$that.find('> ul li:first-child a').click(); 
2047				},900);
2048			}
2049		});
2050	}
2051	tabbedInit();
2052
2053	//deep linking
2054	function tabbbedDeepLinking(){
2055		if(typeof $_GET['tab'] != 'undefined'){
2056			$('.wpb_tabs_nav').each(function(){
2057
2058				$(this).find('li').each(function(){
2059					var $currentText = $(this).find('a').text();
2060					var $getText = $_GET['tab'];
2061					var $that = $(this);
2062
2063					$currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
2064					$getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
2065
2066					if($currentText == $getText)  { 
2067
2068			          $(this).find('a').click(); 
2069			           setTimeout(function(){ 
2070			              $that.find('a').click(); 
2071			           },901);
2072			        }
2073				})
2074			});
2075		}
2076	}
2077	tabbbedDeepLinking();
2078
2079/***************** Toggle ******************/
2080	
2081	//toggles
2082	$('body').on('click','.toggle h3 a', function(){
2083	
2084		if(!$(this).parents('.toggles').hasClass('accordion')) { 
2085			$(this).parents('.toggle').find('> div').slideToggle(300);
2086			$(this).parents('.toggle').toggleClass('open');
2087			
2088			//switch icon
2089			if( $(this).parents('.toggle').hasClass('open') ){
2090				$(this).find('i').attr('class','icon-minus-sign');
2091			} else {
2092				$(this).find('i').attr('class','icon-plus-sign');
2093			}
2094
2095			if($(this).parents('.toggle').find('> div .iframe-embed').length > 0 && $(this).parents('.toggle').find('> div .iframe-embed iframe').height() == '0') responsiveVideoIframes();
2096			if($(this).parents('.full-width-content').length > 0) setTimeout(function(){ fullWidthContentColumns(); },300);
2097			if($('#nectar_fullscreen_rows').length > 0) setTimeout(function(){ $(window).trigger('smartresize'); },300);
2098			return false;
2099		}
2100	});
2101	
2102	//accordion
2103	$('body').on('click','.accordion .toggle h3 a', function(){
2104		
2105		if($(this).parents('.toggle').hasClass('open')) return false;
2106		
2107		$(this).parents('.toggles').find('.toggle > div').slideUp(300);
2108		$(this).parents('.toggles').find('.toggle h3 a i').attr('class','icon-plus-sign');
2109		$(this).parents('.toggles').find('.toggle').removeClass('open');
2110		
2111		$(this).parents('.toggle').find('> div').slideDown(300);
2112		$(this).parents('.toggle').addClass('open');
2113		
2114		//switch icon
2115		if( $(this).parents('.toggle').hasClass('open') ){
2116			$(this).find('i').attr('class','icon-minus-sign');
2117		} else {
2118			$(this).find('i').attr('class','icon-plus-sign');
2119		}
2120
2121		if($(this).parents('.full-width-content').length > 0) { 
2122			clearTimeout($t);
2123			var $t = setTimeout(function(){ fullWidthContentColumns(); },400);
2124		}
2125		if($('#nectar_fullscreen_rows').length > 0) {
2126			clearTimeout($t);
2127			var $t = setTimeout(function(){ $(window).trigger('smartresize'); },400);
2128		}
2129		
2130		return false;
2131	});
2132	
2133	//accordion start open
2134	function accordionInit(){ 
2135		$('.accordion').each(function(){
2136			$(this).find('> .toggle').first().addClass('open').find('> div').show();
2137			$(this).find('> .toggle').first().find('a i').attr('class','icon-minus-sign');
2138		});
2139		
2140		
2141		$('.toggles').each(function(){
2142			
2143			var $isAccordion = ($(this).hasClass('accordion')) ? true : false;
2144			
2145			$(this).find('.toggle').each(function(){
2146				if($(this).find('> div .testimonial_slider').length > 0 || $(this).find('> div iframe').length > 0) {
2147					var $that = $(this);
2148					$(this).find('> div').show().css({'opacity':0,'height':'1px', 'padding':'0'});
2149					
2150					testimonialHeightResize();
2151					
2152					setTimeout(function(){
2153						$that.find('> div').hide().css({'opacity':1,'height':'auto', 'padding':'10px 14px'}); 
2154						if($isAccordion == true && $that.index() == 0) $that.find('> div').slideDown(300);
2155					},900);
2156				} 
2157			});
2158		})
2159	}
2160	accordionInit();
2161
2162	//deep linking
2163	function accordionDeepLinking(){
2164		if(typeof $_GET['toggle'] != 'undefined'){
2165			$('.toggles').each(function(){
2166
2167				$(this).find('.toggle').each(function(){
2168					var $currentText = $(this).find('h3 a').clone();
2169					var $getText = $_GET['toggle'];
2170
2171					$($currentText).find('i').remove();
2172					$currentText = $currentText.text();
2173					$currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
2174					$getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
2175
2176					if($currentText == $getText) $(this).find('h3 a').click();
2177				});
2178			});
2179		}
2180	}
2181	accordionDeepLinking();
2182
2183/***************** Button ******************/
2184	
2185	$.cssHooks.color = {
2186	    get: function(elem) {
2187	        if (elem.currentStyle)
2188	            var color = elem.currentStyle["color"];
2189	        else if (window.getComputedStyle)
2190	            var color = document.defaultView.getComputedStyle(elem,
2191	                null).getPropertyValue("color");
2192	        if (color.search("rgb") == -1)
2193	            return color;
2194	        else {
2195	            color = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
2196	            function hex(x) {
2197	                return ("0" + parseInt(x).toString(16)).slice(-2);
2198	            }
2199	            if(color) {
2200	            	return "#" + hex(color[1]) + hex(color[2]) + hex(color[3]);
2201	            }
2202	        }
2203	    }
2204	}
2205
2206	$.cssHooks.backgroundColor = {
2207	    get: function(elem) {
2208	        if (elem.currentStyle)
2209	            var bg = elem.currentStyle["backgroundColor"];
2210	        else if (window.getComputedStyle)
2211	            var bg = document.defaultView.getComputedStyle(elem,
2212	                null).getPropertyValue("background-color");
2213	        if (bg.search("rgb") == -1)
2214	            return bg;
2215	        else {
2216	            bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
2217	            function hex(x) {
2218	                return ("0" + parseInt(x).toString(16)).slice(-2);
2219	            }
2220	            if(bg) {
2221	            	return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]);
2222	            }
2223	        }
2224	    }
2225	}
2226	
2227	function shadeColor(hex, lum) {
2228
2229	  // validate hex string
2230		hex = String(hex).replace(/[^0-9a-f]/gi, '');
2231		if (hex.length < 6) {
2232			hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];
2233		}
2234		lum = lum || 0;
2235
2236		// convert to decimal and change luminosity
2237		var rgb = "#", c, i;
2238		for (i = 0; i < 3; i++) {
2239			c = parseInt(hex.substr(i*2,2), 16);
2240			c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
2241			rgb += ("00"+c).substr(c.length);
2242		}
2243
2244		return rgb;
2245	}
2246
2247	//color
2248	function coloredButtons() {
2249		$('.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(){
2250			
2251			$(this).css('visibility','visible');
2252			
2253			//if($(this).attr('data-color-override') != 'false'){
2254
2255				if($(this).attr('data-color-override') != 'false') {
2256					var $color = $(this).attr('data-color-override') ;
2257				} else {
2258					if($(this).parents('.dark').length > 0) 
2259						var $color = '#000000';
2260					else 
2261						var $color = '#ffffff';
2262				}
2263
2264				if(!$(this).hasClass('see-through-3')) $(this).css('color',$color);
2265				$(this).find('i').css('color',$color);
2266				
2267				var colorInt = parseInt($color.substring(1),16);
2268				var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override';
2269				var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff';
2270				
2271		   		var R = (colorInt & 0xFF0000) >> 16;
2272		    	var G = (colorInt & 0x00FF00) >> 8;
2273		   		var B = (colorInt & 0x0000FF) >> 0;
2274		   		
2275		   		$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2276
2277				$(this).css('border-color','rgba('+R+','+G+','+B+','+$opacityStr+')');
2278				
2279				if($(this).hasClass('see-through')) {
2280					$(this).hover(function(){
2281						$(this).css('border-color','rgba('+R+','+G+','+B+',1)');
2282					},function(){
2283						$(this).css('border-color','rgba('+R+','+G+','+B+','+$opacityStr+')');
2284					});
2285				} else {
2286					
2287					$(this).find('i').css('color', $hoverTextColor);
2288					
2289					if($hoverColor != 'no-override'){
2290						$(this).hover(function(){
2291				
2292							$(this).css({
2293								'border-color': $hoverColor,
2294								'background-color': $hoverColor,
2295								'color': $hoverTextColor
2296							});
2297						},function(){
2298							$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2299
2300							if(!$(this).hasClass('see-through-3')) {
2301								$(this).css({
2302									'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
2303									'background-color': 'transparent',
2304									'color': $color
2305								});
2306							} else {
2307								$(this).css({
2308									'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
2309									'background-color': 'transparent'
2310								});
2311							}
2312						});
2313					
2314					} else {
2315						$(this).hover(function(){
2316							$(this).css({
2317								'border-color': $hoverColor,
2318								'color': $hoverTextColor
2319							});
2320						},function(){
2321							$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2322							$(this).css({
2323								'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
2324								'color':  $hoverTextColor
2325							});
2326						});
2327					
2328					}
2329			//	}
2330			
2331			}
2332		});
2333		
2334		$('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function(){
2335			
2336			$(this).css('visibility','visible');
2337			
2338			if($(this).attr('data-color-override') != 'false'){
2339				
2340				var $color = $(this).attr('data-color-override');
2341				$(this).removeClass('accent-color').removeClass('extra-color-1').removeClass('extra-color-2').removeClass('extra-color-3');
2342				$(this).css('background-color',$color);
2343				
2344			}
2345			
2346		});
2347
2348
2349		//solid color tilt 
2350		if($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) {
2351
2352			var $tiltButtonCssString = '';
2353
2354			$('.swiper-slide .solid_color_2 a').each(function(i){
2355				
2356				$(this).addClass('instance-'+i);
2357
2358				if($(this).attr('data-color-override') != 'false') {
2359					var $color = $(this).attr('data-color-override');
2360				} else {
2361					if($(this).parents('.dark').length > 0) 
2362						var $color = '#000000';
2363					else 
2364						var $color = '#ffffff';
2365				}
2366
2367				$(this).css('color',$color);
2368				$(this).find('i').css('color',$color);
2369				
2370				var $currentColor = $(this).css('background-color');
2371				var $topColor = shadeColor($currentColor, 0.13);
2372				var $bottomColor = shadeColor($currentColor, -0.15);
2373	
2374				$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+'; } ';
2375
2376			});
2377
2378
2379			$('.tilt-button-wrap a').each(function(i){
2380				
2381				$(this).addClass('instance-'+i);
2382
2383				var $currentColor = $(this).css('background-color');
2384
2385				if($(this).attr('data-color-override') != 'false') {
2386					var $color = $(this).attr('data-color-override');
2387					$(this).css('background-color',$color);
2388					$currentColor = $color;
2389				} 
2390			
2391				var $topColor = shadeColor($currentColor, 0.13);
2392				var $bottomColor = shadeColor($currentColor, -0.15);
2393	
2394				$tiltButtonCssString += '.tilt-button-wrap a.instance-'+i + ':after { background-color: '+$topColor+';  }' + ' .tilt-button-wrap a.instance-'+i + ':before { background-color: '+$bottomColor+'; } ';
2395
2396			});
2397
2398			var head = document.head || document.getElementsByTagName('head')[0];
2399   			var style = document.createElement('style');
2400
2401   			style.type = 'text/css';
2402			if (style.styleSheet){
2403			  style.styleSheet.cssText = $tiltButtonCssString;
2404			} else {
2405			  style.appendChild(document.createTextNode($tiltButtonCssString));
2406			}
2407
2408			head.appendChild(style);
2409		}
2410
2411
2412		//transparent 3d
2413		if($('.nectar-3d-transparent-button').length > 0) {
2414
2415			var $3dTransButtonCssString = '';
2416			$('.nectar-3d-transparent-button').each(function(i){
2417
2418				var $that = $(this);
2419				var $size = $that.attr('data-size');
2420				var $padding = 0;
2421
2422		
2423
2424				//size
2425
2426				if($size == 'large') {
2427					$padding = 46;
2428					$font_size = 16;
2429				} else if($size == 'medium') {
2430					$padding = 30;
2431					$font_size = 16;
2432				} else if($size == 'small') {
2433					$padding = 20;
2434					$font_size = 12;
2435				} else if($size == 'jumbo') {
2436					$padding = 54;
2437					$font_size = 24;
2438				} else if($size == 'extra_jumbo') {
2439					$padding = 100;
2440					$font_size = 64;
2441				}
2442
2443				$that.find('svg text').attr('font-size',$font_size);
2444				$boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect();
2445
2446				$text_width = $boundingRect.width;
2447				$text_height = $font_size*1.5;
2448
2449				$extraMult = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 0 : 1;
2450
2451				$that.css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'});
2452				$that.find('> a').css({'height': ($text_height+$padding)+'px'});
2453
2454				$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));
2455				if($size == 'jumbo')
2456					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.68) +')');
2457				else if($size == 'extra_jumbo')
2458					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.6)/2 +' ' + (($text_height+$padding) / 1.6) +')');
2459				else if($size == 'large') {
2460					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.7) +')');
2461				}
2462				else {
2463					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.65) +')');
2464				}
2465				$that.find('.front-3d ').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
2466				$that.find('.back-3d').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
2467
2468				//mask
2469				$(this).find('.front-3d svg >
2469 rect').attr('id','masked-rect-id-'+i);
2470				$(this).find('.front-3d defs mask').attr('id','button-text-mask-'+i);
2471
2472				$that.css('visibility','visible');
2473				$3dTransButtonCssString+= '#masked-rect-id-'+i+' { mask: url(#button-text-mask-'+i+'); -webkit-mask: url(#button-text-mask-'+i+')} ';
2474
2475			});
2476
2477			//extra jumbo resize
2478			function createExtraJumboSize() {
2479				$('.nectar-3d-transparent-button').each(function(i){
2480					
2481					if($(this).css('visibility') != 'visible') return;
2482
2483					var $that = $(this);
2484					var $size = $that.attr('data-size');
2485					if($size == 'extra_jumbo') {
2486
2487						$extraMult = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 0 : 1;
2488
2489						if(window.innerWidth < 1000 && window.innerWidth > 690) {
2490							$padding = 64;
2491							$font_size = 34;
2492							$that.find('.back-3d rect').attr('stroke-width','12');
2493							$vert_height_divider = 1.7;
2494						} else if(window.innerWidth <= 690 ) {
2495							$padding = 46;
2496							$font_size = 16;
2497							$that.find('.back-3d rect').attr('stroke-width','10');
2498							$vert_height_divider = 1.7;
2499						}  else {
2500							$padding = 100;
2501							$font_size = 64;
2502							$that.find('.back-3d rect').attr('stroke-width','20');
2503							$vert_height_divider = 1.6;
2504						}
2505			
2506
2507						$that.find('svg text').attr('font-size',$font_size);
2508
2509						$boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect();
2510						$text_width = $boundingRect.width;
2511						$text_height = $font_size*1.5;
2512
2513						$that.css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'});
2514						$that.find('> a').css({'height': ($text_height+$padding)+'px'});
2515
2516						$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));
2517
2518						$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.6)/2 +' ' + (($text_height+$padding) / $vert_height_divider) +')');
2519
2520						$that.find('.front-3d ').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
2521						$that.find('.back-3d').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
2522
2523					}
2524				});
2525			}
2526			createExtraJumboSize();
2527			$(window).on('smartresize',createExtraJumboSize);
2528
2529			var head = document.head || document.getElementsByTagName('head')[0];
2530				var style = document.createElement('style');
2531
2532				style.type = 'text/css';
2533			if (style.styleSheet){
2534			  style.styleSheet.cssText = $3dTransButtonCssString;
2535			} else {
2536			  style.appendChild(document.createTextNode($3dTransButtonCssString));
2537			}
2538
2539			head.appendChild(style);
2540		}
2541
2542		//gradient btn init
2543		setTimeout(function(){
2544			$('.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');
2545		},150);
2546		//no grad for ff
2547		if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) {
2548			$('.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');
2549		}
2550	}	
2551
2552	coloredButtons();
2553
2554
2555	//large icon hover
2556	function largeIconHover(){
2557		$('.icon-3x').each(function(){
2558			$(this).closest('.col').hover(function(){
2559				$(this).find('.icon-3x').addClass('hovered')
2560			},function(){
2561				$('.icon-3x').removeClass('hovered')
2562			});
2563		});
2564
2565		//remove gradient from FF
2566		if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./))
2567			$('[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-gradient-text').addClass('no-grad');
2568	}
2569	largeIconHover();
2570
2571
2572
2573/***************** Column Hover BG ******************/
2574
2575function columnBGColors() {	
2576	
2577	var $columnColorCSS = '';
2578
2579	$('.wpb_column').each(function(i){
2580
2581		$(this).addClass('instance-'+i);
2582
2583		//bg color
2584		if($(this).attr('data-has-bg-color') == 'true') {
2585			if($(this).is('[data-animation*="reveal"]') && $(this).hasClass('has-animation')) 
2586				$columnColorCSS += '.wpb_column.instance-'+i+ ' .column-inner-wrap .column-inner:before { background-color:' + $(this).attr('data-bg-color') + ';  opacity: '+$(this).attr('data-bg-opacity')+'; }';
2587			else 
2588				$columnColorCSS += '.wpb_column.instance-'+i+ ':before { background-color:' + $(this).attr('data-bg-color') + ';  opacity: '+$(this).attr('data-bg-opacity')+'; }';
2589		}
2590
2591		//hover bg color
2592		if($(this).is('[data-hover-bg^="#"]')) {
2593			if($(this).is('[data-animation*="reveal"]') && $(this).hasClass('has-animation')) 
2594				$columnColorCSS += '.wpb_column.instance-'+i+ ':hover .column-inner:before { background-color: '+$(this).attr('data-hover-bg') + '; opacity: '+$(this).attr('data-hover-bg-opacity')+'; }';
2595			else 
2596	   			$columnColorCSS += '.wpb_column.instance-'+i+ ':hover:before { background-color: '+$(this).attr('data-hover-bg') + '; opacity: '+$(this).attr('data-hover-bg-opacity')+'; }';
2597
2598		}
2599	});
2600
2601	if($columnColorCSS.length > 1) {
2602		var head = document.head || document.getElementsByTagName('head')[0];
2603		var style = document.createElement('style');
2604
2605		style.type = 'text/css';
2606		if (style.styleSheet){
2607		  style.styleSheet.cssText = $columnColorCSS;
2608		} else {
2609		  style.appendChild(document.createTextNode($columnColorCSS));
2610		}
2611
2612		head.appendChild(style);
2613	}
2614
2615}
2616columnBGColors();
2617
2618
2619
2620/***************** Row Color Overlay ******************/
2621function rowColorOverlay() {	
2622	
2623	var $rowOverlayCSS = '';
2624
2625	$('.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){
2626
2627		$(this).parent().addClass('instance-'+i);
2628
2629		$overlayOpacity = ($(this).attr('data-overlay_strength').length > 0) ? $(this).attr('data-overlay_strength') : '1';
2630		$overlay1 = ($(this).attr('data-color_overlay').length > 0) ? $(this).attr('data-color_overlay') : 'transparent';
2631		$overlay2 = ($(this).attr('data-color_overlay_2').length > 0) ? $(this).attr('data-color_overlay_2') : 'transparent';
2632		$gradientDirection = ($(this).attr('data-gradient_direction').length > 0) ? $(this).attr('data-gradient_direction') : 'left_t_right';
2633		switch($gradientDirection) {
2634			case 'left_to_right' : 
2635				var $gradientDirectionDeg = '90deg';
2636				break;
2637			case 'left_t_to_right_b' : 
2638				var $gradientDirectionDeg = '135deg';
2639				break;
2640			case 'left_b_to_right_t' : 
2641				var $gradientDirectionDeg = '45deg';
2642				break;
2643			case 'top_to_bottom' : 
2644				var $gradientDirectionDeg = 'to bottom';
2645				break;
2646		} 
2647		$enableGradient = ($(this).attr('data-enable_gradient') == 'true') ? true : false;
2648
2649		if($enableGradient) {
2650			
2651			//safari transparent white fix
2652			if($overlay1 == '#ffffff' && $overlay2 == 'transparent') $overlay2 = 'rgba(255,255,255,0.001)';
2653			if($overlay1 == 'transparent' && $overlay2 == '#ffffff') $overlay1 = 'rgba(255,255,255,0.001)';
2654			
2655			if($gradientDirection == 'top_to_bottom') {
2656				if($overlay2 == 'transparent' || $overlay2 == 'rgba(255,255,255,0.001)') $rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 0%,' + $overlay2 + ' 75%);  opacity: '+$overlayOpacity+'; }';
2657				if($overlay1 == 'transparent' || $overlay1 == 'rgba(255,255,255,0.001)') $rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 25%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
2658				
2659				if( $overlay1 != 'transparent' && $overlay2 != 'transparent') $rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after {  background: '+$overlay1+'; background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 0%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
2660			
2661			} else
2662				$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: '+$overlay1+'; background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 0%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
2663
2664
2665		} else {
2666
2667			if($(this).attr('data-color_overlay').length > 0) {
2668				$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background-color:' + $overlay1 + ';  opacity: '+$overlayOpacity+'; }';
2669			}
2670
2671		}
2672	
2673
2674
2675	});
2676	
2677	if($rowOverlayCSS.length > 1) {
2678		var head = document.head || document.getElementsByTagName('head')[0];
2679		var style = document.createElement('style');
2680
2681		style.type = 'text/css';
2682		if (style.styleSheet){
2683		  style.styleSheet.cssText = $rowOverlayCSS;
2684		} else {
2685		  style.appendChild(document.createTextNode($rowOverlayCSS));
2686		}
2687
2688		head.appendChild(style);
2689	}
2690
2691}
2692
2693rowColorOverlay();
2694
2695
2696/***************** morphing button ******************/
2697
2698function morphingOutlines() {
2699
2700	if($('.morphing-outline').length > 0) {
2701
2702		$morphingOutlineCSS = '';
2703
2704		$('.morphing-outline').each(function(i){
2705			$(this).addClass('instance-'+i).css({'visibility':'visible'});
2706			var $width = $(this).find('.inner').width();
2707			var $height = $(this).find('.inner').height();
2708			var $border = parseInt($(this).attr("data-border-thickness"));
2709			var $hover = ($('body[data-button-style="rounded"]').length > 0) ? ':hover': '';
2710			var $hover2 = ($('body[data-button-style="rounded"]').length > 0) ? '': ':hover';
2711
2712			$morphingOutlineCSS += 'body .morphing-outline.instance-'+i+' .inner > * { color: '+$(this).attr("data-starting-color")+'; } ';
2713			$morphingOutlineCSS += 'body .morphing-outline.instance-'+i+' .inner:after  { border-width:'+$(this).attr("data-border-thickness")+'px ; border-color: '+$(this).attr("data-starting-color")+'; } ';
2714			
2715			$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")+'; } ';
2716			$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")+'; } ';
2717			//padding calcs
2718			$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}';
2719			$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
2720			$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 }';
2721
2722			$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 }';
2723			////hover
2724			$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}';
2725			$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 }';
2726
2727		});
2728
2729		var head = document.head || document.getElementsByTagName('head')[0];
2730		var style = document.createElement('style');
2731
2732		style.type = 'text/css';
2733		style.id = 'morphing-outlines';
2734		if (style.styleSheet){
2735		  style.styleSheet.cssText = $morphingOutlineCSS;
2736		} else {
2737		  style.appendChild(document.createTextNode($morphingOutlineCSS));
2738		}
2739
2740		$('#morphing-outlines').remove();
2741		head.appendChild(style);
2742	}
2743}
2744
2745setTimeout(morphingOutlines,100); 
2746setTimeout(fullWidthContentColumns,126);
2747
2748
2749/***************** svg icons *******************/
2750
2751var $svg_icons = [];
2752function svgAnimations() {
2753	
2754	$svgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
2755
2756	if($svg_icons.length == 0) {
2757
2758		$('.svg-icon-holder:not(.animated-in)').each(function(i){
2759			var $that = $(this);
2760
2761			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)) $that.attr('data-animation','false');
2762
2763			//size
2764			$that.css({'height': parseInt($that.attr('data-size')) +'px', 'width': parseInt($that.attr('data-size')) +'px'});
2765
2766			//animation
2767			$(this).attr('id','nectar-svg-animation-instance-'+i);
2768			var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200;
2769			if($that.attr('data-animation') == 'false') { 
2770				$animationSpeed = 1;
2771				$that.css('opacity','1');
2772			}
2773
2774			if(!$that.hasClass('bound'))
2775				$svg_icons[i] = new Vivus($that.attr('id'), {type: 'delayed', pathTimingFunction: Vivus.EASE_OUT, animTimingFunction: Vivus.LINEAR, duration: $animationSpeed, file: $that.text(), onReady: svgInit });
2776			
2777			$that.find('span').remove();
2778			if($animationSpeed !== 1) {
2779
2780				var $that = $(this);
2781				var waypoint = new Waypoint({
2782		 			element: $that,
2783		 			 handler: function(direction) {
2784		 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
2785						     waypoint.destroy();
2786						     return;
2787						}
2788
2789		 			 	checkIfReady();
2790						$that.addClass('animated-in');
2791						waypoint.destroy();
2792					},
2793					offset: $svgOffsetPos
2794
2795				}); 
2796
2797			} else {
2798				checkIfReady();
2799			}
2800
2801			function checkIfReady() {
2802				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;
2803				if($svg_icons[$that.attr('id').slice(-1)].isReady == true) {
2804					$that.css('opacity','1');
2805					 setTimeout(function(){ $svg_icons[$that.attr('id').slice(-1)].reset().play(); },$animationDelay);
2806				} else {
2807					setTimeout(checkIfReady,50);
2808				}
2809			}
2810
2811			function svgInit() {
2812
2813				//set size
2814				$that.find('object').css({'height': parseInt($that.attr('data-size')) +'px', 'width': parseInt($that.attr('data-size')) +'px'});
2815
2816				//stop animation until user scrolls to it
2817				$svg_icons[$that.attr('id').slice(-1)].reset().stop();
2818
2819				//set color
2820				var svgDoc = $that.find('object')[0].contentDocument;
2821
2822				var styleElement = svgDoc.createElementNS("http://www.w3.org/2000/svg", "style");
2823				styleElement.textContent = "svg, svg path { stroke: "+$that.css('color')+"; fill: none; }"; 
2824				svgDoc.getElementById("Layer_1").appendChild(styleElement);
2825
2826			}
2827
2828			$that.addClass('bound');
2829
2830		});	
2831	} else {
2832		$('.svg-icon-holder').addClass('animated-in').css('opacity','1');
2833	}
2834	
2835	//full vc row support
2836	$('.svg-icon-holder.animated-in').each(function(i){
2837		
2838		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;
2839		var $that = $(this);
2840
2841		if($that.attr('data-animation') == 'false') { 
2842			$animationSpeed = 1;
2843			$that.css('opacity','1');
2844			$svg_icons[$that.attr('id').slice(-1)].finish();
2845		} else {
2846			if($(this).parents('.active').length > 0 || $(this).parents('#footer-outer').length > 0 || $('body.mobile').length > 0) {
2847				$svg_icons[$that.attr('id').slice(-1)].reset();
2848				setTimeout(function(){ $svg_icons[$that.attr('id').slice(-1)].play(); },$animationDelay);
2849			}
2850
2851			else {
2852				$svg_icons[$(this).attr('id').slice(-1)].reset().stop();
2853			}
2854		}
2855	});
2856}
2857//if($('.nectar-box-roll').length == 0 || $('body.mobile').length > 0) setTimeout(svgAnimations,100);
2858
2859/***************** fancy ul ******************/
2860
2861	function nectar_fancy_ul_init() {
2862		$($fullscreenSelector+'.nectar-fancy-ul').each(function(){
2863
2864
2865			var $icon = $(this).attr('data-list-icon');
2866			var $color = $(this).attr('data-color');
2867			var $animation = $(this).attr('data-animation');
2868			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;
2869			
2870			$(this).find('li').each(function(){
2871				
2872				if($(this).find('> i').length == 0) 
2873					$(this).prepend('<i class="icon-default-style '+$icon+ ' ' + $color +'"></i> ');
2874			});
2875
2876			
2877			if($animation == 'true') {
2878
2879
2880				var $that = $(this);
2881				var waypoint = new Waypoint({
2882		 			element: $that,
2883		 			 handler: function(direction) {
2884
2885		 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
2886						     waypoint.destroy();
2887						     return;
2888						}
2889
2890						setTimeout(function(){
2891			 			 	$that.find('li').each(function(i){
2892			 			 		var $that = $(this);
2893								$that.delay(i*220).transition({
2894									'opacity': '1',
2895									'left' : '0'
2896								},220,'easeOutCubic');
2897							});
2898			 			 },$animationDelay);
2899
2900						$that.addClass('animated-in');
2901						waypoint.destroy();
2902					},
2903					offset: 'bottom-in-view'
2904
2905				}); 
2906
2907			} 
2908			
2909			
2910			
2911		});
2912	}
2913	setTimeout(function(){ 
2914		//if($('.nectar-box-roll').length == 0) nectar_fancy_ul_init();
2915	},$animationOnScrollTimeOut); 
2916
2917	
2918
2919/***************** flip box min heights ******************/
2920//if content height exceeds min height change it
2921function flipBoxHeights() {
2922	$('.nectar-flip-box').each(function(){
2923		
2924		var $flipBoxMinHeight = parseInt($(this).attr('data-min-height'));
2925		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();
2926
2927		if($flipBoxHeight >= $flipBoxMinHeight - 80) {
2928			$(this).find('> div').css('height', $flipBoxHeight + 80);
2929		} else 
2930			$(this).find('> div').css('height','auto');
2931
2932	});
2933}
2934flipBoxHeights();
2935
2936if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
2937	$('.nectar-flip-box').on('click',function(){
2938		$(this).toggleClass('flipped');
2939	});
2940}
2941
2942/***************** PARALLAX SECTIONS ******************/
2943	
2944	// Create cross browser requestAnimationFrame method:
2945    window.requestAnimationFrame = window.requestAnimationFrame
2946     || window.mozRequestAnimationFrame
2947     || window.webkitRequestAnimationFrame
2948     || window.msRequestAnimationFrame
2949     || function(f){setTimeout(f, 1000/60)}
2950
2951
2952	var $window = $(window);
2953	var windowHeight = $window.height();
2954	
2955	$window.unbind('scroll.parallaxSections').unbind('resize.parallaxSections');
2956	$window.unbind('resize.parallaxSectionsUpdateHeight');
2957	$window.unbind('load.parallaxSectionsOffsetL');
2958	$window.unbind('resize.parallaxSectionsOffsetR');
2959
2960	$window.on('resize.parallaxSectionsUpdateHeight',psUpdateWindowHeight);
2961
2962	function psUpdateWindowHeight() {
2963		windowHeight = $window.height();
2964	}
2965
2966	function psUpdateOffset($this) {
2967		$this.each(function(){
2968	  	    firstTop = $this.offset().top;
2969		});
2970	}
2971	
2972	$.fn.parallaxScroll = function(xpos, speedFactor, outerHeight) {
2973		var $this = $(this);
2974		var getHeight;
2975		var firstTop;
2976		var paddingTop = 0;
2977		
2978		//get the starting position of each element to have parallax applied to it		
2979		$this.each(function(){
2980		    firstTop = $this.offset().top;
2981		});
2982		
2983		
2984		$window.on('resize.parallaxSectionsOffsetR',psUpdateOffset($this));
2985		$window.on('load.parallaxSectionsOffsetL',psUpdateOffset($this));
2986	
2987		getHeight = function(jqo) {
2988			return jqo.outerHeight(true);
2989		};
2990		 
2991			
2992		// setup defaults if arguments aren't specified
2993		if (arguments.length < 1 || xpos === null) xpos = "50%";
2994		if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1;
2995		if (arguments.length < 3 || outerHeight === null) outerHeight = true;
2996		
2997		// function to be called whenever the window is scrolled or resized
2998
2999		var $element, top, height, pos;
3000
3001		function update(){
3002
3003			pos = $window.scrollTop();				
3004			
3005			$this.each(function(){
3006
3007				firstTop = $this.offset().top;
3008
3009				$element = $(this);
3010				top = $element.offset().top;
3011				height = getHeight($element);
3012
3013				// Check if totally above or totally below viewport
3014				if (top + height < pos || top > pos + windowHeight) {
3015					return;
3016				}
3017
3018				var ua = window.navigator.userAgent;
3019		        var msie = ua.indexOf("MSIE ");
3020
3021		        //for IE, Safari or any setup using the styled scrollbar default to animating the BG pos
3022		        if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true || navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
3023		        	$this.find('.row-bg.using-image').css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px");
3024		        }
3025		       	//for Firefox/Chrome use a higher performing method
3026		        else  {
3027		        	var $ifFast = ($this.find('.row-bg[data-parallax-speed="fast"]').length > 0) ? ($element.find('.row-bg').height() - height)/2 : 0;
3028		        	$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)' });
3029		        }              
3030				
3031			});
3032		}		
3033
3034		if (window.addEventListener) {
3035			 window.addEventListener('scroll', function(){ 
3036	          requestAnimationFrame(update); 
3037	        }, false);
3038		}
3039
3040		$window.on('resize.parallaxSections',update);
3041
3042		update();
3043	};
3044
3045
3046
3047	
3048/***************** Full Width Section ******************/
3049	function fullWidthSections(){
3050		
3051		var $scrollBar = ($('#ascrail2000').length > 0 && window.innerWidth > 1000) ? -13 : 4;
3052			 
3053		if($('#boxed').length == 1){
3054			$justOutOfSight = ((parseInt($('.container-wrap').width()) - parseInt($('.main-content').width())) / 2) + 4;
3055		} else {
3056			
3057			//if the ext responsive mode is on - add the extra padding into the calcs
3058			var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1000) ? 180 : 0;
3059			
3060			if($(window).width() <= parseInt($('.main-content').css('max-width'))) { 
3061				var $windowWidth = parseInt($('.main-content').css('max-width'));
3062
3063				//no need for the scrollbar calcs with ext responsive on desktop views
3064				if($extResponsivePadding == 180) $windowWidth = $windowWidth - $scrollBar;
3065
3066			} else { 
3067				var $windowWidth = $(window).width();
3068			}
3069
3070			
3071			$contentWidth = parseInt($('.main-content').css('max-width'));
3072
3073			//single post fullwidth
3074			if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 ) {
3075				$contentWidth = $('#post-area').width();
3076				$extResponsivePadding = 0;
3077			}
3078			
3079			$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
3080		}
3081		
3082		$('.full-width-section').each(function(){
3083			
3084			if(!$(this).parents('.span_9').length > 0 && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner' && $(this).parent().attr('id') != 'portfolio-extra' &&
3085			!$(this).hasClass('non-fw')){
3086
3087				$(this).css({
3088					'margin-left': - $justOutOfSight,
3089					'padding-left': $justOutOfSight,
3090					'padding-right': $justOutOfSight,
3091					'visibility': 'visible'
3092				});	
3093
3094			if($('#boxed').length > 0 && $('#nectar_fullscreen_rows').length > 0) $(this).css({ 'padding-left': 0, 'padding-right': 0 });
3095
3096			}  else if($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) {
3097				$(this).css({
3098					'margin-left': - $justOutOfSight,
3099					'padding-left': $justOutOfSight,
3100					'padding-right': $justOutOfSight,
3101					'visibility': 'visible'
3102				});	
3103			}
3104			
3105			else {
3106				$(this).css({
3107					'margin-left': 0,
3108					'padding-left': 0,
3109					'padding-right': 0,
3110					'visibility': 'visible'
3111				});	
3112			}
3113			
3114		});
3115	
3116	
3117	    //full width content sections
3118	    $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow','visible');
3119	    
3120	    $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"], .full-width-content').each(function(){
3121			
3122			//single post fullwidth
3123			if($('#boxed').length == 1){
3124
3125				var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
3126
3127				if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('#post-area').length > 0) {
3128					$contentWidth = $('#post-area').width();
3129					$extResponsivePadding = 0;
3130					$windowWidth = $(window).width();
3131					$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
3132				} else {
3133					$justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4;
3134				}
3135			} else {
3136				if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('#post-area').length > 0) {
3137					$contentWidth = $('#post-area').width();
3138					$extResponsivePadding = 0;
3139					$windowWidth = $(window).width();
3140				} else {
3141
3142					var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').css('max-width')) : parseInt($(this).parents('.container').css('max-width'));
3143
3144					if($(window).width() <= $mainContentMaxWidth) { 
3145						$windowWidth = $mainContentMaxWidth;
3146						//no need for the scrollbar calcs with ext responsive on desktop views
3147						if($extResponsivePadding == 180) $windowWidth = $windowWidth - $scrollBar;
3148					}
3149					$contentWidth = $mainContentMaxWidth;
3150					$extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1000) ? 180 : 0;
3151				}
3152
3153				$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
3154			}
3155
3156			$extraSpace = ($(this).hasClass('carousel-wrap')) ? 1 : 4;
3157	    	$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width() +$extraSpace  + $scrollBar ;
3158	    	
3159	    	if($(this).parent().hasClass('default-style')) { 
3160
3161	    		var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
3162	    		
3163	    		if($('#boxed').length != 0) {
3164	    			$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width() + $extraSpace + $scrollBar ;
3165				}
3166				else {
3167					$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width()  - ($(window).width()*.025) + $extraSpace + $scrollBar ;
3168					$windowWidth = ($(window).width() <= $mainContentWidth) ? $mainContentWidth : $(window).width() - ($(window).width()*.025);
3169					$justOutOfSight = Math.ceil( (($windowWidth + $scrollBar - $mainContentWidth) / 2) )
3170				}
3171			}
3172
3173			else if($(this).parent().hasClass('spaced')) { 
3174
3175				var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
3176
3177				if($('#boxed').length != 0) {
3178	    			$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) - ($(window).width()*.02) : $(window).width() + $extraSpace + $scrollBar ;
3179				} else {
3180					$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width()  - Math.ceil($(window).width()*.02) + $extraSpace + $scrollBar ;
3181					var $windowWidth2 = ($(window).width() <= $mainContentWidth) ? $mainContentWidth : $(window).width() - ($(window).width()*.02);
3182					$justOutOfSight = Math.ceil( (($windowWidth2 + $scrollBar - $mainContentWidth) / 2) +2)
3183				}
3184			}
3185	    	
3186	    	if(!$(this).parents('.span_9').length > 0 && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner' && $(this).parent().attr('id') != 'portfolio-extra' 
3187	        && !$(this).find('.carousel-wrap[data-full-width="true"]').length > 0
3188	    	&& !$(this).find('.portfolio-items:not(".carousel")[data-col-num="elastic"]').length > 0){
3189
3190	    		//escape if inside woocoommerce page and not using applicable layout
3191	    		if($('.single-product').length > 0 && $(this).parents('#tab-description').length > 0 && $(this).parents('.full-width-tabs').length == 0) {
3192	    			$(this).css({
3193						'visibility': 'visible'
3194					});	
3195	    		} else {
3196	    			if($(this).hasClass('portfolio-items')) {
3197	    				$(this).css({
3198							'transform': 'translateX(-'+ $justOutOfSight + 'px)',
3199							'margin-left': 0,
3200							'width': $carouselWidth,
3201							'visibility': 'visible'
3202						});	
3203	    			} else {
3204	    				$(this).css({
3205							'margin-left': - $justOutOfSight,
3206							'width': $carouselWidth,
3207							'visibility': 'visible'
3208						});	
3209	    			}
3210					
3211				}
3212			}  else if($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) {
3213				$(this).css({
3214					'margin-left': - $justOutOfSight,
3215					'width': $carouselWidth,
3216					'visibility': 'visible'
3217				});	
3218			}
3219			
3220			else {
3221				$(this).css({
3222					'margin-left': 0,
3223					'visibility': 'visible'
3224				});	
3225			}
3226	    	
3227	    });
3228
3229	}
3230	
3231	var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length ;
3232
3233	function parallaxSrollSpeed(speedString) {
3234
3235		var ua = window.navigator.userAgent;	
3236		var msie = ua.indexOf("MSIE ");
3237		var speed;
3238
3239		 //not as modern browsers
3240		 if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true || navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
3241			 switch(speedString) {
3242			   	  case 'slow':
3243			   	      speed = 0.2;
3244			   	      break;
3245			   	  case 'medium': 
3246			   	  	  speed = 0.4;
3247			   	      break;
3248			   	  case 'fast': 
3249			    	  speed = 0.6;
3250			   	       break;
3251			   }
3252		}
3253		 //chrome/ff
3254		 else {
3255		 	 switch(speedString) {
3256			   	  case 'slow':
3257			   	      speed = 0.6;
3258			   	      break;
3259			   	  case 'medium': 
3260			   	  	  speed = 0.4;
3261			   	      break;
3262			   	  case 'fast': 
3263			    	  speed = 0.25;
3264			   	       break;
3265			   }
3266		}
3267
3268		   return speed;
3269	}
3270
3271	function parallaxScrollInit(){
3272		 parallaxRowsBGCals();
3273		$('.full-width-section.parallax_section, .full-width-content.parallax_section').each(function(){
3274		   var $id = $(this).attr('id');	
3275		  
3276		    var ua = window.navigator.userAgent;	
3277		    var msie = ua.indexOf("MSIE ");
3278
3279			if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true || navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)  {
3280		   		if($(this).find('[data-parallax-speed="fixed"]').length == 0) $('#'+$id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) );
3281		   	} else if($(this).find('[data-parallax-speed="fixed"]').length == 0) {
3282		   		$('#'+$id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) );
3283		   	}
3284		});
3285	}
3286
3287	
3288	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
3289		parallaxScrollInit();
3290		$(window).load(parallaxR
3290owsBGCals);
3291	}
3292
3293	function parallaxRowsBGCals(){
3294		$('.full-width-section.parallax_section, .full-width-content.parallax_section').each(function(){
3295
3296			 var ua = window.navigator.userAgent;
3297		     var msie = ua.indexOf("MSIE ");
3298
3299			 if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true || navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
3300			 	$(this).find('.row-bg').css({'height': $(this).outerHeight(true)*2.8, 'margin-top': '-' + ($(this).outerHeight(true)*2.8)/2 + 'px' });
3301			 } else {
3302			 	$(this).find('.row-bg').css({'height': Math.ceil( $(window).height() * parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) ) + $(this).outerHeight(true)   });
3303			 }
3304			 
3305		});
3306	}
3307	
3308	//if fullwidth section is first or last, remove the margins so it fits flush against header/footer
3309	function fwsClasses() {
3310		
3311		$('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function(){
3312			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
3313				if($(this).parents('.wpb_row').index() == '0'){
3314					$(this).addClass('first-nectar-slider');
3315				} 
3316			}
3317		});
3318
3319		if($('#portfolio-extra').length == 0) {
3320			$contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length;
3321		} else {
3322			$contentElementsNum = $('.main-content > .row #portfolio-extra > *').length;
3323		}
3324
3325		$('.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(){
3326			
3327			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
3328				
3329				if($(this).parents('.wpb_row').length > 0){ 
3330				
3331					if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
3332					
3333					////first
3334					if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length != 0 || $(this).parents('.wpb_row').index() == '0' && $('.parallax_slider_outer').length != 0){
3335						//$(this).css('margin-top','-2.1em').addClass('first-section nder-page-header');
3336					} 
3337					else if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length == 0 && $('.page-header-no-bg').length == 0 
3338					         && $('.project-title').length == 0 && $(this).parents('.wpb_row').index() == '0' 
3339					         && $('.parallax_slider_outer').length == 0 && $('.project-title').length == 0 
3340					         && $('body[data-bg-header="true"]').length == 0) {
3341
3342					     if($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0) {
3343					     	$('.container-wrap').css('padding-top','0px');
3344					     } else {
3345					     	$(this).css('margin-top','-70px').addClass('first-section');
3346					     } 	
3347						
3348					} 
3349					
3350					//check if it's also last (i.e. the only fws)
3351					if($(this).parents('.wpb_row').index() == $contentElementsNum-1 && $('#respond').length == 0 ) { 
3352						if($(this).attr('id') != 'portfolio-filters-inline') {
3353							$('.container-wrap').css('padding-bottom','0px');
3354							$('#call-to-action .triangle').remove();
3355						}
3356					} 
3357				
3358				} else {
3359					
3360					if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
3361					
3362					if( $(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area' ) {
3363						
3364						////first
3365						if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' && $('.parallax_slider_outer').length != 0){
3366							//$(this).css('margin-top','-2.1em').addClass('first-section nder-page-header');
3367			
3368						} 
3369						else if($(this).index() == '0' && $('#page-header-bg').length == 0 && $(this).index() == '0' && $('.page-header-no-bg').length == 0 && 
3370						        $(this).index() == '0' && $('.parallax_slider_outer').length == 0 && !$(this).hasClass('blog_next_prev_buttons') ) {
3371						     
3372						      if($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0) { 
3373						          $('.container-wrap').css('padding-top','0px');
3374						      } else {
3375						      	  $(this).css('margin-top','-70px').addClass('first-section');
3376						      }   	
3377							
3378						} 
3379						
3380						//check if it's also last (i.e. the only fws)
3381						if($(this).index() == $contentElementsNum-1 && $('#respond').length == 0 ) { 
3382							$('.container-wrap').css('padding-bottom','0px');
3383							$('.bottom_controls').css('margin-top','0px');
3384							$('#call-to-action .triangle').remove();
3385						} 
3386					}
3387					
3388				}
3389			}
3390		});
3391
3392
3393		//add first class for rows for page header trans effect (zoom only as of now)
3394		$('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function(){
3395			
3396			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
3397				
3398				
3399				if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
3400					
3401				if($(this).index() == '0' && $('#page-header-bg').length == 0 && $('.page-header-no-bg').length == 0 
3402				         && $('.project-title').length == 0 && $('body.single').length == 0 
3403				         && $('.parallax_slider_outer').length == 0 && $('.project-title').length == 0 ) {
3404
3405					$(this).addClass('first-section');
3406					var $that = $(this);
3407					setTimeout( function() { $that.addClass('loaded'); },50);
3408					
3409				} 
3410					
3411	
3412			}
3413		});	
3414
3415
3416		
3417		$('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function(){
3418			//check if it's last 
3419			if($(this).index() == $contentElementsNum-1 && $('#commentform').length == 0 && $('#pagination').length == 0) { 
3420				$(this).css('margin-bottom','-40px');
3421				$('#call-to-action .triangle').remove();
3422			}
3423		});
3424		
3425		
3426		
3427		$('.portfolio-filters').each(function(){
3428			////first
3429			if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' && $('.parallax_slider_outer').length != 0){
3430				$(this).css({'margin-top':'-2.1em'}).addClass('first-section nder-page-header');
3431			}  else if($(this).index() == '0' && $('#page-header-bg').length == 0 || $(this).index() == '0' && $('.parallax_slider_outer').length == 0){
3432				$(this).css({'margin-top':'0px'}).addClass('first-section');
3433			}
3434		});
3435		
3436		$('.portfolio-filters-inline').each(function(){
3437			////first
3438			if($(this).parents('.wpb_row').length > 0){ 
3439				
3440				if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length != 0 || $(this).parents('.wpb_row').index() == '0' && $('.parallax_slider_outer').length != 0){
3441					if($('body[data-header-resize="0"]').length == 0) $(this).css({'margin-top':'-2.1em', 'padding-top' : '19px'}).addClass('first-section nder-page-header');
3442				}  else if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length == 0 || $(this).parents('.wpb_row').index() == '0' && $('.parallax_slider_outer').length == 0){
3443					
3444					 if($('body[data-header-resize="0"]').length == 1) { 
3445				          // $(this).css({'margin-top':'-30px', 'padding-top' : '50px'}).addClass('first-section');
3446				      } else {
3447				      	  $(this).css({'margin-top':'-70px', 'padding-top' : '50px'}).addClass('first-section');
3448				      } 
3449
3450				}
3451				
3452			} else {
3453				if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' && $('.parallax_slider_outer').length != 0){
3454					$(this).css({'margin-top':'-2.1em', 'padding-top' : '19px'}).addClass('first-section nder-page-header');
3455				}  else if($(this).index() == '0' && $('#page-header-bg').length == 0 || $(this).index() == '0' && $('.parallax_slider_outer').length == 0){
3456					
3457					if($('body[data-header-resize="0"]').length == 1) { 
3458				          $(this).css({'margin-top':'-30px', 'padding-top' : '50px'}).addClass('first-section');
3459				      } else {
3460				      	  $(this).css({'margin-top':'-70px', 'padding-top' : '50px'}).addClass('first-section');
3461				      } 
3462
3463				
3464				}
3465			}
3466			
3467		});
3468		
3469		
3470		
3471		$('.parallax_slider_outer').each(function(){
3472			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
3473				
3474				if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
3475				////first
3476				if($(this).parent().index() == '0' && $('#page-header-bg').length != 0){
3477					$(this).addClass('first-section nder-page-header');
3478
3479				} 
3480				else if($(this).parent().index() == '0' && $('#page-header-bg').length == 0){
3481					$(this).css('margin-top','-40px').addClass('first-section');
3482					if(!$('body').hasClass('single-post')) $('.container-wrap').css('padding-top', '0px');
3483				} 
3484				
3485				//check if it's also last (i.e. the only fws)
3486				if($(this).parent().index() == $contentElementsNum-1 && $('#post-area').length == 0) {
3487					$('#call-to-action .triangle').remove();
3488					$('.container-wrap').hide();
3489				}
3490			}
3491		});
3492	}
3493	
3494	//if not using a fullwidth slider first, ajdust the top padding
3495	//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');
3496	//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');
3497	
3498	
3499	//set sizes
3500	fullWidthSections();
3501	fwsClasses();
3502	
3503	//sizing for fullwidth sections that are image only
3504
3505	function fullwidthImgOnlySizingInit(){
3506		////set inital sizes
3507		$('.full-width-section:not(.custom-skip)').each(function(){
3508			
3509			var $fwsHeight = $(this).outerHeight(true);
3510
3511			//make sure it's empty and also not being used as a small dvider
3512			if($(this).find('.span_12 *').length == 0 && $.trim( $(this).find('.span_12').text() ).length == 0  && $fwsHeight > 40){
3513				$(this).addClass('bg-only');
3514				$(this).css({'height': $fwsHeight, 'padding-top': '0px', 'padding-bottom': '0px'});
3515				$(this).attr('data-image-height',$fwsHeight);
3516			}
3517
3518		});
3519	}
3520
3521	function fullwidthImgOnlySizing(){
3522
3523		$('.full-width-section.bg-only').each(function(){
3524			var $initialHeight = $(this).attr('data-image-height');
3525			
3526			if( window.innerWidth < 1000 && window.innerWidth > 690 ) {
3527				$(this).css('height', $initialHeight - $initialHeight*.60);
3528			} 
3529			
3530			else if( window.innerWidth <= 690 ) {
3531				$(this).css('height', $initialHeight - $initialHeight*.78);
3532			} 
3533			
3534			else if( window.innerWidth < 1300 && window.innerWidth >= 1000  ) {
3535				$(this).css('height', $initialHeight - $initialHeight*.33);
3536			} 
3537			
3538			else {
3539				$(this).css('height', $initialHeight);
3540			}
3541			
3542		});
3543		
3544	}
3545
3546	fullwidthImgOnlySizingInit();
3547	fullwidthImgOnlySizing();
3548	
3549	
3550	
3551	//change % padding on rows to be relative to screen
3552	function fullWidthRowPaddingAdjustInit(){
3553		if($('#boxed').length == 0){
3554			$('.full-width-section, .full-width-content').each(function(){
3555				var $topPadding = $(this)[0].style.paddingTop;
3556				var $bottomPadding = $(this)[0].style.paddingBottom;
3557
3558				if($topPadding.indexOf("%") >= 0) $(this).attr('data-top-percent',$topPadding);
3559				if($bottomPadding.indexOf("%") >= 0) $(this).attr('data-bottom-percent',$bottomPadding);
3560				
3561
3562			});
3563		}
3564	}
3565
3566	function fullWidthRowPaddingAdjustCalc(){
3567		if($('#boxed').length == 0){
3568			$('.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(){
3569
3570				var $windowHeight = $(window).width();
3571				var $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip';
3572				var $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip';
3573
3574				//top
3575				if($topPadding != 'skip') {
3576					$(this).css('padding-top',$windowHeight*(parseInt($topPadding)/100));
3577				}
3578
3579				//bottom
3580				if($bottomPadding != 'skip'){
3581					$(this).css('padding-bottom',$windowHeight*(parseInt($bottomPadding)/100));
3582				}
3583				
3584
3585			});
3586		}
3587	}
3588	fullWidthRowPaddingAdjustInit();
3589	fullWidthRowPaddingAdjustCalc();
3590
3591	
3592	//full width content column sizing
3593	function fullWidthContentColumns(){
3594
3595		//standard carousel
3596   	  	$('.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(){
3597			
3598
3599			//only set the height if more than one column
3600			if($(this).find('> .span_12 > .col').length > 1){
3601				
3602				var tallestColumn = 0;
3603				var $columnInnerHeight = 0;
3604				
3605				$(this).find('> .span_12 > .col').each(function(){
3606
3607					$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
3608					
3609					var $padding = parseInt($(this).css('padding-top'));
3610					//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
3611					($(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height() + ($padding*2) > tallestColumn) ? tallestColumn = $(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height() + ($padding*2)  : tallestColumn = tallestColumn;
3612				});	
3613	    	 	
3614	    	 	$(this).find('> .span_12 > .col').each(function(){
3615
3616	    	 		$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
3617					
3618	    	 		//columns with content
3619		    	 	if($(this).find('> '+$column_inner_selector+' > .wpb_wrapper > *').length > 0){
3620		    	 		$(this).css('height',tallestColumn);
3621		    	 	} 
3622		    	 	//empty columns
3623		    	 	else {
3624		    	 		$(this).css('min-height',tallestColumn);
3625		    	 		if($(this).is('[data-animation*="reveal"]')) $(this).find('.column-inner').css('min-height',tallestColumn);
3626		    	 	}
3627	    	 	});
3628	         	
3629	         	//nested column height
3630	         	var $childRows = $(this).find('> .span_12 > .col .wpb_row').length;
3631	         	if(window.innerWidth > 1000) { 
3632	         		
3633	         		var $padding = parseInt($(this).find('> .span_12 > .col').css('padding-top'));
3634	         		
3635	         		//$(this).find('> .span_12 > .col .wpb_row .col').css('min-height',(tallestColumn-($padding*2))/$childRows + 'px'); 
3636	         	} else {
3637	         		$(this).find('> .span_12 > .col .wpb_row .col').css('min-height','0px'); 
3638	         	}
3639	         	
3640	         	
3641	         	//vertically center
3642	         	if($(this).hasClass('vertically-align-columns') && window.innerWidth > 1000 && !$(this).hasClass('vc_row-o-equal-height')){
3643	         		
3644	         		//parent columns
3645		         	$(this).find('> .span_12 > .col').each(function(){
3646
3647		         		$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
3648						
3649						$columnInnerHeight = $(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height();
3650						var $marginCalc = ($(this).height()/2)-($columnInnerHeight/2);
3651						if($marginCalc <= 0) $marginCalc = 0;
3652						
3653						$(this).find('> '+$column_inner_selector+' > .wpb_wrapper').css('margin-top',$marginCalc);
3654						$(this).find('> '+$column_inner_selector+' > .wpb_wrapper').css('margin-bottom',$marginCalc);
3655						
3656					});	
3657	
3658					
3659				}
3660			
3661			}
3662			
3663   	  	});
3664
3665		//requal height columns in container type with reveal columns
3666		$('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function(){
3667			if($(this).find('>.span_12>.wpb_column[data-animation*="reveal"]').length >0) {
3668				var tallestColumn = 0;
3669				var $columnInnerHeight = 0;
3670				
3671				$(this).find('> .span_12 > .col').each(function(){
3672					
3673					var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top'));
3674					($(this).find('> .column-inner-wrap > .column-inner').height() + ($padding*2) > tallestColumn) ? tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding*2)  : tallestColumn = tallestColumn;
3675				});	
3676	    	 	
3677	    	 	$(this).find('> .span_12 > .col').each(function(){
3678					
3679	    	 		//columns with content
3680		    	 	if($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0){
3681		    	 		$(this).find('> .column-inner-wrap').css('height',tallestColumn);
3682		    	 	} 
3683		    	 	//empty columns
3684		    	 	else {
3685		    	 		$(this).css('min-height',tallestColumn);
3686		    	 		if($(this).is('[data-animation*="reveal"]')) $(this).find('.column-inner').css('min-height',tallestColumn);
3687		    	 	}
3688	    	 	});
3689
3690			}	
3691		});
3692
3693		//using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug)
3694		$('.vc_row.vc_row-o-equal-height>.span_12>.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function(){
3695			$(this).css({ 'padding-top': $(this).css('padding-left'), 'padding-bottom': $(this).css('padding-left')});
3696		});
3697		
3698	}
3699	
3700	fullWidthContentColumns();
3701	if($('.owl-carousel').length > 0) owlCarouselInit();
3702
3703
3704var $mouseParallaxScenes = [];
3705function mouseParallaxInit(){
3706	$('.wpb_row:has(.nectar-parallax-scene)').each(function(i){
3707
3708		if($(this).hasClass('first-section')) { 
3709			$('body #header-outer[data-transparent-header="true"] .ns-loading-cover').show();
3710
3711			if($('body #header-outer[data-transparent-header="true"]').length > 0) { 
3712				$(this).css('overflow','hidden');
3713				$(this).find('.nectar-slider-loading').css({
3714					'top': $('#header-space').height(),
3715					'margin-top' : '-1px'
3716				});
3717				$(this).find('.nectar-slider-loading .loading-icon').css({
3718					'height' :  $('.first-section .nectar-parallax-scene').height() - $('#header-space').height() + 'px',
3719					'opacity' : '1'
3720				});
3721			}
3722		}
3723
3724		var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength'));
3725
3726		$mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({
3727			scalarX: $strength,
3728	  		scalarY: $strength
3729		});
3730
3731		//wait until the images in the scene have loaded
3732		var images = $(this).find('.nectar-parallax-scene li');
3733		
3734		$.each(images, function(){
3735			if($(this).find('div').length > 0) {
3736			    var el = $(this).find('div'),
3737			    image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, '');
3738			    if(image && image !== '' && image !== 'none')
3739			        images = images.add($('<img>').attr('src', image));
3740			}
3741		});
3742
3743		var $that = $(this);
3744		images.imagesLoaded(function(){
3745
3746			$that.find('> .nectar-slider-loading, .full-page-inner > .nectar-slider-loading').fadeOut(800,'easeInOutExpo');
3747			if($that.hasClass('first-section')) { 
3748				$('body #header-outer[data-transparent-header="true"] .ns-loading-cover').fadeOut(800,'easeInOutExpo',function(){
3749    				$(this).remove();
3750    			});
3751			}
3752		});
3753
3754	});
3755}
3756mouseParallaxInit();
3757
3758
3759	
3760/***************** Checkmarks ******************/
3761
3762function ulChecks() {
3763	$('ul.checks li').prepend('<i class="icon-ok-sign"></i>');
3764}
3765ulChecks();
3766
3767/***************** Image with Animation / Col Animation *******************/
3768
3769
3770	
3771function colAndImgAnimations(){
3772
3773	$colAndImgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '85%';
3774	$colAndImgOffsetPos2 = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '70%';
3775
3776	$($fullscreenSelector+'img.img-with-animation').each(function() {
3777		
3778		var $that = $(this);
3779		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
3780		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
3781
3782		var waypoint = new Waypoint({
3783 			element: $that,
3784 			 handler: function(direction) {
3785			   
3786					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
3787						 waypoint.destroy();
3788						return;
3789					}
3790
3791					if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
3792				
3793						if($that.attr('data-animation') == 'fade-in-from-left'){
3794							$that.delay($that.attr('data-delay')).transition({
3795								'opacity' : 1,
3796								'x' : '0px'
3797							},$animationDuration, $animationEasing);
3798						} else if($that.attr('data-animation') == 'fade-in-from-right'){
3799							$that.delay($that.attr('data-delay')).transition({
3800								'opacity' : 1,
3801								'x' : '0px'
3802							},$animationDuration, $animationEasing);
3803						} else if($that.attr('data-animation') == 'fade-in-from-bottom'){
3804							$that.delay($that.attr('data-delay')).transition({
3805								'opacity' : 1,
3806								'y' : '0px'
3807							},$animationDuration, $animationEasing);
3808						} else if($that.attr('data-animation') == 'fade-in') {
3809							$that.delay($that.attr('data-delay')).transition({
3810								'opacity' : 1
3811							},$animationDuration, $animationEasing);	
3812						} else if($that.attr('data-animation') == 'grow-in') {
3813							setTimeout(function(){ 
3814								$that.transition({ scale: 1, 'opacity':1 },$animationDuration,$animationEasing);
3815							},$that.attr('data-delay'));
3816						}
3817						else if($that.attr('data-animation') == 'flip-in') {
3818							setTimeout(function(){ 
3819								$that.transition({  rotateY: 0, 'opacity':1 },$animationDuration, $animationEasing);
3820							},$that.attr('data-delay'));
3821						}
3822
3823						$that.addClass('animated-in');
3824						
3825					}
3826
3827					waypoint.destroy();
3828
3829			  },
3830			  offset: $colAndImgOffsetPos
3831		});
3832
3833		
3834	
3835	});
3836
3837
3838	$($fullscreenSelector+'.nectar_cascading_images').each(function() {
3839		
3840		var $that = $(this);
3841		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
3842		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
3843
3844		var waypoint = new Waypoint({
3845 			element: $that,
3846 			 handler: function(direction) {
3847			   
3848					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
3849						 waypoint.destroy();
3850						return;
3851					}
3852
3853					if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
3854					
3855						$that.find('.cascading-image').each(function(i){
3856
3857							var $that2 = $(this);
3858
3859							if($that2.attr('data-animation') == 'flip-in') {
3860								setTimeout(function(){
3861									$that2.find('.inner-wrap').css({
3862										'opacity' : 1,
3863										'transform' : 'rotate(0deg) translateZ(0px)'
3864									});
3865								}, i*175);
3866							} else {
3867								setTimeout(function(){
3868									$that2.find('.inner-wrap').css({
3869										'opacity' : 1,
3870										'transform' : 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)'
3871									});
3872								}, i*175);
3873							}
3874					
3875
3876						});
3877
3878						$that.addClass('animated-in');
3879						
3880					}
3881
3882					waypoint.destroy();
3883
3884			  },
3885			  offset: $colAndImgOffsetPos
3886		});
3887
3888		
3889	
3890	});
3891	
3892
3893	
3894	$($fullscreenSelector+'.col.has-animation:not([data-animation*="reveal"]), '+$fullscreenSelector+'.wpb_column.has-animation:not([data-animation*="reveal"])').each(function() {
3895	    
3896		var $that = $(this);
3897		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
3898		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
3899
3900		var waypoint = new Waypoint({
3901 			element: $that,
3902 			 handler: function(direction) {
3903				
3904				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
3905					 waypoint.destroy();
3906					return;
3907				}
3908
3909				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
3910				 	
3911					if($that.attr('data-animation') == 'fade-in-from-left'){
3912						$that.delay($that.attr('data-delay')).transition({
3913							'opacity' : 1,
3914							'x' : '0px'
3915						},$animationDuration,$animationEasing);
3916					} else if($that.attr('data-animation') == 'fade-in-from-right'){
3917						$that.delay($that.attr('data-delay')).transition({
3918							'opacity' : 1,
3919							'x' : '0px'
3920						},$animationDuration,$animationEasing);
3921					} else if($that.attr('data-animation') == 'fade-in-from-bottom'){
3922						$that.delay($that.attr('data-delay')).transition({
3923							'opacity' : 1,
3924							'y' : '0px'
3925						},$animationDuration,$animationEasing);
3926					} else if($that.attr('data-animation') == 'fade-in') {
3927						$that.delay($that.attr('data-delay')).transition({
3928							'opacity' : 1
3929						},$animationDuration,$animationEasing);	
3930					} else if($that.attr('data-animation') == 'grow-in') {
3931						setTimeout(function(){ 
3932							$that.transition({ scale: 1, 'opacity':1 },$animationDuration,$animationEasing);
3933						},$that.attr('data-delay'));
3934					} else if($that.attr('data-animation') == 'flip-in') {
3935						setTimeout(function(){ 
3936							$that.transition({  rotateY: 0, 'opacity':1 },$animationDuration, $animationEasing);
3937						},$that.attr('data-delay'));
3938					}
3939
3940					//boxed column hover fix
3941					if($that.hasClass('boxed')) {
3942						$that.addClass('no-pointer-events');
3943						setTimeout(function(){
3944							$that.removeClass('no-pointer-events');
3945						},parseInt($animationDuration) + parseInt($that.attr('data-delay')) + 30 );
3946					}
3947
3948					$that.addClass('animated-in');
3949				
3950				}
3951
3952				waypoint.destroy();
3953			},
3954			offset: $colAndImgOffsetPos
3955		});
3956	
3957	});
3958
3959	
3960	$($fullscreenSelector+'.wpb_column.has-animation[data-animation*="reveal"]').each(function() {
3961	    
3962		var $that = $(this);
3963		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
3964		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
3965
3966		var waypoint = new Waypoint({
3967 			element: $that,
3968 			 handler: function(direction) {
3969				
3970				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
3971					 waypoint.destroy();
3972					return;
3973				}
3974
3975				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
3976					
3977					if($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') {
3978						setTimeout(function(){ 
3979							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'); });
3980						},$that.attr('data-delay'));
3981					} else if($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') {
3982						setTimeout(function(){ 
3983							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'); });
3984						},$that.attr('data-delay'));
3985					} 
3986
3987					$that.addClass('animated-in');
3988				
3989				}
3990
3991				waypoint.destroy();
3992			},
3993			offset: $colAndImgOffsetPos2
3994		});
3995	
3996	}); 	
3997
3998	
3999}
4000
4001setTimeout(function(){ 
4002	//if($('.nectar-box-roll').length == 0) colAndImgAnimations();
4003},$animationOnScrollTimeOut); 	
4004
4005
4006function cascadingImageBGSizing() {
4007	$('.nectar_cascading_images').each(function(){
4008
4009		//handle max width for cascading images in equal height columns
4010		if($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) 
4011			$(this).css('max-width',$(this).parents('.wpb_column').width());
4012
4013		//set size for layers with no images
4014		$(this).find('.bg-color').each(function(){
4015			var $bgColorHeight = 0;
4016			var $bgColorWidth = 0;
4017			if($(this).parent().find('.img-wrap').length == 0) {
4018				$firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first();
4019
4020				$firstSibling.css({'position':'relative', 'visiblity':'hidden'});
4021				$bgColorHeight = $firstSibling.find('.img-wrap').height();
4022				$bgColorWidth = $firstSibling.find('.img-wrap').width();
4023				if($firstSibling.index() == 0) {
4024					$firstSibling.css({'visiblity':'visible'});
4025				} else {
4026					$firstSibling.css({'position':'absolute', 'visiblity':'visible'});
4027				}
4028			} else {
4029				$bgColorHeight = $(this).parent().find('.img-wrap').height();
4030				$bgColorWidth = $(this).parent().find('.img-wrap').width();
4031			}
4032
4033			$(this).css({'height': $bgColorHeight,'width': $bgColorWidth});
4034		});
4035	});
4036}
4037imagesLoaded($('.nectar_cascading_images'),function(instance){
4038	cascadingImageBGSizing();
4039});
4040
4041function splitLineHeadings() {
4042
4043	$splitLineOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
4044	$($fullscreenSelector+'.nectar-split-heading').each(function() {
4045
4046		var $that = $(this);
4047		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
4048		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
4049
4050		var waypoint = new Waypoint({
4051				element: $that,
4052				 handler: function(direction) {
4053				
4054				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
4055					 waypoint.destroy();
4056					return;
4057				}
4058
4059				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
4060				 	
4061					
4062					$that.find('.heading-line').each(function(i){
4063						//if($that.parents('.first-section').length > 0 && $('body[data-aie="zoom-out"]').length > 0) i = i+4;
4064						$(this).find('> span').delay(i*70).transition({
4065							'y' : '0px'
4066						},$animationDuration,$animationEasing);
4067
4068					});
4069					
4070
4071					$that.addClass('animated-in');
4072				
4073				}
4074
4075				waypoint.destroy();
4076			},
4077			offset: $splitLineOffsetPos
4078		});
4079
4080	});
4081}
4082
4083	
4084/***************** 4 Col Grid in iPad ******************/
4085	
4086	//add one-fourth class
4087	function oneFourthClasses() {
4088		$('.col.span_3, .vc_span3, .vc_col-sm-3').each(function(){
4089			var $currentDiv = $(this);
4090			var $nextDiv = $(this).next('div');
4091			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') ) {
4092				$currentDiv.addClass('one-fourths clear-both');
4093				$nextDiv.addClass('one-fourths right-edge');
4094			}
4095		});
4096		
4097		/*$('.vc_span4').each(function(){
4098			if($(this).find('.team-member').length > 0 && $(this).parents('.full-width-content').length > 0) {
4099				var $currentDiv = $(this);
4100				var $nextDiv = $(this).next('div');
4101				if( !$currentDiv.hasClass('one-fourths')) {
4102					$currentDiv.addClass('one-fourths clear-both');
4103					$nextDiv.addClass('one-fourths right-edge');
4104				}
4105			}
4106		});*/
4107		
4108		//make empty second 1/2 half columsn display right on iPad
4109		$('.span_12 .col.span_6').each(function(){
4110			if($(this).next('div').hasClass('span_6') && $.trim( $(this).next('div').html() ).length == 0 ) {
4111				$(this).addClass('empty-second')
4112			}
4113		}); 
4114	}
4115	oneFourthClasses();
4116	
4117/***************** Bar Graph ******************/
4118function progressBars(){
4119	$progressBarsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
4120	$($fullscreenSelector+'.nectar-progress-bar').parent().each(function(i){
4121
4122		var $that = $(this);
4123		var waypoint = new Waypoint({
4124 			element: $that,
4125 			 handler: function(direction) {
4126			   
4127					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4128						 waypoint.destroy();
4129						return;
4130					}
4131
4132					if($progressBarsOffsetPos == '100%') $that.find('.nectar-progress-bar .bar-wrap').css('opacity','1');
4133
4134					$that.find('.nectar-progress-bar').each(function(i){
4135
4136
4137						var percent = $(this).find('span').attr('data-width');
4138						var $endNum = parseInt($(this).find('span strong i').text());
4139						var $that = $(this);
4140						
4141						$that.find('span').delay(i*90).transition({
4142							'width' : percent + '%'
4143						},1050, 'easeInOutQuint',function(){
4144						});
4145						
4146	
4147					
4148						setTimeout(function(){
4149							$that.find('span strong i').countTo({
4150								from: 0,
4151								to: $endNum,
4152								speed: 850,
4153								refreshInterval: 30,
4154								onComplete: function(){
4155						
4156								}
4157							});	
4158
4159							$that.find('span strong').transition({
4160								'opacity' : 1
4161							},550, 'easeInCirc');
4162						}, (i*90) );
4163					
4164						////100% progress bar 
4165						if(percent == '100'){
4166							$that.find('span strong').addClass('full');
4167						}
4168					});
4169
4170					$that.addClass('completed');
4171
4172					waypoint.destroy();
4173
4174			  },
4175			  offset: $progressBarsOffsetPos
4176		});
4177
4178	});
4179}
4180
4181//if($('.nectar-box-roll').length == 0) progressBars();
4182	
4183
4184
4185
4186/***************** Dividers ******************/
4187function dividers() {
4188	$dividerOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
4189
4190	$($fullscreenSelector+'.divider-small-border[data-animate="yes"], '+$fullscreenSelector+'.divider-border[data-animate="yes"]').each(function(i){
4191
4192		var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500;
4193		var $that = $(this);
4194		var waypoint = new Waypoint({
4195 			element: $that,
4196 			 handler: function(direction) {
4197			   
4198					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4199						 waypoint.destroy();
4200						return;
4201					}
4202				
4203					$that.each(function(i){
4204
4205						$(this).css({'transform':'scale(0,1)', 'visibility': 'visible'});
4206						var $that = $(this);
4207						
4208						$that.delay($that.attr('data-animation-delay')).transition({
4209							'transform' : 'scale(1, 1)'
4210						},$lineDur, 'cubic-bezier(.18,1,.22,1)');
4211						
4212					});
4213
4214					$that.addClass('completed');
4215
4216					waypoint.destroy();
4217
4218			  },
4219			  offset: $dividerOffsetPos
4220		});
4221
4222	});
4223}
4224
4225//if($('.nectar-box-roll').length == 0) dividers();
4226
4227
4228/***************** Icon List ******************/
4229function iconList() {
4230	$iconListOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
4231
4232	$($fullscreenSelector+'.nectar-icon-list[data-animate="true"]').each(function(i){
4233
4234		var $that = $(this);
4235		var waypoint = new Waypoint({
4236 			element: $that,
4237 			 handler: function(direction) {
4238			   
4239					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4240						 waypoint.destroy();
4241						return;
4242					}
4243				
4244					$that.each(function(i){
4245
4246						$(this).find('.nectar-icon-list-item').each(function(i){
4247							var $thatt = $(this);
4248							setTimeout(function(){ $thatt.addClass('animated') },i*300);
4249						});
4250						
4251					});
4252
4253					$that.addClass('completed');
4254
4255					waypoint.destroy();
4256
4257			  },
4258			  offset: $iconListOffsetPos
4259		});
4260
4261	});
4262}
4263$('.nectar-icon-list[data-icon-style="border"]').each(function(){
4264	if($(this).parents('.wpb_row').length > 0 && $(this).parents('.wpb_row').find('.row-bg.using-bg-color').length > 0) {
4265		var $bgColorToSet = $(this).parents('.wpb_row').find('.row-bg.using-bg-color').css('background-color');
4266	}
4267	else {
4268		if($('#nectar_fullscreen_rows').length > 0)
4269			var $bgColorToSet = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color');
4270		else 
4271			var $bgColorToSet = $('.container-wrap').css('background-color');
4272	}
4273	$(this).find('.list-icon-holder').css('background-color',$bgColorToSet);
4274});
4275
4276
4277
4278/***************** Hotspot ******************/
4279//add pulse animation
4280$('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function(){
4281	$(this).find('.nectar_hotspot_wrap').each(function(i){
4282		var $that = $(this);
4283		setTimeout(function(){
4284			$that.find('.nectar_hotspot').addClass('pulse');
4285		},i*300);	
4286	});
4287});
4288
4289
4290
4291function hotSpotHoverBind() {
4292
4293	var hotSpotHoverTimeout = [];
4294
4295	$('.nectar_hotspot').each(function(i){
4296		
4297		hotSpotHoverTimeout[i] = '';
4298
4299		$(this).on('mouseover', function(){
4300			clearTimeout(hotSpotHoverTimeout[i]);
4301			$(this).parent().css({'z-index':'10', 'height':'auto','width':'auto'});
4302		});
4303
4304		$(this).on('mouseleave', function(){
4305
4306			var $that = $(this);
4307			$that.parent().css({'z-index':'auto'});
4308
4309			hotSpotHoverTimeout[i] = setTimeout(function(){
4310				$that.parent().css({'height':'30px','width':'30px'});
4311			},300);
4312
4313		});
4314
4315	});
4316
4317}
4318
4319hotSpotHoverBind();
4320
4321function responsiveTooltips() {
4322	$('.nectar_image_with_hotspots').each(function(){
4323		$(this).find('.nectar_hotspot_wrap').each(function(i){
4324			
4325			if($(window).width() > 690) {
4326
4327				//remove click if applicable
4328				if($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) {
4329					$(this).find('.nectar_hotspot').removeClass('click');
4330					$(this).find('.nttip').removeClass('open');
4331				}
4332				$(this).find('.nttip .inner a.tipclose').remove();
4333				$('.nttip').css('height','auto');
4334
4335				//reset for positioning
4336				$(this).css({'width': 'auto','height': 'auto'});
4337				$(this).find('.nttip').removeClass('force-right').removeClass('force-left').removeClass('force-top').css('width','auto');
4338
4339				var $tipOffset = $(this).find('.nttip').offset();
4340
4341				//against right side fix
4342				if($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200)
4343					$(this).find('.nttip').css('width','250px');
4344				else 
4345					$(this).find('.nttip').css('width','auto');
4346
4347				//responsive
4348				if($tipOffset.left < 0)
4349					$(this).find('.nttip').addClass('force-right');
4350				else if($tipOffset.left + $(this).find('.nttip').outerWidth(true) > $(window).width())
4351					$(this).find('.nttip').addClass('force-left').css('width','250px');
4352				else if($tipOffset.top + $(this).find('.nttip').height() + 35 > $(window).height())
4353					$(this).find('.nttip').addClass('force-top');
4354
4355				$(this).css({'width': '30px','height': '30px'});
4356
4357			} else {
4358				//fixed position
4359				$(this).find('.nttip').removeClass('force-left').removeClass('force-right').removeClass('force-top');
4360				$(this).find('.nectar_hotspot').addClass('click');
4361			
4362				if($(this).find('.nttip a.tipclose').length == 0)
4363					$(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span></span></a>');
4364
4365				//change height of fixed
4366				$('.nttip').css('height',$(window).height());
4367			}
4368		});
4369	});
4370
4371
4372}
4373responsiveTooltips();
4374
4375function imageWithHotspotClickEvents() {
4376	//click
4377	$('body').on('click','.nectar_hotspot.click',function(){
4378		$(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
4379		$(this).parent().find('.nttip').addClass('open');
4380
4381		$(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open');
4382		$(this).parent().find('.nectar_hotspot').addClass('open');
4383
4384		if($(window).width() <= 690) $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index','200');
4385
4386		return false;
4387	});
4388
4389	$('body').on('click','.nectar_hotspot.open',function(){
4390		$(this).parent().find('.nttip').removeClass('open');
4391		$(this).parent().find('.nectar_hotspot').removeClass('open');
4392
4393		$(this).parents('.wpb_row').css('z-index','auto');
4394		return false;
4395	});
4396
4397	$('body').on('click','.nttip.open',function(){
4398		$(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
4399
4400		$(this).parents('.wpb_row').css('z-index','auto');
4401		return false;
4402	});
4403}
4404imageWithHotspotClickEvents();
4405
4406function imageWithHotspots() {
4407
4408	$imageWithHotspotsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : '50%';
4409
4410	$($fullscreenSelector+'.nectar_image_with_hotspots[data-animation="true"]').each(function(i){
4411
4412		var $that = $(this);
4413		var waypoint = new Waypoint({
4414 			element: $that,
4415 			 handler: function(direction) {
4416			   
4417					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4418						 waypoint.destroy();
4419						return;
4420					}
4421
4422					$that.addClass('completed');
4423					$that.find('.nectar_hotspot_wrap').each(function(i){
4424						var $that2 = $(this);
4425						var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0;
4426						setTimeout(function(){
4427							$that2.addClass('animated-in');
4428						},175*(i+$extrai));
4429					});
4430
4431					waypoint.destroy();
4432
4433			  },
4434			  offset: $imageWithHotspotsOffsetPos
4435		});
4436
4437	});
4438}
4439
4440
4441/***************** Animated Title ******************/
4442function animated_titles() {
4443	$animatedTitlesOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
4444
4445	$($fullscreenSelector+'.nectar-animated-title').each(function(i){
4446
4447		var $that = $(this);
4448		var waypoint = new Waypoint({
4449 			element: $that,
4450 			 handler: function(direction) {
4451			   
4452					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4453						 waypoint.destroy();
4454						return;
4455					}
4456
4457					$that.addClass('completed');
4458
4459					waypoint.destroy();
4460
4461			  },
4462			  offset: $animatedTitlesOffsetPos
4463		});
4464
4465	});
4466}
4467
4468//if($('.nectar-box-roll').length == 0) animated_titles();
4469
4470
4471/***************** Pricing Tables ******************/
4472
4473
4474var $tallestCol;
4475
4476function pricingTableHeight(){
4477	$('.pricing-table[data-style="default"]').each(function(){
4478		$tallestCol = 0;
4479		
4480		$(this).find('> div ul').each(function(){
4481			($(this).height() > $tallestCol) ? $tallestCol = $(this).height() : $tallestCol = $tallestCol;
4482		});	
4483		
4484		//safety net incase pricing tables height couldn't be determined
4485		if($tallestCol == 0) $tallestCol = 'auto';
4486		
4487		//set even height
4488		$(this).find('> div ul').css('height',$tallestCol);
4489
4490	});
4491}
4492
4493pricingTableHeight();
4494
4495 
4496/***************** Testimonial Slider ******************/
4497
4498//testimonial slider controls
4499$('body').on('click','.testimonial_slider:not([data-style="multiple_visible"]) .controls li', function(){
4500	
4501	if($(this).find('span').hasClass('active')) return false;
4502	
4503	var $index = $(this).index();
4504	var currentHeight = $(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).height();
4505	
4506	$(this).parents('.testimonial_slider').find('li span').removeClass('active');
4507	$(this).find('span').addClass('active');
4508	
4509	$(this).parents('.testimonial_slider').find('.slides blockquote').stop().css({'opacity':'0', 'left':'-25px', 'z-index': '1'});
4510	$(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).stop(true,true).animate({'opacity':'1','left':'0'},550,'easeOutCubic').css('z-index','20');
4511	$(this).parents('.testimonial_slider:not(.disable-height-animation)').find('.slides').stop(true,true).animate({'height' : currentHeight + 40 + 'px' },450,'easeOutCubic');
4512	
4513	resizeVideoToCover();
4514});
4515
4516
4517var $tallestQuote;
4518
4519//create controls
4520function createTestimonialControls() {
4521
4522	//fadeIn
4523	$('.testimonial_slider:not([data-style="multiple_visible"])').animate({'opacity':'1'},800);
4524
4525	$('.testimonial_slider:not([data-style="multiple_visible"])').each(function(){
4526		
4527		if($(this).find('blockquote').length > 1 && $(this).find('.controls').length == 0) {
4528			$(this).append('<div class="controls"><ul></ul></div>');
4529			
4530			var slideNum = $(this).find('blockquote').length;
4531			var $that = $(this);
4532			
4533			for(var i=0;i<slideNum;i++) {
4534				$that.find('.controls ul').append('<li><span class="pagination-switch"></span></li>')
4535			}
4536			
4537			//activate first slide
4538			$(this).find('.controls ul li').first().click();
4539			
4540			//autorotate
4541			if($(this).attr('data-autorotate').length > 0) {
4542				slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
4543				var $that = $(this);
4544				var $rotate = setInterval(function(){ testimonialRotate($that) },slide_interval);
4545			}
4546			
4547			$(this).find('.controls li').click(function(e){
4548				if(typeof e.clientX != 'undefined') clearInterval($rotate);
4549			});
4550			
4551			////swipe for testimonials
4552			$(this).swipe({
4553			
4554				swipeLeft : function(e) {
4555					$(this).find('.controls ul li span.active').parent().next('li').find('span').trigger('click');
4556					e.stopImmediatePropagation();
4557					clearInterval($rotate);
4558					return false;
4559				 },
4560				 swipeRight : function(e) {
4561					$(this).find('.controls ul li span.active').parent().prev('li').find('span').trigger('click');
4562					e.stopImmediatePropagation();
4563					clearInterval($rotate);
4564					return false;
4565				 }    
4566			});
4567		} 
4568		//only one testimonial
4569		else if($(this).find('.controls').length == 0) {
4570			var currentHeight = $(this).find('.slides blockquote').height();
4571			$(this).find('.slides blockquote').stop().css({'opacity':'0', 'left':'-25px', 'z-index': '1'});
4572			$(this).find('.slides blockquote').stop(true,true).transition({'opacity':'1','left':'0'},550,'easeOutCubic').css('z-index','20');
4573			$(this).find('.slides').stop(true,true).animate({'height' : currentHeight + 20 + 'px' },450,'easeOutCubic');
4574		}
4575	});
4576
4577
4578
4579		
4580	$('.testimonial_slider[data-style="multiple_visible"] .slides').each(function(){
4581	    	var $that = $(this); 
4582	    	var $element = $that;
4583	    	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;
4584			if($that.find('img').length == 0) $element = $('body');
4585
4586			//move img pos
4587			$(this).find('blockquote').each(function(){
4588				$(this).find('.image-icon').insertAfter($(this).find('p'));
4589			});
4590			
4591
4592			imagesLoaded($element,function(instance){
4593
4594		    	$that.flickity({
4595		    		  contain: true,
4596					  draggable: true,
4597					  lazyLoad: false,
4598					  imagesLoaded: true,
4599					  percentPosition: true,
4600					  prevNextButtons: false,
4601					  pageDots: true,
4602					  resize: true,
4603					  setGallerySize: true,
4604					  wrapAround: true,
4605					  autoPlay: $autoplay,
4606					  accessibility: false
4607		    	});
4608
4609			    $that.parents('.testimonial_slider').css('opacity','1');
4610			    
4611
4612		     });//images loaded
4613		     	     
4614	    });//each	
4615
4616
4617}
4618createTestimonialControls();
4619
4620function testimonialRotate(slider){
4621	
4622	var $testimonialLength = slider.find('li').length;
4623	var $currentTestimonial = slider.find('.pagination-switch.active').parent().index();
4624	
4625	//stop the rotation when toggles are closed
4626	if( slider.parents('.toggle').length > 0 && slider.parents('.toggle').hasClass('open') ) {
4627
4628		if( $currentTestimonial+1 == $testimonialLength) {
4629			slider.find('ul li:first-child').click();
4630		} else {
4631			slider.find('.pagination-switch.active').parent().next('li').click();
4632		}
4633		
4634	} else {
4635		
4636		if( $currentTestimonial+1 == $testimonialLength) {
4637			slider.find('ul li:first-child').click();
4638		} else {
4639			slider.find('.pagination-switch.active').parent().next('li').click();
4640		}
4641	
4642	}
4643
4644}
4645
4646function testimonialHeightResize(){
4647	$('.testimonial_slider:not(.disable-height-animation):not([data-style="multiple_visible"])').each(function(){
4648		
4649		var $index = $(this).find('.controls ul li span.active').parent().index();
4650		var currentHeight = $(this).find('.slides blockquote').eq($index).height();
4651		$(this).find('.slides').stop(true,true).css({'height' : currentHeight + 40 + 'px' });
4652		
4653	});
4654}
4655
4656
4657function testimonialSliderHeight() {
4658		
4659	$('.testimonial_slider.disable-height-animation:not([data-style="multiple_visible"])').each(function(){
4660		$tallestQuote = 0;
4661			
4662		$(this).find('blockquote').each(function(){
4663			($(this).height() > $tallestQuote) ? $tallestQuote = $(this).height() : $tallestQuote = $tallestQuote;
4664		});	
4665		
4666		//safety net incase height couldn't be determined
4667		if($tallestQuote == 0) $tallestQuote = 100;
4668		
4669		//set even height
4670		$(this).find('.slides').css('height',$tallestQuote+40+'px');
4671		
4672		//show the slider once height is set
4673		$(this).animate({'opacity':'1'});
4674
4675		fullWidthContentColumns();
4676
4677	});
4678
4679}
4680
4681testimonialSliderHeight(); 
4682
4683
4684
4685/***************** WP Media Embed / External Embed ******************/
4686
4687//this isn't the for the video shortcode* This is to help any external iframe embed fit & resize correctly 
4688function responsiveVideoIframesInit(){
4689	$('iframe').each(function(){
4690		
4691		//make sure the iframe has a src (things like adsense don't)
4692		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){
4693			
4694			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) {
4695				$(this).wrap('<div class="iframe-embed"/>');	
4696				
4697				$(this).attr('data-aspectRatio', this.height / this.width).removeAttr('height').removeAttr('width');
4698	
4699				//add wmode=transparent to all youytube embeds to fix z-index issues in IE
4700				if($(this).attr('src').indexOf('wmode=transparent') == -1) {
4701					if($(this).attr('src').indexOf('?') == -1){
4702						$(this).attr('src',$(this).attr('src') + '?wmode=transparent');
4703					} else {
4704						$(this).attr('src',$(this).attr('src') + '&wmode=transparent');
4705					}
4706				}
4707			}
4708			 
4709		} else {
4710			//if($(this).parents('ins').length == 0){ 
4711			//	$(this).wrap('<div class="iframe-embed-standard"/>');	
4712			//}
4713		}
4714		
4715	});
4716
4717
4718}
4719
4720function responsiveVideoIframes(){
4721	 $('iframe[data-aspectRatio]').each(function() {
4722	 	var newWidth = $(this).parent().width();
4723	 	 
4724		var $el = $(this);
4725		
4726		//in nectar slider
4727		if($(this).parents('.swiper-slide').length > 0) {
4728			if($(this).is(':visible')) $el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
4729		} 
4730		//all others
4731		else {
4732			$el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
4733		}
4734		
4735		
4736	});
4737}
4738
4739
4740function videoshortcodeSize(){
4741	$('.wp-video').each(function(){
4742
4743		$(this).attr('data-aspectRatio', parseInt($(this).find('.mejs-overlay').height()) / parseInt($(this).find('.wp-video-shortcode').css('width')));
4744
4745		var newWidth = $(this).width();
4746	 	 
4747		var $el = $(this).find('.wp-video-shortcode');
4748		$(this).width(newWidth).height(newWidth * $(this).attr('data-aspectRatio'));
4749	});
4750}
4751
4752responsiveVideoIframesInit();
4753responsiveVideoIframes();
4754videoshortcodeSize();
4755
4756//unwrap post and protfolio videos
4757$('.video-wrap iframe').unwrap();
4758$('#sidebar iframe[src]').unwrap();
4759
4760$('video:not(.slider-video)').attr('width','100%');
4761$('video:not(.slider-video)').attr('height','100%'); 
4762
4763$('audio').attr('width','100%');
4764$('audio').attr('height','100%');
4765
4766$('audio').css('visibility','visible');
4767
4768if($('body').hasClass('mobile')){
4769	$('video').css('visibility','hidden');
4770} else {
4771	$('video').css('visibility','visible');
4772}
4773
4774
4775$(window).load(function(){
4776	$('video').css('visibility','visible');
4777	showLateIframes();
4778	videoshortcodeSize();
4779});
4780
4781$('.wp-video').each(function(){
4782	 video = $(this).find('video').get(0);
4783	 video.addEventListener('loadeddata', function() {
4784	   videoshortcodeSize();
4785	   $(window).trigger('resize');
4786	 }, false);
4787});
4788
4789//webkit video back button fix 
4790$('.main-content iframe[src]').each(function(){
4791	$(this).attr('src',$(this).attr('src'));
4792	$(this).css({'opacity':'1', 'visibility':'visible'});
4793});
4794
4795showLateIframes();
4796
4797function showLateIframes(){
4798	$('iframe[src]').css('opacity','1');
4799	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 100);
4800	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 500);
4801	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 1000);
4802	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 1500);
4803	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 2500);
4804}
4805
4806
4807/***************** Nectar Video BG ******************/
4808
4809
4810	
4811	$('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function(i){
4812		$(this).css('z-index',100 + i);
4813	});
4814
4815	var min_w = 1200; // minimum video width allowed
4816	var vid_w_orig;  // original video dimensions
4817	var vid_h_orig;
4818	
4819    vid_w_orig = 1280;
4820    vid_h_orig = 720;
4821 
4822	function resizeVideoToCover() {
4823		$('.nectar-video-wrap').each(function(i){
4824			
4825			if($(this).parents('#page-header-bg').length > 0) {
4826				if($('.container-wrap.auto-height').length > 0) return false;
4827				var $containerHeight = $(this).parents('#page-header-bg').outerHeight();			
4828				var $containerWidth = $(this).parents('#page-header-bg').outerWidth();
4829			} else {
4830				var $containerHeight = $(this).parents('.wpb_row').outerHeight();			
4831				var $containerWidth = $(this).parents('.wpb_row').outerWidth();
4832			}
4833			
4834		    // set the video viewport to the window size
4835		    $(this).width($containerWidth);
4836		    $(this).height($containerHeight);
4837		
4838		    // use largest scale factor of horizontal/vertical
4839		    var scale_h = $containerWidth / vid_w_orig;
4840		    var scale_v = ($containerHeight - $containerHeight) / vid_h_orig; 
4841		    var scale = scale_h > scale_v ? scale_h : scale_v;
4842			
4843			//update minium width to never allow excess space
4844		    min_w = 1280/720 * ($containerHeight+40);
4845		    
4846		    // don't allow scaled width < minimum video width
4847		    if (scale * vid_w_orig < min_w) {scale = min_w / vid_w_orig;}
4848		        
4849		    // now scale the video
4850		    $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig +0));
4851		    $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig +0));
4852		    
4853		    // and center it by scrolling the video viewport
4854		    $(this).scrollLeft(($(this).find('video').width() - $containerWidth) / 2);
4855		    $(this).scrollTop(($(this).find('video').height() - ($containerHeight)) / 2);
4856		    $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($containerHeight)) / 2);
4857
4858
4859		    //align bottom
4860		    if($(this).attr('data-bg-alignment') == 'center bottom' || $(this).attr('data-bg-alignment') == 'bottom'){
4861		    	$(this).scrollTop(($(this).find('video').height() - ($containerHeight+6)));
4862		    }
4863		    //align top
4864		    else if($(this).attr('data-bg-alignment') == 'center top' || $(this).attr('data-bg-alignment') == 'top') {
4865		    	$(this).scrollTop(0);
4866		    } 
4867
4868		});
4869	}
4870    
4871    //init
4872    function videoBGInit(){
4873	    setTimeout(function(){
4874	    	resizeVideoToCover();
4875	    	$('.video-color-overlay').each(function(){
4876	    		$(this).css('background-color',$(this).attr('data-color'));
4877	    	});
4878	    	$('.nectar-video-wrap').each(function(i){
4879	    		var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false;
4880	    		var $that = $(this);
4881
4882	    		 var videoReady = setInterval(function(){
4883
4884        			if($that.find('video').get(0).readyState > 3) {
4885
4886        				$that.transition({'opacity':'1'},400);
4887		    			$that.find('video').transition({'opacity':'1'},400);
4888		    			$that.parent().find('.video-color-overlay').transition({'opacity':'0.7'},400);
4889
4890		    			if($headerVideo == true) {
4891			    			pageHeaderTextEffect();
4892						}
4893
4894						//remove page loading screen
4895						$('#ajax-loading-screen').addClass('loaded');
4896						setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
4897				
4898
4899						clearInterval(videoReady);
4900					}
4901	    		},60);
4902	    		
4903	    	});
4904	    },300);
4905
4906		if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)){
4907			$('.wpb_row .mobile-video-image, #page-header-wrap .mobile-video-image, .fullscreen-header .mobile-video-image').show();
4908			$('.nectar-video-wrap').remove();
4909		}
4910
4911		
4912		 if(navigator.userAgent.indexOf('Chrome') > 0 && !/Edge\/12./i.test(navigator.userAgent) && !/Edge\/13./i.test(navigator.userAgent)) { 
4913		 	$('.nectar-video-wrap').each(function(i){
4914		 		if(jQuery(this).find('video source[type="video/webm"]').length > 0 ) {
4915				  	var webmSource = jQuery(this).find('video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
4916		          	var firstVideo = jQuery(this).find('video').get(0);
4917		          	firstVideo.src = webmSource;
4918		          	firstVideo.load();
4919		         }
4920            });
4921	    }
4922	}
4923	videoBGInit();
4924
4925
4926/*-------------------------------------------------------------------------*/
4927/*	4.	Header + Search
4928/*-------------------------------------------------------------------------*/	 
4929
4930/***************** Slide Out Widget Area **********/
4931
4932var $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;
4933var $bodyBorderWidth = ($('.body-border-right').length > 0) ? $('.body-border-right').width() : 0;
4934var $resetHeader;
4935
4936//icon effect html creation
4937if($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) {
4938
4939	if($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) {
4940		$('<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');
4941		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');
4942	}
4943
4944	//hover triggered
4945	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/))
4946		$('body').on('mouseenter','#header-outer .slide-out-widget-area-toggle:not(.std-menu) a',openRightHoverNav);
4947	else 
4948		$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a',openRightHoverNav);
4949
4950	$(window).on('smartresize',calculateHoverNavMinHeight);
4951
4952	function calculateHoverNavMinHeight() {
4953		$widgetHeights = 0;
4954		$('#slide-out-widget-area > .widget').each(function(){
4955			$widgetHeights += $(this).height();
4956		});
4957		$menuHeight = ( ($('#slide-out-widget-area').height() - 25 - $('.bottom-meta-wrap').outerHeight(true) -$widgetHeights) > $('#slide-out-widget-area .off-canvas-menu-container').height() ) ? $('#slide-out-widget-area').height() - 25 - $('.bottom-meta-wrap').outerHeight(true) -$widgetHeights : $('#slide-out-widget-area .off-canvas-menu-container').height();
4958		$('#slide-out-widget-area .inner').css({'height':'auto', 'min-height': $menuHeight  });
4959
4960		$('#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').height()/2) + 'px' },0);
4961	
4962	}
4963
4964	function openRightHoverNav() {
4965
4966		
4967
4968			calculateHoverNavMinHeight();
4969
4970			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && $('.slide-out-widget-area-toggle  .unhidden-line').length > 0) {
4971				mobileCloseNavCheck();
4972				return;
4973			}
4974			
4975
4976			$('#slide-out-widget-area').css({ 'transform': 'translate3d(0,
49760,0)' }).addClass('open');
4977
4978			//icon effect
4979			$('.slide-out-hover-icon-effect .lines-button').removeClass('no-delay').addClass('unhidden-line');
4980
4981			if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#nectar_fullscreen_rows').length == 0) {
4982
4983				if(!($(window).scrollTop() == 0 && $('#header-outer.transparent').length > 0)) {
4984					$('#header-outer').attr('data-transparent','true').addClass('no-bg-color').addClass('slide-out-hover');
4985					$('#header-outer header').addClass('all-hidden');
4986				}
4987
4988				var headerResize = $('#header-outer').attr('data-header-resize');
4989				if(headerResize == 1) {
4990
4991					$(window).off('scroll',bigNav);
4992					$(window).off('scroll',smallNav);
4993
4994
4995				} else {
4996					
4997					$(window).off('scroll',opaqueCheck);
4998					$(window).off('scroll',transparentCheck);
4999				}
5000			}
5001
5002			if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/))
5003				$(window).on('mousemove.rightOffsetCheck',closeNavCheck);
5004
5005	}
5006
5007	function closeNavCheck(e) {
5008		var $windowWidth = $(window).width();
5009		if(e.clientX < $windowWidth - 340 - $bodyBorderWidth) {
5010
5011				$(window).off('mousemove.rightOffsetCheck',closeNavCheck);
5012
5013				$('#slide-out-widget-area').css({ 'transform': 'translate3d(341px,0,0)' }).removeClass('open');
5014
5015				$('#header-outer').removeClass('style-slide-out-from-right');
5016
5017				$('.slide-out-hover-icon-effect .lines-button').removeClass('unhidden-line').addClass('no-delay');
5018
5019
5020				if($('#header-outer[data-permanent-transparent="1"]').length == 0) {
5021
5022					if(!($(window).scrollTop() == 0 && $('#header-outer.transparent').length > 0)) {
5023						$('#header-outer').removeClass('no-bg-color');
5024						$('#header-outer header').removeClass('all-hidden');
5025					}
5026
5027					var headerResize = $('#header-outer').attr('data-header-resize');
5028					if(headerResize == 1) {
5029					
5030						$(window).off('scroll.headerResizeEffect');
5031						if($(window).scrollTop() == 0) {
5032							$(window).on('scroll.headerResizeEffect',smallNav); 
5033
5034							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) {
5035								$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
5036									'padding' : '0'			
5037								},{queue:false, duration:250, easing: 'easeOutCubic'});	
5038							}
5039						}
5040						else {
5041							$(window).on('scroll.headerResizeEffect',bigNav);
5042						}
5043						
5044			
5045					} else {
5046						
5047						$(window).off('scroll.headerResizeEffectOpaque');
5048						$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
5049					}
5050				}
5051
5052			}
5053
5054	}
5055
5056	function mobileCloseNavCheck(e) {
5057		
5058
5059				$('#slide-out-widget-area').css({ 'transform': 'translate3d(341px,0,0)' }).removeClass('open');
5060
5061				$('#header-outer').removeClass('style-slide-out-from-right');
5062
5063				$('.slide-out-hover-icon-effect .lines-button').removeClass('unhidden-line').addClass('no-delay');
5064
5065				if($('#header-outer[data-permanent-transparent="1"]').length == 0) {
5066
5067					$('#header-outer').removeClass('no-bg-color');
5068					$('#header-outer header').removeClass('all-hidden');
5069
5070				}
5071
5072			
5073
5074	}
5075
5076}
5077
5078
5079//click triggered
5080$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating)',function(){
5081	if(animating == 'true' || $('.slide-out-from-right-hover').length > 0) return false;
5082	var $that = $(this);
5083
5084	//slide out from right
5085	if($('#slide-out-widget-area').hasClass('slide-out-from-right')) {
5086
5087		//calc height if used bottom meta
5088		$('#slide-out-widget-area .inner').css({'height':'auto', 'min-height': $('#slide-out-widget-area').height() - 25 - $('.bottom-meta-wrap').height() });
5089
5090		if($('#boxed').length == 0) {
5091			$('.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');
5092
5093			if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
5094				if($('#header-outer[data-transparency-option="1"]').length == 0) {
5095					$('#header-outer').stop(true).css('transform','translateY(0)').transition({ x: '-300px'},700,'easeInOutCubic');
5096				} else {
5097					$('#header-outer').stop(true).css('transform','translateY(0)').transition({ x: '-300px', 'background-color':'transparent', 'border-bottom': '1px solid rgba(255,255,255,0.22)' },700,'easeInOutCubic');
5098				}
5099			} else {
5100				$('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').transition({ x: '-300px'},700,'easeInOutCubic');
5101			}
5102
5103			$('#ascrail2000').transition({ 'x': '-300px' },700,'easeInOutCubic');
5104			$('body:not(.ascend) #header-outer .cart-menu').stop(true).transition({ 'x': '300px' },700,'easeInOutCubic');
5105		}
5106
5107		$slideOutAmount = ($('.body-border-top').length > 0 && $('body.mobile').length == 0) ? '-'+$('.body-border-top').height()+'px' : 0;
5108		$('#slide-out-widget-area').stop(true).transition({ x: $slideOutAmount },700,'easeInOutCubic').addClass('open');
5109
5110
5111		if($('#boxed').length == 0) {
5112			//full width menu adjustments
5113			if($('#header-outer[data-full-width="true"]').length > 0 && !$('body').hasClass('mobile')) { 
5114				$('#header-outer').addClass('highzI'); 
5115				$('#ascrail2000').addClass('z-index-adj');
5116
5117				if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
5118					$('header#top #logo').stop(true).transition({ x: '300px' },700,'easeInOutCubic'); 
5119					
5120					$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': $(window).width() - 360, 'left': '300px' },700,'easeInOutCubic');
5121
5122				}
5123
5124				$('header#top .slide-out-widget-area-toggle .lines-button').addClass('close');
5125
5126				if($('#header-outer[data-remove-border="true"]').length > 0) {
5127					$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '64px' },700,'easeInOutCubic');
5128				} else {
5129					$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '89px' },700,'easeInOutCubic'); 
5130				}
5131
5132				$('body #header-outer nav > ul > li > a').css({'margin-bottom':'0'});
5133				
5134			}
5135		}
5136
5137		$('#header-outer').addClass('style-slide-out-from-right');
5138
5139		//fade In BG Overlay
5140		$('#slide-out-widget-area-bg').css({'height':'100%','width':'100%'}).stop(true).transition({
5141			'opacity' : 1
5142		},700,'easeInOutCubic',function(){
5143			$('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating');
5144		});
5145		
5146		//hide menu if no space
5147		if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
5148			$logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width();
5149			if($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) $('#header-outer').addClass('hidden-menu');
5150		} else {
5151			$('#header-outer').addClass('hidden-menu-items');
5152		}
5153
5154		var headerResize = $('#header-outer').attr('data-header-resize');
5155		if($bodyBorderHeaderColorMatch == true && headerResize == 1) {
5156			
5157			$('#header-outer').stop(true).transition({ y: '0' },0).addClass('transparent');
5158			if($('#header-outer').attr('data-transparent-header') != 'true') {
5159				$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
5160			}
5161
5162			$(window).off('scroll',bigNav);
5163			if($('.small-nav').length > 0 || $('#header-outer').hasClass('pseudo-data-transparent')) bigNav();
5164			$(window).off('scroll',smallNav);
5165
5166		} else if ($bodyBorderHeaderColorMatch == true) {
5167			$('#header-outer').addClass('transparent');
5168			$(window).off('scroll',opaqueCheck);
5169			$(window).off('scroll',transparentCheck);
5170		}
5171
5172
5173	}
5174     else if($('#slide-out-widget-area').hasClass('fullscreen')) {
5175
5176		//scroll away from fixed reveal footer if shown (firefox bug with bluring over it)
5177		var $scrollDelay = 0;
5178		var $scrollDelay2 = 0;
5179
5180		if($(window).scrollTop() + $(window).height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) {
5181			$('body,html').stop().animate({
5182				scrollTop: $('.blurred-wrap').height() - $(window).height()
5183			},600,'easeInOutCubic');
5184			$scrollDelay = 550;
5185			$scrollDelay2 = 200;
5186		}
5187
5188		$('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close');
5189		setTimeout(function(){ $('.blurred-wrap').addClass('blurred'); },$scrollDelay);
5190		$('#slide-out-widget-area.fullscreen').show().addClass('open');
5191
5192		hideToTop();
5193
5194		//remove box shadow incase at the top of the page with nectar box roll above
5195		$('.container-wrap').addClass('no-shadow');
5196		$('#header-outer').stop(true).css('transform','translateY(0)');
5197
5198		setTimeout(function(){
5199
5200			$('.off-canvas-menu-container .menu > li').each(function(i){
5201				$(this).delay(i*50).transition({y: 0, 'opacity': 1},800,'easeOutExpo');
5202			});
5203
5204			$('#slide-out-widget-area.fullscreen .widget').each(function(i){
5205				$(this).delay(i*100).transition({y: 0, 'opacity': 1},800,'easeOutExpo');
5206			});
5207		},370+$scrollDelay2);
5208
5209		setTimeout(function(){
5210			$('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
5211
5212			$('#slide-out-widget-area .off-canvas-social-links li').each(function(i){
5213				$(this).delay(i*50).transition({'scale':1},400,'easeOutCubic');
5214			});
5215			$('#slide-out-widget-area .bottom-text').transition({'opacity':0.7},400,'easeOutCubic');
5216		},750+$scrollDelay2);
5217		
5218		//fade In BG Overlay
5219		setTimeout(function(){
5220			$easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint';
5221			$('#slide-out-widget-area-bg').css({'height':'100%','width':'100%'}).show().stop(true).transition({
5222				'y' : '0%'
5223			},920,$easing,function(){
5224				$('.slide-out-widget-area-toggle > div > a').removeClass('animating');
5225			});
5226		},50+$scrollDelay2);
5227
5228		//overflow state 
5229		slideOutWidgetOverflowState();
5230		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').addClass('at-content');
5231		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());
5232	} 
5233
5234	else if($('#slide-out-widget-area').hasClass('fullscreen-alt')) {
5235
5236		$('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close');
5237		$('#slide-out-widget-area.fullscreen-alt').show().addClass('open');
5238		$('#slide-out-widget-area-bg').addClass('open');
5239
5240		$('body > div[class*="body-border"]').css('z-index','9995');
5241
5242		$('.off-canvas-menu-container .menu').transition({y: '0px', 'opacity': 1},0);	
5243
5244		hideToTop();
5245
5246		if($('#header-outer-bg-only').length == 0 ) {
5247			$('body').prepend($('<div id="header-outer-bg-only"/>'));
5248			$('#header-outer-bg-only').css({'height':$('#header-outer').outerHeight(true), 'background-color': $('#header-outer').css('background-color')});	
5249		} 
5250
5251		if($('#header-outer.transparent').length == 0) {
5252
5253			$('#header-outer-bg-only').show();
5254			$('#header-outer-bg-only').css({'height':$('#header-outer').outerHeight(true), 'background-color': $('#header-outer').css('background-color')});
5255
5256			if($('.body-border-top').length > 0) {
5257				//$('.admin-bar #slide-out-widget-area-bg.fullscreen-alt').addClass('no-transition').css({'padding-top': ($('#header-outer').outerHeight(true)+32) + 'px'});
5258				//$('body:not(.admin-bar) #slide-out-widget-area-bg.fullscreen-alt').addClass('no-transition').css({'padding-top': ($('#header-outer').outerHeight(true))+ 'px'});
5259			}
5260		}
5261		else { 
5262
5263			$('#header-outer-bg-only').hide();
5264			if($('.body-border-top').length > 0) {
5265				$('.admin-bar #slide-out-widget-area-bg.fullscreen-alt').addClass('no-transition').css({'padding-top': ($('.body-border-top').outerHeight(true)+32) + 'px'});
5266				$('body:not(.admin-bar) #slide-out-widget-area-bg.fullscreen-alt').addClass('no-transition').css({'padding-top': ($('.body-border-top').outerHeight(true))+ 'px'});
5267			}
5268		}
5269
5270		if($('#logo .starting-logo').length > 0 && $(window).width() > 1000) {
5271			
5272			$('#header-outer').addClass('no-transition').addClass('no-bg-color');
5273			
5274			$('#header-outer').stop(true).css('transform','translateY(0)').addClass('transparent');
5275			if($('#header-outer').attr('data-transparent-header') != 'true') {
5276				$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
5277			}
5278		}
5279
5280		$('.off-canvas-menu-container .clip-wrap').css('transition-duration','0s');
5281
5282		setTimeout(function(){
5283
5284			$('.off-canvas-menu-container .menu > li').each(function(i){
5285				$(this).delay(i*50).transition({y: 0, 'opacity': 1},750,'easeOutCubic').addClass('no-pointer-events');
5286			});
5287
5288			setTimeout(function(){
5289				$('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
5290				$('.off-canvas-menu-container .clip-wrap').css('transition-duration','.45s');
5291			},500);
5292			
5293		
5294
5295			$('#slide-out-widget-area.fullscreen-alt .widget').each(function(i){
5296				$(this).delay(i*100).transition({y: 0, 'opacity': 1},650,'easeOutCubic');
5297			});
5298		},200);
5299
5300		setTimeout(function(){
5301			$('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
5302
5303			$('#slide-out-widget-area .off-canvas-social-links li').css('opacity','1').each(function(i){
5304				$(this).delay(i*50).transition({'scale':1},400,'easeOutCubic');
5305			});
5306			$('#slide-out-widget-area .bottom-text').transition({'opacity':1},600,'easeOutCubic');
5307		},200);
5308		
5309		//fade In BG Overlay
5310		if($('#slide-out-widget-area-bg').hasClass('solid')) $opacity = 1;
5311		if($('#slide-out-widget-area-bg').hasClass('dark')) $opacity = 0.97;
5312		if($('#slide-out-widget-area-bg').hasClass('medium')) $opacity = 0.6;
5313		if($('#slide-out-widget-area-bg').hasClass('light')) $opacity = 0.4;
5314		$('#slide-out-widget-area-bg').removeClass('no-transition');
5315		setTimeout(function(){
5316			$('#slide-out-widget-area-bg').addClass('padding-removed').css({'height':'100%','width':'100%', 'left':'0','opacity': $opacity});
5317		},50);
5318
5319		setTimeout(function(){
5320			$('.slide-out-widget-area-toggle > div > a').removeClass('animating');
5321		},600);
5322			
5323		
5324
5325		//overflow state 
5326		slideOutWidgetOverflowState();
5327		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').addClass('at-content');
5328		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());
5329	}
5330
5331
5332
5333	
5334		
5335
5336	//add open class
5337	$('#header-outer').removeClass('side-widget-closed').addClass('side-widget-open');
5338
5339	//give header transparent state
5340	if($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0 && $('#header-outer[data-full-width="true"]').length > 0) {
5341		$('#header-outer').addClass('transparent');
5342	}
5343
5344	//dark slide transparent nav
5345	if($('#header-outer.dark-slide.transparent').length > 0  && $('#boxed').length == 0) $('#header-outer').removeClass('dark-slide').addClass('temp-removed-dark-slide');
5346	
5347	$('.slide-out-widget-area-toggle > div > a').removeClass('closed').addClass('open');
5348	$('.slide-out-widget-area-toggle > div > a').addClass('animating');
5349
5350	return false;
5351});
5352
5353$('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(){
5354	
5355	if($('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) return;
5356
5357	var $that = $(this);
5358
5359	$('.slide-out-widget-area-toggle:not(.std-menu) a').removeClass('open').addClass('closed');
5360	$('.slide-out-widget-area-toggle:not(.std-menu) a').addClass('animating');
5361
5362	//slide out from right
5363	if($('#slide-out-widget-area').hasClass('slide-out-from-right')) {
5364
5365		$('.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');
5366
5367		if($('#header-outer[data-transparency-option="1"]').length > 0  && $('#boxed').length == 0) {
5368			$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');
5369			$('#header-outer').stop(true).transition({ x: '0px', 'background-color': $currentRowBG },700,'easeInOutCubic');
5370		} else {
5371			$('#header-outer').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
5372		}
5373
5374		$('#ascrail2000').stop(true).transition({ 'x': '0px' },700,'easeInOutCubic');
5375		$('body:not(.ascend) #header-outer .cart-menu').stop(true).transition({ 'x': '0px' },700,'easeInOutCubic');
5376
5377		$('#slide-out-widget-area').stop(true).transition({ x: '301px' },700,'easeInOutCubic').removeClass('open');
5378
5379
5380		if($('#boxed').length == 0) {
5381			if($('#header-outer[data-full-width="true"]').length > 0) {  
5382				$('#header-outer').removeClass('highzI'); 
5383				$('header#top #logo').stop(true).transition({ x: '0px' },700,'easeInOutCubic'); 
5384				$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': '100%', 'left': '0' },700,'easeInOutCubic');
5385				$('.lines-button').removeClass('close');
5386
5387				$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
5388
5389			}
5390		}
5391
5392		if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) {
5393			$('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({ x: '0px' },700,'easeInOutCubic'); 
5394		}
5395
5396		//fade out overlay
5397		$('#slide-out-widget-area-bg').stop(true).transition({
5398			'opacity' : 0
5399		},700,'easeInOutCubic',function(){
5400			$('.slide-out-widget-area-toggle a').removeClass('animating');
5401			$(this).css({'height':'1px','width':'1px'});
5402
5403			//hide menu if transparent, user has scrolled down and hhun is on
5404			if($('#header-outer').hasClass('parallax-contained') && $(window).scrollTop() > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) {
5405				$('#header-outer').removeClass('parallax-contained').addClass('detached').removeClass('transparent');
5406			}
5407			else if($(window).scrollTop() == 0 && $('body[data-hhun="1"]').length >
5407 0 && $('#page-header-bg[data-parallax="1"]').length > 0 ||
5408				$(window).scrollTop() == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) {
5409
5410				if($('#header-outer[data-transparency-option="1"]').length > 0) $('#header-outer').addClass('transparent');
5411				$('#header-outer').addClass('parallax-contained').removeClass('detached');
5412			}
5413
5414			//fix for fixed subpage menu
5415			$('.container-wrap').css('transform','none');
5416		});
5417
5418
5419		$('#header-outer').removeClass('style-slide-out-from-right');
5420
5421
5422		var headerResize = $('#header-outer').attr('data-header-resize');
5423		if($bodyBorderHeaderColorMatch == true && headerResize == 1) {
5424		
5425			$(window).off('scroll.headerResizeEffect');
5426			if($(window).scrollTop() == 0) {
5427				$(window).on('scroll.headerResizeEffect',smallNav); 
5428
5429				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) {
5430					$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
5431						'padding' : '0'			
5432					},{queue:false, duration:250, easing: 'easeOutCubic'});	
5433				}
5434			}
5435			else
5436				smallNav();
5437
5438			if($('#header-outer').hasClass('pseudo-data-transparent')) {
5439				$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
5440			}
5441
5442		} else if ($bodyBorderHeaderColorMatch == true) {
5443			
5444			$(window).off('scroll.headerResizeEffectOpaque');
5445			$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
5446		}
5447
5448
5449
5450	} 
5451
5452	else if($('#slide-out-widget-area').hasClass('fullscreen')) {
5453
5454
5455		$('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close');
5456		//$('.slide-out-widget-area-toggle a').removeClass('animating');
5457		$('.blurred-wrap').removeClass('blurred');
5458		$('#slide-out-widget-area.fullscreen').transition({'opacity': 0 },700,'easeOutQuad',function(){ $('#slide-out-widget-area.fullscreen').hide().css('opacity','1'); }).removeClass('open');
5459		$('#slide-out-widget-area.fullscreen .widget').transition({'opacity': 0},700,'easeOutQuad',function(){
5460			$(this).transition({y: '110px'},0);
5461		});
5462
5463		setTimeout(function(){
5464			$('.off-canvas-menu-container .menu > li').transition({y: '80px', 'opacity': 0},0);		
5465			$('#slide-out-widget-area .off-canvas-social-links li').transition({'scale':0},0);
5466			$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
5467			$('#slide-out-widget-area .bottom-text').transition({'opacity':0},0);	
5468
5469			//close submenu items
5470			$('#slide-out-widget-area .menuwrapper .menu').removeClass( 'subview' );
5471			$('#slide-out-widget-area .menuwrapper .menu li').removeClass( 'subview subviewopen' );
5472			$('#slide-out-widget-area.fullscreen .inner .off-canvas-menu-container').css('height','auto');
5473		},800);
5474
5475		setTimeout(function(){
5476			showToTop();
5477			$('.container-wrap').removeClass('no-shadow');
5478		},500);
5479
5480		//fade out overlay
5481		$('#slide-out-widget-area-bg').stop(true).transition({'opacity': 0},900,'easeOutQuad',function(){
5482			if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').removeClass('at-content');
5483			if($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', '0');
5484			$('.slide-out-widget-area-toggle a').removeClass('animating');
5485			if($('#slide-out-widget-area-bg').hasClass('solid')) $opacity = 1;
5486			if($('#slide-out-widget-area-bg').hasClass('dark')) $opacity = 0.93;
5487			if($('#slide-out-widget-area-bg').hasClass('medium')) $opacity = 0.6;
5488			if($('#slide-out-widget-area-bg').hasClass('light')) $opacity = 0.4;
5489			$(this).css({'height':'1px','width':'1px', 'opacity': $opacity}).transition({ y : '-100%'},0);
5490		});
5491
5492		
5493	}
5494
5495	else if($('#slide-out-widget-area').hasClass('fullscreen-alt')) {
5496
5497		$('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close');
5498		//$('.slide-out-widget-area-toggle a').removeClass('animating');
5499		$('.blurred-wrap').removeClass('blurred');
5500		$('#slide-out-widget-area-bg').removeClass('open');
5501		
5502		$('#slide-out-widget-area.fullscreen-alt .widget').transition({'opacity': 0},500,'easeOutQuad',function(){
5503			$(this).transition({y: '40px'},0);
5504		});
5505		$('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({'opacity': 0},250,'easeOutQuad');
5506		$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
5507
5508		$('.off-canvas-menu-container .menu').transition({y: '-13px', 'opacity': 0},400);	
5509
5510
5511		setTimeout(function(){
5512			$('.off-canvas-menu-container .menu > li').stop(true,true).transition({y: '40px', 'opacity': 0},0);		
5513			$('#slide-out-widget-area .off-canvas-social-links li').transition({'scale':0},0);
5514			$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');	
5515
5516			//close submenu items
5517			$('#slide-out-widget-area .menuwrapper .menu').removeClass( 'subview' );
5518			$('#slide-out-widget-area .menuwrapper .menu li').removeClass( 'subview subviewopen' );
5519			$('#slide-out-widget-area.fullscreen-alt .inner .off-canvas-menu-container').css('height','auto');
5520
5521			if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').removeClass('at-content');
5522			if($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) $('#slide-out-widget-area.fullscreen-alt .inner-wrap').css('padding-top', '0');
5523			$('.slide-out-widget-area-toggle a').removeClass('animating');
5524			$('#slide-out-widget-area-bg').css({'height':'1px','width':'1px','left':'-100%'});
5525			$('#slide-out-widget-area.fullscreen-alt').hide().removeClass('open');
5526		},550);
5527
5528		setTimeout(function(){
5529			showToTop();
5530		},600);
5531
5532		//fade out overlay
5533		setTimeout(function(){
5534			$('#slide-out-widget-area-bg').removeClass('padding-removed');
5535		},50);	
5536
5537		
5538		var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 250: 50;
5539
5540		setTimeout(function(){
5541			$('#slide-out-widget-area-bg').stop(true).css({'opacity': 0});
5542			$('body > div[class*="body-border"]').css('z-index','10000');
5543		},borderDelay);
5544
5545		setTimeout(function(){
5546			$('#header-outer.transparent.small-nav, #header-outer.transparent.detached, #header-outer.transparent.scrolled-down').removeClass('transparent');
5547			
5548			if($('#header-outer').hasClass('pseudo-data-transparent')) {
5549				$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
5550			}
5551
5552			
5553				setTimeout(function(){
5554					$('#header-outer').removeClass('no-bg-color');
5555					$('#header-outer-bg-only').hide();
5556					setTimeout(function(){
5557						$('#header-outer').removeClass('no-transition');
5558					},50);
5559				},250);
5560			
5561
5562		},100);
5563		
5564	}
5565
5566
5567	
5568
5569	//dark slide transparent nav
5570	if($('#header-outer.temp-removed-dark-slide.transparent').length > 0  && $('#boxed').length == 0) $('#header-outer').removeClass('temp-removed-dark-slide').addClass('dark-slide');
5571
5572	//remove header transparent state
5573
5574	if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) {
5575
5576		if($('.nectar-box-roll').length == 0) {
5577			if($('#header-outer.small-nav').length > 0 || $('#header-outer.scrolled-down').length > 0 || $('#header-outer.detached').length > 0) $('#header-outer').removeClass('transparent');
5578		} else {
5579			if($('#header-outer.small-nav').length > 0 || $('#header-outer.scrolled-down').length > 0 || $('.container-wrap.auto-height').length > 0) $('#header-outer').removeClass('transparent');
5580		}
5581	} 
5582
5583
5584
5585	//remove hidden menu
5586	$('#header-outer').removeClass('hidden-menu');
5587
5588	$('#header-outer').removeClass('side-widget-open').addClass('side-widget-closed');
5589
5590	return false;
5591});
5592
5593function slideOutWidgetOverflowState() {
5594
5595
5596	//switch position of social media/extra info based on screen size
5597	if(window.innerWidth < 1000 || $('body > #boxed').length > 0) {
5598		$('#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');
5599		$('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner');
5600	} else {
5601		$('#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');
5602		$('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap');
5603	}
5604
5605	//add overflow
5606	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'); }
5607	else { $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').removeClass('overflow-state'); }
5608
5609	$('#slide-out-widget-area[class*="fullscreen"] .inner').transition({ y : '-' + ($('#slide-out-widget-area[class*="fullscreen"] .inner').height()/2) + 'px' },0);
5610
5611	//close mobile only slide out widget area if switching back to desktop
5612	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');
5613
5614}
5615
5616
5617function fullWidthHeaderSlidingWidgetMenuCalc() {
5618	$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': $(window).width() - 360, 'left': '300px' },700,'easeInOutCubic');
5619}
5620
5621//slide out widget area scrolling 
5622function slideOutWidgetAreaScrolling(){ 
5623	$('#slide-out-widget-area').mousewheel(function(event, delta) {
5624
5625	     this.scrollTop -= (delta * 30);
5626	    
5627	     event.preventDefault();
5628
5629	});
5630}
5631slideOutWidgetAreaScrolling();
5632
5633
5634//handle mobile scrolling
5635if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
5636	$('#slide-out-widget-area').addClass('mobile');
5637}
5638
5639
5640function closeOCM(item) {
5641    if($('#slide-out-widget-area.open').length > 0) {
5642
5643    	var $windowCurrentLocation = window.location.href.split("#")[0];
5644		var $windowClickedLocation = item.find('> a').attr('href').split("#")[0];
5645
5646    	if($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) 
5647        $('.slide-out-widget-area-toggle a').trigger('click');
5648    }
5649}
5650
5651
5652
5653//fullscreen submenu
5654
5655
5656/**
5657 * jquery.dlmenu.js v1.0.1
5658 * http://www.codrops.com
5659 *
5660 * Licensed under the MIT license.
5661 * http://www.opensource.org/licenses/mit-license.php
5662 * 
5663 * Copyright 2013, Codrops
5664 * http://www.codrops.com
5665 */
5666;( function( $, window, undefined ) {
5667
5668	'use strict';
5669
5670	// global
5671	var Modernizr = window.Modernizr, $body = $( 'body' );
5672
5673	$.DLMenu = function( options, element ) {
5674		this.$el = $( element );
5675		this._init( options );
5676	};
5677
5678	// the options
5679	$.DLMenu.defaults = {
5680		// classes for the animation effects
5681		animationClasses : { classin : 'dl-animate-in-1', classout : 'dl-animate-out-1' },
5682		// callback: click a link that has a sub menu
5683		// el is the link element (li); name is the level name
5684		onLevelClick : function( el, name ) { return false; },
5685		// callback: click a link that does not have a sub menu
5686		// el is the link element (li); ev is the event obj
5687		onLinkClick : function( el, ev ) { return false; }
5688	};
5689
5690	$.DLMenu.prototype = {
5691		_init : function( options ) {
5692
5693			// options
5694			this.options = $.extend( true, {}, $.DLMenu.defaults, options );
5695			// cache some elements and initialize some variables
5696			this._config();
5697			
5698			var animEndEventNames = {
5699					'WebkitAnimation' : 'webkitAnimationEnd',
5700					'OAnimation' : 'oAnimationEnd',
5701					'msAnimation' : 'MSAnimationEnd',
5702					'animation' : 'animationend'
5703				},
5704				transEndEventNames = {
5705					'WebkitTransition' : 'webkitTransitionEnd',
5706					'MozTransition' : 'transitionend',
5707					'OTransition' : 'oTransitionEnd',
5708					'msTransition' : 'MSTransitionEnd',
5709					'transition' : 'transitionend'
5710				};
5711			// animation end event name
5712			this.animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' ) ] + '.menu';
5713			// transition end event name
5714			this.transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ] + '.menu',
5715			// support for css animations and css transitions
5716			this.supportAnimations = Modernizr.cssanimations,
5717			this.supportTransitions = Modernizr.csstransitions;
5718
5719			this._initEvents();
5720
5721		},
5722		_config : function() {
5723			this.open = false;
5724			this.$trigger = this.$el.children( '.trigger' );
5725			this.$menu = this.$el.children( 'ul.menu' );
5726			this.$menuitems = this.$menu.find( 'li:not(.back) > a' );
5727			this.$el.find( 'ul.sub-menu' ).prepend( '<li class="back"><a href="#"> '+$('#slide-out-widget-area').attr('data-back-txt')+' </a></li>' );
5728			this.$back = this.$menu.find( 'li.back' );
5729		},
5730		_initEvents : function() {
5731
5732			var self = this;
5733
5734			this.$trigger.on( 'click.menu', function() {
5735				
5736				if( self.open ) {
5737					self._closeMenu();
5738				} 
5739				else {
5740					self._openMenu();
5741				}
5742				return false;
5743
5744			} );
5745			
5746			this.$menuitems.on( 'click.menu', function( event ) {
5747				
5748				//event.stopPropagation();
5749
5750				var $item = $(this).parent('li'),
5751					$submenu = $item.children( 'ul.sub-menu' );
5752
5753				$('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration','0s');	
5754	
5755				//exit if clicking on background LI (avoids effect wrongly triggering)
5756				//if( $item.find('> a').length > 0 && $item.find('> a').css('display') === 'none') return false;
5757			
5758				if( $submenu.length > 0 ) {
5759
5760					var $flyin = $submenu.clone().css( 'opacity', 0 ).insertAfter( self.$menu ),
5761						onAnimationEndFn = function() {
5762							self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classout ).addClass( 'subview' );
5763							$item.addClass( 'subviewopen' ).parents( '.subviewopen:first' ).removeClass( 'subviewopen' ).addClass( 'subview' );
5764							$flyin.remove();
5765							setTimeout(function(){
5766								$('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
5767								$('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration','.45s');
5768							},300);
5769							
5770			
5771						};
5772
5773					setTimeout( function() {
5774						$flyin.addClass( self.options.animationClasses.classin );
5775						self.$menu.addClass( self.options.animationClasses.classout );
5776						if( self.supportAnimations ) {
5777							self.$menu.on( self.animEndEventName, onAnimationEndFn );
5778						}
5779						else {
5780							onAnimationEndFn.call();
5781						}
5782
5783						self.options.onLevelClick( $item, $item.children( 'a:first' ).text() );
5784					} );
5785
5786
5787					//adjust height for mobile / widgets below
5788					$item.parents('.off-canvas-menu-container').css('height',$item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({ 'height': $flyin.height() },500,'easeInOutQuad' );
5789
5790
5791					return false;
5792
5793				}
5794				else {
5795		
5796					self.options.onLinkClick( $item.find('> a'), event );
5797				}
5798
5799				closeOCM($item);
5800
5801			});
5802
5803			
5804
5805
5806			this.$back.on( 'click.menu', function( event ) {
5807				
5808				var $this = $( this ),
5809					$submenu = $this.parents( 'ul.sub-menu:first' ),
5810					$item = $submenu.parent(),
5811
5812					$flyin = $submenu.clone().insertAfter( self.$menu );
5813
5814				var onAnimationEndFn = function() {
5815					self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classin );
5816					$flyin.remove();
5817				};
5818
5819				setTimeout( function() {
5820					$flyin.addClass( self.options.animationClasses.classout );
5821					self.$menu.addClass( self.options.animationClasses.classin );
5822					if( self.supportAnimations ) {
5823						self.$menu.on( self.animEndEventName, onAnimationEndFn );
5824					}
5825					else {
5826						onAnimationEndFn.call();
5827					}
5828
5829					$item.removeClass( 'subviewopen' );
5830					
5831					var $subview = $this.parents( '.subview:first' );
5832					if( $subview.is( 'li' ) ) {
5833						$subview.addClass( 'subviewopen' );
5834					}
5835					$subview.removeClass( 'subview' );
5836				} );
5837
5838		
5839				//adjust height for mobile / widgets below
5840				$item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height())
5841				setTimeout(function() { 
5842					$item.parents('.off-canvas-menu-container').transition({ 'height': $item.parent().height() },500,'easeInOutQuad');
5843				},50);
5844
5845
5846				return false;
5847
5848			} );
5849			
5850		},
5851		closeMenu : function() {
5852			if( this.open ) {
5853				this._closeMenu();
5854			}
5855		},
5856		_closeMenu : function() {
5857			var self = this,
5858				onTransitionEndFn = function() {
5859					self.$menu.off( self.transEndEventName );
5860					self._resetMenu();
5861				};
5862			
5863			this.$menu.removeClass( 'menuopen' );
5864			this.$menu.addClass( 'menu-toggle' );
5865			this.$trigger.removeClass( 'active' );
5866			
5867			if( this.supportTransitions ) {
5868				this.$menu.on( this.transEndEventName, onTransitionEndFn );
5869			}
5870			else {
5871				onTransitionEndFn.call();
5872			}
5873
5874			this.open = false;
5875		},
5876		openMenu : function() {
5877			if( !this.open ) {
5878				this._openMenu();
5879			}
5880		},
5881		_openMenu : function() {
5882			var self = this;
5883			// clicking somewhere else makes the menu close
5884			$body.off( 'click' ).on( 'click.menu', function() {
5885				self._closeMenu() ;
5886			} );
5887			this.$menu.addClass( 'menuopen menu-toggle' ).on( this.transEndEventName, function() {
5888				$( this ).removeClass( 'menu-toggle' );
5889			} );
5890			this.$trigger.addClass( 'active' );
5891			this.open = true;
5892		},
5893		// resets the menu to its original state (first level of options)
5894		_resetMenu : function() {
5895			this.$menu.removeClass( 'subview' );
5896			this.$menuitems.removeClass( 'subview subviewopen' );
5897		}
5898	};
5899
5900	var logError = function( message ) {
5901		if ( window.console ) {
5902			window.console.error( message );
5903		}
5904	};
5905
5906	$.fn.dlmenu = function( options ) {
5907		if ( typeof options === 'string' ) {
5908			var args = Array.prototype.slice.call( arguments, 1 );
5909			this.each(function() {
5910				var instance = $.data( this, 'menu' );
5911				if ( !instance ) {
5912					logError( "cannot call methods on menu prior to initialization; " +
5913					"attempted to call method '" + options + "'" );
5914					return;
5915				}
5916				if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
5917					logError( "no such method '" + options + "' for menu instance" );
5918					return;
5919				}
5920				instance[ options ].apply( instance, args );
5921			});
5922		} 
5923		else {
5924			this.each(function() {	
5925				var instance = $.data( this, 'menu' );
5926				if ( instance ) {
5927					instance._init();
5928				}
5929				else {
5930					instance = $.data( this, 'menu', new $.DLMenu( options, this ) );
5931				}
5932			});
5933		}
5934		return this;
5935	};
5936
5937} )( jQuery, window );
5938
5939function fullscreenMenuInit() {
5940	$('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />');
5941	$('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen');
5942	$ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0) ? '4' : '5';
5943	$('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({ animationClasses : { classin : 'dl-animate-in-'+$ocmAnimationClassNum, classout : 'dl-animate-out-'+$ocmAnimationClassNum } });
5944
5945	//add fullscreen alt text effect 
5946	$('#slide-out-widget-area.fullscreen-alt .menu li, #slide-out-widget-area.slide-out-from-right-hover .menu li').each(function(){
5947
5948		var $menuItemText = $(this).find('> a').html();
5949		$(this).find('> a ').html($menuItemText.replace(/ /g, "&nbsp;"));
5950		$(this).find('> a').append('<span class="clip-wrap"><span>'+$(this).find('> a').text()+'</span></span>');
5951	});
5952
5953
5954	$('body').on('mouseover','#slide-out-widget-area.fullscreen-alt .menu li a',function(){
5955		var $that = $(this);
5956
5957		$(this).find('> .clip-wrap').css({'transition-duration': '0s' });
5958		$(this).find('> .clip-wrap span ').css({'transition-duration': '0s' });
5959
5960	
5961			$that.find('> .clip-wrap').css({'width':'0%', 'transform':'translateX(0%)' });
5962			$that.find('> .clip-wrap span').css({'transform':'translateX(0%)' });
5963		
5964		
5965
5966		setTimeout(function(){
5967
5968			$that.find('> .clip-wrap').css({'transition-duration': '0.45s' });
5969
5970			$that.find('> .clip-wrap').css({'width':'100%', 'left': '0', 'right': 'auto' });
5971			//$that.find('> .clip-wrap span').css({'transform':'translateX(0%)'});
5972		},50);
5973		
5974		
5975	});
5976	$('body').on('mouseleave','#slide-out-widget-area.fullscreen-alt .menu li a',function(){
5977
5978
5979
5980
5981		var $that = $(this);
5982
5983		$(this).find('> .clip-wrap').css({'transition-duration': '0s' });
5984		$(this).find('> .clip-wrap span ').css({'transition-duration': '0s' });
5985
5986		
5987		$that.find('> .clip-wrap').css({'width':'100%', 'transform':'translateX(0%)' });
5988		$that.find('> .clip-wrap span').css({'transform':'translateX(0%)' });
5989
5990
5991		$that.find('> .clip-wrap').css({'transition-duration': '0.45s' });
5992		$that.find('> .clip-wrap span').css({'transition-duration': '0.45s' });
5993
5994		$that.find('> .clip-wrap').css({'transform':'translateX(100%)'});
5995		$that.find('> .clip-wrap span').css({'transform':'translateX(-100%)'});
5996		
5997
5998	});
5999}
6000fullscreenMenuInit();
6001
6002//submenu link hover fix
6003$('body').on('mouseover','#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a',function(){
6004	var $currentTxt = $(this).text();
6005	$('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
6006	$('.off-canvas-menu-container .menuwrapper .menu li > a:contains('+$currentTxt+')').addClass('hovered');
6007});
6008$('body').on('mouseover','.off-canvas-menu-container .menuwrapper .menu li > a',function(){
6009	$('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
6010});
6011
6012
6013
6014/***************** Page Headers ******************/
6015
6016var pageHeaderHeight;
6017var pageHeaderHeightCopy;
6018var pageHeadingHeight;
6019var extraSpaceFromResize = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.nectar-box-roll').length == 0) ? 51 : 1;
6020//full screen header
6021function fullScreenHeaderInit(){
6022
6023	pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
6024	pageHeaderHeightCopy = parseInt($('#page-header-bg').attr('data-height'));
6025
6026	if($('.fullscreen-header').length > 0) {
6027
6028		if($('#header-outer[data-transparency-option]').length > 0 && $('#header-outer').attr('data-transparency-option') != '0'){
6029			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() : $(window).height() - parseInt($('#header-outer').height()) ;
6030		} else {
6031			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() - parseInt($('#header-space').height()) + extraSpaceFromResize : $(window).height() - parseInt($('#header-outer').height()) ;
6032		}
6033		var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
6034		if($('.nectar-box-roll').length > 0) extraHeight = 0;
6035		pageHeaderHeight =   calculatedNum  - extraHeight; 
6036		pageHeaderHeightCopy = calculatedNum - extraHeight; 
6037	}
6038
6039	$('#page-header-bg').css('height',pageHeaderHeight+'px').removeClass('not-loaded');
6040	setTimeout(function(){ $('#page-header-bg').css('overflow','visible') },800);
6041
6042}
6043
6044fullScreenHeaderInit();
6045
6046function pageHeader(){
6047	
6048	//add loaded class
6049	$('#page-header-bg[data-animate-in-effect="zoom-out"]').addClass('loaded');
6050
6051	var $scrollTop = $(window).scrollTop();
6052
6053	//full screen header
6054	if($('.fullscreen-header').length > 0) {
6055		if($('#header-outer[data-transparency-option]').length > 0 && $('#header-outer').attr('data-transparency-option') != '0'){
6056			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() : $(window).height() - parseInt($('#header-outer').height()) ;
6057			if($('body[data-permanent-transparent="1"]').length > 0) calculatedNum = $(window).height();
6058		} else {
6059			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() - parseInt($('#header-space').height()) + extraSpaceFromResize : $(window).height() - parseInt($('#header-outer').height()) ;
6060		}
6061		var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
6062		if($('.nectar-box-roll').length > 0) extraHeight = 0;
6063		pageHeaderHeight =   calculatedNum  - extraHeight; 
6064		pageHeaderHeightCopy = calculatedNum - extraHeight; 
6065	}
6066
6067	if( window.innerWidth < 1000 && window.innerWidth > 690 && !$('body').hasClass('salient_non_responsive') ) {
6068		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 1.6;
6069		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
6070		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
6071		
6072	} else if( window.innerWidth <= 690 && window.innerWidth > 480 && !$('body').hasClass('salient_non_responsive')) {
6073		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 2.1;
6074		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
6075		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
6076		
6077	} else if( window.innerWidth <= 480 && !$('body').hasClass('salient_non_responsive')) {
6078		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 2.5;
6079		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
6080		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
6081		
6082	} else {
6083		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy).css('height',pageHeaderHeightCopy +'px');
6084		if($('.fullscreen-header').length > 0){
6085			$('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
6086		} else {
6087			$('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
6088		}
6089
6090		if($('#page-header-bg[data-parallax="1"]').length == 0) $('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
6091	}
6092
6093	
6094	
6095	if(!$('body').hasClass('mobile')){
6096		
6097		//recalc
6098		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
6099		$('#page-header-bg .container > .row').css('top',0);
6100		var $divisionMultipler = ($('#header-outer[data-remove-border="true"]').length > 0) ? 2 : 1;
6101
6102		//center the heading
6103		pageHeadingHeight = $('#page-header-bg .col.span_6').height();
6104		
6105		if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.fullscreen-header').length == 0) {
6106			$('#page-header-bg:not("[data-parallax=1]") .col.span_6').css('top', ((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2));
6107		} else {
6108			var $extraResizeHeight = ($('#header-outer[data-header-resize="1"]').length > 0) ? 22: 0;
6109			$('#page-header-bg:not("[data-parallax=1]") .col.span_6').css('top', (pageHeaderHeight/2) - (pageHeadingHeight/2) + $extraResizeHeight);
6110		}
6111		
6112		//center portfolio filters
6113		$('#page-header-bg:not("[data-parallax=1]") .portfolio-filters').css('top', (pageHeaderHeight/2) + 2);	
6114		
6115		if($('#page-header-bg[data-parallax="1"] .span_6').css('opacity') > 0) {
6116			
6117			if($('#header-outer[data-transparent-header="true"]').length > 0 && $('body.single-post .fullscreen-header').length == 0) {
6118				//center the parallax heading
6119
6120			    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
6121					'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+60)),
6122					'top' : (((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2)) +"px"
6123			    });
6124			    
6125			    //center parllax portfolio filters
6126			    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
6127					'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
6128					'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
6129			    });
6130		  } else {
6131		  		//center the parallax heading
6132			    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
6133					'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+60)),
6134					'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
6135			    });
6136			    
6137			    //center parllax portfolio filters
6138			    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
6139					'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
6140					'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
6141			    });
6142		  }
6143	   }
6144	}
6145	
6146	else {
6147		//recalc
6148		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
6149		
6150		//center the heading
6151		var pageHeadingHeight = $('#page-header-bg .container > .row').height();
6152		$('#page-header-bg .container > .row').css('top', (pageHeaderHeight/2) - (pageHeadingHeight/2) + 5);
6153		
6154	}
6155
6156
6157	$('#page-header-bg .container > .row').css('visibility','visible');
6158}
6159
6160var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0; 
6161setTimeout(function(){ pageHeader(); },$pt_timeout);
6162
6163
6164if($('#header-outer').attr('data-header-resize') == '' || $('#header-outer').attr('data-header-resize') == '0'){
6165	$('#page-header-wrap').css('margin-top','0');
6166}
6167
6168
6169function extractUrl(input) {
6170	return input.replace(/"/g,"").replace(/url\(|\)$/ig, "");
6171}
6172 
6173/***************** Parallax Page Headers ******************/
6174if($('#page-header-bg[data-parallax="1"]').length > 0) {
6175
6176	//fadeIn
6177
6178	var img = new Image();
6179	
6180	var imgX, imgY, aspectRatio;
6181	var diffX, diffY;
6182	var pageHeadingHeight = $('#page-header-bg .col.span_6').height();
6183	var pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
6184	var headerPadding2 = parseInt($('#header-outer').attr('data-padding'))*2;
6185	var wooCommerceHeader = ($('.demo_store').length > 0) ? 32 : 0 ;
6186	
6187	
6188	var $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
6189	
6190	if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) {    
6191		img.onload = function() {
6192		   pageHeaderInit(); 
6193		}
6194		
6195		img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
6196		
6197	} else {
6198		 pageHeaderInit();
6199	}
6200	
6201	
6202	
6203	var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
6204
6205
6206	 if($('body[data-hhun="1"]').length > 0)  $('#header-outer').addClass('parallax-contained');
6207
6208	 window.addEventListener('scroll', function(){ 
6209        window.requestAnimationFrame(bindHeaderParallax);
6210    }, false);
6211
6212}
6213
6214
6215function bindHeaderParallax(){
6216
6217	var $scrollTop = $(window).scrollTop();
6218	var pageHeadingHeight = $('#page-header-bg .col.span_6').height();
6219	
6220	
6221	if(!$('body').hasClass('mobile') && navigator.userAgent.match(/iPad/i) == null){
6222
6223		var $multiplier1 =  ($('body[data-hhun="1"]').length > 0) ? 0.40: 0.2;
6224   	    var $multiplier2 = ($('body[data-hhun="1"]').length > 0) ? 0.09: 0.14;
6225   	    var $parallaxHeaderHUN = ($('#header-outer[data-transparency-option="1"]').length > 0) ? 0.49: 0.4;
6226
6227		//calc bg pos
6228		//$('#page-header-bg[data-parallax="1"]').css({'top': ((- $scrollTop / 5)+logoHeight+headerPadding+headerResizeOffExtra+extraHeight-extraDef+secondaryHeader)  + 'px' });
6229		if($('#page-header-bg .nectar-particles').length == 0 && $('#page-header-bg.out-of-sight').length == 0) {
6230
6231			$('#page-header-bg[data-parallax="1"]').css({ 'transform': 'translateY('+ $scrollTop*-$multiplier1 +'px)' });	
6232		
6233			var multipler = ($('body').hasClass('single')) ? 1 : 2;
6234			$('#page-header-bg[data-parallax="1"] .span_6,  #page-header-bg[data-parallax="1"][data-post-hs="default_minimal"] .author-section').css({ 
6235				'opacity' : 1-($scrollTop/(pageHeaderHeight-60))
6236			});
6237			
6238			$('#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)' });
6239			
6240			
6241			if($('#page-header-bg[data-parallax="1"] .span_6').css('opacity') == 0){
6242				$('#page-header-bg[data-parallax="1"] .span_6, #page-header-bg[data-parallax="1"] .portfolio-filters').hide();
6243			} else {
6244				$('#page-header-bg[data-parallax="1"] .span_6, #page-header-bg[data-parallax="1"] .portfolio-filters').show();
6245			}
6246
6247			if($('body[data-hhun="1"]').length > 0  && !$('#header-outer').hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) { 
6248	            $('#header-outer.parallax-contained').css({ 'transform': 'translateY('+$scrollTop*-$parallaxHeaderHUN+'px)' });
6249	        }
6250			
6251		
6252		}
6253		else if($('#page-header-bg.out-of-sight').length == 0) {
6254			//alt parallax effect
6255			var multipler = ($('body').hasClass('single')) ? 1 : 2;
6256			$('#page-header-wrap .nectar-particles .fade-out').css({ 
6257				'opacity' : 0+($scrollTop/(pageHeaderHeight+pageHeaderHeight*$multiplier))
6258			});
6259		}
6260
6261
6262		//hide elements to allow other parallax sections to work in webkit browsers
6263		if( ($scrollTop / (pageHeaderHeight + $('#header-space').height() + extraHeight)) > 1 ) {
6264			$('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility','hidden').hide().addClass('out-of-sight');
6265		}
6266		else {
6267		 	$('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility','visible').show().removeClass('out-of-sight');
6268
6269		 		//ensure header is centered
6270		 		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
6271				$('#page-header-bg .container > .row').css('top',0);
6272				var $divisionMultipler = ($('#header-outer[data-remove-border="true"]').length > 0) ? 2 : 1;
6273				pageHeadingHeight = $('#page-header-bg .col.span_6').height();
6274
6275				if($('#header-outer[data-transparent-header="true"]').length > 0 && $('body.single-post .fullscreen-header').length == 0) {
6276					//center the parallax heading
6277				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
6278						'top' : (((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2)) +"px"
6279				    });
6280
6281			  	} else {
6282			  		//center the parallax heading
6283				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
6284						'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
6285				    });
6286			  	}
6287	    }
6288		
6289
6290	}
6291
6292}
6293
6294if($('#page-header-bg').length > 0) {
6295	var $initialImgCheckAscend = extractUrl($('#page-header-bg').css('background-image'));
6296	if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) {    
6297		   $('#page-header-bg').addClass('has-bg');
6298	}
6299}
6300
6301
6302function pageHeaderInit(){
6303
6304	 var wooCommerceHeader = ($('.demo_store').length > 0) ? 32 : 0 ;
6305	 var centeredNavAltSpace = ($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) ? $('header#top nav > .sf-menu').height() -20 : null;
6306	 //transparent
6307	  if($('#header-outer[data-transparent-header="true"]').length > 0) {	
6308	     $('#page-header-bg[data-parallax="1"]').css({'top': extraHeight+wooCommerceHeader });
6309	  } else {
6310
6311	  	 var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
6312		 var headerPadding = parseInt($('#header-outer').attr('data-padding'));
6313		 var headerPadding2 = parseInt($('#header-outer').attr('data-padding'));
6314		 var extraDef = 10;
6315		 var headerResize = ($('body').hasClass('pp-video-function')) ? '1' : $('#header-outer').attr('data-header-resize');
6316		 var headerResizeOffExtra = 0;
6317		 var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
6318		 var usingLogoImage = true;
6319	     var mediaElement = ($('.wp-video-shortcode').length > 0) ? 36 : 0;
6320	     var secondaryHeader = ($('#header-outer').attr('data-using-secondary') == '1') ? 32 : 0 ;
6321	  	 if($('body[data-header-resize="0"]').length == 0) $('#page-header-bg[data-parallax="1"]').css({'top': (logoHeight+headerPadding+centeredNavAltSpace+headerResizeOffExtra+extraHeight-extraDef+secondaryHeader+wooCommerceHeader)  + 'px' });
6322	  }
6323	  
6324	  //fade in header
6325	  if($('#ajax-content-wrap').length == 0 || !$('body').hasClass('ajax-loaded')){
6326	  	$('#page-header-bg[data-parallax="1"]').animate({ 'opacity' : 1},650,'easeInCubic');
6327	  } else if($('#ajax-content-wrap').length == 1) {
6328	  	$('#page-header-bg[data-parallax="1"]').css({ 'opacity' : 1});
6329	  }
6330
6331	  //$('#page-header-wrap').css({'height' : pageHeaderHeight});
6332	  
6333	  //verify smooth scorlling
6334	  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') } 
6335	  
6336	  /* $('#page-header-bg[data-parallax="1"] .span_6').css({ 
6337			'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+60))
6338			'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
6339	   });
6340	   
6341	   $('#page-header-bg[data-parallax="1"] #portfolio-filters').css({ 
6342			'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
6343			'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
6344	   }); */
6345	  
6346	  $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />');
6347}
6348
6349
6350
6351
6352function nectarPageHeader() {
6353
6354	if($('#page-header-bg').length > 0) {
6355		fullScreenHeaderInit();
6356		pageHeader();
6357	}
6358
6359
6360	if($('#page-header-bg[data-parallax="1"]').length > 0) {
6361
6362		var img = new Image();
6363		var $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
6364			
6365		if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) {    
6366			img.onload = function() {
6367			   pageHeaderInit();    
6368					
6369			}
6370			
6371			img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
6372			
6373		} else {
6374			 pageHeaderInit();
6375		}
6376
6377		//bindHeaderParallax();
6378		$('#page-header-bg[data-parallax="1"] .span_6').css({ 
6379			'opacity' : 1
6380		});
6381
6382		
6383
6384		if (window.addEventListener) {
6385			 window.addEventListener('scroll', function(){ 
6386	          requestAnimationFrame(bindHeaderParallax); 
6387	        }, false);
6388		}
6389
6390	} 
6391
6392	if($('#page-header-bg').length > 0) {
6393		var $initialImgCheckAscend = extractUrl($('#page-header-bg').css('background-image'));
6394		if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) {    
6395			   $('#page-header-bg').addClass('has-bg');
6396		}
6397	}
6398}
6399
6400if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
6401	window.onunload = function(){ nectarPageHeader(); };
6402}
6403
6404
6405/***************** header text effects *****************/
6406
6407// rotate in
6408function pageHeaderTextEffectInit() {
6409	$('#page-header-bg').each(function(){
6410		if($(this).attr('data-text-effect') == 'rotate_in') {
6411			var $topHeading = 'none';
6412
6413			if($(this).find('.span_6 h1').length > 0) {
6414				$topHeading = 'h1';
6415			} 
6416			//else if ($(this).find('.span_6 h2').length > 0) {
6417			//	$topHeading = 'h2';
6418			//}
6419
6420			if($topHeading != 'none') {
6421
6422				var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6';
6423
6424				$(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () {
6425			        return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, "");
6426			    }).wrap('<span class="wraped"></span>');
6427
6428			    $(this).find($selector).find('.wraped').each(function () {
6429
6430				    textNode = $(this);
6431
6432				    text = textNode.text().split(' ');
6433				    replace = '';
6434
6435				    $.each(text, function (index, value) {
6436				        if (value.replace(/\s+/, "")) {
6437				            replace += '<span class="wraped"><span>' + value + '</span></span> ';
6438				        }
6439				    });
6440				    textNode.replaceWith($(replace));
6441				    
6442				});
6443			}//make sure suitable heading was found
6444
6445		}//tilt
6446	});
6447	
6448}
6449function pageHeaderTextEffect() {
6450
6451	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) {
6452
6453		var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6';
6454
6455		$($selector).find('.wraped').each(function(i){
6456			$(this).find('span').delay(i*370).transition({ rotateX: '0', 'opacity' : 1, y: 0},400,'easeOutQuad');
6457		});
6458
6459		setTimeout(function(){
6460
6461			$($selector).find('.inner-wrap > *:not(.top-heading)').each(function(i){
6462				$(this).delay(i*370).transition({ rotateX: '0', 'opacity' : 1, y: 0 },650,'easeOutQuad');
6463			});
6464
6465			$('.scroll-down-wrap').removeClass('hidden');
6466
6467		}, $($selector).find('.wraped').length * 370);
6468	}
6469
6470}
6471var $effectTimeout = ($('#ajax-loading-screen').length > 0) ? 800 : 0;
6472pageHeaderTextEffectInit();
6473if($('#page-header-bg .nectar-video-wrap video').length == 0) setTimeout(pageHeaderTextEffect,$effectTimeout);
6474
6475
6476
6477
6478 //submenu fix
6479  if($('header#top nav > ul.sf-menu ul').length > 0) {
6480
6481  	var $midnightSubmenuTimeout;
6482  	$('body').on('mouseover','#header-outer .midnightHeader .sf-with-ul, #header-outer .midnightHeader .cart-menu',function(){
6483
6484  		if($(this).parents('.midnightHeader').offset().top - $(window).scrollTop() < 50){
6485  		
6486  			$(this).parents('.midnightHeader').css({'z-index': '9999'}).addClass('overflow');
6487  			$(this).parents('.midnightInner').css('overflow','visible');
6488  		}
6489  	});
6490  	$('body').on('mouseleave','#header-outer .midnightHeader',function(){
6491  		var $that = $(this);
6492  		clearTimeout($midnightSubmenuTimeout);
6493  		$midnightSubmenuTimeout = setTimeout(function(){
6494  			if(!$that.is(':hover')) {
6495  				$that.css({'z-index': 'auto'}).removeClass('overflow');
6496  				$that.find('.midnightInner').css('overflow','hidden');
6497  		
6498  			}
6499
6500  		},900);
6501  	});
6502  }
6503
6504  function midnightInit() {
6505  	if( $('#header-outer[data-permanent-transparent="1"]').length > 0 && $('body[data-bg-header="true"]').length > 0) {
6506  		 $('#header-outer').midnight();
6507
6508  		 //no menu
6509  		 if($('#header-outer[data-has-menu="false"]').length > 0 && $('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
6510  			 //fix the pointer events
6511  			 //var enableHandler = false;
6512
6513  			 var $buttonsOffset = ($('#social-in-menu').length > 0) ? $('#social-in-menu').position() : $('#header-outer header#top nav > ul.buttons').position();
6514  			 if($('#header-outer #logo img:visible').length > 0) {
6515  			 	var $logoOffset = $('#header-outer #logo img:visible').position();
6516  			 	var $logoOffsetTop = $('#header-outer #logo img:visible').position().top;
6517  			 	var $logoMargin = parseInt($('#header-outer #logo img:visible').css('margin-top'));
6518  			 	var $logoWidth = $('#header-outer #logo img:visible').width();
6519  			 } else {
6520  			 	var $logoOffset = $('#header-outer .span_3 #logo:visible').offset();
6521  			 	var $logoOffsetTop = $('#header-outer .span_3 #logo:visible').offset().top - $(window).scrollTop();
6522  			 	var $logoMargin = parseInt($('#header-outer .span_3 #logo:visible').css('margin-top'));
6523  			 	var $logoWidth = $('#header-outer #logo').width();
6524  			 }
6525  			 var $bodyBorderSize = ($('.body-border-top').length > 0) ? $('.body-border-top').height() : 0;
6526
6527  			 var $containerMargin = parseInt($('#header-outer header > .container').css('padding-left'));
6528  			 var $headerOffset = $('#header-outer').position();
6529  			 //recalc offsets
6530  			 $(window).on('smartresize', function(){
6531  			 	if($('#header-outer #logo img').length > 0) {
6532  				 	$logoMargin = parseInt($('#header-outer #logo img:visible').css('margin-top'));
6533  				 	$logoOffset = $('#header-outer #logo img:visible').position();
6534  				 	$logoOffsetTop = $('#header-outer #logo img:visible').position().top;
6535  				 	$logoWidth = $('#header-outer #logo img:visible').width();
6536  				 } else {
6537  				 	$logoMargin = parseInt($('#header-outer .span_3 #logo:visible').css('margin-top'));
6538  				 	$logoOffset = $('#header-outer .span_3 #logo:visible').offset();
6539  				 	$logoOffsetTop = $('#header-outer .span_3 #logo:visible').offset().top - $(window).scrollTop();
6540  				 	$logoWidth = $('#header-outer #logo').width();
6541  				 }
6542  			 	$containerMargin = parseInt($('#header-outer header > .container').css('padding-left'));
6543  			    $buttonsOffset = ($('#social-in-menu').length > 0) ? $('#social-in-menu').position() : $('#header-outer header#top nav > ul.buttons').position();
6544  			    $headerOffset = $('#header-outer').position();
6545  			 });
6546
6547  			 $('body').mousemove(function(e){
6548  			 	if($('body.mobile').length == 0) {
6549  			 	
6550  					 	//hover over buttons || logo check
6551  					 	if(e.clientX >= $buttonsOffset.left + $containerMargin && 
6552  					 	   e.clientY >= $buttonsOffset.top + $bodyBorderSize && 
6553  					 	   e.clientY <= $buttonsOffset.top + $headerOffset.top + $bodyBorderSize + $('#header-outer header#top nav > ul.buttons').height() ||
6554  					 	   e.clientX <= $logoOffset.left + $containerMargin + $logoWidth &&
6555  					 	   e.clientY >= $logoOffsetTop + $bodyBorderSize&& 
6556  					 	   e.clientY <= $logoOffsetTop + $logoMargin + $bodyBorderSize + $headerOffset.top + $('#header-outer #logo img:visible').height() ) {
6557  					 		$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
6558
6559  					 	} else {
6560  					 		$('.midnightHeader, #header-outer').addClass('no-pointer-events');
6561  					 	}
6562
6563  					
6564  				} else {
6565  					$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
6566  				}
6567  			 });
6568
6569  	
6570  		}
6571
6572  		//using menu
6573  		else if($('#header-outer[data-has-menu="true"]').length > 0) {
6574
6575  			 var $headerPos = $('header#top .container').position();
6576  			 var $headerOffset = $('header#top .container').offset();
6577  			 var $bodyBorderSize = ($('.body-border-top').length > 0) ? $('.body-border-top').height() : 0;
6578
6579  			 //recalc offsets
6580  			 $(window).on('smartresize', function(){
6581  			 	
6582  			    $headerPos = $('header#top .container').position();
6583  			    $headerOffset = $('header#top .container').offset();
6584
6585  			 });
6586
6587  			 $('body').mousemove(function(e){
6588  			 	if($('body.mobile').length == 0) {
6589
6590  					 	//hover over buttons || logo check
6591  					 	if(e.clientX >= $headerOffset.left &&
6592  					 	   e.clientY >= $headerPos.top  + $bodyBorderSize && 
6593  					 	   e.clientY <= $('header#top .container .row').height() + $bodyBorderSize) {
6594  					 		$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
6595  					 	} else if($('li.sfHover').length == 0) {
6596  					 		$('.midnightHeader, #header-outer').addClass('no-pointer-events');
6597  					 	}
6598
6599  					
6600  				} else {
6601  					$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
6602  				}
6603  			 });
6604
6605  		}
6606  	}
6607  }
6608
6609
6610
6611//box roll
6612function getScrollbarWidth() {
6613    var outer = document.createElement("div");
6614    outer.style.visibility = "hidden";
6615    outer.style.width = "100px";
6616    outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
6617
6618    document.body.appendChild(outer);
6619
6620    var widthNoScroll = outer.offsetWidth;
6621    // force scrollbars
6622    outer.style.overflow = "scroll";
6623
6624    // add innerdiv
6625    var inner = document.createElement("div");
6626    inner.style.width = "100%";
6627    outer.appendChild(inner);        
6628
6629    var widthWithScroll = inner.offsetWidth;
6630
6631    // remove divs
6632    outer.parentNode.removeChild(outer);
6633
6634    return widthNoScroll - widthWithScroll;
6635}
6636
6637
6638function boxRollInit() {
6639	if($('.nectar-box-roll').length > 0) { 
6640
6641		$('body').attr('data-scrollbar-width',getScrollbarWidth());
6642
6643		$('body, html, #ajax-content-wrap, .container-wrap, .blurred-wrap').addClass('no-scroll');
6644		$('body,html').stop().animate({ scrollTop:0 },0);
6645		$('.container-wrap').css('opacity',0).addClass('no-transform-animation-bottom-out').addClass('bottomBoxOut');
6646		//keep loading icon centered if scrollbar is going away
6647		if($('.mobile').length == 0) $('#ajax-loading-screen .loading-icon > span').css({ 'left' : '-'+getScrollbarWidth()/2 +'px'});
6648
6649		//change content pos
6650		var $overlaid = $('#page-header-bg .overlaid-content').clone();
6651		var $scrollDownOverlaid = $('.scroll-down-wrap').clone();
6652		$('#page-header-bg').removeAttr('data-midnight');
6653		$('#page-header-bg .overlaid-content, #page-header-bg .scroll-down-wrap').remove();
6654		$('.nectar-box-roll').append($overlaid).attr('data-midnight','light');
6655		$('.overlaid-content').append($scrollDownOverlaid);
6656
6657
6658		nectarBoxRollContentHeight();
6659		setTimeout(function() { pageLoadHash(); },700);
6660	} else {
6661		$('#ajax-content-wrap, .blurred-wrap').addClass('at-content');
6662		$('body, html, #ajax-content-wrap, .container-wrap, .blurred-wrap').removeClass('no-scroll');
6663		$('.container-wrap').css('opacity',1).removeClass('no-transform-animation-bottom-out').removeClass('bottomBoxOut').removeClass('bottomBoxIn');
6664		perspect = 'not-rolled';
6665	}
6666}
6667boxRollInit();
6668
6669function nectarBoxRollContentHeight() {
6670	/*if($('#header-outer[data-transparent-header="true"]').length == 0 && $('.mobile').length == 0) {
6671		$('.nectar-box-roll').css('top',$('#header-space').height());
6672	} else {
6673		$('.nectar-box-roll').css('top','0');
6674	}*/
6675	
6676	if($('#header-outer[data-transparent-header="true"]').length == 0) {
6677		$('.nectar-box-roll .overlaid-content, .nectar-box-roll .canvas-bg, .container-wrap').css({'height':window.innerHeight - $('#header-space').height(), 'min-height':window.innerHeight - $('#header-space').height() });
6678		if($('.mobile').length == 0) { $('#ajax-content-wrap').css('margin-top',$('#header-space').height()); $('#slide-out-widget-area.fullscreen').css('margin-top','-'+$('#header-space').height()+'px'); }
6679		else $('#ajax-content-wrap, #slide-out-widget-area.fullscreen').css('margin-top','0');
6680	} else {
6681		$('.nectar-box-roll .overlaid-content, .nectar-box-roll .canvas-bg, .container-wrap').css('height',window.innerHeight);
6682	}
6683}
6684
6685if($('.nectar-box-roll').length > 0) $(window).on('resize',nectarBoxRollContentHeight);
6686
6687
6688var perspect = 'not-rolled';
6689var animating = 'false';
6690function boxRoll(e,d) {
6691	
6692	if($('#slide-out-widget-area.open').length > 0) return false;
6693	if( $('.nectar-box-roll canvas').length > 0 && $('.nectar-box-roll canvas[data-loaded="true"]').length == 0) return false;
6694
6695	if(perspect == 'not-rolled' && animating == 'false' && d == -1) {
6696		perspect = 'rolled';
6697		animating = 'true';
6698		$('body').addClass('box-animating').addClass('box-perspective-rolled').addClass('box-rolling');
6699
6700		$('.nectar-box-roll #page-header-bg').removeClass('topBoxIn').addClass('topBoxOut').css('will-change','transform');
6701		
6702		$('.nectar-box-roll .overlaid-content').removeClass('topBoxIn2').removeClass('topBoxIn').addClass('topBoxOut2').css('will-change','transform');
6703		
6704		$('.container-wrap').removeClass('bottomBoxOut').addClass('bottomBoxIn').removeClass('no-transform-animation-bottom-out').addClass('nectar-box-roll-class').css('will-change','transform');
6705		if($('#header-outer[data-transparent-header="true"]').length == 0) {
6706			$('.container-wrap').css({'height':$(window).height() - $('#header-space').height(), 'opacity': 1});
6707			$('#slide-out-widget-area.fullscreen').css('margin-top','0px');
6708		} else {
6709			$('.container-wrap').css({'height':$(window).height(), 'opacity': 1});
6710		}
6711		
6712
6713		$('.nectar-slider-wrap').css({'opacity':0});
6714
6715		updateRowRightPadding(d);
6716		pauseVideoBG();
6717
6718		//old browser workaround
6719		var timeout1 = 1220;
6720		var timeout2 = 1650;
6721		var timeout3 = 1700;
6722		var timeout4 = 1350;
6723		if( $('html.no-cssanimations').length > 0) {
6724			timeout1 = 1;
6725			timeout2 = 1;
6726			timeout3 = 1;
6727			timeout4 = 1;
6728		}
6729
6730		$('.container-wrap').css('padding-right',$('body').attr('data-scrollbar-width') + 'px');
6731		setTimeout(function(){
6732			$('#header-outer, #wpadminbar, .cart-outer .cart-menu, .midnightHeader .midnightInner').animate({'padding-right': $('body').attr('data-scrollbar-width')},250);
6733			$('.nectar-box-roll .canvas-bg').addClass('out-of-sight');
6734			if($('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent');
6735
6736			if($('body.mobile').length > 0) $('.nectar-box-roll').css({'z-index':'1'});
6737		},timeout1);
6738		setTimeout(function(){ 
6739			updateRowRightPadding(1);
6740			$('body,html,#ajax-content-wrap, .container-wrap, .blurred-wrap').removeClass('no-scroll'); 
6741			$('#ajax-content-wrap, .blurred-wrap').addClass('at-content');
6742			$('.container-wrap, #footer-outer').removeClass('bottomBoxIn').removeClass('nectar-box-roll-class').addClass('auto-height');
6743			$('#header-outer, #wpadminbar, .container-wrap, .cart-outer .cart-menu, .midnightHeader .midnightInner').stop().css('padding-right',0);
6744
6745			if( $smoothActive == 1 && $(window).width() > 690  && Modernizr.csstransforms3d && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){ 
6746				niceScrollInit();
6747			}
6748			
6749			$('.nectar-box-roll').css({'z-index':'-1000'}).transition({'y': '-200%'},0);
6750			$('.nectar-box-roll canvas').hide();
6751			$('body').removeClass('box-rolling');
6752			$('.nectar-slider-wrap').transition({'opacity':1},600,'easeOutCubic');
6753
6754			$('.nectar-box-roll #page-header-bg, .nectar-box-roll .overlaid-content, .container-wrap').css('will-change','auto');
6755			if($waypointsBound == false) waypoints();	
6756		},timeout2);
6757		
6758		//fadeIn
6759		setTimeout(function(){ 
6760			$('.container-wrap .main-content > .row > div > div[class*="col"]').css({'opacity':1});
6761		},timeout4);
6762
6763		setTimeout(function(){ 
6764					animating ='false'; 
6765					$('body').removeClass('box-animating');		
6766		},timeout3);
6767
6768		//header position when transparent nav was used
6769		if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length != 0) { 
6770			$('#ajax-content-wrap').transition({'margin-top':$('#header-outer').outerHeight(true) + $('#header-outer').offset().top},2000,'easeInOutQuad');
6771		}
6772		/*if($('#header-outer[data-transparent-header="true"]').length == 0 && $('.mobile').length == 0) {
6773			$('.nectar-box-roll').transition({'top': 0},2000,'easeInOutQuad');
6774		}*/
6775		
6776
6777		//remove header if not fixed
6778		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');
6779
6780	}
6781
6782	else if(perspect == 'rolled' && animating == 'false' && d == 1 && $(window).scrollTop() < 100) {
6783
6784		$('.container-wrap').removeClass('auto-height');
6785		if($('#header-outer[data-transparent-header="true"]').length == 0) {
6786			$('.container-wrap').css({'height':$(window).height() - $('#header-space').height(), 'opacity': 1});
6787		} else {
6788			$('.container-wrap').css({'height':$(window).height(), 'opacity': 1});
6789		}
6790		
6791		$('#footer-outer').removeClass('auto-height');
6792		$('body').addClass('box-rolling');
6793
6794		perspect = 'not-rolled';
6795		animating = 'true';
6796		$('body').addClass('box-animating').addClass('box-perspective-not-rolled');
6797
6798		$('#header-outer, #wpadminbar, .container-wrap, .cart-outer .cart-menu, .midnightHeader .midnightInner').css('padding-right',$('body').attr('data-scrollbar-width') + 'px');
6799		$('.nectar-slider-wrap').transition({'opacity':0},600,'easeOutCubic');
6800		$('.container-wrap .main-content > .row > div > div[class*="col"]').stop(true).css({'opacity':0});
6801		setTimeout(function(){
6802			$('#header-outer, #wpadminbar, .cart-outer .cart-menu, .midnightHeader .midnightInner').animate({'padding-right': 0},250);
6803			$('.nectar-box-roll .canvas-bg').removeClass('out-of-sight');
6804			resizeVideoToCover();
6805			//header position when transparent nav was used
6806			if($('#header-outer[data-transparent-header="true"]').length != 0) { 
6807				$('#ajax-content-wrap').stop(true,true).transition({'margin-top':0},2000,'easeInOutCubic');
6808			} else {
6809				if($('.mobile').length == 0) $('#slide-out-widget-area.fullscreen').css('margin-top','-'+$('#header-space').height()+'px');
6810			}
6811			//if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('.mobile').length == 0 ) $('.nectar-box-roll').transition({'top': $('#header-space').height() },2000,'easeInOutQuad');
6812			
6813		},30);
6814
6815		//old browser workaround
6816		var timeout1 = 1700;
6817		var timeout2 = 1600;
6818		var timeout3 = 1300;
6819		if( $('html.no-cssanimations').length > 0) {
6820			timeout1 = 1;
6821			timeout2 = 1;
6822			timeout3 = 1;
6823		}
6824
6825		if($('body.mobile').length > 0) {
6826			setTimeout(function(){
6827				$('.nectar-box-roll').css('z-index','1000');
6828			},timeout3);
6829		} else {
6830			$('.nectar-box-roll').css('z-index','1000');
6831		}
6832
6833		updateRowRightPadding(d);
6834		removeNiceScroll();
6835		$('.nectar-box-roll').transition({'y': '0'},0);
6836		$('.nectar-box-roll canvas').show();
6837		setTimeout(function(){ 
6838			updateRowRightPadding(1);
6839			animating ='false'; 
6840			$('body').removeClass('box-animating');
6841			$('#page-header-bg').removeClass('topBoxIn');
6842			$('.overlaid-content').removeClass('topBoxIn2');	
6843			$('body').removeClass('box-rolling');
6844			resumeVideoBG();
6845			$('.nectar-box-roll #page-header-bg, .nectar-box-roll .overlaid-content, .container-wrap').css('will-change','auto');
6846		},timeout1);
6847
6848		setTimeout(function(){
6849			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');
6850		},timeout2);
6851
6852		$('body,html,#ajax-content-wrap, .container-wrap, .blurred-wrap').addClass('no-scroll');
6853		$('#ajax-content-wrap, .blurred-wrap').removeClass('at-content');
6854		$('.container-wrap').addClass('nectar-box-roll-class');
6855		$('.nectar-box-roll #page-header-bg').removeClass('topBoxOut').addClass('topBoxIn').css('will-change','transform');
6856		
6857		$('.container-wrap').removeClass('bottomBoxIn').addClass('bottomBoxOut').css('will-change','transform');
6858
6859		if($('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').addClass('transparent');
6860
6861		$('.nectar-box-roll .overlaid-content').removeClass('topBoxOut2').removeClass('topBoxOut').addClass('topBoxIn2').css('will-change','transform');
6862	
6863		if($('#header-outer[data-header-resize="1"]').length > 0) { bigNav(); }
6864
6865		$('.nectar-box-roll .trigger-scroll-down').removeClass('hovered');
6866	}
6867
6868	
6869}
6870
6871function boxScrollEvent(event, delta) {
6872	if($('#slide-out-widget-area.open.fullscreen').length > 0) return false;
6873	boxRoll(event,delta);
6874}
6875
6876function boxRollMouseWheelInit() {
6877	if($('.nectar-box-roll').length > 0) {
6878		$('body').on("mousewheel", boxScrollEvent);
6879	} else {
6880		$('body').off("mousewheel", boxScrollEvent);
6881	}
6882}
6883
6884boxRollMouseWheelInit();
6885
6886$('body').on('click','.nectar-box-roll .section-down-arrow',function(){
6887	boxRoll(null,-1);
6888	$(this).addClass('hovered');
6889	setTimeout(function(){ $('.nectar-box-roll .section-down-arrow').removeClass('hovered'); },2000);
6890	return false;
6891});
6892
6893
6894
6895function updateRowRightPadding(d){
6896	$('.wpb_row.full-width-section').each(function(){
6897		if($(this).hasClass('extraPadding') && d == 1) {
6898			$(this).css('padding-right',parseInt($(this).css('padding-right')) - parseInt($('body').attr('data-scrollbar-width')) + 'px' ).removeClass('extraPadding');
6899		} else {
6900			$(this).css('padding-right',parseInt($('body').attr('data-scrollbar-width')) + parseInt($(this).css('padding-right')) + 'px' ).addClass('extraPadding');
6901		}	
6902	});
6903	$('.wpb_row.full-width-content').each(function(){
6904		if($(this).find('.row-bg.using-image').length == 0) {
6905			if($(this).hasClass('extraPadding') && d == 1) {
6906				$(this).find('.row-bg').css('width',parseInt($(this).width()) - parseInt($('body').attr('data-scrollbar-width')) + 'px' ).removeClass('extraPadding');
6907			} else {
6908				$(this).find('.row-bg').css('width',parseInt($('body').attr('data-scrollbar-width')) + $(this).width() + 'px' ).addClass('extraPadding');
6909			}	
6910		}
6911	});
6912}
6913
6914function pauseVideoBG() {
6915	if($('.nectar-box-roll video').length > 0) $('.nectar-box-roll video')[0].pause(); 
6916}
6917function resumeVideoBG() {
6918	if($('.nectar-box-roll video').length > 0) $('.nectar-box-roll video')[0].play(); 
6919}
6920
6921//touch 
6922if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && $('.nectar-box-roll').length > 0) {
6923	$('body').swipe({
6924		swipeStatus: function(event, phase, direction, distance, duration, fingers) {
6925			if($('#slide-out-widget-area.open').length > 0) return false;
6926			if(direction == 'up') {
6927				boxRoll(null,-1);
6928				if($('#ajax-content-wrap.no-scroll').length == 0) $('body').swipe("option", "allowPageScroll", 'vertical');
6929			} else if(direction == "down" && $(window).scrollTop() == 0) {
6930				boxRoll(null,1);
6931				$('body').swipe("option", "allowPageScroll", 'auto');
6932			}
6933		}
6934	});
6935
6936}
6937
6938function removeNiceScroll() {
6939		if($().niceScroll && $("html").getNiceScroll()){
6940			var nice = $("html").getNiceScroll();
6941			nice.stop();
6942			
6943			$('html').removeClass('no-overflow-y');
6944			$('.nicescroll-rails').hide();
6945			if($('#boxed').length == 0){
6946				$('body, body #header-outer, body #header-secondary-outer, body #search-outer, .midnightHeader .midnightInner').css('padding-right','0px');
6947			} else if($('body[data-ext-responsive="true"]').length == 0 ) {
6948				$('body').css('padding-right','0px');
6949			}
6950
6951			$('body').attr('data-smooth-scrolling','0');
6952		}
6953	}
6954//called after box roll
6955$waypointsBound = false;
6956function waypoints() {
6957	colAndImgAnimations(); 
6958	progressBars(); 
6959	dividers();
6960	iconList();
6961	animated_titles();
6962	imageWithHotspots();
6963	clientsFadeIn(); 
6964	splitLineHeadings();
6965	svgAnimations(); 
6966	milestoneInit();
6967	nectar_fancy_ul_init();
6968	owl_carousel_animate();
6969	headerRowColorInheritInit();
6970	morphingOutlines(); 
6971	$waypointsBound = true;
6972}
6973
6974
6975
6976/***************** WooCommerce Cart *****************/
6977var timeout;
6978var productToAdd;
6979
6980//notification
6981$('body').on('click','.product .add_to_cart_button', function(){
6982	productToAdd = $(this).parents('li').find('h3').text();
6983	$('#header-outer .cart-notification span.item-name').html(productToAdd);
6984
6985	//if($('.cart-menu-wrap').hasClass('first-load')) $('.cart-menu-wrap').removeClass('first-load').addClass('static');
6986});
6987
6988//notification hover
6989$('body').on('mouseenter','#header-outer .cart-notification',function(){
6990	$(this).fadeOut(400);
6991	$('#header-outer .widget_shopping_cart').stop(true,true).fadeIn(300);
6992	$('#header-outer .cart_list').stop(true,true).fadeIn(300);
6993	clearTimeout(timeout);
6994});
6995
6996//cart dropdown
6997$('#header-outer div.cart-outer').hoverIntent(function(){
6998	$('#header-outer .widget_shopping_cart').stop(true,true).fadeIn(300);
6999	$('#header-outer .cart_list').stop(true,true).fadeIn(300);
7000	clearTimeout(timeout);
7001	$('#header-outer .cart-notification').fadeOut(300);
7002});
7003
7004
7005$('body').on('mouseleave','#header-outer div.cart-outer',function(){
7006	var $that = $(this);
7007	setTimeout(function(){
7008		if(!$that.is(':hover')){
7009			$('#header-outer .widget_shopping_cart').stop(true,true).fadeOut(300);
7010			$('#header-outer .cart_list').stop(true,true).fadeOut(300);
7011		}
7012	},100);
7013});
7014
7015if($('#header-outer[data-cart="false"]').length == 0) {
7016	$('body').on('added_to_cart', shopping_cart_dropdown_show);
7017	$('body').on('added_to_cart', shopping_cart_dropdown);
7018}
7019
7020function shopping_cart_dropdown() {
7021		
7022		if(!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 ) {
7023			$('.cart-menu-wrap').addClass('has_products');
7024			$('header#top nav > ul, #search-outer #search #close a').addClass('product_added');
7025
7026			if(!$('.cart-menu-wrap').hasClass('static')) $('.cart-menu-wrap').addClass('first-load');
7027
7028			//nectar slider nav directional effect
7029			if($('#header-outer').hasClass('directional-nav-effect') && $('#header-outer .cart-icon-wrap .dark').length == 0 && $('body.ascend').length > 0){
7030				$('#header-outer .cart-outer .cart-icon-wrap').each(function(){
7031                    $(this).find('> i, > span.light, > span.dark, > span.original').remove();
7032                    $(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>');
7033                	$(this).find('.original').attr('data-w',$(this).find('span.original').width()+1);
7034                });
7035			}
7036		}
7037
7038}
7039
7040
7041function shopping_cart_dropdown_show(e) {
7042		
7043		clearTimeout(timeout);
7044		
7045		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' ) {
7046			//before cart has slide in
7047			if(!$('#header-outer .cart-menu-wrap').hasClass('has_products')) {
7048				setTimeout(function(){ $('#header-outer .cart-notification').fadeIn(400); },400);
7049			}
7050			else if(!$('#header-outer .cart-notification').is(':visible')) {
7051				$('#header-outer .cart-notification').fadeIn(400);
7052			} else {
7053				$('#header-outer .cart-notification').show();
7054			}
7055			timeout = setTimeout(hideCart,2700);
7056
7057			$('.cart-menu a, .widget_shopping_cart a').addClass('no-ajaxy');
7058		}
7059}
7060
7061function hideCart() {
7062	$('#header-outer .cart-notification').stop(true,true).fadeOut();
7063}
7064
7065function checkForWooItems(){ 
7066	var checkForCartItems = setInterval(shopping_cart_dropdown,250);
7067	setTimeout(function(){ clearInterval(checkForCartItems); },4500);
7068}
7069if($('#header-outer[data-cart="false"]').length == 0) {
7070	checkForWooItems();
7071}
7072
7073var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
7074var secondaryHeader = ($('#header-outer').attr('data-using-secondary') == '1') ? 32 : 0 ;
7075function searchFieldCenter(){
7076	$('#search-outer').css('top',$('#header-outer').outerHeight() + extraHeight + secondaryHeader);
7077	$('#search-outer > #search #search-box').css('top',($(window).height()/2) - ($('#search-outer > #search input').height()/2) - $('#header-outer').outerHeight() );
7078}
7079
7080//text on hover effect
7081$('body').on('mouseover','.text_on_hover .product-wrap',function(){
7082	$(this).parent().addClass('hovered');
7083	//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');
7084});
7085$('body').on('mouseover','.text_on_hover > a:first-child',function(){
7086	$(this).parent().addClass('hovered');
7087});
7088
7089$('body').on('mouseout','.text_on_hover .product-wrap',function(){
7090	$(this).parent().removeClass('hovered');
7091	//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);
7092});
7093$('body').on('mouseout','.text_on_hover > a:first-child',function(){
7094	$(this).parent().removeClass('hovered');
7095});
7096
7097/*
7098$('.text_on_hover.product .star-rating span').each(function(){
7099	$(this).attr('data-width',$(this).width());
7100	$(this).css('width', $(this).attr('data-width') - 40);
7101});*/
7102
7103
7104/***************** Search ******************/
7105	var $placeholder = $('#search input[type=text]').attr('data-placeholder');
7106	var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
7107	
7108	////search box event
7109	$('body').on('click', '#search-btn a', function(){ return false; });
7110	$('body').on('mousedown', '#search-btn a:not(.inactive)', function(){
7111
7112		if($(this).hasClass('open-search')) { return false; } 
7113
7114		if($('body').hasClass('ascend')){ 
7115			$('#search-outer > #search form, #search-outer #search .span_12 span').css('opacity',0);
7116			$('#search-outer > #search form').css('bottom','10px');
7117			$('#search-outer #search .span_12 span').css('top','10px');
7118			$('#search-outer').show();
7119			$('#search-outer').stop().transition({scale: '1,0', 'opacity': 1},0).transition({ scale: '1,1'},400,'easeInOutCubic');
7120
7121			$('#search-outer > #search form').delay(400).animate({'opacity':1, 'bottom':0},'easeOutCirc');
7122			$('#search-outer #search .span_12 span').delay(470).animate({'opacity':1, 'top':0},'easeOutCirc');
7123			
7124		} else {
7125			$('#search-outer').stop(true).fadeIn(600,'easeOutExpo');
7126		}
7127
7128		$('body:not(.ascend) #search-outer > #search input[type="text"]').css({
7129			'top' : $('#search-outer').height()/2 - $('#search-outer > #search input[type="text"]').height()/2
7130		});
7131		
7132		setTimeout(function(){
7133
7134			$('#search input[type=text]').focus();
7135			
7136			if($('#search input[type=text]').attr('value') == $placeholder){
7137				$('#search input[type=text]').setCursorPosition(0);	
7138			}
7139
7140		},300);
7141
7142		//ascend
7143		if($('body').hasClass('ascend')){ 
7144			searchFieldCenter();
7145		}
7146
7147		$(this).toggleClass('open-search');
7148
7149		//close slide out widget area
7150		$('.slide-out-widget-area-toggle a.open:not(.animating)').trigger('click');
7151
7152		return false;
7153	});
7154	
7155	$('body').on('keydown','#search input[type=text]',function(){
7156		if($(this).attr('value') == $placeholder){
7157			$(this).attr('value', '');
7158		}
7159	});
7160	
7161	$('body').on('keyup','#search input[type=text]',function(){
7162		if($(this).attr('value') == ''){
7163			$(this).attr('value', $placeholder);
7164			$(this).setCursorPosition(0);
7165		}
7166	});
7167	
7168	
7169	////close search btn event
7170	$('body').on('click','#close',function(){
7171		closeSearch();
7172		$('#search-btn a').removeClass('open-search');
7173		return false;
7174	});
7175
7176	//if user clicks away from the search close it
7177	$('body').on('blur','#search-box input[type=text]',function(e){
7178		closeSearch();
7179		$('#search-btn a').removeClass('open-search');
7180	});
7181	
7182	
7183	function closeSearch(){
7184		if($('body').hasClass('ascend')){ 
7185			$('#search-outer').stop().transition({'opacity' :0},300,'easeOutCubic');
7186			$('#search-btn a').addClass('inactive');
7187			setTimeout(function(){ $('#search-outer').hide(); $('#search-btn a').removeClass('inactive'); },300);
7188		} else {
7189			$('#search-outer').stop(true).fadeOut(450,'easeOutExpo');
7190		}
7191	}
7192	
7193	
7194	//mobile search
7195	$('body').on('click', '#mobile-menu #mobile-search .container a#show-search',function(){
7196		$('#mobile-menu .container > ul').slideUp(500);
7197		return false;
7198	});
7199	
7200/***************** Nav ******************/
7201
7202	function centeredLogoMargins() {
7203
7204		if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $(window).width() > 1000) {
7205			$midnightSelector = ($('#header-outer .midnightHeader').length > 0) ? '> .midnightHeader:first-child' : '';
7206			var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] '+$midnightSelector+' nav > .sf-menu > li').length;
7207			if($('#header-outer #social-in-menu').length > 0) $navItemLength--;
7208
7209			$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());
7210
7211			$('#header-outer[data-format="centered-logo-between-menu"] nav > .sf-menu > li:nth-child('+Math.floor($navItemLength/2)+')').css({'margin-right': ($centerLogoWidth+40) + 'px'}).addClass('menu-item-with-margin');
7212			$leftMenuWidth = 0;
7213			$rightMenuWidth = 0;
7214			$('#header-outer[data-format="centered-logo-between-menu"] '+$midnightSelector+' nav > .sf-menu > li:not(#social-in-menu)').each(function(i){
7215				if(i+1 <= Math.floor($navItemLength/2)) {
7216					$leftMenuWidth += $(this).width();
7217				} else {
7218					$rightMenuWidth += $(this).width();
7219				}
7220
7221			});
7222
7223			$menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth);
7224
7225			if($leftMenuWidth > $rightMenuWidth) 
7226				$('#header-outer .row > .col.span_9').css('padding-right',$menuDiff);
7227			else 
7228				$('#header-outer .row > .col.span_9').css('padding-left',$menuDiff);
7229
7230			$('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility','visible');
7231		}
7232	}
7233	
7234	var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
7235	var headerPadding = parseInt($('#header-outer').attr('data-padding'));
7236	var usingLogoImage = $('#header-outer').attr('data-using-logo');
7237	
7238	if( isNaN(headerPadding) || headerPadding.length == 0 ) { headerPadding = 28; }
7239	if( isNaN(logoHeight) || usingLogoImage.length == 0 ) { usingLogoImage = false; logoHeight = 30;}
7240	
7241	//inital calculations
7242	function headerInit() {
7243			
7244		$('#header-outer #logo img').css({
7245			'height' : logoHeight,				
7246		});	
7247		
7248		$('#header-outer').css({
7249			'padding-top' : headerPadding
7250		});	
7251		
7252		if($('body.mobile').length == 0) {
7253			$('header#top nav > ul > li:not(#social-in-menu) > a').css({
7254				'padding-bottom' : Math.floor( ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding),
7255				'padding-top' : Math.floor( (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2))
7256			});	
7257
7258			$('header#top nav > ul > li#social-in-menu > a').css({
7259				'margin-bottom' : Math.floor( ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding),
7260				'margin-top' : Math.floor( (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2))
7261			});	
7262		}
7263		
7264		if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
7265			$('#header-outer .cart-menu').css({  
7266				'padding-bottom' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding),
7267				'padding-top' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding)
7268			});	
7269		} else {
7270			$('#header-outer .cart-menu').css({  
7271				'padding-bottom' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding + logoHeight/2 + 7),
7272				'padding-top' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding + logoHeight/2 + 7)
7273			});	
7274		}
7275		
7276			
7277		$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').css({
7278			'padding-bottom' : (logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2),
7279			'padding-top' : (logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2)
7280		});	
7281
7282		$('.slide-out-hover-icon-effect a').css({
7283			'padding-top' : headerPadding
7284		});	
7285
7286		
7287		if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
7288			$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').css({
7289				'padding-top': 0,
7290				'padding-bottom': 0
7291			});
7292
7293			$('header#top nav > ul.buttons').css({
7294				'margin-top' : - headerPadding,
7295				'height' : Math.floor(logoHeight + headerPadding*2) -1
7296			});
7297
7298			$('header#top nav > ul li#search-btn a, header#top nav > ul li.slide-out-widget-area-toggle a, .slide-out-hover-icon-effect a').css({
7299				'visibility' : 'visible',
7300				'padding-top': Math.floor((logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding),
7301				'padding-bottom': Math.floor((logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding)
7302			});
7303		}
7304		
7305		$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').css({
7306			'top' : $('header#top nav > ul > li > a').outerHeight() 
7307		});	
7308		
7309		
7310		setTimeout(function(){ 
7311			$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').css({
7312				'top': parseInt($('#header-outer').outerHeight())+'px'
7313			}); 
7314		},1000);
7315		
7316		$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').css({
7317			'top': parseInt($('#header-outer').outerHeight())+'px'
7318		});
7319
7320		//header space
7321		if($('.nectar-parallax-scene.first-section').length == 0) {
7322
7323			if($('#header-outer').attr('data-using-secondary') == '1'){
7324				if($('#header-outer[data-mobile-fixed="false"]').length > 0  || $('body.mobile').length == 0 ) {
7325					$('#header-space').css('height', parseInt($('#header-outer').outerHeight()) + $('#header-secondary-outer').height());
7326					
7327				} else {
7328					$('#header-space').css('height', parseInt($('#header-outer').outerHeight()));
7329					
7330				}
7331				
7332			} else {
7333
7334				$('#header-space').css('height', $('#header-outer').outerHeight() );
7335			} 
7336		}
7337		
7338		$('#header-outer .container, #header-outer .cart-menu').css('visibility','visible');
7339		
7340		centeredLogoMargins();
7341
7342		if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
7343			$('body:not(.ascend) #search-outer, #search .container').css({
7344				'height' : logoHeight + headerPadding*2
7345			});	
7346			
7347			$('body:not(.ascend) #search-outer > #search input[type="text"]').css({
7348				'font-size'  : 43,
7349				'height' : '59px',
7350				'top' : ((logoHeight + headerPadding*2)/2) - $('#search-outer > #search input[type="text"]').height()/2
7351			});
7352			
7353			$('body:not(.ascend) #search-outer > #search #close a').css({
7354				'top' : ((logoHeight + headerPadding*2)/2) - 8
7355			});	
7356		} else {
7357			$('body:not(.ascend) #search-outer, #search .container').css({
7358				'height' : logoHeight + headerPadding*2 + logoHeight + 17
7359			});	
7360			
7361			$('body:not(.ascend) #search-outer > #search input[type="text"]').css({
7362				'font-size'  : 43,
7363				'height' : '59px',
7364				'top' : ((logoHeight + headerPadding*2)/2) - ($('#search-outer > #search input[type="text"]').height()/2) + logoHeight/2 + 17
7365			});
7366			
7367			$('body:not(.ascend) #search-outer > #search #close a').css({
7368				'top' : ((logoHeight + headerPadding*2)/2) - 8 + logoHeight/2 + 17
7369			});	
7370		}
7371		
7372		//if no image is being used
7373		//if(usingLogoImage == false) $('header#top #logo').addClass('no-image');
7374		
7375	}
7376	
7377	//one last check to make sure the header space is correct (only if the user hasn't scrolled yet)
7378	$(window).load(function(){
7379		if($(window).scrollTop() == 0 ) headerSpace();
7380	});
7381	
7382	
7383	//is header resize on scroll enabled?
7384	var headerResize = $('#header-outer').attr('data-header-resize');
7385	var headerHideUntilNeeded = $('body').attr('data-hhun');
7386
7387	//transparent fix
7388	if($(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) $('#header-outer').removeClass('transparent');
7389
7390	if( headerResize == 1 && headerHideUntilNeeded != '1'){
7391		
7392		headerInit();
7393
7394		$(window).off('scroll.headerResizeEffect');
7395
7396		if($('#nectar_fullscreen_rows').length == 0)
7397			$(window).on('scroll.headerResizeEffect',smallNav);
7398
7399	} else if(headerHideUntilNeeded != '1') {
7400		headerInit();
7401		$(window).off('scroll.headerResizeEffectOpaque');
7402		$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
7403		
7404	} else if(headerHideUntilNeeded == '1') {
7405
7406		headerInit();
7407
7408		if($('.nectar-box-roll').length > 0) $('#header-outer').addClass('at-top-before-box');
7409
7410		var previousScroll = 0, // previous scroll position
7411        menuOffset = $('#header-space').height()*2, // height of menu (once scroll passed it, menu is hidden)
7412        detachPoint = ($('body.mobile').length > 0) ? 150 : 600, // point of detach (after scroll passed it, menu is fixed)
7413        hideShowOffset = 6; // scrolling value after which triggers hide/show menu
7414
7415	    // on scroll hide/show menu
7416	    function hhunCalcs(e) {
7417
7418	     //stop scrolling while animated anchors
7419	     if($('body.animated-scrolling').length > 0 && $('#header-outer.detached').length > 0) return false;
7420
7421	     //stop on mobile if not using sticky option
7422	      if($('#header-outer[data-mobile-fixed="false"]').length > 0 && $('body.mobile').length > 0) {  $('#header-outer').removeClass('detached'); return false; }
7423
7424	      var currentScroll = $(this).scrollTop(), // gets current scroll position
7425	            scrollDifference = Math.abs(currentScroll - previousScroll); // calculates how fast user is scrolling
7426
7427	      if (!$('#header-outer').hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) {
7428	       
7429	        // if scrolled past menu
7430	        if (currentScroll > menuOffset) {
7431	          // if scrolled past detach point add class to fix menu
7432	          if (currentScroll > detachPoint) {
7433	            if (!$('#header-outer').hasClass('detached'))
7434	              $('#header-outer').addClass('detached').removeClass('parallax-contained');
7435	         
7436	          	  if($('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent');
7437	          }
7438
7439	          // if scrolling faster than hideShowOffset hide/show menu
7440	          if (scrollDifference >= hideShowOffset) {
7441	            if (currentScroll > previousScroll) {
7442	              // scrolling down; hide menu
7443	              if (!$('#header-outer').hasClass('invisible'))
7444	                $('#header-outer').addClass('invisible').removeClass('at-top');
7445	                $('.page-submenu.stuck').css('transform','translateY(0px)').addClass('header-not-visible');
7446	            	
7447	            } else {
7448	              // scrolling up; show menu
7449	              if ($('#header-outer').hasClass('invisible'))
7450	                $('#header-outer').removeClass('invisible');
7451	          	    $('.page-submenu.stuck').css('transform','translateY('+$('#header-outer').outerHeight()+'px)').removeClass('header-not-visible');
7452	            }
7453	          }
7454	        } else {
7455	          // only remove “detached” class if user is at the top of document (menu jump fix)
7456	          $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 : 0;
7457	          if($('.body-border-top').length > 0) {
7458	          		$topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 + $('.body-border-top').height() : $('.body-border-top').height();
7459	          }
7460
7461	          if (currentScroll <= $topDetachNum){
7462	            $('#header-outer').removeClass('detached').addClass('at-top');
7463	            
7464	            if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent').css('transform','translateY(0)');
7465	            else if($('.nectar-box-roll').length > 0) $('#header-outer').css('transform','translateY(0)').addClass('at-top-before-box');
7466
7467	            if($('.parallax_slider_outer').length >
7467 0 || $('#page-header-bg[data-parallax="1"]').length > 0) $('#header-outer').addClass('parallax-contained').css('transform','translateY(0)');
7468	          }
7469	        }
7470
7471	        // if user is at the bottom of document show menu
7472	        if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
7473	          $('#header-outer').removeClass('invisible');
7474	          $('.page-submenu.stuck').css('transform','translateY('+$('#header-outer').outerHeight()+'px)').removeClass('header-not-visible');
7475	        }
7476
7477	      }
7478
7479	      // replace previous scroll position with new one
7480	      previousScroll = currentScroll;
7481
7482	    }
7483
7484	    hhunCalcs();
7485	    $(window).scroll(hhunCalcs);
7486
7487
7488	}//end if hhun
7489	
7490	if($('#nectar_fullscreen_rows').length == 0) midnightInit(); //init midnight	
7491	else ($('#header-outer').attr('data-permanent-transparent','false'))
7492
7493	var shrinkNum = 6;
7494	var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
7495	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;
7496	if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
7497
7498	function smallNav(){
7499		var $offset = $(window).scrollTop();
7500		var $windowWidth = $(window).width();
7501		
7502
7503		if($offset > 0 && $windowWidth > 1000) {
7504			
7505			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');
7506			$('.ns-loading-cover').hide();
7507			
7508			$('#header-outer, #search-outer').addClass('small-nav');
7509			
7510			$('#header-outer #logo img').stop(true,true).animate({
7511				'height' : logoHeight - shrinkNum
7512			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7513				
7514			$('#header-outer').stop(true,true).animate({
7515				'padding-top' : Math.ceil(headerPadding / 1.8)
7516			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7517			
7518
7519			$('header#top nav > ul > li:not(#social-in-menu) > a').stop(true,true).animate({
7520				'padding-bottom' :  Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding / 1.8) ,
7521				'padding-top' :  Math.floor(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) 
7522			},{queue:false, duration:250, easing: 'easeOutCubic'});	 
7523
7524			//body border full width side padding
7525			if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true) {
7526				$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
7527					'padding' : '0'			
7528				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7529			}
7530
7531			$('header#top nav > ul > li#social-in-menu > a').stop(true,true).animate({
7532				'margin-bottom' :  Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding / 1.8) ,
7533				'margin-top' :  Math.floor(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) 
7534			},{queue:false, duration:250, easing: 'easeOutCubic'});	 
7535			
7536			$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
7537				'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(shrinkNum)*4) +'px'
7538			},{queue:false, duration:250, easing: 'easeOutCubic'});	 
7539
7540			if($bodyBorderHeaderColorMatch == true) {
7541				$('.body-border-top').stop(true,true).animate({
7542					'margin-top': '-'+$('.body-border-top').height()+'px'
7543				},{queue:false, duration:400, easing: 'easeOutCubic', complete: function() { $(this).css('margin-top',0)} });	 
7544			}
7545
7546			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
7547				$('#header-outer .cart-menu').stop(true,true).animate({
7548					'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding/ 1.7),
7549					'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding/ 1.7) +1
7550				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7551			} else {
7552				/*$('#header-outer img.starting-logo').stop(true,true).animate({
7553					'margin-top' :  '-' + (logoHeight + 17 - shrinkNum) + 'px'
7554				},{queue:false, duration:250, easing: 'easeOutCubic'});	*/
7555
7556				$('#header-outer .cart-menu').stop(true,true).animate({
7557					'padding-bottom' : Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding / 1.7) + (logoHeight-shrinkNum)/2 + 9,
7558					'padding-top' : Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding / 1.7) + (logoHeight-shrinkNum)/2 + 9
7559				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7560			}
7561			
7562			if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
7563				$('header#top nav > ul.buttons').stop(true,true).animate({
7564					'margin-top' : - Math.ceil(headerPadding/ 1.8),
7565					'height' : Math.floor((headerPadding*2)/ 1.8 + logoHeight-shrinkNum)
7566				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7567
7568				$('header#top nav > ul li#search-btn a, header#top nav > ul li.slide-out-widget-area-toggle a').stop(true,true).animate({
7569					'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding/ 1.7),
7570					'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding/ 1.7) +1
7571				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7572
7573			} else {
7574				$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').stop(true,true).animate({
7575					'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul li#search-btn a').height()/2)),
7576					'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul li#search-btn a').height()/2))
7577				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7578			}
7579
7580			$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
7581				'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),
7582			},{queue:false, duration:250, easing: 'easeOutCubic'});		
7583			
7584			
7585			$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').stop(true,true).animate({
7586				'top': Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8) +'px'
7587			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7588		
7589
7590			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
7591				$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
7592					'height' : Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8)
7593				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7594
7595				$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
7596					'font-size'  : 30,
7597					'line-height' : '30px',
7598					'height' : '44px',
7599					'top' : ((logoHeight-shrinkNum+headerPadding+5)/2) - ($('#search-outer > #search input[type="text"]').height()-15)/2
7600				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7601			
7602				$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
7603					'top' : ((logoHeight-shrinkNum + headerPadding+5)/2) - 10
7604				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7605
7606			} else {
7607				$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
7608					'height' : Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8) + logoHeight - shrinkNum + 17
7609				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7610
7611				$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
7612					'font-size'  : 30,
7613					'line-height' : '30px',
7614					'height' : '44px',
7615					'top' : ((logoHeight-shrinkNum+headerPadding+5)/2) - ($('#search-outer > #search input[type="text"]').height()-15)/2 + (logoHeight- shrinkNum)/2 + 8
7616				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7617
7618				$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
7619					'top' : ((logoHeight-shrinkNum + headerPadding+5)/2) - 10 + (logoHeight- shrinkNum)/2 + 8
7620				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7621			}
7622
7623		
7624			
7625
7626			//box roll
7627			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'})
7628			
7629			
7630			if($('body').hasClass('ascend')){ 
7631				$('#search-outer').stop(true,true).animate({
7632					'top' : Math.floor((logoHeight-shrinkNum) +(headerPadding*2)/ 1.8 + extraHeight + secondaryHeader)
7633				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7634			}
7635			
7636			//if no image is being used
7637			if(usingLogoImage == false) $('header#top #logo').stop(true,true).animate({
7638				'margin-top' : 0
7639			},{queue:false, duration:450, easing: 'easeOutExpo'});	
7640			
7641			$(window).off('scroll',smallNav);
7642			$(window).on('scroll',bigNav);
7643
7644			//dark slider coloring border fix
7645			$('#header-outer[data-transparent-header="true"]').css('transition','background-color 0.40s ease, box-shadow 0.40s ease, margin 0.25s ease-out');
7646			$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','none');
7647			setTimeout(function(){ 
7648				$('#header-outer[data-transparent-header="true"]').css('transition','background-color 0.40s ease, box-shadow 0.40s ease, border-color 0.40s ease, margin 0.25s ease-out'); 
7649				$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','border-color 0.40s ease');
7650			},300);
7651
7652		}
7653
7654	}
7655	
7656	function bigNav(){
7657		var $offset = $(window).scrollTop();
7658		var $windowWidth = $(window).width();
7659
7660		if($offset == 0 && $windowWidth > 1000 || $('.small-nav').length > 0 && $('#ajax-content-wrap.no-scroll').length > 0 || $('.small-nav').length > 0 && $('.slide-out-from-right-hover.open').length > 0 || $('.small-nav').length > 0 && $('.slide-out-from-right.open').length > 0 && $bodyBorderHeaderColorMatch == true) {
7661			
7662			$('#header-outer, #search-outer').removeClass('small-nav');
7663			
7664			if($('#header-outer').attr('data-transparent-header') == 'true'  && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent');
7665			$('.ns-loading-cover').show();
7666			
7667			$('#header-outer #logo img').stop(true,true).animate({
7668				'height' : logoHeight,				
7669			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7670			
7671
7672			//body border full width side padding
7673			if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true) {
7674				$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
7675					'padding' : '0 28px'			
7676				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7677			}
7678
7679			$('#header-outer').stop(true,true).animate({
7680				'padding-top' : headerPadding 
7681			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7682			
7683			$('header#top nav > ul > li:not(#social-in-menu) > a').stop(true,true).animate({
7684				'padding-bottom' : ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding,
7685				'padding-top' : (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2) 
7686			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7687
7688			$('header#top nav > ul > li#social-in-menu > a').stop(true,true).animate({
7689				'margin-bottom' : ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding,
7690				'margin-top' : (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2) 
7691			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7692				
7693			$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
7694				'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(shrinkNum)*4) +'px'
7695			},{queue:false, duration:250, easing: 'easeOutCubic'});	 
7696
7697			if($bodyBorderHeaderColorMatch == true) {
7698				$('.body-border-top').css({ 'margin-top': '-'+$('.body-border-top').height()+'px'}).stop(true,true).animate({
7699					'margin-top': '0'
7700				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
7701			}
7702
7703			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
7704				$('#header-outer .cart-menu').stop(true,true).animate({
7705					'padding-bottom' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding),
7706					'padding-top' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding)
7707				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7708			} else {
7709				/*$('#header-outer img.starting-logo').stop(true,true).animate({
7710					'margin-top' :  '-' + (logoHeight + 17) + 'px'
7711				},{queue:false, duration:250, easing: 'easeOutCubic'});	*/
7712
7713				$('#header-outer .cart-menu').stop(true,true).animate({
7714					'padding-bottom' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding) + logoHeight/2 + 7,
7715					'padding-top' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding) + logoHeight/2 + 7
7716				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7717			}
7718
7719			if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
7720				$('header#top nav > ul.buttons').stop(true,true).animate({
7721					'margin-top' : - Math.ceil(headerPadding),
7722					'height' : Math.floor(headerPadding*2 + logoHeight) -1
7723				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7724
7725				$('header#top nav > ul li#search-btn a, header#top nav > ul li.slide-out-widget-area-toggle a').stop(true,true).animate({
7726					'padding-top': Math.floor((logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding),
7727					'padding-bottom': Math.floor((logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding)
7728				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7729			} else {
7730				$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').stop(true,true).animate({
7731					'padding-bottom' : Math.floor((logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2)),
7732					'padding-top' : Math.ceil((logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2))
7733				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7734			}
7735			
7736			$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
7737				'top' : Math.ceil($('header#top nav > ul > li > a').height() + (((logoHeight)/2) - ($('header#top nav > ul > li > a').height()/2))*2 + headerPadding),
7738			},{queue:false, duration:250, easing: 'easeOutCubic'});		
7739			
7740			$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').stop(true,true).animate({
7741				'top': Math.ceil(logoHeight + headerPadding*2) +'px'
7742			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7743			
7744			
7745			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
7746				$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
7747					'height' : Math.ceil(logoHeight + headerPadding*2)
7748				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7749				
7750				$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
7751					'font-size'  : 43,
7752					'line-height' : '43px',
7753					'height' : '59px',
7754					'top' : ((logoHeight + headerPadding*2)/2) - 30
7755				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7756				
7757				
7758				$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
7759					'top' : ((logoHeight + headerPadding*2)/2) - 8
7760				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7761				
7762			} else {
7763				$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
7764					'height' : Math.ceil(logoHeight + headerPadding*2) + logoHeight + 17
7765				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7766				
7767				$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
7768					'font-size'  : 43,
7769					'line-height' : '43px',
7770					'height' : '59px',
7771					'top' : ((logoHeight + headerPadding*2)/2) - 30 + (logoHeight)/2 + 8
7772				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7773				
7774				
7775				$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
7776					'top' : ((logoHeight + headerPadding*2)/2) - 8 + (logoHeight)/2 + 8
7777				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7778			}
7779
7780
7781			if($('body').hasClass('ascend')){ 
7782				$('#search-outer').stop(true,true).animate({
7783					'top' : (logoHeight) +(headerPadding*2) + extraHeight + secondaryHeader
7784				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7785			}
7786
7787			//if no image is being used
7788			if(usingLogoImage == false) $('header#top #logo').stop(true,true).animate({
7789				'margin-top' : 4
7790			},{queue:false, duration:450, easing: 'easeOutExpo'});	
7791			
7792
7793				//box roll
7794			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'})
7795			
7796
7797			$(window).off('scroll',bigNav);
7798			$(window).on('scroll',smallNav);
7799
7800
7801			//dark slider coloring border fix
7802			$('#header-outer[data-transparent-header="true"]').css('transition','background-color 0.40s ease, box-shadow 0.40s ease, margin 0.25s ease-out');
7803			$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','none');
7804			setTimeout(function(){ 
7805				$('#header-outer[data-transparent-header="true"]').css('transition','background-color 0.40s ease, box-shadow 0.40s ease, border-color 0.40s ease, margin 0.25s ease-out'); 
7806				$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','border-color 0.40s ease');
7807			},300);
7808		}
7809
7810	}
7811	
7812	
7813	function headerSpace() {
7814		if($('.mobile').length > 0) {
7815			if(window.innerHeight < window.innerWidth && window.innerWidth > 1000) {
7816				if($('#header-outer.small-nav').length == 0)
7817					$('#header-space').css('height', $('#header-outer').outerHeight() + $('#header-secondary-outer').height());
7818			} else {
7819				$('#header-space').css('height', $('#header-outer').outerHeight());
7820			}
7821			
7822		} else {
7823			if($('.nectar-parallax-scene.first-section').length == 0) {
7824
7825				var shrinkNum = 6;	
7826				var headerPadding = parseInt($('#header-outer').attr('data-padding'));
7827				if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
7828				var headerPadding2 = headerPadding - headerPadding/1.8;
7829				var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0 ) ? $('#header-outer').outerHeight() + (parseInt(shrinkNum) + headerPadding2*2) : $('#header-outer').outerHeight();
7830
7831				if($('#header-outer').attr('data-using-secondary') == '1'){
7832					$('#header-space').css('height', $headerHeight + $('#header-secondary-outer').height());
7833				} else {
7834					$('#header-space').css('height', $headerHeight);
7835				} 
7836			}
7837		}
7838		
7839	}
7840
7841	var lastPosition = -1;
7842	function headerOffsetAdjust(){
7843		
7844		var $scrollTop = $(window).scrollTop();
7845
7846		 if (lastPosition == $scrollTop) {
7847            requestAnimationFrame(headerOffsetAdjust);
7848            return false;
7849        } else lastPosition = $scrollTop;
7850		
7851		headerOffsetAdjustCalc();
7852
7853		requestAnimationFrame(headerOffsetAdjust);
7854
7855	}
7856
7857	function headerOffsetAdjustCalc() {
7858		if($('body.mobile').length > 0) {
7859			var $eleHeight = 0;
7860			var $endOffset = ($('#wpadminbar').css('position') == 'fixed') ? $('#wpadminbar').height() : 0;
7861			if($('#header-secondary-outer').length > 0) $eleHeight += $('#header-secondary-outer').height();
7862			if($('#wpadminbar').length > 0) $eleHeight += $('#wpadminbar').height();
7863
7864			if( $eleHeight - $scrollTop > $endOffset) { 
7865				$('#header-outer').css('top', $eleHeight - $scrollTop + 'px');
7866			}
7867			else { $('#header-outer').css('top', $endOffset); }
7868
7869		} else {
7870			var $eleHeight = 0;
7871			if($('#header-secondary-outer').length > 0) $eleHeight += $('#header-secondary-outer').height();
7872			if($('#wpadminbar').length > 0) $eleHeight += $('#wpadminbar').height();
7873			$('#header-outer').css('top',$eleHeight+'px');
7874		}
7875	}
7876
7877	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) {
7878		if($('#nectar_fullscreen_rows').length == 0) requestAnimationFrame(headerOffsetAdjust);
7879		$(window).smartresize(headerOffsetAdjustCalc);
7880	}
7881		
7882
7883	function footerRevealCalcs() {
7884		if($(window).height() - $('#wpadminbar').height() - $('#header-outer').outerHeight() - $('#footer-outer').height() - 1 -$('#page-header-bg').height() -$('.parallax_slider_outer').height() - $('.page-header-no-bg').height() > 0) {
7885			$resizeExtra = ($('#header-outer[data-header-resize="1"]').length > 0) ? 55: 0;
7886			$('.container-wrap').css({'margin-bottom': $('#footer-outer').height()-1, 'min-height': $(window).height() - $('#wpadminbar').height() - $('#header-outer').outerHeight() - $('#footer-outer').height() -1  - $('.page-header-no-bg').height() -$('#page-header-bg').height() -$('.parallax_slider_outer').height() + $resizeExtra });
7887		} else {
7888			$('.container-wrap').css({'margin-bottom': $('#footer-outer').height()-1 });
7889		}
7890		
7891		if( $(window).width() < 1000) $('#footer-outer').attr('data-midnight','light');
7892		else $('#footer-outer').removeAttr('data-midnight');
7893	}
7894	if($('body[data-footer-reveal="1"]').length > 0) { 
7895		footerRevealCalcs();
7896		//set shadow to match BG color if applicable
7897		if($('body[data-footer-reveal-shadow="large_2"]').length > 0) $('.container-wrap').css({ boxShadow: '0 70px 110px -30px '+$('#footer-outer').css('backgroundColor') });
7898	}
7899	
7900	function opaqueCheck(){
7901		var $offset = $(window).scrollTop();
7902		var $windowWidth = $(window).width();
7903
7904		if($offset > 0 && $windowWidth > 1000) {
7905			
7906			if($('#header-outer').attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent').addClass('scrolled-down');
7907			$('.ns-loading-cover').hide();
7908			
7909			$(window).off('scroll',opaqueCheck);
7910			$(window).on('scroll',transparentCheck);
7911		}
7912	}
7913	
7914	
7915	function transparentCheck(){
7916		var $offset = $(window).scrollTop();
7917		var $windowWidth = $(window).width();
7918
7919		if($offset == 0 && $windowWidth > 1000) {
7920			
7921			if($('#header-outer').attr('data-transparent-header') == 'true') $('#header-outer').addClass('transparent').removeClass('scrolled-down');
7922			$('.ns-loading-cover').show();
7923			
7924			$(window).off('scroll',transparentCheck);
7925			$(window).on('scroll',opaqueCheck);
7926		}
7927	}
7928	
7929	var adminBarHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
7930
7931	//header inherit row color effect
7932	function headerRowColorInheritInit(){
7933		if($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0){
7934			
7935			var headerOffset = ($('#header-outer[data-permanent-transparent="1"]').length == 0) ? (logoHeight - shrinkNum) + Math.
7935ceil((headerPadding*2) / 1.8) + adminBarHeight : logoHeight/2 + headerPadding + adminBarHeight;
7936			
7937			$('.main-content > .row > .wpb_row').each(function(){
7938
7939
7940				var $that = $(this);
7941				var waypoint = new Waypoint({
7942	 				element: $that,
7943		 			handler: function(direction) {
7944	
7945
7946						if(direction == 'down') {
7947							
7948							if($that.find('.row-bg.using-bg-color').length > 0) {
7949								
7950								var $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
7951								$('#header-outer').css('background-color',$that.find('.row-bg').css('background-color')).removeClass('light-text').removeClass('dark-text').addClass($textColor);
7952								$('#header-outer').attr('data-current-row-bg-color',$that.find('.row-bg').css('background-color'));
7953							} else {
7954								$('#header-outer').css('background-color',$('#header-outer').attr('data-user-set-bg')).removeClass('light-text').removeClass('dark-text');
7955								$('#header-outer').attr('data-current-row-bg-color',$('#header-outer').attr('data-user-set-bg'));
7956							}
7957						
7958						} else {
7959
7960							if($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) {
7961								var $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
7962								$('#header-outer').css('background-color',$that.prev('div.wpb_row').find('.row-bg').css('background-color')).removeClass('light-text').removeClass('dark-text').addClass($textColor);
7963								$('#header-outer').attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color'));
7964							} else {
7965								$('#header-outer').css('background-color',$('#header-outer').attr('data-user-set-bg')).removeClass('light-text').removeClass('dark-text');
7966								$('#header-outer').attr('data-current-row-bg-color',$('#header-outer').attr('data-user-set-bg'));
7967							}
7968
7969						} 
7970
7971				
7972					},
7973					offset: headerOffset
7974
7975				}); 
7976
7977
7978			});
7979		}
7980	}
7981
7982	//if($('.nectar-box-roll').length == 0) headerRowColorInheritInit();
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992/****************sticky page submenu******************/
7993	if($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) {
7994
7995		(function() {
7996		  'use strict'
7997
7998		  var $ = window.jQuery
7999		  var Waypoint = window.Waypoint
8000		  var $offsetHeight = 0; 
8001		  var shrinkNum = 6;	
8002		  var headerPadding = parseInt($('#header-outer').attr('data-padding'));
8003		  if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
8004		  var headerPadding2 = headerPadding - headerPadding/1.8;
8005		  var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('body.mobile').length == 0) ? $('#header-outer').outerHeight() - (parseInt(shrinkNum) + headerPadding2*2) : $('#header-outer').outerHeight();
8006
8007		  if($('#header-secondary-outer').length > 0 && $('body.mobile').length == 0) $headerHeight += $('#header-secondary-outer').height();
8008
8009		  
8010
8011		  $(window).on('smartresize',function(){
8012
8013		  	$headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length == 0 && $('body.mobile').length == 0) ? $('#header-outer').outerHeight() - (parseInt(shrinkNum) + headerPadding2*2) : $('#header-outer').outerHeight();
8014		  	if($('#header-secondary-outer').length > 0  && $('body.mobile').length == 0) $headerHeight += $('#header-secondary-outer').height();
8015
8016		  	$offsetHeight = 0; 
8017		
8018		  	  if($('#wpadminbar').length > 0 && $('#wpadminbar').css('position') == 'fixed') $offsetHeight += $('#wpadminbar').height();
8019 			  if($('body[data-hhun="0"] #header-outer').length > 0 && !($('body.mobile').length > 0 && $('#header-outer[data-mobile-fixed="false"]').length > 0) ) $offsetHeight += $headerHeight;
8020 	
8021 			 // else if($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) $offsetHeight += $headerHeight;
8022 			
8023 			 //recalc for resizing (same as stuck/unstuck logic below)
8024 			 if($('.page-submenu.stuck').length > 0) {
8025
8026		        	$('.page-submenu.stuck').addClass('no-trans').css('top',$offsetHeight).css('transform','translateY(0)').addClass('stuck');
8027		        	var $that = this;
8028		        	setTimeout(function(){ $('.page-submenu.stuck').removeClass('no-trans'); },50);
8029		        	$('.page-submenu.stuck').parents('.wpb_row').css('z-index',10000);
8030
8031		        	//boxed
8032		        	if($('#boxed').length > 0) { 
8033		        		var $negMargin = ($(window).width() > 1000) ? $('.container-wrap').width()*0.04 :39;
8034		        		$('.page-submenu.stuck').css({'margin-left':'-'+$negMargin+'px', 'width' : $('.container-wrap').width()});
8035		        	}
8036
8037		        }
8038		        else { 
8039		        	$('.page-submenu.stuck').css('top','0').removeClass('stuck');
8040		       	   $('.page-submenu.stuck').parents('.wpb_row').css('z-index','auto');
8041
8042		       	    if($('#boxed').length > 0) $('.page-submenu.stuck').css({'margin-left':'0px', 'width' : '100%'});
8043		       	}
8044
8045		  });
8046
8047		  /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */
8048		  function Sticky(options) {
8049		    this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options)
8050		    this.element = this.options.element
8051		    this.$element = $(this.element)
8052		    this.createWrapper()
8053		    this.createWaypoint()
8054		  }
8055
8056		  /* Private */
8057		  Sticky.prototype.createWaypoint = function() {
8058		    var originalHandler = this.options.handler
8059
8060		    $offsetHeight = 0; 
8061		    if($('#wpadminbar').length > 0 && $('#wpadminbar').css('position') == 'fixed') $offsetHeight += $('#wpadminbar').height();
8062 			if($('body[data-hhun="0"] #header-outer').length > 0 && !($('body.mobile').length > 0 && $('#header-outer[data-mobile-fixed="false"]').length > 0)) $offsetHeight += $headerHeight;
8063
8064 		
8065		    this.waypoint = new Waypoint($.extend({}, this.options, {
8066		      element: this.wrapper,
8067		      handler: $.proxy(function(direction) {
8068		        var shouldBeStuck = this.options.direction.indexOf(direction) > -1
8069		        var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''
8070
8071		        this.$wrapper.height(wrapperHeight)
8072		        if(shouldBeStuck) {
8073		        	this.$element.addClass('no-trans').css('top',$offsetHeight).css('transform','translateY(0)').addClass('stuck');
8074		        	var $that = this;
8075		        	setTimeout(function(){ $that.$element.removeClass('no-trans'); },50);
8076		        	this.$element.parents('.wpb_row').css('z-index',10000);
8077
8078		        	//boxed
8079		        	if($('#boxed').length > 0) { 
8080		        		var $negMargin = ($(window).width() > 1000) ? $('.container-wrap').width()*0.04 :39;
8081		        		this.$element.css({'margin-left':'-'+$negMargin+'px', 'width' : $('.container-wrap').width()});
8082		        	}
8083
8084		        }
8085		        else { 
8086		        	this.$element.css('top','0').removeClass('stuck');
8087		       	    //this.$element.parents('.wpb_row').css('z-index','10000');
8088
8089		       	    if($('#boxed').length > 0) this.$element.css({'margin-left':'0px', 'width' : '100%'});
8090		       	}
8091
8092		        if (originalHandler) {
8093		          originalHandler.call(this, direction)
8094		        }
8095		      }, this),
8096		      offset: $offsetHeight
8097		    }))
8098
8099		    var $that = this;
8100
8101		   // if($('body[data-hhun="1"]').length > 0 ) {
8102			    setInterval(function(){ 
8103
8104			    	if($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0)
8105		        		$that.waypoint.options.offset = $offsetHeight + $headerHeight;
8106		        	else 
8107		        		$that.waypoint.options.offset = $offsetHeight;
8108			    	Waypoint.refreshAll();
8109			
8110			    },100); 
8111			//}
8112
8113		  }
8114
8115		  /* Private */
8116		  Sticky.prototype.createWrapper = function() {
8117		    if (this.options.wrapper) {
8118		      this.$element.wrap(this.options.wrapper)
8119		    }
8120		    this.$wrapper = this.$element.parent()
8121		    this.wrapper = this.$wrapper[0]
8122		  }
8123
8124		  /* Public */
8125		  Sticky.prototype.destroy = function() {
8126		    if (this.$element.parent()[0] === this.wrapper) {
8127		      this.waypoint.destroy()
8128		      this.$element.removeClass(this.options.stuckClass)
8129		      if (this.options.wrapper) {
8130		        this.$element.unwrap()
8131		      }
8132		    }
8133		  }
8134
8135		  Sticky.defaults = {
8136		    wrapper: '<div class="sticky-wrapper" />',
8137		    stuckClass: 'stuck',
8138		    direction: 'down right'
8139		  }
8140
8141		  Waypoint.Sticky = Sticky
8142		}())
8143		;
8144
8145		//remove outside of column setups 
8146		if($('.page-submenu').parents('.span_12').find('> .wpb_column').length > 1){
8147			var pageMenu = $('.page-submenu').clone();
8148			var pageMenuParentRow = $('.page-submenu').parents('.wpb_row');
8149			$('.page-submenu').remove();
8150			pageMenuParentRow.before(pageMenu);
8151		}
8152
8153		var sticky = new Waypoint.Sticky({
8154		  element: $('.page-submenu[data-sticky="true"]')[0]
8155		});
8156
8157
8158	}
8159
8160	if($('#nectar_fullscreen_rows').length == 0)
8161		$('.page-submenu').parents('.wpb_row').css('z-index',10000);
8162
8163	$('.page-submenu .mobile-menu-link').on('click',function(){
8164		$(this).parents('.page-submenu').find('ul').stop(true).slideToggle(350);
8165		return false;
8166	});
8167
8168	$('.page-submenu ul li a').on('click',function(){
8169		if($('body.mobile').length > 0) $(this).parents('.page-submenu').find('ul').stop(true).slideToggle(350);
8170	});
8171
8172
8173
8174
8175
8176	//responsive nav
8177	$('body').on('click','#toggle-nav',function(){
8178		$(this).find('.lines-button').toggleClass('close');
8179		$('#mobile-menu').stop(true,true).slideToggle(500);
8180		return false;
8181	});
8182	
8183	
8184	//add wpml to mobile menu
8185	if($('header#top nav > ul > li.menu-item-language').length > 0 && $('#header-secondary-outer ul > li.menu-item-language').length == 0){
8186		var $langSelector = $('header#top nav > ul > li.menu-item-language').clone();
8187		$langSelector.insertBefore('#mobile-menu ul #mobile-search');
8188	}
8189	
8190	////append dropdown indicators / give classes
8191	$('#mobile-menu .container ul li').each(function(){
8192		if($(this).find('> ul').length > 0) {
8193			 $(this).addClass('has-ul');
8194			 $(this).find('> a').append('<span class="sf-sub-indicator"><i class="icon-angle-down"></i></span>');
8195		}
8196	});
8197	
8198	////events
8199	$('#mobile-menu .container ul li:has(">ul") > a .sf-sub-indicator').click(function(){
8200		$(this).parent().parent().toggleClass('open');
8201		$(this).parent().parent().find('> ul').stop(true,true).slideToggle();
8202		return false;
8203	});
8204	
8205
8206
8207/*-------------------------------------------------------------------------*/
8208/*	5.	Page Specific
8209/*-------------------------------------------------------------------------*/	
8210
8211	//recent work
8212	function piVertCenter() {
8213		$('.portfolio-items  > .col').each(function(){
8214				
8215			//style 4
8216			$(this).find('.style-4 .work-info .bottom-meta:not(.shown)').stop().animate({
8217				'bottom' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()-2+'px'
8218			},420,'easeOutCubic');
8219
8220			
8221		});	 
8222	}
8223	
8224	$(window).load(function(){
8225	 	 portfolioCommentOrder();
8226	 	 fullWidthContentColumns();
8227	 	 resizeVideoToCover();
8228	});
8229	
8230	
8231	//ie8 width fix
8232	function ie8Width(){
8233		if( $(window).width() >= 1300 ) {
8234			$('.container').css('max-width','1100px');
8235		} else {
8236			$('.container').css('max-width','880px');
8237		}
8238	}
8239	
8240	if( $(window).width() >= 1300 && $('html').hasClass('no-video')) { $('.container').css('max-width','1100px'); $(window).resize(ie8Width); };
8241	
8242
8243
8244	function smartResizeInit() {
8245
8246		 //carousel height calcs
8247		 carouselHeightCalcs();
8248		 clientsCarouselHeightRecalc();
8249
8250		 //portfolio comment order
8251		 portfolioCommentOrder();
8252		 
8253		 //testimonial slider height
8254		 testimonialHeightResize(); //animated
8255		 testimonialSliderHeight(); //non-animated
8256		 
8257		 //full width content columns sizing
8258		 fullWidthContentColumns();
8259
8260		 //parallax BG Calculations
8261		 if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
8262		   parallaxRowsBGCals();
8263		 }
8264
8265		 headerSpace();
8266
8267		 centeredLogoMargins();
8268
8269		 slideOutWidgetOverflowState();
8270		 recentPostHeight();
8271
8272		 morphingOutlines();
8273
8274		 flipBoxHeights();
8275
8276		 //full width menu megamenu adjust
8277		if($('.slide-out-widget-area-toggle a.open').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) fullWidthHeaderSlidingWidgetMenuCalc();
8278		  
8279	}
8280
8281    $(window).off('smartresize.srInit'); 
8282	$(window).on('smartresize.srInit', smartResizeInit); 
8283	
8284	
8285	
8286	function resizeInit() {
8287		 portfolioDeviceCheck();
8288
8289		 //fullwidth page section calcs
8290		 fullWidthSections(); 
8291		 fullwidthImgOnlySizing();
8292		 fullWidthContentColumns();
8293	  	 fullWidthRowPaddingAdjustCalc();
8294		 
8295		 //iframe video emebeds
8296		 responsiveVideoIframes();
8297		 videoshortcodeSize();
8298		 
8299		 if($('.nectar-social.full-width').length > 0) {
8300		 	nectarLoveFWCenter();
8301		 }
8302
8303		 if($('body').hasClass('ascend')){ 
8304			searchFieldCenter();
8305		 }
8306
8307		 if($('body').hasClass('single-post')) centerPostNextButtonImg();
8308		 
8309		 //fixed sidebar for portfolio
8310		 sidebarPxConversion();
8311
8312		 cascadingImageBGSizing();
8313
8314		 responsiveTooltips();
8315
8316		 //vc mobile columns
8317		 if($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) vcMobileColumns();
8318
8319		 if($('body[data-footer-reveal="1"]').length > 0) footerRevealCalcs();
8320
8321		 if($('#page-header-bg').length > 0) pageHeader();
8322
8323		 if($('.nectar-video-bg').length > 0) {
8324		 	resizeVideoToCover();
8325		 }
8326	}
8327
8328	$(window).off('resize.srInit'); 
8329	$(window).on('resize.srInit', resizeInit); 
8330
8331	$(window).on("orientationchange",function(){
8332	  setTimeout(clientsCarouselHeightRecalc,200);
8333	});
8334	
8335	//blog next post button
8336	function postNextButtonEffect(){
8337
8338		$('.blog_next_prev_buttons').imagesLoaded(function(){
8339
8340			centerPostNextButtonImg();
8341			
8342			$('.blog_next_prev_buttons img').css('opacity','1');
8343
8344			if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
8345				$('.blog_next_prev_buttons img').panr({
8346					scaleDuration: .28,
8347					sensitivity: 22,
8348					scaleTo: 1.06
8349				}); 
8350			}
8351
8352		});
8353	}
8354
8355	function centerPostNextButtonImg(){
8356		
8357		if($('.blog_next_prev_buttons').length == 0) return false;
8358
8359		if( $('.blog_next_prev_buttons img').height() >= $('.blog_next_prev_buttons').height() + 50 ) {
8360			var $height = 'auto';
8361			var $width = $('.blog_next_prev_buttons').width();
8362		} else {
8363
8364			if( $('.blog_next_prev_buttons').width() < $('.blog_next_prev_buttons img').width()) {
8365				var $height = $('.blog_next_prev_buttons').height() + 49;
8366				var $width = 'auto';
8367			} else {
8368				var $height = 'auto';
8369				var $width = '100%';
8370			}
8371			
8372		}
8373
8374		$('.blog_next_prev_buttons img').css({ 'height' : $height, 'width': $width });
8375
8376		$('.blog_next_prev_buttons img').css({
8377			'top' : ($('.blog_next_prev_buttons').height()/2) - ($('.blog_next_prev_buttons img').height()/2) + 'px',
8378			'left' : ($('.blog_next_prev_buttons').width()/2) - ($('.blog_next_prev_buttons img').width()/2) + 'px'
8379		});
8380
8381		$('.blog_next_prev_buttons .inner').each(function(){
8382			$(this).css({'top': $(this).parent().height()/2 - ($(this).height()/2), 'opacity':'1' });
8383		})
8384	}
8385	
8386	postNextButtonEffect();
8387
8388
8389	function recentPostHeight() {
8390		$('.blog-recent[data-style="title_only"]').each(function(){
8391			if($(this).find('> .col').length > 1) return false;
8392			if($(this).parent().parent().parent().hasClass('vc_col-sm-3') || 
8393				$(this).parent().parent().parent().hasClass('vc_col-sm-4') || 
8394				$(this).parent().parent().parent().hasClass('vc_col-sm-6') || 
8395				$(this).parent().parent().parent().hasClass('vc_col-sm-8') || 
8396				$(this).parent().parent().parent().hasClass('vc_col-sm-9')) {
8397				
8398				if($('body.mobile').length == 0 && $(this).next('div').length == 0) {
8399					var tallestColumn = 0;
8400					
8401					$(this).find('> .col').css('padding', '50px 20px');
8402
8403					$(this).parents('.span_12').find(' > .wpb_column').each(function(){
8404						(Math.floor($(this).height()) > tallestColumn) ? tallestColumn = Math.floor($(this).height()) : tallestColumn = tallestColumn;
8405					});	
8406			
8407					if(Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) {
8408						$(this).find('> .col').css('padding-top',(tallestColumn-$(this).find('> .col').height())/2 + 'px');
8409						$(this).find('> .col').css('padding-bottom',(tallestColumn-$(this).find('> .col').height())/2 + 'px');
8410					}
8411					
8412				}
8413				 else {
8414				 		$(this).find('> .col').css('padding', '50px 20px');
8415				}
8416			}
8417		});
8418	}
8419	recentPostHeight();
8420
8421
8422	//recent post slider
8423	function recentPostsFlickityInit() {
8424
8425		if($('.nectar-recent-posts-slider-inner').length == 0) return false;
8426
8427		var $rpF = $('.nectar-recent-posts-slider-inner').flickity({
8428			  contain: true,
8429			  draggable: true,
8430			  lazyLoad: false,
8431			  imagesLoaded: true,
8432			  percentPosition: true,
8433			  prevNextButtons: false,
8434			  pageDots: true,
8435			  resize: true,
8436			  setGallerySize: true,
8437			  wrapAround: true,
8438			  accessibility: false
8439		});
8440
8441		setTimeout(function(){
8442			$('.nectar-recent-posts-slider-inner').addClass('loaded');
8443		},1150);
8444		var flkty = $rpF.data('flickity');
8445	
8446		//$rpF.on( 'cellSelect', function() {
8447		// $(flkty.element).parents('.nectar-recent-posts-slider').find('h2:not(.post-ref-'+flkty.selectedIndex+')').hide().css('opacity','0');
8448		// $(flkty.element).parents('.nectar-recent-posts-slider').find('h2.post-ref-'+flkty.selectedIndex).show().transition({ 'opacity':1},600);
8449		//});
8450
8451		$rpF.on( 'dragStart', function() {
8452			$('.flickity-viewport').addClass('is-moving');
8453		});
8454		$rpF.on( 'dragEnd', function() {
8455			$('.flickity-viewport').removeClass('is-moving');
8456		});
8457
8458		recentPostSliderHeight();
8459		$(window).resize(recentPostSliderHeight);
8460
8461		if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
8462			$(window).resize(recentPostSliderParallaxMargins);
8463
8464		function recentPostSliderHeight(){
8465
8466			$('.nectar-recent-posts-slider').each(function(){
8467					
8468						var $heightCalc;
8469						var $minHeight = 250;
8470						var $windowWidth = $(window).width();
8471						var $definedHeight = parseInt($(this).attr('data-height'));
8472
8473						var dif = ($('body[data-ext-responsive="true"]').length > 0) ? $(window).width() / 1400 : $(window).width() / 1100;
8474
8475						if( window.innerWidth > 1000 && $('#boxed').length == 0) {
8476
8477							if($(this).parents('.full-width-content').length == 0) {
8478								if($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1400){
8479									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight));
8480								} else if($('body[data-ext-responsive="true"]').length == 0 && window.innerWidth >= 1100) {
8481									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight));
8482								} else {
8483									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
8484								}
8485								
8486							} else {
8487								$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
8488							}
8489							
8490						} else {
8491							
8492							//column sliders
8493							var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col') ;
8494							if($parentCol.length == 0) $parentCol = $('.main-content');
8495								
8496							if(!$parentCol.hasClass('vc_span12') && !$parentCol.hasClass('main-content') && !$parentCol.hasClass('span_12') && !$parentCol.hasClass('vc_col-sm-12') ) {
8497							
8498								var $parentColWidth = sliderColumnDesktopWidth($parentCol);
8499								var $aspectRatio = $definedHeight/$parentColWidth;
8500
8501								
8502								//min height
8503								if( $aspectRatio*$parentCol.width() <= $minHeight ){
8504									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$minHeight);
8505								} else {
8506									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$aspectRatio*$parentCol.width());
8507								}
8508							  
8509							} 
8510							
8511							
8512
8513							//regular
8514							else {
8515								
8516								//min height
8517								if( $definedHeight*dif <= $minHeight ){
8518									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$minHeight);
8519								} else {
8520									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
8521								}
8522								
8523							}
8524							
8525						}
8526						
8527	
8528					
8529				});
8530		
8531		}
8532
8533		////helper function
8534		function sliderColumnDesktopWidth(parentCol) {
8535			
8536			var $parentColWidth = 1100;
8537			var $columnNumberParsed = $(parentCol).attr('class').match(/\d+/);
8538			
8539			if($columnNumberParsed == '2') { $parentColWidth = 170 }
8540			else if($columnNumberParsed == '3') { $parentColWidth = 260 } 
8541			else if($columnNumberParsed == '4') { $parentColWidth = 340 } 
8542			else if($columnNumberParsed == '6') { $parentColWidth = 530 } 
8543			else if($columnNumberParsed == '8') { $parentColWidth = 700 } 
8544			else if($columnNumberParsed == '9') { $parentColWidth = 805 }
8545			else if($columnNumberParsed == '10') { $parentColWidth = 916.3 }
8546			else if($columnNumberParsed == '12') { $parentColWidth = 1100 }
8547		
8548			return $parentColWidth;
8549		}
8550
8551	
8552	}
8553	
8554	recentPostsFlickityInit();
8555
8556	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
8557		if($('.nectar-recent-posts-slider').length > 0) window.requestAnimationFrame(recentPostSliderParallax);
8558
8559	function recentPostSliderParallax(){
8560
8561		$('.nectar-recent-posts-slider').each(function(){
8562			var $offset = parseInt($(this).find('.flickity-slider').position().left);
8563			var $slideLength = $(this).find('.nectar-recent-post-slide').length;
8564			var $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index();
8565			var $slideWidth = $(this).find('.nectar-recent-post-slide').width();
8566			//wrapped fix
8567
8568			////first going to first
8569			if($offset >= -3) {
8570				$(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg').css('margin-left',parseInt(Math.ceil($slideWidth/3.5))+'px');
8571			} else {
8572				$(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg').css('margin-left','-'+parseInt(Math.ceil($slideWidth/3.5*$lastChildIndex))+'px');
8573			}
8574			////last going to first
8575			if(Math.abs($offset) >= ($slideLength-1) * $slideWidth) {
8576				$(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg').css('margin-left','-'+parseInt(Math.ceil(($slideWidth/3.5)*$slideLength))+'px');
8577			} else {
8578				$(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg').css('margin-left','0px');
8579			}
8580
8581			$(this).find('.nectar-recent-post-bg').css('transform','translateX('+Math.ceil($(this).find('.flickity-slider').position().left/-3.5)+'px)');
8582			
8583			
8584		});
8585		requestAnimationFrame(recentPostSliderParallax);
8586	}
8587
8588	function recentPostSliderParallaxMargins(){
8589
8590		$('.nectar-recent-posts-slider').each(function(){		
8591			var $slideWidth = $(this).find('.nectar-recent-post-slide').width();
8592			$(this).find('.nectar-recent-post-slide').each(function(i){
8593				$(this).find('.nectar-recent-post-bg').css('margin-left','-'+  parseInt(Math.ceil($slideWidth/3.5)*i)+'px');
8594			});
8595		
8596		});
8597	}
8598
8599	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
8600		recentPostSliderParallaxMargins();
8601
8602
8603	//portfolio item hover effect
8604	
8605	////desktop event 
8606	function portfolioHoverEffects() { 
8607
8608		if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(iPad|IEMobile)/)) {
8609			
8610			//style 1 & 2
8611			$('.portfolio-items .col .work-item:not(.style-3-alt):not(.style-3):not([data-custom-content="on"])').hover(function(){
8612				$(this).find('.work-info .vert-center').css({'margin-top' : 0});
8613				$(this).find('.work-info, .work-info .vert-center *, .work-info > i').css({'opacity' : 1});
8614				$(this).find('.work-info-bg').css({ 'opacity' : 0.9 });
8615			},function(){
8616				$(this).find('.work-info .vert-center').css({ 'margin-top' : -20 });
8617				$(this).find('.work-info, .work-info .vert-center *, .work-info > i').css({ 'opacity' : 0 });
8618				$(this).find('.work-info-bg').css({ 'opacity' : 0 });
8619			});
8620			
8621			
8622			//style 3
8623			$('.portfolio-items .col .work-item.style-3').hover(function(){
8624
8625				$(this).find('.work-info-bg').css({ 'opacity' : 0 });
8626
8627			},function(){
8628				
8629				$(this).find('.work-info-bg').css({ 'opacity' : 0.45 });
8630
8631			});
8632			
8633			
8634			//style 4
8635			$('.portfolio-items .col .work-item.style-4').hover(function(){
8636				
8637				$(this).find('img').stop().animate({
8638					'top' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()/2+'px'
8639				},250,'easeOutCubic');
8640				
8641				$(this).find('.work-info .bottom-meta').addClass('shown').stop().animate({
8642					'bottom' : '0px'
8643				},320,'easeOutCubic');
8644
8645			},function(){
8646				
8647				$(this).find('img').stop().animate({
8648					'top' : '0px'
8649				},250,'easeOutCubic');
8650				
8651				$(this).find('.work-info .bottom-meta').removeClass('shown').stop().animate({
8652					'bottom' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()-2+'px'
8653				},320,'easeOutCubic');
8654				
8655			});
8656		
8657		} 
8658		////mobile event
8659		else {
8660			portfolioDeviceCheck();
8661		}
8662
8663	}
8664
8665	portfolioHoverEffects();
8666
8667	function style6Img(){
8668
8669		//change sizer pos
8670		$('.style-5').each(function(){
8671			$(this).find('.sizer').insertBefore($(this).find('.parallaxImg'));
8672		});
8673
8674		//set parent zindex
8675		$('.style-5').parents('.wpb_row').css('z-index','100');
8676
8677		var d = document,
8678			de = d.documentElement,
8679			bd = d.getElementsByTagName('body')[0],
8680			htm = d.getElementsByTagName('html')[0],
8681			win = window,
8682			imgs = d.querySelectorAll('.parallaxImg'),
8683			totalImgs = imgs.length,
8684			supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints;
8685
8686		if(totalImgs <= 0){
8687			return;
8688		}
8689
8690		// build HTML
8691		for(var l=0;l<totalImgs;l++){
8692
8693			var thisImg = imgs[l],
8694				layerElems = thisImg.querySelectorAll('.parallaxImg-layer'),
8695				totalLayerElems = layerElems.length;
8696
8697			if(totalLayerElems <= 0){
8698				continue;
8699			}
8700
8701			while(thisImg.firstChild) {
8702				thisImg.removeChild(thisImg.firstChild);
8703			}
8704			
8705			var lastMove = 0;
8706
8707			//throttle performance for all browser other than chrome
8708			var eventThrottle = $('html').hasClass('cssreflections') ? 1 : 80;
8709			if(eventThrottle == 80) $('body').addClass('cssreflections');
8710
8711			var containerHTML = d.createElement('div'),
8712				shineHTML = d.createElement('div'),
8713				shadowHTML = d.createElement('div'),
8714				layersHTML = d.createElement('div'),
8715				layers = [];
8716
8717			thisImg.id = 'parallaxImg__'+l;
8718			containerHTML.className = 'parallaxImg-container';
8719			//shineHTML.className = 'parallaxImg-shine';
8720			shadowHTML.className = 'parallaxImg-shadow';
8721			layersHTML.className = 'parallaxImg-layers';
8722
8723			for(var i=0;i<totalLayerElems;i++){
8724				var layer = d.createElement('div'),
8725					layerInner = d.createElement('div'),
8726					imgSrc = layerElems[i].getAttribute('data-img');
8727
8728				$(layer).html($(layerElems[i]).html());
8729				layer.className = 'parallaxImg-rendered-layer';
8730				layer.setAttribute('data-layer',i);
8731
8732				if(i==0) { 
8733					layerInner.className = 'bg-img';
8734					layerInner.style.backgroundImage = 'url('+imgSrc+')';
8735					layer.appendChild(layerInner);
8736				}
8737				layersHTML.appendChild(layer);
8738
8739				layers.push(layer);
8740			}
8741
8742			containerHTML.appendChild(layersHTML);
8743			//containerHTML.appendChild(shineHTML);
8744			thisImg.appendChild(containerHTML);
8745			$(thisImg).wrap('<div class="parallaxImg-wrap" />');
8746			if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { $(thisImg).parent().append(shadowHTML); }
8747
8748			var w = thisImg.clientWidth || thisImg.offsetWidth || thisImg.scrollWidth;
8749			//thisImg.style.transform = 'perspective('+ w*3 +'px)';
8750
8751			if(supportsTouch){
8752				/*win.preventScroll = false;
8753
8754		        (function(_thisImg,_layers,_totalLayers,_shine) {
8755					$(thisImg).parents('.style-5').on('touchmove', function(e){
8756						if (win.preventScroll){
8757							e.preventDefault();
8758						}
8759						window.requestAnimationFrame(function(){
8760							processMovement(e,true,_thisImg,_layers,_totalLayers,_shine);
8761						});		
8762					});
8763		            $(thisImg).parents('.style-5').on('touchstart', function(e){
8764		            	win.preventScroll = true;
8765						processEnter(e,_thisImg,_layers,_totalLayers,_shine);		
8766					});
8767					$(thisImg).parents('.style-5').on('touchend', function(e){
8768						win.preventScroll = false;
8769						processExit(e,_thisImg,_layers,_totalLayers,_shine);		
8770					});
8771		        })(thisImg,layers,totalLayerElems,shineHTML); */
8772		    } else {
8773		    	(function(_thisImg,_layers,_totalLayers,_shine) {
8774					$(thisImg).parents('.style-5').on('mousemove', function(e){
8775
8776					 	var now = Date.now();
8777				        if (now > lastMove + eventThrottle) {
8778				            lastMove = now;
8779							window.requestAnimationFrame(function(){
8780								processMovement(e,false,_thisImg,_layers,_totalLayers,_shine);		
8781							});
8782						}
8783
8784						//window.requestAnimationFrame(function(){
8785						//	processShineMovement(e,false,_thisImg,_layers,_totalLayers,_shine);		
8786						//});
8787					});
8788		            $(thisImg).parents('.style-5').on('mouseenter', function(e){
8789						processEnter(e,_thisImg,_layers,_totalLayers,_shine);		
8790					});
8791					$(thisImg).parents('.style-5').on('mouseleave', function(e){
8792						processExit(e,_thisImg,_layers,_totalLayers,_shine);		
8793					});
8794		        })(thisImg,layers,totalLayerElems,shineHTML);
8795		    }
8796
8797		    //set the depths
8798		    (function(_thisImg,_layers,_totalLayers,_shine) {
8799			    depths(false,_thisImg,_layers,_totalLayers,_shine);
8800			     window.addEventListener('resize', function(e){
8801			    	  depths(false,_thisImg,_layers,_totalLayers,_shine);
8802			    });
8803			 })(thisImg,layers,totalLayerElems,shineHTML);
8804		}
8805
8806		function processMovement(e, touchEnabled, elem, layers, totalLayers, shine){
8807
8808			//stop raf if exit already called
8809			if(!$(elem.firstChild).hasClass('over')) { processExit(e,elem,layers,totalLayers,shine); return false }
8810
8811			//set up multipliers
8812
8813			if($(elem).parents('.col.wide').length > 0 ) {
8814				var yMult = 0.03;
8815				var xMult = 0.063;
8816			} else if( $(elem).parents('.col.regular').length > 0  ) {
8817				var yMult = 0.045;
8818				var xMult = 0.045;
8819			} else if($(elem).parents('.col.tall').length > 0 ) {
8820				var yMult = 0.05;
8821				var xMult = 0.015;
8822			} else if($(elem).parents('.col.wide_tall').length > 0) {
8823				var yMult = 0.04;
8824				var xMult = 0.04;
8825			} else {
8826				var yMult = 0.045;
8827				var xMult = 0.075;
8828			}
8829			
8830			var bdst = bd.scrollTop || htm.scrollTop,
8831				bdsl = bd.scrollLeft,
8832				pageX = (touchEnabled)? e.touches[0].pageX : e.pageX,
8833				pageY = (touchEnabled)? e.touches[0].pageY : e.pageY,
8834				offsets = elem.getBoundingClientRect(),
8835				w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, // width
8836				h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, // height
8837				wMultiple = 320/w,
8838				offsetX = 0.52 - (pageX - offsets.left - bdsl)/w, //cursor position X
8839				offsetY = 0.52 - (pageY - offsets.top - bdst)/h, //cursor position Y
8840				dy = (pageY - offsets.top - bdst) - h / 2, //@h/2 = center of container
8841				dx = (pageX - offsets.left - bdsl) - w / 2, //@w/2 = center of container
8842				yRotate = (offsetX - dx)*(yMult * wMultiple), //rotation for container Y
8843				xRotate = (dy - offsetY)*(xMult * wMultiple); //rotation for container X //old
8844				//imgCSS = ' rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateZ(0)'; //img transform
8845				if($(elem).parents('.wide_tall').length == 0 && $(elem).parents('.wide').length == 0 && $(elem).parents('.tall').length == 0) {
8846					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
8847				} else {
8848					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	
8849				}
8850				//imgCSS2 = 'perspective('+ w*3 +'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateZ(0) translateY('+offsetY*-10+'px) translateX('+offsetX*-10+'px)'; //img transform //old
8851
8852				
8853			//container transform
8854			if(elem.firstChild.className.indexOf(' over') != -1){
8855				if($(elem).parents('.portfolio-items.masonry-items').length > 0){
8856					//imgCSS2 = ' scale3d(1.025,1.025,1.025)';
8857				} else {
8858					//imgCSS2 = ' scale3d(1.06,1.06,1.06)';
8859				}
8860			
8861				
8862
8863			}
8864		
8865			//elem.firstChild.style.transform = imgCSS;
8866			$(elem).find('.parallaxImg-container').css('transform',imgCSS);
8867
8868			if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) {
8869				$(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform',imgCSS);
8870			}
8871			//elem.style.transform = imgCSS2;
8872
8873			
8874		}
8875
8876		function processShineMovement(e, touchEnabled, elem, layers, totalLayers, shine){
8877
8878			var bdst = bd.scrollTop || htm.scrollTop,
8879				bdsl = bd.scrollLeft,
8880				pageX = (touchEnabled)? e.touches[0].pageX : e.pageX,
8881				pageY = (touchEnabled)? e.touches[0].pageY : e.pageY,
8882				offsets = elem.getBoundingClientRect(),
8883				w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, // width
8884				h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, // height
8885				wMultiple = 320/w,
8886				offsetX = 0.52 - (pageX - offsets.left - bdsl)/w, //cursor position X
8887				offsetY = 0.52 - (pageY - offsets.top - bdst)/h, //cursor position Y
8888				dy = (pageY - offsets.top - bdst) - h / 2, //@h/2 = center of container
8889				dx = (pageX - offsets.left - bdsl) - w / 2, //@w/2 = center of container
8890				yRotate = (offsetX - dx)*(0.040 * wMultiple), //rotation for container Y
8891				xRotate = (dy - offsetY)*(0.070 * wMultiple), //rotation for container X
8892				
8893				arad = Math.atan2(dy, dx), //angle between cursor and center of container in RAD
8894				angle = arad * 180 / Math.PI - 90; //convert rad in degrees
8895
8896
8897			//get angle between 0-360
8898			if (angle < 0) {
8899				angle = angle + 360;
8900			}
8901
8902			//gradient angle and opacity for shine
8903			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%)';
8904			shine.style.transform = 'translateX(' + (offsetX * totalLayers) - 0.1 + 'px) translateY(' + (offsetY * totalLayers) - 0.1 + 'px) ';	
8905
8906			
8907		}
8908
8909		function processEnter(e, elem, layers, totalLayers, shine){
8910			//var sAgent = window.navigator.userAgent;
8911  			//var Idx = sAgent.indexOf("Edge");
8912
8913			elem.firstChild.className += ' over';
8914			elem.className += ' over';
8915
8916			//if(Idx == -1) {
8917				//$('body').addClass('cssreflections');
8918				//$(elem).addClass('transition');
8919			//	//var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },150);
8920			//} else {
8921				$(elem).addClass('transition');
8922				var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },200);
8923			//}
8924
8925			//depths(false, elem, layers, totalLayers, shine);
8926		}
8927
8928		function processExit(e, elem, layers, totalLayers, shine){
8929
8930			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
8931			var container = elem.firstChild;
8932
8933			container.className = container.className.replace(' over','');
8934			elem.className = elem.className.replace(' over','');
8935			$(container).css('transform', 'perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
8936			$(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform','perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
8937			//elem.style.transform = 'perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0) translateX(0) translateY(0)';
8938			//shine.style.cssText = '';
8939			
8940			//for(var ly=0;ly<totalLayers;ly++){
8941				//layers[ly].style.transform = '';
8942			//}
8943
8944			$(elem).addClass('transition');
8945				var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },200);
8946
8947			//removeDepths(false, elem, layers, totalLayers, shine);
8948
8949		}
8950
8951		function depths(touchEnabled, elem, layers, totalLayers, shine) {
8952			
8953			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
8954			var revNum = totalLayers;
8955			var container = elem.firstChild;
8956			
8957			//set z
8958			for(var ly=0;ly<totalLayers;ly++){
8959				//layers[ly].style.transform = 'translateX(' + (offsetX * revNum) * ((ly * 2.5) / wMultiple) + 'px) translateY(' + (offsetY * totalLayers) * ((ly * 2.5) / wMultiple) + 'px) translateZ(0)';
8960				if(ly == 0) $(layers[ly]).css('transform', 'translateZ(0px)');
8961				else $(layers[ly]).css('transform','translateZ(' +(w*3)/27*(ly*1.1) + 'px) ');
8962
8963				revNum--;
8964			}
8965			
8966			totalLayers = totalLayers + 3;
8967
8968			//set perspective from beginning
8969			$(container).css('transform','perspective('+ w*3 +'px)');
8970
8971			//$(elem).parents('.col').find('.parallaxImg-shine').css('transform','translateZ('+(w*3)/70*(totalLayers*1.1) +'px)');
8972		}
8973
8974		function removeDepths(touchEnabled, elem, layers, totalLayers, shine) {
8975			
8976			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
8977			var revNum = totalLayers;
8978			
8979			//set z
8980			for(var ly=0;ly<totalLayers;ly++){
8981				
8982				if(ly == 0) $(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)');
8983				else $(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)');
8984
8985				revNum--;
8986			}
8987			
8988			totalLayers = totalLayers + 3;
8989			
8990		}
8991	}
8992
8993	style6Img();
8994
8995	function portfolioDeviceCheck(){
8996		if($('body').hasClass('mobile') || navigator.userAgent.match(/(iPad|IEMobile)/) ){
8997			
8998			//if using more details
8999			if($('.portfolio-items .col .work-item').find('a:not(".pp")').length > 0){
9000				$('.portfolio-items .col .work-item').find('a.pp').css('display','none');
9001			} 
9002			
9003			//if only using pp
9004			else {
9005				$('.portfolio-items .col .work-item').find('a:not(".pp")').css('display','none');
9006			}
9007		
9008		} else {
9009			$('.portfolio-items .col .work-item').find('a').css('display','inline');
9010		}
9011	}
9012	
9013	
9014	//portfolio accent color
9015	function portfolioAccentColor() {
9016
9017		var portfolioSocialColorCss = '';
9018
9019		$('.portfolio-items .col').each(function(){
9020			if ($(this).has('[data-project-color]')) { 
9021				$(this).find('.work-info-bg, .bottom-meta').css('background-color',$(this).attr('data-project-color'));
9022
9023				//style5
9024				$(this).find('.parallaxImg-rendered-layer .bg-overlay').css('border-color',$(this).attr('data-project-color'));
9025
9026				var	$projColor = $(this).attr('data-project-color');
9027				if($(this).find('.custom-content .nectar-social').length > 0 && $('body[data-button-style="rounded"]') ) portfolioSocialColorCss += 'body[data-button-style="rounded"] .col[data-
9027project-color="'+$projColor+'"] .custom-content .nectar-social > *:hover i { color: '+ $projColor +'!important; } ';
9028
9029			}
9030		});
9031		
9032		if(portfolioSocialColorCss.length > 1) {
9033
9034			var head = document.head || document.getElementsByTagName('head')[0];
9035			var style = document.createElement('style');
9036
9037				style.type = 'text/css';
9038			if (style.styleSheet){
9039			  style.styleSheet.cssText = portfolioSocialColorCss;
9040			} else {
9041			  style.appendChild(document.createTextNode(portfolioSocialColorCss));
9042			}
9043
9044			head.appendChild(style);
9045		}
9046	}
9047	portfolioAccentColor();
9048	
9049	//portfolio sort
9050	$('body').on('mouseenter','.portfolio-filters',function(){
9051		$(this).find('> ul').stop(true,true).slideDown(500,'easeOutExpo');
9052		$(this).find('a#sort-portfolio span').html($(this).find('a#sort-portfolio').attr('data-sortable-label'));
9053	});
9054
9055	$('body').on('mouseleave','.portfolio-filters',function(){
9056		var $activeCat = $(this).find('a.active').html();
9057		if( typeof $activeCat == 'undefined' || $activeCat.length == 0) $activeCat = $(this).attr('data-sortable-label');
9058		$(this).find('a#sort-portfolio span').html($activeCat);
9059		$(this).find('> ul').stop(true,true).slideUp(500,'easeOutExpo');
9060	});
9061	
9062	//portfolio selected category
9063	$('body').on('click','.portfolio-filters ul li a', function(){
9064		$(this).parents('.portfolio-filters').find('#sort-portfolio span').html($(this).html());
9065	});
9066	
9067	//inline portfolio selected category
9068	$('body').on('click','.portfolio-filters-inline ul li a',function(){
9069
9070		$(this).parents('ul').find('li a').removeClass('active');
9071		$(this).addClass('active');
9072		$(this).parents('.portfolio-filters-inline').find('#current-category').html($(this).html());
9073		
9074	});
9075	
9076
9077	function portfolioFiltersInit() {
9078		//mobile sort menu fix
9079		if($('body').hasClass('mobile') || navigator.userAgent.match(/(iPad|IEMobile)/)){
9080			$('.portfolio-filters').unbind('mouseenter mouseleave');
9081			$('.portfolio-filters > a, .portfolio-filters ul li a').click(function(e){
9082				if(e.originalEvent !== undefined) $(this).parents('.portfolio-filters').find('> ul').stop(true,true).slideToggle(600,'easeOutCubic');
9083			});
9084		}
9085
9086		$('.portfolio-filters-inline .container > ul > li:nth-child(2) a').click();
9087		
9088		//portfolio more details page menu highlight
9089		$('body.single-portfolio #header-outer nav > ul > li > a:contains("Portfolio")').parents('li').addClass('current-menu-item');
9090		
9091		//blog page highlight
9092		$('body.single-post #header-outer nav > ul > li > a:contains("Blog")').parents('li').addClass('current-menu-item');
9093	}
9094
9095	portfolioFiltersInit();
9096
9097	
9098	//blog love center
9099	function centerLove(){
9100		$('.post').each(function(){
9101			
9102			var $loveWidth = $(this).find('.post-meta .nectar-love').outerWidth();
9103			var $loveWrapWidth = $(this).find('.post-meta  .nectar-love-wrap').width();
9104			
9105			//center
9106			$(this).find('.post-meta .nectar-love').css('margin-left', $loveWrapWidth/2 - $loveWidth/2 + 'px' );
9107			$(this).find('.nectar-love-wrap').css('visibility','visible');
9108		});
9109	}
9110	
9111	$('.nectar-love').on('click',function(){
9112		centerLove();
9113	});
9114	
9115	centerLove();	
9116	
9117
9118	//portfolio single comment order
9119	function portfolioCommentOrder(){
9120	
9121		if($('body').hasClass('mobile') && $('body').hasClass('single-portfolio') && $('#respond').length > 0){
9122			$('#sidebar').insertBefore('.comments-section');
9123		}
9124		 
9125		else if($('body').hasClass('single-portfolio') && $('#respond').length > 0) {
9126			$('#sidebar').insertAfter('#post-area');
9127		}
9128		
9129	}
9130
9131	 portfolioCommentOrder();
9132	 
9133	
9134	//portfolio sidebar follow
9135	
9136	var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
9137	
9138	function portfolioSidebarFollow(){
9139
9140		sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
9141	
9142		if( $('body.single-portfolio').length > 0 && sidebarFollow == 1 && !$('body').hasClass('mobile') && parseInt($('#sidebar').height()) + 50 <= parseInt($('#post-area').height())) {
9143			
9144			 $('#sidebar').addClass('fixed-sidebar');
9145			 
9146			 var $footer = ($('.comment-wrap.full-width-section').length == 0) ? '#footer-outer' : '.comment-wrap';
9147			 if( $('#call-to-action').length > 0 ) $footer = '#call-to-action';
9148			 
9149			 //convert width into px
9150			 sidebarPxConversion();
9151			 
9152			 $('#sidebar').stickyMojo({footerID: $footer, contentID: '#post-area'});
9153			 
9154		}
9155		
9156	}
9157	
9158	function sidebarPxConversion(){
9159		
9160		if( $('body.single-portfolio').length > 0 && sidebarFollow == 1 && !$('body').hasClass('mobile') ) {
9161			
9162			var $containerWidth = $('.main-content > .row').width();
9163			var $sidebarWidth = $containerWidth*.235;
9164			
9165			if(window.innerWidth > 1300){
9166				$sidebarWidth = $containerWidth*.235;
9167			} else if(window.innerWidth < 1300 && window.innerWidth > 1000 ) {
9168				$sidebarWidth = $containerWidth*.273;
9169			}
9170			
9171			$('#sidebar').css('width',$sidebarWidth+'px');
9172		}
9173	}
9174	
9175	$(window).load(function(){
9176		setTimeout(portfolioSidebarFollow,200);
9177	});
9178	
9179	
9180	//remove the portfolio filters that are not found in the current page
9181	function isotopeCatSelection() {
9182
9183
9184		$('.portfolio-items:not(".carousel")').each(function(){
9185
9186			var isotopeCatArr = [];
9187			var $portfolioCatCount = 0;
9188			$(this).parent().parent().find('div[class^=portfolio-filters] ul li').each(function(i){
9189				if($(this).find('a').length > 0) {
9190					isotopeCatArr[$portfolioCatCount] = $(this).find('a').attr('data-filter').substring(1);	
9191					$portfolioCatCount++;
9192				}
9193			});
9194			
9195			////ice the first (all)
9196			isotopeCatArr.shift();
9197			
9198			
9199			var itemCats = '';
9200			
9201			$(this).find('> div').each(function(i){
9202				itemCats += $(this).attr('data-project-cat');
9203			});
9204			itemCats = itemCats.split(' ');
9205			
9206			////remove the extra item on the end of blank space
9207			itemCats.pop();
9208			
9209			////make sure the array has no duplicates
9210			itemCats = $.unique(itemCats);
9211			
9212			////if user has chosen a set of filters to display - only show those
9213			if($(this).attr('data-categories-to-show').length != 0 && $(this).attr('data-categories-to-show') != 'all') {
9214				$userSelectedCats = $(this).attr('data-categories-to-show').replace(/,/g , ' ');
9215				$userSelectedCats = $userSelectedCats.split(' ');
9216				
9217				if(!$(this).hasClass('infinite_scroll')) $(this).removeAttr('data-categories-to-show');
9218			} else {
9219				$userSelectedCats = itemCats;
9220			}
9221			
9222			
9223			////Find which categories are actually on the current page
9224			var notFoundCats = [];
9225			$.grep(isotopeCatArr, function(el) {
9226
9227		    	if ($.inArray(el, itemCats) == -1) notFoundCats.push(el);
9228		    	if ($.inArray(el, $userSelectedCats) == -1) notFoundCats.push(el);
9229
9230			});
9231			
9232			//manipulate the list
9233			if(notFoundCats.length != 0){
9234				$(this).parent().parent().find('div[class^=portfolio-filters] ul li').each(function(){
9235					if($(this).find('a').length > 0) {
9236						if( $.inArray($(this).find('a').attr('data-filter').substring(1), notFoundCats) != -1 ){ 
9237							$(this).hide(); 
9238						} else {
9239							$(this).show();
9240						}
9241					}
9242				})
9243			}
9244		});
9245	}
9246	
9247	isotopeCatSelection();
9248	
9249	
9250	//sharing buttons
9251	/*jQuery.sharedCount = function(url, fn) {
9252		url = encodeURIComponent(url || location.href);
9253		var arg = {
9254			url: "//" + (location.protocol == "https:" ? "sharedcount.appspot" : "api.sharedcount") + ".com/?url=" + url,
9255			cache: true,
9256			dataType: "json"
9257		};
9258		if ('withCredentials' in new XMLHttpRequest) {
9259			arg.success = fn;
9260		}
9261		else {
9262			var cb = "sc_" + url.replace(/\W/g, '');
9263			window[cb] = fn;
9264			arg.jsonpCallback = cb;
9265			arg.dataType += "p";
9266		}
9267		return jQuery.ajax(arg);
9268	};*/
9269	
9270	
9271	
9272	
9273	var completed = 0;
9274	var windowLocation = window.location.href.replace(window.location.hash, '');
9275
9276	function facebookShare(){
9277		windowLocation = window.location.href.replace(window.location.hash, '');
9278		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" ) 
9279		return false;
9280	}
9281
9282	function googlePlusShare(){
9283		windowLocation = window.location.href.replace(window.location.hash, '');
9284		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" ) 
9285		return false;
9286	}
9287
9288	function twitterShare(){
9289        windowLocation = window.location.href.replace(window.location.hash, '');		
9290		if($(".section-title h1").length > 0) {
9291			var $pageTitle = encodeURIComponent($(".section-title h1").text());
9292		} else {
9293			var $pageTitle = encodeURIComponent($(document).find("title").text());
9294		}
9295		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" ) 
9296		return false;
9297	}
9298
9299	function wooTwitterShare(){
9300		windowLocation = window.location.href.replace(window.location.hash, '');
9301		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" ) 
9302		return false;
9303	}
9304
9305	function linkedInShare(){
9306	    windowLocation = window.location.href.replace(window.location.hash, '');	
9307		if($(".section-title h1").length > 0) {
9308			var $pageTitle = encodeURIComponent($(".section-title h1").text());
9309		} else {
9310			var $pageTitle = encodeURIComponent($(document).find("title").text());
9311		}
9312		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" ) 
9313		return false;
9314	}
9315
9316	function woolinkedInShare(){
9317	    windowLocation = window.location.href.replace(window.location.hash, '');	
9318		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" ) 
9319		return false;
9320	}
9321
9322	function pinterestShare(){
9323		windowLocation = window.location.href.replace(window.location.hash, '');
9324		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'); 
9325		
9326		if($(".section-title h1").length > 0) {
9327			var $pageTitle = encodeURIComponent($(".section-title h1").text());
9328		} else {
9329			var $pageTitle = encodeURIComponent($(document).find("title").text());
9330		}
9331		
9332		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" ) 
9333		return false;
9334	}
9335	
9336	function wooPinterestShare(){
9337		$imgToShare = ($('img.attachment-shop_single').length > 0) ? $('img.attachment-shop_single').first().attr('src') : $('.single-product-main-image img').first().attr('src');
9338		windowLocation = window.location.href.replace(window.location.hash, '');
9339		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" ) 
9340		return false;
9341	}
9342
9343
9344	function socialFade(){
9345			if(completed == $('a.nectar-sharing').length && $('a.nectar-sharing').parent().hasClass('in-sight')) {
9346
9347				//$timeout = ($('#page-header-bg[data-animate-in-effect="slide-down"] .nectar-social').length > 0 ) ? 500 : 1;
9348			//	setTimeout(function(){
9349					//$('.nectar-social > a').stop(true,true).transition({'padding-right':'15px'},350,'easeOutSine');
9350					
9351					//love fadein
9352					$('.nectar-social .nectar-love span').show(350,'easeOutSine',function(){
9353						$(this).stop().animate({'opacity':1},800);
9354					});
9355					
9356					//sharing loadin
9357					$('.nectar-social > a').each(function(i){
9358						var $that = $(this);
9359						
9360						$(this).find('> span').show(350,'easeOutSine',function(){
9361							$that.find('> span').stop().animate({'opacity':1},800);
9362						});
9363						
9364					});
9365				//},$timeout);
9366
9367				//alt blog layout total share count
9368				var $totalShares = 0;
9369				$('.nectar-social > a .count').each(function(){
9370					$totalShares += parseInt($(this).html());
9371				});
9372
9373				if($totalShares != 1){
9374					$('.single .meta-share-count .plural').css({'opacity':'1', 'display':'inline'});
9375					$('.single .meta-share-count .singular').remove();
9376				} else {
9377					$('.single .meta-share-count .singular').css({'opacity':'1', 'position':'relative',  'display':'inline'});
9378					$('.single .meta-share-count .plural').remove();
9379				}
9380
9381				$('.meta-share-count .share-count-total').html($totalShares).css('opacity',1);
9382			}
9383		}
9384
9385	$('body').on('click','#single-below-header .nectar-social a', function(){ return false; });
9386
9387	$('body').on('click','.facebook-share:not(.inactive)', facebookShare);
9388	$('body').on('click','.google-plus-share:not(.inactive)', googlePlusShare);
9389	$('body').on('click','.nectar-social:not(".woo") .twitter-share:not(.inactive)', twitterShare);
9390	$('body').on('click','.nectar-social.woo .twitter-share', wooTwitterShare);
9391	$('body').on('click','.nectar-social:not(".woo") .linkedin-share:not(.inactive)', linkedInS
9391hare);
9392	$('body').on('click','.nectar-social.woo .linkedin-share', woolinkedInShare);
9393	$('body').on('click','.nectar-social:not(".woo") .pinterest-share:not(.inactive)', pinterestShare);
9394	$('body').on('click','.nectar-social.woo .pinterest-share', wooPinterestShare);
9395
9396
9397	function socialSharingInit() {
9398
9399		//mobile fullscreen blog class for click event fix
9400		if($('body').hasClass('mobile') && $('.single-post .fullscreen-header').length > 0) {
9401			$('#single-below-header .nectar-social .nectar-sharing, #single-below-header .nectar-social .nectar-sharing-alt').addClass('inactive');
9402		}
9403
9404		completed = 0;
9405
9406		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) {
9407  
9408		 
9409			////facebook
9410			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) {
9411				
9412				//load share count on load  
9413				$.getJSON("https://graph.facebook.com/?id="+ windowLocation +'&callback=?', function(data) {
9414					if((data.shares != 0) && (data.shares != undefined) && (data.shares != null)) { 
9415						$('.facebook-share a span.count, a.facebook-share span.count').html( data.shares );	
9416					}
9417					else {
9418						$('.facebook-share a span.count, a.facebook-share span.count').html( 0 );	
9419					}
9420					completed++;
9421					socialFade();
9422				});
9423			 
9424				
9425				
9426			} else if($('a.facebook-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.facebook-share').length > 0) {
9427				completed++;
9428				socialFade();
9429			}
9430			
9431			
9432			////twitter
9433			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) {
9434				//load tweet count on load 
9435				//$.getJSON('https://cdn.api.twitter.com/1/urls/count.json?url='+windowLocation+'&callback=?', function(data) {
9436				//	if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
9437					//	$('.twitter-share a span.count, a.twitter-share span.count').html( data.count );
9438					//}
9439					//else {
9440					$('.twitter-share a span.count, a.twitter-share span.count').html( 0 );
9441					//}
9442					completed++;
9443					socialFade();
9444				//});
9445
9446
9447			} else if($('a.twitter-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.twitter-share').length > 0 ) {
9448				completed++;
9449				socialFade();
9450			}
9451			
9452			
9453			////linkedIn
9454			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) {
9455				//load share count on load 
9456				//$.getJSON('https://www.linkedin.com/countserv/count/share?url='+windowLocation+'&callback=', function(data) {
9457				//	if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
9458				//		$('.linkedin-share a span.count, a.linkedin-share span.count').html( data.count );
9459				//	}
9460				//	else {
9461						$('.linkedin-share a span.count, a.linkedin-share span.count').html( 0 );
9462				//	}
9463					completed++;
9464					socialFade();
9465				//});
9466
9467				
9468			} else if($('a.linkedin-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.linkedin-share').length > 0) {
9469				completed++;
9470				socialFade();
9471			}
9472			
9473			
9474			////pinterest
9475			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) {
9476				//load pin count on load 
9477				$.getJSON('https://api.pinterest.com/v1/urls/count.json?url='+windowLocation+'&callback=?', function(data) {
9478					if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
9479						$('.pinterest-share a span.count, a.pinterest-share span.count').html( data.count );
9480					}
9481					else {
9482						$('.pinterest-share a span.count, a.pinterest-share span.count').html( 0 );
9483					}
9484					completed++;
9485					socialFade();
9486				});
9487
9488			} else if($('a.pinterest-share').length > 0 && $('body[data-button-style="rounded"]').length >  0 || $('.sharing-default-minimal a.pinterest-share').length > 0) {
9489				completed++;
9490				socialFade();
9491
9492			}
9493			
9494			
9495			//fadeIn
9496			$('a.nectar-sharing > span.count, a.nectar-sharing-alt > span.count').hide().css('width','auto');
9497
9498
9499			//social light up
9500
9501			$('.nectar-social').each(function() {
9502				if($(this).parents('.custom-content').length == 0) {
9503
9504
9505					var $that = $(this);
9506					var waypoint = new Waypoint({
9507		 			element: $that,
9508		 			 handler: function(direction) {
9509
9510						$slide_timeout = ($('#page-header-bg[data-animate-in-effect="slide-down"] .nectar-social').length > 0 ) ? 900 : 1;
9511
9512						setTimeout(function(){
9513
9514							$that.addClass('in-sight');
9515							socialFade();
9516							
9517							if($('#page-header-bg .nectar-social').length == 0) {
9518								$that.find('> *').each(function(i){
9519									
9520									var $that = $(this);
9521									var $timeout = ($('body[data-button-style="rounded"]').length > 0) ? 0: 750;
9522
9523									setTimeout(function(){ 
9524										
9525										$that.delay(i*80).queue(function(){ 
9526											
9527											var $that = $(this); $(this).addClass('hovered'); 
9528											
9529											setTimeout(function(){ 
9530												$that.removeClass('hovered');
9531											},300); 
9532											
9533										});
9534									
9535									},$timeout);
9536								});
9537							}
9538
9539						},$slide_timeout );
9540
9541						$that.addClass('animated-in');
9542						waypoint.destroy();
9543					},
9544					offset: 'bottom-in-view'
9545
9546				}); 
9547
9548
9549					
9550				}
9551			}); 
9552
9553		}
9554
9555	}
9556	
9557	socialSharingInit();
9558
9559
9560	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
9561
9562		var $socialTimeout;
9563		$('body').on('mouseenter','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
9564			clearTimeout($socialTimeout);
9565
9566			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
9567				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'right':'0px'},0);
9568			else 
9569				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'left':'0px'},0);
9570
9571			$(this).parents('[id*="-meta"]').addClass('social-hovered');
9572
9573			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':0},250);
9574			$(this).find('.nectar-social a').each(function(i){
9575				$(this).stop(true).delay(i*40).animate({'opacity': 1,  'left':'0px'}, 150);
9576			});
9577
9578		});
9579
9580	
9581		$('body').on('mouseleave','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
9582			$(this).parents('[id*="-meta"]').removeClass('social-hovered');
9583
9584			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
9585				$(this).find('.nectar-social').stop(true).animate({'opacity': 0,  'right':'-20px'}, 200);
9586			else 
9587				$(this).find('.nectar-social').stop(true).animate({'opacity': 0,  'left':'-20px'}, 200);
9588
9589			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':1},250);
9590
9591			var $that = $(this);
9592			
9593			$socialTimeout = setTimeout(function(){ 
9594				$that.find('.nectar-social').hide(); 
9595				if($that.parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
9596					$that.find('.nectar-social a').stop(true).animate({'opacity': 0,  'left':'20px'},0);   
9597				else 
9598					$that.find('.nectar-social a').stop(true).animate({'opacity': 0,  'left':'-20px'},0);   
9599			}, 200);
9600		});
9601	} else {
9602		var $socialTimeout;
9603		$('body').on('click','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
9604			clearTimeout($socialTimeout);
9605
9606			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
9607				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'right':'0px'},0);
9608			else 
9609				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'left':'0px'},0);
9610
9611			$(this).parents('[id*="-meta"]').addClass('social-hovered');
9612
9613			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':0},250);
9614			$(this).find('.nectar-social a').each(function(i){
9615				$(this).stop(true).delay(i*40).animate({'opacity': 1,  'left':'0px'}, 150);
9616			});
9617
9618			return false;
9619		});
9620
9621	}
9622
9623	$('body').on('mouseenter','.fullscreen-header  .meta-share-count', function(){
9624		$(this).find('> a, > i').stop(true).animate({'opacity': 0},400);
9625		$(this).find('.nectar-social > *').each(function(i){
9626			$(this).stop(true).delay(i*50).animate({'opacity':'1', 'top': '0px'},250,'easeOutCubic');
9627		});
9628		//allow clickable on mobile
9629		setTimeout(function(){ $('.meta-share-count .nectar-sharing, .meta-share-count .nectar-sharing-alt').removeClass('inactive'); },300);
9630	});
9631
9632	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
9633		$('body').on('mouseleave','.fullscreen-header  .meta-share-count', function(){
9634			$(this).find('> a, > i').stop(true).animate({'opacity': 1},300,'easeInCubic');
9635			$(this).find('.nectar-social > *').each(function(i){
9636				$(this).stop(true).animate({'opacity':'0', 'top': '10px'},200,'easeInCubic');
9637			});
9638		});
9639	}
9640
9641
9642
9643
9644	//full width love center
9645	function nectarLoveFWCenter(){
9646		$('.nectar-social.full-width').each(function(){ 
9647			$(this).find('.n-shortcode .nectar-love').css('padding-top', $(this).find('> a').css('padding-top'));
9648		});
9649	}
9650	
9651	nectarLoveFWCenter();
9652	
9653
9654	//-----------------------------------------------------------------
9655	// NectarLove
9656	//-----------------------------------------------------------------
9657	
9658	$('body').on('click','.nectar-love', function() {
9659			
9660
9661			var $loveLink = $(this);
9662			var $id = $(this).attr('id');
9663			var $that = $(this);
9664			
9665			if($loveLink.hasClass('loved')) return false;
9666			if($(this).hasClass('inactive')) return false;
9667			
9668			var $dataToPass = {
9669				action: 'nectar-love', 
9670				loves_id: $id,
9671				love_nonce: nectarLove.loveNonce
9672			}
9673			
9674			$.post(nectarLove.ajaxurl, $dataToPass, function(data){
9675				$loveLink.find('span').html(data);
9676				$loveLink.addClass('loved').attr('title','You already love this!');
9677				$loveLink.find('span').css({'opacity': 1,'width':'auto'});
9678				//ascend
9679				if($('body').hasClass('ascend') && $that.parents('.classic_enhanced').length == 0 ){
9680					$loveLink.find('.icon-salient-heart.loved').show().transition({ scale: 1 },800,'cubic-bezier(0.15, 0.84, 0.35, 1.5)');
9681					setTimeout(function(){ $loveLink.find('.icon-salient-heart-2').css('opacity','0'); },400);
9682					if($loveLink.parents('.sharing-default-minimal').length > 0 && $loveLink.parents('.bottom-meta').length >0 ) $loveLink.find('.icon-salient-heart-2').remove();
9683				} else if($that.parents('.classic_enhanced').length > 0 ) {
9684					$that.find('.icon-salient-heart-2').addClass('loved');
9685				}
9686			});
9687			
9688			$(this).addClass('inactive');
9689			
9690			return false;
9691	});
9692
9693
9694	
9695	//infinite scroll
9696	function infiniteScrollInit() {
9697
9698		if($('.infinite_scroll').length > 0) {
9699			
9700			//portfolio
9701			$('.portfolio-items.infinite_scroll').infinitescroll({
9702		    	navSelector  : "div#pagination",            
9703		   	    nextSelector : "div#pagination a:first",    
9704		   	    itemSelector : ".portfolio-items.infinite_scroll .element",
9705		   	    finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
9706		        msgText: " ",         
9707		   },function(newElements){
9708		   	
9709
9710				var $container = $('.portfolio-items.infinite_scroll:not(.carousel)');
9711				//loading effect   
9712
9713		        var $newElems = $( newElements ).css('opacity',0);
9714		        //// ensure that images load before adding to masonry layout
9715		        $newElems.imagesLoaded(function(){
9716		          
9717		          $( newElements ).css('opacity',1);
9718
9719		          $container.isotope( 'appended', $( newElements ));
9720		          
9721		          $( newElements ).find('.work-item').addClass('ajax-loaded');
9722		          $( newElements ).addClass('ajax-loaded');
9723		          ///// show elems now they're ready
9724		          
9725		          $(newElements).find('.work-meta, .nectar-love-wrap').css({'opacity':1});
9726		          
9727		          //keep filtering
9728		          if($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) {
9729		          	
9730		          	  if($('.portfolio-filters-inline').length > 0) {
9731		          	  	 var selector = $('.portfolio-filters-inline a.active').attr('data-filter');
9732		          	  } else {
9733		          	  	 var selector = $('.portfolio-filters a.active').attr('data-filter');
9734		          	  }
9735		          	  
9736		          	  $('.portfolio-filters-inline a.active').attr('data-filter');
9737			  	 	  $container.isotope({ filter: selector });
9738		          }
9739		          
9740			  	//set width
9741			  	portfolioItemWidths();
9742			  	reLayout();
9743
9744		        if($(newElements).find('.work-item.style-5').length > 0) style6Img();
9745
9746	          	if($(newElements).find('.inner-wrap').attr('data-animation') == 'none') {
9747					$('.portfolio-items .col .inner-wrap').removeClass('animated');
9748				} else {
9749
9750					$(newElements).each(function(i){
9751
9752						$(this).delay(130*i).queue(function(next){
9753						    $(this).addClass("animated-in");
9754						    next();
9755						});
9756	
9757					}); //each
9758				}
9759
9760		       
9761		        portfolioHoverEffects();	
9762				portfolioAccentColor();
9763		         
9764		        //verify smooth scorlling
9765				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') } 
9766				
9767				
9768				//Panr 
9769				if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)) {
9770					
9771					$(".portfolio-items:not(.carousel) .work-item.style-3 img").panr({
9772						scaleDuration: .28
9773					}); 
9774					$(".portfolio-items:not(.carousel) .work-item.style-3-alt img").panr({ scaleDuration: .28, sensitivity: 12.6, scaleTo: 1.08, panDuration: 3 }); 
9775					
9776				}
9777				
9778				//prettyphoto
9779				$('.portfolio-items').each(function(){
9780					var $unique_id = Math.floor(Math.random()*10000);
9781					$(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel','prettyPhoto['+$unique_id+'_gal]').removeClass('pretty_photo');
9782				});
9783		
9784				lightBoxInit();
9785				
9786				piVertCenter();
9787
9788				setTimeout(function(){masonryZindex(); reLayout(); $( newElements ).removeClass('ajax-loaded'); },700);
9789		        
9790		        //recalc the filters
9791		        isotopeCatSelection();
9792
9793		        parallaxRowsBGCals();
9794	          
9795	          }); 
9796		          
9797		       
9798				
9799				
9800				
9801		   });
9802			
9803			
9804			
9805			//blog
9806			$('#post-area.infinite_scroll .posts-container').infinitescroll({
9807		    	navSelector  : "div#pagination",            
9808		   	    nextSelector : "div#pagination a:first",    
9809		   	    itemSelector : "#post-area .posts-container .post",
9810		   	    finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
9811		        msgText: " " 
9812		   },function(newElements){
9813		   	
9814		   	if($('.masonry.meta_overlaid').length == 0) { 
9815			   	//reinit js
9816			   	centerLove();
9817			   	
9818			   	//gallery
9819				$(newElements).find('.flex-gallery').each(function(){
9820					
9821					var $that = $(this);
9822					
9823					 $that.flexslider({
9824				        animation: 'fade',
9825				        smoothHeight: false, 
9826				        animationSpeed: 500,
9827				        useCSS: false, 
9828				        touch: true
9829				    });
9830					
9831					////gallery slider add arrows
9832					$('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="icon-angle-right"></i>');
9833					$('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="icon-angle-left"></i>');
9834
9835				});
9836			   	
9837			   	
9838			   	//media players
9839			   	if($().mediaelementplayer) $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer();
9840			   	
9841			   	
9842			   	//lightbox
9843			    lightBoxInit();
9844			   	
9845			   	//carousels
9846			   	if($('.carousel').length > 0) {
9847				   	standardCarouselInit();
9848			    	clientsCarouselInit();
9849			    }
9850			   	
9851			   	//iframes
9852			   	showLateIframes();
9853
9854			   	//milestone
9855			   	$(newElements).find('.nectar-milestone').each(function() {
9856					//symbol
9857					if($(this).has('[data-symbol]')) {
9858						if($(this).attr('data-symbol-pos') == 'before') {
9859							$(this).find('.number').prepend($(this).attr('data-symbol'));
9860						} else {
9861							$(this).find('.number').append($(this).attr('data-symbol'));
9862						}
9863					}
9864				});
9865				
9866				if(!$('body').hasClass('mobile')) {
9867					
9868					$(newElements).find('.nectar-milestone').each(function() {
9869						//animation
9870
9871							var $that = $(this);
9872							var waypoint = new Waypoint({
9873				 			element: $that,
9874				 			 handler: function(direction) {
9875								if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
9876								     waypoint.destroy();
9877								     return;
9878								}
9879
9880								var $endNum = parseInt($that.find('.number span').text());
9881								$that.find('.number span').countTo({
9882									from: 0,
9883									to: $endNum,
9884									speed: 1500,
9885									refreshInterval: 30
9886								});
9887
9888								$that.addClass('animated-in');
9889								waypoint.destroy();
9890							},
9891							offset: 'bottom-in-view'
9892
9893						}); 
9894
9895						
9896					}); 
9897				}
9898				
9899				//pie chart		
9900			    if($().vcChat) $(newElements).find('.vc_pie_chart').vcChat();
9901		    	
9902		    	//fancy ul
9903		    	nectar_fancy_ul_init();
9904		    	
9905		    	//testimonial slider
9906		    	$('.testimonial_slider').animate({'opacity':'1'},800);
9907		    	createTestimonialControls();
9908				testimonialSliderHeight(); 
9909				testimonialHeightResize();
9910		    	
9911				//bar graph
9912				$(newElements).find('.nectar-progress-bar').each(function(i){
9913				
9914
9915				var $that = $(this);
9916				var waypoint = new Waypoint({
9917		 			element: $that,
9918		 			 handler: function(direction) {
9919						if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
9920						     waypoint.destroy();
9921						     return;
9922						}
9923
9924						var percent = $that.find('span').attr('data-width');
9925						var $endNum = parseInt($that.find('span strong i').text());
9926						
9927						$that.find('span').transition({
9928							'width' : percent + '%'
9929						},1600, 'easeInOutCirc',function(){
9930						});
9931						
9932						$that.find('span strong').transition({
9933							'opacity' : 1
9934						},1350);
9935						
9936						
9937						$that.find('span strong i').countTo({
9938							from: 0,
9939							to: $endNum,
9940							speed: 1100,
9941							refreshInterval: 30,
9942							onComplete: function(){
9943					
9944							}
9945						});	
9946						
9947						////100% progress bar 
9948						if(percent == '100'){
9949							$that.find('span strong').addClass('full');
9950						}
9951
9952
9953						$that.addClass('animated-in');
9954						waypoint.destroy();
9955					},
9956					offset: 'bottom-in-view'
9957
9958				}); 
9959
9960
9961			
9962				});
9963				
9964				
9965				//columns & images with animation
9966				colAndImgAnimations();
9967				splitLineHeadings();
9968
9969				setTimeout(function(){
9970					videoshortcodeSize();
9971					responsiveVideoIframesInit();
9972					responsiveVideoIframes();
9973					$(window).trigger('resize');
9974				},500);
9975
9976
9977				parallaxRowsBGCals();
9978
9979				$(window).trigger('resize');
9980			   	
9981		   	}//non meta overlaid style 
9982		   	else {
9983		   		parallaxRowsBGCals();
9984
9985				$(window).trigger('resize');
9986		   	}
9987
9988		   	// trigger Masonry as a callback
9989		   	var $container = $('.posts-container');
9990		    if($container.parent().hasClass('masonry')) { 
9991		    	 
9992		    	$(newElements).addClass('masonry-blog-item');
9993				$(newElements).prepend('<span class="bottom-line"></span>');
9994				
9995				//move the meta to the bottom
9996				$(newElements).each(function(){
9997					
9998					var $metaClone = $(this).find('.post-meta').clone();
9999		
10000					$(this).find('.post-meta').remove();
10001					
10002					if($('#post-area.meta_overlaid').length > 0){
10003						$(this).find('.post-header h2').after($metaClone);
10004					} else {
10005						$(this).find('.content-inner').after($metaClone);
10006					}
10007					
10008				});
10009			
10010		    	}//if masonry
10011
10012
10013		    	//loading effect   
10014		    	
10015		        //// hide new items while they are loading
10016		        var $newElems = $( newElements );
10017		        //// ensure that images load before adding to masonry layout
10018
10019		        if($newElems.find('img').length == 0) $newElems = $('body');
10020		        
10021		        $newElems.imagesLoaded(function(){
10022
10023		          $container.isotope( 'appended', $( newElements ));
10024
10025		          flickityBlogInit();
10026
10027		          $( newElements ).addClass('ajax-loaded');
10028		          ///// show elems now they're ready
10029
10030
10031		        //classic enhanced specific 
10032		        if($container.parent().hasClass('classic_enhanced')){
10033					$container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function(){
10034						var $src = $(this).find('img').attr('src');
10035						$(this).css('background-image','url('+$src+')');
10036					});
10037
10038					$container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function(){
10039
10040						$(this).find('.cell').each(function(){
10041							var $src = $(this).find('img').attr('src');
10042							$(this).css('background-image','url('+$src+')');
10043						});
10044						
10045					});
10046				}
10047
10048
10049		          if($(newElements).parents('.posts-container').attr('data-animation') == 'none') {
10050						$( newElements ).find('.inner-wrap').removeClass('animated');
10051					} else {
10052
10053						$(newElements).each(function(i){
10054
10055							$(this).delay(130*i).queue(function(next){
10056							    $(this).addClass("animated-in");
10057							    next();
10058							});
10059		
10060						}); //each
10061					}
10062
10063					setTimeout(function(){$( newElements ).removeClass('ajax-loaded'); },700);
10064
10065		        
10066		        });
10067		        
10068		    
10069		   	
10070		   });
10071		   
10072	   }
10073
10074}
10075
10076infiniteScrollInit();
10077
10078function destroyInfiniteScroll(){
10079	$('#post-area.infinite_scroll .posts-container').infinitescroll('destroy');
10080	$('.portfolio-items.infinite_scroll').infinitescroll('destroy');
10081}
10082	
10083/*-------------------------------------------------------------------------*/
10084/*	6.	Scroll to top
10085/*-------------------------------------------------------------------------*/	
10086
10087var $scrollTop = $(window).scrollTop();
10088
10089//starting bind
10090function toTopBind() {
10091	if( $('#to-top').length > 0 && $(window).width() > 1020 || $('#to-top').length > 0 &&  $('#to-top.mobile-enabled').length > 0 ) {
10092		
10093		if($scrollTop > 350){
10094			$(window).on('scroll',hideToTop);
10095		}
10096		else {
10097			$(window).on('scroll',showToTop);
10098		}
10099	}
10100}
10101toTopBind();
10102
10103function showToTop(){
10104	
10105	if( $scrollTop > 350 && $('#slide-out-widget-area.fullscreen.open').length == 0){
10106
10107		$('#to-top').stop().transition({
10108			'bottom' : '17px'
10109		},350,'easeInOutCubic');	
10110		
10111		$(window).off('scroll',showToTop);
10112		$(window).on('scroll',hideToTop);
10113	}
10114
10115}
10116
10117function hideToTop(){
10118	
10119	if( $scrollTop < 350 || $('#slide-out-widget-area.fullscreen.open').length > 0){
10120
10121		$animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350;
10122
10123		$('#to-top').stop().transition({
10124			'bottom' : '-30px'
10125		},$animationTiming,'easeInOutQuint');	
10126		
10127		$(window).off('scroll',hideToTop);
10128		$(window).on('scroll',showToTop);	
10129		
10130	}
10131}
10132
10133
10134//to top color
10135if( $('#to-top').length > 0 ) {
10136	
10137	var $windowHeight, $pageHeight, $footerHeight, $ctaHeight;
10138	
10139	function calcToTopColor(){
10140		$scrollTop = $(window).scrollTop();
10141		$windowHeight = $(window).height();
10142		$pageHeight = $('body').height();
10143		$footerHeight = $('#footer-outer').height();
10144		$ctaHeight = ($('#call-to-action').length > 0) ? $('#call-to-action').height() : 0;
10145		
10146		if( ($scrollTop-35 + $windowHeight) >= ($pageHeight - $footerHeight) && $('#boxed').length == 0){
10147			$('#to-top').addClass('dark');
10148		}
10149		
10150		else {
10151			$('#to-top').removeClass('dark');
10152		}
10153	}
10154	
10155	//calc on scroll
10156	$(window).scroll(calcToTopColor);
10157	
10158	//calc on resize
10159	$(window).resize(calcToTopColor);
10160
10161}
10162
10163//alt style
10164if($('body[data-button-style="rounded"]').length > 0){
10165	var $clone = $('#to-top .icon-angle-up').clone();
10166	$clone.addClass('top-icon');
10167	$('#to-top').prepend($clone)
10168}
10169
10170//scroll up event
10171$('body').on('click','#to-top, a[href="#top"]',function(){
10172	$('body,html').stop().animate({
10173		scrollTop:0
10174	},800,'easeOutQuad',function(){
10175		if($('.nectar-box-roll').length > 0) {
10176			$('body').trigger('mousewheel', [1, 0, 0]);
10177		}
10178	})
10179	return false;
10180});
10181
10182
10183/* one page scrolling */
10184function scrollSpyInit(){ 
10185
10186	//remove full page URLs from hash if located on same page to fix current menu class
10187	//if(location.pathname.length > 1) {
10188		$("#header-outer a[href*='" + location.pathname + "']").each(function(){
10189			var $href = $(this).attr('href');
10190			
10191			if($href.indexOf("#") != -1 && $('div'+$href.substr($href.indexOf("#"))).length > 0 ) {
10192				$(this).attr('href',$href.substr($href.indexOf("#")));
10193				$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
10194			}
10195		});
10196	//}
10197
10198	$target = ($('.page-submenu[data-sticky="true"]').length == 0) ? '#header-outer nav': '.page-submenu';
10199	$('body').scrollspy({
10200		target: $target,
10201		offset: $('#header-outer').height() + adminBarHeight + 40
10202	});
10203
10204}
10205
10206function pageLoadHash() {
10207
10208	var $hash = window.location.hash;
10209	if($hash && $($hash).length > 0) {
10210
10211		$timeoutVar = 0;
10212		if($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
10213			boxRoll(null,-1);
10214			$timeoutVar = 2050;
10215		} 
10216		setTimeout(function(){
10217		
10218			if( $('body[data-permanent-transparent="1"]').length == 0 ) {
10219				
10220				if(!$('body').hasClass('mobile')){
10221					$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
10222					var $scrollTopDistance =  $($hash).offset().top - parseInt($('#header-space').height()) +$resize + 3 - adminBarHeight;
10223				} else {
10224					var $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $('#header-space').height() + adminBarHeight : $($hash).offset().top - adminBarHeight + 1;	
10225				}
10226
10227			} else {
10228				var $scrollTopDistance = $($hash).offset().top - adminBarHeight + 1;
10229			}
10230
10231			if($('body[data-hhun="1"]').length > 0) {
10232				//alter offset 
10233				if($('#header-outer.detached').length == 0) 
10234					$scrollTopDistance = $scrollTopDistance + $('#header-space').height();
10235			}
10236
10237			var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0;
10238
10239			$('body,html').stop().animate({
10240				scrollTop: $scrollTopDistance - $pageSubMenu
10241			},800,'easeInOutCubic');
10242
10243		},$timeoutVar);
10244	}
10245}
10246
10247if($('body[data-animated-anchors="true"]').length > 0) { 
10248
10249
10250+ function(t) {
10251    "use strict";
10252
10253    function s(e, i) {
10254        var r = t.proxy(this.process, this);
10255        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()
10256    }
10257
10258    function e(e) {
10259        return this.each(function() {
10260            var i = t(this),
10261                r = i.data("bs.scrollspy"),
10262                o = "object" == typeof e && e;
10263            r || i.data("bs.scrollspy", r = new s(this, o)), "string" == typeof e && r[e]()
10264        })
10265    }
10266    s.VERSION = "3.2.0", s.DEFAULTS = {
10267        offset: 10
10268    }, s.prototype.getScrollHeight = function() {
10269        return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
10270    }, s.prototype.refresh = function() {
10271        var s = "offset",
10272            e = 0;
10273        t.isWindow(this.$scrollElement[0]) || (s = "position", e = this.$scrollElement.scrollTop()), this.offsets = [], this.targets = [], this.scrollHeight = this.get
10273ScrollHeight();
10274        var i = this;
10275        this.$body.find(this.selector).map(function() {
10276            var i = t(this),
10277                r = i.data("target") || i.attr("href"),
10278                o = /^#./.test(r) && t(r);
10279            return o && o.length && o.is(":visible") && [
10280                [o[s]().top + e, r]
10281            ] || null
10282        }).sort(function(t, s) {
10283            return t[0] - s[0]
10284        }).each(function() {
10285            i.offsets.push(this[0]), i.targets.push(this[1])
10286        })
10287    }, s.prototype.process = function() {
10288    	var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0 && $('body[data-hhun="1"]').length == 0) ? $('.page-submenu').height() : 0;
10289
10290        var t, s = this.$scrollElement.scrollTop() + this.options.offset + $pageSubMenu,
10291            e = this.getScrollHeight(),
10292            i = this.options.offset + e - this.$scrollElement.height() -$pageSubMenu,
10293            r = this.offsets,
10294            o = this.targets,
10295            l = this.activeTarget;
10296        if (this.scrollHeight != e && this.refresh(), s >= i) return l != (t = o[o.length - 1]) && this.activate(t);
10297        if (l && s <= r[0]) return l != (t = o[0]) && this.activate(t);
10298        for (t = r.length; t--;) l != o[t] && s >= r[t] && (!r[t + 1] || s <= r[t + 1]) && this.activate(o[t])
10299    }, s.prototype.activate = function(s) {
10300        this.activeTarget = s, t(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover');
10301        var e = this.selector + '[data-target="' + s + '"],' + this.selector + '[href="' + s + '"]',
10302            i = t(e).parents("li").addClass("current-menu-item");
10303        i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("current-menu-item")), i.trigger("activate.bs.scrollspy")
10304    };
10305    var i = t.fn.scrollspy;
10306    t.fn.scrollspy = e, t.fn.scrollspy.Constructor = s, t.fn.scrollspy.noConflict = function() {
10307        return t.fn.scrollspy = i, this
10308    }
10309}(jQuery);
10310
10311
10312var shrinkNum = 6;	
10313if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
10314headerPadding2 = headerPadding - headerPadding/1.8;
10315
10316setTimeout(scrollSpyInit,200);
10317
10318var $animatedScrollingTimeout;
10319
10320$('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){
10321
10322	var $hash = $(this).prop("hash");	
10323
10324	$('body').addClass('animated-scrolling');
10325	clearTimeout($animatedScrollingTimeout);
10326	$animatedScrollingTimeout = setTimeout(function(){ $('body').removeClass('animated-scrolling'); },850);
10327
10328	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') {
10329
10330		//stop scrolling for certain elements
10331		//if($(this).parents('.tabbed').length > 0) return false;
10332		
10333		//update hash
10334		if(history.pushState) {
10335		    history.pushState(null, null, $hash);
10336		}
10337		else {
10338		    location.hash = $hash;
10339		}
10340
10341		if($(this).parents('ul').length > 0) { 
10342			$(this).parents('ul').find('li').removeClass('current-menu-item');
10343			//$(this).parents('li').addClass('current-menu-item');
10344		}
10345
10346		//side widget area click
10347		if($(this).parents('#slide-out-widget-area').length > 0){
10348			$('#slide-out-widget-area .slide_out_area_close').trigger('click');
10349		}
10350
10351		//mobile menu click
10352		if($(this).parents('#mobile-menu').length > 0) $('#toggle-nav').trigger('click');
10353		var $mobileMenuHeight = ($(this).parents('#mobile-menu').length > 0) ? $(this).parents('#mobile-menu').height() : null;
10354		
10355		$timeoutVar = 1;
10356		if($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
10357			boxRoll(null,-1);
10358			$timeoutVar = 2050;
10359		} 
10360
10361		var $that = $(this);
10362
10363		setTimeout(function(){
10364
10365			//scrolling
10366			var $headerSpace = ($('body[data-permanent-transparent="1"]').length > 0) ? 0 : parseInt($('#header-space').height());
10367
10368			if( $('body[data-permanent-transparent="1"]').length == 0 ) {
10369				
10370				if(!$('body').hasClass('mobile')){
10371					$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
10372					var $scrollTopDistance =  $($hash).offset().top - $mobileMenuHeight - parseInt($('#header-space').height()) +$resize + 3 - adminBarHeight;
10373				} else {
10374					var $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $('#header-space').height() + adminBarHeight : $($hash).offset().top - $mobileMenuHeight - adminBarHeight + 1;	
10375				}
10376
10377			} else {
10378				var $scrollTopDistance = $($hash).offset().top - adminBarHeight + 1;
10379			}
10380
10381			if($('body[data-hhun="1"]').length > 0) {
10382				//alter offset 
10383				if($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) 
10384					$scrollTopDistance = $scrollTopDistance + $('#header-space').height();
10385
10386				//hide top header
10387				if($that.parents('.page-submenu[data-sticky="true"]').length > 0) { 
10388					$('#header-outer.detached').addClass('invisible');
10389					$('.page-submenu').addClass('header-not-visible').css('transform','translateY(0px)');
10390				}
10391			} 
10392
10393			var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0;
10394			$('body,html').stop().animate({
10395				scrollTop: $scrollTopDistance - $pageSubMenu
10396			},800,'easeInOutCubic');
10397
10398		},$timeoutVar);
10399		
10400
10401		e.preventDefault();
10402
10403	}
10404
10405	if($hash == '#top') {
10406		//side widget area click
10407		if($(this).parents('#slide-out-widget-area').length > 0){
10408			$('#slide-out-widget-area .slide_out_area_close').trigger('click');
10409		}
10410	}
10411
10412
10413});
10414
10415
10416if($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) $(window).load(pageLoadHash);
10417
10418}
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429	//portfolio colors
10430	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 ) {
10431		var portfolioColorCss = '';
10432		$('.portfolio-items .col').each(function(){
10433			$titleColor = $(this).attr('data-title-color');
10434			$subTitleColor = $(this).attr('data-subtitle-color');
10435
10436			 if($titleColor.length > 0 ) portfolioColorCss += '.col[data-title-color="'+$titleColor+'"] .vert-center h3, .portfolio-items[data-ps="6"] .col[data-title-color="'+$titleColor+'"] .work-meta h4 { color: '+$titleColor+'; } ';
10437			 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+'; } ';
10438		});
10439
10440
10441		var head = document.head || document.getElementsByTagName('head')[0];
10442		var style = document.createElement('style');
10443
10444			style.type = 'text/css';
10445		if (style.styleSheet){
10446		  style.styleSheet.cssText = portfolioColorCss;
10447		} else {
10448		  style.appendChild(document.createTextNode(portfolioColorCss));
10449		}
10450
10451		head.appendChild(style);
10452	}
10453
10454	// masonryPortfolio
10455
10456	var $portfolio_containers = [];
10457
10458	$('.portfolio-items:not(.carousel)').each(function(i){
10459		$portfolio_containers[i] = $(this);
10460	});
10461
10462	function masonryPortfolioInit() {
10463
10464		$portfolio_containers = [];
10465		$('.portfolio-items:not(.carousel)').each(function(i){
10466			$portfolio_containers[i] = $(this);
10467		});
10468
10469		//// cache window
10470		var $window = jQuery(window);	
10471		
10472			
10473			$.each($portfolio_containers,function(i){
10474
10475				
10476				//// start up isotope with default settings
10477				$portfolio_containers[i].imagesLoaded(function(){
10478					
10479					//verify smooth scorlling
10480					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') } 
10481					
10482					//transformns enabled logic
10483					var $isoUseTransforms = true;
10484					
10485					//Panr 
10486					if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
10487						
10488						$(".portfolio-items:not(.carousel) .work-item.style-3 img").panr({ scaleDuration: .28 }); 
10489						$(".portfolio-items:not(.carousel) .work-item.style-3-alt img").panr({ scaleDuration: .28, sensitivity: 20, scaleTo: 1.12, panDuration: 1 }); 
10490
10491						$isoUseTransforms = true;
10492						
10493					}
10494
10495					piVertCenter();
10496
10497					//initial call to setup isotope
10498					var $layoutMode = ( $portfolio_containers[i].hasClass('masonry-items')) ? 'packery' : 'fitRows';
10499					var $startingFilter = ($portfolio_containers[i].attr('data-starting-filter') != '' && $portfolio_containers[i].attr('data-starting-filter') != 'default') ? '.' + $portfolio_containers[i].attr('data-starting-filter') : '*';
10500
10501					reLayout();
10502					
10503					$portfolio_containers[i].isotope({
10504					  itemSelector : '.element',
10505					  filter: $startingFilter,
10506					  layoutMode: $layoutMode,
10507					  transitionDuration: '0.6s',
10508					  packery: {
10509						 gutter: 0
10510					  }
10511					}).isotope( 'layout' );
10512					
10513					
10514					if($startingFilter != '*'){
10515						$('.portfolio-filters ul a[data-filter="'+$startingFilter+'"], .portfolio-filters-inline ul a[data-filter="'+$startingFilter+'"]').click();
10516					}
10517
10518					//call the reLayout to get things rollin'
10519					masonryZindex();
10520					setTimeout(function(){masonryZindex(); },800);
10521					$window.resize( reLayout );
10522					$window.smartresize( function(){
10523						setTimeout(masonryZindex,700);
10524					});
10525					
10526					//inside fwc fix
10527					if($portfolio_containers[i].parents('.full-width-content').length > 0) { setTimeout(function(){ fullWidthContentColumns(); },200);  }
10528
10529					//fadeout the loading animation
10530					$('.portfolio-loading').stop(true,true).fadeOut(200);
10531					
10532					//fadeIn items one by one
10533
10534					if($portfolio_containers[i].find('.inner-wrap').attr('data-animation') == 'none') {
10535						$('.portfolio-items .col .inner-wrap').removeClass('animated');
10536					} else {
10537
10538						portfolioLoadIn();
10539					}
10540			
10541				});
10542				
10543
10544
10545			});//each
10546			
10547		
10548
10549	}
10550
10551	masonryPortfolioInit();
10552
10553	function portfolioLoadIn() {
10554
10555		$($fullscreenSelector+'.portfolio-items').each(function(){
10556
10557			$portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : '90%';
10558
10559			if($(this).find('.inner-wrap').attr('data-animation') == 'none') return;
10560
10561			var $that = $(this);
10562			var waypoint = new Waypoint({
10563 			element: $that,
10564 			 handler: function(direction) {
10565				
10566				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
10567				     waypoint.destroy();
10568				     return;
10569				}
10570
10571				$that.find('.col').each(function(i){
10572					$(this).delay(130*i).queue(function(next){
10573					    $(this).addClass("animated-in");
10574					    next();
10575					});
10576				});
10577				
10578				waypoint.destroy();
10579			},
10580			offset: $portfolioOffsetPos
10581
10582			}); 
10583
10584		}); //each
10585					
10586	}
10587
10588
10589	
10590
10591	var mediaQuerySize;
10592	function reLayout() {
10593
10594		clearTimeout(clearIsoAnimation);
10595	    $('.portfolio-items .col').addClass('no-transition');
10596	    clearIsoAnimation = setTimeout(function(){  $('.portfolio-items .col').removeClass('no-transition'); },700); 
10597
10598		var windowSize = $window.width();
10599		var masonryObj;
10600		var masonryObjHolder = [];
10601
10602		//remove double quotes for FF
10603		//if (navigator.userAgent.match('MSIE 8') == null) {
10604		//	mediaQuerySize = mediaQuerySize.replace(/"/g, '');
10605		//}
10606		
10607		//user defined cols
10608		var userDefinedColWidth;
10609
10610		$.each($portfolio_containers,function(i){
10611
10612			if( $portfolio_containers[i].attr('data-user-defined-cols') == 'span4') {
10613				userDefinedColWidth = 3
10614			} 
10615			
10616			else if( $portfolio_containers[i].attr('data-user-defined-cols') == 'span3') {
10617				userDefinedColWidth = 4
10618			} 
10619			
10620			var isFullWidth = $portfolio_containers[i].attr('data-col-num') == 'elastic';
10621			
10622			
10623			//chrome 33 approved method for getting column sizing
10624			if(window.innerWidth > 1600){
10625				
10626				if($portfolio_containers[i].hasClass('constrain-max-cols')) {
10627					mediaQuerySize = 'four';
10628				} else {
10629					mediaQuerySize = 'five';
10630				}
10631				
10632			} else if(window.innerWidth <= 1600 && window.innerWidth > 1300){
10633				mediaQuerySize = 'four';
10634			} else if(window.innerWidth <= 1300 && window.innerWidth > 990){
10635				
10636				if($portfolio_containers[i].hasClass('constrain-max-cols')) {
10637					mediaQuerySize = 'four';
10638				} else {
10639					mediaQuerySize = 'three';
10640				}
10641				
10642			} else if(window.innerWidth <= 990 && window.innerWidth > 470){
10643				mediaQuerySize = 'two';
10644			} else if(window.innerWidth <= 470){
10645				mediaQuerySize = 'one';
10646			}
10647			
10648			//boxed
10649			if($('#boxed').length > 0) {
10650				if(window.innerWidth > 1300){
10651					mediaQuerySize = 'four';
10652				} else if(window.innerWidth < 1300 && window.innerWidth > 990){
10653					
10654					if($portfolio_containers[i].hasClass('constrain-max-cols')) {
10655						mediaQuerySize = 'four';
10656					} else {
10657						mediaQuerySize = 'three';
10658					}
10659
10660				} else if(window.innerWidth < 990){
10661					mediaQuerySize = 'one';
10662				}
10663				
10664			}
10665			
10666			//change masonry columns depending on screen size
10667			switch (mediaQuerySize) {
10668				case 'five':
10669					(isFullWidth) ? colWidth = 5 : colWidth = userDefinedColWidth;
10670					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
10671				break;
10672				
10673				case 'four':
10674					(isFullWidth) ? colWidth = 4 : colWidth = userDefinedColWidth;
10675
10676					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
10677				break;
10678				
10679				case 'three':
10680					(isFullWidth) ? colWidth = 3 : colWidth = userDefinedColWidth;
10681					
10682					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
10683				break;
10684				
10685				case 'two':
10686					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / 2) };
10687				break;
10688				
10689				case 'one':
10690					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / 1) };
10691				break;
10692			}
10693
10694
10695			//set widths
10696			portfolioItemWidths();
10697
10698
10699			//sizing for large items
10700			if( $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="regular"]:first:visible').length > 0 || $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="wide"]:first:visible').length > 0 || $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="tall"]:first:visible').length > 0 || $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="wide_tall"]:first:visible').length > 0) {
10701
10702			var multipler = (window.innerWidth > 470) ? 2 : 1;
10703
10704			//reset height for calcs
10705			$itemClassForSizing = 'regular';
10706
10707			if($portfolio_containers[i].find('.col.elastic-portfolio-item[class*="regular"]:first:visible').length == 0 && $portfolio_containers[i].find('.col.elastic-portfolio-item.wide:first:visible').length > 0) {
10708				$itemClassForSizing = 'wide';
10709			} else if($portfolio_containers[i].find('.col.elastic-portfolio-item[class*="regular"]:first:visible').length == 0 && $portfolio_containers[i].find('.col.elastic-portfolio-item.wide_tall:first:visible').length > 0) {
10710				$itemClassForSizing = 'wide_tall';
10711				multipler = 1;
10712			} else if($portfolio_containers[i].find('.col.elastic-portfolio-item[class*="regular"]:first:visible').length == 0 && $portfolio_containers[i].find('.col.elastic-portfolio-item.tall:first:visible').length > 0) {
10713				$itemClassForSizing = 'tall';
10714				multipler = 1;
10715			}
10716
10717		    $portfolio_containers[i].find('.col.elastic-portfolio-item.'+$itemClassForSizing+' img').css('height','auto');
10718
10719			var tallColHeight = $portfolio_containers[i].find('.col.elastic-portfolio-item.'+$itemClassForSizing+':first:visible img').height();
10720			
10721			 $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');
10722			 $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="tall"] img:not(.custom-thumbnail)').css('height',(tallColHeight*multipler));
10723			 $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);
10724			 
10725			 $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 );
10726			 $portfolio_containers[i].find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',tallColHeight);
10727			
10728			} else {
10729				$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');
10730			}
10731
10732			//non masonry
10733
10734			if($portfolio_containers[i].hasClass('no-masonry') && $portfolio_containers[i].find('.col:first:visible').length > 0 && $portfolio_containers[i].parents('.wpb_gallery').length == 0){
10735			  
10736			   //reset height for calcs
10737		   	   $portfolio_containers[i].find('.col img').css('height','auto');
10738		   	   var tallColHeight = $portfolio_containers[i].find('.col:first:visible img').height();
10739		   	   $portfolio_containers[i].find('.col img:not(.custom-thumbnail)').css('height',tallColHeight);
10740		   	   $portfolio_containers[i].find('.col .parallaxImg').css('height',tallColHeight);
10741			}
10742
10743
10744			masonryObjHolder[i] = masonryObj;
10745			
10746			if($portfolio_containers[i].isotope()) $portfolio_containers[i].isotope( 'layout' ); 
10747				
10748			
10749
10750		}); //each
10751	
10752	}
10753
10754	function portfolioItemWidths() {
10755		 $.each($portfolio_containers,function(i,v){
10756		 	var $colSize = 4;
10757		 	var $mult = (mediaQuerySize == 'one') ? 1 : 2;
10758		 	if(mediaQuerySize == 'five') $colSize = 5;
10759		 	if(mediaQuerySize == 'four') $colSize = 4;
10760		 	if(mediaQuerySize == 'three') $colSize = 3;
10761		 	if(mediaQuerySize == 'two') $colSize = 2;
10762		 	if(mediaQuerySize == 'one') $colSize = 1;
10763		 	if($(v).is('[data-ps="6"]') && $colSize == 5) $colSize = 4;
10764
10765		 	if($(v).width() % $colSize == 0) {
10766			 	$(v).find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',Math.floor($(v).width()/$colSize) +'px');
10767			 	$(v).find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',Math.floor($(v).width()/$colSize*$mult) +'px');
10768			 } else {
10769			 	//find closest number to give 0
10770			 	for(var i = 1; i<4; i++) {
10771			 		if(($(v).width() - i) % $colSize == 0) {
10772			 			$(v).find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',($(v).width()- i)/$colSize +'px');
10773			 			$(v).find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',($(v).width()-i)/$colSize*$mult +'px');
10774			 		}
10775
10776			 	}
10777			 }
10778		 	
10779		 });
10780	}
10781
10782	//z-index for masonry
10783	function masonryZindex(){
10784		
10785		//escape if no browser support
10786		if($('body .portfolio-items:not(".carousel") .elastic-portfolio-item').css('left')) {
10787		
10788			var $coords = {};
10789			var $zindexRelation = {};
10790			
10791			$('body .portfolio-items:not(".carousel") .elastic-portfolio-item').each(function(){
10792				//$coords[$(this).index()] = $(this).css('left').substring(0, $(this).css('left').length - 2);
10793				$(this).css('z-index',Math.abs(Math.floor($(this).offset().left/20)));
10794			});
10795			
10796			/*var $corrdsArr = $.map($coords, function (value) { return value; });
10797
10798			$corrdsArr = removeDuplicates($corrdsArr);
10799			$corrdsArr.sort(function(a,b){return a-b});
10800
10801			for(var i = 0; i < $corrdsArr.length; i++){
10802				$zindexRelation[$corrdsArr[i]] = i*10; 
10803			}
10804	
10805			$.each($coords,function(k,v){
10806				
10807				var $zindex;
10808				var $coordCache = v;
10809				$.each($zindexRelation,function(k,v){
10810					if($coordCache == k) {
10811						$zindex = v;
10812					}
10813				});
10814	
10815				$('body .portfolio-items:not(".carousel") .elastic-portfolio-item:eq('+k+')').css('z-index',$zindex);
10816			});*/
10817			
10818		}
10819
10820
10821	}
10822
10823	function blogMasonryZindex(){
10824		
10825		//escape if no browser support
10826		if($('body .masonry.meta_overlaid .masonry-blog-item').css('left')) {
10827		
10828			var $coords = {};
10829			var $zindexRelation = {};
10830			
10831			$('body .masonry.meta_overlaid .masonry-blog-item').each(function(){
10832				$coords[$(this).index()] = $(this).css('left').substring(0, $(this).css('left').length - 2);
10833			});
10834			
10835			var $corrdsArr = $.map($coords, function (value) { return value; });
10836			$corrdsArr = removeDuplicates($corrdsArr);
10837			$corrdsArr.sort(function(a,b){return a-b});
10838	
10839			for(var i = 0; i < $corrdsArr.length; i++){
10840				$zindexRelation[$corrdsArr[i]] = i*10; 
10841			}
10842	
10843			$.each($coords,function(k,v){
10844				
10845				var $zindex;
10846				var $coordCache = v;
10847				$.each($zindexRelation,function(k,v){
10848					if($coordCache == k) {
10849						$zindex = v;
10850					}
10851				});
10852	
10853				$('body .masonry.meta_overlaid .masonry-blog-item:eq('+k+')').css('z-index',$zindex);
10854			});
10855			
10856		}
10857		
10858	}
10859	
10860	function matrixToArray(matrix) {
10861	    return matrix.substr(7, matrix.length - 8).split(', ');
10862	}
10863	
10864	function removeDuplicates(inputArray) {
10865        var i;
10866        var len = inputArray.length;
10867        var outputArray = [];
10868        var temp = {};
10869
10870        for (i = 0; i < len; i++) {
10871            temp[inputArray[i]] = 0;
10872        }
10873        for (i in temp) {
10874            outputArray.push(i);
10875        }
10876        return outputArray;
10877    }
10878
10879    //// filter items when filter link is clicked
10880	var clearIsoAnimation = null;
10881	var $checkForScrollBar = null;
10882
10883
10884	//number portfolios so multiple sortable ones can work easily on same page
10885	$('.portfolio-items:not(".carousel")').each(function(i){
10886		$(this).attr('instance',i);
10887		$(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance',i);
10888	});
10889
10890    function isoClickFilter(){
10891		 var $timeout;		 
10892		 if(window.innerWidth > 690 && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
10893		 	
10894
10895		 	/*clearInterval($checkForScrollBar);
10896
10897		 	if($('html').outerHeight(true) > $(window).height()) {
10898
10899			 	$checkForScrollBar = null;
10900			 	$checkForScrollBar = setInterval(function(){ 
10901
10902			 		if($('body').height() <= $(window).height()) {
10903			 			fullWidthSections();
10904			 			$(window).trigger('resize');
10905			 			clearInterval($checkForScrollBar);
10906			 		} 
10907			 	},40);
10908			} else {
10909
10910				$checkForScrollBar = null;
10911			 	$checkForScrollBar = setInterval(function(){ 
10912
10913			 		if($('html').outerHeight(true) > $(window).height()) {
10914			 			fullWidthSections();
10915			 			$(window).trigger('resize');
10916			 			clearInterval($checkForScrollBar);
10917			 		} 
10918			 	},40);
10919			}*/	 
10920
10921			 //add css animation only for sorting	 
10922			/*  clearTimeout(clearIsoAnimation);
10923			  $('.isotope, .isotope .isotope-item').css('transition-duration','0.7s');
10924			  clearIsoAnimation = setTimeout(function(){  $('.isotope, .isotope .isotope-item').css('transition-duration','0s'); },700); */
10925			  
10926			 clearTimeout($timeout);
10927			 $timeout = setTimeout(function(){masonryZindex();  },600);
10928
10929			  
10930		 }
10931		  
10932		  var selector = $(this).attr('data-filter');
10933		  var $instance = $(this).parents('div[class^=portfolio-filters]').attr('instance');
10934
10935		  $.each($portfolio_containers,function(i){
10936		  	if($portfolio_containers[i].attr('instance') == $instance) $portfolio_containers[i].isotope({ filter: selector }).attr('data-current-cat',selector);
10937		  });
10938
10939
10940		  //active classes
10941		  $(this).parent().parent().find('li a').removeClass('active');
10942		  $(this).addClass('active');
10943		  
10944		  //update pp
10945		  if($('.portfolio-items a[rel^="prettyPhoto"]').length > 0) {
10946		  	setTimeout(updatePrettyPhotoGallery,170);
10947		  }
10948
10949		  else {
10950		  	setTimeout(updateMagPrettyPhotoGallery,170);
10951		  }
10952
10953		  return false;
10954	}
10955
10956	////filter event
10957	$('body').on('click','.portfolio-filters ul li a, .portfolio-filters-inline ul li a', isoClickFilter);
10958
10959
10960	function updatePrettyPhotoGallery(){
10961		$('.portfolio-items').each(function(){
10962
10963			if($(this).find('a[rel^="prettyPhoto"]').length > 0) {
10964
10965			var $unique_id = Math.floor(Math.random()*10000);
10966			var $currentCat = $(this).attr('data-current-cat');
10967			$(this).find('.col'+$currentCat).find('a[rel^="prettyPhoto"]').attr('rel','prettyPhoto['+$unique_id+'_sorted]');
10968			
10969			} 
10970			
10971		});
10972	}
10973
10974	function updateMagPrettyPhotoGallery(){
10975		$('.portfolio-items').each(function(){
10976			
10977			var $currentCat = $(this).attr('data-current-cat');
10978
10979			$(this).find('.col').each(function(){
10980
10981				$(this).find('a.gallery').removeClass('gallery').removeClass('magnific');
10982				
10983				if($(this).is($currentCat))
10984					$(this).find('.work-info a').addClass('gallery').addClass('magnific');
10985
10986			});
10987		
10988			
10989		});
10990	}
10991
10992
10993
10994    function masonryBlogInit() {
10995
10996		var $posts_container = $('.posts-container')
10997		
10998		if($posts_container.parent().hasClass('masonry')) { 
10999			
11000			$posts_container.find('article').addClass('masonry-blog-item');
11001			$posts_container.find('article').prepend('<span class="bottom-line"></span>');
11002			
11003			//move the meta to the bottom
11004			$posts_container.find('article').each(function(){
11005				
11006				var $metaClone = $(this).find('.post-meta').clone();
11007
11008				$(this).find('.post-meta').remove();
11009
11010				if($('#post-area.meta_overlaid').length > 0){
11011					$(this).find('.post-header h2').after($metaClone);
11012				} else {
11013					$(this).find('.content-inner').after($metaClone);
11014				}
11015				
11016			});
11017		
11018			
11019			if($posts_container.parent().hasClass('masonry') && $posts_container.parent().hasClass('full-width-content')){
11020				$posts_container.parent().wrap('<div class="full-width-content blog-fullwidth-wrap"> </div>').removeClass('full-width-content').css({'margin-left':'0','width':'auto'});
11021				
11022				//page header animation fix
11023				if( $posts_container.parents('.wpb_row').length > 0 ) $posts_container.parents('.wpb_row').css('z-index',100);
11024
11025				if($('.masonry.meta_overlaid').length == 0) {
11026
11027					if($('.masonry.classic_enhanced').length > 0) {
11028						$posts_container.parent().parents('.full-width-content').css({
11029							'padding' : '0px 0.2% 0px 2.4%'
11030						});
11031					} else {
11032						$posts_container.parent().parents('.full-width-content').css({
11033							'padding' : '0px 0.2% 0px 3.2%'
11034						});
11035					}
11036					
11037				} else {
11038					$posts_container.parent().parents('.full-width-content').addClass('meta-overlaid');
11039					$('.container-wrap').addClass('meta_overlaid_blog');
11040				}
11041
11042				fullWidthSections(); 
11043			}
11044			
11045			var $cols = 3;
11046			var $element = $posts_container;
11047			
11048			if($posts_container.find('img').length == 0) $element = $('<img />');
11049		
11050			imagesLoaded($element,function(instance){
11051				
11052				if($('body').hasClass('mobile') || $('#post-area').hasClass('span_9')) {
11053					$cols = 2;
11054				}
11055
11056				//set img as BG if masonry classic enhanced
11057				if($posts_container.parent().hasClass('classic_enhanced')){
11058					$posts_container.find('.large_featured.has-post-thumbnail .post-featured-img, .wide_tall.has-post-thumbnail .post-featured-img').each(function(){
11059						var $src = $(this).find('img').attr('src');
11060						$(this).css('background-image','url('+$src+')');
11061					});
11062
11063					$posts_container.find('.large_featured .nectar-flickity, .wide_tall .nectar-flickity').each(function(){
11064
11065						$(this).find('.cell').each(function(){
11066							var $src = $(this).find('img').attr('src');
11067							$(this).css('background-image','url('+$src+')');
11068						});
11069						
11070					});
11071				}
11072
11073				$cols = blogColumnNumbCalcs();
11074				blogHeightCalcs($posts_container, $cols);
11075
11076				if($('#post-area.meta_overlaid').length > 0) {
11077					$posts_container.isotope({
11078					   itemSelector: 'article',
11079					   transitionDuration: '0s',
11080					   layoutMode: 'packery',
11081					   packery: { 
11082					   	 gutter: 0
11083					   	}
11084					}).isotope( 'layout' );
11085
11086				   
11087				} else {
11088				   if($posts_container.parent().hasClass('classic_enhanced')) {
11089					   	if($('.span_9.masonry').length == 0) {
11090					   		$multiplier = (window.innerWidth >= 1600) ? .015 : .02;
11091					   	} else {
11092					   		$multiplier = .04;
11093					    } 
11094				    }
11095				   else {
11096				   	$multiplier = ($('.span_9.masonry').length == 0) ? .02: .04;
11097				   }	
11098					$posts_container.isotope({
11099					   itemSelector: 'article',
11100					   transitionDuration: '0s',
11101					   layoutMode: 'packery',
11102					   packery: { 
11103					   	 gutter: $('#post-area').width()*$multiplier
11104					   	}
11105					}).isotope( 'layout' );
11106				}
11107
11108				blogLoadIn();
11109				flickityBlogInit();
11110				
11111				$(window).trigger('resize');
11112
11113				blogMasonryZindex();
11114				setTimeout(blogMasonryZindex,700);
11115				$window.smartresize( function(){
11116					setTimeout(blogMasonryZindex,700);
11117				});
11118					
11119			});
11120			
11121			$(window).resize(function(){
11122				
11123
11124			   //size all items in grid 
11125			   //sizing for large items
11126			    $cols = blogColumnNumbCalcs();
11127				blogHeightCalcs($posts_container, $cols);
11128
11129				if($('#post-area.meta_overlaid').length > 0) {
11130				
11131				    $posts_container.isotope({
11132				      layoutMode: 'packery',
11133				      packery: {
11134				      	 gutter: 0
11135				      }
11136				   });
11137				} else {
11138				   
11139				   if($posts_container.parent().hasClass('classic_enhanced')) {
11140				   		if($('.span_9.masonry').length == 0) {
11141					   		$multiplier = (window.innerWidth >= 1600) ? .015 : .02;
11142					   	} else {
11143					   		$multiplier = .04;
11144					    } 
11145				   } else {
11146				   	$multiplier = ($('.span_9.masonry').length == 0) ? .02: .04;
11147				   }	
11148				  
11149				   $posts_container.isotope({
11150				   	layoutMode: 'packery',
11151				      packery: { 
11152				      	gutter: $('#post-area').width()*$multiplier
11153				      }
11154				   });
11155				}
11156
11157			});
11158			
11159			
11160	    } else {
11161	    	blogLoadIn();
11162	    }
11163
11164	}
11165	
11166	masonryBlogInit();
11167
11168	function blogLoadIn(){
11169
11170		$('.posts-container').each(function(){
11171
11172			if($(this).attr('data-load-animation') == 'none') {
11173			
11174				$(this).find('.inner-wrap').removeClass('animated');
11175			} else {
11176
11177				var $that = $(this);
11178				var waypoint = new Waypoint({
11179	 			element: $that,
11180	 			 handler: function(direction) {
11181					
11182					$that.find('article').each(function(i){
11183						$(this).delay(130*i).queue(function(next){
11184						    $(this).addClass("animated-in");
11185						    next();
11186						});
11187					});
11188					
11189					waypoint.destroy();
11190				},
11191				offset: '90%'
11192
11193				}); 
11194				
11195			}
11196
11197		}); //each
11198	}
11199
11200	function blogHeightCalcs($posts_container, cols) {
11201		if( $posts_container.parent().hasClass('meta_overlaid') && $posts_container.find('article[class*="regular"]').length > 0) {
11202
11203			//widths
11204			$.each($posts_container,function(i,v){
11205			 	var $colSize = 4;
11206			 	var $mult = (cols == 1) ? 1 : 2;
11207
11208			 	//check if higher than IE9 -- bugs out with width calc
11209			 	if($('html.no-csstransitions').length == 0) {
11210			 		$(v).find('article[class*="regular"]').css('width',Math.floor($(v).width()/cols) +'px');
11211			 		$(v).find('article[class*="tall"]').css('width',Math.floor($(v).width()/cols*$mult) +'px');
11212			 	} else {
11213			 		$('#post-area.masonry').css('width','100%');
11214			 	}
11215			 	
11216			 	
11217			 });
11218
11219			   //reset height for calcs
11220			   $posts_container.find('article[class*="regular"] img').css('height','auto');
11221
11222			   var tallColHeight = Math.ceil($posts_container.find('article[class*="regular"]:not(".format-link"):not(".format-quote") img').first().height());
11223			   var multipler = (window.innerWidth > 470) ? 2 : 1 ;
11224			   $posts_container.find('article[class*="tall"] img, .article.wide img, article.regular img').removeClass('auto-height');
11225			   $posts_container.find('article[class*="tall"] img').css('height',(tallColHeight*multipler));
11226			   $posts_container.find('article[class*="regular"] img').css('height',(tallColHeight));
11227			   //quote/links
11228			   $posts_container.find('article.regular.format-link,article.regular.format-quote').each(function(){
11229
11230			   		if(window.innerWidth > 470) {
11231			   			$(this).css({
11232			  	 			'height': tallColHeight
11233			   			});
11234			   		} else {
11235			   			$(this).css({
11236			  	 			'height': 'auto'
11237			   			});			 		
11238			   		}
11239			  	 	
11240			   	});
11241
11242
11243		} else {
11244			$posts_container.find('article[class*="tall"] img, article.regular img').addClass('auto-height');
11245		}
11246
11247
11248		if( $posts_container.parent().hasClass('classic_enhanced') && $posts_container.find('article[class*="regular"]').length > 0) {
11249			if($(window).width() > 690 ) 
11250				classicEnhancedSizing($posts_container.find('article:not(.large_featured):not(.wide_tall)'));
11251			else 
11252				classicEnhancedSizing($posts_container.find('article:not(.wide_tall)'));
11253
11254			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;
11255
11256			if($(window).width() > 690 ) 
11257				$posts_container.find('article.large_featured, article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
11258			else 
11259				$posts_container.find('article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
11260
11261		//for when no regular articles exist	
11262		} else if( $posts_container.parent().hasClass('classic_enhanced') && $posts_container.find('article[class*="regular"]').length == 0) {
11263			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;
11264
11265			if($(window).width() > 690 ) 
11266				$posts_container.find('article.large_featured, article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
11267			else 
11268				$posts_container.find('article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
11269		}
11270
11271		//IE9 fix
11272		if($('html.no-csstransitions').length > 0) 		
11273			$('#post-area.masonry').css('width','100%');
11274			 	
11275			 	
11276	}
11277
11278	function classicEnhancedSizing(elements) {
11279
11280		var tallestCol = 0;
11281		elements.find('.article-content-wrap').css('height','auto');
11282		elements.filter('.has-post-thumbnail').each(function(){
11283			($(this).find('.article-content-wrap').outerHeight(true) > tallestCol) ? tallestCol = $(this).find('.article-content-wrap').outerHeight(true) : tallestCol = tallestCol;
11284		});	
11285		
11286		elements.filter('.has-post-thumbnail').find('.article-content-wrap').css('height',(tallestCol));
11287
11288	}
11289
11290
11291	var blogMediaQuerySize;
11292	function blogColumnNumbCalcs(){
11293		   if($('body').hasClass('mobile') && window.innerWidth < 990 || $('#post-area').hasClass('span_9') && $('#post-area.meta_overlaid').length == 0) {
11294			   $cols = 2;
11295		   } else if( $('#post-area').hasClass('full-width-content') || $('#post-area').parent().hasClass('full-width-content') && $('#boxed').length == 0 || $('#post-area.meta_overlaid').length > 0 ){
11296		   		
11297				var windowSize = $(window).width();
11298
11299				
11300				if(window.innerWidth >= 1600){
11301					blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'four' :'five';
11302				} else if(window.innerWidth < 1600 && window.innerWidth >= 1300){
11303					blogMediaQuerySize = 'four';
11304				} else if(window.innerWidth < 1300 && window.innerWidth >= 990){
11305					blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'four' :'three';
11306				} else if(window.innerWidth < 990 && window.innerWidth >= 470){
11307					blogMediaQuerySize = 'two';
11308				} else if(window.innerWidth < 470){
11309					blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'two' :'one';
11310				}
11311			
11312				
11313				//boxed
11314				if($('#boxed').length > 0) {
11315					if(window.innerWidth > 1300){
11316						blogMediaQuerySize = 'four';
11317					} else if(window.innerWidth < 1300 && window.innerWidth > 990){
11318						blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'four' :'three';
11319					} else if(window.innerWidth < 990){
11320						blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'two' :'one';
11321					}
11322					
11323				}
11324				
11325				
11326				switch (blogMediaQuerySize) {
11327					case 'five':
11328						$cols = 5;
11329					break;
11330					
11331					case 'four':
11332						$cols = 4;
11333					break;
11334					
11335					case 'three':
11336						$cols = 3;
11337					break;
11338					
11339					case 'two':
11340						$cols = 2;
11341					break;
11342					
11343					case 'one':
11344						$cols = 1;
11345					break;
11346				}
11347		   		
11348			
11349		   } else {
11350
11351		   	   $cols = 3;
11352		   }
11353
11354		   return $cols;
11355
11356	}
11357
11358
11359
11360
11361
11362
11363var shrinkNum = 6;
11364		
11365if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
11366
11367headerPadding2 = headerPadding - headerPadding/1.8;
11368
11369$('body').on('click','.section-down-arrow',function(){
11370	
11371	if($(this).parents('.nectar-box-roll').length > 0) return false;
11372
11373	var $currentSection = $(this).parents('#page-header-bg');
11374	var $topDistance = $currentSection.attr('data-height');
11375	var $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0;
11376	var $bodyBorderSize = ($('.body-border-top').length > 0 && $(window).width() > 690) ? $('.body-border-top').height(): 0;
11377
11378	if($('body[data-permanent-transparent="1"]').length == 0) {
11379		//regular
11380		if(!$('body').hasClass('mobile')){
11381			if($('body[data-hhun="1"]').length > 0) {
11382				$('body,html').stop().animate({
11383					scrollTop: parseInt($topDistance) + $offset + 2 - $bodyBorderSize*2
11384				},1000,'easeInOutCubic')
11385			} else {
11386				$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
11387				$('body,html').stop().animate({
11388					scrollTop: parseInt($topDistance - $('#header-space').height()) +$resize + 3 + $offset 
11389				},1000,'easeInOutCubic')
11390			}
11391			
11392		} else {
11393			$scrollPos = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? parseInt($topDistance) - $('#header-space').height() + parseInt($currentSection.offset().top) + 2 : parseInt($topDistance) + parseInt($currentSection.offset().top) + 2;
11394			$('body,html').stop().animate({
11395				scrollTop: $scrollPos - $bodyBorderSize*2
11396			},1000,'easeInOutCubic')
11397		}
11398	} else {
11399		//permanent transparent
11400		$('body,html').stop().animate({
11401			scrollTop: parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize*2
11402		},1000,'easeInOutCubic')
11403	}
11404	return false;
11405});
11406
11407
11408
11409
11410
11411
11412
11413/*-------------------------------------------------------------------------*/
11414/*	7.	Cross Browser Fixes
11415/*-------------------------------------------------------------------------*/	
11416	 
11417	 function crossBrowserFixes() {
11418
11419		//Fix current class in menu 
11420		if ($("body").hasClass("single-portfolio") || $('body').hasClass("error404") || $('body').hasClass("search-results")) {   
11421			$("li").removeClass("current_page_parent").removeClass("current-menu-ancestor").removeClass('current_page_ancestor');   
11422		}
11423		
11424
11425		//fix for IE8 nth-child
11426		$('.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');
11427		
11428		//remove br's from code tag
11429		$('code').find('br').remove();	
11430		
11431		//if a clear is the last div, remove the padding
11432		if($('.container.main-content > .row > div:last-child').hasClass('clear')) {
11433			$('.container.main-content > .row > div:last-child').css('padding-bottom','0');
11434		}
11435		
11436		//homepage recent blog for IE8
11437		$('.container-wrap .blog-recent > div:last-child').addClass('col_last');
11438		
11439		//blog ascend bottom padding
11440		if($('.single .blog_next_prev_buttons').length > 0) $('.container-wrap').css('padding-bottom',0);
11441
11442		//contact form
11443		$('.wpcf7-form p:has(input[type=submit])').css('padding-bottom','0px');
11444
11445		$('.full-width-content .wpcf7-submit').on('click',function(){ setTimeout(function(){ fullWidthContentColumns() },1000); setTimeout(function(){ fullWidthContentColumns() },2000); });
11446		
11447		//no caption home slider fix
11448		$('#featured article').each(function(){
11449			if($(this).find('h2').attr('data-has-caption') == '0') {
11450				$(this).parents('.slide').addClass('no-caption');
11451			}
11452		});
11453		
11454		//add class for IE
11455		var ua = window.navigator.userAgent;
11456		var msie = ua.indexOf("Edge/");
11457		if(msie > 0)
11458			$('body').addClass('msie');
11459
11460		//gravity form inside fw content row
11461		$('.gform_body').click(function(){
11462		   setTimeout(function(){ fullWidthContentColumns(); },200);
11463		 });
11464
11465		//chat post format nth child color
11466		$('article.post.format-chat .content-inner dt:odd').css('color','#333');
11467		
11468		//remove margin on last cols inside of full width sections 
11469		$('.full-width-section').each(function(){
11470			$(this).find('> .span_12 > div.col_last').last().css('margin-bottom','0');
11471		});
11472		
11473		//remove p tags from extra content editor when warpping only an img 
11474		$('#portfolio-extra p').each(function(){
11475			if($(this).find('*').length == 1 && $(this).find('img').length == 1) {
11476				$(this).find('img').unwrap();
11477			}
11478		});
11479	
11480
11481		//vc text_separator color
11482		$('.vc_text_separator').each(function(){
11483			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'));
11484		});
11485		
11486		//carousel head button alignment  
11487		$('.carousel-heading').each(function(){
11488			if($(this).find('h2').length > 0) $(this).find('.carousel-prev, .carousel-next').css('top','7px');
11489		});
11490		
11491		//remove carousel heading if not being used
11492		$('.carousel-wrap').each(function(){
11493			if($(this).find('.carousel-heading .container:empty').length > 0) $(this).find('.carousel-heading').remove();
11494		});
11495		
11496		//woocommerce product thuimbnails
11497		$('.woocommerce div.product div.images div.thumbnails a:nth-child(4n+4)').css('margin-right','0px');
11498		
11499		//remove extra galleries when using the nectar gallery slider on projects and posts
11500		$('article.post .gallery-slider .gallery,  article.post .gallery-slider .jetpack-slideshow, .single-portfolio .gallery-slider .gallery, .single-portfolio .gallery-slider .jetpack-slideshow').remove();
11501		
11502		
11503		$('.woocommerce .span_9 .products.related .products li:nth-child(4), .woocommerce .span_9 .products.upsells .products li:nth-child(4)').remove();
11504		$('.woocommerce .span_9 .products.related .products li:nth-child(3), .woocommerce .span_9 .products.upsells .products li:nth-child(3)').css('margin-right','0');	
11505		
11506		$('.cart-menu a, .widget_shopping_cart a').addClass('no-ajaxy');
11507
11508		//clients no hover if no link
11509		$('div.clients').each(function(){
11510			$(this).find('> div').each(function(){
11511				if($(this).find('a').length == 0) {
11512					$(this).addClass('no-link');
11513				}
11514			});
11515		});
11516
11517		//remove ajaxy from single posts when using disqus
11518		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');
11519
11520		//blog next color bg only 
11521		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();
11522		
11523		if($('#single-below-header').hasClass('fullscreen-header') && $('.blog_next_prev_buttons').length == 0 ) $('#author-bio, .comment-wrap').addClass('lighter-grey');
11524
11525		//shop header parallax margin 
11526		if($('body.woocommerce').find('#page-header-bg').length > 0){
11527			$('.container-wrap').css({'margin-top':'0px','padding-top':'30px'});
11528		}
11529
11530		//remove arrows on mega menu item
11531		$('header#top nav .megamenu .sub-menu a.sf-with-ul .sf-sub-indicator').remove();
11532		
11533		//if using wooCommerce sitewide notice
11534		if($('.demo_store').length > 0) $('#header-outer, #header-space').css('margin-top','32px');
11535		
11536		//footer last column class for IE8
11537		$('#footer-widgets .container .row > div:last-child').addClass('col_last');
11538		
11539		//nectar slider external links
11540		$('.swiper-slide.external-button-1 .buttons > div:nth-child(1) a').attr('target','_blank');
11541		$('.swiper-slide.external-button-2 .buttons > div:nth-child(2) a').attr('target','_blank');
11542		
11543		//portfolio external links
11544		$(".portfolio-items a[href*='http://']:not([href*='"+window.location.hostname+"']), .recent_projects_widget a[href*='http://']:not([href*='"+window.location.hostname+"'])").attr("target","_blank"); 
11545		
11546		//remove excess inner content when empty row
11547		$('.container-wrap .row > .wpb_row').each(function(){
11548			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();
11549		});
11550		
11551		//remove boxed style from full width content
11552		$('.full-width-content .col.boxed').removeClass('boxed');
11553		
11554		//remove full width attribute on slider in full width content section
11555		$('.full-width-content .wpb_column .nectar-slider-wrap[data-full-width="true"]').attr('data-full-width','false');	
11556
11557		if( $('.nectar-slider-wrap.first-section').length == 0 && 
11558			$('.full-width-section.first-section > .span_12 > .vc_span12 > .wpb_wrapper > .nectar-slider-wrap').length == 0  && 
11559			$('.parallax_slider_outer.first-section').length == 0 && 
11560			$('.full-width-content.first-section .wpb_wrapper > .nectar-slider-wrap').length == 0  && 
11561			!($('.wpb_row.first-section > .nectar-parallax-scene').length == 1 && $('#header-outer[data-transparent-header="true"]').length == 1) ) { 
11562			$('#header-outer .ns-loading-cover').remove(); 
11563	    }
11564
11565	    //portfolio description remove on hover
11566	    var $tmpTitle = null;
11567	    $('.portfolio-items > .col a[title]').hover(function(){
11568	    	$tmpTitle = $(this).attr('title');
11569	    	$(this).attr('title',' ');
11570	    },function(){
11571	    	$(this).attr('title', $tmpTitle);
11572	    });
11573	    $('.portfolio-items > .col a[title]').click(function(){
11574			$(this).attr('title', $tmpTitle);
11575	    });
11576
11577	};
11578
11579	crossBrowserFixes();
11580
11581
11582
11583
11584	function wooPriceSlider(){
11585
11586
11587		// woocommerce_price_slider_params is required to continue, ensure the object exists
11588		if ( typeof woocommerce_price_slider_params === 'undefined' || !$('body').hasClass('woocommerce') ) {
11589			return false;
11590		}
11591
11592		// Get markup ready for slider
11593		$( 'input#min_price, input#max_price' ).hide();
11594		$( '.price_slider, .price_label' ).show();
11595
11596		// Price slider uses jquery ui
11597		var min_price = $( '.price_slider_amount #min_price' ).data( 'min' ),
11598			max_price = $( '.price_slider_amount #max_price' ).data( 'max' );
11599
11600		current_min_price = parseInt( min_price, 10 );
11601		current_max_price = parseInt( max_price, 10 );
11602
11603		if ( woocommerce_price_slider_params.min_price ) current_min_price = parseInt( w
11603oocommerce_price_slider_params.min_price, 10 );
11604		if ( woocommerce_price_slider_params.max_price ) current_max_price = parseInt( woocommerce_price_slider_params.max_price, 10 );
11605
11606		$( 'body' ).bind( 'price_slider_create price_slider_slide', function( event, min, max ) {
11607			if ( woocommerce_price_slider_params.currency_pos === 'left' ) {
11608
11609				$( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + min );
11610				$( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + max );
11611
11612			} else if ( woocommerce_price_slider_params.currency_pos === 'left_space' ) {
11613
11614				$( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + " " + min );
11615				$( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + " " + max );
11616
11617			} else if ( woocommerce_price_slider_params.currency_pos === 'right' ) {
11618
11619				$( '.price_slider_amount span.from' ).html( min + woocommerce_price_slider_params.currency_symbol );
11620				$( '.price_slider_amount span.to' ).html( max + woocommerce_price_slider_params.currency_symbol );
11621
11622			} else if ( woocommerce_price_slider_params.currency_pos === 'right_space' ) {
11623
11624				$( '.price_slider_amount span.from' ).html( min + " " + woocommerce_price_slider_params.currency_symbol );
11625				$( '.price_slider_amount span.to' ).html( max + " " + woocommerce_price_slider_params.currency_symbol );
11626
11627			}
11628
11629			$( 'body' ).trigger( 'price_slider_updated', min, max );
11630		});
11631
11632		$( '.price_slider' ).slider({
11633			range: true,
11634			animate: true,
11635			min: min_price,
11636			max: max_price,
11637			values: [ current_min_price, current_max_price ],
11638			create : function( event, ui ) {
11639
11640				$( '.price_slider_amount #min_price' ).val( current_min_price );
11641				$( '.price_slider_amount #max_price' ).val( current_max_price );
11642
11643				$( 'body' ).trigger( 'price_slider_create', [ current_min_price, current_max_price ] );
11644			},
11645			slide: function( event, ui ) {
11646
11647				$( 'input#min_price' ).val( ui.values[0] );
11648				$( 'input#max_price' ).val( ui.values[1] );
11649
11650				$( 'body' ).trigger( 'price_slider_slide', [ ui.values[0], ui.values[1] ] );
11651			},
11652			change: function( event, ui ) {
11653
11654				$( 'body' ).trigger( 'price_slider_change', [ ui.values[0], ui.values[1] ] );
11655
11656			},
11657		});
11658
11659	}
11660	
11661
11662//vc col mobile fixes
11663function vcMobileColumns() {
11664	$('.wpb_row').each(function(){
11665		if(typeof $(this).find('.span_12').offset() != 'undefined' ) {
11666		
11667			$(this).find('[class*="vc_col-"]').each(function(){
11668
11669				var $firstChildOffset = $(this).parents('.span_12').offset().left;
11670
11671				$(this).removeClass('no-left-margin');
11672				if($(this).offset().left < $firstChildOffset + 27) { 
11673					$(this).addClass('no-left-margin');
11674				} else {
11675					$(this).removeClass('no-left-margin');
11676				}
11677			});
11678		}
11679	});
11680}
11681
11682if($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) vcMobileColumns();
11683
11684
11685/*-------------------------------------------------------------------------*/
11686/*	8.	Form Styling
11687/*-------------------------------------------------------------------------*/	
11688
11689if($('body[data-form-style="minimal"]').length > 0) {
11690
11691
11692	//turn user set place holders into labels for effect
11693	function convertPlaceholders() {
11694		$('form input[placeholder], form textarea[placeholder]').each(function(i){
11695			if($(this).attr('placeholder').length > 1) {
11696				var $placeholder = $(this).attr('placeholder');
11697				var $inputID = ($(this).is('[id]')) ? $(this).attr('id') : 'id-'+i;
11698				//add placeholder as label if label doesn't already exist
11699				
11700				//skip cf7                               //|| $(this).prev('label').length == 1 && $placeholder.length > $(this).prev('label').text().length
11701				if($(this).parents('.wpcf7-form-control-wrap').length == 0) {
11702					if($(this).prev('label').length == 0 || $(this).is('textarea')) {
11703						$('<label for="'+$inputID+'">'+$placeholder+'</label>').insertBefore($(this));
11704					}
11705				} else {
11706					if($(this).parents('.wpcf7-form-control-wrap').find('label').length == 0) {
11707						$('<label for="'+$inputID+'">'+$placeholder+'</label>').insertBefore($(this).parents('.wpcf7-form-control-wrap '));
11708					}
11709				}
11710				$(this).removeAttr('placeholder');
11711			}
11712		});
11713	}
11714	convertPlaceholders();
11715	setTimeout(convertPlaceholders,500);
11716	
11717	//woocommerce placeholder fix
11718	$( '#billing_country, #shipping_country, .country_to_state' ).on('change',function(){
11719		convertPlaceholders();
11720		removeExcessLabels();
11721		var $wooDynamicPlaceholders = setInterval(function(){
11722			convertPlaceholders();
11723			convertToMinimalStyle('form label');
11724			removeExcessLabels();
11725		},30);
11726		setTimeout(function(){ clearInterval($wooDynamicPlaceholders); },600);
11727		
11728	});
11729
11730	function convertToMinimalStyle(selector){
11731
11732		$(selector).each(function(){
11733			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)').length == 1 || $(this).parent().find('textarea').length == 1) {
11734				
11735				if($(this).parents('.minimal-form-input').length == 0) {
11736
11737					//if there's a direct input next to label
11738				
11739					if($(this).next('input').length == 1) {
11740		
11741						$(this).next('input').andSelf().wrapAll('<div class="minimal-form-input"/>');
11742					} else {
11743						//if we need to traverse to parent instead	
11744						$(this).parent().wrapInner('<div class="minimal-form-input" />');
11745					}
11746					$html = $(this).html();
11747					$(this)[0].innerHTML = '<span class="text"><span class="text-inner">'+$html+'</span></span>';
11748			
11749					if($(this).parent().find('textarea').length == 1) $(this).parents('.minimal-form-input').addClass('textarea');
11750				}
11751			}
11752
11753		});
11754
11755		//for labels that changed that already have minimal form markup - just need to update content
11756		$(selector).each(function(){
11757			if($(this).parents('.minimal-form-input').length == 1 && $(this).find('.text').length == 0) {
11758				
11759				$html = $(this).html();
11760				$(this)[0].innerHTML = '<span class="text"><span class="text-inner">'+$html+'</span></span>';
11761				
11762			}
11763
11764		});
11765	}
11766	
11767	convertToMinimalStyle('form label');
11768
11769	jQuery( document.body ).on( 'updated_cart_totals', function() { 
11770		convertToMinimalStyle('form label');
11771	});
11772
11773	setTimeout(function(){ convertToMinimalStyle('form label'); removeExcessLabels(); checkValueOnLoad(); },501);
11774
11775	//remove excess labels
11776	function removeExcessLabels() {
11777		$('.minimal-form-input').each(function(){
11778			if($(this).find('label').length > 1) {
11779				$lngth = 0;
11780				$(this).find('label').each(function(){
11781					if($(this).text().length >= $lngth) {
11782						$lngth = $(this).text().length;
11783						$(this).parents('.minimal-form-input').find('label').addClass('tbr');
11784						$(this).removeClass('tbr');
11785					}
11786				});
11787				$(this).find('label.tbr').remove();
11788			}
11789		});
11790	}
11791	removeExcessLabels();
11792	
11793
11794	//add labels to inputs that don't have them
11795	$('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), textarea').each(function(){
11796		if($(this).parents('.minimal-form-input').length == 0) {
11797
11798			$('<label></label>').insertBefore($(this));
11799			convertToMinimalStyle($(this).prev('label'));
11800		}
11801	});
11802
11803
11804	$('body').on('focus','.minimal-form-input input, .minimal-form-input textarea',function(){
11805		$(this).parents('.minimal-form-input').addClass('filled').removeClass('no-text');
11806	});
11807	$('body').on('blur','.minimal-form-input input, .minimal-form-input textarea',function(){
11808		if($(this).val().length > 0) $(this).parents('.minimal-form-input').addClass('has-text').removeClass('no-text');
11809		else $(this).parents('.minimal-form-input').removeClass('has-text').addClass('no-text');
11810		$(this).parents('.minimal-form-input').removeClass('filled');
11811	});
11812
11813
11814	//on load
11815	function checkValueOnLoad() {
11816		$('.minimal-form-input input, .minimal-form-input textarea').each(function(){
11817			if($(this).val().length > 0) $(this).parents('.minimal-form-input').addClass('has-text').removeClass('no-text');
11818		});
11819	}
11820	checkValueOnLoad();
11821
11822	 // Textarea Auto Resize
11823    var hiddenDiv = $('.hiddendiv').first();
11824    if (!hiddenDiv.length) {
11825      hiddenDiv = $('<div class="textareahiddendiv common"></div>');
11826      $('body').append(hiddenDiv);
11827    }
11828    var text_area_selector = 'textarea';
11829
11830    function textareaAutoResize($textarea) {
11831      // Set font properties of hiddenDiv
11832
11833      var fontFamily = $textarea.css('font-family');
11834      var fontSize = $textarea.css('font-size');
11835
11836      if (fontSize) { hiddenDiv.css('font-size', fontSize); }
11837      if (fontFamily) { hiddenDiv.css('font-family', fontFamily); }
11838
11839      if ($textarea.attr('wrap') === "off") {
11840        hiddenDiv.css('overflow-wrap', "normal")
11841                 .css('white-space', "pre");
11842      }
11843
11844
11845
11846
11847      hiddenDiv.text($textarea.val() + '\n');
11848      var content = hiddenDiv.html().replace(/\n/g, '<br>');
11849      hiddenDiv.html(content);
11850
11851
11852      // When textarea is hidden, width goes crazy.
11853      // Approximate with half of window size
11854
11855      if ($textarea.is(':visible')) {
11856        hiddenDiv.css('width', $textarea.width());
11857      }
11858      else {
11859        hiddenDiv.css('width', $(window).width()/2);
11860      }
11861
11862      $textarea.css('height', hiddenDiv.height());
11863    }
11864
11865    $(text_area_selector).each(function () {
11866      var $textarea = $(this);
11867      if ($textarea.val().length) {
11868        textareaAutoResize($textarea);
11869      }
11870    });
11871
11872    $('body').on('keyup keydown autoresize', text_area_selector, function () {
11873      textareaAutoResize($(this));
11874    });
11875
11876}
11877
11878
11879if($('body[data-fancy-form-rcs="1"]').length > 0) {
11880
11881	 //radio / checkbox markup conversion 
11882
11883    ////default
11884    $('input[type="checkbox"]').each(function(){
11885    	//check if for relationship exists
11886    	$id = $(this).attr('id');
11887    	if(typeof $id !== typeof undefined && $id !== false && $('label[for="'+$id+'"]').length > 0) {
11888    		$('label[for="'+$id+'"]').prepend('<span></span>');
11889    	} 
11890
11891    });	
11892
11893    ////for cf7
11894    $('.wpcf7-radio .wpcf7-list-item-label').each(function(i){
11895    	var $data = $(this).html();
11896    	var $name = $(this).parent().find('input').attr('name') + i;
11897    	$(this).parent().find('input').attr('id',$name);
11898    	$(this).replaceWith('<label for="'+$name+'">'+$data+'</label>');
11899    });
11900
11901     $('.wpcf7-checkbox .wpcf7-list-item-label').each(function(){
11902    	var $data = $(this).html();
11903    	var $name = $(this).parent().find('input').attr('value');
11904    	$(this).parent().find('input').attr('id',$name);
11905    	$(this).replaceWith('<label for="'+$name+'"><span></span>'+$data+'</label>');
11906    });
11907
11908
11909    //select
11910    $('select:not(.comment-form-rating #rating)').each(function(){
11911
11912    	//cf7
11913    	if($(this).parents('.wpcf7-form-control-wrap').length > 0) {
11914
11915    		//select 2 already initialized
11916	    	if($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) {
11917	    		$selector = $($(this).prev('.select2-container'));
11918	    	} else {
11919	    		$selector = $(this);
11920	    	}
11921
11922	    	//if label is found
11923	    	if($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) {
11924	    		$selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />');
11925	    	} else {
11926	    		//default wrap
11927	    		$selector.wrap('<div class="fancy-select-wrap" />');
11928	    	}
11929    	} 
11930    	//default
11931    	else {
11932
11933	    	//select 2 already initialized
11934	    	if($(this).prev('.select2-container').length > 0) {
11935	    		$selector = $(this).prev('.select2-container');
11936	    	} else {
11937	    		$selector = $(this);
11938	    	}
11939
11940	    	//if label is found
11941	    	if($selector.prev('label').length == 1) {
11942	    		$selector.prev('label').andSelf().wrapAll('<div class="fancy-select-wrap" />');
11943	    	} else if($selector.next('label').length == 1) {
11944	    		$selector.next('label').andSelf().wrapAll('<div class="fancy-select-wrap" />');
11945	    	} else {
11946	    		//default wrap
11947	    		$selector.wrap('<div class="fancy-select-wrap" />');
11948	    	}
11949    	}
11950    });
11951	
11952	function select2Init(){
11953		$('select:not(.state_select):not(.country_select):not(.comment-form-rating #rating)' ).each( function() {
11954			$( this ).select2({
11955				minimumResultsForSearch: 7
11956			});
11957		});
11958	}
11959   
11960	select2Init();
11961
11962}
11963	
11964	$('a#toggle-section').click(function(){
11965			
11966		//open
11967		if(!$('#style-selection').hasClass('open')){
11968			var $distance = ($('body[data-smooth-scrolling="0"]').length > 0) ? '0px' : '13px';
11969			$('#style-selection').addClass('open');
11970			$('#style-selection').stop().animate({
11971				'right' : $distance
11972			},600,'easeOutCubic');
11973		}
11974		
11975		//close  
11976		else {
11977			var $distance = ($('body[data-smooth-scrolling="0"]').length > 0) ? '-196px' : '-177px';
11978			$('#style-selection').removeClass('open');
11979			$('#style-selection').stop().animate({
11980				'right' : $distance
11981			},500,'easeInCubic');
11982			if($('#style-selection .select2-choice').length > 0) { 
11983				$('#style-selection .select2-container').removeClass('select2-container-active').removeClass('select2-dropdown-open');
11984				$('.select2-drop, .select2-drop-mask').hide();
11985			}
11986		}
11987
11988		return false;
11989	});
11990	
11991
11992	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 ) {
11993
11994		$('#ajax-content-wrap').ajaxify({
11995			'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
11995([rel^="prettyPhoto"]):not(.pretty_photo), #header-outer li:not(.no-ajaxy) > a:not(.no-ajaxy), #header-outer #logo',
11996			'verbosity': 0, 
11997			requestDelay: 400,
11998			previewoff : true,
11999			memoryoff: true,
12000			turbo : false
12001		});
12002
12003		$(window).on("pronto.render", initPage)
12004		.on("pronto.load", destroyPage)
12005		.on("pronto.request", transitionPage);
12006
12007		if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },300);
12008
12009		initPage();
12010
12011	} else if($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="standard"]').length > 0 ) {
12012		
12013		//chrome white BG flash fix
12014		$('html').addClass('page-trans-loaded');
12015
12016		//fadeout loading animation
12017		if($('#ajax-loading-screen[data-effect="standard"]').length > 0) {
12018			if($('.nectar-particles').length == 0) setTimeout(function(){ $('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ $(this).css({'display':'none'}); }); $('#ajax-loading-screen .loading-icon').transition({'opacity':0},800) },100);
12019
12020			//bind waypoints after loading screen has left
12021			if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },750);
12022
12023			//safari back/prev fix
12024			if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
12025				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) };
12026				window.onpageshow = function(event) {
12027		    		if (event.persisted) { 
12028		    			$('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ 
12029		    				$(this).css({'display':'none'}); 
12030		    			}); 
12031		    			$('#ajax-loading-screen .loading-icon').transition({'opacity':0},600);
12032		    		}
12033		    	}
12034			} else if(navigator.userAgent.indexOf('Firefox') != -1) {
12035				window.onunload = function(){};
12036			}
12037
12038	    		
12039	    	
12040			
12041		} else {
12042			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) {
12043				setTimeout(function(){ 
12044					$('#ajax-loading-screen').addClass('loaded');
12045					setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
12046				},150);
12047			}
12048
12049
12050			//safari back/prev fix
12051			if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
12052				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) };
12053				window.onpageshow = function(event) {
12054		    		if (event.persisted) { 
12055		    			$('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ 
12056		    				$(this).css({'display':'none'}); 
12057		    			}); 
12058		    			$('#ajax-loading-screen .loading-icon').transition({'opacity':0},600);
12059		    		}
12060		    	}
12061			} else if(navigator.userAgent.indexOf('Firefox') != -1) {
12062				window.onunload = function(){};
12063			}
12064
12065			//bind waypoints after loading screen has left
12066			if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },350);
12067
12068		}
12069
12070		//remove excess loading images now
12071		$('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();
12072
12073
12074		if($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) {
12075			$('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([rel^="prettyPhoto"]):not(.pretty_photo)').click(function(e){
12076				
12077				var $windowCurrentLocation = window.location.href.split("#")[0];
12078				var $windowClickedLocation = $(this).attr('href').split("#")[0];
12079
12080				if($(this).parent('.menu-item-has-children').length > 0 && $(this).parents('.off-canvas-menu-container').length > 0 || ($windowClickedLocation == $windowCurrentLocation)) {
12081
12082				} else {
12083					if(!$(this).parent().hasClass('no-ajaxy')) {
12084
12085						var $targetLocation = $(this).attr('href');
12086						var $timeOutDur = 0;
12087						if($targetLocation != '') {
12088
12089							$('#ajax-loading-screen').addClass('set-to-fade');
12090
12091							transitionPageStandard();
12092
12093							setTimeout(function(){
12094								window.location = $targetLocation;
12095							},$timeOutDur)
12096							
12097							return false;
12098						}
12099					}
12100				}
12101
12102			});
12103		} // if disable fade out is not on
12104	} else {	
12105		//bind waypoints regularly
12106		if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },100);
12107	}
12108
12109
12110	function transitionPage(e) {
12111		
12112
12113		if($(window).scrollTop() > 0) {
12114
12115			//stop nicescroll
12116			if($().niceScroll && $("html").getNiceScroll()){
12117				var nice = $("html").getNiceScroll();
12118				nice.stop();
12119			}
12120			
12121			$('body,html').stop(true,true).animate({
12122				scrollTop:0
12123			},500,'easeOutQuad',function(){ 
12124				$('#ajax-loading-screen').css({'opacity':'1', 'display':'none'});
12125				$('#ajax-loading-screen').stop(true,true).fadeIn(600,function(){
12126					$('#ajax-loading-screen .loading-icon').animate({'opacity':1},400);
12127					//close widget area
12128					setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
12129				});
12130			});
12131
12132		} else {
12133			$('#ajax-loading-screen').css('opacity','1').stop().fadeIn(600,function(){
12134				$('#ajax-loading-screen .loading-icon').animate({'opacity':1},400);
12135			});
12136
12137			//close widget area
12138			setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
12139		}
12140
12141		
12142	}
12143
12144	function transitionPageStandard(e) {
12145		
12146		$('#ajax-loading-screen').css('opacity','1').stop().fadeIn(500);
12147		//setTimeout(function(){ $('#ajax-loading-screen .loading-icon').animate({'opacity':1},500); },400);
12148
12149	}
12150
12151	function destroyPage(e) {
12152		$(window).off('scroll.appear');
12153		if($('#nectar_fullscreen_rows').length > 0 && $().fullpage) 
12154			$.fn.fullpage.destroy('all');
12155	}
12156
12157	function initPage(e) {
12158
12159		if(!$('body').hasClass('ajax-loaded')) return false;
12160
12161
12162		//init js
12163		lightBoxInit();
12164		addOrRemoveSF();
12165		$(".sf-menu").superfish('destroy');
12166		$('#header-outer').removeClass('dark-slide');
12167		initSF();
12168		SFArrows();
12169		headerInit();
12170		var $effectTimeout = ($('#ajax-loading-screen').length > 0) ? 800 : 0;
12171		pageHeaderTextEffectInit();
12172		if($('#page-header-bg .nectar-video-wrap video').length == 0) setTimeout(pageHeaderTextEffect,$effectTimeout);
12173		coloredButtons();
12174		columnBGColors();
12175		fwCarouselLinkFix();
12176		if($('.carousel').length > 0) {
12177			standardCarouselInit();
12178			clientsCarouselInit();
12179			carouselHeightCalcs();
12180		}
12181		if($('.owl-carousel').length > 0) owlCarouselInit();
12182		if($('.products-carousel').length > 0) productCarouselInit();
12183		if($('#nectar_fullscreen_rows').length > 0 && $().fullpage) {
12184			setFPNames();
12185			initFullPageFooter();
12186			fullscreenRowLogic();
12187			initNectarFP();
12188		}
12189		flexsliderInit();
12190		progressBars();
12191		dividers();
12192		animated_titles();
12193		milestoneInit();
12194		accordionInit();
12195		tabbedInit();
12196		tabbbedDeepLinking();
12197		accordionDeepLinking();
12198		ulChecks();
12199		oneFourthClasses();
12200		carouselfGrabbingClass();
12201		cascadingImageBGSizing();
12202		clientsFadeIn();
12203		fullWidthSections();
12204		fwsClasses();
12205		fullwidthImgOnlySizingInit();
12206		fullwidthImgOnlySizing();
12207		fullWidthRowPaddingAdjustInit();
12208		fullWidthRowPaddingAdjustCalc();
12209		boxRollInit();
12210		setTimeout(function(){ 
12211		   colAndImgAnimations();
12212		},100); 
12213		if($('body[data-animated-anchors="true"]').length > 0) setTimeout(scrollSpyInit,200);
12214	    nectar_fancy_ul_init();
12215		socialSharingInit();
12216		hotSpotHoverBind();
12217		pricingTableHeight();
12218		createTestimonialControls();
12219		imageWithHotspotClickEvents();
12220		testimonialSliderHeight(); 
12221		largeIconHover();
12222		fullscreenMenuInit();
12223		boxRollMouseWheelInit();
12224		midnightInit();
12225		setTimeout(morphingOutlines,100); 
12226		responsiveVideoIframesInit();
12227		responsiveVideoIframes();
12228		fullWidthContentColumns();
12229		videoBGInit();
12230		$window.unbind('scroll.parallaxSections').unbind('resize.parallaxSections');
12231		parallaxScrollInit();
12232		masonryBlogInit();
12233		masonryPortfolioInit();
12234		portfolioAccentColor();
12235		portfolioHoverEffects();
12236		portfolioFiltersInit();
12237		style6Img();
12238		isotopeCatSelection();
12239		$(window).unbind('.infscr');
12240		infiniteScrollInit();
12241		toTopBind();
12242		centerLove();
12243		postNextButtonEffect();
12244		if($('.nectar-box-roll').length == 0) headerRowColorInheritInit();
12245		pageLoadHash();
12246		slideOutWidgetAreaScrolling();
12247
12248		//cf7
12249		if($().wpcf7InitForm) $('div.wpcf7 > form').wpcf7InitForm();
12250
12251		//woocommerce price slider
12252		wooPriceSlider();
12253
12254		//twitter widget 
12255		if(typeof twttr != 'undefined') { twttr.widgets.load(); }
12256
12257		//Calendarize.it
12258		if(typeof init_rhc === 'function') { init_rhc(); }
12259
12260		//unwrap post and protfolio videos
12261		$('.video-wrap iframe').unwrap();
12262		$('#sidebar iframe[src]').unwrap();
12263
12264		$('video:not(.slider-video)').attr('width','100%');
12265		$('video:not(.slider-video)').attr('height','100%'); 
12266
12267		$('.wp-video-shortcode.mejs-container').each(function(){
12268			$(this).attr('data-aspectRatio', parseInt($(this).css('height')) / parseInt($(this).css('width')));
12269		});
12270
12271		//mediaElement
12272		$('video.wp-media-shortcode-ajax, audio.wp-media-shortcode-ajax').each(function(){ 
12273			if(!$(this).parent().hasClass('mejs-mediaelement') && $().mediaelementplayer) {
12274				$(this).mediaelementplayer();  
12275			}
12276		});
12277
12278		$('.mejs-container').css({'height': '100%', 'width': '100%'});
12279		
12280		$('audio').attr('width','100%');
12281		$('audio').attr('height','100%');
12282
12283		$('audio').css('visibility','visible');
12284
12285		if($('body').hasClass('mobile')){
12286			$('video').css('visibility','hidden');
12287		} else {
12288			$('video').css('visibility','visible');
12289		}
12290
12291		$('.wpb_row:has(".nectar-video-wrap")').each(function(i){
12292			$(this).css('z-index',100 + i);
12293		});
12294
12295		showLateIframes();
12296
12297		mouseParallaxInit();
12298
12299		//chrome self hosted slider bg video correct
12300		 if(navigator.userAgent.indexOf('Chrome') > 0) { 
12301		 	$('.swiper-wrapper .video-wrap').each(function(i){
12302			  	var webmSource = jQuery(this).find('video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
12303	          	var firstVideo = jQuery(this).find('video').get(0);
12304	          	firstVideo.src = webmSource;
12305	          	firstVideo.load();
12306            });
12307	    }
12308
12309
12310		if($('.nectar-video-bg').length > 0) {
12311			setTimeout(function(){
12312			    	resizeVideoToCover();
12313			    	$('.video-color-overlay').each(function(){
12314			    		$(this).css('background-color',$(this).attr('data-color'));
12315			    	});
12316			    	$('.nectar-video-wrap').transition({'opacity':'1'},0);
12317			    	$('.video-color-overlay').transition({'opacity':'0.7'},0);
12318			    	
12319			    },400);
12320		}
12321
12322		
12323		nectarPageHeader();
12324	
12325
12326		//if( $('#featured').length > 0){
12327		//	
12328		//	customSliderHeight();
12329		//	homeSliderInit2();
12330		//	$(window).off('scroll.hsps');
12331		//	$(window).on('scroll.hsps',homeSliderParallaxScroll);
12332		//	$(window).off('resize.hsps');
12333		//	$(window).on('resize.hsps',homeSliderMobile);
12334			
12335		//}
12336
12337		//cart dropdown
12338		$('#header-outer div.cart-outer').hoverIntent(function(){
12339			$('#header-outer .widget_shopping_cart').stop(true,true).fadeIn(400);
12340			$('#header-outer .cart_list').stop(true,true).fadeIn(400);
12341			clearTimeout(timeout);
12342			$('#header-outer .cart-notification').fadeOut(300);
12343		});
12344
12345
12346		//remove excess loading images now
12347		$('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();
12348
12349		setTimeout(portfolioSidebarFollow,250);
12350		setTimeout(portfolioSidebarFollow,500);
12351		setTimeout(portfolioSidebarFollow,1000);
12352
12353		crossBrowserFixes();
12354
12355
12356		$(window).trigger('resize');
12357
12358		//fix admin bar
12359		$("#wpadminbar").show();	
12360
12361
12362		//close widget area
12363		if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click'); 
12364
12365		//fade in page
12366		setTimeout(function(){ $('#ajax-loading-screen').stop(true,true).fadeOut(500, function(){ $('#ajax-loading-screen .loading-icon').css({'opacity':0}); }); closeSearch();  },200);
12367		setTimeout(function(){ $('#ajax-loading-screen').stop(true,true).fadeOut(500, function(){ $('#ajax-loading-screen .loading-icon').css({'opacity':0}); }); closeSearch(); },900);
12368	} 
12369
12370
12371
12372
12373
12374
12375
12376/*
12377 * jQuery Textarea Characters Counter Plugin v 2.0
12378 * Examples and documentation at: http://roy-jin.appspot.com/jsp/textareaCounter.jsp
12379 * Copyright (c) 2010 Roy Jin
12380 * Version: 2.0 (11-JUN-2010)
12381 * Dual licensed under the MIT and GPL licenses:
12382 * http://www.opensource.org/licenses/mit-license.php
12383 * http://www.gnu.org/licenses/gpl.html
12384 * Requires: jQuery v1.4.2 or later
12385 */
12386(function($){
12387	if(!$.fn.textareaCount) { 
12388		$.fn.textareaCount = function(options, fn) {
12389	        var defaults = {
12390				maxCharacterSize: -1,
12391				originalStyle: 'originalTextareaInfo',
12392				warningStyle: 'warningTextareaInfo',
12393				warningNumber: 20,
12394				displayFormat: '#input characters | #words words'
12395			};
12396
12397			var options = $.extend(defaults, options);
12398
12399			var container = $(this);
12400
12401			$("<div class='charleft'>&nbsp;</div>").insertAfter(container);
12402
12403
12404			//create charleft css
12405			var charLeftCss = {
12406				'width' : container.width()
12407			};
12408
12409			var charLeftInfo = getNextCharLeftInformation(container);
12410			charLeftInfo.addClass(options.originalStyle);
12411			//charLeftInfo.css(charLeftCss);
12412
12413
12414			var numInput = 0;
12415			var maxCharacters = options.maxCharacterSize;
12416			var numLeft = 0;
12417			var numWords = 0;
12418
12419			container.bind('keyup', function(event){limitTextAreaByCharacterCount();})
12420					 .bind('mouseover', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);})
12421					 .bind('paste', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);});
12422
12423	        limitTextAreaByCharacterCount();
12424
12425			function limitTextAreaByCharacterCount(){
12426				charLeftInfo.html(countByCharacters());
12427
12428				//function call back
12429				if(typeof fn != 'undefined'){
12430					fn.call(this, getInfo());
12431				}
12432				return true;
12433			}
12434
12435			function countByCharacters(){
12436				var content = container.val();
12437				var contentLength = content.length;
12438				//Start Cut
12439				if(options.maxCharacterSize > 0){
12440					//If copied content is already more than maxCharacterSize, chop it to maxCharacterSize.
12441					if(contentLength >= options.maxCharacterSize) {
12442						content = content.substring(0, options.maxCharacterSize);
12443					}
12444
12445					var newlineCount = getNewlineCount(content);
12446
12447					// newlineCount new line character. For windows, it occupies 2 characters
12448					var systemmaxCharacterSize = options.maxCharacterSize - newlineCount;
12449					if (!isWin()){
12450						 systemmaxCharacterSize = options.maxCharacterSize
12451					}
12452					if(contentLength > systemmaxCharacterSize){
12453						//avoid scroll bar moving
12454						var originalScrollTopPosition = this.scrollTop;
12455						container.val(content.substring(0, systemmaxCharacterSize));
12456						this.scrollTop = originalScrollTopPosition;
12457					}
12458					charLeftInfo.removeClass(options.warningStyle);
12459					if(systemmaxCharacterSize - contentLength <= options.warningNumber){
12460						charLeftInfo.addClass(options.warningStyle);
12461					}
12462
12463					numInput = container.val().length + newlineCount;
12464					if(!isWin()){
12465						numInput = container.val().length;
12466					}
12467
12468					numWords = countWord(getCleanedWordString(container.val()));
12469
12470					numLeft = maxCharacters - numInput;
12471				} else {
12472					//normal count, no cut
12473					var newlineCount = getNewlineCount(content);
12474					numInput = container.val().length + newlineCount;
12475					if(!isWin()){
12476						numInput = container.val().length;
12477					}
12478					numWords = countWord(getCleanedWordString(container.val()));
12479				}
12480
12481				return formatDisplayInfo();
12482			}
12483
12484			function formatDisplayInfo(){
12485				var format = options.displayFormat;
12486				format = format.replace('#input', numInput);
12487				format = format.replace('#words', numWords);
12488				//When maxCharacters <= 0, #max, #left cannot be substituted.
12489				if(maxCharacters > 0){
12490					format = format.replace('#max', maxCharacters);
12491					format = format.replace('#left', numLeft);
12492				}
12493				return format;
12494			}
12495
12496			function getInfo(){
12497				var info = {
12498					input: numInput,
12499					max: maxCharacters,
12500					left: numLeft,
12501					words: numWords
12502				};
12503				return info;
12504			}
12505
12506			function getNextCharLeftInformation(container){
12507					return container.next('.charleft');
12508			}
12509
12510			function isWin(){
12511				var strOS = navigator.appVersion;
12512				if (strOS.toLowerCase().indexOf('win') != -1){
12513					return true;
12514				}
12515				return false;
12516			}
12517
12518			function getNewlineCount(content){
12519				var newlineCount = 0;
12520				for(var i=0; i<content.length;i++){
12521					if(content.charAt(i) == '\n'){
12522						newlineCount++;
12523					}
12524				}
12525				return newlineCount;
12526			}
12527
12528			function getCleanedWordString(content){
12529				var fullStr = content + " ";
12530				var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
12531				var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
12532				var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
12533				var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
12534				var splitString = cleanedStr.split(" ");
12535				return splitString;
12536			}
12537
12538			function countWord(cleanedWordString){
12539				var word_count = cleanedWordString.length-1;
12540				return word_count;
12541			}
12542		};
12543	}
12544})(jQuery);	
12545	
12546	
12547	
12548	
12549});
12550
12551
12552 }(window.jQuery, window, document));
12553
12554
12555function resizeIframe() {
12556	var element = document.getElementById("pp_full_res").getElementsByTagName("iframe");
12557	var height = element[0].contentWindow.document.body.scrollHeight;
12558    
12559    //iframe height
12560    element[0].style.height = height + 'px';
12561	
12562	//pp height
12563	document.getElementsByClassName("pp_content_container")[0].style.height = height+40+ 'px';
12564	document.getElementsByClassName("pp_content")[0].style.height = height+40+ 'px';
12565	
12566}
12567
12568
12569//don't load if mobile
12570if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) ){
12571
12572	
12573	/*
12574	panr - v0.0.1 by Robert Bue (@robert_bue)
12575	*/
12576	;(function ( $, window, document, undefined ) {
12577	// Create the defaults once
12578				
12579	var pluginName = "panr",
12580		defaults = {
12581		sensitivity: 22,
12582		moveTarget: "parent",
12583		scale: false,
12584		scaleOnHover: false,
12585		scaleTo: 1.1,
12586		scaleDuration: .28,
12587		panY: true,
12588		panX: true,
12589		panDuration: 0.7,
12590		resetPanOnMouseLeave: true,
12591		onEnter: function(){},
12592		onLeave: function(){}
12593	};
12594	// The actual plugin constructor
12595	function Plugin ( element, options ) {
12596		this.element = element;
12597		//console.log(element);
12598		this.settings = $.extend( {}, defaults, options );
12599		this._defaults = defaults;
12600		this._name = pluginName;
12601		this.init();
12602	}
12603	Plugin.prototype = {
12604		init: function () {
12605		if ( Modernizr.touch ) {
12606			return;
12607		}
12608		// call them like so: this.yourOtherFunction(this.element, this.settings).
12609		//console.log(this.settings);
12610		var settings = this.settings,
12611		target = $(this.element),
12612		w = target.width(),
12613		targetWidth = target.width() - settings.sensitivity,
12614		cx = (w-targetWidth)/targetWidth,
12615		x,
12616		y,
12617		panVars,
12618		xPanVars,
12619		yPanVars,
12620		mouseleaveVars;
12621		//console.log(cx);
12622		if ( settings.scale || (!settings.scaleOnHover && settings.scale) ) {
12623			TweenMax.set(target, { scale: settings.scaleTo });
12624		}
12625		// If no target provided we'll use the hovered element
12626		if ( !settings.moveTarget ) {
12627			settings.moveTarget = $(this.element);
12628		}
12629		if ( settings.moveTarget == "parent" ) {
12630			settings.moveTarget = $(this.element).parent();
12631		}
12632		if ( settings.moveTarget == "parent parent" ) {
12633			settings.moveTarget = $(this.element).parent().parent();
12634		}
12635		if ( settings.moveTarget == "parent parent parent" ) {
12636			settings.moveTarget = $(this.element).parent().parent().parent();
12637		}
12638	
12639		settings.moveTarget.on('mousemove', function(e){
12640			x = e.pageX - target.offset().left - target.width()/2; // mouse x coordinate relative to the container
12641			y = e.pageY - target.offset().top - target.height()/2; // mouse x coordinate relative to the container
12642			if ( settings.panX ) {
12643				xPanVars = { x: -cx*x };
12644			}
12645			if ( settings.panY ) {
12646				yPanVars = { y: -cx*y };
12647			}
12648			panVars = $.extend({}, xPanVars, yPanVars);
12649	
12650			// Pan element
12651			TweenMax.to(target, settings.panDuration, panVars);
12652		});
12653		// On mouseover
12654		settings.moveTarget.on('mouseenter', function(e){
12655			// Scale up element
12656			TweenMax.to(target, settings.scaleDuration, { scale: settings.scaleTo });
12657			settings.onEnter(target);
12658		});
12659		if ( !settings.scale || (!settings.scaleOnHover && !settings.scale) ) {
12660			mouseleaveVars = { scale: 1.005, x: 0, y: 0 };
12661		} else {
12662		
12663		if ( settings.resetPanOnMouseLeave ) {
12664			mouseleaveVars = { x: 0, y: 0 };
12665		}
12666		}
12667		settings.moveTarget.on('mouseleave', function(e){
12668		// Reset element
12669		TweenMax.to(target, .35, mouseleaveVars );
12670		settings.onLeave(target);
12671		});
12672		}
12673	};
12674	// A really lightweight plugin wrapper around the constructor,
12675	// preventing against multiple instantiations
12676	$.fn[ pluginName ] = function ( options ) {
12677		return this.each(function() {
12678			if ( !$.data( this, "plugin_" + pluginName ) ) {
12679			$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
12680		}
12681	  });
12682	};
12683	})( jQuery, window, document ); 
12684
12685}
12686
12687
12688
12689/*!
12690 * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+
12691 * http://cherne.net/brian/resources/jquery.hoverIntent.html
12692 */
12693(function(e){e.fn.hoverIntent=function(t,n,r){var i={interval:100,sensitivity:7,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.