PageSourceSearch

https://www.iga.com.au/wp-content/themes/iga/js/init.js?1790935241&ver=7.5.02

js iga.com.au collected 2026-10-02 10:19:10 UTC 500,835 bytes, 12,697 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}}
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))}();
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}
34,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>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});
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">' + $(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, 
9320.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	    	if($that.closest('.vc_column_container').hasClass('slider_full_width')){
1172				maxCols = 4	
1173			}
1174			var scrollNum = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : '' ;
1175	    	var colWidth = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 500 : 453 ;
1176	    	var scrollSpeed, easing;
1177	    	var $autoplayBool = ($(this).attr('data-autorotate') == 'true') ? true : false;
1178			
1179			if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
1180				if($(this).find('li').length % 3 === 0) {
1181					var $themeSkin = true;
1182					var $themeSkin2 = true;
1183				} else {
1184					var $themeSkin = false;
1185					var $themeSkin2 = true;
1186				}
1187	
1188			} else {
1189				var $themeSkin = true;
1190				var $themeSkin2 = true;
1191			}
1192
1193			(parseInt($(this).attr('data-scroll-speed'))) ? scrollSpeed = parseInt($(this).attr('data-scroll-speed')) : scrollSpeed = 700;
1194			($(this).attr('data-easing').length > 0) ? easing = $(this).attr('data-easing') : easing = 'linear';
1195			
1196			
1197			var $element = $that;
1198			if($that.find('img').length == 0) $element = $('body');
1199			
1200			imagesLoaded($element,function(instance){
1201	
1202				
1203		    	$that.carouFredSel({
1204		    		circular: $themeSkin,
1205		    		infinite: $themeSkin2,
1206		    		height : 'auto',
1207		    		responsive: true,
1208			        items       : {
1209						width : colWidth,
1210				        visible     : {
1211				            min         : 1,
1212				            max         : maxCols
1213				        }
1214				    },
1215				    swipe       : {
1216				        onTouch     : true,
1217				        onMouse         : true,
1218				        options      : {
1219				        	excludedElements: "button, input, select, textarea, .noSwipe",
1220				        	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'); }
1221				        },
1222				        onBefore : function(){
1223				    		//hover effect fix
1224				    		$that.find('.work-item').trigger('mouseleave');
1225				    		$that.find('.work-item .work-info a').trigger('mouseup');
1226				    	}
1227				    },
1228				    scroll: {
1229				    	items			: scrollNum,
1230				    	easing          : easing,
1231			            duration        : scrollSpeed,
1232			            onBefore	: function( data ) {
1233			            	
1234			            	 if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
1235			            	 	$that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
1236
1237			            	 }	
1238						},
1239						onAfter	: function( data ) {
1240			            	 if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
1241			            	 	$that.parents('.carousel-wrap').find('.item-count .current').html( $that.triggerHandler('currentPage') +1);
1242			            	 	$that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
1243
1244			            	 }	
1245						}
1246
1247				    },
1248			        prev    : {
1249				        button  : function() {
1250				           return $that.parents('.carousel-wrap').find('.carousel-prev');
1251				        }
1252			    	},
1253				    next    : {
1254			       		button  : function() {
1255				           return $that.parents('.carousel-wrap').find('.carousel-next');
1256				        }
1257				    },
1258				    auto    : {
1259				    	play: $autoplayBool
1260				    }
1261			    }, { transition: true }).animate({'opacity': 1},1300);
1262			    
1263			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1264
1265			    if($that.parents('.carousel-wrap').attr('data-full-width') == 'true') $that.parents('.carousel-outer').css('overflow','visible');
1266
1267			    //add count for non full width ascend skin
1268			    if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
1269					$('<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'));
1270				}
1271			    
1272			    $that.addClass('finished-loading');
1273
1274			    carouselHeightCalcs();
1275			    
1276			    //reinit panr
1277			    if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)) {
1278					$(".portfolio-items.carousel .work-item.style-3 img").panr({
1279						scaleDuration: .28
1280					}); 
1281					$(".portfolio-items:not(.carousel) .work-item.style-3-alt img").panr({ scaleDuration: .28, sensitivity: 12.6, scaleTo: 1.08, panDuration: 3 }); 
1282				}
1283				
1284			    
1285		     });//images loaded
1286		     	     
1287	    });//each
1288
1289		
1290    }
1291    if($('.carousel').length > 0) standardCarouselInit();
1292
1293
1294    function owlCarouselInit() {
1295    	//owl
1296		$('.owl-carousel').each(function(){
1297			var $that = $(this);
1298			var $stagePadding = ($(window).width()<1000) ? 0 : parseInt($(this).attr('data-column-p
1298adding'));
1299			var $autoRotateBool = $that.attr('data-autorotate');
1300			var $autoRotateSpeed = $that.attr('data-autorotations-peed');
1301
1302			$(this).owlCarousel({
1303			      responsive:{
1304				        0:{
1305				            items: $(this).attr('data-mobile-cols')
1306				        },
1307				        690:{
1308				            items: $(this).attr('data-tablet-cols')
1309				        },
1310				        1000:{
1311				          items: $(this).attr('data-desktop-small-cols')
1312				        },
1313				        1300:{
1314				            items: $(this).attr('data-desktop-cols')
1315				        }
1316				    },
1317			      /*stagePadding: $stagePadding,*/
1318			      autoplay: $autoRotateBool,
1319			      autoplayTimeout: $autoRotateSpeed,
1320			      onTranslate: function(){
1321			      	$that.addClass('moving');
1322			      },
1323			      onTranslated: function(){
1324			      	$that.removeClass('moving');
1325			      }
1326
1327			  });
1328
1329			$(this).on('changed.owl.carousel', function (event) {
1330			    if (event.item.count - event.page.size == event.item.index)
1331			        $(event.target).find('.owl-dots div:last')
1332			          .addClass('active').siblings().removeClass('active');
1333			});	
1334
1335		});	
1336
1337
1338    }
1339
1340
1341
1342	function owl_carousel_animate() {
1343		$($fullscreenSelector+'.owl-carousel[data-enable-animation="true"]').each(function(){
1344
1345			$owlOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
1346
1347			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;
1348
1349			var $that = $(this);
1350			var waypoint = new Waypoint({
1351	 			element: $that,
1352	 			 handler: function(direction) {
1353
1354	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
1355					     waypoint.destroy();
1356					     return;
1357					}
1358
1359					setTimeout(function(){
1360		 			 	$that.find('.owl-stage > .owl-item').each(function(i){
1361		 			 		var $that = $(this);
1362							$that.delay(i*200).transition({
1363								'opacity': '1',
1364								'y' : '0'
1365							},600,'easeOutQuart');
1366						});
1367						$that.addClass('animated-in');
1368		 			 },$animationDelay);
1369
1370					waypoint.destroy();
1371				},
1372				offset: $owlOffsetPos
1373
1374			}); 
1375
1376		});
1377	}
1378
1379
1380
1381
1382    function productCarouselInit() {
1383		$('.products-carousel').each(function(){
1384	    	var $that = $(this).find('ul'); 
1385	    	var maxCols = 'auto';
1386	    	var scrollNum = 'auto';
1387	    	var colWidth = ($(this).parents('.full-width-content ').length > 0) ? 400 : 353 ;
1388			var scrollSpeed = 800;
1389			var easing = 'easeInOutQuart';
1390			
1391			
1392			var $element = $that;
1393			if($that.find('img').length == 0) $element = $('body');
1394			
1395			//controls on hover
1396			$(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>')
1397
1398			imagesLoaded($element,function(instance){
1399	
1400				
1401		    	$that.carouFredSel({
1402		    		circular: true,
1403		    		responsive: true,
1404			        items       : {
1405						width : colWidth,
1406				        visible     : {
1407				            min         : 1,
1408				            max         : maxCols
1409				        }
1410				    },
1411				    swipe       : {
1412				        onTouch     : true,
1413				        onMouse         : true,
1414				        options      : {
1415				        	excludedElements: "button, input, select, textarea, .noSwipe",
1416				        	tap: function(event, target){ 
1417				        		if($(target).attr('href') && !$(target).is('[target="_blank"]') && !$(target).hasClass('add_to_wishlist') && !$(target).hasClass('add_to_cart_button') && !$(target).is('[rel^="prettyPhoto"]')) 
1418				        			window.open($(target).attr('href'), '_self'); 
1419				        		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"]')) 
1420				        			window.open($(target).parent().attr('href'), '_self'); 
1421				        	}
1422				        },
1423				        onBefore : function(){
1424				    		//hover effect fix
1425				    		$that.find('.product-wrap').trigger('mouseleave');
1426				    		$that.find('.product a').trigger('mouseup');
1427				    	}
1428				    },
1429				    scroll: {
1430				    	items			: scrollNum,
1431				    	easing          : easing,
1432			            duration        : scrollSpeed
1433				    },
1434			        prev    : {
1435				        button  : function() {
1436				           return $that.parents('.carousel-wrap').find('.carousel-prev');
1437				        }
1438			    	},
1439				    next    : {
1440			       		button  : function() {
1441				           return $that.parents('.carousel-wrap').find('.carousel-next');
1442				        }
1443				    },
1444				    auto    : {
1445				    	play: false
1446				    }
1447			    }).animate({'opacity': 1},1300);
1448			    
1449			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1450			    
1451			    $that.addClass('finished-loading');
1452			    fullWidthContentColumns();
1453			    $(window).trigger('resize');
1454
1455		     });//images loaded
1456		     	     
1457	    });//each
1458    }
1459    if($('.products-carousel').length > 0) productCarouselInit();
1460
1461
1462
1463
1464    
1465    //fullwidth carousel swipe link fix
1466    function fwCarouselLinkFix() {
1467	    var $mousePosStart = 0;
1468	    var $mousePosEnd = 0;
1469	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').mousedown(function(e){
1470	    	$mousePosStart = e.clientX;
1471	    });
1472	    
1473	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').mouseup(function(e){
1474	    	$mousePosEnd = e.clientX;
1475	    });
1476	    
1477	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').click(function(e){
1478	    	if(Math.abs($mousePosStart - $mousePosEnd) > 10)  return false;
1479	    });
1480	}
1481	fwCarouselLinkFix();
1482    
1483     
1484	function carouselHeightCalcs(){
1485		
1486		//recent work carousel
1487		$('.carousel.portfolio-items.finished-loading').each(function(){
1488
1489			var bottomSpace = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true' && $(this).find('.style-2, .style-3, .style-4').length > 0) ? 0 : 28 ;
1490			
1491			var tallestMeta = 0;
1492			
1493			$(this).find('> li').each(function(){
1494				($(this).find('.work-meta').height() > tallestMeta) ? tallestMeta = $(this).find('.work-meta').height() : tallestMeta = tallestMeta;
1495			});	
1496    	 
1497     		$(this).parents('.caroufredsel_wrapper').css({
1498     			'height' : ($(this).find('.work-item').outerHeight() + tallestMeta + bottomSpace -2) + 'px'
1499     		});
1500
1501     		 if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
1502        	 	$(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition")+1)/$(this).triggerHandler("currentVisible").length));
1503        	 	$(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length));
1504        	 }	
1505   	  	});
1506   	  	
1507   	  	//standard carousel
1508   	  	$('.carousel.finished-loading:not(".portfolio-items, .clients"), .caroufredsel_wrapper .products.finished-loading').each(function(){
1509			
1510			var tallestColumn = 0;
1511			
1512			$(this).find('> li').each(function(){
1513				($(this).height() > tallestColumn) ? tallestColumn = $(this).height() : tallestColumn = tallestColumn;
1514			});	
1515
1516         	$(this).css('height',tallestColumn + 5);
1517         	$(this).parents('.caroufredsel_wrapper').css('height',tallestColumn + 5);
1518
1519         	 if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
1520        	 	$(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition")+1)/$(this).triggerHandler("currentVisible").length));
1521        	 	$(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length));
1522        	 }	
1523			
1524   	  	});
1525   	  	
1526	}
1527
1528
1529	function clientsCarouselInit(){
1530	     $('.carousel.clients').each(function(){
1531	    	var $that = $(this);
1532	    	var columns; 
1533	    	var $autoRotate = (!$(this).hasClass('disable-autorotate')) ? true : false;
1534	    	(parseInt($(this).attr('data-max'))) ? columns = parseInt($(this).attr('data-max')) : columns = 5;
1535	    	if($(window).width() < 690 && $('body').attr('data-responsive') == '1') { columns = 2; $(this).addClass('phone') }
1536	    	
1537	    	var $element = $that;
1538			if($that.find('img').length == 0) $element = $('body');
1539			
1540			imagesLoaded($element,function(instance){
1541	    		
1542		    	$that.carouFredSel({
1543			    		circular: true,
1544			    		responsive: true, 
1545				        items       : {
1546							
1547							height : $that.find('> div:first').height(),
1548							width  : $that.find('> div:first').width(),
1549					        visible     : {
1550					            min         : 1,
1551					            max         : columns
1552					        }
1553					    },
1554					    swipe       : {
1555					        onTouch     : true,
1556					        onMouse         : true
1557					    },
1558					    scroll: {
1559					    	items           : 1,
1560					    	easing          : 'easeInOutCubic',
1561				            duration        : '800',
1562				            pauseOnHover    : true
1563					    },
1564					    auto    : {
1565					    	play            : $autoRotate,
1566					    	timeoutDuration : 2700
1567					    }
1568			    }).animate({'opacity': 1},1300);
1569			    
1570			    $that.addClass('finished-loading');
1571
1572			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1573			     
1574
1575			    $(window).trigger('resize');
1576			    
1577		    
1578		    });
1579	
1580	    });
1581    }
1582   if($('.carousel').length > 0)  clientsCarouselInit();
1583    
1584
1585    function clientsCarouselHeightRecalc(){
1586
1587    	var tallestImage = 0;
1588		  			
1589    	 $('.carousel.clients.finished-loading').each(function(){
1590    	 	
1591    	 	$(this).find('> div').each(function(){
1592				($(this).height() > tallestImage) ? tallestImage = $(this).height() : tallestImage = tallestImage;
1593			});	
1594    	 	
1595         	$(this).css('height',tallestImage);
1596         	$(this).parent().css('height',tallestImage);
1597         });
1598    }
1599
1600
1601    //carousel grabbing class
1602    function carouselfGrabbingClass() {
1603	    $('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(){
1604	    	$(this).addClass('active');
1605	    });
1606	    
1607	    $('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(){
1608	    	$(this).removeClass('active');
1609	    });
1610	}
1611	carouselfGrabbingClass();
1612	    
1613
1614	//ascend arrow hover class
1615	$('body.ascend').on('mouseover','.carousel-next',function(){
1616		$(this).parent().find('.carousel-prev, .item-count').addClass('next-hovered');
1617	});
1618	$('body.ascend').on('mouseleave','.carousel-next',function(){
1619		$(this).parent().find('.carousel-prev, .item-count').removeClass('next-hovered');
1620	});
1621
1622	//fadein for clients / carousels
1623	function clientsFadeIn() {
1624
1625		$clientsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? 100: 'bottom-in-view';
1626		$($fullscreenSelector+'.clients.fade-in-animation').each(function() {
1627
1628			var $that = $(this);
1629			var waypoint = new Waypoint({
1630 			element: $that,
1631 			 handler: function(direction) {
1632				
1633				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
1634					 waypoint.destroy();
1635					return;
1636				}
1637
1638				 $that.find('> div').each(function(i){
1639					$(this).delay(i*80).transition({'opacity':"1"},450);
1640				});
1641				
1642				
1643				//add the css transition class back in after the aniamtion is done
1644				setTimeout(function(){ $that.addClass('completed'); },($that.find('> div').length*80) + 450);
1645			
1646
1647				$that.addClass('animated-in');
1648				waypoint.destroy();
1649			},
1650			offset: $clientsOffsetPos
1651
1652			}); 
1653		}); 
1654	}
1655	 
1656	//if($('.nectar-box-roll').length == 0) clientsFadeIn();
1657	
1658	
1659/*-------------------------------------------------------------------------*/
1660/*	2.	Helper Functions
1661/*-------------------------------------------------------------------------*/
1662
1663	jQuery.fn.setCursorPosition = function(position){
1664	    if(this.lengh == 0) return this;
1665	    return $(this).setSelection(position, position);
1666	}
1667	
1668	jQuery.fn.setSelection = function(selectionStart, selectionEnd) {
1669	    if(this.lengh == 0) return this;
1670	    input = this[0];
1671	
1672	    if (input.createTextRange) {
1673	        var range = input.createTextRange();
1674	        range.collapse(true);
1675	        range.moveEnd('character', selectionEnd);
1676	        range.moveStart('character', selectionStart);
1677	        range.select();
1678	    } else if (input.setSelectionRange) {
1679	        input.focus();
1680	        input.setSelectionRange(selectionStart, selectionEnd);
1681	    }
1682	
1683	    return this;
1684	}
1685	
1686	
1687
1688	$.extend($.expr[':'], {
1689	    transparent: function(elem, i, attr){
1690	      return( $(elem).css("opacity") === "0" );
1691	    }
1692	});
1693	
1694
1695	function getQueryParams(qs) {
1696	    qs = qs.split("+").join(" ");
1697	    var params = {},
1698	        tokens,
1699	        re = /[?&]?([^=]+)=([^&]*)/g;
1700
1701	    while (tokens = re.exec(qs)) {
1702	        params[decodeURIComponent(tokens[1])]
1703	            = decodeURIComponent(tokens[2]);
1704	    }
1705
1706	    return params;
1707	}
1708
1709	var $_GET = getQueryParams(document.location.search);
1710
1711	
1712	//count
1713	$.fn.countTo = function (options) {
1714		options = options || {};
1715		
1716		return $(this).each(function () {
1717			// set options for current element
1718			var settings = $.extend({}, $.fn.countTo.defaults, {
1719				from:            $(this).data('from'),
1720				to:              $(this).data('to'),
1721				speed:           $(this).data('speed'),
1722				refreshInterval: $(this).data('refresh-interval'),
1723				decimals:        $(this).data('decimals')
1724			}, options);
1725			
1726			// how many times to update the value, and how much to increment the value on each update
1727			var loops = Math.ceil(settings.speed / settings.refreshInterval),
1728				increment = (settings.to - settings.from) / loops;
1729			
1730			// references & variables that will change with each update
1731			var self = this,
1732				$self = $(this),
1733				loopCount = 0,
1734				value = settings.from,
1735				data = $self.data('countTo') || {};
1736			
1737			$self.data('countTo', data);
1738			
1739			// if an existing interval can be found, clear it first
1740			if (data.interval) {
1741				clearInterval(data.interval);
1742			}
1743			data.interval = setInterval(updateTimer, settings.refreshInterval);
1744			
1745			// initialize the element with the starting value
1746			render(value);
1747			
1748			function updateTimer() {
1749				value += increment;
1750				loopCount++;
1751				
1752				render(value);
1753				
1754				if (typeof(settings.onUpdate) == 'function') {
1755					settings.onUpdate.call(self, value);
1756				}
1757				
1758				if (loopCount >= loops) {
1759					// remove the interval
1760					$self.removeData('countTo');
1761					clearInterval(data.interval);
1762					value = settings.to;
1763					
1764					if (typeof(settings.onComplete) == 'function') {
1765						settings.onComplete.call(self, value);
1766					}
1767				}
1768			}
1769			
1770			function render(value) {
1771				var formattedValue = settings.formatter.call(self, value, settings);
1772				$self.html(formattedValue);
1773			}
1774		});
1775	};
1776	
1777	$.fn.countTo.defaults = {
1778		from: 0,               // the number the element should start at
1779		to: 0,                 // the number the element should end at
1780		speed: 1000,           // how long it should take to count between the target numbers
1781		refreshInterval: 100,  // how often the element should be updated
1782		decimals: 0,           // the number of decimal places to show
1783		formatter: formatter,  // handler for formatting the value before rendering
1784		onUpdate: null,        // callback method for every time the element is updated
1785		onComplete: null       // callback method for when the element finishes updating
1786	};
1787	
1788	function formatter(value, settings) {
1789		return value.toFixed(settings.decimals);
1790	}
1791	
1792	
1793	
1794	
1795/*-------------------------------------------------------------------------*/
1796/*	3.	Shortcode Stuff
1797/*-------------------------------------------------------------------------*/
1798
1799
1800/***************** Milestone Counter ******************/
1801	
1802	function milestoneInit() {
1803
1804		$('.nectar-milestone').each(function() {
1805			
1806			//symbol
1807			if($(this).is('[data-symbol]')) {
1808				if($(this).find('.symbol-wrap').length == 0) {
1809					if($(this).attr('data-symbol-pos') == 'before') {
1810						$(this).find('.number').prepend('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>');
1811					} else {
1812						$(this).find('.number').append('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>');
1813					}
1814				}
1815
1816				$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'));
1817			
1818				$(this).find('.symbol-wrap').css({'font-size': $symbol_size + 'px', 'line-height': $symbol_size + 'px'});
1819			}
1820
1821			$(this).find('.number').css({'font-size': $(this).find('.number').attr('data-number-size') +'px', 'line-height': $(this).find('.number').attr('data-number-size') + 'px'});
1822		});
1823		
1824		if(!$('body').hasClass('mobile') && $('.nectar-milestone').length > 0) {
1825			
1826
1827			//blur effect
1828			var $blurCssString = '';
1829			$($fullscreenSelector+'.nectar-milestone.motion_blur').each(function(i){
1830					
1831				$(this).addClass('instance-'+i);
1832
1833				var $currentColor = $(this).find('.number').css('color');
1834				var colorInt = parseInt($currentColor.substring(1),16);
1835		   		var R = (colorInt & 0xFF0000) >> 16;
1836		    	var G = (colorInt & 0x00FF00) >> 8;
1837		   		var B = (colorInt & 0x0000FF) >> 0;
1838		   		
1839		   		var $rgbaColorStart = 'rgba('+R+','+G+','+B+',0.2)';
1840				var $rgbaColorEnd = 'rgba('+R+','+G+','+B+',1)';
1841				var $numberSize = parseInt($(this).find('.number').attr('data-number-size'));
1842
1843				$blurCssString += '@keyframes motion-blur-number-'+i+' { ' +
1844				   ' 0% { '+
1845				   		'opacity: 0;'+
1846						'color: '+$rgbaColorStart+'; '+
1847   						'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+'; '+
1848    					'transform: translateZ(0px) translateY(-100%); '+
1849    					'-webkit-transform: translateZ(0px) translateY(-100%); '+
1850    				'} '+
1851    				'33% { opacity: 1 }' +
1852    				'100% { '+
1853						'color: '+$rgbaColorEnd+'; '+
1854   						'text-shadow: none; '+
1855    					'transform: translateZ(0px) translateY(0px); '+
1856    					'-webkit-transform: translateZ(0px) translateY(0px); '+
1857    				'} '+
1858    			'} '+
1859    			'@-webkit-keyframes motion-blur-number-'+i+' { ' +
1860				   ' 0% { '+
1861				  	    'opacity: 0;'+
1862						'color: '+$rgbaColorStart+'; '+
1863   						'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+'; '+
1864    					'transform: translateZ(0px) translateY(-100%); '+
1865    					'-webkit-transform: translateZ(0px) translateY(-100%); '+
1866    				'} '+
1867    				'33% { opacity: 1 }' +
1868    				'100% { '+
1869						'color: '+$rgbaColorEnd+'; '+
1870   						'text-shadow: none; '+
1871    					'transform: translateZ(0px) translateY(0px); '+
1872    					'-webkit-transform: translateZ(0px) translateY(0px); '+
1873    				'} '+
1874    			'} '+
1875    			'.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+'; } ';
1876    			
1877    			//separate each character into spans
1878    			$symbol = $(this).find('.symbol-wrap').clone();
1879    			$(this).find('.symbol-wrap').remove();
1880    			var characters = $(this).find('.number').text().split("");
1881    			$this = $(this).find('.number');
1882				$this.empty();
1883    			$.each(characters, function (i, el) {
1884				    $this.append("<span>" + el + "</span");
1885				});
1886
1887				//handle symbol
1888				if($(this).has('[data-symbol]')) {
1889	    			if($(this).attr('data-symbol-pos') == 'after') {
1890	    				$this.append($symbol);
1891	    			} else {
1892	    				$this.prepend($symbol);
1893	    			}
1894	    		}
1895				
1896			});
1897
1898			var head = document.head || document.getElementsByTagName('head')[0];
1899				var style = document.createElement('style');
1900
1901				style.type = 'text/css';
1902			if (style.styleSheet){
1903			  style.styleSheet.cssText = $blurCssString;
1904			} else {
1905			  style.appendChild(document.createTextNode($blurCssString));
1906			}
1907			$(style).attr('id','milestone-blur');
1908			$('head #milestone-blur').remove();
1909			head.appendChild(style);
1910
1911
1912			//activate
1913			milestoneWaypoint();
1914
1915		}
1916
1917	}
1918
1919	function milestoneWaypoint() {
1920		$($fullscreenSelector+'.nectar-milestone').each(function() {
1921			//animation
1922			var $offset = ($(this).hasClass('motion_blur')) ? '90%' : '105%';
1923
1924
1925			var $that = $(this);
1926			var waypoint = new Waypoint({
1927	 			element: $that,
1928	 			 handler: function(direction) {
1929
1930	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
1931					     waypoint.destroy();
1932					     return;
1933					}
1934
1935	 			 	var $endNum = parseInt($that.find('.number span:not(.symbol)').text());
1936					if(!$that.hasClass('motion_blur')) {
1937						$that.find('.number span:not(.symbol)').countTo({
1938							from: 0,
1939							to: $endNum,
1940							speed: 1500,
1941							refreshInterval: 30
1942						});
1943					} else {
1944						$that.find('span').each(function(i){
1945							var $that = $(this);
1946							setTimeout(function(){ $that.addClass('in-sight'); },200*i);
1947						});
1948					}
1949
1950
1951					$that.addClass('animated-in');
1952					waypoint.destroy();
1953				},
1954				offset: 'bottom-in-view'
1955
1956			}); 
1957
1958		}); 
1959	}
1960
1961	var $animationOnScrollTimeOut = ($('.nectar-box-roll').length > 0) ? 850: 125;	
1962	//if($('.nectar-box-roll').length == 0) setTimeout(function(){  milestoneInit(); },125); 
1963	
1964/***************** Tabbed ******************/
1965	
1966	$tabbedClickCount = 0;
1967	$('body').on('click','.tabbed > ul li:not(.cta-button) a',function(){
1968		var $id = $(this).parents('li').index()+1;
1969		
1970		if(!$(this).hasClass('active-tab') && !$(this).hasClass('loading')){
1971			$(this).parents('ul').find('a').removeClass('active-tab');
1972			$(this).addClass('active-tab');
1973			
1974			$(this).parents('.tabbed').find('> div:not(.clear)').css({'visibility':'hidden','position':'absolute','opacity':'0','left':'-9999px','display':'none'});
1975			$(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').css({'visibility':'visible', 'position' : 'relative','left':'0','display':'block'}).stop().transition({'opacity':1},300);
1976			
1977			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); 
1978		}
1979		
1980		//waypoint checking
1981		if($tabbedClickCount != 0) {
1982			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-progress-bar').length > 0 ) 
1983				progressBars();
1984			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 ) 
1985				dividers();
1986			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('img.img-with-animation').length > 0 ||
1987			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.col.has-animation').length > 0  || 
1988			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar_cascading_images').length > 0  || 
1989			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wpb_column.has-animation').length > 0 ) {
1990				colAndImgAnimations();
1991				cascadingImageBGSizing();
1992			}
1993			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-milestone').length > 0 ) 
1994				milestoneWaypoint();
1995			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar_image_with_hotspots[data-animation="true"]').length > 0 ) 
1996				imageWithHotspots();
1997			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-fancy-ul').length > 0 ) 
1998				nectar_fancy_ul_init();
1999			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-split-heading').length > 0 ) 
2000				splitLineHeadings();
2001			if($(this).parents('.wpb_row').length > 0) {
2002				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.vc_pie_chart').length > 0  ||
2003				   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wp-video-shortcode').length > 0 ||
2004				   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.twentytwenty-container').length > 0 ||
2005				   $(this).parents('.wpb_row').next().hasClass('parallax_section'))
2006					$(window).trigger('resize');
2007
2008				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-flickity').length > 0 )
2009					$('.nectar-flickity:not(.masonry)').flickity('resize');
2010			}
2011		}
2012
2013		//fix columns inside tabs
2014		$(this).parents('.tabbed').find('.wpb_row').each(function(){
2015			if(typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') {
2016				
2017				var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left;
2018				$(this).find('[class*="vc_col-"]').each(function(){
2019					$(this).removeClass('no-left-margin');
2020					if($(this).offset().left < $firstChildOffset + 15) { 
2021						$(this).addClass('no-left-margin');
2022					} else {
2023						$(this).removeClass('no-left-margin');
2024					}
2025				});
2026			}
2027		});
2028
2029		$tabbedClickCount++;
2030
2031		return false;
2032	});
2033	
2034	//make sure the tabs don't have a nectar slider - we'll init this after the sliders load in that case
2035	function tabbedInit(){ 
2036		$('.tabbed').each(function(){
2037			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){
2038				$(this).find('> ul li:first-child a').click();
2039			}	
2040			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 ){
2041				var $that = $(this);
2042				
2043				$(this).find('.wpb_tab').show().css({'opacity':0,'height':'1px'});
2044				$(this).find('> ul li a').addClass('loading');
2045				
2046				setTimeout(function(){ 
2047					$that.find('.wpb_tab').hide().css({'opacity':1,'height':'auto'}); 
2048					$that.find('> ul li a').removeClass('loading');
2049					$that.find('> ul li:first-child a').click(); 
2050				},900);
2051			}
2052		});
2053	}
2054	tabbedInit();
2055
2056	//deep linking
2057	function tabbbedDeepLinking(){
2058		if(typeof $_GET['tab'] != 'undefined'){
2059			$('.wpb_tabs_nav').each(function(){
2060
2061				$(this).find('li').each(function(){
2062					var $currentText = $(this).find('a').text();
2063					var $getText = $_GET['tab'];
2064					var $that = $(this);
2065
2066					$currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
2067					$getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
2068
2069					if($currentText == $getText)  { 
2070
2071			          $(this).find('a').click(); 
2072			           setTimeout(function(){ 
2073			              $that.find('a').click(); 
2074			           },901);
2075			        }
2076				})
2077			});
2078		}
2079	}
2080	tabbbedDeepLinking();
2081
2082/***************** Toggle ******************/
2083	
2084	//toggles
2085	$('body').on('click','.toggle h3 a', function(){
2086	
2087		if(!$(this).parents('.toggles').hasClass('accordion')) { 
2088			$(this).parents('.toggle').find('> div').slideToggle(300);
2089			$(this).parents('.toggle').toggleClass('open');
2090			
2091			//switch icon
2092			if( $(this).parents('.toggle').hasClass('open') ){
2093				$(this).find('i').attr('class','icon-minus-sign');
2094			} else {
2095				$(this).find('i').attr('class','icon-plus-sign');
2096			}
2097
2098			if($(this).parents('.toggle').find('> div .iframe-embed').length > 0 && $(this).parents('.toggle').find('> div .iframe-embed iframe').height() == '0') responsiveVideoIframes();
2099			if($(this).parents('.full-width-content').length > 0) setTimeout(function(){ fullWidthContentColumns(); },300);
2100			if($('#nectar_fullscreen_rows').length > 0) setTimeout(function(){ $(window).trigger('smartresize'); },300);
2101			return false;
2102		}
2103	});
2104	
2105	//accordion
2106	$('body').on('click','.accordion .toggle h3 a', function(){
2107		
2108		if($(this).parents('.toggle').hasClass('open')) return false;
2109		
2110		$(this).parents('.toggles').find('.toggle > div').slideUp(300);
2111		$(this).parents('.toggles').find('.toggle h3 a i').attr('class','icon-plus-sign');
2112		$(this).parents('.toggles').find('.toggle').removeClass('open');
2113		
2114		$(this).parents('.toggle').find('> div').slideDown(300);
2115		$(this).parents('.toggle').addClass('open');
2116		
2117		//switch icon
2118		if( $(this).parents('.toggle').hasClass('open') ){
2119			$(this).find('i').attr('class','icon-minus-sign');
2120		} else {
2121			$(this).find('i').attr('class','icon-plus-sign');
2122		}
2123
2124		if($(this).parents('.full-width-content').length > 0) { 
2125			clearTimeout($t);
2126			var $t = setTimeout(function(){ fullWidthContentColumns(); },400);
2127		}
2128		if($('#nectar_fullscreen_rows').length > 0) {
2129			clearTimeout($t);
2130			var $t = setTimeout(function(){ $(window).trigger('smartresize'); },400);
2131		}
2132		
2133		return false;
2134	});
2135	
2136	//accordion start open
2137	function accordionInit(){ 
2138		$('.accordion').each(function(){
2139			$(this).find('> .toggle').first().addClass('open').find('> div').show();
2140			$(this).find('> .toggle').first().find('a i').attr('class','icon-minus-sign');
2141		});
2142		
2143		
2144		$('.toggles').each(function(){
2145			
2146			var $isAccordion = ($(this).hasClass('accordion')) ? true : false;
2147			
2148			$(this).find('.toggle').each(function(){
2149				if($(this).find('> div .testimonial_slider').length > 0 || $(this).find('> div iframe').length > 0) {
2150					var $that = $(this);
2151					$(this).find('> div').show().css({'opacity':0,'height':'1px', 'padding':'0'});
2152					
2153					testimonialHeightResize();
2154					
2155					setTimeout(function(){
2156						$that.find('> div').hide().css({'opacity':1,'height':'auto', 'padding':'10px 14px'}); 
2157						if($isAccordion == true && $that.index() == 0) $that.find('> div').slideDown(300);
2158					},900);
2159				} 
2160			});
2161		})
2162	}
2163	accordionInit();
2164
2165	//deep linking
2166	function accordionDeepLinking(){
2167		if(typeof $_GET['toggle'] != 'undefined'){
2168			$('.toggles').each(function(){
2169
2170				$(this).find('.toggle').each(function(){
2171					var $currentText = $(this).find('h3 a').clone();
2172					var $getText = $_GET['toggle'];
2173
2174					$($currentText).find('i').remove();
2175					$currentText = $currentText.text();
2176					$currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
2177					$getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
2178
2179					if($currentText == $getText) $(this).find('h3 a').click();
2180				});
2181			});
2182		}
2183	}
2184	accordionDeepLinking();
2185
2186/***************** Button ******************/
2187	
2188	$.cssHooks.color = {
2189	    get: function(elem) {
2190	        if (elem.currentStyle)
2191	            var color = elem.currentStyle["color"];
2192	        else if (window.getComputedStyle)
2193	            var color = document.defaultView.getComputedStyle(elem,
2194	                null).getPropertyValue("color");
2195	        if (color.search("rgb") == -1)
2196	            return color;
2197	        else {
2198	            color = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
2199	            function hex(x) {
2200	                return ("0" + parseInt(x).toString(16)).slice(-2);
2201	            }
2202	            if(color) {
2203	            	return "#" + hex(color[1]) + hex(color[2]) + hex(color[3]);
2204	            }
2205	        }
2206	    }
2207	}
2208
2209	$.cssHooks.backgroundColor = {
2210	    get: function(elem) {
2211	        if (elem.currentStyle)
2212	            var bg = elem.currentStyle["backgroundColor"];
2213	        else if (window.getComputedStyle)
2214	            var bg = document.defaultView.getComputedStyle(elem,
2215	                null).getPropertyValue("background-color");
2216	        if (bg.search("rgb") == -1)
2217	            return bg;
2218	        else {
2219	            bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
2220	            function hex(x) {
2221	                return ("0" + parseInt(x).toString(16)).slice(-2);
2222	            }
2223	            if(bg) {
2224	            	return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]);
2225	            }
2226	        }
2227	    }
2228	}
2229	
2230	function shadeColor(hex, lum) {
2231
2232	  // validate hex string
2233		hex = String(hex).replace(/[^0-9a-f]/gi, '');
2234		if (hex.length < 6) {
2235			hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];
2236		}
2237		lum = lum || 0;
2238
2239		// convert to decimal and change luminosity
2240		var rgb = "#", c, i;
2241		for (i = 0; i < 3; i++) {
2242			c = parseInt(hex.substr(i*2,2), 16);
2243			c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
2244			rgb += ("00"+c).substr(c.length);
2245		}
2246
2247		return rgb;
2248	}
2249
2250	//color
2251	function coloredButtons() {
2252		$('.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(){
2253			
2254			$(this).css('visibility','visible');
2255			
2256			//if($(this).attr('data-color-override') != 'false'){
2257
2258				if($(this).attr('data-color-override') != 'false') {
2259					var $color = $(this).attr('data-color-override') ;
2260				} else {
2261					if($(this).parents('.dark').length > 0) 
2262						var $color = '#000000';
2263					else 
2264						var $color = '#ffffff';
2265				}
2266
2267				if(!$(this).hasClass('see-through-3')) $(this).css('color',$color);
2268				$(this).find('i').css('color',$color);
2269				
2270				var colorInt = parseInt($color.substring(1),16);
2271				var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override';
2272				var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff';
2273				
2274		   		var R = (colorInt & 0xFF0000) >> 16;
2275		    	var G = (colorInt & 0x00FF00) >> 8;
2276		   		var B = (colorInt & 0x0000FF) >> 0;
2277		   		
2278		   		$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2279
2280				$(this).css('border-color','rgba('+R+','+G+','+B+','+$opacityStr+')');
2281				
2282				if($(this).hasClass('see-through')) {
2283					$(this).hover(function(){
2284						$(this).css('border-color','rgba('+R+','+G+','+B+',1)');
2285					},function(){
2286						$(this).css('border-color','rgba('+R+','+G+','+B+','+$opacityStr+')');
2287					});
2288				} else {
2289					
2290					$(this).find('i').css('color', $hoverTextColor);
2291					
2292					if($hoverColor != 'no-override'){
2293						$(this).hover(function(){
2294				
2295							$(this).css({
2296								'border-color': $hoverColor,
2297								'background-color': $hoverColor,
2298								'color': $hoverTextColor
2299							});
2300						},function(){
2301							$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2302
2303							if(!$(this).hasClass('see-through-3')) {
2304								$(this).css({
2305									'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
2306									'background-color': 'transparent',
2307									'color': $color
2308								});
2309							} else {
2310								$(this).css({
2311									'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
2312									'background-color': 'transparent'
2313								});
2314							}
2315						});
2316					
2317					} else {
2318						$(this).hover(function(){
2319							$(this).css({
2320								'border-color': $hoverColor,
2321								'color': $hoverTextColor
2322							});
2323						},function(){
2324							$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
2325							$(this).css({
2326								'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
2327								'color':  $hoverTextColor
2328							});
2329						});
2330					
2331					}
2332			//	}
2333			
2334			}
2335		});
2336		
2337		$('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function(){
2338			
2339			$(this).css('visibility','visible');
2340			
2341			if($(this).attr('data-color-override') != 'false'){
2342				
2343				var $color = $(this).attr('data-color-override');
2344				$(this).removeClass('accent-color').removeClass('extra-color-1').removeClass('extra-color-2').removeClass('extra-color-3');
2345				$(this).css('background-color',$color);
2346				
2347			}
2348			
2349		});
2350
2351
2352		//solid color tilt 
2353		if($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) {
2354
2355			var $tiltButtonCssString = '';
2356
2357			$('.swiper-slide .solid_color_2 a').each(function(i){
2358				
2359				$(this).addClass('instance-'+i);
2360
2361				if($(this).attr('data-color-override') != 'false') {
2362					var $color = $(this).attr('data-color-override');
2363				} else {
2364					if($(this).parents('.dark').length > 0) 
2365						var $color = '#000000';
2366					else 
2367						var $color = '#ffffff';
2368				}
2369
2370				$(this).css('color',$color);
2371				$(this).find('i').css('color',$color);
2372				
2373				var $currentColor = $(this).css('background-color');
2374				var $topColor = shadeColor($currentColor, 0.13);
2375				var $bottomColor = shadeColor($currentColor, -0.15);
2376	
2377				$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+'; } ';
2378
2379			});
2380
2381
2382			$('.tilt-button-wrap a').each(function(i){
2383				
2384				$(this).addClass('instance-'+i);
2385
2386				var $currentColor = $(this).css('background-color');
2387
2388				if($(this).attr('data-color-override') != 'false') {
2389					var $color = $(this).attr('data-color-override');
2390					$(this).css('background-color',$color);
2391					$currentColor = $color;
2392				} 
2393			
2394				var $topColor = shadeColor($currentColor, 0.13);
2395				var $bottomColor = shadeColor($currentColor, -0.15);
2396	
2397				$tiltButtonCssString += '.tilt-button-wrap a.instance-'+i + ':after { background-color: '+$topColor+';  }' + ' .tilt-button-wrap a.instance-'+i + ':before { background-color: '+$bottomColor+'; } ';
2398
2399			});
2400
2401			var head = document.head || document.getElementsByTagName('head')[0];
2402   			var style = document.createElement('style');
2403
2404   			style.type = 'text/css';
2405			if (style.styleSheet){
2406			  style.styleSheet.cssText = $tiltButtonCssString;
2407			} else {
2408			  style.appendChild(document.createTextNode($tiltButtonCssString));
2409			}
2410
2411			head.appendChild(style);
2412		}
2413
2414
2415		//transparent 3d
2416		if($('.nectar-3d-transparent-button').length > 0) {
2417
2418			var $3dTransButtonCssString = '';
2419			$('.nectar-3d-transparent-button').each(function(i){
2420
2421				var $that = $(this);
2422				var $size = $that.attr('data-size');
2423				var $padding = 0;
2424
2425		
2426
2427				//size
2428
2429				if($size == 'large') {
2430					$padding = 46;
2431					$font_size = 16;
2432				} else if($size == 'medium') {
2433					$padding = 30;
2434					$font_size = 16;
2435				} else if($size == 'small') {
2436					$padding = 20;
2437					$font_size = 12;
2438				} else if($size == 'jumbo') {
2439					$padding = 54;
2440					$font_size = 24;
2441				} else if($size == 'extra_jumbo') {
2442					$padding = 100;
2443					$font_size = 64;
2444				}
2445
2446				$that.find('svg text').attr('font-size',$font_size);
2447				$boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect();
2448
2449				$text_width = $boundingRect.width;
2450				$text_height = $font_size*1.5;
2451
2452				$extraMult = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 0 : 1;
2453
2454				$that.css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'});
2455				$that.find('> a').css({'height': ($text_height+$padding)+'px'});
2456
2457				$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));
2458				if($size == 'jumbo')
2459					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.68) +')');
2460				else if($size == 'extra_jumbo')
2461					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.6)/2 +' ' + (($text_height+$padding) / 1.6) +')');
2462				else if($size == 'large') {
2463					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.7) +')');
2464				}
2465				else {
2466					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.65) +')');
2467				}
2468				$that.find('.front-3d ').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
2469				$that.find('.back-3d').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
2470
2471				//mask
2472				$(this).find('.front-3d svg > rect').attr('id','masked-rect-id-'+i);
2473				$(this).find('.front-3d defs mask').attr('id','button-text-mask-'+i);
2474
2475				$that.css('visibility','visible');
2476				$3dTransButtonCssString+= '#masked-rect-id-'+i+' { mask: url(#button-text-mask-'+i+'); -webkit-mask: url(#button-text-mask-'+i+')} ';
2477
2478			});
2479
2480			//extra jumbo resize
2481			function createExtraJumboSize() {
2482				$('.nectar-3d-transparent-button').each(function(i){
2483					
2484					if($(this).css('visibility') != 'visible') return;
2485
2486					var $that = $(this);
2487					var $size = $that.attr('data-size');
2488					if($size == 'extra_jumbo') {
2489
2490						$extraMult = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 0 : 1;
2491
2492						if(window.innerWidth < 1000 && window.innerWidth > 690) {
2493							$padding = 64;
2494							$font_size = 34;
2495							$that.find('.back-3d rect').attr('stroke-width','12');
2496							$vert_height_divider = 1.7;
2497						} else if(window.innerWidth <= 690 ) {
2498							$padding = 46;
2499							$font_size = 16;
2500							$that.find('.back-3d rect').attr('stroke-width','10');
2501							$vert_height_divider = 1.7;
2502						}  else {
2503							$padding = 100;
2504							$font_size = 64;
2505							$that.find('.back-3d rect').attr('stroke-width','20');
2506							$vert_height_divider = 1.6;
2507						}
2508			
2509
2510						$that.find('svg text').attr('font-size',$font_size);
2511
2512						$boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect();
2513						$text_width = $boundingRect.width;
2514						$text_height = $font_size*1.5;
2515
2516						$that.css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'});
2517						$that.find('> a').css({'height': ($text_height+$padding)+'px'});
2518
2519						$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));
2520
2521						$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.6)/2 +' ' + (($text_height+$padding) / $vert_height_divider) +')');
2522
2523						$that.find('.front-3d ').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
2524						$that.find('.back-3d').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
2525
2526					}
2527				});
2528			}
2529			createExtraJumboSize();
2530			$(window).on('smartresize',createExtraJumboSize);
2531
2532			var head = document.head || document.getElementsByTagName('head')[0];
2533				var style = document.createElement('style');
2534
2535				style.type = 'text/css';
2536			if (style.styleSheet){
2537			  style.styleSheet.cssText = $3dTransButtonCssString;
2538			} else {
2539			  style.appendChild(document.createTextNode($3dTransButtonCssString));
2540			}
2541
2542			head.appendChild(style);
2543		}
2544
2545		//gradient btn init
2546		setTimeout(function(){
2547			$('.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');
2548		},150);
2549		//no grad for ff
2550		if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) {
2551			$('.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');
2552		}
2553	}	
2554
2555	coloredButtons();
2556
2557
2558	//large icon hover
2559	function largeIconHover(){
2560		$('.icon-3x').each(function(){
2561			$(this).closest('.col').hover(function(){
2562				$(this).find('.icon-3x').addClass('hovered')
2563			},function(){
2564				$('.icon-3x').removeClass('hovered')
2565			});
2566		});
2567
2568		//remove gradient from FF
2569		if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./))
2570			$('[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');
2571	}
2572	largeIconHover();
2573
2574
2575
2576/***************** Column Hover BG ******************/
2577
2578function columnBGColors() {	
2579	
2580	var $columnColorCSS = '';
2581
2582	$('.wpb_column').each(function(i){
2583
2584		$(this).addClass('instance-'+i);
2585
2586		//bg color
2587		if($(this).attr('data-has-bg-color') == 'true') {
2588			if($(this).is('[data-animation*="reveal"]') && $(this).hasClass('has-animation')) 
2589				$columnColorCSS += '.wpb_column.instance-'+i+ ' .column-inner-wrap .column-inner:before { background-color:' + $(this).attr('data-bg-color') + ';  opacity: '+$(this).attr('data-bg-opacity')+'; }';
2590			else 
2591				$columnColorCSS += '.wpb_column.instance-'+i+ ':before { background-color:' + $(this).attr('data-bg-color') + ';  opacity: '+$(this).attr('data-bg-opacity')+'; }';
2592		}
2593
2594		//hover bg color
2595		if($(this).is('[data-hover-bg^="#"]')) {
2596			if($(this).is('[data-animation*="reveal"]') && $(this).hasClass('has-animation')) 
2597				$columnColorCSS += '.wpb_column.instance-'+i+ ':hover .column-inner:before { background-color: '+$(this).attr('data-hover-bg') + '; opacity: '+$(this).attr('data-hover-bg-opacity')+'; }';
2598			else 
2599	   			$columnColorCSS += '.wpb_column.instance-'+i+ ':hover:before { background-color: '+$(this).attr('data-hover-bg') + '; opacity: '+$(this).attr('data-hover-bg-opacity')+'; }';
2600
2601		}
2602	});
2603
2604	if($columnColorCSS.length > 1) {
2605		var head = document.head || document.getElementsByTagName('head')[0];
2606		var style = document.createElement('style');
2607
2608		style.type = 'text/css';
2609		if (style.styleSheet){
2610		  style.styleSheet.cssText = $columnColorCSS;
2611		} else {
2612		  style.appendChild(document.createTextNode($columnColorCSS));
2613		}
2614
2615		head.appendChild(style);
2616	}
2617
2618}
2619columnBGColors();
2620
2621
2622
2623/***************** Row Color Overlay ******************/
2624function rowColorOverlay() {	
2625	
2626	var $rowOverlayCSS = '';
2627
2628	$('.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){
2629
2630		$(this).parent().addClass('instance-'+i);
2631
2632		$overlayOpacity = ($(this).attr('data-overlay_strength').length > 0) ? $(this).attr('data-overlay_strength') : '1';
2633		$overlay1 = ($(this).attr('data-color_overlay').length > 0) ? $(this).attr('data-color_overlay') : 'transparent';
2634		$overlay2 = ($(this).attr('data-color_overlay_2').length > 0) ? $(this).attr('data-color_overlay_2') : 'transparent';
2635		$gradientDirection = ($(this).attr('data-gradient_direction').length > 0) ? $(this).attr('data-gradient_direction') : 'left_t_right';
2636		switch($gradientDirection) {
2637			case 'left_to_right' : 
2638				var $gradientDirectionDeg = '90deg';
2639				break;
2640			case 'left_t_to_right_b' : 
2641				var $gradientDirectionDeg = '135deg';
2642				break;
2643			case 'left_b_to_right_t' : 
2644				var $gradientDirectionDeg = '45deg';
2645				break;
2646			case 'top_to_bottom' : 
2647				var $gradientDirectionDeg = 'to bottom';
2648				break;
2649		} 
2650		$enableGradient = ($(this).attr('data-enable_gradient') == 'true') ? true : false;
2651
2652		if($enableGradient) {
2653			
2654			//safari transparent white fix
2655			if($overlay1 == '#ffffff' && $overlay2 == 'transparent') $overlay2 = 'rgba(255,255,255,0.001)';
2656			if($overlay1 == 'transparent' && $overlay2 == '#ffffff') $overlay1 = 'rgba(255,255,255,0.001)';
2657			
2658			if($gradientDirection == 'top_to_bottom') {
2659				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+'; }';
2660				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+'; }';
2661				
2662				if( $overlay1 != 'transparent' && $overlay2 != 'transparent') $rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after {  background: '+$overlay1+'; background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 0%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
2663			
2664			} else
2665				$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background: '+$overlay1+'; background: linear-gradient('+$gradientDirectionDeg+',' + $overlay1 + ' 0%,' + $overlay2 + ' 100%);  opacity: '+$overlayOpacity+'; }';
2666
2667
2668		} else {
2669
2670			if($(this).attr('data-color_overlay').length > 0) {
2671				$rowOverlayCSS += '.row-bg-wrap.instance-'+i+ ':after { background-color:' + $overlay1 + ';  opacity: '+$overlayOpacity+'; }';
2672			}
2673
2674		}
2675	
2676
2677
2678	});
2679	
2680	if($rowOverlayCSS.length > 1) {
2681		var head = document.head || document.getElementsByTagName('head')[0];
2682		var style = document.createElement('style');
2683
2684		style.type = 'text/css';
2685		if (style.styleSheet){
2686		  style.styleSheet.cssText = $rowOverlayCSS;
2687		} else {
2688		  style.appendChild(document.createTextNode($rowOverlayCSS));
2689		}
2690
2691		head.appendChild(style);
2692	}
2693
2694}
2695
2696rowColorOverlay();
2697
2698
2699/***************** morphing button ******************/
2700
2701function morphingOutlines() {
2702
2703	if($('.morphing-outline').length > 0) {
2704
2705		$morphingOutlineCSS = '';
2706
2707		$('.morphing-outline').each(function(i){
2708			$(this).addClass('instance-'+i).css({'visibility':'visible'});
2709			var $width = $(this).find('.inner').width();
2710			var $height = $(this).find('.inner').height();
2711			var $border = parseInt($(this).attr("data-border-thickness"));
2712			var $hover = ($('body[data-button-style="rounded"]').length > 0) ? ':hover': '';
2713			var $hover2 = ($('body[data-button-style="rounded"]').length > 0) ? '': ':hover';
2714
2715			$morphingOutlineCSS += 'body .morphing-outline.instance-'+i+' .inner > * { color: '+$(this).attr("data-starting-color")+'; } ';
2716			$morphingOutlineCSS += 'body .morphing-outline.instance-'+i+' .inner:after  { border-width:'+$(this).attr("data-border-thickness")+'px ; border-color: '+$(this).attr("data-starting-color")+'; } ';
2717			
2718			$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")+'; } ';
2719			$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")+'; } ';
2720			//padding calcs
2721			$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}';
2722			$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
2723			$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 }';
2724
2725			$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 }';
2726			////hover
2727			$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}';
2728			$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 }';
2729
2730		});
2731
2732		var head = document.head || document.getElementsByTagName('head')[0];
2733		var style = document.createElement('style');
2734
2735		style.type = 'text/css';
2736		style.id = 'morphing-outlines';
2737		if (style.styleSheet){
2738		  style.styleSheet.cssText = $morphingOutlineCSS;
2739		} else {
2740		  style.appendChild(document.createTextNode($morphingOutlineCSS));
2741		}
2742
2743		$('#morphing-outlines').remove();
2744		head.appendChild(style);
2745	}
2746}
2747
2748setTimeout(morphingOutlines,100); 
2749setTimeout(fullWidthContentColumns,126);
2750
2751
2752/***************** svg icons *******************/
2753
2754var $svg_icons = [];
2755function svgAnimations() {
2756	
2757	$svgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
2758
2759	if($svg_icons.length == 0) {
2760
2761		$('.svg-icon-holder:not(.animated-in)').each(function(i){
2762			var $that = $(this);
2763
2764			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)) $that.attr('data-animation','false');
2765
2766			//size
2767			$that.css({'height': parseInt($that.attr('data-size')) +'px', 'width': parseInt($that.attr('data-size')) +'px'});
2768
2769			//animation
2770			$(this).attr('id','nectar-svg-animation-instance-'+i);
2771			var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200;
2772			if($that.attr('data-animation') == 'false') { 
2773				$animationSpeed = 1;
2774				$that.css('opacity','1');
2775			}
2776
2777			if(!$that.hasClass('bound'))
2778				$svg_icons[i] = new Vivus($that.attr('id'), {type: 'delayed', pathTimingFunction: Vivus.EASE_OUT, animTimingFunction: Vivus.LINEAR, duration: $animationSpeed, file: $that.text(), onReady: svgInit });
2779			
2780			$that.find('span').remove();
2781			if($animationSpeed !== 1) {
2782
2783				var $that = $(this);
2784				var waypoint = new Waypoint({
2785		 			element: $that,
2786		 			 handler: function(direction) {
2787		 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
2788						     waypoint.destroy();
2789						     return;
2790						}
2791
2792		 			 	checkIfReady();
2793						$that.addClass('animated-in');
2794						waypoint.destroy();
2795					},
2796					offset: $svgOffsetPos
2797
2798				}); 
2799
2800			} else {
2801				checkIfReady();
2802			}
2803
2804			function checkIfReady() {
2805				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;
2806				if($svg_icons[$that.attr('id').slice(-1)].isReady == true) {
2807					$that.css('opacity','1');
2808					 setTimeout(function(){ $svg_icons[$that.attr('id').slice(-1)].reset().play(); },$animationDelay);
2809				} else {
2810					setTimeout(checkIfReady,50);
2811				}
2812			}
2813
2814			function svgInit() {
2815
2816				//set size
2817				$that.find('object').css({'height': parseInt($that.attr('data-size')) +'px', 'width': parseInt($that.attr('data-size')) +'px'});
2818
2819				//stop animation until user scrolls to it
2820				$svg_icons[$that.attr('id').slice(-1)].reset().stop();
2821
2822				//set color
2823				var svgDoc = $that.find('object')[0].contentDocument;
2824
2825				var styleElement = svgDoc.createElementNS("http://www.w3.org/2000/svg", "style");
2826				styleElement.textContent = "svg, svg path { stroke: "+$that.css('color')+"; fill: none; }"; 
2827				svgDoc.getElementById("Layer_1").appendChild(styleElement);
2828
2829			}
2830
2831			$that.addClass('bound');
2832
2833		});	
2834	} else {
2835		$('.svg-icon-holder').addClass('animated-in').css('opacity','1');
2836	}
2837	
2838	//full vc row support
2839	$('.svg-icon-holder.animated-in').each(function(i){
2840		
2841		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;
2842		var $that = $(this);
2843
2844		if($that.attr('data-animation') == 'false') { 
2845			$animationSpeed = 1;
2846			$that.css('opacity','1');
2847			$svg_icons[$that.attr('id').slice(-1)].finish();
2848		} else {
2849			if($(this).parents('.active').length > 0 || $(this).parents('#footer-outer').length > 0 || $('body.mobile').length > 0) {
2850				$svg_icons[$that.attr('id').slice(-1)].reset();
2851				setTimeout(function(){ $svg_icons[$that.attr('id').slice(-1)].play(); },$animationDelay);
2852			}
2853
2854			else {
2855				$svg_icons[$(this).attr('id').slice(-1)].reset().stop();
2856			}
2857		}
2858	});
2859}
2860//if($('.nectar-box-roll').length == 0 || $('body.mobile').length > 0) setTimeout(svgAnimations,100);
2861
2862/***************** fancy ul ******************/
2863
2864	function nectar_fancy_ul_init() {
2865		$($fullscreenSelector+'.nectar-fancy-ul').each(function(){
2866
2867
2868			var $icon = $(this).attr('data-list-icon');
2869			var $color = $(this).attr('data-color');
2870			var $animation = $(this).attr('data-animation');
2871			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;
2872			
2873			$(this).find('li').each(function(){
2874				
2875				if($(this).find('> i').length == 0) 
2876					$(this).prepend('<i class="icon-default-style '+$icon+ ' ' + $color +'"></i> ');
2877			});
2878
2879			
2880			if($animation == 'true') {
2881
2882
2883				var $that = $(this);
2884				var waypoint = new Waypoint({
2885		 			element: $that,
2886		 			 handler: function(direction) {
2887
2888		 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
2889						     waypoint.destroy();
2890						     return;
2891						}
2892
2893						setTimeout(function(){
2894			 			 	$that.find('li').each(function(i){
2895			 			 		var $that = $(this);
2896								$that.delay(i*220).transition({
2897									'opacity': '1',
2898									'left' : '0'
2899								},220,'easeOutCubic');
2900							});
2901			 			 },$animationDelay);
2902
2903						$that.addClass('animated-in');
2904						waypoint.destroy();
2905					},
2906					offset: 'bottom-in-view'
2907
2908				}); 
2909
2910			} 
2911			
2912			
2913			
2914		});
2915	}
2916	setTimeout(function(){ 
2917		//if($('.nectar-box-roll').length == 0) nectar_fancy_ul_init();
2918	},$animationOnScrollTimeOut); 
2919
2920	
2921
2922/***************** flip box min heights ******************/
2923//if content height exceeds min height change it
2924function flipBoxHeights() {
2925	$('.nectar-flip-box').each(function(){
2926		
2927		var $flipBoxMinHeight = parseInt($(this).attr('data-min-height'));
2928		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();
2929
2930		if($flipBoxHeight >= $flipBoxMinHeight - 80) {
2931			$(this).find('> div').css('height', $flipBoxHeight + 80);
2932		} else 
2933			$(this).find('> div').css('height','auto');
2934
2935	});
2936}
2937flipBoxHeights();
2938
2939if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
2940	$('.nectar-flip-box').on('click',function(){
2941		$(this).toggleClass('flipped');
2942	});
2943}
2944
2945/***************** PARALLAX SECTIONS ******************/
2946	
2947	// Create cross browser requestAnimationFrame method:
2948    window.requestAnimationFrame = window.requestAnimationFrame
2949     || window.mozRequestAnimationFrame
2950     || window.webkitRequestAnimationFrame
2951     || window.msRequestAnimationFrame
2952     || function(f){setTimeout(f, 1000/60)}
2953
2954
2955	var $window = $(window);
2956	var windowHeight = $window.height();
2957	
2958	$window.unbind('scroll.parallaxSections').unbind('resize.parallaxSections');
2959	$window.unbind('resize.parallaxSectionsUpdateHeight');
2960	$window.unbind('load.parallaxSectionsOffsetL');
2961	$window.unbind('resize.parallaxSectionsOffsetR');
2962
2963	$window.on('resize.parallaxSectionsUpdateHeight',psUpdateWindowHeight);
2964
2965	function psUpdateWindowHeight() {
2966		windowHeight = $window.height();
2967	}
2968
2969	function psUpdateOffset($this) {
2970		$this.each(function(){
2971	  	    firstTop = $this.offset().top;
2972		});
2973	}
2974	
2975	$.fn.parallaxScroll = function(xpos, speedFactor, outerHeight) {
2976		var $this = $(this);
2977		var getHeight;
2978		var firstTop;
2979		var paddingTop = 0;
2980		
2981		//get the starting position of each element to have parallax applied to it		
2982		$this.each(function(){
2983		    firstTop = $this.offset().top;
2984		});
2985		
2986		
2987		$window.on('resize.parallaxSectionsOffsetR',psUpdateOffset($this));
2988		$window.on('load.parallaxSectionsOffsetL',psUpdateOffset($this));
2989	
2990		getHeight = function(jqo) {
2991			return jqo.outerHeight(true);
2992		};
2993		 
2994			
2995		// setup defaults if arguments aren't specified
2996		if (arguments.length < 1 || xpos === null) xpos = "50%";
2997		if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1;
2998		if (arguments.length < 3 || outerHeight === null) outerHeight = true;
2999		
3000		// function to be called whenever the window is scrolled or resized
3001
3002		var $element, top, height, pos;
3003
3004		function update(){
3005
3006			pos = $window.scrollTop();				
3007			
3008			$this.each(function(){
3009
3010				firstTop = $this.offset().top;
3011
3012				$element = $(this);
3013				top = $element.offset().top;
3014				height = getHeight($element);
3015
3016				// Check if totally above or totally below viewport
3017				if (top + height < pos || top > pos + windowHeight) {
3018					return;
3019				}
3020
3021				var ua = window.navigator.userAgent;
3022		        var msie = ua.indexOf("MSIE ");
3023
3024		        //for IE, Safari or any setup using the styled scrollbar default to animating the BG pos
3025		        if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true || navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
3026		        	$this.find('.row-bg.using-image').css('backgroundPosition', xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px");
3027		        }
3028		       	//for Firefox/Chrome use a higher performing method
3029		        else  {
3030		        	var $ifFast = ($this.find('.row-bg[data-parallax-speed="fast"]').length > 0) ? ($element.find('.row-bg').height() - height)/2 : 0;
3031		        	$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)' });
3032		        }              
3033				
3034			});
3035		}		
3036
3037		if (window.addEventListener) {
3038			 window.addEventListener('scroll', function(){ 
3039	          requestAnimationFrame(update); 
3040	        }, false);
3041		}
3042
3043		$window.on('resize.parallaxSections',update);
3044
3045		update();
3046	};
3047
3048
3049
3050	
3051/***************** Full Width Section ******************/
3052	function fullWidthSections(){
3053		
3054		var $scrollBar = ($('#ascrail2000').length > 0 && window.innerWidth > 1000) ? -13 : 4;
3055			 
3056		if($('#boxed').length == 1){
3057			$justOutOfSight = ((parseInt($('.container-wrap').width()) - parseInt($('.main-content').width())) / 2) + 4;
3058		} else {
3059			
3060			//if the ext responsive mode is on - add the extra padding into the calcs
3061			var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1000) ? 180 : 0;
3062			
3063			if($(window).width() <= parseInt($('.main-content').css('max-width'))) { 
3064				var $windowWidth = parseInt($('.main-content').css('max-width'));
3065
3066				//no need for the scrollbar calcs with ext responsive on desktop views
3067				if($extResponsivePadding == 180) $windowWidth = $windowWidth - $scrollBar;
3068
3069			} else { 
3070				var $windowWidth = $(window).width();
3071			}
3072
3073			
3074			$contentWidth = parseInt($('.main-content').css('max-width'));
3075
3076			//single post fullwidth
3077			if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 ) {
3078				$contentWidth = $('#post-area').width();
3079				$extResponsivePadding = 0;
3080			}
3081			
3082			$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
3083		}
3084		
3085		$('.full-width-section').each(function(){
3086			
3087			if(!$(this).parents('.span_9').length > 0 && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner' && $(this).parent().attr('id') != 'portfolio-extra' &&
3088			!$(this).hasClass('non-fw')){
3089
3090				$(this).css({
3091					'margin-left': - $justOutOfSight,
3092					'padding-left': $justOutOfSight,
3093					'padding-right': $justOutOfSight,
3094					'visibility': 'visible'
3095				});	
3096
3097			if($('#boxed').length > 0 && $('#nectar_fullscreen_rows').length > 0) $(this).css({ 'padding-left': 0, 'padding-right': 0 });
3098
3099			}  else if($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) {
3100				$(this).css({
3101					'margin-left': - $justOutOfSight,
3102					'padding-left': $justOutOfSight,
3103					'padding-right': $justOutOfSight,
3104					'visibility': 'visible'
3105				});	
3106			}
3107			
3108			else {
3109				$(this).css({
3110					'margin-left': 0,
3111					'padding-left': 0,
3112					'padding-right': 0,
3113					'visibility': 'visible'
3114				});	
3115			}
3116			
3117		});
3118	
3119	
3120	    //full width content sections
3121	    $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow','visible');
3122	    
3123	    $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"], .full-width-content').each(function(){
3124			
3125			//single post fullwidth
3126			if($('#boxed').length == 1){
3127
3128				var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
3129
3130				if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('#post-area').length > 0) {
3131					$contentWidth = $('#post-area').width();
3132					$extResponsivePadding = 0;
3133					$windowWidth = $(window).width();
3134					$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
3135				} else {
3136					$justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4;
3137				}
3138			} else {
3139				if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('#post-area').length > 0) {
3140					$contentWidth = $('#post-area').width();
3141					$extResponsivePadding = 0;
3142					$windowWidth = $(window).width();
3143				} else {
3144
3145					var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').css('max-width')) : parseInt($(this).parents('.container').css('max-width'));
3146
3147					if($(window).width() <= $mainContentMaxWidth) { 
3148						$windowWidth = $mainContentMaxWidth;
3149						//no need for the scrollbar calcs with ext responsive on desktop views
3150						if($extResponsivePadding == 180) $windowWidth = $windowWidth - $scrollBar;
3151					}
3152					$contentWidth = $mainContentMaxWidth;
3153					$extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1000) ? 180 : 0;
3154				}
3155
3156				$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
3157			}
3158
3159			$extraSpace = ($(this).hasClass('carousel-wrap')) ? 1 : 4;
3160	    	$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width() +$extraSpace  + $scrollBar ;
3161	    	
3162	    	if($(this).parent().hasClass('default-style')) { 
3163
3164	    		var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
3165	    		
3166	    		if($('#boxed').length != 0) {
3167	    			$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width() + $extraSpace + $scrollBar ;
3168				}
3169				else {
3170					$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width()  - ($(window).width()*.025) + $extraSpace + $scrollBar ;
3171					$windowWidth = ($(window).width() <= $mainContentWidth) ? $mainContentWidth : $(window).width() - ($(window).width()*.025);
3172					$justOutOfSight = Math.ceil( (($windowWidth + $scrollBar - $mainContentWidth) / 2) )
3173				}
3174			}
3175
3176			else if($(this).parent().hasClass('spaced')) { 
3177
3178				var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
3179
3180				if($('#boxed').length != 0) {
3181	    			$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) - ($(window).width()*.02) : $(window).width() + $extraSpace + $scrollBar ;
3182				} else {
3183					$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width()  - Math.ceil($(window).width()*.02) + $extraSpace + $scrollBar ;
3184					var $windowWidth2 = ($(window).width() <= $mainContentWidth) ? $mainContentWidth : $(window).width() - ($(window).width()*.02);
3185					$justOutOfSight = Math.ceil( (($windowWidth2 + $scrollBar - $mainContentWidth) / 2) +2)
3186				}
3187			}
3188	    	
3189	    	if(!$(this).parents('.span_9').length > 0 && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner' && $(this).parent().attr('id') != 'portfolio-extra' 
3190	        && !$(this).find('.carousel-wrap[data-full-width="true"]').length > 0
3191	    	&& !$(this).find('.portfolio-items:not(".carousel")[data-col-num="elastic"]').length > 0){
3192
3193	    		//escape if inside woocoommerce page and not using applicable layout
3194	    		if($('.single-product').length > 0 && $(this).parents('#tab-description').length > 0 && $(this).parents('.full-width-tabs').length == 0) {
3195	    			$(this).css({
3196						'visibility': 'visible'
3197					});	
3198	    		} else {
3199	    			if($(this).hasClass('portfolio-items')) {
3200	    				$(this).css({
3201							'transform': 'translateX(-'+ $justOutOfSight + 'px)',
3202							'margin-left': 0,
3203							'width': $carouselWidth,
3204							'visibility': 'visible'
3205						});	
3206	    			} else {
3207	    				$(this).css({
3208							'margin-left': - $justOutOfSight,
3209							'width': $carouselWidth,
3210							'visibility': 'visible'
3211						});	
3212	    			}
3213					
3214				}
3215			}  else if($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) {
3216				$(this).css({
3217					'margin-left': - $justOutOfSight,
3218					'width': $carouselWidth,
3219					'visibility': 'visible'
3220				});	
3221			}
3222			
3223			else {
3224				$(this).css({
3225					'margin-left': 0,
3226					'visibility': 'visible'
3227				});	
3228			}
3229	    	
3230	    });
3231
3232	}
3233	
3234	var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length ;
3235
3236	function parallaxSrollSpeed(speedString) {
3237
3238		var ua = window.navigator.userAgent;	
3239		var msie = ua.indexOf("MSIE ");
3240		var speed;
3241
3242		 //not as modern browsers
3243		 if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true || navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
3244			 switch(speedString) {
3245			   	  case 'slow':
3246			   	      speed = 0.2;
3247			   	      break;
3248			   	  case 'medium': 
3249			   	  	  speed = 0.4;
3250			   	      break;
3251			   	  case 'fast': 
3252			    	  speed = 0.6;
3253			   	       break;
3254			   }
3255		}
3256		 //chrome/ff
3257		 else {
3258		 	 switch(speedString) {
3259			   	  case 'slow':
3260			   	      speed = 0.6;
3261			   	      break;
3262			   	  case 'medium': 
3263			   	  	  speed = 0.4;
3264			   	      break;
3265			   	  case 'fast': 
3266			    	  speed = 0.25;
3267			   	       break;
3268			   }
3269		}
3270
3271		   return speed;
3272	}
3273
3274	function parallaxScrollInit(){
3275		 parallaxRowsBGCals();
3276		$('.full-width-section.parallax_section, .full-width-content.parallax_section').each(function(){
3277		   var $id = $(this).attr('id');	
3278		  
3279		    var ua = window.navigator.userAgent;	
3280		    var msie = ua.indexOf("MSIE ");
3281
3282			if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true || navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)  {
3283		   		if($(this).find('[data-parallax-speed="fixed"]').length == 0) $('#'+$id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) );
3284		   	} else if($(this).find('[data-parallax-speed="fixed"]').length == 0) {
3285		   		$('#'+$id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) );
3286		   	}
3287		});
3288	}
3289
3290	
3291	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
3292		parallaxScrollInit();
3293		$(window).load(parallaxRowsBGCals);
3294	}
3295
3296	function parallaxRowsBGCals(){
3297		$('.full-width-section.parallax_section, .full-width-content.parallax_section').each(function(){
3298
3299			 var ua = window.navigator.userAgent;
3300		     var msie = ua.indexOf("MSIE ");
3301
3302			 if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./) || $smoothCache == true || navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) {
3303			 	$(this).find('.row-bg').css({'height': $(this).outerHeight(true)*2.8, 'margin-top': '-' + ($(this).outerHeight(true)*2.8)/2 + 'px' });
3304			 } else {
3305			 	$(this).find('.row-bg').css({'height': Math.ceil( $(window).height() * parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) ) + $(this).outerHeight(true)   });
3306			 }
3307			 
3308		});
3309	}
3310	
3311	//if fullwidth section is first or last, remove the margins so it fits flush against header/footer
3312	function fwsClasses() {
3313		
3314		$('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function(){
3315			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
3316				if($(this).parents('.wpb_row').index() == '0'){
3317					$(this).addClass('first-nectar-slider');
3318				} 
3319			}
3320		});
3321
3322		if($('#portfolio-extra').length == 0) {
3323			$contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length;
3324		} else {
3325			$contentElementsNum = $('.main-content > .row #portfolio-extra > *').length;
3326		}
3327
3328		$('.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(){
3329			
3330			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
3331				
3332				if($(this).parents('.wpb_row').length > 0){ 
3333				
3334					if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
3335					
3336					////first
3337					if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length != 0 || $(this).parents('.wpb_row').index() == '0' && $('.parallax_slider_outer').length != 0){
3338						//$(this).css('margin-top','-2.1em').addClass('first-section nder-page-header');
3339					} 
3340					else if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length == 0 && $('.page-header-no-bg').length == 0 
3341					         && $('.project-title').length == 0 && $(this).parents('.wpb_row').index() == '0' 
3342					         && $('.parallax_slider_outer').length == 0 && $('.project-title').length == 0 
3343					         && $('body[data-bg-header="true"]').length == 0) {
3344
3345					     if($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0) {
3346					     	$('.container-wrap').css('padding-top','0px');
3347					     } else {
3348					     	$(this).css('margin-top','-70px').addClass('first-section');
3349					     } 	
3350						
3351					} 
3352					
3353					//check if it's also last (i.e. the only fws)
3354					if($(this).parents('.wpb_row').index() == $contentElementsNum-1 && $('#respond').length == 0 ) { 
3355						if($(this).attr('id') != 'portfolio-filters-inline') {
3356							$('.container-wrap').css('padding-bottom','0px');
3357							$('#call-to-action .triangle').remove();
3358						}
3359					} 
3360				
3361				} else {
3362					
3363					if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
3364					
3365					if( $(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area' ) {
3366						
3367						////first
3368						if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' && $('.parallax_slider_outer').length != 0){
3369							//$(this).css('margin-top','-2.1em').addClass('first-section nder-page-header');
3370			
3371						} 
3372						else if($(this).index() == '0' && $('#page-header-bg').length == 0 && $(this).index() == '0' && $('.page-header-no-bg').length == 0 && 
3373						        $(this).index() == '0' && $('.parallax_slider_outer').length == 0 && !$(this).hasClass('blog_next_prev_buttons') ) {
3374						     
3375						      if($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0) { 
3376						          $('.container-wrap').css('padding-top','0px');
3377						      } else {
3378						      	  $(this).css('margin-top','-70px').addClass('first-section');
3379						      }   	
3380							
3381						} 
3382						
3383						//check if it's also last (i.e. the only fws)
3384						if($(this).index() == $contentElementsNum-1 && $('#respond').length == 0 ) { 
3385							$('.container-wrap').css('padding-bottom','0px');
3386							$('.bottom_controls').css('margin-top','0px');
3387							$('#call-to-action .triangle').remove();
3388						} 
3389					}
3390					
3391				}
3392			}
3393		});
3394
3395
3396		//add first class for rows for page header trans effect (zoom only as of now)
3397		$('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function(){
3398			
3399			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
3400				
3401				
3402				if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
3403					
3404				if($(this).index() == '0' && $('#page-header-bg').length == 0 && $('.page-header-no-bg').length == 0 
3405				         && $('.project-title').length == 0 && $('body.single').length == 0 
3406				         && $('.parallax_slider_outer').length == 0 && $('.project-title').length == 0 ) {
3407
3408					$(this).addClass('first-section');
3409					var $that = $(this);
3410					setTimeout( function() { $that.addClass('loaded'); },50);
3411					
3412				} 
3413					
3414	
3415			}
3416		});	
3417
3418
3419		
3420		$('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function(){
3421			//check if it's last 
3422			if($(this).index() == $contentElementsNum-1 && $('#commentform').length == 0 && $('#pagination').length == 0) { 
3423				$(this).css('margin-bottom','-40px');
3424				$('#call-to-action .triangle').remove();
3425			}
3426		});
3427		
3428		
3429		
3430		$('.portfolio-filters').each(function(){
3431			////first
3432			if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' && $('.parallax_slider_outer').length != 0){
3433				$(this).css({'margin-top':'-2.1em'}).addClass('first-section nder-page-header');
3434			}  else if($(this).index() == '0' && $('#page-header-bg').length == 0 || $(this).index() == '0' && $('.parallax_slider_outer').length == 0){
3435				$(this).css({'margin-top':'0px'}).addClass('first-section');
3436			}
3437		});
3438		
3439		$('.portfolio-filters-inline').each(function(){
3440			////first
3441			if($(this).parents('.wpb_row').length > 0){ 
3442				
3443				if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length != 0 || $(this).parents('.wpb_row').index() == '0' && $('.parallax_slider_outer').length != 0){
3444					if($('body[data-header-resize="0"]').length == 0) $(this).css({'margin-top':'-2.1em', 'padding-top' : '19px'}).addClass('first-section nder-page-header');
3445				}  else if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length == 0 || $(this).parents('.wpb_row').index() == '0' && $('.parallax_slider_outer').length == 0){
3446					
3447					 if($('body[data-header-resize="0"]').length == 1) { 
3448				          // $(this).css({'margin-top':'-30px', 'padding-top' : '50px'}).addClass('first-section');
3449				      } else {
3450				      	  $(this).css({'margin-top':'-70px', 'padding-top' : '50px'}).addClass('first-section');
3451				      } 
3452
3453				}
3454				
3455			} else {
3456				if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' && $('.parallax_slider_outer').length != 0){
3457					$(this).css({'margin-top':'-2.1em', 'padding-top' : '19px'}).addClass('first-section nder-page-header');
3458				}  else if($(this).index() == '0' && $('#page-header-bg').length == 0 || $(this).index() == '0' && $('.parallax_slider_outer').length == 0){
3459					
3460					if($('body[data-header-resize="0"]').length == 1) { 
3461				          $(this).css({'margin-top':'-30px', 'padding-top' : '50px'}).addClass('first-section');
3462				      } else {
3463				      	  $(this).css({'margin-top':'-70px', 'padding-top' : '50px'}).addClass('first-section');
3464				      } 
3465
3466				
3467				}
3468			}
3469			
3470		});
3471		
3472		
3473		
3474		$('.parallax_slider_outer').each(function(){
3475			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
3476				
3477				if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
3478				////first
3479				if($(this).parent().index() == '0' && $('#page-header-bg').length != 0){
3480					$(this).addClass('first-section nder-page-header');
3481
3482				} 
3483				else if($(this).parent().index() == '0' && $('#page-header-bg').length == 0){
3484					$(this).css('margin-top','-40px').addClass('first-section');
3485					if(!$('body').hasClass('single-post')) $('.container-wrap').css('padding-top', '0px');
3486				} 
3487				
3488				//check if it's also last (i.e. the only fws)
3489				if($(this).parent().index() == $contentElementsNum-1 && $('#post-area').length == 0) {
3490					$('#call-to-action .triangle').remove();
3491					$('.container-wrap').hide();
3492				}
3493			}
3494		});
3495	}
3496	
3497	//if not using a fullwidth slider first, ajdust the top padding
3498	//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');
3499	//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');
3500	
3501	
3502	//set sizes
3503	fullWidthSections();
3504	fwsClasses();
3505	
3506	//sizing for fullwidth sections that are image only
3507
3508	function fullwidthImgOnlySizingInit(){
3509		////set inital sizes
3510		$('.full-width-section:not(.custom-skip)').each(function(){
3511			
3512			var $fwsHeight = $(this).outerHeight(true);
3513
3514			//make sure it's empty and also not being used as a small dvider
3515			if($(this).find('.span_12 *').length == 0 && $.trim( $(this).find('.span_12').text() ).length == 0  && $fwsHeight > 40){
3516				$(this).addClass('bg-only');
3517				$(this).css({'height': $fwsHeight, 'padding-top': '0px', 'padding-bottom': '0px'});
3518				$(this).attr('data-image-height',$fwsHeight);
3519			}
3520
3521		});
3522	}
3523
3524	function fullwidthImgOnlySizing(){
3525
3526		$('.full-width-section.bg-only').each(function(){
3527			var $initialHeight = $(this).attr('data-image-height');
3528			
3529			if( window.innerWidth < 1000 && window.innerWidth > 690 ) {
3530				$(this).css('height', $initialHeight - $initialHeight*.60);
3531			} 
3532			
3533			else if( window.innerWidth <= 690 ) {
3534				$(this).css('height', $initialHeight - $initialHeight*.78);
3535			} 
3536			
3537			else if( window.innerWidth < 1300 && window.innerWidth >= 1000  ) {
3538				$(this).css('height', $initialHeight - $initialHeight*.33);
3539			} 
3540			
3541			else {
3542				$(this).css('height', $initialHeight);
3543			}
3544			
3545		});
3546		
3547	}
3548
3549	fullwidthImgOnlySizingInit();
3550	fullwidthImgOnlySizing();
3551	
3552	
3553	
3554	//change % padding on rows to be relative to screen
3555	function fullWidthRowPaddingAdjustInit(){
3556		if($('#boxed').length == 0){
3557			$('.full-width-section, .full-width-content').each(function(){
3558				var $topPadding = $(this)[0].style.paddingTop;
3559				var $bottomPadding = $(this)[0].style.paddingBottom;
3560
3561				if($topPadding.indexOf("%") >= 0) $(this).attr('data-top-percent',$topPadding);
3562				if($bottomPadding.indexOf("%") >= 0) $(this).attr('data-bottom-percent',$bottomPadding);
3563				
3564
3565			});
3566		}
3567	}
3568
3569	function fullWidthRowPaddingAdjustCalc(){
3570		if($('#boxed').length == 0){
3571			$('.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(){
3572
3573				var $windowHeight = $(window).width();
3574				var $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip';
3575				var $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip';
3576
3577				//top
3578				if($topPadding != 'skip') {
3579					$(this).css('padding-top',$windowHeight*(parseInt($topPadding)/100));
3580				}
3581
3582				//bottom
3583				if($bottomPadding != 'skip'){
3584					$(this).css('padding-bottom',$windowHeight*(parseInt($bottomPadding)/100));
3585				}
3586				
3587
3588			});
3589		}
3590	}
3591	fullWidthRowPaddingAdjustInit();
3592	fullWidthRowPaddingAdjustCalc();
3593
3594	
3595	//full width content column sizing
3596	function fullWidthContentColumns(){
3597
3598		//standard carousel
3599   	  	$('.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(){
3600			
3601
3602			//only set the height if more than one column
3603			if($(this).find('> .span_12 > .col').length > 1){
3604				
3605				var tallestColumn = 0;
3606				var $columnInnerHeight = 0;
3607				
3608				$(this).find('> .span_12 > .col').each(function(){
3609
3610					$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
3611					
3612					var $padding = parseInt($(this).css('padding-top'));
3613					//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
3614					($(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height() + ($padding*2) > tallestColumn) ? tallestColumn = $(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height() + ($padding*2)  : tallestColumn = tallestColumn;
3615				});	
3616	    	 	
3617	    	 	$(this).find('> .span_12 > .col').each(function(){
3618
3619	    	 		$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
3620					
3621	    	 		//columns with content
3622		    	 	if($(this).find('> '+$column_inner_selector+' > .wpb_wrapper > *').length > 0){
3623		    	 		$(this).css('height',tallestColumn);
3624		    	 	} 
3625		    	 	//empty columns
3626		    	 	else {
3627		    	 		$(this).css('min-height',tallestColumn);
3628		    	 		if($(this).is('[data-animation*="reveal"]')) $(this).find('.column-inner').css('min-height',tallestColumn);
3629		    	 	}
3630	    	 	});
3631	         	
3632	         	//nested column height
3633	         	var $childRows = $(this).find('> .span_12 > .col .wpb_row').length;
3634	         	if(window.innerWidth > 1000) { 
3635	         		
3636	         		var $padding = parseInt($(this).find('> .span_12 > .col').css('padding-top'));
3637	         		
3638	         		//$(this).find('> .span_12 > .col .wpb_row .col').css('min-height',(tallestColumn-($padding*2))/$childRows + 'px'); 
3639	         	} else {
3640	         		$(this).find('> .span_12 > .col .wpb_row .col').css('min-height','0px'); 
3641	         	}
3642	         	
3643	         	
3644	         	//vertically center
3645	         	if($(this).hasClass('vertically-align-columns') && window.innerWidth > 1000 && !$(this).hasClass('vc_row-o-equal-height')){
3646	         		
3647	         		//parent columns
3648		         	$(this).find('> .span_12 > .col').each(function(){
3649
3650		         		$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
3651						
3652						$columnInnerHeight = $(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height();
3653						var $marginCalc = ($(this).height()/2)-($columnInnerHeight/2);
3654						if($marginCalc <= 0) $marginCalc = 0;
3655						
3656						$(this).find('> '+$column_inner_selector+' > .wpb_wrapper').css('margin-top',$marginCalc);
3657						$(this).find('> '+$column_inner_selector+' > .wpb_wrapper').css('margin-bottom',$marginCalc);
3658						
3659					});	
3660	
3661					
3662				}
3663			
3664			}
3665			
3666   	  	});
3667
3668		//requal height columns in container type with reveal columns
3669		$('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function(){
3670			if($(this).find('>.span_12>.wpb_column[data-animation*="reveal"]').length >0) {
3671				var tallestColumn = 0;
3672				var $columnInnerHeight = 0;
3673				
3674				$(this).find('> .span_12 > .col').each(function(){
3675					
3676					var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top'));
3677					($(this).find('> .column-inner-wrap > .column-inner').height() + ($padding*2) > tallestColumn) ? tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding*2)  : tallestColumn = tallestColumn;
3678				});	
3679	    	 	
3680	    	 	$(this).find('> .span_12 > .col').each(function(){
3681					
3682	    	 		//columns with content
3683		    	 	if($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0){
3684		    	 		$(this).find('> .column-inner-wrap').css('height',tallestColumn);
3685		    	 	} 
3686		    	 	//empty columns
3687		    	 	else {
3688		    	 		$(this).css('min-height',tallestColumn);
3689		    	 		if($(this).is('[data-animation*="reveal"]')) $(this).find('.column-inner').css('min-height',tallestColumn);
3690		    	 	}
3691	    	 	});
3692
3693			}	
3694		});
3695
3696		//using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug)
3697		$('.vc_row.vc_row-o-equal-height>.span_12>.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function(){
3698			$(this).css({ 'padding-top': $(this).css('padding-left'), 'padding-bottom': $(this).css('padding-left')});
3699		});
3700		
3701	}
3702	
3703	fullWidthContentColumns();
3704	if($('.owl-carousel').length > 0) owlCarouselInit();
3705
3706
3707var $mouseParallaxScenes = [];
3708function mouseParallaxInit(){
3709	$('.wpb_row:has(.nectar-parallax-scene)').each(function(i){
3710
3711		if($(this).hasClass('first-section')) { 
3712			$('body #header-outer[data-transparent-header="true"] .ns-loading-cover').show();
3713
3714			if($('body #header-outer[data-transparent-header="true"]').length > 0) { 
3715				$(this).css('overflow','hidden');
3716				$(this).find('.nectar-slider-loading').css({
3717					'top': $('#header-space').height(),
3718					'margin-top' : '-1px'
3719				});
3720				$(this).find('.nectar-slider-loading .loading-icon').css({
3721					'height' :  $('.first-section .nectar-parallax-scene').height() - $('#header-space').height() + 'px',
3722					'opacity' : '1'
3723				});
3724			}
3725		}
3726
3727		var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength'));
3728
3729		$mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({
3730			scalarX: $strength,
3731	  		scalarY: $strength
3732		});
3733
3734		//wait until the images in the scene have loaded
3735		var images = $(this).find('.nectar-parallax-scene li');
3736		
3737		$.each(images, function(){
3738			if($(this).find('div').length > 0) {
3739			    var el = $(this).find('div'),
3740			    image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, '');
3741			    if(image && image !== '' && image !== 'none')
3742			        images = images.add($('<img>').attr('src', image));
3743			}
3744		});
3745
3746		var $that = $(this);
3747		images.imagesLoaded(function(){
3748
3749			$that.find('> .nectar-slider-loading, .full-page-inner > .nectar-slider-loading').fadeOut(800,'easeInOutExpo');
3750			if($that.hasClass('first-section')) { 
3751				$('body #header-outer[data-transparent-header="true"] .ns-loading-cover').fadeOut(800,'easeInOutExpo',function(){
3752    				$(this).remove();
3753    			});
3754			}
3755		});
3756
3757	});
3758}
3759mouseParallaxInit();
3760
3761
3762	
3763/***************** Checkmarks ******************/
3764
3765function ulChecks() {
3766	$('ul.checks li').prepend('<i class="icon-ok-sign"></i>');
3767}
3768ulChecks();
3769
3770/***************** Image with Animation / Col Animation *******************/
3771
3772
3773	
3774function colAndImgAnimations(){
3775
3776	$colAndImgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '85%';
3777	$colAndImgOffsetPos2 = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '70%';
3778
3779	$($fullscreenSelector+'img.img-with-animation').each(function() {
3780		
3781		var $that = $(this);
3782		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
3783		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
3784
3785		var waypoint = new Waypoint({
3786 			element: $that,
3787 			 handler: function(direction) {
3788			   
3789					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
3790						 waypoint.destroy();
3791						return;
3792					}
3793
3794					if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
3795				
3796						if($that.attr('data-animation') == 'fade-in-from-left'){
3797							$that.delay($that.attr('data-delay')).transition({
3798								'opacity' : 1,
3799								'x' : '0px'
3800							},$animationDuration, $animationEasing);
3801						} else if($that.attr('data-animation') == 'fade-in-from-right'){
3802							$that.delay($that.attr('data-delay')).transition({
3803								'opacity' : 1,
3804								'x' : '0px'
3805							},$animationDuration, $animationEasing);
3806						} else if($that.attr('data-animation') == 'fade-in-from-bottom'){
3807							$that.delay($that.attr('data-delay')).transition({
3808								'opacity' : 1,
3809								'y' : '0px'
3810							},$animationDuration, $animationEasing);
3811						} else if($that.attr('data-animation') == 'fade-in') {
3812							$that.delay($that.attr('data-delay')).transition({
3813								'opacity' : 1
3814							},$animationDuration, $animationEasing);	
3815						} else if($that.attr('data-animation') == 'grow-in') {
3816							setTimeout(function(){ 
3817								$that.transition({ scale: 1, 'opacity':1 },$animationDuration,$animationEasing);
3818							},$that.attr('data-delay'));
3819						}
3820						else if($that.attr('data-animation') == 'flip-in') {
3821							setTimeout(function(){ 
3822								$that.transition({  rotateY: 0, 'opacity':1 },$animationDuration, $animationEasing);
3823							},$that.attr('data-delay'));
3824						}
3825
3826						$that.addClass('animated-in');
3827						
3828					}
3829
3830					waypoint.destroy();
3831
3832			  },
3833			  offset: $colAndImgOffsetPos
3834		});
3835
3836		
3837	
3838	});
3839
3840
3841	$($fullscreenSelector+'.nectar_cascading_images').each(function() {
3842		
3843		var $that = $(this);
3844		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
3845		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
3846
3847		var waypoint = new Waypoint({
3848 			element: $that,
3849 			 handler: function(direction) {
3850			   
3851					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
3852						 waypoint.destroy();
3853						return;
3854					}
3855
3856					if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
3857					
3858						$that.find('.cascading-image').each(function(i){
3859
3860							var $that2 = $(this);
3861
3862							if($that2.attr('data-animation') == 'flip-in') {
3863								setTimeout(function(){
3864									$that2.find('.inner-wrap').css({
3865										'opacity' : 1,
3866										'transform' : 'rotate(0deg) translateZ(0px)'
3867									});
3868								}, i*175);
3869							} else {
3870								setTimeout(function(){
3871									$that2.find('.inner-wrap').css({
3872										'opacity' : 1,
3873										'transform' : 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)'
3874									});
3875								}, i*175);
3876							}
3877					
3878
3879						});
3880
3881						$that.addClass('animated-in');
3882						
3883					}
3884
3885					waypoint.destroy();
3886
3887			  },
3888			  offset: $colAndImgOffsetPos
3889		});
3890
3891		
3892	
3893	});
3894	
3895
3896	
3897	$($fullscreenSelector+'.col.has-animation:not([data-animation*="reveal"]), '+$fullscreenSelector+'.wpb_column.has-animation:not([data-animation*="reveal"])').each(function() {
3898	    
3899		var $that = $(this);
3900		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
3901		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
3902
3903		var waypoint = new Waypoint({
3904 			element: $that,
3905 			 handler: function(direction) {
3906				
3907				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
3908					 waypoint.destroy();
3909					return;
3910				}
3911
3912				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
3913				 	
3914					if($that.attr('data-animation') == 'fade-in-from-left'){
3915						$that.delay($that.attr('data-delay')).transition({
3916							'opacity' : 1,
3917							'x' : '0px'
3918						},$animationDuration,$animationEasing);
3919					} else if($that.attr('data-animation') == 'fade-in-from-right'){
3920						$that.delay($that.attr('data-delay')).transition({
3921							'opacity' : 1,
3922							'x' : '0px'
3923						},$animationDuration,$animationEasing);
3924					} else if($that.attr('data-animation') == 'fade-in-from-bottom'){
3925						$that.delay($that.attr('data-delay')).transition({
3926							'opacity' : 1,
3927							'y' : '0px'
3928						},$animationDuration,$animationEasing);
3929					} else if($that.attr('data-animation') == 'fade-in') {
3930						$that.delay($that.attr('data-delay')).transition({
3931							'opacity' : 1
3932						},$animationDuration,$animationEasing);	
3933					} else if($that.attr('data-animation') == 'grow-in') {
3934						setTimeout(function(){ 
3935							$that.transition({ scale: 1, 'opacity':1 },$animationDuration,$animationEasing);
3936						},$that.attr('data-delay'));
3937					} else if($that.attr('data-animation') == 'flip-in') {
3938						setTimeout(function(){ 
3939							$that.transition({  rotateY: 0, 'opacity':1 },$animationDuration, $animationEasing);
3940						},$that.attr('data-delay'));
3941					}
3942
3943					//boxed column hover fix
3944					if($that.hasClass('boxed')) {
3945						$that.addClass('no-pointer-events');
3946						setTimeout(function(){
3947							$that.removeClass('no-pointer-events');
3948						},parseInt($animationDuration) + parseInt($that.attr('data-delay')) + 30 );
3949					}
3950
3951					$that.addClass('animated-in');
3952				
3953				}
3954
3955				waypoint.destroy();
3956			},
3957			offset: $colAndImgOffsetPos
3958		});
3959	
3960	});
3961
3962	
3963	$($fullscreenSelector+'.wpb_column.has-animation[data-animation*="reveal"]').each(function() {
3964	    
3965		var $that = $(this);
3966		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
3967		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
3968
3969		var waypoint = new Waypoint({
3970 			element: $that,
3971 			 handler: function(direction) {
3972				
3973				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
3974					 waypoint.destroy();
3975					return;
3976				}
3977
3978				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
3979					
3980					if($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') {
3981						setTimeout(function(){ 
3982							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'); });
3983						},$that.attr('data-delay'));
3984					} else if($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') {
3985						setTimeout(function(){ 
3986							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'); });
3987						},$that.attr('data-delay'));
3988					} 
3989
3990					$that.addClass('animated-in');
3991				
3992				}
3993
3994				waypoint.destroy();
3995			},
3996			offset: $colAndImgOffsetPos2
3997		});
3998	
3999	}); 	
4000
4001	
4002}
4003
4004setTimeout(function(){ 
4005	//if($('.nectar-box-roll').length == 0) colAndImgAnimations();
4006},$animationOnScrollTimeOut); 	
4007
4008
4009function cascadingImageBGSizing() {
4010	$('.nectar_cascading_images').each(function(){
4011
4012		//handle max width for cascading images in equal height columns
4013		if($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) 
4014			$(this).css('max-width',$(this).parents('.wpb_column').width());
4015
4016		//set size for layers with no images
4017		$(this).find('.bg-color').each(function(){
4018			var $bgColorHeight = 0;
4019			var $bgColorWidth = 0;
4020			if($(this).parent().find('.img-wrap').length == 0) {
4021				$firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first();
4022
4023				$firstSibling.css({'position':'relative', 'visiblity':'hidden'});
4024				$bgColorHeight = $firstSibling.find('.img-wrap').height();
4025				$bgColorWidth = $firstSibling.find('.img-wrap').width();
4026				if($firstSibling.index() == 0) {
4027					$firstSibling.css({'visiblity':'visible'});
4028				} else {
4029					$firstSibling.css({'position':'absolute', 'visiblity':'visible'});
4030				}
4031			} else {
4032				$bgColorHeight = $(this).parent().find('.img-wrap').height();
4033				$bgColorWidth = $(this).parent().find('.img-wrap').width();
4034			}
4035
4036			$(this).css({'height': $bgColorHeight,'width': $bgColorWidth});
4037		});
4038	});
4039}
4040imagesLoaded($('.nectar_cascading_images'),function(instance){
4041	cascadingImageBGSizing();
4042});
4043
4044function splitLineHeadings() {
4045
4046	$splitLineOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
4047	$($fullscreenSelector+'.nectar-split-heading').each(function() {
4048
4049		var $that = $(this);
4050		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
4051		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
4052
4053		var waypoint = new Waypoint({
4054				element: $that,
4055				 handler: function(direction) {
4056				
4057				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
4058					 waypoint.destroy();
4059					return;
4060				}
4061
4062				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
4063				 	
4064					
4065					$that.find('.heading-line').each(function(i){
4066						//if($that.parents('.first-section').length > 0 && $('body[data-aie="zoom-out"]').length > 0) i = i+4;
4067						$(this).find('> span').delay(i*70).transition({
4068							'y' : '0px'
4069						},$animationDuration,$animationEasing);
4070
4071					});
4072					
4073
4074					$that.addClass('animated-in');
4075				
4076				}
4077
4078				waypoint.destroy();
4079			},
4080			offset: $splitLineOffsetPos
4081		});
4082
4083	});
4084}
4085
4086	
4087/***************** 4 Col Grid in iPad ******************/
4088	
4089	//add one-fourth class
4090	function oneFourthClasses() {
4091		$('.col.span_3, .vc_span3, .vc_col-sm-3').each(function(){
4092			var $currentDiv = $(this);
4093			var $nextDiv = $(this).next('div');
4094			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') ) {
4095				$currentDiv.addClass('one-fourths clear-both');
4096				$nextDiv.addClass('one-fourths right-edge');
4097			}
4098		});
4099		
4100		/*$('.vc_span4').each(function(){
4101			if($(this).find('.team-member').length > 0 && $(this).parents('.full-width-content').length > 0) {
4102				var $currentDiv = $(this);
4103				var $nextDiv = $(this).next('div');
4104				if( !$currentDiv.hasClass('one-fourths')) {
4105					$currentDiv.addClass('one-fourths clear-both');
4106					$nextDiv.addClass('one-fourths right-edge');
4107				}
4108			}
4109		});*/
4110		
4111		//make empty second 1/2 half columsn display right on iPad
4112		$('.span_12 .col.span_6').each(function(){
4113			if($(this).next('div').hasClass('span_6') && $.trim( $(this).next('div').html() ).length == 0 ) {
4114				$(this).addClass('empty-second')
4115			}
4116		}); 
4117	}
4118	oneFourthClasses();
4119	
4120/***************** Bar Graph ******************/
4121function progressBars(){
4122	$progressBarsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
4123	$($fullscreenSelector+'.nectar-progress-bar').parent().each(function(i){
4124
4125		var $that = $(this);
4126		var waypoint = new Waypoint({
4127 			element: $that,
4128 			 handler: function(direction) {
4129			   
4130					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4131						 waypoint.destroy();
4132						return;
4133					}
4134
4135					if($progressBarsOffsetPos == '100%') $that.find('.nectar-progress-bar .bar-wrap').css('opacity','1');
4136
4137					$that.find('.nectar-progress-bar').each(function(i){
4138
4139
4140						var percent = $(this).find('span').attr('data-width');
4141						var $endNum = parseInt($(this).find('span strong i').text());
4142						var $that = $(this);
4143						
4144						$that.find('span').delay(i*90).transition({
4145							'width' : percent + '%'
4146						},1050, 'easeInOutQuint',function(){
4147						});
4148						
4149	
4150					
4151						setTimeout(function(){
4152							$that.find('span strong i').countTo({
4153								from: 0,
4154								to: $endNum,
4155								speed: 850,
4156								refreshInterval: 30,
4157								onComplete: function(){
4158						
4159								}
4160							});	
4161
4162							$that.find('span strong').transition({
4163								'opacity' : 1
4164							},550, 'easeInCirc');
4165						}, (i*90) );
4166					
4167						////100% progress bar 
4168						if(percent == '100'){
4169							$that.find('span strong').addClass('full');
4170						}
4171					});
4172
4173					$that.addClass('completed');
4174
4175					waypoint.destroy();
4176
4177			  },
4178			  offset: $progressBarsOffsetPos
4179		});
4180
4181	});
4182}
4183
4184//if($('.nectar-box-roll').length == 0) progressBars();
4185	
4186
4187
4188
4189/***************** Dividers ******************/
4190function dividers() {
4191	$dividerOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
4192
4193	$($fullscreenSelector+'.divider-small-border[data-animate="yes"], '+$fullscreenSelector+'.divider-border[data-animate="yes"]').each(function(i){
4194
4195		var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500;
4196		var $that = $(this);
4197		var waypoint = new Waypoint({
4198 			element: $that,
4199 			 handler: function(direction) {
4200			   
4201					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4202						 waypoint.destroy();
4203						return;
4204					}
4205				
4206					$that.each(function(i){
4207
4208						$(this).css({'transform':'scale(0,1)', 'visibility': 'visible'});
4209						var $that = $(this);
4210						
4211						$that.delay($that.attr('data-animation-delay')).transition({
4212							'transform' : 'scale(1, 1)'
4213						},$lineDur, 'cubic-bezier(.18,1,.22,1)');
4214						
4215					});
4216
4217					$that.addClass('completed');
4218
4219					waypoint.destroy();
4220
4221			  },
4222			  offset: $dividerOffsetPos
4223		});
4224
4225	});
4226}
4227
4228//if($('.nectar-box-roll').length == 0) dividers();
4229
4230
4231/***************** Icon List ******************/
4232function iconList() {
4233	$iconListOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
4234
4235	$($fullscreenSelector+'.nectar-icon-list[data-animate="true"]').each(function(i){
4236
4237		var $that = $(this);
4238		var waypoint = new Waypoint({
4239 			element: $that,
4240 			 handler: function(direction) {
4241			   
4242					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4243						 waypoint.destroy();
4244						return;
4245					}
4246				
4247					$that.each(function(i){
4248
4249						$(this).find('.nectar-icon-list-item').each(function(i){
4250							var $thatt = $(this);
4251							setTimeout(function(){ $thatt.addClass('animated') },i*300);
4252						});
4253						
4254					});
4255
4256					$that.addClass('completed');
4257
4258					waypoint.destroy();
4259
4260			  },
4261			  offset: $iconListOffsetPos
4262		});
4263
4264	});
4265}
4266$('.nectar-icon-list[data-icon-style="border"]').each(function(){
4267	if($(this).parents('.wpb_row').length > 0 && $(this).parents('.wpb_row').find('.row-bg.using-bg-color').length > 0) {
4268		var $bgColorToSet = $(this).parents('.wpb_row').find('.row-bg.using-bg-color').css('background-color');
4269	}
4270	else {
4271		if($('#nectar_fullscreen_rows').length > 0)
4272			var $bgColorToSet = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color');
4273		else 
4274			var $bgColorToSet = $('.container-wrap').css('background-color');
4275	}
4276	$(this).find('.list-icon-holder').css('background-color',$bgColorToSet);
4277});
4278
4279
4280
4281/***************** Hotspot ******************/
4282//add pulse animation
4283$('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function(){
4284	$(this).find('.nectar_hotspot_wrap').each(function(i){
4285		var $that = $(this);
4286		setTimeout(function(){
4287			$that.find('.nectar_hotspot').addClass('pulse');
4288		},i*300);	
4289	});
4290});
4291
4292
4293
4294function hotSpotHoverBind() {
4295
4296	var hotSpotHoverTimeout = [];
4297
4298	$('.nectar_hotspot').each(function(i){
4299		
4300		hotSpotHoverTimeout[i] = '';
4301
4302		$(this).on('mouseover', function(){
4303			clearTimeout(hotSpotHoverTimeout[i]);
4304			$(this).parent().css({'z-index':'10', 'height':'auto','width':'auto'});
4305		});
4306
4307		$(this).on('mouseleave', function(){
4308
4309			var $that = $(this);
4310			$that.parent().css({'z-index':'auto'});
4311
4312			hotSpotHoverTimeout[i] = setTimeout(function(){
4313				$that.parent().css({'height':'30px','width':'30px'});
4314			},300);
4315
4316		});
4317
4318	});
4319
4320}
4321
4322hotSpotHoverBind();
4323
4324function responsiveTooltips() {
4325	$('.nectar_image_with_hotspots').each(function(){
4326		$(this).find('.nectar_hotspot_wrap').each(function(i){
4327			
4328			if($(window).width() > 690) {
4329
4330				//remove click if applicable
4331				if($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) {
4332					$(this).find('.nectar_hotspot').removeClass('click');
4333					$(this).find('.nttip').removeClass('open');
4334				}
4335				$(this).find('.nttip .inner a.tipclose').remove();
4336				$('.nttip').css('height','auto');
4337
4338				//reset for positioning
4339				$(this).css({'width': 'auto','height': 'auto'});
4340				$(this).find('.nttip').removeClass('force-right').removeClass('force-left').removeClass('force-top').css('width','auto');
4341
4342				var $tipOffset = $(this).find('.nttip').offset();
4343
4344				//against right side fix
4345				if($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200)
4346					$(this).find('.nttip').css('width','250px');
4347				else 
4348					$(this).find('.nttip').css('width','auto');
4349
4350				//responsive
4351				if($tipOffset.left < 0)
4352					$(this).find('.nttip').addClass('force-right');
4353				else if($tipOffset.left + $(this).find('.nttip').outerWidth(true) > $(window).width())
4354					$(this).find('.nttip').addClass('force-left').css('width','250px');
4355				else if($tipOffset.top + $(this).find('.nttip').height() + 35 > $(window).height())
4356					$(this).find('.nttip').addClass('force-top');
4357
4358				$(this).css({'width': '30px','height': '30px'});
4359
4360			} else {
4361				//fixed position
4362				$(this).find('.nttip').removeClass('force-left').removeClass('force-right').removeClass('force-top');
4363				$(this).find('.nectar_hotspot').addClass('click');
4364			
4365				if($(this).find('.nttip a.tipclose').length == 0)
4366					$(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span></span></a>');
4367
4368				//change height of fixed
4369				$('.nttip').css('height',$(window).height());
4370			}
4371		});
4372	});
4373
4374
4375}
4376responsiveTooltips();
4377
4378function imageWithHotspotClickEvents() {
4379	//click
4380	$('body').on('click','.nectar_hotspot.click',function(){
4381		$(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
4382		$(this).parent().find('.nttip').addClass('open');
4383
4384		$(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open');
4385		$(this).parent().find('.nectar_hotspot').addClass('open');
4386
4387		if($(window).width() <= 690) $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index','200');
4388
4389		return false;
4390	});
4391
4392	$('body').on('click','.nectar_hotspot.open',function(){
4393		$(this).parent().find('.nttip').removeClass('open');
4394		$(this).parent().find('.nectar_hotspot').removeClass('open');
4395
4396		$(this).parents('.wpb_row').css('z-index','auto');
4397		return false;
4398	});
4399
4400	$('body').on('click','.nttip.open',function(){
4401		$(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
4402
4403		$(this).parents('.wpb_row').css('z-index','auto');
4404		return false;
4405	});
4406}
4407imageWithHotspotClickEvents();
4408
4409function imageWithHotspots() {
4410
4411	$imageWithHotspotsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : '50%';
4412
4413	$($fullscreenSelector+'.nectar_image_with_hotspots[data-animation="true"]').each(function(i){
4414
4415		var $that = $(this);
4416		var waypoint = new Waypoint({
4417 			element: $that,
4418 			 handler: function(direction) {
4419			   
4420					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4421						 waypoint.destroy();
4422						return;
4423					}
4424
4425					$that.addClass('completed');
4426					$that.find('.nectar_hotspot_wrap').each(function(i){
4427						var $that2 = $(this);
4428						var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0;
4429						setTimeout(function(){
4430							$that2.addClass('animated-in');
4431						},175*(i+$extrai));
4432					});
4433
4434					waypoint.destroy();
4435
4436			  },
4437			  offset: $imageWithHotspotsOffsetPos
4438		});
4439
4440	});
4441}
4442
4443
4444/***************** Animated Title ******************/
4445function animated_titles() {
4446	$animatedTitlesOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : 'bottom-in-view';
4447
4448	$($fullscreenSelector+'.nectar-animated-title').each(function(i){
4449
4450		var $that = $(this);
4451		var waypoint = new Waypoint({
4452 			element: $that,
4453 			 handler: function(direction) {
4454			   
4455					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
4456						 waypoint.destroy();
4457						return;
4458					}
4459
4460					$that.addClass('completed');
4461
4462					waypoint.destroy();
4463
4464			  },
4465			  offset: $animatedTitlesOffsetPos
4466		});
4467
4468	});
4469}
4470
4471//if($('.nectar-box-roll').length == 0) animated_titles();
4472
4473
4474/***************** Pricing Tables ******************/
4475
4476
4477var $tallestCol;
4478
4479function pricingTableHeight(){
4480	$('.pricing-table[data-style="default"]').each(function(){
4481		$tallestCol = 0;
4482		
4483		$(this).find('> div ul').each(function(){
4484			($(this).height() > $tallestCol) ? $tallestCol = $(this).height() : $tallestCol = $tallestCol;
4485		});	
4486		
4487		//safety net incase pricing tables height couldn't be determined
4488		if($tallestCol == 0) $tallestCol = 'auto';
4489		
4490		//set even height
4491		$(this).find('> div ul').css('height',$tallestCol);
4492
4493	});
4494}
4495
4496pricingTableHeight();
4497
4498 
4499/***************** Testimonial Slider ******************/
4500
4501//testimonial slider controls
4502$('body').on('click','.testimonial_slider:not([data-style="multiple_visible"]) .controls li', function(){
4503	
4504	if($(this).find('span').hasClass('active')) return false;
4505	
4506	var $index = $(this).index();
4507	var currentHeight = $(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).height();
4508	
4509	$(this).parents('.testimonial_slider').find('li span').removeClass('active');
4510	$(this).find('span').addClass('active');
4511	
4512	$(this).parents('.testimonial_slider').find('.slides blockquote').stop().css({'opacity':'0', 'left':'-25px', 'z-index': '1'});
4513	$(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).stop(true,true).animate({'opacity':'1','left':'0'},550,'easeOutCubic').css('z-index','20');
4514	$(this).parents('.testimonial_slider:not(.disable-height-animation)').find('.slides').stop(true,true).animate({'height' : currentHeight + 40 + 'px' },450,'easeOutCubic');
4515	
4516	resizeVideoToCover();
4517});
4518
4519
4520var $tallestQuote;
4521
4522//create controls
4523function createTestimonialControls() {
4524
4525	//fadeIn
4526	$('.testimonial_slider:not([data-style="multiple_visible"])').animate({'opacity':'1'},800);
4527
4528	$('.testimonial_slider:not([data-style="multiple_visible"])').each(function(){
4529		
4530		if($(this).find('blockquote').length > 1 && $(this).find('.controls').length == 0) {
4531			$(this).append('<div class="controls"><ul></ul></div>');
4532			
4533			var slideNum = $(this).find('blockquote').length;
4534			var $that = $(this);
4535			
4536			for(var i=0;i<slideNum;i++) {
4537				$that.find('.controls ul').append('<li><span class="pagination-switch"></span></li>')
4538			}
4539			
4540			//activate first slide
4541			$(this).find('.controls ul li').first().click();
4542			
4543			//autorotate
4544			if($(this).attr('data-autorotate').length > 0) {
4545				slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
4546				var $that = $(this);
4547				var $rotate = setInterval(function(){ testimonialRotate($that) },slide_interval);
4548			}
4549			
4550			$(this).find('.controls li').click(function(e){
4551				if(typeof e.clientX != 'undefined') clearInterval($rotate);
4552			});
4553			
4554			////swipe for testimonials
4555			$(this).swipe({
4556			
4557				swipeLeft : function(e) {
4558					$(this).find('.controls ul li span.active').parent().next('li').find('span').trigger('click');
4559					e.stopImmediatePropagation();
4560					clearInterval($rotate);
4561					return false;
4562				 },
4563				 swipeRight : function(e) {
4564					$(this).find('.controls ul li span.active').parent().prev('li').find('span').trigger('click');
4565					e.stopImmediatePropagation();
4566					clearInterval($rotate);
4567					return false;
4568				 }    
4569			});
4570		} 
4571		//only one testimonial
4572		else if($(this).find('.controls').length == 0) {
4573			var currentHeight = $(this).find('.slides blockquote').height();
4574			$(this).find('.slides blockquote').stop().css({'opacity':'0', 'left':'-25px', 'z-index': '1'});
4575			$(this).find('.slides blockquote').stop(true,true).transition({'opacity':'1','left':'0'},550,'easeOutCubic').css('z-index','20');
4576			$(this).find('.slides').stop(true,true).animate({'height' : currentHeight + 20 + 'px' },450,'easeOutCubic');
4577		}
4578	});
4579
4580
4581
4582		
4583	$('.testimonial_slider[data-style="multiple_visible"] .slides').each(function(){
4584	    	var $that = $(this); 
4585	    	var $element = $that;
4586	    	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;
4587			if($that.find('img').length == 0) $element = $('body');
4588
4589			//move img pos
4590			$(this).find('blockquote').each(function(){
4591				$(this).find('.image-icon').insertAfter($(this).find('p'));
4592			});
4593			
4594
4595			imagesLoaded($element,function(instance){
4596
4597		    	$that.flickity({
4598		    		  contain: true,
4599					  draggable: true,
4600					  lazyLoad: false,
4601					  imagesLoaded: true,
4602					  percentPosition: true,
4603					  prevNextButtons: false,
4604					  pageDots: true,
4605					  resize: true,
4606					  setGallerySize: true,
4607					  wrapAround: true,
4608					  autoPlay: $autoplay,
4609					  accessibility: false
4610		    	});
4611
4612			    $that.parents('.testimonial_slider').css('opacity','1');
4613			    
4614
4615		     });//images loaded
4616		     	     
4617	    });//each	
4618
4619
4620}
4621createTestimonialControls();
4622
4623function testimonialRotate(slider){
4624	
4625	var $testimonialLength = slider.find('li').length;
4626	var $currentTestimonial = slider.find('.pagination-switch.active').parent().index();
4627	
4628	//stop the rotation when toggles are closed
4629	if( slider.parents('.toggle').length > 0 && slider.parents('.toggle').hasClass('open') ) {
4630
4631		if( $currentTestimonial+1 == $testimonialLength) {
4632			slider.find('ul li:first-child').click();
4633		} else {
4634			slider.find('.pagination-switch.active').parent().next('li').click();
4635		}
4636		
4637	} else {
4638		
4639		if( $currentTestimonial+1 == $testimonialLength) {
4640			slider.find('ul li:first-child').click();
4641		} else {
4642			slider.find('.pagination-switch.active').parent().next('li').click();
4643		}
4644	
4645	}
4646
4647}
4648
4649function testimonialHeightResize(){
4650	$('.testimonial_slider:not(.disable-height-animation):not([data-style="multiple_visible"])').each(function(){
4651		
4652		var $index = $(this).find('.controls ul li span.active').parent().index();
4653		var currentHeight = $(this).find('.slides blockquote').eq($index).height();
4654		$(this).find('.slides').stop(true,true).css({'height' : currentHeight + 40 + 'px' });
4655		
4656	});
4657}
4658
4659
4660function testimonialSliderHeight() {
4661		
4662	$('.testimonial_slider.disable-height-animation:not([data-style="multiple_visible"])').each(function(){
4663		$tallestQuote = 0;
4664			
4665		$(this).find('blockquote').each(function(){
4666			($(this).height() > $tallestQuote) ? $tallestQuote = $(this).height() : $tallestQuote = $tallestQuote;
4667		});	
4668		
4669		//safety net incase height couldn't be determined
4670		if($tallestQuote == 0) $tallestQuote = 100;
4671		
4672		//set even height
4673		$(this).find('.slides').css('height',$tallestQuote+40+'px');
4674		
4675		//show the slider once height is set
4676		$(this).animate({'opacity':'1'});
4677
4678		fullWidthContentColumns();
4679
4680	});
4681
4682}
4683
4684testimonialSliderHeight(); 
4685
4686
4687
4688/***************** WP Media Embed / External Embed ******************/
4689
4690//this isn't the for the video shortcode* This is to help any external iframe embed fit & resize correctly 
4691function responsiveVideoIframesInit(){
4692	$('iframe').each(function(){
4693		
4694		//make sure the iframe has a src (things like adsense don't)
4695		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){
4696			
4697			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) {
4698				$(this).wrap('<div class="iframe-embed"/>');	
4699				
4700				$(this).attr('data-aspectRatio', this.height / this.width).removeAttr('height').removeAttr('width');
4701	
4702				//add wmode=transparent to all youytube embeds to fix z-index issues in IE
4703				if($(this).attr('src').indexOf('wmode=transparent') == -1) {
4704					if($(this).attr('src').indexOf('?') == -1){
4705						$(this).attr('src',$(this).attr('src') + '?wmode=transparent');
4706					} else {
4707						$(this).attr('src',$(this).attr('src') + '&wmode=transparent');
4708					}
4709				}
4710			}
4711			 
4712		} else {
4713			//if($(this).parents('ins').length == 0){ 
4714			//	$(this).wrap('<div class="iframe-embed-standard"/>');	
4715			//}
4716		}
4717		
4718	});
4719
4720
4721}
4722
4723function responsiveVideoIframes(){
4724	 $('iframe[data-aspectRatio]').each(function() {
4725	 	var newWidth = $(this).parent().width();
4726	 	 
4727		var $el = $(this);
4728		
4729		//in nectar slider
4730		if($(this).parents('.swiper-slide').length > 0) {
4731			if($(this).is(':visible')) $el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
4732		} 
4733		//all others
4734		else {
4735			$el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
4736		}
4737		
4738		
4739	});
4740}
4741
4742
4743function videoshortcodeSize(){
4744	$('.wp-video').each(function(){
4745
4746		$(this).attr('data-aspectRatio', parseInt($(this).find('.mejs-overlay').height()) / parseInt($(this).find('.wp-video-shortcode').css('width')));
4747
4748		var newWidth = $(this).width();
4749	 	 
4750		var $el = $(this).find('.wp-video-shortcode');
4751		$(this).width(newWidth).height(newWidth * $(this).attr('data-aspectRatio'));
4752	});
4753}
4754
4755responsiveVideoIframesInit();
4756responsiveVideoIframes();
4757videoshortcodeSize();
4758
4759//unwrap post and protfolio videos
4760$('.video-wrap iframe').unwrap();
4761$('#sidebar iframe[src]').unwrap();
4762
4763$('video:not(.slider-video)').attr('width','100%');
4764$('video:not(.slider-video)').attr('height','100%'); 
4765
4766$('audio').attr('width','100%');
4767$('audio').attr('height','100%');
4768
4769$('audio').css('visibility','visible');
4770
4771if($('body').hasClass('mobile')){
4772	$('video').css('visibility','hidden');
4773} else {
4774	$('video').css('visibility','visible');
4775}
4776
4777
4778$(window).load(function(){
4779	$('video').css('visibility','visible');
4780	showLateIframes();
4781	videoshortcodeSize();
4782});
4783
4784$('.wp-video').each(function(){
4785	 video = $(this).find('video').get(0);
4786	 video.addEventListener('loadeddata', function() {
4787	   videoshortcodeSize();
4788	   $(window).trigger('resize');
4789	 }, false);
4790});
4791
4792//webkit video back button fix 
4793$('.main-content iframe[src]').each(function(){
4794	$(this).attr('src',$(this).attr('src'));
4795	$(this).css({'opacity':'1', 'visibility':'visible'});
4796});
4797
4798showLateIframes();
4799
4800function showLateIframes(){
4801	$('iframe[src]').css('opacity','1');
4802	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 100);
4803	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 500);
4804	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 1000);
4805	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 1500);
4806	setTimeout(function(){ $('iframe[src]').css('opacity','1'); }, 2500);
4807}
4808
4809
4810/***************** Nectar Video BG ******************/
4811
4812
4813	
4814	$('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function(i){
4815		$(this).css('z-index',100 + i);
4816	});
4817
4818	var min_w = 1200; // minimum video width allowed
4819	var vid_w_orig;  // original video dimensions
4820	var vid_h_orig;
4821	
4822    vid_w_orig = 1280;
4823    vid_h_orig = 720;
4824 
4825	function resizeVideoToCover() {
4826		$('.nectar-video-wrap').each(function(i){
4827			
4828			if($(this).parents('#page-header-bg').length > 0) {
4829				if($('.container-wrap.auto-height').length > 0) return false;
4830				var $containerHeight = $(this).parents('#page-header-bg').outerHeight();			
4831				var $containerWidth = $(this).parents('#page-header-bg').outerWidth();
4832			} else {
4833				var $containerHeight = $(this).parents('.wpb_row').outerHeight();			
4834				var $containerWidth = $(this).parents('.wpb_row').outerWidth();
4835			}
4836			
4837		    // set the video viewport to the window size
4838		    $(this).width($containerWidth);
4839		    $(this).height($containerHeight);
4840		
4841		    // use largest scale factor of horizontal/vertical
4842		    var scale_h = $containerWidth / vid_w_orig;
4843		    var scale_v = ($containerHeight - $containerHeight) / vid_h_orig; 
4844		    var scale = scale_h > scale_v ? scale_h : scale_v;
4845			
4846			//update minium width to never allow excess space
4847		    min_w = 1280/720 * ($containerHeight+40);
4848		    
4849		    // don't allow scaled width < minimum video width
4850		    if (scale * vid_w_orig < min_w) {scale = min_w / vid_w_orig;}
4851		        
4852		    // now scale the video
4853		    $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig +0));
4854		    $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig +0));
4855		    
4856		    // and center it by scrolling the video viewport
4857		    $(this).scrollLeft(($(this).find('video').width() - $containerWidth) / 2);
4858		    $(this).scrollTop(($(this).find('video').height() - ($containerHeight)) / 2);
4859		    $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($containerHeight)) / 2);
4860
4861
4862		    //align bottom
4863		    if($(this).attr('data-bg-alignment') == 'center bottom' || $(this).attr('data-bg-alignment') == 'bottom'){
4864		    	$(this).scrollTop(($(this).find('video').height() - ($containerHeight+6)));
4865		    }
4866		    //align top
4867		    else if($(this).attr('data-bg-alignment') == 'center top' || $(this).attr('data-bg-alignment') == 'top') {
4868		    	$(this).scrollTop(0);
4869		    } 
4870
4871		});
4872	}
4873    
4874    //init
4875    function videoBGInit(){
4876	    setTimeout(function(){
4877	    	resizeVideoToCover();
4878	    	$('.video-color-overlay').each(function(){
4879	    		$(this).css('background-color',$(this).attr('data-color'));
4880	    	});
4881	    	$('.nectar-video-wrap').each(function(i){
4882	    		var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false;
4883	    		var $that = $(this);
4884
4885	    		 var videoReady = setInterval(function(){
4886
4887        			if($that.find('video').get(0).readyState > 3) {
4888
4889        				$that.transition({'opacity':'1'},400);
4890		    			$that.find('video').transition({'opacity':'1'},400);
4891		    			$that.parent().find('.video-color-overlay').transition({'opacity':'0.7'},400);
4892
4893		    			if($headerVideo == true) {
4894			    			pageHeaderTextEffect();
4895						}
4896
4897						//remove page loading screen
4898						$('#ajax-loading-screen').addClass('loaded');
4899						setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
4900				
4901
4902						clearInterval(videoReady);
4903					}
4904	    		},60);
4905	    		
4906	    	});
4907	    },300);
4908
4909		if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)){
4910			$('.wpb_row .mobile-video-image, #page-header-wrap .mobile-video-image, .fullscreen-header .mobile-video-image').show();
4911			$('.nectar-video-wrap').remove();
4912		}
4913
4914		
4915		 if(navigator.userAgent.indexOf('Chrome') > 0 && !/Edge\/12./i.test(navigator.userAgent) && !/Edge\/13./i.test(navigator.userAgent)) { 
4916		 	$('.nectar-video-wrap').each(function(i){
4917		 		if(jQuery(this).find('video source[type="video/webm"]').length > 0 ) {
4918				  	var webmSource = jQuery(this).find('video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
4919		          	var firstVideo = jQuery(this).find('video').get(0);
4920		          	firstVideo.src = webmSource;
4921		          	firstVideo.load();
4922		         }
4923            });
4924	    }
4925	}
4926	videoBGInit();
4927
4928
4929/*-------------------------------------------------------------------------*/
4930/*	4.	Header + Search
4931/*-------------------------------------------------------------------------*/	 
4932
4933/***************** Slide Out Widget Area **********/
4934
4935var $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;
4936var $bodyBorderWidth = ($('.body-border-right').length > 0) ? $('.body-border-right').width() : 0;
4937var $resetHeader;
4938
4939//icon effect html creation
4940if($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) {
4941
4942	if($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) {
4943		$('<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');
4944		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');
4945	}
4946
4947	//hover triggered
4948	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/))
4949		$('body').on('mouseenter','#header-outer .slide-out-widget-area-toggle:not(.std-menu) a',openRightHoverNav);
4950	else 
4951		$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a',openRightHoverNav);
4952
4953	$(window).on('smartresize',calculateHoverNavMinHeight);
4954
4955	function calculateHoverNavMinHeight() {
4956		$widgetHeights = 0;
4957		$('#slide-out-widget-area > .widget').each(function(){
4958			$widgetHeights += $(this).height();
4959		});
4960		$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();
4961		$('#slide-out-widget-area .inner').css({'height':'auto', 'min-height': $menuHeight  });
4962
4963		$('#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);
4964	
4965	}
4966
4967	function openRightHoverNav() {
4968
4969		
4970
4971			calculateHoverNavMinHeight();
4972
4973			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && $('.slide-out-widget-area-toggle  .unhidden-line').length > 0) {
4974				mobileCloseNavCheck();
4975				return;
4976			}
4977			
4978
4979			$('#slide-out-widget-area').css({ 'transform': 'translate3d(0,0,0)' }).addClass('open');
4980
4981			//icon effect
4982			$('.slide-out-hover-icon-effect .lines-button').removeClass('no-delay').addClass('unhidden-line');
4983
4984			if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#nectar_fullscreen_rows').length == 0) {
4985
4986				if(!($(window).scrollTop() == 0 && $('#header-outer.transparent').length > 0)) {
4987					$('#header-outer').attr('data-transparent','true').addClass('no-bg-color').addClass('slide-out-hover');
4988					$('#header-outer header').addClass('all-hidden');
4989				}
4990
4991				var headerResize = $('#header-outer').attr('data-header-resize');
4992				if(headerResize == 1) {
4993
4994					$(window).off('scroll',bigNav);
4995					$(window).off('scroll',smallNav);
4996
4997
4998				} else {
4999					
5000					$(window).off('scroll',opaqueCheck);
5001					$(window).off('scroll',transparentCheck);
5002				}
5003			}
5004
5005			if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/))
5006				$(window).on('mousemove.rightOffsetCheck',closeNavCheck);
5007
5008	}
5009
5010	function closeNavCheck(e) {
5011		var $windowWidth = $(window).width();
5012		if(e.clientX < $windowWidth - 340 - $bodyBorderWidth) {
5013
5014				$(window).off('mousemove.rightOffsetCheck',closeNavCheck);
5015
5016				$('#slide-out-widget-area').css({ 'transform': 'translate3d(341px,0,0)' }).removeClass('open');
5017
5018				$('#header-outer').removeClass('style-slide-out-from-right');
5019
5020				$('.slide-out-hover-icon-effect .lines-button').removeClass('unhidden-line').addClass('no-delay');
5021
5022
5023				if($('#header-outer[data-permanent-transparent="1"]').length == 0) {
5024
5025					if(!($(window).scrollTop() == 0 && $('#header-outer.transparent').length > 0)) {
5026						$('#header-outer').removeClass('no-bg-color');
5027						$('#header-outer header').removeClass('all-hidden');
5028					}
5029
5030					var headerResize = $('#header-outer').attr('data-header-resize');
5031					if(headerResize == 1) {
5032					
5033						$(window).off('scroll.headerResizeEffect');
5034						if($(window).scrollTop() == 0) {
5035							$(window).on('scroll.headerResizeEffect',smallNav); 
5036
5037							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) {
5038								$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
5039									'padding' : '0'			
5040								},{queue:false, duration:250, easing: 'easeOutCubic'});	
5041							}
5042						}
5043						else {
5044							$(window).on('scroll.headerResizeEffect',bigNav);
5045						}
5046						
5047			
5048					} else {
5049						
5050						$(window).off('scroll.headerResizeEffectOpaque');
5051						$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
5052					}
5053				}
5054
5055			}
5056
5057	}
5058
5059	function mobileCloseNavCheck(e) {
5060		
5061
5062				$('#slide-out-widget-area').css({ 'transform': 'translate3d(341px,0,0)' }).removeClass('open');
5063
5064				$('#header-outer').removeClass('style-slide-out-from-right');
5065
5066				$('.slide-out-hover-icon-effect .lines-button').removeClass('unhidden-line').addClass('no-delay');
5067
5068				if($('#header-outer[data-permanent-transparent="1"]').length == 0) {
5069
5070					$('#header-outer').removeClass('no-bg-color');
5071					$('#header-outer header').removeClass('all-hidden');
5072
5073				}
5074
5075			
5076
5077	}
5078
5079}
5080
5081
5082//click triggered
5083$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating)',function(){
5084	if(animating == 'true' || $('.slide-out-from-right-hover').length > 0) return false;
5085	var $that = $(this);
5086
5087	//slide out from right
5088	if($('#slide-out-widget-area').hasClass('slide-out-from-right')) {
5089
5090		//calc height if used bottom meta
5091		$('#slide-out-widget-area .inner').css({'height':'auto', 'min-height': $('#slide-out-widget-area').height() - 25 - $('.bottom-meta-wrap').height() });
5092
5093		if($('#boxed').length == 0) {
5094			$('.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');
5095
5096			if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
5097				if($('#header-outer[data-transparency-option="1"]').length == 0) {
5098					$('#header-outer').stop(true).css('transform','translateY(0)').transition({ x: '-300px'},700,'easeInOutCubic');
5099				} else {
5100					$('#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');
5101				}
5102			} else {
5103				$('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').transition({ x: '-300px'},700,'easeInOutCubic');
5104			}
5105
5106			$('#ascrail2000').transition({ 'x': '-300px' },700,'easeInOutCubic');
5107			$('body:not(.ascend) #header-outer .cart-menu').stop(true).transition({ 'x': '300px' },700,'easeInOutCubic');
5108		}
5109
5110		$slideOutAmount = ($('.body-border-top').length > 0 && $('body.mobile').length == 0) ? '-'+$('.body-border-top').height()+'px' : 0;
5111		$('#slide-out-widget-area').stop(true).transition({ x: $slideOutAmount },700,'easeInOutCubic').addClass('open');
5112
5113
5114		if($('#boxed').length == 0) {
5115			//full width menu adjustments
5116			if($('#header-outer[data-full-width="true"]').length > 0 && !$('body').hasClass('mobile')) { 
5117				$('#header-outer').addClass('highzI'); 
5118				$('#ascrail2000').addClass('z-index-adj');
5119
5120				if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
5121					$('header#top #logo').stop(true).transition({ x: '300px' },700,'easeInOutCubic'); 
5122					
5123					$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': $(window).width() - 360, 'left': '300px' },700,'easeInOutCubic');
5124
5125				}
5126
5127				$('header#top .slide-out-widget-area-toggle .lines-button').addClass('close');
5128
5129				if($('#header-outer[data-remove-border="true"]').length > 0) {
5130					$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '64px' },700,'easeInOutCubic');
5131				} else {
5132					$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '89px' },700,'easeInOutCubic'); 
5133				}
5134
5135				$('body #header-outer nav > ul > li > a').css({'margin-bottom':'0'});
5136				
5137			}
5138		}
5139
5140		$('#header-outer').addClass('style-slide-out-from-right');
5141
5142		//fade In BG Overlay
5143		$('#slide-out-widget-area-bg').css({'height':'100%','width':'100%'}).stop(true).transition({
5144			'opacity' : 1
5145		},700,'easeInOutCubic',function(){
5146			$('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating');
5147		});
5148		
5149		//hide menu if no space
5150		if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
5151			$logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width();
5152			if($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) $('#header-outer').addClass('hidden-menu');
5153		} else {
5154			$('#header-outer').addClass('hidden-menu-items');
5155		}
5156
5157		var headerResize = $('#header-outer').attr('data-header-resize');
5158		if($bodyBorderHeaderColorMatch == true && headerResize == 1) {
5159			
5160			$('#header-outer').stop(true).transition({ y: '0' },0).addClass('transparent');
5161			if($('#header-outer').attr('data-transparent-header') != 'true') {
5162				$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
5163			}
5164
5165			$(window).off('scroll',bigNav);
5166			if($('.small-nav').length > 0 || $('#header-outer').hasClass('pseudo-data-transparent')) bigNav();
5167			$(window).off('scroll',smallNav);
5168
5169		} else if ($bodyBorderHeaderColorMatch == true) {
5170			$('#header-outer').addClass('transparent');
5171			$(window).off('scroll',opaqueCheck);
5172			$(window).off('scroll',transparentCheck);
5173		}
5174
5175
5176	}
5177     else if($('#slide-out-widget-area').hasClass('fullscreen')) {
5178
5179		//scroll away from fixed reveal footer if shown (firefox bug with bluring over it)
5180		var $scrollDelay = 0;
5181		var $scrollDelay2 = 0;
5182
5183		if($(window).scrollTop() + $(window).height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) {
5184			$('body,html').stop().animate({
5185				scrollTop: $('.blurred-wrap').height() - $(window).height()
5186			},600,'easeInOutCubic');
5187			$scrollDelay = 550;
5188			$scrollDelay2 = 200;
5189		}
5190
5191		$('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close');
5192		setTimeout(function(){ $('.blurred-wrap').addClass('blurred'); },$scrollDelay);
5193		$('#slide-out-widget-area.fullscreen').show().addClass('open');
5194
5195		hideToTop();
5196
5197		//remove box shadow incase at the top of the page with nectar box roll above
5198		$('.container-wrap').addClass('no-shadow');
5199		$('#header-outer').stop(true).css('transform','translateY(0)');
5200
5201		setTimeout(function(){
5202
5203			$('.off-canvas-menu-container .menu > li').each(function(i){
5204				$(this).delay(i*50).transition({y: 0, 'opacity': 1},800,'easeOutExpo');
5205			});
5206
5207			$('#slide-out-widget-area.fullscreen .widget').each(function(i){
5208				$(this).delay(i*100).transition({y: 0, 'opacity': 1},800,'easeOutExpo');
5209			});
5210		},370+$scrollDelay2);
5211
5212		setTimeout(function(){
5213			$('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
5214
5215			$('#slide-out-widget-area .off-canvas-social-links li').each(function(i){
5216				$(this).delay(i*50).transition({'scale':1},400,'easeOutCubic');
5217			});
5218			$('#slide-out-widget-area .bottom-text').transition({'opacity':0.7},400,'easeOutCubic');
5219		},750+$scrollDelay2);
5220		
5221		//fade In BG Overlay
5222		setTimeout(function(){
5223			$easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint';
5224			$('#slide-out-widget-area-bg').css({'height':'100%','width':'100%'}).show().stop(true).transition({
5225				'y' : '0%'
5226			},920,$easing,function(){
5227				$('.slide-out-widget-area-toggle > div > a').removeClass('animating');
5228			});
5229		},50+$scrollDelay2);
5230
5231		//overflow state 
5232		slideOutWidgetOverflowState();
5233		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').addClass('at-content');
5234		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());
5235	} 
5236
5237	else if($('#slide-out-widget-area').hasClass('fullscreen-alt')) {
5238
5239		$('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close');
5240		$('#slide-out-widget-area.fullscreen-alt').show().addClass('open');
5241		$('#slide-out-widget-area-bg').addClass('open');
5242
5243		$('body > div[class*="body-border"]').css('z-index','9995');
5244
5245		$('.off-canvas-menu-container .menu').transition({y: '0px', 'opacity': 1},0);	
5246
5247		hideToTop();
5248
5249		if($('#header-outer-bg-only').length == 0 ) {
5250			$('body').prepend($('<div id="header-outer-bg-only"/>'));
5251			$('#header-outer-bg-only').css({'height':$('#header-outer').outerHeight(true), 'background-color': $('#header-outer').css('background-color')});	
5252		} 
5253
5254		if($('#header-outer.transparent').length == 0) {
5255
5256			$('#header-outer-bg-only').show();
5257			$('#header-outer-bg-only').css({'height':$('#header-outer').outerHeight(true), 'background-color': $('#header-outer').css('background-color')});
5258
5259			if($('.body-border-top').length > 0) {
5260				//$('.admin-bar #slide-out-widget-area-bg.fullscreen-alt').addClass('no-transition').css({'padding-top': ($('#header-outer').outerHeight(true)+32) + 'px'});
5261				//$('body:not(.admin-bar) #slide-out-widget-area-bg.fullscreen-alt').addClass('no-transition').css({'padding-top': ($('#header-outer').outerHeight(true))+ 'px'});
5262			}
5263		}
5264		else { 
5265
5266			$('#header-outer-bg-only').hide();
5267			if($('.body-border-top').length > 0) {
5268				$('.admin-bar #slide-out-widget-area-bg.fullscreen-alt').addClass('no-transition').css({'padding-top': ($('.body-border-top').outerHeight(true)+32) + 'px'});
5269				$('body:not(.admin-bar) #slide-out-widget-area-bg.fullscreen-alt').addClass('no-transition').css({'padding-top': ($('.body-border-top').outerHeight(true))+ 'px'});
5270			}
5271		}
5272
5273		if($('#logo .starting-logo').length > 0 && $(window).width() > 1000) {
5274			
5275			$('#header-outer').addClass('no-transition').addClass('no-bg-color');
5276			
5277			$('#header-outer').stop(true).css('transform','translateY(0)').addClass('transparent');
5278			if($('#header-outer').attr('data-transparent-header') != 'true') {
5279				$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
5280			}
5281		}
5282
5283		$('.off-canvas-menu-container .clip-wrap').css('transition-duration','0s');
5284
5285		setTimeout(function(){
5286
5287			$('.off-canvas-menu-container .menu > li').each(function(i){
5288				$(this).delay(i*50).transition({y: 0, 'opacity': 1},750,'easeOutCubic').addClass('no-pointer-events');
5289			});
5290
5291			setTimeout(function(){
5292				$('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
5293				$('.off-canvas-menu-container .clip-wrap').css('transition-duration','.45s');
5294			},500);
5295			
5296		
5297
5298			$('#slide-out-widget-area.fullscreen-alt .widget').each(function(i){
5299				$(this).delay(i*100).transition({y: 0, 'opacity': 1},650,'easeOutCubic');
5300			});
5301		},200);
5302
5303		setTimeout(function(){
5304			$('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
5305
5306			$('#slide-out-widget-area .off-canvas-social-links li').css('opacity','1').each(function(i){
5307				$(this).delay(i*50).transition({'scale':1},400,'easeOutCubic');
5308			});
5309			$('#slide-out-widget-area .bottom-text').transition({'opacity':1},600,'easeOutCubic');
5310		},200);
5311		
5312		//fade In BG Overlay
5313		if($('#slide-out-widget-area-bg').hasClass('solid')) $opacity = 1;
5314		if($('#slide-out-widget-area-bg').hasClass('dark')) $opacity = 0.97;
5315		if($('#slide-out-widget-area-bg').hasClass('medium')) $opacity = 0.6;
5316		if($('#slide-out-widget-area-bg').hasClass('light')) $opacity = 0.4;
5317		$('#slide-out-widget-area-bg').removeClass('no-transition');
5318		setTimeout(function(){
5319			$('#slide-out-widget-area-bg').addClass('padding-removed').css({'height':'100%','width':'100%', 'left':'0','opacity': $opacity});
5320		},50);
5321
5322		setTimeout(function(){
5323			$('.slide-out-widget-area-toggle > div > a').removeClass('animating');
5324		},600);
5325			
5326		
5327
5328		//overflow state 
5329		slideOutWidgetOverflowState();
5330		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').addClass('at-content');
5331		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());
5332	}
5333
5334
5335
5336	
5337		
5338
5339	//add open class
5340	$('#header-outer').removeClass('side-widget-closed').addClass('side-widget-open');
5341
5342	//give header transparent state
5343	if($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0 && $('#header-outer[data-full-width="true"]').length > 0) {
5344		$('#header-outer').addClass('transparent');
5345	}
5346
5347	//dark slide transparent nav
5348	if($('#header-outer.dark-slide.transparent').length > 0  && $('#boxed').length == 0) $('#header-outer').removeClass('dark-slide').addClass('temp-removed-dark-slide');
5349	
5350	$('.slide-out-widget-area-toggle > div > a').removeClass('closed').addClass('open');
5351	$('.slide-out-widget-area-toggle > div > a').addClass('animating');
5352
5353	return false;
5354});
5355
5356$('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(){
5357	
5358	if($('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) return;
5359
5360	var $that = $(this);
5361
5362	$('.slide-out-widget-area-toggle:not(.std-menu) a').removeClass('open').addClass('closed');
5363	$('.slide-out-widget-area-toggle:not(.std-menu) a').addClass('animating');
5364
5365	//slide out from right
5366	if($('#slide-out-widget-area').hasClass('slide-out-from-right')) {
5367
5368		$('.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');
5369
5370		if($('#header-outer[data-transparency-option="1"]').length > 0  && $('#boxed').length == 0) {
5371			$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');
5372			$('#header-outer').stop(true).transition({ x: '0px', 'background-color': $currentRowBG },700,'easeInOutCubic');
5373		} else {
5374			$('#header-outer').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
5375		}
5376
5377		$('#ascrail2000').stop(true).transition({ 'x': '0px' },700,'easeInOutCubic');
5378		$('body:not(.ascend) #header-outer .cart-menu').stop(true).transition({ 'x': '0px' },700,'easeInOutCubic');
5379
5380		$('#slide-out-widget-area').stop(true).transition({ x: '301px' },700,'easeInOutCubic').removeClass('open');
5381
5382
5383		if($('#boxed').length == 0) {
5384			if($('#header-outer[data-full-width="true"]').length > 0) {  
5385				$('#header-outer').removeClass('highzI'); 
5386				$('header#top #logo').stop(true).transition({ x: '0px' },700,'easeInOutCubic'); 
5387				$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': '100%', 'left': '0' },700,'easeInOutCubic');
5388				$('.lines-button').removeClass('close');
5389
5390				$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
5391
5392			}
5393		}
5394
5395		if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) {
5396			$('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({ x: '0px' },700,'easeInOutCubic'); 
5397		}
5398
5399		//fade out overlay
5400		$('#slide-out-widget-area-bg').stop(true).transition({
5401			'opacity' : 0
5402		},700,'easeInOutCubic',function(){
5403			$('.slide-out-widget-area-toggle a').removeClass('animating');
5404			$(this).css({'height':'1px','width':'1px'});
5405
5406			//hide menu if transparent, user has scrolled down and hhun is on
5407			if($('#header-outer').hasClass('parallax-contained') && $(window).scrollTop() > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) {
5408				$('#header-outer').removeClass('parallax-contained').addClass('detached').removeClass('transparent');
5409			}
5410			else if($(window).scrollTop() == 0 && $('body[data-hhun="1"]').length >
5410 0 && $('#page-header-bg[data-parallax="1"]').length > 0 ||
5411				$(window).scrollTop() == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) {
5412
5413				if($('#header-outer[data-transparency-option="1"]').length > 0) $('#header-outer').addClass('transparent');
5414				$('#header-outer').addClass('parallax-contained').removeClass('detached');
5415			}
5416
5417			//fix for fixed subpage menu
5418			$('.container-wrap').css('transform','none');
5419		});
5420
5421
5422		$('#header-outer').removeClass('style-slide-out-from-right');
5423
5424
5425		var headerResize = $('#header-outer').attr('data-header-resize');
5426		if($bodyBorderHeaderColorMatch == true && headerResize == 1) {
5427		
5428			$(window).off('scroll.headerResizeEffect');
5429			if($(window).scrollTop() == 0) {
5430				$(window).on('scroll.headerResizeEffect',smallNav); 
5431
5432				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) {
5433					$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
5434						'padding' : '0'			
5435					},{queue:false, duration:250, easing: 'easeOutCubic'});	
5436				}
5437			}
5438			else
5439				smallNav();
5440
5441			if($('#header-outer').hasClass('pseudo-data-transparent')) {
5442				$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
5443			}
5444
5445		} else if ($bodyBorderHeaderColorMatch == true) {
5446			
5447			$(window).off('scroll.headerResizeEffectOpaque');
5448			$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
5449		}
5450
5451
5452
5453	} 
5454
5455	else if($('#slide-out-widget-area').hasClass('fullscreen')) {
5456
5457
5458		$('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close');
5459		//$('.slide-out-widget-area-toggle a').removeClass('animating');
5460		$('.blurred-wrap').removeClass('blurred');
5461		$('#slide-out-widget-area.fullscreen').transition({'opacity': 0 },700,'easeOutQuad',function(){ $('#slide-out-widget-area.fullscreen').hide().css('opacity','1'); }).removeClass('open');
5462		$('#slide-out-widget-area.fullscreen .widget').transition({'opacity': 0},700,'easeOutQuad',function(){
5463			$(this).transition({y: '110px'},0);
5464		});
5465
5466		setTimeout(function(){
5467			$('.off-canvas-menu-container .menu > li').transition({y: '80px', 'opacity': 0},0);		
5468			$('#slide-out-widget-area .off-canvas-social-links li').transition({'scale':0},0);
5469			$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
5470			$('#slide-out-widget-area .bottom-text').transition({'opacity':0},0);	
5471
5472			//close submenu items
5473			$('#slide-out-widget-area .menuwrapper .menu').removeClass( 'subview' );
5474			$('#slide-out-widget-area .menuwrapper .menu li').removeClass( 'subview subviewopen' );
5475			$('#slide-out-widget-area.fullscreen .inner .off-canvas-menu-container').css('height','auto');
5476		},800);
5477
5478		setTimeout(function(){
5479			showToTop();
5480			$('.container-wrap').removeClass('no-shadow');
5481		},500);
5482
5483		//fade out overlay
5484		$('#slide-out-widget-area-bg').stop(true).transition({'opacity': 0},900,'easeOutQuad',function(){
5485			if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').removeClass('at-content');
5486			if($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', '0');
5487			$('.slide-out-widget-area-toggle a').removeClass('animating');
5488			if($('#slide-out-widget-area-bg').hasClass('solid')) $opacity = 1;
5489			if($('#slide-out-widget-area-bg').hasClass('dark')) $opacity = 0.93;
5490			if($('#slide-out-widget-area-bg').hasClass('medium')) $opacity = 0.6;
5491			if($('#slide-out-widget-area-bg').hasClass('light')) $opacity = 0.4;
5492			$(this).css({'height':'1px','width':'1px', 'opacity': $opacity}).transition({ y : '-100%'},0);
5493		});
5494
5495		
5496	}
5497
5498	else if($('#slide-out-widget-area').hasClass('fullscreen-alt')) {
5499
5500		$('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close');
5501		//$('.slide-out-widget-area-toggle a').removeClass('animating');
5502		$('.blurred-wrap').removeClass('blurred');
5503		$('#slide-out-widget-area-bg').removeClass('open');
5504		
5505		$('#slide-out-widget-area.fullscreen-alt .widget').transition({'opacity': 0},500,'easeOutQuad',function(){
5506			$(this).transition({y: '40px'},0);
5507		});
5508		$('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({'opacity': 0},250,'easeOutQuad');
5509		$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
5510
5511		$('.off-canvas-menu-container .menu').transition({y: '-13px', 'opacity': 0},400);	
5512
5513
5514		setTimeout(function(){
5515			$('.off-canvas-menu-container .menu > li').stop(true,true).transition({y: '40px', 'opacity': 0},0);		
5516			$('#slide-out-widget-area .off-canvas-social-links li').transition({'scale':0},0);
5517			$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');	
5518
5519			//close submenu items
5520			$('#slide-out-widget-area .menuwrapper .menu').removeClass( 'subview' );
5521			$('#slide-out-widget-area .menuwrapper .menu li').removeClass( 'subview subviewopen' );
5522			$('#slide-out-widget-area.fullscreen-alt .inner .off-canvas-menu-container').css('height','auto');
5523
5524			if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').removeClass('at-content');
5525			if($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) $('#slide-out-widget-area.fullscreen-alt .inner-wrap').css('padding-top', '0');
5526			$('.slide-out-widget-area-toggle a').removeClass('animating');
5527			$('#slide-out-widget-area-bg').css({'height':'1px','width':'1px','left':'-100%'});
5528			$('#slide-out-widget-area.fullscreen-alt').hide().removeClass('open');
5529		},550);
5530
5531		setTimeout(function(){
5532			showToTop();
5533		},600);
5534
5535		//fade out overlay
5536		setTimeout(function(){
5537			$('#slide-out-widget-area-bg').removeClass('padding-removed');
5538		},50);	
5539
5540		
5541		var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 250: 50;
5542
5543		setTimeout(function(){
5544			$('#slide-out-widget-area-bg').stop(true).css({'opacity': 0});
5545			$('body > div[class*="body-border"]').css('z-index','10000');
5546		},borderDelay);
5547
5548		setTimeout(function(){
5549			$('#header-outer.transparent.small-nav, #header-outer.transparent.detached, #header-outer.transparent.scrolled-down').removeClass('transparent');
5550			
5551			if($('#header-outer').hasClass('pseudo-data-transparent')) {
5552				$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
5553			}
5554
5555			
5556				setTimeout(function(){
5557					$('#header-outer').removeClass('no-bg-color');
5558					$('#header-outer-bg-only').hide();
5559					setTimeout(function(){
5560						$('#header-outer').removeClass('no-transition');
5561					},50);
5562				},250);
5563			
5564
5565		},100);
5566		
5567	}
5568
5569
5570	
5571
5572	//dark slide transparent nav
5573	if($('#header-outer.temp-removed-dark-slide.transparent').length > 0  && $('#boxed').length == 0) $('#header-outer').removeClass('temp-removed-dark-slide').addClass('dark-slide');
5574
5575	//remove header transparent state
5576
5577	if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) {
5578
5579		if($('.nectar-box-roll').length == 0) {
5580			if($('#header-outer.small-nav').length > 0 || $('#header-outer.scrolled-down').length > 0 || $('#header-outer.detached').length > 0) $('#header-outer').removeClass('transparent');
5581		} else {
5582			if($('#header-outer.small-nav').length > 0 || $('#header-outer.scrolled-down').length > 0 || $('.container-wrap.auto-height').length > 0) $('#header-outer').removeClass('transparent');
5583		}
5584	} 
5585
5586
5587
5588	//remove hidden menu
5589	$('#header-outer').removeClass('hidden-menu');
5590
5591	$('#header-outer').removeClass('side-widget-open').addClass('side-widget-closed');
5592
5593	return false;
5594});
5595
5596function slideOutWidgetOverflowState() {
5597
5598
5599	//switch position of social media/extra info based on screen size
5600	if(window.innerWidth < 1000 || $('body > #boxed').length > 0) {
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');
5602		$('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner');
5603	} else {
5604		$('#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');
5605		$('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap');
5606	}
5607
5608	//add overflow
5609	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'); }
5610	else { $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').removeClass('overflow-state'); }
5611
5612	$('#slide-out-widget-area[class*="fullscreen"] .inner').transition({ y : '-' + ($('#slide-out-widget-area[class*="fullscreen"] .inner').height()/2) + 'px' },0);
5613
5614	//close mobile only slide out widget area if switching back to desktop
5615	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');
5616
5617}
5618
5619
5620function fullWidthHeaderSlidingWidgetMenuCalc() {
5621	$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': $(window).width() - 360, 'left': '300px' },700,'easeInOutCubic');
5622}
5623
5624//slide out widget area scrolling 
5625function slideOutWidgetAreaScrolling(){ 
5626	$('#slide-out-widget-area').mousewheel(function(event, delta) {
5627
5628	     this.scrollTop -= (delta * 30);
5629	    
5630	     event.preventDefault();
5631
5632	});
5633}
5634slideOutWidgetAreaScrolling();
5635
5636
5637//handle mobile scrolling
5638if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
5639	$('#slide-out-widget-area').addClass('mobile');
5640}
5641
5642
5643function closeOCM(item) {
5644    if($('#slide-out-widget-area.open').length > 0) {
5645
5646    	var $windowCurrentLocation = window.location.href.split("#")[0];
5647		var $windowClickedLocation = item.find('> a').attr('href').split("#")[0];
5648
5649    	if($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) 
5650        $('.slide-out-widget-area-toggle a').trigger('click');
5651    }
5652}
5653
5654
5655
5656//fullscreen submenu
5657
5658
5659/**
5660 * jquery.dlmenu.js v1.0.1
5661 * http://www.codrops.com
5662 *
5663 * Licensed under the MIT license.
5664 * http://www.opensource.org/licenses/mit-license.php
5665 * 
5666 * Copyright 2013, Codrops
5667 * http://www.codrops.com
5668 */
5669;( function( $, window, undefined ) {
5670
5671	'use strict';
5672
5673	// global
5674	var Modernizr = window.Modernizr, $body = $( 'body' );
5675
5676	$.DLMenu = function( options, element ) {
5677		this.$el = $( element );
5678		this._init( options );
5679	};
5680
5681	// the options
5682	$.DLMenu.defaults = {
5683		// classes for the animation effects
5684		animationClasses : { classin : 'dl-animate-in-1', classout : 'dl-animate-out-1' },
5685		// callback: click a link that has a sub menu
5686		// el is the link element (li); name is the level name
5687		onLevelClick : function( el, name ) { return false; },
5688		// callback: click a link that does not have a sub menu
5689		// el is the link element (li); ev is the event obj
5690		onLinkClick : function( el, ev ) { return false; }
5691	};
5692
5693	$.DLMenu.prototype = {
5694		_init : function( options ) {
5695
5696			// options
5697			this.options = $.extend( true, {}, $.DLMenu.defaults, options );
5698			// cache some elements and initialize some variables
5699			this._config();
5700			
5701			var animEndEventNames = {
5702					'WebkitAnimation' : 'webkitAnimationEnd',
5703					'OAnimation' : 'oAnimationEnd',
5704					'msAnimation' : 'MSAnimationEnd',
5705					'animation' : 'animationend'
5706				},
5707				transEndEventNames = {
5708					'WebkitTransition' : 'webkitTransitionEnd',
5709					'MozTransition' : 'transitionend',
5710					'OTransition' : 'oTransitionEnd',
5711					'msTransition' : 'MSTransitionEnd',
5712					'transition' : 'transitionend'
5713				};
5714			// animation end event name
5715			this.animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' ) ] + '.menu';
5716			// transition end event name
5717			this.transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ] + '.menu',
5718			// support for css animations and css transitions
5719			this.supportAnimations = Modernizr.cssanimations,
5720			this.supportTransitions = Modernizr.csstransitions;
5721
5722			this._initEvents();
5723
5724		},
5725		_config : function() {
5726			this.open = false;
5727			this.$trigger = this.$el.children( '.trigger' );
5728			this.$menu = this.$el.children( 'ul.menu' );
5729			this.$menuitems = this.$menu.find( 'li:not(.back) > a' );
5730			this.$el.find( 'ul.sub-menu' ).prepend( '<li class="back"><a href="#"> '+$('#slide-out-widget-area').attr('data-back-txt')+' </a></li>' );
5731			this.$back = this.$menu.find( 'li.back' );
5732		},
5733		_initEvents : function() {
5734
5735			var self = this;
5736
5737			this.$trigger.on( 'click.menu', function() {
5738				
5739				if( self.open ) {
5740					self._closeMenu();
5741				} 
5742				else {
5743					self._openMenu();
5744				}
5745				return false;
5746
5747			} );
5748			
5749			this.$menuitems.on( 'click.menu', function( event ) {
5750				
5751				//event.stopPropagation();
5752
5753				var $item = $(this).parent('li'),
5754					$submenu = $item.children( 'ul.sub-menu' );
5755
5756				$('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration','0s');	
5757	
5758				//exit if clicking on background LI (avoids effect wrongly triggering)
5759				//if( $item.find('> a').length > 0 && $item.find('> a').css('display') === 'none') return false;
5760			
5761				if( $submenu.length > 0 ) {
5762
5763					var $flyin = $submenu.clone().css( 'opacity', 0 ).insertAfter( self.$menu ),
5764						onAnimationEndFn = function() {
5765							self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classout ).addClass( 'subview' );
5766							$item.addClass( 'subviewopen' ).parents( '.subviewopen:first' ).removeClass( 'subviewopen' ).addClass( 'subview' );
5767							$flyin.remove();
5768							setTimeout(function(){
5769								$('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
5770								$('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration','.45s');
5771							},300);
5772							
5773			
5774						};
5775
5776					setTimeout( function() {
5777						$flyin.addClass( self.options.animationClasses.classin );
5778						self.$menu.addClass( self.options.animationClasses.classout );
5779						if( self.supportAnimations ) {
5780							self.$menu.on( self.animEndEventName, onAnimationEndFn );
5781						}
5782						else {
5783							onAnimationEndFn.call();
5784						}
5785
5786						self.options.onLevelClick( $item, $item.children( 'a:first' ).text() );
5787					} );
5788
5789
5790					//adjust height for mobile / widgets below
5791					$item.parents('.off-canvas-menu-container').css('height',$item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({ 'height': $flyin.height() },500,'easeInOutQuad' );
5792
5793
5794					return false;
5795
5796				}
5797				else {
5798		
5799					self.options.onLinkClick( $item.find('> a'), event );
5800				}
5801
5802				closeOCM($item);
5803
5804			});
5805
5806			
5807
5808
5809			this.$back.on( 'click.menu', function( event ) {
5810				
5811				var $this = $( this ),
5812					$submenu = $this.parents( 'ul.sub-menu:first' ),
5813					$item = $submenu.parent(),
5814
5815					$flyin = $submenu.clone().insertAfter( self.$menu );
5816
5817				var onAnimationEndFn = function() {
5818					self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classin );
5819					$flyin.remove();
5820				};
5821
5822				setTimeout( function() {
5823					$flyin.addClass( self.options.animationClasses.classout );
5824					self.$menu.addClass( self.options.animationClasses.classin );
5825					if( self.supportAnimations ) {
5826						self.$menu.on( self.animEndEventName, onAnimationEndFn );
5827					}
5828					else {
5829						onAnimationEndFn.call();
5830					}
5831
5832					$item.removeClass( 'subviewopen' );
5833					
5834					var $subview = $this.parents( '.subview:first' );
5835					if( $subview.is( 'li' ) ) {
5836						$subview.addClass( 'subviewopen' );
5837					}
5838					$subview.removeClass( 'subview' );
5839				} );
5840
5841		
5842				//adjust height for mobile / widgets below
5843				$item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height())
5844				setTimeout(function() { 
5845					$item.parents('.off-canvas-menu-container').transition({ 'height': $item.parent().height() },500,'easeInOutQuad');
5846				},50);
5847
5848
5849				return false;
5850
5851			} );
5852			
5853		},
5854		closeMenu : function() {
5855			if( this.open ) {
5856				this._closeMenu();
5857			}
5858		},
5859		_closeMenu : function() {
5860			var self = this,
5861				onTransitionEndFn = function() {
5862					self.$menu.off( self.transEndEventName );
5863					self._resetMenu();
5864				};
5865			
5866			this.$menu.removeClass( 'menuopen' );
5867			this.$menu.addClass( 'menu-toggle' );
5868			this.$trigger.removeClass( 'active' );
5869			
5870			if( this.supportTransitions ) {
5871				this.$menu.on( this.transEndEventName, onTransitionEndFn );
5872			}
5873			else {
5874				onTransitionEndFn.call();
5875			}
5876
5877			this.open = false;
5878		},
5879		openMenu : function() {
5880			if( !this.open ) {
5881				this._openMenu();
5882			}
5883		},
5884		_openMenu : function() {
5885			var self = this;
5886			// clicking somewhere else makes the menu close
5887			$body.off( 'click' ).on( 'click.menu', function() {
5888				self._closeMenu() ;
5889			} );
5890			this.$menu.addClass( 'menuopen menu-toggle' ).on( this.transEndEventName, function() {
5891				$( this ).removeClass( 'menu-toggle' );
5892			} );
5893			this.$trigger.addClass( 'active' );
5894			this.open = true;
5895		},
5896		// resets the menu to its original state (first level of options)
5897		_resetMenu : function() {
5898			this.$menu.removeClass( 'subview' );
5899			this.$menuitems.removeClass( 'subview subviewopen' );
5900		}
5901	};
5902
5903	var logError = function( message ) {
5904		if ( window.console ) {
5905			window.console.error( message );
5906		}
5907	};
5908
5909	$.fn.dlmenu = function( options ) {
5910		if ( typeof options === 'string' ) {
5911			var args = Array.prototype.slice.call( arguments, 1 );
5912			this.each(function() {
5913				var instance = $.data( this, 'menu' );
5914				if ( !instance ) {
5915					logError( "cannot call methods on menu prior to initialization; " +
5916					"attempted to call method '" + options + "'" );
5917					return;
5918				}
5919				if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
5920					logError( "no such method '" + options + "' for menu instance" );
5921					return;
5922				}
5923				instance[ options ].apply( instance, args );
5924			});
5925		} 
5926		else {
5927			this.each(function() {	
5928				var instance = $.data( this, 'menu' );
5929				if ( instance ) {
5930					instance._init();
5931				}
5932				else {
5933					instance = $.data( this, 'menu', new $.DLMenu( options, this ) );
5934				}
5935			});
5936		}
5937		return this;
5938	};
5939
5940} )( jQuery, window );
5941
5942function fullscreenMenuInit() {
5943	$('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />');
5944	$('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen');
5945	$ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0) ? '4' : '5';
5946	$('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({ animationClasses : { classin : 'dl-animate-in-'+$ocmAnimationClassNum, classout : 'dl-animate-out-'+$ocmAnimationClassNum } });
5947
5948	//add fullscreen alt text effect 
5949	$('#slide-out-widget-area.fullscreen-alt .menu li, #slide-out-widget-area.slide-out-from-right-hover .menu li').each(function(){
5950
5951		var $menuItemText = $(this).find('> a').html();
5952		$(this).find('> a ').html($menuItemText.replace(/ /g, "&nbsp;"));
5953		$(this).find('> a').append('<span class="clip-wrap"><span>'+$(this).find('> a').text()+'</span></span>');
5954	});
5955
5956
5957	$('body').on('mouseover','#slide-out-widget-area.fullscreen-alt .menu li a',function(){
5958		var $that = $(this);
5959
5960		$(this).find('> .clip-wrap').css({'transition-duration': '0s' });
5961		$(this).find('> .clip-wrap span ').css({'transition-duration': '0s' });
5962
5963	
5964			$that.find('> .clip-wrap').css({'width':'0%', 'transform':'translateX(0%)' });
5965			$that.find('> .clip-wrap span').css({'transform':'translateX(0%)' });
5966		
5967		
5968
5969		setTimeout(function(){
5970
5971			$that.find('> .clip-wrap').css({'transition-duration': '0.45s' });
5972
5973			$that.find('> .clip-wrap').css({'width':'100%', 'left': '0', 'right': 'auto' });
5974			//$that.find('> .clip-wrap span').css({'transform':'translateX(0%)'});
5975		},50);
5976		
5977		
5978	});
5979	$('body').on('mouseleave','#slide-out-widget-area.fullscreen-alt .menu li a',function(){
5980
5981
5982
5983
5984		var $that = $(this);
5985
5986		$(this).find('> .clip-wrap').css({'transition-duration': '0s' });
5987		$(this).find('> .clip-wrap span ').css({'transition-duration': '0s' });
5988
5989		
5990		$that.find('> .clip-wrap').css({'width':'100%', 'transform':'translateX(0%)' });
5991		$that.find('> .clip-wrap span').css({'transform':'translateX(0%)' });
5992
5993
5994		$that.find('> .clip-wrap').css({'transition-duration': '0.45s' });
5995		$that.find('> .clip-wrap span').css({'transition-duration': '0.45s' });
5996
5997		$that.find('> .clip-wrap').css({'transform':'translateX(100%)'});
5998		$that.find('> .clip-wrap span').css({'transform':'translateX(-100%)'});
5999		
6000
6001	});
6002}
6003fullscreenMenuInit();
6004
6005//submenu link hover fix
6006$('body').on('mouseover','#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a',function(){
6007	var $currentTxt = $(this).text();
6008	$('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
6009	$('.off-canvas-menu-container .menuwrapper .menu li > a:contains('+$currentTxt+')').addClass('hovered');
6010});
6011$('body').on('mouseover','.off-canvas-menu-container .menuwrapper .menu li > a',function(){
6012	$('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
6013});
6014
6015
6016
6017/***************** Page Headers ******************/
6018
6019var pageHeaderHeight;
6020var pageHeaderHeightCopy;
6021var pageHeadingHeight;
6022var extraSpaceFromResize = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.nectar-box-roll').length == 0) ? 51 : 1;
6023//full screen header
6024function fullScreenHeaderInit(){
6025
6026	pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
6027	pageHeaderHeightCopy = parseInt($('#page-header-bg').attr('data-height'));
6028
6029	if($('.fullscreen-header').length > 0) {
6030
6031		if($('#header-outer[data-transparency-option]').length > 0 && $('#header-outer').attr('data-transparency-option') != '0'){
6032			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() : $(window).height() - parseInt($('#header-outer').height()) ;
6033		} else {
6034			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() - parseInt($('#header-space').height()) + extraSpaceFromResize : $(window).height() - parseInt($('#header-outer').height()) ;
6035		}
6036		var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
6037		if($('.nectar-box-roll').length > 0) extraHeight = 0;
6038		pageHeaderHeight =   calculatedNum  - extraHeight; 
6039		pageHeaderHeightCopy = calculatedNum - extraHeight; 
6040	}
6041
6042	$('#page-header-bg').css('height',pageHeaderHeight+'px').removeClass('not-loaded');
6043	setTimeout(function(){ $('#page-header-bg').css('overflow','visible') },800);
6044
6045}
6046
6047fullScreenHeaderInit();
6048
6049function pageHeader(){
6050	
6051	//add loaded class
6052	$('#page-header-bg[data-animate-in-effect="zoom-out"]').addClass('loaded');
6053
6054	var $scrollTop = $(window).scrollTop();
6055
6056	//full screen header
6057	if($('.fullscreen-header').length > 0) {
6058		if($('#header-outer[data-transparency-option]').length > 0 && $('#header-outer').attr('data-transparency-option') != '0'){
6059			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() : $(window).height() - parseInt($('#header-outer').height()) ;
6060			if($('body[data-permanent-transparent="1"]').length > 0) calculatedNum = $(window).height();
6061		} else {
6062			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() - parseInt($('#header-space').height()) + extraSpaceFromResize : $(window).height() - parseInt($('#header-outer').height()) ;
6063		}
6064		var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
6065		if($('.nectar-box-roll').length > 0) extraHeight = 0;
6066		pageHeaderHeight =   calculatedNum  - extraHeight; 
6067		pageHeaderHeightCopy = calculatedNum - extraHeight; 
6068	}
6069
6070	if( window.innerWidth < 1000 && window.innerWidth > 690 && !$('body').hasClass('salient_non_responsive') ) {
6071		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 1.6;
6072		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
6073		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
6074		
6075	} else if( window.innerWidth <= 690 && window.innerWidth > 480 && !$('body').hasClass('salient_non_responsive')) {
6076		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 2.1;
6077		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
6078		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
6079		
6080	} else if( window.innerWidth <= 480 && !$('body').hasClass('salient_non_responsive')) {
6081		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 2.5;
6082		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
6083		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
6084		
6085	} else {
6086		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy).css('height',pageHeaderHeightCopy +'px');
6087		if($('.fullscreen-header').length > 0){
6088			$('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
6089		} else {
6090			$('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
6091		}
6092
6093		if($('#page-header-bg[data-parallax="1"]').length == 0) $('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
6094	}
6095
6096	
6097	
6098	if(!$('body').hasClass('mobile')){
6099		
6100		//recalc
6101		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
6102		$('#page-header-bg .container > .row').css('top',0);
6103		var $divisionMultipler = ($('#header-outer[data-remove-border="true"]').length > 0) ? 2 : 1;
6104
6105		//center the heading
6106		pageHeadingHeight = $('#page-header-bg .col.span_6').height();
6107		
6108		if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.fullscreen-header').length == 0) {
6109			$('#page-header-bg:not("[data-parallax=1]") .col.span_6').css('top', ((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2));
6110		} else {
6111			var $extraResizeHeight = ($('#header-outer[data-header-resize="1"]').length > 0) ? 22: 0;
6112			$('#page-header-bg:not("[data-parallax=1]") .col.span_6').css('top', (pageHeaderHeight/2) - (pageHeadingHeight/2) + $extraResizeHeight);
6113		}
6114		
6115		//center portfolio filters
6116		$('#page-header-bg:not("[data-parallax=1]") .portfolio-filters').css('top', (pageHeaderHeight/2) + 2);	
6117		
6118		if($('#page-header-bg[data-parallax="1"] .span_6').css('opacity') > 0) {
6119			
6120			if($('#header-outer[data-transparent-header="true"]').length > 0 && $('body.single-post .fullscreen-header').length == 0) {
6121				//center the parallax heading
6122
6123			    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
6124					'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+60)),
6125					'top' : (((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2)) +"px"
6126			    });
6127			    
6128			    //center parllax portfolio filters
6129			    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
6130					'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
6131					'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
6132			    });
6133		  } else {
6134		  		//center the parallax heading
6135			    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
6136					'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+60)),
6137					'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
6138			    });
6139			    
6140			    //center parllax portfolio filters
6141			    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
6142					'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
6143					'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
6144			    });
6145		  }
6146	   }
6147	}
6148	
6149	else {
6150		//recalc
6151		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
6152		
6153		//center the heading
6154		var pageHeadingHeight = $('#page-header-bg .container > .row').height();
6155		$('#page-header-bg .container > .row').css('top', (pageHeaderHeight/2) - (pageHeadingHeight/2) + 5);
6156		
6157	}
6158
6159
6160	$('#page-header-bg .container > .row').css('visibility','visible');
6161}
6162
6163var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0; 
6164setTimeout(function(){ pageHeader(); },$pt_timeout);
6165
6166
6167if($('#header-outer').attr('data-header-resize') == '' || $('#header-outer').attr('data-header-resize') == '0'){
6168	$('#page-header-wrap').css('margin-top','0');
6169}
6170
6171
6172function extractUrl(input) {
6173	return input.replace(/"/g,"").replace(/url\(|\)$/ig, "");
6174}
6175 
6176/***************** Parallax Page Headers ******************/
6177if($('#page-header-bg[data-parallax="1"]').length > 0) {
6178
6179	//fadeIn
6180
6181	var img = new Image();
6182	
6183	var imgX, imgY, aspectRatio;
6184	var diffX, diffY;
6185	var pageHeadingHeight = $('#page-header-bg .col.span_6').height();
6186	var pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
6187	var headerPadding2 = parseInt($('#header-outer').attr('data-padding'))*2;
6188	var wooCommerceHeader = ($('.demo_store').length > 0) ? 32 : 0 ;
6189	
6190	
6191	var $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
6192	
6193	if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) {    
6194		img.onload = function() {
6195		   pageHeaderInit(); 
6196		}
6197		
6198		img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
6199		
6200	} else {
6201		 pageHeaderInit();
6202	}
6203	
6204	
6205	
6206	var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
6207
6208
6209	 if($('body[data-hhun="1"]').length > 0)  $('#header-outer').addClass('parallax-contained');
6210
6211	 window.addEventListener('scroll', function(){ 
6212        window.requestAnimationFrame(bindHeaderParallax);
6213    }, false);
6214
6215}
6216
6217
6218function bindHeaderParallax(){
6219
6220	var $scrollTop = $(window).scrollTop();
6221	var pageHeadingHeight = $('#page-header-bg .col.span_6').height();
6222	
6223	
6224	if(!$('body').hasClass('mobile') && navigator.userAgent.match(/iPad/i) == null){
6225
6226		var $multiplier1 =  ($('body[data-hhun="1"]').length > 0) ? 0.40: 0.2;
6227   	    var $multiplier2 = ($('body[data-hhun="1"]').length > 0) ? 0.09: 0.14;
6228   	    var $parallaxHeaderHUN = ($('#header-outer[data-transparency-option="1"]').length > 0) ? 0.49: 0.4;
6229
6230		//calc bg pos
6231		//$('#page-header-bg[data-parallax="1"]').css({'top': ((- $scrollTop / 5)+logoHeight+headerPadding+headerResizeOffExtra+extraHeight-extraDef+secondaryHeader)  + 'px' });
6232		if($('#page-header-bg .nectar-particles').length == 0 && $('#page-header-bg.out-of-sight').length == 0) {
6233
6234			$('#page-header-bg[data-parallax="1"]').css({ 'transform': 'translateY('+ $scrollTop*-$multiplier1 +'px)' });	
6235		
6236			var multipler = ($('body').hasClass('single')) ? 1 : 2;
6237			$('#page-header-bg[data-parallax="1"] .span_6,  #page-header-bg[data-parallax="1"][data-post-hs="default_minimal"] .author-section').css({ 
6238				'opacity' : 1-($scrollTop/(pageHeaderHeight-60))
6239			});
6240			
6241			$('#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)' });
6242			
6243			
6244			if($('#page-header-bg[data-parallax="1"] .span_6').css('opacity') == 0){
6245				$('#page-header-bg[data-parallax="1"] .span_6, #page-header-bg[data-parallax="1"] .portfolio-filters').hide();
6246			} else {
6247				$('#page-header-bg[data-parallax="1"] .span_6, #page-header-bg[data-parallax="1"] .portfolio-filters').show();
6248			}
6249
6250			if($('body[data-hhun="1"]').length > 0  && !$('#header-outer').hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) { 
6251	            $('#header-outer.parallax-contained').css({ 'transform': 'translateY('+$scrollTop*-$parallaxHeaderHUN+'px)' });
6252	        }
6253			
6254		
6255		}
6256		else if($('#page-header-bg.out-of-sight').length == 0) {
6257			//alt parallax effect
6258			var multipler = ($('body').hasClass('single')) ? 1 : 2;
6259			$('#page-header-wrap .nectar-particles .fade-out').css({ 
6260				'opacity' : 0+($scrollTop/(pageHeaderHeight+pageHeaderHeight*$multiplier))
6261			});
6262		}
6263
6264
6265		//hide elements to allow other parallax sections to work in webkit browsers
6266		if( ($scrollTop / (pageHeaderHeight + $('#header-space').height() + extraHeight)) > 1 ) {
6267			$('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility','hidden').hide().addClass('out-of-sight');
6268		}
6269		else {
6270		 	$('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility','visible').show().removeClass('out-of-sight');
6271
6272		 		//ensure header is centered
6273		 		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
6274				$('#page-header-bg .container > .row').css('top',0);
6275				var $divisionMultipler = ($('#header-outer[data-remove-border="true"]').length > 0) ? 2 : 1;
6276				pageHeadingHeight = $('#page-header-bg .col.span_6').height();
6277
6278				if($('#header-outer[data-transparent-header="true"]').length > 0 && $('body.single-post .fullscreen-header').length == 0) {
6279					//center the parallax heading
6280				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
6281						'top' : (((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2)) +"px"
6282				    });
6283
6284			  	} else {
6285			  		//center the parallax heading
6286				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
6287						'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
6288				    });
6289			  	}
6290	    }
6291		
6292
6293	}
6294
6295}
6296
6297if($('#page-header-bg').length > 0) {
6298	var $initialImgCheckAscend = extractUrl($('#page-header-bg').css('background-image'));
6299	if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) {    
6300		   $('#page-header-bg').addClass('has-bg');
6301	}
6302}
6303
6304
6305function pageHeaderInit(){
6306
6307	 var wooCommerceHeader = ($('.demo_store').length > 0) ? 32 : 0 ;
6308	 var centeredNavAltSpace = ($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) ? $('header#top nav > .sf-menu').height() -20 : null;
6309	 //transparent
6310	  if($('#header-outer[data-transparent-header="true"]').length > 0) {	
6311	     $('#page-header-bg[data-parallax="1"]').css({'top': extraHeight+wooCommerceHeader });
6312	  } else {
6313
6314	  	 var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
6315		 var headerPadding = parseInt($('#header-outer').attr('data-padding'));
6316		 var headerPadding2 = parseInt($('#header-outer').attr('data-padding'));
6317		 var extraDef = 10;
6318		 var headerResize = ($('body').hasClass('pp-video-function')) ? '1' : $('#header-outer').attr('data-header-resize');
6319		 var headerResizeOffExtra = 0;
6320		 var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
6321		 var usingLogoImage = true;
6322	     var mediaElement = ($('.wp-video-shortcode').length > 0) ? 36 : 0;
6323	     var secondaryHeader = ($('#header-outer').attr('data-using-secondary') == '1') ? 32 : 0 ;
6324	  	 if($('body[data-header-resize="0"]').length == 0) $('#page-header-bg[data-
6324parallax="1"]').css({'top': (logoHeight+headerPadding+centeredNavAltSpace+headerResizeOffExtra+extraHeight-extraDef+secondaryHeader+wooCommerceHeader)  + 'px' });
6325	  }
6326	  
6327	  //fade in header
6328	  if($('#ajax-content-wrap').length == 0 || !$('body').hasClass('ajax-loaded')){
6329	  	$('#page-header-bg[data-parallax="1"]').animate({ 'opacity' : 1},650,'easeInCubic');
6330	  } else if($('#ajax-content-wrap').length == 1) {
6331	  	$('#page-header-bg[data-parallax="1"]').css({ 'opacity' : 1});
6332	  }
6333
6334	  //$('#page-header-wrap').css({'height' : pageHeaderHeight});
6335	  
6336	  //verify smooth scorlling
6337	  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') } 
6338	  
6339	  /* $('#page-header-bg[data-parallax="1"] .span_6').css({ 
6340			'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+60))
6341			'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
6342	   });
6343	   
6344	   $('#page-header-bg[data-parallax="1"] #portfolio-filters').css({ 
6345			'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
6346			'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
6347	   }); */
6348	  
6349	  $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />');
6350}
6351
6352
6353
6354
6355function nectarPageHeader() {
6356
6357	if($('#page-header-bg').length > 0) {
6358		fullScreenHeaderInit();
6359		pageHeader();
6360	}
6361
6362
6363	if($('#page-header-bg[data-parallax="1"]').length > 0) {
6364
6365		var img = new Image();
6366		var $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
6367			
6368		if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) {    
6369			img.onload = function() {
6370			   pageHeaderInit();    
6371					
6372			}
6373			
6374			img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
6375			
6376		} else {
6377			 pageHeaderInit();
6378		}
6379
6380		//bindHeaderParallax();
6381		$('#page-header-bg[data-parallax="1"] .span_6').css({ 
6382			'opacity' : 1
6383		});
6384
6385		
6386
6387		if (window.addEventListener) {
6388			 window.addEventListener('scroll', function(){ 
6389	          requestAnimationFrame(bindHeaderParallax); 
6390	        }, false);
6391		}
6392
6393	} 
6394
6395	if($('#page-header-bg').length > 0) {
6396		var $initialImgCheckAscend = extractUrl($('#page-header-bg').css('background-image'));
6397		if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) {    
6398			   $('#page-header-bg').addClass('has-bg');
6399		}
6400	}
6401}
6402
6403if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
6404	window.onunload = function(){ nectarPageHeader(); };
6405}
6406
6407
6408/***************** header text effects *****************/
6409
6410// rotate in
6411function pageHeaderTextEffectInit() {
6412	$('#page-header-bg').each(function(){
6413		if($(this).attr('data-text-effect') == 'rotate_in') {
6414			var $topHeading = 'none';
6415
6416			if($(this).find('.span_6 h1').length > 0) {
6417				$topHeading = 'h1';
6418			} 
6419			//else if ($(this).find('.span_6 h2').length > 0) {
6420			//	$topHeading = 'h2';
6421			//}
6422
6423			if($topHeading != 'none') {
6424
6425				var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6';
6426
6427				$(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () {
6428			        return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, "");
6429			    }).wrap('<span class="wraped"></span>');
6430
6431			    $(this).find($selector).find('.wraped').each(function () {
6432
6433				    textNode = $(this);
6434
6435				    text = textNode.text().split(' ');
6436				    replace = '';
6437
6438				    $.each(text, function (index, value) {
6439				        if (value.replace(/\s+/, "")) {
6440				            replace += '<span class="wraped"><span>' + value + '</span></span> ';
6441				        }
6442				    });
6443				    textNode.replaceWith($(replace));
6444				    
6445				});
6446			}//make sure suitable heading was found
6447
6448		}//tilt
6449	});
6450	
6451}
6452function pageHeaderTextEffect() {
6453
6454	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) {
6455
6456		var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6';
6457
6458		$($selector).find('.wraped').each(function(i){
6459			$(this).find('span').delay(i*370).transition({ rotateX: '0', 'opacity' : 1, y: 0},400,'easeOutQuad');
6460		});
6461
6462		setTimeout(function(){
6463
6464			$($selector).find('.inner-wrap > *:not(.top-heading)').each(function(i){
6465				$(this).delay(i*370).transition({ rotateX: '0', 'opacity' : 1, y: 0 },650,'easeOutQuad');
6466			});
6467
6468			$('.scroll-down-wrap').removeClass('hidden');
6469
6470		}, $($selector).find('.wraped').length * 370);
6471	}
6472
6473}
6474var $effectTimeout = ($('#ajax-loading-screen').length > 0) ? 800 : 0;
6475pageHeaderTextEffectInit();
6476if($('#page-header-bg .nectar-video-wrap video').length == 0) setTimeout(pageHeaderTextEffect,$effectTimeout);
6477
6478
6479
6480
6481 //submenu fix
6482  if($('header#top nav > ul.sf-menu ul').length > 0) {
6483
6484  	var $midnightSubmenuTimeout;
6485  	$('body').on('mouseover','#header-outer .midnightHeader .sf-with-ul, #header-outer .midnightHeader .cart-menu',function(){
6486
6487  		if($(this).parents('.midnightHeader').offset().top - $(window).scrollTop() < 50){
6488  		
6489  			$(this).parents('.midnightHeader').css({'z-index': '9999'}).addClass('overflow');
6490  			$(this).parents('.midnightInner').css('overflow','visible');
6491  		}
6492  	});
6493  	$('body').on('mouseleave','#header-outer .midnightHeader',function(){
6494  		var $that = $(this);
6495  		clearTimeout($midnightSubmenuTimeout);
6496  		$midnightSubmenuTimeout = setTimeout(function(){
6497  			if(!$that.is(':hover')) {
6498  				$that.css({'z-index': 'auto'}).removeClass('overflow');
6499  				$that.find('.midnightInner').css('overflow','hidden');
6500  		
6501  			}
6502
6503  		},900);
6504  	});
6505  }
6506
6507  function midnightInit() {
6508  	if( $('#header-outer[data-permanent-transparent="1"]').length > 0 && $('body[data-bg-header="true"]').length > 0) {
6509  		 $('#header-outer').midnight();
6510
6511  		 //no menu
6512  		 if($('#header-outer[data-has-menu="false"]').length > 0 && $('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
6513  			 //fix the pointer events
6514  			 //var enableHandler = false;
6515
6516  			 var $buttonsOffset = ($('#social-in-menu').length > 0) ? $('#social-in-menu').position() : $('#header-outer header#top nav > ul.buttons').position();
6517  			 if($('#header-outer #logo img:visible').length > 0) {
6518  			 	var $logoOffset = $('#header-outer #logo img:visible').position();
6519  			 	var $logoOffsetTop = $('#header-outer #logo img:visible').position().top;
6520  			 	var $logoMargin = parseInt($('#header-outer #logo img:visible').css('margin-top'));
6521  			 	var $logoWidth = $('#header-outer #logo img:visible').width();
6522  			 } else {
6523  			 	var $logoOffset = $('#header-outer .span_3 #logo:visible').offset();
6524  			 	var $logoOffsetTop = $('#header-outer .span_3 #logo:visible').offset().top - $(window).scrollTop();
6525  			 	var $logoMargin = parseInt($('#header-outer .span_3 #logo:visible').css('margin-top'));
6526  			 	var $logoWidth = $('#header-outer #logo').width();
6527  			 }
6528  			 var $bodyBorderSize = ($('.body-border-top').length > 0) ? $('.body-border-top').height() : 0;
6529
6530  			 var $containerMargin = parseInt($('#header-outer header > .container').css('padding-left'));
6531  			 var $headerOffset = $('#header-outer').position();
6532  			 //recalc offsets
6533  			 $(window).on('smartresize', function(){
6534  			 	if($('#header-outer #logo img').length > 0) {
6535  				 	$logoMargin = parseInt($('#header-outer #logo img:visible').css('margin-top'));
6536  				 	$logoOffset = $('#header-outer #logo img:visible').position();
6537  				 	$logoOffsetTop = $('#header-outer #logo img:visible').position().top;
6538  				 	$logoWidth = $('#header-outer #logo img:visible').width();
6539  				 } else {
6540  				 	$logoMargin = parseInt($('#header-outer .span_3 #logo:visible').css('margin-top'));
6541  				 	$logoOffset = $('#header-outer .span_3 #logo:visible').offset();
6542  				 	$logoOffsetTop = $('#header-outer .span_3 #logo:visible').offset().top - $(window).scrollTop();
6543  				 	$logoWidth = $('#header-outer #logo').width();
6544  				 }
6545  			 	$containerMargin = parseInt($('#header-outer header > .container').css('padding-left'));
6546  			    $buttonsOffset = ($('#social-in-menu').length > 0) ? $('#social-in-menu').position() : $('#header-outer header#top nav > ul.buttons').position();
6547  			    $headerOffset = $('#header-outer').position();
6548  			 });
6549
6550  			 $('body').mousemove(function(e){
6551  			 	if($('body.mobile').length == 0) {
6552  			 	
6553  					 	//hover over buttons || logo check
6554  					 	if(e.clientX >= $buttonsOffset.left + $containerMargin && 
6555  					 	   e.clientY >= $buttonsOffset.top + $bodyBorderSize && 
6556  					 	   e.clientY <= $buttonsOffset.top + $headerOffset.top + $bodyBorderSize + $('#header-outer header#top nav > ul.buttons').height() ||
6557  					 	   e.clientX <= $logoOffset.left + $containerMargin + $logoWidth &&
6558  					 	   e.clientY >= $logoOffsetTop + $bodyBorderSize&& 
6559  					 	   e.clientY <= $logoOffsetTop + $logoMargin + $bodyBorderSize + $headerOffset.top + $('#header-outer #logo img:visible').height() ) {
6560  					 		$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
6561
6562  					 	} else {
6563  					 		$('.midnightHeader, #header-outer').addClass('no-pointer-events');
6564  					 	}
6565
6566  					
6567  				} else {
6568  					$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
6569  				}
6570  			 });
6571
6572  	
6573  		}
6574
6575  		//using menu
6576  		else if($('#header-outer[data-has-menu="true"]').length > 0) {
6577
6578  			 var $headerPos = $('header#top .container').position();
6579  			 var $headerOffset = $('header#top .container').offset();
6580  			 var $bodyBorderSize = ($('.body-border-top').length > 0) ? $('.body-border-top').height() : 0;
6581
6582  			 //recalc offsets
6583  			 $(window).on('smartresize', function(){
6584  			 	
6585  			    $headerPos = $('header#top .container').position();
6586  			    $headerOffset = $('header#top .container').offset();
6587
6588  			 });
6589
6590  			 $('body').mousemove(function(e){
6591  			 	if($('body.mobile').length == 0) {
6592
6593  					 	//hover over buttons || logo check
6594  					 	if(e.clientX >= $headerOffset.left &&
6595  					 	   e.clientY >= $headerPos.top  + $bodyBorderSize && 
6596  					 	   e.clientY <= $('header#top .container .row').height() + $bodyBorderSize) {
6597  					 		$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
6598  					 	} else if($('li.sfHover').length == 0) {
6599  					 		$('.midnightHeader, #header-outer').addClass('no-pointer-events');
6600  					 	}
6601
6602  					
6603  				} else {
6604  					$('.midnightHeader, #header-outer').removeClass('no-pointer-events');
6605  				}
6606  			 });
6607
6608  		}
6609  	}
6610  }
6611
6612
6613
6614//box roll
6615function getScrollbarWidth() {
6616    var outer = document.createElement("div");
6617    outer.style.visibility = "hidden";
6618    outer.style.width = "100px";
6619    outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
6620
6621    document.body.appendChild(outer);
6622
6623    var widthNoScroll = outer.offsetWidth;
6624    // force scrollbars
6625    outer.style.overflow = "scroll";
6626
6627    // add innerdiv
6628    var inner = document.createElement("div");
6629    inner.style.width = "100%";
6630    outer.appendChild(inner);        
6631
6632    var widthWithScroll = inner.offsetWidth;
6633
6634    // remove divs
6635    outer.parentNode.removeChild(outer);
6636
6637    return widthNoScroll - widthWithScroll;
6638}
6639
6640
6641function boxRollInit() {
6642	if($('.nectar-box-roll').length > 0) { 
6643
6644		$('body').attr('data-scrollbar-width',getScrollbarWidth());
6645
6646		$('body, html, #ajax-content-wrap, .container-wrap, .blurred-wrap').addClass('no-scroll');
6647		$('body,html').stop().animate({ scrollTop:0 },0);
6648		$('.container-wrap').css('opacity',0).addClass('no-transform-animation-bottom-out').addClass('bottomBoxOut');
6649		//keep loading icon centered if scrollbar is going away
6650		if($('.mobile').length == 0) $('#ajax-loading-screen .loading-icon > span').css({ 'left' : '-'+getScrollbarWidth()/2 +'px'});
6651
6652		//change content pos
6653		var $overlaid = $('#page-header-bg .overlaid-content').clone();
6654		var $scrollDownOverlaid = $('.scroll-down-wrap').clone();
6655		$('#page-header-bg').removeAttr('data-midnight');
6656		$('#page-header-bg .overlaid-content, #page-header-bg .scroll-down-wrap').remove();
6657		$('.nectar-box-roll').append($overlaid).attr('data-midnight','light');
6658		$('.overlaid-content').append($scrollDownOverlaid);
6659
6660
6661		nectarBoxRollContentHeight();
6662		setTimeout(function() { pageLoadHash(); },700);
6663	} else {
6664		$('#ajax-content-wrap, .blurred-wrap').addClass('at-content');
6665		$('body, html, #ajax-content-wrap, .container-wrap, .blurred-wrap').removeClass('no-scroll');
6666		$('.container-wrap').css('opacity',1).removeClass('no-transform-animation-bottom-out').removeClass('bottomBoxOut').removeClass('bottomBoxIn');
6667		perspect = 'not-rolled';
6668	}
6669}
6670boxRollInit();
6671
6672function nectarBoxRollContentHeight() {
6673	/*if($('#header-outer[data-transparent-header="true"]').length == 0 && $('.mobile').length == 0) {
6674		$('.nectar-box-roll').css('top',$('#header-space').height());
6675	} else {
6676		$('.nectar-box-roll').css('top','0');
6677	}*/
6678	
6679	if($('#header-outer[data-transparent-header="true"]').length == 0) {
6680		$('.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() });
6681		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'); }
6682		else $('#ajax-content-wrap, #slide-out-widget-area.fullscreen').css('margin-top','0');
6683	} else {
6684		$('.nectar-box-roll .overlaid-content, .nectar-box-roll .canvas-bg, .container-wrap').css('height',window.innerHeight);
6685	}
6686}
6687
6688if($('.nectar-box-roll').length > 0) $(window).on('resize',nectarBoxRollContentHeight);
6689
6690
6691var perspect = 'not-rolled';
6692var animating = 'false';
6693function boxRoll(e,d) {
6694	
6695	if($('#slide-out-widget-area.open').length > 0) return false;
6696	if( $('.nectar-box-roll canvas').length > 0 && $('.nectar-box-roll canvas[data-loaded="true"]').length == 0) return false;
6697
6698	if(perspect == 'not-rolled' && animating == 'false' && d == -1) {
6699		perspect = 'rolled';
6700		animating = 'true';
6701		$('body').addClass('box-animating').addClass('box-perspective-rolled').addClass('box-rolling');
6702
6703		$('.nectar-box-roll #page-header-bg').removeClass('topBoxIn').addClass('topBoxOut').css('will-change','transform');
6704		
6705		$('.nectar-box-roll .overlaid-content').removeClass('topBoxIn2').removeClass('topBoxIn').addClass('topBoxOut2').css('will-change','transform');
6706		
6707		$('.container-wrap').removeClass('bottomBoxOut').addClass('bottomBoxIn').removeClass('no-transform-animation-bottom-out').addClass('nectar-box-roll-class').css('will-change','transform');
6708		if($('#header-outer[data-transparent-header="true"]').length == 0) {
6709			$('.container-wrap').css({'height':$(window).height() - $('#header-space').height(), 'opacity': 1});
6710			$('#slide-out-widget-area.fullscreen').css('margin-top','0px');
6711		} else {
6712			$('.container-wrap').css({'height':$(window).height(), 'opacity': 1});
6713		}
6714		
6715
6716		$('.nectar-slider-wrap').css({'opacity':0});
6717
6718		updateRowRightPadding(d);
6719		pauseVideoBG();
6720
6721		//old browser workaround
6722		var timeout1 = 1220;
6723		var timeout2 = 1650;
6724		var timeout3 = 1700;
6725		var timeout4 = 1350;
6726		if( $('html.no-cssanimations').length > 0) {
6727			timeout1 = 1;
6728			timeout2 = 1;
6729			timeout3 = 1;
6730			timeout4 = 1;
6731		}
6732
6733		$('.container-wrap').css('padding-right',$('body').attr('data-scrollbar-width') + 'px');
6734		setTimeout(function(){
6735			$('#header-outer, #wpadminbar, .cart-outer .cart-menu, .midnightHeader .midnightInner').animate({'padding-right': $('body').attr('data-scrollbar-width')},250);
6736			$('.nectar-box-roll .canvas-bg').addClass('out-of-sight');
6737			if($('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent');
6738
6739			if($('body.mobile').length > 0) $('.nectar-box-roll').css({'z-index':'1'});
6740		},timeout1);
6741		setTimeout(function(){ 
6742			updateRowRightPadding(1);
6743			$('body,html,#ajax-content-wrap, .container-wrap, .blurred-wrap').removeClass('no-scroll'); 
6744			$('#ajax-content-wrap, .blurred-wrap').addClass('at-content');
6745			$('.container-wrap, #footer-outer').removeClass('bottomBoxIn').removeClass('nectar-box-roll-class').addClass('auto-height');
6746			$('#header-outer, #wpadminbar, .container-wrap, .cart-outer .cart-menu, .midnightHeader .midnightInner').stop().css('padding-right',0);
6747
6748			if( $smoothActive == 1 && $(window).width() > 690  && Modernizr.csstransforms3d && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){ 
6749				niceScrollInit();
6750			}
6751			
6752			$('.nectar-box-roll').css({'z-index':'-1000'}).transition({'y': '-200%'},0);
6753			$('.nectar-box-roll canvas').hide();
6754			$('body').removeClass('box-rolling');
6755			$('.nectar-slider-wrap').transition({'opacity':1},600,'easeOutCubic');
6756
6757			$('.nectar-box-roll #page-header-bg, .nectar-box-roll .overlaid-content, .container-wrap').css('will-change','auto');
6758			if($waypointsBound == false) waypoints();	
6759		},timeout2);
6760		
6761		//fadeIn
6762		setTimeout(function(){ 
6763			$('.container-wrap .main-content > .row > div > div[class*="col"]').css({'opacity':1});
6764		},timeout4);
6765
6766		setTimeout(function(){ 
6767					animating ='false'; 
6768					$('body').removeClass('box-animating');		
6769		},timeout3);
6770
6771		//header position when transparent nav was used
6772		if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length != 0) { 
6773			$('#ajax-content-wrap').transition({'margin-top':$('#header-outer').outerHeight(true) + $('#header-outer').offset().top},2000,'easeInOutQuad');
6774		}
6775		/*if($('#header-outer[data-transparent-header="true"]').length == 0 && $('.mobile').length == 0) {
6776			$('.nectar-box-roll').transition({'top': 0},2000,'easeInOutQuad');
6777		}*/
6778		
6779
6780		//remove header if not fixed
6781		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');
6782
6783	}
6784
6785	else if(perspect == 'rolled' && animating == 'false' && d == 1 && $(window).scrollTop() < 100) {
6786
6787		$('.container-wrap').removeClass('auto-height');
6788		if($('#header-outer[data-transparent-header="true"]').length == 0) {
6789			$('.container-wrap').css({'height':$(window).height() - $('#header-space').height(), 'opacity': 1});
6790		} else {
6791			$('.container-wrap').css({'height':$(window).height(), 'opacity': 1});
6792		}
6793		
6794		$('#footer-outer').removeClass('auto-height');
6795		$('body').addClass('box-rolling');
6796
6797		perspect = 'not-rolled';
6798		animating = 'true';
6799		$('body').addClass('box-animating').addClass('box-perspective-not-rolled');
6800
6801		$('#header-outer, #wpadminbar, .container-wrap, .cart-outer .cart-menu, .midnightHeader .midnightInner').css('padding-right',$('body').attr('data-scrollbar-width') + 'px');
6802		$('.nectar-slider-wrap').transition({'opacity':0},600,'easeOutCubic');
6803		$('.container-wrap .main-content > .row > div > div[class*="col"]').stop(true).css({'opacity':0});
6804		setTimeout(function(){
6805			$('#header-outer, #wpadminbar, .cart-outer .cart-menu, .midnightHeader .midnightInner').animate({'padding-right': 0},250);
6806			$('.nectar-box-roll .canvas-bg').removeClass('out-of-sight');
6807			resizeVideoToCover();
6808			//header position when transparent nav was used
6809			if($('#header-outer[data-transparent-header="true"]').length != 0) { 
6810				$('#ajax-content-wrap').stop(true,true).transition({'margin-top':0},2000,'easeInOutCubic');
6811			} else {
6812				if($('.mobile').length == 0) $('#slide-out-widget-area.fullscreen').css('margin-top','-'+$('#header-space').height()+'px');
6813			}
6814			//if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('.mobile').length == 0 ) $('.nectar-box-roll').transition({'top': $('#header-space').height() },2000,'easeInOutQuad');
6815			
6816		},30);
6817
6818		//old browser workaround
6819		var timeout1 = 1700;
6820		var timeout2 = 1600;
6821		var timeout3 = 1300;
6822		if( $('html.no-cssanimations').length > 0) {
6823			timeout1 = 1;
6824			timeout2 = 1;
6825			timeout3 = 1;
6826		}
6827
6828		if($('body.mobile').length > 0) {
6829			setTimeout(function(){
6830				$('.nectar-box-roll').css('z-index','1000');
6831			},timeout3);
6832		} else {
6833			$('.nectar-box-roll').css('z-index','1000');
6834		}
6835
6836		updateRowRightPadding(d);
6837		removeNiceScroll();
6838		$('.nectar-box-roll').transition({'y': '0'},0);
6839		$('.nectar-box-roll canvas').show();
6840		setTimeout(function(){ 
6841			updateRowRightPadding(1);
6842			animating ='false'; 
6843			$('body').removeClass('box-animating');
6844			$('#page-header-bg').removeClass('topBoxIn');
6845			$('.overlaid-content').removeClass('topBoxIn2');	
6846			$('body').removeClass('box-rolling');
6847			resumeVideoBG();
6848			$('.nectar-box-roll #page-header-bg, .nectar-box-roll .overlaid-content, .container-wrap').css('will-change','auto');
6849		},timeout1);
6850
6851		setTimeout(function(){
6852			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');
6853		},timeout2);
6854
6855		$('body,html,#ajax-content-wrap, .container-wrap, .blurred-wrap').addClass('no-scroll');
6856		$('#ajax-content-wrap, .blurred-wrap').removeClass('at-content');
6857		$('.container-wrap').addClass('nectar-box-roll-class');
6858		$('.nectar-box-roll #page-header-bg').removeClass('topBoxOut').addClass('topBoxIn').css('will-change','transform');
6859		
6860		$('.container-wrap').removeClass('bottomBoxIn').addClass('bottomBoxOut').css('will-change','transform');
6861
6862		if($('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').addClass('transparent');
6863
6864		$('.nectar-box-roll .overlaid-content').removeClass('topBoxOut2').removeClass('topBoxOut').addClass('topBoxIn2').css('will-change','transform');
6865	
6866		if($('#header-outer[data-header-resize="1"]').length > 0) { bigNav(); }
6867
6868		$('.nectar-box-roll .trigger-scroll-down').removeClass('hovered');
6869	}
6870
6871	
6872}
6873
6874function boxScrollEvent(event, delta) {
6875	if($('#slide-out-widget-area.open.fullscreen').length > 0) return false;
6876	boxRoll(event,delta);
6877}
6878
6879function boxRollMouseWheelInit() {
6880	if($('.nectar-box-roll').length > 0) {
6881		$('body').on("mousewheel", boxScrollEvent);
6882	} else {
6883		$('body').off("mousewheel", boxScrollEvent);
6884	}
6885}
6886
6887boxRollMouseWheelInit();
6888
6889$('body').on('click','.nectar-box-roll .section-down-arrow',function(){
6890	boxRoll(null,-1);
6891	$(this).addClass('hovered');
6892	setTimeout(function(){ $('.nectar-box-roll .section-down-arrow').removeClass('hovered'); },2000);
6893	return false;
6894});
6895
6896
6897
6898function updateRowRightPadding(d){
6899	$('.wpb_row.full-width-section').each(function(){
6900		if($(this).hasClass('extraPadding') && d == 1) {
6901			$(this).css('padding-right',parseInt($(this).css('padding-right')) - parseInt($('body').attr('data-scrollbar-width')) + 'px' ).removeClass('extraPadding');
6902		} else {
6903			$(this).css('padding-right',parseInt($('body').attr('data-scrollbar-width')) + parseInt($(this).css('padding-right')) + 'px' ).addClass('extraPadding');
6904		}	
6905	});
6906	$('.wpb_row.full-width-content').each(function(){
6907		if($(this).find('.row-bg.using-image').length == 0) {
6908			if($(this).hasClass('extraPadding') && d == 1) {
6909				$(this).find('.row-bg').css('width',parseInt($(this).width()) - parseInt($('body').attr('data-scrollbar-width')) + 'px' ).removeClass('extraPadding');
6910			} else {
6911				$(this).find('.row-bg').css('width',parseInt($('body').attr('data-scrollbar-width')) + $(this).width() + 'px' ).addClass('extraPadding');
6912			}	
6913		}
6914	});
6915}
6916
6917function pauseVideoBG() {
6918	if($('.nectar-box-roll video').length > 0) $('.nectar-box-roll video')[0].pause(); 
6919}
6920function resumeVideoBG() {
6921	if($('.nectar-box-roll video').length > 0) $('.nectar-box-roll video')[0].play(); 
6922}
6923
6924//touch 
6925if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && $('.nectar-box-roll').length > 0) {
6926	$('body').swipe({
6927		swipeStatus: function(event, phase, direction, distance, duration, fingers) {
6928			if($('#slide-out-widget-area.open').length > 0) return false;
6929			if(direction == 'up') {
6930				boxRoll(null,-1);
6931				if($('#ajax-content-wrap.no-scroll').length == 0) $('body').swipe("option", "allowPageScroll", 'vertical');
6932			} else if(direction == "down" && $(window).scrollTop() == 0) {
6933				boxRoll(null,1);
6934				$('body').swipe("option", "allowPageScroll", 'auto');
6935			}
6936		}
6937	});
6938
6939}
6940
6941function removeNiceScroll() {
6942		if($().niceScroll && $("html").getNiceScroll()){
6943			var nice = $("html").getNiceScroll();
6944			nice.stop();
6945			
6946			$('html').removeClass('no-overflow-y');
6947			$('.nicescroll-rails').hide();
6948			if($('#boxed').length == 0){
6949				$('body, body #header-outer, body #header-secondary-outer, body #search-outer, .midnightHeader .midnightInner').css('padding-right','0px');
6950			} else if($('body[data-ext-responsive="true"]').length == 0 ) {
6951				$('body').css('padding-right','0px');
6952			}
6953
6954			$('body').attr('data-smooth-scrolling','0');
6955		}
6956	}
6957//called after box roll
6958$waypointsBound = false;
6959function waypoints() {
6960	colAndImgAnimations(); 
6961	progressBars(); 
6962	dividers();
6963	iconList();
6964	animated_titles();
6965	imageWithHotspots();
6966	clientsFadeIn(); 
6967	splitLineHeadings();
6968	svgAnimations(); 
6969	milestoneInit();
6970	nectar_fancy_ul_init();
6971	owl_carousel_animate();
6972	headerRowColorInheritInit();
6973	morphingOutlines(); 
6974	$waypointsBound = true;
6975}
6976
6977
6978
6979/***************** WooCommerce Cart *****************/
6980var timeout;
6981var productToAdd;
6982
6983//notification
6984$('body').on('click','.product .add_to_cart_button', function(){
6985	productToAdd = $(this).parents('li').find('h3').text();
6986	$('#header-outer .cart-notification span.item-name').html(productToAdd);
6987
6988	//if($('.cart-menu-wrap').hasClass('first-load')) $('.cart-menu-wrap').removeClass('first-load').addClass('static');
6989});
6990
6991//notification hover
6992$('body').on('mouseenter','#header-outer .cart-notification',function(){
6993	$(this).fadeOut(400);
6994	$('#header-outer .widget_shopping_cart').stop(true,true).fadeIn(300);
6995	$('#header-outer .cart_list').stop(true,true).fadeIn(300);
6996	clearTimeout(timeout);
6997});
6998
6999//cart dropdown
7000$('#header-outer div.cart-outer').hoverIntent(function(){
7001	$('#header-outer .widget_shopping_cart').stop(true,true).fadeIn(300);
7002	$('#header-outer .cart_list').stop(true,true).fadeIn(300);
7003	clearTimeout(timeout);
7004	$('#header-outer .cart-notification').fadeOut(300);
7005});
7006
7007
7008$('body').on('mouseleave','#header-outer div.cart-outer',function(){
7009	var $that = $(this);
7010	setTimeout(function(){
7011		if(!$that.is(':hover')){
7012			$('#header-outer .widget_shopping_cart').stop(true,true).fadeOut(300);
7013			$('#header-outer .cart_list').stop(true,true).fadeOut(300);
7014		}
7015	},100);
7016});
7017
7018if($('#header-outer[data-cart="false"]').length == 0) {
7019	$('body').on('added_to_cart', shopping_cart_dropdown_show);
7020	$('body').on('added_to_cart', shopping_cart_dropdown);
7021}
7022
7023function shopping_cart_dropdown() {
7024		
7025		if(!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 ) {
7026			$('.cart-menu-wrap').addClass('has_products');
7027			$('header#top nav > ul, #search-outer #search #close a').addClass('product_added');
7028
7029			if(!$('.cart-menu-wrap').hasClass('static')) $('.cart-menu-wrap').addClass('first-load');
7030
7031			//nectar slider nav directional effect
7032			if($('#header-outer').hasClass('directional-nav-effect') && $('#header-outer .cart-icon-wrap .dark').length == 0 && $('body.ascend').length > 0){
7033				$('#header-outer .cart-outer .cart-icon-wrap').each(function(){
7034                    $(this).find('> i, > span.light, > span.dark, > span.original').remove();
7035                    $(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>');
7036                	$(this).find('.original').attr('data-w',$(this).find('span.original').width()+1);
7037                });
7038			}
7039		}
7040
7041}
7042
7043
7044function shopping_cart_dropdown_show(e) {
7045		
7046		clearTimeout(timeout);
7047		
7048		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' ) {
7049			//before cart has slide in
7050			if(!$('#header-outer .cart-menu-wrap').hasClass('has_products')) {
7051				setTimeout(function(){ $('#header-outer .cart-notification').fadeIn(400); },400);
7052			}
7053			else if(!$('#header-outer .cart-notification').is(':visible')) {
7054				$('#header-outer .cart-notification').fadeIn(400);
7055			} else {
7056				$('#header-outer .cart-notification').show();
7057			}
7058			timeout = setTimeout(hideCart,2700);
7059
7060			$('.cart-menu a, .widget_shopping_cart a').addClass('no-ajaxy');
7061		}
7062}
7063
7064function hideCart() {
7065	$('#header-outer .cart-notification').stop(true,true).fadeOut();
7066}
7067
7068function checkForWooItems(){ 
7069	var checkForCartItems = setInterval(shopping_cart_dropdown,250);
7070	setTimeout(function(){ clearInterval(checkForCartItems); },4500);
7071}
7072if($('#header-outer[data-cart="false"]').length == 0) {
7073	checkForWooItems();
7074}
7075
7076var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
7077var secondaryHeader = ($('#header-outer').attr('data-using-secondary') == '1') ? 32 : 0 ;
7078function searchFieldCenter(){
7079	$('#search-outer').css('top',$('#header-outer').outerHeight() + extraHeight + secondaryHeader);
7080	$('#search-outer > #search #search-box').css('top',($(window).height()/2) - ($('#search-outer > #search input').height()/2) - $('#header-outer').outerHeight() );
7081}
7082
7083//text on hover effect
7084$('body').on('mouseover','.text_on_hover .product-wrap',function(){
7085	$(this).parent().addClass('hovered');
7086	//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');
7087});
7088$('body').on('mouseover','.text_on_hover > a:first-child',function(){
7089	$(this).parent().addClass('hovered');
7090});
7091
7092$('body').on('mouseout','.text_on_hover .product-wrap',function(){
7093	$(this).parent().removeClass('hovered');
7094	//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);
7095});
7096$('body').on('mouseout','.text_on_hover > a:first-child',function(){
7097	$(this).parent().removeClass('hovered');
7098});
7099
7100/*
7101$('.text_on_hover.product .star-rating span').each(function(){
7102	$(this).attr('data-width',$(this).width());
7103	$(this).css('width', $(this).attr('data-width') - 40);
7104});*/
7105
7106
7107/***************** Search ******************/
7108	var $placeholder = $('#search input[type=text]').attr('data-placeholder');
7109	var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
7110	
7111	////search box event
7112	$('body').on('click', '#search-btn a', function(){ return false; });
7113	$('body').on('mousedown', '#search-btn a:not(.inactive)', function(){
7114
7115		if($(this).hasClass('open-search')) { return false; } 
7116
7117		if($('body').hasClass('ascend')){ 
7118			$('#search-outer > #search form, #search-outer #search .span_12 span').css('opacity',0);
7119			$('#search-outer > #search form').css('bottom','10px');
7120			$('#search-outer #search .span_12 span').css('top','10px');
7121			$('#search-outer').show();
7122			$('#search-outer').stop().transition({scale: '1,0', 'opacity': 1},0).transition({ scale: '1,1'},400,'easeInOutCubic');
7123
7124			$('#search-outer > #search form').delay(400).animate({'opacity':1, 'bottom':0},'easeOutCirc');
7125			$('#search-outer #search .span_12 span').delay(470).animate({'opacity':1, 'top':0},'easeOutCirc');
7126			
7127		} else {
7128			$('#search-outer').stop(true).fadeIn(600,'easeOutExpo');
7129		}
7130
7131		$('body:not(.ascend) #search-outer > #search input[type="text"]').css({
7132			'top' : $('#search-outer').height()/2 - $('#search-outer > #search input[type="text"]').height()/2
7133		});
7134		
7135		setTimeout(function(){
7136
7137			$('#search input[type=text]').focus();
7138			
7139			if($('#search input[type=text]').attr('value') == $placeholder){
7140				$('#search input[type=text]').setCursorPosition(0);	
7141			}
7142
7143		},300);
7144
7145		//ascend
7146		if($('body').hasClass('ascend')){ 
7147			searchFieldCenter();
7148		}
7149
7150		$(this).toggleClass('open-search');
7151
7152		//close slide out widget area
7153		$('.slide-out-widget-area-toggle a.open:not(.animating)').trigger('click');
7154
7155		return false;
7156	});
7157	
7158	$('body').on('keydown','#search input[type=text]',function(){
7159		if($(this).attr('value') == $placeholder){
7160			$(this).attr('value', '');
7161		}
7162	});
7163	
7164	/*$('body').on('keyup','#search input[type=text]',function(){
7165		if($(this).attr('value') == ''){
7166			$(this).attr('value', $placeholder);
7167			$(this).setCursorPosition(0);
7168		}
7169	});*/
7170	
7171	
7172	////close search btn event
7173	$('body').on('click','#close',function(){
7174		closeSearch();
7175		$('#search-btn a').removeClass('open-search');
7176		return false;
7177	});
7178
7179	//if user clicks away from the search close it
7180	$('body').on('blur','#search-box input[type=text]',function(e){
7181		closeSearch();
7182		$('#search-btn a').removeClass('open-search');
7183	});
7184	
7185	
7186	function closeSearch(){
7187		if($('body').hasClass('ascend')){ 
7188			$('#search-outer').stop().transition({'opacity' :0},300,'easeOutCubic');
7189			$('#search-btn a').addClass('inactive');
7190			setTimeout(function(){ $('#search-outer').hide(); $('#search-btn a').removeClass('inactive'); },300);
7191		} else {
7192			$('#search-outer').stop(true).fadeOut(450,'easeOutExpo');
7193		}
7194	}
7195	
7196	
7197	//mobile search
7198	$('body').on('click', '#mobile-menu #mobile-search .container a#show-search',function(){
7199		$('#mobile-menu .container > ul').slideUp(500);
7200		return false;
7201	});
7202	
7203/***************** Nav ******************/
7204
7205	function centeredLogoMargins() {
7206
7207		if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $(window).width() > 1000) {
7208			$midnightSelector = ($('#header-outer .midnightHeader').length > 0) ? '> .midnightHeader:first-child' : '';
7209			var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] '+$midnightSelector+' nav > .sf-menu > li').length;
7210			if($('#header-outer #social-in-menu').length > 0) $navItemLength--;
7211
7212			$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());
7213
7214			$('#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');
7215			$leftMenuWidth = 0;
7216			$rightMenuWidth = 0;
7217			$('#header-outer[data-format="centered-logo-between-menu"] '+$midnightSelector+' nav > .sf-menu > li:not(#social-in-menu)').each(function(i){
7218				if(i+1 <= Math.floor($navItemLength/2)) {
7219					$leftMenuWidth += $(this).width();
7220				} else {
7221					$rightMenuWidth += $(this).width();
7222				}
7223
7224			});
7225
7226			$menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth);
7227
7228			if($leftMenuWidth > $rightMenuWidth) 
7229				$('#header-outer .row > .col.span_9').css('padding-right',$menuDiff);
7230			else 
7231				$('#header-outer .row > .col.span_9').css('padding-left',$menuDiff);
7232
7233			$('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility','visible');
7234		}
7235	}
7236	
7237	var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
7238	var headerPadding = parseInt($('#header-outer').attr('data-padding'));
7239	var usingLogoImage = $('#header-outer').attr('data-using-logo');
7240	
7241	if( isNaN(headerPadding) || headerPadding.length == 0 ) { headerPadding = 28; }
7242	if( isNaN(logoHeight) || usingLogoImage.length == 0 ) { usingLogoImage = false; logoHeight = 30;}
7243	
7244	//inital calculations
7245	function headerInit() {
7246			
7247		$('#header-outer #logo img').css({
7248			'height' : logoHeight,				
7249		});	
7250		
7251		$('#header-outer').css({
7252			'padding-top' : headerPadding
7253		});	
7254		
7255		if($('body.mobile').length == 0) {
7256			$('header#top nav > ul > li:not(#social-in-menu) > a').css({
7257				'padding-bottom' : Math.floor( ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding),
7258				'padding-top' : Math.floor( (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2))
7259			});	
7260
7261			$('header#top nav > ul > li#social-in-menu > a').css({
7262				'margin-bottom' : Math.floor( ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding),
7263				'margin-top' : Math.floor( (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2))
7264			});	
7265		}
7266		
7267		if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
7268			$('#header-outer .cart-menu').css({  
7269				'padding-bottom' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding),
7270				'padding-top' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding)
7271			});	
7272		} else {
7273			$('#header-outer .cart-menu').css({  
7274				'padding-bottom' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding + logoHeight/2 + 7),
7275				'padding-top' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding + logoHeight/2 + 7)
7276			});	
7277		}
7278		
7279			
7280		$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').css({
7281			'padding-bottom' : (logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2),
7282			'padding-top' : (logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2)
7283		});	
7284
7285		$('.slide-out-hover-icon-effect a').css({
7286			'padding-top' : headerPadding
7287		});	
7288
7289		
7290		if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
7291			$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').css({
7292				'padding-top': 0,
7293				'padding-bottom': 0
7294			});
7295
7296			$('header#top nav > ul.buttons').css({
7297				'margin-top' : - headerPadding,
7298				'height' : Math.floor(logoHeight + headerPadding*2) -1
7299			});
7300
7301			$('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({
7302				'visibility' : 'visible',
7303				'padding-top': Math.floor((logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding),
7304				'padding-bottom': Math.floor((logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding)
7305			});
7306		}
7307		
7308		$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').css({
7309			'top' : $('header#top nav > ul > li > a').outerHeight() 
7310		});	
7311		
7312		
7313		setTimeout(function(){ 
7314			$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').css({
7315				'top': parseInt($('#header-outer').outerHeight())+'px'
7316			}); 
7317		},1000);
7318		
7319		$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').css({
7320			'top': parseInt($('#header-outer').outerHeight())+'px'
7321		});
7322
7323		//header space
7324		if($('.nectar-parallax-scene.first-section').length == 0) {
7325
7326			if($('#header-outer').attr('data-using-secondary') == '1'){
7327				if($('#header-outer[data-mobile-fixed="false"]').length > 0  || $('body.mobile').length == 0 ) {
7328					$('#header-space').css('height', parseInt($('#header-outer').outerHeight()) + $('#header-secondary-outer').height());
7329					
7330				} else {
7331					$('#header-space').css('height', parseInt($('#header-outer').outerHeight()));
7332					
7333				}
7334				
7335			} else {
7336
7337				$('#header-space').css('height', $('#header-outer').outerHeight() );
7338			} 
7339		}
7340		
7341		$('#header-outer .container, #header-outer .cart-menu').css('visibility','visible');
7342		
7343		centeredLogoMargins();
7344
7345		if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
7346			$('body:not(.ascend) #search-outer, #search .container').css({
7347				'height' : logoHeight + headerPadding*2
7348			});	
7349			
7350			$('body:not(.ascend) #search-outer > #search input[type="text"]').css({
7351				'font-size'  : 43,
7352				'height' : '59px',
7353				'top' : ((logoHeight + headerPadding*2)/2) - $('#search-outer > #search input[type="text"]').height()/2
7354			});
7355			
7356			$('body:not(.ascend) #search-outer > #search #close a').css({
7357				'top' : ((logoHeight + headerPadding*2)/2) - 8
7358			});	
7359		} else {
7360			$('body:not(.ascend) #search-outer, #search .container').css({
7361				'height' : logoHeight + headerPadding*2 + logoHeight + 17
7362			});	
7363			
7364			$('body:not(.ascend) #search-outer > #search input[type="text"]').css({
7365				'font-size'  : 43,
7366				'height' : '59px',
7367				'top' : ((logoHeight + headerPadding*2)/2) - ($('#search-outer > #search input[type="text"]').height()/2) + logoHeight/2 + 17
7368			});
7369			
7370			$('body:not(.ascend) #search-outer > #search #close a').css({
7371				'top' : ((logoHeight + headerPadding*2)/2) - 8 + logoHeight/2 + 17
7372			});	
7373		}
7374		
7375		//if no image is being used
7376		//if(usingLogoImage == false) $('header#top #logo').addClass('no-image');
7377		
7378	}
7379	
7380	//one last check to make sure the header space is correct (only if the user hasn't scrolled yet)
7381	$(window).load(function(){
7382		if($(window).scrollTop() == 0 ) headerSpace();
7383	});
7384	
7385	
7386	//is header resize on scroll enabled?
7387	var headerResize = $('#header-outer').attr('data-header-resize');
7388	var headerHideUntilNeeded = $('body').attr('data-hhun');
7389
7390	//transparent fix
7391	if($(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) $('#header-outer').removeClass('transparent');
7392
7393	if( headerResize == 1 && headerHideUntilNeeded != '1'){
7394		
7395		headerInit();
7396
7397		$(window).off('scroll.headerResizeEffect');
7398
7399		if($('#nectar_fullscreen_rows').length == 0)
7400			$(window).on('scroll.headerResizeEffect',smallNav);
7401
7402	} else if(headerHideUntilNeeded != '1') {
7403		headerInit();
7404		$(window).off('scroll.headerResizeEffectOpaque');
7405		$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
7406		
7407	} else if(headerHideUntilNeeded == '1') {
7408
7409		headerInit();
7410
7411		if($('.nectar-box-roll').length > 0) $('#header-outer').addClass('at-top-before-box');
7412
7413		var previousScroll = 0, // previous scroll position
7414        menuOffset = $('#header-space').height()*2, // height of menu (once scroll passed it, menu is hidden)
7415        detachPoint = ($('body.mobile').length > 0) ? 150 : 600, // point of detach (after scroll passed it, menu is fixed)
7416        hideShowOffset = 6; // scrolling value after which triggers hide/show menu
7417
7418	    // on scroll hide/show menu
7419	    function hhunCalcs(e) {
7420
7421	     //stop scrolling while animated anchors
7422	     if($('body.animated-scrolling').length > 0 && $('#header-outer.detached').length > 0) return false;
7423
7424	     //stop on mobile if not using sticky option
7425	      if($('#header-outer[data-mobile-fixed="false"]').length > 0 && $('body.mobile').length > 0) {  $('#header-outer').removeClass('detached'); return false; }
7426
7427	      var currentScroll = $(this).scrollTop(), // gets current scroll position
7428	            scrollDifference = Math.abs(currentScroll - previousScroll); // calculates how fast user is scrolling
7429
7430	      if (!$('#header-outer').hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) {
7431	       
7432	        // if scrolled past menu
7433	        if (currentScroll > menuOffset) {
7434	          // if scrolled past detach point add class to fix menu
7435	          if (currentScroll > detachPoint) {
7436	            if (!$('#header-outer').hasClass('detached'))
7437	              $('#header-outer').addClass('detached').removeClass('parallax-contained');
7438	         
7439	          	  if($('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent');
7440	          }
7441
7442	          // if scrolling faster than hideShowOffset hide/show menu
7443	          if (scrollDifference >= hideShowOffset) {
7444	            if (currentScroll > previousScroll) {
7445	              // scrolling down; hide menu
7446	              if (!$('#header-outer').hasClass('invisible'))
7447	                $('#header-outer').addClass('invisible').removeClass('at-top');
7448	                $('.page-submenu.stuck').css('transform','translateY(0px)').addClass('header-not-visible');
7449	            	
7450	            } else {
7451	              // scrolling up; show menu
7452	              if ($('#header-outer').hasClass('invisible'))
7453	                $('#header-outer').removeClass('invisible');
7454	          	    $('.page-submenu.stuck').css('transform','translateY('+$('#header-outer').outerHeight()+'px)').removeClass('header-not-visible');
7455	            }
7456	          }
7457	        } else {
7458	          // only remove “detached” class if user is at the top of document (menu jump fix)
7459	          $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 : 0;
7460	          if($('.body-border-top').length > 0) {
7461	          		$topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 + $('.body-border-top').height() : $('.body-border-top').height();
7462	          }
7463
7464	          if (currentScroll <= $topDetachNum){
7465	            $('#header-outer').removeClass('detached').addClass('at-top');
7466	            
7467	            if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent').css('transform','translateY(0)');
7468	            else if($('.nectar-box-roll').length > 0) $('#header-outer').css('transform','translateY(0)').addClass('at-top-before-box');
7469
7470	            if($('.parallax_slider_outer').length >
7470 0 || $('#page-header-bg[data-parallax="1"]').length > 0) $('#header-outer').addClass('parallax-contained').css('transform','translateY(0)');
7471	          }
7472	        }
7473
7474	        // if user is at the bottom of document show menu
7475	        if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
7476	          $('#header-outer').removeClass('invisible');
7477	          $('.page-submenu.stuck').css('transform','translateY('+$('#header-outer').outerHeight()+'px)').removeClass('header-not-visible');
7478	        }
7479
7480	      }
7481
7482	      // replace previous scroll position with new one
7483	      previousScroll = currentScroll;
7484
7485	    }
7486
7487	    hhunCalcs();
7488	    $(window).scroll(hhunCalcs);
7489
7490
7491	}//end if hhun
7492	
7493	if($('#nectar_fullscreen_rows').length == 0) midnightInit(); //init midnight	
7494	else ($('#header-outer').attr('data-permanent-transparent','false'))
7495
7496	var shrinkNum = 6;
7497	var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
7498	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;
7499	if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
7500
7501	function smallNav(){
7502		var $offset = $(window).scrollTop();
7503		var $windowWidth = $(window).width();
7504		
7505
7506		if($offset > 0 && $windowWidth > 1000) {
7507			
7508			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');
7509			$('.ns-loading-cover').hide();
7510			
7511			$('#header-outer, #search-outer').addClass('small-nav');
7512			
7513			$('#header-outer #logo img').stop(true,true).animate({
7514				'height' : logoHeight - shrinkNum
7515			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7516				
7517			$('#header-outer').stop(true,true).animate({
7518				'padding-top' : Math.ceil(headerPadding / 1.8)
7519			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7520			
7521
7522			$('header#top nav > ul > li:not(#social-in-menu) > a').stop(true,true).animate({
7523				'padding-bottom' :  Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding / 1.8) ,
7524				'padding-top' :  Math.floor(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) 
7525			},{queue:false, duration:250, easing: 'easeOutCubic'});	 
7526
7527			//body border full width side padding
7528			if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true) {
7529				$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
7530					'padding' : '0'			
7531				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7532			}
7533
7534			$('header#top nav > ul > li#social-in-menu > a').stop(true,true).animate({
7535				'margin-bottom' :  Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding / 1.8) ,
7536				'margin-top' :  Math.floor(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) 
7537			},{queue:false, duration:250, easing: 'easeOutCubic'});	 
7538			
7539			$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
7540				'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(shrinkNum)*4) +'px'
7541			},{queue:false, duration:250, easing: 'easeOutCubic'});	 
7542
7543			if($bodyBorderHeaderColorMatch == true) {
7544				$('.body-border-top').stop(true,true).animate({
7545					'margin-top': '-'+$('.body-border-top').height()+'px'
7546				},{queue:false, duration:400, easing: 'easeOutCubic', complete: function() { $(this).css('margin-top',0)} });	 
7547			}
7548
7549			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
7550				$('#header-outer .cart-menu').stop(true,true).animate({
7551					'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding/ 1.7),
7552					'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding/ 1.7) +1
7553				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7554			} else {
7555				/*$('#header-outer img.starting-logo').stop(true,true).animate({
7556					'margin-top' :  '-' + (logoHeight + 17 - shrinkNum) + 'px'
7557				},{queue:false, duration:250, easing: 'easeOutCubic'});	*/
7558
7559				$('#header-outer .cart-menu').stop(true,true).animate({
7560					'padding-bottom' : Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding / 1.7) + (logoHeight-shrinkNum)/2 + 9,
7561					'padding-top' : Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding / 1.7) + (logoHeight-shrinkNum)/2 + 9
7562				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7563			}
7564			
7565			if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
7566				$('header#top nav > ul.buttons').stop(true,true).animate({
7567					'margin-top' : - Math.ceil(headerPadding/ 1.8),
7568					'height' : Math.floor((headerPadding*2)/ 1.8 + logoHeight-shrinkNum)
7569				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7570
7571				$('header#top nav > ul li#search-btn a, header#top nav > ul li.slide-out-widget-area-toggle a').stop(true,true).animate({
7572					'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding/ 1.7),
7573					'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding/ 1.7) +1
7574				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7575
7576			} else {
7577				$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').stop(true,true).animate({
7578					'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul li#search-btn a').height()/2)),
7579					'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul li#search-btn a').height()/2))
7580				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7581			}
7582
7583			$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
7584				'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),
7585			},{queue:false, duration:250, easing: 'easeOutCubic'});		
7586			
7587			
7588			$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').stop(true,true).animate({
7589				'top': Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8) +'px'
7590			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7591		
7592
7593			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
7594				$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
7595					'height' : Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8)
7596				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7597
7598				$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
7599					'font-size'  : 30,
7600					'line-height' : '30px',
7601					'height' : '44px',
7602					'top' : ((logoHeight-shrinkNum+headerPadding+5)/2) - ($('#search-outer > #search input[type="text"]').height()-15)/2
7603				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7604			
7605				$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
7606					'top' : ((logoHeight-shrinkNum + headerPadding+5)/2) - 10
7607				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7608
7609			} else {
7610				$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
7611					'height' : Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8) + logoHeight - shrinkNum + 17
7612				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7613
7614				$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
7615					'font-size'  : 30,
7616					'line-height' : '30px',
7617					'height' : '44px',
7618					'top' : ((logoHeight-shrinkNum+headerPadding+5)/2) - ($('#search-outer > #search input[type="text"]').height()-15)/2 + (logoHeight- shrinkNum)/2 + 8
7619				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7620
7621				$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
7622					'top' : ((logoHeight-shrinkNum + headerPadding+5)/2) - 10 + (logoHeight- shrinkNum)/2 + 8
7623				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7624			}
7625
7626		
7627			
7628
7629			//box roll
7630			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'})
7631			
7632			
7633			if($('body').hasClass('ascend')){ 
7634				$('#search-outer').stop(true,true).animate({
7635					'top' : Math.floor((logoHeight-shrinkNum) +(headerPadding*2)/ 1.8 + extraHeight + secondaryHeader)
7636				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7637			}
7638			
7639			//if no image is being used
7640			if(usingLogoImage == false) $('header#top #logo').stop(true,true).animate({
7641				'margin-top' : 0
7642			},{queue:false, duration:450, easing: 'easeOutExpo'});	
7643			
7644			$(window).off('scroll',smallNav);
7645			$(window).on('scroll',bigNav);
7646
7647			//dark slider coloring border fix
7648			$('#header-outer[data-transparent-header="true"]').css('transition','background-color 0.40s ease, box-shadow 0.40s ease, margin 0.25s ease-out');
7649			$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','none');
7650			setTimeout(function(){ 
7651				$('#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'); 
7652				$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','border-color 0.40s ease');
7653			},300);
7654
7655		}
7656
7657	}
7658	
7659	function bigNav(){
7660		var $offset = $(window).scrollTop();
7661		var $windowWidth = $(window).width();
7662
7663		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) {
7664			
7665			$('#header-outer, #search-outer').removeClass('small-nav');
7666			
7667			if($('#header-outer').attr('data-transparent-header') == 'true'  && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent');
7668			$('.ns-loading-cover').show();
7669			
7670			$('#header-outer #logo img').stop(true,true).animate({
7671				'height' : logoHeight,				
7672			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7673			
7674
7675			//body border full width side padding
7676			if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true) {
7677				$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
7678					'padding' : '0 28px'			
7679				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7680			}
7681
7682			$('#header-outer').stop(true,true).animate({
7683				'padding-top' : headerPadding 
7684			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7685			
7686			$('header#top nav > ul > li:not(#social-in-menu) > a').stop(true,true).animate({
7687				'padding-bottom' : ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding,
7688				'padding-top' : (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2) 
7689			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7690
7691			$('header#top nav > ul > li#social-in-menu > a').stop(true,true).animate({
7692				'margin-bottom' : ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding,
7693				'margin-top' : (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2) 
7694			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7695				
7696			$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
7697				'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(shrinkNum)*4) +'px'
7698			},{queue:false, duration:250, easing: 'easeOutCubic'});	 
7699
7700			if($bodyBorderHeaderColorMatch == true) {
7701				$('.body-border-top').css({ 'margin-top': '-'+$('.body-border-top').height()+'px'}).stop(true,true).animate({
7702					'margin-top': '0'
7703				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
7704			}
7705
7706			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
7707				$('#header-outer .cart-menu').stop(true,true).animate({
7708					'padding-bottom' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding),
7709					'padding-top' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding)
7710				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7711			} else {
7712				/*$('#header-outer img.starting-logo').stop(true,true).animate({
7713					'margin-top' :  '-' + (logoHeight + 17) + 'px'
7714				},{queue:false, duration:250, easing: 'easeOutCubic'});	*/
7715
7716				$('#header-outer .cart-menu').stop(true,true).animate({
7717					'padding-bottom' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding) + logoHeight/2 + 7,
7718					'padding-top' : Math.ceil(((logoHeight/2) - ($('header#top nav ul #search-btn a').height()/2)) + headerPadding) + logoHeight/2 + 7
7719				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7720			}
7721
7722			if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
7723				$('header#top nav > ul.buttons').stop(true,true).animate({
7724					'margin-top' : - Math.ceil(headerPadding),
7725					'height' : Math.floor(headerPadding*2 + logoHeight) -1
7726				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7727
7728				$('header#top nav > ul li#search-btn a, header#top nav > ul li.slide-out-widget-area-toggle a').stop(true,true).animate({
7729					'padding-top': Math.floor((logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding),
7730					'padding-bottom': Math.floor((logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2) + headerPadding)
7731				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7732			} else {
7733				$('header#top nav > ul li#search-btn, header#top nav > ul li.slide-out-widget-area-toggle').stop(true,true).animate({
7734					'padding-bottom' : Math.floor((logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2)),
7735					'padding-top' : Math.ceil((logoHeight/2) - ($('header#top nav > ul li#search-btn a').height()/2))
7736				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7737			}
7738			
7739			$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
7740				'top' : Math.ceil($('header#top nav > ul > li > a').height() + (((logoHeight)/2) - ($('header#top nav > ul > li > a').height()/2))*2 + headerPadding),
7741			},{queue:false, duration:250, easing: 'easeOutCubic'});		
7742			
7743			$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').stop(true,true).animate({
7744				'top': Math.ceil(logoHeight + headerPadding*2) +'px'
7745			},{queue:false, duration:250, easing: 'easeOutCubic'});	
7746			
7747			
7748			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
7749				$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
7750					'height' : Math.ceil(logoHeight + headerPadding*2)
7751				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7752				
7753				$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
7754					'font-size'  : 43,
7755					'line-height' : '43px',
7756					'height' : '59px',
7757					'top' : ((logoHeight + headerPadding*2)/2) - 30
7758				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7759				
7760				
7761				$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
7762					'top' : ((logoHeight + headerPadding*2)/2) - 8
7763				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7764				
7765			} else {
7766				$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
7767					'height' : Math.ceil(logoHeight + headerPadding*2) + logoHeight + 17
7768				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7769				
7770				$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
7771					'font-size'  : 43,
7772					'line-height' : '43px',
7773					'height' : '59px',
7774					'top' : ((logoHeight + headerPadding*2)/2) - 30 + (logoHeight)/2 + 8
7775				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7776				
7777				
7778				$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
7779					'top' : ((logoHeight + headerPadding*2)/2) - 8 + (logoHeight)/2 + 8
7780				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7781			}
7782
7783
7784			if($('body').hasClass('ascend')){ 
7785				$('#search-outer').stop(true,true).animate({
7786					'top' : (logoHeight) +(headerPadding*2) + extraHeight + secondaryHeader
7787				},{queue:false, duration:250, easing: 'easeOutCubic'});	
7788			}
7789
7790			//if no image is being used
7791			if(usingLogoImage == false) $('header#top #logo').stop(true,true).animate({
7792				'margin-top' : 4
7793			},{queue:false, duration:450, easing: 'easeOutExpo'});	
7794			
7795
7796				//box roll
7797			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'})
7798			
7799
7800			$(window).off('scroll',bigNav);
7801			$(window).on('scroll',smallNav);
7802
7803
7804			//dark slider coloring border fix
7805			$('#header-outer[data-transparent-header="true"]').css('transition','background-color 0.40s ease, box-shadow 0.40s ease, margin 0.25s ease-out');
7806			$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','none');
7807			setTimeout(function(){ 
7808				$('#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'); 
7809				$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','border-color 0.40s ease');
7810			},300);
7811		}
7812
7813	}
7814	
7815	
7816	function headerSpace() {
7817		if($('.mobile').length > 0) {
7818			if(window.innerHeight < window.innerWidth && window.innerWidth > 1000) {
7819				if($('#header-outer.small-nav').length == 0)
7820					$('#header-space').css('height', $('#header-outer').outerHeight() + $('#header-secondary-outer').height());
7821			} else {
7822				$('#header-space').css('height', $('#header-outer').outerHeight());
7823			}
7824			
7825		} else {
7826			if($('.nectar-parallax-scene.first-section').length == 0) {
7827
7828				var shrinkNum = 6;	
7829				var headerPadding = parseInt($('#header-outer').attr('data-padding'));
7830				if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
7831				var headerPadding2 = headerPadding - headerPadding/1.8;
7832				var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0 ) ? $('#header-outer').outerHeight() + (parseInt(shrinkNum) + headerPadding2*2) : $('#header-outer').outerHeight();
7833
7834				if($('#header-outer').attr('data-using-secondary') == '1'){
7835					$('#header-space').css('height', $headerHeight + $('#header-secondary-outer').height());
7836				} else {
7837					$('#header-space').css('height', $headerHeight);
7838				} 
7839			}
7840		}
7841		
7842	}
7843
7844	var lastPosition = -1;
7845	function headerOffsetAdjust(){
7846		
7847		var $scrollTop = $(window).scrollTop();
7848
7849		 if (lastPosition == $scrollTop) {
7850            requestAnimationFrame(headerOffsetAdjust);
7851            return false;
7852        } else lastPosition = $scrollTop;
7853		
7854		headerOffsetAdjustCalc();
7855
7856		requestAnimationFrame(headerOffsetAdjust);
7857
7858	}
7859
7860	function headerOffsetAdjustCalc() {
7861		if($('body.mobile').length > 0) {
7862			var $eleHeight = 0;
7863			var $endOffset = ($('#wpadminbar').css('position') == 'fixed') ? $('#wpadminbar').height() : 0;
7864			if($('#header-secondary-outer').length > 0) $eleHeight += $('#header-secondary-outer').height();
7865			if($('#wpadminbar').length > 0) $eleHeight += $('#wpadminbar').height();
7866
7867			if( $eleHeight - $scrollTop > $endOffset) { 
7868				$('#header-outer').css('top', $eleHeight - $scrollTop + 'px');
7869			}
7870			else { $('#header-outer').css('top', $endOffset); }
7871
7872		} else {
7873			var $eleHeight = 0;
7874			if($('#header-secondary-outer').length > 0) $eleHeight += $('#header-secondary-outer').height();
7875			if($('#wpadminbar').length > 0) $eleHeight += $('#wpadminbar').height();
7876			$('#header-outer').css('top',$eleHeight+'px');
7877		}
7878	}
7879
7880	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) {
7881		if($('#nectar_fullscreen_rows').length == 0) requestAnimationFrame(headerOffsetAdjust);
7882		$(window).smartresize(headerOffsetAdjustCalc);
7883	}
7884		
7885
7886	function footerRevealCalcs() {
7887		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) {
7888			$resizeExtra = ($('#header-outer[data-header-resize="1"]').length > 0) ? 55: 0;
7889			$('.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 });
7890		} else {
7891			$('.container-wrap').css({'margin-bottom': $('#footer-outer').height()-1 });
7892		}
7893		
7894		if( $(window).width() < 1000) $('#footer-outer').attr('data-midnight','light');
7895		else $('#footer-outer').removeAttr('data-midnight');
7896	}
7897	if($('body[data-footer-reveal="1"]').length > 0) { 
7898		footerRevealCalcs();
7899		//set shadow to match BG color if applicable
7900		if($('body[data-footer-reveal-shadow="large_2"]').length > 0) $('.container-wrap').css({ boxShadow: '0 70px 110px -30px '+$('#footer-outer').css('backgroundColor') });
7901	}
7902	
7903	function opaqueCheck(){
7904		var $offset = $(window).scrollTop();
7905		var $windowWidth = $(window).width();
7906
7907		if($offset > 0 && $windowWidth > 1000) {
7908			
7909			if($('#header-outer').attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent').addClass('scrolled-down');
7910			$('.ns-loading-cover').hide();
7911			
7912			$(window).off('scroll',opaqueCheck);
7913			$(window).on('scroll',transparentCheck);
7914		}
7915	}
7916	
7917	
7918	function transparentCheck(){
7919		var $offset = $(window).scrollTop();
7920		var $windowWidth = $(window).width();
7921
7922		if($offset == 0 && $windowWidth > 1000) {
7923			
7924			if($('#header-outer').attr('data-transparent-header') == 'true') $('#header-outer').addClass('transparent').removeClass('scrolled-down');
7925			$('.ns-loading-cover').show();
7926			
7927			$(window).off('scroll',transparentCheck);
7928			$(window).on('scroll',opaqueCheck);
7929		}
7930	}
7931	
7932	var adminBarHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
7933
7934	//header inherit row color effect
7935	function headerRowColorInheritInit(){
7936		if($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0){
7937			
7938			var headerOffset = ($('#header-outer[data-permanent-transparent="1"]').length == 0) ? (logoHeight - shrinkNum) + Math.ceil((headerPadding*2) / 1.8) + adminBarHeight : logoHeight/2 + headerPadding + adminBarHeight;
7939			
7940			$('.main-content > .row > .wpb_row').each(function(){
7941
7942
7943				var $that = $(this);
7944				var waypoint = new Waypoint({
7945	 				element: $that,
7946		 			handler: function(direction) {
7947	
7948
7949						if(direction == 'down') {
7950							
7951							if($that.find('.row-bg.using-bg-color').length > 0) {
7952								
7953								var $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
7954								$('#header-outer').css('background-color',$that.find('.row-bg').css('background-color')).removeClass('light-text').removeClass('dark-text').addClass($textColor);
7955								$('#header-outer').attr('data-current-row-bg-color',$that.find('.row-bg').css('background-color'));
7956							} else {
7957								$('#header-outer').css('background-color',$('#header-outer').attr('data-user-set-bg')).removeClass('light-text').removeClass('dark-text');
7958								$('#header-outer').attr('data-current-row-bg-color',$('#header-outer').attr('data-user-set-bg'));
7959							}
7960						
7961						} else {
7962
7963							if($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) {
7964								var $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
7965								$('#header-outer').css('background-color',$that.prev('div.wpb_row').find('.row-bg').css('background-color')).removeClass('light-text').removeClass('dark-text').addClass($textColor);
7966								$('#header-outer').attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color'));
7967							} else {
7968								$('#header-outer').css('background-color',$('#header-outer').attr('data-user-set-bg')).removeClass('light-text').removeClass('dark-text');
7969								$('#header-outer').attr('data-current-row-bg-color',$('#header-outer').attr('data-user-set-bg'));
7970							}
7971
7972						} 
7973
7974				
7975					},
7976					offset: headerOffset
7977
7978				}); 
7979
7980
7981			});
7982		}
7983	}
7984
7985	//if($('.nectar-box-roll').length == 0) headerRowColorInheritInit();
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995/****************sticky page submenu******************/
7996	if($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) {
7997
7998		(function() {
7999		  'use strict'
8000
8001		  var $ = window.jQuery
8002		  var Waypoint = window.Waypoint
8003		  var $offsetHeight = 0; 
8004		  var shrinkNum = 6;	
8005		  var headerPadding = parseInt($('#header-outer').attr('data-padding'));
8006		  if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
8007		  var headerPadding2 = headerPadding - headerPadding/1.8;
8008		  var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('body.mobile').length == 0) ? $('#header-outer').outerHeight() - (parseInt(shrinkNum) + headerPadding2*2) : $('#header-outer').outerHeight();
8009
8010		  if($('#header-secondary-outer').length > 0 && $('body.mobile').length == 0) $headerHeight += $('#header-secondary-outer').height();
8011
8012		  
8013
8014		  $(window).on('smartresize',function(){
8015
8016		  	$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();
8017		  	if($('#header-secondary-outer').length > 0  && $('body.mobile').length == 0) $headerHeight += $('#header-secondary-outer').height();
8018
8019		  	$offsetHeight = 0; 
8020		
8021		  	  if($('#wpadminbar').length > 0 && $('#wpadminbar').css('position') == 'fixed') $offsetHeight += $('#wpadminbar').height();
8022 			  if($('body[data-hhun="0"] #header-outer').length > 0 && !($('body.mobile').length > 0 && $('#header-outer[data-mobile-fixed="false"]').length > 0) ) $offsetHeight += $headerHeight;
8023 	
8024 			 // else if($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) $offsetHeight += $headerHeight;
8025 			
8026 			 //recalc for resizing (same as stuck/unstuck logic below)
8027 			 if($('.page-submenu.stuck').length > 0) {
8028
8029		        	$('.page-submenu.stuck').addClass('no-trans').css('top',$offsetHeight).css('transform','translateY(0)').addClass('stuck');
8030		        	var $that = this;
8031		        	setTimeout(function(){ $('.page-submenu.stuck').removeClass('no-trans'); },50);
8032		        	$('.page-submenu.stuck').parents('.wpb_row').css('z-index',10000);
8033
8034		        	//boxed
8035		        	if($('#boxed').length > 0) { 
8036		        		var $negMargin = ($(window).width() > 1000) ? $('.container-wrap').width()*0.04 :39;
8037		        		$('.page-submenu.stuck').css({'margin-left':'-'+$negMargin+'px', 'width' : $('.container-wrap').width()});
8038		        	}
8039
8040		        }
8041		        else { 
8042		        	$('.page-submenu.stuck').css('top','0').removeClass('stuck');
8043		       	   $('.page-submenu.stuck').parents('.wpb_row').css('z-index','auto');
8044
8045		       	    if($('#boxed').length > 0) $('.page-submenu.stuck').css({'margin-left':'0px', 'width' : '100%'});
8046		       	}
8047
8048		  });
8049
8050		  /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */
8051		  function Sticky(options) {
8052		    this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options)
8053		    this.element = this.options.element
8054		    this.$element = $(this.element)
8055		    this.createWrapper()
8056		    this.createWaypoint()
8057		  }
8058
8059		  /* Private */
8060		  Sticky.prototype.createWaypoint = function() {
8061		    var originalHandler = this.options.handler
8062
8063		    $offsetHeight = 0; 
8064		    if($('#wpadminbar').length > 0 && $('#wpadminbar').css('position') == 'fixed') $offsetHeight += $('#wpadminbar').height();
8065 			if($('body[data-hhun="0"] #header-outer').length > 0 && !($('body.mobile').length > 0 && $('#header-outer[data-mobile-fixed="false"]').length > 0)) $offsetHeight += $headerHeight;
8066
8067 		
8068		    this.waypoint = new Waypoint($.extend({}, this.options, {
8069		      element: this.wrapper,
8070		      handler: $.proxy(function(direction) {
8071		        var shouldBeStuck = this.options.direction.indexOf(direction) > -1
8072		        var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''
8073
8074		        this.$wrapper.height(wrapperHeight)
8075		        if(shouldBeStuck) {
8076		        	this.$element.addClass('no-trans').css('top',$offsetHeight).css('transform','translateY(0)').addClass('stuck');
8077		        	var $that = this;
8078		        	setTimeout(function(){ $that.$element.removeClass('no-trans'); },50);
8079		        	this.$element.parents('.wpb_row').css('z-index',10000);
8080
8081		        	//boxed
8082		        	if($('#boxed').length > 0) { 
8083		        		var $negMargin = ($(window).width() > 1000) ? $('.container-wrap').width()*0.04 :39;
8084		        		this.$element.css({'margin-left':'-'+$negMargin+'px', 'width' : $('.container-wrap').width()});
8085		        	}
8086
8087		        }
8088		        else { 
8089		        	this.$element.css('top','0').removeClass('stuck');
8090		       	    //this.$element.parents('.wpb_row').css('z-index','10000');
8091
8092		       	    if($('#boxed').length > 0) this.$element.css({'margin-left':'0px', 'width' : '100%'});
8093		       	}
8094
8095		        if (originalHandler) {
8096		          originalHandler.call(this, direction)
8097		        }
8098		      }, this),
8099		      offset: $offsetHeight
8100		    }))
8101
8102		    var $that = this;
8103
8104		   // if($('body[data-hhun="1"]').length > 0 ) {
8105			    setInterval(function(){ 
8106
8107			    	if($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0)
8108		        		$that.waypoint.options.offset = $offsetHeight + $headerHeight;
8109		        	else 
8110		        		$that.waypoint.options.offset = $offsetHeight;
8111			    	Waypoint.refreshAll();
8112			
8113			    },100); 
8114			//}
8115
8116		  }
8117
8118		  /* Private */
8119		  Sticky.prototype.createWrapper = function() {
8120		    if (this.options.wrapper) {
8121		      this.$element.wrap(this.options.wrapper)
8122		    }
8123		    this.$wrapper = this.$element.parent()
8124		    this.wrapper = this.$wrapper[0]
8125		  }
8126
8127		  /* Public */
8128		  Sticky.prototype.destroy = function() {
8129		    if (this.$element.parent()[0] === this.wrapper) {
8130		      this.waypoint.destroy()
8131		      this.$element.removeClass(this.options.stuckClass)
8132		      if (this.options.wrapper) {
8133		        this.$element.unwrap()
8134		      }
8135		    }
8136		  }
8137
8138		  Sticky.defaults = {
8139		    wrapper: '<div class="sticky-wrapper" />',
8140		    stuckClass: 'stuck',
8141		    direction: 'down right'
8142		  }
8143
8144		  Waypoint.Sticky = Sticky
8145		}())
8146		;
8147
8148		//remove outside of column setups 
8149		if($('.page-submenu').parents('.span_12').find('> .wpb_column').length > 1){
8150			var pageMenu = $('.page-submenu').clone();
8151			var pageMenuParentRow = $('.page-submenu').parents('.wpb_row');
8152			$('.page-submenu').remove();
8153			pageMenuParentRow.before(pageMenu);
8154		}
8155
8156		var sticky = new Waypoint.Sticky({
8157		  element: $('.page-submenu[data-sticky="true"]')[0]
8158		});
8159
8160
8161	}
8162
8163	if($('#nectar_fullscreen_rows').length == 0)
8164		$('.page-submenu').parents('.wpb_row').css('z-index',10000);
8165
8166	$('.page-submenu .mobile-menu-link').on('click',function(){
8167		$(this).parents('.page-submenu').find('ul').stop(true).slideToggle(350);
8168		return false;
8169	});
8170
8171	$('.page-submenu ul li a').on('click',function(){
8172		if($('body.mobile').length > 0) $(this).parents('.page-submenu').find('ul').stop(true).slideToggle(350);
8173	});
8174
8175
8176
8177
8178
8179	//responsive nav
8180	$('body').on('click','#toggle-nav',function(){
8181		$(this).find('.lines-button').toggleClass('close');
8182		$('#mobile-menu').stop(true,true).slideToggle(500);
8183		return false;
8184	});
8185	
8186	
8187	//add wpml to mobile menu
8188	if($('header#top nav > ul > li.menu-item-language').length > 0 && $('#header-secondary-outer ul > li.menu-item-language').length == 0){
8189		var $langSelector = $('header#top nav > ul > li.menu-item-language').clone();
8190		$langSelector.insertBefore('#mobile-menu ul #mobile-search');
8191	}
8192	
8193	////append dropdown indicators / give classes
8194	$('#mobile-menu .container ul li').each(function(){
8195		if($(this).find('> ul').length > 0) {
8196			 $(this).addClass('has-ul');
8197			 $(this).find('> a').append('<span class="sf-sub-indicator"><i class="icon-angle-down"></i></span>');
8198		}
8199	});
8200	
8201	////events
8202	$('#mobile-menu .container ul li:has(">ul") > a .sf-sub-indicator').click(function(){
8203		$(this).parent().parent().toggleClass('open');
8204		$(this).parent().parent().find('> ul').stop(true,true).slideToggle();
8205		return false;
8206	});
8207	
8208
8209
8210/*-------------------------------------------------------------------------*/
8211/*	5.	Page Specific
8212/*-------------------------------------------------------------------------*/	
8213
8214	//recent work
8215	function piVertCenter() {
8216		$('.portfolio-items  > .col').each(function(){
8217				
8218			//style 4
8219			$(this).find('.style-4 .work-info .bottom-meta:not(.shown)').stop().animate({
8220				'bottom' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()-2+'px'
8221			},420,'easeOutCubic');
8222
8223			
8224		});	 
8225	}
8226	
8227	$(window).load(function(){
8228	 	 portfolioCommentOrder();
8229	 	 fullWidthContentColumns();
8230	 	 resizeVideoToCover();
8231	});
8232	
8233	
8234	//ie8 width fix
8235	function ie8Width(){
8236		if( $(window).width() >= 1300 ) {
8237			$('.container').css('max-width','1100px');
8238		} else {
8239			$('.container').css('max-width','880px');
8240		}
8241	}
8242	
8243	if( $(window).width() >= 1300 && $('html').hasClass('no-video')) { $('.container').css('max-width','1100px'); $(window).resize(ie8Width); };
8244	
8245
8246
8247	function smartResizeInit() {
8248
8249		 //carousel height calcs
8250		 carouselHeightCalcs();
8251		 clientsCarouselHeightRecalc();
8252
8253		 //portfolio comment order
8254		 portfolioCommentOrder();
8255		 
8256		 //testimonial slider height
8257		 testimonialHeightResize(); //animated
8258		 testimonialSliderHeight(); //non-animated
8259		 
8260		 //full width content columns sizing
8261		 fullWidthContentColumns();
8262
8263		 //parallax BG Calculations
8264		 if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
8265		   parallaxRowsBGCals();
8266		 }
8267
8268		 headerSpace();
8269
8270		 centeredLogoMargins();
8271
8272		 slideOutWidgetOverflowState();
8273		 recentPostHeight();
8274
8275		 morphingOutlines();
8276
8277		 flipBoxHeights();
8278
8279		 //full width menu megamenu adjust
8280		if($('.slide-out-widget-area-toggle a.open').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) fullWidthHeaderSlidingWidgetMenuCalc();
8281		  
8282	}
8283
8284    $(window).off('smartresize.srInit'); 
8285	$(window).on('smartresize.srInit', smartResizeInit); 
8286	
8287	
8288	
8289	function resizeInit() {
8290		 portfolioDeviceCheck();
8291
8292		 //fullwidth page section calcs
8293		 fullWidthSections(); 
8294		 fullwidthImgOnlySizing();
8295		 fullWidthContentColumns();
8296	  	 fullWidthRowPaddingAdjustCalc();
8297		 
8298		 //iframe video emebeds
8299		 responsiveVideoIframes();
8300		 videoshortcodeSize();
8301		 
8302		 if($('.nectar-social.full-width').length > 0) {
8303		 	nectarLoveFWCenter();
8304		 }
8305
8306		 if($('body').hasClass('ascend')){ 
8307			searchFieldCenter();
8308		 }
8309
8310		 if($('body').hasClass('single-post')) centerPostNextButtonImg();
8311		 
8312		 //fixed sidebar for portfolio
8313		 sidebarPxConversion();
8314
8315		 cascadingImageBGSizing();
8316
8317		 responsiveTooltips();
8318
8319		 //vc mobile columns
8320		 if($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) vcMobileColumns();
8321
8322		 if($('body[data-footer-reveal="1"]').length > 0) footerRevealCalcs();
8323
8324		 if($('#page-header-bg').length > 0) pageHeader();
8325
8326		 if($('.nectar-video-bg').length > 0) {
8327		 	resizeVideoToCover();
8328		 }
8329	}
8330
8331	$(window).off('resize.srInit'); 
8332	$(window).on('resize.srInit', resizeInit); 
8333
8334	$(window).on("orientationchange",function(){
8335	  setTimeout(clientsCarouselHeightRecalc,200);
8336	});
8337	
8338	//blog next post button
8339	function postNextButtonEffect(){
8340
8341		$('.blog_next_prev_buttons').imagesLoaded(function(){
8342
8343			centerPostNextButtonImg();
8344			
8345			$('.blog_next_prev_buttons img').css('opacity','1');
8346
8347			if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
8348				$('.blog_next_prev_buttons img').panr({
8349					scaleDuration: .28,
8350					sensitivity: 22,
8351					scaleTo: 1.06
8352				}); 
8353			}
8354
8355		});
8356	}
8357
8358	function centerPostNextButtonImg(){
8359		
8360		if($('.blog_next_prev_buttons').length == 0) return false;
8361
8362		if( $('.blog_next_prev_buttons img').height() >= $('.blog_next_prev_buttons').height() + 50 ) {
8363			var $height = 'auto';
8364			var $width = $('.blog_next_prev_buttons').width();
8365		} else {
8366
8367			if( $('.blog_next_prev_buttons').width() < $('.blog_next_prev_buttons img').width()) {
8368				var $height = $('.blog_next_prev_buttons').height() + 49;
8369				var $width = 'auto';
8370			} else {
8371				var $height = 'auto';
8372				var $width = '100%';
8373			}
8374			
8375		}
8376
8377		$('.blog_next_prev_buttons img').css({ 'height' : $height, 'width': $width });
8378
8379		$('.blog_next_prev_buttons img').css({
8380			'top' : ($('.blog_next_prev_buttons').height()/2) - ($('.blog_next_prev_buttons img').height()/2) + 'px',
8381			'left' : ($('.blog_next_prev_buttons').width()/2) - ($('.blog_next_prev_buttons img').width()/2) + 'px'
8382		});
8383
8384		$('.blog_next_prev_buttons .inner').each(function(){
8385			$(this).css({'top': $(this).parent().height()/2 - ($(this).height()/2), 'opacity':'1' });
8386		})
8387	}
8388	
8389	postNextButtonEffect();
8390
8391
8392	function recentPostHeight() {
8393		$('.blog-recent[data-style="title_only"]').each(function(){
8394			if($(this).find('> .col').length > 1) return false;
8395			if($(this).parent().parent().parent().hasClass('vc_col-sm-3') || 
8396				$(this).parent().parent().parent().hasClass('vc_col-sm-4') || 
8397				$(this).parent().parent().parent().hasClass('vc_col-sm-6') || 
8398				$(this).parent().parent().parent().hasClass('vc_col-sm-8') || 
8399				$(this).parent().parent().parent().hasClass('vc_col-sm-9')) {
8400				
8401				if($('body.mobile').length == 0 && $(this).next('div').length == 0) {
8402					var tallestColumn = 0;
8403					
8404					$(this).find('> .col').css('padding', '50px 20px');
8405
8406					$(this).parents('.span_12').find(' > .wpb_column').each(function(){
8407						(Math.floor($(this).height()) > tallestColumn) ? tallestColumn = Math.floor($(this).height()) : tallestColumn = tallestColumn;
8408					});	
8409			
8410					if(Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) {
8411						$(this).find('> .col').css('padding-top',(tallestColumn-$(this).find('> .col').height())/2 + 'px');
8412						$(this).find('> .col').css('padding-bottom',(tallestColumn-$(this).find('> .col').height())/2 + 'px');
8413					}
8414					
8415				}
8416				 else {
8417				 		$(this).find('> .col').css('padding', '50px 20px');
8418				}
8419			}
8420		});
8421	}
8422	recentPostHeight();
8423
8424
8425	//recent post slider
8426	function recentPostsFlickityInit() {
8427
8428		if($('.nectar-recent-posts-slider-inner').length == 0) return false;
8429
8430		var $rpF = $('.nectar-recent-posts-slider-inner').flickity({
8431			  contain: true,
8432			  draggable: true,
8433			  lazyLoad: false,
8434			  imagesLoaded: true,
8435			  percentPosition: true,
8436			  prevNextButtons: false,
8437			  pageDots: true,
8438			  resize: true,
8439			  setGallerySize: true,
8440			  wrapAround: true,
8441			  accessibility: false
8442		});
8443
8444		setTimeout(function(){
8445			$('.nectar-recent-posts-slider-inner').addClass('loaded');
8446		},1150);
8447		var flkty = $rpF.data('flickity');
8448	
8449		//$rpF.on( 'cellSelect', function() {
8450		// $(flkty.element).parents('.nectar-recent-posts-slider').find('h2:not(.post-ref-'+flkty.selectedIndex+')').hide().css('opacity','0');
8451		// $(flkty.element).parents('.nectar-recent-posts-slider').find('h2.post-ref-'+flkty.selectedIndex).show().transition({ 'opacity':1},600);
8452		//});
8453
8454		$rpF.on( 'dragStart', function() {
8455			$('.flickity-viewport').addClass('is-moving');
8456		});
8457		$rpF.on( 'dragEnd', function() {
8458			$('.flickity-viewport').removeClass('is-moving');
8459		});
8460
8461		recentPostSliderHeight();
8462		$(window).resize(recentPostSliderHeight);
8463
8464		if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
8465			$(window).resize(recentPostSliderParallaxMargins);
8466
8467		function recentPostSliderHeight(){
8468
8469			$('.nectar-recent-posts-slider').each(function(){
8470					
8471						var $heightCalc;
8472						var $minHeight = 250;
8473						var $windowWidth = $(window).width();
8474						var $definedHeight = parseInt($(this).attr('data-height'));
8475
8476						var dif = ($('body[data-ext-responsive="true"]').length > 0) ? $(window).width() / 1400 : $(window).width() / 1100;
8477
8478						if( window.innerWidth > 1000 && $('#boxed').length == 0) {
8479
8480							if($(this).parents('.full-width-content').length == 0) {
8481								if($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1400){
8482									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight));
8483								} else if($('body[data-ext-responsive="true"]').length == 0 && window.innerWidth >= 1100) {
8484									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight));
8485								} else {
8486									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
8487								}
8488								
8489							} else {
8490								$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
8491							}
8492							
8493						} else {
8494							
8495							//column sliders
8496							var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col') ;
8497							if($parentCol.length == 0) $parentCol = $('.main-content');
8498								
8499							if(!$parentCol.hasClass('vc_span12') && !$parentCol.hasClass('main-content') && !$parentCol.hasClass('span_12') && !$parentCol.hasClass('vc_col-sm-12') ) {
8500							
8501								var $parentColWidth = sliderColumnDesktopWidth($parentCol);
8502								var $aspectRatio = $definedHeight/$parentColWidth;
8503
8504								
8505								//min height
8506								if( $aspectRatio*$parentCol.width() <= $minHeight ){
8507									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$minHeight);
8508								} else {
8509									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$aspectRatio*$parentCol.width());
8510								}
8511							  
8512							} 
8513							
8514							
8515
8516							//regular
8517							else {
8518								
8519								//min height
8520								if( $definedHeight*dif <= $minHeight ){
8521									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$minHeight);
8522								} else {
8523									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
8524								}
8525								
8526							}
8527							
8528						}
8529						
8530	
8531					
8532				});
8533		
8534		}
8535
8536		////helper function
8537		function sliderColumnDesktopWidth(parentCol) {
8538			
8539			var $parentColWidth = 1100;
8540			var $columnNumberParsed = $(parentCol).attr('class').match(/\d+/);
8541			
8542			if($columnNumberParsed == '2') { $parentColWidth = 170 }
8543			else if($columnNumberParsed == '3') { $parentColWidth = 260 } 
8544			else if($columnNumberParsed == '4') { $parentColWidth = 340 } 
8545			else if($columnNumberParsed == '6') { $parentColWidth = 530 } 
8546			else if($columnNumberParsed == '8') { $parentColWidth = 700 } 
8547			else if($columnNumberParsed == '9') { $parentColWidth = 805 }
8548			else if($columnNumberParsed == '10') { $parentColWidth = 916.3 }
8549			else if($columnNumberParsed == '12') { $parentColWidth = 1100 }
8550		
8551			return $parentColWidth;
8552		}
8553
8554	
8555	}
8556	
8557	recentPostsFlickityInit();
8558
8559	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
8560		if($('.nectar-recent-posts-slider').length > 0) window.requestAnimationFrame(recentPostSliderParallax);
8561
8562	function recentPostSliderParallax(){
8563
8564		$('.nectar-recent-posts-slider').each(function(){
8565			var $offset = parseInt($(this).find('.flickity-slider').position().left);
8566			var $slideLength = $(this).find('.nectar-recent-post-slide').length;
8567			var $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index();
8568			var $slideWidth = $(this).find('.nectar-recent-post-slide').width();
8569			//wrapped fix
8570
8571			////first going to first
8572			if($offset >= -3) {
8573				$(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg').css('margin-left',parseInt(Math.ceil($slideWidth/3.5))+'px');
8574			} else {
8575				$(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg').css('margin-left','-'+parseInt(Math.ceil($slideWidth/3.5*$lastChildIndex))+'px');
8576			}
8577			////last going to first
8578			if(Math.abs($offset) >= ($slideLength-1) * $slideWidth) {
8579				$(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg').css('margin-left','-'+parseInt(Math.ceil(($slideWidth/3.5)*$slideLength))+'px');
8580			} else {
8581				$(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg').css('margin-left','0px');
8582			}
8583
8584			$(this).find('.nectar-recent-post-bg').css('transform','translateX('+Math.ceil($(this).find('.flickity-slider').position().left/-3.5)+'px)');
8585			
8586			
8587		});
8588		requestAnimationFrame(recentPostSliderParallax);
8589	}
8590
8591	function recentPostSliderParallaxMargins(){
8592
8593		$('.nectar-recent-posts-slider').each(function(){		
8594			var $slideWidth = $(this).find('.nectar-recent-post-slide').width();
8595			$(this).find('.nectar-recent-post-slide').each(function(i){
8596				$(this).find('.nectar-recent-post-bg').css('margin-left','-'+  parseInt(Math.ceil($slideWidth/3.5)*i)+'px');
8597			});
8598		
8599		});
8600	}
8601
8602	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
8603		recentPostSliderParallaxMargins();
8604
8605
8606	//portfolio item hover effect
8607	
8608	////desktop event 
8609	function portfolioHoverEffects() { 
8610
8611		if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(iPad|IEMobile)/)) {
8612			
8613			//style 1 & 2
8614			$('.portfolio-items .col .work-item:not(.style-3-alt):not(.style-3):not([data-custom-content="on"])').hover(function(){
8615				$(this).find('.work-info .vert-center').css({'margin-top' : 0});
8616				$(this).find('.work-info, .work-info .vert-center *, .work-info > i').css({'opacity' : 1});
8617				$(this).find('.work-info-bg').css({ 'opacity' : 0.9 });
8618			},function(){
8619				$(this).find('.work-info .vert-center').css({ 'margin-top' : -20 });
8620				$(this).find('.work-info, .work-info .vert-center *, .work-info > i').css({ 'opacity' : 0 });
8621				$(this).find('.work-info-bg').css({ 'opacity' : 0 });
8622			});
8623			
8624			
8625			//style 3
8626			$('.portfolio-items .col .work-item.style-3').hover(function(){
8627
8628				$(this).find('.work-info-bg').css({ 'opacity' : 0 });
8629
8630			},function(){
8631				
8632				$(this).find('.work-info-bg').css({ 'opacity' : 0.45 });
8633
8634			});
8635			
8636			
8637			//style 4
8638			$('.portfolio-items .col .work-item.style-4').hover(function(){
8639				
8640				$(this).find('img').stop().animate({
8641					'top' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()/2+'px'
8642				},250,'easeOutCubic');
8643				
8644				$(this).find('.work-info .bottom-meta').addClass('shown').stop().animate({
8645					'bottom' : '0px'
8646				},320,'easeOutCubic');
8647
8648			},function(){
8649				
8650				$(this).find('img').stop().animate({
8651					'top' : '0px'
8652				},250,'easeOutCubic');
8653				
8654				$(this).find('.work-info .bottom-meta').removeClass('shown').stop().animate({
8655					'bottom' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()-2+'px'
8656				},320,'easeOutCubic');
8657				
8658			});
8659		
8660		} 
8661		////mobile event
8662		else {
8663			portfolioDeviceCheck();
8664		}
8665
8666	}
8667
8668	portfolioHoverEffects();
8669
8670	function style6Img(){
8671
8672		//change sizer pos
8673		$('.style-5').each(function(){
8674			$(this).find('.sizer').insertBefore($(this).find('.parallaxImg'));
8675		});
8676
8677		//set parent zindex
8678		$('.style-5').parents('.wpb_row').css('z-index','100');
8679
8680		var d = document,
8681			de = d.documentElement,
8682			bd = d.getElementsByTagName('body')[0],
8683			htm = d.getElementsByTagName('html')[0],
8684			win = window,
8685			imgs = d.querySelectorAll('.parallaxImg'),
8686			totalImgs = imgs.length,
8687			supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints;
8688
8689		if(totalImgs <= 0){
8690			return;
8691		}
8692
8693		// build HTML
8694		for(var l=0;l<totalImgs;l++){
8695
8696			var thisImg = imgs[l],
8697				layerElems = thisImg.querySelectorAll('.parallaxImg-layer'),
8698				totalLayerElems = layerElems.length;
8699
8700			if(totalLayerElems <= 0){
8701				continue;
8702			}
8703
8704			while(thisImg.firstChild) {
8705				thisImg.removeChild(thisImg.firstChild);
8706			}
8707			
8708			var lastMove = 0;
8709
8710			//throttle performance for all browser other than chrome
8711			var eventThrottle = $('html').hasClass('cssreflections') ? 1 : 80;
8712			if(eventThrottle == 80) $('body').addClass('cssreflections');
8713
8714			var containerHTML = d.createElement('div'),
8715				shineHTML = d.createElement('div'),
8716				shadowHTML = d.createElement('div'),
8717				layersHTML = d.createElement('div'),
8718				layers = [];
8719
8720			thisImg.id = 'parallaxImg__'+l;
8721			containerHTML.className = 'parallaxImg-container';
8722			//shineHTML.className = 'parallaxImg-shine';
8723			shadowHTML.className = 'parallaxImg-shadow';
8724			layersHTML.className = 'parallaxImg-layers';
8725
8726			for(var i=0;i<totalLayerElems;i++){
8727				var layer = d.createElement('div'),
8728					layerInner = d.createElement('div'),
8729					imgSrc = layerElems[i].getAttribute('data-img');
8730
8731				$(layer).html($(layerElems[i]).html());
8732				layer.className = 'parallaxImg-rendered-layer';
8733				layer.setAttribute('data-layer',i);
8734
8735				if(i==0) { 
8736					layerInner.className = 'bg-img';
8737					layerInner.style.backgroundImage = 'url('+imgSrc+')';
8738					layer.appendChild(layerInner);
8739				}
8740				layersHTML.appendChild(layer);
8741
8742				layers.push(layer);
8743			}
8744
8745			containerHTML.appendChild(layersHTML);
8746			//containerHTML.appendChild(shineHTML);
8747			thisImg.appendChild(containerHTML);
8748			$(thisImg).wrap('<div class="parallaxImg-wrap" />');
8749			if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { $(thisImg).parent().append(shadowHTML); }
8750
8751			var w = thisImg.clientWidth || thisImg.offsetWidth || thisImg.scrollWidth;
8752			//thisImg.style.transform = 'perspective('+ w*3 +'px)';
8753
8754			if(supportsTouch){
8755				/*win.preventScroll = false;
8756
8757		        (function(_thisImg,_layers,_totalLayers,_shine) {
8758					$(thisImg).parents('.style-5').on('touchmove', function(e){
8759						if (win.preventScroll){
8760							e.preventDefault();
8761						}
8762						window.requestAnimationFrame(function(){
8763							processMovement(e,true,_thisImg,_layers,_totalLayers,_shine);
8764						});		
8765					});
8766		            $(thisImg).parents('.style-5').on('touchstart', function(e){
8767		            	win.preventScroll = true;
8768						processEnter(e,_thisImg,_layers,_totalLayers,_shine);		
8769					});
8770					$(thisImg).parents('.style-5').on('touchend', function(e){
8771						win.preventScroll = false;
8772						processExit(e,_thisImg,_layers,_totalLayers,_shine);		
8773					});
8774		        })(thisImg,layers,totalLayerElems,shineHTML); */
8775		    } else {
8776		    	(function(_thisImg,_layers,_totalLayers,_shine) {
8777					$(thisImg).parents('.style-5').on('mousemove', function(e){
8778
8779					 	var now = Date.now();
8780				        if (now > lastMove + eventThrottle) {
8781				            lastMove = now;
8782							window.requestAnimationFrame(function(){
8783								processMovement(e,false,_thisImg,_layers,_totalLayers,_shine);		
8784							});
8785						}
8786
8787						//window.requestAnimationFrame(function(){
8788						//	processShineMovement(e,false,_thisImg,_layers,_totalLayers,_shine);		
8789						//});
8790					});
8791		            $(thisImg).parents('.style-5').on('mouseenter', function(e){
8792						processEnter(e,_thisImg,_layers,_totalLayers,_shine);		
8793					});
8794					$(thisImg).parents('.style-5').on('mouseleave', function(e){
8795						processExit(e,_thisImg,_layers,_totalLayers,_shine);		
8796					});
8797		        })(thisImg,layers,totalLayerElems,shineHTML);
8798		    }
8799
8800		    //set the depths
8801		    (function(_thisImg,_layers,_totalLayers,_shine) {
8802			    depths(false,_thisImg,_layers,_totalLayers,_shine);
8803			     window.addEventListener('resize', function(e){
8804			    	  depths(false,_thisImg,_layers,_totalLayers,_shine);
8805			    });
8806			 })(thisImg,layers,totalLayerElems,shineHTML);
8807		}
8808
8809		function processMovement(e, touchEnabled, elem, layers, totalLayers, shine){
8810
8811			//stop raf if exit already called
8812			if(!$(elem.firstChild).hasClass('over')) { processExit(e,elem,layers,totalLayers,shine); return false }
8813
8814			//set up multipliers
8815
8816			if($(elem).parents('.col.wide').length > 0 ) {
8817				var yMult = 0.03;
8818				var xMult = 0.063;
8819			} else if( $(elem).parents('.col.regular').length > 0  ) {
8820				var yMult = 0.045;
8821				var xMult = 0.045;
8822			} else if($(elem).parents('.col.tall').length > 0 ) {
8823				var yMult = 0.05;
8824				var xMult = 0.015;
8825			} else if($(elem).parents('.col.wide_tall').length > 0) {
8826				var yMult = 0.04;
8827				var xMult = 0.04;
8828			} else {
8829				var yMult = 0.045;
8830				var xMult = 0.075;
8831			}
8832			
8833			var bdst = bd.scrollTop || htm.scrollTop,
8834				bdsl = bd.scrollLeft,
8835				pageX = (touchEnabled)? e.touches[0].pageX : e.pageX,
8836				pageY = (touchEnabled)? e.touches[0].pageY : e.pageY,
8837				offsets = elem.getBoundingClientRect(),
8838				w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, // width
8839				h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, // height
8840				wMultiple = 320/w,
8841				offsetX = 0.52 - (pageX - offsets.left - bdsl)/w, //cursor position X
8842				offsetY = 0.52 - (pageY - offsets.top - bdst)/h, //cursor position Y
8843				dy = (pageY - offsets.top - bdst) - h / 2, //@h/2 = center of container
8844				dx = (pageX - offsets.left - bdsl) - w / 2, //@w/2 = center of container
8845				yRotate = (offsetX - dx)*(yMult * wMultiple), //rotation for container Y
8846				xRotate = (dy - offsetY)*(xMult * wMultiple); //rotation for container X //old
8847				//imgCSS = ' rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateZ(0)'; //img transform
8848				if($(elem).parents('.wide_tall').length == 0 && $(elem).parents('.wide').length == 0 && $(elem).parents('.tall').length == 0) {
8849					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
8850				} else {
8851					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	
8852				}
8853				//imgCSS2 = 'perspective('+ w*3 +'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateZ(0) translateY('+offsetY*-10+'px) translateX('+offsetX*-10+'px)'; //img transform //old
8854
8855				
8856			//container transform
8857			if(elem.firstChild.className.indexOf(' over') != -1){
8858				if($(elem).parents('.portfolio-items.masonry-items').length > 0){
8859					//imgCSS2 = ' scale3d(1.025,1.025,1.025)';
8860				} else {
8861					//imgCSS2 = ' scale3d(1.06,1.06,1.06)';
8862				}
8863			
8864				
8865
8866			}
8867		
8868			//elem.firstChild.style.transform = imgCSS;
8869			$(elem).find('.parallaxImg-container').css('transform',imgCSS);
8870
8871			if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) {
8872				$(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform',imgCSS);
8873			}
8874			//elem.style.transform = imgCSS2;
8875
8876			
8877		}
8878
8879		function processShineMovement(e, touchEnabled, elem, layers, totalLayers, shine){
8880
8881			var bdst = bd.scrollTop || htm.scrollTop,
8882				bdsl = bd.scrollLeft,
8883				pageX = (touchEnabled)? e.touches[0].pageX : e.pageX,
8884				pageY = (touchEnabled)? e.touches[0].pageY : e.pageY,
8885				offsets = elem.getBoundingClientRect(),
8886				w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, // width
8887				h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, // height
8888				wMultiple = 320/w,
8889				offsetX = 0.52 - (pageX - offsets.left - bdsl)/w, //cursor position X
8890				offsetY = 0.52 - (pageY - offsets.top - bdst)/h, //cursor position Y
8891				dy = (pageY - offsets.top - bdst) - h / 2, //@h/2 = center of container
8892				dx = (pageX - offsets.left - bdsl) - w / 2, //@w/2 = center of container
8893				yRotate = (offsetX - dx)*(0.040 * wMultiple), //rotation for container Y
8894				xRotate = (dy - offsetY)*(0.070 * wMultiple), //rotation for container X
8895				
8896				arad = Math.atan2(dy, dx), //angle between cursor and center of container in RAD
8897				angle = arad * 180 / Math.PI - 90; //convert rad in degrees
8898
8899
8900			//get angle between 0-360
8901			if (angle < 0) {
8902				angle = angle + 360;
8903			}
8904
8905			//gradient angle and opacity for shine
8906			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%)';
8907			shine.style.transform = 'translateX(' + (offsetX * totalLayers) - 0.1 + 'px) translateY(' + (offsetY * totalLayers) - 0.1 + 'px) ';	
8908
8909			
8910		}
8911
8912		function processEnter(e, elem, layers, totalLayers, shine){
8913			//var sAgent = window.navigator.userAgent;
8914  			//var Idx = sAgent.indexOf("Edge");
8915
8916			elem.firstChild.className += ' over';
8917			elem.className += ' over';
8918
8919			//if(Idx == -1) {
8920				//$('body').addClass('cssreflections');
8921				//$(elem).addClass('transition');
8922			//	//var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },150);
8923			//} else {
8924				$(elem).addClass('transition');
8925				var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },200);
8926			//}
8927
8928			//depths(false, elem, layers, totalLayers, shine);
8929		}
8930
8931		function processExit(e, elem, layers, totalLayers, shine){
8932
8933			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
8934			var container = elem.firstChild;
8935
8936			container.className = container.className.replace(' over','');
8937			elem.className = elem.className.replace(' over','');
8938			$(container).css('transform', 'perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
8939			$(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform','perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
8940			//elem.style.transform = 'perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0) translateX(0) translateY(0)';
8941			//shine.style.cssText = '';
8942			
8943			//for(var ly=0;ly<totalLayers;ly++){
8944				//layers[ly].style.transform = '';
8945			//}
8946
8947			$(elem).addClass('transition');
8948				var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },200);
8949
8950			//removeDepths(false, elem, layers, totalLayers, shine);
8951
8952		}
8953
8954		function depths(touchEnabled, elem, layers, totalLayers, shine) {
8955			
8956			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
8957			var revNum = totalLayers;
8958			var container = elem.firstChild;
8959			
8960			//set z
8961			for(var ly=0;ly<totalLayers;ly++){
8962				//layers[ly].style.transform = 'translateX(' + (offsetX * revNum) * ((ly * 2.5) / wMultiple) + 'px) translateY(' + (offsetY * totalLayers) * ((ly * 2.5) / wMultiple) + 'px) translateZ(0)';
8963				if(ly == 0) $(layers[ly]).css('transform', 'translateZ(0px)');
8964				else $(layers[ly]).css('transform','translateZ(' +(w*3)/27*(ly*1.1) + 'px) ');
8965
8966				revNum--;
8967			}
8968			
8969			totalLayers = totalLayers + 3;
8970
8971			//set perspective from beginning
8972			$(container).css('transform','perspective('+ w*3 +'px)');
8973
8974			//$(elem).parents('.col').find('.parallaxImg-shine').css('transform','translateZ('+(w*3)/70*(totalLayers*1.1) +'px)');
8975		}
8976
8977		function removeDepths(touchEnabled, elem, layers, totalLayers, shine) {
8978			
8979			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
8980			var revNum = totalLayers;
8981			
8982			//set z
8983			for(var ly=0;ly<totalLayers;ly++){
8984				
8985				if(ly == 0) $(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)');
8986				else $(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)');
8987
8988				revNum--;
8989			}
8990			
8991			totalLayers = totalLayers + 3;
8992			
8993		}
8994	}
8995
8996	style6Img();
8997
8998	function portfolioDeviceCheck(){
8999		if($('body').hasClass('mobile') || navigator.userAgent.match(/(iPad|IEMobile)/) ){
9000			
9001			//if using more details
9002			if($('.portfolio-items .col .work-item').find('a:not(".pp")').length > 0){
9003				$('.portfolio-items .col .work-item').find('a.pp').css('display','none');
9004			} 
9005			
9006			//if only using pp
9007			else {
9008				$('.portfolio-items .col .work-item').find('a:not(".pp")').css('display','none');
9009			}
9010		
9011		} else {
9012			$('.portfolio-items .col .work-item').find('a').css('display','inline');
9013		}
9014	}
9015	
9016	
9017	//portfolio accent color
9018	function portfolioAccentColor() {
9019
9020		var portfolioSocialColorCss = '';
9021
9022		$('.portfolio-items .col').each(function(){
9023			if ($(this).has('[data-project-color]')) { 
9024				$(this).find('.work-info-bg, .bottom-meta').css('background-color',$(this).attr('data-project-color'));
9025
9026				//style5
9027				$(this).find('.parallaxImg-rendered-layer .bg-overlay').css('border-color',$(this).attr('data-project-color'));
9028
9029				var	$projColor = $(this).attr('data-project-color');
9030				if($(this).find('.custom-content .nectar-social').length > 0 && $('body[data-button-style="rounded"]') ) portfolioSocialColorCss += 'body[data-button-style="rounded"] .col[data-
9030project-color="'+$projColor+'"] .custom-content .nectar-social > *:hover i { color: '+ $projColor +'!important; } ';
9031
9032			}
9033		});
9034		
9035		if(portfolioSocialColorCss.length > 1) {
9036
9037			var head = document.head || document.getElementsByTagName('head')[0];
9038			var style = document.createElement('style');
9039
9040				style.type = 'text/css';
9041			if (style.styleSheet){
9042			  style.styleSheet.cssText = portfolioSocialColorCss;
9043			} else {
9044			  style.appendChild(document.createTextNode(portfolioSocialColorCss));
9045			}
9046
9047			head.appendChild(style);
9048		}
9049	}
9050	portfolioAccentColor();
9051	
9052	//portfolio sort
9053	$('body').on('mouseenter','.portfolio-filters',function(){
9054		$(this).find('> ul').stop(true,true).slideDown(500,'easeOutExpo');
9055		$(this).find('a#sort-portfolio span').html($(this).find('a#sort-portfolio').attr('data-sortable-label'));
9056	});
9057
9058	$('body').on('mouseleave','.portfolio-filters',function(){
9059		var $activeCat = $(this).find('a.active').html();
9060		if( typeof $activeCat == 'undefined' || $activeCat.length == 0) $activeCat = $(this).attr('data-sortable-label');
9061		$(this).find('a#sort-portfolio span').html($activeCat);
9062		$(this).find('> ul').stop(true,true).slideUp(500,'easeOutExpo');
9063	});
9064	
9065	//portfolio selected category
9066	$('body').on('click','.portfolio-filters ul li a', function(){
9067		$(this).parents('.portfolio-filters').find('#sort-portfolio span').html($(this).html());
9068	});
9069	
9070	//inline portfolio selected category
9071	$('body').on('click','.portfolio-filters-inline ul li a',function(){
9072
9073		$(this).parents('ul').find('li a').removeClass('active');
9074		$(this).addClass('active');
9075		$(this).parents('.portfolio-filters-inline').find('#current-category').html($(this).html());
9076		
9077	});
9078	
9079
9080	function portfolioFiltersInit() {
9081		//mobile sort menu fix
9082		if($('body').hasClass('mobile') || navigator.userAgent.match(/(iPad|IEMobile)/)){
9083			$('.portfolio-filters').unbind('mouseenter mouseleave');
9084			$('.portfolio-filters > a, .portfolio-filters ul li a').click(function(e){
9085				if(e.originalEvent !== undefined) $(this).parents('.portfolio-filters').find('> ul').stop(true,true).slideToggle(600,'easeOutCubic');
9086			});
9087		}
9088
9089		$('.portfolio-filters-inline .container > ul > li:nth-child(2) a').click();
9090		
9091		//portfolio more details page menu highlight
9092		$('body.single-portfolio #header-outer nav > ul > li > a:contains("Portfolio")').parents('li').addClass('current-menu-item');
9093		
9094		//blog page highlight
9095		$('body.single-post #header-outer nav > ul > li > a:contains("Blog")').parents('li').addClass('current-menu-item');
9096	}
9097
9098	portfolioFiltersInit();
9099
9100	
9101	//blog love center
9102	function centerLove(){
9103		$('.post').each(function(){
9104			
9105			var $loveWidth = $(this).find('.post-meta .nectar-love').outerWidth();
9106			var $loveWrapWidth = $(this).find('.post-meta  .nectar-love-wrap').width();
9107			
9108			//center
9109			$(this).find('.post-meta .nectar-love').css('margin-left', $loveWrapWidth/2 - $loveWidth/2 + 'px' );
9110			$(this).find('.nectar-love-wrap').css('visibility','visible');
9111		});
9112	}
9113	
9114	$('.nectar-love').on('click',function(){
9115		centerLove();
9116	});
9117	
9118	centerLove();	
9119	
9120
9121	//portfolio single comment order
9122	function portfolioCommentOrder(){
9123	
9124		if($('body').hasClass('mobile') && $('body').hasClass('single-portfolio') && $('#respond').length > 0){
9125			$('#sidebar').insertBefore('.comments-section');
9126		}
9127		 
9128		else if($('body').hasClass('single-portfolio') && $('#respond').length > 0) {
9129			$('#sidebar').insertAfter('#post-area');
9130		}
9131		
9132	}
9133
9134	 portfolioCommentOrder();
9135	 
9136	
9137	//portfolio sidebar follow
9138	
9139	var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
9140	
9141	function portfolioSidebarFollow(){
9142
9143		sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
9144	
9145		if( $('body.single-portfolio').length > 0 && sidebarFollow == 1 && !$('body').hasClass('mobile') && parseInt($('#sidebar').height()) + 50 <= parseInt($('#post-area').height())) {
9146			
9147			 $('#sidebar').addClass('fixed-sidebar');
9148			 
9149			 var $footer = ($('.comment-wrap.full-width-section').length == 0) ? '#footer-outer' : '.comment-wrap';
9150			 if( $('#call-to-action').length > 0 ) $footer = '#call-to-action';
9151			 
9152			 //convert width into px
9153			 sidebarPxConversion();
9154			 
9155			 $('#sidebar').stickyMojo({footerID: $footer, contentID: '#post-area'});
9156			 
9157		}
9158		
9159	}
9160	
9161	function sidebarPxConversion(){
9162		
9163		if( $('body.single-portfolio').length > 0 && sidebarFollow == 1 && !$('body').hasClass('mobile') ) {
9164			
9165			var $containerWidth = $('.main-content > .row').width();
9166			var $sidebarWidth = $containerWidth*.235;
9167			
9168			if(window.innerWidth > 1300){
9169				$sidebarWidth = $containerWidth*.235;
9170			} else if(window.innerWidth < 1300 && window.innerWidth > 1000 ) {
9171				$sidebarWidth = $containerWidth*.273;
9172			}
9173			
9174			$('#sidebar').css('width',$sidebarWidth+'px');
9175		}
9176	}
9177	
9178	$(window).load(function(){
9179		setTimeout(portfolioSidebarFollow,200);
9180	});
9181	
9182	
9183	//remove the portfolio filters that are not found in the current page
9184	function isotopeCatSelection() {
9185
9186
9187		$('.portfolio-items:not(".carousel")').each(function(){
9188
9189			var isotopeCatArr = [];
9190			var $portfolioCatCount = 0;
9191			$(this).parent().parent().find('div[class^=portfolio-filters] ul li').each(function(i){
9192				if($(this).find('a').length > 0) {
9193					isotopeCatArr[$portfolioCatCount] = $(this).find('a').attr('data-filter').substring(1);	
9194					$portfolioCatCount++;
9195				}
9196			});
9197			
9198			////ice the first (all)
9199			isotopeCatArr.shift();
9200			
9201			
9202			var itemCats = '';
9203			
9204			$(this).find('> div').each(function(i){
9205				itemCats += $(this).attr('data-project-cat');
9206			});
9207			itemCats = itemCats.split(' ');
9208			
9209			////remove the extra item on the end of blank space
9210			itemCats.pop();
9211			
9212			////make sure the array has no duplicates
9213			itemCats = $.unique(itemCats);
9214			
9215			////if user has chosen a set of filters to display - only show those
9216			if($(this).attr('data-categories-to-show').length != 0 && $(this).attr('data-categories-to-show') != 'all') {
9217				$userSelectedCats = $(this).attr('data-categories-to-show').replace(/,/g , ' ');
9218				$userSelectedCats = $userSelectedCats.split(' ');
9219				
9220				if(!$(this).hasClass('infinite_scroll')) $(this).removeAttr('data-categories-to-show');
9221			} else {
9222				$userSelectedCats = itemCats;
9223			}
9224			
9225			
9226			////Find which categories are actually on the current page
9227			var notFoundCats = [];
9228			$.grep(isotopeCatArr, function(el) {
9229
9230		    	if ($.inArray(el, itemCats) == -1) notFoundCats.push(el);
9231		    	if ($.inArray(el, $userSelectedCats) == -1) notFoundCats.push(el);
9232
9233			});
9234			
9235			//manipulate the list
9236			if(notFoundCats.length != 0){
9237				$(this).parent().parent().find('div[class^=portfolio-filters] ul li').each(function(){
9238					if($(this).find('a').length > 0) {
9239						if( $.inArray($(this).find('a').attr('data-filter').substring(1), notFoundCats) != -1 ){ 
9240							$(this).hide(); 
9241						} else {
9242							$(this).show();
9243						}
9244					}
9245				})
9246			}
9247		});
9248	}
9249	
9250	isotopeCatSelection();
9251	
9252	
9253	//sharing buttons
9254	/*jQuery.sharedCount = function(url, fn) {
9255		url = encodeURIComponent(url || location.href);
9256		var arg = {
9257			url: "//" + (location.protocol == "https:" ? "sharedcount.appspot" : "api.sharedcount") + ".com/?url=" + url,
9258			cache: true,
9259			dataType: "json"
9260		};
9261		if ('withCredentials' in new XMLHttpRequest) {
9262			arg.success = fn;
9263		}
9264		else {
9265			var cb = "sc_" + url.replace(/\W/g, '');
9266			window[cb] = fn;
9267			arg.jsonpCallback = cb;
9268			arg.dataType += "p";
9269		}
9270		return jQuery.ajax(arg);
9271	};*/
9272	
9273	
9274	
9275	
9276	var completed = 0;
9277	var windowLocation = window.location.href.replace(window.location.hash, '');
9278
9279	function facebookShare(){
9280		windowLocation = window.location.href.replace(window.location.hash, '');
9281		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" ) 
9282		return false;
9283	}
9284
9285	function googlePlusShare(){
9286		windowLocation = window.location.href.replace(window.location.hash, '');
9287		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" ) 
9288		return false;
9289	}
9290
9291	function twitterShare(){
9292        windowLocation = window.location.href.replace(window.location.hash, '');		
9293		if($(".section-title h1").length > 0) {
9294			var $pageTitle = encodeURIComponent($(".section-title h1").text());
9295		} else {
9296			var $pageTitle = encodeURIComponent($(document).find("title").text());
9297		}
9298		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" ) 
9299		return false;
9300	}
9301
9302	function wooTwitterShare(){
9303		windowLocation = window.location.href.replace(window.location.hash, '');
9304		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" ) 
9305		return false;
9306	}
9307
9308	function linkedInShare(){
9309	    windowLocation = window.location.href.replace(window.location.hash, '');	
9310		if($(".section-title h1").length > 0) {
9311			var $pageTitle = encodeURIComponent($(".section-title h1").text());
9312		} else {
9313			var $pageTitle = encodeURIComponent($(document).find("title").text());
9314		}
9315		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" ) 
9316		return false;
9317	}
9318
9319	function woolinkedInShare(){
9320	    windowLocation = window.location.href.replace(window.location.hash, '');	
9321		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" ) 
9322		return false;
9323	}
9324
9325	function pinterestShare(){
9326		windowLocation = window.location.href.replace(window.location.hash, '');
9327		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'); 
9328		
9329		if($(".section-title h1").length > 0) {
9330			var $pageTitle = encodeURIComponent($(".section-title h1").text());
9331		} else {
9332			var $pageTitle = encodeURIComponent($(document).find("title").text());
9333		}
9334		
9335		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" ) 
9336		return false;
9337	}
9338	
9339	function wooPinterestShare(){
9340		$imgToShare = ($('img.attachment-shop_single').length > 0) ? $('img.attachment-shop_single').first().attr('src') : $('.single-product-main-image img').first().attr('src');
9341		windowLocation = window.location.href.replace(window.location.hash, '');
9342		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" ) 
9343		return false;
9344	}
9345
9346
9347	function socialFade(){
9348			if(completed == $('a.nectar-sharing').length && $('a.nectar-sharing').parent().hasClass('in-sight')) {
9349
9350				//$timeout = ($('#page-header-bg[data-animate-in-effect="slide-down"] .nectar-social').length > 0 ) ? 500 : 1;
9351			//	setTimeout(function(){
9352					//$('.nectar-social > a').stop(true,true).transition({'padding-right':'15px'},350,'easeOutSine');
9353					
9354					//love fadein
9355					$('.nectar-social .nectar-love span').show(350,'easeOutSine',function(){
9356						$(this).stop().animate({'opacity':1},800);
9357					});
9358					
9359					//sharing loadin
9360					$('.nectar-social > a').each(function(i){
9361						var $that = $(this);
9362						
9363						$(this).find('> span').show(350,'easeOutSine',function(){
9364							$that.find('> span').stop().animate({'opacity':1},800);
9365						});
9366						
9367					});
9368				//},$timeout);
9369
9370				//alt blog layout total share count
9371				var $totalShares = 0;
9372				$('.nectar-social > a .count').each(function(){
9373					$totalShares += parseInt($(this).html());
9374				});
9375
9376				if($totalShares != 1){
9377					$('.single .meta-share-count .plural').css({'opacity':'1', 'display':'inline'});
9378					$('.single .meta-share-count .singular').remove();
9379				} else {
9380					$('.single .meta-share-count .singular').css({'opacity':'1', 'position':'relative',  'display':'inline'});
9381					$('.single .meta-share-count .plural').remove();
9382				}
9383
9384				$('.meta-share-count .share-count-total').html($totalShares).css('opacity',1);
9385			}
9386		}
9387
9388	$('body').on('click','#single-below-header .nectar-social a', function(){ return false; });
9389
9390	$('body').on('click','.facebook-share:not(.inactive)', facebookShare);
9391	$('body').on('click','.google-plus-share:not(.inactive)', googlePlusShare);
9392	$('body').on('click','.nectar-social:not(".woo") .twitter-share:not(.inactive)', twitterShare);
9393	$('body').on('click','.nectar-social.woo .twitter-share', wooTwitterShare);
9394	$('body').on('click','.nectar-social:not(".woo") .linkedin-share:not(.inactive)', linkedInShare);
9395	$('body').on('click','.nectar-social.woo .linkedin-share', woolinkedInShare);
9396	$('body').on('click','.nectar-social:not(".woo") .pinterest-share:not(.inactive)', pinterestShare);
9397	$('body').on('click','.nectar-social.woo .pinterest-share', wooPinterestShare);
9398
9399
9400	function socialSharingInit() {
9401
9402		//mobile fullscreen blog class for click event fix
9403		if($('body').hasClass('mobile') && $('.single-post .fullscreen-header').length > 0) {
9404			$('#single-below-header .nectar-social .nectar-sharing, #single-below-header .nectar-social .nectar-sharing-alt').addClass('inactive');
9405		}
9406
9407		completed = 0;
9408
9409		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) {
9410  
9411		 
9412			////facebook
9413			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) {
9414				
9415				//load share count on load  
9416				$.getJSON("https://graph.facebook.com/?id="+ windowLocation +'&callback=?', function(data) {
9417					if((data.shares != 0) && (data.shares != undefined) && (data.shares != null)) { 
9418						$('.facebook-share a span.count, a.facebook-share span.count').html( data.shares );	
9419					}
9420					else {
9421						$('.facebook-share a span.count, a.facebook-share span.count').html( 0 );	
9422					}
9423					completed++;
9424					socialFade();
9425				});
9426			 
9427				
9428				
9429			} else if($('a.facebook-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.facebook-share').length > 0) {
9430				completed++;
9431				socialFade();
9432			}
9433			
9434			
9435			////twitter
9436			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) {
9437				//load tweet count on load 
9438				//$.getJSON('https://cdn.api.twitter.com/1/urls/count.json?url='+windowLocation+'&callback=?', function(data) {
9439				//	if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
9440					//	$('.twitter-share a span.count, a.twitter-share span.count').html( data.count );
9441					//}
9442					//else {
9443					$('.twitter-share a span.count, a.twitter-share span.count').html( 0 );
9444					//}
9445					completed++;
9446					socialFade();
9447				//});
9448
9449
9450			} else if($('a.twitter-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.twitter-share').length > 0 ) {
9451				completed++;
9452				socialFade();
9453			}
9454			
9455			
9456			////linkedIn
9457			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) {
9458				//load share count on load 
9459				//$.getJSON('https://www.linkedin.com/countserv/count/share?url='+windowLocation+'&callback=', function(data) {
9460				//	if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
9461				//		$('.linkedin-share a span.count, a.linkedin-share span.count').html( data.count );
9462				//	}
9463				//	else {
9464						$('.linkedin-share a span.count, a.linkedin-share span.count').html( 0 );
9465				//	}
9466					completed++;
9467					socialFade();
9468				//});
9469
9470				
9471			} else if($('a.linkedin-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.linkedin-share').length > 0) {
9472				completed++;
9473				socialFade();
9474			}
9475			
9476			
9477			////pinterest
9478			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) {
9479				//load pin count on load 
9480				$.getJSON('https://api.pinterest.com/v1/urls/count.json?url='+windowLocation+'&callback=?', function(data) {
9481					if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
9482						$('.pinterest-share a span.count, a.pinterest-share span.count').html( data.count );
9483					}
9484					else {
9485						$('.pinterest-share a span.count, a.pinterest-share span.count').html( 0 );
9486					}
9487					completed++;
9488					socialFade();
9489				});
9490
9491			} else if($('a.pinterest-share').length > 0 && $('body[data-button-style="rounded"]').length >  0 || $('.sharing-default-minimal a.pinterest-share').length > 0) {
9492				completed++;
9493				socialFade();
9494
9495			}
9496			
9497			
9498			//fadeIn
9499			$('a.nectar-sharing > span.count, a.nectar-sharing-alt > span.count').hide().css('width','auto');
9500
9501
9502			//social light up
9503
9504			$('.nectar-social').each(function() {
9505				if($(this).parents('.custom-content').length == 0) {
9506
9507
9508					var $that = $(this);
9509					var waypoint = new Waypoint({
9510		 			element: $that,
9511		 			 handler: function(direction) {
9512
9513						$slide_timeout = ($('#page-header-bg[data-animate-in-effect="slide-down"] .nectar-social').length > 0 ) ? 900 : 1;
9514
9515						setTimeout(function(){
9516
9517							$that.addClass('in-sight');
9518							socialFade();
9519							
9520							if($('#page-header-bg .nectar-social').length == 0) {
9521								$that.find('> *').each(function(i){
9522									
9523									var $that = $(this);
9524									var $timeout = ($('body[data-button-style="rounded"]').length > 0) ? 0: 750;
9525
9526									setTimeout(function(){ 
9527										
9528										$that.delay(i*80).queue(function(){ 
9529											
9530											var $that = $(this); $(this).addClass('hovered'); 
9531											
9532											setTimeout(function(){ 
9533												$that.removeClass('hovered');
9534											},300); 
9535											
9536										});
9537									
9538									},$timeout);
9539								});
9540							}
9541
9542						},$slide_timeout );
9543
9544						$that.addClass('animated-in');
9545						waypoint.destroy();
9546					},
9547					offset: 'bottom-in-view'
9548
9549				}); 
9550
9551
9552					
9553				}
9554			}); 
9555
9556		}
9557
9558	}
9559	
9560	socialSharingInit();
9561
9562
9563	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
9564
9565		var $socialTimeout;
9566		$('body').on('mouseenter','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
9567			clearTimeout($socialTimeout);
9568
9569			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
9570				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'right':'0px'},0);
9571			else 
9572				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'left':'0px'},0);
9573
9574			$(this).parents('[id*="-meta"]').addClass('social-hovered');
9575
9576			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':0},250);
9577			$(this).find('.nectar-social a').each(function(i){
9578				$(this).stop(true).delay(i*40).animate({'opacity': 1,  'left':'0px'}, 150);
9579			});
9580
9581		});
9582
9583	
9584		$('body').on('mouseleave','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
9585			$(this).parents('[id*="-meta"]').removeClass('social-hovered');
9586
9587			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
9588				$(this).find('.nectar-social').stop(true).animate({'opacity': 0,  'right':'-20px'}, 200);
9589			else 
9590				$(this).find('.nectar-social').stop(true).animate({'opacity': 0,  'left':'-20px'}, 200);
9591
9592			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':1},250);
9593
9594			var $that = $(this);
9595			
9596			$socialTimeout = setTimeout(function(){ 
9597				$that.find('.nectar-social').hide(); 
9598				if($that.parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
9599					$that.find('.nectar-social a').stop(true).animate({'opacity': 0,  'left':'20px'},0);   
9600				else 
9601					$that.find('.nectar-social a').stop(true).animate({'opacity': 0,  'left':'-20px'},0);   
9602			}, 200);
9603		});
9604	} else {
9605		var $socialTimeout;
9606		$('body').on('click','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
9607			clearTimeout($socialTimeout);
9608
9609			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
9610				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'right':'0px'},0);
9611			else 
9612				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'left':'0px'},0);
9613
9614			$(this).parents('[id*="-meta"]').addClass('social-hovered');
9615
9616			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':0},250);
9617			$(this).find('.nectar-social a').each(function(i){
9618				$(this).stop(true).delay(i*40).animate({'opacity': 1,  'left':'0px'}, 150);
9619			});
9620
9621			return false;
9622		});
9623
9624	}
9625
9626	$('body').on('mouseenter','.fullscreen-header  .meta-share-count', function(){
9627		$(this).find('> a, > i').stop(true).animate({'opacity': 0},400);
9628		$(this).find('.nectar-social > *').each(function(i){
9629			$(this).stop(true).delay(i*50).animate({'opacity':'1', 'top': '0px'},250,'easeOutCubic');
9630		});
9631		//allow clickable on mobile
9632		setTimeout(function(){ $('.meta-share-count .nectar-sharing, .meta-share-count .nectar-sharing-alt').removeClass('inactive'); },300);
9633	});
9634
9635	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
9636		$('body').on('mouseleave','.fullscreen-header  .meta-share-count', function(){
9637			$(this).find('> a, > i').stop(true).animate({'opacity': 1},300,'easeInCubic');
9638			$(this).find('.nectar-social > *').each(function(i){
9639				$(this).stop(true).animate({'opacity':'0', 'top': '10px'},200,'easeInCubic');
9640			});
9641		});
9642	}
9643
9644
9645
9646
9647	//full width love center
9648	function nectarLoveFWCenter(){
9649		$('.nectar-social.full-width').each(function(){ 
9650			$(this).find('.n-shortcode .nectar-love').css('padding-top', $(this).find('> a').css('padding-top'));
9651		});
9652	}
9653	
9654	nectarLoveFWCenter();
9655	
9656
9657	//-----------------------------------------------------------------
9658	// NectarLove
9659	//-----------------------------------------------------------------
9660	
9661	$('body').on('click','.nectar-love', function() {
9662			
9663
9664			var $loveLink = $(this);
9665			var $id = $(this).attr('id');
9666			var $that = $(this);
9667			
9668			if($loveLink.hasClass('loved')) return false;
9669			if($(this).hasClass('inactive')) return false;
9670			
9671			var $dataToPass = {
9672				action: 'nectar-love', 
9673				loves_id: $id,
9674				love_nonce: nectarLove.loveNonce
9675			}
9676			
9677			$.post(nectarLove.ajaxurl, $dataToPass, function(data){
9678				$loveLink.find('span').html(data);
9679				$loveLink.addClass('loved').attr('title','You already love this!');
9680				$loveLink.find('span').css({'opacity': 1,'width':'auto'});
9681				//ascend
9682				if($('body').hasClass('ascend') && $that.parents('.classic_enhanced').length == 0 ){
9683					$loveLink.find('.icon-salient-heart.loved').show().transition({ scale: 1 },800,'cubic-bezier(0.15, 0.84, 0.35, 1.5)');
9684					setTimeout(function(){ $loveLink.find('.icon-salient-heart-2').css('opacity','0'); },400);
9685					if($loveLink.parents('.sharing-default-minimal').length > 0 && $loveLink.parents('.bottom-meta').length >0 ) $loveLink.find('.icon-salient-heart-2').remove();
9686				} else if($that.parents('.classic_enhanced').length > 0 ) {
9687					$that.find('.icon-salient-heart-2').addClass('loved');
9688				}
9689			});
9690			
9691			$(this).addClass('inactive');
9692			
9693			return false;
9694	});
9695
9696
9697	
9698	//infinite scroll
9699	function infiniteScrollInit() {
9700
9701		if($('.infinite_scroll').length > 0) {
9702			
9703			//portfolio
9704			$('.portfolio-items.infinite_scroll').infinitescroll({
9705		    	navSelector  : "div#pagination",            
9706		   	    nextSelector : "div#pagination a:first",    
9707		   	    itemSelector : ".portfolio-items.infinite_scroll .element",
9708		   	    finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
9709		        msgText: " ",         
9710		   },function(newElements){
9711		   	
9712
9713				var $container = $('.portfolio-items.infinite_scroll:not(.carousel)');
9714				//loading effect   
9715
9716		        var $newElems = $( newElements ).css('opacity',0);
9717		        //// ensure that images load before adding to masonry layout
9718		        $newElems.imagesLoaded(function(){
9719		          
9720		          $( newElements ).css('opacity',1);
9721
9722		          $container.isotope( 'appended', $( newElements ));
9723		          
9724		          $( newElements ).find('.work-item').addClass('ajax-loaded');
9725		          $( newElements ).addClass('ajax-loaded');
9726		          ///// show elems now they're ready
9727		          
9728		          $(newElements).find('.work-meta, .nectar-love-wrap').css({'opacity':1});
9729		          
9730		          //keep filtering
9731		          if($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) {
9732		          	
9733		          	  if($('.portfolio-filters-inline').length > 0) {
9734		          	  	 var selector = $('.portfolio-filters-inline a.active').attr('data-filter');
9735		          	  } else {
9736		          	  	 var selector = $('.portfolio-filters a.active').attr('data-filter');
9737		          	  }
9738		          	  
9739		          	  $('.portfolio-filters-inline a.active').attr('data-filter');
9740			  	 	  $container.isotope({ filter: selector });
9741		          }
9742		          
9743			  	//set width
9744			  	portfolioItemWidths();
9745			  	reLayout();
9746
9747		        if($(newElements).find('.work-item.style-5').length > 0) style6Img();
9748
9749	          	if($(newElements).find('.inner-wrap').attr('data-animation') == 'none') {
9750					$('.portfolio-items .col .inner-wrap').removeClass('animated');
9751				} else {
9752
9753					$(newElements).each(function(i){
9754
9755						$(this).delay(130*i).queue(function(next){
9756						    $(this).addClass("animated-in");
9757						    next();
9758						});
9759	
9760					}); //each
9761				}
9762
9763		       
9764		        portfolioHoverEffects();	
9765				portfolioAccentColor();
9766		         
9767		        //verify smooth scorlling
9768				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') } 
9769				
9770				
9771				//Panr 
9772				if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)) {
9773					
9774					$(".portfolio-items:not(.carousel) .work-item.style-3 img").panr({
9775						scaleDuration: .28
9776					}); 
9777					$(".portfolio-items:not(.carousel) .work-item.style-3-alt img").panr({ scaleDuration: .28, sensitivity: 12.6, scaleTo: 1.08, panDuration: 3 }); 
9778					
9779				}
9780				
9781				//prettyphoto
9782				$('.portfolio-items').each(function(){
9783					var $unique_id = Math.floor(Math.random()*10000);
9784					$(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel','prettyPhoto['+$unique_id+'_gal]').removeClass('pretty_photo');
9785				});
9786		
9787				lightBoxInit();
9788				
9789				piVertCenter();
9790
9791				setTimeout(function(){masonryZindex(); reLayout(); $( newElements ).removeClass('ajax-loaded'); },700);
9792		        
9793		        //recalc the filters
9794		        isotopeCatSelection();
9795
9796		        parallaxRowsBGCals();
9797	          
9798	          }); 
9799		          
9800		       
9801				
9802				
9803				
9804		   });
9805			
9806			
9807			
9808			//blog
9809			$('#post-area.infinite_scroll .posts-container').infinitescroll({
9810		    	navSelector  : "div#pagination",            
9811		   	    nextSelector : "div#pagination a:first",    
9812		   	    itemSelector : "#post-area .posts-container .post",
9813		   	    finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
9814		        msgText: " " 
9815		   },function(newElements){
9816		   	
9817		   	if($('.masonry.meta_overlaid').length == 0) { 
9818			   	//reinit js
9819			   	centerLove();
9820			   	
9821			   	//gallery
9822				$(newElements).find('.flex-gallery').each(function(){
9823					
9824					var $that = $(this);
9825					
9826					 $that.flexslider({
9827				        animation: 'fade',
9828				        smoothHeight: false, 
9829				        animationSpeed: 500,
9830				        useCSS: false, 
9831				        touch: true
9832				    });
9833					
9834					////gallery slider add arrows
9835					$('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="icon-angle-right"></i>');
9836					$('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="icon-angle-left"></i>');
9837
9838				});
9839			   	
9840			   	
9841			   	//media players
9842			   	if($().mediaelementplayer) $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer();
9843			   	
9844			   	
9845			   	//lightbox
9846			    lightBoxInit();
9847			   	
9848			   	//carousels
9849			   	if($('.carousel').length > 0) {
9850				   	standardCarouselInit();
9851			    	clientsCarouselInit();
9852			    }
9853			   	
9854			   	//iframes
9855			   	showLateIframes();
9856
9857			   	//milestone
9858			   	$(newElements).find('.nectar-milestone').each(function() {
9859					//symbol
9860					if($(this).has('[data-symbol]')) {
9861						if($(this).attr('data-symbol-pos') == 'before') {
9862							$(this).find('.number').prepend($(this).attr('data-symbol'));
9863						} else {
9864							$(this).find('.number').append($(this).attr('data-symbol'));
9865						}
9866					}
9867				});
9868				
9869				if(!$('body').hasClass('mobile')) {
9870					
9871					$(newElements).find('.nectar-milestone').each(function() {
9872						//animation
9873
9874							var $that = $(this);
9875							var waypoint = new Waypoint({
9876				 			element: $that,
9877				 			 handler: function(direction) {
9878								if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
9879								     waypoint.destroy();
9880								     return;
9881								}
9882
9883								var $endNum = parseInt($that.find('.number span').text());
9884								$that.find('.number span').countTo({
9885									from: 0,
9886									to: $endNum,
9887									speed: 1500,
9888									refreshInterval: 30
9889								});
9890
9891								$that.addClass('animated-in');
9892								waypoint.destroy();
9893							},
9894							offset: 'bottom-in-view'
9895
9896						}); 
9897
9898						
9899					}); 
9900				}
9901				
9902				//pie chart		
9903			    if($().vcChat) $(newElements).find('.vc_pie_chart').vcChat();
9904		    	
9905		    	//fancy ul
9906		    	nectar_fancy_ul_init();
9907		    	
9908		    	//testimonial slider
9909		    	$('.testimonial_slider').animate({'opacity':'1'},800);
9910		    	createTestimonialControls();
9911				testimonialSliderHeight(); 
9912				testimonialHeightResize();
9913		    	
9914				//bar graph
9915				$(newElements).find('.nectar-progress-bar').each(function(i){
9916				
9917
9918				var $that = $(this);
9919				var waypoint = new Waypoint({
9920		 			element: $that,
9921		 			 handler: function(direction) {
9922						if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
9923						     waypoint.destroy();
9924						     return;
9925						}
9926
9927						var percent = $that.find('span').attr('data-width');
9928						var $endNum = parseInt($that.find('span strong i').text());
9929						
9930						$that.find('span').transition({
9931							'width' : percent + '%'
9932						},1600, 'easeInOutCirc',function(){
9933						});
9934						
9935						$that.find('span strong').transition({
9936							'opacity' : 1
9937						},1350);
9938						
9939						
9940						$that.find('span strong i').countTo({
9941							from: 0,
9942							to: $endNum,
9943							speed: 1100,
9944							refreshInterval: 30,
9945							onComplete: function(){
9946					
9947							}
9948						});	
9949						
9950						////100% progress bar 
9951						if(percent == '100'){
9952							$that.find('span strong').addClass('full');
9953						}
9954
9955
9956						$that.addClass('animated-in');
9957						waypoint.destroy();
9958					},
9959					offset: 'bottom-in-view'
9960
9961				}); 
9962
9963
9964			
9965				});
9966				
9967				
9968				//columns & images with animation
9969				colAndImgAnimations();
9970				splitLineHeadings();
9971
9972				setTimeout(function(){
9973					videoshortcodeSize();
9974					responsiveVideoIframesInit();
9975					responsiveVideoIframes();
9976					$(window).trigger('resize');
9977				},500);
9978
9979
9980				parallaxRowsBGCals();
9981
9982				$(window).trigger('resize');
9983			   	
9984		   	}//non meta overlaid style 
9985		   	else {
9986		   		parallaxRowsBGCals();
9987
9988				$(window).trigger('resize');
9989		   	}
9990
9991		   	// trigger Masonry as a callback
9992		   	var $container = $('.posts-container');
9993		    if($container.parent().hasClass('masonry')) { 
9994		    	 
9995		    	$(newElements).addClass('masonry-blog-item');
9996				$(newElements).prepend('<span class="bottom-line"></span>');
9997				
9998				//move the meta to the bottom
9999				$(newElements).each(function(){
10000					
10001					var $metaClone = $(this).find('.post-meta').clone();
10002		
10003					$(this).find('.post-meta').remove();
10004					
10005					if($('#post-area.meta_overlaid').length > 0){
10006						$(this).find('.post-header h2').after($metaClone);
10007					} else {
10008						$(this).find('.content-inner').after($metaClone);
10009					}
10010					
10011				});
10012			
10013		    	}//if masonry
10014
10015
10016		    	//loading effect   
10017		    	
10018		        //// hide new items while they are loading
10019		        var $newElems = $( newElements );
10020		        //// ensure that images load before adding to masonry layout
10021
10022		        if($newElems.find('img').length == 0) $newElems = $('body');
10023		        
10024		        $newElems.imagesLoaded(function(){
10025
10026		          $container.isotope( 'appended', $( newElements ));
10027
10028		          flickityBlogInit();
10029
10030		          $( newElements ).addClass('ajax-loaded');
10031		          ///// show elems now they're ready
10032
10033
10034		        //classic enhanced specific 
10035		        if($container.parent().hasClass('classic_enhanced')){
10036					$container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function(){
10037						var $src = $(this).find('img').attr('src');
10038						$(this).css('background-image','url('+$src+')');
10039					});
10040
10041					$container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function(){
10042
10043						$(this).find('.cell').each(function(){
10044							var $src = $(this).find('img').attr('src');
10045							$(this).css('background-image','url('+$src+')');
10046						});
10047						
10048					});
10049				}
10050
10051
10052		          if($(newElements).parents('.posts-container').attr('data-animation') == 'none') {
10053						$( newElements ).find('.inner-wrap').removeClass('animated');
10054					} else {
10055
10056						$(newElements).each(function(i){
10057
10058							$(this).delay(130*i).queue(function(next){
10059							    $(this).addClass("animated-in");
10060							    next();
10061							});
10062		
10063						}); //each
10064					}
10065
10066					setTimeout(function(){$( newElements ).removeClass('ajax-loaded'); },700);
10067
10068		        
10069		        });
10070		        
10071		    
10072		   	
10073		   });
10074		   
10075	   }
10076
10077}
10078
10079infiniteScrollInit();
10080
10081function destroyInfiniteScroll(){
10082	$('#post-area.infinite_scroll .posts-container').infinitescroll('destroy');
10083	$('.portfolio-items.infinite_scroll').infinitescroll('destroy');
10084}
10085	
10086/*-------------------------------------------------------------------------*/
10087/*	6.	Scroll to top
10088/*-------------------------------------------------------------------------*/	
10089
10090var $scrollTop = $(window).scrollTop();
10091
10092//starting bind
10093function toTopBind() {
10094	if( $('#to-top').length > 0 && $(window).width() > 1020 || $('#to-top').length > 0 &&  $('#to-top.mobile-enabled').length > 0 ) {
10095		
10096		if($scrollTop > 350){
10097			$(window).on('scroll',hideToTop);
10098		}
10099		else {
10100			$(window).on('scroll',showToTop);
10101		}
10102	}
10103}
10104toTopBind();
10105
10106function showToTop(){
10107	
10108	if( $scrollTop > 350 && $('#slide-out-widget-area.fullscreen.open').length == 0){
10109
10110		$('#to-top').stop().transition({
10111			'bottom' : '17px'
10112		},350,'easeInOutCubic');	
10113		
10114		$(window).off('scroll',showToTop);
10115		$(window).on('scroll',hideToTop);
10116	}
10117
10118}
10119
10120function hideToTop(){
10121	
10122	if( $scrollTop < 350 || $('#slide-out-widget-area.fullscreen.open').length > 0){
10123
10124		$animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350;
10125
10126		$('#to-top').stop().transition({
10127			'bottom' : '-30px'
10128		},$animationTiming,'easeInOutQuint');	
10129		
10130		$(window).off('scroll',hideToTop);
10131		$(window).on('scroll',showToTop);	
10132		
10133	}
10134}
10135
10136
10137//to top color
10138if( $('#to-top').length > 0 ) {
10139	
10140	var $windowHeight, $pageHeight, $footerHeight, $ctaHeight;
10141	
10142	function calcToTopColor(){
10143		$scrollTop = $(window).scrollTop();
10144		$windowHeight = $(window).height();
10145		$pageHeight = $('body').height();
10146		$footerHeight = $('#footer-outer').height();
10147		$ctaHeight = ($('#call-to-action').length > 0) ? $('#call-to-action').height() : 0;
10148		
10149		if( ($scrollTop-35 + $windowHeight) >= ($pageHeight - $footerHeight) && $('#boxed').length == 0){
10150			$('#to-top').addClass('dark');
10151		}
10152		
10153		else {
10154			$('#to-top').removeClass('dark');
10155		}
10156	}
10157	
10158	//calc on scroll
10159	$(window).scroll(calcToTopColor);
10160	
10161	//calc on resize
10162	$(window).resize(calcToTopColor);
10163
10164}
10165
10166//alt style
10167if($('body[data-button-style="rounded"]').length > 0){
10168	var $clone = $('#to-top .icon-angle-up').clone();
10169	$clone.addClass('top-icon');
10170	$('#to-top').prepend($clone)
10171}
10172
10173//scroll up event
10174$('body').on('click','#to-top, a[href="#top"]',function(){
10175	$('body,html').stop().animate({
10176		scrollTop:0
10177	},800,'easeOutQuad',function(){
10178		if($('.nectar-box-roll').length > 0) {
10179			$('body').trigger('mousewheel', [1, 0, 0]);
10180		}
10181	})
10182	return false;
10183});
10184
10185
10186/* one page scrolling */
10187function scrollSpyInit(){ 
10188
10189	//remove full page URLs from hash if located on same page to fix current menu class
10190	//if(location.pathname.length > 1) {
10191		$("#header-outer a[href*='" + location.pathname + "']").each(function(){
10192			var $href = $(this).attr('href');
10193			
10194			if($href.indexOf("#") != -1 && $('div'+$href.substr($href.indexOf("#"))).length > 0 ) {
10195				$(this).attr('href',$href.substr($href.indexOf("#")));
10196				$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
10197			}
10198		});
10199	//}
10200
10201	$target = ($('.page-submenu[data-sticky="true"]').length == 0) ? '#header-outer nav': '.page-submenu';
10202	$('body').scrollspy({
10203		target: $target,
10204		offset: $('#header-outer').height() + adminBarHeight + 40
10205	});
10206
10207}
10208
10209function pageLoadHash() {
10210if(window.location.pathname !== '/catalogue/'){ // Salefinder uses hash instead of query string
10211	var $hash = window.location.hash;
10212	if($hash && $($hash).length > 0) {
10213
10214		$timeoutVar = 0;
10215		if($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
10216			boxRoll(null,-1);
10217			$timeoutVar = 2050;
10218		} 
10219		setTimeout(function(){
10220		
10221			if( $('body[data-permanent-transparent="1"]').length == 0 ) {
10222				
10223				if(!$('body').hasClass('mobile')){
10224					$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
10225					var $scrollTopDistance =  $($hash).offset().top - parseInt($('#header-space').height()) +$resize + 3 - adminBarHeight;
10226				} else {
10227					var $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $('#header-space').height() + adminBarHeight : $($hash).offset().top - adminBarHeight + 1;	
10228				}
10229
10230			} else {
10231				var $scrollTopDistance = $($hash).offset().top - adminBarHeight + 1;
10232			}
10233
10234			if($('body[data-hhun="1"]').length > 0) {
10235				//alter offset 
10236				if($('#header-outer.detached').length == 0) 
10237					$scrollTopDistance = $scrollTopDistance + $('#header-space').height();
10238			}
10239
10240			var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0;
10241
10242			$('body,html').stop().animate({
10243				scrollTop: $scrollTopDistance - $pageSubMenu
10244			},800,'easeInOutCubic');
10245
10246		},$timeoutVar);
10247	}
10248}
10249}
10250
10251if($('body[data-animated-anchors="true"]').length > 0) { 
10252
10253
10254+ function(t) {
10255    "use strict";
10256
10257    function s(e, i) {
10258        var r = t.proxy(this.process, this);
10259        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()
10260    }
10261
10262    function e(e) {
10263        return this.each(function() {
10264            var i = t(this),
10265                r = i.data("bs.scrollspy"),
10266                o = "object" == typeof e && e;
10267            r || i.data("bs.scrollspy", r = new s(this, o)), "string" == typeof e && r[e]()
10268        })
10269    }
10270    s.VERSION = "3.2.0", s.DEFAULTS = {
10271        offset: 10
10272    }, s.prototype.getScrollHeight = function() {
10273        return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
10274    }, s.prototype.refresh = function() {
10275        var s = "offset",
10276            e = 0;
10277        t.isWindow(this.$scrollElement[0]) || (s = "position", e = this.$scrollElement.scrollTop()), this.offsets = [], this.targets = [], this.scrollHeight = this.get
10277ScrollHeight();
10278        var i = this;
10279        this.$body.find(this.selector).map(function() {
10280            var i = t(this),
10281                r = i.data("target") || i.attr("href"),
10282                o = /^#./.test(r) && t(r);
10283            return o && o.length && o.is(":visible") && [
10284                [o[s]().top + e, r]
10285            ] || null
10286        }).sort(function(t, s) {
10287            return t[0] - s[0]
10288        }).each(function() {
10289            i.offsets.push(this[0]), i.targets.push(this[1])
10290        })
10291    }, s.prototype.process = function() {
10292    	var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0 && $('body[data-hhun="1"]').length == 0) ? $('.page-submenu').height() : 0;
10293
10294        var t, s = this.$scrollElement.scrollTop() + this.options.offset + $pageSubMenu,
10295            e = this.getScrollHeight(),
10296            i = this.options.offset + e - this.$scrollElement.height() -$pageSubMenu,
10297            r = this.offsets,
10298            o = this.targets,
10299            l = this.activeTarget;
10300        if (this.scrollHeight != e && this.refresh(), s >= i) return l != (t = o[o.length - 1]) && this.activate(t);
10301        if (l && s <= r[0]) return l != (t = o[0]) && this.activate(t);
10302        for (t = r.length; t--;) l != o[t] && s >= r[t] && (!r[t + 1] || s <= r[t + 1]) && this.activate(o[t])
10303    }, s.prototype.activate = function(s) {
10304        this.activeTarget = s, t(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover');
10305        var e = this.selector + '[data-target="' + s + '"],' + this.selector + '[href="' + s + '"]',
10306            i = t(e).parents("li").addClass("current-menu-item");
10307        i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("current-menu-item")), i.trigger("activate.bs.scrollspy")
10308    };
10309    var i = t.fn.scrollspy;
10310    t.fn.scrollspy = e, t.fn.scrollspy.Constructor = s, t.fn.scrollspy.noConflict = function() {
10311        return t.fn.scrollspy = i, this
10312    }
10313}(jQuery);
10314
10315
10316var shrinkNum = 6;	
10317if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
10318headerPadding2 = headerPadding - headerPadding/1.8;
10319
10320setTimeout(scrollSpyInit,200);
10321
10322var $animatedScrollingTimeout;
10323
10324$('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){
10325if(window.location.pathname !== '/catalogue/'){
10326	var $hash = $(this).prop("hash");	
10327
10328	$('body').addClass('animated-scrolling');
10329	clearTimeout($animatedScrollingTimeout);
10330	$animatedScrollingTimeout = setTimeout(function(){ $('body').removeClass('animated-scrolling'); },850);
10331
10332	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') {
10333
10334		//stop scrolling for certain elements
10335		//if($(this).parents('.tabbed').length > 0) return false;
10336		
10337		//update hash
10338		if(history.pushState) {
10339		    history.pushState(null, null, $hash);
10340		}
10341		else {
10342		    location.hash = $hash;
10343		}
10344
10345		if($(this).parents('ul').length > 0) { 
10346			$(this).parents('ul').find('li').removeClass('current-menu-item');
10347			//$(this).parents('li').addClass('current-menu-item');
10348		}
10349
10350		//side widget area click
10351		if($(this).parents('#slide-out-widget-area').length > 0){
10352			$('#slide-out-widget-area .slide_out_area_close').trigger('click');
10353		}
10354
10355		//mobile menu click
10356		if($(this).parents('#mobile-menu').length > 0) $('#toggle-nav').trigger('click');
10357		var $mobileMenuHeight = ($(this).parents('#mobile-menu').length > 0) ? $(this).parents('#mobile-menu').height() : null;
10358		
10359		$timeoutVar = 1;
10360		if($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
10361			boxRoll(null,-1);
10362			$timeoutVar = 2050;
10363		} 
10364
10365		var $that = $(this);
10366
10367		setTimeout(function(){
10368
10369			//scrolling
10370			var $headerSpace = ($('body[data-permanent-transparent="1"]').length > 0) ? 0 : parseInt($('#header-space').height());
10371
10372			if( $('body[data-permanent-transparent="1"]').length == 0 ) {
10373				
10374				if(!$('body').hasClass('mobile')){
10375					$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
10376					var $scrollTopDistance =  $($hash).offset().top - $mobileMenuHeight - parseInt($('#header-space').height()) +$resize + 3 - adminBarHeight;
10377				} else {
10378					var $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $('#header-space').height() + adminBarHeight : $($hash).offset().top - $mobileMenuHeight - adminBarHeight + 1;	
10379				}
10380
10381			} else {
10382				var $scrollTopDistance = $($hash).offset().top - adminBarHeight + 1;
10383			}
10384
10385			if($('body[data-hhun="1"]').length > 0) {
10386				//alter offset 
10387				if($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) 
10388					$scrollTopDistance = $scrollTopDistance + $('#header-space').height();
10389
10390				//hide top header
10391				if($that.parents('.page-submenu[data-sticky="true"]').length > 0) { 
10392					$('#header-outer.detached').addClass('invisible');
10393					$('.page-submenu').addClass('header-not-visible').css('transform','translateY(0px)');
10394				}
10395			} 
10396
10397			var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0;
10398			$('body,html').stop().animate({
10399				scrollTop: $scrollTopDistance - $pageSubMenu
10400			},800,'easeInOutCubic');
10401
10402		},$timeoutVar);
10403		
10404
10405		e.preventDefault();
10406
10407	}
10408
10409	if($hash == '#top') {
10410		//side widget area click
10411		if($(this).parents('#slide-out-widget-area').length > 0){
10412			$('#slide-out-widget-area .slide_out_area_close').trigger('click');
10413		}
10414	}
10415}
10416
10417});
10418
10419
10420if($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) $(window).load(pageLoadHash);
10421
10422}
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433	//portfolio colors
10434	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 ) {
10435		var portfolioColorCss = '';
10436		$('.portfolio-items .col').each(function(){
10437			$titleColor = $(this).attr('data-title-color');
10438			$subTitleColor = $(this).attr('data-subtitle-color');
10439
10440			 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+'; } ';
10441			 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+'; } ';
10442		});
10443
10444
10445		var head = document.head || document.getElementsByTagName('head')[0];
10446		var style = document.createElement('style');
10447
10448			style.type = 'text/css';
10449		if (style.styleSheet){
10450		  style.styleSheet.cssText = portfolioColorCss;
10451		} else {
10452		  style.appendChild(document.createTextNode(portfolioColorCss));
10453		}
10454
10455		head.appendChild(style);
10456	}
10457
10458	// masonryPortfolio
10459
10460	var $portfolio_containers = [];
10461
10462	$('.portfolio-items:not(.carousel)').each(function(i){
10463		$portfolio_containers[i] = $(this);
10464	});
10465
10466	function masonryPortfolioInit() {
10467
10468		$portfolio_containers = [];
10469		$('.portfolio-items:not(.carousel)').each(function(i){
10470			$portfolio_containers[i] = $(this);
10471		});
10472
10473		//// cache window
10474		var $window = jQuery(window);	
10475		
10476			
10477			$.each($portfolio_containers,function(i){
10478
10479				
10480				//// start up isotope with default settings
10481				$portfolio_containers[i].imagesLoaded(function(){
10482					
10483					//verify smooth scorlling
10484					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') } 
10485					
10486					//transformns enabled logic
10487					var $isoUseTransforms = true;
10488					
10489					//Panr 
10490					if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
10491						
10492						$(".portfolio-items:not(.carousel) .work-item.style-3 img").panr({ scaleDuration: .28 }); 
10493						$(".portfolio-items:not(.carousel) .work-item.style-3-alt img").panr({ scaleDuration: .28, sensitivity: 20, scaleTo: 1.12, panDuration: 1 }); 
10494
10495						$isoUseTransforms = true;
10496						
10497					}
10498
10499					piVertCenter();
10500
10501					//initial call to setup isotope
10502					var $layoutMode = ( $portfolio_containers[i].hasClass('masonry-items')) ? 'packery' : 'fitRows';
10503					var $startingFilter = ($portfolio_containers[i].attr('data-starting-filter') != '' && $portfolio_containers[i].attr('data-starting-filter') != 'default') ? '.' + $portfolio_containers[i].attr('data-starting-filter') : '*';
10504
10505					reLayout();
10506					
10507					$portfolio_containers[i].isotope({
10508					  itemSelector : '.element',
10509					  filter: $startingFilter,
10510					  layoutMode: $layoutMode,
10511					  transitionDuration: '0.6s',
10512					  packery: {
10513						 gutter: 0
10514					  }
10515					}).isotope( 'layout' );
10516					
10517					
10518					if($startingFilter != '*'){
10519						$('.portfolio-filters ul a[data-filter="'+$startingFilter+'"], .portfolio-filters-inline ul a[data-filter="'+$startingFilter+'"]').click();
10520					}
10521
10522					//call the reLayout to get things rollin'
10523					masonryZindex();
10524					setTimeout(function(){masonryZindex(); },800);
10525					$window.resize( reLayout );
10526					$window.smartresize( function(){
10527						setTimeout(masonryZindex,700);
10528					});
10529					
10530					//inside fwc fix
10531					if($portfolio_containers[i].parents('.full-width-content').length > 0) { setTimeout(function(){ fullWidthContentColumns(); },200);  }
10532
10533					//fadeout the loading animation
10534					$('.portfolio-loading').stop(true,true).fadeOut(200);
10535					
10536					//fadeIn items one by one
10537
10538					if($portfolio_containers[i].find('.inner-wrap').attr('data-animation') == 'none') {
10539						$('.portfolio-items .col .inner-wrap').removeClass('animated');
10540					} else {
10541
10542						portfolioLoadIn();
10543					}
10544			
10545				});
10546				
10547
10548
10549			});//each
10550			
10551		
10552
10553	}
10554
10555	masonryPortfolioInit();
10556
10557	function portfolioLoadIn() {
10558
10559		$($fullscreenSelector+'.portfolio-items').each(function(){
10560
10561			$portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '100%' : '90%';
10562
10563			if($(this).find('.inner-wrap').attr('data-animation') == 'none') return;
10564
10565			var $that = $(this);
10566			var waypoint = new Waypoint({
10567 			element: $that,
10568 			 handler: function(direction) {
10569				
10570				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
10571				     waypoint.destroy();
10572				     return;
10573				}
10574
10575				$that.find('.col').each(function(i){
10576					$(this).delay(130*i).queue(function(next){
10577					    $(this).addClass("animated-in");
10578					    next();
10579					});
10580				});
10581				
10582				waypoint.destroy();
10583			},
10584			offset: $portfolioOffsetPos
10585
10586			}); 
10587
10588		}); //each
10589					
10590	}
10591
10592
10593	
10594
10595	var mediaQuerySize;
10596	function reLayout() {
10597
10598		clearTimeout(clearIsoAnimation);
10599	    $('.portfolio-items .col').addClass('no-transition');
10600	    clearIsoAnimation = setTimeout(function(){  $('.portfolio-items .col').removeClass('no-transition'); },700); 
10601
10602		var windowSize = $window.width();
10603		var masonryObj;
10604		var masonryObjHolder = [];
10605
10606		//remove double quotes for FF
10607		//if (navigator.userAgent.match('MSIE 8') == null) {
10608		//	mediaQuerySize = mediaQuerySize.replace(/"/g, '');
10609		//}
10610		
10611		//user defined cols
10612		var userDefinedColWidth;
10613
10614		$.each($portfolio_containers,function(i){
10615
10616			if( $portfolio_containers[i].attr('data-user-defined-cols') == 'span4') {
10617				userDefinedColWidth = 3
10618			} 
10619			
10620			else if( $portfolio_containers[i].attr('data-user-defined-cols') == 'span3') {
10621				userDefinedColWidth = 4
10622			} 
10623			
10624			var isFullWidth = $portfolio_containers[i].attr('data-col-num') == 'elastic';
10625			
10626			
10627			//chrome 33 approved method for getting column sizing
10628			if(window.innerWidth > 1600){
10629				
10630				if($portfolio_containers[i].hasClass('constrain-max-cols')) {
10631					mediaQuerySize = 'four';
10632				} else {
10633					mediaQuerySize = 'five';
10634				}
10635				
10636			} else if(window.innerWidth <= 1600 && window.innerWidth > 1300){
10637				mediaQuerySize = 'four';
10638			} else if(window.innerWidth <= 1300 && window.innerWidth > 990){
10639				
10640				if($portfolio_containers[i].hasClass('constrain-max-cols')) {
10641					mediaQuerySize = 'four';
10642				} else {
10643					mediaQuerySize = 'three';
10644				}
10645				
10646			} else if(window.innerWidth <= 990 && window.innerWidth > 470){
10647				mediaQuerySize = 'two';
10648			} else if(window.innerWidth <= 470){
10649				mediaQuerySize = 'one';
10650			}
10651			
10652			//boxed
10653			if($('#boxed').length > 0) {
10654				if(window.innerWidth > 1300){
10655					mediaQuerySize = 'four';
10656				} else if(window.innerWidth < 1300 && window.innerWidth > 990){
10657					
10658					if($portfolio_containers[i].hasClass('constrain-max-cols')) {
10659						mediaQuerySize = 'four';
10660					} else {
10661						mediaQuerySize = 'three';
10662					}
10663
10664				} else if(window.innerWidth < 990){
10665					mediaQuerySize = 'one';
10666				}
10667				
10668			}
10669			
10670			//change masonry columns depending on screen size
10671			switch (mediaQuerySize) {
10672				case 'five':
10673					(isFullWidth) ? colWidth = 5 : colWidth = userDefinedColWidth;
10674					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
10675				break;
10676				
10677				case 'four':
10678					(isFullWidth) ? colWidth = 4 : colWidth = userDefinedColWidth;
10679
10680					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
10681				break;
10682				
10683				case 'three':
10684					(isFullWidth) ? colWidth = 3 : colWidth = userDefinedColWidth;
10685					
10686					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
10687				break;
10688				
10689				case 'two':
10690					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / 2) };
10691				break;
10692				
10693				case 'one':
10694					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / 1) };
10695				break;
10696			}
10697
10698
10699			//set widths
10700			portfolioItemWidths();
10701
10702
10703			//sizing for large items
10704			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) {
10705
10706			var multipler = (window.innerWidth > 470) ? 2 : 1;
10707
10708			//reset height for calcs
10709			$itemClassForSizing = 'regular';
10710
10711			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) {
10712				$itemClassForSizing = 'wide';
10713			} 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) {
10714				$itemClassForSizing = 'wide_tall';
10715				multipler = 1;
10716			} 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) {
10717				$itemClassForSizing = 'tall';
10718				multipler = 1;
10719			}
10720
10721		    $portfolio_containers[i].find('.col.elastic-portfolio-item.'+$itemClassForSizing+' img').css('height','auto');
10722
10723			var tallColHeight = $portfolio_containers[i].find('.col.elastic-portfolio-item.'+$itemClassForSizing+':first:visible img').height();
10724			
10725			 $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');
10726			 $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="tall"] img:not(.custom-thumbnail)').css('height',(tallColHeight*multipler));
10727			 $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);
10728			 
10729			 $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 );
10730			 $portfolio_containers[i].find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',tallColHeight);
10731			
10732			} else {
10733				$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');
10734			}
10735
10736			//non masonry
10737
10738			if($portfolio_containers[i].hasClass('no-masonry') && $portfolio_containers[i].find('.col:first:visible').length > 0 && $portfolio_containers[i].parents('.wpb_gallery').length == 0){
10739			  
10740			   //reset height for calcs
10741		   	   $portfolio_containers[i].find('.col img').css('height','auto');
10742		   	   var tallColHeight = $portfolio_containers[i].find('.col:first:visible img').height();
10743		   	   $portfolio_containers[i].find('.col img:not(.custom-thumbnail)').css('height',tallColHeight);
10744		   	   $portfolio_containers[i].find('.col .parallaxImg').css('height',tallColHeight);
10745			}
10746
10747
10748			masonryObjHolder[i] = masonryObj;
10749			
10750			if($portfolio_containers[i].isotope()) $portfolio_containers[i].isotope( 'layout' ); 
10751				
10752			
10753
10754		}); //each
10755	
10756	}
10757
10758	function portfolioItemWidths() {
10759		 $.each($portfolio_containers,function(i,v){
10760		 	var $colSize = 4;
10761		 	var $mult = (mediaQuerySize == 'one') ? 1 : 2;
10762		 	if(mediaQuerySize == 'five') $colSize = 5;
10763		 	if(mediaQuerySize == 'four') $colSize = 4;
10764		 	if(mediaQuerySize == 'three') $colSize = 3;
10765		 	if(mediaQuerySize == 'two') $colSize = 2;
10766		 	if(mediaQuerySize == 'one') $colSize = 1;
10767		 	if($(v).is('[data-ps="6"]') && $colSize == 5) $colSize = 4;
10768
10769		 	if($(v).width() % $colSize == 0) {
10770			 	$(v).find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',Math.floor($(v).width()/$colSize) +'px');
10771			 	$(v).find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',Math.floor($(v).width()/$colSize*$mult) +'px');
10772			 } else {
10773			 	//find closest number to give 0
10774			 	for(var i = 1; i<4; i++) {
10775			 		if(($(v).width() - i) % $colSize == 0) {
10776			 			$(v).find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',($(v).width()- i)/$colSize +'px');
10777			 			$(v).find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',($(v).width()-i)/$colSize*$mult +'px');
10778			 		}
10779
10780			 	}
10781			 }
10782		 	
10783		 });
10784	}
10785
10786	//z-index for masonry
10787	function masonryZindex(){
10788		
10789		//escape if no browser support
10790		if($('body .portfolio-items:not(".carousel") .elastic-portfolio-item').css('left')) {
10791		
10792			var $coords = {};
10793			var $zindexRelation = {};
10794			
10795			$('body .portfolio-items:not(".carousel") .elastic-portfolio-item').each(function(){
10796				//$coords[$(this).index()] = $(this).css('left').substring(0, $(this).css('left').length - 2);
10797				$(this).css('z-index',Math.abs(Math.floor($(this).offset().left/20)));
10798			});
10799			
10800			/*var $corrdsArr = $.map($coords, function (value) { return value; });
10801
10802			$corrdsArr = removeDuplicates($corrdsArr);
10803			$corrdsArr.sort(function(a,b){return a-b});
10804
10805			for(var i = 0; i < $corrdsArr.length; i++){
10806				$zindexRelation[$corrdsArr[i]] = i*10; 
10807			}
10808	
10809			$.each($coords,function(k,v){
10810				
10811				var $zindex;
10812				var $coordCache = v;
10813				$.each($zindexRelation,function(k,v){
10814					if($coordCache == k) {
10815						$zindex = v;
10816					}
10817				});
10818	
10819				$('body .portfolio-items:not(".carousel") .elastic-portfolio-item:eq('+k+')').css('z-index',$zindex);
10820			});*/
10821			
10822		}
10823
10824
10825	}
10826
10827	function blogMasonryZindex(){
10828		
10829		//escape if no browser support
10830		if($('body .masonry.meta_overlaid .masonry-blog-item').css('left')) {
10831		
10832			var $coords = {};
10833			var $zindexRelation = {};
10834			
10835			$('body .masonry.meta_overlaid .masonry-blog-item').each(function(){
10836				$coords[$(this).index()] = $(this).css('left').substring(0, $(this).css('left').length - 2);
10837			});
10838			
10839			var $corrdsArr = $.map($coords, function (value) { return value; });
10840			$corrdsArr = removeDuplicates($corrdsArr);
10841			$corrdsArr.sort(function(a,b){return a-b});
10842	
10843			for(var i = 0; i < $corrdsArr.length; i++){
10844				$zindexRelation[$corrdsArr[i]] = i*10; 
10845			}
10846	
10847			$.each($coords,function(k,v){
10848				
10849				var $zindex;
10850				var $coordCache = v;
10851				$.each($zindexRelation,function(k,v){
10852					if($coordCache == k) {
10853						$zindex = v;
10854					}
10855				});
10856	
10857				$('body .masonry.meta_overlaid .masonry-blog-item:eq('+k+')').css('z-index',$zindex);
10858			});
10859			
10860		}
10861		
10862	}
10863	
10864	function matrixToArray(matrix) {
10865	    return matrix.substr(7, matrix.length - 8).split(', ');
10866	}
10867	
10868	function removeDuplicates(inputArray) {
10869        var i;
10870        var len = inputArray.length;
10871        var outputArray = [];
10872        var temp = {};
10873
10874        for (i = 0; i < len; i++) {
10875            temp[inputArray[i]] = 0;
10876        }
10877        for (i in temp) {
10878            outputArray.push(i);
10879        }
10880        return outputArray;
10881    }
10882
10883    //// filter items when filter link is clicked
10884	var clearIsoAnimation = null;
10885	var $checkForScrollBar = null;
10886
10887
10888	//number portfolios so multiple sortable ones can work easily on same page
10889	$('.portfolio-items:not(".carousel")').each(function(i){
10890		$(this).attr('instance',i);
10891		$(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance',i);
10892	});
10893
10894    function isoClickFilter(){
10895		 var $timeout;		 
10896		 if(window.innerWidth > 690 && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
10897		 	
10898
10899		 	/*clearInterval($checkForScrollBar);
10900
10901		 	if($('html').outerHeight(true) > $(window).height()) {
10902
10903			 	$checkForScrollBar = null;
10904			 	$checkForScrollBar = setInterval(function(){ 
10905
10906			 		if($('body').height() <= $(window).height()) {
10907			 			fullWidthSections();
10908			 			$(window).trigger('resize');
10909			 			clearInterval($checkForScrollBar);
10910			 		} 
10911			 	},40);
10912			} else {
10913
10914				$checkForScrollBar = null;
10915			 	$checkForScrollBar = setInterval(function(){ 
10916
10917			 		if($('html').outerHeight(true) > $(window).height()) {
10918			 			fullWidthSections();
10919			 			$(window).trigger('resize');
10920			 			clearInterval($checkForScrollBar);
10921			 		} 
10922			 	},40);
10923			}*/	 
10924
10925			 //add css animation only for sorting	 
10926			/*  clearTimeout(clearIsoAnimation);
10927			  $('.isotope, .isotope .isotope-item').css('transition-duration','0.7s');
10928			  clearIsoAnimation = setTimeout(function(){  $('.isotope, .isotope .isotope-item').css('transition-duration','0s'); },700); */
10929			  
10930			 clearTimeout($timeout);
10931			 $timeout = setTimeout(function(){masonryZindex();  },600);
10932
10933			  
10934		 }
10935		  
10936		  var selector = $(this).attr('data-filter');
10937		  var $instance = $(this).parents('div[class^=portfolio-filters]').attr('instance');
10938
10939		  $.each($portfolio_containers,function(i){
10940		  	if($portfolio_containers[i].attr('instance') == $instance) $portfolio_containers[i].isotope({ filter: selector }).attr('data-current-cat',selector);
10941		  });
10942
10943
10944		  //active classes
10945		  $(this).parent().parent().find('li a').removeClass('active');
10946		  $(this).addClass('active');
10947		  
10948		  //update pp
10949		  if($('.portfolio-items a[rel^="prettyPhoto"]').length > 0) {
10950		  	setTimeout(updatePrettyPhotoGallery,170);
10951		  }
10952
10953		  else {
10954		  	setTimeout(updateMagPrettyPhotoGallery,170);
10955		  }
10956
10957		  return false;
10958	}
10959
10960	////filter event
10961	$('body').on('click','.portfolio-filters ul li a, .portfolio-filters-inline ul li a', isoClickFilter);
10962
10963
10964	function updatePrettyPhotoGallery(){
10965		$('.portfolio-items').each(function(){
10966
10967			if($(this).find('a[rel^="prettyPhoto"]').length > 0) {
10968
10969			var $unique_id = Math.floor(Math.random()*10000);
10970			var $currentCat = $(this).attr('data-current-cat');
10971			$(this).find('.col'+$currentCat).find('a[rel^="prettyPhoto"]').attr('rel','prettyPhoto['+$unique_id+'_sorted]');
10972			
10973			} 
10974			
10975		});
10976	}
10977
10978	function updateMagPrettyPhotoGallery(){
10979		$('.portfolio-items').each(function(){
10980			
10981			var $currentCat = $(this).attr('data-current-cat');
10982
10983			$(this).find('.col').each(function(){
10984
10985				$(this).find('a.gallery').removeClass('gallery').removeClass('magnific');
10986				
10987				if($(this).is($currentCat))
10988					$(this).find('.work-info a').addClass('gallery').addClass('magnific');
10989
10990			});
10991		
10992			
10993		});
10994	}
10995
10996
10997
10998    function masonryBlogInit() {
10999
11000		var $posts_container = $('.posts-container')
11001		
11002		if($posts_container.parent().hasClass('masonry')) { 
11003			
11004			$posts_container.find('article').addClass('masonry-blog-item');
11005			$posts_container.find('article').prepend('<span class="bottom-line"></span>');
11006			
11007			//move the meta to the bottom
11008			$posts_container.find('article').each(function(){
11009				
11010				var $metaClone = $(this).find('.post-meta').clone();
11011
11012				$(this).find('.post-meta').remove();
11013
11014				if($('#post-area.meta_overlaid').length > 0){
11015					$(this).find('.post-header h2').after($metaClone);
11016				} else {
11017					$(this).find('.content-inner').after($metaClone);
11018				}
11019				
11020			});
11021		
11022			
11023			if($posts_container.parent().hasClass('masonry') && $posts_container.parent().hasClass('full-width-content')){
11024				$posts_container.parent().wrap('<div class="full-width-content blog-fullwidth-wrap"> </div>').removeClass('full-width-content').css({'margin-left':'0','width':'auto'});
11025				
11026				//page header animation fix
11027				if( $posts_container.parents('.wpb_row').length > 0 ) $posts_container.parents('.wpb_row').css('z-index',100);
11028
11029				if($('.masonry.meta_overlaid').length == 0) {
11030
11031					if($('.masonry.classic_enhanced').length > 0) {
11032						$posts_container.parent().parents('.full-width-content').css({
11033							'padding' : '0px 0.2% 0px 2.4%'
11034						});
11035					} else {
11036						$posts_container.parent().parents('.full-width-content').css({
11037							'padding' : '0px 0.2% 0px 3.2%'
11038						});
11039					}
11040					
11041				} else {
11042					$posts_container.parent().parents('.full-width-content').addClass('meta-overlaid');
11043					$('.container-wrap').addClass('meta_overlaid_blog');
11044				}
11045
11046				fullWidthSections(); 
11047			}
11048			
11049			var $cols = 3;
11050			var $element = $posts_container;
11051			
11052			if($posts_container.find('img').length == 0) $element = $('<img />');
11053		
11054			imagesLoaded($element,function(instance){
11055				
11056				if($('body').hasClass('mobile') || $('#post-area').hasClass('span_9')) {
11057					$cols = 2;
11058				}
11059
11060				//set img as BG if masonry classic enhanced
11061				if($posts_container.parent().hasClass('classic_enhanced')){
11062					$posts_container.find('.large_featured.has-post-thumbnail .post-featured-img, .wide_tall.has-post-thumbnail .post-featured-img').each(function(){
11063						var $src = $(this).find('img').attr('src');
11064						$(this).css('background-image','url('+$src+')');
11065					});
11066
11067					$posts_container.find('.large_featured .nectar-flickity, .wide_tall .nectar-flickity').each(function(){
11068
11069						$(this).find('.cell').each(function(){
11070							var $src = $(this).find('img').attr('src');
11071							$(this).css('background-image','url('+$src+')');
11072						});
11073						
11074					});
11075				}
11076
11077				$cols = blogColumnNumbCalcs();
11078				blogHeightCalcs($posts_container, $cols);
11079
11080				if($('#post-area.meta_overlaid').length > 0) {
11081					$posts_container.isotope({
11082					   itemSelector: 'article',
11083					   transitionDuration: '0s',
11084					   layoutMode: 'packery',
11085					   packery: { 
11086					   	 gutter: 0
11087					   	}
11088					}).isotope( 'layout' );
11089
11090				   
11091				} else {
11092				   if($posts_container.parent().hasClass('classic_enhanced')) {
11093					   	if($('.span_9.masonry').length == 0) {
11094					   		$multiplier = (window.innerWidth >= 1600) ? .015 : .02;
11095					   	} else {
11096					   		$multiplier = .04;
11097					    } 
11098				    }
11099				   else {
11100				   	$multiplier = ($('.span_9.masonry').length == 0) ? .02: .04;
11101				   }	
11102					$posts_container.isotope({
11103					   itemSelector: 'article',
11104					   transitionDuration: '0s',
11105					   layoutMode: 'packery',
11106					   packery: { 
11107					   	 gutter: $('#post-area').width()*$multiplier
11108					   	}
11109					}).isotope( 'layout' );
11110				}
11111
11112				blogLoadIn();
11113				flickityBlogInit();
11114				
11115				$(window).trigger('resize');
11116
11117				blogMasonryZindex();
11118				setTimeout(blogMasonryZindex,700);
11119				$window.smartresize( function(){
11120					setTimeout(blogMasonryZindex,700);
11121				});
11122					
11123			});
11124			
11125			$(window).resize(function(){
11126				
11127
11128			   //size all items in grid 
11129			   //sizing for large items
11130			    $cols = blogColumnNumbCalcs();
11131				blogHeightCalcs($posts_container, $cols);
11132
11133				if($('#post-area.meta_overlaid').length > 0) {
11134				
11135				    $posts_container.isotope({
11136				      layoutMode: 'packery',
11137				      packery: {
11138				      	 gutter: 0
11139				      }
11140				   });
11141				} else {
11142				   
11143				   if($posts_container.parent().hasClass('classic_enhanced')) {
11144				   		if($('.span_9.masonry').length == 0) {
11145					   		$multiplier = (window.innerWidth >= 1600) ? .015 : .02;
11146					   	} else {
11147					   		$multiplier = .04;
11148					    } 
11149				   } else {
11150				   	$multiplier = ($('.span_9.masonry').length == 0) ? .02: .04;
11151				   }	
11152				  
11153				   $posts_container.isotope({
11154				   	layoutMode: 'packery',
11155				      packery: { 
11156				      	gutter: $('#post-area').width()*$multiplier
11157				      }
11158				   });
11159				}
11160
11161			});
11162			
11163			
11164	    } else {
11165	    	blogLoadIn();
11166	    }
11167
11168	}
11169	
11170	masonryBlogInit();
11171
11172	function blogLoadIn(){
11173
11174		$('.posts-container').each(function(){
11175
11176			if($(this).attr('data-load-animation') == 'none') {
11177			
11178				$(this).find('.inner-wrap').removeClass('animated');
11179			} else {
11180
11181				var $that = $(this);
11182				var waypoint = new Waypoint({
11183	 			element: $that,
11184	 			 handler: function(direction) {
11185					
11186					$that.find('article').each(function(i){
11187						$(this).delay(130*i).queue(function(next){
11188						    $(this).addClass("animated-in");
11189						    next();
11190						});
11191					});
11192					
11193					waypoint.destroy();
11194				},
11195				offset: '90%'
11196
11197				}); 
11198				
11199			}
11200
11201		}); //each
11202	}
11203
11204	function blogHeightCalcs($posts_container, cols) {
11205		if( $posts_container.parent().hasClass('meta_overlaid') && $posts_container.find('article[class*="regular"]').length > 0) {
11206
11207			//widths
11208			$.each($posts_container,function(i,v){
11209			 	var $colSize = 4;
11210			 	var $mult = (cols == 1) ? 1 : 2;
11211
11212			 	//check if higher than IE9 -- bugs out with width calc
11213			 	if($('html.no-csstransitions').length == 0) {
11214			 		$(v).find('article[class*="regular"]').css('width',Math.floor($(v).width()/cols) +'px');
11215			 		$(v).find('article[class*="tall"]').css('width',Math.floor($(v).width()/cols*$mult) +'px');
11216			 	} else {
11217			 		$('#post-area.masonry').css('width','100%');
11218			 	}
11219			 	
11220			 	
11221			 });
11222
11223			   //reset height for calcs
11224			   $posts_container.find('article[class*="regular"] img').css('height','auto');
11225
11226			   var tallColHeight = Math.ceil($posts_container.find('article[class*="regular"]:not(".format-link"):not(".format-quote") img').first().height());
11227			   var multipler = (window.innerWidth > 470) ? 2 : 1 ;
11228			   $posts_container.find('article[class*="tall"] img, .article.wide img, article.regular img').removeClass('auto-height');
11229			   $posts_container.find('article[class*="tall"] img').css('height',(tallColHeight*multipler));
11230			   $posts_container.find('article[class*="regular"] img').css('height',(tallColHeight));
11231			   //quote/links
11232			   $posts_container.find('article.regular.format-link,article.regular.format-quote').each(function(){
11233
11234			   		if(window.innerWidth > 470) {
11235			   			$(this).css({
11236			  	 			'height': tallColHeight
11237			   			});
11238			   		} else {
11239			   			$(this).css({
11240			  	 			'height': 'auto'
11241			   			});			 		
11242			   		}
11243			  	 	
11244			   	});
11245
11246
11247		} else {
11248			$posts_container.find('article[class*="tall"] img, article.regular img').addClass('auto-height');
11249		}
11250
11251
11252		if( $posts_container.parent().hasClass('classic_enhanced') && $posts_container.find('article[class*="regular"]').length > 0) {
11253			if($(window).width() > 690 ) 
11254				classicEnhancedSizing($posts_container.find('article:not(.large_featured):not(.wide_tall)'));
11255			else 
11256				classicEnhancedSizing($posts_container.find('article:not(.wide_tall)'));
11257
11258			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;
11259
11260			if($(window).width() > 690 ) 
11261				$posts_container.find('article.large_featured, article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
11262			else 
11263				$posts_container.find('article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
11264
11265		//for when no regular articles exist	
11266		} else if( $posts_container.parent().hasClass('classic_enhanced') && $posts_container.find('article[class*="regular"]').length == 0) {
11267			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;
11268
11269			if($(window).width() > 690 ) 
11270				$posts_container.find('article.large_featured, article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
11271			else 
11272				$posts_container.find('article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
11273		}
11274
11275		//IE9 fix
11276		if($('html.no-csstransitions').length > 0) 		
11277			$('#post-area.masonry').css('width','100%');
11278			 	
11279			 	
11280	}
11281
11282	function classicEnhancedSizing(elements) {
11283
11284		var tallestCol = 0;
11285		elements.find('.article-content-wrap').css('height','auto');
11286		elements.filter('.has-post-thumbnail').each(function(){
11287			($(this).find('.article-content-wrap').outerHeight(true) > tallestCol) ? tallestCol = $(this).find('.article-content-wrap').outerHeight(true) : tallestCol = tallestCol;
11288		});	
11289		
11290		elements.filter('.has-post-thumbnail').find('.article-content-wrap').css('height',(tallestCol));
11291
11292	}
11293
11294
11295	var blogMediaQuerySize;
11296	function blogColumnNumbCalcs(){
11297		   if($('body').hasClass('mobile') && window.innerWidth < 990 || $('#post-area').hasClass('span_9') && $('#post-area.meta_overlaid').length == 0) {
11298			   $cols = 2;
11299		   } else if( $('#post-area').hasClass('full-width-content') || $('#post-area').parent().hasClass('full-width-content') && $('#boxed').length == 0 || $('#post-area.meta_overlaid').length > 0 ){
11300		   		
11301				var windowSize = $(window).width();
11302
11303				
11304				if(window.innerWidth >= 1600){
11305					blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'four' :'five';
11306				} else if(window.innerWidth < 1600 && window.innerWidth >= 1300){
11307					blogMediaQuerySize = 'four';
11308				} else if(window.innerWidth < 1300 && window.innerWidth >= 990){
11309					blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'four' :'three';
11310				} else if(window.innerWidth < 990 && window.innerWidth >= 470){
11311					blogMediaQuerySize = 'two';
11312				} else if(window.innerWidth < 470){
11313					blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'two' :'one';
11314				}
11315			
11316				
11317				//boxed
11318				if($('#boxed').length > 0) {
11319					if(window.innerWidth > 1300){
11320						blogMediaQuerySize = 'four';
11321					} else if(window.innerWidth < 1300 && window.innerWidth > 990){
11322						blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'four' :'three';
11323					} else if(window.innerWidth < 990){
11324						blogMediaQuerySize = ($('#post-area.meta_overlaid').length > 0) ? 'two' :'one';
11325					}
11326					
11327				}
11328				
11329				
11330				switch (blogMediaQuerySize) {
11331					case 'five':
11332						$cols = 5;
11333					break;
11334					
11335					case 'four':
11336						$cols = 4;
11337					break;
11338					
11339					case 'three':
11340						$cols = 3;
11341					break;
11342					
11343					case 'two':
11344						$cols = 2;
11345					break;
11346					
11347					case 'one':
11348						$cols = 1;
11349					break;
11350				}
11351		   		
11352			
11353		   } else {
11354
11355		   	   $cols = 3;
11356		   }
11357
11358		   return $cols;
11359
11360	}
11361
11362
11363
11364
11365
11366
11367var shrinkNum = 6;
11368		
11369if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
11370
11371headerPadding2 = headerPadding - headerPadding/1.8;
11372
11373$('body').on('click','.section-down-arrow',function(){
11374	
11375	if($(this).parents('.nectar-box-roll').length > 0) return false;
11376
11377	var $currentSection = $(this).parents('#page-header-bg');
11378	var $topDistance = $currentSection.attr('data-height');
11379	var $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0;
11380	var $bodyBorderSize = ($('.body-border-top').length > 0 && $(window).width() > 690) ? $('.body-border-top').height(): 0;
11381
11382	if($('body[data-permanent-transparent="1"]').length == 0) {
11383		//regular
11384		if(!$('body').hasClass('mobile')){
11385			if($('body[data-hhun="1"]').length > 0) {
11386				$('body,html').stop().animate({
11387					scrollTop: parseInt($topDistance) + $offset + 2 - $bodyBorderSize*2
11388				},1000,'easeInOutCubic')
11389			} else {
11390				$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
11391				$('body,html').stop().animate({
11392					scrollTop: parseInt($topDistance - $('#header-space').height()) +$resize + 3 + $offset 
11393				},1000,'easeInOutCubic')
11394			}
11395			
11396		} else {
11397			$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;
11398			$('body,html').stop().animate({
11399				scrollTop: $scrollPos - $bodyBorderSize*2
11400			},1000,'easeInOutCubic')
11401		}
11402	} else {
11403		//permanent transparent
11404		$('body,html').stop().animate({
11405			scrollTop: parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize*2
11406		},1000,'easeInOutCubic')
11407	}
11408	return false;
11409});
11410
11411
11412
11413
11414
11415
11416
11417/*-------------------------------------------------------------------------*/
11418/*	7.	Cross Browser Fixes
11419/*-------------------------------------------------------------------------*/	
11420	 
11421	 function crossBrowserFixes() {
11422
11423		//Fix current class in menu 
11424		if ($("body").hasClass("single-portfolio") || $('body').hasClass("error404") || $('body').hasClass("search-results")) {   
11425			$("li").removeClass("current_page_parent").removeClass("current-menu-ancestor").removeClass('current_page_ancestor');   
11426		}
11427		
11428
11429		//fix for IE8 nth-child
11430		$('.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');
11431		
11432		//remove br's from code tag
11433		$('code').find('br').remove();	
11434		
11435		//if a clear is the last div, remove the padding
11436		if($('.container.main-content > .row > div:last-child').hasClass('clear')) {
11437			$('.container.main-content > .row > div:last-child').css('padding-bottom','0');
11438		}
11439		
11440		//homepage recent blog for IE8
11441		$('.container-wrap .blog-recent > div:last-child').addClass('col_last');
11442		
11443		//blog ascend bottom padding
11444		if($('.single .blog_next_prev_buttons').length > 0) $('.container-wrap').css('padding-bottom',0);
11445
11446		//contact form
11447		$('.wpcf7-form p:has(input[type=submit])').css('padding-bottom','0px');
11448
11449		$('.full-width-content .wpcf7-submit').on('click',function(){ setTimeout(function(){ fullWidthContentColumns() },1000); setTimeout(function(){ fullWidthContentColumns() },2000); });
11450		
11451		//no caption home slider fix
11452		$('#featured article').each(function(){
11453			if($(this).find('h2').attr('data-has-caption') == '0') {
11454				$(this).parents('.slide').addClass('no-caption');
11455			}
11456		});
11457		
11458		//add class for IE
11459		var ua = window.navigator.userAgent;
11460		var msie = ua.indexOf("Edge/");
11461		if(msie > 0)
11462			$('body').addClass('msie');
11463
11464		//gravity form inside fw content row
11465		$('.gform_body').click(function(){
11466		   setTimeout(function(){ fullWidthContentColumns(); },200);
11467		 });
11468
11469		//chat post format nth child color
11470		$('article.post.format-chat .content-inner dt:odd').css('color','#333');
11471		
11472		//remove margin on last cols inside of full width sections 
11473		$('.full-width-section').each(function(){
11474			$(this).find('> .span_12 > div.col_last').last().css('margin-bottom','0');
11475		});
11476		
11477		//remove p tags from extra content editor when warpping only an img 
11478		$('#portfolio-extra p').each(function(){
11479			if($(this).find('*').length == 1 && $(this).find('img').length == 1) {
11480				$(this).find('img').unwrap();
11481			}
11482		});
11483	
11484
11485		//vc text_separator color
11486		$('.vc_text_separator').each(function(){
11487			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'));
11488		});
11489		
11490		//carousel head button alignment  
11491		$('.carousel-heading').each(function(){
11492			if($(this).find('h2').length > 0) $(this).find('.carousel-prev, .carousel-next').css('top','7px');
11493		});
11494		
11495		//remove carousel heading if not being used
11496		$('.carousel-wrap').each(function(){
11497			if($(this).find('.carousel-heading .container:empty').length > 0) $(this).find('.carousel-heading').remove();
11498		});
11499		
11500		//woocommerce product thuimbnails
11501		$('.woocommerce div.product div.images div.thumbnails a:nth-child(4n+4)').css('margin-right','0px');
11502		
11503		//remove extra galleries when using the nectar gallery slider on projects and posts
11504		$('article.post .gallery-slider .gallery,  article.post .gallery-slider .jetpack-sli
11504deshow, .single-portfolio .gallery-slider .gallery, .single-portfolio .gallery-slider .jetpack-slideshow').remove();
11505		
11506		
11507		$('.woocommerce .span_9 .products.related .products li:nth-child(4), .woocommerce .span_9 .products.upsells .products li:nth-child(4)').remove();
11508		$('.woocommerce .span_9 .products.related .products li:nth-child(3), .woocommerce .span_9 .products.upsells .products li:nth-child(3)').css('margin-right','0');	
11509		
11510		$('.cart-menu a, .widget_shopping_cart a').addClass('no-ajaxy');
11511
11512		//clients no hover if no link
11513		$('div.clients').each(function(){
11514			$(this).find('> div').each(function(){
11515				if($(this).find('a').length == 0) {
11516					$(this).addClass('no-link');
11517				}
11518			});
11519		});
11520
11521		//remove ajaxy from single posts when using disqus
11522		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');
11523
11524		//blog next color bg only 
11525		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();
11526		
11527		if($('#single-below-header').hasClass('fullscreen-header') && $('.blog_next_prev_buttons').length == 0 ) $('#author-bio, .comment-wrap').addClass('lighter-grey');
11528
11529		//shop header parallax margin 
11530		if($('body.woocommerce').find('#page-header-bg').length > 0){
11531			$('.container-wrap').css({'margin-top':'0px','padding-top':'30px'});
11532		}
11533
11534		//remove arrows on mega menu item
11535		$('header#top nav .megamenu .sub-menu a.sf-with-ul .sf-sub-indicator').remove();
11536		
11537		//if using wooCommerce sitewide notice
11538		if($('.demo_store').length > 0) $('#header-outer, #header-space').css('margin-top','32px');
11539		
11540		//footer last column class for IE8
11541		$('#footer-widgets .container .row > div:last-child').addClass('col_last');
11542		
11543		//nectar slider external links
11544		$('.swiper-slide.external-button-1 .buttons > div:nth-child(1) a').attr('target','_blank');
11545		$('.swiper-slide.external-button-2 .buttons > div:nth-child(2) a').attr('target','_blank');
11546		
11547		//portfolio external links
11548		$(".portfolio-items a[href*='http://']:not([href*='"+window.location.hostname+"']), .recent_projects_widget a[href*='http://']:not([href*='"+window.location.hostname+"'])").attr("target","_blank"); 
11549		
11550		//remove excess inner content when empty row
11551		$('.container-wrap .row > .wpb_row').each(function(){
11552			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();
11553		});
11554		
11555		//remove boxed style from full width content
11556		$('.full-width-content .col.boxed').removeClass('boxed');
11557		
11558		//remove full width attribute on slider in full width content section
11559		$('.full-width-content .wpb_column .nectar-slider-wrap[data-full-width="true"]').attr('data-full-width','false');	
11560
11561		if( $('.nectar-slider-wrap.first-section').length == 0 && 
11562			$('.full-width-section.first-section > .span_12 > .vc_span12 > .wpb_wrapper > .nectar-slider-wrap').length == 0  && 
11563			$('.parallax_slider_outer.first-section').length == 0 && 
11564			$('.full-width-content.first-section .wpb_wrapper > .nectar-slider-wrap').length == 0  && 
11565			!($('.wpb_row.first-section > .nectar-parallax-scene').length == 1 && $('#header-outer[data-transparent-header="true"]').length == 1) ) { 
11566			$('#header-outer .ns-loading-cover').remove(); 
11567	    }
11568
11569	    //portfolio description remove on hover
11570	    var $tmpTitle = null;
11571	    $('.portfolio-items > .col a[title]').hover(function(){
11572	    	$tmpTitle = $(this).attr('title');
11573	    	$(this).attr('title',' ');
11574	    },function(){
11575	    	$(this).attr('title', $tmpTitle);
11576	    });
11577	    $('.portfolio-items > .col a[title]').click(function(){
11578			$(this).attr('title', $tmpTitle);
11579	    });
11580
11581	};
11582
11583	crossBrowserFixes();
11584
11585
11586
11587
11588	function wooPriceSlider(){
11589
11590
11591		// woocommerce_price_slider_params is required to continue, ensure the object exists
11592		if ( typeof woocommerce_price_slider_params === 'undefined' || !$('body').hasClass('woocommerce') ) {
11593			return false;
11594		}
11595
11596		// Get markup ready for slider
11597		$( 'input#min_price, input#max_price' ).hide();
11598		$( '.price_slider, .price_label' ).show();
11599
11600		// Price slider uses jquery ui
11601		var min_price = $( '.price_slider_amount #min_price' ).data( 'min' ),
11602			max_price = $( '.price_slider_amount #max_price' ).data( 'max' );
11603
11604		current_min_price = parseInt( min_price, 10 );
11605		current_max_price = parseInt( max_price, 10 );
11606
11607		if ( woocommerce_price_slider_params.min_price ) current_min_price = parseInt( woocommerce_price_slider_params.min_price, 10 );
11608		if ( woocommerce_price_slider_params.max_price ) current_max_price = parseInt( woocommerce_price_slider_params.max_price, 10 );
11609
11610		$( 'body' ).bind( 'price_slider_create price_slider_slide', function( event, min, max ) {
11611			if ( woocommerce_price_slider_params.currency_pos === 'left' ) {
11612
11613				$( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + min );
11614				$( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + max );
11615
11616			} else if ( woocommerce_price_slider_params.currency_pos === 'left_space' ) {
11617
11618				$( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + " " + min );
11619				$( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + " " + max );
11620
11621			} else if ( woocommerce_price_slider_params.currency_pos === 'right' ) {
11622
11623				$( '.price_slider_amount span.from' ).html( min + woocommerce_price_slider_params.currency_symbol );
11624				$( '.price_slider_amount span.to' ).html( max + woocommerce_price_slider_params.currency_symbol );
11625
11626			} else if ( woocommerce_price_slider_params.currency_pos === 'right_space' ) {
11627
11628				$( '.price_slider_amount span.from' ).html( min + " " + woocommerce_price_slider_params.currency_symbol );
11629				$( '.price_slider_amount span.to' ).html( max + " " + woocommerce_price_slider_params.currency_symbol );
11630
11631			}
11632
11633			$( 'body' ).trigger( 'price_slider_updated', min, max );
11634		});
11635
11636		$( '.price_slider' ).slider({
11637			range: true,
11638			animate: true,
11639			min: min_price,
11640			max: max_price,
11641			values: [ current_min_price, current_max_price ],
11642			create : function( event, ui ) {
11643
11644				$( '.price_slider_amount #min_price' ).val( current_min_price );
11645				$( '.price_slider_amount #max_price' ).val( current_max_price );
11646
11647				$( 'body' ).trigger( 'price_slider_create', [ current_min_price, current_max_price ] );
11648			},
11649			slide: function( event, ui ) {
11650
11651				$( 'input#min_price' ).val( ui.values[0] );
11652				$( 'input#max_price' ).val( ui.values[1] );
11653
11654				$( 'body' ).trigger( 'price_slider_slide', [ ui.values[0], ui.values[1] ] );
11655			},
11656			change: function( event, ui ) {
11657
11658				$( 'body' ).trigger( 'price_slider_change', [ ui.values[0], ui.values[1] ] );
11659
11660			},
11661		});
11662
11663	}
11664	
11665
11666//vc col mobile fixes
11667function vcMobileColumns() {
11668	$('.wpb_row').each(function(){
11669		if(typeof $(this).find('.span_12').offset() != 'undefined' ) {
11670		
11671			$(this).find('[class*="vc_col-"]').each(function(){
11672
11673				var $firstChildOffset = $(this).parents('.span_12').offset().left;
11674
11675				$(this).removeClass('no-left-margin');
11676				if($(this).offset().left < $firstChildOffset + 27) { 
11677					$(this).addClass('no-left-margin');
11678				} else {
11679					$(this).removeClass('no-left-margin');
11680				}
11681			});
11682		}
11683	});
11684}
11685
11686if($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) vcMobileColumns();
11687
11688
11689/*-------------------------------------------------------------------------*/
11690/*	8.	Form Styling
11691/*-------------------------------------------------------------------------*/	
11692
11693if($('body[data-form-style="minimal"]').length > 0) {
11694
11695
11696	//turn user set place holders into labels for effect
11697	function convertPlaceholders() {
11698		$('form input[placeholder], form textarea[placeholder]').each(function(i){
11699			if($(this).attr('placeholder').length > 1) {
11700				var $placeholder = $(this).attr('placeholder');
11701				var $inputID = ($(this).is('[id]')) ? $(this).attr('id') : 'id-'+i;
11702				//add placeholder as label if label doesn't already exist
11703				
11704				//skip cf7                               //|| $(this).prev('label').length == 1 && $placeholder.length > $(this).prev('label').text().length
11705				if($(this).parents('.wpcf7-form-control-wrap').length == 0) {
11706					if($(this).prev('label').length == 0 || $(this).is('textarea')) {
11707						$('<label for="'+$inputID+'">'+$placeholder+'</label>').insertBefore($(this));
11708					}
11709				} else {
11710					if($(this).parents('.wpcf7-form-control-wrap').find('label').length == 0) {
11711						$('<label for="'+$inputID+'">'+$placeholder+'</label>').insertBefore($(this).parents('.wpcf7-form-control-wrap '));
11712					}
11713				}
11714				$(this).removeAttr('placeholder');
11715			}
11716		});
11717	}
11718	convertPlaceholders();
11719	setTimeout(convertPlaceholders,500);
11720	
11721	//woocommerce placeholder fix
11722	$( '#billing_country, #shipping_country, .country_to_state' ).on('change',function(){
11723		convertPlaceholders();
11724		removeExcessLabels();
11725		var $wooDynamicPlaceholders = setInterval(function(){
11726			convertPlaceholders();
11727			convertToMinimalStyle('form label');
11728			removeExcessLabels();
11729		},30);
11730		setTimeout(function(){ clearInterval($wooDynamicPlaceholders); },600);
11731		
11732	});
11733
11734	function convertToMinimalStyle(selector){
11735
11736		$(selector).each(function(){
11737			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) {
11738				
11739				if($(this).parents('.minimal-form-input').length == 0) {
11740
11741					//if there's a direct input next to label
11742				
11743					if($(this).next('input').length == 1) {
11744		
11745						$(this).next('input').andSelf().wrapAll('<div class="minimal-form-input"/>');
11746					} else {
11747						//if we need to traverse to parent instead	
11748						$(this).parent().wrapInner('<div class="minimal-form-input" />');
11749					}
11750					$html = $(this).html();
11751					$(this)[0].innerHTML = '<span class="text"><span class="text-inner">'+$html+'</span></span>';
11752			
11753					if($(this).parent().find('textarea').length == 1) $(this).parents('.minimal-form-input').addClass('textarea');
11754				}
11755			}
11756
11757		});
11758
11759		//for labels that changed that already have minimal form markup - just need to update content
11760		$(selector).each(function(){
11761			if($(this).parents('.minimal-form-input').length == 1 && $(this).find('.text').length == 0) {
11762				
11763				$html = $(this).html();
11764				$(this)[0].innerHTML = '<span class="text"><span class="text-inner">'+$html+'</span></span>';
11765				
11766			}
11767
11768		});
11769	}
11770	
11771	convertToMinimalStyle('form label');
11772
11773	jQuery( document.body ).on( 'updated_cart_totals', function() { 
11774		convertToMinimalStyle('form label');
11775	});
11776
11777	setTimeout(function(){ convertToMinimalStyle('form label'); removeExcessLabels(); checkValueOnLoad(); },501);
11778
11779	//remove excess labels
11780	function removeExcessLabels() {
11781		$('.minimal-form-input').each(function(){
11782			if($(this).find('label').length > 1) {
11783				$lngth = 0;
11784				$(this).find('label').each(function(){
11785					if($(this).text().length >= $lngth) {
11786						$lngth = $(this).text().length;
11787						$(this).parents('.minimal-form-input').find('label').addClass('tbr');
11788						$(this).removeClass('tbr');
11789					}
11790				});
11791				$(this).find('label.tbr').remove();
11792			}
11793		});
11794	}
11795	removeExcessLabels();
11796	
11797
11798	//add labels to inputs that don't have them
11799	$('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(){
11800		if($(this).parents('.minimal-form-input').length == 0) {
11801
11802			$('<label></label>').insertBefore($(this));
11803			convertToMinimalStyle($(this).prev('label'));
11804		}
11805	});
11806
11807
11808	$('body').on('focus','.minimal-form-input input, .minimal-form-input textarea',function(){
11809		$(this).parents('.minimal-form-input').addClass('filled').removeClass('no-text');
11810	});
11811	$('body').on('blur','.minimal-form-input input, .minimal-form-input textarea',function(){
11812		if($(this).val().length > 0) $(this).parents('.minimal-form-input').addClass('has-text').removeClass('no-text');
11813		else $(this).parents('.minimal-form-input').removeClass('has-text').addClass('no-text');
11814		$(this).parents('.minimal-form-input').removeClass('filled');
11815	});
11816
11817
11818	//on load
11819	function checkValueOnLoad() {
11820		$('.minimal-form-input input, .minimal-form-input textarea').each(function(){
11821			if($(this).val().length > 0) $(this).parents('.minimal-form-input').addClass('has-text').removeClass('no-text');
11822		});
11823	}
11824	checkValueOnLoad();
11825
11826	 // Textarea Auto Resize
11827    var hiddenDiv = $('.hiddendiv').first();
11828    if (!hiddenDiv.length) {
11829      hiddenDiv = $('<div class="textareahiddendiv common"></div>');
11830      $('body').append(hiddenDiv);
11831    }
11832    var text_area_selector = 'textarea';
11833
11834    function textareaAutoResize($textarea) {
11835      // Set font properties of hiddenDiv
11836
11837      var fontFamily = $textarea.css('font-family');
11838      var fontSize = $textarea.css('font-size');
11839
11840      if (fontSize) { hiddenDiv.css('font-size', fontSize); }
11841      if (fontFamily) { hiddenDiv.css('font-family', fontFamily); }
11842
11843      if ($textarea.attr('wrap') === "off") {
11844        hiddenDiv.css('overflow-wrap', "normal")
11845                 .css('white-space', "pre");
11846      }
11847
11848
11849
11850
11851      hiddenDiv.text($textarea.val() + '\n');
11852      var content = hiddenDiv.html().replace(/\n/g, '<br>');
11853      hiddenDiv.html(content);
11854
11855
11856      // When textarea is hidden, width goes crazy.
11857      // Approximate with half of window size
11858
11859      if ($textarea.is(':visible')) {
11860        hiddenDiv.css('width', $textarea.width());
11861      }
11862      else {
11863        hiddenDiv.css('width', $(window).width()/2);
11864      }
11865
11866      $textarea.css('height', hiddenDiv.height());
11867    }
11868
11869    $(text_area_selector).each(function () {
11870      var $textarea = $(this);
11871      if ($textarea.val().length) {
11872        textareaAutoResize($textarea);
11873      }
11874    });
11875
11876    $('body').on('keyup keydown autoresize', text_area_selector, function () {
11877      textareaAutoResize($(this));
11878    });
11879
11880}
11881
11882
11883if($('body[data-fancy-form-rcs="1"]').length > 0) {
11884
11885	 //radio / checkbox markup conversion 
11886
11887    ////default
11888    $('input[type="checkbox"]').each(function(){
11889    	//check if for relationship exists
11890    	$id = $(this).attr('id');
11891    	if(typeof $id !== typeof undefined && $id !== false && $('label[for="'+$id+'"]').length > 0) {
11892    		$('label[for="'+$id+'"]').prepend('<span></span>');
11893    	} 
11894
11895    });	
11896
11897    ////for cf7
11898    $('.wpcf7-radio .wpcf7-list-item-label').each(function(i){
11899    	var $data = $(this).html();
11900    	var $name = $(this).parent().find('input').attr('name') + i;
11901    	$(this).parent().find('input').attr('id',$name);
11902    	$(this).replaceWith('<label for="'+$name+'">'+$data+'</label>');
11903    });
11904
11905     $('.wpcf7-checkbox .wpcf7-list-item-label').each(function(){
11906    	var $data = $(this).html();
11907    	var $name = $(this).parent().find('input').attr('value');
11908    	$(this).parent().find('input').attr('id',$name);
11909    	$(this).replaceWith('<label for="'+$name+'"><span></span>'+$data+'</label>');
11910    });
11911
11912
11913    //select
11914    $('select:not(.comment-form-rating #rating)').each(function(){
11915
11916    	//cf7
11917    	if($(this).parents('.wpcf7-form-control-wrap').length > 0) {
11918
11919    		//select 2 already initialized
11920	    	if($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) {
11921	    		$selector = $($(this).prev('.select2-container'));
11922	    	} else {
11923	    		$selector = $(this);
11924	    	}
11925
11926	    	//if label is found
11927	    	if($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) {
11928	    		$selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />');
11929	    	} else {
11930	    		//default wrap
11931	    		$selector.wrap('<div class="fancy-select-wrap" />');
11932	    	}
11933    	} 
11934    	//default
11935    	else {
11936
11937	    	//select 2 already initialized
11938	    	if($(this).prev('.select2-container').length > 0) {
11939	    		$selector = $(this).prev('.select2-container');
11940	    	} else {
11941	    		$selector = $(this);
11942	    	}
11943
11944	    	//if label is found
11945	    	if($selector.prev('label').length == 1) {
11946	    		$selector.prev('label').andSelf().wrapAll('<div class="fancy-select-wrap" />');
11947	    	} else if($selector.next('label').length == 1) {
11948	    		$selector.next('label').andSelf().wrapAll('<div class="fancy-select-wrap" />');
11949	    	} else {
11950	    		//default wrap
11951	    		$selector.wrap('<div class="fancy-select-wrap" />');
11952	    	}
11953    	}
11954    });
11955	
11956	function select2Init(){
11957		$('select:not(.state_select):not(.country_select):not(.comment-form-rating #rating)' ).each( function() {
11958			$( this ).select2({
11959				minimumResultsForSearch: 7
11960			});
11961		});
11962	}
11963   
11964	select2Init();
11965
11966}
11967	
11968	$('a#toggle-section').click(function(){
11969			
11970		//open
11971		if(!$('#style-selection').hasClass('open')){
11972			var $distance = ($('body[data-smooth-scrolling="0"]').length > 0) ? '0px' : '13px';
11973			$('#style-selection').addClass('open');
11974			$('#style-selection').stop().animate({
11975				'right' : $distance
11976			},600,'easeOutCubic');
11977		}
11978		
11979		//close  
11980		else {
11981			var $distance = ($('body[data-smooth-scrolling="0"]').length > 0) ? '-196px' : '-177px';
11982			$('#style-selection').removeClass('open');
11983			$('#style-selection').stop().animate({
11984				'right' : $distance
11985			},500,'easeInCubic');
11986			if($('#style-selection .select2-choice').length > 0) { 
11987				$('#style-selection .select2-container').removeClass('select2-container-active').removeClass('select2-dropdown-open');
11988				$('.select2-drop, .select2-drop-mask').hide();
11989			}
11990		}
11991
11992		return false;
11993	});
11994	
11995
11996	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 ) {
11997
11998		$('#ajax-content-wrap').ajaxify({
11999			'selector':'#ajax-content-wrap a:not(.no-ajaxy):not([target="_blank"]):not([href^="#"]):not(.comment-edit-link):not(#cancel-comment-reply-link):not(.comment-reply-link):not(#toggle-nav):not(.cart_list a):not(.logged-in-as a):not(.no-widget-added a):not(.add_to_cart_button):not(.product-wrap a):not(.section-down-arrow):not([data-filter]):not(.product_list_widget a):not(.pp):not([rel^="prettyPhoto"]):not(.pretty_photo), #header-outer li:not(.no-ajaxy) > a:not(.no-ajaxy), #header-outer #logo',
12000			'verbosity': 0, 
12001			requestDelay: 400,
12002			previewoff : true,
12003			memoryoff: true,
12004			turbo : false
12005		});
12006
12007		$(window).on("pronto.render", initPage)
12008		.on("pronto.load", destroyPage)
12009		.on("pronto.request", transitionPage);
12010
12011		if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },300);
12012
12013		initPage();
12014
12015	} else if($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="standard"]').length > 0 ) {
12016		
12017		//chrome white BG flash fix
12018		$('html').addClass('page-trans-loaded');
12019
12020		//fadeout loading animation
12021		if($('#ajax-loading-screen[data-effect="standard"]').length > 0) {
12022			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);
12023
12024			//bind waypoints after loading screen has left
12025			if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },750);
12026
12027			//safari back/prev fix
12028			if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
12029				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) };
12030				window.onpageshow = function(event) {
12031		    		if (event.persisted) { 
12032		    			$('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ 
12033		    				$(this).css({'display':'none'}); 
12034		    			}); 
12035		    			$('#ajax-loading-screen .loading-icon').transition({'opacity':0},600);
12036		    		}
12037		    	}
12038			} else if(navigator.userAgent.indexOf('Firefox') != -1) {
12039				window.onunload = function(){};
12040			}
12041
12042	    		
12043	    	
12044			
12045		} else {
12046			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) {
12047				setTimeout(function(){ 
12048					$('#ajax-loading-screen').addClass('loaded');
12049					setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
12050				},150);
12051			}
12052
12053
12054			//safari back/prev fix
12055			if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
12056				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) };
12057				window.onpageshow = function(event) {
12058		    		if (event.persisted) { 
12059		    			$('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ 
12060		    				$(this).css({'display':'none'}); 
12061		    			}); 
12062		    			$('#ajax-loading-screen .loading-icon').transition({'opacity':0},600);
12063		    		}
12064		    	}
12065			} else if(navigator.userAgent.indexOf('Firefox') != -1) {
12066				window.onunload = function(){};
12067			}
12068
12069			//bind waypoints after loading screen has left
12070			if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },350);
12071
12072		}
12073
12074		//remove excess loading images now
12075		$('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();
12076
12077
12078		if($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) {
12079			$('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
12079([rel^="prettyPhoto"]):not(.pretty_photo)').click(function(e){
12080				
12081				var $windowCurrentLocation = window.location.href.split("#")[0];
12082				var $windowClickedLocation = $(this).attr('href').split("#")[0];
12083
12084				if($(this).parent('.menu-item-has-children').length > 0 && $(this).parents('.off-canvas-menu-container').length > 0 || ($windowClickedLocation == $windowCurrentLocation)) {
12085
12086				} else {
12087					if(!$(this).parent().hasClass('no-ajaxy')) {
12088
12089						var $targetLocation = $(this).attr('href');
12090						var $timeOutDur = 0;
12091						if($targetLocation != '') {
12092
12093							$('#ajax-loading-screen').addClass('set-to-fade');
12094
12095							transitionPageStandard();
12096
12097							setTimeout(function(){
12098								window.location = $targetLocation;
12099							},$timeOutDur)
12100							
12101							return false;
12102						}
12103					}
12104				}
12105
12106			});
12107		} // if disable fade out is not on
12108	} else {	
12109		//bind waypoints regularly
12110		if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },100);
12111	}
12112
12113
12114	function transitionPage(e) {
12115		
12116
12117		if($(window).scrollTop() > 0) {
12118
12119			//stop nicescroll
12120			if($().niceScroll && $("html").getNiceScroll()){
12121				var nice = $("html").getNiceScroll();
12122				nice.stop();
12123			}
12124			
12125			$('body,html').stop(true,true).animate({
12126				scrollTop:0
12127			},500,'easeOutQuad',function(){ 
12128				$('#ajax-loading-screen').css({'opacity':'1', 'display':'none'});
12129				$('#ajax-loading-screen').stop(true,true).fadeIn(600,function(){
12130					$('#ajax-loading-screen .loading-icon').animate({'opacity':1},400);
12131					//close widget area
12132					setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
12133				});
12134			});
12135
12136		} else {
12137			$('#ajax-loading-screen').css('opacity','1').stop().fadeIn(600,function(){
12138				$('#ajax-loading-screen .loading-icon').animate({'opacity':1},400);
12139			});
12140
12141			//close widget area
12142			setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
12143		}
12144
12145		
12146	}
12147
12148	function transitionPageStandard(e) {
12149		
12150		$('#ajax-loading-screen').css('opacity','1').stop().fadeIn(500);
12151		//setTimeout(function(){ $('#ajax-loading-screen .loading-icon').animate({'opacity':1},500); },400);
12152
12153	}
12154
12155	function destroyPage(e) {
12156		$(window).off('scroll.appear');
12157		if($('#nectar_fullscreen_rows').length > 0 && $().fullpage) 
12158			$.fn.fullpage.destroy('all');
12159	}
12160
12161	function initPage(e) {
12162
12163		if(!$('body').hasClass('ajax-loaded')) return false;
12164
12165
12166		//init js
12167		lightBoxInit();
12168		addOrRemoveSF();
12169		$(".sf-menu").superfish('destroy');
12170		$('#header-outer').removeClass('dark-slide');
12171		initSF();
12172		SFArrows();
12173		headerInit();
12174		var $effectTimeout = ($('#ajax-loading-screen').length > 0) ? 800 : 0;
12175		pageHeaderTextEffectInit();
12176		if($('#page-header-bg .nectar-video-wrap video').length == 0) setTimeout(pageHeaderTextEffect,$effectTimeout);
12177		coloredButtons();
12178		columnBGColors();
12179		fwCarouselLinkFix();
12180		if($('.carousel').length > 0) {
12181			standardCarouselInit();
12182			clientsCarouselInit();
12183			carouselHeightCalcs();
12184		}
12185		if($('.owl-carousel').length > 0) owlCarouselInit();
12186		if($('.products-carousel').length > 0) productCarouselInit();
12187		if($('#nectar_fullscreen_rows').length > 0 && $().fullpage) {
12188			setFPNames();
12189			initFullPageFooter();
12190			fullscreenRowLogic();
12191			initNectarFP();
12192		}
12193		flexsliderInit();
12194		progressBars();
12195		dividers();
12196		animated_titles();
12197		milestoneInit();
12198		accordionInit();
12199		tabbedInit();
12200		tabbbedDeepLinking();
12201		accordionDeepLinking();
12202		ulChecks();
12203		oneFourthClasses();
12204		carouselfGrabbingClass();
12205		cascadingImageBGSizing();
12206		clientsFadeIn();
12207		fullWidthSections();
12208		fwsClasses();
12209		fullwidthImgOnlySizingInit();
12210		fullwidthImgOnlySizing();
12211		fullWidthRowPaddingAdjustInit();
12212		fullWidthRowPaddingAdjustCalc();
12213		boxRollInit();
12214		setTimeout(function(){ 
12215		   colAndImgAnimations();
12216		},100); 
12217		if($('body[data-animated-anchors="true"]').length > 0) setTimeout(scrollSpyInit,200);
12218	    nectar_fancy_ul_init();
12219		socialSharingInit();
12220		hotSpotHoverBind();
12221		pricingTableHeight();
12222		createTestimonialControls();
12223		imageWithHotspotClickEvents();
12224		testimonialSliderHeight(); 
12225		largeIconHover();
12226		fullscreenMenuInit();
12227		boxRollMouseWheelInit();
12228		midnightInit();
12229		setTimeout(morphingOutlines,100); 
12230		responsiveVideoIframesInit();
12231		responsiveVideoIframes();
12232		fullWidthContentColumns();
12233		videoBGInit();
12234		$window.unbind('scroll.parallaxSections').unbind('resize.parallaxSections');
12235		parallaxScrollInit();
12236		masonryBlogInit();
12237		masonryPortfolioInit();
12238		portfolioAccentColor();
12239		portfolioHoverEffects();
12240		portfolioFiltersInit();
12241		style6Img();
12242		isotopeCatSelection();
12243		$(window).unbind('.infscr');
12244		infiniteScrollInit();
12245		toTopBind();
12246		centerLove();
12247		postNextButtonEffect();
12248		if($('.nectar-box-roll').length == 0) headerRowColorInheritInit();
12249		pageLoadHash();
12250		slideOutWidgetAreaScrolling();
12251
12252		//cf7
12253		if($().wpcf7InitForm) $('div.wpcf7 > form').wpcf7InitForm();
12254
12255		//woocommerce price slider
12256		wooPriceSlider();
12257
12258		//twitter widget 
12259		if(typeof twttr != 'undefined') { twttr.widgets.load(); }
12260
12261		//Calendarize.it
12262		if(typeof init_rhc === 'function') { init_rhc(); }
12263
12264		//unwrap post and protfolio videos
12265		$('.video-wrap iframe').unwrap();
12266		$('#sidebar iframe[src]').unwrap();
12267
12268		$('video:not(.slider-video)').attr('width','100%');
12269		$('video:not(.slider-video)').attr('height','100%'); 
12270
12271		$('.wp-video-shortcode.mejs-container').each(function(){
12272			$(this).attr('data-aspectRatio', parseInt($(this).css('height')) / parseInt($(this).css('width')));
12273		});
12274
12275		//mediaElement
12276		$('video.wp-media-shortcode-ajax, audio.wp-media-shortcode-ajax').each(function(){ 
12277			if(!$(this).parent().hasClass('mejs-mediaelement') && $().mediaelementplayer) {
12278				$(this).mediaelementplayer();  
12279			}
12280		});
12281
12282		$('.mejs-container').css({'height': '100%', 'width': '100%'});
12283		
12284		$('audio').attr('width','100%');
12285		$('audio').attr('height','100%');
12286
12287		$('audio').css('visibility','visible');
12288
12289		if($('body').hasClass('mobile')){
12290			$('video').css('visibility','hidden');
12291		} else {
12292			$('video').css('visibility','visible');
12293		}
12294
12295		$('.wpb_row:has(".nectar-video-wrap")').each(function(i){
12296			$(this).css('z-index',100 + i);
12297		});
12298
12299		showLateIframes();
12300
12301		mouseParallaxInit();
12302
12303		//chrome self hosted slider bg video correct
12304		 if(navigator.userAgent.indexOf('Chrome') > 0) { 
12305		 	$('.swiper-wrapper .video-wrap').each(function(i){
12306			  	var webmSource = jQuery(this).find('video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
12307	          	var firstVideo = jQuery(this).find('video').get(0);
12308	          	firstVideo.src = webmSource;
12309	          	firstVideo.load();
12310            });
12311	    }
12312
12313
12314		if($('.nectar-video-bg').length > 0) {
12315			setTimeout(function(){
12316			    	resizeVideoToCover();
12317			    	$('.video-color-overlay').each(function(){
12318			    		$(this).css('background-color',$(this).attr('data-color'));
12319			    	});
12320			    	$('.nectar-video-wrap').transition({'opacity':'1'},0);
12321			    	$('.video-color-overlay').transition({'opacity':'0.7'},0);
12322			    	
12323			    },400);
12324		}
12325
12326		
12327		nectarPageHeader();
12328	
12329
12330		//if( $('#featured').length > 0){
12331		//	
12332		//	customSliderHeight();
12333		//	homeSliderInit2();
12334		//	$(window).off('scroll.hsps');
12335		//	$(window).on('scroll.hsps',homeSliderParallaxScroll);
12336		//	$(window).off('resize.hsps');
12337		//	$(window).on('resize.hsps',homeSliderMobile);
12338			
12339		//}
12340
12341		//cart dropdown
12342		$('#header-outer div.cart-outer').hoverIntent(function(){
12343			$('#header-outer .widget_shopping_cart').stop(true,true).fadeIn(400);
12344			$('#header-outer .cart_list').stop(true,true).fadeIn(400);
12345			clearTimeout(timeout);
12346			$('#header-outer .cart-notification').fadeOut(300);
12347		});
12348
12349
12350		//remove excess loading images now
12351		$('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();
12352
12353		setTimeout(portfolioSidebarFollow,250);
12354		setTimeout(portfolioSidebarFollow,500);
12355		setTimeout(portfolioSidebarFollow,1000);
12356
12357		crossBrowserFixes();
12358
12359
12360		$(window).trigger('resize');
12361
12362		//fix admin bar
12363		$("#wpadminbar").show();	
12364
12365
12366		//close widget area
12367		if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click'); 
12368
12369		//fade in page
12370		setTimeout(function(){ $('#ajax-loading-screen').stop(true,true).fadeOut(500, function(){ $('#ajax-loading-screen .loading-icon').css({'opacity':0}); }); closeSearch();  },200);
12371		setTimeout(function(){ $('#ajax-loading-screen').stop(true,true).fadeOut(500, function(){ $('#ajax-loading-screen .loading-icon').css({'opacity':0}); }); closeSearch(); },900);
12372	} 
12373
12374
12375
12376
12377
12378
12379
12380/*
12381 * jQuery Textarea Characters Counter Plugin v 2.0
12382 * Examples and documentation at: http://roy-jin.appspot.com/jsp/textareaCounter.jsp
12383 * Copyright (c) 2010 Roy Jin
12384 * Version: 2.0 (11-JUN-2010)
12385 * Dual licensed under the MIT and GPL licenses:
12386 * http://www.opensource.org/licenses/mit-license.php
12387 * http://www.gnu.org/licenses/gpl.html
12388 * Requires: jQuery v1.4.2 or later
12389 */
12390(function($){
12391	if(!$.fn.textareaCount) { 
12392		$.fn.textareaCount = function(options, fn) {
12393	        var defaults = {
12394				maxCharacterSize: -1,
12395				originalStyle: 'originalTextareaInfo',
12396				warningStyle: 'warningTextareaInfo',
12397				warningNumber: 20,
12398				displayFormat: '#input characters | #words words'
12399			};
12400
12401			var options = $.extend(defaults, options);
12402
12403			var container = $(this);
12404
12405			$("<div class='charleft'>&nbsp;</div>").insertAfter(container);
12406
12407
12408			//create charleft css
12409			var charLeftCss = {
12410				'width' : container.width()
12411			};
12412
12413			var charLeftInfo = getNextCharLeftInformation(container);
12414			charLeftInfo.addClass(options.originalStyle);
12415			//charLeftInfo.css(charLeftCss);
12416
12417
12418			var numInput = 0;
12419			var maxCharacters = options.maxCharacterSize;
12420			var numLeft = 0;
12421			var numWords = 0;
12422
12423			container.bind('keyup', function(event){limitTextAreaByCharacterCount();})
12424					 .bind('mouseover', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);})
12425					 .bind('paste', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);});
12426
12427	        limitTextAreaByCharacterCount();
12428
12429			function limitTextAreaByCharacterCount(){
12430				charLeftInfo.html(countByCharacters());
12431
12432				//function call back
12433				if(typeof fn != 'undefined'){
12434					fn.call(this, getInfo());
12435				}
12436				return true;
12437			}
12438
12439			function countByCharacters(){
12440				var content = container.val();
12441				var contentLength = content.length;
12442				//Start Cut
12443				if(options.maxCharacterSize > 0){
12444					//If copied content is already more than maxCharacterSize, chop it to maxCharacterSize.
12445					if(contentLength >= options.maxCharacterSize) {
12446						content = content.substring(0, options.maxCharacterSize);
12447					}
12448
12449					var newlineCount = getNewlineCount(content);
12450
12451					// newlineCount new line character. For windows, it occupies 2 characters
12452					var systemmaxCharacterSize = options.maxCharacterSize - newlineCount;
12453					if (!isWin()){
12454						 systemmaxCharacterSize = options.maxCharacterSize
12455					}
12456					if(contentLength > systemmaxCharacterSize){
12457						//avoid scroll bar moving
12458						var originalScrollTopPosition = this.scrollTop;
12459						container.val(content.substring(0, systemmaxCharacterSize));
12460						this.scrollTop = originalScrollTopPosition;
12461					}
12462					charLeftInfo.removeClass(options.warningStyle);
12463					if(systemmaxCharacterSize - contentLength <= options.warningNumber){
12464						charLeftInfo.addClass(options.warningStyle);
12465					}
12466
12467					numInput = container.val().length + newlineCount;
12468					if(!isWin()){
12469						numInput = container.val().length;
12470					}
12471
12472					numWords = countWord(getCleanedWordString(container.val()));
12473
12474					numLeft = maxCharacters - numInput;
12475				} else {
12476					//normal count, no cut
12477					var newlineCount = getNewlineCount(content);
12478					numInput = container.val().length + newlineCount;
12479					if(!isWin()){
12480						numInput = container.val().length;
12481					}
12482					numWords = countWord(getCleanedWordString(container.val()));
12483				}
12484
12485				return formatDisplayInfo();
12486			}
12487
12488			function formatDisplayInfo(){
12489				var format = options.displayFormat;
12490				format = format.replace('#input', numInput);
12491				format = format.replace('#words', numWords);
12492				//When maxCharacters <= 0, #max, #left cannot be substituted.
12493				if(maxCharacters > 0){
12494					format = format.replace('#max', maxCharacters);
12495					format = format.replace('#left', numLeft);
12496				}
12497				return format;
12498			}
12499
12500			function getInfo(){
12501				var info = {
12502					input: numInput,
12503					max: maxCharacters,
12504					left: numLeft,
12505					words: numWords
12506				};
12507				return info;
12508			}
12509
12510			function getNextCharLeftInformation(container){
12511					return container.next('.charleft');
12512			}
12513
12514			function isWin(){
12515				var strOS = navigator.appVersion;
12516				if (strOS.toLowerCase().indexOf('win') != -1){
12517					return true;
12518				}
12519				return false;
12520			}
12521
12522			function getNewlineCount(content){
12523				var newlineCount = 0;
12524				for(var i=0; i<content.length;i++){
12525					if(content.charAt(i) == '\n'){
12526						newlineCount++;
12527					}
12528				}
12529				return newlineCount;
12530			}
12531
12532			function getCleanedWordString(content){
12533				var fullStr = content + " ";
12534				var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
12535				var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
12536				var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
12537				var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
12538				var splitString = cleanedStr.split(" ");
12539				return splitString;
12540			}
12541
12542			function countWord(cleanedWordString){
12543				var word_count = cleanedWordString.length-1;
12544				return word_count;
12545			}
12546		};
12547	}
12548})(jQuery);	
12549	
12550	
12551	
12552	
12553});
12554
12555
12556 }(window.jQuery, window, document));
12557
12558
12559function resizeIframe() {
12560	var element = document.getElementById("pp_full_res").getElementsByTagName("iframe");
12561	var height = element[0].contentWindow.document.body.scrollHeight;
12562    
12563    //iframe height
12564    element[0].style.height = height + 'px';
12565	
12566	//pp height
12567	document.getElementsByClassName("pp_content_container")[0].style.height = height+40+ 'px';
12568	document.getElementsByClassName("pp_content")[0].style.height = height+40+ 'px';
12569	
12570}
12571
12572
12573//don't load if mobile
12574if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) ){
12575
12576	
12577	/*
12578	panr - v0.0.1 by Robert Bue (@robert_bue)
12579	*/
12580	;(function ( $, window, document, undefined ) {
12581	// Create the defaults once
12582				
12583	var pluginName = "panr",
12584		defaults = {
12585		sensitivity: 22,
12586		moveTarget: "parent",
12587		scale: false,
12588		scaleOnHover: false,
12589		scaleTo: 1.1,
12590		scaleDuration: .28,
12591		panY: true,
12592		panX: true,
12593		panDuration: 0.7,
12594		resetPanOnMouseLeave: true,
12595		onEnter: function(){},
12596		onLeave: function(){}
12597	};
12598	// The actual plugin constructor
12599	function Plugin ( element, options ) {
12600		this.element = element;
12601		//console.log(element);
12602		this.settings = $.extend( {}, defaults, options );
12603		this._defaults = defaults;
12604		this._name = pluginName;
12605		this.init();
12606	}
12607	Plugin.prototype = {
12608		init: function () {
12609		if ( Modernizr.touch ) {
12610			return;
12611		}
12612		// call them like so: this.yourOtherFunction(this.element, this.settings).
12613		//console.log(this.settings);
12614		var settings = this.settings,
12615		target = $(this.element),
12616		w = target.width(),
12617		targetWidth = target.width() - settings.sensitivity,
12618		cx = (w-targetWidth)/targetWidth,
12619		x,
12620		y,
12621		panVars,
12622		xPanVars,
12623		yPanVars,
12624		mouseleaveVars;
12625		//console.log(cx);
12626		if ( settings.scale || (!settings.scaleOnHover && settings.scale) ) {
12627			TweenMax.set(target, { scale: settings.scaleTo });
12628		}
12629		// If no target provided we'll use the hovered element
12630		if ( !settings.moveTarget ) {
12631			settings.moveTarget = $(this.element);
12632		}
12633		if ( settings.moveTarget == "parent" ) {
12634			settings.moveTarget = $(this.element).parent();
12635		}
12636		if ( settings.moveTarget == "parent parent" ) {
12637			settings.moveTarget = $(this.element).parent().parent();
12638		}
12639		if ( settings.moveTarget == "parent parent parent" ) {
12640			settings.moveTarget = $(this.element).parent().parent().parent();
12641		}
12642	
12643		settings.moveTarget.on('mousemove', function(e){
12644			x = e.pageX - target.offset().left - target.width()/2; // mouse x coordinate relative to the container
12645			y = e.pageY - target.offset().top - target.height()/2; // mouse x coordinate relative to the container
12646			if ( settings.panX ) {
12647				xPanVars = { x: -cx*x };
12648			}
12649			if ( settings.panY ) {
12650				yPanVars = { y: -cx*y };
12651			}
12652			panVars = $.extend({}, xPanVars, yPanVars);
12653	
12654			// Pan element
12655			TweenMax.to(target, settings.panDuration, panVars);
12656		});
12657		// On mouseover
12658		settings.moveTarget.on('mouseenter', function(e){
12659			// Scale up element
12660			TweenMax.to(target, settings.scaleDuration, { scale: settings.scaleTo });
12661			settings.onEnter(target);
12662		});
12663		if ( !settings.scale || (!settings.scaleOnHover && !settings.scale) ) {
12664			mouseleaveVars = { scale: 1.005, x: 0, y: 0 };
12665		} else {
12666		
12667		if ( settings.resetPanOnMouseLeave ) {
12668			mouseleaveVars = { x: 0, y: 0 };
12669		}
12670		}
12671		settings.moveTarget.on('mouseleave', function(e){
12672		// Reset element
12673		TweenMax.to(target, .35, mouseleaveVars );
12674		settings.onLeave(target);
12675		});
12676		}
12677	};
12678	// A really lightweight plugin wrapper around the constructor,
12679	// preventing against multiple instantiations
12680	$.fn[ pluginName ] = function ( options ) {
12681		return this.each(function() {
12682			if ( !$.data( this, "plugin_" + pluginName ) ) {
12683			$.data( this, "plugin_" + pluginName, new Plugin( this, options ) );
12684		}
12685	  });
12686	};
12687	})( jQuery, window, document ); 
12688
12689}
12690
12691
12692
12693/*!
12694 * hoverIntent r7 // 2013.03.11 // jQuery 1.9.1+
12695 * http://cherne.net/brian/resources/jquery.hoverIntent.html
12696 */
12697(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.