PageSourceSearch

https://www.lacasaprefabricada.net/wp-content/themes/rttheme19/js/scripts.js?ver=7.1.2

js lacasaprefabricada.net collected 2026-10-05 05:08:51 UTC 59,012 bytes, 2,363 lines download raw bytes

1/*!
2 * RT-Theme 19 WordPress Theme Scripts
3 * Copyright (C) 2014 RT-Themes
4 * http://rtthemes.com
5 *
6 * various scripts file 
7 */
8
9
10(function($){
11"use strict"; 
12
13	/* ******************************************************************************* 
14
15		GLOBAL VARS
16
17	***********************************************************************************/ 	
18	var is_rtl = $("body").hasClass("rtl");
19	var window_width = $(window).width();
20	var is_layout1 = $("body").hasClass("layout1");
21	var is_layout2 = $("body").hasClass("layout2");
22
23	/* ******************************************************************************* 
24
25		WINDOW WIDTH RESIZE ONLY
26
27	***********************************************************************************/ 
28	$(window).resize(function(){
29		if($(this).width() != window_width){
30			window_width = $(this).width();   
31			$(window).trigger("window_width_resize");
32		}
33	});
34
35	/* ******************************************************************************* 
36
37		CHECK IF THE HIDDEN MOBILE MENU ACTIVE
38
39	***********************************************************************************/ 
40	if( ! $.fn.is_mobile_menu ){
41
42		$.fn.is_mobile_menu = function()
43		{ 
44			return $(window).width() < 980;
45		};
46	}
47
48	/* ******************************************************************************* 
49
50		LOGO HOLDER HEIGHT - LAYOUT 2 
51
52	***********************************************************************************/ 
53	$(window).on('window_width_resize load', function() {    
54		
55		if( is_layout2 && ! $.fn.is_mobile_menu() ){
56			var nav_height = $(".header-right").outerHeight();
57			$(".header-elements").css({"min-height":nav_height+"px"});
58		}else{
59			$(".header-elements").css({"min-height":"auto"});
60		}
61	});
62
63	/* ******************************************************************************* 
64
65		MOBILE MENU
66
67	***********************************************************************************/ 
68	function rt_toggle_mobile_menu(menu_button){
69		menu_button.toggleClass("icon-menu icon-menu-outline");
70		$("body").toggleClass("mobile-menu-active");			
71	}
72
73	//on menu button click
74	$(".mobile-menu-button").on("click",function() {
75		rt_toggle_mobile_menu($(this));
76		return false;
77	});
78
79	//on right side click
80	$("#right_side").on('touchstart click', function(e) {
81		if( $("body").hasClass("mobile-menu-active") ){
82			rt_toggle_mobile_menu($(".mobile-menu-button"));
83			return false;
84		}
85	});
86
87	$(window).on('window_width_resize load', function() {     
88		
89		if($.fn.is_mobile_menu()){
90			$("body").addClass("mobile-menu");
91		}else{
92			$("body").removeClass("mobile-menu");
93			$("body").removeClass("mobile-menu-active");
94		}
95 
96		if( Modernizr.touch && is_layout1 ){
97			$("body").addClass("mobile-menu");
98			return false;
99		}
100
101	});
102
103
104	/* ******************************************************************************* 
105
106		STICKY HEADER
107
108	********************************************************************************** */  
109
110		if( ! $.fn.rt_sticky_header ){
111
112			$.fn.rt_sticky_header = function()
113			{ 	
114
115					if( $(this).length == 0 ){
116						return;
117					}
118
119					var header = $(this);
120					var site_logo = $(".site-logo, .site-logo img");
121					var site_name = $(".site-logo .sitename > a");
122					var main_content = $("#container");
123
124					if( Modernizr.touch || ! is_layout2 || $.fn.is_mobile_menu() ){
125						header.removeClass( "stuck" ); 
126						main_content.removeAttr("style");
127						site_logo.removeAttr("style");						
128						return;
129					}
130
131					var header_right = $(".header-right");
132					var navigation_bar_height = header.outerHeight();  
133					var header_top_position = header.position().top;
134					var wp_admin_bar_height = $("#wpadminbar").outerHeight();
135					var top_distance = ( header.position().top - wp_admin_bar_height ) + navigation_bar_height ; 
136
137					if( header.length > 0 ){			
138
139						//scroll function
140						$(window).scroll(function(event) {
141
142							if( $.fn.is_mobile_menu() ){
143								return;
144							}
145
146							var y = $(window).scrollTop();
147						
148							if( y > top_distance ){							
149								header.addClass( "stuck" );
150								main_content.css({"padding-top":top_distance +"px"});
151								site_logo.css({"max-height":header_right.height()+"px"}); 
152								site_name.css({"line-height":header_right.height()+"px",padding:"0"}); 
153							}else{
154								header.removeClass( "stuck" ); 
155								main_content.removeAttr("style");
156								site_logo.removeAttr("style");
157								site_name.removeAttr("style");
158							}
159						});							
160					}
161
162			};
163
164		}	
165
166		$(window).on('window_width_resize load', function() {
167			$(".sticky.top-header").rt_sticky_header();
168		});
169
170
171
172	/* ******************************************************************************* 
173
174		ON PAGE LOAD
175
176	***********************************************************************************/ 
177	imagesLoaded( "body" ).on('done', function( instance ) {
178	
179		$("body").removeClass("rt-loading");
180		$("#loader-wrapper").remove();
181
182		if ( ! Modernizr.touch ) {
183			$(window).scrollTop(0);
184		}
185	});
186
187	Pace.on('hide', function(){
188		$('.pace').remove();   
189		$("body").removeClass("rt-loading");
190		$("#loader-wrapper").remove();		
191	});
192
193	/* ******************************************************************************* 
194
195		RT ONE PAGE
196
197	***********************************************************************************/ 
198 
199	if( ! $.fn.rt_one_page ){
200
201		$.fn.rt_one_page = function()
202		{ 
203
204			var wp_admin_bar_height = $("#wpadminbar").outerHeight() - 1;
205
206			if( window.location.hash ){ 
207				if( $(window.location.hash).length > 0 ){ 
208					rt_scroll_to( $(window.location.hash).offset().top - wp_admin_bar_height, window.location.hash );
209				}
210			}
211
212			$(this).on("click",function(e){
213			
214					var cur_url = window.location.host + window.location.pathname + window.location.search;
215					var this_url = this.host + this.pathname + this.search;
216
217					if( cur_url == this_url ){
218
219						e.preventDefault();		
220
221						if( this.hash == "#top" ){
222							rt_scroll_to( 0, "");
223							return ;
224						}						
225		 
226						var target = $(this.hash);
227
228						if( target.length == 0 ){
229							window.location = this.href;
230							return ;
231						}
232						
233						if( $("body").hasClass("mobile-menu-active") ){
234							$(".mobile-menu-button").trigger("click");
235						}
236
237						var sticky_menu_item = $(".sticky #navigation > li > a");
238						var sticky_height = 0;
239
240						if( sticky_menu_item.length > 0 ){
241							sticky_height = sticky_menu_item.height() + 30;
242						}
243						
244						var reduce = wp_admin_bar_height + sticky_height;
245						
246						rt_scroll_to( target.offset().top - reduce, this.hash);
247					}
248			});
249
250
251			$(this).each(function(){
252
253				var menu_item = $(this),
254					hash = this.hash,
255					section = $(hash);
256
257				menu_item.parent("li").removeClass("current-menu-item current_page_item");
258
259				section.waypoint(function(direction) { 
260						if (direction === 'down') {
261							rt_remove_active_menu_class();
262							menu_item.parent("li").addClass("current-menu-item current_page_item");
263						}
264				}, { offset: '50%' });
265
266				section.waypoint(function(direction) { 
267						if (direction === 'up') {
268							rt_remove_active_menu_class();
269							menu_item.parent("li").addClass("current-menu-item current_page_item");
270						}
271				}, { 
272					offset: function() { 
273						return 0;
274					}
275				});
276
277				section.waypoint(function(direction) { 
278						if (direction === 'up') {
279							menu_item.parent("li").removeClass("current-menu-item current_page_item");
280						}
281				}, { 
282					offset: function() { 
283						return $.waypoints('viewportHeight');
284					}
285				});
286
287				section.waypoint(function(direction) { 
288						if (direction === 'down') {
289							menu_item.parent("li").removeClass("current-menu-item current_page_item");
290						}
291				}, { 
292					offset: function() { 
293						return -$(this).height();
294					}
295				});
296
297			});
298
299
300			function rt_remove_active_menu_class(){
301				$("#navigation > li.current-menu-item, #navigation > li.current_page_item").removeClass("current-menu-item current_page_item"); 
302			}
303
304		};
305	}
306
307	
308	if ( $.fn.rt_one_page ) {  
309		Pace.on('hide', function(){
310			$($('#navigation a[href*="#"]:not([href="#"])')).rt_one_page();   
311		});
312	}
313
314
315
316	/* ******************************************************************************* 
317
318		SCROLLTO LINKS
319
320	***********************************************************************************/ 
321	$(".scroll").on("click",function(){
322
323		if( this.hash == "#top" ){
324			rt_scroll_to( 0, "");
325			return ;
326		}			
327
328		var wp_admin_bar_height = $("#wpadminbar").outerHeight();
329		var sticky_menu_item = $(".sticky #navigation > li > a");
330		var sticky_height = 0;
331
332		if( sticky_menu_item.length > 0 ){
333			sticky_height = sticky_menu_item.height() + 30;
334		}
335		
336		var reduce = wp_admin_bar_height + sticky_height;
337
338		if( $(this.hash).length < 1 ){
339			return ;
340		}
341
342		rt_scroll_to( $(this.hash).offset().top - reduce, this.hash);
343	});
344
345
346	/* ******************************************************************************* 
347
348		GO TO TOP LINK
349
350	***********************************************************************************/ 
351 
352	if( ! $.fn.rt_go_to_top ){
353
354		$.fn.rt_go_to_top = function()
355		{ 
356
357			var $this = $(this);
358			$(window).scroll(function(event) {
359
360				var top_distance = 100;
361				var y = $(window).scrollTop();
362			
363				if( y > top_distance ){							
364					 $this.addClass("visible");
365				}else{
366					 $this.removeClass("visible");
367				}
368
369			});		
370
371			$(this).on("click",function(e){
372				rt_scroll_to( 0, "");
373			});
374
375		};
376	}
377	
378	if ( $.fn.rt_go_to_top ) {  
379		$('.go-to-top').rt_go_to_top();   
380	}
381
382	/* ******************************************************************************* 
383
384		RT COUNTER
385
386	***********************************************************************************/ 
387 
388	if( ! $.fn.rt_counter ){
389
390		$.fn.rt_counter = function()
391		{ 
392
393			$(this).each(function(){
394				var number_holder = $(this).find("> .number"),
395					 number = number_holder.text();
396
397				$(this).waypoint( { 
398					triggerOnce: true,   
399					offset: "100%",  
400					handler: function() {    
401
402						$({
403							Counter: 0
404						}).animate({
405							Counter: number_holder.text()
406						}, {
407							duration: 1200,
408							step: function () {
409								number_holder.text(Math.ceil(this.Counter));
410							},
411							complete: function () {
412								number_holder.text(number);
413							}							
414						});
415
416					}
417				});
418			});
419		};
420	}
421	
422	if ( $.fn.rt_counter ) {  
423		Pace.on('hide', function(){
424			$('.rt_counter').rt_counter();   
425		});
426	}
427
428	/* ******************************************************************************* 
429
430		RT SCROLL TO
431
432	***********************************************************************************/ 
433
434	function rt_scroll_to( to, hash ){
435
436		$('html, body').stop().animate({
437			'scrollTop': to
438		}, 900, 'swing', function() {
439			window.location.hash = hash;
440			$('html,body').scrollTop(to);
441		});				
442	
443	}
444
445
446	/* ******************************************************************************* 
447
448		FIX FEATURES COLUMN POSITION OF COMPARE TABLES
449
450	********************************************************************************** */  
451
452	if( ! $.fn.rt_tables ){
453
454		$.fn.rt_tables = function()
455		{ 
456
457			var features,
458				table = $(this);
459
460
461			//brings the features column position same with other columns
462			function fix_compare_features( table ){
463
464				$(table).each(function(i){
465
466					var start_position_element = $(this).find(".start_position"),
467					features_list = $(this).find(".table_wrap.features ul"), 
468					new_offset =  start_position_element.offset().top - $(this).offset().top; 
469
470					features_list.css("top",new_offset);
471				});
472
473			}
474
475
476			//copy features to each column for mobile
477			function copy_features( table ){
478
479				$(table).each(function(){
480
481					features=[];
482					//createa features array from the first row
483					$(this).find(".table_wrap.features li").each(function(){
484						features.push( $(this).html() );
485					});
486
487				});
488
489				$(table).find(".table_wrap").each(function(i){
490
491					if( $(this).hasClass("features") == "" ){
492						var i = 0;
493						$(this).find("li").each(function(){
494							$(this).prepend('<div class="visible-xs-block hidden-sm hidden-md hidden-lg">'+features[i]+'</div>'); 
495						i++;
496						});
497					} 
498				}); 				
499			}
500
501			//bind to window resize
502			$(window).bind("resize",table, function( ){
503				fix_compare_features( table );   
504			});
505
506			//start functions
507			fix_compare_features( table );
508			copy_features( table );
509
510		};
511	}
512
513	if ( $.fn.rt_tables ) {  
514		$('.pricing_table.compare').rt_tables();   
515	}
516
517	/* ******************************************************************************* 
518
519		TOGGLE - ACCORDION
520
521	********************************************************************************** */  
522	$(".rt-toggle .toggle-content").hide(); 
523	$(".rt-toggle .open .toggle-content").show();  
524	
525	$(".rt-toggle ol li .toggle-head").click(function(){ 
526
527		clearTimeout("accordion_timeout");
528		
529		var element = $(this).parent("li"),
530			content = element.find(".toggle-content");
531
532		if( element.hasClass("open")){ 
533			element.removeClass("open");
534			content.stop().slideUp(300);
535
536		}else{
537
538			$(this).parents("ol").find("li.open").removeClass("open").find(".toggle-content").stop().slideUp(300);  
539
540			element.addClass("open");
541			content.stop().slideDown(300,function(){
542				fix_accordion_pos();
543			});	
544
545			//fixed heights 
546			content.find('.fixed_heights').rt_fixed_rows("load"); 
547
548			//fixed footers
549			$('[data-footer="fixed_footer"]').rt_fixed_footers();
550
551		} 
552
553		function fix_accordion_pos(){
554			if( $(window).scrollTop() > element.offset().top ){
555				var accordion_timeout = setTimeout(function() {
556					var add = $("#wpadminbar").outerHeight() + $(".top-header.stuck").outerHeight();
557					rt_scroll_to( element.offset().top - add, "");
558				}, 100 );			
559			}			
560		}
561
562	});
563
564
565	/* ******************************************************************************* 
566
567		TABS
568
569	********************************************************************************** */  
570
571	if( ! $.fn.rt_tabs ){
572
573		$.fn.rt_tabs = function()
574		{ 
575
576			$(this).each(function () {
577
578				var tabs = $(this),
579					tab_nav = $(this).find("> .tab_nav"),
580					desktop_nav_element = $(this).find("> .tab_nav > li"),
581					mobile_nav_element = $(this).find("> .tab_contents > .tab_content_wrapper > .tab_title"),
582					tab_wrappers =  $(this).find("> .tab_contents > .tab_content_wrapper"),
583					tab_style = $(this).attr("data-tab-style");
584
585				//nav height fix
586				height_fix(1);
587
588				//mobile nav clicks	
589				mobile_nav_element.click(function() {		
590					close_all();
591					open_tab( $(this).attr("data-tab-number") );
592				})
593
594				//desktop nav clicks
595				desktop_nav_element.click(function() {				
596					close_all();
597					open_tab( $(this).attr("data-tab-number") );
598				})
599
600				//close all tab_style
601				function close_all(){
602					tab_wrappers.each(function() {
603						$(this).removeClass("active");
604					});
605
606					desktop_nav_element.each(function() {
607						$(this).removeClass("active");
608					});
609
610				}
611
612				//open a tab 
613				function open_tab( tab_number ){
614
615					var nav_item = tabs.find('[data-tab-number="'+tab_number+'"]'),
616						tab_content_wrapper = tabs.find('[data-tab-content="'+tab_number+'"]');
617
618						nav_item.addClass("active");
619						tab_content_wrapper.addClass("active");
620						height_fix( tab_number );
621
622						//fixed heights 
623						tab_content_wrapper.find('.fixed_heights').rt_fixed_rows("load");
624
625 
626						//fix custom select forms
627						$.fn.rt_customized_selects( tab_content_wrapper );
628						tab_content_wrapper.find('span.customselect').remove();
629						tab_content_wrapper.find('select.hasCustomSelect').removeAttr("style");
630						$.fn.rt_customized_selects( tab_content_wrapper );
631 
632
633						if( window_width < 767 ){
634							rt_scroll_to( tab_content_wrapper.offset().top, "" );
635						}
636				}
637
638				//height fix -  vertical style
639				function height_fix( tab_number ) {
640					if( tab_style == "tab-style-2" ){						
641						var current_tab_height = tabs.find('[data-tab-content="'+tab_number+'"]').outerHeight();
642						tab_nav.css({"min-height":current_tab_height+"px"});
643					}
644				}
645
646			});
647 
648		};
649	}
650
651	if ( $.fn.rt_tabs ) {  
652		$('.rt_tabs').rt_tabs();   
653	}
654
655	/* ******************************************************************************* 
656
657		START CAROUSELS
658
659	********************************************************************************** */    
660
661	$.fn.rt_start_carousels = function( callbacks ) {
662
663		$(this).find(".rt-carousel").each(function(){
664
665			var autoHeight_,
666				margin = $(this).data("margin") !== "" ? $(this).data("margin") : 15, 
667				carousel_holder = $(this),
668				items = $(this).attr("data-item-width"),//number of items of each slides
669				nav = $(this).attr("data-nav") == "true" ? true : false,
670				dots = $(this).attr("data-dots") == "true" ? true : false,
671				timeout = typeof $(this).attr("data-timeout") != "undefined" ? $(this).data("timeout") : 5000,
672				autoplay = $(this).data("autoplay") != "undefined" ? $(this).data("autoplay") : false,
673				loop = $(this).data("loop") != "" ? true : false, 
674				carousel_id = $(this).attr("id");
675
676			//auto height & margin 
677			if( items == 1 ){
678				autoHeight_ = true;
679				margin = 0;
680			}else{
681				autoHeight_ = false;
682				margin = margin;
683			}
684
685			//start carousel
686			var carousel = carousel_holder.find(".owl-carousel"); 
687
688			imagesLoaded( carousel ).on('done', function( instance ) {
689
690				if( instance.images.length == 1 ){
691					nav = dots = false;
692				} 
693				
694				var startover;
695				carousel.on('changed.owl.carousel', function(e) {
696
697					if( ! autoplay ){
698						return;
699					}
700
701					clearTimeout(startover); 
702
703					if (!e.namespace || e.type != 'initialized' && e.property.name != 'position') return;
704 
705		 			var items = $(this).find('.active').size(); 
706
707					if( e.item.index == e.item.count - items ){
708
709						var startover = setTimeout(function() {
710							carousel.trigger('to.owl.carousel',  [0, 400, true]);
711						}, timeout );			
712
713					}
714
715				});
716				
717
718				carousel.owlCarousel({
719					rtl: is_rtl ? true : false,
720					//loop:loop, //isues with webkit
721					autoplayTimeout : timeout,
722					autoplay:autoplay,
723					autoplayHoverPause:true,
724					margin:margin,
725					responsiveClass:true,					
726					autoHeightClass: 'owl-height',
727					navText: ["<span class=\"icon-left-open\"></span>","<span class=\"icon-right-open\"></span>"],
728					responsive:{
729						0:{
730							items:1,
731							nav:nav,
732							dots:dots,
733							autoHeight:( items == 1 ),
734							dotsContainer: "#"+carousel_id+"-dots"
735						},
736						1024:{
737							items:( items == 1 ) ? 1 : 2,
738							nav:nav,
739							dots:dots,
740							autoHeight:( items == 1 ),
741							dotsContainer: "#"+carousel_id+"-dots"
742						},						
743						1025:{
744							items:items,
745							nav:nav,
746							dots:dots,
747							autoHeight:( items == 1 ),
748							dotsContainer: "#"+carousel_id+"-dots",
749						}
750					},
751					onInitialized: callbacks ? callbacks._onInitialized : isotope_layout,
752					onChanged: callbacks ? callbacks._onChanged : "",
753					onRefreshed: callbacks ? callbacks._onRefreshed : "",
754					onTranslated: isotope_layout,
755
756				});
757
758				//cosmetic fix for content carousels
759				make_same_height(carousel,items);
760				$(window).on('window_width_resize', function() { 
761					setTimeout(function() {
762						reset_carousel_heights(carousel,items);
763						make_same_height(carousel,items); 
764					}, 300);			
765				});		
766
767			});
768
769		});
770
771		//reset isotopes after carousel
772		function isotope_layout(){
773
774			var isotope_gallery = $(".masonry");
775
776			if( isotope_gallery.length > 0 ){
777				setTimeout(function() {	      				
778					isotope_gallery.isotope('layout'); 
779				}, 1000);							
780			}
781		}
782
783		//get highest item of the carousel
784		function get_highest_item( carousel ){
785			var heights = [];
786			carousel.find(".owl-item").each(function(){  
787				heights.push($(this).outerHeight());   
788			});
789
790			return Math.max.apply(null, heights);
791		}
792
793		//reset carousel item heights
794		function reset_carousel_heights( carousel, items ){
795
796			if( items == 1 ){
797				return false;
798			} 
799
800			carousel.find(".owl-item > div").each(function(){ 
801				$(this).css({"min-height": ""});
802			});
803		}		 
804
805		//make all carousel items in same height
806		function make_same_height( carousel, items ){
807
808			if( items == 1 ){
809				return false;
810			} 
811
812			var height = get_highest_item( carousel );			
813
814			carousel.find(".owl-item > div").each(function(){ 
815				$(this).css({"min-height": height +"px"});
816			});
817		}
818
819	}; 	
820
821	$("body").rt_start_carousels();
822
823
824	/* ******************************************************************************* 
825
826		RIGHT BACKGROUND HEIGHT 
827
828	********************************************************************************** */  
829
830	if( ! $.fn.rt_side_height ){
831
832		$.fn.rt_side_height = function()
833		{ 
834
835			var right_side = $("#right_side"),
836				left_side = $("#left_side"),
837				reduce = 0,
838				height = 0,
839				wp_admin_bar = $("#wpadminbar");
840
841			if( wp_admin_bar.length > 0 ){
842				reduce = wp_admin_bar.outerHeight();
843			}
844
845			if($.fn.is_mobile_menu()){
846				height = "";
847			}else{
848				height = Math.max($(window).innerHeight(),left_side.height(),right_side.height()) - reduce +"px";
849			}
850
851			left_side.css( { "min-height" : height });
852			right_side.css( { "min-height" : height });
853
854		};
855	}
856
857
858	if ( $.fn.rt_side_height && is_layout1 ) {  
859
860		$(window).on('resize', function() {     
861			$.fn.rt_side_height();
862		});	
863
864		Pace.on('hide', function(){
865			$.fn.rt_side_height();
866		});
867
868	}
869
870
871	if( ! $.fn.rt_side_margin ){
872
873		$.fn.rt_side_margin = function()
874		{ 
875
876			var right_side = $("#right_side"),
877				left_side = $("#left_side");
878
879
880			if($.fn.is_mobile_menu()){
881				right_side.removeAttr("style");
882			}else{
883
884				if( is_rtl ){
885					right_side.css( { "margin-right" : left_side[0].getBoundingClientRect().width });
886				}else{
887					right_side.css( { "margin-left" : left_side[0].getBoundingClientRect().width });
888				}
889			}
890			
891		};
892	}
893
894
895	if ( $.fn.rt_side_margin && is_layout1 ) {  
896
897		Pace.on('hide', function(){
898			$.fn.rt_side_margin();
899		});
900		
901		$(window).on('resize', function() {
902			$.fn.rt_side_margin();
903		});
904			
905	}
906
907	/* ******************************************************************************* 
908
909		FIXED SIDEBAR POSITION
910
911	***********************************************************************************/ 
912	if( ! $.fn.rt_left_height ){
913
914		$.fn.rt_left_height = function()
915		{ 
916			var left_side = $("#left_side");
917
918			if( Modernizr.touch ){
919				left_side.removeClass("fixed_position scroll");
920				return ;
921			}
922
923			$(window).off(".rt_sidebar");
924
925			if( ! left_side.hasClass("fixed_position")){
926				return ;
927			}
928
929			var side_content = $("#side_content").removeAttr("style"),
930				side_content_height = side_content.innerHeight(),
931				content_height = $("body").height(),
932				side_content_top_pos = side_content.offset().top,
933				$window = $(window),
934				window_height = $window.height(),
935				window_scrollTop = $window.scrollTop(),
936				diff = window_height - ( ( side_content_top_pos - window_scrollTop ) + side_content_height );			
937
938				if( diff > 0 ){
939					return false;
940				} 
941
942				//make two side heights are equal  
943				if ( side_content_height > content_height ) {
944					$("#right_side").css( { "min-height" : side_content_height+side_content_top_pos+"px"});
945				}
946
947				//scroll
948				$(window).on("scroll.rt_sidebar", function( event ){
949
950					var y = -1 * $window.scrollTop();
951
952						y = Math.max( y, diff );
953
954						$(side_content).css({ 
955							"-webkit-transform": "translateY("+y+"px)",
956							"-moz-transform": "translateY("+y+"px)",
957							"-ms-transform": "translateY("+y+"px)",
958							"-o-transform": "translateY("+y+"px)",
959							"transform": "translateY("+y+"px)"
960						});
961
962						$(side_content).attr("data-position-y",y);		
963
964				});
965		};
966	}
967
968	if ( $.fn.rt_left_height && is_layout1 ) {  
969
970		$(window).on('resize', function() {     
971			$.fn.rt_left_height();
972		});	
973
974		Pace.on('hide', function(){
975			$.fn.rt_left_height();
976		}); 		
977	} 
978 
979
980	/* ******************************************************************************* 
981
982		PARALLAX SIDEBAR BACKGROUND IMAGE
983
984	***********************************************************************************/ 
985
986	$.fn.rt_left_background = function(durum)
987	{
988
989		var left_side =  $("#left_side");
990
991		if( left_side.length == 0 ){
992			return;
993		}
994		
995	  	var parallax_effect = ! Modernizr.touch ? left_side.attr("data-parallax-effect") : false,
996			$window = $(window),
997			window_height =  $window.height(),
998			side_width =  document.getElementById("left_side").getBoundingClientRect().width,
999			side_content = $("#side_content"),
1000			side_content_width = side_content.innerWidth(),
1001			side_content_height = side_content.outerHeight(),
1002			padding_top = 50, //#left_side top padding
1003			side_background_holder = left_side.find(".left-side-background-holder");
1004
1005
1006			var parallax_height = parallax_effect ? 300 : 100,
1007				parallax_height = window_height + parallax_height; 		
1008
1009			side_background_holder.find(".left-side-background").css({ 
1010							"width": side_width+100+"px",
1011							"height": parallax_height+"px"
1012						});
1013
1014			//turn off parallax if it is not enabled
1015			if ( ! parallax_effect || Modernizr.touch ) {
1016				return false;
1017			}
1018
1019			//parallax effect
1020			$(window).on("scroll.rt_left_background", function( event ){
1021
1022				//for the side background image
1023				var y = Math.max ( -1 * ( $window.scrollTop() * 0.03 ), - ( parallax_height - window_height ) ) ; 
1024
1025				side_background_holder.find(".left-side-background").css({  
1026						"-webkit-transform": "translateY("+y+"px)",
1027						"-moz-transform": "translateY("+y+"px)",
1028						"-ms-transform": "translateY("+y+"px)",
1029						"-o-transform": "translateY("+y+"px)",
1030						"transform": "translateY("+y+"px)"
1031				});  
1032
1033			});		
1034
1035		return false;	
1036	}
1037
1038	if( is_layout1 ){
1039		imagesLoaded( "body" ).on('done', function( instance ) {
1040
1041			$(window).on('resize', function() {     
1042				$.fn.rt_left_background("resize");
1043			});	
1044
1045			$.fn.rt_left_background("load");
1046		}); 
1047	}
1048
1049
1050	/* ******************************************************************************* 
1051
1052		WOOCOMMERCE CART UPDATE FOR WC CART WIDGET
1053		Fixes the fixed left column height after new items added to the cart
1054
1055	********************************************************************************** */  
1056
1057	if( is_layout1 ){
1058			$("#tools > ul > li > span").on("click",function(e){
1059
1060
1061				var holder = $(this).parent("li"),
1062					 widget = holder.find("div:eq(0)");
1063
1064				$("#tools > ul > li").each(function(){				
1065
1066					if ( ! $(this).is(holder) ){
1067						$(this).removeClass("active");	
1068					}
1069					
1070				});
1071
1072
1073				if( holder.hasClass("active") ){ 
1074					holder.removeClass("active");	
1075				}else{
1076					holder.addClass("active");
1077					
1078
1079					if( ! is_rtl ){
1080						widget.css({"margin-left": -1 * holder.position().left +"px"});
1081					}else{
1082						widget.css({"margin-right":"0"}).css({"margin-right":  widget.position().left + holder.position().left +"px"});
1083					}
1084						
1085				}
1086
1087				$.fn.rt_left_height();
1088				$(window).trigger("scroll");  
1089
1090			});
1091	}
1092
1093
1094	if( is_layout2 ){
1095			$("#tools > ul:first-child > li > span").on("click",function(e){
1096
1097				if( ! $(this).hasClass("active") ){
1098					$(this).addClass("active");
1099					$("#tools > ul:last-child").addClass("active");
1100				}else{
1101					$(this).removeClass("active");
1102					$("#tools > ul:last-child").removeClass("active");
1103				}
1104
1105
1106			});
1107	}
1108 	
1109	/* ******************************************************************************* 
1110
1111		WOOCOMMERCE FLYING ADDED TO CART ITEM
1112
1113	********************************************************************************** */  
1114 
1115	if ( ! $.fn.rt_flying_cart ) {  
1116
1117		$.fn.rt_flying_cart = function()
1118		{ 
1119
1120			if( typeof wc_cart_fragments_params == 'undefined' ){
1121				return ;
1122			}
1123
1124			if( $(".product_holder.woocommerce").length == 0 ){
1125				return ;
1126			}
1127
1128			$( '.add_to_cart_button' ).on( 'click', function() {
1129
1130				var $this = $(this),
1131					y = $(this).offset().top,
1132					x = $(this).offset().left,
1133					number = $("#tools .cart .number"),
1134					ty= number.offset().top,
1135					tx= number.offset().left
1136
1137				//freeze scroll
1138				$("body").css({"overflow":"hidden"});
1139				var unfreeze = setTimeout(function(){ $("body").css({"overflow":"visible"}); }, 5000);
1140				
1141				//bind to added_to_cart
1142				$( 'body' ).bind( 'added_to_cart',  function() {
1143
1144					var img_src = $this.parents(".product_item_holder").find(".featured_image img").attr("src"),
1145						img_holder = $('<div></div>');
1146
1147						img_holder.css({
1148							"background-image" : "url("+img_src+")",
1149							"background-size" : "cover",
1150							"background-repeat" : "no-repeat",
1151							"background-position" : "center center",
1152							"border-radius" : "50%",
1153							"width" : "0px",
1154							"height" : "0px",
1155							"position" : "absolute",
1156							"z-index" : 9999999
1157						});
1158
1159						img_holder.prependTo("body");		 				
1160
1161						img_holder.css({
1162								"opacity": 0,
1163								"top": y+"px",
1164								"left": x+"px",
1165							}).animate({
1166								"opacity": 1,
1167								"width": "150px",
1168								"height": "150px"
1169							},500).animate({
1170								"top": +ty+"px",
1171								"left": +tx+"px",
1172								"padding": "0",
1173								"width": "18px",
1174								"height": "18px"		
1175							},700).animate({
1176								"opacity": 0
1177							},400,function(){
1178								img_holder.remove();
1179
1180							//fix left side
1181							$.fn.rt_left_height();
1182							$(window).trigger("scroll"); 
1183							
1184							$("body").css({"overflow":"visible"});
1185							clearTimeout(unfreeze);
1186					
1187						});						
1188						$(this).unbind('added_to_cart');
1189				});
1190
1191			});
1192
1193		}
1194	} 
1195 
1196	$.fn.rt_flying_cart();
1197
1198
1199	/* ******************************************************************************* 
1200
1201		SEARCH WIDGET
1202
1203	********************************************************************************** */  
1204	$(".wp-search-form span").on('click', function() {     
1205		$(this).parents("form:eq(0)").submit();
1206	});	
1207
1208	/* ******************************************************************************* 
1209
1210		FIXED FOOOTERS
1211
1212	********************************************************************************** */  
1213
1214	if( ! $.fn.rt_fixed_footers ){
1215
1216		$.fn.rt_fixed_footers = function()
1217		{ 
1218
1219			if(is_layout2){
1220				var footer = $(this),
1221					header = $(".top-header"),
1222					main_content = $("#main_content"),
1223					sub_page_header = $(".sub_page_header"),
1224					wp_admin_bar = $("#wpadminbar"),
1225					footer_height = footer.outerHeight(true);
1226
1227				if ( Modernizr.touch ) {
1228					footer.removeClass( "fixed_footer" );
1229					return ;
1230				}			
1231
1232				if( 
1233					$(window).height() - ( header.outerHeight() + header.position().top + wp_admin_bar.outerHeight() + sub_page_header.outerHeight() ) < footer_height 
1234					|| main_content.height() - 160 < footer_height 
1235					|| $("body").outerHeight() - $(window).height() < footer_height
1236				){
1237					footer.removeClass( "fixed_footer" );
1238					main_content.css( { "margin-bottom" : "0px" });
1239				}else{
1240					footer.addClass( "fixed_footer" );
1241					main_content.css( { "margin-bottom" : footer_height +"px" });				
1242				}
1243			}else{
1244				var footer = $(this),
1245					right = $("#right_side"),
1246					top_bar = $("#top_bar"),
1247					main_content = $("#main_content"),
1248					sub_page_header = $(".sub_page_header"),
1249					wp_admin_bar = $("#wpadminbar"),
1250					footer_height = footer.outerHeight(true);
1251
1252				if ( Modernizr.touch ) {
1253					footer.removeClass( "fixed_footer" );
1254					return ;
1255				}			
1256
1257				if( $(window).height() - ( top_bar.outerHeight() + wp_admin_bar.outerHeight() + sub_page_header.outerHeight() ) < footer_height 
1258					|| main_content.height() -160 < footer_height 
1259					|| right.outerHeight() - $(window).height() < footer_height ){
1260					footer.removeClass( "fixed_footer" );
1261					right.css( { "padding-bottom" : "0px" });
1262				}else{
1263					footer.addClass( "fixed_footer" );
1264					right.css( { "padding-bottom" : footer_height +"px" });				
1265				}
1266			}
1267
1268		};
1269	}
1270
1271	if ( $.fn.rt_fixed_footers ) {  
1272
1273		Pace.on('hide', function(){
1274			
1275			$(window).on('resize', function() {     
1276				$('[data-footer="fixed_footer"]').rt_fixed_footers();
1277			});				
1278
1279			$('[data-footer="fixed_footer"]').rt_fixed_footers();
1280		}); 		
1281	}
1282
1283
1284	/* ******************************************************************************* 
1285
1286		SOCIAL SHARE 
1287
1288	********************************************************************************** */
1289 
1290	$(".social_share_holder a").click(function( event ) {		
1291
1292		//if email button clicked do nothing
1293		if( $(this).hasClass("icon-mail") ){
1294			return ;
1295		}
1296
1297		//for other buttons open a popup window
1298		newwindow=window.open($(this).attr("data-url"),'name','height=400,width=400');
1299
1300		if (newwindow == null || typeof(newwindow)=='undefined') {  
1301			alert( rt_theme_params["popup_blocker_message"] ); 
1302		}else{  
1303			newwindow.focus();
1304		}
1305
1306		event.preventDefault();
1307	});
1308
1309	/* ******************************************************************************* 
1310
1311		Tooltips
1312
1313	********************************************************************************** */
1314	$('[data-toggle="tooltip"]').tooltip();
1315
1316
1317	/* ******************************************************************************* 
1318
1319		IMG effects
1320
1321	********************************************************************************** */
1322	if( ! $.fn.rt_img_effect ){
1323
1324		$.fn.rt_img_effect = function()
1325		{ 
1326			$(this).find('.imgeffect').each(function() {
1327				$('<div/>').append($(this).find("img")).appendTo($(this));
1328			});
1329		};
1330	}
1331
1332	$("#container").rt_img_effect();
1333
1334	/* ******************************************************************************* 
1335
1336		DROP RIGHT MENU
1337
1338	********************************************************************************** */
1339
1340	if( ! $.fn.rt_drop_right ){
1341
1342		$.fn.rt_drop_right = function()
1343		{ 
1344			if ($(this).length == 0 ){
1345				return false;
1346			}
1347
1348			$(this).on("mouseover",function(){
1349
1350				if( $("body").hasClass("mobile-menu") ){
1351					return false;
1352				}
1353
1354				if( $(this).prev() && $(this).parent().hasClass("sub-menu") ){
1355					var add = 0;
1356				}else{
1357					var add = 1;
1358				}
1359
1360				var margin_top = -1 * ( $(this).outerHeight() + add );
1361				var sub_menu = $(this).find("ul:eq(0)").css({"margin-top":margin_top +"px"});
1362
1363				if ( sub_menu.length == 0 ){
1364					return false;
1365				}
1366
1367				var sub_menu_height = sub_menu.outerHeight(),
1368					sub_menu_position = $(sub_menu).offset().top,
1369					_window = $(window),
1370					window_height = _window.height()+margin_top,
1371					window_scrollTop = _window.scrollTop(),
1372					diff = window_height - ( ( sub_menu_position - window_scrollTop ) + sub_menu_height );
1373
1374					if( diff < 0 ){ 
1375						sub_menu.css({"margin-top": margin_top + diff + "px"});
1376					} 
1377
1378					if( sub_menu.offset().left + 250 > _window.width() ){ 
1379						sub_menu.css({"right": "250px"});
1380					} 
1381			});
1382
1383		};
1384	}
1385
1386	if( is_layout1 ){
1387		$('#navigation li').rt_drop_right();	
1388	}
1389  
1390
1391	/* ******************************************************************************* 
1392
1393		DROP DOWN MENU
1394
1395	********************************************************************************** */
1396
1397	if( ! $.fn.rt_drop_down ){
1398
1399		$.fn.rt_drop_down = function()
1400		{ 
1401
1402			if( $.fn.is_mobile_menu() ){
1403				return ;
1404			}
1405
1406			var $this = $(this);				
1407
1408			$this.each(function(){
1409
1410					var menu_items_with_sub = $(this).find(".menu-item-has-children"),
1411						max_depth = 0;
1412
1413					menu_items_with_sub.each(function(){
1414						max_depth = Math.max( max_depth, $(this).data("depth") ); 
1415					});
1416
1417					if( ! is_rtl ){
1418
1419						if( window_width < $(this).offset().left + ( ( max_depth + 1 ) * 240 ) ){
1420							$(this).addClass("o-direction");
1421						}					
1422
1423					}else{
1424
1425						if( 0 > ( $(this).offset().left - ( ( max_depth + 1 ) * 240 ) ) ){
1426							$(this).addClass("o-direction");
1427						}
1428					}
1429			});  
1430
1431		};
1432	}
1433
1434	$("#navigation > li:not(.multicolumn).menu-item-has-children").rt_drop_down();
1435
1436	/* ******************************************************************************* 
1437
1438		MOBILE DROP DOWN MENU
1439
1440	********************************************************************************** */
1441
1442	if( ! $.fn.rt_mobile_drop_down ){
1443
1444		$.fn.rt_mobile_drop_down = function()
1445		{ 
1446
1447			$(this).on("click",function(e){
1448
1449				if( ! $("body").hasClass("mobile-menu") ){
1450					return ;
1451				}
1452
1453				var $this = $(this);				
1454
1455
1456
1457				if( ! is_rtl || $("body").hasClass("layout2")  ){
1458
1459					if( ! $this.hasClass("menu-item-has-children") || e.pageX - $this.position().left < 225){
1460						return ;
1461					}
1462
1463				}else{
1464
1465					if( ! $this.hasClass("menu-item-has-children") || e.pageX - $("#left_side").position().left > 50 ){
1466						return ;
1467					}
1468				}
1469				
1470				e.preventDefault();
1471
1472				console.log($(this));
1473				$this.toggleClass("current-menu-item");
1474
1475				return false;
1476
1477			});
1478
1479		};
1480	}
1481
1482	$(window).on('load', function() {  
1483		$('#navigation li').rt_mobile_drop_down();
1484	});
1485
1486	/* ******************************************************************************* 
1487
1488		TABLET NAVIGATION FIX FOR DEACTIVE STATE
1489
1490	********************************************************************************** */    
1491	$("#container").on("click",function() { 
1492		return true;
1493	});
1494
1495
1496	/* ******************************************************************************* 
1497
1498		LOAD MORE
1499
1500	********************************************************************************** */    
1501
1502	$(".load_more").on("click",function(e){
1503 
1504		e.preventDefault();	
1505
1506		var button = $(this),
1507			listid = button.attr("data-listid"),
1508			page_count = parseInt(button.attr("data-page_count")) ,
1509			current_page = parseInt(button.attr("data-current_page")) ;
1510
1511		//prevent multiple clicks before loading elements
1512		button.attr("disabled", "disabled");
1513
1514		//check if there is more posts to display
1515		if( page_count == 1 ){
1516			return ;
1517		}
1518
1519		//load more button classes
1520		button.children("span").removeClass("icon-angle-double-down").addClass("icon-spin1 animate-spin");
1521	
1522		//start ajax
1523		$.ajax({
1524			type: 'POST',
1525			url: rt_theme_params.ajax_url,
1526			data : {
1527				'action': 'rt_ajax_loader',
1528				'atts': $(this).attr("data-atts"),
1529				'wpml_lang': rt_theme_params.wpml_lang,
1530				'page': current_page + 1
1531			},		
1532			success: function(response, textStatus, XMLHttpRequest){
1533
1534				var response = $(response), elems, wrapper, masonry;
1535
1536					wrapper = $("#"+listid);	
1537
1538					if( wrapper.hasClass("masonry") ){
1539						masonry = true;
1540					}	
1541					
1542					if( masonry ){
1543						elems = response.find(".isotope-item");	
1544					}else{
1545						elems = response.find("> div, > article");							
1546					}
1547
1548
1549				// wait the images 
1550				imagesLoaded( response ).on('done', function( instance ) {
1551
1552					//append the elements and rebuild the masonry layout
1553					if( masonry ){
1554						wrapper.isotope().append( elems ).isotope( 'appended', elems );
1555					}else{
1556						wrapper.append( elems );					
1557					}
1558
1559					//img effects for new loaded elements
1560					elems.rt_img_effect();
1561
1562					//media player
1563					elems.rt_mediaelementplayer();
1564
1565					//append isotope elements
1566					if( masonry ){ 
1567						wrapper.isotope('layout'); 
1568					}
1569
1570					//lightboxes 
1571					$.jackBox.available(function() {
1572						elems.rt_lightbox("newItem");
1573					});
1574
1575					//start carousels
1576					elems.rt_start_carousels( { '_onRefreshed' : function _onRefreshed(){
1577											if( masonry ){ 
1578												wrapper.isotope('layout'); 
1579											}
1580										}});
1581
1582					//portoflio items
1583					elems.find(".type-portfolio.loop > .overlay").rt_portfolio_items();
1584
1585					//the load more button
1586					button.children("span").removeClass("icon-spin1 animate-spin").addClass("icon-angle-double-down");
1587
1588					//decrease the page count
1589					button.attr("data-page_count",page_count-1);
1590
1591					//increase the current page count
1592					button.attr("data-current_page", current_page+1 );
1593
1594					//remove the button if there is no page left
1595					if( page_count -1 <= 1 ){
1596						button.attr("disabled", "disabled").hide();
1597					}else{
1598						button.removeAttr("disabled");
1599					}
1600
1601					//fix left side
1602					$.fn.rt_left_height();
1603					$(window).trigger("scroll");  
1604				});
1605
1606			},
1607			error: function( MLHttpRequest, textStatus, errorThrown ){
1608				console.log(errorThrown);
1609			}		
1610		});
1611 
1612	});
1613
1614	/* ******************************************************************************* 
1615
1616		CUSTOM DESIGNED SELECT FORMS
1617
1618	********************************************************************************** */  
1619	if( ! $.fn.rt_customized_selects ){
1620		$.fn.rt_customized_selects = function( wrapper ) {
1621			if ( $.isFunction($.fn.customSelect) ) {
1622
1623				var selectors = '.orderby, .variations select:not([multiple]), .widget .menu.dropdown-menu, .gfield:not(.notcustomselect) .ginput_container select:not([multiple]), .wpcf7-form select:not([multiple])';
1624				if( wrapper ){
1625					wrapper.find(selectors).customSelect( { customClass: "customselect" } );
1626				}else{
1627					$(selectors).customSelect( { customClass: "customselect" } );
1628				}
1629				
1630			}
1631		};
1632	};
1633
1634	$(window).load(function(){
1635		$.fn.rt_customized_selects();
1636
1637		//bind to gravity ajax load
1638		$(document).bind('gform_post_render', function(){			
1639			$.fn.rt_customized_selects();
1640		});
1641
1642	});
1643
1644
1645	/* ******************************************************************************* 
1646
1647		WC REVIEWS
1648
1649	********************************************************************************** */  
1650
1651	$(".woocommerce-review-link").click(function( event ){  
1652		var review_tab = $("#reviews-title");
1653		review_tab.trigger("click"); 
1654	});
1655
1656
1657	/* ******************************************************************************* 
1658
1659		FORM VALIDATION
1660
1661	********************************************************************************** */  
1662
1663	$.fn.rt_contact_form = function() {
1664		
1665		$(this).each(function(){
1666
1667			var the_form = $(this);
1668
1669			the_form.find(".submit").click(function( event ){  
1670
1671				//vars
1672				var loading = the_form.find(".loading"),
1673					error = false;
1674
1675				//check required fields
1676				the_form.find(".required").each(function(){
1677					if( $(this).val() == "" ){
1678						$(this).addClass("error");
1679						error = true;
1680					}else{
1681						$(this).removeClass("error");
1682					}
1683				});
1684
1685				//there is an error
1686				if(error){
1687					return ;
1688				}
1689
1690				//show loading icon
1691				loading.show();
1692
1693				//searialize the form
1694				var serialize_form = $(the_form).serialize();
1695
1696				//ajax form data 
1697				var data = serialize_form +'&action=rt_ajax_contact_form';
1698
1699				//post
1700				$.post(rt_theme_params.ajax_url, data, function(response) {
1701					var response = $(response);
1702					response.prependTo(the_form);
1703					loading.hide();
1704				});
1705
1706				//close warnings
1707				the_form.find(".info_box").remove();
1708
1709			});
1710		});
1711	}; 
1712
1713	$('.validate_form').rt_contact_form();
1714 
1715
1716	/* ******************************************************************************* 
1717
1718		INFO BOX CLOSE
1719
1720	********************************************************************************** */  
1721	$(document.body).on("click",".info_box .icon-cancel",function() { 
1722		$(this).parent(".info_box").fadeOut();
1723	}); 
1724
1725
1726
1727
1728	/* ******************************************************************************* 
1729
1730		PORTFOLIO ITEMS 
1731
1732	********************************************************************************** */    
1733
1734	$.fn.rt_portfolio_items = function() {
1735		$(this).each(function(){
1736			var text = $(this).find(".text"),
1737				holder_height = $(this).height(),
1738				text_height = text.height(),
1739				margin = ( text_height < holder_height ) ? ( holder_height - text_height ) / 2 : 0;
1740
1741				text.css({
1742					"margin-top": margin + "px",
1743					"max-height": holder_height + "px"
1744				});
1745		}); 
1746	};
1747
1748	Pace.on('hide', function(){
1749		$(".type-portfolio.loop > .overlay").rt_portfolio_items();
1750	});
1751	
1752 
1753	/* ******************************************************************************* 
1754
1755		LIGHTBOX PLUGIN
1756
1757	********************************************************************************** */    
1758
1759	$.fn.rt_lightbox = function(event) {
1760		if ($.jackBox){
1761			$(this).find(".lightbox_[data-group]").jackBox(event, { preloadGraphics: false, baseName: rt_theme_params["rttheme_template_dir"] +"/js/lightbox", className: ".lightbox_", deepLinking : false, socialMedia : false, showInfoByDefault: true});  
1762		}
1763
1764	};
1765
1766	$(document).rt_lightbox("init");
1767
1768
1769
1770	/* ******************************************************************************* 
1771
1772		RT GOOGLE MAPS
1773
1774	********************************************************************************** */  
1775	$.rt_maps = function(el, locations, zoom){
1776
1777		var base = this; 
1778		base.init = function(){ 
1779			// initialize google map
1780			if(locations.length>0) google.maps.event.addDomListener(window, 'load', $.fn.rt_maps());  
1781
1782		};
1783 
1784		if(locations.length>0) base.init();
1785	}; 
1786
1787	$.fn.rt_maps = function(locations, zoom){		 
1788
1789		var map_id = $(this).attr("id");  
1790 
1791		//holder height
1792		var height = $('[data-scope="#'+map_id+'"]').attr("data-height");   
1793
1794		if ( height > 0 ){
1795			$(this).css({'height':height+"px"});
1796		}
1797
1798		//api options
1799		var myOptions = {
1800			zoom: zoom,
1801			panControl: true,
1802			zoomControl: true,
1803			scaleControl: true,			
1804			streetViewControl: false,
1805			overviewMapControl: false,
1806			scrollwheel : false,
1807			navigationControl: true,
1808			center: new google.maps.LatLng(0, 0),
1809			mapTypeId: google.maps.MapTypeId.ROADMAP
1810		}			 
1811 
1812		var map = new google.maps.Map( document.getElementById(map_id), myOptions);		
1813		$.fn.setMarkers(map, locations);
1814
1815		$.fn.fixTabs(map,map_id,zoom);
1816		$.fn.fixAccordions(map,map_id,zoom);
1817	};
1818
1819	$.fn.setMarkers = function (map, locations) {
1820		 
1821
1822		if(locations.length>1){
1823			var bounds = new google.maps.LatLngBounds();	 
1824		}else{
1825			var center = new google.maps.LatLng(locations[0][1], locations[0][2]);
1826			map.panTo(center);			
1827		}
1828
1829
1830		for (var i = 0; i < locations.length; i++) {
1831			if (locations[i] instanceof Array) {
1832				var location = locations[i];
1833				var myLatLng = new google.maps.LatLng(location[1], location[2]);
1834				var marker = new google.maps.Marker({
1835					position: myLatLng,
1836					map: map,
1837					animation: google.maps.Animation.DROP,
1838					draggable: false,
1839					title: location[0]
1840				});
1841
1842				$.fn.add_new_event(map,marker,location[4]);
1843				if(locations.length>1) bounds.extend(myLatLng);
1844			}
1845		}
1846
1847		if(locations.length>1)  map.fitBounds(bounds);
1848	};
1849	 
1850	$.fn.add_new_event = function (map,marker,content) {
1851
1852	  if(content){
1853			var infowindow = new google.maps.InfoWindow({
1854				content: content,
1855				maxWidth: 300
1856			});
1857			google.maps.event.addListener(marker, 'click', function() {;
1858			infowindow.open(map,marker);
1859		});
1860	  }
1861	}; 
1862
1863	$.fn.fixTabs = function (map,map_id,zoom) {
1864		var tabs = $("#"+map_id).parents(".rt_tabs:eq(0)"),
1865			desktop_nav_element = tabs.find("> .tab_nav > li"),
1866			mobile_nav_element = tabs.find("> .tab_contents > .tab_content_wrapper > .tab_title");
1867
1868		desktop_nav_element.on("click",  { map: map } , function() { 
1869			var c = map.getCenter();  
1870			google.maps.event.trigger(map, 'resize'); 
1871			map.setZoom(zoom); 
1872			map.setCenter(c);  
1873		});
1874 
1875		mobile_nav_element.on("click",  { map: map } , function() { 
1876			var c = map.getCenter();  
1877			google.maps.event.trigger(map, 'resize'); 
1878			map.setZoom(zoom); 
1879			map.setCenter(c);  
1880		});
1881
1882	};	
1883
1884	$.fn.fixAccordions = function (map,map_id,zoom) {
1885		var panes = $("#"+map_id).parents(".rt-toggle:eq(0) > ol > li");
1886
1887		panes.on("click",  { map: map } , function() { 
1888			var c = map.getCenter();  
1889			google.maps.event.trigger(map, 'resize'); 
1890			map.setZoom(zoom); 
1891			map.setCenter(c);  
1892		}); 
1893
1894	};	
1895
1896	/* ******************************************************************************* 
1897
1898		SLIDER PARALLAX EFFECT
1899
1900	********************************************************************************** */  
1901
1902	$.fn.rt_slider_position = function()
1903	{
1904		var slider =  $('#main_content > .content_row:first-child .main-carousel[data-parallax="true"]');
1905
1906		if( slider.length == 0 || Modernizr.touch ){
1907			return ;
1908		}
1909
1910		var	parallax_effect = ! Modernizr.touch ? true : false,		
1911			wp_admin_bar_height = $("#wpadminbar").outerHeight(),
1912			offsetTop = slider.offset().top,
1913			sliderHeight = slider.outerHeight(),
1914			gap = offsetTop - wp_admin_bar_height,
1915			carousel = slider.find(".owl-stage-outer"),
1916			$window = $(window);
1917
1918
1919			//parallax effect
1920			$(window).on("scroll", function( event ){
1921
1922				var scrollTop = $window.scrollTop() - gap ;
1923
1924				 
1925				if( sliderHeight < scrollTop ){
1926					return ;
1927				}
1928
1929				var y = Math.max( 0, scrollTop ),
1930					cy = 0.4*y;
1931
1932 
1933				carousel.css({ 
1934					"-webkit-transform": "translateY("+cy+"px)",
1935					"-moz-transform": "translateY("+cy+"px)",
1936					"-ms-transform": "translateY("+cy+"px)",
1937					"-o-transform": "translateY("+cy+"px)",
1938					"transform": "translateY("+cy+"px)"
1939				});
1940
1941
1942			});			
1943	}
1944
1945
1946	$(window).on('resize', function() {     
1947		$.fn.rt_slider_position();
1948	});	
1949
1950	Pace.on('hide', function(){
1951		$.fn.rt_slider_position();
1952	}); 
1953
1954	/* ******************************************************************************* 
1955
1956		MEDIA PLAYER
1957
1958	********************************************************************************** */  
1959
1960	$.fn.rt_mediaelementplayer = function() {
1961		
1962		$(this).find(".rt-hosted-media video, .rt-hosted-media audio").mediaelementplayer();
1963	}; 
1964
1965	$(document).rt_mediaelementplayer();
1966
1967
1968	/* ******************************************************************************* 
1969
1970		PARALLAX BACKGROUNDS
1971
1972	********************************************************************************** */  
1973
1974	if( ! $.fn.rt_parallax_backgrounds ){
1975
1976		$.fn.rt_parallax_backgrounds = function(options)
1977		{ 
1978			if( Modernizr.touch ){
1979				return ;
1980			}
1981
1982			$(this).each(function(){
1983				
1984				var row = $(this).parents("div:eq(0)"),
1985					row_height = row.outerHeight() ,
1986					row_width = row.outerWidth() ,
1987					row_inheight = row.height(), 
1988					row_paddings = row_height - row_inheight,
1989					speed = ( row_height / $(window).height() ) + 1, 
1990					holder_height = row_height * speed,
1991					holder_width = row_width * speed,
1992					effect = $(this).attr("data-rt-parallax-effect"), // vertical, horizontal
1993					direction = $(this).attr("data-rt-parallax-direction"); // -1 down/right , 1 up/left
1994 
1995
1996					if( effect == "horizontal" ){
1997						$(this).css({ "height":row_height+4+"px", "width":holder_width+"px" });	
1998					}else{
1999						$(this).css({ "height":holder_height+"px", "width":row_width+4+"px" });	
2000					}
2001 
2002
2003					if( effect == "horizontal" ){
2004						$(this).rt_horizontal_parallax_effect({ row: row, row_width: row_width, holder_width: holder_width, direction: direction });
2005					}else{
2006						$(this).rt_vertical_parallax_effect({ row: row, row_height: row_height, holder_height: holder_height, direction: direction });	
2007					}
2008			
2009	 
2010 
2011			});
2012		} 
2013 
2014		$.fn.rt_horizontal_parallax_effect = function( options )
2015		{ 
2016			var $this = $(this),
2017				$window = $(window),
2018				invisible_part = options["holder_width"] - options["row_width"],
2019				posTop = options["row"].offset().top,
2020				start_position = options["direction"] == -1 ? -1 * invisible_part : 0;
2021 
2022			//start position of the parallax layer
2023			$this.rt_parallax_apply_css(start_position, 0 );
2024
2025			//scroll function
2026			$(window).scroll(function(event) {
2027
2028				if( ( posTop - $window.height() ) > $window.scrollTop() ){
2029					return ;
2030				}
2031
2032				var move_rate  = ( $window.scrollTop() *  invisible_part ) / ( posTop + options["row_width"] ); 
2033				var xPos = options["direction"] == 1 ? -1 * move_rate :  -1 * invisible_part + move_rate ;
2034
2035				if( xPos < -1 * invisible_part ) xPos = -1 * invisible_part; //max left position					
2036				if( xPos > 0 ) xPos = 0;  //max right position
2037
2038				$this.rt_parallax_apply_css(xPos, 0);
2039
2040			});
2041		}	
2042
2043
2044		$.fn.rt_vertical_parallax_effect = function( options )
2045		{ 
2046			var $this = $(this),
2047				$window = $(window),
2048				invisible_part = options["holder_height"] - options["row_height"],
2049				posTop = options["row"].offset().top,
2050				start_position = options["direction"] == -1 ? -1 * invisible_part : 0;
2051 
2052			//start position of the parallax layer
2053			$this.rt_parallax_apply_css(0, start_position );
2054  
2055			//scroll function
2056			$(window).scroll(function(event) {
2057
2058				if( (posTop - $window.height() ) > $window.scrollTop()  ){
2059					return ;
2060				}
2061
2062				var move_rate  = ( $window.scrollTop() *  invisible_part ) / ( posTop + options["row_height"] ); 
2063				var yPos = options["direction"] == 1 ? -1 * move_rate :  -1 * invisible_part + move_rate ;
2064
2065				if( yPos < -1 * invisible_part ) yPos = -1 * invisible_part; //max bottom position					
2066				if( yPos > 0 ) yPos = 0;  //max top position	
2067			
2068				$this.rt_parallax_apply_css(0, yPos);	
2069
2070				//sub page headers
2071				if( $this.parent(".content_row").hasClass("sub_page_header") ){
2072					$this.next(".content_row_wrapper").find(".page-title").rt_parallax_apply_css( 0, $window.scrollTop() / 6 );	
2073				}
2074 
2075			});
2076		}		
2077
2078
2079		$.fn.rt_parallax_apply_css = function( x, y )
2080		{ 
2081
2082			var is_rtl = $("body").hasClass("rtl");
2083
2084			//if it is rtl language make it reverse
2085			x = is_rtl ? -1 * x : x; 
2086
2087			$(this).css({ 
2088				"-webkit-transform": "translate("+x+"px, "+y+"px)",
2089				"-moz-transform": "translate("+x+"px, "+y+"px)",
2090				"-ms-transform": "translate("+x+"px, "+y+"px)",
2091				"-o-transform": "translate("+x+"px, "+y+"px)",
2092				"transform": "translate("+x+"px, "+y+"px)" 
2093			});
2094 
2095		}		
2096	}
2097
2098
2099	if ( $.fn.rt_parallax_backgrounds ) {  
2100
2101		$(window).on('resize', function() {     
2102			$('.rt-parallax-background').rt_parallax_backgrounds();   
2103
2104			if( ! Modernizr.touch ){
2105				window.scrollTo(0,0);			
2106			}
2107
2108		});	
2109
2110		//start first to get rid of white images
2111		imagesLoaded( "body" ).on('done', function( instance ) {
2112			$('.rt-parallax-background').rt_parallax_backgrounds();   
2113		}); 
2114	}
2115
2116
2117	/* ******************************************************************************* 
2118
2119		RT Fixed Rows  
2120
2121	********************************************************************************** */
2122
2123	$.fn.rt_fixed_rows = function( action ) {
2124
2125		function fix_heights(row) {
2126			row.each(function(){
2127
2128				var this_row_height = $(this).height();
2129
2130				if( Modernizr.csstransforms3d ){
2131					$(this).find(" > .wpb_column,  > .col").css({'min-height': this_row_height });
2132				}else{//ie9 or before
2133					$(this).find(" > .wpb_column,  > .col").css({'height': this_row_height });
2134				}
2135
2136			});	
2137		}
2138
2139		function reset_heights(row) {
2140			row.each(function(){
2141
2142				var this_row_height = $(this).height();
2143				if( Modernizr.csstransforms3d ){
2144					$(this).find(" > .wpb_column, > .col").css({'min-height': "auto" });
2145				}else{//ie9 or before
2146					$(this).find(" > .wpb_column, > .col").css({'height': "auto" });
2147				}
2148
2149			});	
2150
2151			row.rt_fixed_rows("load");
2152		}
2153		
2154		if( action == "reset"){
2155			$(this).each(function(){
2156				if( $(this).children(".content_row_wrapper").length > 0 ){
2157					reset_heights( $(this).children(".content_row_wrapper") );
2158				}
2159
2160				if( $(this).find(".content_row").length > 0 ){
2161					reset_heights( $(this).find(".content_row") );
2162				}
2163
2164				if( $(this).find(".row").length > 0 ){
2165					reset_heights( $(this).find(".row") );
2166				}
2167
2168				reset_heights( $(this) );
2169			}); 		
2170		}
2171
2172		if( $(window).width() < 767 ){
2173			return false;
2174		} 
2175
2176		if( action == "load"){
2177			$(this).each(function(){
2178				if( $(this).children(".content_row_wrapper").length > 0 ){
2179					fix_heights( $(this).children(".content_row_wrapper") );
2180				}
2181
2182				if( $(this).find(".content_row").length > 0 ){
2183					fix_heights( $(this).find(".content_row") );
2184				}
2185
2186				if( $(this).find(".row").length > 0 ){
2187					fix_heights( $(this).find(".row") );
2188				}
2189
2190				fix_heights( $(this) );
2191			}); 
2192		}
2193
2194	}; 
2195
2196	//run the script
2197	Pace.on('hide', function(){
2198		$('.fixed_heights').rt_fixed_rows("load");
2199
2200		//run the script
2201		$(window).on('window_width_resize', function() { 
2202			setTimeout(function() {
2203				$('.fixed_heights').rt_fixed_rows("reset"); 
2204			}, 700);			
2205		});		
2206  
2207	});
2208
2209
2210	/* ******************************************************************************* 
2211
2212		MASONRY LAYOUTS
2213
2214	********************************************************************************** */  
2215
2216	$.fn.rt_run_masonry_isotope = function(options) {
2217		
2218		$(this).each(function(){
2219			var $container = $(this),
2220				$filter_navigation = $('[data-list-id="'+$(this).attr("id")+'"]'),
2221				colWidth = function () {
2222					var w = $container.width(), 
2223						columnNum = $container.attr("data-column-width"),
2224						columnWidth = Math.floor( w / columnNum );
2225
2226						//fix column width
2227						if( w === (columnWidth * columnNum)){
2228							columnWidth = columnWidth - 0.5; 
2229						}
2230
2231						//draw the lines
2232						$container.rt_vertical_lines({
2233							"w": w,
2234							"columnNum" : columnNum
2235						});
2236
2237						return columnWidth;
2238				},
2239				isotope = function () {
2240					$container.isotope({
2241						resizable: false,
2242						itemSelector: '.isotope-item',
2243						masonry: {
2244							columnWidth: colWidth(),
2245							gutterWidth: 0
2246						}
2247					});
2248				};
2249				isotope();
2250
2251				//filter nativation
2252				$filter_navigation.rt_filter_nav( $container );				
2253		});
2254
2255	}; 
2256
2257	$.fn.rt_run_grid_isotope = function(options) {
2258		var $container = $(this),
2259			$filter_navigation = $(".filter-holder"),
2260			colWidth = function () {
2261				var w = $container.width(), 
2262					columnNum = $container.attr("data-column-width"),
2263					columnWidth = Math.floor( w/columnNum );
2264
2265					//fix column width
2266					if( w === (columnWidth * columnNum)){
2267						columnWidth = columnWidth - 0.5; 
2268					}
2269						
2270					return columnWidth;
2271			},
2272			isotope = function () {
2273				$container.isotope({
2274					resizable: false,
2275					itemSelector: '.col',
2276					layoutMode: 'fitRows' 
2277				});
2278			};
2279		isotope();
2280
2281		//filter nativation
2282		$filter_navigation.rt_filter_nav( $container );
2283
2284	}; 
2285
2286	//a function for drawing vertical lines to masonry layouts
2287	$.fn.rt_vertical_lines = function(options) {
2288 
2289		var options = $.extend({
2290			w: 980,
2291			columnNum: 3,
2292		}, options);
2293
2294		//clear newlines first for winresize
2295		$(this).find(".vertical_line").remove();
2296
2297		//create new 
2298		var new_line = $('<div class="vertical_line"></div>');
2299
2300		for (var i = 1; i < options["columnNum"]; i++) {
2301			
2302			new_line.clone().css({"left": ( options["w"] / options["columnNum"] ) * i + "px"}).prependTo( $(this) );
2303
2304		};
2305
2306	}; 
2307
2308	//a function for filter navigation classes on click
2309	$.fn.rt_filter_nav = function( $container ) {
2310 
2311		var $optionLinks = $(this).find('a');
2312
2313		$optionLinks.click(function(){
2314			var $this = $(this),
2315				selector = $(this).attr('data-filter'); 
2316
2317			//filter items
2318			$container.isotope({ filter: selector });
2319
2320			// add active class to the navigation item
2321			if ( $this.hasClass('active') ) {
2322				// don't proceed if the current item already selected
2323				return false;
2324			}
2325
2326			var $optionSet = $this.parents('.filter_navigation');
2327			$optionSet.find('.active').removeClass('active');
2328			$this.addClass('active');
2329
2330			return false;
2331		}); 
2332
2333	}; 
2334
2335
2336	//start isotopes
2337	$(window).on('load window_width_resize', function() {  
2338		$('.masonry').rt_run_masonry_isotope();
2339		$('.border_grid.filterable').rt_run_grid_isotope();
2340	});
2341
2342
2343
2344	/* ******************************************************************************* 
2345
2346		FIX IE FIXED BACKGROUND BUG
2347
2348	********************************************************************************** */
2349		if(navigator.userAgent.match(/Trident\/7\./)) { // if IE
2350 
2351			$('body').on("mousewheel", function () {
2352				// remove default behavior
2353				event.preventDefault(); 
2354
2355				//scroll without smoothing
2356				var wheelDelta = event.wheelDelta;
2357				var currentScrollPosition = window.pageYOffset;
2358				window.scrollTo(0, currentScrollPosition - wheelDelta);
2359			});
2360		}
2361
2362
2363})(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.