PageSourceSearch

https://www.pul.va/wp-content/plugins/goodlayers-core/include/js/page-builder.js?ver=1.3.9

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