PageSourceSearch

https://www.corcoranaffiliate.com/wp-content/themes/hazel/js/global.js

js corcoranaffiliate.com collected 2026-10-09 22:50:50 UTC 72,030 bytes, 1,704 lines download raw bytes

1window.hazelOptions = hazelOptions;
2window.BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser",this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version",this.OS=this.searchString(this.dataOS)||"an unknown OS",this.isEdge=window.navigator.userAgent.indexOf("Edge")>-1?true:false,this.isModernIE=window.navigator.userAgent.indexOf("Trident")>-1&&!this.isEdge?true:false},searchString:function(i){for(var n=0;n<i.length;n++){var r=i[n].string,t=i[n].prop;if(this.versionSearchString=i[n].versionSearch||i[n].identity,r){if(-1!=r.indexOf(i[n].subString))return i[n].identity}else if(t)return i[n].identity}},searchVersion:function(i){var n=i.indexOf(this.versionSearchString);if(-1!=n)return parseFloat(i.substring(n+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera",versionSearch:"Version"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init();
3var isMobile = {
4    Android: function() {
5        return navigator.userAgent.match(/Android/i);
6    },
7    BlackBerry: function() {
8        return navigator.userAgent.match(/BlackBerry/i);
9    },
10    iOS: function() {
11        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
12    },
13    Opera: function() {
14        return navigator.userAgent.match(/Opera Mini/i);
15    },
16    Windows: function() {
17        return navigator.userAgent.match(/IEMobile/i);
18    },
19    any: function() {
20        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
21    },
22    allExceptIpad: function(){
23	    return (isMobile.Android() || isMobile.BlackBerry() || navigator.userAgent.match(/iPhone|iPod/i) || isMobile.Opera() || isMobile.Windows());
24    }
25};
26
27if (window.location.hash) {
28	window.treethemesOrigHash = window.location.hash;
29	jQuery(document).scrollTop(0); 
30}
31
32$ = (jQuery);
33
34(function($) {
35	"use strict";
36	jQuery.fn.getHiddenDimensions = function(includeMargin) {
37	    var $item = this,
38	        props = { position: 'absolute', visibility: 'hidden', display: 'block' },
39	        dim = { width:0, height:0, innerWidth: 0, innerHeight: 0,outerWidth: 0,outerHeight: 0 },
40	        $hiddenParents = $item.parents().andSelf().not(':visible'),
41	        includeMargin = (includeMargin == null)? false : includeMargin;
42	
43	    var oldProps = [];
44	    $hiddenParents.each(function() {
45	        var old = {};
46	
47	        for ( var name in props ) {
48	            old[ name ] = this.style[ name ];
49	            this.style[ name ] = props[ name ];
50	        }
51	
52	        oldProps.push(old);
53	    });
54	
55	    dim.width = $item.width();
56	    dim.outerWidth = $item.outerWidth(includeMargin);
57	    dim.innerWidth = $item.innerWidth();
58	    dim.height = $item.height();
59	    dim.innerHeight = $item.innerHeight();
60	    dim.outerHeight = $item.outerHeight(includeMargin);
61	
62	    return dim;
63	}
64}(jQuery));
65
66
67
68function correct_hazel_mega_menu(){
69	jQuery('header:not(.headerclone) .navbar-collapse li.hazel_mega_menu > ul.menu-depth-1, .header_style8_left_container .navbar-collapse li.hazel_mega_menu > ul.menu-depth-1, .header_style9_left_container .navbar-collapse li.hazel_mega_menu > ul.menu-depth-1').each(function(){
70		var four_plus_columns = false;
71		if (jQuery('header.style8').length){
72			var colsNum = jQuery(this).children('li').length;
73			if (jQuery(this).width(jQuery('.header_style8_right').width()-1).children('li').length > 4){
74				var columns_width = 100 / jQuery(this).children('li').length;
75				four_plus_columns = true;
76				jQuery(this).children('li').css({
77					'min-width' : columns_width+"%",
78					'max-width' : columns_width+"%",
79					'width'		: columns_width+"%"
80				}).find('ul').css('min-width','100%');
81			}
82		} else if (jQuery('body.style9').length){
83			var colsNum = jQuery(this).children('li').length;
84			if (jQuery(this).width(jQuery(window).width() - jQuery('.header_style9_left_container').width()-1).children('li').length > 4){
85				var columns_width = 100 / jQuery(this).children('li').length;
86				four_plus_columns = true;
87				jQuery(this).children('li').css({
88					'min-width' : columns_width+"%",
89					'max-width' : columns_width+"%",
90					'width'		: columns_width+"%"
91				}).find('ul').css('min-width','100%');
92			}
93		} else {
94			if (jQuery(this).children('li').length > 4){
95				var columns_width = 100 / jQuery(this).children('li').length;
96				four_plus_columns = true;
97				jQuery(this).css({
98					'max-width' : '100vw',
99					'width'		: '100vw'
100				}).children('li').css({
101					'min-width' : columns_width+"%",
102					'max-width' : columns_width+"%",
103					'width'		: columns_width+"%"
104				}).find('ul').css('min-width','100%');
105			}
106			
107			if (jQuery('body').hasClass('rtl')){
108				jQuery(this).css('right',0);
109				
110				var right_real_margin = (jQuery(window).width()-jQuery(this).width())/2,
111					right_offset = jQuery(window).width()- (jQuery(this).width() + jQuery(this).offset().left),
112					right_adjust_value = -right_offset+right_real_margin;
113				
114				jQuery(this).css('right',right_adjust_value);
115				
116			} else {
117				if (!window.BrowserDetect.isModernIE){
118	
119					var nav_pad = parseInt(jQuery('header:not(.headerclone) .nav-container').css('padding-right'),10),
120						right_offset = jQuery(window).width() - ( jQuery(this).closest('li.menu-item-depth-0').offset().left + jQuery(this).closest('li.menu-item-depth-0').width() + nav_pad ),
121						left_aux = jQuery(window).width() - ( jQuery(this).width() + right_offset ),
122						left_offset = left_aux > 0 ? left_aux : 0,
123						center_left_aux = (jQuery(window).width()-1240)/2,
124						center_left_offset = center_left_aux > 0 ? center_left_aux : 0;
125					
126					if (left_offset < nav_pad || jQuery(window).width() - right_offset < center_left_offset + jQuery(this).width() ){
127						if (!four_plus_columns) jQuery(this).offset({ left: center_left_offset });
128						else jQuery(this).offset({ left : -(jQuery(this).width() - jQuery(window).width()) });
129					} else {
130						jQuery(this).offset({ left: left_offset });
131					}
132		
133				} else {
134					//modern IE
135					//11 specific
136					if (window.BrowserDetect.browser == "Mozilla" && parseInt(window.BrowserDetect.version, 10) == 11){
137						if (jQuery(window).width() < jQuery(this).parent().offset().left + jQuery(this).width()){
138							jQuery(this).css({ left : (jQuery(window).width() - jQuery(this).width())/2 });
139						}
140					}
141				}
142			}
143		}
144	});
145	
146	if (jQuery('#dl-menu').is(':visible')){
147		jQuery('.dl-menu, .dl-menu ul').css('max-height', window.screen.availHeight-jQuery('body header').first().height()-50 );
148	}
149}
150
151	
152	// Blog Isotope
153	function blogMasonry() {
154	
155		var $blogcontainer = jQuery('.blog-default.wideblog .container');
156	
157		if ($blogcontainer.length > 0){
158			$blogcontainer.imagesLoaded( function() {
159				setTimeout(function(){
160					$blogcontainer.animate({'opacity' : 1}, 200);
161			    }, 100);
162		    });
163	    }
164	}
165	
166	blogMasonry();
167	
168	
169	// Blog Isotope without Container
170	function blogMasonrynoContainer() {
171	
172		var $blognocontainer = jQuery('.blog-default.wideblog .smooth_loading');
173	
174		if ($blognocontainer.length > 0){
175			$blognocontainer.imagesLoaded( function() {
176				setTimeout(function(){
177					$blognocontainer.animate({'opacity' : 1}, 200);
178			    }, 100);
179		    });
180	    }
181	}
182	
183	blogMasonrynoContainer();
184	
185	
186	// Blog Isotope without Container
187	function blogMasonrynoContainerGrid() {
188	
189		var $blognocontainerGrid = jQuery('.archive .blog-default-bg.masonry_grid');
190	
191		if ($blognocontainerGrid.length > 0){
192			$blognocontainerGrid.imagesLoaded( function() {
193				setTimeout(function(){
194					$blognocontainerGrid.animate({'opacity' : 1}, 200);
195			    }, 100);
196		    });
197	    }
198	}
199	
200	blogMasonrynoContainerGrid();
201
202
203	jQuery(document).on('click', 'header:not(.headerclone) .sliderbar-menu-controller, .hazel-push-sidebar .sliderbar-menu-controller', function (event) {
204		if (!jQuery('.hazel-push-sidebar').hasClass('opened')) {
205			window.bypassDefer = 0;
206			window.fromSlidingPanel = 1;
207			if (!jQuery('body').hasClass('page-template-blog-masonry-template') && !jQuery('body').hasClass('page-template-blog-masonry-grid-template')) jQuery(window).resize();
208		} else {
209			window.fromSlidingPanel = 1;
210			window.bypassDefer = 0;
211		}
212		if (typeof fixto == "object" && jQuery('.ult_stick_to_row').length > 0) {
213			var stickies_correct = setInterval(function(){
214				jQuery('.ult_stick_to_row').fixTo('refresh');
215			}, 10);
216		} 
217		jQuery('.hazel-push-sidebar').toggleClass('opened');
218		jQuery('.sliderbar-menu-controller .hamburguer-trigger-menu-icon').toggleClass('sidebar-opened');
219		jQuery('html,body').toggleClass('hazel-push-sidebar-opened'); 
220		setTimeout(function(){
221			if (!jQuery('.hazel-push-sidebar').hasClass('opened')) {
222				window.fromSlidingPanel = 0;
223				window.bypassDefer = 1;
224				if (!jQuery('body').hasClass('page-template-blog-masonry-template') && !jQuery('body').hasClass('page-template-blog-masonry-grid-template')) jQuery(window).resize();
225			} else {
226				window.fromSlidingPanel = 0;
227				window.bypassDefer = 0;
228			}
229			if (typeof fixto == "object" && jQuery('.ult_stick_to_row').length > 0){
230				jQuery('.ult_stick_to_row').fixTo('refresh');
231				clearInterval(stickies_correct);
232			}
233		},400);
234	});
235
236	jQuery(document).on('click', 'header.style7:not(.headerclone) .menu-trigger-button', function(){
237		jQuery(this).find('.hamburguer-trigger-menu-icon').add(jQuery('header')).toggleClass('menu-opened');
238	});
239
240    
241jQuery(function(){
242	
243	jQuery('.widget').each(function(){
244		if (!jQuery(this).children('h2').eq(0).children('span.widget_title_span').length) jQuery(this).children('h2').eq(0).wrapInner('<span class="widget_title_span" />');
245	});
246	
247	jQuery('.metas').each(function(){
248		if (jQuery(this).find('.tags').html() == ""){
249			jQuery(this).find('.tags').parent().remove();
250		}
251	});
252	
253	
254	/* dl-menu [mobile] */
255	jQuery('#dl-menu ul.dl-menu li').attr('id', 'mobile-'+jQuery('#dl-menu ul.dl-menu li').attr('id') );
256	jQuery('#dl-menu ul.dl-menu > li li:not(.dl-back)').removeAttr('class');
257	jQuery('#dl-menu ul.dl-menu ul').removeClass('sub-menu').addClass('dl-submenu-smart');
258	jQuery( '#dl-menu' ).dlmenu({
259		animationClasses : { classin : 'dl-animate-in-2', classout : 'dl-animate-out-2' }
260	});
261	jQuery('.dl-menu a').each(function(){ 
262		if (jQuery(this).siblings('ul').length){
263			jQuery(this).after('<span class="gosubmenu ion-chevron-right" />');
264		}
265		jQuery(this).on("click",function(e){
266			if (jQuery(this).attr('href').indexOf('http') > -1){
267				e.preventDefault(); e.stopPropagation(); window.location = jQuery(this).attr('href');
268			} else {
269				if ((jQuery(this).attr('href').indexOf('#section') > -1 && jQuery(this).attr('href') != '#section_page-0') || jQuery(this).attr('href')==="#home"){
270					e.preventDefault(); e.stopPropagation();
271					jQuery('html, body').animate({
272						scrollTop : jQuery(jQuery(this).attr('href')).offset().top - jQuery('body header').first().height()
273					},{
274						duration: 1200,
275						easing: 'easeInOutExpo',
276						complete: function(){
277							jQuery('.dl-trigger').trigger('click');
278						}
279					});
280				}
281			}
282		});
283	});
284	
285	/* MAIN MENU */
286	jQuery('.navbar-nav li').add(jQuery('.navbar-nav ul')).mouseenter(function(){
287		jQuery(this).closest('.main-menu-item').children('a').addClass('hover_selected');
288	}).mouseleave(function(){
289		if (!jQuery(this).closest('.main-menu-item > ul').is(':visible'))
290			jQuery(this).closest('.main-menu-item').children('a').removeClass('hover_selected');
291	});
292	
293	jQuery('.navbar-nav li').not('.menu-item-depth-1').removeClass('hazel_mega_hide_title').removeClass('hazel_mega_hide_link');
294	jQuery('.navbar-nav li.hazel_mega_hide_link > a').attr('href','#');
295	jQuery('.navbar-nav:not(#main_menu_outside) a:not(.outsider)').add(jQuery('.navbar-nav:not(#main_menu_outside) a.mainhomepage')).each(function(){
296		
297		jQuery(this).on("click",function(e){
298			
299			if (typeof Waypoint == "function") Waypoint.refreshAll();
300			
301			//exclude header style 6
302			if (jQuery(this).closest('.nav-style-6').length) return;
303			
304			var target = jQuery(this).attr('href'),
305				wpadminheight = jQuery('#wpadmin').length ? jQuery('#wpadmin').height() : jQuery('#wpadminbar').length ? jQuery('#wpadminbar').height() : 0;
306			
307			if (jQuery(this).attr('href').indexOf('://') < 0 && jQuery(jQuery(this).attr('href')).length){
308				e.preventDefault();
309				var whereTo = jQuery(jQuery(this).attr('href')).offset().top - jQuery('header.headerclone').height() - wpadminheight;
310				
311				if (jQuery(window).scrollTop() < 301 && whereTo > 301) {
312					jQuery('header.headerclone').addClass('header_after_scroll');
313					whereTo = jQuery(target).offset().top - parseInt(jQuery('header.headerclone').outerHeight(true)) - wpadminheight;
314				}
315				if (jQuery(this).children('.sub-arrow').length){
316					if (!jQuery(this).children('.sub-arrow').is(':hover')){
317						jQuery('html, body').animate({
318							scrollTop : whereTo+1
319						},{
320							duration: 1200,
321							easing: 'easeInOutExpo',
322							complete: function(){
323										 if (window.hazelOptions.hazel_update_section_titles == 'on' && jQuery(target).data('sectionTitle')){
324											 if (history && history.replaceState) history.replaceState({}, "", "#"+jQuery(target).data('sectionTitle')); 
325											 else window.location.hash = jQuery(target).data('sectionTitle');
326										 } 
327										 if (jQuery('.navbar-toggle').is(':visible')) jQuery('.navbar-toggle').trigger('click');
328									  }
329						})
330					    e.preventDefault();
331					}
332				} else {
333					jQuery('html, body').animate({
334						scrollTop : whereTo+1
335					},{
336						duration: 1200,
337						easing: 'easeInOutExpo',
338						complete: function(){
339									 if (window.hazelOptions.hazel_update_section_titles == 'on' && jQuery(target).data('sectionTitle')){
340										 if (history && history.replaceState) history.replaceState({}, "", "#"+jQuery(target).data('sectionTitle')); 
341										 else window.location.hash = jQuery(target).data('sectionTitle');
342									 } 
343									 if (jQuery('.navbar-toggle').is(':visible')) jQuery('.navbar-toggle').trigger('click');
344								  }
345					})
346				    e.preventDefault();
347				}	
348			}
349		});
350	});
351	
352	if (jQuery("body header").first().hasClass('hide-on-start')){
353		if (jQuery(document).scrollTop() > 200) jQuery("body header").first().addClass('nothidden');
354		else jQuery("body header").first().removeClass('nothidden');
355	}
356	
357	/* header related stuff */
358	if (jQuery('header').length && !jQuery('body.style9').length){
359		var theheader = jQuery("body header").first();
360		  if (theheader.hasClass('style4')){
361			  theheader.children().not('.top-bar').wrapAll('<div style="position:relative;" />');
362			var isstyle4 = true;
363			var howmanyitems = theheader.find('.navbar-nav > li').length;
364			if (howmanyitems > 1){
365				var itemsleft = Math.ceil(howmanyitems / 2) - howmanyitems % 2;
366				theheader.find('.new-menu-wrapper .new-menu-left .new-menu-bearer ul').append( theheader.find('.navbar-collapse .navbar-nav > li').eq(0).nextUntil(theheader.find('.navbar-collapse .navbar-nav > li').eq(itemsleft)).andSelf() );
367				theheader.find('.new-menu-wrapper .new-menu-right .new-menu-bearer ul').append( theheader.find('.navbar-collapse .navbar-nav > li') );
368				theheader.find('.new-menu-bearer').addClass('navbar-collapse');
369				theheader.find('.navbar-brand').insertAfter( theheader.find('.new-menu-left') );
370			}
371		}
372		
373		/* new header style8 */
374		if (theheader.hasClass('style8') || theheader.hasClass('style9')){
375			window.hazelOptions.hazel_header_after_scroll = "no";
376			window.hazelOptions.hazel_header_after_scroll_type2 = "no";
377			window.hazelOptions.hazel_header_shrink = "no";
378		}
379		
380		/* hideonstart stuff */
381		if (theheader.hasClass('hide-on-start') || window.hazelOptions.hazel_header_after_scroll_type2 == 'yes') {
382			window.hazelOptions.hazel_header_after_scroll = 'yes';
383			window.hazelOptions.hazel_header_shrink = 'no';
384		}
385	
386		var topbar = jQuery('header .top-bar');
387		topbar_height = 0;
388		//if (topbar.length) topbar_height = topbar.outerHeight(true) + 15;
389		
390		if (jQuery('header').hasClass('navbar-fixed-top')) {
391			var theheaderclone = theheader.clone();
392			jQuery(theheaderclone).addClass('headerclone').removeClass('header_after_scroll').find('.navbar-nav li, .dl-menu li').removeAttr('id');
393			jQuery(theheaderclone).find('#searchsubmit').removeAttr('id');
394			jQuery(theheaderclone).find('.top-bar').remove();
395	
396			jQuery(theheaderclone).insertAfter(theheader);
397			if (!theheader.hasClass('header_not_fixed')) theheader.css('position','fixed');
398		}
399		
400		var nav = jQuery(".nav-container");
401		
402		var downbutton = theheader.find('.down-button');
403		var logocontainer = theheader.find('.navbar-header');
404	
405		jQuery('header.headerclone').addClass('header_after_scroll');
406		var wpadminheight = jQuery('#wpadmin').length ? jQuery('#wpadmin').height() : jQuery('#wpadminbar').length ? jQuery('#wpadminbar').height() : 0,
407			waypoint_offset = -parseInt(jQuery('header.headerclone').outerHeight(true),10) - wpadminheight;
408		if (window.BrowserDetect.browser === "Firefox") waypoint_offset = -20;
409		
410		if (window.hazelOptions.hazel_header_after_scroll_type2 != 'no') jQuery('.headerclone').removeClass('header_after_scroll');
411		
412		var header_style_pre_scroll = header_style_after_scroll = "light";
413		if (theheader.data('rel') != ""){
414			header_style_pre_scroll = theheader.data('rel').split('|')[0];
415			header_style_after_scroll = theheader.data('rel').split('|')[1];
416		}
417		
418		var initialScroll = jQuery(document).scrollTop();
419		
420		if (window.hazelOptions.hazel_header_shrink == 'yes' || window.hazelOptions.hazel_header_after_scroll == 'yes'){
421			
422			var header_after_scroll_class = 'header_after_scroll';
423			if (window.hazelOptions.hazel_header_after_scroll_type2 == 'yes'){
424				
425				header_after_scroll_class = 'header_after_scroll_type2';
426				
427				// check for transparency
428				var isTransparent = false, values = "", changeFactor = .2;
429				if ( theheader.css('background-color') == 'transparent' ) isTransparent = true; // this one is kinda complex, but im fairly sure this case doesnt happen as will always get a rgba value.
430				if ( theheader.css('background-color').toString().indexOf('rgba') > -1 ){
431					
432					theheader.addClass('no_opacity_animation');
433					theheader.removeClass('header_force_opacity');
434					
435					var values = theheader.css('background-color').toString().replace('rgba(', '').replace(')','').split(',');
436					if ( parseInt( values.length > 3 && values[3], 10 ) == 0) isTransparent = true;
437					
438					theheader.addClass('header_force_opacity');
439					theheader.removeClass('no_opacity_animation');
440	
441					var pagePos = window.pageYOffset || window.scrollTop;
442					
443					if ( pagePos > Math.floor(jQuery(window).height()*changeFactor) ) theheader.addClass('header_force_opacity');
444					else theheader.removeClass('header_force_opacity');
445					
446				}
447				
448				jQuery('body:not(.page-template-template-side-nav) #main').each(function(i){ // substitui imagesload to each function
449					var lastScrollTop = window.pageYOffset || window.scrollTop;
450					var lastDir = 1;
451					var isChrome = window.BrowserDetect.browser === "Chrome" ? true : false;
452					var timeout = isChrome ? 50 : 1;
453					window.addEventListener( "scroll", function(e){ 
454						e.preventDefault(); e.stopPropagation();
455						// exits
456						
457						if (jQuery('body.opening-search').length ||
458							jQuery('header.waiting-for-anim').length || 
459							jQuery('header.header-init').length ||
460							jQuery('.cbp-popup-singlePageInline:not(.cbp-popup-singlePageInline-ready)').length ||
461							jQuery('.cbp-popup-singlePageInline-close').length) {
462							return;
463						} 
464						var st = window.pageYOffset || document.documentElement.scrollTop;
465						if (st > lastScrollTop){
466							// DOWN HIDE
467							if (lastDir == 1){
468								lastDir = 0;
469								theheader.addClass('waiting-for-anim');
470								setTimeout(function(){
471									if (jQuery('.dl-menu.dl-menuopen').is(':visible')) jQuery('.dl-trigger').trigger('click');
472									theheader.removeClass(header_after_scroll_class);
473									if (jQuery(window).width() > 767) topbar.css('margin-top','');
474									theheader.removeClass('waiting-for-anim');
475								}, timeout);
476							}
477						} else {
478							// UP SHOW
479							if (lastDir == 0){
480								lastDir = 1;
481								theheader.addClass('waiting-for-anim');
482								setTimeout(function(){
483									theheader.addClass(header_after_scroll_class);
484									// comment this line to always show top bar 
485									// if (jQuery(window).width() > 767) topbar.css('margin-top', -topbar.height());
486									
487									if (jQuery(window).width() < 768 && downbutton.hasClass('current')) downbutton.trigger('click');
488									theheader.removeClass('waiting-for-anim');
489								}, timeout);
490							}
491						}
492						lastScrollTop = st <= 0 ? 0 : st; // For Mobile or negative scrolling
493						
494						if (isTransparent){
495							if (st > Math.floor(jQuery(window).height()*changeFactor)) theheader.addClass('header_force_opacity');
496							else theheader.removeClass('header_force_opacity');
497						}
498						
499					}, Modernizr.passiveeventlisteners ? {passive: true} : false);
500				});
501				
502			} else {
503				jQuery('body').waypoint({
504					handler: function(event, direction) {
505						
506						if (event == 'up' && jQuery(document).scrollTop() < 301){
507							if (jQuery('.dl-menu.dl-menuopen').is(':visible')) jQuery('.dl-trigger').trigger('click');
508							var navheight = jQuery('header.headerclone').height();
509							/* hideonstart stuff */
510							if (theheader.hasClass('hide-on-start')) theheader.removeClass('nothidden');
511							else theheader.removeClass(header_after_scroll_class);
512							if (jQuery(window).width() > 767) topbar.css('margin-top','');
513							
514							theheader.removeClass(header_style_after_scroll).addClass(header_style_pre_scroll);
515						} else {
516							
517							theheader.addClass(header_after_scroll_class);
518							
519							/* hideonstart stuff */
520							if (theheader.hasClass('hide-on-start')) theheader.addClass('nothidden');
521					  
522							if (jQuery(window).width() > 767) topbar.css('margin-top', -topbar.height());
523							if (jQuery(window).width() < 768 && downbutton.hasClass('current')) downbutton.trigger('click');
524							
525							theheader.removeClass(header_style_pre_scroll).addClass(header_style_after_scroll);
526						}
527						correct_hazel_mega_menu();
528					},
529					offset: waypoint_offset+"px"
530				});
531			}
532			
533			if (window.hazelOptions.hazel_header_after_scroll_type2 == 'no') jQuery(document).scrollTop(0);
534			var pagePos = window.pageYOffset || window.scrollTop;
535			if ( pagePos > Math.floor(jQuery(window).height()/changeFactor) ) theheader.addClass('header_force_opacity');
536			  theheader.addClass(header_after_scroll_class);
537			  if (jQuery(window).width() > 767) topbar.css('margin-top','');
538			  
539			theheader.addClass(header_after_scroll_class);
540			if (jQuery(window).width() > 767) topbar.css('margin-top', -topbar.height());
541			if (jQuery(window).width() < 768 && downbutton.hasClass('current')) downbutton.trigger('click');
542	
543			jQuery('.hide-on-start').addClass('hidestartready');
544			if (window.hazelOptions.hazel_header_after_scroll_type2 == 'no') jQuery(document).scrollTop(initialScroll);
545			if (initialScroll < 301 && !theheader.hasClass('hide-on-start') && window.hazelOptions.hazel_header_after_scroll_type2 == 'no') jQuery('header').removeClass(header_after_scroll_class);
546			if (initialScroll < 301 && theheader.hasClass('hide-on-start')) theheader.removeClass('nothidden');
547			if (initialScroll < 301 && jQuery(window).width() > 767 ) topbar.css('margin-top','');
548		} else {
549			if (theheader.hasClass('style8') || theheader.hasClass('style9')) jQuery('header').removeClass('header_after_scroll');
550		}
551		correct_hazel_mega_menu();
552		if (isstyle4) jQuery('.navbar-brand').css('opacity',1);
553		jQuery('.homepage_parallax .home-text-wrapper').removeClass('notready');
554		jQuery('.nav > li').css('pointer-events','auto');
555		
556		jQuery('header').removeClass('header-init');
557	}
558	
559	/* TERMINA AQUI O HEADER */
560	
561	
562	if (jQuery('section.page_content').length > 1){
563		var sections = jQuery("body > #main > section");
564		var navigation_links = jQuery("a.menu-link");
565		var wpadminheight = jQuery('#wpadmin').length ? jQuery('#wpadmin').height() : jQuery('#wpadminbar').length ? jQuery('#wpadminbar').height() : 0;
566	
567		sections.waypoint({
568			handler: function(event, direction) {
569				//if (!window.scrollHappened) window.scrollHappened = true;
570				var active_section;
571				active_section = typeof jQuery(this)[0].element != "undefined" ? jQuery(jQuery(this)[0].element) : jQuery(this);
572
573				if (event === "up" && active_section.prevAll('section').first().length != 0) active_section = active_section.prevAll('section').first();
574				if (active_section.hasClass('content_from_homepage_template')) active_section = active_section.prevAll('section').first();
575				
576				var active_link = jQuery('a.menu-link[href="#' + active_section.attr("id") + '"]');
577				var sectionTitle = active_section.data('sectionTitle') ? active_section.data('sectionTitle') : active_link.eq(0).text();
578				
579				navigation_links.removeClass("selected hover_selected").parent().removeClass('current-menu-item');
580				active_link.addClass("selected hover_selected");
581				if (window.hazelOptions.hazel_update_section_titles == 'on' && jQuery('body > #main > section').length > 2){
582					if (history && history.replaceState) history.replaceState({}, "", "#"+sectionTitle); 
583					else window.location.hash = sectionTitle;
584				} 
585			},
586			offset: parseInt(jQuery('header.headerclone').height() + wpadminheight,10)+2+'px'
587		});
588	}
589	
590	//ajax search
591	var form = jQuery('.hazel_search_input.search_input');
592	var search_ajaxing = null;
593	jQuery('header:not(.headerclone) .search_trigger, header:not(.headerclone) .search_trigger_mobile').on("click",function(){
594		jQuery('.hazel_search_input.search_input').addClass('open');
595		setTimeout(function(){ 
596			jQuery('.hazel_search_input .search_input_value').focus();
597		}, 1500);
598	});
599	jQuery(document).on('click', '.hazel_search_input .search_close', function(){
600		form.find('.ajax_search_results ul').html("");
601		jQuery('.hazel_search_input.search_input').removeClass('open');
602		jQuery('.hazel_search_input.search_input input').blur().val('');
603	});
604	
605		
606	if (window.hazelOptions.hazel_enable_ajax_search == "on"){
607		jQuery('body > .search_input input.search_input_value').keydown(function(e){
608			switch (e.which){
609				case 27:
610					//esc key. close the results.
611					if (form.find('.ajax_search_results ul').html() == "") form.find('.search_close').trigger('click');
612					form.find('.ajax_search_results ul').html("");
613					clearTimeout(jQuery.data(form, des_search_timer));
614				break;
615				case 38:
616					//up key, navigate up on the results
617					e.preventDefault(); e.stopPropagation();
618					if (form.find('li.selected').prev().length){
619						form.find('li.selected').removeClass('selected').prev().addClass('selected');
620						// is out of the ul visual field? scroll the ul down
621					}
622					if (form.find('li.selected').position().top < 40){
623						form.find('ul').stop().animate({
624							"scrollTop": form.find('ul').scrollTop()-40
625						}, 100);
626					}
627					clearTimeout(jQuery.data(form, des_search_timer));
628				break;
629				case 40:
630					//down key, navigate up on the results	
631					e.preventDefault(); e.stopPropagation();
632					if (form.find('li.selected').next().length){
633						form.find('li.selected').removeClass('selected').next().addClass('selected');
634						// is out of the ul visual field? scroll the ul down
635					}
636					if (form.find('li.selected').position().top+80 > form.find('ul').height()){
637						form.find('ul').stop().animate({
638							"scrollTop": form.find('ul').scrollTop()+40
639						}, 100);
640					}
641					clearTimeout(jQuery.data(form, des_search_timer));
642				break;
643				case 13:
644					//enter key. if some result is selected shows the one.
645					if (form.find('li.selected').length){
646						e.preventDefault(); e.stopPropagation();
647						window.location = form.find('li.selected a').attr('href');
648					}
649					clearTimeout(jQuery.data(form, des_search_timer));
650				break;
651				case 37: case 39: case 27: case 29: case 17: case 18: case 9: case 16: case 20: case 91: case 93: case 36: case 35: case 33: case 34: case 144: case 145: case 19: case 112: case 113: case 114: case 115: case 116: case 117: case 118: case 119: case 120: case 121: case 122: case 123:
652					//ignore keys like left and right arrows, ctrl, alt, shift, F[1-12], home, insert, etc etc etc
653					clearTimeout(jQuery.data(form, des_search_timer));
654				break;
655				default:
656					clearTimeout(jQuery.data(form, des_search_timer));
657					var des_search_timer = setTimeout(function(){
658						if (form.find('.search_input_value').val().length > 0){
659							if (search_ajaxing != null){
660								search_ajaxing.abort();
661								search_ajaxing = null;
662							}
663							form.find('.search_close div').attr('class','fa fa-spinner desrotating').on("mouseenter",function(){ jQuery(this).attr('class','icon dripicons-cross'); }).on("mouseleave", function(){ jQuery(this).attr('class','fa fa-spinner desrotating'); });
664							
665							search_ajaxing = jQuery.ajax({
666								type: 'POST',
667								dataType: 'JSON',
668								url: ajaxurl,
669								data: {
670									action : 'call_treethemes_search_ajax',
671									se: window.hazelOptions.searcheverything,
672									query: form.serialize().substr(2),
673									wpml_lang: window.hazelOptions.hazel_wpml_current_lang,
674									dataType: 'JSON',
675									security: jQuery('#hazel-theme-search').val()
676								},
677								success: function(data){
678									form.find('.search_close div').attr('class','icon dripicons-cross').unbind('hover');
679									form.find('.ajax_search_results ul').html(data.data);
680									form.find('ul').stop().animate({
681										"scrollTop": 0
682									}, 100);
683									if (form.find('li.selected').length){
684										form.find('.ajax_search_results ul').css('overflow-y','scroll').children().each(function(){
685											jQuery(this).mouseover(function(){
686												jQuery(this).addClass('selected').siblings().removeClass('selected');
687											});
688										});
689									}
690								}
691							});	
692						} else {
693							clearTimeout(jQuery.data(form, des_search_timer));
694							form.find('.search_close div').attr('class','icon dripicons-cross').unbind('hover');
695							if (search_ajaxing != null){
696								search_ajaxing.abort();
697								search_ajaxing = null;
698							}
699							form.find('.ajax_search_results ul').html("").css('overflow-y','visible');
700						}
701					}, 100);
702				break;
703			}
704		});	
705	} else {
706		jQuery('body > .search_input input.search_input_value').keydown(function(e){
707			if (e.which === 27){
708				//esc key. close the results.
709				form.find('.search_close').trigger('click');
710			}
711		});
712	}
713});
714
715function randomXToY(minVal,maxVal,floatVal){
716  var randVal = minVal+(Math.random()*(maxVal-minVal));
717  return typeof floatVal=='undefined'?Math.round(randVal):randVal.toFixed(floatVal);
718}
719
720jQuery(window).resize(function(event){
721	if (jQuery('html,body').hasClass('hazel-push-sidebar-opened') && !window.fromSlidingPanel){
722		jQuery('.hazel-push-sidebar').add(jQuery('header:not(.headerclone)')).add(jQuery('body > #main')).addClass('none-transition');
723		jQuery('html,body').removeClass('hazel-push-sidebar-opened');
724		jQuery('.hazel-push-sidebar').removeClass('opened');
725		jQuery('.sliderbar-menu-controller .hamburguer-trigger-menu-icon').removeClass('sidebar-opened');
726	} else {
727		jQuery('.hazel-push-sidebar').add(jQuery('header:not(.headerclone)')).add(jQuery('body > #main')).removeClass('none-transition');
728	}
729	
730	correct_hazel_mega_menu();
731	if (!window.fromSlidingPanel){
732		if (jQuery(window).width() > 767){
733			if (jQuery(window).scrollTop() < 301) jQuery('header').eq(0).find('.top-bar').css('margin-top','');
734			else jQuery('header').eq(0).find('.top-bar').css('margin-top', -jQuery('header').eq(0).find('.top-bar').height());
735		} else {
736			jQuery('header').eq(0).find('.top-bar').css('margin-top','');
737		}
738	}
739	
740	if (typeof Waypoint === "function") Waypoint.refreshAll();
741});
742
743jQuery(window).on("load", function(){
744	
745	window.isWLoaded = true;
746	
747	
748	
749	
750	/* Revome titulos das setas */
751	jQuery(".cbp-popup-next").removeAttr("title");
752	
753	jQuery('a.nav-to[href*="#"]').not('[href="#"]').add(jQuery('div.nav-to')).add(jQuery('button.nav-to')).add(jQuery('span.nav-to')).each(function() {
754		var $this = jQuery(this).is('a') ? jQuery(this) : jQuery(this).find('a').first();
755		var isMenu = ($this.parents('.navbar').length) ? true : false;
756		if ($this.children('.sub-arrow').length){
757			$this.on("click",function(e){
758				e.preventDefault();
759				var target = jQuery(this.hash),
760					wpadminheight = jQuery('#wpadmin').length ? jQuery('#wpadmin').height() : jQuery('#wpadminbar').length ? jQuery('#wpadminbar').height() : 0;
761			    target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']');
762			    
763			    var whereTo = jQuery(jQuery(this).attr('href')).offset().top - jQuery('header.headerclone').height() - wpadminheight /* + top_bar_factor */;
764				if (jQuery(window).scrollTop() < 301 && whereTo > 301) {
765					jQuery('header.headerclone').addClass('header_after_scroll');
766					whereTo = target.offset().top - parseInt(jQuery('header.headerclone').outerHeight(true)) - wpadminheight + jQuery('header.headerclone .top-bar').height() ;
767			    }
768			    if (target.length) {
769					if (!$this.children('.sub-arrow').is(':hover')){
770						jQuery('html,body').animate({
771				          scrollTop: whereTo+1
772				        }, {
773					        duration: 1200,
774					        easing: "easeOutQuad",
775					        complete: function(){
776						        if (window.hazelOptions.hazel_update_section_titles == 'on' && target.data('sectionTitle')){
777							        if (history && history.replaceState) history.replaceState({}, "", "#"+target.data('sectionTitle')); 
778									else window.location.hash = target.data('sectionTitle');
779						        } 
780						        if (jQuery('.navbar-toggle').is(':visible') && isMenu){
781							        jQuery('.navbar-toggle').trigger('click');
782						        } 
783					        }
784				        });
785					}
786				}
787			});
788		} else {
789			$this.on("click",function(e){
790				e.preventDefault();
791				var target = jQuery(this.hash),
792					wpadminheight = jQuery('#wpadmin').length ? jQuery('#wpadmin').height() : jQuery('#wpadminbar').length ? jQuery('#wpadminbar').height() : 0;
793			    target = target.length ? target : jQuery('[name=' + this.hash.slice(1) +']');
794			    var whereTo = jQuery(jQuery(this).attr('href')).offset().top - jQuery('header.headerclone').height() - wpadminheight /* + top_bar_factor */;
795				if (jQuery(window).scrollTop() < 301 && whereTo > 301) {
796					jQuery('header.headerclone').addClass('header_after_scroll');
797					whereTo = target.offset().top - parseInt(jQuery('header.headerclone').outerHeight(true)) - wpadminheight + jQuery('header.headerclone .top-bar').height() ;
798			    }
799			    if (target.length) {
800					jQuery('html,body').animate({
801					  scrollTop: whereTo+1
802					}, {
803						duration: 1200,
804						easing: "easeOutQuad",
805						complete: function(){
806							if (window.hazelOptions.hazel_update_section_titles == 'on' && target.data('sectionTitle')){
807								if (history && history.replaceState) history.replaceState({}, "", "#"+target.data('sectionTitle')); 
808								else window.location.hash = target.data('sectionTitle');
809							} 
810							if (jQuery('.navbar-toggle').is(':visible') && isMenu){
811								 jQuery('.navbar-toggle').trigger('click');
812							}
813						}
814					});			    
815			    }
816			});
817		}
818    });
819	
820	/* grayscale effect on images. */
821	if (window.hazelOptions.hazel_grayscale_effect == "on") {
822		jQuery('img').each(function(){
823			if (!jQuery(this).closest('.gm-style').length && !jQuery(this).parent().hasClass('navbar-brand') && !jQuery(this).closest('rev_slider').length && !jQuery(this).closest('#big_footer').length){
824				jQuery(this).addClass('hazel_grayscale');
825			}
826		});
827		if (jQuery('a.cbp-l-loadMore-link:not(.cbp-l-loadMore-stop)').length){
828			jQuery('a.cbp-l-loadMore-link').on("click",function(){
829				if (!jQuery(this).hasClass('cbp-l-loadMore-stop')){
830					var thisLoadMore = jQuery(this);
831					var treethemesInitialCubeItems = jQuery(this).parent().parent().siblings('.cbp').find('img').length;
832					var treethemesCheckForNewCubeItems = setInterval(function(){
833						if (thisLoadMore.parent().parent().siblings('.cbp').find('img').length > treethemesInitialCubeItems){
834							clearInterval(treethemesCheckForNewCubeItems);
835							thisLoadMore.parent().parent().siblings('.cbp').find('img:not(.hazel_grayscale)').addClass('hazel_grayscale');
836						}
837					}, 200);	
838				}
839			});
840		}
841	}
842	
843	/* grayscales only on thumbnails*/
844	if (window.hazelOptions.hazel__portfolio_grayscale_effect == "on") {
845		jQuery('.cbp-wrapper img').each(function(){
846			jQuery(this).addClass('hazel_grayscale');
847			
848		});
849	}
850	
851	/* grayscales only on thumbnails*/
852	if (window.hazelOptions.hazel__instagram_grayscale_effect == "on") {
853		jQuery('.cbp-wrapper img').each(function(){
854			jQuery(this).addClass('hazel_grayscale');
855			
856		});
857	}
858	
859	correct_hazel_mega_menu();
860	
861	if (window.BrowserDetect.isModernIE) setTimeout(function(){ jQuery('header .search_trigger, header .menu-control
861s, header .hazel_dynamic_shopping_bag, .header_social_icons.with-social-icons').css('display','table-cell'); }, 1000);
862	
863	jQuery(window).trigger('resize'); 
864	if (window.treethemesOrigHash && !window.scrollHappened && window.isWLoaded) {
865		var sectionid = window.treethemesOrigHash;
866		if (jQuery('section[data-section-title="'+sectionid.substr(1)+'"]').length) {
867			sectionid = "#"+jQuery('section[data-section-title="'+sectionid.substr(1)+'"]').attr('id');
868		}
869		if (jQuery('header:not(.headerclone) .navbar-collapse a[href="'+sectionid+'"]').length && !window.treethemesWaitOnRev && !window.treethemesWaitOnTabs && window.isDLoaded){
870			setTimeout(function(){
871				jQuery(window).trigger('resize'); 
872				if (typeof Waypoint == "function") Waypoint.refreshAll();
873				window.scrollHappened = true;
874				jQuery('header:not(.headerclone) .navbar-collapse a[href="'+sectionid+'"]').trigger('click');  
875			}, 1000);
876		}
877		if (window.hazelOptions.hazel_update_section_titles === "off" && window.location.hash != "" && !jQuery('body').hasClass('page-template-template-side-nav')){
878			if (history && history.replaceState) history.replaceState({}, "", "#"); 
879			else window.location.hash = "";
880		} 
881	} else {
882		if (window.hazelOptions.hazel_update_section_titles === "off" && window.location.hash != "" && !jQuery('body').hasClass('page-template-template-side-nav')){
883			if (history && history.replaceState) history.replaceState({}, "", "#"); 
884			else window.location.hash = "";
885		}
886	}
887	
888});
889
890jQuery(document).ready(function(){
891	"use strict";
892	window.isDLoaded = true;
893	jQuery(document).trigger('treethemesDLoad');
894	
895	jQuery('header:not(.headerclone) .menu_style5_bearer > .hazel-header-button').appendTo(jQuery('header:not(.headerclone) .menu_style5_bearer > ul'));
896		
897	if (window.BrowserDetect.browser === "Explorer" && window.BrowserDetect.version == 9){
898		/* disable address update */
899		window.hazelOptions.hazel_update_section_titles = 'off';
900		/* merge inline css and js from vc rows and what not. explora */
901		if (jQuery('style').length){
902			var inlineStyles = ""; 
903			jQuery('style').each(function(){ 
904				if (jQuery(this).html()){
905					inlineStyles += jQuery(this).html()+"\n"; 
906					jQuery(this).remove(); 	
907				}
908			});
909			jQuery('body').append('<style class="css-merged-for-ie">'+inlineStyles+'</style>' );
910		}
911	}
912	
913	if(navigator.userAgent.match(/Trident\/7\./)) { // if IE
914		window.usesDocumentElement = false;
915		var scrollControl = document.body.scrollTop;
916		document.body.scrollTop = scrollControl != 1 ? 1 : 2;
917		if (scrollControl == document.body.scrollTop) window.usesDocumentElement = true;
918		else document.body.scrollTop = scrollControl;
919		
920		jQuery('html').css({ 'height' : '0px', 'overflow' : 'visible' });
921		jQuery('body').on("scroll", function (event) {
922			// remove default behavior
923			event.preventDefault(); 
924			//scroll without smoothing
925			var wheelDelta = event.wheelDelta ? event.wheelDelta : event.originalEvent.wheelDelta;
926			var currentScrollPosition = window.pageYOffset;
927			treethemesScrollTo(currentScrollPosition - wheelDelta, 500);
928		});
929	}
930	
931	jQuery('select:not(.hazel-push-sidebar-content select)').selectWoo();
932		
933	jQuery('.simpleselect').parent('p').css({'position':'relative','z-index':9});
934		
935	//window.scrollHappened = false;
936	if (jQuery('.navbar-brand img').length > 0) {
937		window.logoIsImage = true
938		window.logoReady = false;
939	}
940	
941	if (jQuery('#hazel_website_load').length){
942		QueryLoader2(document.querySelector("body"), {
943			barColor: "#000",
944	        backgroundColor: "#fff",
945	        percentage: true,
946	        barHeight: 1,
947	        completeAnimation: "fade",
948	        deepSearch: true,
949	        minimumTime: 500,
950	        onComplete: function(){
951		        jQuery('#hazel_website_load').fadeOut(1000, function(){
952    		        jQuery(this).remove();
953    	        });
954	        }
955		});
956	}
957
958	
959	/* wrap the contents minding the fullwiths [NEW STUFF - check problems after with components fullwidth like for instance the projects]  */
960	jQuery('.page_content').each(function(){
961		if (jQuery(this).find('.fullwidth-section').length){
962		
963			if (jQuery('.fullwidth-section > .video-container video').length){
964				jQuery('.fullwidth-section > .video-container video').add(jQuery('.fullwidth-section > .video-container .wp-video-shortcode')).attr('height','').attr('width','').removeAttr('height').removeAttr('width').css('width','100vw');
965			}
966		} 
967		jQuery(window).trigger('resize');
968	});
969	/* endof wrap the contents minding the fullwiths */
970
971	/* icon services new effect from hazel */
972	jQuery('.aio-icon-tooltip .aio-icon, .aio-icon-tooltip .aio-icon-img').each(function(){
973		jQuery(this).on("mouseenter",function(){
974			jQuery(this).closest('.aio-icon-tooltip').siblings('.aio-icon-description').addClass('visible');
975		}).on("mouseleave", function(){
976			jQuery(this).closest('.aio-icon-tooltip').siblings('.aio-icon-description').stop().animate({
977				opacity:1
978			}, 100, function(){
979				jQuery(this).removeClass('visible');
980			});
981		});
982	});
983	
984	
985	jQuery('.tooltip').css('visibility','hidden');
986	jQuery('.socialiconsshortcode li a').trigger('mouseover').trigger('mouseout');
987	setTimeout(function(){
988		jQuery('.tooltip').css('visibility','visible');
989	}, 500);
990
991	
992	if (jQuery('#lang_sel a.lang_sel_sel, #lang_sel_click a.lang_sel_sel').length){
993		jQuery('#lang_sel a.lang_sel_sel, #lang_sel_click a.lang_sel_sel').prepend('<i class="fa fa-globe" style="left:0px;"></i>');
994	}
995	
996	/* remove brs from the new non-visual shortcodes */
997	jQuery('.main_cols.container > br').remove();
998
999	/*InEx*/
1000	if (window.BrowserDetect.browser === "Explorer"){
1001		jQuery('.info_above_menu .telephone i, .info_above_menu .email i, .info_above_menu .address i').css('vertical-align', 'middle');	
1002	}
1003
1004	if (jQuery('#mc-embedded-subscribe').length){
1005		jQuery('#mc-embedded-subscribe').on("click",function(e){
1006			if (!hazel_validate_email(jQuery('#mce-EMAIL').val())){
1007				e.stopPropagation();
1008				e.preventDefault();
1009				jQuery('#mce-EMAIL').css({'border':'1px solid #D07F7F', 'color':'#D07F7F'}).val('Please insert a valid email');
1010				jQuery('#mce-EMAIL').focus(function(){
1011					jQuery(this).val('');
1012					jQuery(this).css({
1013						'border':'none',
1014						'color': 'rgb(192, 191, 191)'
1015					});
1016				});
1017				return false;
1018			}
1019		});
1020	}
1021		
1022	if (window.BrowserDetect.browser == "iPhone")
1023		jQuery('.acc-substitute .pane p, #accordion .pane p').css({ 'font-size': '11px' });
1024	
1025	if (jQuery(".container .vendor").length) jQuery(".container .vendor").fitVids();
1026				
1027	/* search widget top */
1028	if (jQuery('.search_toggler')){
1029		jQuery('.search_toggler').each(function(){
1030			jQuery(this)
1031				.unbind('click')
1032				.on('click', function(){
1033					if (jQuery(this).siblings('#s').hasClass('search_close')){
1034						jQuery(this).siblings('#s').toggleClass('search_close');
1035						jQuery(this).parents('#searchform').removeClass('ie_searcher_close').addClass('ie_searcher_open');
1036						jQuery(this).siblings('#s').trigger('focus');
1037					} else {
1038						if (jQuery(this).siblings('#s').val() == jQuery(this).siblings('.search_box_text').html()){
1039							jQuery(this).siblings('#s').toggleClass('search_close');
1040							jQuery(this).parents('#searchform').removeClass('ie_searcher_open').addClass('ie_searcher_close');
1041						} else {
1042							jQuery(this).siblings('#searchsubmit').trigger('click');
1043						}
1044					}
1045				});
1046		});	
1047	}
1048	
1049	/*special tabs stuff*/
1050	treethemes_special_tabs();
1051	
1052	if (jQuery(".player").length) { 
1053		jQuery(".player").each(function(){ 
1054			jQuery(this).mb_YTPlayer();  
1055			jQuery(this).on('YTPStart', function(){ 
1056				jQuery(this).YTPPlay();
1057				if (jQuery(this).parent().is('.homepage_parallax')) jQuery('#parallax-home').after(jQuery('#parallax-home .mb_YTPBar').css({'position':'relative','bottom':'3px'}));
1058			});
1059		}); 
1060	}
1061	
1062	if (!isMobile.any()){
1063		if ((window.BrowserDetect.browser == "Mozilla" && window.BrowserDetect.version == 11) || (window.BrowserDetect.browser == "Explorer" && window.BrowserDetect.version < 11)){
1064			//do nothing for now.
1065		} else jQuery.stellar({responsive: true,  scrollProperty: 'scroll', positionProperty: 'transform', hideDistantElements: false, horizontalScrolling:false});
1066	}
1067
1068	var browserprefix = "";
1069	switch (window.BrowserDetect.browser){
1070		case "Chrome" : case "Safari" : browserprefix = "-webkit-"; break;
1071		case "Firefox" : browserprefix = "-moz-"; break;
1072	}
1073	jQuery('.slick-list.draggable .slick-slide').css({
1074		'cursor': browserprefix+'grab'
1075	}).mousedown(function(){
1076		jQuery(this).css({
1077			'cursor': browserprefix+'grabbing'
1078		});
1079	}).mouseup(function(){
1080		jQuery(this).css({
1081			'cursor': browserprefix+'grab'
1082		});
1083	});
1084	
1085	/* SCROLL TOP BUTTON */
1086	jQuery("#back-top").hide();
1087	
1088	jQuery(window).scroll(function () {
1089		if (jQuery(this).scrollTop() > 301) {
1090			jQuery('#back-top').fadeIn();
1091		} else {
1092			jQuery('#back-top').fadeOut();
1093		}
1094	});
1095
1096	jQuery('#back-top a').on("click",function () {
1097		jQuery('body,html').animate({
1098			scrollTop: 0
1099		}, 600);
1100		return false;
1101	});
1102	
1103	/* cube filters helper */
1104	jQuery('.cbp-l-filters-list.des-align-center').children().wrapAll('<div class="filters_helper" style="float:left;" />');
1105		
1106	jQuery('header:not(.headerclone) .nav-container, .header_style8_left .navbar-collapse, .header_style9_left .navbar-collapse').on('mouseenter', function(){ correct_hazel_mega_menu(); });
1107		
1108	jQuery('header .navbar-nav > li:not(.hazel_mega_menu) li, header .navbar-nav > li:not(.hazel_mega_menu) li').each(function(){
1109		hazel_check_menu_right_frontier(jQuery(this));
1110	});
1111	
1112	jQuery(window).resize(function(){
1113		jQuery('header .navbar-nav > li:not(.hazel_mega_menu) li, header .navbar-nav > li:not(.hazel_mega_menu) li').each(function(){
1114			hazel_check_menu_right_frontier(jQuery(this));
1115		});
1116	});
1117	
1118	jQuery('.hazel_dynamic_shopping_bag').siblings('.search_trigger').addClass('next-to-shopping-bag');
1119	jQuery('.hazel_dynamic_shopping_bag').siblings('.menu-controls').addClass('menu-next-to-shopping-bag');
1120		
1121	if (jQuery('#big_footer').hasClass('reveal-footer')){ 
1122		jQuery('#big_footer').footerReveal();
1123	}
1124	
1125	// next / previous nav on singles [post & project]
1126	jQuery(document).on('click','.single #nav-below div.nav-previous, .single #nav-below div.nav-next', function(e){
1127		window.location = jQuery(this).find('a').prop('href');
1128	});
1129	
1130	/* top bar - previously on headers */
1131	if (jQuery('header .top-bar').length > 0){
1132		if (jQuery(window).width() > 768) {
1133			jQuery("a.down-button").removeClass("current");
1134			jQuery(".slidedown").removeAttr("style");
1135		}
1136		jQuery("a.down-button").on("click", function () {
1137		  if (jQuery(this).hasClass("current")) {
1138			  jQuery(this).removeClass("current");
1139			  jQuery(this).parent().parent().find(".slidedown").slideUp("slow", function(){ jQuery(this).closest(".top-bar").removeClass("opened"); });
1140			  return false;
1141		  } else {
1142			  jQuery(this).addClass("current").closest(".top-bar").addClass("opened");
1143			  jQuery(this).parent().parent().find(".slidedown").slideDown("slow");
1144			  return false;
1145		  }
1146		});
1147		jQuery(window).resize(function(){
1148			if (jQuery(window).width() > 768) {
1149				jQuery("a.down-button").removeClass("current");
1150				jQuery(".slidedown").removeAttr("style");
1151			}
1152		});
1153	}
1154	
1155	if (jQuery('body.page-template-template-under-construction').length && typeof vc_js == 'function'){
1156		vc_js();
1157	}
1158	
1159	if (jQuery('#secondary.widget-area.four.columns.alpha').length && !jQuery('#secondary.widget-area.four.columns.alpha').text().trim().length){
1160		jQuery('#secondary.widget-area.four.columns.alpha').closest('.col-md-3').siblings('.col-md-9').removeClass('col-md-9').addClass('col-md-12').siblings('.col-md-3').remove();
1161	}
1162	
1163	/* 2020 header style9 related */
1164	jQuery(document).on("click", ".hazel_menu_trigger .menu_trigger", function(){
1165		if (jQuery(".hazel_menu_trigger").is(".menu-opened")){
1166			jQuery(".header_style9_left_container .mobile-opened").removeClass("mobile-opened");
1167			jQuery(".hazel_menu_trigger, .hazel_menu_trigger .hamburguer-trigger-menu-icon").removeClass("menu-opened");
1168		} else {
1169			jQuery(".hazel_menu_trigger, .hazel_menu_trigger .hamburguer-trigger-menu-icon").addClass("menu-opened");
1170		}
1171	});
1172	
1173	jQuery(document).on("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend", ".header_style9_left_container", function(){
1174		if (jQuery(".hazel_menu_trigger").is(".menu-opened")){
1175			//correct_hazel_mega_menu();
1176			setTimeout(function(){
1177				jQuery(".header_style9_left_container").addClass("overflowVisibleHelper");
1178			}, 150);
1179		} else {
1180			setTimeout(function(){
1181				jQuery(".header_style9_left_container").removeClass("overflowVisibleHelper");
1182			}, 250);
1183		}
1184		jQuery(".slick-slider").each(function(){ jQuery(this).slick("getSlick").setPosition(jQuery(this).slick("getSlick").currentSlide); });
1185		
1186	});
1187	
1188	if (window.treethemesOrigHash) {
1189		var sectionid = window.treethemesOrigHash;
1190		if (jQuery('section[data-section-title="'+sectionid.substr(1)+'"]').length) {
1191			sectionid = "#"+jQuery('section[data-section-title="'+sectionid.substr(1)+'"]').attr('id');
1192		}
1193		if (jQuery('header:not(.headerclone) .navbar-collapse a[href="'+sectionid+'"]').length && jQuery('#home.revslider rs-module').length){
1194			var auxrevapi = jQuery('#'+ jQuery('#home.revslider rs-module').prop('id') );
1195			
1196			window.treethemesWaitOnRev = true;
1197			jQuery(document).scrollTop(0);
1198			auxrevapi.one("revolution.slide.onloaded", function(){
1199				window.treethemesWaitOnRev = false;
1200				if (window.isWLoaded && !window.scrollHappened && !window.treethemesWaitOnTabs){
1201					setTimeout(function(){ 
1202						jQuery(window).trigger('resize'); 
1203						if (typeof Waypoint == "function") Waypoint.refreshAll();
1204						jQuery('header:not(.headerclone) .navbar-collapse a[href="'+sectionid+'"]').trigger('click'); 
1205						window.scrollHappened = true;
1206						if (window.hazelOptions.hazel_update_section_titles === "off" && window.location.hash != "" && !jQuery('body').hasClass('page-template-template-side-nav')){
1207							if (history && history.replaceState) history.replaceState({}, "", "#"); 
1208							else window.location.hash = "";
1209						} 
1210					}, 100);
1211				}
1212			}); 
1213		}
1214	}
1215	
1216	
1217	/* 2021 header style9 on mobile related stuff */
1218	jQuery('.current-menu-item:not(.menu-item-depth-0), .current-menu-parent:not(.current-menu-item), .current-menu-ancestor:not(.current-menu-item)').addClass('mobile-opened');
1219	jQuery(document).on("click", ".header_style9_left_container li", function(e){
1220		e.stopPropagation();
1221		if (jQuery(window).width() < 767){
1222			if (!jQuery(this).hasClass('menu-item-has-children')) return;
1223			if (jQuery(this).hasClass('mobile-opened')) jQuery(this).add(jQuery(this).find('.mobile-opened')).removeClass('mobile-opened');
1224			else jQuery(this).addClass('mobile-opened').siblings('.mobile-opened').removeClass('mobile-opened');
1225		}
1226	});
1227	
1228});
1229
1230jQuery(document).one('treethemes_st_ready', function(){
1231	if (window.isWLoaded && !window.scrollHappened && window.treethemesOrigHash){
1232		var sectionid = window.treethemesOrigHash;
1233		if (jQuery('section[data-section-title="'+sectionid.substr(1)+'"]').length) {
1234			sectionid = "#"+jQuery('section[data-section-title="'+sectionid.substr(1)+'"]').attr('id');
1235		}
1236		jQuery('header:not(.headerclone) .navbar-collapse a[href="'+sectionid+'"]').trigger('click'); 
1237		window.scrollHappened = true;
1238		if (window.hazelOptions.hazel_update_section_titles === "off" && window.location.hash != "" && !jQuery('body').hasClass('page-template-template-side-nav')){
1239			if (history && history.replaceState) history.replaceState({}, "", "#"); 
1240			else window.location.hash = "";
1241		} 
1242	}
1243});
1244
1245function treethemesScrollTo( to, duration ) {
1246	
1247	var element = window.usesDocumentElement ? document.documentElement : document.body,
1248		start = element.scrollTop,
1249		change = to - start,
1250		currentTime = 0,
1251		increment = 20;
1252
1253	var animateScroll = function(){
1254			currentTime += increment;
1255			var val = Math.easeInOutCubic(currentTime, start, change, duration);
1256			element.scrollTop = val;
1257			window.pageYOffset = val;
1258			if(currentTime < duration) {
1259				setTimeout(animateScroll, increment);
1260			}
1261		};
1262
1263	animateScroll();
1264}
1265
1266//t = current time
1267//b = start value
1268//c = change in value
1269//d = duration
1270Math.easeInOutCubic = function (t, b, c, d) {
1271	t /= d/2;
1272	if (t < 1) return c/2*t*t*t + b;
1273	t -= 2;
1274	return c/2*(t*t*t + 2) + b;
1275};
1276
1277
1278function treethemes_special_tabs(fromcube){
1279	
1280	if (typeof fromcube == "undefined") fromcube = false;
1281	if (jQuery('.special_tabs:not(.special_tabs_ready)').length){
1282	
1283		jQuery('.special_tabs:not(.special_tabs_ready)').each(function(e){
1284		
1285			jQuery(this).addClass('st-'+e);
1286			var el = jQuery('.st-'+e);
1287			
1288			jQuery(el).children("p, br").remove();
1289
1290			jQuery(el).find('.label').appendTo(jQuery(el).children('.tab-selector'));
1291			jQuery(el).find('.content').appendTo(jQuery(el).children('.tab-container'));
1292			
1293			jQuery(el).find('.tab-selector .label').eq(0).addClass('current');
1294			
1295			if (jQuery(el).hasClass('horizontal')){
1296				if (fromcube){
1297					jQuery(el).find('.tab-container > .content').eq(0).addClass('current').css({
1298						'opacity':1,
1299						'transform':'translateX(0%)',
1300						'position':'relative'
1301					});
1302				} else {
1303					jQuery(el).find('.tab-container > .content').eq(0).addClass('current').css({
1304						'opacity':1,
1305						'left':'0%',
1306						'position':'absolute'
1307					});
1308				}
1309			} else {
1310				if (fromcube){
1311					jQuery(el).find('.tab-container > .content').eq(0).addClass('current').css({
1312						'opacity':1,
1313						'transform':'translateY(0%)'
1314					});
1315				} else {
1316					jQuery(el).find('.tab-container > .content').eq(0).addClass('current').css({
1317						'opacity':1,
1318						'top':'0%'
1319					});
1320				}
1321			}
1322			
1323			if (jQuery(el).find('.tab-container > .content').find('img.aligncenter').length){
1324		    	jQuery(el).find('.tab-container > .content').find('img.aligncenter').parents('p').css('text-align','center');
1325		    }
1326			
1327			// jumping at first interaction fix
1328			if (jQuery(el).find('.tab-container .current').height() > jQuery(el).find('.tab-selector').height())
1329				jQuery(el).find('.tab-container').stop().animate({'height': jQuery(el).find('.tab-container .current').height()+10}, 1000, 'easeInOutExpo');
1330			else 
1331				jQuery(el).find('.tab-container').stop().animate({'height': jQuery(el).find('.tab-selector').height()+10}, 1000, 'easeInOutExpo');
1332
1333			if (jQuery(el).hasClass('horizontal')){
1334				for ( var i = 1; i < jQuery(el).find('.tab-container > .content').length; i++){
1335					if (fromcube){
1336						jQuery(el).find('.tab-container > .content').eq(i).css({
1337							'position':'relative',
1338							'transform':'translateX(100%)',
1339							opacity:0
1340						});
1341					} else {
1342						jQuery(el).find('.tab-container > .content').eq(i).css({
1343							'position':'absolute',
1344							'margin-left':'100%',
1345							opacity:0
1346						});
1347					}
1348				}
1349			} else {
1350				for ( var i = 1; i < jQuery(el).find('.tab-container > .content').length; i++){
1351					if (fromcube){
1352						jQuery(el).find('.tab-container > .content').eq(i).css({
1353							'position':'relative',
1354							'transform':'translateY(100%)',
1355							opacity:0
1356						});
1357					} else {
1358						jQuery(el).find('.tab-container > .content').eq(i).css({
1359							'position':'absolute',
1360							'margin-top':'100%',
1361							opacity:0
1362						});
1363					}
1364				}	
1365			}
1366			
1367			var elm = jQuery(this).attr('class').split("st-");
1368			var elm = "st-"+elm[1];
1369			
1370			if (jQuery(el).hasClass('horizontal') && !jQuery(el).find('.tab-selector .labels-container').length){
1371				jQuery(el).find('.tab-selector div.label').wrapAll('<div class="labels-container" />');
1372				jQuery(el).find('.tab-selector').css({'width':'100%','text-align':'center'}).find('.labels-container').css({'display':'inline-block','margin':'0 auto'});
1373			}
1374			
1375			jQuery('.'+elm).find('.tab-selector .label').each(function(){
1376			
1377				if (!jQuery(this).find('.hazel_icon_special_tabs').length){
1378					jQuery(this).find('.tab_title').css('padding-left','10px');
1379				}
1380				
1381				jQuery(this).on("click",function(){ 
1382				
1383					if (!jQuery(this).hasClass('current')){
1384						var filterClass = jQuery(this).attr('class').toString();
1385						var randid = filterClass.replace("label ","");
1386						var nextEl = jQuery('.'+elm).find('.tab-container > .content.'+randid);
1387						if (jQuery(nextEl).height() > jQuery(this).parents('.tab-selector').height())
1388							jQuery(this).parents('.special_tabs').find('.tab-container').stop().animate({'height': jQuery(nextEl).height()+10}, 1000, 'easeInOutExpo');
1389						else 
1390							jQuery(this).parents('.special_tabs').find('.tab-container').stop().animate({'height': jQuery(this).parents('.tab-selector').height()+10}, 1000, 'easeInOutExpo');
1391							
1392						if (jQuery(el).hasClass('horizontal')){
1393							if (fromcube) jQuery(nextEl).css({'transform':'translateX(100%)','left':'0%', 'display':'block'});
1394							else jQuery(nextEl).css({'margin-left':'100%','left':'0%', 'display':'block'});
1395						} else {
1396							if (fromcube)jQuery(nextEl).css({'transform':'translateY(100%)','to
1396p':'0%', 'display':'block'});
1397							else jQuery(nextEl).css({'margin-top':'100%','top':'0%', 'display':'block'});
1398						}
1399						
1400						
1401						var current = jQuery('.'+elm).find('.tab-container > .current');
1402						var id = jQuery(current).attr('class').split(" ");
1403							id = id[1];
1404						jQuery('.'+elm).find('.tab-selector .label.'+id).css({'color':'#5c5c5c'});
1405						jQuery('.'+elm).find('.tab-selector .label.'+id+'.current').css({'color':'#5c5c5c'});
1406						
1407						if (jQuery(el).hasClass('horizontal')){
1408							if (fromcube){
1409								jQuery(current).stop().css({'transform':'translateX(100%)', opacity:0}).css('display','none');
1410							} else {
1411								jQuery(current).stop().animate({'margin-left':'100%', opacity:0}, 1000, 'easeInOutExpo', function(){
1412									jQuery(this).css('display','none');
1413								});
1414							}
1415						} else {
1416							if (fromcube){
1417								jQuery(current).stop().css({'transform':'translateY(100%)', opacity:0}).css('display','none');
1418							} else {
1419								jQuery(current).stop().animate({'margin-top':'100%', opacity:0}, 1000, 'easeInOutExpo', function(){
1420									jQuery(this).css('display','none');
1421								});
1422							}
1423						}
1424						
1425 
1426						jQuery('.'+elm).find('.tab-selector .label.'+id).removeClass('current');
1427						jQuery(current).removeClass('current');
1428						
1429						if (jQuery(el).hasClass('horizontal')){
1430							if (fromcube){
1431								jQuery(current).css({
1432									'transform': 'translateX(-100%)',
1433									opacity: 0
1434								});
1435								jQuery(this).css({'transform':'translateX(100%)'});
1436							} else {
1437								jQuery(current).animate({
1438									'margin-left': '-100%',
1439									opacity: 0
1440								}, 1000, 'easeInOutExpo', function(){
1441									jQuery(this).css({'margin-left':'100%'});
1442								});
1443							}
1444						} else {
1445							if (fromcube){
1446								jQuery(current).css({
1447									'transform': 'translateY(-100%)',
1448									opacity: 0
1449								});
1450								jQuery(this).css({'transform':'translateY(100%)'});
1451							} else {
1452								jQuery(current).animate({
1453									'margin-top': '-100%',
1454									opacity: 0
1455								}, 1000, 'easeInOutExpo', function(){
1456									jQuery(this).css({'margin-top':'100%'});
1457								});
1458							}
1459						}
1460						
1461						
1462						jQuery('.'+elm).find('.tab-selector .label.'+randid).css({'color': window.hazelOptions.styleColor });
1463						jQuery('.'+elm).find('.tab-selector .label.'+randid).addClass('current');
1464						jQuery('.'+elm).find('.tab-selector .label.'+randid).css('color', window.hazelOptions.styleColor);
1465						jQuery('.'+elm).find('.tab-container > .content.'+randid).css('display','block');
1466						
1467						if (jQuery(el).hasClass('horizontal')){
1468							if (fromcube){
1469								jQuery('.'+elm).find('.tab-container > .content.'+randid).addClass('current').stop().css({ 'transform': 'translateX(0%)', opacity:1 });
1470								jQuery('.'+elm).find('.tab-container > .content.'+randid).css('display','block');
1471								if (jQuery(this).find('.services-graph').length){
1472									var id = jQuery('.'+elm).find('.tab-container > .content.'+randid).find('.services-graph').attr('id');
1473									sliding_horizontal_graph(id,3000);
1474								}
1475								
1476								if (window.BrowserDetect.browser == "Explorer" && window.BrowserDetect.version == 8){
1477									if (jQuery('.'+elm).find('.tab-container > .content.'+randid).find('.recent_testimonials').length){
1478										jQuery('.'+elm).find('.tab-container > .content.'+randid).css('width','100%');
1479									}
1480								}
1481								
1482								if (jQuery('.'+elm).find('.tab-container > .content.'+randid).find('.indproj2').length){
1483									jQuery('.'+elm).find('.tab-container > .content.'+randid).find('.indproj2').each(function(){
1484										var newHeight = jQuery(this).width() * window.ration;
1485										jQuery(this).find('.da-thumbs li a').css('height',newHeight);
1486									});
1487								}
1488							} else {
1489								jQuery('.'+elm).find('.tab-container > .content.'+randid).addClass('current').stop().animate({ 'margin-left': '0%', opacity:1 },1000, 'easeInOutExpo', function(){
1490									jQuery(this).css('display','block');
1491									if (jQuery(this).find('.services-graph').length){
1492										var id = jQuery(this).find('.services-graph').attr('id');
1493										sliding_horizontal_graph(id,3000);
1494									}
1495									
1496									if (window.BrowserDetect.browser == "Explorer" && window.BrowserDetect.version == 8){
1497										if (jQuery(this).find('.recent_testimonials').length){
1498											jQuery(this).css('width','100%');
1499										}
1500									}
1501									
1502									if (jQuery(this).find('.indproj2').length){
1503										jQuery(this).find('.indproj2').each(function(){
1504											var newHeight = jQuery(this).width() * window.ration;
1505											jQuery(this).find('.da-thumbs li a').css('height',newHeight);
1506										});
1507									}
1508									
1509								});
1510							}
1511						} else {
1512							if (fromcube){
1513								jQuery('.'+elm).find('.tab-container > .content.'+randid).addClass('current').stop().css({ 'transform': 'translateY(0%)', opacity:1 });
1514								jQuery('.'+elm).find('.tab-container > .content.'+randid).css('display','block');
1515								if (jQuery('.'+elm).find('.tab-container > .content.'+randid).find('.services-graph').length){
1516									var id = jQuery('.'+elm).find('.tab-container > .content.'+randid).find('.services-graph').attr('id');
1517									sliding_horizontal_graph(id,3000);
1518								}
1519								
1520								if (window.BrowserDetect.browser == "Explorer" && window.BrowserDetect.version == 8){
1521									if (jQuery('.'+elm).find('.tab-container > .content.'+randid).find('.recent_testimonials').length){
1522										jQuery('.'+elm).find('.tab-container > .content.'+randid).css('width','100%');
1523									}
1524								}
1525								
1526								if (jQuery('.'+elm).find('.tab-container > .content.'+randid).find('.indproj2').length){
1527									jQuery('.'+elm).find('.tab-container > .content.'+randid).find('.indproj2').each(function(){
1528										var newHeight = jQuery(this).width() * window.ration;
1529										jQuery(this).find('.da-thumbs li a').css('height',newHeight);
1530									});
1531								}
1532							} else {
1533								jQuery('.'+elm).find('.tab-container > .content.'+randid).addClass('current').stop().animate({ 'margin-top': '0%', opacity:1 }
1533,1000, 'easeInOutExpo', function(){
1534									jQuery(this).css('display','block');
1535									if (jQuery(this).find('.services-graph').length){
1536										var id = jQuery(this).find('.services-graph').attr('id');
1537										sliding_horizontal_graph(id,3000);
1538									}
1539									
1540									if (window.BrowserDetect.browser == "Explorer" && window.BrowserDetect.version == 8){
1541										if (jQuery(this).find('.recent_testimonials').length){
1542											jQuery(this).css('width','100%');
1543										}
1544									}
1545									
1546									if (jQuery(this).find('.indproj2').length){
1547										jQuery(this).find('.indproj2').each(function(){
1548											var newHeight = jQuery(this).width() * window.ration;
1549											jQuery(this).find('.da-thumbs li a').css('height',newHeight);
1550										});
1551									}
1552									
1553								});
1554							}
1555						}
1556					}
1557				});
1558				
1559			});
1560			jQuery(this).find('.tab-container').addClass('animateMinHeight');
1561			window.treethemesWaitOnTabs = true;
1562			jQuery('.animateMinHeight').on('animationend webkitAnimationEnd mozAnimationEnd oAnimationEnd transitionend webkitTransitionEnd mozTransitionEnd oTransitionEnd', function(){
1563				if (typeof Waypoint === "function") Waypoint.refreshAll();
1564				jQuery(document).trigger('treethemes_st_ready');
1565				window.treethemesWaitOnTabs = false;
1566			});
1567			jQuery(this).addClass('special_tabs_ready');
1568		});
1569	}
1570}
1571
1572jQuery(document).on('click', '.special_tabs_ready .content.current .vc_toggle', function(e){
1573	window.special_tabs_aux = jQuery(e.currentTarget);
1574	setTimeout(function(){
1575		if (!jQuery(window.special_tabs_aux).closest('.special_tabs').hasClass('horizontal')){
1576			var tabSelectorHeight = jQuery(window.special_tabs_aux).closest('.special_tabs').find('.tab-selector').height(),
1577				currentTabHeight = jQuery(window.special_tabs_aux).closest('.special_tabs').find('.tab-container .current').height()+10;
1578			jQuery(window.special_tabs_aux).closest('.special_tabs').find('.tab-container').css('height', ( tabSelectorHeight > currentTabHeight ? tabSelectorHeight : currentTabHeight ));
1579		}
1580		else jQuery(window.special_tabs_aux).closest('.special_tabs').find('.tab-container').css('height', jQuery(window.special_tabs_aux).closest('.special_tabs').find('.tab-container .current').height()+10);
1581		delete window.special_tabs_aux;
1582	}, 500);
1583});
1584
1585function isScrolledIntoView(id){
1586    var elem = "#" + id;
1587    var docViewTop = jQuery(window).scrollTop();
1588    var docViewBottom = docViewTop + jQuery(window).height();
1589
1590    if (jQuery(elem).length > 0){
1591        var elemTop = jQuery(elem).offset().top;
1592        var elemBottom = elemTop + jQuery(elem).height();
1593    }
1594
1595    return ((elemBottom >= docViewTop) && (elemTop <= docViewBottom)
1596      && (elemBottom <= docViewBottom) &&  (elemTop >= docViewTop) );
1597}
1598
1599function sliding_horizontal_graph(id, speed){
1600    jQuery("#" + id + " li span").each(function(i){
1601        var cur_li = jQuery("#" + id + " li").eq(i).find("span");
1602        var w = cur_li.attr("title");
1603        cur_li.animate({width: w + "%"}, speed);
1604    })
1605}
1606
1607function graph_init(id, speed){
1608    jQuery(window).scroll(function(){
1609    	if (jQuery('#'+id).hasClass('notinview')){
1610	    	if (isScrolledIntoView(id)){
1611	    		jQuery('#'+id).removeClass('notinview');
1612	            sliding_horizontal_graph(id, speed);
1613	        }
1614    	}
1615    });
1616    
1617    if (isScrolledIntoView(id)){
1618        sliding_horizontal_graph(id, speed);
1619    }
1620}
1621
1622function incrementNumerical(id, percent, speed){
1623	setTimeout(function(){
1624		var newVal = parseInt(jQuery(id+' .value').html(),10)+speed;
1625
1626		if (newVal > percent) newVal = percent;
1627		jQuery(id+' .value').html(newVal);
1628		if (newVal < percent){
1629			incrementNumerical(id, percent, speed);
1630		}
1631	}, 1);
1632}
1633
1634function htmlDecode(a) {
1635    var b = jQuery("<div/>").html(a).text();
1636    return b
1637}
1638
1639/* Convert HEX to RGB */
1640function hexToRgb(hex) {
1641    var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
1642    return result ? {
1643        r: parseInt(result[1], 16),
1644        g: parseInt(result[2], 16),
1645        b: parseInt(result[3], 16)
1646    } : null;
1647}
1648
1649// Grayscale w canvas method
1650function grayscale(src){
1651	var canvas = document.createElement('canvas');
1652	var ctx = canvas.getContext('2d');
1653	var imgObj = new Image();
1654	imgObj.src = src;
1655	canvas.width = imgObj.width;
1656	canvas.height = imgObj.height; 
1657	ctx.drawImage(imgObj, 0, 0); 
1658	var imgPixels = ctx.getImageData(0, 0, canvas.width, canvas.height);
1659	for(var y = 0; y < imgPixels.height; y++){
1660		for (var x = 0; x < imgPixels.width; x++){
1661			var i = (y * 4) * imgPixels.width + x * 4;
1662			var avg = (imgPixels.data[i] + imgPixels.data[i + 1] + imgPixels.data[i + 2]) / 3;
1663			imgPixels.data[i] = avg; 
1664			imgPixels.data[i + 1] = avg; 
1665			imgPixels.data[i + 2] = avg;
1666		}
1667	}
1668	ctx.putImageData(imgPixels, 0, 0, 0, 0, imgPixels.width, imgPixels.height);
1669	return canvas.toDataURL();
1670	
1671}
1672
1673function hazel_validate_email(email) {
1674   var reg = /^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i;
1675   if(reg.test(email) == false) {
1676      return 0;
1677   } else {
1678   		return 1;
1679   }
1680}
1681
1682
1683function hazel_checkerror(elem){
1684	if(jQuery(elem).hasClass('with_error')) {
1685		jQuery(elem).removeClass('with_error').addClass('change_error');
1686		jQuery(elem).val("");
1687	}
1688}
1689
1690
1691function hazel_check_menu_right_frontier(el){
1692	if (el.offset().left + el.width() + el.children('ul').width() > jQuery(window).width() || el.closest('menu-to-the-left').length > 0){
1693		el.find('ul').addClass('menu-to-the-left');
1694	} else {
1695		el.find('ul').removeClass('menu-to-the-left');
1696	}
1697}
1698
1699/* sliding-graphs */
1700function isScrolledIntoView(e){var t="#"+e;var n=$(window).scrollTop();var r=n+$(window).height();if($(t).length>0){var i=$(t).offset().top;var s=i+$(t).height()}return s>=n&&i<=r&&s<=r&&i>=n}function sliding_horizontal_graph(e,t){$("#"+e+" li span").each(function(n){var r=n+1;var i=$("#"+e+" li:nth-child("+r+") span");var s=i.attr("title");i.animate({width:s+"%"},t)})}function graph_init(e,t){$(window).scroll(function(){if(isScrolledIntoView(e)){sliding_horizontal_graph(e,t)}else{}});if(isScrolledIntoView(e)){sliding_horizontal_graph(e,t)}}function htmlDecode(e){var t=$("<div/>").html(e).text();return t}function playpause(e){if(e.hasClass("playing")){$("#slider_container").cameraResume();e.removeClass("playing").addClass("paused")}else{$("#slider_container").cameraPause();e.removeClass("paused").addClass("playing")}}
1701
1702jQuery(window).on("load", function(){ jQuery('img, a:not(.social-network)').on('mouseenter', function(){ jQuery(this).data('title', jQuery(this).attr('title') ).removeAttr('title'); }).on('mouseleave',function(){ jQuery(this).attr('title', jQuery(this).data('title') ); }); jQuery('form.hazel_search_input').removeClass('not-ready'); });
1703
1704

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.