PageSourceSearch

https://workvillenyc.com/wp-content/themes/salient/js/init.js?ver=9.0.1

js workvillenyc.com collected 2026-10-05 05:32:05 UTC 657,456 bytes, 16,627 lines download raw bytes

vendor: 9,392 bytes, lines 1-27
1/*-------------------------------------------------------------------------
2
3	1.	Plugin Init
4	2.	Helper Functions
5	3.	Shortcode Stuff
6	4.	Header + Search
7	5.	Page Specific
8	6.  Scroll to top 
9	7.	Cross Browser Fixes
10
11
12-------------------------------------------------------------------------*/
13
14
15
16
17
18
19/*-------------------------------------------------------------------------*/
20/*	1.	Plugin Init
21/*-------------------------------------------------------------------------*/
22
23
24/*!
25Waypoints - 4.0.1
26*/
27!function(){"use strict";function t(o){if(!o)throw new Error("No options passed to Waypoint constructor");if(!o.element)throw new Error("No element option passed to Waypoint constructor");if(!o.handler)throw new Error("No handler option passed to Waypoint constructor");this.key="waypoint-"+e,this.options=t.Adapter.extend({},t.defaults,o),this.element=this.options.element,this.adapter=new t.Adapter(this.element),this.callback=o.handler,this.axis=this.options.horizontal?"horizontal":"vertical",this.enabled=this.options.enabled,this.triggerPoint=null,this.group=t.Group.findOrCreate({name:this.options.group,axis:this.axis}),this.context=t.Context.findOrCreateByElement(this.options.context),t.offsetAliases[this.options.offset]&&(this.options.offset=t.offsetAliases[this.options.offset]),this.group.add(this),this.context.add(this),i[this.key]=this,e+=1}var e=0,i={};t.prototype.queueTrigger=function(t){this.group.queueTrigger(this,t)},t.prototype.trigger=function(t){this.enabled&&this.callback&&this.callback.apply(this,t)},t.prototype.destroy=function(){this.context.remove(this),this.group.remove(this),delete i[this.key]},t.prototype.disable=function(){return this.enabled=!1,this},t.prototype.enable=function(){return this.context.refresh(),this.enabled=!0,this},t.prototype.next=function(){return this.group.next(this)},t.prototype.previous=function(){return this.group.previous(this)},t.invokeAll=function(t){var e=[];for(var o in i)e.push(i[o]);for(var n=0,r=e.length;r>n;n++)e[n][t]()},t.destroyAll=function(){t.invokeAll("destroy")},t.disableAll=function(){t.invokeAll("disable")},t.enableAll=function(){t.Context.refreshAll();for(var e in i)i[e].enabled=!0;return this},t.refreshAll=function(){t.Context.refreshAll()},t.viewportHeight=function(){return window.innerHeight||document.documentElement.clientHeight},t.viewportWidth=function(){return document.documentElement.clientWidth},t.adapters=[],t.defaults={context:window,continuous:!0,enabled:!0,group:"default",horizontal:!1,offset:0},t.offsetAliases={"bottom-in-view":function(){return this.context.innerHeight()-this.adapter.outerHeight()},"right-in-view":function(){return this.context.innerWidth()-this.adapter.outerWidth()}},window.Waypoint=t}(),function(){"use strict";function t(t){window.setTimeout(t,1e3/60)}function e(t){this.element=t,this.Adapter=n.Adapter,this.adapter=new this.Adapter(t),this.key="waypoint-context-"+i,this.didScroll=!1,this.didResize=!1,this.oldScroll={x:this.adapter.scrollLeft(),y:this.adapter.scrollTop()},this.waypoints={vertical:{},horizontal:{}},t.waypointContextKey=this.key,o[t.waypointContextKey]=this,i+=1,n.windowContext||(n.windowContext=!0,n.windowContext=new e(window)),this.createThrottledScrollHandler(),this.createThrottledResizeHandler()}var i=0,o={},n=window.Waypoint,r=window.onload;e.prototype.add=function(t){var e=t.options.horizontal?"horizontal":"vertical";this.waypoints[e][t.key]=t,this.refresh()},e.prototype.checkEmpty=function(){var t=this.Adapter.isEmptyObject(this.waypoints.horizontal),e=this.Adapter.isEmptyObject(this.waypoints.vertical),i=this.element==this.element.window;t&&e&&!i&&(this.adapter.off(".waypoints"),delete o[this.key])},e.prototype.createThrottledResizeHandler=function(){function t(){e.handleResize(),e.didResize=!1}var e=this;this.adapter.on("resize.waypoints",function(){e.didResize||(e.didResize=!0,n.requestAnimationFrame(t))})},e.prototype.createThrottledScrollHandler=function(){function t(){e.handleScroll(),e.didScroll=!1}var e=this;this.adapter.on("scroll.waypoints",function(){(!e.didScroll||n.isTouch)&&(e.didScroll=!0,n.requestAnimationFrame(t))})},e.prototype.handleResize=function(){n.Context.refreshAll()},e.prototype.handleScroll=function(){var t={},e={horizontal:{newScroll:this.adapter.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.adapter.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}};for(var i in e){var o=e[i],n=o.newScroll>o.oldScroll,r=n?o.forward:o.backward;for(var s in this.waypoints[i]){var a=this.waypoints[i][s];if(null!==a.triggerPoint){var l=o.oldScroll<a.triggerPoint,h=o.newScroll>=a.triggerPoint,p=l&&h,u=!l&&!h;(p||u)&&(a.queueTrigger(r),t[a.group.id]=a.group)}}}for(var c in t)t[c].flushTriggers();this.oldScroll={x:e.horizontal.newScroll,y:e.vertical.newScroll}},e.prototype.innerHeight=function(){return this.element==this.element.window?n.viewportHeight():this.adapter.innerHeight()},e.prototype.remove=function(t){delete this.waypoints[t.axis][t.key],this.checkEmpty()},e.prototype.innerWidth=function(){return this.element==this.element.window?n.viewportWidth():this.adapter.innerWidth()},e.prototype.destroy=function(){var t=[];for(var e in this.waypoints)for(var i in this.waypoints[e])t.push(this.waypoints[e][i]);for(var o=0,n=t.length;n>o;o++)t[o].destroy()},e.prototype.refresh=function(){var t,e=this.element==this.element.window,i=e?void 0:this.adapter.offset(),o={};this.handleScroll(),t={horizontal:{contextOffset:e?0:i.left,contextScroll:e?0:this.oldScroll.x,contextDimension:this.innerWidth(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:e?0:i.top,contextScroll:e?0:this.oldScroll.y,contextDimension:this.innerHeight(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};for(var r in t){var s=t[r];for(var a in this.waypoints[r]){var l,h,p,u,c,d=this.waypoints[r][a],f=d.options.offset,w=d.triggerPoint,y=0,g=null==w;d.element!==d.element.window&&(y=d.adapter.offset()[s.offsetProp]),"function"==typeof f?f=f.apply(d):"string"==typeof f&&(f=parseFloat(f),d.options.offset.indexOf("%")>-1&&(f=Math.ceil(s.contextDimension*f/100))),l=s.contextScroll-s.contextOffset,d.triggerPoint=Math.floor(y+l-f),h=w<s.oldScroll,p=d.triggerPoint>=s.oldScroll,u=h&&p,c=!h&&!p,!g&&u?(d.queueTrigger(s.backward),o[d.group.id]=d.group):!g&&c?(d.queueTrigger(s.forward),o[d.group.id]=d.group):g&&s.oldScroll>=d.triggerPoint&&(d.queueTrigger(s.forward),o[d.group.id]=d.group)}}return n.requestAnimationFrame(function(){for(var t in o)o[t].flushTriggers()}),this},e.findOrCreateByElement=function(t){return e.findByElement(t)||new e(t)},e.refreshAll=function(){for(var t in o)o[t].refresh()},e.findByElement=function(t){return o[t.waypointContextKey]},window.onload=function(){r&&r(),e.refreshAll()},n.requestAnimationFrame=function(e){var i=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||t;i.call(window,e)},n.Context=e}(),function(){"use strict";function t(t,e){return t.triggerPoint-e.triggerPoint}function e(t,e){return e.triggerPoint-t.triggerPoint}function i(t){this.name=t.name,this.axis=t.axis,this.id=this.name+"-"+this.axis,this.waypoints=[],this.clearTriggerQueues(),o[this.axis][this.name]=this}var o={vertical:{},horizontal:{}},n=window.Waypoint;i.prototype.add=function(t){this.waypoints.push(t)},i.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],right:[]}},i.prototype.flushTriggers=function(){for(var i in this.triggerQueues){var o=this.triggerQueues[i],n="up"===i||"left"===i;o.sort(n?e:t);for(var r=0,s=o.length;s>r;r+=1){var a=o[r];(a.options.continuous||r===o.length-1)&&a.trigger([i])}}this.clearTriggerQueues()},i.prototype.next=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints),o=i===this.waypoints.length-1;return o?null:this.waypoints[i+1]},i.prototype.previous=function(e){this.waypoints.sort(t);var i=n.Adapter.inArray(e,this.waypoints);return i?this.waypoints[i-1]:null},i.prototype.queueTrigger=function(t,e){this.triggerQueues[e].push(t)},i.prototype.remove=function(t){var e=n.Adapter.inArray(t,this.waypoints);e>-1&&this.waypoints.splice(e,1)},i.prototype.first=function(){return this.waypoints[0]},i.prototype.last=function(){return this.waypoints[this.waypoints.length-1]},i.findOrCreate=function(t){return o[t.axis][t.name]||new i(t)},n.Group=i}(),function(){"use strict";function t(t){this.$element=e(t)}var e=window.jQuery,i=window.Waypoint;e.each(["innerHeight","innerWidth","off","offset","on","outerHeight","outerWidth","scrollLeft","scrollTop"],function(e,i){t.prototype[i]=function(){var t=Array.prototype.slice.call(arguments);return this.$element[i].apply(this.$element,t)}}),e.each(["extend","inArray","isEmptyObject"],function(i,o){t[o]=e[o]}),i.adapters.push({name:"jquery",Adapter:t}),i.Adapter=t}(),function(){"use strict";function t(t){return function(){var i=[],o=arguments[0];return t.isFunction(arguments[0])&&(o=t.extend({},arguments[1]),o.handler=arguments[0]),this.each(function(){var n=t.extend({},o,{element:this});"string"==typeof n.context&&(n.context=t(this).closest(n.context)[0]),i.push(new e(n))}),i}}var e=window.Waypoint;window.jQuery&&(window.jQuery.fn.waypoint=t(window.jQuery)),window.Zepto&&(window.Zepto.fn.waypoint=t(window.Zepto))}();
vendor: 4,679 bytes, lines 28-40
28
29//visible
30!function(t){var i=t(window);t.fn.visible=function(t,e,o){if(!(this.length<1)){var r=this.length>1?this.eq(0):this,n=r.get(0),f=i.width(),h=i.height(),o=o?o:"both",l=e===!0?n.offsetWidth*n.offsetHeight:!0;if("function"==typeof n.getBoundingClientRect){var g=n.getBoundingClientRect(),u=g.top>=0&&g.top<h,s=g.bottom>0&&g.bottom<=h,c=g.left>=0&&g.left<f,a=g.right>0&&g.right<=f,v=t?u||s:u&&s,b=t?c||a:c&&a;if("both"===o)return l&&v&&b;if("vertical"===o)return l&&v;if("horizontal"===o)return l&&b}else{var d=i.scrollTop(),p=d+h,w=i.scrollLeft(),m=w+f,y=r.offset(),z=y.top,B=z+r.height(),C=y.left,R=C+r.width(),j=t===!0?B:z,q=t===!0?z:B,H=t===!0?R:C,L=t===!0?C:R;if("both"===o)return!!l&&p>=q&&j>=d&&m>=L&&H>=w;if("vertical"===o)return!!l&&p>=q&&j>=d;if("horizontal"===o)return!!l&&m>=L&&H>=w}}}}(jQuery);
31
32
33/*
34* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
35*/
36jQuery.easing["jswing"]=jQuery.easing["swing"];jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(a,b,c,d,e){return jQuery.easing[jQuery.easing.def](a,b,c,d,e)},easeInQuad:function(a,b,c,d,e){return d*(b/=e)*b+c},easeOutQuad:function(a,b,c,d,e){return-d*(b/=e)*(b-2)+c},easeInOutQuad:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b+c;return-d/2*(--b*(b-2)-1)+c},easeInCubic:function(a,b,c,d,e){return d*(b/=e)*b*b+c},easeOutCubic:function(a,b,c,d,e){return d*((b=b/e-1)*b*b+1)+c},easeInOutCubic:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b+c;return d/2*((b-=2)*b*b+2)+c},easeInQuart:function(a,b,c,d,e){return d*(b/=e)*b*b*b+c},easeOutQuart:function(a,b,c,d,e){return-d*((b=b/e-1)*b*b*b-1)+c},easeInOutQuart:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b+c;return-d/2*((b-=2)*b*b*b-2)+c},easeInQuint:function(a,b,c,d,e){return d*(b/=e)*b*b*b*b+c},easeOutQuint:function(a,b,c,d,e){return d*((b=b/e-1)*b*b*b*b+1)+c},easeInOutQuint:function(a,b,c,d,e){if((b/=e/2)<1)return d/2*b*b*b*b*b+c;return d/2*((b-=2)*b*b*b*b+2)+c},easeInSine:function(a,b,c,d,e){return-d*Math.cos(b/e*(Math.PI/2))+d+c},easeOutSine:function(a,b,c,d,e){return d*Math.sin(b/e*(Math.PI/2))+c},easeInOutSine:function(a,b,c,d,e){return-d/2*(Math.cos(Math.PI*b/e)-1)+c},easeInExpo:function(a,b,c,d,e){return b==0?c:d*Math.pow(2,10*(b/e-1))+c},easeOutExpo:function(a,b,c,d,e){return b==e?c+d:d*(-Math.pow(2,-10*b/e)+1)+c},easeInOutExpo:function(a,b,c,d,e){if(b==0)return c;if(b==e)return c+d;if((b/=e/2)<1)return d/2*Math.pow(2,10*(b-1))+c;return d/2*(-Math.pow(2,-10*--b)+2)+c},easeInCirc:function(a,b,c,d,e){return-d*(Math.sqrt(1-(b/=e)*b)-1)+c},easeOutCirc:function(a,b,c,d,e){return d*Math.sqrt(1-(b=b/e-1)*b)+c},easeInOutCirc:function(a,b,c,d,e){if((b/=e/2)<1)return-d/2*(Math.sqrt(1-b*b)-1)+c;return d/2*(Math.sqrt(1-(b-=2)*b)+1)+c},easeInElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e)==1)return c+d;if(!g)g=e*.3;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g))+c},easeOutElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e)==1)return c+d;if(!g)g=e*.3;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*b)*Math.sin((b*e-f)*2*Math.PI/g)+d+c},easeInOutElastic:function(a,b,c,d,e){var f=1.70158;var g=0;var h=d;if(b==0)return c;if((b/=e/2)==2)return c+d;if(!g)g=e*.3*1.5;if(h<Math.abs(d)){h=d;var f=g/4}else var f=g/(2*Math.PI)*Math.asin(d/h);if(b<1)return-.5*h*Math.pow(2,10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)+c;return h*Math.pow(2,-10*(b-=1))*Math.sin((b*e-f)*2*Math.PI/g)*.5+d+c},easeInBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;return d*(b/=e)*b*((f+1)*b-f)+c},easeOutBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;return d*((b=b/e-1)*b*((f+1)*b+f)+1)+c},easeInOutBack:function(a,b,c,d,e,f){if(f==undefined)f=1.70158;if((b/=e/2)<1)return d/2*b*b*(((f*=1.525)+1)*b-f)+c;return d/2*((b-=2)*b*(((f*=1.525)+1)*b+f)+2)+c},easeInBounce:function(a,b,c,d,e){return d-jQuery.easing.easeOutBounce(a,e-b,0,d,e)+c},easeOutBounce:function(a,b,c,d,e){if((b/=e)<1/2.75){return d*7.5625*b*b+c}else if(b<2/2.75){return d*(7.5625*(b-=1.5/2.75)*b+.75)+c}else if(b<2.5/2.75){return d*(7.5625*(b-=2.25/2.75)*b+.9375)+c}else{return d*(7.5625*(b-=2.625/2.75)*b+.984375)+c}},easeInOutBounce:function(a,b,c,d,e){if(b<e/2)return jQuery.easing.easeInBounce(a,b*2,0,d,e)*.5+c;return jQuery.easing.easeOutBounce(a,b*2-e,0,d,e)*.5+d*.5+c}})
37
38
39/*! Mousewheel by Brandon Aaron (http://brandon.aaron.sh) */
40!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
40),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)}})});
41
42(function($, window, document) {
43
44
45
46jQuery(document).ready(function($){
47	
48/****************** Nectar ******************/	
49
50// Create cross browser requestAnimationFrame method:
51window.requestAnimationFrame = window.requestAnimationFrame
52|| window.mozRequestAnimationFrame
53|| window.webkitRequestAnimationFrame
54|| window.msRequestAnimationFrame
55|| function(f){setTimeout(f, 1000/60)}
56	 
57var nectarDOMInfo = {
58	
59	usingMobileBrowser: (navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? true : false,
60
61	getWindowSize: function() {
62		nectarDOMInfo.windowHeight = window.innerHeight;
63		nectarDOMInfo.windowWidth = window.innerWidth;
64		
65		nectarDOMInfo.adminBarHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0;
66		nectarDOMInfo.secondaryHeaderHeight = ($('#header-secondary-outer').length > 0) ? $('#header-secondary-outer').height() : 0;
67	},
68
69	scrollPosMouse: function() {
70		return $(window).scrollTop();
71	},
72	
73	scrollPosRAF: function() {
74		nectarDOMInfo.scrollTop = $(window).scrollTop();
75		requestAnimationFrame(nectarDOMInfo.scrollPosRAF);
76	},
77	
78
79	bindEvents: function() {
80		
81		if(!nectarDOMInfo.usingMobileBrowser) {
82			$(window).on('scroll',function(){ nectarDOMInfo.scrollTop = nectarDOMInfo.scrollPosMouse(); });
83		}
84		
85		$(window).on('resize',nectarDOMInfo.getWindowSize);
86		
87	}
88
89}
90
91nectarDOMInfo.getWindowSize();
92nectarDOMInfo.scrollTop = nectarDOMInfo.scrollPosMouse();
93
94if(nectarDOMInfo.usingMobileBrowser) { requestAnimationFrame(nectarDOMInfo.scrollPosRAF); } 
95
96nectarDOMInfo.bindEvents();
97
98
99//set row sizes
100//fullWidthSections();
101fwsClasses();
102
103
104
105
106/***************** Lightbox Init ******************/
107	
108	function fancyBoxInit() {
109		//convert old pp links
110		$('a.pp').removeClass('pp').attr('data-fancybox','');
111		$("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])").removeAttr('rel').attr('data-fancybox','');
112		
113		//image gallery nectar
114		$('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function(){
115			var $unique_id = Math.floor(Math.random()*10000);
116			$(this).find('.swiper-slide a:not(.ext-url-link)').attr('data-fancybox','group_'+$unique_id);
117		});
118		
119		//flex
120		$('.wpb_gallery_slides.wpb_flexslider').each(function(){
121			var $unique_id = Math.floor(Math.random()*10000);
122			$(this).find('.slides > li > a').attr('data-fancybox','group_'+$unique_id);
123		});
124		
125		//touch enabled gal
126		$('.wpb_gallery_slidesflickity_style').each(function(){
127			var $unique_id = Math.floor(Math.random()*10000);
128			$(this).find('.cell > a:not(.ext-url-link)').attr('data-fancybox','group_'+$unique_id);
129		});
130		
131		//add galleries to portfolios
132		$('.portfolio-items, .wpb_gallery .parallax-grid-item').each(function(){
133			var $unique_id = Math.floor(Math.random()*10000);
134			if($(this).find('.pretty_photo').length > 0) {
135				$(this).find('.pretty_photo').removeClass('pretty_photo').attr('data-fancybox','group_'+$unique_id);
136			} else if($(this).find('a[rel*="prettyPhoto["]').length > 0){
137				$(this).find('a[rel*="prettyPhoto["]').removeAttr('rel').attr('data-fancybox','group_'+$unique_id);
138			}
139
140		});
141		
142		//nectar auto lightbox
143		if($('body').hasClass('nectar-auto-lightbox')){
144			$('.gallery').each(function(){
145				if($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) {
146					var $unique_id = Math.floor(Math.random()*10000);
147					$(this).find('.gallery-item .gallery-icon a[href*=".jpg"], .gallery-item .gallery-icon a[href*=".png"], .gallery-item .gallery-icon a[href*=".gif"], .gallery-item .gallery-icon a[href*=".jpeg"]').attr('data-fancybox','group_'+$unique_id).removeClass('pretty_photo');
148				}
149			});
150			$('.main-content img').each(function(){
151				if($(this).parent().is("[href]") && !$(this).parent().is(".magnific-popup") && $(this).parents('.tiled-gallery').length == 0 && $(this).parents('.product-image').length == 0 && $(this).parents('.iosSlider.product-slider').length == 0) {
152					var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/);
153					if(match) $(this).parent().attr('data-fancybox','');
154				} 
155			});
156		}
157		
158		//regular
159		fbMarginArr = ($('body.admin-bar').length > 0) ? [60,100] : [60,100];
160		if(window.innerWidth < 1000) {
161			fbMarginArr = [0,0];
162		}
163		$("[data-fancybox]").fancybox({
164			animationEffect : "zoom-in-out",
165			animationDuration : 350,
166			buttons : [
167        //'slideShow',
168        'fullScreen',
169        //'thumbs',
170        //'share',
171        //'download',
172        'zoom',
173        'close'
174    	],
175			margin : fbMarginArr,
176			loop     : true,
177			caption : function( instance, item ) {
178				return $(this).attr('title');
179			},
180			beforeLoad: function(instance,current) {
181				//when there's nothing to load
182				if(typeof instance.current.src !== 'string') {  $.fancybox.close(true);  }
183			},
184			mobile : {
185				margin   : 0
186			}
187		});
188	}
189	
190	
191	function magnificInit() {
192		
193		//convert old pp links
194		$('a.pp').removeClass('pp').addClass('magnific-popup');
195		$("a[rel^='prettyPhoto']:not([rel*='_gal']):not([rel*='product-gallery']):not([rel*='prettyPhoto['])").removeAttr('rel').addClass('magnific-popup');
196
197
198		//image gallery nectar
199		$('.wpb_gallery .wpb_gallery_slidesnectarslider_style').each(function(){
200			var $unique_id = Math.floor(Math.random()*10000);
201			$(this).find('.swiper-slide a:not(.ext-url-link)').addClass('pretty_photo');
202		});
203
204		//flex
205		$('.wpb_gallery_slides.wpb_flexslider').each(function(){
206			var $unique_id = Math.floor(Math.random()*10000);
207			$(this).find('.slides > li > a').addClass('pretty_photo');
208		});
209		//touch enabled gal
210		$('.wpb_gallery_slidesflickity_style').each(function(){
211			var $unique_id = Math.floor(Math.random()*10000);
212			$(this).find('.cell > a:not(.ext-url-link)').addClass('pretty_photo');
213		});
214
215		//add galleries to portfolios
216		$('.portfolio-items, .wpb_gallery .swiper-slide, .wpb_gallery_slidesflickity_style .cell, .wpb_gallery_slides.wpb_flexslider ul > li,  .wpb_gallery .parallax-grid-item').each(function(){
217			if($(this).find('.pretty_photo').length > 0) {
218				$(this).find('.pretty_photo').removeClass('pretty_photo').addClass('gallery').addClass('magnific');
219			} else if($(this).find('a[rel*="prettyPhoto["]').length > 0){
220				$(this).find('a[rel*="prettyPhoto["]').removeAttr('rel').addClass('gallery').addClass('magnific');
221			}
222
223		});
224		
225		$("a[data-rel='prettyPhoto[product-gallery]']").each(function(){
226			$(this).removeAttr('data-rel').addClass('magnific').addClass('gallery');
227		});
228		
229		//nectar auto lightbox
230		if($('body').hasClass('nectar-auto-lightbox')){
231			$('.gallery').each(function(){
232				if($(this).find('.gallery-icon a[rel^="prettyPhoto"]').length == 0) {
233					var $unique_id = Math.floor(Math.random()*10000);
234					$(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');
235				}
236			});
237			$('.main-content img').each(function(){
238				if($(this).parent().is("[href]") && !$(this).parent().is(".magnific-popup") && $(this).parents('.tiled-gallery').length == 0 && $(this).parents('.product-image').length == 0 && $(this).parents('.iosSlider.product-slider').length == 0) {
239					var match = $(this).parent().attr('href').match(/\.(jpg|png|gif)\b/);
240					if(match) $(this).parent().addClass('magnific-popup').addClass('image-link');
241				} 
242			});
243		}
244		
245
246		//regular
247		$('a.magnific-popup:not(.gallery):not(.nectar_video_lightbox)').magnificPopup({ 
248			type: 'image', 
249			callbacks: {
250				
251				imageLoadComplete: function()  {	
252					var $that = this;
253					setTimeout( function() { $that.wrap.addClass('mfp-image-loaded'); }, 10);
254				},
255				beforeOpen: function() {
256				    this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
257			    },
258			    open: function() {
259					    	
260					$.magnificPopup.instance.next = function() {
261						var $that = this;
262
263						this.wrap.removeClass('mfp-image-loaded');
264						setTimeout( function() { $.magnificPopup.proto.next.call($that); }, 100);
265					}
266
267					$.magnificPopup.instance.prev = function() {
268						var $that = this;
269
270						this.wrap.removeClass('mfp-image-loaded');
271						setTimeout( function() { $.magnificPopup.proto.prev.call($that); }, 100);
272					}
273					
274				}
275			},
276			fixedContentPos: false,
277		    mainClass: 'mfp-zoom-in', 
278		    removalDelay: 400 
279		});
280
281		//video
282		$('a.magnific-popup.nectar_video_lightbox, .magnific_nectar_video_lightbox a.link_text, .swiper-slide a[href*=youtube], .swiper-slide a[href*=vimeo], .nectar-video-box a.full-link.magnific-popup').magnificPopup({ 
283			type: 'iframe', 
284			fixedContentPos: false,
285		    mainClass: 'mfp-zoom-in', 
286		    removalDelay: 400 
287		});
288
289
290		//galleries
291		$('a.magnific.gallery').each(function(){
292
293			var $parentRow = ($(this).closest('.wpb_column').length > 0) ? $(this).closest('.wpb_column') : $(this).parents('.row');
294			if($parentRow.length > 0 && !$parentRow.hasClass('lightbox-col')) {
295
296				$parentRow.magnificPopup({
297					type: 'image',
298					delegate: 'a.magnific',
299					mainClass: 'mfp-zoom-in',
300					fixedContentPos: false,
301					callbacks: {
302
303						elementParse: function(item) {
304			
305							 if($(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('iframe=true') != -1 || $(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('https://www.youtube.com/watch') != -1 ) {
306						         item.type = 'iframe';
307						      } else if ($(item.el.context).is('[href]') && $(item.el.context).attr('href').indexOf('video-popup-') != -1) {
308						      	item.type = 'inline';
309						      } else {
310						         item.type = 'image';
311						      }
312						},
313
314						imageLoadComplete: function()  {	
315							var $that = this;
316							setTimeout( function() { $that.wrap.addClass('mfp-image-loaded'); }, 10);
317						},
318
319						beforeOpen: function() {
320					       this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
321					    },
322
323					    open: function() {
324					    	
325
326					    	//self hosted video
327					    	if($(this.content).find('.mejs-video video').length > 0 && $().mediaelementplayer ) {
328	            				$(this.content).find('.mejs-video video')[0].player.remove();
329	            				
330	            				var $that = this;
331	            				setTimeout(function(){
332	            					$($that.content).find('video').mediaelementplayer();
333	            					$($that.content).find('.mejs-video video')[0].player.play();
334	            				},50);
335	            				
336	            			}
337
338							$.magnificPopup.instance.next = function() {
339								var $that = this;
340
341								this.wrap.removeClass('mfp-image-loaded');
342								setTimeout( function() { 
343									$.magnificPopup.proto.next.call($that); 
344
345									//self hosted video
346									if($($that.content).find('.mejs-video video').length > 0) {
347			            				$($that.content).find('.mejs-video video')[0].play();
348			            			}
349
350								}, 100);
351							}
352
353							$.magnificPopup.instance.prev = function() {
354								var $that = this;
355
356								this.wrap.removeClass('mfp-image-loaded');
357								setTimeout( function() { 
358									$.magnificPopup.proto.prev.call($that); 
359
360									//self hosted video
361									if($($that.content).find('.mejs-video video').length > 0) {
362			            				$($that.content).find('.mejs-video video')[0].play();
363			            			}
364								}, 100);
365							}
366							
367						},
368
369						close: function() {
370							//self hosted video
371					    	if($(this.content).find('.mejs-video video').length > 0) {
372	            				 $(this.content).find('.mejs-video video')[0].load();
373	            			}
374						}
375					},
376					removalDelay: 400, 
377					gallery: {
378			          enabled:true
379			        }
380				});
381
382				$parentRow.addClass('lightbox-col');
383			}
384			
385		});
386
387	}
388
389	function lightBoxInit() {
390		if($('body[data-ls="magnific"]').length > 0 || $('body[data-ls="pretty_photo"]').length > 0 ) {
391			magnificInit();
392		} else if($('body[data-ls="fancybox"]').length > 0) {
393			fancyBoxInit();
394		}
395	}
396
397	lightBoxInit();
398	//check for late links
399	setTimeout(lightBoxInit,500);
400	
401/*!
402 * jQuery Transit - CSS3 transitions and transformations
403 * (c) 2011-2012 Rico Sta. Cruz <[email protected]>
404 * MIT Licensed.
405 *
406 * http://ricostacruz.com/jquery.transit
407 * http://github.com/rstacruz/jquery.transit
408 */
409(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
409)",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")}
409this.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);
410
411
412
413
414  // ========================= smartresize ===============================
415
416  /*
417   * smartresize: debounced resize event for jQuery
418   *
419   * latest version and complete README available on Github:
420   * https://github.com/louisremi/jquery.smartresize.js
421   *
422   * Copyright 2011 @louis_remi
423   * Licensed under the MIT license.
424   */
425
426  var $event = $.event,
427      dispatchMethod = $.event.handle ? 'handle' : 'dispatch',
428      resizeTimeout;
429
430  $event.special.smartresize = {
431    setup: function() {
432      $(this).bind( "resize", $event.special.smartresize.handler );
433    },
434    teardown: function() {
435      $(this).unbind( "resize", $event.special.smartresize.handler );
436    },
437    handler: function( event, execAsap ) {
438      // Save the context
439      var context = this,
440          args = arguments;
441
442      // set correct event type
443      event.type = "smartresize";
444
445      if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
446      resizeTimeout = setTimeout(function() {
447        $event[ dispatchMethod ].apply( context, args );
448      }, execAsap === "execAsap"? 0 : 100 );
449    }
450  };
451
452  $.fn.smartresize = function( fn ) {
453    return fn ? this.bind( "smartresize", fn ) : this.trigger( "smartresize", ["execAsap"] );
454  };
455
456
457/***************** Global vars ******************/
458var $standAnimatedColTimeout = [];
459var $animatedSVGIconTimeout = [];
460var $svg_icons = [];
461var $nectarCustomSliderRotate;
462
463/***************** Smooth Scrolling ******************/
464
465	function niceScrollInit(){
466		if(!$().niceScroll) { return; }
467		
468		$("html").niceScroll({
469			scrollspeed: 60,
470			mousescrollstep: 40,
471			cursorwidth: 15,
472			cursorborder: 0,
473			cursorcolor: '#303030',
474			cursorborderradius: 6,
475			autohidemode: false,
476			horizrailenabled: false
477		});
478		
479		
480		if($('#boxed').length == 0){
481			$('body, body #header-outer, body #header-secondary-outer, body #search-outer').css('padding-right','16px');
482		} else if($('body[data-ext-responsive="true"]').length == 0 ) {
483			$('body').css('padding-right','16px');
484		}
485		
486		$('html').addClass('no-overflow-y');
487	}
488
489	var $smoothActive = $('body').attr('data-smooth-scrolling'); 
490	var $smoothCache = ( $smoothActive == 1 ) ? true : false;
491	
492	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 {
493		$('body').attr('data-smooth-scrolling','0');
494	}
495	
496	//chrome ss
497	if($smoothCache == false && $('body.material').length == 0 && navigator.platform.toUpperCase().indexOf('MAC') === -1 && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/) && $(window).width() > 690 && $('#nectar_fullscreen_rows').length == 0) {
498		!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);
498var 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))}();
499	}
500
501
502
503
504
505
506
507/***************** Sliders ******************/
508
509	//gallery
510	function flexsliderInit(){
511		$('.flex-gallery').each(function(){
512			
513			var $that = $(this);
514			
515			imagesLoaded($(this),function(instance){
516			
517				 $that.flexslider({
518			        animation: 'fade',
519			        smoothHeight: false, 
520			        animationSpeed: 500,
521			        useCSS: false, 
522			        touch: true
523			    });
524				
525				////gallery slider add arrows
526				$('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="fa fa-angle-right"></i>');
527				$('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="fa fa-angle-left"></i>');
528			
529			});
530			
531		});
532	}
533	flexsliderInit();
534
535  
536
537
538	function flickityInit() {
539		if($('.nectar-flickity:not(.masonry)').length == 0) return false;
540
541		var $flickitySliders = [];
542
543		$('.nectar-flickity:not(.masonry)').each(function(i){
544			
545			$(this).addClass('instance-'+i);
546			
547			var $freeScrollBool = ($(this).is('[data-free-scroll]') && $(this).attr('data-free-scroll') == 'true') ? true : false;
548			var $groupCellsBool = true;
549			var $flickContainBool = true;
550			var $flcikAttr = 0.025;
551			
552			var $flickCellAlign = 'center';
553			if( $(this).is('[data-format="fixed_text_content_fullwidth"]') ) {
554					$flickCellAlign = 'left';
555					$groupCellsBool = false;
556					$flickContainBool = false;
557					$flcikAttr = 0.02;
558			}
559
560			if($freeScrollBool == true) {
561				 $groupCellsBool = false;
562			}
563
564			if($(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'next_prev_arrows') {
565				var $paginationBool = false;
566				var $nextPrevArrowBool = true;
567			} else {
568				var $paginationBool = true;
569				var $nextPrevArrowBool = false;
570			}
571
572			if($(this).attr('data-controls').length > 0 && $(this).attr('data-controls') == 'none') {
573				var $paginationBool = false;
574				var $nextPrevArrowBool = false;
575			}
576
577			var $flickity_autoplay = false;
578			var $selectedAttraction = 0.025;
579
580			if($(this).is('[data-autoplay]') && $(this).attr('data-autoplay') == 'true') {
581				
582				$flickity_autoplay = true;
583				$selectedAttraction = 0.019;
584
585				if($(this).is('[data-autoplay-dur]') && $(this).attr('data-autoplay-dur').length > 0) {
586
587					if(parseInt($(this).attr('data-autoplay-dur')) > 100 && parseInt($(this).attr('data-autoplay-dur')) < 30000) {
588						$flickity_autoplay = parseInt($(this).attr('data-autoplay-dur'));
589					}
590					
591				}
592
593			}
594
595			var $that = $(this);
596
597			$flickitySliders[i] = new Flickity('.nectar-flickity.instance-'+i, {
598			  contain: $flickContainBool,
599			  draggable: true,
600			  lazyLoad: false,
601			  imagesLoaded: true,
602			  percentPosition: true,
603				cellAlign: $flickCellAlign,
604			  selectedAttraction: $selectedAttraction,
605			  groupCells: $groupCellsBool,
606			  prevNextButtons: $nextPrevArrowBool,
607			  freeScroll: $freeScrollBool,
608			  pageDots: $paginationBool,
609			  resize: true,
610				selectedAttraction: $flcikAttr,
611			  autoPlay: $flickity_autoplay,
612			  pauseAutoPlayOnHover: false,
613			  setGallerySize: true,
614			  wrapAround: true,
615			  accessibility: false,
616			  arrowShape: { 
617				     x0: 20,
618					  x1: 70, y1: 30,
619					  x2: 70, y2: 25,
620					  x3: 70
621				}
622			});
623			
624
625			if($(this).is('[data-format="fixed_text_content_fullwidth"]')) {
626				
627				var $onMobileBrowser = navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/);
628				
629				$flickitySliders[i].on( 'scroll', function() {
630					
631					if($onMobileBrowser) { return; }
632					
633					var $curFlkSlid = $flickitySliders[i];
634					var $flkSlideWidth = $that.find('.cell').outerWidth() + 25;
635					var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 275 : 0;
636					var $extraWindowSpace = ( ($(window).width() + $leftHeaderSize) - $that.parents('.main-content').width())/2;
637					$extraWindowSpace += parseInt($that.css('margin-left')) + 2;
638					$flickitySliders[i].slides.forEach( function( slide, j ) {
639
640							var $scaleAmt = 1;
641							var $translateXAmt = 0;
642							var $rotateAmt = 0;
643							var $slideZIndex = 10;
644							var $opacityAmt = 1;
645							
646							var $slideOffset = $(slide.cells[0].element).offset().left;
647							
648							var flkInstanceSlide = $('.nectar-flickity.instance-'+i+' .cell:nth-child('+ (j+1) +')');
649							
650							if($slideOffset - $extraWindowSpace < 0 && $slideOffset  - $extraWindowSpace > $flkSlideWidth*-1 ) {
651								$scaleAmt = 1 + ( ($slideOffset - $extraWindowSpace) / 1500);
652								$opacityAmt = 1 + ( ($slideOffset - $extraWindowSpace + 70) / 550);
653								$translateXAmt = ( ($slideOffset - $extraWindowSpace)) * -1;
654								$rotateAmt = ( ($slideOffset  - $extraWindowSpace) / 25) * -1;
655							} else {
656								$scaleAmt = 1;
657								$opacityAmt = 1;
658								$translateXAmt = 0;
659								$rotateAmt = 0;
660							}
661							
662							//handle z separately for an extra cushion of 5px in case
663							if($slideOffset + 5 - $extraWindowSpace < 0 && $slideOffset  - $extraWindowSpace > $flkSlideWidth*-1 ) {
664								$slideZIndex = 5;
665							} else {
666								$slideZIndex = 10;
667							}
668							
669							flkInstanceSlide.css({
670								'z-index' : $slideZIndex
671							});
672							
673							flkInstanceSlide.find('.inner-wrap-outer').css({
674								'transform': 'perspective(800px) translateX('+ $translateXAmt +'px) rotateY('+$rotateAmt+'deg) translateZ(0)',
675								'opacity' : $opacityAmt
676							});
677							
678							flkInstanceSlide.find('.inner-wrap').css({
679								'transform': 'scale('+ $scaleAmt +') translateZ(0)'
680							}); 
681							
682						  
683					
684					});
685				});
686				
687				
688			}
689
690			var $removeHiddenTimeout;
691
692			$flickitySliders[i].on( 'dragStart', function() {
693			   clearTimeout($removeHiddenTimeout);
694				 $that.addClass('is-dragging');
695			   $that.find('.flickity-prev-next-button').addClass('hidden');
696			});
697			$flickitySliders[i].on( 'dragEnd', function() {
698				$that.removeClass('is-dragging');
699				$removeHiddenTimeout = setTimeout(function(){
700					$that.find('.flickity-prev-next-button').removeClass('hidden');
701				},600);
702			 
703			});
704
705			$('.flickity-prev-next-button').on( 'click', function() {
706			   clearTimeout($removeHiddenTimeout);
707			   $(this).parents('.nectar-flickity').find('.flickity-prev-next-button').addClass('hidden');
708			   $removeHiddenTimeout = setTimeout(function(){
709					$that.find('.flickity-prev-next-button').removeClass('hidden');
710				},600);
711			});
712			
713			
714			//imgs loaded
715			if($that.hasClass('nectar-carousel')) {
716				imagesLoaded($that,function(instance){
717					nectarCarouselFlkEH($that);
718				});
719			}
720			
721
722		});
723		
724
725	}
726	
727	
728	setTimeout(flickityInit,100);
729	
730	
731	//nectar carousel flickity equal height
732	
733	////loop
734	function setNectarCarouselFlkEH() {
735			$('.nectar-carousel.nectar-flickity:not(.masonry)').each(function(){
736				  nectarCarouselFlkEH($(this));
737			});
738	}
739	
740	function nectarCarouselFlkEH($slider_instance) {
741			
742			var $tallestSlideCol = 0;
743			
744			$slider_instance.find('.flickity-slider > .cell').css('height','auto');
745			
746			$slider_instance.find('.flickity-slider > .cell').each(function(){
747				($(this).height() > $tallestSlideCol) ? $tallestSlideCol = $(this).height() : $tallestSlideCol = $tallestSlideCol;
748			});	
749			
750			//safety net incase height couldn't be determined
751			if($tallestSlideCol < 10) $tallestSlideCol = 'auto';
752
753			//set even height
754			$slider_instance.find('.flickity-slider > .cell').css('height',$tallestSlideCol+'px');
755
756	}
757	
758	
759
760
761	function flickityBlogInit() {
762		if($('.nectar-flickity.masonry.not-initialized').length == 0) return false;
763
764		$('.nectar-flickity.masonry.not-initialized').each(function(){
765
766			//move pos for large_featured
767			if($(this).parents('article').hasClass('large_featured')) 
768				$(this).insertBefore( $(this).parents('article').find('.content-inner') );
769			
770		});
771
772
773		$('.nectar-flickity.masonry.not-initialized').flickity({
774		  contain: true,
775		  draggable: false,
776		  lazyLoad: false,
777		  imagesLoaded: true,
778		  percentPosition: true,
779		  prevNextButtons: true,
780		  pageDots: false,
781		  resize: true,
782		  setGallerySize: true,
783		  wrapAround: true,
784		  accessibility: false
785		});
786
787		$('.nectar-flickity.masonry').removeClass('not-initialized');
788
789		//add count
790		$('.nectar-flickity.masonry:not(.not-initialized)').each(function(){
791
792			if($(this).find('.item-count').length == 0) {
793				
794				$('<div class="item-count"/>').insertBefore($(this).find('.flickity-prev-next-button.next'));
795				$(this).find('.item-count').html('<span class="current">1</span>/<span class="total">
795' + $(this).find('.flickity-slider .cell').length + '</span>');
796
797				$(this).find('.flickity-prev-next-button, .item-count').wrapAll('<div class="control-wrap" />');
798
799				//move pos for wide_tall
800				if($(this).parents('article').hasClass('wide_tall') && $(this).parents('.masonry.material').length == 0) 
801					$(this).find('.control-wrap').insertBefore( $(this) );
802			}
803		});
804
805		//update count
806		$('.masonry .flickity-prev-next-button.previous,  .masonry .flickity-prev-next-button.next').click(function(){
807			if($(this).parents('.wide_tall').length > 0) 
808				$(this).parent().find('.item-count .current').html($(this).parents('article').find('.nectar-flickity .cell.is-selected').index()+1);
809			else 
810				$(this).parent().find('.item-count .current').html($(this).parents('.nectar-flickity').find('.cell.is-selected').index()+1);
811		});
812
813		$('body').on('mouseover','.flickity-prev-next-button.next',function(){
814			$(this).parent().find('.flickity-prev-next-button.previous, .item-count').addClass('next-hovered');
815		});
816		$('body').on('mouseleave','.flickity-prev-next-button.next',function(){
817			$(this).parent().find('.flickity-prev-next-button.previous, .item-count').removeClass('next-hovered');
818		});
819	
820	}
821/****************twenty twenty******************/
822	$('.twentytwenty-container').each(function(){
823		var $that = $(this);
824		$(this).imagesLoaded(function(){
825			$that.twentytwenty();
826		});
827	});
828
829
830/****************split line text******************/
831if($('.nectar-recent-posts-single_featured.multiple_featured').length > 0) {
832  splitLineText();
833}
834	
835/****************full page******************/
836var $usingFullScreenRows = false;
837var $fullscreenSelector = '';
838var $disableFPonMobile = ($('#nectar_fullscreen_rows[data-mobile-disable]').length > 0) ? $('#nectar_fullscreen_rows').attr('data-mobile-disable') : 'off';
839var $onMobileBrowser = navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/);
840
841if(!$onMobileBrowser) {
842	$disableFPonMobile = 'off';
843}
844
845//change anchor link IDs for when disabled on mobile
846if($disableFPonMobile == 'on' && $('#nectar_fullscreen_rows').length > 0) {
847	$('#nectar_fullscreen_rows > .wpb_row[data-fullscreen-anchor-id]').each(function(){
848		if($(this).attr('data-fullscreen-anchor-id').length > 0)
849			$(this).attr('id',$(this).attr('data-fullscreen-anchor-id'));
850	});
851
852
853	//remove main content row padding
854	$('.container-wrap .main-content > .row').css({'padding-bottom':'0'});
855
856	//extra padding for first row is using transparent header
857	if( $('#nectar_fullscreen_rows > .wpb_row:nth-child(1)').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && !$('#nectar_fullscreen_rows > .wpb_row:nth-child(1)').hasClass('full-width-content') ) {
858		$('#nectar_fullscreen_rows > .wpb_row:nth-child(1)').addClass('extra-top-padding');
859	}
860}
861
862if($('#nectar_fullscreen_rows').length > 0 && $disableFPonMobile != 'on' || $().fullpage && $disableFPonMobile != 'on') {
863
864	function setFPNavColoring(index,direction) {
865			
866		  if($('#boxed').length > 0 && overallWidth > 750) return;
867		
868		  if($('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').find('.span_12.light').length > 0) {
869    		$('#fp-nav').addClass('light-controls');
870
871    		  if(direction == 'up')
872    			  $('#header-outer.dark-slide').removeClass('dark-slide');
873    		  else
874    		  	setTimeout(function(){ $('#header-outer.dark-slide').removeClass('dark-slide'); },520);
875    	} else {
876    		  $('#fp-nav.light-controls').removeClass('light-controls');
877
878    		  if(direction == 'up')
879    		  	$('#header-outer').addClass('dark-slide');
880    		  else
881    			  setTimeout(function(){ $('#header-outer').addClass('dark-slide'); },520);
882    	}
883			
884			//handle n slider coloring
885			 if($('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').find('.nectar-slider-wrap[data-fullscreen="true"]').length > 0) {
886				var $currentSlider = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').find('.nectar-slider-wrap[data-fullscreen="true"]');
887		
888				if( $currentSlider.is('[data-overall_style="directional"]') && $('#header-outer #logo span.dark').length > 0 ){
889					$('#header-outer').addClass('directional-nav-effect').removeClass('dne-disabled');
890				}
891				
892				if($currentSlider.find('.swiper-slide-active[data-color-scheme="light"]').length > 0) {
893					$('#header-outer').removeClass('dark-slide');
894				} else if($currentSlider.find('.swiper-slide-active[data-color-scheme="dark"]').length > 0) {
895					$('#header-outer').addClass('dark-slide');
896				}
897				
898			} else {
899				
900					$('#header-outer').removeClass('directional-nav-effect').addClass('dne-disabled');
901				
902			}
903			
904	}
905	
906	
907
908	var $anchors = [];
909	var $names = [];
910	
911	function setFPNames() {
912		$anchors = [];
913		$names = [];
914		$('#nectar_fullscreen_rows > .wpb_row').each(function(i){
915			$id = ($(this).is('[data-fullscreen-anchor-id]')) ? $(this).attr('data-fullscreen-anchor-id') : '';
916
917			//anchor checks
918			if($('#nectar_fullscreen_rows[data-anchors="on"]').length > 0) {
919				if($id.indexOf('fws_') == -1) $anchors.push($id);
920				else $anchors.push('section-'+(i+1));
921			}
922
923			//name checks
924			if($(this).find('.full-page-inner-wrap[data-name]').length > 0) 
925				$names.push($(this).find('.full-page-inner-wrap').attr('data-name'));
926			else 
927				$names.push(' ');
928		});
929	}
930	setFPNames();
931
932	function initFullPageFooter() {
933		var $footerPos = $('#nectar_fullscreen_rows').attr('data-footer');
934
935		if($footerPos == 'default') {
936			$('#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" />');
937		}
938		else if($footerPos == 'last_row') {
939			$('#footer-outer').remove();
940			$('#nectar_fullscreen_rows > .wpb_row:last-child').attr('id','footer-outer').addClass('fp-auto-height');
941		} else {
942			$('#footer-outer').remove();
943		}
944		
945	}	
946
947	if($('#nectar_fullscreen_rows').length > 0)
948		initFullPageFooter();
949
950	//fullscreen row logic
951	function fullscreenRowLogic() {
952		$('.full-page-inner-wrap .full-page-inner > .span_12 > .wpb_column').each(function(){
953			if($(this).find('> .vc_column-inner > .wpb_wrapper').find('> .wpb_row').length > 0) {
954
955				//add class for css
956				$(this).find('> .vc_column-inner > .wpb_wrapper').addClass('only_rows');
957
958				//set number of rows for css
959				$rowNum = $(this).find('> .vc_column-inner > .wpb_wrapper').find('> .wpb_row').length;
960				$(this).find('> .vc_column-inner > .wpb_wrapper').attr('data-inner-row-num',$rowNum);
961			} 
962
963			else if($(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').find('> .wpb_row').length > 0) {
964
965				//add class for css
966				$(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').addClass('only_rows');
967
968				//set number of rows for css
969				$rowNum = $(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').find('> .wpb_row').length;
970				$(this).find('> .column-inner-wrap > .column-inner > .wpb_wrapper').attr('data-inner-row-num',$rowNum);
971			}
972		});
973	}
974
975	fullscreenRowLogic();
976
977	function fullHeightRowOverflow() {
978		//handle rows with full height that are larger than viewport
979		if($(window).width() >= 1000) {
980
981	    	$('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap[data-content-pos="full_height"]').each(function(){
982
983	    		//reset mobile calcs incase user plays with window resize
984	    		$(this).find('> .full-page-inner').css('height','100%');
985
986	    		var maxHeight = overallHeight;
987	    		var columnPaddingTop = 0;
988	    		var columnPaddingBottom = 0;
989
990	    		
991	    		if($('#nectar_fullscreen_rows').attr('data-animation') == 'none')
992	    			$(this).find('> .full-page-inner > .span_12 ').css('height','100%');
993	    		else
994	    			$(this).find('> .full-page-inner > .span_12 ').css('height',overallHeight);
995
996	    		$(this).find('> .full-page-inner > .span_12 > .wpb_column > .vc_column-inner > .wpb_wrapper').each(function(){
997	    			 columnPaddingTop = parseInt($(this).parents('.wpb_column').css('padding-top'));
998	    			 columnPaddingBottom = parseInt($(this).parents('.wpb_column').css('padding-bottom'));
999
1000	    			 maxHeight = maxHeight > $(this).height() + columnPaddingTop + columnPaddingBottom ? maxHeight : $(this).height() + columnPaddingTop + columnPaddingBottom;
1001	    		});
1002	    		
1003	    	
1004	    		if(maxHeight > overallHeight)
1005	    			$(this).find('> .full-page-inner > .span_12').height(maxHeight).css('float','none');
1006	    		
1007	    	});
1008
1009	    }
1010
1011	    else {
1012	    	//mobile min height set
1013	    	$('#nectar_fullscreen_rows > .wpb_row').each(function(){
1014	    		$totalColHeight = 0;
1015	    		$(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(){
1016	    			$totalColHeight += $(this).outerHeight(true);
1017	    		});
1018
1019	    		$(this).find('.fp-scrollable > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').css('height','100%');
1020	    		if($totalColHeight > $(this).find('.fp-scrollable > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').height())
1021	    			$(this).find('.fp-scrollable  > .fp-scroller > .full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner').height($totalColHeight);
1022	    	});
1023	    }
1024
1025	}
1026
1027	function fullscreenElementSizing() {
1028		//nectar slider
1029		$nsSelector = '.nectar-slider-wrap[data-fullscreen="true"][data-full-width="true"], .nectar-slider-wrap[data-fullscreen="true"][data-full-width="boxed-full-width"]';
1030		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) {
1031			if($('#nectar_fullscreen_rows .wpb_row').length > 0) 
1032				$($nsSelector).find('.swiper-container').attr('data-height',$('#nectar_fullscreen_rows .wpb_row').height()+1);
1033	        
1034	        $(window).trigger('resize.nsSliderContent');
1035
1036	        $($nsSelector).parents('.full-page-inner').addClass('only-nectar-slider');
1037	    }
1038	}
1039
1040
1041	//kenburns first slide fix
1042	$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').addClass('kenburns');
1043	setTimeout(function(){
1044		//ken burns first slide fix
1045		$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').removeClass('kenburns');
1046	},500);
1047
1048	//remove kenburns from safari
1049	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');
1050
1051	var overallHeight = $(window).height();
1052	var overallWidth = $(window).width();
1053	var $fpAnimation = $('#nectar_fullscreen_rows').attr('data-animation');
1054	var $fpAnimationSpeed;
1055	var $svgResizeTimeout;
1056	
1057	switch($('#nectar_fullscreen_rows').attr('data-animation-speed')) {
1058		case 'slow':
1059			$fpAnimationSpeed = 1150;
1060			break;
1061		case 'medium':
1062			$fpAnimationSpeed = 850;
1063			break;
1064		case 'fast':
1065			$fpAnimationSpeed = 650;
1066			break;
1067		default:
1068			$fpAnimationSpeed = 850;
1069	}
1070	
1071	function heyFirefoxDrawTheEl(){
1072			var $drawTheEl = $('#nectar_fullscreen_rows > div:first-child').height();
1073			if($('#nectar_fullscreen_rows.trans-animation-active').length > 0){
1074				requestAnimationFrame(heyFirefoxDrawTheEl);
1075			}
1076	}
1077
1078	
1079	function initNectarFP() {
1080
1081		$usingFullScreenRows = true;
1082		$fullscreenSelector = '.wpb_row.active ';
1083
1084		$('.container-wrap, .container-wrap .main-content > .row').css({'padding-bottom':'0', 'margin-bottom': '0'});
1085		$('#nectar_fullscreen_rows').fullpage({
1086			sectionSelector: '#nectar_fullscreen_rows > .wpb_row',
1087			navigation: true,
1088			css3: true,
1089			scrollingSpeed: $fpAnimationSpeed,
1090			anchors: $anchors,
1091			scrollOverflow: true,
1092			navigationPosition: 'right',
1093			navigationTooltips: $names,
1094			afterLoad: function(anchorLink, index, slideAnchor, slideIndex){ 
1095
1096				if($('#nectar_fullscreen_rows').hasClass('afterLoaded')) {
1097				 	
1098					//ensure no scrolling body occurs
1099					if(nectarDOMInfo.scrollTop != 0) {
1100						window.scrollTo(0,0);
1101					}
1102					
1103					//reset slim scroll to top
1104					$('.wpb_row:not(.last-before-footer):not(:nth-child('+index+')) .fp-scrollable').each(function(){
1105						$scrollable = $(this).data('iscrollInstance');
1106						$scrollable.scrollTo(0,0);
1107					});
1108
1109					//reset carousel
1110					$('.wpb_row:not(:nth-child('+index+')) .owl-carousel').trigger('to.owl.carousel',[0]);
1111
1112					var $row_id = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').attr('id');
1113
1114					$('#nectar_fullscreen_rows > .wpb_row').removeClass('transition-out').removeClass('trans');
1115					
1116
1117					$('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')').removeClass('next-current');
1118					$('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+') .full-page-inner-wrap-outer').css({'height': '100%'});
1119					$('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap-outer').css({'transform':'none'});
1120					//take care of nav/control coloring
1121					//setFPNavColoring(index,'na');
1122					
1123					//handle waypoints
1124					if($row_id != 'footer-outer' && $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+').last-before-footer').length == 0) {
1125						waypoints();
1126						if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
1127							resetWaypoints();
1128							Waypoint.destroyAll();
1129							startMouseParallax();
1130							//portfolioLoadIn();
1131						}
1132						responsiveTooltips();
1133					}
1134					
1135					if($row_id !='footer-outer') {
1136						$('#nectar_fullscreen_rows > .wpb_row').removeClass('last-before-footer').css('transform','initial');
1137
1138						//reset animation attrs
1139						$('#nectar_fullscreen_rows > .wpb_row:not(.active):not(#footer-outer)').css({'transform':'translateY(0)','left':'-9999px', 'transition': 'none', 'opacity':'1', 'will-change':'auto'});
1140						$('#nectar_fullscreen_rows > .wpb_row:not(#footer-outer)').find('.full-page-inner-wrap-outer').css({'transition': 'none',  'transform':'none', 'will-change':'auto'});
1141						$('#nectar_fullscreen_rows > .wpb_row:not(#footer-outer)').find('.fp-tableCell').css({'transition': 'none', 'transform':'none', 'will-change':'auto'});
1142						
1143						//stacking fix
1144						$('#nectar_fullscreen_rows > .wpb_row:not(#footer-outer)').find('.full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner > .container').css({'backface-visibility':'visible', 'z-index':'auto'});
1145					}
1146				} else {
1147					fullHeightRowOverflow();
1148					overallHeight = $('#nectar_fullscreen_rows').height();
1149					$('#nectar_fullscreen_rows').addClass('afterLoaded');
1150
1151					//for users that have scrolled down prior to turning on full page
1152					setTimeout(function(){ window.scrollTo(0,0); },1800);
1153
1154					//ken burns first slide fix
1155					$('#nectar_fullscreen_rows[data-row-bg-animation="ken_burns"] > .wpb_row:first-child .row-bg.using-image').removeClass('kenburns');
1156
1157					//handle fullscreen elements
1158	        fullscreenElementSizing();
1159				}
1160
1161				
1162				$('#nectar_fullscreen_rows').removeClass('nextSectionAllowed');
1163
1164				
1165			 },
1166	        onLeave: function(index, nextIndex, direction){ 
1167	        	
1168						$('#nectar_fullscreen_rows').addClass('trans-animation-active');
1169						
1170	        	var $row_id = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+nextIndex+')').attr('id');
1171	        	var $indexRow = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')');
1172	        	var $nextIndexRow = $('#nectar_fullscreen_rows > .wpb_row:nth-child('+nextIndex+')');
1173	        	var $nextIndexRowInner = $nextIndexRow.find('.full-page-inner-wrap-outer');
1174	        	var $nextIndexRowFpTable = $nextIndexRow.find('.fp-tableCell');
1175	        	//mobile/safari  fix
1176	        	var $transformProp = (!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) ? 'transform' : 'all'; 
1177	        	//if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1) $transformProp = 'all';
1178
1179	        	if( $row_id == 'footer-outer') {
1180	        		$indexRow.addClass('last-before-footer'); 
1181	        		$('#footer-outer').css('opacity','1');
1182	        	} else {
1183	        		$('#nectar_fullscreen_rows > .wpb_row.last-before-footer').css('transform','translateY(0px)');
1184	        		$('#footer-outer').css('opacity','0');
1185	        	}
1186	        	if($indexRow.attr('id') == 'footer-outer') {
1187	        		$('#footer-outer').css({'transition': $transformProp+' 460ms cubic-bezier(0.60, 0.23, 0.2, 
11870.93)', 'backface-visibility': 'hidden'});
1188	        		$('#footer-outer').css({'transform': 'translateY(45%) translateZ(0)'});
1189	        	}
1190	 			
1191
1192	 			//stacking fix
1193	 			if($nextIndexRow.attr('id') != 'footer-outer') {
1194					$nextIndexRowFpTable.find('.full-page-inner-wrap-outer > .full-page-inner-wrap > .full-page-inner > .container').css({'backface-visibility':'hidden', 'z-index':'110'});
1195				}
1196
1197	        	//animation
1198	        	if($nextIndexRow.attr('id') != 'footer-outer' && $indexRow.attr('id') != 'footer-outer' && $('#nectar_fullscreen_rows[data-animation="none"]').length == 0 ) {
1199
1200	        		//scrolling down
1201	        		if(direction == 'down') {
1202
1203	        			if($fpAnimation == 'parallax') {
1204		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'will-change':'transform', 'transform':'translateZ(0)' ,'z-index': '100'});
1205		        			setTimeout(function() { 
1206		        				$indexRow.css({'transform': 'translateY(-50%) translateZ(0)'});
1207		        			}, 60);
1208
1209		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1210		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
1211		        			$nextIndexRowInner.css({'transform':'translateY(-50%) translateZ(0)', 'will-change':'transform'});
1212		        			
1213	        			} else if($fpAnimation == 'zoom-out-parallax') {
1214
1215	        				$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'});
1216		        			setTimeout(function() { 
1217		        				$indexRow.css({'transform': 'scale(0.77) translateZ(0)', 'opacity': '0'});
1218		        			}, 60);
1219
1220		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1221		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
1222		        			$nextIndexRowInner.css({'transform':'translateY(-50%) translateZ(0)',  'will-change':'transform'});
1223	        			} 
1224	        			/*else if($fpAnimation == 'none') {
1225
1226	        				$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'z-index': '100'});
1227	        				$indexRow.css({'will-change':'transform'});
1228
1229		        			setTimeout(function() { 
1230		        				$indexRow.css({'transform': 'translateY(-100%) translateZ(0)'});
1231		        			}, 80);
1232
1233		        			$nextIndexRowFpTable.css({'transform':'translateY(100%) translateZ(0)', 'will-change':'transform'});
1234		        			setTimeout(function() { 
1235		        				$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1236		        			}, 30);
1237	        			}*/
1238	        		}
1239
1240	        		//scrolling up
1241	        		else {
1242
1243	        			if($fpAnimation == 'parallax') {
1244		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'z-index': '100', 'will-change':'transform'});
1245		        			setTimeout(function() { 
1246		        				$indexRow.css({'transform': 'translateY(50%) translateZ(0)'});
1247		        			}, 60);
1248
1249		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1250		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)','will-change':'transform'});
1251		        			$nextIndexRowInner.css({'transform':'translateY(50%) translateZ(0)','will-change':'transform'});
1252	        			}
1253
1254	        			else if($fpAnimation == 'zoom-out-parallax') {
1255		        			$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'});
1256		        			setTimeout(function() { 
1257		        				$indexRow.css({'transform': 'scale(0.77) translateZ(0)', 'opacity': '0'});
1258		        			}, 60);
1259
1260		        			$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1261		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)', 'will-change':'transform'});
1262		        			$nextIndexRowInner.css({'transform':'translateY(50%) translateZ(0)', 'will-change':'transform'});
1263	        			} 
1264	        			/*else if($fpAnimation == 'none') {
1265		        			$indexRow.css({'transition': $transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1)', 'z-index': '100'});
1266		        			$indexRow.css({'will-change':'transform'});
1267
1268		        			setTimeout(function() { 
1269		        				$indexRow.css({'transform': 'translateY(100%) translateZ(0)'});
1270		        			}, 80);
1271
1272		        			$nextIndexRowFpTable.css({'transform':'translateY(-100%) translateZ(0)', 'will-change':'transform'});
1273		        			setTimeout(function() { 
1274		        				$nextIndexRow.css({'z-index':'1000','top':'0','left':'0'});
1275		        			}, 30);
1276	        			}*/
1277	        			
1278	        			
1279	        		}
1280	        		
1281	        		setTimeout(function() { 
1282	    				$nextIndexRowFpTable.css({'transition':$transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1) 0ms', 'transform':'translateY(0%) translateZ(0)'});
1283	    				if($fpAnimation != 'none') { 
1284									$nextIndexRowInner.css({'transition':$transformProp+' '+$fpAnimationSpeed+'ms cubic-bezier(.29,.23,.13,1) 0ms', 'transform':'translateY(0%) translateZ(0)'});
1285									if(navigator.userAgent.indexOf('Firefox') != -1) {
1286										requestAnimationFrame(heyFirefoxDrawTheEl);
1287									}
1288							}
1289							
1290							
1291
1292							
1293	    			},60);
1294
1295	        	}
1296
1297	        	//adjust transform if larger than row height for parallax
1298	        	if($('#nectar_fullscreen_rows[data-animation="none"]').length == 0 && $nextIndexRow.find('.fp-scrollable').length > 0) {
1299	        		$nextIndexRow.find('.full-page-inner-wrap-outer').css('height',overallHeight);
1300						}
1301
1302	        	setTimeout(function() { 
1303	        		
1304	        		if( $row_id == 'footer-outer') {
1305
1306		        		$indexRow.css('transform','translateY(-'+($('#footer-outer').height()-1)+'px)');
1307
1308		        		$('#footer-outer').css({'transform': 'translateY(45%) translateZ(0)'});
1309		        		$('#footer-outer').css({'transition-duration': '0s', 'backface-visibility': 'hidden'});
1310		        		setTimeout(function() { 
1311		        			$('#footer-outer').css({'transition': $transformProp+' 500ms cubic-bezier(0.60, 0.23, 0.2, 0.93)', 'backface-visibility': 'hidden'});
1312	        				$('#footer-outer').css({'transform': 'translateY(0%) translateZ(0)'});
1313	        			},30);
1314		        	}
1315	        	},30);
1316
1317	        	if($row_id!='footer-outer') {
1318	        		
1319	        		stopMouseParallax();
1320
1321	        		//take care of nav/control coloring
1322	        		setFPNavColoring(nextIndex,direction);
1323							
1324							//handle main nav link highlight
1325							setTimeout(function(){
1326								FPActiveMenuItems(nextIndex);
1327							},50);
1328							
1329							
1330	        	}
1331	        		
1332	        },
1333
1334	        afterResize: function(){
1335	        	overallHeight = $('#nectar_fullscreen_rows').height();
1336	        	overallWidth = $(window).width();
1337	        	fullHeightRowOverflow();
1338	        	fullscreenElementSizing();
1339	        	fullscreenFooterCalcs();
1340
1341	        	if( $('#footer-outer.active').length > 0) {
1342	        		setTimeout(function(){
1343	        			$('.last-before-footer').css('transform','translateY(-'+$('#footer-outer').height()+'px)');
1344	        		},200);
1345		        } 
1346
1347		        //fix for svg animations when resizing and iscroll wraps/unwraps
1348		        clearTimeout($svgResizeTimeout);
1349		        $svgResizeTimeout = setTimeout(function(){ 
1350
1351		        	if($svg_icons.length > 0) {
1352			        	$('.svg-icon-holder.animated-in').each(function(i){
1353									$(this).css('opacity','1');
1354									$svg_icons[$(this).find('svg').attr('id').slice(-1)].finish();
1355								});
1356			        }
1357
1358		         },300);
1359	        }
1360
1361		});
1362	}
1363	
1364	if($('#nectar_fullscreen_rows').length > 0) {
1365		initNectarFP();
1366	}
1367
1368
1369	$(window).smartresize(function(){
1370		
1371		if($('#nectar_fullscreen_rows').length > 0) {
1372			setTimeout(function(){
1373				$('.wpb_row:not(.last-before-footer) .fp-scrollable').each(function(){
1374					$scrollable = $(this).data('iscrollInstance');
1375					$scrollable.refresh();
1376				});
1377			},200);
1378
1379			fullHeightRowOverflow();
1380
1381		}
1382	});
1383
1384	function fullscreenFooterCalcs() {
1385		if($('#footer-outer.active').length > 0) {
1386	    		$('.last-before-footer').addClass('fp-notransition').css('transform','translateY(-'+$('#footer-outer').height()+'px)');
1387	    		setTimeout(function(){
1388	    			$('.last-before-footer').removeClass('fp-notransition');
1389	    		},10);
1390	    	}
1391	}
1392
1393
1394
1395	function stopMouseParallax(){
1396		$.each($mouseParallaxScenes,function(k,v){
1397			v.parallax('disable');
1398		});
1399	}
1400
1401	function startMouseParallax(){
1402		if($('#nectar_fullscreen_rows > .wpb_row.active .nectar-parallax-scene').length > 0) {
1403			$.each($mouseParallaxScenes,function(k,v){
1404				v.parallax('enable');
1405			});
1406		}
1407	}
1408
1409	if($('#nectar_fullscreen_rows').length > 0) {
1410		setFPNavColoring(1,'na');
1411		fullscreenElementSizing();
1412		
1413		//slide out right OCM material nav compat
1414		if($('body[data-slide-out-widget-area-style="slide-out-from-right"].material').length > 0) {
1415			$('#slide-out-widget-area .off-canvas-menu-container').find("a[href*='#']").click(function(e){
1416					
1417					var $link_hash = $(this).prop("hash");	
1418
1419					if($link_hash != '#' && $link_hash.indexOf("#") != -1 && $('div[data-fullscreen-anchor-id="'+$link_hash.substr($link_hash.indexOf("#")+1)+'"]').length > 0) {
1420						
1421							if($('body.material-ocm-open').length > 0) {
1422									
1423									$('body > .slide_out_area_close').addClass('non-human-allowed').trigger('click');
1424
1425									setTimeout(function(){
1426										$('body > .slide_out_area_close').removeClass('non-human-allowed');
1427									},100);
1428
1429							} 
1430							
1431					} // if a section has been found
1432					
1433			}); //click
1434		}
1435		
1436		
1437	}
1438	
1439	function FPActiveMenuItems(index) {
1440		
1441		if(!$('#nectar_fullscreen_rows[data-anchors="on"]').length > 0 || !index) return;
1442		
1443		var $hash = window.location.hash;
1444		var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1,$hash.length) : '';
1445
1446		 if($('body:not(.mobile) #header-outer[data-has-menu="true"]').length > 0 && $('#nectar_fullscreen_rows > .wpb_row:nth-child('+index+')[data-fullscreen-anchor-id]').length > 0 && $('header#top nav > ul.sf-menu > li').find('> a[href$="#'+$hashSubstrng+'"]').length > 0 ) {
1447			  $('header#top nav > ul.sf-menu > li').removeClass('current-menu-item');
1448				$('header#top nav > ul.sf-menu > li').find('> a[href$="'+$hashSubstrng+'"]').parent().addClass('current-menu-item');
1449		 } 
1450	}
1451
1452	function resetWaypoints() {
1453		//animated columns / imgs
1454		$('img.img-with-animation.animated-in:not([data-animation="none"])').css({'transition':'none'});
1455		$('img.img-with-animation.animated-in:not([data-animation="none"])').css({'opacity':'0','transform':'none'}).removeClass('animated-in');
1456		$('.col.has-animation.animated-in:not([data-animation*="reveal"]), .wpb_column.has-animation.animated-in:not([data-animation*="reveal"])').css({'transition':'none'});
1457		$('.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');	
1458		$('.col.has-animation.boxed:not([data-animation*="reveal"]), .wpb_column.has-animation.boxed:not([data-animation*="reveal"])').addClass('no-pointer-events');
1459
1460		//reveal columns
1461		$('.wpb_column.has-animation[data-animation*="reveal"], .nectar_cascading_images').removeClass('animated-in');
1462		if(overallWidth > 1000 && $('.using-mobile-browser').length == 0) {
1463			$('.wpb_column.has-animation[data-animation="reveal-from-bottom"] > .column-inner-wrap').css({'transition':'none','transform':'translate(0, 100%)'});
1464			$('.wpb_column.has-animation[data-animation="reveal-from-bottom"] > .column-inner-wrap > .column-inner').css({'transition':'none','transform':'translate(0, -90%)'});
1465			$('.wpb_column.has-animation[data-animation="reveal-from-top"] > .column-inner-wrap').css({'transition':'none','transform':'translate(0, -100%)'});
1466			$('.wpb_column.has-animation[data-animation="reveal-from-top"] > .column-inner-wrap > .column-inner').css({'transition':'none','transform':'translate(0, 90%)'});
1467			$('.wpb_column.has-animation[data-animation="reveal-from-left"] > .column-inner-wrap').css({'transition-duration':'0s','transform':'translate(-100%, 0)'});
1468			$('.wpb_column.has-animation[data-animation="reveal-from-left"] > .column-inner-wrap > .column-inner').css({'transition-duration':'0s','transform':'translate(90%, 0)'});
1469			$('.wpb_column.has-animation[data-animation="reveal-from-right"] > .column-inner-wrap').css({'transition-duration':'0s','transform':'translate(100%, 0)'});
1470			$('.wpb_column.has-animation[data-animation="reveal-from-right"] > .column-inner-wrap > .column-inner').css({'transition-duration':'0s','transform':'translate(-90%, 0)'});
1471		}
1472		$('.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');
1473
1474		//vcwaypoints
1475		$('.wpb_animate_when_almost_visible.animated').removeClass('wpb_start_animation').removeClass('animated');
1476
1477		//column borders
1478		$('.wpb_column[data-border-animation="true"] .border-wrap.animation').removeClass('animation').removeClass('completed');
1479
1480		//milestone
1481		$('.nectar-milestone.animated-in').removeClass('animated-in').removeClass('in-sight');
1482		$('.nectar-milestone .symbol').removeClass('in-sight');
1483
1484		//fancy ul
1485		$('.nectar-fancy-ul[data-animation="true"]').removeClass('animated-in');
1486		$('.nectar-fancy-ul[data-animation="true"] ul li').css({'opacity':'0','left':'-20px'});
1487
1488		//progress bars
1489		$('.nectar-progress-bar').parent().removeClass('completed');
1490		$('.nectar-progress-bar .bar-wrap > span').css({'width':'0px'});
1491		$('.nectar-progress-bar .bar-wrap > span > strong').css({'opacity':'0'});
1492		//$('.nectar-progress-bar .bar-wrap').css({'opacity':'0'});
1493
1494		//clients
1495		$('.clients.fade-in-animation').removeClass('animated-in');
1496		$('.clients.fade-in-animation > div').css('opacity','0');
1497
1498		//carousel
1499		$('.owl-carousel[data-enable-animation="true"]').removeClass('animated-in');
1500		$('.owl-carousel[data-enable-animation="true"] .owl-stage > .owl-item').css({'transition':'none','opacity':'0','transform':'translate(0, 70px)'});
1501		//dividers
1502		$('.divider-small-border[data-animate="yes"], .divider-border[data-animate="yes"]').removeClass('completed').css({'transition':'none','transform':'scale(0,1)'});
1503
1504		//icon list
1505		$('.nectar-icon-list').removeClass('completed');
1506		$('.nectar-icon-list-item').removeClass('animated');
1507
1508		//portfolio
1509		$('.portfolio-items .col').removeClass('animated-in');
1510
1511		//split line
1512		$('.nectar-split-heading').removeClass('animated-in');
1513		$('.nectar-split-heading .heading-line > div').transit({'y':'200%'},0);
1514
1515		//image with hotspots
1516		$('.nectar_image_with_hotspots[data-animation="true"]').removeClass('completed');
1517		$('.nectar_image_with_hotspots[data-animation="true"] .nectar_hotspot_wrap').removeClass('animated-in');
1518
1519		//animated titles
1520		$('.nectar-animated-title').removeClass('completed');
1521		
1522		//highlighted text
1523		$('.nectar-highlighted-text em').removeClass('animated');
1524
1525		if($('.vc_pie_chart').length > 0) {
1526			vc_pieChart();
1527		}
1528
1529		$('.col.has-animation:not([data-animation*="reveal"]), .wpb_column.has-animation:not([data-animation*="reveal"])').each(function(i) {
1530		   	//clear previous timeout (needed for fullscreen rows)
1531			clearTimeout($standAnimatedColTimeout[i]); 
1532		});
1533
1534	}
1535
1536	
1537
1538} else if($('#nectar_fullscreen_rows').length > 0 && $disableFPonMobile == 'on' || $().fullpage && $disableFPonMobile == 'on') {
1539
1540	//remove markup
1541	//$('#nectar_fullscreen_rows > div.wpb_row .row-bg-wrap').unwrap().unwrap().unwrap();
1542	//$('#nectar_fullscreen_rows > div.wpb_row:first-child').unwrap();
1543	$('html,body').css({'height':'auto','overflow-y':'auto'});
1544}
1545
1546
1547
1548/***************** Superfish ******************/
1549	
1550	function initSF(){
1551
1552		if($('body[data-header-format="left-header"]').length == 0) {
1553
1554
1555			$disableHI = ($('body[data-dropdown-style="minimal"]').length > 0 && !($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0) ) ? true : false;
1556
1557			$(".sf-menu").superfish({
1558				 delay: 650,
1559				 speed: 'fast',
1560				 disableHI: $disableHI,
1561				 speedOut:      'fast',             
1562				 animation:   {opacity:'show'}
1563			}); 
1564
1565			//handle initial show on left class for minimal styling
1566			$('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function(){
1567				
1568				if($(this).offset().left + $(this).outerWidth() > $(window).width()) {
1569					$(this).addClass('on-left-side');
1570					$(this).find('ul').addClass('on-left-side');
1571				} 
1572				
1573			});
1574			
1575
1576			//megamenu multi section per column title support
1577			$('body:not([data-header-format="left-header"]) header#top nav > ul > li.megamenu > ul > li > ul > li:has("> ul")').addClass('has-ul'); 
1578
1579			//fullwidth megamenu
1580			if($('body[data-megamenu-width="full-width"]').length > 0 && $('ul.sub-menu').length > 0) {
1581				megamenuFullwidth();
1582				$(window).on('smartresize',megamenuFullwidth);
1583				$('header#top nav > ul > li.megamenu > .sub-menu').css('box-sizing','content-box');
1584			}
1585
1586			//extra hover class for megamenu check
1587			$('header#top nav > ul.sf-menu > li').on('mouseenter',function(){
1588				$(this).addClass('menu-item-over');
1589			});
1590			$('header#top nav > ul.sf-menu > li').on('mouseleave',function(){
1591				$(this).removeClass('menu-item-over');
1592			});
1593
1594			//remove arrows on mega menu item
1595			$('header#top nav .megamenu .sub-menu a.sf-with-ul .sf-sub-indicator, header#top .megamenu .sub-menu a .sf-sub-indicator').remove();
1596
1597			//blank title megamenu columns
1598			////desktop
1599			$('header#top nav > ul > li.megamenu > ul.sub-menu > li > a').each(function(){
1600				if( $(this).text() == '–' ) {
1601					$(this).remove();
1602				}
1603			});
1604
1605		
1606		}
1607		
1608	}
1609
1610	
1611	function megamenuFullwidth() {
1612		var $windowWidth = $(window).width();
1613		var $headerContainerWidth = $('header#top > .container').width();
1614		$('header#top nav > ul > li.megamenu > .sub-menu').css({
1615			'padding-left' : ($windowWidth - $headerContainerWidth)/2 + 'px',
1616			'padding-right' : ($windowWidth+2 - $headerContainerWidth)/2 + 'px',
1617			'width' : $headerContainerWidth,
1618			'left' : '-' + ($windowWidth - $headerContainerWidth)/2 + 'px'
1619		});
1620	}
1621	
1622	var $navLeave;
1623	
1624	function addOrRemoveSF(){
1625		
1626		if( window.innerWidth < 1000 && $('body').attr('data-responsive') == '1'){
1627			$('body').addClass('mobile');
1628			$('header#top nav').css('display','none');
1629		}
1630		
1631		else {
1632			$('body').removeClass('mobile');
1633			$('header#top nav').css('display','');
1634			$('#mobile-menu').hide();
1635			$('.slide-out-widget-area-toggle #toggle-nav .lines-button').removeClass('close');
1636			
1637			//recalc height of dropdown arrow
1638			$('.sf-sub-indicator').css('height',$('a.sf-with-ul').height());
1639		}
1640
1641		//add specific class if on device for better tablet tracking
1642		if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) { $('body').addClass('using-mobile-browser'); }
1643
1644	}
1645
1646	function showOnLeftSubMenu() {
1647		//show on left class for minimal styling
1648		$('#header-outer .sf-menu > li:not(.megamenu) > ul > li > ul').each(function(){
1649			
1650			$(this).removeClass('on-left-side');
1651
1652			if($(this).offset().left + $(this).outerWidth() > $(window).width()) {
1653				$(this).addClass('on-left-side');
1654				$(this).find('ul').addClass('on-left-side');
1655			} else {
1656				$(this).removeClass('on-left-side');
1657				$(this).find('ul').removeClass('on-left-side');
1658			}
1659			
1660		});
1661	}
1662	
1663	addOrRemoveSF();
1664	initSF();
1665	
1666	$(window).resize(addOrRemoveSF);
1667
1668	
1669	function SFArrows(){
1670
1671		//set height of dropdown arrow
1672		$('.sf-sub-indicator').css('height',$('a.sf-with-ul').height());
1673	}
1674	
1675	SFArrows();
1676	
1677
1678	//deactivate hhun on phone
1679	if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
1680		$('body').attr('data-hhun','0');
1681
1682
1683/***************** Caroufredsel ******************/
1684	
1685	function standardCarouselInit() {
1686		$('ul.carousel:not(".clients")').each(function(){
1687	    	var $that = $(this); 
1688	    	var maxCols = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : 3 ;
1689	    	var scrollNum = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 'auto' : '' ;
1690	    	var colWidth = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true') ? 500 : 453 ;
1691	    	var scrollSpeed, easing;
1692	    	var $autoplayBool = ($(this).attr('data-autorotate') == 'true') ? true : false;
1693			
1694			if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
1695				if($(this).find('li').length % 3 === 0) {
1696					var $themeSkin = true;
1697					var $themeSkin2 = true;
1698				} else {
1699					var $themeSkin = false;
1700					var $themeSkin2 = true;
1701				}
1702	
1703			} else {
1704				var $themeSkin = true;
1705				var $themeSkin2 = true;
1706			}
1707
1708			(parseInt($(this).attr('data-scroll-speed'))) ? scrollSpeed = parseInt($(this).attr('data-scroll-speed')) : scrollSpeed = 700;
1709			($(this).is('[data-easing]')) ? easing = $(this).attr('data-easing') : easing = 'linear';
1710			
1711			
1712			var $element = $that;
1713			if($that.find('img').length == 0) $element = $('body');
1714			
1715			imagesLoaded($element,function(instance){
1716	
1717				
1718		    	$that.carouFredSel({
1719		    		circular: $themeSkin,
1720		    		infinite: $themeSkin2,
1721		    		height : 'auto',
1722		    		responsive: true,
1723			        items       : {
1724						width : colWidth,
1725				        visible     : {
1726				            min         : 1,
1727				            max         : maxCols
1728				        }
1729				    },
1730				    swipe       : {
1731				        onTouch     : true,
1732				        onMouse         : true,
1733				        options      : {
1734				        	excludedElements: "button, input, select, textarea, .noSwipe",
1735				        	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'); }
1736				        },
1737				        onBefore : function(){
1738				    		//hover effect fix
1739				    		$that.find('.work-item').trigger('mouseleave');
1740				    		$that.find('.work-item .work-info a').trigger('mouseup');
1741				    	}
1742				    },
1743				    scroll: {
1744				    	items			: scrollNum,
1745				    	easing          : easing,
1746			            duration        : scrollSpeed,
1747			            onBefore	: function( data ) {
1748			            	
1749			            	 if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
1750			            	 	$that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
1751
1752			            	 }	
1753						},
1754						onAfter	: function( data ) {
1755			            	 if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
1756			            	 	$that.parents('.carousel-wrap').find('.item-count .current').html( $that.triggerHandler('currentPage') +1);
1757			            	 	$that.parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($that.find('> li').length / $that.triggerHandler("currentVisible").length));
1758
1759			            	 }	
1760						}
1761
1762				    },
1763			        prev    : {
1764				        button  : function() {
1765				           return $that.parents('.carousel-wrap').find('.carousel-prev');
1766				        }
1767			    	},
1768				    next    : {
1769			       		button  : function() {
1770				           return $that.parents('.carousel-wrap').find('.carousel-next');
1771				        }
1772				    },
1773				    auto    : {
1774				    	play: $autoplayBool
1775				    }
1776			    }, { transition: true }).animate({'opacity': 1},1300);
1777			    
1778			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1779
1780			    if($that.parents('.carousel-wrap').attr('data-full-width') == 'true') $that.parents('.carousel-outer').css('overflow','visible');
1781
1782			    //add count for non full width ascend skin
1783			    if($('body.ascend').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true' || $('body.material').length > 0 && $that.parents('.carousel-wrap').attr('data-full-width') != 'true') {
1784					$('<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'));
1785				}
1786			    
1787			    $that.addClass('finished-loading');
1788
1789			    carouselHeightCalcs();
1790
1791				
1792			    
1793		     });//images loaded
1794		     	     
1795	    });//each
1796
1797		
1798    }
1799    if($('.carousel').length > 0) standardCarouselInit();
1800
1801
1802    function owlCarouselInit() {
1803    	//owl
1804		$('.owl-carousel').each(function(){
1805			
1806			$(this).addClass('owl-theme'); //new version removed this
1807			
1808			var $that = $(this);
1809			var $stagePadding = ($(window).width()<1000) ? 0 : parseInt($(this).attr('data-column-padding'));
1810			var $autoRotateBool = $that.attr('data-autorotate');
1811			var $autoRotateSpeed = $that.attr('data-autorotation-speed');
1812			var $owlLoopBool = ($that.is('[data-loop="true"]')) ? true : false;
1813			
1814			$(this).owlCarousel({
1815			      responsive:{
1816				        0:{
1817				            items: $(this).attr('data-mobile-cols')
1818				        },
1819				        690:{
1820				            items: $(this).attr('data-tablet-cols')
1821				        },
1822				        1000:{
1823				          items: $(this).attr('data-desktop-small-cols')
1824				        },
1825				        1300:{
1826				            items: $(this).attr('data-desktop-cols')
1827				        }
1828				    },
1829			      /*stagePadding: $stagePadding,*/
1830			      autoplay: $autoRotateBool,
1831			      autoplayTimeout: $autoRotateSpeed,
1832						loop: $owlLoopBool,
1833						smartSpeed: 350,
1834			      onTranslate: function(){
1835			      	$that.addClass('moving');
1836			      },
1837			      onTranslated: function(){
1838			      	$that.removeClass('moving');
1839			      }
1840
1841			  });
1842
1843			$(this).on('changed.owl.carousel', function (event) {
1844			    if (event.item.count - event.page.size == event.item.index)
1845			        $(event.target).find('.owl-dots div:last')
1846			          .addClass('active').siblings().removeClass('active');
1847			});	
1848
1849		});	
1850
1851
1852    }
1853
1854
1855
1856	function owl_carousel_animate() {
1857		$($fullscreenSelector+'.owl-carousel[data-enable-animation="true"]').each(function(){
1858
1859			$owlOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
1860
1861			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;
1862
1863			var $that = $(this);
1864			var waypoint = new Waypoint({
1865	 			element: $that,
1866	 			 handler: function(direction) {
1867
1868	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
1869					     waypoint.destroy();
1870					     return;
1871					}
1872
1873					setTimeout(function(){
1874		 			 	$that.find('.owl-stage > .owl-item').each(function(i){
1875		 			 		var $that = $(this);
1876							$that.delay(i*200).transition({
1877								'opacity': '1',
1878								'y' : '0'
1879							},600,'easeOutQuart');
1880						});
1881						$that.addClass('animated-in');
1882		 			 },$animationDelay);
1883
1884					waypoint.destroy();
1885				},
1886				offset: $owlOffsetPos
1887
1888			}); 
1889
1890		});
1891	}
1892
1893
1894
1895
1896    function productCarouselInit() {
1897		$('.products-carousel').each(function(){
1898	    	var $that = $(this).find('ul'); 
1899	    	var maxCols = 'auto';
1900	    	var scrollNum = 'auto';
1901	    	var colWidth = ($(this).parents('.full-width-content ').length > 0) ? 400 : 353 ;
1902			var scrollSpeed = 800;
1903			var easing = 'easeInOutQuart';
1904			
1905			
1906			var $element = $that;
1907			if($that.find('img').length == 0) $element = $('body');
1908			
1909			//controls on hover
1910			$(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>')
1911
1912			imagesLoaded($element,function(instance){
1913	
1914				
1915		    	$that.carouFredSel({
1916		    		circular: true,
1917		    		responsive: true,
1918			        items       : {
1919						width : colWidth,
1920				        visible     : {
1921				            min         : 1,
1922				            max         : maxCols
1923				        }
1924				    },
1925				    swipe       : {
1926				        onTouch     : true,
1927				        onMouse         : true,
1928				        options      : {
1929				        	excludedElements: "button, input, select, textarea, .noSwipe",
1930				        	tap: function(event, target){ 
1931				        		if($(target).attr('href') && !$(target).is('[target="_blank"]') && !$(target).hasClass('add_to_wishlist') && !$(target).hasClass('add_to_cart_button') && !$(target).is('[rel^="prettyPhoto"]')) 
1932				        			window.open($(target).attr('href'), '_self'); 
1933				        		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"]')) 
1934				        			window.open($(target).parent().attr('href'), '_self'); 
1935				        	}
1936				        },
1937				        onBefore : function(){
1938				    		//hover effect fix
1939				    		$that.find('.product-wrap').trigger('mouseleave');
1940				    		$that.find('.product a').trigger('mouseup');
1941				    	}
1942				    },
1943				    scroll: {
1944				    	items			: scrollNum,
1945				    	easing          : easing,
1946			            duration        : scrollSpeed
1947				    },
1948			        prev    : {
1949				        button  : function() {
1950				           return $that.parents('.carousel-wrap').find('.carousel-prev');
1951				        }
1952			    	},
1953				    next    : {
1954			       		button  : function() {
1955				           return $that.parents('.carousel-wrap').find('.carousel-next');
1956				        }
1957				    },
1958				    auto    : {
1959				    	play: false
1960				    }
1961			    }).animate({'opacity': 1},1300);
1962			    
1963			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
1964			    
1965			    $that.addClass('finished-loading');
1966			    fullWidthContentColumns();
1967			    $(window).trigger('resize');
1968
1969		     });//images loaded
1970				 
1971		     	     
1972	    });//each
1973			
1974			
1975			
1976			var $wooFlickityCarousels = [];
1977			
1978			$('.nectar-woo-flickity').each(function(i){
1979				
1980				var $that = $(this);
1981
1982				$(this).find('.products > li').each(function(){
1983					$(this).wrap('<div class="flickity-cell"></div>');
1984				});
1985				
1986				fullWidthSections();
1987				
1988				var pageDotsBool = ($that.is('[data-controls="bottom-pagination"]')) ? true : false;
1989				var arrowsBool = ($that.is('[data-controls="bottom-pagination"]')) ? false : true;
1990				var $autoplay = ( $that.is('[data-autorotate-speed]') && parseInt( $that.attr('data-autorotate-speed') ) > 800) ? parseInt($that.attr('data-autorotate-speed')) : 5000;
1991				if(!$that.is('[data-autorotate="true"]')) { $autoplay = false; }
1992				
1993				$wooFlickityCarousels[i] = $(this).find('ul');
1994				
1995				if(arrowsBool == true) {
1996					$wooFlickityCarousels[i].on( 'ready.flickity', function() {
1997						var flickityPrv = $that.find('.flickity-prev-next-button.previous').detach();
1998	 				  var flickityNxt = $that.find('.flickity-prev-next-button.next').detach();
1999						
2000						$that.find('.nectar-woo-carousel-top').append(flickityPrv).append(flickityNxt);
2001				  });
2002				}
2003				
2004				$wooFlickityCarousels[i].flickity({
2005					 draggable: true,
2006					 lazyLoad: false,
2007					 imagesLoaded: true,
2008					 cellAlign: 'left',
2009					 groupCells: pageDotsBool,
2010					 prevNextButtons: arrowsBool,
2011					 pageDots: pageDotsBool,
2012					 resize: true,
2013					 percentPosition: true,
2014					 setGallerySize: true,
2015					 wrapAround: true,
2016					 autoPlay: $autoplay,
2017					 accessibility: false
2018				 });
2019				 
2020				 
2021				 //mobile pagination numbers
2022				 if(arrowsBool == true) {
2023					 
2024					 	$that.find('.flickity-prev-next-button').append('<svg width="65px" height="65px" viewBox="0 0 72 72" xmlns="http://www.w3.org/2000/svg"><circle stroke-width="3" fill="none" stroke-linecap="round" cx="33" cy="33" r="28"></circle> <circle class="time" stroke-width="3" fill="none" stroke-linecap="round" cx="33" cy="33" r="28"></circle></svg>');
2025					 
2026						var $wooFlickityCount = $('<div class="woo-flickity-count" />');
2027						$that.append($wooFlickityCount);
2028						var $wooFlickityData = $wooFlickityCarousels[i].data('flickity');
2029						
2030						function updateWooFlickityCount() {
2031						  var slideNumber = $wooFlickityData.selectedIndex + 1;
2032						  $wooFlickityCount.text( slideNumber + '/' + $wooFlickityData.slides.length );
2033						}
2034						updateWooFlickityCount();
2035						$wooFlickityCarousels[i].on( 'select.flickity', updateWooFlickityCount );
2036				 }
2037				 
2038				 
2039				 
2040				 
2041				 
2042				
2043			});
2044			
2045			
2046    }
2047    if($('.products-carousel').length > 0 || $('.nectar-woo-flickity').length > 0) productCarouselInit();
2048
2049
2050
2051
2052    
2053    //fullwidth carousel swipe link fix
2054    function fwCarouselLinkFix() {
2055	    var $mousePosStart = 0;
2056	    var $mousePosEnd = 0;
2057	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').mousedown(function(e){
2058	    	$mousePosStart = e.clientX;
2059	    });
2060	    
2061	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').mouseup(function(e){
2062	    	$mousePosEnd = e.clientX;
2063	    });
2064	    
2065	    $('.carousel-wrap .portfolio-items .col .work-item .work-info a, .woocommerce .products-carousel ul.products li.product a').click(function(e){
2066	    	if(Math.abs($mousePosStart - $mousePosEnd) > 10)  return false;
2067	    });
2068	}
2069	fwCarouselLinkFix();
2070    
2071     
2072	function carouselHeightCalcs(){
2073		
2074		//recent work carousel
2075		$('.carousel.portfolio-items.finished-loading').each(function(){
2076
2077			var bottomSpace = ($(this).parents('.carousel-wrap').attr('data-full-width') == 'true' && $(this).find('.style-2, .style-3, .style-4').length > 0) ? 0 : 28 ;
2078			
2079			var tallestMeta = 0;
2080			
2081			$(this).find('> li').each(function(){
2082				($(this).find('.work-meta').height() > tallestMeta) ? tallestMeta = $(this).find('.work-meta').height() : tallestMeta = tallestMeta;
2083			});	
2084    	 
2085     		$(this).parents('.caroufredsel_wrapper').css({
2086     			'height' : ($(this).find('.work-item').outerHeight() + tallestMeta + bottomSpace -2) + 'px'
2087     		});
2088
2089     		 if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
2090        	 	$(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition")+1)/$(this).triggerHandler("currentVisible").length));
2091        	 	$(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length));
2092        	 }	
2093   	  	});
2094   	  	
2095   	  	//standard carousel
2096   	  	$('.carousel.finished-loading:not(".portfolio-items, .clients"), .caroufredsel_wrapper .products.finished-loading').each(function(){
2097			
2098			var tallestColumn = 0;
2099			
2100			$(this).find('> li').each(function(){
2101				($(this).height() > tallestColumn) ? tallestColumn = $(this).height() : tallestColumn = tallestColumn;
2102			});	
2103
2104         	$(this).css('height',tallestColumn + 5);
2105         	$(this).parents('.caroufredsel_wrapper').css('height',tallestColumn + 5);
2106
2107         	 if($('body.ascend').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true' || $('body.material').length > 0 && $(this).parents('.carousel-wrap').attr('data-full-width') != 'true') {
2108        	 	$(this).parents('.carousel-wrap').find('.item-count .current').html(Math.ceil(($(this).triggerHandler("currentPosition")+1)/$(this).triggerHandler("currentVisible").length));
2109        	 	$(this).parents('.carousel-wrap').find('.item-count .total').html(Math.ceil($(this).find('> li').length / $(this).triggerHandler("currentVisible").length));
2110        	 }	
2111			
2112   	  	});
2113   	  	
2114	}
2115
2116
2117	function clientsCarouselInit(){
2118	     $('.carousel.clients').each(function(){
2119	    	var $that = $(this);
2120	    	var columns; 
2121	    	var $autoRotate = (!$(this).hasClass('disable-autorotate')) ? true : false;
2122	    	(parseInt($(this).attr('data-max'))) ? columns = parseInt($(this).attr('data-max')) : columns = 5;
2123	    	if($(window).width() < 690 && $('body').attr('data-responsive') == '1') { columns = 2; $(this).addClass('phone') }
2124	    	
2125	    	var $element = $that;
2126			if($that.find('img').length == 0) $element = $('body');
2127			
2128			imagesLoaded($element,function(instance){
2129	    		
2130		    	$that.carouFredSel({
2131			    		circular: true,
2132			    		responsive: true, 
2133				        items       : {
2134							
2135							height : $that.find('> div:first').height(),
2136							width  : $that.find('> div:first').width(),
2137					        visible     : {
2138					            min         : 1,
2139					            max         : columns
2140					        }
2141					    },
2142					    swipe       : {
2143					        onTouch     : true,
2144					        onMouse         : true
2145					    },
2146					    scroll: {
2147					    	items           : 1,
2148					    	easing          : 'easeInOutCubic',
2149				            duration        : '800',
2150				            pauseOnHover    : true
2151					    },
2152					    auto    : {
2153					    	play            : $autoRotate,
2154					    	timeoutDuration : 2700
2155					    }
2156			    }).animate({'opacity': 1},1300);
2157			    
2158			    $that.addClass('finished-loading');
2159
2160			    $that.parents('.carousel-wrap').wrap('<div class="carousel-outer">');
2161			     
2162
2163			    $(window).trigger('resize');
2164			    
2165		    
2166		    });
2167	
2168	    });
2169    }
2170   if($('.carousel').length > 0)  clientsCarouselInit();
2171    
2172
2173    function clientsCarouselHeightRecalc(){
2174
2175    	var tallestImage = 0;
2176		  			
2177    	 $('.carousel.clients.finished-loading').each(function(){
2178    	 	
2179    	 	$(this).find('> div').each(function(){
2180				($(this).height() > tallestImage) ? tallestImage = $(this).height() : tallestImage = tallestImage;
2181			});	
2182    	 	
2183         	$(this).css('height',tallestImage);
2184         	$(this).parent().css('height',tallestImage);
2185         });
2186    }
2187
2188
2189    //carousel grabbing class
2190    function carouselfGrabbingClass() {
2191	    $('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(){
2192	    	$(this).addClass('active');
2193	    });
2194	    
2195	    $('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(){
2196	    	$(this).removeClass('active');
2197	    });
2198	}
2199	carouselfGrabbingClass();
2200	    
2201
2202	//ascend arrow hover class
2203	$('body.ascend, body.material').on('mouseover','.carousel-next',function(){
2204		$(this).parent().find('.carousel-prev, .item-count').addClass('next-hovered');
2205	});
2206	$('body.ascend, body.material').on('mouseleave','.carousel-next',function(){
2207		$(this).parent().find('.carousel-prev, .item-count').removeClass('next-hovered');
2208	});
2209
2210	//fadein for clients / carousels
2211	function clientsFadeIn() {
2212
2213		$clientsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? 100: 'bottom-in-view';
2214		$($fullscreenSelector+'.clients.fade-in-animation').each(function() {
2215
2216			var $that = $(this);
2217			var waypoint = new Waypoint({
2218 			element: $that,
2219 			 handler: function(direction) {
2220				
2221				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
2222					 waypoint.destroy();
2223					return;
2224				}
2225
2226				 $that.find('> div').each(function(i){
2227					$(this).delay(i*80).transition({'opacity':"1"},450);
2228				});
2229				
2230				
2231				//add the css transition class back in after the aniamtion is done
2232				setTimeout(function(){ $that.addClass('completed'); },($that.find('> div').length*80) + 450);
2233			
2234
2235				$that.addClass('animated-in');
2236				waypoint.destroy();
2237			},
2238			offset: $clientsOffsetPos
2239
2240			}); 
2241		}); 
2242	}
2243	 
2244	//if($('.nectar-box-roll').length == 0) clientsFadeIn();
2245	
2246	
2247/*-------------------------------------------------------------------------*/
2248/*	2.	Helper Functions
2249/*-------------------------------------------------------------------------*/
2250
2251	jQuery.fn.setCursorPosition = function(position){
2252	    if(this.lengh == 0) return this;
2253	    return $(this).setSelection(position, position);
2254	}
2255	
2256	jQuery.fn.setSelection = function(selectionStart, selectionEnd) {
2257	    if(this.lengh == 0) return this;
2258	    input = this[0];
2259	
2260	    if (input.createTextRange) {
2261	        var range = input.createTextRange();
2262	        range.collapse(true);
2263	        range.moveEnd('character', selectionEnd);
2264	        range.moveStart('character', selectionStart);
2265	        range.select();
2266	    } else if (input.setSelectionRange) {
2267	        input.focus();
2268	        input.setSelectionRange(selectionStart, selectionEnd);
2269	    }
2270	
2271	    return this;
2272	}
2273	
2274	
2275
2276	$.extend($.expr[':'], {
2277	    transparent: function(elem, i, attr){
2278	      return( $(elem).css("opacity") === "0" );
2279	    }
2280	});
2281	
2282
2283	function getQueryParams(qs) {
2284	    qs = qs.split("+").join(" ");
2285	    var params = {},
2286	        tokens,
2287	        re = /[?&]?([^=]+)=([^&]*)/g;
2288
2289	    while (tokens = re.exec(qs)) {
2290	        params[decodeURIComponent(tokens[1])]
2291	            = decodeURIComponent(tokens[2]);
2292	    }
2293
2294	    return params;
2295	}
2296
2297	var $_GET = getQueryParams(document.location.search);
2298
2299	
2300	//count
2301	var CountUp = function(target, startVal, endVal, decimals, duration, options) {
2302
2303    // make sure requestAnimationFrame and cancelAnimationFrame are defined
2304    // polyfill for browsers without native support
2305    // by Opera engineer Erik Möller
2306    var lastTime = 0;
2307    var vendors = ['webkit', 'moz', 'ms', 'o'];
2308    for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
2309        window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
2310        window.cancelAnimationFrame =
2311          window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
2312    }
2313    if (!window.requestAnimationFrame) {
2314        window.requestAnimationFrame = function(callback, element) {
2315            var currTime = new Date().getTime();
2316            var timeToCall = Math.max(0, 16 - (currTime - lastTime));
2317            var id = window.setTimeout(function() { callback(currTime + timeToCall); },
2318              timeToCall);
2319            lastTime = currTime + timeToCall;
2320            return id;
2321        };
2322    }
2323    if (!window.cancelAnimationFrame) {
2324        window.cancelAnimationFrame = function(id) {
2325            clearTimeout(id);
2326        };
2327    }
2328
2329    var self = this;
2330
2331     // default options
2332    self.options = {
2333        useEasing : true, // toggle easing
2334        useGrouping : true, // 1,000,000 vs 1000000
2335        separator : ',', // character to use as a separator
2336        decimal : '.', // character to use as a decimal
2337        easingFn: null, // optional custom easing closure function, default is Robert Penner's easeOutExpo
vendor: 5,312 bytes, lines 2338-2482
2338        formattingFn: null // optional custom formatting function, default is self.formatNumber below
2339    };
2340    // extend default options with passed options object
2341    for (var key in options) {
2342        if (options.hasOwnProperty(key)) {
2343            self.options[key] = options[key];
2344        }
2345    }
2346    if (self.options.separator === '') { self.options.useGrouping = false; }
2347    if (!self.options.prefix) self.options.prefix = '';
2348    if (!self.options.suffix) self.options.suffix = '';
2349
2350    self.d = (typeof target === 'string') ? document.getElementById(target) : target;
2351    self.startVal = Number(startVal);
2352    self.endVal = Number(endVal);
2353    self.countDown = (self.startVal > self.endVal);
2354    self.frameVal = self.startVal;
2355    self.decimals = Math.max(0, decimals || 0);
2356    self.dec = Math.pow(10, self.decimals);
2357    self.duration = Number(duration) * 1000 || 2000;
2358
2359    self.formatNumber = function(nStr) {
2360        nStr = nStr.toFixed(self.decimals);
2361        nStr += '';
2362        var x, x1, x2, rgx;
2363        x = nStr.split('.');
2364        x1 = x[0];
2365        x2 = x.length > 1 ? self.options.decimal + x[1] : '';
2366        rgx = /(\d+)(\d{3})/;
2367        if (self.options.useGrouping) {
2368            while (rgx.test(x1)) {
2369                x1 = x1.replace(rgx, '$1' + self.options.separator + '$2');
2370            }
2371        }
2372        return self.options.prefix + x1 + x2 + self.options.suffix;
2373    };
2374    // Robert Penner's easeOutExpo
2375    self.easeOutExpo = function(t, b, c, d) {
2376        return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b;
2377    };
2378
2379    self.easingFn = self.options.easingFn ? self.options.easingFn : self.easeOutExpo;
2380    self.formattingFn = self.options.formattingFn ? self.options.formattingFn : self.formatNumber;
2381
2382    self.version = function () { return '1.7.1'; };
2383
2384    // Print value to target
2385    self.printValue = function(value) {
2386        var result = self.formattingFn(value);
2387
2388        if (self.d.tagName === 'INPUT') {
2389            this.d.value = result;
2390        }
2391        else if (self.d.tagName === 'text' || self.d.tagName === 'tspan') {
2392            this.d.textContent = result;
2393        }
2394        else {
2395            this.d.innerHTML = result;
2396        }
2397    };
2398
2399    self.count = function(timestamp) {
2400
2401        if (!self.startTime) { self.startTime = timestamp; }
2402
2403        self.timestamp = timestamp;
2404        var progress = timestamp - self.startTime;
2405        self.remaining = self.duration - progress;
2406
2407        // to ease or not to ease
2408        if (self.options.useEasing) {
2409            if (self.countDown) {
2410                self.frameVal = self.startVal - self.easingFn(progress, 0, self.startVal - self.endVal, self.duration);
2411            } else {
2412                self.frameVal = self.easingFn(progress, self.startVal, self.endVal - self.startVal, self.duration);
2413            }
2414        } else {
2415            if (self.countDown) {
2416                self.frameVal = self.startVal - ((self.startVal - self.endVal) * (progress / self.duration));
2417            } else {
2418                self.frameVal = self.startVal + (self.endVal - self.startVal) * (progress / self.duration);
2419            }
2420        }
2421
2422        // don't go past endVal since progress can exceed duration in the last frame
2423        if (self.countDown) {
2424            self.frameVal = (self.frameVal < self.endVal) ? self.endVal : self.frameVal;
2425        } else {
2426            self.frameVal = (self.frameVal > self.endVal) ? self.endVal : self.frameVal;
2427        }
2428
2429        // decimal
2430        self.frameVal = Math.round(self.frameVal*self.dec)/self.dec;
2431
2432        // format and print value
2433        self.printValue(self.frameVal);
2434
2435        // whether to continue
2436        if (progress < self.duration) {
2437            self.rAF = requestAnimationFrame(self.count);
2438        } else {
2439            if (self.callback) { self.callback(); }
2440        }
2441    };
2442    // start your animation
2443    self.start = function(callback) {
2444        self.callback = callback;
2445        self.rAF = requestAnimationFrame(self.count);
2446        return false;
2447    };
2448    // toggles pause/resume animation
2449    self.pauseResume = function() {
2450        if (!self.paused) {
2451            self.paused = true;
2452            cancelAnimationFrame(self.rAF);
2453        } else {
2454            self.paused = false;
2455            delete self.startTime;
2456            self.duration = self.remaining;
2457            self.startVal = self.frameVal;
2458            requestAnimationFrame(self.count);
2459        }
2460    };
2461    // reset to startVal so animation can be run again
2462    self.reset = function() {
2463        self.paused = false;
2464        delete self.startTime;
2465        self.startVal = startVal;
2466        cancelAnimationFrame(self.rAF);
2467        self.printValue(self.startVal);
2468    };
2469    // pass a new endVal and start animation
2470    self.update = function (newEndVal) {
2471        cancelAnimationFrame(self.rAF);
2472        self.paused = false;
2473        delete self.startTime;
2474        self.startVal = self.frameVal;
2475        self.endVal = Number(newEndVal);
2476        self.countDown = (self.startVal > self.endVal);
2477        self.rAF = requestAnimationFrame(self.count);
2478    };
2479
2480    // format startVal on initialization
2481    self.printValue(self.startVal);
2482};
2483	
2484var easeOutCubic = function(t, b, c, d) {
2485    return c*((t=t/d-1)*t*t + 1) + b;
2486};	
2487	
2488	
2489/*-------------------------------------------------------------------------*/
2490/*	3.	Shortcode Stuff
2491/*-------------------------------------------------------------------------*/
2492
2493
2494function vcWaypoints() {
2495	$($fullscreenSelector+' .wpb_animate_when_almost_visible').each(function() {
2496		  
2497			var $vcOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%';
2498
2499			var $that = $(this);
2500			var waypoint = new Waypoint({
2501	 			element: $that,
2502	 			 handler: function(direction) {
2503
2504	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 
2505					     waypoint.destroy();
2506					     return;
2507					}
2508	 				$that.addClass("animated");
2509	 				$that.addClass("wpb_start_animation");
2510	 				waypoint.destroy();
2511					
2512					if($that.is('.nectar-button') && $('body[data-button-style*="rounded_shadow"]').length > 0) {
2513						setTimeout(function(){
2514							$that.removeClass('wpb_start_animation');
2515						},1100);
2516					}
2517				
2518				},
2519				offset: $vcOffsetPos
2520
2521			}); 
2522
2523	});
2524}
2525			 
2526
2527/***************** Milestone Counter ******************/
2528	
2529	function milestoneInit() {
2530
2531		$('.nectar-milestone').each(function() {
2532			
2533			//symbol
2534			if($(this).is('[data-symbol]')) {
2535				if($(this).find('.symbol-wrap').length == 0) {
2536					if($(this).attr('data-symbol-pos') == 'before') {
2537						$(this).find('.number').prepend('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>');
2538					} else {
2539						$(this).find('.number').append('<div class="symbol-wrap"><span class="symbol">' + $(this).attr('data-symbol') + '</span></div>');
2540					}
2541				}
2542
2543				$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'));
2544			
2545				$(this).find('.symbol-wrap').css({'font-size': $symbol_size + 'px', 'line-height': $symbol_size + 'px'});
2546			}
2547
2548			$(this).find('.number').css({'font-size': $(this).find('.number').attr('data-number-size') +'px', 'line-height': $(this).find('.number').attr('data-number-size') + 'px'});
2549		});
2550		
2551		if(!$('body').hasClass('mobile') && $('.nectar-milestone').length > 0) {
2552			
2553
2554			//blur effect
2555			var $blurCssString = '';
2556			$($fullscreenSelector+'.nectar-milestone.motion_blur').each(function(i){
2557					
2558				$(this).addClass('instance-'+i);
2559
2560				var $currentColor = $(this).find('.number').css('color');
2561				var colorInt = parseInt($currentColor.substring(1),16);
2562		   		var R = (colorInt & 0xFF0000) >> 16;
2563		    	var G = (colorInt & 0x00FF00) >> 8;
2564		   		var B = (colorInt & 0x0000FF) >> 0;
2565		   		
2566		   		var $rgbaColorStart = 'rgba('+R+','+G+','+B+',0.2)';
2567				var $rgbaColorEnd = 'rgba('+R+','+G+','+B+',1)';
2568				var $numberSize = parseInt($(this).find('.number').attr('data-number-size'));
2569
2570				$blurCssString += '@keyframes motion-blur-number-'+i+' { ' +
2571				   ' 0% { '+
2572				   		'opacity: 0;'+
2573						'color: '+$rgbaColorStart+'; '+
2574   						'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+'; '+
2575    					'transform: translateZ(0px) translateY(-100%); '+
2576    					'-webkit-transform: translateZ(0px) translateY(-100%); '+
2577    				'} '+
2578    				'33% { opacity: 1 }' +
2579    				'100% { '+
2580						'color: '+$rgbaColorEnd+'; '+
2581   						'text-shadow: none; '+
2582    					'transform: translateZ(0px) translateY(0px); '+
2583    					'-webkit-transform: translateZ(0px) translateY(0px); '+
2584    				'} '+
2585    			'} '+
2586    			'@-webkit-keyframes motion-blur-number-'+i+' { ' +
2587				   ' 0% { '+
2588				  	    'opacity: 0;'+
2589						'color: '+$rgbaColorStart+'; '+
2590   						'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+'; '+
2591    					'transform: translateZ(0px) translateY(-100%); '+
2592    					'-webkit-transform: translateZ(0px) translateY(-100%); '+
2593    				'} '+
2594    				'33% { opacity: 1 }' +
2595    				'100% { '+
2596						'color: '+$rgbaColorEnd+'; '+
2597   						'text-shadow: none; '+
2598    					'transform: translateZ(0px) translateY(0px); '+
2599    					'-webkit-transform: translateZ(0px) translateY(0px); '+
2600    				'} '+
2601    			'} '+
2602    			'.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+'; } ';
2603    			
2604    			//separate each character into spans
2605    			$symbol = $(this).find('.symbol-wrap').clone();
2606    			$(this).find('.symbol-wrap').remove();
2607    			var characters = $(this).find('.number').text().split("");
2608    			$this = $(this).find('.number');
2609				$this.empty();
2610    			$.each(characters, function (i, el) {
2611				    $this.append("<span>" + el + "</span");
2612				});
2613
2614				//handle symbol
2615				if($(this).has('[data-symbol]')) {
2616	    			if($(this).attr('data-symbol-pos') == 'after') {
2617	    				$this.append($symbol);
2618	    			} else {
2619	    				$this.prepend($symbol);
2620	    			}
2621	    		}
2622				
2623			});
2624
2625			var head = document.head || document.getElementsByTagName('head')[0];
2626				var style = document.createElement('style');
2627
2628				style.type = 'text/css';
2629			if (style.styleSheet){
2630			  style.styleSheet.cssText = $blurCssString;
2631			} else {
2632			  style.appendChild(document.createTextNode($blurCssString));
2633			}
2634			$(style).attr('id','milestone-blur');
2635			$('head #milestone-blur').remove();
2636			head.appendChild(style);
2637
2638
2639			//activate
2640			milestoneWaypoint();
2641
2642		}
2643
2644	}
2645
2646	function milestoneWaypoint() {
2647		$($fullscreenSelector+'.nectar-milestone').each(function() {
2648			//animation
2649			
2650			var $offset = ($('#nectar_fullscreen_rows').length > 0) ? '250%' : '98%';
2651
2652			var $that = $(this);
2653			var waypoint = new Waypoint({
2654	 			element: $that,
2655	 			 handler: function(direction) {
2656
2657	 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
2658					     waypoint.destroy();
2659					     return;
2660					}
2661
2662	 			 	var $endNum = parseInt($that.find('.number span:not(.symbol)').text().replace(/,/g , ''));
2663
2664					if(!$that.hasClass('motion_blur')) {
2665
2666						var countOptions = { easingFn: easeOutCubic };
2667						var $countEle = $that.find('.number span:not(.symbol)')[0];
2668						var numAnim = new CountUp($countEle, 0, $endNum,0,2.2,countOptions);
2669						numAnim.start();
2670
2671					} else {
2672						$that.find('span').each(function(i){
2673							var $that = $(this);
2674							setTimeout(function(){ $that.addClass('in-sight'); },200*i);
2675						});
2676					}
2677
2678
2679					$that.addClass('animated-in');
2680					waypoint.destroy();
2681				},
2682				offset: $offset
2683
2684			}); 
2685
2686		}); 
2687	}
2688
2689	var $animationOnScrollTimeOut = ($('.nectar-box-roll').length > 0) ? 850: 125;	
2690	//if($('.nectar-box-roll').length == 0) setTimeout(function(){  milestoneInit(); },125); 
2691	
2692/***************** Tabbed ******************/
2693	
2694	$tabbedClickCount = 0;
2695	$('body').on('click','.tabbed > ul li:not(.cta-button) a',function(){
2696		var $id = $(this).parents('li').index()+1;
2697		
2698		if(!$(this).hasClass('active-tab') && !$(this).hasClass('loading')){
2699			$(this).parents('ul').find('a').removeClass('active-tab');
2700			$(this).addClass('active-tab');
2701			
2702			$(this).parents('.tabbed').find('> div:not(.clear)').css({'visibility':'hidden','position':'absolute','opacity':'0','left':'-9999px'});
2703			$(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').css({'visibility':'visible', 'position' : 'relative','left':'0','display':'block'}).stop().transition({'opacity':1},400);
2704			
2705			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); 
2706		}
2707		
2708		//waypoint checking
2709		if($tabbedClickCount != 0) {
2710			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-progress-bar').length > 0 ) 
2711				progressBars();
2712			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 ) 
2713				dividers();
2714			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('img.img-with-animation').length > 0 ||
2715			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.col.has-animation').length > 0  || 
2716			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar_cascading_images').length > 0  || 
2717			   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wpb_column.has-animation').length > 0 ) {
2718				colAndImgAnimations();
2719				cascadingImageBGSizing();
2720			}
2721			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-milestone').length > 0 ) 
2722				milestoneWaypoint();
2723			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar_image_with_hotspots[data-animation="true"]').length > 0 ) 
2724				imageWithHotspots();
2725			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-fancy-ul').length > 0 ) 
2726				nectar_fancy_ul_init();
2727			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-split-heading').length > 0 ) 
2728				splitLineHeadings();
2729			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wpb_column[data-border-animation="true"]').length > 0) {
2730				animatedColBorders();
2731			}
2732			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wpb_animate_when_almost_visible').length > 0) {
2733				vcWaypoints();
2734			}
2735			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-animated-title').length > 0) {
2736				animated_titles();
2737			}
2738			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-highlighted-text').length > 0) {
2739				highlighted_text();
2740			}
2741			if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar_food_menu_item').length > 0) {
2742				foodMenuItems();
2743			}
2744			if($(this).parents('.wpb_row').length > 0) {
2745				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.vc_pie_chart').length > 0  ||
2746				   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wp-video-shortcode').length > 0 ||
2747					 $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.post-area.masonry .posts-container').length > 0 ||
2748				   $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.twentytwenty-container').length > 0 ||
2749					 $(this).parents('#nectar_fullscreen_rows[data-content-overflow="scrollbar"]').length > 0 ||
2750					 $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.wpb_gallery').length > 0 ||
2751				   $(this).parents('.wpb_row').next().hasClass('parallax_section'))
2752					$(window).trigger('resize');
2753					
2754					
2755				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-flickity').length > 0 && typeof Flickity != 'undefined' ) {
2756					var tabbedFlkty = Flickity.data( $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-flickity')[0] );
2757					tabbedFlkty.resize();
2758				}
2759				
2760				if($(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-woo-flickity').length > 0 && typeof Flickity != 'undefined' ) {
2761					var wootabbedFlkty = Flickity.data( $(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.nectar-woo-flickity > ul')[0] );
2762					wootabbedFlkty.resize();
2763				}
2764				
2765			}
2766
2767			//svg icons
2768		
2769			$(this).parents('.tabbed').find('> div:nth-of-type('+$id+')').find('.svg-icon-holder').each(function(i){
2770				var $that = $(this);
2771
2772				setTimeout(function(){
2773
2774					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;
2775
2776					clearTimeout($animatedSVGIconTimeout[i]);
2777
2778					if($that.attr('data-animation') == 'false') { 
2779						$animationSpeed = 1;
2780						$that.css('opacity','1');
2781						$svg_icons[$that.find('svg').attr('id').slice(-1)].finish();
2782					} else {
2783						
2784						$svg_icons[$that.find('svg').attr('id').slice(-1)].reset();
2785						$animatedSVGIconTimeout[i] = setTimeout(function(){ $svg_icons[$that.find('svg').attr('id').slice(-1)].play(); },$animationDelay);
2786						
2787					}
2788				},150);
2789			});
2790
2791		}
2792
2793		//fix columns inside tabs
2794		$(this).parents('.tabbed').find('.wpb_row').each(function(){
2795			if( typeof $(this).find('[class*="vc_col-"]').first().offset() != 'undefined') {
2796				
2797				var $firstChildOffset = $(this).find('[class*="vc_col-"]').first().offset().left;
2798				$(this).find('[class*="vc_col-"]').each(function(){
2799					$(this).removeClass('no-left-margin');
2800					if($(this).offset().left < $firstChildOffset + 15) { 
2801						$(this).addClass('no-left-margin');
2802					} else {
2803						$(this).removeClass('no-left-margin');
2804					}
2805				});
2806			}
2807		});
2808
2809		$tabbedClickCount++;
2810
2811		//magic line
2812		if($(this).parent().parent().find('.magic-line').length > 0) {
2813			magicLineCalc($(this));
2814	     }
2815
2816		return false;
2817	});
2818
2819
2820	function magicLineCalc($ele) {
2821		var el, leftPos, ratio;
2822	    el = $ele.parent();
2823	    if (el.length) {
2824	        leftPos = el.position().left;
2825	        ratio = el.width();
2826	    } else {
2827	        leftPos = ratio = 0;
2828	    }
2829
2830	    $ele.parent().parent().find('.magic-line').css('transform', 'translateX(' + leftPos + 'px) scaleX(' + ratio + ')');
2831	}
2832	
2833	
2834	function tabbedInit(){ 
2835		$('.tabbed').each(function(){
2836			
2837			//handle icons
2838			$(this).find('.wpb_tab').each(function(i){
2839				
2840				if($(this).is('[data-tab-icon]') && $(this).attr('data-tab-icon').length > 0) {
2841					 $(this).parent().addClass('using-icons');
2842					 $(this).parent().find('.wpb_tabs_nav li:nth-child('+ (i+1) +') > a').prepend('<i class="'+$(this).attr("data-tab-icon")+'"></i>');
2843				}
2844			});
2845			
2846			//make sure the tabs don't have a nectar slider - we'll init this after the sliders load in that case
2847			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){
2848				$(this).find('> ul li:first-child a').click();
2849			}	
2850			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 ){
2851				var $that = $(this);
2852				
2853				$(this).find('.wpb_tab').show().css({'opacity':0,'height':'1px'});
2854				$(this).find('> ul li a').addClass('loading');
2855				
2856				setTimeout(function(){ 
2857					$that.find('.wpb_tab').hide().css({'opacity':1,'height':'auto'}); 
2858					$that.find('> ul li a').removeClass('loading');
2859					$that.find('> ul li:first-child a').click(); 
2860				},900);
2861			}
2862
2863			var $that = $(this);
2864			//minimal alt effect
2865			setTimeout(function(){
2866				if($that.is('[data-style="minimal_alt"]')) {
2867					$that.find('> ul').append('<li class="magic-line" />');
2868					 magicLineCalc($that.find('> ul > li:first-child > a'));
2869				}
2870			},100);
2871
2872
2873		});
2874	}
2875	tabbedInit();
2876
2877	//deep linking
2878	function tabbbedDeepLinking(){
2879		if(typeof $_GET['tab'] != 'undefined'){
2880			$('.wpb_tabs_nav').each(function(){
2881
2882				$(this).find('li').each(function(){
2883					var $currentText = $(this).find('a').text();
2884					var $getText = $_GET['tab'];
2885					var $that = $(this);
2886
2887					$currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
2888					$getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
2889
2890					if($currentText == $getText)  { 
2891
2892			          $(this).find('a').click(); 
2893			           setTimeout(function(){ 
2894			              $that.find('a').click(); 
2895			           },901);
2896			        }
2897				})
2898			});
2899		}
2900	}
2901	tabbbedDeepLinking();
2902
2903/***************** Toggle ******************/
2904	
2905	//toggles
2906	$('body').on('click','.toggle h3 a', function(){
2907	
2908		if(!$(this).parents('.toggles').hasClass('accordion')) { 
2909			$(this).parents('.toggle').find('> div').slideToggle(300);
2910			$(this).parents('.toggle').toggleClass('open');
2911			
2912			//switch icon
2913			if( $(this).parents('.toggle').hasClass('open') ){
2914				$(this).find('i').attr('class','icon-minus-sign');
2915			} else {
2916				$(this).find('i').attr('class','icon-plus-sign');
2917			}
2918
2919			if($(this).parents('.toggle').find('> div .iframe-embed').length > 0 && $(this).parents('.toggle').find('> div iframe.iframe-embed').height() == '0') responsiveVideoIframes();
2920			if($(this).parents('.full-width-content').length > 0) setTimeout(function(){ fullWidthContentColumns(); },300);
2921			if($('#nectar_fullscreen_rows').length > 0) setTimeout(function(){ $(window).trigger('smartresize'); },300);
2922			return false;
2923		}
2924	});
2925	
2926	//accordion
2927	$('body').on('click','.accordion .toggle h3 a', function(){
2928		
2929		if($(this).parents('.toggle').hasClass('open')) return false;
2930		
2931		$(this).parents('.toggles').find('.toggle > div').slideUp(300);
2932		$(this).parents('.toggles').find('.toggle h3 a i').attr('class','icon-plus-sign');
2933		$(this).parents('.toggles').find('.toggle').removeClass('open');
2934		
2935		$(this).parents('.toggle').find('> div').slideDown(300);
2936		$(this).parents('.toggle').addClass('open');
2937		
2938		//switch icon
2939		if( $(this).parents('.toggle').hasClass('open') ){
2940			$(this).find('i').attr('class','icon-minus-sign');
2941		} else {
2942			$(this).find('i').attr('class','icon-plus-sign');
2943		}
2944
2945		if($(this).parents('.full-width-content').length > 0) { 
2946			clearTimeout($t);
2947			var $t = setTimeout(function(){ fullWidthContentColumns(); },400);
2948		}
2949		if($('#nectar_fullscreen_rows').length > 0) {
2950			clearTimeout($t);
2951			var $t = setTimeout(function(){ $(window).trigger('smartresize'); },400);
2952		}
2953		
2954		return false;
2955	});
2956	
2957	//accordion start open
2958	function accordionInit(){ 
2959		$('.accordion').each(function(){
2960			$(this).find('> .toggle').first().addClass('open').find('> div').show();
2961			$(this).find('> .toggle').first().find('a i').attr('class','icon-minus-sign');
2962		});
2963		
2964		
2965		$('.toggles').each(function(){
2966			
2967			var $isAccordion = ($(this).hasClass('accordion')) ? true : false;
2968			
2969			$(this).find('.toggle').each(function(){
2970				if($(this).find('> div .testimonial_slider').length > 0 || $(this).find('> div iframe').length > 0) {
2971					var $that = $(this);
2972					$(this).find('> div').show().css({'opacity':0,'height':'1px', 'padding':'0'});
2973					
2974					testimonialHeightResize();
2975					
2976					setTimeout(function(){
2977						$that.find('> div').hide().css({'opacity':1,'height':'auto', 'padding':'10px 14px'}); 
2978						if($isAccordion == true && $that.index() == 0) $that.find('> div').slideDown(300);
2979					},900);
2980				} 
2981			});
2982		})
2983	}
2984	accordionInit();
2985
2986	//deep linking
2987	function accordionDeepLinking(){
2988		if(typeof $_GET['toggle'] != 'undefined'){
2989			$('.toggles').each(function(){
2990
2991				$(this).find('.toggle').each(function(){
2992					var $currentText = $(this).find('h3 a').clone();
2993					var $getText = $_GET['toggle'];
2994
2995					$($currentText).find('i').remove();
2996					$currentText = $currentText.text();
2997					$currentText = $currentText.replace(/\s+/g, '-').toLowerCase();
2998					$getText = $getText.replace(/\s+/g, '-').replace(/</g, '&lt;').replace(/"/g, '&quot;').toLowerCase();
2999
3000					if($currentText == $getText) $(this).find('h3 a').click();
3001				});
3002			});
3003		}
3004	}
3005	accordionDeepLinking();
3006
3007/***************** Button ******************/
3008	
3009	$.cssHooks.color = {
3010	    get: function(elem) {
3011	        if (elem.currentStyle)
3012	            var color = elem.currentStyle["color"];
3013	        else if (window.getComputedStyle)
3014	            var color = document.defaultView.getComputedStyle(elem,
3015	                null).getPropertyValue("color");
3016	        if (color.search("rgb") == -1)
3017	            return color;
3018	        else {
3019	            color = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
3020	            function hex(x) {
3021	                return ("0" + parseInt(x).toString(16)).slice(-2);
3022	            }
3023	            if(color) {
3024	            	return "#" + hex(color[1]) + hex(color[2]) + hex(color[3]);
3025	            }
3026	        }
3027	    }
3028	}
3029
3030	$.cssHooks.backgroundColor = {
3031	    get: function(elem) {
3032	        if (elem.currentStyle)
3033	            var bg = elem.currentStyle["backgroundColor"];
3034	        else if (window.getComputedStyle)
3035	            var bg = document.defaultView.getComputedStyle(elem,
3036	                null).getPropertyValue("background-color");
3037	        if (bg.search("rgb") == -1)
3038	            return bg;
3039	        else {
3040	            bg = bg.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
3041	            function hex(x) {
3042	                return ("0" + parseInt(x).toString(16)).slice(-2);
3043	            }
3044	            if(bg) {
3045	            	return "#" + hex(bg[1]) + hex(bg[2]) + hex(bg[3]);
3046	            }
3047	        }
3048	    }
3049	}
3050	
3051	function shadeColor(hex, lum) {
3052
3053	  // validate hex string
3054		hex = String(hex).replace(/[^0-9a-f]/gi, '');
3055		if (hex.length < 6) {
3056			hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];
3057		}
3058		lum = lum || 0;
3059
3060		// convert to decimal and change luminosity
3061		var rgb = "#", c, i;
3062		for (i = 0; i < 3; i++) {
3063			c = parseInt(hex.substr(i*2,2), 16);
3064			c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16);
3065			rgb += ("00"+c).substr(c.length);
3066		}
3067
3068		return rgb;
3069	}
3070
3071	//color
3072	function coloredButtons() {
3073		$('.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(){
3074			
3075			var $usingMaterialSkin = ($('body.material[data-button-style^="rounded"]').length > 0) ? true : false;
3076			$(this).css('visibility','visible');
3077			
3078			if($(this).hasClass('see-through-3') && $(this).attr('data-color-override') == 'false') {
3079				return true;
3080			}
3081			//if($(this).attr('data-color-override') != 'false'){
3082
3083				if($(this).attr('data-color-override') != 'false') {
3084					var $color = $(this).attr('data-color-override') ;
3085				} else {
3086					if($(this).parents('.dark').length > 0) 
3087						var $color = '#000000';
3088					else 
3089						var $color = '#ffffff';
3090				}
3091
3092				if(!$(this).hasClass('see-through-3')) $(this).css('color',$color);
3093				$(this).find('i').css('color',$color);
3094				
3095				var colorInt = parseInt($color.substring(1),16);
3096				var $hoverColor = ($(this).has('[data-hover-color-override]')) ? $(this).attr('data-hover-color-override') : 'no-override';
3097				var $hoverTextColor = ($(this).has('[data-hover-text-color-override]')) ? $(this).attr('data-hover-text-color-override') : '#fff';
3098				
3099		   		var R = (colorInt & 0xFF0000) >> 16;
3100		    	var G = (colorInt & 0x00FF00) >> 8;
3101		   		var B = (colorInt & 0x0000FF) >> 0;
3102		   		
3103		   		$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
3104
3105				$(this).css('border-color','rgba('+R+','+G+','+B+','+$opacityStr+')');
3106				
3107				//material buttons w/ icons starting
3108				if($usingMaterialSkin) {
3109					$(this).find('i').css({'background-color': 'rgba('+R+','+G+','+B+',1)', 'box-shadow': '0px 8px 15px rgba('+R+','+G+','+B+',0.24)'});
3110				}
3111				
3112				if($(this).hasClass('see-through')) {
3113					
3114					var $that = $(this);
3115					
3116					$(this).on('mouseenter touchstart', function(){
3117						$that.css('border-color','rgba('+R+','+G+','+B+',1)');
3118					});
3119					
3120					$(this).on('mouseleave touchtouchend', function(){
3121						$that.css('border-color','rgba('+R+','+G+','+B+',1)');
3122						$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
3123						$that.css('border-color','rgba('+R+','+G+','+B+','+$opacityStr+')');
3124					});
3125					
3126					
3127				} else {
3128					
3129					$(this).find('i').css('color', $hoverTextColor);
3130					
3131					if($hoverColor != 'no-override'){
3132						
3133						var $that = $(this);
3134						
3135						$(this).on('mouseenter touchstart', function(){
3136							
3137							$that.css({
3138								'border-color': $hoverColor,
3139								'background-color': $hoverColor,
3140								'color': $hoverTextColor
3141							});
3142							
3143							//material buttons w/ icons over
3144							if($usingMaterialSkin) {
3145								$that.find('i').css({'background-color': '', 'box-shadow': ''});
3146							}
3147							
3148						});
3149						
3150						$(this).on('mouseleave touchtouchend', function(){
3151								
3152								$opacityStr = ($(this).hasClass('see-through-3')) ? '1': '0.75';
3153								
3154								//material buttons w/ icons leave
3155								if($usingMaterialSkin) {
3156									$that.find('i').css({'background-color': 'rgba('+R+','+G+','+B+',1)', 'box-shadow': '0px 8px 15px rgba('+R+','+G+','+B+',0.24)'});
3157								}
3158								
3159								if(!$that.hasClass('see-through-3')) {
3160									$that.css({
3161										'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
3162										'background-color': 'transparent',
3163										'color': $color
3164									});
3165								} else {
3166									$that.css({
3167										'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
3168										'background-color': 'transparent'
3169									});
3170								}
3171							
3172						});
3173							
3174
3175					
3176					} else {
3177						
3178						var $that = $(this);
3179						
3180						$(this).on('mouseenter touchstart', function(){
3181							
3182								$that.css({
3183									'border-color': $hoverColor,
3184									'color': $hoverTextColor
3185								});
3186								
3187						});
3188						
3189						$(this).on('mouseleave touchtouchend', function(){
3190							
3191								$opacityStr = ($that.hasClass('see-through-3')) ? '1': '0.75';
3192								$that.css({
3193									'border-color':'rgba('+R+','+G+','+B+','+$opacityStr+')',
3194									'color':  $hoverTextColor
3195								});
3196								
3197						});
3198							
3199
3200					
3201					}
3202			//	}
3203			
3204			}
3205		});
3206		
3207		$('.nectar-button:not(.see-through):not(.see-through-2):not(.see-through-3)[data-color-override]').each(function(){
3208			
3209			$(this).css('visibility','visible');
3210			
3211			if($(this).attr('data-color-override') != 'false'){
3212				
3213				var $color = $(this).attr('data-color-override');
3214				$(this).removeClass('accent-color').removeClass('extra-color-1').removeClass('extra-color-2').removeClass('extra-color-3');
3215				$(this).css('background-color',$color);
3216				
3217			}
3218			
3219		});
3220
3221
3222		//solid color tilt 
3223		if($('.swiper-slide .solid_color_2').length > 0 || $('.tilt-button-inner').length > 0) {
3224
3225			var $tiltButtonCssString = '';
3226
3227			$('.swiper-slide .solid_color_2 a').each(function(i){
3228				
3229				$(this).addClass('instance-'+i);
3230
3231				if($(this).attr('data-color-override') != 'false') {
3232					var $color = $(this).attr('data-color-override');
3233				} else {
3234					if($(this).parents('.dark').length > 0) 
3235						var $color = '#000000';
3236					else 
3237						var $color = '#ffffff';
3238				}
3239
3240				$(this).css('color',$color);
3241				$(this).find('i').css('color',$color);
3242				
3243				var $currentColor = $(this).css('background-color');
3244				var $topColor = shadeColor($currentColor, 0.13);
3245				var $bottomColor = shadeColor($currentColor, -0.15);
3246	
3247				$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+'; } ';
3248
3249			});
3250
3251
3252			$('.tilt-button-wrap a').each(function(i){
3253				
3254				$(this).addClass('instance-'+i);
3255
3256				var $currentColor = $(this).css('background-color');
3257
3258				if($(this).attr('data-color-override') != 'false') {
3259					var $color = $(this).attr('data-color-override');
3260					$(this).css('background-color',$color);
3261					$currentColor = $color;
3262				} 
3263			
3264				var $topColor = shadeColor($currentColor, 0.13);
3265				var $bottomColor = shadeColor($currentColor, -0.15);
3266	
3267				$tiltButtonCssString += '.tilt-button-wrap a.instance-'+i + ':after { background-color: '+$topColor+';  }' + ' .tilt-button-wrap a.instance-'+i + ':before { background-color: '+$bottomColor+'; } ';
3268
3269			});
3270
3271			var head = document.head || document.getElementsByTagName('head')[0];
3272   			var style = document.createElement('style');
3273
3274   			style.type = 'text/css';
3275			if (style.styleSheet){
3276			  style.styleSheet.cssText = $tiltButtonCssString;
3277			} else {
3278			  style.appendChild(document.createTextNode($tiltButtonCssString));
3279			}
3280
3281			head.appendChild(style);
3282		}
3283
3284
3285		//transparent 3d
3286		if($('.nectar-3d-transparent-button').length > 0) {
3287
3288			var $3dTransButtonCssString = '';
3289			$('.nectar-3d-transparent-button').each(function(i){
3290
3291				var $that = $(this);
3292				var $size = $that.attr('data-size');
3293				var $padding = 0;
3294
3295		
3296
3297				//size
3298
3299				if($size == 'large') {
3300					$padding = 46;
3301					$font_size = 16;
3302				} else if($size == 'medium') {
3303					$padding = 30;
3304					$font_size = 16;
3305				} else if($size == 'small') {
3306					$padding = 20;
3307					$font_size = 12;
3308				} else if($size == 'jumbo') {
3309					$padding = 54;
3310					$font_size = 24;
3311				} else if($size == 'extra_jumbo') {
3312					$padding = 100;
3313					$font_size = 64;
3314				}
3315
3316				$that.find('svg text').attr('font-size',$font_size);
3317				$boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect();
3318
3319				$text_width = $boundingRect.width;
3320				$text_height = $font_size*1.5;
3321
3322				$extraMult = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 0 : 1;
3323
3324				$that.css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'});
3325				$that.find('> a').css({'height': ($text_height+$padding)+'px'});
3326
3327				$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));
3328				if($size == 'jumbo')
3329					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.68) +')');
3330				else if($size == 'extra_jumbo')
3331					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.6)/2 +' ' + (($text_height+$padding) / 1.6) +')');
3332				else if($size == 'large') {
3333					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.7) +')');
3334				}
3335				else {
3336					$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.5)/2 +' ' + (($text_height+$padding) / 1.65) +')');
3337				}
3338				$that.find('.front-3d ').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
3339				$that.find('.back-3d').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
3340
3341				//mask
3342				$(this).find('.front-3d svg > rect').attr('id','masked-rect-id-'+i);
3343				$(this).find('.front-3d defs mask').attr('id','button-text-mask-'+i);
3344
3345				$that.css('visibility','visible');
3346				$3dTransButtonCssString+= '#masked-rect-id-'+i+' { mask: url(#button-text-mask-'+i+'); -webkit-mask: url(#button-text-mask-'+i+')} ';
3347
3348			});
3349
3350			//extra jumbo resize
3351			function createExtraJumboSize() {
3352				$('.nectar-3d-transparent-button').each(function(i){
3353					
3354					if($(this).css('visibility') != 'visible') return;
3355
3356					var $that = $(this);
3357					var $size = $that.attr('data-size');
3358					if($size == 'extra_jumbo') {
3359
3360						$extraMult = (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) ? 0 : 1;
3361
3362						if(window.innerWidth < 1000 && window.innerWidth > 690) {
3363							$padding = 64;
3364							$font_size = 34;
3365							$that.find('.back-3d rect').attr('stroke-width','12');
3366							$vert_height_divider = 1.7;
3367						} else if(window.innerWidth <= 690 ) {
3368							$padding = 46;
3369							$font_size = 16;
3370							$that.find('.back-3d rect').attr('stroke-width','10');
3371							$vert_height_divider = 1.7;
3372						}  else {
3373							$padding = 100;
3374							$font_size = 64;
3375							$that.find('.back-3d rect').attr('stroke-width','20');
3376							$vert_height_divider = 1.6;
3377						}
3378			
3379
3380						$that.find('svg text').attr('font-size',$font_size);
3381
3382						$boundingRect = $(this).find('.back-3d .button-text')[0].getBoundingClientRect();
3383						$text_width = $boundingRect.width;
3384						$text_height = $font_size*1.5;
3385
3386						$that.css({'width': ($text_width+$padding*1.5)+'px','height': ($text_height+$padding)+'px'});
3387						$that.find('> a').css({'height': ($text_height+$padding)+'px'});
3388
3389						$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));
3390
3391						$that.find('svg text').attr('transform','matrix(1 0 0 1 '+($text_width+$padding*1.6)/2 +' ' + (($text_height+$padding) / $vert_height_divider) +')');
3392
3393						$that.find('.front-3d ').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
3394						$that.find('.back-3d').css('transform-origin','50% 50% -'+($text_height+$padding)/2+'px');
3395
3396					}
3397				});
3398			}
3399			createExtraJumboSize();
3400			$(window).on('smartresize',createExtraJumboSize);
3401
3402			var head = document.head || document.getElementsByTagName('head')[0];
3403				var style = document.createElement('style');
3404
3405				style.type = 'text/css';
3406			if (style.styleSheet){
3407			  style.styleSheet.cssText = $3dTransButtonCssString;
3408			} else {
3409			  style.appendChild(document.createTextNode($3dTransButtonCssString));
3410			}
3411
3412			head.appendChild(style);
3413		}
3414
3415		//gradient btn init
3416		setTimeout(function(){
3417			$('.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');
3418		},150);
3419		//no grad for ff
3420		if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1 || navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./)) {
3421			$('.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');
3422		}
3423	}	
3424
3425	coloredButtons();
3426
3427
3428	//large icon hover
3429	function largeIconHover(){
3430		$('.icon-3x').each(function(){
3431			$(this).closest('.col').hover(function(){
3432				$(this).find('.icon-3x').addClass('hovered')
3433			},function(){
3434				$('.icon-3x').removeClass('hovered')
3435			});
3436		});
3437
3438		//remove gradient from FF
3439		if( navigator.userAgent.indexOf("MSIE ") > -1 || navigator.userAgent.match(/Trident\/7\./))
3440			$('[class^="icon-"].extra-color-gradient-1, [class^="icon-"].extra-color-gradient-2, [class^="icon-"][data-color="extra-color-gradient-1"], [class^="icon-"][data-color="extra-color-gradient-2"], .nectar_icon_wrap[data-color*="extra-color-gradient"] .nectar_icon, .nectar-gradient-text').addClass('no-grad');
3441	}
3442	largeIconHover();
3443
3444
3445/***************** Team Member ******************/
3446function teamMemberFullscreen() {
3447
3448	//open
3449	$('body').on('click','.team-member[data-style="bio_fullscreen"]',function(){
3450		
3451		if($('.nectar_team_member_overlay').length > 0) return;
3452
3453		var $usingBoxedClass = ($('body > #boxed').length > 0) ? 'in-boxed' : null;
3454
3455		$teamMemberMeta = $(this).find('.nectar_team_bio').html();
3456		$teamMemberImg = ($(this).find('.nectar_team_bio_img[data-img-src]').length > 0) ? $(this).find('.nectar_team_bio_img').attr('data-img-src') : '';
3457		$('body').append('<div class="nectar_team_member_overlay '+$usingBoxedClass+'"><div class="inner-wrap"><div class="team_member_details"><div class="bio-inner"><span class="mobile-close"></span><h2>'+$(this).find('.team-meta h3').html()+'</h2><div class="title">'+$(this).find('.team-meta p').html()+'</div><div class="team-desc">'+$teamMemberMeta+'</div></div></div><div class="team_member_picture"><div class="team_member_image_bg_cover"></div><div class="team_member_picture_wrap"><div class="team_member_image"></div></div></div></div></div><div class="nectar_team_member_close '+$usingBoxedClass+'"><div class="inner"></div></div>');
3458		if($teamMemberImg.length > 0) {
3459
3460			//fadein img on load
3461			var teamTmpImg = new Image();
3462			teamTmpImg.src = $teamMemberImg;
3463		    teamTmpImg.onload = function() {
3464		        $('.nectar_team_member_overlay .team_member_image').css('opacity','1');
3465		    };
3466			$('.nectar_team_member_overlay .team_member_image').css({ 'background-image': 'url("'+$teamMemberImg+'")'});
3467		}
3468		
3469		
3470		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').height();
3471		$('.nectar_team_member_overlay .inner-wrap').css({ 'padding-top': $headerNavSpace });
3472		
3473		//no-scroll class - ios ready
3474		if($('.using-mobile-browser').length > 0) {
3475			$('body,html').addClass('nectar-no-scrolling');
3476		}
3477		
3478		teamFullscreenResize();
3479
3480		//transition in
3481		$('.nectar_team_member_overlay').addClass('open').addClass('animating');
3482
3483		setTimeout(function(){
3484			$('.nectar_team_member_close').addClass('visible');
3485			$('.nectar_team_member_overlay').removeClass('animating');
3486		},500);
3487
3488		//bind close mousemove
3489		$(document).on('mousemove',teamMousemoveOn);
3490
3491		//bind overflow
3492		if($('.using-mobile-browser').length == 0) {
3493			fullscreenBioScrolling();
3494		}
3495
3496		if($('.team-member[data-style="bio_fullscreen"]').length > 0 && navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)) { 
3497			$('.nectar_team_member_overlay').addClass('on-mobile');
3498		}
3499
3500	});
3501
3502	//close
3503	$('body').on('click','.nectar_team_member_overlay',function(){
3504		if(!$(this).hasClass('animating')) {
3505
3506			$('.nectar_team_member_overlay').removeClass('open');
3507			$('.nectar_team_member_close').removeClass('visible');
3508			
3509			if($('.using-mobile-browser').length > 0) {
3510				$('body,html').removeClass('nectar-no-scrolling');
3511			}
3512			
3513			setTimeout(function(){
3514				
3515				//unbind close mousemove
3516				$(document).off('mousemove',teamMousemoveOn);
3517
3518				$('.nectar_team_member_overlay, .nectar_team_member_close').remove();
3519
3520			},820);
3521		}
3522	});
3523
3524	if($('.team-member[data-style="bio_fullscreen"]').length > 0) {
3525		$(window).resize(teamFullscreenResize);
3526	}
3527
3528	
3529}
3530
3531function teamFullscreenResize() {
3532	var $leftHeaderSize = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 275 : 0;
3533	$('.nectar_team_member_overlay').css({'width' : $(window).width()-$leftHeaderSize, 'left': $leftHeaderSize});
3534}
3535
3536function fullscreenBioScrolling(){ 
3537	$('.nectar_team_member_overlay .inner-wrap').mousewheel(function(event, delta) {
3538
3539	     this.scrollTop -= (delta * 30);
3540	     event.preventDefault();
3541
3542	});
3543
3544}
3545
3546function teamMousemoveOn(e) {
3547	
3548	if($('a:hover').length > 0) {
3549		$('.nectar_team_member_close .inner').removeClass('visible');
3550	} else {
3551		$('.nectar_team_member_close .inner').addClass('visible');
3552	}
3553    $('.nectar_team_member_close').css({
3554       left:  e.pageX - 26,
3555       top:   e.pageY - $(window).scrollTop() - 29
3556    });
3557}
3558
3559if($('.team-member').length > 0) {
3560	teamMemberFullscreen();
3561}
3562
3563/***************** Column Hover BG ******************/
3564
3565function columnBGColors() {	
3566	
3567	var $columnColorCSS = '';
3568
3569	$('.wpb_column').each(function(i){
3570
3571		$(this).addClass('instance-'+i);
3572
3573		//bg color
3574		if($(this).attr('data-has-bg-color') == 'true') {
3575			if($(this).is('[data-animation*="reveal"]') && $(this).hasClass('has-animation')) {
3576				$columnColorCSS += '.wpb_column.instance-'+i+ ' > .column-bg-overlay { background-color:' + $(this).attr('data-bg-color') + ';  opacity: '+$(this).attr('data-bg-opacity')+'; }';
3577			}
3578			else {
3579				$columnColorCSS += '.wpb_column.instance-'+i+ ' > .column-bg-overlay{ background-color:' + $(this).attr('data-bg-color') + ';  opacity: '+$(this).attr('data-bg-opacity')+'; }';
3580			}
3581		}
3582
3583		//hover bg color
3584		if($(this).is('[data-hover-bg^="#"]')) {
3585			if($(this).is('[data-animation*="reveal"]') && $(this).hasClass('has-animation')) {
3586				 $columnColorCSS += '.wpb_column.instance-'+i+ ':hover > .column-bg-overlay { background-color: '+$(this).attr('data-hover-bg') + '!important; opacity: '+$(this).attr('data-hover-bg-opacity')+'!important; }';
3587			}
3588			else {
3589	   		 $columnColorCSS += '.wpb_column.instance-'+i+ ':hover > .column-bg-overlay { background-color: '+$(this).attr('data-hover-bg') + '!important; opacity: '+$(this).attr('data-hover-bg-opacity')+'!important; }';
3590			}
3591
3592		}
3593	});
3594
3595	if($columnColorCSS.length > 1) {
3596		var head = document.head || document.getElementsByTagName('head')[0];
3597		var style = document.createElement('style');
3598
3599		style.type = 'text/css';
3600		if (style.styleSheet){
3601		  style.styleSheet.cssText = $columnColorCSS;
3602		} else {
3603		  style.appendChild(document.createTextNode($columnColorCSS));
3604		}
3605
3606		head.appendChild(style);
3607	}
3608
3609}
3610columnBGColors();
3611
3612
3613
3614
3615
3616
3617/***************** morphing button ******************/
3618
3619function morphingOutlines() {
3620
3621	if($('.morphing-outline').length > 0) {
3622
3623		$morphingOutlineCSS = '';
3624
3625		$('.morphing-outline').each(function(i){
3626			$(this).addClass('instance-'+i).css({'visibility':'visible'});
3627			var $width = $(this).find('.inner').width();
3628			var $height = $(this).find('.inner').height();
3629			var $border = parseInt($(this).attr("data-border-thickness"));
3630			var $hover = ($('body[data-button-style*="rounded"]').length > 0) ? ':hover': '';
3631			var $hover2 = ($('body[data-button-style*="rounded"]').length > 0) ? '': ':hover';
3632
3633			$morphingOutlineCSS += 'body .morphing-outline.instance-'+i+' .inner > * { color: '+$(this).attr("data-starting-color")+'; } ';
3634			$morphingOutlineCSS += 'body .morphing-outline.instance-'+i+' .inner:after  { border-width:'+$(this).attr("data-border-thickness")+'px ; border-color: '+$(this).attr("data-starting-color")+'; } ';
3635			
3636			$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")+'; } ';
3637			$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")+'; } ';
3638			//padding calcs
3639			$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}';
3640			$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
3641			$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 }';
3642
3643			$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 }';
3644			////hover
3645			$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}';
3646			$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 }';
3647
3648		});
3649
3650		var head = document.head || document.getElementsByTagName('head')[0];
3651		var style = document.createElement('style');
3652
3653		style.type = 'text/css';
3654		style.id = 'morphing-outlines';
3655		if (style.styleSheet){
3656		  style.styleSheet.cssText = $morphingOutlineCSS;
3657		} else {
3658		  style.appendChild(document.createTextNode($morphingOutlineCSS));
3659		}
3660
3661		$('#morphing-outlines').remove();
3662		head.appendChild(style);
3663	}
3664}
3665
3666setTimeout(morphingOutlines,100); 
3667setTimeout(fullWidthContentColumns,126);
3668
3669
3670/***************** svg icons *******************/
3671
3672var $svg_icons = [];
3673function svgAnimations() {
3674	
3675	$svgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
3676
3677	if($svg_icons.length == 0) {
3678
3679		$('.svg-icon-holder:not(.animated-in)').has('svg').each(function(i){
3680			var $that = $(this);
3681
3682			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)) $that.attr('data-animation','false');
3683
3684			//size
3685			$that.find('svg').css({'height': parseInt($that.attr('data-size')) +'px', 'width': parseInt($that.attr('data-size')) +'px'});
3686
3687			//animation
3688			$(this).find('svg').attr('id','nectar-svg-animation-instance-'+i);
3689			var $animationSpeed = ($that.is('[data-animation-speed]') && $that.attr('data-animation-speed').length > 0) ? $that.attr('data-animation-speed') : 200;
3690			if($that.attr('data-animation') == 'false') { 
3691				$animationSpeed = 1;
3692				$that.css('opacity','1');
3693			}
3694
3695			if(!$that.hasClass('bound')) {
3696				$svg_icons[i] = new Vivus($that.find('svg').attr('id'), {type: 'delayed', pathTimingFunction: Vivus.EASE_OUT, animTimingFunction: Vivus.LINEAR, duration: $animationSpeed, onReady: svgInit });
3697			}
3698
3699			if($animationSpeed !== 1) {
3700
3701				var $that = $(this);
3702				var waypoint = new Waypoint({
3703		 			element: $that,
3704		 			 handler: function(direction) {
3705		 			 	if( $that.hasClass('animated-in')) { 
3706						     waypoint.destroy();
3707						     return;
3708						}
3709
3710		 			 	checkIfReady();
3711						$that.addClass('animated-in');
3712						waypoint.destroy();
3713					},
3714					offset: $svgOffsetPos
3715
3716				}); 
3717
3718			} else {
3719				checkIfReady();
3720			}
3721
3722			function checkIfReady() {
3723				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;
3724				
3725				var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g,'');
3726
3727				if($svg_icons[$iconID].isReady == true) {
3728					 setTimeout(function(){ $that.css('opacity','1'); $svg_icons[$iconID].reset().play(); },$animationDelay);
3729				} else {
3730					setTimeout(checkIfReady,50);
3731				}
3732			}
3733
3734			function svgInit() {
3735
3736				//set size
3737				$that.css({'height': parseInt($that.attr('data-size')) +'px', 'width': parseInt($that.attr('data-size')) +'px'});
3738
3739				//var $iconID = $that.find('svg').attr('id');
3740				//$iconID = $iconID.replace(/[^0-9]/g,'');
3741				
3742				//stop animation until user scrolls to it
3743				//svg_icons[$iconID].reset().stop();
3744
3745				//set color
3746				//var svgDoc = $that.find('object')[0].contentDocument;
3747
3748				//var styleElement = svgDoc.createElementNS("http://www.w3.org/2000/svg", "style");
3749				//styleElement.textContent = "svg, svg path { stroke: "+$that.css('color')+"; fill: none; }"; 
3750				//svgDoc.getElementById("Layer_1").appendChild(styleElement);
3751
3752			}
3753
3754			$that.addClass('bound');
3755
3756		});	
3757	} else {
3758		$('.svg-icon-holder').addClass('animated-in').css('opacity','1');
3759	}
3760	
3761	//full vc row support
3762	$('#nectar_fullscreen_rows .svg-icon-holder.animated-in').has('svg').each(function(i){
3763		
3764		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;
3765		var $that = $(this);
3766
3767		var $iconID = $that.find('svg').attr('id').replace(/[^0-9]/g,'');
3768
3769		clearTimeout($animatedSVGIconTimeout[i]);
3770
3771		if($that.attr('data-animation') == 'false') { 
3772			$animationSpeed = 1;
3773			$that.css('opacity','1');
3774			$svg_icons[$iconID].finish();
3775		} else {
3776			if($(this).parents('.active').length > 0 || $(this).parents('#footer-outer').length > 0 || $('body.mobile').length > 0) {
3777				$svg_icons[$iconID].reset();
3778				$animatedSVGIconTimeout[i] = setTimeout(function(){ $svg_icons[$iconID].play(); },$animationDelay);
3779			}
3780
3781			else {
3782				$svg_icons[$iconID].reset().stop();
3783			}
3784		}
3785	});
3786}
3787//svg in equal height column resize
3788if($('.vc_row-o-equal-height .svg-icon-holder[data-animation="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) {
3789	 $(window).on('smartresize', function(){
3790	    clearTimeout($svgResizeTimeout);
3791	    $svgResizeTimeout = setTimeout(function(){ 
3792
3793	    	if($svg_icons.length > 0) {
3794	        	$('.svg-icon-holder.animated-in').each(function(i){
3795					$(this).css('opacity','1');
3796					var $iconID = $(this).attr('id').replace(/[^0-9]/g,'');
3797					$svg_icons[$iconID].finish();
3798				});
3799	        }
3800
3801	     },300);
3802	});
3803}
3804
3805//if($('.nectar-box-roll').length == 0 || $('body.mobile').length > 0) setTimeout(svgAnimations,100);
3806
3807/***************** fancy ul ******************/
3808
3809	function nectar_fancy_ul_init() {
3810		$($fullscreenSelector+'.nectar-fancy-ul').each(function(){
3811
3812
3813			var $icon = $(this).attr('data-list-icon');
3814			var $color = $(this).attr('data-color');
3815			var $animation = $(this).attr('data-animation');
3816			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;
3817			
3818			$(this).find('li').each(function(){
3819				
3820				if($(this).find('> i').length == 0) 
3821					$(this).prepend('<i class="icon-default-style '+$icon+ ' ' + $color +'"></i> ');
3822			});
3823
3824			
3825			if($animation == 'true') {
3826
3827
3828				var $that = $(this);
3829				var waypoint = new Waypoint({
3830		 			element: $that,
3831		 			 handler: function(direction) {
3832
3833		 			 	if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
3834						     waypoint.destroy();
3835						     return;
3836						}
3837
3838						setTimeout(function(){
3839			 			 	$that.find('li').each(function(i){
3840			 			 		var $that = $(this);
3841								$that.delay(i*220).transition({
3842									'opacity': '1',
3843									'left' : '0'
3844								},220,'easeOutCubic');
3845							});
3846			 			 },$animationDelay);
3847
3848						$that.addClass('animated-in');
3849						waypoint.destroy();
3850					},
3851					offset: 'bottom-in-view'
3852
3853				}); 
3854
3855			} 
3856			
3857			
3858			
3859		});
3860	}
3861	setTimeout(function(){ 
3862		//if($('.nectar-box-roll').length == 0) nectar_fancy_ul_init();
3863	},$animationOnScrollTimeOut); 
3864
3865	
3866
3867/***************** flip box min heights ******************/
3868//if content height exceeds min height change it
3869function flipBoxHeights() {
3870	$('.nectar-flip-box').each(function(){
3871		
3872		var $flipBoxMinHeight = parseInt($(this).attr('data-min-height'));
3873		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();
3874
3875		if($flipBoxHeight >= $flipBoxMinHeight - 80) {
3876			$(this).find('> div').css('height', $flipBoxHeight + 80);
3877		} else 
3878			$(this).find('> div').css('height','auto');
3879
3880	});
3881}
3882flipBoxHeights();
3883
3884if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
3885	$('body').on('click','.nectar-flip-box', function(){
3886		$(this).toggleClass('flipped');
3887	});
3888}
3889
3890/***************** PARALLAX SECTIONS ******************/
3891	
3892	
3893
3894
3895	var $window = $(window);
3896	var windowHeight = $window.height();
3897
3898		
3899	$window.unbind('scroll.parallaxSections').unbind('resize.parallaxSections');
3900	$window.unbind('resize.parallaxSectionsUpdateHeight');
3901	$window.unbind('load.parallaxSectionsOffsetL');
3902	$window.unbind('resize.parallaxSectionsOffsetR');
3903
3904	$window.on('resize.parallaxSectionsUpdateHeight',psUpdateWindowHeight);
3905
3906	function psUpdateWindowHeight() {
3907		windowHeight = $window.height();
3908	}
3909
3910	function psUpdateOffset($this) {
3911		$this.each(function(){
3912	  	    firstTop = $this.offset().top;
3913		});
3914	}
3915	
3916	$.fn.parallaxScroll = function(xpos, speedFactor, outerHeight) {
3917		var $this = $(this);
3918		var getHeight;
3919		var firstTop;
3920		var paddingTop = 0;
3921		
3922		var $windowDOMWidth = window.innerWidth, $windowDOMHeight = window.innerHeight;
3923		var $orientationChange = 0;
3924		
3925		//get the starting position of each element to have parallax applied to it		
3926		$this.each(function(){
3927		    firstTop = $this.offset().top;
3928		});
3929		
3930		
3931		$window.on('resize.parallaxSectionsOffsetR',psUpdateOffset($this));
3932		$window.on('load.parallaxSectionsOffsetL',psUpdateOffset($this));
3933	
3934		getHeight = function(jqo) {
3935			return jqo.outerHeight(true);
3936		};
3937		 
3938			
3939		// setup defaults if arguments aren't specified
3940		if (arguments.length < 1 || xpos === null) xpos = "50%";
3941		if (arguments.length < 2 || speedFactor === null) speedFactor = 0.25;
3942		if (arguments.length < 3 || outerHeight === null) outerHeight = true;
3943		
3944		// function to be called whenever the window is scrolled or resized
3945
3946		var $element, top, height;
3947		
3948		var ua = window.navigator.userAgent;
3949		var msie = ua.indexOf("MSIE ");
3950		var $onMobileBrowser = navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/);		
3951		
3952		var $toTransformOrNot = ($smoothCache == true) ? true : false;
3953		
3954		if(!$toTransformOrNot) {
3955			$this.find('.row-bg.using-image, .page-header-bg-image, .image-bg, .video-wrap').addClass('translate');
3956		}
3957		
3958		var $ifFast = 0;
3959		$element = $this;
3960		
3961		height = getHeight($element);
3962		
3963		var classic_mobile_menu_open = false;
3964		
3965		setInterval(function(){
3966			height = getHeight($element);
3967			
3968			classic_mobile_menu_open = ( $('body.classic_mobile_menu_open.mobile').length > 0 ) ? true : false;
3969			
3970		},600);
3971		
3972		var firstSection = ( ($element.parents('.top-level').length > 0 && $element.parents('.parallax_slider_outer').length > 0) || ($element.parents('.top-level').length > 0 && $element.is('.nectar-recent-posts-single_featured') ) || $element.is('.wpb_row.top-level') || $('.wpb_row').length == 0) ? true : false;
3973		
3974		//for first nectar slider shortcode without page builder or portfolio first
3975		if( $('.wpb_row').length == 0 && $element.parents('.parallax_slider_outer').length > 0 && $element.is('[data-full-width="true"]') ||
3976	      ($('#portfolio-extra').length > 0 && $element.parents('.parallax_slider_outer').length > 0 && $element.parents('.wpb_row').length > 0 && $element.parents('.wpb_row').index() == '0') ) {
3977			firstSection = true;
3978		}
3979		
3980		var nectarSliderElBool = $this.is('.nectar-slider-wrap');
3981		var pageHeaderBool = ($this.find('.page-header-bg-image').length > 0) ? true : false;
3982		
3983		var $elToParallax = false;
3984		
3985		if(nectarSliderElBool) {
3986			
3987				if($this.find('.video-wrap').length > 0 || $this.find('.image-bg').length > 0) {
3988					$elToParallax = $this.find('.video-wrap, .image-bg');
3989				} 
3990		}
3991		else {
3992			
3993				if($this.find('.row-bg.using-image').length > 0) {
3994					
3995					$elToParallax = $this.find('.row-bg.using-image');
3996					
3997				} else if($this.find('.page-header-bg-image').length > 0) {
3998					
3999					$elToParallax = $this.find('.page-header-bg-image');
4000				}
4001				
4002		}
4003		
4004
4005		function update(){
4006			
4007				firstTop = $element.offset().top;
4008				
4009				// Check if totally above or totally below viewport
4010				if ($elToParallax == false || firstTop + height < nectarDOMInfo.scrollTop || firstTop > nectarDOMInfo.scrollTop + windowHeight || $('body.material-ocm-open').length > 0) {
4011					
4012				} else {
4013
4014		        //for IE, Safari or any setup using the styled scrollbar default to animating the BG pos
4015		        if ($toTransformOrNot) {
4016		        	$this.find('.row-bg.using-image').css('backgroundPosition', xpos + " " + Math.round((firstTop - nectarDOMInfo.scrollTop) * speedFactor) + "px");
4017		        }
4018		       	//for Firefox/Chrome use a higher performing method
4019		        else  {
4020							
4021							//nectar slider
4022							if(nectarSliderElBool) {
4023									
4024								 if(firstSection) {
4025									 //top level row
4026 										if(!classic_mobile_menu_open) {
4027									 		$this.find('.video-wrap, .image-bg').css({ 'transform':  'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor)  + 'px, 0)' }); 
4028									  }
4029								 } else {
4030									 	$this.find('.video-wrap, .image-bg').css({ 'transform':  'translate3d(0, ' + parseFloat((($windowDOMHeight + nectarDOMInfo.scrollTop -  firstTop) * speedFactor) ) + 'px, 0)' }); 
4031								 }
4032								
4033							} else {
4034								
4035								//rows
4036								if(firstSection) {
4037									//top level row
4038									if(!classic_mobile_menu_open) {
4039		        				$elToParallax.css({ 'transform':  'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor)  + 'px, 0)' });
4040									}
4041								} else {
4042									//regular rows
4043									$elToParallax.css({ 'transform':  'translate3d(0, ' + parseFloat((($windowDOMHeight + nectarDOMInfo.scrollTop -  firstTop) * speedFactor) ) + 'px, 0), scale(1.005)' });
4044								}
4045								
4046								//page header
4047								if(pageHeaderBool && !classic_mobile_menu_open) {
4048									$elToParallax.css({ 'transform':  'translate3d(0, ' + parseFloat(nectarDOMInfo.scrollTop * speedFactor) + 'px, 0)' });
4049								}
4050							
4051							}
4052							
4053						} 
4054				
4055				}
4056				
4057
4058			//if on mobile, auto RAF
4059			if($onMobileBrowser){
4060				requestAnimationFrame(update); 
4061			}
4062			
4063		}		
4064
4065		if (window.addEventListener) {
4066			
4067			if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)){
4068					 window.addEventListener('scroll', function(){ 
4069			          requestAnimationFrame(update); 
4070			     }, false);
4071					 
4072					 $(window).resize(function(){
4073						 $windowDOMWidth = window.innerWidth;
4074						 $windowDOMHeight = window.innerHeight;
4075					 });
4076					 
4077			 } else {
4078				 	//if on mobile, auto RAF
4079					requestAnimationFrame(update); 
4080					
4081
4082					window.addEventListener("orientationchange", function() {
4083						 $orientationChange = 1;
4084					});
4085					
4086					$(window).resize(function(){
4087							if( ($(window).width() != $windowDOMWidth && $(window).height != $windowDOMHeight) || $orientationChange == 1){
4088
4089									//store the current window dimensions
4090									$windowDOMWidth = window.innerWidth;
4091									$windowDOMHeight = window.innerHeight;
4092									
4093									$orientationChange = 0;
4094							}
4095					});
4096					 
4097			 }
4098			 
4099		}
4100
4101		$window.on('resize.parallaxSections',update);
4102
4103		update();
4104	};
4105
4106 
4107 
4108
4109
4110	
4111/***************** Full Width Section ******************/
4112
4113	//nectar slider in container but fullwidth fix
4114	$('.wpb_row .vc_col-sm-12 .nectar-slider-wrap[data-full-width="true"]').each(function(){
4115		if($(this).parents('.wpb_row.full-width-section').length == 0 && $(this).parents('.wpb_row.full-width-content').length == 0) {
4116			$(this).parents('.wpb_row').addClass('full-width-section');
4117		}
4118	});
4119
4120	function fullWidthSections(){
4121
4122		var $windowInnerWidth = window.innerWidth;
4123		var $scrollBar = ($('#ascrail2000').length > 0 && $windowInnerWidth > 1000) ? -13 : 0;
4124		var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? parseInt($('.body-border-right').width())*2 : 0;
4125		
4126		if($('#boxed').length == 1){
4127			$justOutOfSight = ((parseInt($('.container-wrap').width()) - parseInt($('.main-content').width())) / 2) + 4;
4128		} else {
4129			
4130			//if the ext responsive mode is on - add the extra padding into the calcs
4131			var $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && $windowInnerWidth >= 1000) ? 180 : 0;
4132			var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0;
4133			if($(window).width() - $leftHeaderSize - $bodyBorderWidth  <= parseInt($('.main-content').css('max-width'))) { 
4134				var $windowWidth = parseInt($('.main-content').css('max-width'));
4135
4136				//no need for the scrollbar calcs with ext responsive on desktop views
4137				if($extResponsivePadding == 180) $windowWidth = $windowWidth - $scrollBar;
4138
4139			} else { 
4140				var $windowWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth;
4141			}
4142
4143			
4144			$contentWidth = parseInt($('.main-content').css('max-width'));
4145
4146			//single post fullwidth
4147			if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 ) {
4148				$contentWidth = $('.post-area').width();
4149				$extResponsivePadding = 0;
4150			}
4151			
4152			$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
4153		}
4154		
4155		/*
4156		$('.full-width-section').each(function(){
4157			
4158			if(!$(this).parents('.span_9').length > 0 && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner' && $(this).parent().attr('id') != 'portfolio-extra' &&
4159			!$(this).hasClass('non-fw')){
4160
4161				$(this).css({
4162					'margin-left': - $justOutOfSight,
4163					'padding-left': $justOutOfSight,
4164					'padding-right': $justOutOfSight,
4165					'visibility': 'visible'
4166				});	
4167
4168			if($('#boxed').length > 0 && $('#nectar_fullscreen_rows').length > 0) $(this).css({ 'padding-left': 0, 'padding-right': 0 });
4169
4170			}  else if($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) {
4171				$(this).css({
4172					'margin-left': - $justOutOfSight,
4173					'padding-left': $justOutOfSight,
4174					'padding-right': $justOutOfSight,
4175					'visibility': 'visible'
4176				});	
4177			}
4178			
4179			else {
4180				$(this).css({
4181					'margin-left': 0,
4182					'padding-left': 0,
4183					'padding-right': 0,
4184					'visibility': 'visible'
4185				});	
4186			}
4187			
4188		});
4189	
4190		*/
4191	    //full width content sections
4192	    $('.carousel-outer').has('.carousel-wrap[data-full-width="true"]').css('overflow','visible');
4193	    
4194	    $('.carousel-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]:not(.fullwidth-constrained), .full-width-content').each(function(){
4195			
4196			var $leftHeaderSize = ($('#header-outer[data-format="left-header"]').length > 0 && $windowInnerWidth >= 1000) ? parseInt($('#header-outer[data-format="left-header"]').width()) : 0;
4197			var $bodyBorderWidth = ($('.body-border-right').length > 0 && $windowInnerWidth > 1000) ? (parseInt($('.body-border-right').width())*2) - 2 : 0;
4198
4199			//single post fullwidth
4200			if($('#boxed').length == 1){
4201
4202				var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
4203
4204				if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) {
4205					$contentWidth = $('.post-area').width();
4206					$extResponsivePadding = 0;
4207					$windowWidth = $(window).width() - $bodyBorderWidth;
4208					$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
4209				} else {
4210					if($(this).parents('.page-submenu').length > 0)
4211						$justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2);
4212					else 
4213						$justOutOfSight = ((parseInt($('.container-wrap').width()) - $mainContentWidth) / 2) + 4;
4214				}
4215			} else {
4216				if($('body.single-post[data-ext-responsive="true"]').length > 0 && $('.container-wrap.no-sidebar').length > 0 && $(this).parents('.post-area').length > 0) {
4217					$contentWidth = $('.post-area').width();
4218					$extResponsivePadding = 0;
4219					$windowWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth;
4220				} else {
4221
4222					var $mainContentMaxWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').css('max-width')) : parseInt($(this).parents('.container').css('max-width'));
4223
4224					//when using gutter on portfolio don't add extra space for scroll bar
4225			    	if($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') {
4226			    		$scrollBar = ($('#ascrail2000').length > 0 && $windowInnerWidth > 1000) ? -13 : 0;
4227			    	}
4228
4229					if($(window).width() - $leftHeaderSize - $bodyBorderWidth <= $mainContentMaxWidth) { 
4230						$windowWidth = $mainContentMaxWidth;
4231						//no need for the scrollbar calcs with ext responsive on desktop views
4232						if($extResponsivePadding == 180) $windowWidth = $windowWidth - $scrollBar;
4233					}
4234					$contentWidth = $mainContentMaxWidth;
4235					$extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1000) ? 180 : 0;
4236					if($leftHeaderSize > 0) $extResponsivePadding = ($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1000) ? 120 : 0;
4237				}
4238
4239				$justOutOfSight = Math.ceil( (($windowWidth + $extResponsivePadding + $scrollBar - $contentWidth) / 2) )
4240			}
4241
4242			$extraSpace = 0;
4243			if( $(this).hasClass('carousel-wrap')) $extraSpace = 1;
4244			if( $(this).hasClass('portfolio-items')) $extraSpace = 5;
4245			
4246	    	$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width() - $leftHeaderSize - $bodyBorderWidth +$extraSpace  + $scrollBar ;
4247
4248	    	//when using gutter on portfolio don't add extra space
4249	    	if($('#boxed').length == 0 && $(this).hasClass('portfolio-items') && $(this).is('[data-gutter*="px"]') && $(this).attr('data-gutter').length > 0 && $(this).attr('data-gutter') != 'none') {
4250	    		if($(window).width() > 1000)
4251	    			$carouselWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth + $scrollBar + 3
4252	    		else 
4253	    			$carouselWidth = $(window).width() - $leftHeaderSize - $bodyBorderWidth + $scrollBar 
4254	    	}
4255
4256	    	if($(this).parent().hasClass('default-style')) { 
4257
4258	    		var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
4259	    		
4260	    		if($('#boxed').length != 0) {
4261	    			$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : $(window).width() - $leftHeaderSize + $extraSpace + $scrollBar ;
4262				}
4263				else {
4264					$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : ($(window).width() - $leftHeaderSize - $bodyBorderWidth) - (($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.025) + $extraSpace + $scrollBar ;
4265					$windowWidth = ($(window).width() - $leftHeaderSize - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($(window).width() - $leftHeaderSize - $bodyBorderWidth) - (($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.025);
4266					$justOutOfSight = Math.ceil( (($windowWidth + $scrollBar - $mainContentWidth) / 2) )
4267				}
4268			}
4269
4270			else if($(this).parent().hasClass('spaced')) { 
4271
4272				var $mainContentWidth = ($('#nectar_fullscreen_rows').length == 0) ? parseInt($('.main-content').width()) : parseInt($(this).parents('.container').width());
4273
4274				if($('#boxed').length != 0) {
4275	    			$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) - ($(window).width()*.02) : $(window).width() + $extraSpace + $scrollBar ;
4276				} else {
4277					$carouselWidth = ($('#boxed').length == 1) ? $mainContentWidth + parseInt($justOutOfSight*2) : ($(window).width()- $leftHeaderSize - $bodyBorderWidth)  - Math.ceil(($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.02) + $extraSpace + $scrollBar ;
4278					var $windowWidth2 = ($(window).width() - $leftHeaderSize - $bodyBorderWidth <= $mainContentWidth) ? $mainContentWidth : ($(window).width() - $leftHeaderSize - $bodyBorderWidth) - (($(window).width()- $leftHeaderSize - $bodyBorderWidth)*.02);
4279					$justOutOfSight = Math.ceil( (($windowWidth2 + $scrollBar - $mainContentWidth) / 2) +2)
4280				}
4281			}
4282	    	
4283	    	if(!$(this).parents('.span_9').length > 0 && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner' && $(this).parent().attr('id') != 'portfolio-extra' 
4284	      && !$(this).find('.carousel-wrap[data-full-width="true"]').length > 0
4285				&& !$(this).find('.nectar-carousel-flickity-fixed-content').length > 0
4286	    	&& !$(this).find('.portfolio-items:not(".carousel")[data-col-num="elastic"]').length > 0){
4287
4288	    		//escape if inside woocoommerce page and not using applicable layout
4289	    		if($('.single-product').length > 0 && $(this).parents('#tab-description').length > 0 && $(this).parents('.full-width-tabs').length == 0) {
4290	    			$(this).css({
4291						'visibility': 'visible'
4292					});	
4293	    		} else {
4294	    			if($(this).hasClass('portfolio-items')) {
4295		    				$(this).css({
4296								'transform': 'translateX(-'+ $justOutOfSight + 'px)',
4297								'margin-left': 0,
4298								'left': 0,
4299								'width': $carouselWidth,
4300								'visibility': 'visible'
4301							});	
4302	    			} else {
4303							
4304							//fullscreen page rows left fix
4305							if($('#nectar_fullscreen_rows').length > 0 && $(this).hasClass('wpb_row')) {
4306								$(this).css({
4307									'margin-left': - $justOutOfSight,
4308									'width': $carouselWidth,
4309									'visibility': 'visible'
4310								});	
4311							} else {
4312								$(this).css({
4313									'left': 0,
4314									'margin-left': - $justOutOfSight,
4315									'width': $carouselWidth,
4316									'visibility': 'visible'
4317								});	
4318							}
4319							
4320	    			}
4321					
4322				}
4323			}  else if($(this).parent().attr('id') == 'portfolio-extra' && $('#full_width_portfolio').length != 0) {
4324				$(this).css({
4325					'left': 0,
4326					'margin-left': - $justOutOfSight,
4327					'width': $carouselWidth,
4328					'visibility': 'visible'
4329				});	
4330			}
4331			
4332			else {
4333
4334				$(this).css({
4335					'margin-left': 0,
4336					'width': 'auto',
4337					'left': '0',
4338					'visibility': 'visible'
4339				});	
4340			}
4341	    	
4342	    });
4343			
4344	}
4345	
4346	var $contentElementsNum = ($('#portfolio-extra').length == 0) ? $('.main-content > .row > *').length : $('.main-content > .row #portfolio-extra > *').length ;
4347
4348	function parallaxSrollSpeed(speedString) {
4349
4350		var ua = window.navigator.userAgent;	
4351		var msie = ua.indexOf("MSIE ");
4352		var speed;
4353
4354		 //not as modern browsers
4355		 if ($smoothCache == true) {
4356			 switch(speedString) {
4357			   	  case 'slow':
4358			   	      speed = 0.2;
4359			   	      break;
4360			   	  case 'medium': 
4361			   	  	  speed = 0.4;
4362			   	      break;
4363			   	  case 'fast': 
4364			    	  speed = 0.6;
4365			   	       break;
4366			   }
4367		}
4368		 //chrome/ff
4369		 else {
4370		 	 switch(speedString) {
4371			   	  case 'slow':
4372			   	      speed = 0.6;
4373			   	      break;
4374			   	  case 'medium': 
4375			   	  	  speed = 0.4;
4376			   	      break;
4377			   	  case 'fast': 
4378			    	  speed = 0.25;
4379			   	       break;
4380			   }
4381		}
4382
4383		   return speed;
4384	}
4385
4386	function parallaxScrollInit(){
4387		
4388		if(nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) {
4389			return;
4390		}
4391		
4392		parallaxRowsBGCals();
4393		
4394		$('.nectar-recent-posts-single_featured, .wpb_row.parallax_section, #page-header-bg[data-parallax="1"] .page-header-bg-image-wrap, .parallax_slider_outer .nectar-slider-wrap').each(function(){
4395		   var $id = $(this).attr('id');	
4396
4397		    var ua = window.navigator.userAgent;	
4398		    var msie = ua.indexOf("MSIE ");
4399
4400			if ($smoothCache == true)  {
4401				
4402		   		if($(this).find('[data-parallax-speed="fixed"]').length == 0) { 
4403						
4404							if($(this).find('.row-bg').length == 0) {
4405								$('#'+$id).parallaxScroll("50%", 0.25);
4406							} else {
4407								$('#'+$id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) );
4408							}
4409					}
4410					
4411		  } else if($(this).find('[data-parallax-speed="fixed"]').length == 0) {
4412				
4413					if($(this).find('.row-bg').length == 0) {
4414							//set default scroll speed if not defined
4415							$('#'+$id).parallaxScroll("50%", 0.25);
4416					} else {
4417							$('#'+$id + ".parallax_section").parallaxScroll("50%", parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) );
4418					}
4419		  }
4420			
4421			$(this).addClass('nectar-parallax-enabled');
4422			
4423		});
4424		
4425	}
4426	
4427	
4428	
4429	//add first class for rows for page header trans effect (zoom only as of now)
4430	$('.full-width-section.wpb_row, .full-width-content.wpb_row').each(function(){
4431		
4432		if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
4433			
4434			
4435			if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
4436				
4437			if($(this).index() == '0' && $('#page-header-bg').length == 0 && $('.page-header-no-bg').length == 0 
4438							 && $('.project-title').length == 0 && $('body.single').length == 0 
4439							 && $('.project-title').length == 0 ) {
4440
4441				$(this).addClass('first-section');
4442				var $that = $(this);
4443				setTimeout( function() { $that.addClass('loaded'); },50);
4444				
4445			} 
4446				
4447
4448		}
4449	});	
4450	
4451	
4452	
4453
4454	parallaxScrollInit();
4455	parallaxRowsBGCals();
4456
4457
4458	function parallaxRowsBGCals(){
4459		
4460		if(nectarDOMInfo.usingMobileBrowser && $('body[data-remove-m-parallax="1"]').length > 0) {
4461			return;
4462		}
4463
4464		$('.nectar-recent-posts-single_featured, .wpb_row.parallax_section, #page-header-bg[data-parallax="1"] .page-header-bg-image-wrap, .parallax_slider_outer .nectar-slider-wrap .slide-bg-wrap').each(function(){
4465
4466			 var ua = window.navigator.userAgent;
4467		   var msie = ua.indexOf("MSIE ");
4468
4469			 if ($smoothCache == true) {
4470			 	 $(this).find('.row-bg').css({'height': $(this).outerHeight(true)*2.8, 'margin-top': '-' + ($(this).outerHeight(true)*2.8)/2 + 'px' });
4471			 } else {
4472				 
4473				 if($(this).find('.row-bg').length == 0 && $(this).find('.page-header-bg-image').length > 0 ) {
4474					 	//$(this).find('.page-header-bg-image').css({'height': $(this).outerHeight(true)   });
4475				 } 
4476				 else if($(this).find('.row-bg').length == 0 && $(this).find('.image-bg').length > 0 ) {
4477					 	
4478						var $non_page_builder_slider = false;
4479						//for first nectar slider shortcode without page builder
4480				 		if( $('.wpb_row').length == 0 && $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && $(this).parents('.parallax_slider_outer').length > 0 && $(this).parents('.parallax_slider_outer').index() == '0' ) {
4481				 			$non_page_builder_slider = true;
4482				 		}
4483						//portfolio first
4484						if($('#portfolio-extra').length > 0 && $(this).parents('.wpb_row').length > 0 && $(this).parents('.parallax_slider_outer').length > 0 && $(this).parents('.wpb_row').index() == '0' ) {
4485								$non_page_builder_slider = true;
4486						}
4487					 
4488					 if($(this).parents('.top-level').length > 0 || $non_page_builder_slider) {
4489						 $(this).find('.image-bg').css({'height':  Math.ceil( $(this).parent().offset().top * 0.25 ) + $(this).outerHeight(true) });
4490					 } else {
4491						 	$(this).find('.image-bg').css({'height': Math.ceil( $(window).height() * 0.25 ) + $(this).outerHeight(true)   });
4492					 }
4493					 
4494				 }
4495				 else if($(this).find('.row-bg').length == 0 && $(this).find('.video-wrap').length > 0 ) {
4496					 
4497					 
4498					 var $non_page_builder_slider = false;
4499					 //for first nectar slider shortcode without page builder
4500					 if( $('.wpb_row').length == 0 && $(this).parents('.nectar-slider-wrap[data-full-width="true"]').length > 0 && $(this).parents('.parallax_slider_outer').length > 0 && $(this).parents('.parallax_slider_outer').index() == '0' ) {
4501						 $non_page_builder_slider = true;
4502					 } 
4503					 //portfolio first
4504					 if($('#portfolio-extra').length > 0 && $(this).parents('.wpb_row').length > 0 && $(this).parents('.parallax_slider_outer').length > 0 && $(this).parents('.wpb_row').index() == '0' ) {
4505							 $non_page_builder_slider = true;
4506					 }
4507					 
4508					 if($(this).parents('.top-level').length > 0 || $non_page_builder_slider) {
4509						 $(this).find('.video-wrap').css({'height': Math.ceil( $(this).parent().offset().top * 0.25 ) + $(this).outerHeight(true) });
4510					 } else {
4511						 	$(this).find('.video-wrap').css({'height': Math.ceil( $(window).height() * 0.25 ) + $(this).outerHeight(true)   });
4512					 }
4513					 
4514					 var vid = $(this).find('.video-wrap video');
4515					 var vid_w_orig = 1280;
4516					 var vid_h_orig = 720;
4517
4518					 // get the parent element size
4519					 var container_w = vid.parent().width();
4520					 var container_h = vid.parent().height();	 
4521					 var scale_w = container_w / vid_w_orig;
4522					 var scale_h = container_h / vid_h_orig;
4523					 var scale = scale_w > scale_h ? scale_w : scale_h;
4524					 
4525					 // scale the video
4526					 vid.width(scale * vid_w_orig);
4527					 vid.height(scale * vid_h_orig);
4528
4529				 }  
4530				 else {
4531					 	if($(this).is('.nectar-recent-posts-single_featured') && $(this).parents('.top-level').length > 0 ) {
4532							
4533						}
4534					 	else if( !$(this).hasClass('top-level') ) {
4535							var $ifFast = ($(this).find('.row-bg[data-parallax-speed="fast"]').length > 0) ? 60 : 0;
4536						 	$(this).find('.row-bg').css({'height': Math.ceil( $(window).height() * parallaxSrollSpeed($(this).find('.row-bg').attr('data-parallax-speed')) ) + $(this).outerHeight(true) + $ifFast  });
4537						} 
4538						
4539				 }
4540			 
4541			 }
4542			 
4543		});
4544	}
4545	
4546	//if fullwidth section is first or last, remove the margins so it fits flush against header/footer
4547	function fwsClasses() {
4548		
4549		$('.wpb_wrapper > .nectar-slider-wrap[data-full-width="true"]').each(function(){
4550			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
4551				if($(this).parents('.wpb_row').index() == '0'){
4552					$(this).addClass('first-nectar-slider');
4553				} 
4554			}
4555		});
4556
4557		if($('#portfolio-extra').length == 0) {
4558			$contentElementsNum = ($('.main-content > .row > .wpb_row').length > 0) ? $('.main-content > .row > .wpb_row').length : $('.main-content > .row > *').length;
4559		} else {
4560			$contentElementsNum = $('.main-content > .row #portfolio-extra > *').length;
4561		}
4562
4563		$('.full-width-section, .full-width-content:not(.page-submenu .full-width-content):not(.blog-fullwidth-wrap), .row > .nectar-slider-wrap[data-full-width="true"], .wpb_wrapper > .nectar-slider-wrap[data-full-width="true"], .portfolio-items[data-col-num="elastic"]').each(function(){
4564			
4565			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
4566				
4567				if($(this).parents('.wpb_row').length > 0){ 
4568				
4569					if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
4570					
4571					////first
4572					if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length != 0 ){
4573						//$(this).css('margin-top','-2.1em').addClass('first-section nder-page-header');
4574					} 
4575					else if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length == 0 && $('.page-header-no-bg').length == 0 
4576					         && $('.project-title').length == 0 && $(this).parents('.wpb_row').index() == '0' 
4577					         && $('.project-title').length == 0 
4578					         && $('body[data-bg-header="true"]').length == 0) {
4579
4580					     if($('.single').length == 0) {
4581					     	$('.container-wrap').css('padding-top','0px');
4582					     } else {
4583					     	$(this).addClass('first-section');
4584					     } 	
4585						
4586					} 
4587					
4588					//check if it's also last (i.e. the only fws)
4589					if($(this).parents('.wpb_row').index() == $contentElementsNum-1 && $('#respond').length == 0 ) { 
4590						if($(this).attr('id') != 'portfolio-filters-inline') {
4591							$('.container-wrap').css('padding-bottom','0px');
4592							$('#call-to-action .triangle').remove();
4593						}
4594					} 
4595				
4596				} else {
4597
4598					if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
4599					
4600					if( $(this).find('.portfolio-filters-inline').length == 0 && $(this).attr('id') != 'post-area' ) {
4601						
4602						////first
4603						if($(this).index() == '0' && $('#page-header-bg').length != 0 ){
4604							//$(this).css('margin-top','-2.1em').addClass('first-section nder-page-header');
4605			
4606						} 
4607						else if($(this).index() == '0' && $('#page-header-bg').length == 0 && $(this).index() == '0' && $('.page-header-no-bg').length == 0 && 
4608						        $(this).index() == '0' && !$(this).hasClass('blog_next_prev_buttons') && !$(this).hasClass('nectar-shop-outer') && $(this).parents('.pum-container').length == 0 ) {
4609						     
4610						      if($('body[data-header-resize="0"]').length == 1 && $('.single').length == 0 || $('body.material').length > 0 && $('.single').length == 0) { 
4611											
4612											if(!$('body.blog .blog-fullwidth-wrap > .masonry:not(.meta-overlaid)').length > 0) {
4613						          	$('.container-wrap').css('padding-top','0px');
4614											}
4615											
4616						      } else {
4617						      	  $(this).addClass('first-section');
4618						      }   	
4619							
4620						} 
4621						
4622						//check if it's also last (i.e. the only fws)
4623						if($(this).index() == $contentElementsNum-1 && $('#respond').length == 0 && $('body.woocommerce-checkout').length == 0) { 
4624							$('.container-wrap').css('padding-bottom','0px');
4625							$('.bottom_controls').css('margin-top','0px');
4626							$('#call-to-action .triangle').remove();
4627						} 
4628					}
4629					
4630				}
4631			}
4632		});
4633
4634
4635
4636
4637		
4638		$('#portfolio-extra > .nectar-slider-wrap[data-full-width="true"], .portfolio-wrap').each(function(){
4639			//check if it's last 
4640			if($(this).index() == $contentElementsNum-1 && $('#commentform').length == 0 && $('#pagination').length == 0) { 
4641				if(parseInt($('.container-wrap').css('padding-bottom')) > 0) $(this).css('margin-bottom','-40px');
4642				$('#call-to-action .triangle').remove();
4643			}
4644		});
4645		
4646		
4647		
4648		$('.portfolio-filters').each(function(){
4649			////first
4650			if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' ){
4651				$(this).addClass('first-section nder-page-header');
4652			}  else if($(this).index() == '0' && $('#page-header-bg').length == 0 || $(this).index() == '0'){
4653				$(this).css({'margin-top':'0px'}).addClass('first-section');
4654			}
4655		});
4656		
4657		$('.portfolio-filters-inline').each(function(){
4658			////first
4659			if($(this).parents('.wpb_row').length > 0){ 
4660				
4661				if($(this).parents('.wpb_row').index() == '0' && $('#page-header-bg').length != 0 || $(this).parents('.wpb_row').index() == '0' ){
4662					if($('body[data-header-resize="0"]').length == 0) { 
4663						//$(this).css({'margin-top':'-2.1em', 'padding-top' : '19px'}).addClass('first-section nder-page-header');
4664					}
4665				}  
4666				
4667			} else {
4668				if($(this).index() == '0' && $('#page-header-bg').length != 0 || $(this).index() == '0' ){
4669					$(this).css({'margin-top':'-2.1em', 'padding-top' : '19px'}).addClass('first-section nder-page-header');
4670				}  else if($(this).index() == '0' && $('#page-header-bg').length == 0 || $(this).index() == '0'){
4671					
4672					//if($('body[data-header-resize="0"]').length == 1 || $('body.material').length > 0) { 
4673				          $(this).css({'margin-top':'-30px', 'padding-top' : '50px'}).addClass('first-section');
4674				      //} else {
4675				      //	  $(this).css({'margin-top':'-70px', 'padding-top' : '50px'}).addClass('first-section');
4676				      //} 
4677
4678				
4679				}
4680			}
4681			
4682		});
4683		
4684		
4685		/*
4686		$('.parallax_slider_outer').each(function(){
4687			if(!$(this).parent().hasClass('span_9') && !$(this).parent().hasClass('span_3') && $(this).parent().attr('id') != 'sidebar-inner'){
4688				
4689				if($(this).parents('#portfolio-extra').length > 0 && $('#full_width_portfolio').length == 0) return false;
4690				////first
4691				if($(this).parent().index() == '0' && $('#page-header-bg').length != 0){
4692					$(this).addClass('first-section nder-page-header');
4693
4694				} 
4695				else if($(this).parent().index() == '0' && $('#page-header-bg').length == 0){
4696					$(this).css('margin-top','-40px').addClass('first-section');
4697					if(!$('body').hasClass('single-post')) $('.container-wrap').css('padding-top', '0px');
4698				} 
4699				
4700				//check if it's also last (i.e. the only fws)
4701				if($(this).parent().index() == $contentElementsNum-1 && $('.post-area').length == 0) {
4702					$('#call-to-action .triangle').remove();
4703					$('.container-wrap').hide();
4704				}
4705			}
4706		}); */
4707		
4708	}
4709	
4710	//if not using a fullwidth slider first, ajdust the top padding
4711	//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');
4712	//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');
4713	
4714	
4715	
4716	
4717	//sizing for fullwidth sections that are image only
4718
4719	function fullwidthImgOnlySizingInit(){
4720		////set inital sizes
4721		$('.full-width-section:not(.custom-skip)').each(function(){
4722			
4723			var $fwsHeight = $(this).outerHeight(true);
4724
4725			//make sure it's empty and also not being used as a small dvider
4726			if($(this).find('.span_12 *').length == 0 && $.trim( $(this).find('.span_12').text() ).length == 0  && $fwsHeight > 40){
4727				$(this).addClass('bg-only');
4728				$(this).css({'height': $fwsHeight, 'padding-top': '0px', 'padding-bottom': '0px'});
4729				$(this).attr('data-image-height',$fwsHeight);
4730			}
4731
4732		});
4733	}
4734
4735	function fullwidthImgOnlySizing(){
4736
4737		$('.full-width-section.bg-only').each(function(){
4738			var $initialHeight = $(this).attr('data-image-height');
4739			
4740			if( window.innerWidth < 1000 && window.innerWidth > 690 ) {
4741				$(this).css('height', $initialHeight - $initialHeight*.60);
4742			} 
4743			
4744			else if( window.innerWidth <= 690 ) {
4745				$(this).css('height', $initialHeight - $initialHeight*.78);
4746			} 
4747			
4748			else if( window.innerWidth < 1300 && window.innerWidth >= 1000  ) {
4749				$(this).css('height', $initialHeight - $initialHeight*.33);
4750			} 
4751			
4752			else {
4753				$(this).css('height', $initialHeight);
4754			}
4755			
4756		});
4757		
4758	}
4759
4760	fullwidthImgOnlySizingInit();
4761	fullwidthImgOnlySizing();
4762	
4763	
4764	
4765	//change % padding on rows to be relative to screen
4766	function fullWidthRowPaddingAdjustInit(){
4767		if($('#boxed').length == 0){
4768			$('.full-width-section, .full-width-content').each(function(){
4769				var $topPadding = $(this)[0].style.paddingTop;
4770				var $bottomPadding = $(this)[0].style.paddingBottom;
4771
4772				if($topPadding.indexOf("%") >= 0) $(this).attr('data-top-percent',$topPadding);
4773				if($bottomPadding.indexOf("%") >= 0) $(this).attr('data-bottom-percent',$bottomPadding);
4774				
4775
4776			});
4777		}
4778	}
4779
4780	function fullWidthRowPaddingAdjustCalc(){
4781		if($('#boxed').length == 0){
4782			$('.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(){
4783
4784				var $windowHeight = $(window).width();
4785				var $topPadding = ($(this).attr('data-top-percent')) ? $(this).attr('data-top-percent') : 'skip';
4786				var $bottomPadding = ($(this).attr('data-bottom-percent')) ? $(this).attr('data-bottom-percent') : 'skip';
4787
4788				//top
4789				if($topPadding != 'skip') {
4790					$(this).css('padding-top',$windowHeight*(parseInt($topPadding)/100));
4791				}
4792
4793				//bottom
4794				if($bottomPadding != 'skip'){
4795					$(this).css('padding-bottom',$windowHeight*(parseInt($bottomPadding)/100));
4796				}
4797				
4798
4799			});
4800		}
4801	}
4802	if(nectarDOMInfo.usingMobileBrowser) {
4803		fullWidthRowPaddingAdjustCalc();
4804	}
4805
4806	
4807	//full width content column sizing
4808	function fullWidthContentColumns(){
4809
4810		//standard carousel
4811   	  	$('.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(){
4812			
4813
4814			//only set the height if more than one column
4815			if($(this).find('> .span_12 > .col').length > 1){
4816				
4817				var tallestColumn = 0;
4818				var $columnInnerHeight = 0;
4819				
4820				$(this).find('> .span_12 > .col').each(function(){
4821
4822					$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
4823					
4824					var $padding = parseInt($(this).css('padding-top'));
4825					//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
4826					($(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height() + ($padding*2) > tallestColumn) ? tallestColumn = $(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height() + ($padding*2)  : tallestColumn = tallestColumn;
4827				});	
4828	    	 	
4829	    	 	$(this).find('> .span_12 > .col').each(function(){
4830
4831	    	 		$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
4832					
4833	    	 		//columns with content
4834		    	 	if($(this).find('> '+$column_inner_selector+' > .wpb_wrapper > *').length > 0){
4835		    	 		//added in 7.6 to fix equal height columns 
4836		    	 		if(!$(this).parent().parent().hasClass('vc_row-o-equal-height')) $(this).css('height',tallestColumn);
4837		    	 	} 
4838		    	 	//empty columns
4839		    	 	else {
4840		    	 		$(this).css('min-height',tallestColumn);
4841		    	 		if($(this).is('[data-animation*="reveal"]')) $(this).find('.column-inner').css('min-height',tallestColumn);
4842		    	 	}
4843	    	 	});
4844	         	
4845	         	//nested column height
4846	         	var $childRows = $(this).find('> .span_12 > .col .wpb_row').length;
4847	         	if(window.innerWidth > 1000) { 
4848	         		
4849	         		var $padding = parseInt($(this).find('> .span_12 > .col').css('padding-top'));
4850	         		
4851	         		//$(this).find('> .span_12 > .col .wpb_row .col').css('min-height',(tallestColumn-($padding*2))/$childRows + 'px'); 
4852	         	} else {
4853	         		$(this).find('> .span_12 > .col .wpb_row .col').css('min-height','0px'); 
4854	         	}
4855	         	
4856	         	
4857	         	//vertically center
4858	         	if($(this).hasClass('vertically-align-columns') && window.innerWidth > 1000 && !$(this).hasClass('vc_row-o-equal-height')){
4859	         		
4860	         		//parent columns
4861		         	$(this).find('> .span_12 > .col').each(function(){
4862
4863		         		$column_inner_selector = ($(this).find('> .vc_column-inner > .wpb_wrapper').length > 0) ? '.vc_column-inner' : '.column-inner-wrap > .column-inner';
4864						
4865						$columnInnerHeight = $(this).find('> '+$column_inner_selector+' > .wpb_wrapper').height();
4866						var $marginCalc = ($(this).height()/2)-($columnInnerHeight/2);
4867						if($marginCalc <= 0) $marginCalc = 0;
4868						
4869						$(this).find('> '+$column_inner_selector+' > .wpb_wrapper').css('margin-top',$marginCalc);
4870						$(this).find('> '+$column_inner_selector+' > .wpb_wrapper').css('margin-bottom',$marginCalc);
4871						
4872					});	
4873	
4874					
4875				}
4876			
4877			}
4878			
4879   	  	});
4880
4881		//requal height columns in container type with reveal columns
4882		$('.main-content > .row > .wpb_row:not(.full-width-content).vc_row-o-equal-height').each(function(){
4883			if($(this).find('>.span_12>.wpb_column[data-animation*="reveal"]').length >0) {
4884				var tallestColumn = 0;
4885				var $columnInnerHeight = 0;
4886				
4887				$(this).find('> .span_12 > .col').each(function(){
4888					
4889					var $padding = parseInt($(this).find('> .column-inner-wrap > .column-inner').css('padding-top'));
4890					($(this).find('> .column-inner-wrap > .column-inner').height() + ($padding*2) > tallestColumn) ? tallestColumn = $(this).find('> .column-inner-wrap > .column-inner').height() + ($padding*2)  : tallestColumn = tallestColumn;
4891				});	
4892	    	 	
4893	    	 	$(this).find('> .span_12 > .col').each(function(){
4894					
4895	    	 		//columns with content
4896		    	 	if($(this).find('> .column-inner-wrap > .column-inner .wpb_wrapper > *').length > 0){
4897		    	 		$(this).find('> .column-inner-wrap').css('height',tallestColumn);
4898		    	 	} 
4899		    	 	//empty columns
4900		    	 	else {
4901		    	 		$(this).css('min-height',tallestColumn);
4902		    	 		if($(this).is('[data-animation*="reveal"]')) $(this).find('.column-inner').css('min-height',tallestColumn);
4903		    	 	}
4904	    	 	});
4905
4906			}	
4907		});
4908
4909		//using equal height option, top/bottom padding % needs to be convered into px for cross browser (flex bug)
4910		$('.wpb_row.vc_row-o-equal-height>.span_12>.wpb_column[class*="padding-"][data-padding-pos="all"]').each(function(){
4911			$(this).css({ 'padding-top': $(this).css('padding-left'), 'padding-bottom': $(this).css('padding-left')});
4912		});
4913		
4914	}
4915	
4916	fullWidthContentColumns();
4917	if($('.owl-carousel').length > 0) owlCarouselInit();
4918
4919
4920var $mouseParallaxScenes = [];
4921function mouseParallaxInit(){
4922	$('.wpb_row:has(.nectar-parallax-scene)').each(function(i){
4923
4924		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').height();
4925		
4926		/*
4927		if($(this).hasClass('first-section')) { 
4928			$('body #header-outer[data-transparent-header="true"] .ns-loading-cover').show();
4929			
4930			if($('body #header-outer[data-transparent-header="true"]').length > 0) { 
4931				$(this).css('overflow','hidden');
4932				$(this).find('.nectar-slider-loading').css({
4933					'top': $headerNavSpace,
4934					'margin-top' : '-1px'
4935				});
4936				$(this).find('.nectar-slider-loading .loading-icon').css({
4937					'height' :  $('.first-section .nectar-parallax-scene').height() - $headerNavSpace + 'px',
4938					'opacity' : '1'
4939				});
4940			}
4941		} */
4942
4943		var $strength = parseInt($(this).find('.nectar-parallax-scene').attr('data-scene-strength'));
4944
4945		$mouseParallaxScenes[i] = $(this).find('.nectar-parallax-scene').parallax({
4946			scalarX: $strength,
4947	  		scalarY: $strength
4948		});
4949
4950		//wait until the images in the scene have loaded
4951		var images = $(this).find('.nectar-parallax-scene li');
4952		
4953		$.each(images, function(){
4954			if($(this).find('div').length > 0) {
4955			    var el = $(this).find('div'),
4956			    image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, '');
4957			    if(image && image !== '' && image !== 'none')
4958			        images = images.add($('<img>').attr('src', image));
4959			}
4960		});
4961
4962		var $that = $(this);
4963		
4964		/* images.imagesLoaded(function(){
4965
4966			$that.find('> .nectar-slider-loading, .full-page-inner > .nectar-slider-loading').fadeOut(800,'easeInOutExpo');
4967			if($that.hasClass('first-section')) { 
4968				$('body #header-outer[data-transparent-header="true"] .ns-loading-cover').fadeOut(800,'easeInOutExpo',function(){
4969    				$(this).remove();
4970    			});
4971			}
4972		}); */
4973
4974	});
4975}
4976mouseParallaxInit();
4977
4978
4979	
4980/***************** Checkmarks ******************/
4981
4982function ulChecks() {
4983	$('ul.checks li').prepend('<i class="icon-ok-sign"></i>');
4984}
4985ulChecks();
4986
4987/***************** Image with Animation / Col Animation *******************/
4988
4989
4990	
4991function colAndImgAnimations(){
4992
4993	$colAndImgOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '88%';
4994	$colAndImgOffsetPos2 = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '70%';
4995
4996	$($fullscreenSelector+'img.img-with-animation').each(function() {
4997		
4998		var $that = $(this);
4999		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
5000		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
5001
5002		var waypoint = new Waypoint({
5003 			element: $that,
5004 			 handler: function(direction) {
5005			   
5006					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
5007						 waypoint.destroy();
5008						return;
5009					}
5010
5011					if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
5012				
5013						if($that.attr('data-animation') == 'fade-in-from-left'){
5014							$that.delay($that.attr('data-delay')).transition({
5015								'opacity' : 1,
5016								'x' : '0px'
5017							},$animationDuration, $animationEasing);
5018						} else if($that.attr('data-animation') == 'fade-in-from-right'){
5019							$that.delay($that.attr('data-delay')).transition({
5020								'opacity' : 1,
5021								'x' : '0px'
5022							},$animationDuration, $animationEasing);
5023						} else if($that.attr('data-animation') == 'fade-in-from-bottom'){
5024							$that.delay($that.attr('data-delay')).transition({
5025								'opacity' : 1,
5026								'y' : '0px'
5027							},$animationDuration, $animationEasing);
5028						} else if($that.attr('data-animation') == 'fade-in') {
5029							$that.delay($that.attr('data-delay')).transition({
5030								'opacity' : 1
5031							},$animationDuration, $animationEasing);	
5032						} else if($that.attr('data-animation') == 'grow-in') {
5033							setTimeout(function(){ 
5034								$that.transition({ scale: 1, 'opacity':1 },$animationDuration,$animationEasing);
5035							},$that.attr('data-delay'));
5036						}
5037						else if($that.attr('data-animation') == 'flip-in') {
5038							setTimeout(function(){ 
5039								$that.transition({  rotateY: 0, 'opacity':1 },$animationDuration, $animationEasing);
5040							},$that.attr('data-delay'));
5041						}
5042						else if($that.attr('data-animation') == 'flip-in-vertical') {
5043							setTimeout(function(){ 
5044								$that.transition({  rotateX: 0, 'opacity':1 },$animationDuration, $animationEasing);
5045							},$that.attr('data-delay'));
5046						}
5047
5048						$that.addClass('animated-in');
5049						
5050					}
5051
5052					waypoint.destroy();
5053
5054			  },
5055			  offset: $colAndImgOffsetPos
5056		});
5057
5058		
5059	
5060	});
5061
5062
5063	$($fullscreenSelector+'.nectar_cascading_images').each(function() {
5064		
5065		var $that = $(this);
5066		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
5067		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
5068		var $animationDelay = ($(this).is('[data-animation-timing]')) ? $(this).attr('data-animation-timing') : 175;
5069		$animationDelay = parseInt($animationDelay);
5070
5071		var waypoint = new Waypoint({
5072 			element: $that,
5073 			 handler: function(direction) {
5074			   
5075					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
5076						 waypoint.destroy();
5077						return;
5078					}
5079
5080					if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
5081					
5082						$that.find('.cascading-image').each(function(i){
5083
5084							var $that2 = $(this);
5085
5086							if($that2.attr('data-animation') == 'flip-in' || $that2.attr('data-animation') == 'flip-in-vertical') {
5087								setTimeout(function(){
5088									$that2.find('.inner-wrap').css({
5089										'opacity' : 1,
5090										'transform' : 'rotate(0deg) translateZ(0px)'
5091									});
5092								}, i* $animationDelay);
5093							} else {
5094								setTimeout(function(){
5095									$that2.find('.inner-wrap').css({
5096										'opacity' : 1,
5097										'transform' : 'translateX(0px) translateY(0px) scale(1,1) translateZ(0px)'
5098									});
5099								}, i* $animationDelay);
5100							}
5101					
5102
5103						});
5104
5105						$that.addClass('animated-in');
5106						
5107					}
5108
5109					waypoint.destroy();
5110
5111			  },
5112			  offset: $colAndImgOffsetPos
5113		});
5114
5115		
5116	
5117	});
5118	
5119
5120	
5121	$($fullscreenSelector+'.col.has-animation:not([data-animation*="reveal"]), '+$fullscreenSelector+'.wpb_column.has-animation:not([data-animation*="reveal"]), '+$fullscreenSelector+'.nectar-fancy-box.has-animation').each(function(i) {
5122	    
5123		var $that = $(this);
5124		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
5125		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
5126
5127		//set perspective for vertical flip
5128		if($that.is('[data-animation="flip-in-vertical"]')) {
5129			$that.parents('.col.span_12').addClass('flip-in-vertical-wrap');
5130		}
5131
5132		var waypoint = new Waypoint({
5133 			element: $that,
5134 			 handler: function(direction) {
5135				
5136				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
5137					 waypoint.destroy();
5138					return;
5139				}
5140
5141				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
5142				 	
5143				 	
5144					if($that.attr('data-animation') == 'fade-in-from-left'){
5145						$standAnimatedColTimeout[i] = setTimeout(function(){ 
5146							$that.transition({
5147								'opacity' : 1,
5148								'x' : '0px'
5149							},$animationDuration,$animationEasing);
5150						},$that.attr('data-delay'));
5151					} else if($that.attr('data-animation') == 'fade-in-from-right'){
5152						$standAnimatedColTimeout[i] = setTimeout(function(){ 
5153							$that.transition({
5154								'opacity' : 1,
5155								'x' : '0px'
5156							},$animationDuration,$animationEasing);
5157						},$that.attr('data-delay'));
5158					} else if($that.attr('data-animation') == 'fade-in-from-bottom'){
5159						$standAnimatedColTimeout[i] = setTimeout(function(){ 
5160							$that.transition({
5161								'opacity' : 1,
5162								'y' : '0px'
5163							},$animationDuration,$animationEasing);
5164						},$that.attr('data-delay'));
5165					} else if($that.attr('data-animation') == 'fade-in') {
5166						$standAnimatedColTimeout[i] = setTimeout(function(){ 
5167							$that.transition({
5168								'opacity' : 1
5169							},$animationDuration,$animationEasing);	
5170						},$that.attr('data-delay'));
5171					} else if($that.attr('data-animation') == 'grow-in') {
5172						$standAnimatedColTimeout[i] = setTimeout(function(){ 
5173							$that.transition({ scale: 1, 'opacity':1 },$animationDuration,$animationEasing);
5174						},$that.attr('data-delay'));
5175					} else if($that.attr('data-animation') == 'flip-in') {
5176						$standAnimatedColTimeout[i] = setTimeout(function(){ 
5177							$that.transition({  rotateY: 0, 'opacity':1 },$animationDuration, $animationEasing);
5178						},$that.attr('data-delay'));
5179					} else if($that.attr('data-animation') == 'flip-in-vertical') {
5180						$standAnimatedColTimeout[i] = setTimeout(function(){ 
5181							$that.transition({  rotateX: 0, y: 0, 'opacity':1 },$animationDuration, $animationEasing);
5182						},$that.attr('data-delay'));
5183					}
5184
5185					//boxed column hover fix
5186					if($that.hasClass('boxed')) {
5187						$that.addClass('no-pointer-events');
5188						setTimeout(function(){
5189							$that.removeClass('no-pointer-events');
5190						},parseInt($animationDuration) + parseInt($that.attr('data-delay')) + 30 );
5191					}
5192
5193					$that.addClass('animated-in');
5194				
5195				}
5196
5197				waypoint.destroy();
5198			},
5199			offset: $colAndImgOffsetPos
5200		});
5201	
5202	});
5203
5204	
5205	$($fullscreenSelector+'.wpb_column.has-animation[data-animation*="reveal"]').each(function() {
5206	    
5207		var $that = $(this);
5208		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
5209		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
5210
5211		var waypoint = new Waypoint({
5212 			element: $that,
5213 			 handler: function(direction) {
5214				
5215				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
5216					 waypoint.destroy();
5217					return;
5218				}
5219
5220				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
5221					
5222					if($that.attr('data-animation') == 'reveal-from-bottom' || $that.attr('data-animation') == 'reveal-from-top') {
5223						setTimeout(function(){ 
5224							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'); });
5225						},$that.attr('data-delay'));
5226					} else if($that.attr('data-animation') == 'reveal-from-right' || $that.attr('data-animation') == 'reveal-from-left') {
5227						setTimeout(function(){ 
5228							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'); });
5229						},$that.attr('data-delay'));
5230					} 
5231
5232					$that.addClass('animated-in');
5233				
5234				}
5235
5236				waypoint.destroy();
5237			},
5238			offset: $colAndImgOffsetPos2
5239		});
5240	
5241	}); 	
5242
5243	
5244}
5245
5246setTimeout(function(){ 
5247	//if($('.nectar-box-roll').length == 0) colAndImgAnimations();
5248},$animationOnScrollTimeOut); 	
5249
5250
5251function cascadingImageBGSizing() {
5252	$('.nectar_cascading_images').each(function(){
5253
5254		//handle max width for cascading images in equal height columns
5255		if($(this).parents('.vc_row-o-equal-height').length > 0 && $(this).parents('.wpb_column').length > 0) 
5256			$(this).css('max-width',$(this).parents('.wpb_column').width());
5257
5258		//set size for layers with no images
5259		$(this).find('.bg-color').each(function(){
5260			var $bgColorHeight = 0;
5261			var $bgColorWidth = 0;
5262			if($(this).parent().find('.img-wrap').length == 0) {
5263				$firstSibling = $(this).parents('.cascading-image').siblings('.cascading-image[data-has-img="true"]').first();
5264
5265				$firstSibling.css({'position':'relative', 'visiblity':'hidden'});
5266				$bgColorHeight = $firstSibling.find('.img-wrap').height();
5267				$bgColorWidth = $firstSibling.find('.img-wrap').width();
5268				if($firstSibling.index() == 0) {
5269					$firstSibling.css({'visiblity':'visible'});
5270				} else {
5271					$firstSibling.css({'position':'absolute', 'visiblity':'visible'});
5272				}
5273			} else {
5274				$bgColorHeight = $(this).parent().find('.img-wrap').height();
5275				$bgColorWidth = $(this).parent().find('.img-wrap').width();
5276			}
5277
5278			$(this).css({'height': $bgColorHeight,'width': $bgColorWidth});
5279		});
5280	});
5281}
5282
5283if($('.nectar_cascading_images').length > 0) {
5284	imagesLoaded($('.nectar_cascading_images'),function(instance){
5285		cascadingImageBGSizing();
5286	});
5287}
5288
5289function splitLineHeadings() {
5290
5291	$splitLineOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
5292	$($fullscreenSelector+'.nectar-split-heading').each(function() {
5293
5294		var $that = $(this);
5295		var $animationEasing = ($('body[data-cae]').length > 0) ? $('body').attr('data-cae') : 'easeOutSine';
5296		var $animationDuration = ($('body[data-cad]').length > 0) ? $('body').attr('data-cad') : '650';
5297
5298		var waypoint = new Waypoint({
5299				element: $that,
5300				 handler: function(direction) {
5301				
5302				if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
5303					 waypoint.destroy();
5304					return;
5305				}
5306
5307				if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) || $('body[data-responsive="0"]').length > 0) {
5308				 	
5309					
5310					$that.find('.heading-line').each(function(i){
5311						//if($that.parents('.first-section').length > 0 && $('body[data-aie="zoom-out"]').length > 0) i = i+4;
5312						$(this).find('> div').delay(i*70).transition({
5313							'y' : '0px'
5314						},$animationDuration,$animationEasing);
5315
5316					});
5317					
5318
5319					$that.addClass('animated-in');
5320				
5321				}
5322
5323				waypoint.destroy();
5324			},
5325			offset: $splitLineOffsetPos
5326		});
5327
5328	});
5329}
5330
5331	
5332/***************** Custom tablet default column widths  ******************/
5333	
5334	//add one-fourth class
5335	function oneFourthClasses() {
5336		$('.col.span_3, .vc_span3, .vc_col-sm-3').each(function(){
5337			if( !$(this).is('[data-t-w-inherits="small_desktop"]') ) {
5338				var $currentDiv = $(this);
5339				var $nextDiv = $(this).next('div');
5340				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') ) {
5341					$currentDiv.addClass('one-fourths clear-both');
5342					$nextDiv.addClass('one-fourths right-edge');
5343				}
5344			}
5345		});
5346		
5347		//make empty second 1/2 half columsn display right on iPad
5348		$('.span_12 .col.span_6').each(function(){
5349			if($(this).next('div').hasClass('span_6') && $.trim( $(this).next('div').html() ).length == 0 ) {
5350				$(this).addClass('empty-second')
5351			}
5352		}); 
5353		
5354	}
5355	oneFourthClasses();
5356	
5357/***************** Bar Graph ******************/
5358function progressBars(){
5359	$progressBarsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
5360	$($fullscreenSelector+'.nectar-progress-bar').parent().each(function(i){
5361		
5362		var $that = $(this);
5363		var waypoint = new Waypoint({
5364 			element: $that,
5365 			 handler: function(direction) {
5366			   
5367					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5368						 waypoint.destroy();
5369						return;
5370					}
5371
5372					if($progressBarsOffsetPos == '100%') $that.find('.nectar-progress-bar .bar-wrap').css('opacity','1');
5373
5374					$that.find('.nectar-progress-bar').each(function(i){
5375
5376
5377						var percent = $(this).find('span').attr('data-width');
5378						var $endNum = parseInt($(this).find('span strong i').text());
5379						var $that = $(this);
5380						
5381						$that.find('span').delay(i*90).transition({
5382							'width' : percent + '%'
5383						},1050, 'easeInOutQuint',function(){
5384						});
5385	
5386						setTimeout(function(){
5387
5388							var countOptions = { useEasing : false };
5389							var $countEle = $that.find('span strong i')[0];
5390							var numAnim = new CountUp($countEle, 0, $endNum,0,1,countOptions);
5391							numAnim.start();
5392
5393							$that.find('span strong').transition({
5394								'opacity' : 1
5395							},550, 'easeInCirc');
5396						}, (i*90) );
5397					
5398						////100% progress bar 
5399						if(percent == '100'){
5400							$that.find('span strong').addClass('full');
5401						}
5402					});
5403
5404					$that.addClass('completed');
5405
5406					waypoint.destroy();
5407
5408			  },
5409			  offset: $progressBarsOffsetPos
5410		});
5411
5412	});
5413}
5414
5415
5416/***************** Column Borders ******************/
5417function animatedColBorders(){
5418	$progressBarsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '75%';
5419	$($fullscreenSelector+'.wpb_column[data-border-animation="true"]').each(function(i){
5420
5421		var $that = $(this);
5422		var waypoint = new Waypoint({
5423 			element: $that,
5424 			 handler: function(direction) {
5425			   
5426					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5427						 waypoint.destroy();
5428						return;
5429					}
5430
5431					$borderDelay = ($that.attr('data-border-animation-delay').length > 0) ? parseInt($that.attr('data-border-animation-delay')) : 0;
5432					setTimeout(function(){
5433						$that.find('.border-wrap').addClass('animation');
5434						$that.find('.border-wrap').addClass('completed');
5435					},$borderDelay)
5436					
5437
5438					waypoint.destroy();
5439
5440			  },
5441			  offset: $progressBarsOffsetPos
5442		});
5443
5444	});
5445}
5446
5447/***************** Food Menu Item ******************/
5448function foodMenuItems() {
5449	$foodItemOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '80%';
5450	$($fullscreenSelector+'.nectar_food_menu_item').parent().each(function(i){
5451
5452		var $that = $(this);
5453		var waypoint = new Waypoint({
5454 			element: $that,
5455 			 handler: function(direction) {
5456			   
5457					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5458						 waypoint.destroy();
5459						return;
5460					}
5461
5462					$that.find('.nectar_food_menu_item').each(function(i){
5463
5464						var $that = $(this);
5465
5466						setTimeout(function(){
5467							$that.addClass('animated-in');
5468						},i*150);
5469						
5470					});
5471					
5472					waypoint.destroy();
5473
5474			  },
5475			  offset: $foodItemOffsetPos
5476		});
5477
5478	});
5479}
5480
5481
5482/***************** Dividers ******************/
5483function dividers() {
5484	$dividerOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
5485
5486	$($fullscreenSelector+'.divider-small-border[data-animate="yes"], '+$fullscreenSelector+'.divider-border[data-animate="yes"]').each(function(i){
5487
5488		var $lineDur = ($(this).hasClass('divider-small-border')) ? 1300 : 1500;
5489		var $that = $(this);
5490		var waypoint = new Waypoint({
5491 			element: $that,
5492 			 handler: function(direction) {
5493			   
5494					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5495						 waypoint.destroy();
5496						return;
5497					}
5498				
5499					$that.each(function(i){
5500
5501						$(this).css({'transform':'scale(0,1)', 'visibility': 'visible'});
5502						var $that = $(this);
5503						
5504						$that.delay($that.attr('data-animation-delay')).transition({
5505							'transform' : 'scale(1, 1)'
5506						},$lineDur, 'cubic-bezier(.18,1,.22,1)');
5507						
5508					});
5509
5510					$that.addClass('completed');
5511
5512					waypoint.destroy();
5513
5514			  },
5515			  offset: $dividerOffsetPos
5516		});
5517
5518	});
5519}
5520
5521//if($('.nectar-box-roll').length == 0) dividers();
5522
5523
5524/***************** Icon List ******************/
5525function iconList() {
5526	$iconListOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '250%' : '75%';
5527
5528	$($fullscreenSelector+'.nectar-icon-list[data-animate="true"]').each(function(i){
5529
5530		var $that = $(this);
5531		var waypoint = new Waypoint({
5532 			element: $that,
5533 			 handler: function(direction) {
5534			   
5535					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5536						 waypoint.destroy();
5537						return;
5538					}
5539				
5540					$that.each(function(i){
5541						
5542						var $listItemAnimationDelay = ( $that.is('[data-direction="horizontal"]') ) ? 100 : 300;
5543						
5544						$(this).find('.nectar-icon-list-item').each(function(i){
5545							var $thatt = $(this);
5546							setTimeout(function(){ $thatt.addClass('animated') },i*$listItemAnimationDelay);
5547						});
5548						
5549					});
5550
5551					$that.addClass('completed');
5552
5553					waypoint.destroy();
5554
5555			  },
5556			  offset: $iconListOffsetPos
5557		});
5558
5559	});
5560}
5561
5562//bg color match 
5563
5564function narrowParentBGC(element) {
5565	
5566	var narrowedBGC;
5567	
5568	if(element.parents('.wpb_column[data-bg-color*="#"]').length > 0 && element.parents('.wpb_column[data-bg-opacity="1"]').length > 0) {
5569		var narrowedBGC = element.parents('.wpb_column').attr('data-bg-color');
5570	}
5571	else if(element.parents('.wpb_row').length > 0 && element.parents('.wpb_row').find('.row-bg.using-bg-color').length > 0) {
5572		var narrowedBGC = element.parents('.wpb_row').find('.row-bg.using-bg-color').css('background-color');
5573	}
5574	else {
5575		if($('#nectar_fullscreen_rows').length > 0)
5576			var narrowedBGC = $('#nectar_fullscreen_rows > .wpb_row .full-page-inner-wrap').css('background-color');
5577		else 
5578			var narrowedBGC = $('.container-wrap').css('background-color');
5579	}
5580	
5581	return narrowedBGC;
5582	
5583}
5584
5585var nectarMatchingBGCss = '';
5586
5587//icon list
5588$('.nectar-icon-list[data-icon-style="border"], .nectar_icon_wrap[data-style="border-animation"][data-color*="extra-color-gradient-"]').each(function(i){
5589	
5590	var $bgColorToSet = narrowParentBGC($(this));
5591	
5592	if($(this).hasClass('nectar-icon-list')) 
5593		$(this).find('.list-icon-holder').css('background-color',$bgColorToSet);
5594	else {
5595		//must be set in css, can't manip pseudo
5596		$(this).addClass('instance-'+i);
5597		nectarMatchingBGCss += '.nectar_icon_wrap.instance-'+i+' .nectar_icon:before { background-color: '+$bgColorToSet+'!important; }';
5598	}
5599		
5600});
5601
5602//material gradient btns
5603$('body.material .nectar-button.see-through[class*="m-extra-color-gradient"]').each(function(i){
5604	
5605	var $bgColorToSet = narrowParentBGC($(this));
5606
5607	$(this).addClass('instance-'+i);
5608	nectarMatchingBGCss += '.nectar-button.see-through.instance-'+i+':after { background-color: '+$bgColorToSet+'!important; }';
5609	
5610});
5611
5612if(nectarMatchingBGCss.length > 0) {
5613	var head = document.head || document.getElementsByTagName('head')[0];
5614	var style = document.createElement('style');
5615
5616	style.type = 'text/css';
5617	if (style.styleSheet){
5618	  style.styleSheet.cssText = nectarMatchingBGCss;
5619	} else {
5620	  style.appendChild(document.createTextNode(nectarMatchingBGCss));
5621	}
5622
5623	head.appendChild(style);
5624}
5625
5626/***************** Hotspot ******************/
5627//add pulse animation
5628$('.nectar_image_with_hotspots[data-hotspot-icon="numerical"]').each(function(){
5629	$(this).find('.nectar_hotspot_wrap').each(function(i){
5630		var $that = $(this);
5631		setTimeout(function(){
5632			$that.find('.nectar_hotspot').addClass('pulse');
5633		},i*300);	
5634	});
5635});
5636
5637
5638
5639function hotSpotHoverBind() {
5640
5641	var hotSpotHoverTimeout = [];
5642
5643	$('.nectar_image_with_hotspots:not([data-tooltip-func="click"]) .nectar_hotspot').each(function(i){
5644		
5645		hotSpotHoverTimeout[i] = '';
5646
5647		$(this).on('mouseover', function(){
5648			clearTimeout(hotSpotHoverTimeout[i]);
5649			$(this).parent().css({'z-index':'400', 'height':'auto','width':'auto'});
5650		});
5651
5652		$(this).on('mouseleave', function(){
5653
5654			var $that = $(this);
5655			$that.parent().css({'z-index':'auto'});
5656
5657			hotSpotHoverTimeout[i] = setTimeout(function(){
5658				$that.parent().css({'height':'30px','width':'30px'});
5659			},300);
5660
5661		});
5662
5663	});
5664
5665}
5666
5667hotSpotHoverBind();
5668
5669function responsiveTooltips() {
5670
5671	$('.nectar_image_with_hotspots').each(function(){
5672		$(this).find('.nectar_hotspot_wrap').each(function(i){
5673			
5674			if(  window.innerWidth > 690) {
5675
5676				//remove click if applicable
5677				if($(this).parents('.nectar_image_with_hotspots[data-tooltip-func="hover"]').length > 0) {
5678					$(this).find('.nectar_hotspot').removeClass('click');
5679					$(this).find('.nttip').removeClass('open');
5680				}
5681				$(this).find('.nttip .inner a.tipclose').remove();
5682				$('.nttip').css('height','auto');
5683
5684				//reset for positioning
5685				$(this).css({'width': 'auto','height': 'auto'});
5686				$(this).find('.nttip').removeClass('force-right').removeClass('force-left').removeClass('force-top').css('width','auto');
5687
5688				var $tipOffset = $(this).find('.nttip').offset();
5689
5690				//against right side fix
5691				if($tipOffset.left > $(this).parents('.nectar_image_with_hotspots').width() - 200)
5692					$(this).find('.nttip').css('width','250px');
5693				else 
5694					$(this).find('.nttip').css('width','auto');
5695
5696				//responsive
5697				if($tipOffset.left < 0)
5698					$(this).find('.nttip').addClass('force-right');
5699				else if($tipOffset.left + $(this).find('.nttip').outerWidth(true) >  window.innerWidth )
5700					$(this).find('.nttip').addClass('force-left').css('width','250px');
5701				else if($tipOffset.top + $(this).find('.nttip').height() + 35 > $(window).height() && $('#nectar_fullscreen_rows').length > 0)
5702					$(this).find('.nttip').addClass('force-top');
5703
5704				if($(this).find('> .open').length == 0)
5705					$(this).css({'width': '30px','height': '30px'});
5706
5707			} else {
5708				//fixed position
5709				$(this).find('.nttip').removeClass('force-left').removeClass('force-right').removeClass('force-top');
5710				$(this).find('.nectar_hotspot').addClass('click');
5711			
5712				if($(this).find('.nttip a.tipclose').length == 0)
5713					$(this).find('.nttip .inner').append('<a href="#" class="tipclose"><span></span></a>');
5714
5715				//change height of fixed
5716				$('.nttip').css('height',$(window).height());
5717			}
5718		});
5719	});
5720
5721
5722}
5723responsiveTooltips();
5724
5725function imageWithHotspotClickEvents() {
5726	//click
5727	$('body').on('click','.nectar_hotspot.click',function(){
5728		$(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
5729		$(this).parent().find('.nttip').addClass('open');
5730
5731		$(this).parents('.nectar_image_with_hotspots').find('.nectar_hotspot').removeClass('open');
5732		$(this).parent().find('.nectar_hotspot').addClass('open');
5733
5734		if( window.innerWidth > 690) {
5735			$(this).parent().css({'z-index':'120', 'height':'auto','width':'auto'});
5736
5737			var $that = $(this);
5738
5739			setTimeout(function(){
5740				$that.parents('.nectar_image_with_hotspots').find('.nectar_hotspot_wrap').each(function(){
5741					if($(this).find('> .open').length == 0)
5742						$(this).css({'height':'30px','width':'30px', 'z-index':'auto'});
5743				});
5744			},300);
5745		}
5746
5747		if(  window.innerWidth <= 690) $(this).parents('.wpb_row, [class*="vc_col-"]').css('z-index','200');
5748
5749		return false;
5750	});
5751
5752	$('body').on('click','.nectar_hotspot.open',function(){
5753		$(this).parent().find('.nttip').removeClass('open');
5754		$(this).parent().find('.nectar_hotspot').removeClass('open');
5755
5756		$(this).parents('.wpb_row').css('z-index','auto');
5757
5758		return false;
5759	});
5760
5761	$('body').on('click','.nttip.open',function(){
5762		if(  window.innerWidth < 690) {
5763			$(this).parents('.nectar_image_with_hotspots').find('.nttip').removeClass('open');
5764			$(this).parents('.wpb_row').css('z-index','auto');
5765			return false;
5766		}
5767	});
5768}
5769imageWithHotspotClickEvents();
5770
5771function imageWithHotspots() {
5772
5773	$imageWithHotspotsOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '50%';
5774
5775	$($fullscreenSelector+'.nectar_image_with_hotspots[data-animation="true"]').each(function(i){
5776
5777		var $that = $(this);
5778		var waypoint = new Waypoint({
5779 			element: $that,
5780 			 handler: function(direction) {
5781			   
5782					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5783						 waypoint.destroy();
5784						return;
5785					}
5786
5787					$that.addClass('completed');
5788					$that.find('.nectar_hotspot_wrap').each(function(i){
5789						var $that2 = $(this);
5790						var $extrai = ($that2.parents('.col.has-animation').length > 0) ? 1 : 0;
5791						setTimeout(function(){
5792							$that2.addClass('animated-in');
5793						},175*(i+$extrai));
5794					});
5795
5796					waypoint.destroy();
5797
5798			  },
5799			  offset: $imageWithHotspotsOffsetPos
5800		});
5801
5802	});
5803}
5804
5805
5806/***************** Animated Title ******************/
5807function animated_titles() {
5808	$animatedTitlesOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
5809
5810	$($fullscreenSelector+'.nectar-animated-title').each(function(i){
5811
5812		var $that = $(this);
5813		var waypoint = new Waypoint({
5814 			element: $that,
5815 			 handler: function(direction) {
5816			   
5817					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('completed')) { 
5818						 waypoint.destroy();
5819						return;
5820					}
5821
5822					$that.addClass('completed');
5823
5824					waypoint.destroy();
5825
5826			  },
5827			  offset: $animatedTitlesOffsetPos
5828		});
5829
5830	});
5831}
5832
5833
5834/***************** Highlighted Text ******************/
5835function highlighted_text() {
5836	$highlightedTextOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : 'bottom-in-view';
5837
5838	$($fullscreenSelector+'.nectar-highlighted-text').each(function(i){
5839		
5840		/*custom color*/
5841		if($(this).is('[data-using-custom-color="true"]')) {
5842			
5843				var highlightedColorCss = '';
5844				var $custom_highlight_color = $(this).attr('data-color');
5845			
5846				$(this).addClass('instance-'+i);
5847			
5848				highlightedColorCss += '.nectar-highlighted-text.instance-' + i + ' em:before { background-color: ' + $custom_highlight_color + '; }';
5849			
5850				if(highlightedColorCss.length > 1) {
5851		
5852					var head = document.head || document.getElementsByTagName('head')[0];
5853					var style = document.createElement('style');
5854		
5855						style.type = 'text/css';
5856					if (style.styleSheet){
5857					  style.styleSheet.cssText = highlightedColorCss;
5858					} else {
5859					  style.appendChild(document.createTextNode(highlightedColorCss));
5860					}
5861		
5862					head.appendChild(style);
5863				}
5864			
5865		}
5866		
5867		if(nectarDOMInfo.usingMobileBrowser) {
5868			$(this).find('em').addClass('animated');
5869		}
5870		
5871		/*waypoint*/
5872		var $that = $(this);
5873		var waypoint = new Waypoint({
5874 			element: $that,
5875 			 handler: function(direction) {
5876			   
5877					if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated')) { 
5878						 waypoint.destroy();
5879						return;
5880					}
5881					
5882					$that.find('em').each(function(i){
5883						var $highlighted_em = $(this);
5884						setTimeout(function(){
5885							$highlighted_em.addClass('animated');
5886						},i*300);
5887
5888					});
5889
5890					waypoint.destroy();
5891
5892			  },
5893			  offset: $highlightedTextOffsetPos
5894		});
5895
5896	});
5897}
5898
5899
5900
5901/***************** Pricing Tables ******************/
5902
5903
5904var $tallestCol;
5905
5906function pricingTableHeight(){
5907	$('.pricing-table[data-style="default"]').each(function(){
5908		$tallestCol = 0;
5909		
5910		$(this).find('> div ul').each(function(){
5911			($(this).height() > $tallestCol) ? $tallestCol = $(this).height() : $tallestCol = $tallestCol;
5912		});	
5913		
5914		//safety net incase pricing tables height couldn't be determined
5915		if($tallestCol == 0) $tallestCol = 'auto';
5916		
5917		//set even height
5918		$(this).find('> div ul').css('height',$tallestCol);
5919
5920	});
5921}
5922
5923pricingTableHeight();
5924
5925 
5926/***************** Testimonial Slider ******************/
5927
5928//testimonial slider controls
5929
5930//non minimal
5931$('body').on('click','.testimonial_slider:not([data-style*="multiple_visible"]):not([data-style="minimal"]) .controls li', function(){
5932	
5933	if($(this).find('span').hasClass('active')) return false;
5934	
5935	var $index = $(this).index();
5936	var currentHeight = $(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).height();
5937	
5938	$(this).parents('.testimonial_slider').find('li span').removeClass('active');
5939	$(this).find('span').addClass('active');
5940	
5941	$(this).parents('.testimonial_slider').find('.slides blockquote').addClass('no-trans');
5942	$(this).parents('.testimonial_slider').find('.slides blockquote').css({'opacity':'0', 'transform': 'translateX(-25px)', 'z-index': '1'});
5943	$(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).removeClass('no-trans').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
5944	$(this).parents('.testimonial_slider:not(.disable-height-animation)').find('.slides').stop(true,true).animate({'height' : currentHeight + 40 + 'px' },450,'easeOutCubic');
5945	
5946	resizeVideoToCover();
5947});
5948
5949//minimal
5950$('body').on('click','.testimonial_slider[data-style="minimal"] .testimonial-next-prev a', function(){
5951	
5952	var $index = $(this).parents('.testimonial_slider').find('.slides blockquote.active').index();
5953	var $actualIndex = $index;
5954
5955	$(this).parents('.testimonial_slider').find('.slides blockquote').addClass('no-trans');
5956	$(this).parents('.testimonial_slider').find('.slides blockquote').css({'opacity':'0', 'transform': 'translateX(-25px)', 'z-index': '1'});
5957
5958
5959	$(this).parents('.testimonial_slider').find('.slides blockquote').eq($index).removeClass('active');
5960
5961	if($(this).hasClass('next')) {
5962		if($index+1 >= $(this).parents('.testimonial_slider').find('.slides blockquote').length) { 
5963			$actualIndex = 0; 
5964		} else {
5965			$actualIndex = $index+1; 
5966		}
5967		var currentHeight = $(this).parents('.testimonial_slider').find('.slides blockquote').eq($actualIndex).height();
5968		//show slide
5969		$(this).parents('.testimonial_slider').find('.slides blockquote').eq($actualIndex).addClass('active').removeClass('no-trans').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
5970		//change pag #
5971		$(this).parents('.testimonial_slider').find('.control-wrap ul').css({'transform':'translateX(-'+(20*$actualIndex)+'px)'});
5972	} else {
5973		if($index-1 == -1) { 
5974			$actualIndex = $(this).parents('.testimonial_slider').find('.slides blockquote').length-1; 
5975		} else {
5976			$actualIndex = $index-1; 
5977		}
5978		var currentHeight = $(this).parents('.testimonial_slider').find('.slides blockquote').eq($index-1).height();
5979		//show slide
5980		$(this).parents('.testimonial_slider').find('.slides blockquote').eq($index-1).addClass('active').removeClass('no-trans').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
5981		//change pag #
5982		$(this).parents('.testimonial_slider').find('.control-wrap ul').css({'transform':'translateX(-'+(20*$actualIndex)+'px)'});
5983	}
5984	
5985	
5986	$(this).parents('.testimonial_slider:not(.disable-height-animation)').find('.slides').stop(true,true).animate({'height' : currentHeight + 40 + 'px' },450,'easeOutCubic');
5987	
5988	resizeVideoToCover();
5989
5990	return false;
5991});
5992
5993
5994var $tallestQuote;
5995
5996//create controls
5997function createTestimonialControls() {
5998
5999	//fadeIn
6000	$('.testimonial_slider:not([data-style*="multiple_visible"])').animate({'opacity':'1'},800);
6001
6002	$('.testimonial_slider:not([data-style*="multiple_visible"])').each(function(i){
6003		
6004		if($(this).find('blockquote').length > 1 && $(this).find('.controls').length == 0) {
6005			$(this).append('<div class="controls"><ul></ul></div>');
6006			
6007			var slideNum = $(this).find('blockquote').length;
6008			var $that = $(this);
6009			
6010			for(var i=0;i<slideNum;i++) {
6011
6012				if( !$(this).is('[data-style="minimal"]') ) {
6013					$that.find('.controls ul').append('<li><span class="pagination-switch"></span></li>');
6014				} else {
6015					$that.find('.controls ul').append('<li>'+(i+1)+'</li>');
6016				}
6017			}
6018			
6019			//minimal
6020			if( $(this).is('[data-style="minimal"]') ) {
6021
6022				//add next/prev
6023				$(this).append('<div class="testimonial-next-prev"><a href="#" class="prev fa fa-angle-left"></a><a href="#" class="next fa fa-angle-right"></a></div>');
6024
6025				//start on first
6026				$(this).find('.slides blockquote:first-child').addClass('active').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
6027				if(	!$(this).hasClass('disable-height-animation') ) {
6028					$(this).find('.slides').css({'height' : $(this).find('.slides blockquote:first-child').height() + 40 + 'px' });
6029				}
6030
6031				//autorotate
6032				if($(this).attr('data-autorotate').length > 0) {
6033					slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
6034					var $that = $(this);
6035					var $rotate = setInterval(function(){ testimonialRotate($that) },slide_interval);
6036				}
6037				$(this).find('.testimonial-next-prev a').click(function(e){
6038					if(typeof e.clientX != 'undefined') clearInterval($rotate);
6039				});
6040
6041				//wrap bullets
6042				$(this).find('.controls ul').wrap('<div class="control-wrap" />');
6043				$(this).find('.controls ul').css('width', (($(this).find('.controls ul li').length * 20) +1) + 'px');
6044				$(this).find('.controls').append('<span class="out-of">/</span><span class="total">'+$(this).find('blockquote').length+'</span>');
6045
6046				////swipe for testimonials
6047				$(this).swipe({
6048				
6049					swipeLeft : function(e) {
6050						$(this).find('.testimonial-next-prev .next').trigger('click');
6051						e.stopImmediatePropagation();
6052						clearInterval($rotate);
6053						return false;
6054					 },
6055					 swipeRight : function(e) {
6056						$(this).find('.testimonial-next-prev .prev').trigger('click');
6057						e.stopImmediatePropagation();
6058						clearInterval($rotate);
6059						return false;
6060					 }    
6061				});
6062
6063
6064			}
6065
6066			//non minimal
6067			if( !$(this).is('[data-style="minimal"]') ) {
6068
6069				//activate first slide
6070				$(this).find('.controls ul li').first().click();
6071
6072				//autorotate
6073				if($(this).attr('data-autorotate').length > 0) {
6074					slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
6075					var $that = $(this);
6076					var $rotate = setInterval(function(){ testimonialRotate($that) },slide_interval);
6077				}
6078				
6079				$(this).find('.controls li').click(function(e){
6080					if(typeof e.clientX != 'undefined') clearInterval($rotate);
6081				});
6082				
6083				////swipe for testimonials
6084				$(this).swipe({
6085				
6086					swipeLeft : function(e) {
6087						$(this).find('.controls ul li span.active').parent().next('li').find('span').trigger('click');
6088						e.stopImmediatePropagation();
6089						clearInterval($rotate);
6090						return false;
6091					 },
6092					 swipeRight : function(e) {
6093						$(this).find('.controls ul li span.active').parent().prev('li').find('span').trigger('click');
6094						e.stopImmediatePropagation();
6095						clearInterval($rotate);
6096						return false;
6097					 }    
6098				});
6099
6100		}
6101		} 
6102		//only one testimonial
6103		else if($(this).find('.controls').length == 0) {
6104			var currentHeight = $(this).find('.slides blockquote').height();
6105			$(this).find('.slides blockquote').css({'opacity':'0', 'transform': 'translateX(-25px)', 'z-index': '1'});
6106			$(this).find('.slides blockquote').css({'opacity':'1', 'transform': 'translateX(0px)'}).css('z-index','20');
6107			$(this).find('.slides').stop(true,true).animate({'height' : currentHeight + 20 + 'px' },450,'easeOutCubic');
6108		}
6109	});
6110
6111
6112
6113		
6114	$('.testimonial_slider[data-style*="multiple_visible"] .slides').each(function(){
6115	    	var $that = $(this); 
6116	    	var $element = $that;
6117	    	var $autoplay = ($that.parents('.testimonial_slider').attr('data-autorotate').length > 1 && parseInt($that.parents('.testimonial_slider').attr('data-autorotate')) > 100) ? parseInt($that.parents('.testimonial_slider').attr('data-autorotate')) : false;
6118			if($that.find('img').length == 0) $element = $('body');
6119
6120			//move img pos
6121			if( $(this).parents('.testimonial_slider').attr('data-style') != 'multiple_visible_minimal') {
6122				$(this).find('blockquote').each(function(){
6123					$(this).find('.image-icon').insertAfter($(this).find('p'));
6124				});
6125			} else {
6126				//has alf class
6127				if($(this).find('blockquote').length > 4) {
6128					$(this).parents('.testimonial_slider').addClass('has-alf');
6129				}
6130			}
6131			
6132			var $testimonialGroupCells = ($(this).parents('.testimonial_slider').attr('data-style') == 'multiple_visible_minimal') ? true : false;
6133
6134			imagesLoaded($element,function(instance){
6135
6136		    	$that.flickity({
6137		    		contain: true,
6138					  draggable: true,
6139					  groupCells: $testimonialGroupCells,
6140					  lazyLoad: false,
6141					  imagesLoaded: true,
6142					  percentPosition: true,
6143					  prevNextButtons: false,
6144					  pageDots: true,
6145					  resize: true,
6146					  setGallerySize: true,
6147					  wrapAround: true,
6148					  autoPlay: $autoplay,
6149					  accessibility: false
6150		    	});
6151
6152			    $that.parents('.testimonial_slider').css('opacity','1');
6153			    
6154
6155		     });//images loaded
6156		     	     
6157	    });//each	
6158
6159
6160}
6161createTestimonialControls();
6162
6163function testimonialRotate(slider){
6164	
6165	var $testimonialLength = slider.find('li').length;
6166	var $currentTestimonial = slider.find('.pagination-switch.active').parent().index();
6167	
6168	//stop the rotation when toggles are closed
6169	if( slider.parents('.toggle').length > 0 && slider.parents('.toggle').hasClass('open') ) {
6170
6171		if( !slider.is('[data-style="minimal"]') ) {
6172			if( $currentTestimonial+1 == $testimonialLength) {
6173				slider.find('ul li:first-child').click();
6174			} else {
6175				slider.find('.pagination-switch.active').parent().next('li').click();
6176			}
6177		} else {
6178			slider.find('.testimonial-next-prev .next').click();
6179		}
6180			
6181	} else {
6182		
6183		if( !slider.is('[data-style="minimal"]') ) {
6184			if( $currentTestimonial+1 == $testimonialLength) {
6185				slider.find('ul li:first-child').click();
6186			} else {
6187				slider.find('.pagination-switch.active').parent().next('li').click();
6188			}
6189		} else {
6190			slider.find('.testimonial-next-prev .next').click();
6191		}
6192	
6193	}
6194
6195}
6196
6197function testimonialHeightResize(){
6198	$('.testimonial_slider:not(.disable-height-animation):not([data-style*="multiple_visible"])').each(function(){
6199		
6200		var $index = $(this).find('.controls ul li span.active').parent().index();
6201		var currentHeight = $(this).find('.slides blockquote').eq($index).height();
6202		$(this).find('.slides').stop(true,true).css({'height' : currentHeight + 40 + 'px' });
6203		
6204	});
6205}
6206
6207
6208function testimonialSliderHeight() {
6209		
6210	$('.testimonial_slider.disable-height-animation:not([data-style*="multiple_visible"])').each(function(){
6211		$tallestQuote = 0;
6212			
6213		$(this).find('blockquote').each(function(){
6214			($(this).height() > $tallestQuote) ? $tallestQuote = $(this).height() : $tallestQuote = $tallestQuote;
6215		});	
6216		
6217		//safety net incase height couldn't be determined
6218		if($tallestQuote == 0) $tallestQuote = 100;
6219		
6220		//set even height
6221		$(this).find('.slides').css('height',$tallestQuote+40+'px');
6222		
6223		//show the slider once height is set
6224		$(this).animate({'opacity':'1'});
6225
6226		fullWidthContentColumns();
6227
6228	});
6229
6230
6231}
6232
6233function testimonialSliderHeightMinimalMult() {
6234		
6235	$('.testimonial_slider[data-style="multiple_visible_minimal"]').each(function(){
6236		$tallestQuote = 0;
6237		
6238		$(this).find('blockquote > .inner p').css('height','auto');
6239		
6240		$(this).find('blockquote > .inner p').each(function(){
6241			($(this).height() > $tallestQuote) ? $tallestQuote = $(this).height() : $tallestQuote = $tallestQuote;
6242		});	
6243		
6244		//safety net incase height couldn't be determined
6245		if($tallestQuote == 0) $tallestQuote = 200;
6246		
6247		//set even height
6248		$(this).find('blockquote > .inner p').css('height',$tallestQuote+'px');
6249		
6250	});
6251
6252}
6253
6254if($('.testimonial_slider.disable-height-animation:not([data-style*="multiple_visible"])').length > 0) {
6255	testimonialSliderHeight(); 
6256	setTimeout(testimonialSliderHeight,500);
6257}
6258
6259if($('.testimonial_slider[data-style="multiple_visible_minimal"]').length > 0) {
6260	testimonialSliderHeightMinimalMult();
6261	setTimeout(testimonialSliderHeightMinimalMult,500);
6262}
6263
6264
6265/***************** WP Media Embed / External Embed ******************/
6266
6267//this isn't the for the video shortcode* This is to help any external iframe embed fit & resize correctly 
6268function responsiveVideoIframesInit(){
6269	$('iframe').each(function(){
6270		
6271		//make sure the iframe has a src (things like adsense don't)
6272		if(typeof $(this).attr('src') != 'undefined' && !$(this).hasClass('iframe-embed') && $(this).parents('.ult_modal').length == 0 && $(this).parents('.ls-slide').length == 0 && $(this).parents('.esg-entry-media').length == 0 && $(this).parents('.wpb_video_widget.wpb_content_element').length == 0){
6273			
6274			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) {
6275				
6276				$(this).addClass('iframe-embed');	
6277
6278				$(this).attr('data-aspectRatio', $(this).height() / $(this).width()).removeAttr('height').removeAttr('width');
6279				
6280				if($(this).parents('.post-area.masonry.classic').length > 0) {
6281						$(this).attr('data-aspectRatio', '0.56').removeAttr('height').removeAttr('width');
6282				}
6283				//add wmode=transparent to all youytube embeds to fix z-index issues in IE
6284				/*if($(this).attr('src').indexOf('wmode=transparent') == -1) {
6285					if($(this).attr('src').indexOf('?') == -1){
6286						$(this).attr('src',$(this).attr('src') + '?wmode=transparent');
6287					} else {
6288						$(this).attr('src',$(this).attr('src') + '&wmode=transparent');
6289					}
6290				} */
6291			}
6292			 
6293		} else {
6294			//if($(this).parents('ins').length == 0){ 
6295			//	$(this).wrap('<div class="iframe-embed-standard"/>');	
6296			//}
6297		}
6298		
6299	});
6300
6301
6302}
6303
6304function responsiveVideoIframes(){
6305	 $('iframe[data-aspectRatio]').each(function() {
6306	 	var newWidth = $(this).parent().width();
6307	 	 
6308		var $el = $(this);
6309		
6310		//in nectar slider
6311		if($(this).parents('.swiper-slide').length > 0) {
6312			if($(this).is(':visible')) $el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
6313		} 
6314		//all others
6315		else {
6316			$el.width(newWidth).height(newWidth * $el.attr('data-aspectRatio'));
6317		}
6318		
6319		
6320	});
6321}
6322
6323
6324function videoshortcodeSize(){
6325	$('.wp-video').each(function(){
6326
6327
6328		//if($(this).find('.mejs-poster-img').length > 0){
6329		//	$(this).attr('data-aspectRatio', parseInt($(this).find('.mejs-poster-img').height()) / parseInt($(this).find('.wp-video-shortcode').css('width')));
6330		//} else {
6331		//	$(this).attr('data-aspectRatio', parseInt($(this).find('.mejs-overlay').height()) / parseInt($(this).find('.wp-video-shortcode').css('width')));
6332
6333		//}
6334
6335		//var newWidth = $(this).width();
6336	 	 
6337		//var $el = $(this).find('.wp-video-shortcode');
6338		//$(this).width(newWidth).height(newWidth * $(this).attr('data-aspectRatio'));
6339		//$(this).find('.mejs-container').css('height','100%');
6340	});
6341}
6342
6343responsiveVideoIframesInit();
6344responsiveVideoIframes();
6345
6346
6347//unwrap post and protfolio videos
6348$('.video-wrap iframe').unwrap();
6349$('#sidebar iframe[src]').unwrap();
6350
6351//$('video:not(.slider-video)').attr('width','100%');
6352//$('video:not(.slider-video)').attr('height','100%'); 
6353
6354$('audio').attr('width','100%');
6355$('audio').attr('height','100%');
6356
6357$('audio').css('visibility','visible');
6358
6359if($('body').hasClass('mobile')){
6360	$('video').css('visibility','hidden');
6361} else {
6362	$('video').css('visibility','visible');
6363}
6364
6365
6366$('.wp-video').each(function(){
6367	 video = $(this).find('video').get(0);
6368	 video.addEventListener('loadeddata', function() {
6369	   videoshortcodeSize();
6370	   $(window).trigger('resize');
6371	 }, false);
6372});
6373
6374//webkit video back button fix 
6375$('.main-content iframe[src]').each(function(){
6376	//$(this).attr('src',$(this).attr('src'));
6377	$(this).css({'opacity':'1', 'visibility':'visible'});
6378});
6379
6380
6381/***************** Nectar Video BG ******************/
6382
6383	$('.wpb_row:has(".nectar-video-wrap"):not(.fp-section)').each(function(i){
6384		$(this).css('z-index',100 + i);
6385	});
6386
6387	var min_w = 1200; // minimum video width allowed
6388	var vid_w_orig;  // original video dimensions
6389	var vid_h_orig;
6390	
6391    vid_w_orig = 1280;
6392    vid_h_orig = 720;
6393 
6394	function resizeVideoToCover() {
6395		$('.nectar-video-wrap').each(function(i){
6396			if($(this).find('video').length == 0 ) return;
6397
6398			if($(this).parents('#page-header-bg').length > 0) {
6399				if($('.container-wrap.auto-height').length > 0) return false;
6400				var $containerHeight = $(this).parents('#page-header-bg').outerHeight();			
6401				var $containerWidth = $(this).parents('#page-header-bg').outerWidth();
6402			} else {
6403				var $containerHeight = $(this).parents('.wpb_row').outerHeight();			
6404				var $containerWidth = ($(this).parents('.full-width-section').length > 0) ? window.innerWidth : $(this).parents('.wpb_row').outerWidth();			
6405			}
6406			
6407		    // set the video viewport to the window size
6408		    $(this).width($containerWidth);
6409				if($(this).parents('#page-header-bg').length > 0) {
6410			    $(this).height($containerHeight);
6411				}
6412		
6413		    // use largest scale factor of horizontal/vertical
6414		    var scale_h = $containerWidth / vid_w_orig;
6415		    var scale_v = ($containerHeight - $containerHeight) / vid_h_orig; 
6416		    var scale = scale_h > scale_v ? scale_h : scale_v;
6417			
6418			//update minium width to never allow excess space
6419		    min_w = 1280/720 * ($containerHeight+40);
6420		    
6421		    // don't allow scaled width < minimum video width
6422		    if (scale * vid_w_orig < min_w) {scale = min_w / vid_w_orig;}
6423		        
6424		    // now scale the video
6425		    $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig +0));
6426		    $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig +0));
6427		    
6428		    // and center it by scrolling the video viewport
6429		    $(this).scrollLeft(($(this).find('video').width() - $containerWidth) / 2);
6430		    $(this).scrollTop(($(this).find('video').height() - ($containerHeight)) / 2);
6431		    $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - ($containerHeight)) / 2);
6432
6433
6434		    //align bottom
6435		    if($(this).attr('data-bg-alignment') == 'center bottom' || $(this).attr('data-bg-alignment') == 'bottom'){
6436		    	$(this).scrollTop(($(this).find('video').height() - ($containerHeight+6)));
6437		    }
6438		    //align top
6439		    else if($(this).attr('data-bg-alignment') == 'center top' || $(this).attr('data-bg-alignment') == 'top') {
6440		    	$(this).scrollTop(0);
6441		    } 
6442				
6443				//add loaded class
6444				$(this).addClass('position-loaded');
6445		});
6446	}
6447    
6448    //init
6449    function videoBGInit(){
6450	    setTimeout(function(){
6451	    	resizeVideoToCover();
6452	    	$('.video-color-overlay').each(function(){
6453	    		$(this).css('background-color',$(this).attr('data-color'));
6454	    	});
6455	    	$('.nectar-video-wrap').each(function(i){
6456
6457	    		if($(this).find('video').length == 0) return;
6458
6459	    		var $headerVideo = ($(this).parents('#page-header-bg').length > 0) ? true : false;
6460	    		var $that = $(this);
6461
6462	    		 var videoReady = setInterval(function(){
6463
6464	        		if($that.find('video').get(0).readyState > 3) {
6465								
6466								if(!nectarDOMInfo.usingMobileBrowser) {
6467		        			$that.transition({'opacity':'1'},400);
6468				    			$that.find('video').transition({'opacity':'1'},400);
6469				    			$that.parent().find('.video-color-overlay').transition({'opacity':'0.7'},400);
6470									if($headerVideo == true) {
6471					    			pageHeaderTextEffect();
6472								  }
6473								}
6474
6475							//remove page loading screen
6476							$('#ajax-loading-screen').addClass('loaded');
6477							setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
6478					
6479
6480							clearInterval(videoReady);
6481						}
6482						
6483	    		},60);
6484					
6485					if(nectarDOMInfo.usingMobileBrowser) {
6486						if($that.parents('.full-width-section').length > 0) {
6487							$that.css('left','50%');
6488						} else {
6489							$that.css('left','0px');
6490						}
6491						
6492						if($headerVideo == true) {
6493							pageHeaderTextEffect();
6494						}
6495						$that.find('video')[0].onplay = function(){
6496							$that.transition({'opacity':'1'},400);
6497							$that.find('video').transition({'opacity':'1'},400);
6498							$that.parent().find('.video-color-overlay').transition({'opacity':'0.7'},400);
6499						};
6500					}
6501	    		
6502	    	});
6503	    },300);
6504
6505		if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)){
6506
6507				
6508				$('.nectar-video-wrap').each(function(){
6509					
6510						if(!$(this).find('video').is('[muted]')) {
6511
6512								//autoplay not supported unless muted
6513								$(this).parent().find('.mobile-video-image').show();
6514								$(this).remove();
6515						}
6516						
6517				});
6518		
6519		
6520		}
6521
6522		
6523		 if(navigator.userAgent.indexOf('Chrome') > 0 && !/Edge\/12./i.test(navigator.userAgent) && !/Edge\/\d./i.test(navigator.userAgent)) { 
6524		 	
6525		 	$('.nectar-video-wrap').each(function(i){
6526		 		if(jQuery(this).find('video source[type="video/webm"]').length > 0 ) {
6527				  	var webmSource = jQuery(this).find('video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
6528		          	var firstVideo = jQuery(this).find('video').get(0);
6529		          	firstVideo.src = webmSource;
6530		          	firstVideo.load();
6531		         }
6532            });
6533	    }
6534
6535
6536
6537
6538	    jQuery(".vc_row").each(function() {
6539	        var youtubeUrl, youtubeId, $row = jQuery(this);
6540	        $row.find('.nectar-youtube-bg').length > 0 ? (youtubeUrl = $row.find('.nectar-youtube-bg span').text(), youtubeId = nectarExtractYoutubeId(youtubeUrl), youtubeId && ($row.find(".vc_video-bg").remove(), nectarInsertYoutubeVideoAsBackgroun
6540d($row.find('.nectar-youtube-bg'), youtubeId))) : $row.find(".nectar-youtube-bg").remove()
6541
6542	        //remove yt url
6543	        $row.find('.nectar-youtube-bg span').remove();
6544					
6545					if(!nectarDOMInfo.usingMobileBrowser) {
6546		        $row.find('.nectar-video-wrap, .nectar-youtube-bg').css({'opacity':'1','width':'100%', 'height':'100%'});
6547					}
6548	         $row.find('.video-color-overlay').transition({'opacity':'0.7'},400);
6549	    });
6550		
6551
6552		function nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter) {
6553		    if ("undefined" == typeof YT || void 0 === YT.Player) return 100 < (counter = void 0 === counter ? 0 : counter) ? void console.warn("Too many attempts to load YouTube api") : void setTimeout(function() {
6554		        nectarInsertYoutubeVideoAsBackground($element, youtubeId, counter++)
6555		    }, 100);
6556		    var $container = $element.prepend('<div class="vc_video-bg"><div class="inner"></div></div>').find(".inner");
6557		    new YT.Player($container[0], {
6558		        width: "100%",
6559		        height: "100%",
6560		        videoId: youtubeId,
6561		        playerVars: {
6562		            playlist: youtubeId,
6563		            iv_load_policy: 3,
6564		            enablejsapi: 1,
6565		            disablekb: 1,
6566		            autoplay: 1,
6567		            controls: 0,
6568		            showinfo: 0,
6569		            rel: 0,
6570		            loop: 1
6571		        },
6572		        events: {
6573		            onReady: function(event) {
6574		                event.target.mute().setLoop(!0);
6575										nectarResizeVideoBackground($element);
6576		            }
6577		        }
6578		    }), nectarResizeVideoBackground($element), jQuery(window).bind("resize", function() {
6579		        nectarResizeVideoBackground($element);
6580		    });
6581				
6582				setTimeout(function(){
6583					 nectarResizeVideoBackground($element);
6584				},100);
6585		}
6586
6587		function nectarResizeVideoBackground($element) {
6588		    var iframeW, iframeH, marginLeft, marginTop, containerW = $element.innerWidth(),
6589		        containerH = $element.innerHeight(),
6590		        ratio1 = 16,
6591		        ratio2 = 9;
6592		    ratio1 / ratio2 > containerW / containerH ? (iframeW = containerH * (ratio1 / ratio2), 
6593		    	iframeH = containerH, marginLeft = -Math.round((iframeW - containerW) / 2) + "px", marginTop = -Math.round((iframeH - containerH) / 2) + "px", iframeW += "px", iframeH += "px") : (iframeW = containerW, iframeH = containerW * (ratio2 / ratio1), marginTop = -Math.round((iframeH - containerH) / 2) + "px", 
6594		    	marginLeft = -Math.round((iframeW - containerW) / 2) + "px", iframeW += "px", iframeH += "px"), 
6595		    	$element.find(".vc_video-bg iframe").css({
6596			        maxWidth: "1000%",
6597			        marginLeft: marginLeft,
6598			        marginTop: marginTop,
6599			        width: iframeW,
6600			        height: iframeH
6601			    })
6602		}
6603
6604		function nectarExtractYoutubeId(url) {
6605		    if ("undefined" == typeof url) return !1;
6606		    var id = url.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/);
6607		    return null !== id ? id[1] : !1
6608		}
6609
6610
6611	}
6612
6613	if($('.nectar-video-wrap').length > 0 || $('.nectar-youtube-bg').length > 0) {
6614		videoBGInit();
6615	}
6616
6617
6618/*-------------------------------------------------------------------------*/
6619/*	4.	Header + Search
6620/*-------------------------------------------------------------------------*/	 
6621
6622////mobile megamenus without titles / nested groupings
6623$mobileNavSelector = ($('.off-canvas-menu-container.mobile-only').length > 0) ? '.off-canvas-menu-container.mobile-only ': '#mobile-menu .container ';
6624$($mobileNavSelector+'.megamenu > ul > li > a').each(function(){
6625	if( $(this).text() == '–' ) {
6626		$navLIs = $(this).parent().find('> ul > li').clone();
6627		$(this).parent().find('ul').remove();
6628		$(this).parent().parent().append($navLIs);
6629		$(this).parent().remove();
6630	}
6631});
6632
6633/***************** Slide Out Widget Area **********/
6634
6635var $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;
6636var $bodyBorderWidth = ($('.body-border-right').length > 0) ? $('.body-border-right').width() : 0;
6637var $resetHeader;
6638
6639
6640function mobileBreakPointCheck() {
6641	var $mobileBreakpoint = ( $('body[data-header-breakpoint]').length > 0 && $('body').attr('data-header-breakpoint') != '1000' ) ? parseInt($('body').attr('data-header-breakpoint')) : 1000;
6642	var $withinCustomBreakpoint = false;
6643
6644	if($mobileBreakpoint != 1000) {
6645		if( $('body[data-user-set-ocm="1"][data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0 && window.innerWidth > 1000 && window.innerWidth <= $mobileBreakpoint ) {
6646			$withinCustomBreakpoint = true;
6647		}
6648	}
6649
6650	return $withinCustomBreakpoint;
6651}
6652
6653//icon effect html creation
6654if($('#slide-out-widget-area.slide-out-from-right-hover').length > 0) {
6655
6656	if($('#ajax-content-wrap > .slide-out-widget-area-toggle').length == 0) {
6657		$('<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');
6658		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');
6659	}
6660
6661
6662	function calculateHoverNavMinHeight() {
6663		$widgetHeights = 0;
6664		$('#slide-out-widget-area > .widget').each(function(){
6665			$widgetHeights += $(this).height();
6666		});
6667		$menuHeight = ( ($('#slide-out-widget-area').height() - 25 - $('.bottom-meta-wrap').outerHeight(true) -$widgetHeights) > $('#slide-out-widget-area .off-canvas-menu-container:last-child').height() ) ? $('#slide-out-widget-area').height() - 25 - $('.bottom-meta-wrap').outerHeight(true) -$widgetHeights : $('#slide-out-widget-area .off-canvas-menu-container:last-child').height();
6668
6669		$('#slide-out-widget-area .inner').css({'height':'auto', 'min-height': $menuHeight  });
6670
6671		$('#slide-out-widget-area.slide-out-from-right-hover > .inner .off-canvas-menu-container').transition({ y : '-' + ($('#slide-out-widget-area.slide-out-from-right-hover > .inner .off-canvas-menu-container:last-child').height()/2) + 'px' },0);
6672	
6673	}
6674
6675	function openRightHoverNav() {
6676
6677		
6678
6679			calculateHoverNavMinHeight();
6680
6681			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && $('#slide-out-widget-area.open').length > 0) {
6682				mobileCloseNavCheck();
6683				return;
6684			}
6685			
6686
6687			$('#slide-out-widget-area').css({ 'transform': 'translate3d(0,0,0)' }).addClass('open');
6688
6689			var $bodyBorderHeaderColorMatch = ($('.body-border-top').length > 0 && $('.body-border-top').css('background-color') == '#ffffff' && $('body').attr('data-header-color') == 'light' || $('.body-border-top').length > 0 && $('.body-border-top').css('background-color') == $('#header-outer').attr('data-user-set-bg')) ? true : false;
6690
6691			//icon effect
6692			////set pos 
6693			if($('header#top .container .span_9 > .slide-out-widget-area-toggle').length > 0) {
6694				
6695				var secondaryBarHeight = ($('#header-secondary-outer').length > 0) ? $('#header-secondary-outer').height() : 0; 
6696				
6697
6698				if($('body.mobile').length > 0) {
6699
6700					$('.slide-out-hover-icon-effect').css({'top': $('header#top .span_9 > .slide-out-widget-area-toggle a').offset().top - $(window).scrollTop(), 'right': parseInt($('#header-outer header > .container').css('padding-right')) + 1 });
6701				} else {
6702
6703					if($bodyBorderHeaderColorMatch) {
6704
6705						var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1;
6706						$('.slide-out-hover-icon-effect').css({
6707							'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')), 
6708							'right': 29 + $extraCushion });
6709
6710					} else {
6711
6712						var $withinCustomBreakpoint = mobileBreakPointCheck();
6713
6714						if($('body.ascend').length > 0 && $withinCustomBreakpoint != true) {
6715							var $extraCushion = ($('#header-outer[data-has-menu="false"]').length > 0) ? 2 : 1;
6716							$('.slide-out-hover-icon-effect').css({'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($('header#top nav >ul .slide-out-widget-area-toggle a').css('padding-top')), 'right': parseInt($('#header-outer header >.container').css('padding-right')) + $extraCushion });
6717						} else {
6718
6719							if($('body.material').length > 0) {
6720								if($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) {
6721									var $nectarHamMenuPos = ($('header#top .span_9 > .slide-out-widget-area-toggle').css('display') == 'block') ? $('#header-outer header#top > .container .span_9 > .slide-out-widget-area-toggle.mobile-icon').position() : $('header#top .span_3 .right-side .slide-out-widget-area-toggle > div').offset();
6722									if($('#header-secondary-outer.hide-up').length > 0) { secondaryBarHeight = 0; }
6723									$('.slide-out-hover-icon-effect').css({'top': secondaryBarHeight + parseInt($nectarHamMenuPos.top) - nectarDOMInfo.scrollTop , 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2  });
6724								} else {
6725									var $nectarHamMenuPos = ($('header#top .span_9 > .slide-out-widget-area-toggle').css('display') == 'block') ? $('#header-outer header#top > .container .span_9 > .slide-out-widget-area-toggle.mobile-icon').position() : $('header#top nav .buttons .slide-out-widget-area-toggle > div').position();
6726									if($('#header-secondary-outer.hide-up').length > 0) { secondaryBarHeight = 0; }
6727									$('.slide-out-hover-icon-effect').css({'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($nectarHamMenuPos.top) , 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 2  });
6728								}
6729								
6730								
6731							} else {
6732								$menuToggleSelector = ($('header#top nav > ul .slide-out-widget-area-toggle').length > 0 && $('header#top nav > ul .slide-out-widget-area-toggle').css('display') != 'none') ? $('header#top nav > ul .slide-out-widget-area-toggle') : $('body header#top .span_9 >.slide-out-widget-area-toggle');
6733								$('.slide-out-hover-icon-effect').css({'top': nectarDOMInfo.adminBarHeight + secondaryBarHeight + parseInt($menuToggleSelector.css('padding-top')) + parseInt($('#header-outer').css('padding-top')), 'right': parseInt($('#header-outer header >.container').css('padding-right')) + 1 + parseInt($menuToggleSelector.css('margin-right')) });
6734							}
6735						}
6736					}
6737					
6738				}
6739			}
6740
6741			////open
6742
6743			$('.slide-out-hover-icon-effect .lines-button').removeClass('no-delay').addClass('unhidden-line');
6744			
6745
6746			if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#nectar_fullscreen_rows').length == 0) {
6747
6748				if(!($(window).scrollTop() == 0 && $('#header-outer.transparent').length > 0)) {
6749
6750					if($('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6751
6752						$('#header-outer').attr('data-transparent','true').addClass('no-bg-color').addClass('slide-out-hover');
6753						$('#header-outer header, #header-outer > .cart-outer').addClass('all-hidden');
6754					}
6755
6756				}
6757
6758				if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6759					var headerResize = $('#header-outer').attr('data-header-resize');
6760					if(headerResize == 1) {
6761
6762						$(window).off('scroll',bigNav);
6763						$(window).off('scroll',smallNav);
6764
6765
6766					} else {
6767						
6768						$(window).off('scroll',opaqueCheck);
6769						$(window).off('scroll',transparentCheck);
6770					}
6771				}
6772
6773			}
6774
6775			if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
6776				$(window).on('mousemove.rightOffsetCheck',closeNavCheck);
6777			}
6778
6779	}
6780
6781	function closeNavCheck(e) {
6782		var $windowWidth = $(window).width();
6783		if(e.clientX < $windowWidth - 340 - $bodyBorderWidth) {
6784
6785				$(window).off('mousemove.rightOffsetCheck',closeNavCheck);
6786
6787				$('#slide-out-widget-area').css({ 'transform': 'translate3d(341px,0,0)' }).removeClass('open');
6788
6789				$('#header-outer').removeClass('style-slide-out-from-right');
6790
6791				$('.slide-out-hover-icon-effect .lines-button').removeClass('unhidden-line').addClass('no-delay');
6792
6793				var $bodyBorderHeaderColorMatch = ($('.body-border-top').length > 0 && $('.body-border-top').css('background-color') == '#ffffff' && $('body').attr('data-header-color') == 'light' || $('.body-border-top').length > 0 && $('.body-border-top').css('background-color') == $('#header-outer').attr('data-user-set-bg')) ? true : false;
6794
6795				if($('#header-outer[data-permanent-transparent="1"]').length == 0) {
6796
6797					if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6798
6799						if($('body.mobile').length == 0) {
6800							$('#header-outer').removeClass('no-bg-color');
6801							$('#header-outer header, #header-outer > .cart-outer').removeClass('all-hidden');
6802						}
6803					}
6804
6805					if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6806						var headerResize = $('#header-outer').attr('data-header-resize');
6807						if(headerResize == 1) {
6808						
6809							$(window).off('scroll.headerResizeEffect');
6810							if($(window).scrollTop() == 0) {
6811								$(window).on('scroll.headerResizeEffect',smallNav); 
6812
6813								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) {
6814									$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
6815										'padding' : '0'			
6816									},{queue:false, duration:250, easing: 'easeOutCubic'});	
6817								}
6818							}
6819							else {
6820								$(window).on('scroll.headerResizeEffect',bigNav);
6821							}
6822							
6823				
6824						} else {
6825							
6826							$(window).off('scroll.headerResizeEffectOpaque');
6827							$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
6828						}
6829					}
6830				}
6831
6832			}
6833
6834	}
6835
6836	function mobileCloseNavCheck(e) {
6837		
6838
6839				$('#slide-out-widget-area').css({ 'transform': 'translate3d(341px,0,0)' }).removeClass('open');
6840
6841				$('#header-outer').removeClass('style-slide-out-from-right');
6842
6843				$('.slide-out-hover-icon-effect .lines-button').removeClass('unhidden-line').addClass('no-delay');
6844
6845				if($('#header-outer[data-permanent-transparent="1"]').length == 0) {
6846
6847					$('#header-outer').removeClass('no-bg-color');
6848					$('#header-outer header').removeClass('all-hidden');
6849
6850				}
6851
6852				var $bodyBorderHeaderColorMatch = ($('.body-border-top').length > 0 && $('.body-border-top').css('background-color') == '#ffffff' && $('body').attr('data-header-color') == 'light' || $('.body-border-top').length > 0 && $('.body-border-top').css('background-color') == $('#header-outer').attr('data-user-set-bg')) ? true : false;
6853
6854				if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('body.mobile').length == 0 && $bodyBorderHeaderColorMatch) {
6855					
6856					var headerResize = $('#header-outer').attr('data-header-resize');
6857					if(headerResize == 1) {
6858					
6859						$(window).off('scroll.headerResizeEffect');
6860						if($(window).scrollTop() == 0) {
6861							$(window).on('scroll.headerResizeEffect',smallNav); 
6862
6863							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) {
6864								$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
6865									'padding' : '0'			
6866								},{queue:false, duration:250, easing: 'easeOutCubic'});	
6867							}
6868						}
6869						else {
6870							$(window).on('scroll.headerResizeEffect',bigNav);
6871						}
6872						
6873			
6874					} else {
6875						
6876						$(window).off('scroll.headerResizeEffectOpaque');
6877						$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
6878					}
6879			}
6880
6881			
6882
6883	}
6884
6885	//hover triggered
6886	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
6887		$('body').on('mouseenter','#header-outer .slide-out-widget-area-toggle:not(.std-menu) a',openRightHoverNav);
6888	}
6889	else {
6890		$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a',openRightHoverNav);
6891	}
6892
6893	$(window).on('smartresize',calculateHoverNavMinHeight);
6894
6895}
6896
6897
6898
6899function setMaterialWidth() {
6900	
6901	
6902	$('#slide-out-widget-area.slide-out-from-right').css({
6903		'padding-top' : $(window).height()*0.1,
6904		'padding-bottom' : $(window).height()*0.1
6905	});
6906
6907	slideOutWidgetOverflowState();
6908}
6909
6910if($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) {
6911	setMaterialWidth();
6912}
6913
6914//icon hover effect
6915if($('body.material').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length == 0) {
6916
6917	if($('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0) {
6918		var $menuIconClone = $('header#top nav ul .slide-out-widget-area-toggle a > span > i').clone();
6919		$menuIconClone.addClass('hover-effect');
6920		$('header#top nav ul .slide-out-widget-area-toggle a > span').append($menuIconClone);
6921
6922		var $menuIconClone2 = $('header#top .slide-out-widget-area-toggle.mobile-icon a > span > i').clone();
6923		$menuIconClone2.addClass('hover-effect');
6924		$('header#top .slide-out-widget-area-toggle.mobile-icon a > span').append($menuIconClone2);
6925	}
6926
6927	$('body:not([data-slide-out-widget-area-style="slide-out-from-right"]) header#top .slide-out-widget-area-toggle a > span').append($('<span class="close-wrap"> <span class="close-line close-line1"></span> <span class="close-line close-line2"></span> </span>'));
6928}
6929
6930if($('body.material #boxed').length > 0 && $('body[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0) {
6931	$('#ajax-content-wrap > .slide-out-widget-area-toggle.slide-out-hover-icon-effect.small').insertAfter('.ocm-effect-wrap');
6932}
6933
6934//move material skin default ocm
6935if($('body.material').length > 0 && $('body[data-slide-out-widget-area-style*="fullscreen"]').length == 0) {
6936	$('body.material #slide-out-widget-area.slide-out-from-right .slide_out_area_close').insertAfter('.ocm-effect-wrap');
6937	$('#slide-out-widget-area-bg').insertAfter('.ocm-effect-wrap');
6938	$('#slide-out-widget-area').insertAfter('.ocm-effect-wrap');
6939	
6940}
6941
6942//remove trans on material search/ocm when resizing 
6943if($('body.material[data-header-search="true"]').length > 0 || $('body.material .ocm-effect-wrap').length > 0 ) {
6944		
6945	var materialTransTO;
6946
6947	$(window).resize(function(){
6948
6949		clearTimeout(materialTransTO);
6950
6951		$('body[data-slide-out-widget-area-style="slide-out-from-right"] > a.slide_out_area_close, .material #header-outer, .ocm-effect-wrap, .ocm-effect-wrap-shadow').addClass('no-material-transition');
6952
6953		materialTransTO = setTimeout(function(){
6954			$('body[data-slide-out-widget-area-style="slide-out-from-right"] > a.slide_out_area_close, .material #header-outer, .ocm-effect-wrap, .ocm-effect-wrap-shadow').removeClass('no-material-transition');
6955		},250);
6956
6957		setMaterialWidth();
6958
6959	});
6960}
6961
6962
6963function materialOCM_Size() {
6964	if($('.ocm-effect-wrap.material-ocm-open').length > 0 ) {
6965
6966		//$('#ajax-content-wrap').css({'position' : 'relative', 'top' : '-' + $(window).scrollTop() + 'px' });
6967		$('.ocm-effect-wrap').css({'height': $(window).height() });
6968		$('.ocm-effect-wrap-inner').css({'padding-top': nectarDOMInfo.adminBarHeight });
6969		
6970		
6971	}
6972}
6973$(window).resize(materialOCM_Size);
6974
6975
6976function OCM_dropdown_function() {
6977	var $nectar_ocm_dropdown_func = ($('#slide-out-widget-area[data-dropdown-func]').length > 0) ? $('#slide-out-widget-area').attr('data-dropdown-func') : 'default';
6978	if($nectar_ocm_dropdown_func == 'separate-dropdown-parent-link') {
6979		$('#slide-out-widget-area .off-canvas-menu-container li.menu-item-has-children').append('<span class="ocm-dropdown-arrow"><i class="fa-angle-down"></i></span>');
6980	}
6981}
6982
6983OCM_dropdown_function();
6984
6985//click triggered
6986$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a.closed:not(.animating)',function(){
6987	if(animating == 'true' || $('.slide-out-from-right-hover').length > 0) return false;
6988	var $that = $(this);
6989
6990	$('#header-outer').removeClass('no-transition');
6991
6992	//slide out from right
6993	if($('#slide-out-widget-area').hasClass('slide-out-from-right')) {
6994
6995		$slideOutAmount = ($('.body-border-top').length > 0 && $('body.mobile').length == 0) ? $('.body-border-top').height() : 0;
6996
6997
6998		if($('body.material').length == 0) {
6999
7000				//calc height if used bottom meta
7001				$('#slide-out-widget-area .inner').css({'height':'auto', 'min-height': $('#slide-out-widget-area').height() - 25 - $('.bottom-meta-wrap').height() });
7002
7003				if($('#boxed').length == 0) {
7004					$('.container-wrap, .home-wrap, #header-secondary-outer, #footer-outer:not(#nectar_fullscreen_rows #footer-outer), .nectar-box-roll,   #page-header-wrap .page-header-bg-image,  #page-header-wrap .nectar-video-wrap, #page-header-wrap .mobile-video-image, #page-header-wrap #page-header-bg > .container, .page-header-no-bg, div:not(.container) > .project-title').stop(true).transition({ x: '-300px' },700,'easeInOutCubic');
7005
7006					var $withinCustomBreakpoint = mobileBreakPointCheck();
7007
7008					if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0 || $withinCustomBreakpoint) {
7009						if($('#header-outer[data-transparency-option="1"]').length == 0 || ($('#header-outer[data-transparency-option="1"]').length > 0 && $('#header-outer[data-full-width="true"]').length == 0) || $('body.mobile').length > 0) {
7010							$('#header-outer').stop(true).css('transform','translateY(0)').transition({ x: '-' + (300+$slideOutAmount) +'px'},700,'easeInOutCubic');
7011						} else {
7012							$('#header-outer').stop(true).css('transform','translateY(0)').transition({ x: '-' + (300+$slideOutAmount) +'px', 'background-color':'transparent', 'border-bottom': '1px solid rgba(255,255,255,0.22)' },700,'easeInOutCubic');
7013						}
7014					} else {
7015						$('#header-outer header#top nav > ul.buttons, body:not(.material) #header-outer .cart-outer .cart-menu-wrap').transition({ x: '-300px'},700,'easeInOutCubic');
7016					}
7017
7018					$('#ascrail2000').transition({ 'x': '-' + (300+$slideOutAmount) +'px' },700,'easeInOutCubic');
7019					$('body:not(.ascend):not(.material) #header-outer .cart-menu').stop(true).transition({ 'x': '300px' },700,'easeInOutCubic');
7020				}
7021
7022				$('#slide-out-widget-area').stop(true).transition({ x: '-' + $slideOutAmount +'px' },700,'easeInOutCubic').addClass('open');
7023
7024
7025				if($('#boxed').length == 0) {
7026					//full width menu adjustments
7027					if($('#header-outer[data-full-width="true"]').length > 0 && !$('body').hasClass('mobile')) { 
7028						$('#header-outer').addClass('highzI'); 
7029						$('#ascrail2000').addClass('z-index-adj');
7030
7031						if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
7032							if($bodyBorderWidth == 0)
7033								$('header#top #logo').stop(true).transition({ x: (300+$slideOutAmount) +'px' },700,'easeInOutCubic'); 
7034							
7035							//$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': $(window).width() - 360, 'left': '300px' },700,'easeInOutCubic');
7036
7037						}
7038
7039						$('header#top .slide-out-widget-area-toggle .lines-button').addClass('close');
7040
7041						if($('#header-outer[data-remove-border="true"]').length > 0) {
7042							$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '64px' },700,'easeInOutCubic');
7043						} else {
7044							$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '89px' },700,'easeInOutCubic'); 
7045						}
7046
7047						$('body #header-outer nav > ul > li > a').css({'margin-bottom':'0'});
7048						
7049					}
7050				}
7051
7052				$('#header-outer').addClass('style-slide-out-from-right');
7053
7054				//fade In BG Overlay
7055				$('#slide-out-widget-area-bg').css({'height':'100%','width':'100%'}).stop(true).transition({
7056					'opacity' : 1
7057				},700,'easeInOutCubic',function(){
7058					$('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating');
7059				});
7060				
7061				//hide menu if no space
7062				if($('#header-outer[data-format="centered-logo-between-menu"]').length == 0) {
7063					$logoWidth = ($('#logo img:visible').length > 0) ? $('#logo img:visible').width() : $('#logo').width();
7064					if($('header#top nav > .sf-menu').offset().left - $logoWidth - 300 < 20) $('#header-outer').addClass('hidden-menu');
7065				} else {
7066					$('#header-outer').addClass('hidden-menu-items');
7067				}
7068
7069				var headerResize = $('#header-outer').attr('data-header-resize');
7070
7071				if($('#header-outer[data-remove-fixed="1"]').length == 0) {
7072					if($bodyBorderHeaderColorMatch == true && headerResize == 1) {
7073						
7074						$('#header-outer').stop(true).transition({ y: '0' },0).addClass('transparent').css('transition','transform');
7075						if($('#header-outer').attr('data-transparent-header') != 'true') {
7076							$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
7077						}
7078
7079						$(window).off('scroll',bigNav);
7080						//if($('.small-nav').length > 0 || $('#header-outer').hasClass('pseudo-data-transparent')) bigNav();
7081						$(window).off('scroll',smallNav);
7082
7083					} else if ($bodyBorderHeaderColorMatch == true) {
7084						$('#header-outer').addClass('transparent');
7085						$(window).off('scroll',opaqueCheck);
7086						$(window).off('scroll',transparentCheck);
7087
7088						if($('#header-outer').attr('data-transparent-header') != 'true') {
7089							$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
7090						}
7091					}
7092				}
7093
7094		} else if ( $('body.material').length > 0 ) {
7095
7096			//material
7097			
7098			//move ajax loading outside
7099			if($('#ajax-loading-screen').length > 0 && $('.ocm-effect-wrap #ajax-loading-screen').length > 0) {
7100				$('#ajax-loading-screen').insertBefore('.ocm-effect-wrap');
7101			}
7102			
7103			////hide secondary header when not at top with hhun
7104			if($(window).scrollTop() > 40) {
7105				
7106				$('body[data-hhun="1"] #header-secondary-outer').addClass('hidden');
7107			}
7108
7109
7110			setTimeout(function(){ $('.slide-out-widget-area-toggle:not(.std-menu) > div > a').removeClass('animating'); },300);
7111			$('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').addClass('material-open');
7112
7113
7114			//handle bottom bar nav
7115			if($('body:not(.mobile) #header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0  && $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none') {
7116				$('#header-outer:not(.fixed-menu)').css('top', nectarDOMInfo.adminBarHeight - $(window).scrollTop() + 'px' );
7117				
7118				if($('#header-secondary-outer').length > 0  && $('#header-outer.fixed-menu').length > 0) {
7119					$('#header-secondary-outer').css('visibility','hidden');
7120				}
7121				
7122			}
7123			
7124			$('#ajax-content-wrap').css({'position' : 'relative', 'top' : '-' + $(window).scrollTop() + 'px' });
7125			$('.ocm-effect-wrap-inner').css({'padding-top': nectarDOMInfo.adminBarHeight });
7126			$('#fp-nav').addClass('material-ocm-open');
7127			$('body').addClass('material-ocm-open');
7128			$('.ocm-effect-wrap').css({'height': window.innerHeight });
7129
7130			setTimeout(function(){
7131				$('.ocm-effect-wrap').addClass('material-ocm-open');
7132			},40);
7133			
7134			
7135			$('body > .slide_out_area_close').addClass('follow-body');
7136
7137			//icon effect
7138			$('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('effect-shown');
7139
7140			//handle hhun when at top
7141			$('body[data-hhun="1"]:not(.no-scroll):not(.mobile) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({'transition':'none', 'transform':'translateY('+ nectarDOMInfo.adminBarHeight +'px)'});
7142
7143			setTimeout(function(){
7144				$('body > .slide_out_area_close').addClass('material-ocm-open');
7145			},350);
7146
7147
7148		}
7149
7150
7151	}
7152     else if($('#slide-out-widget-area').hasClass('fullscreen')) {
7153
7154     	if ( $('body.material').length > 0 ) {
7155     		$('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out');
7156     	}
7157
7158		//scroll away from fixed reveal footer if shown (firefox bug with bluring over it)
7159		var $scrollDelay = 0;
7160		var $scrollDelay2 = 0;
7161
7162		if($(window).scrollTop() + $(window).height() > $('.blurred-wrap').height() && $('#nectar_fullscreen_rows').length == 0) {
7163			$('body,html').stop().animate({
7164				scrollTop: $('.blurred-wrap').height() - $(window).height()
7165			},600,'easeInOutCubic');
7166			$scrollDelay = 550;
7167			$scrollDelay2 = 200;
7168		}
7169
7170		$('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close');
7171		setTimeout(function(){ $('.blurred-wrap').addClass('blurred'); },$scrollDelay);
7172		$('#slide-out-widget-area.fullscreen').show().addClass('open');
7173
7174		if($('.nectar-social-sharing-fixed').length == 0) {
7175			hideToTop();
7176		}
7177
7178		//remove box shadow incase at the top of the page with nectar box roll above
7179		$('.container-wrap').addClass('no-shadow');
7180		$('#header-outer').stop(true).css('transform','translateY(0)');
7181
7182		setTimeout(function(){
7183
7184			$('.off-canvas-menu-container .menu > li').each(function(i){
7185				$(this).delay(i*50).transition({y: 0, 'opacity': 1},800,'easeOutExpo');
7186			});
7187
7188			$('#slide-out-widget-area.fullscreen .widget').each(function(i){
7189				$(this).delay(i*100).transition({y: 0, 'opacity': 1},800,'easeOutExpo');
7190			});
7191		},370+$scrollDelay2);
7192
7193		setTimeout(function(){
7194			$('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
7195
7196			$('#slide-out-widget-area .off-canvas-social-links li').each(function(i){
7197				$(this).delay(i*50).transition({'scale':1},400,'easeOutCubic');
7198			});
7199			$('#slide-out-widget-area .bottom-text').transition({'opacity':0.7},400,'easeOutCubic');
7200		},750+$scrollDelay2);
7201		
7202		//fade In BG Overlay
7203		setTimeout(function(){
7204			$easing = ($('body.mobile').length > 0) ? 'easeOutCubic' : 'easeInOutQuint';
7205			$('#slide-out-widget-area-bg').css({'height':'100%','width':'100%'}).show().stop(true).transition({
7206				'y' : '0%'
7207			},920,$easing,function(){
7208				$('.slide-out-widget-area-toggle > div > a').removeClass('animating');
7209			});
7210		},50+$scrollDelay2);
7211
7212		//overflow state 
7213		slideOutWidgetOverflowState();
7214		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').addClass('at-content');
7215		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());
7216	} 
7217
7218	else if($('#slide-out-widget-area').hasClass('fullscreen-alt')) {
7219
7220		if ( $('body.material').length > 0 ) {
7221     		$('header#top .slide-out-widget-area-toggle a').addClass('menu-push-out');
7222     	}
7223
7224		$('header#top .slide-out-widget-area-toggle:not(.std-menu) .lines-button').addClass('close');
7225		$('#slide-out-widget-area.fullscreen-alt').show().addClass('open');
7226		$('#slide-out-widget-area-bg').addClass('open');
7227
7228		$('body > div[class*="body-border"]').css('z-index','9995');
7229
7230		$('.off-canvas-menu-container .menu').transition({y: '0px', 'opacity': 1},0);	
7231
7232		if($('.nectar-social-sharing-fixed').length == 0) {
7233			hideToTop();
7234		}
7235
7236		if($('#header-outer.transparent').length == 0) {
7237
7238
7239		}
7240		else { 
7241
7242			//$('#header-outer-bg-only').hide();
7243			if($('.body-border-top').length > 0) {
7244				$('.admin-bar #slide-out-widget-area-bg.fullscreen-alt').css({'padding-top': ($('.body-border-top').outerHeight(true)+32) + 'px'});
7245				$('body:not(.admin-bar) #slide-out-widget-area-bg.fullscreen-alt').css({'padding-top': ($('.body-border-top').outerHeight(true))+ 'px'});
7246			}
7247		}
7248		
7249		//set translateY to 0 in all cases
7250		$('#header-outer').stop(true).css('transform','translateY(0)');
7251
7252		if($('#logo .starting-logo').length > 0 && $(window).width() > 1000 && $('#header-outer[data-format="centered-menu-bottom-bar"].fixed-menu').length == 0 && $('body.material #header-outer[data-condense="true"]').length == 0) {
7253			
7254			//$('#header-outer').addClass('no-transition').addClass('no-bg-color');
7255			
7256			$('#header-outer').stop(true).css('transform','translateY(0)').addClass('transparent');
7257			if($('#header-outer').attr('data-transparent-header') != 'true') {
7258				$('#header-outer').attr('data-transparent-header','true').addClass('pseudo-data-transparent');
7259			}
7260		}
7261
7262		$('.off-canvas-menu-container .clip-wrap').css('transition-duration','0s');
7263
7264		setTimeout(function(){
7265
7266			$('.off-canvas-menu-container .menu > li').each(function(i){
7267				$(this).delay(i*50).transition({y: 0, 'opacity': 1},750,'easeOutCubic').addClass('no-pointer-events');
7268			});
7269
7270			setTimeout(function(){
7271				$('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
7272				$('.off-canvas-menu-container .clip-wrap').css('transition-duration','.45s');
7273			},500);
7274			
7275		
7276
7277			$('#slide-out-widget-area.fullscreen-alt .widget').each(function(i){
7278				$(this).delay(i*100).transition({y: 0, 'opacity': 1},650,'easeOutCubic');
7279			});
7280		},200);
7281
7282		setTimeout(function(){
7283			$('#slide-out-widget-area .off-canvas-social-links').addClass('line-shown');
7284
7285			$('#slide-out-widget-area .off-canvas-social-links li').css('opacity','1').each(function(i){
7286				$(this).delay(i*50).transition({'scale':1},400,'easeOutCubic');
7287			});
7288			$('#slide-out-widget-area .bottom-text').transition({'opacity':1},600,'easeOutCubic');
7289		},200);
7290		
7291		//fade In BG Overlay
7292		if($('#slide-out-widget-area-bg').hasClass('solid')) $opacity = 1;
7293		if($('#slide-out-widget-area-bg').hasClass('dark')) $opacity = 0.97;
7294		if($('#slide-out-widget-area-bg').hasClass('medium')) $opacity = 0.6;
7295		if($('#slide-out-widget-area-bg').hasClass('light')) $opacity = 0.4;
7296		$('#slide-out-widget-area-bg').removeClass('no-transition');
7297		
7298
7299		$('#slide-out-widget-area-bg').addClass('padding-removed').css({'height':'100%','width':'100%', 'left':'0','opacity': $opacity});
7300		
7301
7302		setTimeout(function(){
7303			$('.slide-out-widget-area-toggle > div > a').removeClass('animating');
7304		},600);
7305			
7306		
7307
7308		//overflow state 
7309		slideOutWidgetOverflowState();
7310		if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').addClass('at-content');
7311		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());
7312	}
7313
7314
7315
7316	//add open class
7317	$('#header-outer').removeClass('side-widget-closed').addClass('side-widget-open');
7318
7319	//give header transparent state
7320	if($('#header-outer[data-transparency-option="1"]').length > 0 && $('#boxed').length == 0 && $('#header-outer[data-full-width="true"]').length > 0) {
7321			if($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length == 0 && $('body.material #header-outer[data-condense="true"]').length == 0) {
7322				$('#header-outer').addClass('transparent');
7323			}
7324	}
7325
7326	//dark slide transparent nav
7327	if($('#header-outer.dark-slide.transparent').length > 0  && $('#boxed').length == 0 && $('body.material-ocm-open').length == 0) $('#header-outer').removeClass('dark-slide').addClass('temp-removed-dark-slide');
7328	
7329	$('.slide-out-widget-area-toggle > div > a').removeClass('closed').addClass('open');
7330	$('.slide-out-widget-area-toggle > div > a').addClass('animating');
7331
7332	return false;
7333});
7334
7335$('body').on('click','.slide-out-widget-area-toggle:not(.std-menu) a.open:not(.animating), #slide-out-widget-area .slide_out_area_close,  > .slide_out_area_close, #slide-out-widget-area-bg.slide-out-from-right, .material-ocm-open #ajax-content-wrap',function(e){
7336
7337	if (e.originalEvent == undefined && $('.slide_out_area_close.non-human-allowed').length == 0 ) { return; }
7338
7339	if($('.slide-out-widget-area-toggle:not(.std-menu) a.animating').length > 0) return;
7340
7341	$('#header-outer').removeClass('no-transition');
7342
7343	
7344
7345	var $that = $(this);
7346
7347	$('.slide-out-widget-area-toggle:not(.std-menu) a').removeClass('open').addClass('closed');
7348	$('.slide-out-widget-area-toggle:not(.std-menu) a').addClass('animating');
7349
7350	//slide out from right
7351	if($('#slide-out-widget-area').hasClass('slide-out-from-right')) {
7352
7353			if($('body.material').length == 0) {
7354
7355				$('.container-wrap, .home-wrap, #header-secondary-outer, #footer-outer:not(#nectar_fullscreen_rows #footer-outer), .nectar-box-roll, #page-header-wrap .page-header-bg-image,  #page-header-wrap .nectar-video-wrap, #page-header-wrap .mobile-video-image, #page-header-wrap #page-header-bg > .container, .page-header-no-bg, div:not(.container) > .project-title').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
7356
7357				if($('#header-outer[data-transparency-option="1"]').length > 0  && $('#boxed').length == 0) {
7358					$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');
7359					$('#header-outer').stop(true).transition({ x: '0px', 'background-color': $currentRowBG },700,'easeInOutCubic');
7360				} else {
7361					$('#header-outer').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
7362				}
7363
7364				$('#ascrail2000').stop(true).transition({ 'x': '0px' },700,'easeInOutCubic');
7365				$('body:not(.ascend):not(.material) #header-outer .cart-menu').stop(true).transition({ 'x': '0px' },700,'easeInOutCubic');
7366
7367				$('#slide-out-widget-area').stop(true).transition({ x: '301px' },700,'easeInOutCubic').removeClass('open');
7368
7369
7370				if($('#boxed').length == 0) {
7371					if($('#header-outer[data-full-width="true"]').length > 0) {  
7372						$('#header-outer').removeClass('highzI'); 
7373						$('header#top #logo').stop(true).transition({ x: '0px' },700,'easeInOutCubic'); 
7374						//$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': '100%', 'left': '0' },700,'easeInOutCubic');
7375						$('.lines-button').removeClass('close');
7376
7377						$('body:not(.ascend) #header-outer[data-full-width="true"] header#top nav > ul.product_added').stop(true).transition({ x: '0px' },700,'easeInOutCubic');
7378
7379					}
7380				}
7381
7382				if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0) {
7383					$('#header-outer header#top nav > ul.buttons, #header-outer .cart-outer .cart-menu-wrap').stop(true).transition({ x: '0px' },700,'easeInOutCubic'); 
7384				}
7385
7386				//fade out overlay
7387				$('#slide-out-widget-area-bg').stop(true).transition({
7388					'opacity' : 0
7389				},700,'easeInOutCubic',function(){
7390					$('.slide-out-widget-area-toggle a').removeClass('animating');
7391					$(this).css({'height':'1px','width':'1px'});
7392
7393					if($('#header-outer[data-remove-fixed="1"]').length == 0) {
7394						//hide menu if transparent, user has scrolled down and hhun is on
7395						if($('#header-outer').hasClass('parallax-contained') && $(window).scrollTop() > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) {
7396							$('#header-outer').removeClass('parallax-contained').addClass('detached').removeClass('transparent');
7397						}
7398						else if($(window).scrollTop() == 0 && $('body[data-hhun="1"]').length > 0 && $('#page-header-bg[data-parallax="1"]').length > 0 ||
7399							$(window).scrollTop() == 0 && $('body[data-hhun="1"]').length > 0 && $('.parallax_slider_outer').length > 0) {
7400
7401							if($('#header-outer[data-transparency-option="1"]').length > 0) $('#header-outer').addClass('transparent');
7402							$('#header-outer').addClass('parallax-contained').removeClass('detached');
7403						}
7404					}
7405
7406					//fix for fixed subpage menu
7407					$('.container-wrap').css('transform','none');
7408				});
7409
7410
7411				$('#header-outer').removeClass('style-slide-out-from-right');
7412
7413
7414				var headerResize = $('#header-outer').attr('data-header-resize');
7415				if($('#header-outer[data-remove-fixed="1"]').length == 0) {
7416
7417					if($bodyBorderHeaderColorMatch == true && headerResize == 1) {
7418					
7419						$(window).off('scroll.headerResizeEffect');
7420						if($(window).scrollTop() == 0) {
7421							$(window).on('scroll.headerResizeEffect',smallNav); 
7422
7423							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) {
7424								$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
7425									'padding' : '0'			
7426								},{queue:false, duration:250, easing: 'easeOutCubic'});	
7427							}
7428						}
7429						else
7430							$(window).on('scroll.headerResizeEffect',bigNav); 
7431							//smallNav();
7432
7433						if($('#header-outer').hasClass('pseudo-data-transparent')) {
7434							$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
7435						}
7436
7437						$('#header-outer').css('transition','transform');
7438
7439					} else if ($bodyBorderHeaderColorMatch == true) {
7440						
7441						$(window).off('scroll.headerResizeEffectOpaque');
7442						$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
7443
7444						$('#header-outer').css('transition','transform');
7445
7446						if($('#header-outer').hasClass('pseudo-data-transparent')) {
7447							$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
7448						}
7449					}
7450				}
7451		}
7452
7453		else if ( $('body.material').length > 0 ) {
7454
7455			//material
7456			$('#slide-out-widget-area').removeClass('open');
7457
7458			$('#slide-out-widget-area, #slide-out-widget-area-bg, #header-outer .slide-out-widget-area-toggle').removeClass('material-open');
7459			$('.ocm-effect-wrap, .ocm-effect-wrap-shadow, body > .slide_out_area_close, #fp-nav').removeClass('material-ocm-open');
7460
7461			$('body > .slide_out_area_close').removeClass('follow-body');
7462
7463			setTimeout(function(){
7464				$('.slide-out-widget-area-toggle a').removeClass('animating');
7465				$('body').removeClass('material-ocm-open');
7466				$('.ocm-effect-wrap').css({'height': '100%'});
7467				$('.ocm-effect-wrap-inner').css({'padding-top': '0' });
7468				$(window).scrollTop(Math.abs( parseInt($('#ajax-content-wrap').css('top')) ) );
7469				$('#ajax-content-wrap').css({'position' : '', 'top' : '' });
7470				
7471
7472				//handle bottom bar nav
7473				if($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0 && $('#header-outer[data-format="centered-menu-bottom-bar"] .span_9').css('display') != 'none' && $('body.mobile').length == 0) {
7474					$('#header-outer:not(.fixed-menu)').css('top', '');
7475					$('#header-secondary-outer').css('visibility','');
7476				}
7477				
7478				//handle hhun when at top
7479				$('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({'transform':''});
7480				setTimeout(function(){
7481					$('body[data-hhun="1"]:not(.no-scroll) #header-outer[data-permanent-transparent="false"]:not(.detached):not(.parallax-contained):not(.at-top-before-box)').css({'transition':''});
7482				},30);
7483				
7484
7485				$('body[data-hhun="1"] #header-secondary-outer.hidden').removeClass('hidden');
7486
7487			},900);
7488
7489			setTimeout(function(){
7490				//icon effect
7491				$('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').addClass('no-trans').removeClass('effect-shown');
7492			},200);
7493
7494			setTimeout(function(){
7495				//icon
7496				$('#header-outer:not([data-format="left-header"]) header#top .slide-out-widget-area-toggle a').removeClass('no-trans')
7497			},500);
7498			
7499		}
7500
7501
7502	} 
7503
7504	else if($('#slide-out-widget-area').hasClass('fullscreen')) {
7505
7506
7507		if ( $('body.material').length > 0 ) {
7508			setTimeout(function(){
7509				$('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out');
7510			},350);
7511     	}
7512
7513		$('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close');
7514		//$('.slide-out-widget-area-toggle a').removeClass('animating');
7515		$('.blurred-wrap').removeClass('blurred');
7516		$('#slide-out-widget-area.fullscreen').transition({'opacity': 0 },700,'easeOutQuad',function(){ $('#slide-out-widget-area.fullscreen').hide().css('opacity','1'); }).removeClass('open');
7517		$('#slide-out-widget-area.fullscreen .widget').transition({'opacity': 0},700,'easeOutQuad',function(){
7518			$(this).transition({y: '110px'},0);
7519		});
7520
7521		setTimeout(function(){
7522			$('.off-canvas-menu-container .menu > li').transition({y: '80px', 'opacity': 0},0);		
7523			$('#slide-out-widget-area .off-canvas-social-links li').transition({'scale':0},0);
7524			$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
7525			$('#slide-out-widget-area .bottom-text').transition({'opacity':0},0);	
7526
7527			//close submenu items
7528			$('#slide-out-widget-area .menuwrapper .menu').removeClass( 'subview' );
7529			$('#slide-out-widget-area .menuwrapper .menu li').removeClass( 'subview subviewopen' );
7530			$('#slide-out-widget-area.fullscreen .inner .off-canvas-menu-container').css('height','auto');
7531		},800);
7532
7533		setTimeout(function(){
7534			if($('.nectar-social-sharing-fixed').length == 0) {
7535				showToTop();
7536			}
7537			$('.container-wrap').removeClass('no-shadow');
7538		},500);
7539
7540		//fade out overlay
7541		$('#slide-out-widget-area-bg').stop(true).transition({'opacity': 0},900,'easeOutQuad',function(){
7542			if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').removeClass('at-content');
7543			if($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) $('#slide-out-widget-area.fullscreen .inner-wrap').css('padding-top', '0');
7544			$('.slide-out-widget-area-toggle a').removeClass('animating');
7545			if($('#slide-out-widget-area-bg').hasClass('solid')) $opacity = 1;
7546			if($('#slide-out-widget-area-bg').hasClass('dark')) $opacity = 0.93;
7547			if($('#slide-out-widget-area-bg').hasClass('medium')) $opacity = 0.6;
7548			if($('#slide-out-widget-area-bg').hasClass('light')) $opacity = 0.4;
7549			$(this).css({'height':'1px','width':'1px', 'opacity': $opacity}).transition({ y : '-100%'},0);
7550		});
7551
7552		
7553	}
7554
7555	else if($('#slide-out-widget-area').hasClass('fullscreen-alt')) {
7556
7557
7558		if ( $('body.material').length > 0 ) {
7559			setTimeout(function(){
7560				$('header#top .slide-out-widget-area-toggle a').removeClass('menu-push-out');
7561			},350);
7562     	}
7563
7564		$('.slide-out-widget-area-toggle:not(.std-menu) .lines-button').removeClass('close');
7565		//$('.slide-out-widget-area-toggle a').removeClass('animating');
7566		$('.blurred-wrap').removeClass('blurred');
7567		$('#slide-out-widget-area-bg').removeClass('open');
7568		
7569		$('#slide-out-widget-area.fullscreen-alt .widget').transition({'opacity': 0},500,'easeOutQuad',function(){
7570			$(this).transition({y: '40px'},0);
7571		});
7572		$('#slide-out-widget-area .bottom-text, #slide-out-widget-area .off-canvas-social-links li').transition({'opacity': 0},250,'easeOutQuad');
7573		$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');
7574
7575		$('.off-canvas-menu-container .menu').transition({y: '-13px', 'opacity': 0},400);	
7576
7577
7578		setTimeout(function(){
7579			$('.off-canvas-menu-container .menu > li').stop(true,true).transition({y: '40px', 'opacity': 0},0);		
7580			$('#slide-out-widget-area .off-canvas-social-links li').transition({'scale':0},0);
7581			$('#slide-out-widget-area .off-canvas-social-links').removeClass('line-shown');	
7582
7583			//close submenu items
7584			$('#slide-out-widget-area .menuwrapper .menu').removeClass( 'subview' );
7585			$('#slide-out-widget-area .menuwrapper .menu li').removeClass( 'subview subviewopen' );
7586			$('#slide-out-widget-area.fullscreen-alt .inner .off-canvas-menu-container').css('height','auto');
7587
7588			if($('.mobile #header-outer[data-permanent-transparent="false"]').length > 0 && $('.container-wrap').hasClass('no-scroll')) $('#ajax-content-wrap').removeClass('at-content');
7589			if($('.mobile #header-outer[data-permanent-transparent="false"]').length == 0) $('#slide-out-widget-area.fullscreen-alt .inner-wrap').css('padding-top', '0');
7590			$('.slide-out-widget-area-toggle a').removeClass('animating');
7591			$('#slide-out-widget-area-bg').css({'height':'1px','width':'1px','left':'-100%'});
7592			$('#slide-out-widget-area.fullscreen-alt').hide().removeClass('open');
7593		},550);
7594
7595		setTimeout(function(){
7596			if($('.nectar-social-sharing-fixed').length == 0) {
7597				showToTop();
7598			}
7599		},600);
7600
7601		//fade out overlay
7602		setTimeout(function(){
7603			$('#slide-out-widget-area-bg').removeClass('padding-removed');
7604		},50);	
7605
7606		
7607		var borderDelay = ($bodyBorderHeaderColorMatch == true) ? 150: 50;
7608
7609		setTimeout(function(){
7610			$('#slide-out-widget-area-bg').stop(true).css({'opacity': 0});
7611			if($('[data-transparent-header="true"]').length > 0) $('body > div[class*="body-border"]').css('z-index','10000');
7612		},borderDelay);
7613
7614		setTimeout(function(){
7615			$('#header-outer.transparent.small-nav, #header-outer.transparent.detached, #header-outer:not([data-permanent-transparent="1"]).transparent.scrolled-down').removeClass('transparent');
7616			
7617			if($('#header-outer').hasClass('pseudo-data-transparent')) {
7618				$('#header-outer').attr('data-transparent-header','false').removeClass('pseudo-data-transparent').removeClass('transparent');
7619			}
7620
7621			
7622
7623		},100);
7624		
7625	}
7626
7627
7628	
7629
7630	//dark slide transparent nav
7631	if($('#header-outer.temp-removed-dark-slide.transparent').length > 0  && $('#boxed').length == 0) $('#header-outer').removeClass('temp-removed-dark-slide').addClass('dark-slide');
7632
7633	//remove header transparent state
7634
7635	if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('#slide-out-widget-area.fullscreen-alt').length == 0) {
7636
7637		if($('.nectar-box-roll').length == 0) {
7638			if($('#header-outer.small-nav').length > 0 || $('#header-outer.scrolled-down').length > 0 || $('#header-outer.detached').length > 0) $('#header-outer').removeClass('transparent');
7639		} else {
7640			if($('#header-outer.small-nav').length > 0 || $('#header-outer.scrolled-down').length > 0 || $('.container-wrap.auto-height').length > 0) $('#header-outer').removeClass('transparent');
7641		}
7642	} 
7643
7644
7645
7646	//remove hidden menu
7647	$('#header-outer').removeClass('hidden-menu');
7648
7649	$('#header-outer').removeClass('side-widget-open').addClass('side-widget-closed');
7650
7651	return false;
7652});
7653
7654function slideOutWidgetOverflowState() {
7655
7656
7657	//switch position of social media/extra info based on screen size
7658	if(window.innerWidth < 1000 || $('body > #boxed').length > 0 || $('.ocm-effect-wrap-inner > #boxed').length > 0) {
7659
7660		$('#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');
7661		$('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner');
7662	} else {
7663		$('#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');
7664		$('#slide-out-widget-area.fullscreen .bottom-text, #slide-out-widget-area.fullscreen-alt .bottom-text').appendTo('#slide-out-widget-area .inner-wrap');
7665	}
7666
7667	//add overflow
7668	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'); }
7669	else { $('#slide-out-widget-area[class*="fullscreen"] .inner, #slide-out-widget-area[class*="fullscreen"]').removeClass('overflow-state'); }
7670
7671	$('#slide-out-widget-area[class*="fullscreen"] .inner').transition({ y : '-' + ($('#slide-out-widget-area[class*="fullscreen"] .inner').height()/2) + 'px' },0);
7672
7673	//close mobile only slide out widget area if switching back to desktop
7674	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'); }
7675
7676	//sizing for dropdown
7677	OCM_Dropdown_Icon_Pos();
7678
7679	
7680
7681}
7682
7683
7684function OCM_Dropdown_Icon_Pos() {
7685	$('#slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children').each(function(){
7686		$(this).find('.ocm-dropdown-arrow').css({'top': $(this).find('a').height()/2 });
7687	});
7688}
7689OCM_Dropdown_Icon_Pos();
7690
7691
7692function fullWidthHeaderSlidingWidgetMenuCalc() {
7693	$('header#top nav > ul > li.megamenu > ul.sub-menu').stop(true).transition({'width': $(window).width() - 360, 'left': '300px' },700,'easeInOutCubic');
7694}
7695
7696//slide out widget area scrolling 
7697function slideOutWidgetAreaScrolling(){ 
7698	$('#slide-out-widget-area').mousewheel(function(event, delta) {
7699
7700	     this.scrollTop -= (delta * 30);
7701	    
7702	     event.preventDefault();
7703
7704	});
7705}
7706setTimeout(slideOutWidgetAreaScrolling,500);
7707
7708
7709//handle mobile scrolling
7710if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
7711	$('#slide-out-widget-area').addClass('mobile');
7712}
7713
7714
7715function closeOCM(item) {
7716    if($('#slide-out-widget-area.open').length > 0) {
7717
7718    	var $windowCurrentLocation = window.location.href.split("#")[0];
7719		  var $windowClickedLocation = item.find('> a').attr('href').split("#")[0];
7720
7721    	if($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0) {
7722				if(item.parents('.slide-out-from-right-hover').length > 0) {
7723					$('.slide-out-widget-area-toggle.slide-out-hover-icon-effect a').trigger('click');
7724				} else {
7725					$('.slide-out-widget-area-toggle a').trigger('click');
7726				}
7727        
7728			}
7729    } 
7730		/*else if($('#slide-out-widget-area.slide-out-from-right.material-open').length > 0) {
7731			
7732			var $windowCurrentLocation = window.location.href.split("#")[0];
7733			var $windowClickedLocation = item.find('> a').attr('href').split("#")[0];
7734			
7735				if($windowCurrentLocation == $windowClickedLocation || item.find('a[href^="#"]').length > 0 && item.find('a').attr('href') != '#') {
7736					$('a.slide_out_area_close.material-ocm-open').trigger('click');
7737					
7738					setTimeout(function(){
7739						//scroll to window hash
7740						console.log('scroll to hash');
7741					},900);
7742					
7743				}
7744		} */
7745}
7746
7747
7748//left header
7749function leftHeaderSubmenus() {
7750
7751	//remove megamenu class
7752	$('#header-outer[data-format="left-header"] nav li.megamenu').removeClass('megamenu');
7753
7754	$ocm_link_selector = ($('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) ? '#slide-out-widget-area .off-canvas-menu-container li.menu-item-has-children > .ocm-dropdown-arrow' : 'body.material #slide-out-widget-area[class*="slide-out-from-right"] .off-canvas-menu-container li.menu-item-has-children > a';
7755	//click
7756	$('#header-outer[data-format="left-header"]  li.menu-item-has-children > a, '+$ocm_link_selector).click(function(){
7757
7758		if($(this).parent().hasClass('open-submenu')) {
7759			$(this).parent().find('.sub-menu').css({
7760				'max-height' : '0'
7761			});
7762			$(this).parent().removeClass('open-submenu');
7763		}
7764		else {
7765
7766			//get max height
7767
7768			var $that = $(this);
7769			var $maxSubMenuHeight;
7770
7771			$that.parent().find('> .sub-menu').addClass('no-trans');
7772
7773			setTimeout(function(){
7774
7775				$that.parent().find('> .sub-menu').css({
7776					'max-height' : 'none',
7777					'position' : 'absolute',
7778					'visibility' : 'hidden'
7779				});
7780				
7781				$maxSubMenuHeight =  $that.parent().find('> .sub-menu').height();
7782
7783				$that.parent().find('> .sub-menu').removeClass('no-trans');
7784				$that.parent().find('> .sub-menu').css({
7785					'max-height' : '0',
7786					'position' : 'relative',
7787					'visibility' : 'visible'
7788				});
7789
7790			},25);
7791
7792			setTimeout(function(){
7793				
7794				//reset
7795				$that.closest('ul').find('li.menu-item-has-children').removeClass('open-submenu');
7796				$that.closest('ul').find('li.menu-item-has-children > .sub-menu').css({
7797					'max-height' : '0'
7798				});
7799
7800				$that.parent().addClass('open-submenu');
7801
7802				$that.parent().find('> .sub-menu').css('max-height', $maxSubMenuHeight);
7803
7804				//add height to open parents
7805				if($that.parents('ul').length > 0) {
7806
7807					$that.parents('ul:not(.sf-menu)').each(function(){
7808						$(this).css('max-height');
7809						$(this).css('max-height', parseInt($(this).height() + parseInt($(this).css('padding-top'))*2 + $maxSubMenuHeight)+'px');
7810					});
7811				} 
7812					
7813
7814			},50);
7815		}
7816		
7817		return false;
7818	});
7819	
7820	//start open for current page items
7821	var $maxSubMenuHeightArr = [];
7822
7823	$('#header-outer[data-format="left-header"] .current-menu-ancestor').find('.current-menu-item').parents('ul.sub-menu').each(function(i){
7824
7825		
7826
7827		$maxSubMenuHeightArr[i] =  $(this).parent().find('> .sub-menu').height();
7828
7829
7830		var $that = $(this);
7831		setTimeout(function(){
7832
7833			var $totalSubMenuHeight = 0;
7834
7835			for(var $i=0; $i < $maxSubMenuHeightArr.length; $i++) {
7836				$totalSubMenuHeight += parseInt($maxSubMenuHeightArr[i]);
7837			}
7838	
7839			$that.parent().addClass('open-submenu');
7840			$that.css('max-height', $totalSubMenuHeight);
7841
7842		},40);
7843	});
7844}
7845
7846if($('#header-outer[data-format="left-header"]').length >
7846 0 || $('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length > 0 || $('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length > 0) {
7847	leftHeaderSubmenus();
7848}
7849
7850
7851
7852
7853//fullscreen submenu
7854;( function( $, window, undefined ) {
7855
7856	'use strict';
7857
7858	// global
7859	var Modernizr = window.Modernizr, $body = $( 'body' );
7860
7861	$.DLMenu = function( options, element ) {
7862		this.$el = $( element );
7863		this._init( options );
7864	};
7865
7866	// the options
7867	$.DLMenu.defaults = {
7868		// classes for the animation effects
7869		animationClasses : { classin : 'dl-animate-in-1', classout : 'dl-animate-out-1' },
7870		onLevelClick : function( el, name ) { return false; },
7871		onLinkClick : function( el, ev ) { return false; }
7872	};
7873
7874	$.DLMenu.prototype = {
7875		_init : function( options ) {
7876
7877			// options
7878			this.options = $.extend( true, {}, $.DLMenu.defaults, options );
7879			// cache some elements and initialize some variables
7880			this._config();
7881			
7882			var animEndEventNames = {
7883					'WebkitAnimation' : 'webkitAnimationEnd',
7884					'OAnimation' : 'oAnimationEnd',
7885					'msAnimation' : 'MSAnimationEnd',
7886					'animation' : 'animationend'
7887				},
7888				transEndEventNames = {
7889					'WebkitTransition' : 'webkitTransitionEnd',
7890					'MozTransition' : 'transitionend',
7891					'OTransition' : 'oTransitionEnd',
7892					'msTransition' : 'MSTransitionEnd',
7893					'transition' : 'transitionend'
7894				};
7895			// animation end event name
7896			this.animEndEventName = animEndEventNames[ Modernizr.prefixed( 'animation' ) ] + '.menu';
7897			// transition end event name
7898			this.transEndEventName = transEndEventNames[ Modernizr.prefixed( 'transition' ) ] + '.menu',
7899			// support for css animations and css transitions
7900			this.supportAnimations = Modernizr.cssanimations,
7901			this.supportTransitions = Modernizr.csstransitions;
7902
7903			this._initEvents();
7904
7905		},
7906		_config : function() {
7907			this.open = false;
7908			this.$trigger = this.$el.children( '.trigger' );
7909			this.$menu = this.$el.children( 'ul.menu' );
7910			this.$menuitems = this.$menu.find( 'li:not(.back) > a' );
7911			this.$el.find( 'ul.sub-menu' ).prepend( '<li class="back"><a href="#"> '+$('#slide-out-widget-area').attr('data-back-txt')+' </a></li>' );
7912			this.$back = this.$menu.find( 'li.back' );
7913		},
7914		_initEvents : function() {
7915
7916			var self = this;
7917
7918			this.$trigger.on( 'click.menu', function() {
7919				
7920				if( self.open ) {
7921					self._closeMenu();
7922				} 
7923				else {
7924					self._openMenu();
7925				}
7926				return false;
7927
7928			} );
7929			
7930			this.$menuitems.on( 'click.menu', function( event ) {
7931				
7932				//event.stopPropagation();
7933
7934				var $item = $(this).parent('li'),
7935					$submenu = $item.children( 'ul.sub-menu' );
7936
7937				$('.fullscreen-alt .off-canvas-menu-container .clip-wrap, .fullscreen-alt .off-canvas-menu-container .clip-wrap span').css('transition-duration','0s');	
7938	
7939				//exit if clicking on background LI (avoids effect wrongly triggering)
7940				//if( $item.find('> a').length > 0 && $item.find('> a').css('display') === 'none') return false;
7941			
7942				if( $submenu.length > 0 ) {
7943
7944					var $flyin = $submenu.clone().css( 'opacity', 0 ).insertAfter( self.$menu ),
7945						onAnimationEndFn = function() {
7946							self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classout ).addClass( 'subview' );
7947							$item.addClass( 'subviewopen' ).parents( '.subviewopen:first' ).removeClass( 'subviewopen' ).addClass( 'subview' );
7948							$flyin.remove();
7949							setTimeout(function(){
7950								$('.off-canvas-menu-container .menu > li').removeClass('no-pointer-events');
7951								$('.off-canvas-menu-container .clip-wrap, .off-canvas-menu-container .clip-wrap span').css('transition-duration','.45s');
7952							},300);
7953							
7954			
7955						};
7956
7957					setTimeout( function() {
7958						$flyin.addClass( self.options.animationClasses.classin );
7959						self.$menu.addClass( self.options.animationClasses.classout );
7960						if( self.supportAnimations ) {
7961							self.$menu.on( self.animEndEventName, onAnimationEndFn );
7962						}
7963						else {
7964							onAnimationEndFn.call();
7965						}
7966
7967						self.options.onLevelClick( $item, $item.children( 'a:first' ).text() );
7968					} );
7969
7970
7971					//adjust height for mobile / widgets below
7972					$item.parents('.off-canvas-menu-container').css('height',$item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height()).transition({ 'height': $flyin.height() },500,'easeInOutQuad' );
7973
7974
7975					return false;
7976
7977				}
7978				else {
7979		
7980					self.options.onLinkClick( $item.find('> a'), event );
7981				}
7982
7983				closeOCM($item);
7984
7985			});
7986
7987			
7988
7989
7990			this.$back.on( 'click.menu', function( event ) {
7991				
7992				var $this = $( this ),
7993					$submenu = $this.parents( 'ul.sub-menu:first' ),
7994					$item = $submenu.parent(),
7995
7996					$flyin = $submenu.clone().insertAfter( self.$menu );
7997
7998				var onAnimationEndFn = function() {
7999					self.$menu.off( self.animEndEventName ).removeClass( self.options.animationClasses.classin );
8000					$flyin.remove();
8001				};
8002
8003				setTimeout( function() {
8004					$flyin.addClass( self.options.animationClasses.classout );
8005					self.$menu.addClass( self.options.animationClasses.classin );
8006					if( self.supportAnimations ) {
8007						self.$menu.on( self.animEndEventName, onAnimationEndFn );
8008					}
8009					else {
8010						onAnimationEndFn.call();
8011					}
8012
8013					$item.removeClass( 'subviewopen' );
8014					
8015					var $subview = $this.parents( '.subview:first' );
8016					if( $subview.is( 'li' ) ) {
8017						$subview.addClass( 'subviewopen' );
8018					}
8019					$subview.removeClass( 'subview' );
8020				} );
8021
8022		
8023				//adjust height for mobile / widgets below
8024				$item.parents('.off-canvas-menu-container').css('height', $item.parents('.off-canvas-menu-container').find('.menuwrapper .menu').height())
8025				setTimeout(function() { 
8026					$item.parents('.off-canvas-menu-container').transition({ 'height': $item.parent().height() },500,'easeInOutQuad');
8027				},50);
8028
8029
8030				return false;
8031
8032			} );
8033			
8034		},
8035		closeMenu : function() {
8036			if( this.open ) {
8037				this._closeMenu();
8038			}
8039		},
8040		_closeMenu : function() {
8041			var self = this,
8042				onTransitionEndFn = function() {
8043					self.$menu.off( self.transEndEventName );
8044					self._resetMenu();
8045				};
8046			
8047			this.$menu.removeClass( 'menuopen' );
8048			this.$menu.addClass( 'menu-toggle' );
8049			this.$trigger.removeClass( 'active' );
8050			
8051			if( this.supportTransitions ) {
8052				this.$menu.on( this.transEndEventName, onTransitionEndFn );
8053			}
8054			else {
8055				onTransitionEndFn.call();
8056			}
8057
8058			this.open = false;
8059		},
8060		openMenu : function() {
8061			if( !this.open ) {
8062				this._openMenu();
8063			}
8064		},
8065		_openMenu : function() {
8066			var self = this;
8067			// clicking somewhere else makes the menu close
8068			$body.off( 'click' ).on( 'click.menu', function() {
8069				self._closeMenu() ;
8070			} );
8071			this.$menu.addClass( 'menuopen menu-toggle' ).on( this.transEndEventName, function() {
8072				$( this ).removeClass( 'menu-toggle' );
8073			} );
8074			this.$trigger.addClass( 'active' );
8075			this.open = true;
8076		},
8077		// resets the menu to its original state (first level of options)
8078		_resetMenu : function() {
8079			this.$menu.removeClass( 'subview' );
8080			this.$menuitems.removeClass( 'subview subviewopen' );
8081		}
8082	};
8083
8084	var logError = function( message ) {
8085		if ( window.console ) {
8086			window.console.error( message );
8087		}
8088	};
8089
8090	$.fn.dlmenu = function( options ) {
8091		if ( typeof options === 'string' ) {
8092			var args = Array.prototype.slice.call( arguments, 1 );
8093			this.each(function() {
8094				var instance = $.data( this, 'menu' );
8095				if ( !instance ) {
8096					logError( "cannot call methods on menu prior to initialization; " +
8097					"attempted to call method '" + options + "'" );
8098					return;
8099				}
8100				if ( !$.isFunction( instance[options] ) || options.charAt(0) === "_" ) {
8101					logError( "no such method '" + options + "' for menu instance" );
8102					return;
8103				}
8104				instance[ options ].apply( instance, args );
8105			});
8106		} 
8107		else {
8108			this.each(function() {	
8109				var instance = $.data( this, 'menu' );
8110				if ( instance ) {
8111					instance._init();
8112				}
8113				else {
8114					instance = $.data( this, 'menu', new $.DLMenu( options, this ) );
8115				}
8116			});
8117		}
8118		return this;
8119	};
8120
8121} )( jQuery, window );
8122
8123function fullscreenMenuInit() {
8124	$('#slide-out-widget-area .off-canvas-menu-container .menu').wrap('<div class="menu-wrap menuwrapper" />');
8125	$('#slide-out-widget-area .off-canvas-menu-container .menu').addClass('menuopen');
8126	$ocmAnimationClassNum = ($('#slide-out-widget-area.fullscreen-alt').length > 0) ? '4' : '5';
8127	$('#slide-out-widget-area .off-canvas-menu-container .menu-wrap').dlmenu({ animationClasses : { classin : 'dl-animate-in-'+$ocmAnimationClassNum, classout : 'dl-animate-out-'+$ocmAnimationClassNum } });
8128	
8129}
8130
8131if($('body.material[data-slide-out-widget-area-style*="slide-out-from-right"]').length == 0 && $('#slide-out-widget-area[data-dropdown-func="separate-dropdown-parent-link"]').length == 0 ) {
8132	fullscreenMenuInit();
8133} else if($('body.using-mobile-browser[data-slide-out-widget-area-style="slide-out-from-right-hover"]').length > 0){
8134	
8135	//close OCM on mobile when clicking anchor on same page 
8136	$('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click',function(){
8137
8138		  if($(this).attr('href') != '#') {
8139				closeOCM($(this).parent());	
8140			}
8141
8142	});
8143	
8144} 
8145
8146/*else if($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) {
8147	
8148	$('body #slide-out-widget-area .inner .off-canvas-menu-container li a[href]').on('click',function(){
8149		
8150		  if($(this).attr('href') != '#' && $(this).attr('href').indexOf("#") != -1) {
8151				closeOCM($(this).parent());	
8152			}
8153	});
8154	
8155} */
8156
8157//submenu link hover fix
8158$('body').on('mouseover','#slide-out-widget-area .off-canvas-menu-container .menuwrapper > .sub-menu li > a',function(){
8159	var $currentTxt = $(this).text();
8160	$('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
8161	$('.off-canvas-menu-container .menuwrapper .menu li > a:contains('+$currentTxt+')').addClass('hovered');
8162});
8163$('body').on('mouseover','.off-canvas-menu-container .menuwrapper .menu li > a',function(){
8164	$('.off-canvas-menu-container .menuwrapper .menu li > a').removeClass('hovered');
8165});
8166
8167
8168
8169/***************** Page Headers ******************/
8170
8171var pageHeaderHeight;
8172var pageHeaderHeightCopy;
8173var pageHeadingHeight;
8174var extraSpaceFromResize = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.nectar-box-roll').length == 0) ? 0 : 1;
8175var $headerRemoveStickyness = ($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0) ? 1 : 0;
8176
8177if($('body.material').length > 0 ) { extraSpaceFromResize = 0; }
8178
8179//full screen header
8180function fullScreenHeaderInit(){
8181	
8182	pageHeaderHeight = parseInt($('#page-header-bg').height());
8183	
8184	return;
8185	
8186	pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
8187	pageHeaderHeightCopy = parseInt($('#page-header-bg').attr('data-height'));
8188
8189	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && window.innerWidth > 1000) ? 0 : $('#header-outer').height();
8190
8191	if($('.fullscreen-header').length > 0) {
8192
8193		if($('#header-outer[data-transparency-option]').length > 0 && $('#header-outer').attr('data-transparency-option') != '0'){
8194			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() : $(window).height() - parseInt($headerNavSpace) ;
8195		} else {
8196			var calculatedNum = (!$('body').hasClass('mobile')) ? $(window).height() - parseInt($headerNavSpace) + extraSpaceFromResize : $(window).height() - parseInt($headerNavSpace) ;
8197		}
8198		var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
8199		if($('.nectar-box-roll').length > 0) extraHeight = 0;
8200		pageHeaderHeight =   calculatedNum  - extraHeight; 
8201		pageHeaderHeightCopy = calculatedNum - extraHeight; 
8202	}
8203
8204	$('#page-header-bg').css('height',pageHeaderHeight+'px').removeClass('not-loaded');
8205	setTimeout(function(){ $('#page-header-bg').css('overflow','visible') },800);
8206
8207}
8208
8209fullScreenHeaderInit();
8210
8211function pageHeader(){
8212	
8213	pageHeaderHeight = parseInt($('#page-header-bg').height());
8214	
8215	//handle slide down effect
8216	$('body[data-aie="slide-down"] #page-header-wrap:not(.fullscreen-header)').css('height',pageHeaderHeight +'px');
8217  
8218  //as of 9.0
8219	return;
8220	
8221	
8222	var $scrollTop = 0;
8223	var $windowInnerWidth = window.innerWidth;
8224	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $windowInnerWidth > 1000) ? 0 : $('#header-outer').height();
8225	var $windowHeight = $(window).height();
8226
8227	//full screen header
8228	if($('.fullscreen-header').length > 0) {
8229		if($('#header-outer[data-transparency-option]').length > 0 && $('#header-outer').attr('data-transparency-option') != '0'){
8230			var calculatedNum = (!$('body').hasClass('mobile')) ? $windowHeight : $windowHeight - parseInt($headerNavSpace) ;
8231			if($('body[data-permanent-transparent="1"]').length > 0) calculatedNum = $windowHeight;
8232		} else {
8233			var calculatedNum = (!$('body').hasClass('mobile')) ? $windowHeight - parseInt($headerNavSpace) + extraSpaceFromResize : $windowHeight - parseInt($headerNavSpace);
8234		}
8235		var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
8236		if($('.nectar-box-roll').length > 0) extraHeight = 0;
8237		pageHeaderHeight =   calculatedNum  - extraHeight; 
8238		pageHeaderHeightCopy = calculatedNum - extraHeight; 
8239	}
8240
8241	if( $windowInnerWidth < 1000 && $windowInnerWidth > 690 && !$('body').hasClass('salient_non_responsive') ) {
8242		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 1.6;
8243		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
8244		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
8245		
8246	} else if( $windowInnerWidth <= 690 && $windowInnerWidth > 480 && !$('body').hasClass('salient_non_responsive')) {
8247		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 2.1;
8248		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
8249		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
8250		
8251	} else if( $windowInnerWidth <= 480 && !$('body').hasClass('salient_non_responsive')) {
8252		var $multiplier = ($('.fullscreen-header').length > 0) ? 1 : 2.5;
8253		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy/$multiplier).css('height',pageHeaderHeightCopy/$multiplier +'px');
8254		$('#page-header-wrap').css('height',pageHeaderHeightCopy/$multiplier +'px');
8255		
8256	} else {
8257		$('#page-header-bg').attr('data-height', pageHeaderHeightCopy).css('height',pageHeaderHeightCopy +'px');
8258		if($('.fullscreen-header').length > 0){
8259			$('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
8260		} else {
8261			$('#page-header-wrap').css('height',pageHeaderHeightCopy +'px');
8262		}
8263
8264		if($('#page-header-bg[data-parallax="1"]').length == 0) { $('#page-header-wrap').css('height',pageHeaderHeightCopy +'px'); }
8265	}
8266
8267
8268	//handle left header 
8269	if($('body[data-header-format="left-header"]').length > 0 ) { $('#page-header-bg[data-parallax="1"]').css('width',$('#ajax-content-wrap').width()) }
8270	
8271	
8272	if(!$('body').hasClass('mobile')){
8273		
8274		//recalc
8275		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
8276		$('#page-header-bg .container > .row').css('top',0);
8277		var $divisionMultipler = ($('#header-outer[data-remove-border="true"]').length > 0 && $('#header-outer[data-format="centered-menu-under-logo"]').length == 0) ? 2 : 1;
8278
8279		//center the heading
8280		pageHeadingHeight = $('#page-header-bg .col.span_6').height();
8281		
8282		
8283		if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.fullscreen-header').length == 0) {
8284			//$('#page-header-bg:not("[data-parallax=1]") .col.span_6').css('top', ((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2));
8285		} else {
8286			var $extraResizeHeight = ($('#header-outer[data-header-resize="1"]').length > 0) ? 22: 0;
8287			//$('#page-header-bg:not("[data-parallax=1]") .col.span_6').css('top', (pageHeaderHeight/2) - (pageHeadingHeight/2) + $extraResizeHeight);
8288		}
8289		
8290		//center portfolio filters
8291		$('#page-header-bg:not("[data-parallax=1]") .portfolio-filters').css('top', (pageHeaderHeight/2) + 2);	
8292		
8293		if($('#page-header-bg[data-parallax="1"]').length > 0) {
8294			$scrollTop = $(window).scrollTop();
8295		}
8296
8297		if($('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap').css('opacity') > 0) {
8298			
8299			if($('#header-outer[data-transparent-header="true"]').length > 0 && $('body.single-post .fullscreen-header').length == 0) {
8300				//center the parallax heading
8301
8302				if($headerRemoveStickyness) {
8303					
8304					/*
8305					$('#page-header-bg[data-parallax="1"] .span_6').css({ 
8306						'top' : (((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2)) +"px"
8307					}); */
8308				    
8309				    //center parllax portfolio filters
8310				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
8311						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
8312				    });
8313
8314				} else {
8315					/*
8316					$('#page-header-bg[data-parallax="1"] .span_6 ').css({ 
8317						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+60)),
8318						'top' : (((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2)) +"px"
8319					}); */
8320				    
8321				    //center parllax portfolio filters
8322				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
8323						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
8324						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
8325				    });
8326				}
8327			    
8328		  } else {
8329
8330		  		if($headerRemoveStickyness) {
8331			  		//center the parallax heading
8332						/*
8333				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
8334						'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
8335					}); */
8336				    
8337				    //center parllax portfolio filters
8338				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
8339						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
8340				    });
8341				} else {
8342					//center the parallax heading
8343					/*
8344				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
8345						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+60)),
8346						'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
8347				    });
8348						*/
8349				    
8350				    //center parllax portfolio filters
8351				    $('#page-header-bg[data-parallax="1"] .portfolio-filters').css({ 
8352						'opacity' : 1-($scrollTop/(pageHeaderHeight-($('#page-header-bg .col.span_6').height()*2)+75)),
8353						'top' : ($scrollTop*-0.10) + ((pageHeaderHeight/2)) - 7 +"px"
8354				    });
8355				}
8356		  }
8357	   }
8358	}
8359	
8360	else {
8361		//recalc
8362		pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'));
8363		
8364		//center the heading
8365		var pageHeadingHeight = $('#page-header-bg .container > .row').height();
8366		$('#page-header-bg .container > .row').css('top', (pageHeaderHeight/2) - (pageHeadingHeight/2) + 5);
8367		
8368	}
8369
8370
8371	$('#page-header-bg .container > .row').css('visibility','visible');
8372}
8373
8374var $pt_timeout = ($('body[data-ajax-transitions="true"]').length > 0 && $('#page-header-bg[data-animate-in-effect="slide-down"]').length > 0) ? 350 : 0; 
8375
8376if($('#page-header-bg').length > 0) { 
8377	setTimeout(function(){ pageHeader(); },$pt_timeout);
8378}
8379
8380
8381if($('#header-outer').attr('data-header-resize') == '' || $('#header-outer').attr('data-header-resize') == '0'){
8382	$('#page-header-wrap').css('margin-top','0');
8383}
8384
8385
8386function extractUrl(input) {
8387	return input.replace(/"/g,"").replace(/url\(|\)$/ig, "");
8388}
8389 
8390/***************** Parallax Page Headers ******************/
8391if($('#page-header-bg[data-parallax="1"]').length > 0) {
8392
8393	//fadeIn
8394
8395	var img = new Image();
8396	
8397	var imgX, imgY, aspectRatio;
8398	var diffX, diffY;
8399	var pageHeadingHeight = $('#page-header-bg .col.span_6').height();
8400	var pageHeaderHeight = parseInt($('#page-header-bg').height());
8401	var headerPadding2 = parseInt($('#header-outer').attr('data-padding'))*2;
8402	var wooCommerceHeader = ($('.demo_store').length > 0) ? 32 : 0 ;
8403	
8404	
8405	var $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
8406	
8407	if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) {    
8408		img.onload = function() {
8409		   pageHeaderInit(); 
8410		}
8411		
8412		img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
8413		
8414	} else {
8415		 pageHeaderInit();
8416	}
8417
8418	
8419	
8420	var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
8421
8422
8423	 if($('body[data-hhun="1"]').length > 0 && !$('#header-outer[data-remove-fixed="1"]').length > 0)  $('#header-outer').addClass('parallax-contained');
8424
8425	 window.addEventListener('scroll', function(){ 
8426        window.requestAnimationFrame(bindHeaderParallax);
8427    }, false);
8428
8429}
8430
8431					
8432function bindHeaderParallax(){
8433
8434	var $scrollTop = $(window).scrollTop();
8435	var pageHeadingHeight = $('#page-header-bg .col.span_6').height();
8436	
8437	if(!$('body').hasClass('mobile') && navigator.userAgent.match(/iPad/i) == null && $('body.material-ocm-open').length == 0 ){
8438
8439
8440		//material needs to set top for when effect wrap sets transform
8441		if(window.innerWidth > 1000) {
8442        $('body:not("[data-header-format=\'left-header\']") #page-header-bg[data-parallax="1"]').css('top',$('#ajax-content-wrap').offset().top);
8443    } else {
8444        $('body:not("[data-header-format=\'left-header\']") #page-header-bg[data-
8444parallax="1"]').css('top','0');
8445    }
8446
8447		var $multiplier1 =  ($('body[data-hhun="1"]').length > 0 || $('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0) ? 0.40: 0.4;
8448    var $multiplier2 = ($('body[data-hhun="1"]').length > 0 || $('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0) ? 0.09: 0.09;
8449    var $parallaxHeaderHUN = ($('#header-outer[data-transparency-option="1"]').length > 0) ? 0.49: 0.4;
8450
8451		//calc bg pos
8452		//$('#page-header-bg[data-parallax="1"]').css({'top': ((- $scrollTop / 5)+logoHeight+headerPadding+headerResizeOffExtra+extraHeight-extraDef+secondaryHeader)  + 'px' });
8453		if($('#page-header-bg.out-of-sight').length == 0) {
8454
8455			if($headerRemoveStickyness) {
8456				$('#page-header-bg[data-parallax="1"]').css({ 'transform': 'translateY('+ $scrollTop*-0.55 +'px)' });	
8457			} else {
8458				$('#page-header-bg[data-parallax="1"]').css({ 'transform': 'translateY('+ $scrollTop*-$multiplier1 +'px)' });
8459			}
8460
8461			var multipler = ($('body').hasClass('single')) ? 1 : 2;
8462			if(!$headerRemoveStickyness) {
8463				$('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap,  #page-header-bg[data-parallax="1"][data-post-hs="default_minimal"] .author-section').css({ 
8464					'opacity' : 1-($scrollTop/(pageHeaderHeight-60))
8465				});
8466			}
8467			
8468			if($headerRemoveStickyness) {
8469				$('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap, body[data-button-style="rounded"] #page-header-bg[data-parallax="1"] .scroll-down-wrap, #page-header-bg[data-parallax="1"][data-post-hs="default_minimal"] .author-section').css({ 'transform': 'translateY('+ $scrollTop*- 0.45+'px)' });
8470			} else {
8471				$('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap, body[data-button-style="rounded"] #page-header-bg[data-parallax="1"] .section-down-arrow, #page-header-bg[data-parallax="1"][data-post-hs="default_minimal"] .author-section').css({ 'transform': 'translateY('+ $scrollTop*- $multiplier2+'px)' });
8472			}
8473			
8474			if($('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap').css('opacity') == 0){
8475				$('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap, #page-header-bg[data-parallax="1"] .portfolio-filters').hide();
8476			} else {
8477				$('#page-header-bg[data-parallax="1"] .span_6 .inner-wrap, #page-header-bg[data-parallax="1"] .portfolio-filters').show();
8478			}
8479
8480			if($('body[data-hhun="1"]').length > 0  && !$('#header-outer').hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) { 
8481          $('#header-outer.parallax-contained').css({ 'transform': 'translateY('+$scrollTop*-$parallaxHeaderHUN+'px)' });
8482      }
8483			
8484		
8485		}
8486		else if($('#page-header-bg.out-of-sight').length == 0) {
8487			//alt parallax effect
8488			var multipler = ($('body').hasClass('single')) ? 1 : 2;
8489			$('#page-header-wrap .nectar-particles .fade-out').css({ 
8490				'opacity' : 0+($scrollTop/(pageHeaderHeight+pageHeaderHeight*$multiplier))
8491			});
8492		}
8493
8494
8495		//hide elements to allow other parallax sections to work in webkit browsers
8496		if( ($scrollTop / (pageHeaderHeight + $('#header-space').height() + extraHeight)) > 1 ) {
8497			$('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility','hidden').hide().addClass('out-of-sight');
8498		}
8499		else {
8500		 	$('#page-header-bg, .nectar-particles, #page-header-bg .fade-out').css('visibility','visible').show().removeClass('out-of-sight');
8501
8502		 		//ensure header is centered
8503		 		pageHeaderHeight = parseInt($('#page-header-bg').height());
8504				$('#page-header-bg .container > .row').css('top',0);
8505				var $divisionMultipler = ($('#header-outer[data-remove-border="true"]').length > 0 && $('#header-outer[data-format="centered-menu-under-logo"]').length == 0) ? 2 : 1;
8506				pageHeadingHeight = $('#page-header-bg .col.span_6').height();
8507				
8508				/*
8509				if($('#header-outer[data-transparent-header="true"]').length > 0 && $('body.single-post .fullscreen-header').length == 0) {
8510					//center the parallax heading
8511				    $('#page-header-bg[data-parallax="1"] .span_6 ').css({ 
8512						'top' : (((pageHeaderHeight+$('#header-space').height()/$divisionMultipler)/2) - (pageHeadingHeight/2)) +"px"
8513				    });
8514
8515			  	} else {
8516			  		//center the parallax heading
8517				    $('#page-header-bg[data-parallax="1"] .span_6').css({ 
8518						'top' : ((pageHeaderHeight/2) - (pageHeadingHeight/2)) +10 +"px"
8519				    });
8520			  	} */
8521	    }
8522		
8523
8524	}
8525
8526
8527
8528}
8529
8530if($('#page-header-bg').length > 0) {
8531	var $initialImgCheckAscend = extractUrl($('#page-header-bg').css('background-image'));
8532	if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) {    
8533		   $('#page-header-bg').addClass('has-bg');
8534	}
8535}
8536
8537
8538function pageHeaderInit(){
8539
8540	 var wooCommerceHeader = ($('.demo_store').length > 0) ? 32 : 0 ;
8541	 var centeredNavAltSpace = ($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) ? $('header#top nav > .sf-menu').height() -20 : null;
8542	 //transparent
8543	  if($('#header-outer[data-transparent-header="true"]').length > 0) {	
8544	     $('#page-header-bg[data-parallax="1"]').css({'top': extraHeight+wooCommerceHeader });
8545	  } else {
8546
8547	   var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
8548		 var headerPadding = parseInt($('#header-outer').attr('data-padding'));
8549		 var headerPadding2 = parseInt($('#header-outer').attr('data-padding'));
8550		 var extraDef = 10;
8551		 var headerResize = ($('body').hasClass('pp-video-function')) ? '1' : $('#header-outer').attr('data-header-resize');
8552		 var headerResizeOffExtra = 0;
8553		 var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
8554		 var usingLogoImage = true;
8555	     var mediaElement = ($('.wp-video-shortcode').length > 0) ? 36 : 0;
8556	     var secondaryHeader = ($('#header-outer').attr('data-using-secondary') == '1') ? 32 : 0 ;
8557	  	 if($('body[data-header-resize="0"]').length == 0 && $('body.material').length == 0) {
8558				 $('#page-header-bg[data-parallax="1"]').css({'top': ($('#page-header-wrap').offset().top)  + 'px' });
8559			 }
8560	  }
8561	  
8562	  //fade in header
8563	  if($('#ajax-content-wrap').length == 0 || !$('body').hasClass('ajax-loaded')){
8564	  	$('#page-header-bg[data-parallax="1"]').animate({ 'opacity' : 1},350,'easeInCubic');
8565	  } else if($('#ajax-content-wrap').length == 1) {
8566	  	$('#page-header-bg[data-parallax="1"]').css({ 'opacity' : 1});
8567	  }
8568
8569	  //$('#page-header-wrap').css({'height' : pageHeaderHeight});
8570	  
8571	  //verify smooth scorlling
8572	  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') } 
8573	  
8574
8575	  $('#page-header-bg[data-parallax="1"] .nectar-particles').append('<div class="fade-out" />');
8576}
8577
8578
8579
8580
8581function nectarPageHeader() {
8582
8583	if($('#page-header-bg').length > 0) {
8584		fullScreenHeaderInit();
8585		pageHeader();
8586	}
8587
8588
8589	if($('#page-header-bg[data-parallax="1"]').length > 0) {
8590
8591		var img = new Image();
8592		var $initialImgCheck = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
8593			
8594		if ($initialImgCheck && $initialImgCheck.indexOf('.') !== -1) {    
8595			img.onload = function() {
8596			   pageHeaderInit();    
8597					
8598			}
8599			
8600			img.src = extractUrl($('#page-header-bg[data-parallax="1"]').css('background-image'));
8601			
8602		} else {
8603			 pageHeaderInit();
8604		}
8605
8606		//bindHeaderParallax();
8607		$('#page-header-bg[data-parallax="1"] .span_6').css({ 
8608			'opacity' : 1
8609		});
8610
8611		
8612
8613		if (window.addEventListener) {
8614			 window.addEventListener('scroll', function(){ 
8615	          requestAnimationFrame(bindHeaderParallax); 
8616	        }, false);
8617		}
8618
8619	} 
8620
8621	if($('#page-header-bg').length > 0) {
8622		var $initialImgCheckAscend = extractUrl($('#page-header-bg').css('background-image'));
8623		if ($initialImgCheckAscend && $initialImgCheckAscend.indexOf('.') !== -1) {    
8624			   $('#page-header-bg').addClass('has-bg');
8625		}
8626	}
8627}
8628
8629if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
8630	window.onunload = function(){ nectarPageHeader(); };
8631}
8632
8633
8634/***************** header text effects *****************/
8635
8636// rotate in
8637function pageHeaderTextEffectInit() {
8638	$('#page-header-bg').each(function(){
8639		if($(this).attr('data-text-effect') == 'rotate_in') {
8640			var $topHeading = 'none';
8641
8642			if($(this).find('.span_6 h1').length > 0) {
8643				$topHeading = 'h1';
8644			} 
8645			//else if ($(this).find('.span_6 h2').length > 0) {
8646			//	$topHeading = 'h2';
8647			//}
8648
8649			if($topHeading != 'none') {
8650
8651				var $selector = ($(this).find('.nectar-particles').length > 0) ? '.inner-wrap.shape-1' : '.span_6';
8652
8653				$(this).find($selector).find($topHeading).addClass('top-heading').contents().filter(function () {
8654			        return this.nodeType === 3 && typeof this.data != 'undefined' && this.data.replace(/\s+/, "");
8655			    }).wrap('<span class="wraped"></span>');
8656
8657			    $(this).find($selector).find('.wraped').each(function () {
8658
8659				    textNode = $(this);
8660
8661				    text = textNode.text().split(' ');
8662				    replace = '';
8663
8664				    $.each(text, function (index, value) {
8665				        if (value.replace(/\s+/, "")) {
8666				            replace += '<span class="wraped"><span>' + value + '</span></span> ';
8667				        }
8668				    });
8669				    textNode.replaceWith($(replace));
8670				    
8671				});
8672			}//make sure suitable heading was found
8673
8674		}//tilt
8675	});
8676	
8677}
8678function pageHeaderTextEffect() {
8679
8680	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) {
8681
8682		var $selector = ($('.nectar-box-roll').length == 0) ? '#page-header-bg .span_6' : '.nectar-box-roll .overlaid-content .span_6';
8683
8684		$($selector).find('.wraped').each(function(i){
8685			$(this).find('span').delay(i*370).transition({ rotateX: '0', 'opacity' : 1, y: 0},400,'easeOutQuad');
8686		});
8687
8688		setTimeout(function(){
8689
8690			$($selector).find('.inner-wrap > *:not(.top-heading)').each(function(i){
8691				$(this).delay(i*370).transition({ rotateX: '0', 'opacity' : 1, y: 0 },650,'easeOutQuad');
8692			});
8693
8694			$('.scroll-down-wrap').removeClass('hidden');
8695
8696		}, $($selector).find('.wraped').length * 370);
8697	}
8698
8699}
8700var $effectTimeout = ($('#ajax-loading-screen').length > 0) ? 800 : 0;
8701
8702pageHeaderTextEffectInit();
8703
8704if($('#page-header-bg .nectar-video-wrap video').length == 0) { setTimeout(pageHeaderTextEffect,$effectTimeout); }
8705
8706
8707
8708
8709 //submenu fix
8710  if($('header#top nav > ul.sf-menu ul').length > 0) {
8711
8712  	var $midnightSubmenuTimeout;
8713  	$('body').on('mouseover','#header-outer .midnightHeader .sf-with-ul, #header-outer .midnightHeader .cart-menu',function(){
8714
8715  		if($(this).parents('.midnightHeader').offset().top - $(window).scrollTop() < 50){
8716  		
8717  			$(this).parents('.midnightHeader').css({'z-index': '9999'}).addClass('overflow');
8718  			$(this).parents('.midnightInner').css('overflow','visible');
8719  		}
8720  	});
8721  	$('body').on('mouseleave','#header-outer .midnightHeader',function(){
8722  		var $that = $(this);
8723  		clearTimeout($midnightSubmenuTimeout);
8724  		$midnightSubmenuTimeout = setTimeout(function(){
8725  			if(!$that.is(':hover')) {
8726  				$that.css({'z-index': 'auto'}).removeClass('overflow');
8727  				$that.find('.midnightInner').css('overflow','hidden');
8728  		
8729  			}
8730
8731  		},900);
8732  	});
8733  }
8734
8735  function midnightInit() {
8736
8737  	if( $('#header-outer[data-permanent-transparent="1"]').length > 0 && $('body[data-bg-header="true"]').length > 0) {
8738
8739			//perma trans
8740			
8741			////fix pages that set no midnight coloring
8742			if($('.container-wrap div[data-midnight]').length == 0) {
8743				$('.container-wrap').attr('data-midnight','dark');
8744			}
8745
8746			////cache midnighgt compat divs
8747			var $midnightCompatArr = [];
8748			$('div[data-midnight]').each(function(){
8749
8750				if($(this).attr('data-midnight') == 'light' || $(this).attr('data-midnight') == 'dark') {
8751					$midnightCompatArr.push($(this));
8752				}
8753
8754			});
8755
8756
8757			if($midnightCompatArr.length > 0) {
8758
8759				$.each($midnightCompatArr,function(k,v){
8760
8761						if(v.attr('data-midnight') == 'light' || v.attr('data-midnight') == 'dark') {
8762
8763							var $that = v;
8764							var waypoint = new Waypoint({
8765				 				element: $that,
8766					 			handler: function(direction) {
8767				
8768					 				if($('body.material-ocm-open').length > 0) return;
8769
8770									if(direction == 'down') {
8771										var $textColor = ($that.attr('data-midnight') == 'light') ? '' : 'dark-slide';
8772										$('#header-outer').removeClass('dark-slide').addClass($textColor);
8773								
8774									} else {
8775
8776										if(k-1 >= 0) { 
8777											var $prevMidItem = k-1;
8778										} else {
8779											var $prevMidItem = k;
8780										}
8781
8782										var $textColor = ($midnightCompatArr[$prevMidItem].attr('data-midnight') == 'light') ? '' : 'dark-slide';
8783										$('#header-outer').removeClass('dark-slide').addClass($textColor);
8784
8785									} 
8786
8787							
8788								},
8789								offset: $('#header-outer').height()
8790
8791							}); 
8792
8793						}
8794
8795				}); //each
8796
8797			} //if rows with color set are found
8798
8799  	} //if page is using trans effect
8800
8801  
8802  } 
8803
8804
8805
8806//box roll
8807function getScrollbarWidth() {
8808    var outer = document.createElement("div");
8809    outer.style.visibility = "hidden";
8810    outer.style.width = "100px";
8811    outer.style.msOverflowStyle = "scrollbar"; // needed for WinJS apps
8812
8813    document.body.appendChild(outer);
8814
8815    var widthNoScroll = outer.offsetWidth;
8816    // force scrollbars
8817    outer.style.overflow = "scroll";
8818
8819    // add innerdiv
8820    var inner = document.createElement("div");
8821    inner.style.width = "100%";
8822    outer.appendChild(inner);        
8823
8824    var widthWithScroll = inner.offsetWidth;
8825
8826    // remove divs
8827    outer.parentNode.removeChild(outer);
8828
8829    return widthNoScroll - widthWithScroll;
8830}
8831
8832
8833function boxRollInit() {
8834	if($('.nectar-box-roll').length > 0) { 
8835
8836		$('body').attr('data-scrollbar-width',getScrollbarWidth());
8837		
8838		$('body, html, #ajax-content-wrap, .container-wrap, .blurred-wrap').addClass('no-scroll');
8839		$('body,html').stop().animate({ scrollTop:0 },0);
8840		$('.container-wrap').css('opacity',0).addClass('no-transform-animation-bottom-out').addClass('bottomBoxOut');
8841		//keep loading icon centered if scrollbar is going away
8842		if($('.mobile').length == 0) $('#ajax-loading-screen .loading-icon > span').css({ 'left' : '-'+getScrollbarWidth()/2 +'px'});
8843
8844		//change content pos
8845		var $overlaid = $('#page-header-bg .overlaid-content').clone();
8846		var $scrollDownOverlaid = $('.scroll-down-wrap').clone();
8847		$('#page-header-bg').removeAttr('data-midnight');
8848		$('#page-header-bg .overlaid-content, #page-header-bg .scroll-down-wrap').remove();
8849		$('.nectar-box-roll').append($overlaid);
8850		if($('#header-outer.dark-slide').length == 0) {
8851			$('.nectar-box-roll').attr('data-midnight','light');
8852		} else {
8853			$('.nectar-box-roll').attr('data-midnight','dark');
8854		}
8855		$('.overlaid-content').append($scrollDownOverlaid);
8856
8857		if($('.page-submenu[data-sticky="true"]').length > 0) {
8858			$('.container-wrap').addClass('no-trans');
8859		}
8860		
8861		nectarBoxRollContentHeight();
8862		
8863		$('html').addClass('nectar-box-roll-loaded');
8864		
8865		setTimeout(function() { pageLoadHash(); },700);
8866	} else {
8867		$('#ajax-content-wrap, .blurred-wrap').addClass('at-content');
8868		$('body, html, #ajax-content-wrap, .container-wrap, .blurred-wrap').removeClass('no-scroll');
8869		$('.container-wrap').css('opacity',1).removeClass('no-transform-animation-bottom-out').removeClass('bottomBoxOut').removeClass('bottomBoxIn');
8870		perspect = 'not-rolled';
8871	}
8872}
8873if($('.nectar-box-roll').length > 0) { 
8874	boxRollInit();
8875}
8876
8877function nectarBoxRollContentHeight() {
8878	/*if($('#header-outer[data-transparent-header="true"]').length == 0 && $('.mobile').length == 0) {
8879		$('.nectar-box-roll').css('top',$('#header-space').height());
8880	} else {
8881		$('.nectar-box-roll').css('top','0');
8882	}*/
8883	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').height();
8884
8885	if($('#header-outer[data-transparent-header="true"]').length == 0) {
8886			$('.nectar-box-roll .overlaid-content, .nectar-box-roll .canvas-bg, .container-wrap').css({'height':window.innerHeight - $headerNavSpace, 'min-height':window.innerHeight - $headerNavSpace });
8887			if($('.mobile').length == 0 && $('body[data-header-format="left-header"]').length == 0) { 
8888				$('#ajax-content-wrap').css('margin-top',$headerNavSpace); 
8889				$('#slide-out-widget-area.fullscreen').css('margin-top','-'+$headerNavSpace+'px'); 
8890			}
8891			else { 
8892				$('#ajax-content-wrap, #slide-out-widget-area.fullscreen').css('margin-top','0'); 
8893			}
8894	} else {
8895		
8896		if($('.mobile').length > 0 && $('body[data-permanent-transparent="1"]').length == 0 ) {
8897			$('.nectar-box-roll .overlaid-content, .nectar-box-roll .canvas-bg, .container-wrap').css('height',window.innerHeight - $headerNavSpace);
8898		} else {
8899			$('.nectar-box-roll .overlaid-content, .nectar-box-roll .canvas-bg, .container-wrap').css('height',window.innerHeight);
8900		}
8901		
8902	}
8903}
8904
8905if($('.nectar-box-roll').length > 0) $(window).on('resize',nectarBoxRollContentHeight);
8906
8907
8908var perspect = 'not-rolled';
8909var animating = 'false';
8910function boxRoll(e,d) {
8911	
8912	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').height();
8913
8914	if($('#slide-out-widget-area.open').length > 0) return false;
8915	if( $('.nectar-box-roll canvas').length > 0 && $('.nectar-box-roll canvas[data-loaded="true"]').length == 0) return false;
8916
8917	if(perspect == 'not-rolled' && animating == 'false' && d == -1) {
8918		perspect = 'rolled';
8919		animating = 'true';
8920		$('body').addClass('box-animating').addClass('box-perspective-rolled').addClass('box-rolling');
8921
8922		$('.nectar-box-roll #page-header-bg').removeClass('topBoxIn').addClass('topBoxOut').css('will-change','transform');
8923		
8924		$('.nectar-box-roll .overlaid-content').removeClass('topBoxIn2').removeClass('topBoxIn').addClass('topBoxOut2').css('will-change','transform');
8925		
8926		$('.container-wrap').removeClass('bottomBoxOut').addClass('bottomBoxIn').removeClass('no-transform-animation-bottom-out').addClass('nectar-box-roll-class').css('will-change','transform');
8927		if($('#header-outer[data-transparent-header="true"]').length == 0) {
8928			$('.container-wrap').css({'height':$(window).height() - $headerNavSpace, 'opacity': 1});
8929			$('#slide-out-widget-area.fullscreen').css('margin-top','0px');
8930		} else {
8931			$('.container-wrap').css({'height':$(window).height(), 'opacity': 1});
8932		}
8933		
8934
8935		$('.nectar-slider-wrap').css({'opacity':0});
8936
8937		updateRowRightPadding(d);
8938		pauseVideoBG();
8939
8940		//old browser workaround
8941		var timeout1 = 1220;
8942		var timeout2 = 1650;
8943		var timeout3 = 1700;
8944		var timeout4 = 1350;
8945		if( $('html.no-cssanimations').length > 0) {
8946			timeout1 = 1;
8947			timeout2 = 1;
8948			timeout3 = 1;
8949			timeout4 = 1;
8950		}
8951
8952		$('.container-wrap').css('padding-right',$('body').attr('data-scrollbar-width') + 'px');
8953		setTimeout(function(){
8954			$('#header-outer, #wpadminbar, body:not(.material) .cart-outer .cart-menu, .midnightHeader .midnightInner').animate({'padding-right': $('body').attr('data-scrollbar-width')},250);
8955			$('.nectar-box-roll .canvas-bg').addClass('out-of-sight');
8956			if($('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent');
8957
8958			if($('body.mobile').length > 0) $('.nectar-box-roll').css({'z-index':'1'});
8959			
8960			//perma trans coloring
8961			$first_row_coloring = ($('.container-wrap > .main-content > .row > .wpb_row').length > 0) ? $('.container-wrap > .main-content > .row > .wpb_row:first-child').attr('data-midnight') : 'dark';
8962			if($('#header-outer[data-permanent-transparent="1"]').length > 0) {
8963				
8964				if($first_row_coloring == 'dark') {
8965					$('#header-outer').addClass('dark-slide');
8966				} else {
8967					$('#header-outer').removeClass('dark-slide');
8968				}
8969				
8970			}
8971			
8972		},timeout1);
8973		setTimeout(function(){ 
8974			updateRowRightPadding(1);
8975			$('body,html,#ajax-content-wrap, .container-wrap, .blurred-wrap').removeClass('no-scroll'); 
8976			$('#ajax-content-wrap, .blurred-wrap').addClass('at-content');
8977			$('.container-wrap, #footer-outer').removeClass('bottomBoxIn').removeClass('nectar-box-roll-class').addClass('auto-height');
8978			$('#header-outer, #wpadminbar, .container-wrap, .cart-outer .cart-menu, .midnightHeader .midnightInner').stop().css('padding-right',0);
8979
8980			if( $smoothActive == 1 && $(window).width() > 690  && Modernizr.csstransforms3d && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){ 
8981				niceScrollInit();
8982			}
8983			
8984			$('.nectar-box-roll').css({'z-index':'-1000'}).transition({'y': '-200%'},0);
8985			$('.nectar-box-roll canvas').hide();
8986			$('body').removeClass('box-rolling');
8987			$('.nectar-slider-wrap').transition({'opacity':1},600,'easeOutCubic');
8988
8989			$('.nectar-box-roll #page-header-bg, .nectar-box-roll .overlaid-content, .container-wrap').css('will-change','auto');
8990			if($waypointsBound == false) { 
8991				waypoints();	
8992				midnightInit();
8993			}
8994			
8995		},timeout2);
8996		
8997		//fadeIn
8998		setTimeout(function(){ 
8999			$('.container-wrap .main-content > .row > div > div[class*="col"]').css({'opacity':1});
9000		},timeout4);
9001
9002		setTimeout(function(){ 
9003					animating ='false'; 
9004					$('body').removeClass('box-animating');		
9005		},timeout3);
9006
9007		//header position when transparent nav was used
9008		if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('.mobile').length == 0 && $('#header-outer[data-transparent-header="true"]').length != 0) { 
9009			$('#ajax-content-wrap').transition({'margin-top':$('#header-outer').outerHeight(true) + $('#header-outer').offset().top},2000,'easeInOutQuad');
9010		}
9011		/*if($('#header-outer[data-transparent-header="true"]').length == 0 && $('.mobile').length == 0) {
9012			$('.nectar-box-roll').transition({'top': 0},2000,'easeInOutQuad');
9013		}*/
9014		
9015
9016		//remove header if not fixed
9017		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');
9018
9019	}
9020
9021	else if(perspect == 'rolled' && animating == 'false' && d == 1 && $(window).scrollTop() < 100) {
9022
9023		$('.container-wrap').removeClass('auto-height');
9024		if($('#header-outer[data-transparent-header="true"]').length == 0) {
9025			$('.container-wrap').css({'height':$(window).height() - $headerNavSpace, 'opacity': 1});
9026		} else {
9027			$('.container-wrap').css({'height':$(window).height(), 'opacity': 1});
9028		}
9029		
9030		$('#footer-outer').removeClass('auto-height');
9031		$('body').addClass('box-rolling');
9032
9033		perspect = 'not-rolled';
9034		animating = 'true';
9035		$('body').addClass('box-animating').addClass('box-perspective-not-rolled');
9036
9037		$('#header-outer, #wpadminbar, .container-wrap, .cart-outer .cart-menu, .midnightHeader .midnightInner').css('padding-right',$('body').attr('data-scrollbar-width') + 'px');
9038		$('.nectar-slider-wrap').transition({'opacity':0},600,'easeOutCubic');
9039		$('.container-wrap .main-content > .row > div > div[class*="col"]').stop(true).css({'opacity':0});
9040		setTimeout(function(){
9041			$('#header-outer, #wpadminbar, .cart-outer .cart-menu, .midnightHeader .midnightInner').animate({'padding-right': 0},250);
9042			$('.nectar-box-roll .canvas-bg').removeClass('out-of-sight');
9043			resizeVideoToCover();
9044			//header position when transparent nav was used
9045			if($('#header-outer[data-transparent-header="true"]').length != 0) { 
9046				$('#ajax-content-wrap').stop(true,true).transition({'margin-top':0},2000,'easeInOutCubic');
9047			} else {
9048				if($('.mobile').length == 0) $('#slide-out-widget-area.fullscreen').css('margin-top','-'+$headerNavSpace+'px');
9049			}
9050			//if($('#header-outer[data-permanent-transparent="1"]').length == 0 && $('.mobile').length == 0 ) $('.nectar-box-roll').transition({'top': $('#header-space').height() },2000,'easeInOutQuad');
9051			
9052		},30);
9053
9054		//old browser workaround
9055		var timeout1 = 1700;
9056		var timeout2 = 1600;
9057		var timeout3 = 1300;
9058		if( $('html.no-cssanimations').length > 0) {
9059			timeout1 = 1;
9060			timeout2 = 1;
9061			timeout3 = 1;
9062		}
9063
9064		if($('body.mobile').length > 0) {
9065			setTimeout(function(){
9066				$('.nectar-box-roll').css('z-index','1000');
9067			},timeout3);
9068		} else {
9069			$('.nectar-box-roll').css('z-index','1000');
9070		}
9071
9072		updateRowRightPadding(d);
9073		removeNiceScroll();
9074		$('.nectar-box-roll').transition({'y': '0'},0);
9075		$('.nectar-box-roll canvas').show();
9076		setTimeout(function(){ 
9077			updateRowRightPadding(1);
9078			animating ='false'; 
9079			$('body').removeClass('box-animating');
9080			$('#page-header-bg').removeClass('topBoxIn');
9081			$('.overlaid-content').removeClass('topBoxIn2');	
9082			$('body').removeClass('box-rolling');
9083			resumeVideoBG();
9084			$('.nectar-box-roll #page-header-bg, .nectar-box-roll .overlaid-content, .container-wrap').css('will-change','auto');
9085			
9086			
9087			//perma trans coloring
9088			if($('#header-outer[data-permanent-transparent="1"]').length > 0) {
9089				
9090				if( $('.nectar-box-roll[data-midnight="dark"]').length > 0 ) {
9091					$('#header-outer').addClass('dark-slide');
9092				} else {
9093					$('#header-outer').removeClass('dark-slide');
9094				}
9095				
9096			}
9097			
9098		},timeout1);
9099
9100		setTimeout(function(){
9101			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');
9102		},timeout2);
9103
9104		$('body,html,#ajax-content-wrap, .container-wrap, .blurred-wrap').addClass('no-scroll');
9105		$('#ajax-content-wrap, .blurred-wrap').removeClass('at-content');
9106		$('.container-wrap').addClass('nectar-box-roll-class');
9107		$('.nectar-box-roll #page-header-bg').removeClass('topBoxOut').addClass('topBoxIn').css('will-change','transform');
9108		
9109		$('.container-wrap').removeClass('bottomBoxIn').addClass('bottomBoxOut').css('will-change','transform');
9110
9111		if($('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').addClass('transparent');
9112
9113		$('.nectar-box-roll .overlaid-content').removeClass('topBoxOut2').removeClass('topBoxOut').addClass('topBoxIn2').css('will-change','transform');
9114	
9115		if($('#header-outer[data-header-resize="1"]').length > 0) { bigNav(); }
9116
9117		$('.nectar-box-roll .trigger-scroll-down').removeClass('hovered');
9118	}
9119
9120	
9121}
9122
9123function boxScrollEvent(event, delta) {
9124	if($('#slide-out-widget-area.open.fullscreen').length > 0 || $('.material-ocm-open').length > 0 ||  $('#search-outer.material-open').length > 0 ) return false;
9125	boxRoll(event,delta);
9126}
9127
9128function boxRollMouseWheelInit() {
9129	if($('.nectar-box-roll').length > 0) {
9130		$('body').on("mousewheel", boxScrollEvent);
9131	} else {
9132		$('body').off("mousewheel", boxScrollEvent);
9133	}
9134}
9135
9136if($('.nectar-box-roll').length > 0) {
9137	boxRollMouseWheelInit();
9138}
9139
9140$('body').on('click','.nectar-box-roll .section-down-arrow',function(){
9141	boxRoll(null,-1);
9142	$(this).addClass('hovered');
9143	setTimeout(function(){ $('.nectar-box-roll .section-down-arrow').removeClass('hovered'); },2000);
9144	return false;
9145});
9146
9147
9148
9149function updateRowRightPadding(d){
9150	$('.wpb_row.full-width-section').each(function(){
9151		if($(this).hasClass('extraPadding') && d == 1) {
9152			$(this).css('padding-right',parseInt($(this).css('padding-right')) - parseInt($('body').attr('data-scrollbar-width')) + 'px' ).removeClass('extraPadding');
9153		} else {
9154			$(this).css('padding-right',parseInt($('body').attr('data-scrollbar-width')) + parseInt($(this).css('padding-right')) + 'px' ).addClass('extraPadding');
9155		}	
9156	});
9157	$('.wpb_row.full-width-content').each(function(){
9158		if($(this).find('.row-bg.using-image').length == 0) {
9159			if($(this).hasClass('extraPadding') && d == 1) {
9160				$(this).find('.row-bg').css('width',parseInt($(this).width()) - parseInt($('body').attr('data-scrollbar-width')) + 'px' ).removeClass('extraPadding');
9161			} else {
9162				$(this).find('.row-bg').css('width',parseInt($('body').attr('data-scrollbar-width')) + $(this).width() + 'px' ).addClass('extraPadding');
9163			}	
9164		}
9165	});
9166}
9167
9168function pauseVideoBG() {
9169	if($('.nectar-box-roll video').length > 0 && !nectarDOMInfo.usingMobileBrowser) { $('.nectar-box-roll video')[0].pause(); }
9170}
9171function resumeVideoBG() {
9172	if($('.nectar-box-roll video').length > 0 && !nectarDOMInfo.usingMobileBrowser) { $('.nectar-box-roll video')[0].play(); }
9173}
9174
9175//touch 
9176if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) && $('.nectar-box-roll').length > 0) {
9177	$('body').swipe({
9178		tap: function(event,target) {
9179			if($(target).parents('.nectar-flip-box').length > 0)
9180				$(target).parents('.nectar-flip-box').trigger('click');
9181			if($(target).is('.nectar-flip-box'))
9182				$(target).trigger('click');
9183		},
9184		swipeStatus: function(event, phase, direction, distance, duration, fingers) {
9185			if($('#slide-out-widget-area.open').length > 0) return false;
9186			if(direction == 'up') {
9187				boxRoll(null,-1);
9188				if($('#ajax-content-wrap.no-scroll').length == 0) $('body').swipe("option", "allowPageScroll", 'vertical');
9189			} else if(direction == "down" && $(window).scrollTop() == 0) {
9190				boxRoll(null,1);
9191				$('body').swipe("option", "allowPageScroll", 'auto');
9192			}
9193		}
9194	});
9195
9196}
9197
9198function removeNiceScroll() {
9199		if($().niceScroll && $("html").getNiceScroll()){
9200			var nice = $("html").getNiceScroll();
9201			nice.stop();
9202			
9203			$('html').removeClass('no-overflow-y');
9204			$('.nicescroll-rails').hide();
9205			if($('#boxed').length == 0){
9206				$('body, body #header-outer, body #header-secondary-outer, body #search-outer, .midnightHeader .midnightInner').css('padding-right','0px');
9207			} else if($('body[data-ext-responsive="true"]').length == 0 ) {
9208				$('body').css('padding-right','0px');
9209			}
9210
9211			$('body').attr('data-smooth-scrolling','0');
9212		}
9213	}
9214//called after box roll
9215$waypointsBound = false;
9216function waypoints() {
9217	colAndImgAnimations(); 
9218	progressBars(); 
9219	dividers();
9220	iconList();
9221	animated_titles();
9222	highlighted_text();
9223	imageWithHotspots();
9224	clientsFadeIn(); 
9225	splitLineHeadings();
9226	svgAnimations(); 
9227	milestoneInit();
9228	nectar_fancy_ul_init();
9229	owl_carousel_animate();
9230	headerRowColorInheritInit();
9231	morphingOutlines(); 
9232	portfolioLoadIn();
9233	animatedColBorders();
9234	foodMenuItems();
9235	vcWaypoints();
9236	$waypointsBound = true;
9237}
9238
9239
9240
9241/***************** WooCommerce Cart *****************/
9242var timeout;
9243var productToAdd;
9244var $dropdownStyle = ($('body[data-dropdown-style="minimal"]').length > 0)  ? 'minimal' : 'default';
9245//notification
9246$('body').on('click','.product .add_to_cart_button', function(){
9247
9248	var $productHeading = ($(this).parents('li').find('h2').length > 0) ? 'h2' : 'h3';
9249
9250	productToAdd = $(this).parents('li').find($productHeading).text();
9251	$('#header-outer .cart-notification span.item-name').html(productToAdd);
9252
9253	//if($('.cart-menu-wrap').hasClass('first-load')) $('.cart-menu-wrap').removeClass('first-load').addClass('static');
9254});
9255
9256//notification hover
9257$('body').on('mouseenter','#header-outer .cart-notification',function(){
9258	if($dropdownStyle == 'minimal') {
9259		$(this).hide();
9260		$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).show();
9261		$('#header-outer .cart_list').stop(true,true).show();
9262	} else {
9263		$(this).fadeOut(400);
9264		$('#header-outer .widget_shopping_cart').stop(true,true).fadeIn(300);
9265		$('#header-outer .cart_list').stop(true,true).fadeIn(300);
9266	}
9267	
9268	clearTimeout(timeout);
9269});
9270
9271//cart dropdown
9272var $headerCartSelector = ($('body.material').length > 0) ? '#header-outer .nectar-woo-cart' : '#header-outer  div.cart-outer';
9273
9274if($($headerCartSelector).length > 0) {
9275	$($headerCartSelector).hoverIntent(function(){
9276
9277		if($dropdownStyle == 'minimal') { 
9278			$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).show()
9279			$('#header-outer .cart_list').stop(true,true).show();
9280			clearTimeout(timeout);
9281			$('#header-outer .cart-notification').hide();
9282		} else {
9283			$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).fadeIn(300);
9284			$('#header-outer .cart_list').stop(true,true).fadeIn(300);
9285			clearTimeout(timeout);
9286			$('#header-outer .cart-notification').fadeOut(300);
9287		}
9288		
9289	});
9290}
9291
9292
9293$('body').on('mouseleave',$headerCartSelector,function(){
9294	var $that = $(this);
9295	setTimeout(function(){
9296		if(!$that.is(':hover')){
9297			$('#header-outer .widget_shopping_cart').removeClass('open').stop(true,true).fadeOut(300);
9298			$('#header-outer .cart_list').stop(true,true).fadeOut(300);
9299		}
9300	},200);
9301});
9302
9303if($('#header-outer[data-cart="false"]').length == 0) {
9304	$('body').on('added_to_cart', shopping_cart_dropdown_show);
9305	$('body').on('added_to_cart', shopping_cart_dropdown);
9306	
9307	//update header cart markup after ajax remove
9308	$('body').on('removed_from_cart', wooCartImgPos);
9309}
9310
9311function shopping_cart_dropdown() {
9312		
9313		if(!$('.widget_shopping_cart .widget_shopping_cart_content .cart_list .empty').length && $('.widget_shopping_cart .widget_shopping_cart_content .cart_list').length > 0 ) {
9314			$('.cart-menu-wrap').addClass('has_products');
9315			$('header#top nav > ul, #search-outer #search #close a, header#top .span_9 >.slide-out-widget-area-toggle').addClass('product_added');
9316
9317			if(!$('.cart-menu-wrap').hasClass('static')) $('.cart-menu-wrap, #mobile-cart-link').addClass('first-load');
9318			
9319			//change position of img in cart nav dropdown
9320			wooCartImgPos();
9321			
9322			//nectar slider nav directional effect
9323			if($('#header-outer').hasClass('directional-nav-effect') && $('#header-outer .cart-icon-wrap .dark').length == 0 && $('body.ascend').length > 0){
9324				$('#header-outer .cart-outer .cart-icon-wrap').each(function(){
9325                    $(this).find('> i, > span.light, > span.dark, > span.original').remove();
9326                    $(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>');
9327                	$(this).find('.original').attr('data-w',$(this).find('span.original').width()+1);
9328                });
9329			}
9330		}
9331
9332}
9333
9334
9335function shopping_cart_dropdown_show(e) {
9336		
9337		clearTimeout(timeout);
9338		
9339		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' ) {
9340			
9341			//fix for standalone woocommerce add to cart buttons
9342			if( $('#header-outer .cart-notification .item-name').length > 0 && $('#header-outer .cart-notification .item-name').text().length == 0 ) { return; }
9343			
9344			//before cart has slide in
9345			if(!$('#header-outer .cart-menu-wrap').hasClass('has_products')) {
9346				setTimeout(function(){ $('#header-outer .cart-notification').fadeIn(400); },400);
9347			}
9348			else if(!$('#header-outer .cart-notification').is(':visible')) {
9349				$('#header-outer .cart-notification').fadeIn(400);
9350			} else {
9351				$('#header-outer .cart-notification').show();
9352			}
9353			timeout = setTimeout(hideCart,2700);
9354
9355			$('.cart-menu a, .widget_shopping_cart a').addClass('no-ajaxy');
9356		}
9357}
9358
9359function hideCart() {
9360	$('#header-outer .cart-notification').stop(true,true).fadeOut();
9361}
9362
9363function checkForWooItems(){ 
9364	
9365	var checkForCartItems = setInterval(shopping_cart_dropdown,250);
9366	setTimeout(function(){ clearInterval(checkForCartItems); },4500);
9367	
9368}
9369
9370function wooCartImgPos() {
9371	$('#header-outer .widget_shopping_cart .cart_list li').each(function(){
9372		
9373		if( $(this).find('> img').length == 0 && $(this).find('.product-meta').length == 0 ) {
9374			
9375			var productCartImgLinkSrc = ($(this).find('> a[href]:not(.remove)').length > 0) ? $(this).find('> a[href]:not(.remove)').attr('href') : '';
9376			var productCartImg = $(this).find('> a > img').clone();
9377			
9378			$(this).wrapInner('<div class="product-meta" />');
9379			
9380			$(this).prepend(productCartImg);
9381			
9382			if(productCartImgLinkSrc.length > 0) {
9383			   productCartImg.wrap('<a href="'+productCartImgLinkSrc+'"></a>');
9384			}
9385			
9386		}
9387		
9388	});
9389}
9390
9391if($('#header-outer[data-cart="false"]').length == 0) {
9392	checkForWooItems();
9393}
9394
9395function nectarAccountPageTabs() {
9396	
9397	//if not on account page
9398	if($('body.woocommerce-account #customer_login').length == 0) return;
9399	
9400	//create HTML
9401	$('.woocommerce-account .woocommerce > #customer_login').prepend('<div class="nectar-form-controls" />');
9402	
9403	$('.woocommerce-account .woocommerce > #customer_login > div:not(.nectar-form-controls)').each(function(){
9404			var $title = $(this).find('> h2').text();
9405			$('#customer_login .nectar-form-controls').append('<div class="control">' + $title + '</div>');
9406	});
9407	
9408	//event
9409	$('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').on('click',function(){
9410		
9411		$('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control').removeClass('active');
9412		$(this).addClass('active');
9413		
9414		var formIndex = $(this).index() + 1;
9415		$('#customer_login div[class*="u-column"]').hide();
9416		$('#customer_login div[class*="u-column"].col-'+formIndex).show();
9417		
9418		setTimeout(function(){
9419			$('#customer_login div[class*="u-column"]').removeClass('visible');
9420			$('#customer_login div[class*="u-column"].col-'+formIndex).addClass('visible');
9421		},30);
9422		
9423	});
9424	
9425	//starting
9426	$('.woocommerce-account .woocommerce > #customer_login .nectar-form-controls .control:nth-child(1)').trigger('click');
9427	
9428}
9429
9430nectarAccountPageTabs();
9431
9432var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
9433var secondaryHeader = ($('#header-outer').attr('data-using-secondary') == '1') ? 32 : 0 ;
9434function searchFieldCenter(){
9435	var $headerHeightSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
9436	$('#search-outer').css('top', $headerHeightSpace + extraHeight + secondaryHeader);
9437	$('#search-outer > #search #search-box').css('top',($(window).height()/2) - ($('#search-outer > #search input').height()/2) - $headerHeightSpace );
9438}
9439
9440
9441
9442//text on hover effect
9443$('body').on('mouseover','.text_on_hover .product-wrap',function(){
9444	$(this).parent().addClass('hovered');
9445	//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');
9446});
9447$('body').on('mouseover','.text_on_hover > a:first-child',function(){
9448	$(this).parent().addClass('hovered');
9449});
9450
9451$('body').on('mouseout','.text_on_hover .product-wrap',function(){
9452	$(this).parent().removeClass('hovered');
9453	//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);
9454});
9455$('body').on('mouseout','.text_on_hover > a:first-child',function(){
9456	$(this).parent().removeClass('hovered');
9457});
9458
9459
9460//material/fancy parallax hover effect zindex
9461if($('.material.product').length > 0 || $('.minimal.product').length > 0 || $('.nectar-fancy-box[data-style="parallax_hover"]').length > 0 || $('.nectar-category-grid[data-shadow-hover="yes"]').length > 0){
9462
9463	$productZindex = 101;
9464	$('body').on('mouseenter','.material.product, .minimal.product, .nectar-fancy-box[data-style="parallax_hover"], .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item',function(){
9465		
9466		$productZindex++;
9467
9468		$(this).css('z-index',$productZindex+1);
9469		
9470	});
9471	$('body').on('mouseleave','.material.product, .minimal.product, .nectar-fancy-box[data-style="parallax_hover"], .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item',function(){
9472		
9473		var $that = $(this);
9474		setTimeout(function(){ if(!$that.is(':hover')) $that.css('z-index',100); },350);
9475	});
9476
9477	//reset to stop zindex from getting too high
9478	setInterval(function(){ 
9479		if($('.nectar-fancy-box[data-style="parallax_hover"]:hover').length > 0 || $('.minimal.product:hover').length > 0) {
9480			 return;
9481		}
9482
9483		$('.material.product:not(:hover), .minimal.product:not(:hover), .nectar-fancy-box[data-style="parallax_hover"]:not(:hover), .nectar-category-grid[data-shadow-hover="yes"] .nectar-category-grid-item:not(:hover)').css('z-index',100);
9484		$productZindex = 101; 
9485	},10000);
9486
9487}
9488
9489function minimalProductHover() {
9490	
9491	//add icons
9492	$('.products .classic .product-wrap .add_to_cart_button').wrapInner('<span />');
9493	$('.products .classic .product-wrap .add_to_cart_button').prepend('<i class="normal icon-salient-cart"></i>');
9494	
9495	//bind hover
9496	$('body').on('mouseover', '.products .minimal.product',function(){
9497		minimalProductCalc($(this));
9498	});
9499	
9500	$('body').on('mouseleave', '.products .minimal.product',function(){
9501		
9502		$(this).find('.background-color-expand').css({
9503			'transform': 'scale(1)'
9504		});
9505		
9506	});
9507	
9508	//starting trigger mouse over
9509	$('.products .minimal.product').each(function(){
9510		if($(this).is(':hover')) {
9511			$(this).trigger('mouseover');
9512		}
9513	});
9514}
9515
9516function minimalProductCalc(el) {
9517	var $item = el;
9518	var $itemWidth = $item.width();
9519	var $itemHeight = $item.height();
9520	
9521	var $wChange = (parseInt($itemWidth) + 40) / parseInt($itemWidth);
9522	var $hChange = (parseInt($itemHeight) + 40) / parseInt($itemHeight);
9523	
9524	$item.addClass('hover-bound');
9525	
9526	$item.find('.background-color-expand').css({
9527		'transform': 'scale('+ $wChange + ',' + $hChange  +') translateY(0px)'
9528	});
9529}
9530
9531minimalProductHover();
9532
9533
9534
9535
9536//mobile widget filters
9537////skip widgets without any titles
9538$('.woocommerce #sidebar .widget.woocommerce').each(function(){
9539	if($(this).find('> h4').length == 0) {
9540		$(this).addClass('no-widget-title');
9541	}
9542});
9543
9544$('body').on('click','#sidebar .widget.woocommerce:not(.widget_price_filter) h4',function(){
9545	if($(window).width() < 1000) {
9546		$(this).parent().find('> ul').slideToggle();
9547		$(this).parent().toggleClass('open-filter');
9548	}
9549});
9550
9551	//slide in cart
9552	$('body').on('mouseenter','#header-outer [data-cart-style="slide_in"] .cart-menu-wrap',openRightCart);
9553
9554	function openRightCart() {
9555
9556		if($('.nectar-slide-in-cart ul.cart_list li:not(.empty)').length > 0) {
9557			$('.nectar-slide-in-cart').addClass('open');
9558
9559			$(window).on('mousemove.rightCartOffsetCheck',closeCartCheck);
9560		}
9561	}
9562
9563	function closeCartCheck(e) {
9564		var $windowWidth = $(window).width();
9565		if(e.clientX < $windowWidth - 370 - $bodyBorderWidth) {
9566
9567			$(window).off('mousemove.rightCartOffsetCheck',closeNavCheck);
9568
9569			$('.nectar-slide-in-cart').removeClass('open');
9570
9571		}
9572
9573	}
9574
9575
9576
9577
9578
9579/***************** Search ******************/
9580	var $placeholder = $('#search input[type=text]').attr('data-placeholder');
9581	var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
9582	
9583
9584	if($('body').hasClass('material') && $('#header-outer .bg-color-stripe').length == 0) {
9585		$('#header-outer').append('<div class="bg-color-stripe" />');
9586	} 
9587
9588	////search box event
9589	$('body').on('click', '#search-btn a', function(){ return false; });
9590	$('body').on('mouseup', '#search-btn a:not(.inactive), #header-outer .mobile-search', function(){
9591
9592		if($(this).hasClass('open-search')) { return false; } 
9593
9594
9595		if($('body').hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0 ){ 
9596			$('#search-outer > #search form, #search-outer #search .span_12 span').css('opacity',0);
9597			$('#search-outer > #search form').css('bottom','10px');
9598			$('#search-outer #search .span_12 span').css('top','10px');
9599			$('#search-outer').show();
9600			$('#search-outer').stop().transition({scale: '1,0', 'opacity': 1},0).transition({ scale: '1,1'},400,'easeInOutCubic');
9601
9602			$('#search-outer > #search form').delay(400).animate({'opacity':1, 'bottom':0},'easeOutCirc');
9603			$('#search-outer #search .span_12 span').delay(470).animate({'opacity':1, 'top':0},'easeOutCirc');
9604			
9605		} else if( !$('body').hasClass('material') ) {
9606			$('#search-outer').stop(true).fadeIn(600,'easeOutExpo');
9607		} else {
9608
9609			/*material*/
9610			$('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition',''); //remove element.tyle of no transition in case it was removed from smallNav
9611
9612			$('#search-outer').addClass('material-open');
9613			$('#ajax-content-wrap').addClass('material-open');
9614			$('#header-outer').addClass('material-search-open');
9615			$('#fp-nav').addClass('material-ocm-open');
9616
9617
9618		}
9619
9620
9621		if($('body[data-header-format="left-header"]').length == 0) {
9622			$('body.original #search-outer > #search input[type="text"]').css({
9623				'top' : $('#search-outer').height()/2 - $('#search-outer > #search input[type="text"]').height()/2
9624			});
9625		}
9626		
9627		setTimeout(function(){
9628
9629			$('#search input[type=text]').focus();
9630			
9631			if($('#search input[type=text]').attr('value') == $placeholder){
9632				$('#search input[type=text]').setCursorPosition(0);	
9633			}
9634
9635		},300);
9636
9637		//ascend
9638		if($('body').hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0){ 
9639			searchFieldCenter();
9640		}
9641
9642		$(this).toggleClass('open-search');
9643
9644		//close slide out widget area
9645		$('.slide-out-widget-area-toggle a:not(#toggle-nav).open:not(.animating)').trigger('click');
9646
9647		return false;
9648	});
9649	
9650	$('body:not(.material)').on('keydown','#search input[type=text]',function(){
9651		if($(this).attr('value') == $placeholder){
9652			$(this).attr('value', '');
9653		}
9654	});
9655	
9656	$('body:not(.material)').on('keyup','#search input[type=text]',function(){
9657		if($(this).attr('value') == ''){
9658			$(this).attr('value', $placeholder);
9659			$(this).setCursorPosition(0);
9660		}
9661	});
9662	
9663	
9664	////close search btn event
9665	$('body').on('click','#close',function(){
9666		closeSearch();
9667		$('#search-btn a, #header-outer .mobile-search').removeClass('open-search');
9668		return false;
9669	});
9670
9671	//close material when clicking off the search
9672	$('body.material').on('click', '#ajax-content-wrap', function(e){
9673		if (e.originalEvent !== undefined) {
9674			closeSearch();
9675			$('#search-btn a, #header-outer .mobile-search').removeClass('open-search');
9676		}
9677	});
9678
9679	//material gets esc
9680	if($('body.material').length > 0) {
9681		$(document).keyup(function(e) {
9682
9683	     if (e.keyCode == 27) { 
9684	     	closeSearch();  
9685	     	$('#search-btn a').removeClass('open-search'); 
9686
9687	     	//close ocm material
9688	     	if($('.ocm-effect-wrap.material-ocm-open').length > 0) {
9689	     		$('.slide-out-widget-area-toggle.material-open a').trigger('click');
9690	     	}
9691	     }
9692
9693		});
9694	}
9695
9696	//if user clicks away from the search close it
9697	$('body:not(.material)').on('blur','#search-box input[type=text]',function(e){
9698		closeSearch();
9699		$('#search-btn a, #header-outer .mobile-search').removeClass('open-search');
9700	});
9701
9702	
9703	function closeSearch(){
9704		if($('body').hasClass('ascend') || $('body[data-header-format="left-header"]').length > 0 && $('body.material').length == 0){ 
9705			$('#search-outer').stop().transition({'opacity' :0},300,'easeOutCubic');
9706			$('#search-btn a').addClass('inactive');
9707			setTimeout(function(){ $('#search-outer').hide(); $('#search-btn a').removeClass('inactive'); },300);
9708		} else if($('body.material').length == 0) {
9709			$('#search-outer').stop(true).fadeOut(450,'easeOutExpo');
9710		}
9711
9712		if($('body').hasClass('material')) {
9713			$('#ajax-content-wrap').removeClass('material-open');
9714			$('#header-outer').removeClass('material-search-open');
9715			$('#search-outer').removeClass('material-open');
9716			$('#fp-nav').removeClass('material-ocm-open');
9717		}
9718	}
9719	
9720	
9721	//mobile search
9722	$('body').on('click', '#mobile-menu #mobile-search .container a#show-search',function(){
9723		$('#mobile-menu .container > ul').slideUp(500);
9724		return false;
9725	});
9726	
9727/***************** Nav ******************/
9728	
9729
9730	function centeredNavBottomBarReposition() {
9731		
9732		var $headerOuter = $('#header-outer');
9733		var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
9734		var $headerSpan3 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_3');
9735		var $secondaryHeader = $('#header-secondary-outer');
9736		var $headerBtns = $headerSpan3.find('nav >ul.buttons');
9737		var $bodyBorderSize = ($('.body-border-top').length > 0 && $(window).width() > 1000) ? $('.body-border-top').height(): 0;
9738		var override_remove_check = false;
9739		
9740		function centeredNavBottomBarSecondary() {
9741			if($('body.mobile').length > 0) {
9742				$('#header-outer').css('margin-top','');
9743			} else {
9744				if($('#header-outer').css('top') == '0px') {
9745						
9746						$(window).off('scroll', centeredNavBottomFixed_Add);
9747						$(window).off('scroll', centeredNavBottomFixed_Remove);
9748						
9749						$navLogoMargin = parseInt($('body.material #header-outer #logo').css('margin-top'));
9750						if($headerSpan9.offset().top - $navLogoMargin - nectarDOMInfo.scrollTop <= $headerOuter.offset().top - parseInt($secondaryHeader.height()) ) {
9751								$(window).on('scroll', centeredNavBottomFixed_Add);
9752						} else {
9753								$(window).on('scroll', centeredNavBottomFixed_Remove);
9754						}
9755					
9756				}
9757
9758				
9759				$('#header-outer').css('margin-top',nectarDOMInfo.secondaryHeaderHeight);
9760				
9761				// custom mobile breakpoint
9762				if($('#header-outer .span_9').css('display') == 'none') {
9763					 $('#header-outer').css('margin-top','');
9764				} else if($('#header-outer .span_9').css('display') != 'none' && parseInt($('#header-outer').css('top')) > 0) {
9765					 $('#header-outer').css('top','');
9766				}
9767				
9768				
9769			}
9770			
9771		}
9772		
9773		if($secondaryHeader.length > 0) {
9774			
9775			if($('#header-outer[data-remove-fixed="1"]').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
9776				setTimeout(function(){
9777					nectarDOMInfo.secondaryHeaderHeight = $('#header-secondary-outer').height();
9778					centeredNavBottomBarSecondary();
9779				},50);
9780				$(window).smartresize(centeredNavBottomBarSecondary);
9781			}
9782		
9783		} 
9784		
9785
9786		var $navLogoMargin = parseInt($('body.material #header-outer #logo').css('margin-top'));
9787		
9788
9789		if($('#header-outer[data-condense="true"]').length > 0) {
9790			
9791				$(window).on('scroll',centeredNavBottomFixed_Add);
9792				$(window).trigger('scroll');
9793				
9794				
9795				$(window).smartresize(function(){
9796					
9797					condenseCustomBreakPointHelper();
9798					
9799					//trigger condense if switching from mobile to desktop and user has scrolled down
9800					if(nectarDOMInfo.windowWidth > 1000 && $('#header-outer').css('position') == 'fixed' && $('#header-outer').css('top') == '0px' && override_remove_check == false) {
9801						setTimeout(function(){
9802							$(window).off('scroll', centeredNavBottomFixed_Add);
9803							$(window).off('scroll', centeredNavBottomFixed_Remove);
9804							override_remove_check = true;
9805							centeredNavBottomFixed_Remove();
9806						},100);
9807							
9808					}
9809				});
9810				
9811				function condenseCustomBreakPointHelper() {
9812					var $withinCustomBreakpoint = mobileBreakPointCheck();
9813					
9814					//adding class to prevent logo from hiding when opening OCM
9815					if($withinCustomBreakpoint) {
9816						$('#header-outer').addClass('within-custom-breakpoint');
9817					} else {
9818						$('#header-outer').removeClass('within-custom-breakpoint');
9819					}
9820				}
9821				
9822				condenseCustomBreakPointHelper();
9823
9824		}
9825
9826		
9827		
9828		
9829		function centeredNavBottomFixed_Add() {
9830				
9831				if(nectarDOMInfo.windowWidth < 1000 || $('body.material-ocm-open').length > 0 || $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9').css('display') == 'none') { return; }
9832				
9833				$navLogoMargin = parseInt($('body.material #header-outer #logo').css('margin-top'));
9834				
9835				var $bodyBorderTop = ($('.body-border-top').length > 0 && nectarDOMInfo.secondaryHeaderHeight > 0) ? $('.body-border-top').height() : 0;
9836				
9837				if($headerSpan9.offset().top - $navLogoMargin - nectarDOMInfo.scrollTop <= $headerOuter.offset().top - parseInt(nectarDOMInfo.secondaryHeaderHeight) + $bodyBorderTop ) {
9838						
9839						var amountToMove = (parseInt($headerSpan9.position().top) - $navLogoMargin - parseInt(nectarDOMInfo.adminBarHeight)) + parseInt(nectarDOMInfo.secondaryHeaderHeight) - $bodyBorderTop;
9840						
9841						//megamenu RT
9842						if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer .megamenu').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0) {
9843							$('#header-outer').removeClass('no-transition');	
9844						}
9845						
9846						$headerOuter.addClass('fixed-menu').removeClass('transparent').css({
9847							'top' : '-' + amountToMove + 'px',
9848							'position': 'fixed'
9849						});
9850						
9851						var $headerNavBarOffset = $('header#top .span_9 nav >ul').offset().top;
9852						var $headerButtonsOffset = $headerBtns.offset().top;
9853						
9854						if($('#boxed > #header-outer').length > 0) {
9855							$headerButtonsOffset = $headerButtonsOffset + 20;
9856						}
9857
9858						var $headerButtonsHeight = ($headerSpan9.find('.sf-menu > li > a').length > 0) ? (20 - parseInt($headerSpan9.find('.sf-menu > li > a').height())) / 2 : 2;
9859						$headerBtns.css('transform','translateY('+ (parseInt($headerNavBarOffset) - parseInt($headerButtonsOffset) - $headerButtonsHeight - 1) +'px)');
9860						
9861						$headerBtns.find('.nectar-woo-cart').css('height',$headerOuter.height() + parseInt($headerOuter.css('top')) - parseInt(nectarDOMInfo.adminBarHeight) + parseInt(nectarDOMInfo.secondaryHeaderHeight) );
9862
9863						//search
9864						//$('#search-outer .container').css({'transform':'translateY('+ amountToMove/2 +'px)', 'transition': 'transform 0.3s ease'});
9865
9866						
9867						$(window).off('scroll', centeredNavBottomFixed_Add);
9868						$(window).on('scroll', centeredNavBottomFixed_Remove);
9869				}
9870		}
9871		
9872		function centeredNavBottomFixed_Remove() {
9873			
9874			if(nectarDOMInfo.windowWidth < 1000 || $('body.material-ocm-open').length > 0 || $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"] .span_9').css('display') == 'none') { return; }
9875			
9876			$navLogoMargin = parseInt($('body.material #header-outer #logo').css('margin-top'));
9877			
9878			if($headerSpan9.offset().top - $navLogoMargin - nectarDOMInfo.scrollTop > $headerOuter.offset().top - parseInt(nectarDOMInfo.secondaryHeaderHeight) || override_remove_check ) {
9879						$headerOuter.removeClass('fixed-menu').css({
9880							'top' : '0',
9881							'position': 'absolute'
9882						});
9883						
9884						//reset override_remove_check
9885						override_remove_check = false;
9886						
9887						//search
9888						//$('#search-outer .container').css('transform','translateY(0px)');
9889						
9890						$headerBtns.css('transform','translateY(0px)');
9891						
9892						$headerBtns.find('.nectar-woo-cart').css('height','');
9893						
9894						if($('#header-outer.transparent').length == 0) {
9895							
9896							if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer .megamenu').length > 0) {
9897								$('#header-outer').removeClass('no-transition');	
9898							}
9899							
9900							if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
9901								
9902								if($('#header-outer').attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0 && $('.megamenu.sfHover').length == 0) {
9903									$('#header-outer').addClass('transparent');
9904									$('#header-outer').removeClass('no-transition');	
9905								}
9906								
9907								else if($('#header-outer').attr('data-transparent-header') == 'true' && $('.nectar-box-roll').length == 0 && $('.megamenu.sfHover').length > 0) {
9908									$('#header-outer').addClass('no-transition');	
9909								}
9910								
9911							} else {
9912								if($('#header-outer').attr('data-transparent-header') == 'true'  && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent');
9913							}
9914						}
9915						
9916						$(window).off('scroll', centeredNavBottomFixed_Remove);
9917						$(window).on('scroll', centeredNavBottomFixed_Add);
9918							
9919			}
9920			
9921		}
9922		
9923		
9924		
9925}
9926	
9927	
9928
9929function condenseHeaderMobileOverride() {
9930	var $transCondenseHeader = $('#header-outer[data-has-menu="true"][data-format="centered-menu-bottom-bar"][data-condense="true"][data-transparent-header="true"] .span_9');
9931	
9932	if($transCondenseHeader.length > 0 && nectarDOMInfo.windowWidth > 1000 && $transCondenseHeader.css('display') == 'none') {
9933		$('#header-outer').removeClass('transparent').addClass('no-transition');
9934	} else if($transCondenseHeader.length > 0 && nectarDOMInfo.scrollTop < 20 && nectarDOMInfo.windowWidth > 1000 && $transCondenseHeader.css('display') != 'none') {
9935		$('#header-outer:not(.transparent)').addClass('transparent');
9936	}
9937
9938	
9939}
9940
9941
9942	
9943	if($('#header-outer[data-format="centered-menu-bottom-bar"]').length > 0) {
9944		centeredNavBottomBarReposition();
9945		
9946		condenseHeaderMobileOverride();
9947		$(window).smartresize(condenseHeaderMobileOverride);
9948	}
9949	
9950	
9951	
9952	
9953	
9954	function centeredLogoMargins() {
9955
9956		if($('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $(window).width() > 1000) {
9957			$midnightSelector = ($('#header-outer .midnightHeader').length > 0) ? '> .midnightHeader:first-child' : '';
9958			var $navItemLength = $('#header-outer[data-format="centered-logo-between-menu"] '+$midnightSelector+' nav > .sf-menu > li').length;
9959			if($('#header-outer #social-in-menu').length > 0) { $navItemLength--; }
9960
9961			$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());
9962
9963			$extraMenuSpace = ($('#header-outer[data-lhe="animated_underline"]').length > 0) ? parseInt($('#header-outer header#top nav > ul > li:first-child > a').css('margin-right')) : parseInt($('#header-outer header#top nav > ul > li:first-child > a').css('padding-right'));
9964			
9965			if($extraMenuSpace > 30) {
9966				$extraMenuSpace += 45;
9967			} else if($extraMenuSpace > 20) {
9968				$extraMenuSpace += 40;
9969			} else {
9970				$extraMenuSpace += 30;
9971			}
9972
9973			$('#header-outer[data-format="centered-logo-between-menu"] nav > .sf-menu > li:nth-child('+Math.floor($navItemLength/2)+')').css({'margin-right': ($centerLogoWidth+$extraMenuSpace) + 'px'}).addClass('menu-item-with-margin');
9974			$leftMenuWidth = 0;
9975			$rightMenuWidth = 0;
9976			$('#header-outer[data-format="centered-logo-between-menu"] '+$midnightSelector+' nav > .sf-menu > li:not(#social-in-menu)').each(function(i){
9977				if(i+1 <= Math.floor($navItemLength/2)) {
9978					$leftMenuWidth += $(this).width();
9979				} else {
9980					$rightMenuWidth += $(this).width();
9981				}
9982
9983			});
9984
9985			var $menuDiff = Math.abs($rightMenuWidth - $leftMenuWidth);
9986
9987			if($leftMenuWidth > $rightMenuWidth)  {
9988				$('#header-outer .row > .col.span_9').css('padding-right',$menuDiff);
9989			}
9990			else {
9991				$('#header-outer .row > .col.span_9').css('padding-left',$menuDiff);
9992			}
9993
9994			$('#header-outer[data-format="centered-logo-between-menu"] nav').css('visibility','visible');
9995		}
9996	}
9997	
9998	var logoHeight = parseInt($('#header-outer').attr('data-logo-height'));
9999	var headerPadding = parseInt($('#header-outer').attr('data-padding'));
10000	var usingLogoImage = $('#header-outer').attr('data-using-logo');
10001	
10002	if( isNaN(headerPadding) || headerPadding.length == 0 ) { headerPadding = 28; }
10003	if( isNaN(logoHeight) || usingLogoImage.length == 0 ) { usingLogoImage = false; logoHeight = 30;}
10004	
10005	if($('header#top nav > ul li#search-btn a').length > 0) {
10006		$searchBtnHeight = $('header#top nav > ul li#search-btn a').height();
10007	} else {
10008		$searchBtnHeight = 24;
10009	}
10010
10011	//inital calculations
10012	function headerInit() {
10013		
10014		if($('#header-outer[data-format="left-header"]').length > 0) return;
10015
10016
10017		if($('body.material').length == 0) {
10018
10019			$('#header-outer #logo img').css({
10020				'height' : logoHeight				
10021			});	
10022
10023			$('body:not(.material) #header-outer, .ascend #header-outer[data-full-width="true"][data-using-pr-menu="true"] header#top nav ul.buttons li.menu-item, .ascend #header-outer[data-full-width="true"][data-format="centered-menu"] header#top nav ul.buttons li#social-in-menu').css({
10024				'padding-top' : headerPadding
10025			});	
10026			
10027			if($('body.mobile').length == 0) {
10028				$('header#top nav > ul > li:not(#social-in-menu) > a').css({
10029					'padding-bottom' : Math.floor( ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding),
10030					'padding-top' : Math.floor( (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2))
10031				});	
10032				
10033				var $socialInMenuHeight = ($('header#top nav > .sf-menu > li:not(#social-in-menu) a').length > 0 && $('header#top nav > .sf-menu > li:not(#social-in-menu) a').height() > 22) ? $('header#top nav > .sf-menu > li:not(#social-in-menu) a').height() : $('header#top nav > ul > li#social-in-menu > a i').height();
10034				
10035				$('header#top nav > ul > li#social-in-menu > a').css({
10036					'margin-top' : Math.ceil(logoHeight/2) - Math.ceil($socialInMenuHeight/2)
10037				});	
10038			}
10039			
10040			if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
10041				$('#header-outer .cart-menu').css({  
10042					'padding-bottom' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding),
10043					'padding-top' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding)
10044				});	
10045			} 
10046			
10047			
10048			$('header#top nav > ul li#search-btn, header#top nav > ul li#nectar-user-account, header#top nav > ul li.slide-out-widget-area-toggle').css({
10049				'padding-bottom' : (logoHeight/2) - ($searchBtnHeight/2),
10050				'padding-top' : (logoHeight/2) - ($searchBtnHeight/2)
10051			});	
10052			
10053
10054			
10055			if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
10056				$('header#top nav > ul li#search-btn, header#top nav > ul li#nectar-user-account, header#top nav > ul li.slide-out-widget-area-toggle').css({
10057					'padding-top': 0,
10058					'padding-bottom': 0
10059				});
10060
10061				$('header#top nav > ul.buttons').css({
10062					'margin-top' : - headerPadding,
10063					'height' : Math.floor(logoHeight + headerPadding*2) -1
10064				});
10065
10066				$('header#top nav > ul li#search-btn a, header#top nav > ul li#nectar-user-account a, header#top nav > ul li.slide-out-widget-area-toggle a').css({
10067					'visibility' : 'visible',
10068					'padding-top': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding),
10069					'padding-bottom': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding)
10070				});
10071			}
10072			
10073			$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').css({
10074				'top' : $('header#top nav > ul.sf-menu > li > a').outerHeight() 
10075			});	
10076			
10077			
10078			setTimeout(function(){ 
10079				$('body:not(.ascend):not(.material) #search-outer #search-box .ui-autocomplete').css({
10080					'top': parseInt($('#header-outer').outerHeight())+'px'
10081				}); 
10082			},1000);
10083			
10084			$('body:not(.ascend):not(.material) #search-outer #search-box .ui-autocomplete').css({
10085				'top': parseInt($('#header-outer').outerHeight())+'px'
10086			});
10087
10088		}//not material skin
10089
10090		//header space
10091		if($('.nectar-parallax-scene.first-section').length == 0) {
10092
10093			if($('#header-outer').attr('data-using-secondary') == '1'){
10094				if($('#header-outer[data-mobile-fixed="false"]').length > 0  || $('body.mobile').length == 0 ) {
10095					$('#header-space').css('height', parseInt($('#header-outer').outerHeight()) + $('#header-secondary-outer').height());
10096					
10097				} else {
10098					$('#header-space').css('height', parseInt($('#header-outer').outerHeight()));
10099					
10100				}
10101				
10102			} else {
10103
10104				$('#header-space').css('height', $('#header-outer').outerHeight() );
10105			} 
10106		}
10107		
10108		$('#header-outer .container, #header-outer .cart-menu').css('visibility','visible');
10109		
10110		
10111		
10112		/* moved to priority
10113		//centeredLogoMargins();
10114		
10115		if(usingLogoImage && $('#header-outer[data-format="centered-logo-between-menu"]').length > 0 && $('header#top #logo img:first-child[src]').length > 0) {
10116			
10117			//fadein img on load
10118			var tempLogoImg = new Image();
10119			tempLogoImg.src = $('header#top #logo img:first-child').attr('src');
10120
10121		    tempLogoImg.onload = function() {
10122		       centeredLogoMargins();
10123		    };
10124			
10125		} */
10126
10127		if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
10128			$('body:not(.ascend):not(.material) #search-outer, #search .container').css({
10129				'height' : logoHeight + headerPadding*2
10130			});	
10131			
10132			$('body:not(.ascend):not(.material) #search-outer > #search input[type="text"]').css({
10133				'font-size'  : 43,
10134				'height' : '59px',
10135				'top' : ((logoHeight + headerPadding*2)/2) - $('#search-outer > #search input[type="text"]').height()/2
10136			});
10137			
10138			$('body:not(.ascend):not(.material) #search-outer > #search #close a').css({
10139				'top' : ((logoHeight + headerPadding*2)/2) - 8
10140			});	
10141		} else {
10142			$('body:not(.ascend):not(.material) #search-outer, #search .container').css({
10143				'height' : logoHeight + headerPadding*2 + logoHeight + 17
10144			});	
10145			
10146			$('body:not(.ascend):not(.material) #search-outer > #search input[type="text"]').css({
10147				'font-size'  : 43,
10148				'height' : '59px',
10149				'top' : ((logoHeight + headerPadding*2)/2) - ($('#search-outer > #search input[type="text"]').height()/2) + logoHeight/2 + 17
10150			});
10151			
10152			$('body:not(.ascend):not(.material) #search-outer > #search #close a').css({
10153				'top' : ((logoHeight + headerPadding*2)/2) - 8 + logoHeight/2 + 17
10154			});	
10155		}
10156		
10157		//if no image is being used
10158		//if(usingLogoImage == false) $('header#top #logo').addClass('no-image');
10159		
10160	}
10161
10162	
10163	//is header resize on scroll enabled?
10164	var headerResize = $('#header-outer').attr('data-header-resize');
10165	var headerHideUntilNeeded = $('body').attr('data-hhun');
10166
10167	//transparent fix
10168
10169	if($('#header-outer[data-remove-fixed="1"]').length == 0) {
10170		if($(window).scrollTop() != 0 && $('#header-outer.transparent[data-permanent-transparent="false"]').length == 1) $('#header-outer').removeClass('transparent');
10171	}
10172
10173	if( headerResize == 1 && headerHideUntilNeeded != '1'){
10174		
10175		headerInit();
10176
10177		$(window).off('scroll.headerResizeEffect');
10178
10179		if($('#nectar_fullscreen_rows').length == 0) {
10180			$(window).on('scroll.headerResizeEffect',smallNav);
10181		}
10182		else if($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/) ) {
10183			$(window).on('scroll.headerResizeEffect',smallNav);
10184		}
10185
10186	} else if(headerHideUntilNeeded != '1') {
10187		headerInit();
10188		$(window).off('scroll.headerResizeEffectOpaque');
10189		$(window).on('scroll.headerResizeEffectOpaque',opaqueCheck);
10190		
10191	} else if(headerHideUntilNeeded == '1') {
10192
10193		headerInit();
10194
10195		if($('.nectar-box-roll').length > 0) $('#header-outer').addClass('at-top-before-box');
10196
10197		var previousScroll = 0, // previous scroll position
10198        menuOffset = $('#header-space').height()*2, // height of menu (once scroll passed it, menu is hidden)
10199        detachPoint = ($('body.mobile').length > 0) ? 150 : 600, // point of detach (after scroll passed it, menu is fixed)
10200        hideShowOffset = 6; // scrolling value after which triggers hide/show menu
10201
10202	    // on scroll hide/show menu
10203	    function hhunCalcs(e) {
10204
10205	     //stop scrolling while animated anchors
10206	     if($('body.animated-scrolling').length > 0 && $('#header-outer.detached').length > 0) return false;
10207
10208	     //stop when material ocm or material search is open
10209	     if($('body.material-ocm-open').length > 0 || $('#search-outer.material-open').length > 0) { return false; }
10210
10211	     //stop on mobile if not using sticky option
10212	      if($('#header-outer[data-mobile-fixed="false"]').length > 0 && $('body.mobile').length > 0) {  $('#header-outer').removeClass('detached'); return false; }
10213
10214	      var currentScroll = $(this).scrollTop(), // gets current scroll position
10215	            scrollDifference = Math.abs(currentScroll - previousScroll); // calculates how fast user is scrolling
10216
10217	      if (!$('#header-outer').hasClass('side-widget-open') && !$('#header-outer .slide-out-widget-area-toggle a').hasClass('animating')) {
10218	       
10219	        // if scrolled past menu
10220	        if (currentScroll > menuOffset) {
10221	          // if scrolled past detach point add class to fix menu
10222	          if (currentScroll > detachPoint) {
10223	            if (!$('#header-outer').hasClass('detached'))
10224	              $('#header-outer').addClass('detached').removeClass('parallax-contained');
10225	          	   $('#header-outer').removeClass('no-transition');	
10226
10227
10228	          	  if($('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent');
10229	          }
10230
10231	          // if scrolling faster than hideShowOffset hide/show menu
10232	          if (scrollDifference >= hideShowOffset) {
10233	            if (currentScroll > previousScroll) {
10234	              // scrolling down; hide menu
10235	              if (!$('#header-outer').hasClass('invisible')) {
10236								
10237									if($('#header-outer.at-top').length > 0) {
10238									
10239										//prevent header from transitioning when first hiding
10240										$('#header-outer').addClass('no-trans-hidden');
10241										setTimeout(function(){
10242											$('#header-outer').addClass('invisible').removeClass('at-top');
10243											$('#header-outer').removeClass('no-trans-hidden');
10244										},30);
10245										
10246									} else {
10247										
10248										$('#header-outer').addClass('invisible').removeClass('at-top');
10249									}
10250								
10251	                
10252									
10253	                 //close submenus
10254	                 if( $(".sf-menu").length > 0 && $().superfish ) {
10255		          		 $(".sf-menu").superfish('hide');
10256		          		 $('header#top nav > ul.sf-menu > li.menu-item-over').removeClass('menu-item-over');
10257		          	 }
10258
10259	              }
10260	                $('.page-submenu.stuck').css('transform','translateY(0px)').addClass('header-not-visible');
10261
10262	            	
10263	            } else {
10264	              // scrolling up; show menu
10265	              if ($('#header-outer').hasClass('invisible'))
10266	                $('#header-outer').removeClass('invisible');
10267
10268	            	if($('.body-border-top').length > 0 && $('body.mobile').length == 0) {
10269
10270	            		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;
10271	            		var $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $('.body-border-top').height() : 0;
10272	          	    	$('.page-submenu.stuck').css('transform','translateY('+ ($('#header-outer').outerHeight()-$bodyBorderSizeToRemove) +'px)').removeClass('header-not-visible');
10273
10274	            	} else {
10275	            		$('.page-submenu.stuck').css('transform','translateY('+$('#header-outer').outerHeight()+'px)').removeClass('header-not-visible');
10276	            	}
10277	            }
10278	          }
10279	        } else {
10280	          // only remove "detached" class if user is at the top of document (menu jump fix)
10281	          $topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 : 0;
10282	          if($('.body-border-top').length > 0) {
10283	          		$topDetachNum = ($('#header-outer[data-using-secondary="1"]').length > 0) ? 32 + $('.body-border-top').height() : $('.body-border-top').height();
10284	          }
10285
10286	          if (currentScroll <= $topDetachNum){
10287	            $('#header-outer').removeClass('detached').removeClass('invisible').addClass('at-top');
10288	            
10289	            if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
10290		            if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.nectar-box-roll').length == 0 && $('.megamenu.sfHover').length == 0) { 
10291		            	$('#header-outer').addClass('transparent').css('transform','translateY(0)');
10292		            	$('#header-outer').removeClass('no-transition');	
10293		            }
10294		            else if($('.nectar-box-roll').length > 0) $('#header-outer').css('transform','translateY(0)').addClass('at-top-before-box');
10295		          
10296		        } else {
10297		        	 if($('#header-outer[data-transparent-header="true"]').length > 0 && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent').css('transform','translateY(0)');
10298		            else if($('.nectar-box-roll').length > 0) $('#header-outer').css('transform','translateY(0)').addClass('at-top-before-box');
10299		        }
10300
10301	            if( $('#page-header-bg[data-parallax="1"]').length > 0) $('#header-outer').addClass('parallax-contained').css('transform','translateY(0)');
10302	          }
10303	        }
10304
10305	        // if user is at the bottom of document show menu
10306	        if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
10307	          $('#header-outer').removeClass('invisible');
10308
10309	            if($('.body-border-top').length > 0 && $('body.mobile').length == 0) {
10310
10311            		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;
10312            		var $bodyBorderSizeToRemove = ($bodyBorderHeaderColorMatch) ? $('.body-border-top').height() : 0;
10313          	    	$('.page-submenu.stuck').css('transform','translateY('+ ($('#header-outer').outerHeight()-$bodyBorderSizeToRemove) +'px)').removeClass('header-not-visible');
10314	            }
10315	            else {
10316	            	$('.page-submenu.stuck').css('transform','translateY('+$('#header-outer').outerHeight()+'px)').removeClass('header-not-visible');
10317	            }
10318	          
10319	        }
10320
10321	      }
10322
10323	      // replace previous scroll position with new one
10324	      previousScroll = currentScroll;
10325
10326	    }
10327
10328	    //don't trigger for header remove stickiness
10329	    if($('#header-outer[data-remove-fixed="1"]').length == 0) {
10330		    hhunCalcs();
10331		    $(window).scroll(hhunCalcs);
10332		}
10333
10334
10335	}//end if hhun
10336	
10337	if($('#nectar_fullscreen_rows').length == 0 && $('.nectar-box-roll').length == 0) { midnightInit(); }	
10338	
10339	if($('#nectar_fullscreen_rows').length > 0 ) { ($('#header-outer').attr('data-permanent-transparent','false')) }
10340
10341	var shrinkNum = 6;
10342	var extraHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar
10343	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;
10344	var $scrollTriggerOffset = ( $('body.material').length > 0 ) ? 150 : 0;
10345
10346	if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
10347
10348	function smallNav(){
10349		var $offset = $(window).scrollTop();
10350		var $windowWidth = $(window).width();
10351		
10352
10353		if($offset > $scrollTriggerOffset && $windowWidth > 1000 && $('body.material-ocm-open').length == 0) {
10354		
10355
10356			//if going to small when material search is closing, it must be closed immediately
10357			if($('body.material').length > 0) {
10358				if($('#search-outer.material-open').length == 0) {
10359					$('#header-outer[data-transparent-header="true"] .bg-color-stripe').css('transition','none');
10360				}
10361
10362				//secondary header
10363				if($('#header-secondary-outer').length > 0) {
10364					$('#header-secondary-outer').addClass('hide-up').css('transform','translateY(-100%)');
10365					$('#header-outer').css('transform', 'translateY(-' +$('#header-secondary-outer').height()+ 'px)');
10366				}
10367
10368			}
10369
10370			if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
10371				if($('#header-outer').attr('data-transparent-header') == 'true' && $('#header-outer.side-widget-open').length == 0 && $('#header-outer[data-permanent-transparent="1"]').length == 0 && $('.megamenu.sfHover').length == 0) { 
10372					$('#header-outer').removeClass('transparent');
10373					$('#header-outer').removeClass('no-transition');	
10374				}
10375			} else {
10376				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');
10377			}
10378
10379			
10380			$('#header-outer, #search-outer').addClass('small-nav');
10381			
10382			//body border full width side padding
10383			if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true) {
10384				$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
10385					'padding' : '0'			
10386				},{queue:false, duration:250, easing: 'easeOutCubic'});	
10387			}
10388
10389			if($('body.material').length > 0) {
10390				$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
10391					'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(shrinkNum)*3) +'px'
10392				},{queue:false, duration:310, easing: 'easeOutQuad'});	
10393			}
10394			if($('body.material').length == 0) {
10395
10396				$('#header-outer #logo img').stop(true,true).animate({
10397					'height' : logoHeight - shrinkNum
10398				},{queue:false, duration:250, easing: 'easeOutCubic'});	
10399					
10400				$('body:not(.material) #header-outer, .ascend #header-outer[data-full-width="true"][data-using-pr-menu="true"] header#top nav ul.buttons li.menu-item, .ascend #header-outer[data-full-width="true"][data-format="centered-menu"] header#top nav ul.buttons li#social-in-menu').stop(true,true).animate({
10401					'padding-top' : Math.ceil(headerPadding / 1.8)
10402				},{queue:false, duration:250, easing: 'easeOutCubic'});	
10403				
10404				if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
10405					$('#header-outer .row > .span_3').stop(true,true).animate({
10406						'padding-bottom' : Math.ceil(headerPadding / 1.8)
10407					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10408				}
10409
10410				$('header#top nav > ul > li:not(#social-in-menu) > a').stop(true,true).animate({
10411					'padding-bottom' :  Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding / 1.8) ,
10412					'padding-top' :  Math.floor(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li > a').height()/2)) 
10413				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
10414
10415				
10416
10417				$('header#top nav > ul > li#social-in-menu > a').stop(true,true).animate({
10418					'margin-bottom' :  Math.floor((((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li#social-in-menu > a').height()/2)) + headerPadding / 1.8) ,
10419					'margin-top' :  Math.floor(((logoHeight-shrinkNum)/2) - ($('header#top nav > ul > li#social-in-menu > a').height()/2)) 
10420				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
10421				
10422				$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
10423					'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) - parseInt(shrinkNum)*3) +'px'
10424				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
10425
10426				if($bodyBorderHeaderColorMatch == true) {
10427					$('.body-border-top').stop(true,true).animate({
10428						'margin-top': '-'+$('.body-border-top').height()+'px'
10429					},{queue:false, duration:400, easing: 'easeOutCubic', complete: function() { $(this).css('margin-top',0)} });	 
10430				}
10431
10432				if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
10433					$('#header-outer .cart-menu').stop(true,true).animate({
10434						'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7),
10435						'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7) +1
10436					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10437				} 
10438				
10439				if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
10440					$('header#top nav > ul.buttons').stop(true,true).animate({
10441						'margin-top' : - Math.ceil(headerPadding/ 1.8),
10442						'height' : Math.floor((headerPadding*2)/ 1.8 + logoHeight-shrinkNum)
10443					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10444
10445					$('header#top nav > ul li#search-btn a, header#top nav > ul li#nectar-user-account a, header#top nav > ul li.slide-out-widget-area-toggle a').stop(true,true).animate({
10446						'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7),
10447						'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2) + headerPadding/ 1.7) +1
10448					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10449
10450				} else {
10451					$('header#top nav > ul li#search-btn, header#top nav > ul li#nectar-user-account, header#top nav > ul li.slide-out-widget-area-toggle').stop(true,true).animate({
10452						'padding-bottom' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2)),
10453						'padding-top' : Math.ceil(((logoHeight-shrinkNum)/2) - ($searchBtnHeight/2))
10454					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10455				}
10456
10457				if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
10458					$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
10459						'top' : Math.floor($('header#top nav > ul > li > a').outerHeight())
10460					},{queue:false, duration:250, easing: 'easeOutCubic'});		
10461				} else {
10462					$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
10463						'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),
10464					},{queue:false, duration:250, easing: 'easeOutCubic'});		
10465				}
10466				
10467				$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').stop(true,true).animate({
10468					'top': Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8) +'px'
10469				},{queue:false, duration:250, easing: 'easeOutCubic'});	
10470			
10471
10472				if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
10473					$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
10474						'height' : Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8)
10475					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10476
10477					$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
10478						'font-size'  : 30,
10479						'line-height' : '30px',
10480						'height' : '44px',
10481						'top' : ((logoHeight-shrinkNum+headerPadding+5)/2) - ($('#search-outer > #search input[type="text"]').height()-15)/2
10482					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10483				
10484					$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
10485						'top' : ((logoHeight-shrinkNum + headerPadding+5)/2) - 10
10486					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10487
10488				} else {
10489					$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
10490						'height' : Math.floor((logoHeight-shrinkNum) + (headerPadding*2)/ 1.8) + logoHeight - shrinkNum + 17
10491					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10492
10493					$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
10494						'font-size'  : 30,
10495						'line-height' : '30px',
10496						'height' : '44px',
10497						'top' : ((logoHeight-shrinkNum+headerPadding+5)/2) - ($('#search-outer > #search input[type="text"]').height()-15)/2 + (logoHeight- shrinkNum)/2 + 8
10498					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10499
10500					$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
10501						'top' : ((logoHeight-shrinkNum + headerPadding+5)/2) - 10 + (logoHeight- shrinkNum)/2 + 8
10502					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10503				}
10504
10505			}//not material skin
10506		
10507			
10508
10509			//box roll
10510			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'})
10511			
10512			
10513			if($('body').hasClass('ascend')){ 
10514				$('#search-outer').stop(true,true).animate({
10515					'top' : Math.floor((logoHeight-shrinkNum) +(headerPadding*2)/ 1.8 + extraHeight + secondaryHeader)
10516				},{queue:false, duration:250, easing: 'easeOutCubic'});	
10517			}
10518			
10519			//if no image is being used
10520			if(usingLogoImage == false) $('body:not(.material) header#top #logo').stop(true,true).animate({
10521				'margin-top' : 0
10522			},{queue:false, duration:450, easing: 'easeOutExpo'});	
10523			
10524			$(window).off('scroll',smallNav);
10525			$(window).on('scroll',bigNav);
10526
10527			//dark slider coloring border fix
10528			$('#header-outer[data-transparent-header="true"]').css('transition','transform 0.3s ease, background-color 0.30s ease, opacity 0.3s ease, box-shadow 0.30s ease, margin 0.25s ease-out');
10529			$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','none');
10530			setTimeout(function(){ 
10531				$('#header-outer[data-transparent-header="true"]').css('transition','transform 0.3s ease, background-color 0.30s ease, opacity 0.3s ease, box-shadow 0.30s ease, border-color 0.30s ease, margin 0.25s ease-out'); 
10532				$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','border-color 0.30s ease');
10533			},300);
10534
10535		}
10536
10537	}
10538	
10539	function bigNav(){
10540		var $offset = $(window).scrollTop();
10541		var $windowWidth = $(window).width();
10542
10543		if($('body.material-ocm-open').length > 0) { return false; }
10544
10545		if($offset <= $scrollTriggerOffset && $windowWidth > 1000 || $('.small-nav').length > 0 && $('#ajax-content-wrap.no-scroll').length > 0 ) {
10546			
10547
10548			$('#header-outer, #search-outer').removeClass('small-nav');
10549			
10550			if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
10551				if($('#header-outer').attr('data-transparent-header') == 'true'  && $('.nectar-box-roll').length == 0 && $('.megamenu.sfHover').length == 0) {
10552					$('#header-outer').addClass('transparent');
10553					$('#header-outer').removeClass('no-transition');	
10554				}
10555			} else {
10556				if($('#header-outer').attr('data-transparent-header') == 'true'  && $('.nectar-box-roll').length == 0) $('#header-outer').addClass('transparent');
10557			}
10558
10559			
10560
10561
10562			//body border full width side padding
10563			if($('#header-outer[data-full-width="true"][data-transparent-header="true"]').length > 0 && $('.body-border-top').length > 0 && $bodyBorderHeaderColorMatch == true) {
10564				$('#header-outer[data-full-width="true"] header > .container').stop(true,true).animate({
10565					'padding' : '0 28px'			
10566				},{queue:false, duration:250, easing: 'easeOutCubic'});	
10567			}
10568
10569
10570			if($('body.material').length > 0) {
10571
10572				$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
10573					'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(shrinkNum)*3) +'px'
10574				},{queue:false, duration:140, easing: 'easeOutQuad'});
10575
10576				//secondary header
10577				if($('#header-secondary-outer').length > 0) {
10578					$('#header-secondary-outer, #header-outer').removeClass('hide-up').css('transform','translateY(0%)');
10579				}
10580		
10581			}
10582
10583			if($('body.material').length == 0) {
10584
10585				$('#header-outer #logo img').stop(true,true).animate({
10586					'height' : logoHeight,				
10587				},{queue:false, duration:250, easing: 'easeOutCubic'});	
10588
10589				$('body:not(.material) #header-outer, .ascend #header-outer[data-full-width="true"][data-using-pr-menu="true"] header#top nav ul.buttons li.menu-item, .ascend #header-outer[data-full-width="true"][data-format="centered-menu"] header#top nav ul.buttons li#social-in-menu').stop(true,true).animate({
10590					'padding-top' : headerPadding 
10591				},{queue:false, duration:250, easing: 'easeOutCubic'});	
10592				
10593				if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
10594					$('#header-outer .row > .span_3').stop(true,true).animate({
10595						'padding-bottom' : headerPadding 
10596					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10597				}
10598
10599				$('header#top nav > ul > li:not(#social-in-menu) > a').stop(true,true).animate({
10600					'padding-bottom' : ((logoHeight/2) - ($('header#top nav > ul > li > a').height()/2)) + headerPadding,
10601					'padding-top' : (logoHeight/2) - ($('header#top nav > ul > li > a').height()/2) 
10602				},{queue:false, duration:250, easing: 'easeOutCubic'});	
10603				
10604				var $socialInMenuHeight = ($('header#top nav > .sf-menu > li:not(#social-in-menu) a').length > 0 && $('header#top nav > .sf-menu > li:not(#social-in-menu) a').height() > 22) ? $('header#top nav > .sf-menu > li:not(#social-in-menu) a').height() : $('header#top nav > ul > li#social-in-menu > a i').height();
10605				
10606				$('header#top nav > ul > li#social-in-menu > a').stop(true,true).animate({
10607					'margin-top' : Math.ceil(logoHeight/2) - Math.ceil($socialInMenuHeight/2)
10608				},{queue:false, duration:250, easing: 'easeOutCubic'});	
10609					
10610				$('header#top nav > ul > li.menu-item-with-margin').stop(true,true).animate({
10611					'margin-right': (parseInt($('header#top nav > ul > li.menu-item-with-margin').css('margin-right')) + parseInt(shrinkNum)*3) +'px'
10612				},{queue:false, duration:250, easing: 'easeOutCubic'});	 
10613
10614				if($bodyBorderHeaderColorMatch == true) {
10615					$('.body-border-top').css({ 'margin-top': '-'+$('.body-border-top').height()+'px'}).stop(true,true).animate({
10616						'margin-top': '0'
10617					},{queue:false, duration:250, easing: 'easeOutCubic'});	 
10618				}
10619
10620				if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
10621					$('#header-outer .cart-menu').stop(true,true).animate({
10622						'padding-bottom' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding),
10623						'padding-top' : Math.ceil(((logoHeight/2) - ($searchBtnHeight/2)) + headerPadding)
10624					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10625				}
10626
10627				if($('body.ascend ').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) {
10628					$('header#top nav > ul.buttons').stop(true,true).animate({
10629						'margin-top' : - Math.ceil(headerPadding),
10630						'height' : Math.floor(headerPadding*2 + logoHeight) -1
10631					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10632
10633					$('header#top nav > ul li#search-btn a, header#top nav > ul li#nectar-user-account a, header#top nav > ul li.slide-out-widget-area-toggle a').stop(true,true).animate({
10634						'padding-top': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding),
10635						'padding-bottom': Math.floor((logoHeight/2) - ($searchBtnHeight/2) + headerPadding)
10636					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10637				} else {
10638					$('header#top nav > ul li#search-btn, header#top nav > ul li#nectar-user-account, header#top nav > ul li.slide-out-widget-area-toggle').stop(true,true).animate({
10639						'padding-bottom' : Math.floor((logoHeight/2) - ($searchBtnHeight/2)),
10640						'padding-top' : Math.ceil((logoHeight/2) - ($searchBtnHeight/2))
10641					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10642				}
10643				
10644				if($('#header-outer[data-format="centered-menu-under-logo"]').length > 0) {
10645					$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
10646						'top' : Math.floor($('header#top nav > ul > li > a').outerHeight())
10647					},{queue:false, duration:250, easing: 'easeOutCubic'});		
10648				} else {
10649					$('header#top .sf-menu > li > ul, header#top .sf-menu > li.sfHover > ul').stop(true,true).animate({
10650						'top' : Math.ceil($('header#top nav > ul > li > a').height() + (((logoHeight)/2) - ($('header#top nav > ul > li > a').height()/2))*2 + headerPadding),
10651					},{queue:false, duration:250, easing: 'easeOutCubic'});		
10652				}
10653				
10654				$('body:not(.ascend) #search-outer #search-box .ui-autocomplete').stop(true,true).animate({
10655					'top': Math.ceil(logoHeight + headerPadding*2) +'px'
10656				},{queue:false, duration:250, easing: 'easeOutCubic'});	
10657				
10658				
10659				if($('#header-outer[data-format="centered-menu-under-logo"]').length == 0) {
10660					$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
10661						'height' : Math.ceil(logoHeight + headerPadding*2)
10662					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10663					
10664					$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
10665						'font-size'  : 43,
10666						'line-height' : '43px',
10667						'height' : '59px',
10668						'top' : ((logoHeight + headerPadding*2)/2) - 30
10669					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10670					
10671					
10672					$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
10673						'top' : ((logoHeight + headerPadding*2)/2) - 8
10674					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10675					
10676				} else {
10677					$('body:not(.ascend) #search-outer, #search .container').stop(true,true).animate({
10678						'height' : Math.ceil(logoHeight + headerPadding*2) + logoHeight + 17
10679					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10680					
10681					$('body:not(.ascend) #search-outer > #search input[type="text"]').stop(true,true).animate({
10682						'font-size'  : 43,
10683						'line-height' : '43px',
10684						'height' : '59px',
10685						'top' : ((logoHeight + headerPadding*2)/2) - 30 + (logoHeight)/2 + 8
10686					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10687					
10688					
10689					$('body:not(.ascend) #search-outer > #search #close a').stop(true,true).animate({
10690						'top' : ((logoHeight + headerPadding*2)/2) - 8 + (logoHeight)/2 + 8
10691					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10692				}
10693
10694
10695				if($('body').hasClass('ascend')){ 
10696					$('#search-outer').stop(true,true).animate({
10697						'top' : (logoHeight) +(headerPadding*2) + extraHeight + secondaryHeader
10698					},{queue:false, duration:250, easing: 'easeOutCubic'});	
10699				}
10700
10701				//if no image is being used
10702				if(usingLogoImage == false) $('header#top #logo').stop(true,true).animate({
10703					'margin-top' : 4
10704				},{queue:false, duration:450, easing: 'easeOutExpo'});	
10705				
10706
10707
10708			}//not material skin
10709
10710
10711				//box roll
10712			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'})
10713			
10714
10715			$(window).off('scroll',bigNav);
10716			$(window).on('scroll',smallNav);
10717
10718
10719			//dark slider coloring border fix
10720			$('#header-outer[data-transparent-header="true"]').css('transition','transform 0.3s ease, background-color 0.30s ease, opacity 0.3s ease, box-shadow 0.30s ease, margin 0.25s ease-out');
10721			$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','none');
10722			setTimeout(function(){ 
10723				$('#header-outer[data-transparent-header="true"]').css('transition','transform 0.3s ease, background-color 0.30s ease, opacity 0.3s ease, box-shadow 0.30s ease, border-color 0.30s ease, margin 0.25s ease-out'); 
10724				$('#header-outer[data-transparent-header="true"] .cart-menu').css('transition','border-color 0.30s ease');
10725			},300);
10726		}
10727
10728	}
10729	
10730	
10731	function headerSpace() {
10732		if($('.mobile').length > 0) {
10733			if(window.innerHeight < window.innerWidth && window.innerWidth > 1000) {
10734				if($('#header-outer.small-nav').length == 0)
10735					$('#header-space').css('height', $('#header-outer').outerHeight() + $('#header-secondary-outer').height());
10736			} else {
10737				$('#header-space').css('height', $('#header-outer').outerHeight());
10738			}
10739			
10740		} else {
10741			if($('.nectar-parallax-scene.first-section').length == 0) {
10742
10743				var shrinkNum = 6;	
10744				var headerPadding = parseInt($('#header-outer').attr('data-padding'));
10745				if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
10746				var headerPadding2 = headerPadding - headerPadding/1.8;
10747				var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length > 0 ) ? $('#header-outer').outerHeight() + (parseInt(shrinkNum) + headerPadding2*2) : $('#header-outer').outerHeight();
10748
10749				if($('#header-outer').attr('data-using-secondary') == '1'){
10750					$('#header-space').css('height', $headerHeight + $('#header-secondary-outer').height());
10751				} else {
10752					$('#header-space').css('height', $headerHeight);
10753				} 
10754			}
10755		}
10756		
10757	}
10758
10759	//call immediately on mobile to make sure there's no gap with fixed setups
10760	if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/) && $('#header-outer[data-mobile-fixed="1"]').length > 0 && $('#header-outer[data-permanent-transparent="false"]').length > 0) {
10761		$('#header-space').css('height', $('#header-outer').outerHeight());
10762	}
10763
10764
10765	var lastPosition = -1;
10766	var $headerScrollTop = nectarDOMInfo.scrollTop;
10767
10768	function headerOffsetAdjust(){
10769		
10770		$headerScrollTop = nectarDOMInfo.scrollTop;
10771
10772		 if (lastPosition == $headerScrollTop) {
10773            requestAnimationFrame(headerOffsetAdjust);
10774            return false;
10775        } else lastPosition = $headerScrollTop;
10776		
10777		headerOffsetAdjustCalc();
10778
10779		requestAnimationFrame(headerOffsetAdjust);
10780
10781	}
10782	var condenseHeaderLayout = $('#header-outer[data-condense="true"]').length > 0 ? true : false;
10783	var headerOuterCached = $('#header-outer');
10784	
10785	function headerOffsetAdjustCalc() {
10786		if($('body.mobile').length > 0 || condenseHeaderLayout == true && $('#header-outer .span_9').css('display') == 'none') {
10787			var $eleHeight = 0;
10788
10789			var $endOffset = ($('#wpadminbar').css('position') == 'fixed') ? $('#wpadminbar').height() : 0;
10790			$eleHeight += ($('#header-secondary-outer').length > 0 && $('#header-secondary-outer').css('display') == 'block') ? nectarDOMInfo.secondaryHeaderHeight : 0;
10791			$eleHeight += nectarDOMInfo.adminBarHeight;
10792			
10793			if( $eleHeight - $headerScrollTop > $endOffset) { 
10794				headerOuterCached.css('top', $eleHeight - $headerScrollTop + 'px');
10795			}
10796			else { headerOuterCached.css('top', $endOffset); }
10797
10798		} else {
10799				if(condenseHeaderLayout == false) {
10800					var $eleHeight = 0;
10801					
10802					$eleHeight += nectarDOMInfo.secondaryHeaderHeight;
10803					$eleHeight += nectarDOMInfo.adminBarHeight;
10804					headerOuterCached.css('top',$eleHeight+'px');
10805				}
10806		}
10807	}
10808
10809	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) {
10810		if($('#nectar_fullscreen_rows').length == 0) { requestAnimationFrame(headerOffsetAdjust); }
10811		else if($('#nectar_fullscreen_rows').length > 0 && $onMobileBrowser) {
10812			requestAnimationFrame(headerOffsetAdjust);
10813		}
10814		$(window).smartresize(headerOffsetAdjustCalc);
10815	}
10816		
10817
10818	function footerRevealCalcs() {
10819		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
10820
10821		if($(window).height() - $('#wpadminbar').height() - $headerNavSpace - $('#footer-outer').height() - 1 -$('#page-header-bg').height()  - $('.page-header-no-bg').height() > 0) {
10822			$resizeExtra = ($('body:not(.material) #header-outer[data-header-resize="1"]').length > 0) ? 55: 0;
10823			$('body[data-footer-reveal="1"] .container-wrap').css({'margin-bottom': $('#footer-outer').height()-1 });
10824			//let even non reveal footer have min height set when using material ocm
10825			$('.container-wrap').css({'min-height': $(window).height() - $('#wpadminbar').height() - $headerNavSpace - $('#footer-outer').height() -1  - $('.page-header-no-bg').height() -$('#page-header-bg').height() + $resizeExtra });
10826		} else {
10827			$('body[data-footer-reveal="1"] .container-wrap').css({'margin-bottom': $('#footer-outer').height()-1 });
10828		}
10829		
10830		if( $(window).width() < 1000) $('#footer-outer').attr('data-midnight','light');
10831		else $('#footer-outer').removeAttr('data-midnight');
10832	}
10833	if($('body[data-footer-reveal="1"]').length > 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { 
10834		setTimeout(function(){
10835			footerRevealCalcs();
10836		},60);
10837		footerRevealCalcs();
10838		//set shadow to match BG color if applicable
10839		if($('bodybody[data-footer-reveal="1"][data-footer-reveal-shadow="large_2"]').length > 0) $('.container-wrap').css({ boxShadow: '0 70px 110px -30px '+$('#footer-outer').css('backgroundColor') });
10840	}
10841	
10842	
10843	function opaqueCheck(){
10844		if($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0) { return; }
10845		
10846		var $offset = $(window).scrollTop();
10847		var $windowWidth = $(window).width();
10848
10849		if($offset > 0 && $windowWidth > 1000) {
10850			
10851			if($('body.material').length > 0) {
10852				$('#header-outer').addClass('scrolled-down');
10853
10854				//secondary header
10855				if($('#header-secondary-outer').length > 0) {
10856					$('#header-secondary-outer').addClass('hide-up').css('transform','translateY(-100%)');
10857					$('#header-outer').css('transform', 'translateY(-' +$('#header-secondary-outer').height()+ 'px)');
10858				}
10859			}
10860
10861			if($('#header-outer').attr('data-transparent-header') == 'true' && $('#header-outer[data-permanent-transparent="1"]').length == 0) $('#header-outer').removeClass('transparent').addClass('scrolled-down');
10862			
10863			$(window).off('scroll',opaqueCheck);
10864			$(window).on('scroll',transparentCheck);
10865		}
10866	}
10867	
10868	
10869	function transparentCheck(){
10870		
10871		if($('#header-outer[data-format="centered-menu-bottom-bar"][data-condense="true"]').length > 0) { return; }
10872		
10873		var $offset = $(window).scrollTop();
10874		var $windowWidth = $(window).width();
10875
10876		if($offset == 0 && $windowWidth > 1000 && $('body.material-ocm-open').length == 0) {
10877			
10878			if($('#header-outer[data-megamenu-rt="1"]').length > 0 && $('#header-outer[data-transparent-header="true"]').length > 0 && $('#header-outer .megamenu').length > 0) {
10879				
10880				if($('#header-outer').attr('data-transparent-header') == 'true' && $('.megamenu.sfHover').length == 0) { 
10881					$('#header-outer').addClass('transparent').removeClass('scrolled-down');
10882					$('#header-outer').removeClass('no-transition');	
10883				}
10884				else if($('#header-outer').attr('data-transparent-header') == 'true') { $('#header-outer').removeClass('scrolled-down'); }
10885				
10886			} else {
10887				if($('#header-outer').attr('data-transparent-header') == 'true') { $('#header-outer').addClass('transparent').removeClass('scrolled-down'); }
10888			}
10889
10890			if($('body.material').length > 0) {
10891				$('#header-outer').removeClass('scrolled-down');
10892
10893				//secondary header
10894				if($('#header-secondary-outer').length > 0) {
10895					$('#header-secondary-outer, #header-outer').removeClass('hide-up').css('transform','translateY(0%)');
10896				}
10897			}
10898
10899			
10900			$(window).off('scroll',transparentCheck);
10901			$(window).on('scroll',opaqueCheck);
10902		}
10903	}
10904	
10905
10906	
10907	
10908	//header inherit row color effect
10909	function headerRowColorInheritInit(){
10910		if($('body[data-header-inherit-rc="true"]').length > 0 && $('.mobile').length == 0){
10911			
10912			var headerOffset = ($('#header-outer[data-permanent-transparent="1"]').length == 0) ? (logoHeight - shrinkNum) + Math.ceil((headerPadding*2) / 1.8) + nectarDOMInfo.adminBarHeight : logoHeight/2 + headerPadding + nectarDOMInfo.adminBarHeight;
10913			
10914			$('.main-content > .row > .wpb_row').each(function(){
10915
10916
10917				var $that = $(this);
10918				var waypoint = new Waypoint({
10919	 				element: $that,
10920		 			handler: function(direction) {
10921	
10922
10923						if(direction == 'down') {
10924							
10925							if($that.find('.row-bg.using-bg-color').length > 0) {
10926								
10927								var $textColor = ($that.find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
10928								$('#header-outer').css('background-color',$that.find('.row-bg').css('background-color')).removeClass('light-text').removeClass('dark-text').addClass($textColor);
10929								$('#header-outer').attr('data-current-row-bg-color',$that.find('.row-bg').css('background-color'));
10930
10931								$('body.material #header-outer .bg-color-stripe').css('background-color',$that.find('.row-bg').css('background-color'));
10932							} else {
10933								$('#header-outer').css('background-color',$('#header-outer').attr('data-user-set-bg')).removeClass('light-text').removeClass('dark-text');
10934								$('#header-outer').attr('data-current-row-bg-color',$('#header-outer').attr('data-user-set-bg'));
10935
10936								$('body.material #header-outer .bg-color-stripe').css('background-color', '');
10937							}
10938						
10939						} else {
10940
10941							if($that.prev('div.wpb_row').find('.row-bg.using-bg-color').length > 0) {
10942								var $textColor = ($that.prev('div.wpb_row').find('> .col.span_12.light').length > 0) ? 'light-text' : 'dark-text';
10943								$('#header-outer').css('background-color',$that.prev('div.wpb_row').find('.row-bg').css('background-color')).removeClass('light-text').removeClass('dark-text').addClass($textColor);
10944								$('#header-outer').attr('data-current-row-bg-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color'));
10945
10946								$('body.material #header-outer .bg-color-stripe').css('background-color', $that.prev('div.wpb_row').find('.row-bg').css('background-color'));
10947							} else {
10948								$('#header-outer').css('background-color',$('#header-outer').attr('data-user-set-bg')).removeClass('light-text').removeClass('dark-text');
10949								$('#header-outer').attr('data-current-row-bg-color',$('#header-outer').attr('data-user-set-bg'));
10950
10951								$('body.material #header-outer .bg-color-stripe').css('background-color', '');
10952							}
10953
10954						} 
10955
10956				
10957					},
10958					offset: headerOffset
10959
10960				}); 
10961
10962
10963			});
10964		}
10965	}
10966
10967	//if($('.nectar-box-roll').length == 0) headerRowColorInheritInit();
10968
10969
10970
10971/****************sticky page submenu******************/
10972	if($('.page-submenu[data-sticky="true"]').length > 0 && $('#nectar_fullscreen_rows').length == 0) {
10973
10974		(function() {
10975		  'use strict'
10976
10977		  var $ = window.jQuery
10978		  var Waypoint = window.Waypoint
10979		  var $offsetHeight = 0; 
10980		  var shrinkNum = 6;	
10981		  var headerPadding = parseInt($('#header-outer').attr('data-padding'));
10982
10983		  if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
10984		  var headerPadding2 = headerPadding - headerPadding/1.8;
10985		  var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
10986		  var $headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('body.mobile').length == 0) ? $headerNavSpace - (parseInt(shrinkNum) + headerPadding2*2) : $headerNavSpace;
10987			
10988			if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
10989				
10990					var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
10991					var $secondaryHeader = $('#header-secondary-outer');
10992					
10993					$headerHeight = $('#header-outer').height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top')) ) -  parseInt(nectarDOMInfo.secondaryHeaderHeight);
10994			}
10995			
10996		  if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; $headerHeight = 0; }
10997
10998		  if($('#header-secondary-outer').length > 0 && $('body.mobile').length == 0 && $('body.material').length == 0) $headerHeight += $('#header-secondary-outer').height();
10999		  
11000
11001		  $(window).on('smartresize',function(){
11002
11003		    $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
11004		  	$headerHeight = ($('#header-outer[data-header-resize="1"]').length > 0 && $('.small-nav').length == 0 && $('body.mobile').length == 0) ? $headerNavSpace - (parseInt(shrinkNum) + headerPadding2*2) : $headerNavSpace;
11005		  	
11006				if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
11007					
11008						var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
11009						var $secondaryHeader = $('#header-secondary-outer');
11010						
11011						$headerHeight = $('#header-outer').height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top')) ) - parseInt(nectarDOMInfo.secondaryHeaderHeight);
11012				}
11013				
11014				if($('#header-secondary-outer').length > 0  && $('body.mobile').length == 0 && $('body.material').length == 0) $headerHeight += $('#header-secondary-outer').height();
11015
11016		  	$offsetHeight = 0; 
11017		
11018		  	  if($('#wpadminbar').length > 0 && $('#wpadminbar').css('position') == 'fixed') $offsetHeight += $('#wpadminbar').height();
11019 			  if($('body[data-hhun="0"] #header-outer').length > 0 && !($('body.mobile').length > 0 && $('#header-outer[data-mobile-fixed="false"]').length > 0) ) {
11020 			  	  $offsetHeight += $headerHeight;
11021 			  }
11022
11023 			  if($('.body-border-top').length > 0 && $(window).width() > 1000 && $('body[data-hhun="1"]').length > 0) $offsetHeight += $('.body-border-top').height();
11024 	
11025 			 // else if($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0) $offsetHeight += $headerHeight;
11026 			
11027 			 //recalc for resizing (same as stuck/unstuck logic below)
11028 			 if($('.page-submenu.stuck').length > 0) {
11029
11030		        	$('.page-submenu.stuck').addClass('no-trans').css('top',$offsetHeight).css('transform','translateY(0)').addClass('stuck');
11031		        	var $that = this;
11032		        	setTimeout(function(){ $('.page-submenu.stuck').removeClass('no-trans'); },50);
11033		        	$('.page-submenu.stuck').parents('.wpb_row').css('z-index',10000);
11034
11035		        	//boxed
11036		        	if($('#boxed').length > 0) { 
11037		        		var $negMargin = ($(window).width() > 1000) ? $('.container-wrap').width()*0.04 :39;
11038		        		$('.page-submenu.stuck').css({'margin-left':'-'+$negMargin+'px', 'width' : $('.container-wrap').width()});
11039		        	}
11040
11041		        }
11042		        else { 
11043		        	$('.page-submenu.stuck').css('top','0').removeClass('stuck');
11044		       	   $('.page-submenu.stuck').parents('.wpb_row').css('z-index','auto');
11045
11046		       	    if($('#boxed').length > 0) $('.page-submenu.stuck').css({'margin-left':'0px', 'width' : '100%'});
11047		       	}
11048
11049		  });
11050
11051		  /* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */
11052		  function Sticky(options) {
11053		    this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options)
11054		    this.element = this.options.element
11055		    this.$element = $(this.element)
11056		    this.createWrapper()
11057		    this.createWaypoint()
11058		  }
11059
11060		  /* Private */
11061		  Sticky.prototype.createWaypoint = function() {
11062		    var originalHandler = this.options.handler
11063
11064		    $offsetHeight = 0; 
11065		    if($('#wpadminbar').length > 0 && $('#wpadminbar').css('position') == 'fixed') $offsetHeight += $('#wpadminbar').height();
11066 			if($('body[data-hhun="0"] #header-outer').length > 0 && !($('body.mobile').length > 0 && $('#header-outer[data-mobile-fixed="false"]').length > 0) ) { 
11067 				$offsetHeight += $headerHeight;
11068 			}
11069 			 if($('.body-border-top').length > 0 && $(window).width() > 1000 && $('body[data-hhun="1"]').length > 0) $offsetHeight += $('.body-border-top').height();
11070 		
11071		    this.waypoint = new Waypoint($.extend({}, this.options, {
11072		      element: this.wrapper,
11073		      handler: $.proxy(function(direction) {
11074		        var shouldBeStuck = this.options.direction.indexOf(direction) > -1
11075		        var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''
11076
11077		        this.$wrapper.height(wrapperHeight)
11078		        if(shouldBeStuck) {
11079		        	this.$element.addClass('no-trans').css('top',$offsetHeight).css('transform','translateY(0)').addClass('stuck');
11080		        	var $that = this;
11081		        	setTimeout(function(){ $that.$element.removeClass('no-trans'); },50);
11082		        	this.$element.parents('.wpb_row').css('z-index',10000);
11083
11084		        	//boxed
11085		        	if($('#boxed').length > 0) { 
11086		        		var $negMargin = ($(window).width() > 1000) ? $('.container-wrap').width()*0.04 :39;
11087		        		this.$element.css({'margin-left':'-'+$negMargin+'px', 'width' : $('.container-wrap').width()});
11088		        	}
11089
11090		        }
11091		        else { 
11092		        	this.$element.css('top','0').removeClass('stuck');
11093		       	    //this.$element.parents('.wpb_row').css('z-index','10000');
11094
11095		       	    if($('#boxed').length > 0) this.$element.css({'margin-left':'0px', 'width' : '100%'});
11096		       	}
11097
11098		        if (originalHandler) {
11099		          originalHandler.call(this, direction)
11100		        }
11101		      }, this),
11102		      offset: $offsetHeight
11103		    }))
11104
11105		    var $that = this;
11106
11107		   // if($('body[data-hhun="1"]').length > 0 ) {
11108			    setInterval(function(){ 
11109
11110			    	if($('body[data-hhun="1"] #header-outer.detached:not(.invisible)').length > 0)
11111		        		$that.waypoint.options.offset = $offsetHeight + $headerHeight;
11112		        	else 
11113		        		$that.waypoint.options.offset = $offsetHeight;
11114			    	Waypoint.refreshAll();
11115			
11116			    },100); 
11117			//}
11118
11119		  }
11120
11121		  /* Private */
11122		  Sticky.prototype.createWrapper = function() {
11123		    if (this.options.wrapper) {
11124		      this.$element.wrap(this.options.wrapper)
11125		    }
11126		    this.$wrapper = this.$element.parent()
11127		    this.wrapper = this.$wrapper[0]
11128		  }
11129
11130		  /* Public */
11131		  Sticky.prototype.destroy = function() {
11132		    if (this.$element.parent()[0] === this.wrapper) {
11133		      this.waypoint.destroy()
11134		      this.$element.removeClass(this.options.stuckClass)
11135		      if (this.options.wrapper) {
11136		        this.$element.unwrap()
11137		      }
11138		    }
11139		  }
11140
11141		  Sticky.defaults = {
11142		    wrapper: '<div class="sticky-wrapper" />',
11143		    stuckClass: 'stuck',
11144		    direction: 'down right'
11145		  }
11146
11147		  Waypoint.Sticky = Sticky
11148		}())
11149		;
11150
11151		//remove outside of column setups 
11152		if($('.page-submenu').parents('.span_12').find('> .wpb_column').length > 1){
11153			var pageMenu = $('.page-submenu').clone();
11154			var pageMenuParentRow = $('.page-submenu').parents('.wpb_row');
11155			$('.page-submenu').remove();
11156			pageMenuParentRow.before(pageMenu);
11157		}
11158
11159		var sticky = new Waypoint.Sticky({
11160		  element: $('.page-submenu[data-sticky="true"]')[0]
11161		});
11162
11163
11164	}
11165
11166	if($('#nectar_fullscreen_rows').length == 0)
11167		$('.page-submenu').parents('.wpb_row').css('z-index',10000);
11168
11169	$('.page-submenu .mobile-menu-link').on('click',function(){
11170		$(this).parents('.page-submenu').find('ul').stop(true).slideToggle(350);
11171		return false;
11172	});
11173
11174	$('.page-submenu ul li a').on('click',function(){
11175		if($('body.mobile').length > 0) $(this).parents('.page-submenu').find('ul').stop(true).slideToggle(350);
11176	});
11177
11178
11179	//responsive nav
11180	$('body').on('click','#toggle-nav',function(){
11181		if(window.innerWidth > 1000) {
11182			window.scrollTo(0,0);	
11183		}
11184
11185		$(this).find('.lines-button').toggleClass('close');
11186		
11187		
11188		if( $('body').hasClass('classic_mobile_menu_open') ) {
11189			
11190			$('#mobile-menu').hide();
11191			$('body').removeClass('classic_mobile_menu_open');
11192			
11193		} else {
11194			
11195			if($('#header-outer[data-transparent-header="true"][data-permanent-transparent="1"][data-mobile-fixed="false"].transparent').length > 0) {
11196				$('#mobile-menu').css({
11197					'top': parseInt($('#header-outer').outerHeight() + nectarDOMInfo.adminBarHeight) + 'px' ,
11198					'position': 'absolute',
11199					'width': '100%',
11200					'left': '0' 
11201				});
11202			}
11203			
11204			$('#mobile-menu').show();
11205			$('body').addClass('classic_mobile_menu_open');
11206			
11207		}
11208		
11209		
11210		
11211		
11212		return false;
11213	});
11214	
11215	
11216	//add wpml to mobile menu
11217	if($('header#top nav > ul > li.menu-item-language').length > 0 && $('#header-secondary-outer ul > li.menu-item-language').length == 0){
11218		var $langSelector = $('header#top nav > ul > li.menu-item-language').clone();
11219		$langSelector.insertBefore('#mobile-menu ul #mobile-search');
11220	}
11221	
11222	////append dropdown indicators / give classes
11223	$('#mobile-menu .container ul li').each(function(){
11224		if($(this).find('> ul').length > 0) {
11225			 $(this).addClass('has-ul');
11226			 $(this).find('> a').append('<span class="sf-sub-indicator"><i class="icon-angle-down"></i></span>');
11227		}
11228	});
11229	
11230	////events
11231	$('#mobile-menu .container ul li:has(">ul") > a .sf-sub-indicator').click(function(){
11232		$(this).parent().parent().toggleClass('open');
11233		$(this).parent().parent().find('> ul').stop(true,true).slideToggle();
11234		return false;
11235	});
11236	
11237
11238
11239/*-------------------------------------------------------------------------*/
11240/*	5.	Page Specific
11241/*-------------------------------------------------------------------------*/	
11242	
11243	function vcFullHeightRow() {
11244        var $element = $(".vc_row-o-full-height:first");
11245        if ($element.length) {
11246            var $window, windowHeight, offsetTop, fullHeight;
11247            $window = $(window), 
11248            windowHeight = $window.height();
11249
11250            $(".vc_row-o-full-height").each(function(){
11251            	offsetTop = $(this).offset().top;
11252
11253            	var $realRowIndex = ($(this).parent().hasClass('vc_ie-flexbox-fixer')) ? $(this).parent().index() : $(this).index();
11254
11255            	if(offsetTop < windowHeight && $(this).hasClass('top-level')) {
11256            		fullHeight = 100 - offsetTop / (windowHeight / 100);
11257          	    	$(this).css("min-height", fullHeight + "vh");
11258          	    	$(this).find('> .col.span_12').css("min-height", fullHeight + "vh");
11259            	} else {
11260            		$(this).css("min-height", windowHeight);
11261            		$(this).find('> .col.span_12').css("min-height", windowHeight);
11262            	}
11263          	   
11264            });
11265
11266            
11267        }
11268
11269    }
11270    function fixIeFlexbox() {
11271        var ua = window.navigator.userAgent,
11272            msie = ua.indexOf("MSIE ");
11273        (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) && $(".vc_row-o-full-height").each(function() {
11274            "flex" === $(this).find('> .span_12').css("display") && $(this).wrap('<div class="vc_ie-flexbox-fixer"></div>')
11275        })
11276    }
11277    fixIeFlexbox();
11278
11279    vcFullHeightRow();
11280
11281	//recent work
11282	function piVertCenter() {
11283		$('.portfolio-items  > .col').each(function(){
11284				
11285			//style 4
11286			$(this).find('.style-4 .work-info .bottom-meta:not(.shown)').stop().animate({
11287				'bottom' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()-2+'px'
11288			},420,'easeOutCubic');
11289
11290			
11291		});	 
11292	}
11293	
11294	
11295	//ie8 width fix
11296	function ie8Width(){
11297		if( $(window).width() >= 1300 ) {
11298			$('.container').css('max-width','1100px');
11299		} else {
11300			$('.container').css('max-width','880px');
11301		}
11302	}
11303	
11304	if( $(window).width() >= 1300 && $('html').hasClass('no-video')) { $('.container').css('max-width','1100px'); $(window).resize(ie8Width); };
11305	
11306
11307
11308	function smartResizeInit() {
11309
11310		 //carousel height calcs
11311		 carouselHeightCalcs();
11312		 clientsCarouselHeightRecalc();
11313
11314		 //portfolio comment order
11315		 portfolioCommentOrder();
11316		 
11317		 //testimonial slider height
11318		 testimonialHeightResize(); //animated
11319		 testimonialSliderHeight(); //non-animated
11320		 
11321		 //full width content columns sizing
11322		 fullWidthContentColumns();
11323		 
11324		 //parallax BG Calculations
11325		 parallaxRowsBGCals();
11326		 
11327		
11328		 vcFullHeightRow();
11329		 headerSpace();
11330
11331		 centeredLogoMargins();
11332
11333		 slideOutWidgetOverflowState();
11334		 recentPostHeight();
11335
11336		 morphingOutlines();
11337
11338		 flipBoxHeights();
11339
11340		 showOnLeftSubMenu();
11341
11342		 //minimal alt effect
11343		if($('.tabbed[data-style="minimal_alt"]').length > 0) {
11344			 magicLineCalc($('.tabbed[data-style="minimal_alt"] > ul > li > a.active-tab'));
11345		}
11346		
11347
11348		 //full width menu megamenu adjust
11349		//if($('.slide-out-widget-area-toggle a.open').length > 0 && $('#header-outer[data-full-width="true"]').length > 0) fullWidthHeaderSlidingWidgetMenuCalc();
11350		  
11351	}
11352
11353  $(window).off('smartresize.srInit'); 
11354	$(window).on('smartresize.srInit', smartResizeInit); 
11355	
11356	
11357	$usingNectarCarouselFlk = ($('.nectar-carousel.nectar-flickity:not(.masonry)').length > 0) ? true : false;
11358	
11359	function resizeInit() {
11360		 portfolioDeviceCheck();
11361
11362		 //fullwidth page section calcs
11363		 fullWidthSections(); 
11364		 fullwidthImgOnlySizing();
11365		 fullWidthContentColumns();
11366		 if(nectarDOMInfo.usingMobileBrowser) {
11367		  fullWidthRowPaddingAdjustCalc();
11368		}
11369		 
11370		 //iframe video emebeds
11371		 responsiveVideoIframes();
11372		 videoshortcodeSize();
11373		 
11374		 //parallax BG Calculations
11375		 if(!nectarDOMInfo.usingMobileBrowser){
11376		   parallaxRowsBGCals();
11377		 }
11378		 
11379		 testimonialSliderHeightMinimalMult();
11380		 if($usingNectarCarouselFlk) {
11381			 setNectarCarouselFlkEH();
11382		 }
11383		 
11384		 if($('.nectar-social.full-width').length > 0) {
11385		 	nectarLoveFWCenter();
11386		 }
11387
11388		 if($('body').hasClass('ascend') ){ 
11389			searchFieldCenter();
11390		 }
11391
11392		 if($('body').hasClass('single-post')) { centerPostNextButtonImg(); }
11393
11394		 cascadingImageBGSizing();
11395
11396		 responsiveTooltips();
11397
11398		 //vc mobile columns
11399		 if($('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) { vcMobileColumns(); }
11400
11401		 if($('body[data-footer-reveal="1"]').length > 0 || $('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) { footerRevealCalcs(); }
11402
11403		 if($('#page-header-bg').length > 0) { pageHeader(); }
11404
11405		 if($('.nectar-video-bg').length > 0) {
11406		 	resizeVideoToCover();
11407		 }
11408	}
11409
11410	$(window).off('resize.srInit'); 
11411	$(window).on('resize.srInit', resizeInit); 
11412	
11413	
11414	$(window).load(function(){
11415		
11416		if($(window).scrollTop() == 0 ) { headerSpace(); }
11417		setTimeout(portfolioSidebarFollow,200);
11418		
11419		$('video').css('visibility','visible');
11420		videoshortcodeSize();
11421		
11422		if($('body[data-animated-anchors="true"]').length > 0) { 
11423				if($('.nectar-box-roll').length == 0 && $('#nectar_fullscreen_rows').length == 0) { pageLoadHash(); }
11424				
11425				if($('#nectar_fullscreen_rows[data-mobile-disable="on"]').length > 0 && $('.nectar-box-roll').length == 0 && nectarDOMInfo.usingMobileBrowser) {
11426					pageLoadHash();
11427				}
11428		}
11429		
11430		parallaxRowsBGCals();
11431		portfolioCommentOrder();
11432		fullWidthContentColumns();
11433		resizeVideoToCover();
11434
11435	});
11436
11437
11438	$(window).on("orientationchange",function(){
11439	  setTimeout(clientsCarouselHeightRecalc,200);
11440	});
11441	
11442	//blog next post button
11443	function postNextButtonEffect(){
11444
11445		$('.blog_next_prev_buttons').imagesLoaded(function(){
11446
11447			centerPostNextButtonImg();
11448			
11449			$('.blog_next_prev_buttons img').css('opacity','1');
11450
11451		});
11452	}
11453
11454	function centerPostNextButtonImg(){
11455		
11456		if($('.blog_next_prev_buttons').length == 0) return false;
11457
11458		if( $('.blog_next_prev_buttons img').height() >= $('.blog_next_prev_buttons').height() + 50 ) {
11459			var $height = 'auto';
11460			var $width = $('.blog_next_prev_buttons').width();
11461		} else {
11462
11463			if( $('.blog_next_prev_buttons').width() < $('.blog_next_prev_buttons img').width()) {
11464				var $height = $('.blog_next_prev_buttons').height() + 49;
11465				var $width = 'auto';
11466			} else {
11467				var $height = 'auto';
11468				var $width = '100%';
11469			}
11470			
11471		}
11472
11473		$('.blog_next_prev_buttons img').css({ 'height' : $height, 'width': $width });
11474
11475		$('.blog_next_prev_buttons img').css({
11476			'top' : ($('.blog_next_prev_buttons').height()/2) - ($('.blog_next_prev_buttons img').height()/2) + 'px',
11477			'left' : ($('.blog_next_prev_buttons').width()/2) - ($('.blog_next_prev_buttons img').width()/2) + 'px'
11478		});
11479
11480		$('.blog_next_prev_buttons .inner').each(function(){
11481			$(this).css({'top': $(this).parent().height()/2 - ($(this).height()/2), 'opacity':'1' });
11482		})
11483	}
11484	
11485	postNextButtonEffect();
11486
11487
11488	function recentPostHeight() {
11489		$('.blog-recent[data-style="title_only"]').each(function(){
11490			if($(this).find('> .col').length > 1) return false;
11491			if($(this).parent().parent().parent().hasClass('vc_col-sm-3') || 
11492				$(this).parent().parent().parent().hasClass('vc_col-sm-4') || 
11493				$(this).parent().parent().parent().hasClass('vc_col-sm-6') || 
11494				$(this).parent().parent().parent().hasClass('vc_col-sm-8') || 
11495				$(this).parent().parent().parent().hasClass('vc_col-sm-9')) {
11496				
11497				if($('body.mobile').length == 0 && $(this).next('div').length == 0) {
11498					var tallestColumn = 0;
11499					
11500					$(this).find('> .col').css('padding', '50px 20px');
11501
11502					$(this).parents('.span_12').find(' > .wpb_column').each(function(){
11503						(Math.floor($(this).height()) > tallestColumn) ? tallestColumn = Math.floor($(this).height()) : tallestColumn = tallestColumn;
11504					});	
11505			
11506					if(Math.floor($(this).find('> .col').outerHeight(true)) < Math.floor($(this).parents('.wpb_row').height()) - 1) {
11507						$(this).find('> .col').css('padding-top',(tallestColumn-$(this).find('> .col').height())/2 + 'px');
11508						$(this).find('> .col').css('padding-bottom',(tallestColumn-$(this).find('> .col').height())/2 + 'px');
11509					}
11510					
11511				}
11512				 else {
11513				 		$(this).find('> .col').css('padding', '50px 20px');
11514				}
11515			}
11516		});
11517	}
11518	recentPostHeight();
11519
11520
11521	//recent post slider
11522	function recentPostsFlickityInit() {
11523
11524		//classic enhanced specific 
11525    $('.blog-recent[data-style="classic_enhanced_alt"] .inner-wrap').each(function(){
11526        	$(this).find('.post-featured-img').each(function(){
11527				var $src = $(this).find('img').attr('src');
11528				$(this).css('background-image','url('+$src+')');
11529			});
11530        });
11531		$('.blog-recent[data-style="classic_enhanced"]').each(function(){
11532			if($(this).find('.inner-wrap.has-post-thumbnail').length == 0) {
11533				$(this).addClass('no-thumbs');
11534			}
11535		});
11536
11537		if($('.nectar-recent-posts-slider-inner').length > 0) {
11538		
11539			var $rpFGroupCells = ($('.nectar-recent-posts-slider_multiple_visible').length > 0) ? '90%' : false;
11540			
11541			var $rpF = $('.nectar-recent-posts-slider-inner').flickity({
11542				  contain: true,
11543					groupCells: $rpFGroupCells,
11544				  draggable: true,
11545				  lazyLoad: false,
11546				  imagesLoaded: true,
11547				  percentPosition: true,
11548				  prevNextButtons: false,
11549				  pageDots: true,
11550				  resize: true,
11551				  setGallerySize: true,
11552				  wrapAround: true,
11553				  accessibility: false
11554			});
11555			
11556			setTimeout(function(){
11557				$('.nectar-recent-posts-slider-inner').addClass('loaded');
11558			},1150);
11559			var flkty = $rpF.data('flickity');
11560			
11561			$rpF.on( 'dragStart.flickity', function() {
11562				$('.flickity-viewport').addClass('is-moving');
11563			});
11564			
11565			$rpF.on( 'dragEnd.flickity', function() {
11566				$('.flickity-viewport').removeClass('is-moving');
11567			});
11568			
11569			var $dragTimeout;
11570			
11571			$rpF.on( 'select.flickity', function() {
11572				//don't trigger no hover if user is still on same item
11573				//if() {
11574				  $('.flickity-viewport').addClass('no-hover');
11575				  clearTimeout( $dragTimeout);
11576				   $dragTimeout = setTimeout(function(){ $('.flickity-viewport').removeClass('no-hover'); },400);
11577			 //}
11578			});
11579			
11580			
11581	  
11582			recentPostSliderHeight();
11583			$(window).resize(recentPostSliderHeight);
11584
11585			if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
11586				$(window).resize(recentPostSliderParallaxMargins);
11587
11588			function recentPostSliderHeight(){
11589
11590				$('.nectar-recent-posts-slider').each(function(){
11591						
11592							var $heightCalc;
11593							var $minHeight = 250;
11594							var $windowWidth = $(window).width();
11595							var $definedHeight = parseInt($(this).attr('data-height'));
11596
11597							var dif = ($('body[data-ext-responsive="true"]').length > 0) ? $(window).width() / 1400 : $(window).width() / 1100;
11598
11599							if( window.innerWidth > 1000 && $('#boxed').length == 0) {
11600
11601								if($(this).parents('.full-width-content').length == 0) {
11602									if($('body[data-ext-responsive="true"]').length > 0 && window.innerWidth >= 1400){
11603										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight));
11604									} else if($('body[data-ext-responsive="true"]').length == 0 && window.innerWidth >= 1100) {
11605										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight));
11606									} else {
11607										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
11608									}
11609									
11610								} else {
11611									$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.ceil($definedHeight*dif));
11612								}
11613								
11614							} else {
11615								
11616								//column sliders
11617								var $parentCol = ($(this).parents('.wpb_column').length > 0) ? $(this).parents('.wpb_column') : $(this).parents('.col') ;
11618								if($parentCol.length == 0) $parentCol = $('.main-content');
11619									
11620								if(!$parentCol.hasClass('vc_span12') && !$parentCol.hasClass('main-content') && !$parentCol.hasClass('span_12') && !$parentCol.hasClass('vc_col-sm-12') ) {
11621								
11622									var $parentColWidth = sliderColumnDesktopWidth($parentCol);
11623									var $aspectRatio = $definedHeight/$parentColWidth;
11624
11625									
11626									//min height
11627									if( $aspectRatio*$parentCol.width() <= $minHeight ){
11628										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$minHeight);
11629									} else {
11630										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$aspectRatio*$parentCol.width());
11631									}
11632								  
11633								} 
11634								
11635								
11636
11637								//regular
11638								else {
11639									
11640									//min height
11641									if( $definedHeight*dif <= $minHeight ){
11642										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',$minHeight);
11643									} else {
11644										$(this).find('.nectar-recent-post-slide, .flickity-viewport').css('height',Math.
11644ceil($definedHeight*dif));
11645									}
11646									
11647								}
11648								
11649							}
11650							
11651		
11652						
11653					});
11654			
11655			}
11656
11657			////helper function
11658			function sliderColumnDesktopWidth(parentCol) {
11659				
11660				var $parentColWidth = 1100;
11661				var $columnNumberParsed = $(parentCol).attr('class').match(/\d+/);
11662				
11663				if($columnNumberParsed == '2') { $parentColWidth = 170 }
11664				else if($columnNumberParsed == '3') { $parentColWidth = 260 } 
11665				else if($columnNumberParsed == '4') { $parentColWidth = 340 } 
11666				else if($columnNumberParsed == '6') { $parentColWidth = 530 } 
11667				else if($columnNumberParsed == '8') { $parentColWidth = 700 } 
11668				else if($columnNumberParsed == '9') { $parentColWidth = 805 }
11669				else if($columnNumberParsed == '10') { $parentColWidth = 916.3 }
11670				else if($columnNumberParsed == '12') { $parentColWidth = 1100 }
11671			
11672				return $parentColWidth;
11673			}
11674		
11675		}//if using rp slider
11676		
11677		
11678		//multiple featured controls
11679		
11680		function multipleLargeFeaturedInit() {
11681			 $('.nectar-recent-posts-single_featured.multiple_featured').each(function(){
11682				 	$(this).append('<div class="normal-container container"> <ul class="controls" data-color="' + $(this).attr('data-button-color') + '" data-num="'+ $(this).find('.nectar-recent-post-slide').length +'"></ul> </div>');
11683					var $that = $(this);
11684					
11685					var tallestFeaturedSlide = 0;
11686					$(this).find('.nectar-recent-post-slide').each(function(i){
11687						
11688						if($(this).find('.recent-post-container').height() > tallestFeaturedSlide) {
11689							$(this).siblings().removeClass('tallest');
11690							$(this).addClass('tallest');
11691							tallestFeaturedSlide = $(this).find('.recent-post-container').height();
11692						} 
11693						
11694						var $activeClass = (i == 0 && $(this).parents('.nectar-recent-posts-single_featured.multiple_featured[data-autorotate="none"]').length > 0) ? 'class="active"': '';
11695						 $that.find('.controls').append('<li '+$activeClass+'><span class="title">'+ $(this).find('h2').text() +'</span></li>');
11696					});
11697					
11698					$(this).addClass('js-loaded');
11699					
11700					var $slideClickTimeout;
11701					
11702					//click Functionality
11703					$(this).find('.controls li').click(function(e){
11704						
11705							if($(this).hasClass('active')) 
11706								return;
11707								
11708							if(e.originalEvent !== undefined)
11709								$(this).parent().find('.active').addClass('trans-out');
11710							
11711							var $index = $(this).index();
11712							var $oldIndex = $(this).parent().find('.active').index();
11713							var $that = $(this);
11714							
11715							clearTimeout($slideClickTimeout);
11716							
11717							$(this).siblings().removeClass('active');
11718							$(this).addClass('active');
11719							$slideClickTimeout = setTimeout( function() { 
11720								$that.parents('.multiple_featured').find('.nectar-recent-post-slide:not(:eq('+$index+'))').css('opacity','0').removeClass('active');
11721								$that.parent().find('.trans-out').removeClass('trans-out');
11722							}, 300);
11723							$that.parents('.multiple_featured').find('.nectar-recent-post-slide:not(:eq('+$index+'))').css('z-index','10');
11724							$that.parents('.multiple_featured').find('.nectar-recent-post-slide:eq('+$oldIndex+')').css('z-index','15');
11725							
11726							$(this).parents('.multiple_featured').find('.nectar-recent-post-slide').eq($index).css({'opacity':'1', 'z-index':'20'}).addClass('active');
11727							
11728							if($(this).parents('.multiple_featured').attr('data-autorotate') != 'none') {
11729								nectarCustomSliderResetRotate($that.parents('.nectar-recent-posts-single_featured.multiple_featured'));
11730							}
11731					});
11732					
11733					
11734				//autorotate
11735				var $that = $(this);
11736				 if($(this).attr('data-autorotate').length > 0 && $(this).attr('data-autorotate') != 'none') {
11737					 
11738					 setTimeout(function(){
11739							 slide_interval = (parseInt($that.attr('data-autorotate')) < 100) ? 4000 : parseInt($that.attr('data-autorotate'));
11740							 $nectarCustomSliderRotate = setInterval(function(){ nectarCustomSliderRotate($that) },slide_interval);
11741							 
11742							 //set first active class
11743							 $that.find('.controls > li:first-child').addClass('active');
11744
11745					 },30);
11746					 
11747				 }
11748				 
11749			 });
11750			 
11751			 splitLineText();
11752			 $(window).resize(splitLineText);
11753			 
11754			
11755			
11756		}
11757		
11758		multipleLargeFeaturedInit();
11759	
11760	}
11761	
11762	recentPostsFlickityInit();
11763
11764	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
11765		if($('.nectar-recent-posts-slider').length > 0) window.requestAnimationFrame(recentPostSliderParallax);
11766
11767	function recentPostSliderParallax(){
11768
11769		$('.nectar-recent-posts-slider').each(function(){
11770			var $offset = parseInt($(this).find('.flickity-slider').position().left);
11771			var $slideLength = $(this).find('.nectar-recent-post-slide').length;
11772			var $lastChildIndex = $(this).find('.nectar-recent-post-slide:last-child').index();
11773			var $slideWidth = $(this).find('.nectar-recent-post-slide').width();
11774			//wrapped fix
11775
11776			////first going to first
11777			if($offset >= -3) {
11778				$(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg').css('margin-left',parseInt(Math.ceil($slideWidth/3.5))+'px');
11779			} else {
11780				$(this).find('.nectar-recent-post-slide:last-child .nectar-recent-post-bg').css('margin-left','-'+parseInt(Math.ceil($slideWidth/3.5*$lastChildIndex))+'px');
11781			}
11782			////last going to first
11783			if(Math.abs($offset) >= ($slideLength-1) * $slideWidth) {
11784				$(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg').css('margin-left','-'+parseInt(Math.ceil(($slideWidth/3.5)*$slideLength))+'px');
11785			} else {
11786				$(this).find('.nectar-recent-post-slide:first-child .nectar-recent-post-bg').css('margin-left','0px');
11787			}
11788
11789			$(this).find('.nectar-recent-post-bg').css('transform','translateX('+Math.ceil($(this).find('.flickity-slider').position().left/-3.5)+'px)');
11790			
11791			
11792		});
11793		requestAnimationFrame(recentPostSliderParallax);
11794	}
11795
11796	function recentPostSliderParallaxMargins(){
11797
11798		$('.nectar-recent-posts-slider').each(function(){		
11799			var $slideWidth = $(this).find('.nectar-recent-post-slide').width();
11800			$(this).find('.nectar-recent-post-slide').each(function(i){
11801				$(this).find('.nectar-recent-post-bg').css('margin-left','-'+  parseInt(Math.ceil($slideWidth/3.5)*i)+'px');
11802			});
11803		
11804		});
11805	}
11806
11807	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/))
11808		recentPostSliderParallaxMargins();
11809
11810
11811	//portfolio item hover effect
11812	
11813	////desktop event 
11814	function portfolioHoverEffects() { 
11815
11816		if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(iPad|IEMobile)/)) {
11817			
11818			//style 1 & 2
11819			$('.portfolio-items:not([data-ps="7"]) .col .work-item:not(.style-3-alt):not(.style-3):not([data-custom-content="on"])').hover(function(){
11820				$(this).find('.work-info .vert-center').css({'margin-top' : 0});
11821				$(this).find('.work-info, .work-info .vert-center > *, .work-info > i').css({'opacity' : 1});
11822				$(this).find('.work-info-bg').css({ 'opacity' : 0.9 });
11823			},function(){
11824				$(this).find('.work-info .vert-center').css({ 'margin-top' : -20 });
11825				$(this).find('.work-info, .work-info .vert-center > *:not(.mfp-figure), .work-info > i').css({ 'opacity' : 0 });
11826				$(this).find('.work-info-bg').css({ 'opacity' : 0 });
11827			});
11828			
11829			
11830			//style 3
11831			$('.portfolio-items .col .work-item.style-3').hover(function(){
11832
11833				$(this).find('.work-info-bg').css({ 'opacity' : 0 });
11834
11835			},function(){
11836				
11837				$(this).find('.work-info-bg').css({ 'opacity' : 0.45 });
11838
11839			});
11840			
11841			
11842			//style 4
11843			$('.portfolio-items .col .work-item.style-4').hover(function(){
11844				
11845				$(this).find('img').stop().animate({
11846					'top' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()/2+'px'
11847				},250,'easeOutCubic');
11848				
11849				$(this).find('.work-info .bottom-meta').addClass('shown').stop().animate({
11850					'bottom' : '0px'
11851				},320,'easeOutCubic');
11852
11853			},function(){
11854				
11855				$(this).find('img').stop().animate({
11856					'top' : '0px'
11857				},250,'easeOutCubic');
11858				
11859				$(this).find('.work-info .bottom-meta').removeClass('shown').stop().animate({
11860					'bottom' : '-'+$(this).find('.work-info .bottom-meta').outerHeight()-2+'px'
11861				},320,'easeOutCubic');
11862				
11863			});
11864		
11865		} 
11866		////mobile event
11867		else {
11868			portfolioDeviceCheck();
11869		}
11870
11871	}
11872
11873	portfolioHoverEffects();
11874
11875	function style6Img(){
11876  
11877		//change sizer pos
11878		$('.style-5').each(function(){
11879			$(this).find('.sizer').insertBefore($(this).find('.parallaxImg'));
11880		});
11881
11882		//set parent zindex
11883		$('.style-5').parents('.wpb_row').css('z-index','100');
11884
11885		var d = document,
11886			de = d.documentElement,
11887			bd = d.getElementsByTagName('body')[0],
11888			htm = d.getElementsByTagName('html')[0],
11889			win = window,
11890			imgs = d.querySelectorAll('.parallaxImg'),
11891			totalImgs = imgs.length,
11892			supportsTouch = 'ontouchstart' in win || navigator.msMaxTouchPoints;
11893
11894		if(totalImgs <= 0){
11895			return;
11896		}
11897
11898		// build HTML
11899		for(var l=0;l<totalImgs;l++){
11900
11901			var thisImg = imgs[l],
11902				layerElems = thisImg.querySelectorAll('.parallaxImg-layer'),
11903				totalLayerElems = layerElems.length;
11904
11905			if(totalLayerElems <= 0){
11906				continue;
11907			}
11908
11909			while(thisImg.firstChild) {
11910				thisImg.removeChild(thisImg.firstChild);
11911			}
11912			
11913			var lastMove = 0;
11914
11915			//throttle performance for all browser other than chrome
11916			var eventThrottle = $('html').hasClass('cssreflections') ? 1 : 80;
11917			if(eventThrottle == 80) $('body').addClass('cssreflections');
11918
11919			var containerHTML = d.createElement('div'),
11920				shineHTML = d.createElement('div'),
11921				shadowHTML = d.createElement('div'),
11922				layersHTML = d.createElement('div'),
11923				layers = [];
11924
11925			thisImg.id = 'parallaxImg__'+l;
11926			containerHTML.className = 'parallaxImg-container';
11927			//shineHTML.className = 'parallaxImg-shine';
11928			shadowHTML.className = 'parallaxImg-shadow';
11929			layersHTML.className = 'parallaxImg-layers';
11930
11931			for(var i=0;i<totalLayerElems;i++){
11932				var layer = d.createElement('div'),
11933					layerInner = d.createElement('div'),
11934					imgSrc = layerElems[i].getAttribute('data-img');
11935
11936				$(layer).html($(layerElems[i]).html());
11937				layer.className = 'parallaxImg-rendered-layer';
11938				layer.setAttribute('data-layer',i);
11939
11940				if(i==0 && $(thisImg).parents('.wpb_gallery').length == 0) { 
11941					layerInner.className = 'bg-img';
11942					layerInner.style.backgroundImage = 'url('+imgSrc+')';
11943					layer.appendChild(layerInner);
11944				}
11945				layersHTML.appendChild(layer);
11946
11947				layers.push(layer);
11948			}
11949
11950			containerHTML.appendChild(layersHTML);
11951			//containerHTML.appendChild(shineHTML);
11952			thisImg.appendChild(containerHTML);
11953			$(thisImg).wrap('<div class="parallaxImg-wrap" />');
11954			if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) { $(thisImg).parent().append(shadowHTML); }
11955
11956			var w = thisImg.clientWidth || thisImg.offsetWidth || thisImg.scrollWidth;
11957			//thisImg.style.transform = 'perspective('+ w*3 +'px)';
11958
11959			if(supportsTouch && $('body.using-mobile-browser').length > 0 ){
11960				
11961		    } else {
11962		    	(function(_thisImg,_layers,_totalLayers,_shine) {
11963					$(thisImg).parents('.style-5').on('mousemove', function(e){
11964						
11965						var parentEl = $(this);
11966					 	var now = Date.now();
11967				        if (now > lastMove + eventThrottle) {
11968				            lastMove = now;
11969							window.requestAnimationFrame(function(){
11970								processMovement(e,false,_thisImg,_layers,_totalLayers,_shine,parentEl);		
11971							});
11972						}
11973
11974						//window.requestAnimationFrame(function(){
11975						//	processShineMovement(e,false,_thisImg,_layers,_totalLayers,_shine);		
11976						//});
11977					});
11978		            $(thisImg).parents('.style-5').on('mouseenter', function(e){
11979						processEnter(e,_thisImg,_layers,_totalLayers,_shine);		
11980					});
11981					$(thisImg).parents('.style-5').on('mouseleave', function(e){
11982						processExit(e,_thisImg,_layers,_totalLayers,_shine);		
11983					});
11984		        })(thisImg,layers,totalLayerElems,shineHTML);
11985		    }
11986
11987		    //set the depths
11988		    (function(_thisImg,_layers,_totalLayers,_shine) {
11989			    depths(false,_thisImg,_layers,_totalLayers,_shine);
11990			     window.addEventListener('resize', function(e){
11991			    	  depths(false,_thisImg,_layers,_totalLayers,_shine);
11992			    });
11993			 })(thisImg,layers,totalLayerElems,shineHTML);
11994		}
11995
11996		function processMovement(e, touchEnabled, elem, layers, totalLayers, shine, parentEl){
11997			
11998			//stop raf if exit already called
11999			if(!$(elem.firstChild).hasClass('over')) { processExit(e,elem,layers,totalLayers,shine); return false }
12000
12001			//set up multipliers
12002
12003			if($(elem).parents('.col.wide').length > 0 ) {
12004				var yMult = 0.03;
12005				var xMult = 0.063;
12006			} else if( $(elem).parents('.col.regular').length > 0  || $(elem).parents('.wpb_gallery').length > 0) {
12007				var yMult = 0.045;
12008				var xMult = 0.045;
12009			} else if($(elem).parents('.col.tall').length > 0 ) {
12010				var yMult = 0.05;
12011				var xMult = 0.015;
12012			} else if($(elem).parents('.col.wide_tall').length > 0) {
12013				var yMult = 0.04;
12014				var xMult = 0.04;
12015			} else if(parentEl.hasClass('nectar-fancy-box')) {
12016				var yMult = 0.045;
12017				var xMult = 0.022;
12018			} else {
12019				var yMult = 0.045;
12020				var xMult = 0.075;
12021			}
12022			
12023			var bdst = $(window).scrollTop(),
12024				bdsl = bd.scrollLeft,
12025				pageX = (touchEnabled)? e.touches[0].pageX : e.pageX,
12026				pageY = (touchEnabled)? e.touches[0].pageY : e.pageY,
12027				offsets = elem.getBoundingClientRect(),
12028				w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth, // width
12029				h = elem.clientHeight || elem.offsetHeight || elem.scrollHeight, // height
12030				wMultiple = 320/w,
12031				offsetX = 0.52 - (pageX - offsets.left - bdsl)/w, //cursor position X
12032				offsetY = 0.52 - (pageY - offsets.top - bdst)/h, //cursor position Y
12033				dy = (pageY - offsets.top - bdst) - h / 2, //@h/2 = center of container
12034				dx = (pageX - offsets.left - bdsl) - w / 2, //@w/2 = center of container
12035				yRotate = (offsetX - dx)*(yMult * wMultiple), //rotation for container Y
12036				xRotate = (dy - offsetY)*(xMult * wMultiple); //rotation for container X //old
12037
12038				//imgCSS = ' rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateZ(0)'; //img transform
12039
12040				if($(elem).parents('.wpb_gallery').length > 0) {
12041					var imgCSS = ' perspective('+ w*3 +'px) rotateX(' + -xRotate*1.9 + 'deg) rotateY(' + -yRotate*1.3 + 'deg)'; //img transform	
12042				} else {
12043					if($(elem).parents('.wide_tall').length == 0 && $(elem).parents('.wide').length == 0 && $(elem).parents('.tall').length == 0) {
12044						var $scaleAmount = (parentEl.hasClass('nectar-fancy-box')) ? '1.06' : '1.03';
12045						var $offsetAmount = (parentEl.hasClass('nectar-fancy-box')) ? '-2' : '-10';
12046						
12047						var imgCSS = ' perspective('+ w*3 +'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg)  translateY('+offsetY*$offsetAmount+'px) translateX('+offsetX*$offsetAmount+'px) scale('+$scaleAmount+')'; //img transform
12048					} else {
12049						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	
12050					}
12051				}
12052				//imgCSS2 = 'perspective('+ w*3 +'px) rotateX(' + xRotate + 'deg) rotateY(' + yRotate + 'deg) translateZ(0) translateY('+offsetY*-10+'px) translateX('+offsetX*-10+'px)'; //img transform //old
12053
12054				
12055			//container transform
12056			if(elem.firstChild.className.indexOf(' over') != -1){
12057				if($(elem).parents('.portfolio-items.masonry-items').length > 0){
12058					//imgCSS2 = ' scale3d(1.025,1.025,1.025)';
12059				} else {
12060					//imgCSS2 = ' scale3d(1.06,1.06,1.06)';
12061				}
12062			
12063				
12064
12065			}
12066		
12067			//elem.firstChild.style.transform = imgCSS;
12068			$(elem).find('.parallaxImg-container').css('transform',imgCSS);
12069
12070			if(!(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)) {
12071				$(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform',imgCSS);
12072			}
12073			//elem.style.transform = imgCSS2;
12074
12075			
12076		}
12077
12078		function processShineMovement(e, touchEnabled, elem, layers, totalLayers, shine){
12079
12080		}
12081
12082		function processEnter(e, elem, layers, totalLayers, shine){
12083
12084			elem.firstChild.className += ' over';
12085			elem.className += ' over';
12086
12087			//if(Idx == -1) {
12088				//$('body').addClass('cssreflections');
12089				//$(elem).addClass('transition');
12090			//	//var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },150);
12091			//} else {
12092				$(elem).addClass('transition');
12093
12094				if($(elem).parents('.wpb_gallery').length > 0) {
12095					var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },450);
12096				} else {
12097					var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },200);
12098				}
12099			//}
12100
12101			//depths(false, elem, layers, totalLayers, shine);
12102		}
12103
12104		function processExit(e, elem, layers, totalLayers, shine){
12105
12106			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
12107			var container = elem.firstChild;
12108
12109			container.className = container.className.replace(' over','');
12110			elem.className = elem.className.replace(' over','');
12111			$(container).css('transform', 'perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
12112			$(elem).parents('.parallaxImg-wrap').find('.parallaxImg-shadow').css('transform','perspective('+ w*3 +'px) rotateX(0deg) rotateY(0deg) translateZ(0)');
12113
12114			$(elem).addClass('transition');
12115				var $timeout = setTimeout(function(){ $(elem).removeClass('transition'); },200);
12116
12117			//removeDepths(false, elem, layers, totalLayers, shine);
12118
12119		}
12120
12121		function depths(touchEnabled, elem, layers, totalLayers, shine) {
12122			
12123			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
12124			var revNum = totalLayers;
12125			var container = elem.firstChild;
12126			
12127			//set z
12128			for(var ly=0;ly<totalLayers;ly++){
12129				//layers[ly].style.transform = 'translateX(' + (offsetX * revNum) * ((ly * 2.5) / wMultiple) + 'px) translateY(' + (offsetY * totalLayers) * ((ly * 2.5) / wMultiple) + 'px) translateZ(0)';
12130				if(ly == 0) $(layers[ly]).css('transform', 'translateZ(0px)');
12131				else $(layers[ly]).css('transform','translateZ(' +(w*3)/27*(ly*1.1) + 'px) ');
12132
12133				revNum--;
12134			}
12135			
12136			totalLayers = totalLayers + 3;
12137
12138			//set perspective from beginning
12139			$(container).css('transform','perspective('+ w*3 +'px)');
12140
12141			//$(elem).parents('.col').find('.parallaxImg-shine').css('transform','translateZ('+(w*3)/70*(totalLayers*1.1) +'px)');
12142		}
12143
12144		function removeDepths(touchEnabled, elem, layers, totalLayers, shine) {
12145			
12146			var w = elem.clientWidth || elem.offsetWidth || elem.scrollWidth;
12147			var revNum = totalLayers;
12148			
12149			//set z
12150			for(var ly=0;ly<totalLayers;ly++){
12151				
12152				if(ly == 0) $(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)');
12153				else $(layers[ly]).css('transform', 'translateZ(' +(w*3)/45*(ly*1.1) + 'px) scale(1)');
12154
12155				revNum--;
12156			}
12157			
12158			totalLayers = totalLayers + 3;
12159			
12160		}
12161	}
12162
12163	style6Img();
12164
12165	function portfolioDeviceCheck(){
12166		if($('body').hasClass('mobile') || navigator.userAgent.match(/(iPad|IEMobile)/) ){
12167			
12168			//if using more details
12169			if($('.portfolio-items .col .work-item').find('a:not(".pp")').length > 0){
12170				$('.portfolio-items .col .work-item').find('a.pp').css('display','none');
12171			} 
12172			
12173			//if only using pp
12174			else {
12175				$('.portfolio-items .col .work-item').find('a:not(".pp")').css('display','none');
12176			}
12177		
12178		} else {
12179			$('.portfolio-items .col .work-item').find('a').css('display','inline');
12180		}
12181	}
12182	
12183	
12184	//portfolio fullscreen zoom slider
12185
12186	//remove outside of column setups 
12187	$('.nectar_fullscreen_zoom_recent_projects').each(function(){
12188		if($(this).parents('.span_12').find('> .wpb_column').length > 1){
12189			var $zoomProjects = $(this).clone();
12190			var $zoomProjectsRow = $(this).parents('.span_12');
12191			$(this).remove();
12192			$zoomProjectsRow.prepend($zoomProjects);
12193		}
12194	});
12195
12196	 $.fn.lines = function (opts) {
12197        var s = $.extend({
12198            'lineClass' : 'line'
12199        },opts);
12200        return this.each(function () {
12201            var self = this,
12202                $self = $(self),
12203                $line,
12204                $prev;
12205            $self.find('.' + s.lineClass).contents().unwrap();
12206            $self.html(function (i, h) {
12207                return h.replace(/(\b[\w']+\b)/g, '<span class="' + s.lineClass + '">$1</span>');
12208            });
12209
12210            $self.find('.line + .line').each(function(i, el){
12211                $line = $(this),
12212                $prev = $line.prev('.line');
12213                if ($line.offset().top === $prev.offset().top) {
12214                    $prev.append(el.previousSibling, $line.contents());
12215                    $line.remove();
12216                }
12217            });
12218        });
12219    };
12220
12221	function splitLineText() {
12222		$('.nectar_fullscreen_zoom_recent_projects, .nectar-recent-posts-single_featured.multiple_featured').each(function(){
12223			
12224			var $slideClass = ($(this).find('.project-slides').length > 0) ? '.project-slide' : '.nectar-recent-post-slide';
12225			var $slideInfoClass = ($(this).find('.project-slides').length > 0) ? '.project-info h1' : '.inner-wrap h2 a';
12226			
12227			$(this).find($slideClass).each(function(i){
12228				
12229				$(this).find($slideInfoClass).each(function(){
12230					
12231					var textArr = $(this).text();
12232		      textArr = textArr.trim();
12233		      textArr = textArr.split(' ');
12234		
12235		      $(this)[0].innerHTML = '';
12236		      
12237		      for(var i=0;i<textArr.length;i++) {
12238		          $(this)[0].innerHTML += '<span>'+ textArr[i] + '</span> ';
12239		      }
12240					
12241				});
12242
12243				$(this).find($slideInfoClass + ' > span').wrapInner('<span class="inner" />');
12244
12245			});
12246			
12247		});
12248		
12249	}
12250
12251	function portfolioFullScreenSliderCalcs() {
12252
12253		var $bodyBorderSize = ($('.body-border-top').length > 0 && $(window).width() > 1000) ? $('.body-border-top').height(): 0;
12254
12255		$('.nectar_fullscreen_zoom_recent_projects').each(function(){
12256			if($(this).parents('.first-section').length > 0) {
12257				$(this).css('height',$(window).height() - $(this).offset().top - $bodyBorderSize);
12258			} else {
12259				$(this).css('height',$(window).height());
12260			}
12261		});
12262
12263	}
12264
12265				
12266	function nectarCustomSliderRotate(slider){
12267		var $controlSelector = (slider.find('.project-slides').length > 0) ? '.dot-nav > span' : '.controls > li';
12268		var $controlSelectorInd = (slider.find('.project-slides').length > 0) ? 'span' : ' li';
12269		
12270		var $slideLength = slider.find($controlSelector).length;
12271		var $currentSlide = slider.find($controlSelector+'.active').index();
12272		if( $currentSlide+1 == $slideLength) {
12273			slider.find($controlSelector+':first-child').click();
12274		} else {
12275			slider.find($controlSelector+'.active').next($controlSelectorInd).click();
12276		}
12277	}
12278	
12279	function nectarCustomSliderResetRotate(slider){
12280		clearInterval($nectarCustomSliderRotate);
12281
12282		//reinit autorotate
12283		if(slider.attr('data-autorotate').length > 0) {
12284			slide_interval = (parseInt(slider.attr('data-autorotate')) < 100) ? 4000 : parseInt(slider.attr('data-autorotate'));
12285			$nectarCustomSliderRotate = setInterval(function(){ nectarCustomSliderRotate(slider) },slide_interval);
12286		}
12287	}
12288
12289
12290	if($('.nectar_fullscreen_zoom_recent_projects').length > 0){
12291		portfolioFullScreenSliderCalcs();
12292		splitLineText();
12293		$(window).resize(splitLineText);
12294		$(window).resize(portfolioFullScreenSliderCalcs);
12295	}
12296
12297	$('.nectar_fullscreen_zoom_recent_projects').each(function(){
12298
12299
12300		var $projLength = $(this).find('.project-slide').length;
12301
12302		//autorotate
12303		if($(this).attr('data-autorotate').length > 0) {
12304			slide_interval = (parseInt($(this).attr('data-autorotate')) < 100) ? 4000 : parseInt($(this).attr('data-autorotate'));
12305			var $that = $(this);
12306			$nectarCustomSliderRotate = setInterval(function(){ nectarCustomSliderRotate($that) },slide_interval);
12307		}
12308
12309		//next/prev
12310		$(this).find('.zoom-slider-controls .next').click(function(){
12311
12312			//thres
12313			
12314			var $that = $(this);
12315			if(!$that.parent().hasClass('timeout')) {
12316				setTimeout(function(){
12317					$that.parent().removeClass('timeout');
12318				},1150);
12319			}
12320
12321			if($(this).parent().hasClass('timeout')) return false;
12322			$(this).parent().addClass('timeout');
12323			//switch logic
12324
12325			nectarCustomSliderResetRotate($that.parents('.nectar_fullscreen_zoom_recent_projects'));
12326			
12327			var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current');
12328			var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects');
12329
12330			$sliderInstance.find('.project-slide').removeClass('next').removeClass('prev');
12331			$sliderInstance.find('.project-slide').each(function(i){
12332
12333				if(i < $current.index()+1 && $current.index()+1 < $projLength)
12334					$(this).addClass('prev');
12335				else
12336					$(this).addClass('next');
12337			});
12338
12339			if($current.index()+1 == $projLength) {
12340				$sliderInstance.find('.project-slide:first-child').addClass('no-trans');
12341			}
12342
12343			setTimeout(function(){
12344
12345				if($current.index()+1 == $projLength) {
12346					$sliderInstance.find('.project-slide:first-child').removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
12347					$sliderInstance.find('.project-slide:last-child').removeClass('next').removeClass('current').addClass('prev');
12348				} else {
12349					$current.next('.project-slide').removeClass('next').removeClass('prev').addClass('current');
12350					$current.removeClass('current').addClass('prev');
12351				}
12352
12353				//update dot nav
12354				if($sliderInstance.find('.dot-nav').length > 0) {
12355					$sliderInstance.find('.dot-nav span.active').removeClass('active');
12356					$sliderInstance.find('.dot-nav span:nth-child('+ ($sliderInstance.find('.project-slide.current').index() + 1) +')').addClass('active');
12357				}
12358
12359			},30);
12360
12361			return false;
12362			
12363		});
12364
12365		$(this).find('.zoom-slider-controls .prev').click(function(){
12366
12367			//thres
12368			var $that = $(this);
12369			if(!$that.parent().hasClass('timeout')) {
12370				setTimeout(function(){
12371					$that.parent().removeClass('timeout');
12372				},1150);
12373			}
12374
12375			if($(this).parent().hasClass('timeout')) return false;
12376			$(this).parent().addClass('timeout');
12377			
12378			nectarCustomSliderResetRotate($that.parents('.nectar_fullscreen_zoom_recent_projects'));
12379
12380			//switch logic
12381			var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current');
12382			var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects');
12383
12384			
12385			$sliderInstance.find('.project-slide').removeClass('next').removeClass('prev');
12386			$sliderInstance.find('.project-slide').each(function(i){
12387
12388				if(i < $current.index() || $current.index() == 0)
12389					$(this).addClass('prev');
12390				else
12391					$(this).addClass('next');
12392			});
12393
12394			if($current.index() == 0)
12395				$sliderInstance.find('.project-slide:last-child').addClass('no-trans');
12396
12397			setTimeout(function(){
12398
12399				if($current.index() == 0) {
12400					$sliderInstance.find('.project-slide:last-child').removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
12401					$sliderInstance.find('.project-slide:first-child').removeClass('next').removeClass('prev').removeClass('current').addClass('next');
12402				} else {
12403					$current.prev('.project-slide').removeClass('next').removeClass('prev').addClass('current');
12404					$current.removeClass('current').addClass('next');
12405				}
12406
12407				//update dot nav
12408				if($sliderInstance.find('.dot-nav').length > 0) {
12409					$sliderInstance.find('.dot-nav span.active').removeClass('active');
12410					$sliderInstance.find('.dot-nav span:nth-child('+ ($sliderInstance.find('.project-slide.current').index() + 1) +')').addClass('active');
12411				}
12412
12413			},30);
12414
12415
12416			return false;
12417
12418		});
12419
12420		//pagination
12421		//if($(this).is('[data-slider-controls="both"]') || $(this).is('[data-slider-controls="pagination"]')) {
12422			$(this).find('> .normal-container').append('<div class="dot-nav"></div>');
12423			for(var $i=0;$i < $projLength;$i++) {
12424				if($i == 0) {
12425					$(this).find('.dot-nav').append('<span class="dot active"><span></span></span>');
12426				} else {
12427					$(this).find('.dot-nav').append('<span class="dot"><span></span></span>');
12428				}
12429		
12430			}
12431		//}
12432
12433		var $dotIndex = 1;
12434
12435		$('.nectar_fullscreen_zoom_recent_projects .dot-nav > span').click(function(){
12436
12437			if($(this).hasClass('active')) return;
12438
12439			//thres
12440			var $that = $(this);
12441			if(!$that.parent().hasClass('timeout')) {
12442				setTimeout(function(){
12443					$that.parent().removeClass('timeout');
12444				},1150);
12445			}
12446
12447			if($(this).parent().hasClass('timeout')) return;
12448			$(this).parent().addClass('timeout');
12449
12450			nectarCustomSliderResetRotate($that.parents('.nectar_fullscreen_zoom_recent_projects'));
12451
12452			//switch logic
12453			$(this).parent().find('span.active').removeClass('active');
12454			$(this).addClass('active');
12455
12456			$dotIndex = $(this).index() + 1;
12457
12458			var $current = $(this).parents('.nectar_fullscreen_zoom_recent_projects').find('.project-slide.current');
12459			var $sliderInstance = $(this).parents('.nectar_fullscreen_zoom_recent_projects');
12460
12461			var $prevIndex = $current.index() + 1;
12462
12463			$sliderInstance.find('.project-slide').removeClass('next').removeClass('prev');
12464
12465			$sliderInstance.find('.project-slide').each(function(i){
12466				if(i < $dotIndex-1)
12467					$(this).addClass('prev');
12468				else
12469					$(this).addClass('next');
12470			});
12471
12472			//going prev
12473			if($prevIndex > $dotIndex) {
12474				$sliderInstance.find('.project-slide').eq($dotIndex-1).addClass('no-trans').addClass('prev').removeClass('next');
12475				setTimeout(function(){
12476					$sliderInstance.find('.project-slide').eq($dotIndex-1).removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
12477					$current.removeClass('current').addClass('next');
12478				},30);
12479			
12480			} 
12481
12482			//going forawrd
12483			else {
12484				$sliderInstance.find('.project-slide').eq($dotIndex-1).addClass('no-trans').addClass('next').removeClass('prev');
12485				setTimeout(function(){
12486					$sliderInstance.find('.project-slide').eq($dotIndex-1).removeClass('no-trans').removeClass('next').removeClass('prev').addClass('current');
12487					$current.removeClass('current').addClass('prev');
12488				},30);
12489
12490			}
12491			
12492		});	
12493
12494
12495	});
12496
12497	
12498 	
12499
12500	//portfolio accent color
12501	function portfolioAccentColor() {
12502
12503		var portfolioSocialColorCss = '';
12504
12505		$('.portfolio-items .col').each(function(){
12506			if ($(this).has('[data-project-color]')) { 
12507				$(this).find('.work-info-bg, .bottom-meta').css('background-color',$(this).attr('data-project-color'));
12508
12509				//style5
12510				$(this).find('.parallaxImg-rendered-layer .bg-overlay').css('border-color',$(this).attr('data-project-color'));
12511
12512				var	$projColor = $(this).attr('data-project-color');
12513				if($(this).find('.custom-content .nectar-social').length > 0 && $('body[data-button-style="rounded"]') ) portfolioSocialColorCss += 'body[data-button-style="rounded"] .col[data-
12513project-color="'+$projColor+'"] .custom-content .nectar-social > *:hover i { color: '+ $projColor +'!important; } ';
12514
12515			}
12516		});
12517		
12518		if(portfolioSocialColorCss.length > 1) {
12519
12520			var head = document.head || document.getElementsByTagName('head')[0];
12521			var style = document.createElement('style');
12522
12523				style.type = 'text/css';
12524			if (style.styleSheet){
12525			  style.styleSheet.cssText = portfolioSocialColorCss;
12526			} else {
12527			  style.appendChild(document.createTextNode(portfolioSocialColorCss));
12528			}
12529
12530			head.appendChild(style);
12531		}
12532	}
12533	portfolioAccentColor();
12534	
12535	//portfolio sort
12536	$('body').on('mouseenter','.portfolio-filters',function(){
12537		if(!portfolioFiltersOnMobile) {
12538			$(this).find('> ul').stop(true,true).slideDown(500,'easeOutExpo');
12539		}
12540		$(this).find('a#sort-portfolio span').html($(this).find('a#sort-portfolio').attr('data-sortable-label'));
12541	});
12542
12543	$('body').on('mouseleave','.portfolio-filters',function(){
12544		var $activeCat = $(this).find('a.active').html();
12545		if( typeof $activeCat == 'undefined' || $activeCat.length == 0) $activeCat = $(this).attr('data-sortable-label');
12546		$(this).find('a#sort-portfolio span').html($activeCat);
12547		if(!portfolioFiltersOnMobile) {
12548			$(this).find('> ul').stop(true,true).slideUp(500,'easeOutExpo');
12549		}
12550	});
12551	
12552	//portfolio selected category
12553	$('body').on('click','.portfolio-filters ul li a', function(){
12554		$(this).parents('.portfolio-filters').find('#sort-portfolio span').html($(this).html());
12555	});
12556	
12557	//portfolio prevent jump on parent dropdown click
12558	$('body').on('click','.portfolio-filters > a#sort-portfolio', function(){
12559		return false;
12560	});
12561	
12562	//inline portfolio selected category
12563	$('body').on('click','.portfolio-filters-inline ul li a',function(){
12564
12565		$(this).parents('ul').find('li a').removeClass('active');
12566		$(this).addClass('active');
12567		$(this).parents('.portfolio-filters-inline').find('#current-category').html($(this).html());
12568		
12569	});
12570	
12571	var portfolioFiltersOnMobile = false;
12572	
12573	function portfolioFiltersInit() {
12574		//mobile sort menu fix
12575		if($('body').hasClass('mobile') || navigator.userAgent.match(/(iPad|IEMobile)/)){
12576			portfolioFiltersOnMobile = true;
12577			$('.portfolio-filters').unbind('mouseenter mouseleave');
12578			$('.portfolio-filters > a, .portfolio-filters ul li a').click(function(e){
12579				if(e.originalEvent !== undefined) $(this).parents('.portfolio-filters').find('> ul').stop(true,true).slideToggle(600,'easeOutCubic');
12580			});
12581		}
12582
12583		if($('.portfolio-filters-inline[data-alignment="left"]').length > 0 || $('.portfolio-filters-inline[data-alignment="center"]').length > 0) {
12584			$('.portfolio-filters-inline .container > ul > li:nth-child(1) a').click();
12585		} else {
12586			$('.portfolio-filters-inline .container > ul > li:nth-child(2) a').click();
12587		}
12588		
12589		//portfolio more details page menu highlight
12590		$('body.single-portfolio #header-outer nav > ul > li > a:contains("Portfolio")').parents('li').addClass('current-menu-item');
12591		
12592		//blog page highlight
12593		$('body.single-post #header-outer nav > ul > li > a:contains("Blog")').parents('li').addClass('current-menu-item');
12594	}
12595
12596	portfolioFiltersInit();
12597
12598	
12599	//blog love center
12600	function centerLove(){
12601		$('.post').each(function(){
12602			
12603			var $loveWidth = $(this).find('.post-meta .nectar-love').outerWidth();
12604			var $loveWrapWidth = $(this).find('.post-meta  .nectar-love-wrap').width();
12605			
12606			//center
12607			$(this).find('.post-meta .nectar-love').css('margin-left', $loveWrapWidth/2 - $loveWidth/2 + 'px' );
12608			$(this).find('.nectar-love-wrap').css('visibility','visible');
12609		});
12610	}
12611	
12612	$('.nectar-love').on('click',function(){
12613		centerLove();
12614	});
12615	
12616	centerLove();	
12617	
12618
12619	//portfolio single comment order
12620	function portfolioCommentOrder(){
12621	
12622		if($('body').hasClass('mobile') && $('body').hasClass('single-portfolio') && $('#respond').length > 0){
12623			$('#sidebar').insertBefore('.comments-section');
12624		}
12625		 
12626		else if($('body').hasClass('single-portfolio') && $('#respond').length > 0) {
12627			$('#sidebar').insertAfter('.post-area');
12628		}
12629		
12630	}
12631
12632	portfolioCommentOrder();
12633	 
12634	
12635	//portfolio sidebar follow
12636	var sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
12637	
12638	function portfolioSidebarFollow(){
12639		
12640		if($('body.single-portfolio').length == 0 || $('#sidebar[data-follow-on-scroll]').length == 0) { return; }
12641
12642		sidebarFollow = $('.single-portfolio #sidebar').attr('data-follow-on-scroll');
12643	
12644		if( sidebarFollow == 1 && !$('body').hasClass('mobile') && parseInt($('#sidebar').height()) + 50 <= parseInt($('.post-area').height())) {
12645			
12646			 
12647			 //padding from top of screen
12648			 var $ssExtraTopSpace = 50;
12649
12650			 if($('#header-outer[data-remove-fixed="0"]').length > 0 && $('body[data-hhun="1"]').length == 0) { 
12651				 $ssExtraTopSpace += $('#header-outer').outerHeight();	
12652				 
12653				 //resize effect
12654				 if($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0 ) {
12655						var shrinkNum = 6;		
12656						var headerPadding2 = parseInt($('#header-outer').attr('data-padding')) - parseInt($('#header-outer').attr('data-padding'))/1.8;
12657						shrinkNum = $('#header-outer').attr('data-shrink-num');
12658						$ssExtraTopSpace -= shrinkNum;
12659						$ssExtraTopSpace -= headerPadding2;
12660				 }
12661				 
12662				 //condesne
12663				 if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
12664					 
12665						 var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
12666						 var $secondaryHeader = $('#header-secondary-outer');
12667						 
12668						 $ssExtraTopSpace = 50;
12669						 $ssExtraTopSpace += $('#header-outer').height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top')) ) - parseInt(nectarDOMInfo.secondaryHeaderHeight);
12670				 }
12671				 
12672
12673			 }
12674
12675			 if($('#wpadminbar').length > 0) {
12676				 $ssExtraTopSpace += $('#wpadminbar').outerHeight();
12677			 }
12678
12679			if($('#header-outer').attr('data-using-secondary') == '1' && $('body.material').length == 0) {
12680				 $ssExtraTopSpace += $('#header-secondary-outer').outerHeight();
12681			 }
12682			 
12683			 $('.single-portfolio #sidebar').theiaStickySidebar({
12684				 additionalMarginTop: $ssExtraTopSpace,
12685				 updateSidebarHeight: false
12686			 });
12687
12688			 
12689		} //if sticky sidebar is active and needs to be called
12690		
12691	} // end  portfolioSidebarFollow function
12692	
12693
12694	
12695	
12696	
12697	//remove the portfolio filters that are not found in the current page
12698	function isotopeCatSelection() {
12699
12700
12701		$('.portfolio-items:not(".carousel")').each(function(){
12702
12703			var isotopeCatArr = [];
12704			var $portfolioCatCount = 0;
12705			$(this).parent().parent().find('div[class^=portfolio-filters] ul li').each(function(i){
12706				if($(this).find('a').length > 0) {
12707					isotopeCatArr[$portfolioCatCount] = $(this).find('a').attr('data-filter').substring(1);	
12708					$portfolioCatCount++;
12709				}
12710			});
12711			
12712			////ice the first (all)
12713			isotopeCatArr.shift();
12714			
12715			
12716			var itemCats = '';
12717			
12718			$(this).find('> div').each(function(i){
12719				itemCats += $(this).attr('data-project-cat');
12720			});
12721			itemCats = itemCats.split(' ');
12722			
12723			////remove the extra item on the end of blank space
12724			itemCats.pop();
12725			
12726			////make sure the array has no duplicates
12727			itemCats = $.unique(itemCats);
12728			
12729			////if user has chosen a set of filters to display - only show those
12730			if($(this).attr('data-categories-to-show').length != 0 && $(this).attr('data-categories-to-show') != 'all') {
12731				$userSelectedCats = $(this).attr('data-categories-to-show').replace(/,/g , ' ');
12732				$userSelectedCats = $userSelectedCats.split(' ');
12733				
12734				if(!$(this).hasClass('infinite_scroll')) $(this).removeAttr('data-categories-to-show');
12735			} else {
12736				$userSelectedCats = itemCats;
12737			}
12738			
12739			
12740			////Find which categories are actually on the current page
12741			var notFoundCats = [];
12742			$.grep(isotopeCatArr, function(el) {
12743
12744		    	if ($.inArray(el, itemCats) == -1) notFoundCats.push(el);
12745		    	if ($.inArray(el, $userSelectedCats) == -1) notFoundCats.push(el);
12746
12747			});
12748			
12749			//manipulate the list
12750			if(notFoundCats.length != 0){
12751				$(this).parent().parent().find('div[class^=portfolio-filters] ul li').each(function(){
12752					if($(this).find('a').length > 0) {
12753						if( $.inArray($(this).find('a').attr('data-filter').substring(1), notFoundCats) != -1 ){ 
12754							
12755							if($(this).find('> ul.children').length > 0) {
12756								$(this).find('> a').hide(); 
12757							} else {
12758								$(this).hide(); 
12759							}
12760							
12761						} else {
12762							$(this).show();
12763						}
12764					}
12765				})
12766			}
12767		});
12768	}
12769	
12770	isotopeCatSelection();
12771	
12772	
12773	//sharing buttons
12774
12775	var completed = 0;
12776	var windowLocation = window.location.href.replace(window.location.hash, '');
12777
12778	function facebookShare(){
12779		windowLocation = window.location.href.replace(window.location.hash, '');
12780		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" ) 
12781		return false;
12782	}
12783
12784	function googlePlusShare(){
12785		windowLocation = window.location.href.replace(window.location.hash, '');
12786		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" ) 
12787		return false;
12788	}
12789
12790	function twitterShare(){
12791        windowLocation = window.location.href.replace(window.location.hash, '');		
12792		if($(".section-title h1").length > 0) {
12793			var $pageTitle = encodeURIComponent($(".section-title h1").text());
12794		} else {
12795			var $pageTitle = encodeURIComponent($(document).find("title").text());
12796		}
12797		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" ) 
12798		return false;
12799	}
12800
12801	function wooTwitterShare(){
12802		windowLocation = window.location.href.replace(window.location.hash, '');
12803		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" ) 
12804		return false;
12805	}
12806
12807	function linkedInShare(){
12808	    windowLocation = window.location.href.replace(window.location.hash, '');	
12809		if($(".section-title h1").length > 0) {
12810			var $pageTitle = encodeURIComponent($(".section-title h1").text());
12811		} else {
12812			var $pageTitle = encodeURIComponent($(document).find("title").text());
12813		}
12814		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" ) 
12815		return false;
12816	}
12817
12818	function woolinkedInShare(){
12819	    windowLocation = window.location.href.replace(window.location.hash, '');	
12820		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" ) 
12821		return false;
12822	}
12823
12824	function pinterestShare(){
12825		windowLocation = window.location.href.replace(window.location.hash, '');
12826		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'); 
12827		
12828		if($(".section-title h1").length > 0) {
12829			var $pageTitle = encodeURIComponent($(".section-title h1").text());
12830		} else {
12831			var $pageTitle = encodeURIComponent($(document).find("title").text());
12832		}
12833		
12834		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" ) 
12835		return false;
12836	}
12837	
12838	function wooPinterestShare(){
12839		$imgToShare = ($('img.attachment-shop_single').length > 0) ? $('img.attachment-shop_single').first().attr('src') : $('.single-product-main-image img').first().attr('src');
12840		windowLocation = window.location.href.replace(window.location.hash, '');
12841		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" ) 
12842		return false;
12843	}
12844
12845
12846	function socialFade(){
12847
12848			if(completed == $('a.nectar-sharing').length && $('a.nectar-sharing').parent().hasClass('in-sight')) {
12849
12850
12851					//love fadein
12852					$('.nectar-social .nectar-love span').show(350,'easeOutSine',function(){
12853						$(this).stop().animate({'opacity':1},800);
12854					});
12855					
12856					//sharing loadin
12857					$('.nectar-social > a').each(function(i){
12858						var $that = $(this);
12859						
12860						$(this).find('> span').show(350,'easeOutSine',function(){
12861							$that.find('> span').stop().animate({'opacity':1},800);
12862						});
12863						
12864					});
12865
12866
12867				//alt blog layout total share count
12868				var $totalShares = 0;
12869				$('.nectar-social > a .count').each(function(){
12870					$totalShares += parseInt($(this).html());
12871				});
12872				
12873				if($totalShares != 1){
12874					$('.single .meta-share-count .plural').css({'opacity':'1', 'display':'inline'});
12875					$('.single .meta-share-count .singular').remove();
12876				} else {
12877					$('.single .meta-share-count .singular').css({'opacity':'1', 'position':'relative',  'display':'inline'});
12878					$('.single .meta-share-count .plural').remove();
12879				}
12880
12881				$('.meta-share-count .share-count-total').html($totalShares).css('opacity',1);
12882			}
12883		}
12884
12885	$('body').on('click','#single-below-header .nectar-social a', function(){ return false; });
12886
12887	$('body').on('click','.facebook-share:not(.inactive)', facebookShare);
12888	$('body').on('click','.google-plus-share:not(.inactive)', googlePlusShare);
12889	$('body').on('click','.nectar-social:not(".woo") .twitter-share:not(.inactive)', twitterShare);
12890	$('body').on('click','.nectar-social.woo .twitter-share', wooTwitterShare);
12891	$('body').on('click','.nectar-social:not(".woo") .linkedin-share:not(.inactive)', linkedInShare);
12892	$('body').on('click','.nectar-social.woo .linkedin-share', woolinkedInShare);
12893	$('body').on('click','.nectar-social:not(".woo") .pinterest-share:not(.inactive)', pinterestShare);
12894	$('body').on('click','.nectar-social.woo .pinterest-share', wooPinterestShare);
12895	$('body').on('click','.nectar-social-sharing-fixed > a', function(){ return false; });
12896
12897	function socialSharingInit() {
12898
12899		//mobile fullscreen blog class for click event fix
12900		if($('body').hasClass('mobile') && $('.single-post .fullscreen-header').length > 0) {
12901			$('#single-below-header .nectar-social .nectar-sharing, #single-below-header .nectar-social .nectar-sharing-alt').addClass('inactive');
12902		}
12903
12904		completed = 0;
12905
12906		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) {
12907  
12908		 
12909			////facebook
12910			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) {
12911				
12912				//load share count on load  
12913				$.getJSON("https://graph.facebook.com/?id="+ windowLocation +"&callback=?", function(data) {
12914					if( data.share != undefined && data.share.share_count != undefined && data.share.share_count != 0 && (data.share.share_count != null)) { 
12915						$('.facebook-share a span.count, a.facebook-share span.count').html( data.share.share_count );	
12916					}
12917					else {
12918						$('.facebook-share a span.count, a.facebook-share span.count').html( 0 );	
12919					}
12920					completed++;
12921					socialFade();
12922				});
12923			 
12924				
12925				
12926			} else if($('a.facebook-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.facebook-share').length > 0) {
12927				completed++;
12928				socialFade();
12929			}
12930			
12931			
12932			////twitter
12933			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) {
12934				//load tweet count on load 
12935				//$.getJSON('https://cdn.api.twitter.com/1/urls/count.json?url='+windowLocation+'&callback=?', function(data) {
12936				//	if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
12937					//	$('.twitter-share a span.count, a.twitter-share span.count').html( data.count );
12938					//}
12939					//else {
12940					$('.twitter-share a span.count, a.twitter-share span.count').html( 0 );
12941					//}
12942					completed++;
12943					socialFade();
12944				//});
12945
12946
12947			} else if($('a.twitter-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.twitter-share').length > 0 ) {
12948				completed++;
12949				socialFade();
12950			}
12951			
12952			
12953			////linkedIn
12954			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) {
12955				//load share count on load 
12956				//$.getJSON('https://www.linkedin.com/countserv/count/share?url='+windowLocation+'&callback=', function(data) {
12957				//	if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
12958				//		$('.linkedin-share a span.count, a.linkedin-share span.count').html( data.count );
12959				//	}
12960				//	else {
12961						$('.linkedin-share a span.count, a.linkedin-share span.count').html( 0 );
12962				//	}
12963					completed++;
12964					socialFade();
12965				//});
12966
12967				
12968			} else if($('a.linkedin-share').length > 0 && $('body[data-button-style="rounded"]').length > 0 || $('.sharing-default-minimal a.linkedin-share').length > 0) {
12969				completed++;
12970				socialFade();
12971			}
12972			
12973			
12974			////pinterest
12975			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) {
12976				//load pin count on load 
12977				$.getJSON('https://api.pinterest.com/v1/urls/count.json?url='+windowLocation+'&callback=?', function(data) {
12978					if((data.count != 0) && (data.count != undefined) && (data.count != null)) { 
12979						$('.pinterest-share a span.count, a.pinterest-share span.count').html( data.count );
12980					}
12981					else {
12982						$('.pinterest-share a span.count, a.pinterest-share span.count').html( 0 );
12983					}
12984					completed++;
12985					socialFade();
12986				});
12987
12988			} else if($('a.pinterest-share').length > 0 && $('body[data-button-style="rounded"]').length >  0 || $('.sharing-default-minimal a.pinterest-share').length > 0) {
12989				completed++;
12990				socialFade();
12991
12992			}
12993
12994		//fadeIn
12995		$('a.nectar-sharing > span.count, a.nectar-sharing-alt > span.count').hide().css('width','auto');
12996
12997
12998		//social light up
12999		$('.nectar-social').each(function() {
13000			if($(this).parents('.custom-content').length == 0 && $(this).parents('.nectar-social-sharing-fixed').length == 0) {
13001
13002
13003				var $that = $(this);
13004				var waypoint = new Waypoint({
13005	 			element: $that,
13006	 			 handler: function(direction) {
13007
13008					$slide_timeout = ($('#page-header-bg[data-animate-in-effect="slide-down"] .nectar-social').length > 0 ) ? 900 : 1;
13009
13010					setTimeout(function(){
13011
13012						$that.addClass('in-sight');
13013						socialFade();
13014						
13015						if($('#page-header-bg .nectar-social').length == 0) {
13016							$that.find('> *').each(function(i){
13017								
13018								var $that = $(this);
13019								var $timeout = ($('body[data-button-style="rounded"]').length > 0) ? 0: 750;
13020
13021								setTimeout(function(){ 
13022									
13023									$that.delay(i*80).queue(function(){ 
13024										
13025										var $that = $(this); $(this).addClass('hovered'); 
13026										
13027										setTimeout(function(){ 
13028											$that.removeClass('hovered');
13029										},300); 
13030										
13031									});
13032								
13033								},$timeout);
13034							});
13035						}
13036
13037					},$slide_timeout );
13038
13039					$that.addClass('animated-in');
13040					waypoint.destroy();
13041				},
13042				offset: 'bottom-in-view'
13043
13044			}); 
13045
13046
13047				
13048			}
13049			}); 
13050
13051		}
13052
13053	}
13054	
13055	socialSharingInit();
13056
13057
13058	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
13059
13060		var $socialTimeout;
13061		$('body').on('mouseenter','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
13062			clearTimeout($socialTimeout);
13063
13064			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
13065				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'right':'0px'},0);
13066			else 
13067				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'left':'0px'},0);
13068
13069			$(this).parents('[id*="-meta"]').addClass('social-hovered');
13070
13071			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':0},250);
13072			$(this).find('.nectar-social a').each(function(i){
13073				$(this).stop(true).delay(i*40).animate({'opacity': 1,  'left':'0px'}, 150);
13074			});
13075
13076		});
13077
13078	
13079		$('body').on('mouseleave','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
13080			$(this).parents('[id*="-meta"]').removeClass('social-hovered');
13081
13082			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
13083				$(this).find('.nectar-social').stop(true).animate({'opacity': 0,  'right':'-20px'}, 200);
13084			else 
13085				$(this).find('.nectar-social').stop(true).animate({'opacity': 0,  'left':'-20px'}, 200);
13086
13087			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':1},250);
13088
13089			var $that = $(this);
13090			
13091			$socialTimeout = setTimeout(function(){ 
13092				$that.find('.nectar-social').hide(); 
13093				if($that.parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
13094					$that.find('.nectar-social a').stop(true).animate({'opacity': 0,  'left':'20px'},0);   
13095				else 
13096					$that.find('.nectar-social a').stop(true).animate({'opacity': 0,  'left':'-20px'},0);   
13097			}, 200);
13098		});
13099	} else {
13100		var $socialTimeout;
13101		$('body').on('click','#single-meta .meta-share-count, #project-meta .meta-share-count', function(){
13102			clearTimeout($socialTimeout);
13103
13104			if($(this).parents('[id*="single-meta"]').length > 0 && $('[data-tab-pos="fullwidth"]').length == 0) 
13105				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'right':'0px'},0);
13106			else 
13107				$(this).find('.nectar-social').show().stop(true).animate({'opacity': 1, 'left':'0px'},0);
13108
13109			$(this).parents('[id*="-meta"]').addClass('social-hovered');
13110
13111			$(this).parents('[id*="-meta"]').find('.n-shortcode a, .meta-comment-count a, .meta-share-count > a ').stop(true).animate({'opacity':0},250);
13112			$(this).find('.nectar-social a').each(function(i){
13113				$(this).stop(true).delay(i*40).animate({'opacity': 1,  'left':'0px'}, 150);
13114			});
13115
13116			return false;
13117		});
13118
13119	}
13120
13121	$('body').on('mouseenter','.fullscreen-header  .meta-share-count', function(){
13122		$(this).find('> a, > i').stop(true).animate({'opacity': 0},400);
13123		$(this).find('.nectar-social > *').each(function(i){
13124			$(this).stop(true).delay(i*50).animate({'opacity':'1', 'top': '0px'},250,'easeOutCubic');
13125		});
13126		//allow clickable on mobile
13127		setTimeout(function(){ $('.meta-share-count .nectar-sharing, .meta-share-count .nectar-sharing-alt').removeClass('inactive'); },300);
13128	});
13129
13130	if(!navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
13131		$('body').on('mouseleave','.fullscreen-header  .meta-share-count', function(){
13132			$(this).find('> a, > i').stop(true).animate({'opacity': 1},300,'easeInCubic');
13133			$(this).find('.nectar-social > *').each(function(i){
13134				$(this).stop(true).animate({'opacity':'0', 'top': '10px'},200,'easeInCubic');
13135			});
13136		});
13137	}
13138
13139	//full width love center
13140	function nectarLoveFWCenter(){
13141		$('.nectar-social.full-width').each(function(){ 
13142			$(this).find('.n-shortcode .nectar-love').css('padding-top', $(this).find('> a').css('padding-top'));
13143		});
13144	}
13145	
13146	nectarLoveFWCenter();
13147	
13148
13149	//-----------------------------------------------------------------
13150	// NectarLove
13151	//-----------------------------------------------------------------
13152	
13153	////love iwth txt
13154	$('.fullscreen-header .nectar-love').each(function(){
13155		if($(this).find('.nectar-love-count').text() == '1') {
13156			$(this).find('span.love-txt.single').css({'visibility':'visible', 'text-indent':'0'});
13157			$(this).find('span.love-txt.plural').css({'visibility':'hidden', 'text-indent':'-9999px'});
13158		} else {
13159			$(this).find('span.love-txt.single').css({'visibility':'hidden', 'text-indent':'-9999px'});
13160			$(this).find('span.love-txt.plural').css({'visibility':'visible', 'text-indent':'0'});
13161		}
13162	});
13163
13164	$('body').on('click','.nectar-love', function() {
13165			
13166
13167			var $loveLink = $(this);
13168			var $id = $(this).attr('id');
13169			var $that = $(this);
13170			
13171			if($loveLink.hasClass('loved')) return false;
13172			if($(this).hasClass('inactive')) return false;
13173			
13174			var $dataToPass = {
13175				action: 'nectar-love', 
13176				loves_id: $id,
13177				love_nonce: nectarLove.loveNonce
13178			}
13179			
13180			$.post(nectarLove.ajaxurl, $dataToPass, function(data){
13181				$loveLink.find('span:not(.love-txt)').html(data);
13182				$loveLink.addClass('loved').attr('title','You already love this!');
13183				$loveLink.find('span:not(.love-txt)').css({'opacity': 1,'width':'auto'});
13184
13185				if($(data).text() == '1') {
13186					$loveLink.find('span.love-txt.single').css({'visibility':'visible', 'text-indent':'0'});
13187					$loveLink.find('span.love-txt.plural').css({'visibility':'hidden', 'text-indent':'-9999px'});
13188				} else {
13189					$loveLink.find('span.love-txt.single').css({'visibility':'hidden', 'text-indent':'-9999px'});
13190					$loveLink.find('span.love-txt.plural').css({'visibility':'visible', 'text-indent':'0'});
13191				}
13192
13193				//ascend
13194				if($('body').hasClass('ascend') && $that.parents('.classic_enhanced').length == 0 ){
13195					$that.find('.icon-salient-heart-2').addClass('loved');
13196				} else if($that.parents('.classic_enhanced').length > 0 ) {
13197					$that.find('.icon-salient-heart-2').addClass('loved');
13198				}
13199			});
13200			
13201			$(this).addClass('inactive');
13202			
13203			return false;
13204	});
13205
13206
13207	
13208	//infinite scroll
13209	function infiniteScrollInit() {
13210
13211		if($('.infinite_scroll').length > 0) {
13212			
13213			//portfolio
13214			$('.portfolio-items.infinite_scroll').infinitescroll({
13215		    	navSelector  : "div#pagination",            
13216		   	    nextSelector : "div#pagination a:first",    
13217		   	    itemSelector : ".portfolio-items.infinite_scroll .element",
13218		   	    finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
13219		        msgText: " ",         
13220		   },function(newElements){
13221		   	
13222
13223				var $container = $('.portfolio-items.infinite_scroll:not(.carousel)');
13224				//loading effect   
13225
13226		        var $newElems = $( newElements ).css('opacity',0);
13227		        //// ensure that images load before adding to masonry layout
13228		        $newElems.imagesLoaded(function(){
13229		          
13230		          $( newElements ).css('opacity',1);
13231
13232		          $container.isotope( 'appended', $( newElements ));
13233		          
13234		          $( newElements ).find('.work-item').addClass('ajax-loaded');
13235		          $( newElements ).addClass('ajax-loaded');
13236		          ///// show elems now they're ready
13237		          
13238		          $(newElements).find('.work-meta, .nectar-love-wrap').css({'opacity':1});
13239		          
13240		          //keep filtering
13241		          if($('.portfolio-filters-inline').length > 0 || $('.portfolio-filters').length > 0) {
13242		          	
13243		          	  if($('.portfolio-filters-inline').length > 0) {
13244		          	  	 var selector = $('.portfolio-filters-inline a.active').attr('data-filter');
13245		          	  } else {
13246		          	  	 var selector = $('.portfolio-filters a.active').attr('data-filter');
13247		          	  }
13248		          	  
13249		          	  $('.portfolio-filters-inline a.active').attr('data-filter');
13250			  	 	  $container.isotope({ filter: selector });
13251		          }
13252		          
13253			  	//set width
13254			  	//portfolioItemWidths();
13255			  	reLayout();
13256
13257		        if($(newElements).find('.work-item.style-5').length > 0) style6Img();
13258
13259	          	if($(newElements).find('.inner-wrap').attr('data-animation') == 'none') {
13260					$('.portfolio-items .col .inner-wrap').removeClass('animated');
13261				} else {
13262
13263					masonryZindex();
13264					$(newElements).each(function(i){
13265
13266						//not already visible
13267						var $that = $(this);
13268						var waypoint = new Waypoint({
13269			 			element: $that,
13270			 			 handler: function(direction) {
13271							
13272							var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 115;
13273						
13274							setTimeout(function(){
13275								$that.addClass("animated-in");
13276							},$portfolioAnimationDelay * $that.attr('data-delay-amount'));
13277						
13278							
13279							waypoint.destroy();
13280						},
13281						offset: $portfolioOffsetPos
13282
13283						}); //waypoint
13284
13285	
13286					}); //each
13287				}
13288
13289		       
13290		    portfolioHoverEffects();	
13291				portfolioAccentColor();
13292		         
13293		    //verify smooth scorlling
13294				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') } 
13295				
13296				
13297				
13298				//prettyphoto
13299				$('.portfolio-items').each(function(){
13300					var $unique_id = Math.floor(Math.random()*10000);
13301					$(this).find('a[rel^="prettyPhoto"], a.pretty_photo').attr('rel','prettyPhoto['+$unique_id+'_gal]').removeClass('pretty_photo');
13302				});
13303		
13304				lightBoxInit();
13305				
13306				piVertCenter();
13307
13308				setTimeout(function(){masonryZindex(); reLayout(); $( newElements ).removeClass('ajax-loaded'); },700);
13309		        
13310		        //recalc the filters
13311		        isotopeCatSelection();
13312
13313		        parallaxRowsBGCals();
13314	          
13315	          }); 
13316
13317				
13318		   });
13319
13320			//blog
13321			$('.post-area.infinite_scroll .posts-container').infinitescroll({
13322		    	navSelector  : "div#pagination",            
13323		   	    nextSelector : "div#pagination a:first",    
13324		   	    itemSelector : ".post-area .posts-container .post",
13325		   	    finishedMsg: "<em>Congratulations, you've reached the end of the internet.</em>",
13326		        msgText: " " 
13327		   },function(newElements){
13328		   	
13329		   	if($('.masonry.meta_overlaid').length == 0) { 
13330			   	//reinit js
13331			   	centerLove();
13332			   	
13333			   	//gallery
13334				$(newElements).find('.flex-gallery').each(function(){
13335					
13336					var $that = $(this);
13337					
13338					 $that.flexslider({
13339				        animation: 'fade',
13340				        smoothHeight: false, 
13341				        animationSpeed: 500,
13342				        useCSS: false, 
13343				        touch: true
13344				    });
13345					
13346					////gallery slider add arrows
13347					$('.flex-gallery .flex-direction-nav li a.flex-next').html('<i class="fa fa-angle-right"></i>');
13348					$('.flex-gallery .flex-direction-nav li a.flex-prev').html('<i class="fa fa-angle-left"></i>');
13349
13350				});
13351			   	
13352			   	
13353			   	//media players
13354			   	if($().mediaelementplayer) $(newElements).find('.wp-audio-shortcode, .wp-video-shortcode').mediaelementplayer();
13355			   	
13356			   	
13357			   	//lightbox
13358			    lightBoxInit();
13359			   	
13360			   	//carousels
13361			   	if($('.carousel').length > 0) {
13362				   	standardCarouselInit();
13363			    	clientsCarouselInit();
13364			    }
13365			   	
13366
13367			   	//milestone
13368			   	$(newElements).find('.nectar-milestone').each(function() {
13369					//symbol
13370					if($(this).has('[data-symbol]')) {
13371						if($(this).attr('data-symbol-pos') == 'before') {
13372							$(this).find('.number').prepend($(this).attr('data-symbol'));
13373						} else {
13374							$(this).find('.number').append($(this).attr('data-symbol'));
13375						}
13376					}
13377				});
13378				
13379				if(!$('body').hasClass('mobile')) {
13380					
13381					$(newElements).find('.nectar-milestone').each(function() {
13382						//animation
13383
13384							var $that = $(this);
13385							var waypoint = new Waypoint({
13386				 			element: $that,
13387				 			 handler: function(direction) {
13388								if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
13389								     waypoint.destroy();
13390								     return;
13391								}
13392
13393								var $endNum = parseInt($that.find('.number span').text());
13394
13395								var countOptions = { easingFn: easeOutCubic };
13396								var $countEle = $that.find('.number span:not(.symbol)')[0];
13397								var numAnim = new CountUp($countEle, 0, $endNum,0,2.2,countOptions);
13398								numAnim.start();
13399
13400
13401								$that.addClass('animated-in');
13402								waypoint.destroy();
13403							},
13404							offset: 'bottom-in-view'
13405
13406						}); 
13407
13408						
13409					}); 
13410				}
13411				
13412				//pie chart		
13413			    if($().vcChat) $(newElements).find('.vc_pie_chart').vcChat();
13414		    	
13415		    	//fancy ul
13416		    	nectar_fancy_ul_init();
13417		    	
13418		    	//testimonial slider
13419		    	$('.testimonial_slider').animate({'opacity':'1'},800);
13420		    	createTestimonialControls();
13421				testimonialSliderHeight(); 
13422				testimonialHeightResize();
13423		    	
13424				//bar graph
13425				$(newElements).find('.nectar-progress-bar').each(function(i){
13426				
13427
13428				var $that = $(this);
13429				var waypoint = new Waypoint({
13430		 			element: $that,
13431		 			 handler: function(direction) {
13432						if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
13433						     waypoint.destroy();
13434						     return;
13435						}
13436
13437						var percent = $that.find('span').attr('data-width');
13438						var $endNum = parseInt($that.find('span strong i').text());
13439						
13440						$that.find('span').transition({
13441							'width' : percent + '%'
13442						},1600, 'easeInOutCirc',function(){
13443						});
13444						
13445						$that.find('span strong').transition({
13446							'opacity' : 1
13447						},1350);
13448						
13449						
13450						var countOptions = { useEasing : false };
13451						var $countEle = $that.find('span strong i')[0];
13452						var numAnim = new CountUp($countEle, 0, $endNum,0,1.2,countOptions);
13453						numAnim.start();
13454
13455						
13456						////100% progress bar 
13457						if(percent == '100'){
13458							$that.find('span strong').addClass('full');
13459						}
13460
13461
13462						$that.addClass('animated-in');
13463						waypoint.destroy();
13464					},
13465					offset: 'bottom-in-view'
13466
13467				}); 
13468
13469
13470			
13471				});
13472				
13473				
13474				//columns & images with animation
13475				colAndImgAnimations();
13476				splitLineHeadings();
13477
13478				setTimeout(function(){
13479					videoshortcodeSize();
13480					responsiveVideoIframesInit();
13481					responsiveVideoIframes();
13482					$(window).trigger('resize');
13483				},500);
13484
13485
13486				parallaxRowsBGCals();
13487
13488				$(window).trigger('resize');
13489			   	
13490		   	}//non meta overlaid style 
13491		   	else {
13492		   		parallaxRowsBGCals();
13493
13494				  $(window).trigger('resize');
13495		   	}
13496
13497		   	// trigger Masonry as a callback
13498		   	var $container = $('.posts-container');
13499		    if($container.parent().hasClass('masonry')) { 
13500		    	 
13501		    	$(newElements).addClass('masonry-blog-item');
13502				$(newElements).prepend('<span class="bottom-line"></span>');
13503				
13504				//move the meta to the bottom
13505				$(newElements).each(function(){
13506					
13507					var $metaClone = $(this).find('.post-meta').clone();
13508		
13509					$(this).find('.post-meta').remove();
13510					
13511					if($('.post-area.meta_overlaid').length > 0){
13512						$(this).find('.post-header h2').after($metaClone);
13513					} else {
13514						$(this).find('.content-inner').after($metaClone);
13515					}
13516					
13517				});
13518			
13519		    	}//if masonry
13520
13521
13522		    	//loading effect   
13523		    	
13524		        //// hide new items while they are loading
13525		        var $newElems = $( newElements );
13526		        //// ensure that images load before adding to masonry layout
13527						
13528		        if($newElems.find('img').length == 0) $newElems = $('body');
13529		        
13530		        $newElems.imagesLoaded(function(){
13531							
13532							if($container.parent().hasClass('masonry')) {
13533			          $container.isotope( 'appended', $( newElements ));
13534							}
13535
13536		          flickityBlogInit();
13537
13538		          $( newElements ).addClass('ajax-loaded');
13539		          ///// show elems now they're ready
13540
13541
13542		        //classic enhanced specific 
13543		        if($container.parent().hasClass('classic_enhanced')){
13544					$container.find('.large_featured.has-post-thumbnail.ajax-loaded .post-featured-img, .wide_tall.has-post-thumbnail.ajax-loaded .post-featured-img').each(function(){
13545						var $src = $(this).find('img').attr('src');
13546						$(this).css('background-image','url('+$src+')');
13547					});
13548
13549					$container.find('.large_featured.ajax-loaded .nectar-flickity, .wide_tall.ajax-loaded .nectar-flickity').each(function(){
13550
13551						$(this).find('.cell').each(function(){
13552							var $src = $(this).find('img').attr('src');
13553							$(this).css('background-image','url('+$src+')');
13554						});
13555						
13556					});
13557				}
13558
13559
13560		          if($(newElements).parents('.posts-container').attr('data-animation') == 'none') {
13561						$( newElements ).find('.inner-wrap').removeClass('animated');
13562					} else {
13563						blogMasonryZindex();
13564						$(newElements).each(function(i){
13565
13566							var $that = $(this);
13567							var waypoint = new Waypoint({
13568
13569					 			element: $that,
13570					 			 handler: function(direction) {
13571									
13572									setTimeout(function(){
13573									    $that.addClass("animated-in");
13574									},80*$that.attr('data-delay-amount'));
13575
13576									waypoint.destroy();
13577								},
13578								offset: '90%'
13579
13580							}); 
13581
13582		
13583						}); //each
13584					}
13585
13586					setTimeout(function(){$( newElements ).removeClass('ajax-loaded'); },700);
13587
13588		        
13589		        });
13590		        
13591		    
13592		   	
13593		   });
13594		   
13595	   }
13596
13597}
13598
13599infiniteScrollInit();
13600
13601function destroyInfiniteScroll(){
13602	$('.post-area.infinite_scroll .posts-container').infinitescroll('destroy');
13603	$('.portfolio-items.infinite_scroll').infinitescroll('destroy');
13604}
13605	
13606/*-------------------------------------------------------------------------*/
13607/*	6.	Scroll to top
13608/*-------------------------------------------------------------------------*/	
13609
13610var $scrollTop = $(window).scrollTop();
13611
13612//starting bind
13613function toTopBind() {
13614	if( $('#to-top').length > 0 && $(window).width() > 1020 || $('#to-top').length > 0 &&  $('#to-top.mobile-enabled').length > 0 ) {
13615		
13616		if($scrollTop > 350){
13617			$(window).on('scroll',hideToTop);
13618		}
13619		else {
13620			$(window).on('scroll',showToTop);
13621		}
13622	}
13623}
13624
13625if($('.nectar-social-sharing-fixed').length == 0) {
13626	toTopBind();
13627} else {
13628	if($(window).width() < 1000 && $('body.single').length > 0) {
13629		if($scrollTop > 150){
13630			$(window).on('scroll',hideFixedSharing);
13631		}
13632		else {
13633			$(window).on('scroll',showFixedSharing);
13634		}
13635	}
13636
13637	$(window).smartresize(function(){
13638		if($(window).width() > 1000) { 
13639			$('.nectar-social-sharing-fixed').addClass('visible');
13640		}	
13641		else if($scrollTop < 150) { 
13642			$(window).off('scroll',hideFixedSharing);
13643			$(window).on('scroll',showFixedSharing);
13644			$('.nectar-social-sharing-fixed').removeClass('visible');	
13645		} else {
13646			$(window).off('scroll',showFixedSharing);
13647			$(window).on('scroll',hideFixedSharing);
13648		}
13649	});
13650}
13651
13652function showFixedSharing(){
13653	
13654  $scrollTop = $(window).scrollTop();
13655	if( $scrollTop > 150){
13656
13657		$('.nectar-social-sharing-fixed').addClass('visible');	
13658		
13659		$(window).off('scroll',showFixedSharing);
13660		$(window).on('scroll',hideFixedSharing);
13661	}
13662
13663}
13664
13665function hideFixedSharing(){
13666  
13667	$scrollTop = $(window).scrollTop();
13668	if( $scrollTop < 150){
13669
13670		$('.nectar-social-sharing-fixed').removeClass('visible');	
13671		
13672		$(window).off('scroll',hideFixedSharing);
13673		$(window).on('scroll',showFixedSharing);
13674	}
13675
13676}
13677
13678
13679
13680function showToTop(){
13681
13682	if( $scrollTop > 350 && $('#slide-out-widget-area.fullscreen.open').length == 0){
13683
13684		$('#to-top').stop().transition({
13685			'bottom' : '17px'
13686		},350,'easeInOutCubic');	
13687		
13688		$(window).off('scroll',showToTop);
13689		$(window).on('scroll',hideToTop);
13690	}
13691
13692}
13693
13694function hideToTop(){
13695	
13696	if( $scrollTop < 350 || $('#slide-out-widget-area.fullscreen.open').length > 0){
13697
13698		$animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350;
13699
13700		$('#to-top').stop().transition({
13701			'bottom' : '-30px'
13702		},$animationTiming,'easeInOutQuint');	
13703		
13704		$(window).off('scroll',hideToTop);
13705		$(window).on('scroll',showToTop);	
13706		
13707	}
13708}
13709
13710
13711//to top color
13712if( $('#to-top').length > 0 ) {
13713	
13714	var $windowHeight, $pageHeight, $footerHeight, $ctaHeight;
13715	
13716	function calcToTopColor(){
13717		$scrollTop = $(window).scrollTop();
13718		$windowHeight = $(window).height();
13719		$pageHeight = $('body').height();
13720		$footerHeight = $('#footer-outer').height();
13721		$ctaHeight = ($('#call-to-action').length > 0) ? $('#call-to-action').height() : 0;
13722		
13723		if( ($scrollTop-35 + $windowHeight) >= ($pageHeight - $footerHeight) && $('#boxed').length == 0){
13724			$('#to-top').addClass('dark');
13725		}
13726		
13727		else {
13728			$('#to-top').removeClass('dark');
13729		}
13730	}
13731	
13732	if(!nectarDOMInfo.usingMobileBrowser) {
13733		//calc on scroll
13734		$(window).scroll(calcToTopColor);
13735		
13736		//calc on resize
13737		$(window).resize(calcToTopColor);
13738	}
13739
13740}
13741
13742//alt style
13743if($('body[data-button-style*="rounded"]').length > 0){
13744	var $clone = $('#to-top .fa-angle-up').clone();
13745	$clone.addClass('top-icon');
13746	$('#to-top').prepend($clone)
13747}
13748
13749//scroll up event
13750$('body').on('click','#to-top, a[href="#top"]',function(){
13751	$('body,html').stop().animate({
13752		scrollTop:0
13753	},800,'easeOutQuad',function(){
13754		if($('.nectar-box-roll').length > 0) {
13755			$('body').trigger('mousewheel', [1, 0, 0]);
13756		}
13757	})
13758	return false;
13759});
13760
13761
13762/* one page scrolling */
13763function scrollSpyInit(){ 
13764
13765	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-outer').outerHeight();
13766
13767	if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; }
13768
13769	//prevent jump to rop on empty items
13770	$('header#top .sf-menu li a[href="#"]').on('click',function(e){
13771		e.preventDefault();
13772	});
13773
13774	//remove full page URLs from hash if located on same page to fix current menu class
13775	//if(location.pathname.length > 1) {
13776	
13777	  //ocm
13778		if($('#slide-out-widget-area .off-canvas-menu-container').length > 0) {
13779			$('#slide-out-widget-area .off-canvas-menu-container').find("a[href*='" + location.pathname + "']").each(function(){
13780					
13781					var $href = $(this).attr('href');
13782
13783					//regular animated anchors
13784					if($href != '#' && $href.indexOf("#") != -1 && $('div'+$href.substr($href.indexOf("#"))).length > 0 ) {
13785						$(this).attr('href',$href.substr($href.indexOf("#")));
13786						$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
13787					}
13788					
13789					//fullpage is a little different
13790					if($('div[data-fullscreen-anchor-id="'+$href.substr($href.indexOf("#")+1)+'"]').length > 0) {
13791						$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
13792					}
13793					
13794			});
13795		}
13796		
13797	  //header
13798		$("#header-outer").find("a[href*='" + location.pathname + "']").each(function(){
13799			var $href = $(this).attr('href');
13800
13801			//regular animated anchors
13802			if($href.indexOf("#") != -1 && $('div'+$href.substr($href.indexOf("#"))).length > 0 ) {
13803
13804				$(this).attr('href',$href.substr($href.indexOf("#")));
13805				$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
13806			}
13807
13808			//fullpage is a little different
13809			if($('div[data-fullscreen-anchor-id="'+$href.substr($href.indexOf("#")+1)+'"]').length > 0) {
13810				$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
13811			}
13812
13813		});
13814	//}
13815
13816	$target = ($('.page-submenu[data-sticky="true"]').length == 0) ? '#header-outer nav': '.page-submenu';
13817	$('body').scrollspy({
13818		target: $target,
13819		offset: $headerNavSpace + nectarDOMInfo.adminBarHeight + 40
13820	});
13821
13822}
13823
13824
13825/*helper function to scroll the page in an animated manner*/
13826function nectar_scrollToY(scrollTargetY, speed, easing) {
13827
13828		var scrollY = window.scrollY || document.documentElement.scrollTop,
13829				scrollTargetY = scrollTargetY || 0,
13830				speed = speed || 2000,
13831				easing = easing || 'easeOutSine',
13832				currentTime = 0;
13833
13834		var time = Math.max(.1, Math.min(Math.abs(scrollY - scrollTargetY) / speed, .8));
13835
13836
13837		var easingEquations = {
13838						easeInOutQuint: function (pos) {
13839								if ((pos /= 0.5) < 1) {
13840										return 0.5 * Math.pow(pos, 5);
13841								}
13842								return 0.5 * (Math.pow((pos - 2), 5) + 2);
13843						}
13844				};
13845
13846
13847		function tick() {
13848				currentTime += 1 / 60;
13849
13850				var p = currentTime / time;
13851				var t = easingEquations[easing](p);
13852
13853				if (p < 1) {
13854						requestAnimationFrame(tick);
13855
13856						window.scrollTo(0, scrollY + ((scrollTargetY - scrollY) * t));
13857				} else {
13858						window.scrollTo(0, scrollTargetY);
13859				}
13860		}
13861
13862		tick();
13863}
13864
13865
13866function pageLoadHash() {
13867
13868	var $hash = window.location.hash;
13869	
13870	var $hashSubstrng = ($hash && $hash.length > 0) ? $hash.substring(1,$hash.length) : 0;
13871
13872	//if hash has slashes 
13873	var $hasSlashLength = 0;
13874	if($hashSubstrng) {
13875		$hasSlashLength = $hashSubstrng.split("/");
13876		$hasSlashLength = $hasSlashLength.length;
13877	}
13878	
13879	if($hashSubstrng && $hasSlashLength > 1 ) { 
13880		$hashSubstrng = $hashSubstrng.replace(/\//g, ""); 
13881		$hash = $hash.replace(/\//g, ""); 
13882	}
13883
13884	if($hash && $('.main-content').find($hash).length > 0 || $hash && $('.main-content').find('[data-fullscreen-anchor-id="'+$hashSubstrng+'"]').length > 0) {
13885
13886		var $hashObj = ($('.main-content').find($hash).length > 0) ? $('.main-content').find($hash) : $('.main-content').find('[data-fullscreen-anchor-id="'+$hashSubstrng+'"]');
13887
13888		var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').outerHeight();
13889		if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; }
13890
13891		$timeoutVar = 0;
13892		if($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
13893			boxRoll(null,-1);
13894			$timeoutVar = 2050;
13895		} 
13896		setTimeout(function(){
13897		
13898			if( $('body[data-permanent-transparent="1"]').length == 0 ) {
13899				
13900				if(!$('body').hasClass('mobile')){
13901					$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
13902					if($('#header-outer[data-remove-fixed="1"]').length > 0) { 
13903						$headerNavSpace = 0;
13904					}
13905					var $scrollTopDistance =  $hashObj.offset().top - parseInt($headerNavSpace) +$resize + 3 - nectarDOMInfo.adminBarHeight;
13906					
13907					
13908					
13909					//condesne
13910					if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
13911						
13912							var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
13913							var $secondaryHeader = $('#header-secondary-outer');
13914							var $headerHeightStored = $('#header-outer').height();
13915							
13916							$headerHeightCondensed = $headerHeightStored - ( parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top')) );
13917						
13918							$scrollTopDistance =  $hashObj.offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight;
13919					}
13920						
13921					
13922					
13923				} else {
13924					var $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $hashObj.offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1;	
13925				}
13926
13927			} else {
13928				var $scrollTopDistance = $hashObj.offset().top - nectarDOMInfo.adminBarHeight + 1;
13929			}
13930
13931			if($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
13932				//alter offset 
13933				if($('#header-outer.detached').length == 0) 
13934					$scrollTopDistance = $scrollTopDistance + $headerNavSpace;
13935			}
13936
13937			var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0) ? $('.page-submenu').height() : 0;
13938			
13939			if($('body.material').length > 0 && 
13940				 $('#header-secondary-outer').length > 0 &&
13941				 $('body[data-hhun="1"]').length == 0 && 
13942				 $('#header-outer[data-remove-fixed="1"]').length == 0 && 
13943				 !$('body').hasClass('mobile')) { 
13944					 
13945					 var $headerSecondary = $('#header-secondary-outer').height();
13946					 
13947			 } else {
13948					 var $headerSecondary = 0;
13949			 }
13950			 
13951			nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint');
13952
13953		},$timeoutVar);
13954	}
13955}
13956
13957if($('body[data-animated-anchors="true"]').length > 0 || $('.single-product [data-gallery-style="left_thumb_sticky"]').length > 0) { 
13958
13959
13960+ function(t) {
13961    "use strict";
13962
13963    function s(e, i) {
13964        var r = t.proxy(this.process, this);
13965        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()
13966    }
13967
13968    function e(e) {
13969        return this.each(function() {
13970            var i = t(this),
13971                r = i.data("bs.scrollspy"),
13972                o = "object" == typeof e && e;
13973            r || i.data("bs.scrollspy", r = new s(this, o)), "string" == typeof e && r[e]()
13974        })
13975    }
13976    s.VERSION = "3.2.0", s.DEFAULTS = {
13977        offset: 10
13978    }, s.prototype.getScrollHeight = function() {
13979        return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
13980    }, s.prototype.refresh = function() {
13981        var s = "offset",
13982            e = 0;
13983        t.isWindow(this.$scrollElement[0]) || (s = "position", e = this.$scrollElement.scrollTop()), this.offsets = [], this.targets = [], this.scrollHeight = this.getScrollHeight();
13984        var i = this;
13985        this.$body.find(this.selector).map(function() {
13986            var i = t(this),
13987                r = i.data("target") || i.attr("href"),
13988                o = /^#./.test(r) && t(r);
13989            return o && o.length && o.is(":visible") && [
13990                [o[s]().top + e, r]
13991            ] || null
13992        }).sort(function(t, s) {
13993            return t[0] - s[0]
13994        }).each(function() {
13995            i.offsets.push(this[0]), i.targets.push(this[1])
13996        })
13997    }, s.prototype.process = function() {
13998    	var $pageSubMenu = ($('.page-submenu[data-sticky="true"]').length > 0 && $('body[data-hhun="1"]').length == 0 || $('.page-submenu[data-sticky="true"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length > 0 ) ? $('.page-submenu').height() : 0;
13999
14000        var t, s = this.$scrollElement.scrollTop() + this.options.offset + $pageSubMenu,
14001            e = this.getScrollHeight(),
14002            i = this.options.offset + e - this.$scrollElement.height() -$pageSubMenu,
14003            r = this.offsets,
14004            o = this.targets,
14005            l = this.activeTarget;
14006        if (this.scrollHeight != e && this.refresh(), s >= i) return l != (t = o[o.length - 1]) && this.activate(t);
14007        if (l && s <= r[0]) return l != (t = o[0]) && this.activate(t);
14008        for (t = r.length; t--;) l != o[t] && s >= r[t] && (!r[t + 1] || s <= r[t + 1]) && this.activate(o[t])
14009    }, s.prototype.activate = function(s) {
14010        this.activeTarget = s, t(this.selector).parentsUntil(this.options.target, ".current-menu-item").removeClass("current-menu-item").removeClass('sfHover');
14011        var e = this.selector + '[data-target="' + s + '"],' + this.selector + '[href="' + s + '"]',
14012            i = t(e).parents("li").addClass("current-menu-item");
14013        i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("current-menu-item")), i.trigger("activate.bs.scrollspy")
14014    };
14015    var i = t.fn.scrollspy;
14016    t.fn.scrollspy = e, t.fn.scrollspy.Constructor = s, t.fn.scrollspy.noConflict = function() {
14017        return t.fn.scrollspy = i, this
14018    }
14019}(jQuery);
14020
14021
14022var shrinkNum = 6;	
14023if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
14024headerPadding2 = headerPadding - headerPadding/1.8;
14025
14026setTimeout(scrollSpyInit,200);
14027
14028var $animatedScrollingTimeout;
14029
14030$('body').on('click','#header-outer nav .sf-menu a, #footer-outer .nectar-button, .container-wrap a:not(.wpb_tabs_nav a):not(.magnific):not([data-fancybox]):not(.woocommerce-tabs a):not(.testimonial-next-prev a), .swiper-slide .button a, #slide-out-widget-area a, #mobile-menu .container ul li a, #slide-out-widget-area .inner div a',function(e){
14031	
14032
14033
14034	var $hash = $(this).prop("hash");	
14035
14036	$('body').addClass('animated-scrolling');
14037	clearTimeout($animatedScrollingTimeout);
14038	$animatedScrollingTimeout = setTimeout(function(){ $('body').removeClass('animated-scrolling'); },850);
14039	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0 && $(window).width() > 1000) ? 0 : $('#header-space').outerHeight();
14040	if( $('.page-template-template-no-header-footer').length > 0 || $('.page-template-template-no-header').length > 0 ) { $headerNavSpace = 0; }
14041
14042	if($hash && $('body').find($hash).length > 0 && $hash != '#top' && $hash != '' && $(this).attr('href').indexOf(window.location.href.split("#")[0]) !== -1 || $(this).is('[href^="#"]') && $hash != '' && $('body').find($hash).length > 0 && $hash != '#top') {
14043
14044		//stop scrolling for certain elements
14045		//if($(this).parents('.tabbed').length > 0) return false;
14046		
14047		//update hash
14048		if(!$(this).hasClass('skip-hash')) {
14049			if(history.pushState) {
14050			    history.pushState(null, null, $hash);
14051			}
14052			else {
14053			    location.hash = $hash;
14054			}
14055		}
14056
14057		if($(this).parents('ul').length > 0) { 
14058			$(this).parents('ul').find('li').removeClass('current-menu-item');
14059			//$(this).parents('li').addClass('current-menu-item');
14060		}
14061
14062		//side widget area click
14063		if($(this).parents('#slide-out-widget-area').length > 0){
14064			
14065			if($('body.material[data-slide-out-widget-area-style="slide-out-from-right"].material-ocm-open').length > 0) {
14066				$('body > .slide_out_area_close').addClass('non-human-allowed').trigger('click');
14067				//scroll
14068				var $clickedLinkStore = $(this);
14069				setTimeout(function(){
14070					$clickedLinkStore.trigger('click');
14071				},1000);
14072				
14073			} else {
14074				$('#slide-out-widget-area .slide_out_area_close').addClass('non-human-allowed').trigger('click');
14075			}
14076			
14077			setTimeout(function(){
14078				if($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length > 0) {
14079					$('body > .slide_out_area_close').removeClass('non-human-allowed');
14080
14081				} else {
14082					$('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed');
14083				}
14084			},100);
14085		}
14086
14087		//mobile menu click
14088		if($(this).parents('#mobile-menu').length > 0) $('#toggle-nav').trigger('click');
14089		var $mobileMenuHeight = ($(this).parents('#mobile-menu').length > 0) ? $(this).parents('#mobile-menu').height() : null;
14090		
14091		$timeoutVar = 1;
14092		if($('.nectar-box-roll').length > 0 && $('.container-wrap.bottomBoxOut').length > 0) {
14093			boxRoll(null,-1);
14094			$timeoutVar = 2050;
14095		} 
14096
14097		var $that = $(this);
14098
14099		setTimeout(function(){
14100
14101			//scrolling
14102			var $headerSpace = ($('body[data-permanent-transparent="1"]').length > 0) ? 0 : parseInt($headerNavSpace);
14103			
14104			if( $('body[data-permanent-transparent="1"]').length == 0 ) {
14105				
14106				if(!$('body').hasClass('mobile')){
14107					$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
14108					if($('#header-outer[data-remove-fixed="1"]').length > 0) { 
14109						$headerNavSpace = 0;
14110					}
14111					
14112					var $scrollTopDistance =  $($hash).offset().top - $mobileMenuHeight - parseInt($headerNavSpace) +$resize + 3 - nectarDOMInfo.adminBarHeight;
14113					
14114					
14115					//condesne
14116					if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
14117							var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
14118							var $secondaryHeader = $('#header-secondary-outer');
14119							var $headerHeightStored = $('#header-outer').height();
14120							
14121							$headerHeightCondensed = $headerHeightStored - ( parseInt($headerSpan9.height()) + parseInt($('#header-outer #logo').css('margin-top')) );
14122						
14123							$scrollTopDistance =  $($hash).offset().top - parseInt($headerNavSpace) + $headerHeightCondensed - nectarDOMInfo.adminBarHeight;
14124					}
14125					
14126					
14127				} else {
14128					var $scrollTopDistance = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? $($hash).offset().top + 2 - $headerNavSpace + nectarDOMInfo.adminBarHeight : $($hash).offset().top - $mobileMenuHeight - nectarDOMInfo.adminBarHeight + 1;	
14129				}
14130
14131			} else {
14132				var $scrollTopDistance = $($hash).offset().top - nectarDOMInfo.adminBarHeight + 1;
14133			}
14134
14135			if($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
14136				//alter offset 
14137				if($('#header-outer.detached').length == 0 || $that.parents('.page-submenu[data-sticky="true"]').length > 0) 
14138					$scrollTopDistance = $scrollTopDistance + $headerNavSpace;
14139
14140				//hide top header
14141				if($that.parents('.page-submenu[data-sticky="true"]').length > 0) { 
14142					$('#header-outer.detached').addClass('invisible');
14143					$('.page-submenu').addClass('header-not-visible').css('transform','translateY(0px)');
14144				}
14145			} 
14146
14147			var $pageSubMenu = ($that.parents('.page-submenu[data-sticky="true"]').length > 0) ? $that.parents('.page-submenu').height() : 0;
14148			
14149			 if($('body.material').length > 0 && 
14150			 		$('#header-secondary-outer').length > 0 &&
14151			    $('body[data-hhun="1"]').length == 0 && 
14152			    $('#header-outer[data-remove-fixed="1"]').length == 0 && 
14153					!$('body').hasClass('mobile')) { 
14154						
14155						var $headerSecondary = $('#header-secondary-outer').height();
14156						
14157				} else {
14158						var $headerSecondary = 0;
14159				}
14160
14161			nectar_scrollToY($scrollTopDistance - $pageSubMenu + $headerSecondary, 700, 'easeInOutQuint');
14162			
14163
14164		},$timeoutVar);
14165		
14166
14167		e.preventDefault();
14168
14169	}
14170
14171	if($hash == '#top') {
14172		//side widget area click
14173		if($(this).parents('#slide-out-widget-area').length > 0){
14174			$('#slide-out-widget-area .slide_out_area_close').trigger('click');
14175		}
14176	}
14177
14178
14179});
14180
14181
14182
14183}
14184
14185
14186
14187
14188function searchResultMasonry() {
14189	var $searchContainer = $('#search-results');
14190	var $dividerNum = ($searchContainer.is('[data-layout="masonry-no-sidebar"]')) ? 4 : 3;
14191	
14192	$searchContainer.imagesLoaded(function(){
14193		
14194		$searchContainer.isotope({
14195			 itemSelector: '.result',
14196			 layoutMode: 'packery',
14197			 packery: { columnWidth: $('#search-results').width() / $dividerNum }
14198		});
14199		
14200		$searchContainer.find('article').css('opacity','1');
14201		
14202	});
14203				
14204
14205	$(window).resize(function(){
14206		 $searchContainer.isotope({
14207				layoutMode: 'packery',
14208				packery: { columnWidth: $('#search-results').width() / $dividerNum }
14209		 });
14210	});
14211	
14212}
14213
14214if($('body.search-results').length > 0 && $('#search-results article').length > 0 && $('#search-results[data-layout="list-no-sidebar"]').length == 0) { searchResultMasonry(); }
14215
14216
14217
14218	//portfolio colors
14219	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 ) {
14220		var portfolioColorCss = '';
14221		$('.portfolio-items .col').each(function(){
14222			$titleColor = $(this).attr('data-title-color');
14223			$subTitleColor = $(this).attr('data-subtitle-color');
14224
14225			 if($titleColor.length > 0 ) { 
14226			 	portfolioColorCss += '.col[data-title-color="'+$titleColor+'"] .vert-center h3, .portfolio-items[data-ps="6"] .col[data-title-color="'+$titleColor+'"] .work-meta h4 { color: '+$titleColor+'!important; } ';
14227			 	portfolioColorCss += ' .portfolio-items[data-ps="8"] .col[data-title-color="'+$titleColor+'"] .line { background-color: '+$titleColor+'; }';
14228			 	portfolioColorCss += '.portfolio-items[data-ps="8"] .col[data-title-color="'+$titleColor+'"] .next-arrow line { stroke: '+$titleColor+'; } ';
14229			 }
14230			 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+'; } ';
14231	
14232		});
14233
14234
14235		var head = document.head || document.getElementsByTagName('head')[0];
14236		var style = document.createElement('style');
14237
14238			style.type = 'text/css';
14239		if (style.styleSheet){
14240		  style.styleSheet.cssText = portfolioColorCss;
14241		} else {
14242		  style.appendChild(document.createTextNode(portfolioColorCss));
14243		}
14244
14245		head.appendChild(style);
14246	}
14247
14248	//bottom controls 2
14249	$('body').on('mouseleave','.container-wrap[data-nav-pos="after_project_2"] #portfolio-nav ul li, .blog_next_prev_buttons[data-style="fullwidth_next_prev"] ul li',function(){
14250		$(this).addClass('mouse-leaving');
14251	});	
14252
14253	// masonryPortfolio
14254
14255	var $portfolio_containers = [];
14256
14257	$('.portfolio-items:not(.carousel)').each(function(i){
14258		$portfolio_containers[i] = $(this);
14259	});
14260
14261	function masonryPortfolioInit() {
14262
14263		$portfolio_containers = [];
14264		$('.portfolio-items:not(.carousel)').each(function(i){
14265			$portfolio_containers[i] = $(this);
14266		});
14267
14268		//// cache window
14269		var $window = jQuery(window);	
14270		
14271			
14272			$.each($portfolio_containers,function(i){
14273
14274				
14275				//// start up isotope with default settings
14276				$portfolio_containers[i].imagesLoaded(function(){
14277					
14278					//verify smooth scorlling
14279					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') } 
14280					
14281					//transformns enabled logic
14282					var $isoUseTransforms = true;
14283					
14284					//Panr 
14285					if(!$('body').hasClass('mobile') && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|BlackBerry|IEMobile|Opera Mini)/)) {
14286
14287						$isoUseTransforms = true;
14288						
14289					}
14290
14291					piVertCenter();
14292
14293					//initial call to setup isotope
14294					var $layoutMode = ( $portfolio_containers[i].hasClass('masonry-items')) ? 'packery' : 'fitRows';
14295					var $startingFilter = ($portfolio_containers[i].attr('data-starting-filter') != '' && $portfolio_containers[i].attr('data-starting-filter') != 'default') ? '.' + $portfolio_containers[i].attr('data-starting-filter') : '*';
14296
14297					reLayout();
14298					
14299					$portfolio_containers[i].addClass('isotope-activated');
14300					
14301					$portfolio_containers[i].isotope({
14302					  itemSelector : '.element',
14303					  filter: $startingFilter,
14304					  layoutMode: $layoutMode,
14305					  transitionDuration: '0.6s',
14306					  packery: {
14307						 gutter: 0
14308					  }
14309					}).isotope( 'layout' );
14310					
14311					
14312					if($startingFilter != '*'){
14313						$('.portfolio-filters ul a[data-filter="'+$startingFilter+'"], .portfolio-filters-inline ul a[data-filter="'+$startingFilter+'"]').click();
14314					}
14315
14316					//call the reLayout to get things rollin'
14317					masonryZindex();
14318					setTimeout(function(){masonryZindex(); },800);
14319					
14320				
14321					
14322					//inside fwc fix
14323					if($portfolio_containers[i].parents('.full-width-content').length > 0) { setTimeout(function(){ fullWidthContentColumns(); },200);  }
14324
14325					//fadeout the loading animation
14326					$('.portfolio-loading').stop(true,true).fadeOut(200);
14327					
14328					//fadeIn items one by one
14329					if($portfolio_containers[i].find('.inner-wrap').attr('data-animation') == 'none') {
14330						$portfolio_containers[i].find('.inner-wrap').removeClass('animated');
14331					} else {
14332
14333						//portfolioLoadIn(); moved to waypoints
14334					}
14335
14336			
14337				});
14338				
14339
14340
14341			});//each
14342			
14343			if($portfolio_containers.length > 0) {
14344				$window.resize( reLayout );
14345
14346				$window.smartresize( function(){
14347					setTimeout(masonryZindex,700);
14348				});
14349			}
14350			
14351		
14352
14353	}
14354
14355	masonryPortfolioInit();
14356
14357	function portfolioLoadIn() {
14358
14359		$($fullscreenSelector+'.portfolio-items').each(function(){
14360
14361			$portfolioOffsetPos = ($('#nectar_fullscreen_rows').length > 0) ? '200%' : '90%';
14362
14363			if($(this).find('.inner-wrap').attr('data-animation') == 'none') return;
14364		
14365			$(this).find('.col').each(function(i){
14366
14367				var $that = $(this);
14368
14369				//loaded visible
14370				if($(this).visible(true) || $(this).parents('#nectar_fullscreen_rows').length > 0) {
14371
14372					var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 90 : 115;
14373					$(this).delay($portfolioAnimationDelay *i).queue(function(next){
14374					    $(this).addClass("animated-in");
14375					    next();
14376					});
14377
14378				} else {
14379
14380					//not already visible
14381					var waypoint = new Waypoint({
14382		 			element: $that,
14383		 			 handler: function(direction) {
14384						
14385						if($that.parents('.wpb_tab').length > 0 && $that.parents('.wpb_tab').css('visibility') == 'hidden' || $that.hasClass('animated-in')) { 
14386						     waypoint.destroy();
14387						     return;
14388						}
14389
14390						var $portfolioAnimationDelay = ($that.is('[data-masonry-type="photography"].masonry-items')) ? 85 : 100;
14391					
14392						setTimeout(function(){
14393							$that.addClass("animated-in");
14394						},$portfolioAnimationDelay * $that.attr('data-delay-amount'));
14395					
14396						
14397						waypoint.destroy();
14398					},
14399					offset: $portfolioOffsetPos
14400
14401					}); //waypoint
14402				}
14403
14404			}); //each
14405		}); //each
14406					
14407	}
14408
14409
14410	//perspective load in
14411	if($('.portfolio-items .inner-wrap[data-animation="perspective"]').length > 0 || $('.posts-container[data-load-animation="perspective"]').length > 0) {
14412
14413		var lastScrollTop = $(window).scrollTop();
14414
14415		$('.portfolio-items, .posts-container[data-load-animation="perspective"]').css('perspective-origin','50% '+ (lastScrollTop + $(window).height()) + 'px');
14416
14417		requestAnimationFrame(updatePerspectiveOrigin);
14418		
14419		function updatePerspectiveOrigin() {
14420
14421			var scrollTop = $(window).scrollTop();
14422
14423			if (lastScrollTop === scrollTop) {
14424				requestAnimationFrame(updatePerspectiveOrigin);
14425				return;
14426			} else {
14427				lastScrollTop = scrollTop;
14428				$('.portfolio-items,.posts-container[data-load-animation="perspective"]').css('perspective-origin','50% '+ (lastScrollTop + $(window).height()) + 'px');
14429				requestAnimationFrame(updatePerspectiveOrigin);
14430			}
14431		}
14432
14433	}
14434
14435	var mediaQuerySize;
14436	function reLayout() {
14437
14438		clearTimeout(clearIsoAnimation);
14439	    $('.portfolio-items .col').addClass('no-transition');
14440	    clearIsoAnimation = setTimeout(function(){  $('.portfolio-items .col').removeClass('no-transition'); },700); 
14441
14442		var windowSize = $window.width();
14443		var masonryObj;
14444		var masonryObjHolder = [];
14445
14446		//remove double quotes for FF
14447		//if (navigator.userAgent.match('MSIE 8') == null) {
14448		//	mediaQuerySize = mediaQuerySize.replace(/"/g, '');
14449		//}
14450		
14451		//user defined cols
14452		var userDefinedColWidth;
14453
14454		$.each($portfolio_containers,function(i,v){
14455
14456			if( $portfolio_containers[i].attr('data-user-defined-cols') == 'span4') {
14457				userDefinedColWidth = 3
14458			} 
14459			
14460			else if( $portfolio_containers[i].attr('data-user-defined-cols') == 'span3') {
14461				userDefinedColWidth = 4
14462			} 
14463			
14464			var isFullWidth = $portfolio_containers[i].attr('data-col-num') == 'elastic';
14465			
14466			
14467			//chrome 33 approved method for getting column sizing
14468			if(window.innerWidth > 1600){
14469				
14470				if($portfolio_containers[i].hasClass('fullwidth-constrained')) {
14471					if($portfolio_containers[i].is('[data-masonry-type="photography"]')) {
14472						mediaQuerySize = 'three';
14473					} else {
14474						mediaQuerySize = 'four';
14475					}
14476	
14477				} else {
14478					if($portfolio_containers[i].hasClass('constrain-max-cols')) {
14479						mediaQuerySize = 'four';
14480					} else {
14481						mediaQuerySize = 'five';
14482					}
14483				}
14484				
14485			} else if(window.innerWidth <= 1600 && window.innerWidth > 1300){
14486
14487				if($portfolio_containers[i].hasClass('fullwidth-constrained')) {
14488					if($portfolio_containers[i].is('[data-masonry-type="photography"]')) {
14489						mediaQuerySize = 'three';
14490					} else {
14491						mediaQuerySize = 'four';
14492					}
14493				} else {
14494					mediaQuerySize = 'four';
14495				}
14496			} else if(window.innerWidth <= 1300 && window.innerWidth > 990){
14497				
14498				if($portfolio_containers[i].hasClass('constrain-max-cols')) {
14499					mediaQuerySize = 'four';
14500				} else {
14501					mediaQuerySize = 'three';
14502				}
14503				
14504			} else if(window.innerWidth <= 990 && window.innerWidth > 470){
14505				mediaQuerySize = 'two';
14506			} else if(window.innerWidth <= 470){
14507				mediaQuerySize = 'one';
14508			}
14509			
14510			//boxed
14511			if($('#boxed').length > 0) {
14512				if(window.innerWidth > 1300){
14513					mediaQuerySize = 'four';
14514				} else if(window.innerWidth < 1300 && window.innerWidth > 990){
14515					
14516					if($portfolio_containers[i].hasClass('constrain-max-cols')) {
14517						mediaQuerySize = 'four';
14518					} else {
14519						mediaQuerySize = 'three';
14520					}
14521
14522				} else if(window.innerWidth < 990){
14523					mediaQuerySize = 'one';
14524				}
14525				
14526			}
14527			
14528			//change masonry columns depending on screen size
14529			switch (mediaQuerySize) {
14530				case 'five':
14531					(isFullWidth) ? colWidth = 5 : colWidth = userDefinedColWidth;
14532					//change cols for photography
14533					if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]')) colWidth = 6;
14534
14535					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
14536				break;
14537				
14538				case 'four':
14539					(isFullWidth) ? colWidth = 4 : colWidth = userDefinedColWidth;
14540					//change cols for photography
14541					if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]')) colWidth = 5;
14542
14543					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
14544				break;
14545				
14546				case 'three':
14547					(isFullWidth) ? colWidth = 3 : colWidth = userDefinedColWidth;
14548					//change cols for photography
14549					if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]')) colWidth = 4;
14550					
14551					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / parseInt(colWidth)) };
14552				break;
14553				
14554				case 'two':
14555					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / 2) };
14556				break;
14557				
14558				case 'one':
14559					masonryObj = { columnWidth: Math.floor($portfolio_containers[i].width() / 1) };
14560				break;
14561			}
14562
14563
14564			 //set widths
14565			 portfolioItemWidths(i,v);
14566			
14567
14568			//sizing for large items
14569			if( $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="regular"]:visible').length > 0 || $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="wide"]:visible').length > 0 || $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="tall"]:visible').length > 0 || $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="wide_tall"]:visible').length > 0) {
14570
14571				var $gutterSize = ($portfolio_containers[i].is('[data-gutter*="px"]') && $portfolio_containers[i].attr('data-gutter').length > 0 && $portfolio_containers[i].attr('data-gutter') != 'none') ? parseInt($portfolio_containers[i].attr('data-gutter')) : 0;
14572				var multipler = (window.innerWidth > 470) ? 2 : 1;
14573
14574				//reset height for calcs
14575				$itemClassForSizing = 'regular';
14576
14577				if($portfolio_containers[i].find('.col.elastic-portfolio-item[class*="regular"]:visible').length == 0 && $portfolio_containers[i].find('.col.elastic-portfolio-item.wide:visible').length > 0) {
14578					$itemClassForSizing = 'wide';
14579				} else if($portfolio_containers[i].find('.col.elastic-portfolio-item[class*="regular"]:visible').length == 0 && $portfolio_containers[i].find('.col.elastic-portfolio-item.wide_tall:visible').length > 0) {
14580					$itemClassForSizing = 'wide_tall';
14581					multipler = 1;
14582				} else if($portfolio_containers[i].find('.col.elastic-portfolio-item[class*="regular"]:visible').length == 0 && $portfolio_containers[i].find('.col.elastic-portfolio-item.tall:visible').length > 0) {
14583					$itemClassForSizing = 'tall';
14584					multipler = 1;
14585				}
14586
14587			    $portfolio_containers[i].find('.col.elastic-portfolio-item.'+$itemClassForSizing+' img').css('height','auto');
14588
14589				var tallColHeight = $portfolio_containers[i].find('.col.elastic-portfolio-item.'+$itemClassForSizing+':visible img').height();
14590				
14591				 $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');
14592				 $portfolio_containers[i].find('.col.elastic-portfolio-item[class*="tall"] img:not(.custom-thumbnail)').css('height',(tallColHeight*multipler) + ($gutterSize*2));
14593
14594				 if($itemClassForSizing == 'regular' || $itemClassForSizing == 'wide') {
14595				 	$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);
14596				 } else {
14597				 	$portfolio_containers[i].find('.col.elastic-portfolio-item.wide img:not(.custom-thumbnail), .col.elastic-portfolio-item.regular img:not(.custom-thumbnail)').css('height',(tallColHeight/2) - ($gutterSize*2));
14598				 }
14599
14600				 $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 );
14601				 
14602				 if($itemClassForSizing == 'regular' || $itemClassForSizing == 'wide') {
14603					 $portfolio_containers[i].find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',tallColHeight);
14604				} else {
14605				 	 $portfolio_containers[i].find('.col.elastic-portfolio-item.regular .parallaxImg, .col.elastic-portfolio-item.wide .parallaxImg').css('height',(tallColHeight/2) - ($gutterSize*2));
14606				 }
14607
14608			} else {
14609				$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');
14610			}
14611
14612			//non masonry
14613			if($portfolio_containers[i].hasClass('no-masonry') && $portfolio_containers[i].find('.col:first:visible').length > 0 && $portfolio_containers[i].parents('.wpb_gallery').length == 0){
14614			  
14615				//skip style 9
14616				if( !$portfolio_containers[i].is('[data-ps="9"]') ) {
14617
14618				   	//reset height for calcs
14619			   	   $portfolio_containers[i].find('.col img').css('height','auto');
14620			   	   var tallColHeight = $portfolio_containers[i].find('.col:first:visible img').height();
14621			   	   $portfolio_containers[i].find('.col img:not(.custom-thumbnail)').css('height',tallColHeight);
14622			   	   $portfolio_containers[i].find('.col .parallaxImg').css('height',tallColHeight);
14623				 }
14624				 
14625			}
14626	
14627
14628
14629			masonryObjHolder[i] = masonryObj;
14630			
14631			if($portfolio_containers[i].isotope()) $portfolio_containers[i].isotope( 'layout' ); 
14632				
14633			
14634
14635		}); //each
14636	
14637	}
14638
14639	function portfolioItemWidths(i,v) {
14640		// passing each index value where function is called first to avoid nested loops
14641		// $.each($portfolio_containers,function(i,v){
14642		 		var isFullWidth = $portfolio_containers[i].attr('data-col-num') == 'elastic';
14643
14644		 		if(isFullWidth) { 
14645
14646				 	var $colSize = 4;
14647				 	var $mult = (mediaQuerySize == 'one') ? 1 : 2;
14648				 	if(mediaQuerySize == 'five') $colSize = 5;
14649				 	if(mediaQuerySize == 'four') $colSize = 4;
14650				 	if(mediaQuerySize == 'three') $colSize = 3;
14651				 	if(mediaQuerySize == 'two') $colSize = 2;
14652				 	if(mediaQuerySize == 'one') $colSize = 1;
14653				 	if($(v).is('[data-ps="6"]') && $colSize == 5) $colSize = 4;
14654
14655				 	//photography
14656				 	if(isFullWidth && $portfolio_containers[i].is('[data-masonry-type="photography"]') && !$portfolio_containers[i].hasClass('no-masonry')) {
14657				 		if(mediaQuerySize == 'five') $colSize = 6;
14658				 		if(mediaQuerySize == 'four') $colSize = 5;
14659				 		if(mediaQuerySize == 'three') $colSize = 4;
14660				 	}
14661				 	
14662				 	if($(v).width() % $colSize == 0) {
14663					 	$(v).find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',Math.floor($(v).width()/$colSize) +'px');
14664					 	$(v).find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',Math.floor($(v).width()/$colSize*$mult) +'px');
14665					 } else {
14666					 	var $loopEndNum = ($(window).width() > 1000) ? 6 : 3;
14667					 	if($portfolio_containers[i].hasClass('fullwidth-constrained') && $(window).width() > 1000) $loopEndNum = 4;
14668					 	//find closest number to give 0
14669					 	for(var i = 1; i<$loopEndNum; i++) {
14670
14671					 		if(($(v).width() - i) % $colSize == 0) {
14672					 			$(v).find('.elastic-portfolio-item:not(.wide):not(.wide_tall)').css('width',($(v).width()- i)/$colSize +'px');
14673					 			$(v).find('.elastic-portfolio-item.wide, .elastic-portfolio-item.wide_tall').css('width',($(v).width()-i)/$colSize*$mult +'px');
14674					 		}
14675
14676					 	}
14677					 }
14678
14679				} // isFullWidth
14680
14681		 	
14682		// });
14683	}
14684
14685	//z-index for masonry
14686	function masonryZindex(){
14687
14688		//escape if no browser support
14689		if($('body .portfolio-items:not(".carousel") > .col').length > 0 && $('body .portfolio-items:not(".carousel") > .col').offset().left) {
14690
14691			$('body .portfolio-items:not(".carousel")').each(function(){
14692
14693				var $coords = {};
14694				var $zindexRelation = {};
14695				var $that = $(this);
14696
14697				$(this).find('> .col').each(function(){
14698					var $itemOffset = $(this).offset();
14699					$itemOffset = $itemOffset.left;
14700
14701					$coords[$(this).index()] = $itemOffset;
14702					$(this).css('z-index',Math.abs(Math.floor($(this).offset().left/20)));
14703				});
14704
14705				var $corrdsArr = $.map($coords, function (value) { return value; });
14706
14707				$corrdsArr = removeDuplicates($corrdsArr);
14708				$corrdsArr.sort(function(a,b){return a-b});
14709
14710				for(var i = 0; i < $corrdsArr.length; i++){
14711					$zindexRelation[$corrdsArr[i]] = i; 
14712				}
14713		
14714				$.each($coords,function(k,v){
14715					
14716					var $zindex;
14717					var $coordCache = v;
14718					$.each($zindexRelation,function(k,v){
14719						if($coordCache == k) {
14720							$zindex = v;
14721						}
14722					});
14723				
14724					$that.find('> .col:eq('+k+')').attr('data-delay-amount',$zindex);
14725				});
14726
14727				
14728			});
14729			
14730			
14731			
14732		}
14733
14734
14735	}
14736
14737	function blogMasonryZindex(){
14738	
14739		//escape if no browser support
14740		if($('body .post-area .masonry-blog-item').length > 0 && $('body .post-area .masonry-blog-item').offset().left) {
14741		
14742			$('body .post-area.masonry').each(function(){
14743				
14744				var $coords = {};
14745				var $zindexRelation = {};
14746				var $that = $(this);
14747
14748				$(this).find('.masonry-blog-item').each(function(){
14749					var $itemOffset = $(this).offset();
14750					$itemOffset = $itemOffset.left;
14751
14752					$coords[$(this).index()] = $itemOffset;
14753					$(this).css('z-index',Math.abs(Math.floor($(this).offset().left/20)));
14754				});
14755
14756				var $corrdsArr = $.map($coords, function (value) { return value; });
14757
14758				$corrdsArr = removeDuplicates($corrdsArr);
14759				$corrdsArr.sort(function(a,b){return a-b});
14760		
14761				for(var i = 0; i < $corrdsArr.length; i++){
14762					$zindexRelation[$corrdsArr[i]] = i*1; 
14763				}
14764		
14765				$.each($coords,function(k,v){
14766					
14767					var $zindex;
14768					var $coordCache = v;
14769					$.each($zindexRelation,function(k,v){
14770						if($coordCache == k) {
14771							$zindex = v;
14772						}
14773					});
14774		
14775					$that.find('.masonry-blog-item:eq('+k+')').css('z-index',$zindex).attr('data-delay-amount',$zindex);
14776					
14777				});
14778			
14779			});
14780			
14781		}
14782		
14783	}
14784	
14785	function matrixToArray(matrix) {
14786	    return matrix.substr(7, matrix.length - 8).split(', ');
14787	}
14788	
14789	function removeDuplicates(inputArray) {
14790        var i;
14791        var len = inputArray.length;
14792        var outputArray = [];
14793        var temp = {};
14794
14795        for (i = 0; i < len; i++) {
14796            temp[inputArray[i]] = 0;
14797        }
14798        for (i in temp) {
14799            outputArray.push(i);
14800        }
14801        return outputArray;
14802    }
14803
14804    //// filter items when filter link is clicked
14805	var clearIsoAnimation = null;
14806	var $checkForScrollBar = null;
14807
14808
14809	//number portfolios so multiple sortable ones can work easily on same page
14810	$('.portfolio-items:not(".carousel")').each(function(i){
14811		$(this).attr('instance',i);
14812		$(this).parent().parent().find('div[class^=portfolio-filters]').attr('instance',i);
14813	});
14814
14815    function isoClickFilter(){
14816		 var $timeout;		 
14817		 if(window.innerWidth > 690 && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
14818		 	
14819			  
14820			 clearTimeout($timeout);
14821			 $timeout = setTimeout(function(){masonryZindex();  },600);
14822
14823			  
14824		 }
14825		  
14826		  var selector = $(this).attr('data-filter');
14827		  var $instance = $(this).parents('div[class^=portfolio-filters]').attr('instance');
14828
14829		  $.each($portfolio_containers,function(i){
14830		  	if($portfolio_containers[i].attr('instance') == $instance) { 
14831		  		$portfolio_containers[i].isotope({ filter: selector }).attr('data-current-cat',selector);
14832
14833		  		//fade in all incase user hasn't scrolled down yet
14834		  		if($portfolio_containers[i].find('.inner-wrap[data-animation="none"]').length == 0) {
14835			   		$portfolio_containers[i].find('.col').addClass('animated-in');
14836				}
14837		  	}
14838		  });
14839
14840
14841
14842
14843		  //active classes
14844		  $(this).parent().parent().find('li a').removeClass('active');
14845		  $(this).addClass('active');
14846		  
14847		  //update pp
14848		  if($('.portfolio-items a[rel^="prettyPhoto"]').length > 0) {
14849		  	setTimeout(updatePrettyPhotoGallery,170);
14850		  }
14851
14852		  else {
14853		  	setTimeout(updateMagPrettyPhotoGallery,170);
14854		  }
14855
14856		  return false;
14857	}
14858
14859	////filter event
14860	$('body').on('click','.portfolio-filters ul li a, .portfolio-filters-inline ul li a', isoClickFilter);
14861
14862
14863	function updatePrettyPhotoGallery(){
14864		$('.portfolio-items').each(function(){
14865
14866			if($(this).find('a[rel^="prettyPhoto"]').length > 0) {
14867
14868			var $unique_id = Math.floor(Math.random()*10000);
14869			var $currentCat = $(this).attr('data-current-cat');
14870			$(this).find('.col'+$currentCat).find('a[rel^="prettyPhoto"]').attr('rel','prettyPhoto['+$unique_id+'_sorted]');
14871			
14872			} 
14873			
14874		});
14875	}
14876
14877	function updateMagPrettyPhotoGallery(){
14878		$('.portfolio-items').each(function(){
14879
14880			var $currentCat = $(this).attr('data-current-cat');
14881			var $unique_id = Math.floor(Math.random()*10000);
14882			
14883			if($(this).is('[data-lightbox-only="true"]')){
14884				
14885					$(this).find('.col').each(function(){
14886		
14887						$(this).find('a.gallery').removeClass('gallery').removeClass('magnific');
14888						
14889						if($(this).is($currentCat)) {
14890							
14891							//parallax styles
14892							if($(this).find('.parallaxImg-wrap').length > 0) {
14893								
14894									if($('body[data-ls="fancybox"]').length > 0) {
14895										$(this).find('.work-item > a').attr('data-fancybox','group_'+$unique_id);
14896									} else {
14897										$(this).find('.work-item > a').addClass('gallery').addClass('magnific');
14898									}
14899									
14900							} else {
14901								//others
14902								
14903									if($('body[data-ls="fancybox"]').length > 0) {
14904										$(this).find('.work-item a').attr('data-fancybox','group_'+$unique_id);
14905									} else {
14906										$(this).find('.work-info a').addClass('gallery').addClass('magnific');
14907									}
14908									
14909							}
14910							
14911						}
14912		
14913					});
14914				
14915			}
14916			
14917			else if ($(this).find('.work-item.style-1').length > 0){
14918				
14919					$(this).find('.col').each(function(){
14920		
14921						$(this).find('a.gallery').removeClass('gallery').removeClass('magnific');
14922						
14923						if($(this).is($currentCat)) {
14924							
14925								if($('body[data-ls="fancybox"]').length > 0) {
14926									$(this).find('.work-info .vert-center a:first-of-type').attr('data-fancybox','group_'+$unique_id);
14927								} 
14928								else {
14929									$(this).find('.work-info .vert-center a:first-of-type').addClass('gallery').addClass('magnific');
14930								}
14931								
14932						}
14933		
14934					});
14935			}
14936			
14937		
14938			
14939		});
14940	}
14941
14942
14943
14944	$blog_containers = [];
14945
14946	$('.posts-container').each(function(i){
14947		$blog_containers[i] = $(this);
14948	});
14949
14950  function masonryBlogInit() {
14951
14952		//// cache window
14953		var $window = jQuery(window);	
14954		
14955			
14956		$.each($blog_containers,function(i){
14957
14958			
14959				if($blog_containers[i].parent().hasClass('masonry') && !$blog_containers[i].parent().hasClass('auto_meta_overlaid_spaced')) { 
14960					
14961					$blog_containers[i].find('article').addClass('masonry-blog-item');
14962					
14963					if($blog_containers[i].parents('.masonry.classic').length > 0) {
14964						$blog_containers[i].find('article').prepend('<span class="bottom-line"></span>');
14965					}
14966					
14967					//move the meta to the bottom
14968					$blog_containers[i].find('article').each(function(){
14969						
14970						var $metaClone = $(this).find('.post-meta').clone();
14971
14972						$(this).find('.post-meta').remove();
14973
14974						if($blog_containers[i].parents('.post-area.meta_overlaid').length > 0){
14975							$(this).find('.post-header h2').after($metaClone);
14976						} else {
14977							$(this).find('.content-inner').after($metaClone);
14978						}
14979						
14980						$blog_containers[i].addClass('meta-moved');
14981						
14982					});
14983				
14984					
14985					if($blog_containers[i].parent().hasClass('masonry') && $blog_containers[i].parents('.blog-fullwidth-wrap').length > 0){
14986						//$blog_containers[i].parent().wrap('<div class="full-width-content blog-fullwidth-wrap"> </div>').removeClass('full-width-content').css({'margin-left':'0','width':'auto'});
14987						
14988						//page header animation fix
14989						if( $blog_containers[i].parents('.wpb_row').length > 0 ) $blog_containers[i].parents('.wpb_row').css('z-index',100);
14990
14991						if(!$blog_containers[i].parent().hasClass('meta_overlaid') && !$blog_containers[i].parent().hasClass('auto_meta_overlaid_spaced')) {
14992
14993							if($blog_containers[i].parent().hasClass('classic_enhanced')) {
14994								$blog_containers[i].parent().parents('.full-width-content').css({
14995									'padding' : '0px 0.2% 0px 2.4%'
14996								});
14997							} else {
14998								$blog_containers[i].parent().parents('.full-width-content').css({
14999									'padding' : '0px 0.2% 0px 3.2%'
15000								});
15001							}
15002							
15003						} else {
15004							$blog_containers[i].parent().parents('.full-width-content').addClass('meta-overlaid');
15005							$('.container-wrap').addClass('meta_overlaid_blog');
15006						}
15007
15008						fullWidthSections(); 
15009					}
15010					
15011					var $cols = 3;
15012					var $element = $blog_containers[i];
15013					
15014					if($blog_containers[i].find('img').length == 0) $element = $('<img />');
15015					
15016					imagesLoaded($element,function(instance){
15017						
15018						if($('body').hasClass('mobile') || $blog_containers[i].parents('.post-area').hasClass('span_9')) {
15019							$cols = 2;
15020						}
15021
15022						//set img as BG if masonry classic enhanced
15023						if($blog_containers[i].parent().hasClass('classic_enhanced')){
15024							$blog_containers[i].find('.large_featured.has-post-thumbnail .post-featured-img, .wide_tall.has-post-thumbnail .post-featured-img').each(function(){
15025								var $src = $(this).find('img').attr('src');
15026								$(this).css('background-image','url('+$src+')');
15027							});
15028
15029							$blog_containers[i].find('.large_featured .nectar-flickity, .wide_tall .nectar-flickity').each(function(){
15030
15031								$(this).find('.cell').each(function(){
15032									var $src = $(this).find('img').attr('src');
15033									$(this).css('background-image','url('+$src+')');
15034								});
15035								
15036							});
15037						}
15038
15039						$cols = blogColumnNumbCalcs($blog_containers[i]);
15040						blogHeightCalcs($blog_containers[i], $cols);
15041
15042						if($blog_containers[i].parents('.post-area.meta_overlaid').length > 0) {
15043							$blog_containers[i].isotope({
15044							   itemSelector: 'article',
15045							   transitionDuration: '0s',
15046							   layoutMode: 'packery',
15047							   packery: { 
15048							   	 gutter: 0
15049							   	}
15050							}).isotope( 'layout' );
15051
15052						   
15053						} else if ($blog_containers[i].parents('.auto_meta_overlaid_spaced').length > 0) {
15054							
15055							$multiplier = .025;
15056							if($blog_containers[i].parents('.blog-fullwidth-wrap').length > 0) {
15057									$multiplier = .02;
15058							}
15059							
15060							$blog_containers[i].isotope({
15061								layoutMode: 'packery',
15062								transitionDuration: '0s',
15063								packery: {
15064									 /* gutter: $blog_containers[i].parents('.post-area').width() * $multiplier */
15065									 gutter: 0
15066								}
15067						 });
15068						 
15069						}  else {
15070						   if($blog_containers[i].parent().hasClass('classic_enhanced')) {
15071							   	if($blog_containers[i].parents('.span_9.masonry').length == 0) {
15072							   		$multiplier = (window.innerWidth >= 1600) ? .015 : .02;
15073							   	} else {
15074							   		$multiplier = .04;
15075							    } 
15076						    }
15077							else {
15078 								 		$multiplier = ($blog_containers[i].parents('.span_9.masonry').length == 0) ? .03: .055;
15079 							 }
15080						   
15081							$blog_containers[i].isotope({
15082							   itemSelector: 'article',
15083							   transitionDuration: '0s',
15084							   layoutMode: 'packery',
15085							   packery: { 
15086							   	 gutter: $blog_containers[i].parents('.post-area').width()*$multiplier
15087							   	}
15088							}).isotope( 'layout' );
15089						}
15090
15091						blogLoadIn($blog_containers[i]);
15092						flickityBlogInit();
15093						
15094						$(window).trigger('resize');
15095
15096							
15097					});
15098					
15099					$(window).resize(function(){
15100						
15101
15102					   //size all items in grid 
15103					   //sizing for large items
15104						 if(typeof $blog_containers[i] !== 'undefined') { 
15105							 
15106							  $cols = blogColumnNumbCalcs($blog_containers[i]);
15107								blogHeightCalcs($blog_containers[i], $cols);
15108								
15109								if($blog_containers[i].parents('.post-area.meta_overlaid').length > 0) {
15110								
15111								    $blog_containers[i].isotope({
15112								      layoutMode: 'packery',
15113								      packery: {
15114								      	 gutter: 0
15115								      }
15116								   });
15117								} else if ($blog_containers[i].parents('.auto_meta_overlaid_spaced').length > 0) {
15118									
15119									$multiplier = .025;
15120									if($blog_containers[i].parents('.blog-fullwidth-wrap').length > 0) {
15121											$multiplier = .02;
15122									}
15123									
15124									$blog_containers[i].isotope({
15125										layoutMode: 'packery',
15126										transitionDuration: '0s',
15127										packery: {
15128											/*
15129											 gutter: $blog_containers[i].parents('.post-area').width() * $multiplier
15130											 */
15131											 gutter: 0
15132										}
15133								 });
15134								} else {
15135								   
15136								   if($blog_containers[i].parent().hasClass('classic_enhanced')) {
15137								   		if($blog_containers[i].parents('.span_9.masonry').length == 0) {
15138									   		$multiplier = (window.innerWidth >= 1600) ? .015 : .02;
15139									   	} else {
15140									   		$multiplier = .04;
15141									    } 
15142								   } else {
15143										 		$multiplier = ($blog_containers[i].parents('.span_9.masonry').length == 0) ? .03: .055;
15144												if($blog_containers[i].parents('.blog-fullwidth-wrap').length > 0) {
15145														$multiplier = .02;
15146												}
15147									 } 
15148								  
15149								   $blog_containers[i].isotope({
15150								   	layoutMode: 'packery',
15151								      packery: { 
15152								      	gutter: $blog_containers[i].parents('.post-area').width()*$multiplier
15153								      }
15154								   });
15155								}
15156								
15157							} // if $blog_containers[i]
15158
15159					});
15160					
15161					
15162			    } else {
15163			    	blogLoadIn($blog_containers[i]);
15164			    }
15165
15166		});
15167		
15168		//set z-index / animation order only once
15169		setTimeout(blogMasonryZindex,700);
15170		$window.smartresize( function(){
15171			setTimeout(blogMasonryZindex,700);
15172		});
15173		
15174	}
15175	
15176	masonryBlogInit();
15177
15178	function blogLoadIn(post_container){
15179
15180
15181		if(post_container.attr('data-load-animation') == 'none') {
15182		
15183			post_container.find('.inner-wrap').removeClass('animated');
15184
15185		} else {
15186
15187			post_container.find('article').each(function(i){
15188
15189				//loaded visible
15190				if($(this).visible(true)) {
15191
15192					$(this).delay(110*i).queue(function(next){
15193					    $(this).addClass("animated-in");
15194					    next();
15195					});
15196
15197
15198				} else {
15199					//not already visible
15200					var $that = $(this);
15201					var waypoint = new Waypoint({
15202
15203			 			element: $that,
15204			 			 handler: function(direction) {
15205							
15206							setTimeout(function(){
15207							    $that.addClass("animated-in");
15208							},80*$that.attr('data-delay-amount'));
15209
15210							waypoint.destroy();
15211						},
15212						offset: '90%'
15213
15214					}); 
15215				}
15216
15217
15218			});
15219	
15220			
15221		}
15222
15223	}
15224
15225	function blogHeightCalcs($posts_container, cols) {
15226		if( $posts_container.parent().hasClass('meta_overlaid') && $posts_container.find('article[class*="regular"]').length > 0) {
15227
15228			//widths
15229			$.each($posts_container,function(i,v){
15230			 	var $colSize = 4;
15231			 	var $mult = (cols == 1) ? 1 : 2;
15232
15233			 	//check if higher than IE9 -- bugs out with width calc
15234			 	if($('html.no-csstransitions').length == 0) {
15235			 		$(v).find('article[class*="regular"]').css('width',Math.floor($(v).width()/cols) +'px');
15236			 		$(v).find('article[class*="tall"]').css('width',Math.floor($(v).width()/cols*$mult) +'px');
15237			 	} else {
15238			 		$('.post-area.masonry').css('width','100%');
15239			 	}
15240			 	
15241			 	
15242			 });
15243
15244			   //reset height for calcs
15245			   $posts_container.find('article[class*="regular"] img').css('height','auto');
15246
15247			   var tallColHeight = Math.ceil($posts_container.find('article[class*="regular"]:not(".format-link"):not(".format-quote") img').first().height());
15248			   var multipler = (window.innerWidth > 690) ? 2 : 1 ;
15249			   $posts_container.find('article[class*="tall"] img, .article.wide img, article.regular img').removeClass('auto-height');
15250			   $posts_container.find('article[class*="tall"] img').css('height',(tallColHeight*multipler));
15251			   $posts_container.find('article[class*="regular"] img').css('height',(tallColHeight));
15252			   //quote/links
15253			   $posts_container.find('article.regular.format-link,article.regular.format-quote').each(function(){
15254
15255			   		if(window.innerWidth > 690) {
15256			   			$(this).css({
15257			  	 			'height': tallColHeight
15258			   			});
15259			   		} else {
15260			   			$(this).css({
15261			  	 			'height': 'auto'
15262			   			});			 		
15263			   		}
15264			  	 	
15265			   	});
15266
15267
15268		} else {
15269			$posts_container.find('article[class*="tall"] img, article.regular img').addClass('auto-height');
15270		}
15271
15272
15273		if( $posts_container.parent().hasClass('classic_enhanced') && $posts_container.find('article[class*="regular"]').length > 0) {
15274			
15275			if($(window).width() > 690 ) {
15276				classicEnhancedSizing($posts_container.find('article:not(.large_featured):not(.wide_tall)'));
15277			}
15278			else { 
15279				classicEnhancedSizing($posts_container.find('article:not(.wide_tall)'));
15280			}
15281
15282			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;
15283
15284			if($(window).width() > 690 ) {
15285				$posts_container.find('article.large_featured, article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
15286			}
15287			else {
15288				$posts_container.find('article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
15289			}
15290
15291		//for when no regular articles exist	
15292		} else if( $posts_container.parent().hasClass('classic_enhanced') && $posts_container.find('article[class*="regular"]').length == 0) {
15293			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;
15294
15295			if($(window).width() > 690 ) {
15296				$posts_container.find('article.large_featured, article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
15297			}
15298			else {
15299				$posts_container.find('article.regular, article[class*="wide_tall"]').css('height',(tallColHeight));
15300			}
15301		}
15302
15303		//IE9 fix
15304		if($('html.no-csstransitions').length > 0) 		
15305			$('.post-area.masonry').css('width','100%');
15306			 	
15307			 	
15308	}
15309
15310	function classicEnhancedSizing(elements) {
15311
15312		var tallestCol = 0;
15313		elements.find('.article-content-wrap').css('height','auto');
15314		elements.filter('.has-post-thumbnail').each(function(){
15315			($(this).find('.article-content-wrap').outerHeight(true) > tallestCol) ? tallestCol = $(this).find('.article-content-wrap').outerHeight(true) : tallestCol = tallestCol;
15316		});	
15317		
15318		elements.filter('.has-post-thumbnail').find('.article-content-wrap').css('height',(tallestCol));
15319
15320	}
15321
15322
15323	function blogStickySS() {
15324		$('#sidebar[data-nectar-ss="true"], #sidebar[data-nectar-ss="1"]').each(function(){
15325
15326			//padding from top of screen
15327			$ssExtraTopSpace = 50;
15328
15329			if($('#header-outer[data-remove-fixed="0"]').length > 0 && $('body[data-hhun="1"]').length == 0) { 
15330			 	$ssExtraTopSpace += $('#header-outer').outerHeight();	
15331				
15332				//resize effect
15333				if($('#header-outer[data-shrink-num][data-header-resize="1"]').length > 0 ) {
15334					 var shrinkNum = 6;		
15335					 var headerPadding2 = parseInt($('#header-outer').attr('data-padding')) - parseInt($('#header-outer').attr('data-padding'))/1.8;
15336					 shrinkNum = $('#header-outer').attr('data-shrink-num');
15337					 $ssExtraTopSpace -= shrinkNum;
15338					 $ssExtraTopSpace -= headerPadding2;
15339				}
15340				
15341				//condesne
15342				if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
15343					
15344						var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
15345						var $secondaryHeader = $('#header-secondary-outer');
15346						
15347						$ssExtraTopSpace = 50;
15348						$ssExtraTopSpace += $('#header-outer').height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top')) ) - parseInt(nectarDOMInfo.secondaryHeaderHeight);
15349				}
15350				
15351
15352			}
15353
15354			if($('#wpadminbar').length > 0) {
15355				$ssExtraTopSpace += $('#wpadminbar').outerHeight();
15356			}
15357
15358 			if($('#header-outer').attr('data-using-secondary') == '1') {
15359				$ssExtraTopSpace += $('#header-secondary-outer').outerHeight();
15360			}
15361			
15362			if($(this).parents('.wpb_widgetised_column').length > 0) {
15363				$(this).parents('.wpb_column').theiaStickySidebar({
15364			      additionalMarginTop: $ssExtraTopSpace,
15365						updateSidebarHeight: false
15366			    });
15367			} else {
15368				$(this).theiaStickySidebar({
15369			      additionalMarginTop: $ssExtraTopSpace,
15370						updateSidebarHeight: false
15371			    });
15372			}
15373			
15374		});
15375	}
15376
15377	if( $().theiaStickySidebar ) {
15378		blogStickySS();
15379	}
15380
15381	var blogMediaQuerySize;
15382	function blogColumnNumbCalcs(post_container){
15383		   if($('body').hasClass('mobile') && window.innerWidth < 990 || post_container.parents('.post-area').hasClass('span_9') && post_container.parents('.post-area.meta_overlaid').length == 0) {
15384			   $cols = 2;
15385		   } else if( post_container.parents('.post-area').hasClass('full-width-content') || post_container.parents('.post-area').parent().hasClass('full-width-content') && $('#boxed').length == 0 || post_container.parents('.post-area.meta_overlaid').length > 0 ){
15386		   		
15387				var windowSize = $(window).width();
15388
15389				
15390				if(window.innerWidth >= 1600){
15391					blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'four' :'five';
15392				} else if(window.innerWidth < 1600 && window.innerWidth >= 1300){
15393					blogMediaQuerySize = 'four';
15394				} else if(window.innerWidth < 1300 && window.innerWidth >= 990){
15395					blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'four' :'three';
15396				} else if(window.innerWidth < 990 && window.innerWidth >= 470){
15397					blogMediaQuerySize = 'two';
15398				} else if(window.innerWidth < 470){
15399					blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'two' :'one';
15400				}
15401			
15402				
15403				//boxed
15404				if($('#boxed').length > 0) {
15405					if(window.innerWidth > 1300){
15406						blogMediaQuerySize = 'four';
15407					} else if(window.innerWidth < 1300 && window.innerWidth > 990){
15408						blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'four' :'three';
15409					} else if(window.innerWidth < 990){
15410						blogMediaQuerySize = (post_container.parents('.post-area.meta_overlaid').length > 0) ? 'two' :'one';
15411					}
15412					
15413				}
15414				
15415				
15416				switch (blogMediaQuerySize) {
15417					case 'five':
15418						$cols = 5;
15419					break;
15420					
15421					case 'four':
15422						$cols = 4;
15423					break;
15424					
15425					case 'three':
15426						$cols = 3;
15427					break;
15428					
15429					case 'two':
15430						$cols = 2;
15431					break;
15432					
15433					case 'one':
15434						$cols = 1;
15435					break;
15436				}
15437		   		
15438			
15439		   } else {
15440
15441		   	   $cols = 3;
15442		   }
15443
15444		   return $cols;
15445
15446	}
15447
15448
15449
15450
15451
15452
15453var shrinkNum = 6;
15454		
15455if($('#header-outer[data-shrink-num]').length > 0 ) shrinkNum = $('#header-outer').attr('data-shrink-num');
15456
15457headerPadding2 = headerPadding - headerPadding/1.8;
15458
15459$('body').on('click','.section-down-arrow',function(){
15460	
15461	if($(this).parents('.nectar-box-roll').length > 0) return false;
15462
15463	var $currentSection = $(this).parents('#page-header-bg');
15464	var $topDistance = $currentSection.height();
15465	var $offset = ($currentSection.parents('.first-section').length == 0 || $('body[data-transparent-header="false"]').length > 0) ? $currentSection.offset().top : 0;
15466	var $bodyBorderSize = ($('.body-border-top').length > 0 && $(window).width() > 1000) ? $('.body-border-top').height(): 0;
15467	var $headerNavSpace = ($('body[data-header-format="left-header"]').length > 0) ? 0 : $('#header-space').height();
15468	
15469	var $materialSecondary = 0;
15470	if($('body.material').length > 0 && $('#header-secondary-outer').length > 0) { $materialSecondary = $('#header-secondary-outer').height(); }
15471	
15472	if($('body[data-permanent-transparent="1"]').length == 0) {
15473		//regular
15474		if(!$('body').hasClass('mobile')){
15475			
15476			if($('body[data-hhun="1"]').length > 0 && $('#header-outer[data-remove-fixed="1"]').length == 0) {
15477				$('body,html').stop().animate({
15478					scrollTop: parseInt($topDistance) + $offset + 2 - $bodyBorderSize*2
15479				},1000,'easeInOutCubic')
15480			} 
15481			else {
15482				
15483				$resize = ($('#header-outer[data-header-resize="0"]').length > 0) ? 0 : parseInt(shrinkNum) + headerPadding2*2;
15484				if($('#header-outer[data-remove-fixed="1"]').length > 0) { 
15485					$headerNavSpace = 0;
15486					$offset = 0;
15487				}
15488					
15489				//condesne
15490				if($('body.mobile').length == 0 && $('#header-outer[data-condense="true"]').length > 0) {
15491					
15492						var $headerSpan9 = $('#header-outer[data-format="centered-menu-bottom-bar"] header#top .span_9');
15493						var $secondaryHeader = $('#header-secondary-outer');
15494						
15495						$headerNavSpace = $('#header-outer').height() - (parseInt($headerSpan9.position().top) - parseInt($('#header-outer #logo').css('margin-top')) ) - parseInt(nectarDOMInfo.secondaryHeaderHeight);
15496				}
15497				
15498				
15499				$('body,html').stop().animate({
15500					scrollTop: parseInt($topDistance - $headerNavSpace) +$resize + 3 + $offset + $materialSecondary
15501				},1000,'easeInOutCubic')
15502
15503			}
15504			
15505		} else {
15506			$scrollPos = ($('#header-outer[data-mobile-fixed="1"]').length > 0) ? parseInt($topDistance) - $headerNavSpace + parseInt($currentSection.offset().top) + 2 : parseInt($topDistance) + parseInt($currentSection.offset().top) + 2;
15507			$('body,html').stop().animate({
15508				scrollTop: $scrollPos - $bodyBorderSize*2
15509			},1000,'easeInOutCubic')
15510		}
15511	} else {
15512		//permanent transparent
15513		$('body,html').stop().animate({
15514			scrollTop: parseInt($topDistance) + parseInt($currentSection.offset().top) + 2 - $bodyBorderSize*2
15515		},1000,'easeInOutCubic')
15516	}
15517	return false;
15518});
15519
15520
15521$('body').on('mouseover','.post-area.featured_img_left .grav-wrap .text a, .masonry.material .masonry-blog-item .grav-wrap .text a, .blog-recent[data-style="material"] .grav-wrap .text a',function(){
15522	$(this).parents('.grav-wrap').find('img').addClass('hovered');
15523});
15524$('body').on('mouseleave','.post-area.featured_img_left .grav-wrap .text a, .masonry.material .masonry-blog-item .grav-wrap .text a, .blog-recent[data-style="material"] .grav-wrap .text a',function(){
15525	$(this).parents('.grav-wrap').find('img').removeClass('hovered');
15526});  
15527
15528
15529
15530
15531/*-------------------------------------------------------------------------*/
15532/*	7.	Cross Browser Fixes
15533/*-------------------------------------------------------------------------*/	
15534	 
15535	 function crossBrowserFixes() {
15536	
15537		 
15538		//Fix current class in menu 
15539		if ($("body").hasClass("single-portfolio") || $('body').hasClass("error404") || $('body').hasClass("search-results")) {   
15540			$("li").removeClass("current_page_parent").removeClass("current-menu-ancestor").removeClass('current_page_ancestor');   
15541		}
15542		
15543		//for users updating to 8 with a custom, old header template file
15544		if($('html.js').length == 0) { $('html').removeClass('no-js').addClass('js'); }
15545
15546		//fix for IE8 nth-child
15547		$('.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');
15548		
15549		//remove br's from code tag
15550		$('code').find('br').remove();	
15551		
15552		//if a clear is the last div, remove the padding
15553		if($('.container.main-content > .row > div:last-child').hasClass('clear')) {
15554			$('.container.main-content > .row > div:last-child').css('padding-bottom','0');
15555		}
15556		
15557		//homepage recent blog for IE8
15558		$('.container-wrap .blog-recent > div:last-child').addClass('col_last');
15559		
15560		//blog ascend bottom padding
15561		if($('.single .blog_next_prev_buttons').length > 0) $('.container-wrap').css('padding-bottom',0);
15562
15563		//contact form
15564		$('.wpcf7-form p:has(input[type=submit])').css('padding-bottom','0px');
15565
15566		$('.full-width-content .wpcf7-submit').on('click',function(){ setTimeout(function(){ fullWidthContentColumns() },1000); setTimeout(function(){ fullWidthContentColumns() },2000); });
15567		
15568		//no caption home slider fix
15569		$('#featured article').each(function(){
15570			if($(this).find('h2').attr('data-has-caption') == '0') {
15571				$(this).parents('.slide').addClass('no-caption');
15572			}
15573		});
15574		
15575		//add class for IE
15576		var ua = window.navigator.userAgent;
15577		var msie = ua.indexOf("Edge/");
15578		if(msie > 0)
15579			$('body').addClass('msie');
15580
15581		//gravity form inside fw content row
15582		$('.gform_body').click(function(){
15583		   setTimeout(function(){ fullWidthContentColumns(); },200);
15584		 });
15585		 
15586		//pum salient close 
15587		$('.pum.pum-theme-salient-page-builder-optimized button.pum-close').wrapInner('<span />'); 
15588		
15589		//pum inside fspr
15590		if($('#nectar_fullscreen_rows').length > 0 && $('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').length > 0) {
15591			$('.pum-container .pum-content > .wpb_row .full-page-inner > .container > .span_12').unwrap();
15592		}
15593
15594		//chat post format nth child color
15595		$('article.post.format-chat .content-inner dt:odd').css('color','#333');
15596		
15597		//remove margin on last cols inside of full width sections 
15598		$('.full-width-section').each(function(){
15599			$(this).find('> .span_12 > div.col_last').last().css('margin-bottom','0');
15600		});
15601		
15602		//remove p tags from extra content editor when warpping only an img 
15603		$('#portfolio-extra p').each(function(){
15604			if($(this).find('*').length == 1 && $(this).find('img').length == 1) {
15605				$(this).find('img').unwrap();
15606			}
15607		});
15608	
15609
15610		//vc text_separator color
15611		$('.vc_text_separator').each(function(){
15612			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'));
15613		});
15614		
15615		//carousel head button alignment  
15616		$('.carousel-heading').each(function(){
15617			if($(this).find('h2').length > 0) $(this).find('.carousel-prev, .carousel-next').css('top','7px');
15618		});
15619		
15620		//remove carousel heading if not being used
15621		$('.carousel-wrap').each(function(){
15622			if($(this).find('.carousel-heading .container:empty').length > 0) $(this).find('.carousel-heading').remove();
15623		});
15624		
15625		//woocommerce product thuimbnails
15626		$('.woocommerce div.product div.images div.thumbnails a:nth-child(4n+4)').css('margin-right','0px');
15627		
15628		//remove extra galleries when using the nectar gallery slider on projects and posts
15629		$('article.post .gallery-slider .gallery,  article.post .gallery-slider .jetpack-slideshow, .single-portfolio .gallery-slider .gallery, .single-portfolio .gallery-slider .jetpack-slideshow').remove();
15630		
15631		
15632		$('.woocommerce .span_9 .products.related .products li:nth-child(4), .woocommerce .span_9 .products.upsells .products li:nth-child(4)').remove();
15633		$('.woocommerce .span_9 .products.related .products li:nth-child(3), .woocommerce .span_9 .products.upsells .products li:nth-child(3)').css('margin-right','0');	
15634		
15635		$('.cart-menu a, .widget_shopping_cart a').addClass('no-ajaxy');
15636
15637		//clients no hover if no link
15638		$('div.clients').each(function(){
15639			$(this).find('> div').each(function(){
15640				if($(this).find('a').length == 0) {
15641					$(this).addClass('no-link');
15642				}
15643			});
15644		});
15645
15646		//remove ajaxy from single posts when using disqus
15647		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');
15648
15649		//blog next color bg only 
15650		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();
15651		
15652		if($('#single-below-header').hasClass('fullscreen-header') && $('.blog_next_prev_buttons').length == 0 ) $('#author-bio, .comment-wrap').addClass('lighter-grey');
15653
15654		//shop header parallax margin 
15655		if($('body.woocommerce').find('#page-header-bg').length > 0){
15656			$('.container-wrap').css({'margin-top':'0px','padding-top':'30px'});
15657		}
15658		
15659		//if using wooCommerce sitewide notice
15660		if($('.demo_store').length > 0) $('#header-outer, #header-space').css('margin-top','32px');
15661		
15662		//footer last column class for IE8
15663		$('#footer-widgets .container .row > div:last-child').addClass('col_last');
15664		
15665		//nectar slider external links
15666		$('.swiper-slide.external-button-1 .buttons > div:nth-child(1) a').attr('target','_blank');
15667		$('.swiper-slide.external-button-2 .buttons > div:nth-child(2) a').attr('target','_blank');
15668		
15669		//portfolio external links
15670		$(".portfolio-items").find("a[href*='http://']:not([href*='"+window.location.hostname+"'])").attr("target","_blank"); 
15671		$(".recent_projects_widget").find("a[href*='http://']:not([href*='"+window.location.hostname+"'])").attr("target","_blank"); 
15672		
15673		$(".portfolio-items").find("a[href*='https://']:not([href*='"+window.location.hostname+"'])").attr("target","_blank"); 
15674		$(".recent_projects_widget").find("a[href*='https://']:not([href*='"+window.location.hostname+"'])").attr("target","_blank"); 
15675		
15676		//remove excess inner content when empty row
15677		$('.container-wrap .row > .wpb_row').each(function(){
15678			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();
15679		});
15680		
15681		//remove boxed style from full width content
15682		$('.full-width-content .col.boxed').removeClass('boxed');
15683		
15684		//remove full width attribute on slider in full width content section
15685		$('.full-width-content .wpb_column .nectar-slider-wrap[data-full-width="true"]').attr('data-full-width','false');	
15686
15687	    //neg marg z-index
15688	    $('.wpb_column.neg-marg').parents('.wpb_row').css('z-index','110');
15689
15690
15691	    //portfolio description remove on hover
15692	    var $tmpTitle = null;
15693	    $('.portfolio-items > .col a[title]').hover(function(){
15694	    	$tmpTitle = $(this).attr('title');
15695	    	$(this).attr('title','');
15696	    },function(){
15697	    	$(this).attr('title', $tmpTitle);
15698	    });
15699	    $('.portfolio-items > .col a[title]').click(function(){
15700			$(this).attr('title', $tmpTitle);
15701	    });
15702
15703	};
15704
15705	crossBrowserFixes();
15706
15707
15708
15709	jQuery( document.body ).on( 'updated_cart_totals', function() { 
15710		if($('.plus').length == 0) 
15711			$( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '<input type="button" value="+" class="plus" />' ).prepend( '<input type="button" value="-" class="minus" />' );
15712	});
15713
15714	// Quantity buttons
15715	if($('.plus').length == 0) {
15716		$( 'div.quantity:not(.buttons_added), td.quantity:not(.buttons_added)' ).addClass( 'buttons_added' ).append( '<input type="button" value="+" class="plus" />' ).prepend( '<input type="button" value="-" class="minus" />' );
15717
15718		$( document ).on( 'click', '.plus, .minus', function() {
15719
15720			// Get values
15721			var $qty		= $( this ).closest( '.quantity' ).find( '.qty' ),
15722				currentVal	= parseFloat( $qty.val() ),
15723				max			= parseFloat( $qty.attr( 'max' ) ),
15724				min			= parseFloat( $qty.attr( 'min' ) ),
15725				step		= $qty.attr( 'step' );
15726
15727			// Format values
15728			if ( ! currentVal || currentVal === '' || currentVal === 'NaN' ) currentVal = 0;
15729			if ( max === '' || max === 'NaN' ) max = '';
15730			if ( min === '' || min === 'NaN' ) min = 0;
15731			if ( step === 'any' || step === '' || step === undefined || parseFloat( step ) 
15731=== 'NaN' ) step = 1;
15732
15733			// Change the value
15734			if ( $( this ).is( '.plus' ) ) {
15735
15736				if ( max && ( max == currentVal || currentVal > max ) ) {
15737					$qty.val( max );
15738				} else {
15739					$qty.val( currentVal + parseFloat( step ) );
15740				}
15741
15742			} else {
15743
15744				if ( min && ( min == currentVal || currentVal < min ) ) {
15745					$qty.val( min );
15746				} else if ( currentVal > 0 ) {
15747					$qty.val( currentVal - parseFloat( step ) );
15748				}
15749
15750			}
15751
15752			// Trigger change event
15753			$qty.trigger( 'change' );
15754
15755		});
15756	}
15757
15758	function wooPriceSlider(){
15759
15760
15761		// woocommerce_price_slider_params is required to continue, ensure the object exists
15762		if ( typeof woocommerce_price_slider_params === 'undefined' || !$('body').hasClass('woocommerce') ) {
15763			return false;
15764		}
15765
15766		// Get markup ready for slider
15767		$( 'input#min_price, input#max_price' ).hide();
15768		$( '.price_slider, .price_label' ).show();
15769
15770		// Price slider uses jquery ui
15771		var min_price = $( '.price_slider_amount #min_price' ).data( 'min' ),
15772			max_price = $( '.price_slider_amount #max_price' ).data( 'max' );
15773
15774		current_min_price = parseInt( min_price, 10 );
15775		current_max_price = parseInt( max_price, 10 );
15776
15777		if ( woocommerce_price_slider_params.min_price ) current_min_price = parseInt( woocommerce_price_slider_params.min_price, 10 );
15778		if ( woocommerce_price_slider_params.max_price ) current_max_price = parseInt( woocommerce_price_slider_params.max_price, 10 );
15779
15780		$( 'body' ).bind( 'price_slider_create price_slider_slide', function( event, min, max ) {
15781			if ( woocommerce_price_slider_params.currency_pos === 'left' ) {
15782
15783				$( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + min );
15784				$( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + max );
15785
15786			} else if ( woocommerce_price_slider_params.currency_pos === 'left_space' ) {
15787
15788				$( '.price_slider_amount span.from' ).html( woocommerce_price_slider_params.currency_symbol + " " + min );
15789				$( '.price_slider_amount span.to' ).html( woocommerce_price_slider_params.currency_symbol + " " + max );
15790
15791			} else if ( woocommerce_price_slider_params.currency_pos === 'right' ) {
15792
15793				$( '.price_slider_amount span.from' ).html( min + woocommerce_price_slider_params.currency_symbol );
15794				$( '.price_slider_amount span.to' ).html( max + woocommerce_price_slider_params.currency_symbol );
15795
15796			} else if ( woocommerce_price_slider_params.currency_pos === 'right_space' ) {
15797
15798				$( '.price_slider_amount span.from' ).html( min + " " + woocommerce_price_slider_params.currency_symbol );
15799				$( '.price_slider_amount span.to' ).html( max + " " + woocommerce_price_slider_params.currency_symbol );
15800
15801			}
15802
15803			$( 'body' ).trigger( 'price_slider_updated', min, max );
15804		});
15805
15806		$( '.price_slider' ).slider({
15807			range: true,
15808			animate: true,
15809			min: min_price,
15810			max: max_price,
15811			values: [ current_min_price, current_max_price ],
15812			create : function( event, ui ) {
15813
15814				$( '.price_slider_amount #min_price' ).val( current_min_price );
15815				$( '.price_slider_amount #max_price' ).val( current_max_price );
15816
15817				$( 'body' ).trigger( 'price_slider_create', [ current_min_price, current_max_price ] );
15818			},
15819			slide: function( event, ui ) {
15820
15821				$( 'input#min_price' ).val( ui.values[0] );
15822				$( 'input#max_price' ).val( ui.values[1] );
15823
15824				$( 'body' ).trigger( 'price_slider_slide', [ ui.values[0], ui.values[1] ] );
15825			},
15826			change: function( event, ui ) {
15827
15828				$( 'body' ).trigger( 'price_slider_change', [ ui.values[0], ui.values[1] ] );
15829
15830			},
15831		});
15832
15833	}
15834	
15835
15836//vc col mobile fixes
15837function vcMobileColumns() {
15838
15839	$('.wpb_row').each(function(){
15840		if(typeof $(this).find('.span_12').offset() != 'undefined' ) {
15841		
15842			$(this).find('[class*="vc_col-"]').each(function(){
15843
15844				var $firstChildOffset = $(this).parents('.span_12').offset().left;
15845				
15846				$(this).removeClass('no-left-margin');
15847				if($(this).offset().left < $firstChildOffset + 27) { 
15848					$(this).addClass('no-left-margin');
15849				} else {
15850					$(this).removeClass('no-left-margin');
15851				}
15852			});
15853		}
15854	});
15855}
15856
15857if( $('[class*="vc_col-xs-"], [class*="vc_col-md-"], [class*="vc_col-lg-"]').length > 0) { vcMobileColumns(); }
15858
15859
15860/*-------------------------------------------------------------------------*/
15861/*	8.	Form Styling
15862/*-------------------------------------------------------------------------*/	
15863
15864
15865if($('body[data-fancy-form-rcs="1"]').length > 0) {
15866
15867
15868    //select only as of v9
15869    $('select:not(.comment-form-rating #rating)').each(function(){
15870
15871    	//cf7
15872    	if($(this).parents('.wpcf7-form-control-wrap').length > 0) {
15873
15874    		//select 2 already initialized
15875	    	if($(this).parents('.wpcf7-form-control-wrap').find('.select2-container').length > 0) {
15876	    		$selector = $($(this).prev('.select2-container'));
15877	    	} else {
15878	    		$selector = $(this);
15879	    	}
15880
15881	    	//if label is found
15882	    	if($selector.parents('.wpcf7-form-control-wrap').parent().find('label').length == 1) {
15883	    		$selector.parents('.wpcf7-form-control-wrap').parent().wrapInner('<div class="fancy-select-wrap" />');
15884	    	} else {
15885	    		//default wrap
15886	    		$selector.wrap('<div class="fancy-select-wrap" />');
15887	    	}
15888    	} 
15889    	//default
15890    	else {
15891
15892	    	//select 2 already initialized
15893	    	if($(this).prev('.select2-container').length > 0) {
15894	    		$selector = $(this).prev('.select2-container');
15895	    	} else {
15896	    		$selector = $(this);
15897	    	}
15898				
15899				if($(this).parents('#buddypress').length == 0) {
15900			    	//if label is found
15901			    	if($selector.prev('label').length == 1) {
15902			    		$selector.prev('label').andSelf().wrapAll('<div class="fancy-select-wrap" />');
15903			    	} else if($selector.next('label').length == 1) {
15904			    		$selector.next('label').andSelf().wrapAll('<div class="fancy-select-wrap" />');
15905			    	} else {
15906			    		//default wrap
15907			    		$selector.wrap('<div class="fancy-select-wrap" />');
15908			    	}
15909				}
15910				
15911    	}
15912    });
15913	
15914	function select2Init(){
15915		$('select:not(.state_select):not(.country_select):not(.comment-form-rating #rating):not(#tribe-bar-form select):not(.woocommerce-currency-switcher)' ).each( function() {
15916			
15917			if($(this).parents('#buddypress').length == 0) {
15918			
15919						if($(this).parents('.woocommerce-ordering').length == 0) {
15920							$( this ).select2({
15921								minimumResultsForSearch: 7,
15922								width: '100%'
15923							});
15924						} else {
15925							$( this ).select2({
15926								minimumResultsForSearch: 7,
15927								dropdownAutoWidth: true
15928							});
15929						}
15930			}
15931
15932		});
15933	}
15934   
15935	select2Init();
15936
15937}
15938	
15939
15940
15941//Back/forward cache OCM close
15942if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
15943	
15944	window.onpageshow = function(event) {
15945		
15946			if(event.persisted) {
15947					
15948					//play video BGs
15949					$('.nectar-video-wrap, .nectar-slider-wrap .swiper-slide .video-wrap').each(function(i){
15950						
15951						if($(this).find('video').length > 0) {
15952							  $(this).find('video')[0].play();
15953						}
15954						
15955					});
15956	
15957
15958					//close mobile nav
15959					
15960					////material
15961					if($('body.material-ocm-open').length > 0) {	
15962							$('body > .slide_out_area_close').addClass('non-human-allowed').trigger('click');
15963
15964							setTimeout(function(){
15965								$('body > .slide_out_area_close').removeClass('non-human-allowed');
15966							},100);
15967						
15968					} 
15969					else if( $('#slide-out-widget-area.slide-out-from-right-hover.open').length > 0 && navigator.userAgent.match(/(iPod|iPhone|iPad)/) ) {
15970						mobileCloseNavCheck();
15971					}
15972					////others
15973					else if( $('#slide-out-widget-area.fullscreen.open').length > 0 || $('#slide-out-widget-area.fullscreen-alt.open').length > 0 || $('#slide-out-widget-area.slide-out-from-right.open').length > 0 ) {
15974						
15975							$('#slide-out-widget-area .slide_out_area_close').addClass('non-human-allowed');
15976							$('.slide-out-widget-area-toggle:not(.std-menu) a.open').addClass('non-human-allowed').trigger('click');
15977							setTimeout(function(){
15978								$('#slide-out-widget-area .slide_out_area_close').removeClass('non-human-allowed');
15979							},100);
15980						
15981					}
15982
15983			} // if loaded from bf cache
15984			
15985		} //onpage show
15986		
15987} // only used on Safari or mobile
15988	
15989	
15990/*-------------------------------------------------------------------------*/
15991/*	10.	Page transitions
15992/*-------------------------------------------------------------------------*/	
15993
15994	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 ) {
15995
15996		$('#ajax-content-wrap').ajaxify({
15997			'selector':'#ajax-content-wrap a:not(.no-ajaxy):not([target="_blank"]):not([href^="#"]):not(.comment-edit-link):not(#cancel-comment-reply-link):not(.comment-reply-link):not(#toggle-nav):not(.cart_list a):not(.logged-in-as a):not(.no-widget-added a):not(.add_to_cart_button):not(.product-wrap a):not(.section-down-arrow):not([data-filter]):not([data-fancybox]):not(.product_list_widget a):not(.magnific):not(.pp):not([rel^="prettyPhoto"]):not(.pretty_photo), #header-outer li:not(.no-ajaxy) > a:not(.no-ajaxy), #header-outer #logo',
15998			'verbosity': 0, 
15999			requestDelay: 400,
16000			previewoff : true,
16001			memoryoff: true,
16002			turbo : false
16003		});
16004
16005		$(window).on("pronto.render", initPage)
16006		.on("pronto.load", destroyPage)
16007		.on("pronto.request", transitionPage);
16008
16009		if($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) setTimeout(function() { waypoints(); }, 750);
16010		else if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },300);
16011
16012		if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
16013			setTimeout(function(){ 
16014				$('#ajax-loading-screen').addClass('loaded');
16015			},30);
16016		}
16017
16018		initPage();
16019
16020	} else if($('body[data-ajax-transitions="true"]').length > 0 && $('#ajax-loading-screen[data-method="standard"]').length > 0 ) {
16021		
16022		//chrome white BG flash fix
16023		$('html').addClass('page-trans-loaded');
16024
16025		//fadeout loading animation
16026		if($('#ajax-loading-screen[data-effect="standard"]').length > 0) {
16027
16028			if($('.nectar-particles').length == 0) {
16029
16030					$('#ajax-loading-screen').transition({'opacity':0},500,function(){ 
16031						$(this).css({'display':'none'}); 
16032					}); 
16033					$('#ajax-loading-screen .loading-icon').transition({'opacity':0},500) 
16034				
16035			}
16036
16037			//bind waypoints after loading screen has left
16038			if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },550);
16039
16040			//safari back/prev fix
16041			if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
16042				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) };
16043				window.onpageshow = function(event) {
16044					
16045		    		if (event.persisted) {
16046							
16047							
16048		    			$('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ 
16049		    				$(this).css({'display':'none'}); 
16050		    			}); 
16051		    			$('#ajax-loading-screen .loading-icon').transition({'opacity':0},600);
16052							
16053		    		} //presisted
16054						
16055		    	}
16056					
16057			} else if(navigator.userAgent.indexOf('Firefox') != -1) {
16058				window.onunload = function(){};
16059			}
16060
16061	    		
16062	    	
16063			
16064		} else {
16065
16066			//for swipe trans add loaded immediately
16067			if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
16068				setTimeout(function(){ 
16069					$('#ajax-loading-screen').addClass('loaded');
16070				},60);
16071			}
16072
16073			if($('#page-header-wrap #page-header-bg[data-animate-in-effect="zoom-out"] .nectar-video-wrap').length == 0 && $('.first-nectar-slider').length == 0) {
16074				setTimeout(function(){ 
16075					$('#ajax-loading-screen:not(.loaded)').addClass('loaded');
16076					setTimeout(function(){ $('#ajax-loading-screen').addClass('hidden'); },1000);
16077				},150);
16078			}
16079
16080			//safari back/prev fix
16081			if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){
16082				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) };
16083				window.onpageshow = function(event) {
16084		    		if (event.persisted) { 
16085		    			$('#ajax-loading-screen').stop().transition({'opacity':0},800,function(){ 
16086		    				$(this).css({'display':'none'}); 
16087		    			}); 
16088		    			$('#ajax-loading-screen .loading-icon').transition({'opacity':0},600);
16089		    		}
16090		    	}
16091			} else if(navigator.userAgent.indexOf('Firefox') != -1) {
16092				window.onunload = function(){};
16093			}
16094			
16095			//bind waypoints after loading screen has left
16096			if($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) { setTimeout(function() { waypoints(); }, 750); }
16097			else if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },350);
16098
16099		}
16100
16101		//remove excess loading images now
16102		$('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();
16103
16104
16105		if($('#ajax-loading-screen[data-disable-fade-on-click="1"]').length == 0) {
16106				
16107				if( $('body.using-mobile-browser #ajax-loading-screen[data-method="standard"][data-disable-mobile="1"]').length == 0) {
16108					window.addEventListener('beforeunload', function () {
16109								$('#ajax-loading-screen').addClass('set-to-fade');
16110								transitionPageStandard();
16111					});
16112				}
16113
16114		} // if disable fade out is not on
16115		
16116		
16117	} else {	
16118		//bind waypoints regularly
16119		if($('.nectar-box-roll').length == 0) setTimeout(function() { waypoints(); },100);
16120	}
16121
16122
16123	function transitionPage(e) {
16124		
16125		if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
16126
16127			if($(window).scrollTop() > 0) {
16128
16129				//stop nicescroll
16130				if($().niceScroll && $("html").getNiceScroll()){
16131					var nice = $("html").getNiceScroll();
16132					nice.stop();
16133				}
16134				
16135				$('body,html').stop(true,true).animate({
16136					scrollTop:0
16137				},500,'easeOutQuad',function(){ 
16138					
16139					//close widget area
16140					setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
16141					$('#ajax-loading-screen').removeClass('loaded');
16142					$('#ajax-loading-screen').addClass('in-from-right');
16143					setTimeout(function(){
16144						$('#ajax-loading-screen').addClass('loaded');
16145					},30);
16146
16147				});
16148			}
16149			else { 
16150				//close widget area
16151				setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
16152				$('#ajax-loading-screen').removeClass('loaded');
16153				$('#ajax-loading-screen').addClass('in-from-right');
16154				setTimeout(function(){
16155					$('#ajax-loading-screen').addClass('loaded');
16156				},30);
16157			}
16158
16159		} else {
16160			if($(window).scrollTop() > 0) {
16161
16162				//stop nicescroll
16163				if($().niceScroll && $("html").getNiceScroll()){
16164					var nice = $("html").getNiceScroll();
16165					nice.stop();
16166				}
16167				
16168				$('body,html').stop(true,true).animate({
16169					scrollTop:0
16170				},500,'easeOutQuad',function(){ 
16171					$('#ajax-loading-screen').css({'opacity':'1', 'display':'none'});
16172					$('#ajax-loading-screen').stop(true,true).fadeIn(600,function(){
16173						$('#ajax-loading-screen .loading-icon').animate({'opacity':1},400);
16174						//close widget area
16175						setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
16176					});
16177				});
16178
16179			} else {
16180				$('#ajax-loading-screen').css('opacity','1').stop().fadeIn(600,function(){
16181					$('#ajax-loading-screen .loading-icon').animate({'opacity':1},400);
16182				});
16183
16184				//close widget area
16185				setTimeout(function(){  if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click');  },400);
16186			}
16187		}
16188
16189		
16190	}
16191
16192	function transitionPageStandard(e) {
16193
16194		if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
16195			$('#ajax-loading-screen').removeClass('loaded');
16196			$('#ajax-loading-screen').addClass('in-from-right');
16197			setTimeout(function(){
16198				$('#ajax-loading-screen').addClass('loaded');
16199			},30);
16200		} else {
16201			if($('#ajax-loading-screen[data-effect="center_mask_reveal"]').length > 0) {
16202				$('#ajax-loading-screen').css('opacity','0').css('display','block').transition({'opacity':'1'},450);
16203			} else {
16204				$('#ajax-loading-screen').show().transition({'opacity':'1'},450);
16205			}
16206		}
16207		
16208		//setTimeout(function(){ $('#ajax-loading-screen .loading-icon').animate({'opacity':1},500); },400);
16209
16210	}
16211
16212	function destroyPage(e) {
16213		$(window).off('scroll.appear');
16214		if($('#nectar_fullscreen_rows').length > 0 && $().fullpage) 
16215			$.fn.fullpage.destroy('all');
16216	}
16217
16218	function initPage(e) {
16219
16220		if(!$('body').hasClass('ajax-loaded')) return false;
16221
16222
16223		//init js
16224		lightBoxInit();
16225		addOrRemoveSF();
16226		
16227		if($('body[data-header-format="left-header"]').length == 0) 
16228			$(".sf-menu").superfish('destroy');
16229		
16230		//$('#header-outer').removeClass('dark-slide');
16231		initSF();
16232		SFArrows();
16233		headerInit();
16234		var $effectTimeout = ($('#ajax-loading-screen').length > 0) ? 800 : 0;
16235		pageHeaderTextEffectInit();
16236		if($('#page-header-bg .nectar-video-wrap video').length == 0) { setTimeout(pageHeaderTextEffect,$effectTimeout); }
16237		coloredButtons();
16238		columnBGColors();
16239		fwCarouselLinkFix();
16240		if($('.carousel').length > 0) {
16241			standardCarouselInit();
16242			clientsCarouselInit();
16243			carouselHeightCalcs();
16244		}
16245		if($('.owl-carousel').length > 0) owlCarouselInit();
16246		if($('.products-carousel').length > 0 || $('.nectar-woo-flickity').length > 0) productCarouselInit();
16247		if($('#nectar_fullscreen_rows').length > 0 && $().fullpage) {
16248			setFPNames();
16249			initFullPageFooter();
16250			fullscreenRowLogic();
16251			initNectarFP();
16252		}
16253		flexsliderInit();
16254		accordionInit();
16255		tabbedInit();
16256		tabbbedDeepLinking();
16257		accordionDeepLinking();
16258		ulChecks();
16259		oneFourthClasses();
16260		carouselfGrabbingClass();
16261		cascadingImageBGSizing();
16262		fullWidthSections();
16263		fwsClasses();
16264		fullwidthImgOnlySizingInit();
16265		fullwidthImgOnlySizing();
16266		if(nectarDOMInfo.usingMobileBrowser) {
16267			fullWidthRowPaddingAdjustCalc();
16268		}
16269		boxRollInit();
16270		setTimeout(function(){ 
16271		   waypoints();
16272		   flickityInit();
16273		},100); 
16274		if($('body[data-animated-anchors="true"]').length > 0) setTimeout(scrollSpyInit,200);
16275		socialSharingInit();
16276		hotSpotHoverBind();
16277		pricingTableHeight();
16278		createTestimonialControls();
16279		imageWithHotspotClickEvents();
16280		testimonialSliderHeight(); 
16281		largeIconHover();
16282		if($('body.material[data-slide-out-widget-area-style="slide-out-from-right"]').length == 0) {
16283			fullscreenMenuInit();
16284		}
16285		boxRollMouseWheelInit();
16286		midnightInit();
16287		responsiveVideoIframesInit();
16288		responsiveVideoIframes();
16289		fullWidthContentColumns();
16290		videoBGInit();
16291		$window.unbind('scroll.parallaxSections').unbind('resize.parallaxSections');
16292		parallaxScrollInit();
16293		
16294		$blog_containers = [];
16295		$('.posts-container').each(function(i){
16296			$blog_containers[i] = $(this);
16297		});
16298		
16299		nectarAccountPageTabs();
16300		masonryBlogInit();
16301		masonryPortfolioInit();
16302		portfolioAccentColor();
16303		portfolioHoverEffects();
16304		portfolioFiltersInit();
16305		style6Img();
16306		isotopeCatSelection();
16307		$(window).unbind('.infscr');
16308		infiniteScrollInit();
16309		toTopBind();
16310		centerLove();
16311		postNextButtonEffect();
16312		pageLoadHash();
16313		slideOutWidgetAreaScrolling();
16314		
16315		//search results
16316		if($('body.search-results').length > 0 && $('#search-results article').length > 0) { searchResultMasonry(); }
16317		
16318		//cf7
16319		if($().wpcf7InitForm) $('div.wpcf7 > form').wpcf7InitForm();
16320
16321		//woocommerce price slider
16322		wooPriceSlider();
16323
16324		//twitter widget 
16325		if(typeof twttr != 'undefined') { twttr.widgets.load(); }
16326
16327		//Calendarize.it
16328		if(typeof init_rhc === 'function') { init_rhc(); }
16329
16330		//unwrap post and protfolio videos
16331		$('.video-wrap iframe').unwrap();
16332		$('#sidebar iframe[src]').unwrap();
16333
16334		$('video:not(.slider-video)').attr('width','100%');
16335		$('video:not(.slider-video)').attr('height','100%'); 
16336
16337		$('.wp-video-shortcode.mejs-container').each(function(){
16338			$(this).attr('data-aspectRatio', parseInt($(this).css('height')) / parseInt($(this).css('width')));
16339		});
16340
16341		//mediaElement
16342		$('video.wp-media-shortcode-ajax, audio.wp-media-shortcode-ajax').each(function(){ 
16343			if(!$(this).parent().hasClass('mejs-mediaelement') && $().mediaelementplayer) {
16344				$(this).mediaelementplayer();  
16345			}
16346		});
16347
16348		$('.mejs-container').css({'height': '100%', 'width': '100%'});
16349		
16350		$('audio').attr('width','100%');
16351		$('audio').attr('height','100%');
16352
16353		$('audio').css('visibility','visible');
16354
16355		if($('body').hasClass('mobile')){
16356			$('video').css('visibility','hidden');
16357		} else {
16358			$('video').css('visibility','visible');
16359		}
16360
16361		$('.wpb_row:has(".nectar-video-wrap")').each(function(i){
16362			$(this).css('z-index',100 + i);
16363		});
16364
16365		mouseParallaxInit();
16366
16367		//chrome self hosted slider bg video correct
16368		 if(navigator.userAgent.indexOf('Chrome') > 0) { 
16369		 	$('.swiper-wrapper .video-wrap').each(function(i){
16370			  	var webmSource = jQuery(this).find('video source[type="video/webm"]').attr('src') + "?id="+Math.ceil(Math.random()*10000);
16371	          	var firstVideo = jQuery(this).find('video').get(0);
16372	          	firstVideo.src = webmSource;
16373	          	firstVideo.load();
16374            });
16375	    }
16376
16377
16378		if($('.nectar-video-bg').length > 0) {
16379			setTimeout(function(){
16380			    	resizeVideoToCover();
16381			    	$('.video-color-overlay').each(function(){
16382			    		$(this).css('background-color',$(this).attr('data-color'));
16383			    	});
16384			    	$('.nectar-video-wrap').transition({'opacity':'1'},0);
16385			    	$('.video-color-overlay').transition({'opacity':'0.7'},0);
16386			    	
16387			    },400);
16388		}
16389
16390		
16391		nectarPageHeader();
16392	
16393
16394		//cart dropdown
16395		$('#header-outer div.cart-outer').hoverIntent(function(){
16396			$('#header-outer .widget_shopping_cart').addClass('open').stop(true,true).fadeIn(400);
16397			$('#header-outer .cart_list').stop(true,true).fadeIn(400);
16398			clearTimeout(timeout);
16399			$('#header-outer .cart-notification').fadeOut(300);
16400		});
16401
16402
16403		//remove excess loading images now
16404		$('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();
16405
16406		setTimeout(portfolioSidebarFollow,250);
16407		setTimeout(portfolioSidebarFollow,500);
16408		setTimeout(portfolioSidebarFollow,1000);
16409
16410		crossBrowserFixes();
16411
16412
16413		$(window).trigger('resize');
16414
16415		//fix admin bar
16416		$("#wpadminbar").show();	
16417
16418
16419		//close widget area
16420		if($('#header-outer').hasClass('side-widget-open')) $('.slide-out-widget-area-toggle a').trigger('click'); 
16421
16422		if($('#ajax-loading-screen[data-effect*="horizontal_swipe"]').length > 0) {
16423			closeSearch();
16424			$('#ajax-loading-screen').removeClass('in-from-right').removeClass('loaded');
16425			setTimeout(function(){ $('#ajax-loading-screen').addClass('loaded'); },30);
16426		} else {
16427			//fade in page
16428			setTimeout(function(){ $('#ajax-loading-screen').stop(true,true).fadeOut(500, function(){ $('#ajax-loading-screen .loading-icon').css({'opacity':0}); }); closeSearch();  },200);
16429			setTimeout(function(){ $('#ajax-loading-screen').stop(true,true).fadeOut(500, function(){ $('#ajax-loading-screen .loading-icon').css({'opacity':0}); }); closeSearch(); },900);
16430		}
16431	} 
16432
16433
16434
16435(function($){
16436	if(!$.fn.textareaCount) { 
16437		$.fn.textareaCount = function(options, fn) {
16438	        var defaults = {
16439				maxCharacterSize: -1,
16440				originalStyle: 'originalTextareaInfo',
16441				warningStyle: 'warningTextareaInfo',
16442				warningNumber: 20,
16443				displayFormat: '#input characters | #words words'
16444			};
16445
16446			var options = $.extend(defaults, options);
16447
16448			var container = $(this);
16449
16450			$("<div class='charleft'>&nbsp;</div>").insertAfter(container);
16451
16452
16453			//create charleft css
16454			var charLeftCss = {
16455				'width' : container.width()
16456			};
16457
16458			var charLeftInfo = getNextCharLeftInformation(container);
16459			charLeftInfo.addClass(options.originalStyle);
16460			//charLeftInfo.css(charLeftCss);
16461
16462
16463			var numInput = 0;
16464			var maxCharacters = options.maxCharacterSize;
16465			var numLeft = 0;
16466			var numWords = 0;
16467
16468			container.bind('keyup', function(event){limitTextAreaByCharacterCount();})
16469					 .bind('mouseover', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);})
16470					 .bind('paste', function(event){setTimeout(function(){limitTextAreaByCharacterCount();}, 10);});
16471
16472	        limitTextAreaByCharacterCount();
16473
16474			function limitTextAreaByCharacterCount(){
16475				charLeftInfo.html(countByCharacters());
16476
16477				//function call back
16478				if(typeof fn != 'undefined'){
16479					fn.call(this, getInfo());
16480				}
16481				return true;
16482			}
16483
16484			function countByCharacters(){
16485				var content = container.val();
16486				var contentLength = content.length;
16487				//Start Cut
16488				if(options.maxCharacterSize > 0){
16489					//If copied content is already more than maxCharacterSize, chop it to maxCharacterSize.
16490					if(contentLength >= options.maxCharacterSize) {
16491						content = content.substring(0, options.maxCharacterSize);
16492					}
16493
16494					var newlineCount = getNewlineCount(content);
16495
16496					// newlineCount new line character. For windows, it occupies 2 characters
16497					var systemmaxCharacterSize = options.maxCharacterSize - newlineCount;
16498					if (!isWin()){
16499						 systemmaxCharacterSize = options.maxCharacterSize
16500					}
16501					if(contentLength > systemmaxCharacterSize){
16502						//avoid scroll bar moving
16503						var originalScrollTopPosition = this.scrollTop;
16504						container.val(content.substring(0, systemmaxCharacterSize));
16505						this.scrollTop = originalScrollTopPosition;
16506					}
16507					charLeftInfo.removeClass(options.warningStyle);
16508					if(systemmaxCharacterSize - contentLength <= options.warningNumber){
16509						charLeftInfo.addClass(options.warningStyle);
16510					}
16511
16512					numInput = container.val().length + newlineCount;
16513					if(!isWin()){
16514						numInput = container.val().length;
16515					}
16516
16517					numWords = countWord(getCleanedWordString(container.val()));
16518
16519					numLeft = maxCharacters - numInput;
16520				} else {
16521					//normal count, no cut
16522					var newlineCount = getNewlineCount(content);
16523					numInput = container.val().length + newlineCount;
16524					if(!isWin()){
16525						numInput = container.val().length;
16526					}
16527					numWords = countWord(getCleanedWordString(container.val()));
16528				}
16529
16530				return formatDisplayInfo();
16531			}
16532
16533			function formatDisplayInfo(){
16534				var format = options.displayFormat;
16535				format = format.replace('#input', numInput);
16536				format = format.replace('#words', numWords);
16537				//When maxCharacters <= 0, #max, #left cannot be substituted.
16538				if(maxCharacters > 0){
16539					format = format.replace('#max', maxCharacters);
16540					format = format.replace('#left', numLeft);
16541				}
16542				return format;
16543			}
16544
16545			function getInfo(){
16546				var info = {
16547					input: numInput,
16548					max: maxCharacters,
16549					left: numLeft,
16550					words: numWords
16551				};
16552				return info;
16553			}
16554
16555			function getNextCharLeftInformation(container){
16556					return container.next('.charleft');
16557			}
16558
16559			function isWin(){
16560				var strOS = navigator.appVersion;
16561				if (strOS.toLowerCase().indexOf('win') != -1){
16562					return true;
16563				}
16564				return false;
16565			}
16566
16567			function getNewlineCount(content){
16568				var newlineCount = 0;
16569				for(var i=0; i<content.length;i++){
16570					if(content.charAt(i) == '\n'){
16571						newlineCount++;
16572					}
16573				}
16574				return newlineCount;
16575			}
16576
16577			function getCleanedWordString(content){
16578				var fullStr = content + " ";
16579				var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
16580				var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
16581				var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
16582				var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
16583				var splitString = cleanedStr.split(" ");
16584				return splitString;
16585			}
16586
16587			function countWord(cleanedWordString){
16588				var word_count = cleanedWordString.length-1;
16589				return word_count;
16590			}
16591		};
16592	}
16593})(jQuery);	
16594	
16595	
16596	
16597	
16598});
16599
16600
16601 }(window.jQuery, window, document));
16602
16603
16604function resizeIframe() {
16605	var element = document.getElementById("pp_full_res").getElementsByTagName("iframe");
16606	var height = element[0].contentWindow.document.body.scrollHeight;
16607    
16608    //iframe height
16609    element[0].style.height = height + 'px';
16610	
16611	//pp height
16612	document.getElementsByClassName("pp_content_container")[0].style.height = height+40+ 'px';
16613	document.getElementsByClassName("pp_content")[0].style.height = height+40+ 'px';
16614	
16615}
16616
16617
16618
16619/*!
16620 * hoverIntent v1.9.0 // 2017.09.01 // jQuery v1.7.0+
16621 * http://briancherne.github.io/jquery-hoverIntent/
16622 *
16623 * You may use hoverIntent under the terms of the MIT license. Basically that
16624 * means you are free to use hoverIntent as long as this header is left intact.
16625 * Copyright 2007-2017 Brian Cherne
16626 */
16627!function(factory){"use strict";"function"==typeof define&&define.amd?define(["jquery"],factory):jQuery&&!jQuery.fn.hoverIntent&&factory(jQuery)}(function($){"use strict";var cX,cY,_cfg={interval:100,sensitivity:6,timeout:0},INSTANCE_COUNT=0,track=function(ev){cX=ev.pageX,cY=ev.pageY},compare=function(ev,$el,s,cfg){if(Math.sqrt((s.pX-cX)*(s.pX-cX)+(s.pY-cY)*(s.pY-cY))<cfg.sensitivity)return $el.off(s.event,track),delete s.timeoutId,s.isActive=!0,ev.pageX=cX,ev.pageY=cY,delete s.pX,delete s.pY,cfg.over.apply($el[0],[ev]);s.pX=cX,s.pY=cY,s.timeoutId=setTimeout(function(){compare(ev,$el,s,cfg)},cfg.interval)},delay=function(ev,$el,s,out){return delete $el.data("hoverIntent")[s.id],out.apply($el[0],[ev])};$.fn.hoverIntent=function(handlerIn,handlerOut,selector){var instanceId=INSTANCE_COUNT++,cfg=$.extend({},_cfg);$.isPlainObject(handlerIn)?(cfg=$.extend(cfg,handlerIn),$.isFunction(cfg.out)||(cfg.out=cfg.over)):cfg=$.isFunction(handlerOut)?$.extend(cfg,{over:handlerIn,out:handlerOut,selector:selector}):$.extend(cfg,{over:handlerIn,out:handlerIn,selector:handlerOut});var handleHover=function(e){var ev=$.extend({},e),$el=$(this),hoverIntentData=$el.data("hoverIntent");hoverIntentData||$el.data("hoverIntent",hoverIntentData={});var state=hoverIntentData[instanceId];state||(hoverIntentData[instanceId]=state={id:instanceId}),state.timeoutId&&(state.timeoutId=clearTimeout(state.timeoutId));
16627var mousemove=state.event="mousemove.hoverIntent.hoverIntent"+instanceId;if("mouseenter"===e.type){if(state.isActive)return;state.pX=ev.pageX,state.pY=ev.pageY,$el.off(mousemove,track).on(mousemove,track),state.timeoutId=setTimeout(function(){compare(ev,$el,state,cfg)},cfg.interval)}else{if(!state.isActive)return;$el.off(mousemove,track),state.timeoutId=setTimeout(function(){delay(ev,$el,state,cfg.out)},cfg.timeout)}};return this.on({"mouseenter.hoverIntent":handleHover,"mouseleave.hoverIntent":handleHover},cfg.selector)}});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.