PageSourceSearch

https://athulyahomecare.com/plugins/goodlayers-core/include/js/page-builder.js

js athulyahomecare.com collected 2026-10-04 19:39:48 UTC 87,151 bytes, 2,618 lines download raw bytes

1/* start page builder */
2(function($){
3	"use strict";
4
5	// Detect Mobile Device
6	var gdlr_core_mobile = false;
7	if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/BlackBerry/i) ||
8		navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/Windows Phone/i) ){ 
9		gdlr_core_mobile = true; 
10	}else{ 
11		gdlr_core_mobile = false; 
12	}
13
14	// Detect Screen
15	var gdlr_core_display = 'desktop';
16	if( typeof(window.matchMedia) == 'function' ){
17		$(window).on('resize themename-set-display gdlr-core-element-resize', function(){
18			if( window.matchMedia('(max-width: 419px)').matches ){
19				gdlr_core_display = 'mobile-portrait';
20			}else if( window.matchMedia('(max-width: 767px)').matches ){
21				gdlr_core_display = 'mobile-landscape'
22			}else if( window.matchMedia('(max-width: 959px)').matches ){
23				gdlr_core_display = 'tablet'
24			}else{
25				gdlr_core_display = 'desktop';
26			}
27		});
28		$(window).trigger('themename-set-display');
29	}else{
30		$(window).on('resize themename-set-display gdlr-core-element-resize', function(){
31			if( $(window).innerWidth() <= 419 ){
32				gdlr_core_display = 'mobile-portrait';
33			}else if( $(window).innerWidth() <= 767 ){
34				gdlr_core_display = 'mobile-landscape'
35			}else if( $(window).innerWidth() <= 959 ){
36				gdlr_core_display = 'tablet'
37			}else{
38				gdlr_core_display = 'desktop';
39			}
40		});
41		$(window).trigger('themename-set-display');
42	}
43	
44	// set cookie
45	function gdlr_core_set_cookie( cname, cvalue, expires ){
46		if( typeof(expires) != 'undefined' ){
47			if( expires == 0 ){
48				expires = 86400;
49			}
50
51			var now = new Date();
52			var new_time  = now.getTime() + (parseInt(expires) * 1000);
53			now.setTime(new_time);
54
55			expires = now.toGMTString();
56		}
57
58	    document.cookie = cname + "=" + encodeURIComponent(cvalue) + "; expires=" + expires + "; path=/";
59	}
60
61	// script for normal content
62	$.fn.gdlr_core_content_script = function( filter_elem, document_ready ){
63
64		$(this).gdlr_core_fluid_video( filter_elem );
65
66		// audio
67		if( !document_ready && typeof($.fn.mediaelementplayer) == 'function' ){
68			var wpme_settings = {
69				"stretching": "responsive"
70			};
71			if( typeof(_wpmejsSettings) !== 'undefined' ){ 
72				wpme_settings.pluginPath = _wpmejsSettings.pluginPath; 
73			}
74
75			$(this).find('audio, video').mediaelementplayer(wpme_settings);
76		}		
77
78		return $(this);
79	}
80	
81	// responsive video
82	$.fn.gdlr_core_fluid_video = function( filter_elem ){
83		
84		if( typeof(filter_elem) == 'undefined' ){
85			var elem = $(this).find('iframe[src*="youtube"], iframe[src*="vimeo"]');
86		}else{
87			var elem = filter_elem.filter('iframe[src*="youtube"], iframe[src*="vimeo"]');
88		}
89		
90		elem.each(function(){
91
92			// ignore if inside slider
93			if( $(this).closest('.ls-container, .master-slider').length <= 0 ){ 
94				if( ($(this).is('embed') && $(this).parent('object').length) || $(this).parent('.gdlr-core-fluid-video-wrapper').length ){ return; } 
95				if( !$(this).attr('id') ){ $(this).attr('id', 'gdlr-video-' + Math.floor(Math.random()*999999)); }			
96			
97				var ratio = $(this).height() / $(this).width();
98				$(this).removeAttr('height').removeAttr('width');
99				
100				try{
101					$(this).wrap('<div class="gdlr-core-fluid-video-wrapper"></div>').parent().css('padding-top', (ratio * 100)+"%");
102					$(this).attr('src', $(this).attr('src'));
103				}catch(e){}
104			}
105		});	
106
107		return $(this);
108	}
109
110	// ajax mejs
111	$.fn.gdlr_core_mejs_ajax = function(){
112		if( typeof($.fn.mediaelementplayer) == 'function' ){
113
114			var wpme_settings = {};
115			if( typeof(_wpmejsSettings) !== 'undefined' ){ wpme_settings.pluginPath = _wpmejsSettings.pluginPath; }
116			$(this).find('audio, video').mediaelementplayer(wpme_settings);
117
118		}
119	}
120
121	// counter item
122	$.fn.gdlr_core_counter_item = function( filter_elem ){
123		
124		if( typeof(filter_elem) == 'undefined' ){
125			var elem = $(this).find('.gdlr-core-counter-item-count[data-counter-start][data-counter-end]');
126		}else{
127			var elem = filter_elem.filter('.gdlr-core-counter-item-count[data-counter-start][data-counter-end]');
128		}
129		
130		elem.each(function(){
131			var counter_item = $(this);
132			var start_num = parseInt($(this).attr('data-counter-start'));
133			var end_num = parseInt($(this).attr('data-counter-end'));
134			var duration_time = ($(this).attr('data-duration'))? parseInt($(this).attr('data-duration')): 4000;
135			
136			if( (gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') || $(window).scrollTop() + $(window).height() > counter_item.offset().top ){
137				$({ counter_num: start_num }).animate({ counter_num: end_num }, { duration: duration_time, easing: 'easeOutExpo', 
138					step: function(){
139						if( this.counter_num > 0.3 ){
140							counter_item.html( Math.ceil(this.counter_num) );
141						}else{
142							counter_item.html( 0 );
143						}
144						
145					}
146				});
147			}else{
148				$(window).on('scroll pb-scroll', function( e ){
149					if( $(this).scrollTop() + $(window).height() > counter_item.offset().top ){
150						$({ counter_num: start_num }).animate({ counter_num: end_num }, { duration: duration_time,  easing: 'easeOutExpo', 
151							step: function(){
152								if( this.counter_num > 0.3 ){
153									counter_item.html( Math.ceil(this.counter_num) );
154								}else{
155									counter_item.html( 0 );
156								}
157							}
158						});
159						
160						$(this).unbind('scroll pb-scroll', e.handleObj.handler, e);
161					}
162				});
163			}
164		});
165	}
166
167	// typed animation item
168	$.fn.gdlr_core_typed_animation = function( filter_elem ){
169		
170		if( typeof(filter_elem) == 'undefined' ){
171			var elem = $(this).find('.gdlr-core-type-animation-item-animated[data-animation-text]');
172		}else{
173			var elem = filter_elem.filter('.gdlr-core-type-animation-item-animated[data-animation-text]');
174		}
175		
176		elem.each(function(){
177
178			var animation_text = JSON.parse($(this).attr('data-animation-text'));
179			
180			if( typeof($.fn.typed) == 'function' && animation_text && animation_text.length > 0 ){
181				$(this).typed({
182					strings: animation_text,
183					typeSpeed: 50,
184					loop: true
185				});
186			}
187		});
188	}
189
190	// countdown item
191	$.fn.gdlr_core_countdown_item = function( filter_elem ){
192		
193		if( typeof(filter_elem) == 'undefined' ){
194			var elem = $(this).find('.gdlr-core-countdown-wrap');
195		}else{
196			var elem = filter_elem.filter('.gdlr-core-countdown-wrap');
197		}
198		
199		elem.each(function(){
200			var day_field = $(this).find('.gdlr-core-day');
201			var day = parseInt(day_field.text());
202			
203			var hrs_field = $(this).find('.gdlr-core-hrs');
204			var hrs = parseInt(hrs_field.text());
205			
206			var min_field = $(this).find('.gdlr-core-min');
207			var min = parseInt(min_field.text());
208			
209			var sec_field = $(this).find('.gdlr-core-sec');
210			var sec = parseInt(sec_field.text());
211			
212			$(window).load(function(){
213				sec_field.text('00');
214				sec_field.css('width', sec_field.width());
215				sec_field.text(sec);
216			});
217
218			var i = setInterval(function(){
219				if( sec > 0 ){
220					sec--;			
221				}else{
222					sec = 59;
223					if( min > 0 ){
224						min--;
225					}else{
226						min = 59;
227						if( hrs > 0 ){
228							hrs--;
229						}else{
230							hrs = 24;
231							if( day > 0 ){
232								day--;
233							}else{
234								day = 0;
235								hrs = 0;
236								min = 0;
237								sec = 0;
238								clearInterval(i);
239							}
240							day_field.text(day);
241						}
242						hrs_field.text(hrs);
243					}
244					min_field.text(min);
245				}
246				sec_field.text(sec);	
247			}, 1000);
248		});
249	}
250
251	// accordion
252	$.fn.gdlr_core_accordion = function( filter_elem ){
253	
254		if( typeof(filter_elem) == 'undefined' ){
255			var elem_title = $(this).find('.gdlr-core-accordion-item-title');
256			var elem_icon = $(this).find('.gdlr-core-accordion-item-icon');
257		}else{
258			var elem_title = filter_elem.filter('.gdlr-core-accordion-item-title');
259			var elem_icon = filter_elem.filter('.gdlr-core-accordion-item-icon');
260		}	
261		
262		elem_title.click(function(){
263			$(this).siblings('.gdlr-core-accordion-item-content').slideDown(200);
264			
265			var item_tab = $(this).closest('.gdlr-core-accordion-item-tab');
266			if( item_tab.hasClass('gdlr-core-active') ){
267				if( item_tab.closest('.gdlr-core-accordion-item').hasClass('gdlr-core-allow-close-all') ){
268					item_tab.removeClass('gdlr-core-active')
269						.find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200);
270				}
271			}else{
272				item_tab.addClass('gdlr-core-active')
273					.siblings('.gdlr-core-active').removeClass('gdlr-core-active')
274					.find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200);
275			}
276		});
277		elem_icon.click(function(){
278			if( $(this).closest('.gdlr-core-accordion-item-title').length ){ return; }
279
280			$(this).siblings('.gdlr-core-accordion-item-content-wrapper').children('.gdlr-core-accordion-item-content').slideDown(200);
281			
282			var item_tab = $(this).closest('.gdlr-core-accordion-item-tab');
283			if( item_tab.hasClass('gdlr-core-active') ){
284				if( item_tab.closest('.gdlr-core-accordion-item').hasClass('gdlr-core-allow-close-all') ){
285					item_tab.removeClass('gdlr-core-active')
286						.find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200);
287				}
288			}else{
289				item_tab.addClass('gdlr-core-active')
290					.siblings('.gdlr-core-active').removeClass('gdlr-core-active')
291					.find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200);
292			}
293		});
294	}
295
296	// toggle_box
297	$.fn.gdlr_core_toggle_box = function( filter_elem ){
298		
299		if( typeof(filter_elem) == 'undefined' ){
300			var elem_title = $(this).find('.gdlr-core-toggle-box-item-title');
301			var elem_icon = $(this).find('.gdlr-core-toggle-box-item-icon');
302		}else{
303			var elem_title = filter_elem.filter('.gdlr-core-toggle-box-item-title');
304			var elem_icon = filter_elem.filter('.gdlr-core-toggle-box-item-icon');
305		}		
306		
307		elem_title.click(function(){
308			var toggle_parent = $(this).closest('.gdlr-core-toggle-box-item-tab');
309			if( toggle_parent.hasClass('gdlr-core-active') ){
310				
311				toggle_parent.removeClass('gdlr-core-active');
312				$(this).siblings('.gdlr-core-toggle-box-item-content').css({display: 'block'}).slideUp(200);
313				
314			}else{
315
316				toggle_parent.addClass('gdlr-core-active');
317				$(this).siblings('.gdlr-core-toggle-box-item-content').css({display: 'none'}).slideDown(200);
318			}
319		});
320		elem_icon.click(function(){
321			if( $(this).closest('.gdlr-core-toggle-box-item-title').length ){ return; }
322			
323			var toggle_parent = $(this).closest('.gdlr-core-toggle-box-item-tab');
324			if( toggle_parent.hasClass('gdlr-core-active') ){
325				toggle_parent.removeClass('gdlr-core-active');
326				$(this).siblings('.gdlr-core-toggle-box-item-content-wrapper').children('.gdlr-core-toggle-box-item-content').css({display: 'block'}).slideUp(200);
327				
328			}else{
329				toggle_parent.addClass('gdlr-core-active');
330				$(this).siblings('.gdlr-core-toggle-box-item-content-wrapper').children('.gdlr-core-toggle-box-item-content').css({display: 'none'}).slideDown(200);
331			}
332		});
333	}	
334
335	// alert box
336	$.fn.gdlr_core_alert_box_item = function( filter_elem ){
337		
338		if( typeof(filter_elem) == 'undefined' ){
339			var elem = $(this).find('.gdlr-core-alert-box-remove');
340		}else{
341			var elem = filter_elem.filter('.gdlr-core-alert-box-remove');
342		}
343		
344		elem.click(function(){ 
345			$(this).closest('.gdlr-core-alert-box-item').slideUp(400, 'easeOutQuart', function(){
346				$(this).remove();
347			});
348		});
349	}
350
351	// particle background
352	$.fn.gdlr_core_particle_background = function( filter_elem ){
353
354		if( typeof(filter_elem) == 'undefined' ){
355			var elem = $(this).find('.gdlr-core-particle-bg');
356		}else{
357			var elem = filter_elem.filter('.gdlr-core-particle-bg');
358		}	
359
360		elem.each(function(){
361			if( typeof(window.gdlr_particle_bg_id) == 'undefined' ){
362				window.gdlr_particle_bg_id = 1;
363			}else{
364				window.gdlr_particle_bg_id++;
365			}
366
367			var item_id = 'gdlr-core-particle' + window.gdlr_particle_bg_id;
368			$(this).attr('id', item_id);
369
370			particlesJS(item_id, {
371			  "particles": {
372			    "number": {
373			      "value": 40,
374			      "density": {"enable": true,"value_area": 1500}
375			    },
376			    "color": {"value": "#ffffff"},
377			    "shape": {
378			      "type": "circle",
379			      "stroke": {"width": 0,"color": "#000000"},
380			      "polygon": {"nb_sides": 5},
381			      "image": {"src": "img/github.svg","width": 100,"height": 100}
382			    },
383			    "opacity": {
384			      "value": 0.8,
385			      "random": false,
386			      "anim": {"enable": false,"speed": 0.6,"opacity_min": 0.1,"sync": false}
387			    },
388			    "size": {
389			      "value": 2,
390			      "random": true,
391			      "anim": {"enable": false,"speed": 80,"size_min": 0.1,"sync": false}
392			    },
393			    "line_linked": {"enable": true,"distance": 300,"color": "#ffffff","opacity": 0.4,"width": 2},
394			    "move": {
395			      "enable": true,
396			      "speed": 12,
397			      "direction": "none",
398			      "random": false,
399			      "straight": false,
400			      "out_mode": "out",
401			      "bounce": false,
402			      "attract": {"enable": false,"rotateX": 600,"rotateY": 1200}
403			    }
404			  },
405			  "interactivity": {
406			    "detect_on": "canvas",
407			    "events": {
408			      "onhover": {"enable": false,"mode": "repulse"},
409			      "onclick": {"enable": false,"mode": "push"},
410			      "resize": true
411			    },
412			    "modes": {
413			      "grab": {"distance": 800,"line_linked": {"opacity": 1}},
414			      "bubble": {"distance": 800,"size": 80,"duration": 2,"opacity": 0.8,"
414speed": 3},
415			      "repulse": {"distance": 400,"duration": 0.4},
416			      "push": {"particles_nb": 4},
417			      "remove": {"particles_nb": 2}
418			    }
419			  },
420			  "retina_detect": true
421			});
422		});
423
424		return $(this);
425	}
426
427	// parallax background
428	$.fn.gdlr_core_parallax_background = function( filter_elem ){
429
430		if( typeof(filter_elem) == 'undefined' ){
431			var elem = $(this).find('.gdlr-core-parallax');
432		}else{
433			var elem = filter_elem.filter('.gdlr-core-parallax');
434		}	
435		
436		elem.each(function(){ 
437			new gdlr_core_parallax($(this)); 
438		});
439
440		return $(this);
441	}
442	
443	var gdlr_core_parallax = function(t){
444		
445		this.wrapper_bg = t;
446		this.wrapper = t.parent(); // background-wrap
447		
448		this.parallax_speed = parseFloat(t.attr('data-parallax-speed'));
449
450		this.init();
451	}
452	gdlr_core_parallax.prototype = {
453		
454		init: function(){
455			
456			var t = this;
457
458			// scroll event
459			if( t.parallax_speed != 0 ){
460				t.set_extra_height();
461				t.set_background_position(t);
462				$(window).on('load resize gdlr-core-element-resize', function(){ 
463					t.set_extra_height($(this)); 
464					t.set_background_position(t);
465				});
466
467				$(window).on('scroll pb-scroll', function(){ 
468					t.set_background_position(t);
469				});
470			}
471			
472			if( gdlr_core_mobile ){
473				t.wrapper_bg.children('[data-background-type="video"]').remove();
474				
475				if( t.wrapper_bg.attr('data-video-fallback') ){
476					t.wrapper_bg.css('background-image', 'url(' + t.wrapper_bg.attr('data-video-fallback') + ')')
477				}
478			}else{
479				t.wrapper_bg.children('[data-background-type="video"]').each(function(){
480					if( t.parallax_speed == 0 ){
481						t.set_extra_height();
482						t.set_background_position(t);
483						$(window).on('load resize gdlr-core-element-resize', function(){ 
484							t.set_extra_height($(this)); 
485							t.set_background_position(t);
486						});
487					}
488
489					// script for muting the vimeo/youtube player
490					$(this).find('iframe').each(function(){
491						if( $(this).attr('data-player-type') == 'vimeo' ){
492							var player = $f($(this)[0]);
493							
494							player.addEvent('ready', function() {
495								player.api('setVolume', 0);
496							});
497						}else if( $(this).attr('data-player-type') == 'youtube' ){
498
499							// assign the script
500							if( $('body').children('#gdlr-core-youtube-api').length == 0 ){
501								$('body').append('<script src="https://www.youtube.com/iframe_api" id="gdlr-core-youtube-api" ></script>');
502							}
503							
504							// store to global variable
505							if( typeof(window.gdlr_core_ytb) == 'undefined' ){
506								window.gdlr_core_ytb = [$(this)[0]];
507							}else{
508								window.gdlr_core_ytb.push($(this)[0]);
509							}
510							
511							// script loading action
512							window.onYouTubeIframeAPIReady = function(){
513								for( var key in window.gdlr_core_ytb ){
514									new YT.Player(gdlr_core_ytb[key],{
515										events: { 
516											'onReady': function(e){
517												e.target.mute();
518											}
519										}						
520									});
521								}
522							}
523						}
524					});
525				});
526			} // else gdlr_core_mobile
527			
528		}, // init
529		
530		set_extra_height: function(){
531			
532			var t = this;
533			
534			var new_height = t.wrapper.outerHeight();
535			if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ){
536				t.wrapper_bg.css({'transform': ''});
537			}else{
538				if( t.parallax_speed > 0){
539					new_height += (($(window).height() - t.wrapper.outerHeight()) * t.parallax_speed);
540				}else if( t.parallax_speed < 0){
541					new_height += (($(window).height() + t.wrapper.outerHeight()) * Math.abs(t.parallax_speed));
542				}
543			}
544			t.wrapper_bg.css({height: new_height});
545			
546			// set video height
547			var ratio = parseInt(gdlr_core_pbf.video.width) / parseInt(gdlr_core_pbf.video.height);
548			t.wrapper_bg.children('[data-background-type="video"]').each(function(){
549				if( (t.wrapper_bg.width() / t.wrapper_bg.height()) > ratio ){
550					var v_height = t.wrapper_bg.width() / ratio;
551					var v_margin = (t.wrapper_bg.height() - v_height) / 2;
552					$(this).css({width: t.wrapper_bg.width(), height: v_height, 'margin-left': 0, 'margin-top': v_margin});
553				}else{
554					var v_width = t.wrapper_bg.height() * ratio;
555					var v_margin = (t.wrapper_bg.width() - v_width) / 2;
556					$(this).css({width: v_width, height: t.wrapper_bg.height(), 'margin-left': v_margin, 'margin-top': 0});
557				}
558			});
559			
560		}, // set_extra_height
561		
562		set_background_position: function( t ){
563
564			if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ) return;
565			
566			var wrapper_top = t.wrapper.offset().top;
567			var scroll_pos = $(window).scrollTop();
568
569			if( scroll_pos + $(window).height() > wrapper_top && 
570				scroll_pos < wrapper_top + t.wrapper.outerHeight() ){
571				
572				if( t.parallax_speed > 0 ){
573					t.wrapper_bg.css({'transform': 'translate(0px, ' + (($(window).scrollTop() - wrapper_top) * t.parallax_speed) + 'px)'});
574				}else if( t.parallax_speed < 0 ){
575					t.wrapper_bg.css({'transform': 'translate(0px, ' + (($(window).scrollTop() + $(window).height() - wrapper_top) * t.parallax_speed) + 'px)'});
576				}
577			}
578		}
579	}; // gdlr_core_parallax
580	
581	// ux animation
582	var gdlr_core_ux = function( container, filter_elem ){
583		
584		if( typeof(filter_elem) == 'undefined' ){
585			this.elem = container.find('[data-gdlr-animation]');
586		}else{
587			this.elem = filter_elem.filter('[data-gdlr-animation]');
588			this.preload = filter_elem.filter('.gdlr-core-page-preload');
589		}
590		
591		this.ux_items = [];
592		this.ux_item_length = 0;
593		
594		this.init();
595		
596	} // gdlr_core_ux
597	gdlr_core_ux.prototype = {
598		
599		init: function(){
600			
601			var t = this;
602			
603			t.ux_item_length = t.elem.each(function(){
604				var ux_item = $(this);
605				var ux_item_offset = 0.8;
606				if( $(this).attr('data-gdlr-animation-offset') ){
607					ux_item_offset = parseFloat($(this).attr('data-gdlr-animation-offset'));
608				}
609				
610				// check item at the first time the page is loaded
611				if( (gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') || $(window).scrollTop() + $(window).height() > ux_item.offset().top ){
612					t.ux_items.push(ux_item);
613					
614				// check the item on scroll event
615				}else{
616					$(window).on('scroll pb-scroll', function(e){
617						if( $(window).scrollTop() + ($(window).height() * ux_item_offset) > ux_item.offset().top ){
618							t.ux_items.push(ux_item);
619							$(window).unbind('scroll', e.handleObj.handler, e);
620						} 
621					});
622				}
623			}).length;
624			
625			if( typeof(t.preload) != 'undefined' && t.preload.length ){
626				$(window).load(function(){
627					var preload_time = t.preload.attr('data-animation-time');
628					if( !preload_time ){ preload_time = 0; }
629					
630					setTimeout(function(){
631						t.animate();
632					}, preload_time);
633				});
634			}else{
635				t.animate();
636			}
637			
638		},
639		
640		animate: function(){
641			
642			var t = this;
643			
644			// run the ux in order with delay
645			var ux_interval = setInterval(function(){ 
646				
647				while( t.ux_items.length > 0 ){
648
649					// animate the ux item
650					var ux_animate = t.ux_items.shift();
651					var animation_duration = '600ms';
652					if( ux_animate.attr('data-gdlr-animation-duration') ){
653						animation_duration = ux_animate.attr('data-gdlr-animation-duration');
654					}
655
656					ux_animate.css({ 'animation-duration':  animation_duration });
657					ux_animate.addClass(ux_animate.attr('data-gdlr-animation'));
658					
659					// remove selector
660					setTimeout(function(){
661						ux_animate.css({ 'animation-duration':  '' })
662							.removeClass(ux_animate.attr('data-gdlr-animation'))
663							.removeAttr('data-gdlr-animation');
664					}, parseInt(animation_duration));	
665						
666					t.ux_item_length--;
667
668					// if item is inside the screen break while loop
669					if(	$(window).scrollTop() < ux_animate.offset().top + ux_animate.outerHeight() ){
670						break;
671					}
672				}
673				
674				if( t.ux_item_length <= 0 ){
675					clearInterval(ux_interval);
676				}
677			}, 200);
678			
679		}
680		
681	}; // gdlr_core_ux.prototype
682	$.fn.gdlr_core_ux = function( filter_elem ){
683		new gdlr_core_ux( $(this), filter_elem );
684		
685		return $(this);
686	}
687	
688	// skill bar
689	$.fn.gdlr_core_skill_bar = function( filter_elem ){
690
691		if( typeof(filter_elem) == 'undefined' ){
692			var elem = $(this).find('.gdlr-core-skill-bar-filled');
693		}else{
694			var elem = filter_elem.filter('.gdlr-core-skill-bar-filled');
695		}	
696		
697		elem.each(function(){
698			var t = $(this);
699			
700			if( (gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') || $(window).scrollTop() + $(window).height() > t.offset().top ){
701				t.animate({width: parseInt(t.attr('data-width')) + '%'}, {duration: 1200, easing: 'easeOutQuart'}).addClass('gdlr-core-animate');	
702			}else{
703				$(window).on('scroll pb-scroll', function(e){
704					if( $(window).scrollTop() + $(window).height() > t.offset().top ){
705						t.animate({width: parseInt(t.attr('data-width')) + '%'}, {duration: 1200, easing: 'easeOutQuart'}).addClass('gdlr-core-animate');
706						$(window).unbind('scroll pb-scroll', e.handleObj.handler, e);
707					} 
708				});
709			}
710		});
711	}
712	
713	// divider width
714	$.fn.gdlr_core_divider = function( filter_elem ){
715
716		if( typeof(filter_elem) == 'undefined' ){
717			var elem = $(this).find('.gdlr-core-divider-item-with-icon-inner');
718		}else{
719			var elem = filter_elem.filter('.gdlr-core-divider-item-with-icon-inner');
720		}
721	
722		elem.each(function(){
723			var divider_elem = $(this);
724			var icon_width = divider_elem.children('i, img').outerWidth();
725			var divider_width = (divider_elem.width() - icon_width) / 2;
726			$(this).children('.gdlr-core-divider-line').css({ width: divider_width }).each(function(){
727				$(this).css('margin-top', -$(this).outerHeight()/2);
728			});
729
730			$(window).on('resize gdlr-core-element-resize', function(){
731				icon_width = divider_elem.children('i, img').outerWidth();
732				divider_width = (divider_elem.width() - icon_width) / 2;
733				divider_elem.children('.gdlr-core-divider-line').css({ width: divider_width }).each(function(){
734					$(this).css('margin-top', -$(this).outerHeight()/2);
735				});
736			});
737		});
738		
739	}	
740
741	window.gdlr_core_sidebar_wrapper = function( container, filter_elem ){
742
743		if( typeof(filter_elem) == 'undefined' ){
744			this.elem = container.find('.gdlr-core-page-builder-wrapper-sidebar-container, .gdlr-core-pbf-sidebar-container');
745		}else{
746			this.elem = filter_elem.filter('.gdlr-core-page-builder-wrapper-sidebar-container, .gdlr-core-pbf-sidebar-container');
747		}
748
749		this.init();
750
751	}
752	gdlr_core_sidebar_wrapper.prototype = {
753
754		init: function(){
755
756			var t = this;
757
758			// if no background, don't sync height
759			var sync_height = false;
760			t.elem.each(function(){
761				if( $(this).children().children('.gdlr-core-pbf-background-wrap').length ){
762					sync_height = true;
763				}
764			});
765
766			// sync the height
767			if( sync_height ){
768				t.set_height();
769				$(window).on('load resize gdlr-core-element-resize', function(){ t.set_height(); });
770			}
771		},
772
773		set_height: function(){
774
775			var t = this;
776
777			t.elem.each(function(){
778
779				var sidebar_elem = $(this).find('.gdlr-core-pbf-sidebar-padding');
780				sidebar_elem.css('min-height', '');
781
782				if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ) return;
783				
784				// determine max height
785				var max_height = 0;
786				sidebar_elem.each(function(){
787					if( $(this).outerHeight() > max_height ){
788						max_height = $(this).outerHeight();
789					}
790				});
791
792				// set the height
793				sidebar_elem.css('min-height', max_height);
794
795			});
796			
797		}
798
799	};
800
801	// title divider width
802	$.fn.gdlr_core_title_divider = function( filter_elem ){
803
804		if( typeof(filter_elem) == 'undefined' ){
805			var elem = $(this).find('.gdlr-core-title-item-title-wrap.gdlr-core-with-divider');
806		}else{
807			var elem = filter_elem.filter('.gdlr-core-title-item-title-wrap.gdlr-core-with-divider');
808		}
809	
810		elem.each(function(){
811
812			var t = $(this);
813			var divider = t.children('.gdlr-core-title-item-divider');
814			var divider_num = t.children('.gdlr-core-title-item-divider').length;
815			divider_num = (divider_num)? divider_num: 1;
816			
817			var title_width = t.children('.gdlr-core-title-item-title').outerWidth(true);
818			var divider_width = (t.width() - title_width) / divider_num;
819			if( t.children('.gdlr-core-title-item-link').length ){
820				var right_pos = t.children('.gdlr-core-title-item-link').outerWidth() + 20;
821				divider_width = divider_width - right_pos;
822			}
823	
824			// for right divider with link text
825			if( t.children('.gdlr-core-title-item-link').length ){
826				divider.css({ width: divider_width, right: right_pos });
827			}else{
828				divider.css({ width: divider_width });
829			}
830
831			$(window).on('resize gdlr-core-element-resize', function(){
832				title_width = t.children('.gdlr-core-title-item-title').outerWidth(true);
833				divider_width = (t.width() - title_width) / divider_num;
834				if( t.children('.gdlr-core-title-item-link').length ){
835					right_pos = t.children('.gdlr-core-title-item-link').outerWidth() + 20;
836					divider_width = divider_width - right_pos;
837				}
838
839				// for right divider with link text
840				if( t.children('.gdlr-core-title-item-link').length ){
841					divider.css({ width: divider_width, right: right_pos });
842				}else{
843					divider.css({ width: divider_width });
844				}
845			});
846		});
847
848		if( typeof(filter_elem) == 'undefined' ){
849			var elem2 = $(this).find('.gdlr-core-title-item-title-wrap.gdlr-core-with-link-text');
850		}else{
851			var elem2 = filter_elem.filter('.gdlr-core-title-item-title-wrap.gdlr-core-with-link-text');
852		}
853		elem2.each(function(){
854			var t = $(this);
855			var title_width = t.children('.gdlr-core-title-item-title').outerWidth(true);
856			var right_pos = t.children('.gdlr-core-title-item-link').outerWidth();
857
858			if( t.width() < title_width + right_pos ){
859				t.children('.gdlr-core-title-item-link').addClass('gdlr-core-overflow');
860			}else{
861				t.children('.gdlr-core-title-item-link').removeClass('gdlr-core-overflow');
862			}
863
864			$(window).on('resize gdlr-core-element-resize', function(){
865				if( t.width() < title_width + right_pos ){
866					t.children('.gdlr-core-title-item-link').addClass('gdlr-core-overflow');
867				}else{
868					t.children('.gdlr-core-title-item-link').removeClass('gdlr-core-overflow');
869				}
870			});
871
872		});
873		
874	}
875
876	$.fn.gdlr_core_flipbox = function( filter_elem ){
877		if(typeof($.fn.flip) == 'function'){
878			
879			if( typeof(filter_elem) == 'undefined' ){
880				var elem = $(this).find('.gdlr-core-flipbox');
881			}else{
882				var elem = filter_elem.filter('.gdlr-core-flipbox');
883			}			
884			
885			elem.each(function(){
886				var flipbox_obj = $(this).flip({
887					axis: 'y',
888					trigger: 'hover',
889					autoSize: false,
890					front: '.gdlr-core-flipbox-front',
891					back: '.gdlr-core-flipbox-back'
892				});
893
894				$(this).find('.gdlr-core-flipbox-back a').click(function(){
895					if( flipbox_obj.data('flip-model') ){
896						flipbox_obj.data('flip-model').unflip();
897					}
898				});
899				
900				$(this).addClass('gdlr-core-after-init');
901			});
902		}
903
904		return $(this);
905	}
906	
907	// marquee
908	$.fn.gdlr_core_marquee = function( filter_elem ){
909		if( typeof(filter_elem) == 'undefined' ){
910			var elem = $(this).find('.gdlr-core-marquee');
911		}else{
912			var elem = filter_elem.filter('.gdlr-core-marquee');
913		}
914
915		elem.each(function(){
916			var speed = $(this).attr('data-speed')? parseFloat($(this).attr('data-speed')): 10000;
917			var direction = $(this).attr('data-direction')? parseFloat($(this).attr('data-direction')): 'left';
918
919			$(this).marquee({
920				//time in milliseconds before the marquee will start animating
921			    delayBeforeStart: 0,
922			    //speed in milliseconds of the marquee
923			    duration: speed,
924			    //gap in pixels between the tickers
925			    gap: 50,
926			    //'left' or 'right'
927			    direction: direction,
928			    //true or false - should the marquee be duplicated to show an effect of continues flow
929			    duplicated: true,
930			    // the marquee is visible initially positioned next to the border towards it will be moving
931			    startVisible: true
932			});
933		});
934
935		return $(this);
936	}
937
938	// pie chart
939	function gdlr_core_skill_circle_height(t){
940		t.children('.gdlr-core-skill-circle-content').each(function(){
941			$(this).css({'margin-top': -$(this).outerHeight()/2});
942		});
943		t.css({'max-width': t.parent().width(), 'max-height': t.parent().width()});	
944	}
945	$.fn.gdlr_core_pie_chart = function(){
946		if(typeof($.fn.easyPieChart) == 'function'){
947			$(this).easyPieChart({
948				animate: parseInt($(this).attr('data-duration')),
949				lineWidth: parseInt($(this).attr('data-line-width')),
950				size: parseInt($(this).attr('data-width')),
951				barColor: $(this).attr('data-filled-color'),
952				trackColor: $(this).attr('data-filled-background'),
953				scaleColor: false,
954				lineCap: 'square'
955			});
956		}
957	}
958	$.fn.gdlr_core_skill_circle = function( filter_elem ){
959		
960		if( typeof(filter_elem) == 'undefined' ){
961			var elem = $(this).find('.gdlr-core-skill-circle');
962		}else{
963			var elem = filter_elem.filter('.gdlr-core-skill-circle');
964		}		
965		
966		elem.each(function(){
967			var t = $(this);
968
969			// for responsive
970			gdlr_core_skill_circle_height(t);
971			$(window).on('resize gdlr-core-element-resize', function(){ gdlr_core_skill_circle_height(t); });
972			
973			// scroll action
974			if( $(window).scrollTop() + $(window).height() > t.offset().top ){
975				t.gdlr_core_pie_chart();
976			}else{
977				$(window).on('scroll pb-scroll', function(e){
978					if( $(window).scrollTop() + $(window).height() > t.offset().top ){
979						t.gdlr_core_pie_chart();
980						$(window).unbind('scroll pb-scroll', e.handleObj.handler, e);
981					} 
982				});
983			}
984		});
985	}
986	
987	// chart.js
988	$.fn.gdlr_core_chart_js = function( filter_elem ){
989		
990		if( typeof(filter_elem) == 'undefined' ){
991			var elem = $(this).find('.gdlr-core-chart-js');
992		}else{
993			var elem = filter_elem.filter('.gdlr-core-chart-js');
994		}		
995
996		if( typeof(window.gdlr_core_chart_js_id) == 'undefined' ){
997			window.gdlr_core_chart_js_id = 0;
998		}
999
1000		elem.each(function(){
1001
1002			var data = [];
1003			var options = [];
1004			if( $(this).attr('data-content') ){
1005				data = JSON.parse($(this).attr('data-content'));
1006			}
1007			if( $(this).attr('data-options') ){
1008				options = JSON.parse($(this).attr('data-options'));
1009			}
1010
1011			if( $(this).attr('data-type') == 'doughnut' || $(this).attr('data-type') == 'pie' ){
1012				if( options.legend.position == 'right' || options.legend.position == 'left' ){
1013					if( gdlr_core_display == 'mobile-portrait' || gdlr_core_display == 'mobile-landscape' ){
1014						options.legend.orig_position = options.legend.position;
1015						options.legend.position = 'bottom';
1016						$(this).attr('width', $(this).width());
1017						$(this).attr('height', $(this).width() * 1);
1018					}
1019				}
1020			}
1021			options.onResize = function(chart, size){
1022				if( chart.config.type == 'doughnut' || chart.config.type == 'pie' ){
1023					if( chart.config.options.legend.position == 'right' || chart.config.options.legend.position == 'left' ){
1024						if( gdlr_core_display == 'mobile-portrait' || gdlr_core_display == 'mobile-landscape' ){
1025							chart.config.options.legend.orig_position = chart.config.options.legend.position;
1026							chart.config.options.legend.position = 'bottom';
1027							chart.aspectRatio = 1;
1028						}
1029					}else if( typeof(chart.config.options.legend.orig_position) != 'undefined' ){
1030						if( gdlr_core_display == 'tablet' || gdlr_core_display == 'desktop' ){
1031							chart.config.options.legend.position = chart.config.options.legend.orig_position;
1032							chart.aspectRatio = 2;
1033						}
1034					}
1035					
1036				}
1037				
1038			}
1039
1040			new Chart($(this), {
1041			    type: $(this).attr('data-type')? $(this).attr('data-type'): 'pie',
1042			    data: data,
1043			   	options: options
1044			});	
1045
1046		});
1047
1048	} // gdlr_core_chart_js
1049		
1050	// tab
1051	$.fn.gdlr_core_tab = function( filter_elem ){
1052		
1053		if( typeof(filter_elem) == 'undefined' ){
1054			var elem = $(this).find('.gdlr-core-tab-item, .gdlr-core-tab-action, .gdlr-core-roadmap-item, .gdlr-core-tab-feature-item, .gdlr-core-tab-feature2-item, .gdlr-core-tab-featurev-item');
1055		}else{
1056			var elem = filter_elem.filter('.gdlr-core-tab-item, .gdlr-core-tab-action, .gdlr-core-roadmap-item, .gdlr-core-tab-feature-item, .gdlr-core-tab-feature2-item, .gdlr-core-tab-featurev-item');
1057		}		
1058		
1059		elem.each(function(){
1060			
1061			// click action
1062			$(this).find('.gdlr-core-tab-item-title, .gdlr-core-tab-action-title, .gdlr-core-roadmap-item-head, .gdlr-core-tab-feature-title-wrap, .gdlr-core-tab-feature2-title-wrap, .gdlr-core-tab-featurev-title').click(function(){
1063				if( $(this).hasClass('gdlr-core-active') ) return;
1064				
1065				var tab_id = $(this).attr('data-tab-id');
1066				
1067				$(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
1068
1069				// for tab feature vertical
1070				if( $(this).is('.gdlr-core-tab-featurev-title') ){
1071					var parent = $(this).parent().parent();
1072
1073					parent.closest('.gdlr-core-tab-featurev-item').find('.gdlr-core-tab-featurev-background-switch').each(function(){
1074						$(this).children().removeClass('gdlr-core-active');
1075						$(this).children('[data-tab-id="' + tab_id + '"]').addClass('gdlr-core-active');
1076					});
1077				}else{
1078					var parent = $(this).parent();
1079				}
1080				parent.siblings('.gdlr-core-tab-item-content-wrap, .gdlr-core-tab-action-content-wrap, .gdlr-core-roadmap-item-content-wrap, .gdlr-core-tab-feature-item-content-wrap, .gdlr-core-tab-feature2-item-content-wrap, .gdlr-core-tab-featurev-item-content-wrap').each(function(){
1081					var active_tab = $(this).children('[data-tab-id="' + tab_id + '"]');
1082
1083					if( active_tab.length ){
1084						active_tab.fadeIn(200).siblings().hide();
1085					}else{
1086						$(this).children().hide();
1087					}
1088				});
1089				
1090			});
1091			
1092			// hover action
1093			if( !(gdlr_core_mobile || gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') && 
1094				$(this).is('.gdlr-core-tab-feature2-item') ){
1095
1096				var slide_bar_width = 35;
1097				var slide_bar = $(this).find('.gdlr-core-tab-feature2-bottom-slide-bar');
1098				var active_tab = slide_bar.siblings('.gdlr-core-active');
1099				
1100				if( active_tab.length ){
1101					slide_bar.css({ width: slide_bar_width, left: active_tab.position().left + (active_tab.width() - 35)/2 });
1102				}
1103				$(window).resize(function(){
1104					active_tab = slide_bar.siblings('.gdlr-core-active');
1105					slide_bar.css({ width: slide_bar_width, left: active_tab.position().left + (active_tab.width() - 35)/2 });
1106				});
1107				$(this).find('.gdlr-core-tab-feature2-title-wrap').click(function(){
1108					active_tab = $(this);
1109				});
1110				$(this).find('.gdlr-core-tab-feature2-title-wrap').hover(function(){
1111					slide_bar.animate({ width: slide_bar_width, left: $(this).position().left + ($(this).width() - 35)/2 }, {duration: 200, queue: false});
1112				}, function(){
1113					slide_bar.animate({ width: slide_bar_width, left: active_tab.position().left + (active_tab.width() - 35)/2 }, {duration: 200, queue: false});
1114				});
1115				
1116			}
1117
1118			if( !(gdlr_core_mobile || gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') && 
1119				$(this).is('.gdlr-core-tab-style2-horizontal, .gdlr-core-tab-style2-vertical') ){
1120
1121				var horizontal = $(this).is('.gdlr-core-tab-style2-horizontal');
1122				var hover_line = $(this).find('.gdlr-core-tab-item-title-line');
1123				var hover_line_w = 0;
1124				var hover_line_l = 0;
1125				
1126				// initiate
1127				$(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-active').each(function(){
1128					if( horizontal ){
1129						hover_line_w = $(this).outerWidth();
1130						hover_line_l = $(this).position().left;
1131						hover_line.css({ width: hover_line_w, left: hover_line_l });
1132					}else{
1133						hover_line_w = $(this).outerHeight();
1134						hover_line_l = $(this).position().top;
1135						hover_line.css({ height: hover_line_w, top: hover_line_l });
1136					}
1137				});
1138				$(window).on('resize gdlr-core-element-resize', function(){
1139					$(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-active').each(function(){
1140						if( horizontal ){
1141							hover_line_w = $(this).outerWidth();
1142							hover_line_l = $(this).position().left;
1143							hover_line.css({ width: hover_line_w, left: hover_line_l });
1144						}else{
1145							hover_line_w = $(this).outerHeight();
1146							hover_line_l = $(this).position().top;
1147							hover_line.css({ height: hover_line_w, top: hover_line_l });
1148						}
1149					});
1150				});
1151				
1152				// animate
1153				$(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-tab-item-title').hover(function(){
1154					if( horizontal ){
1155						hover_line.animate({ width: $(this).outerWidth(), left: $(this).position().left }, { duration: 300, easing: 'easeOutQuart', queue: false });
1156					}else{
1157						hover_line.animate({ height: $(this).outerHeight(), top: $(this).position().top }, { duration: 300, easing: 'easeOutQuart', queue: false });
1158					}
1159				}, function(){
1160					if( horizontal ){
1161						hover_line.animate({ width: hover_line_w, left: hover_line_l }, { duration: 300, easing: 'easeOutQuart', queue: false });
1162					}else{
1163						hover_line.animate({ height: hover_line_w, top: hover_line_l }, { duration: 300, easing: 'easeOutQuart', queue: false });
1164					}
1165				});
1166				
1167				// click
1168				$(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-tab-item-title').click(function(){
1169					if( horizontal ){
1170						hover_line_w = $(this).outerWidth();
1171						hover_line_l = $(this).position().left;
1172						hover_line.css({ width: hover_line_w, left: hover_line_l });
1173					}else{
1174						hover_line_w = $(this).outerHeight();
1175						hover_line_l = $(this).position().top;
1176						hover_line.css({ height: hover_line_w, top: hover_line_l });
1177					}
1178				});
1179			}
1180		});
1181
1182		return $(this);
1183		
1184	} // gdlr_core_tab
1185
1186	$.fn.gdlr_core_price_table_tab = function( filter_elem ){
1187		if( typeof(filter_elem) == 'undefined' ){
1188			var elem = $(this).find('.gdlr-core-price-table-tab-title-wrap');
1189		}else{
1190			var elem = filter_elem.filter('.gdlr-core-price-table-tab-title-wrap');
1191		}
1192
1193		elem.each(function(){
1194
1195			var tab_title = $(this);
1196			tab_title.find('.gdlr-core-price-table-tab-title').on('click', function(){
1197				if( $(this).hasClass('gdlr-core-active') ) return;
1198
1199				var price_tab = $(this).attr('data-price-tab');
1200				$(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
1201				tab_title.siblings('.gdlr-core-price-table-tab-content-wrap').find('[data-price-tab="' + price_tab + '"]').each(function(){
1202					$(this).siblings('.gdlr-core-active').css({display: 'none'}).removeClass('gdlr-core-active');
1203					$(this).fadeIn(200).addClass('gdlr-core-active');
1204				});
1205			});
1206
1207		});
1208	}
1209	
1210	$.fn.gdlr_core_sly = function( filter_elem ){
1211
1212		if( typeof(filter_elem) == 'undefined' ){
1213			var elem = $(this).find('.gdlr-core-sly-slider');
1214		}else{
1215			var elem = filter_elem.filter('.gdlr-core-sly-slider');
1216		}	
1217	
1218		elem.addClass('gdlr-core-after-init').each(function(){
1219			var sly_slider = $(this);
1220
1221			sly_slider.sly({
1222				horizontal: 1,
1223				itemNav: 'basic',
1224				smart: 1,
1225				activateOn: 'click',
1226				mouseDragging: 1,
1227				touchDragging: 1,
1228				releaseSwing: 1,
1229				startAt: 0,
1230				scrollBy: 1,
1231				speed: 1000,
1232				elasticBounds: 1,
1233				easing: 'easeOutQuart',
1234				dragHandle: 1,
1235				dynamicHandle: 1,
1236				clickBar: 1,
1237				scrollBar: $(this).siblings('.gdlr-core-sly-scroll')
1238			});
1239			$(window).on('resize gdlr-core-element-resize', function(){ sly_slider.sly('reload'); });
1240		});
1241
1242		return $(this);
1243
1244	} // gdlr-core_sly
1245
1246	$.fn.gdlr_core_flexslider = function( filter_elem ){
1247
1248		if( typeof(filter_elem) == 'undefined' ){
1249			var elem = $(this).find('.gdlr-core-flexslider');
1250		}else{
1251			var elem = filter_elem.filter('.gdlr-core-flexslider');
1252		}	
1253	
1254		elem.each(function(){
1255
1256			var flex_attr = {
1257				useCSS: false,
1258				animation: 'fade',
1259				animationLoop: true,
1260				prevText: '<i class="arrow_carrot-left"></i>',
1261				nextText: '<i class="arrow_carrot-right"></i>'
1262			};
1263
1264			if( $(this).attr('data-start-at') && $(this).attr('data-start-at') > 1 ){
1265				flex_attr.startAt = $(this).attr('data-start-at') - 1;
1266			}
1267
1268			if( $(this).find('.gdlr-core-flexslider').length > 0 ){ 
1269				$(this).children('ul.slides').addClass('parent-slides');
1270				flex_attr.selector = '.parent-slides > li';
1271			}
1272
1273			// variable settings
1274			if( $(this).attr('data-disable-autoslide') ){
1275				flex_attr.slideshow = false;
1276			}
1277			if( $(this).attr('data-pausetime') ){
1278				flex_attr.slideshowSpeed = parseInt($(this).attr('data-pausetime'));
1279			}
1280			if( $(this).attr('data-slidespeed') ){
1281				flex_attr.animationSpeed = parseInt($(this).attr('data-slidespeed'));
1282			}else{
1283				flex_attr.animationSpeed = 500;
1284			}
1285
1286			// for carousel
1287			if( $(this).attr('data-type') == 'carousel' ){
1288				flex_attr.move = $(this).attr('data-move')? parseInt($(this).attr('data-move')): 1;
1289				flex_attr.animation = 'slide';
1290
1291				// determine the spaces
1292				var column_num = parseInt($(this).attr('data-column'));
1293				flex_attr.itemMargin = 2 * parseInt($(this).children('ul.slides').children('li:first-child').css('margin-right'));
1294				flex_attr.itemWidth = (($(this).width() + flex_attr.itemMargin) / column_num) - (flex_attr.itemMargin);
1295
1296				flex_attr.minItems = column_num;
1297				flex_attr.maxItems = column_num;
1298				
1299				var t = $(this);
1300				$(window).on('resize gdlr-core-element-resize', function(){
1301					if( t.data('goodlayers_flexslider') ){
1302						var newWidth = ((t.width() + flex_attr.itemMargin) / column_num) - (flex_attr.itemMargin);
1303						t.data('goodlayers_flexslider').editItemWidth(newWidth);
1304					}
1305				});
1306
1307			}else if( $(this).attr('data-effect') ){
1308				if( $(this).attr('data-effect') == 'kenburn' ){
1309					flex_attr.animation = 'fade';
1310				}else{
1311					flex_attr.animation = $(this).attr('data-effect');
1312				}
1313			}
1314
1315			// for navigation
1316			var data_nav = ['both', 'navigation', 'navigation-outer-plain-round', 'navigation-top', 'navigation-bottom', 'navigation-inner', 'navigation-outer'];
1317			if( !$(this).attr('data-nav') || data_nav.indexOf($(this).attr('data-nav')) != -1 ){
1318				if( !$(this).hasClass('gdlr-core-bottom-nav-1') ){ /* old style fallback */
1319					if( $(this).attr('data-nav-parent') ){
1320						if( $(this).attr('data-nav-parent') == 'self' ){
1321							flex_attr.customDirectionNav = $(this).find('.flex-prev, .flex-next');
1322						}if( $(this).attr('data-nav-type') == 'custom' ){
1323							flex_attr.customDirectionNav = $(this).closest('.' + $(this).attr('data-nav-parent')).find('.flex-prev, .flex-next');
1324						}else{
1325							$(this).closest('.' + $(this).attr('data-nav-parent')).each(function(){
1326								var flex_nav = $('<ul class="flex-direction-nav">' + 
1327												'<li class="flex-nav-prev">
1327<a class="flex-prev" href="#"><i class="arrow_carrot-left"></i></a></li>' +
1328												'<li class="flex-nav-next"><a class="flex-next" href="#"><i class="arrow_carrot-right"></i></a></li>' +
1329											'</ul>');
1330
1331								var flex_nav_position = $(this).find('.gdlr-core-flexslider-nav');
1332								if( flex_nav_position.length ){
1333									flex_nav_position.append(flex_nav);
1334									flex_attr.customDirectionNav = flex_nav.find('.flex-prev, .flex-next');
1335								}
1336							});
1337						}
1338					}
1339				}
1340			}else{
1341				flex_attr.directionNav = false;
1342			}
1343			if( $(this).attr('data-nav') == 'both' || $(this).attr('data-nav') == 'bullet' ){
1344				flex_attr.controlNav = true;
1345			}else{
1346				flex_attr.controlNav = false;
1347			}
1348
1349			// for thumbnail 
1350			if( $(this).attr('data-thumbnail') ){
1351				var thumbnail_slide = $(this).siblings('.gdlr-core-sly-slider');
1352
1353				flex_attr.manualControls = thumbnail_slide.find('ul.slides li')
1354				flex_attr.controlNav = true;
1355			}
1356
1357			// center the navigation
1358			// add active class for kenburn effects
1359			if( $(this).attr('data-vcenter-nav') ){
1360				flex_attr.start = function(slider){
1361					$(slider).children('.gdlr-core-flexslider-custom-nav.gdlr-core-style-navigation-outer').each(function(){
1362						$(this).insertAfter($(slider).children('.flex-viewport'));
1363					});
1364					if( slider.directionNav ){
1365						$(window).on('resize gdlr-core-element-resize', function(){
1366							slider.directionNav.each(function(){
1367								var margin = -(slider.height() + $(this).outerHeight()) / 2;
1368								$(this).css('margin-top', margin);
1369							});
1370						});
1371					}
1372					if( typeof(slider.slides) != 'undefined' ){
1373						$(window).trigger('gdlr-core-element-resize');
1374						slider.slides.filter('.flex-active-slide').addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
1375					}
1376				};
1377			}else{
1378				flex_attr.start = function(slider){
1379					if( typeof(slider.slides) != 'undefined' ){
1380
1381						if( $(slider).attr('data-controls-top-margin') ){
1382							$(slider).find('.flex-control-nav').css({ 'margin-top': $(slider).attr('data-controls-top-margin') });
1383						}
1384						
1385						$(slider).children('.gdlr-core-flexslider-custom-nav.gdlr-core-style-navigation-bottom').each(function(){
1386							$(this).insertAfter($(slider).children('.flex-viewport'));
1387						});
1388
1389						$(window).trigger('gdlr-core-element-resize');
1390						slider.slides.filter('.flex-active-slide').addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
1391					}
1392				}
1393			}
1394
1395			// add the action for class
1396			flex_attr.after = function(slider){
1397				slider.slides.filter('.flex-active-slide').addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
1398			}
1399
1400			// add outer frame class
1401			if( $(this).find('.gdlr-core-outer-frame-element').length > 0 ){
1402				$(this).addClass('gdlr-core-with-outer-frame-element');
1403			}
1404
1405			$(this).goodlayers_flexslider(flex_attr);
1406		});
1407
1408		return $(this);
1409
1410	} // gdlr-core-flexslier
1411
1412	window.gdlr_core_sticky_sidebar = function( filter_elem ){
1413
1414		if( typeof(filter_elem) == 'undefined' ){
1415			this.elem = $(this).find('.gdlr-core-sticky-sidebar');
1416		}else{
1417			this.elem = filter_elem.filter('.gdlr-core-sticky-sidebar');
1418		}
1419
1420		this.init();
1421
1422	}
1423	gdlr_core_sticky_sidebar.prototype = {
1424
1425		init: function(){
1426
1427			var t = this;
1428			t.elem.each(function(){
1429				$(this).find('.gdlr-core-pbf-sidebar-left, .gdlr-core-pbf-sidebar-right, .gdlr-core-sidebar-script').each(function(){
1430
1431					var sidebar_item = $(this);
1432					var sidebar_wrap = sidebar_item.parent();
1433					var sidebar_sub = $('<div></div>');
1434
1435					var prev_scroll = 0;
1436					$(window).on('scroll resize', function(e){
1437						
1438						// sidebar larger than content
1439						if( sidebar_item.outerHeight() >= sidebar_wrap.outerHeight() ){
1440							t.return_sidebar_pos(sidebar_sub, sidebar_item);
1441							return;
1442						} 
1443
1444						// not in desktop
1445						if( gdlr_core_display != 'desktop' ){
1446							t.return_sidebar_pos(sidebar_sub, sidebar_item);
1447							return;
1448						}
1449
1450						var scroll_pos = $(window).scrollTop();
1451						var scroll_direction = (prev_scroll > scroll_pos)? 'up': 'down';
1452						prev_scroll = scroll_pos;
1453
1454						// sidebar smaller than screen
1455						if( $(window).height() > sidebar_item.height() ){
1456
1457							if( scroll_pos <= sidebar_wrap.offset().top ){
1458
1459								if( sidebar_item.hasClass('gdlr-core-fixed-sidebar') || sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){
1460									t.return_sidebar_pos(sidebar_sub, sidebar_item);
1461								}
1462
1463							}else{
1464								
1465								// overflow the content - stick to the bottom
1466								if( scroll_pos + sidebar_item.outerHeight() >= sidebar_wrap.offset().top + sidebar_wrap.outerHeight() ){
1467									
1468									if( !sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){
1469										t.set_sidebar_sub(sidebar_sub, sidebar_item);
1470
1471										sidebar_item.addClass('gdlr-core-fixed-bottom-sidebar').removeClass('gdlr-core-fixed-sidebar');
1472										sidebar_item.css({
1473											'position': 'absolute',
1474											'top': 'auto',
1475											'bottom': 0,
1476											'left': sidebar_sub.position().left,
1477											'width': sidebar_sub.outerWidth()
1478										});
1479									}
1480									
1481								// inside the content - fixed at the top
1482								}else{
1483
1484									if( !sidebar_item.hasClass('gdlr-core-fixed-sidebar') ){
1485										
1486										t.set_sidebar_sub(sidebar_sub, sidebar_item);
1487
1488										sidebar_item.addClass('gdlr-core-fixed-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar');
1489										sidebar_item.css({
1490											'position': 'fixed',
1491											'top': 0,
1492											'bottom': 'auto',
1493											'width': sidebar_sub.outerWidth()
1494										});
1495										sidebar_item.css({
1496											'left': sidebar_sub.offset().left,
1497										});
1498
1499									}
1500
1501								}
1502
1503								if( e.type == 'resize' ){
1504
1505									if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){
1506										sidebar_item.css({ 
1507											'width': sidebar_sub.outerWidth(),
1508											'left': sidebar_sub.position().left,
1509										});
1510									}else if( sidebar_item.hasClass('gdlr-core-fixed-sidebar') ){
1511										sidebar_item.css({ 
1512											'width': sidebar_sub.outerWidth(),
1513											'left': sidebar_sub.offset().left,
1514										});
1515									}
1516
1517								}
1518															
1519							}
1520
1521						// sidebar larger than screen
1522						}else{
1523
1524							// to the top
1525							if( scroll_pos <= sidebar_wrap.offset().top ){
1526
1527								if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') || sidebar_item.hasClass('gdlr-core-stick-bottom-sidebar') ||
1528									sidebar_item.hasClass('gdlr-core-fixed-top-sidebar') || sidebar_item.hasClass('gdlr-core-stick-top-sidebar') ){
1529									t.return_sidebar_pos(sidebar_sub, sidebar_item);
1530								}
1531
1532							}else{
1533
1534								// scroll direction down
1535								if( scroll_direction == 'down' ){
1536
1537									if( sidebar_item.hasClass('gdlr-core-fixed-top-sidebar') ){
1538
1539										t.set_sidebar_sub(sidebar_sub, sidebar_item);
1540
1541										sidebar_item.addClass('gdlr-core-stick-top-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar gdlr-core-stick-bottom-sidebar');
1542										sidebar_item.css({
1543											'position': 'absolute',
1544											'top': scroll_pos - sidebar_wrap.offset().top,
1545											'bottom': 'auto',
1546											'left': sidebar_sub.position().left,
1547											'width': sidebar_sub.outerWidth()
1548										});
1549
1550									// stick at the bottom
1551									}else if( scroll_pos + $(window).height() >= sidebar_wrap.offset().top + sidebar_wrap.outerHeight() ){
1552
1553										t.set_sidebar_sub(sidebar_sub, sidebar_item);
1554
1555										sidebar_item.addClass('gdlr-core-stick-bottom-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar gdlr-core-stick-top-sidebar');
1556										sidebar_item.css({
1557											'position': 'absolute',
1558											'top': 'auto',
1559											'bottom': 0,
1560											'left': sidebar_sub.position().left,
1561											'width': sidebar_sub.outerWidth()
1562										});
1563
1564									// fixed at the bottom
1565									}else if( scroll_pos + $(window).height() > sidebar_item.offset().top + sidebar_item.outerHeight() ){
1566
1567										t.set_sidebar_sub(sidebar_sub, sidebar_item);
1568
1569										sidebar_item.addClass('gdlr-core-fixed-bottom-sidebar').removeClass('gdlr-core-stick-bottom-sidebar gdlr-core-stick-top-sidebar gdlr-core-fixed-top-sidebar');
1570										sidebar_item.css({
1571											'position': 'fixed',
1572											'top': 'auto',
1573											'bottom': '0',
1574											'left': sidebar_sub.offset().left,
1575											'width': sidebar_sub.outerWidth()
1576										});
1577									}
1578
1579								// scroll direction up
1580								}else{
1581
1582									if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){
1583
1584										t.set_sidebar_sub(sidebar_sub, sidebar_item);
1585
1586										sidebar_item.addClass('gdlr-core-stick-bottom-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar gdlr-core-stick-top-sidebar');
1587										sidebar_item.css({
1588											'position': 'absolute',
1589											'top': scroll_pos + $(window).height() - sidebar_item.outerHeight() - sidebar_wrap.offset().top,
1590											'bottom': 'auto',
1591											'left': sidebar_sub.position().left,
1592											'width': sidebar_sub.outerWidth()
1593										});
1594
1595									}else{
1596
1597										// stick at the top
1598										if( scroll_pos < sidebar_item.offset().top ){
1599
1600											t.set_sidebar_sub(sidebar_sub, sidebar_item);
1601
1602											sidebar_item.addClass('gdlr-core-fixed-top-sidebar').removeClass('gdlr-core-stick-bottom-sidebar gdlr-core-fixed-bottom-sidebar gdlr-core-stick-top-sidebar');
1603											sidebar_item.css({
1604												'position': 'fixed',
1605												'top': '0',
1606												'bottom': 'auto',
1607												'left': sidebar_sub.offset().left,
1608												'width': sidebar_sub.outerWidth()
1609											});
1610
1611										}
1612									}
1613
1614									
1615
1616								}
1617
1618								if( e.type == 'resize' ){
1619									if( sidebar_item.hasClass('gdlr-core-stick-bottom-sidebar') || sidebar_item.hasClass('gdlr-core-stick-top-sidebar') ){
1620										sidebar_item.css({ 
1621											'width': sidebar_sub.outerWidth(),
1622											'left': sidebar_sub.position().left,
1623										});
1624									}else if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') || sidebar_item.hasClass('gdlr-core-fixed-top-sidebar') ){
1625										sidebar_item.css({ 
1626											'width': sidebar_sub.outerWidth(),
1627											'left': sidebar_sub.offset().left,
1628										});
1629									}
1630								}
1631
1632							}
1633						}
1634
1635					}); // window scroll
1636
1637				});
1638			});
1639
1640		},
1641
1642		set_sidebar_sub: function(sidebar_sub, sidebar_item){
1643
1644			if(sidebar_item.hasClass('gdlr-core-sidebar-sub-added')) return;
1645
1646			// set the width
1647			var sidebar_class = '';
1648			sidebar_item.each(function(){
1649				var className = this.className.match(/gdlr-core-column-\d+/);
1650				if( className ){
1651					sidebar_class = className[0];
1652				}
1653			});
1654			sidebar_sub.addClass(sidebar_class);
1655
1656			// set position
1657			sidebar_sub.css({
1658				'float': sidebar_item.css('float'),
1659				'height': 20,
1660				'background': '#fd9'
1661			});
1662
1663			sidebar_sub.insertAfter(sidebar_item);
1664			sidebar_item.addClass('gdlr-core-sidebar-sub-added');
1665		},
1666
1667		return_sidebar_pos: function(sidebar_sub, sidebar_item){
1668			sidebar_item.css({'position': '', 'top': '', 'bottom': '', 'left': '', 'width': '', 'height': ''});
1669			sidebar_item.removeClass('gdlr-core-fixed-sidebar gdlr-core-fixed-bottom-sidebar gdlr-core-sidebar-sub-added');
1670			sidebar_item.removeClass('gdlr-core-stick-bottom-sidebar gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar');
1671			sidebar_sub.remove();
1672		}
1673
1674	}
1675
1676	$.fn.gdlr_core_isotope = function( filter_elem ){
1677
1678		if(typeof($.fn.isotope) == 'function'){
1679
1680			if( typeof(filter_elem) == 'undefined' ){
1681				var elem = $(this).find('[data-layout="masonry"]');
1682			}else{
1683				var elem = filter_elem.filter('[data-layout="masonry"]');
1684			}
1685		
1686			elem.each(function(){
1687
1688				var t = $(this);
1689				if( t.children('ul.products').length ){
1690					t = t.children('ul.products');
1691				}
1692				var columnSize = t.width() / 60;
1693
1694				t.isotope({
1695					itemSelector: '.gdlr-core-item-list',
1696					layoutMode: 'masonry',
1697					masonry:{
1698						columnWidth: columnSize
1699					}
1700				});
1701				t.isotope();
1702
1703				t.children('.gdlr-core-item-list').gdlr_core_animate_list_item();
1704
1705				// resize event
1706				$(window).on('resize gdlr-core-element-resize', function(){
1707					
1708					columnSize = t.width() / 60;
1709					
1710					t.isotope({
1711						masonry:{
1712							columnWidth: columnSize
1713						}
1714					});
1715				});	
1716			});
1717
1718		}
1719
1720		return $(this);
1721
1722	} // gdlr-core-isotope
1723	$.fn.gdlr_core_animate_list_item = function(){
1724
1725		var ux_items = $(this).get();
1726
1727		// run the ux in order with delay
1728		var ux_interval = setInterval(function(){ 
1729			
1730			if( ux_items.length > 0 ){
1731				// animate the ux item
1732				var ux_animate = $(ux_items.shift());
1733				var animation_duration = '600ms';
1734
1735				ux_animate.css({'animation-duration': animation_duration});
1736				ux_animate.addClass('gdlr-core-animate');
1737				
1738				// remove selector
1739				setTimeout(function(){
1740					ux_animate.css({'animation-duration':  ''})
1741						.addClass('gdlr-core-animate-end')
1742						.removeClass('gdlr-core-animate gdlr-core-animate-init');
1743				}, parseInt(animation_duration));	
1744					
1745			}else{
1746				clearInterval(ux_interval);
1747			}
1748		}, 200);
1749
1750	}
1751
1752	$.fn.gdlr_core_lightbox = function( filter_elem ){
1753		
1754		// ilightbox
1755		if( typeof($.iLightBox) == 'function' ){
1756
1757			if( typeof(filter_elem) == 'undefined' ){
1758				var ilightbox = $(this).find('.gdlr-core-ilightbox');
1759			}else{
1760				var ilightbox = filter_elem.filter('.gdlr-core-ilightbox');
1761			}		
1762		
1763			var ilightbox_atts = {};
1764			var ilightbox_groups = [];
1765
1766			if( typeof(gdlr_core_pbf.ilightbox_skin) != 'undefined' ){
1767				ilightbox_atts['skin'] = gdlr_core_pbf.ilightbox_skin;
1768			}
1769
1770			ilightbox.each(function(){
1771				if( $(this).attr('data-ilightbox-group') ){
1772					if( ilightbox_groups.indexOf($(this).attr('data-ilightbox-group')) == -1 ){
1773						ilightbox_groups.push($(this).attr('data-ilightbox-group'));
1774					}
1775				}else{
1776					$(this).iLightBox(ilightbox_atts);
1777				}
1778			});
1779
1780			for( var key in ilightbox_groups ){
1781				$(this).find('.gdlr-core-ilightbox[data-ilightbox-group="' + ilightbox_groups[key] + '"]').iLightBox(ilightbox_atts);
1782			}
1783
1784		}else if( typeof($.fn.lightGallery) == 'function' ){
1785
1786			if( typeof(filter_elem) == 'undefined' ){
1787				var lightgallery = $(this).find('.gdlr-core-lightgallery');
1788			}else{
1789				var lightgallery = filter_elem.filter('.gdlr-core-lightgallery');
1790			}
1791
1792			var lightbox_groups = [];
1793
1794			lightgallery.each(function(){
1795				if( $(this).attr('data-lightbox-group') ){
1796					if( lightbox_groups.indexOf($(this).attr('data-lightbox-group')) == -1 ){
1797						lightbox_groups.push($(this).attr('data-lightbox-group'));
1798					}
1799				}else{
1800					$(this).lightGallery({ selector: 'this' });
1801				}
1802			});
1803
1804			for( var key in lightbox_groups ){
1805				var group_selector = '.gdlr-core-lightgallery[data-lightbox-group="' + lightbox_groups[key] + '"]';
1806				
1807				lightgallery.filter(group_selector).first().lightGallery({ 
1808					selector: group_selector, 
1809					selectWithin: 'body',
1810					thumbnail: false
1811				});
1812			}
1813			
1814		}
1815
1816		// lightbox gallery
1817		if( typeof(filter_elem) == 'undefined' ){
1818			var gallery_lb = $(this).find('[data-gallery-lb]');
1819		}else{
1820			var gallery_lb = filter_elem.filter('[data-gallery-lb]');
1821		}
1822
1823		gallery_lb.click(function(){
1824			if( typeof($.iLightBox) != 'undefined' ){
1825				$.iLightBox($(this).data('gallery-lb'));
1826			}else if(typeof(Strip) != 'undefined' ){
1827				Strip.show($(this).data('gallery-lb'));
1828			}else if(typeof($.fn.lightGallery) == 'function'){
1829				$(this).lightGallery({ 
1830					dynamic: true,
1831					dynamicEl: $(this).data('gallery-lb'),
1832					thumbnail: false
1833				});
1834			}
1835
1836			return false;
1837		});
1838
1839		
1840		// image overlay
1841		if( typeof(filter_elem) == 'undefined' ){
1842			var center_overlay = $(this).find('.gdlr-core-image-overlay-center, .gdlr-core-image-overlay-center-icon');
1843		}else{
1844			var center_overlay = filter_elem.filter('.gdlr-core-image-overlay-center, .gdlr-core-image-overlay-center-icon');
1845		}		
1846	
1847		center_overlay.each(function(){
1848			
1849			// for portfolio overlay content style
1850			if( $(this).hasClass('gdlr-core-image-overlay-center') ){
1851				var overlay_content = $(this).children('.gdlr-core-image-overlay-content');
1852				var wrap_height = $(this).outerHeight() - (2 * parseInt(overlay_content.css('bottom')));
1853				
1854				var overlay_icon = overlay_content.children('.gdlr-core-portfolio-icon-wrap');
1855				var icon_margin = (wrap_height - (overlay_content.outerHeight() - parseInt(overlay_icon.css('margin-bottom')))) / 2;
1856				if( icon_margin > 20 ){
1857					overlay_icon.css('margin-bottom', icon_margin);
1858				}
1859				
1860			// normal centering
1861			}else{
1862				var content_offset = 0;
1863				if( $(this).children('.gdlr-core-image-overlay-content-offset').length ){
1864					content_offset = $(this).children('.gdlr-core-image-overlay-content-offset').outerHeight(true);
1865				}
1866
1867				$(this).children('.gdlr-core-image-overlay-content').each(function(){
1868					$(this).css({ 'margin-top': -( ($(this).outerHeight() + content_offset) / 2 ) });
1869				});
1870			}
1871			
1872		});
1873		$(window).on('resize gdlr-core-element-resize', function(){
1874			center_overlay.each(function(){
1875				// for portfolio style
1876				if( $(this).hasClass('gdlr-core-image-overlay-center') ){
1877					var overlay_content = $(this).children('.gdlr-core-image-overlay-content');
1878					var wrap_height = $(this).outerHeight() - (2 * parseInt(overlay_content.css('bottom')));
1879					
1880					var overlay_icon = overlay_content.children('.gdlr-core-portfolio-icon-wrap');
1881					var icon_margin = (wrap_height - (overlay_content.outerHeight() - parseInt(overlay_icon.css('margin-bottom')))) / 2;
1882					if( icon_margin > 20 ){
1883						overlay_icon.css('margin-bottom', icon_margin);
1884					}
1885					
1886				// normal centering
1887				}else{
1888					var content_offset = 0;
1889					if( $(this).children('.gdlr-core-image-overlay-content-offset').length ){
1890						content_offset = $(this).children('.gdlr-core-image-overlay-content-offset').outerHeight(true);
1891					}
1892
1893					$(this).children('.gdlr-core-image-overlay-content').each(function(){
1894						$(this).css({ 'margin-top': -( ($(this).outerHeight() + content_offset) / 2 ) });
1895					});
1896				}
1897			});
1898		});
1899
1900		return $(this);
1901	}
1902
1903	$.fn.gdlr_core_set_image_height = function(){
1904
1905		var all_image = $(this).find('img');
1906
1907		all_image.each(function(){
1908			var img_width = $(this).attr('width');
1909			var img_height = $(this).attr('height');
1910
1911			if( img_width && img_height ){
1912				var parent_item = $(this).parent('.gdlr-core-temp-image-wrap');
1913
1914				if( parent_item.length ){
1915					parent_item.height((img_height * $(this).parent().width()) / img_width);
1916				}else{
1917					parent_item = $('<div class="gdlr-core-temp-image-wrap" ></div>');
1918					parent_item.css('height', ((img_height * $(this).closest('span, div').width()) / img_width));
1919					$(this).wrap(parent_item);
1920				}
1921			}else{
1922				return;
1923			}
1924		});
1925		$(window).on('resize gdlr-core-element-resize', function(e){
1926			all_image.each(function(){
1927				var parent_item = $(this).parent('.gdlr-core-temp-image-wrap');
1928
1929				if( parent_item.length ){
1930					$(this).unwrap();
1931				}
1932			});
1933			
1934			$(window).unbind('resize', e.handleObj.handler, e);
1935		});
1936
1937		return $(this);
1938	} // gdlr_core_set_image_height
1939
1940	// to set full height wrapper / column
1941	window.gdlr_core_set_full_height = function( container, filter_elem ){
1942		if( typeof(filter_elem) == 'undefined' ){
1943			this.elements = container.find('.gdlr-core-wrapper-full-height, .gdlr-core-column-full-height');
1944		}else{
1945			this.elements = filter_elem.filter('.gdlr-core-wrapper-full-height, .gdlr-core-column-full-height');
1946		}
1947
1948		if( this.elements.length ){
1949			this.init();
1950		}
1951	}
1952	gdlr_core_set_full_height.prototype = {
1953
1954		init: function(){
1955
1956			var t = this;
1957
1958			t.resize();
1959			$(window).on('load resize gdlr-core-element-resize', function(){ t.resize(); });
1960		},
1961
1962		resize: function(){
1963
1964			this.elements.each(function(){
1965				var offset = $(this).attr('data-decrease-height')? parseInt($(this).attr('data-decrease-height')): 0;
1966
1967				$(this).css('min-height', $(window).height() - offset);
1968
1969				if( $(this).hasClass('gdlr-core-full-height-center') ){
1970					$(this).children('.gdlr-core-full-height-pre-spaces').remove();
1971
1972					var pre_space = ($(this).height() - $(this).children('.gdlr-core-full-height-content').outerHeight(true)) / 2;
1973					if( pre_space > 0 ){
1974						$(this).prepend($('<div class="gdlr-core-full-height-pre-spaces" ></div>').height(pre_space));
1975					}
1976				}
1977			});
1978
1979		}
1980	};
1981
1982	// sync height among items
1983	window.gdlr_core_sync_height = function( container, filter_elem ){
1984
1985		// for half height item
1986		this.set_half_height(container);
1987
1988		// sync height
1989		if( typeof(window.gdlr_core_sync_height_elem) != 'undefined' ){
1990			window.gdlr_core_sync_height_elem.reinit();
1991			return;
1992		}
1993		window.gdlr_core_sync_height_elem = this;
1994
1995		if( typeof(filter_elem) == 'undefined' ){
1996			this.elements = container.find('[data-sync-height]');
1997		}else{
1998			this.elements = filter_elem.filter('[data-sync-height]');
1999		}
2000		
2001		this.elements_group = [];
2002		this.container = container;
2003		this.init();
2004	} 
2005	gdlr_core_sync_height.prototype = {
2006
2007		init: function(){
2008
2009			var t = this;
2010			t.group_elements();	
2011			t.set_height();
2012
2013			$(window).on('load resize gdlr-core-element-resize', function(){ t.set_height(); });
2014		},
2015
2016		reinit: function(){
2017			
2018			if( !this.container.is('body, .gdlr-core-page-builder-body') ){
2019				this.container = this.container.closest('.gdlr-core-page-builder-body');
2020			}
2021
2022			this.elements = this.container.find('[data-sync-height]');
2023			this.group_elements();
2024			this.set_height();
2025
2026		},	
2027
2028		group_elements: function(){
2029
2030			var t = this;
2031			
2032			// do flipbox first
2033			t.elements.filter('.gdlr-core-flipbox-front, .gdlr-core-feature-box').each(function(){
2034				if( t.elements_group.indexOf($(this).attr('data-sync-height')) == -1 ){
2035					t.elements_group.push($(this).attr('data-sync-height'));
2036				}
2037			});
2038			
2039			// do the rest elements
2040			t.elements.each(function(){
2041				if( t.elements_group.indexOf($(this).attr('data-sync-height')) == -1 ){
2042					t.elements_group.push($(this).attr('data-sync-height'));
2043				}
2044			});
2045		},
2046
2047		set_height: function(){
2048
2049			var t = this;
2050
2051			// revert to default value
2052			t.elements.css('height', 'auto').children('.gdlr-core-sync-height-pre-spaces').remove();
2053			t.elements.find('.gdlr-core-sync-height-offset').remove();
2054
2055			var sync_element = t.elements;
2056			if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ){
2057				sync_element = sync_element.filter('.gdlr-core-flipbox-front, .gdlr-core-flipbox-back');
2058			}
2059
2060			// setting the height by each group
2061			for( var key in t.elements_group ){
2062				var max_height = 0;
2063
2064				// determine max height
2065				sync_element.filter('[data-sync-height="' + t.elements_group[key] + '"]').each(function(){
2066					if( $(this).outerHeight() > max_height ){
2067						max_height = $(this).outerHeight();
2068					}
2069				});
2070
2071				// set the height
2072				sync_element.filter('[data-sync-height="' + t.elements_group[key] + '"]').each(function(){
2073					
2074					// set the offset space to the bottom
2075					var offset = parseInt(max_height - $(this).outerHeight());
2076					var offset_item = $(this).find('[data-sync-height-offset]');
2077					if( offset_item.length && offset > 0 ){
2078						$('<div class="gdlr-core-sync-height-offset" ></div>').css('height', offset).insertBefore(offset_item);
2079					}
2080
2081					$(this).css('height', max_height);
2082
2083					// flipbox
2084					if( $(this).hasClass('gdlr-core-flipbox-front') ){
2085						$(this).parent().css('height', max_height);
2086					}
2087
2088					// center the content if selected
2089					if( $(this).is('[data-sync-height-center]') ){
2090						var content = $(this).children('.gdlr-core-sync-height-content');
2091						
2092						// determine top padding for centering content
2093						var padding_top = max_height;
2094						if( content.length > 0 ){
2095							padding_top -= content.outerHeight();
2096						}else{
2097							$(this).children().each(function(){
2098								padding_top -= $(this).outerHeight();
2099							});
2100						}
2101						padding_top = padding_top / 2;
2102						padding_top = padding_top - (parseInt($(this).css('padding-top')) + parseInt($(this).css('border-top-width')));
2103
2104						// insert the spaces
2105						if( padding_top > 0 ){
2106							var spaces_item = $('<div class="gdlr-core-sync-height-pre-spaces" ></div>').css('padding-top', padding_top);
2107							var space_position = $(this).children('.gdlr-core-sync-height-space-position');
2108							if( space_position.length > 0 ){
2109								spaces_item.insertBefore(space_position);
2110							}else{
2111								$(this).prepend(spaces_item);
2112							}
2113						}
2114					}
2115
2116				});
2117			}
2118
2119		},
2120
2121		set_half_height: function( container ){
2122
2123			container.find('.gdlr-core-half-height').each(function(){
2124				var temp = $(this);
2125				if( !gdlr_core_mobile && (gdlr_core_display == 'tablet' || gdlr_core_display == 'desktop') ){
2126					var temp_height = temp.outerHeight();
2127					temp.gdlr_core_set_image_height();
2128					temp.css('height', temp_height / 2);
2129					temp.find('img').css('margin-top', -temp_height/4);
2130				}
2131				$(window).on('load resize', function(){
2132					temp.css('height', 'auto');
2133					temp.find('img').css('margin-top', '0');
2134					if( !gdlr_core_mobile && (gdlr_core_display == 'tablet' || gdlr_core_display == 'desktop') ){
2135						temp_height = temp.outerHeight();
2136						temp.gdlr_core_set_image_height();
2137						temp.css('height', temp_height / 2);
2138						temp.find('img').css('margin-top', -temp_height/4);
2139					}
2140				});
2141			});
2142
2143		}
2144
2145	}; // gdlr_core_sync_height.prototype
2146
2147	function gdlr_core_ajax_action(ajax_section, name, value){
2148
2149		var now_loading = $('<div class="gdlr-core-now-loading" ></div>').hide();
2150
2151		$.ajax({
2152			type: 'POST',
2153			url: gdlr_core_pbf.ajax_url,
2154			data: { 
2155				'action': ajax_section.attr('data-ajax'), 
2156				'settings': ajax_section.data('settings'), 
2157				'option': { 'name':name, 'value':value } 
2158			},
2159			dataType: 'json',
2160			beforeSend: function(jqXHR, settings){
2161				// before send action
2162				if( ajax_section.attr('data-target-action') == 'replace' ){
2163					ajax_section.siblings('.' + ajax_section.attr('data-target')).animate({opacity: 0}, 150);
2164				}
2165
2166				// for portfolio item
2167				if( (ajax_section.attr('data-target') == 'gdlr-core-portfolio-item-holder' ||
2168					 ajax_section.attr('data-target') == 'gdlr-core-personnel-item-holder') && 
2169					ajax_section.attr('data-target-action') == 'replace' ){
2170
2171					now_loading.insertBefore( ajax_section.siblings('.gdlr-core-portfolio-item-holder, .gdlr-core-personnel-item-holder') );
2172					now_loading.fadeIn(200);
2173				}
2174			},
2175			error: function(jqXHR, textStatus, errorThrown){
2176				ajax_section.removeClass('gdlr-core-disable');
2177
2178				console.log(jqXHR, textStatus, errorThrown);
2179			},
2180			success: function(data){
2181				
2182				if( data.status == 'success' ){
2183					if( data.content && ajax_section.attr('data-target') ){
2184						if( ajax_section.attr('data-target-action') == 'append' ){
2185							var content = $(data.content);
2186							ajax_section.siblings('.' + ajax_section.attr('data-target')).each(function(){
2187
2188								if( $(this).attr('data-layout') != 'masonry' || typeof($.fn.isotope) != 'function' ){
2189									content.addClass('gdlr-core-animate-init');
2190								}
2191								$(this).append(content);
2192
2193								content.gdlr_core_lightbox().gdlr_core_flexslider().gdlr_core_content_script().gdlr_core_set_image_height();
2194								new gdlr_core_sync_height(content);
2195
2196								if( $(this).attr('data-layout') == 'masonry' && typeof($.fn.isotope) == 'function' ){
2197									var addItems = $(this).isotope('addItems', content);
2198									$(this).isotope('layoutItems', addItems, true);
2199								}
2200								
2201								content.gdlr_core_animate_list_item();
2202							});
2203
2204							if( data.load_more ){
2205								if( data.load_more != 'none' ){
2206									var load_more = $(data.load_more);
2207									ajax_section.parent().append(load_more);
2208									load_more.gdlr_core_ajax(load_more);
2209									load_more.css('display', 'none').slideDown(100);
2210
2211									ajax_section.remove();
2212								}else{
2213									ajax_section.slideUp(100, function(){ $(this).remove(); });
2214								}
2215							}
2216							
2217						}else if( ajax_section.attr('data-target-action') == 'replace' ){
2218							var content = $(data.content);
2219							ajax_section.siblings('.' + ajax_section.attr('data-target')).each(function(){
2220								if( ajax_section.is('.gdlr-core-pagination') ){
2221									var scroll_position = $(this).offset().top - 120;
2222									if( $(window).scrollTop() > scroll_position ){
2223										$('html, body').animate({ scrollTop: scroll_position }, { duration: 1500, easing: 'easeOutQuart', queue: false });
2224									} 
2225								}
2226								
2227								var fix_height = false;
2228								var current_height = $(this).height();
2229
2230								if( $(this).attr('data-layout') != 'masonry' || typeof($.fn.isotope) != 'function' ){
2231									content.addClass('gdlr-core-animate-init');
2232								}
2233								$(this).empty().append(content);
2234
2235								content.gdlr_core_lightbox().gdlr_core_flexslider().gdlr_core_fluid_video().gdlr_core_set_image_height();
2236								new gdlr_core_sync_height(content);
2237
2238								if( $(this).attr('data-layout') == 'masonry' && typeof($.fn.isotope) == 'function' ){
2239									$(this).isotope('destroy');
2240									$(this).parent().gdlr_core_isotope();
2241									fix_height = true;
2242								}else{
2243									content.gdlr_core_animate_list_item();
2244								}
2245
2246								var new_height = $(this).height();
2247								$(this).css({height:current_height}).animate({'height':new_height, opacity:1}, {'duration':400, 'easing':'easeOutExpo', 'complete': function(){
2248									if( !fix_height ){ $(this).css('height',''); }
2249								}});
2250							});
2251
2252							// pagination
2253							if( data.pagination ){
2254								ajax_section.siblings('.gdlr-core-pagination').slideUp(100, function(){ $(this).remove(); });
2255
2256								if( data.pagination != 'none' ){
2257									var pagination = $(data.pagination);
2258									ajax_section.parent().append(pagination);
2259									pagination.gdlr_core_ajax(pagination);
2260									pagination.css('display', 'none').slideDown(100);
2261								}
2262							}
2263
2264							// load more button
2265							if( data.load_more ){
2266								ajax_section.siblings('.gdlr-core-load-more-wrap').slideUp(100, function(){ $(this).remove(); });
2267								
2268								if( data.load_more != 'none' ){
2269									var load_more = $(data.load_more);
2270									ajax_section.parent().append(load_more);
2271									load_more.gdlr_core_ajax(load_more);
2272									load_more.css('display', 'none').slideDown(100);
2273								}
2274							}
2275
2276						}
2277					}
2278
2279					if( typeof(data.settings) != 'undefined' ){
2280						ajax_section.data('settings', data.settings);
2281					}
2282
2283					now_loading.fadeOut(200, function(){ 
2284						$(this).remove(); 
2285						ajax_section.removeClass('gdlr-core-disable');
2286					});
2287				}else{
2288					ajax_section.removeClass('gdlr-core-disable');
2289				}
2290				
2291			}
2292		});	
2293
2294	} // gdlr_core_ajax_action
2295	$.fn.gdlr_core_ajax = function( filter_elem ){
2296
2297		if( typeof(filter_elem) == 'undefined' ){
2298			var elem = $(this).find('[data-ajax]');
2299		}else{
2300			var elem = filter_elem.filter('[data-ajax]');
2301		}
2302
2303		elem.each(function(){
2304
2305			var ajax_section = $(this);
2306
2307			// button click
2308			$(this).on('click', 'a, .gdlr-core-ajax-link', function(){
2309				if( $(this).hasClass('gdlr-core-active') || ajax_section.hasClass('gdlr-core-disable') ){
2310					return false;
2311				}
2312
2313				ajax_section.addClass('gdlr-core-disable');
2314				$(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
2315				
2316				var name = $(this).attr('data-ajax-name');
2317				var value = $(this).attr('data-ajax-value');
2318
2319				gdlr_core_ajax_action(ajax_section, name, value);
2320
2321				if( $(this).is('a') ){
2322					return false;
2323				}
2324			});
2325
2326			// filter changed
2327			$(this).on('change', 'select', function(){
2328				var name = $(this).attr('data-ajax-name');
2329				var value = $(this).val();
2330
2331				gdlr_core_ajax_action(ajax_section, name, value);
2332			});
2333
2334		});	
2335
2336	} // gdlr_core_ajax
2337	$.fn.gdlr_core_ajax_slide_bar = function( filter_elem ){
2338		if( typeof(filter_elem) == 'undefined' ){
2339			var elem = $(this).find('[data-ajax]');
2340		}else{
2341			var elem = filter_elem.filter('[data-ajax]');
2342		}
2343
2344		elem.each(function(){
2345
2346			var ajax_section = $(this);
2347
2348			// filter slide bar
2349			$(this).children('.gdlr-core-filterer-slide-bar').each(function(){
2350				var slide_bar = $(this);
2351				var active_slide = slide_bar.siblings('.gdlr-core-active');
2352				slide_bar.css({'width': active_slide.outerWidth(), 'left': active_slide.position().left + parseInt(active_slide.css('margin-left')) });
2353
2354				$(window).on('load resize', function(){
2355					active_slide = slide_bar.siblings('.gdlr-core-active');
2356					slide_bar.css({'width': active_slide.outerWidth(), 'left': active_slide.position().left + parseInt(active_slide.css('margin-left')) });
2357				});
2358				
2359				ajax_section.find('a').hover(function(){
2360					slide_bar.animate({'width': $(this).outerWidth(), 'left': $(this).position().left + parseInt($(this).css('margin-left')) }, {queue: false, duration: 200});
2361				}, function(){
2362					active_slide = slide_bar.siblings('.gdlr-core-active');
2363					slide_bar.animate({'width': active_slide.outerWidth(), 'left': active_slide.position().left + parseInt(active_slide.css('margin-left')) }, {queue: false, duration: 200});
2364				});
2365			});
2366
2367		});	
2368	}
2369
2370	$.fn.gdlr_core_dropdown_tab = function( filter_elem ){
2371
2372		if( typeof(filter_elem) == 'undefined' ){
2373			var elem = $(this).find('.gdlr-core-dropdown-tab');
2374		}else{
2375			var elem = filter_elem.filter('.gdlr-core-dropdown-tab');
2376		}	
2377	
2378		elem.each(function(){
2379			var tab_title = $(this).children('.gdlr-core-dropdown-tab-title');
2380			var tab_title_text = tab_title.children('.gdlr-core-head');
2381			var tab_dropdown = tab_title.children('.gdlr-core-dropdown-tab-head-wrap');
2382			var tab_content = $(this).children('.gdlr-core-dropdown-tab-content-wrap');
2383
2384			// dropdown
2385			tab_title.click(function(){
2386				if( $(this).hasClass('gdlr-core-active') ){
2387					$(this).removeClass('gdlr-core-active');
2388					tab_dropdown.hide();
2389				}else{
2390					$(this).addClass('gdlr-core-active');
2391					tab_dropdown.slideDown(200);
2392				}
2393			});
2394			tab_dropdown.children().click(function(){
2395				tab_title_text.html($(this).html());
2396				$(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
2397
2398				var content_active = tab_content.children('[data-index="' + $(this).attr('data-index') + '"]');
2399				content_active.fadeIn(200).addClass('gdlr-core-active');
2400				content_active.siblings().hide().removeClass('gdlr-core-active');
2401			});
2402
2403		});
2404
2405	} // gdlr_core_dropdown_tab
2406
2407	if( !gdlr_core_pbf.admin ){
2408		
2409		$(document).ready(function(){
2410
2411			var wpcf7_select = $('.wpcf7-form select');
2412			if( wpcf7_select.length ){
2413				$('<div class="wpcf7-form-indicator" ><i class="fa fa-angle-down" ></i></div>').insertAfter(wpcf7_select);
2414			}
2415			
2416			$('body').each(function(){
2417				
2418				// turns image link to open in lightbox
2419				if( $(this).hasClass('gdlr-core-link-to-lightbox') ){
2420					var image_link = $(this).find('a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"]')
2421						.not('.gdlr-core-ilightbox, .strip, [data-rel], .gdlr-core-lightgallery, .gdlr-core-social-share-pinterest')
2422						.addClass('strip gdlr-core-ilightbox gdlr-core-lightgallery').each(function(){
2423							
2424							if( $(this).closest('.gallery').length ){
2425								var gallery_wrap = $(this).closest('.gallery');
2426								if( gallery_wrap.attr('data-gallery-id') ){
2427									var gallery_id = gallery_wrap.attr('data-gallery-id');
2428								}else{
2429									var gallery_id = Math.floor((Math.random() * 10000) + 1);
2430									gallery_wrap.attr('data-gallery-id', gallery_id);
2431								}
2432
2433								$(this).attr('data-ilightbox-group', 'wp-gallery-' + gallery_id);
2434								$(this).attr('data-lightbox-group', 'wp-gallery-' + gallery_id);
2435								$(this).attr('data-strip-group', 'wp-gallery-' + gallery_id);
2436
2437							}
2438						});
2439					$(this).gdlr_core_lightbox( image_link );
2440				}
2441
2442				var gdlr_core_js = $(this).find('.gdlr-core-js, iframe[src*="youtube"], iframe[src*="vimeo"]');
2443				
2444				// video resizing
2445				$(this).gdlr_core_content_script( gdlr_core_js, true );
2446				
2447				// counter item
2448				$(this).gdlr_core_counter_item( gdlr_core_js );	
2449				
2450				// type animation item
2451				$(this).gdlr_core_typed_animation( gdlr_core_js );	
2452
2453				// countdown item
2454				$(this).gdlr_core_countdown_item( gdlr_core_js );		
2455
2456				// alert box item
2457				$(this).gdlr_core_alert_box_item( gdlr_core_js );
2458				
2459				// accordion item
2460				$(this).gdlr_core_accordion( gdlr_core_js );
2461				
2462				// toggle box item
2463				$(this).gdlr_core_toggle_box( gdlr_core_js );
2464				
2465				// divider
2466				$(this).gdlr_core_divider( gdlr_core_js );
2467				
2468				// flipbox
2469				$(this).gdlr_core_flipbox( gdlr_core_js );
2470				
2471				// marquee
2472				$(this).gdlr_core_marquee( gdlr_core_js );
2473
2474				// chart.js
2475				$(this).gdlr_core_chart_js( gdlr_core_js );
2476
2477				// skill circle
2478				$(this).gdlr_core_skill_circle( gdlr_core_js );
2479				
2480				// skill bar
2481				$(this).gdlr_core_skill_bar( gdlr_core_js );
2482				
2483				// tab
2484				$(this).gdlr_core_tab( gdlr_core_js );
2485				$(this).gdlr_core_price_table_tab( gdlr_core_js );
2486
2487				// dropdown tab
2488				$(this).gdlr_core_dropdown_tab( gdlr_core_js );
2489				
2490				// lightbox
2491				$(this).gdlr_core_lightbox( gdlr_core_js );
2492
2493				// ajax action
2494				$(this).gdlr_core_ajax( gdlr_core_js );
2495				$(this).gdlr_core_ajax_slide_bar( gdlr_core_js );
2496				
2497				// sync height
2498				new gdlr_core_sync_height( $(this), gdlr_core_js );
2499
2500				// set height
2501				new gdlr_core_set_full_height( $(this), gdlr_core_js );
2502
2503				// sidebar wrapper height
2504				new gdlr_core_sidebar_wrapper( $(this), gdlr_core_js );
2505				
2506				// ux animation
2507				// $(this).gdlr_core_ux( gdlr_core_js );
2508				new gdlr_core_ux( $(this), gdlr_core_js );
2509				
2510				// background parallax
2511				$(this).gdlr_core_parallax_background( gdlr_core_js );
2512
2513				// particle
2514				$(this).gdlr_core_particle_background( gdlr_core_js );
2515
2516				// custom dropdown
2517				gdlr_core_js.filter('.gdlr-core-custom-dropdown').each(function(){
2518					var custom_dropdown = $(this);
2519					var dropdown_current = custom_dropdown.find('.gdlr-core-custom-dropdown-current');
2520
2521					$(this).on('click', '.gdlr-core-custom-dropdown-current', function(){
2522						dropdown_current.siblings('.gdlr-core-custom-dropdown-list').slideDown(150);
2523					});
2524					$(document).click(function(e){
2525						if( !$(e.target).is('.gdlr-core-custom-dropdown-current') ){
2526							dropdown_current.siblings('.gdlr-core-custom-dropdown-list').slideUp(150, function(){
2527								if( $(e.target).is('.gdlr-core-custom-dropdown-list-item') ){
2528									$(e.target).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active')
2529								}
2530							});
2531							if( $(e.target).is('.gdlr-core-custom-dropdown-list-item') ){
2532								dropdown_current.html( $(e.target).html() );
2533							}
2534						}
2535					});
2536				});
2537
2538				// privacy box cookie
2539				gdlr_core_js.filter('.gdlr-core-privacy-box-button').on('click', function(){
2540					var privacy_box_wrap = $(this).closest('.gdlr-core-privacy-box-wrap');
2541					if( privacy_box_wrap.is('.gdlr-core-pos-bottom-bar, .gdlr-core-pos-top-bar') ){
2542						privacy_box_wrap.slideUp(200);
2543					}else{
2544						privacy_box_wrap.fadeOut(250);
2545					}
2546
2547					var cookie_time = $(this).attr('data-cookie-time')? $(this).attr('data-cookie-time'): 2592000;
2548					gdlr_core_set_cookie('gdlr-core-privacy-box', 1, cookie_time);
2549
2550					return false;
2551				});
2552
2553				// gdlr lightbox
2554				gdlr_core_js.filter('[data-gdlr-lb]').each(function(){
2555					var lb_wrap = $('#' + $(this).data('gdlr-lb'));
2556					if( lb_wrap.length ){
2557						
2558						// open lightbox action
2559						$(this).on('click', function(){
2560							lb_wrap.fadeIn(200);
2561							return false;
2562						});
2563
2564						// bind the lightbox close action
2565						lb_wrap.find('.gdlr-core-lightbox-form-close').on('click', function(){
2566							$(this).closest('.gdlr-core-lightbox-wrapper').fadeOut();
2567							return false;
2568						});
2569					}
2570				});
2571
2572				// gdpr form
2573				gdlr_core_js.filter('#gdlr-core-gdpr-form').each(function(){
2574					
2575					// change tab
2576					$(this).on('click', '.gdlr-core-gdlr-form-nav li', function(){
2577						$(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active');
2578
2579						var nav_id = $(this).data('gdlr-nav');
2580						var content_wrap = $(this).closest('.gdlr-core-gdpr-form-left').siblings('.gdlr-core-gdpr-form-right');
2581						content_wrap.find('[data-gdlr-nav="' + nav_id + '"]').each(function(){
2582							$(this).siblings('[data-gdlr-nav]').removeClass('gdlr-core-active').css('display', 'none');
2583							$(this).fadeIn(200, function(){ $(this).addClass('gdlr-core-active'); });
2584						});
2585					});
2586				});
2587
2588				// sticky sidebar
2589				new gdlr_core_sticky_sidebar(gdlr_core_js);
2590			});
2591
2592		}); // document.ready
2593
2594		$(window).load(function(){
2595			
2596			$('body').each(function(){
2597
2598				var gdlr_core_js = $(this).find('.gdlr-core-js-2');
2599			
2600				// title divider
2601				$(this).gdlr_core_title_divider( gdlr_core_js );
2602
2603				// flexslider
2604				$(this).gdlr_core_flexslider( gdlr_core_js );
2605
2606				// sly slider
2607				$(this).gdlr_core_sly( gdlr_core_js );
2608
2609				// isotope
2610				$(this).gdlr_core_isotope( gdlr_core_js );
2611
2612			});
2613
2614		}); // window.load
2615
2616	}
2617
2618})(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.