PageSourceSearch

https://powerofcalm.com/wp-content/themes/Divi/includes/builder/scripts/frontend-builder-scripts.js?ver=3.0.34

js powerofcalm.com collected 2026-09-24 11:41:09 UTC 152,564 bytes, 4,103 lines download raw bytes

1(function($){
2	var $et_window = $(window);
3
4	window.et_load_event_fired   = false;
5	window.et_is_transparent_nav = $( 'body' ).hasClass( 'et_transparent_nav' );
6	window.et_is_vertical_nav    = $( 'body' ).hasClass( 'et_vertical_nav' );
7	window.et_is_fixed_nav       = $( 'body' ).hasClass( 'et_fixed_nav' );
8
9	jQuery.fn.reverse = [].reverse;
10
11	jQuery.fn.closest_descendent = function( selector ) {
12		var $found,
13			$current_children = this.children();
14
15		while ( $current_children.length ) {
16			$found = $current_children.filter( selector );
17			if ( $found.length ) {
18				break;
19			}
20			$current_children = $current_children.children();
21		}
22
23		return $found;
24	};
25
26	window.et_pb_init_modules = function() {
27		$.et_pb_simple_slider = function(el, options) {
28			var settings = $.extend( {
29				slide         			: '.et-slide',				 	// slide class
30				arrows					: '.et-pb-slider-arrows',		// arrows container class
31				prev_arrow				: '.et-pb-arrow-prev',			// left arrow class
32				next_arrow				: '.et-pb-arrow-next',			// right arrow class
33				controls 				: '.et-pb-controllers a',		// control selector
34				carousel_controls 		: '.et_pb_carousel_item',		// carousel control selector
35				control_active_class	: 'et-pb-active-control',		// active control class name
36				previous_text			: et_pb_custom.previous,			// previous arrow text
37				next_text				: et_pb_custom.next,				// next arrow text
38				fade_speed				: 500,							// fade effect speed
39				use_arrows				: true,							// use arrows?
40				use_controls			: true,							// use controls?
41				manual_arrows			: '',							// html code for custom arrows
42				append_controls_to		: '',							// controls are appended to the slider element by default, here you can specify the element it should append to
43				controls_below			: false,
44				controls_class			: 'et-pb-controllers',				// controls container class name
45				slideshow				: false,						// automattic animation?
46				slideshow_speed			: 7000,							// automattic animation speed
47				show_progress_bar		: false,							// show progress bar if automattic animation is active
48				tabs_animation			: false,
49				use_carousel			: false
50			}, options );
51
52			var $et_slider 			= $(el),
53				$et_slide			= $et_slider.closest_descendent( settings.slide ),
54				et_slides_number	= $et_slide.length,
55				et_fade_speed		= settings.fade_speed,
56				et_active_slide		= 0,
57				$et_slider_arrows,
58				$et_slider_prev,
59				$et_slider_next,
60				$et_slider_controls,
61				$et_slider_carousel_controls,
62				et_slider_timer,
63				controls_html = '',
64				carousel_html = '',
65				$progress_bar = null,
66				progress_timer_count = 0,
67				$et_pb_container = $et_slider.find( '.et_pb_container' ),
68				et_pb_container_width = $et_pb_container.width(),
69				is_post_slider = $et_slider.hasClass( 'et_pb_post_slider' );
70
71				$et_slider.et_animation_running = false;
72
73				$.data(el, "et_pb_simple_slider", $et_slider);
74
75				$et_slide.eq(0).addClass( 'et-pb-active-slide' );
76
77				if ( ! settings.tabs_animation ) {
78					if ( !$et_slider.hasClass('et_pb_bg_layout_dark') && !$et_slider.hasClass('et_pb_bg_layout_light') ) {
79						$et_slider.addClass( et_get_bg_layout_color( $et_slide.eq(0) ) );
80					}
81				}
82
83				if ( settings.use_arrows && et_slides_number > 1 ) {
84					if ( settings.manual_arrows == '' )
85						$et_slider.append( '<div class="et-pb-slider-arrows"><a class="et-pb-arrow-prev" href="#">' + '<span>' +settings.previous_text + '</span>' + '</a><a class="et-pb-arrow-next" href="#">' + '<span>' + settings.next_text + '</span>' + '</a></div>' );
86					else
87						$et_slider.append( settings.manual_arrows );
88
89					$et_slider_arrows 	= $et_slider.find( settings.arrows );
90					$et_slider_prev 	= $et_slider.find( settings.prev_arrow );
91					$et_slider_next 	= $et_slider.find( settings.next_arrow );
92
93					$et_slider_next.click( function(){
94						if ( $et_slider.et_animation_running )	return false;
95
96						$et_slider.et_slider_move_to( 'next' );
97
98						return false;
99					} );
100
101					$et_slider_prev.click( function(){
102						if ( $et_slider.et_animation_running )	return false;
103
104						$et_slider.et_slider_move_to( 'previous' );
105
106						return false;
107					} );
108
109					// swipe support requires et-jquery-touch-mobile
110					$et_slider.find( settings.slide ).on( 'swipeleft', function( event ) {
111						// do not switch slide on selecting text in VB
112						if ( $( event.target ).closest( '.et-fb-popover-tinymce' ).length || $( event.target ).closest( '.et-fb-editable-element' ).length ) {
113							return;
114						}
115
116						$et_slider.et_slider_move_to( 'next' );
117					});
118					$et_slider.find( settings.slide ).on( 'swiperight', function( event ) {
119						// do not switch slide on selecting text in VB
120						if ( $( event.target ).closest( '.et-fb-popover-tinymce' ).length || $( event.target ).closest( '.et-fb-editable-element' ).length ) {
121							return;
122						}
123
124						$et_slider.et_slider_move_to( 'previous' );
125					});
126				}
127
128				if ( settings.use_controls && et_slides_number > 1 ) {
129					for ( var i = 1; i <= et_slides_number; i++ ) {
130						controls_html += '<a href="#"' + ( i == 1 ? ' class="' + settings.control_active_class + '"' : '' ) + '>' + i + '</a>';
131					}
132
133					if ($et_slider.find('video').length > 0) {
134						settings.controls_class += ' et-pb-controllers-has-video-tag';
135					}
136
137					controls_html =
138						'<div class="' + settings.controls_class + '">' +
139							controls_html +
140						'</div>';
141
142					if ( settings.append_controls_to == '' )
143						$et_slider.append( controls_html );
144					else
145						$( settings.append_controls_to ).append( controls_html );
146
147					if ( settings.controls_below )
148						$et_slider_controls	= $et_slider.parent().find( settings.controls );
149					else
150						$et_slider_controls	= $et_slider.find( settings.controls );
151
152					et_maybe_set_controls_color( $et_slide.eq(0) );
153
154					$et_slider_controls.click( function(){
155						if ( $et_slider.et_animation_running )	return false;
156
157						$et_slider.et_slider_move_to( $(this).index() );
158
159						return false;
160					} );
161				}
162
163				if ( settings.use_carousel && et_slides_number > 1 ) {
164					for ( var i = 1; i <= et_slides_number; i++ ) {
165						slide_id = i - 1;
166						image_src = ( $et_slide.eq(slide_id).data('image') !== undefined ) ? 'url(' + $et_slide.eq(slide_id).data('image') + ')' : 'none';
167						carousel_html += '<div class="et_pb_carousel_item ' + ( i == 1 ? settings.control_active_class : '' ) + '" data-slide-id="'+ slide_id +'">' +
168							'<div class="et_pb_video_overlay" href="#" style="background-image: ' + image_src + ';">' +
169								'<div class="et_pb_video_overlay_hover"><a href="#" class="et_pb_video_play"></a></div>' +
170							'</div>' +
171						'</div>';
172					}
173
174					carousel_html =
175						'<div class="et_pb_carousel">' +
176						'<div class="et_pb_carousel_items">' +
177							carousel_html +
178						'</div>' +
179						'</div>';
180					$et_slider.after( carousel_html );
181
182					$et_slider_carousel_controls = $et_slider.siblings('.et_pb_carousel').find( settings.carousel_controls );
183					$et_slider_carousel_controls.click( function(){
184						if ( $et_slider.et_animation_running )	return false;
185
186						var $this = $(this);
187						$et_slider.et_slider_move_to( $this.data('slide-id') );
188
189						return false;
190					} );
191				}
192
193				if ( settings.slideshow && et_slides_number > 1 ) {
194					$et_slider.hover( function() {
195						if ( $et_slider.hasClass( 'et_slider_auto_ignore_hover' ) ) {
196							return;
197						}
198
199						$et_slider.addClass( 'et_slider_hovered' );
200
201						if ( typeof et_slider_timer != 'undefined' ) {
202							clearInterval( et_slider_timer );
203						}
204					}, function() {
205						if ( $et_slider.hasClass( 'et_slider_auto_ignore_hover' ) ) {
206							return;
207						}
208
209						$et_slider.removeClass( 'et_slider_hovered' );
210
211						et_slider_auto_rotate();
212					} );
213				}
214
215				et_slider_auto_rotate();
216
217				function et_slider_auto_rotate(){
218					if ( settings.slideshow && et_slides_number > 1 && ! $et_slider.hasClass( 'et_slider_hovered' ) ) {
219						et_slider_timer = setTimeout( function() {
220							$et_slider.et_slider_move_to( 'next' );
221						}, settings.slideshow_speed );
222					}
223				}
224
225				$et_slider.et_slider_destroy = function() {
226					// Clear existing timer / auto rotate
227					if ( typeof et_slider_timer != 'undefined' ) {
228						clearInterval( et_slider_timer );
229					}
230
231					// Deregister existing events
232					$et_slider.unbind('mouseenter mouseleave');
233					$et_slider.find('.et-pb-slider-arrows a, .et-pb-controllers a').unbind('click');
234
235					// Removing existing style from slide(s)
236					$et_slider.find('.et_pb_slide').css({
237						'z-index': '',
238						'display': '',
239						'opacity': '',
240					});
241
242					// Removing existing classnames from slide(s)
243					$et_slider.find('.et-pb-active-slide').removeClass('et-pb-active-slide');
244					$et_slider.find('.et-pb-moved-slide').removeClass('et-pb-moved-slide');
245
246					// Removing DOM that was added by slider
247					$et_slider.find('.et-pb-slider-arrows, .et-pb-controllers').remove();
248					$et_slider.siblings('.et_pb_carousel').remove();
249				};
250
251				function et_stop_video( active_slide ) {
252					var $et_video, et_video_src;
253
254					// if there is a video in the slide, stop it when switching to another slide
255					if ( active_slide.has( 'iframe' ).length ) {
256						$et_video = active_slide.find( 'iframe' );
257						et_video_src = $et_video.attr( 'src' );
258
259						$et_video.attr( 'src', '' );
260						$et_video.attr( 'src', et_video_src );
261
262					} else if ( active_slide.has( 'video' ).length ) {
263						if ( !active_slide.find('.et_pb_section_video_bg').length ) {
264							$et_video = active_slide.find( 'video' );
265							$et_video[0].pause();
266						}
267					}
268				}
269
270				$et_slider.et_fix_slider_content_images = et_fix_slider_content_images;
271
272				function et_fix_slider_content_images() {
273					var $this_slider                 = $et_slider,
274						$slide_image_container       = $this_slider.find( '.et-pb-active-slide .et_pb_slide_image' ),
275						$slide_video_container       = $this_slider.find( '.et-pb-active-slide .et_pb_slide_video' ),
276						$slide                       = $slide_image_container.closest( '.et_pb_slide' ),
277						$slider                      = $slide.closest( '.et_pb_slider' ),
278						slide_height                 = parseFloat( $slider.innerHeight() ),
279						image_height                 = parseFloat( slide_height * 0.8 ),
280						slide_image_container_height = parseFloat( $slide_image_container.height() ),
281						slide_video_container_height = parseFloat( $slide_video_container.height() );
282
283					if ( ! isNaN( image_height ) ) {
284						$slide_image_container.find( 'img' ).css( 'maxHeight', image_height + 'px' );
285
286						slide_image_container_height = parseInt( $slide_image_container.height() )
287					}
288
289					if ( ! isNaN( slide_image_container_height ) && $slide.hasClass( 'et_pb_media_alignment_center' ) ) {
290						$slide_image_container.css( 'marginTop', '-' + ( slide_image_container_height / 2 ) + 'px' );
291					}
292
293					if ( ! isNaN( slide_video_container_height ) ) {
294						$slide_video_container.css( 'marginTop', '-' + ( slide_video_container_height / 2 ) + 'px' );
295					}
296				}
297
298				function et_get_bg_layout_color( $slide ) {
299					if ( $slide.hasClass( 'et_pb_bg_layout_light' ) ) {
300						return 'et_pb_bg_layout_light';
301					}
302
303					return 'et_pb_bg_layout_dark';
304				}
305
306				function et_maybe_set_controls_color( $slide ) {
307					var next_slide_dot_color,
308						$arrows,
309						arrows_color;
310
311					if ( typeof $et_slider_controls !== 'undefined' && $et_slider_controls.length ) {
312						next_slide_dot_color = $slide.attr( 'data-dots_color' ) || '';
313
314						if ( next_slide_dot_color !== '' ) {
315							$et_slider_controls.attr( 'style', 'background-color: ' + hex_to_rgba( next_slide_dot_color, '0.3' ) + ';' )
316							$et_slider_controls.filter( '.et-pb-active-control' ).attr( 'style', 'background-color: ' + hex_to_rgba( next_slide_dot_color ) + '!important;' );
317						} else {
318							$et_slider_controls.removeAttr( 'style' );
319						}
320					}
321
322					if ( typeof $et_slider_arrows !== 'undefined' && $et_slider_arrows.length ) {
323						$arrows      = $et_slider_arrows.find( 'a' );
324						arrows_color = $slide.attr( 'data-arrows_color' ) || '';
325
326						if ( arrows_color !== '' ) {
327							$arrows.css( 'color', arrows_color );
328						} else {
329							$arrows.css( 'color', 'inherit' );
330						}
331					}
332				}
333
334				// fix the appearance of some modules inside the post slider
335				function et_fix_builder_content() {
336					if ( is_post_slider ) {
337						setTimeout( function() {
338							var $et_pb_circle_counter = $( '.et_pb_circle_counter' ),
339								$et_pb_number_counter = $( '.et_pb_number_counter' );
340
341							window.et_fix_testimonial_inner_width();
342
343							if ( $et_pb_circle_counter.length ) {
344								window.et_pb_reinit_circle_counters( $et_pb_circle_counter );
345							}
346
347							if ( $et_pb_number_counter.length ) {
348								window.et_pb_reinit_number_counters( $et_pb_number_counter );
349							}
350							window.et_reinit_waypoint_modules();
351						}, 1000 );
352					}
353				}
354
355				function hex_to_rgba( color, alpha ) {
356					var color_16 = parseInt( color.replace( '#', '' ), 16 ),
357						red      = ( color_16 >> 16 ) & 255,
358						green    = ( color_16 >> 8 ) & 255,
359						blue     = color_16 & 255,
360						alpha    = alpha || 1,
361						rgba;
362
363					rgba = red + ',' + green + ',' + blue + ',' + alpha;
364					rgba = 'rgba(' + rgba + ')';
365
366					return rgba;
367				}
368
369				if ( window.et_load_event_fired ) {
370					et_fix_slider_height( $et_slider );
371				} else {
372					$et_window.on( 'load', function() {
373						et_fix_slider_height( $et_slider );
374					} );
375				}
376
377				$et_window.on( 'resize', function() {
378					et_fix_slider_height( $et_slider );
379				} );
380
381				$et_slider.et_slider_move_to = function ( direction ) {
382					var $active_slide = $et_slide.eq( et_active_slide ),
383						$next_slide;
384
385					$et_slider.et_animation_running = true;
386
387					$et_slider.removeClass('et_slide_transition_to_next et_slide_transition_to_previous').addClass('et_slide_transition_to_' + direction );
388
389					$et_slider.find('.et-pb-moved-slide').removeClass('et-pb-moved-slide');
390
391					if ( direction == 'next' || direction == 'previous' ){
392
393						if ( direction == 'next' )
394							et_active_slide = ( et_active_slide + 1 ) < et_slides_number ? et_active_slide + 1 : 0;
395						else
396							et_active_slide = ( et_active_slide - 1 ) >= 0 ? et_active_slide - 1 : et_slides_number - 1;
397
398					} else {
399
400						if ( et_active_slide == direction ) {
401							$et_slider.et_animation_running = false;
402							return;
403						}
404
405						et_active_slide = direction;
406
407					}
408
409					if ( typeof et_slider_timer != 'undefined' )
410						clearInterval( et_slider_timer );
411
412					$next_slide	= $et_slide.eq( et_active_slide );
413
414					if ( typeof $active_slide.find('video')[0] !== 'undefined' && typeof $active_slide.find('video')[0]['player'] !== 'undefined' ) {
415						$active_slide.find('video')[0].player.pause();
416					}
417
418					if ( typeof $next_slide.find('video')[0] !== 'undefined' && typeof $next_slide.find('video')[0]['player'] !== 'undefined' ) {
419						$next_slide.find('video')[0].player.play();
420					}
421
422					var $active_slide_video = $active_slide.find('.et_pb_video_box iframe');
423
424					if ( $active_slide_video.length ) {
425						var active_slide_video_src = $active_slide_video.attr('src');
426
427						// Removes the "autoplay=1" parameter when switching slides
428						// by covering three possible cases:
429
430						// "?autoplay=1" at the end of the URL
431						active_slide_video_src = active_slide_video_src.replace(/\?autoplay=1$/, '');
432
433						// "?autoplay=1" followed by another parameter
434						active_slide_video_src = active_slide_video_src.replace(/\?autoplay=1&(amp;)?/, '?');
435
436						// "&autoplay=1" anywhere in the URL
437						active_slide_video_src = active_slide_video_src.replace(/&(amp;)?autoplay=1/, '');
438
439						// Delays the URL update so that the cross-fade animation's smoothness is not affected
440						setTimeout(function() {
441							$active_slide_video.attr({
442								'src': active_slide_video_src
443							});
444						}, settings.fade_speed);
445
446						// Restores video overlay
447						$active_slide_video.parents('.et_pb_video_box').next('.et_pb_video_overlay').css({
448							'display' : 'block',
449							'opacity' : 1
450						});
451					}
452
453					$et_slider.trigger( 'simple_slider_before_move_to', { direction : direction, next_slide : $next_slide });
454
455					$et_slide.each( function(){
456						$(this).css( 'zIndex', 1 );
457					} );
458					$active_slide.css( 'zIndex', 2 ).removeClass( 'et-pb-active-slide' ).addClass('et-pb-moved-slide');
459					$next_slide.css( { 'display' : 'block', opacity : 0 } ).addClass( 'et-pb-active-slide' );
460
461					et_fix_slider_content_images();
462
463					et_fix_builder_content();
464
465					if ( settings.use_controls )
466						$et_slider_controls.removeClass( settings.control_active_class ).eq( et_active_slide ).addClass( settings.control_active_class );
467
468					if ( settings.use_carousel )
469						$et_slider_carousel_controls.removeClass( settings.control_active_class ).eq( et_active_slide ).addClass( settings.control_active_class );
470
471					if ( ! settings.tabs_animation ) {
472						et_maybe_set_controls_color( $next_slide );
473
474						$next_slide.animate( { opacity : 1 }, et_fade_speed );
475						$active_slide.addClass( 'et_slide_transition' ).css( { 'display' : 'list-item', 'opacity' : 1 } ).animate( { opacity : 0 }, et_fade_speed, function(){
476							var active_slide_layout_bg_color = et_get_bg_layout_color( $active_slide ),
477								next_slide_layout_bg_color = et_get_bg_layout_color( $next_slide );
478
479							$(this).css('display', 'none').removeClass( 'et_slide_transition' );
480
481							et_stop_video( $active_slide );
482
483							$et_slider
484								.removeClass( active_slide_layout_bg_color )
485								.addClass( next_slide_layout_bg_color );
486
487							$et_slider.et_animation_running = false;
488
489							$et_slider.trigger( 'simple_slider_after_move_to', { next_slide : $next_slide } );
490						} );
491					} else {
492						$next_slide.css( { 'display' : 'none', opacity : 0 } );
493
494						$active_slide.addClass( 'et_slide_transition' ).css( { 'display' : 'block', 'opacity' : 1 } ).animate( { opacity : 0 }, et_fade_speed, function(){
495							$(this).css('display', 'none').removeClass( 'et_slide_transition' );
496
497							$next_slide.css( { 'display' : 'block', 'opacity' : 0 } ).animate( { opacity : 1 }, et_fade_speed, function() {
498								$et_slider.et_animation_running = false;
499
500								$et_slider.trigger( 'simple_slider_after_move_to', { next_slide : $next_slide } );
501							} );
502						} );
503					}
504
505					if ( $next_slide.find( '.et_parallax_bg' ).length ) {
506						// reinit parallax on slide change to make sure it displayed correctly
507						window.et_pb_parallax_init( $next_slide.find( '.et_parallax_bg' ) );
508					}
509
510					et_slider_auto_rotate();
511				}
512		}
513
514		$.fn.et_pb_simple_slider = function( options ) {
515			return this.each(function() {
516				new $.et_pb_simple_slider(this, options);
517			});
518		}
519
520		var et_hash_module_seperator = '||',
521			et_hash_module_param_seperator = '|';
522
523		function process_et_hashchange( hash ) {
524			if ( ( hash.indexOf( et_hash_module_seperator, 0 ) ) !== -1 ) {
525				modules = hash.split( et_hash_module_seperator );
526				for ( var i = 0; i < modules.length; i++ ) {
527					var module_params = modules[i].split( et_hash_module_param_seperator );
528					var element = module_params[0];
529					module_params.shift();
530					if ( $('#' + element ).length ) {
531						$('#' + element ).trigger({
532							type: "et_hashchange",
533							params: module_params
534						});
535					}
536				}
537			} else {
538				module_params = hash.split( et_hash_module_param_seperator );
539				var element = module_params[0];
540				module_params.shift();
541				if ( $('#' + element ).length ) {
542					$('#' + element ).trigger({
543						type: "et_hashchange",
544						params: module_params
545					});
546				}
547			}
548		}
549
550		function et_set_hash( module_state_hash ) {
551			module_id = module_state_hash.split( et_hash_module_param_seperator )[0];
552			if ( !$('#' + module_id ).length ) {
553				return;
554			}
555
556			if ( window.location.hash ) {
557				var hash = window.location.hash.substring(1), //Puts hash in variable, and removes the # character
558					new_hash = [];
559
560				if ( ( hash.indexOf( et_hash_module_seperator, 0 ) ) !== -1 ) {
561					modules = hash.split( et_hash_module_seperator );
562					var in_hash = false;
563					for ( var i = 0; i < modules.length; i++ ) {
564						var element = modules[i].split( et_hash_module_param_seperator )[0];
565						if ( element === module_id ) {
566							new_hash.push( module_state_hash );
567							in_hash = true;
568						} else {
569							new_hash.push( modules[i] );
570						}
571					}
572					if ( !in_hash ) {
573						new_hash.push( module_state_hash );
574					}
575				} else {
576					module_params = hash.split( et_hash_module_param_seperator );
577					var element = module_params[0];
578					if ( element !== module_id ) {
579						new_hash.push( hash );
580					}
581					new_hash.push( module_state_hash );
582				}
583
584				hash = new_hash.join( et_hash_module_seperator );
585			} else {
586				hash = module_state_hash;
587			}
588
589			var yScroll = document.body.scrollTop;
590			window.location.hash = hash;
591			document.body.scrollTop = yScroll;
592		}
593
594		$.et_pb_simple_carousel = function(el, options) {
595			var settings = $.extend( {
596				slide_duration	: 500,
597			}, options );
598
599			var $et_carousel 			= $(el),
600				$carousel_items 		= $et_carousel.find('.et_pb_carousel_items'),
601				$the_carousel_items 	= $carousel_items.find('.et_pb_carousel_item');
602
603			$et_carousel.et_animation_running = false;
604
605			$et_carousel.addClass('container-width-change-notify').on('containerWidthChanged', function( event ){
606				set_carousel_columns( $et_carousel );
607				set_carousel_height( $et_carousel );
608			});
609
610			$carousel_items.data('items', $the_carousel_items.toArray() );
611			$et_carousel.data('columns_setting_up', false );
612
613			$carousel_items.prepend('<div class="et-pb-slider-arrows"><a class="et-pb-slider-arrow et-pb-arrow-prev" href="#">' + '<span>' + et_pb_custom.previous + '</span>' + '</a><a class="et-pb-slider-arrow et-pb-arrow-next" href="#">' + '<span>' + et_pb_custom.next + '</span>' + '</a></div>');
614
615			set_carousel_columns( $et_carousel );
616			set_carousel_height( $et_carousel );
617
618			$et_carousel_next 	= $et_carousel.find( '.et-pb-arrow-next' );
619			$et_carousel_prev 	= $et_carousel.find( '.et-pb-arrow-prev'  );
620
621			$et_carousel.on( 'click', '.et-pb-arrow-next', function(){
622				if ( $et_carousel.et_animation_running ) return false;
623
624				$et_carousel.et_carousel_move_to( 'next' );
625
626				return false;
627			} );
628
629			$et_carousel.on( 'click', '.et-pb-arrow-prev', function(){
630				if ( $et_carousel.et_animation_running ) return false;
631
632				$et_carousel.et_carousel_move_to( 'previous' );
633
634				return false;
635			} );
636
637			// swipe support requires et-jquery-touch-mobile
638			$et_carousel.on( 'swipeleft', function() {
639				$et_carousel.et_carousel_move_to( 'next' );
640			});
641			$et_carousel.on( 'swiperight', function() {
642				$et_carousel.et_carousel_move_to( 'previous' );
643			});
644
645			function set_carousel_height( $the_carousel ) {
646				var carousel_items_width = $the_carousel_items.width(),
647					carousel_items_height = $the_carousel_items.height();
648
649				$carousel_items.css('height', carousel_items_height + 'px' );
650			}
651
652			function set_carousel_columns( $the_carousel ) {
653				var columns,
654					$carousel_parent = $the_carousel.parents('.et_pb_column'),
655					carousel_items_width = $carousel_items.width(),
656					carousel_item_count = $the_carousel_items.length;
657
658				if ( $carousel_parent.hasClass('et_pb_column_4_4') || $carousel_parent.hasClass('et_pb_column_3_4') || $carousel_parent.hasClass('et_pb_column_2_3') ) {
659					if ( $et_window.width() < 768 ) {
660						columns = 3;
661					} else {
662						columns = 4;
663					}
664				} else if ( $carousel_parent.hasClass('et_pb_column_1_2') || $carousel_parent.hasClass('et_pb_column_3_8') || $carousel_parent.hasClass('et_pb_column_1_3') ) {
665					columns = 3;
666				} else if ( $carousel_parent.hasClass('et_pb_column_1_4') ) {
667					if ( $et_window.width() > 480 && $et_window.width() < 980 ) {
668						columns = 3;
669					} else {
670						columns = 2;
671					}
672				}
673
674				if ( columns === $carousel_items.data('portfolio-columns') ) {
675					return;
676				}
677
678				if ( $the_carousel.data('columns_setting_up') ) {
679					return;
680				}
681
682				$the_carousel.data('columns_setting_up', true );
683
684				// store last setup column
685				$carousel_items.removeClass('columns-' + $carousel_items.data('portfolio-columns') );
686				$carousel_items.addClass('columns-' + columns );
687				$carousel_items.data('portfolio-columns', columns );
688
689				// kill all previous groups to get ready to re-group
690				if ( $carousel_items.find('.et-carousel-group').length ) {
691					$the_carousel_items.appendTo( $carousel_items );
692					$carousel_items.find('.et-carousel-group').remove();
693				}
694
695				// setup the grouping
696				var the_carousel_items = $carousel_items.data('items'),
697					$carousel_group = $('<div class="et-carousel-group active">').appendTo( $carousel_items );
698
699				$the_carousel_items.data('position', '');
700				if ( the_carousel_items.length <= columns ) {
701					$carousel_items.find('.et-pb-slider-arrows').hide();
702				} else {
703					$carousel_items.find('.et-pb-slider-arrows').show();
704				}
705
706				for ( position = 1, x=0 ;x < the_carousel_items.length; x++, position++ ) {
707					if ( x < columns ) {
708						$( the_carousel_items[x] ).show();
709						$( the_carousel_items[x] ).appendTo( $carousel_group );
710						$( the_carousel_items[x] ).data('position', position );
711						$( the_carousel_items[x] ).addClass('position_' + position );
712					} else {
713						position = $( the_carousel_items[x] ).data('position');
714						$( the_carousel_items[x] ).removeClass('position_' + position );
715						$( the_carousel_items[x] ).data('position', '' );
716						$( the_carousel_items[x] ).hide();
717					}
718				}
719
720				$the_carousel.data('columns_setting_up', false );
721
722			} /* end set_carousel_columns() */
723
724			$et_carousel.et_carousel_move_to = function ( direction ) {
725				var $active_carousel_group 	= $carousel_items.find('.et-carousel-group.active'),
726					items 					= $carousel_items.data('items'),
727					columns 				= $carousel_items.data('portfolio-columns');
728
729				$et_carousel.et_animation_running = true;
730
731				var left = 0;
732				$active_carousel_group.children().each(function(){
733					$(this).css({'position':'absolute', 'left': left });
734					left = left + $(this).outerWidth(true);
735				});
736
737				if ( direction == 'next' ) {
738					var $next_carousel_group,
739						current_position = 1,
740						next_position = 1,
741						active_items_start = items.indexOf( $active_carousel_group.children().first()[0] ),
742						active_items_end = active_items_start + columns,
743						next_items_start = active_items_end,
744						next_items_end = next_items_start + columns;
745
746					$next_carousel_group = $('<div class="et-carousel-group next" style="display: none;left: 100%;position: absolute;top: 0;">').insertAfter( $active_carousel_group );
747					$next_carousel_group.css({ 'width': $active_carousel_group.innerWidth() }).show();
748
749					// this is an endless loop, so it can decide internally when to break out, so that next_position
750					// can get filled up, even to the extent of an element having both and current_ and next_ position
751					for( x = 0, total = 0 ; ; x++, total++ ) {
752						if ( total >= active_items_start && total < active_items_end ) {
753							$( items[x] ).addClass( 'changing_position current_position current_position_' + current_position );
754							$( items[x] ).data('current_position', current_position );
755							current_position++;
756						}
757
758						if ( total >= next_items_start && total < next_items_end ) {
759							$( items[x] ).data('next_position', next_position );
760							$( items[x] ).addClass('changing_position next_position next_position_' + next_position );
761
762							if ( !$( items[x] ).hasClass( 'current_position' ) ) {
763								$( items[x] ).addClass('container_append');
764							} else {
765								$( items[x] ).clone(true).appendTo( $active_carousel_group ).hide().addClass('delayed_container_append_dup').attr('id', $( items[x] ).attr('id') + '-dup' );
766								$( items[x] ).addClass('delayed_container_append');
767							}
768
769							next_position++;
770						}
771
772						if ( next_position > columns ) {
773							break;
774						}
775
776						if ( x >= ( items.length -1 )) {
777							x = -1;
778						}
779					}
780
781					var sorted = $carousel_items.find('.container_append, .delayed_container_append_dup').sort(function (a, b) {
782						var el_a_position = parseInt( $(a).data('next_position') );
783						var el_b_position = parseInt( $(b).data('next_position') );
784						return ( el_a_position < el_b_position ) ? -1 : ( el_a_position > el_b_position ) ? 1 : 0;
785					});
786
787					$( sorted ).show().appendTo( $next_carousel_group );
788
789					var left = 0;
790					$next_carousel_group.children().each(function(){
791						$(this).css({'position':'absolute', 'left': left });
792						left = left + $(this).outerWidth(true);
793					});
794
795					$active_carousel_group.animate({
796						left: '-100%'
797					}, {
798						duration: settings.slide_duration,
799						complete: function() {
800							$carousel_items.find('.delayed_container_append').each(function(){
801								left = $( '#' + $(this).attr('id') + '-dup' ).css('left');
802								$(this).css({'position':'absolute', 'left': left });
803								$(this).appendTo( $next_carousel_group );
804							});
805
806							$active_carousel_group.removeClass('active');
807							$active_carousel_group.children().each(function(){
808								position = $(this).data('position');
809								current_position = $(this).data('current_position');
810								$(this).removeClass('position_' + position + ' ' + 'changing_position current_position current_position_' + current_position );
811								$(this).data('position', '');
812								$(this).data('current_position', '');
813								$(this).hide();
814								$(this).css({'position': '', 'left': ''});
815								$(this).appendTo( $carousel_items );
816							});
817
818							$active_carousel_group.remove();
819
820						}
821					} );
822
823					next_left = $active_carousel_group.width() + parseInt( $the_carousel_items.first().css('marginRight').slice(0, -2) );
824					$next_carousel_group.addClass('active').css({'position':'absolute', 'top':0, left: next_left });
825					$next_carousel_group.animate({
826						left: '0%'
827					}, {
828						duration: settings.slide_duration,
829						complete: function(){
830							$next_carousel_group.removeClass('next').addClass('active').css({'position':'', 'width':'', 'top':'', 'left': ''});
831
832							$next_carousel_group.find('.changing_position').each(function( index ){
833								position = $(this).data('position');
834								current_position = $(this).data('current_position');
835								next_position = $(this).data('next_position');
836								$(this).removeClass('container_append delayed_container_append position_' + position + ' ' + 'changing_position current_position current_position_' + current_position + ' next_position next_position_' + next_position );
837								$(this).data('current_position', '');
838								$(this).data('next_position', '');
839								$(this).data('position', ( index + 1 ) );
840							});
841
842							$next_carousel_group.children().css({'position': '', 'left': ''});
843							$next_carousel_group.find('.delayed_container_append_dup').remove();
844
845							$et_carousel.et_animation_running = false;
846						}
847					} );
848
849				} else if ( direction == 'previous' ) {
850					var $prev_carousel_group,
851						current_position = columns,
852						prev_position = columns,
853						columns_span = columns - 1,
854						active_items_start = items.indexOf( $active_carousel_group.children().last()[0] ),
855						active_items_end = active_items_start - columns_span,
856						prev_items_start = active_items_end - 1,
857						prev_items_end = prev_items_start - columns_span;
858
859					$prev_carousel_group = $('<div class="et-carousel-group prev" style="display: none;left: 100%;position: absolute;top: 0;">').insertBefore( $active_carousel_group );
860					$prev_carousel_group.css({ 'left': '-' + $active_carousel_group.innerWidth(), 'width': $active_carousel_group.innerWidth() }).show();
861
862					// this is an endless loop, so it can decide internally when to break out, so that next_position
863					// can get filled up, even to the extent of an element having both and current_ and next_ position
864					for( x = ( items.length - 1 ), total = ( items.length - 1 ) ; ; x--, total-- ) {
865
866						if ( total <= active_items_start && total >= active_items_end ) {
867							$( items[x] ).addClass( 'changing_position current_position current_position_' + current_position );
868							$( items[x] ).data('current_position', current_position );
869							current_position--;
870						}
871
872						if ( total <= prev_items_start && total >= prev_items_end ) {
873							$( items[x] ).data('prev_position', prev_position );
874							$( items[x] ).addClass('changing_position prev_position prev_position_' + prev_position );
875
876							if ( !$( items[x] ).hasClass( 'current_position' ) ) {
877								$( items[x] ).addClass('container_append');
878							} else {
879								$( items[x] ).clone(true).appendTo( $active_carousel_group ).addClass('delayed_container_append_dup').attr('id', $( items[x] ).attr('id') + '-dup' );
880								$( items[x] ).addClass('delayed_container_append');
881							}
882
883							prev_position--;
884						}
885
886						if ( prev_position <= 0 ) {
887							break;
888						}
889
890						if ( x == 0 ) {
891							x = items.length;
892						}
893					}
894
895					var sorted = $carousel_items.find('.container_append, .delayed_container_append_dup').sort(function (a, b) {
896						var el_a_position = parseInt( $(a).data('prev_position') );
897						var el_b_position = parseInt( $(b).data('prev_position') );
898						return ( el_a_position < el_b_position ) ? -1 : ( el_a_position > el_b_position ) ? 1 : 0;
899					});
900
901					$( sorted ).show().appendTo( $prev_carousel_group );
902
903					var left = 0;
904					$prev_carousel_group.children().each(function(){
905						$(this).css({'position':'absolute', 'left': left });
906						left = left + $(this).outerWidth(true);
907					});
908
909					$active_carousel_group.animate({
910						left: '100%'
911					}, {
912						duration: settings.slide_duration,
913						complete: function() {
914							$carousel_items.find('.delayed_container_append').reverse().each(function(){
915								left = $( '#' + $(this).attr('id') + '-dup' ).css('left');
916								$(this).css({'position':'absolute', 'left': left });
917								$(this).prependTo( $prev_carousel_group );
918							});
919
920							$active_carousel_group.removeClass('active');
921							$active_carousel_group.children().each(function(){
922								position = $(this).data('position');
923								current_position = $(this).data('current_position');
924								$(this).removeClass('position_' + position + ' ' + 'changing_position current_position current_position_' + current_position );
925								$(this).data('position', '');
926								$(this).data('current_position', '');
927								$(this).hide();
928								$(this).css({'position': '', 'left': ''});
929								$(this).appendTo( $carousel_items );
930							});
931
932							$active_carousel_group.remove();
933						}
934					} );
935
936					prev_left = (-1) * $active_carousel_group.width() - parseInt( $the_carousel_items.first().css('marginRight').slice(0, -2) );
937					$prev_carousel_group.addClass('active').css({'position':'absolute', 'top':0, left: prev_left });
938					$prev_carousel_group.animate({
939						left: '0%'
940					}, {
941						duration: settings.slide_duration,
942						complete: function(){
943							$prev_carousel_group.removeClass('prev').addClass('active').css({'position':'', 'width':'', 'top':'', 'left': ''});
944
945							$prev_carousel_group.find('.delayed_container_append_dup').remove();
946
947							$prev_carousel_group.find('.changing_position').each(function( index ){
948								position = $(this).data('position');
949								current_position = $(this).data('current_position');
950								prev_position = $(this).data('prev_position');
951								$(this).removeClass('container_append delayed_container_append position_' + position + ' ' + 'changing_position current_position current_position_' + current_position + ' prev_position prev_position_' + prev_position );
952								$(this).data('current_position', '');
953								$(this).data('prev_position', '');
954								position = index + 1;
955								$(this).data('position', position );
956								$(this).addClass('position_' + position );
957							});
958
959							$prev_carousel_group.children().css({'position': '', 'left': ''});
960							$et_carousel.et_animation_running = false;
961						}
962					} );
963				}
964			}
965		}
966
967		$.fn.et_pb_simple_carousel = function( options ) {
968			return this.each(function() {
969				new $.et_pb_simple_carousel(this, options);
970			});
971		}
972
973		$(document).ready( function(){
974			/**
975			 * Provide event listener for plugins to hook up to
976			 */
977			$(window).trigger('et_pb_before_init_modules');
978
979			var $et_pb_slider  = $( '.et_pb_slider' ),
980				$et_pb_tabs    = $( '.et_pb_tabs' ),
981				$et_pb_video_section = $('.et_pb_section_video_bg'),
982				$et_pb_newsletter_button = $( '.et_pb_newsletter_button' ),
983				$et_pb_filterable_portfolio = $( '.et_pb_filterable_portfolio' ),
984				$et_pb_fullwidth_portfolio = $( '.et_pb_fullwidth_portfolio' ),
985				$et_pb_gallery = $( '.et_pb_gallery' ),
986				$et_pb_countdown_timer = $( '.et_pb_countdown_timer' ),
987				$et_post_gallery = $( '.et_post_gallery' ),
988				$et_lightbox_image = $( '.et_pb_lightbox_image'),
989				$et_pb_map    = $( '.et_pb_map_container' ),
990				$et_pb_circle_counter = $( '.et_pb_circle_counter' ),
991				$et_pb_number_counter = $( '.et_pb_number_counter' ),
992				$et_pb_parallax = $( '.et_parallax_bg' ),
993				$et_pb_shop = $( '.et_pb_shop' ),
994				$et_pb_post_fullwidth = $( '.single.et_pb_pagebuilder_layout.et_full_width_page' ),
995				et_is_mobile_device = navigator.userAgent.match( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/ ) !== null,
996				et_is_ipad = navigator.userAgent.match( /iPad/ ),
997				et_is_ie9 = navigator.userAgent.match( /MSIE 9.0/ ) !== null,
998				$et_container = ! et_pb_custom.is_builder_plugin_used ? $( '.container' ) : $( '.et_pb_row' ),
999				et_container_width = $et_container.width(),
1000				et_is_vertical_fixed_nav = $( 'body' ).hasClass( 'et_vertical_fixed' ),
1001				et_is_rtl = $( 'body' ).hasClass( 'rtl' ),
1002				et_hide_nav = $( 'body' ).hasClass( 'et_hide_nav' ),
1003				et_header_style_left = $( 'body' ).hasClass( 'et_header_style_left' ),
1004				$top_header = $('#top-header'),
1005				$main_header = $('#main-header'),
1006				$main_container_wrapper = $( '#page-container' ),
1007				$et_transparent_nav = $( '.et_transparent_nav' ),
1008				$et_pb_first_row = $( 'body.et_pb_pagebuilder_layout .et_pb_section:first-child' ),
1009				$et_main_content_first_row = $( '#main-content .container:first-child' ),
1010				$et_main_content_first_row_meta_wrapper = $et_main_content_first_row.find('.et_post_meta_wrapper:first'),
1011				$et_main_content_first_row_meta_wrapper_title = $et_main_content_first_row_meta_wrapper.find( 'h1' ),
1012				$et_main_content_first_row_content = $et_main_content_first_row.find('.entry-content:first'),
1013				$et_single_post = $( 'body.single-post' ),
1014				etRecalculateOffset = false,
1015				et_header_height,
1016				et_header_modifier,
1017				et_header_offset,
1018				et_primary_header_top,
1019				$et_header_style_split = $('.et_header_style_split'),
1020				$et_top_navigation = $('#et-top-navigation'),
1021				$logo = $('#logo'),
1022				$et_sticky_image = $('.et_pb_image_sticky'),
1023				$et_pb_counter_amount = $('.et_pb_counter_amount'),
1024				$et_pb_carousel = $( '.et_pb_carousel' ),
1025				$et_menu_selector = et_pb_custom.is_divi_theme_used ? $( 'ul.nav' ) : $( '.et_pb_fullwidth_menu ul.nav' ),
1026				et_pb_ab_bounce_rate = et_pb_custom.ab_bounce_rate * 1000,
1027				et_pb_ab_logged_status = {
1028					read_page: false,
1029					read_goal: false,
1030					view_goal: false,
1031					click_goal: false,
1032					con_goal: false,
1033					con_short: false,
1034				};
1035
1036			window.et_pb_slider_init = function( $this_slider ) {
1037				var et_slider_settings = {
1038						fade_speed 		: 700,
1039						slide			: ! $this_slider.hasClass( 'et_pb_gallery' ) ? '.et_pb_slide' : '.et_pb_gallery_item'
1040					}
1041
1042				if ( $this_slider.hasClass('et_pb_slider_no_arrows') )
1043					et_slider_settings.use_arrows = false;
1044
1045				if ( $this_slider.hasClass('et_pb_slider_no_pagination') )
1046					et_slider_settings.use_controls = false;
1047
1048				if ( $this_slider.hasClass('et_slider_auto') ) {
1049					var et_slider_autospeed_class_value = /et_slider_speed_(\d+)/g;
1050
1051					et_slider_settings.slideshow = true;
1052
1053					et_slider_autospeed = et_slider_autospeed_class_value.exec( $this_slider.attr('class') );
1054
1055					et_slider_settings.slideshow_speed = et_slider_autospeed === null ? 10 : et_slider_autospeed[1];
1056				}
1057
1058				if ( $this_slider.parent().hasClass('et_pb_video_slider') ) {
1059					et_slider_settings.controls_below = true;
1060					et_slider_settings.append_controls_to = $this_slider.parent();
1061
1062					setTimeout( function() {
1063						$( '.et_pb_preload' ).removeClass( 'et_pb_preload' );
1064					}, 500 );
1065				}
1066
1067				if ( $this_slider.hasClass('et_pb_slider_carousel') )
1068					et_slider_settings.use_carousel = true;
1069
1070				$this_slider.et_pb_simple_slider( et_slider_settings );
1071			}
1072
1073			var $et_top_menu = $et_menu_selector,
1074				et_parent_menu_longpress_limit = 300,
1075				et_parent_menu_longpress_start,
1076				et_parent_menu_click = true,
1077				is_frontend_builder = $('body').hasClass('et-fb'),
1078				et_menu_hover_triggered = false;
1079
1080			// log the conversion if visitor is on Thank You page and comes from the Shop module which is the Goal
1081			if ( $( '.et_pb_ab_shop_conversion' ).length && typeof et_pb_get_cookie_value( 'et_pb_ab_shop_log' ) !== 'undefined' && '' !== et_pb_get_cookie_value( 'et_pb_ab_shop_log' ) ) {
1082				var shop_log_data = et_pb_get_cookie_value( 'et_pb_ab_shop_log' ).split( '_' );
1083					page_id = shop_log_data[0],
1084					subject_id = shop_log_data[1],
1085					test_id = shop_log_data[2];
1086
1087				et_pb_ab_update_stats( 'con_goal', page_id, subject_id, test_id );
1088
1089				// remove the cookie after conversion is logged
1090				et_pb_set_cookie( 0, 'et_pb_ab_shop_log=true' );
1091			}
1092
1093			// log the conversion if visitor is on page with tracking shortcode
1094			if ( $( '.et_pb_ab_split_track' ).length ) {
1095				$( '.et_pb_ab_split_track' ).each( function() {
1096					var tracking_test = $( this ).data( 'test_id' ),
1097						cookies_name = 'et_pb_ab_shortcode_track_' + tracking_test;
1098
1099					if ( typeof et_pb_get_cookie_value( cookies_name ) !== 'undefined' && '' !== et_pb_get_cookie_value( cookies_name ) ) {
1100						var track_data = et_pb_get_cookie_value( cookies_name ).split( '_' );
1101							page_id = track_data[0],
1102							subject_id = track_data[1],
1103							test_id = track_data[2];
1104
1105						et_pb_ab_update_stats( 'con_short', page_id, subject_id, test_id );
1106
1107						// remove the cookie after conversion is logged
1108						et_pb_set_cookie( 0, cookies_name + '=true' );
1109					}
1110				});
1111			}
1112
1113			// init split testing if enabled
1114			if ( et_pb_custom.is_ab_testing_active ) {
1115				et_pb_init_ab_test();
1116			}
1117
1118			if ( $( '.et_pb_row' ).length ) {
1119				$( '.et_pb_row' ).each( function() {
1120					var $this_row = $( this ),
1121						row_class = '';
1122
1123					row_class = et_get_column_types( $this_row.find( '>.et_pb_column' ) );
1124
1125					if ( '' !== row_class && ( -1 !== row_class.indexOf( '1-4' ) || '_4col' === row_class ) ) {
1126						$this_row.addClass( 'et_pb_row' + row_class );
1127					}
1128
1129					if ( $this_row.find( '.et_pb_row_inner' ).length ) {
1130						$this_row.find( '.et_pb_row_inner' ).each( function() {
1131							var $this_row_inner = $( this );
1132							row_class = et_get_column_types( $this_row_inner.find( '.et_pb_column' ) );
1133
1134							if ( '' !== row_class && -1 !== row_class.indexOf( '1-4' ) ) {
1135								$this_row_inner.addClass( 'et_pb_row' + row_class );
1136							}
1137						});
1138					}
1139				});
1140			}
1141
1142			function et_get_column_types( $columns ) {
1143				var row_class = '';
1144
1145				if ( $columns.length ) {
1146					$columns.each( function() {
1147						var $this_column = $( this ),
1148							column_type = $this_column.attr( 'class' ).split( 'et_pb_column_' )[1],
1149							column_type_clean = typeof column_type !== 'undefined' ? column_type.split( ' ', 1 )[0] : '4_4',
1150							column_type_updated = column_type_clean.replace( '_', '-' ).trim();
1151
1152						row_class += '_' + column_type_updated;
1153					});
1154
1155					row_class = '_1-4_1-4_1-4_1-4' === row_class ? '_4col' : row_class;
1156				}
1157
1158				return row_class;
1159			}
1160
1161			$et_top_menu.find( 'li' ).hover( function() {
1162				if ( ! $(this).closest( 'li.mega-menu' ).length || $(this).hasClass( 'mega-menu' ) ) {
1163					$(this).addClass( 'et-show-dropdown' );
1164					$(this).removeClass( 'et-hover' ).addClass( 'et-hover' );
1165					et_menu_hover_triggered = true;
1166				}
1167			}, function() {
1168				var $this_el = $(this);
1169
1170				$this_el.removeClass( 'et-show-dropdown' ).addClass( 'et-dropdown-removing' );
1171
1172				et_menu_hover_triggered = false;
1173
1174				setTimeout( function() {
1175					if ( ! $this_el.hasClass( 'et-show-dropdown' ) ) {
1176						$this_el.removeClass( 'et-hover' ).removeClass( 'et-dropdown-removing' );
1177					}
1178				}, 200 );
1179			} );
1180
1181			// Dropdown menu adjustment for touch screen
1182			$et_top_menu.find('.menu-item-has-children > a').on( 'touchstart', function(){
1183				et_parent_menu_longpress_start = new Date().getTime();
1184			} ).on( 'touchend', function(){
1185				var et_parent_menu_longpress_end = new Date().getTime()
1186				if ( et_parent_menu_longpress_end  >= et_parent_menu_longpress_start + et_parent_menu_longpress_limit ) {
1187					et_parent_menu_click = true;
1188				} else {
1189					et_parent_menu_click = false;
1190
1191					// Some devices emulate hover event on touch, so check that hover event was not triggered to avoid extra mouseleave event triggering
1192					if ( ! et_menu_hover_triggered ) {
1193						// Close sub-menu if toggled
1194						var $et_parent_menu = $(this).parent('li');
1195						if ( $et_parent_menu.hasClass( 'et-hover') ) {
1196							$et_parent_menu.trigger( 'mouseleave' );
1197						} else {
1198							$et_parent_menu.trigger( 'mouseenter' );
1199						}
1200					}
1201				}
1202				et_parent_menu_longpress_start = 0;
1203			} ).click(function() {
1204				if ( et_parent_menu_click ) {
1205					return true;
1206				}
1207
1208				return false;
1209			} );
1210
1211			$et_top_menu.find( 'li.mega-menu' ).each(function(){
1212				var $li_mega_menu           = $(this),
1213					$li_mega_menu_item      = $li_mega_menu.children( 'ul' ).children( 'li' ),
1214					li_mega_menu_item_count = $li_mega_menu_item.length;
1215
1216				if ( li_mega_menu_item_count < 4 ) {
1217					$li_mega_menu.addClass( 'mega-menu-parent mega-menu-parent-' + li_mega_menu_item_count );
1218				}
1219			});
1220
1221			$et_sticky_image.each( function() {
1222				var $this_el            = $(this),
1223					$row                = $this_el.closest('.et_pb_row'),
1224					$section            = $row.closest('.et_pb_section'),
1225					$column             = $this_el.closest( '.et_pb_column' ),
1226					sticky_class        = 'et_pb_section_sticky',
1227					sticky_mobile_class = 'et_pb_section_sticky_mobile';
1228
1229				// If it is not in the last row, continue
1230				if ( ! $row.is( ':last-child' ) ) {
1231					return true;
1232				}
1233
1234				// Make sure sticky image is the last element in the column
1235				if ( ! $this_el.is( ':last-child' ) ) {
1236					return true;
1237				}
1238
1239				// If it is in the last row, find the parent section and attach new class to it
1240				if ( ! $section.hasClass( sticky_class ) ) {
1241					$section.addClass( sticky_class );
1242				}
1243
1244				$column.addClass( 'et_pb_row_sticky' );
1245
1246				if ( ! $section.hasClass( sticky_mobile_class ) && $column.is( ':last-child' ) ) {
1247					$section.addClass( sticky_mobile_class );
1248				}
1249			} );
1250
1251			if ( et_is_mobile_device ) {
1252				$( '.et_pb_section_video_bg' ).each( function() {
1253					var $this_el = $(this);
1254
1255					$this_el.closest( '.et_pb_preload' ).removeClass( 'et_pb_preload' )
1256
1257					$this_el.remove();
1258				} );
1259
1260				$( 'body' ).addClass( 'et_mobile_device' );
1261
1262				if ( ! et_is_ipad ) {
1263					$( 'body' ).addClass( 'et_mobile_device_not_ipad' );
1264				}
1265			}
1266
1267			if ( et_is_ie9 ) {
1268				$( 'body' ).addClass( 'et_ie9' );
1269			}
1270
1271			if ( $et_pb_video_section.length || is_frontend_builder ) {
1272				window.et_pb_video_section_init = function( $et_pb_video_section ) {
1273					$et_pb_video_section.find( 'video' ).mediaelementplayer( {
1274						pauseOtherPlayers: false,
1275						success : function( mediaElement, domObject ) {
1276							mediaElement.addEventListener( 'loadeddata', function() {
1277								et_pb_resize_section_video_bg( $(domObject) );
1278								et_pb_center_video( $(domObject).closest( '.mejs-video' ) );
1279							}, false );
1280
1281							mediaElement.addEventListener( 'canplay', function() {
1282								$(domObject).closest( '.et_pb_preload' ).removeClass( 'et_pb_preload' );
1283							}, false );
1284						}
1285					} );
1286				}
1287				et_pb_video_section_init( $et_pb_video_section );
1288			}
1289
1290			if ( $et_post_gallery.length ) {
1291				// swipe support in magnific popup only if gallery exists
1292				var magnificPopup = $.magnificPopup.instance;
1293
1294				$( 'body' ).on( 'swiperight', '.mfp-container', function() {
1295					magnificPopup.prev();
1296				} );
1297				$( 'body' ).on( 'swipeleft', '.mfp-container', function() {
1298					magnificPopup.next();
1299				} );
1300
1301				$et_post_gallery.each(function() {
1302					$(this).magnificPopup( {
1303						delegate: '.et_pb_gallery_image a',
1304						type: 'image',
1305						removalDelay: 500,
1306						gallery: {
1307							enabled: true,
1308							navigateByImgClick: true
1309						},
1310						mainClass: 'mfp-fade',
1311						zoom: {
1312							enabled: ! et_pb_custom.is_builder_plugin_used,
1313							duration: 500,
1314							opener: function(element) {
1315								return element.find('img');
1316							}
1317						}
1318					} );
1319				} );
1320				// prevent attaching of any further actions on click
1321				$et_post_gallery.find( 'a' ).unbind( 'click' );
1322			}
1323
1324			if ( $et_lightbox_image.length || is_frontend_builder ) {
1325				// prevent attaching of any further actions on click
1326				$et_lightbox_image.unbind( 'click' );
1327				$et_lightbox_image.bind( 'click' );
1328
1329				window.et_pb_image_lightbox_init = function( $et_lightbox_image ) {
1330					$et_lightbox_image.magnificPopup( {
1331						type: 'image',
1332						removalDelay: 500,
1333						mainClass: 'mfp-fade',
1334						zoom: {
1335							enabled: ! et_pb_custom.is_builder_plugin_used,
1336							duration: 500,
1337							opener: function(element) {
1338								return element.find('img');
1339							}
1340						}
1341					} );
1342				}
1343
1344				et_pb_image_lightbox_init( $et_lightbox_image );
1345			}
1346
1347			if ( $et_pb_slider.length || is_frontend_builder ) {
1348				$et_pb_slider.each( function() {
1349					$this_slider = $(this);
1350
1351					et_pb_slider_init( $this_slider );
1352				} );
1353			}
1354
1355			$et_pb_carousel  = $( '.et_pb_carousel' );
1356			if ( $et_pb_carousel.length || is_frontend_builder ) {
1357				$et_pb_carousel.each( function() {
1358					var $this_carousel = $(this),
1359						et_carousel_settings = {
1360							fade_speed 		: 1000
1361						};
1362
1363					$this_carousel.et_pb_simple_carousel( et_carousel_settings );
1364				} );
1365			}
1366
1367			if ( $et_pb_fullwidth_portfolio.length || is_frontend_builder ) {
1368
1369			 	window.et_fullwidth_portfolio_init = function( $the_portfolio ) {
1370					var $portfolio_items = $the_portfolio.find('.et_pb_portfolio_items');
1371
1372						$portfolio_items.data('items', $portfolio_items.find('.et_pb_portfolio_item').toArray() );
1373						$the_portfolio.data('columns_setting_up', false );
1374
1375					if ( $the_portfolio.hasClass('et_pb_fullwidth_portfolio_carousel') ) {
1376						// add left and right arrows
1377						$portfolio_items.prepend('<div class="et-pb-slider-arrows"><a class="et-pb-arrow-prev" href="#">
1377' + '<span>' + et_pb_custom.previous + '</span>' + '</a><a class="et-pb-arrow-next" href="#">' + '<span>' + et_pb_custom.next + '</span>' + '</a></div>');
1378
1379						set_fullwidth_portfolio_columns( $the_portfolio, true );
1380
1381						et_carousel_auto_rotate( $the_portfolio );
1382
1383						// swipe support
1384						$the_portfolio.on( 'swiperight', function() {
1385							$( this ).find( '.et-pb-arrow-prev' ).click();
1386						});
1387						$the_portfolio.on( 'swipeleft', function() {
1388							$( this ).find( '.et-pb-arrow-next' ).click();
1389						});
1390
1391						$the_portfolio.hover(
1392							function(){
1393								$(this).addClass('et_carousel_hovered');
1394								if ( typeof $(this).data('et_carousel_timer') != 'undefined' ) {
1395									clearInterval( $(this).data('et_carousel_timer') );
1396								}
1397							},
1398							function(){
1399								$(this).removeClass('et_carousel_hovered');
1400								et_carousel_auto_rotate( $(this) );
1401							}
1402						);
1403
1404						$the_portfolio.data('carouseling', false );
1405
1406						$the_portfolio.on('click', '.et-pb-slider-arrows a', function(e){
1407							fullwidth_portfolio_carousel_slide( $( this) );
1408							e.preventDefault();
1409							return false;
1410						});
1411
1412					} else {
1413						// setup fullwidth portfolio grid
1414						set_fullwidth_portfolio_columns( $the_portfolio, false );
1415					}
1416			 	}
1417
1418			 	function fullwidth_portfolio_carousel_slide( $arrow ) {
1419			 		var $the_portfolio = $arrow.parents('.et_pb_fullwidth_portfolio'),
1420						$portfolio_items = $the_portfolio.find('.et_pb_portfolio_items'),
1421						$the_portfolio_items = $portfolio_items.find('.et_pb_portfolio_item'),
1422						$active_carousel_group = $portfolio_items.find('.et_pb_carousel_group.active'),
1423						slide_duration = 700,
1424						items = $portfolio_items.data('items'),
1425						columns = $portfolio_items.data('portfolio-columns'),
1426						item_width = $active_carousel_group.innerWidth() / columns, //$active_carousel_group.children().first().innerWidth(),
1427						original_item_width = ( 100 / columns ) + '%';
1428
1429					if ( 'undefined' == typeof items ) {
1430						return;
1431					}
1432
1433					if ( $the_portfolio.data('carouseling') ) {
1434						return;
1435					}
1436
1437					$the_portfolio.data('carouseling', true);
1438
1439					$active_carousel_group.children().each(function(){
1440						$(this).css({'width': $(this).innerWidth() + 1, 'position':'absolute', 'left': ( $(this).innerWidth() * ( $(this).data('position') - 1 ) ) });
1441					});
1442
1443					if ( $arrow.hasClass('et-pb-arrow-next') ) {
1444						var $next_carousel_group,
1445							current_position = 1,
1446							next_position = 1,
1447							active_items_start = items.indexOf( $active_carousel_group.children().first()[0] ),
1448							active_items_end = active_items_start + columns,
1449							next_items_start = active_items_end,
1450							next_items_end = next_items_start + columns;
1451
1452						$next_carousel_group = $('<div class="et_pb_carousel_group next" style="display: none;left: 100%;position: absolute;top: 0;">').insertAfter( $active_carousel_group );
1453						$next_carousel_group.css({ 'width': $active_carousel_group.innerWidth() }).show();
1454
1455						// this is an endless loop, so it can decide internally when to break out, so that next_position
1456						// can get filled up, even to the extent of an element having both and current_ and next_ position
1457						for( x = 0, total = 0 ; ; x++, total++ ) {
1458							if ( total >= active_items_start && total < active_items_end ) {
1459								$( items[x] ).addClass( 'changing_position current_position current_position_' + current_position );
1460								$( items[x] ).data('current_position', current_position );
1461								current_position++;
1462							}
1463
1464							if ( total >= next_items_start && total < next_items_end ) {
1465								$( items[x] ).data('next_position', next_position );
1466								$( items[x] ).addClass('changing_position next_position next_position_' + next_position );
1467
1468								if ( !$( items[x] ).hasClass( 'current_position' ) ) {
1469									$( items[x] ).addClass('container_append');
1470								} else {
1471									$( items[x] ).clone(true).appendTo( $active_carousel_group ).hide().addClass('delayed_container_append_dup').attr('id', $( items[x] ).attr('id') + '-dup' );
1472									$( items[x] ).addClass('delayed_container_append');
1473								}
1474
1475								next_position++;
1476							}
1477
1478							if ( next_position > columns ) {
1479								break;
1480							}
1481
1482							if ( x >= ( items.length -1 )) {
1483								x = -1;
1484							}
1485						}
1486
1487						sorted = $portfolio_items.find('.container_append, .delayed_container_append_dup').sort(function (a, b) {
1488							var el_a_position = parseInt( $(a).data('next_position') );
1489							var el_b_position = parseInt( $(b).data('next_position') );
1490							return ( el_a_position < el_b_position ) ? -1 : ( el_a_position > el_b_position ) ? 1 : 0;
1491						});
1492
1493						$( sorted ).show().appendTo( $next_carousel_group );
1494
1495						$next_carousel_group.children().each(function(){
1496							$(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('next_position') - 1 ) ) });
1497						});
1498
1499						$active_carousel_group.animate({
1500							left: '-100%'
1501						}, {
1502							duration: slide_duration,
1503							complete: function() {
1504								$portfolio_items.find('.delayed_container_append').each(function(){
1505									$(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('next_position') - 1 ) ) });
1506									$(this).appendTo( $next_carousel_group );
1507								});
1508
1509								$active_carousel_group.removeClass('active');
1510								$active_carousel_group.children().each(function(){
1511									position = $(this).data('position');
1512									current_position = $(this).data('current_position');
1513									$(this).removeClass('position_' + position + ' ' + 'changing_position current_position current_position_' + current_position );
1514									$(this).data('position', '');
1515									$(this).data('current_position', '');
1516									$(this).hide();
1517									$(this).css({'position': '', 'width': '', 'left': ''});
1518									$(this).appendTo( $portfolio_items );
1519								});
1520
1521								$active_carousel_group.remove();
1522
1523								et_carousel_auto_rotate( $the_portfolio );
1524
1525							}
1526						} );
1527
1528						$next_carousel_group.addClass('active').css({'position':'absolute', 'top':0, left: '100%'});
1529						$next_carousel_group.animate({
1530							left: '0%'
1531						}, {
1532							duration: slide_duration,
1533							complete: function(){
1534								setTimeout(function(){
1535									$next_carousel_group.removeClass('next').addClass('active').css({'position':'', 'width':'', 'top':'', 'left': ''});
1536
1537									$next_carousel_group.find('.delayed_container_append_dup').remove();
1538
1539									$next_carousel_group.find('.changing_position').each(function( index ){
1540										position = $(this).data('position');
1541										current_position = $(this).data('current_position');
1542										next_position = $(this).data('next_position');
1543										$(this).removeClass('container_append delayed_container_append position_' + position + ' ' + 'changing_position current_position current_position_' + current_position + ' next_position next_position_' + next_position );
1544										$(this).data('current_position', '');
1545										$(this).data('next_position', '');
1546										$(this).data('position', ( index + 1 ) );
1547									});
1548
1549									$next_carousel_group.children().css({'position': '', 'width': original_item_width, 'left': ''});
1550
1551									$the_portfolio.data('carouseling', false);
1552								}, 100 );
1553							}
1554						} );
1555
1556					} else {
1557						var $prev_carousel_group,
1558							current_position = columns,
1559							prev_position = columns,
1560							columns_span = columns - 1,
1561							active_items_start = items.indexOf( $active_carousel_group.children().last()[0] ),
1562							active_items_end = active_items_start - columns_span,
1563							prev_items_start = active_items_end - 1,
1564							prev_items_end = prev_items_start - columns_span;
1565
1566						$prev_carousel_group = $('<div class="et_pb_carousel_group prev" style="display: none;left: 100%;position: absolute;top: 0;">').insertBefore( $active_carousel_group );
1567						$prev_carousel_group.css({ 'left': '-' + $active_carousel_group.innerWidth(), 'width': $active_carousel_group.innerWidth() }).show();
1568
1569						// this is an endless loop, so it can decide internally when to break out, so that next_position
1570						// can get filled up, even to the extent of an element having both and current_ and next_ position
1571						for( x = ( items.length - 1 ), total = ( items.length - 1 ) ; ; x--, total-- ) {
1572
1573							if ( total <= active_items_start && total >= active_items_end ) {
1574								$( items[x] ).addClass( 'changing_position current_position current_position_' + current_position );
1575								$( items[x] ).data('current_position', current_position );
1576								current_position--;
1577							}
1578
1579							if ( total <= prev_items_start && total >= prev_items_end ) {
1580								$( items[x] ).data('prev_position', prev_position );
1581								$( items[x] ).addClass('changing_position prev_position prev_position_' + prev_position );
1582
1583								if ( !$( items[x] ).hasClass( 'current_position' ) ) {
1584									$( items[x] ).addClass('container_append');
1585								} else {
1586									$( items[x] ).clone(true).appendTo( $active_carousel_group ).addClass('delayed_container_append_dup').attr('id', $( items[x] ).attr('id') + '-dup' );
1587									$( items[x] ).addClass('delayed_container_append');
1588								}
1589
1590								prev_position--;
1591							}
1592
1593							if ( prev_position <= 0 ) {
1594								break;
1595							}
1596
1597							if ( x == 0 ) {
1598								x = items.length;
1599							}
1600						}
1601
1602						sorted = $portfolio_items.find('.container_append, .delayed_container_append_dup').sort(function (a, b) {
1603							var el_a_position = parseInt( $(a).data('prev_position') );
1604							var el_b_position = parseInt( $(b).data('prev_position') );
1605							return ( el_a_position < el_b_position ) ? -1 : ( el_a_position > el_b_position ) ? 1 : 0;
1606						});
1607
1608						$( sorted ).show().appendTo( $prev_carousel_group );
1609
1610						$prev_carousel_group.children().each(function(){
1611							$(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('prev_position') - 1 ) ) });
1612						});
1613
1614						$active_carousel_group.animate({
1615							left: '100%'
1616						}, {
1617							duration: slide_duration,
1618							complete: function() {
1619								$portfolio_items.find('.delayed_container_append').reverse().each(function(){
1620									$(this).css({'width': item_width, 'position':'absolute', 'left': ( item_width * ( $(this).data('prev_position') - 1 ) ) });
1621									$(this).prependTo( $prev_carousel_group );
1622								});
1623
1624								$active_carousel_group.removeClass('active');
1625								$active_carousel_group.children().each(function(){
1626									position = $(this).data('position');
1627									current_position = $(this).data('current_position');
1628									$(this).removeClass('position_' + position + ' ' + 'changing_position current_position current_position_' + current_position );
1629									$(this).data('position', '');
1630									$(this).data('current_position', '');
1631									$(this).hide();
1632									$(this).css({'position': '', 'width': '', 'left': ''});
1633									$(this).appendTo( $portfolio_items );
1634								});
1635
1636								$active_carousel_group.remove();
1637							}
1638						} );
1639
1640						$prev_carousel_group.addClass('active').css({'position':'absolute', 'top':0, left: '-100%'});
1641						$prev_carousel_group.animate({
1642							left: '0%'
1643						}, {
1644							duration: slide_duration,
1645							complete: function(){
1646								setTimeout(function(){
1647									$prev_carousel_group.removeClass('prev').addClass('active').css({'position':'', 'width':'', 'top':'', 'left': ''});
1648
1649									$prev_carousel_group.find('.delayed_container_append_dup').remove();
1650
1651									$prev_carousel_group.find('.changing_position').each(function( index ){
1652										position = $(this).data('position');
1653										current_position = $(this).data('current_position');
1654										prev_position = $(this).data('prev_position');
1655										$(this).removeClass('container_append delayed_container_append position_' + position + ' ' + 'changing_position current_position current_position_' + current_position + ' prev_position prev_position_' + prev_position );
1656										$(this).data('current_position', '');
1657										$(this).data('prev_position', '');
1658										position = index + 1;
1659										$(this).data('position', position );
1660										$(this).addClass('position_' + position );
1661									});
1662
1663									$prev_carousel_group.children().css({'position': '', 'width': original_item_width, 'left': ''});
1664									$the_portfolio.data('carouseling', false);
1665								}, 100 );
1666							}
1667						} );
1668					}
1669			 	}
1670
1671				function set_fullwidth_portfolio_columns( $the_portfolio, carousel_mode ) {
1672					var columns,
1673						$portfolio_items = $the_portfolio.find('.et_pb_portfolio_items'),
1674						portfolio_items_width = $portfolio_items.width(),
1675						$the_portfolio_items = $portfolio_items.find('.et_pb_portfolio_item'),
1676						portfolio_item_count = $the_portfolio_items.length;
1677
1678					if ('undefined' === typeof $the_portfolio_items) {
1679						return;
1680					}
1681
1682					// calculate column breakpoints
1683					if ( portfolio_items_width >= 1600 ) {
1684						columns = 5;
1685					} else if ( portfolio_items_width >= 1024 ) {
1686						columns = 4;
1687					} else if ( portfolio_items_width >= 768 ) {
1688						columns = 3;
1689					} else if ( portfolio_items_width >= 480 ) {
1690						columns = 2;
1691					} else {
1692						columns = 1;
1693					}
1694
1695					// set height of items
1696					portfolio_item_width = portfolio_items_width / columns;
1697					portfolio_item_height = portfolio_item_width * .75;
1698
1699					if ( carousel_mode ) {
1700						$portfolio_items.css({ 'height' : portfolio_item_height });
1701					}
1702
1703					$the_portfolio_items.css({ 'height' : portfolio_item_height });
1704
1705					if ( columns === $portfolio_items.data('portfolio-columns') ) {
1706						return;
1707					}
1708
1709					if ( $the_portfolio.data('columns_setting_up') ) {
1710						return;
1711					}
1712
1713					$the_portfolio.data('columns_setting_up', true );
1714
1715					var portfolio_item_width_percentage = ( 100 / columns ) + '%';
1716					$the_portfolio_items.css({ 'width' : portfolio_item_width_percentage });
1717
1718					// store last setup column
1719					$portfolio_items.removeClass('columns-' + $portfolio_items.data('portfolio-columns') );
1720					$portfolio_items.addClass('columns-' + columns );
1721					$portfolio_items.data('portfolio-columns', columns );
1722
1723					if ( !carousel_mode ) {
1724						return $the_portfolio.data('columns_setting_up', false );
1725					}
1726
1727					// kill all previous groups to get ready to re-group
1728					if ( $portfolio_items.find('.et_pb_carousel_group').length ) {
1729						$the_portfolio_items.appendTo( $portfolio_items );
1730						$portfolio_items.find('.et_pb_carousel_group').remove();
1731					}
1732
1733					// setup the grouping
1734					var the_portfolio_items = $portfolio_items.data('items' ),
1735						$carousel_group = $('<div class="et_pb_carousel_group active">').appendTo( $portfolio_items );
1736
1737					if ('undefined' === typeof the_portfolio_items) {
1738						return;
1739					}
1740
1741					$the_portfolio_items.data('position', '');
1742					if ( the_portfolio_items.length <= columns ) {
1743						$portfolio_items.find('.et-pb-slider-arrows').hide();
1744					} else {
1745						$portfolio_items.find('.et-pb-slider-arrows').show();
1746					}
1747
1748					for ( position = 1, x=0 ;x < the_portfolio_items.length; x++, position++ ) {
1749						if ( x < columns ) {
1750							$( the_portfolio_items[x] ).show();
1751							$( the_portfolio_items[x] ).appendTo( $carousel_group );
1752							$( the_portfolio_items[x] ).data('position', position );
1753							$( the_portfolio_items[x] ).addClass('position_' + position );
1754						} else {
1755							position = $( the_portfolio_items[x] ).data('position');
1756							$( the_portfolio_items[x] ).removeClass('position_' + position );
1757							$( the_portfolio_items[x] ).data('position', '' );
1758							$( the_portfolio_items[x] ).hide();
1759						}
1760					}
1761
1762					$the_portfolio.data('columns_setting_up', false );
1763
1764				}
1765
1766				function et_carousel_auto_rotate( $carousel ) {
1767					if ( 'on' === $carousel.data('auto-rotate') && $carousel.find('.et_pb_portfolio_item').length > $carousel.find('.et_pb_carousel_group .et_pb_portfolio_item').length && ! $carousel.hasClass( 'et_carousel_hovered' ) ) {
1768
1769						et_carousel_timer = setTimeout( function() {
1770							fullwidth_portfolio_carousel_slide( $carousel.find('.et-pb-arrow-next') );
1771						}, $carousel.data('auto-rotate-speed') );
1772
1773						$carousel.data('et_carousel_timer', et_carousel_timer);
1774					}
1775				}
1776
1777				$et_pb_fullwidth_portfolio.each(function(){
1778					et_fullwidth_portfolio_init( $(this) );
1779				});
1780			}
1781
1782			function et_audio_module_set() {
1783				if ( $( '.et_pb_audio_module .mejs-audio' ).length || $( '.et_audio_content .mejs-audio' ).length ) {
1784					$( '.et_audio_container' ).each( function(){
1785						et_pb_audio_module_init( $(this) );
1786					});
1787				}
1788			}
1789
1790			window.et_pb_audio_module_init = function( $audio_container ) {
1791				var $this_player = $audio_container,
1792					$time_rail = $this_player.find( '.mejs-time-rail' ),
1793					$time_slider = $this_player.find( '.mejs-time-slider' );
1794				// remove previously added width and min-width attributes to calculate the new sizes accurately
1795				$time_rail.removeAttr( 'style' );
1796				$time_slider.removeAttr( 'style' );
1797
1798				var $count_timer = $this_player.find( 'div.mejs-currenttime-container' ),
1799					player_width = $this_player.width(),
1800					controls_play_width = $this_player.find( '.mejs-play' ).outerWidth(),
1801					time_width = $this_player.find( '.mejs-currenttime-container' ).outerWidth(),
1802					volume_icon_width = $this_player.find( '.mejs-volume-button' ).outerWidth(),
1803					volume_bar_width = $this_player.find( '.mejs-horizontal-volume-slider' ).outerWidth(),
1804					new_time_rail_width;
1805
1806				$count_timer.addClass( 'custom' );
1807				$this_player.find( '.mejs-controls div.mejs-duration-container' ).replaceWith( $count_timer );
1808				new_time_rail_width = player_width - ( controls_play_width + time_width + volume_icon_width + volume_bar_width + 65 );
1809
1810				if ( 0 < new_time_rail_width ) {
1811					$time_rail.attr( 'style', 'min-width: ' + new_time_rail_width + 'px;' );
1812					$time_slider.attr( 'style', 'min-width: ' + new_time_rail_width + 'px;' );
1813				}
1814			}
1815
1816			if ( $('.et_pb_section_video').length ) {
1817				window._wpmejsSettings.pauseOtherPlayers = false;
1818			}
1819
1820			if ( $et_pb_filterable_portfolio.length || is_frontend_builder ) {
1821
1822				window.et_pb_filterable_portfolio_init = function( $selector ) {
1823					if ( typeof $selector !== 'undefined' ){
1824						set_filterable_portfolio_init( $selector );
1825					} else {
1826						$et_pb_filterable_portfolio.each(function(){
1827							set_filterable_portfolio_init( $(this) )
1828						});
1829					}
1830				}
1831
1832				window.set_filterable_portfolio_init = function( $the_portfolio ) {
1833					var $the_portfolio_items = $the_portfolio.find('.et_pb_portfolio_items'),
1834						$left_orientatation = true == $the_portfolio.data( 'rtl' ) ? false : true;
1835
1836					$the_portfolio.show();
1837
1838					set_filterable_grid_items( $the_portfolio );
1839
1840					$the_portfolio.on('click', '.et_pb_portfolio_filter a', function(e){
1841						e.preventDefault();
1842						var category_slug = $(this).data('category-slug');
1843						$the_portfolio_items = $(this).parents('.et_pb_filterable_portfolio').find('.et_pb_portfolio_items');
1844
1845						if ( 'all' == category_slug ) {
1846							$the_portfolio.find('.et_pb_portfolio_filter a').removeClass('active');
1847							$the_portfolio.find('.et_pb_portfolio_filter_all a').addClass('active');
1848							$the_portfolio.find('.et_pb_portfolio_item').removeClass('active inactive');
1849							$the_portfolio.find('.et_pb_portfolio_item').show();
1850							$the_portfolio.find('.et_pb_portfolio_item').addClass('active');
1851						} else {
1852							$the_portfolio.find('.et_pb_portfolio_filter_all').removeClass('active');
1853							$the_portfolio.find('.et_pb_portfolio_filter a').removeClass('active');
1854							$the_portfolio.find('.et_pb_portfolio_filter_all a').removeClass('active');
1855							$(this).addClass('active');
1856
1857							$the_portfolio_items.find('.et_pb_portfolio_item').hide();
1858							$the_portfolio_items.find('.et_pb_portfolio_item').addClass( 'inactive' );
1859							$the_portfolio_items.find('.et_pb_portfolio_item').removeClass('active');
1860							$the_portfolio_items.find('.et_pb_portfolio_item.project_category_' + $(this).data('category-slug') ).show();
1861							$the_portfolio_items.find('.et_pb_portfolio_item.project_category_' + $(this).data('category-slug') ).addClass('active').removeClass( 'inactive' );
1862						}
1863
1864						set_filterable_grid_items( $the_portfolio );
1865						setTimeout(function(){
1866							set_filterable_portfolio_hash( $the_portfolio );
1867						}, 500 );
1868					});
1869
1870					$the_portfolio.on('click', '.et_pb_portofolio_pagination a', function(e){
1871						e.preventDefault();
1872
1873						var to_page = $(this).data('page'),
1874							$the_portfolio = $(this).parents('.et_pb_filterable_portfolio'),
1875							$the_portfolio_items = $the_portfolio.find('.et_pb_portfolio_items');
1876
1877						et_pb_smooth_scroll( $the_portfolio, false, 800 );
1878
1879						if ( $(this).hasClass('page-prev') ) {
1880							to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) - 1;
1881						} else if ( $(this).hasClass('page-next') ) {
1882							to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) + 1;
1883						}
1884
1885						$(this).parents('ul').find('a').removeClass('active');
1886						$(this).parents('ul').find('a.page-' + to_page ).addClass('active');
1887
1888						var current_index = $(this).parents('ul').find('a.page-' + to_page ).parent().index(),
1889							total_pages = $(this).parents('ul').find('li.page').length;
1890
1891						$(this).parent().nextUntil('.page-' + ( current_index + 3 ) ).show();
1892						$(this).parent().prevUntil('.page-' + ( current_index - 3 ) ).show();
1893
1894						$(this).parents('ul').find('li.page').each(function(i){
1895							if ( !$(this).hasClass('prev') && !$(this).hasClass('next') ) {
1896								if ( i < ( current_index - 3 ) ) {
1897									$(this).hide();
1898								} else if ( i > ( current_index + 1 ) ) {
1899									$(this).hide();
1900								} else {
1901									$(this).show();
1902								}
1903
1904								if ( total_pages - current_index <= 2 && total_pages - i <= 5 ) {
1905									$(this).show();
1906								} else if ( current_index <= 3 && i <= 4 ) {
1907									$(this).show();
1908								}
1909
1910							}
1911						});
1912
1913						if ( to_page > 1 ) {
1914							$(this).parents('ul').find('li.prev').show();
1915						} else {
1916							$(this).parents('ul').find('li.prev').hide();
1917						}
1918
1919						if ( $(this).parents('ul').find('a.active').hasClass('last-page') ) {
1920							$(this).parents('ul').find('li.next').hide();
1921						} else {
1922							$(this).parents('ul').find('li.next').show();
1923						}
1924
1925						$the_portfolio.find('.et_pb_portfolio_item').hide();
1926						$the_portfolio.find('.et_pb_portfolio_item').filter(function( index ) {
1927							return $(this).data('page') === to_page;
1928						}).show();
1929
1930						setTimeout(function(){
1931							set_filterable_portfolio_hash( $the_portfolio );
1932						}, 500 );
1933					});
1934
1935					$(this).on('et_hashchange', function( event ){
1936						var params = event.params;
1937						$the_portfolio = $( '#' + event.target.id );
1938
1939						if ( !$the_portfolio.find('.et_pb_portfolio_filter a[data-category-slug="' + params[0] + '"]').hasClass('active') ) {
1940							$the_portfolio.find('.et_pb_portfolio_filter a[data-category-slug="' + params[0] + '"]').click();
1941						}
1942
1943						if ( params[1] ) {
1944							setTimeout(function(){
1945								if ( !$the_portfolio.find('.et_pb_portofolio_pagination a.page-' + params[1]).hasClass('active') ) {
1946									$the_portfolio.find('.et_pb_portofolio_pagination a.page-' + params[1]).addClass('active').click();
1947								}
1948							}, 300 );
1949						}
1950					});
1951				}
1952
1953				// init portfolio if .load event was fired already, wait for the window load otherwise.
1954				if ( window.et_load_event_fired ) {
1955					et_pb_filterable_portfolio_init();
1956				} else {
1957					$(window).load(function(){
1958						et_pb_filterable_portfolio_init();
1959					}); // End $(window).load()
1960				}
1961
1962				function set_filterable_grid_items( $the_portfolio ) {
1963					var active_category = $the_portfolio.find('.et_pb_portfolio_filter > a.active').data('category-slug');
1964
1965					window.et_pb_set_responsive_grid( $the_portfolio.find( '.et_pb_portfolio_items' ), '.et_pb_portfolio_item' );
1966
1967					if ( 'all' === active_category ) {
1968						$the_portfolio_visible_items = $the_portfolio.find('.et_pb_portfolio_item');
1969					} else {
1970						$the_portfolio_visible_items = $the_portfolio.find('.et_pb_portfolio_item.project_category_' + active_category);
1971					}
1972
1973					var visible_grid_items = $the_portfolio_visible_items.length,
1974						posts_number = $the_portfolio.data('posts-number'),
1975						pages = 0 === posts_number ? 1 : Math.ceil( visible_grid_items / posts_number );
1976
1977					set_filterable_grid_pages( $the_portfolio, pages );
1978
1979					var visible_grid_items = 0;
1980					var _page = 1;
1981					$the_portfolio.find('.et_pb_portfolio_item').data('page', '');
1982					$the_portfolio_visible_items.each(function(i){
1983						visible_grid_items++;
1984						if ( 0 === parseInt( visible_grid_items % posts_number ) ) {
1985							$(this).data('page', _page);
1986							_page++;
1987						} else {
1988							$(this).data('page', _page);
1989						}
1990					});
1991
1992					$the_portfolio_visible_items.filter(function() {
1993						return $(this).data('page') == 1;
1994					}).show();
1995
1996					$the_portfolio_visible_items.filter(function() {
1997						return $(this).data('page') != 1;
1998					}).hide();
1999				}
2000
2001				function set_filterable_grid_pages( $the_portfolio, pages ) {
2002					$pagination = $the_portfolio.find('.et_pb_portofolio_pagination');
2003
2004					if ( !$pagination.length ) {
2005						return;
2006					}
2007
2008					$pagination.html('<ul></ul>');
2009					if ( pages <= 1 ) {
2010						return;
2011					}
2012
2013					$pagination_list = $pagination.children('ul');
2014					$pagination_list.append('<li class="prev" style="display:none;"><a href="#" data-page="prev" class="page-prev">' + et_pb_custom.prev + '</a></li>');
2015					for( var page = 1; page <= pages; page++ ) {
2016						var first_page_class = page === 1 ? ' active' : '',
2017							last_page_class = page === pages ? ' last-page' : '',
2018							hidden_page_class = page >= 5 ? ' style="display:none;"' : '';
2019						$pagination_list.append('<li' + hidden_page_class + ' class="page page-' + page + '"><a href="#" data-page="' + page + '" class="page-' + page + first_page_class + last_page_class + '">' + page + '</a></li>');
2020					}
2021					$pagination_list.append('<li class="next"><a href="#" data-page="next" class="page-next">' + et_pb_custom.next + '</a></li>');
2022				}
2023
2024				function set_filterable_portfolio_hash( $the_portfolio ) {
2025
2026					if ( !$the_portfolio.attr('id') ) {
2027						return;
2028					}
2029
2030					var this_portfolio_state = [];
2031					this_portfolio_state.push( $the_portfolio.attr('id') );
2032					this_portfolio_state.push( $the_portfolio.find('.et_pb_portfolio_filter > a.active').data('category-slug') );
2033
2034					if ( $the_portfolio.find('.et_pb_portofolio_pagination a.active').length ) {
2035						this_portfolio_state.push( $the_portfolio.find('.et_pb_portofolio_pagination a.active').data('page') );
2036					} else {
2037						this_portfolio_state.push( 1 );
2038					}
2039
2040					this_portfolio_state = this_portfolio_state.join( et_hash_module_param_seperator );
2041
2042					et_set_hash( this_portfolio_state );
2043				}
2044			} /*  end if ( $et_pb_filterable_portfolio.length ) */
2045
2046			if ( $et_pb_gallery.length || is_frontend_builder ) {
2047
2048				window.set_gallery_grid_items = function( $the_gallery ) {
2049					var $the_gallery_items_container = $the_gallery.find('.et_pb_gallery_items'),
2050						$the_gallery_items = $the_gallery_items_container.find('.et_pb_gallery_item');
2051
2052					var total_grid_items = $the_gallery_items.length,
2053						posts_number_original = parseInt( $the_gallery_items_container.attr('data-per_page') ),
2054						posts_number = isNaN( posts_number_original ) || 0 === posts_number_original ? 4 : posts_number_original,
2055						pages = Math.ceil( total_grid_items / posts_number );
2056
2057					set_gallery_grid_pages( $the_gallery, pages );
2058
2059					var total_grid_items = 0;
2060					var _page = 1;
2061					$the_gallery_items.data('page', '');
2062					$the_gallery_items.each(function(i){
2063						total_grid_items++;
2064						if ( 0 === parseInt( total_grid_items % posts_number ) ) {
2065							$(this).data('page', _page);
2066							_page++;
2067						} else {
2068							$(this).data('page', _page);
2069						}
2070
2071					});
2072
2073					var visible_items = $the_gallery_items.filter(function() {
2074						return $(this).data('page') == 1;
2075					}).show();
2076
2077					$the_gallery_items.filter(function() {
2078						return $(this).data('page') != 1;
2079					}).hide();
2080				}
2081
2082				window.set_gallery_grid_pages = function( $the_gallery, pages ) {
2083					$pagination = $the_gallery.find('.et_pb_gallery_pagination');
2084
2085					if ( !$pagination.length ) {
2086						return;
2087					}
2088
2089					$pagination.html('<ul></ul>');
2090					if ( pages <= 1 ) {
2091						$pagination.hide();
2092						return;
2093					}
2094
2095					$pagination_list = $pagination.children('ul');
2096					$pagination_list.append('<li class="prev" style="display:none;"><a href="#" data-page="prev" class="page-prev">' + et_pb_custom.prev + '</a></li>');
2097					for( var page = 1; page <= pages; page++ ) {
2098						var first_page_class = page === 1 ? ' active' : '',
2099							last_page_class = page === pages ? ' last-page' : '',
2100							hidden_page_class = page >= 5 ? ' style="display:none;"' : '';
2101						$pagination_list.append('<li' + hidden_page_class + ' class="page page-' + page + '"><a href="#" data-page="' + page + '" class="page-' + page + first_page_class + last_page_class + '">' + page + '</a></li>');
2102					}
2103					$pagination_list.append('<li class="next"><a href="#" data-page="next" class="page-next">' + et_pb_custom.next + '</a></li>');
2104				}
2105
2106				window.set_gallery_hash = function( $the_gallery ) {
2107
2108					if ( !$the_gallery.attr('id') ) {
2109						return;
2110					}
2111
2112					var this_gallery_state = [];
2113					this_gallery_state.push( $the_gallery.attr('id') );
2114
2115					if ( $the_gallery.find('.et_pb_gallery_pagination a.active').length ) {
2116						this_gallery_state.push( $the_gallery.find('.et_pb_gallery_pagination a.active').data('page') );
2117					} else {
2118						this_gallery_state.push( 1 );
2119					}
2120
2121					this_gallery_state = this_gallery_state.join( et_hash_module_param_seperator );
2122
2123					et_set_hash( this_gallery_state );
2124				}
2125
2126				window.et_pb_gallery_init = function( $the_gallery ) {
2127					if ( $the_gallery.hasClass( 'et_pb_gallery_grid' ) ) {
2128
2129						$the_gallery.show();
2130						set_gallery_grid_items( $the_gallery );
2131
2132						$the_gallery.on('et_hashchange', function( event ){
2133							var params = event.params;
2134							$the_gallery = $( '#' + event.target.id );
2135
2136							if ( page_to = params[0] ) {
2137								if ( !$the_gallery.find('.et_pb_gallery_pagination a.page-' + page_to ).hasClass('active') ) {
2138									$the_gallery.find('.et_pb_gallery_pagination a.page-' + page_to ).addClass('active').click();
2139								}
2140							}
2141						});
2142					}
2143				}
2144
2145				$et_pb_gallery.each(function(){
2146					var $the_gallery = $(this);
2147
2148					et_pb_gallery_init( $the_gallery );
2149				});
2150
2151				$et_pb_gallery.data('paginating', false );
2152
2153				window.et_pb_gallery_pagination_nav = function( $the_gallery ) {
2154					$the_gallery.on('click', '.et_pb_gallery_pagination a', function(e){
2155						e.preventDefault();
2156
2157						var to_page = $(this).data('page'),
2158							$the_gallery = $(this).parents('.et_pb_gallery'),
2159							$the_gallery_items_container = $the_gallery.find('.et_pb_gallery_items'),
2160							$the_gallery_items = $the_gallery_items_container.find('.et_pb_gallery_item');
2161
2162						if ( $the_gallery.data('paginating') ) {
2163							return;
2164						}
2165
2166						$the_gallery.data('paginating', true );
2167
2168						if ( $(this).hasClass('page-prev') ) {
2169							to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) - 1;
2170						} else if ( $(this).hasClass('page-next') ) {
2171							to_page = parseInt( $(this).parents('ul').find('a.active').data('page') ) + 1;
2172						}
2173
2174						$(this).parents('ul').find('a').removeClass('active');
2175						$(this).parents('ul').find('a.page-' + to_page ).addClass('active');
2176
2177						var current_index = $(this).parents('ul').find('a.page-' + to_page ).parent().index(),
2178							total_pages = $(this).parents('ul').find('li.page').length;
2179
2180						$(this).parent().nextUntil('.page-' + ( current_index + 3 ) ).show();
2181						$(this).parent().prevUntil('.page-' + ( current_index - 3 ) ).show();
2182
2183						$(this).parents('ul').find('li.page').each(function(i){
2184							if ( !$(this).hasClass('prev') && !$(this).hasClass('next') ) {
2185								if ( i < ( current_index - 3 ) ) {
2186									$(this).hide();
2187								} else if ( i > ( current_index + 1 ) ) {
2188									$(this).hide();
2189								} else {
2190									$(this).show();
2191								}
2192
2193								if ( total_pages - current_index <= 2 && total_pages - i <= 5 ) {
2194									$(this).show();
2195								} else if ( current_index <= 3 && i <= 4 ) {
2196									$(this).show();
2197								}
2198
2199							}
2200						});
2201
2202						if ( to_page > 1 ) {
2203							$(this).parents('ul').find('li.prev').show();
2204						} else {
2205							$(this).parents('ul').find('li.prev').hide();
2206						}
2207
2208						if ( $(this).parents('ul').find('a.active').hasClass('last-page') ) {
2209							$(this).parents('ul').find('li.next').hide();
2210						} else {
2211							$(this).parents('ul').find('li.next').show();
2212						}
2213
2214						$the_gallery_items.hide();
2215						var visible_items = $the_gallery_items.filter(function( index ) {
2216							return $(this).data('page') === to_page;
2217						}).show();
2218
2219						$the_gallery.data('paginating', false );
2220
2221						window.et_pb_set_responsive_grid( $the_gallery_items_container, '.et_pb_gallery_item' );
2222
2223						setTimeout(function(){
2224							set_gallery_hash( $the_gallery );
2225						}, 100 );
2226
2227						$( 'html, body' ).animate( { scrollTop : $the_gallery.offset().top - 200 }, 200 );
2228					});
2229				}
2230				et_pb_gallery_pagination_nav( $et_pb_gallery );
2231
2232				// Frontend builder's interface wouldn't be able to use $et_pb_gallery as selector
2233				// due to its react component's nature. Using more global selector works.
2234				if ( is_frontend_builder ) {
2235					et_pb_gallery_pagination_nav( $('#et-fb-app') );
2236				}
2237
2238			} /*  end if ( $et_pb_gallery.length ) */
2239
2240			if ( $et_pb_counter_amount.length ) {
2241				$et_pb_counter_amount.each(function(){
2242					window.et_bar_counters_init( $( this ) );
2243				});
2244			} /* $et_pb_counter_amount.length */
2245
2246			window.et_countdown_timer = function( timer ) {
2247				var end_date = parseInt( timer.attr( 'data-end-timestamp') ),
2248					current_date = new Date().getTime() / 1000,
2249					seconds_left = ( end_date - current_date );
2250
2251				days = parseInt(seconds_left / 86400);
2252				days = days > 0 ? days : 0;
2253				seconds_left = seconds_left % 86400;
2254
2255				hours = parseInt(seconds_left / 3600);
2256				hours = hours > 0 ? hours : 0;
2257
2258				seconds_left = seconds_left % 3600;
2259
2260				minutes = parseInt(seconds_left /
2260 60);
2261				minutes = minutes > 0 ? minutes : 0;
2262
2263				seconds = parseInt(seconds_left % 60);
2264				seconds = seconds > 0 ? seconds : 0;
2265
2266				var $days_section = timer.find('.days > .value').parent('.section'),
2267					$hours_section = timer.find('.hours > .value').parent('.section'),
2268					$minutes_section = timer.find('.minutes > .value').parent('.section'),
2269					$seconds_section = timer.find('.seconds > .value').parent('.section');
2270
2271
2272				if ( days == 0 ) {
2273					if ( ! $days_section.hasClass('zero') ) {
2274						timer.find('.days > .value').html( '000' ).parent('.section').addClass('zero').next().addClass('zero');
2275					}
2276				} else {
2277					days_slice = days.toString().length >= 3 ? days.toString().length : 3;
2278					timer.find('.days > .value').html( ('000' + days).slice(-days_slice) );
2279
2280					if ( $days_section.hasClass('zero') ) {
2281						$days_section.removeClass('zero').next().removeClass('zero');
2282					}
2283				}
2284
2285				if ( days == 0 && hours == 0 ) {
2286					if ( ! $hours_section.hasClass('zero') ) {
2287						timer.find('.hours > .value').html('00').parent('.section').addClass('zero').next().addClass('zero');
2288					}
2289				} else {
2290					timer.find('.hours > .value').html( ( '0' + hours ).slice(-2) );
2291
2292					if ( $hours_section.hasClass('zero') ) {
2293						$hours_section.removeClass('zero').next().removeClass('zero');
2294					}
2295				}
2296
2297				if ( days == 0 && hours == 0 && minutes == 0 ) {
2298					if ( ! $minutes_section.hasClass('zero') ) {
2299						timer.find('.minutes > .value').html('00').parent('.section').addClass('zero').next().addClass('zero');
2300					}
2301				} else {
2302					timer.find('.minutes > .value').html( ( '0' + minutes ).slice(-2) );
2303
2304					if ( $minutes_section.hasClass('zero') ) {
2305						$minutes_section.removeClass('zero').next().removeClass('zero');
2306					}
2307				}
2308
2309				if ( days == 0 && hours == 0 && minutes == 0 && seconds == 0 ) {
2310					if ( ! $seconds_section.hasClass('zero') ) {
2311						timer.find('.seconds > .value').html('00').parent('.section').addClass('zero');
2312					}
2313				} else {
2314					timer.find('.seconds > .value').html( ( '0' + seconds ).slice(-2) );
2315
2316					if ( $seconds_section.hasClass('zero') ) {
2317						$seconds_section.removeClass('zero').next().removeClass('zero');
2318					}
2319				}
2320			}
2321
2322			window.et_countdown_timer_labels = function( timer ) {
2323				if ( timer.closest( '.et_pb_column_3_8' ).length || timer.closest( '.et_pb_column_1_4' ).length || timer.children('.et_pb_countdown_timer_container').width() <= 400 ) {
2324					timer.find('.days .label').html( timer.find('.days').data('short') );
2325					timer.find('.hours .label').html( timer.find('.hours').data('short') );
2326					timer.find('.minutes .label').html( timer.find('.minutes').data('short') );
2327					timer.find('.seconds .label').html( timer.find('.seconds').data('short') );
2328				} else {
2329					timer.find('.days .label').html( timer.find('.days').data('full') );
2330					timer.find('.hours .label').html( timer.find('.hours').data('full') );
2331					timer.find('.minutes .label').html( timer.find('.minutes').data('full') );
2332					timer.find('.seconds .label').html( timer.find('.seconds').data('full') );
2333				}
2334			}
2335
2336			if ( $et_pb_countdown_timer.length || is_frontend_builder ) {
2337				window.et_pb_countdown_timer_init = function( $et_pb_countdown_timer ) {
2338					$et_pb_countdown_timer.each(function(){
2339						var timer = $(this);
2340						et_countdown_timer_labels( timer );
2341						et_countdown_timer( timer );
2342						setInterval(function(){
2343							et_countdown_timer( timer );
2344						}, 1000);
2345					});
2346				}
2347				et_pb_countdown_timer_init( $et_pb_countdown_timer );
2348			}
2349
2350			if ( $et_pb_tabs.length || is_frontend_builder ) {
2351				window.et_pb_tabs_init = function( $et_pb_tabs ) {
2352					var $et_pb_tabs_li = $et_pb_tabs.find( '.et_pb_tabs_controls li' );
2353
2354					$et_pb_tabs.et_pb_simple_slider( {
2355						use_controls   : false,
2356						use_arrows     : false,
2357						slide          : '.et_pb_all_tabs > div',
2358						tabs_animation : true
2359					} ).on('et_hashchange', function( event ){
2360						var params = event.params;
2361						var $the_tabs = $( '#' + event.target.id );
2362						var active_tab = params[0];
2363						if ( !$the_tabs.find( '.et_pb_tabs_controls li' ).eq( active_tab ).hasClass('et_pb_tab_active') ) {
2364							$the_tabs.find( '.et_pb_tabs_controls li' ).eq( active_tab ).click();
2365						}
2366					});
2367
2368					$et_pb_tabs_li.click( function() {
2369						var $this_el        = $(this),
2370							$tabs_container = $this_el.closest( '.et_pb_tabs' ).data('et_pb_simple_slider');
2371
2372						if ( $tabs_container.et_animation_running ) return false;
2373
2374						$this_el.addClass( 'et_pb_tab_active' ).siblings().removeClass( 'et_pb_tab_active' );
2375
2376						$tabs_container.data('et_pb_simple_slider').et_slider_move_to( $this_el.index() );
2377
2378						if ( $this_el.closest( '.et_pb_tabs' ).attr('id') ) {
2379							var tab_state = [];
2380							tab_state.push( $this_el.closest( '.et_pb_tabs' ).attr('id') );
2381							tab_state.push( $this_el.index() );
2382							tab_state = tab_state.join( et_hash_module_param_seperator );
2383							et_set_hash( tab_state );
2384						}
2385
2386						return false;
2387					} );
2388				}
2389				window.et_pb_tabs_init( $et_pb_tabs );
2390			}
2391
2392			if ( $et_pb_map.length || is_frontend_builder ) {
2393				function et_pb_init_maps() {
2394					$et_pb_map.each(function(){
2395						et_pb_map_init( $(this) );
2396					});
2397				}
2398
2399				window.et_pb_map_init = function( $this_map_container ) {
2400					if (typeof google === 'undefined') {
2401						return;
2402					}
2403
2404					var $this_map = $this_map_container.children('.et_pb_map'),
2405						this_map_grayscale = $this_map_container.attr( 'data-grayscale' ) || 0,
2406						is_draggable = ( et_is_mobile_device && $this_map.data('mobile-dragging') !== 'off' ) || ! et_is_mobile_device,
2407						infowindow_active;
2408
2409					if ( this_map_grayscale !== 0 ) {
2410						this_map_grayscale = '-' + this_map_grayscale.toString();
2411					}
2412
2413					$this_map_container.data('map', new google.maps.Map( $this_map[0], {
2414						zoom: parseInt( $this_map.attr('data-zoom') ),
2415						center: new google.maps.LatLng( parseFloat( $this_map.attr('data-center-lat') ) , parseFloat( $this_map.attr('data-center-lng') )),
2416						mapTypeId: google.maps.MapTypeId.ROADMAP,
2417						scrollwheel: $this_map.attr('data-mouse-wheel') == 'on' ? true : false,
2418						draggable: is_draggable,
2419						panControlOptions: {
2420							position: $this_map_container.is( '.et_beneath_transparent_nav' ) ? google.maps.ControlPosition.LEFT_BOTTOM : google.maps.ControlPosition.LEFT_TOP
2421						},
2422						zoomControlOptions: {
2423							position: $this_map_container.is( '.et_beneath_transparent_nav' ) ? google.maps.ControlPosition.LEFT_BOTTOM : google.maps.ControlPosition.LEFT_TOP
2424						},
2425						styles: [ {
2426							stylers: [
2427								{ saturation: parseInt( this_map_grayscale ) }
2428							]
2429						} ]
2430					}));
2431
2432					$this_map_container.find('.et_pb_map_pin').each(function(){
2433						var $this_marker = $(this);
2434
2435						var marker = new google.maps.Marker({
2436							position: new google.maps.LatLng( parseFloat( $this_marker.attr('data-lat') ) , parseFloat( $this_marker.attr('data-lng') ) ),
2437							map: $this_map_container.data('map'),
2438							title: $this_marker.attr('data-title'),
2439							icon: { url: et_pb_custom.builder_images_uri + '/marker.png', size: new google.maps.Size( 46, 43 ), anchor: new google.maps.Point( 16, 43 ) },
2440							shape: { coord: [1, 1, 46, 43], type: 'rect' },
2441							anchorPoint: new google.maps.Point(0, -45)
2442						});
2443
2444						if ( $this_marker.find('.infowindow').length ) {
2445							var infowindow = new google.maps.InfoWindow({
2446								content: $this_marker.html()
2447							});
2448
2449							google.maps.event.addListener( $this_map_container.data('map'), 'click', function() {
2450								infowindow.close();
2451							});
2452
2453							google.maps.event.addListener(marker, 'click', function() {
2454								if( infowindow_active ) {
2455									infowindow_active.close();
2456								}
2457								infowindow_active = infowindow;
2458
2459								infowindow.open( $this_map_container.data('map'), marker );
2460							});
2461						}
2462					});
2463				}
2464
2465				if ( window.et_load_event_fired ) {
2466					et_pb_init_maps();
2467				} else {
2468					if ( typeof google !== 'undefined' ) {
2469						google.maps.event.addDomListener(window, 'load', function() {
2470							et_pb_init_maps();
2471						} );
2472					}
2473				}
2474			}
2475
2476			if ( $et_pb_shop.length ) {
2477				$et_pb_shop.each( function() {
2478					var $this_el = $(this),
2479						icon     = $this_el.data('icon') || '';
2480
2481					if ( icon === '' ) {
2482						return true;
2483					}
2484
2485					$this_el.find( '.et_overlay' )
2486						.attr( 'data-icon', icon )
2487						.addClass( 'et_pb_inline_icon' );
2488				} );
2489			}
2490
2491			if ( $et_pb_circle_counter.length || is_frontend_builder ) {
2492
2493				window.et_pb_circle_counter_init = function($the_counter, animate) {
2494					if ( 0 === $the_counter.width() ) {
2495						return;
2496					}
2497
2498					$the_counter.easyPieChart({
2499						animate: {
2500							duration: 1800,
2501							enabled: true
2502						},
2503						size: 0 !== $the_counter.width() ? $the_counter.width() : 10, // set the width to 10 if actual width is 0 to avoid js errors
2504						barColor: $the_counter.data( 'bar-bg-color' ),
2505						trackColor: $the_counter.data( 'color' ) || '#000000',
2506						trackAlpha: $the_counter.data( 'alpha' ) || '0.1',
2507						scaleColor: false,
2508						lineWidth: 5,
2509						onStart: function() {
2510							$(this.el).find('.percent p').css({ 'visibility' : 'visible' });
2511						},
2512						onStep: function(from, to, percent) {
2513							$(this.el).find('.percent-value').text( Math.round( parseInt( percent ) ) );
2514						},
2515						onStop: function(from, to) {
2516							$(this.el).find('.percent-value').text( $(this.el).data('number-value') );
2517						}
2518					});
2519				}
2520
2521				window.et_pb_reinit_circle_counters = function( $et_pb_circle_counter ) {
2522					$et_pb_circle_counter.each(function(){
2523						var $the_counter = $(this);
2524						window.et_pb_circle_counter_init($the_counter, false);
2525
2526						$the_counter.on('containerWidthChanged', function( event ){
2527							$the_counter = $( event.target );
2528							$the_counter.find('canvas').remove();
2529							$the_counter.removeData('easyPieChart' );
2530							window.et_pb_circle_counter_init($the_counter, true);
2531						});
2532
2533					});
2534				}
2535				window.et_pb_reinit_circle_counters( $et_pb_circle_counter );
2536			}
2537
2538			if ( $et_pb_number_counter.length || is_frontend_builder ) {
2539				window.et_pb_reinit_number_counters = function( $et_pb_number_counter ) {
2540					if ( $.fn.fitText ) {
2541						$et_pb_number_counter.find( '.percent p' ).fitText( 0.3 );
2542					}
2543
2544					$et_pb_number_counter.each(function(){
2545						var $this_counter = $(this);
2546						$this_counter.easyPieChart({
2547							animate: {
2548								duration: 1800,
2549								enabled: true
2550							},
2551							size: 0,
2552							trackColor: false,
2553							scaleColor: false,
2554							lineWidth: 0,
2555							onStart: function() {
2556								$(this.el).find('.percent p').css({ 'visibility' : 'visible' });
2557							},
2558							onStep: function(from, to, percent) {
2559								if ( percent != to )
2560									$(this.el).find('.percent-value').text( Math.round( parseInt( percent ) ) );
2561							},
2562							onStop: function(from, to) {
2563								$(this.el).find('.percent-value').text( $(this.el).data('number-value') );
2564							}
2565						});
2566					});
2567				}
2568				window.et_pb_reinit_number_counters( $et_pb_number_counter );
2569			}
2570
2571			window.et_apply_parallax = function() {
2572				if ( ! $(this).length || typeof $(this) === 'undefined' || typeof $(this).offset() === 'undefined') {
2573					return;
2574				}
2575
2576				var $this = $(this),
2577					element_top = $this.offset().top,
2578					window_top = $et_window.scrollTop(),
2579					y_pos = ( ( ( window_top + $et_window.height() ) - element_top ) * 0.3 ),
2580					main_position;
2581
2582				main_position = 'translate(0, ' + y_pos + 'px)';
2583
2584				$this.find('.et_parallax_bg').css( {
2585					'-webkit-transform' : main_position,
2586					'-moz-transform'    : main_position,
2587					'-ms-transform'     : main_position,
2588					'transform'         : main_position
2589				} );
2590			}
2591
2592			window.et_parallax_set_height = function() {
2593				var $this = $(this),
2594					bg_height;
2595
2596				bg_height = ( $et_window.height() * 0.3 + $this.innerHeight() );
2597
2598				$this.find('.et_parallax_bg').css( { 'height' : bg_height } );
2599			}
2600
2601			function et_toggle_animation_callback( initial_toggle_state, $module, $section ) {
2602				if ( 'closed' === initial_toggle_state ) {
2603					$module.removeClass('et_pb_toggle_close').addClass('et_pb_toggle_open');
2604				} else {
2605					$module.removeClass('et_pb_toggle_open').addClass('et_pb_toggle_close');
2606				}
2607
2608				if ( $section.hasClass( 'et_pb_section_parallax' ) && !$section.children().hasClass( 'et_pb_parallax_css') ) {
2609					$.proxy( et_parallax_set_height, $section )();
2610				}
2611			}
2612
2613			$( 'body' ).on( 'click', '.et_pb_toggle_title, .et_fb_toggle_overlay', function() {
2614				var $this_heading         = $(this),
2615					$module               = $this_heading.closest('.et_pb_toggle'),
2616					$section              = $module.parents( '.et_pb_section' ),
2617					$content              = $module.find('.et_pb_toggle_content'),
2618					$accordion            = $module.closest( '.et_pb_accordion' ),
2619					is_accordion          = $accordion.length,
2620					is_accordion_toggling = $accordion.hasClass( 'et_pb_accordion_toggling' ),
2621					window_offset_top     = $(window).scrollTop(),
2622					fixed_header_height   = 0,
2623					initial_toggle_state  = $module.hasClass( 'et_pb_toggle_close' ) ? 'closed' : 'opened',
2624					$accordion_active_toggle,
2625					module_offset;
2626
2627				if ( is_accordion ) {
2628					if ( $module.hasClass('et_pb_toggle_open') || is_accordion_toggling ) {
2629						return false;
2630					}
2631
2632					$accordion.addClass( 'et_pb_accordion_toggling' );
2633					$accordion_active_toggle = $module.siblings('.et_pb_toggle_open');
2634				}
2635
2636				if ( $content.is( ':animated' ) ) {
2637					return;
2638				}
2639
2640				if ( $('body').hasClass('safari') ) {
2641					$content.fadeToggle( 700, function() {
2642						et_toggle_animation_callback( initial_toggle_state, $module, $section );
2643					} );
2644				} else {
2645					$content.slideToggle( 700, function() {
2646						et_toggle_animation_callback( initial_toggle_state, $module, $section );
2647					} );
2648				}
2649
2650				if ( is_accordion ) {
2651					$accordion_active_toggle.find('.et_pb_toggle_content').slideToggle( 700, function() {
2652						$accordion_active_toggle.removeClass( 'et_pb_toggle_open' ).addClass('et_pb_toggle_close');
2653						$accordion.removeClass( 'et_pb_accordion_toggling' );
2654
2655						module_offset = $module.offset();
2656
2657						// Calculate height of fixed nav
2658						if ( $('#wpadminbar').length ) {
2659							fixed_header_height += $('#wpadminbar').height();
2660						}
2661
2662						if ( $('#top-header').length ) {
2663							fixed_header_height += $('#top-header').height();
2664						}
2665
2666						if ( $('#main-header').length && ! window.et_is_vertical_nav ) {
2667							fixed_header_height += $('#main-header').height();
2668						}
2669
2670						// Compare accordion offset against window's offset and adjust accordingly
2671						if ( ( window_offset_top + fixed_header_height ) > module_offset.top ) {
2672							$('html, body').animate({ scrollTop : ( module_offset.top - fixed_header_height - 50 ) });
2673						}
2674					} );
2675				}
2676			} );
2677
2678			var $et_contact_container = $( '.et_pb_contact_form_container' );
2679
2680			if ( $et_contact_container.length ) {
2681				$et_contact_container.each( function() {
2682					var $this_contact_container = $( this ),
2683						$et_contact_form = $this_contact_container.find( 'form' ),
2684						$et_contact_submit = $this_contact_container.find( 'input.et_pb_contact_submit' ),
2685						$et_inputs = $et_contact_form.find( 'input[type=text],textarea' ),
2686						et_email_reg = /^[\w-]+(\.[\w-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$/,
2687						redirect_url = typeof $this_contact_container.data( 'redirect_url' ) !== 'undefined' ? $this_contact_container.data( 'redirect_url' ) : '';
2688
2689					$et_contact_form.on( 'submit', function( event ) {
2690						var $this_contact_form = $( this ),
2691							$this_inputs = $this_contact_form.find( 'input[type=text],textarea' ),
2692							this_et_contact_error = false,
2693							$et_contact_message = $this_contact_form.closest( '.et_pb_contact_form_container' ).find( '.et-pb-contact-message' ),
2694							et_message = '',
2695							et_fields_message = '',
2696							$this_contact_container = $this_contact_form.closest( '.et_pb_contact_form_container' ),
2697							$captcha_field = $this_contact_form.find( '.et_pb_contact_captcha' ),
2698							form_unique_id = typeof $this_contact_container.data( 'form_unique_num' ) !== 'undefined' ? $this_contact_container.data( 'form_unique_num' ) : 0,
2699							inputs_list = [];
2700						et_message = '<ul>';
2701
2702						$this_inputs.removeClass( 'et_contact_error' );
2703
2704						$this_inputs.each( function(){
2705							var $this_el = $( this ),
2706								this_val = $this_el.val(),
2707								this_label = $this_el.siblings( 'label' ).text(),
2708								field_type = typeof $this_el.data( 'field_type' ) !== 'undefined' ? $this_el.data( 'field_type' ) : 'text',
2709								required_mark = typeof $this_el.data( 'required_mark' ) !== 'undefined' ? $this_el.data( 'required_mark' ) : 'not_required',
2710								original_id = typeof $this_el.data( 'original_id' ) !== 'undefined' ? $this_el.data( 'original_id' ) : '',
2711								default_value;
2712
2713							// add current field data into array of inputs
2714							if ( typeof $this_el.attr( 'id' ) !== 'undefined' ) {
2715								inputs_list.push( { 'field_id' : $this_el.attr( 'id' ), 'original_id' : original_id, 'required_mark' : required_mark, 'field_type' : field_type, 'field_label' : this_label } );
2716							}
2717
2718							// add error message for the field if it is required and empty
2719							if ( 'required' === required_mark && ( '' === this_val || this_label === this_val ) ) {
2720								$this_el.addClass( 'et_contact_error' );
2721								this_et_contact_error = true;
2722
2723								default_value = this_label;
2724
2725								if ( '' === default_value ) {
2726									default_value = et_pb_custom.captcha;
2727								}
2728
2729								et_fields_message += '<li>' + default_value + '</li>';
2730							}
2731
2732							// add error message if email field is not empty and fails the email validation
2733							if ( 'email' === field_type && '' !== this_val && this_label !== this_val && ! et_email_reg.test( this_val ) ) {
2734								$this_el.addClass( 'et_contact_error' );
2735								this_et_contact_error = true;
2736
2737								if ( ! et_email_reg.test( this_val ) ) {
2738									et_message += '<li>' + et_pb_custom.invalid + '</li>';
2739								}
2740							}
2741						});
2742
2743						// check the captcha value if required for current form
2744						if ( $captcha_field.length && '' !== $captcha_field.val() ) {
2745							var first_digit = parseInt( $captcha_field.data( 'first_digit' ) ),
2746								second_digit = parseInt( $captcha_field.data( 'second_digit' ) );
2747
2748							if ( parseInt( $captcha_field.val() ) !== first_digit + second_digit ) {
2749
2750								et_message += '<li>' + et_pb_custom.wrong_captcha + '</li>';
2751								this_et_contact_error = true;
2752
2753								// generate new digits for captcha
2754								first_digit = Math.floor( ( Math.random() * 15 ) + 1 );
2755								second_digit = Math.floor( ( Math.random() * 15 ) + 1 );
2756
2757								// set new digits for captcha
2758								$captcha_field.data( 'first_digit', first_digit );
2759								$captcha_field.data( 'second_digit', second_digit );
2760
2761								// regenerate captcha on page
2762								$this_contact_form.find( '.et_pb_contact_captcha_question' ).empty().append( first_digit  + ' + ' + second_digit );
2763							}
2764
2765						}
2766
2767						if ( ! this_et_contact_error ) {
2768							var $href = $( this ).attr( 'action' ),
2769								form_data = $( this ).serializeArray();
2770
2771							form_data.push( { 'name': 'et_pb_contact_email_fields_' + form_unique_id, 'value' : JSON.stringify( inputs_list ) } );
2772
2773							$this_contact_container.fadeTo( 'fast', 0.2 ).load( $href + ' #' + $this_contact_form.closest( '.et_pb_contact_form_container' ).attr( 'id' ), form_data, function( responseText ) {
2774								if ( ! $( responseText ).find( '.et_pb_contact_error_text').length ) {
2775
2776									et_pb_maybe_log_event( $this_contact_container, 'con_goal' );
2777
2778									// redirect if redirect URL is not empty and no errors in contact form
2779									if ( '' !== redirect_url ) {
2780										window.location.href = redirect_url;
2781									}
2782								}
2783
2784								$this_contact_container.fadeTo( 'fast', 1 );
2785							} );
2786						}
2787
2788						et_message += '</ul>';
2789
2790						if ( '' !== et_fields_message ) {
2791							if ( et_message != '<ul></ul>' ) {
2792								et_message = '<p class="et_normal_padding">' + et_pb_custom.contact_error_message + '</p>' + et_message;
2793							}
2794
2795							et_fields_message = '<ul>' + et_fields_message + '</ul>';
2796
2797							et_fields_message = '<p>' + et_pb_custom.fill_message + '</p>' + et_fields_message;
2798
2799							et_message = et_fields_message + et_message;
2800						}
2801
2802						if ( et_message != '<ul></ul>' ) {
2803							$et_contact_message.html( et_message );
2804
2805							// If parent of this contact form uses parallax
2806							if ( $this_contact_container.parents('.et_pb_section_parallax').length ) {
2807								$this_contact_container.parents('.et_pb_section_parallax').each(function() {
2808									var $parallax_element = $(this),
2809										$parallax         = $parallax_element.children('.et_parallax_bg'),
2810										is_true_parallax  = ( ! $parallax.hasClass( 'et_pb_parallax_css' ) );
2811
2812									if ( is_true_parallax ) {
2813										$et_window.trigger( 'resize' );
2814									}
2815								});
2816							}
2817						}
2818
2819						event.preventDefault();
2820					});
2821				});
2822			}
2823
2824			window.et_pb_play_overlayed_video = function( $play_video ) {
2825				var $this        = $play_video,
2826					$video_image = $this.closest('.et_pb_video_overlay'),
2827					$wrapper     = $this.closest('.et_pb_video, .et_main_video_container, .et_pb_video_wrap'),
2828					$video_iframe = $wrapper.find('iframe'),
2829					is_embedded = $video_iframe.length ? true : false,
2830					video_iframe_src,
2831					video_iframe_src_splitted,
2832					video_iframe_src_autoplay;
2833
2834				if (is_embedded) {
2835					// Add autoplay parameter to automatically play embedded content when overlay is clicked
2836					video_iframe_src = $video_iframe.attr('src');
2837					video_iframe_src_splitted = video_iframe_src.split("?");
2838
2839					if (video_iframe_src.indexOf('autoplay=') !== -1) {
2840						return;
2841					}
2842
2843					if (typeof video_iframe_src_splitted[1] !== 'undefined') {
2844						video_iframe_src_autoplay = video_iframe_src_splitted[0] + "?autoplay=1&amp;" + video_iframe_src_splitted[1];
2845					} else {
2846						video_iframe_src_autoplay = video_iframe_src_splitted[0] + "?autoplay=1";
2847					}
2848
2849					$video_iframe.attr({
2850						'src': video_iframe_src_autoplay
2851					});
2852				} else {
2853					$wrapper.find('video').get(0).play();
2854				}
2855
2856
2857				$video_image.fadeTo( 500, 0, function() {
2858					var $image = $(this);
2859
2860					$image.css( 'display', 'none' );
2861				} );
2862			};
2863
2864			$( '.et_pb_post .et_pb_video_overlay, .et_pb_video .et_pb_video_overlay, .et_pb_video_wrap .et_pb_video_overlay' ).click( function() {
2865				var $this = $(this);
2866
2867				et_pb_play_overlayed_video( $this );
2868
2869				return false;
2870			} );
2871
2872			window.et_pb_resize_section_video_bg = function( $video ) {
2873				$element = typeof $video !== 'undefined' ? $video.closest( '.et_pb_section_video_bg' ) : $( '.et_pb_section_video_bg' );
2874
2875				$element.each( function() {
2876					var $this_el = $(this),
2877						ratio = ( typeof $this_el.attr( 'data-ratio' ) !== 'undefined' ) && ! is_frontend_builder
2878							? $this_el.attr( 'data-ratio' )
2879							: $this_el.find('video').attr( 'width' ) / $this_el.find('video').attr( 'height' ),
2880						$video_elements = $this_el.find( '.mejs-video, video, object' ).css( 'margin', 0 ),
2881						$container = $this_el.closest( '.et_pb_section_video' ).length
2882							? $this_el.closest( '.et_pb_section_video' )
2883							: $this_el.closest( '.et_pb_slides' ),
2884						body_width = $container.innerWidth(),
2885						container_height = $container.innerHeight(),
2886						width, height;
2887					if ( typeof $this_el.attr( 'data-ratio' ) == 'undefined' && !isNaN(ratio) ) {
2888						$this_el.attr( 'data-ratio', ratio );
2889					}
2890
2891					if ( body_width / container_height < ratio ) {
2892						width = container_height * ratio;
2893						height = container_height;
2894					} else {
2895						width = body_width;
2896						height = body_width / ratio;
2897					}
2898
2899					$video_elements.width( width ).height( height );
2900
2901					// need to re-set the values to make it work correctly in Frontend builder
2902					if ( is_frontend_builder ) {
2903						setTimeout( function() {
2904							$video_elements.width( width ).height( height );
2905						}, 0 );
2906					}
2907				} );
2908			};
2909
2910			window.et_pb_center_video = function( $video ) {
2911				$element = typeof $video !== 'undefined' ? $video : $( '.et_pb_section_video_bg .mejs-video' );
2912
2913					$element.each( function() {
2914						var $this_el = $(this);
2915						var $video_width = $this_el.width() / 2;
2916						var $video_width_negative = 0 - $video_width;
2917						$this_el.css("margin-left",$video_width_negative );
2918
2919						// need to re-calculate the values in Frontend builder
2920						if ( is_frontend_builder ) {
2921							setTimeout( function() {
2922								var $video_width = $this_el.width() / 2;
2923								var $video_width_negative = 0 - $video_width;
2924								$this_el.css("margin-left",$video_width_negative );
2925							}, 0 );
2926						}
2927
2928						if ( typeof $video !== 'undefined' ) {
2929							if ( $video.closest( '.et_pb_slider' ).length && ! $video.closest( '.et_pb_first_video' ).length ) {
2930								return false;
2931							}
2932						}
2933					} );
2934			};
2935
2936			window.et_fix_slider_height = function( $slider ) {
2937				var $this_slider = $slider || $et_pb_slider;
2938
2939				if ( ! $this_slider || ! $this_slider.length ) {
2940					return;
2941				}
2942
2943				$this_slider.each( function() {
2944					var $slide_section = $(this).parent( '.et_pb_section' ),
2945						$slides = $(this).find( '.et_pb_slide' ),
2946						$slide_containers = $slides.find( '.et_pb_container' ),
2947						max_height = 0,
2948						image_margin = 0,
2949						need_image_margin_top = $(this).hasClass( 'et_pb_post_slider_image_top' ),
2950						need_image_margin_bottom = $(this).hasClass( 'et_pb_post_slider_image_bottom' );
2951
2952					// If this is appears at the first section beneath transparent nav, skip it
2953					// leave it to et_fix_page_container_position()
2954					if ( $slide_section.is( '.et_pb_section_first' ) ){
2955						return true;
2956					}
2957
2958					$slide_containers.css( 'height', 0 );
2959
2960					// make slides visible to calculate the height correctly
2961					$slides.addClass( 'et_pb_temp_slide' );
2962
2963					$(this).data('et_pb_simple_slider').et_fix_slider_content_images();
2964
2965					$slides.each( function() {
2966						var height = parseFloat( $(this).innerHeight() ),
2967							$slide_image = $(this).find( '.et_pb_slide_image' ),
2968							adjustedHeight = parseFloat( $(this).data( 'adjustedHeight' ) ),
2969							autoTopPadding = isNaN( adjustedHeight ) ? 0 : adjustedHeight;
2970
2971						// reduce the height by autopadding value if slider height was adjusted. This is required in VB.
2972						height = ( autoTopPadding && autoTopPadding < height ) ? ( height - autoTopPadding ) : height;
2973
2974						if ( need_image_margin_top || need_image_margin_bottom ) {
2975							if ( $slide_image.length ) {
2976								// get the margin from slides with image
2977								image_margin = need_image_margin_top ? parseFloat( $slide_image.css( 'margin-top' ) ) : parseFloat( $slide_image.css( 'margin-bottom' ) );
2978								image_margin += 10;
2979							} else {
2980								// add class to slides without image to adjust their height accordingly
2981								$(this).find( '.et_pb_container' ).addClass( 'et_pb_no_image' );
2982							}
2983						}
2984
2985						// mark the slides without content
2986						if ( 0 === Math.abs( parseInt( $(this).find( '.et_pb_slide_description' ).height() ) ) ) {
2987							$(this).find( '.et_pb_container' ).addClass( 'et_pb_empty_slide' );
2988						}
2989
2990						if ( max_height < height ) {
2991							max_height = height;
2992						}
2993					} );
2994
2995					if ( ( max_height + image_margin ) < 1 ) {
2996						// No slides have any content. It's probably being used with background images only.
2997						// Reset the height so that it falls back to the default padding for the content.
2998						$slide_containers.css( 'height', '' );
2999
3000					} else {
3001						$slide_containers.css( 'height', max_height + image_margin );
3002					}
3003
3004					// remove temp class after getting the slider height
3005					$slides.removeClass( 'et_pb_temp_slide' );
3006
3007					// Show the active slide's image (if exists)
3008					$slides.filter('.et-pb-active-slide')
3009						.find( '.et_pb_slide_image' )
3010						.children( 'img' )
3011						.addClass( 'active' );
3012				} );
3013			};
3014
3015			/**
3016			 * Add conditional class to prevent unwanted dropdown nav
3017			 */
3018			function et_fix_nav_direction() {
3019				window_width = $(window).width();
3020				$('.nav li.et-reverse-direction-nav').removeClass( 'et-reverse-direction-nav' );
3021				$('.nav li li ul').each(function(){
3022					var $dropdown       = $(this),
3023						dropdown_width  = $dropdown.width(),
3024						dropdown_offset = $dropdown.offset(),
3025						$parents        = $dropdown.parents('.nav > li');
3026
3027					if ( dropdown_offset.left > ( window_width - dropdown_width ) ) {
3028						$parents.addClass( 'et-reverse-direction-nav' );
3029					}
3030				});
3031			}
3032			et_fix_nav_direction();
3033
3034			et_pb_form_placeholders_init( $( '.et_pb_newsletter_form, .et_pb_comments_module #commentform' ) );
3035
3036			$('.et_pb_fullwidth_menu ul.nav').each(function(i) {
3037				i++;
3038				et_duplicate_menu( $(this), $(this).parents('.et_pb_row').find('div .mobile_nav'), 'mobile_menu' + i, 'et_mobile_menu' );
3039			});
3040
3041			$('.et_pb_fullwidth_menu').each(function() {
3042				var this_menu = $( this ),
3043					bg_color = this_menu.data( 'bg_color' );
3044				if ( bg_color ) {
3045					this_menu.find( 'ul' ).css( { 'background-color' : bg_color } );
3046				}
3047			});
3048
3049			$et_pb_newsletter_button.click( function( event ) {
3050				et_pb_submit_newsletter( $(this), event );
3051			} );
3052
3053			window.et_pb_submit_newsletter = function( $submit, event ) {
3054				if ( $submit.closest( '.et_pb_login_form' ).length || $submit.closest( '.et_pb_feedburner_form' ).length ) {
3055					et_pb_maybe_log_event( $submit.closest( '.et_pb_newsletter' ), 'con_goal' );
3056					return;
3057				}
3058
3059				if ( typeof event !== 'undefined' ) {
3060					event.preventDefault();
3061				}
3062
3063				var $newsletter_container = $submit.closest( '.et_pb_newsletter' ),
3064					$firstname = $newsletter_container.find( 'input[name="et_pb_signup_firstname"]' ),
3065					$lastname = $newsletter_container.find( 'input[name="et_pb_signup_lastname"]' ),
3066					$email = $newsletter_container.find( 'input[name="et_pb_signup_email"]' ),
3067					list_id = $newsletter_container.find( 'input[name="et_pb_signup_list_id"]' ).val(),
3068					$result = $newsletter_container.find( '.et_pb_newsletter_result' ).hide(),
3069					service = $submit.closest( '.et_pb_newsletter_form' ).data( 'service' ) || 'mailchimp';
3070
3071				$firstname.removeClass( 'et_pb_signup_error' );
3072				$lastname.removeClass( 'et_pb_signup_error' );
3073				$email.removeClass( 'et_pb_signup_error' );
3074
3075				et_pb_remove_placeholder_text( $submit.closest( '.et_pb_newsletter_form' ) );
3076
3077				if ( $firstname.val() == '' || $email.val() == '' || list_id === '' ) {
3078					if ( $firstname.val() == '' ) $firstname.addClass( 'et_pb_signup_error' );
3079
3080					if ( $email.val() == '' ) $email.addClass( 'et_pb_signup_error' );
3081
3082					if ( $firstname.val() == '' )
3083						$firstname.val( $firstname.siblings( '.et_pb_contact_form_label' ).text() );
3084
3085					if ( $lastname.val() == '' )
3086						$lastname.val( $lastname.siblings( '.et_pb_contact_form_label' ).text() );
3087
3088					if ( $email.val() == '' )
3089						$email.val( $email.siblings( '.et_pb_contact_form_label' ).text() );
3090
3091					return;
3092				}
3093
3094				$.ajax( {
3095					type: "POST",
3096					url: et_pb_custom.ajaxurl,
3097					dataType: "json",
3098					data:
3099					{
3100						action : 'et_pb_submit_subscribe_form',
3101						et_frontend_nonce : et_pb_custom.et_frontend_nonce,
3102						et_list_id : list_id,
3103						et_firstname : $firstname.val(),
3104						et_lastname : $lastname.val(),
3105						et_email : $email.val(),
3106						et_service : service
3107					},
3108					beforeSend: function() {
3109						$newsletter_container
3110							.find( '.et_pb_newsletter_button' )
3111							.addClass( 'et_pb_button_text_loading' )
3112							.find('.et_subscribe_loader')
3113							.show();
3114					},
3115					complete: function(){
3116						$newsletter_container
3117							.find( '.et_pb_newsletter_button' )
3118							.removeClass( 'et_pb_button_text_loading' )
3119							.find('.et_subscribe_loader')
3120							.hide();
3121					},
3122					success: function( data ){
3123						if ( data ) {
3124							if ( data.error ) {
3125								$result.html( data.error ).show();
3126							}
3127							if ( data.success ) {
3128								$newsletter_container.find( '.et_pb_newsletter_form > p' ).hide();
3129								$result.html( data.success ).show();
3130
3131								et_pb_maybe_log_event( $newsletter_container, 'con_goal' );
3132							}
3133						} else {
3134							$result.html( et_pb_custom.subscription_failed ).show();
3135						}
3136					}
3137				} );
3138			}
3139
3140			window.et_fix_testimonial_inner_width = function() {
3141				var window_width = $( window ).width();
3142
3143				if( window_width > 767 ){
3144					$( '.et_pb_testimonial' ).each( function() {
3145						if ( ! $(this).is(':visible') ) {
3146							return;
3147						}
3148
3149						var $testimonial      = $(this),
3150							testimonial_width = $testimonial.width(),
3151							$portrait         = $testimonial.find( '.et_pb_testimonial_portrait' ),
3152							portrait_width    = $portrait.width(),
3153							$testimonial_inner= $testimonial.find( '.et_pb_testimonial_description_inner' ),
3154							$outer_column     = $testimonial.closest( '.et_pb_column' ),
3155							testimonial_inner_width = testimonial_width,
3156							subtract = ! ( $outer_column.hasClass( 'et_pb_column_1_3' ) || $outer_column.hasClass( 'et_pb_column_1_4' ) || $outer_column.hasClass( 'et_pb_column_3_8' ) ) ? portrait_width + 31 : 0;
3157
3158							$testimonial_inner.width( testimonial_inner_width - subtract );
3159					} );
3160				} else {
3161					$( '.et_pb_testimonial_description_inner' ).removeAttr( 'style' );
3162				}
3163			}
3164			window.et_fix_testimonial_inner_width();
3165
3166			window.et_pb_video_background_init = function( $this_video_background, this_video_background ) {
3167				var $video_background_wrapper = $this_video_background.closest( '.et_pb_section_video_bg' ),
3168					this_video_player = this_video_background.player;
3169
3170				// Entering video's top viewport
3171				$video_background_wrapper.waypoint({
3172					offset: '100%',
3173					handler : function( direction ) {
3174						if ( $this_video_background.is(':visible') && direction === 'down' ) {
3175							this_video_player.play();
3176						} else if ( $this_video_background.is(':visible') && direction === 'up' ) {
3177							this_video_player.pause();
3178						}
3179					}
3180				});
3181
3182				// Entering video's bottom viewport
3183				$video_background_wrapper.waypoint({
3184					offset: function() {
3185						var video_height = this.element.clientHeight,
3186							toggle_offset = Math.ceil( window.innerHeight / 2);
3187
3188						if ( video_height > toggle_offset ) {
3189							toggle_offset = video_height;
3190						}
3191
3192						return toggle_offset * (-1);
3193					},
3194					handler : function( direction ) {
3195						if ( $this_video_background.is(':visible') && direction === 'up' ) {
3196							this_video_player.play();
3197						} else if ( $this_video_background.is(':visible') && direction === 'down' ) {
3198							this_video_player.pause();
3199						}
3200					}
3201				});
3202			}
3203
3204			window.et_reinit_waypoint_modules = et_pb_debounce( function() {
3205					var $et_pb_circle_counter = $( '.et_pb_circle_counter' ),
3206						$et_pb_number_counter = $( '.et_pb_number_counter' ),
3207						$et_pb_video_background = $( '.et_pb_section_video_bg video' );
3208
3209				if ( $.fn.waypoint && 'yes' !== et_pb_custom.ignore_waypoints ) {
3210					$( '.et_pb_counter_container, .et-waypoint' ).waypoint( {
3211						offset: '75%',
3212						handler: function() {
3213							$(this.element).addClass( 'et-animated' );
3214						}
3215					} );
3216
3217					// fallback to 'bottom-in-view' offset, to make sure element become visible when it's on the bottom of page and other offsets are not triggered
3218					$( '.et_pb_counter_container, .et-waypoint' ).waypoint( {
3219						offset: 'bottom-in-view',
3220						handler: function() {
3221							$(this.element).addClass( 'et-animated' );
3222						}
3223					} );
3224
3225					if ( $et_pb_circle_counter.length ) {
3226						$et_pb_circle_counter.each(function(){
3227							var $this_counter = $(this);
3228							if ( ! $this_counter.is( ':visible' ) ) {
3229								return;
3230							}
3231							$this_counter.waypoint({
3232								offset: '65%',
3233								handler: function() {
3234									if ( $this_counter.data( 'PieChartHasLoaded' ) ) {
3235										return;
3236									}
3237
3238									$this_counter.data('easyPieChart').update( $this_counter.data('number-value') );
3239
3240									$this_counter.data( 'PieChartHasLoaded', true );
3241								}
3242							});
3243
3244							// fallback to 'bottom-in-view' offset, to make sure animation applied when element is on the bottom of page and other offsets are not triggered
3245							$this_counter.waypoint({
3246								offset: 'bottom-in-view',
3247								handler: function() {
3248									if ( $this_counter.data( 'PieChartHasLoaded' ) ) {
3249										return;
3250									}
3251
3252									$this_counter.data('easyPieChart').update( $this_counter.data('number-value') );
3253
3254									$this_counter.data( 'PieChartHasLoaded', true );
3255								}
3256							});
3257						});
3258					}
3259
3260					if ( $et_pb_number_counter.length ) {
3261						$et_pb_number_counter.each(function(){
3262							var $this_counter = $(this);
3263							$this_counter.waypoint({
3264								offset: '75%',
3265								handler: function() {
3266									$this_counter.data('easyPieChart').update( $this_counter.data('number-value') );
3267								}
3268							});
3269
3270							// fallback to 'bottom-in-view' offset, to make sure animation applied when element is on the bottom of page and other offsets are not triggered
3271							$this_counter.waypoint({
3272								offset: 'bottom-in-view',
3273								handler: function() {
3274									$this_counter.data('easyPieChart').update( $this_counter.data('number-value') );
3275								}
3276							});
3277						});
3278					}
3279
3280					if ( $( '.et_pb_ab_goal' ).length ) {
3281						var $et_pb_ab_goal = $( '.et_pb_ab_goal' );
3282
3283						$et_pb_ab_goal.waypoint({
3284							offset: '80%',
3285							handler: function() {
3286								if ( et_pb_ab_logged_status['read_goal'] || ! $et_pb_ab_goal.length || ! $et_pb_ab_goal.visible( true ) ) {
3287									return;
3288								}
3289
3290								// log the goal_read if goal is still visible after 3 seconds.
3291								setTimeout( function() {
3292									if ( $et_pb_ab_goal.length && $et_pb_ab_goal.visible( true ) && ! et_pb_ab_logged_status['read_goal'] ) {
3293										et_pb_ab_update_stats( 'read_goal' );
3294									}
3295								}, 3000 );
3296
3297								et_pb_maybe_log_event( $et_pb_ab_goal, 'view_goal' );
3298							}
3299						});
3300					}
3301				} else {
3302					// if no waypoints supported then apply all the animations right away
3303					$( '.et_pb_counter_container, .et-waypoint' ).addClass( 'et-animated' );
3304
3305					if ( $et_pb_circle_counter.length ) {
3306						$et_pb_circle_counter.each(function() {
3307							var $this_counter = $(this);
3308
3309							if ( ! $this_counter.is( ':visible' ) ) {
3310								return;
3311							}
3312
3313							if ( $this_counter.data( 'PieChartHasLoaded' ) ) {
3314								return;
3315							}
3316
3317							$this_counter.data('easyPieChart').update( $this_counter.data('number-value') );
3318
3319							$this_counter.data( 'PieChartHasLoaded', true );
3320						} );
3321					}
3322
3323					if ( $et_pb_number_counter.length ) {
3324						$et_pb_number_counter.each(function(){
3325							var $this_counter = $(this);
3326
3327							$this_counter.data('easyPieChart').update( $this_counter.data('number-value') );
3328						});
3329					}
3330
3331					// log the stats without waypoints
3332					if ( $( '.et_pb_ab_goal' ).length ) {
3333						var $et_pb_ab_goal = $( '.et_pb_ab_goal' );
3334
3335						if ( et_pb_ab_logged_status['read_goal'] || ! $et_pb_ab_goal.length || ! $et_pb_ab_goal.visible( true ) ) {
3336							return;
3337						}
3338
3339						// log the goal_read if goal is still visible after 3 seconds.
3340						setTimeout( function() {
3341							if ( $et_pb_ab_goal.length && $et_pb_ab_goal.visible( true ) && ! et_pb_ab_logged_status['read_goal'] ) {
3342								et_pb_ab_update_stats( 'read_goal' );
3343							}
3344						}, 3000 );
3345
3346						et_pb_maybe_log_event( $et_pb_ab_goal, 'view_goal' );
3347					}
3348				}
3349
3350				if ( $et_pb_video_background.length ) {
3351					$et_pb_video_background.each( function(){
3352						var $this_video_background = $(this);
3353
3354						et_pb_video_background_init( $this_video_background, this );
3355					});
3356				}
3357			}, 100 );
3358
3359			function et_pb_init_ab_test() {
3360				var $et_pb_ab_goal = $( '.et_pb_ab_goal' ),
3361					et_ab_subject_id = et_pb_get_subject_id();
3362
3363				$.each( et_pb_ab_logged_status, function( key, value ) {
3364					var cookie_subject = 'click_goal' === key || 'con_short' === key ? '' : et_ab_subject_id;
3365
3366					et_pb_ab_logged_status[key] = et_pb_check_cookie_value( 'et_pb_ab_' + key + '_' + et_pb_custom.page_id + et_pb_custom.unique_test_id + cookie_subject, 'true' );
3367
3368				});
3369
3370				// log the page read event if user stays on page long enough and if not logged for current subject
3371				if ( ! et_pb_ab_logged_status['read_page'] ) {
3372					setTimeout( function() {
3373						et_pb_ab_update_stats( 'read_page' );
3374					}, et_pb_ab_bounce_rate );
3375				}
3376
3377				// add the cookies for shortcode tracking, if enabled
3378				if ( 'on' === et_pb_custom.is_shortcode_tracking && ! et_pb_ab_logged_status['con_short'] ) {
3379					et_pb_set_cookie( 365, 'et_pb_ab_shortcode_track_' + et_pb_custom.page_id + '=' + et_pb_custom.page_id + '_' + et_pb_get_subject_id() + '_' + et_pb_custom.unique_test_id );
3380				}
3381
3382				if ( $et_pb_ab_goal.length ) {
3383					// if goal is a module and has a button then track the conversions, otherwise track clicks
3384					if ( $et_pb_ab_goal.hasClass( 'et_pb_module' ) && ( $et_pb_ab_goal.hasClass( 'et_pb_button' ) || $et_pb_ab_goal.find( '.et_pb_button' ).length ) ) {
3385						// Log con_goal if current goal doesn't require any specific conversion calculation
3386						if ( ! $et_pb_ab_goal.hasClass( 'et_pb_contact_form_container' ) && ! $et_pb_ab_goal.hasClass( 'et_pb_newsletter' ) ) {
3387							var $goal_button = $et_pb_ab_goal.hasClass( 'et_pb_button' ) ? $et_pb_ab_goal : $et_pb_ab_goal.find( '.et_pb_button' );
3388
3389							if ( $et_pb_ab_goal.hasClass( 'et_pb_comments_module' ) ) {
3390								var page_url = window.location.href,
3391									comment_submitted = -1 !== page_url.indexOf( '#comment-' ) ? true : false,
3392									log_conversion = et_pb_check_cookie_value( 'et_pb_ab_comment_log_' + et_pb_custom.page_id + et_pb_custom.unique_test_id, 'true' );
3393
3394								if ( comment_submitted && log_conversion ) {
3395									et_pb_ab_update_stats( 'con_goal' );
3396									et_pb_set_cookie( 0, 'et_pb_ab_comment_log_' + et_pb_custom.page_id + et_pb_custom.unique_test_id + '=true' );
3397								}
3398							}
3399
3400							$goal_button.click( function(){
3401								if ( $et_pb_ab_goal.hasClass( 'et_pb_comments_module' ) && ! et_pb_ab_logged_status['con_goal'] ) {
3402									et_pb_set_cookie( 365, 'et_pb_ab_comment_log_' + et_pb_custom.page_id + et_pb_custom.unique_test_id + '=true' );
3403									return;
3404								}
3405
3406								et_pb_maybe_log_event( $et_pb_ab_goal, 'click_goal' );
3407							});
3408						}
3409					} else {
3410						$et_pb_ab_goal.click( function() {
3411							if ( $et_pb_ab_goal.hasClass( 'et_pb_shop' ) && ! et_pb_ab_logged_status['con_goal'] ) {
3412								et_pb_set_cookie( 365, 'et_pb_ab_shop_log=' + et_pb_custom.page_id + '_' + et_pb_get_subject_id() + '_' + et_pb_custom.unique_test_id );
3413							}
3414
3415							et_pb_maybe_log_event( $et_pb_ab_goal, 'click_goal' );
3416						});
3417					}
3418				}
3419			}
3420
3421			function et_pb_maybe_log_event( $goal_container, event ) {
3422				var log_event = typeof event === 'undefined' ? 'con_goal' : event;
3423
3424				if ( ! $goal_container.hasClass( 'et_pb_ab_goal' ) || et_pb_ab_logged_status[ log_event ] ) {
3425					return;
3426				}
3427
3428				// log the event if it's not logged for current user
3429				et_pb_ab_update_stats( log_event );
3430			}
3431
3432			function et_pb_ab_update_stats( record_type, set_page_id, set_subject_id, set_test_id ) {
3433				var subject_id = typeof set_subject_id === 'undefined' ? et_pb_get_subject_id() : set_subject_id,
3434					page_id = typeof set_page_id === 'undefined' ? et_pb_custom.page_id : set_page_id,
3435					test_id = typeof set_test_id === 'undefined' ? et_pb_custom.unique_test_id : set_test_id,
3436					stats_data = JSON.stringify({ 'test_id' : page_id, 'subject_id' : subject_id, 'record_type' : record_type }),
3437					cookie_subject = 'click_goal' === record_type || 'con_short' === record_type ? '' : subject_id;
3438
3439				et_pb_set_cookie( 365, 'et_pb_ab_' + record_type + '_' + page_id + test_id + cookie_subject + '=true' );
3440
3441				et_pb_ab_logged_status[record_type] = true;
3442
3443				$.ajax({
3444					type: 'POST',
3445					url: et_pb_custom.ajaxurl,
3446					data: {
3447						action : 'et_pb_update_stats_table',
3448						stats_data_array : stats_data,
3449						et_ab_log_nonce : et_pb_custom.et_ab_log_nonce
3450					}
3451				});
3452			}
3453
3454			function et_pb_get_subject_id() {
3455				var $subject = $( '.et_pb_ab_subject' );
3456
3457				// In case no subject found
3458				if ( $subject.length <= 0 ) {
3459					return false;
3460				}
3461
3462				var subject_classname = $subject.attr( 'class' ),
3463					subject_id_raw = subject_classname.split( 'et_pb_ab_subject_id-' )[1],
3464					subject_id_clean = subject_id_raw.split( ' ' )[0],
3465					subject_id_separated = subject_id_clean.split( '_' ),
3466					subject_id = subject_id_separated[1];
3467
3468				return subject_id;
3469			}
3470
3471			function et_pb_set_cookie_expire( days ) {
3472				var ms = days*24*60*60*1000;
3473
3474				var date = new Date();
3475				date.setTime( date.getTime() + ms );
3476
3477				return "; expires=" + date.toUTCString();
3478			}
3479
3480			function et_pb_check_cookie_value( cookie_name, value ) {
3481				return et_pb_get_cookie_value( cookie_name ) == value;
3482			}
3483
3484			function et_pb_get_cookie_value( cookie_name ) {
3485				return et_pb_parse_cookies()[cookie_name];
3486			}
3487
3488			function et_pb_parse_cookies() {
3489				var cookies = document.cookie.split( '; ' );
3490
3491				var ret = {};
3492				for ( var i = cookies.length - 1; i >= 0; i-- ) {
3493				  var el = cookies[i].split( '=' );
3494				  ret[el[0]] = el[1];
3495				}
3496				return ret;
3497			}
3498
3499			function et_pb_set_cookie( expire, cookie_content ) {
3500				cookie_expire = et_pb_set_cookie_expire( expire );
3501				document.cookie = cookie_content + cookie_expire + "; path=/";
3502			}
3503
3504			function et_pb_get_fixed_main_header_height() {
3505				if ( ! window.et_is_fixed_nav ) {
3506					return 0;
3507				}
3508
3509				var fixed_height_onload = typeof $('#main-header').attr('data-fixed-height-onload') === 'undefined' ? 0 : $('#main-header').attr('data-fixed-height-onload');
3510
3511				return ! window.et_is_fixed_nav ? 0 : parseFloat( fixed_height_onload );
3512			}
3513
3514			var fullscreen_section_width = {};
3515			var fullscreen_section_timeout = {};
3516
3517			window.et_calc_fullscreen_section = function(event) {
3518				var isResizing = typeof event === 'object' && event.type === 'resize',
3519					$et_window = $(window),
3520					$this_section = $(this),
3521					section_index = $this_section.index('.et_pb_fullscreen'),
3522					timeout = isResizing && typeof fullscreen_section_width[section_index] !== 'undefined' && event.target.window_width > fullscreen_section_width[section_index] ? 800 : 0;
3523
3524					fullscreen_section_width[section_index] = $et_window.width();
3525
3526					if ( typeof fullscreen_section_timeout[section_index] !== 'undefined' ) {
3527						clearTimeout( fullscreen_section_timeout[section_index] );
3528					}
3529
3530					fullscreen_section_timeout[section_index] = setTimeout( function() {
3531					var $body = $( 'body' ),
3532						this_section_index = $this_section.index('.et_pb_fullwidth_header'),
3533						this_section_offset = $this_section.offset(),
3534						$header = $this_section.children('.et_pb_fullwidth_header_container'),
3535						$header_content = $header.children('.header-content-container'),
3536						$header_image = $header.children('.header-image-container'),
3537						sectionHeight = window.innerHeight || $et_window.height(),
3538						$wpadminbar = $('#wpadminbar'),
3539						has_wpadminbar = $wpadminbar.length,
3540						wpadminbar_height = has_wpadminbar ? $wpadminbar.height() : 0,
3541						$top_header = $('#top-header'),
3542						has_top_header = $top_header.length,
3543						top_header_height = has_top_header ? $top_header.height() : 0,
3544						$main_header = $('#main-header'),
3545						has_main_header = $main_header.length,
3546						main_header_height = has_main_header ? $main_header.outerHeight() : 0,
3547						fixed_main_header_height = et_pb_get_fixed_main_header_height(),
3548						is_mobile_first_module = this_section_offset.top <= (main_header_height + wpadminbar_height),
3549						is_wp_relative_admin_bar = $et_window.width() < 782,
3550						is_desktop_view = $et_window.width() > 980,
3551						is_tablet_view = $et_window.width() <= 980 && $et_window.width() >= 479,
3552						is_phone_view = $et_window.width() < 479,
3553						overall_header_height = window.et_is_vertical_nav && is_desktop_view ? wpadminbar_height + top_header_height : wpadminbar_height + top_header_height + main_header_height,
3554						is_first_module = this_section_offset.top <= overall_header_height;
3555
3556					// In case theme stored the onload main-header height as data-attribute
3557					if ( $main_header.attr('data-height-onload') ) {
3558						main_header_height = parseFloat( $main_header.attr('data-height-onload') );
3559					}
3560
3561					/**
3562					 * WP Admin Bar:
3563					 *
3564					 * - Desktop fixed: standard
3565					 * - WP Mobile relative: less than 782px window
3566					**/
3567					if ( has_wpadminbar ) {
3568						if ( is_wp_relative_admin_bar ) {
3569							if ( is_first_module ) {
3570								sectionHeight -= wpadminbar_height;
3571							}
3572						} else {
3573							sectionHeight -= wpadminbar_height;
3574						}
3575					}
3576
3577					/**
3578					 * Divi Top Header:
3579					 *
3580					 * - Desktop fixed: standard.
3581					 * - Desktop fixed BUT first header's height shouldn't be substracted: hide nav until scroll activated
3582					 * - Desktop relative: fixed nav bar disabled
3583					 * - Desktop relative: vertical nav activated
3584					 */
3585					if ( has_top_header ) {
3586						if ( is_desktop_view ) {
3587							if ( et_hide_nav && ! window.et_is_vertical_nav ) {
3588								if ( ! is_first_module ) {
3589									sectionHeight -= top_header_height;
3590								}
3591							} else if ( ! window.et_is_fixed_nav || window.et_is_vertical_nav ) {
3592								if ( is_first_module ) {
3593									sectionHeight -= top_header_height;
3594								}
3595							} else {
3596								sectionHeight -= top_header_height;
3597							}
3598						}
3599					}
3600
3601					/**
3602					 * Divi Main Header:
3603					 *
3604					 * - Desktop fixed: standard. Initial and 'fixed' header might have different height
3605					 * - Desktop relative: fixed nav bar disabled
3606					 * - Desktop fixed BUT height should be ignored: vertical nav activated
3607					 * - Desktop fixed BUT height should be ignored for first header only: main header uses rgba
3608					 * - Desktop fixed BUT first header's height shouldn't be substracted: hide nav until scroll activated
3609					 * - Tablet relative: standard. Including vertical header style
3610					 * - Phone relative: standard. Including vertical header style
3611					 */
3612					if ( has_main_header ) {
3613						if ( is_desktop_view ) {
3614							if ( et_hide_nav && ! window.et_is_vertical_nav ) {
3615								if ( ! is_first_module ) {
3616									sectionHeight -= fixed_main_header_height;
3617								}
3618							} else if ( window.et_is_fixed_nav && ! window.et_is_vertical_nav ) {
3619								if ( is_first_module ) {
3620									sectionHeight -= main_header_height;
3621								} else {
3622									sectionHeight -= fixed_main_header_height;
3623								}
3624							} else if ( ! window.et_is_fixed_nav && ! window.et_is_vertical_nav ) {
3625								if ( is_first_module ) {
3626									sectionHeight -= main_header_height;
3627								}
3628							}
3629						} else {
3630							if ( is_first_module ) {
3631								sectionHeight -= main_header_height;
3632							}
3633						}
3634					}
3635
3636					// If the transparent primary nav + hide nav until scroll is being used,
3637					// cancel automatic padding-top added by transparent nav mechanism
3638					if ( $body.hasClass('et_transparent_nav') && $body.hasClass( 'et_hide_nav' ) &&  0 === this_section_index ) {
3639						$this_section.css( 'padding-top', '' );
3640					}
3641
3642					$this_section.css('min-height', sectionHeight + 'px' );
3643					$header.css('min-height', sectionHeight + 'px' );
3644
3645					if ( $header.hasClass('center') && $header_content.hasClass('bottom') && $header_image.hasClass('bottom') ) {
3646						$header.addClass('bottom-bottom');
3647					}
3648
3649					if ( $header.hasClass('center') && $header_content.hasClass('center') && $header_image.hasClass('center') ) {
3650						$header.addClass('center-center');
3651					}
3652
3653					if ( $header.hasClass('center') && $header_content.hasClass('center') && $header_image.hasClass('bottom') ) {
3654						$header.addClass('center-bottom');
3655
3656						var contentHeight = sectionHeight - $header_image.outerHeight( true );
3657
3658						if ( contentHeight > 0 ) {
3659							$header_content.css('min-height', contentHeight + 'px' );
3660						}
3661					}
3662
3663					if ( $header.hasClass('center') && $header_content.hasClass('bottom') && $header_image.hasClass('center') ) {
3664						$header.addClass('bottom-center');
3665					}
3666
3667					if ( ( $header.hasClass('left') || $header.hasClass('right') ) && !$header_content.length && $header_image.length ) {
3668						$header.css('justify-content', 'flex-end');
3669					}
3670
3671					if ( $header.hasClass('center') && $header_content.hasClass('bottom') && !$header_image.length ) {
3672						$header_content.find('.header-content').css( 'margin-bottom', 80 + 'px' );
3673					}
3674
3675					if ( $header_content.hasClass('bottom') && $header_image.hasClass('center') ) {
3676						$header_image.find('.header-image').css( 'margin-bottom', 80 + 'px' );
3677						$header_image.css('align-self', 'flex-end');
3678					}
3679
3680				}, timeout );
3681			}
3682
3683			window.et_pb_parallax_init = function( $this_parallax ) {
3684				if ( $this_parallax.hasClass('et_pb_parallax_css') ) {
3685					return;
3686				}
3687
3688				var $this_parent = $this_parallax.parent();
3689
3690				$.proxy( et_parallax_set_height, $this_parent )();
3691
3692				$.proxy( et_apply_parallax, $this_parent )();
3693
3694				$et_window.on( 'scroll', $.proxy( et_apply_parallax, $this_parent ) );
3695
3696				$et_window.on( 'resize', $.proxy( et_parallax_set_height, $this_parent ) );
3697
3698				$et_window.on( 'resize', $.proxy( et_apply_parallax, $this_parent ) );
3699
3700				$this_parent.find('.et-learn-more .heading-more').click( function() {
3701					setTimeout(function(){
3702						$.proxy( et_parallax_set_height, $this_parent )();
3703					}, 300 );
3704				});
3705			}
3706
3707			$( window ).resize( function(){
3708				var window_width                = $et_window.width(),
3709					et_container_css_width      = $et_container.css( 'width' ),
3710					et_container_width_in_pixel = ( typeof et_container_css_width !== 'undefined' ) ? et_container_css_width.substr( -1, 1 ) !== '%' : '',
3711					et_container_actual_width   = ( et_container_width_in_pixel ) ? $et_container.width() : ( ( $et_container.width() / 100 ) * window_width ), // $et_container.width() doesn't recognize pixel or percentage unit. It's our duty to understand what it returns and convert it properly
3712					containerWidthChanged       = et_container_width !== et_container_actual_width;
3713
3714				et_pb_resize_section_video_bg();
3715				et_pb_center_video();
3716				et_fix_slider_height();
3717				et_fix_nav_direction();
3718
3719				$et_pb_fullwidth_portfolio.each(function(){
3720					set_container_height = $(this).hasClass('et_pb_fullwidth_portfolio_carousel') ? true : false;
3721					set_fullwidth_portfolio_columns( $(this), set_container_height );
3722				});
3723
3724				if ( containerWidthChanged ) {
3725					$('.container-width-change-notify').trigger('containerWidthChanged');
3726
3727					setTimeout( function() {
3728						$et_pb_filterable_portfolio.each(function(){
3729							set_filterable_grid_items( $(this) );
3730						});
3731						$et_pb_gallery.each(function(){
3732							if ( $(this).hasClass( 'et_pb_gallery_grid' ) ) {
3733								set_gallery_grid_items( $(this) );
3734							}
3735						});
3736					}, 100 );
3737
3738					et_container_width = et_container_actual_width;
3739
3740					etRecalculateOffset = true;
3741
3742					if ( $et_pb_circle_counter.length ) {
3743						$et_pb_circle_counter.each(function(){
3744							var $this_counter = $(this);
3745							if ( ! $this_counter.is( ':visible' ) ) {
3746								return;
3747							}
3748
3749							$this_counter.data('easyPieChart').update( $this_counter.data('number-value') );
3750						});
3751					}
3752					if ( $et_pb_countdown_timer.length ) {
3753						$et_pb_countdown_timer.each(function(){
3754							var timer = $(this);
3755							et_countdown_timer_labels( timer );
3756						} );
3757					}
3758				}
3759
3760				window.et_fix_testimonial_inner_width();
3761
3762				et_audio_module_set();
3763
3764				if ( $et_pb_counter_amount.length ) {
3765					$et_pb_counter_amount.each(function(){
3766						window.et_bar_counters_init( $( this ) );
3767					});
3768				} /* $et_pb_counter_amount.length */
3769			} );
3770
3771			$( window ).ready( function(){
3772				if ( $.fn.fitVids ) {
3773					$( '.et_pb_slide_video' ).fitVids();
3774					$( '.et_pb_module' ).fitVids( { customSelector: "iframe[src^='http://www.hulu.com'], iframe[src^='http://www.dailymotion.com'], iframe[src^='http://www.funnyordie.com'], iframe[src^='https://embed-ssl.ted.com'], iframe[src^='http://embed.revision3.com'], iframe[src^='https://flickr.com'], iframe[src^='http://blip.tv'], iframe[src^='http://www.collegehumor.com']"} );
3775				}
3776
3777				et_fix_video_wmode('.fluid-width-video-wrapper');
3778
3779				et_fix_slider_height();
3780
3781				// calculate fullscreen section sizes on $( window ).ready to avoid jumping in some cases
3782				$( 'section.et_pb_fullscreen' ).each( function(){
3783					var $this_section = $( this );
3784
3785					$.proxy( et_calc_fullscreen_section, $this_section )();
3786
3787					$et_window.on( 'resize', $.proxy( et_calc_fullscreen_section, $this_section ) );
3788				});
3789			} );
3790
3791			window.et_pb_fullwidth_header_scroll = function( event ) {
3792				event.preventDefault();
3793
3794				var window_width             = $et_window.width(),
3795					$body                    = $('body'),
3796					is_wp_relative_admin_bar = window_width < 782,
3797					is_transparent_main_header = $body.hasClass( 'et_transparent_nav' ),
3798					is_hide_nav              = $body.hasClass( 'et_hide_nav' ),
3799					is_desktop_view          = window_width > 980,
3800					is_tablet_view           = window_width <= 980 && window_width >= 479,
3801					is_phone_view            = window_width < 479,
3802					$this_section            = $(this).parents( 'section' ),
3803					this_section_offset      = $this_section.offset(),
3804					$wpadminbar              = $('#wpadminbar'),
3805					$main_header             = $('#main-header'),
3806					wpadminbar_height        = $wpadminbar.length && ! is_wp_relative_admin_bar ? $wpadminbar.height() : 0,
3807					top_header_height        = !window.et_is_fixed_nav || !is_desktop_view ? 0 : $top_header.height(),
3808					data_height_onload       = typeof $main_header.attr('data-height-onload') === 'undefined' ? 0 : $main_header.attr('data-height-onload');
3809					initial_fixed_difference = $main_header.height() === et_pb_get_fixed_main_header_height() || ! is_desktop_view || ! window.et_is_fixed_nav || is_transparent_main_header || is_hide_nav ? 0 : et_pb_get_fixed_main_header_height() - parseFloat( data_height_onload ),
3810					section_bottom           = ( this_section_offset.top + $this_section.outerHeight( true ) + initial_fixed_difference ) - ( wpadminbar_height + top_header_height + et_pb_get_fixed_main_header_height() ),
3811					animate_modified         = false;
3812
3813				if ( $this_section.length ) {
3814					var fullscreen_scroll_duration = 800;
3815
3816					$( 'html, body' ).animate( { scrollTop : section_bottom }, {
3817						duration: fullscreen_scroll_duration
3818					} );
3819				}
3820			}
3821
3822			function et_pb_window_load_scripts() {
3823				et_fix_fullscreen_section();
3824
3825				// recalculate fullscreen section sizes on load
3826				$( 'section.et_pb_fullscreen' ).each( function(){
3827					var $this_section = $( this );
3828
3829					$.proxy( et_calc_fullscreen_section, $this_section )();
3830				});
3831
3832				$( '.et_pb_fullwidth_header_scroll' ).on('click', 'a', et_pb_fullwidth_header_scroll );
3833
3834				setTimeout( function() {
3835					$( '.et_pb_preload' ).removeClass( 'et_pb_preload' );
3836				}, 500 );
3837
3838				if ( $.fn.hashchange ) {
3839					$(window).hashchange( function(){
3840						var hash = window.location.hash.substring(1);
3841						process_et_hashchange( hash );
3842					});
3843					$(window).hashchange();
3844				}
3845
3846				if ( $et_pb_parallax.length && !et_is_mobile_device ) {
3847					$et_pb_parallax.each(function(){
3848						et_pb_parallax_init( $(this) );
3849					});
3850				}
3851
3852				et_audio_module_set();
3853
3854				window.et_reinit_waypoint_modules();
3855
3856				if ( $( '.et_audio_content' ).length ) {
3857					$( window ).trigger( 'resize' );
3858				}
3859			}
3860
3861			if ( window.et_load_event_fired ) {
3862				et_pb_window_load_scripts();
3863			} else {
3864				$( window ).load( function() {
3865					et_pb_window_load_scripts();
3866				} );
3867			}
3868
3869			if ( $( '.et_section_specialty' ).length ) {
3870				$( '.et_section_specialty' ).each( function() {
3871					var this_row = $( this ).find( '.et_pb_row' );
3872
3873					this_row.find( '>.et_pb_column:not(.et_pb_specialty_column)' ).addClass( 'et_pb_column_single' );
3874				});
3875			}
3876
3877			/**
3878			* In particular browser, map + parallax doesn't play well due the use of CSS 3D transform
3879			*/
3880			if ( $('.et_pb_section_parallax').length && $('.et_pb_map').length ) {
3881				$('body').addClass( 'parallax-map-support' );
3882			}
3883
3884			/**
3885			 * Add conditional class for search widget in sidebar module
3886			 */
3887			$('.et_pb_widget_area ' + et_pb_custom.widget_search_selector ).each( function() {
3888				var $search_wrap              = $(this),
3889					$search_input_submit      = $search_wrap.find('input[type="submit"]'),
3890					search_input_submit_text = $search_input_submit.attr( 'value' ),
3891					$search_button            = $search_wrap.find('button'),
3892					search_button_text       = $search_button.text(),
3893					has_submit_button         = $search_input_submit.length || $search_button.length ? true : false,
3894					min_column_width          = 150;
3895
3896				if ( ! $search_wrap.find( 'input[type="text"]' ).length && ! $search_wrap.find( 'input[type="search"]' ).length ) {
3897					return;
3898				}
3899
3900				// Mark no button state
3901				if ( ! has_submit_button ) {
3902					$search_wrap.addClass( 'et-no-submit-button' );
3903				}
3904
3905				// Mark narrow state
3906				if ( $search_wrap.width() < 150 ) {
3907					$search_wrap.addClass( 'et-narrow-wrapper' );
3908				}
3909
3910				// Fixes issue where theme's search button has no text: treat it as non-existent
3911				if ( $search_input_submit.length && ( typeof search_input_submit_text == 'undefined' || search_input_submit_text === '' ) ) {
3912					$search_input_submit.remove();
3913					$search_wrap.addClass( 'et-no-submit-button' );
3914				}
3915
3916				if ( $search_button.length && ( typeof search_button_text == 'undefined' || search_button_text === '' ) ) {
3917					$search_button.remove();
3918					$search_wrap.addClass( 'et-no-submit-button' );
3919				}
3920
3921			} );
3922
3923			window.et_pb_search_init = function( $search ) {
3924				var $input_field = $search.find( '.et_pb_s' ),
3925					$button = $search.find( '.et_pb_searchsubmit' ),
3926					input_padding = $search.hasClass( 'et_pb_text_align_right' ) ? 'paddingLeft' : 'paddingRight',
3927					disabled_button = $search.hasClass( 'et_pb_hide_search_button' );
3928
3929				// set the relative button position to get its height correctly
3930				$button.css( { 'position' : 'relative' } );
3931
3932				if ( $button.innerHeight() > $input_field.innerHeight() ) {
3933					$input_field.height( $button.innerHeight() );
3934				}
3935
3936				if ( ! disabled_button ) {
3937					$input_field.css( input_padding, $button.innerWidth() + 10 );
3938				}
3939
3940				// reset the button position back to default
3941				$button.css( { 'position' : '' } );
3942			}
3943
3944			/**
3945			 * Fix search module which has percentage based custom margin
3946			 */
3947			window.et_pb_search_percentage_custom_margin_fix = function( $search ) {
3948				var inputMargin = $search.find( '.et_pb_s' ).css( 'margin' ).split(' ');
3949				var inputMarginObj = {};
3950
3951				switch(inputMargin.length) {
3952					case 4:
3953						inputMarginObj = {
3954							top: inputMargin[0],
3955							right: inputMargin[1],
3956							bottom: inputMargin[2],
3957							left: inputMargin[3],
3958						};
3959						break;
3960					case 2:
3961						inputMarginObj = {
3962							top: inputMargin[0],
3963							right: inputMargin[1],
3964							bottom: inputMargin[0],
3965							left: inputMargin[1],
3966						};
3967						break;
3968					default:
3969						inputMarginObj = {
3970							top: inputMargin[0],
3971							right: inputMargin[0],
3972							bottom: inputMargin[0],
3973							left: inputMargin[0],
3974						};
3975						break;
3976				}
3977
3978				var inputRight = 0 - parseFloat(inputMarginObj.left) + 'px';
3979
3980				$search.find('.et_pb_searchsubmit').css({
3981					top: inputMarginObj.top,
3982					right: inputRight,
3983					bottom: inputMarginObj.bottom,
3984				});
3985			}
3986
3987			if ( $( '.et_pb_search' ).length ) {
3988				$( '.et_pb_search' ).each( function() {
3989					var $search = $(this);
3990
3991					if ( $search.is( '.et_pb_search_percentage_custom_margin' ) ) {
3992						et_pb_search_percentage_custom_margin_fix( $search );
3993					}
3994
3995					et_pb_search_init( $search );
3996				});
3997			}
3998
3999			window.et_pb_comments_init = function( $comments_module ) {
4000				var $comments_module_button = $comments_module.find( '.comment-reply-link, .submit' );
4001
4002				if ( $comments_module_button.length ) {
4003					$comments_module_button.addClass( 'et_pb_button' );
4004
4005					if ( typeof $comments_module.attr( 'data-icon' ) !== 'undefined' && $comments_module.attr( 'data-icon' ) !== '' ) {
4006						$comments_module_button.attr( 'data-icon', $comments_module.attr( 'data-icon' ) );
4007						$comments_module_button.addClass( 'et_pb_custom_button_icon' );
4008					}
4009				}
4010			};
4011
4012			// apply required classes for the Reply buttons in Comments Module
4013			if ( $( '.et_pb_comments_module' ).length ) {
4014				$( '.et_pb_comments_module' ).each( function() {
4015					var $comments_module = $( this );
4016
4017					et_pb_comments_init( $comments_module );
4018				});
4019			}
4020
4021			window.et_fix_pricing_currency_position();
4022
4023			/**
4024			 * Provide event listener for plugins to hook up to
4025			 */
4026			$(document).trigger('et_pb_after_init_modules');
4027		});
4028	}
4029
4030	// Modification of underscore's _.debounce()
4031	// Underscore.js 1.8.3
4032	// http://underscorejs.org
4033	// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
4034	// Underscore may be freely distributed under the MIT license.
4035	window.et_pb_debounce = function(func, wait, immediate) {
4036		var timeout, args, context, timestamp, result;
4037
4038		var now = Date.now || new Date().getTime();
4039
4040		var later = function() {
4041			var last = now - timestamp;
4042
4043			if (last < wait && last >= 0) {
4044				timeout = setTimeout(later, wait - last);
4045			} else {
4046				timeout = null;
4047				if (!immediate) {
4048					result = func.apply(context, args);
4049					if (!timeout) context = args = null;
4050				}
4051			}
4052		};
4053
4054		return function() {
4055			context = this;
4056			args = arguments;
4057			timestamp = now;
4058			var callNow = immediate && !timeout;
4059			if (!timeout) timeout = setTimeout(later, wait);
4060			if (callNow) {
4061				result = func.apply(context, args);
4062				context = args = null;
4063			}
4064
4065			return result;
4066		};
4067	};
4068
4069	if ( et_pb_custom.is_ab_testing_active && 'yes' === et_pb_custom.is_cache_plugin_active ) {
4070		// update the window.et_load_event_fired variable to initiate the scripts properly
4071		$( window ).load( function() {
4072			window.et_load_event_fired = true;
4073		});
4074
4075		// get the subject id for current visitor and display it
4076		// this ajax request performed only if split testing is enabled and cache plugin active
4077		$.ajax( {
4078			type: "POST",
4079			url: et_pb_custom.ajaxurl,
4080			dataType: "json",
4081			data:
4082			{
4083				action : 'et_pb_ab_get_subject_id',
4084				et_frontend_nonce : et_pb_custom.et_frontend_nonce,
4085				et_pb_ab_test_id : et_pb_custom.page_id
4086			},
4087			success: function( subject_data ) {
4088				if ( subject_data ) {
4089					// append the subject content to appropriate placeholder
4090					$( '.et_pb_subject_placeholder_id_' + subject_data.id ).after( subject_data.content );
4091					// remove all other placeholders from the DOM
4092					$( '.et_pb_subject_placeholder' ).remove();
4093
4094					// init all scripts once the subject loaded
4095					window.et_pb_init_modules();
4096					$( 'body' ).trigger( 'et_pb_ab_subject_ready' );
4097				}
4098			}
4099		});
4100	} else {
4101		window.et_pb_init_modules();
4102	}
4103})(jQuery)

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